### Install Nyx Version Package Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/developer/go/semantic-version.mdx Use 'go get' to install the version module locally. ```sh go get github.com/mooltiverse/nyx/src/go/version ``` -------------------------------- ### Install Nyx Go Module Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/developer/go/nyx-main.mdx Use 'go get' to install the Nyx module locally for use in your Go projects. ```sh go get github.com/mooltiverse/nyx/src/go/nyx/nyx ``` -------------------------------- ### Initialize Nyx with Simple Preset Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/quick-start/command-line.mdx Use the 'simple' preset to quickly configure Nyx with Conventional Commits and basic release types. This is a good starting point to avoid complex setup. ```sh nyx --preset=simple ``` -------------------------------- ### YAML Configuration File Example Source: https://context7.com/mooltiverse/nyx/llms.txt A comprehensive example of a Nyx configuration file (`.nyx.yaml`) demonstrating presets, changelog settings, commit message conventions, and service configurations. ```yaml # .nyx.yaml - Complete configuration example preset: "simple" # Start from 'simple' or 'extended' preset dryRun: false resume: true stateFile: "build/.nyx-state.json" summaryFile: "build/.nyx-summary.txt" releasePrefix: "v" releaseLenient: true verbosity: "INFO" # Changelog configuration changelog: path: "CHANGELOG.md" template: "config/CHANGELOG.tpl" sections: "Added": "^feat$" "Fixed": "^fix$" "Changed": "^refactor$" "Deprecated": "^deprecate$" "Removed": "^remove$" "Security": "^security$" substitutions: "(?m)#([0-9]+)(?s)": "[#%s](https://github.com/myorg/myrepo/issues/%s)" # Commit message conventions commitMessageConventions: enabled: - conventionalCommits - gitmoji items: conventionalCommits: expression: "(?m)^(?[a-zA-Z0-9_]+)(\((?[a-zA-Z0-9_]+)\))?(!)?:( )+(?.+)$" bumpExpressions: major: "(?s)(?m)^[a-zA-Z0-9_]+(\([a-zA-Z0-9_]+\))?!: .+$" minor: "(?s)(?m)^feat(\([a-zA-Z0-9_]+\))?: .+$" patch: "(?s)(?m)^fix(\([a-zA-Z0-9_]+\))?: .+$" ``` -------------------------------- ### Build Project with Gradle Source: https://github.com/mooltiverse/nyx/blob/main/RUNBOOK.md Use this command to build the entire project. Ensure Gradle is installed and accessible in your PATH. ```bash # Build the whole project ./gradlew build ``` -------------------------------- ### Start Docusaurus Development Server Source: https://github.com/mooltiverse/nyx/blob/main/RUNBOOK.md This script starts the Docusaurus development server. It requires Node.js and npm. Ensure you are in the 'docs/main' directory and set the DOCUSAURUS_PORT environment variable. ```bash export DOCUSAURUS_PORT=3000 # Start the Docusaurus development server cd docs/main npm run start -- --host 0.0.0.0 --port $DOCUSAURUS_PORT ``` -------------------------------- ### Go Library Integration Example Source: https://context7.com/mooltiverse/nyx/llms.txt Demonstrates full programmatic control over Nyx configuration and release process in a Go application. Requires importing Nyx and related configuration and entities packages. ```go package main import ( "fmt" "log" nyx "github.com/mooltiverse/nyx/src/go/nyx/nyx" cnf "github.com/mooltiverse/nyx/src/go/nyx/configuration" ent "github.com/mooltiverse/nyx/src/go/nyx/entities" ) func main() { // Simple one-liner release // n := nyx.NewNyx() // n.Publish() // Full control example n := nyx.NewNyxIn("/path/to/project") // Create and configure a configuration layer configLayer := cnf.NewSimpleConfigurationLayer() dryRun := true prefix := "v" verbosity := ent.INFO preset := "extended" configLayer.SetDryRun(&dryRun) configLayer.SetReleasePrefix(&prefix) configLayer.SetVerbosity(&verbosity) configLayer.SetPreset(&preset) // Inject configuration at command-line level (highest priority) var cl cnf.ConfigurationLayer = configLayer n.Configuration().WithCommandLineConfiguration(&cl) // Run inference to compute version if err := n.Infer(); err != nil { log.Fatalf("Infer failed: %v", err) } // Access state information state := n.State() branch, _ := state.GetBranch() version, _ := state.GetVersion() newRelease, _ := state.GetNewRelease() bump, _ := state.GetBump() fmt.Printf("Branch: %s\n", *branch) fmt.Printf("Version: %s\n", *version) fmt.Printf("New Release: %t\n", *newRelease) if bump != nil { fmt.Printf("Bump: %s\n", *bump) } // Access the Git repository repo := n.Repository() // Create a custom commit if needed // repo.Commit("Custom commit message") // Only proceed with release if there's a new version if *newRelease { // Generate changelog if err := n.Make(); err != nil { log.Fatalf("Make failed: %v", err) } // Create tag and push if err := n.Mark(); err != nil { log.Fatalf("Mark failed: %v", err) } // Publish to configured services if err := n.Publish(); err != nil { log.Fatalf("Publish failed: %v", err) } fmt.Println("Release published successfully!") } else { fmt.Println("No new release needed") } } ``` -------------------------------- ### Start Docusaurus Documentation Site Source: https://github.com/mooltiverse/nyx/blob/main/CONTRIBUTING.md Run this command in the `docs/main` directory to test the documentation site locally. Open `http://localhost:3000/` to view changes. ```shell $ npm run start ``` -------------------------------- ### Gradle Configuration Example Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/introduction/configuration-methods.mdx Shows how to configure Nyx within Gradle build scripts using the `nyx` extension block. Note the specific syntax for lists and maps. ```groovy nyx { simpleOption = '<VALUE>' section { simpleNestedOption = '<VALUE>' } listOption = ['<VALUE1>', '<VALUE2>', '<VALUEN>'] objectsListOption { "<NAME1>" { option1 = "<VALUE>" option2 = "<VALUE>" } "<NAME2>" { option1 = "<VALUE>" option2 = "<VALUE>" } "<NAME3>" { option1 = "<VALUE>" option2 = "<VALUE>" } } mapOption { "<NAME1>" = "<VALUE>" "<NAME2>" = "<VALUE>" "<NAME3>" = "<VALUE>" } objectsMapOption { "<NAME1>" { option1 = "<VALUE>" option2 = "<VALUE>" } "<NAME2>" { option1 = "<VALUE>" option2 = "<VALUE>" } "<NAME3>" { option1 = "<VALUE>" option2 = "<VALUE>" } } } ``` -------------------------------- ### Example Summary File Content Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/configuration-reference/global-options.mdx This is an example of the content found in the summary file generated by Nyx. It includes various state attributes as key-value pairs. ```properties branch = main bump = minor core version = true latest version = true new release = true new version = true scheme = SEMVER timestamp = 1591802533 current version = 1.2.3 previous version = 1.2.2 prime version = 1.2.2 ``` -------------------------------- ### Checkout and Setup for Pre-release in GitHub Actions Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/combined-use-examples.mdx Checks out the repository with full history and sets up Java 20 for a pre-release job. It restores the Nyx state from the cache. ```yaml - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up JDK 20 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 20 - name: Set up the Nyx state cache uses: actions/cache@v4 with: path: | build/ key: nyx-state restore-keys: | nyx-state - name: Pre release run: ./gradlew preRelease ``` -------------------------------- ### Java Library Integration Example Source: https://context7.com/mooltiverse/nyx/llms.txt Shows how to use the Nyx Java library for full control over release management. Includes configuration, inference, state access, and publishing steps. Uses SLF4J for logging. ```java import com.mooltiverse.oss.nyx.Nyx; import com.mooltiverse.oss.nyx.configuration.SimpleConfigurationLayer; import com.mooltiverse.oss.nyx.state.State; import java.io.File; public class ReleaseManager { public static void main(String[] args) throws Exception { // Simple one-liner release // new Nyx().publish(); // Full control example File projectDir = new File("/path/to/project"); Nyx nyx = new Nyx(projectDir); // Create and configure a configuration layer SimpleConfigurationLayer configLayer = new SimpleConfigurationLayer(); configLayer.setDryRun(Boolean.TRUE); configLayer.setReleasePrefix("v"); configLayer.setPreset("extended"); // Inject configuration at command-line level (highest priority) nyx.configuration().withCommandLineConfiguration(configLayer); // Run inference to compute version nyx.infer(); // Access state information State state = nyx.state(); String branch = state.getBranch(); String version = state.getVersion(); Boolean newRelease = state.getNewRelease(); String bump = state.getBump(); System.out.printf("Branch: %s%n", branch); System.out.printf("Version: %s%n", version); System.out.printf("New Release: %s%n", newRelease); System.out.printf("Bump: %s%n", bump); // Access the Git repository for custom operations // nyx.repository().commit("Custom commit message"); // Only proceed with release if there's a new version if (Boolean.TRUE.equals(newRelease)) { // Generate changelog nyx.make(); // Create tag and push nyx.mark(); // Publish to configured services nyx.publish(); System.out.println("Release published successfully!"); } else { System.out.println("No new release needed"); } } } // Maven dependency (pom.xml) /* <dependency> <groupId>com.mooltiverse.oss.nyx</groupId> <artifactId>main</artifactId> <version>3.1.7</version> </dependency> */ // Gradle dependency (build.gradle) // implementation 'com.mooltiverse.oss.nyx:main:3.1.7' ``` -------------------------------- ### Simplest Nyx Configuration in JSON Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/simplest-configuration-example.mdx This is the most basic Nyx configuration using the 'simple' preset. All other options will be set to their default values. Use this as a starting point for minimal setups. ```json { "preset": "simple" } ``` -------------------------------- ### Simplest Nyx Configuration in YAML Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/simplest-configuration-example.mdx This is the most basic Nyx configuration using the 'simple' preset. All other options will be set to their default values. Use this as a starting point for minimal setups. ```yaml preset: "simple" ``` -------------------------------- ### Simplest Nyx Configuration in Groovy (Gradle) Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/simplest-configuration-example.mdx This is the most basic Nyx configuration using the 'simple' preset. All other options will be set to their default values. Use this as a starting point for minimal setups. ```groovy nyx { preset 'simple' } ``` -------------------------------- ### Get Nyx CLI Help Source: https://context7.com/mooltiverse/nyx/llms.txt Displays the help information for the Nyx CLI, listing available commands and options. ```bash # Get help nyx --help ``` -------------------------------- ### Advanced Nyx Usage with Custom Configuration Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/developer/java/nyx-main.mdx This example demonstrates advanced usage where you can specify a custom directory, inject programmatic configuration, and run tasks individually. It also shows how to access the Git repository and internal state. ```java import com.mooltiverse.oss.nyx.Nyx; import com.mooltiverse.oss.nyx.configuration.SimpleConfigurationLayer; public class Test { static void main(String[] args) throws Exception { File customDirectory = new File("~/project"); Nyx nyx = new Nyx(customDirectory); // Nyx now runs on the '~/project' directory // Create a new configuration layer, set some options, and add it on top // of other layers at the 'command line' layer level SimpleConfigurationLayer configurationLayer = new SimpleConfigurationLayer(); configurationLayer.setDryRun​(Boolean.TRUE); // make it run dry configurationLayer.setReleasePrefix​("rel"); // make it use 'rel' as the prefix for generated versions nyx.configuration().withCommandLineConfiguration(configurationLayer); // inject the configuration nyx.infer(); // let Nyx infer values from the Git repository // now we have plenty of values in the State, let's read some... System.out.println(nyx.state().getBranch()); System.out.println(nyx.state().getVersion()); // it might be a good place to run some custom tasks of yours, i.e. using the Git Repository // let's say you create a RELEASE_NOTES.md file and want to commit it nyx.repository().commit​("Adding RELEASE_NOTES.md"); // then run the remaining tasks one by one nyx.make(); nyx.mark(); nyx.publish(); } } ``` -------------------------------- ### Publish Release to GitHub Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/quick-start/command-line.mdx Publish a new release to GitHub using the 'publish' command. This example configures the changelog as the release description and specifies GitHub as the publication service with necessary authentication and repository details. ```sh nyx --preset=simple --changelog-path=build/CHANGELOG.md --release-types-mainline-git-commit=true --release-types-mainline-description="{{#fileContent}}build/CHANGELOG.md{{/fileContent}}" --release-types-mainline-publication-services=github --services-github-type=GITHUB --services-github-options-AUTHENTICATION_TOKEN="<TOKEN>" --services-github-options-REPOSITORY_NAME="<REPO_NAME>" --services-github-options-REPOSITORY_OWNER="<REPO_OWNER>" publish ``` -------------------------------- ### Verify Gradle Plugin Setup Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/quick-start/gradle-plugin.mdx Run the `gradle tasks` command to confirm that the Nyx plugin has been successfully applied and its release tasks are available. This command lists all available tasks, including those provided by Nyx. ```bash $ gradle tasks > Task :tasks [...] Release tasks ------------- nyxClean - Deletes local release artifacts and reverts the release process to its initial state nyxInfer - Collects information from the local Git repository to generate the new version and plan the release actions nyxMake - Builds the configured local release artifacts nyxMark - Marks the release by tagging and committing the repository nyxPublish - Publishes the new release to remote services and emits notifications release - Runs all the release tasks [...] BUILD SUCCESSFUL in 280ms 1 actionable task: 1 executed ``` -------------------------------- ### Setup Java and Nyx Infer in GitHub Actions Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/combined-use-examples.mdx Sets up Java 20 and uses the Nyx GitHub Action to infer the initial release version and create a state file. The cache is used to store the Nyx state. ```yaml - name: Set up JDK 20 uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 20 - name: Set up the Nyx state cache uses: actions/cache@v4 with: path: | build/ key: nyx-state - name: Nyx Infer run: ./gradlew nyxInfer - name: Load Nyx data id: nyx uses: mooltiverse/nyx@main ``` -------------------------------- ### Integrate Nyx State with Gradle Tasks Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/quick-start/gradle-plugin.mdx This example demonstrates how to integrate Nyx's internal state into Gradle build scripts. It shows how to make a build task dependent on Nyx's publishing task and how to conditionally execute a release task only when Nyx determines a new version needs to be published. ```groovy // make myBuildTask depend on nyxPublish tasks.myBuildTask.dependsOn tasks.nyxPublish // nyxState.newRelease is true only when a new version has been generated and it must be published tasks.myReleaseTask.onlyIf { rootProject.nyxState.newRelease } ``` -------------------------------- ### Setting Nyx Global Options via Environment Variables Source: https://context7.com/mooltiverse/nyx/llms.txt Configure global Nyx behavior using environment variables. This example demonstrates setting options like preset, dry run mode, verbosity, directory, configuration file path, state file, summary file, release prefix, lenient release parsing, resume capability, semantic versioning scheme, initial version, and forcing a specific version bump. ```bash # Global options export NYX_PRESET="extended" export NYX_DRY_RUN="false" export NYX_VERBOSITY="INFO" export NYX_DIRECTORY="/path/to/project" export NYX_CONFIGURATION_FILE=".nyx.yaml" export NYX_STATE_FILE=".nyx-state.json" export NYX_SUMMARY_FILE=".nyx-summary.txt" export NYX_RELEASE_PREFIX="v" export NYX_RELEASE_LENIENT="true" export NYX_RESUME="true" export NYX_SCHEME="SEMVER" export NYX_INITIAL_VERSION="0.1.0" export NYX_BUMP="minor" # Force specific bump ``` -------------------------------- ### Simple Configuration in YAML Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/simple-configuration-example.mdx This YAML snippet provides a minimal Nyx configuration, employing the 'simple' preset and defining basic global settings. It's ideal for projects requiring a simple setup without extensive configuration. ```yaml --- preset: "simple" version: "1.0.0" ... ``` -------------------------------- ### Basic Version Inference with Nyx CLI Source: https://context7.com/mooltiverse/nyx/llms.txt Performs basic version inference using the 'simple' preset and displays inferred details. Ensure Nyx is installed and accessible in your PATH. ```bash # Basic version inference with simple preset nyx --preset=simple --summary infer # Output: # branch = main # bump = minor # core version = true # latest version = true # new release = true # new version = true # scheme = SEMVER # timestamp = 1692276827782 # current version = 1.2.3 # previous version = 1.2.2 # prime version = 1.2.2 ``` -------------------------------- ### Complex Templating Example in Nyx Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/configuration-reference/templates.mdx Demonstrates combining various state attributes, nested configurations, environment variables, and custom functions to generate multi-line text output. Useful for understanding template rendering capabilities. ```text Version: {{version}} (bumping '{{bump}}' on {{configuration.initialVersion}} using lenient ({{configuration.releaseLenient}})) Scheme: {{scheme}} Timestamp: {{timestamp}} OS: {{#environmentVariable}}OS{{/environmentVariable}} User: {{environmentUser}} Previous Version: {{releaseScope.previousVersion}} at {{#short5}}{{releaseScope.previousVersionCommit}}{{/short5}} Commits: {{#releaseScope.commits}} {{.}} {{/releaseScope.commits}} ``` ```text Version: 9.8.6 (bumping 'theta' on 1.2.3 using lenient (true)) Scheme: SEMVER Timestamp: 9223372036854775807 OS: Linux Users: jdoe Previous Version: 4.5.6 at 05cbf Commits: d40fcded9e516158a2901f5657794931528af106 9bed70fac8a27a4b14b6b12307d034bc59da85c3 ef6a6481adb2df26bc7eebfde465e5c2f3e93539 ``` -------------------------------- ### Publish Release with Nyx GitHub Action Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/quick-start/github-action.mdx This example demonstrates how to use Nyx to publish a release. It requires the `GH_TOKEN` secret and specifies a command, changelog path, preset, and other options. The `GH_TOKEN` must match the `AUTHENTICATION_TOKEN` in your Nyx configuration. ```yaml jobs: infer-version: name: Publish the release (if any) with Nyx runs-on: ubuntu-latest steps: - name: Git checkout uses: actions/checkout@v4 with: fetch-depth: 0 // highlight-start - name: Nyx publish id: nyx uses: mooltiverse/nyx@main env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NYX_VERBOSITY: 'INFO' with: command: 'publish' changelogPath: 'CHANGELOG.md' preset: 'extended' releaseLenient: 'true' stateFile: '.nyx-state.json' summaryFile: '.nyx-summary.txt' // highlight-end ``` -------------------------------- ### Conventional Commits Expression Example Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/configuration-reference/commit-message-conventions.mdx This is an example of a regular expression that adheres to the Conventional Commits specification, demonstrating the use of named capturing groups for type, scope, and title. It includes multi-line and single-line flags for broader matching. ```regex (?m)^(?<type>[a-zA-Z0-9_]+)(\((?<scope>[a-z ]+)\))?(!)?:( (?<title>.+))$(?s).* ``` -------------------------------- ### Import Nyx Go Package Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/developer/go/nyx-main.mdx Import the Nyx package into your Go source code to start using its functionalities. ```go import "github.com/mooltiverse/nyx/src/go/nyx/nyx" ``` -------------------------------- ### Simple Configuration in Groovy (Gradle) Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/simple-configuration-example.mdx This Groovy script demonstrates a minimal Nyx configuration within a Gradle context, using the 'simple' preset and essential global options. It's useful for projects managed by Gradle that need a straightforward configuration. ```groovy nyx { preset = "simple" version = "1.0.0" } ``` -------------------------------- ### Basic Nyx Publish Command Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/developer/go/nyx-main.mdx Instantiate the Nyx library and run the 'publish' command. This single line of code triggers infer, mark, and make tasks by default, using configurations from default locations. ```go package main import nyx "github.com/mooltiverse/nyx/src/go/nyx/nyx" func main() { n := nyx.NewNyx() // highlight-next-line err := n.Publish() // This is it! } ``` -------------------------------- ### Get Current System User with environmentUser Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/configuration-reference/templates.mdx Retrieve the current system username. Any provided value to this function is ignored. ```text user = "{{environmentUser}}" ``` ```text user = "{{#environmentUser}}{{/environmentUser}}" ``` -------------------------------- ### Command Line Execution of Nyx and Gradle Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/combined-use-examples.mdx Demonstrates running Nyx from the command line and then executing a Gradle task that utilizes Nyx's state. ```sh $ nyx $ ./gradlew preRelease Project version is: 1.2.3 ``` -------------------------------- ### environmentVariable - Get Environment Variable Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/configuration-reference/templates.mdx Retrieves the value of a specified environment variable. Returns an empty string if the variable is not found. ```APIDOC ## environmentVariable ### Description Returns the value of the environment variable used as parameter, if any. ### Method N/A (Templating Function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```text os = "{{#environmentVariable}}OS{{/environmentVariable}}" ``` ### Response #### Success Response (200) - **os** (string) - The value of the specified environment variable. #### Response Example ```json { "os": "Windows_NT" } ``` ``` -------------------------------- ### Basic Semantic Version Manipulation Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/developer/go/semantic-version.mdx Demonstrates parsing, bumping major/minor/prerelease versions, and setting build identifiers. Remember that SemanticVersion objects are immutable; methods return new objects. ```go package main import version "github.com/mooltiverse/nyx/src/go/version" func main() { // parse any string as a semantic version, in this case we use the default initial version "0.1.0" v1, err := version.ValueOfSemanticVersion(version.SEMANTIC_VERSION_DEFAULT_INITIAL_VERSION) // bump the MINOR number > "0.2.0" v2, err := v1.BumpMinor() // bump the MAJOR number > "1.0.0" v3, err := v2.BumpMajor() // bump the new pre-release identifier named 'alpha' > "1.0.0-alpha.1" v4, err := v3.BumpPrerelease("alpha") // bump the 'alpha' pre-release identifier again > "1.0.0-alpha.2" v5, err := v4.BumpPrerelease("alpha") // add the 'build' identifier and give it the '123' value > "1.0.0-alpha.2+build.123" v6, err := v5.SetBuild("build", "123") // and so on... } ``` -------------------------------- ### environmentUser - Get System User Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/configuration-reference/templates.mdx Returns the current system user's name. Any provided value to this function is ignored. ```APIDOC ## environmentUser ### Description Returns the current system user name. Example: ### Method N/A (Templating Function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```text user = "{{environmentUser}}" ``` or, if you prefer the open/close tags: ```text user = "{{#environmentUser}}{{/environmentUser}}" ``` ### Response #### Success Response (200) - **user** (string) - The current system user name. #### Response Example ```json { "user": "current_user" } ``` ``` -------------------------------- ### Get Environment Variable with environmentVariable Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/configuration-reference/templates.mdx Retrieve the value of a specified environment variable. Returns an empty string if the variable is not set. ```text os = "{{#environmentVariable}}OS{{/environmentVariable}}" ``` -------------------------------- ### Clean Eclipse Files with Gradle Source: https://github.com/mooltiverse/nyx/blob/main/CONTRIBUTING.md Use this command to remove previously generated Eclipse project files. This is part of the IDE setup process. ```shell # Clean previous files $ ./gradlew cleanEclipse ``` -------------------------------- ### Extended Configuration in YAML Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/extended-configuration-example.mdx This YAML configuration mirrors the JSON example, providing an alternative syntax for defining global options, commit conventions, and release types. ```yaml --- $schema: ../../.nyx-schema.json release: type: semver version: 1.0.0 commit: message: convention: angular types: - type: feat section: Features - type: fix section: Bug Fixes - type: chore section: Chores hidden: true - type: docs section: Documentation commit: false - type: style section: Styling commit: false - type: refactor section: Code Refactoring commit: false - type: perf section: Performance Improvements commit: false - type: test section: Tests commit: false changelog: header: "# Changelog" introduction: "This is an example of a changelog generated by Nyx." footer: "" groups: - title: "### Breaking Changes" commits: - type: feat section: Features - type: fix section: Bug Fixes commit: message: template: "- {{ type }}: {{ subject }}" template: file: ../../.nyx-template.md ``` -------------------------------- ### Basic Nyx Publish Command Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/developer/java/nyx-main.mdx This is the simplest way to use the Nyx library. It loads default configurations and runs the publish command, which includes infer, mark, and make. ```java import com.mooltiverse.oss.nyx.Nyx; public class Test { static void main(String[] args) throws Exception { // highlight-next-line new Nyx().publish(); // This is it! } } ``` -------------------------------- ### Pull Nyx Docker Image from Docker Hub Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/quick-start/docker-container.mdx Fetches the latest Nyx Docker image from Docker Hub. Ensure Docker is installed and you have basic familiarity with its commands. ```bash $ docker pull mooltiverse/nyx:latest latest: Pulling from mooltiverse/nyx ab6db1bc80d0: Pull complete [...] Digest: sha256:976f4821d643e02fc55c884cd6c9af5e958011132145150b7dd97e01d71ba055 Status: Downloaded newer image for mooltiverse/latest mooltiverse/latest ``` -------------------------------- ### Run Nyx Docker Container for Inference Source: https://context7.com/mooltiverse/nyx/llms.txt Executes version inference within a Docker container by mounting the local project directory. Ensure Docker is installed and running. ```bash # Pull the latest image docker pull mooltiverse/nyx:latest # Run version inference on local project docker run -it --rm \ -v /path/to/your/project:/project \ mooltiverse/nyx:latest infer ``` -------------------------------- ### Run Gradle Tests Source: https://github.com/mooltiverse/nyx/blob/main/CONTRIBUTING.md Execute Gradle tests using the standard Gradle wrapper command. This command initiates the testing process for the project. ```bash $ ./gradlew test ``` -------------------------------- ### Get File Content with fileContent Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/user/configuration-reference/templates.mdx Retrieves the entire content of a specified text file. Supports relative and absolute paths. Ensure the file is text-based and not excessively large. ```text filecontent = "{{#fileContent}}example.txt{{/fileContent}}" ``` -------------------------------- ### Run Tests with Gradle Source: https://github.com/mooltiverse/nyx/blob/main/RUNBOOK.md Commands to execute various test suites. Use './gradlew tests' for all tests, or specific commands for unit, integration, or functional tests. ```bash # Run all tests ./gradlew tests ``` ```bash # Run all unit tests ./gradlew unitTest ``` ```bash # Run all integration tests ./gradlew integrationTest ``` ```bash # Run all functional tests ./gradlew functionalTest ``` -------------------------------- ### Extended Configuration in JSON Source: https://github.com/mooltiverse/nyx/blob/main/docs/main/docs/resources/examples/extended-configuration-example.mdx Use this JSON configuration for complex setups without presets. It explicitly defines global options, commit message conventions, and release types. ```json { "$schema": "../../.nyx-schema.json", "release": { "type": "semver", "version": "1.0.0" }, "commit": { "message": { "convention": "angular", "types": [ { "type": "feat", "section": "Features" }, { "type": "fix", "section": "Bug Fixes" }, { "type": "chore", "section": "Chores", "hidden": true }, { "type": "docs", "section": "Documentation", "commit": false }, { "type": "style", "section": "Styling", "commit": false }, { "type": "refactor", "section": "Code Refactoring", "commit": false }, { "type": "perf", "section": "Performance Improvements", "commit": false }, { "type": "test", "section": "Tests", "commit": false } ] } }, "changelog": { "header": "# Changelog", "introduction": "This is an example of a changelog generated by Nyx.", "footer": "", "groups": [ { "title": "### Breaking Changes", "commits": [ { "type": "feat", "section": "Features" }, { "type": "fix", "section": "Bug Fixes" } ] } ], "commit": { "message": { "template": "- {{ type }}: {{ subject }}" } } }, "template": { "file": "../../.nyx-template.md" } } ``` -------------------------------- ### Run Gradle Documentation Build Source: https://github.com/mooltiverse/nyx/blob/main/CONTRIBUTING.md Ensure that running the Gradle documentation build command does not introduce errors. ```shell ./gradlew docs:build ``` -------------------------------- ### Generate Eclipse Project Files with Gradle Source: https://github.com/mooltiverse/nyx/blob/main/CONTRIBUTING.md Run this command to generate or update Eclipse project files based on Gradle definitions. Ensure Gradle is installed and the project is configured. ```shell # Generate the files from Gradle definitions $ ./gradlew eclipse ```