@lipter7/blueprint 2.0.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 (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +626 -0
  3. package/agents/bp-codebase-mapper.md +761 -0
  4. package/agents/bp-debugger.md +1198 -0
  5. package/agents/bp-executor.md +403 -0
  6. package/agents/bp-integration-checker.md +423 -0
  7. package/agents/bp-phase-researcher.md +469 -0
  8. package/agents/bp-plan-checker.md +622 -0
  9. package/agents/bp-planner.md +1157 -0
  10. package/agents/bp-project-researcher.md +618 -0
  11. package/agents/bp-research-synthesizer.md +236 -0
  12. package/agents/bp-roadmapper.md +605 -0
  13. package/agents/bp-verifier.md +523 -0
  14. package/bin/install.js +1754 -0
  15. package/blueprint/bin/blueprint-tools.js +4597 -0
  16. package/blueprint/bin/blueprint-tools.test.js +2033 -0
  17. package/blueprint/references/checkpoints.md +775 -0
  18. package/blueprint/references/continuation-format.md +249 -0
  19. package/blueprint/references/decimal-phase-calculation.md +65 -0
  20. package/blueprint/references/git-integration.md +248 -0
  21. package/blueprint/references/git-planning-commit.md +38 -0
  22. package/blueprint/references/model-profile-resolution.md +32 -0
  23. package/blueprint/references/model-profiles.md +73 -0
  24. package/blueprint/references/phase-argument-parsing.md +61 -0
  25. package/blueprint/references/planning-config.md +194 -0
  26. package/blueprint/references/questioning.md +141 -0
  27. package/blueprint/references/tdd.md +263 -0
  28. package/blueprint/references/ui-brand.md +160 -0
  29. package/blueprint/references/verification-patterns.md +612 -0
  30. package/blueprint/templates/DEBUG.md +159 -0
  31. package/blueprint/templates/UAT.md +247 -0
  32. package/blueprint/templates/codebase/architecture.md +255 -0
  33. package/blueprint/templates/codebase/concerns.md +310 -0
  34. package/blueprint/templates/codebase/conventions.md +307 -0
  35. package/blueprint/templates/codebase/integrations.md +280 -0
  36. package/blueprint/templates/codebase/stack.md +186 -0
  37. package/blueprint/templates/codebase/structure.md +285 -0
  38. package/blueprint/templates/codebase/testing.md +480 -0
  39. package/blueprint/templates/config.json +35 -0
  40. package/blueprint/templates/context.md +283 -0
  41. package/blueprint/templates/continue-here.md +78 -0
  42. package/blueprint/templates/debug-subagent-prompt.md +91 -0
  43. package/blueprint/templates/discovery.md +146 -0
  44. package/blueprint/templates/milestone-archive.md +123 -0
  45. package/blueprint/templates/milestone.md +115 -0
  46. package/blueprint/templates/phase-prompt.md +567 -0
  47. package/blueprint/templates/planner-subagent-prompt.md +117 -0
  48. package/blueprint/templates/project.md +184 -0
  49. package/blueprint/templates/requirements.md +231 -0
  50. package/blueprint/templates/research-project/ARCHITECTURE.md +204 -0
  51. package/blueprint/templates/research-project/FEATURES.md +147 -0
  52. package/blueprint/templates/research-project/PITFALLS.md +200 -0
  53. package/blueprint/templates/research-project/STACK.md +120 -0
  54. package/blueprint/templates/research-project/SUMMARY.md +170 -0
  55. package/blueprint/templates/research.md +552 -0
  56. package/blueprint/templates/roadmap.md +202 -0
  57. package/blueprint/templates/state.md +176 -0
  58. package/blueprint/templates/summary-complex.md +59 -0
  59. package/blueprint/templates/summary-minimal.md +41 -0
  60. package/blueprint/templates/summary-standard.md +48 -0
  61. package/blueprint/templates/summary.md +246 -0
  62. package/blueprint/templates/user-setup.md +311 -0
  63. package/blueprint/templates/verification-report.md +322 -0
  64. package/blueprint/workflows/add-phase.md +111 -0
  65. package/blueprint/workflows/add-todo.md +157 -0
  66. package/blueprint/workflows/audit-milestone.md +241 -0
  67. package/blueprint/workflows/check-todos.md +176 -0
  68. package/blueprint/workflows/complete-milestone.md +644 -0
  69. package/blueprint/workflows/diagnose-issues.md +219 -0
  70. package/blueprint/workflows/discovery-phase.md +289 -0
  71. package/blueprint/workflows/discuss-phase.md +408 -0
  72. package/blueprint/workflows/execute-phase.md +338 -0
  73. package/blueprint/workflows/execute-plan.md +437 -0
  74. package/blueprint/workflows/help.md +470 -0
  75. package/blueprint/workflows/insert-phase.md +129 -0
  76. package/blueprint/workflows/list-phase-assumptions.md +178 -0
  77. package/blueprint/workflows/map-codebase.md +327 -0
  78. package/blueprint/workflows/new-milestone.md +373 -0
  79. package/blueprint/workflows/new-project.md +958 -0
  80. package/blueprint/workflows/pause-work.md +122 -0
  81. package/blueprint/workflows/plan-milestone-gaps.md +256 -0
  82. package/blueprint/workflows/plan-phase.md +376 -0
  83. package/blueprint/workflows/progress.md +385 -0
  84. package/blueprint/workflows/quick.md +230 -0
  85. package/blueprint/workflows/remove-phase.md +154 -0
  86. package/blueprint/workflows/research-phase.md +74 -0
  87. package/blueprint/workflows/resume-project.md +306 -0
  88. package/blueprint/workflows/set-profile.md +80 -0
  89. package/blueprint/workflows/settings.md +145 -0
  90. package/blueprint/workflows/transition.md +493 -0
  91. package/blueprint/workflows/update.md +212 -0
  92. package/blueprint/workflows/verify-phase.md +226 -0
  93. package/blueprint/workflows/verify-work.md +570 -0
  94. package/commands/bp/add-phase.md +39 -0
  95. package/commands/bp/add-todo.md +42 -0
  96. package/commands/bp/audit-milestone.md +42 -0
  97. package/commands/bp/check-todos.md +41 -0
  98. package/commands/bp/complete-milestone.md +136 -0
  99. package/commands/bp/debug.md +162 -0
  100. package/commands/bp/discuss-phase.md +86 -0
  101. package/commands/bp/execute-phase.md +42 -0
  102. package/commands/bp/help.md +22 -0
  103. package/commands/bp/insert-phase.md +33 -0
  104. package/commands/bp/join-discord.md +18 -0
  105. package/commands/bp/list-phase-assumptions.md +50 -0
  106. package/commands/bp/map-codebase.md +71 -0
  107. package/commands/bp/new-milestone.md +51 -0
  108. package/commands/bp/new-project.md +42 -0
  109. package/commands/bp/pause-work.md +35 -0
  110. package/commands/bp/plan-milestone-gaps.md +40 -0
  111. package/commands/bp/plan-phase.md +44 -0
  112. package/commands/bp/progress.md +24 -0
  113. package/commands/bp/quick.md +38 -0
  114. package/commands/bp/reapply-patches.md +110 -0
  115. package/commands/bp/remove-phase.md +32 -0
  116. package/commands/bp/research-phase.md +187 -0
  117. package/commands/bp/resume-work.md +40 -0
  118. package/commands/bp/set-profile.md +34 -0
  119. package/commands/bp/settings.md +36 -0
  120. package/commands/bp/update.md +37 -0
  121. package/commands/bp/verify-work.md +39 -0
  122. package/hooks/dist/bp-check-update.js +62 -0
  123. package/hooks/dist/bp-statusline.js +91 -0
  124. package/package.json +48 -0
  125. package/scripts/build-hooks.js +42 -0
@@ -0,0 +1,376 @@
1
+ <purpose>
2
+ Create executable phase prompts (PLAN.md files) for a roadmap phase with integrated research and verification. Default flow: Research (if needed) -> Plan -> Verify -> Done. Orchestrates bp-phase-researcher, bp-planner, and bp-plan-checker agents with a revision loop (max 3 iterations).
3
+ </purpose>
4
+
5
+ <required_reading>
6
+ Read all files referenced by the invoking prompt's execution_context before starting.
7
+
8
+ @~/.claude/blueprint/references/ui-brand.md
9
+ </required_reading>
10
+
11
+ <process>
12
+
13
+ ## 1. Initialize
14
+
15
+ Load all context in one call (include file contents to avoid redundant reads):
16
+
17
+ ```bash
18
+ INIT=$(node ~/.claude/blueprint/bin/blueprint-tools.js init plan-phase "$PHASE" --include state,roadmap,requirements,context,research,verification,uat)
19
+ ```
20
+
21
+ Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_enabled`, `plan_checker_enabled`, `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `plan_count`, `planning_exists`, `roadmap_exists`.
22
+
23
+ **File contents (from --include):** `state_content`, `roadmap_content`, `requirements_content`, `context_content`, `research_content`, `verification_content`, `uat_content`. These are null if files don't exist.
24
+
25
+ **If `planning_exists` is false:** Error — run `/bp:new-project` first.
26
+
27
+ ## 2. Parse and Normalize Arguments
28
+
29
+ Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`).
30
+
31
+ **If no phase number:** Detect next unplanned phase from roadmap.
32
+
33
+ **If `phase_found` is false:** Validate phase exists in ROADMAP.md. If valid, create the directory using `phase_slug` and `padded_phase` from init:
34
+ ```bash
35
+ mkdir -p ".blueprint/phases/${padded_phase}-${phase_slug}"
36
+ ```
37
+
38
+ **Existing artifacts from init:** `has_research`, `has_plans`, `plan_count`.
39
+
40
+ ## 3. Validate Phase
41
+
42
+ ```bash
43
+ PHASE_INFO=$(node ~/.claude/blueprint/bin/blueprint-tools.js roadmap get-phase "${PHASE}")
44
+ ```
45
+
46
+ **If `found` is false:** Error with available phases. **If `found` is true:** Extract `phase_number`, `phase_name`, `goal` from JSON.
47
+
48
+ ## 4. Load CONTEXT.md
49
+
50
+ Use `context_content` from init JSON (already loaded via `--include context`).
51
+
52
+ **CRITICAL:** Use `context_content` from INIT — pass to researcher, planner, checker, and revision agents.
53
+
54
+ If `context_content` is not null, display: `Using phase context from: ${PHASE_DIR}/*-CONTEXT.md`
55
+
56
+ ## 5. Handle Research
57
+
58
+ **Skip if:** `--gaps` flag, `--skip-research` flag, or `research_enabled` is false (from init) without `--research` override.
59
+
60
+ **If `has_research` is true (from init) AND no `--research` flag:** Use existing, skip to step 6.
61
+
62
+ **If RESEARCH.md missing OR `--research` flag:**
63
+
64
+ Display banner:
65
+ ```
66
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
67
+ Blueprint ► RESEARCHING PHASE {X}
68
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
69
+
70
+ ◆ Spawning researcher...
71
+ ```
72
+
73
+ ### Spawn bp-phase-researcher
74
+
75
+ ```bash
76
+ PHASE_DESC=$(node ~/.claude/blueprint/bin/blueprint-tools.js roadmap get-phase "${PHASE}" | jq -r '.section')
77
+ # Use requirements_content from INIT (already loaded via --include requirements)
78
+ REQUIREMENTS=$(echo "$INIT" | jq -r '.requirements_content // empty' | grep -A100 "## Requirements" | head -50)
79
+ STATE_SNAP=$(node ~/.claude/blueprint/bin/blueprint-tools.js state-snapshot)
80
+ # Extract decisions from state-snapshot JSON: jq '.decisions[] | "\(.phase): \(.summary) - \(.rationale)"'
81
+ ```
82
+
83
+ Research prompt:
84
+
85
+ ```markdown
86
+ <objective>
87
+ Research how to implement Phase {phase_number}: {phase_name}
88
+ Answer: "What do I need to know to PLAN this phase well?"
89
+ </objective>
90
+
91
+ <phase_context>
92
+ IMPORTANT: If CONTEXT.md exists below, it contains user decisions from /bp:discuss-phase.
93
+ - **Decisions** = Locked — research THESE deeply, no alternatives
94
+ - **Claude's Discretion** = Freedom areas — research options, recommend
95
+ - **Deferred Ideas** = Out of scope — ignore
96
+
97
+ {context_content}
98
+ </phase_context>
99
+
100
+ <additional_context>
101
+ **Phase description:** {phase_description}
102
+ **Requirements:** {requirements}
103
+ **Prior decisions:** {decisions}
104
+ </additional_context>
105
+
106
+ <output>
107
+ Write to: {phase_dir}/{phase}-RESEARCH.md
108
+ </output>
109
+ ```
110
+
111
+ ```
112
+ Task(
113
+ prompt="First, read ~/.claude/agents/bp-phase-researcher.md for your role and instructions.\n\n" + research_prompt,
114
+ subagent_type="general-purpose",
115
+ model="{researcher_model}",
116
+ description="Research Phase {phase}"
117
+ )
118
+ ```
119
+
120
+ ### Handle Researcher Return
121
+
122
+ - **`## RESEARCH COMPLETE`:** Display confirmation, continue to step 6
123
+ - **`## RESEARCH BLOCKED`:** Display blocker, offer: 1) Provide context, 2) Skip research, 3) Abort
124
+
125
+ ## 6. Check Existing Plans
126
+
127
+ ```bash
128
+ ls "${PHASE_DIR}"/*-PLAN.md 2>/dev/null
129
+ ```
130
+
131
+ **If exists:** Offer: 1) Add more plans, 2) View existing, 3) Replan from scratch.
132
+
133
+ ## 7. Use Context Files from INIT
134
+
135
+ All file contents are already loaded via `--include` in step 1 (`@` syntax doesn't work across Task() boundaries):
136
+
137
+ ```bash
138
+ # Extract from INIT JSON (no need to re-read files)
139
+ STATE_CONTENT=$(echo "$INIT" | jq -r '.state_content // empty')
140
+ ROADMAP_CONTENT=$(echo "$INIT" | jq -r '.roadmap_content // empty')
141
+ REQUIREMENTS_CONTENT=$(echo "$INIT" | jq -r '.requirements_content // empty')
142
+ RESEARCH_CONTENT=$(echo "$INIT" | jq -r '.research_content // empty')
143
+ VERIFICATION_CONTENT=$(echo "$INIT" | jq -r '.verification_content // empty')
144
+ UAT_CONTENT=$(echo "$INIT" | jq -r '.uat_content // empty')
145
+ CONTEXT_CONTENT=$(echo "$INIT" | jq -r '.context_content // empty')
146
+ ```
147
+
148
+ ## 8. Spawn bp-planner Agent
149
+
150
+ Display banner:
151
+ ```
152
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
153
+ Blueprint ► PLANNING PHASE {X}
154
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
155
+
156
+ ◆ Spawning planner...
157
+ ```
158
+
159
+ Planner prompt:
160
+
161
+ ```markdown
162
+ <planning_context>
163
+ **Phase:** {phase_number}
164
+ **Mode:** {standard | gap_closure}
165
+
166
+ **Project State:** {state_content}
167
+ **Roadmap:** {roadmap_content}
168
+ **Requirements:** {requirements_content}
169
+
170
+ **Phase Context:**
171
+ IMPORTANT: If context exists below, it contains USER DECISIONS from /bp:discuss-phase.
172
+ - **Decisions** = LOCKED — honor exactly, do not revisit
173
+ - **Claude's Discretion** = Freedom — make implementation choices
174
+ - **Deferred Ideas** = Out of scope — do NOT include
175
+
176
+ {context_content}
177
+
178
+ **Research:** {research_content}
179
+ **Gap Closure (if --gaps):** {verification_content} {uat_content}
180
+ </planning_context>
181
+
182
+ <downstream_consumer>
183
+ Output consumed by /bp:execute-phase. Plans need:
184
+ - Frontmatter (wave, depends_on, files_modified, autonomous)
185
+ - Tasks in XML format
186
+ - Verification criteria
187
+ - must_haves for goal-backward verification
188
+ </downstream_consumer>
189
+
190
+ <quality_gate>
191
+ - [ ] PLAN.md files created in phase directory
192
+ - [ ] Each plan has valid frontmatter
193
+ - [ ] Tasks are specific and actionable
194
+ - [ ] Dependencies correctly identified
195
+ - [ ] Waves assigned for parallel execution
196
+ - [ ] must_haves derived from phase goal
197
+ </quality_gate>
198
+ ```
199
+
200
+ ```
201
+ Task(
202
+ prompt="First, read ~/.claude/agents/bp-planner.md for your role and instructions.\n\n" + filled_prompt,
203
+ subagent_type="general-purpose",
204
+ model="{planner_model}",
205
+ description="Plan Phase {phase}"
206
+ )
207
+ ```
208
+
209
+ ## 9. Handle Planner Return
210
+
211
+ - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
212
+ - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
213
+ - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
214
+
215
+ ## 10. Spawn bp-plan-checker Agent
216
+
217
+ Display banner:
218
+ ```
219
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
220
+ Blueprint ► VERIFYING PLANS
221
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
222
+
223
+ ◆ Spawning plan checker...
224
+ ```
225
+
226
+ ```bash
227
+ PLANS_CONTENT=$(cat "${PHASE_DIR}"/*-PLAN.md 2>/dev/null)
228
+ ```
229
+
230
+ Checker prompt:
231
+
232
+ ```markdown
233
+ <verification_context>
234
+ **Phase:** {phase_number}
235
+ **Phase Goal:** {goal from ROADMAP}
236
+
237
+ **Plans to verify:** {plans_content}
238
+ **Requirements:** {requirements_content}
239
+
240
+ **Phase Context:**
241
+ IMPORTANT: Plans MUST honor user decisions. Flag as issue if plans contradict.
242
+ - **Decisions** = LOCKED — plans must implement exactly
243
+ - **Claude's Discretion** = Freedom areas — plans can choose approach
244
+ - **Deferred Ideas** = Out of scope — plans must NOT include
245
+
246
+ {context_content}
247
+ </verification_context>
248
+
249
+ <expected_output>
250
+ - ## VERIFICATION PASSED — all checks pass
251
+ - ## ISSUES FOUND — structured issue list
252
+ </expected_output>
253
+ ```
254
+
255
+ ```
256
+ Task(
257
+ prompt=checker_prompt,
258
+ subagent_type="bp-plan-checker",
259
+ model="{checker_model}",
260
+ description="Verify Phase {phase} plans"
261
+ )
262
+ ```
263
+
264
+ ## 11. Handle Checker Return
265
+
266
+ - **`## VERIFICATION PASSED`:** Display confirmation, proceed to step 13.
267
+ - **`## ISSUES FOUND`:** Display issues, check iteration count, proceed to step 12.
268
+
269
+ ## 12. Revision Loop (Max 3 Iterations)
270
+
271
+ Track `iteration_count` (starts at 1 after initial plan + check).
272
+
273
+ **If iteration_count < 3:**
274
+
275
+ Display: `Sending back to planner for revision... (iteration {N}/3)`
276
+
277
+ ```bash
278
+ PLANS_CONTENT=$(cat "${PHASE_DIR}"/*-PLAN.md 2>/dev/null)
279
+ ```
280
+
281
+ Revision prompt:
282
+
283
+ ```markdown
284
+ <revision_context>
285
+ **Phase:** {phase_number}
286
+ **Mode:** revision
287
+
288
+ **Existing plans:** {plans_content}
289
+ **Checker issues:** {structured_issues_from_checker}
290
+
291
+ **Phase Context:**
292
+ Revisions MUST still honor user decisions.
293
+ {context_content}
294
+ </revision_context>
295
+
296
+ <instructions>
297
+ Make targeted updates to address checker issues.
298
+ Do NOT replan from scratch unless issues are fundamental.
299
+ Return what changed.
300
+ </instructions>
301
+ ```
302
+
303
+ ```
304
+ Task(
305
+ prompt="First, read ~/.claude/agents/bp-planner.md for your role and instructions.\n\n" + revision_prompt,
306
+ subagent_type="general-purpose",
307
+ model="{planner_model}",
308
+ description="Revise Phase {phase} plans"
309
+ )
310
+ ```
311
+
312
+ After planner returns -> spawn checker again (step 10), increment iteration_count.
313
+
314
+ **If iteration_count >= 3:**
315
+
316
+ Display: `Max iterations reached. {N} issues remain:` + issue list
317
+
318
+ Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
319
+
320
+ ## 13. Present Final Status
321
+
322
+ Route to `<offer_next>`.
323
+
324
+ </process>
325
+
326
+ <offer_next>
327
+ Output this markdown directly (not as a code block):
328
+
329
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
330
+ Blueprint ► PHASE {X} PLANNED ✓
331
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
332
+
333
+ **Phase {X}: {Name}** — {N} plan(s) in {M} wave(s)
334
+
335
+ | Wave | Plans | What it builds |
336
+ |------|-------|----------------|
337
+ | 1 | 01, 02 | [objectives] |
338
+ | 2 | 03 | [objective] |
339
+
340
+ Research: {Completed | Used existing | Skipped}
341
+ Verification: {Passed | Passed with override | Skipped}
342
+
343
+ ───────────────────────────────────────────────────────────────
344
+
345
+ ## ▶ Next Up
346
+
347
+ **Execute Phase {X}** — run all {N} plans
348
+
349
+ /bp:execute-phase {X}
350
+
351
+ <sub>/clear first → fresh context window</sub>
352
+
353
+ ───────────────────────────────────────────────────────────────
354
+
355
+ **Also available:**
356
+ - cat .blueprint/phases/{phase-dir}/*-PLAN.md — review plans
357
+ - /bp:plan-phase {X} --research — re-research first
358
+
359
+ ───────────────────────────────────────────────────────────────
360
+ </offer_next>
361
+
362
+ <success_criteria>
363
+ - [ ] .blueprint/ directory validated
364
+ - [ ] Phase validated against roadmap
365
+ - [ ] Phase directory created if needed
366
+ - [ ] CONTEXT.md loaded early (step 4) and passed to ALL agents
367
+ - [ ] Research completed (unless --skip-research or --gaps or exists)
368
+ - [ ] bp-phase-researcher spawned with CONTEXT.md
369
+ - [ ] Existing plans checked
370
+ - [ ] bp-planner spawned with CONTEXT.md + RESEARCH.md
371
+ - [ ] Plans created (PLANNING COMPLETE or CHECKPOINT handled)
372
+ - [ ] bp-plan-checker spawned with CONTEXT.md
373
+ - [ ] Verification passed OR user override OR max iterations with user decision
374
+ - [ ] User sees status between agent spawns
375
+ - [ ] User knows next steps
376
+ </success_criteria>