Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DocRig

High-performance document analysis engine and CLI toolkit


🔍 What is DocRig?

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

✨ Key Features

  • Fast — written in Rust; handles large documentation trees efficiently
  • Modular — clean separation between docrig-core (engine) and docrig-cli (interface)
  • CI-readyci command 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 formatstext, json, and html

📦 Installation

Requires a Rust toolchain.

cargo install --git https://github.com/atakanonat/docrig

🚀 Usage

Scan

Scan a documentation directory and display results.

docrig scan ./docs
docrig scan ./docs --format json
docrig scan ./docs --format html --output report.html

Report

Generate a detailed report (implies full-detail output).

docrig report ./docs
docrig report ./docs --format json --output report.json

CI Mode

Scan 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-warnings

Exit codes

Code Meaning
0 All checks passed
1 Threshold exceeded or error

Suggestions

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 json

Auto-Fix

Apply 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 high

Baseline Workflow

Capture 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 json

🏗 Architecture

docrig-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

🛠 Development

# 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-cases

Test fixtures live in test-fixtures/ and cover basic documentation structures as well as edge cases such as relative links and uppercase file names.


License

MIT

About

High-performance documentation analysis engine and CLI toolkit. Detect structural issues, manage baselines, and auto-fix links with Rust-powered speed.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages