gsd-opencode 1.22.1 → 1.33.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.
- package/agents/gsd-advisor-researcher.md +112 -0
- package/agents/gsd-assumptions-analyzer.md +110 -0
- package/agents/gsd-codebase-mapper.md +0 -2
- package/agents/gsd-debugger.md +117 -2
- package/agents/gsd-doc-verifier.md +207 -0
- package/agents/gsd-doc-writer.md +608 -0
- package/agents/gsd-executor.md +45 -4
- package/agents/gsd-integration-checker.md +0 -2
- package/agents/gsd-nyquist-auditor.md +0 -2
- package/agents/gsd-phase-researcher.md +191 -5
- package/agents/gsd-plan-checker.md +152 -5
- package/agents/gsd-planner.md +131 -157
- package/agents/gsd-project-researcher.md +28 -3
- package/agents/gsd-research-synthesizer.md +0 -2
- package/agents/gsd-roadmapper.md +29 -2
- package/agents/gsd-security-auditor.md +129 -0
- package/agents/gsd-ui-auditor.md +485 -0
- package/agents/gsd-ui-checker.md +305 -0
- package/agents/gsd-ui-researcher.md +368 -0
- package/agents/gsd-user-profiler.md +173 -0
- package/agents/gsd-verifier.md +207 -22
- package/commands/gsd/gsd-add-backlog.md +76 -0
- package/commands/gsd/gsd-analyze-dependencies.md +34 -0
- package/commands/gsd/gsd-audit-uat.md +24 -0
- package/commands/gsd/gsd-autonomous.md +45 -0
- package/commands/gsd/gsd-cleanup.md +5 -0
- package/commands/gsd/gsd-debug.md +29 -21
- package/commands/gsd/gsd-discuss-phase.md +15 -36
- package/commands/gsd/gsd-do.md +30 -0
- package/commands/gsd/gsd-docs-update.md +48 -0
- package/commands/gsd/gsd-execute-phase.md +24 -2
- package/commands/gsd/gsd-fast.md +30 -0
- package/commands/gsd/gsd-forensics.md +56 -0
- package/commands/gsd/gsd-help.md +2 -0
- package/commands/gsd/gsd-join-discord.md +2 -1
- package/commands/gsd/gsd-list-workspaces.md +19 -0
- package/commands/gsd/gsd-manager.md +40 -0
- package/commands/gsd/gsd-milestone-summary.md +51 -0
- package/commands/gsd/gsd-new-project.md +4 -0
- package/commands/gsd/gsd-new-workspace.md +44 -0
- package/commands/gsd/gsd-next.md +24 -0
- package/commands/gsd/gsd-note.md +34 -0
- package/commands/gsd/gsd-plan-phase.md +8 -1
- package/commands/gsd/gsd-plant-seed.md +28 -0
- package/commands/gsd/gsd-pr-branch.md +25 -0
- package/commands/gsd/gsd-profile-user.md +46 -0
- package/commands/gsd/gsd-quick.md +7 -3
- package/commands/gsd/gsd-reapply-patches.md +178 -45
- package/commands/gsd/gsd-remove-workspace.md +26 -0
- package/commands/gsd/gsd-research-phase.md +7 -12
- package/commands/gsd/gsd-review-backlog.md +62 -0
- package/commands/gsd/gsd-review.md +38 -0
- package/commands/gsd/gsd-secure-phase.md +35 -0
- package/commands/gsd/gsd-session-report.md +19 -0
- package/commands/gsd/gsd-set-profile.md +24 -23
- package/commands/gsd/gsd-ship.md +23 -0
- package/commands/gsd/gsd-stats.md +18 -0
- package/commands/gsd/gsd-thread.md +127 -0
- package/commands/gsd/gsd-ui-phase.md +34 -0
- package/commands/gsd/gsd-ui-review.md +32 -0
- package/commands/gsd/gsd-workstreams.md +71 -0
- package/get-shit-done/bin/gsd-tools.cjs +450 -90
- package/get-shit-done/bin/lib/commands.cjs +489 -24
- package/get-shit-done/bin/lib/config.cjs +329 -48
- package/get-shit-done/bin/lib/core.cjs +1143 -102
- package/get-shit-done/bin/lib/docs.cjs +267 -0
- package/get-shit-done/bin/lib/frontmatter.cjs +125 -43
- package/get-shit-done/bin/lib/init.cjs +918 -106
- package/get-shit-done/bin/lib/milestone.cjs +65 -33
- package/get-shit-done/bin/lib/model-profiles.cjs +70 -0
- package/get-shit-done/bin/lib/phase.cjs +434 -404
- package/get-shit-done/bin/lib/profile-output.cjs +1048 -0
- package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
- package/get-shit-done/bin/lib/roadmap.cjs +156 -101
- package/get-shit-done/bin/lib/schema-detect.cjs +238 -0
- package/get-shit-done/bin/lib/security.cjs +384 -0
- package/get-shit-done/bin/lib/state.cjs +711 -79
- package/get-shit-done/bin/lib/template.cjs +2 -2
- package/get-shit-done/bin/lib/uat.cjs +282 -0
- package/get-shit-done/bin/lib/verify.cjs +254 -42
- package/get-shit-done/bin/lib/workstream.cjs +495 -0
- package/get-shit-done/references/agent-contracts.md +79 -0
- package/get-shit-done/references/artifact-types.md +113 -0
- package/get-shit-done/references/checkpoints.md +12 -10
- package/get-shit-done/references/context-budget.md +49 -0
- package/get-shit-done/references/continuation-format.md +15 -15
- package/get-shit-done/references/decimal-phase-calculation.md +2 -3
- package/get-shit-done/references/domain-probes.md +125 -0
- package/get-shit-done/references/gate-prompts.md +100 -0
- package/get-shit-done/references/git-integration.md +47 -0
- package/get-shit-done/references/model-profile-resolution.md +2 -0
- package/get-shit-done/references/model-profiles.md +62 -16
- package/get-shit-done/references/phase-argument-parsing.md +2 -2
- package/get-shit-done/references/planner-gap-closure.md +62 -0
- package/get-shit-done/references/planner-reviews.md +39 -0
- package/get-shit-done/references/planner-revision.md +87 -0
- package/get-shit-done/references/planning-config.md +18 -1
- package/get-shit-done/references/revision-loop.md +97 -0
- package/get-shit-done/references/ui-brand.md +2 -2
- package/get-shit-done/references/universal-anti-patterns.md +58 -0
- package/get-shit-done/references/user-profiling.md +681 -0
- package/get-shit-done/references/workstream-flag.md +111 -0
- package/get-shit-done/templates/SECURITY.md +61 -0
- package/get-shit-done/templates/UAT.md +21 -3
- package/get-shit-done/templates/UI-SPEC.md +100 -0
- package/get-shit-done/templates/VALIDATION.md +3 -3
- package/get-shit-done/templates/claude-md.md +145 -0
- package/get-shit-done/templates/config.json +14 -3
- package/get-shit-done/templates/context.md +61 -6
- package/get-shit-done/templates/debug-subagent-prompt.md +2 -6
- package/get-shit-done/templates/dev-preferences.md +21 -0
- package/get-shit-done/templates/discussion-log.md +63 -0
- package/get-shit-done/templates/phase-prompt.md +46 -5
- package/get-shit-done/templates/planner-subagent-prompt.md +2 -10
- package/get-shit-done/templates/project.md +2 -0
- package/get-shit-done/templates/state.md +2 -2
- package/get-shit-done/templates/user-profile.md +146 -0
- package/get-shit-done/workflows/add-phase.md +4 -4
- package/get-shit-done/workflows/add-tests.md +4 -4
- package/get-shit-done/workflows/add-todo.md +4 -4
- package/get-shit-done/workflows/analyze-dependencies.md +96 -0
- package/get-shit-done/workflows/audit-milestone.md +20 -16
- package/get-shit-done/workflows/audit-uat.md +109 -0
- package/get-shit-done/workflows/autonomous.md +1036 -0
- package/get-shit-done/workflows/check-todos.md +4 -4
- package/get-shit-done/workflows/cleanup.md +4 -4
- package/get-shit-done/workflows/complete-milestone.md +22 -10
- package/get-shit-done/workflows/diagnose-issues.md +21 -7
- package/get-shit-done/workflows/discovery-phase.md +2 -2
- package/get-shit-done/workflows/discuss-phase-assumptions.md +671 -0
- package/get-shit-done/workflows/discuss-phase-power.md +291 -0
- package/get-shit-done/workflows/discuss-phase.md +558 -47
- package/get-shit-done/workflows/do.md +104 -0
- package/get-shit-done/workflows/docs-update.md +1093 -0
- package/get-shit-done/workflows/execute-phase.md +741 -58
- package/get-shit-done/workflows/execute-plan.md +77 -12
- package/get-shit-done/workflows/fast.md +105 -0
- package/get-shit-done/workflows/forensics.md +265 -0
- package/get-shit-done/workflows/health.md +28 -6
- package/get-shit-done/workflows/help.md +127 -7
- package/get-shit-done/workflows/insert-phase.md +4 -4
- package/get-shit-done/workflows/list-phase-assumptions.md +2 -2
- package/get-shit-done/workflows/list-workspaces.md +56 -0
- package/get-shit-done/workflows/manager.md +363 -0
- package/get-shit-done/workflows/map-codebase.md +83 -44
- package/get-shit-done/workflows/milestone-summary.md +223 -0
- package/get-shit-done/workflows/new-milestone.md +133 -25
- package/get-shit-done/workflows/new-project.md +216 -54
- package/get-shit-done/workflows/new-workspace.md +237 -0
- package/get-shit-done/workflows/next.md +97 -0
- package/get-shit-done/workflows/node-repair.md +92 -0
- package/get-shit-done/workflows/note.md +156 -0
- package/get-shit-done/workflows/pause-work.md +132 -15
- package/get-shit-done/workflows/plan-milestone-gaps.md +6 -7
- package/get-shit-done/workflows/plan-phase.md +513 -62
- package/get-shit-done/workflows/plant-seed.md +169 -0
- package/get-shit-done/workflows/pr-branch.md +129 -0
- package/get-shit-done/workflows/profile-user.md +450 -0
- package/get-shit-done/workflows/progress.md +154 -29
- package/get-shit-done/workflows/quick.md +285 -111
- package/get-shit-done/workflows/remove-phase.md +2 -2
- package/get-shit-done/workflows/remove-workspace.md +90 -0
- package/get-shit-done/workflows/research-phase.md +13 -9
- package/get-shit-done/workflows/resume-project.md +37 -18
- package/get-shit-done/workflows/review.md +281 -0
- package/get-shit-done/workflows/secure-phase.md +154 -0
- package/get-shit-done/workflows/session-report.md +146 -0
- package/get-shit-done/workflows/set-profile.md +2 -2
- package/get-shit-done/workflows/settings.md +91 -11
- package/get-shit-done/workflows/ship.md +237 -0
- package/get-shit-done/workflows/stats.md +60 -0
- package/get-shit-done/workflows/transition.md +150 -23
- package/get-shit-done/workflows/ui-phase.md +292 -0
- package/get-shit-done/workflows/ui-review.md +183 -0
- package/get-shit-done/workflows/update.md +262 -30
- package/get-shit-done/workflows/validate-phase.md +14 -17
- package/get-shit-done/workflows/verify-phase.md +143 -11
- package/get-shit-done/workflows/verify-work.md +141 -39
- package/package.json +1 -1
- package/skills/gsd-audit-milestone/SKILL.md +29 -0
- package/skills/gsd-cleanup/SKILL.md +19 -0
- package/skills/gsd-complete-milestone/SKILL.md +131 -0
- package/skills/gsd-discuss-phase/SKILL.md +54 -0
- package/skills/gsd-execute-phase/SKILL.md +49 -0
- package/skills/gsd-plan-phase/SKILL.md +37 -0
- package/skills/gsd-ui-phase/SKILL.md +24 -0
- package/skills/gsd-ui-review/SKILL.md +24 -0
- package/skills/gsd-verify-work/SKILL.md +30 -0
|
@@ -0,0 +1,1093 @@
|
|
|
1
|
+
<objective>
|
|
2
|
+
Generate, update, and verify all project documentation — both canonical doc types and existing hand-written docs. The orchestrator detects the project's doc structure, assembles a work manifest tracking every item, dispatches parallel doc-writer and doc-verifier agents across waves, reviews existing docs for accuracy, identifies documentation gaps, and fixes inaccuracies via a bounded fix loop. All state is persisted in a work manifest so no work item is lost between steps. Output: Complete, structure-aware documentation verified against the live codebase.
|
|
3
|
+
</objective>
|
|
4
|
+
|
|
5
|
+
<available_agent_types>
|
|
6
|
+
Valid GSD subagent types (use exact names — do not fall back to 'general'):
|
|
7
|
+
- gsd-doc-writer — Writes and updates project documentation files
|
|
8
|
+
- gsd-doc-verifier — Verifies factual claims in docs against the live codebase
|
|
9
|
+
</available_agent_types>
|
|
10
|
+
|
|
11
|
+
<process>
|
|
12
|
+
|
|
13
|
+
<step name="init_context" priority="first">
|
|
14
|
+
Load docs-update context:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" docs-init)
|
|
18
|
+
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
|
|
19
|
+
AGENT_SKILLS=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-doc-writer 2>/dev/null)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Extract from init JSON:
|
|
23
|
+
- `doc_writer_model` — model string to pass to each spawned agent (never hardcode a model name)
|
|
24
|
+
- `commit_docs` — whether to commit generated files when done
|
|
25
|
+
- `existing_docs` — array of `{path, has_gsd_marker}` objects for existing Markdown files
|
|
26
|
+
- `project_type` — object with boolean signals: `has_package_json`, `has_api_routes`, `has_cli_bin`, `is_open_source`, `has_deploy_config`, `is_monorepo`, `has_tests`
|
|
27
|
+
- `doc_tooling` — object with booleans: `docusaurus`, `vitepress`, `mkdocs`, `storybook`
|
|
28
|
+
- `monorepo_workspaces` — array of workspace glob patterns (empty if not a monorepo)
|
|
29
|
+
- `project_root` — absolute path to the project root
|
|
30
|
+
</step>
|
|
31
|
+
|
|
32
|
+
<step name="classify_project">
|
|
33
|
+
Map the `project_type` boolean signals from the init JSON to a primary type label and collect conditional doc signals.
|
|
34
|
+
|
|
35
|
+
**Primary type classification (first match wins):**
|
|
36
|
+
|
|
37
|
+
| Condition | primary_type |
|
|
38
|
+
|-----------|-------------|
|
|
39
|
+
| `is_monorepo` is true | `"monorepo"` |
|
|
40
|
+
| `has_cli_bin` is true AND `has_api_routes` is false | `"cli-tool"` |
|
|
41
|
+
| `has_api_routes` is true AND `is_open_source` is false | `"saas"` |
|
|
42
|
+
| `is_open_source` is true AND `has_api_routes` is false | `"open-source-library"` |
|
|
43
|
+
| (none of the above) | `"generic"` |
|
|
44
|
+
|
|
45
|
+
**Conditional doc signals (D-02 union rule — check independently after primary classification):**
|
|
46
|
+
|
|
47
|
+
After determining primary_type, check each signal independently regardless of the primary type. A CLI tool that is also open source with API routes still gets all three conditional docs.
|
|
48
|
+
|
|
49
|
+
| Signal | Conditional Doc |
|
|
50
|
+
|--------|----------------|
|
|
51
|
+
| `has_api_routes` is true | Queue API.md |
|
|
52
|
+
| `is_open_source` is true | Queue CONTRIBUTING.md |
|
|
53
|
+
| `has_deploy_config` is true | Queue DEPLOYMENT.md |
|
|
54
|
+
|
|
55
|
+
Present the classification result:
|
|
56
|
+
```
|
|
57
|
+
Project type: {primary_type}
|
|
58
|
+
Conditional docs queued: {list or "none"}
|
|
59
|
+
```
|
|
60
|
+
</step>
|
|
61
|
+
|
|
62
|
+
<step name="build_doc_queue">
|
|
63
|
+
Assemble the complete doc queue from always-on docs plus conditional docs from classify_project.
|
|
64
|
+
|
|
65
|
+
**Always-on docs (queued for every project, no exceptions):**
|
|
66
|
+
1. README
|
|
67
|
+
2. ARCHITECTURE
|
|
68
|
+
3. GETTING-STARTED
|
|
69
|
+
4. DEVELOPMENT
|
|
70
|
+
5. TESTING
|
|
71
|
+
6. CONFIGURATION
|
|
72
|
+
|
|
73
|
+
**Conditional docs (add only if signal matched in classify_project):**
|
|
74
|
+
- API (if `has_api_routes`)
|
|
75
|
+
- CONTRIBUTING (if `is_open_source`)
|
|
76
|
+
- DEPLOYMENT (if `has_deploy_config`)
|
|
77
|
+
|
|
78
|
+
**IMPORTANT: CHANGELOG.md is NEVER queued. The doc queue is built exclusively from the 9 known doc types listed above. Do not derive the queue from `existing_docs` directly — existing_docs is only used in the next step to determine create vs update mode.**
|
|
79
|
+
|
|
80
|
+
**Doc queue limit:** Maximum 9 docs. Always-on (6) + up to 3 conditional = at most 9.
|
|
81
|
+
|
|
82
|
+
**CONTRIBUTING.md confirmation (new file only):**
|
|
83
|
+
|
|
84
|
+
If CONTRIBUTING.md is in the conditional queue AND does NOT appear in the `existing_docs` array from init JSON:
|
|
85
|
+
|
|
86
|
+
1. If `--force` is present in `$ARGUMENTS`: skip this check, include CONTRIBUTING.md in the queue.
|
|
87
|
+
2. Otherwise, use question to confirm:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
question([{
|
|
91
|
+
question: "This project appears to be open source (LICENSE file detected). CONTRIBUTING.md does not exist yet. Would you like to create one?",
|
|
92
|
+
header: "Contributing",
|
|
93
|
+
multiSelect: false,
|
|
94
|
+
options: [
|
|
95
|
+
{ label: "Yes, create it", description: "Generate CONTRIBUTING.md with project guidelines" },
|
|
96
|
+
{ label: "No, skip it", description: "This project does not need a CONTRIBUTING.md" }
|
|
97
|
+
]
|
|
98
|
+
}])
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If the user selects "No, skip it": remove CONTRIBUTING.md from the doc queue.
|
|
102
|
+
If CONTRIBUTING.md already exists in `existing_docs`: skip this prompt entirely, include it for update.
|
|
103
|
+
|
|
104
|
+
**Existing non-canonical docs (review queue):**
|
|
105
|
+
|
|
106
|
+
After assembling the canonical doc queue above, scan the `existing_docs` array from init JSON for files that do NOT match any canonical path in the queue (neither primary nor fallback path from the resolve_modes table). These are hand-written docs like `docs/api/endpoint-map.md` or `docs/frontend/pages/not-found.md`.
|
|
107
|
+
|
|
108
|
+
For each non-canonical existing doc found:
|
|
109
|
+
- Add to a separate `review_queue`
|
|
110
|
+
- These will be passed to gsd-doc-verifier in the verify_docs step for accuracy checking
|
|
111
|
+
- If inaccuracies are found, they will be dispatched to gsd-doc-writer in `fix` mode for surgical corrections
|
|
112
|
+
|
|
113
|
+
If non-canonical docs are found, display them in the queue presentation:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Existing docs queued for accuracy review:
|
|
117
|
+
- docs/api/endpoint-map.md (hand-written)
|
|
118
|
+
- docs/api/README.md (hand-written)
|
|
119
|
+
- docs/frontend/pages/not-found.md (hand-written)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
If none found, omit this section from the queue presentation.
|
|
123
|
+
|
|
124
|
+
**Documentation gap detection (missing non-canonical docs):**
|
|
125
|
+
|
|
126
|
+
After assembling the canonical and review queues, analyze the codebase to identify areas that should have documentation but don't. This ensures the command creates complete project documentation, not just the 9 canonical types.
|
|
127
|
+
|
|
128
|
+
1. **Scan the codebase for undocumented areas:**
|
|
129
|
+
- Use glob/grep to discover significant source directories (e.g., `src/components/`, `src/pages/`, `src/services/`, `src/api/`, `lib/`, `routes/`)
|
|
130
|
+
- Compare against existing docs: for each major source directory, check if corresponding documentation exists in the docs tree
|
|
131
|
+
- Look at the project's existing doc structure for patterns — if the project has `docs/frontend/components/`, `docs/services/`, etc., these indicate the project's documentation conventions
|
|
132
|
+
|
|
133
|
+
2. **Identify gaps based on project conventions:**
|
|
134
|
+
- If the project has a `docs/` directory with grouped subdirectories, each source module area that has a corresponding docs subdirectory but is missing documentation files represents a gap
|
|
135
|
+
- If the project has frontend components/pages but no component docs, flag this
|
|
136
|
+
- If the project has service modules but no service docs, flag this
|
|
137
|
+
- Skip areas that are already covered by canonical docs (e.g., don't flag missing API docs if `docs/API.md` is already in the canonical queue)
|
|
138
|
+
|
|
139
|
+
3. **Present discovered gaps to the user:**
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
question([{
|
|
143
|
+
question: "Found {N} documentation gaps in the codebase. Which should be created?",
|
|
144
|
+
header: "Doc gaps",
|
|
145
|
+
multiSelect: true,
|
|
146
|
+
options: [
|
|
147
|
+
{ label: "{area}", description: "{why it needs docs — e.g., '5 components in src/components/ with no docs'}" },
|
|
148
|
+
...up to 4 options (group related gaps if more than 4)
|
|
149
|
+
]
|
|
150
|
+
}])
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
4. For each gap the user selects:
|
|
154
|
+
- Add to the generation queue with mode = `"create"`
|
|
155
|
+
- Set the output path to match the project's existing doc directory structure
|
|
156
|
+
- The gsd-doc-writer will receive a `doc_assignment` with `type: "custom"` and a description of what to document, using the project's source files as content discovery targets
|
|
157
|
+
|
|
158
|
+
If no gaps are detected, omit this section entirely.
|
|
159
|
+
|
|
160
|
+
Present the assembled queue to the user before proceeding:
|
|
161
|
+
|
|
162
|
+
Present the mode resolution table from resolve_modes (shown above), followed by:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
{If non-canonical docs found, show as a table:}
|
|
166
|
+
|
|
167
|
+
Existing docs queued for accuracy review:
|
|
168
|
+
|
|
169
|
+
| Path | Type |
|
|
170
|
+
|------|------|
|
|
171
|
+
| {path} | hand-written |
|
|
172
|
+
| ... | ... |
|
|
173
|
+
|
|
174
|
+
CHANGELOG.md: excluded (out of scope)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The mode resolution table IS the queue presentation — it shows every doc with its resolved path, mode, and source. Do not duplicate the list in a separate format.
|
|
178
|
+
|
|
179
|
+
Then confirm with question:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
question([{
|
|
183
|
+
question: "Doc queue assembled ({N} docs). Proceed with generation?",
|
|
184
|
+
header: "Doc queue",
|
|
185
|
+
multiSelect: false,
|
|
186
|
+
options: [
|
|
187
|
+
{ label: "Proceed", description: "Generate all {N} docs in the queue" },
|
|
188
|
+
{ label: "Abort", description: "Cancel doc generation" }
|
|
189
|
+
]
|
|
190
|
+
}])
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
If the user selects "Abort": exit the workflow. Otherwise continue to resolve_modes.
|
|
194
|
+
</step>
|
|
195
|
+
|
|
196
|
+
<step name="resolve_modes">
|
|
197
|
+
For each doc in the assembled queue, determine whether to create (new file) or update (existing file).
|
|
198
|
+
|
|
199
|
+
**Doc type to canonical path mapping (defaults):**
|
|
200
|
+
|
|
201
|
+
| Type | Default Path | Fallback Path |
|
|
202
|
+
|------|-------------|---------------|
|
|
203
|
+
| `readme` | `README.md` | — |
|
|
204
|
+
| `architecture` | `docs/ARCHITECTURE.md` | `ARCHITECTURE.md` |
|
|
205
|
+
| `getting_started` | `docs/GETTING-STARTED.md` | `GETTING-STARTED.md` |
|
|
206
|
+
| `development` | `docs/DEVELOPMENT.md` | `DEVELOPMENT.md` |
|
|
207
|
+
| `testing` | `docs/TESTING.md` | `TESTING.md` |
|
|
208
|
+
| `api` | `docs/API.md` | `API.md` |
|
|
209
|
+
| `configuration` | `docs/CONFIGURATION.md` | `CONFIGURATION.md` |
|
|
210
|
+
| `deployment` | `docs/DEPLOYMENT.md` | `DEPLOYMENT.md` |
|
|
211
|
+
| `contributing` | `CONTRIBUTING.md` | — |
|
|
212
|
+
|
|
213
|
+
**Structure-aware path resolution:**
|
|
214
|
+
|
|
215
|
+
Before applying the default path table, inspect the project's existing docs directory structure to detect whether the project uses **grouped subdirectories** or **flat files**. This determines how ALL new docs are placed.
|
|
216
|
+
|
|
217
|
+
**Step 1: Detect the project's docs organization pattern.**
|
|
218
|
+
|
|
219
|
+
List subdirectories under `docs/` from the `existing_docs` paths. If the project has 2+ subdirectories (e.g., `docs/architecture/`, `docs/api/`, `docs/guides/`, `docs/frontend/`), the project uses a **grouped structure**. If docs are only flat files directly in `docs/` (e.g., `docs/ARCHITECTURE.md`), it uses a **flat structure**.
|
|
220
|
+
|
|
221
|
+
**Step 2: Resolve paths based on the detected pattern.**
|
|
222
|
+
|
|
223
|
+
**If GROUPED structure detected:**
|
|
224
|
+
|
|
225
|
+
Every doc type MUST be placed in an appropriate subdirectory — no doc should be left flat in `docs/` when the project organizes into groups. Use the following resolution logic:
|
|
226
|
+
|
|
227
|
+
| Type | Subdirectory resolution (in priority order) |
|
|
228
|
+
|------|----------------------------------------------|
|
|
229
|
+
| `architecture` | existing `docs/architecture/` → create `docs/architecture/` if not present |
|
|
230
|
+
| `getting_started` | existing `docs/guides/` → existing `docs/getting-started/` → create `docs/guides/` |
|
|
231
|
+
| `development` | existing `docs/guides/` → existing `docs/development/` → create `docs/guides/` |
|
|
232
|
+
| `testing` | existing `docs/testing/` → existing `docs/guides/` → create `docs/testing/` |
|
|
233
|
+
| `api` | existing `docs/api/` → create `docs/api/` if not present |
|
|
234
|
+
| `configuration` | existing `docs/configuration/` → existing `docs/guides/` → create `docs/configuration/` |
|
|
235
|
+
| `deployment` | existing `docs/deployment/` → existing `docs/guides/` → create `docs/deployment/` |
|
|
236
|
+
|
|
237
|
+
For each type, check the resolution chain left-to-right. Use the first existing subdirectory. If none exist, create the rightmost option.
|
|
238
|
+
|
|
239
|
+
The filename within the subdirectory should be contextual — e.g., `docs/guides/getting-started.md`, `docs/architecture/overview.md`, `docs/api/reference.md` — rather than `docs/architecture/ARCHITECTURE.md`. Match the naming style of existing files in that subdirectory (lowercase-kebab, UPPERCASE, etc.).
|
|
240
|
+
|
|
241
|
+
**If FLAT structure detected (or no docs/ directory):**
|
|
242
|
+
|
|
243
|
+
Use the default path table above as-is (e.g., `docs/ARCHITECTURE.md`, `docs/TESTING.md`).
|
|
244
|
+
|
|
245
|
+
**Step 3: Store each resolved path and create directories.**
|
|
246
|
+
|
|
247
|
+
For each doc type, store the resolved path as `resolved_path`. Then create all necessary directories:
|
|
248
|
+
```bash
|
|
249
|
+
mkdir -p {each unique directory from resolved paths}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Mode resolution logic:**
|
|
253
|
+
|
|
254
|
+
For each doc type in the queue:
|
|
255
|
+
1. Check if the `resolved_path` appears in the `existing_docs` array from the init JSON
|
|
256
|
+
2. If not found at resolved path, check the default and fallback paths from the table
|
|
257
|
+
3. If found at any path: mode = `"update"` — use the read tool to load the current file content (will be passed as `existing_content` in the doc_assignment block). Use the found path as the output path (do not move existing docs).
|
|
258
|
+
4. If not found: mode = `"create"` — no existing content to load. Use the `resolved_path`.
|
|
259
|
+
|
|
260
|
+
**Ensure docs/ directory exists:**
|
|
261
|
+
Before proceeding to the next step, create the `docs/` directory and any resolved subdirectories if they do not exist:
|
|
262
|
+
```bash
|
|
263
|
+
mkdir -p docs/
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Output a mode resolution table:**
|
|
267
|
+
|
|
268
|
+
Present a table showing the resolved path, mode, and source for every doc in the queue:
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
Mode resolution:
|
|
272
|
+
|
|
273
|
+
| Doc | Resolved Path | Mode | Source |
|
|
274
|
+
|-----|---------------|------|--------|
|
|
275
|
+
| readme | README.md | update | found at README.md |
|
|
276
|
+
| architecture | docs/architecture/overview.md | create | new directory |
|
|
277
|
+
| getting_started | docs/guides/getting-started.md | update | found, hand-written |
|
|
278
|
+
| development | docs/guides/development.md | create | matched docs/guides/ |
|
|
279
|
+
| testing | docs/guides/testing.md | create | matched docs/guides/ |
|
|
280
|
+
| configuration | docs/guides/configuration.md | create | matched docs/guides/ |
|
|
281
|
+
| api | docs/api/reference.md | create | new directory |
|
|
282
|
+
| deployment | docs/guides/deployment.md | update | found, hand-written |
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
This table MUST be shown to the user — it is the primary confirmation of where files will be written and whether existing files will be updated. It appears as part of the queue presentation BEFORE the question confirmation.
|
|
286
|
+
|
|
287
|
+
Track the resolved mode and file path for each queued doc. For update-mode docs, store the loaded file content — it will be passed to the agent in the next steps.
|
|
288
|
+
|
|
289
|
+
**CRITICAL: Persist the work manifest.**
|
|
290
|
+
|
|
291
|
+
After resolve_modes completes, write ALL work items to `.planning/tmp/docs-work-manifest.json`. This is the single source of truth for every subsequent step — the orchestrator MUST read this file at each step instead of relying on memory.
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
mkdir -p .planning/tmp
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
write the manifest using the write tool:
|
|
298
|
+
|
|
299
|
+
```json
|
|
300
|
+
{
|
|
301
|
+
"canonical_queue": [
|
|
302
|
+
{
|
|
303
|
+
"type": "readme",
|
|
304
|
+
"resolved_path": "README.md",
|
|
305
|
+
"mode": "create|update|supplement",
|
|
306
|
+
"preservation_mode": null,
|
|
307
|
+
"wave": 1,
|
|
308
|
+
"status": "pending"
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
"review_queue": [
|
|
312
|
+
{
|
|
313
|
+
"path": "docs/frontend/components/button.md",
|
|
314
|
+
"type": "hand-written",
|
|
315
|
+
"status": "pending_review"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"gap_queue": [
|
|
319
|
+
{
|
|
320
|
+
"description": "Frontend components in src/components/",
|
|
321
|
+
"output_path": "docs/frontend/components/overview.md",
|
|
322
|
+
"status": "pending"
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"created_at": "{ISO timestamp}"
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Every subsequent step (dispatch, collect, verify, fix_loop, report) MUST begin by reading `.planning/tmp/docs-work-manifest.json` and update the `status` field for items it processes. This prevents the orchestrator from "forgetting" any work item across the multi-step workflow.
|
|
330
|
+
</step>
|
|
331
|
+
|
|
332
|
+
<step name="preservation_check">
|
|
333
|
+
Check for hand-written docs in the queue and gather user decisions before dispatch.
|
|
334
|
+
|
|
335
|
+
**Skip conditions (check in order):**
|
|
336
|
+
|
|
337
|
+
1. If `--force` is present in `$ARGUMENTS`: treat all docs as mode: regenerate, skip to detect_runtime_capabilities.
|
|
338
|
+
2. If `--verify-only` is present in `$ARGUMENTS`: skip to verify_only_report (do not continue to detect_runtime_capabilities).
|
|
339
|
+
3. If no docs in the queue have `has_gsd_marker: false` in the `existing_docs` array: skip to detect_runtime_capabilities.
|
|
340
|
+
|
|
341
|
+
**For each queued doc where `has_gsd_marker` is false (hand-written doc detected):**
|
|
342
|
+
|
|
343
|
+
Present the following choice using `question` if available, or inline prompt otherwise:
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
{filename} appears to be hand-written (no GSD marker found).
|
|
347
|
+
|
|
348
|
+
How should this file be handled?
|
|
349
|
+
[1] preserve -- Skip entirely. Leave unchanged.
|
|
350
|
+
[2] supplement -- Append only missing sections. Existing content untouched.
|
|
351
|
+
[3] regenerate -- Overwrite with a fresh GSD-generated doc.
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Record each decision. Update the doc queue:
|
|
355
|
+
- `preserve` decisions: remove the doc from the queue entirely
|
|
356
|
+
- `supplement` decisions: set mode to `supplement` in the doc_assignment block; include `existing_content` (full file content)
|
|
357
|
+
- `regenerate` decisions: set mode to `create` (treat as a fresh write)
|
|
358
|
+
|
|
359
|
+
**Fallback when question is unavailable:** Default all hand-written docs to `preserve` (safest default). Display message:
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
question unavailable — hand-written docs preserved by default.
|
|
363
|
+
Use --force to regenerate all docs, or re-run in OpenCode to get per-file prompts.
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
After all decisions recorded, continue to detect_runtime_capabilities.
|
|
367
|
+
</step>
|
|
368
|
+
|
|
369
|
+
<!-- If task tool is unavailable at runtime, skip dispatch/collect waves and use sequential_generation instead. -->
|
|
370
|
+
|
|
371
|
+
<step name="dispatch_wave_1" condition="task tool is available">
|
|
372
|
+
**read the work manifest first:** `read .planning/tmp/docs-work-manifest.json` — use `canonical_queue` items with `wave: 1` for this step.
|
|
373
|
+
|
|
374
|
+
Spawn 3 parallel gsd-doc-writer agents for Wave 1 docs: README, ARCHITECTURE, CONFIGURATION.
|
|
375
|
+
|
|
376
|
+
These are foundational docs with no cross-references needed, making them ideal for parallel generation.
|
|
377
|
+
|
|
378
|
+
Use `run_in_background=true` for all three to enable parallel execution.
|
|
379
|
+
|
|
380
|
+
**Agent 1: README**
|
|
381
|
+
|
|
382
|
+
```
|
|
383
|
+
@gsd-doc-writer "<doc_assignment>
|
|
384
|
+
type: readme
|
|
385
|
+
mode: {create|update|supplement}
|
|
386
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
387
|
+
project_context: {INIT JSON}
|
|
388
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
389
|
+
</doc_assignment>
|
|
390
|
+
|
|
391
|
+
{AGENT_SKILLS}
|
|
392
|
+
|
|
393
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
**Agent 2: ARCHITECTURE**
|
|
397
|
+
|
|
398
|
+
```
|
|
399
|
+
@gsd-doc-writer "<doc_assignment>
|
|
400
|
+
type: architecture
|
|
401
|
+
mode: {create|update|supplement}
|
|
402
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
403
|
+
project_context: {INIT JSON}
|
|
404
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
405
|
+
</doc_assignment>
|
|
406
|
+
|
|
407
|
+
{AGENT_SKILLS}
|
|
408
|
+
|
|
409
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Agent 3: CONFIGURATION**
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
@gsd-doc-writer "<doc_assignment>
|
|
416
|
+
type: configuration
|
|
417
|
+
mode: {create|update|supplement}
|
|
418
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
419
|
+
project_context: {INIT JSON}
|
|
420
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
421
|
+
note: Apply VERIFY markers to any infrastructure claim not discoverable from the repository.
|
|
422
|
+
</doc_assignment>
|
|
423
|
+
|
|
424
|
+
{AGENT_SKILLS}
|
|
425
|
+
|
|
426
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
**CRITICAL:** Agent prompts must contain ONLY the `<doc_assignment>` block, the `${AGENT_SKILLS}` variable, and the return instruction. Do not include project planning context, workflow prose, or any internal tooling references in agent prompts.
|
|
430
|
+
|
|
431
|
+
Continue to collect_wave_1.
|
|
432
|
+
</step>
|
|
433
|
+
|
|
434
|
+
<step name="collect_wave_1">
|
|
435
|
+
**read the work manifest first:** `read .planning/tmp/docs-work-manifest.json` — update `status` to `"completed"` or `"failed"` for each Wave 1 item after collection. write the updated manifest back to disk.
|
|
436
|
+
|
|
437
|
+
Wait for all 3 Wave 1 agents to complete using the TaskOutput tool.
|
|
438
|
+
|
|
439
|
+
Call TaskOutput for all 3 agents in parallel (single message with 3 TaskOutput calls):
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
TaskOutput tool:
|
|
443
|
+
task_id: "{task_id from README agent result}"
|
|
444
|
+
block: true
|
|
445
|
+
timeout: 300000
|
|
446
|
+
|
|
447
|
+
TaskOutput tool:
|
|
448
|
+
task_id: "{task_id from ARCHITECTURE agent result}"
|
|
449
|
+
block: true
|
|
450
|
+
timeout: 300000
|
|
451
|
+
|
|
452
|
+
TaskOutput tool:
|
|
453
|
+
task_id: "{task_id from CONFIGURATION agent result}"
|
|
454
|
+
block: true
|
|
455
|
+
timeout: 300000
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
**Expected confirmation format from each agent:**
|
|
459
|
+
```
|
|
460
|
+
## Doc Generation Complete
|
|
461
|
+
**Type:** {type}
|
|
462
|
+
**Mode:** {mode}
|
|
463
|
+
**File written:** `{path}` ({N} lines)
|
|
464
|
+
Ready for orchestrator summary.
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
**After collection, verify the Wave 1 files exist on disk** using the `resolved_path` from each manifest entry:
|
|
468
|
+
```bash
|
|
469
|
+
ls -la {resolved_path_1} {resolved_path_2} {resolved_path_3} 2>/dev/null
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
If any agent failed or its file is missing:
|
|
473
|
+
- Note the failure
|
|
474
|
+
- Continue with the successful docs (do NOT halt Wave 2 for a single failure)
|
|
475
|
+
- The missing doc will be noted in the final report
|
|
476
|
+
|
|
477
|
+
Continue to dispatch_wave_2.
|
|
478
|
+
</step>
|
|
479
|
+
|
|
480
|
+
<step name="dispatch_wave_2" condition="task tool is available">
|
|
481
|
+
**read the work manifest first:** `read .planning/tmp/docs-work-manifest.json` — use `canonical_queue` items with `wave: 2` for this step.
|
|
482
|
+
|
|
483
|
+
Spawn agents for all queued Wave 2 docs: GETTING-STARTED, DEVELOPMENT, TESTING, and any conditional docs (API, DEPLOYMENT, CONTRIBUTING) that were queued in build_doc_queue.
|
|
484
|
+
|
|
485
|
+
Wave 2 agents can reference Wave 1 outputs for cross-referencing — include the `wave_1_outputs` field in each doc_assignment block.
|
|
486
|
+
|
|
487
|
+
Use `run_in_background=true` for all Wave 2 agents to enable parallel execution within the wave.
|
|
488
|
+
|
|
489
|
+
**Agent: GETTING-STARTED**
|
|
490
|
+
|
|
491
|
+
```
|
|
492
|
+
@gsd-doc-writer "<doc_assignment>
|
|
493
|
+
type: getting_started
|
|
494
|
+
mode: {create|update|supplement}
|
|
495
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
496
|
+
project_context: {INIT JSON}
|
|
497
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
498
|
+
wave_1_outputs:
|
|
499
|
+
- README.md
|
|
500
|
+
- docs/ARCHITECTURE.md
|
|
501
|
+
- docs/CONFIGURATION.md
|
|
502
|
+
</doc_assignment>
|
|
503
|
+
|
|
504
|
+
{AGENT_SKILLS}
|
|
505
|
+
|
|
506
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
**Agent: DEVELOPMENT**
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
@gsd-doc-writer "<doc_assignment>
|
|
513
|
+
type: development
|
|
514
|
+
mode: {create|update|supplement}
|
|
515
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
516
|
+
project_context: {INIT JSON}
|
|
517
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
518
|
+
wave_1_outputs:
|
|
519
|
+
- README.md
|
|
520
|
+
- docs/ARCHITECTURE.md
|
|
521
|
+
- docs/CONFIGURATION.md
|
|
522
|
+
</doc_assignment>
|
|
523
|
+
|
|
524
|
+
{AGENT_SKILLS}
|
|
525
|
+
|
|
526
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
**Agent: TESTING**
|
|
530
|
+
|
|
531
|
+
```
|
|
532
|
+
@gsd-doc-writer "<doc_assignment>
|
|
533
|
+
type: testing
|
|
534
|
+
mode: {create|update|supplement}
|
|
535
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
536
|
+
project_context: {INIT JSON}
|
|
537
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
538
|
+
wave_1_outputs:
|
|
539
|
+
- README.md
|
|
540
|
+
- docs/ARCHITECTURE.md
|
|
541
|
+
- docs/CONFIGURATION.md
|
|
542
|
+
</doc_assignment>
|
|
543
|
+
|
|
544
|
+
{AGENT_SKILLS}
|
|
545
|
+
|
|
546
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
**Conditional Agent: API** (only if `has_api_routes` was true — spawn only if API.md was queued)
|
|
550
|
+
|
|
551
|
+
```
|
|
552
|
+
@gsd-doc-writer "<doc_assignment>
|
|
553
|
+
type: api
|
|
554
|
+
mode: {create|update|supplement}
|
|
555
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
556
|
+
project_context: {INIT JSON}
|
|
557
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
558
|
+
wave_1_outputs:
|
|
559
|
+
- README.md
|
|
560
|
+
- docs/ARCHITECTURE.md
|
|
561
|
+
- docs/CONFIGURATION.md
|
|
562
|
+
</doc_assignment>
|
|
563
|
+
|
|
564
|
+
{AGENT_SKILLS}
|
|
565
|
+
|
|
566
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
**Conditional Agent: DEPLOYMENT** (only if `has_deploy_config` was true — spawn only if DEPLOYMENT.md was queued)
|
|
570
|
+
|
|
571
|
+
```
|
|
572
|
+
@gsd-doc-writer "<doc_assignment>
|
|
573
|
+
type: deployment
|
|
574
|
+
mode: {create|update|supplement}
|
|
575
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
576
|
+
project_context: {INIT JSON}
|
|
577
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
578
|
+
note: Apply VERIFY markers to any infrastructure claim not discoverable from the repository.
|
|
579
|
+
wave_1_outputs:
|
|
580
|
+
- README.md
|
|
581
|
+
- docs/ARCHITECTURE.md
|
|
582
|
+
- docs/CONFIGURATION.md
|
|
583
|
+
</doc_assignment>
|
|
584
|
+
|
|
585
|
+
{AGENT_SKILLS}
|
|
586
|
+
|
|
587
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
**Conditional Agent: CONTRIBUTING** (only if `is_open_source` was true — spawn only if CONTRIBUTING.md was queued)
|
|
591
|
+
|
|
592
|
+
```
|
|
593
|
+
@gsd-doc-writer "<doc_assignment>
|
|
594
|
+
type: contributing
|
|
595
|
+
mode: {create|update|supplement}
|
|
596
|
+
preservation_mode: {preserve|supplement|regenerate|null}
|
|
597
|
+
project_context: {INIT JSON}
|
|
598
|
+
{existing_content: | (include full file content here if mode is update or supplement, else omit this line)}
|
|
599
|
+
wave_1_outputs:
|
|
600
|
+
- README.md
|
|
601
|
+
- docs/ARCHITECTURE.md
|
|
602
|
+
- docs/CONFIGURATION.md
|
|
603
|
+
</doc_assignment>
|
|
604
|
+
|
|
605
|
+
{AGENT_SKILLS}
|
|
606
|
+
|
|
607
|
+
write the doc file directly. Return confirmation only — do not return doc content."
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
**CRITICAL:** Agent prompts must contain ONLY the `<doc_assignment>` block, the `${AGENT_SKILLS}` variable, and the return instruction. Do not include project planning context, workflow prose, or any internal tooling references in agent prompts.
|
|
611
|
+
|
|
612
|
+
Continue to collect_wave_2.
|
|
613
|
+
</step>
|
|
614
|
+
|
|
615
|
+
<step name="collect_wave_2">
|
|
616
|
+
**read the work manifest first:** `read .planning/tmp/docs-work-manifest.json` — update `status` to `"completed"` or `"failed"` for each Wave 2 item after collection. write the updated manifest back to disk.
|
|
617
|
+
|
|
618
|
+
Wait for all Wave 2 agents to complete using the TaskOutput tool.
|
|
619
|
+
|
|
620
|
+
Call TaskOutput for all Wave 2 agents in parallel (single message with N TaskOutput calls — one per spawned Wave 2 agent):
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
TaskOutput tool:
|
|
624
|
+
task_id: "{task_id from GETTING-STARTED agent result}"
|
|
625
|
+
block: true
|
|
626
|
+
timeout: 300000
|
|
627
|
+
|
|
628
|
+
TaskOutput tool:
|
|
629
|
+
task_id: "{task_id from DEVELOPMENT agent result}"
|
|
630
|
+
block: true
|
|
631
|
+
timeout: 300000
|
|
632
|
+
|
|
633
|
+
TaskOutput tool:
|
|
634
|
+
task_id: "{task_id from TESTING agent result}"
|
|
635
|
+
block: true
|
|
636
|
+
timeout: 300000
|
|
637
|
+
|
|
638
|
+
# Add one TaskOutput call per conditional agent spawned (API, DEPLOYMENT, CONTRIBUTING)
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
**After collection, verify all Wave 2 files exist on disk** using the `resolved_path` from each manifest entry:
|
|
642
|
+
```bash
|
|
643
|
+
ls -la {resolved_path for each wave 2 item} 2>/dev/null
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
If any agent failed or its file is missing, note the failure and continue. Missing docs will be reported in the final report.
|
|
647
|
+
|
|
648
|
+
Continue to dispatch_monorepo_packages (if monorepo_workspaces is non-empty) or commit_docs.
|
|
649
|
+
</step>
|
|
650
|
+
|
|
651
|
+
<step name="dispatch_monorepo_packages" condition="monorepo_workspaces is non-empty">
|
|
652
|
+
After Wave 2 collection, generate per-package READMEs for each monorepo workspace.
|
|
653
|
+
|
|
654
|
+
**Condition:** Only run this step if `monorepo_workspaces` from the init JSON is non-empty.
|
|
655
|
+
|
|
656
|
+
**Resolve workspace packages from glob patterns:**
|
|
657
|
+
|
|
658
|
+
```bash
|
|
659
|
+
# Expand workspace globs to actual package directories
|
|
660
|
+
for pattern in {monorepo_workspaces}; do
|
|
661
|
+
ls -d $pattern 2>/dev/null
|
|
662
|
+
done
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
**For each resolved directory that contains a `package.json`:**
|
|
666
|
+
|
|
667
|
+
Determine mode:
|
|
668
|
+
- If `{package_dir}/README.md` exists: mode = `update`, read existing content
|
|
669
|
+
- Else: mode = `create`
|
|
670
|
+
|
|
671
|
+
Spawn a `gsd-doc-writer` agent with `run_in_background=true`:
|
|
672
|
+
|
|
673
|
+
```
|
|
674
|
+
@gsd-doc-writer "<doc_assignment>
|
|
675
|
+
type: readme
|
|
676
|
+
mode: {create|update}
|
|
677
|
+
scope: per_package
|
|
678
|
+
package_dir: {absolute path to package directory}
|
|
679
|
+
project_context: {INIT JSON with project_root set to package directory}
|
|
680
|
+
{existing_content: | (include full README.md content here if mode is update, else omit)}
|
|
681
|
+
</doc_assignment>
|
|
682
|
+
|
|
683
|
+
{AGENT_SKILLS}
|
|
684
|
+
|
|
685
|
+
write {package_dir}/README.md directly. Return confirmation only — do not return doc content."
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
Collect confirmations via TaskOutput for all package agents. Note failures in the final report.
|
|
689
|
+
|
|
690
|
+
**Fallback when task tool is unavailable:** Generate per-package READMEs sequentially inline after the `sequential_generation` step. For each package directory with a `package.json`, construct the equivalent `doc_assignment` block and generate the README following gsd-doc-writer instructions.
|
|
691
|
+
|
|
692
|
+
Continue to commit_docs.
|
|
693
|
+
</step>
|
|
694
|
+
|
|
695
|
+
<step name="sequential_generation" condition="task tool is NOT available (e.g. Antigravity, Gemini CLI, Codex, Copilot)">
|
|
696
|
+
**read the work manifest first:** `read .planning/tmp/docs-work-manifest.json` — use `canonical_queue` items for generation order. Update `status` after each doc is generated. write the updated manifest back to disk after all docs are complete.
|
|
697
|
+
|
|
698
|
+
When the `task` tool is unavailable, generate docs sequentially in the current context. This step replaces dispatch_wave_1, collect_wave_1, dispatch_wave_2, and collect_wave_2.
|
|
699
|
+
|
|
700
|
+
**IMPORTANT:** Do NOT use `browser_subagent`, `Explore`, or any browser-based tool. Use only file system tools (read, bash, write, grep, glob, or equivalent tools available in your runtime).
|
|
701
|
+
|
|
702
|
+
read `agents/gsd-doc-writer.md` instructions once before beginning. Follow the create_mode or update_mode instructions from that agent for each doc, using the same doc_assignment fields as the parallel path.
|
|
703
|
+
|
|
704
|
+
**Wave 1 (sequential — complete all three before starting Wave 2):**
|
|
705
|
+
|
|
706
|
+
For each Wave 1 doc, construct the equivalent doc_assignment block and generate the file inline:
|
|
707
|
+
|
|
708
|
+
1. **README** — mode from resolve_modes; for update/supplement mode, include existing_content
|
|
709
|
+
- Construct doc_assignment: `type: readme`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
|
|
710
|
+
- Explore the codebase (read, grep, glob, bash) following gsd-doc-writer create_mode / update_mode instructions
|
|
711
|
+
- write the file to the resolved path (README.md)
|
|
712
|
+
|
|
713
|
+
2. **ARCHITECTURE** — mode from resolve_modes; for update/supplement mode, include existing_content
|
|
714
|
+
- Construct doc_assignment: `type: architecture`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
|
|
715
|
+
- Explore the codebase following gsd-doc-writer instructions
|
|
716
|
+
- write the file to the resolved path (docs/ARCHITECTURE.md, or ARCHITECTURE.md if found at root as fallback)
|
|
717
|
+
|
|
718
|
+
3. **CONFIGURATION** — mode from resolve_modes; for update/supplement mode, include existing_content
|
|
719
|
+
- Construct doc_assignment: `type: configuration`, `mode: {create|update|supplement}`, `preservation_mode: {value|null}`, `project_context: {INIT JSON}`, `existing_content:` (if update/supplement)
|
|
720
|
+
- Apply VERIFY markers to any infrastructure claim not discoverable from the repository
|
|
721
|
+
- Explore the codebase following gsd-doc-writer instructions
|
|
722
|
+
- write the file to the resolved path (docs/CONFIGURATION.md, or CONFIGURATION.md if found at root as fallback)
|
|
723
|
+
|
|
724
|
+
**Wave 2 (sequential — begin only after all Wave 1 docs are written):**
|
|
725
|
+
|
|
726
|
+
Wave 2 docs can reference Wave 1 outputs since they are already written. Include `wave_1_outputs` in each doc_assignment.
|
|
727
|
+
|
|
728
|
+
4. **GETTING-STARTED** — mode from resolve_modes; include wave_1_outputs: [README.md, docs/ARCHITECTURE.md, docs/CONFIGURATION.md]
|
|
729
|
+
5. **DEVELOPMENT** — mode from resolve_modes; include wave_1_outputs
|
|
730
|
+
6. **TESTING** — mode from resolve_modes; include wave_1_outputs
|
|
731
|
+
7. **API** (only if queued) — mode from resolve_modes; include wave_1_outputs
|
|
732
|
+
8. **DEPLOYMENT** (only if queued) — Apply VERIFY markers to any infrastructure claim not discoverable from the repository; include wave_1_outputs
|
|
733
|
+
9. **CONTRIBUTING** (only if queued) — mode from resolve_modes; include wave_1_outputs
|
|
734
|
+
|
|
735
|
+
**Monorepo per-package READMEs (only if `monorepo_workspaces` is non-empty):**
|
|
736
|
+
|
|
737
|
+
After all 9 root-level docs are written, generate per-package READMEs sequentially:
|
|
738
|
+
|
|
739
|
+
For each resolved package directory (from workspace glob expansion) that contains a `package.json`:
|
|
740
|
+
- Determine mode: if `{package_dir}/README.md` exists, mode = `update`; else mode = `create`
|
|
741
|
+
- Construct doc_assignment: `type: readme`, `mode: {create|update}`, `scope: per_package`, `package_dir: {absolute path}`, `project_context: {INIT JSON with project_root set to package directory}`, `existing_content:` (if update)
|
|
742
|
+
- Follow gsd-doc-writer instructions for per_package scope
|
|
743
|
+
- write the file to `{package_dir}/README.md`
|
|
744
|
+
|
|
745
|
+
Continue to verify_docs.
|
|
746
|
+
</step>
|
|
747
|
+
|
|
748
|
+
<step name="verify_docs">
|
|
749
|
+
Verify factual claims in ALL docs — both canonical (generated) and non-canonical (existing hand-written) — against the live codebase.
|
|
750
|
+
|
|
751
|
+
**CRITICAL: read the work manifest first.**
|
|
752
|
+
|
|
753
|
+
```
|
|
754
|
+
read .planning/tmp/docs-work-manifest.json
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
Extract `canonical_queue` (items with `status: "completed"`) and `review_queue` (items with `status: "pending_review"`). Both queues are verified in this step.
|
|
758
|
+
|
|
759
|
+
**Skip condition:** If `--verify-only` is present in `$ARGUMENTS`, this step was already handled by `verify_only_report` (early exit). Skip.
|
|
760
|
+
|
|
761
|
+
**Phase 1: Verify canonical docs (generated/updated docs)**
|
|
762
|
+
|
|
763
|
+
For each doc in `canonical_queue` that was successfully written to disk:
|
|
764
|
+
|
|
765
|
+
1. Spawn the `gsd-doc-verifier` agent (or invoke sequentially if task tool is unavailable) with a `<verify_assignment>` block:
|
|
766
|
+
```xml
|
|
767
|
+
<verify_assignment>
|
|
768
|
+
doc_path: {relative path to the doc file, e.g. README.md}
|
|
769
|
+
project_root: {project_root from init JSON}
|
|
770
|
+
</verify_assignment>
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
2. After the verifier completes, read the result JSON from `.planning/tmp/verify-{doc_filename}.json`.
|
|
774
|
+
|
|
775
|
+
3. Update the manifest: set `status: "verified"` for each canonical doc processed.
|
|
776
|
+
|
|
777
|
+
**Phase 2: Verify non-canonical docs (existing hand-written docs)**
|
|
778
|
+
|
|
779
|
+
This is NOT optional. Every doc in `review_queue` MUST be verified.
|
|
780
|
+
|
|
781
|
+
For each doc in `review_queue` from the manifest:
|
|
782
|
+
|
|
783
|
+
1. Spawn the `gsd-doc-verifier` agent with the same `<verify_assignment>` block as above.
|
|
784
|
+
2. read the result JSON from `.planning/tmp/verify-{doc_filename}.json`.
|
|
785
|
+
3. Update the manifest: set `status: "verified"` for each review_queue doc processed.
|
|
786
|
+
|
|
787
|
+
Non-canonical docs with failures ARE eligible for the fix_loop. When a non-canonical doc has `claims_failed > 0`, dispatch it to gsd-doc-writer in `fix` mode with the failures array — the writer's fix mode does surgical corrections on specific lines regardless of doc type (no template needed). The writer MUST NOT restructure, rephrase, or reformat any content beyond the failing claims.
|
|
788
|
+
|
|
789
|
+
**Phase 3: Present combined verification summary**
|
|
790
|
+
|
|
791
|
+
Collect ALL results (canonical + non-canonical) into a single `verification_results` array:
|
|
792
|
+
|
|
793
|
+
```
|
|
794
|
+
Verification results:
|
|
795
|
+
|
|
796
|
+
Canonical docs (generated):
|
|
797
|
+
|
|
798
|
+
| Doc | Claims | Passed | Failed |
|
|
799
|
+
|------------------------|--------|--------|--------|
|
|
800
|
+
| README.md | 12 | 10 | 2 |
|
|
801
|
+
| docs/architecture/overview.md | 8 | 8 | 0 |
|
|
802
|
+
|
|
803
|
+
Existing docs (reviewed):
|
|
804
|
+
|
|
805
|
+
| Doc | Claims | Passed | Failed |
|
|
806
|
+
|------------------------|--------|--------|--------|
|
|
807
|
+
| docs/frontend/components/button.md | 5 | 4 | 1 |
|
|
808
|
+
| docs/services/api.md | 8 | 8 | 0 |
|
|
809
|
+
|
|
810
|
+
Total: {total_checked} claims checked, {total_failed} failures
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
write the updated manifest back to disk.
|
|
814
|
+
|
|
815
|
+
If all docs have `claims_failed === 0`: skip fix_loop, continue to scan_for_secrets.
|
|
816
|
+
If any doc (canonical OR non-canonical) has `claims_failed > 0`: continue to fix_loop.
|
|
817
|
+
</step>
|
|
818
|
+
|
|
819
|
+
<step name="fix_loop">
|
|
820
|
+
**read the work manifest first:** `read .planning/tmp/docs-work-manifest.json` — identify ALL docs (canonical AND non-canonical) with `claims_failed > 0` from the verification results in `.planning/tmp/verify-*.json`. Both queues are eligible for fixes.
|
|
821
|
+
|
|
822
|
+
Correct flagged inaccuracies by re-sending failing docs to the doc-writer in fix mode. Per D-06, max 2 iterations. Per D-05, halt immediately on regression.
|
|
823
|
+
|
|
824
|
+
**Skip condition:** If all docs passed verification (no failures), skip this step.
|
|
825
|
+
|
|
826
|
+
**Iteration tracking:**
|
|
827
|
+
- `MAX_FIX_ITERATIONS = 2`
|
|
828
|
+
- `iteration = 0`
|
|
829
|
+
- `previous_passed_docs` = set of doc_paths where claims_failed === 0 after initial verification
|
|
830
|
+
|
|
831
|
+
**For each iteration (while iteration < MAX_FIX_ITERATIONS and there are docs with failures):**
|
|
832
|
+
|
|
833
|
+
1. For each doc with `claims_failed > 0` in the latest verification_results:
|
|
834
|
+
a. read the current file content from disk.
|
|
835
|
+
b. Spawn `gsd-doc-writer` agent (or invoke sequentially) with a fix assignment:
|
|
836
|
+
```xml
|
|
837
|
+
<doc_assignment>
|
|
838
|
+
type: {original doc type from the queue, e.g. readme}
|
|
839
|
+
mode: fix
|
|
840
|
+
doc_path: {relative path}
|
|
841
|
+
project_context: {INIT JSON}
|
|
842
|
+
existing_content: {current file content read from disk}
|
|
843
|
+
failures:
|
|
844
|
+
- line: {line}
|
|
845
|
+
claim: "{claim}"
|
|
846
|
+
expected: "{expected}"
|
|
847
|
+
actual: "{actual}"
|
|
848
|
+
</doc_assignment>
|
|
849
|
+
```
|
|
850
|
+
c. One agent spawn per doc with failures. Do not batch multiple docs into one spawn.
|
|
851
|
+
|
|
852
|
+
2. After all fix agents complete, re-verify ALL docs (not just the ones that were fixed):
|
|
853
|
+
- Re-run the same verification process as verify_docs step.
|
|
854
|
+
- read updated result JSONs from `.planning/tmp/verify-{doc_filename}.json`.
|
|
855
|
+
|
|
856
|
+
3. **Regression detection (D-05):**
|
|
857
|
+
For each doc in the new verification_results:
|
|
858
|
+
- If this doc was in `previous_passed_docs` (passed in the prior round) AND now has `claims_failed > 0`, this is a REGRESSION.
|
|
859
|
+
- If regression detected: HALT the loop immediately. Present:
|
|
860
|
+
```
|
|
861
|
+
REGRESSION DETECTED -- halting fix loop.
|
|
862
|
+
|
|
863
|
+
{doc_path} previously passed verification but now has {claims_failed} failures after fix iteration {iteration + 1}.
|
|
864
|
+
|
|
865
|
+
This means the fix introduced new errors. Remaining failures require manual review.
|
|
866
|
+
```
|
|
867
|
+
Continue to scan_for_secrets (do not attempt further fixes).
|
|
868
|
+
|
|
869
|
+
4. Update `previous_passed_docs` with docs that now pass.
|
|
870
|
+
5. Increment `iteration`.
|
|
871
|
+
|
|
872
|
+
**After loop exhaustion (iteration === MAX_FIX_ITERATIONS and failures remain):**
|
|
873
|
+
|
|
874
|
+
Present remaining failures:
|
|
875
|
+
```
|
|
876
|
+
Fix loop completed ({MAX_FIX_ITERATIONS} iterations). Remaining failures:
|
|
877
|
+
|
|
878
|
+
| Doc | Failed Claims |
|
|
879
|
+
|-------------------|---------------|
|
|
880
|
+
| {doc_path} | {count} |
|
|
881
|
+
|
|
882
|
+
These failures require manual correction. Review the verification output in .planning/tmp/verify-*.json for details.
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
Continue to scan_for_secrets.
|
|
886
|
+
</step>
|
|
887
|
+
|
|
888
|
+
<step name="verify_only_report">
|
|
889
|
+
**Reached when `--verify-only` is present in `$ARGUMENTS`.** This is an early-exit step — do not proceed to dispatch, generation, commit, or report steps after this step.
|
|
890
|
+
|
|
891
|
+
Invoke the gsd-doc-verifier agent in read-only mode for each file in `existing_docs` from the init JSON:
|
|
892
|
+
|
|
893
|
+
1. For each doc in `existing_docs`:
|
|
894
|
+
a. Spawn `gsd-doc-verifier` (or invoke sequentially if task tool is unavailable) with:
|
|
895
|
+
```xml
|
|
896
|
+
<verify_assignment>
|
|
897
|
+
doc_path: {doc.path}
|
|
898
|
+
project_root: {project_root from init JSON}
|
|
899
|
+
</verify_assignment>
|
|
900
|
+
```
|
|
901
|
+
b. read the result JSON from `.planning/tmp/verify-{doc_filename}.json`.
|
|
902
|
+
|
|
903
|
+
2. Also count VERIFY markers in each doc: grep for `<!-- VERIFY:` in the file content.
|
|
904
|
+
|
|
905
|
+
Present a combined summary table:
|
|
906
|
+
|
|
907
|
+
```
|
|
908
|
+
--verify-only audit:
|
|
909
|
+
|
|
910
|
+
| File | Claims Checked | Passed | Failed | VERIFY Markers |
|
|
911
|
+
|--------------------------|----------------|--------|--------|----------------|
|
|
912
|
+
| README.md | 12 | 10 | 2 | 0 |
|
|
913
|
+
| docs/ARCHITECTURE.md | 8 | 8 | 0 | 0 |
|
|
914
|
+
| docs/CONFIGURATION.md | 5 | 3 | 2 | 5 |
|
|
915
|
+
| ... | ... | ... | ... | ... |
|
|
916
|
+
|
|
917
|
+
Total: {total_checked} claims checked, {total_failed} failures, {total_markers} VERIFY markers requiring manual review
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
If any failures exist, show details:
|
|
921
|
+
```
|
|
922
|
+
Failed claims:
|
|
923
|
+
README.md:34 - "src/cli/index.ts" (expected: file exists, actual: file not found)
|
|
924
|
+
docs/CONFIGURATION.md:12 - "npm run deploy" (expected: script in package.json, actual: script not found)
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
Display note:
|
|
928
|
+
```
|
|
929
|
+
To fix failures automatically: /gsd-docs-update (runs generation + fix loop)
|
|
930
|
+
To regenerate all docs from scratch: /gsd-docs-update --force
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
Clean up temp files: remove `.planning/tmp/verify-*.json` files.
|
|
934
|
+
|
|
935
|
+
End workflow — do not proceed to any dispatch, commit, or report steps.
|
|
936
|
+
</step>
|
|
937
|
+
|
|
938
|
+
<step name="scan_for_secrets">
|
|
939
|
+
CRITICAL SECURITY CHECK: Scan all generated/updated doc files for accidentally leaked secrets before committing. Per D-07, this runs once after the fix loop completes, before commit_docs.
|
|
940
|
+
|
|
941
|
+
Build the file list from the generation queue -- include all docs that were written to disk (created, updated, supplemented, or fixed). Do not hardcode a static list; use the actual list of files that were generated or modified.
|
|
942
|
+
|
|
943
|
+
Run secret pattern detection:
|
|
944
|
+
|
|
945
|
+
```bash
|
|
946
|
+
# Check for common API key patterns in generated docs
|
|
947
|
+
grep -E '(sk-[a-zA-Z0-9]{20,}|sk_live_[a-zA-Z0-9]+|sk_test_[a-zA-Z0-9]+|ghp_[a-zA-Z0-9]{36}|gho_[a-zA-Z0-9]{36}|glpat-[a-zA-Z0-9_-]+|AKIA[A-Z0-9]{16}|xox[baprs]-[a-zA-Z0-9-]+|-----BEGIN.*PRIVATE KEY|eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+\.)' \
|
|
948
|
+
{space-separated list of generated doc files} 2>/dev/null \
|
|
949
|
+
&& SECRETS_FOUND=true || SECRETS_FOUND=false
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
**If SECRETS_FOUND=true:**
|
|
953
|
+
|
|
954
|
+
```
|
|
955
|
+
SECURITY ALERT: Potential secrets detected in generated documentation!
|
|
956
|
+
|
|
957
|
+
Found patterns that look like API keys or tokens in:
|
|
958
|
+
{show grep output}
|
|
959
|
+
|
|
960
|
+
This would expose credentials if committed.
|
|
961
|
+
|
|
962
|
+
Action required:
|
|
963
|
+
1. Review the flagged lines above
|
|
964
|
+
2. Remove any real secrets from the doc files
|
|
965
|
+
3. Re-run /gsd-docs-update to regenerate clean docs
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
Then confirm with question:
|
|
969
|
+
|
|
970
|
+
```
|
|
971
|
+
question([{
|
|
972
|
+
question: "Potential secrets detected in generated docs. How would you like to proceed?",
|
|
973
|
+
header: "Security",
|
|
974
|
+
multiSelect: false,
|
|
975
|
+
options: [
|
|
976
|
+
{ label: "Safe to proceed", description: "I've reviewed the flagged lines — no real secrets, commit the docs" },
|
|
977
|
+
{ label: "Abort commit", description: "Skip committing — I'll clean up the docs first" }
|
|
978
|
+
]
|
|
979
|
+
}])
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
If the user selects "Abort commit": skip commit_docs and continue to report. If "Safe to proceed": continue to commit_docs.
|
|
983
|
+
|
|
984
|
+
**If SECRETS_FOUND=false:**
|
|
985
|
+
|
|
986
|
+
Continue to commit_docs.
|
|
987
|
+
</step>
|
|
988
|
+
|
|
989
|
+
<step name="commit_docs">
|
|
990
|
+
Only run this step if `commit_docs` is `true` from the init JSON. If `commit_docs` is false, skip to report.
|
|
991
|
+
|
|
992
|
+
Assemble the list of files that were actually generated (do not include files that failed or were skipped):
|
|
993
|
+
|
|
994
|
+
```bash
|
|
995
|
+
node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs: generate project documentation" \
|
|
996
|
+
--files README.md docs/ARCHITECTURE.md docs/CONFIGURATION.md docs/GETTING-STARTED.md docs/DEVELOPMENT.md docs/TESTING.md
|
|
997
|
+
# Append any conditional docs that were generated:
|
|
998
|
+
# --files ... docs/API.md docs/DEPLOYMENT.md CONTRIBUTING.md
|
|
999
|
+
# Append per-package READMEs if monorepo dispatch ran:
|
|
1000
|
+
# --files ... packages/core/README.md packages/cli/README.md
|
|
1001
|
+
```
|
|
1002
|
+
|
|
1003
|
+
Only include files that were successfully written to disk. Do not include failed or skipped docs.
|
|
1004
|
+
|
|
1005
|
+
Continue to report.
|
|
1006
|
+
</step>
|
|
1007
|
+
|
|
1008
|
+
<step name="report">
|
|
1009
|
+
**read the work manifest first:** `read .planning/tmp/docs-work-manifest.json` — use the manifest to compile the complete report covering all canonical docs, review_queue results, and gap_queue results. The manifest is the source of truth for what was processed.
|
|
1010
|
+
|
|
1011
|
+
Present a completion summary to the user.
|
|
1012
|
+
|
|
1013
|
+
**Summary format:**
|
|
1014
|
+
|
|
1015
|
+
```
|
|
1016
|
+
Documentation generation complete.
|
|
1017
|
+
|
|
1018
|
+
Project type: {primary_type}
|
|
1019
|
+
|
|
1020
|
+
Generated docs:
|
|
1021
|
+
| File | Mode | Lines |
|
|
1022
|
+
|--------------------------|--------|-------|
|
|
1023
|
+
| README.md | create | 87 |
|
|
1024
|
+
| docs/ARCHITECTURE.md | update | 124 |
|
|
1025
|
+
| docs/GETTING-STARTED.md | create | 63 |
|
|
1026
|
+
| docs/DEVELOPMENT.md | create | 71 |
|
|
1027
|
+
| docs/TESTING.md | create | 58 |
|
|
1028
|
+
| docs/CONFIGURATION.md | create | 45 |
|
|
1029
|
+
[conditional docs if generated]
|
|
1030
|
+
|
|
1031
|
+
{If monorepo per-package READMEs were generated:}
|
|
1032
|
+
Per-package READMEs:
|
|
1033
|
+
| Package | Mode | Lines |
|
|
1034
|
+
|---------------------|--------|-------|
|
|
1035
|
+
| packages/core | create | 42 |
|
|
1036
|
+
| packages/cli | create | 38 |
|
|
1037
|
+
|
|
1038
|
+
{If any docs failed or were skipped:}
|
|
1039
|
+
Skipped / failed:
|
|
1040
|
+
- docs/API.md: agent did not complete
|
|
1041
|
+
|
|
1042
|
+
{If preservation_check ran:}
|
|
1043
|
+
Preservation decisions:
|
|
1044
|
+
- {filename}: {preserve|supplement|regenerate}
|
|
1045
|
+
|
|
1046
|
+
{If docs/DEPLOYMENT.md or docs/CONFIGURATION.md were generated:}
|
|
1047
|
+
VERIFY markers: {N} markers placed in docs/DEPLOYMENT.md and/or docs/CONFIGURATION.md for infrastructure claims that require manual verification.
|
|
1048
|
+
|
|
1049
|
+
{If review_queue was non-empty:}
|
|
1050
|
+
|
|
1051
|
+
Existing doc accuracy review:
|
|
1052
|
+
|
|
1053
|
+
| Doc | Claims Checked | Passed | Failed | Fixed |
|
|
1054
|
+
|-----|----------------|--------|--------|-------|
|
|
1055
|
+
| docs/api/endpoint-map.md | 5 | 4 | 1 | 1 |
|
|
1056
|
+
|
|
1057
|
+
{For any remaining unfixed failures after fix_loop:}
|
|
1058
|
+
Remaining inaccuracies could not be auto-corrected — manual review recommended for flagged items above.
|
|
1059
|
+
|
|
1060
|
+
{If commit_docs was true:}
|
|
1061
|
+
All generated files committed.
|
|
1062
|
+
```
|
|
1063
|
+
|
|
1064
|
+
Remind the user they can fact-check generated docs:
|
|
1065
|
+
|
|
1066
|
+
```
|
|
1067
|
+
Run `/gsd-docs-update --verify-only` to fact-check generated docs against the codebase.
|
|
1068
|
+
```
|
|
1069
|
+
|
|
1070
|
+
End workflow.
|
|
1071
|
+
</step>
|
|
1072
|
+
|
|
1073
|
+
</process>
|
|
1074
|
+
|
|
1075
|
+
<success_criteria>
|
|
1076
|
+
- [ ] docs-init JSON loaded and all fields extracted
|
|
1077
|
+
- [ ] Project type correctly classified from project_type signals
|
|
1078
|
+
- [ ] Doc queue contains all always-on docs plus only the conditional docs matching project signals
|
|
1079
|
+
- [ ] CHANGELOG.md was NOT generated or queued
|
|
1080
|
+
- [ ] Each doc was generated in correct mode (create for new, update for existing)
|
|
1081
|
+
- [ ] Wave 1 docs (README, ARCHITECTURE, CONFIGURATION) completed before Wave 2 started
|
|
1082
|
+
- [ ] Generated docs contain zero GSD methodology content
|
|
1083
|
+
- [ ] docs/DEPLOYMENT.md and docs/CONFIGURATION.md use VERIFY markers for undiscoverable claims (if generated)
|
|
1084
|
+
- [ ] All generated files committed (if commit_docs is true)
|
|
1085
|
+
- [ ] Hand-written docs (no GSD marker) prompted for preserve/supplement/regenerate before dispatch (unless --force)
|
|
1086
|
+
- [ ] --force flag skipped preservation prompts and regenerated all docs
|
|
1087
|
+
- [ ] --verify-only flag reported doc status without generating files
|
|
1088
|
+
- [ ] Per-package READMEs generated for monorepo workspaces (if applicable)
|
|
1089
|
+
- [ ] verify_docs step checked all generated docs against the live codebase
|
|
1090
|
+
- [ ] fix_loop ran at most 2 iterations and halted on regression
|
|
1091
|
+
- [ ] scan_for_secrets ran before commit and blocked on detected patterns
|
|
1092
|
+
- [ ] --verify-only invokes gsd-doc-verifier for full fact-checking (not just VERIFY marker count)
|
|
1093
|
+
</success_criteria>
|