Skip to main content

doctrace

Overview • Features • Motivation • Quick Start • Commands • Configuration • Contributing • License

🎺 Overview

Keep documentation in sync with code. When files change, know exactly which docs need review - and in what order.

  src/booking/handler.ts changed
               │
               v
      ┌───────────────────┐
      │ doctrace affected │
      └────────┬──────────┘
               │
               v
  ┌─────────────────────────────────┐
  │ Direct hits:                    │
  │   docs/bookings.md              │  ← has "sources: src/booking/"
  │                                 │
  │ Indirect hits:                  │
  │   docs/payments.md              │  ← requires docs/bookings.md
  └─────────────────────────────────┘
Preview
How it works

Each doc has YAML frontmatter with metadata sections:

---
required_docs:
  - docs/payments.md: payment integration

sources:
  - src/booking/: booking module
  - src/booking/commands/: command handlers
---

# Booking System

How bookings work...

When src/booking/handler.ts changes:

doctrace affected docs/ --last 1

Direct hits (1):
  docs/bookings.md       <- references src/booking/

Indirect hits (1):
  docs/payments.md       <- referenced BY docs/bookings.md

The propagation: if bookings.md might be outdated, then payments.md (which references it) might also need review.

⭐ Features

  • Impact analysis: detects which docs need review when code changes, with cascading through dependencies
  • AI-ready output: JSON output feeds AI agents to auto-update docs based on code changes
  • Interactive UI: browser dashboard to explore and visualize doc dependencies
  • Auto-gen index: generates index.md table from frontmatter metadata

❓ Motivation

In large codebases, docs get outdated because:

  1. No one remembers which docs need updating when a file changes
  2. AI agents don't know which files to read to understand each doc

doctrace solves this by adding "hints" to each doc - sources: tells any AI exactly what to read.

🚀 Quick Start

Install:

brew install pipx         # if not installed (macOS/linux)
pipx install doctrace     # or: pip install doctrace

Add metadata to your docs:

---
required_docs:
  - docs/other-feature.md: hard dependency

related_docs:
  - docs/related.md: soft reference

sources:
  - src/feature/: main module
  - src/feature/utils.ts: helper functions
---

# My Feature

Documentation content here...

Setup in your repo:

cd your-repo
doctrace init                        # creates doctrace.json (optional)

doctrace info docs/                  # show phases + validate refs
doctrace affected docs/ --last 5     # find docs affected by last 5 commits
doctrace preview docs/               # interactive explorer in browser

📖 Commands

doctrace info <path>                           # show phases + validate refs
doctrace affected <path> --last <N>            # list affected docs by last N commits
doctrace affected <path> --since <ref>         # list affected docs since ref (commit/tag/branch)
doctrace affected <path> --base-branch <branch># list affected docs from merge-base
doctrace affected <path> --json                # output as JSON
doctrace preview <path>                        # interactive explorer in browser
doctrace preview <path> --port <N>             # preview on custom port (default 8420)
doctrace init                                  # create doctrace.json
doctrace index <path> -o <file>                # generate index.md from frontmatter
doctrace completion <shell>                    # generate shell completion script
doctrace --version                             # show version
Example output
Direct hits (3):
  docs/concepts.md
  docs/api.md
  docs/utils.md

Indirect hits (1):
  docs/overview.md <- docs/api.md

Phases (3):
  1. docs/concepts.md, docs/utils.md
  2. docs/api.md
  3. docs/overview.md

Phases show dependency order - useful for AI agents processing docs.

⚙️ Configuration

Config file

doctrace.json (at repo root):

{
  "metadata": {
    "required_docs_key": "required_docs",
    "related_docs_key": "related_docs",
    "sources_key": "sources"
  }
}
Key Description
metadata.required_docs_key frontmatter key for required docs (default: "required_docs")
metadata.related_docs_key frontmatter key for related docs (default: "related_docs")
metadata.sources_key frontmatter key for source refs (default: "sources")
Shell Completion
# zsh - add to ~/.zshrc
eval "$(doctrace completion zsh)"

# bash - add to ~/.bashrc
eval "$(doctrace completion bash)"

# fish
doctrace completion fish | source

🤝 Contributing

make install    # venv + deps + pre-commit
make test       # run tests
make format     # ruff fix + format
make check      # validate ruff rules
make build      # build package
make clean      # remove venv + dist

Dev alias:

ln -sf $(pwd)/.venv/bin/doctrace ~/.local/bin/doctraced   # install
rm ~/.local/bin/doctraced                                 # remove

📜 License

This project is licensed under the MIT License.


LinkedIn Email GitHub

Metadata

Release files for doctrace 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doctrace 0.3.0
File Size Uploaded
doctrace-0.3.0.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for doctrace 0.3.0
File Interpreter ABI Platform
doctrace-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 55.2 kB

Release files / doctrace-0.3.0.tar.gz

Download URL doctrace-0.3.0.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d2004356fef864e9d24ccaa5f153d1633faeb3ffdce6a3fc0d0026eeaab23f56
BLAKE2b-256 checksum
How to use checksums
5bf55eb76b078812ea9768f935424ef5330b57051b6f46b291e2d40e589a53ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 3, 2026.

Transparency log

Release files / doctrace-0.3.0-py3-none-any.whl

Download URL doctrace-0.3.0-py3-none-any.whl
Size 38.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ed29169b81ef713cfa2026cd8c0c11053d63afbb14ff95f6826434c43684dc51
BLAKE2b-256 checksum
How to use checksums
31ac72d56e30f0fe1679cae2faa2f56d66f328306d7a51c7c9980a021ad0909d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page