agileflow 2.85.0 → 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 +5 -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 +11 -8
- 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 +125 -14
- package/scripts/session-boundary.js +3 -3
- package/scripts/session-manager.js +303 -8
- 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 +30 -22
- 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
|
@@ -6,12 +6,14 @@ compact_context:
|
|
|
6
6
|
preserve_rules:
|
|
7
7
|
- "map: Execute action on each item sequentially"
|
|
8
8
|
- "pmap: Execute action on each item in parallel (spawn Task agents)"
|
|
9
|
+
- "pmap MODE=loop: Iterate on each item until tests pass"
|
|
9
10
|
- "filter: Return items matching criteria"
|
|
10
11
|
- "reduce: Aggregate items into single output"
|
|
11
12
|
state_fields:
|
|
12
13
|
- batch_operation
|
|
13
14
|
- items_processed
|
|
14
15
|
- items_total
|
|
16
|
+
- batch_loop
|
|
15
17
|
---
|
|
16
18
|
|
|
17
19
|
# /agileflow:batch
|
|
@@ -44,15 +46,22 @@ node .agileflow/scripts/obtain-context.js batch
|
|
|
44
46
|
```
|
|
45
47
|
/agileflow:batch map "docs/06-stories/*.md" validate
|
|
46
48
|
/agileflow:batch pmap "src/**/*.tsx" add-tests
|
|
49
|
+
/agileflow:batch pmap "src/**/*.tsx" add-tests MODE=loop # Iterate until tests pass
|
|
47
50
|
/agileflow:batch filter stories status=ready
|
|
48
51
|
/agileflow:batch reduce "docs/06-stories/*.md" summary
|
|
49
52
|
```
|
|
50
53
|
|
|
54
|
+
**Loop Mode** (pmap only):
|
|
55
|
+
- `MODE=loop` - Iterate on each file until tests pass
|
|
56
|
+
- Sequential processing with quality gates
|
|
57
|
+
- Tracks progress in `batch_loop` session state
|
|
58
|
+
|
|
51
59
|
**Workflow**:
|
|
52
60
|
1. Parse operation and pattern
|
|
53
61
|
2. Resolve pattern to item list
|
|
54
62
|
3. For each item: execute action based on operation type
|
|
55
|
-
4.
|
|
63
|
+
4. (Loop mode) Run tests, iterate if failing
|
|
64
|
+
5. Collect and report results
|
|
56
65
|
|
|
57
66
|
<!-- COMPACT_SUMMARY_END -->
|
|
58
67
|
|
|
@@ -355,8 +364,114 @@ Batch operations update session-state.json:
|
|
|
355
364
|
|
|
356
365
|
---
|
|
357
366
|
|
|
367
|
+
## Loop Mode (pmap with quality gates)
|
|
368
|
+
|
|
369
|
+
Process items iteratively until quality gates pass. Useful for test-driven batch operations.
|
|
370
|
+
|
|
371
|
+
### Usage
|
|
372
|
+
|
|
373
|
+
```
|
|
374
|
+
/agileflow:batch pmap "pattern" action MODE=loop [GATE=tests] [MAX=50]
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Parameters
|
|
378
|
+
|
|
379
|
+
| Parameter | Description | Default |
|
|
380
|
+
|-----------|-------------|---------|
|
|
381
|
+
| MODE=loop | Enable loop mode | off |
|
|
382
|
+
| GATE=tests | Quality gate type (v1: tests only) | tests |
|
|
383
|
+
| MAX=N | Max total iterations | 50 |
|
|
384
|
+
|
|
385
|
+
### How It Works
|
|
386
|
+
|
|
387
|
+
1. **Initialize**: Resolve glob pattern to file list
|
|
388
|
+
2. **Process**: Work on first file, implement the action
|
|
389
|
+
3. **Validate**: On stop, run tests for that file
|
|
390
|
+
4. **Iterate**: If tests pass → next file; if fail → continue fixing
|
|
391
|
+
5. **Complete**: When all files pass or max iterations reached
|
|
392
|
+
|
|
393
|
+
### Example
|
|
394
|
+
|
|
395
|
+
```
|
|
396
|
+
/agileflow:batch pmap "src/components/*.tsx" add-tests MODE=loop
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Output:**
|
|
400
|
+
```
|
|
401
|
+
======================================================
|
|
402
|
+
BATCH LOOP - Iteration 1/50
|
|
403
|
+
======================================================
|
|
404
|
+
|
|
405
|
+
🔄 Iteration 1/50
|
|
406
|
+
📍 Working on: src/components/Button.tsx
|
|
407
|
+
|
|
408
|
+
Running tests for: src/components/Button.tsx
|
|
409
|
+
──────────────────────────────────────────────────────
|
|
410
|
+
✓ Tests passed (2.3s)
|
|
411
|
+
|
|
412
|
+
✅ Item complete: src/components/Button.tsx
|
|
413
|
+
|
|
414
|
+
━━━ Next Item ━━━
|
|
415
|
+
src/components/Input.tsx
|
|
416
|
+
|
|
417
|
+
Progress: 1/8 items complete
|
|
418
|
+
|
|
419
|
+
▶ Implement "add-tests" for this file
|
|
420
|
+
Run tests when ready. Loop will validate and continue.
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Manual Control
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Check loop status
|
|
427
|
+
node scripts/batch-pmap-loop.js --status
|
|
428
|
+
|
|
429
|
+
# Stop the loop
|
|
430
|
+
node scripts/batch-pmap-loop.js --stop
|
|
431
|
+
|
|
432
|
+
# Reset loop state
|
|
433
|
+
node scripts/batch-pmap-loop.js --reset
|
|
434
|
+
|
|
435
|
+
# Initialize directly (alternative to slash command)
|
|
436
|
+
node scripts/batch-pmap-loop.js --init --pattern="src/**/*.tsx" --action="add-tests" --max=30
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Session State
|
|
440
|
+
|
|
441
|
+
Loop mode tracks progress in `session-state.json`:
|
|
442
|
+
|
|
443
|
+
```json
|
|
444
|
+
{
|
|
445
|
+
"batch_loop": {
|
|
446
|
+
"enabled": true,
|
|
447
|
+
"pattern": "src/**/*.tsx",
|
|
448
|
+
"action": "add-tests",
|
|
449
|
+
"quality_gate": "tests",
|
|
450
|
+
"current_item": "src/components/Button.tsx",
|
|
451
|
+
"items": {
|
|
452
|
+
"src/components/Button.tsx": { "status": "completed", "iterations": 1 },
|
|
453
|
+
"src/components/Input.tsx": { "status": "in_progress", "iterations": 0 }
|
|
454
|
+
},
|
|
455
|
+
"summary": { "total": 8, "completed": 1, "pending": 7 },
|
|
456
|
+
"iteration": 2,
|
|
457
|
+
"max_iterations": 50
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Quality Gate (V1)
|
|
463
|
+
|
|
464
|
+
V1 supports **tests gate only**:
|
|
465
|
+
- Runs: `npm test -- --testPathPattern="filename"`
|
|
466
|
+
- Passes if tests for this file pass (or no matching tests)
|
|
467
|
+
- Fails if tests for this file fail
|
|
468
|
+
|
|
469
|
+
Future versions may add: coverage, lint, types gates.
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
358
473
|
## Integration
|
|
359
474
|
|
|
360
475
|
- Works with `/agileflow:babysit` for batch story processing
|
|
361
|
-
-
|
|
476
|
+
- **Loop mode** enables iterative batch processing with quality gates
|
|
362
477
|
- Integrates with agent system for parallel work
|
|
@@ -76,17 +76,18 @@ Every metric should suggest:
|
|
|
76
76
|
|
|
77
77
|
## Key Metrics Calculated
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
11 core metrics:
|
|
80
80
|
1. **Cycle Time** - in-progress → done
|
|
81
81
|
2. **Lead Time** - created → done
|
|
82
82
|
3. **Throughput** - stories completed/period
|
|
83
83
|
4. **WIP** - current in-progress + in-review
|
|
84
84
|
5. **Agent Utilization** - work distribution
|
|
85
|
-
6. **
|
|
86
|
-
7. **
|
|
87
|
-
8. **
|
|
88
|
-
9. **
|
|
89
|
-
10. **
|
|
85
|
+
6. **Thread Distribution** - session breakdown by thread type
|
|
86
|
+
7. **Epic Health** - progress % + trend
|
|
87
|
+
8. **Estimation Accuracy** - estimate vs actual
|
|
88
|
+
9. **Blocked Stories** - count + duration
|
|
89
|
+
10. **Flow Efficiency** - active vs total time %
|
|
90
|
+
11. **Cumulative Flow Diagram** - stacked area chart
|
|
90
91
|
|
|
91
92
|
---
|
|
92
93
|
|
|
@@ -164,10 +165,11 @@ After displaying metrics:
|
|
|
164
165
|
|
|
165
166
|
## REMEMBER AFTER COMPACTION
|
|
166
167
|
|
|
167
|
-
- Command is read-only (analyzes bus/log.jsonl + status.json)
|
|
168
|
-
- Calculates
|
|
168
|
+
- Command is read-only (analyzes bus/log.jsonl + status.json + session registry)
|
|
169
|
+
- Calculates 11 metrics (cycle-time, lead-time, throughput, WIP, thread-distribution, etc.)
|
|
169
170
|
- Shows trends (↗ ↘ →) with % change vs previous period
|
|
170
171
|
- Uses health indicators (🟢🟡🔴) for quick assessment
|
|
172
|
+
- Thread Distribution shows session breakdown by thread type (base/parallel/chained/fusion/big/long)
|
|
171
173
|
- Provides actionable recommendations (HIGH/MEDIUM/LOW)
|
|
172
174
|
- Saves reports to docs/08-project/metrics-reports/
|
|
173
175
|
- Always includes timeframe and generation timestamp
|
|
@@ -366,7 +368,48 @@ Balance Score: 78/100 (Good distribution)
|
|
|
366
368
|
Recommendation: Consider assigning more work to AG-DEVOPS
|
|
367
369
|
```
|
|
368
370
|
|
|
369
|
-
### 6.
|
|
371
|
+
### 6. Thread Distribution
|
|
372
|
+
**Definition**: Distribution of work by thread type (see docs/02-practices/thread-based-engineering.md)
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
# Get thread type from session registry
|
|
376
|
+
for session in sessions; do
|
|
377
|
+
thread_type=$(node .agileflow/scripts/session-manager.js thread-type $session)
|
|
378
|
+
stories_completed=$(count_stories_completed_in_session $session)
|
|
379
|
+
duration=$(calculate_session_duration $session)
|
|
380
|
+
echo "$thread_type: $stories_completed stories, $duration hours"
|
|
381
|
+
done
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Output**:
|
|
385
|
+
```
|
|
386
|
+
Thread Distribution (30 days)
|
|
387
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
388
|
+
Sessions by Thread Type:
|
|
389
|
+
base ████████████████████░░ 65% (13 sessions)
|
|
390
|
+
parallel ████████░░ 25% (5 sessions)
|
|
391
|
+
chained ██░░ 5% (1 session)
|
|
392
|
+
fusion ██░░ 5% (1 session)
|
|
393
|
+
big ░░ 0% (0 sessions)
|
|
394
|
+
long ░░ 0% (0 sessions)
|
|
395
|
+
|
|
396
|
+
Avg Duration by Type:
|
|
397
|
+
base: 45 min avg 8 stories/session
|
|
398
|
+
parallel: 2.5 hours avg 12 stories/session
|
|
399
|
+
chained: 3 hours avg 15 stories/session
|
|
400
|
+
fusion: 30 min avg 1 decision/session
|
|
401
|
+
|
|
402
|
+
Success Rate by Type:
|
|
403
|
+
base: 85% stories completed
|
|
404
|
+
parallel: 92% stories completed ← Highest
|
|
405
|
+
chained: 78% stories completed
|
|
406
|
+
fusion: N/A (advisory only)
|
|
407
|
+
|
|
408
|
+
Trend (vs last month): ↗ +15% parallel usage
|
|
409
|
+
Recommendation: Consider using parallel sessions for independent tasks
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### 7. Epic Health (was 6)
|
|
370
413
|
**Definition**: Progress and health indicators for epics
|
|
371
414
|
|
|
372
415
|
```bash
|
|
@@ -641,6 +684,16 @@ EXPORT FORMATS
|
|
|
641
684
|
"limit": 6,
|
|
642
685
|
"pct": 67,
|
|
643
686
|
"blocked": 2
|
|
687
|
+
},
|
|
688
|
+
"thread_distribution": {
|
|
689
|
+
"base": {"count": 13, "pct": 65, "avg_duration_min": 45, "stories_per_session": 8},
|
|
690
|
+
"parallel": {"count": 5, "pct": 25, "avg_duration_min": 150, "stories_per_session": 12},
|
|
691
|
+
"chained": {"count": 1, "pct": 5, "avg_duration_min": 180, "stories_per_session": 15},
|
|
692
|
+
"fusion": {"count": 1, "pct": 5, "avg_duration_min": 30, "decisions_per_session": 1},
|
|
693
|
+
"big": {"count": 0, "pct": 0},
|
|
694
|
+
"long": {"count": 0, "pct": 0},
|
|
695
|
+
"trend": "parallel_increasing",
|
|
696
|
+
"change_pct": 15
|
|
644
697
|
}
|
|
645
698
|
},
|
|
646
699
|
"epics": [...],
|