Skip to content

CLI Commands

These options are available on all commands:

OptionDescription
--version, -VPrint the Archgate version
--help, -hShow help for any command
Terminal window
archgate --version
archgate check --help

Authenticate with GitHub to access Archgate editor plugins. If you are not registered yet, the CLI handles signup automatically — it prompts for your email, editor preference (Claude Code, VS Code, Copilot CLI, or Cursor), and use case, then registers you before completing the login.

Terminal window
archgate login

Starts a GitHub Device Flow (OAuth). The CLI displays a one-time code and a URL. Open the URL in your browser, enter the code, and authorize the Archgate GitHub OAuth App. Once authorized, the CLI exchanges your GitHub identity for an Archgate plugin token and stores it securely in your OS credential manager (macOS Keychain, Windows Credential Manager, or Linux libsecret) via git credential approve. Non-sensitive metadata (username, date) is saved to ~/.archgate/credentials.

If your GitHub account is not yet registered, the CLI prompts for your email, preferred editor, and use case, then signs you up automatically.

Credentials are required to install editor plugins via archgate init --install-plugin. The CLI itself (check, init, etc.) works without login.

SubcommandDescription
archgate loginAuthenticate (skips if already logged in)
archgate login statusShow current authentication status
archgate login logoutRemove stored credentials
archgate login refreshRe-authenticate and claim a new token

Log in for the first time:

Terminal window
archgate login
Authenticating with GitHub...
Open https://github.com/login/device in your browser
and enter the code: ABCD-1234
Waiting for authorization...
GitHub user: yourname
Your GitHub account yourname is not yet registered.
Let's sign you up now.
Email: you@example.com
Editor: Claude Code
Use case: Enforcing ADRs in our monorepo
Submitting signup request...
Claiming archgate plugin token...
Authenticated as yourname. Plugin access is now available.
Run `archgate init` to set up a project with the archgate plugin.

If the project already has .archgate/adrs/, the final line reads:

Run `archgate check` to validate your project against its ADRs.

If archgate login fails with a TLS certificate error (common behind corporate proxies), point your runtime at your organization’s CA bundle using the NODE_EXTRA_CA_CERTS environment variable.

On macOS/Linux:

Terminal window
export NODE_EXTRA_CA_CERTS=/path/to/your-corporate-ca.pem
archgate login

On Windows (PowerShell):

Terminal window
$env:NODE_EXTRA_CA_CERTS = "C:\path\to\your-corporate-ca.pem"
archgate login

On Windows (cmd):

Terminal window
set NODE_EXTRA_CA_CERTS=C:\path\to\your-corporate-ca.pem
archgate login

On Windows (Git Bash):

Terminal window
export NODE_EXTRA_CA_CERTS=/c/path/to/your-corporate-ca.pem
archgate login

Ask your IT team for the correct certificate path if you are unsure.

Check login status:

Terminal window
archgate login status
Logged in as yourname (since 2026-02-28)

Log out:

Terminal window
archgate login logout

Re-authenticate:

Terminal window
archgate login refresh

Initialize Archgate governance in the current project.

Terminal window
archgate init [options]

Creates the .archgate/ directory with an example ADR, companion rules file, and linter configuration. Optionally configures editor integration for AI agent workflows and installs the Archgate editor plugin.

OptionDefaultDescription
--editor <editor>claudeEditor integration to configure (claude, cursor, vscode, copilot)
--install-pluginautoInstall the Archgate editor plugin (requires prior archgate login)

When --install-plugin is passed, the CLI installs the Archgate plugin for the selected editor. If the flag is omitted, the CLI auto-detects: it installs the plugin when valid credentials exist (from a previous archgate login) and skips otherwise.

Claude Code: If the claude CLI is on your PATH, the plugin is installed automatically via claude plugin marketplace add and claude plugin install. If the claude CLI is not found, the command prints the manual installation commands instead.

Cursor: The plugin bundle is downloaded from plugins.archgate.dev and extracted into the .cursor/ directory.

Initialized Archgate governance in /path/to/project
adrs/ - architecture decision records
lint/ - linter-specific rules
.claude/ - Claude Code settings configured
Archgate plugin installed for Claude Code.

When --editor cursor is used, the output shows .cursor/ instead of .claude/.

.archgate/
adrs/
ARCH-001-example.md # Example ADR
ARCH-001-example.rules.ts # Example rules file
lint/
archgate.config.ts # Archgate configuration

Manage Archgate editor plugins independently of archgate init.

Terminal window
archgate plugin <subcommand> [options]

Use archgate plugin to install plugins or retrieve the authenticated repository URL on projects that have already been initialized.

Print the plugin repository URL for manual tool configuration.

Terminal window
archgate plugin url [options]
OptionDefaultDescription
--editor <editor>claudeTarget editor (claude, cursor, vscode, copilot)

The URL can be used to manually configure editor tools. Credentials are provided automatically by your git credential manager (stored during archgate login). For example, to add the Archgate marketplace in Claude Code:

Terminal window
claude plugin marketplace add "$(archgate plugin url)"
claude plugin install archgate@archgate

For VS Code, the URL points to a separate plugin repository:

Terminal window
archgate plugin url --editor vscode

Install the Archgate plugin for the specified editor on an already-initialized project.

Terminal window
archgate plugin install [options]
OptionDefaultDescription
--editor <editor>claudeTarget editor (claude, cursor, vscode, copilot)

Installation behavior varies by editor:

  • Claude Code: Auto-installs via claude CLI if available; prints manual commands otherwise.
  • Copilot CLI: Auto-installs via copilot CLI if available; prints manual commands otherwise.
  • Cursor: Downloads and extracts the plugin bundle into .cursor/.
  • VS Code: Adds the marketplace URL to VS Code user settings and installs the VS Code extension (.vsix) via code CLI if available; prints manual instructions otherwise.

Get the plugin URL for manual configuration:

Terminal window
archgate plugin url

Install the plugin for Claude Code:

Terminal window
archgate plugin install

Install the plugin for Cursor:

Terminal window
archgate plugin install --editor cursor

Run all automated ADR compliance checks against the codebase.

Terminal window
archgate check [options] [files...]

Loads every ADR with rules: true in its frontmatter, executes the companion .rules.ts file, and reports violations with file paths and line numbers. When file paths are provided as positional arguments, only ADRs whose files patterns match those files are executed.

OptionDescription
--stagedOnly check git-staged files (useful for pre-commit hooks)
--jsonMachine-readable JSON output
--ciGitHub Actions annotation format
--adr <id>Only check rules from a specific ADR
--verboseShow passing rules and timing info
ArgumentDescription
[files...]Optional file paths to scope checks to. Only ADRs whose files patterns match will run. Supports stdin piping.
CodeMeaning
0All rules pass. No violations found.
1One or more violations detected.
2Rule execution error (e.g., malformed rule, security scanner block).

Check the entire project:

Terminal window
archgate check

Check only staged files before committing:

Terminal window
archgate check --staged

Check a single ADR:

Terminal window
archgate check --adr ARCH-001

Check specific files (only matching ADRs run):

Terminal window
archgate check src/foo.ts src/bar.ts

Pipe from git (check only changed files):

Terminal window
git diff --name-only | archgate check --json

Get JSON output for CI integration:

Terminal window
archgate check --json

Get GitHub Actions annotations:

Terminal window
archgate check --ci

When --json is used, the output is a single JSON object:

{
"pass": false,
"total": 4,
"passed": 3,
"failed": 1,
"warnings": 0,
"errors": 1,
"infos": 0,
"ruleErrors": 0,
"truncated": false,
"results": [
{
"adrId": "ARCH-001",
"ruleId": "register-function-export",
"description": "Command file must export a register*Command function",
"status": "fail",
"totalViolations": 1,
"shownViolations": 1,
"violations": [
{
"message": "Command file must export a register*Command function",
"file": "src/commands/broken.ts",
"line": 1,
"endLine": 1,
"endColumn": 42,
"severity": "error"
}
],
"durationMs": 12
}
],
"durationMs": 42
}
FieldTypeDescription
messagestringWhat the violation is
filestring?Relative file path
linenumber?Start line (1-based)
endLinenumber?End line (1-based) — for precise editor highlighting
endColumnnumber?End column (0-based) — for precise editor highlighting
fixstring?Suggested fix (guidance only)
severitystring"error", "warning", or "info"

When a rule file is blocked by the security scanner (e.g., uses Bun.spawn()) or a companion .rules.ts file is missing, the result appears in the JSON output with status: "error" and ruleId: "security-scan". Violations include the exact file and line of the blocked code (or the rules: true line in the ADR for missing companions).


Create a new ADR interactively or via flags.

Terminal window
archgate adr create [options]

When run without --title and --domain, the command prompts interactively for the domain, title, and optional file patterns. When both --title and --domain are provided, it runs non-interactively.

The ADR ID is auto-generated with the domain prefix and the next available sequence number (e.g., ARCH-002, BE-001).

OptionDescription
--title <title>ADR title (skip interactive prompt)
--domain <domain>ADR domain (backend, frontend, data, architecture, general)
--files <patterns>File patterns, comma-separated
--body <markdown>Full ADR body markdown (skip template)
--rulesSet rules: true in frontmatter
--jsonOutput as JSON

Interactive mode:

Terminal window
archgate adr create

Non-interactive mode:

Terminal window
archgate adr create \
--title "API Response Envelope" \
--domain backend \
--files "src/api/**/*.ts" \
--rules

List all ADRs in the project.

Terminal window
archgate adr list [options]
OptionDescription
--jsonOutput as JSON
--domain <domain>Filter by domain

List all ADRs in table format:

Terminal window
archgate adr list
ID Domain Rules Title
────────────────────────────────────────────────────────
ARCH-001 architecture true Command Structure
ARCH-002 architecture true Error Handling
BE-001 backend true API Response Envelope

List ADRs as JSON:

Terminal window
archgate adr list --json

Filter by domain:

Terminal window
archgate adr list --domain backend

Print a specific ADR by ID.

Terminal window
archgate adr show <id>

Prints the full ADR content (frontmatter and body) to stdout.

ArgumentDescription
<id>ADR ID (e.g., ARCH-001, BE-003)
Terminal window
archgate adr show ARCH-001

Update an existing ADR by ID.

Terminal window
archgate adr update --id <id> --body <markdown> [options]

Replaces the ADR body with the provided markdown. Frontmatter fields (--title, --domain, --files, --rules) are updated only when explicitly passed; otherwise the existing values are preserved.

OptionRequiredDescription
--id <id>YesADR ID to update (e.g., ARCH-001)
--body <markdown>YesFull replacement ADR body markdown
--title <title>NoNew ADR title (preserves existing if omitted)
--domain <domain>NoNew domain (backend, frontend, data, architecture, general)
--files <patterns>NoNew file patterns, comma-separated (preserves existing if omitted)
--rulesNoSet rules: true in frontmatter
--jsonNoOutput as JSON
Terminal window
archgate adr update \
--id ARCH-001 \
--title "Updated Command Structure" \
--body "## Context\n\nUpdated context..."

Pre-compute review context with ADR briefings for changed files. Designed for CI and editor plugin integrations that need a summary of which ADRs apply to the files being changed.

Terminal window
archgate review-context [options]
OptionDescription
--stagedOnly include git-staged files
--run-checksInclude ADR compliance check results
--domain <domain>Filter to a single domain
Terminal window
archgate review-context --staged

Read AI editor session transcripts for the project. Useful for auditing what an AI agent did during a coding session.

Terminal window
archgate session-context <subcommand> [options]

Read the Claude Code session transcript for the project.

Terminal window
archgate session-context claude-code [options]
OptionDescription
--max-entries <n>Maximum entries to return (default: 200)

Read the Cursor agent session transcript for the project.

Terminal window
archgate session-context cursor [options]
OptionDescription
--max-entries <n>Maximum entries to return (default: 200)
--session-id <id>Specific session UUID to read

Read the latest Claude Code session:

Terminal window
archgate session-context claude-code

Read a specific Cursor session:

Terminal window
archgate session-context cursor --session-id abc123

Upgrade Archgate to the latest version via npm.

Terminal window
archgate upgrade

Checks the npm registry for the latest published version. If a newer version is available, runs npm install -g archgate@latest to upgrade. If already up-to-date, prints a message and exits.

Terminal window
archgate upgrade
Checking for latest Archgate release...
Upgrading 0.3.0 -> 0.4.0...
Archgate upgraded to 0.4.0 successfully.

Check the system environment, installation method, and editor integrations. Useful for diagnosing configuration issues and sharing debug context in bug reports.

Terminal window
archgate doctor [options]
OptionDescription
--jsonMachine-readable output
  • System — OS, architecture, WSL detection, Bun and Node versions
  • Archgate — CLI version, install method (binary, proto, local, global-pm), config directory, telemetry and login status
  • Project — Whether an .archgate/ project exists, ADR count, domains
  • Editor CLIs — Whether claude, cursor, code (VS Code), copilot, and git are available on PATH
  • Project Integrations — Whether editor-specific plugin files exist in the current project (.claude/settings.local.json, .cursor/rules/archgate-governance.mdc, .vscode/settings.json, .github/copilot/instructions.md)
Terminal window
archgate doctor
System
OS: win32/x64
Bun: 1.3.11
Node: v24.3.0
Archgate
Version: 0.25.1
Install: binary
Exec path: /home/user/.archgate/bin/archgate
Config dir: /home/user/.archgate OK
Telemetry: enabled
Logged in: yes
Project
ADRs: 5 (3 with rules)
Domains: ARCH, GEN
Editor CLIs
claude: OK
cursor: MISSING
code (vscode):OK
copilot: MISSING
git: OK
Project Integrations
Claude: OK (.claude/settings.local.json)
Cursor: MISSING (.cursor/rules/archgate-governance.mdc)
VS Code: OK (.vscode/settings.json)
Copilot: MISSING (.github/copilot/instructions.md)

Remove the CLI cache directory.

Terminal window
archgate clean

Removes ~/.archgate/, which stores cached data such as update check timestamps. Safe to run at any time — the directory is recreated automatically when needed.

Terminal window
archgate clean
/home/user/.archgate cleaned up