prizmkit 1.1.100 → 1.1.102

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 (317) hide show
  1. package/bin/create-prizmkit.js +4 -4
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/dev-pipeline/.env.example +3 -3
  4. package/bundled/dev-pipeline/README.md +110 -90
  5. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +1 -1
  6. package/bundled/dev-pipeline/cli.py +27 -0
  7. package/bundled/dev-pipeline/prizmkit_runtime/__init__.py +13 -0
  8. package/bundled/dev-pipeline/prizmkit_runtime/__main__.py +9 -0
  9. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +193 -0
  10. package/bundled/dev-pipeline/prizmkit_runtime/commands.py +313 -0
  11. package/bundled/dev-pipeline/prizmkit_runtime/compat.py +32 -0
  12. package/bundled/dev-pipeline/prizmkit_runtime/config.py +410 -0
  13. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +478 -0
  14. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +734 -0
  15. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +256 -0
  16. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +109 -0
  17. package/bundled/dev-pipeline/prizmkit_runtime/paths.py +110 -0
  18. package/bundled/dev-pipeline/prizmkit_runtime/processes.py +373 -0
  19. package/bundled/dev-pipeline/prizmkit_runtime/reset.py +389 -0
  20. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +51 -0
  21. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +179 -0
  22. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +355 -0
  23. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +118 -0
  24. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +187 -0
  25. package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +153 -0
  26. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +425 -0
  27. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +560 -0
  28. package/bundled/dev-pipeline/prizmkit_runtime/status.py +71 -0
  29. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +51 -36
  30. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +20 -5
  31. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +2 -2
  32. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +39 -0
  33. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +8 -2
  34. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +1 -1
  35. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +6 -2
  36. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +14 -6
  37. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +14 -4
  38. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +14 -4
  39. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +2 -0
  40. package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +9 -30
  41. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +15 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +42 -29
  43. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +41 -39
  44. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +8 -17
  45. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -2
  46. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +1 -3
  47. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -3
  48. package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +3 -8
  49. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +6 -2
  50. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +5 -1
  51. package/bundled/dev-pipeline/tests/test_auto_skip.py +436 -14
  52. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +115 -7
  53. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +40 -0
  54. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +1226 -0
  55. package/bundled/dev-pipeline/tests/test_unified_cli.py +1045 -0
  56. package/bundled/skills/_metadata.json +1 -1
  57. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +29 -34
  58. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +6 -5
  59. package/bundled/skills/feature-pipeline-launcher/SKILL.md +29 -35
  60. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +7 -6
  61. package/bundled/skills/feature-workflow/SKILL.md +3 -6
  62. package/bundled/skills/recovery-workflow/SKILL.md +23 -32
  63. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +29 -35
  64. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +7 -6
  65. package/bundled/skills/refactor-workflow/SKILL.md +3 -6
  66. package/bundled/templates/hooks/commit-intent.json +2 -2
  67. package/bundled/templates/hooks/diff-prizm-docs.py +226 -0
  68. package/bundled/templates/hooks/prizm-pre-commit.py +45 -0
  69. package/bundled/templates/hooks/validate-prizm-docs.py +240 -0
  70. package/package.json +1 -1
  71. package/src/config.js +42 -19
  72. package/src/external-skills.js +14 -14
  73. package/src/index.js +3 -6
  74. package/src/manifest.js +11 -5
  75. package/src/metadata.js +7 -18
  76. package/src/platforms.js +25 -0
  77. package/src/prompts.js +0 -12
  78. package/src/runtimes.js +18 -11
  79. package/src/scaffold.js +144 -122
  80. package/src/upgrade.js +12 -3
  81. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +0 -500
  82. package/bundled/dev-pipeline/launch-feature-daemon.sh +0 -657
  83. package/bundled/dev-pipeline/launch-refactor-daemon.sh +0 -502
  84. package/bundled/dev-pipeline/lib/branch.sh +0 -326
  85. package/bundled/dev-pipeline/lib/common.sh +0 -1476
  86. package/bundled/dev-pipeline/lib/heartbeat.sh +0 -469
  87. package/bundled/dev-pipeline/reset-bug.sh +0 -425
  88. package/bundled/dev-pipeline/reset-feature.sh +0 -436
  89. package/bundled/dev-pipeline/reset-refactor.sh +0 -423
  90. package/bundled/dev-pipeline/run-bugfix.sh +0 -1430
  91. package/bundled/dev-pipeline/run-feature.sh +0 -1718
  92. package/bundled/dev-pipeline/run-recovery.sh +0 -648
  93. package/bundled/dev-pipeline/run-refactor.sh +0 -1463
  94. package/bundled/dev-pipeline/tests/test-path-resolution.sh +0 -100
  95. package/bundled/dev-pipeline-windows/.env.example +0 -36
  96. package/bundled/dev-pipeline-windows/README.md +0 -30
  97. package/bundled/dev-pipeline-windows/SCHEMA_ANALYSIS.md +0 -533
  98. package/bundled/dev-pipeline-windows/assets/feature-list-example.json +0 -146
  99. package/bundled/dev-pipeline-windows/assets/prizm-dev-team-integration.md +0 -137
  100. package/bundled/dev-pipeline-windows/launch-bugfix-daemon.ps1 +0 -9
  101. package/bundled/dev-pipeline-windows/launch-feature-daemon.ps1 +0 -9
  102. package/bundled/dev-pipeline-windows/launch-refactor-daemon.ps1 +0 -9
  103. package/bundled/dev-pipeline-windows/lib/branch.ps1 +0 -235
  104. package/bundled/dev-pipeline-windows/lib/common.ps1 +0 -991
  105. package/bundled/dev-pipeline-windows/lib/daemon.ps1 +0 -140
  106. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +0 -1051
  107. package/bundled/dev-pipeline-windows/lib/reset.ps1 +0 -121
  108. package/bundled/dev-pipeline-windows/reset-bug.ps1 +0 -10
  109. package/bundled/dev-pipeline-windows/reset-feature.ps1 +0 -10
  110. package/bundled/dev-pipeline-windows/reset-refactor.ps1 +0 -10
  111. package/bundled/dev-pipeline-windows/run-bugfix.ps1 +0 -9
  112. package/bundled/dev-pipeline-windows/run-feature.ps1 +0 -9
  113. package/bundled/dev-pipeline-windows/run-recovery.ps1 +0 -179
  114. package/bundled/dev-pipeline-windows/run-refactor.ps1 +0 -9
  115. package/bundled/dev-pipeline-windows/scripts/check-session-status.py +0 -301
  116. package/bundled/dev-pipeline-windows/scripts/continuation.py +0 -374
  117. package/bundled/dev-pipeline-windows/scripts/detect-stuck.py +0 -530
  118. package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +0 -2279
  119. package/bundled/dev-pipeline-windows/scripts/generate-bugfix-prompt.py +0 -763
  120. package/bundled/dev-pipeline-windows/scripts/generate-recovery-prompt.py +0 -805
  121. package/bundled/dev-pipeline-windows/scripts/generate-refactor-prompt.py +0 -841
  122. package/bundled/dev-pipeline-windows/scripts/init-bugfix-pipeline.py +0 -316
  123. package/bundled/dev-pipeline-windows/scripts/init-dev-team.py +0 -134
  124. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +0 -382
  125. package/bundled/dev-pipeline-windows/scripts/init-refactor-pipeline.py +0 -399
  126. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +0 -1362
  127. package/bundled/dev-pipeline-windows/scripts/patch-completion-notes.py +0 -191
  128. package/bundled/dev-pipeline-windows/scripts/prizmkit-test-gate.py +0 -446
  129. package/bundled/dev-pipeline-windows/scripts/update-bug-status.py +0 -1121
  130. package/bundled/dev-pipeline-windows/scripts/update-checkpoint.py +0 -173
  131. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +0 -1789
  132. package/bundled/dev-pipeline-windows/scripts/update-refactor-status.py +0 -1327
  133. package/bundled/dev-pipeline-windows/scripts/utils.py +0 -542
  134. package/bundled/dev-pipeline-windows/templates/agent-prompts/critic-plan-challenge.md +0 -7
  135. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-fix.md +0 -7
  136. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +0 -65
  137. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-resume.md +0 -5
  138. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +0 -7
  139. package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +0 -73
  140. package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +0 -589
  141. package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +0 -710
  142. package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +0 -791
  143. package/bundled/dev-pipeline-windows/templates/bug-fix-list-schema.json +0 -263
  144. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +0 -326
  145. package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +0 -237
  146. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +0 -340
  147. package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +0 -270
  148. package/bundled/dev-pipeline-windows/templates/sections/ac-verification-checklist.md +0 -7
  149. package/bundled/dev-pipeline-windows/templates/sections/checkpoint-system.md +0 -91
  150. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +0 -34
  151. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-agent.md +0 -10
  152. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-full.md +0 -12
  153. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-lite.md +0 -7
  154. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-agent.md +0 -8
  155. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-full.md +0 -9
  156. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-lite.md +0 -6
  157. package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +0 -21
  158. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +0 -21
  159. package/bundled/dev-pipeline-windows/templates/sections/log-size-awareness.md +0 -41
  160. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +0 -283
  161. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +0 -112
  162. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +0 -168
  163. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +0 -82
  164. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +0 -75
  165. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +0 -23
  166. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +0 -14
  167. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +0 -19
  168. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +0 -63
  169. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +0 -42
  170. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +0 -44
  171. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +0 -59
  172. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +0 -39
  173. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +0 -27
  174. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +0 -27
  175. package/bundled/dev-pipeline-windows/templates/sections/phase-prizmkit-test.md +0 -39
  176. package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +0 -35
  177. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +0 -35
  178. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +0 -73
  179. package/bundled/dev-pipeline-windows/templates/sections/phase0-init.md +0 -13
  180. package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +0 -21
  181. package/bundled/dev-pipeline-windows/templates/sections/session-context.md +0 -5
  182. package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +0 -6
  183. package/bundled/dev-pipeline-windows/templates/sections/task-contract.md +0 -34
  184. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-agent.md +0 -48
  185. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-lite.md +0 -48
  186. package/bundled/dev-pipeline-windows/templates/session-status-schema.json +0 -83
  187. package/bundled/skills-windows/app-planner/SKILL.md +0 -296
  188. package/bundled/skills-windows/app-planner/assets/app-design-guide.md +0 -101
  189. package/bundled/skills-windows/app-planner/references/architecture-decisions.md +0 -52
  190. package/bundled/skills-windows/app-planner/references/brainstorm-guide.md +0 -101
  191. package/bundled/skills-windows/app-planner/references/frontend-design-guide.md +0 -71
  192. package/bundled/skills-windows/app-planner/references/infrastructure-convention-discovery.md +0 -108
  193. package/bundled/skills-windows/app-planner/references/project-brief-guide.md +0 -82
  194. package/bundled/skills-windows/app-planner/references/project-conventions-discovery.md +0 -59
  195. package/bundled/skills-windows/app-planner/references/project-state-detection.md +0 -90
  196. package/bundled/skills-windows/app-planner/references/red-team-checklist.md +0 -40
  197. package/bundled/skills-windows/app-planner/references/rules/backend/derivation-rules.md +0 -619
  198. package/bundled/skills-windows/app-planner/references/rules/backend/fixed-rules.md +0 -285
  199. package/bundled/skills-windows/app-planner/references/rules/backend/question-bank.md +0 -249
  200. package/bundled/skills-windows/app-planner/references/rules/backend/question-manifest.json +0 -46
  201. package/bundled/skills-windows/app-planner/references/rules/backend/template.md +0 -173
  202. package/bundled/skills-windows/app-planner/references/rules/database/derivation-rules.md +0 -382
  203. package/bundled/skills-windows/app-planner/references/rules/database/fixed-rules.md +0 -211
  204. package/bundled/skills-windows/app-planner/references/rules/database/question-bank.md +0 -184
  205. package/bundled/skills-windows/app-planner/references/rules/database/question-manifest.json +0 -39
  206. package/bundled/skills-windows/app-planner/references/rules/database/template.md +0 -158
  207. package/bundled/skills-windows/app-planner/references/rules/frontend/derivation-rules.md +0 -820
  208. package/bundled/skills-windows/app-planner/references/rules/frontend/fixed-rules.md +0 -188
  209. package/bundled/skills-windows/app-planner/references/rules/frontend/question-bank.md +0 -319
  210. package/bundled/skills-windows/app-planner/references/rules/frontend/question-manifest.json +0 -51
  211. package/bundled/skills-windows/app-planner/references/rules/frontend/template.md +0 -339
  212. package/bundled/skills-windows/app-planner/references/rules/mobile/derivation-rules.md +0 -649
  213. package/bundled/skills-windows/app-planner/references/rules/mobile/fixed-rules.md +0 -290
  214. package/bundled/skills-windows/app-planner/references/rules/mobile/question-bank.md +0 -232
  215. package/bundled/skills-windows/app-planner/references/rules/mobile/question-manifest.json +0 -47
  216. package/bundled/skills-windows/app-planner/references/rules/mobile/template.md +0 -175
  217. package/bundled/skills-windows/app-planner/references/rules-configuration.md +0 -46
  218. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +0 -379
  219. package/bundled/skills-windows/bug-fix-workflow/references/bug-diagnosis.md +0 -41
  220. package/bundled/skills-windows/bug-planner/SKILL.md +0 -402
  221. package/bundled/skills-windows/bug-planner/assets/bug-confirmation-template.md +0 -43
  222. package/bundled/skills-windows/bug-planner/references/critic-and-verification.md +0 -44
  223. package/bundled/skills-windows/bug-planner/references/error-recovery.md +0 -73
  224. package/bundled/skills-windows/bug-planner/references/input-formats.md +0 -53
  225. package/bundled/skills-windows/bug-planner/references/schema-validation.md +0 -25
  226. package/bundled/skills-windows/bug-planner/references/severity-rules.md +0 -16
  227. package/bundled/skills-windows/bug-planner/scripts/validate-bug-list.py +0 -322
  228. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +0 -304
  229. package/bundled/skills-windows/bugfix-pipeline-launcher/references/configuration.md +0 -84
  230. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +0 -381
  231. package/bundled/skills-windows/feature-pipeline-launcher/references/configuration.md +0 -67
  232. package/bundled/skills-windows/feature-pipeline-launcher/scripts/preflight-check.py +0 -462
  233. package/bundled/skills-windows/feature-planner/SKILL.md +0 -397
  234. package/bundled/skills-windows/feature-planner/assets/evaluation-guide.md +0 -64
  235. package/bundled/skills-windows/feature-planner/assets/planning-guide.md +0 -214
  236. package/bundled/skills-windows/feature-planner/references/browser-interaction.md +0 -59
  237. package/bundled/skills-windows/feature-planner/references/completeness-review.md +0 -57
  238. package/bundled/skills-windows/feature-planner/references/decomposition-patterns.md +0 -75
  239. package/bundled/skills-windows/feature-planner/references/error-recovery.md +0 -90
  240. package/bundled/skills-windows/feature-planner/references/incremental-feature-planning.md +0 -112
  241. package/bundled/skills-windows/feature-planner/references/new-project-planning.md +0 -85
  242. package/bundled/skills-windows/feature-planner/scripts/validate-and-generate.py +0 -1020
  243. package/bundled/skills-windows/feature-workflow/SKILL.md +0 -374
  244. package/bundled/skills-windows/feature-workflow/references/brainstorm-guide.md +0 -137
  245. package/bundled/skills-windows/prizm-kit/SKILL.md +0 -93
  246. package/bundled/skills-windows/prizmkit-code-review/SKILL.md +0 -161
  247. package/bundled/skills-windows/prizmkit-code-review/references/dev-agent-prompt.md +0 -30
  248. package/bundled/skills-windows/prizmkit-code-review/references/review-report-template.md +0 -31
  249. package/bundled/skills-windows/prizmkit-code-review/references/reviewer-agent-prompt.md +0 -66
  250. package/bundled/skills-windows/prizmkit-code-review/scripts/check_loop.py +0 -186
  251. package/bundled/skills-windows/prizmkit-committer/SKILL.md +0 -89
  252. package/bundled/skills-windows/prizmkit-deploy/SKILL.md +0 -444
  253. package/bundled/skills-windows/prizmkit-deploy/references/ci-cd-workflows.md +0 -115
  254. package/bundled/skills-windows/prizmkit-deploy/references/cloud-platform-deploy.md +0 -93
  255. package/bundled/skills-windows/prizmkit-deploy/references/data-safety-examples.md +0 -120
  256. package/bundled/skills-windows/prizmkit-deploy/references/database-setup.md +0 -46
  257. package/bundled/skills-windows/prizmkit-deploy/references/deploy-config-schema.md +0 -148
  258. package/bundled/skills-windows/prizmkit-deploy/references/deploy-history-schema.md +0 -62
  259. package/bundled/skills-windows/prizmkit-deploy/references/deployment-modes.md +0 -50
  260. package/bundled/skills-windows/prizmkit-deploy/references/direct-upload.md +0 -26
  261. package/bundled/skills-windows/prizmkit-deploy/references/dns-setup.md +0 -42
  262. package/bundled/skills-windows/prizmkit-deploy/references/docker-deploy.md +0 -31
  263. package/bundled/skills-windows/prizmkit-deploy/references/firewall-setup.md +0 -37
  264. package/bundled/skills-windows/prizmkit-deploy/references/live-validation-notes.md +0 -21
  265. package/bundled/skills-windows/prizmkit-deploy/references/nginx-blue-green.md +0 -59
  266. package/bundled/skills-windows/prizmkit-deploy/references/ssh-bootstrap-flow.md +0 -49
  267. package/bundled/skills-windows/prizmkit-deploy/references/ssh-execution-flow.md +0 -41
  268. package/bundled/skills-windows/prizmkit-deploy/references/ssh-takeover.md +0 -20
  269. package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +0 -56
  270. package/bundled/skills-windows/prizmkit-implement/SKILL.md +0 -71
  271. package/bundled/skills-windows/prizmkit-init/SKILL.md +0 -356
  272. package/bundled/skills-windows/prizmkit-init/assets/project-brief-template.md +0 -82
  273. package/bundled/skills-windows/prizmkit-init/references/config-schema.md +0 -70
  274. package/bundled/skills-windows/prizmkit-init/references/rules/layer-detection.md +0 -41
  275. package/bundled/skills-windows/prizmkit-init/references/tech-stack-catalog.md +0 -13
  276. package/bundled/skills-windows/prizmkit-init/references/update-supplement.md +0 -9
  277. package/bundled/skills-windows/prizmkit-plan/SKILL.md +0 -102
  278. package/bundled/skills-windows/prizmkit-plan/assets/plan-template.md +0 -115
  279. package/bundled/skills-windows/prizmkit-plan/assets/spec-template.md +0 -73
  280. package/bundled/skills-windows/prizmkit-plan/references/clarify-guide.md +0 -67
  281. package/bundled/skills-windows/prizmkit-plan/references/examples.md +0 -85
  282. package/bundled/skills-windows/prizmkit-plan/references/verification-checklist.md +0 -60
  283. package/bundled/skills-windows/prizmkit-prizm-docs/SKILL.md +0 -129
  284. package/bundled/skills-windows/prizmkit-prizm-docs/assets/prizm-docs-format.md +0 -613
  285. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-init.md +0 -45
  286. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-rebuild.md +0 -15
  287. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-status.md +0 -14
  288. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-update.md +0 -19
  289. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-validate.md +0 -17
  290. package/bundled/skills-windows/prizmkit-retrospective/SKILL.md +0 -87
  291. package/bundled/skills-windows/prizmkit-retrospective/references/knowledge-injection-steps.md +0 -50
  292. package/bundled/skills-windows/prizmkit-retrospective/references/structural-sync-steps.md +0 -43
  293. package/bundled/skills-windows/prizmkit-test/SKILL.md +0 -227
  294. package/bundled/skills-windows/prizmkit-test/references/boundary-coverage-protocol.md +0 -220
  295. package/bundled/skills-windows/prizmkit-test/references/examples.md +0 -143
  296. package/bundled/skills-windows/prizmkit-test/references/service-boundary-test-catalog.md +0 -225
  297. package/bundled/skills-windows/prizmkit-test/references/test-generation-steps.md +0 -109
  298. package/bundled/skills-windows/prizmkit-test/references/test-report-template.md +0 -111
  299. package/bundled/skills-windows/prizmkit-test/scripts/validate_boundary_report.py +0 -347
  300. package/bundled/skills-windows/recovery-workflow/SKILL.md +0 -355
  301. package/bundled/skills-windows/recovery-workflow/evals/evals.json +0 -46
  302. package/bundled/skills-windows/recovery-workflow/references/detection.md +0 -58
  303. package/bundled/skills-windows/recovery-workflow/scripts/detect-recovery-state.py +0 -544
  304. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +0 -346
  305. package/bundled/skills-windows/refactor-pipeline-launcher/references/configuration.md +0 -72
  306. package/bundled/skills-windows/refactor-planner/SKILL.md +0 -398
  307. package/bundled/skills-windows/refactor-planner/assets/planning-guide.md +0 -292
  308. package/bundled/skills-windows/refactor-planner/references/behavior-preservation.md +0 -301
  309. package/bundled/skills-windows/refactor-planner/references/fast-path.md +0 -59
  310. package/bundled/skills-windows/refactor-planner/references/planning-phases.md +0 -135
  311. package/bundled/skills-windows/refactor-planner/references/refactor-scoping-guide.md +0 -221
  312. package/bundled/skills-windows/refactor-planner/scripts/validate-and-generate-refactor.py +0 -858
  313. package/bundled/skills-windows/refactor-workflow/SKILL.md +0 -343
  314. package/bundled/skills-windows/refactor-workflow/references/brainstorm-guide.md +0 -116
  315. package/bundled/templates/hooks/diff-prizm-docs.sh +0 -158
  316. package/bundled/templates/hooks/prizm-pre-commit.sh +0 -108
  317. package/bundled/templates/hooks/validate-prizm-docs.sh +0 -139
@@ -1,763 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Generate a session-specific bug fix bootstrap prompt from template and .prizmkit/plans/bug-fix-list.json.
3
-
4
- Reads the bugfix-bootstrap-prompt.md template and a .prizmkit/plans/bug-fix-list.json, resolves all
5
- {{PLACEHOLDER}} variables, handles conditional blocks, and writes the rendered
6
- prompt to the specified output path.
7
-
8
- Usage:
9
- python3 generate-bugfix-prompt.py \
10
- --bug-list <path> --bug-id <id> \
11
- --session-id <id> --run-id <id> \
12
- --retry-count <n> --resume-phase <n|null> \
13
- --state-dir <path> --output <path>
14
- """
15
-
16
- import argparse
17
- import json
18
- import os
19
- import re
20
- import sys
21
-
22
- from utils import enrich_global_context, load_json_file, read_platform_conventions, setup_logging
23
- from continuation import add_continuation_args, append_continuation_handoff, is_continuation
24
-
25
-
26
- DEFAULT_MAX_RETRIES = 3
27
- DEFAULT_MAX_LOG_SIZE = 2097152
28
-
29
- LOGGER = setup_logging("generate-bugfix-prompt")
30
-
31
-
32
- def parse_args():
33
- parser = argparse.ArgumentParser(
34
- description=(
35
- "Generate a session-specific bug fix bootstrap prompt from a template "
36
- "and .prizmkit/plans/bug-fix-list.json."
37
- )
38
- )
39
- parser.add_argument("--bug-list", required=True, help="Path to .prizmkit/plans/bug-fix-list.json")
40
- parser.add_argument("--bug-id", required=True, help="Bug ID to generate prompt for (e.g. B-001)")
41
- parser.add_argument("--session-id", required=True, help="Session ID for this pipeline session")
42
- parser.add_argument("--run-id", required=True, help="Pipeline run ID")
43
- parser.add_argument("--retry-count", required=True, help="Current retry count")
44
- parser.add_argument("--resume-phase", required=True, help='Phase to resume from, or "null" for fresh start')
45
- parser.add_argument("--state-dir", default=None, help="State directory (default: .prizmkit/state/bugfix)")
46
- parser.add_argument("--output", required=True, help="Output path for the rendered prompt")
47
- parser.add_argument("--template", default=None, help="Custom template path. Defaults to {script_dir}/../templates/bugfix-bootstrap-prompt.md")
48
- parser.add_argument("--mode", default=None, help="Pipeline execution mode override: lite, standard, full")
49
- parser.add_argument("--critic", default=None, help="Enable critic agent: true/false")
50
- parser.add_argument("--no-checkpoint", action="store_true", help="Do not write workflow-checkpoint.json (used by pipeline dry-run)")
51
- add_continuation_args(parser, "bugfix")
52
-
53
- return parser.parse_args()
54
-
55
-
56
- def read_text_file(path):
57
- """Read and return the text content of a file."""
58
- abs_path = os.path.abspath(path)
59
- if not os.path.isfile(abs_path):
60
- return None, "File not found: {}".format(abs_path)
61
- try:
62
- with open(abs_path, "r", encoding="utf-8") as f:
63
- return f.read(), None
64
- except IOError as e:
65
- return None, "Cannot read file: {}".format(str(e))
66
-
67
-
68
-
69
- def _format_bytes(n):
70
- """Format a byte count to a human-readable string."""
71
- if n >= 1048576:
72
- return "{}MB".format(n // 1048576)
73
- elif n >= 1024:
74
- return "{}KB".format(n // 1024)
75
- return "{}B".format(n)
76
-
77
-
78
- def _parse_non_negative_int_env(name, default):
79
- """Parse a non-negative integer environment variable."""
80
- value = os.environ.get(name, str(default))
81
- try:
82
- parsed = int(value)
83
- except ValueError:
84
- raise ValueError("{} must be a non-negative integer".format(name))
85
- if parsed < 0:
86
- raise ValueError("{} must be a non-negative integer".format(name))
87
- return parsed
88
-
89
-
90
- def _parse_positive_int_env(name, default):
91
- """Parse a positive integer environment variable."""
92
- value = os.environ.get(name, str(default))
93
- try:
94
- parsed = int(value)
95
- except ValueError:
96
- raise ValueError("{} must be a positive integer".format(name))
97
- if parsed <= 0:
98
- raise ValueError("{} must be a positive integer".format(name))
99
- return parsed
100
-
101
-
102
- def load_log_size_section(script_dir):
103
- """Load the optional log-size awareness prompt section."""
104
- max_log_size = _parse_non_negative_int_env("MAX_LOG_SIZE", DEFAULT_MAX_LOG_SIZE)
105
- if max_log_size == 0:
106
- return ""
107
-
108
- section_path = os.path.join(
109
- script_dir, "..", "templates", "sections", "log-size-awareness.md",
110
- )
111
- if not os.path.isfile(section_path):
112
- return ""
113
-
114
- content, err = read_text_file(section_path)
115
- if err:
116
- return ""
117
- return content
118
-
119
- def find_bug(bugs, bug_id):
120
- """Find and return the bug dict matching the given ID."""
121
- for bug in bugs:
122
- if isinstance(bug, dict) and bug.get("id") == bug_id:
123
- return bug
124
- return None
125
-
126
-
127
- def format_acceptance_criteria(criteria):
128
- """Format acceptance criteria as a markdown bullet list."""
129
- if not criteria:
130
- return "- (none specified)"
131
- lines = []
132
- for item in criteria:
133
- lines.append("- {}".format(item))
134
- return "\n".join(lines)
135
-
136
-
137
- def format_global_context(global_context, project_root=None):
138
- """Format global_context dict as a key-value list.
139
-
140
- If global_context is empty/sparse and project_root is provided,
141
- auto-detect tech stack from project files to fill gaps.
142
- """
143
- if project_root:
144
- enrich_global_context(global_context, project_root)
145
-
146
- if not global_context:
147
- return "- (none specified)"
148
- lines = []
149
- for key, value in sorted(global_context.items()):
150
- lines.append("- **{}**: {}".format(key, value))
151
- return "\n".join(lines)
152
-
153
-
154
- def format_error_source_details(error_source):
155
- """Format error_source fields into markdown detail lines."""
156
- if not error_source or not isinstance(error_source, dict):
157
- return "- (no error source details)"
158
- lines = []
159
- etype = error_source.get("type", "unknown")
160
-
161
- if etype == "stack_trace" and error_source.get("stack_trace"):
162
- lines.append("- **Stack Trace**:")
163
- lines.append("```")
164
- lines.append(error_source["stack_trace"])
165
- lines.append("```")
166
- if error_source.get("error_message"):
167
- lines.append("- **Error Message**: {}".format(error_source["error_message"]))
168
- if etype == "log_pattern" and error_source.get("log_snippet"):
169
- lines.append("- **Log Snippet**:")
170
- lines.append("```")
171
- lines.append(error_source["log_snippet"])
172
- lines.append("```")
173
- if etype == "failed_test" and error_source.get("failed_test_path"):
174
- lines.append("- **Failed Test**: `{}`".format(error_source["failed_test_path"]))
175
- if etype == "user_report" and error_source.get("reproduction_steps"):
176
- lines.append("- **Reproduction Steps**:")
177
- for i, step in enumerate(error_source["reproduction_steps"], 1):
178
- lines.append(" {}. {}".format(i, step))
179
-
180
- if not lines:
181
- lines.append("- (no additional details)")
182
- return "\n".join(lines)
183
-
184
-
185
- def format_user_context(user_context):
186
- """Format user_context array as a markdown section.
187
-
188
- Returns empty string if user_context is empty or absent,
189
- so the template placeholder resolves to nothing.
190
- """
191
- if not user_context or not isinstance(user_context, list):
192
- return ""
193
- items = [item for item in user_context if isinstance(item, str) and item.strip()]
194
- if not items:
195
- return ""
196
- lines = [
197
- "### User-Provided Context (HIGHEST PRIORITY)",
198
- "",
199
- "> The following materials were provided by the user. "
200
- "They take precedence over AI inference.",
201
- "",
202
- ]
203
- for item in items:
204
- lines.append("- {}".format(item))
205
- return "\n".join(lines)
206
-
207
-
208
- def format_environment(env):
209
- """Format environment dict as a key-value list."""
210
- if not env or not isinstance(env, dict):
211
- return "- (not specified)"
212
- lines = []
213
- for key, value in sorted(env.items()):
214
- if value:
215
- lines.append("- **{}**: {}".format(key, value))
216
- if not lines:
217
- return "- (not specified)"
218
- return "\n".join(lines)
219
-
220
-
221
- def get_prev_session_status(state_dir, bug_id):
222
- """Read previous session status from state dir if available."""
223
- if not state_dir:
224
- return "N/A (first run)"
225
-
226
- bug_status_path = os.path.join(state_dir, bug_id, "status.json")
227
- if not os.path.isfile(bug_status_path):
228
- return "N/A (first run)"
229
-
230
- try:
231
- with open(bug_status_path, "r", encoding="utf-8") as f:
232
- bug_status = json.load(f)
233
- except (json.JSONDecodeError, IOError):
234
- return "N/A (could not read bug status)"
235
-
236
- last_session_id = bug_status.get("last_session_id")
237
- if not last_session_id:
238
- return "N/A (first run)"
239
-
240
- session_status_path = os.path.join(state_dir, bug_id, "sessions",
241
- last_session_id, "session-status.json"
242
- )
243
- if not os.path.isfile(session_status_path):
244
- return "N/A (previous session status file not found)"
245
-
246
- try:
247
- with open(session_status_path, "r", encoding="utf-8") as f:
248
- session_data = json.load(f)
249
- except (json.JSONDecodeError, IOError):
250
- return "N/A (could not read previous session status)"
251
-
252
- status = session_data.get("status", "unknown")
253
- checkpoint = session_data.get("checkpoint_reached", "none")
254
- current_phase = session_data.get("current_phase", "unknown")
255
- errors = session_data.get("errors", [])
256
-
257
- result = "{} (checkpoint: {}, last phase: {})".format(
258
- status, checkpoint, current_phase
259
- )
260
- if errors:
261
- result += " — errors: {}".format("; ".join(str(e) for e in errors))
262
- return result
263
-
264
-
265
- def resolve_project_root(script_dir):
266
- """Resolve project root. Layout-aware:
267
- <project>/.prizmkit/dev-pipeline/scripts/ → <project>
268
- <repo>/dev-pipeline/scripts/ → <repo>
269
- """
270
- pipeline_dir = os.path.dirname(script_dir)
271
- pipeline_parent = os.path.dirname(pipeline_dir)
272
- if os.path.basename(pipeline_parent) == ".prizmkit":
273
- return os.path.abspath(os.path.dirname(pipeline_parent))
274
- return os.path.abspath(pipeline_parent)
275
-
276
-
277
- def build_replacements(args, bug, global_context, script_dir):
278
- """Build the full dict of placeholder -> replacement value."""
279
- project_root = resolve_project_root(script_dir)
280
-
281
- # Platform-aware agent/team path resolution
282
- platform = os.environ.get("PRIZMKIT_PLATFORM", "")
283
- home_dir = os.path.expanduser("~")
284
-
285
- if not platform:
286
- if os.path.isdir(os.path.join(project_root, ".codex", "agents")):
287
- platform = "codex"
288
- elif os.path.isdir(os.path.join(project_root, ".claude", "agents")):
289
- platform = "claude"
290
- else:
291
- platform = "codebuddy"
292
-
293
- if platform == "claude":
294
- agents_dir = os.path.join(project_root, ".claude", "agents")
295
- team_config_path = os.path.join(project_root, ".claude", "team-info.json")
296
- elif platform == "codex":
297
- agents_dir = os.path.join(project_root, ".codex", "agents")
298
- team_config_path = os.path.join(project_root, ".codex", "team-info.json")
299
- else:
300
- agents_dir = os.path.join(project_root, ".codebuddy", "agents")
301
- team_config_path = os.path.join(
302
- home_dir, ".codebuddy", "teams", "prizm-dev-team", "config.json"
303
- )
304
-
305
- agent_ext = ".toml" if platform == "codex" else ".md"
306
- dev_subagent = os.path.join(agents_dir, f"prizm-dev-team-dev{agent_ext}")
307
- reviewer_subagent = os.path.join(agents_dir, f"prizm-dev-team-reviewer{agent_ext}")
308
-
309
- # Session status path
310
- session_status_path = os.path.join(
311
- project_root, ".prizmkit", "state", "bugfix", args.bug_id,
312
- "sessions", args.session_id, "session-status.json"
313
- )
314
-
315
- # Error source
316
- error_source = bug.get("error_source", {})
317
- error_type = error_source.get("type", "unknown") if isinstance(error_source, dict) else "unknown"
318
-
319
- # Determine fix scope from affected_modules or title
320
- affected_modules = bug.get("affected_modules", [])
321
- if affected_modules:
322
- fix_scope = affected_modules[0]
323
- else:
324
- fix_scope = bug.get("title", "unknown").split()[0].lower() if bug.get("title") else "unknown"
325
-
326
- # Determine verification type
327
- vtype = bug.get("verification_type", "automated")
328
-
329
- # Browser interaction - extract from bug if present
330
- browser_interaction = bug.get("browser_interaction")
331
- browser_enabled = False
332
- browser_verify_steps = ""
333
- browser_tool = "auto"
334
-
335
- # Environment override
336
- browser_verify_env = os.environ.get("BROWSER_VERIFY", "").lower()
337
- if browser_verify_env == "false":
338
- browser_interaction = None
339
-
340
- # Extract browser config (same logic as feature pipeline)
341
- if browser_interaction and isinstance(browser_interaction, bool):
342
- browser_enabled = True
343
- browser_tool = "auto"
344
- browser_verify_steps = " # (no specific verify goals — reproduce the bug and verify it's fixed)"
345
- elif browser_interaction and isinstance(browser_interaction, dict):
346
- browser_tool = browser_interaction.get("tool", "auto")
347
- if browser_tool not in ("playwright-cli", "opencli", "auto"):
348
- LOGGER.warning("Unknown browser_interaction.tool '%s', defaulting to 'auto'", browser_tool)
349
- browser_tool = "auto"
350
-
351
- steps = browser_interaction.get("verify_steps", [])
352
- if steps:
353
- browser_enabled = True
354
- browser_verify_steps = "\n".join(
355
- " # Step {}: {}".format(i + 1, step)
356
- for i, step in enumerate(steps)
357
- )
358
- elif browser_interaction.get("url") or browser_interaction.get("enabled", True):
359
- browser_enabled = True
360
- browser_verify_steps = " # (reproduce bug and verify fix)"
361
-
362
- max_log_size = _parse_non_negative_int_env("MAX_LOG_SIZE", DEFAULT_MAX_LOG_SIZE)
363
-
364
- replacements = {
365
- "{{LOG_SIZE_AWARENESS}}": load_log_size_section(script_dir),
366
- "{{MAX_LOG_SIZE}}": str(max_log_size),
367
- "{{MAX_LOG_SIZE_HUMAN}}": _format_bytes(max_log_size),
368
- "{{SESSION_LOG_PATH}}": os.path.join(
369
- ".prizmkit", "state", "bugfix", args.bug_id,
370
- "sessions", args.session_id, "logs", "session.log",
371
- ),
372
- "{{RUN_ID}}": args.run_id,
373
- "{{SESSION_ID}}": args.session_id,
374
- "{{BUG_ID}}": args.bug_id,
375
- "{{BUG_TITLE}}": bug.get("title", ""),
376
- "{{SEVERITY}}": bug.get("severity", "medium"),
377
- "{{VERIFICATION_TYPE}}": vtype,
378
- "{{BUG_DESCRIPTION}}": bug.get("description", ""),
379
- "{{USER_CONTEXT}}": format_user_context(bug.get("user_context", [])),
380
- "{{ERROR_SOURCE_TYPE}}": error_type,
381
- "{{ERROR_SOURCE_DETAILS}}": format_error_source_details(error_source),
382
- "{{ACCEPTANCE_CRITERIA}}": format_acceptance_criteria(
383
- bug.get("acceptance_criteria", [])
384
- ),
385
- "{{ENVIRONMENT}}": format_environment(bug.get("environment")),
386
- "{{GLOBAL_CONTEXT}}": format_global_context(global_context, project_root),
387
- "{{PLATFORM_CONVENTIONS}}": read_platform_conventions(project_root),
388
- "{{TEAM_CONFIG_PATH}}": team_config_path,
389
- "{{DEV_SUBAGENT_PATH}}": dev_subagent,
390
- "{{REVIEWER_SUBAGENT_PATH}}": reviewer_subagent,
391
- "{{SESSION_STATUS_PATH}}": session_status_path,
392
- "{{PROJECT_ROOT}}": project_root,
393
- "{{PIPELINE_DIR}}": ".prizmkit\\dev-pipeline",
394
- "{{FIX_SCOPE}}": fix_scope,
395
- "{{TIMESTAMP}}": "", # Placeholder, agent fills in the timestamp
396
- "{{BROWSER_ENABLED}}": "true" if browser_enabled else "false",
397
- "{{BROWSER_TOOL}}": browser_tool,
398
- "{{BROWSER_VERIFY_STEPS}}": browser_verify_steps,
399
- }
400
-
401
- return replacements
402
-
403
-
404
- def process_conditional_blocks(content, bug):
405
- """Handle conditional blocks based on verification_type and browser_interaction."""
406
- # Handle verification type blocks
407
- vtype = bug.get("verification_type", "automated")
408
- is_manual_or_hybrid = vtype in ("manual", "hybrid")
409
-
410
- if is_manual_or_hybrid:
411
- content = content.replace("{{IF_VERIFICATION_MANUAL_OR_HYBRID}}\n", "")
412
- content = content.replace("{{IF_VERIFICATION_MANUAL_OR_HYBRID}}", "")
413
- content = content.replace("{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}\n", "")
414
- content = content.replace("{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}", "")
415
- else:
416
- # Remove the entire conditional block
417
- content = re.sub(
418
- r"\{\{IF_VERIFICATION_MANUAL_OR_HYBRID\}\}.*?\{\{END_IF_VERIFICATION_MANUAL_OR_HYBRID\}\}\n?",
419
- "", content, flags=re.DOTALL,
420
- )
421
-
422
- # Handle browser interaction blocks
423
- browser_interaction = bug.get("browser_interaction")
424
- browser_enabled = False
425
- browser_tool = "auto"
426
-
427
- # Check environment override
428
- browser_verify_env = os.environ.get("BROWSER_VERIFY", "").lower()
429
- if browser_verify_env == "false":
430
- browser_interaction = None
431
-
432
- # Determine if browser is enabled
433
- if browser_interaction:
434
- if isinstance(browser_interaction, bool):
435
- browser_enabled = True
436
- elif isinstance(browser_interaction, dict):
437
- steps = browser_interaction.get("verify_steps", [])
438
- if steps or browser_interaction.get("url") or browser_interaction.get("enabled", True):
439
- browser_enabled = True
440
- browser_tool = browser_interaction.get("tool", "auto")
441
-
442
- # Process browser interaction blocks
443
- browser_open = "{{IF_BROWSER_INTERACTION}}"
444
- browser_close = "{{END_IF_BROWSER_INTERACTION}}"
445
-
446
- if browser_enabled:
447
- # Keep content, remove tags
448
- content = content.replace(browser_open + "\n", "")
449
- content = content.replace(browser_open, "")
450
- content = content.replace(browser_close + "\n", "")
451
- content = content.replace(browser_close, "")
452
- else:
453
- # Remove entire block
454
- pattern = re.escape(browser_open) + r".*?" + re.escape(browser_close) + r"\n?"
455
- content = re.sub(pattern, "", content, flags=re.DOTALL)
456
-
457
- # Process browser tool selection blocks (nested inside browser interaction)
458
- tool_variants = ["PLAYWRIGHT", "OPENCLI", "AUTO"]
459
- active_variant = {
460
- "playwright-cli": "PLAYWRIGHT",
461
- "opencli": "OPENCLI",
462
- "auto": "AUTO",
463
- }.get(browser_tool, "AUTO")
464
-
465
- for variant in tool_variants:
466
- tool_open = "{{{{IF_BROWSER_TOOL_{}}}}}".format(variant)
467
- tool_close = "{{{{END_IF_BROWSER_TOOL_{}}}}}".format(variant)
468
-
469
- if variant == active_variant and browser_enabled:
470
- # Keep content, remove tags
471
- content = content.replace(tool_open + "\n", "")
472
- content = content.replace(tool_open, "")
473
- content = content.replace(tool_close + "\n", "")
474
- content = content.replace(tool_close, "")
475
- else:
476
- # Remove entire block
477
- pat = re.escape(tool_open) + r".*?" + re.escape(tool_close) + r"\n?"
478
- content = re.sub(pat, "", content, flags=re.DOTALL)
479
-
480
- return content
481
-
482
-
483
- def render_template(template_content, replacements, bug):
484
- """Render the template by processing conditionals and replacing placeholders."""
485
- # Step 1: Process conditional blocks
486
- content = process_conditional_blocks(template_content, bug)
487
-
488
- # Step 2: Replace all {{PLACEHOLDER}} variables (two passes for nested sections)
489
- for _pass in range(2):
490
- for placeholder, value in replacements.items():
491
- content = content.replace(placeholder, value)
492
-
493
- return content
494
-
495
-
496
- def write_output(output_path, content):
497
- """Write the rendered content to the output file."""
498
- abs_path = os.path.abspath(output_path)
499
- output_dir = os.path.dirname(abs_path)
500
- if output_dir and not os.path.isdir(output_dir):
501
- try:
502
- os.makedirs(output_dir, exist_ok=True)
503
- except OSError as e:
504
- return "Cannot create output directory: {}".format(str(e))
505
- try:
506
- with open(abs_path, "w", encoding="utf-8") as f:
507
- f.write(content)
508
- except IOError as e:
509
- return "Cannot write output file: {}".format(str(e))
510
- return None
511
-
512
-
513
- def emit_failure(message):
514
- """Emit standardized failure JSON and exit."""
515
- print(json.dumps({"success": False, "error": message}, indent=2, ensure_ascii=False))
516
- sys.exit(1)
517
-
518
-
519
- # ============================================================
520
- # Checkpoint generation for bugfix pipeline
521
- # ============================================================
522
-
523
- BUGFIX_STEPS = [
524
- ("prizmkit-init", "Initialize", []),
525
- ("bug-diagnosis-and-plan", "Diagnose & Plan",
526
- [".prizmkit/bugfix/{slug}/spec.md",
527
- ".prizmkit/bugfix/{slug}/plan.md"]),
528
- ("prizmkit-implement", "Implement Fix", []),
529
- ("prizmkit-code-review", "Code Review", []),
530
- ("prizmkit-committer", "Commit", ["--headless"]),
531
- ("bug-report", "Generate Fix Report",
532
- [".prizmkit/bugfix/{slug}/fix-report.md"]),
533
- ]
534
-
535
-
536
- def generate_bugfix_checkpoint(bug_id, session_id):
537
- """Generate a checkpoint definition for bugfix pipeline.
538
-
539
- Returns a dict suitable for writing as workflow-checkpoint.json.
540
- """
541
- steps = []
542
- prev_id = None
543
- for i, (skill, name, artifacts) in enumerate(BUGFIX_STEPS, 1):
544
- step_id = "S{:02d}".format(i)
545
- steps.append({
546
- "id": step_id,
547
- "skill": skill,
548
- "name": name,
549
- "status": "pending",
550
- "required_artifacts": [a.replace("{slug}", bug_id) for a in artifacts],
551
- "depends_on": prev_id,
552
- })
553
- prev_id = step_id
554
-
555
- return {
556
- "version": 1,
557
- "workflow_type": "bugfix-pipeline",
558
- "pipeline_mode": "single",
559
- "item_id": bug_id,
560
- "item_slug": bug_id,
561
- "session_id": session_id,
562
- "steps": steps,
563
- }
564
-
565
-
566
- def merge_bugfix_checkpoint_state(existing, fresh, project_root):
567
- """Merge existing bugfix checkpoint state into fresh definition.
568
-
569
- Same logic as feature pipeline: validate artifacts, break chain on
570
- first invalid step.
571
- """
572
- existing_status = {}
573
- existing_artifacts = {}
574
- for step in existing.get("steps", []):
575
- existing_status[step["skill"]] = step["status"]
576
- existing_artifacts[step["skill"]] = step.get("required_artifacts", [])
577
-
578
- valid_completed = set()
579
- for skill_key, status in existing_status.items():
580
- if status == "completed":
581
- artifacts = existing_artifacts.get(skill_key, [])
582
- if all(os.path.exists(os.path.join(project_root, a))
583
- for a in artifacts):
584
- valid_completed.add(skill_key)
585
- else:
586
- LOGGER.warning(
587
- "Step '%s' was completed but artifacts missing — "
588
- "resetting to pending", skill_key
589
- )
590
- elif status == "skipped":
591
- valid_completed.add(skill_key)
592
-
593
- chain_broken = False
594
- for step in fresh["steps"]:
595
- if chain_broken:
596
- step["status"] = "pending"
597
- continue
598
- prev = existing_status.get(step["skill"])
599
- if step["skill"] in valid_completed:
600
- step["status"] = prev
601
- else:
602
- chain_broken = True
603
- step["status"] = "pending"
604
-
605
- return fresh
606
-
607
-
608
- def main():
609
- args = parse_args()
610
-
611
- # Resolve script directory
612
- script_dir = os.path.dirname(os.path.abspath(__file__))
613
-
614
- # Resolve template path
615
- if args.template:
616
- template_path = args.template
617
- else:
618
- template_path = os.path.join(
619
- script_dir, "..", "templates", "bugfix-bootstrap-prompt.md"
620
- )
621
-
622
- # Load template
623
- template_content, err = read_text_file(template_path)
624
- if err:
625
- emit_failure("Template error: {}".format(err))
626
-
627
- # Load bug fix list
628
- bug_list_data, err = load_json_file(args.bug_list)
629
- if err:
630
- emit_failure("Bug list error: {}".format(err))
631
-
632
- # Extract bugs array
633
- bugs = bug_list_data.get("bugs")
634
- if not isinstance(bugs, list):
635
- emit_failure("Bug fix list does not contain a 'bugs' array")
636
-
637
- # Find the target bug
638
- bug = find_bug(bugs, args.bug_id)
639
- if bug is None:
640
- emit_failure("Bug '{}' not found in bug fix list".format(args.bug_id))
641
-
642
- # Extract global context
643
- global_context = bug_list_data.get("global_context", {})
644
- if not isinstance(global_context, dict):
645
- global_context = {}
646
-
647
- # Build replacements
648
- replacements = build_replacements(args, bug, global_context, script_dir)
649
- if is_continuation(args):
650
- replacements["{{LOG_SIZE_AWARENESS}}"] = ""
651
-
652
- # Add checkpoint path to replacements
653
- checkpoint_rel = os.path.join(
654
- ".prizmkit", "bugfix", args.bug_id, "workflow-checkpoint.json",
655
- )
656
- replacements["{{CHECKPOINT_PATH}}"] = checkpoint_rel
657
-
658
- # Render the template
659
- rendered = render_template(template_content, replacements, bug)
660
-
661
- # Write the output
662
- err = write_output(args.output, rendered)
663
- if err:
664
- emit_failure(err)
665
-
666
- # Generate checkpoint file
667
- project_root = resolve_project_root(script_dir)
668
- checkpoint_path = os.path.join(project_root, checkpoint_rel)
669
- checkpoint = {}
670
- if not args.no_checkpoint:
671
- checkpoint_dir = os.path.dirname(checkpoint_path)
672
- os.makedirs(checkpoint_dir, exist_ok=True)
673
-
674
- checkpoint = generate_bugfix_checkpoint(args.bug_id, args.session_id)
675
-
676
- is_resume = args.resume_phase != "null"
677
- if (is_resume or is_continuation(args)) and os.path.exists(checkpoint_path):
678
- try:
679
- with open(checkpoint_path, "r", encoding="utf-8") as f:
680
- existing = json.load(f)
681
- checkpoint = merge_bugfix_checkpoint_state(
682
- existing, checkpoint, project_root,
683
- )
684
- LOGGER.info("Merged existing bugfix checkpoint from %s",
685
- checkpoint_path)
686
- except (json.JSONDecodeError, KeyError) as exc:
687
- LOGGER.warning(
688
- "Existing bugfix checkpoint corrupted (%s) — generating fresh",
689
- exc,
690
- )
691
-
692
- with open(checkpoint_path, "w", encoding="utf-8") as f:
693
- json.dump(checkpoint, f, indent=2, ensure_ascii=False)
694
- LOGGER.info("Wrote bugfix checkpoint to %s", checkpoint_path)
695
-
696
- if is_continuation(args):
697
- rendered = append_continuation_handoff(
698
- rendered, args, project_root, args.task_type, args.bug_id,
699
- args.bug_id, checkpoint,
700
- )
701
- err = write_output(args.output, rendered)
702
- if err:
703
- emit_failure(err)
704
-
705
- # Resolve critic and mode
706
- bug_critic = bug.get("critic", False)
707
- if args.critic is not None:
708
- critic_enabled = str(args.critic).lower() == "true"
709
- else:
710
- critic_enabled = bool(bug_critic)
711
-
712
- pipeline_mode = args.mode or "standard"
713
- agent_count = 5 if critic_enabled else 3
714
-
715
- # Success
716
- bug_model = bug.get("model", "")
717
- # Extract browser interaction state for output
718
- browser_interaction = bug.get("browser_interaction")
719
- browser_enabled = False
720
- browser_tool = "auto"
721
-
722
- browser_verify_env = os.environ.get("BROWSER_VERIFY", "").lower()
723
- if browser_verify_env == "false":
724
- browser_interaction = None
725
-
726
- if browser_interaction:
727
- if isinstance(browser_interaction, bool):
728
- browser_enabled = True
729
- elif isinstance(browser_interaction, dict):
730
- steps = browser_interaction.get("verify_steps", [])
731
- if steps or browser_interaction.get("url") or browser_interaction.get("enabled", True):
732
- browser_enabled = True
733
- browser_tool = browser_interaction.get("tool", "auto")
734
- if browser_tool not in ("playwright-cli", "opencli", "auto"):
735
- browser_tool = "auto"
736
-
737
- output = {
738
- "success": True,
739
- "output_path": os.path.abspath(args.output),
740
- "checkpoint_path": checkpoint_path,
741
- "model": bug_model,
742
- "pipeline_mode": pipeline_mode,
743
- "agent_count": agent_count,
744
- "critic_enabled": critic_enabled,
745
- "browser_enabled": browser_enabled,
746
- "browser_tool": browser_tool
747
- }
748
- print(json.dumps(output, indent=2, ensure_ascii=False))
749
- sys.exit(0)
750
-
751
-
752
- if __name__ == "__main__":
753
- try:
754
- main()
755
- except KeyboardInterrupt:
756
- emit_failure("generate-bugfix-prompt interrupted")
757
- except ValueError as exc:
758
- emit_failure(str(exc))
759
- except SystemExit:
760
- raise
761
- except Exception as exc:
762
- LOGGER.exception("Unhandled exception in generate-bugfix-prompt")
763
- emit_failure("Unexpected error: {}".format(str(exc)))