docguard-cli 0.10.0 → 0.11.0

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.
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: docguard-sync
3
+ description: Keep canonical documentation ALWAYS UP TO DATE. Refreshes code-truth doc sections in place (mechanical, idempotent, preserves human prose) and flags the prose sections you must review when code changes.
4
+ compatibility: Requires DocGuard CLI installed (npm i -g docguard-cli or npx docguard-cli)
5
+ metadata:
6
+ author: docguard
7
+ version: 0.10.0
8
+ source: extensions/spec-kit-docguard/skills/docguard-sync
9
+ ---
10
+
11
+ # DocGuard Sync Skill
12
+
13
+ ## User Input
14
+
15
+ ```text
16
+ $ARGUMENTS
17
+ ```
18
+
19
+ You **MUST** consider the user input. If `--since <ref>` is provided, include the
20
+ git diff context in your reasoning when reviewing prose sections.
21
+
22
+ ## Goal
23
+
24
+ When code changes, re-derive the code-truth surface (endpoints, entities,
25
+ screens, tech stack, env vars), refresh the matching `<!-- docguard:section
26
+ source=code -->` blocks in canonical docs in place, and **review/refresh the
27
+ human-written prose** in the same docs so it still describes reality.
28
+
29
+ ## Operating Constraints
30
+
31
+ - **Mechanical refreshes do not need you.** DocGuard does them itself. Your job
32
+ is the prose sections flagged as "review" — where the human writing may no
33
+ longer match the new code reality.
34
+ - **Never edit anything outside the marked `source=human` sections** in
35
+ generated docs. The markers protect human writing; respect them.
36
+ - **Use the dry run first** to see what will change before applying.
37
+
38
+ ## Execution Flow
39
+
40
+ ### Step 1 — Preview what's stale
41
+
42
+ ```bash
43
+ npx --yes docguard-cli@latest sync 2>&1
44
+ ```
45
+
46
+ Reads:
47
+ - `↻` / `•` lines: code-truth sections that drifted (you don't need to write these).
48
+ - `🤖 Prose to review` lines: human-written sections whose surrounding code changed — **these are yours**.
49
+
50
+ ### Step 2 — Apply the mechanical refresh
51
+
52
+ ```bash
53
+ npx --yes docguard-cli@latest sync --write 2>&1
54
+ ```
55
+
56
+ Re-derives every code-truth section from the current code and rewrites only those
57
+ markers. Idempotent — running again is a no-op when up to date.
58
+
59
+ ### Step 3 — Review the flagged prose
60
+
61
+ For each `🤖 Prose to review` entry:
62
+
63
+ 1. Open the doc (e.g. `docs-canonical/API-REFERENCE.md`).
64
+ 2. Locate the `<!-- docguard:section id=<id> source=human -->` block.
65
+ 3. **Read the surrounding `source=code` section first** — that's the new truth
66
+ (e.g. the refreshed endpoint list, the refreshed screens table).
67
+ 4. Update the human prose so it still accurately describes that truth.
68
+ Examples of what to update:
69
+ - The API overview's endpoint count, or its description of the surface area.
70
+ - The Architecture overview when new components/services appeared.
71
+ - The Screens flows when new screens were added/removed/renamed.
72
+ 5. Stay inside the `source=human` markers — don't touch the code sections.
73
+
74
+ ### Step 4 — Verify
75
+
76
+ ```bash
77
+ npx --yes docguard-cli@latest guard
78
+ ```
79
+
80
+ Confirm there are no errors. If the API surface drifted (`API-Surface` failures),
81
+ combine with `docguard fix --write` (the mechanical removal of stale endpoints).
82
+
83
+ ### Step 5 — Loop
84
+
85
+ The intended flow is `sync → guard → (fix if needed) → guard → commit`. Run sync
86
+ again before opening a PR to make sure the memory is current.
87
+
88
+ ## What to do if `--since <ref>` is provided
89
+
90
+ When `--since main` is given, DocGuard also lists the changed code files since
91
+ that ref. Use that diff to:
92
+
93
+ - Prioritize which prose sections to update first (the ones whose related code
94
+ files changed most).
95
+ - Cite concrete change reasons in your prose updates ("Added `/api/orders`
96
+ endpoint in commit X" → update the API overview accordingly).
97
+
98
+ ## Common patterns
99
+
100
+ | Symptom | Action |
101
+ |---|---|
102
+ | `↻ docs-canonical/API-REFERENCE.md → endpoints` | Code-truth refreshed by `--write`. No action needed. |
103
+ | `🤖 docs-canonical/API-REFERENCE.md → overview` | Open the doc; update the `overview` prose to reflect the new endpoint set. |
104
+ | `Skipped … not marked docguard:generated` | The doc isn't owned by DocGuard. Either add the marker (and commit ownership) or skip with `--force`. |
105
+ | `Documentation memory is up to date` | Done — no drift. |
106
+
107
+ ## Anti-patterns (do NOT do these)
108
+
109
+ - ❌ Editing inside `<!-- docguard:section source=code -->` — DocGuard will rewrite it on the next sync.
110
+ - ❌ Removing the markers to "make the doc look cleaner" — that breaks future sync/regeneration.
111
+ - ❌ Skipping `sync --write` and editing the code section by hand — let DocGuard do it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docguard-cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "The enforcement tool for Canonical-Driven Development (CDD). Audit, generate, and guard your project documentation.",
5
5
  "type": "module",
6
6
  "bin": {