@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.
- package/dist/hooks/orchestrator-guard-hook.d.ts +2 -1
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/index.js +197 -147
- package/dist/services/telemetry.d.ts +1 -1
- package/dist/services/telemetry.d.ts.map +1 -1
- package/dist/tools/run-parallel.d.ts.map +1 -1
- package/docs/configuration.md +2 -0
- package/docs/parallel-execution.md +28 -0
- package/docs/workflows.md +72 -320
- package/package.json +1 -2
- package/src/commands/fd-deploy-check.md +67 -32
- package/src/commands/fd-discuss.md +44 -6
- package/src/commands/fd-fix-bug.md +47 -20
- package/src/commands/fd-map-codebase.md +66 -18
- package/src/commands/fd-multi-repo.md +130 -6
- package/src/commands/fd-new-feature.md +164 -21
- package/src/commands/fd-plan.md +66 -44
- package/src/commands/fd-review-code.md +69 -35
- package/src/commands/fd-write-docs.md +55 -23
- package/src/workflows/debug-flow.md +0 -119
- package/src/workflows/deploy-check-flow.md +0 -98
- package/src/workflows/discuss-flow.md +0 -97
- package/src/workflows/execute-flow.md +0 -233
- package/src/workflows/execute-phase.md +0 -145
- package/src/workflows/fix-bug-flow.md +0 -210
- package/src/workflows/map-codebase-flow.md +0 -92
- package/src/workflows/multi-repo-flow.md +0 -226
- package/src/workflows/parallel-execution-flow.md +0 -236
- package/src/workflows/plan-flow.md +0 -126
- package/src/workflows/plan-phase.md +0 -101
- package/src/workflows/refactor-flow.md +0 -122
- package/src/workflows/review-code-flow.md +0 -105
- package/src/workflows/spec-driven-flow.md +0 -43
- package/src/workflows/write-docs-flow.md +0 -95
|
@@ -15,9 +15,34 @@ Run a structured requirements discussion session and capture decisions.
|
|
|
15
15
|
2. Read current phase from STATE.md.
|
|
16
16
|
3. Create `.planning/phases/phase-<N>/` directory if it does not exist.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Process
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### Step 1: Load Context
|
|
21
|
+
|
|
22
|
+
Read `.planning/PROJECT.md` to understand the project vision and goals.
|
|
23
|
+
Read `.planning/STATE.md` to determine the current phase and context.
|
|
24
|
+
|
|
25
|
+
### Step 2: Determine Phase
|
|
26
|
+
|
|
27
|
+
Extract the current phase number from STATE.md.
|
|
28
|
+
Decisions will be saved to `.planning/phases/phase-{N}/DISCUSS.md`.
|
|
29
|
+
|
|
30
|
+
### Step 3: Invoke Discusser
|
|
31
|
+
|
|
32
|
+
Spawn @discusser agent with:
|
|
33
|
+
- Project context (from PROJECT.md)
|
|
34
|
+
- Current phase number
|
|
35
|
+
- Instructions to ask ONE question per turn
|
|
36
|
+
|
|
37
|
+
### Step 4: Q&A Loop
|
|
38
|
+
|
|
39
|
+
The @discusser agent asks one question at a time.
|
|
40
|
+
After each user response:
|
|
41
|
+
- Assign D-XX number to any new decision
|
|
42
|
+
- Record: topic, choice, rationale
|
|
43
|
+
- If response conflicts with previous decision, flag the conflict
|
|
44
|
+
|
|
45
|
+
Continue until all required topics are covered or user says to stop early.
|
|
21
46
|
|
|
22
47
|
Structure the discussion:
|
|
23
48
|
|
|
@@ -30,8 +55,6 @@ Ask questions one at a time. Wait for answers before proceeding.
|
|
|
30
55
|
|
|
31
56
|
## Decision Recording
|
|
32
57
|
|
|
33
|
-
As the user answers, extract decisions and number them `D-01`, `D-02`, etc.
|
|
34
|
-
|
|
35
58
|
After the discussion, write `.planning/phases/phase-<N>/DISCUSS.md`:
|
|
36
59
|
|
|
37
60
|
```markdown
|
|
@@ -43,8 +66,8 @@ After the discussion, write `.planning/phases/phase-<N>/DISCUSS.md`:
|
|
|
43
66
|
|
|
44
67
|
## Decisions
|
|
45
68
|
|
|
46
|
-
D-01:
|
|
47
|
-
D-02:
|
|
69
|
+
D-01: [Topic] — [Decision] ([Rationale])
|
|
70
|
+
D-02: [Topic] — [Decision] ([Rationale])
|
|
48
71
|
...
|
|
49
72
|
|
|
50
73
|
## Open Questions
|
|
@@ -56,6 +79,21 @@ D-02: <decision>
|
|
|
56
79
|
- Run /fd-plan to create implementation plan from these decisions
|
|
57
80
|
```
|
|
58
81
|
|
|
82
|
+
## D-05 Compliance
|
|
83
|
+
|
|
84
|
+
- Loads PROJECT.md + current phase STATE.md
|
|
85
|
+
- Invokes @discusser agent
|
|
86
|
+
- Saves decisions with D-XX numbering to DISCUSS.md
|
|
87
|
+
- One question at a time (no compound questions)
|
|
88
|
+
|
|
59
89
|
## Completion
|
|
60
90
|
|
|
61
91
|
Report: decisions captured, file path, and suggest running `/fd-plan`.
|
|
92
|
+
|
|
93
|
+
## Error Handling
|
|
94
|
+
|
|
95
|
+
D-03: Fail fast with clear error
|
|
96
|
+
- If PROJECT.md not found: error with "Run /new-project first"
|
|
97
|
+
- If STATE.md not found: error with "Project not initialized"
|
|
98
|
+
- If @discusser fails: error with "Discusser agent unavailable"
|
|
99
|
+
- No partial state saved on error
|
|
@@ -9,6 +9,22 @@ Fix a bug using the TDD red-green-refactor discipline.
|
|
|
9
9
|
|
|
10
10
|
**Input:** $ARGUMENTS — description of the bug. Optional `--scope=<path>` to limit search scope.
|
|
11
11
|
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- `.planning/` initialized
|
|
15
|
+
- Bug description or reproduction steps available
|
|
16
|
+
|
|
17
|
+
## TDD Cycle
|
|
18
|
+
|
|
19
|
+
The workflow enforces the TDD cycle with guards at each transition:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
BEHAVIOR → RED → GREEN → REFACTOR → complete
|
|
23
|
+
↑______________| |
|
|
24
|
+
(loop if needed) |
|
|
25
|
+
Only if GREEN
|
|
26
|
+
```
|
|
27
|
+
|
|
12
28
|
## Pre-flight
|
|
13
29
|
|
|
14
30
|
1. Check `.planning/STATE.md` exists — if not, error: "Run /fd-new-project first."
|
|
@@ -16,49 +32,44 @@ Fix a bug using the TDD red-green-refactor discipline.
|
|
|
16
32
|
3. Read `.codebase/ARCHITECTURE.md` if available — pass as context.
|
|
17
33
|
4. Check `.codebase/FAILURES.json` for prior failures matching the bug description.
|
|
18
34
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
[1-2] Explore + Research → isolate root cause
|
|
23
|
-
[3] Define behaviors → acceptance cases for the fix
|
|
24
|
-
[4] RED → @tester writes failing regression test
|
|
25
|
-
[5] Confirm → test MUST fail before proceeding
|
|
26
|
-
[6] GREEN → @coder implements minimum fix
|
|
27
|
-
[7] Confirm → test MUST pass before proceeding
|
|
28
|
-
[8] REFACTOR → clean up (only if GREEN)
|
|
29
|
-
[9-10] Verify → full test suite passes
|
|
30
|
-
[11] Review → @reviewer confirms + TDD discipline check
|
|
31
|
-
[12] Record → log fix + regression test in FAILURES.json
|
|
32
|
-
```
|
|
35
|
+
## Process
|
|
33
36
|
|
|
34
37
|
### Steps 1-2: Explore & Research
|
|
35
38
|
|
|
36
39
|
- **@researcher**: Investigate bug scope, trace root cause via ARCHITECTURE.md and source files
|
|
37
40
|
- **@researcher**: Identify all affected components, list prior similar failures from FAILURES.json
|
|
38
41
|
|
|
42
|
+
Reproduce the bug with minimal case; document inputs and expected vs actual.
|
|
43
|
+
|
|
39
44
|
### Step 3: Define Behaviors
|
|
40
45
|
|
|
41
46
|
Write acceptance cases describing the fix (what should happen after the bug is fixed).
|
|
42
47
|
|
|
43
|
-
### Step 4:
|
|
48
|
+
### Step 4: Isolate Root Cause
|
|
49
|
+
|
|
50
|
+
Spawn `@researcher` to investigate:
|
|
51
|
+
- Trace the execution path
|
|
52
|
+
- Read stack trace completely
|
|
53
|
+
- Check recent changes: `git log --oneline -20 -- <file>`
|
|
54
|
+
- Identify root cause (not symptom)
|
|
55
|
+
|
|
56
|
+
### Step 5: RED — Write Failing Test
|
|
44
57
|
|
|
45
58
|
- **@tester**: Write a regression test that reproduces the bug (it MUST fail right now)
|
|
46
59
|
- Show test output proving it fails
|
|
47
60
|
|
|
48
61
|
**GUARD: Do NOT proceed if test does not fail RED.**
|
|
49
62
|
|
|
50
|
-
### Step
|
|
63
|
+
### Step 6: Confirm RED
|
|
51
64
|
|
|
52
65
|
Confirm test fails. If it passes, the bug may already be fixed or the test is wrong.
|
|
53
66
|
|
|
54
|
-
### Step
|
|
67
|
+
### Step 7: GREEN — Implement Fix
|
|
55
68
|
|
|
56
69
|
- **@coder**: Implement the minimum code change that makes the regression test pass
|
|
57
70
|
- Do not refactor yet
|
|
58
71
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Run test. It MUST pass. **GUARD: Do NOT proceed if test does not pass GREEN.**
|
|
72
|
+
**GUARD: Do NOT proceed if test does not pass GREEN.**
|
|
62
73
|
|
|
63
74
|
### Step 8: REFACTOR
|
|
64
75
|
|
|
@@ -88,6 +99,22 @@ Append entry to `.codebase/FAILURES.json`:
|
|
|
88
99
|
}
|
|
89
100
|
```
|
|
90
101
|
|
|
102
|
+
## Error Handling
|
|
103
|
+
|
|
104
|
+
- **GUARD VIOLATION**: If coder attempts to skip RED or GREEN phase, block and return to correct phase
|
|
105
|
+
- **Override mechanism**: User can override with `/fd-fix-bug --override` but every override is logged in `override_log`
|
|
106
|
+
- If root cause unclear: spawn `@debug-specialist` for deeper analysis
|
|
107
|
+
- If fix breaks tests: revert, reassess root cause, never suppress error
|
|
108
|
+
|
|
109
|
+
## Guards Summary
|
|
110
|
+
|
|
111
|
+
| Transition | Guard | If Violated |
|
|
112
|
+
|-----------|-------|-------------|
|
|
113
|
+
| behavior → red | Test written and fails | Block until test fails |
|
|
114
|
+
| red → green | Test exists and fails | Block until test passes |
|
|
115
|
+
| green → refactor | Tests are green | Block until green |
|
|
116
|
+
| refactor → complete | All tests pass | Block until all pass |
|
|
117
|
+
|
|
91
118
|
## Completion
|
|
92
119
|
|
|
93
120
|
Report: root cause, fix applied, regression test location, reviewer sign-off.
|
|
@@ -9,28 +9,76 @@ Analyze the current codebase and generate comprehensive documentation under `.co
|
|
|
9
9
|
|
|
10
10
|
**Input:** $ARGUMENTS (pass `--incremental` to only process changed files)
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Pre-flight
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Check if `.codebase/` directory already exists. If present, warn and require confirmation to overwrite.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
- **@researcher**: Scan package files (`package.json`, `go.mod`, `pyproject.toml`, `Cargo.toml`, etc.) to identify tech stack, frameworks, and dependencies
|
|
18
|
-
- **@architect**: Analyze directory structure, module boundaries, key entry points, and architectural patterns
|
|
19
|
-
- **@code-explorer**: Scan source files for naming conventions, code style patterns, import conventions, and anti-patterns
|
|
20
|
-
- **@tester**: Find test files, identify testing frameworks, coverage configuration, and testing patterns
|
|
21
|
-
- **@researcher** (second pass): Scan for TODO/FIXME/HACK comments, large files (>500 lines), duplicated code patterns, and security concerns
|
|
16
|
+
## Process
|
|
22
17
|
|
|
23
|
-
|
|
18
|
+
### Step 1: Check Existing
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
If `.codebase/` directory already exists:
|
|
21
|
+
```
|
|
22
|
+
Warning: .codebase/ already exists. Running /map-codebase will overwrite existing docs.
|
|
23
|
+
Continue? (y/n)
|
|
24
|
+
```
|
|
25
|
+
If user declines, abort. If user confirms, proceed.
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
### Step 2: Initialize Worktrees
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
D-04: Each mapper runs in its own isolated worktree to prevent conflicts.
|
|
30
|
+
Create worktrees:
|
|
31
|
+
- `flowdeck-mapper-stack`
|
|
32
|
+
- `flowdeck-mapper-arch`
|
|
33
|
+
- `flowdeck-mapper-structure`
|
|
34
|
+
- `flowdeck-mapper-conventions`
|
|
35
|
+
- `flowdeck-mapper-testing`
|
|
36
|
+
- `flowdeck-mapper-concerns`
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
### Step 3: Invoke Mappers
|
|
39
|
+
|
|
40
|
+
Spawn 6 @mapper agents in parallel:
|
|
41
|
+
- @mapper → STACK.md (tech stack, dependencies, versions)
|
|
42
|
+
- @mapper → ARCHITECTURE.md (system design, components, data flow)
|
|
43
|
+
- @mapper → STRUCTURE.md (file organization, directory layout)
|
|
44
|
+
- @mapper → CONVENTIONS.md (coding standards, naming, patterns)
|
|
45
|
+
- @mapper → TESTING.md (test strategy, coverage, frameworks)
|
|
46
|
+
- @mapper → CONCERNS.md (known issues, technical debt, risks)
|
|
47
|
+
|
|
48
|
+
Each mapper:
|
|
49
|
+
- Reads source files directly (no guessing)
|
|
50
|
+
- Outputs factual analysis only
|
|
51
|
+
- Writes to assigned .codebase/ doc file
|
|
52
|
+
|
|
53
|
+
### Step 4: Wait for Completion
|
|
54
|
+
|
|
55
|
+
Wait for all 6 mapper agents to complete. If any fails:
|
|
56
|
+
- Log the failure
|
|
57
|
+
- Continue with remaining mappers
|
|
58
|
+
- Report which docs were not generated
|
|
59
|
+
|
|
60
|
+
### Step 5: Cleanup
|
|
61
|
+
|
|
62
|
+
Remove all worktrees regardless of outcome (cleanup happens after all agents complete).
|
|
63
|
+
|
|
64
|
+
### Step 6: Verify
|
|
65
|
+
|
|
66
|
+
Check that all 6 .codebase/ doc files exist and contain non-empty content.
|
|
67
|
+
If any are missing or empty, report which ones need regeneration.
|
|
68
|
+
|
|
69
|
+
If `--incremental`: only update files where the underlying source has changed since the last map (check `.codebase/last_mapped` timestamp).
|
|
70
|
+
|
|
71
|
+
### Step 7: Write Timestamp
|
|
72
|
+
|
|
73
|
+
Write timestamp to `.codebase/last_mapped`.
|
|
74
|
+
|
|
75
|
+
## Output
|
|
76
|
+
|
|
77
|
+
Report summary: files created/updated, key findings per category.
|
|
78
|
+
|
|
79
|
+
## Error Handling
|
|
80
|
+
|
|
81
|
+
D-03: Fail fast with clear error
|
|
82
|
+
- If .codebase/ check fails: show clear error with remediation
|
|
83
|
+
- If worktree creation fails: report which worktree failed
|
|
84
|
+
- Do NOT save partial state on error
|
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Cross-repo change orchestration — analyze-repos → identify-dependencies → plan-changes → execute-per-repo → verify-integration
|
|
3
3
|
argument-hint: [list | add <path> [name] | remove <name> | status]
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Multi-Repo
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Orchestrates a feature or fix that spans multiple repositories in a microservice architecture.
|
|
9
9
|
|
|
10
10
|
**Input:** $ARGUMENTS
|
|
11
11
|
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- A feature requires changes in two or more services
|
|
15
|
+
- An API contract is changing in an upstream service with downstream consumers
|
|
16
|
+
- A shared library is being upgraded with a breaking change
|
|
17
|
+
- You need a coordinated rollout across services
|
|
18
|
+
|
|
19
|
+
Do not use for single-repo work. Use `/new-feature` instead.
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
Before running this flow:
|
|
24
|
+
1. `.planning/config.json` has a `sub_repos` array with the relevant repos registered
|
|
25
|
+
2. All `path` values in the registry resolve to actual directories on disk
|
|
26
|
+
3. A description of the intended change is available (from `/discuss` or passed directly)
|
|
27
|
+
|
|
28
|
+
If the registry is empty or not set up, run `/multi-repo --add` first.
|
|
29
|
+
|
|
12
30
|
## Behavior
|
|
13
31
|
|
|
14
32
|
### List (`list` or no arguments)
|
|
@@ -19,10 +37,12 @@ Read `.planning/config.json` → `repos` array. Display:
|
|
|
19
37
|
════════════════════════════════════
|
|
20
38
|
MULTI-REPO REGISTRY
|
|
21
39
|
════════════════════════════════════
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
shared
|
|
25
|
-
|
|
40
|
+
user-service ../user-service upstream-api node+typescript
|
|
41
|
+
order-service ../order-service downstream-consumer node+typescript
|
|
42
|
+
shared-types ../shared-types shared-lib node+typescript
|
|
43
|
+
api-gateway ../api-gateway gateway nginx+lua
|
|
44
|
+
|
|
45
|
+
Path check: all 4 repos resolved ✅
|
|
26
46
|
```
|
|
27
47
|
|
|
28
48
|
### Add (`add <path> [name]`)
|
|
@@ -51,6 +71,110 @@ WORKSPACE STATUS
|
|
|
51
71
|
Overall: 1 in progress, 1 complete, 1 planned
|
|
52
72
|
```
|
|
53
73
|
|
|
74
|
+
## Execution Flow
|
|
75
|
+
|
|
76
|
+
### Step 1: Analyze Repos
|
|
77
|
+
|
|
78
|
+
`@multi-repo-coordinator` reads `.planning/config.json` and produces a registry summary.
|
|
79
|
+
|
|
80
|
+
If any path fails to resolve, the flow stops here with a clear error. The registry must be clean before proceeding.
|
|
81
|
+
|
|
82
|
+
### Step 2: Identify Dependencies
|
|
83
|
+
|
|
84
|
+
`@multi-repo-coordinator` and `@architect` work together to:
|
|
85
|
+
|
|
86
|
+
1. Build the dependency graph from service roles and actual API references (scan client code, package.json, service mesh config)
|
|
87
|
+
2. Classify the requested change as breaking or non-breaking for each affected service
|
|
88
|
+
3. Produce the ordered change list
|
|
89
|
+
|
|
90
|
+
If any circular dependency is detected, the flow stops and reports the cycle. Circular dependencies cannot be resolved automatically.
|
|
91
|
+
|
|
92
|
+
### Step 3: Plan Changes
|
|
93
|
+
|
|
94
|
+
`@architect` produces the cross-repo CHANGE PLAN using contract-first development:
|
|
95
|
+
|
|
96
|
+
1. Write the new API contract or type definition before any implementation starts
|
|
97
|
+
2. Confirm the contract covers all required changes without unnecessary scope creep
|
|
98
|
+
3. Produce a per-repo task list ordered by the dependency graph
|
|
99
|
+
|
|
100
|
+
### Step 4: Execute Per Repo
|
|
101
|
+
|
|
102
|
+
Changes execute in dependency order. For each repo:
|
|
103
|
+
|
|
104
|
+
1. `@coder` implements the changes in that repo
|
|
105
|
+
2. `@tester` writes and runs tests for that repo's changes
|
|
106
|
+
3. No downstream repo starts until the upstream repo's changes pass tests
|
|
107
|
+
|
|
108
|
+
For non-breaking changes, `@coder` and `@tester` for a given repo run in parallel. For breaking changes, `@tester` must verify the upstream before `@coder` starts on any downstream.
|
|
109
|
+
|
|
110
|
+
If a repo's `@coder` or `@tester` fails, that repo and all downstream repos in the dependency chain are paused. Upstream repos that completed are not rolled back — they remain deployed. The flow resumes once the failing repo is fixed.
|
|
111
|
+
|
|
112
|
+
### Step 5: Verify Integration
|
|
113
|
+
|
|
114
|
+
After all per-repo changes are complete, `@tester` and `@reviewer` run cross-repo verification:
|
|
115
|
+
|
|
116
|
+
**@tester (integration):**
|
|
117
|
+
```
|
|
118
|
+
Task: Run end-to-end integration tests covering the full change path
|
|
119
|
+
Scope: user-service → order-service interaction via the new preferences endpoint
|
|
120
|
+
Test environment: staging (all services deployed to stage)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**@reviewer (cross-repo review):**
|
|
124
|
+
```
|
|
125
|
+
Task: Review all changed files across all repos
|
|
126
|
+
Check: contract adherence, no breaking changes introduced unintentionally,
|
|
127
|
+
consistent error handling patterns across services
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Both run in parallel. Integration tests failing in stage block the production rollout for the entire change set.
|
|
131
|
+
|
|
132
|
+
## Rollout After Integration Pass
|
|
133
|
+
|
|
134
|
+
Once integration is verified in staging, deploy in dependency order:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
1. shared-types → publish to package registry (semver minor)
|
|
138
|
+
2. user-service → canary (5% traffic, 15 min) → stage ✅ → prod
|
|
139
|
+
3. order-service → canary (after user-service prod) → stage ✅ → prod
|
|
140
|
+
4. api-gateway → canary (after order-service prod) → stage ✅ → prod
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
No downstream service enters its canary phase until the upstream service is confirmed stable in production.
|
|
144
|
+
|
|
145
|
+
## Conflict Handling
|
|
146
|
+
|
|
147
|
+
If `@multi-repo-coordinator` detects a conflict during Step 2 or Step 3 (two concurrent changes that are incompatible), the flow pauses:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
FLOW PAUSED — Conflict Requires Resolution
|
|
151
|
+
|
|
152
|
+
Service A (user-service): removing `legacyUserId` from response
|
|
153
|
+
Service B (order-service PR #47): new consumer of `legacyUserId`
|
|
154
|
+
Classification: Breaking API collision
|
|
155
|
+
|
|
156
|
+
Resolution options:
|
|
157
|
+
A. Versioned endpoint: keep /v1/users (with legacyUserId) + add /v2/users (without)
|
|
158
|
+
B. Coordinate: block order-service PR #47 until user-service migration is complete
|
|
159
|
+
C. Reverse: defer the user-service removal until order-service removes its dependency
|
|
160
|
+
|
|
161
|
+
Owner teams: platform (user-service), commerce (order-service)
|
|
162
|
+
Decision required before this flow can continue.
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The flow does not auto-resolve conflicts. It surfaces them clearly, names the options, and waits for human direction.
|
|
166
|
+
|
|
167
|
+
## Error Handling
|
|
168
|
+
|
|
169
|
+
| Condition | Action |
|
|
170
|
+
|-----------|--------|
|
|
171
|
+
| Registry path not found on disk | Stop at Step 1; report which path failed |
|
|
172
|
+
| Circular dependency in graph | Stop at Step 2; show the cycle |
|
|
173
|
+
| Contract review rejected | Stop at Step 3; rework contract before proceeding |
|
|
174
|
+
| Repo's tests fail | Pause that repo and all dependents; upstream remains deployed |
|
|
175
|
+
| Integration test fails | Block production rollout; report which test failed and why |
|
|
176
|
+
| Conflict detected | Pause flow; surface options; wait for human decision |
|
|
177
|
+
|
|
54
178
|
## Config Format
|
|
55
179
|
|
|
56
180
|
`.planning/config.json` repos entry:
|
|
@@ -11,38 +11,181 @@ Implement a new feature using the full FlowDeck agent pipeline.
|
|
|
11
11
|
|
|
12
12
|
## Pre-flight
|
|
13
13
|
|
|
14
|
-
1. Check `.planning
|
|
14
|
+
1. Check `.planning/` exists — if not, error: "Run /fd-new-project first."
|
|
15
15
|
2. Check `plan_confirmed: true` in STATE.md — if not, error: "Confirm plan first with /fd-plan."
|
|
16
16
|
3. Read `.planning/phases/phase-<N>/PLAN.md` to get implementation steps.
|
|
17
17
|
4. Read `.codebase/ARCHITECTURE.md` if it exists — pass as context.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## TDD Cycle Per Step
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Each plan step follows the TDD cycle:
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
```
|
|
24
|
+
BEHAVIOR → RED → GREEN → REFACTOR → next step
|
|
25
|
+
↑_________| |
|
|
26
|
+
(loop if needed) Only if GREEN
|
|
27
|
+
```
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
- **@coder**: Implement the feature following PLAN.md steps, CONVENTIONS.md patterns, and TDD discipline
|
|
29
|
-
- Write failing tests FIRST (RED)
|
|
30
|
-
- Implement minimum code to pass (GREEN)
|
|
31
|
-
- Refactor if needed (REFACTOR)
|
|
29
|
+
## Process
|
|
32
30
|
|
|
33
|
-
###
|
|
34
|
-
- **@tester**: Run test suite, verify new tests pass, check coverage
|
|
35
|
-
- **@reviewer**: Review implementation for quality, security, and convention compliance
|
|
31
|
+
### Step 1: Guard Check
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
33
|
+
Verify prerequisites:
|
|
34
|
+
- `.planning/` directory exists
|
|
35
|
+
- `.codebase/` directory exists
|
|
36
|
+
- `STATE.md` has `plan_confirmed: true`
|
|
37
|
+
- `PLAN.md` exists in current phase directory
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
Initialize TDD state:
|
|
40
|
+
```yaml
|
|
41
|
+
tdd:
|
|
42
|
+
stage: behavior
|
|
43
|
+
cycle: 1
|
|
44
|
+
behaviors: []
|
|
45
|
+
regression_test_links: []
|
|
46
|
+
```
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
### Step 2: Load Plan
|
|
49
|
+
|
|
50
|
+
Read the active PLAN.md from the current phase directory.
|
|
51
|
+
Parse the tasks list and identify which steps are complete.
|
|
52
|
+
|
|
53
|
+
### Step 3: Define Behaviors
|
|
54
|
+
|
|
55
|
+
Spawn `@orchestrator` to generate behavior checklist from PLAN.md:
|
|
56
|
+
- Acceptance cases for each step
|
|
57
|
+
- Edge cases to test
|
|
58
|
+
- Expected behaviors
|
|
59
|
+
|
|
60
|
+
Store in TDD state.
|
|
61
|
+
|
|
62
|
+
### Step 4: Identify Next Step
|
|
63
|
+
|
|
64
|
+
From PLAN.md, find the first step NOT in `steps_complete`.
|
|
65
|
+
Check TDD stage — only proceed if stage is appropriate for the step.
|
|
66
|
+
|
|
67
|
+
### Step 5: Write Failing Tests (RED)
|
|
68
|
+
|
|
69
|
+
Spawn `@tester` to write tests for the step's behavior:
|
|
70
|
+
- **Tests MUST fail** before implementation
|
|
71
|
+
- Cover acceptance cases and edge cases
|
|
72
|
+
- Use AAA pattern (Arrange-Act-Assert)
|
|
73
|
+
|
|
74
|
+
### Step 6: Confirm RED
|
|
75
|
+
|
|
76
|
+
Run failing tests:
|
|
77
|
+
- **GUARD: Do NOT proceed to Step 7 until tests fail**
|
|
78
|
+
- If tests pass unexpectedly, tests don't correctly describe behavior
|
|
79
|
+
|
|
80
|
+
### Step 7: Implement Minimum (GREEN)
|
|
81
|
+
|
|
82
|
+
Spawn `@coder` to implement:
|
|
83
|
+
- **Minimum code** to make failing tests pass
|
|
84
|
+
- No speculative features
|
|
85
|
+
- No over-engineering
|
|
86
|
+
|
|
87
|
+
### Step 8: Confirm GREEN
|
|
88
|
+
|
|
89
|
+
Run tests:
|
|
90
|
+
- **GUARD: Do NOT proceed to Step 9 until tests pass**
|
|
91
|
+
- If tests fail, return to Step 7
|
|
92
|
+
|
|
93
|
+
### Step 9: Refactor (REFACTOR)
|
|
94
|
+
|
|
95
|
+
Only if GREEN:
|
|
96
|
+
- Clean up code for this step
|
|
97
|
+
- Remove dead code
|
|
98
|
+
- Improve readability
|
|
99
|
+
- **GUARD: Do not refactor if not GREEN**
|
|
100
|
+
|
|
101
|
+
### Step 10: Verify
|
|
102
|
+
|
|
103
|
+
Run full test suite:
|
|
104
|
+
- All tests must pass
|
|
105
|
+
- If any fails, revert refactoring
|
|
106
|
+
|
|
107
|
+
### Step 11: Review Step
|
|
108
|
+
|
|
109
|
+
Spawn `@reviewer` to check:
|
|
110
|
+
- Code quality, security, conventions
|
|
111
|
+
- TDD discipline followed
|
|
112
|
+
- Test coverage >= 80%
|
|
113
|
+
- No missing or weak tests (flag as major finding)
|
|
114
|
+
|
|
115
|
+
### Step 12: Update State
|
|
116
|
+
|
|
117
|
+
Mark step complete via planning-state tool:
|
|
118
|
+
```yaml
|
|
119
|
+
steps_complete: [N, ...]
|
|
120
|
+
last_action: "Step N complete via TDD: [behavior]"
|
|
121
|
+
tdd:
|
|
122
|
+
stage: behavior # Ready for next step
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Step 13: Loop or Complete
|
|
126
|
+
|
|
127
|
+
If more steps pending:
|
|
128
|
+
- Return to Step 3 (define behaviors for next step)
|
|
129
|
+
|
|
130
|
+
If all steps complete:
|
|
131
|
+
- Update phase status to "complete"
|
|
132
|
+
- Update ROADMAP.md progress
|
|
133
|
+
- Present completion summary
|
|
134
|
+
|
|
135
|
+
## Wave-Based Execution
|
|
136
|
+
|
|
137
|
+
WF-03 respects wave structure from PLAN.md:
|
|
138
|
+
- Wave 1 steps execute first (with TDD cycle per step)
|
|
139
|
+
- Wave 2 steps execute after Wave 1 completes
|
|
140
|
+
- Wave 3 steps execute after Wave 2 completes
|
|
141
|
+
- No intra-wave dependencies (parallel execution)
|
|
142
|
+
|
|
143
|
+
## Guards Summary
|
|
144
|
+
|
|
145
|
+
| Transition | Guard | If Violated |
|
|
146
|
+
|-----------|-------|-------------|
|
|
147
|
+
| behavior → red | Test written and fails | Block until test fails |
|
|
148
|
+
| red → green | Test exists and fails | Block until test passes |
|
|
149
|
+
| green → refactor | Tests are green | Block until green |
|
|
150
|
+
| refactor → verify | All tests pass | Block until all pass |
|
|
151
|
+
|
|
152
|
+
## Override Mechanism
|
|
153
|
+
|
|
154
|
+
User can override with `/fd-new-feature --override`:
|
|
155
|
+
- Every override is logged in `override_log`
|
|
156
|
+
- Surface override in next review
|
|
157
|
+
- Flag in deploy check
|
|
158
|
+
|
|
159
|
+
## Error Handling
|
|
160
|
+
|
|
161
|
+
D-03: Fail fast with clear error
|
|
162
|
+
- If guard check fails: abort with clear error and remediation
|
|
163
|
+
- If @coder fails: report failure, offer retry or skip
|
|
164
|
+
- If @reviewer finds critical issues: return to Step 7 for fixes
|
|
165
|
+
- No partial state saved on error
|
|
166
|
+
|
|
167
|
+
## State Updates
|
|
168
|
+
|
|
169
|
+
STATE.md updates after each step:
|
|
170
|
+
```yaml
|
|
171
|
+
steps_complete: [1, 2] # Added after step 2
|
|
172
|
+
steps_pending: [3, 4, 5] # Removed step 2
|
|
173
|
+
last_action: "Step 2 TDD complete: [behavior] (RED→GREEN→REFACTOR)"
|
|
174
|
+
tdd:
|
|
175
|
+
stage: behavior
|
|
176
|
+
cycle: 2
|
|
177
|
+
behaviors_completed: 2
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Full phase completion:
|
|
181
|
+
```yaml
|
|
182
|
+
status: complete
|
|
183
|
+
last_action: "Phase N TDD complete — all steps finished"
|
|
184
|
+
tdd:
|
|
185
|
+
stage: complete
|
|
186
|
+
cycles_used: N
|
|
187
|
+
behaviors_completed: M
|
|
188
|
+
```
|
|
46
189
|
|
|
47
190
|
## Completion
|
|
48
191
|
|