@dv.nghiem/flowdeck 0.2.3 → 0.3.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/README.md +24 -41
- package/dist/hooks/memory-hook.d.ts +21 -0
- package/dist/hooks/memory-hook.d.ts.map +1 -0
- package/dist/hooks/orchestrator-guard-hook.d.ts +2 -1
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/hooks/todo-hook.d.ts +1 -7
- package/dist/hooks/todo-hook.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +649 -310
- package/dist/services/memory-store.d.ts +40 -0
- package/dist/services/memory-store.d.ts.map +1 -0
- package/dist/services/telemetry.d.ts +1 -1
- package/dist/services/telemetry.d.ts.map +1 -1
- package/dist/tools/memory-search.d.ts +3 -0
- package/dist/tools/memory-search.d.ts.map +1 -0
- package/docs/commands/fd-doctor.md +21 -0
- package/docs/commands/fd-quick.md +33 -0
- package/docs/commands/fd-reflect.md +23 -0
- package/docs/commands/fd-status.md +31 -0
- package/docs/commands/fd-translate-intent.md +17 -0
- package/docs/commands.md +209 -271
- package/docs/configuration.md +2 -1
- package/docs/index.md +22 -28
- package/docs/memory.md +69 -0
- package/docs/quick-start.md +1 -1
- package/docs/workflows.md +72 -320
- package/package.json +1 -2
- package/src/commands/fd-deploy-check.md +189 -34
- package/src/commands/fd-discuss.md +44 -6
- package/src/commands/fd-fix-bug.md +47 -20
- package/src/commands/fd-map-codebase.md +66 -18
- package/src/commands/fd-multi-repo.md +130 -6
- package/src/commands/fd-new-feature.md +164 -21
- package/src/commands/fd-new-project.md +14 -1
- package/src/commands/fd-plan.md +66 -44
- package/src/commands/fd-quick.md +60 -0
- package/src/commands/fd-reflect.md +41 -2
- package/src/commands/fd-status.md +84 -0
- package/src/commands/fd-write-docs.md +55 -23
- package/src/rules/README.md +8 -7
- package/src/skills/agent-harness-construction/SKILL.md +227 -0
- package/src/skills/api-design/SKILL.md +5 -0
- package/src/skills/backend-patterns/SKILL.md +105 -0
- package/src/skills/clean-architecture/SKILL.md +85 -0
- package/src/skills/cqrs/SKILL.md +230 -0
- package/src/skills/ddd-architecture/SKILL.md +104 -0
- package/src/skills/django-patterns/SKILL.md +304 -0
- package/src/skills/django-tdd/SKILL.md +297 -0
- package/src/skills/event-driven-architecture/SKILL.md +152 -0
- package/src/skills/frontend-pattern/SKILL.md +159 -0
- package/src/skills/hexagonal-architecture/SKILL.md +80 -0
- package/src/skills/layered-architecture/SKILL.md +64 -0
- package/src/skills/postgres-patterns/SKILL.md +74 -0
- package/src/skills/python-patterns/SKILL.md +5 -0
- package/src/skills/saga-architecture/SKILL.md +113 -0
- package/dist/tools/run-parallel.d.ts +0 -4
- package/dist/tools/run-parallel.d.ts.map +0 -1
- package/docs/command-migration.md +0 -175
- package/docs/commands/fd-analyze-change.md +0 -107
- package/docs/commands/fd-dashboard.md +0 -11
- package/docs/commands/fd-evaluate-risk.md +0 -134
- package/docs/commands/fd-guarded-edit.md +0 -105
- package/docs/commands/fd-progress.md +0 -11
- package/docs/commands/fd-review-code.md +0 -29
- package/docs/commands/fd-roadmap.md +0 -10
- package/docs/commands/fd-settings.md +0 -10
- package/docs/parallel-execution.md +0 -227
- package/src/commands/fd-analyze-change.md +0 -57
- package/src/commands/fd-approve.md +0 -64
- package/src/commands/fd-blast-radius.md +0 -49
- package/src/commands/fd-dashboard.md +0 -57
- package/src/commands/fd-evaluate-risk.md +0 -62
- package/src/commands/fd-guarded-edit.md +0 -69
- package/src/commands/fd-impact-radar.md +0 -51
- package/src/commands/fd-learn.md +0 -36
- package/src/commands/fd-progress.md +0 -50
- package/src/commands/fd-regression-predict.md +0 -57
- package/src/commands/fd-review-code.md +0 -62
- package/src/commands/fd-review-route.md +0 -54
- package/src/commands/fd-roadmap.md +0 -46
- package/src/commands/fd-settings.md +0 -57
- package/src/commands/fd-test-gap.md +0 -54
- package/src/commands/fd-volatility-map.md +0 -64
- package/src/commands/fd-workspace-status.md +0 -34
- package/src/skills/parallel-execute/SKILL.md +0 -92
- package/src/workflows/debug-flow.md +0 -119
- package/src/workflows/deploy-check-flow.md +0 -98
- package/src/workflows/discuss-flow.md +0 -97
- package/src/workflows/execute-flow.md +0 -233
- package/src/workflows/execute-phase.md +0 -145
- package/src/workflows/fix-bug-flow.md +0 -210
- package/src/workflows/map-codebase-flow.md +0 -92
- package/src/workflows/multi-repo-flow.md +0 -226
- package/src/workflows/parallel-execution-flow.md +0 -236
- package/src/workflows/plan-flow.md +0 -126
- package/src/workflows/plan-phase.md +0 -101
- package/src/workflows/refactor-flow.md +0 -122
- package/src/workflows/review-code-flow.md +0 -105
- package/src/workflows/spec-driven-flow.md +0 -43
- package/src/workflows/write-docs-flow.md +0 -95
|
@@ -1,58 +1,213 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
3
|
-
argument-hint: [--env=staging|production]
|
|
2
|
+
description: Pre-deployment checks, code review, and pre-change analysis — all-in-one quality gate
|
|
3
|
+
argument-hint: [--env=staging|production] [--check=deploy,review,analysis] [--scope=path]
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Deploy Check
|
|
7
7
|
|
|
8
|
-
Run
|
|
8
|
+
Run comprehensive checks before deployment or review code changes.
|
|
9
9
|
|
|
10
|
-
**Input:** $ARGUMENTS
|
|
10
|
+
**Input:** $ARGUMENTS
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Check Types
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
### Deploy Check (`--check=deploy` or default)
|
|
15
|
+
Run full pre-deployment suite. See Steps 1-3 below.
|
|
15
16
|
|
|
16
|
-
###
|
|
17
|
-
|
|
18
|
-
- Check TDD coverage meets threshold (default: 80%)
|
|
19
|
-
- Report: tests passed/failed, coverage %, any flaky tests
|
|
17
|
+
### Code Review (`--check=review`)
|
|
18
|
+
Run parallel reviewer + researcher + tester on changed files. See Steps 4-6 below.
|
|
20
19
|
|
|
21
|
-
###
|
|
20
|
+
### Pre-Change Analysis (`--check=analysis`)
|
|
21
|
+
Run comprehensive pre-change analysis. See Step 7 below.
|
|
22
|
+
|
|
23
|
+
## Common Pre-flight
|
|
24
|
+
|
|
25
|
+
1. If `--scope` provided: use that path
|
|
26
|
+
2. If no scope with `--check=review`: use files changed since last commit
|
|
27
|
+
3. If no scope with `--check=deploy`: use all changed files since last commit
|
|
28
|
+
|
|
29
|
+
## Process
|
|
30
|
+
|
|
31
|
+
### Step 1: Parallel Checks
|
|
32
|
+
|
|
33
|
+
Launch four checks simultaneously:
|
|
34
|
+
|
|
35
|
+
**Check A: Test Suite (@tester)**
|
|
36
|
+
```bash
|
|
37
|
+
npm test
|
|
38
|
+
```
|
|
39
|
+
All tests must pass. No failures, no skips without justification.
|
|
40
|
+
|
|
41
|
+
**Check B: Security Scan**
|
|
42
|
+
|
|
43
|
+
Spawn `@security-auditor` to check:
|
|
44
|
+
- No hardcoded secrets in changed files
|
|
45
|
+
- Input validation at trust boundaries
|
|
46
|
+
- Auth/authz on all protected routes
|
|
47
|
+
- No CRITICAL or HIGH vulnerabilities
|
|
48
|
+
|
|
49
|
+
**Check C: Dependency CVE Audit**
|
|
50
|
+
```bash
|
|
51
|
+
npm audit --audit-level=high
|
|
52
|
+
```
|
|
53
|
+
No HIGH or CRITICAL CVEs unaddressed.
|
|
54
|
+
|
|
55
|
+
**Check D: Build Verification**
|
|
56
|
+
```bash
|
|
57
|
+
npm run build
|
|
58
|
+
```
|
|
59
|
+
Build must succeed with zero errors.
|
|
60
|
+
|
|
61
|
+
**Check E: Code Review (@reviewer)** — parallel with above
|
|
22
62
|
- Security review: secrets, injection vulnerabilities, auth gaps
|
|
23
63
|
- Quality review: critical bugs, missing error handling
|
|
24
64
|
- TDD discipline: verify new code has tests
|
|
25
65
|
- Report: CRITICAL/HIGH findings only (no nits for deploy check)
|
|
26
66
|
|
|
27
|
-
###
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
67
|
+
### Step 2: Aggregate Results
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
## Pre-Deployment Check
|
|
71
|
+
|
|
72
|
+
| Check | Status | Details |
|
|
73
|
+
|-------|--------|---------|
|
|
74
|
+
| Tests | ✅ PASS / ❌ FAIL | N/N passed |
|
|
75
|
+
| Security | ✅ PASS / ❌ FAIL | [findings] |
|
|
76
|
+
| CVE Audit | ✅ PASS / ❌ FAIL | [vulnerabilities] |
|
|
77
|
+
| Build | ✅ PASS / ❌ FAIL | [errors] |
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Step 3: Go/No-Go Decision
|
|
81
|
+
|
|
82
|
+
**🚀 GO** — all checks pass, proceed with deployment.
|
|
83
|
+
|
|
84
|
+
**🛑 NO-GO** — one or more checks failed:
|
|
85
|
+
```
|
|
86
|
+
Verdict: NO-GO
|
|
87
|
+
|
|
88
|
+
Required fixes before deploy:
|
|
89
|
+
- [ ] [fix 1]
|
|
90
|
+
- [ ] [fix 2]
|
|
91
|
+
|
|
92
|
+
Run /deploy-check again after fixing.
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## No-go conditions (automatic)
|
|
96
|
+
|
|
97
|
+
Any of these → automatic NO-GO:
|
|
98
|
+
- Test failures
|
|
99
|
+
- CRITICAL security vulnerability
|
|
100
|
+
- HIGH/CRITICAL CVE unpatched
|
|
101
|
+
- Build error
|
|
102
|
+
|
|
103
|
+
### Step 4: Code Review Scope (--check=review)
|
|
31
104
|
|
|
32
|
-
|
|
105
|
+
If `/deploy-check --check=review [scope]` provided: review files matching scope.
|
|
106
|
+
If no scope: review all files changed since last commit.
|
|
33
107
|
|
|
34
|
-
|
|
108
|
+
```bash
|
|
109
|
+
git diff --name-only HEAD~1
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If no changes found, report: "Nothing to review."
|
|
113
|
+
|
|
114
|
+
### Step 5: Parallel Review
|
|
115
|
+
|
|
116
|
+
Spawn three agents simultaneously:
|
|
117
|
+
|
|
118
|
+
**@reviewer**
|
|
119
|
+
- Security: secrets, injection, auth, XSS
|
|
120
|
+
- Quality: function size, nesting, error handling
|
|
121
|
+
- Conventions: naming, import style, patterns
|
|
122
|
+
|
|
123
|
+
**@researcher**
|
|
124
|
+
- Look up best practices for flagged patterns
|
|
125
|
+
- Check if flagged patterns are known vulnerabilities
|
|
126
|
+
- Provide context for MEDIUM findings
|
|
127
|
+
|
|
128
|
+
**@tester**
|
|
129
|
+
- Check coverage for changed files
|
|
130
|
+
- Identify untested paths
|
|
131
|
+
- Run existing tests
|
|
132
|
+
|
|
133
|
+
### Step 6: Aggregate Review Results
|
|
134
|
+
|
|
135
|
+
Merge all findings by severity:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
## Code Review: <scope>
|
|
139
|
+
|
|
140
|
+
### 🔴 CRITICAL (block merge)
|
|
141
|
+
- [finding with file:line and fix]
|
|
142
|
+
|
|
143
|
+
### 🟠 HIGH (strongly recommend fix)
|
|
144
|
+
- [finding]
|
|
145
|
+
|
|
146
|
+
### 🟡 MEDIUM (consider fixing)
|
|
147
|
+
- [finding]
|
|
35
148
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
| All checks pass, zero CRITICAL/HIGH | ✅ GO |
|
|
39
|
-
| Test failures or coverage below threshold | ❌ NO-GO |
|
|
40
|
-
| CRITICAL security issues | ❌ NO-GO |
|
|
41
|
-
| HIGH issues or HIGH CVEs | ⚠️ CONDITIONAL (requires override) |
|
|
149
|
+
### 🟢 LOW (optional)
|
|
150
|
+
- [finding]
|
|
42
151
|
|
|
43
|
-
|
|
152
|
+
### Coverage
|
|
153
|
+
- Changed files: N%
|
|
154
|
+
- Untested paths: [list]
|
|
44
155
|
|
|
156
|
+
### Verdict: PASS | FAIL | PASS_WITH_NOTES
|
|
45
157
|
```
|
|
46
|
-
════════════════════════════════════════════
|
|
47
|
-
DEPLOY CHECK — <env>
|
|
48
|
-
════════════════════════════════════════════
|
|
49
|
-
Tests: <passed>/<total> | Coverage: <X>%
|
|
50
|
-
Security: <N> critical, <M> high
|
|
51
|
-
CVEs: <N> high, <M> medium
|
|
52
158
|
|
|
53
|
-
|
|
54
|
-
|
|
159
|
+
### Step 7: Pre-Change Analysis (--check=analysis)
|
|
160
|
+
|
|
161
|
+
Run all analyses in parallel:
|
|
162
|
+
|
|
163
|
+
1. **Impact Radar** — which files/APIs/tests are affected
|
|
164
|
+
2. **Blast Radius** — downstream consequences and hidden couplings
|
|
165
|
+
3. **Regression Predict** — most likely regression categories
|
|
166
|
+
4. **Test Gap** — coverage gaps to fill before implementing
|
|
167
|
+
5. **Volatility** — check hotspot scores on affected files
|
|
168
|
+
6. **Review Route** — who should review this change
|
|
169
|
+
|
|
170
|
+
## Consolidated Analysis Report
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
════════════════════════════════════════════════════
|
|
174
|
+
PRE-CHANGE ANALYSIS: "$ARGUMENTS"
|
|
175
|
+
════════════════════════════════════════════════════
|
|
176
|
+
|
|
177
|
+
IMPACT (<N> files affected)
|
|
178
|
+
- <top 5 affected files with reason>
|
|
179
|
+
|
|
180
|
+
BLAST RADIUS (risk: <low|medium|high>)
|
|
181
|
+
- <key downstream risks>
|
|
182
|
+
|
|
183
|
+
REGRESSIONS (top 3 risks)
|
|
184
|
+
🔴 <category> — <reason>
|
|
185
|
+
🟠 <category> — <reason>
|
|
186
|
+
|
|
187
|
+
TEST GAPS (<N> gaps found)
|
|
188
|
+
- CRITICAL: <gap>
|
|
189
|
+
- HIGH: <gap>
|
|
190
|
+
|
|
191
|
+
VOLATILITY
|
|
192
|
+
Hot zones touched: <list or "none">
|
|
193
|
+
|
|
194
|
+
REVIEW ROUTING
|
|
195
|
+
→ <reviewer type> (<reason>)
|
|
196
|
+
|
|
197
|
+
────────────────────────────────────────────────────
|
|
198
|
+
RECOMMENDATION: <proceed | add tests first | redesign | review required>
|
|
199
|
+
|
|
200
|
+
Next steps:
|
|
201
|
+
1. <most important action>
|
|
202
|
+
2. <second action>
|
|
203
|
+
════════════════════════════════════════════════════
|
|
55
204
|
```
|
|
56
205
|
|
|
57
|
-
|
|
58
|
-
|
|
206
|
+
## Severity Classification
|
|
207
|
+
|
|
208
|
+
| Severity | Meaning | Action |
|
|
209
|
+
|----------|---------|--------|
|
|
210
|
+
| CRITICAL | Security vulnerability or data loss risk | **BLOCK** - Must fix before merge |
|
|
211
|
+
| HIGH | Bug or significant quality issue | **WARN** - Should fix before merge |
|
|
212
|
+
| MEDIUM | Maintainability concern | **INFO** - Consider fixing |
|
|
213
|
+
| LOW | Style or minor suggestion | **NOTE** - Optional |
|
|
@@ -15,9 +15,34 @@ Run a structured requirements discussion session and capture decisions.
|
|
|
15
15
|
2. Read current phase from STATE.md.
|
|
16
16
|
3. Create `.planning/phases/phase-<N>/` directory if it does not exist.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Process
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### Step 1: Load Context
|
|
21
|
+
|
|
22
|
+
Read `.planning/PROJECT.md` to understand the project vision and goals.
|
|
23
|
+
Read `.planning/STATE.md` to determine the current phase and context.
|
|
24
|
+
|
|
25
|
+
### Step 2: Determine Phase
|
|
26
|
+
|
|
27
|
+
Extract the current phase number from STATE.md.
|
|
28
|
+
Decisions will be saved to `.planning/phases/phase-{N}/DISCUSS.md`.
|
|
29
|
+
|
|
30
|
+
### Step 3: Invoke Discusser
|
|
31
|
+
|
|
32
|
+
Spawn @discusser agent with:
|
|
33
|
+
- Project context (from PROJECT.md)
|
|
34
|
+
- Current phase number
|
|
35
|
+
- Instructions to ask ONE question per turn
|
|
36
|
+
|
|
37
|
+
### Step 4: Q&A Loop
|
|
38
|
+
|
|
39
|
+
The @discusser agent asks one question at a time.
|
|
40
|
+
After each user response:
|
|
41
|
+
- Assign D-XX number to any new decision
|
|
42
|
+
- Record: topic, choice, rationale
|
|
43
|
+
- If response conflicts with previous decision, flag the conflict
|
|
44
|
+
|
|
45
|
+
Continue until all required topics are covered or user says to stop early.
|
|
21
46
|
|
|
22
47
|
Structure the discussion:
|
|
23
48
|
|
|
@@ -30,8 +55,6 @@ Ask questions one at a time. Wait for answers before proceeding.
|
|
|
30
55
|
|
|
31
56
|
## Decision Recording
|
|
32
57
|
|
|
33
|
-
As the user answers, extract decisions and number them `D-01`, `D-02`, etc.
|
|
34
|
-
|
|
35
58
|
After the discussion, write `.planning/phases/phase-<N>/DISCUSS.md`:
|
|
36
59
|
|
|
37
60
|
```markdown
|
|
@@ -43,8 +66,8 @@ After the discussion, write `.planning/phases/phase-<N>/DISCUSS.md`:
|
|
|
43
66
|
|
|
44
67
|
## Decisions
|
|
45
68
|
|
|
46
|
-
D-01:
|
|
47
|
-
D-02:
|
|
69
|
+
D-01: [Topic] — [Decision] ([Rationale])
|
|
70
|
+
D-02: [Topic] — [Decision] ([Rationale])
|
|
48
71
|
...
|
|
49
72
|
|
|
50
73
|
## Open Questions
|
|
@@ -56,6 +79,21 @@ D-02: <decision>
|
|
|
56
79
|
- Run /fd-plan to create implementation plan from these decisions
|
|
57
80
|
```
|
|
58
81
|
|
|
82
|
+
## D-05 Compliance
|
|
83
|
+
|
|
84
|
+
- Loads PROJECT.md + current phase STATE.md
|
|
85
|
+
- Invokes @discusser agent
|
|
86
|
+
- Saves decisions with D-XX numbering to DISCUSS.md
|
|
87
|
+
- One question at a time (no compound questions)
|
|
88
|
+
|
|
59
89
|
## Completion
|
|
60
90
|
|
|
61
91
|
Report: decisions captured, file path, and suggest running `/fd-plan`.
|
|
92
|
+
|
|
93
|
+
## Error Handling
|
|
94
|
+
|
|
95
|
+
D-03: Fail fast with clear error
|
|
96
|
+
- If PROJECT.md not found: error with "Run /new-project first"
|
|
97
|
+
- If STATE.md not found: error with "Project not initialized"
|
|
98
|
+
- If @discusser fails: error with "Discusser agent unavailable"
|
|
99
|
+
- No partial state saved on error
|
|
@@ -9,6 +9,22 @@ Fix a bug using the TDD red-green-refactor discipline.
|
|
|
9
9
|
|
|
10
10
|
**Input:** $ARGUMENTS — description of the bug. Optional `--scope=<path>` to limit search scope.
|
|
11
11
|
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- `.planning/` initialized
|
|
15
|
+
- Bug description or reproduction steps available
|
|
16
|
+
|
|
17
|
+
## TDD Cycle
|
|
18
|
+
|
|
19
|
+
The workflow enforces the TDD cycle with guards at each transition:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
BEHAVIOR → RED → GREEN → REFACTOR → complete
|
|
23
|
+
↑______________| |
|
|
24
|
+
(loop if needed) |
|
|
25
|
+
Only if GREEN
|
|
26
|
+
```
|
|
27
|
+
|
|
12
28
|
## Pre-flight
|
|
13
29
|
|
|
14
30
|
1. Check `.planning/STATE.md` exists — if not, error: "Run /fd-new-project first."
|
|
@@ -16,49 +32,44 @@ Fix a bug using the TDD red-green-refactor discipline.
|
|
|
16
32
|
3. Read `.codebase/ARCHITECTURE.md` if available — pass as context.
|
|
17
33
|
4. Check `.codebase/FAILURES.json` for prior failures matching the bug description.
|
|
18
34
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
[1-2] Explore + Research → isolate root cause
|
|
23
|
-
[3] Define behaviors → acceptance cases for the fix
|
|
24
|
-
[4] RED → @tester writes failing regression test
|
|
25
|
-
[5] Confirm → test MUST fail before proceeding
|
|
26
|
-
[6] GREEN → @coder implements minimum fix
|
|
27
|
-
[7] Confirm → test MUST pass before proceeding
|
|
28
|
-
[8] REFACTOR → clean up (only if GREEN)
|
|
29
|
-
[9-10] Verify → full test suite passes
|
|
30
|
-
[11] Review → @reviewer confirms + TDD discipline check
|
|
31
|
-
[12] Record → log fix + regression test in FAILURES.json
|
|
32
|
-
```
|
|
35
|
+
## Process
|
|
33
36
|
|
|
34
37
|
### Steps 1-2: Explore & Research
|
|
35
38
|
|
|
36
39
|
- **@researcher**: Investigate bug scope, trace root cause via ARCHITECTURE.md and source files
|
|
37
40
|
- **@researcher**: Identify all affected components, list prior similar failures from FAILURES.json
|
|
38
41
|
|
|
42
|
+
Reproduce the bug with minimal case; document inputs and expected vs actual.
|
|
43
|
+
|
|
39
44
|
### Step 3: Define Behaviors
|
|
40
45
|
|
|
41
46
|
Write acceptance cases describing the fix (what should happen after the bug is fixed).
|
|
42
47
|
|
|
43
|
-
### Step 4:
|
|
48
|
+
### Step 4: Isolate Root Cause
|
|
49
|
+
|
|
50
|
+
Spawn `@researcher` to investigate:
|
|
51
|
+
- Trace the execution path
|
|
52
|
+
- Read stack trace completely
|
|
53
|
+
- Check recent changes: `git log --oneline -20 -- <file>`
|
|
54
|
+
- Identify root cause (not symptom)
|
|
55
|
+
|
|
56
|
+
### Step 5: RED — Write Failing Test
|
|
44
57
|
|
|
45
58
|
- **@tester**: Write a regression test that reproduces the bug (it MUST fail right now)
|
|
46
59
|
- Show test output proving it fails
|
|
47
60
|
|
|
48
61
|
**GUARD: Do NOT proceed if test does not fail RED.**
|
|
49
62
|
|
|
50
|
-
### Step
|
|
63
|
+
### Step 6: Confirm RED
|
|
51
64
|
|
|
52
65
|
Confirm test fails. If it passes, the bug may already be fixed or the test is wrong.
|
|
53
66
|
|
|
54
|
-
### Step
|
|
67
|
+
### Step 7: GREEN — Implement Fix
|
|
55
68
|
|
|
56
69
|
- **@coder**: Implement the minimum code change that makes the regression test pass
|
|
57
70
|
- Do not refactor yet
|
|
58
71
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Run test. It MUST pass. **GUARD: Do NOT proceed if test does not pass GREEN.**
|
|
72
|
+
**GUARD: Do NOT proceed if test does not pass GREEN.**
|
|
62
73
|
|
|
63
74
|
### Step 8: REFACTOR
|
|
64
75
|
|
|
@@ -88,6 +99,22 @@ Append entry to `.codebase/FAILURES.json`:
|
|
|
88
99
|
}
|
|
89
100
|
```
|
|
90
101
|
|
|
102
|
+
## Error Handling
|
|
103
|
+
|
|
104
|
+
- **GUARD VIOLATION**: If coder attempts to skip RED or GREEN phase, block and return to correct phase
|
|
105
|
+
- **Override mechanism**: User can override with `/fd-fix-bug --override` but every override is logged in `override_log`
|
|
106
|
+
- If root cause unclear: spawn `@debug-specialist` for deeper analysis
|
|
107
|
+
- If fix breaks tests: revert, reassess root cause, never suppress error
|
|
108
|
+
|
|
109
|
+
## Guards Summary
|
|
110
|
+
|
|
111
|
+
| Transition | Guard | If Violated |
|
|
112
|
+
|-----------|-------|-------------|
|
|
113
|
+
| behavior → red | Test written and fails | Block until test fails |
|
|
114
|
+
| red → green | Test exists and fails | Block until test passes |
|
|
115
|
+
| green → refactor | Tests are green | Block until green |
|
|
116
|
+
| refactor → complete | All tests pass | Block until all pass |
|
|
117
|
+
|
|
91
118
|
## Completion
|
|
92
119
|
|
|
93
120
|
Report: root cause, fix applied, regression test location, reviewer sign-off.
|
|
@@ -9,28 +9,76 @@ Analyze the current codebase and generate comprehensive documentation under `.co
|
|
|
9
9
|
|
|
10
10
|
**Input:** $ARGUMENTS (pass `--incremental` to only process changed files)
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Pre-flight
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Check if `.codebase/` directory already exists. If present, warn and require confirmation to overwrite.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- **@researcher**: Scan package files (`package.json`, `go.mod`, `pyproject.toml`, `Cargo.toml`, etc.) to identify tech stack, frameworks, and dependencies
|
|
18
|
-
- **@architect**: Analyze directory structure, module boundaries, key entry points, and architectural patterns
|
|
19
|
-
- **@code-explorer**: Scan source files for naming conventions, code style patterns, import conventions, and anti-patterns
|
|
20
|
-
- **@tester**: Find test files, identify testing frameworks, coverage configuration, and testing patterns
|
|
21
|
-
- **@researcher** (second pass): Scan for TODO/FIXME/HACK comments, large files (>500 lines), duplicated code patterns, and security concerns
|
|
16
|
+
## Process
|
|
22
17
|
|
|
23
|
-
|
|
18
|
+
### Step 1: Check Existing
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
If `.codebase/` directory already exists:
|
|
21
|
+
```
|
|
22
|
+
Warning: .codebase/ already exists. Running /map-codebase will overwrite existing docs.
|
|
23
|
+
Continue? (y/n)
|
|
24
|
+
```
|
|
25
|
+
If user declines, abort. If user confirms, proceed.
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
### Step 2: Initialize Worktrees
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
D-04: Each mapper runs in its own isolated worktree to prevent conflicts.
|
|
30
|
+
Create worktrees:
|
|
31
|
+
- `flowdeck-mapper-stack`
|
|
32
|
+
- `flowdeck-mapper-arch`
|
|
33
|
+
- `flowdeck-mapper-structure`
|
|
34
|
+
- `flowdeck-mapper-conventions`
|
|
35
|
+
- `flowdeck-mapper-testing`
|
|
36
|
+
- `flowdeck-mapper-concerns`
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
### Step 3: Invoke Mappers
|
|
39
|
+
|
|
40
|
+
Spawn 6 @mapper agents in parallel:
|
|
41
|
+
- @mapper → STACK.md (tech stack, dependencies, versions)
|
|
42
|
+
- @mapper → ARCHITECTURE.md (system design, components, data flow)
|
|
43
|
+
- @mapper → STRUCTURE.md (file organization, directory layout)
|
|
44
|
+
- @mapper → CONVENTIONS.md (coding standards, naming, patterns)
|
|
45
|
+
- @mapper → TESTING.md (test strategy, coverage, frameworks)
|
|
46
|
+
- @mapper → CONCERNS.md (known issues, technical debt, risks)
|
|
47
|
+
|
|
48
|
+
Each mapper:
|
|
49
|
+
- Reads source files directly (no guessing)
|
|
50
|
+
- Outputs factual analysis only
|
|
51
|
+
- Writes to assigned .codebase/ doc file
|
|
52
|
+
|
|
53
|
+
### Step 4: Wait for Completion
|
|
54
|
+
|
|
55
|
+
Wait for all 6 mapper agents to complete. If any fails:
|
|
56
|
+
- Log the failure
|
|
57
|
+
- Continue with remaining mappers
|
|
58
|
+
- Report which docs were not generated
|
|
59
|
+
|
|
60
|
+
### Step 5: Cleanup
|
|
61
|
+
|
|
62
|
+
Remove all worktrees regardless of outcome (cleanup happens after all agents complete).
|
|
63
|
+
|
|
64
|
+
### Step 6: Verify
|
|
65
|
+
|
|
66
|
+
Check that all 6 .codebase/ doc files exist and contain non-empty content.
|
|
67
|
+
If any are missing or empty, report which ones need regeneration.
|
|
68
|
+
|
|
69
|
+
If `--incremental`: only update files where the underlying source has changed since the last map (check `.codebase/last_mapped` timestamp).
|
|
70
|
+
|
|
71
|
+
### Step 7: Write Timestamp
|
|
72
|
+
|
|
73
|
+
Write timestamp to `.codebase/last_mapped`.
|
|
74
|
+
|
|
75
|
+
## Output
|
|
76
|
+
|
|
77
|
+
Report summary: files created/updated, key findings per category.
|
|
78
|
+
|
|
79
|
+
## Error Handling
|
|
80
|
+
|
|
81
|
+
D-03: Fail fast with clear error
|
|
82
|
+
- If .codebase/ check fails: show clear error with remediation
|
|
83
|
+
- If worktree creation fails: report which worktree failed
|
|
84
|
+
- Do NOT save partial state on error
|