@fermindi/pwn-cli 0.1.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 -0
- package/README.md +251 -0
- package/cli/batch.js +333 -0
- package/cli/codespaces.js +303 -0
- package/cli/index.js +91 -0
- package/cli/inject.js +53 -0
- package/cli/knowledge.js +531 -0
- package/cli/notify.js +135 -0
- package/cli/patterns.js +665 -0
- package/cli/status.js +91 -0
- package/cli/validate.js +61 -0
- package/package.json +70 -0
- package/src/core/inject.js +128 -0
- package/src/core/state.js +91 -0
- package/src/core/validate.js +202 -0
- package/src/core/workspace.js +176 -0
- package/src/index.js +20 -0
- package/src/knowledge/gc.js +308 -0
- package/src/knowledge/lifecycle.js +401 -0
- package/src/knowledge/promote.js +364 -0
- package/src/knowledge/references.js +342 -0
- package/src/patterns/matcher.js +218 -0
- package/src/patterns/registry.js +375 -0
- package/src/patterns/triggers.js +423 -0
- package/src/services/batch-service.js +849 -0
- package/src/services/notification-service.js +342 -0
- package/templates/codespaces/devcontainer.json +52 -0
- package/templates/codespaces/setup.sh +70 -0
- package/templates/workspace/.ai/README.md +164 -0
- package/templates/workspace/.ai/agents/README.md +204 -0
- package/templates/workspace/.ai/agents/claude.md +625 -0
- package/templates/workspace/.ai/config/.gitkeep +0 -0
- package/templates/workspace/.ai/config/README.md +79 -0
- package/templates/workspace/.ai/config/notifications.template.json +20 -0
- package/templates/workspace/.ai/memory/deadends.md +79 -0
- package/templates/workspace/.ai/memory/decisions.md +58 -0
- package/templates/workspace/.ai/memory/patterns.md +65 -0
- package/templates/workspace/.ai/patterns/backend/README.md +126 -0
- package/templates/workspace/.ai/patterns/frontend/README.md +103 -0
- package/templates/workspace/.ai/patterns/index.md +256 -0
- package/templates/workspace/.ai/patterns/triggers.json +1087 -0
- package/templates/workspace/.ai/patterns/universal/README.md +141 -0
- package/templates/workspace/.ai/state.template.json +8 -0
- package/templates/workspace/.ai/tasks/active.md +77 -0
- package/templates/workspace/.ai/tasks/backlog.md +95 -0
- package/templates/workspace/.ai/workflows/batch-task.md +356 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Universal Patterns
|
|
2
|
+
|
|
3
|
+
This directory contains cross-cutting patterns that apply to both frontend and backend development.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Universal patterns cover:
|
|
8
|
+
- TypeScript best practices
|
|
9
|
+
- Testing strategies (unit, integration, e2e)
|
|
10
|
+
- Error handling and logging
|
|
11
|
+
- Git workflow and commit conventions
|
|
12
|
+
- Build tool configuration
|
|
13
|
+
- Code organization
|
|
14
|
+
- Documentation standards
|
|
15
|
+
- Performance profiling
|
|
16
|
+
- Security principles
|
|
17
|
+
|
|
18
|
+
## Structure
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
universal/
|
|
22
|
+
├── README.md # This file
|
|
23
|
+
├── typescript/ # TypeScript patterns
|
|
24
|
+
│ └── README.md # Type definitions, generics, etc.
|
|
25
|
+
├── testing/ # Testing patterns
|
|
26
|
+
│ ├── unit/README.md # Unit test patterns
|
|
27
|
+
│ ├── integration/README.md # Integration test patterns
|
|
28
|
+
│ └── e2e/README.md # End-to-end test patterns
|
|
29
|
+
├── error-handling/ # Error handling patterns
|
|
30
|
+
│ └── README.md # Exception handling, logging
|
|
31
|
+
├── git/ # Git workflow patterns
|
|
32
|
+
│ └── README.md # Branching, commits, PRs
|
|
33
|
+
├── build-tools/ # Build and package patterns
|
|
34
|
+
│ └── README.md # Webpack, Vite, etc.
|
|
35
|
+
├── performance/ # Performance optimization
|
|
36
|
+
│ └── README.md # Profiling, optimization
|
|
37
|
+
└── security/ # Security patterns
|
|
38
|
+
└── README.md # Input validation, secrets, etc.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Auto-Apply Triggers
|
|
42
|
+
|
|
43
|
+
These patterns are automatically loaded when:
|
|
44
|
+
|
|
45
|
+
- **File:** `*.ts`, `*.tsx` (TypeScript)
|
|
46
|
+
- **File:** `*.test.ts`, `*.spec.ts` (Tests)
|
|
47
|
+
- **Import:** `from 'jest'`, `from 'vitest'` (Testing)
|
|
48
|
+
- **Command:** `git commit`, `npm build` (Git, Build)
|
|
49
|
+
- **Path:** `src/__tests__/`, `cypress/`, `playwright/`
|
|
50
|
+
|
|
51
|
+
See `patterns/index.md` for trigger configuration.
|
|
52
|
+
|
|
53
|
+
## Common Patterns
|
|
54
|
+
|
|
55
|
+
### TypeScript
|
|
56
|
+
- Enable strict mode in `tsconfig.json`
|
|
57
|
+
- Use interfaces for object shapes, types for aliases
|
|
58
|
+
- Avoid `any` - use `unknown` with type guards instead
|
|
59
|
+
- Export types alongside implementations
|
|
60
|
+
- Use generics for reusable, type-safe code
|
|
61
|
+
- Document complex types with JSDoc comments
|
|
62
|
+
|
|
63
|
+
### Testing Strategy
|
|
64
|
+
- Unit tests for utilities and pure functions
|
|
65
|
+
- Integration tests for API endpoints and workflows
|
|
66
|
+
- E2E tests for critical user journeys
|
|
67
|
+
- Test file co-located with source: `feature.ts` + `feature.test.ts`
|
|
68
|
+
- Aim for >80% code coverage on critical paths
|
|
69
|
+
- Mock external dependencies, test real business logic
|
|
70
|
+
|
|
71
|
+
### Error Handling
|
|
72
|
+
- Use custom error classes that extend Error
|
|
73
|
+
- Include error context (what, why, how to fix)
|
|
74
|
+
- Log errors with full stack traces
|
|
75
|
+
- Different handling strategies for different error types
|
|
76
|
+
- Never silently catch and ignore errors
|
|
77
|
+
- Provide user-friendly error messages
|
|
78
|
+
|
|
79
|
+
### Git Workflow
|
|
80
|
+
- Descriptive commit messages (50 char subject, blank line, details)
|
|
81
|
+
- Atomic commits (one logical change per commit)
|
|
82
|
+
- Branch naming: `feature/name`, `fix/name`, `docs/name`
|
|
83
|
+
- Pull request template with context
|
|
84
|
+
- Code review before merge
|
|
85
|
+
- Squash or rebase to keep history clean
|
|
86
|
+
|
|
87
|
+
### Build Tools
|
|
88
|
+
- Consistent build configuration across projects
|
|
89
|
+
- Separate dev and production builds
|
|
90
|
+
- Fast development build (hot reload, source maps)
|
|
91
|
+
- Optimized production build (minification, tree-shaking)
|
|
92
|
+
- Automate with npm/pnpm scripts
|
|
93
|
+
- Cache dependencies to speed up builds
|
|
94
|
+
|
|
95
|
+
### Code Organization
|
|
96
|
+
- Organize by feature, not by type
|
|
97
|
+
- Keep related code together
|
|
98
|
+
- Use barrel exports (`index.ts`) for clean imports
|
|
99
|
+
- Avoid circular dependencies
|
|
100
|
+
- Monorepo structure for related packages
|
|
101
|
+
- Clear separation of concerns
|
|
102
|
+
|
|
103
|
+
### Documentation
|
|
104
|
+
- JSDoc comments for public APIs
|
|
105
|
+
- README files in each directory explaining purpose
|
|
106
|
+
- Architecture decision records (ADRs)
|
|
107
|
+
- Code examples for complex logic
|
|
108
|
+
- Keep docs in sync with code
|
|
109
|
+
- Link to external references where relevant
|
|
110
|
+
|
|
111
|
+
## Usage
|
|
112
|
+
|
|
113
|
+
1. Read the relevant sub-directory README for your task
|
|
114
|
+
2. Check code examples for reference implementations
|
|
115
|
+
3. Apply patterns to new code
|
|
116
|
+
4. Update patterns if you discover improvements
|
|
117
|
+
|
|
118
|
+
## Contributing
|
|
119
|
+
|
|
120
|
+
Found a better pattern?
|
|
121
|
+
|
|
122
|
+
1. Document it with examples
|
|
123
|
+
2. Add to appropriate subdirectory
|
|
124
|
+
3. Update this README
|
|
125
|
+
4. Commit with message: `docs: add [pattern name] pattern`
|
|
126
|
+
5. Update triggers in `patterns/index.md` if widely applicable
|
|
127
|
+
|
|
128
|
+
## Links
|
|
129
|
+
|
|
130
|
+
- [TypeScript Patterns](typescript/README.md)
|
|
131
|
+
- [Testing Strategies](testing/README.md)
|
|
132
|
+
- [Error Handling](error-handling/README.md)
|
|
133
|
+
- [Git Workflow](git/README.md)
|
|
134
|
+
- [Build Tools](build-tools/README.md)
|
|
135
|
+
- [Performance Profiling](performance/README.md)
|
|
136
|
+
- [Security Principles](security/README.md)
|
|
137
|
+
|
|
138
|
+
## Version
|
|
139
|
+
|
|
140
|
+
**Last Updated:** (Set on template injection)
|
|
141
|
+
**Maintained By:** Development Team
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Active Tasks
|
|
2
|
+
|
|
3
|
+
This file tracks work currently in progress.
|
|
4
|
+
|
|
5
|
+
## Format
|
|
6
|
+
|
|
7
|
+
Use checkboxes to track completion status:
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
- [ ] US-001: Pending task
|
|
11
|
+
- [x] US-002: Completed task
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Each task can have:
|
|
15
|
+
- **Status indicator:** [ ] = pending, [x] = completed
|
|
16
|
+
- **ID:** US-XXX, BUG-XXX, DEV-XXX, or SPIKE-XXX
|
|
17
|
+
- **Title:** Clear, actionable description
|
|
18
|
+
- **Notes:** Optional context or blockers
|
|
19
|
+
- **Assignee:** Who's working on it (optional)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Task Types
|
|
24
|
+
|
|
25
|
+
- **US-XXX:** User Story (feature work)
|
|
26
|
+
- **BUG-XXX:** Bug fix
|
|
27
|
+
- **DEV-XXX:** Developer task (refactoring, tech debt)
|
|
28
|
+
- **SPIKE-XXX:** Research or investigation
|
|
29
|
+
- **DOCS-XXX:** Documentation
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Management Rules
|
|
34
|
+
|
|
35
|
+
1. **Limit WIP:** Keep 3-5 tasks active max
|
|
36
|
+
2. **Prioritize:** Order from highest to lowest priority
|
|
37
|
+
3. **Clarify blockers:** Note if task is blocked
|
|
38
|
+
4. **Update daily:** Check boxes as you work
|
|
39
|
+
5. **Archive completion:** Move finished tasks to backlog with date
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Template for New Task
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
- [ ] US-XXX: [Clear title]
|
|
47
|
+
- Assignee: (your name or team)
|
|
48
|
+
- Priority: High/Medium/Low
|
|
49
|
+
- Blocked by: (if applicable)
|
|
50
|
+
- Notes: (context)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Current Sprint
|
|
56
|
+
|
|
57
|
+
Update this section weekly with sprint goals and dates.
|
|
58
|
+
|
|
59
|
+
**Sprint:** YYYY-MM-DD to YYYY-MM-DD
|
|
60
|
+
**Goal:** (What we're trying to accomplish)
|
|
61
|
+
**Capacity:** (Team capacity/points)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Today's Focus
|
|
66
|
+
|
|
67
|
+
Highlight 1-3 most important tasks for today.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Notes
|
|
72
|
+
|
|
73
|
+
- Check backlog.md for upcoming work
|
|
74
|
+
- Move completed tasks to archive or backlog with completion date
|
|
75
|
+
- When stuck, create SPIKE task to investigate
|
|
76
|
+
- Reference decisions from `memory/decisions.md`
|
|
77
|
+
- Flag architectural changes for team discussion
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Backlog
|
|
2
|
+
|
|
3
|
+
This file contains prioritized future tasks not yet in active work.
|
|
4
|
+
|
|
5
|
+
## Format
|
|
6
|
+
|
|
7
|
+
Tasks are listed in priority order (highest to lowest):
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
### US-XXX: Task Title
|
|
11
|
+
**Type:** Story | Bug | DevTask
|
|
12
|
+
**Priority:** High | Medium | Low
|
|
13
|
+
**Effort:** (T-shirt size: XS, S, M, L, XL)
|
|
14
|
+
**Description:** What needs to be done
|
|
15
|
+
**Acceptance Criteria:**
|
|
16
|
+
- [ ] Criterion 1
|
|
17
|
+
- [ ] Criterion 2
|
|
18
|
+
**Dependencies:** (Other tasks needed first)
|
|
19
|
+
**Notes:** Context, caveats, research needed
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Moving to Active
|
|
25
|
+
|
|
26
|
+
When starting a backlog task:
|
|
27
|
+
|
|
28
|
+
1. Create issue/ticket in your tracking system
|
|
29
|
+
2. Move to `active.md` with checkbox
|
|
30
|
+
3. Assign team member
|
|
31
|
+
4. Update priority based on sprint plan
|
|
32
|
+
5. Reference in commit messages
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Adding New Tasks
|
|
37
|
+
|
|
38
|
+
When new work is identified:
|
|
39
|
+
|
|
40
|
+
1. Assign next ID (US-XXX, BUG-XXX, etc.)
|
|
41
|
+
2. Add to appropriate section
|
|
42
|
+
3. Fill in all fields
|
|
43
|
+
4. Don't assign yet - wait for planning
|
|
44
|
+
5. Commit with message: `docs: add [ID] to backlog`
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Backlog Sections
|
|
49
|
+
|
|
50
|
+
### High Priority
|
|
51
|
+
Work that should start soon. Review weekly.
|
|
52
|
+
|
|
53
|
+
### Medium Priority
|
|
54
|
+
Important but can wait. Review biweekly.
|
|
55
|
+
|
|
56
|
+
### Low Priority
|
|
57
|
+
Nice-to-have improvements. Review monthly.
|
|
58
|
+
|
|
59
|
+
### Roadmap (Future Phases)
|
|
60
|
+
Longer-term projects for future planning.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Template for New Backlog Item
|
|
65
|
+
|
|
66
|
+
```markdown
|
|
67
|
+
### US-XXX: [Title]
|
|
68
|
+
**Type:** Story | Bug | DevTask
|
|
69
|
+
**Priority:** High | Medium | Low
|
|
70
|
+
**Effort:** S/M/L
|
|
71
|
+
**Description:** (What and why)
|
|
72
|
+
**Acceptance Criteria:**
|
|
73
|
+
- [ ] (Specific, measurable outcome)
|
|
74
|
+
**Dependencies:** (Other tasks)
|
|
75
|
+
**Notes:** (Research, concerns, constraints)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Management Guidelines
|
|
81
|
+
|
|
82
|
+
- Groom backlog every sprint (remove duplicates, clarify)
|
|
83
|
+
- Estimate effort using relative sizing (XS, S, M, L, XL)
|
|
84
|
+
- Link related tasks together
|
|
85
|
+
- Archive completed items with date + time spent
|
|
86
|
+
- Keep description brief - link to external tickets for details
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Cleanup
|
|
91
|
+
|
|
92
|
+
- Remove or update duplicates
|
|
93
|
+
- Close blocked items after 30 days of no progress
|
|
94
|
+
- Archive completed items to `completed/` section
|
|
95
|
+
- Re-estimate if context changes significantly
|
|
@@ -0,0 +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
|