@driftdev/cli
Command-line interface for documentation coverage analysis and drift detection. Ships as the drift binary.
Who This CLI Is For
- Maintainers of TypeScript libraries, SDKs, and CLI packages.
- Teams that want docs quality enforced in CI.
- Engineers building automation around machine-readable docs diagnostics.
Why Use It
- Catch stale JSDoc, examples, and markdown references before release.
- Enforce quality thresholds with standard exit codes.
- Produce structured output that agents and tooling can act on directly.
Install
bun add -g @driftdev/cli
Quick Start
drift scan
drift coverage
drift lint
drift examples
Entry auto-detects from package.json (types, exports, main, module, bin) for TypeScript packages with an exported API surface.
Commands
Composed
drift scan [entry] | Coverage + lint + prose drift + health in one pass |
drift health [entry] | Documentation health score (default command) |
drift ci | CI checks on changed packages with PR comments |
Analysis
drift coverage [entry] | Documentation coverage score |
drift lint [entry] | Cross-reference JSDoc vs code signatures |
drift examples [entry] | Validate @example blocks (presence, typecheck, run) |
drift extract [entry] | Extract full API spec as JSON |
drift list [entry] | List all exports with kinds |
drift get <name> [entry] | Inspect single export detail + types |
Spec Operations
drift validate <spec> | Validate a spec file |
drift filter <spec> | Filter exports by kind, search, tag |
Comparison
drift diff <old> <new> | What changed between two specs |
drift breaking <old> <new> | Detect breaking changes |
drift semver <old> <new> | Recommend semver bump |
drift changelog <old> <new> | Generate changelog |
Setup & Plumbing
drift init | Create configuration file |
drift config | Manage config (list, get, set) |
drift context | Generate agent context file |
drift report | Documentation trends from history |
drift release | Pre-release documentation audit |
drift cache | Cache management (clear, status) |
Discovery
drift --tools
Global Options
--json Force JSON output (default when piped)
--human Force human-readable output (default in terminal)
--config <path> Path to drift config file
--cwd <dir> Run as if started in <dir>
--no-cache Bypass spec cache
scan
Run coverage + lint + prose drift + health in one pass.
drift scan
drift scan --min 80
drift scan --all
drift scan --all --private
lint
Cross-reference JSDoc against code signatures. Detects 15 drift types across 4 categories (structural, semantic, example, prose). Prose detection scans markdown files for broken import references.
drift lint
drift lint --all
drift lint --json
coverage
Documentation coverage score.
drift coverage
drift coverage --min 80
drift coverage --all
health
Weighted health score: completeness (coverage) + accuracy (lint).
drift health
drift health --min 80
drift health --all
examples
Validate @example blocks.
drift examples
drift examples --typecheck
drift examples --run
drift examples --min 50
ci
CI checks with GitHub integration: PR comments, step summaries, history tracking.
drift ci
drift ci --all
drift ci --private
Generates ~/.drift/projects/<slug>/context.md — machine-readable project state for agents.
Configuration
drift.config.json
{
"entry": "src/index.ts",
"coverage": {
"min": 80,
"ratchet": true
},
"lint": true,
"docs": {
"include": ["README.md", "docs/**/*.md"],
"exclude": ["node_modules/**"]
}
}
See Configuration docs for all keys and drift config commands.
Output Format
All commands return structured JSON when piped or with --json:
{
"ok": true,
"data": { "score": 88, "documented": 243, "total": 275 },
"meta": { "command": "coverage", "duration": 1234, "version": "0.38.0" }
}
Human-readable output in terminal by default, or with --human.
Monorepo Support
All analysis commands support --all for workspace batch mode:
drift scan --all
drift coverage --all
drift lint --all
Auto-detects workspace globs from package.json.
License
MIT