docsync 0.1.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.
- docsync-0.1.0/.bumpversion.cfg +8 -0
- docsync-0.1.0/.changelog/.gitkeep +3 -0
- docsync-0.1.0/.github/workflows/callable-ci.yml +39 -0
- docsync-0.1.0/.github/workflows/prs.yml +8 -0
- docsync-0.1.0/.github/workflows/push-to-main.yml +9 -0
- docsync-0.1.0/.github/workflows/release.yml +62 -0
- docsync-0.1.0/.gitignore +7 -0
- docsync-0.1.0/CHANGELOG.md +6 -0
- docsync-0.1.0/LICENSE +21 -0
- docsync-0.1.0/Makefile +19 -0
- docsync-0.1.0/PKG-INFO +216 -0
- docsync-0.1.0/README.md +203 -0
- docsync-0.1.0/docs/test.md +12 -0
- docsync-0.1.0/pyproject.toml +48 -0
- docsync-0.1.0/src/docsync/__init__.py +5 -0
- docsync-0.1.0/src/docsync/cli.py +50 -0
- docsync-0.1.0/src/docsync/commands/__init__.py +0 -0
- docsync-0.1.0/src/docsync/commands/cascade.py +120 -0
- docsync-0.1.0/src/docsync/commands/check.py +92 -0
- docsync-0.1.0/src/docsync/commands/init.py +9 -0
- docsync-0.1.0/src/docsync/commands/sync.py +172 -0
- docsync-0.1.0/src/docsync/commands/tree.py +121 -0
- docsync-0.1.0/src/docsync/core/__init__.py +0 -0
- docsync-0.1.0/src/docsync/core/config.py +91 -0
- docsync-0.1.0/src/docsync/core/constants.py +26 -0
- docsync-0.1.0/src/docsync/core/lock.py +60 -0
- docsync-0.1.0/src/docsync/core/parser.py +47 -0
- docsync-0.1.0/src/docsync/prompts/sync-parallel.md +21 -0
- docsync-0.1.0/src/docsync/prompts/sync.md +17 -0
- docsync-0.1.0/tests/__init__.py +0 -0
- docsync-0.1.0/tests/test_cascade.py +147 -0
- docsync-0.1.0/tests/test_parser.py +84 -0
- docsync-0.1.0/tests/test_tree.py +75 -0
- docsync-0.1.0/tests/test_validator.py +140 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
check:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v4
|
|
11
|
+
- uses: actions/setup-python@v5
|
|
12
|
+
with:
|
|
13
|
+
python-version: "3.12"
|
|
14
|
+
- run: pip install -e ".[dev]"
|
|
15
|
+
- run: ruff check .
|
|
16
|
+
- run: ruff format --check .
|
|
17
|
+
|
|
18
|
+
practical-test:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.12"
|
|
25
|
+
- run: pip install -e ".[dev]"
|
|
26
|
+
- run: docsync check docs/
|
|
27
|
+
|
|
28
|
+
test:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
strategy:
|
|
31
|
+
matrix:
|
|
32
|
+
python-version: ["3.9", "3.12"]
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: actions/setup-python@v5
|
|
36
|
+
with:
|
|
37
|
+
python-version: ${{ matrix.python-version }}
|
|
38
|
+
- run: pip install -e ".[dev]"
|
|
39
|
+
- run: pytest -v
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
bump:
|
|
7
|
+
description: "Version bump type"
|
|
8
|
+
required: true
|
|
9
|
+
type: choice
|
|
10
|
+
options:
|
|
11
|
+
- patch
|
|
12
|
+
- minor
|
|
13
|
+
- major
|
|
14
|
+
- initial
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
id-token: write
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
release:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
environment: pypi
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 0
|
|
28
|
+
|
|
29
|
+
- uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
|
|
33
|
+
- run: pip install bump2version towncrier hatch
|
|
34
|
+
|
|
35
|
+
- name: Configure git
|
|
36
|
+
run: |
|
|
37
|
+
git config user.name "github-actions[bot]"
|
|
38
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
39
|
+
|
|
40
|
+
- name: Bump version
|
|
41
|
+
if: inputs.bump != 'initial'
|
|
42
|
+
run: bump2version ${{ inputs.bump }}
|
|
43
|
+
|
|
44
|
+
- name: Read new version
|
|
45
|
+
id: version
|
|
46
|
+
run: echo "version=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")" >> "$GITHUB_OUTPUT"
|
|
47
|
+
|
|
48
|
+
- name: Build changelog
|
|
49
|
+
run: towncrier build --yes --version ${{ steps.version.outputs.version }}
|
|
50
|
+
|
|
51
|
+
- name: Commit and tag
|
|
52
|
+
run: |
|
|
53
|
+
git add -A
|
|
54
|
+
git commit -m "chore: release v${{ steps.version.outputs.version }}"
|
|
55
|
+
git tag "v${{ steps.version.outputs.version }}"
|
|
56
|
+
git push origin main --tags
|
|
57
|
+
|
|
58
|
+
- name: Build
|
|
59
|
+
run: hatch build
|
|
60
|
+
|
|
61
|
+
- name: Publish to PyPI
|
|
62
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
docsync-0.1.0/.gitignore
ADDED
docsync-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Lucas Vieira
|
|
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.
|
docsync-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
install:
|
|
2
|
+
python3 -m venv .venv
|
|
3
|
+
.venv/bin/pip install -e ".[dev]"
|
|
4
|
+
|
|
5
|
+
check:
|
|
6
|
+
.venv/bin/ruff check .
|
|
7
|
+
.venv/bin/ruff format --check .
|
|
8
|
+
|
|
9
|
+
test:
|
|
10
|
+
.venv/bin/pytest -v
|
|
11
|
+
|
|
12
|
+
practical-test:
|
|
13
|
+
.venv/bin/docsync check docs/
|
|
14
|
+
|
|
15
|
+
changelog:
|
|
16
|
+
.venv/bin/towncrier build --yes --version $(shell python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
17
|
+
|
|
18
|
+
changelog-draft:
|
|
19
|
+
.venv/bin/towncrier build --draft --version $(shell python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
docsync-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: docsync
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Auto-validate and update docs in large codebases
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Provides-Extra: dev
|
|
8
|
+
Requires-Dist: bump2version>=1; extra == 'dev'
|
|
9
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
10
|
+
Requires-Dist: ruff>=0.9; extra == 'dev'
|
|
11
|
+
Requires-Dist: towncrier>=23; extra == 'dev'
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Overview
|
|
15
|
+
|
|
16
|
+
CLI tool that keeps documentation in sync with code in large codebases. Detects which docs are affected by code changes and generates reports for AI validation.
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
src/booking/handler.ts changed
|
|
20
|
+
│
|
|
21
|
+
v
|
|
22
|
+
┌─────────────────────────┐
|
|
23
|
+
│ docsync cascade HEAD~1 │
|
|
24
|
+
└───────────┬─────────────┘
|
|
25
|
+
│
|
|
26
|
+
v
|
|
27
|
+
┌─────────────────────────┐ ┌─────────────────────────┐
|
|
28
|
+
│ Direct hits: │ │ docs/bookings.md │
|
|
29
|
+
│ - docs/bookings.md │ ──> │ │
|
|
30
|
+
└─────────────────────────┘ │ related sources: │
|
|
31
|
+
│ │ - src/booking/ <───── │ ← matched!
|
|
32
|
+
v └─────────────────────────┘
|
|
33
|
+
┌─────────────────────────┐
|
|
34
|
+
│ Cascade hits: │ docs/bookings.md references
|
|
35
|
+
│ - docs/payments.md │ ──> docs/payments.md, so it
|
|
36
|
+
└─────────────────────────┘ might need review too
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
<summary>How it works</summary>
|
|
41
|
+
|
|
42
|
+
Each doc ends with metadata sections:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
# Booking System
|
|
46
|
+
|
|
47
|
+
How bookings work...
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
related docs:
|
|
52
|
+
- docs/payments.md - payment integration
|
|
53
|
+
|
|
54
|
+
related sources:
|
|
55
|
+
- src/booking/ - booking module
|
|
56
|
+
- src/booking/commands/ - command handlers
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
When `src/booking/handler.ts` changes:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
docsync cascade HEAD~1
|
|
63
|
+
|
|
64
|
+
Direct hits (1):
|
|
65
|
+
docs/bookings.md <- references src/booking/
|
|
66
|
+
|
|
67
|
+
Cascade hits (1):
|
|
68
|
+
docs/payments.md <- referenced BY docs/bookings.md
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The cascade propagates: if `bookings.md` might be outdated, then `payments.md` (which references it) might also need review.
|
|
72
|
+
|
|
73
|
+
</details>
|
|
74
|
+
|
|
75
|
+
## Motivation
|
|
76
|
+
|
|
77
|
+
In large codebases, docs get outdated because:
|
|
78
|
+
1. No one remembers which docs need updating when a file changes
|
|
79
|
+
2. AI agents don't know which files to read to validate each doc
|
|
80
|
+
|
|
81
|
+
docsync solves this by adding "hints" to each doc - `related sources:` tells any AI exactly what to read.
|
|
82
|
+
|
|
83
|
+
## Features
|
|
84
|
+
|
|
85
|
+
- check - validates all referenced paths exist
|
|
86
|
+
- cascade - finds docs affected by code changes (with directory matching)
|
|
87
|
+
- sync - generates prompt for AI to fix docs (ordered by deps)
|
|
88
|
+
- tree - shows doc dependency tree
|
|
89
|
+
|
|
90
|
+
## Quickstart
|
|
91
|
+
|
|
92
|
+
### 1. Install
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pipx install docsync
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2. Add metadata to your docs
|
|
99
|
+
|
|
100
|
+
Each doc needs two sections at the end (after a `---` separator):
|
|
101
|
+
|
|
102
|
+
```markdown
|
|
103
|
+
# My Feature
|
|
104
|
+
|
|
105
|
+
Documentation content here...
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
related docs:
|
|
110
|
+
- docs/other-feature.md - brief description
|
|
111
|
+
|
|
112
|
+
related sources:
|
|
113
|
+
- src/feature/ - main module
|
|
114
|
+
- src/feature/utils.ts - helper functions
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 3. Initialize config (optional)
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
docsync init # creates .docsync/ folder
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary>Config options</summary>
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
.docsync/
|
|
128
|
+
├── config.json # required
|
|
129
|
+
├── sync.md # optional - custom prompt template
|
|
130
|
+
├── lock.json # optional - tracks last synced commit
|
|
131
|
+
└── syncs/ # ignored - AI writes sync reports here
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
config.json:
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"ignored_paths": ["**/migrations/**", "**/*.test.ts"],
|
|
138
|
+
"cascade_depth_limit": null
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
sync.md (custom template):
|
|
143
|
+
```markdown
|
|
144
|
+
Sync {count} docs. Write reports to {syncs_dir}/
|
|
145
|
+
|
|
146
|
+
{phases}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Placeholders: `{count}`, `{phases}`, `{docs_list}`, `{syncs_dir}`
|
|
150
|
+
|
|
151
|
+
</details>
|
|
152
|
+
|
|
153
|
+
### 4. Validate your setup
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
docsync check docs/ # ensures all paths exist
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 5. Use it
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
docsync cascade HEAD~5 --docs docs/ # docs affected by last 5 commits
|
|
163
|
+
docsync sync docs/ | pbcopy # generate AI prompt
|
|
164
|
+
claude "$(docsync sync docs/)" # or pipe directly to AI
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Commands
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
docsync check <path> # validate refs exist
|
|
171
|
+
docsync cascade <commit> --docs <dir> # list affected docs
|
|
172
|
+
docsync sync <path> # generate prompt (ordered by deps)
|
|
173
|
+
docsync sync <path> --parallel # ignore deps, all at once
|
|
174
|
+
docsync sync <path> --incremental # only include changed docs
|
|
175
|
+
docsync sync <path> --update-lock # update lock.json after sync
|
|
176
|
+
docsync sync <path> --json # output as JSON for scripts
|
|
177
|
+
docsync tree <path> # show doc dependency tree
|
|
178
|
+
docsync init # create .docsync/ folder
|
|
179
|
+
docsync --version # show version
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### AI Sync
|
|
183
|
+
|
|
184
|
+
The `sync` command generates a prompt for AI to fix docs in phases (respecting dependencies):
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Sync 5 docs by launching agents in phases (respecting dependencies).
|
|
188
|
+
|
|
189
|
+
Each agent will:
|
|
190
|
+
1. Read the doc + all related sources
|
|
191
|
+
2. Fix any outdated/incorrect content directly in the doc
|
|
192
|
+
3. Write a report to .docsync/syncs/2024-01-15T10-30-00/
|
|
193
|
+
|
|
194
|
+
Phase 1 - Independent (launch parallel):
|
|
195
|
+
docs/utils.md
|
|
196
|
+
docs/config.md
|
|
197
|
+
|
|
198
|
+
Phase 2 - Level 1 (after phase 1 completes):
|
|
199
|
+
docs/auth.md
|
|
200
|
+
sources: src/auth/
|
|
201
|
+
|
|
202
|
+
Phase 3 - Level 2 (after phase 2 completes):
|
|
203
|
+
docs/login.md
|
|
204
|
+
sources: src/login/
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Use `--parallel` to ignore dependencies and sync all at once.
|
|
208
|
+
|
|
209
|
+
## Development
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
make install # create venv + install
|
|
213
|
+
make check # lint
|
|
214
|
+
make test # run tests
|
|
215
|
+
docsync check docs/ # practical test
|
|
216
|
+
```
|
docsync-0.1.0/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
CLI tool that keeps documentation in sync with code in large codebases. Detects which docs are affected by code changes and generates reports for AI validation.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
src/booking/handler.ts changed
|
|
7
|
+
│
|
|
8
|
+
v
|
|
9
|
+
┌─────────────────────────┐
|
|
10
|
+
│ docsync cascade HEAD~1 │
|
|
11
|
+
└───────────┬─────────────┘
|
|
12
|
+
│
|
|
13
|
+
v
|
|
14
|
+
┌─────────────────────────┐ ┌─────────────────────────┐
|
|
15
|
+
│ Direct hits: │ │ docs/bookings.md │
|
|
16
|
+
│ - docs/bookings.md │ ──> │ │
|
|
17
|
+
└─────────────────────────┘ │ related sources: │
|
|
18
|
+
│ │ - src/booking/ <───── │ ← matched!
|
|
19
|
+
v └─────────────────────────┘
|
|
20
|
+
┌─────────────────────────┐
|
|
21
|
+
│ Cascade hits: │ docs/bookings.md references
|
|
22
|
+
│ - docs/payments.md │ ──> docs/payments.md, so it
|
|
23
|
+
└─────────────────────────┘ might need review too
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
<details>
|
|
27
|
+
<summary>How it works</summary>
|
|
28
|
+
|
|
29
|
+
Each doc ends with metadata sections:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
# Booking System
|
|
33
|
+
|
|
34
|
+
How bookings work...
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
related docs:
|
|
39
|
+
- docs/payments.md - payment integration
|
|
40
|
+
|
|
41
|
+
related sources:
|
|
42
|
+
- src/booking/ - booking module
|
|
43
|
+
- src/booking/commands/ - command handlers
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
When `src/booking/handler.ts` changes:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
docsync cascade HEAD~1
|
|
50
|
+
|
|
51
|
+
Direct hits (1):
|
|
52
|
+
docs/bookings.md <- references src/booking/
|
|
53
|
+
|
|
54
|
+
Cascade hits (1):
|
|
55
|
+
docs/payments.md <- referenced BY docs/bookings.md
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The cascade propagates: if `bookings.md` might be outdated, then `payments.md` (which references it) might also need review.
|
|
59
|
+
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
## Motivation
|
|
63
|
+
|
|
64
|
+
In large codebases, docs get outdated because:
|
|
65
|
+
1. No one remembers which docs need updating when a file changes
|
|
66
|
+
2. AI agents don't know which files to read to validate each doc
|
|
67
|
+
|
|
68
|
+
docsync solves this by adding "hints" to each doc - `related sources:` tells any AI exactly what to read.
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
- check - validates all referenced paths exist
|
|
73
|
+
- cascade - finds docs affected by code changes (with directory matching)
|
|
74
|
+
- sync - generates prompt for AI to fix docs (ordered by deps)
|
|
75
|
+
- tree - shows doc dependency tree
|
|
76
|
+
|
|
77
|
+
## Quickstart
|
|
78
|
+
|
|
79
|
+
### 1. Install
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pipx install docsync
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. Add metadata to your docs
|
|
86
|
+
|
|
87
|
+
Each doc needs two sections at the end (after a `---` separator):
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
# My Feature
|
|
91
|
+
|
|
92
|
+
Documentation content here...
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
related docs:
|
|
97
|
+
- docs/other-feature.md - brief description
|
|
98
|
+
|
|
99
|
+
related sources:
|
|
100
|
+
- src/feature/ - main module
|
|
101
|
+
- src/feature/utils.ts - helper functions
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 3. Initialize config (optional)
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
docsync init # creates .docsync/ folder
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
<details>
|
|
111
|
+
<summary>Config options</summary>
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
.docsync/
|
|
115
|
+
├── config.json # required
|
|
116
|
+
├── sync.md # optional - custom prompt template
|
|
117
|
+
├── lock.json # optional - tracks last synced commit
|
|
118
|
+
└── syncs/ # ignored - AI writes sync reports here
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
config.json:
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"ignored_paths": ["**/migrations/**", "**/*.test.ts"],
|
|
125
|
+
"cascade_depth_limit": null
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
sync.md (custom template):
|
|
130
|
+
```markdown
|
|
131
|
+
Sync {count} docs. Write reports to {syncs_dir}/
|
|
132
|
+
|
|
133
|
+
{phases}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Placeholders: `{count}`, `{phases}`, `{docs_list}`, `{syncs_dir}`
|
|
137
|
+
|
|
138
|
+
</details>
|
|
139
|
+
|
|
140
|
+
### 4. Validate your setup
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
docsync check docs/ # ensures all paths exist
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 5. Use it
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
docsync cascade HEAD~5 --docs docs/ # docs affected by last 5 commits
|
|
150
|
+
docsync sync docs/ | pbcopy # generate AI prompt
|
|
151
|
+
claude "$(docsync sync docs/)" # or pipe directly to AI
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Commands
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
docsync check <path> # validate refs exist
|
|
158
|
+
docsync cascade <commit> --docs <dir> # list affected docs
|
|
159
|
+
docsync sync <path> # generate prompt (ordered by deps)
|
|
160
|
+
docsync sync <path> --parallel # ignore deps, all at once
|
|
161
|
+
docsync sync <path> --incremental # only include changed docs
|
|
162
|
+
docsync sync <path> --update-lock # update lock.json after sync
|
|
163
|
+
docsync sync <path> --json # output as JSON for scripts
|
|
164
|
+
docsync tree <path> # show doc dependency tree
|
|
165
|
+
docsync init # create .docsync/ folder
|
|
166
|
+
docsync --version # show version
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### AI Sync
|
|
170
|
+
|
|
171
|
+
The `sync` command generates a prompt for AI to fix docs in phases (respecting dependencies):
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
Sync 5 docs by launching agents in phases (respecting dependencies).
|
|
175
|
+
|
|
176
|
+
Each agent will:
|
|
177
|
+
1. Read the doc + all related sources
|
|
178
|
+
2. Fix any outdated/incorrect content directly in the doc
|
|
179
|
+
3. Write a report to .docsync/syncs/2024-01-15T10-30-00/
|
|
180
|
+
|
|
181
|
+
Phase 1 - Independent (launch parallel):
|
|
182
|
+
docs/utils.md
|
|
183
|
+
docs/config.md
|
|
184
|
+
|
|
185
|
+
Phase 2 - Level 1 (after phase 1 completes):
|
|
186
|
+
docs/auth.md
|
|
187
|
+
sources: src/auth/
|
|
188
|
+
|
|
189
|
+
Phase 3 - Level 2 (after phase 2 completes):
|
|
190
|
+
docs/login.md
|
|
191
|
+
sources: src/login/
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Use `--parallel` to ignore dependencies and sync all at once.
|
|
195
|
+
|
|
196
|
+
## Development
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
make install # create venv + install
|
|
200
|
+
make check # lint
|
|
201
|
+
make test # run tests
|
|
202
|
+
docsync check docs/ # practical test
|
|
203
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "docsync"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Auto-validate and update docs in large codebases"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
|
|
12
|
+
[project.optional-dependencies]
|
|
13
|
+
dev = ["pytest>=7", "ruff>=0.9", "towncrier>=23", "bump2version>=1"]
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
docsync = "docsync.cli:main"
|
|
17
|
+
|
|
18
|
+
[tool.hatch.build.targets.wheel]
|
|
19
|
+
packages = ["src/docsync"]
|
|
20
|
+
|
|
21
|
+
[tool.pytest.ini_options]
|
|
22
|
+
testpaths = ["tests"]
|
|
23
|
+
|
|
24
|
+
[tool.ruff]
|
|
25
|
+
line-length = 120
|
|
26
|
+
|
|
27
|
+
[tool.ruff.lint]
|
|
28
|
+
select = ["E", "F", "I"]
|
|
29
|
+
|
|
30
|
+
[tool.towncrier]
|
|
31
|
+
directory = ".changelog"
|
|
32
|
+
filename = "CHANGELOG.md"
|
|
33
|
+
title_format = "## {version} ({project_date})"
|
|
34
|
+
|
|
35
|
+
[[tool.towncrier.type]]
|
|
36
|
+
directory = "feature"
|
|
37
|
+
name = "Features"
|
|
38
|
+
showcontent = true
|
|
39
|
+
|
|
40
|
+
[[tool.towncrier.type]]
|
|
41
|
+
directory = "bugfix"
|
|
42
|
+
name = "Bug Fixes"
|
|
43
|
+
showcontent = true
|
|
44
|
+
|
|
45
|
+
[[tool.towncrier.type]]
|
|
46
|
+
directory = "misc"
|
|
47
|
+
name = "Misc"
|
|
48
|
+
showcontent = true
|