agileflow 3.3.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +6 -6
  3. package/lib/skill-loader.js +0 -1
  4. package/package.json +1 -1
  5. package/scripts/agileflow-statusline.sh +81 -0
  6. package/scripts/agileflow-welcome.js +79 -0
  7. package/scripts/claude-tmux.sh +90 -23
  8. package/scripts/claude-watchdog.sh +225 -0
  9. package/scripts/generators/agent-registry.js +14 -1
  10. package/scripts/generators/inject-babysit.js +22 -9
  11. package/scripts/generators/inject-help.js +19 -9
  12. package/scripts/lib/ac-test-matcher.js +452 -0
  13. package/scripts/lib/audit-cleanup.js +250 -0
  14. package/scripts/lib/audit-registry.js +304 -0
  15. package/scripts/lib/configure-features.js +35 -0
  16. package/scripts/lib/feature-catalog.js +3 -3
  17. package/scripts/lib/gate-enforcer.js +295 -0
  18. package/scripts/lib/model-profiles.js +118 -0
  19. package/scripts/lib/quality-gates.js +163 -0
  20. package/scripts/lib/signal-detectors.js +44 -1
  21. package/scripts/lib/skill-catalog.js +557 -0
  22. package/scripts/lib/skill-recommender.js +311 -0
  23. package/scripts/lib/status-writer.js +255 -0
  24. package/scripts/lib/story-claiming.js +128 -45
  25. package/scripts/lib/task-sync.js +32 -38
  26. package/scripts/lib/tdd-phase-manager.js +455 -0
  27. package/scripts/lib/team-events.js +34 -3
  28. package/scripts/lib/tmux-audit-monitor.js +611 -0
  29. package/scripts/lib/tmux-group-colors.js +113 -0
  30. package/scripts/lib/tool-registry.yaml +241 -0
  31. package/scripts/lib/tool-shed.js +441 -0
  32. package/scripts/messaging-bridge.js +209 -1
  33. package/scripts/native-team-observer.js +219 -0
  34. package/scripts/obtain-context.js +14 -0
  35. package/scripts/ralph-loop.js +30 -5
  36. package/scripts/smart-detect.js +21 -0
  37. package/scripts/spawn-audit-sessions.js +877 -0
  38. package/scripts/team-manager.js +56 -16
  39. package/scripts/tmux-close-windows.sh +180 -0
  40. package/src/core/agents/a11y-analyzer-aria.md +155 -0
  41. package/src/core/agents/a11y-analyzer-forms.md +162 -0
  42. package/src/core/agents/a11y-analyzer-keyboard.md +175 -0
  43. package/src/core/agents/a11y-analyzer-semantic.md +153 -0
  44. package/src/core/agents/a11y-analyzer-visual.md +158 -0
  45. package/src/core/agents/a11y-consensus.md +248 -0
  46. package/src/core/agents/ads-audit-budget.md +181 -0
  47. package/src/core/agents/ads-audit-compliance.md +169 -0
  48. package/src/core/agents/ads-audit-creative.md +164 -0
  49. package/src/core/agents/ads-audit-google.md +226 -0
  50. package/src/core/agents/ads-audit-meta.md +183 -0
  51. package/src/core/agents/ads-audit-tracking.md +197 -0
  52. package/src/core/agents/ads-consensus.md +396 -0
  53. package/src/core/agents/ads-generate.md +145 -0
  54. package/src/core/agents/ads-performance-tracker.md +197 -0
  55. package/src/core/agents/api-quality-analyzer-conventions.md +148 -0
  56. package/src/core/agents/api-quality-analyzer-docs.md +176 -0
  57. package/src/core/agents/api-quality-analyzer-errors.md +183 -0
  58. package/src/core/agents/api-quality-analyzer-pagination.md +171 -0
  59. package/src/core/agents/api-quality-analyzer-versioning.md +143 -0
  60. package/src/core/agents/api-quality-consensus.md +214 -0
  61. package/src/core/agents/arch-analyzer-circular.md +148 -0
  62. package/src/core/agents/arch-analyzer-complexity.md +171 -0
  63. package/src/core/agents/arch-analyzer-coupling.md +146 -0
  64. package/src/core/agents/arch-analyzer-layering.md +151 -0
  65. package/src/core/agents/arch-analyzer-patterns.md +162 -0
  66. package/src/core/agents/arch-consensus.md +227 -0
  67. package/src/core/agents/brainstorm-analyzer-features.md +169 -0
  68. package/src/core/agents/brainstorm-analyzer-growth.md +161 -0
  69. package/src/core/agents/brainstorm-analyzer-integration.md +172 -0
  70. package/src/core/agents/brainstorm-analyzer-market.md +147 -0
  71. package/src/core/agents/brainstorm-analyzer-ux.md +167 -0
  72. package/src/core/agents/brainstorm-consensus.md +237 -0
  73. package/src/core/agents/completeness-consensus.md +5 -5
  74. package/src/core/agents/perf-consensus.md +2 -2
  75. package/src/core/agents/security-consensus.md +2 -2
  76. package/src/core/agents/seo-analyzer-content.md +167 -0
  77. package/src/core/agents/seo-analyzer-images.md +187 -0
  78. package/src/core/agents/seo-analyzer-performance.md +206 -0
  79. package/src/core/agents/seo-analyzer-schema.md +176 -0
  80. package/src/core/agents/seo-analyzer-sitemap.md +172 -0
  81. package/src/core/agents/seo-analyzer-technical.md +144 -0
  82. package/src/core/agents/seo-consensus.md +289 -0
  83. package/src/core/agents/test-consensus.md +2 -2
  84. package/src/core/commands/adr.md +1 -0
  85. package/src/core/commands/ads/audit.md +375 -0
  86. package/src/core/commands/ads/budget.md +97 -0
  87. package/src/core/commands/ads/competitor.md +112 -0
  88. package/src/core/commands/ads/creative.md +85 -0
  89. package/src/core/commands/ads/generate.md +238 -0
  90. package/src/core/commands/ads/google.md +112 -0
  91. package/src/core/commands/ads/health.md +327 -0
  92. package/src/core/commands/ads/landing.md +119 -0
  93. package/src/core/commands/ads/linkedin.md +112 -0
  94. package/src/core/commands/ads/meta.md +91 -0
  95. package/src/core/commands/ads/microsoft.md +115 -0
  96. package/src/core/commands/ads/plan.md +321 -0
  97. package/src/core/commands/ads/test-plan.md +317 -0
  98. package/src/core/commands/ads/tiktok.md +129 -0
  99. package/src/core/commands/ads/track.md +288 -0
  100. package/src/core/commands/ads/youtube.md +124 -0
  101. package/src/core/commands/ads.md +140 -0
  102. package/src/core/commands/assign.md +1 -0
  103. package/src/core/commands/audit.md +43 -6
  104. package/src/core/commands/babysit.md +315 -1266
  105. package/src/core/commands/baseline.md +1 -0
  106. package/src/core/commands/blockers.md +1 -0
  107. package/src/core/commands/board.md +1 -0
  108. package/src/core/commands/changelog.md +1 -0
  109. package/src/core/commands/choose.md +1 -0
  110. package/src/core/commands/ci.md +1 -0
  111. package/src/core/commands/code/accessibility.md +347 -0
  112. package/src/core/commands/code/api.md +297 -0
  113. package/src/core/commands/code/architecture.md +297 -0
  114. package/src/core/commands/{audit → code}/completeness.md +72 -25
  115. package/src/core/commands/{audit → code}/legal.md +63 -16
  116. package/src/core/commands/{audit → code}/logic.md +64 -16
  117. package/src/core/commands/{audit → code}/performance.md +67 -20
  118. package/src/core/commands/{audit → code}/security.md +69 -19
  119. package/src/core/commands/{audit → code}/test.md +67 -20
  120. package/src/core/commands/configure.md +1 -0
  121. package/src/core/commands/council.md +1 -0
  122. package/src/core/commands/deploy.md +1 -0
  123. package/src/core/commands/diagnose.md +1 -0
  124. package/src/core/commands/docs.md +1 -0
  125. package/src/core/commands/epic/edit.md +213 -0
  126. package/src/core/commands/epic.md +1 -0
  127. package/src/core/commands/export.md +238 -0
  128. package/src/core/commands/help.md +16 -1
  129. package/src/core/commands/{discovery → ideate}/brief.md +12 -12
  130. package/src/core/commands/{discovery/new.md → ideate/discover.md} +20 -16
  131. package/src/core/commands/ideate/features.md +496 -0
  132. package/src/core/commands/ideate/new.md +158 -124
  133. package/src/core/commands/impact.md +1 -0
  134. package/src/core/commands/learn/explain.md +118 -0
  135. package/src/core/commands/learn/glossary.md +135 -0
  136. package/src/core/commands/learn/patterns.md +138 -0
  137. package/src/core/commands/learn/tour.md +126 -0
  138. package/src/core/commands/migrate/codemods.md +151 -0
  139. package/src/core/commands/migrate/plan.md +131 -0
  140. package/src/core/commands/migrate/scan.md +114 -0
  141. package/src/core/commands/migrate/validate.md +119 -0
  142. package/src/core/commands/multi-expert.md +1 -0
  143. package/src/core/commands/pr.md +1 -0
  144. package/src/core/commands/review.md +1 -0
  145. package/src/core/commands/seo/audit.md +373 -0
  146. package/src/core/commands/seo/competitor.md +174 -0
  147. package/src/core/commands/seo/content.md +107 -0
  148. package/src/core/commands/seo/geo.md +229 -0
  149. package/src/core/commands/seo/hreflang.md +140 -0
  150. package/src/core/commands/seo/images.md +96 -0
  151. package/src/core/commands/seo/page.md +198 -0
  152. package/src/core/commands/seo/plan.md +163 -0
  153. package/src/core/commands/seo/programmatic.md +131 -0
  154. package/src/core/commands/seo/references/cwv-thresholds.md +64 -0
  155. package/src/core/commands/seo/references/eeat-framework.md +110 -0
  156. package/src/core/commands/seo/references/quality-gates.md +91 -0
  157. package/src/core/commands/seo/references/schema-types.md +102 -0
  158. package/src/core/commands/seo/schema.md +183 -0
  159. package/src/core/commands/seo/sitemap.md +97 -0
  160. package/src/core/commands/seo/technical.md +100 -0
  161. package/src/core/commands/seo.md +107 -0
  162. package/src/core/commands/skill/list.md +68 -212
  163. package/src/core/commands/skill/recommend.md +216 -0
  164. package/src/core/commands/sprint.md +1 -0
  165. package/src/core/commands/status/undo.md +191 -0
  166. package/src/core/commands/status.md +1 -0
  167. package/src/core/commands/story/edit.md +204 -0
  168. package/src/core/commands/story/view.md +29 -7
  169. package/src/core/commands/story-validate.md +1 -0
  170. package/src/core/commands/story.md +1 -0
  171. package/src/core/commands/tdd-next.md +238 -0
  172. package/src/core/commands/tdd.md +211 -0
  173. package/src/core/commands/team/start.md +10 -6
  174. package/src/core/commands/tests.md +1 -0
  175. package/src/core/commands/verify.md +27 -1
  176. package/src/core/commands/workflow.md +2 -0
  177. package/src/core/experts/_core-expertise.yaml +105 -0
  178. package/src/core/experts/analytics/expertise.yaml +5 -99
  179. package/src/core/experts/codebase-query/expertise.yaml +3 -72
  180. package/src/core/experts/compliance/expertise.yaml +6 -72
  181. package/src/core/experts/database/expertise.yaml +9 -52
  182. package/src/core/experts/documentation/expertise.yaml +7 -140
  183. package/src/core/experts/integrations/expertise.yaml +7 -127
  184. package/src/core/experts/mentor/expertise.yaml +8 -35
  185. package/src/core/experts/monitoring/expertise.yaml +7 -49
  186. package/src/core/experts/performance/expertise.yaml +1 -26
  187. package/src/core/experts/security/expertise.yaml +9 -34
  188. package/src/core/experts/ui/expertise.yaml +6 -36
  189. package/src/core/knowledge/ads/ad-audit-checklist-scoring.md +424 -0
  190. package/src/core/knowledge/ads/ad-optimization-logic.md +590 -0
  191. package/src/core/knowledge/ads/ad-technical-specifications.md +385 -0
  192. package/src/core/knowledge/ads/definitive-advertising-reference-2026.md +506 -0
  193. package/src/core/knowledge/ads/paid-advertising-research-2026.md +445 -0
  194. package/src/core/teams/backend.json +41 -0
  195. package/src/core/teams/frontend.json +41 -0
  196. package/src/core/teams/qa.json +41 -0
  197. package/src/core/teams/solo.json +35 -0
  198. package/src/core/templates/agileflow-metadata.json +20 -1
  199. package/tools/cli/commands/setup.js +85 -3
  200. package/tools/cli/commands/update.js +42 -0
  201. package/tools/cli/installers/ide/_base-ide.js +42 -5
  202. package/tools/cli/installers/ide/claude-code.js +71 -3
  203. package/tools/cli/lib/content-injector.js +160 -12
  204. package/tools/cli/lib/docs-setup.js +1 -1
  205. package/src/core/commands/skill/create.md +0 -698
  206. package/src/core/commands/skill/delete.md +0 -316
  207. package/src/core/commands/skill/edit.md +0 -359
  208. package/src/core/commands/skill/test.md +0 -394
  209. package/src/core/commands/skill/upgrade.md +0 -552
  210. package/src/core/templates/skill-template.md +0 -117
@@ -0,0 +1,191 @@
1
+ ---
2
+ description: Undo the last status change for a story (rollback)
3
+ argument-hint: "STORY=<US-ID>"
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:status:undo - Rollback story status to previous value"
8
+ - "{{RULES:json_operations}}"
9
+ - "{{RULES:user_confirmation}}"
10
+ - "{{RULES:file_preview}}"
11
+ - "MUST read bus/log.jsonl to find the last status change"
12
+ - "MUST show current vs previous status as diff"
13
+ - "MUST confirm with AskUserQuestion before applying"
14
+ - "MUST log revert event to bus/log.jsonl with type=status-reverted"
15
+ state_fields:
16
+ - story_id
17
+ - current_status
18
+ - previous_status
19
+ ---
20
+
21
+ # /agileflow:status:undo
22
+
23
+ Undo the last status change for a story by reading the bus event log to find the previous status.
24
+
25
+ ---
26
+
27
+ ## STEP 0: Gather Context
28
+
29
+ ```bash
30
+ node .agileflow/scripts/obtain-context.js status:undo
31
+ ```
32
+
33
+ ---
34
+
35
+ <!-- COMPACT_SUMMARY_START -->
36
+ ## Compact Summary
37
+
38
+ **Command**: `/agileflow:status:undo STORY=<US-ID>`
39
+ **Purpose**: Rollback a story's status to its previous value using bus log history
40
+
41
+ ### Flow
42
+ 1. Parse STORY parameter (required)
43
+ 2. Read bus/log.jsonl to find status change history for the story
44
+ 3. Read current status from status.json
45
+ 4. Show diff: current status vs previous status
46
+ 5. Confirm via AskUserQuestion
47
+ 6. Apply rollback to status.json
48
+ 7. Log status-reverted event to bus/log.jsonl
49
+
50
+ ### Critical Rules
51
+ - **Bus log sourced**: Previous status comes from bus/log.jsonl history
52
+ - **Diff preview**: Show current vs previous before applying
53
+ - **Confirmation**: Never write without user approval
54
+ - **Bus logging**: Append status-reverted event after rollback
55
+ - **No history = no undo**: If no previous status event found, inform user
56
+ <!-- COMPACT_SUMMARY_END -->
57
+
58
+ ---
59
+
60
+ ## Arguments
61
+
62
+ | Argument | Required | Description |
63
+ |----------|----------|-------------|
64
+ | STORY | Yes | Story ID to revert (e.g., US-0042) |
65
+
66
+ ---
67
+
68
+ ## IMMEDIATE ACTIONS
69
+
70
+ ### Step 1: Validate Input
71
+
72
+ If STORY not provided, list recently changed stories from bus log.
73
+
74
+ ### Step 2: Find Previous Status
75
+
76
+ Read `docs/09-agents/bus/log.jsonl` and find status change events for the given story. Look for events with:
77
+ - `type: "status"` and matching `story` field
78
+ - `type: "assign"` (initial creation = "ready")
79
+ - `type: "status-reverted"` (previous undos)
80
+
81
+ Parse the log in reverse chronological order to find:
82
+ 1. **Current status event** (most recent)
83
+ 2. **Previous status event** (the one before that)
84
+
85
+ If only one status event exists (the initial creation), inform the user:
86
+ ```
87
+ No previous status found for US-0042.
88
+ Current status "ready" is the original status from story creation.
89
+ Nothing to undo.
90
+ ```
91
+
92
+ ### Step 3: Read Current State
93
+
94
+ Read story from `docs/09-agents/status.json` to confirm the current status matches what the bus log says.
95
+
96
+ ### Step 4: Show Diff Preview
97
+
98
+ ```markdown
99
+ ## Status Undo: US-0042
100
+
101
+ | | Status |
102
+ |---|--------|
103
+ | Current | in_progress |
104
+ | Revert to | ready |
105
+
106
+ Based on bus event from 2026-03-01T14:30:00Z:
107
+ "Story US-0042 status changed to in_progress"
108
+ ```
109
+
110
+ ### Step 5: Confirm Rollback
111
+
112
+ ```xml
113
+ <invoke name="AskUserQuestion">
114
+ <parameter name="questions">[{
115
+ "question": "Revert US-0042 from 'in_progress' back to 'ready'?",
116
+ "header": "Confirm undo",
117
+ "multiSelect": false,
118
+ "options": [
119
+ {"label": "Yes, revert status (Recommended)", "description": "Change status from in_progress back to ready"},
120
+ {"label": "No, cancel", "description": "Keep current status"}
121
+ ]
122
+ }]</parameter>
123
+ </invoke>
124
+ ```
125
+
126
+ ### Step 6: Apply Rollback
127
+
128
+ On confirmation:
129
+
130
+ 1. **Update status.json** using Edit tool:
131
+ - Set story status to the previous value
132
+ - Update the `updated` timestamp
133
+
134
+ 2. **Validate JSON**:
135
+ ```bash
136
+ node -e "JSON.parse(require('fs').readFileSync('docs/09-agents/status.json','utf8')); console.log('valid')"
137
+ ```
138
+
139
+ 3. **Append to bus/log.jsonl**:
140
+ ```json
141
+ {"ts":"<ISO>","type":"status-reverted","from":"USER","story":"<STORY>","from_status":"<current>","to_status":"<previous>","text":"Status reverted from <current> to <previous>"}
142
+ ```
143
+
144
+ ### Step 7: Confirm Success
145
+
146
+ ```
147
+ US-0042 status reverted: in_progress -> ready
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Edge Cases
153
+
154
+ | Scenario | Behavior |
155
+ |----------|----------|
156
+ | No status events in bus log | Check status.json only, inform "no history available" |
157
+ | Story not found | Error: "Story {ID} not found in status.json" |
158
+ | Current status doesn't match bus log | Warn user, show both, ask which to revert to |
159
+ | Multiple rapid changes | Revert to the immediately previous status only |
160
+
161
+ ---
162
+
163
+ ## Example Usage
164
+
165
+ ```bash
166
+ # Undo last status change
167
+ /agileflow:status:undo STORY=US-0042
168
+
169
+ # Typical flow: accidentally marked done, want to go back
170
+ # Before: done -> After: in_progress
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Rules
176
+
177
+ - **Always preview**: Show current vs previous status before applying
178
+ - **Always confirm**: Use AskUserQuestion before writes
179
+ - **Always log**: Append status-reverted event to bus/log.jsonl
180
+ - **Always validate**: Check JSON integrity after write
181
+ - **One level**: Only undo one status change at a time (run again for more)
182
+ - **Bus log is source of truth**: Previous status comes from event history
183
+
184
+ ---
185
+
186
+ ## Related Commands
187
+
188
+ - `/agileflow:status` - Update story status
189
+ - `/agileflow:story:view` - View story details
190
+ - `/agileflow:story:edit` - Edit story fields
191
+ - `/agileflow:board` - View kanban board
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  description: Update story status and progress
3
+ phase: pre-story
3
4
  argument-hint: "STORY=<US-ID> STATUS=<status> [SUMMARY=<text>] [PR=<url>] [TO=<agent-id>]"
4
5
  compact_context:
5
6
  priority: high
@@ -0,0 +1,204 @@
1
+ ---
2
+ description: Edit an existing story's fields (title, owner, estimate, status, priority)
3
+ argument-hint: "STORY=<US-ID> [TITLE=<text>] [OWNER=<id>] [ESTIMATE=<time>] [STATUS=<status>] [PRIORITY=<P0-P3|high|medium|low>]"
4
+ compact_context:
5
+ priority: high
6
+ preserve_rules:
7
+ - "ACTIVE COMMAND: /agileflow:story:edit - Edit story fields with diff-preview-confirm"
8
+ - "{{RULES:json_operations}}"
9
+ - "{{RULES:user_confirmation}}"
10
+ - "{{RULES:file_preview}}"
11
+ - "MUST read current story from status.json BEFORE proposing changes"
12
+ - "MUST show diff of old vs new values"
13
+ - "MUST confirm with AskUserQuestion before writing"
14
+ - "MUST log edit event to bus/log.jsonl"
15
+ state_fields:
16
+ - story_id
17
+ - fields_changed
18
+ ---
19
+
20
+ # /agileflow:story:edit
21
+
22
+ Edit an existing story's metadata fields with diff preview and confirmation.
23
+
24
+ ---
25
+
26
+ ## STEP 0: Gather Context
27
+
28
+ ```bash
29
+ node .agileflow/scripts/obtain-context.js story:edit
30
+ ```
31
+
32
+ ---
33
+
34
+ <!-- COMPACT_SUMMARY_START -->
35
+ ## Compact Summary
36
+
37
+ **Command**: `/agileflow:story:edit STORY=<US-ID> [TITLE=...] [OWNER=...] [ESTIMATE=...] [STATUS=...] [PRIORITY=...]`
38
+ **Purpose**: Edit story fields in status.json with diff-preview-confirm workflow
39
+
40
+ ### Flow
41
+ 1. Parse STORY parameter (required) and optional field overrides
42
+ 2. Read current story from status.json
43
+ 3. Show diff of proposed changes
44
+ 4. Confirm via AskUserQuestion
45
+ 5. Apply changes to status.json
46
+ 6. Log edit event to bus/log.jsonl
47
+
48
+ ### Critical Rules
49
+ - **Diff preview**: Always show old vs new before writing
50
+ - **Confirmation**: Never write without user approval
51
+ - **Bus logging**: Always append story-edited event
52
+ - **Validation**: Verify JSON integrity after write
53
+ <!-- COMPACT_SUMMARY_END -->
54
+
55
+ ---
56
+
57
+ ## Arguments
58
+
59
+ | Argument | Required | Description |
60
+ |----------|----------|-------------|
61
+ | STORY | Yes | Story ID (e.g., US-0042) |
62
+ | TITLE | No | New story title |
63
+ | OWNER | No | New owner (e.g., AG-API, AG-UI) |
64
+ | ESTIMATE | No | New estimate (e.g., 2h, 1d) |
65
+ | STATUS | No | New status (ready, in_progress, blocked, done) |
66
+ | PRIORITY | No | New priority (P0, P1, P2, P3, high, medium, low) |
67
+
68
+ At least one optional field must be provided (otherwise suggest `/agileflow:story:view`).
69
+
70
+ ---
71
+
72
+ ## IMMEDIATE ACTIONS
73
+
74
+ ### Step 1: Validate Input
75
+
76
+ If STORY not provided:
77
+
78
+ ```xml
79
+ <invoke name="AskUserQuestion">
80
+ <parameter name="questions">[{
81
+ "question": "Which story would you like to edit?",
82
+ "header": "Select",
83
+ "multiSelect": false,
84
+ "options": [
85
+ {"label": "Enter story ID", "description": "Provide a US-XXXX identifier"}
86
+ ]
87
+ }]</parameter>
88
+ </invoke>
89
+ ```
90
+
91
+ ### Step 2: Read Current Story
92
+
93
+ Read the story entry from `docs/09-agents/status.json`:
94
+
95
+ ```javascript
96
+ const data = JSON.parse(fs.readFileSync('docs/09-agents/status.json', 'utf8'));
97
+ const story = data.stories[storyId];
98
+ ```
99
+
100
+ If story not found, show error: "Story {STORY} not found in status.json"
101
+
102
+ ### Step 3: Build Change Set
103
+
104
+ Compare provided fields against current values. Skip fields that match current values (no-op).
105
+
106
+ If no fields would change, inform user: "No changes detected. Current values match provided values."
107
+
108
+ ### Step 4: Show Diff Preview
109
+
110
+ Display a clear diff of what will change:
111
+
112
+ ```markdown
113
+ ## Editing US-0042: Current Title
114
+
115
+ | Field | Current | New |
116
+ |-------|---------|-----|
117
+ | title | "Login Form" | "Login Form with Validation" |
118
+ | owner | AG-UI | AG-API |
119
+ | estimate | 2h | 4h |
120
+
121
+ Files modified:
122
+ 1. docs/09-agents/status.json (story entry update)
123
+ 2. docs/09-agents/bus/log.jsonl (edit event append)
124
+ ```
125
+
126
+ ### Step 5: Confirm Changes
127
+
128
+ ```xml
129
+ <invoke name="AskUserQuestion">
130
+ <parameter name="questions">[{
131
+ "question": "Apply these changes to US-0042?",
132
+ "header": "Confirm edit",
133
+ "multiSelect": false,
134
+ "options": [
135
+ {"label": "Yes, apply changes (Recommended)", "description": "Update status.json and log edit event"},
136
+ {"label": "No, cancel", "description": "Discard changes"}
137
+ ]
138
+ }]</parameter>
139
+ </invoke>
140
+ ```
141
+
142
+ ### Step 6: Apply Changes
143
+
144
+ On confirmation:
145
+
146
+ 1. **Update status.json** using Edit tool or jq:
147
+ - Update only the changed fields in the story entry
148
+ - Set `updated` timestamp to current ISO date
149
+
150
+ 2. **Validate JSON**:
151
+ ```bash
152
+ node -e "JSON.parse(require('fs').readFileSync('docs/09-agents/status.json','utf8')); console.log('valid')"
153
+ ```
154
+
155
+ 3. **Append to bus/log.jsonl**:
156
+ ```json
157
+ {"ts":"<ISO>","type":"story-edited","from":"USER","story":"<STORY>","changes":{"field":"old_value->new_value"},"text":"Story edited: <changed fields>"}
158
+ ```
159
+
160
+ ### Step 7: Confirm Success
161
+
162
+ ```
163
+ Story US-0042 updated:
164
+ title: "Login Form" -> "Login Form with Validation"
165
+ owner: AG-UI -> AG-API
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Example Usage
171
+
172
+ ```bash
173
+ # Edit title
174
+ /agileflow:story:edit STORY=US-0042 TITLE="Updated Title"
175
+
176
+ # Change owner and estimate
177
+ /agileflow:story:edit STORY=US-0042 OWNER=AG-API ESTIMATE=4h
178
+
179
+ # Change status
180
+ /agileflow:story:edit STORY=US-0042 STATUS=blocked
181
+
182
+ # Multiple fields at once
183
+ /agileflow:story:edit STORY=US-0042 TITLE="New Title" OWNER=AG-UI PRIORITY=high
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Rules
189
+
190
+ - **Always preview**: Show diff before applying
191
+ - **Always confirm**: Use AskUserQuestion before writes
192
+ - **Always log**: Append edit event to bus/log.jsonl
193
+ - **Always validate**: Check JSON integrity after write
194
+ - **No silent changes**: Every change must be visible to the user
195
+
196
+ ---
197
+
198
+ ## Related Commands
199
+
200
+ - `/agileflow:story:view` - View story details
201
+ - `/agileflow:story:list` - List all stories
202
+ - `/agileflow:story` - Create new story
203
+ - `/agileflow:status` - Quick status update
204
+ - `/agileflow:epic:edit` - Edit epic fields
@@ -6,6 +6,8 @@ compact_context:
6
6
  preserve_rules:
7
7
  - "ACTIVE COMMAND: /agileflow:story:view - Views story with context-aware actions"
8
8
  - "MUST read story file and status.json entry"
9
+ - "MUST parse AC items and cross-reference with test files for verified/pending status"
10
+ - "MUST display AC Progress: X/Y verified with visual progress bar"
9
11
  - "MUST display full story: AC (with checkboxes), tests, dependencies, blockers"
10
12
  - "MUST offer CONTEXT-AWARE actions based on story status"
11
13
  - "STATUS=ready → Start work, validate, view research"
@@ -51,13 +53,15 @@ node .agileflow/scripts/obtain-context.js story:view
51
53
 
52
54
  ### Flow
53
55
  1. Read story file and status.json entry
54
- 2. Display full story details (AC, tests, progress)
55
- 3. Offer actions based on current status
56
- 4. Execute selected action
56
+ 2. Parse AC items and cross-reference with test files
57
+ 3. Display full story details (AC progress, tests, dependencies)
58
+ 4. Offer actions based on current status
59
+ 5. Execute selected action
57
60
 
58
61
  ### Critical Rules
62
+ - **AC progress**: Parse AC items, cross-reference with tests, show X/Y verified with progress bar
59
63
  - **Context-aware actions**: Different options based on story status
60
- - **Show everything**: AC, test status, dependencies, blockers
64
+ - **Show everything**: AC progress, test status, dependencies, blockers
61
65
  - **Always offer next steps**: End with relevant AskUserQuestion
62
66
  <!-- COMPACT_SUMMARY_END -->
63
67
 
@@ -109,7 +113,22 @@ cat docs/09-agents/status.json | jq '.stories["<STORY>"]'
109
113
  cat docs/07-testing/test-cases/<STORY>.md
110
114
  ```
111
115
 
112
- ### Step 3: Display Story Details
116
+ ### Step 3: Parse AC and Compute Progress
117
+
118
+ Before displaying, count acceptance criteria completion:
119
+
120
+ 1. **Parse AC from status.json**: Read the `ac` array from the story entry (string list of AC items)
121
+ 2. **Parse AC from story file** (if exists): Look for Given/When/Then patterns or `- [ ]`/`- [x]` checkboxes
122
+ 3. **Cross-reference with tests**: Check `docs/07-testing/test-cases/<STORY>.md` and `__tests__/<STORY>.test.*` for matching test descriptions
123
+ 4. **Compute progress**: Count verified (has matching test OR `[x]` checkbox) vs total AC items
124
+ 5. **Build ac_status**: `{ total: N, verified: M, items: [{text, verified, test_match}] }`
125
+
126
+ **Matching rules:**
127
+ - AC is "verified" if: story file has `[x]` checkbox for it, OR a test file has a describe/it/test matching the AC text
128
+ - Use fuzzy substring matching (lowercase, strip "given/when/then" prefixes)
129
+ - If no test files found, fall back to checkbox status only
130
+
131
+ ### Step 4: Display Story Details
113
132
 
114
133
  ```markdown
115
134
  ## US-0042: User Login Form
@@ -124,11 +143,14 @@ cat docs/07-testing/test-cases/<STORY>.md
124
143
 
125
144
  ---
126
145
 
127
- ### Acceptance Criteria
146
+ ### AC Progress: 1/3 verified
147
+
148
+ [==========....................] 33%
128
149
 
129
150
  - [x] Given a user on the login page
130
151
  When they enter valid credentials
131
152
  Then they are redirected to dashboard
153
+ (matched: LoginForm.test.tsx > "redirects on valid credentials")
132
154
 
133
155
  - [ ] Given a user on the login page
134
156
  When they enter invalid credentials
@@ -143,7 +165,7 @@ cat docs/07-testing/test-cases/<STORY>.md
143
165
  ### Dependencies
144
166
 
145
167
  - US-0040: API authentication endpoint (done)
146
- - US-0041: Session management (ready) ⚠️ Not started yet
168
+ - US-0041: Session management (ready) - Not started yet
147
169
 
148
170
  ---
149
171
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  description: Validate story completeness before development
3
+ phase: pre-story
3
4
  argument-hint: "STORY=<US-ID>"
4
5
  compact_context:
5
6
  priority: high
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  description: Create a user story with acceptance criteria
3
+ phase: pre-story
3
4
  argument-hint: "EPIC=<EP-ID> STORY=<US-ID> TITLE=<text> OWNER=<id> [ESTIMATE=<pts>] [AC=<list>] [TDD=true]"
4
5
  compact_context:
5
6
  priority: high