claude-code-workflow 7.2.11 → 7.2.12
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/.claude/commands/workflow/analyze-with-file.md +108 -54
- package/.claude/commands/workflow-tune.md +811 -0
- package/.claude/skills/workflow-lite-execute/SKILL.md +106 -14
- package/.claude/skills/workflow-lite-plan/SKILL.md +34 -72
- package/.claude/skills/workflow-lite-test-review/SKILL.md +39 -26
- package/package.json +1 -1
- package/.claude/commands/ddd/auto.md +0 -359
- package/.claude/commands/ddd/doc-generate.md +0 -222
- package/.claude/commands/ddd/doc-refresh.md +0 -218
- package/.claude/commands/ddd/execute.md +0 -416
- package/.claude/commands/ddd/index-build.md +0 -212
- package/.claude/commands/ddd/plan.md +0 -611
- package/.claude/commands/ddd/scan.md +0 -365
- package/.claude/commands/ddd/sync.md +0 -353
- package/.claude/commands/ddd/update.md +0 -160
- package/.claude/commands/idaw/add.md +0 -287
- package/.claude/commands/idaw/resume.md +0 -442
- package/.claude/commands/idaw/run-coordinate.md +0 -648
- package/.claude/commands/idaw/run.md +0 -539
- package/.claude/commands/idaw/status.md +0 -182
- package/.claude/skills/workflow-tune/SKILL.md +0 -487
- package/.claude/skills/workflow-tune/phases/01-setup.md +0 -548
- package/.claude/skills/workflow-tune/phases/02-step-execute.md +0 -197
- package/.claude/skills/workflow-tune/phases/03-step-analyze.md +0 -386
- package/.claude/skills/workflow-tune/phases/04-synthesize.md +0 -257
- package/.claude/skills/workflow-tune/phases/05-optimize-report.md +0 -246
- package/.claude/skills/workflow-tune/specs/workflow-eval-criteria.md +0 -57
- package/.claude/skills/workflow-tune/templates/step-analysis-prompt.md +0 -88
- package/.claude/skills/workflow-tune/templates/synthesis-prompt.md +0 -90
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: auto
|
|
3
|
-
description: Chain command - automated document-driven development flow. Detects project state and runs the appropriate chain for new or existing projects.
|
|
4
|
-
argument-hint: "[-y|--yes] [--skip-spec] [--skip-build] [--spec <session-id>] [--resume] \"project idea or task description\""
|
|
5
|
-
allowed-tools: TodoWrite(*), Agent(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*)
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Auto Mode
|
|
9
|
-
|
|
10
|
-
When `--yes` or `-y`: All sub-commands run in auto mode. Minimal human intervention.
|
|
11
|
-
|
|
12
|
-
# DDD Auto Command (/ddd:auto)
|
|
13
|
-
|
|
14
|
-
## Purpose
|
|
15
|
-
|
|
16
|
-
Orchestrate the full document-driven development lifecycle. **Adapts to project state** — works for both new projects and existing codebases.
|
|
17
|
-
|
|
18
|
-
## Flow Variants
|
|
19
|
-
|
|
20
|
-
### Variant 1: New Project (no code, no spec)
|
|
21
|
-
```
|
|
22
|
-
spec-generator → ddd:index-build → ddd:plan → ddd:execute → verify → ddd:sync
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Variant 2: Existing Project (has code, no spec)
|
|
26
|
-
```
|
|
27
|
-
ddd:scan → ddd:plan → ddd:execute → verify → ddd:sync
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Variant 3: Existing Project with Spec (has code + spec)
|
|
31
|
-
```
|
|
32
|
-
ddd:index-build → ddd:plan → ddd:execute → verify → ddd:sync
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Variant 4: Index Exists (has doc-index.json)
|
|
36
|
-
```
|
|
37
|
-
ddd:plan → ddd:execute → verify → ddd:sync
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Flow Diagram
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
┌────────────────────────────────────────────────────────────┐
|
|
44
|
-
│ /ddd:auto │
|
|
45
|
-
│ │
|
|
46
|
-
│ Stage 0: Detect Project State │
|
|
47
|
-
│ ┌───────────────────────────────────┐ │
|
|
48
|
-
│ │ has_codebase? has_spec? has_index?│ │
|
|
49
|
-
│ └────────────┬──────────────────────┘ │
|
|
50
|
-
│ │ │
|
|
51
|
-
│ ┌──────────┼──────────────┐ │
|
|
52
|
-
│ ▼ ▼ ▼ │
|
|
53
|
-
│ No Code Code Only Code + Spec Index Exists │
|
|
54
|
-
│ │ │ │ │ │
|
|
55
|
-
│ ▼ │ │ │ │
|
|
56
|
-
│ Stage 1 │ │ │ │
|
|
57
|
-
│ Spec Gen │ │ │ │
|
|
58
|
-
│ │ │ │ │ │
|
|
59
|
-
│ ▼ │ ▼ │ │
|
|
60
|
-
│ Stage 2a Stage 2b Stage 2a │ │
|
|
61
|
-
│ index-build ddd:scan index-build │ │
|
|
62
|
-
│ (Path A or Path B auto-detected) │ │
|
|
63
|
-
│ │ │ │
|
|
64
|
-
│ └───────────────────┬───────────────────┘ │
|
|
65
|
-
│ ▼ │
|
|
66
|
-
│ Stage 3: DDD Plan (enhanced) │
|
|
67
|
-
│ (doc-index query + exploration + │
|
|
68
|
-
│ clarification + task planning) │
|
|
69
|
-
│ │ │
|
|
70
|
-
│ ▼ │
|
|
71
|
-
│ Stage 4: Execute │
|
|
72
|
-
│ (ddd:execute = doc-aware execution) │
|
|
73
|
-
│ │ │
|
|
74
|
-
│ ▼ │
|
|
75
|
-
│ Stage 4.5: Verify Gate │
|
|
76
|
-
│ (convergence + build + lint + tests │
|
|
77
|
-
│ → execution-manifest.json) │
|
|
78
|
-
│ │ │
|
|
79
|
-
│ PASS / WARN → continue │
|
|
80
|
-
│ FAIL → ask user │
|
|
81
|
-
│ │ │
|
|
82
|
-
│ ▼ │
|
|
83
|
-
│ Stage 5: Doc Sync │
|
|
84
|
-
│ (auto-triggered with --from-manifest, │
|
|
85
|
-
│ or manual /ddd:sync) │
|
|
86
|
-
└────────────────────────────────────────────────────────────┘
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Stage 0: Project State Detection
|
|
90
|
-
|
|
91
|
-
Automatically detect project state to determine which stages to run:
|
|
92
|
-
|
|
93
|
-
```
|
|
94
|
-
Check 1: doc-index.json exists? → has_index
|
|
95
|
-
Check 2: SPEC-* directories exist? → has_spec
|
|
96
|
-
Check 3: Source code directories? → has_codebase
|
|
97
|
-
Check 4: project-tech.json exists? → has_tech_analysis
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Decision Matrix
|
|
101
|
-
|
|
102
|
-
| has_codebase | has_spec | has_index | Action |
|
|
103
|
-
|:---:|:---:|:---:|--------|
|
|
104
|
-
| No | No | No | Stage 1 (spec-gen) → Stage 2a (index-build) → Stage 3-5 |
|
|
105
|
-
| No | Yes | No | Stage 2a (index-build) → Stage 3-5 |
|
|
106
|
-
| Yes | No | No | **Stage 2b (ddd:scan)** → Stage 3-5 |
|
|
107
|
-
| Yes | Yes | No | Stage 2a (index-build) → Stage 3-5 |
|
|
108
|
-
| Yes | * | Yes | **Skip to Stage 3** (index exists) |
|
|
109
|
-
|
|
110
|
-
### Override Flags
|
|
111
|
-
|
|
112
|
-
| Flag | Effect |
|
|
113
|
-
|------|--------|
|
|
114
|
-
| `--skip-spec` | Never run spec-generator |
|
|
115
|
-
| `--skip-build` | Never run index-build |
|
|
116
|
-
| `--spec <id>` | Use specific spec session, force Path A |
|
|
117
|
-
| `--from-scratch` | Rebuild index even if exists |
|
|
118
|
-
|
|
119
|
-
## Stage 1: Specification (conditional)
|
|
120
|
-
|
|
121
|
-
### Run When
|
|
122
|
-
- No codebase AND no spec AND `--skip-spec` not set
|
|
123
|
-
- User provides a new project idea (not an existing task description)
|
|
124
|
-
|
|
125
|
-
### Skip When
|
|
126
|
-
- `--skip-spec` flag
|
|
127
|
-
- Codebase already exists (existing project)
|
|
128
|
-
- `--spec <id>` pointing to existing session
|
|
129
|
-
|
|
130
|
-
### Execution
|
|
131
|
-
```
|
|
132
|
-
Invoke /spec-generator with user input
|
|
133
|
-
→ Output: .workflow/.doc-index/specs/SPEC-{slug}-{date}/
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Stage 2: Index Construction (conditional)
|
|
137
|
-
|
|
138
|
-
### Run When
|
|
139
|
-
- `doc-index.json` does not exist
|
|
140
|
-
- OR `--from-scratch` flag
|
|
141
|
-
|
|
142
|
-
### Route Selection
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
Has spec outputs → Stage 2a: /ddd:index-build (spec-first)
|
|
146
|
-
No spec, has code → Stage 2b: /ddd:scan (code-first)
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Stage 2a: /ddd:index-build (has spec)
|
|
150
|
-
```
|
|
151
|
-
Invoke /ddd:index-build [-y] [-s <spec-id>]
|
|
152
|
-
→ Output: doc-index.json from spec entities + code mapping
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Stage 2b: /ddd:scan (no spec, has code)
|
|
156
|
-
```
|
|
157
|
-
Invoke /ddd:scan [-y]
|
|
158
|
-
→ Output: doc-index.json from code analysis + inferred features
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Skip When
|
|
162
|
-
- `--skip-build` flag
|
|
163
|
-
- `doc-index.json` exists AND NOT `--from-scratch`
|
|
164
|
-
- In this case, suggest `/ddd:update` for incremental refresh
|
|
165
|
-
|
|
166
|
-
## Stage 3: Planning (always runs)
|
|
167
|
-
|
|
168
|
-
### Execution
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
Invoke /ddd:plan [-y] "task description"
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
The enhanced `/ddd:plan` now performs:
|
|
175
|
-
1. Doc-index query (instant context from features, requirements, components, ADRs)
|
|
176
|
-
2. Doc-index-guided exploration (1-4 angles based on affected features)
|
|
177
|
-
3. Clarification (aggregate ambiguities from exploration + doc-index gaps)
|
|
178
|
-
4. Task planning (plan.json + TASK-*.json with doc_context traceability)
|
|
179
|
-
5. Handoff selection
|
|
180
|
-
|
|
181
|
-
Output:
|
|
182
|
-
- `plan.json` — plan overview with doc_context
|
|
183
|
-
- `.task/TASK-*.json` — individual tasks with doc_context
|
|
184
|
-
- `exploration-{angle}.json` — exploration results (if Phase 2 ran)
|
|
185
|
-
- `planning-context.md` — legacy context package
|
|
186
|
-
|
|
187
|
-
### Handoff Decision
|
|
188
|
-
|
|
189
|
-
After planning, `/ddd:plan` presents execution options:
|
|
190
|
-
|
|
191
|
-
| Option | Description | Auto-Select When |
|
|
192
|
-
|--------|-------------|-----------------|
|
|
193
|
-
| **ddd:execute** | Document-aware execution (recommended) | Default in ddd workflow |
|
|
194
|
-
| **lite-execute** | Standard execution (no doc awareness) | When doc traceability not needed |
|
|
195
|
-
| **direct** | Start coding with context | User prefers manual |
|
|
196
|
-
| **stop** | Just the plan context | Planning/research only |
|
|
197
|
-
|
|
198
|
-
With `-y`: Auto-select `ddd:execute`.
|
|
199
|
-
|
|
200
|
-
## Stage 4: Execution
|
|
201
|
-
|
|
202
|
-
Based on Stage 3 handoff decision:
|
|
203
|
-
|
|
204
|
-
| Mode | Delegates To |
|
|
205
|
-
|------|-------------|
|
|
206
|
-
| **ddd:execute** | `/ddd:execute --in-memory` with plan.json + doc-index enrichment |
|
|
207
|
-
| lite-execute | `/workflow:lite-execute` with plan.json path |
|
|
208
|
-
| direct | Output context package, developer works manually |
|
|
209
|
-
| stop | End here, no execution |
|
|
210
|
-
|
|
211
|
-
### ddd:execute Features (when selected)
|
|
212
|
-
- Doc-enriched task prompts (feature context + component docs + ADR constraints)
|
|
213
|
-
- Per-batch impact verification (changes stay within planned scope)
|
|
214
|
-
- Result persistence (`TASK-*.result.json` per task, `execution-manifest.json` per session)
|
|
215
|
-
- Post-execution verify gate (Stage 4.5, unless `--skip-verify`)
|
|
216
|
-
- Post-completion auto-sync with manifest (Stage 5 triggered automatically)
|
|
217
|
-
|
|
218
|
-
**Note**: When using `ddd:execute`, Stage 4.5 and Stage 5 are auto-triggered. For other modes, run Stage 5 manually.
|
|
219
|
-
|
|
220
|
-
## Stage 4.5: Verify Gate
|
|
221
|
-
|
|
222
|
-
Embedded within `ddd:execute` (Step 4.5). Runs after all batches complete, before doc sync.
|
|
223
|
-
|
|
224
|
-
### Purpose
|
|
225
|
-
|
|
226
|
-
Quality gate ensuring execution output is correct before committing to documentation updates. Prevents bad code from being "blessed" into the doc-index.
|
|
227
|
-
|
|
228
|
-
### Checks Performed
|
|
229
|
-
|
|
230
|
-
| Check | Description | Gate Behavior |
|
|
231
|
-
|-------|-------------|---------------|
|
|
232
|
-
| **Convergence** | Run `task.convergence.verification` for each task | FAIL if any critical task fails |
|
|
233
|
-
| **Build** | Run project build command (`tsc --noEmit`, etc.) | FAIL on build errors |
|
|
234
|
-
| **Lint** | Run project linter (`eslint`, etc.) | WARN only (non-blocking) |
|
|
235
|
-
| **Regression** | Run full test suite, compare to baseline | FAIL on new test failures |
|
|
236
|
-
|
|
237
|
-
### Gate Results
|
|
238
|
-
|
|
239
|
-
| Result | Action |
|
|
240
|
-
|--------|--------|
|
|
241
|
-
| **PASS** | All checks passed → proceed to Stage 5 |
|
|
242
|
-
| **WARN** | Non-critical issues (lint warnings) → proceed with warnings logged |
|
|
243
|
-
| **FAIL** | Critical issues → ask user: fix now / skip sync / abort |
|
|
244
|
-
| **FAIL + `-y`** | Log failures, set `error_state` in session, stop |
|
|
245
|
-
|
|
246
|
-
### Output
|
|
247
|
-
|
|
248
|
-
- `execution-manifest.json` — persisted to session folder, consumed by Stage 5
|
|
249
|
-
- Contains: task results, files_modified (with task attribution), verify gate results
|
|
250
|
-
|
|
251
|
-
## Stage 5: Post-Task Sync
|
|
252
|
-
|
|
253
|
-
### Trigger
|
|
254
|
-
- **Auto**: `/ddd:execute` triggers `/ddd:sync --from-manifest` automatically after verify gate passes
|
|
255
|
-
- **Manual**: User runs `/ddd:sync` after completing work in direct/lite-execute mode
|
|
256
|
-
- **Resume**: `/ddd:auto --resume` after task completion
|
|
257
|
-
|
|
258
|
-
### Execution
|
|
259
|
-
```
|
|
260
|
-
# Auto mode (from ddd:execute): uses manifest for precise change tracking
|
|
261
|
-
Invoke /ddd:sync [-y] --task-id <id> --from-manifest {session}/execution-manifest.json "task summary"
|
|
262
|
-
|
|
263
|
-
# Manual mode (from direct/lite-execute): falls back to git diff
|
|
264
|
-
Invoke /ddd:sync [-y] [--task-id <id>] "task summary"
|
|
265
|
-
|
|
266
|
-
→ Updates: doc-index.json, feature-maps/, tech-registry/, action-logs/
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## State Tracking
|
|
270
|
-
|
|
271
|
-
### Session File: `.workflow/.doc-index/.auto-session.json`
|
|
272
|
-
|
|
273
|
-
```json
|
|
274
|
-
{
|
|
275
|
-
"session_id": "DAUTO-{timestamp}",
|
|
276
|
-
"input": "user's original input",
|
|
277
|
-
"detected_state": {
|
|
278
|
-
"has_codebase": true,
|
|
279
|
-
"has_spec": false,
|
|
280
|
-
"has_index": false,
|
|
281
|
-
"build_path": "code-first"
|
|
282
|
-
},
|
|
283
|
-
"stages_completed": ["detect", "index-build", "plan"],
|
|
284
|
-
"current_stage": "execute",
|
|
285
|
-
"spec_session": "SPEC-{slug}-{date}|null",
|
|
286
|
-
"plan_session": "planning/{task-slug}-{date}/",
|
|
287
|
-
"plan_context": "planning/{task-slug}-{date}/plan.json",
|
|
288
|
-
"execution_mode": "ddd:execute|lite-execute|direct|stop",
|
|
289
|
-
"execution_manifest": "planning/{task-slug}-{date}/execution-manifest.json|null",
|
|
290
|
-
"verify_gate": "PASS|WARN|FAIL|null",
|
|
291
|
-
"error_state": null,
|
|
292
|
-
"last_error": {
|
|
293
|
-
"stage": "execute",
|
|
294
|
-
"message": "Task TASK-002 failed: compilation error",
|
|
295
|
-
"timestamp": "ISO8601",
|
|
296
|
-
"recoverable": true
|
|
297
|
-
},
|
|
298
|
-
"created_at": "ISO8601",
|
|
299
|
-
"last_updated": "ISO8601"
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Resume
|
|
304
|
-
```
|
|
305
|
-
/ddd:auto --resume → Resume from current_stage in .auto-session.json
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### Error Recovery
|
|
309
|
-
```
|
|
310
|
-
/ddd:auto --resume
|
|
311
|
-
IF error_state is set:
|
|
312
|
-
Display last error context
|
|
313
|
-
Ask: retry current stage / skip to next / abort
|
|
314
|
-
ELSE:
|
|
315
|
-
Resume from current_stage normally
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
## Example Workflows
|
|
319
|
-
|
|
320
|
-
### New Project (Full Flow)
|
|
321
|
-
```
|
|
322
|
-
/ddd:auto "Build a task management API with user auth and team features"
|
|
323
|
-
→ Stage 0: No code, no spec → need spec-gen
|
|
324
|
-
→ Stage 1: spec-generator produces full spec
|
|
325
|
-
→ Stage 2: index-build creates index from spec + empty codebase
|
|
326
|
-
→ Stage 3: ddd:plan produces plan.json + TASK-*.json with doc_context
|
|
327
|
-
→ Stage 4: ddd:execute runs tasks with feature context enrichment
|
|
328
|
-
→ Stage 4.5: verify gate — convergence ✓, build ✓, tests ✓ → PASS
|
|
329
|
-
→ Stage 5: ddd:sync --from-manifest auto-triggered, updates index
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Existing Project, No Spec (Code-First)
|
|
333
|
-
```
|
|
334
|
-
/ddd:auto "Add rate limiting to API endpoints"
|
|
335
|
-
→ Stage 0: Has code, no spec, no index
|
|
336
|
-
→ Stage 2b: ddd:scan analyzes code, infers features from codebase
|
|
337
|
-
→ Stage 3: ddd:plan queries index, explores with security + patterns angles
|
|
338
|
-
→ Stage 4: ddd:execute runs with rate-limit component docs as context
|
|
339
|
-
→ Stage 4.5: verify gate — convergence ✓, tests 41/42 (1 regression) → WARN
|
|
340
|
-
→ Stage 5: ddd:sync --from-manifest, registers new rate-limit component
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
### Existing Project with Index (Incremental)
|
|
344
|
-
```
|
|
345
|
-
/ddd:auto "Fix auth token expiration bug"
|
|
346
|
-
→ Stage 0: Has code, has index → skip to plan
|
|
347
|
-
→ Stage 3: ddd:plan finds feat-auth, REQ-002, tech-auth-service (Low complexity, skip exploration)
|
|
348
|
-
→ Stage 4: ddd:execute runs single task with auth feature context
|
|
349
|
-
→ Stage 4.5: verify gate — convergence ✓, build ✓, tests ✓ → PASS
|
|
350
|
-
→ Stage 5: ddd:sync --from-manifest, updates tech-auth-service code locations
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
### Planning Only
|
|
354
|
-
```
|
|
355
|
-
/ddd:auto "Investigate payment module architecture"
|
|
356
|
-
→ Stage 0-2: (as needed)
|
|
357
|
-
→ Stage 3: ddd:plan shows full context with exploration results
|
|
358
|
-
→ Stage 4: user selects "stop" → gets plan.json + context package only
|
|
359
|
-
```
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: doc-generate
|
|
3
|
-
description: Generate full document tree from doc-index.json. Layer 3 (components) → Layer 2 (features) → Layer 1 (indexes/overview). Standalone or called by scan/index-build.
|
|
4
|
-
argument-hint: "[-y|--yes] [--layer <3|2|1|all>] [--force] [--skip-overview] [--skip-schema]"
|
|
5
|
-
allowed-tools: TodoWrite(*), Agent(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*)
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Auto Mode
|
|
9
|
-
|
|
10
|
-
When `--yes` or `-y`: Auto-generate all layers without confirmation prompts.
|
|
11
|
-
|
|
12
|
-
# DDD Doc Generate Command (/ddd:doc-generate)
|
|
13
|
-
|
|
14
|
-
## Purpose
|
|
15
|
-
|
|
16
|
-
Generate the complete document tree from `doc-index.json`. **Single source of truth** for all document generation logic, following bottom-up Layer 3 → 2 → 1 strategy.
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
doc-index.json → tech-registry/*.md (L3) → feature-maps/*.md (L2) → _index.md + README + ARCHITECTURE (L1)
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## When to Use
|
|
23
|
-
|
|
24
|
-
| Scenario | Use |
|
|
25
|
-
|----------|-----|
|
|
26
|
-
| After `/ddd:scan` builds doc-index.json | **doc-generate** (auto-called by scan) |
|
|
27
|
-
| After `/ddd:index-build` builds doc-index.json | **doc-generate** (auto-called by index-build) |
|
|
28
|
-
| Rebuild all docs from existing index | **doc-generate --force** |
|
|
29
|
-
| Regenerate only component docs | **doc-generate --layer 3** |
|
|
30
|
-
| Regenerate only overview/index docs | **doc-generate --layer 1** |
|
|
31
|
-
|
|
32
|
-
## Prerequisite
|
|
33
|
-
|
|
34
|
-
- `doc-index.json` must exist at `.workflow/.doc-index/doc-index.json`
|
|
35
|
-
- If not found → error: "No doc-index.json found. Run /ddd:scan or /ddd:index-build first."
|
|
36
|
-
|
|
37
|
-
## Storage Output
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
.workflow/.doc-index/
|
|
41
|
-
├── doc-index.json ← Input (read-only, not modified)
|
|
42
|
-
├── SCHEMA.md ← Schema documentation
|
|
43
|
-
├── README.md ← Project overview (Layer 1)
|
|
44
|
-
├── ARCHITECTURE.md ← Architecture overview (Layer 1)
|
|
45
|
-
├── feature-maps/ ← Feature documentation (Layer 2)
|
|
46
|
-
│ ├── _index.md
|
|
47
|
-
│ └── {feature-slug}.md
|
|
48
|
-
├── tech-registry/ ← Component documentation (Layer 3)
|
|
49
|
-
│ ├── _index.md
|
|
50
|
-
│ └── {component-slug}.md
|
|
51
|
-
└── planning/ ← Planning sessions (Layer 1)
|
|
52
|
-
├── _index.md ← Planning sessions index
|
|
53
|
-
└── {task-slug}-{date}/ ← Individual session folders
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Phase 1: Load & Validate
|
|
57
|
-
|
|
58
|
-
### 1.1 Load doc-index.json
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
Read .workflow/.doc-index/doc-index.json
|
|
62
|
-
Validate: features[], technicalComponents[] are non-empty arrays
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### 1.2 Schema Version Check
|
|
66
|
-
|
|
67
|
-
```javascript
|
|
68
|
-
const schemaVersion = docIndex.schema_version || '0.0';
|
|
69
|
-
if (schemaVersion !== '1.0') {
|
|
70
|
-
warn(`Schema version mismatch: found ${schemaVersion}, expected 1.0`);
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### 1.3 Determine Generation Scope
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
IF --layer 3: generate Layer 3 only
|
|
78
|
-
IF --layer 2: generate Layer 2 only (requires Layer 3 exists)
|
|
79
|
-
IF --layer 1: generate Layer 1 only (requires Layer 2 exists)
|
|
80
|
-
IF --layer all (default): generate Layer 3 → 2 → 1
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### 1.4 Check Existing Docs
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
IF docs already exist AND NOT --force:
|
|
87
|
-
Warn: "Documents already exist. Use --force to overwrite."
|
|
88
|
-
Ask user (unless -y → overwrite)
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Phase 2: Layer 3 -- Component Documentation
|
|
92
|
-
|
|
93
|
-
For each component in `technicalComponents[]`, call the generate_ddd_docs endpoint:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
for COMPONENT_ID in "${technicalComponents[@]}"; do
|
|
97
|
-
ccw tool exec generate_ddd_docs '{"strategy":"component","entityId":"'"$COMPONENT_ID"'","tool":"gemini"}'
|
|
98
|
-
done
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
The endpoint handles:
|
|
102
|
-
- Loading the component entity from doc-index.json
|
|
103
|
-
- Building YAML frontmatter (layer: 3, component_id, name, type, features, code_locations, generated_at)
|
|
104
|
-
- Constructing the CLI prompt with code context paths
|
|
105
|
-
- **Including Change History section**: Pull related entries from `doc-index.json.actions[]` where `affectedComponents` includes this component ID. Display as timeline (date, action type, description)
|
|
106
|
-
- Writing output to `.workflow/.doc-index/tech-registry/{slug}.md`
|
|
107
|
-
- Tool fallback (gemini -> qwen -> codex) on failure
|
|
108
|
-
|
|
109
|
-
Output: `.workflow/.doc-index/tech-registry/{component-slug}.md`
|
|
110
|
-
|
|
111
|
-
## Phase 3: Layer 2 -- Feature Documentation
|
|
112
|
-
|
|
113
|
-
For each feature in `features[]`, call the generate_ddd_docs endpoint:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
for FEATURE_ID in "${features[@]}"; do
|
|
117
|
-
ccw tool exec generate_ddd_docs '{"strategy":"feature","entityId":"'"$FEATURE_ID"'","tool":"gemini"}'
|
|
118
|
-
done
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
The endpoint handles:
|
|
122
|
-
- Loading the feature entity from doc-index.json
|
|
123
|
-
- Building YAML frontmatter (layer: 2, feature_id, name, epic_id, status, requirements, components, tags, generated_at)
|
|
124
|
-
- Constructing the CLI prompt referencing Layer 3 component docs
|
|
125
|
-
- **Including Change History section**: Pull related entries from `doc-index.json.actions[]` where `affectedFeatures` includes this feature ID. Display as timeline (date, action type, description)
|
|
126
|
-
- Writing output to `.workflow/.doc-index/feature-maps/{slug}.md`
|
|
127
|
-
- Tool fallback (gemini -> qwen -> codex) on failure
|
|
128
|
-
|
|
129
|
-
Output: `.workflow/.doc-index/feature-maps/{feature-slug}.md`
|
|
130
|
-
|
|
131
|
-
## Phase 4: Layer 1 -- Index & Overview Documentation
|
|
132
|
-
|
|
133
|
-
### 4.1 Index Documents
|
|
134
|
-
|
|
135
|
-
Generate catalog files for each subdirectory:
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# Feature maps index
|
|
139
|
-
ccw tool exec generate_ddd_docs '{"strategy":"index","entityId":"feature-maps","tool":"gemini"}'
|
|
140
|
-
|
|
141
|
-
# Tech registry index
|
|
142
|
-
ccw tool exec generate_ddd_docs '{"strategy":"index","entityId":"tech-registry","tool":"gemini"}'
|
|
143
|
-
|
|
144
|
-
# Action logs index
|
|
145
|
-
ccw tool exec generate_ddd_docs '{"strategy":"index","entityId":"action-logs","tool":"gemini"}'
|
|
146
|
-
|
|
147
|
-
# Planning sessions index
|
|
148
|
-
ccw tool exec generate_ddd_docs '{"strategy":"index","entityId":"planning","tool":"gemini"}'
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Or generate all indexes at once (omit entityId):
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
ccw tool exec generate_ddd_docs '{"strategy":"index","tool":"gemini"}'
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### 4.2 README.md (unless --skip-overview)
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
ccw tool exec generate_ddd_docs '{"strategy":"overview","tool":"gemini"}'
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### 4.3 ARCHITECTURE.md (unless --skip-overview)
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
ccw tool exec generate_ddd_docs '{"strategy":"overview","entityId":"architecture","tool":"gemini"}'
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Phase 5: SCHEMA.md (unless --skip-schema)
|
|
170
|
-
|
|
171
|
-
### 5.1 Generate Schema Documentation
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
ccw tool exec generate_ddd_docs '{"strategy":"schema","tool":"gemini"}'
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
### 5.2 Versioning Policy
|
|
178
|
-
|
|
179
|
-
**Semantic Versioning**:
|
|
180
|
-
- **Major** (X.0): Breaking changes (field removal, type changes, incompatible structure)
|
|
181
|
-
- **Minor** (X.Y): Non-breaking additions (new optional fields, new sections)
|
|
182
|
-
|
|
183
|
-
**Migration Protocol**:
|
|
184
|
-
1. Detect version mismatch in ddd:plan/ddd:sync
|
|
185
|
-
2. Log warning with migration instructions
|
|
186
|
-
3. Provide migration script or regeneration option
|
|
187
|
-
4. Update schema_version after successful migration
|
|
188
|
-
|
|
189
|
-
## Phase 6: Generation Report
|
|
190
|
-
|
|
191
|
-
```
|
|
192
|
-
Document Generation Report
|
|
193
|
-
|
|
194
|
-
Project: {name}
|
|
195
|
-
Source: doc-index.json (build_path: {spec-first|code-first})
|
|
196
|
-
|
|
197
|
-
Generated:
|
|
198
|
-
Layer 3 (Components): {N} documents in tech-registry/
|
|
199
|
-
Layer 2 (Features): {N} documents in feature-maps/
|
|
200
|
-
Layer 1 (Indexes): {N} documents (_index.md, README, ARCHITECTURE)
|
|
201
|
-
Schema: SCHEMA.md
|
|
202
|
-
|
|
203
|
-
Total: {N} documents generated
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
## Flags
|
|
207
|
-
|
|
208
|
-
| Flag | Effect |
|
|
209
|
-
|------|--------|
|
|
210
|
-
| `-y, --yes` | Auto-confirm all decisions |
|
|
211
|
-
| `--layer <3\|2\|1\|all>` | Generate specific layer only (default: all) |
|
|
212
|
-
| `--force` | Overwrite existing documents |
|
|
213
|
-
| `--skip-overview` | Skip README.md, ARCHITECTURE.md, planning/_index.md |
|
|
214
|
-
| `--skip-schema` | Skip SCHEMA.md generation |
|
|
215
|
-
|
|
216
|
-
## Integration Points
|
|
217
|
-
|
|
218
|
-
- **Input from**: `doc-index.json` (from `/ddd:scan` or `/ddd:index-build`)
|
|
219
|
-
- **Called by**: `/ddd:scan` (after index assembly), `/ddd:index-build` (after index assembly)
|
|
220
|
-
- **Standalone**: Can be run independently on any project with existing doc-index.json
|
|
221
|
-
- **Output**: Complete document tree in `.workflow/.doc-index/`
|
|
222
|
-
- **Endpoint**: `ccw tool exec generate_ddd_docs` handles prompt construction, frontmatter, tool fallback, and file creation
|