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.
- package/CHANGELOG.md +10 -0
- package/README.md +6 -6
- package/lib/api-server.js +3 -2
- package/lib/dashboard-server.js +131 -50
- package/lib/flag-detection.js +4 -2
- package/lib/git-operations.js +4 -2
- package/lib/process-executor.js +24 -9
- package/lib/skill-loader.js +11 -3
- package/package.json +1 -1
- package/scripts/agileflow-welcome.js +65 -25
- package/scripts/archive-completed-stories.sh +3 -0
- package/scripts/ci-summary.js +294 -0
- package/scripts/claude-smart.sh +18 -0
- package/scripts/claude-tmux.sh +50 -20
- package/scripts/damage-control-multi-agent.js +14 -10
- package/scripts/lib/bus-utils.js +3 -1
- package/scripts/lib/configure-detect.js +89 -8
- package/scripts/lib/configure-features.js +77 -10
- package/scripts/lib/configure-repair.js +6 -5
- package/scripts/lib/context-formatter.js +13 -3
- package/scripts/lib/damage-control-utils.js +5 -1
- package/scripts/lib/lifecycle-detector.js +5 -3
- package/scripts/lib/process-cleanup.js +8 -4
- package/scripts/lib/scale-detector.js +47 -8
- package/scripts/lib/signal-detectors.js +117 -59
- package/scripts/lib/task-registry.js +5 -1
- package/scripts/lib/team-events.js +4 -4
- package/scripts/messaging-bridge.js +7 -1
- package/scripts/precompact-context.sh +3 -0
- package/scripts/ralph-loop.js +10 -8
- package/scripts/smart-detect.js +32 -11
- package/scripts/team-manager.js +1 -1
- package/scripts/tmux-task-name.sh +75 -0
- package/scripts/tmux-task-watcher.sh +177 -0
- package/src/core/commands/babysit.md +75 -42
- package/src/core/commands/blockers.md +7 -7
- package/src/core/commands/configure.md +49 -63
- package/src/core/commands/discovery/brief.md +363 -0
- package/src/core/commands/discovery/new.md +395 -0
- package/src/core/commands/ideate/new.md +5 -5
- package/src/core/commands/logic/audit.md +5 -5
- package/src/core/commands/review.md +7 -1
- package/src/core/commands/rpi.md +61 -26
- package/src/core/commands/sprint.md +7 -6
- package/src/core/templates/product-brief.md +136 -0
- package/tools/cli/installers/ide/claude-code.js +67 -2
- package/src/core/agents/configuration/archival.md +0 -350
- package/src/core/agents/configuration/attribution.md +0 -343
- package/src/core/agents/configuration/ci.md +0 -1103
- package/src/core/agents/configuration/damage-control.md +0 -375
- package/src/core/agents/configuration/git-config.md +0 -537
- package/src/core/agents/configuration/hooks.md +0 -623
- package/src/core/agents/configuration/precompact.md +0 -302
- package/src/core/agents/configuration/status-line.md +0 -557
- package/src/core/agents/configuration/verify.md +0 -618
- package/src/core/agents/configuration-damage-control.md +0 -259
- package/src/core/agents/configuration-visual-e2e.md +0 -339
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: configuration-damage-control
|
|
3
|
-
description: Configure AgileFlow damage control to protect against destructive commands
|
|
4
|
-
tools:
|
|
5
|
-
- Read
|
|
6
|
-
- Write
|
|
7
|
-
- Edit
|
|
8
|
-
- Bash
|
|
9
|
-
- Glob
|
|
10
|
-
- Grep
|
|
11
|
-
model: haiku
|
|
12
|
-
team_role: teammate
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# Configuration Agent: Damage Control
|
|
17
|
-
|
|
18
|
-
Configure PreToolUse hooks to protect your codebase from destructive agent commands.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## STEP 0: Gather Context (MANDATORY)
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
node .agileflow/scripts/obtain-context.js configuration-damage-control
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## What Is Damage Control?
|
|
31
|
-
|
|
32
|
-
Damage control uses Claude Code's PreToolUse hooks to validate commands BEFORE they execute:
|
|
33
|
-
|
|
34
|
-
**Three Protection Layers:**
|
|
35
|
-
1. **Bash Tool Hook** - Blocks dangerous commands (rm -rf, DROP TABLE, etc.)
|
|
36
|
-
2. **Edit Tool Hook** - Prevents editing protected files
|
|
37
|
-
3. **Write Tool Hook** - Prevents writing to protected locations
|
|
38
|
-
|
|
39
|
-
**Path Protection Levels:**
|
|
40
|
-
| Level | Read | Write | Edit | Delete |
|
|
41
|
-
|-------|------|-------|------|--------|
|
|
42
|
-
| Zero Access | No | No | No | No |
|
|
43
|
-
| Read-Only | Yes | No | No | No |
|
|
44
|
-
| No Delete | Yes | Yes | Yes | No |
|
|
45
|
-
|
|
46
|
-
**Protection Modes:**
|
|
47
|
-
- **Standard** (recommended): Deterministic pattern matching - fast and reliable
|
|
48
|
-
- **Enhanced**: Standard + AI prompt hook for unknown threats - slower but thorough
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## IMMEDIATE ACTIONS
|
|
53
|
-
|
|
54
|
-
### Step 1: Check Current Status
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# Check if patterns file exists
|
|
58
|
-
if [ -f ".agileflow/config/damage-control-patterns.yaml" ]; then
|
|
59
|
-
echo "STATUS: Damage control patterns configured"
|
|
60
|
-
PATTERNS_EXIST=true
|
|
61
|
-
else
|
|
62
|
-
echo "STATUS: No patterns file found"
|
|
63
|
-
PATTERNS_EXIST=false
|
|
64
|
-
fi
|
|
65
|
-
|
|
66
|
-
# Check if hooks are in settings.json
|
|
67
|
-
if [ -f ".claude/settings.json" ] && grep -q "damage-control" .claude/settings.json 2>/dev/null; then
|
|
68
|
-
echo "STATUS: PreToolUse hooks configured"
|
|
69
|
-
HOOKS_EXIST=true
|
|
70
|
-
else
|
|
71
|
-
echo "STATUS: No hooks configured"
|
|
72
|
-
HOOKS_EXIST=false
|
|
73
|
-
fi
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Step 2: Determine Action
|
|
77
|
-
|
|
78
|
-
**If NOT configured** (first time setup):
|
|
79
|
-
- Proceed to Step 3 (Protection Level)
|
|
80
|
-
|
|
81
|
-
**If ALREADY configured**:
|
|
82
|
-
- Use AskUserQuestion to offer reconfiguration options:
|
|
83
|
-
|
|
84
|
-
```xml
|
|
85
|
-
<invoke name="AskUserQuestion">
|
|
86
|
-
<parameter name="questions">[{
|
|
87
|
-
"question": "Damage control is already configured. What would you like to do?",
|
|
88
|
-
"header": "Options",
|
|
89
|
-
"multiSelect": false,
|
|
90
|
-
"options": [
|
|
91
|
-
{"label": "Change protection level", "description": "Switch between Standard/Enhanced"},
|
|
92
|
-
{"label": "Add custom patterns", "description": "Block additional commands or protect more paths"},
|
|
93
|
-
{"label": "View current config", "description": "Show what's protected"},
|
|
94
|
-
{"label": "Disable damage control", "description": "Remove all hooks"},
|
|
95
|
-
{"label": "Keep current", "description": "Exit without changes"}
|
|
96
|
-
]
|
|
97
|
-
}]</parameter>
|
|
98
|
-
</invoke>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Step 3: Choose Protection Level
|
|
102
|
-
|
|
103
|
-
```xml
|
|
104
|
-
<invoke name="AskUserQuestion">
|
|
105
|
-
<parameter name="questions">[{
|
|
106
|
-
"question": "What protection level would you like?",
|
|
107
|
-
"header": "Level",
|
|
108
|
-
"multiSelect": false,
|
|
109
|
-
"options": [
|
|
110
|
-
{"label": "Standard (Recommended)", "description": "Fast deterministic hooks - blocks known dangerous patterns"},
|
|
111
|
-
{"label": "Enhanced", "description": "Standard + AI evaluation for unknown threats (adds latency)"},
|
|
112
|
-
{"label": "Minimal", "description": "Path protection only - no command pattern matching"}
|
|
113
|
-
]
|
|
114
|
-
}]</parameter>
|
|
115
|
-
</invoke>
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Step 4: Ask About Custom Protections
|
|
119
|
-
|
|
120
|
-
```xml
|
|
121
|
-
<invoke name="AskUserQuestion">
|
|
122
|
-
<parameter name="questions">[{
|
|
123
|
-
"question": "Any additional protections to enable?",
|
|
124
|
-
"header": "Custom",
|
|
125
|
-
"multiSelect": true,
|
|
126
|
-
"options": [
|
|
127
|
-
{"label": "Production database commands", "description": "Block psql/mysql/mongo production connections"},
|
|
128
|
-
{"label": "Cloud CLI destructive ops", "description": "Block aws/gcloud/az delete commands"},
|
|
129
|
-
{"label": "Extra env file protection", "description": "Block all .env.* and secrets.* files"},
|
|
130
|
-
{"label": "AI attribution blocking", "description": "Block Co-Authored-By: Claude/AI/GPT in git commits"},
|
|
131
|
-
{"label": "Use defaults only", "description": "No additional protections needed"}
|
|
132
|
-
]
|
|
133
|
-
}]</parameter>
|
|
134
|
-
</invoke>
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Step 5: Create Configuration Directory
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
mkdir -p .agileflow/config
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Step 6: Deploy Patterns File
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
# Copy from templates if not exists, or if user wants reset
|
|
147
|
-
if [ ! -f ".agileflow/config/damage-control-patterns.yaml" ]; then
|
|
148
|
-
if [ -f ".agileflow/templates/damage-control-patterns.yaml" ]; then
|
|
149
|
-
cp .agileflow/templates/damage-control-patterns.yaml .agileflow/config/damage-control-patterns.yaml
|
|
150
|
-
echo "Deployed default patterns"
|
|
151
|
-
fi
|
|
152
|
-
fi
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Step 7: Add Custom Patterns (if selected)
|
|
156
|
-
|
|
157
|
-
Based on user selections from Step 4, append to patterns file:
|
|
158
|
-
|
|
159
|
-
**Production database commands:**
|
|
160
|
-
```yaml
|
|
161
|
-
# Production database protection (added by configure)
|
|
162
|
-
- pattern: 'psql\s+.*production'
|
|
163
|
-
reason: "Production database access blocked"
|
|
164
|
-
- pattern: 'mysql\s+.*-h\s+.*prod'
|
|
165
|
-
reason: "Production MySQL access blocked"
|
|
166
|
-
- pattern: 'mongo.*mongodb\+srv.*prod'
|
|
167
|
-
reason: "Production MongoDB access blocked"
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
**Cloud CLI destructive ops:**
|
|
171
|
-
```yaml
|
|
172
|
-
# Cloud CLI protection (added by configure)
|
|
173
|
-
- pattern: '\baws\s+s3\s+rm'
|
|
174
|
-
reason: "AWS S3 delete blocked"
|
|
175
|
-
- pattern: '\baws\s+ec2\s+terminate'
|
|
176
|
-
reason: "AWS EC2 terminate blocked"
|
|
177
|
-
- pattern: '\bgcloud\s+compute\s+instances\s+delete'
|
|
178
|
-
reason: "GCloud instance delete blocked"
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
**Extra env file protection** - add to zeroAccessPaths:
|
|
182
|
-
```yaml
|
|
183
|
-
- ".env.*"
|
|
184
|
-
- "secrets.*"
|
|
185
|
-
- "credentials.*"
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**AI attribution blocking** - add to bashToolPatterns:
|
|
189
|
-
```yaml
|
|
190
|
-
# AI Attribution Prevention (added by configure)
|
|
191
|
-
# Match actual footer format: Co-Authored-By with AI name and email
|
|
192
|
-
- pattern: 'Co-Authored-By:\s*(Claude|AI|GPT|Copilot|Anthropic)[^/]*<[^>]+>'
|
|
193
|
-
reason: "AI co-author attribution blocked - follow project commit policy"
|
|
194
|
-
flags: "i"
|
|
195
|
-
|
|
196
|
-
- pattern: '🤖\s*(Generated|Created|Written)'
|
|
197
|
-
reason: "AI emoji attribution blocked - follow project commit policy"
|
|
198
|
-
|
|
199
|
-
- pattern: '\[Claude Code\]\(https?://'
|
|
200
|
-
reason: "Claude Code attribution links blocked - follow project commit policy"
|
|
201
|
-
flags: "i"
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Step 8: Configure PreToolUse Hooks
|
|
205
|
-
|
|
206
|
-
Read current settings.json and merge damage control hooks:
|
|
207
|
-
|
|
208
|
-
```javascript
|
|
209
|
-
// This is the hook configuration to add/merge
|
|
210
|
-
const damageControlHooks = {
|
|
211
|
-
PreToolUse: [
|
|
212
|
-
{
|
|
213
|
-
matcher: "Bash",
|
|
214
|
-
hooks: [{
|
|
215
|
-
type: "command",
|
|
216
|
-
command: `node ${process.cwd()}/.agileflow/scripts/damage-control-bash.js`,
|
|
217
|
-
timeout: 5
|
|
218
|
-
}]
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
matcher: "Edit",
|
|
222
|
-
hooks: [{
|
|
223
|
-
type: "command",
|
|
224
|
-
command: `node ${process.cwd()}/.agileflow/scripts/damage-control-edit.js`,
|
|
225
|
-
timeout: 5
|
|
226
|
-
}]
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
matcher: "Write",
|
|
230
|
-
hooks: [{
|
|
231
|
-
type: "command",
|
|
232
|
-
command: `node ${process.cwd()}/.agileflow/scripts/damage-control-write.js`,
|
|
233
|
-
timeout: 5
|
|
234
|
-
}]
|
|
235
|
-
}
|
|
236
|
-
]
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// For Enhanced protection, add prompt hook to Bash:
|
|
240
|
-
// {
|
|
241
|
-
// type: "prompt",
|
|
242
|
-
// prompt: "Evaluate if this bash command could cause destructive or irreversible changes to files, databases, or systems. If dangerous, block it."
|
|
243
|
-
// }
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
**Implementation:**
|
|
247
|
-
1. Read existing `.claude/settings.json` (create if missing)
|
|
248
|
-
2. Initialize `hooks.PreToolUse` array if missing
|
|
249
|
-
3. Remove any existing damage-control hooks (to allow reconfiguration)
|
|
250
|
-
4. Add the new hooks
|
|
251
|
-
5. Write back to settings.json
|
|
252
|
-
|
|
253
|
-
### Step 9: Update Metadata
|
|
254
|
-
|
|
255
|
-
```bash
|
|
256
|
-
node -e "
|
|
257
|
-
const fs = require('fs');
|
|
258
|
-
const metaPath = 'docs/00-meta/agileflow-metadata.json';
|
|
259
|
-
|
|
260
|
-
// Ensure directory exists
|
|
261
|
-
fs.mkdirSync('docs/00-meta', { recursive: true });
|
|
262
|
-
|
|
263
|
-
// Read or create metadata
|
|
264
|
-
let meta = {};
|
|
265
|
-
if (fs.existsSync(metaPath)) {
|
|
266
|
-
meta = JSON.parse(fs.readFileSync(metaPath, 'utf8'));
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// Update damage control feature
|
|
270
|
-
meta.features = meta.features || {};
|
|
271
|
-
meta.features.damageControl = {
|
|
272
|
-
enabled: true,
|
|
273
|
-
protectionLevel: 'LEVEL_HERE', // Replace with actual selection
|
|
274
|
-
version: '2.78.0',
|
|
275
|
-
configured_at: new Date().toISOString()
|
|
276
|
-
};
|
|
277
|
-
meta.updated = new Date().toISOString();
|
|
278
|
-
|
|
279
|
-
fs.writeFileSync(metaPath, JSON.stringify(meta, null, 2));
|
|
280
|
-
console.log('Updated metadata');
|
|
281
|
-
"
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### Step 10: Verify Scripts Exist
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
# Verify all required scripts exist
|
|
288
|
-
MISSING=false
|
|
289
|
-
for script in damage-control-bash.js damage-control-edit.js damage-control-write.js; do
|
|
290
|
-
if [ ! -f ".agileflow/scripts/$script" ]; then
|
|
291
|
-
echo "WARNING: Missing .agileflow/scripts/$script"
|
|
292
|
-
MISSING=true
|
|
293
|
-
fi
|
|
294
|
-
done
|
|
295
|
-
|
|
296
|
-
if [ "$MISSING" = "true" ]; then
|
|
297
|
-
echo "Some scripts missing. Run 'npx agileflow update' to restore."
|
|
298
|
-
fi
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
---
|
|
302
|
-
|
|
303
|
-
## Success Output
|
|
304
|
-
|
|
305
|
-
Display formatted success message:
|
|
306
|
-
|
|
307
|
-
```
|
|
308
|
-
Damage Control Configured!
|
|
309
|
-
|
|
310
|
-
Protection Level: [Standard/Enhanced]
|
|
311
|
-
|
|
312
|
-
Hooks Enabled:
|
|
313
|
-
Bash Tool: Validates commands against patterns
|
|
314
|
-
Edit Tool: Enforces path access controls
|
|
315
|
-
Write Tool: Enforces path access controls
|
|
316
|
-
|
|
317
|
-
Protected Paths:
|
|
318
|
-
Zero Access: ~/.ssh/, ~/.aws/, .env files
|
|
319
|
-
Read-Only: ~/.bashrc, package-lock.json
|
|
320
|
-
No Delete: .agileflow/, .claude/, status.json
|
|
321
|
-
|
|
322
|
-
Blocked Patterns: [N] bash patterns, [N] ask-first patterns
|
|
323
|
-
|
|
324
|
-
Files Updated:
|
|
325
|
-
.agileflow/config/damage-control-patterns.yaml
|
|
326
|
-
.claude/settings.json
|
|
327
|
-
|
|
328
|
-
To customize: Edit .agileflow/config/damage-control-patterns.yaml
|
|
329
|
-
To test: Try running 'rm -rf /' (will be blocked)
|
|
330
|
-
|
|
331
|
-
═══════════════════════════════════════════════════════════
|
|
332
|
-
RESTART CLAUDE CODE NOW!
|
|
333
|
-
Quit completely (Cmd+Q / Ctrl+Q), wait 5 seconds, restart
|
|
334
|
-
Hooks only take effect after restart!
|
|
335
|
-
═══════════════════════════════════════════════════════════
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
|
-
## Disable Damage Control
|
|
341
|
-
|
|
342
|
-
If user selects "Disable":
|
|
343
|
-
|
|
344
|
-
1. Remove damage-control hooks from `.claude/settings.json`
|
|
345
|
-
2. Update metadata to show disabled:
|
|
346
|
-
```javascript
|
|
347
|
-
meta.features.damageControl = {
|
|
348
|
-
enabled: false,
|
|
349
|
-
disabled_at: new Date().toISOString()
|
|
350
|
-
};
|
|
351
|
-
```
|
|
352
|
-
3. Keep patterns file (user may re-enable later)
|
|
353
|
-
4. Show restart reminder
|
|
354
|
-
|
|
355
|
-
---
|
|
356
|
-
|
|
357
|
-
## View Current Config
|
|
358
|
-
|
|
359
|
-
If user selects "View current config":
|
|
360
|
-
|
|
361
|
-
1. Read and display `.agileflow/config/damage-control-patterns.yaml`
|
|
362
|
-
2. Count patterns in each category
|
|
363
|
-
3. List protected paths
|
|
364
|
-
4. Show whether Enhanced mode is enabled
|
|
365
|
-
|
|
366
|
-
---
|
|
367
|
-
|
|
368
|
-
## Rules
|
|
369
|
-
|
|
370
|
-
- **ALWAYS use AskUserQuestion** for user choices - never ask users to type
|
|
371
|
-
- **MERGE hooks** into existing settings.json - don't overwrite other hooks
|
|
372
|
-
- **VERIFY scripts exist** before enabling hooks
|
|
373
|
-
- **UPDATE metadata** for version tracking
|
|
374
|
-
- **SHOW restart banner** at the end - hooks require Claude Code restart
|
|
375
|
-
- **FAIL-OPEN principle** - if something goes wrong, don't break existing functionality
|