Track doc dependencies and detect affected docs from code changes
Project description
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:
- No one remembers which docs need updating when a file changes
- 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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file doctrace-0.3.0.tar.gz.
File metadata
- Download URL: doctrace-0.3.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2004356fef864e9d24ccaa5f153d1633faeb3ffdce6a3fc0d0026eeaab23f56
|
|
| MD5 |
81281e2e2eb2f360614977cc633e66d2
|
|
| BLAKE2b-256 |
5bf55eb76b078812ea9768f935424ef5330b57051b6f46b291e2d40e589a53ec
|
Provenance
The following attestation bundles were made for doctrace-0.3.0.tar.gz:
Publisher:
release.yml on lucasvtiradentes/doc-trace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
doctrace-0.3.0.tar.gz -
Subject digest:
d2004356fef864e9d24ccaa5f153d1633faeb3ffdce6a3fc0d0026eeaab23f56 - Sigstore transparency entry: 1014660225
- Sigstore integration time:
-
Permalink:
lucasvtiradentes/doc-trace@ae520e5cc9adc1870843dc5c0f0ebb2408803f46 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/lucasvtiradentes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae520e5cc9adc1870843dc5c0f0ebb2408803f46 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file doctrace-0.3.0-py3-none-any.whl.
File metadata
- Download URL: doctrace-0.3.0-py3-none-any.whl
- Upload date:
- Size: 38.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed29169b81ef713cfa2026cd8c0c11053d63afbb14ff95f6826434c43684dc51
|
|
| MD5 |
3926e317744fc226e994c7d40cd8ae7f
|
|
| BLAKE2b-256 |
31ac72d56e30f0fe1679cae2faa2f56d66f328306d7a51c7c9980a021ad0909d
|
Provenance
The following attestation bundles were made for doctrace-0.3.0-py3-none-any.whl:
Publisher:
release.yml on lucasvtiradentes/doc-trace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
doctrace-0.3.0-py3-none-any.whl -
Subject digest:
ed29169b81ef713cfa2026cd8c0c11053d63afbb14ff95f6826434c43684dc51 - Sigstore transparency entry: 1014660293
- Sigstore integration time:
-
Permalink:
lucasvtiradentes/doc-trace@ae520e5cc9adc1870843dc5c0f0ebb2408803f46 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/lucasvtiradentes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae520e5cc9adc1870843dc5c0f0ebb2408803f46 -
Trigger Event:
workflow_dispatch
-
Statement type: