pure-point-guard 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/.claude-plugin/marketplace.json +17 -0
- package/.claude-plugin/plugin.json +7 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +462 -0
- package/dist/cli.js +2896 -0
- package/dist/cli.js.map +1 -0
- package/package.json +66 -0
- package/skills/ppg/SKILL.md +16 -0
- package/skills/ppg-conductor/SKILL.md +52 -0
- package/skills/ppg-conductor/references/commands.md +248 -0
- package/skills/ppg-conductor/references/conductor.md +183 -0
- package/skills/ppg-conductor/references/modes.md +85 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pure-point-guard",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "2witstudios"
|
|
5
|
+
},
|
|
6
|
+
"plugins": [
|
|
7
|
+
{
|
|
8
|
+
"name": "ppg",
|
|
9
|
+
"source": "./",
|
|
10
|
+
"description": "Orchestrate parallel AI coding agents — spawn, monitor, aggregate, and merge work across isolated git worktrees",
|
|
11
|
+
"version": "1.0.0",
|
|
12
|
+
"author": {
|
|
13
|
+
"name": "2witstudios"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-02-23
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Core orchestration commands: `init`, `spawn`, `status`, `kill`, `merge`
|
|
13
|
+
- Agent monitoring: `logs`, `attach`, `wait`, `send`
|
|
14
|
+
- Result collection: `aggregate` with file output support
|
|
15
|
+
- Worktree management: `worktree create`, `clean`, `diff`
|
|
16
|
+
- Agent lifecycle: `restart` for failed/killed agents
|
|
17
|
+
- Template system with `{{VAR}}` placeholders and built-in variables
|
|
18
|
+
- Agent-agnostic config — works with Claude Code, Codex, or any CLI agent
|
|
19
|
+
- Conductor mode — full `--json` support on every command for meta-agent orchestration
|
|
20
|
+
- Manifest-based state with file-level locking and atomic writes
|
|
21
|
+
- tmux session management: one session per project, one window per worktree, one pane per agent
|
|
22
|
+
- Terminal.app auto-open on macOS via AppleScript
|
|
23
|
+
- Status detection via signal-stack: result file, pane existence, pane liveness, current command
|
|
24
|
+
- Native macOS dashboard app (`ppg ui`)
|
|
25
|
+
|
|
26
|
+
[0.1.0]: https://github.com/2witstudios/ppg-cli/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 2witstudios
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
# ppg — Pure Point Guard
|
|
2
|
+
|
|
3
|
+
[](https://github.com/2witstudios/ppg-cli/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/pure-point-guard)
|
|
5
|
+
[](https://github.com/2witstudios/ppg-cli/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
Local orchestration runtime for parallel CLI coding agents.
|
|
8
|
+
|
|
9
|
+
ppg spawns multiple AI coding agents in isolated git worktrees, each in its own tmux pane, and gives you a single control plane to monitor, aggregate, and merge their work.
|
|
10
|
+
|
|
11
|
+
## Why
|
|
12
|
+
|
|
13
|
+
When you have a large task — adding tests across a codebase, refactoring multiple modules, fixing a batch of issues — you can break it into independent units and run them in parallel. ppg handles the plumbing: worktree creation, agent spawning, tmux session management, status tracking, result collection, and branch merging.
|
|
14
|
+
|
|
15
|
+
It works with any CLI agent (Claude Code, Codex, custom scripts) and is designed to be driven by a human or by a "conductor" meta-agent.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- **Node.js** >= 20
|
|
20
|
+
- **git** (with worktree support)
|
|
21
|
+
- **tmux** (`brew install tmux`)
|
|
22
|
+
- **macOS** (Terminal.app auto-open uses AppleScript; tmux features work anywhere)
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
### CLI
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g pure-point-guard
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Claude Code Integration
|
|
33
|
+
|
|
34
|
+
Running `ppg init` in any project automatically installs the `/ppg` skill for Claude Code. This gives Claude the ability to orchestrate parallel agents — just type `/ppg` in any Claude Code session.
|
|
35
|
+
|
|
36
|
+
### Dashboard (optional)
|
|
37
|
+
|
|
38
|
+
The native macOS dashboard app provides a visual interface for monitoring agents and worktrees.
|
|
39
|
+
|
|
40
|
+
**Via CLI:**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
ppg install-dashboard
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Or download directly** from [GitHub Releases](https://github.com/2witstudios/ppg-cli/releases/latest) — grab the `.dmg` file.
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Initialize in your project
|
|
52
|
+
cd your-project
|
|
53
|
+
ppg init
|
|
54
|
+
|
|
55
|
+
# Spawn an agent
|
|
56
|
+
ppg spawn --name fix-auth --prompt "Fix the authentication bug in src/auth.ts"
|
|
57
|
+
|
|
58
|
+
# Spawn multiple agents in parallel
|
|
59
|
+
ppg spawn --name add-tests --prompt "Add unit tests for src/utils/"
|
|
60
|
+
ppg spawn --name update-docs --prompt "Update the API documentation"
|
|
61
|
+
|
|
62
|
+
# Check status
|
|
63
|
+
ppg status
|
|
64
|
+
|
|
65
|
+
# Watch status live
|
|
66
|
+
ppg status --watch
|
|
67
|
+
|
|
68
|
+
# View agent output
|
|
69
|
+
ppg logs ag-xxxxxxxx
|
|
70
|
+
|
|
71
|
+
# Collect results
|
|
72
|
+
ppg aggregate --all
|
|
73
|
+
|
|
74
|
+
# Merge a completed worktree back
|
|
75
|
+
ppg merge wt-xxxxxx
|
|
76
|
+
|
|
77
|
+
# Open the dashboard
|
|
78
|
+
ppg ui
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Each `ppg spawn` creates a git worktree, opens a tmux pane, launches the agent, and pops open a Terminal.app window so you can watch it work.
|
|
82
|
+
|
|
83
|
+
## How It Works
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
your-project/
|
|
87
|
+
├── .pg/
|
|
88
|
+
│ ├── config.yaml # Agent and project config
|
|
89
|
+
│ ├── manifest.json # Runtime state (worktrees, agents, status)
|
|
90
|
+
│ ├── templates/ # Reusable prompt templates
|
|
91
|
+
│ ├── prompts/ # Generated per-agent prompt files
|
|
92
|
+
│ └── results/ # Agent result files
|
|
93
|
+
├── .worktrees/
|
|
94
|
+
│ ├── wt-abc123/ # Isolated git worktree
|
|
95
|
+
│ └── wt-def456/ # Another worktree
|
|
96
|
+
└── ...
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Worktrees** are isolated git checkouts on their own branches (`ppg/<name>`). Each agent works in its own worktree so there are no file conflicts between parallel agents.
|
|
100
|
+
|
|
101
|
+
**tmux** provides the process management layer. One session per project, one window per worktree, one pane per agent. This gives you `ppg logs`, `ppg status`, `ppg attach`, and `ppg kill` for free.
|
|
102
|
+
|
|
103
|
+
**Terminal.app windows** open automatically when agents spawn (macOS), so you can see what every agent is doing without manually attaching. Use `--no-open` to suppress this.
|
|
104
|
+
|
|
105
|
+
## Commands
|
|
106
|
+
|
|
107
|
+
### `ppg init`
|
|
108
|
+
|
|
109
|
+
Initialize ppg in the current git repository. Creates `.pg/` directory with default config and a sample template. Also installs the `/ppg` Claude Code skill if Claude Code is available.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
ppg init
|
|
113
|
+
ppg init --json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### `ppg spawn`
|
|
117
|
+
|
|
118
|
+
Spawn a new worktree with agent(s), or add agents to an existing worktree.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Inline prompt
|
|
122
|
+
ppg spawn --name fix-bug --prompt "Fix the null check in parser.ts"
|
|
123
|
+
|
|
124
|
+
# From a file
|
|
125
|
+
ppg spawn --name refactor --prompt-file tasks/refactor-auth.md
|
|
126
|
+
|
|
127
|
+
# Using a template with variables
|
|
128
|
+
ppg spawn --name add-tests --template test-writer --var SCOPE=auth --var STYLE=unit
|
|
129
|
+
|
|
130
|
+
# Multiple agents in one worktree
|
|
131
|
+
ppg spawn --name big-task --prompt "Implement feature X" --count 2
|
|
132
|
+
|
|
133
|
+
# Split panes in one window
|
|
134
|
+
ppg spawn --name big-task --prompt "Implement feature X" --count 2 --split
|
|
135
|
+
|
|
136
|
+
# Add agent to existing worktree
|
|
137
|
+
ppg spawn --worktree wt-abc123 --prompt "Review the changes"
|
|
138
|
+
|
|
139
|
+
# Silent mode (no Terminal window)
|
|
140
|
+
ppg spawn --name ci-task --prompt "Run linting" --no-open
|
|
141
|
+
|
|
142
|
+
# Specify base branch
|
|
143
|
+
ppg spawn --name hotfix --prompt "Fix critical bug" --base release/v2
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
| Option | Description |
|
|
147
|
+
|---|---|
|
|
148
|
+
| `-n, --name <name>` | Name for the worktree (becomes branch `ppg/<name>`) |
|
|
149
|
+
| `-a, --agent <type>` | Agent type from config (default: `claude`) |
|
|
150
|
+
| `-p, --prompt <text>` | Inline prompt text |
|
|
151
|
+
| `-f, --prompt-file <path>` | Read prompt from file |
|
|
152
|
+
| `-t, --template <name>` | Use a template from `.pg/templates/` |
|
|
153
|
+
| `--var <key=value>` | Template variable (repeatable) |
|
|
154
|
+
| `-b, --base <branch>` | Base branch for the worktree |
|
|
155
|
+
| `-w, --worktree <id>` | Add agent to existing worktree instead of creating new |
|
|
156
|
+
| `-c, --count <n>` | Number of agents to spawn (default: 1) |
|
|
157
|
+
| `--split` | Put all agents in one window as split panes |
|
|
158
|
+
| `--no-open` | Don't open a Terminal window |
|
|
159
|
+
| `--json` | JSON output |
|
|
160
|
+
|
|
161
|
+
### `ppg status`
|
|
162
|
+
|
|
163
|
+
Show status of all worktrees and agents.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
ppg status # Pretty table
|
|
167
|
+
ppg status --json # Machine-readable
|
|
168
|
+
ppg status --watch # Live updates
|
|
169
|
+
ppg status my-task # Filter by worktree name
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `ppg attach`
|
|
173
|
+
|
|
174
|
+
Open a terminal attached to a worktree or agent pane. If you're already in tmux, it switches to the target pane. Otherwise it opens a new Terminal.app window.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
ppg attach wt-abc123 # By worktree ID
|
|
178
|
+
ppg attach my-task # By worktree name
|
|
179
|
+
ppg attach ag-xxxxxxxx # By agent ID
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### `ppg logs`
|
|
183
|
+
|
|
184
|
+
View captured output from an agent's tmux pane.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
ppg logs ag-xxxxxxxx # Last 100 lines
|
|
188
|
+
ppg logs ag-xxxxxxxx --lines 500 # Last 500 lines
|
|
189
|
+
ppg logs ag-xxxxxxxx --follow # Tail (polls every 1s)
|
|
190
|
+
ppg logs ag-xxxxxxxx --full # Full pane history
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### `ppg kill`
|
|
194
|
+
|
|
195
|
+
Kill agents and optionally remove worktrees.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
ppg kill --agent ag-xxxxxxxx # Kill one agent
|
|
199
|
+
ppg kill --worktree wt-abc123 # Kill all agents in worktree
|
|
200
|
+
ppg kill --all # Kill everything
|
|
201
|
+
ppg kill --all --remove # Kill everything and remove worktrees
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### `ppg aggregate`
|
|
205
|
+
|
|
206
|
+
Collect result files from completed agents.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
ppg aggregate wt-abc123 # Results from one worktree
|
|
210
|
+
ppg aggregate --all # Results from all worktrees
|
|
211
|
+
ppg aggregate --all -o results.md # Write to file
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### `ppg merge`
|
|
215
|
+
|
|
216
|
+
Merge a worktree branch back into its base branch.
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
ppg merge wt-abc123 # Squash merge (default)
|
|
220
|
+
ppg merge wt-abc123 -s no-ff # No-ff merge
|
|
221
|
+
ppg merge wt-abc123 --dry-run # Preview
|
|
222
|
+
ppg merge wt-abc123 --no-cleanup # Keep worktree after merge
|
|
223
|
+
ppg merge wt-abc123 --force # Merge even if agents aren't done
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### `ppg diff`
|
|
227
|
+
|
|
228
|
+
Show changes made in a worktree branch relative to its base.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
ppg diff wt-abc123 # Full diff
|
|
232
|
+
ppg diff wt-abc123 --stat # Diffstat summary
|
|
233
|
+
ppg diff wt-abc123 --name-only # Changed file names only
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### `ppg restart`
|
|
237
|
+
|
|
238
|
+
Restart a failed or killed agent in the same worktree.
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
ppg restart ag-xxxxxxxx # Restart with original prompt
|
|
242
|
+
ppg restart ag-xxxxxxxx --prompt "Try again" # Override the prompt
|
|
243
|
+
ppg restart ag-xxxxxxxx --agent codex # Override the agent type
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### `ppg send`
|
|
247
|
+
|
|
248
|
+
Send text or keystrokes to an agent's tmux pane.
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
ppg send ag-xxxxxxxx "yes" # Send text + Enter
|
|
252
|
+
ppg send ag-xxxxxxxx "y" --no-enter # Send text without Enter
|
|
253
|
+
ppg send ag-xxxxxxxx "C-c" --keys # Send raw tmux key names
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### `ppg wait`
|
|
257
|
+
|
|
258
|
+
Wait for agents to reach a terminal state (completed, failed, killed, lost).
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
ppg wait wt-abc123 # Wait for all agents in worktree
|
|
262
|
+
ppg wait --all # Wait for all agents everywhere
|
|
263
|
+
ppg wait --all --timeout 300 # Timeout after 5 minutes
|
|
264
|
+
ppg wait --all --interval 10 # Poll every 10 seconds
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### `ppg clean`
|
|
268
|
+
|
|
269
|
+
Remove worktrees in terminal states (merged, cleaned, failed).
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
ppg clean # Clean merged/cleaned worktrees
|
|
273
|
+
ppg clean --all # Also clean failed worktrees
|
|
274
|
+
ppg clean --dry-run # Preview what would be cleaned
|
|
275
|
+
ppg clean --prune # Also run git worktree prune
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### `ppg worktree create`
|
|
279
|
+
|
|
280
|
+
Create a standalone worktree without spawning any agents.
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
ppg worktree create --name my-branch
|
|
284
|
+
ppg worktree create --name my-branch --base develop
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### `ppg list templates`
|
|
288
|
+
|
|
289
|
+
List available prompt templates from `.pg/templates/`.
|
|
290
|
+
|
|
291
|
+
### `ppg install-dashboard`
|
|
292
|
+
|
|
293
|
+
Download and install the native macOS dashboard app from GitHub Releases.
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
ppg install-dashboard # Install to /Applications
|
|
297
|
+
ppg install-dashboard --dir ~/Apps # Custom install directory
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### `ppg ui`
|
|
301
|
+
|
|
302
|
+
Open the native macOS dashboard app (alias: `ppg dashboard`).
|
|
303
|
+
|
|
304
|
+
## Configuration
|
|
305
|
+
|
|
306
|
+
`.pg/config.yaml`:
|
|
307
|
+
|
|
308
|
+
```yaml
|
|
309
|
+
sessionName: ppg
|
|
310
|
+
defaultAgent: claude
|
|
311
|
+
|
|
312
|
+
agents:
|
|
313
|
+
claude:
|
|
314
|
+
name: claude
|
|
315
|
+
command: claude --dangerously-skip-permissions
|
|
316
|
+
interactive: true
|
|
317
|
+
resultInstructions: >-
|
|
318
|
+
When you have completed the task, write a summary of what you did
|
|
319
|
+
and any important notes to the file at: {{RESULT_FILE}}
|
|
320
|
+
|
|
321
|
+
worktreeBase: .worktrees
|
|
322
|
+
templateDir: .pg/templates
|
|
323
|
+
resultDir: .pg/results
|
|
324
|
+
logDir: .pg/logs
|
|
325
|
+
envFiles:
|
|
326
|
+
- .env
|
|
327
|
+
- .env.local
|
|
328
|
+
symlinkNodeModules: true
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Custom Agents
|
|
332
|
+
|
|
333
|
+
Add any CLI agent by defining it in the agents map:
|
|
334
|
+
|
|
335
|
+
```yaml
|
|
336
|
+
agents:
|
|
337
|
+
claude:
|
|
338
|
+
name: claude
|
|
339
|
+
command: claude --dangerously-skip-permissions
|
|
340
|
+
interactive: true
|
|
341
|
+
|
|
342
|
+
codex:
|
|
343
|
+
name: codex
|
|
344
|
+
command: codex
|
|
345
|
+
promptFlag: --prompt
|
|
346
|
+
interactive: true
|
|
347
|
+
|
|
348
|
+
custom-script:
|
|
349
|
+
name: custom
|
|
350
|
+
command: ./scripts/my-agent.sh
|
|
351
|
+
promptFlag: --task
|
|
352
|
+
interactive: false
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Then spawn with `ppg spawn --agent codex --prompt "..."`.
|
|
356
|
+
|
|
357
|
+
## Templates
|
|
358
|
+
|
|
359
|
+
Templates live in `.pg/templates/` as Markdown files with `{{VAR}}` placeholders.
|
|
360
|
+
|
|
361
|
+
**Built-in variables:**
|
|
362
|
+
|
|
363
|
+
| Variable | Value |
|
|
364
|
+
|---|---|
|
|
365
|
+
| `{{WORKTREE_PATH}}` | Path to the agent's worktree |
|
|
366
|
+
| `{{BRANCH}}` | Git branch name |
|
|
367
|
+
| `{{AGENT_ID}}` | Agent identifier |
|
|
368
|
+
| `{{RESULT_FILE}}` | Where the agent should write results |
|
|
369
|
+
| `{{PROJECT_ROOT}}` | Repository root path |
|
|
370
|
+
| `{{TASK_NAME}}` | Worktree name |
|
|
371
|
+
| `{{PROMPT}}` | The prompt text |
|
|
372
|
+
|
|
373
|
+
Custom variables are passed with `--var KEY=VALUE`.
|
|
374
|
+
|
|
375
|
+
**Example template** (`.pg/templates/test-writer.md`):
|
|
376
|
+
|
|
377
|
+
```markdown
|
|
378
|
+
# Task: {{TASK_NAME}}
|
|
379
|
+
|
|
380
|
+
Write comprehensive tests for the {{SCOPE}} module.
|
|
381
|
+
|
|
382
|
+
## Working Directory
|
|
383
|
+
{{WORKTREE_PATH}}
|
|
384
|
+
|
|
385
|
+
## Guidelines
|
|
386
|
+
- Use {{FRAMEWORK}} for test framework
|
|
387
|
+
- Aim for >90% coverage
|
|
388
|
+
- Write your summary to {{RESULT_FILE}} when done
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
ppg spawn --name auth-tests --template test-writer --var SCOPE=auth --var FRAMEWORK=vitest
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## Agent Lifecycle
|
|
396
|
+
|
|
397
|
+
```
|
|
398
|
+
spawning → running → completed (result file written)
|
|
399
|
+
→ failed (non-zero exit or shell prompt visible)
|
|
400
|
+
→ killed (via ppg kill)
|
|
401
|
+
→ lost (tmux pane died unexpectedly)
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Status is determined by checking (in order):
|
|
405
|
+
1. Result file exists → `completed`
|
|
406
|
+
2. Tmux pane gone → `lost`
|
|
407
|
+
3. Pane dead with exit 0 → `completed`
|
|
408
|
+
4. Pane dead with non-zero exit → `failed`
|
|
409
|
+
5. Pane alive, shell prompt visible → `failed` (agent exited without writing results)
|
|
410
|
+
6. Otherwise → `running`
|
|
411
|
+
|
|
412
|
+
## Conductor Mode
|
|
413
|
+
|
|
414
|
+
ppg is designed to be driven programmatically by a meta-agent (a "conductor"). All orchestration commands (`spawn`, `status`, `kill`, `wait`, `aggregate`, `merge`) support `--json` for machine-readable output.
|
|
415
|
+
|
|
416
|
+
**Conductor workflow:**
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# 1. Plan — break the task into independent units
|
|
420
|
+
# 2. Spawn agents
|
|
421
|
+
ppg spawn --name task-1 --prompt "Do X" --json
|
|
422
|
+
ppg spawn --name task-2 --prompt "Do Y" --json
|
|
423
|
+
|
|
424
|
+
# 3. Poll for completion
|
|
425
|
+
ppg status --json # check for status: "completed" or "failed"
|
|
426
|
+
|
|
427
|
+
# 4. Wait for all agents
|
|
428
|
+
ppg wait --all --json
|
|
429
|
+
|
|
430
|
+
# 5. Aggregate results
|
|
431
|
+
ppg aggregate --all --json
|
|
432
|
+
|
|
433
|
+
# 6. Merge completed work
|
|
434
|
+
ppg merge wt-xxxxxx --json
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Key principles:
|
|
438
|
+
- Always use `--json` for machine-readable output
|
|
439
|
+
- Poll status every 5 seconds or use `ppg wait`
|
|
440
|
+
- One concern per worktree for clean merges
|
|
441
|
+
- Use `ppg aggregate` to collect and review results before merging
|
|
442
|
+
|
|
443
|
+
## Architecture
|
|
444
|
+
|
|
445
|
+
```
|
|
446
|
+
src/
|
|
447
|
+
├── cli.ts # Entry point — registers commands with Commander.js
|
|
448
|
+
├── commands/ # Command implementations
|
|
449
|
+
├── core/ # Domain logic (manifest, agent, worktree, tmux, terminal, config)
|
|
450
|
+
├── lib/ # Utilities (paths, errors, id, output, shell)
|
|
451
|
+
└── types/ # Type definitions
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
Built with TypeScript (strict, ES2022, ESM-only), Commander.js for CLI framework, and tmux + git worktrees as foundational abstractions. See [CONTRIBUTING.md](CONTRIBUTING.md) for development details.
|
|
455
|
+
|
|
456
|
+
## Contributing
|
|
457
|
+
|
|
458
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing, and code conventions.
|
|
459
|
+
|
|
460
|
+
## License
|
|
461
|
+
|
|
462
|
+
[MIT](LICENSE)
|