agileflow 2.95.2 → 2.96.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 +6 -6
- package/lib/api-routes.js +605 -0
- package/lib/api-server.js +260 -0
- package/lib/claude-cli-bridge.js +221 -0
- package/lib/dashboard-protocol.js +541 -0
- package/lib/dashboard-server.js +1601 -0
- package/lib/drivers/claude-driver.ts +310 -0
- package/lib/drivers/codex-driver.ts +454 -0
- package/lib/drivers/driver-manager.ts +158 -0
- package/lib/drivers/gemini-driver.ts +485 -0
- package/lib/drivers/index.ts +17 -0
- package/lib/flag-detection.js +350 -0
- package/lib/git-operations.js +267 -0
- package/lib/lock-file.js +144 -0
- package/lib/merge-operations.js +959 -0
- package/lib/protocol/driver.ts +360 -0
- package/lib/protocol/index.ts +12 -0
- package/lib/protocol/ir.ts +271 -0
- package/lib/session-display.js +330 -0
- package/lib/worktree-operations.js +221 -0
- package/package.json +2 -2
- package/scripts/agileflow-welcome.js +272 -24
- package/scripts/api-server-runner.js +177 -0
- package/scripts/archive-completed-stories.sh +22 -0
- package/scripts/automation-run-due.js +126 -0
- package/scripts/backfill-ideation-status.js +124 -0
- package/scripts/claude-tmux.sh +62 -1
- package/scripts/context-loader.js +292 -0
- package/scripts/dashboard-serve.js +323 -0
- package/scripts/lib/automation-registry.js +544 -0
- package/scripts/lib/automation-runner.js +476 -0
- package/scripts/lib/concurrency-limiter.js +513 -0
- package/scripts/lib/configure-features.js +46 -0
- package/scripts/lib/context-formatter.js +61 -0
- package/scripts/lib/damage-control-utils.js +29 -4
- package/scripts/lib/hook-metrics.js +324 -0
- package/scripts/lib/ideation-index.js +1196 -0
- package/scripts/lib/process-cleanup.js +359 -0
- package/scripts/lib/quality-gates.js +574 -0
- package/scripts/lib/status-task-bridge.js +522 -0
- package/scripts/lib/sync-ideation-status.js +292 -0
- package/scripts/lib/task-registry-cache.js +490 -0
- package/scripts/lib/task-registry.js +1181 -0
- package/scripts/migrate-ideation-index.js +515 -0
- package/scripts/precompact-context.sh +104 -0
- package/scripts/ralph-loop.js +2 -2
- package/scripts/session-manager.js +363 -2770
- package/scripts/spawn-parallel.js +45 -9
- package/src/core/agents/api-validator.md +180 -0
- package/src/core/agents/api.md +2 -0
- package/src/core/agents/code-reviewer.md +289 -0
- package/src/core/agents/configuration/damage-control.md +17 -0
- package/src/core/agents/database.md +2 -0
- package/src/core/agents/error-analyzer.md +203 -0
- package/src/core/agents/logic-analyzer-edge.md +171 -0
- package/src/core/agents/logic-analyzer-flow.md +254 -0
- package/src/core/agents/logic-analyzer-invariant.md +207 -0
- package/src/core/agents/logic-analyzer-race.md +267 -0
- package/src/core/agents/logic-analyzer-type.md +218 -0
- package/src/core/agents/logic-consensus.md +256 -0
- package/src/core/agents/orchestrator.md +89 -1
- package/src/core/agents/schema-validator.md +451 -0
- package/src/core/agents/team-coordinator.md +328 -0
- package/src/core/agents/ui-validator.md +328 -0
- package/src/core/agents/ui.md +2 -0
- package/src/core/commands/api.md +267 -0
- package/src/core/commands/automate.md +415 -0
- package/src/core/commands/babysit.md +290 -9
- package/src/core/commands/ideate/history.md +403 -0
- package/src/core/commands/{ideate.md → ideate/new.md} +244 -34
- package/src/core/commands/logic/audit.md +368 -0
- package/src/core/commands/roadmap/analyze.md +1 -1
- package/src/core/experts/documentation/expertise.yaml +29 -2
- package/src/core/templates/CONTEXT.md.example +49 -0
- package/src/core/templates/claude-settings.advanced.example.json +4 -0
- package/tools/cli/commands/serve.js +456 -0
- package/tools/cli/installers/core/installer.js +7 -2
- package/tools/cli/installers/ide/claude-code.js +85 -0
- package/tools/cli/lib/content-injector.js +27 -1
- package/tools/cli/lib/ui.js +26 -57
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Start REST API server to expose AgileFlow state
|
|
3
|
+
argument-hint: ACTION=start|stop|status [PORT=3456]
|
|
4
|
+
compact_context:
|
|
5
|
+
priority: medium
|
|
6
|
+
preserve_rules:
|
|
7
|
+
- "ACTIVE COMMAND: /agileflow:api - REST API server for state exposure"
|
|
8
|
+
- "API is READ-ONLY (no mutations through API)"
|
|
9
|
+
- "Default port: 3456, localhost only"
|
|
10
|
+
state_fields:
|
|
11
|
+
- server_running
|
|
12
|
+
- server_port
|
|
13
|
+
- server_pid
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# api
|
|
17
|
+
|
|
18
|
+
Start, stop, or check status of the AgileFlow REST API server.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
The API server exposes AgileFlow state (sessions, status, tasks, bus messages) via REST endpoints for external GUI integrations like dashboards.
|
|
25
|
+
|
|
26
|
+
**Key Principles**:
|
|
27
|
+
- **READ-ONLY**: API exposes state but never mutates it (writes go through CLI)
|
|
28
|
+
- **JSON source of truth**: All data comes from existing JSON files
|
|
29
|
+
- **Localhost-only**: Binds to 127.0.0.1 by default for security
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Start the API Server
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
/agileflow:api ACTION=start [PORT=3456]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Starts the REST API server on the specified port (default: 3456).
|
|
42
|
+
|
|
43
|
+
### Stop the API Server
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
/agileflow:api ACTION=stop
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Stops the running API server.
|
|
50
|
+
|
|
51
|
+
### Check Server Status
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
/agileflow:api ACTION=status
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Shows whether the server is running and on which port.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Available Endpoints
|
|
62
|
+
|
|
63
|
+
Once the server is running, these endpoints are available:
|
|
64
|
+
|
|
65
|
+
| Endpoint | Description |
|
|
66
|
+
|----------|-------------|
|
|
67
|
+
| `GET /api` | API information and available endpoints |
|
|
68
|
+
| `GET /api/health` | Health check |
|
|
69
|
+
| `GET /api/sessions` | List active sessions |
|
|
70
|
+
| `GET /api/sessions/:id` | Get session by ID |
|
|
71
|
+
| `GET /api/status` | Get status.json (epics/stories state) |
|
|
72
|
+
| `GET /api/tasks` | List tasks (filterable) |
|
|
73
|
+
| `GET /api/tasks/:id` | Get task by ID |
|
|
74
|
+
| `GET /api/bus/messages` | Get bus messages (paginated) |
|
|
75
|
+
| `GET /api/metrics` | Aggregated metrics |
|
|
76
|
+
| `GET /api/epics` | List epics |
|
|
77
|
+
| `GET /api/epics/:id` | Get epic by ID |
|
|
78
|
+
| `GET /api/stories` | List stories (filterable) |
|
|
79
|
+
| `GET /api/stories/:id` | Get story by ID |
|
|
80
|
+
|
|
81
|
+
### Query Parameters
|
|
82
|
+
|
|
83
|
+
**GET /api/tasks**:
|
|
84
|
+
- `state`: Filter by state (queued, running, completed, failed, blocked)
|
|
85
|
+
- `story_id`: Filter by story ID
|
|
86
|
+
- `subagent_type`: Filter by agent type
|
|
87
|
+
|
|
88
|
+
**GET /api/bus/messages**:
|
|
89
|
+
- `limit`: Max messages to return (default: 100)
|
|
90
|
+
- `offset`: Skip first N messages
|
|
91
|
+
- `story_id`: Filter by story ID
|
|
92
|
+
- `from`: Filter by sender agent
|
|
93
|
+
- `since`: Filter by timestamp (ISO string)
|
|
94
|
+
|
|
95
|
+
**GET /api/stories**:
|
|
96
|
+
- `status`: Filter by status
|
|
97
|
+
- `epic_id`: Filter by epic ID
|
|
98
|
+
- `owner`: Filter by owner
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Prompt
|
|
103
|
+
|
|
104
|
+
ROLE: API Server Manager
|
|
105
|
+
|
|
106
|
+
INPUTS:
|
|
107
|
+
- ACTION=start|stop|status (required)
|
|
108
|
+
- PORT=<number> (optional, default: 3456)
|
|
109
|
+
|
|
110
|
+
ACTIONS:
|
|
111
|
+
|
|
112
|
+
**For ACTION=start**:
|
|
113
|
+
1. Check if server is already running (check `.agileflow/api-server.pid`)
|
|
114
|
+
2. If running, report existing server URL
|
|
115
|
+
3. If not running:
|
|
116
|
+
- Create the API server script
|
|
117
|
+
- Start server in background
|
|
118
|
+
- Save PID to `.agileflow/api-server.pid`
|
|
119
|
+
- Report server URL
|
|
120
|
+
|
|
121
|
+
**For ACTION=stop**:
|
|
122
|
+
1. Check `.agileflow/api-server.pid` for running server
|
|
123
|
+
2. If running, kill the process
|
|
124
|
+
3. Remove PID file
|
|
125
|
+
4. Report success
|
|
126
|
+
|
|
127
|
+
**For ACTION=status**:
|
|
128
|
+
1. Check `.agileflow/api-server.pid`
|
|
129
|
+
2. If PID file exists, check if process is alive
|
|
130
|
+
3. Report running/stopped status with URL if running
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Implementation
|
|
135
|
+
|
|
136
|
+
### Start Server
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Check for existing server
|
|
140
|
+
if [ -f ".agileflow/api-server.pid" ]; then
|
|
141
|
+
PID=$(cat .agileflow/api-server.pid)
|
|
142
|
+
if kill -0 "$PID" 2>/dev/null; then
|
|
143
|
+
echo "API server already running on PID $PID"
|
|
144
|
+
echo "URL: http://127.0.0.1:${PORT:-3456}/api"
|
|
145
|
+
exit 0
|
|
146
|
+
fi
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
# Start server
|
|
150
|
+
node -e "
|
|
151
|
+
const { createApiServer, startApiServer } = require('./.agileflow/scripts/lib/api-server-runner');
|
|
152
|
+
const server = createApiServer({ port: ${PORT:-3456} });
|
|
153
|
+
startApiServer(server).then(({ url }) => {
|
|
154
|
+
console.log('API server started at ' + url);
|
|
155
|
+
}).catch(err => {
|
|
156
|
+
console.error('Failed to start:', err.message);
|
|
157
|
+
process.exit(1);
|
|
158
|
+
});
|
|
159
|
+
" &
|
|
160
|
+
|
|
161
|
+
# Save PID
|
|
162
|
+
echo $! > .agileflow/api-server.pid
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### API Server Runner Script
|
|
166
|
+
|
|
167
|
+
Create `.agileflow/scripts/lib/api-server-runner.js`:
|
|
168
|
+
|
|
169
|
+
```javascript
|
|
170
|
+
const { createApiServer, startApiServer, stopApiServer } = require('../../lib/api-server');
|
|
171
|
+
|
|
172
|
+
// Re-export for CLI usage
|
|
173
|
+
module.exports = { createApiServer, startApiServer, stopApiServer };
|
|
174
|
+
|
|
175
|
+
// If run directly, start server
|
|
176
|
+
if (require.main === module) {
|
|
177
|
+
const port = parseInt(process.env.PORT || '3456', 10);
|
|
178
|
+
const server = createApiServer({ port });
|
|
179
|
+
|
|
180
|
+
startApiServer(server).then(({ url }) => {
|
|
181
|
+
console.log(`AgileFlow API running at ${url}`);
|
|
182
|
+
console.log('Press Ctrl+C to stop');
|
|
183
|
+
}).catch(err => {
|
|
184
|
+
console.error('Failed to start server:', err.message);
|
|
185
|
+
process.exit(1);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Handle shutdown
|
|
189
|
+
process.on('SIGINT', async () => {
|
|
190
|
+
console.log('\nShutting down...');
|
|
191
|
+
await stopApiServer(server);
|
|
192
|
+
process.exit(0);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Expected Output
|
|
200
|
+
|
|
201
|
+
### Starting Server
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
/agileflow:api ACTION=start PORT=3456
|
|
205
|
+
|
|
206
|
+
Starting AgileFlow API server...
|
|
207
|
+
|
|
208
|
+
✅ API server started
|
|
209
|
+
URL: http://127.0.0.1:3456/api
|
|
210
|
+
PID: 12345
|
|
211
|
+
|
|
212
|
+
Available endpoints:
|
|
213
|
+
GET /api - API information
|
|
214
|
+
GET /api/health - Health check
|
|
215
|
+
GET /api/sessions - List sessions
|
|
216
|
+
GET /api/status - Story/epic state
|
|
217
|
+
GET /api/tasks - Task registry
|
|
218
|
+
GET /api/metrics - Aggregated metrics
|
|
219
|
+
|
|
220
|
+
Try: curl http://127.0.0.1:3456/api/status
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Stopping Server
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
/agileflow:api ACTION=stop
|
|
227
|
+
|
|
228
|
+
Stopping API server (PID: 12345)...
|
|
229
|
+
|
|
230
|
+
✅ API server stopped
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Server Status
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
/agileflow:api ACTION=status
|
|
237
|
+
|
|
238
|
+
AgileFlow API Server Status
|
|
239
|
+
────────────────────────────
|
|
240
|
+
Status: Running
|
|
241
|
+
PID: 12345
|
|
242
|
+
URL: http://127.0.0.1:3456/api
|
|
243
|
+
Uptime: 2h 15m
|
|
244
|
+
|
|
245
|
+
Endpoints:
|
|
246
|
+
/api/status - 42 stories
|
|
247
|
+
/api/tasks - 15 tasks
|
|
248
|
+
/api/sessions - 3 active
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Security Notes
|
|
254
|
+
|
|
255
|
+
- Server binds to **localhost only** (127.0.0.1) by default
|
|
256
|
+
- No authentication required (local access only)
|
|
257
|
+
- All endpoints are **read-only** (no mutations)
|
|
258
|
+
- To expose externally, use a reverse proxy with authentication
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Related Commands
|
|
263
|
+
|
|
264
|
+
- `/agileflow:status` - Update story status
|
|
265
|
+
- `/agileflow:board` - Visual kanban board
|
|
266
|
+
- `/agileflow:metrics` - View project metrics
|
|
267
|
+
- `/agileflow:session` - Manage agent sessions
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Manage scheduled automations for recurring tasks
|
|
3
|
+
argument-hint: ACTION=list|add|edit|remove|run|presets [ID=<automation-id>]
|
|
4
|
+
compact_context:
|
|
5
|
+
priority: medium
|
|
6
|
+
preserve_rules:
|
|
7
|
+
- "ACTIVE COMMAND: /agileflow:automate - Scheduled automation management"
|
|
8
|
+
- "Automations stored in docs/09-agents/automation-schedule.json"
|
|
9
|
+
- "No daemon required - runs during user sessions"
|
|
10
|
+
state_fields:
|
|
11
|
+
- action
|
|
12
|
+
- automation_id
|
|
13
|
+
- schedule_type
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# automate
|
|
17
|
+
|
|
18
|
+
Manage scheduled automations for recurring tasks like changelog generation, dependency audits, and tech debt scans.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
AgileFlow's automation system enables recurring tasks without requiring a daemon process. Automations run during user sessions, triggered by the SessionStart hook.
|
|
25
|
+
|
|
26
|
+
**Key Features**:
|
|
27
|
+
- **No daemon required** - Runs when you start a session
|
|
28
|
+
- **Simple scheduling** - Daily, weekly, monthly, or custom intervals
|
|
29
|
+
- **Loop detection** - Prevents runaway automation chains
|
|
30
|
+
- **Timeout protection** - Kills stuck processes
|
|
31
|
+
- **Retry logic** - Automatic retries with exponential backoff
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### List Automations
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
/agileflow:automate ACTION=list
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Shows all configured automations with their schedules and status.
|
|
44
|
+
|
|
45
|
+
### View Presets
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
/agileflow:automate ACTION=presets
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Shows available preset automations that can be installed.
|
|
52
|
+
|
|
53
|
+
### Add Automation
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
/agileflow:automate ACTION=add ID=weekly-report
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Add a new automation (interactive wizard).
|
|
60
|
+
|
|
61
|
+
### Edit Automation
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
/agileflow:automate ACTION=edit ID=weekly-changelog
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Modify an existing automation.
|
|
68
|
+
|
|
69
|
+
### Remove Automation
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
/agileflow:automate ACTION=remove ID=weekly-changelog
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Delete an automation.
|
|
76
|
+
|
|
77
|
+
### Run Automation Manually
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
/agileflow:automate ACTION=run ID=weekly-changelog
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Run an automation immediately without waiting for schedule.
|
|
84
|
+
|
|
85
|
+
### Run All Due
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
/agileflow:automate ACTION=run-due
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Run all automations that are due based on their schedules.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Schedule Types
|
|
96
|
+
|
|
97
|
+
| Type | Description | Example |
|
|
98
|
+
|------|-------------|---------|
|
|
99
|
+
| `daily` | Run once per day | Every day at session start |
|
|
100
|
+
| `weekly` | Run on specific day | Every Sunday |
|
|
101
|
+
| `monthly` | Run on specific date | 1st of every month |
|
|
102
|
+
| `interval` | Run every N hours | Every 12 hours |
|
|
103
|
+
| `on_session` | Run every session | Every time you start Claude |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Preset Automations
|
|
108
|
+
|
|
109
|
+
Available presets that can be installed:
|
|
110
|
+
|
|
111
|
+
| Preset | Description | Schedule |
|
|
112
|
+
|--------|-------------|----------|
|
|
113
|
+
| `weekly-changelog` | Generate changelog from commits | Weekly (Sunday) |
|
|
114
|
+
| `daily-ci-summary` | Summarize CI failures | Daily |
|
|
115
|
+
| `monthly-debt-scan` | Scan for tech debt | Monthly (1st) |
|
|
116
|
+
| `weekly-dependency-audit` | Check for vulnerabilities | Weekly (Monday) |
|
|
117
|
+
| `session-context-refresh` | Refresh CONTEXT.md | Every session |
|
|
118
|
+
|
|
119
|
+
Install with:
|
|
120
|
+
```
|
|
121
|
+
/agileflow:automate ACTION=add ID=weekly-changelog PRESET=true
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Prompt
|
|
127
|
+
|
|
128
|
+
ROLE: Automation Manager
|
|
129
|
+
|
|
130
|
+
INPUTS:
|
|
131
|
+
- ACTION=list|add|edit|remove|run|run-due|presets (required)
|
|
132
|
+
- ID=<automation-id> (required for add/edit/remove/run)
|
|
133
|
+
- PRESET=true (optional, use preset template)
|
|
134
|
+
|
|
135
|
+
ACTIONS:
|
|
136
|
+
|
|
137
|
+
**For ACTION=list**:
|
|
138
|
+
1. Load `docs/09-agents/automation-schedule.json`
|
|
139
|
+
2. Display all automations with:
|
|
140
|
+
- ID and name
|
|
141
|
+
- Schedule (type, day/date/hours)
|
|
142
|
+
- Enabled status
|
|
143
|
+
- Last run time (if available)
|
|
144
|
+
- Next expected run
|
|
145
|
+
|
|
146
|
+
**For ACTION=presets**:
|
|
147
|
+
1. List available preset templates:
|
|
148
|
+
- weekly-changelog
|
|
149
|
+
- daily-ci-summary
|
|
150
|
+
- monthly-debt-scan
|
|
151
|
+
- weekly-dependency-audit
|
|
152
|
+
- session-context-refresh
|
|
153
|
+
|
|
154
|
+
**For ACTION=add**:
|
|
155
|
+
1. If PRESET=true, load preset definition
|
|
156
|
+
2. Otherwise, use interactive wizard:
|
|
157
|
+
- Ask for name and description
|
|
158
|
+
- Ask for command or script
|
|
159
|
+
- Ask for schedule type
|
|
160
|
+
- Ask for schedule parameters (day/date/hours)
|
|
161
|
+
- Ask for timeout (default: 5 minutes)
|
|
162
|
+
- Ask for retry count (default: 2)
|
|
163
|
+
3. Validate automation definition
|
|
164
|
+
4. Save to automation-schedule.json
|
|
165
|
+
5. Report success
|
|
166
|
+
|
|
167
|
+
**For ACTION=edit**:
|
|
168
|
+
1. Load existing automation by ID
|
|
169
|
+
2. Show current values
|
|
170
|
+
3. Ask what to modify
|
|
171
|
+
4. Update and save
|
|
172
|
+
|
|
173
|
+
**For ACTION=remove**:
|
|
174
|
+
1. Confirm deletion
|
|
175
|
+
2. Remove from automation-schedule.json
|
|
176
|
+
3. Report success
|
|
177
|
+
|
|
178
|
+
**For ACTION=run**:
|
|
179
|
+
1. Load automation by ID
|
|
180
|
+
2. Execute immediately (bypass schedule check)
|
|
181
|
+
3. Show output in real-time
|
|
182
|
+
4. Record run in history
|
|
183
|
+
5. Report success/failure
|
|
184
|
+
|
|
185
|
+
**For ACTION=run-due**:
|
|
186
|
+
1. Get all due automations from registry
|
|
187
|
+
2. Run each sequentially
|
|
188
|
+
3. Report results summary
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Implementation
|
|
193
|
+
|
|
194
|
+
### Load Automation Registry
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
const { getAutomationRegistry } = require('./.agileflow/scripts/lib/automation-registry');
|
|
198
|
+
const registry = getAutomationRegistry();
|
|
199
|
+
|
|
200
|
+
// List all
|
|
201
|
+
const automations = registry.list();
|
|
202
|
+
|
|
203
|
+
// Get due
|
|
204
|
+
const due = registry.getDue();
|
|
205
|
+
|
|
206
|
+
// Install preset
|
|
207
|
+
registry.installPreset('weekly-changelog');
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Run Automation
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
const { getAutomationRunner } = require('./.agileflow/scripts/lib/automation-runner');
|
|
214
|
+
const runner = getAutomationRunner();
|
|
215
|
+
|
|
216
|
+
// Run specific automation
|
|
217
|
+
const result = await runner.run('weekly-changelog');
|
|
218
|
+
|
|
219
|
+
// Run all due
|
|
220
|
+
const results = await runner.runDue();
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Expected Output
|
|
226
|
+
|
|
227
|
+
### ACTION=list
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
/agileflow:automate ACTION=list
|
|
231
|
+
|
|
232
|
+
📋 Scheduled Automations
|
|
233
|
+
────────────────────────────────────────────────
|
|
234
|
+
|
|
235
|
+
ID: weekly-changelog
|
|
236
|
+
Name: Weekly Changelog Generation
|
|
237
|
+
Schedule: Weekly (Sunday)
|
|
238
|
+
Enabled: ✅ Yes
|
|
239
|
+
Last Run: 2026-01-26T10:00:00Z (7 days ago)
|
|
240
|
+
Next: Due now
|
|
241
|
+
|
|
242
|
+
ID: daily-ci-summary
|
|
243
|
+
Name: Daily CI Summary
|
|
244
|
+
Schedule: Daily
|
|
245
|
+
Enabled: ✅ Yes
|
|
246
|
+
Last Run: 2026-02-02T08:00:00Z (yesterday)
|
|
247
|
+
Next: Not due yet
|
|
248
|
+
|
|
249
|
+
ID: monthly-debt-scan
|
|
250
|
+
Name: Monthly Tech Debt Scan
|
|
251
|
+
Schedule: Monthly (1st)
|
|
252
|
+
Enabled: ❌ No
|
|
253
|
+
Last Run: Never
|
|
254
|
+
Next: Disabled
|
|
255
|
+
|
|
256
|
+
────────────────────────────────────────────────
|
|
257
|
+
Total: 3 automations | Enabled: 2 | Due: 1
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### ACTION=presets
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
/agileflow:automate ACTION=presets
|
|
264
|
+
|
|
265
|
+
📦 Available Automation Presets
|
|
266
|
+
────────────────────────────────────────────────
|
|
267
|
+
|
|
268
|
+
weekly-changelog
|
|
269
|
+
Weekly Changelog Generation
|
|
270
|
+
Generate changelog from commits every Sunday
|
|
271
|
+
Schedule: Weekly (Sunday)
|
|
272
|
+
Timeout: 5 minutes
|
|
273
|
+
|
|
274
|
+
daily-ci-summary
|
|
275
|
+
Daily CI Summary
|
|
276
|
+
Summarize CI failures from the past 24 hours
|
|
277
|
+
Schedule: Daily
|
|
278
|
+
Timeout: 2 minutes
|
|
279
|
+
|
|
280
|
+
monthly-debt-scan
|
|
281
|
+
Monthly Tech Debt Scan
|
|
282
|
+
Scan for tech debt and generate report on the 1st
|
|
283
|
+
Schedule: Monthly (1st)
|
|
284
|
+
Timeout: 10 minutes
|
|
285
|
+
|
|
286
|
+
weekly-dependency-audit
|
|
287
|
+
Weekly Dependency Audit
|
|
288
|
+
Check for security vulnerabilities every Monday
|
|
289
|
+
Schedule: Weekly (Monday)
|
|
290
|
+
Timeout: 3 minutes
|
|
291
|
+
|
|
292
|
+
────────────────────────────────────────────────
|
|
293
|
+
Install with: /agileflow:automate ACTION=add ID=<preset-id> PRESET=true
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### ACTION=run
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
/agileflow:automate ACTION=run ID=weekly-changelog
|
|
300
|
+
|
|
301
|
+
🚀 Running: weekly-changelog
|
|
302
|
+
────────────────────────────────────────────────
|
|
303
|
+
|
|
304
|
+
[10:00:01] Starting automation...
|
|
305
|
+
[10:00:02] Generating changelog...
|
|
306
|
+
[10:00:05] Found 15 commits since last release
|
|
307
|
+
[10:00:07] Changelog updated: CHANGELOG.md
|
|
308
|
+
[10:00:07] Complete
|
|
309
|
+
|
|
310
|
+
────────────────────────────────────────────────
|
|
311
|
+
✅ Success
|
|
312
|
+
Duration: 6.2 seconds
|
|
313
|
+
Output: CHANGELOG.md updated with 15 commits
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### ACTION=add (Interactive)
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
/agileflow:automate ACTION=add ID=custom-backup
|
|
320
|
+
|
|
321
|
+
Creating new automation: custom-backup
|
|
322
|
+
────────────────────────────────────────────────
|
|
323
|
+
|
|
324
|
+
[AskUserQuestion: "What should this automation be called?"]
|
|
325
|
+
Name: Daily Database Backup
|
|
326
|
+
|
|
327
|
+
[AskUserQuestion: "Enter the command or script to run"]
|
|
328
|
+
Command: ./scripts/backup-db.sh
|
|
329
|
+
|
|
330
|
+
[AskUserQuestion: "How often should this run?"]
|
|
331
|
+
Schedule: Daily
|
|
332
|
+
|
|
333
|
+
[AskUserQuestion: "Timeout in minutes? (default: 5)"]
|
|
334
|
+
Timeout: 10
|
|
335
|
+
|
|
336
|
+
────────────────────────────────────────────────
|
|
337
|
+
|
|
338
|
+
Preview:
|
|
339
|
+
ID: custom-backup
|
|
340
|
+
Name: Daily Database Backup
|
|
341
|
+
Command: ./scripts/backup-db.sh
|
|
342
|
+
Schedule: Daily
|
|
343
|
+
Timeout: 10 minutes
|
|
344
|
+
Enabled: Yes
|
|
345
|
+
|
|
346
|
+
[AskUserQuestion: "Create this automation?"]
|
|
347
|
+
|
|
348
|
+
✅ Automation created: custom-backup
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Configuration File
|
|
354
|
+
|
|
355
|
+
Automations are stored in `docs/09-agents/automation-schedule.json`:
|
|
356
|
+
|
|
357
|
+
```json
|
|
358
|
+
{
|
|
359
|
+
"schema_version": "1.0.0",
|
|
360
|
+
"created_at": "2026-01-01T00:00:00Z",
|
|
361
|
+
"updated_at": "2026-02-03T10:00:00Z",
|
|
362
|
+
"automations": {
|
|
363
|
+
"weekly-changelog": {
|
|
364
|
+
"name": "Weekly Changelog Generation",
|
|
365
|
+
"description": "Generate changelog from commits every Sunday",
|
|
366
|
+
"command": "/agileflow:changelog ACTION=generate",
|
|
367
|
+
"schedule": {
|
|
368
|
+
"type": "weekly",
|
|
369
|
+
"day": "sunday"
|
|
370
|
+
},
|
|
371
|
+
"timeout": 300000,
|
|
372
|
+
"enabled": true,
|
|
373
|
+
"created_at": "2026-01-01T00:00:00Z",
|
|
374
|
+
"updated_at": "2026-01-15T00:00:00Z"
|
|
375
|
+
}
|
|
376
|
+
},
|
|
377
|
+
"run_history": [
|
|
378
|
+
{
|
|
379
|
+
"automation_id": "weekly-changelog",
|
|
380
|
+
"at": "2026-01-26T10:00:00Z",
|
|
381
|
+
"success": true,
|
|
382
|
+
"duration_ms": 6200,
|
|
383
|
+
"output": "CHANGELOG.md updated"
|
|
384
|
+
}
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Safety Features
|
|
392
|
+
|
|
393
|
+
### Loop Detection
|
|
394
|
+
- Detects if automation runs more than 3 times in 5 minutes
|
|
395
|
+
- Prevents infinite automation chains
|
|
396
|
+
- Logs warning when loop detected
|
|
397
|
+
|
|
398
|
+
### Timeout Protection
|
|
399
|
+
- Default: 5 minutes per automation
|
|
400
|
+
- Configurable per automation
|
|
401
|
+
- SIGTERM followed by SIGKILL after 5s
|
|
402
|
+
|
|
403
|
+
### Retry Logic
|
|
404
|
+
- Default: 2 retries on failure
|
|
405
|
+
- Exponential backoff (5s, 10s, 20s)
|
|
406
|
+
- Records all attempts in history
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Related Commands
|
|
411
|
+
|
|
412
|
+
- `/agileflow:changelog` - Generate changelogs
|
|
413
|
+
- `/agileflow:debt` - Tech debt scanning
|
|
414
|
+
- `/agileflow:ci` - CI/CD operations
|
|
415
|
+
- `/agileflow:configure` - Configure hooks and features
|