High-performance document analysis engine and CLI toolkit
DocRig scans and analyzes documentation directories to surface structural issues before they reach production. It detects broken links, orphaned pages, and missing cross-references — and can automatically fix high-confidence problems.
- Powered by docrig-core, a deterministic Rust analysis engine
- Exposes a full-featured CLI (
docrig) for local and CI workflows
- Fast — written in Rust; handles large documentation trees efficiently
- Modular — clean separation between
docrig-core(engine) anddocrig-cli(interface) - CI-ready —
cicommand exits non-zero when configurable thresholds are exceeded - Baseline & diff workflow — snapshot current state, compare later to detect regressions
- AI-inspired suggestions — heuristic-based recommendations for broken and missing links
- Auto-fix — applies high-confidence suggestions directly to source files
- Deterministic — same input always produces the same output; safe for reproducible builds
- Multiple output formats —
text,json, andhtml
Requires a Rust toolchain.
cargo install --git https://github.com/atakanonat/docrigScan a documentation directory and display results.
docrig scan ./docs
docrig scan ./docs --format json
docrig scan ./docs --format html --output report.htmlGenerate a detailed report (implies full-detail output).
docrig report ./docs
docrig report ./docs --format json --output report.jsonScan and exit with a non-zero code if thresholds are exceeded. Integrate into any CI pipeline.
# Fail if any broken links or orphans are introduced
docrig ci ./docs
# Custom thresholds
docrig ci ./docs --max-broken 5 --max-orphans 3
# Compare against a baseline — thresholds apply to NEW issues only
docrig ci ./docs --baseline docrig-baseline.json
# Treat dead-end pages as failures (default: warnings)
docrig ci ./docs --fail-on-warningsExit codes
| Code | Meaning |
|---|---|
0 |
All checks passed |
1 |
Threshold exceeded or error |
Show AI-inspired suggestions for broken links and missing link recommendations.
docrig suggest ./docs
# Filter by confidence level: low (default), medium, or high
docrig suggest ./docs --min-confidence high
docrig suggest ./docs --format jsonApply high-confidence suggestions directly to source files.
# Preview changes without writing
docrig fix ./docs --dry-run
# Apply fixes at medium confidence and above (default)
docrig fix ./docs
# Only apply high-confidence fixes
docrig fix ./docs --min-confidence highCapture a baseline snapshot, then diff against it later to detect regressions.
# Save baseline (defaults to docrig-baseline.json)
docrig save-baseline ./docs
# Save to a custom path
docrig save-baseline ./docs --output .ci/baseline.json
# Compare current state against the baseline
docrig diff ./docs --baseline docrig-baseline.json
# Exit with code 1 if new issues are introduced
docrig diff ./docs --baseline docrig-baseline.json --fail-on-regression
# Output diff as JSON
docrig diff ./docs --baseline docrig-baseline.json --format jsondocrig-engine/
├── crates/
│ ├── docrig-core/ # Analysis engine: scanning, parsing, graph, diff, suggestions
│ └── docrig-cli/ # Command-line interface wrapping docrig-core
| Crate | Role |
|---|---|
docrig-core |
Core analysis engine — file scanning, link parsing, graph building, diffing, suggestion generation |
docrig-cli |
Thin CLI layer — argument parsing, output formatting, process exit codes |
# Clone the repository
git clone https://github.com/atakanonat/docrig
cd docrig
# Build all crates
cargo build
# Run all tests
cargo test
# Run against the included test fixtures
cargo run -p docrig-cli -- scan ./test-fixtures/basic
cargo run -p docrig-cli -- report ./test-fixtures/edge-casesTest fixtures live in test-fixtures/ and cover basic documentation structures as well as edge cases such as relative links and uppercase file names.