Links

Reference

Table of contents

mod

Automated code remediation.

Usage

mod [parameters] [subcommands]

Options

Name
Description
--version
Display version info.

Subcommands

  • build: Generates LST artifacts for one or more repositories.
  • clean: Clean build and run artifacts produced by the CLI.
  • config: Global configuration options that are required by some CLI commands.
  • exec: Execute an arbitrary shell command recursively on selected repository roots.
  • git: Multi-repository git operations.
  • log: Manages a log aggregate.
  • list: Lists the repositories that can be built and published.
  • monitor: (INCUBATING) Launches an HTTP server used to monitor the CLI.
  • publish: Publishes the LST artifacts for one or more projects.
  • run: Runs an OpenRewrite recipe locally on pre-built LSTS.
  • run-history: Get information about the most recent recipe runs.
  • study: Produces studies from OpenRewrite recipe data tables locally.
  • generate-completion

mod build

Generates LST artifacts for one or more repositories.
Once generated, the artifacts can be uploaded to your artifact management tool so that Moderne can ingest them or they can be used to run recipes locally.
While it is possible to manually build and publish your artifacts, we strongly recommend setting up a Jenkins pipeline or GitHub actions for ingesting LST artifacts in bulk.
If the path itself is not a Git repository, then this command will recursively look through the directories to find Git repositories that match the repository-* options.
If this command executes successfully, the LST artifact for each project will be stored in a .moderne/build directory inside of each repository that is built.
If you've set up a connection with Moderne (by running the mod config moderne command), this command will attempt to download LST artifacts from Moderne instead of building them locally. This will allow you to quickly run recipes and make changes. If you do not want this command to look for LST artifacts in Moderne, you can add the --no-download flag.

Usage

mod build [parameters]

Examples

mod build /path/to/project

Parameters

Name
Description
path
The absolute or relative path on disk to a directory containing one or more checked-out Git repositories that you want to operate on. This typically takes the form of targeting a single, checked-out copy of a Git repository or it can be a folder containing a collection of Git repositories that will be discovered by recursively scanning the initial provided directory.

Options

Name
Description
Example
--dry-run
Do not actually build the LST(s), but list the steps that would be required to do so.
--no-download
Do not attempt to download LSTs from Moderne.
--offline
When an underlying build tool has an offline mode, enable it.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite

mod clean

Clean build and run artifacts produced by the CLI.
Can be filtered to only clean certain artifacts.

Usage

mod clean [parameters] [subcommands]

Examples

mod clean builds /path/to/project --keep 1

Subcommands

  • builds: Clean build artifacts produced by the CLI.
  • runs: Clean run artifacts produced by the CLI.

mod clean builds

Clean build artifacts produced by the CLI.
Can be filtered to only clean certain artifacts.

Usage

mod clean builds [parameters]

Examples

mod clean builds /path/to/project --keep 1

Parameters

Name
Description
path
The absolute or relative path on disk to a directory containing one or more checked-out Git repositories that you want to operate on. This typically takes the form of targeting a single, checked-out copy of a Git repository or it can be a folder containing a collection of Git repositories that will be discovered by recursively scanning the initial provided directory.

Options

Name
Description
Example
--keep
Keep this many run artifacts and clean all others.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite

mod clean runs

Clean run artifacts produced by the CLI.
Can be filtered to only clean certain artifacts.

Usage

mod clean runs [parameters]

Examples

mod clean runs /path/to/project --keep 1

Parameters

Name
Description
path
The absolute or relative path on disk to a directory containing one or more checked-out Git repositories that you want to operate on. This typically takes the form of targeting a single, checked-out copy of a Git repository or it can be a folder containing a collection of Git repositories that will be discovered by recursively scanning the initial provided directory.

Options

Name
Description
Example
--keep
Keep this many run artifacts and clean all others.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite

mod config

Global configuration options that are required by some CLI commands.
Configuration set here is used as needed in all subsequent commands.

Usage

mod config [parameters] [subcommands]

Examples

mod config moderne edit --api <tenant-api-gateway> --token <token>

Subcommands

  • build: Configures build tools used to produce LSTs.
  • artifacts: Configures the storage layer for LSTs to be published to and downloaded from.
  • environment: The build environment that the CLI is running in.
  • http: Configures HTTP options that will be used throughout the CLI.
  • java: Configures Java options used for building LSTs and running recipes.
  • lsts: Configures LSTs production and publishing.
  • moderne: Configures the connection to Moderne. Must be configured before you can install and run recipes.
  • recipes: Configures the recipe marketplace available to the CLI. Must be configured before you can run recipes.
  • scm: Configures source code management.
  • user: Configure the active user.

mod config build

Configures build tools used to produce LSTs.

Usage

mod config build [parameters] [subcommands]

Subcommands

  • active-styles: Configure the active styles to use when building LSTs.
  • bazel: Configures the Bazel build tool.
  • gradle: Configures Gradle as it is used to resolve recipe dependencies and when running recipes.
  • maven: Configures Maven as it is used for LST production, resolving recipe dependencies, and when running recipes.

mod config build active-styles

Configure the active styles to use when building LSTs.
Overriding active styles circumvents auto-detection of styles in the production of LSTs.

Usage

mod config build active-styles [parameters] [subcommands]

Subcommands

  • delete: Removes overriding active styles.
  • edit: Configure the active styles to use when building LSTs.
  • show: Displays the configured overriding active styles.

mod config build active-styles delete

Removes overriding active styles.

Usage

mod config build active-styles delete [parameters]

Options

Name
Description
Example
--local
Configuration relevant to a specific group of repositories.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite
--save
When applied to a group of repositories, indicates that the configuration should be placed in a .modernecfg which can be committed to source control. When applied to global configuration, this option has no effect.

mod config build active-styles edit

Configure the active styles to use when building LSTs.
Overriding active styles circumvents auto-detection of styles in the production of LSTs.

Usage

mod config build active-styles edit [parameters]

Parameters

Name
Description
activeStyles
Additional build arguments that are added to the end of the Gradle command line.

Options

Name
Description
Example
--local
Configuration relevant to a specific group of repositories.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite
--save
When applied to a group of repositories, indicates that the configuration should be placed in a .modernecfg which can be committed to source control. When applied to global configuration, this option has no effect.

mod config build active-styles show

Displays the configured overriding active styles.

Usage

mod config build active-styles show [parameters]

Options

Name
Description
Example
--local
Configuration relevant to a specific group of repositories.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite
--save
When applied to a group of repositories, indicates that the configuration should be placed in a .modernecfg which can be committed to source control. When applied to global configuration, this option has no effect.

mod config build bazel

Configures the Bazel build tool.

Usage

mod config build bazel [parameters] [subcommands]

Examples

mod config build bazel rule edit "//:java-maven-lib"

Subcommands

  • rule: Configure the Bazel rule used to build LSTs.

mod config build bazel rule

Configure the Bazel rule used to build LSTs.
The rule affects how the project is built.

Usage

mod config build bazel rule [parameters] [subcommands]

Subcommands

  • delete: Removes Bazel build rule customization.
  • edit: Configure Bazel build rule.
  • show: Displays the configured Bazel build rule.

mod config build bazel rule delete

Removes Bazel build rule customization.

Usage

mod config build bazel rule delete [parameters]

Options

Name
Description
Example
--local
Configuration relevant to a specific group of repositories.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite
--save
When applied to a group of repositories, indicates that the configuration should be placed in a .modernecfg which can be committed to source control. When applied to global configuration, this option has no effect.

mod config build bazel rule edit

Configure Bazel build rule.

Usage

mod config build bazel rule edit [parameters]

Parameters

Name
Description
rule
The Bazel build rule to use when building LSTs.

Options

Name
Description
Example
--local
Configuration relevant to a specific group of repositories.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite
--save
When applied to a group of repositories, indicates that the configuration should be placed in a .modernecfg which can be committed to source control. When applied to global configuration, this option has no effect.

mod config build bazel rule show

Displays the configured Bazel build rule.

Usage

mod config build bazel rule show [parameters]

Options

Name
Description
Example
--local
Configuration relevant to a specific group of repositories.
--repository-branch
Restricts the command to only run against repositories that are currently on this branch.
main
--repository-origin
Restricts the command to only run against repositories that have an origin that matches this. Supports partial matches (e.g., if the origin is [email protected]:foo/bar - all of the following would match this: github.com:foo/bar, github.com, foo, and foo/bar).
github.com
--repository-path
Restricts the command to only run against repositories that have a path (a combination of the organization/project and the repository name) that matches this. Supports partial matches (e.g., if the repository is in the foo organization and is called bar - all of the following would match this: foo/bar, foo/.*, foo, and bar).
openrewrite/rewrite
--save
When applied to a group of repositories, indicates that the configuration should be placed in a .modernecfg which can be committed to source control. When applied to global configuration, this option has no effect.

mod config build gradle

Configures Gradle as it is used to resolve recipe dependencies and when running recipes.

Usage

mod config build gradle [parameters] [subcommands]

Examples

mod config build gradle arguments edit --refresh-dependencies

Subcommands

  • arguments: Configure Gradle build arguments.

mod config build gradle arguments

Configure Gradle build arguments.
Build arguments are added to the end of the Gradle command line when building LSTs.

Usage