prizmkit 1.1.57 → 1.1.60

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 (188) hide show
  1. package/bin/create-prizmkit.js +8 -6
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/codex/agent-adapter.js +38 -0
  4. package/bundled/adapters/codex/paths.js +27 -0
  5. package/bundled/adapters/codex/rules-adapter.js +30 -0
  6. package/bundled/adapters/codex/settings-adapter.js +27 -0
  7. package/bundled/adapters/codex/skill-adapter.js +65 -0
  8. package/bundled/adapters/codex/team-adapter.js +37 -0
  9. package/bundled/dev-pipeline/.env.example +2 -1
  10. package/bundled/dev-pipeline/README.md +10 -7
  11. package/bundled/dev-pipeline/lib/common.sh +278 -37
  12. package/bundled/dev-pipeline/run-bugfix.sh +10 -61
  13. package/bundled/dev-pipeline/run-feature.sh +10 -78
  14. package/bundled/dev-pipeline/run-recovery.sh +10 -46
  15. package/bundled/dev-pipeline/run-refactor.sh +10 -61
  16. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +17 -7
  17. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +9 -3
  18. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +9 -3
  19. package/bundled/dev-pipeline/scripts/utils.py +6 -4
  20. package/bundled/dev-pipeline-windows/.env.example +28 -0
  21. package/bundled/dev-pipeline-windows/README.md +30 -0
  22. package/bundled/dev-pipeline-windows/SCHEMA_ANALYSIS.md +525 -0
  23. package/bundled/dev-pipeline-windows/assets/feature-list-example.json +146 -0
  24. package/bundled/dev-pipeline-windows/assets/prizm-dev-team-integration.md +138 -0
  25. package/bundled/dev-pipeline-windows/launch-bugfix-daemon.ps1 +9 -0
  26. package/bundled/dev-pipeline-windows/launch-feature-daemon.ps1 +9 -0
  27. package/bundled/dev-pipeline-windows/launch-refactor-daemon.ps1 +9 -0
  28. package/bundled/dev-pipeline-windows/lib/common.ps1 +432 -0
  29. package/bundled/dev-pipeline-windows/lib/daemon.ps1 +140 -0
  30. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +446 -0
  31. package/bundled/dev-pipeline-windows/lib/reset.ps1 +87 -0
  32. package/bundled/dev-pipeline-windows/reset-bug.ps1 +9 -0
  33. package/bundled/dev-pipeline-windows/reset-feature.ps1 +9 -0
  34. package/bundled/dev-pipeline-windows/reset-refactor.ps1 +9 -0
  35. package/bundled/dev-pipeline-windows/run-bugfix.ps1 +9 -0
  36. package/bundled/dev-pipeline-windows/run-feature.ps1 +9 -0
  37. package/bundled/dev-pipeline-windows/run-recovery.ps1 +76 -0
  38. package/bundled/dev-pipeline-windows/run-refactor.ps1 +9 -0
  39. package/bundled/dev-pipeline-windows/scripts/check-session-status.py +228 -0
  40. package/bundled/dev-pipeline-windows/scripts/cleanup-logs.py +192 -0
  41. package/bundled/dev-pipeline-windows/scripts/detect-stuck.py +530 -0
  42. package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +1737 -0
  43. package/bundled/dev-pipeline-windows/scripts/generate-bugfix-prompt.py +685 -0
  44. package/bundled/dev-pipeline-windows/scripts/generate-recovery-prompt.py +805 -0
  45. package/bundled/dev-pipeline-windows/scripts/generate-refactor-prompt.py +763 -0
  46. package/bundled/dev-pipeline-windows/scripts/init-bugfix-pipeline.py +316 -0
  47. package/bundled/dev-pipeline-windows/scripts/init-dev-team.py +134 -0
  48. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +380 -0
  49. package/bundled/dev-pipeline-windows/scripts/init-refactor-pipeline.py +399 -0
  50. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +388 -0
  51. package/bundled/dev-pipeline-windows/scripts/patch-completion-notes.py +191 -0
  52. package/bundled/dev-pipeline-windows/scripts/update-bug-status.py +864 -0
  53. package/bundled/dev-pipeline-windows/scripts/update-checkpoint.py +173 -0
  54. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +1501 -0
  55. package/bundled/dev-pipeline-windows/scripts/update-refactor-status.py +1073 -0
  56. package/bundled/dev-pipeline-windows/scripts/utils.py +542 -0
  57. package/bundled/dev-pipeline-windows/templates/agent-prompts/critic-plan-challenge.md +7 -0
  58. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-fix.md +7 -0
  59. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +30 -0
  60. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-resume.md +5 -0
  61. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +7 -0
  62. package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +46 -0
  63. package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +43 -0
  64. package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +43 -0
  65. package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +43 -0
  66. package/bundled/dev-pipeline-windows/templates/bug-fix-list-schema.json +263 -0
  67. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +320 -0
  68. package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +237 -0
  69. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +331 -0
  70. package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +270 -0
  71. package/bundled/dev-pipeline-windows/templates/sections/ac-verification-checklist.md +13 -0
  72. package/bundled/dev-pipeline-windows/templates/sections/checkpoint-system.md +91 -0
  73. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +33 -0
  74. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-agent.md +10 -0
  75. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-full.md +12 -0
  76. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-lite.md +7 -0
  77. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-agent.md +8 -0
  78. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-full.md +9 -0
  79. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-lite.md +6 -0
  80. package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +21 -0
  81. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +31 -0
  82. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +72 -0
  83. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +63 -0
  84. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +62 -0
  85. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +71 -0
  86. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +64 -0
  87. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +23 -0
  88. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +24 -0
  89. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +12 -0
  90. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +53 -0
  91. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +32 -0
  92. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +37 -0
  93. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +50 -0
  94. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +52 -0
  95. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +27 -0
  96. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +27 -0
  97. package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +27 -0
  98. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +29 -0
  99. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +77 -0
  100. package/bundled/dev-pipeline-windows/templates/sections/phase0-init.md +13 -0
  101. package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +23 -0
  102. package/bundled/dev-pipeline-windows/templates/sections/session-context.md +5 -0
  103. package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +6 -0
  104. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-agent.md +67 -0
  105. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-lite.md +58 -0
  106. package/bundled/dev-pipeline-windows/templates/session-status-schema.json +83 -0
  107. package/bundled/skills/_metadata.json +1 -1
  108. package/bundled/skills/app-planner/SKILL.md +26 -18
  109. package/bundled/skills/app-planner/references/architecture-decisions.md +9 -5
  110. package/bundled/skills/app-planner/references/frontend-design-guide.md +1 -1
  111. package/bundled/skills/feature-planner/SKILL.md +9 -2
  112. package/bundled/skills/prizmkit-init/SKILL.md +7 -6
  113. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +2 -0
  114. package/bundled/skills-windows/app-planner/SKILL.md +639 -0
  115. package/bundled/skills-windows/app-planner/assets/app-design-guide.md +101 -0
  116. package/bundled/skills-windows/app-planner/references/architecture-decisions.md +52 -0
  117. package/bundled/skills-windows/app-planner/references/brainstorm-guide.md +101 -0
  118. package/bundled/skills-windows/app-planner/references/frontend-design-guide.md +71 -0
  119. package/bundled/skills-windows/app-planner/references/project-brief-guide.md +82 -0
  120. package/bundled/skills-windows/app-planner/references/red-team-checklist.md +40 -0
  121. package/bundled/skills-windows/app-planner/references/rules/backend/derivation-rules.md +609 -0
  122. package/bundled/skills-windows/app-planner/references/rules/backend/fixed-rules.md +285 -0
  123. package/bundled/skills-windows/app-planner/references/rules/backend/question-bank.md +249 -0
  124. package/bundled/skills-windows/app-planner/references/rules/backend/template.md +173 -0
  125. package/bundled/skills-windows/app-planner/references/rules/database/derivation-rules.md +373 -0
  126. package/bundled/skills-windows/app-planner/references/rules/database/fixed-rules.md +211 -0
  127. package/bundled/skills-windows/app-planner/references/rules/database/question-bank.md +184 -0
  128. package/bundled/skills-windows/app-planner/references/rules/database/template.md +158 -0
  129. package/bundled/skills-windows/app-planner/references/rules/frontend/derivation-rules.md +810 -0
  130. package/bundled/skills-windows/app-planner/references/rules/frontend/fixed-rules.md +188 -0
  131. package/bundled/skills-windows/app-planner/references/rules/frontend/question-bank.md +302 -0
  132. package/bundled/skills-windows/app-planner/references/rules/frontend/template.md +320 -0
  133. package/bundled/skills-windows/app-planner/references/rules/mobile/derivation-rules.md +639 -0
  134. package/bundled/skills-windows/app-planner/references/rules/mobile/fixed-rules.md +290 -0
  135. package/bundled/skills-windows/app-planner/references/rules/mobile/question-bank.md +232 -0
  136. package/bundled/skills-windows/app-planner/references/rules/mobile/template.md +175 -0
  137. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +415 -0
  138. package/bundled/skills-windows/bug-planner/SKILL.md +395 -0
  139. package/bundled/skills-windows/bug-planner/assets/bug-confirmation-template.md +43 -0
  140. package/bundled/skills-windows/bug-planner/references/critic-and-verification.md +44 -0
  141. package/bundled/skills-windows/bug-planner/references/error-recovery.md +73 -0
  142. package/bundled/skills-windows/bug-planner/references/input-formats.md +53 -0
  143. package/bundled/skills-windows/bug-planner/references/schema-validation.md +25 -0
  144. package/bundled/skills-windows/bug-planner/references/severity-rules.md +16 -0
  145. package/bundled/skills-windows/bug-planner/scripts/validate-bug-list.py +322 -0
  146. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +380 -0
  147. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +441 -0
  148. package/bundled/skills-windows/feature-pipeline-launcher/scripts/preflight-check.py +462 -0
  149. package/bundled/skills-windows/feature-planner/SKILL.md +401 -0
  150. package/bundled/skills-windows/feature-planner/assets/evaluation-guide.md +64 -0
  151. package/bundled/skills-windows/feature-planner/assets/planning-guide.md +214 -0
  152. package/bundled/skills-windows/feature-planner/references/browser-interaction.md +59 -0
  153. package/bundled/skills-windows/feature-planner/references/completeness-review.md +57 -0
  154. package/bundled/skills-windows/feature-planner/references/decomposition-patterns.md +75 -0
  155. package/bundled/skills-windows/feature-planner/references/error-recovery.md +90 -0
  156. package/bundled/skills-windows/feature-planner/references/incremental-feature-planning.md +112 -0
  157. package/bundled/skills-windows/feature-planner/references/new-project-planning.md +85 -0
  158. package/bundled/skills-windows/feature-planner/scripts/validate-and-generate.py +1029 -0
  159. package/bundled/skills-windows/feature-workflow/SKILL.md +531 -0
  160. package/bundled/skills-windows/prizmkit-init/SKILL.md +356 -0
  161. package/bundled/skills-windows/prizmkit-init/assets/project-brief-template.md +82 -0
  162. package/bundled/skills-windows/prizmkit-init/references/config-schema.md +68 -0
  163. package/bundled/skills-windows/prizmkit-init/references/rules/layer-detection.md +41 -0
  164. package/bundled/skills-windows/prizmkit-init/references/tech-stack-catalog.md +13 -0
  165. package/bundled/skills-windows/prizmkit-init/references/update-supplement.md +9 -0
  166. package/bundled/skills-windows/recovery-workflow/SKILL.md +456 -0
  167. package/bundled/skills-windows/recovery-workflow/evals/evals.json +46 -0
  168. package/bundled/skills-windows/recovery-workflow/scripts/detect-recovery-state.py +544 -0
  169. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +406 -0
  170. package/bundled/skills-windows/refactor-planner/SKILL.md +540 -0
  171. package/bundled/skills-windows/refactor-planner/assets/planning-guide.md +292 -0
  172. package/bundled/skills-windows/refactor-planner/references/behavior-preservation.md +301 -0
  173. package/bundled/skills-windows/refactor-planner/references/refactor-scoping-guide.md +221 -0
  174. package/bundled/skills-windows/refactor-planner/scripts/validate-and-generate-refactor.py +858 -0
  175. package/bundled/skills-windows/refactor-workflow/SKILL.md +503 -0
  176. package/package.json +3 -2
  177. package/src/clean.js +73 -2
  178. package/src/config.js +159 -50
  179. package/src/detect-platform.js +16 -8
  180. package/src/external-skills.js +26 -19
  181. package/src/index.js +31 -9
  182. package/src/manifest.js +6 -2
  183. package/src/metadata.js +43 -5
  184. package/src/platforms.js +36 -0
  185. package/src/prompts.js +31 -6
  186. package/src/runtimes.js +20 -0
  187. package/src/scaffold.js +314 -110
  188. package/src/upgrade.js +81 -41
@@ -0,0 +1,380 @@
1
+ ---
2
+ name: "bugfix-pipeline-launcher"
3
+ description: "Launch and manage the bugfix pipeline from within an AI CLI session. Start pipeline in background, monitor logs, check status, stop pipeline. Use this skill whenever the user wants to start fixing bugs, run the bugfix pipeline, check bugfix progress, or stop the bugfix pipeline. Trigger on: 'start fixing bugs', 'run bugfix pipeline', 'bugfix status', 'stop bug fix', 'launch bug fix', 'fix progress', 'stop fixing'. (project)"
4
+ ---
5
+
6
+ # Bugfix-Pipeline Launcher
7
+
8
+ Launch the autonomous bug fix pipeline from within an AI CLI conversation. Supports foreground and background execution modes.
9
+
10
+ ### Execution Mode
11
+
12
+ Three execution modes are available. The user chooses one before configuring other options:
13
+
14
+ 1. **Foreground** (recommended) — `.\.prizmkit\dev-pipeline\run-bugfix.ps1 run`. Visible output, direct error feedback, no orphaned processes.
15
+ 2. **Background daemon** — `.\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1`. Runs fully detached, survives AI CLI session closure.
16
+ 3. **Manual** — Display the assembled command(s) only. Do not execute anything. User runs them on their own.
17
+
18
+ **Background mode documentation**: When the user chooses background/daemon mode, record the choice and PID in `.prizmkit/bugfix-pipeline-run.log` (append-only) with timestamp, so the decision is traceable:
19
+ ```
20
+ [2026-03-26T10:30:00] MODE=daemon PID=12345 BUG_LIST=.prizmkit/plans/bug-fix-list.json BUGS=3
21
+ ```
22
+
23
+ ### When to Use
24
+
25
+ **Start bugfix pipeline** -- User says:
26
+ - "start fixing bugs", "run bugfix pipeline", "launch bug fixes", "fix all bugs"
27
+ - "start bug fix", "execute bug list", "begin fixing", "batch fix"
28
+ - After bug-planner completes: "fix them", "start fixing"
29
+
30
+ **Check status** -- User says:
31
+ - "bugfix status", "check bug fixes", "how's the fixing going", "bug fix progress"
32
+ - "fix progress", "bug fix status", "check fix progress", "how far along are the fixes"
33
+
34
+ **Stop bugfix pipeline** -- User says:
35
+ - "stop bug fix", "stop fixing", "halt bugfix", "pause bug fix", "stop fix pipeline"
36
+
37
+ **Show logs** -- User says:
38
+ - "bugfix logs", "show fix logs", "what's being fixed"
39
+ - "view fix logs", "fix logs"
40
+
41
+ **Do NOT use this skill when:**
42
+ - User wants to plan/collect bugs (use `bug-planner` instead)
43
+ - User wants to fix a single bug interactively in current session (use `bug-fix-workflow`)
44
+ - User wants to launch the feature pipeline (use `feature-pipeline-launcher`)
45
+
46
+ ### Prerequisites
47
+
48
+ Before any action, validate:
49
+
50
+ 1. **bugfix pipeline exists**: Confirm `.\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1` and `.\.prizmkit\dev-pipeline\run-bugfix.ps1` are present and executable
51
+ 2. **For start**: `.prizmkit/plans/bug-fix-list.json` must exist in `.prizmkit/plans/` (or user-specified path)
52
+ 3. **Dependencies**: `python` or the Windows `py` launcher, `git`, and one AI CLI (`codex`, `claude`, or `cbc`) must be in PATH
53
+ 4. **Browser tools** (optional): If any bug has `browser_interaction` field, check the corresponding tool is available. Bugs may specify `tool: "playwright-cli"`, `tool: "opencli"`, or `tool: "auto"` (AI chooses at runtime).
54
+
55
+ Quick check:
56
+ ```powershell
57
+ function Invoke-PrizmPython {
58
+ param([Parameter(ValueFromRemainingArguments = $true)][string[]]$Arguments)
59
+ $python = Get-Command python -ErrorAction SilentlyContinue
60
+ if ($python) {
61
+ & $python.Source -c 'import sys; raise SystemExit(0 if sys.version_info[0] == 3 else 1)' *> $null
62
+ if ($LASTEXITCODE -eq 0) {
63
+ & $python.Source @Arguments
64
+ return
65
+ }
66
+ }
67
+ $py = Get-Command py -ErrorAction SilentlyContinue
68
+ if ($py) {
69
+ & $py.Source -3 -c 'import sys; raise SystemExit(0 if sys.version_info[0] == 3 else 1)' *> $null
70
+ if ($LASTEXITCODE -eq 0) {
71
+ & $py.Source -3 @Arguments
72
+ return
73
+ }
74
+ }
75
+ throw "Python 3 is required. Install Python and ensure python or py is in PATH."
76
+ }
77
+ try {
78
+ $prizmPythonPath = Invoke-PrizmPython -c "import sys; print(sys.executable)"
79
+ "Python OK: $prizmPythonPath"
80
+ } catch {
81
+ "Missing Python: install Python 3 and ensure python or py is in PATH"
82
+ }
83
+ Get-Command git
84
+ $aiCli = @("codex", "claude", "cbc") | Where-Object { Get-Command $_ -ErrorAction SilentlyContinue } | Select-Object -First 1
85
+ if ($aiCli) { "AI CLI OK: $aiCli" } else { "Missing AI CLI: install codex, claude, or cbc" }
86
+ # Optional: browser interaction support (check both tools — bugs may use either)
87
+ if (Get-Command playwright-cli -ErrorAction SilentlyContinue) { "playwright-cli OK" } else { "playwright-cli not found (playwright browser verification will be skipped)" }
88
+ if (Get-Command opencli -ErrorAction SilentlyContinue) { "opencli OK" } else { "opencli not found (opencli browser verification will be skipped)" }
89
+ ```
90
+
91
+ If `.prizmkit/plans/bug-fix-list.json` is missing, inform user:
92
+ > "No .prizmkit/plans/bug-fix-list.json found. Run the `bug-planner` skill first to generate one, or provide a path to your bug fix list."
93
+
94
+ ### Workflow
95
+
96
+ Detect user intent from their message, then follow the corresponding workflow:
97
+
98
+ ---
99
+
100
+ #### Intent A: Start Bugfix Pipeline
101
+
102
+ > **Execution model**: The pipeline processes bugs **sequentially** (one at a time, in severity/priority order). The `dependencies` field in bug-fix-list.json is reserved for future parallel execution support and does NOT affect current execution order.
103
+
104
+ 1. **Check prerequisites**:
105
+ ```powershell
106
+ if (Test-Path .prizmkit/plans/bug-fix-list.json) { "Found" } else { "Missing" }
107
+ ```
108
+
109
+ 2. **Check not already running**:
110
+ ```powershell
111
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 status
112
+ ```
113
+ If running, inform user and ask: "Bugfix pipeline is already running. Want to restart it, check status, or view logs?"
114
+
115
+ 3. **Show bug summary** (so user knows what will be fixed):
116
+ ```powershell
117
+ $data = Get-Content .prizmkit\plans\bug-fix-list.json -Raw | ConvertFrom-Json
118
+ $bugs = @($data.bugs)
119
+ $severityOrder = @{ critical = 0; high = 1; medium = 2; low = 3 }
120
+ "Total bugs: $($bugs.Count)"
121
+ $bugs | Group-Object severity | ForEach-Object { " $($_.Name): $($_.Count)" }
122
+ ""
123
+ $bugsSorted = $bugs | Sort-Object `
124
+ @{ Expression = { if ($severityOrder.ContainsKey($_.severity)) { $severityOrder[$_.severity] } else { 2 } } }, `
125
+ @{ Expression = { if ($_.priority) { [int]$_.priority } else { 99 } } }
126
+ foreach ($bug in $bugsSorted) {
127
+ $severity = if ($bug.severity) { $bug.severity.ToUpperInvariant() } else { "?" }
128
+ $title = if ($bug.title) { $bug.title } else { "untitled" }
129
+ " $($bug.id): [$severity] $title"
130
+ }
131
+ ```
132
+ If pipeline state already exists, use the status command instead:
133
+ ```powershell
134
+ Invoke-PrizmPython .prizmkit/dev-pipeline/scripts/update-bug-status.py `
135
+ --bug-list .prizmkit/plans/bug-fix-list.json `
136
+ --state-dir .prizmkit/state/bugfix `
137
+ --action status
138
+ ```
139
+
140
+ 4. **Ask execution mode** (first user decision — SEPARATE `AskUserQuestion` call):
141
+
142
+ ⛔ **This MUST be its own standalone `AskUserQuestion` call.** Do NOT combine execution mode with step 5 config questions. The execution mode question is asked ALONE, user responds, THEN you proceed to step 5.
143
+
144
+ Use `AskUserQuestion` with exactly 1 question:
145
+
146
+ **Question 1 — Execution mode** (multiSelect: false):
147
+ - Foreground (Recommended) — pipeline runs in the current session via `run-bugfix.ps1 run`. Visible output and direct error feedback.
148
+ - Background daemon — pipeline runs fully detached via `launch-bugfix-daemon.ps1`. Survives AI CLI session closure.
149
+ - Manual — display the final assembled commands only. Do not execute anything. User runs them on their own.
150
+
151
+ ⚠️ STOP HERE and wait for user response before continuing to step 5.
152
+
153
+ 5. **Ask configuration options** ⚠️ MANDATORY INTERACTIVE STEP — applies to ALL execution modes (Foreground, Background, AND Manual). This is a SEPARATE `AskUserQuestion` call from step 4. You MUST ask the user to configure options and WAIT for their response BEFORE proceeding to step 6.
154
+
155
+ ⛔ **HARD STOP**: You MUST call `AskUserQuestion` with the 4 questions below and WAIT for the user's response. You MUST NOT:
156
+ - Combine step 4 and step 5 into one `AskUserQuestion` call (this is the most common violation — execution mode MUST be asked separately in step 4)
157
+ - Skip this step and jump to the next step
158
+ - Merge this step and the next step into one response
159
+ - Assume default values and show the command without asking
160
+ - Show the command as text and ask "ready?" without presenting the options
161
+ If you find yourself writing the final command before the user has answered these 4 questions, STOP — you are violating this rule.
162
+
163
+ Use `AskUserQuestion` to present ALL 4 configuration choices (the full 4-question budget goes to config, NOT shared with execution mode):
164
+
165
+ **Question 1 — Verbose logging** (multiSelect: false):
166
+ - On (default) — Detailed AI session logs including tool calls and subagent activity
167
+ - Off — Minimal logging
168
+
169
+ **Question 2 — Max retries** (multiSelect: false):
170
+ - 3 (default)
171
+ - 1
172
+ - 5
173
+
174
+ **Question 3 — Critic review** (multiSelect: false):
175
+ - Off (default) — Skip adversarial review
176
+ - On — Enable adversarial critic review: an independent AI agent reviews the diagnosis/plan for completeness and the fix for defects, edge cases, and regression risks. Adds ~5-10 min per bug.
177
+
178
+ **Question 4 — Advanced config?** (multiSelect: false):
179
+ - No (default) — Use defaults for session timeout and failure behavior
180
+ - Yes — Configure session timeout and stop-on-failure options
181
+
182
+ Note: Bug filter defaults to all bugs (by severity order). Default Critic to Off unless bugs have `severity: "critical"` or `severity: "high"` (in which case default to On). If the user selects "Other" on any option, handle their custom input.
183
+
184
+ **If user chose "Yes" to Advanced config**, ask a second round of `AskUserQuestion`:
185
+
186
+ **Question 1 — Session timeout** (multiSelect: false):
187
+ - None (default) — No timeout
188
+ - 30 min — `SESSION_TIMEOUT=1800`
189
+ - 1 hour — `SESSION_TIMEOUT=3600`
190
+ - 2 hours — `SESSION_TIMEOUT=7200`
191
+
192
+ **Question 2 — Stop on failure** (multiSelect: false):
193
+ - Off (default) — Pipeline continues to next task after failure
194
+ - On — Pipeline halts immediately when a task exhausts all retries (`STOP_ON_FAILURE=1`)
195
+
196
+ **Environment variable mapping** (for translating user responses → env vars):
197
+
198
+ | Config choice | Environment variable |
199
+ |-----------|---------------------|
200
+ | Verbose: Off | `VERBOSE=0` |
201
+ | Verbose: On | `VERBOSE=1` |
202
+ | Max retries: N | `MAX_RETRIES=N` |
203
+ | Critic: On | `ENABLE_CRITIC=true` |
204
+ | Timeout: value | `SESSION_TIMEOUT=<seconds>` |
205
+ | Stop on failure: On | `STOP_ON_FAILURE=1` |
206
+
207
+ **Advanced environment variables** (not exposed in interactive menu, pass via `--env`):
208
+
209
+ | Variable | Default | Purpose |
210
+ |----------|---------|---------|
211
+ | `MODEL` | (none) | AI model override (e.g. `claude-opus-4.6`) |
212
+
213
+ ⚠️ STOP HERE and wait for user response before continuing to step 6.
214
+
215
+ 6. **Show final command**: Assemble the complete command from execution mode + confirmed configuration, and present it to the user.
216
+
217
+ **Foreground command:**
218
+ ```powershell
219
+ $env:VERBOSE = "1"; .\.prizmkit\dev-pipeline\run-bugfix.ps1 run .prizmkit/plans/bug-fix-list.json
220
+ ```
221
+ With all options:
222
+ ```powershell
223
+ $env:VERBOSE = "1"; $env:MAX_RETRIES = "5"; $env:SESSION_TIMEOUT = "3600"
224
+ .\.prizmkit\dev-pipeline\run-bugfix.ps1 run .prizmkit/plans/bug-fix-list.json
225
+ ```
226
+
227
+ **Background daemon command:**
228
+ ```powershell
229
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 start .prizmkit/plans/bug-fix-list.json --env "VERBOSE=1"
230
+ ```
231
+ With all options:
232
+ ```powershell
233
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 start .prizmkit/plans/bug-fix-list.json `
234
+ --env "VERBOSE=1 MAX_RETRIES=5"
235
+ ```
236
+
237
+ **Manual mode**: Print the assembled command(s) and **stop here**. Do not execute anything. Do not proceed to step 7.
238
+ ```
239
+ # To run in foreground:
240
+ $env:VERBOSE = "1"; .\.prizmkit\dev-pipeline\run-bugfix.ps1 run .prizmkit/plans/bug-fix-list.json
241
+
242
+ # To run in background (detached):
243
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 start .prizmkit/plans/bug-fix-list.json --env "VERBOSE=1"
244
+
245
+ # To check status:
246
+ .\.prizmkit\dev-pipeline\run-bugfix.ps1 status .prizmkit/plans/bug-fix-list.json
247
+ ```
248
+
249
+ 7. **Confirm and launch** (Foreground and Background only — Manual mode ends at step 6):
250
+
251
+ Ask: "Ready to launch the bugfix pipeline with the above command?"
252
+
253
+ After user confirms, execute the command from step 6.
254
+
255
+ 8. **Post-launch** (depends on execution mode):
256
+
257
+ **If foreground**: Pipeline runs to completion in the terminal. After it finishes:
258
+ - Summarize results: total bugs, fixed, failed, skipped
259
+ - If all fixed: each bug session has already run `prizmkit-retrospective` internally (structural sync by default; full retrospective when the fix changed interfaces, dependencies, or observable behavior). Ask user what's next.
260
+ - If some failed: show failed bug IDs and suggest `.\.prizmkit\dev-pipeline\reset-bug.ps1 <B-XXX> --clean --run` for a fresh retry
261
+
262
+ **If background daemon**:
263
+ 1. Verify launch:
264
+ ```powershell
265
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 status
266
+ ```
267
+ 2. Start log monitoring — Use the PowerShell terminal with `run_in_background: true`:
268
+ ```powershell
269
+ Get-Content -Wait -Tail 50 .prizmkit/state/daemon/bugfix-daemon.log
270
+ ```
271
+ 3. Report to user:
272
+ - Pipeline PID
273
+ - Log file location
274
+ - "You can ask me 'bugfix status' or 'show fix logs' at any time"
275
+ - "Closing this session will NOT stop the pipeline"
276
+
277
+ ---
278
+
279
+ #### Intent B: Check Status
280
+
281
+ 1. **Check daemon status**:
282
+ ```powershell
283
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 status
284
+ ```
285
+
286
+ 2. **Show bug-level progress**:
287
+ ```powershell
288
+ Invoke-PrizmPython .prizmkit/dev-pipeline/scripts/update-bug-status.py `
289
+ --bug-list .prizmkit/plans/bug-fix-list.json `
290
+ --state-dir .prizmkit/state/bugfix `
291
+ --action status
292
+ ```
293
+
294
+ 3. **Show recent log activity** (last 20 lines):
295
+ ```powershell
296
+ Get-Content -Tail 20 .prizmkit/state/daemon/bugfix-daemon.log
297
+ ```
298
+
299
+ 4. **Summarize** to user: total bugs, completed, in-progress, failed, pending, needs-info.
300
+
301
+ ---
302
+
303
+ #### Intent C: Stop Bugfix Pipeline
304
+
305
+ 1. **Stop the daemon**:
306
+ ```powershell
307
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 stop
308
+ ```
309
+
310
+ 2. **Verify stopped**:
311
+ ```powershell
312
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 status
313
+ ```
314
+
315
+ 3. **Inform user**: "Bugfix pipeline stopped. State is preserved -- you can resume later with 'start bug fix' and it will pick up where it left off."
316
+
317
+ ---
318
+
319
+ #### Intent D: Show Logs
320
+
321
+ 1. **Check if running**:
322
+ ```powershell
323
+ .\.prizmkit\dev-pipeline\launch-bugfix-daemon.ps1 status
324
+ ```
325
+
326
+ 2. **If running** -- Start live tail with PowerShell terminal `run_in_background: true`:
327
+ ```powershell
328
+ Get-Content -Wait -Tail 50 .prizmkit/state/daemon/bugfix-daemon.log
329
+ ```
330
+
331
+ 3. **If not running** -- Show last 50 lines:
332
+ ```powershell
333
+ Get-Content -Tail 50 .prizmkit/state/daemon/bugfix-daemon.log
334
+ ```
335
+
336
+ 4. **For per-bug session logs** (when user asks about a specific bug):
337
+ ```powershell
338
+ # Check bug status for last session ID
339
+ Get-Content .prizmkit/state/bugfix/bugs/<BUG_ID>/status.json -ErrorAction SilentlyContinue
340
+ # Then tail that bug's session log
341
+ Get-Content -Tail 100 .prizmkit/state/bugfix/bugs/<BUG_ID>/sessions/<SESSION_ID>/logs/session.log
342
+ ```
343
+
344
+ ---
345
+
346
+ #### Intent E: Retry Single Bug
347
+
348
+ When user says "retry B-001":
349
+
350
+ ```powershell
351
+ .\.prizmkit\dev-pipeline\reset-bug.ps1 B-001 --clean --run .prizmkit/plans/bug-fix-list.json
352
+ ```
353
+
354
+ **Note:** `reset-bug.ps1 B-001 --clean --run` performs a clean reset for `B-001` before retrying that bug — this gives a fresh start.
355
+
356
+ ### Error Handling
357
+
358
+ | Error | Action |
359
+ |-------|--------|
360
+ | `.prizmkit/plans/bug-fix-list.json` not found | Tell user to run `bug-planner` skill first |
361
+ | JSON parsing failed | Use the bundled Python validation/status scripts instead of external JSON tools |
362
+ | AI CLI not in PATH | Check Codex (`codex`), Claude (`claude`), or CodeBuddy (`cbc`) installation |
363
+ | Bugfix pipeline already running | Show status, ask if user wants to stop and restart |
364
+ | PID file stale (process dead) | `launch-bugfix-daemon.ps1` auto-cleans, retry start |
365
+ | Launch failed (process died immediately) | Show last 20 lines of log: `Get-Content -Tail 20 .prizmkit/state/daemon/bugfix-daemon.log` |
366
+ | All bugs blocked/failed/needs-info | Show status, suggest retrying or providing more info |
367
+ | `playwright-cli` not installed | Browser verification skipped for playwright bugs (non-blocking). Suggest: `npm install -g @playwright/cli@latest; playwright-cli install --skills` |
368
+ | `opencli` not installed | Browser verification skipped for opencli bugs (non-blocking). Install opencli for Chrome session-based browser verification |
369
+ | PowerShell execution policy blocks script | Run `Set-ExecutionPolicy -Scope Process Bypass` for the current terminal |
370
+
371
+ ### Integration Notes
372
+
373
+ - **After bug-planner**: This is the natural next step. When user finishes bug planning and has `.prizmkit/plans/bug-fix-list.json`, suggest launching the bugfix pipeline.
374
+ - **Session independence**: In daemon mode, the bugfix pipeline runs completely detached. User can close the AI CLI, open a new session later, and use this skill to check progress or stop the pipeline.
375
+ - **Single instance**: Only one bugfix pipeline can run at a time. The PID file prevents duplicates.
376
+ - **Feature pipeline coexistence**: Bugfix and feature pipelines use separate state directories (`.prizmkit/state/bugfix/` vs `.prizmkit/state/features/`), so they can run simultaneously without conflict.
377
+ - **State preservation**: Stopping and restarting the bugfix pipeline resumes from where it left off -- completed bugs are not re-fixed.
378
+ - **Bug ordering**: Bugs are processed by severity (critical → high → medium → low), then by priority number within the same severity.
379
+ - **Background mode traceability**: When daemon mode is chosen, the decision is logged to `.prizmkit/bugfix-pipeline-run.log` with timestamp, PID, and bug count for auditability.
380
+ - **HANDOFF**: After pipeline completes all bugs, suggest running `prizmkit-retrospective` to capture lessons learned, or checking the fix reports in `.prizmkit/bugfix/`.