> ## Documentation Index
> Fetch the complete documentation index at: https://tashfiq.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Overview

> Reference for Charter's command surface, exit codes, and shared CLI flags.

Charter is a single-binary, offline-first Go CLI for scoring a repository's AI-agent readiness.

<Note>
  Every command runs offline. Charter makes no network calls and never sends your code anywhere.
</Note>

## Commands

<CardGroup cols={2}>
  <Card title="doctor" icon="stethoscope" href="/cli/doctor">
    Scan a repo, evaluate all rules, and compute an AI-agent-readiness score.
  </Card>

  <Card title="init" icon="sparkles" href="/cli/init">
    Scaffold missing agent context files into a repo with create-missing-only safety.
  </Card>

  <Card title="fix" icon="tool" href="/cli/fix">
    Preview and apply diff-first auto-repair for supported findings.
  </Card>

  <Card title="report" icon="file-analytics" href="/cli/report">
    Generate a shareable, self-contained offline HTML report artifact.
  </Card>

  <Card title="explain" icon="book" href="/cli/explain">
    Look up a rule by ID and print its catalog metadata.
  </Card>

  <Card title="suppress" icon="eye-off" href="/cli/suppress">
    Record a governed suppression entry in `.charter-suppress.yml`.
  </Card>

  <Card title="version" icon="tag" href="/cli/version">
    Print build metadata for the currently installed binary.
  </Card>
</CardGroup>

## Exit Codes

| Code | Meaning | When                                                                                              |
| ---- | ------- | ------------------------------------------------------------------------------------------------- |
| `0`  | Pass    | Score ≥ threshold, or non-gating commands (`report`, `explain`, `version`) completed successfully |
| `1`  | Fail    | Score \< threshold, or `--rule` fired at least one matching finding                               |
| `2`  | Error   | Invalid flags, unknown rule ID, scan failure, not a TTY for `-i`, malformed config                |

## Global Flags

These flags are shared across most commands.

<ResponseField name="--path" type="string">
  Explicit repository root to scan. Defaults to the current working directory.
</ResponseField>

<ResponseField name="--threshold" type="int">
  Minimum passing score. Overrides the value set in `charter.yaml` when provided. Used by `doctor` for gating; reflected in `report` output but does not gate the report write.
</ResponseField>

<ResponseField name="--format" type="text | json | markdown | sarif">
  Output format. Available values depend on the command: `doctor` supports all four; `report` supports `html`, `markdown`, and `json`; `explain` and `version` support `text` and `json`.
</ResponseField>

<ResponseField name="--out" type="string">
  Write rendered output to a file instead of stdout. Supported by `doctor` and `report`.
</ResponseField>

<ResponseField name="--quiet" type="boolean">
  Silent on pass; emits one summary line on fail. Applies to `doctor` text output only — JSON, Markdown, and SARIF still emit the full payload.
</ResponseField>

## Typical Workflows

<CodeGroup>
  ```bash Local development theme={null}
  charter doctor --path . --threshold 80
  ```

  ```bash CI gate theme={null}
  charter doctor --quiet --threshold 80
  ```

  ```bash SARIF upload theme={null}
  charter doctor --format sarif --out charter.sarif
  ```

  ```bash Shareable report theme={null}
  charter report --out charter-report.html --open
  ```
</CodeGroup>
