@dv.nghiem/flowdeck 0.1.0 → 0.1.1

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 (99) hide show
  1. package/dist/index.d.ts.map +1 -1
  2. package/dist/index.js +14 -4197
  3. package/package.json +2 -1
  4. package/src/commands/fd-analyze-change.md +57 -0
  5. package/src/commands/fd-approve.md +64 -0
  6. package/src/commands/fd-ask.md +39 -0
  7. package/src/commands/fd-blast-radius.md +49 -0
  8. package/src/commands/fd-checkpoint.md +46 -0
  9. package/src/commands/fd-dashboard.md +57 -0
  10. package/src/commands/fd-deploy-check.md +58 -0
  11. package/src/commands/fd-discuss.md +61 -0
  12. package/src/commands/fd-doctor.md +37 -0
  13. package/src/commands/fd-evaluate-risk.md +62 -0
  14. package/src/commands/fd-fix-bug.md +93 -0
  15. package/src/commands/fd-guarded-edit.md +69 -0
  16. package/src/commands/fd-impact-radar.md +51 -0
  17. package/src/commands/fd-map-codebase.md +36 -0
  18. package/src/commands/fd-multi-repo.md +63 -0
  19. package/src/commands/fd-new-feature.md +49 -0
  20. package/src/commands/fd-new-project.md +103 -0
  21. package/src/commands/fd-plan.md +80 -0
  22. package/src/commands/fd-progress.md +50 -0
  23. package/src/commands/fd-regression-predict.md +57 -0
  24. package/src/commands/fd-resume.md +46 -0
  25. package/src/commands/fd-review-code.md +62 -0
  26. package/src/commands/fd-review-route.md +54 -0
  27. package/src/commands/fd-roadmap.md +46 -0
  28. package/src/commands/fd-settings.md +57 -0
  29. package/src/commands/fd-test-gap.md +54 -0
  30. package/src/commands/fd-translate-intent.md +56 -0
  31. package/src/commands/fd-volatility-map.md +64 -0
  32. package/src/commands/fd-workspace-status.md +34 -0
  33. package/src/commands/fd-write-docs.md +50 -0
  34. package/dist/commands/analysis/analysis.test.d.ts +0 -2
  35. package/dist/commands/analysis/analysis.test.d.ts.map +0 -1
  36. package/dist/commands/analysis/analyze-change.d.ts +0 -148
  37. package/dist/commands/analysis/analyze-change.d.ts.map +0 -1
  38. package/dist/commands/analysis/evaluate-risk.d.ts +0 -77
  39. package/dist/commands/analysis/evaluate-risk.d.ts.map +0 -1
  40. package/dist/commands/analysis/guarded-edit.d.ts +0 -72
  41. package/dist/commands/analysis/guarded-edit.d.ts.map +0 -1
  42. package/dist/commands/execution/deploy-check.d.ts +0 -91
  43. package/dist/commands/execution/deploy-check.d.ts.map +0 -1
  44. package/dist/commands/execution/fix-bug.d.ts +0 -187
  45. package/dist/commands/execution/fix-bug.d.ts.map +0 -1
  46. package/dist/commands/execution/new-feature.d.ts +0 -171
  47. package/dist/commands/execution/new-feature.d.ts.map +0 -1
  48. package/dist/commands/execution/review-code.d.ts +0 -130
  49. package/dist/commands/execution/review-code.d.ts.map +0 -1
  50. package/dist/commands/execution/write-docs.d.ts +0 -94
  51. package/dist/commands/execution/write-docs.d.ts.map +0 -1
  52. package/dist/commands/governance/approve.d.ts +0 -80
  53. package/dist/commands/governance/approve.d.ts.map +0 -1
  54. package/dist/commands/intelligence/blast-radius.d.ts +0 -67
  55. package/dist/commands/intelligence/blast-radius.d.ts.map +0 -1
  56. package/dist/commands/intelligence/impact-radar.d.ts +0 -71
  57. package/dist/commands/intelligence/impact-radar.d.ts.map +0 -1
  58. package/dist/commands/intelligence/intelligence.test.d.ts +0 -2
  59. package/dist/commands/intelligence/intelligence.test.d.ts.map +0 -1
  60. package/dist/commands/intelligence/regression-predict.d.ts +0 -75
  61. package/dist/commands/intelligence/regression-predict.d.ts.map +0 -1
  62. package/dist/commands/intelligence/review-route.d.ts +0 -65
  63. package/dist/commands/intelligence/review-route.d.ts.map +0 -1
  64. package/dist/commands/intelligence/test-gap.d.ts +0 -73
  65. package/dist/commands/intelligence/test-gap.d.ts.map +0 -1
  66. package/dist/commands/intelligence/translate-intent.d.ts +0 -87
  67. package/dist/commands/intelligence/translate-intent.d.ts.map +0 -1
  68. package/dist/commands/intelligence/volatility-map-cmd.d.ts +0 -68
  69. package/dist/commands/intelligence/volatility-map-cmd.d.ts.map +0 -1
  70. package/dist/commands/planning/ask.d.ts +0 -62
  71. package/dist/commands/planning/ask.d.ts.map +0 -1
  72. package/dist/commands/planning/ask.test.d.ts +0 -2
  73. package/dist/commands/planning/ask.test.d.ts.map +0 -1
  74. package/dist/commands/planning/dashboard.d.ts +0 -30
  75. package/dist/commands/planning/dashboard.d.ts.map +0 -1
  76. package/dist/commands/planning/discuss.d.ts +0 -39
  77. package/dist/commands/planning/discuss.d.ts.map +0 -1
  78. package/dist/commands/planning/plan.d.ts +0 -67
  79. package/dist/commands/planning/plan.d.ts.map +0 -1
  80. package/dist/commands/planning/roadmap.d.ts +0 -105
  81. package/dist/commands/planning/roadmap.d.ts.map +0 -1
  82. package/dist/commands/setup/doctor.d.ts +0 -10
  83. package/dist/commands/setup/doctor.d.ts.map +0 -1
  84. package/dist/commands/setup/map-codebase.d.ts +0 -62
  85. package/dist/commands/setup/map-codebase.d.ts.map +0 -1
  86. package/dist/commands/setup/new-project.d.ts +0 -19
  87. package/dist/commands/setup/new-project.d.ts.map +0 -1
  88. package/dist/commands/setup/settings.d.ts +0 -57
  89. package/dist/commands/setup/settings.d.ts.map +0 -1
  90. package/dist/commands/state/checkpoint.d.ts +0 -27
  91. package/dist/commands/state/checkpoint.d.ts.map +0 -1
  92. package/dist/commands/state/multi-repo.d.ts +0 -63
  93. package/dist/commands/state/multi-repo.d.ts.map +0 -1
  94. package/dist/commands/state/progress.d.ts +0 -57
  95. package/dist/commands/state/progress.d.ts.map +0 -1
  96. package/dist/commands/state/resume.d.ts +0 -11
  97. package/dist/commands/state/resume.d.ts.map +0 -1
  98. package/dist/commands/state/workspace-commands.d.ts +0 -207
  99. package/dist/commands/state/workspace-commands.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dv.nghiem/flowdeck",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "FlowDeck — structured planning and execution workflows for OpenCode",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,6 +17,7 @@
17
17
  "files": [
18
18
  "dist",
19
19
  "bin",
20
+ "src/commands",
20
21
  "src/rules",
21
22
  "src/skills",
22
23
  "src/workflows",
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: Pre-change analysis — runs impact radar, blast radius, regression prediction, test gaps, volatility, and reviewer routing in one report
3
+ argument-hint: [change description]
4
+ ---
5
+
6
+ # Analyze Change
7
+
8
+ Run a comprehensive pre-change analysis combining all intelligence tools into a single report.
9
+
10
+ **Input:** $ARGUMENTS — description of the proposed change
11
+
12
+ ## Steps
13
+
14
+ Run all analyses in parallel:
15
+
16
+ 1. **Impact Radar** — which files/APIs/tests are affected (see `/fd-impact-radar`)
17
+ 2. **Blast Radius** — downstream consequences and hidden couplings (see `/fd-blast-radius`)
18
+ 3. **Regression Predict** — most likely regression categories (see `/fd-regression-predict`)
19
+ 4. **Test Gap** — coverage gaps to fill before implementing (see `/fd-test-gap`)
20
+ 5. **Volatility** — check `.codebase/VOLATILITY.json` for hotspot scores on affected files
21
+ 6. **Review Route** — who should review this change (see `/fd-review-route`)
22
+
23
+ ## Consolidated Report
24
+
25
+ ```
26
+ ════════════════════════════════════════════════════
27
+ PRE-CHANGE ANALYSIS: "$ARGUMENTS"
28
+ ════════════════════════════════════════════════════
29
+
30
+ IMPACT (<N> files affected)
31
+ - <top 5 affected files with reason>
32
+
33
+ BLAST RADIUS (risk: <low|medium|high>)
34
+ - <key downstream risks>
35
+
36
+ REGRESSIONS (top 3 risks)
37
+ 🔴 <category> — <reason>
38
+ 🟠 <category> — <reason>
39
+
40
+ TEST GAPS (<N> gaps found)
41
+ - CRITICAL: <gap>
42
+ - HIGH: <gap>
43
+
44
+ VOLATILITY
45
+ Hot zones touched: <list or "none">
46
+
47
+ REVIEW ROUTING
48
+ → <reviewer type> (<reason>)
49
+
50
+ ────────────────────────────────────────────────────
51
+ RECOMMENDATION: <proceed | add tests first | redesign | review required>
52
+
53
+ Next steps:
54
+ 1. <most important action>
55
+ 2. <second action>
56
+ ════════════════════════════════════════════════════
57
+ ```
@@ -0,0 +1,64 @@
1
+ ---
2
+ description: Manage approval requests — list pending approvals, approve or reject a request by ID
3
+ argument-hint: [list | approve <id> | reject <id> [reason]]
4
+ ---
5
+
6
+ # Approve
7
+
8
+ Manage approval requests for guarded changes.
9
+
10
+ **Input:** $ARGUMENTS
11
+
12
+ ## Behavior
13
+
14
+ ### List Pending (`list` or no arguments)
15
+
16
+ Read `.planning/approvals.json`. Display all pending approval requests:
17
+
18
+ ```
19
+ ════════════════════════════════════════
20
+ PENDING APPROVALS
21
+ ════════════════════════════════════════
22
+ ID | Change | Risk | Requested
23
+ ---------|---------------------------|-------|----------
24
+ APR-001 | Edit auth middleware | HIGH | <time>
25
+ APR-002 | Update DB migration | MED | <time>
26
+ ════════════════════════════════════════
27
+ Use: /fd-approve approve <ID> or /fd-approve reject <ID> [reason]
28
+ ```
29
+
30
+ If no pending approvals: "No pending approvals."
31
+
32
+ ### Approve (`approve <ID>`)
33
+
34
+ 1. Read `.planning/approvals.json`
35
+ 2. Find approval with matching ID
36
+ 3. Update status to `approved`, set `approved_at` timestamp
37
+ 4. Write updated file
38
+ 5. Report: "APR-XXX approved. Change may proceed."
39
+
40
+ ### Reject (`reject <ID> [reason]`)
41
+
42
+ 1. Find approval with matching ID
43
+ 2. Update status to `rejected`, set `rejected_at` and `reason`
44
+ 3. Report: "APR-XXX rejected. Reason: <reason>."
45
+
46
+ ## Approval File Format
47
+
48
+ `.planning/approvals.json`:
49
+ ```json
50
+ {
51
+ "approvals": [
52
+ {
53
+ "id": "APR-001",
54
+ "change": "<description>",
55
+ "risk_score": 0.8,
56
+ "requested_at": "<timestamp>",
57
+ "status": "pending|approved|rejected",
58
+ "approved_at": null,
59
+ "rejected_at": null,
60
+ "reason": null
61
+ }
62
+ ]
63
+ }
64
+ ```
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Ask a specialist agent a focused question — routes to architect, security, performance, or impact analyst
3
+ argument-hint: [question]
4
+ ---
5
+
6
+ # Ask
7
+
8
+ Route a focused question to the most appropriate specialist agent.
9
+
10
+ **Input:** $ARGUMENTS — your question
11
+
12
+ ## Routing
13
+
14
+ Analyze `$ARGUMENTS` to determine the best specialist:
15
+
16
+ | Keywords / Topic | Agent |
17
+ |-----------------|-------|
18
+ | design, architecture, structure, system, component, API | **@architect** |
19
+ | security, auth, vulnerability, token, permission, injection | **@security-auditor** |
20
+ | performance, speed, slow, optimize, latency, cache, memory | **@performance** |
21
+ | impact, change, affect, downstream, dependency, blast | **@researcher** (impact mode) |
22
+ | test, coverage, regression, tdd, gap | **@tester** |
23
+ | bug, error, crash, debug, trace | **@debug-specialist** |
24
+ | general / unclear | **@orchestrator** |
25
+
26
+ ## Process
27
+
28
+ 1. Identify the best specialist from the table above.
29
+ 2. Delegate `$ARGUMENTS` to that specialist with full context:
30
+ - Include `.codebase/ARCHITECTURE.md` if available and relevant
31
+ - Include `.planning/STATE.md` phase context if relevant
32
+ 3. Return the specialist's answer directly.
33
+
34
+ ## Output
35
+
36
+ Present the answer clearly with:
37
+ - Which specialist answered
38
+ - The answer (no padding, no ceremony)
39
+ - Any follow-up suggestions if the question opens further threads
@@ -0,0 +1,49 @@
1
+ ---
2
+ description: Blast Radius Preview — show downstream consequences of a proposed change including hidden dependencies and fragile integration points
3
+ argument-hint: [change description] [--depth=N]
4
+ ---
5
+
6
+ # Blast Radius
7
+
8
+ Map the full downstream blast radius of a proposed change.
9
+
10
+ **Input:** $ARGUMENTS — description or file path of the proposed change. Optional `--depth=N` (default: 3).
11
+
12
+ ## Steps
13
+
14
+ Run two agents in parallel:
15
+
16
+ - **@architect**: Trace dependency graph to depth `--depth` (default 3 levels); flag integration points, event listeners, shared state, and service-to-service calls that would be affected
17
+
18
+ - **@researcher**: Identify hidden couplings — shared config values, environment variables, database tables, message queue topics, and implicit conventions that the changed code relies on
19
+
20
+ ## Report
21
+
22
+ ```
23
+ ════════════════════════════════════════════
24
+ BLAST RADIUS PREVIEW
25
+ ════════════════════════════════════════════
26
+ Change: <summary>
27
+ Depth: <N> levels
28
+
29
+ Direct Impact (depth 1):
30
+ - <file/module> — <relationship>
31
+
32
+ Indirect Impact (depth 2-3):
33
+ - <file/module> — <chain>
34
+
35
+ Hidden Couplings:
36
+ - <coupling type>: <description>
37
+
38
+ Fragile Integration Points:
39
+ - <point> — <why fragile>
40
+
41
+ Risk Assessment:
42
+ Score: <0-10>
43
+ Level: <low|medium|high|critical>
44
+
45
+ <1-2 sentence summary of the biggest risks>
46
+
47
+ Recommended: <proceed | add tests | get review | redesign>
48
+ ════════════════════════════════════════════
49
+ ```
@@ -0,0 +1,46 @@
1
+ ---
2
+ description: Force-save current state to STATE.md — safe to close session
3
+ ---
4
+
5
+ # Checkpoint
6
+
7
+ Save the current session state so work can be safely resumed later.
8
+
9
+ ## Steps
10
+
11
+ 1. Check `.planning/STATE.md` exists — if not, error: "No active project to checkpoint."
12
+
13
+ 2. Read current STATE.md content.
14
+
15
+ 3. Update STATE.md:
16
+ - Set `last_updated` to current timestamp
17
+ - Ensure `status` reflects current state accurately
18
+
19
+ 4. If `.planning/phases/phase-<N>/PLAN.md` exists, scan for completed steps and update STATE.md's `steps_complete` if tracked.
20
+
21
+ 5. Write a brief checkpoint summary to `.planning/phases/phase-<N>/CHECKPOINT.md`:
22
+
23
+ ```markdown
24
+ # Checkpoint
25
+
26
+ **Saved:** <timestamp>
27
+ **Phase:** <N>
28
+ **Status:** <status>
29
+ **Plan confirmed:** <yes/no>
30
+
31
+ ## What was done
32
+
33
+ <brief summary of recent changes in this session>
34
+
35
+ ## What's next
36
+
37
+ <next uncompleted step from PLAN.md, or "No plan active">
38
+ ```
39
+
40
+ 6. Report:
41
+ ```
42
+ ✅ Checkpoint saved
43
+ Phase: <N> | Status: <status>
44
+ File: .planning/phases/phase-<N>/CHECKPOINT.md
45
+ Safe to close session. Resume with /fd-resume.
46
+ ```
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: Open project dashboard in browser — displays phase progress, milestones, and blockers
3
+ argument-hint: [--port=N]
4
+ ---
5
+
6
+ # Dashboard
7
+
8
+ Open the FlowDeck project dashboard.
9
+
10
+ **Input:** $ARGUMENTS — optional `--port=N` (default: 3847)
11
+
12
+ ## Steps
13
+
14
+ 1. Check `.planning/STATE.md` exists — if not, error: "No active project. Run /fd-new-project first."
15
+
16
+ 2. Read project state from:
17
+ - `.planning/STATE.md` — current phase, status, progress
18
+ - `.planning/ROADMAP.md` — all phases and completion status
19
+ - `.planning/phases/phase-*/PLAN.md` — step completion per phase
20
+
21
+ 3. Try to start the dashboard server if not running:
22
+ ```bash
23
+ npx @dv.nghiem/flowdeck-dashboard --port <port> &
24
+ ```
25
+ Or if the package is installed, run:
26
+ ```bash
27
+ flowdeck-dashboard --port <port> &
28
+ ```
29
+
30
+ 4. If server cannot start, display a text-based dashboard instead:
31
+
32
+ ```
33
+ ════════════════════════════════════════════
34
+ FLOWDECK DASHBOARD
35
+ ════════════════════════════════════════════
36
+ Project: <name from PROJECT.md>
37
+ Updated: <last_updated>
38
+
39
+ ROADMAP
40
+ ✅ Phase 1: Setup — completed
41
+ 🔄 Phase 2: Core Feature — in progress (3/7 steps)
42
+ ⏳ Phase 3: Polish — planned
43
+
44
+ CURRENT PHASE (2): Core Feature
45
+ ✅ Step 1: Set up database schema
46
+ ✅ Step 2: Create API endpoints
47
+ ✅ Step 3: Add authentication
48
+ ⬜ Step 4: Write tests
49
+ ⬜ Step 5: Write documentation
50
+
51
+ BLOCKERS
52
+ - (none)
53
+ ════════════════════════════════════════════
54
+ Run /fd-progress for detailed state view.
55
+ ```
56
+
57
+ 5. If server starts: report the URL: "Dashboard running at http://localhost:<port>"
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: Parallel tester + reviewer + researcher CVE check — orchestrator go/no-go deploy decision
3
+ argument-hint: [--env=staging|production]
4
+ ---
5
+
6
+ # Deploy Check
7
+
8
+ Run a comprehensive pre-deploy validation to produce a go/no-go decision.
9
+
10
+ **Input:** $ARGUMENTS — optional `--env=staging|production` (default: staging)
11
+
12
+ ## Parallel Checks
13
+
14
+ Run three checks simultaneously:
15
+
16
+ ### Check 1 — Test Suite (@tester)
17
+ - Run full test suite
18
+ - Check TDD coverage meets threshold (default: 80%)
19
+ - Report: tests passed/failed, coverage %, any flaky tests
20
+
21
+ ### Check 2 — Code Review (@reviewer)
22
+ - Security review: secrets, injection vulnerabilities, auth gaps
23
+ - Quality review: critical bugs, missing error handling
24
+ - TDD discipline: verify new code has tests
25
+ - Report: CRITICAL/HIGH findings only (no nits for deploy check)
26
+
27
+ ### Check 3 — CVE Scan (@researcher)
28
+ - Scan `package.json`, `go.mod`, `Cargo.toml`, `requirements.txt` for known CVEs
29
+ - Check for recently disclosed vulnerabilities in key dependencies
30
+ - Report: any HIGH or CRITICAL CVEs found
31
+
32
+ ## Go/No-Go Decision
33
+
34
+ **@orchestrator** aggregates results:
35
+
36
+ | Condition | Decision |
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) |
42
+
43
+ ## Report
44
+
45
+ ```
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
+
53
+ DECISION: GO / NO-GO / CONDITIONAL
54
+ ════════════════════════════════════════════
55
+ ```
56
+
57
+ For NO-GO: list blocking issues with fix suggestions.
58
+ For CONDITIONAL: list what requires override approval.
@@ -0,0 +1,61 @@
1
+ ---
2
+ description: Extract requirements via structured Q&A — saves decisions to .planning/phases/phase-N/DISCUSS.md with D-XX numbering
3
+ argument-hint: [topic]
4
+ ---
5
+
6
+ # Discuss
7
+
8
+ Run a structured requirements discussion session and capture decisions.
9
+
10
+ **Input:** $ARGUMENTS (optional topic to focus the discussion)
11
+
12
+ ## Pre-flight
13
+
14
+ 1. Check `.planning/STATE.md` exists — if not, return error: "Run /fd-new-project first."
15
+ 2. Read current phase from STATE.md.
16
+ 3. Create `.planning/phases/phase-<N>/` directory if it does not exist.
17
+
18
+ ## Discussion Process
19
+
20
+ Act as `@discusser` — a requirements analyst. Ask the user focused questions about the topic: **$ARGUMENTS**
21
+
22
+ Structure the discussion:
23
+
24
+ 1. **Scope** — What exactly needs to be built/changed? What is out of scope?
25
+ 2. **Constraints** — Technical constraints, deadlines, dependencies?
26
+ 3. **Acceptance criteria** — How will we know it's done?
27
+ 4. **Risks** — What could go wrong? Any known issues?
28
+
29
+ Ask questions one at a time. Wait for answers before proceeding.
30
+
31
+ ## Decision Recording
32
+
33
+ As the user answers, extract decisions and number them `D-01`, `D-02`, etc.
34
+
35
+ After the discussion, write `.planning/phases/phase-<N>/DISCUSS.md`:
36
+
37
+ ```markdown
38
+ # Discussion: <topic>
39
+
40
+ **Phase:** <N>
41
+ **Date:** <timestamp>
42
+ **Topic:** <topic>
43
+
44
+ ## Decisions
45
+
46
+ D-01: <decision>
47
+ D-02: <decision>
48
+ ...
49
+
50
+ ## Open Questions
51
+
52
+ - <any unresolved items>
53
+
54
+ ## Next Steps
55
+
56
+ - Run /fd-plan to create implementation plan from these decisions
57
+ ```
58
+
59
+ ## Completion
60
+
61
+ Report: decisions captured, file path, and suggest running `/fd-plan`.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Check FlowDeck installation and environment health
3
+ ---
4
+
5
+ # Doctor
6
+
7
+ Run environment health checks and report status.
8
+
9
+ ## Checks
10
+
11
+ 1. **OpenCode CLI** — run `opencode --version`. Report version if found, warn if not found.
12
+
13
+ 2. **FlowDeck plugin registration** — read `~/.config/opencode/opencode.json` (or `$OPENCODE_CONFIG_DIR/opencode.json`). Check that `@dv.nghiem/flowdeck` is in the `plugin` array.
14
+
15
+ 3. **Workspace state** — check if `.planning/STATE.md` exists in the current directory. Warn (non-fatal) if missing.
16
+
17
+ 4. **Codebase map** — check if `.codebase/ARCHITECTURE.md` exists. Note if missing (suggest `/fd-map-codebase`).
18
+
19
+ 5. **Planning phases** — if STATE.md exists, parse the current phase and check that `.planning/phases/phase-N/` directory exists.
20
+
21
+ ## Output Format
22
+
23
+ ```
24
+ # FlowDeck Doctor Report
25
+
26
+ - [x] OpenCode detected: <version>
27
+ - [x] FlowDeck registered in ~/.config/opencode/opencode.json
28
+ - [x] .planning/STATE.md exists in current workspace
29
+ - [!] No .codebase/ARCHITECTURE.md found (run /fd-map-codebase)
30
+ - [x] Phase directory .planning/phases/phase-1/ exists
31
+
32
+ ✅ Environment looks healthy!
33
+ ```
34
+
35
+ Use `[x]` for pass, `[ ]` for failure (blocks healthy), `[!]` for warning (non-blocking).
36
+
37
+ Report `✅ Environment looks healthy!` if no failures, otherwise `❌ Some issues found.`
@@ -0,0 +1,62 @@
1
+ ---
2
+ description: Risk assessment — estimates change risk, confidence, likely regressions, and whether approval is needed before proceeding
3
+ argument-hint: [change description]
4
+ ---
5
+
6
+ # Evaluate Risk
7
+
8
+ Produce a risk assessment for a proposed change.
9
+
10
+ **Input:** $ARGUMENTS — description of the proposed change
11
+
12
+ ## Steps
13
+
14
+ Run two agents in parallel:
15
+
16
+ - **@researcher**: Map `$ARGUMENTS` to affected paths and modules; check `.codebase/VOLATILITY.json` for hotspot scores; check `.codebase/FAILURES.json` for prior failures; identify external dependencies touched
17
+
18
+ - **@reviewer**: Validate the risk assessment — verify risk level is calibrated correctly given the scope; flag any under-estimated risks; check if approval is warranted by active policies in `.planning/config.json`
19
+
20
+ ## Risk Dimensions
21
+
22
+ | Dimension | Weight | Assessment |
23
+ |-----------|--------|------------|
24
+ | Volatility | 30% | hotspot score of affected files |
25
+ | Blast radius | 25% | number of downstream dependents |
26
+ | Prior failures | 25% | recurrences in FAILURES.json |
27
+ | External deps | 20% | third-party APIs or services involved |
28
+
29
+ ## Approval Logic
30
+
31
+ Approval required if:
32
+ - `approval_required: true` in config
33
+ - Overall risk score ≥ `volatility_threshold` (default 0.7)
34
+ - Any touched file has 3+ prior failures
35
+
36
+ ## Report
37
+
38
+ ```
39
+ ════════════════════════════════════════════
40
+ RISK ASSESSMENT
41
+ ════════════════════════════════════════════
42
+ Change: <summary>
43
+
44
+ Risk Score: <0.0–1.0> (<low|medium|high|critical>)
45
+ Confidence: <high|medium|low>
46
+
47
+ Breakdown:
48
+ Volatility: <score> (<rationale>)
49
+ Blast radius: <score> (<N downstream>)
50
+ Prior failures: <score> (<N failures>)
51
+ External deps: <score> (<list or none>)
52
+
53
+ Likely Regressions:
54
+ - <category>: <reason>
55
+
56
+ Approval Required: <yes|no>
57
+ <if yes: reason and who should approve>
58
+
59
+ Recommendation:
60
+ <proceed | add tests | get review | redesign>
61
+ ════════════════════════════════════════════
62
+ ```
@@ -0,0 +1,93 @@
1
+ ---
2
+ description: TDD bug fix — explore → research → RED test → GREEN fix → REFACTOR → reviewer → record in FAILURES.json
3
+ argument-hint: [bug description] [--scope=path]
4
+ ---
5
+
6
+ # Fix Bug
7
+
8
+ Fix a bug using the TDD red-green-refactor discipline.
9
+
10
+ **Input:** $ARGUMENTS — description of the bug. Optional `--scope=<path>` to limit search scope.
11
+
12
+ ## Pre-flight
13
+
14
+ 1. Check `.planning/STATE.md` exists — if not, error: "Run /fd-new-project first."
15
+ 2. Parse `--scope` from arguments (default: entire codebase).
16
+ 3. Read `.codebase/ARCHITECTURE.md` if available — pass as context.
17
+ 4. Check `.codebase/FAILURES.json` for prior failures matching the bug description.
18
+
19
+ ## TDD Fix Pipeline (12 steps)
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
+ ```
33
+
34
+ ### Steps 1-2: Explore & Research
35
+
36
+ - **@researcher**: Investigate bug scope, trace root cause via ARCHITECTURE.md and source files
37
+ - **@researcher**: Identify all affected components, list prior similar failures from FAILURES.json
38
+
39
+ ### Step 3: Define Behaviors
40
+
41
+ Write acceptance cases describing the fix (what should happen after the bug is fixed).
42
+
43
+ ### Step 4: RED — Write Failing Test
44
+
45
+ - **@tester**: Write a regression test that reproduces the bug (it MUST fail right now)
46
+ - Show test output proving it fails
47
+
48
+ **GUARD: Do NOT proceed if test does not fail RED.**
49
+
50
+ ### Step 5: Confirm RED
51
+
52
+ Confirm test fails. If it passes, the bug may already be fixed or the test is wrong.
53
+
54
+ ### Step 6: GREEN — Implement Fix
55
+
56
+ - **@coder**: Implement the minimum code change that makes the regression test pass
57
+ - Do not refactor yet
58
+
59
+ ### Step 7: Confirm GREEN
60
+
61
+ Run test. It MUST pass. **GUARD: Do NOT proceed if test does not pass GREEN.**
62
+
63
+ ### Step 8: REFACTOR
64
+
65
+ Clean up the implementation. Run tests again to confirm they still pass.
66
+
67
+ ### Steps 9-10: Full Suite
68
+
69
+ Run the full test suite. All tests must pass.
70
+
71
+ ### Step 11: Review
72
+
73
+ - **@reviewer**: Confirm fix is correct, no regressions, TDD discipline followed
74
+
75
+ ### Step 12: Record
76
+
77
+ Append entry to `.codebase/FAILURES.json`:
78
+ ```json
79
+ {
80
+ "id": "F-<N>",
81
+ "type": "bug",
82
+ "description": "<bug description>",
83
+ "affected_paths": ["<files changed>"],
84
+ "root_cause": "<root cause>",
85
+ "fix_applied": "<fix summary>",
86
+ "regression_test": "<test file path>",
87
+ "resolved_at": "<timestamp>"
88
+ }
89
+ ```
90
+
91
+ ## Completion
92
+
93
+ Report: root cause, fix applied, regression test location, reviewer sign-off.