@fermindi/pwn-cli 0.1.1 → 0.2.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/LICENSE +21 -21
- package/README.md +265 -251
- package/cli/batch.js +333 -333
- package/cli/codespaces.js +303 -303
- package/cli/index.js +98 -91
- package/cli/inject.js +78 -67
- package/cli/knowledge.js +531 -531
- package/cli/migrate.js +466 -0
- package/cli/notify.js +135 -135
- package/cli/patterns.js +665 -665
- package/cli/status.js +91 -91
- package/cli/validate.js +61 -61
- package/package.json +70 -70
- package/src/core/inject.js +208 -204
- package/src/core/state.js +91 -91
- package/src/core/validate.js +202 -202
- package/src/core/workspace.js +176 -176
- package/src/index.js +20 -20
- package/src/knowledge/gc.js +308 -308
- package/src/knowledge/lifecycle.js +401 -401
- package/src/knowledge/promote.js +364 -364
- package/src/knowledge/references.js +342 -342
- package/src/patterns/matcher.js +218 -218
- package/src/patterns/registry.js +375 -375
- package/src/patterns/triggers.js +423 -423
- package/src/services/batch-service.js +849 -849
- package/src/services/notification-service.js +342 -342
- package/templates/codespaces/devcontainer.json +52 -52
- package/templates/codespaces/setup.sh +70 -70
- package/templates/workspace/.ai/README.md +164 -164
- package/templates/workspace/.ai/agents/README.md +204 -204
- package/templates/workspace/.ai/agents/claude.md +625 -625
- package/templates/workspace/.ai/config/README.md +79 -79
- package/templates/workspace/.ai/config/notifications.template.json +20 -20
- package/templates/workspace/.ai/memory/deadends.md +79 -79
- package/templates/workspace/.ai/memory/decisions.md +58 -58
- package/templates/workspace/.ai/memory/patterns.md +65 -65
- package/templates/workspace/.ai/patterns/backend/README.md +126 -126
- package/templates/workspace/.ai/patterns/frontend/README.md +103 -103
- package/templates/workspace/.ai/patterns/index.md +256 -256
- package/templates/workspace/.ai/patterns/triggers.json +1087 -1087
- package/templates/workspace/.ai/patterns/universal/README.md +141 -141
- package/templates/workspace/.ai/state.template.json +8 -8
- package/templates/workspace/.ai/tasks/active.md +77 -77
- package/templates/workspace/.ai/tasks/backlog.md +95 -95
- package/templates/workspace/.ai/workflows/batch-task.md +356 -356
|
@@ -1,356 +1,356 @@
|
|
|
1
|
-
# Batch Task Execution Workflow
|
|
2
|
-
|
|
3
|
-
This file defines the template for autonomous batch task execution via the `pwn batch` command.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Batch task execution allows AI agents to autonomously:
|
|
8
|
-
- Select tasks from backlog
|
|
9
|
-
- Execute work in sequence
|
|
10
|
-
- Run quality gates (tests, linting, type checking)
|
|
11
|
-
- Commit changes following conventions
|
|
12
|
-
- Continue until backlog depleted or threshold reached
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# Execute next available task
|
|
18
|
-
pwn batch
|
|
19
|
-
|
|
20
|
-
# Execute specific number of tasks
|
|
21
|
-
pwn batch --count 5
|
|
22
|
-
|
|
23
|
-
# Dry-run: show what would execute
|
|
24
|
-
pwn batch --dry-run
|
|
25
|
-
|
|
26
|
-
# Execute with specific priority
|
|
27
|
-
pwn batch --priority high
|
|
28
|
-
|
|
29
|
-
# Resume interrupted batch
|
|
30
|
-
pwn batch --resume
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Batch Execution Protocol
|
|
34
|
-
|
|
35
|
-
### Phase 1: Task Selection
|
|
36
|
-
|
|
37
|
-
1. Read `tasks/active.md` for incomplete tasks
|
|
38
|
-
2. If active tasks exist and not blocked, resume
|
|
39
|
-
3. Otherwise, read `tasks/backlog.md`
|
|
40
|
-
4. Select highest priority unblocked task
|
|
41
|
-
5. Verify dependencies are met
|
|
42
|
-
6. Move to `active.md`
|
|
43
|
-
|
|
44
|
-
### Phase 2: Execution
|
|
45
|
-
|
|
46
|
-
1. Analyze task requirements
|
|
47
|
-
2. Create feature branch: `feature/[task-id]-[slug]`
|
|
48
|
-
3. Execute work following patterns in `patterns/index.md`
|
|
49
|
-
4. Test incrementally during development
|
|
50
|
-
5. Keep commits atomic and descriptive
|
|
51
|
-
|
|
52
|
-
### Phase 3: Quality Gates
|
|
53
|
-
|
|
54
|
-
Before commit, verify:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# Type checking
|
|
58
|
-
[ ] npm run typecheck || tsc --noEmit
|
|
59
|
-
|
|
60
|
-
# Linting
|
|
61
|
-
[ ] npm run lint || eslint .
|
|
62
|
-
|
|
63
|
-
# Unit tests
|
|
64
|
-
[ ] npm run test || jest
|
|
65
|
-
|
|
66
|
-
# Integration tests (if applicable)
|
|
67
|
-
[ ] npm run test:integration
|
|
68
|
-
|
|
69
|
-
# Build verification
|
|
70
|
-
[ ] npm run build
|
|
71
|
-
|
|
72
|
-
# Security scan (if configured)
|
|
73
|
-
[ ] npm run security
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**Gate Strategy:**
|
|
77
|
-
- Fail fast on first error
|
|
78
|
-
- Output clear error message
|
|
79
|
-
- Suggest fix if known
|
|
80
|
-
- Option to skip non-critical gates with `--force`
|
|
81
|
-
|
|
82
|
-
### Phase 4: Commit & Cleanup
|
|
83
|
-
|
|
84
|
-
1. Stage all changes: `git add .`
|
|
85
|
-
2. Commit with message format:
|
|
86
|
-
```
|
|
87
|
-
feat: [task-id] - [description]
|
|
88
|
-
|
|
89
|
-
- Specific change 1
|
|
90
|
-
- Specific change 2
|
|
91
|
-
|
|
92
|
-
Fixes: [task-id]
|
|
93
|
-
```
|
|
94
|
-
3. Push to remote: `git push -u origin feature/[task-id]-[slug]`
|
|
95
|
-
4. Create PR if configured
|
|
96
|
-
5. Update `active.md`: mark complete with date
|
|
97
|
-
|
|
98
|
-
### Phase 5: Completion
|
|
99
|
-
|
|
100
|
-
1. Verify commit is on remote
|
|
101
|
-
2. Delete local feature branch
|
|
102
|
-
3. Report completion to user
|
|
103
|
-
4. Continue to next task or stop
|
|
104
|
-
|
|
105
|
-
## Batch Configuration
|
|
106
|
-
|
|
107
|
-
Define batch settings in `state.json`:
|
|
108
|
-
|
|
109
|
-
```json
|
|
110
|
-
{
|
|
111
|
-
"batch_config": {
|
|
112
|
-
"max_tasks": 5,
|
|
113
|
-
"max_duration_hours": 4,
|
|
114
|
-
"quality_gates": ["typecheck", "lint", "test"],
|
|
115
|
-
"skip_gates": [],
|
|
116
|
-
"auto_commit": true,
|
|
117
|
-
"auto_push": false,
|
|
118
|
-
"create_pr": false,
|
|
119
|
-
"branch_format": "feature/{id}-{slug}",
|
|
120
|
-
"commit_format": "conventional"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Task Selection Strategy
|
|
126
|
-
|
|
127
|
-
### Default: Highest Priority
|
|
128
|
-
```
|
|
129
|
-
- High priority tasks first
|
|
130
|
-
- Within priority: ordered by position in backlog
|
|
131
|
-
- Skip blocked tasks (note reason in state)
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Alternative: By Effort
|
|
135
|
-
```
|
|
136
|
-
- Small (XS, S) tasks first
|
|
137
|
-
- Accumulate quick wins
|
|
138
|
-
- Build momentum
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Alternative: By Due Date
|
|
142
|
-
```
|
|
143
|
-
- Tasks with deadlines first
|
|
144
|
-
- Then by priority
|
|
145
|
-
- Suitable for time-sensitive work
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Error Handling
|
|
149
|
-
|
|
150
|
-
### Build Fails
|
|
151
|
-
```
|
|
152
|
-
1. Show error output
|
|
153
|
-
2. Offer options:
|
|
154
|
-
a) Fix automatically (if pattern known)
|
|
155
|
-
b) Pause for manual fix
|
|
156
|
-
c) Skip to next task (with note)
|
|
157
|
-
3. Retry if auto-fixed
|
|
158
|
-
4. Abort batch if repeated failures
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Test Fails
|
|
162
|
-
```
|
|
163
|
-
1. Show failing test
|
|
164
|
-
2. Offer options:
|
|
165
|
-
a) Debug and fix
|
|
166
|
-
b) Review assertion (might be test issue)
|
|
167
|
-
c) Pause for investigation
|
|
168
|
-
3. Don't commit until tests pass
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### Git Conflicts
|
|
172
|
-
```
|
|
173
|
-
1. Pause batch execution
|
|
174
|
-
2. Notify user of conflict
|
|
175
|
-
3. Request manual resolution
|
|
176
|
-
4. Resume after rebase/merge
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### Dependency Issues
|
|
180
|
-
```
|
|
181
|
-
1. Check if task dependencies are met
|
|
182
|
-
2. If not met:
|
|
183
|
-
a) Add dependency task to batch
|
|
184
|
-
b) Execute dependency first
|
|
185
|
-
c) Resume original task
|
|
186
|
-
3. Don't proceed if can't satisfy dependencies
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Commit Message Format
|
|
190
|
-
|
|
191
|
-
Use conventional commits:
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
type(scope): subject
|
|
195
|
-
|
|
196
|
-
body
|
|
197
|
-
|
|
198
|
-
footer
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
**Types:**
|
|
202
|
-
- `feat:` New feature
|
|
203
|
-
- `fix:` Bug fix
|
|
204
|
-
- `docs:` Documentation
|
|
205
|
-
- `style:` Code style (formatting, missing semicolons)
|
|
206
|
-
- `refactor:` Refactoring without feature changes
|
|
207
|
-
- `perf:` Performance improvement
|
|
208
|
-
- `test:` Adding/updating tests
|
|
209
|
-
- `chore:` Build, dependencies, tooling
|
|
210
|
-
|
|
211
|
-
**Example:**
|
|
212
|
-
```
|
|
213
|
-
feat(youtube-summarizer): add batch download mode
|
|
214
|
-
|
|
215
|
-
- Added batch processing for multiple URLs
|
|
216
|
-
- Implemented progress tracking
|
|
217
|
-
- Added resume capability for interrupted batches
|
|
218
|
-
|
|
219
|
-
Fixes: US-042
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
## Logging & Reporting
|
|
223
|
-
|
|
224
|
-
Log batch execution for review:
|
|
225
|
-
|
|
226
|
-
```
|
|
227
|
-
[14:23] Starting batch execution (max 5 tasks, 4 hours)
|
|
228
|
-
[14:23] → Selected US-042: Add batch download mode (High, M)
|
|
229
|
-
[14:25] ✓ Feature branch created
|
|
230
|
-
[14:28] ✓ Implementation complete
|
|
231
|
-
[14:30] ✓ Tests pass (18 specs, 0 failures)
|
|
232
|
-
[14:31] ✓ Linting pass (0 issues)
|
|
233
|
-
[14:31] ✓ Build successful (2.3s)
|
|
234
|
-
[14:32] ✓ Committed: feat(youtube-summarizer): add batch download mode
|
|
235
|
-
[14:33] ✓ Pushed to origin
|
|
236
|
-
[14:33] ✓ Task completed (10 min)
|
|
237
|
-
[14:33]
|
|
238
|
-
[14:33] → Selected US-043: Add schedule endpoint (High, M)
|
|
239
|
-
[14:35] ✗ Type check failed: ...
|
|
240
|
-
[14:35] ⓘ Pausing batch - manual intervention needed
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
## Resuming Batch
|
|
244
|
-
|
|
245
|
-
To resume after pause:
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
# Shows what was paused
|
|
249
|
-
pwn batch --status
|
|
250
|
-
|
|
251
|
-
# Continue from where it stopped
|
|
252
|
-
pwn batch --resume
|
|
253
|
-
|
|
254
|
-
# Skip current task and continue
|
|
255
|
-
pwn batch --resume --skip
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
State is stored in `state.json`:
|
|
259
|
-
|
|
260
|
-
```json
|
|
261
|
-
{
|
|
262
|
-
"batch_state": {
|
|
263
|
-
"current_task": "US-042",
|
|
264
|
-
"started_at": "2026-01-21T14:23:00Z",
|
|
265
|
-
"completed": ["US-041"],
|
|
266
|
-
"pending": ["US-043", "US-044", "US-045"],
|
|
267
|
-
"paused_at": "2026-01-21T14:35:00Z",
|
|
268
|
-
"pause_reason": "Type check failed"
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
## Safety Measures
|
|
274
|
-
|
|
275
|
-
1. **No destructive operations without confirmation**
|
|
276
|
-
- Force push requires explicit approval
|
|
277
|
-
- Deleting branches requires confirmation
|
|
278
|
-
- Reverting commits shows diff first
|
|
279
|
-
|
|
280
|
-
2. **Rollback capability**
|
|
281
|
-
- Each batch has unique branch
|
|
282
|
-
- Can revert entire batch: `git reset --hard`
|
|
283
|
-
- Commits are preserved in history
|
|
284
|
-
|
|
285
|
-
3. **Notifications**
|
|
286
|
-
- Completion notification to user
|
|
287
|
-
- Failure notification with context
|
|
288
|
-
- Blockers notify team if configured
|
|
289
|
-
|
|
290
|
-
4. **Rate limiting**
|
|
291
|
-
- Default 5 tasks max per batch
|
|
292
|
-
- Configurable via `--count` or `batch_config`
|
|
293
|
-
- Time-based limit (default 4 hours)
|
|
294
|
-
|
|
295
|
-
## Configuration Examples
|
|
296
|
-
|
|
297
|
-
### Quick Wins Mode
|
|
298
|
-
```json
|
|
299
|
-
{
|
|
300
|
-
"batch_config": {
|
|
301
|
-
"max_tasks": 10,
|
|
302
|
-
"selection_strategy": "effort",
|
|
303
|
-
"quality_gates": ["test"],
|
|
304
|
-
"auto_commit": true
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### Safe Mode
|
|
310
|
-
```json
|
|
311
|
-
{
|
|
312
|
-
"batch_config": {
|
|
313
|
-
"max_tasks": 1,
|
|
314
|
-
"quality_gates": ["typecheck", "lint", "test", "build"],
|
|
315
|
-
"auto_commit": false,
|
|
316
|
-
"create_pr": true
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
### Aggressive Mode
|
|
322
|
-
```json
|
|
323
|
-
{
|
|
324
|
-
"batch_config": {
|
|
325
|
-
"max_tasks": 20,
|
|
326
|
-
"quality_gates": ["test"],
|
|
327
|
-
"skip_gates": ["typecheck"],
|
|
328
|
-
"auto_commit": true,
|
|
329
|
-
"auto_push": true
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
## Monitoring
|
|
335
|
-
|
|
336
|
-
Track batch execution performance:
|
|
337
|
-
|
|
338
|
-
```json
|
|
339
|
-
{
|
|
340
|
-
"batch_metrics": {
|
|
341
|
-
"average_task_duration": "15 min",
|
|
342
|
-
"success_rate": "92%",
|
|
343
|
-
"most_common_blocker": "failing_tests",
|
|
344
|
-
"total_tasks_completed": 47
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
## Tips
|
|
350
|
-
|
|
351
|
-
- Start with small batches (1-3 tasks) to validate quality gates
|
|
352
|
-
- Increase batch size as confidence grows
|
|
353
|
-
- Monitor commit history for quality
|
|
354
|
-
- Adjust quality gates if too strict or too loose
|
|
355
|
-
- Use batch mode during focused work sessions
|
|
356
|
-
- Coordinate with team when executing larger batches
|
|
1
|
+
# Batch Task Execution Workflow
|
|
2
|
+
|
|
3
|
+
This file defines the template for autonomous batch task execution via the `pwn batch` command.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Batch task execution allows AI agents to autonomously:
|
|
8
|
+
- Select tasks from backlog
|
|
9
|
+
- Execute work in sequence
|
|
10
|
+
- Run quality gates (tests, linting, type checking)
|
|
11
|
+
- Commit changes following conventions
|
|
12
|
+
- Continue until backlog depleted or threshold reached
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Execute next available task
|
|
18
|
+
pwn batch
|
|
19
|
+
|
|
20
|
+
# Execute specific number of tasks
|
|
21
|
+
pwn batch --count 5
|
|
22
|
+
|
|
23
|
+
# Dry-run: show what would execute
|
|
24
|
+
pwn batch --dry-run
|
|
25
|
+
|
|
26
|
+
# Execute with specific priority
|
|
27
|
+
pwn batch --priority high
|
|
28
|
+
|
|
29
|
+
# Resume interrupted batch
|
|
30
|
+
pwn batch --resume
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Batch Execution Protocol
|
|
34
|
+
|
|
35
|
+
### Phase 1: Task Selection
|
|
36
|
+
|
|
37
|
+
1. Read `tasks/active.md` for incomplete tasks
|
|
38
|
+
2. If active tasks exist and not blocked, resume
|
|
39
|
+
3. Otherwise, read `tasks/backlog.md`
|
|
40
|
+
4. Select highest priority unblocked task
|
|
41
|
+
5. Verify dependencies are met
|
|
42
|
+
6. Move to `active.md`
|
|
43
|
+
|
|
44
|
+
### Phase 2: Execution
|
|
45
|
+
|
|
46
|
+
1. Analyze task requirements
|
|
47
|
+
2. Create feature branch: `feature/[task-id]-[slug]`
|
|
48
|
+
3. Execute work following patterns in `patterns/index.md`
|
|
49
|
+
4. Test incrementally during development
|
|
50
|
+
5. Keep commits atomic and descriptive
|
|
51
|
+
|
|
52
|
+
### Phase 3: Quality Gates
|
|
53
|
+
|
|
54
|
+
Before commit, verify:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Type checking
|
|
58
|
+
[ ] npm run typecheck || tsc --noEmit
|
|
59
|
+
|
|
60
|
+
# Linting
|
|
61
|
+
[ ] npm run lint || eslint .
|
|
62
|
+
|
|
63
|
+
# Unit tests
|
|
64
|
+
[ ] npm run test || jest
|
|
65
|
+
|
|
66
|
+
# Integration tests (if applicable)
|
|
67
|
+
[ ] npm run test:integration
|
|
68
|
+
|
|
69
|
+
# Build verification
|
|
70
|
+
[ ] npm run build
|
|
71
|
+
|
|
72
|
+
# Security scan (if configured)
|
|
73
|
+
[ ] npm run security
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Gate Strategy:**
|
|
77
|
+
- Fail fast on first error
|
|
78
|
+
- Output clear error message
|
|
79
|
+
- Suggest fix if known
|
|
80
|
+
- Option to skip non-critical gates with `--force`
|
|
81
|
+
|
|
82
|
+
### Phase 4: Commit & Cleanup
|
|
83
|
+
|
|
84
|
+
1. Stage all changes: `git add .`
|
|
85
|
+
2. Commit with message format:
|
|
86
|
+
```
|
|
87
|
+
feat: [task-id] - [description]
|
|
88
|
+
|
|
89
|
+
- Specific change 1
|
|
90
|
+
- Specific change 2
|
|
91
|
+
|
|
92
|
+
Fixes: [task-id]
|
|
93
|
+
```
|
|
94
|
+
3. Push to remote: `git push -u origin feature/[task-id]-[slug]`
|
|
95
|
+
4. Create PR if configured
|
|
96
|
+
5. Update `active.md`: mark complete with date
|
|
97
|
+
|
|
98
|
+
### Phase 5: Completion
|
|
99
|
+
|
|
100
|
+
1. Verify commit is on remote
|
|
101
|
+
2. Delete local feature branch
|
|
102
|
+
3. Report completion to user
|
|
103
|
+
4. Continue to next task or stop
|
|
104
|
+
|
|
105
|
+
## Batch Configuration
|
|
106
|
+
|
|
107
|
+
Define batch settings in `state.json`:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"batch_config": {
|
|
112
|
+
"max_tasks": 5,
|
|
113
|
+
"max_duration_hours": 4,
|
|
114
|
+
"quality_gates": ["typecheck", "lint", "test"],
|
|
115
|
+
"skip_gates": [],
|
|
116
|
+
"auto_commit": true,
|
|
117
|
+
"auto_push": false,
|
|
118
|
+
"create_pr": false,
|
|
119
|
+
"branch_format": "feature/{id}-{slug}",
|
|
120
|
+
"commit_format": "conventional"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Task Selection Strategy
|
|
126
|
+
|
|
127
|
+
### Default: Highest Priority
|
|
128
|
+
```
|
|
129
|
+
- High priority tasks first
|
|
130
|
+
- Within priority: ordered by position in backlog
|
|
131
|
+
- Skip blocked tasks (note reason in state)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Alternative: By Effort
|
|
135
|
+
```
|
|
136
|
+
- Small (XS, S) tasks first
|
|
137
|
+
- Accumulate quick wins
|
|
138
|
+
- Build momentum
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Alternative: By Due Date
|
|
142
|
+
```
|
|
143
|
+
- Tasks with deadlines first
|
|
144
|
+
- Then by priority
|
|
145
|
+
- Suitable for time-sensitive work
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Error Handling
|
|
149
|
+
|
|
150
|
+
### Build Fails
|
|
151
|
+
```
|
|
152
|
+
1. Show error output
|
|
153
|
+
2. Offer options:
|
|
154
|
+
a) Fix automatically (if pattern known)
|
|
155
|
+
b) Pause for manual fix
|
|
156
|
+
c) Skip to next task (with note)
|
|
157
|
+
3. Retry if auto-fixed
|
|
158
|
+
4. Abort batch if repeated failures
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Test Fails
|
|
162
|
+
```
|
|
163
|
+
1. Show failing test
|
|
164
|
+
2. Offer options:
|
|
165
|
+
a) Debug and fix
|
|
166
|
+
b) Review assertion (might be test issue)
|
|
167
|
+
c) Pause for investigation
|
|
168
|
+
3. Don't commit until tests pass
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Git Conflicts
|
|
172
|
+
```
|
|
173
|
+
1. Pause batch execution
|
|
174
|
+
2. Notify user of conflict
|
|
175
|
+
3. Request manual resolution
|
|
176
|
+
4. Resume after rebase/merge
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Dependency Issues
|
|
180
|
+
```
|
|
181
|
+
1. Check if task dependencies are met
|
|
182
|
+
2. If not met:
|
|
183
|
+
a) Add dependency task to batch
|
|
184
|
+
b) Execute dependency first
|
|
185
|
+
c) Resume original task
|
|
186
|
+
3. Don't proceed if can't satisfy dependencies
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Commit Message Format
|
|
190
|
+
|
|
191
|
+
Use conventional commits:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
type(scope): subject
|
|
195
|
+
|
|
196
|
+
body
|
|
197
|
+
|
|
198
|
+
footer
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Types:**
|
|
202
|
+
- `feat:` New feature
|
|
203
|
+
- `fix:` Bug fix
|
|
204
|
+
- `docs:` Documentation
|
|
205
|
+
- `style:` Code style (formatting, missing semicolons)
|
|
206
|
+
- `refactor:` Refactoring without feature changes
|
|
207
|
+
- `perf:` Performance improvement
|
|
208
|
+
- `test:` Adding/updating tests
|
|
209
|
+
- `chore:` Build, dependencies, tooling
|
|
210
|
+
|
|
211
|
+
**Example:**
|
|
212
|
+
```
|
|
213
|
+
feat(youtube-summarizer): add batch download mode
|
|
214
|
+
|
|
215
|
+
- Added batch processing for multiple URLs
|
|
216
|
+
- Implemented progress tracking
|
|
217
|
+
- Added resume capability for interrupted batches
|
|
218
|
+
|
|
219
|
+
Fixes: US-042
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Logging & Reporting
|
|
223
|
+
|
|
224
|
+
Log batch execution for review:
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
[14:23] Starting batch execution (max 5 tasks, 4 hours)
|
|
228
|
+
[14:23] → Selected US-042: Add batch download mode (High, M)
|
|
229
|
+
[14:25] ✓ Feature branch created
|
|
230
|
+
[14:28] ✓ Implementation complete
|
|
231
|
+
[14:30] ✓ Tests pass (18 specs, 0 failures)
|
|
232
|
+
[14:31] ✓ Linting pass (0 issues)
|
|
233
|
+
[14:31] ✓ Build successful (2.3s)
|
|
234
|
+
[14:32] ✓ Committed: feat(youtube-summarizer): add batch download mode
|
|
235
|
+
[14:33] ✓ Pushed to origin
|
|
236
|
+
[14:33] ✓ Task completed (10 min)
|
|
237
|
+
[14:33]
|
|
238
|
+
[14:33] → Selected US-043: Add schedule endpoint (High, M)
|
|
239
|
+
[14:35] ✗ Type check failed: ...
|
|
240
|
+
[14:35] ⓘ Pausing batch - manual intervention needed
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Resuming Batch
|
|
244
|
+
|
|
245
|
+
To resume after pause:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Shows what was paused
|
|
249
|
+
pwn batch --status
|
|
250
|
+
|
|
251
|
+
# Continue from where it stopped
|
|
252
|
+
pwn batch --resume
|
|
253
|
+
|
|
254
|
+
# Skip current task and continue
|
|
255
|
+
pwn batch --resume --skip
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
State is stored in `state.json`:
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"batch_state": {
|
|
263
|
+
"current_task": "US-042",
|
|
264
|
+
"started_at": "2026-01-21T14:23:00Z",
|
|
265
|
+
"completed": ["US-041"],
|
|
266
|
+
"pending": ["US-043", "US-044", "US-045"],
|
|
267
|
+
"paused_at": "2026-01-21T14:35:00Z",
|
|
268
|
+
"pause_reason": "Type check failed"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Safety Measures
|
|
274
|
+
|
|
275
|
+
1. **No destructive operations without confirmation**
|
|
276
|
+
- Force push requires explicit approval
|
|
277
|
+
- Deleting branches requires confirmation
|
|
278
|
+
- Reverting commits shows diff first
|
|
279
|
+
|
|
280
|
+
2. **Rollback capability**
|
|
281
|
+
- Each batch has unique branch
|
|
282
|
+
- Can revert entire batch: `git reset --hard`
|
|
283
|
+
- Commits are preserved in history
|
|
284
|
+
|
|
285
|
+
3. **Notifications**
|
|
286
|
+
- Completion notification to user
|
|
287
|
+
- Failure notification with context
|
|
288
|
+
- Blockers notify team if configured
|
|
289
|
+
|
|
290
|
+
4. **Rate limiting**
|
|
291
|
+
- Default 5 tasks max per batch
|
|
292
|
+
- Configurable via `--count` or `batch_config`
|
|
293
|
+
- Time-based limit (default 4 hours)
|
|
294
|
+
|
|
295
|
+
## Configuration Examples
|
|
296
|
+
|
|
297
|
+
### Quick Wins Mode
|
|
298
|
+
```json
|
|
299
|
+
{
|
|
300
|
+
"batch_config": {
|
|
301
|
+
"max_tasks": 10,
|
|
302
|
+
"selection_strategy": "effort",
|
|
303
|
+
"quality_gates": ["test"],
|
|
304
|
+
"auto_commit": true
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Safe Mode
|
|
310
|
+
```json
|
|
311
|
+
{
|
|
312
|
+
"batch_config": {
|
|
313
|
+
"max_tasks": 1,
|
|
314
|
+
"quality_gates": ["typecheck", "lint", "test", "build"],
|
|
315
|
+
"auto_commit": false,
|
|
316
|
+
"create_pr": true
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Aggressive Mode
|
|
322
|
+
```json
|
|
323
|
+
{
|
|
324
|
+
"batch_config": {
|
|
325
|
+
"max_tasks": 20,
|
|
326
|
+
"quality_gates": ["test"],
|
|
327
|
+
"skip_gates": ["typecheck"],
|
|
328
|
+
"auto_commit": true,
|
|
329
|
+
"auto_push": true
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## Monitoring
|
|
335
|
+
|
|
336
|
+
Track batch execution performance:
|
|
337
|
+
|
|
338
|
+
```json
|
|
339
|
+
{
|
|
340
|
+
"batch_metrics": {
|
|
341
|
+
"average_task_duration": "15 min",
|
|
342
|
+
"success_rate": "92%",
|
|
343
|
+
"most_common_blocker": "failing_tests",
|
|
344
|
+
"total_tasks_completed": 47
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Tips
|
|
350
|
+
|
|
351
|
+
- Start with small batches (1-3 tasks) to validate quality gates
|
|
352
|
+
- Increase batch size as confidence grows
|
|
353
|
+
- Monitor commit history for quality
|
|
354
|
+
- Adjust quality gates if too strict or too loose
|
|
355
|
+
- Use batch mode during focused work sessions
|
|
356
|
+
- Coordinate with team when executing larger batches
|