@sienklogic/plan-build-run 2.54.0 → 2.55.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 (127) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/plugins/codex-pbr/agents/audit.md +223 -0
  4. package/plugins/codex-pbr/agents/codebase-mapper.md +196 -0
  5. package/plugins/codex-pbr/agents/debugger.md +245 -0
  6. package/plugins/codex-pbr/agents/dev-sync.md +142 -0
  7. package/plugins/codex-pbr/agents/executor.md +429 -0
  8. package/plugins/codex-pbr/agents/general.md +131 -0
  9. package/plugins/codex-pbr/agents/integration-checker.md +178 -0
  10. package/plugins/codex-pbr/agents/plan-checker.md +253 -0
  11. package/plugins/codex-pbr/agents/planner.md +343 -0
  12. package/plugins/codex-pbr/agents/researcher.md +253 -0
  13. package/plugins/codex-pbr/agents/synthesizer.md +183 -0
  14. package/plugins/codex-pbr/agents/verifier.md +352 -0
  15. package/plugins/codex-pbr/commands/audit.md +5 -0
  16. package/plugins/codex-pbr/commands/begin.md +5 -0
  17. package/plugins/codex-pbr/commands/build.md +5 -0
  18. package/plugins/codex-pbr/commands/config.md +5 -0
  19. package/plugins/codex-pbr/commands/continue.md +5 -0
  20. package/plugins/codex-pbr/commands/dashboard.md +5 -0
  21. package/plugins/codex-pbr/commands/debug.md +5 -0
  22. package/plugins/codex-pbr/commands/discuss.md +5 -0
  23. package/plugins/codex-pbr/commands/do.md +5 -0
  24. package/plugins/codex-pbr/commands/explore.md +5 -0
  25. package/plugins/codex-pbr/commands/health.md +5 -0
  26. package/plugins/codex-pbr/commands/help.md +5 -0
  27. package/plugins/codex-pbr/commands/import.md +5 -0
  28. package/plugins/codex-pbr/commands/milestone.md +5 -0
  29. package/plugins/codex-pbr/commands/note.md +5 -0
  30. package/plugins/codex-pbr/commands/pause.md +5 -0
  31. package/plugins/codex-pbr/commands/plan.md +5 -0
  32. package/plugins/codex-pbr/commands/quick.md +5 -0
  33. package/plugins/codex-pbr/commands/resume.md +5 -0
  34. package/plugins/codex-pbr/commands/review.md +5 -0
  35. package/plugins/codex-pbr/commands/scan.md +5 -0
  36. package/plugins/codex-pbr/commands/setup.md +5 -0
  37. package/plugins/codex-pbr/commands/status.md +5 -0
  38. package/plugins/codex-pbr/commands/statusline.md +5 -0
  39. package/plugins/codex-pbr/commands/test.md +5 -0
  40. package/plugins/codex-pbr/commands/todo.md +5 -0
  41. package/plugins/codex-pbr/commands/undo.md +5 -0
  42. package/plugins/codex-pbr/references/agent-contracts.md +324 -0
  43. package/plugins/codex-pbr/references/agent-teams.md +54 -0
  44. package/plugins/codex-pbr/references/common-bug-patterns.md +13 -0
  45. package/plugins/codex-pbr/references/config-reference.md +552 -0
  46. package/plugins/codex-pbr/references/continuation-format.md +212 -0
  47. package/plugins/codex-pbr/references/deviation-rules.md +112 -0
  48. package/plugins/codex-pbr/references/git-integration.md +256 -0
  49. package/plugins/codex-pbr/references/integration-patterns.md +117 -0
  50. package/plugins/codex-pbr/references/model-profiles.md +99 -0
  51. package/plugins/codex-pbr/references/model-selection.md +31 -0
  52. package/plugins/codex-pbr/references/pbr-tools-cli.md +400 -0
  53. package/plugins/codex-pbr/references/plan-authoring.md +246 -0
  54. package/plugins/codex-pbr/references/plan-format.md +313 -0
  55. package/plugins/codex-pbr/references/questioning.md +235 -0
  56. package/plugins/codex-pbr/references/reading-verification.md +127 -0
  57. package/plugins/codex-pbr/references/signal-files.md +41 -0
  58. package/plugins/codex-pbr/references/stub-patterns.md +160 -0
  59. package/plugins/codex-pbr/references/ui-formatting.md +444 -0
  60. package/plugins/codex-pbr/references/wave-execution.md +95 -0
  61. package/plugins/codex-pbr/skills/audit/SKILL.md +346 -0
  62. package/plugins/codex-pbr/skills/begin/SKILL.md +800 -0
  63. package/plugins/codex-pbr/skills/build/SKILL.md +958 -0
  64. package/plugins/codex-pbr/skills/config/SKILL.md +267 -0
  65. package/plugins/codex-pbr/skills/continue/SKILL.md +172 -0
  66. package/plugins/codex-pbr/skills/dashboard/SKILL.md +44 -0
  67. package/plugins/codex-pbr/skills/debug/SKILL.md +530 -0
  68. package/plugins/codex-pbr/skills/discuss/SKILL.md +355 -0
  69. package/plugins/codex-pbr/skills/do/SKILL.md +68 -0
  70. package/plugins/codex-pbr/skills/explore/SKILL.md +407 -0
  71. package/plugins/codex-pbr/skills/health/SKILL.md +300 -0
  72. package/plugins/codex-pbr/skills/help/SKILL.md +229 -0
  73. package/plugins/codex-pbr/skills/import/SKILL.md +538 -0
  74. package/plugins/codex-pbr/skills/milestone/SKILL.md +620 -0
  75. package/plugins/codex-pbr/skills/note/SKILL.md +215 -0
  76. package/plugins/codex-pbr/skills/pause/SKILL.md +258 -0
  77. package/plugins/codex-pbr/skills/plan/SKILL.md +650 -0
  78. package/plugins/codex-pbr/skills/quick/SKILL.md +417 -0
  79. package/plugins/codex-pbr/skills/resume/SKILL.md +403 -0
  80. package/plugins/codex-pbr/skills/review/SKILL.md +669 -0
  81. package/plugins/codex-pbr/skills/scan/SKILL.md +325 -0
  82. package/plugins/codex-pbr/skills/setup/SKILL.md +169 -0
  83. package/plugins/codex-pbr/skills/shared/commit-planning-docs.md +35 -0
  84. package/plugins/codex-pbr/skills/shared/config-loading.md +102 -0
  85. package/plugins/codex-pbr/skills/shared/context-budget.md +77 -0
  86. package/plugins/codex-pbr/skills/shared/context-loader-task.md +86 -0
  87. package/plugins/codex-pbr/skills/shared/digest-select.md +79 -0
  88. package/plugins/codex-pbr/skills/shared/domain-probes.md +125 -0
  89. package/plugins/codex-pbr/skills/shared/error-reporting.md +59 -0
  90. package/plugins/codex-pbr/skills/shared/gate-prompts.md +388 -0
  91. package/plugins/codex-pbr/skills/shared/phase-argument-parsing.md +45 -0
  92. package/plugins/codex-pbr/skills/shared/revision-loop.md +81 -0
  93. package/plugins/codex-pbr/skills/shared/state-update.md +169 -0
  94. package/plugins/codex-pbr/skills/shared/universal-anti-patterns.md +43 -0
  95. package/plugins/codex-pbr/skills/status/SKILL.md +449 -0
  96. package/plugins/codex-pbr/skills/statusline/SKILL.md +149 -0
  97. package/plugins/codex-pbr/skills/test/SKILL.md +210 -0
  98. package/plugins/codex-pbr/skills/todo/SKILL.md +281 -0
  99. package/plugins/codex-pbr/skills/undo/SKILL.md +172 -0
  100. package/plugins/codex-pbr/templates/CONTEXT.md.tmpl +52 -0
  101. package/plugins/codex-pbr/templates/INTEGRATION-REPORT.md.tmpl +167 -0
  102. package/plugins/codex-pbr/templates/RESEARCH-SUMMARY.md.tmpl +97 -0
  103. package/plugins/codex-pbr/templates/ROADMAP.md.tmpl +47 -0
  104. package/plugins/codex-pbr/templates/SUMMARY-complex.md.tmpl +95 -0
  105. package/plugins/codex-pbr/templates/SUMMARY-minimal.md.tmpl +48 -0
  106. package/plugins/codex-pbr/templates/SUMMARY.md.tmpl +81 -0
  107. package/plugins/codex-pbr/templates/VERIFICATION-DETAIL.md.tmpl +117 -0
  108. package/plugins/codex-pbr/templates/codebase/ARCHITECTURE.md.tmpl +98 -0
  109. package/plugins/codex-pbr/templates/codebase/CONCERNS.md.tmpl +93 -0
  110. package/plugins/codex-pbr/templates/codebase/CONVENTIONS.md.tmpl +104 -0
  111. package/plugins/codex-pbr/templates/codebase/INTEGRATIONS.md.tmpl +78 -0
  112. package/plugins/codex-pbr/templates/codebase/STACK.md.tmpl +78 -0
  113. package/plugins/codex-pbr/templates/codebase/STRUCTURE.md.tmpl +80 -0
  114. package/plugins/codex-pbr/templates/codebase/TESTING.md.tmpl +107 -0
  115. package/plugins/codex-pbr/templates/continue-here.md.tmpl +73 -0
  116. package/plugins/codex-pbr/templates/pr-body.md.tmpl +22 -0
  117. package/plugins/codex-pbr/templates/prompt-partials/phase-project-context.md.tmpl +37 -0
  118. package/plugins/codex-pbr/templates/research/ARCHITECTURE.md.tmpl +124 -0
  119. package/plugins/codex-pbr/templates/research/STACK.md.tmpl +71 -0
  120. package/plugins/codex-pbr/templates/research/SUMMARY.md.tmpl +112 -0
  121. package/plugins/codex-pbr/templates/research-outputs/phase-research.md.tmpl +81 -0
  122. package/plugins/codex-pbr/templates/research-outputs/project-research.md.tmpl +99 -0
  123. package/plugins/codex-pbr/templates/research-outputs/synthesis.md.tmpl +36 -0
  124. package/plugins/copilot-pbr/plugin.json +1 -1
  125. package/plugins/cursor-pbr/.cursor-plugin/plugin.json +1 -1
  126. package/plugins/jules-pbr/AGENTS.md +600 -0
  127. package/plugins/pbr/.claude-plugin/plugin.json +1 -1
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: test
3
+ description: "Generate tests for completed phase code. Detects test framework and targets key files."
4
+ ---
5
+
6
+ **STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
7
+
8
+ # $pbr-test — Post-Phase Test Generation
9
+
10
+ You are the orchestrator for `$pbr-test`. This skill generates tests for code that was built WITHOUT TDD mode. It targets key files from completed phases and creates meaningful test coverage.
11
+
12
+ ## Context Budget
13
+
14
+ Reference: `skills/shared/context-budget.md` for the universal orchestrator rules.
15
+
16
+ Additionally for this skill:
17
+ - **Delegate** all test writing to executor agents — never write test code in the main context
18
+ - Read only SUMMARY.md frontmatter for `key_files` lists — do not read full summaries
19
+
20
+ ## Step 0 — Immediate Output
21
+
22
+ **Before ANY tool calls**, display this banner:
23
+
24
+ ```
25
+ ╔══════════════════════════════════════════════════════════════╗
26
+ ║ PLAN-BUILD-RUN ► GENERATING TESTS FOR PHASE {N} ║
27
+ ╚══════════════════════════════════════════════════════════════╝
28
+ ```
29
+
30
+ Where `{N}` is the phase number from `$ARGUMENTS`. Then proceed to Step 1.
31
+
32
+ ## Prerequisites
33
+
34
+ - `.planning/config.json` exists
35
+ - Phase has been built: SUMMARY.md files exist in `.planning/phases/{NN}-{slug}/`
36
+ - Phase should NOT already have TDD coverage (check if `features.tdd_mode` is false in config — if TDD mode is enabled, warn user that tests should already exist and ask to proceed anyway)
37
+
38
+ ---
39
+
40
+ ## Argument Parsing
41
+
42
+ Parse `$ARGUMENTS` according to `skills/shared/phase-argument-parsing.md`.
43
+
44
+ | Argument | Meaning |
45
+ |----------|---------|
46
+ | `3` | Generate tests for phase 3 |
47
+ | (no number) | Use current phase from STATE.md |
48
+
49
+ ---
50
+
51
+ ## Step 1 — Gather Context
52
+
53
+ **CRITICAL: Run init command to load project state efficiently.**
54
+
55
+ ```bash
56
+ node "${PLUGIN_ROOT}/scripts/pbr-tools.js" init execute-phase {phase_number}
57
+ ```
58
+
59
+ This returns STATE.md snapshot, phase plans, ROADMAP excerpt, and config — all in one call.
60
+
61
+ ## Step 2 — Detect Test Framework
62
+
63
+ Scan the project root for test framework indicators:
64
+
65
+ 1. Check `package.json` for `jest`, `vitest`, `mocha`, `ava` in devDependencies
66
+ 2. Check for `pytest.ini`, `pyproject.toml` (with `[tool.pytest]`), `setup.cfg` (with `[tool:pytest]`)
67
+ 3. Check for `jest.config.*`, `vitest.config.*`, `.mocharc.*`
68
+ 4. Check for existing test directories: `tests/`, `test/`, `__tests__/`, `spec/`
69
+ 5. Check for existing test file patterns: `*.test.*`, `*.spec.*`, `test_*.py`
70
+
71
+ If no test framework is detected, ask the user:
72
+
73
+ Use AskUserQuestion:
74
+ question: "No test framework detected. Which should I use?"
75
+ header: "Framework"
76
+ options:
77
+ - label: "Jest" description: "JavaScript/TypeScript testing (most common)"
78
+ - label: "Vitest" description: "Vite-native testing (faster, ESM-friendly)"
79
+ - label: "pytest" description: "Python testing framework"
80
+ multiSelect: false
81
+
82
+ ## Step 3 — Collect Target Files
83
+
84
+ Read SUMMARY.md frontmatter from each plan in the phase to extract `key_files`:
85
+
86
+ ```bash
87
+ node "${PLUGIN_ROOT}/scripts/pbr-tools.js" frontmatter .planning/phases/{NN}-{slug}/SUMMARY.md
88
+ ```
89
+
90
+ Collect all `key_files` across all plans in the phase. Filter to only source files (exclude config, docs, assets). Group by:
91
+ - **High priority**: Files with business logic, API endpoints, data models
92
+ - **Medium priority**: Utility functions, helpers, middleware
93
+ - **Low priority**: Config, types-only files, constants
94
+
95
+ Present the file list to the user:
96
+
97
+ Use AskUserQuestion:
98
+ question: "Found {N} source files from phase {P}. Generate tests for which?"
99
+ header: "Scope"
100
+ options:
101
+ - label: "High priority only" description: "{X} files — business logic, APIs, models"
102
+ - label: "High + Medium" description: "{Y} files — adds utilities and helpers"
103
+ - label: "All files" description: "{Z} files — comprehensive coverage"
104
+ multiSelect: false
105
+
106
+ ## Step 4 — Generate Test Plans
107
+
108
+ For each target file, create a lightweight test plan (NOT a full PBR PLAN.md — just a task list):
109
+
110
+ ```
111
+ File: src/auth/login.js
112
+ Tests to generate:
113
+ - Happy path: valid credentials return token
114
+ - Error: invalid password returns 401
115
+ - Error: missing email returns 400
116
+ - Edge: expired session handling
117
+ Framework: jest
118
+ Output: tests/auth/login.test.js
119
+ ```
120
+
121
+ ## Step 5 — Spawn Executor Agents
122
+
123
+ **CRITICAL: Delegate ALL test writing to agents. Do NOT write test code in the main context.**
124
+
125
+ For each target file (or batch of related files), spawn an executor agent:
126
+
127
+ ```
128
+ Spawn subagent_type: "pbr:executor"
129
+
130
+ Task: Generate tests for the following file(s):
131
+
132
+ <files_to_test>
133
+ {file_path}: {brief description from SUMMARY}
134
+ </files_to_test>
135
+
136
+ <test_framework>
137
+ {detected framework name and version}
138
+ Existing test directory: {path}
139
+ Test file naming: {pattern, e.g., *.test.js}
140
+ </test_framework>
141
+
142
+ <test_plan>
143
+ {test plan from Step 4}
144
+ </test_plan>
145
+
146
+ Instructions:
147
+ 1. Read each source file to understand the implementation
148
+ 2. Write test files following the project's existing test patterns
149
+ 3. Each test file should cover: happy path, error cases, edge cases
150
+ 4. Use the project's existing mocking patterns if any exist
151
+ 5. Run the tests to verify they pass: {test command}
152
+ 6. Commit with format: test({phase}-tests): add tests for {file}
153
+ ```
154
+
155
+ Spawn up to `parallelization.max_concurrent_agents` agents in parallel for independent files.
156
+
157
+ ## Step 6 — Verify and Report
158
+
159
+ After all agents complete, check results:
160
+
161
+ 1. Glob for new test files created in this session
162
+ 2. Run the test suite to verify all new tests pass:
163
+ ```bash
164
+ {test_command}
165
+ ```
166
+ 3. Count: files tested, tests written, tests passing
167
+
168
+ Display completion:
169
+
170
+ ```
171
+ ╔══════════════════════════════════════════════════════════════╗
172
+ ║ PLAN-BUILD-RUN ► TESTS GENERATED ✓ ║
173
+ ╚══════════════════════════════════════════════════════════════╝
174
+
175
+ Phase {N}: {X} test files created, {Y} tests passing
176
+
177
+ Files tested:
178
+ - src/auth/login.js → tests/auth/login.test.js (8 tests)
179
+ - src/api/users.js → tests/api/users.test.js (12 tests)
180
+
181
+
182
+
183
+ ╔══════════════════════════════════════════════════════════════╗
184
+ ║ ▶ NEXT UP ║
185
+ ╚══════════════════════════════════════════════════════════════╝
186
+
187
+ **Run coverage check** to see how much is covered
188
+
189
+ `npm test -- --coverage`
190
+
191
+ <sub>`/clear` first → fresh context window</sub>
192
+
193
+
194
+
195
+ **Also available:**
196
+ - `$pbr-review {N}` — verify the full phase
197
+ - `$pbr-continue` — execute next logical step
198
+
199
+
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Anti-Patterns
205
+
206
+ 1. **DO NOT** write test code in the main orchestrator context — always delegate to executor agents
207
+ 2. **DO NOT** generate tests for files not listed in SUMMARY.md key_files — stay scoped to the phase
208
+ 3. **DO NOT** skip running the tests — always verify they pass before reporting success
209
+ 4. **DO NOT** generate trivial tests (testing getters/setters, testing constants) — focus on behavior
210
+ 5. **DO NOT** read full source files in the orchestrator — let the executor agents read them
@@ -0,0 +1,281 @@
1
+ ---
2
+ name: todo
3
+ description: "File-based persistent todos. Add, list, complete — survives sessions."
4
+ ---
5
+
6
+ **STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.**
7
+
8
+ ## Step 0 — Immediate Output
9
+
10
+ **Before ANY tool calls**, display this banner:
11
+
12
+ ```
13
+ ╔══════════════════════════════════════════════════════════════╗
14
+ ║ PLAN-BUILD-RUN ► TODO ║
15
+ ╚══════════════════════════════════════════════════════════════╝
16
+ ```
17
+
18
+ Then proceed to Step 1.
19
+
20
+ # $pbr-todo — Persistent File-Based Todos
21
+
22
+ ## Why File-Based
23
+
24
+ Native Claude Code Tasks are session-scoped — they vanish when the conversation ends. Plan-Build-Run todos are individual `.md` files in `.planning/todos/` that persist across sessions, context resets, and compactions.
25
+
26
+ ## Subcommands
27
+
28
+ Parse `$ARGUMENTS` to determine the subcommand:
29
+
30
+ ### `add <description>`
31
+
32
+ 1. Ensure `.planning/todos/pending/` directory exists
33
+ 2. Generate NNN: scan **both** `.planning/todos/pending/` and `.planning/todos/done/` for the highest existing number, then increment by 1 (zero-padded to 3 digits)
34
+ 3. Generate slug: take the first ~4 meaningful words from the description, lowercase, hyphen-separated (e.g., "Add rate limiting to login" → `add-rate-limiting-login`)
35
+ 4. Infer theme from description (e.g., "auth" → security, "test" → testing, "UI" → frontend, "refactor" → quality)
36
+ 5. Check for duplicates — read existing pending todos, if a similar one exists, ask user via AskUserQuestion
37
+ 6. Create `.planning/todos/pending/{NNN}-{slug}.md`:
38
+
39
+ ```yaml
40
+ ---
41
+ title: "{description}"
42
+ status: pending
43
+ priority: P2
44
+ source: conversation
45
+ created: {YYYY-MM-DD}
46
+ theme: {inferred-theme}
47
+ ---
48
+
49
+ ## Goal
50
+
51
+ {description expanded into a clear goal statement}
52
+
53
+ ## Scope
54
+
55
+ {any relevant context from the current conversation, or bullet points of what's in/out of scope}
56
+
57
+ ## Acceptance Criteria
58
+
59
+ - [ ] {primary acceptance criterion derived from description}
60
+ ```
61
+
62
+ 7. Update STATE.md Pending Todos section
63
+
64
+ If the Write fails, display:
65
+ ```
66
+ ╔══════════════════════════════════════════════════════════════╗
67
+ ║ ERROR ║
68
+ ╚══════════════════════════════════════════════════════════════╝
69
+
70
+ Failed to write todo file.
71
+
72
+ **To fix:** Check that `.planning/todos/pending/` exists and is writable.
73
+ ```
74
+
75
+ 8. Confirm with branded output:
76
+ ```
77
+ ╔══════════════════════════════════════════════════════════════╗
78
+ ║ PLAN-BUILD-RUN ► TODO ADDED ✓ ║
79
+ ╚══════════════════════════════════════════════════════════════╝
80
+
81
+ **Todo {NNN}:** {description}
82
+
83
+
84
+
85
+ ╔══════════════════════════════════════════════════════════════╗
86
+ ║ ▶ NEXT UP ║
87
+ ╚══════════════════════════════════════════════════════════════╝
88
+
89
+ **Work on it now** or see your task list
90
+
91
+ `$pbr-quick`
92
+
93
+ <sub>`/clear` first → fresh context window</sub>
94
+
95
+
96
+
97
+ **Also available:**
98
+ - `$pbr-todo list` — see all pending todos
99
+ - `$pbr-status` — see project status
100
+
101
+
102
+ ```
103
+
104
+ ### `list [theme]`
105
+
106
+ 1. Read all files in `.planning/todos/pending/`
107
+ 2. Parse frontmatter from each
108
+ 3. If theme filter provided, filter by theme
109
+ 4. Display as table:
110
+
111
+ ```
112
+ Pending Todos:
113
+ | # | Title | Priority | Theme | Created |
114
+ |---|-------|----------|-------|---------|
115
+ | 074 | Status-line customization options | P2 | capability | 2026-02-10 |
116
+ | 075 | Add WebSearch/WebFetch/Context7 to researcher | P2 | capability | 2026-02-10 |
117
+ ```
118
+
119
+ 5. Offer actions with branded routing:
120
+ ```
121
+
122
+
123
+ ╔══════════════════════════════════════════════════════════════╗
124
+ ║ ▶ NEXT UP ║
125
+ ╚══════════════════════════════════════════════════════════════╝
126
+
127
+ **Pick a todo** — mark one done or start working
128
+
129
+ `$pbr-todo work <NNN>` — start working on a todo
130
+ `$pbr-todo done <NNN>` — mark a todo as complete
131
+
132
+
133
+
134
+ **Also available:**
135
+ - `$pbr-status` — see project status
136
+
137
+
138
+ ```
139
+
140
+ ### `done <NNN>`
141
+
142
+ 1. Find `.planning/todos/pending/{NNN}-*.md` (match by number prefix)
143
+ 2. If not found, display:
144
+ ```
145
+ ╔══════════════════════════════════════════════════════════════╗
146
+ ║ ERROR ║
147
+ ╚══════════════════════════════════════════════════════════════╝
148
+
149
+ Todo {NNN} not found in pending todos.
150
+
151
+ **To fix:** Run `$pbr-todo list` to see available numbers.
152
+ ```
153
+ 3. Ensure `.planning/todos/done/` directory exists (create if needed)
154
+ 4. Read the pending file content
155
+ 5. Update frontmatter in the content: set `status: done` and add `completed: {YYYY-MM-DD}`
156
+
157
+ **CRITICAL: Write to done/ FIRST, verify it exists, THEN delete from pending/. Do NOT delete pending before confirming done/ write succeeded.**
158
+
159
+ 6. Write the updated content to `.planning/todos/done/{NNN}-{slug}.md`
160
+ 7. Verify the done/ file was written successfully: check that `.planning/todos/done/{NNN}-{slug}.md` exists and has content (use `ls` or Glob)
161
+ - If the done/ write failed, abort and display:
162
+ ```
163
+ ╔══════════════════════════════════════════════════════════════╗
164
+ ║ ERROR ║
165
+ ╚══════════════════════════════════════════════════════════════╝
166
+
167
+ Failed to write to done/. Pending file preserved.
168
+
169
+ **To fix:** Check that `.planning/todos/done/` exists and is writable.
170
+ ```
171
+ Do NOT proceed to delete the pending file.
172
+ 8. Only THEN delete the original file from `.planning/todos/pending/` (use `rm` via Bash)
173
+ 8. Update STATE.md
174
+ 9. Confirm with branded output:
175
+ ```
176
+ ╔══════════════════════════════════════════════════════════════╗
177
+ ║ PLAN-BUILD-RUN ► TODO COMPLETED ✓ ║
178
+ ╚══════════════════════════════════════════════════════════════╝
179
+
180
+ **Todo {NNN}:** {title}
181
+
182
+
183
+
184
+ ╔══════════════════════════════════════════════════════════════╗
185
+ ║ ▶ NEXT UP ║
186
+ ╚══════════════════════════════════════════════════════════════╝
187
+
188
+ **See remaining tasks**
189
+
190
+ `$pbr-todo list`
191
+
192
+ <sub>`/clear` first → fresh context window</sub>
193
+
194
+
195
+
196
+ **Also available:**
197
+ - `$pbr-continue` — execute next logical step
198
+ - `$pbr-status` — see project status
199
+
200
+
201
+ ```
202
+
203
+ ### `work <NNN>`
204
+
205
+ 1. Find `.planning/todos/pending/{NNN}-*.md` (match by number prefix)
206
+ 2. If not found, display the same error block as `done` — suggest `$pbr-todo list`
207
+ 3. Read the todo file content (frontmatter + body)
208
+ 4. Extract the `title` from frontmatter and the full body (Goal, Scope, Acceptance Criteria sections)
209
+
210
+ 5. **Assess complexity** to choose the right skill. Evaluate the todo content against these criteria:
211
+
212
+ | Signal | Route to |
213
+ |--------|----------|
214
+ | Single file change, small fix, simple addition | `$pbr-quick` |
215
+ | Multiple acceptance criteria, multi-file scope, architectural decisions, needs research | `$pbr-plan` (requires an active phase) |
216
+ | Investigation needed, unclear root cause | `$pbr-debug` |
217
+ | Open-ended exploration, no clear deliverable | `$pbr-explore` |
218
+
219
+ If unsure, ask the user via AskUserQuestion:
220
+ ```
221
+ Todo {NNN} could be handled as a quick task or may need full planning.
222
+
223
+ Which approach?
224
+ - Quick task ($pbr-quick) — single executor, atomic commit
225
+ - Full planning ($pbr-plan) — research, plan, build cycle
226
+ - Debug ($pbr-debug) — systematic investigation
227
+ - Explore ($pbr-explore) — open-ended investigation
228
+ ```
229
+
230
+ 6. Display branded output:
231
+ ```
232
+ ╔══════════════════════════════════════════════════════════════╗
233
+ ║ PLAN-BUILD-RUN ► WORKING ON TODO {NNN} ║
234
+ ╚══════════════════════════════════════════════════════════════╝
235
+
236
+ **Todo {NNN}:** {title}
237
+ **Routing to:** $pbr-{chosen-skill}
238
+ ```
239
+
240
+ 7. Invoke the chosen skill via the Skill tool, passing the todo title and body as args:
241
+
242
+ ```
243
+ {title}
244
+
245
+ Context from todo {NNN}:
246
+ {body content — Goal, Scope, Acceptance Criteria sections}
247
+ ```
248
+
249
+ For `$pbr-plan`, if no phase exists for this work yet, suggest the user run `$pbr-plan add` first to create one, then re-run `$pbr-todo work {NNN}`.
250
+
251
+ 8. When the skill completes, remind the user:
252
+
253
+ ```
254
+
255
+
256
+ ╔══════════════════════════════════════════════════════════════╗
257
+ ║ ▶ NEXT UP ║
258
+ ╚══════════════════════════════════════════════════════════════╝
259
+
260
+ **Mark this todo as done if the work is complete**
261
+
262
+ `$pbr-todo done {NNN}`
263
+
264
+
265
+ ```
266
+
267
+ ### No arguments
268
+
269
+ Show a brief summary: count of pending todos, grouped by theme, plus usage hint.
270
+
271
+ ## State Integration
272
+
273
+ After any todo operation, update the "Pending Todos" section of STATE.md with the current count and list.
274
+
275
+ ## Git Integration
276
+
277
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
278
+
279
+ If `planning.commit_docs: true` in config, commit todo changes:
280
+ - `docs(planning): add todo {NNN}`
281
+ - `docs(planning): complete todo {NNN}`
@@ -0,0 +1,172 @@
1
+ ---
2
+ name: undo
3
+ description: "Revert recent PBR-generated commits by phase/plan, safely using git revert."
4
+ ---
5
+
6
+ **STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Begin executing Step 0 immediately.**
7
+
8
+ ## Step 0 — Immediate Output
9
+
10
+ **Before ANY tool calls**, display this banner:
11
+
12
+ ```
13
+ ╔══════════════════════════════════════════════════════════════╗
14
+ ║ PLAN-BUILD-RUN ► UNDO ║
15
+ ╚══════════════════════════════════════════════════════════════╝
16
+ ```
17
+
18
+ Then proceed to Step 1.
19
+
20
+ # $pbr-undo — Safe Commit Reversal
21
+
22
+ You are running the **undo** skill. Your job is to help the user safely revert recent PBR-generated commits using `git revert` (history-preserving), not `git reset` (destructive).
23
+
24
+ This skill runs **inline** (no Task delegation).
25
+
26
+ ---
27
+
28
+ ## Step 1 — Gather PBR Commits
29
+
30
+ Run:
31
+
32
+ ```bash
33
+ git log --oneline --no-merges -50
34
+ ```
35
+
36
+ Filter lines matching the PBR commit pattern:
37
+ `^[0-9a-f]+ (feat|fix|refactor|test|docs|chore|wip|revert)(\([a-zA-Z0-9._-]+\))?:`
38
+
39
+ If no PBR commits found, display:
40
+
41
+ ```
42
+ No PBR commits found in the last 50 commits.
43
+ ```
44
+
45
+ Then exit.
46
+
47
+ **Parse $ARGUMENTS for flags**:
48
+ - `--last N`: limit to N most recent PBR commits (default 20)
49
+ - `--phase NN`: filter to commits for a specific phase number (e.g. `--phase 55`)
50
+ - `--plan NN-MM`: filter to commits for a specific plan (e.g. `--plan 55-02`)
51
+ - `--range HASH..HASH`: preselect a hash range for revert — if provided, skip to Step 5 with that range pre-filled
52
+
53
+ Apply filters to the collected PBR commits before proceeding.
54
+
55
+ ---
56
+
57
+ ## Step 2 — Group Commits by Scope
58
+
59
+ Parse the scope from each commit message (e.g., `55-02`, `quick-003`, `planning`). If no scope is present, use `(no scope)`.
60
+
61
+ Present grouped output:
62
+
63
+ ```
64
+ Recent PBR commits (grouped by scope):
65
+
66
+ [55-02] Phase 55, Plan 02
67
+ abc1234 feat(55-02): add undo skill
68
+ def5678 chore(55-02): register undo command
69
+
70
+ [quick-003]
71
+ ghi9012 fix(quick-003): fix hook path resolution
72
+
73
+ [planning]
74
+ jkl3456 docs(planning): update roadmap phase 55
75
+ ```
76
+
77
+ For phase-plan scopes (NN-MM pattern), add a "Phase NN, Plan MM" annotation. For other scopes, show just the scope label.
78
+
79
+ ---
80
+
81
+ ## Step 3 — Prompt for Selection
82
+
83
+ Use AskUserQuestion with the **select-action** pattern:
84
+
85
+ - **question**: "Which commit(s) do you want to undo? Select a scope to revert all commits in that scope, or choose a custom option."
86
+ - **header**: "Select commits to undo"
87
+ - **options**: (dynamic — top 8 scope labels from grouped list, each formatted as `[{scope}] {N} commit(s)`, plus "Enter custom hash or range" and "Cancel")
88
+ - **multiSelect**: false
89
+
90
+ If user selects a scope label: collect all commits with that scope as the revert set.
91
+ If user selects "Enter custom hash or range": use AskUserQuestion (freeform) to ask:
92
+ - "Enter a commit hash or range (e.g. abc1234 or abc..def):"
93
+ - Parse the response as a hash or HASH1..HASH2 range
94
+ If user selects "Cancel": print "Undo cancelled." and exit.
95
+
96
+ ---
97
+
98
+ ## Step 4 — Confirm Selection
99
+
100
+ Display the commits that will be reverted:
101
+
102
+ ```
103
+ The following commits will be reverted (using git revert, NOT git reset):
104
+
105
+ abc1234 feat(55-02): add undo skill
106
+ def5678 chore(55-02): register undo command
107
+
108
+ This creates new revert commits — your history is preserved.
109
+ ```
110
+
111
+ Use AskUserQuestion with the **yes-no** pattern:
112
+ - **question**: "Proceed with reverting these commits?"
113
+ - **options**: ["Proceed with revert", "Cancel"]
114
+
115
+ If user selects "Cancel": print "Undo cancelled." and exit.
116
+
117
+ ---
118
+
119
+ ## Step 5 — Execute git revert
120
+
121
+ For each commit hash in **reverse chronological order** (newest first):
122
+
123
+ ```bash
124
+ git revert --no-commit {hash}
125
+ ```
126
+
127
+ After all reverts are staged, determine the commit message:
128
+ - Extract scope from the first commit being reverted (e.g., `55-02`)
129
+ - If reverting a **single commit**: `revert({scope}): undo {original description}`
130
+ - If reverting **multiple commits**: `revert({scope}): undo {N} commits from {scope}`
131
+
132
+ Commit with:
133
+
134
+ ```bash
135
+ git commit -m "revert({scope}): undo {description}"
136
+ ```
137
+
138
+ **Conflict handling**: If `git revert --no-commit` exits non-zero or produces conflict markers:
139
+ 1. Run `git revert --abort` to clean up
140
+ 2. Display:
141
+ ```
142
+ Revert failed due to merge conflicts. Manual resolution required.
143
+ Run: git revert {hashes} and resolve conflicts.
144
+ ```
145
+ 3. Exit without committing.
146
+
147
+ ---
148
+
149
+ ## Step 6 — Report Result
150
+
151
+ Display completion banner:
152
+
153
+ ```
154
+ ╔══════════════════════════════════════════════════════════════╗
155
+ ║ PLAN-BUILD-RUN ► UNDO COMPLETE ║
156
+ ╚══════════════════════════════════════════════════════════════╝
157
+
158
+ Reverted: {N} commit(s) from scope {scope}
159
+ New revert commit: {hash} — revert({scope}): undo {description}
160
+
161
+ $pbr-status — check current state
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Anti-Patterns
167
+
168
+ 1. **DO NOT** use `git reset` — always use `git revert` to preserve history
169
+ 2. **DO NOT** revert commits from other users without confirmation
170
+ 3. **DO NOT** revert merge commits without warning the user about potential complexity
171
+ 4. **DO NOT** skip the confirmation step (Step 4)
172
+ 5. **DO NOT** commit if `git revert` reports conflicts — abort and report instead