agileflow 3.0.0 → 3.0.2

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 (57) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +6 -6
  3. package/lib/api-server.js +3 -2
  4. package/lib/dashboard-server.js +131 -50
  5. package/lib/flag-detection.js +4 -2
  6. package/lib/git-operations.js +4 -2
  7. package/lib/process-executor.js +24 -9
  8. package/lib/skill-loader.js +11 -3
  9. package/package.json +1 -1
  10. package/scripts/agileflow-welcome.js +65 -25
  11. package/scripts/archive-completed-stories.sh +3 -0
  12. package/scripts/ci-summary.js +294 -0
  13. package/scripts/claude-smart.sh +18 -0
  14. package/scripts/claude-tmux.sh +50 -20
  15. package/scripts/damage-control-multi-agent.js +14 -10
  16. package/scripts/lib/bus-utils.js +3 -1
  17. package/scripts/lib/configure-detect.js +89 -8
  18. package/scripts/lib/configure-features.js +77 -10
  19. package/scripts/lib/configure-repair.js +6 -5
  20. package/scripts/lib/context-formatter.js +13 -3
  21. package/scripts/lib/damage-control-utils.js +5 -1
  22. package/scripts/lib/lifecycle-detector.js +5 -3
  23. package/scripts/lib/process-cleanup.js +8 -4
  24. package/scripts/lib/scale-detector.js +47 -8
  25. package/scripts/lib/signal-detectors.js +117 -59
  26. package/scripts/lib/task-registry.js +5 -1
  27. package/scripts/lib/team-events.js +4 -4
  28. package/scripts/messaging-bridge.js +7 -1
  29. package/scripts/precompact-context.sh +3 -0
  30. package/scripts/ralph-loop.js +10 -8
  31. package/scripts/smart-detect.js +32 -11
  32. package/scripts/team-manager.js +1 -1
  33. package/scripts/tmux-task-name.sh +75 -0
  34. package/scripts/tmux-task-watcher.sh +177 -0
  35. package/src/core/commands/babysit.md +75 -42
  36. package/src/core/commands/blockers.md +7 -7
  37. package/src/core/commands/configure.md +49 -63
  38. package/src/core/commands/discovery/brief.md +363 -0
  39. package/src/core/commands/discovery/new.md +395 -0
  40. package/src/core/commands/ideate/new.md +5 -5
  41. package/src/core/commands/logic/audit.md +5 -5
  42. package/src/core/commands/review.md +7 -1
  43. package/src/core/commands/rpi.md +61 -26
  44. package/src/core/commands/sprint.md +7 -6
  45. package/src/core/templates/product-brief.md +136 -0
  46. package/tools/cli/installers/ide/claude-code.js +67 -2
  47. package/src/core/agents/configuration/archival.md +0 -350
  48. package/src/core/agents/configuration/attribution.md +0 -343
  49. package/src/core/agents/configuration/ci.md +0 -1103
  50. package/src/core/agents/configuration/damage-control.md +0 -375
  51. package/src/core/agents/configuration/git-config.md +0 -537
  52. package/src/core/agents/configuration/hooks.md +0 -623
  53. package/src/core/agents/configuration/precompact.md +0 -302
  54. package/src/core/agents/configuration/status-line.md +0 -557
  55. package/src/core/agents/configuration/verify.md +0 -618
  56. package/src/core/agents/configuration-damage-control.md +0 -259
  57. package/src/core/agents/configuration-visual-e2e.md +0 -339
@@ -1,259 +0,0 @@
1
- ---
2
- name: configuration-damage-control
3
- description: Configure AgileFlow damage control to protect against destructive commands
4
- tools: Read, Write, Edit, Bash, Glob, Grep
5
- model: haiku
6
- team_role: utility
7
- ---
8
-
9
- <!-- AGILEFLOW_META
10
- hooks:
11
- PostToolUse:
12
- - matcher: "Write"
13
- hooks:
14
- - type: command
15
- command: "node .agileflow/hooks/validators/json-schema-validator.js"
16
- compact_context:
17
- priority: high
18
- preserve_rules:
19
- - "Use AskUserQuestion for all configuration choices"
20
- - "Copy hook scripts to .claude/hooks/damage-control/"
21
- - "Create patterns.yaml if not exists, PRESERVE if exists"
22
- - "Write PreToolUse hooks to .claude/settings.json"
23
- - "Never overwrite existing patterns without confirmation"
24
- state_fields:
25
- - damage_control_enabled
26
- - protection_level
27
- AGILEFLOW_META -->
28
-
29
-
30
- # Configuration: Damage Control
31
-
32
- Set up damage control protection to block destructive commands and protect sensitive paths.
33
-
34
- ---
35
-
36
- ## What This Does
37
-
38
- Damage control protects your codebase from destructive agent commands through PreToolUse hooks:
39
-
40
- 1. **Bash Command Validation** - Blocks dangerous commands like `rm -rf`, `DROP TABLE`, force pushes
41
- 2. **Path Protection** - Prevents access to sensitive files (`.env`, `~/.ssh/`, etc.)
42
- 3. **Ask Confirmation** - Prompts before risky-but-valid operations
43
-
44
- ---
45
-
46
- ## Configuration Steps
47
-
48
- ### Step 1: Ask User to Enable
49
-
50
- ```xml
51
- <invoke name="AskUserQuestion">
52
- <parameter name="questions">[{
53
- "question": "Enable damage control to protect against destructive commands?",
54
- "header": "Damage Control",
55
- "multiSelect": false,
56
- "options": [
57
- {"label": "Enable (Recommended)", "description": "Block dangerous commands and protect sensitive paths"},
58
- {"label": "Skip", "description": "No damage control (not recommended)"}
59
- ]
60
- }]</parameter>
61
- </invoke>
62
- ```
63
-
64
- If user selects "Skip", exit with message: "Damage control not enabled. Run /agileflow:configure to enable later."
65
-
66
- ### Step 2: Ask Protection Level
67
-
68
- ```xml
69
- <invoke name="AskUserQuestion">
70
- <parameter name="questions">[{
71
- "question": "Choose protection level:",
72
- "header": "Protection Level",
73
- "multiSelect": false,
74
- "options": [
75
- {"label": "Standard (Recommended)", "description": "Deterministic pattern matching - fast, no AI calls"},
76
- {"label": "Enhanced", "description": "Standard + AI prompt hook for unknown threats (slower)"}
77
- ]
78
- }]</parameter>
79
- </invoke>
80
- ```
81
-
82
- ### Step 3: Create Hooks Directory
83
-
84
- ```bash
85
- mkdir -p .claude/hooks/damage-control
86
- ```
87
-
88
- ### Step 4: Copy Hook Scripts
89
-
90
- Copy the following scripts from AgileFlow installation:
91
-
92
- ```bash
93
- # Source: .agileflow/scripts/damage-control/
94
- # Destination: .claude/hooks/damage-control/
95
-
96
- cp .agileflow/scripts/damage-control/bash-tool-damage-control.js .claude/hooks/damage-control/
97
- cp .agileflow/scripts/damage-control/edit-tool-damage-control.js .claude/hooks/damage-control/
98
- cp .agileflow/scripts/damage-control/write-tool-damage-control.js .claude/hooks/damage-control/
99
- ```
100
-
101
- ### Step 5: Create or Preserve patterns.yaml
102
-
103
- **If patterns.yaml does NOT exist**, copy the default:
104
-
105
- ```bash
106
- cp .agileflow/scripts/damage-control/patterns.yaml .claude/hooks/damage-control/
107
- ```
108
-
109
- **If patterns.yaml ALREADY exists**, preserve it (do not overwrite):
110
-
111
- ```
112
- patterns.yaml already exists - preserving existing rules.
113
- To update patterns, edit .claude/hooks/damage-control/patterns.yaml
114
- ```
115
-
116
- ### Step 6: Update settings.json
117
-
118
- Add PreToolUse hooks to `.claude/settings.json`:
119
-
120
- **For Standard protection:**
121
-
122
- ```json
123
- {
124
- "hooks": {
125
- "PreToolUse": [
126
- {
127
- "matcher": "Bash",
128
- "hooks": [{
129
- "type": "command",
130
- "command": "node $CLAUDE_PROJECT_DIR/.claude/hooks/damage-control/bash-tool-damage-control.js",
131
- "timeout": 5000
132
- }]
133
- },
134
- {
135
- "matcher": "Edit",
136
- "hooks": [{
137
- "type": "command",
138
- "command": "node $CLAUDE_PROJECT_DIR/.claude/hooks/damage-control/edit-tool-damage-control.js",
139
- "timeout": 5000
140
- }]
141
- },
142
- {
143
- "matcher": "Write",
144
- "hooks": [{
145
- "type": "command",
146
- "command": "node $CLAUDE_PROJECT_DIR/.claude/hooks/damage-control/write-tool-damage-control.js",
147
- "timeout": 5000
148
- }]
149
- }
150
- ]
151
- }
152
- }
153
- ```
154
-
155
- **For Enhanced protection (adds prompt hook):**
156
-
157
- Add to the Bash matcher:
158
-
159
- ```json
160
- {
161
- "matcher": "Bash",
162
- "hooks": [
163
- {
164
- "type": "command",
165
- "command": "node $CLAUDE_PROJECT_DIR/.claude/hooks/damage-control/bash-tool-damage-control.js",
166
- "timeout": 5000
167
- },
168
- {
169
- "type": "prompt",
170
- "prompt": "Evaluate if this bash command is destructive or could cause irreversible damage. Consider: Does it delete files recursively? Does it modify system files? Could it expose secrets? Block if dangerous."
171
- }
172
- ]
173
- }
174
- ```
175
-
176
- ### Step 7: Merge with Existing Hooks
177
-
178
- **IMPORTANT**: If PreToolUse hooks already exist in settings.json, MERGE the new hooks with existing ones. Do NOT replace existing hooks.
179
-
180
- Check for existing hooks:
181
- ```javascript
182
- // If settings.hooks.PreToolUse exists, append to it
183
- // If a matcher (Bash, Edit, Write) already exists, merge hooks array
184
- ```
185
-
186
- ### Step 8: Show Completion Summary
187
-
188
- ```
189
- Damage Control Enabled
190
-
191
- Protection level: Standard (or Enhanced)
192
-
193
- Protected against:
194
- - Destructive bash commands (rm -rf, DROP TABLE, etc.)
195
- - Access to sensitive paths (~/.ssh, .env, etc.)
196
- - Force pushes and hard resets
197
-
198
- Configuration:
199
- - Hook scripts: .claude/hooks/damage-control/
200
- - Patterns file: .claude/hooks/damage-control/patterns.yaml
201
- - Settings: .claude/settings.json
202
-
203
- To customize blocked patterns, edit:
204
- .claude/hooks/damage-control/patterns.yaml
205
-
206
- Restart Claude Code for hooks to take effect.
207
- ```
208
-
209
- ---
210
-
211
- ## Patterns.yaml Reference
212
-
213
- ```yaml
214
- # Block dangerous bash commands
215
- bashToolPatterns:
216
- - pattern: '\brm\s+-[rRf]'
217
- reason: "rm with recursive or force flags"
218
-
219
- # Commands requiring confirmation
220
- askPatterns:
221
- - pattern: 'git\s+push\s+.*--force'
222
- reason: "Force push overwrites history"
223
-
224
- # Path protection levels
225
- zeroAccessPaths: # Cannot read, write, edit, delete
226
- - ~/.ssh/
227
- - .env
228
-
229
- readOnlyPaths: # Can read, cannot modify
230
- - /etc/
231
- - package-lock.json
232
-
233
- noDeletePaths: # Can modify, cannot delete
234
- - .agileflow/
235
- - .claude/
236
- ```
237
-
238
- ---
239
-
240
- ## Troubleshooting
241
-
242
- **Hooks not working after enabling:**
243
- - Restart Claude Code - hooks only load on startup
244
-
245
- **Command blocked that should be allowed:**
246
- - Edit patterns.yaml to remove or adjust the pattern
247
- - Use `ask: true` instead of blocking
248
-
249
- **Need to disable damage control:**
250
- - Remove PreToolUse hooks from .claude/settings.json
251
- - Or delete .claude/hooks/damage-control/ directory
252
-
253
- ---
254
-
255
- ## Related
256
-
257
- - Research: `docs/10-research/20260106-claude-code-damage-control-hooks.md`
258
- - Patterns file: `.claude/hooks/damage-control/patterns.yaml`
259
- - Hook scripts: `.claude/hooks/damage-control/*.js`
@@ -1,339 +0,0 @@
1
- ---
2
- name: configuration-visual-e2e
3
- description: Configure Visual E2E testing infrastructure with Playwright and screenshot verification
4
- tools: Read, Write, Edit, Bash, Glob, Grep
5
- model: haiku
6
- team_role: utility
7
- ---
8
-
9
- <!-- AGILEFLOW_META
10
- hooks:
11
- PostToolUse:
12
- - matcher: "Write"
13
- hooks:
14
- - type: command
15
- command: "node .agileflow/hooks/validators/json-schema-validator.js"
16
- compact_context:
17
- priority: high
18
- preserve_rules:
19
- - "Install Playwright with npx playwright install --with-deps chromium"
20
- - "Create playwright.config.ts with webServer config for auto-starting dev server"
21
- - "Create tests/e2e/ directory with example test that takes screenshots"
22
- - "Create screenshots/ directory for visual verification workflow"
23
- - "Add test:e2e script to package.json"
24
- - "All screenshots must be visually reviewed and renamed with 'verified-' prefix"
25
- - "Use TaskCreate/TaskUpdate to track all 8 setup steps"
26
- - "Run example test after setup to verify it works"
27
- state_fields:
28
- - playwright_installed
29
- - config_created
30
- - example_test_created
31
- - screenshots_dir_created
32
- AGILEFLOW_META -->
33
-
34
-
35
- # Configuration: Visual E2E Testing
36
-
37
- Set up Visual E2E testing infrastructure with Playwright and screenshot verification workflow for reliable UI development.
38
-
39
- ---
40
-
41
- ## What This Does
42
-
43
- Visual E2E testing catches issues that functional tests miss:
44
-
45
- 1. **Playwright Setup** - Install test runner and chromium browser
46
- 2. **Screenshot Capture** - E2E tests capture screenshots during test runs
47
- 3. **Visual Verification** - Claude reviews screenshots before marking UI work complete
48
- 4. **Auto-Start Dev Server** - webServer config auto-starts dev server for tests
49
-
50
- ---
51
-
52
- ## Configuration Steps
53
-
54
- ### Step 1: Check Prerequisites
55
-
56
- ```bash
57
- # Verify package.json exists
58
- ls package.json
59
- ```
60
-
61
- If no package.json, exit with: "This project needs a package.json. Run `npm init` first."
62
-
63
- ### Step 2: Ask User to Proceed
64
-
65
- ```xml
66
- <invoke name="AskUserQuestion">
67
- <parameter name="questions">[{
68
- "question": "Set up Visual E2E testing with Playwright?",
69
- "header": "Visual E2E",
70
- "multiSelect": false,
71
- "options": [
72
- {"label": "Yes, install Playwright (Recommended)", "description": "~300MB for chromium browser, creates tests/e2e/ and screenshots/"},
73
- {"label": "Skip", "description": "No Visual E2E setup"}
74
- ]
75
- }]</parameter>
76
- </invoke>
77
- ```
78
-
79
- If user selects "Skip", exit with: "Visual E2E setup skipped. Run /agileflow:configure to set up later."
80
-
81
- ### Step 3: Ask Dev Server Configuration
82
-
83
- ```xml
84
- <invoke name="AskUserQuestion">
85
- <parameter name="questions">[{
86
- "question": "What command starts your dev server?",
87
- "header": "Dev Server",
88
- "multiSelect": false,
89
- "options": [
90
- {"label": "npm run dev", "description": "Default Next.js/Vite command"},
91
- {"label": "npm start", "description": "Create React App default"},
92
- {"label": "yarn dev", "description": "Yarn package manager"}
93
- ]
94
- }]</parameter>
95
- </invoke>
96
- ```
97
-
98
- ### Step 4: Install Playwright
99
-
100
- ```bash
101
- # Install Playwright test runner
102
- npm install --save-dev @playwright/test
103
-
104
- # Install chromium browser (smallest option, ~300MB)
105
- npx playwright install --with-deps chromium
106
- ```
107
-
108
- ### Step 5: Create playwright.config.ts
109
-
110
- Create `playwright.config.ts` in project root:
111
-
112
- ```typescript
113
- import { defineConfig, devices } from '@playwright/test';
114
-
115
- export default defineConfig({
116
- testDir: './tests/e2e',
117
-
118
- // Run tests in parallel
119
- fullyParallel: true,
120
-
121
- // Fail the build on CI if you accidentally left test.only
122
- forbidOnly: !!process.env.CI,
123
-
124
- // Retry on CI only
125
- retries: process.env.CI ? 2 : 0,
126
-
127
- // Opt out of parallel tests on CI
128
- workers: process.env.CI ? 1 : undefined,
129
-
130
- // Reporter
131
- reporter: 'html',
132
-
133
- use: {
134
- // Base URL for navigation
135
- baseURL: 'http://localhost:3000',
136
-
137
- // Capture screenshot on every test
138
- screenshot: 'on',
139
-
140
- // Collect trace on failure
141
- trace: 'on-first-retry',
142
- },
143
-
144
- // Configure webServer to auto-start dev server
145
- webServer: {
146
- command: 'npm run dev', // Replace with user's choice from Step 3
147
- url: 'http://localhost:3000',
148
- reuseExistingServer: !process.env.CI,
149
- timeout: 120000,
150
- },
151
-
152
- projects: [
153
- {
154
- name: 'chromium',
155
- use: { ...devices['Desktop Chrome'] },
156
- },
157
- ],
158
- });
159
- ```
160
-
161
- ### Step 6: Create Directory Structure
162
-
163
- ```bash
164
- # Create tests/e2e directory
165
- mkdir -p tests/e2e
166
-
167
- # Create screenshots directory
168
- mkdir -p screenshots
169
- ```
170
-
171
- ### Step 7: Create Example Test
172
-
173
- Create `tests/e2e/visual-example.spec.ts`:
174
-
175
- ```typescript
176
- import { test, expect } from '@playwright/test';
177
-
178
- test.describe('Visual Verification Examples', () => {
179
- test('homepage loads correctly', async ({ page }) => {
180
- await page.goto('/');
181
-
182
- // Capture full-page screenshot for visual verification
183
- await page.screenshot({
184
- path: 'screenshots/homepage-full.png',
185
- fullPage: true,
186
- });
187
-
188
- // Basic assertions
189
- await expect(page).toHaveTitle(/./);
190
- });
191
-
192
- test('component renders correctly', async ({ page }) => {
193
- await page.goto('/');
194
-
195
- // Capture specific element screenshot
196
- const header = page.locator('header').first();
197
- if (await header.isVisible()) {
198
- await header.screenshot({
199
- path: 'screenshots/header-component.png',
200
- });
201
- }
202
-
203
- // Verify element is visible
204
- await expect(header).toBeVisible();
205
- });
206
- });
207
- ```
208
-
209
- ### Step 8: Add npm Scripts
210
-
211
- Add to package.json scripts:
212
-
213
- ```json
214
- {
215
- "scripts": {
216
- "test:e2e": "playwright test",
217
- "test:e2e:ui": "playwright test --ui",
218
- "test:e2e:headed": "playwright test --headed"
219
- }
220
- }
221
- ```
222
-
223
- ### Step 9: Run Verification Test
224
-
225
- ```bash
226
- npm run test:e2e
227
- ```
228
-
229
- ### Step 10: Update Metadata
230
-
231
- Update `docs/00-meta/agileflow-metadata.json` to register Visual E2E as enabled:
232
-
233
- ```javascript
234
- // Read existing metadata
235
- const metadataPath = 'docs/00-meta/agileflow-metadata.json';
236
- const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf8'));
237
-
238
- // Add visual_e2e feature
239
- metadata.features = metadata.features || {};
240
- metadata.features.visual_e2e = {
241
- enabled: true,
242
- version: "2.83.0",
243
- at: new Date().toISOString(),
244
- screenshots_dir: "screenshots/",
245
- playwright_config: "playwright.config.ts"
246
- };
247
-
248
- // Update the updated timestamp
249
- metadata.updated = new Date().toISOString();
250
-
251
- // Write back
252
- fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2) + '\n');
253
- ```
254
-
255
- This enables automatic detection by `obtain-context.js` so agents know Visual E2E is available.
256
-
257
- ### Step 11: Show Completion Summary
258
-
259
- ```
260
- Visual E2E Setup Complete
261
-
262
- Installed:
263
- - @playwright/test
264
- - chromium browser
265
-
266
- Created:
267
- - playwright.config.ts (with webServer auto-start)
268
- - tests/e2e/visual-example.spec.ts (example test)
269
- - screenshots/ (for visual verification)
270
-
271
- Added scripts to package.json:
272
- - npm run test:e2e Run all e2e tests
273
- - npm run test:e2e:ui Run with Playwright UI
274
- - npm run test:e2e:headed Run with visible browser
275
-
276
- Visual Verification Workflow:
277
- 1. Run tests: npm run test:e2e
278
- 2. Review screenshots in screenshots/
279
- 3. Rename verified: mv file.png verified-file.png
280
- 4. Verify all: node scripts/screenshot-verifier.js
281
-
282
- Why Visual Mode?
283
- Tests passing doesn't mean UI looks correct. A button can "work"
284
- but be the wrong color, position, or missing entirely.
285
- Visual verification catches these issues.
286
- ```
287
-
288
- ---
289
-
290
- ## Visual Verification Workflow
291
-
292
- After running tests:
293
-
294
- 1. **Review screenshots**: Read each screenshot in screenshots/
295
- 2. **Verify visually**: Check that UI looks correct
296
- 3. **Rename verified**: `mv screenshots/homepage.png screenshots/verified-homepage.png`
297
- 4. **Run verifier**: `node scripts/screenshot-verifier.js --path ./screenshots`
298
-
299
- This ensures Claude actually looked at each screenshot before declaring completion.
300
-
301
- ---
302
-
303
- ## Integration with Ralph Loop
304
-
305
- When using Visual Mode in Ralph Loop:
306
-
307
- ```bash
308
- # Initialize loop with Visual Mode
309
- node scripts/ralph-loop.js --init --epic=EP-XXXX --visual
310
-
311
- # Loop checks:
312
- # 1. npm test passes
313
- # 2. All screenshots have verified- prefix
314
- # 3. Minimum 2 iterations completed
315
- ```
316
-
317
- Visual Mode prevents premature completion promises for UI work.
318
-
319
- ---
320
-
321
- ## Troubleshooting
322
-
323
- **Tests fail with "No server running":**
324
- - Ensure webServer command matches your dev server command
325
- - Check the port number in baseURL matches your app
326
-
327
- **Screenshots directory empty:**
328
- - Tests must include `await page.screenshot({path: 'screenshots/...'})` calls
329
- - Check test output for errors
330
-
331
- **Browser not installed:**
332
- - Run `npx playwright install --with-deps chromium`
333
-
334
- ---
335
-
336
- ## Related
337
-
338
- - Playwright docs: https://playwright.dev/docs/intro
339
- - webServer config: https://playwright.dev/docs/test-webserver