documate 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. documate-0.2.0/.claude/settings.local.json +7 -0
  2. documate-0.2.0/.github/documate-intro.webp +0 -0
  3. documate-0.2.0/.github/workflows/ci.yml +29 -0
  4. documate-0.2.0/.github/workflows/pages.yml +40 -0
  5. documate-0.2.0/.gitignore +16 -0
  6. documate-0.2.0/.pre-commit-hooks.yaml +11 -0
  7. documate-0.2.0/CONTRIBUTING.md +58 -0
  8. documate-0.2.0/LICENSE +29 -0
  9. documate-0.2.0/Makefile +27 -0
  10. documate-0.2.0/PKG-INFO +145 -0
  11. documate-0.2.0/README.md +90 -0
  12. documate-0.2.0/docs/ARCHITECTURE.md +410 -0
  13. documate-0.2.0/docs/README.md +76 -0
  14. documate-0.2.0/docs/architecture/scripts.coverage_report.md +47 -0
  15. documate-0.2.0/docs/architecture/src.documate.__init__.md +13 -0
  16. documate-0.2.0/docs/architecture/src.documate.anchors.md +59 -0
  17. documate-0.2.0/docs/architecture/src.documate.briefs.md +168 -0
  18. documate-0.2.0/docs/architecture/src.documate.check.md +32 -0
  19. documate-0.2.0/docs/architecture/src.documate.cli.md +115 -0
  20. documate-0.2.0/docs/architecture/src.documate.config.md +69 -0
  21. documate-0.2.0/docs/architecture/src.documate.core.md +38 -0
  22. documate-0.2.0/docs/architecture/src.documate.docs.md +522 -0
  23. documate-0.2.0/docs/architecture/src.documate.drift.md +85 -0
  24. documate-0.2.0/docs/architecture/src.documate.extract.md +143 -0
  25. documate-0.2.0/docs/architecture/src.documate.graphdb.md +194 -0
  26. documate-0.2.0/docs/architecture/src.documate.prose.md +445 -0
  27. documate-0.2.0/docs/architecture/src.documate.resolve.md +67 -0
  28. documate-0.2.0/docs/architecture/src.documate.site.md +210 -0
  29. documate-0.2.0/docs/architecture/src.documate.stats.md +134 -0
  30. documate-0.2.0/docs/architecture/src.documate.ui.md +239 -0
  31. documate-0.2.0/docs/guides/getting-started.md +52 -0
  32. documate-0.2.0/docs/guides/how-it-works.md +61 -0
  33. documate-0.2.0/documate.config.json +3 -0
  34. documate-0.2.0/hooks/pre-commit +38 -0
  35. documate-0.2.0/notes/v2-direction.md +85 -0
  36. documate-0.2.0/pyproject.toml +47 -0
  37. documate-0.2.0/scripts/coverage_report.py +66 -0
  38. documate-0.2.0/src/documate/__init__.py +13 -0
  39. documate-0.2.0/src/documate/_engine/LICENSE +21 -0
  40. documate-0.2.0/src/documate/_engine/ORIGIN.md +18 -0
  41. documate-0.2.0/src/documate/_engine/__init__.py +1 -0
  42. documate-0.2.0/src/documate/_engine/changes.py +409 -0
  43. documate-0.2.0/src/documate/_engine/constants.py +23 -0
  44. documate-0.2.0/src/documate/_engine/custom_languages.py +322 -0
  45. documate-0.2.0/src/documate/_engine/flows.py +698 -0
  46. documate-0.2.0/src/documate/_engine/graph.py +1524 -0
  47. documate-0.2.0/src/documate/_engine/incremental.py +1292 -0
  48. documate-0.2.0/src/documate/_engine/migrations.py +284 -0
  49. documate-0.2.0/src/documate/_engine/parser.py +7907 -0
  50. documate-0.2.0/src/documate/_engine/registry.py +319 -0
  51. documate-0.2.0/src/documate/_engine/rescript_resolver.py +206 -0
  52. documate-0.2.0/src/documate/_engine/spring_resolver.py +200 -0
  53. documate-0.2.0/src/documate/_engine/temporal_resolver.py +199 -0
  54. documate-0.2.0/src/documate/_engine/tsconfig_resolver.py +257 -0
  55. documate-0.2.0/src/documate/anchors.py +97 -0
  56. documate-0.2.0/src/documate/briefs.py +410 -0
  57. documate-0.2.0/src/documate/check.py +142 -0
  58. documate-0.2.0/src/documate/cli.py +320 -0
  59. documate-0.2.0/src/documate/config.py +157 -0
  60. documate-0.2.0/src/documate/core.py +66 -0
  61. documate-0.2.0/src/documate/docs.py +1434 -0
  62. documate-0.2.0/src/documate/drift.py +178 -0
  63. documate-0.2.0/src/documate/extract.py +309 -0
  64. documate-0.2.0/src/documate/graphdb.py +329 -0
  65. documate-0.2.0/src/documate/prose.py +1099 -0
  66. documate-0.2.0/src/documate/resolve.py +120 -0
  67. documate-0.2.0/src/documate/site.py +848 -0
  68. documate-0.2.0/src/documate/stats.py +271 -0
  69. documate-0.2.0/src/documate/ui.py +322 -0
  70. documate-0.2.0/tests/test_documate.py +2851 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(git grep *)"
5
+ ]
6
+ }
7
+ }
@@ -0,0 +1,29 @@
1
+ name: ci
2
+
3
+ # Run the suite on every push/PR, and dogfood documate on its own docs — if our own
4
+ # docs can go stale unnoticed, we have no business shipping a docs engine.
5
+ on:
6
+ push:
7
+ branches: [main]
8
+ pull_request:
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ python: ["3.10", "3.11", "3.12"]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0 # the drift gate needs history to diff against the base
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python }}
24
+ - name: install
25
+ run: pip install -e .
26
+ - name: unit tests
27
+ run: python -m unittest discover -s tests -v
28
+ - name: dogfood — the gate on our own docs
29
+ run: documate --check --base "${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || 'HEAD' }}"
@@ -0,0 +1,40 @@
1
+ name: docs-site
2
+
3
+ # Publish the `documate --html` site to GitHub Pages. Works for private repos too.
4
+ # Enable once, then trigger from the Actions tab (or add a `push:` trigger below):
5
+ # repo Settings -> Pages -> Source: "GitHub Actions".
6
+ on:
7
+ workflow_dispatch:
8
+ # push: # uncomment to auto-publish on every push to main
9
+ # branches: [main]
10
+
11
+ permissions:
12
+ contents: read
13
+ pages: write
14
+ id-token: write
15
+
16
+ concurrency:
17
+ group: pages
18
+ cancel-in-progress: true
19
+
20
+ jobs:
21
+ build-and-deploy:
22
+ runs-on: ubuntu-latest
23
+ environment:
24
+ name: github-pages
25
+ url: ${{ steps.deploy.outputs.page_url }}
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ with:
29
+ fetch-depth: 0 # hotspots/evidence read git history
30
+ - uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.12"
33
+ - run: pip install -e .
34
+ - run: documate --html .
35
+ - uses: actions/configure-pages@v5
36
+ - uses: actions/upload-pages-artifact@v3
37
+ with:
38
+ path: site
39
+ - id: deploy
40
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,16 @@
1
+ .venv/
2
+ .documate/
3
+ site/
4
+ __pycache__/
5
+ *.pyc
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ node_modules/
10
+ *.tsbuildinfo
11
+ .claude/worktrees/
12
+ tmp/
13
+ .coverage
14
+ coverage/
15
+ .pytest_cache/
16
+ CLAUDE.md
@@ -0,0 +1,11 @@
1
+ # Lets other repos consume documate via the `pre-commit` framework:
2
+ # - repo: https://github.com/<you>/documate
3
+ # rev: v0.2.0
4
+ # hooks: [{ id: documate }]
5
+ - id: documate
6
+ name: documate (self-healing docs + gate)
7
+ description: Regenerate the generated docs tier and gate it — fails if pages changed (re-commit with fresh docs), an anchor is dead, or an authored doc lies about changed code.
8
+ entry: documate
9
+ language: python
10
+ pass_filenames: false
11
+ always_run: true
@@ -0,0 +1,58 @@
1
+ # Contributing to documate
2
+
3
+ Small tool, simple rules. The whole point is binding docs to code so they can't quietly
4
+ rot, so the bar is: don't let documate's own docs rot, and don't break the gate.
5
+
6
+ ## Setup
7
+
8
+ ```bash
9
+ python -m venv .venv && . .venv/bin/activate
10
+ pip install -e . # stdlib tool + the vendored tree-sitter engine
11
+ make test # or: python -m unittest discover -s tests -v
12
+ ```
13
+
14
+ `tree-sitter-language-pack` is pinned `<1` on purpose — 1.x reshuffled the grammar API and
15
+ breaks the vendored parser. Don't bump it past that.
16
+
17
+ ## The tool is one command
18
+
19
+ - `documate` — index the repo, (re)write `docs/`, then gate the result.
20
+ - `documate --check` — the gate alone, writes nothing (CI and the pre-commit hook).
21
+
22
+ Everything else is a flag; `documate --help` is the whole surface on one screen.
23
+
24
+ ## Layout
25
+
26
+ ```
27
+ src/documate/ the tool — repo-agnostic logic, stdlib-only
28
+ src/documate/_engine/ the tree-sitter → sqlite indexer (MIT; see _engine/ORIGIN.md)
29
+ src/documate/graphdb.py the ONLY module that touches the engine / sqlite schema
30
+ tests/test_documate.py one file, stdlib unittest, throwaway git fixtures
31
+ ```
32
+
33
+ The engine is first-party code (it began as a copy of code-review-graph — provenance and
34
+ license in `_engine/ORIGIN.md`). Adapt to it through `graphdb.py`; never edit `_engine/*`
35
+ to make documate work — put that logic behind the adapter instead.
36
+
37
+ ## Rules
38
+
39
+ - **Anchor what you hand-write.** New authored prose about a symbol (under `docs/guides/`)
40
+ gets a `<!-- documents: sym:NAME -->` anchor, or the drift gate can't protect it.
41
+ `documate --check` prints a `sig:` fingerprint you can add to pin the anchor exactly.
42
+ - **Never hand-edit generated pages.** `docs/README.md`, `docs/ARCHITECTURE.md`, and
43
+ `docs/architecture/*` are generated (each opens with a stamp line). Fix the source — a
44
+ docstring, or an anchor — then regenerate with `documate`.
45
+ - **Run the gate before you commit.** `documate --check`, or install the hook:
46
+ `git config core.hooksPath hooks` (or use `.pre-commit-hooks.yaml`). The pre-commit
47
+ hook is self-healing — it regenerates the generated pages and stages them, then gates.
48
+ Skip it with `--no-verify`; override the base ref with `DOCUMATE_BASE=<ref>`.
49
+ - **Stdlib for the tool.** documate's own modules import only the stdlib (plus rich for
50
+ output, and the `_engine` adapter). Heavy deps (tree-sitter, networkx) live behind
51
+ `_engine`.
52
+
53
+ ## Tests
54
+
55
+ TDD-ish: a failing test first when you can. Cover the degraded-graph path — a missing or
56
+ locked `graph.db` must soft-pass, never raise; that's the contract the whole design leans
57
+ on. The engine ships no tests of its own, so cover engine changes with a `RealGraph`-style
58
+ fixture here. `make`-free: just `python -m unittest discover -s tests`.
documate-0.2.0/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aseem Chopra
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This project vendors a code-indexing engine under src/documate/_engine/, which
26
+ is a separate work licensed MIT, Copyright (c) 2026 Tirth Kanani (the
27
+ code-review-graph project). Its license is retained at
28
+ src/documate/_engine/LICENSE and provenance noted in
29
+ src/documate/_engine/ORIGIN.md.
@@ -0,0 +1,27 @@
1
+ PY := .venv/bin/python
2
+
3
+ .PHONY: test coverage docs check
4
+
5
+ test: ## Run the full test suite in parallel (same tests CI runs serially)
6
+ @$(PY) -c "import pytest, xdist" 2>/dev/null \
7
+ || uv pip install -q --python $(PY) pytest pytest-xdist 2>/dev/null \
8
+ || $(PY) -m pip install -q pytest pytest-xdist
9
+ @$(PY) -m pytest -n auto -q tests/test_documate.py
10
+
11
+ coverage: ## Line coverage of documate's source → terminal table + coverage/html/index.html
12
+ @$(PY) -m coverage --version >/dev/null 2>&1 \
13
+ || uv pip install -q --python $(PY) coverage 2>/dev/null \
14
+ || $(PY) -m pip install -q coverage
15
+ @mkdir -p coverage
16
+ @$(PY) -m coverage run --source=src/documate -m unittest tests.test_documate \
17
+ >coverage/test.log 2>&1 || { cat coverage/test.log; exit 1; }
18
+ @$(PY) -m coverage html -q -d coverage/html
19
+ @$(PY) -m coverage json -q -o coverage/coverage.json
20
+ @$(PY) scripts/coverage_report.py coverage/coverage.json
21
+ @echo " html: coverage/html/index.html"
22
+
23
+ docs: ## The whole job: regenerate docs/ and gate them (+ static site: make docs HTML=1)
24
+ @.venv/bin/documate . $(if $(HTML),--html)
25
+
26
+ check: ## The gate alone: docs fresh, anchors real, no drift vs origin/main
27
+ @.venv/bin/documate --check .
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.4
2
+ Name: documate
3
+ Version: 0.2.0
4
+ Summary: Tie docs to the code they describe, and yell when one moves without the other. Plugs into any repo.
5
+ Author: Aseem Chopra
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Aseem Chopra
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ ---
29
+
30
+ This project vendors a code-indexing engine under src/documate/_engine/, which
31
+ is a separate work licensed MIT, Copyright (c) 2026 Tirth Kanani (the
32
+ code-review-graph project). Its license is retained at
33
+ src/documate/_engine/LICENSE and provenance noted in
34
+ src/documate/_engine/ORIGIN.md.
35
+ License-File: LICENSE
36
+ Keywords: docs-as-code,documentation,drift,knowledge-graph,tree-sitter
37
+ Classifier: Development Status :: 4 - Beta
38
+ Classifier: Environment :: Console
39
+ Classifier: Intended Audience :: Developers
40
+ Classifier: License :: OSI Approved :: MIT License
41
+ Classifier: Programming Language :: Python :: 3
42
+ Classifier: Programming Language :: Python :: 3.10
43
+ Classifier: Programming Language :: Python :: 3.11
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Topic :: Software Development :: Documentation
46
+ Classifier: Topic :: Software Development :: Quality Assurance
47
+ Requires-Python: >=3.10
48
+ Requires-Dist: networkx<4,>=3.2
49
+ Requires-Dist: rich-argparse<2,>=1.5
50
+ Requires-Dist: rich<15,>=13
51
+ Requires-Dist: tomli; python_version < '3.11'
52
+ Requires-Dist: tree-sitter-language-pack<1,>=0.3.0
53
+ Requires-Dist: tree-sitter<1,>=0.23.0
54
+ Description-Content-Type: text/markdown
55
+
56
+ <p align="center">
57
+ <img src=".github/documate-intro.webp" alt="documate generating a repository's docs and gating them from the terminal" width="640">
58
+ </p>
59
+
60
+ # documate
61
+
62
+ documate generates documentation from your code (an overview, one page per module, and an API
63
+ reference from your docstrings) and fails CI when those docs stop matching the code.
64
+
65
+ [![python](https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=white)](pyproject.toml)
66
+ [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
67
+ [![docs](https://img.shields.io/badge/docs-self--generated_·_100%25_documented-8A2BE2)](docs/README.md)
68
+
69
+ ## Install
70
+
71
+ ```bash
72
+ uv tool install documate # or: pipx install documate / pip install documate
73
+ ```
74
+
75
+ `--ai` additionally needs the `claude` CLI on your PATH. Everything else is stdlib.
76
+
77
+ ## Use
78
+
79
+ ```bash
80
+ cd your-repo
81
+ documate --init # first run: create a config, then generate the docs
82
+ documate # generate or refresh docs/, then gate them
83
+ ```
84
+
85
+ | Command | What it does |
86
+ | --- | --- |
87
+ | `documate` | index, write or refresh `docs/`, then gate it |
88
+ | `documate --check` | gate only, writes nothing (for CI and pre-commit) |
89
+ | `documate --watch` | regenerate on every save |
90
+ | `documate --html` | also render a static site into `site/` |
91
+ | `documate --ai [MODEL]` | draft missing docstrings with a model, then re-verify |
92
+ | `documate --stats` | show coverage, documentation lines, and model spend |
93
+
94
+ Run `documate path/to/repo` to document any repo. Run `documate --help` for the full list.
95
+
96
+ ## What it writes
97
+
98
+ - `docs/README.md`: an overview with a dependency map, coverage, entry points, and hotspots.
99
+ - `docs/ARCHITECTURE.md`: the whole system on one page.
100
+ - `docs/architecture/<module>.md`: one page per module (docstring, dependencies, call-flow, symbols).
101
+
102
+ ## The gate
103
+
104
+ `documate --check` exits non-zero when:
105
+
106
+ 1. Generated pages are out of date. Run `documate` to refresh them.
107
+ 2. A hand-written page points at code that no longer exists.
108
+ 3. A hand-written page describes code that changed since `--base` but was not updated.
109
+
110
+ Install the pre-commit hook once:
111
+
112
+ ```bash
113
+ git config core.hooksPath hooks
114
+ ```
115
+
116
+ It regenerates and stages the generated pages on every commit. In CI, run `documate --check`
117
+ with `fetch-depth: 0` on `actions/checkout`.
118
+
119
+ ## Authored pages
120
+
121
+ Write Markdown under `docs/` and anchor it to the code it documents:
122
+
123
+ ```markdown
124
+ <!-- documents: sym:build_model -->
125
+ ```
126
+
127
+ `documate --check` then fails if that code changes and the page does not. Add a `sig:`
128
+ fingerprint after the symbol to pin the page to the exact source.
129
+
130
+ ## Configuration
131
+
132
+ `documate --init` writes `documate.config.json`. Override only what you need:
133
+
134
+ ```json
135
+ {
136
+ "docs_dir": "docs",
137
+ "site_dir": "site",
138
+ "skip_dirs": ["/generated/"],
139
+ "default_base": "main"
140
+ }
141
+ ```
142
+
143
+ ## License
144
+
145
+ [MIT](LICENSE). The engine in `src/documate/_engine/` is vendored from code-review-graph (MIT).
@@ -0,0 +1,90 @@
1
+ <p align="center">
2
+ <img src=".github/documate-intro.webp" alt="documate generating a repository's docs and gating them from the terminal" width="640">
3
+ </p>
4
+
5
+ # documate
6
+
7
+ documate generates documentation from your code (an overview, one page per module, and an API
8
+ reference from your docstrings) and fails CI when those docs stop matching the code.
9
+
10
+ [![python](https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=white)](pyproject.toml)
11
+ [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
12
+ [![docs](https://img.shields.io/badge/docs-self--generated_·_100%25_documented-8A2BE2)](docs/README.md)
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ uv tool install documate # or: pipx install documate / pip install documate
18
+ ```
19
+
20
+ `--ai` additionally needs the `claude` CLI on your PATH. Everything else is stdlib.
21
+
22
+ ## Use
23
+
24
+ ```bash
25
+ cd your-repo
26
+ documate --init # first run: create a config, then generate the docs
27
+ documate # generate or refresh docs/, then gate them
28
+ ```
29
+
30
+ | Command | What it does |
31
+ | --- | --- |
32
+ | `documate` | index, write or refresh `docs/`, then gate it |
33
+ | `documate --check` | gate only, writes nothing (for CI and pre-commit) |
34
+ | `documate --watch` | regenerate on every save |
35
+ | `documate --html` | also render a static site into `site/` |
36
+ | `documate --ai [MODEL]` | draft missing docstrings with a model, then re-verify |
37
+ | `documate --stats` | show coverage, documentation lines, and model spend |
38
+
39
+ Run `documate path/to/repo` to document any repo. Run `documate --help` for the full list.
40
+
41
+ ## What it writes
42
+
43
+ - `docs/README.md`: an overview with a dependency map, coverage, entry points, and hotspots.
44
+ - `docs/ARCHITECTURE.md`: the whole system on one page.
45
+ - `docs/architecture/<module>.md`: one page per module (docstring, dependencies, call-flow, symbols).
46
+
47
+ ## The gate
48
+
49
+ `documate --check` exits non-zero when:
50
+
51
+ 1. Generated pages are out of date. Run `documate` to refresh them.
52
+ 2. A hand-written page points at code that no longer exists.
53
+ 3. A hand-written page describes code that changed since `--base` but was not updated.
54
+
55
+ Install the pre-commit hook once:
56
+
57
+ ```bash
58
+ git config core.hooksPath hooks
59
+ ```
60
+
61
+ It regenerates and stages the generated pages on every commit. In CI, run `documate --check`
62
+ with `fetch-depth: 0` on `actions/checkout`.
63
+
64
+ ## Authored pages
65
+
66
+ Write Markdown under `docs/` and anchor it to the code it documents:
67
+
68
+ ```markdown
69
+ <!-- documents: sym:build_model -->
70
+ ```
71
+
72
+ `documate --check` then fails if that code changes and the page does not. Add a `sig:`
73
+ fingerprint after the symbol to pin the page to the exact source.
74
+
75
+ ## Configuration
76
+
77
+ `documate --init` writes `documate.config.json`. Override only what you need:
78
+
79
+ ```json
80
+ {
81
+ "docs_dir": "docs",
82
+ "site_dir": "site",
83
+ "skip_dirs": ["/generated/"],
84
+ "default_base": "main"
85
+ }
86
+ ```
87
+
88
+ ## License
89
+
90
+ [MIT](LICENSE). The engine in `src/documate/_engine/` is vendored from code-review-graph (MIT).