NewDash Dots are hereMini apps in Dash, with payments built inLearn more

Developer Resources · CLI

CI and scripts

Run the Monime CLI without a browser using an access token, read JSON or YAML output, and handle exit codes in scripts and CI pipelines.

Browser login is for people. On build servers and in scripts, give the CLI an access token through the environment, turn off prompts, and read structured output.

Authenticate with an access token

Create an access token

In the dashboard, open Developer → Access Tokens and create a token with only the permissions your pipeline needs. See Personal Access Tokens.

Store it as a secret

Save the token in your CI provider's secret store, and expose it to the job as MONIME_ACCESS_TOKEN.

Name the Space

Pass --space, or set MONIME_CORE_SPACE, so the job does not depend on a saved configuration.

Terminal
export MONIME_ACCESS_TOKEN=…   # from your CI provider's secret store
monime space list --space spc-k6Em1Aap25VZ8oWg7ajhxHX3JqF -o json

MONIME_ACCESS_TOKEN takes the place of stored logins: when it is set, the CLI uses it instead of the Monimeer you logged in as.

Example: GitHub Actions

.github/workflows/monime.yml
jobs:
  check:
    runs-on: ubuntu-latest
    env:
      MONIME_ACCESS_TOKEN: ${{ secrets.MONIME_ACCESS_TOKEN }}
      MONIME_CORE_SPACE: ${{ vars.MONIME_SPACE_ID }}
      MONIME_NO_UPDATE_NOTIFIER: "1"
    steps:
      - name: Install the Monime CLI
        run: |
          curl -fsSL https://cli.monime.io/install.sh \
            | MONIME_NO_MODIFY_PATH=1 sh
          echo "$HOME/.local/bin" >> "$GITHUB_PATH"
      - name: Check access
        run: monime status -o json

Prompts

The CLI never prompts when it is not attached to a terminal. In a terminal, add --quiet (or set MONIME_CORE_DISABLE_PROMPTS=true) to use default answers instead; a command that needs an answer and has no default fails rather than waiting.

Machine-readable output

Commands that print data accept -o (--output):

FormatUse it for
tableReading in a terminal (the default)
wideA table with extra columns
jsonScripts and tools such as jq
yamlConfig files and human-readable diffs
Terminal
# The IDs of every Space you belong to
monime space list -o json | jq -r '.[].id'

# The ID of the active Space
monime space list -o json | jq -r '.[] | select(.active) | .id'

Add --no-headers to table output when you pipe it into tools such as awk or cut.

Exit codes

CodeMeaning
0Success
1The command failed
2Usage error, such as an unknown flag or a missing argument
4Authentication is needed: you are not logged in, the login expired, or the access token was rejected
130Cancelled, for example with Ctrl+C
Terminal
if ! monime status > /dev/null 2>&1; then
  echo "Log in with: monime login" >&2
  exit 1
fi

Useful environment variables

VariableWhat it does
MONIME_ACCESS_TOKENAuthenticate with this access token instead of a stored login
MONIME_CORE_SPACEThe Space to operate in
MONIME_ACTIVE_CONFIGThe named configuration to use
MONIME_CORE_DISABLE_PROMPTSSet to true to turn off prompts
MONIME_CORE_VERBOSITYLog level on stderr: debug, info, warning, error or none
MONIME_CONFIG_DIRThe folder the CLI keeps its configurations in
MONIME_NO_UPDATE_NOTIFIERSet to 1 to turn off the new-release notice

Every property also has its own variable; see Configuration.

Keep reading