@dv.nghiem/flowdeck 0.2.2 → 0.2.4

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.
Files changed (35) hide show
  1. package/dist/hooks/orchestrator-guard-hook.d.ts +2 -1
  2. package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +209 -146
  5. package/dist/services/telemetry.d.ts +1 -1
  6. package/dist/services/telemetry.d.ts.map +1 -1
  7. package/dist/tools/run-parallel.d.ts.map +1 -1
  8. package/docs/configuration.md +2 -0
  9. package/docs/parallel-execution.md +28 -0
  10. package/docs/workflows.md +72 -320
  11. package/package.json +1 -2
  12. package/src/commands/fd-deploy-check.md +67 -32
  13. package/src/commands/fd-discuss.md +44 -6
  14. package/src/commands/fd-fix-bug.md +47 -20
  15. package/src/commands/fd-map-codebase.md +66 -18
  16. package/src/commands/fd-multi-repo.md +130 -6
  17. package/src/commands/fd-new-feature.md +164 -21
  18. package/src/commands/fd-plan.md +66 -44
  19. package/src/commands/fd-review-code.md +69 -35
  20. package/src/commands/fd-write-docs.md +55 -23
  21. package/src/workflows/debug-flow.md +0 -119
  22. package/src/workflows/deploy-check-flow.md +0 -98
  23. package/src/workflows/discuss-flow.md +0 -97
  24. package/src/workflows/execute-flow.md +0 -233
  25. package/src/workflows/execute-phase.md +0 -145
  26. package/src/workflows/fix-bug-flow.md +0 -210
  27. package/src/workflows/map-codebase-flow.md +0 -92
  28. package/src/workflows/multi-repo-flow.md +0 -226
  29. package/src/workflows/parallel-execution-flow.md +0 -236
  30. package/src/workflows/plan-flow.md +0 -126
  31. package/src/workflows/plan-phase.md +0 -101
  32. package/src/workflows/refactor-flow.md +0 -122
  33. package/src/workflows/review-code-flow.md +0 -105
  34. package/src/workflows/spec-driven-flow.md +0 -43
  35. package/src/workflows/write-docs-flow.md +0 -95
@@ -1,233 +0,0 @@
1
- ---
2
- name: execute-flow
3
- description: "TDD-enforced feature execution: behavior checklist → RED (failing tests) → GREEN (minimum impl) → REFACTOR → review"
4
- triggers:
5
- - /new-feature
6
- steps:
7
- - name: guard_check
8
- agent: "@orchestrator"
9
- priority: first
10
- action: Verify .planning/ and .codebase/ exist, plan is confirmed; Initialize TDD state (stage=behavior)
11
- - name: load_plan
12
- agent: "@orchestrator"
13
- action: Read active PLAN.md from current phase directory
14
- - name: define_behaviors
15
- agent: "@orchestrator"
16
- action: "Generate behavior checklist from PLAN.md: list all acceptance cases, edge cases, and expected behaviors"
17
- - name: identify_next_step
18
- agent: "@orchestrator"
19
- action: Find first incomplete step (not in steps_complete); Check TDD stage for that step
20
- - name: write_behavior_tests
21
- agent: "@tester"
22
- action: "TDD RED: Write failing tests for the behavior. Tests MUST fail before implementation."
23
- - name: confirm_red
24
- agent: "@tester"
25
- action: "Run failing tests — confirm they fail for expected reasons. Do NOT proceed until tests fail."
26
- - name: implement_minimum
27
- agent: "@coder"
28
- action: "TDD GREEN: Implement minimum code to make failing tests pass. No speculative features."
29
- - name: confirm_green
30
- agent: "@tester"
31
- action: "Run tests — confirm they pass. Do NOT proceed until tests pass."
32
- - name: refactor_step
33
- agent: "@coder"
34
- action: "TDD REFACTOR: Clean up code for this step while preserving passing tests. Only if GREEN."
35
- - name: verify_step
36
- agent: "@tester"
37
- action: "Run full test suite for this step. Confirm all pass after refactoring."
38
- - name: review_step
39
- agent: "@reviewer"
40
- action: "Run @reviewer on completed step work; Check TDD discipline, test coverage, no test omissions"
41
- - name: update_state
42
- agent: "@orchestrator"
43
- action: "Mark step complete via planning-state tool; Update TDD stage"
44
- - name: loop_or_complete
45
- agent: "@orchestrator"
46
- action: "If more steps, return to identify_next_step; If all done, update phase status to complete"
47
- ---
48
-
49
- # Execute Flow (TDD-Enforced)
50
-
51
- ## Purpose
52
-
53
- Orchestrates execution of a confirmed PLAN.md following strict Red-Green-Refactor TDD cycle.
54
-
55
- ## Prerequisites
56
-
57
- Before executing, verify:
58
- 1. `.planning/` exists (project initialized)
59
- 2. `.codebase/` exists (codebase mapped)
60
- 3. `PLAN.md` is confirmed (via /plan phase)
61
-
62
- If any prerequisite fails, abort with clear error.
63
-
64
- ## TDD Cycle Per Step
65
-
66
- Each plan step follows the TDD cycle:
67
-
68
- ```
69
- BEHAVIOR → RED → GREEN → REFACTOR → next step
70
- ↑_________| |
71
- (loop if needed) Only if GREEN
72
- ```
73
-
74
- ## Step Definitions
75
-
76
- ### Step 1: Guard Check
77
-
78
- Verify prerequisites:
79
- - `.planning/` directory exists
80
- - `.codebase/` directory exists
81
- - `STATE.md` has `plan_confirmed: true`
82
- - `PLAN.md` exists in current phase directory
83
-
84
- Initialize TDD state:
85
- ```yaml
86
- tdd:
87
- stage: behavior
88
- cycle: 1
89
- behaviors: []
90
- regression_test_links: []
91
- ```
92
-
93
- ### Step 2: Load Plan
94
-
95
- Read the active PLAN.md from the current phase directory.
96
- Parse the tasks list and identify which steps are complete.
97
-
98
- ### Step 3: Define Behaviors
99
-
100
- Spawn `@orchestrator` to generate behavior checklist from PLAN.md:
101
- - Acceptance cases for each step
102
- - Edge cases to test
103
- - Expected behaviors
104
-
105
- Store in TDD state.
106
-
107
- ### Step 4: Identify Next Step
108
-
109
- From PLAN.md, find the first step NOT in `steps_complete`.
110
- Check TDD stage — only proceed if stage is appropriate for the step.
111
-
112
- ### Step 5: Write Failing Tests (RED)
113
-
114
- Spawn `@tester` to write tests for the step's behavior:
115
- - **Tests MUST fail** before implementation
116
- - Cover acceptance cases and edge cases
117
- - Use AAA pattern (Arrange-Act-Assert)
118
-
119
- ### Step 6: Confirm RED
120
-
121
- Run failing tests:
122
- - **GUARD: Do NOT proceed to Step 7 until tests fail**
123
- - If tests pass unexpectedly, tests don't correctly describe behavior
124
-
125
- ### Step 7: Implement Minimum (GREEN)
126
-
127
- Spawn `@coder` to implement:
128
- - **Minimum code** to make failing tests pass
129
- - No speculative features
130
- - No over-engineering
131
-
132
- ### Step 8: Confirm GREEN
133
-
134
- Run tests:
135
- - **GUARD: Do NOT proceed to Step 9 until tests pass**
136
- - If tests fail, return to Step 7
137
-
138
- ### Step 9: Refactor (REFACTOR)
139
-
140
- Only if GREEN:
141
- - Clean up code for this step
142
- - Remove dead code
143
- - Improve readability
144
- - **GUARD: Do not refactor if not GREEN**
145
-
146
- ### Step 10: Verify
147
-
148
- Run full test suite:
149
- - All tests must pass
150
- - If any fails, revert refactoring
151
-
152
- ### Step 11: Review Step
153
-
154
- Spawn `@reviewer` to check:
155
- - Code quality, security, conventions
156
- - TDD discipline followed
157
- - Test coverage >= 80%
158
- - No missing or weak tests (flag as major finding)
159
-
160
- ### Step 12: Update State
161
-
162
- Mark step complete via planning-state tool:
163
- ```yaml
164
- steps_complete: [N, ...]
165
- last_action: "Step N complete via TDD: [behavior]"
166
- tdd:
167
- stage: behavior # Ready for next step
168
- ```
169
-
170
- ### Step 13: Loop or Complete
171
-
172
- If more steps pending:
173
- - Return to Step 3 (define behaviors for next step)
174
-
175
- If all steps complete:
176
- - Update phase status to "complete"
177
- - Update ROADMAP.md progress
178
- - Present completion summary
179
-
180
- ## Wave-Based Execution
181
-
182
- WF-03 respects wave structure from PLAN.md:
183
- - Wave 1 steps execute first (with TDD cycle per step)
184
- - Wave 2 steps execute after Wave 1 completes
185
- - Wave 3 steps execute after Wave 2 completes
186
- - No intra-wave dependencies (parallel execution)
187
-
188
- ## Guards Summary
189
-
190
- | Transition | Guard | If Violated |
191
- |-----------|-------|-------------|
192
- | behavior → red | Test written and fails | Block until test fails |
193
- | red → green | Test exists and fails | Block until test passes |
194
- | green → refactor | Tests are green | Block until green |
195
- | refactor → verify | All tests pass | Block until all pass |
196
-
197
- ## Override Mechanism
198
-
199
- User can override with `/fd-new-feature --override`:
200
- - Every override is logged in `override_log`
201
- - Surface override in next review
202
- - Flag in deploy check
203
-
204
- ## Error Handling
205
-
206
- D-03: Fail fast with clear error
207
- - If guard check fails: abort with clear error and remediation
208
- - If @coder fails: report failure, offer retry or skip
209
- - If @reviewer finds critical issues: return to Step 7 for fixes
210
- - No partial state saved on error
211
-
212
- ## State Updates
213
-
214
- STATE.md updates after each step:
215
- ```yaml
216
- steps_complete: [1, 2] # Added after step 2
217
- steps_pending: [3, 4, 5] # Removed step 2
218
- last_action: "Step 2 TDD complete: [behavior] (RED→GREEN→REFACTOR)"
219
- tdd:
220
- stage: behavior
221
- cycle: 2
222
- behaviors_completed: 2
223
- ```
224
-
225
- Full phase completion:
226
- ```yaml
227
- status: complete
228
- last_action: "Phase N TDD complete — all steps finished"
229
- tdd:
230
- stage: complete
231
- cycles_used: N
232
- behaviors_completed: M
233
- ```
@@ -1,145 +0,0 @@
1
- ---
2
- name: execute-phase
3
- description: "Orchestrates /execute-phase [N] — delegates to orchestrator with checkpoint protocol"
4
- triggers:
5
- - /execute-phase
6
- steps:
7
- - name: verify_prerequisites
8
- agent: "@orchestrator"
9
- action: Check .planning/, .codebase/, plan_confirmed flag
10
- - name: load_context
11
- agent: "@orchestrator"
12
- action: Load PLAN.md, STATE.md, PROJECT.md
13
- - name: execute_tasks
14
- agent: "@orchestrator"
15
- action: Delegate each task to appropriate specialist (@coder, @tester, etc.)
16
- - name: checkpoint_protocol
17
- agent: "@orchestrator"
18
- action: After each task, checkpoint state via planning-state tool
19
- - name: present_results
20
- agent: "@orchestrator"
21
- action: Present execution summary
22
- - name: update_state
23
- agent: "@orchestrator"
24
- action: Mark phase complete in STATE.md and ROADMAP.md
25
- ---
26
-
27
- # Execute Phase Workflow
28
-
29
- ## Purpose
30
-
31
- Execute `/execute-phase [N]` to implement a phase plan using the orchestrator agent.
32
-
33
- ## Prerequisites
34
-
35
- Before executing, verify:
36
- 1. `.planning/` exists
37
- 2. `.codebase/` exists
38
- 3. `.planning/phases/phase-N/PLAN.md` exists and is confirmed
39
-
40
- ## Process
41
-
42
- ### Step 1: Verify Prerequisites
43
-
44
- Guard check:
45
- - `.planning/` directory must exist
46
- - `.codebase/` directory must exist
47
- - `STATE.md` has `plan_confirmed: true`
48
- - `PLAN.md` exists in `.planning/phases/phase-N/`
49
-
50
- If any check fails, abort with clear error and remediation steps.
51
-
52
- ### Step 2: Load Context
53
-
54
- Read into execution context:
55
- - `.planning/PROJECT.md` (project goals and tech stack)
56
- - `.planning/STATE.md` (current phase and progress)
57
- - `.planning/phases/phase-N/PLAN.md` (implementation plan)
58
- - `.codebase/ARCHITECTURE.md` (if exists)
59
- - `.codebase/CONVENTIONS.md` (if exists)
60
-
61
- ### Step 3: Execute Tasks
62
-
63
- Orchestrator delegates each task to appropriate specialist agents:
64
- - @coder for implementation
65
- - @tester for tests
66
- - @researcher for research tasks
67
- - etc.
68
-
69
- Each task:
70
- 1. Execute via delegated agent
71
- 2. Run verification tests for each task
72
- 3. Commit atomically with message: `feat(phase-N): task description`
73
- 4. Handle deviations (document, pause for approval if checkpoint)
74
-
75
- ### Step 4: Checkpoint Protocol
76
-
77
- After each task:
78
- - Call `planning-state.update_planning_state()` with current progress
79
- - Update `steps_complete`, `last_action`, `next_action`
80
- - Append to session history (never overwrite)
81
-
82
- If session interrupted:
83
- - User can resume with `/resume`
84
- - Orchestrator will pick up from last checkpoint
85
-
86
- ### Step 5: Present Results
87
-
88
- On completion, present:
89
- ```
90
- ## Phase [N] Execution Complete
91
-
92
- **Executed:** [date]
93
- **Tasks:** [N] completed
94
- **Duration:** [time]
95
-
96
- ### What Was Built
97
- [Summary of deliverables]
98
-
99
- ### Key Decisions
100
- - [D-XX]: [decision made during execution]
101
-
102
- ### Deviations
103
- - [Any deviations from original plan]
104
-
105
- ### Verification
106
- - [x] Criterion 1
107
- - [x] Criterion 2
108
- ```
109
-
110
- ### Step 6: Update State
111
-
112
- Update STATE.md:
113
- - Set `status: complete` for current phase
114
- - Update `last_action` to "Phase N complete"
115
- - Append to session history
116
-
117
- Update ROADMAP.md:
118
- - Mark phase N as "complete"
119
-
120
- ## Agent Configuration
121
-
122
- | Agent | Model | Purpose |
123
- |-------|-------|---------|
124
- | orchestrator | Sonnet 4.6 | Coordinates plan execution via delegation |
125
-
126
- ## Output Files
127
-
128
- - `.planning/phases/phase-N/SUMMARY.md` — execution summary
129
- - `.planning/phases/phase-N/RESULT.md` — final outcome (legacy)
130
- - STATE.md — updated with phase completion
131
-
132
- ## Deviation Handling
133
-
134
- If implementation requires deviating from plan:
135
- 1. Document the deviation in SUMMARY.md
136
- 2. If at checkpoint: pause and get user approval
137
- 3. If minor: continue and document
138
- 4. Update PLAN.md with adjusted approach
139
-
140
- ## Error Handling
141
-
142
- - If task fails: stop at checkpoint, preserve state
143
- - User can run `/fix-bug` or manually fix
144
- - Resume picks up from last successful checkpoint
145
- - Never leave partial state on error
@@ -1,210 +0,0 @@
1
- ---
2
- name: fix-bug-flow
3
- description: "TDD-enforced bug fix: reproduce → isolate → RED (failing regression test) → GREEN (minimum fix) → REFACTOR → verify"
4
- triggers:
5
- - /fix-bug
6
- steps:
7
- - name: load_context
8
- agent: "@orchestrator"
9
- action: Read STATE.md, ARCHITECTURE.md, CONVENTIONS.md; Initialize TDD state (stage=behavior)
10
- - name: define_behaviors
11
- agent: "@orchestrator"
12
- action: "Generate behavior checklist: what behaviors does this bug break? List acceptance cases."
13
- - name: reproduce
14
- agent: "@debug-specialist"
15
- action: Reproduce the bug with minimal case; document inputs and expected vs actual
16
- - name: isolate
17
- agent: "@researcher"
18
- action: Researcher investigates root cause; traces stack, reads related code
19
- - name: write_failing_test
20
- agent: "@tester"
21
- action: "TDD RED: Write a failing regression test that reproduces the bug. Test MUST fail before proceeding."
22
- - name: confirm_red
23
- agent: "@tester"
24
- action: "Run failing test — confirm it fails for the expected reason. Record RED state. Do NOT proceed until test fails."
25
- - name: implement_fix
26
- agent: "@coder"
27
- action: "TDD GREEN: Implement minimum code change to make the failing test pass. No over-engineering."
28
- - name: confirm_green
29
- agent: "@tester"
30
- action: "Run regression test — confirm it passes. Record GREEN state. Do NOT proceed until test passes."
31
- - name: refactor
32
- agent: "@coder"
33
- action: "TDD REFACTOR: Clean up implementation while preserving passing tests. Only if tests are GREEN."
34
- - name: verify_refactor
35
- agent: "@tester"
36
- action: "Run full test suite — confirm all tests pass after refactoring."
37
- - name: review
38
- agent: "@reviewer"
39
- action: "Reviewer checks: fix is correct, no regressions, TDD discipline followed, no missing tests."
40
- - name: update_state
41
- agent: "@orchestrator"
42
- action: "Update STATE.md: record bug, fix, test name, TDD stage=complete, regression test link"
43
- ---
44
-
45
- # Fix Bug Flow (TDD-Enforced)
46
-
47
- ## Purpose
48
-
49
- Fix a reported bug following strict Red-Green-Refactor TDD cycle with mandatory regression test.
50
-
51
- ## Prerequisites
52
-
53
- - `.planning/` initialized
54
- - Bug description or reproduction steps available
55
-
56
- ## TDD Cycle
57
-
58
- The workflow enforces the TDD cycle with guards at each transition:
59
-
60
- ```
61
- BEHAVIOR → RED → GREEN → REFACTOR → complete
62
- ↑______________| |
63
- (loop if needed) |
64
- Only if GREEN
65
- ```
66
-
67
- ## Step Definitions
68
-
69
- ### Step 1: Load Context
70
-
71
- Read:
72
- - `.planning/STATE.md` — current phase, TDD state
73
- - `.codebase/ARCHITECTURE.md` — system structure
74
- - `.codebase/CONVENTIONS.md` — coding standards
75
-
76
- Initialize TDD state:
77
- ```yaml
78
- tdd:
79
- stage: behavior
80
- cycle: 1
81
- behaviors: []
82
- regression_test_links: []
83
- ```
84
-
85
- ### Step 2: Define Behaviors
86
-
87
- Spawn `@orchestrator` to generate a behavior checklist:
88
- - What behaviors does this bug break?
89
- - What are the acceptance cases for "fixed"?
90
- - What edge cases should be tested?
91
-
92
- Store behaviors in TDD state.
93
-
94
- ### Step 3: Reproduce
95
-
96
- Identify minimal reproduction:
97
- - What inputs trigger the bug?
98
- - What is expected behavior?
99
- - What is actual behavior?
100
-
101
- Document in comment or issue before touching code.
102
-
103
- ### Step 4: Isolate Root Cause
104
-
105
- Spawn `@researcher` to investigate:
106
- - Trace the execution path
107
- - Read stack trace completely
108
- - Check recent changes: `git log --oneline -20 -- <file>`
109
- - Identify root cause (not symptom)
110
-
111
- ### Step 5: Write Failing Test (RED)
112
-
113
- Spawn `@tester` to write regression test:
114
- - **Test MUST fail on current code** (this is the RED phase)
115
- - Named: `test('should <expected> when <condition>')`
116
- - Tests the bug scenario exactly
117
- - Use AAA pattern (Arrange-Act-Assert)
118
-
119
- ### Step 6: Confirm RED
120
-
121
- Run the failing test:
122
- - Confirm it fails for the expected reason
123
- - **GUARD: Do NOT proceed to Step 7 until test fails**
124
- - If test passes unexpectedly, the test is not correctly reproducing the bug
125
-
126
- ### Step 7: Implement Fix (GREEN)
127
-
128
- Spawn `@coder` to implement fix:
129
- - Fix the root cause identified in Step 4
130
- - **Minimum code change** that makes regression test pass
131
- - Do NOT add unrelated functionality
132
- - Do NOT over-engineer
133
-
134
- ### Step 8: Confirm GREEN
135
-
136
- Run regression test:
137
- - **GUARD: Do NOT proceed to Step 9 until test passes**
138
- - If test fails, the fix is incomplete — return to Step 7
139
-
140
- ### Step 9: Refactor (REFACTOR)
141
-
142
- Only if tests are GREEN:
143
- - Clean up implementation
144
- - Remove dead code introduced during green phase
145
- - Improve readability without changing behavior
146
- - **GUARD: Do not refactor if tests are not green**
147
-
148
- ### Step 10: Verify Refactor
149
-
150
- Run full test suite:
151
- - All tests must pass
152
- - If any test fails, revert refactoring and return to Step 9
153
-
154
- ### Step 11: Review
155
-
156
- Spawn `@reviewer` to check:
157
- - Fix is correct and complete
158
- - No regressions introduced
159
- - TDD discipline followed (RED before GREEN, minimum impl)
160
- - Missing tests are flagged as major findings
161
- - No suspicious test omissions
162
-
163
- ### Step 12: Update State
164
-
165
- Update STATE.md:
166
- - Record bug description and root cause
167
- - Record fix applied (file:line)
168
- - Record regression test name and path
169
- - Update TDD stage to "complete"
170
- - Update `last_action` to "Bug fixed: [description]"
171
-
172
- ## Error Handling
173
-
174
- - **GUARD VIOLATION**: If coder attempts to skip RED or GREEN phase, block and return to correct phase
175
- - **Override mechanism**: User can override with `/fd-fix-bug --override` but every override is logged in `override_log`
176
- - If root cause unclear: spawn `@debug-specialist` for deeper analysis
177
- - If fix breaks tests: revert, reassess root cause, never suppress error
178
-
179
- ## Override Protocol
180
-
181
- If user requests bypass of TDD stages:
182
- 1. Log the override: `logTDDOverride(dir, stage, reason, override_by="user")`
183
- 2. Surface override in next review check
184
- 3. Flag in deploy check as "TDD override used"
185
-
186
- ## Output
187
-
188
- ```
189
- ## Bug Fix Complete (TDD-Enforced)
190
-
191
- **Bug:** [description]
192
- **Root cause:** [what caused it]
193
- **Behaviors tested:** [N behaviors]
194
- **TDD Stage:** complete
195
- **Cycle:** [N cycles used]
196
-
197
- **Regression test:** [test name] @ [path]
198
- **Test result:** ✅ PASS
199
-
200
- **Override used:** [yes/no]
201
- ```
202
-
203
- ## Guards Summary
204
-
205
- | Transition | Guard | If Violated |
206
- |-----------|-------|-------------|
207
- | behavior → red | Test written and fails | Block until test fails |
208
- | red → green | Test exists and fails | Block until test passes |
209
- | green → refactor | Tests are green | Block until green |
210
- | refactor → complete | All tests pass | Block until all pass |
@@ -1,92 +0,0 @@
1
- ---
2
- name: map-codebase-flow
3
- description: "Orchestrates codebase mapping (parallel mappers → wait for all → synthesize → write .codebase/ docs)"
4
- triggers:
5
- - /map-codebase
6
- steps:
7
- - name: check_existing
8
- agent: "@orchestrator"
9
- priority: first
10
- action: Check if .codebase/ already exists; warn and require confirmation if present
11
- - name: initialize_worktrees
12
- agent: "@orchestrator"
13
- action: Create individual worktrees for each mapper agent (one per doc: STACK, ARCHITECTURE, STRUCTURE, CONVENTIONS, TESTING, CONCERNS)
14
- - name: invoke_mappers
15
- agent: "@mapper"
16
- action: Spawn 6 @mapper agents in parallel, each writing to its assigned doc file
17
- - name: wait_for_mappers
18
- agent: "@orchestrator"
19
- action: Wait for all mapper agents to complete
20
- - name: cleanup_worktrees
21
- agent: "@orchestrator"
22
- action: Remove worktrees after all mappers complete (success or error)
23
- - name: verify_output
24
- agent: "@orchestrator"
25
- action: Verify all 6 .codebase/ doc files exist and contain non-empty content
26
- ---
27
-
28
- # Map Codebase Flow
29
-
30
- ## Purpose
31
-
32
- Maps an existing codebase to documentation via parallel analysis. Produces STACK.md, ARCHITECTURE.md, STRUCTURE.md, CONVENTIONS.md, TESTING.md, CONCERNS.md in `.codebase/`.
33
-
34
- ## Process
35
-
36
- ### Step 1: Check Existing
37
-
38
- If `.codebase/` directory already exists:
39
- ```
40
- Warning: .codebase/ already exists. Running /map-codebase will overwrite existing docs.
41
- Continue? (y/n)
42
- ```
43
- If user declines, abort. If user confirms, proceed.
44
-
45
- ### Step 2: Initialize Worktrees
46
-
47
- D-04: Each mapper runs in its own isolated worktree to prevent conflicts.
48
- Create worktrees:
49
- - `flowdeck-mapper-stack`
50
- - `flowdeck-mapper-arch`
51
- - `flowdeck-mapper-structure`
52
- - `flowdeck-mapper-conventions`
53
- - `flowdeck-mapper-testing`
54
- - `flowdeck-mapper-concerns`
55
-
56
- ### Step 3: Invoke Mappers
57
-
58
- Spawn 6 @mapper agents in parallel:
59
- - @mapper → STACK.md (tech stack, dependencies, versions)
60
- - @mapper → ARCHITECTURE.md (system design, components, data flow)
61
- - @mapper → STRUCTURE.md (file organization, directory layout)
62
- - @mapper → CONVENTIONS.md (coding standards, naming, patterns)
63
- - @mapper → TESTING.md (test strategy, coverage, frameworks)
64
- - @mapper → CONCERNS.md (known issues, technical debt, risks)
65
-
66
- Each mapper:
67
- - Reads source files directly (no guessing)
68
- - Outputs factual analysis only
69
- - Writes to assigned .codebase/ doc file
70
-
71
- ### Step 4: Wait for Completion
72
-
73
- Wait for all 6 mapper agents to complete. If any fails:
74
- - Log the failure
75
- - Continue with remaining mappers
76
- - Report which docs were not generated
77
-
78
- ### Step 5: Cleanup
79
-
80
- Remove all worktrees regardless of outcome (D-04: cleanup happens after all agents complete).
81
-
82
- ### Step 6: Verify
83
-
84
- Check that all 6 .codebase/ doc files exist and contain non-empty content.
85
- If any are missing or empty, report which ones need regeneration.
86
-
87
- ## Error Handling
88
-
89
- D-03: Fail fast with clear error
90
- - If .codebase/ check fails: show clear error with remediation
91
- - If worktree creation fails: report which worktree failed
92
- - Do NOT save partial state on error