@dv.nghiem/flowdeck 0.2.3 → 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 (34) 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.js +197 -147
  4. package/dist/services/telemetry.d.ts +1 -1
  5. package/dist/services/telemetry.d.ts.map +1 -1
  6. package/dist/tools/run-parallel.d.ts.map +1 -1
  7. package/docs/configuration.md +2 -0
  8. package/docs/parallel-execution.md +28 -0
  9. package/docs/workflows.md +72 -320
  10. package/package.json +1 -2
  11. package/src/commands/fd-deploy-check.md +67 -32
  12. package/src/commands/fd-discuss.md +44 -6
  13. package/src/commands/fd-fix-bug.md +47 -20
  14. package/src/commands/fd-map-codebase.md +66 -18
  15. package/src/commands/fd-multi-repo.md +130 -6
  16. package/src/commands/fd-new-feature.md +164 -21
  17. package/src/commands/fd-plan.md +66 -44
  18. package/src/commands/fd-review-code.md +69 -35
  19. package/src/commands/fd-write-docs.md +55 -23
  20. package/src/workflows/debug-flow.md +0 -119
  21. package/src/workflows/deploy-check-flow.md +0 -98
  22. package/src/workflows/discuss-flow.md +0 -97
  23. package/src/workflows/execute-flow.md +0 -233
  24. package/src/workflows/execute-phase.md +0 -145
  25. package/src/workflows/fix-bug-flow.md +0 -210
  26. package/src/workflows/map-codebase-flow.md +0 -92
  27. package/src/workflows/multi-repo-flow.md +0 -226
  28. package/src/workflows/parallel-execution-flow.md +0 -236
  29. package/src/workflows/plan-flow.md +0 -126
  30. package/src/workflows/plan-phase.md +0 -101
  31. package/src/workflows/refactor-flow.md +0 -122
  32. package/src/workflows/review-code-flow.md +0 -105
  33. package/src/workflows/spec-driven-flow.md +0 -43
  34. package/src/workflows/write-docs-flow.md +0 -95
@@ -18,7 +18,7 @@ export interface TelemetryEvent {
18
18
  meta?: Record<string, unknown>;
19
19
  }
20
20
  export declare function telemetryPath(dir: string): string;
21
- export declare function appendEvent(dir: string, partial: Omit<TelemetryEvent, "id" | "ts">): TelemetryEvent;
21
+ export declare function appendEvent(dir: string, partial: Omit<TelemetryEvent, "id" | "ts">): TelemetryEvent | null;
22
22
  export declare function readEvents(dir: string, limit?: number): TelemetryEvent[];
23
23
  export declare function getRunEvents(dir: string, run_id: string): TelemetryEvent[];
24
24
  export interface CommandSummary {
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/services/telemetry.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,kBAAkB,GAC1B,eAAe,GACf,aAAa,GACb,WAAW,GACX,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,UAAU,GACV,kBAAkB,GAClB,cAAc,CAAA;AAElB,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,kBAAkB,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAA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ceRoot":"","sources":["../../src/tools/run-parallel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAkBtD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CA8G5E"}
1
+ {"version":3,"file":"run-parallel.d.ts","sourceRoot":"","sources":["../../src/tools/run-parallel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAsBtD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAiK5E"}
@@ -268,6 +268,8 @@ These are enabled by default. If you have API keys (e.g., `CONTEXT7_API_KEY`, `E
268
268
  | `XDG_CONFIG_HOME` | `~/.config` | Standard XDG base directory; used to resolve `OPENCODE_CONFIG_DIR` when not explicitly set |
269
269
  | `FLOWDECK_CONTEXT_LIMIT` | `200000` | Token limit used by the Context Window Monitor to warn when context usage exceeds 70% |
270
270
  | `FLOWDECK_DISABLE_MCP` | (empty) | Comma-separated list of remote MCPs to disable. Valid options: `context7`, `websearch`, `grep_app` |
271
+ | `FLOWDECK_ORCHESTRATOR_GUARD` | `off` | Enable the orchestrator guard hook. When `on`, the orchestrator session cannot use write/bash tools directly and must delegate all implementation work. |
272
+ | `TELEMETRY_ENABLED` | `false` | Enable telemetry events from `run-parallel` and hooks. When `true`, events are written to `.codebase/TELEMETRY.jsonl`. |
271
273
 
272
274
  ---
273
275
 
@@ -224,4 +224,32 @@ All three dispatch tools (`run-parallel`, `delegate`, `run-pipeline`) create rea
224
224
 
225
225
  ---
226
226
 
227
+ ## Telemetry & Monitoring
228
+
229
+ The `run-parallel` tool emits structured telemetry events for observability:
230
+
231
+ | Event | When |
232
+ |-------|------|
233
+ | `agent.dispatch` | Child session created for a task |
234
+ | `agent.complete` | Task finished (success or error) |
235
+
236
+ Events are appended to `.codebase/TELEMETRY.jsonl` and include:
237
+ - `session_id` / `run_id` — session tracking
238
+ - `agent` — which agent ran
239
+ - `duration_ms` — wall time
240
+ - `status` — `ok` or `error`
241
+ - `meta` — child session ID, task index, output length, error details
242
+
243
+ Additionally, `run-parallel` writes `.codebase/parallel-progress.json` at completion with aggregate stats.
244
+
245
+ **To enable telemetry**, set the environment variable:
246
+
247
+ ```bash
248
+ TELEMETRY_ENABLED=true
249
+ ```
250
+
251
+ When enabled, events are written to `.codebase/TELEMETRY.jsonl`. The progress file is always written regardless of this setting.
252
+
253
+ ---
254
+
227
255
  ← [Back to Index](index.md)
package/docs/workflows.md CHANGED
@@ -1,14 +1,14 @@
1
- # FlowDeck Workflows
1
+ # Command Architecture
2
2
 
3
- Workflows define how agents collaborate in multi-step sequences. They live in `flowdeck/workflows/` as reference documentsagents read and follow them, but you don't invoke workflows directly. Commands trigger them.
3
+ FlowDeck commands are the single entry point for all operations. Each command embeds its workflow steps directlyno separate workflow files are needed.
4
4
 
5
- ## How Workflows Work
5
+ ## How Commands Work
6
6
 
7
7
  1. You run a command (e.g., `/fd-plan`)
8
- 2. The command's plugin handler injects workflow context into the session
9
- 3. The AI reads the workflow steps and delegates to the named agents in order
10
- 4. Each step's output becomes context for the next step
11
- 5. The workflow may pause for user confirmation before irreversible actions
8
+ 2. The command template is loaded with its embedded workflow steps
9
+ 3. The AI follows the step-by-step process defined in the command
10
+ 4. Each step may spawn agents or perform actions
11
+ 5. The command may pause for user confirmation before irreversible actions
12
12
 
13
13
  ## The Core FlowDeck Cycle
14
14
 
@@ -32,345 +32,97 @@ Each step gates the next. `/fd-plan` will not proceed without a confirmed `DISCU
32
32
 
33
33
  ---
34
34
 
35
- ## Workflow Reference Table
35
+ ## Command Reference
36
36
 
37
- | Workflow file | Triggered by | Agents involved |
38
- |--------------|-------------|----------------|
39
- | `discuss-flow.md` | `/fd-discuss` | `@orchestrator`, `@discusser` |
40
- | `plan-flow.md` | `/fd-plan` | `@orchestrator`, `@planner`, `@plan-checker` |
41
- | `plan-phase.md` | `/fd-plan-phase [N]` | `@planner`, `@plan-checker`, `@orchestrator` |
42
- | `execute-flow.md` | `/fd-new-feature` | `@orchestrator`, `@coder`, `@reviewer` |
43
- | `execute-phase.md` | `/execute-phase [N]` | `@orchestrator`, `@orchestrator` |
44
- | `fix-bug-flow.md` | `/fd-fix-bug` | `@orchestrator`, `@debug-specialist`, `@researcher`, `@tester`, `@coder`, `@reviewer` |
45
- | `debug-flow.md` | `/debug` | `@debug-specialist`, `@tester`, `@coder` |
46
- | `review-code-flow.md` | `/fd-review-code` | `@orchestrator`, `@parallel-coordinator`, `@reviewer`, `@researcher`, `@tester` |
47
- | `deploy-check-flow.md` | `/fd-deploy-check` | `@parallel-coordinator`, `@orchestrator`, `@security-auditor`, `@tester`, `@reviewer` |
48
- | `refactor-flow.md` | `/refactor` | `@tester`, `@mapper`, `@refactor-guide`, `@coder`, `@orchestrator` |
49
- | `write-docs-flow.md` | `/fd-write-docs` | `@code-explorer`, `@writer`, `@reviewer`, `@doc-updater` |
50
- | `map-codebase-flow.md` | `/fd-map-codebase` | `@orchestrator`, `@mapper` (×6 in parallel) |
51
- | `parallel-execution-flow.md` | Triggered by `@parallel-coordinator` | `@parallel-coordinator`, `@researcher`, `@code-explorer`, `@architect`, `@coder`, `@tester`, `@reviewer`, `@security-auditor` |
52
- | `multi-repo-flow.md` | `/fd-multi-repo` | `@multi-repo-coordinator`, `@architect`, `@coder`, `@tester`, `@reviewer` |
37
+ | Command | Purpose | Key Agents |
38
+ |---------|---------|------------|
39
+ | `/fd-new-project` | Bootstrap a new project | @orchestrator |
40
+ | `/fd-map-codebase` | Analyse and index the codebase | @mapper (×6 parallel) |
41
+ | `/fd-settings` | Configure FlowDeck settings | @orchestrator |
42
+ | `/fd-discuss` | Pre-planning discussion | @discusser |
43
+ | `/fd-plan` | Generate a phase plan | @planner, @plan-checker |
44
+ | `/fd-roadmap` | View / update project roadmap | @orchestrator |
45
+ | `/fd-dashboard` | Visual progress dashboard | |
46
+ | `/fd-ask` | Smart agent dispatch | various |
47
+ | `/fd-new-feature` | Implement a new feature | @coder, @tester, @reviewer |
48
+ | `/fd-fix-bug` | Fix a bug with TDD | @debug-specialist, @tester, @coder |
49
+ | `/fd-review-code` | Code review | @reviewer, @researcher, @tester |
50
+ | `/fd-write-docs` | Generate documentation | @writer, @reviewer |
51
+ | `/fd-deploy-check` | Pre-deploy safety check | @tester, @security-auditor, @reviewer |
52
+ | `/fd-progress` | View project progress | |
53
+ | `/fd-checkpoint` | Save a session checkpoint | — |
54
+ | `/fd-resume` | Resume from checkpoint | — |
55
+ | `/fd-multi-repo` | Multi-repo orchestration | @multi-repo-coordinator, @architect |
53
56
 
54
57
  ---
55
58
 
56
- ## Detailed Workflow Descriptions
59
+ ## Analysis Commands
57
60
 
58
- ### discuss-flow
61
+ These umbrella commands combine multiple analysis modules:
59
62
 
60
- **Triggered by:** `/fd-discuss`
61
-
62
- The discuss flow drives the requirements extraction phase. It starts by loading `PROJECT.md` and `STATE.md` to understand the current phase and any decisions already made. The `@orchestrator` extracts the current phase number, then spawns `@discusser` with that context so it avoids re-asking about settled decisions.
63
-
64
- The `@discusser` asks one question per turn, records every decision as `D-XX` with its rationale, and detects conflicts between new answers and existing decisions before proceeding. The Q&A loop continues until all required topics are covered. When complete, all decisions are written to `.planning/phases/phase-N/DISCUSS.md`.
65
-
66
- Before the file is marked confirmed, `@orchestrator` presents a summary of all decisions to the user and requires explicit confirmation. Nothing in DISCUSS.md is treated as locked until the user confirms.
67
-
68
- **Steps:**
69
- 1. `@orchestrator` — Load `PROJECT.md` and `STATE.md`
70
- 2. `@orchestrator` — Extract current phase number
71
- 3. `@discusser` — Q&A loop, one question per turn
72
- 4. `@discusser` — Record decisions with D-XX numbering
73
- 5. `@discusser` — Save to `.planning/phases/phase-N/DISCUSS.md`
74
- 6. `@orchestrator` — Present summary; require user confirmation
75
-
76
- **Workflow format:**
77
- ```yaml
78
- ---
79
- name: discuss-flow
80
- description: "Orchestrates discuss phase (context load → @discusser Q&A → pause → decisions → save)"
81
- triggers:
82
- - /fd-discuss
83
- steps:
84
- - name: load_context
85
- agent: "@orchestrator"
86
- priority: first
87
- action: Load PROJECT.md and current phase STATE.md
88
- - name: determine_phase
89
- agent: "@orchestrator"
90
- action: Extract current phase number from STATE.md
91
- - name: invoke_discusser
92
- agent: "@discusser"
93
- action: Spawn @discusser agent with project context
94
- - name: qa_loop
95
- agent: "@discusser"
96
- action: Discusser asks one question at a time; user responds; repeat until all topics covered
97
- - name: save_decisions
98
- agent: "@discusser"
99
- action: Write all decisions to .planning/phases/phase-N/DISCUSS.md with D-XX numbering
100
- - name: confirm_discuss
101
- agent: "@orchestrator"
102
- action: Present summary to user; require explicit confirmation before marking DISCUSS.md as confirmed
103
- ---
104
- ```
105
-
106
- ---
107
-
108
- ### plan-flow
109
-
110
- **Triggered by:** `/fd-plan`
111
-
112
- The plan flow creates an execution-ready `PLAN.md` from the decisions in a confirmed `DISCUSS.md`. It starts with a guard check — if `DISCUSS.md` does not exist or is not confirmed, execution stops and the user is directed to run `/fd-discuss` first.
113
-
114
- After loading context (`PROJECT.md`, `STATE.md`, `DISCUSS.md`), `@planner` creates a wave-structured `PLAN.md` where every task traces back to a `D-XX` decision. The draft plan is then handed to `@plan-checker`, which scores it for completeness, feasibility, and testability.
115
-
116
- A FAIL verdict from `@plan-checker` returns the plan to `@planner` for revision. A PASS (or PASS_WITH_NOTES) causes `@orchestrator` to present the plan to the user. Execution **pauses here** — the plan is not saved until the user explicitly confirms it. After confirmation, the plan is saved to `.planning/phases/phase-N/PLAN.md` and `STATE.md` is updated.
117
-
118
- **Steps:**
119
- 1. `@orchestrator` — Guard check: verify `DISCUSS.md` exists and is confirmed
120
- 2. `@orchestrator` — Load `PROJECT.md`, `STATE.md`, `DISCUSS.md`
121
- 3. `@planner` — Create `PLAN.md` with tasks traced to D-XX decisions
122
- 4. `@plan-checker` — Verify completeness, feasibility, testability; return PASS or FAIL
123
- 5. `@orchestrator` — Present draft plan for user review
124
- 6. `@orchestrator` — **PAUSE** — wait for explicit user CONFIRM before saving
125
- 7. `@orchestrator` — Save confirmed `PLAN.md` to `.planning/phases/phase-N/`
126
- 8. `@orchestrator` — Update `STATE.md` with plan file path
127
-
128
- ---
129
-
130
- ### plan-phase
131
-
132
- **Triggered by:** `/fd-plan-phase [N]`
133
-
134
- A focused sub-flow for creating a plan for a specific numbered phase. Unlike `plan-flow`, which drives the full `/fd-plan` command, `plan-phase` is a targeted invocation that takes a phase number as an argument and operates only on that phase's scope.
135
-
136
- `@planner` is spawned with the phase's `REQUIREMENTS.md` (or `DISCUSS.md`), `ROADMAP.md`, and `PROJECT.md`. It produces `.planning/phases/phase-N/PLAN.md`. `@plan-checker` then reviews the plan and returns PASS or FAIL with specific recommendations. Results are presented by `@orchestrator`.
137
-
138
- **Steps:**
139
- 1. `@planner` — Create `PLAN.md` for the specified phase
140
- 2. `@plan-checker` — Score plan: completeness, feasibility, testability
141
- 3. `@orchestrator` — Present PASS/FAIL verdict and recommendations
63
+ | Command | Purpose | Flags |
64
+ |---------|---------|-------|
65
+ | `/fd-analyze-change` | Combined impact analysis | `--impact`, `--blast-radius`, `--regression`, `--test-gap`, `--volatility` |
66
+ | `/fd-guarded-edit` | Edit gate decision | auto/confirm/review/block |
67
+ | `/fd-evaluate-risk` | Standalone risk assessment | |
68
+ | `/fd-translate-intent` | Intent to concrete options | `assumptions`, `recommended_option` |
142
69
 
143
70
  ---
144
71
 
145
- ### execute-flow
146
-
147
- **Triggered by:** `/fd-new-feature`
148
-
149
- The execute flow drives full feature delivery. A guard check verifies that `.planning/` and `.codebase/` exist and that `PLAN.md` is confirmed — if any check fails, execution stops with a specific message directing the user to the missing prerequisite.
72
+ ## Command Structure
150
73
 
151
- `@orchestrator` loads the active `PLAN.md` and identifies the first incomplete step. If steps are independent, `@coder` agents run in parallel via `@parallel-coordinator`. After each step, `@reviewer` reviews the completed work. `@orchestrator` marks the step complete in `STATE.md`, then advances to the next step. When all steps are complete, `STATE.md` is updated to the `review` phase.
74
+ Each command file (`src/commands/fd-*.md`) contains:
152
75
 
153
- **Steps:**
154
- 1. `@orchestrator`Guard check: verify `.planning/`, `.codebase/`, plan confirmed
155
- 2. `@orchestrator`Load active `PLAN.md`; identify first incomplete step
156
- 3. `@coder`Execute step (parallel if steps are independent)
157
- 4. `@reviewer`Review completed work
158
- 5. `@orchestrator`Mark step complete; advance to next step
159
- 6. `@orchestrator` — Loop until all steps complete; update phase to `review`
76
+ 1. **Frontmatter** — description and argument hint
77
+ 2. **Purpose**what the command does
78
+ 3. **Input**how to invoke it
79
+ 4. **Process** — step-by-step workflow embedded directly
80
+ 5. **Guards**transition rules and blocking conditions
81
+ 6. **Error Handling** fail-fast rules
160
82
 
83
+ Example structure:
84
+ ```markdown
161
85
  ---
162
-
163
- ### execute-phase
164
-
165
- **Triggered by:** `/execute-phase [N]`
166
-
167
- A targeted sub-flow for executing a single numbered phase plan. Before delegating, `@orchestrator` verifies that `.planning/`, `.codebase/`, and `.planning/phases/phase-N/PLAN.md` all exist and that the plan has the `confirmed` status flag.
168
-
169
- `@orchestrator` is spawned with `STATE.md`, `PLAN.md`, and `PROJECT.md`. It executes tasks in wave order, committing each atomically. After each task it checkpoints state via the planning-state tool. Deviations from the plan are documented in a `## Deviations` section of `PLAN.md`. After all tasks complete, `@orchestrator` writes `SUMMARY.md` and `@orchestrator` marks the phase complete in `STATE.md` and `ROADMAP.md`.
170
-
171
- **Steps:**
172
- 1. `@orchestrator` — Verify prerequisites: `.planning/`, `.codebase/`, `PLAN.md` confirmed
173
- 2. `@orchestrator` — Load `PLAN.md`, `STATE.md`, `PROJECT.md`
174
- 3. `@orchestrator` — Execute tasks in wave order; atomic commit per task
175
- 4. `@orchestrator` — Checkpoint state after each task
176
- 5. `@orchestrator` — Write `SUMMARY.md`
177
- 6. `@orchestrator` — Mark phase complete in `STATE.md` and `ROADMAP.md`
178
-
179
- ---
180
-
181
- ### fix-bug-flow
182
-
183
- **Triggered by:** `/fd-fix-bug`
184
-
185
- A systematic bug fix workflow that guarantees a regression test exists before any fix is applied. `@orchestrator` loads `STATE.md`, `ARCHITECTURE.md`, and `CONVENTIONS.md` to give all agents the project context they need.
186
-
187
- `@debug-specialist` reproduces the bug with a minimal case, documenting expected vs actual behavior. `@researcher` assists with root cause investigation by tracing the stack and reading related code. `@tester` writes a failing regression test that reproduces the exact failure — this test must fail before any fix is written. `@coder` then fixes the root cause (not the symptom) with the minimum change that makes the regression test pass. `@reviewer` checks the fix for quality and security regressions. Finally, `@tester` runs the full test suite to confirm everything is green.
188
-
189
- **Steps:**
190
- 1. `@orchestrator` — Load `STATE.md`, `ARCHITECTURE.md`, `CONVENTIONS.md`
191
- 2. `@debug-specialist` — Reproduce bug; document inputs and expected vs actual
192
- 3. `@researcher` — Trace stack; identify root cause candidates
193
- 4. `@tester` — Write failing regression test
194
- 5. `@coder` — Fix root cause; minimum change to make regression test pass
195
- 6. `@reviewer` — Review fix for quality and security regressions
196
- 7. `@tester` — Run full suite; confirm regression test and all others pass
197
- 8. `@orchestrator` — Update `STATE.md` with fix summary
198
-
86
+ description: Brief description
87
+ argument-hint: [args]
199
88
  ---
200
89
 
201
- ### debug-flow
202
-
203
- **Triggered by:** `/debug`
90
+ # Command Name
204
91
 
205
- A lighter debugging workflow focused on systematic diagnosis without the full bug-fix lifecycle. Where `fix-bug-flow` orchestrates a complete team, `debug-flow` keeps `@debug-specialist` in the lead throughout.
206
-
207
- `@debug-specialist` establishes a minimal reproduction case, reads the full stack trace from top to bottom, and traces the execution path backward to identify root cause. `@tester` then writes a failing regression test for the exact failure — not a general test, but one that fails for the specific reason `@debug-specialist` identified. `@coder` applies the minimal fix, and `@tester` verifies by running the regression test plus the full suite.
208
-
209
- The cardinal rule of this workflow: never suppress an error to make a test pass. Fix the root cause.
210
-
211
- **Steps:**
212
- 1. `@debug-specialist` — Establish minimal reproduction case
213
- 2. `@debug-specialist` — Trace execution path; identify root cause
214
- 3. `@tester` — Write failing regression test for the specific failure
215
- 4. `@coder` — Fix root cause with minimal change
216
- 5. `@tester` — Run regression test + full suite to confirm
217
-
218
- ---
92
+ **Input:** $ARGUMENTS
219
93
 
220
- ### review-code-flow
94
+ ## Process
221
95
 
222
- **Triggered by:** `/fd-review-code`
96
+ ### Step 1: Context Load
97
+ ...
223
98
 
224
- A parallel code review workflow that combines quality review, security checking, and test coverage verification simultaneously. `@orchestrator` determines the review scope — either from changed files (git diff) or an explicit scope argument.
99
+ ### Step 2: Execute
100
+ ...
225
101
 
226
- `@parallel-coordinator` spawns three agents simultaneously: `@reviewer` checks for security vulnerabilities (injection, exposed secrets, missing auth) and code quality issues; `@researcher` provides best-practice context for any flagged areas; `@tester` verifies that changed code has adequate test coverage. All three run in parallel and report independently. `@orchestrator` then aggregates the findings into a unified report sorted by severity: CRITICAL → HIGH → MEDIUM → PASS.
102
+ ## Guards
227
103
 
228
- **Steps:**
229
- 1. `@orchestrator` — Identify review scope (changed files or explicit argument)
230
- 2. `@parallel-coordinator` Spawn in parallel:
231
- - `@reviewer` — security vulnerabilities and code quality
232
- - `@researcher` — best-practice context for flagged areas
233
- - `@tester` — test coverage for changed code
234
- 3. `@orchestrator` — Aggregate all findings by severity into unified report
235
-
236
- ---
237
-
238
- ### deploy-check-flow
239
-
240
- **Triggered by:** `/fd-deploy-check`
241
-
242
- A comprehensive pre-deployment check suite that runs four independent checks simultaneously and produces a single GO/NO-GO decision. Any CRITICAL or HIGH finding from any check produces NO-GO.
243
-
244
- `@parallel-coordinator` launches all four checks at once: the full test suite (all tests pass, no unexplained skips), a security scan via `@security-auditor` (OWASP Top 10 on changed files), a CVE audit on dependencies, and a clean build verification. `@orchestrator` waits for all four to complete, aggregates the results, and produces the final GO or NO-GO verdict. A NO-GO includes a specific list of required fixes before the deployment can be retried.
245
-
246
- **Steps:**
247
- 1. `@parallel-coordinator` — Run simultaneously:
248
- - Full test suite
249
- - Security scan (`@security-auditor`)
250
- - CVE dependency audit
251
- - Build verification
252
- 2. `@orchestrator` — Aggregate all results
253
- 3. `@orchestrator` — Produce GO/NO-GO decision; list required fixes if NO-GO
254
-
255
- ---
256
-
257
- ### refactor-flow
258
-
259
- **Triggered by:** `/refactor`
260
-
261
- A disciplined safe-refactoring workflow where the test suite must be green before the first line of code changes, and must stay green after every single transformation. No feature additions are permitted during a refactoring session.
262
-
263
- `@tester` runs the suite and confirms it is green. If it is not green, the workflow stops — tests must be fixed before refactoring begins. `@mapper` reads the codebase and identifies refactoring candidates (large files, duplication, high complexity). `@refactor-guide` produces a list of specific transforms ordered from lowest to highest risk. `@coder` applies one transform, then `@tester` verifies the suite is still green. `@orchestrator` commits each transform separately with a `refactor:` prefix message. The loop repeats until all planned transforms are complete.
264
-
265
- **Steps:**
266
- 1. `@tester` — Run suite; confirm green before any changes
267
- 2. `@mapper` — Identify refactoring candidates
268
- 3. `@refactor-guide` — List transforms in low-to-high risk order
269
- 4. Loop:
270
- - `@coder` — Apply one transform
271
- - `@tester` — Verify suite still green; if broken, undo
272
- - `@orchestrator` — Commit with `refactor:` message
273
-
274
- ---
275
-
276
- ### write-docs-flow
277
-
278
- **Triggered by:** `/fd-write-docs`
279
-
280
- A documentation workflow that prioritizes accuracy over speed — every piece of documentation is verified against the actual code before it is finalized. The flow starts with exploration rather than writing.
281
-
282
- `@code-explorer` maps all exported functions, classes, and types in the target scope, identifying public API entry points and key workflows. `@writer` uses that structural map to draft documentation covering API reference, examples, and usage patterns — it reads every source file it documents. `@reviewer` then checks the draft for accuracy against actual code behavior (not plausible-sounding descriptions, actual behavior). `@writer` incorporates reviewer feedback, and `@doc-updater` writes the final output to the appropriate location and ensures no stale references remain.
283
-
284
- **Steps:**
285
- 1. `@code-explorer` — Map exports, public APIs, and key workflows in scope
286
- 2. `@writer` — Draft documentation from code exploration output
287
- 3. `@reviewer` — Accuracy check against actual code behavior
288
- 4. `@writer` — Revise based on review feedback
289
- 5. `@doc-updater` — Write final docs to appropriate location; remove stale references
290
-
291
- ---
292
-
293
- ### map-codebase-flow
294
-
295
- **Triggered by:** `/fd-map-codebase`
296
-
297
- Produces the six `.codebase/` documentation files in parallel using six `@mapper` instances, each assigned to one output file. Before running, `@orchestrator` checks whether `.codebase/` already exists and requires user confirmation before overwriting.
298
-
299
- `@orchestrator` creates individual worktrees for each mapper instance to prevent file conflicts, then spawns all six `@mapper` agents simultaneously. Each mapper reads source files directly and writes only its assigned file: `STACK.md`, `ARCHITECTURE.md`, `STRUCTURE.md`, `CONVENTIONS.md`, `TESTING.md`, or `CONCERNS.md`. `@orchestrator` waits for all six to complete, then verifies each file exists and contains non-empty content. Worktrees are cleaned up regardless of success or failure.
300
-
301
- **Steps:**
302
- 1. `@orchestrator` — Check if `.codebase/` exists; warn and require confirmation if present
303
- 2. `@orchestrator` — Create worktrees for each mapper instance
304
- 3. `@mapper` ×6 — Run in parallel, each writing its assigned `.codebase/` file
305
- 4. `@orchestrator` — Wait for all mappers to complete
306
- 5. `@orchestrator` — Clean up worktrees
307
- 6. `@orchestrator` — Verify all six files exist with non-empty content
308
-
309
- **Output files:**
310
-
311
- | File | Contents |
312
- |------|---------|
313
- | `.codebase/STACK.md` | Tech stack with exact pinned versions |
314
- | `.codebase/ARCHITECTURE.md` | Component diagram and data flow |
315
- | `.codebase/STRUCTURE.md` | Directory layout with purpose of each directory |
316
- | `.codebase/CONVENTIONS.md` | Naming and coding patterns with file:line examples |
317
- | `.codebase/TESTING.md` | Test frameworks, patterns, and file organization |
318
- | `.codebase/CONCERNS.md` | All TODO, FIXME, and HACK markers found by grep |
319
-
320
- ---
321
-
322
- ### parallel-execution-flow
323
-
324
- **Triggered by:** `@parallel-coordinator` (invoked from execute-flow or directly)
325
-
326
- The parallel execution flow maximizes agent throughput by running independent workstreams simultaneously in waves. It is not triggered by a user command directly — it is invoked when `@orchestrator` or `@execute-flow` determines that parallel execution is appropriate for a plan.
327
-
328
- `@parallel-coordinator` reads the active `PLAN.md`, identifies all tasks, and classifies each as blocking (must complete before something else) or independent (can run simultaneously). It then groups tasks into waves and emits a WAVE TABLE before delegating any agents.
329
-
330
- The standard wave structure: Wave 1 runs `@researcher` and `@code-explorer` simultaneously (discovery); Wave 2 runs `@architect` alone (design, serial, gates Wave 3); Wave 3 runs `@coder` and `@tester` simultaneously (implementation from `@architect`'s contracts); Wave 4 runs `@reviewer` and `@security-auditor` simultaneously (validation). When Wave 3 tracks converge, `@parallel-coordinator` runs a merge protocol to detect and resolve any overlapping file changes.
331
-
332
- **Steps:**
333
- 1. `@parallel-coordinator` — Read `PLAN.md`; classify tasks as blocking or independent
334
- 2. `@parallel-coordinator` — Group into waves; emit WAVE TABLE
335
- 3. Wave 1 (parallel): `@researcher` + `@code-explorer`
336
- 4. Wave 2 (serial): `@architect` (design from Wave 1 output)
337
- 5. Wave 3 (parallel): `@coder` + `@tester` (from `@architect` contracts)
338
- 6. `@parallel-coordinator` — Merge Wave 3 outputs; resolve conflicts
339
- 7. Wave 4 (parallel): `@reviewer` + `@security-auditor`
340
-
341
- **WAVE TABLE format:**
342
- ```
343
- ╔══════════════════════════════════════════════════════════════╗
344
- ║ WAVE TABLE — [Job Title] ║
345
- ╠══════════════════════════════════════════════════════════════╣
346
- ║ Wave 1 (parallel) │ @researcher + @code-explorer ║
347
- ║ Wave 2 (serial) │ @architect ║
348
- ║ Wave 3 (parallel) │ @coder + @tester ║
349
- ║ Wave 4 (parallel) │ @reviewer + @security-auditor ║
350
- ╠══════════════════════════════════════════════════════════════╣
351
- ║ Est. sequential: │ 8h ║
352
- ║ Est. parallel: │ 4.5h ║
353
- ║ Dependency locks: │ Wave 3 blocked on Wave 2 output ║
354
- ╚══════════════════════════════════════════════════════════════╝
104
+ | Transition | Guard | If Violated |
105
+ |-----------|-------|-------------|
106
+ | A B | condition | block |
355
107
  ```
356
108
 
357
109
  ---
358
110
 
359
- ### multi-repo-flow
360
-
361
- **Triggered by:** `/fd-multi-repo`
362
-
363
- Orchestrates a feature or fix that spans multiple repositories in a microservice architecture. Ensures changes propagate in the correct dependency order, API contracts are agreed before implementation, and integration is verified end-to-end before any service ships to production.
364
-
365
- `@multi-repo-coordinator` reads the sub-repo registry from `.planning/config.json`, verifies all repository paths exist, and loads each service's tech stack. It then builds a dependency graph — which services call which — and classifies the change as breaking or non-breaking. `@architect` writes the contract-first change specification and a per-repo CHANGE PLAN ordered by the dependency graph. `@coder` and `@tester` implement and test changes in each repo in the correct order (upstream before downstream). After all repos are implemented, `@tester` and `@reviewer` run cross-repo integration verification and sign off on each repo before any service is deployed.
111
+ ## Agent Configuration
366
112
 
367
- **Steps:**
368
- 1. `@multi-repo-coordinator` — Read `.planning/config.json`; verify repo paths; load stacks
369
- 2. `@multi-repo-coordinator` + `@architect` Build dependency graph; classify change
370
- 3. `@architect` Write contract-first change spec and ordered per-repo CHANGE PLAN
371
- 4. `@coder` + `@tester` Implement and test in dependency order (upstream first)
372
- 5. `@tester` + `@reviewer` Cross-repo integration tests; sign off per repo
113
+ | Agent | Purpose |
114
+ |-------|---------|
115
+ | @orchestrator | Coordinates multi-step workflows |
116
+ | @planner | Creates implementation plans |
117
+ | @coder | Implements code changes |
118
+ | @tester | Writes and runs tests |
119
+ | @reviewer | Reviews code quality |
120
+ | @researcher | Investigates and provides context |
121
+ | @security-auditor | Security vulnerability scanning |
122
+ | @architect | System design and patterns |
123
+ | @writer | Documentation generation |
124
+ | @mapper | Codebase analysis |
373
125
 
374
126
  ---
375
127
 
376
- ← [Back to Index](index.md)
128
+ ← [Back to Index](index.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dv.nghiem/flowdeck",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "FlowDeck — structured planning and execution workflows for OpenCode",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,6 @@
20
20
  "src/commands",
21
21
  "src/rules",
22
22
  "src/skills",
23
- "src/workflows",
24
23
  "docs",
25
24
  "postinstall.mjs"
26
25
  ],
@@ -5,54 +5,89 @@ argument-hint: [--env=staging|production]
5
5
 
6
6
  # Deploy Check
7
7
 
8
- Run a comprehensive pre-deploy validation to produce a go/no-go decision.
8
+ Run a comprehensive pre-deployment check suite before releasing to production.
9
9
 
10
10
  **Input:** $ARGUMENTS — optional `--env=staging|production` (default: staging)
11
11
 
12
- ## Parallel Checks
12
+ ## Process
13
13
 
14
- Run three checks simultaneously:
14
+ ### Step 1: Parallel Checks
15
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
16
+ Launch four checks simultaneously:
20
17
 
21
- ### Check 2 Code Review (@reviewer)
18
+ **Check A: Test Suite (@tester)**
19
+ ```bash
20
+ npm test
21
+ ```
22
+ All tests must pass. No failures, no skips without justification.
23
+
24
+ **Check B: Security Scan**
25
+
26
+ Spawn `@security-auditor` to check:
27
+ - No hardcoded secrets in changed files
28
+ - Input validation at trust boundaries
29
+ - Auth/authz on all protected routes
30
+ - No CRITICAL or HIGH vulnerabilities
31
+
32
+ **Check C: Dependency CVE Audit**
33
+ ```bash
34
+ npm audit --audit-level=high
35
+ ```
36
+ No HIGH or CRITICAL CVEs unaddressed.
37
+
38
+ **Check D: Build Verification**
39
+ ```bash
40
+ npm run build
41
+ ```
42
+ Build must succeed with zero errors.
43
+
44
+ **Check E: Code Review (@reviewer)** — parallel with above
22
45
  - Security review: secrets, injection vulnerabilities, auth gaps
23
46
  - Quality review: critical bugs, missing error handling
24
47
  - TDD discipline: verify new code has tests
25
48
  - Report: CRITICAL/HIGH findings only (no nits for deploy check)
26
49
 
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
50
+ ### Step 2: Aggregate Results
31
51
 
32
- ## Go/No-Go Decision
52
+ ```
53
+ ## Pre-Deployment Check
33
54
 
34
- **@orchestrator** aggregates results:
55
+ | Check | Status | Details |
56
+ |-------|--------|---------|
57
+ | Tests | ✅ PASS / ❌ FAIL | N/N passed |
58
+ | Security | ✅ PASS / ❌ FAIL | [findings] |
59
+ | CVE Audit | ✅ PASS / ❌ FAIL | [vulnerabilities] |
60
+ | Build | ✅ PASS / ❌ FAIL | [errors] |
61
+ ```
35
62
 
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) |
63
+ ### Step 3: Go/No-Go Decision
42
64
 
43
- ## Report
65
+ **🚀 GO** — all checks pass, proceed with deployment.
44
66
 
67
+ **🛑 NO-GO** — one or more checks failed:
45
68
  ```
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
- ════════════════════════════════════════════
69
+ Verdict: NO-GO
70
+
71
+ Required fixes before deploy:
72
+ - [ ] [fix 1]
73
+ - [ ] [fix 2]
74
+
75
+ Run /deploy-check again after fixing.
55
76
  ```
56
77
 
57
- For NO-GO: list blocking issues with fix suggestions.
58
- For CONDITIONAL: list what requires override approval.
78
+ ## No-go conditions (automatic)
79
+
80
+ Any of these → automatic NO-GO:
81
+ - Test failures
82
+ - CRITICAL security vulnerability
83
+ - HIGH/CRITICAL CVE unpatched
84
+ - Build error
85
+
86
+ ## Agent Configuration
87
+
88
+ | Agent | Purpose |
89
+ |-------|---------|
90
+ | @tester | Run test suite |
91
+ | @security-auditor | Security vulnerability scan |
92
+ | @researcher | CVE research and context |
93
+ | @reviewer | Code quality review |