@@ -48,8 +48,9 @@ doc-index.json → tech-registry/*.md (L3) → feature-maps/*.md (L2) → _index
4848├── tech-registry/ ← Component documentation (Layer 3)
4949│ ├── _index.md
5050│ └── {component-slug}.md
51- └── sessions/
52- └── _index.md ← Planning sessions index (Layer 1)
51+ └── planning/ ← Planning sessions (Layer 1)
52+ ├── _index.md ← Planning sessions index
53+ └── {task-slug}-{date}/ ← Individual session folders
5354```
5455
5556## Phase 1: Load & Validate
@@ -87,165 +88,90 @@ IF docs already exist AND NOT --force:
8788 Ask user (unless -y → overwrite)
8889```
8990
90- ## Phase 2: Layer 3 — Component Documentation
91+ ## Phase 2: Layer 3 -- Component Documentation
9192
92- For each component in ` technicalComponents[] ` :
93+ For each component in ` technicalComponents[] ` , call the generate_ddd_docs endpoint :
9394
9495``` bash
95- ccw cli -p " PURPOSE: Generate component documentation for {component.name}
96- TASK:
97- • Document component purpose and responsibility
98- • List exported symbols (classes, functions, types)
99- • Document dependencies (internal and external)
100- • Include code examples for key APIs
101- • Document integration points with other components
102- MODE: write
103- CONTEXT: @{component.codeLocations[].path}
104- EXPECTED: Markdown file with: Overview, API Reference, Dependencies, Usage Examples
105- CONSTRAINTS: Focus on public API | Include type signatures
106- " --tool gemini --mode write --cd .workflow/.doc-index/tech-registry/
96+ for COMPONENT_ID in " ${technicalComponents[@]} " ; do
97+ ccw tool exec generate_ddd_docs ' {"strategy":"component","entityId":"' " $COMPONENT_ID " ' ","tool":"gemini"}'
98+ done
10799```
108100
109- Output: ` .workflow/.doc-index/tech-registry/{component-slug}.md `
110-
111- Frontmatter:
112- ``` markdown
113- ---
114- layer: 3
115- component_id: tech-{slug}
116- name: ComponentName
117- type: service|controller|model|...
118- features: [ feat-auth]
119- code_locations:
120- - path: src/services/auth.ts
121- symbols: [ AuthService, AuthService.login]
122- generated_at: ISO8601
123- ---
124- ```
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
125108
126- Sections: Responsibility, Code Locations, Related Requirements, Architecture Decisions, Dependencies (in/out)
109+ Output: ` .workflow/.doc-index/tech-registry/{component-slug}.md `
127110
128- ## Phase 3: Layer 2 — Feature Documentation
111+ ## Phase 3: Layer 2 -- Feature Documentation
129112
130- For each feature in ` features[] ` :
113+ For each feature in ` features[] ` , call the generate_ddd_docs endpoint :
131114
132115``` bash
133- ccw cli -p " PURPOSE: Generate feature documentation for {feature.name}
134- TASK:
135- • Describe feature purpose and business value
136- • List requirements (from requirementIds)
137- • Document components involved (from techComponentIds)
138- • Include architecture decisions (from adrIds)
139- • Provide integration guide
140- MODE: write
141- CONTEXT: @.workflow/.doc-index/tech-registry/{related-components}.md
142- EXPECTED: Markdown file with: Overview, Requirements, Components, Architecture, Integration
143- CONSTRAINTS: Reference Layer 3 component docs | Business-focused language
144- " --tool gemini --mode write --cd .workflow/.doc-index/feature-maps/
116+ for FEATURE_ID in " ${features[@]} " ; do
117+ ccw tool exec generate_ddd_docs ' {"strategy":"feature","entityId":"' " $FEATURE_ID " ' ","tool":"gemini"}'
118+ done
145119```
146120
147- Output: ` .workflow/.doc-index/feature-maps/{feature-slug}.md `
148-
149- Frontmatter:
150- ``` markdown
151- ---
152- layer: 2
153- feature_id: feat-{slug}
154- name: Feature Name
155- epic_id: EPIC-NNN|null
156- status: implemented|in-progress|planned|partial
157- requirements: [ REQ-001, REQ-002]
158- components: [ tech-auth-service, tech-user-model]
159- depends_on_layer3: [ tech-auth-service, tech-user-model]
160- tags: [ auth, security]
161- generated_at: ISO8601
162- ---
163- ```
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
164128
165- Sections: Overview, Requirements (with mapping status), Technical Components, Architecture Decisions, Change History
129+ Output: ` .workflow/.doc-index/feature-maps/{feature-slug}.md `
166130
167- ## Phase 4: Layer 1 — Index & Overview Documentation
131+ ## Phase 4: Layer 1 -- Index & Overview Documentation
168132
169133### 4.1 Index Documents
170134
171- Generate catalog files:
135+ Generate catalog files for each subdirectory :
172136
173- - ** feature-maps/ _ index.md ** — Feature overview table with status
174- - ** tech-registry/ _ index.md ** — Component registry table with types
175- - ** action-logs/ _ index.md ** — Action history table (empty initially for new projects)
137+ ``` bash
138+ # Feature maps index
139+ ccw tool exec generate_ddd_docs ' {"strategy":"index","entityId":"feature-maps","tool":"gemini"} '
176140
177- ### 4.2 README.md (unless --skip-overview)
141+ # Tech registry index
142+ ccw tool exec generate_ddd_docs ' {"strategy":"index","entityId":"tech-registry","tool":"gemini"}'
178143
179- ``` bash
180- ccw cli -p " PURPOSE: Generate project README with overview and navigation
181- TASK:
182- • Project summary and purpose
183- • Quick start guide
184- • Navigation to features, components, and architecture
185- • Link to doc-index.json
186- MODE: write
187- CONTEXT: @.workflow/.doc-index/doc-index.json @.workflow/.doc-index/feature-maps/_index.md
188- EXPECTED: README.md with: Overview, Quick Start, Navigation, Links
189- CONSTRAINTS: High-level only | Entry point for new developers
190- " --tool gemini --mode write --cd .workflow/.doc-index/
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"}'
191149```
192150
193- ### 4.3 ARCHITECTURE.md (unless --skip-overview)
151+ Or generate all indexes at once (omit entityId):
194152
195153``` bash
196- ccw cli -p " PURPOSE: Generate architecture overview document
197- TASK:
198- • System design overview
199- • Component relationships and dependencies
200- • Key architecture decisions (from ADRs)
201- • Technology stack
202- MODE: write
203- CONTEXT: @.workflow/.doc-index/doc-index.json @.workflow/.doc-index/tech-registry/*.md
204- EXPECTED: ARCHITECTURE.md with: System Design, Component Diagram, ADRs, Tech Stack
205- CONSTRAINTS: Architecture-focused | Reference component docs for details
206- " --tool gemini --mode write --cd .workflow/.doc-index/
154+ ccw tool exec generate_ddd_docs ' {"strategy":"index","tool":"gemini"}'
207155```
208156
209- ### 4.4 sessions/ _ index .md (unless --skip-overview)
157+ ### 4.2 README .md (unless --skip-overview)
210158
211159``` bash
212- ccw cli -p " PURPOSE: Generate planning sessions index
213- TASK:
214- • List all planning session folders chronologically
215- • Link to each session's plan.json
216- • Show session status and task count
217- MODE: write
218- CONTEXT: @.workflow/.doc-index/planning/*/plan.json
219- EXPECTED: sessions/_index.md with: Session List, Links, Status
220- CONSTRAINTS: Chronological order | Link to session folders
221- " --tool gemini --mode write --cd .workflow/.doc-index/sessions/
160+ ccw tool exec generate_ddd_docs ' {"strategy":"overview","tool":"gemini"}'
222161```
223162
224- Layer 1 frontmatter:
225- ``` markdown
226- ---
227- layer: 1
228- depends_on_layer2: [ feat-auth, feat-orders]
229- generated_at: ISO8601
230- ---
163+ ### 4.3 ARCHITECTURE.md (unless --skip-overview)
164+
165+ ``` bash
166+ ccw tool exec generate_ddd_docs ' {"strategy":"overview","entityId":"architecture","tool":"gemini"}'
231167```
232168
233169## Phase 5: SCHEMA.md (unless --skip-schema)
234170
235171### 5.1 Generate Schema Documentation
236172
237173``` bash
238- ccw cli -p " PURPOSE: Document doc-index.json schema structure and versioning
239- TASK:
240- • Document current schema structure (all fields)
241- • Define versioning policy (semver: major.minor)
242- • Document migration protocol for version upgrades
243- • Provide examples for each schema section
244- MODE: write
245- CONTEXT: @.workflow/.doc-index/doc-index.json
246- EXPECTED: SCHEMA.md with: Schema Structure, Versioning Policy, Migration Protocol, Examples
247- CONSTRAINTS: Complete field documentation | Clear migration steps
248- " --tool gemini --mode write --cd .workflow/.doc-index/
174+ ccw tool exec generate_ddd_docs ' {"strategy":"schema","tool":"gemini"}'
249175```
250176
251177### 5.2 Versioning Policy
@@ -284,7 +210,7 @@ Total: {N} documents generated
284210| ` -y, --yes ` | Auto-confirm all decisions |
285211| ` --layer <3\|2\|1\|all> ` | Generate specific layer only (default: all) |
286212| ` --force ` | Overwrite existing documents |
287- | ` --skip-overview ` | Skip README.md, ARCHITECTURE.md, sessions /_ index.md |
213+ | ` --skip-overview ` | Skip README.md, ARCHITECTURE.md, planning /_ index.md |
288214| ` --skip-schema ` | Skip SCHEMA.md generation |
289215
290216## Integration Points
@@ -293,3 +219,4 @@ Total: {N} documents generated
293219- ** Called by** : ` /ddd:scan ` (after index assembly), ` /ddd:index-build ` (after index assembly)
294220- ** Standalone** : Can be run independently on any project with existing doc-index.json
295221- ** 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
0 commit comments