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,829 +0,0 @@
1
- Set-StrictMode -Version 2.0
2
- $ErrorActionPreference = 'Stop'
3
-
4
- $script:PrizmAiProcess = $null
5
-
6
- function Initialize-PrizmLineLogBridgeType {
7
- if ('PrizmLineLogBridge' -as [type]) { return }
8
-
9
- Add-Type -TypeDefinition @'
10
- using System;
11
- using System.Diagnostics;
12
- using System.IO;
13
- using System.Text;
14
-
15
- public sealed class PrizmLineLogBridge : IDisposable
16
- {
17
- private readonly StreamWriter writer;
18
- private readonly object sync = new object();
19
- public readonly DataReceivedEventHandler Handler;
20
-
21
- public PrizmLineLogBridge(string logPath)
22
- {
23
- writer = new StreamWriter(logPath, false, new UTF8Encoding(false));
24
- Handler = new DataReceivedEventHandler(OnDataReceived);
25
- }
26
-
27
- private void OnDataReceived(object sender, DataReceivedEventArgs eventArgs)
28
- {
29
- if (eventArgs.Data == null) return;
30
- lock (sync)
31
- {
32
- writer.WriteLine(eventArgs.Data);
33
- writer.Flush();
34
- }
35
- }
36
-
37
- public void Dispose()
38
- {
39
- lock (sync)
40
- {
41
- writer.Flush();
42
- writer.Dispose();
43
- }
44
- }
45
- }
46
- '@
47
- }
48
-
49
- function Write-PrizmInfo { param([string]$Message) Write-Host "[INFO] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $Message" -ForegroundColor Blue }
50
- function Write-PrizmWarn { param([string]$Message) Write-Host "[WARN] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $Message" -ForegroundColor Yellow }
51
- function Write-PrizmError { param([string]$Message) Write-Host "[ERROR] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $Message" -ForegroundColor Red }
52
- function Write-PrizmSuccess { param([string]$Message) Write-Host "[SUCCESS] $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') $Message" -ForegroundColor Green }
53
-
54
- function Get-PrizmHiddenToolWorktreeExcludes {
55
- return @(
56
- ':(top,exclude,glob).*/worktree',
57
- ':(top,exclude,glob).*/worktree/**',
58
- ':(top,exclude,glob).*/worktrees',
59
- ':(top,exclude,glob).*/worktrees/**'
60
- )
61
- }
62
-
63
- function Initialize-PrizmPaths {
64
- param([string]$ScriptRoot)
65
- $pipelineDir = Resolve-Path $ScriptRoot
66
- $pipelineParent = Split-Path $pipelineDir -Parent
67
- if ((Split-Path $pipelineParent -Leaf) -eq '.prizmkit') {
68
- $prizmkitDir = $pipelineParent
69
- $projectRoot = Split-Path $pipelineParent -Parent
70
- } else {
71
- $projectRoot = Split-Path $pipelineDir -Parent
72
- $prizmkitDir = Join-Path $projectRoot '.prizmkit'
73
- }
74
- [pscustomobject]@{
75
- PipelineDir = $pipelineDir.Path
76
- PrizmkitDir = $prizmkitDir
77
- ProjectRoot = $projectRoot
78
- ScriptsDir = Join-Path $pipelineDir.Path 'scripts'
79
- TemplatesDir = Join-Path $pipelineDir.Path 'templates'
80
- }
81
- }
82
-
83
- function Import-PrizmEnv {
84
- param([string]$EnvPath)
85
- if (-not (Test-Path $EnvPath)) { return }
86
- foreach ($line in Get-Content $EnvPath) {
87
- $trimmed = $line.Trim()
88
- if (-not $trimmed -or $trimmed.StartsWith('#')) { continue }
89
- $idx = $trimmed.IndexOf('=')
90
- if ($idx -lt 1) { continue }
91
- $key = $trimmed.Substring(0, $idx).Trim()
92
- $rawValue = $trimmed.Substring($idx + 1).Trim()
93
- $valueBuilder = [System.Text.StringBuilder]::new()
94
- $inSingleQuote = $false
95
- $inDoubleQuote = $false
96
- for ($i = 0; $i -lt $rawValue.Length; $i++) {
97
- $char = $rawValue[$i]
98
- if ($char -eq "'" -and -not $inDoubleQuote) { $inSingleQuote = -not $inSingleQuote }
99
- if ($char -eq '"' -and -not $inSingleQuote) { $inDoubleQuote = -not $inDoubleQuote }
100
- if ($char -eq '#' -and -not $inSingleQuote -and -not $inDoubleQuote) { break }
101
- [void]$valueBuilder.Append($char)
102
- }
103
- $value = $valueBuilder.ToString().Trim().Trim('"').Trim("'")
104
- if (-not [Environment]::GetEnvironmentVariable($key, 'Process')) {
105
- [Environment]::SetEnvironmentVariable($key, $value, 'Process')
106
- }
107
- }
108
- }
109
-
110
- function Resolve-PrizmPython {
111
- $python = Get-Command python -ErrorAction SilentlyContinue
112
- if ($python) {
113
- & $python.Source -c 'import sys; raise SystemExit(0 if sys.version_info[0] == 3 else 1)' *> $null
114
- if ($LASTEXITCODE -eq 0) { return @($python.Source) }
115
- }
116
- $py = Get-Command py -ErrorAction SilentlyContinue
117
- if ($py) {
118
- & $py.Source -3 -c 'import sys; raise SystemExit(0 if sys.version_info[0] == 3 else 1)' *> $null
119
- if ($LASTEXITCODE -eq 0) { return @($py.Source, '-3') }
120
- }
121
- throw 'Python 3 is required. Install Python and ensure python or py is in PATH.'
122
- }
123
-
124
- function Resolve-PrizmPowerShellHost {
125
- $pwsh = Get-Command pwsh -ErrorAction SilentlyContinue
126
- if ($pwsh) { return $pwsh.Source }
127
- $powershell = Get-Command powershell -ErrorAction SilentlyContinue
128
- if ($powershell) { return $powershell.Source }
129
- throw 'PowerShell host not found. Install PowerShell or ensure powershell.exe is in PATH.'
130
- }
131
-
132
- function Invoke-PrizmPythonOutput {
133
- param([string[]]$PythonCommand, [string[]]$Arguments)
134
- $cmd = $PythonCommand[0]
135
- $prefix = @()
136
- if ($PythonCommand.Count -gt 1) { $prefix = $PythonCommand[1..($PythonCommand.Count - 1)] }
137
- $output = & $cmd @prefix @Arguments
138
- if ($LASTEXITCODE -ne 0) { throw "Python command failed: $($Arguments -join ' ')" }
139
- if (-not $output) { return '' }
140
- return ($output -join "`n")
141
- }
142
-
143
- function Invoke-PrizmPythonJson {
144
- param([string[]]$PythonCommand, [string[]]$Arguments)
145
- $text = Invoke-PrizmPythonOutput $PythonCommand $Arguments
146
- if (-not $text) { return $null }
147
- return $text | ConvertFrom-Json
148
- }
149
-
150
- function Invoke-PrizmPythonText {
151
- param([string[]]$PythonCommand, [string[]]$Arguments)
152
- $cmd = $PythonCommand[0]
153
- $prefix = @()
154
- if ($PythonCommand.Count -gt 1) { $prefix = $PythonCommand[1..($PythonCommand.Count - 1)] }
155
- & $cmd @prefix @Arguments
156
- if ($LASTEXITCODE -ne 0) { throw "Python command failed: $($Arguments -join ' ')" }
157
- }
158
-
159
- function Test-PrizmInfraError {
160
- param([string]$SessionLog, [string]$ProgressJson)
161
- $parts = @()
162
- if ($SessionLog -and (Test-Path $SessionLog)) {
163
- try {
164
- $text = Get-Content $SessionLog -Raw -ErrorAction Stop
165
- if ($text.Length -gt 65536) { $text = $text.Substring($text.Length - 65536) }
166
- $parts += $text
167
- } catch {}
168
- }
169
- if ($ProgressJson -and (Test-Path $ProgressJson)) {
170
- try { $parts += (Get-Content $ProgressJson -Raw -ErrorAction Stop) } catch {}
171
- }
172
- if ($parts.Count -eq 0) { return $false }
173
-
174
- $haystack = $parts -join "`n"
175
- return ($haystack -match '(?i)auth_unavailable|no auth available|502 Bad Gateway|503 Service Unavailable|504 Gateway Timeout|gateway timeout|upstream (connect )?error|connection reset|ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|rate limit|rate_limit|temporarily unavailable|overloaded')
176
- }
177
-
178
- function Test-PrizmAiRuntimeError {
179
- param([string]$SessionLog, [string]$ProgressJson)
180
-
181
- if ($ProgressJson -and (Test-Path $ProgressJson)) {
182
- try {
183
- $progress = Get-Content $ProgressJson -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop
184
- if ($progress.PSObject.Properties['fatal_error_code'] -and $progress.fatal_error_code) {
185
- return $true
186
- }
187
- } catch {}
188
- }
189
-
190
- $parts = @()
191
- if ($SessionLog -and (Test-Path $SessionLog)) {
192
- try {
193
- $text = Get-Content $SessionLog -Raw -ErrorAction Stop
194
- if ($text.Length -gt 65536) { $text = $text.Substring($text.Length - 65536) }
195
- $parts += $text
196
- } catch {}
197
- }
198
- if ($ProgressJson -and (Test-Path $ProgressJson)) {
199
- try { $parts += (Get-Content $ProgressJson -Raw -ErrorAction Stop) } catch {}
200
- }
201
- if ($parts.Count -eq 0) { return $false }
202
-
203
- $haystack = $parts -join "`n"
204
- $contextPattern = '(?i)context_too_large|model_context_window_exceeded|input exceeds the context window|context window of this model|context window (was )?exceeded|exceeded (the )?context window|invalid_request_error.*context window|context window.*invalid_request_error'
205
- $errorPattern = '(?i)api error|invalid_request_error|api_error_status|api_error_code|status\s*[:=]?\s*(400|413)|last_result_is_error\s*["'':=]?\s*true|is_error\s*["'':=]?\s*true'
206
- if (($haystack -match $contextPattern) -and ($haystack -match $errorPattern)) { return $true }
207
- return $false
208
- }
209
-
210
- function Get-PrizmProgressFatalErrorCode {
211
- param([string]$ProgressFile)
212
- if (-not (Test-Path $ProgressFile)) { return '' }
213
- try {
214
- $progress = Get-Content $ProgressFile -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop
215
- if ($progress.PSObject.Properties['fatal_error_code'] -and $progress.fatal_error_code) {
216
- return [string]$progress.fatal_error_code
217
- }
218
- } catch {}
219
- return ''
220
- }
221
-
222
- function Write-PrizmFatalErrorMarker {
223
- param([string]$MarkerPath, [string]$FatalErrorCode, [int]$StaleSeconds, [int]$Threshold)
224
- $markerDir = Split-Path $MarkerPath -Parent
225
- if ($markerDir) { New-Item -ItemType Directory -Force -Path $markerDir | Out-Null }
226
- [ordered]@{
227
- killed_at = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ')
228
- reason = $FatalErrorCode
229
- fatal_error_code = $FatalErrorCode
230
- stale_seconds = $StaleSeconds
231
- threshold = $Threshold
232
- } | ConvertTo-Json -Compress | Set-Content -Path $MarkerPath -Encoding UTF8
233
- }
234
-
235
- function Get-PrizmConfigValue {
236
- param([string]$ConfigPath, [string]$Key)
237
- if (-not (Test-Path $ConfigPath)) { return $null }
238
- try {
239
- $json = Get-Content $ConfigPath -Raw | ConvertFrom-Json
240
- return $json.$Key
241
- } catch { return $null }
242
- }
243
-
244
- function Split-PrizmCommandLine {
245
- param([string]$CommandLine)
246
- $trimmed = if ($CommandLine) { $CommandLine.Trim() } else { '' }
247
- if (-not $trimmed) { throw 'AI CLI command is empty.' }
248
- if (Test-Path $trimmed) {
249
- return [pscustomobject]@{ Command = $trimmed; Arguments = '' }
250
- }
251
- if ($trimmed -match '^"([^"]+)"\s*(.*)$') {
252
- return [pscustomobject]@{ Command = $matches[1]; Arguments = $matches[2].Trim() }
253
- }
254
- if ($trimmed -match "^'([^']+)'\s*(.*)$") {
255
- return [pscustomobject]@{ Command = $matches[1]; Arguments = $matches[2].Trim() }
256
- }
257
- if ($trimmed -match '^(\S+)\s*(.*)$') {
258
- return [pscustomobject]@{ Command = $matches[1]; Arguments = $matches[2].Trim() }
259
- }
260
- throw "Unable to parse AI CLI command: $CommandLine"
261
- }
262
-
263
- function Resolve-PrizmExecutableShim {
264
- param([string]$Source)
265
- if (-not $Source) { return $Source }
266
-
267
- $extension = [System.IO.Path]::GetExtension($Source).ToLowerInvariant()
268
- if ($extension -ne '.ps1') { return $Source }
269
-
270
- $directory = [System.IO.Path]::GetDirectoryName($Source)
271
- $baseName = [System.IO.Path]::GetFileNameWithoutExtension($Source)
272
- if (-not $directory -or -not $baseName) { return $Source }
273
-
274
- foreach ($candidateExtension in @('.cmd', '.bat', '.exe')) {
275
- $candidate = Join-Path $directory ($baseName + $candidateExtension)
276
- if (Test-Path $candidate) { return $candidate }
277
- }
278
-
279
- return $Source
280
- }
281
-
282
- function Resolve-PrizmCommandLine {
283
- param([string]$CommandLine)
284
- $parsed = Split-PrizmCommandLine $CommandLine
285
- $command = @(Get-Command $parsed.Command -ErrorAction SilentlyContinue)[0]
286
- if (-not $command) { return $CommandLine }
287
- $source = if ($command.Source) { $command.Source } else { $command.Definition }
288
- if (-not $source) { return $CommandLine }
289
- $source = Resolve-PrizmExecutableShim $source
290
- if ($source -match '\s') { $source = '"' + $source + '"' }
291
- if ($parsed.Arguments) {
292
- return "$source $($parsed.Arguments)"
293
- }
294
- return $source
295
- }
296
-
297
- function Get-PrizmCliNamesForPlatform {
298
- param([string]$Platform)
299
- $normalized = if ($Platform) { $Platform.ToLowerInvariant() } else { '' }
300
- switch ($normalized) {
301
- 'codex' { return @('codex') }
302
- 'claude' { return @('claude') }
303
- 'codebuddy' { return @('cbc') }
304
- 'both' { return @('claude', 'cbc') }
305
- 'all' { return @('codex', 'claude', 'cbc') }
306
- default { return @() }
307
- }
308
- }
309
-
310
- function Resolve-PrizmCliName {
311
- param([string]$CliName)
312
- if ($CliName -eq 'cbc' -and $env:CODEBUDDY_CLI) {
313
- return Resolve-PrizmCommandLine $env:CODEBUDDY_CLI
314
- }
315
- if (Get-Command $CliName -ErrorAction SilentlyContinue) {
316
- return Resolve-PrizmCommandLine $CliName
317
- }
318
- return ''
319
- }
320
-
321
- function Resolve-PrizmCliForPlatform {
322
- param([string]$Platform)
323
- foreach ($candidate in (Get-PrizmCliNamesForPlatform $Platform)) {
324
- $cli = Resolve-PrizmCliName $candidate
325
- if ($cli) { return $cli }
326
- }
327
- return ''
328
- }
329
-
330
- function Resolve-PrizmCliForPlatformRequirement {
331
- param([string]$Platform, [string]$Source)
332
- $expectedCliNames = @(Get-PrizmCliNamesForPlatform $Platform)
333
- if ($expectedCliNames.Count -eq 0) { return '' }
334
- $cli = Resolve-PrizmCliForPlatform $Platform
335
- if ($cli) { return $cli }
336
- $expectedCliText = $expectedCliNames -join ', '
337
- throw "$Source PrizmKit platform '$Platform' requires one of: $expectedCliText. Install it or set AI_CLI."
338
- }
339
-
340
- function Resolve-PrizmAiCli {
341
- param([string]$ProjectRoot, [string]$PrizmkitDir)
342
- Import-PrizmEnv (Join-Path $PrizmkitDir '.env')
343
- if ($env:AI_CLI) { return Resolve-PrizmCommandLine $env:AI_CLI }
344
- $configured = Get-PrizmConfigValue (Join-Path $PrizmkitDir 'config.json') 'ai_cli'
345
- if ($configured) { return Resolve-PrizmCommandLine $configured }
346
-
347
- $manifestPlatform = Get-PrizmConfigValue (Join-Path $PrizmkitDir 'manifest.json') 'platform'
348
- if ($manifestPlatform) {
349
- $manifestCli = Resolve-PrizmCliForPlatformRequirement ([string]$manifestPlatform) 'Installed'
350
- if ($manifestCli) { return $manifestCli }
351
- }
352
-
353
- $configuredPlatform = Get-PrizmConfigValue (Join-Path $PrizmkitDir 'config.json') 'platform'
354
- if ($configuredPlatform) {
355
- $configuredPlatformCli = Resolve-PrizmCliForPlatformRequirement ([string]$configuredPlatform) 'Configured'
356
- if ($configuredPlatformCli) { return $configuredPlatformCli }
357
- }
358
-
359
- if ($env:CODEBUDDY_CLI) { return Resolve-PrizmCommandLine $env:CODEBUDDY_CLI }
360
-
361
- if (((Test-Path (Join-Path $ProjectRoot '.codex\agents\prizm-dev-team-dev.toml')) -or (Test-Path (Join-Path $ProjectRoot '.agents\skills\prizm-kit\SKILL.md'))) -and (Get-Command codex -ErrorAction SilentlyContinue)) { return Resolve-PrizmCommandLine 'codex' }
362
- if ((Test-Path (Join-Path $ProjectRoot '.claude\commands\prizm-kit.md')) -and (Get-Command claude -ErrorAction SilentlyContinue)) { return Resolve-PrizmCommandLine 'claude' }
363
- if (((Test-Path (Join-Path $ProjectRoot '.codebuddy\agents\prizm-dev-team-dev.md')) -or (Test-Path (Join-Path $ProjectRoot '.codebuddy\skills\prizm-kit\SKILL.md'))) -and (Resolve-PrizmCliName 'cbc')) { return Resolve-PrizmCliName 'cbc' }
364
- foreach ($candidate in @('codex', 'claude', 'cbc')) {
365
- $cli = Resolve-PrizmCliName $candidate
366
- if ($cli) { return $cli }
367
- }
368
- throw 'No AI CLI found. Install Codex (codex), Claude Code (claude), or CodeBuddy (cbc), or set AI_CLI.'
369
- }
370
-
371
- function Get-PrizmConcretePlatform {
372
- param([string]$Platform)
373
- $normalized = if ($Platform) { $Platform.ToLowerInvariant() } else { '' }
374
- if (@('codex', 'claude', 'codebuddy') -contains $normalized) { return $normalized }
375
- return ''
376
- }
377
-
378
- function Get-PrizmKnownPlatformFromCli {
379
- param([string]$CliCommand)
380
- $parsed = Split-PrizmCommandLine $CliCommand
381
- $cliName = [System.IO.Path]::GetFileNameWithoutExtension($parsed.Command).ToLowerInvariant()
382
- if ($cliName -match 'claude') { return 'claude' }
383
- if ($cliName -match 'codex') { return 'codex' }
384
- if ($cliName -match 'cbc|codebuddy') { return 'codebuddy' }
385
- return ''
386
- }
387
-
388
- function ConvertTo-PrizmProcessArgument {
389
- param([string]$Argument)
390
- if ($Argument -eq $null) { return '""' }
391
- if ($Argument -notmatch '[\s"]') { return $Argument }
392
- return '"' + ($Argument -replace '"', '\"') + '"'
393
- }
394
-
395
- function Join-PrizmProcessArguments {
396
- param([string[]]$Arguments)
397
- return (($Arguments | ForEach-Object { ConvertTo-PrizmProcessArgument $_ }) -join ' ')
398
- }
399
-
400
- function Get-PrizmPlatformFromCli {
401
- param([string]$CliCommand)
402
- $platform = Get-PrizmKnownPlatformFromCli $CliCommand
403
- if ($platform) { return $platform }
404
- return 'codebuddy'
405
- }
406
-
407
- function Get-PrizmPlatformFromProject {
408
- param([string]$ProjectRoot, [string]$PrizmkitDir, [string]$CliCommand)
409
- $cliPlatform = Get-PrizmKnownPlatformFromCli $CliCommand
410
- if ($cliPlatform) { return $cliPlatform }
411
- $envPlatform = Get-PrizmConcretePlatform $env:PRIZMKIT_PLATFORM
412
- if ($envPlatform) { return $envPlatform }
413
- $manifestPlatform = Get-PrizmConcretePlatform (Get-PrizmConfigValue (Join-Path $PrizmkitDir 'manifest.json') 'platform')
414
- if ($manifestPlatform) { return $manifestPlatform }
415
- $configuredPlatform = Get-PrizmConcretePlatform (Get-PrizmConfigValue (Join-Path $PrizmkitDir 'config.json') 'platform')
416
- if ($configuredPlatform) { return $configuredPlatform }
417
- return Get-PrizmPlatformFromCli $CliCommand
418
- }
419
-
420
- function Get-PrizmSessionPlatform {
421
- param([string]$CliCommand)
422
- $cliPlatform = Get-PrizmKnownPlatformFromCli $CliCommand
423
- if ($cliPlatform) { return $cliPlatform }
424
- $platform = Get-PrizmConcretePlatform $env:PRIZMKIT_PLATFORM
425
- if ($platform) { return $platform }
426
- return Get-PrizmPlatformFromCli $CliCommand
427
- }
428
-
429
- function Get-PrizmCodexSubagentTimeoutSeconds {
430
- $configuredTimeout = 0
431
- if ([int]::TryParse($env:CODEX_SUBAGENT_TIMEOUT_SECONDS, [ref]$configuredTimeout) -and $configuredTimeout -gt 0) {
432
- return $configuredTimeout
433
- }
434
-
435
- $waitThreshold = 0
436
- $waitThresholdText = if ($env:CODEX_WAIT_STALE_KILL_THRESHOLD) { $env:CODEX_WAIT_STALE_KILL_THRESHOLD } else { '3600' }
437
- if ([int]::TryParse($waitThresholdText, [ref]$waitThreshold) -and $waitThreshold -gt 600) {
438
- return ($waitThreshold - 300)
439
- }
440
-
441
- return 3300
442
- }
443
-
444
- function Get-PrizmEffectiveStaleKillThreshold {
445
- param(
446
- [string]$ProgressFile,
447
- [int]$BaseThreshold
448
- )
449
-
450
- if ($BaseThreshold -le 0) { return $BaseThreshold }
451
- if (-not (Test-Path $ProgressFile)) { return $BaseThreshold }
452
-
453
- try {
454
- $progress = Get-Content $ProgressFile -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop
455
- } catch {
456
- return $BaseThreshold
457
- }
458
-
459
- $spawnCount = 0
460
- if ($progress.event_format -eq 'codex-json' -and $progress.current_tool -eq 'wait' -and $progress.tool_calls) {
461
- foreach ($tool in @($progress.tool_calls)) {
462
- if ($tool.name -eq 'spawn_agent') {
463
- $count = 0
464
- if ([int]::TryParse([string]$tool.count, [ref]$count)) { $spawnCount += $count }
465
- }
466
- }
467
- }
468
-
469
- if ($spawnCount -le 0) { return $BaseThreshold }
470
-
471
- $waitThreshold = 0
472
- if ([int]::TryParse($env:CODEX_WAIT_STALE_KILL_THRESHOLD, [ref]$waitThreshold) -and $waitThreshold -gt $BaseThreshold) {
473
- return $waitThreshold
474
- }
475
-
476
- return [Math]::Max($BaseThreshold * 4, 3600)
477
- }
478
-
479
- function Get-PrizmProgressActivity {
480
- param([string]$ProgressFile)
481
-
482
- $empty = [pscustomobject]@{
483
- ChildSignature = ''
484
- ChildTotalBytes = 0
485
- ChildSessionCount = 0
486
- ProgressSignature = ''
487
- }
488
- if (-not (Test-Path $ProgressFile)) { return $empty }
489
-
490
- try {
491
- $progress = Get-Content $ProgressFile -Raw -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop
492
- } catch {
493
- return $empty
494
- }
495
-
496
- $childSignature = ''
497
- if ($progress.PSObject.Properties['child_activity_signature'] -and $progress.child_activity_signature) {
498
- $childSignature = [string]$progress.child_activity_signature
499
- }
500
-
501
- $childTotalBytes = [int64]0
502
- if ($progress.PSObject.Properties['child_total_bytes']) {
503
- [int64]::TryParse([string]$progress.child_total_bytes, [ref]$childTotalBytes) | Out-Null
504
- }
505
-
506
- $childSessionCount = 0
507
- if ($progress.PSObject.Properties['child_session_files'] -and $progress.child_session_files) {
508
- $childSessionCount = @($progress.child_session_files).Count
509
- }
510
-
511
- $messageCount = 0
512
- if ($progress.PSObject.Properties['message_count']) {
513
- [int]::TryParse([string]$progress.message_count, [ref]$messageCount) | Out-Null
514
- }
515
- $totalToolCalls = 0
516
- if ($progress.PSObject.Properties['total_tool_calls']) {
517
- [int]::TryParse([string]$progress.total_tool_calls, [ref]$totalToolCalls) | Out-Null
518
- }
519
- $activeSubagentCount = 0
520
- if ($progress.PSObject.Properties['active_subagent_count']) {
521
- [int]::TryParse([string]$progress.active_subagent_count, [ref]$activeSubagentCount) | Out-Null
522
- }
523
- $subagentSpawnCount = 0
524
- if ($progress.PSObject.Properties['subagent_spawn_count']) {
525
- [int]::TryParse([string]$progress.subagent_spawn_count, [ref]$subagentSpawnCount) | Out-Null
526
- }
527
- $currentPhase = if ($progress.PSObject.Properties['current_phase'] -and $progress.current_phase) { [string]$progress.current_phase } else { '' }
528
- $currentTool = if ($progress.PSObject.Properties['current_tool'] -and $progress.current_tool) { [string]$progress.current_tool } else { '' }
529
- $fatalErrorCode = if ($progress.PSObject.Properties['fatal_error_code'] -and $progress.fatal_error_code) { [string]$progress.fatal_error_code } else { '' }
530
- $terminalResultText = if ($progress.PSObject.Properties['terminal_result_text'] -and $progress.terminal_result_text) { [string]$progress.terminal_result_text } else { '' }
531
-
532
- $progressSignature = @(
533
- $currentPhase,
534
- $currentTool,
535
- $messageCount,
536
- $totalToolCalls,
537
- $activeSubagentCount,
538
- $subagentSpawnCount,
539
- $childSignature,
540
- $childTotalBytes,
541
- $childSessionCount,
542
- $fatalErrorCode,
543
- $terminalResultText
544
- ) | ConvertTo-Json -Compress
545
-
546
- return [pscustomobject]@{
547
- ChildSignature = $childSignature
548
- ChildTotalBytes = $childTotalBytes
549
- ChildSessionCount = $childSessionCount
550
- ProgressSignature = $progressSignature
551
- }
552
- }
553
-
554
- function Get-PrizmProgressChildActivity {
555
- param([string]$ProgressFile)
556
-
557
- $activity = Get-PrizmProgressActivity -ProgressFile $ProgressFile
558
- return [pscustomobject]@{
559
- Signature = $activity.ChildSignature
560
- TotalBytes = $activity.ChildTotalBytes
561
- SessionCount = $activity.ChildSessionCount
562
- }
563
- }
564
-
565
- function Test-PrizmCodexJsonSupport {
566
- param([string]$CliExecutable)
567
- try {
568
- $helpOutput = & $CliExecutable exec --help 2>&1
569
- return (($helpOutput -join "`n") -match '--json')
570
- } catch {
571
- return $false
572
- }
573
- }
574
-
575
- function Test-PrizmStreamJsonSupport {
576
- param([string]$CliCommand)
577
- $sessionPlatform = Get-PrizmSessionPlatform $CliCommand
578
- $parsedCli = Split-PrizmCommandLine $CliCommand
579
-
580
- if ($sessionPlatform -eq 'codebuddy') { return $true }
581
- if ($sessionPlatform -eq 'codex') { return (Test-PrizmCodexJsonSupport $parsedCli.Command) }
582
-
583
- try {
584
- $helpOutput = & $parsedCli.Command --help 2>&1
585
- return (($helpOutput -join "`n") -match 'stream-json')
586
- } catch {
587
- return $false
588
- }
589
- }
590
-
591
- function Test-PrizmEffort {
592
- param([string]$CliCommand)
593
- if ([string]::IsNullOrEmpty($env:PRIZMKIT_EFFORT)) { return }
594
-
595
- $sessionPlatform = Get-PrizmSessionPlatform $CliCommand
596
- $valid = @{
597
- claude = @('low', 'medium', 'high', 'xhigh', 'max')
598
- codex = @('low', 'medium', 'high', 'xhigh')
599
- codebuddy = @('low', 'medium', 'high', 'xhigh')
600
- }
601
-
602
- $allowed = $valid[$sessionPlatform]
603
- if ($env:PRIZMKIT_EFFORT -notin $allowed) {
604
- Write-Host "ERROR: PRIZMKIT_EFFORT='$env:PRIZMKIT_EFFORT' is not supported by the detected CLI ($sessionPlatform)." -ForegroundColor Red
605
- Write-Host " Supported values for $($sessionPlatform): $($allowed -join ', ')" -ForegroundColor Red
606
- Write-Host " Set `$env:PRIZMKIT_EFFORT to one of the above, or unset it to use the CLI default." -ForegroundColor Red
607
- exit 1
608
- }
609
- }
610
-
611
- function Start-PrizmProgressParser {
612
- param(
613
- [string[]]$PythonCommand,
614
- [string]$ScriptsDir,
615
- [string]$SessionLog,
616
- [string]$ProgressFile,
617
- [string]$CliCommand
618
- )
619
-
620
- if (-not (Test-PrizmStreamJsonSupport $CliCommand)) { return $null }
621
-
622
- $parserScript = Join-Path $ScriptsDir 'parse-stream-progress.py'
623
- if (-not (Test-Path $parserScript)) { return $null }
624
-
625
- $cmd = $PythonCommand[0]
626
- $prefix = @()
627
- if ($PythonCommand.Count -gt 1) { $prefix = $PythonCommand[1..($PythonCommand.Count - 1)] }
628
-
629
- $progressDir = Split-Path $ProgressFile -Parent
630
- if ($progressDir) { New-Item -ItemType Directory -Force -Path $progressDir | Out-Null }
631
-
632
- $psi = [System.Diagnostics.ProcessStartInfo]::new()
633
- $psi.UseShellExecute = $false
634
- $psi.CreateNoWindow = $true
635
- $psi.FileName = $cmd
636
- $psi.Arguments = Join-PrizmProcessArguments ($prefix + @($parserScript, '--session-log', $SessionLog, '--progress-file', $ProgressFile))
637
- return [System.Diagnostics.Process]::Start($psi)
638
- }
639
-
640
- function Stop-PrizmProgressParser {
641
- param($Process)
642
- if ($Process -eq $null) { return }
643
- try {
644
- if (-not $Process.HasExited) {
645
- try {
646
- $Process.Kill($true)
647
- } catch {
648
- Stop-PrizmProcessTreeById -ProcessId ([int]$Process.Id)
649
- }
650
- }
651
- } catch {}
652
- }
653
-
654
- function Stop-PrizmProcessTreeById {
655
- param([int]$ProcessId)
656
- if ($ProcessId -le 0) { return }
657
-
658
- $process = Get-Process -Id $ProcessId -ErrorAction SilentlyContinue
659
- if (-not $process) { return }
660
-
661
- try {
662
- $process.Kill($true)
663
- return
664
- } catch {
665
- try {
666
- $children = Get-CimInstance Win32_Process -Filter "ParentProcessId=$ProcessId" -ErrorAction SilentlyContinue
667
- foreach ($child in $children) {
668
- Stop-PrizmProcessTreeById -ProcessId ([int]$child.ProcessId)
669
- }
670
- } catch {
671
- try {
672
- $children = Get-WmiObject Win32_Process -Filter "ParentProcessId=$ProcessId" -ErrorAction SilentlyContinue
673
- foreach ($child in $children) {
674
- Stop-PrizmProcessTreeById -ProcessId ([int]$child.ProcessId)
675
- }
676
- } catch {}
677
- }
678
- try {
679
- Stop-Process -Id $ProcessId -Force -ErrorAction SilentlyContinue
680
- } catch {}
681
- }
682
- }
683
-
684
- function Stop-PrizmSessionProcess {
685
- param([string]$PidPath)
686
- if (-not (Test-Path $PidPath)) { return }
687
- $rawPid = Get-Content $PidPath -ErrorAction SilentlyContinue | Select-Object -First 1
688
- $aiPid = 0
689
- if ([int]::TryParse($rawPid, [ref]$aiPid)) {
690
- Stop-PrizmProcessTreeById -ProcessId $aiPid
691
- }
692
- }
693
-
694
- function Write-PrizmStaleKillMarker {
695
- param([string]$MarkerPath, [int]$StaleSeconds, [int]$Threshold)
696
- $markerDir = Split-Path $MarkerPath -Parent
697
- if ($markerDir) { New-Item -ItemType Directory -Force -Path $markerDir | Out-Null }
698
- [ordered]@{
699
- killed_at = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ')
700
- reason = 'stale_session'
701
- stale_seconds = $StaleSeconds
702
- threshold = $Threshold
703
- } | ConvertTo-Json -Compress | Set-Content -Path $MarkerPath -Encoding UTF8
704
- }
705
-
706
- function Invoke-PrizmAiSession {
707
- param(
708
- [string]$CliCommand,
709
- [string]$PromptPath,
710
- [string]$LogPath,
711
- [string]$ProjectRoot,
712
- [string]$Model = '',
713
- [string]$PidPath = ''
714
- )
715
- $prompt = Get-Content $PromptPath -Raw
716
- $logDir = Split-Path $LogPath -Parent
717
- New-Item -ItemType Directory -Force -Path $logDir | Out-Null
718
-
719
- $psi = [System.Diagnostics.ProcessStartInfo]::new()
720
- $psi.UseShellExecute = $false
721
- $psi.RedirectStandardInput = $true
722
- $psi.RedirectStandardOutput = $true
723
- $psi.RedirectStandardError = $true
724
- $psi.WorkingDirectory = $ProjectRoot
725
- [void]$psi.Environment.Remove('CLAUDECODE')
726
- $cliArgs = @()
727
- $parsedCli = Split-PrizmCommandLine $CliCommand
728
- $cliExecutable = $parsedCli.Command
729
- $sessionPlatform = Get-PrizmSessionPlatform $CliCommand
730
- $useStreamJson = Test-PrizmStreamJsonSupport $CliCommand
731
-
732
- if ($sessionPlatform -eq 'claude') {
733
- $cliArgs += @('-p', '--dangerously-skip-permissions')
734
- if ($env:VERBOSE -in @('1','true','yes','on') -or $useStreamJson) { $cliArgs += '--verbose' }
735
- if ($useStreamJson) { $cliArgs += @('--output-format', 'stream-json') }
736
- if ($env:PRIZMKIT_EFFORT) { $cliArgs += @('--effort', $env:PRIZMKIT_EFFORT) }
737
- if ($Model) { $cliArgs += @('--model', $Model) }
738
- } elseif ($sessionPlatform -eq 'codex') {
739
- $cliArgs += @('--ask-for-approval', 'never', '--sandbox', 'danger-full-access')
740
- $codexSubagentTimeout = Get-PrizmCodexSubagentTimeoutSeconds
741
- if ($codexSubagentTimeout -gt 0) {
742
- $cliArgs += @('--config', "agents.job_max_runtime_seconds=$codexSubagentTimeout")
743
- }
744
- $cliArgs += @('exec', '--cd', $ProjectRoot, '--skip-git-repo-check')
745
- if ($useStreamJson) { $cliArgs += '--json' }
746
- if ($Model) { $cliArgs += @('--model', $Model) }
747
- if ($env:PRIZMKIT_EFFORT) { $cliArgs += @('--config', "model_reasoning_effort=$env:PRIZMKIT_EFFORT") }
748
- $cliArgs += '-'
749
- } else {
750
- $cliArgs += @('--print', '-y')
751
- if ($env:VERBOSE -in @('1','true','yes','on')) { $cliArgs += '--verbose' }
752
- if ($useStreamJson) { $cliArgs += @('--output-format', 'stream-json') }
753
- if ($env:PRIZMKIT_EFFORT) { $cliArgs += @('--effort', $env:PRIZMKIT_EFFORT) }
754
- if ($Model) { $cliArgs += @('--model', $Model) }
755
- }
756
- $generatedArgs = (($cliArgs | ForEach-Object { ConvertTo-PrizmProcessArgument $_ }) -join ' ')
757
- $fullArgs = @()
758
- if ($parsedCli.Arguments) { $fullArgs += $parsedCli.Arguments }
759
- if ($generatedArgs) { $fullArgs += $generatedArgs }
760
- $argumentString = ($fullArgs -join ' ')
761
-
762
- $cliExtension = [System.IO.Path]::GetExtension($cliExecutable).ToLowerInvariant()
763
-
764
- if ($cliExtension -in @('.cmd', '.bat')) {
765
- $psi.FileName = if ($env:ComSpec) { $env:ComSpec } else { 'cmd.exe' }
766
- $childCommand = (ConvertTo-PrizmProcessArgument $cliExecutable)
767
- if ($argumentString) { $childCommand = "$childCommand $argumentString" }
768
- $psi.Arguments = '/d /s /c "' + $childCommand + '"'
769
- } elseif ($cliExtension -eq '.ps1') {
770
- $psi.FileName = Resolve-PrizmPowerShellHost
771
- $scriptArgs = @('-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', $cliExecutable)
772
- $scriptArgumentString = Join-PrizmProcessArguments $scriptArgs
773
- if ($argumentString) { $scriptArgumentString = "$scriptArgumentString $argumentString" }
774
- $psi.Arguments = $scriptArgumentString
775
- } else {
776
- $psi.FileName = $cliExecutable
777
- $psi.Arguments = $argumentString
778
- }
779
-
780
- Initialize-PrizmLineLogBridgeType
781
- $process = [System.Diagnostics.Process]::Start($psi)
782
- $script:PrizmAiProcess = $process
783
- $logBridge = [PrizmLineLogBridge]::new($LogPath)
784
- $process.add_OutputDataReceived($logBridge.Handler)
785
- $process.add_ErrorDataReceived($logBridge.Handler)
786
- if ($PidPath) {
787
- $pidDir = Split-Path $PidPath -Parent
788
- if ($pidDir) { New-Item -ItemType Directory -Force -Path $pidDir | Out-Null }
789
- Set-Content -Path $PidPath -Value ([string]$process.Id) -Encoding UTF8
790
- }
791
- try {
792
- $process.BeginOutputReadLine()
793
- $process.BeginErrorReadLine()
794
- $process.StandardInput.Write($prompt)
795
- $process.StandardInput.Close()
796
- $process.WaitForExit()
797
- $process.WaitForExit()
798
- return $process.ExitCode
799
- } finally {
800
- $process.remove_OutputDataReceived($logBridge.Handler)
801
- $process.remove_ErrorDataReceived($logBridge.Handler)
802
- $logBridge.Dispose()
803
- }
804
- }
805
-
806
- function New-PrizmSessionId {
807
- param([string]$Prefix)
808
- return "$Prefix-$(Get-Date -Format 'yyyyMMdd-HHmmss')-$([guid]::NewGuid().ToString('N').Substring(0, 8))"
809
- }
810
-
811
- function Get-PrizmListDefault {
812
- param([string]$Kind, [string]$ProjectRoot)
813
- switch ($Kind) {
814
- 'feature' { return Join-Path $ProjectRoot '.prizmkit\plans\feature-list.json' }
815
- 'bugfix' { return Join-Path $ProjectRoot '.prizmkit\plans\bug-fix-list.json' }
816
- 'refactor' { return Join-Path $ProjectRoot '.prizmkit\plans\refactor-list.json' }
817
- default { throw "Unknown pipeline kind: $Kind" }
818
- }
819
- }
820
-
821
- function Get-PrizmStateDir {
822
- param([string]$Kind, [string]$ProjectRoot)
823
- switch ($Kind) {
824
- 'feature' { return Join-Path $ProjectRoot '.prizmkit\state\features' }
825
- 'bugfix' { return Join-Path $ProjectRoot '.prizmkit\state\bugfix' }
826
- 'refactor' { return Join-Path $ProjectRoot '.prizmkit\state\refactor' }
827
- default { throw "Unknown pipeline kind: $Kind" }
828
- }
829
- }