@sienklogic/plan-build-run 2.60.0 → 2.61.1

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/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to Plan-Build-Run will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.61.1](https://github.com/SienkLogic/plan-build-run/compare/plan-build-run-v2.61.0...plan-build-run-v2.61.1) (2026-03-06)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **hooks:** resolve script path before .planning/ early-exit check ([06487f7](https://github.com/SienkLogic/plan-build-run/commit/06487f78799a521f6d9041dc1323d36bfdf4a1d8))
14
+
15
+ ## [2.61.0](https://github.com/SienkLogic/plan-build-run/compare/plan-build-run-v2.60.0...plan-build-run-v2.61.0) (2026-03-06)
16
+
17
+
18
+ ### Features
19
+
20
+ * **prd-import:** add --prd flag and Steps A-G to import skill ([1260658](https://github.com/SienkLogic/plan-build-run/commit/1260658fc4341f61f7e5c7e8bc47b70932f34bd8))
21
+ * **prd-import:** add prd.auto_extract config schema key ([5ba6b8a](https://github.com/SienkLogic/plan-build-run/commit/5ba6b8a57c6d99ef7ceb8279dda8e25acf5352fb))
22
+ * **prd-import:** sync --prd import flow to derivative plugins ([0d5fa67](https://github.com/SienkLogic/plan-build-run/commit/0d5fa67dcf0b84411dbe09b3ba77f278d7c178cc))
23
+
8
24
  ## [2.60.0](https://github.com/SienkLogic/plan-build-run/compare/plan-build-run-v2.59.0...plan-build-run-v2.60.0) (2026-03-06)
9
25
 
10
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sienklogic/plan-build-run",
3
- "version": "2.60.0",
3
+ "version": "2.61.1",
4
4
  "description": "Plan it, Build it, Run it — structured development workflow for Claude Code",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -49,7 +49,15 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
49
49
  1. Parse `$ARGUMENTS` for phase number
50
50
  2. Parse optional `--from <filepath>` flag (path to the external document to import)
51
51
  3. Parse optional `--skip-checker` flag (skip plan validation step)
52
+ 3b. Parse optional `--prd <filepath>` flag.
53
+ - If `--prd` is present: **branch into PRD Import Flow (Steps A–G below)** immediately after writing `.active-skill`.
54
+ - Do NOT proceed to Step 2 (standard import flow). The --prd branch is a completely separate execution path.
55
+ - If both `--prd` and `--from` are present: treat `--prd` as the primary flag; `--from` is ignored with an [INFO] note.
56
+ - If `--prd` is present but no filepath follows: display error "Missing filepath for --prd flag." and stop.
52
57
  4. **CRITICAL: Write .active-skill NOW.** Write the text "import" to `.planning/.active-skill` using the Write tool.
58
+
59
+ **→ If --prd flag was set: jump to PRD Import Flow (Step A). Do not continue to Step 2.**
60
+
53
61
  5. Validate:
54
62
  - Phase exists in ROADMAP.md
55
63
  - Phase directory exists at `.planning/phases/{NN}-{slug}/`
@@ -61,6 +69,253 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
61
69
 
62
70
  ---
63
71
 
72
+ ## PRD Import Flow
73
+
74
+ > **Entered when `--prd <filepath>` is present in $ARGUMENTS. Steps A–G replace Steps 2–11 entirely for this path.**
75
+
76
+ ---
77
+
78
+ ### Step A: Read and Validate PRD File
79
+
80
+ 1. Read the file at the `--prd <filepath>` path.
81
+ 2. If the file does not exist: display the "Import file not found" error from the Error Handling section and stop.
82
+ 3. If the file is empty or < 100 characters: display error "PRD file appears empty or too short to extract meaningful content." and stop.
83
+ 4. Store the full PRD content for use in Steps B–E.
84
+
85
+ ---
86
+
87
+ ### Step B: Gap Detection — Identify Missing Sections (inline)
88
+
89
+ Analyze the PRD content for the presence of these six required sections:
90
+
91
+ | Section | What to look for |
92
+ |---------|-----------------|
93
+ | Project name / title | A clear product name or title |
94
+ | Problem statement | What problem the product solves, who it's for |
95
+ | Goals / success criteria | Measurable outcomes, KPIs, or acceptance tests |
96
+ | Functional requirements | Feature list, user stories, or capabilities |
97
+ | Non-functional requirements | Performance, security, reliability constraints |
98
+ | Out of scope / deferred | Explicitly excluded features |
99
+
100
+ For each section that is **absent or ambiguous**, record it as a gap.
101
+
102
+ **If 1–3 gaps found:** Batch all gaps into ≤ 3 AskUserQuestion calls (max 4 options each). Ask the user to supply the missing info:
103
+
104
+ - If 1 gap: one AskUserQuestion with a freeform prompt.
105
+ - If 2–3 gaps: group into 2 AskUserQuestion calls of related topics (e.g., "Requirements" and "Constraints/Scope").
106
+ - If > 3 gaps: group all into exactly 3 AskUserQuestion calls. Do NOT exceed 3 calls.
107
+
108
+ Example AskUserQuestion for missing requirements:
109
+
110
+ ```
111
+ Use AskUserQuestion:
112
+ question: "The PRD doesn't clearly specify functional requirements. Please describe the main features or capabilities this product must have."
113
+ header: "Fill Gap"
114
+ options: [] ← freeform (no options means free text input)
115
+ multiSelect: false
116
+ ```
117
+
118
+ **If 0 gaps:** proceed directly to Step C with no prompts.
119
+
120
+ Incorporate user answers into the extraction context used in Step C.
121
+
122
+ ---
123
+
124
+ ### Step C: Extract 3 Files Inline (PROJECT.md, REQUIREMENTS.md, CONTEXT.md)
125
+
126
+ Using the PRD content (plus any gap-fill answers from Step B), generate the content for three files. Do this inline in your context — no agents for these three files.
127
+
128
+ **C1. Generate PROJECT.md content** using `templates/PROJECT.md.tmpl` as the structure:
129
+
130
+ - `{project_name}`: extract from PRD title/header
131
+ - `{ONE sentence core value statement}`: extract from problem statement / vision
132
+ - Vision section: 2-3 sentences from PRD problem statement
133
+ - Scope — In Scope: features from functional requirements section
134
+ - Scope — Out of Scope: features from "out of scope" section (or mark "None specified" if absent)
135
+ - Success Criteria: from goals/KPIs section
136
+ - Stakeholders: extract if present; default to "Primary user: end users of the product"
137
+ - Milestones line: leave as "Planned in {N} phases across 1 milestone — see .planning/ROADMAP.md"
138
+
139
+ **C2. Generate REQUIREMENTS.md content** using `templates/REQUIREMENTS.md.tmpl` as the structure:
140
+
141
+ - Functional Requirements: each feature/capability from PRD becomes one REQ-F-xxx row
142
+ - Number from REQ-F-001 sequentially
143
+ - Priority: "Must" for core features, "Should" for nice-to-haves (infer from PRD language)
144
+ - Non-Functional Requirements: from performance/security/reliability section if present
145
+ - Deferred Requirements: items from "out of scope" section
146
+ - Traceability table: leave "Implemented In" and "Verified In" columns as "—"
147
+
148
+ **C3. Generate CONTEXT.md content** using `templates/project-CONTEXT.md.tmpl` as the structure:
149
+
150
+ - Locked Decisions: extract any explicit technology choices or constraints from PRD
151
+ - User Constraints: extract deployment, team size, budget, timeline if mentioned
152
+ - Deferred Ideas: items from "out of scope" section
153
+ - Claude's Discretion Areas: leave empty (executor will fill as they work)
154
+
155
+ ---
156
+
157
+ ### Step D: Confirmation Gate
158
+
159
+ **Check config:** Read `.planning/config.json`. If `prd.auto_extract` is `true`, skip this step entirely and proceed directly to Step E.
160
+
161
+ **If prd.auto_extract is false (default):**
162
+
163
+ Display a preview of the three generated files (show first 10 lines of each with a `...` truncation).
164
+
165
+ Then present the confirmation gate using the **approve-revise-abort** pattern from `skills/shared/gate-prompts.md`:
166
+
167
+ ```
168
+ Use AskUserQuestion:
169
+ question: "Approve these extracted files? (PROJECT.md, REQUIREMENTS.md, CONTEXT.md — ROADMAP.md will be generated next)"
170
+ header: "Approve?"
171
+ options:
172
+ - label: "Approve" description: "Write files and generate ROADMAP.md"
173
+ - label: "Request changes" description: "Describe what to adjust before writing"
174
+ - label: "Abort" description: "Cancel PRD import"
175
+ multiSelect: false
176
+ ```
177
+
178
+ - **Approve**: proceed to Step E.
179
+ - **Request changes**: ask user what to change (AskUserQuestion freeform), revise the affected file(s) inline, and re-display the gate. Repeat until Approve or Abort.
180
+ - **Abort**: delete `.planning/.active-skill` and stop with message: "PRD import cancelled."
181
+
182
+ ---
183
+
184
+ ### Step E: Check for Existing Files and Write PROJECT.md, REQUIREMENTS.md, CONTEXT.md
185
+
186
+ For each of the three files (`PROJECT.md`, `REQUIREMENTS.md`, `CONTEXT.md` in `.planning/`):
187
+
188
+ 1. Check if the file already exists (Glob `.planning/PROJECT.md`, etc.).
189
+ 2. If it exists: use AskUserQuestion yes-no pattern:
190
+ ```
191
+ question: ".planning/{filename} already exists. Overwrite it?"
192
+ header: "Overwrite?"
193
+ options:
194
+ - label: "Yes" description: "Replace existing file"
195
+ - label: "No" description: "Keep existing, skip this file"
196
+ ```
197
+ - If No: skip writing that file.
198
+ 3. Write approved content to:
199
+ - `.planning/PROJECT.md`
200
+ - `.planning/REQUIREMENTS.md`
201
+ - `.planning/CONTEXT.md`
202
+
203
+ ---
204
+
205
+ ### Step F: Delegate ROADMAP.md Generation to pbr:planner
206
+
207
+ Display: `◐ Generating ROADMAP.md via planner...`
208
+
209
+ Spawn the planner subagent:
210
+
211
+ ```
212
+ Task({
213
+ subagent_type: "pbr:planner",
214
+ prompt: "
215
+ You are the planner agent in Roadmap Mode.
216
+
217
+ <files_to_read>
218
+ CRITICAL: Read these files BEFORE any other action:
219
+ 1. .planning/PROJECT.md
220
+ 2. .planning/REQUIREMENTS.md
221
+ 3. .planning/CONTEXT.md
222
+ </files_to_read>
223
+
224
+ Generate `.planning/ROADMAP.md` from the project files above.
225
+
226
+ Use the roadmap template at `${PLUGIN_ROOT}/templates/ROADMAP.md.tmpl`.
227
+ Apply Requirement Coverage Validation: every requirement in REQUIREMENTS.md must appear in at least one phase.
228
+ Apply the Dual Format requirement: Quick-scan checklist at top + detailed phase descriptions.
229
+ Wrap all phases in a Milestone section named after the project.
230
+
231
+ Write ROADMAP.md to `.planning/ROADMAP.md`.
232
+ Output your completion marker when done: ## PLANNING COMPLETE
233
+ "
234
+ })
235
+ ```
236
+
237
+ After the Task() completes:
238
+
239
+ - Confirm `.planning/ROADMAP.md` exists (Glob check).
240
+ - If missing: display error "Planner failed to generate ROADMAP.md. Run $pbr-plan to retry." and proceed to Step G anyway (the other 3 files are already written).
241
+
242
+ ---
243
+
244
+ ### Step G: State Updates, Commit, and Summary
245
+
246
+ **G1. Initialize STATE.md** (if it does not already exist):
247
+
248
+ - Run: `node ${PLUGIN_ROOT}/scripts/pbr-tools.js state load`
249
+ - If STATE.md does not exist: create `.planning/STATE.md` with frontmatter fields:
250
+ ```
251
+ project: {project_name from PROJECT.md}
252
+ current_phase: 1
253
+ status: planning
254
+ source: prd-import
255
+ prd_file: {filepath}
256
+ ```
257
+
258
+ **G2. Update STATE.md** with PRD import status:
259
+
260
+ - Set `status: planning`
261
+ - Note `source: prd-import` and `prd_file: {filepath}`
262
+
263
+ **G3. Commit (if planning.commit_docs is true in config):**
264
+
265
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
266
+
267
+ ```
268
+ docs(planning): init project docs from PRD import
269
+ ```
270
+
271
+ Stage: `.planning/PROJECT.md`, `.planning/REQUIREMENTS.md`, `.planning/CONTEXT.md`, `.planning/ROADMAP.md` (if generated), `.planning/STATE.md`.
272
+
273
+ **G4. Delete `.planning/.active-skill`.**
274
+
275
+ **G5. Display completion banner:**
276
+
277
+ ```
278
+ ╔══════════════════════════════════════════════════════════════╗
279
+ ║ PLAN-BUILD-RUN ► PRD IMPORT COMPLETE ✓ ║
280
+ ╚══════════════════════════════════════════════════════════════╝
281
+
282
+ **Project**: {project_name}
283
+ **Source**: {prd_filepath}
284
+
285
+ Files generated:
286
+ ✓ .planning/PROJECT.md
287
+ ✓ .planning/REQUIREMENTS.md
288
+ ✓ .planning/CONTEXT.md
289
+ {✓ or ✗} .planning/ROADMAP.md
290
+
291
+ Requirements extracted: {count} REQ-IDs
292
+ Gaps filled: {count} (via interactive prompts)
293
+
294
+
295
+
296
+ ╔══════════════════════════════════════════════════════════════╗
297
+ ║ ▶ NEXT UP ║
298
+ ╚══════════════════════════════════════════════════════════════╝
299
+
300
+ **Plan Phase 1** — generate execution plans for the first phase
301
+
302
+ `$pbr-plan 1`
303
+
304
+ <sub>`/clear` first → fresh context window</sub>
305
+
306
+
307
+
308
+ **Also available:**
309
+ - `$pbr-discuss` — review and refine decisions before planning
310
+ - `$pbr-status` — see full project overview
311
+ ```
312
+
313
+ ---
314
+
315
+ > **End of PRD Import Flow. Steps 2–11 below apply only to the standard --from flow.**
316
+
317
+ ---
318
+
64
319
  ### Step 2: Load Full Project Context (inline)
65
320
 
66
321
  Read all relevant context files. This context is used for conflict detection in Step 4.
@@ -500,6 +755,22 @@ File not found: {filepath}
500
755
  **To fix:** Check the path and try again.
501
756
  ```
502
757
 
758
+ ### PRD file too short
759
+ If the PRD file is < 100 characters:
760
+ ```
761
+ ╔══════════════════════════════════════════════════════════════╗
762
+ ║ ERROR ║
763
+ ╚══════════════════════════════════════════════════════════════╝
764
+
765
+ PRD file appears empty or too short to extract meaningful content.
766
+
767
+ **To fix:** Provide a more complete PRD document (minimum ~100 characters).
768
+ ```
769
+
770
+ ### PRD import cancelled
771
+ If user selects "Abort" at the confirmation gate (Step D):
772
+ Display: "PRD import cancelled." and delete `.planning/.active-skill`.
773
+
503
774
  ### Import document too vague
504
775
  If the imported document contains no actionable tasks, display:
505
776
  ```
@@ -536,3 +807,7 @@ Present remaining issues and ask user to decide: proceed or intervene.
536
807
  | `.planning/ROADMAP.md` | Plans Complete + Status updated to `planned` | Step 8a |
537
808
  | `.planning/STATE.md` | Updated with plan status and import source | Step 8b |
538
809
  | `.planning/CONTEXT.md` | Updated if blockers surfaced new locked decisions | Step 8d |
810
+ | `.planning/PROJECT.md` | Generated from PRD | Step E (PRD flow) |
811
+ | `.planning/REQUIREMENTS.md` | Generated from PRD | Step E (PRD flow) |
812
+ | `.planning/CONTEXT.md` | Generated from PRD | Step E (PRD flow) |
813
+ | `.planning/ROADMAP.md` | Generated by planner subagent | Step F (PRD flow) |
@@ -79,18 +79,6 @@
79
79
  }
80
80
  ]
81
81
  },
82
- {
83
- "matcher": "Write|Edit",
84
- "hooks": [
85
- {
86
- "type": "command",
87
- "bash": "node \"$(cd \"$(dirname \"$0\")\" && pwd)/../../pbr/scripts/run-hook.js\" suggest-compact.js",
88
- "powershell": "node (Join-Path (Split-Path -Parent $PSScriptRoot) 'pbr\\scripts\\run-hook.js') suggest-compact.js",
89
- "cwd": ".",
90
- "timeoutSec": 15
91
- }
92
- ]
93
- },
94
82
  {
95
83
  "matcher": "Bash",
96
84
  "hooks": [
@@ -166,18 +154,6 @@
166
154
  }
167
155
  ]
168
156
  },
169
- {
170
- "matcher": "Bash",
171
- "hooks": [
172
- {
173
- "type": "command",
174
- "bash": "node \"$(cd \"$(dirname \"$0\")\" && pwd)/../../pbr/scripts/run-hook.js\" check-cross-plugin-sync.js",
175
- "powershell": "node (Join-Path (Split-Path -Parent $PSScriptRoot) 'pbr\\scripts\\run-hook.js') check-cross-plugin-sync.js",
176
- "cwd": ".",
177
- "timeoutSec": 15
178
- }
179
- ]
180
- },
181
157
  {
182
158
  "matcher": "Write|Edit",
183
159
  "hooks": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pbr",
3
3
  "displayName": "Plan-Build-Run",
4
- "version": "2.60.0",
4
+ "version": "2.61.1",
5
5
  "description": "Plan-Build-Run — Structured development workflow for GitHub Copilot CLI. Solves context rot through disciplined agent delegation, structured planning, atomic execution, and goal-backward verification.",
6
6
  "author": {
7
7
  "name": "SienkLogic",
@@ -49,7 +49,15 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
49
49
  1. Parse `$ARGUMENTS` for phase number
50
50
  2. Parse optional `--from <filepath>` flag (path to the external document to import)
51
51
  3. Parse optional `--skip-checker` flag (skip plan validation step)
52
+ 3b. Parse optional `--prd <filepath>` flag.
53
+ - If `--prd` is present: **branch into PRD Import Flow (Steps A–G below)** immediately after writing `.active-skill`.
54
+ - Do NOT proceed to Step 2 (standard import flow). The --prd branch is a completely separate execution path.
55
+ - If both `--prd` and `--from` are present: treat `--prd` as the primary flag; `--from` is ignored with an [INFO] note.
56
+ - If `--prd` is present but no filepath follows: display error "Missing filepath for --prd flag." and stop.
52
57
  4. **CRITICAL: Write .active-skill NOW.** Write the text "import" to `.planning/.active-skill` using the Write tool.
58
+
59
+ **→ If --prd flag was set: jump to PRD Import Flow (Step A). Do not continue to Step 2.**
60
+
53
61
  5. Validate:
54
62
  - Phase exists in ROADMAP.md
55
63
  - Phase directory exists at `.planning/phases/{NN}-{slug}/`
@@ -61,6 +69,253 @@ Reference: `skills/shared/config-loading.md` for the tooling shortcut and config
61
69
 
62
70
  ---
63
71
 
72
+ ## PRD Import Flow
73
+
74
+ > **Entered when `--prd <filepath>` is present in $ARGUMENTS. Steps A–G replace Steps 2–11 entirely for this path.**
75
+
76
+ ---
77
+
78
+ ### Step A: Read and Validate PRD File
79
+
80
+ 1. Read the file at the `--prd <filepath>` path.
81
+ 2. If the file does not exist: display the "Import file not found" error from the Error Handling section and stop.
82
+ 3. If the file is empty or < 100 characters: display error "PRD file appears empty or too short to extract meaningful content." and stop.
83
+ 4. Store the full PRD content for use in Steps B–E.
84
+
85
+ ---
86
+
87
+ ### Step B: Gap Detection — Identify Missing Sections (inline)
88
+
89
+ Analyze the PRD content for the presence of these six required sections:
90
+
91
+ | Section | What to look for |
92
+ |---------|-----------------|
93
+ | Project name / title | A clear product name or title |
94
+ | Problem statement | What problem the product solves, who it's for |
95
+ | Goals / success criteria | Measurable outcomes, KPIs, or acceptance tests |
96
+ | Functional requirements | Feature list, user stories, or capabilities |
97
+ | Non-functional requirements | Performance, security, reliability constraints |
98
+ | Out of scope / deferred | Explicitly excluded features |
99
+
100
+ For each section that is **absent or ambiguous**, record it as a gap.
101
+
102
+ **If 1–3 gaps found:** Batch all gaps into ≤ 3 AskUserQuestion calls (max 4 options each). Ask the user to supply the missing info:
103
+
104
+ - If 1 gap: one AskUserQuestion with a freeform prompt.
105
+ - If 2–3 gaps: group into 2 AskUserQuestion calls of related topics (e.g., "Requirements" and "Constraints/Scope").
106
+ - If > 3 gaps: group all into exactly 3 AskUserQuestion calls. Do NOT exceed 3 calls.
107
+
108
+ Example AskUserQuestion for missing requirements:
109
+
110
+ ```
111
+ Use AskUserQuestion:
112
+ question: "The PRD doesn't clearly specify functional requirements. Please describe the main features or capabilities this product must have."
113
+ header: "Fill Gap"
114
+ options: [] ← freeform (no options means free text input)
115
+ multiSelect: false
116
+ ```
117
+
118
+ **If 0 gaps:** proceed directly to Step C with no prompts.
119
+
120
+ Incorporate user answers into the extraction context used in Step C.
121
+
122
+ ---
123
+
124
+ ### Step C: Extract 3 Files Inline (PROJECT.md, REQUIREMENTS.md, CONTEXT.md)
125
+
126
+ Using the PRD content (plus any gap-fill answers from Step B), generate the content for three files. Do this inline in your context — no agents for these three files.
127
+
128
+ **C1. Generate PROJECT.md content** using `templates/PROJECT.md.tmpl` as the structure:
129
+
130
+ - `{project_name}`: extract from PRD title/header
131
+ - `{ONE sentence core value statement}`: extract from problem statement / vision
132
+ - Vision section: 2-3 sentences from PRD problem statement
133
+ - Scope — In Scope: features from functional requirements section
134
+ - Scope — Out of Scope: features from "out of scope" section (or mark "None specified" if absent)
135
+ - Success Criteria: from goals/KPIs section
136
+ - Stakeholders: extract if present; default to "Primary user: end users of the product"
137
+ - Milestones line: leave as "Planned in {N} phases across 1 milestone — see .planning/ROADMAP.md"
138
+
139
+ **C2. Generate REQUIREMENTS.md content** using `templates/REQUIREMENTS.md.tmpl` as the structure:
140
+
141
+ - Functional Requirements: each feature/capability from PRD becomes one REQ-F-xxx row
142
+ - Number from REQ-F-001 sequentially
143
+ - Priority: "Must" for core features, "Should" for nice-to-haves (infer from PRD language)
144
+ - Non-Functional Requirements: from performance/security/reliability section if present
145
+ - Deferred Requirements: items from "out of scope" section
146
+ - Traceability table: leave "Implemented In" and "Verified In" columns as "—"
147
+
148
+ **C3. Generate CONTEXT.md content** using `templates/project-CONTEXT.md.tmpl` as the structure:
149
+
150
+ - Locked Decisions: extract any explicit technology choices or constraints from PRD
151
+ - User Constraints: extract deployment, team size, budget, timeline if mentioned
152
+ - Deferred Ideas: items from "out of scope" section
153
+ - Claude's Discretion Areas: leave empty (executor will fill as they work)
154
+
155
+ ---
156
+
157
+ ### Step D: Confirmation Gate
158
+
159
+ **Check config:** Read `.planning/config.json`. If `prd.auto_extract` is `true`, skip this step entirely and proceed directly to Step E.
160
+
161
+ **If prd.auto_extract is false (default):**
162
+
163
+ Display a preview of the three generated files (show first 10 lines of each with a `...` truncation).
164
+
165
+ Then present the confirmation gate using the **approve-revise-abort** pattern from `skills/shared/gate-prompts.md`:
166
+
167
+ ```
168
+ Use AskUserQuestion:
169
+ question: "Approve these extracted files? (PROJECT.md, REQUIREMENTS.md, CONTEXT.md — ROADMAP.md will be generated next)"
170
+ header: "Approve?"
171
+ options:
172
+ - label: "Approve" description: "Write files and generate ROADMAP.md"
173
+ - label: "Request changes" description: "Describe what to adjust before writing"
174
+ - label: "Abort" description: "Cancel PRD import"
175
+ multiSelect: false
176
+ ```
177
+
178
+ - **Approve**: proceed to Step E.
179
+ - **Request changes**: ask user what to change (AskUserQuestion freeform), revise the affected file(s) inline, and re-display the gate. Repeat until Approve or Abort.
180
+ - **Abort**: delete `.planning/.active-skill` and stop with message: "PRD import cancelled."
181
+
182
+ ---
183
+
184
+ ### Step E: Check for Existing Files and Write PROJECT.md, REQUIREMENTS.md, CONTEXT.md
185
+
186
+ For each of the three files (`PROJECT.md`, `REQUIREMENTS.md`, `CONTEXT.md` in `.planning/`):
187
+
188
+ 1. Check if the file already exists (Glob `.planning/PROJECT.md`, etc.).
189
+ 2. If it exists: use AskUserQuestion yes-no pattern:
190
+ ```
191
+ question: ".planning/{filename} already exists. Overwrite it?"
192
+ header: "Overwrite?"
193
+ options:
194
+ - label: "Yes" description: "Replace existing file"
195
+ - label: "No" description: "Keep existing, skip this file"
196
+ ```
197
+ - If No: skip writing that file.
198
+ 3. Write approved content to:
199
+ - `.planning/PROJECT.md`
200
+ - `.planning/REQUIREMENTS.md`
201
+ - `.planning/CONTEXT.md`
202
+
203
+ ---
204
+
205
+ ### Step F: Delegate ROADMAP.md Generation to pbr:planner
206
+
207
+ Display: `◐ Generating ROADMAP.md via planner...`
208
+
209
+ Spawn the planner subagent:
210
+
211
+ ```
212
+ Task({
213
+ subagent_type: "pbr:planner",
214
+ prompt: "
215
+ You are the planner agent in Roadmap Mode.
216
+
217
+ <files_to_read>
218
+ CRITICAL: Read these files BEFORE any other action:
219
+ 1. .planning/PROJECT.md
220
+ 2. .planning/REQUIREMENTS.md
221
+ 3. .planning/CONTEXT.md
222
+ </files_to_read>
223
+
224
+ Generate `.planning/ROADMAP.md` from the project files above.
225
+
226
+ Use the roadmap template at `${PLUGIN_ROOT}/templates/ROADMAP.md.tmpl`.
227
+ Apply Requirement Coverage Validation: every requirement in REQUIREMENTS.md must appear in at least one phase.
228
+ Apply the Dual Format requirement: Quick-scan checklist at top + detailed phase descriptions.
229
+ Wrap all phases in a Milestone section named after the project.
230
+
231
+ Write ROADMAP.md to `.planning/ROADMAP.md`.
232
+ Output your completion marker when done: ## PLANNING COMPLETE
233
+ "
234
+ })
235
+ ```
236
+
237
+ After the Task() completes:
238
+
239
+ - Confirm `.planning/ROADMAP.md` exists (Glob check).
240
+ - If missing: display error "Planner failed to generate ROADMAP.md. Run /pbr:plan to retry." and proceed to Step G anyway (the other 3 files are already written).
241
+
242
+ ---
243
+
244
+ ### Step G: State Updates, Commit, and Summary
245
+
246
+ **G1. Initialize STATE.md** (if it does not already exist):
247
+
248
+ - Run: `node ${PLUGIN_ROOT}/scripts/pbr-tools.js state load`
249
+ - If STATE.md does not exist: create `.planning/STATE.md` with frontmatter fields:
250
+ ```
251
+ project: {project_name from PROJECT.md}
252
+ current_phase: 1
253
+ status: planning
254
+ source: prd-import
255
+ prd_file: {filepath}
256
+ ```
257
+
258
+ **G2. Update STATE.md** with PRD import status:
259
+
260
+ - Set `status: planning`
261
+ - Note `source: prd-import` and `prd_file: {filepath}`
262
+
263
+ **G3. Commit (if planning.commit_docs is true in config):**
264
+
265
+ Reference: `skills/shared/commit-planning-docs.md` for the standard commit pattern.
266
+
267
+ ```
268
+ docs(planning): init project docs from PRD import
269
+ ```
270
+
271
+ Stage: `.planning/PROJECT.md`, `.planning/REQUIREMENTS.md`, `.planning/CONTEXT.md`, `.planning/ROADMAP.md` (if generated), `.planning/STATE.md`.
272
+
273
+ **G4. Delete `.planning/.active-skill`.**
274
+
275
+ **G5. Display completion banner:**
276
+
277
+ ```
278
+ ╔══════════════════════════════════════════════════════════════╗
279
+ ║ PLAN-BUILD-RUN ► PRD IMPORT COMPLETE ✓ ║
280
+ ╚══════════════════════════════════════════════════════════════╝
281
+
282
+ **Project**: {project_name}
283
+ **Source**: {prd_filepath}
284
+
285
+ Files generated:
286
+ ✓ .planning/PROJECT.md
287
+ ✓ .planning/REQUIREMENTS.md
288
+ ✓ .planning/CONTEXT.md
289
+ {✓ or ✗} .planning/ROADMAP.md
290
+
291
+ Requirements extracted: {count} REQ-IDs
292
+ Gaps filled: {count} (via interactive prompts)
293
+
294
+
295
+
296
+ ╔══════════════════════════════════════════════════════════════╗
297
+ ║ ▶ NEXT UP ║
298
+ ╚══════════════════════════════════════════════════════════════╝
299
+
300
+ **Plan Phase 1** — generate execution plans for the first phase
301
+
302
+ `/pbr:plan 1`
303
+
304
+ <sub>`/clear` first → fresh context window</sub>
305
+
306
+
307
+
308
+ **Also available:**
309
+ - `/pbr:discuss` — review and refine decisions before planning
310
+ - `/pbr:status` — see full project overview
311
+ ```
312
+
313
+ ---
314
+
315
+ > **End of PRD Import Flow. Steps 2–11 below apply only to the standard --from flow.**
316
+
317
+ ---
318
+
64
319
  ### Step 2: Load Full Project Context (inline)
65
320
 
66
321
  Read all relevant context files. This context is used for conflict detection in Step 4.
@@ -500,6 +755,22 @@ File not found: {filepath}
500
755
  **To fix:** Check the path and try again.
501
756
  ```
502
757
 
758
+ ### PRD file too short
759
+ If the PRD file is < 100 characters:
760
+ ```
761
+ ╔══════════════════════════════════════════════════════════════╗
762
+ ║ ERROR ║
763
+ ╚══════════════════════════════════════════════════════════════╝
764
+
765
+ PRD file appears empty or too short to extract meaningful content.
766
+
767
+ **To fix:** Provide a more complete PRD document (minimum ~100 characters).
768
+ ```
769
+
770
+ ### PRD import cancelled
771
+ If user selects "Abort" at the confirmation gate (Step D):
772
+ Display: "PRD import cancelled." and delete `.planning/.active-skill`.
773
+
503
774
  ### Import document too vague
504
775
  If the imported document contains no actionable tasks, display:
505
776
  ```
@@ -536,3 +807,7 @@ Present remaining issues and ask user to decide: proceed or intervene.
536
807
  | `.planning/ROADMAP.md` | Plans Complete + Status updated to `planned` | Step 8a |
537
808
  | `.planning/STATE.md` | Updated with plan status and import source | Step 8b |
538
809
  | `.planning/CONTEXT.md` | Updated if blockers surfaced new locked decisions | Step 8d |
810
+ | `.planning/PROJECT.md` | Generated from PRD | Step E (PRD flow) |
811
+ | `.planning/REQUIREMENTS.md` | Generated from PRD | Step E (PRD flow) |
812
+ | `.planning/CONTEXT.md` | Generated from PRD | Step E (PRD flow) |
813
+ | `.planning/ROADMAP.md` | Generated by planner subagent | Step F (PRD flow) |