Scripting and CI automation

Before running moi-cli in a script or CI job, configure the Product API endpoint and personal access token. Workspace-scoped commands also need a workspace. The CLI can read saved configuration, or you can provide -endpoint, -api-key, and -workspace-id for one command. See Configuration and authentication.

Output JSON

Add -o before the command when a later program needs to read its result. For example, save the accessible workspace list as JSON:

set -e
moi-cli -o workspace list > workspaces.json

On success, the command writes the result to workspaces.json. If it fails, set -e stops the script. Parse the JSON instead of extracting resource IDs or status from the human-readable default output.

Current limitation of -no-interactive

moi-cli accepts the global -no-interactive option, intended to disable interactive prompts such as pagination. Current task commands do not change their behavior based on this option. Do not rely on it to bypass confirmations or to ensure that a CI job cannot wait for input.

Before creating, deleting, publishing, subscribing, pausing, resuming, rerunning, or cancelling resources, confirm the target workspace, resource ID, and impact in the script.

Protect credentials

  • Do not commit personal access tokens to source control.

  • Do not print complete command lines, ~/.moi-cli.json, or unredacted command results in CI logs.

  • Record resource IDs, task IDs, status, and non-sensitive error summaries for later investigation.

Next steps

Last updated on