Skip to content

CLI Usage

erode provides four commands for working with architecture models and analyzing change requests.

erode is not yet published as an npm package. Clone the repository and build from source:

Terminal window
git clone https://github.com/erode-app/core.git
cd core
npm install && npm run build

The built CLI is at packages/cli/dist/cli.js. Run it with Node.js:

Terminal window
node packages/cli/dist/cli.js --help

When run without arguments in an interactive terminal, erode starts an Ink-based wizard that guides you through command selection and option entry.

Analyze a change request for architecture drift.

Terminal window
erode analyze ./model --url https://github.com/org/repo/pull/42
erode analyze ./model --url https://gitlab.com/group/project/-/merge_requests/42
erode analyze ./model --url https://bitbucket.org/workspace/repo/pull-requests/42
FlagDescriptionDefault
--url <url>Change request URL (GitHub PR, GitLab MR, or Bitbucket PR). Required.
--model-format <fmt>Architecture model formatlikec4
--format <fmt>Output format: console, jsonconsole
--generate-modelGenerate architecture model code from the analysis
--open-prCreate a PR with suggested model updates
--dry-runPreview without creating a PR
--draftCreate change request as drafttrue
--output-file <path>Write structured JSON output to a file
--skip-file-filteringAnalyze all changed files (skip pattern-based filtering)
--commentPost analysis results as a PR/MR comment
--github-actionsWrite GitHub Actions outputs and step summary
--fail-on-violationsExit with code 1 when violations are found

List components from an architecture model.

Terminal window
erode components ./model
erode components ./model --format json
FlagDescriptionDefault
--model-format <fmt>Architecture model formatlikec4
--format <fmt>Output format: table, json, yamltable

Show component connections from an architecture model.

Terminal window
erode connections ./model --repo https://github.com/org/repo
erode connections ./model --repo https://gitlab.com/group/project
FlagDescriptionDefault
--repo <url>Repository URL. Required.
--model-format <fmt>Architecture model formatlikec4
--output <fmt>Output format: console, jsonconsole

Check that all components in an architecture model have repository links.

Terminal window
erode validate ./model
erode validate ./model --format json
FlagDescriptionDefault
--model-format <fmt>Architecture model formatlikec4
--format <fmt>Output format: table, jsontable

Exits with code 1 if any components are missing repository links.

Set these before running any command:

VariableDescription
GITHUB_TOKENRequired for GitHub PRs. See Configuration for required permissions.
GITLAB_TOKENRequired for GitLab MRs. Requires api scope.
BITBUCKET_TOKENRequired for Bitbucket PRs. See Configuration for required permissions.
GEMINI_API_KEY, OPENAI_API_KEY, or ANTHROPIC_API_KEYAPI key for your chosen AI provider.
AI_PROVIDERgemini (default), openai, or anthropic.

See Configuration for the full list of environment variables including diff limits, timeouts, and model overrides.

Terminal window
export GITHUB_TOKEN="ghp_..."
export GEMINI_API_KEY="AIza..."
node packages/cli/dist/cli.js analyze ./architecture \
--url https://github.com/acme/backend/pull/42 \
--comment \
--fail-on-violations