prizmkit 1.1.99 → 1.1.101

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