agileflow 3.2.1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +6 -6
- package/lib/feature-flags.js +32 -4
- package/lib/skill-loader.js +0 -1
- package/package.json +1 -1
- package/scripts/agileflow-statusline.sh +81 -0
- package/scripts/babysit-clear-restore.js +154 -0
- package/scripts/claude-tmux.sh +120 -24
- package/scripts/claude-watchdog.sh +225 -0
- package/scripts/generators/agent-registry.js +14 -1
- package/scripts/generators/inject-babysit.js +22 -9
- package/scripts/generators/inject-help.js +19 -9
- package/scripts/lib/README-portable-tasks.md +424 -0
- package/scripts/lib/audit-cleanup.js +250 -0
- package/scripts/lib/audit-registry.js +248 -0
- package/scripts/lib/configure-detect.js +20 -0
- package/scripts/lib/feature-catalog.js +13 -2
- package/scripts/lib/gate-enforcer.js +295 -0
- package/scripts/lib/model-profiles.js +98 -0
- package/scripts/lib/signal-detectors.js +1 -1
- package/scripts/lib/skill-catalog.js +557 -0
- package/scripts/lib/skill-recommender.js +311 -0
- package/scripts/lib/tdd-phase-manager.js +455 -0
- package/scripts/lib/team-events.js +76 -8
- package/scripts/lib/tmux-group-colors.js +113 -0
- package/scripts/messaging-bridge.js +209 -1
- package/scripts/spawn-audit-sessions.js +549 -0
- package/scripts/team-manager.js +37 -16
- package/scripts/tmux-close-windows.sh +180 -0
- package/scripts/tmux-restore-window.sh +67 -0
- package/scripts/tmux-save-closed-window.sh +35 -0
- package/src/core/agents/ads-audit-budget.md +181 -0
- package/src/core/agents/ads-audit-compliance.md +169 -0
- package/src/core/agents/ads-audit-creative.md +164 -0
- package/src/core/agents/ads-audit-google.md +226 -0
- package/src/core/agents/ads-audit-meta.md +183 -0
- package/src/core/agents/ads-audit-tracking.md +197 -0
- package/src/core/agents/ads-consensus.md +322 -0
- package/src/core/agents/brainstorm-analyzer-features.md +169 -0
- package/src/core/agents/brainstorm-analyzer-growth.md +161 -0
- package/src/core/agents/brainstorm-analyzer-integration.md +172 -0
- package/src/core/agents/brainstorm-analyzer-market.md +147 -0
- package/src/core/agents/brainstorm-analyzer-ux.md +167 -0
- package/src/core/agents/brainstorm-consensus.md +237 -0
- package/src/core/agents/completeness-analyzer-api.md +190 -0
- package/src/core/agents/completeness-analyzer-conditional.md +201 -0
- package/src/core/agents/completeness-analyzer-handlers.md +159 -0
- package/src/core/agents/completeness-analyzer-imports.md +159 -0
- package/src/core/agents/completeness-analyzer-routes.md +182 -0
- package/src/core/agents/completeness-analyzer-state.md +188 -0
- package/src/core/agents/completeness-analyzer-stubs.md +198 -0
- package/src/core/agents/completeness-consensus.md +286 -0
- package/src/core/agents/perf-consensus.md +2 -2
- package/src/core/agents/security-consensus.md +2 -2
- package/src/core/agents/seo-analyzer-content.md +167 -0
- package/src/core/agents/seo-analyzer-images.md +187 -0
- package/src/core/agents/seo-analyzer-performance.md +206 -0
- package/src/core/agents/seo-analyzer-schema.md +176 -0
- package/src/core/agents/seo-analyzer-sitemap.md +172 -0
- package/src/core/agents/seo-analyzer-technical.md +144 -0
- package/src/core/agents/seo-consensus.md +289 -0
- package/src/core/agents/test-consensus.md +2 -2
- package/src/core/commands/ads/audit.md +375 -0
- package/src/core/commands/ads/budget.md +97 -0
- package/src/core/commands/ads/competitor.md +112 -0
- package/src/core/commands/ads/creative.md +85 -0
- package/src/core/commands/ads/google.md +112 -0
- package/src/core/commands/ads/landing.md +119 -0
- package/src/core/commands/ads/linkedin.md +112 -0
- package/src/core/commands/ads/meta.md +91 -0
- package/src/core/commands/ads/microsoft.md +115 -0
- package/src/core/commands/ads/plan.md +321 -0
- package/src/core/commands/ads/tiktok.md +129 -0
- package/src/core/commands/ads/youtube.md +124 -0
- package/src/core/commands/ads.md +128 -0
- package/src/core/commands/babysit.md +250 -1344
- package/src/core/commands/code/completeness.md +466 -0
- package/src/core/commands/{audit → code}/legal.md +26 -16
- package/src/core/commands/{audit → code}/logic.md +27 -16
- package/src/core/commands/{audit → code}/performance.md +30 -20
- package/src/core/commands/{audit → code}/security.md +32 -19
- package/src/core/commands/{audit → code}/test.md +30 -20
- package/src/core/commands/{discovery → ideate}/brief.md +12 -12
- package/src/core/commands/{discovery/new.md → ideate/discover.md} +13 -13
- package/src/core/commands/ideate/features.md +435 -0
- package/src/core/commands/seo/audit.md +373 -0
- package/src/core/commands/seo/competitor.md +174 -0
- package/src/core/commands/seo/content.md +107 -0
- package/src/core/commands/seo/geo.md +229 -0
- package/src/core/commands/seo/hreflang.md +140 -0
- package/src/core/commands/seo/images.md +96 -0
- package/src/core/commands/seo/page.md +198 -0
- package/src/core/commands/seo/plan.md +163 -0
- package/src/core/commands/seo/programmatic.md +131 -0
- package/src/core/commands/seo/references/cwv-thresholds.md +64 -0
- package/src/core/commands/seo/references/eeat-framework.md +110 -0
- package/src/core/commands/seo/references/quality-gates.md +91 -0
- package/src/core/commands/seo/references/schema-types.md +102 -0
- package/src/core/commands/seo/schema.md +183 -0
- package/src/core/commands/seo/sitemap.md +97 -0
- package/src/core/commands/seo/technical.md +100 -0
- package/src/core/commands/seo.md +107 -0
- package/src/core/commands/skill/list.md +68 -212
- package/src/core/commands/skill/recommend.md +216 -0
- package/src/core/commands/tdd-next.md +238 -0
- package/src/core/commands/tdd.md +210 -0
- package/src/core/experts/_core-expertise.yaml +105 -0
- package/src/core/experts/analytics/expertise.yaml +5 -99
- package/src/core/experts/codebase-query/expertise.yaml +3 -72
- package/src/core/experts/compliance/expertise.yaml +6 -72
- package/src/core/experts/database/expertise.yaml +9 -52
- package/src/core/experts/documentation/expertise.yaml +7 -140
- package/src/core/experts/integrations/expertise.yaml +7 -127
- package/src/core/experts/mentor/expertise.yaml +8 -35
- package/src/core/experts/monitoring/expertise.yaml +7 -49
- package/src/core/experts/performance/expertise.yaml +1 -26
- package/src/core/experts/security/expertise.yaml +9 -34
- package/src/core/experts/ui/expertise.yaml +6 -36
- package/src/core/knowledge/ads/ad-audit-checklist-scoring.md +424 -0
- package/src/core/knowledge/ads/ad-optimization-logic.md +590 -0
- package/src/core/knowledge/ads/ad-technical-specifications.md +385 -0
- package/src/core/knowledge/ads/definitive-advertising-reference-2026.md +506 -0
- package/src/core/knowledge/ads/paid-advertising-research-2026.md +445 -0
- package/src/core/templates/agileflow-metadata.json +15 -1
- package/tools/cli/installers/ide/_base-ide.js +42 -5
- package/tools/cli/installers/ide/claude-code.js +13 -4
- package/tools/cli/lib/content-injector.js +160 -12
- package/tools/cli/lib/docs-setup.js +1 -1
- package/src/core/commands/skill/create.md +0 -698
- package/src/core/commands/skill/delete.md +0 -316
- package/src/core/commands/skill/edit.md +0 -359
- package/src/core/commands/skill/test.md +0 -394
- package/src/core/commands/skill/upgrade.md +0 -552
- package/src/core/templates/skill-template.md +0 -117
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Advance TDD phase (RED→GREEN→REFACTOR→COMPLETE)
|
|
3
|
+
argument-hint: "[<US-ID>]"
|
|
4
|
+
compact_context:
|
|
5
|
+
priority: high
|
|
6
|
+
preserve_rules:
|
|
7
|
+
- "TDD phase gate: RED→GREEN requires test_status=failing"
|
|
8
|
+
- "TDD phase gate: GREEN→REFACTOR requires test_status=passing"
|
|
9
|
+
- "TDD phase gate: REFACTOR→COMPLETE requires test_status=passing"
|
|
10
|
+
- "Always run /agileflow:verify before attempting phase advance"
|
|
11
|
+
- "Show clear phase transition banner with new phase instructions"
|
|
12
|
+
state_fields:
|
|
13
|
+
- tdd_phase
|
|
14
|
+
- test_status
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# /agileflow:tdd-next - Advance TDD Phase
|
|
18
|
+
|
|
19
|
+
Advance to the next TDD phase with gate validation.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## STEP 0: Gather Context
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
node .agileflow/scripts/obtain-context.js tdd-next
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<!-- COMPACT_SUMMARY_START -->
|
|
32
|
+
|
|
33
|
+
## Compact Summary
|
|
34
|
+
|
|
35
|
+
**Role**: TDD Phase Gate Controller
|
|
36
|
+
|
|
37
|
+
**Critical Rules**:
|
|
38
|
+
1. Read current `tdd_phase` and `test_status` from status.json
|
|
39
|
+
2. Validate transition conditions (failing/passing tests)
|
|
40
|
+
3. Block advancement if conditions not met
|
|
41
|
+
4. Update `tdd_phase` in status.json on success
|
|
42
|
+
5. Display new phase instructions
|
|
43
|
+
|
|
44
|
+
**Transitions**:
|
|
45
|
+
- RED → GREEN: `test_status` must be `"failing"`
|
|
46
|
+
- GREEN → REFACTOR: `test_status` must be `"passing"`
|
|
47
|
+
- REFACTOR → RED (new cycle): `test_status` must be `"passing"`
|
|
48
|
+
- REFACTOR → COMPLETE: `test_status` must be `"passing"`
|
|
49
|
+
|
|
50
|
+
<!-- COMPACT_SUMMARY_END -->
|
|
51
|
+
|
|
52
|
+
## Prompt
|
|
53
|
+
|
|
54
|
+
ROLE: TDD Phase Gate Controller
|
|
55
|
+
|
|
56
|
+
INPUTS
|
|
57
|
+
STORY=<US-ID> Optional - defaults to current in_progress story with active tdd_phase
|
|
58
|
+
|
|
59
|
+
ACTIONS
|
|
60
|
+
1) Load story and current TDD phase from status.json
|
|
61
|
+
2) Determine target phase based on current phase
|
|
62
|
+
3) Validate gate conditions (test_status)
|
|
63
|
+
4) If gate passes: advance phase, show new instructions
|
|
64
|
+
5) If gate fails: show blocking message with remedy
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
/agileflow:tdd-next # Advance current TDD story
|
|
72
|
+
/agileflow:tdd-next US-0042 # Advance specific story
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Workflow
|
|
76
|
+
|
|
77
|
+
### 1. Find Active TDD Story
|
|
78
|
+
|
|
79
|
+
Read `docs/09-agents/status.json`. Find the story:
|
|
80
|
+
- If STORY specified, use that
|
|
81
|
+
- Otherwise, find the story with an active `tdd_phase` (not complete/cancelled)
|
|
82
|
+
- If multiple active, ask user to specify
|
|
83
|
+
|
|
84
|
+
### 2. Determine Target Phase
|
|
85
|
+
|
|
86
|
+
Based on current phase, determine what to advance to:
|
|
87
|
+
|
|
88
|
+
| Current | Default Next | Alternative |
|
|
89
|
+
|---------|-------------|-------------|
|
|
90
|
+
| RED | GREEN | cancel |
|
|
91
|
+
| GREEN | REFACTOR | cancel |
|
|
92
|
+
| REFACTOR | COMPLETE | RED (new cycle), cancel |
|
|
93
|
+
|
|
94
|
+
For REFACTOR, ask the user:
|
|
95
|
+
```json
|
|
96
|
+
[
|
|
97
|
+
{"label": "Complete TDD (Recommended)", "description": "All tests pass, code is clean - ready for review"},
|
|
98
|
+
{"label": "Start new RED→GREEN cycle", "description": "More features to add with TDD discipline"},
|
|
99
|
+
{"label": "Cancel TDD", "description": "Exit TDD workflow, keep changes"}
|
|
100
|
+
]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 3. Validate Gate Conditions
|
|
104
|
+
|
|
105
|
+
Check `test_status` in the story against transition requirements:
|
|
106
|
+
|
|
107
|
+
**RED → GREEN** (needs `test_status: "failing"`):
|
|
108
|
+
```
|
|
109
|
+
Current: 🔴 RED phase
|
|
110
|
+
Target: 🟢 GREEN phase
|
|
111
|
+
Gate: test_status must be "failing"
|
|
112
|
+
Status: test_status = "failing" ✅
|
|
113
|
+
|
|
114
|
+
Advancing to GREEN phase...
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Gate BLOCKED example:**
|
|
118
|
+
```
|
|
119
|
+
Current: 🔴 RED phase
|
|
120
|
+
Target: 🟢 GREEN phase
|
|
121
|
+
Gate: test_status must be "failing"
|
|
122
|
+
Status: test_status = "passing" ❌
|
|
123
|
+
|
|
124
|
+
🚫 Cannot advance: Tests must FAIL before moving to GREEN.
|
|
125
|
+
|
|
126
|
+
This means either:
|
|
127
|
+
1. You haven't written tests yet (write failing tests first)
|
|
128
|
+
2. Your tests pass because they don't test real behavior
|
|
129
|
+
3. The implementation already exists
|
|
130
|
+
|
|
131
|
+
Action: Write tests that verify behavior not yet implemented.
|
|
132
|
+
Then run /agileflow:verify to confirm they fail.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**No test_status at all:**
|
|
136
|
+
```
|
|
137
|
+
🚫 Cannot advance: No test results found.
|
|
138
|
+
|
|
139
|
+
Run /agileflow:verify first to execute tests and record status.
|
|
140
|
+
Then try /agileflow:tdd-next again.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 4. Advance Phase
|
|
144
|
+
|
|
145
|
+
On success, update status.json:
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"tdd_phase": "green",
|
|
149
|
+
"tdd_last_transition": "2026-02-25T..."
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 5. Display New Phase Banner
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
🟢 TDD GREEN PHASE - US-0042: [Story Title]
|
|
157
|
+
══════════════════════════════════════════
|
|
158
|
+
|
|
159
|
+
RED → GREEN transition complete! ✅
|
|
160
|
+
|
|
161
|
+
Write MINIMAL code to make tests pass. Rules:
|
|
162
|
+
• Write the simplest implementation that passes tests
|
|
163
|
+
• Do NOT refactor yet - ugly code is fine
|
|
164
|
+
• Do NOT add features beyond what tests require
|
|
165
|
+
• Do NOT modify test files (except removing .skip())
|
|
166
|
+
• Run tests frequently
|
|
167
|
+
|
|
168
|
+
Next steps:
|
|
169
|
+
1. Implement code to pass the failing tests
|
|
170
|
+
2. Run /agileflow:verify to confirm tests PASS
|
|
171
|
+
3. Run /agileflow:tdd-next to advance to REFACTOR
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 6. AskUserQuestion
|
|
175
|
+
|
|
176
|
+
After showing the transition result:
|
|
177
|
+
|
|
178
|
+
**Successful advance to GREEN:**
|
|
179
|
+
```json
|
|
180
|
+
[
|
|
181
|
+
{"label": "Start implementing to pass tests (Recommended)", "description": "Write minimal code - tests define the requirements"},
|
|
182
|
+
{"label": "Review the failing tests first", "description": "Read test files to understand requirements"},
|
|
183
|
+
{"label": "Cancel TDD mode", "description": "Exit TDD workflow, keep test files"}
|
|
184
|
+
]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Successful advance to REFACTOR:**
|
|
188
|
+
```json
|
|
189
|
+
[
|
|
190
|
+
{"label": "Start refactoring (Recommended)", "description": "Tests pass - clean up the code while keeping them green"},
|
|
191
|
+
{"label": "Run logic audit on implementation", "description": "Check for edge cases before refactoring"},
|
|
192
|
+
{"label": "Skip refactor, complete TDD", "description": "Code is clean enough - finish TDD cycle"}
|
|
193
|
+
]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Successful COMPLETE:**
|
|
197
|
+
```json
|
|
198
|
+
[
|
|
199
|
+
{"label": "Run code review (Recommended)", "description": "TDD complete - review before committing"},
|
|
200
|
+
{"label": "Commit changes", "description": "All tests pass, TDD cycle done"},
|
|
201
|
+
{"label": "Start new TDD cycle", "description": "More features to implement for this story"}
|
|
202
|
+
]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Gate blocked:**
|
|
206
|
+
```json
|
|
207
|
+
[
|
|
208
|
+
{"label": "Run /agileflow:verify (Recommended)", "description": "Execute tests to update test_status"},
|
|
209
|
+
{"label": "Review test files", "description": "Check if tests are correctly written"},
|
|
210
|
+
{"label": "Cancel TDD mode", "description": "Exit TDD workflow"}
|
|
211
|
+
]
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Error Handling
|
|
215
|
+
|
|
216
|
+
### No Active TDD Story
|
|
217
|
+
```
|
|
218
|
+
❌ No active TDD workflow found.
|
|
219
|
+
|
|
220
|
+
Start TDD with: /agileflow:tdd US-0042
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Multiple Active TDD Stories
|
|
224
|
+
```
|
|
225
|
+
⚠️ Multiple active TDD stories found:
|
|
226
|
+
🔴 US-0042: Add auth middleware (RED phase)
|
|
227
|
+
🟢 US-0043: User settings API (GREEN phase)
|
|
228
|
+
|
|
229
|
+
Specify which story: /agileflow:tdd-next US-0042
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Related Commands
|
|
235
|
+
|
|
236
|
+
- `/agileflow:tdd` - Start TDD workflow
|
|
237
|
+
- `/agileflow:verify` - Run tests and update test_status
|
|
238
|
+
- `/agileflow:babysit` - Main implementation workflow
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Start TDD workflow with RED→GREEN→REFACTOR phases
|
|
3
|
+
argument-hint: "<US-ID>"
|
|
4
|
+
compact_context:
|
|
5
|
+
priority: high
|
|
6
|
+
preserve_rules:
|
|
7
|
+
- "TDD WORKFLOW ACTIVE: Enforce RED→GREEN→REFACTOR phases"
|
|
8
|
+
- "RED phase: Write failing tests ONLY - no implementation code"
|
|
9
|
+
- "GREEN phase: Minimal code to make tests pass - no extras"
|
|
10
|
+
- "REFACTOR phase: Clean up while keeping tests green"
|
|
11
|
+
- "Use /agileflow:verify to confirm test status before advancing"
|
|
12
|
+
- "Use /agileflow:tdd-next to advance to next phase"
|
|
13
|
+
- "Phase gates are HARD - cannot skip (RED needs failing tests, GREEN needs passing)"
|
|
14
|
+
state_fields:
|
|
15
|
+
- tdd_phase
|
|
16
|
+
- tdd_cycles
|
|
17
|
+
- test_status
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# /agileflow:tdd - Test-Driven Development Workflow
|
|
21
|
+
|
|
22
|
+
Start a TDD workflow for a story, enforcing RED→GREEN→REFACTOR phase discipline.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## STEP 0: Gather Context
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
node .agileflow/scripts/obtain-context.js tdd
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<!-- COMPACT_SUMMARY_START -->
|
|
35
|
+
|
|
36
|
+
## Compact Summary
|
|
37
|
+
|
|
38
|
+
**Role**: TDD Coach - Enforce test-first development with phase gates
|
|
39
|
+
|
|
40
|
+
**Critical Rules**:
|
|
41
|
+
1. Start in RED phase - write failing tests first
|
|
42
|
+
2. Cannot advance to GREEN without failing tests (verified by /agileflow:verify)
|
|
43
|
+
3. Cannot advance to REFACTOR without passing tests
|
|
44
|
+
4. Cannot complete without passing tests after refactor
|
|
45
|
+
5. Track phase in status.json story entry (`tdd_phase` field)
|
|
46
|
+
|
|
47
|
+
**Phase Summary**:
|
|
48
|
+
- 🔴 RED: Write tests that FAIL (test what the code SHOULD do)
|
|
49
|
+
- 🟢 GREEN: Write MINIMAL code to make tests PASS
|
|
50
|
+
- 🔵 REFACTOR: Clean up while keeping tests GREEN
|
|
51
|
+
- ✅ COMPLETE: All tests pass, code is clean
|
|
52
|
+
|
|
53
|
+
<!-- COMPACT_SUMMARY_END -->
|
|
54
|
+
|
|
55
|
+
## Prompt
|
|
56
|
+
|
|
57
|
+
ROLE: TDD Coach
|
|
58
|
+
|
|
59
|
+
INPUTS
|
|
60
|
+
STORY=<US-ID> Required - story to start TDD for
|
|
61
|
+
|
|
62
|
+
ACTIONS
|
|
63
|
+
1) Load story from status.json
|
|
64
|
+
2) Initialize TDD RED phase for the story
|
|
65
|
+
3) Display phase instructions and constraints
|
|
66
|
+
4) Guide user through test-first development
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
/agileflow:tdd US-0042
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Workflow
|
|
77
|
+
|
|
78
|
+
### 1. Initialize
|
|
79
|
+
|
|
80
|
+
Read `docs/09-agents/status.json` and locate the story. Set:
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"tdd_phase": "red",
|
|
84
|
+
"tdd_started_at": "2026-02-25T...",
|
|
85
|
+
"tdd_cycles": 1
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
If the story already has an active `tdd_phase` (not complete/cancelled), resume it instead.
|
|
90
|
+
|
|
91
|
+
### 2. Display Phase Banner
|
|
92
|
+
|
|
93
|
+
Show the current phase prominently:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
🔴 TDD RED PHASE - US-0042: [Story Title]
|
|
97
|
+
══════════════════════════════════════════
|
|
98
|
+
|
|
99
|
+
Write FAILING tests first. Rules:
|
|
100
|
+
• Write test files ONLY - no implementation code yet
|
|
101
|
+
• Tests should cover the acceptance criteria
|
|
102
|
+
• Tests MUST fail when run (they test code that doesn't exist)
|
|
103
|
+
• Focus on the public API - what should the code DO?
|
|
104
|
+
|
|
105
|
+
Allowed files: **/*.test.*, **/*.spec.*, **/tests/**, **/fixtures/**
|
|
106
|
+
|
|
107
|
+
Next steps:
|
|
108
|
+
1. Write your failing tests
|
|
109
|
+
2. Run /agileflow:verify to confirm tests FAIL
|
|
110
|
+
3. Run /agileflow:tdd-next to advance to GREEN
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 3. Phase-Specific Guidance
|
|
114
|
+
|
|
115
|
+
#### 🔴 RED Phase
|
|
116
|
+
- Help user identify WHAT to test based on acceptance criteria
|
|
117
|
+
- Suggest test file names and locations based on project conventions
|
|
118
|
+
- Write test code that exercises the expected API/interface
|
|
119
|
+
- Tests should be meaningful - not just `expect(true).toBe(false)`
|
|
120
|
+
- Use the project's testing framework (detect from package.json, pytest.ini, etc.)
|
|
121
|
+
|
|
122
|
+
#### 🟢 GREEN Phase (after /agileflow:tdd-next)
|
|
123
|
+
- Write the simplest possible implementation to pass tests
|
|
124
|
+
- Resist the urge to over-engineer or optimize
|
|
125
|
+
- If a test needs a complex solution, the test may be too broad
|
|
126
|
+
- Run tests frequently during implementation
|
|
127
|
+
|
|
128
|
+
#### 🔵 REFACTOR Phase (after /agileflow:tdd-next)
|
|
129
|
+
- Extract common patterns into helper functions
|
|
130
|
+
- Improve naming and readability
|
|
131
|
+
- Reduce duplication
|
|
132
|
+
- Run tests after every change - any failure means rollback
|
|
133
|
+
|
|
134
|
+
### 4. AskUserQuestion Integration
|
|
135
|
+
|
|
136
|
+
After showing the phase banner, present smart options:
|
|
137
|
+
|
|
138
|
+
**RED phase start:**
|
|
139
|
+
```json
|
|
140
|
+
[
|
|
141
|
+
{"label": "Show acceptance criteria for test planning (Recommended)", "description": "Review AC to identify what tests to write"},
|
|
142
|
+
{"label": "Create test file scaffold", "description": "Generate test file structure based on story requirements"},
|
|
143
|
+
{"label": "Cancel TDD mode", "description": "Exit TDD and use standard implementation workflow"}
|
|
144
|
+
]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**After tests written (RED):**
|
|
148
|
+
```json
|
|
149
|
+
[
|
|
150
|
+
{"label": "Run /agileflow:verify to check tests fail (Recommended)", "description": "Tests must fail before advancing to GREEN"},
|
|
151
|
+
{"label": "Write more tests", "description": "Add additional test cases"},
|
|
152
|
+
{"label": "Cancel TDD mode", "description": "Exit TDD workflow"}
|
|
153
|
+
]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**After verify confirms failing (RED→GREEN):**
|
|
157
|
+
```json
|
|
158
|
+
[
|
|
159
|
+
{"label": "Advance to GREEN phase (Recommended)", "description": "Tests are failing - ready to write implementation"},
|
|
160
|
+
{"label": "Write more failing tests first", "description": "Add more test coverage before implementing"},
|
|
161
|
+
{"label": "Cancel TDD mode", "description": "Exit TDD workflow"}
|
|
162
|
+
]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Integration Points
|
|
166
|
+
|
|
167
|
+
### Uses
|
|
168
|
+
- `docs/09-agents/status.json` - Story data and TDD phase tracking
|
|
169
|
+
- `/agileflow:verify` - Test execution and status updates
|
|
170
|
+
- `/agileflow:tdd-next` - Phase advancement
|
|
171
|
+
|
|
172
|
+
### Used By
|
|
173
|
+
- `/agileflow:babysit` - Can suggest TDD workflow for stories
|
|
174
|
+
- `/agileflow:babysit STRICT=true` - TDD recommended as default approach
|
|
175
|
+
|
|
176
|
+
## Error Handling
|
|
177
|
+
|
|
178
|
+
### Story Not Found
|
|
179
|
+
```
|
|
180
|
+
❌ Story US-0099 not found in status.json
|
|
181
|
+
|
|
182
|
+
Available stories:
|
|
183
|
+
- US-0042: Add user authentication (ready)
|
|
184
|
+
- US-0043: Implement settings page (in_progress)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Already in TDD
|
|
188
|
+
```
|
|
189
|
+
🔴 Resuming TDD for US-0042 (RED phase, cycle 1)
|
|
190
|
+
|
|
191
|
+
You're already in TDD mode. Current phase: RED
|
|
192
|
+
Write failing tests, then run /agileflow:tdd-next to advance.
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### No Test Framework Detected
|
|
196
|
+
```
|
|
197
|
+
⚠️ No test framework detected for this project.
|
|
198
|
+
|
|
199
|
+
Run /agileflow:tests first to set up testing infrastructure,
|
|
200
|
+
then restart TDD with /agileflow:tdd US-0042.
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Related Commands
|
|
206
|
+
|
|
207
|
+
- `/agileflow:tdd-next` - Advance TDD phase (RED→GREEN→REFACTOR→COMPLETE)
|
|
208
|
+
- `/agileflow:verify` - Run tests and update test_status
|
|
209
|
+
- `/agileflow:tests` - Set up testing infrastructure
|
|
210
|
+
- `/agileflow:babysit` - Main implementation workflow (can integrate TDD)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Core Expertise - Always-Loaded AgileFlow Knowledge
|
|
2
|
+
# These 3 curated modules contain high-value cross-cutting patterns.
|
|
3
|
+
# Loaded by all agents. Domain-specific files are reference-only (loaded on demand).
|
|
4
|
+
|
|
5
|
+
version: 1.0
|
|
6
|
+
last_updated: 2026-02-26
|
|
7
|
+
|
|
8
|
+
# Module 1: CLI Architecture Patterns
|
|
9
|
+
cli_architecture:
|
|
10
|
+
structure:
|
|
11
|
+
source: packages/cli/src/core/
|
|
12
|
+
commands: "src/core/commands/*.md - Slash commands with frontmatter"
|
|
13
|
+
agents: "src/core/agents/*.md - Spawnable agents with frontmatter"
|
|
14
|
+
experts: "src/core/experts/*/expertise.yaml - Domain knowledge"
|
|
15
|
+
skills: "src/core/skills/ - Skill learnings and marketplace (browse via /skill:recommend)"
|
|
16
|
+
|
|
17
|
+
content_injection:
|
|
18
|
+
description: "Source files use placeholders replaced at install time"
|
|
19
|
+
placeholders:
|
|
20
|
+
- "<!-- {{AGENT_LIST}} --> - Current agent list"
|
|
21
|
+
- "<!-- {{COMMAND_LIST}} --> - Current command list"
|
|
22
|
+
- "<!-- {{SKILL_LIST}} --> - Current skill list"
|
|
23
|
+
pipeline: "content-injector.js -> content-transformer.js -> IDE installer"
|
|
24
|
+
|
|
25
|
+
installers:
|
|
26
|
+
core: "tools/cli/installers/core/installer.js - Copies agents, commands, scripts"
|
|
27
|
+
ide_base: "tools/cli/installers/ide/_base-ide.js - Shared IDE setup logic"
|
|
28
|
+
claude_code: "tools/cli/installers/ide/claude-code.js - Claude Code specific (hooks, agents)"
|
|
29
|
+
|
|
30
|
+
key_conventions:
|
|
31
|
+
- "Commands: frontmatter with description, optional argument-hint"
|
|
32
|
+
- "Agents: frontmatter with name, description, tools, model (no agileflow- prefix in filename)"
|
|
33
|
+
- "Scripts in packages/cli/scripts/ are PUBLISHED (copied to user projects)"
|
|
34
|
+
- "Scripts in root scripts/ are dev-only (NOT published)"
|
|
35
|
+
- "Dynamic counts: run npm run sync-counts after adding commands/agents"
|
|
36
|
+
|
|
37
|
+
# Module 2: Testing Conventions
|
|
38
|
+
testing:
|
|
39
|
+
framework:
|
|
40
|
+
runner: "Jest (packages/cli/__tests__/)"
|
|
41
|
+
command: "npm test from packages/cli/"
|
|
42
|
+
total_tests: "~4373+ tests across 161+ suites"
|
|
43
|
+
|
|
44
|
+
patterns:
|
|
45
|
+
- "Tests mirror source structure: __tests__/lib/ for tools/cli/lib/"
|
|
46
|
+
- "Use jest.mock() for fs, child_process dependencies"
|
|
47
|
+
- "Expertise validation: scripts/validate-expertise.sh"
|
|
48
|
+
- "Story test tracking: status.json test_status field (passing/failing/not_run)"
|
|
49
|
+
|
|
50
|
+
quality_gates:
|
|
51
|
+
- "All tests must pass before commit"
|
|
52
|
+
- "Session Harness: /agileflow:verify runs tests for current story"
|
|
53
|
+
- "/agileflow:baseline marks verified state"
|
|
54
|
+
- "Logic audit: 5 analyzers check edge cases, race conditions, type bugs"
|
|
55
|
+
|
|
56
|
+
known_issues:
|
|
57
|
+
- "api-server port 3456 conflict causes ~10 test failures (pre-existing)"
|
|
58
|
+
- "--legacy-peer-deps required for TensorFlow.js version conflicts"
|
|
59
|
+
|
|
60
|
+
# Module 3: Security Guidelines
|
|
61
|
+
security:
|
|
62
|
+
commit_policy:
|
|
63
|
+
- "NO AI attribution in commits (forbidden: Co-Authored-By AI, emoji robots)"
|
|
64
|
+
- "Clean conventional commits only (feat/fix/chore/docs)"
|
|
65
|
+
|
|
66
|
+
secrets:
|
|
67
|
+
gitignored: [".npmrc", "CLAUDE.md"]
|
|
68
|
+
storage: "NPM_TOKEN in GitHub Secrets, never committed"
|
|
69
|
+
|
|
70
|
+
code_patterns:
|
|
71
|
+
- "Use execFileSync(cmd, [args]) not execSync(`cmd ${var}`) to prevent injection"
|
|
72
|
+
- "Validate PIDs are numeric, ports are numbers, paths don't traverse"
|
|
73
|
+
- "Damage control hooks guard Bash/Edit/Write via PreToolUse"
|
|
74
|
+
- "patterns.yaml defines blocked commands, read-only paths, zero-access paths"
|
|
75
|
+
|
|
76
|
+
hooks:
|
|
77
|
+
exit_codes: "0=allow, 1=error (fail-open), 2=block"
|
|
78
|
+
files:
|
|
79
|
+
- "damage-control/bash-tool-damage-control.js"
|
|
80
|
+
- "damage-control/edit-tool-damage-control.js"
|
|
81
|
+
- "damage-control/write-tool-damage-control.js"
|
|
82
|
+
- "lib/damage-control-utils.js - Shared validation logic"
|
|
83
|
+
|
|
84
|
+
# Data Stores (cross-cutting knowledge)
|
|
85
|
+
data_stores:
|
|
86
|
+
status_json:
|
|
87
|
+
path: "docs/09-agents/status.json"
|
|
88
|
+
schema: "epics (EP-ID keys), stories (US-ID keys)"
|
|
89
|
+
operations: "Read-modify-write with updated timestamp"
|
|
90
|
+
session_state:
|
|
91
|
+
path: "docs/09-agents/session-state.json"
|
|
92
|
+
purpose: "Active command, loop state, smart-detect results"
|
|
93
|
+
archive:
|
|
94
|
+
path: "docs/09-agents/archive/YYYY-MM.json"
|
|
95
|
+
policy: "Completed stories >7 days auto-archived"
|
|
96
|
+
metadata:
|
|
97
|
+
path: "docs/00-meta/agileflow-metadata.json"
|
|
98
|
+
purpose: "Config schema version, feature toggles, profiles"
|
|
99
|
+
|
|
100
|
+
# Release Process
|
|
101
|
+
release:
|
|
102
|
+
command: "./scripts/release.sh <version> <title>"
|
|
103
|
+
version_files: ["packages/cli/package.json", "package.json"]
|
|
104
|
+
ci: ".github/workflows/npm-publish.yml triggered by v*.*.* tags"
|
|
105
|
+
brand_color: "#e8683a"
|
|
@@ -108,106 +108,12 @@ conventions:
|
|
|
108
108
|
- "Document all events in event catalog"
|
|
109
109
|
- "Test tracking in development before production"
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
navigation:
|
|
113
|
-
- page_viewed
|
|
114
|
-
- navigation_clicked
|
|
115
|
-
- back_clicked
|
|
116
|
-
- search_performed
|
|
117
|
-
|
|
118
|
-
user_actions:
|
|
119
|
-
- button_clicked
|
|
120
|
-
- form_submitted
|
|
121
|
-
- feature_used
|
|
122
|
-
- content_shared
|
|
123
|
-
|
|
124
|
-
conversions:
|
|
125
|
-
- signup_started
|
|
126
|
-
- signup_completed
|
|
127
|
-
- trial_started
|
|
128
|
-
- purchase_completed
|
|
129
|
-
- upgrade_clicked
|
|
130
|
-
|
|
131
|
-
engagement:
|
|
132
|
-
- content_viewed
|
|
133
|
-
- video_played
|
|
134
|
-
- comment_added
|
|
135
|
-
- reaction_added
|
|
136
|
-
|
|
137
|
-
errors:
|
|
138
|
-
- error_occurred
|
|
139
|
-
- api_failed
|
|
140
|
-
- validation_failed
|
|
141
|
-
|
|
142
|
-
key_metrics:
|
|
143
|
-
acquisition:
|
|
144
|
-
- daily_signups
|
|
145
|
-
- signup_conversion_rate
|
|
146
|
-
- acquisition_source
|
|
147
|
-
|
|
148
|
-
engagement:
|
|
149
|
-
- daily_active_users
|
|
150
|
-
- monthly_active_users
|
|
151
|
-
- session_duration
|
|
152
|
-
- feature_adoption_rate
|
|
153
|
-
|
|
154
|
-
retention:
|
|
155
|
-
- day_1_retention
|
|
156
|
-
- day_7_retention
|
|
157
|
-
- day_30_retention
|
|
158
|
-
- churn_rate
|
|
159
|
-
|
|
160
|
-
revenue:
|
|
161
|
-
- monthly_recurring_revenue
|
|
162
|
-
- average_revenue_per_user
|
|
163
|
-
- lifetime_value
|
|
164
|
-
|
|
165
|
-
# Learnings are AUTO-UPDATED by self-improve.md
|
|
166
|
-
# Do not edit manually - let the agent learn from experience
|
|
111
|
+
# Learnings (trimmed - keep 2 most actionable)
|
|
167
112
|
learnings:
|
|
168
113
|
- date: 2025-12-21
|
|
169
|
-
context:
|
|
170
|
-
|
|
171
|
-
AgileFlow tracks expertise system metrics via scripts/expertise-metrics.sh script.
|
|
172
|
-
This script analyzes all expert expertise.yaml files to generate health metrics:
|
|
173
|
-
- Total number of experts
|
|
174
|
-
- Experts with learnings vs without
|
|
175
|
-
- Average learnings per expert
|
|
176
|
-
- Most active experts (by learning count)
|
|
177
|
-
- Stale experts (not updated recently)
|
|
178
|
-
Use this pattern for analyzing distributed knowledge across multiple expertise files.
|
|
179
|
-
|
|
180
|
-
- date: 2025-12-21
|
|
181
|
-
context: Validation script health metrics
|
|
182
|
-
learning: |
|
|
183
|
-
AgileFlow validation scripts (scripts/validate-*.sh) provide structured health metrics
|
|
184
|
-
with PASS/WARN/FAIL counts. Key patterns:
|
|
185
|
-
- Each validation script outputs structured results (not just exit codes)
|
|
186
|
-
- Metrics include: total checks, passed, warnings, failures
|
|
187
|
-
- validate-all.sh aggregates metrics from individual validators
|
|
188
|
-
- Health dashboard can be built by parsing validation output
|
|
189
|
-
This pattern enables tracking system health trends over time.
|
|
190
|
-
|
|
191
|
-
- date: 2025-12-21
|
|
192
|
-
context: Story completion metrics from status.json
|
|
193
|
-
learning: |
|
|
194
|
-
AgileFlow tracks project progress via docs/09-agents/status.json.
|
|
195
|
-
Key metrics available:
|
|
196
|
-
- Total stories vs completed stories (completion percentage)
|
|
197
|
-
- Stories by status: backlog, in_progress, blocked, completed
|
|
198
|
-
- WIP (work in progress) count
|
|
199
|
-
- Stories by epic (epic-level progress)
|
|
200
|
-
- Average story age (time in current status)
|
|
201
|
-
Parse status.json to generate project health dashboards and velocity metrics.
|
|
114
|
+
context: "Expertise metrics"
|
|
115
|
+
insight: "scripts/expertise-metrics.sh analyzes expertise.yaml files for health: total experts, learnings count, staleness distribution"
|
|
202
116
|
|
|
203
117
|
- date: 2025-12-21
|
|
204
|
-
context:
|
|
205
|
-
|
|
206
|
-
AgileFlow tracks agent activity in docs/09-agents/bus/log.jsonl (append-only).
|
|
207
|
-
Each line is a JSON object with: timestamp, agent, action, metadata.
|
|
208
|
-
Key patterns:
|
|
209
|
-
- Append-only format (never edit existing lines)
|
|
210
|
-
- Parse line-by-line to analyze agent activity patterns
|
|
211
|
-
- Track agent invocation frequency, success rates, common errors
|
|
212
|
-
- Identify most active agents and underutilized agents
|
|
213
|
-
Use this for agent performance analytics and optimization insights.
|
|
118
|
+
context: "Story metrics from status.json"
|
|
119
|
+
insight: "Parse status.json for: completion %, stories by status/epic, WIP count, average story age"
|