@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.
Files changed (46) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +265 -251
  3. package/cli/batch.js +333 -333
  4. package/cli/codespaces.js +303 -303
  5. package/cli/index.js +98 -91
  6. package/cli/inject.js +78 -67
  7. package/cli/knowledge.js +531 -531
  8. package/cli/migrate.js +466 -0
  9. package/cli/notify.js +135 -135
  10. package/cli/patterns.js +665 -665
  11. package/cli/status.js +91 -91
  12. package/cli/validate.js +61 -61
  13. package/package.json +70 -70
  14. package/src/core/inject.js +208 -204
  15. package/src/core/state.js +91 -91
  16. package/src/core/validate.js +202 -202
  17. package/src/core/workspace.js +176 -176
  18. package/src/index.js +20 -20
  19. package/src/knowledge/gc.js +308 -308
  20. package/src/knowledge/lifecycle.js +401 -401
  21. package/src/knowledge/promote.js +364 -364
  22. package/src/knowledge/references.js +342 -342
  23. package/src/patterns/matcher.js +218 -218
  24. package/src/patterns/registry.js +375 -375
  25. package/src/patterns/triggers.js +423 -423
  26. package/src/services/batch-service.js +849 -849
  27. package/src/services/notification-service.js +342 -342
  28. package/templates/codespaces/devcontainer.json +52 -52
  29. package/templates/codespaces/setup.sh +70 -70
  30. package/templates/workspace/.ai/README.md +164 -164
  31. package/templates/workspace/.ai/agents/README.md +204 -204
  32. package/templates/workspace/.ai/agents/claude.md +625 -625
  33. package/templates/workspace/.ai/config/README.md +79 -79
  34. package/templates/workspace/.ai/config/notifications.template.json +20 -20
  35. package/templates/workspace/.ai/memory/deadends.md +79 -79
  36. package/templates/workspace/.ai/memory/decisions.md +58 -58
  37. package/templates/workspace/.ai/memory/patterns.md +65 -65
  38. package/templates/workspace/.ai/patterns/backend/README.md +126 -126
  39. package/templates/workspace/.ai/patterns/frontend/README.md +103 -103
  40. package/templates/workspace/.ai/patterns/index.md +256 -256
  41. package/templates/workspace/.ai/patterns/triggers.json +1087 -1087
  42. package/templates/workspace/.ai/patterns/universal/README.md +141 -141
  43. package/templates/workspace/.ai/state.template.json +8 -8
  44. package/templates/workspace/.ai/tasks/active.md +77 -77
  45. package/templates/workspace/.ai/tasks/backlog.md +95 -95
  46. package/templates/workspace/.ai/workflows/batch-task.md +356 -356
@@ -1,204 +1,204 @@
1
- # AI Agent Configuration
2
-
3
- This directory contains bootstrap instructions and configuration for different AI agents working on this project.
4
-
5
- ## Overview
6
-
7
- Different AI agents (Claude, Cursor, Copilot, etc.) need specific instructions to work effectively with PWN framework and project context.
8
-
9
- Each agent has:
10
- - **`<agent>.md`** - Complete bootstrap instructions for that agent
11
- - **Auto-load triggers** defined in `patterns/index.md`
12
- - **Context loading order** for efficient session start
13
- - **Task execution mode** (batch vs. interactive)
14
-
15
- ## Available Agents
16
-
17
- ### Claude Code (`claude.md`)
18
- - **Status:** Primary agent
19
- - **Recommended for:** Full-stack development, complex tasks, refactoring
20
- - **Session model:** Interactive or batch (autonomous)
21
- - **Model:** Claude Opus 4.5 (recommended)
22
-
23
- ### Cursor (Coming Soon)
24
- - **Status:** Planned
25
- - **Recommended for:** Single-file editing, rapid iteration
26
- - **Session model:** Interactive
27
- - **Model:** Latest Claude via Cursor
28
-
29
- ### GitHub Copilot (Coming Soon)
30
- - **Status:** Planned
31
- - **Recommended for:** In-IDE completion, pair programming
32
- - **Session model:** Interactive
33
- - **Model:** Copilot Plus
34
-
35
- ## Bootstrap Protocol
36
-
37
- Every agent follows this sequence on session start:
38
-
39
- 1. **Load Session State**
40
- - Read `/.ai/state.json` for current session info
41
- - Identify developer and session mode
42
-
43
- 2. **Load Shared Context**
44
- - Read `memory/decisions.md` for architectural decisions
45
- - Read `memory/patterns.md` for discovered patterns
46
- - Read `memory/deadends.md` to avoid known failures
47
-
48
- 3. **Load Task Context**
49
- - Read `tasks/active.md` for current work
50
- - Optionally read `tasks/backlog.md` for planning
51
-
52
- 4. **Register Auto-Apply Triggers**
53
- - Read `patterns/index.md`
54
- - Register file watchers and import triggers
55
- - Load relevant patterns as needed
56
-
57
- 5. **Load Agent-Specific Instructions**
58
- - Read `agents/<agent>.md` for specific bootstrap
59
- - Configure agent settings from `state.json`
60
- - Prepare for interactive or batch mode
61
-
62
- 6. **Acknowledge Understanding**
63
- - Display what context was loaded
64
- - Show current task or available work
65
- - Ready to accept commands
66
-
67
- ## Agent-Specific Features
68
-
69
- ### Claude Code
70
- - Full filesystem access
71
- - Git repository integration
72
- - Browser automation (Playwright)
73
- - Network requests
74
- - File editing and creation
75
- - Batch task execution
76
- - Pattern auto-application
77
-
78
- ### Cursor
79
- - Single file focus
80
- - In-editor quick-start
81
- - Codebase navigation
82
- - Inline suggestions
83
- - Git integration (basic)
84
-
85
- ### Copilot
86
- - In-IDE suggestions
87
- - Autocomplete
88
- - Ghost text
89
- - Chat interface
90
- - Limited filesystem access
91
-
92
- ## Adding New Agents
93
-
94
- To add a new AI agent:
95
-
96
- 1. Create `agents/<agent-name>.md` with complete bootstrap instructions
97
- 2. Follow the template structure in `claude.md`
98
- 3. Include agent-specific capabilities and limitations
99
- 4. Define recommended use cases
100
- 5. Add instructions for pattern auto-application
101
- 6. Document any configuration needed in `state.json`
102
- 7. Commit with message: `docs: add <agent-name> agent bootstrap`
103
-
104
- ### Template Structure
105
-
106
- ```markdown
107
- # [Agent Name] Bootstrap
108
-
109
- ## Overview
110
- - What the agent is and does
111
- - Recommended use cases
112
- - Supported models
113
-
114
- ## Session Start Protocol
115
- 1. Step 1
116
- 2. Step 2
117
- 3. ...
118
-
119
- ## Configuration
120
- - Settings in state.json
121
- - Environment variables
122
- - Installation requirements
123
-
124
- ## Capabilities
125
- - What it can do
126
- - Limitations
127
- - Best practices
128
-
129
- ## Examples
130
- - Example 1: Typical workflow
131
- - Example 2: Complex scenario
132
-
133
- ## Troubleshooting
134
- - Common issues
135
- - Solutions
136
- ```
137
-
138
- ## Workflow Coordination
139
-
140
- Multiple agents can work on same project:
141
-
142
- - **Serial workflow:** Agent A finishes, Agent B continues
143
- - Commit state before switching agents
144
- - New agent reads latest context and tasks
145
-
146
- - **Parallel workflow:** Different agents on different tasks
147
- - Each agent has separate active task
148
- - Coordinate via `tasks/active.md`
149
- - Merge regularly to avoid conflicts
150
-
151
- ## State Sharing
152
-
153
- All agents share:
154
-
155
- ```
156
- tasks/active.md ← What's being worked on
157
- tasks/backlog.md ← What's next
158
- memory/decisions.md ← What was decided
159
- memory/patterns.md ← What was learned
160
- memory/deadends.md ← What failed
161
- ```
162
-
163
- Each agent has personal state in:
164
-
165
- ```
166
- .ai/state.json ← Personal session state (git-ignored)
167
- .ai/config/ ← Agent-specific configs (git-ignored)
168
- ```
169
-
170
- ## Configuration Format
171
-
172
- Agent configuration in `state.json`:
173
-
174
- ```json
175
- {
176
- "agent": "claude",
177
- "model": "claude-opus-4-5",
178
- "session_mode": "interactive",
179
- "auto_patterns": true,
180
- "batch_config": { ... },
181
- "developer": "username"
182
- }
183
- ```
184
-
185
- ## Tips for Agent Integration
186
-
187
- 1. **Keep context compact** - Link to detailed docs, don't embed everything
188
- 2. **Make decisions explicit** - Use `memory/decisions.md` for reasoning
189
- 3. **Track failures** - Document dead ends to avoid repetition
190
- 4. **Commit frequently** - Small commits are easier to understand
191
- 5. **Update patterns** - Capture learned patterns for future use
192
- 6. **Test quality gates** - Automate verification to catch issues early
193
-
194
- ## Links
195
-
196
- - [Claude Code Bootstrap](claude.md) - Full instructions for Claude
197
- - [Patterns Auto-Apply System](../patterns/index.md) - How triggers work
198
- - [Batch Execution Workflow](../workflows/batch-task.md) - Autonomous task execution
199
-
200
- ## Version
201
-
202
- **Last Updated:** (Set on template injection)
203
- **Supported Agents:** Claude, Cursor (planned), Copilot (planned)
204
- **Framework:** PWN 1.0.0
1
+ # AI Agent Configuration
2
+
3
+ This directory contains bootstrap instructions and configuration for different AI agents working on this project.
4
+
5
+ ## Overview
6
+
7
+ Different AI agents (Claude, Cursor, Copilot, etc.) need specific instructions to work effectively with PWN framework and project context.
8
+
9
+ Each agent has:
10
+ - **`<agent>.md`** - Complete bootstrap instructions for that agent
11
+ - **Auto-load triggers** defined in `patterns/index.md`
12
+ - **Context loading order** for efficient session start
13
+ - **Task execution mode** (batch vs. interactive)
14
+
15
+ ## Available Agents
16
+
17
+ ### Claude Code (`claude.md`)
18
+ - **Status:** Primary agent
19
+ - **Recommended for:** Full-stack development, complex tasks, refactoring
20
+ - **Session model:** Interactive or batch (autonomous)
21
+ - **Model:** Claude Opus 4.5 (recommended)
22
+
23
+ ### Cursor (Coming Soon)
24
+ - **Status:** Planned
25
+ - **Recommended for:** Single-file editing, rapid iteration
26
+ - **Session model:** Interactive
27
+ - **Model:** Latest Claude via Cursor
28
+
29
+ ### GitHub Copilot (Coming Soon)
30
+ - **Status:** Planned
31
+ - **Recommended for:** In-IDE completion, pair programming
32
+ - **Session model:** Interactive
33
+ - **Model:** Copilot Plus
34
+
35
+ ## Bootstrap Protocol
36
+
37
+ Every agent follows this sequence on session start:
38
+
39
+ 1. **Load Session State**
40
+ - Read `/.ai/state.json` for current session info
41
+ - Identify developer and session mode
42
+
43
+ 2. **Load Shared Context**
44
+ - Read `memory/decisions.md` for architectural decisions
45
+ - Read `memory/patterns.md` for discovered patterns
46
+ - Read `memory/deadends.md` to avoid known failures
47
+
48
+ 3. **Load Task Context**
49
+ - Read `tasks/active.md` for current work
50
+ - Optionally read `tasks/backlog.md` for planning
51
+
52
+ 4. **Register Auto-Apply Triggers**
53
+ - Read `patterns/index.md`
54
+ - Register file watchers and import triggers
55
+ - Load relevant patterns as needed
56
+
57
+ 5. **Load Agent-Specific Instructions**
58
+ - Read `agents/<agent>.md` for specific bootstrap
59
+ - Configure agent settings from `state.json`
60
+ - Prepare for interactive or batch mode
61
+
62
+ 6. **Acknowledge Understanding**
63
+ - Display what context was loaded
64
+ - Show current task or available work
65
+ - Ready to accept commands
66
+
67
+ ## Agent-Specific Features
68
+
69
+ ### Claude Code
70
+ - Full filesystem access
71
+ - Git repository integration
72
+ - Browser automation (Playwright)
73
+ - Network requests
74
+ - File editing and creation
75
+ - Batch task execution
76
+ - Pattern auto-application
77
+
78
+ ### Cursor
79
+ - Single file focus
80
+ - In-editor quick-start
81
+ - Codebase navigation
82
+ - Inline suggestions
83
+ - Git integration (basic)
84
+
85
+ ### Copilot
86
+ - In-IDE suggestions
87
+ - Autocomplete
88
+ - Ghost text
89
+ - Chat interface
90
+ - Limited filesystem access
91
+
92
+ ## Adding New Agents
93
+
94
+ To add a new AI agent:
95
+
96
+ 1. Create `agents/<agent-name>.md` with complete bootstrap instructions
97
+ 2. Follow the template structure in `claude.md`
98
+ 3. Include agent-specific capabilities and limitations
99
+ 4. Define recommended use cases
100
+ 5. Add instructions for pattern auto-application
101
+ 6. Document any configuration needed in `state.json`
102
+ 7. Commit with message: `docs: add <agent-name> agent bootstrap`
103
+
104
+ ### Template Structure
105
+
106
+ ```markdown
107
+ # [Agent Name] Bootstrap
108
+
109
+ ## Overview
110
+ - What the agent is and does
111
+ - Recommended use cases
112
+ - Supported models
113
+
114
+ ## Session Start Protocol
115
+ 1. Step 1
116
+ 2. Step 2
117
+ 3. ...
118
+
119
+ ## Configuration
120
+ - Settings in state.json
121
+ - Environment variables
122
+ - Installation requirements
123
+
124
+ ## Capabilities
125
+ - What it can do
126
+ - Limitations
127
+ - Best practices
128
+
129
+ ## Examples
130
+ - Example 1: Typical workflow
131
+ - Example 2: Complex scenario
132
+
133
+ ## Troubleshooting
134
+ - Common issues
135
+ - Solutions
136
+ ```
137
+
138
+ ## Workflow Coordination
139
+
140
+ Multiple agents can work on same project:
141
+
142
+ - **Serial workflow:** Agent A finishes, Agent B continues
143
+ - Commit state before switching agents
144
+ - New agent reads latest context and tasks
145
+
146
+ - **Parallel workflow:** Different agents on different tasks
147
+ - Each agent has separate active task
148
+ - Coordinate via `tasks/active.md`
149
+ - Merge regularly to avoid conflicts
150
+
151
+ ## State Sharing
152
+
153
+ All agents share:
154
+
155
+ ```
156
+ tasks/active.md ← What's being worked on
157
+ tasks/backlog.md ← What's next
158
+ memory/decisions.md ← What was decided
159
+ memory/patterns.md ← What was learned
160
+ memory/deadends.md ← What failed
161
+ ```
162
+
163
+ Each agent has personal state in:
164
+
165
+ ```
166
+ .ai/state.json ← Personal session state (git-ignored)
167
+ .ai/config/ ← Agent-specific configs (git-ignored)
168
+ ```
169
+
170
+ ## Configuration Format
171
+
172
+ Agent configuration in `state.json`:
173
+
174
+ ```json
175
+ {
176
+ "agent": "claude",
177
+ "model": "claude-opus-4-5",
178
+ "session_mode": "interactive",
179
+ "auto_patterns": true,
180
+ "batch_config": { ... },
181
+ "developer": "username"
182
+ }
183
+ ```
184
+
185
+ ## Tips for Agent Integration
186
+
187
+ 1. **Keep context compact** - Link to detailed docs, don't embed everything
188
+ 2. **Make decisions explicit** - Use `memory/decisions.md` for reasoning
189
+ 3. **Track failures** - Document dead ends to avoid repetition
190
+ 4. **Commit frequently** - Small commits are easier to understand
191
+ 5. **Update patterns** - Capture learned patterns for future use
192
+ 6. **Test quality gates** - Automate verification to catch issues early
193
+
194
+ ## Links
195
+
196
+ - [Claude Code Bootstrap](claude.md) - Full instructions for Claude
197
+ - [Patterns Auto-Apply System](../patterns/index.md) - How triggers work
198
+ - [Batch Execution Workflow](../workflows/batch-task.md) - Autonomous task execution
199
+
200
+ ## Version
201
+
202
+ **Last Updated:** (Set on template injection)
203
+ **Supported Agents:** Claude, Cursor (planned), Copilot (planned)
204
+ **Framework:** PWN 1.0.0