| name | drift |
| description | Documentation drift detection and sync for any API surface — TypeScript packages, OpenAPI/REST specs, Clarity contracts. Use when checking doc coverage, validating docs against an API, detecting drift, or fixing outdated documentation. Triggers on "doc coverage", "validate docs", "drift", "docs out of sync", "are my docs accurate", "update docs to match API". |
Drift: Documentation Sync
Detect and fix documentation drift. The drift CLI is the truth oracle: it deterministically extracts what an API actually is. You verify claims against it — never from memory, never by grepping source.
Core Concept
Truth-first. Get the API surface from drift, not by reading source files. drift resolves re-exports, barrel files, request schemas, and gives the authoritative list.
drift --tools
All commands support --json → {ok, data, meta} envelope on stdout.
Truth Sources
Every primitive accepts any supported surface:
drift <cmd> [entry]
drift <cmd> --spec openapi.json
drift <cmd> token.clar --abi token.abi.json
Commands
drift list [search]
drift get <name>
drift extract
drift scan [--min N]
drift coverage [--min N]
drift lint
drift diff --base <ref>
drift breaking --base <ref>
drift scan --docs-map <file>
drift docs-map stub|baseline
Prefer MCP when available: drift mcp exposes these as drift_* tools.
Workflows
Coverage
drift coverage --json (add truth flags for non-TS)
drift list --undocumented --json for the backlog
- Report: documented/total + undocumented list.
Validate docs against the API
drift list --json → the real surface
- Read the docs (user-provided path/URL)
- For each doc claim:
drift get <name> --json → compare params, optionality, types, deprecation
- Report inaccuracies with
file:line. (For a full docs sweep, use the docs-verify skill.)
Check drift vs a baseline
drift diff --base <ref> --json (or drift breaking --base <ref> --json)
- For each change, grep docs for impacted references
- Report locations needing updates.
Fix drift
drift lint --json → issues with filePath and line
- For each issue:
drift get <name> --json → correct signature; edit the doc/JSDoc to match
- Only modify code references and signatures — preserve prose voice
- Re-run
drift lint to confirm zero.
Docs-site key coverage
drift docs-map stub --docs <corpus> --out drift.docs-map.json --json → scaffold
- Review/refine the map (page→type, sectionRe, annotations) — see the
drift-docs-map skill
drift scan --docs-map drift.docs-map.json --json → gaps/ghosts/inversions per page
drift docs-map baseline once verified; commit the map. CI fails on ghosts or gap growth.
Generate stubs
drift list --undocumented --json
- For each:
drift get <name> --json → signature-accurate stub with <!-- TODO --> prose markers
- Never invent descriptions — TODO markers are for the human.
Output Formats
JSON report, GitHub issue, or PR comment on request. Keep the shape:
{
"type": "coverage|validation|drift",
"package": "<name>",
"summary": { "total": 0, "documented": 0, "issues": 0 },
"issues": [
{ "export": "<name>", "severity": "breaking|warning|info",
"type": "missing|outdated|inaccurate", "message": "...",
"locations": ["docs/file.md:45"] }
]
}
Rules
- The spec is the source of truth; grep is only for searching doc content.
- One
drift get per claim you verify — never trust memory of an API.
- Preserve doc prose; only fix code references, signatures, and factual claims.
- Exit codes matter in CI (grep convention): 0 = clean, 1 = findings/threshold missed/not found, 2 = usage or internal error.