@dv.nghiem/flowdeck 0.3.9 → 0.4.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 +13 -21
- package/dist/agents/code-explorer.d.ts.map +1 -1
- package/dist/agents/mapper.d.ts.map +1 -1
- package/dist/agents/orchestrator.d.ts.map +1 -1
- package/dist/agents/planner.d.ts.map +1 -1
- package/dist/agents/specialist.d.ts.map +1 -1
- package/dist/dashboard/server.mjs +12 -2
- package/dist/hooks/compaction-hook.d.ts +1 -2
- package/dist/hooks/compaction-hook.d.ts.map +1 -1
- package/dist/hooks/file-tracker.d.ts +6 -0
- package/dist/hooks/file-tracker.d.ts.map +1 -1
- package/dist/hooks/notifications.d.ts.map +1 -1
- package/dist/hooks/session-start.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +742 -794
- package/dist/lib/completion-validator.d.ts +51 -0
- package/dist/lib/completion-validator.d.ts.map +1 -0
- package/dist/lib/recommended-question.d.ts +24 -0
- package/dist/lib/recommended-question.d.ts.map +1 -0
- package/dist/lib/research-gate.d.ts +97 -0
- package/dist/lib/research-gate.d.ts.map +1 -0
- package/dist/lib/research-gate.test.d.ts +2 -0
- package/dist/lib/research-gate.test.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +12 -2
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/services/codegraph.d.ts +36 -0
- package/dist/services/codegraph.d.ts.map +1 -0
- package/dist/services/codegraph.test.d.ts +2 -0
- package/dist/services/codegraph.test.d.ts.map +1 -0
- package/dist/services/question-guard.d.ts +4 -0
- package/dist/services/question-guard.d.ts.map +1 -1
- package/dist/services/recommended-question.test.d.ts +2 -0
- package/dist/services/recommended-question.test.d.ts.map +1 -0
- package/dist/services/supervisor-binding.d.ts +3 -1
- package/dist/services/supervisor-binding.d.ts.map +1 -1
- package/dist/tools/codebase-index.d.ts +30 -0
- package/dist/tools/codebase-index.d.ts.map +1 -0
- package/dist/tools/codebase-index.test.d.ts +2 -0
- package/dist/tools/codebase-index.test.d.ts.map +1 -0
- package/dist/tools/codegraph-tool.d.ts +3 -0
- package/dist/tools/codegraph-tool.d.ts.map +1 -0
- package/dist/tools/planning-state-lib.d.ts +23 -0
- package/dist/tools/planning-state-lib.d.ts.map +1 -1
- package/docs/agents/index.md +154 -0
- package/docs/commands/fd-ask.md +71 -39
- package/docs/commands/fd-checkpoint.md +63 -8
- package/docs/commands/fd-deploy-check.md +166 -9
- package/docs/commands/fd-design.md +101 -0
- package/docs/commands/fd-discuss.md +87 -20
- package/docs/commands/fd-doctor.md +100 -13
- package/docs/commands/fd-done.md +215 -0
- package/docs/commands/fd-execute.md +104 -0
- package/docs/commands/fd-fix-bug.md +144 -24
- package/docs/commands/fd-map-codebase.md +85 -21
- package/docs/commands/fd-multi-repo.md +155 -40
- package/docs/commands/fd-new-feature.md +63 -19
- package/docs/commands/fd-plan.md +80 -27
- package/docs/commands/fd-quick.md +143 -29
- package/docs/commands/fd-reflect.md +81 -13
- package/docs/commands/fd-resume.md +65 -8
- package/docs/commands/fd-status.md +80 -12
- package/docs/commands/fd-suggest.md +114 -0
- package/docs/commands/fd-translate-intent.md +69 -9
- package/docs/commands/fd-verify.md +71 -14
- package/docs/commands/fd-write-docs.md +121 -8
- package/docs/concepts/architecture.md +163 -0
- package/docs/concepts/governance.md +242 -0
- package/docs/concepts/intelligence.md +145 -0
- package/docs/concepts/multi-repo.md +227 -0
- package/docs/concepts/workflows.md +205 -0
- package/docs/configuration/index.md +208 -0
- package/docs/configuration/opencode-settings.md +98 -0
- package/docs/getting-started/first-project.md +126 -0
- package/docs/getting-started/installation.md +73 -0
- package/docs/getting-started/quick-start.md +74 -0
- package/docs/index.md +36 -72
- package/docs/reference/hooks.md +176 -0
- package/docs/reference/rules.md +109 -0
- package/docs/skills/code-review.md +47 -0
- package/docs/skills/index.md +148 -0
- package/docs/skills/planning.md +39 -0
- package/package.json +1 -1
- package/src/commands/fd-discuss.md +74 -10
- package/src/commands/fd-done.md +196 -0
- package/src/commands/fd-execute.md +43 -6
- package/src/commands/fd-fix-bug.md +43 -6
- package/src/commands/fd-map-codebase.md +99 -19
- package/src/commands/fd-new-feature.md +14 -5
- package/src/commands/fd-plan.md +38 -1
- package/src/commands/fd-quick.md +1 -1
- package/src/commands/fd-resume.md +1 -1
- package/src/commands/fd-status.md +1 -1
- package/src/commands/fd-verify.md +16 -2
- package/src/commands/fd-write-docs.md +30 -5
- package/src/skills/context-load/SKILL.md +1 -1
- package/dist/hooks/memory-hook.d.ts +0 -28
- package/dist/hooks/memory-hook.d.ts.map +0 -1
- package/dist/services/memory-store.d.ts +0 -73
- package/dist/services/memory-store.d.ts.map +0 -1
- package/dist/services/memory-store.test.d.ts +0 -2
- package/dist/services/memory-store.test.d.ts.map +0 -1
- package/dist/tools/memory-search.d.ts +0 -3
- package/dist/tools/memory-search.d.ts.map +0 -1
- package/dist/tools/memory-status.d.ts +0 -3
- package/dist/tools/memory-status.d.ts.map +0 -1
- package/docs/USER_GUIDE.md +0 -20
- package/docs/agents.md +0 -544
- package/docs/best-practices.md +0 -47
- package/docs/commands/fd-new-project.md +0 -24
- package/docs/commands.md +0 -557
- package/docs/configuration.md +0 -325
- package/docs/design-first-workflow.md +0 -94
- package/docs/feature-integration-architecture.md +0 -227
- package/docs/installation.md +0 -123
- package/docs/intelligence.md +0 -370
- package/docs/memory.md +0 -69
- package/docs/multi-repo.md +0 -201
- package/docs/notifications.md +0 -170
- package/docs/optimization-baseline.md +0 -21
- package/docs/quick-start.md +0 -197
- package/docs/rules.md +0 -432
- package/docs/skills.md +0 -417
- package/docs/workflows.md +0 -134
- package/src/commands/fd-new-project.md +0 -114
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Mark the current feature as complete — validates readiness, finalizes state, refreshes codebase mapping
|
|
3
|
+
argument-hint: [--skip-verify] [--phase=N]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Done
|
|
7
|
+
|
|
8
|
+
Close the current feature or phase: validate completion readiness, mark it done, update all shared state, and refresh the codebase mapping so later commands start from a current understanding of the code.
|
|
9
|
+
|
|
10
|
+
**Input:** $ARGUMENTS — optional `--skip-verify` to allow closing without a prior `/fd-verify` run; optional `--phase=N` to target a specific phase
|
|
11
|
+
|
|
12
|
+
## Step 0: Pre-flight
|
|
13
|
+
|
|
14
|
+
1. Check `.planning/STATE.md` exists. If not: error `"No active feature. Run \`/fd-map-codebase\` then \`/fd-new-feature\` to start a feature."`
|
|
15
|
+
2. Read current STATE.md using `planning_state action=read`.
|
|
16
|
+
3. Record: `phase`, `status`, `plan_confirmed`, `blockers`, `steps_complete`, `requires_design_first`, `design_stage`, `design_approved`.
|
|
17
|
+
|
|
18
|
+
## Step 1: Completion Readiness Validation
|
|
19
|
+
|
|
20
|
+
Before marking done, verify the workflow is in a finishable state.
|
|
21
|
+
|
|
22
|
+
Evaluate all of the following. Collect every failure — do not stop at the first:
|
|
23
|
+
|
|
24
|
+
| Check | Pass condition |
|
|
25
|
+
|-------|---------------|
|
|
26
|
+
| Plan confirmed | `plan_confirmed: true` |
|
|
27
|
+
| Not already done | `status != "complete"` |
|
|
28
|
+
| Work has started | `status != "planned"` OR `steps_complete` is non-empty |
|
|
29
|
+
| No active blockers | `blockers` list is empty or contains only `"none"` |
|
|
30
|
+
| Design gate (if required) | `requires_design_first: false` OR `design_stage: handoff_complete` AND `design_approved: true` OR `design_override: true` |
|
|
31
|
+
|
|
32
|
+
**If any check fails**, stop and report:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
❌ Cannot mark done — completion requirements not met:
|
|
36
|
+
|
|
37
|
+
- [ ] <reason 1>
|
|
38
|
+
- [ ] <reason 2>
|
|
39
|
+
|
|
40
|
+
Fix these issues, then run /fd-done again.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Do NOT update any state when validation fails.
|
|
44
|
+
|
|
45
|
+
**Verify check:**
|
|
46
|
+
|
|
47
|
+
If `status != "verified"` and `--skip-verify` was NOT passed:
|
|
48
|
+
- Warn: `"⚠️ /fd-verify has not been run for this phase. Run /fd-verify first, or pass --skip-verify to close without it."`
|
|
49
|
+
- Do NOT block — this is a warning, not a hard blocker (unless there are other hard blockers above)
|
|
50
|
+
|
|
51
|
+
If `--skip-verify` is passed:
|
|
52
|
+
- Log: `"[fd-done] --skip-verify passed — closing without /fd-verify"`
|
|
53
|
+
|
|
54
|
+
## Step 2: Collect Completion Evidence
|
|
55
|
+
|
|
56
|
+
Gather files changed in this feature:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git diff --name-only HEAD
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Also check:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git diff --name-only HEAD~1..HEAD 2>/dev/null || echo "(no commits yet)"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Record `changedFiles[]` for the summary artifact.
|
|
69
|
+
|
|
70
|
+
## Step 3: Codebase Mapping — Refresh or Reuse
|
|
71
|
+
|
|
72
|
+
Check current codegraph state:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
codegraph action=status
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**If mapping is fresh** (indexed, `freshnessStatus: fresh`, and no changed files since last index):
|
|
79
|
+
- Log: `"[fd-done] Codebase mapping is current — skipping remap"`
|
|
80
|
+
- Record: `mappingRefreshed: false`, `mappingFreshnessStatus: fresh`
|
|
81
|
+
|
|
82
|
+
**If mapping is stale, absent, or changed files exist since last index:**
|
|
83
|
+
- Log: `"[fd-done] Refreshing codebase mapping..."`
|
|
84
|
+
- Run:
|
|
85
|
+
```
|
|
86
|
+
codegraph action=refresh agent=fd-done
|
|
87
|
+
```
|
|
88
|
+
- Record result: `mappingRefreshed: true`, `mappingFreshnessStatus: fresh|stale`
|
|
89
|
+
- If refresh fails: log the error, set `mappingFreshnessStatus: stale`, continue — do not abort completion
|
|
90
|
+
|
|
91
|
+
## Step 4: Mark Feature Complete
|
|
92
|
+
|
|
93
|
+
Update STATE.md:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
planning_state action=update updates={
|
|
97
|
+
status: "complete",
|
|
98
|
+
last_action: "Phase <N> marked done via /fd-done",
|
|
99
|
+
next_action: "Run /fd-status to review project state, or /fd-new-feature to start the next phase"
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Additional fields to upsert directly into STATE.md:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
completed_at: "<ISO timestamp>"
|
|
107
|
+
completed_by: "fd-done"
|
|
108
|
+
verify_skipped: <true|false>
|
|
109
|
+
mapping_refreshed_at_done: "<ISO timestamp if refreshed, else skipped>"
|
|
110
|
+
mapping_freshness_at_done: "<fresh|stale|skipped>"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Step 5: Write Completion Artifact
|
|
114
|
+
|
|
115
|
+
Write `.planning/phases/phase-<N>/DONE.md`:
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
# Phase <N> — Done
|
|
119
|
+
|
|
120
|
+
**Completed:** <ISO timestamp>
|
|
121
|
+
**Completed by:** fd-done
|
|
122
|
+
**Prior status:** <status before this run>
|
|
123
|
+
**Steps complete:** <list>
|
|
124
|
+
|
|
125
|
+
## Verification
|
|
126
|
+
|
|
127
|
+
✅ /fd-verify ran — all checks passed before closing
|
|
128
|
+
— OR —
|
|
129
|
+
⚠️ /fd-verify not run — skipped by user (--skip-verify)
|
|
130
|
+
— OR —
|
|
131
|
+
⚠️ /fd-verify not run — consider running before deploying
|
|
132
|
+
|
|
133
|
+
## Codebase Mapping
|
|
134
|
+
|
|
135
|
+
✅ Codebase mapping refreshed (status: fresh)
|
|
136
|
+
— OR —
|
|
137
|
+
ℹ️ Codebase mapping reused — already fresh (status: fresh)
|
|
138
|
+
— OR —
|
|
139
|
+
⚠️ Codebase mapping refresh failed (status: stale)
|
|
140
|
+
|
|
141
|
+
## Changed Files
|
|
142
|
+
|
|
143
|
+
- <file 1>
|
|
144
|
+
- <file 2>
|
|
145
|
+
...
|
|
146
|
+
|
|
147
|
+
## Next Steps
|
|
148
|
+
|
|
149
|
+
- Run `/fd-status` to see the full project state
|
|
150
|
+
- Run `/fd-new-feature` or increment the phase to start the next feature
|
|
151
|
+
- Run `/fd-deploy-check` if preparing for production deployment
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Step 6: Update ROADMAP.md (if present)
|
|
155
|
+
|
|
156
|
+
If `.planning/ROADMAP.md` exists:
|
|
157
|
+
- Find the entry for Phase N
|
|
158
|
+
- Update its status from whatever it currently is to `completed`
|
|
159
|
+
- Preserve all other phases unchanged
|
|
160
|
+
|
|
161
|
+
Only do this if the ROADMAP.md already tracks phases explicitly.
|
|
162
|
+
|
|
163
|
+
## Step 7: Report Completion
|
|
164
|
+
|
|
165
|
+
Print final summary:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
════════════════════════════════════════════════════════════
|
|
169
|
+
✅ DONE — Phase <N> marked complete
|
|
170
|
+
════════════════════════════════════════════════════════════
|
|
171
|
+
|
|
172
|
+
Completed at: <timestamp>
|
|
173
|
+
Prior status: <status>
|
|
174
|
+
Steps complete: <N>
|
|
175
|
+
Changed files: <N files>
|
|
176
|
+
|
|
177
|
+
Verification: ✅ verified | ⚠️ skipped
|
|
178
|
+
Codebase mapping: ✅ refreshed | ℹ️ reused (already fresh)
|
|
179
|
+
|
|
180
|
+
Artifact: .planning/phases/phase-<N>/DONE.md
|
|
181
|
+
State: .planning/STATE.md ← status: complete
|
|
182
|
+
|
|
183
|
+
────────────────────────────────────────────────────────────
|
|
184
|
+
Next: /fd-status | /fd-new-feature | /fd-deploy-check
|
|
185
|
+
════════════════════════════════════════════════════════════
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Error Handling
|
|
189
|
+
|
|
190
|
+
- STATE.md not found → error with remediation ("No active feature. Run `/fd-map-codebase` then `/fd-new-feature` to start a feature.")
|
|
191
|
+
- Completion validation fails → list all failures, do not update state
|
|
192
|
+
- Mapping refresh fails → log error, continue with `mappingFreshnessStatus: stale`
|
|
193
|
+
- DONE.md write fails → log error, do not fail overall — state is already updated
|
|
194
|
+
- ROADMAP.md update fails → log error, do not fail overall
|
|
195
|
+
|
|
196
|
+
No partial state writes. Either the validation passes and full state is written, or nothing is written.
|
|
@@ -9,14 +9,43 @@ Implement the current phase's plan using the full FlowDeck TDD agent pipeline.
|
|
|
9
9
|
|
|
10
10
|
**Input:** $ARGUMENTS — optional `--phase=N` to target a specific phase, `--override` to bypass guards
|
|
11
11
|
|
|
12
|
-
## Pre-flight
|
|
12
|
+
## Pre-flight: Research Gate
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
2. Check `plan_confirmed: true` in STATE.md — if not, error: "Confirm plan first with /fd-plan."
|
|
16
|
-
3. Read `.planning/phases/phase-<N>/PLAN.md` to get implementation steps.
|
|
17
|
-
4. Read `.codebase/ARCHITECTURE.md` if it exists — pass as context.
|
|
14
|
+
**Before reading PLAN.md or touching any code**, re-verify the execution context.
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
Research scope: `execute`
|
|
17
|
+
|
|
18
|
+
**CodeGraph Intelligence Check (first):**
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
codegraph action=check
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- If codegraph indexed and fresh: use `codegraph_context` and `codegraph_impact` to understand affected file scope before each implementation step
|
|
25
|
+
- Log: "codegraph available — impact analysis will use code intelligence"
|
|
26
|
+
- If codegraph absent or stale after a prior execution run: consider running `/fd-map-codebase --incremental` to rebuild the index before proceeding
|
|
27
|
+
|
|
28
|
+
**Standard pre-flight (always):**
|
|
29
|
+
|
|
30
|
+
1. Read `.planning/STATE.md` — verify plan_confirmed, current phase, freshness
|
|
31
|
+
2. Read `.codebase/CODEBASE_INDEX.md` if available — check for any file changes since plan was written
|
|
32
|
+
3. Read `.codebase/CODEGRAPH.md` if available — check codegraph index freshness
|
|
33
|
+
4. Check for any `research_execute` evidence in STATE.md from prior research passes
|
|
34
|
+
5. If design-first is required, verify design handoff is complete before proceeding
|
|
35
|
+
|
|
36
|
+
If existing research is fresh (summaryVersion matches, state fresh within 5 min):
|
|
37
|
+
- Reuse the persisted research evidence
|
|
38
|
+
- Log: "Research skipped — fresh evidence reused from prior pass"
|
|
39
|
+
- Proceed to Guard Check
|
|
40
|
+
|
|
41
|
+
If research is stale or missing:
|
|
42
|
+
- Run fresh research pass using available MCP and filesystem tools
|
|
43
|
+
- Persist results to STATE.md for future reuse
|
|
44
|
+
- Log which sources were consulted and what evidence was gathered
|
|
45
|
+
|
|
46
|
+
> **MCP integration:** When implementation requires external library knowledge, invoke configured MCP tools as part of the research pass.
|
|
47
|
+
|
|
48
|
+
### Step 1: Guard Check
|
|
20
49
|
|
|
21
50
|
Each plan step follows the TDD cycle:
|
|
22
51
|
|
|
@@ -126,6 +155,14 @@ tdd:
|
|
|
126
155
|
stage: behavior # Ready for next step
|
|
127
156
|
```
|
|
128
157
|
|
|
158
|
+
After each step that changes source files, refresh the codegraph index so impact analysis stays current for subsequent steps:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
codegraph action=refresh agent=fd-execute
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
If refresh fails, log a warning but do not block execution — codegraph auto-syncs via file watcher when the MCP server is running.
|
|
165
|
+
|
|
129
166
|
### Step 13: Loop or Complete
|
|
130
167
|
|
|
131
168
|
If more steps pending:
|
|
@@ -25,14 +25,42 @@ BEHAVIOR → RED → GREEN → REFACTOR → complete
|
|
|
25
25
|
Only if GREEN
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
## Pre-flight
|
|
28
|
+
## Pre-flight: Research Gate
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
2. Parse `--scope` from arguments (default: entire codebase).
|
|
32
|
-
3. Read `.codebase/ARCHITECTURE.md` if available — pass as context.
|
|
33
|
-
4. Check `.codebase/FAILURES.json` for prior failures matching the bug description.
|
|
30
|
+
**Before investigating the bug**, inspect the failure path and relevant codebase area.
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
Research scope: `fix-bug`
|
|
33
|
+
|
|
34
|
+
**CodeGraph Intelligence Check (first):**
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
codegraph action=check
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- If codegraph indexed: use `codegraph_context` to map the bug area, `codegraph_callers`/`codegraph_callees` to trace the execution path, `codegraph_impact` to identify affected files — before opening any file
|
|
41
|
+
- Log: "codegraph available — using code intelligence for bug investigation"
|
|
42
|
+
- If absent: fall back to ARCHITECTURE.md + direct source reads
|
|
43
|
+
|
|
44
|
+
**Standard pre-flight (always):**
|
|
45
|
+
|
|
46
|
+
1. Read `.planning/STATE.md` — current phase, freshness
|
|
47
|
+
2. Read `.codebase/FAILURES.json` — check for prior similar failures matching the bug description
|
|
48
|
+
3. Read `.codebase/ARCHITECTURE.md` if available — codebase structure
|
|
49
|
+
4. Read `.codebase/CODEGRAPH.md` if available — codegraph index freshness
|
|
50
|
+
5. Check for any `research_fix-bug` evidence in STATE.md from prior research passes
|
|
51
|
+
6. Check recent changes via `git log --oneline -10` on relevant files
|
|
52
|
+
|
|
53
|
+
If existing research is fresh (summaryVersion matches, state fresh within 5 min):
|
|
54
|
+
- Reuse the persisted research evidence
|
|
55
|
+
- Log: "Research skipped — fresh evidence reused from prior pass"
|
|
56
|
+
- Proceed to Explore & Research
|
|
57
|
+
|
|
58
|
+
If research is stale or missing:
|
|
59
|
+
- Run fresh research pass using available MCP and filesystem tools
|
|
60
|
+
- Persist results to STATE.md for future reuse
|
|
61
|
+
- Log which sources were consulted and what evidence was gathered
|
|
62
|
+
|
|
63
|
+
> **MCP integration:** When the bug involves external APIs or libraries, invoke configured MCP tools (websearch, docs MCP) to research known failure modes.
|
|
36
64
|
|
|
37
65
|
### Steps 1-2: Explore & Research
|
|
38
66
|
|
|
@@ -99,6 +127,14 @@ Append entry to `.codebase/FAILURES.json`:
|
|
|
99
127
|
}
|
|
100
128
|
```
|
|
101
129
|
|
|
130
|
+
After recording, refresh the codegraph index so later stages and agents work against the updated codebase:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
codegraph action=refresh agent=fd-fix-bug
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
If refresh fails, log a warning but do not block — codegraph auto-syncs via file watcher when the MCP server is running.
|
|
137
|
+
|
|
102
138
|
## Error Handling
|
|
103
139
|
|
|
104
140
|
- **GUARD VIOLATION**: If implementation agent attempts to skip RED or GREEN phase, block and return to correct phase
|
|
@@ -118,3 +154,4 @@ Append entry to `.codebase/FAILURES.json`:
|
|
|
118
154
|
## Completion
|
|
119
155
|
|
|
120
156
|
Report: root cause, fix applied, regression test location, reviewer sign-off.
|
|
157
|
+
Next step: run `/fd-verify`.
|
|
@@ -1,30 +1,82 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Analyze codebase and generate .codebase/ documentation — STACK, ARCHITECTURE, STRUCTURE, CONVENTIONS, TESTING, CONCERNS
|
|
3
|
-
argument-hint: [--incremental]
|
|
2
|
+
description: Analyze codebase and generate .codebase/ documentation — STACK, ARCHITECTURE, STRUCTURE, CONVENTIONS, TESTING, CONCERNS. Uses codegraph as primary code intelligence layer.
|
|
3
|
+
argument-hint: [--incremental] [--force]
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Map Codebase
|
|
7
7
|
|
|
8
8
|
Analyze the current codebase and generate comprehensive documentation under `.codebase/`.
|
|
9
|
+
Uses `codegraph` as the primary code intelligence layer for accurate, symbol-level understanding.
|
|
9
10
|
|
|
10
|
-
**Input:** $ARGUMENTS (pass `--incremental` to only
|
|
11
|
+
**Input:** $ARGUMENTS (pass `--incremental` to only update changed files, `--force` to skip existing-index confirmation)
|
|
11
12
|
|
|
12
13
|
## Pre-flight
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
### Step 0: Check codegraph Installation
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Use the `codegraph` tool to check the current state:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
codegraph action=check
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Log the result:
|
|
24
|
+
- **If installed and indexed**: "codegraph ready — index is [fresh/stale]"
|
|
25
|
+
- **If installed but not indexed**: "codegraph installed, index not built — will initialize"
|
|
26
|
+
- **If not installed**: "codegraph not installed — will auto-install"
|
|
27
|
+
|
|
28
|
+
### Step 1: Auto-Install codegraph if Missing
|
|
29
|
+
|
|
30
|
+
If `codegraph` is not installed:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
codegraph action=install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Log clearly:
|
|
37
|
+
- If install succeeded: "codegraph installed successfully"
|
|
38
|
+
- If already installed (skipped): "codegraph already installed — skipping"
|
|
39
|
+
- If install failed: report the error and remediation steps; abort
|
|
40
|
+
|
|
41
|
+
> **Diagnostics**: Log install output verbatim for troubleshooting.
|
|
42
|
+
|
|
43
|
+
### Step 2: Initialize or Refresh codegraph Index
|
|
44
|
+
|
|
45
|
+
If `.codegraph/` does not exist or `--force` was passed:
|
|
17
46
|
|
|
18
|
-
|
|
47
|
+
```
|
|
48
|
+
codegraph action=init agent=fd-map-codebase
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
If `.codegraph/` exists and `--incremental` was passed:
|
|
52
|
+
- Check if changed since last index
|
|
53
|
+
- If stale: run `codegraph action=refresh agent=fd-map-codebase`
|
|
54
|
+
- If fresh: log "codegraph index is fresh — reusing existing mapping"
|
|
55
|
+
|
|
56
|
+
Log:
|
|
57
|
+
- Whether this was a full build or incremental update
|
|
58
|
+
- Number of changed files detected
|
|
59
|
+
- The git revision fingerprinted
|
|
60
|
+
|
|
61
|
+
If init/refresh fails:
|
|
62
|
+
- Log the error and diagnostic output
|
|
63
|
+
- Fall back to mapper agents only (proceed to Step 3 without codegraph)
|
|
64
|
+
- Note in summary that codegraph was unavailable
|
|
65
|
+
|
|
66
|
+
### Step 3: Check Existing .codebase/ Docs
|
|
67
|
+
|
|
68
|
+
Check if `.codebase/` documentation directory already exists.
|
|
19
69
|
|
|
20
|
-
If
|
|
70
|
+
If present and `--force` is not set:
|
|
21
71
|
```
|
|
22
72
|
Warning: .codebase/ already exists. Running /fd-map-codebase will overwrite existing docs.
|
|
23
73
|
Continue? (y/n)
|
|
24
74
|
```
|
|
25
|
-
If user declines, abort. If user confirms, proceed.
|
|
75
|
+
If user declines, abort. If user confirms or `--force` was passed, proceed.
|
|
26
76
|
|
|
27
|
-
|
|
77
|
+
## Process
|
|
78
|
+
|
|
79
|
+
### Step 4: Initialize Worktrees
|
|
28
80
|
|
|
29
81
|
D-04: Each mapper runs in its own isolated worktree to prevent conflicts.
|
|
30
82
|
Create worktrees:
|
|
@@ -35,9 +87,10 @@ Create worktrees:
|
|
|
35
87
|
- `flowdeck-mapper-testing`
|
|
36
88
|
- `flowdeck-mapper-concerns`
|
|
37
89
|
|
|
38
|
-
### Step
|
|
90
|
+
### Step 5: Invoke Mappers with codegraph Context
|
|
91
|
+
|
|
92
|
+
Spawn 6 @mapper agents in parallel. Each mapper receives the codegraph status:
|
|
39
93
|
|
|
40
|
-
Spawn 6 @mapper agents in parallel:
|
|
41
94
|
- @mapper → STACK.md (tech stack, dependencies, versions)
|
|
42
95
|
- @mapper → ARCHITECTURE.md (system design, components, data flow)
|
|
43
96
|
- @mapper → STRUCTURE.md (file organization, directory layout)
|
|
@@ -45,40 +98,67 @@ Spawn 6 @mapper agents in parallel:
|
|
|
45
98
|
- @mapper → TESTING.md (test strategy, coverage, frameworks)
|
|
46
99
|
- @mapper → CONCERNS.md (known issues, technical debt, risks)
|
|
47
100
|
|
|
101
|
+
**codegraph instructions for mappers:**
|
|
102
|
+
|
|
103
|
+
If `.codegraph/` exists, each mapper **must** use codegraph MCP tools first:
|
|
104
|
+
|
|
105
|
+
| Task | Tool |
|
|
106
|
+
|------|------|
|
|
107
|
+
| Map a module / feature area | `codegraph_context` |
|
|
108
|
+
| Find a symbol by name | `codegraph_search` |
|
|
109
|
+
| Trace call paths | `codegraph_trace` |
|
|
110
|
+
| Check callers/callees | `codegraph_callers` / `codegraph_callees` |
|
|
111
|
+
| Impact of a change | `codegraph_impact` |
|
|
112
|
+
| Read a symbol's source | `codegraph_node` |
|
|
113
|
+
| Survey related symbols | `codegraph_explore` |
|
|
114
|
+
|
|
115
|
+
Fall back to direct file reads only when codegraph doesn't cover a specific detail.
|
|
116
|
+
|
|
48
117
|
Each mapper:
|
|
49
|
-
- Reads
|
|
118
|
+
- Reads from codegraph first, files only when necessary
|
|
50
119
|
- Outputs factual analysis only
|
|
51
120
|
- Writes to assigned .codebase/ doc file
|
|
52
121
|
|
|
53
|
-
### Step
|
|
122
|
+
### Step 6: Wait for Completion
|
|
54
123
|
|
|
55
124
|
Wait for all 6 mapper agents to complete. If any fails:
|
|
56
125
|
- Log the failure
|
|
57
126
|
- Continue with remaining mappers
|
|
58
127
|
- Report which docs were not generated
|
|
59
128
|
|
|
60
|
-
### Step
|
|
129
|
+
### Step 7: Cleanup
|
|
61
130
|
|
|
62
131
|
Remove all worktrees regardless of outcome (cleanup happens after all agents complete).
|
|
63
132
|
|
|
64
|
-
### Step
|
|
133
|
+
### Step 8: Verify
|
|
65
134
|
|
|
66
135
|
Check that all 6 .codebase/ doc files exist and contain non-empty content.
|
|
67
136
|
If any are missing or empty, report which ones need regeneration.
|
|
68
137
|
|
|
69
|
-
If `--incremental`: only update files where the underlying source has changed since the last map (check `.codebase/
|
|
138
|
+
If `--incremental`: only update files where the underlying source has changed since the last map (check `.codebase/CODEGRAPH.md` lastIndexedAt timestamp).
|
|
70
139
|
|
|
71
|
-
### Step
|
|
140
|
+
### Step 9: Write Timestamp and Update State
|
|
72
141
|
|
|
73
|
-
Write timestamp to `.codebase/last_mapped`.
|
|
142
|
+
1. Write timestamp to `.codebase/last_mapped`.
|
|
143
|
+
2. Update the `codegraph` tool state:
|
|
144
|
+
```
|
|
145
|
+
codegraph action=status
|
|
146
|
+
```
|
|
147
|
+
Log whether codegraph MCP tools are available for subsequent commands.
|
|
74
148
|
|
|
75
149
|
## Output
|
|
76
150
|
|
|
77
|
-
Report summary:
|
|
151
|
+
Report summary:
|
|
152
|
+
- codegraph: installed ✅/❌, indexed ✅/❌, full/incremental build
|
|
153
|
+
- files created/updated per mapper agent
|
|
154
|
+
- key findings per category
|
|
155
|
+
- Next: codegraph MCP tools are now available to /fd-discuss, /fd-plan, /fd-execute, /fd-fix-bug
|
|
78
156
|
|
|
79
157
|
## Error Handling
|
|
80
158
|
|
|
81
159
|
D-03: Fail fast with clear error
|
|
160
|
+
- If codegraph install fails: log diagnostics, fall back to mapper-only mode (no codegraph MCP)
|
|
161
|
+
- If codegraph init fails: log diagnostics, fall back to mapper-only mode
|
|
82
162
|
- If .codebase/ check fails: show clear error with remediation
|
|
83
163
|
- If worktree creation fails: report which worktree failed
|
|
84
164
|
- Do NOT save partial state on error
|
|
@@ -11,9 +11,19 @@ Initialize a new feature and guide through the full FlowDeck feature workflow.
|
|
|
11
11
|
|
|
12
12
|
## Pre-flight
|
|
13
13
|
|
|
14
|
-
1. Check `.
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
1. Check `.codebase/` exists — if not, error:
|
|
15
|
+
> "Codebase mapping is required before starting a feature. Run `/fd-map-codebase` first to index the codebase."
|
|
16
|
+
|
|
17
|
+
2. If `.planning/` does not exist, initialize it now:
|
|
18
|
+
- Create `.planning/` directory.
|
|
19
|
+
- Create `.planning/STATE.md` with default initial state (phase 1, status: ready).
|
|
20
|
+
- Create `.planning/config.json` with default settings:
|
|
21
|
+
```json
|
|
22
|
+
{ "model_profile": "balanced", "tdd_enforced": true, "approval_required": false, "default_agent": "orchestrator" }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. Read `.planning/STATE.md` to determine the current phase number N (default: 1 if not set).
|
|
26
|
+
4. Create `.planning/phases/phase-<N>/` directory if it does not exist.
|
|
17
27
|
|
|
18
28
|
## Process
|
|
19
29
|
|
|
@@ -73,7 +83,6 @@ Next steps (in order):
|
|
|
73
83
|
|
|
74
84
|
## Error Handling
|
|
75
85
|
|
|
76
|
-
- If `.
|
|
77
|
-
- If STATE.md not found: error "Project not initialized. Run /fd-new-project first."
|
|
86
|
+
- If `.codebase/` not found: error "Codebase mapping is required first. Run `/fd-map-codebase` to index the codebase."
|
|
78
87
|
- No partial state saved on error.
|
|
79
88
|
|
package/src/commands/fd-plan.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Create detailed implementation plan from DISCUSS.md decisions — save PLAN.md, update STATE.md, require CONFIRM before execution
|
|
2
|
+
description: Create detailed implementation plan from DISCUSS.md decisions — research-first, save PLAN.md, update STATE.md, require CONFIRM before execution
|
|
3
3
|
argument-hint: [--phase=N] [--yes]
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -11,6 +11,43 @@ Create a detailed implementation plan from confirmed DISCUSS.md decisions.
|
|
|
11
11
|
|
|
12
12
|
## Process
|
|
13
13
|
|
|
14
|
+
### Step 0: Research Gate
|
|
15
|
+
|
|
16
|
+
**Before producing any plan**, gather implementation context from the repository.
|
|
17
|
+
|
|
18
|
+
Research scope: `plan`
|
|
19
|
+
|
|
20
|
+
**CodeGraph Intelligence Check (first):**
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
codegraph action=check
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- If codegraph is installed and indexed: use `codegraph_context`, `codegraph_explore`, `codegraph_impact` for architecture and affected-file analysis instead of direct file reads
|
|
27
|
+
- Log: "codegraph available — using code intelligence for research gate"
|
|
28
|
+
- If codegraph is absent or stale: fall back to standard research pass
|
|
29
|
+
|
|
30
|
+
**Standard research pass (always):**
|
|
31
|
+
|
|
32
|
+
1. Read `.planning/STATE.md` — current phase, position, freshness
|
|
33
|
+
2. Read `.planning/phases/phase-<N>/DISCUSS.md` — D-XX decisions to trace
|
|
34
|
+
3. Read `.codebase/ARCHITECTURE.md` if available — codebase structure
|
|
35
|
+
4. Read `.codebase/CODEBASE_INDEX.md` if available — recent changes and volatility signals
|
|
36
|
+
5. Read `.codebase/CODEGRAPH.md` if available — codegraph index freshness metadata
|
|
37
|
+
6. Check for any `research_plan` evidence in STATE.md from prior research passes
|
|
38
|
+
|
|
39
|
+
If existing research is fresh (summaryVersion matches, state fresh within 5 min):
|
|
40
|
+
- Reuse the persisted research evidence
|
|
41
|
+
- Log: "Research skipped — fresh evidence reused from prior pass"
|
|
42
|
+
- Proceed to Step 1
|
|
43
|
+
|
|
44
|
+
If research is stale or missing:
|
|
45
|
+
- Run fresh research pass using available MCP and filesystem tools
|
|
46
|
+
- Persist results to STATE.md for future reuse
|
|
47
|
+
- Log which sources were consulted and what evidence was gathered
|
|
48
|
+
|
|
49
|
+
> **MCP integration:** When library, API, or external knowledge is needed, invoke configured MCP tools (websearch, docs MCP, code search MCP) as part of the research pass.
|
|
50
|
+
|
|
14
51
|
### Step 1: Guard Check
|
|
15
52
|
|
|
16
53
|
D-06: Verify DISCUSS.md exists and is confirmed.
|
package/src/commands/fd-quick.md
CHANGED
|
@@ -66,7 +66,7 @@ If the question can be answered from repo evidence, suppress it and log it in
|
|
|
66
66
|
|
|
67
67
|
## Step 1: Pre-flight State Check
|
|
68
68
|
|
|
69
|
-
1. Check `.planning/STATE.md` exists — if not, error: "Run
|
|
69
|
+
1. Check `.planning/STATE.md` exists — if not, error: "No active feature. Run `/fd-map-codebase` then `/fd-new-feature` to start a feature."
|
|
70
70
|
2. Read `.planning/STATE.md` to determine if a `quick_run` entry already exists for this session.
|
|
71
71
|
- If `quick_run.outcome` is `running` or `blocked`: **resume from the last completed stage** (skip to Step 5).
|
|
72
72
|
- If `quick_run.preflightExploration` exists and `exploredAt` is recent (< 5 min): reuse it, skip Step 0.
|
|
@@ -11,7 +11,7 @@ Resume a previously interrupted FlowDeck session.
|
|
|
11
11
|
|
|
12
12
|
## Steps
|
|
13
13
|
|
|
14
|
-
1. Check `.planning/STATE.md` exists — if not, error: "No active
|
|
14
|
+
1. Check `.planning/STATE.md` exists — if not, error: "No active feature. Run `/fd-map-codebase` then `/fd-new-feature` to start a feature."
|
|
15
15
|
|
|
16
16
|
2. Read STATE.md and parse current state:
|
|
17
17
|
- Phase, status, last_updated, plan_confirmed
|
|
@@ -80,5 +80,5 @@ Steps:
|
|
|
80
80
|
|
|
81
81
|
## Error Handling
|
|
82
82
|
|
|
83
|
-
- If `.planning/STATE.md` not found: "No active
|
|
83
|
+
- If `.planning/STATE.md` not found: "No active feature. Run `/fd-map-codebase` then `/fd-new-feature` to start a feature."
|
|
84
84
|
- If `--phase` requested but phase directory doesn't exist: "Phase N not found."
|
|
@@ -11,7 +11,7 @@ Run the full verification pipeline for the current feature: tests, code review,
|
|
|
11
11
|
|
|
12
12
|
## Pre-flight
|
|
13
13
|
|
|
14
|
-
1. Check `.planning/STATE.md` exists — if not, error: "Run
|
|
14
|
+
1. Check `.planning/STATE.md` exists — if not, error: "No active feature. Run `/fd-map-codebase` then `/fd-new-feature` to start a feature."
|
|
15
15
|
2. Read current phase N from STATE.md.
|
|
16
16
|
3. Confirm `steps_complete` in STATE.md is non-empty — if empty, warn: "No steps completed yet. Run /fd-execute first."
|
|
17
17
|
|
|
@@ -26,6 +26,19 @@ git diff --name-only HEAD
|
|
|
26
26
|
|
|
27
27
|
If no changed files, use all files in the current phase directory as scope.
|
|
28
28
|
|
|
29
|
+
**CodeGraph Impact Check (when available):**
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
codegraph action=check
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If codegraph is installed and indexed:
|
|
36
|
+
- Use `codegraph_impact` on each changed file to surface any dependent modules not caught by `git diff`
|
|
37
|
+
- Log: "codegraph impact analysis: [N] dependent symbols detected"
|
|
38
|
+
- Expand review scope to include impacted modules flagged by codegraph
|
|
39
|
+
|
|
40
|
+
This ensures verification covers caller/callee relationships, not just directly-changed files.
|
|
41
|
+
|
|
29
42
|
### Step 2: Run Checks in Parallel
|
|
30
43
|
|
|
31
44
|
Launch all four checks simultaneously:
|
|
@@ -122,7 +135,7 @@ verified_at: "<timestamp>"
|
|
|
122
135
|
|
|
123
136
|
## Error Handling
|
|
124
137
|
|
|
125
|
-
- If `.planning/` not found: error "Run
|
|
138
|
+
- If `.planning/` not found: error "No active feature. Run `/fd-map-codebase` then `/fd-new-feature` to start a feature."
|
|
126
139
|
- If STATE.md not found: error "Project not initialized."
|
|
127
140
|
- If test runner not found: error with remediation (e.g., "No test script in package.json")
|
|
128
141
|
- No partial state update on error.
|
|
@@ -130,3 +143,4 @@ verified_at: "<timestamp>"
|
|
|
130
143
|
## Completion
|
|
131
144
|
|
|
132
145
|
Report: verification result, check statuses, any required fixes, and suggested next step.
|
|
146
|
+
Next step: run `/fd-done` or `/fd-fix-bug`.
|