prizmkit 1.1.100 → 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 (309) 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/generate-bootstrap-prompt.py +38 -23
  30. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +20 -5
  31. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +2 -2
  32. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +39 -0
  33. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +7 -1
  34. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +4 -0
  35. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +12 -3
  36. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +13 -3
  37. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +13 -3
  38. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +2 -0
  39. package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +9 -30
  40. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +15 -7
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +42 -29
  42. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +41 -39
  43. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +4 -0
  44. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +4 -0
  45. package/bundled/dev-pipeline/tests/test_auto_skip.py +436 -14
  46. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +104 -0
  47. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +40 -0
  48. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +1138 -0
  49. package/bundled/dev-pipeline/tests/test_unified_cli.py +1045 -0
  50. package/bundled/skills/_metadata.json +1 -1
  51. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +29 -34
  52. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +6 -5
  53. package/bundled/skills/feature-pipeline-launcher/SKILL.md +29 -35
  54. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +7 -6
  55. package/bundled/skills/feature-workflow/SKILL.md +3 -6
  56. package/bundled/skills/recovery-workflow/SKILL.md +23 -32
  57. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +29 -35
  58. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +7 -6
  59. package/bundled/skills/refactor-workflow/SKILL.md +3 -6
  60. package/bundled/templates/hooks/commit-intent.json +2 -2
  61. package/bundled/templates/hooks/diff-prizm-docs.py +226 -0
  62. package/bundled/templates/hooks/prizm-pre-commit.py +45 -0
  63. package/bundled/templates/hooks/validate-prizm-docs.py +240 -0
  64. package/package.json +1 -1
  65. package/src/config.js +33 -12
  66. package/src/index.js +3 -6
  67. package/src/manifest.js +3 -2
  68. package/src/metadata.js +7 -18
  69. package/src/prompts.js +0 -12
  70. package/src/runtimes.js +18 -11
  71. package/src/scaffold.js +133 -116
  72. package/src/upgrade.js +1 -1
  73. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +0 -500
  74. package/bundled/dev-pipeline/launch-feature-daemon.sh +0 -657
  75. package/bundled/dev-pipeline/launch-refactor-daemon.sh +0 -502
  76. package/bundled/dev-pipeline/lib/branch.sh +0 -326
  77. package/bundled/dev-pipeline/lib/common.sh +0 -1476
  78. package/bundled/dev-pipeline/lib/heartbeat.sh +0 -469
  79. package/bundled/dev-pipeline/reset-bug.sh +0 -425
  80. package/bundled/dev-pipeline/reset-feature.sh +0 -436
  81. package/bundled/dev-pipeline/reset-refactor.sh +0 -423
  82. package/bundled/dev-pipeline/run-bugfix.sh +0 -1430
  83. package/bundled/dev-pipeline/run-feature.sh +0 -1718
  84. package/bundled/dev-pipeline/run-recovery.sh +0 -648
  85. package/bundled/dev-pipeline/run-refactor.sh +0 -1463
  86. package/bundled/dev-pipeline/tests/test-path-resolution.sh +0 -100
  87. package/bundled/dev-pipeline-windows/.env.example +0 -36
  88. package/bundled/dev-pipeline-windows/README.md +0 -30
  89. package/bundled/dev-pipeline-windows/SCHEMA_ANALYSIS.md +0 -533
  90. package/bundled/dev-pipeline-windows/assets/feature-list-example.json +0 -146
  91. package/bundled/dev-pipeline-windows/assets/prizm-dev-team-integration.md +0 -137
  92. package/bundled/dev-pipeline-windows/launch-bugfix-daemon.ps1 +0 -9
  93. package/bundled/dev-pipeline-windows/launch-feature-daemon.ps1 +0 -9
  94. package/bundled/dev-pipeline-windows/launch-refactor-daemon.ps1 +0 -9
  95. package/bundled/dev-pipeline-windows/lib/branch.ps1 +0 -235
  96. package/bundled/dev-pipeline-windows/lib/common.ps1 +0 -991
  97. package/bundled/dev-pipeline-windows/lib/daemon.ps1 +0 -140
  98. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +0 -1051
  99. package/bundled/dev-pipeline-windows/lib/reset.ps1 +0 -121
  100. package/bundled/dev-pipeline-windows/reset-bug.ps1 +0 -10
  101. package/bundled/dev-pipeline-windows/reset-feature.ps1 +0 -10
  102. package/bundled/dev-pipeline-windows/reset-refactor.ps1 +0 -10
  103. package/bundled/dev-pipeline-windows/run-bugfix.ps1 +0 -9
  104. package/bundled/dev-pipeline-windows/run-feature.ps1 +0 -9
  105. package/bundled/dev-pipeline-windows/run-recovery.ps1 +0 -179
  106. package/bundled/dev-pipeline-windows/run-refactor.ps1 +0 -9
  107. package/bundled/dev-pipeline-windows/scripts/check-session-status.py +0 -301
  108. package/bundled/dev-pipeline-windows/scripts/continuation.py +0 -374
  109. package/bundled/dev-pipeline-windows/scripts/detect-stuck.py +0 -530
  110. package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +0 -2279
  111. package/bundled/dev-pipeline-windows/scripts/generate-bugfix-prompt.py +0 -763
  112. package/bundled/dev-pipeline-windows/scripts/generate-recovery-prompt.py +0 -805
  113. package/bundled/dev-pipeline-windows/scripts/generate-refactor-prompt.py +0 -841
  114. package/bundled/dev-pipeline-windows/scripts/init-bugfix-pipeline.py +0 -316
  115. package/bundled/dev-pipeline-windows/scripts/init-dev-team.py +0 -134
  116. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +0 -382
  117. package/bundled/dev-pipeline-windows/scripts/init-refactor-pipeline.py +0 -399
  118. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +0 -1362
  119. package/bundled/dev-pipeline-windows/scripts/patch-completion-notes.py +0 -191
  120. package/bundled/dev-pipeline-windows/scripts/prizmkit-test-gate.py +0 -446
  121. package/bundled/dev-pipeline-windows/scripts/update-bug-status.py +0 -1121
  122. package/bundled/dev-pipeline-windows/scripts/update-checkpoint.py +0 -173
  123. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +0 -1789
  124. package/bundled/dev-pipeline-windows/scripts/update-refactor-status.py +0 -1327
  125. package/bundled/dev-pipeline-windows/scripts/utils.py +0 -542
  126. package/bundled/dev-pipeline-windows/templates/agent-prompts/critic-plan-challenge.md +0 -7
  127. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-fix.md +0 -7
  128. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +0 -65
  129. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-resume.md +0 -5
  130. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +0 -7
  131. package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +0 -73
  132. package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +0 -589
  133. package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +0 -710
  134. package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +0 -791
  135. package/bundled/dev-pipeline-windows/templates/bug-fix-list-schema.json +0 -263
  136. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +0 -326
  137. package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +0 -237
  138. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +0 -340
  139. package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +0 -270
  140. package/bundled/dev-pipeline-windows/templates/sections/ac-verification-checklist.md +0 -7
  141. package/bundled/dev-pipeline-windows/templates/sections/checkpoint-system.md +0 -91
  142. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +0 -34
  143. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-agent.md +0 -10
  144. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-full.md +0 -12
  145. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-lite.md +0 -7
  146. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-agent.md +0 -8
  147. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-full.md +0 -9
  148. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-lite.md +0 -6
  149. package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +0 -21
  150. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +0 -21
  151. package/bundled/dev-pipeline-windows/templates/sections/log-size-awareness.md +0 -41
  152. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +0 -283
  153. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +0 -112
  154. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +0 -168
  155. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +0 -82
  156. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +0 -75
  157. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +0 -23
  158. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +0 -14
  159. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +0 -19
  160. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +0 -63
  161. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +0 -42
  162. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +0 -44
  163. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +0 -59
  164. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +0 -39
  165. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +0 -27
  166. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +0 -27
  167. package/bundled/dev-pipeline-windows/templates/sections/phase-prizmkit-test.md +0 -39
  168. package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +0 -35
  169. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +0 -35
  170. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +0 -73
  171. package/bundled/dev-pipeline-windows/templates/sections/phase0-init.md +0 -13
  172. package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +0 -21
  173. package/bundled/dev-pipeline-windows/templates/sections/session-context.md +0 -5
  174. package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +0 -6
  175. package/bundled/dev-pipeline-windows/templates/sections/task-contract.md +0 -34
  176. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-agent.md +0 -48
  177. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-lite.md +0 -48
  178. package/bundled/dev-pipeline-windows/templates/session-status-schema.json +0 -83
  179. package/bundled/skills-windows/app-planner/SKILL.md +0 -296
  180. package/bundled/skills-windows/app-planner/assets/app-design-guide.md +0 -101
  181. package/bundled/skills-windows/app-planner/references/architecture-decisions.md +0 -52
  182. package/bundled/skills-windows/app-planner/references/brainstorm-guide.md +0 -101
  183. package/bundled/skills-windows/app-planner/references/frontend-design-guide.md +0 -71
  184. package/bundled/skills-windows/app-planner/references/infrastructure-convention-discovery.md +0 -108
  185. package/bundled/skills-windows/app-planner/references/project-brief-guide.md +0 -82
  186. package/bundled/skills-windows/app-planner/references/project-conventions-discovery.md +0 -59
  187. package/bundled/skills-windows/app-planner/references/project-state-detection.md +0 -90
  188. package/bundled/skills-windows/app-planner/references/red-team-checklist.md +0 -40
  189. package/bundled/skills-windows/app-planner/references/rules/backend/derivation-rules.md +0 -619
  190. package/bundled/skills-windows/app-planner/references/rules/backend/fixed-rules.md +0 -285
  191. package/bundled/skills-windows/app-planner/references/rules/backend/question-bank.md +0 -249
  192. package/bundled/skills-windows/app-planner/references/rules/backend/question-manifest.json +0 -46
  193. package/bundled/skills-windows/app-planner/references/rules/backend/template.md +0 -173
  194. package/bundled/skills-windows/app-planner/references/rules/database/derivation-rules.md +0 -382
  195. package/bundled/skills-windows/app-planner/references/rules/database/fixed-rules.md +0 -211
  196. package/bundled/skills-windows/app-planner/references/rules/database/question-bank.md +0 -184
  197. package/bundled/skills-windows/app-planner/references/rules/database/question-manifest.json +0 -39
  198. package/bundled/skills-windows/app-planner/references/rules/database/template.md +0 -158
  199. package/bundled/skills-windows/app-planner/references/rules/frontend/derivation-rules.md +0 -820
  200. package/bundled/skills-windows/app-planner/references/rules/frontend/fixed-rules.md +0 -188
  201. package/bundled/skills-windows/app-planner/references/rules/frontend/question-bank.md +0 -319
  202. package/bundled/skills-windows/app-planner/references/rules/frontend/question-manifest.json +0 -51
  203. package/bundled/skills-windows/app-planner/references/rules/frontend/template.md +0 -339
  204. package/bundled/skills-windows/app-planner/references/rules/mobile/derivation-rules.md +0 -649
  205. package/bundled/skills-windows/app-planner/references/rules/mobile/fixed-rules.md +0 -290
  206. package/bundled/skills-windows/app-planner/references/rules/mobile/question-bank.md +0 -232
  207. package/bundled/skills-windows/app-planner/references/rules/mobile/question-manifest.json +0 -47
  208. package/bundled/skills-windows/app-planner/references/rules/mobile/template.md +0 -175
  209. package/bundled/skills-windows/app-planner/references/rules-configuration.md +0 -46
  210. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +0 -379
  211. package/bundled/skills-windows/bug-fix-workflow/references/bug-diagnosis.md +0 -41
  212. package/bundled/skills-windows/bug-planner/SKILL.md +0 -402
  213. package/bundled/skills-windows/bug-planner/assets/bug-confirmation-template.md +0 -43
  214. package/bundled/skills-windows/bug-planner/references/critic-and-verification.md +0 -44
  215. package/bundled/skills-windows/bug-planner/references/error-recovery.md +0 -73
  216. package/bundled/skills-windows/bug-planner/references/input-formats.md +0 -53
  217. package/bundled/skills-windows/bug-planner/references/schema-validation.md +0 -25
  218. package/bundled/skills-windows/bug-planner/references/severity-rules.md +0 -16
  219. package/bundled/skills-windows/bug-planner/scripts/validate-bug-list.py +0 -322
  220. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +0 -304
  221. package/bundled/skills-windows/bugfix-pipeline-launcher/references/configuration.md +0 -84
  222. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +0 -381
  223. package/bundled/skills-windows/feature-pipeline-launcher/references/configuration.md +0 -67
  224. package/bundled/skills-windows/feature-pipeline-launcher/scripts/preflight-check.py +0 -462
  225. package/bundled/skills-windows/feature-planner/SKILL.md +0 -397
  226. package/bundled/skills-windows/feature-planner/assets/evaluation-guide.md +0 -64
  227. package/bundled/skills-windows/feature-planner/assets/planning-guide.md +0 -214
  228. package/bundled/skills-windows/feature-planner/references/browser-interaction.md +0 -59
  229. package/bundled/skills-windows/feature-planner/references/completeness-review.md +0 -57
  230. package/bundled/skills-windows/feature-planner/references/decomposition-patterns.md +0 -75
  231. package/bundled/skills-windows/feature-planner/references/error-recovery.md +0 -90
  232. package/bundled/skills-windows/feature-planner/references/incremental-feature-planning.md +0 -112
  233. package/bundled/skills-windows/feature-planner/references/new-project-planning.md +0 -85
  234. package/bundled/skills-windows/feature-planner/scripts/validate-and-generate.py +0 -1020
  235. package/bundled/skills-windows/feature-workflow/SKILL.md +0 -374
  236. package/bundled/skills-windows/feature-workflow/references/brainstorm-guide.md +0 -137
  237. package/bundled/skills-windows/prizm-kit/SKILL.md +0 -93
  238. package/bundled/skills-windows/prizmkit-code-review/SKILL.md +0 -161
  239. package/bundled/skills-windows/prizmkit-code-review/references/dev-agent-prompt.md +0 -30
  240. package/bundled/skills-windows/prizmkit-code-review/references/review-report-template.md +0 -31
  241. package/bundled/skills-windows/prizmkit-code-review/references/reviewer-agent-prompt.md +0 -66
  242. package/bundled/skills-windows/prizmkit-code-review/scripts/check_loop.py +0 -186
  243. package/bundled/skills-windows/prizmkit-committer/SKILL.md +0 -89
  244. package/bundled/skills-windows/prizmkit-deploy/SKILL.md +0 -444
  245. package/bundled/skills-windows/prizmkit-deploy/references/ci-cd-workflows.md +0 -115
  246. package/bundled/skills-windows/prizmkit-deploy/references/cloud-platform-deploy.md +0 -93
  247. package/bundled/skills-windows/prizmkit-deploy/references/data-safety-examples.md +0 -120
  248. package/bundled/skills-windows/prizmkit-deploy/references/database-setup.md +0 -46
  249. package/bundled/skills-windows/prizmkit-deploy/references/deploy-config-schema.md +0 -148
  250. package/bundled/skills-windows/prizmkit-deploy/references/deploy-history-schema.md +0 -62
  251. package/bundled/skills-windows/prizmkit-deploy/references/deployment-modes.md +0 -50
  252. package/bundled/skills-windows/prizmkit-deploy/references/direct-upload.md +0 -26
  253. package/bundled/skills-windows/prizmkit-deploy/references/dns-setup.md +0 -42
  254. package/bundled/skills-windows/prizmkit-deploy/references/docker-deploy.md +0 -31
  255. package/bundled/skills-windows/prizmkit-deploy/references/firewall-setup.md +0 -37
  256. package/bundled/skills-windows/prizmkit-deploy/references/live-validation-notes.md +0 -21
  257. package/bundled/skills-windows/prizmkit-deploy/references/nginx-blue-green.md +0 -59
  258. package/bundled/skills-windows/prizmkit-deploy/references/ssh-bootstrap-flow.md +0 -49
  259. package/bundled/skills-windows/prizmkit-deploy/references/ssh-execution-flow.md +0 -41
  260. package/bundled/skills-windows/prizmkit-deploy/references/ssh-takeover.md +0 -20
  261. package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +0 -56
  262. package/bundled/skills-windows/prizmkit-implement/SKILL.md +0 -71
  263. package/bundled/skills-windows/prizmkit-init/SKILL.md +0 -356
  264. package/bundled/skills-windows/prizmkit-init/assets/project-brief-template.md +0 -82
  265. package/bundled/skills-windows/prizmkit-init/references/config-schema.md +0 -70
  266. package/bundled/skills-windows/prizmkit-init/references/rules/layer-detection.md +0 -41
  267. package/bundled/skills-windows/prizmkit-init/references/tech-stack-catalog.md +0 -13
  268. package/bundled/skills-windows/prizmkit-init/references/update-supplement.md +0 -9
  269. package/bundled/skills-windows/prizmkit-plan/SKILL.md +0 -102
  270. package/bundled/skills-windows/prizmkit-plan/assets/plan-template.md +0 -115
  271. package/bundled/skills-windows/prizmkit-plan/assets/spec-template.md +0 -73
  272. package/bundled/skills-windows/prizmkit-plan/references/clarify-guide.md +0 -67
  273. package/bundled/skills-windows/prizmkit-plan/references/examples.md +0 -85
  274. package/bundled/skills-windows/prizmkit-plan/references/verification-checklist.md +0 -60
  275. package/bundled/skills-windows/prizmkit-prizm-docs/SKILL.md +0 -129
  276. package/bundled/skills-windows/prizmkit-prizm-docs/assets/prizm-docs-format.md +0 -613
  277. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-init.md +0 -45
  278. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-rebuild.md +0 -15
  279. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-status.md +0 -14
  280. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-update.md +0 -19
  281. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-validate.md +0 -17
  282. package/bundled/skills-windows/prizmkit-retrospective/SKILL.md +0 -87
  283. package/bundled/skills-windows/prizmkit-retrospective/references/knowledge-injection-steps.md +0 -50
  284. package/bundled/skills-windows/prizmkit-retrospective/references/structural-sync-steps.md +0 -43
  285. package/bundled/skills-windows/prizmkit-test/SKILL.md +0 -227
  286. package/bundled/skills-windows/prizmkit-test/references/boundary-coverage-protocol.md +0 -220
  287. package/bundled/skills-windows/prizmkit-test/references/examples.md +0 -143
  288. package/bundled/skills-windows/prizmkit-test/references/service-boundary-test-catalog.md +0 -225
  289. package/bundled/skills-windows/prizmkit-test/references/test-generation-steps.md +0 -109
  290. package/bundled/skills-windows/prizmkit-test/references/test-report-template.md +0 -111
  291. package/bundled/skills-windows/prizmkit-test/scripts/validate_boundary_report.py +0 -347
  292. package/bundled/skills-windows/recovery-workflow/SKILL.md +0 -355
  293. package/bundled/skills-windows/recovery-workflow/evals/evals.json +0 -46
  294. package/bundled/skills-windows/recovery-workflow/references/detection.md +0 -58
  295. package/bundled/skills-windows/recovery-workflow/scripts/detect-recovery-state.py +0 -544
  296. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +0 -346
  297. package/bundled/skills-windows/refactor-pipeline-launcher/references/configuration.md +0 -72
  298. package/bundled/skills-windows/refactor-planner/SKILL.md +0 -398
  299. package/bundled/skills-windows/refactor-planner/assets/planning-guide.md +0 -292
  300. package/bundled/skills-windows/refactor-planner/references/behavior-preservation.md +0 -301
  301. package/bundled/skills-windows/refactor-planner/references/fast-path.md +0 -59
  302. package/bundled/skills-windows/refactor-planner/references/planning-phases.md +0 -135
  303. package/bundled/skills-windows/refactor-planner/references/refactor-scoping-guide.md +0 -221
  304. package/bundled/skills-windows/refactor-planner/scripts/validate-and-generate-refactor.py +0 -858
  305. package/bundled/skills-windows/refactor-workflow/SKILL.md +0 -343
  306. package/bundled/skills-windows/refactor-workflow/references/brainstorm-guide.md +0 -116
  307. package/bundled/templates/hooks/diff-prizm-docs.sh +0 -158
  308. package/bundled/templates/hooks/prizm-pre-commit.sh +0 -108
  309. package/bundled/templates/hooks/validate-prizm-docs.sh +0 -139
@@ -1,121 +0,0 @@
1
- . "$PSScriptRoot\common.ps1"
2
-
3
- function Get-PrizmFeatureSlug {
4
- param([string]$ListPath, [string]$FeatureId)
5
- $data = Get-Content $ListPath -Raw | ConvertFrom-Json
6
- $feature = $data.features | Where-Object { $_.id -eq $FeatureId } | Select-Object -First 1
7
- if (-not $feature) { throw "Feature not found in list: $FeatureId" }
8
- $numeric = ($FeatureId -replace '^[Ff]-', '').PadLeft(3, '0')
9
- $slug = ([string]$feature.title).ToLowerInvariant()
10
- $slug = $slug -replace '[^a-z0-9\s-]', ''
11
- $slug = ($slug.Trim() -replace '\s+', '-')
12
- $slug = ($slug -replace '-+', '-').Trim('-')
13
- if (-not $slug) { $slug = 'feature' }
14
- return "$numeric-$slug"
15
- }
16
-
17
- function Write-PrizmContinuationResetWarning {
18
- param([string]$StatusPath, [string]$ItemId, [string]$Label)
19
- if (-not (Test-Path $StatusPath)) { return }
20
- try {
21
- $status = Get-Content $StatusPath -Raw | ConvertFrom-Json
22
- } catch {
23
- return
24
- }
25
- if ($status.continuation_pending -eq $true) {
26
- $reason = $status.continuation_reason
27
- if (-not $reason) { $reason = 'context_overflow' }
28
- Write-PrizmWarn "Continuation pending for $Label $ItemId ($reason). Manual reset will abandon automatic continuation progress."
29
- if ($status.active_dev_branch) {
30
- Write-PrizmWarn "Pending continuation branch: $($status.active_dev_branch)"
31
- }
32
- }
33
- }
34
-
35
- function Write-PrizmContinuationResetWarningsForState {
36
- param([string]$StateDir, [string]$Label)
37
- if (-not (Test-Path $StateDir)) { return }
38
- Get-ChildItem -Path $StateDir -Directory -ErrorAction SilentlyContinue | ForEach-Object {
39
- Write-PrizmContinuationResetWarning `
40
- -StatusPath (Join-Path $_.FullName 'status.json') `
41
- -ItemId $_.Name `
42
- -Label $Label
43
- }
44
- }
45
-
46
- function Invoke-PrizmReset {
47
- param(
48
- [ValidateSet('feature','bugfix','refactor')][string]$Kind,
49
- [string]$ScriptRoot,
50
- [string[]]$Args
51
- )
52
-
53
- $global:PRIZM_RESET_EXIT_CODE = 0
54
- $paths = Initialize-PrizmPaths $ScriptRoot
55
- Set-Location $paths.ProjectRoot
56
- $python = Resolve-PrizmPython
57
-
58
- $idOption = @{ feature = '--feature-id'; bugfix = '--bug-id'; refactor = '--refactor-id' }[$Kind]
59
- $listOption = @{ feature = '--feature-list'; bugfix = '--bug-list'; refactor = '--refactor-list' }[$Kind]
60
- $updateScript = @{ feature = 'update-feature-status.py'; bugfix = 'update-bug-status.py'; refactor = 'update-refactor-status.py' }[$Kind]
61
- $runScript = @{ feature = 'run-feature.ps1'; bugfix = 'run-bugfix.ps1'; refactor = 'run-refactor.ps1' }[$Kind]
62
- $idPattern = @{ feature = '^[Ff]-\d+'; bugfix = '^[Bb]-\d+'; refactor = '^[Rr]-\d+' }[$Kind]
63
- $label = @{ feature = 'feature'; bugfix = 'bug'; refactor = 'refactor' }[$Kind]
64
- $listPath = Get-PrizmListDefault $Kind $paths.ProjectRoot
65
- $stateDir = Get-PrizmStateDir $Kind $paths.ProjectRoot
66
- $itemId = $null
67
- $clean = $false
68
- $runAfterReset = $false
69
-
70
- foreach ($arg in $Args) {
71
- switch -Regex ($arg) {
72
- '^--clean$' { $clean = $true; continue }
73
- '^--run$' { $runAfterReset = $true; continue }
74
- '^(--help|-h)$' {
75
- Write-Host "Usage: .\reset-$label.ps1 [$($label)-id] [--clean] [--run] [list-path]"
76
- Write-Host " No ID clears the whole $Kind pipeline state."
77
- Write-Host " With an ID, reset only that item. --clean removes item artifacts. --run retries it immediately."
78
- return
79
- }
80
- '^-.*' { Write-PrizmWarn "Ignoring unsupported option: $arg"; continue }
81
- default {
82
- if (-not $itemId -and $arg -match $idPattern) {
83
- $itemId = $arg.ToUpperInvariant()
84
- } else {
85
- $listPath = $arg
86
- }
87
- }
88
- }
89
- }
90
-
91
- if (-not $itemId) {
92
- Write-PrizmContinuationResetWarningsForState -StateDir $stateDir -Label $label
93
- & (Join-Path $paths.PipelineDir $runScript) reset
94
- $global:PRIZM_RESET_EXIT_CODE = $LASTEXITCODE
95
- return
96
- }
97
-
98
- if (-not (Test-Path $listPath)) { throw "List file not found: $listPath" }
99
- New-Item -ItemType Directory -Force -Path $stateDir | Out-Null
100
- Write-PrizmContinuationResetWarning `
101
- -StatusPath (Join-Path (Join-Path $stateDir $itemId) 'status.json') `
102
- -ItemId $itemId `
103
- -Label $label
104
-
105
- $action = if ($clean) { 'clean' } else { 'reset' }
106
- $resetArgs = @((Join-Path $paths.ScriptsDir $updateScript), $listOption, $listPath, '--state-dir', $stateDir, '--action', $action, $idOption, $itemId)
107
- if ($clean) {
108
- $resetArgs += @('--project-root', $paths.ProjectRoot)
109
- if ($Kind -eq 'feature') {
110
- $resetArgs += @('--feature-slug', (Get-PrizmFeatureSlug $listPath $itemId))
111
- }
112
- }
113
-
114
- Invoke-PrizmPythonText $python $resetArgs
115
- Write-PrizmSuccess "Reset $label item: $itemId"
116
-
117
- if ($runAfterReset) {
118
- & (Join-Path $paths.PipelineDir $runScript) run $itemId $listPath
119
- $global:PRIZM_RESET_EXIT_CODE = $LASTEXITCODE
120
- }
121
- }
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env pwsh
2
- # Manual reset entrypoint; shared warning/reset behavior lives in lib/reset.ps1.
3
- . "$PSScriptRoot\lib\reset.ps1"
4
- try {
5
- Invoke-PrizmReset -Kind bugfix -ScriptRoot $PSScriptRoot -Args $args
6
- exit $global:PRIZM_RESET_EXIT_CODE
7
- } catch {
8
- Write-PrizmError $_.Exception.Message
9
- exit 1
10
- }
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env pwsh
2
- # Manual reset entrypoint; shared warning/reset behavior lives in lib/reset.ps1.
3
- . "$PSScriptRoot\lib\reset.ps1"
4
- try {
5
- Invoke-PrizmReset -Kind feature -ScriptRoot $PSScriptRoot -Args $args
6
- exit $global:PRIZM_RESET_EXIT_CODE
7
- } catch {
8
- Write-PrizmError $_.Exception.Message
9
- exit 1
10
- }
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env pwsh
2
- # Manual reset entrypoint; shared warning/reset behavior lives in lib/reset.ps1.
3
- . "$PSScriptRoot\lib\reset.ps1"
4
- try {
5
- Invoke-PrizmReset -Kind refactor -ScriptRoot $PSScriptRoot -Args $args
6
- exit $global:PRIZM_RESET_EXIT_CODE
7
- } catch {
8
- Write-PrizmError $_.Exception.Message
9
- exit 1
10
- }
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env pwsh
2
- . "$PSScriptRoot\lib\pipeline.ps1"
3
- try {
4
- Invoke-PrizmPipeline -Kind bugfix -ScriptRoot $PSScriptRoot -Args $args
5
- exit $global:PRIZM_EXIT_CODE
6
- } catch {
7
- Write-PrizmError $_.Exception.Message
8
- exit 1
9
- }
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env pwsh
2
- . "$PSScriptRoot\lib\pipeline.ps1"
3
- try {
4
- Invoke-PrizmPipeline -Kind feature -ScriptRoot $PSScriptRoot -Args $args
5
- exit $global:PRIZM_EXIT_CODE
6
- } catch {
7
- Write-PrizmError $_.Exception.Message
8
- exit 1
9
- }
@@ -1,179 +0,0 @@
1
- #!/usr/bin/env pwsh
2
- . "$PSScriptRoot\lib\common.ps1"
3
- $paths = Initialize-PrizmPaths $PSScriptRoot
4
- Import-PrizmEnv (Join-Path $paths.PrizmkitDir '.env')
5
- Set-Location $paths.ProjectRoot
6
- $python = Resolve-PrizmPython
7
-
8
- $command = if ($args.Count -gt 0 -and $args[0] -in @('run','detect','help','--help','-h')) { $args[0] } else { 'run' }
9
- $remaining = if ($args.Count -gt 0 -and $args[0] -in @('run','detect','help','--help','-h')) {
10
- if ($args.Count -gt 1) { $args[1..($args.Count - 1)] } else { @() }
11
- } else {
12
- $args
13
- }
14
-
15
- if ($command -in @('help','--help','-h')) {
16
- Write-Host 'Usage: .\run-recovery.ps1 [run|detect] [--dry-run] [--yes] [--model <model>]'
17
- Write-Host ' run Auto-detect interrupted workflow and start a recovery AI session'
18
- Write-Host ' detect Print detection report only'
19
- Write-Host ' --dry-run Generate and print the recovery prompt without starting AI'
20
- Write-Host ' --yes Accepted for scripted use; no confirmation prompt is shown'
21
- Write-Host ' --model Override MODEL for this recovery session'
22
- Write-Host ''
23
- Write-Host 'Environment Variables:'
24
- Write-Host ' PRIZMKIT_EFFORT AI reasoning effort (low|medium|high|xhigh|max; max is Claude Code only)'
25
- Write-Host ''
26
- Write-Host 'Examples:'
27
- Write-Host ' .\run-recovery.ps1 # Auto-detect and recover'
28
- Write-Host ' .\run-recovery.ps1 detect # Show what would be recovered'
29
- Write-Host ' .\run-recovery.ps1 run --dry-run # Generate prompt, don''t execute'
30
- Write-Host ' .\run-recovery.ps1 run --yes # Skip confirmation prompt'
31
- Write-Host ' $env:PRIZMKIT_EFFORT=''high''; .\run-recovery.ps1 # Use high reasoning effort'
32
- exit 0
33
- }
34
-
35
- $dryRun = $false
36
- $model = $env:MODEL
37
- for ($i = 0; $i -lt $remaining.Count; $i++) {
38
- $arg = $remaining[$i]
39
- switch -Regex ($arg) {
40
- '^--dry-run$' { $dryRun = $true; continue }
41
- '^--yes$' { continue }
42
- '^--model$' {
43
- if ($i + 1 -ge $remaining.Count) { Write-PrizmError '--model requires a value'; exit 1 }
44
- $i++
45
- $model = $remaining[$i]
46
- continue
47
- }
48
- default {
49
- Write-PrizmWarn "Ignoring unsupported recovery option: $arg"
50
- }
51
- }
52
- }
53
-
54
- function Get-PrizmRecoveryIntEnv {
55
- param([string]$Name, [int]$DefaultValue, [int]$MinimumValue = 0)
56
- $value = [Environment]::GetEnvironmentVariable($Name, 'Process')
57
- if (-not $value) { return $DefaultValue }
58
- $parsed = 0
59
- if (-not [int]::TryParse($value, [ref]$parsed) -or $parsed -lt $MinimumValue) {
60
- throw "$Name must be an integer >= $MinimumValue`: $value"
61
- }
62
- return $parsed
63
- }
64
-
65
- $heartbeatInterval = Get-PrizmRecoveryIntEnv 'HEARTBEAT_INTERVAL' 30 1
66
- $staleKillThreshold = Get-PrizmRecoveryIntEnv 'STALE_KILL_THRESHOLD' 900 0
67
- $staleKillGraceSeconds = Get-PrizmRecoveryIntEnv 'STALE_KILL_GRACE_SECONDS' 10 0
68
-
69
- $recoveryDetectScript = $null
70
- foreach ($candidate in @(
71
- (Join-Path $paths.ProjectRoot '.agents\skills\recovery-workflow\scripts\detect-recovery-state.py'),
72
- (Join-Path $paths.ProjectRoot '.claude\command-assets\recovery-workflow\scripts\detect-recovery-state.py'),
73
- (Join-Path $paths.ProjectRoot '.codebuddy\skills\recovery-workflow\scripts\detect-recovery-state.py')
74
- )) {
75
- if (Test-Path $candidate) {
76
- $recoveryDetectScript = $candidate
77
- break
78
- }
79
- }
80
- if (-not $recoveryDetectScript) {
81
- Write-PrizmError 'Recovery detection script not found. Reinstall PrizmKit skills first.'
82
- exit 1
83
- }
84
-
85
- $stateDir = Join-Path $paths.PrizmkitDir 'state\recovery'
86
- New-Item -ItemType Directory -Force -Path $stateDir | Out-Null
87
- $detectionPath = Join-Path $stateDir 'detection.json'
88
-
89
- Invoke-PrizmPythonText $python @($recoveryDetectScript, '--project-root', $paths.ProjectRoot) | Set-Content -Path $detectionPath -Encoding UTF8
90
- if ($command -eq 'detect') { Get-Content $detectionPath; exit 0 }
91
-
92
- $sessionId = New-PrizmSessionId 'recovery'
93
- $sessionDir = Join-Path $stateDir "sessions\$sessionId"
94
- $logsDir = Join-Path $sessionDir 'logs'
95
- New-Item -ItemType Directory -Force -Path $logsDir | Out-Null
96
- $sessionDetectionPath = Join-Path $sessionDir 'detection.json'
97
- Copy-Item -Path $detectionPath -Destination $sessionDetectionPath -Force
98
- $promptPath = Join-Path $sessionDir 'bootstrap-prompt.md'
99
- $logPath = Join-Path $logsDir 'session.log'
100
- $progressPath = Join-Path $logsDir 'progress.json'
101
- $pidPath = Join-Path $logsDir 'ai.pid'
102
- $staleKillMarker = Join-Path $logsDir 'stale-kill.json'
103
-
104
- Invoke-PrizmPythonText $python @((Join-Path $paths.ScriptsDir 'generate-recovery-prompt.py'), '--detection-json', $sessionDetectionPath, '--project-root', $paths.ProjectRoot, '--session-id', $sessionId, '--output', $promptPath)
105
- if ($dryRun) { Get-Content $promptPath; exit 0 }
106
- $cli = Resolve-PrizmAiCli $paths.ProjectRoot $paths.PrizmkitDir
107
- $env:PRIZMKIT_PLATFORM = Get-PrizmPlatformFromProject $paths.ProjectRoot $paths.PrizmkitDir $cli
108
- Test-PrizmEffort $cli
109
- Write-PrizmInfo "Starting recovery session: $sessionId"
110
- Write-PrizmInfo "Prompt: $promptPath"
111
- Write-PrizmInfo "Log: $logPath"
112
-
113
- $parserProcess = Start-PrizmProgressParser -PythonCommand $python -ScriptsDir $paths.ScriptsDir -SessionLog $logPath -ProgressFile $progressPath -CliCommand $cli
114
- $job = Start-Job -ScriptBlock {
115
- param($commonPath, $cli, $promptPath, $logPath, $projectRoot, $model, $pidPath)
116
- . $commonPath
117
- Invoke-PrizmAiSession -CliCommand $cli -PromptPath $promptPath -LogPath $logPath -ProjectRoot $projectRoot -Model $model -PidPath $pidPath
118
- } -ArgumentList (Join-Path $paths.PipelineDir 'lib\common.ps1'), $cli, $promptPath, $logPath, $paths.ProjectRoot, $model, $pidPath
119
-
120
- $elapsedSeconds = 0
121
- $staleSeconds = 0
122
- $previousLogSize = 0
123
- $previousProgressSignature = ''
124
- $previousChildActivitySignature = ''
125
- $wasStaleKilled = $false
126
- while ($true) {
127
- $completed = Wait-Job $job -Timeout $heartbeatInterval
128
- if ($completed) { break }
129
-
130
- $elapsedSeconds += $heartbeatInterval
131
- $currentLogSize = 0
132
- if (Test-Path $logPath) { $currentLogSize = [int64](Get-Item $logPath).Length }
133
- $growth = $currentLogSize - $previousLogSize
134
- $previousLogSize = $currentLogSize
135
-
136
- $progressActivity = Get-PrizmProgressActivity -ProgressFile $progressPath
137
- $progressSignature = [string]$progressActivity.ProgressSignature
138
- $progressAdvanced = ($progressSignature -and $progressSignature -ne $previousProgressSignature)
139
- $previousProgressSignature = $progressSignature
140
- $childSignature = [string]$progressActivity.ChildSignature
141
- $childAdvanced = ($childSignature -and $childSignature -ne $previousChildActivitySignature)
142
- $previousChildActivitySignature = $childSignature
143
-
144
- if ($growth -gt 0 -or $childAdvanced -or $progressAdvanced) { $staleSeconds = 0 } else { $staleSeconds += $heartbeatInterval }
145
-
146
- if ($staleKillThreshold -gt 0 -and $staleSeconds -ge $staleKillThreshold) {
147
- $wasStaleKilled = $true
148
- Write-PrizmWarn "Recovery session stale-killed (no progress for ${staleKillThreshold}s)"
149
- Write-PrizmStaleKillMarker $staleKillMarker $staleSeconds $staleKillThreshold
150
- Stop-PrizmSessionProcess $pidPath
151
- if ($staleKillGraceSeconds -gt 0) { Start-Sleep -Seconds $staleKillGraceSeconds }
152
- break
153
- }
154
- }
155
-
156
- $exitCode = 0
157
- if ($wasStaleKilled) {
158
- Stop-Job $job
159
- Remove-Job $job
160
- $exitCode = 143
161
- } else {
162
- try {
163
- $exitCode = [int](Receive-Job $job)
164
- } catch {
165
- Write-PrizmWarn "Recovery session job failed: $($_.Exception.Message)"
166
- $exitCode = 1
167
- }
168
- Remove-Job $job
169
- }
170
- Stop-PrizmProgressParser $parserProcess
171
-
172
- if (Test-Path $logPath) {
173
- $lineCount = (Get-Content $logPath | Measure-Object -Line).Lines
174
- $sizeKb = [int](([int64](Get-Item $logPath).Length) / 1024)
175
- Write-PrizmInfo "Session log: $lineCount lines, ${sizeKb}KB"
176
- }
177
- if ($wasStaleKilled -or (Test-Path $staleKillMarker)) { Write-PrizmWarn "Recovery session was stale-killed." }
178
- if ($exitCode -eq 0) { Write-PrizmSuccess "Recovery session completed." } else { Write-PrizmError "Recovery session failed. Log: $logPath" }
179
- exit $exitCode
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env pwsh
2
- . "$PSScriptRoot\lib\pipeline.ps1"
3
- try {
4
- Invoke-PrizmPipeline -Kind refactor -ScriptRoot $PSScriptRoot -Args $args
5
- exit $global:PRIZM_EXIT_CODE
6
- } catch {
7
- Write-PrizmError $_.Exception.Message
8
- exit 1
9
- }
@@ -1,301 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Parse a session-status.json file and output a simple status string for the shell runner.
3
-
4
- Reads the session status written by an agent at session end, validates required
5
- fields, and prints a single-line result to stdout. Detailed JSON is written to
6
- stderr for logging.
7
-
8
- Usage:
9
- python3 check-session-status.py --status-file <path>
10
- """
11
-
12
- import argparse
13
- import json
14
- import sys
15
-
16
- from utils import setup_logging
17
-
18
-
19
- REQUIRED_FIELDS = ["session_id", "status", "timestamp"]
20
- # At least one of these ID fields must be present (depends on pipeline type)
21
- ID_FIELDS = ["feature_id", "bug_id", "refactor_id"]
22
-
23
- LOGGER = setup_logging("check-session-status")
24
-
25
- CONTEXT_OVERFLOW_CODE = "context_overflow"
26
- CONTEXT_CODE_VALUES = {
27
- "context_overflow",
28
- "context_too_large",
29
- "context_length_exceeded",
30
- "model_context_window_exceeded",
31
- }
32
- CONTEXT_TEXT_PATTERNS = (
33
- "input exceeds the context window",
34
- "context window of this model",
35
- "context window exceeded",
36
- "maximum context length exceeded",
37
- "prompt is too long",
38
- "too many tokens",
39
- "input token count exceeds",
40
- )
41
- REQUEST_TOO_LARGE_TEXT = "request too large"
42
- REQUEST_TOO_LARGE_SEMANTICS = ("context", "token", "tokens", "prompt", "input", "model")
43
- ERROR_LIKE_STATUSES = {"failed", "crashed", "timed_out", "context_overflow"}
44
-
45
-
46
- def _flatten_values(value):
47
- if isinstance(value, dict):
48
- values = []
49
- for child in value.values():
50
- values.extend(_flatten_values(child))
51
- return values
52
- if isinstance(value, list):
53
- values = []
54
- for child in value:
55
- values.extend(_flatten_values(child))
56
- return values
57
- if value is None:
58
- return []
59
- return [str(value)]
60
-
61
-
62
- def _is_error_like_status(data):
63
- status = str(data.get("status", "")).lower()
64
- if status in ERROR_LIKE_STATUSES:
65
- return True
66
- if data.get("last_result_is_error") is True or data.get("is_error") is True:
67
- return True
68
- if data.get("api_error_status") not in (None, ""):
69
- return True
70
- errors = data.get("errors")
71
- return isinstance(errors, list) and len(errors) > 0
72
-
73
-
74
- def has_context_overflow_signal(data):
75
- """Return true when session-status data carries a context overflow signal.
76
-
77
- Success remains success: direct status handling happens before this helper.
78
- Exact machine codes are accepted only from structured code fields. Natural
79
- language context/token phrases require a failed/error-like status or an
80
- explicit error field to avoid prompt/documentation false positives.
81
- """
82
- if not isinstance(data, dict):
83
- return False
84
- for field in ("fatal_error_code", "api_error_code", "error_code", "stop_reason"):
85
- value = data.get(field)
86
- if isinstance(value, str) and value.lower() in CONTEXT_CODE_VALUES:
87
- return True
88
- if not _is_error_like_status(data):
89
- return False
90
- text = " ".join(_flatten_values(data)).lower()
91
- if any(pattern in text for pattern in CONTEXT_TEXT_PATTERNS):
92
- return True
93
- return REQUEST_TOO_LARGE_TEXT in text and any(
94
- semantic in text for semantic in REQUEST_TOO_LARGE_SEMANTICS
95
- )
96
-
97
- def parse_args():
98
- parser = argparse.ArgumentParser(
99
- description="Parse session-status.json and output a status string for the shell runner."
100
- )
101
- parser.add_argument(
102
- "--status-file",
103
- required=True,
104
- help="Path to the session-status.json file",
105
- )
106
- return parser.parse_args()
107
-
108
-
109
- def load_status_file(path):
110
- """Load and parse the session status JSON file.
111
-
112
- Returns (data, error_message). On success error_message is None.
113
- """
114
- try:
115
- with open(path, "r", encoding="utf-8") as f:
116
- data = json.load(f)
117
- except (IOError, OSError) as e:
118
- return None, "Cannot read status file: {}".format(str(e))
119
- except (json.JSONDecodeError, ValueError) as e:
120
- return None, "Malformed JSON in status file: {}".format(str(e))
121
- return data, None
122
-
123
-
124
- def validate_required_fields(data):
125
- """Check that all required fields are present and non-empty.
126
-
127
- Returns a list of missing/invalid field names.
128
- In addition to the always-required fields, at least one of
129
- feature_id / bug_id / refactor_id must be present.
130
- """
131
- missing = []
132
- for field in REQUIRED_FIELDS:
133
- if field not in data:
134
- missing.append(field)
135
- elif not isinstance(data[field], str) or not data[field].strip():
136
- missing.append(field)
137
-
138
- # Check that at least one ID field is present and non-empty
139
- has_id = any(
140
- field in data and isinstance(data[field], str) and data[field].strip()
141
- for field in ID_FIELDS
142
- )
143
- if not has_id:
144
- missing.append("feature_id|bug_id|refactor_id")
145
-
146
- return missing
147
-
148
-
149
- def determine_status(data):
150
- """Determine the single-line status string from the parsed data.
151
-
152
- Returns one of: success, partial_resumable, partial_not_resumable,
153
- failed, commit_missing, docs_missing, merge_conflict, context_overflow.
154
- """
155
- status = data.get("status", "")
156
-
157
- if status == "success":
158
- return "success"
159
- if status == "context_overflow" or has_context_overflow_signal(data):
160
- return "context_overflow"
161
- elif status == "partial":
162
- can_resume = data.get("can_resume", False)
163
- if can_resume:
164
- return "partial_resumable"
165
- else:
166
- return "partial_not_resumable"
167
- elif status == "partial_resumable":
168
- return "partial_resumable"
169
- elif status == "partial_not_resumable":
170
- return "partial_not_resumable"
171
- elif status == "failed":
172
- return "failed"
173
- elif status == "crashed":
174
- return "crashed"
175
- elif status == "timed_out":
176
- return "timed_out"
177
- elif status == "commit_missing":
178
- return "commit_missing"
179
- elif status == "docs_missing":
180
- return "docs_missing"
181
- elif status == "merge_conflict":
182
- return "merge_conflict"
183
- else:
184
- # Unknown status value — treat as crashed
185
- return "crashed"
186
-
187
-
188
- def build_detail_report(data, resolved_status):
189
- """Build the detailed JSON report for stderr logging."""
190
- errors = data.get("errors", [])
191
- error_count = len(errors) if isinstance(errors, list) else 0
192
-
193
- return {
194
- "status": resolved_status,
195
- "feature_id": data.get("feature_id"),
196
- "bug_id": data.get("bug_id"),
197
- "refactor_id": data.get("refactor_id"),
198
- "completed_phases": data.get("completed_phases", []),
199
- "checkpoint_reached": data.get("checkpoint_reached"),
200
- "tasks_completed": data.get("tasks_completed", 0),
201
- "tasks_total": data.get("tasks_total", 0),
202
- "error_count": error_count,
203
- "can_resume": data.get("can_resume", False),
204
- "resume_from_phase": data.get("resume_from_phase"),
205
- }
206
-
207
-
208
- def main():
209
- args = parse_args()
210
-
211
- # Load the status file
212
- data, load_error = load_status_file(args.status_file)
213
- if load_error is not None:
214
- # File missing or malformed JSON
215
- detail = {
216
- "status": "crashed",
217
- "feature_id": None,
218
- "completed_phases": [],
219
- "checkpoint_reached": None,
220
- "tasks_completed": 0,
221
- "tasks_total": 0,
222
- "error_count": 1,
223
- "can_resume": False,
224
- "resume_from_phase": None,
225
- "load_error": load_error,
226
- }
227
- sys.stderr.write(json.dumps(detail, indent=2, ensure_ascii=False) + "\n")
228
- print("crashed")
229
- sys.exit(0)
230
-
231
- # Validate required fields
232
- missing = validate_required_fields(data)
233
- if missing:
234
- detail = {
235
- "status": "crashed",
236
- "feature_id": data.get("feature_id"),
237
- "completed_phases": data.get("completed_phases", []),
238
- "checkpoint_reached": data.get("checkpoint_reached"),
239
- "tasks_completed": data.get("tasks_completed", 0),
240
- "tasks_total": data.get("tasks_total", 0),
241
- "error_count": 1,
242
- "can_resume": False,
243
- "resume_from_phase": None,
244
- "validation_error": "Missing or invalid required fields: {}".format(
245
- ", ".join(missing)
246
- ),
247
- }
248
- sys.stderr.write(json.dumps(detail, indent=2, ensure_ascii=False) + "\n")
249
- print("crashed")
250
- sys.exit(0)
251
-
252
- # Determine status
253
- resolved_status = determine_status(data)
254
-
255
- # Build and emit detail report to stderr
256
- detail = build_detail_report(data, resolved_status)
257
- sys.stderr.write(json.dumps(detail, indent=2, ensure_ascii=False) + "\n")
258
-
259
- # Emit single-line status to stdout
260
- print(resolved_status)
261
- sys.exit(0)
262
-
263
-
264
- if __name__ == "__main__":
265
- try:
266
- main()
267
- except KeyboardInterrupt:
268
- detail = {
269
- "status": "crashed",
270
- "feature_id": None,
271
- "completed_phases": [],
272
- "checkpoint_reached": None,
273
- "tasks_completed": 0,
274
- "tasks_total": 0,
275
- "error_count": 1,
276
- "can_resume": False,
277
- "resume_from_phase": None,
278
- "internal_error": "Interrupted",
279
- }
280
- sys.stderr.write(json.dumps(detail, indent=2, ensure_ascii=False) + "\n")
281
- print("crashed")
282
- sys.exit(0)
283
- except SystemExit:
284
- raise
285
- except Exception as exc:
286
- LOGGER.exception("Unhandled exception in check-session-status")
287
- detail = {
288
- "status": "crashed",
289
- "feature_id": None,
290
- "completed_phases": [],
291
- "checkpoint_reached": None,
292
- "tasks_completed": 0,
293
- "tasks_total": 0,
294
- "error_count": 1,
295
- "can_resume": False,
296
- "resume_from_phase": None,
297
- "internal_error": str(exc),
298
- }
299
- sys.stderr.write(json.dumps(detail, indent=2, ensure_ascii=False) + "\n")
300
- print("crashed")
301
- sys.exit(0)