ctxo doctor β
Runs a series of independent health checks against your project and environment, then reports each result as pass, warn, or fail. With --fix, it applies remediation in dependency order (config first, plugins and index last).
Synopsis β
shell
npx ctxo doctor [options]Flags β
| Flag | Default | Description |
|---|---|---|
--json | false | Emit the full report as JSON on stdout |
--quiet | false | Only print failures and warnings |
--fix | false | Apply remediation for auto-fixable failures |
--dry-run | false | Only with --fix. Print planned actions, do not execute |
--yes, -y | false | Only with --fix. Required in CI (CI=true) to apply changes |
Checks run β
| Check | What it verifies |
|---|---|
| Versions | Core vs. plugin API compatibility |
| Node version | Node >= 20 |
| Git binary | git is on PATH |
| Git repo | cwd is inside a git working tree |
| Index directory | .ctxo/index/ exists and is readable |
| Index freshness | JSON index matches source hashes |
| SQLite cache | .ctxo/.cache/symbols.db present and usable |
| Config file | .ctxo/config.yaml is valid YAML and conforms to the schema |
| ts-morph, tree-sitter | Runtime parsers load |
| Language coverage | Every detected language has a registered plugin |
| Disk usage | Free space sufficient for the index |
| Symbol / Edge count | Sanity bounds |
| Orphaned files | No stale entries in .ctxo/index/ |
| Co-changes cache | Present and readable |
| Schema version | Matches the current core |
Remediation order (--fix) β
--fix applies attempts in dependency order, skipping later steps when an earlier one fails:
- Config β write a default
.ctxo/config.yamlif missing or invalid. - Git hooks β install
post-commitandpost-mergehooks. - Language coverage β run
ctxo installfor missing plugins. - Index β run
ctxo index(requires step 3 to have succeeded). - SQLite cache β run
ctxo sync.
Every attempt is appended to .ctxo/doctor-fix.log for forensics.
CI safety
--fix refuses to mutate anything under CI=true unless you pass --yes. This keeps the command safe to expose in shared scripts.
Examples β
shell
npx ctxo doctorshell
# Only print non-passing checks β good for shell prompts.
npx ctxo doctor --quietshell
# Pipe to jq for dashboards.
npx ctxo doctor --json | jq '.checks | map(select(.status != "pass"))'shell
npx ctxo doctor --fix --dry-runshell
npx ctxo doctor --fix --yesExit codes β
| Code | Meaning |
|---|---|
0 | All checks passed |
1 | One or more checks failed |
2 | --fix halted before completing (a dependency step failed) |
See also β
ctxo install,ctxo index,ctxo syncβ the individual commands--fixorchestrates.- .ctxo/config.yaml reference.