Skip to content

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 ​

FlagDefaultDescription
--jsonfalseEmit the full report as JSON on stdout
--quietfalseOnly print failures and warnings
--fixfalseApply remediation for auto-fixable failures
--dry-runfalseOnly with --fix. Print planned actions, do not execute
--yes, -yfalseOnly with --fix. Required in CI (CI=true) to apply changes

Checks run ​

CheckWhat it verifies
VersionsCore vs. plugin API compatibility
Node versionNode >= 20
Git binarygit is on PATH
Git repocwd is inside a git working tree
Index directory.ctxo/index/ exists and is readable
Index freshnessJSON 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-sitterRuntime parsers load
Language coverageEvery detected language has a registered plugin
Disk usageFree space sufficient for the index
Symbol / Edge countSanity bounds
Orphaned filesNo stale entries in .ctxo/index/
Co-changes cachePresent and readable
Schema versionMatches the current core

Remediation order (--fix) ​

--fix applies attempts in dependency order, skipping later steps when an earlier one fails:

  1. Config β€” write a default .ctxo/config.yaml if missing or invalid.
  2. Git hooks β€” install post-commit and post-merge hooks.
  3. Language coverage β€” run ctxo install for missing plugins.
  4. Index β€” run ctxo index (requires step 3 to have succeeded).
  5. 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 doctor
shell
# Only print non-passing checks β€” good for shell prompts.
npx ctxo doctor --quiet
shell
# Pipe to jq for dashboards.
npx ctxo doctor --json | jq '.checks | map(select(.status != "pass"))'
shell
npx ctxo doctor --fix --dry-run
shell
npx ctxo doctor --fix --yes

Exit codes ​

CodeMeaning
0All checks passed
1One or more checks failed
2--fix halted before completing (a dependency step failed)

See also ​

Released under the MIT License.