agileflow 2.84.2 → 2.86.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 +3 -3
- package/lib/colors.js +23 -0
- package/package.json +1 -1
- package/scripts/agileflow-statusline.sh +31 -44
- package/scripts/agileflow-welcome.js +378 -132
- package/scripts/batch-pmap-loop.js +528 -0
- package/scripts/lib/colors.sh +106 -0
- package/scripts/lib/file-tracking.js +5 -3
- package/scripts/obtain-context.js +132 -20
- package/scripts/session-boundary.js +138 -0
- package/scripts/session-manager.js +526 -7
- package/scripts/test-session-boundary.js +80 -0
- package/src/core/agents/mentor.md +40 -2
- package/src/core/agents/orchestrator.md +35 -2
- package/src/core/commands/babysit.md +198 -674
- package/src/core/commands/batch.md +117 -2
- package/src/core/commands/metrics.md +62 -9
- package/src/core/commands/rpi.md +500 -0
- package/src/core/commands/session/new.md +90 -51
- package/src/core/commands/session/resume.md +40 -16
- package/src/core/commands/session/status.md +35 -2
- package/src/core/templates/session-state.json +32 -3
- package/tools/cli/commands/config.js +43 -21
- package/tools/cli/commands/doctor.js +8 -5
- package/tools/cli/commands/setup.js +14 -7
- package/tools/cli/commands/uninstall.js +8 -5
- package/tools/cli/commands/update.js +20 -10
- package/tools/cli/lib/content-injector.js +80 -0
- package/tools/cli/lib/error-handler.js +173 -0
- package/tools/cli/lib/ui.js +3 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* test-session-boundary.js - Test session boundary hook logic
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node test-session-boundary.js --active=/path/to/session --file=/path/to/file
|
|
7
|
+
*
|
|
8
|
+
* Examples:
|
|
9
|
+
* node test-session-boundary.js --active=/home/coder/project-bugfix --file=/home/coder/project-bugfix/src/App.tsx
|
|
10
|
+
* → ALLOWED (file is inside active session)
|
|
11
|
+
*
|
|
12
|
+
* node test-session-boundary.js --active=/home/coder/project-bugfix --file=/home/coder/project/src/App.tsx
|
|
13
|
+
* → BLOCKED (file is outside active session)
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const path = require('path');
|
|
17
|
+
|
|
18
|
+
// Parse arguments
|
|
19
|
+
const args = process.argv.slice(2);
|
|
20
|
+
let activeSessionPath = null;
|
|
21
|
+
let filePath = null;
|
|
22
|
+
|
|
23
|
+
for (const arg of args) {
|
|
24
|
+
if (arg.startsWith('--active=')) {
|
|
25
|
+
activeSessionPath = arg.slice('--active='.length);
|
|
26
|
+
} else if (arg.startsWith('--file=')) {
|
|
27
|
+
filePath = arg.slice('--file='.length);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Show usage if missing args
|
|
32
|
+
if (!activeSessionPath || !filePath) {
|
|
33
|
+
console.log(`
|
|
34
|
+
Session Boundary Hook Tester
|
|
35
|
+
|
|
36
|
+
Usage:
|
|
37
|
+
node test-session-boundary.js --active=<session_path> --file=<file_path>
|
|
38
|
+
|
|
39
|
+
Examples:
|
|
40
|
+
# File INSIDE active session (should be ALLOWED)
|
|
41
|
+
node test-session-boundary.js \\
|
|
42
|
+
--active=/home/coder/project-bugfix \\
|
|
43
|
+
--file=/home/coder/project-bugfix/src/App.tsx
|
|
44
|
+
|
|
45
|
+
# File OUTSIDE active session (should be BLOCKED)
|
|
46
|
+
node test-session-boundary.js \\
|
|
47
|
+
--active=/home/coder/project-bugfix \\
|
|
48
|
+
--file=/home/coder/project/src/App.tsx
|
|
49
|
+
`);
|
|
50
|
+
process.exit(0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Normalize paths
|
|
54
|
+
const normalizedActive = path.resolve(activeSessionPath);
|
|
55
|
+
const normalizedFile = path.resolve(filePath);
|
|
56
|
+
|
|
57
|
+
console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
58
|
+
console.log('Session Boundary Check');
|
|
59
|
+
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
|
|
60
|
+
|
|
61
|
+
console.log(`Active Session Path: ${normalizedActive}`);
|
|
62
|
+
console.log(`File Being Edited: ${normalizedFile}`);
|
|
63
|
+
console.log('');
|
|
64
|
+
|
|
65
|
+
// Check if file is within active session path
|
|
66
|
+
const isInsideSession = normalizedFile.startsWith(normalizedActive + path.sep) ||
|
|
67
|
+
normalizedFile === normalizedActive;
|
|
68
|
+
|
|
69
|
+
if (isInsideSession) {
|
|
70
|
+
console.log('✅ ALLOWED - File is inside the active session directory');
|
|
71
|
+
console.log('');
|
|
72
|
+
console.log('The hook would exit(0) and allow this edit.');
|
|
73
|
+
} else {
|
|
74
|
+
console.log('❌ BLOCKED - File is OUTSIDE the active session directory!');
|
|
75
|
+
console.log('');
|
|
76
|
+
console.log('The hook would exit(2) and block this edit with message:');
|
|
77
|
+
console.log(` "Edit blocked: ${normalizedFile} is outside active session ${normalizedActive}"`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
|
|
@@ -447,8 +447,46 @@ Before implementing, evaluate task complexity:
|
|
|
447
447
|
3. Design implementation approach
|
|
448
448
|
4. Present plan with file paths and steps
|
|
449
449
|
5. Clarify decisions with user
|
|
450
|
-
6.
|
|
451
|
-
7.
|
|
450
|
+
6. **PLAN REVIEW CHECKPOINT** (see below)
|
|
451
|
+
7. Get approval → `ExitPlanMode`
|
|
452
|
+
8. Implement the approved plan
|
|
453
|
+
|
|
454
|
+
### Plan Review Checkpoint (CRITICAL)
|
|
455
|
+
|
|
456
|
+
**Before transitioning from plan → implement, ALWAYS display:**
|
|
457
|
+
|
|
458
|
+
```markdown
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## Plan Review Checkpoint
|
|
462
|
+
|
|
463
|
+
**Leverage Reminder:**
|
|
464
|
+
```
|
|
465
|
+
Bad line of code = 1 bad line
|
|
466
|
+
Bad part of plan = 100+ bad lines
|
|
467
|
+
Bad line of research = entire direction is hosed
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Take time to review this plan. A few minutes now saves hours later.
|
|
471
|
+
|
|
472
|
+
**Review Checklist:**
|
|
473
|
+
- [ ] Does this approach make sense for the codebase?
|
|
474
|
+
- [ ] Are there simpler alternatives?
|
|
475
|
+
- [ ] Will this cause breaking changes?
|
|
476
|
+
- [ ] Are edge cases covered?
|
|
477
|
+
|
|
478
|
+
**Approve plan and proceed to implementation?**
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Why this matters:**
|
|
482
|
+
- Plans are the highest-leverage checkpoint for human review
|
|
483
|
+
- Catching a bad approach before coding saves 100s of lines of rework
|
|
484
|
+
- This is where to invest review time (not code review)
|
|
485
|
+
|
|
486
|
+
**Options to present:**
|
|
487
|
+
1. **Approve** - Proceed to implementation
|
|
488
|
+
2. **Iterate** - Modify the plan first
|
|
489
|
+
3. **Research** - Need more context before deciding
|
|
452
490
|
|
|
453
491
|
**Plan Quality Checklist**:
|
|
454
492
|
- [ ] Explored relevant codebase
|
|
@@ -106,7 +106,7 @@ RULE #4: SYNTHESIS REQUIREMENTS
|
|
|
106
106
|
3. Collect ALL results before synthesizing
|
|
107
107
|
4. Always flag conflicts in final answer
|
|
108
108
|
5. Provide recommendation with rationale
|
|
109
|
-
6.
|
|
109
|
+
6. For quality gates (coverage ≥ X%, tests pass), use nested loops - see "NESTED LOOP MODE" section
|
|
110
110
|
|
|
111
111
|
<!-- COMPACT_SUMMARY_END -->
|
|
112
112
|
|
|
@@ -459,10 +459,12 @@ Proceed with integration?
|
|
|
459
459
|
|
|
460
460
|
---
|
|
461
461
|
|
|
462
|
-
## NESTED LOOP MODE
|
|
462
|
+
## NESTED LOOP MODE
|
|
463
463
|
|
|
464
464
|
When agents need to iterate until quality gates pass, use **nested loops**. Each agent runs its own isolated loop with quality verification.
|
|
465
465
|
|
|
466
|
+
> **Status**: Stable (v2.85+). Thread type: `big` (B-thread). See [Thread-Based Engineering](../../02-practices/thread-based-engineering.md).
|
|
467
|
+
|
|
466
468
|
### When to Use
|
|
467
469
|
|
|
468
470
|
| Scenario | Use Nested Loops? |
|
|
@@ -621,3 +623,34 @@ If an agent loop fails:
|
|
|
621
623
|
- Consider if 80% is achievable
|
|
622
624
|
- May need to reduce threshold or add more test cases
|
|
623
625
|
```
|
|
626
|
+
|
|
627
|
+
### Troubleshooting Nested Loops
|
|
628
|
+
|
|
629
|
+
| Issue | Cause | Solution |
|
|
630
|
+
|-------|-------|----------|
|
|
631
|
+
| Agent never starts loop | Loop ID not passed in prompt | Ensure `--loop-id=xyz` is included in prompt instructions |
|
|
632
|
+
| Gate always fails | Wrong threshold | Check `--threshold` matches realistic target |
|
|
633
|
+
| Timeout exceeded | Complex work | Increase timeout or split into smaller loops |
|
|
634
|
+
| Regression abort | Flaky tests | Fix test flakiness before using coverage gate |
|
|
635
|
+
| Max iterations reached | Insufficient changes | Review agent's iteration logs for patterns |
|
|
636
|
+
| "Loop not found" error | --init not run | Agent must run `--init` before `--check` |
|
|
637
|
+
|
|
638
|
+
**Debugging commands:**
|
|
639
|
+
```bash
|
|
640
|
+
# View all active loops
|
|
641
|
+
cat .agileflow/state/loops.json
|
|
642
|
+
|
|
643
|
+
# View loop history for specific ID
|
|
644
|
+
node .agileflow/scripts/agent-loop.js --history --loop-id=abc12345
|
|
645
|
+
|
|
646
|
+
# Force abort a stuck loop
|
|
647
|
+
node .agileflow/scripts/agent-loop.js --abort --loop-id=abc12345
|
|
648
|
+
|
|
649
|
+
# Clear all loops (reset)
|
|
650
|
+
rm .agileflow/state/loops.json
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
**Common patterns:**
|
|
654
|
+
- **Coverage stalls at 70%**: Usually means edge cases aren't tested. Agent needs clearer guidance on what to cover.
|
|
655
|
+
- **Visual verification loops forever**: Ensure screenshots use `verified-` prefix convention.
|
|
656
|
+
- **Type gate fails repeatedly**: Check for implicit `any` types or missing declarations.
|