prizmkit 1.1.100 → 1.1.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/bin/create-prizmkit.js +4 -4
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/dev-pipeline/.env.example +3 -3
  4. package/bundled/dev-pipeline/README.md +110 -90
  5. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +1 -1
  6. package/bundled/dev-pipeline/cli.py +27 -0
  7. package/bundled/dev-pipeline/prizmkit_runtime/__init__.py +13 -0
  8. package/bundled/dev-pipeline/prizmkit_runtime/__main__.py +9 -0
  9. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +193 -0
  10. package/bundled/dev-pipeline/prizmkit_runtime/commands.py +313 -0
  11. package/bundled/dev-pipeline/prizmkit_runtime/compat.py +32 -0
  12. package/bundled/dev-pipeline/prizmkit_runtime/config.py +410 -0
  13. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +478 -0
  14. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +734 -0
  15. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +256 -0
  16. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +109 -0
  17. package/bundled/dev-pipeline/prizmkit_runtime/paths.py +110 -0
  18. package/bundled/dev-pipeline/prizmkit_runtime/processes.py +373 -0
  19. package/bundled/dev-pipeline/prizmkit_runtime/reset.py +389 -0
  20. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +51 -0
  21. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +179 -0
  22. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +355 -0
  23. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +118 -0
  24. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +187 -0
  25. package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +153 -0
  26. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +425 -0
  27. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +560 -0
  28. package/bundled/dev-pipeline/prizmkit_runtime/status.py +71 -0
  29. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +51 -36
  30. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +20 -5
  31. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +2 -2
  32. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +39 -0
  33. package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +8 -2
  34. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +1 -1
  35. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +6 -2
  36. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +14 -6
  37. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +14 -4
  38. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +14 -4
  39. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +2 -0
  40. package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +9 -30
  41. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +15 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +42 -29
  43. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +41 -39
  44. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +8 -17
  45. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -2
  46. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +1 -3
  47. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -3
  48. package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +3 -8
  49. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +6 -2
  50. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +5 -1
  51. package/bundled/dev-pipeline/tests/test_auto_skip.py +436 -14
  52. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +115 -7
  53. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +40 -0
  54. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +1226 -0
  55. package/bundled/dev-pipeline/tests/test_unified_cli.py +1045 -0
  56. package/bundled/skills/_metadata.json +1 -1
  57. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +29 -34
  58. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +6 -5
  59. package/bundled/skills/feature-pipeline-launcher/SKILL.md +29 -35
  60. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +7 -6
  61. package/bundled/skills/feature-workflow/SKILL.md +3 -6
  62. package/bundled/skills/recovery-workflow/SKILL.md +23 -32
  63. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +29 -35
  64. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +7 -6
  65. package/bundled/skills/refactor-workflow/SKILL.md +3 -6
  66. package/bundled/templates/hooks/commit-intent.json +2 -2
  67. package/bundled/templates/hooks/diff-prizm-docs.py +226 -0
  68. package/bundled/templates/hooks/prizm-pre-commit.py +45 -0
  69. package/bundled/templates/hooks/validate-prizm-docs.py +240 -0
  70. package/package.json +1 -1
  71. package/src/config.js +42 -19
  72. package/src/external-skills.js +14 -14
  73. package/src/index.js +3 -6
  74. package/src/manifest.js +11 -5
  75. package/src/metadata.js +7 -18
  76. package/src/platforms.js +25 -0
  77. package/src/prompts.js +0 -12
  78. package/src/runtimes.js +18 -11
  79. package/src/scaffold.js +144 -122
  80. package/src/upgrade.js +12 -3
  81. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +0 -500
  82. package/bundled/dev-pipeline/launch-feature-daemon.sh +0 -657
  83. package/bundled/dev-pipeline/launch-refactor-daemon.sh +0 -502
  84. package/bundled/dev-pipeline/lib/branch.sh +0 -326
  85. package/bundled/dev-pipeline/lib/common.sh +0 -1476
  86. package/bundled/dev-pipeline/lib/heartbeat.sh +0 -469
  87. package/bundled/dev-pipeline/reset-bug.sh +0 -425
  88. package/bundled/dev-pipeline/reset-feature.sh +0 -436
  89. package/bundled/dev-pipeline/reset-refactor.sh +0 -423
  90. package/bundled/dev-pipeline/run-bugfix.sh +0 -1430
  91. package/bundled/dev-pipeline/run-feature.sh +0 -1718
  92. package/bundled/dev-pipeline/run-recovery.sh +0 -648
  93. package/bundled/dev-pipeline/run-refactor.sh +0 -1463
  94. package/bundled/dev-pipeline/tests/test-path-resolution.sh +0 -100
  95. package/bundled/dev-pipeline-windows/.env.example +0 -36
  96. package/bundled/dev-pipeline-windows/README.md +0 -30
  97. package/bundled/dev-pipeline-windows/SCHEMA_ANALYSIS.md +0 -533
  98. package/bundled/dev-pipeline-windows/assets/feature-list-example.json +0 -146
  99. package/bundled/dev-pipeline-windows/assets/prizm-dev-team-integration.md +0 -137
  100. package/bundled/dev-pipeline-windows/launch-bugfix-daemon.ps1 +0 -9
  101. package/bundled/dev-pipeline-windows/launch-feature-daemon.ps1 +0 -9
  102. package/bundled/dev-pipeline-windows/launch-refactor-daemon.ps1 +0 -9
  103. package/bundled/dev-pipeline-windows/lib/branch.ps1 +0 -235
  104. package/bundled/dev-pipeline-windows/lib/common.ps1 +0 -991
  105. package/bundled/dev-pipeline-windows/lib/daemon.ps1 +0 -140
  106. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +0 -1051
  107. package/bundled/dev-pipeline-windows/lib/reset.ps1 +0 -121
  108. package/bundled/dev-pipeline-windows/reset-bug.ps1 +0 -10
  109. package/bundled/dev-pipeline-windows/reset-feature.ps1 +0 -10
  110. package/bundled/dev-pipeline-windows/reset-refactor.ps1 +0 -10
  111. package/bundled/dev-pipeline-windows/run-bugfix.ps1 +0 -9
  112. package/bundled/dev-pipeline-windows/run-feature.ps1 +0 -9
  113. package/bundled/dev-pipeline-windows/run-recovery.ps1 +0 -179
  114. package/bundled/dev-pipeline-windows/run-refactor.ps1 +0 -9
  115. package/bundled/dev-pipeline-windows/scripts/check-session-status.py +0 -301
  116. package/bundled/dev-pipeline-windows/scripts/continuation.py +0 -374
  117. package/bundled/dev-pipeline-windows/scripts/detect-stuck.py +0 -530
  118. package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +0 -2279
  119. package/bundled/dev-pipeline-windows/scripts/generate-bugfix-prompt.py +0 -763
  120. package/bundled/dev-pipeline-windows/scripts/generate-recovery-prompt.py +0 -805
  121. package/bundled/dev-pipeline-windows/scripts/generate-refactor-prompt.py +0 -841
  122. package/bundled/dev-pipeline-windows/scripts/init-bugfix-pipeline.py +0 -316
  123. package/bundled/dev-pipeline-windows/scripts/init-dev-team.py +0 -134
  124. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +0 -382
  125. package/bundled/dev-pipeline-windows/scripts/init-refactor-pipeline.py +0 -399
  126. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +0 -1362
  127. package/bundled/dev-pipeline-windows/scripts/patch-completion-notes.py +0 -191
  128. package/bundled/dev-pipeline-windows/scripts/prizmkit-test-gate.py +0 -446
  129. package/bundled/dev-pipeline-windows/scripts/update-bug-status.py +0 -1121
  130. package/bundled/dev-pipeline-windows/scripts/update-checkpoint.py +0 -173
  131. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +0 -1789
  132. package/bundled/dev-pipeline-windows/scripts/update-refactor-status.py +0 -1327
  133. package/bundled/dev-pipeline-windows/scripts/utils.py +0 -542
  134. package/bundled/dev-pipeline-windows/templates/agent-prompts/critic-plan-challenge.md +0 -7
  135. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-fix.md +0 -7
  136. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +0 -65
  137. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-resume.md +0 -5
  138. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +0 -7
  139. package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +0 -73
  140. package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +0 -589
  141. package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +0 -710
  142. package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +0 -791
  143. package/bundled/dev-pipeline-windows/templates/bug-fix-list-schema.json +0 -263
  144. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +0 -326
  145. package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +0 -237
  146. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +0 -340
  147. package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +0 -270
  148. package/bundled/dev-pipeline-windows/templates/sections/ac-verification-checklist.md +0 -7
  149. package/bundled/dev-pipeline-windows/templates/sections/checkpoint-system.md +0 -91
  150. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +0 -34
  151. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-agent.md +0 -10
  152. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-full.md +0 -12
  153. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-lite.md +0 -7
  154. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-agent.md +0 -8
  155. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-full.md +0 -9
  156. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-lite.md +0 -6
  157. package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +0 -21
  158. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +0 -21
  159. package/bundled/dev-pipeline-windows/templates/sections/log-size-awareness.md +0 -41
  160. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +0 -283
  161. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +0 -112
  162. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +0 -168
  163. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +0 -82
  164. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +0 -75
  165. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +0 -23
  166. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +0 -14
  167. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +0 -19
  168. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +0 -63
  169. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +0 -42
  170. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +0 -44
  171. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +0 -59
  172. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +0 -39
  173. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +0 -27
  174. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +0 -27
  175. package/bundled/dev-pipeline-windows/templates/sections/phase-prizmkit-test.md +0 -39
  176. package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +0 -35
  177. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +0 -35
  178. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +0 -73
  179. package/bundled/dev-pipeline-windows/templates/sections/phase0-init.md +0 -13
  180. package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +0 -21
  181. package/bundled/dev-pipeline-windows/templates/sections/session-context.md +0 -5
  182. package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +0 -6
  183. package/bundled/dev-pipeline-windows/templates/sections/task-contract.md +0 -34
  184. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-agent.md +0 -48
  185. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-lite.md +0 -48
  186. package/bundled/dev-pipeline-windows/templates/session-status-schema.json +0 -83
  187. package/bundled/skills-windows/app-planner/SKILL.md +0 -296
  188. package/bundled/skills-windows/app-planner/assets/app-design-guide.md +0 -101
  189. package/bundled/skills-windows/app-planner/references/architecture-decisions.md +0 -52
  190. package/bundled/skills-windows/app-planner/references/brainstorm-guide.md +0 -101
  191. package/bundled/skills-windows/app-planner/references/frontend-design-guide.md +0 -71
  192. package/bundled/skills-windows/app-planner/references/infrastructure-convention-discovery.md +0 -108
  193. package/bundled/skills-windows/app-planner/references/project-brief-guide.md +0 -82
  194. package/bundled/skills-windows/app-planner/references/project-conventions-discovery.md +0 -59
  195. package/bundled/skills-windows/app-planner/references/project-state-detection.md +0 -90
  196. package/bundled/skills-windows/app-planner/references/red-team-checklist.md +0 -40
  197. package/bundled/skills-windows/app-planner/references/rules/backend/derivation-rules.md +0 -619
  198. package/bundled/skills-windows/app-planner/references/rules/backend/fixed-rules.md +0 -285
  199. package/bundled/skills-windows/app-planner/references/rules/backend/question-bank.md +0 -249
  200. package/bundled/skills-windows/app-planner/references/rules/backend/question-manifest.json +0 -46
  201. package/bundled/skills-windows/app-planner/references/rules/backend/template.md +0 -173
  202. package/bundled/skills-windows/app-planner/references/rules/database/derivation-rules.md +0 -382
  203. package/bundled/skills-windows/app-planner/references/rules/database/fixed-rules.md +0 -211
  204. package/bundled/skills-windows/app-planner/references/rules/database/question-bank.md +0 -184
  205. package/bundled/skills-windows/app-planner/references/rules/database/question-manifest.json +0 -39
  206. package/bundled/skills-windows/app-planner/references/rules/database/template.md +0 -158
  207. package/bundled/skills-windows/app-planner/references/rules/frontend/derivation-rules.md +0 -820
  208. package/bundled/skills-windows/app-planner/references/rules/frontend/fixed-rules.md +0 -188
  209. package/bundled/skills-windows/app-planner/references/rules/frontend/question-bank.md +0 -319
  210. package/bundled/skills-windows/app-planner/references/rules/frontend/question-manifest.json +0 -51
  211. package/bundled/skills-windows/app-planner/references/rules/frontend/template.md +0 -339
  212. package/bundled/skills-windows/app-planner/references/rules/mobile/derivation-rules.md +0 -649
  213. package/bundled/skills-windows/app-planner/references/rules/mobile/fixed-rules.md +0 -290
  214. package/bundled/skills-windows/app-planner/references/rules/mobile/question-bank.md +0 -232
  215. package/bundled/skills-windows/app-planner/references/rules/mobile/question-manifest.json +0 -47
  216. package/bundled/skills-windows/app-planner/references/rules/mobile/template.md +0 -175
  217. package/bundled/skills-windows/app-planner/references/rules-configuration.md +0 -46
  218. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +0 -379
  219. package/bundled/skills-windows/bug-fix-workflow/references/bug-diagnosis.md +0 -41
  220. package/bundled/skills-windows/bug-planner/SKILL.md +0 -402
  221. package/bundled/skills-windows/bug-planner/assets/bug-confirmation-template.md +0 -43
  222. package/bundled/skills-windows/bug-planner/references/critic-and-verification.md +0 -44
  223. package/bundled/skills-windows/bug-planner/references/error-recovery.md +0 -73
  224. package/bundled/skills-windows/bug-planner/references/input-formats.md +0 -53
  225. package/bundled/skills-windows/bug-planner/references/schema-validation.md +0 -25
  226. package/bundled/skills-windows/bug-planner/references/severity-rules.md +0 -16
  227. package/bundled/skills-windows/bug-planner/scripts/validate-bug-list.py +0 -322
  228. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +0 -304
  229. package/bundled/skills-windows/bugfix-pipeline-launcher/references/configuration.md +0 -84
  230. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +0 -381
  231. package/bundled/skills-windows/feature-pipeline-launcher/references/configuration.md +0 -67
  232. package/bundled/skills-windows/feature-pipeline-launcher/scripts/preflight-check.py +0 -462
  233. package/bundled/skills-windows/feature-planner/SKILL.md +0 -397
  234. package/bundled/skills-windows/feature-planner/assets/evaluation-guide.md +0 -64
  235. package/bundled/skills-windows/feature-planner/assets/planning-guide.md +0 -214
  236. package/bundled/skills-windows/feature-planner/references/browser-interaction.md +0 -59
  237. package/bundled/skills-windows/feature-planner/references/completeness-review.md +0 -57
  238. package/bundled/skills-windows/feature-planner/references/decomposition-patterns.md +0 -75
  239. package/bundled/skills-windows/feature-planner/references/error-recovery.md +0 -90
  240. package/bundled/skills-windows/feature-planner/references/incremental-feature-planning.md +0 -112
  241. package/bundled/skills-windows/feature-planner/references/new-project-planning.md +0 -85
  242. package/bundled/skills-windows/feature-planner/scripts/validate-and-generate.py +0 -1020
  243. package/bundled/skills-windows/feature-workflow/SKILL.md +0 -374
  244. package/bundled/skills-windows/feature-workflow/references/brainstorm-guide.md +0 -137
  245. package/bundled/skills-windows/prizm-kit/SKILL.md +0 -93
  246. package/bundled/skills-windows/prizmkit-code-review/SKILL.md +0 -161
  247. package/bundled/skills-windows/prizmkit-code-review/references/dev-agent-prompt.md +0 -30
  248. package/bundled/skills-windows/prizmkit-code-review/references/review-report-template.md +0 -31
  249. package/bundled/skills-windows/prizmkit-code-review/references/reviewer-agent-prompt.md +0 -66
  250. package/bundled/skills-windows/prizmkit-code-review/scripts/check_loop.py +0 -186
  251. package/bundled/skills-windows/prizmkit-committer/SKILL.md +0 -89
  252. package/bundled/skills-windows/prizmkit-deploy/SKILL.md +0 -444
  253. package/bundled/skills-windows/prizmkit-deploy/references/ci-cd-workflows.md +0 -115
  254. package/bundled/skills-windows/prizmkit-deploy/references/cloud-platform-deploy.md +0 -93
  255. package/bundled/skills-windows/prizmkit-deploy/references/data-safety-examples.md +0 -120
  256. package/bundled/skills-windows/prizmkit-deploy/references/database-setup.md +0 -46
  257. package/bundled/skills-windows/prizmkit-deploy/references/deploy-config-schema.md +0 -148
  258. package/bundled/skills-windows/prizmkit-deploy/references/deploy-history-schema.md +0 -62
  259. package/bundled/skills-windows/prizmkit-deploy/references/deployment-modes.md +0 -50
  260. package/bundled/skills-windows/prizmkit-deploy/references/direct-upload.md +0 -26
  261. package/bundled/skills-windows/prizmkit-deploy/references/dns-setup.md +0 -42
  262. package/bundled/skills-windows/prizmkit-deploy/references/docker-deploy.md +0 -31
  263. package/bundled/skills-windows/prizmkit-deploy/references/firewall-setup.md +0 -37
  264. package/bundled/skills-windows/prizmkit-deploy/references/live-validation-notes.md +0 -21
  265. package/bundled/skills-windows/prizmkit-deploy/references/nginx-blue-green.md +0 -59
  266. package/bundled/skills-windows/prizmkit-deploy/references/ssh-bootstrap-flow.md +0 -49
  267. package/bundled/skills-windows/prizmkit-deploy/references/ssh-execution-flow.md +0 -41
  268. package/bundled/skills-windows/prizmkit-deploy/references/ssh-takeover.md +0 -20
  269. package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +0 -56
  270. package/bundled/skills-windows/prizmkit-implement/SKILL.md +0 -71
  271. package/bundled/skills-windows/prizmkit-init/SKILL.md +0 -356
  272. package/bundled/skills-windows/prizmkit-init/assets/project-brief-template.md +0 -82
  273. package/bundled/skills-windows/prizmkit-init/references/config-schema.md +0 -70
  274. package/bundled/skills-windows/prizmkit-init/references/rules/layer-detection.md +0 -41
  275. package/bundled/skills-windows/prizmkit-init/references/tech-stack-catalog.md +0 -13
  276. package/bundled/skills-windows/prizmkit-init/references/update-supplement.md +0 -9
  277. package/bundled/skills-windows/prizmkit-plan/SKILL.md +0 -102
  278. package/bundled/skills-windows/prizmkit-plan/assets/plan-template.md +0 -115
  279. package/bundled/skills-windows/prizmkit-plan/assets/spec-template.md +0 -73
  280. package/bundled/skills-windows/prizmkit-plan/references/clarify-guide.md +0 -67
  281. package/bundled/skills-windows/prizmkit-plan/references/examples.md +0 -85
  282. package/bundled/skills-windows/prizmkit-plan/references/verification-checklist.md +0 -60
  283. package/bundled/skills-windows/prizmkit-prizm-docs/SKILL.md +0 -129
  284. package/bundled/skills-windows/prizmkit-prizm-docs/assets/prizm-docs-format.md +0 -613
  285. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-init.md +0 -45
  286. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-rebuild.md +0 -15
  287. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-status.md +0 -14
  288. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-update.md +0 -19
  289. package/bundled/skills-windows/prizmkit-prizm-docs/references/op-validate.md +0 -17
  290. package/bundled/skills-windows/prizmkit-retrospective/SKILL.md +0 -87
  291. package/bundled/skills-windows/prizmkit-retrospective/references/knowledge-injection-steps.md +0 -50
  292. package/bundled/skills-windows/prizmkit-retrospective/references/structural-sync-steps.md +0 -43
  293. package/bundled/skills-windows/prizmkit-test/SKILL.md +0 -227
  294. package/bundled/skills-windows/prizmkit-test/references/boundary-coverage-protocol.md +0 -220
  295. package/bundled/skills-windows/prizmkit-test/references/examples.md +0 -143
  296. package/bundled/skills-windows/prizmkit-test/references/service-boundary-test-catalog.md +0 -225
  297. package/bundled/skills-windows/prizmkit-test/references/test-generation-steps.md +0 -109
  298. package/bundled/skills-windows/prizmkit-test/references/test-report-template.md +0 -111
  299. package/bundled/skills-windows/prizmkit-test/scripts/validate_boundary_report.py +0 -347
  300. package/bundled/skills-windows/recovery-workflow/SKILL.md +0 -355
  301. package/bundled/skills-windows/recovery-workflow/evals/evals.json +0 -46
  302. package/bundled/skills-windows/recovery-workflow/references/detection.md +0 -58
  303. package/bundled/skills-windows/recovery-workflow/scripts/detect-recovery-state.py +0 -544
  304. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +0 -346
  305. package/bundled/skills-windows/refactor-pipeline-launcher/references/configuration.md +0 -72
  306. package/bundled/skills-windows/refactor-planner/SKILL.md +0 -398
  307. package/bundled/skills-windows/refactor-planner/assets/planning-guide.md +0 -292
  308. package/bundled/skills-windows/refactor-planner/references/behavior-preservation.md +0 -301
  309. package/bundled/skills-windows/refactor-planner/references/fast-path.md +0 -59
  310. package/bundled/skills-windows/refactor-planner/references/planning-phases.md +0 -135
  311. package/bundled/skills-windows/refactor-planner/references/refactor-scoping-guide.md +0 -221
  312. package/bundled/skills-windows/refactor-planner/scripts/validate-and-generate-refactor.py +0 -858
  313. package/bundled/skills-windows/refactor-workflow/SKILL.md +0 -343
  314. package/bundled/skills-windows/refactor-workflow/references/brainstorm-guide.md +0 -116
  315. package/bundled/templates/hooks/diff-prizm-docs.sh +0 -158
  316. package/bundled/templates/hooks/prizm-pre-commit.sh +0 -108
  317. package/bundled/templates/hooks/validate-prizm-docs.sh +0 -139
@@ -1,648 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # ============================================================
5
- # dev-pipeline/run-recovery.sh - Recover Interrupted Workflow Sessions
6
- #
7
- # Auto-detects which workflow (feature-workflow, bug-fix-workflow,
8
- # refactor-workflow) was interrupted and what phase it reached,
9
- # then generates a comprehensive bootstrap prompt and spawns an
10
- # AI CLI session to complete all remaining phases.
11
- #
12
- # Unlike run-feature.sh / run-bugfix.sh / run-refactor.sh, this
13
- # is a single-shot operation (no pipeline loop) for one detected
14
- # interrupted workflow.
15
- #
16
- # Usage:
17
- # ./run-recovery.sh Auto-detect and recover
18
- # ./run-recovery.sh run Same as above
19
- # ./run-recovery.sh run --dry-run Generate prompt only
20
- # ./run-recovery.sh run --yes Skip confirmation
21
- # ./run-recovery.sh run --model <model> Override AI model
22
- # ./run-recovery.sh detect Detection report only
23
- # ./run-recovery.sh help Show help
24
- #
25
- # Environment Variables:
26
- # AI_CLI AI CLI command name (auto-detected: cbc, claude, or codex)
27
- # PRIZMKIT_PLATFORM Platform hint for custom AI_CLI wrappers: codebuddy, claude, or codex
28
- # MODEL AI model to use (e.g. claude-opus-4.6)
29
- # VERBOSE Set to 1 to enable --verbose on AI CLI
30
- # HEARTBEAT_INTERVAL Heartbeat log interval in seconds (default: 30)
31
- # STALE_KILL_THRESHOLD Auto-kill after N seconds of no progress (default: 900)
32
- # AUTO_PUSH Auto-push after successful recovery (default: 0)
33
- # ============================================================
34
-
35
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
36
-
37
- # Source shared common helpers (exports PIPELINE_DIR/PRIZMKIT_DIR/PROJECT_ROOT,
38
- # CLI/platform detection, logs, deps)
39
- source "$SCRIPT_DIR/lib/common.sh"
40
-
41
- RECOVERY_STATE_DIR="${PRIZMKIT_DIR}/state/recovery"
42
- SCRIPTS_DIR="$SCRIPT_DIR/scripts"
43
- # detect-recovery-state.py lives in the installed skill assets for the active platform.
44
- if [[ -f "${PROJECT_ROOT}/.agents/skills/recovery-workflow/scripts/detect-recovery-state.py" ]]; then
45
- RECOVERY_DETECT_SCRIPT="${PROJECT_ROOT}/.agents/skills/recovery-workflow/scripts/detect-recovery-state.py"
46
- elif [[ -f "${PROJECT_ROOT}/.claude/command-assets/recovery-workflow/scripts/detect-recovery-state.py" ]]; then
47
- RECOVERY_DETECT_SCRIPT="${PROJECT_ROOT}/.claude/command-assets/recovery-workflow/scripts/detect-recovery-state.py"
48
- elif [[ -f "${PROJECT_ROOT}/.codebuddy/skills/recovery-workflow/scripts/detect-recovery-state.py" ]]; then
49
- RECOVERY_DETECT_SCRIPT="${PROJECT_ROOT}/.codebuddy/skills/recovery-workflow/scripts/detect-recovery-state.py"
50
- else
51
- RECOVERY_DETECT_SCRIPT=""
52
- fi
53
-
54
- if [[ -z "$RECOVERY_DETECT_SCRIPT" ]]; then
55
- log_error "Recovery detection script not found in any platform location:"
56
- log_error " ${PROJECT_ROOT}/.agents/skills/recovery-workflow/scripts/detect-recovery-state.py"
57
- log_error " ${PROJECT_ROOT}/.claude/command-assets/recovery-workflow/scripts/detect-recovery-state.py"
58
- log_error " ${PROJECT_ROOT}/.codebuddy/skills/recovery-workflow/scripts/detect-recovery-state.py"
59
- log_error "Ensure PrizmKit is installed (npx prizmkit install) before running recovery."
60
- exit 1
61
- fi
62
-
63
- # Configuration
64
- HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-30}
65
- STALE_KILL_THRESHOLD=${STALE_KILL_THRESHOLD:-900}
66
- VERBOSE=${VERBOSE:-0}
67
- MODEL=${MODEL:-""}
68
- PRIZMKIT_EFFORT=${PRIZMKIT_EFFORT:-""}
69
- AUTO_PUSH=${AUTO_PUSH:-0}
70
-
71
- # Source shared common helpers (CLI/platform detection + logs + deps)
72
- prizm_detect_cli_and_platform
73
-
74
- # Validate PRIZMKIT_EFFORT early (fail-fast before any sessions are spawned)
75
- prizm_validate_effort
76
-
77
- # Source shared heartbeat library
78
- source "$SCRIPT_DIR/lib/heartbeat.sh"
79
-
80
- # Source shared branch library
81
- source "$SCRIPT_DIR/lib/branch.sh"
82
-
83
- # Detect stream-json support
84
- detect_stream_json_support "$CLI_CMD"
85
-
86
- # Session tracking (for cleanup)
87
- _SESSION_DIR=""
88
- _SESSION_PID=""
89
-
90
- # ============================================================
91
- # Help
92
- # ============================================================
93
-
94
- show_help() {
95
- cat <<'HELP'
96
- Usage: ./run-recovery.sh [command] [options]
97
-
98
- Commands:
99
- run Auto-detect interrupted workflow and recover (default)
100
- detect Show detection report only (no execution)
101
- help Show this help
102
-
103
- Options (for 'run' command):
104
- --dry-run Generate bootstrap prompt without spawning AI session
105
- --yes Skip user confirmation
106
- --model M Override AI model (e.g. claude-opus-4.6)
107
-
108
- Environment Variables:
109
- MODEL AI model to use
110
- PRIZMKIT_EFFORT AI reasoning effort (low|medium|high|xhigh|max; max is Claude Code only)
111
- VERBOSE Set to 1 for verbose AI CLI output
112
- HEARTBEAT_INTERVAL Heartbeat log interval in seconds (default: 30)
113
- STALE_KILL_THRESHOLD Auto-kill after N seconds no progress (default: 900)
114
- AUTO_PUSH Auto-push after success (default: 0)
115
-
116
- Examples:
117
- ./run-recovery.sh # Auto-detect and recover
118
- ./run-recovery.sh detect # Show what would be recovered
119
- ./run-recovery.sh run --dry-run # Generate prompt, don't execute
120
- ./run-recovery.sh run --yes # Skip confirmation prompt
121
- ./run-recovery.sh run --model claude-opus-4.6
122
- PRIZMKIT_EFFORT=high ./run-recovery.sh # Use high reasoning effort
123
- HELP
124
- }
125
-
126
- # ============================================================
127
- # Cleanup trap
128
- # ============================================================
129
-
130
- cleanup() {
131
- local exit_code=$?
132
- # Kill any background processes
133
- if [[ -n "${_SESSION_PID:-}" ]]; then
134
- kill "$_SESSION_PID" 2>/dev/null || true
135
- wait "$_SESSION_PID" 2>/dev/null || true
136
- fi
137
- # Stop heartbeat if running
138
- stop_heartbeat "${_HEARTBEAT_PID:-}" 2>/dev/null || true
139
- # Log recovery session location
140
- if [[ -n "${_SESSION_DIR:-}" && -d "${_SESSION_DIR:-}" ]]; then
141
- log_info "Session directory: $_SESSION_DIR"
142
- if [[ -f "$_SESSION_DIR/logs/session.log" ]]; then
143
- log_info "Session log: $_SESSION_DIR/logs/session.log"
144
- fi
145
- fi
146
- if [[ $exit_code -ne 0 && $exit_code -ne 130 ]]; then
147
- log_info "Re-run ./run-recovery.sh to try again."
148
- fi
149
- }
150
- trap cleanup EXIT
151
-
152
- # ============================================================
153
- # Detection
154
- # ============================================================
155
-
156
- run_detection() {
157
- local detection_output
158
- local detect_stderr_file
159
- detect_stderr_file=$(mktemp)
160
- detection_output=$(python3 "$RECOVERY_DETECT_SCRIPT" --project-root "$PROJECT_ROOT" 2>"$detect_stderr_file") || {
161
- log_error "Detection script failed"
162
- if [[ -s "$detect_stderr_file" ]]; then
163
- log_error "Details: $(cat "$detect_stderr_file")"
164
- fi
165
- rm -f "$detect_stderr_file"
166
- return 1
167
- }
168
- # Show migration warnings or other informational messages from detection
169
- if [[ -s "$detect_stderr_file" ]]; then
170
- log_warn "$(cat "$detect_stderr_file")"
171
- fi
172
- rm -f "$detect_stderr_file"
173
- echo "$detection_output"
174
- }
175
-
176
- display_report() {
177
- local detection_json="$1"
178
-
179
- local detected workflow_type branch phase phase_name reason remaining
180
- detected=$(echo "$detection_json" | jq -r '.detected // false')
181
-
182
- if [[ "$detected" != "true" ]]; then
183
- echo ""
184
- log_info "No interrupted workflow detected in this workspace."
185
- echo ""
186
- echo " To start a new workflow:"
187
- echo " • /feature-workflow — build features from idea to code"
188
- echo " • /bug-fix-workflow — fix a specific bug interactively"
189
- echo " • /refactor-workflow — behavior-preserving code restructuring"
190
- echo ""
191
- return 1
192
- fi
193
-
194
- workflow_type=$(echo "$detection_json" | jq -r '.workflow_type')
195
- branch=$(echo "$detection_json" | jq -r '.git.current_branch // "unknown"')
196
- phase=$(echo "$detection_json" | jq -r '.phase')
197
- phase_name=$(echo "$detection_json" | jq -r '.phase_name')
198
- reason=$(echo "$detection_json" | jq -r '.recovery.reason // ""')
199
- remaining=$(echo "$detection_json" | jq -r '.recovery.remaining_work // ""')
200
-
201
- local uncommitted staged commits_ahead
202
- uncommitted=$(echo "$detection_json" | jq -r '.git.uncommitted_files // 0')
203
- staged=$(echo "$detection_json" | jq -r '.git.staged_files // 0')
204
- commits_ahead=$(echo "$detection_json" | jq -r '.git.commits_ahead_of_main // 0')
205
-
206
- local has_changes files_modified files_added test_files
207
- has_changes=$(echo "$detection_json" | jq -r '.code.has_changes // false')
208
- files_modified=$(echo "$detection_json" | jq -r '.code.files_modified // 0')
209
- files_added=$(echo "$detection_json" | jq -r '.code.files_added // 0')
210
- test_files=$(echo "$detection_json" | jq -r '.code.test_files_touched // 0')
211
-
212
- echo ""
213
- echo "═══════════════════════════════════════════════════"
214
- echo " Recovery Report"
215
- echo "═══════════════════════════════════════════════════"
216
- echo ""
217
- echo " Workflow: $workflow_type"
218
- echo " Branch: $branch"
219
- echo " Phase: $phase — $phase_name"
220
- echo ""
221
-
222
- if [[ "$has_changes" == "true" ]]; then
223
- echo " Code Changes:"
224
- echo " Modified: $files_modified files"
225
- echo " Added: $files_added files"
226
- echo " Tests: $test_files test files touched"
227
- echo ""
228
- fi
229
-
230
- echo " Git State:"
231
- echo " Uncommitted: $uncommitted files"
232
- echo " Staged: $staged files"
233
- echo " Ahead: $commits_ahead commits ahead of main"
234
- echo ""
235
- echo " Reason: $reason"
236
- echo " Remaining: $remaining"
237
- echo ""
238
-
239
- # Show other interrupted workflows (if any)
240
- local others
241
- others=$(echo "$detection_json" | jq -r '.other_interrupted_workflows // [] | .[]' 2>/dev/null)
242
- if [[ -n "$others" ]]; then
243
- echo " Note: Other interrupted workflows also detected:"
244
- echo "$others" | while IFS= read -r w; do
245
- echo " • $w"
246
- done
247
- echo " (Run recovery again after this one completes)"
248
- echo ""
249
- fi
250
-
251
- echo "═══════════════════════════════════════════════════"
252
- echo ""
253
-
254
- return 0
255
- }
256
-
257
- # ============================================================
258
- # Session spawn (simplified from run-bugfix.sh)
259
- # ============================================================
260
-
261
- spawn_recovery_session() {
262
- local bootstrap_prompt="$1"
263
- local session_dir="$2"
264
- local session_model="${3:-}"
265
-
266
- local session_log="$session_dir/logs/session.log"
267
- local progress_json="$session_dir/logs/progress.json"
268
-
269
- local effective_model="${session_model:-$MODEL}"
270
-
271
- log_info "Spawning AI CLI session..."
272
- log_info "CLI: $CLI_CMD"
273
- [[ -n "$effective_model" ]] && log_info "Model: $effective_model"
274
- log_info "Prompt: $bootstrap_prompt"
275
-
276
- prizm_start_ai_session "$bootstrap_prompt" "$session_log" "$effective_model"
277
- _SESSION_PID="$PRIZM_AI_PID"
278
-
279
- # Start progress parser
280
- start_progress_parser "$session_log" "$progress_json" "$SCRIPTS_DIR"
281
- local parser_pid="${_PARSER_PID:-}"
282
-
283
- # Heartbeat monitor
284
- start_heartbeat "$_SESSION_PID" "$session_log" "$progress_json" "$HEARTBEAT_INTERVAL" "$STALE_KILL_THRESHOLD"
285
- _HEARTBEAT_PID="${_HEARTBEAT_PID:-}"
286
-
287
- # Wait for session to finish
288
- local exit_code=0
289
- if wait "$_SESSION_PID" 2>/dev/null; then
290
- exit_code=0
291
- else
292
- exit_code=$?
293
- fi
294
- _SESSION_PID=""
295
-
296
- # Clean up heartbeat and parser
297
- stop_heartbeat "${_HEARTBEAT_PID:-}"
298
- _HEARTBEAT_PID=""
299
- stop_progress_parser "$parser_pid"
300
-
301
- # Check for stale-kill
302
- local stale_kill_marker="$session_dir/logs/stale-kill.json"
303
- if [[ -f "$stale_kill_marker" ]]; then
304
- log_warn "Session was stale-killed (no progress for too long)"
305
- fi
306
-
307
- # Log session summary
308
- if [[ -f "$session_log" ]]; then
309
- local final_size final_lines
310
- final_size=$(wc -c < "$session_log" 2>/dev/null | tr -d ' ')
311
- final_lines=$(wc -l < "$session_log" 2>/dev/null | tr -d ' ')
312
- log_info "Session log: $final_lines lines, $((final_size / 1024))KB"
313
- fi
314
- log_info "Session exit code: $exit_code"
315
-
316
- return $exit_code
317
- }
318
-
319
- # ============================================================
320
- # Post-session outcome detection
321
- # ============================================================
322
-
323
- detect_session_outcome() {
324
- local exit_code="$1"
325
- local session_dir="$2"
326
- local workflow_type="$3"
327
- local main_branch="${4:-main}"
328
-
329
- local stale_kill_marker="$session_dir/logs/stale-kill.json"
330
- local was_stale_killed=false
331
- [[ -f "$stale_kill_marker" ]] && was_stale_killed=true
332
-
333
- if [[ "$was_stale_killed" == true ]]; then
334
- log_warn "Session stale-killed"
335
- fi
336
-
337
- # Check for commits
338
- local has_commits=""
339
- has_commits=$(git -C "$PROJECT_ROOT" log "${main_branch}..HEAD" --oneline 2>/dev/null | head -1 || true)
340
-
341
- if [[ -n "$has_commits" ]]; then
342
- echo "success"
343
- return
344
- fi
345
-
346
- # Check for uncommitted changes
347
- local uncommitted=""
348
- uncommitted=$(git -C "$PROJECT_ROOT" status --porcelain 2>/dev/null | head -1 || true)
349
- if [[ -n "$uncommitted" ]]; then
350
- # Try auto-commit to preserve work (like run-bugfix.sh does)
351
- log_info "Uncommitted changes found — attempting to preserve work..."
352
- git -C "$PROJECT_ROOT" add -A 2>/dev/null || true
353
- if git -C "$PROJECT_ROOT" commit --no-verify -m "wip(recovery): auto-save interrupted session work" 2>/dev/null; then
354
- log_info "Auto-saved recovery work as WIP commit"
355
- echo "success_wip"
356
- return
357
- fi
358
- echo "partial"
359
- return
360
- fi
361
-
362
- if [[ $exit_code -ne 0 ]]; then
363
- echo "failed"
364
- else
365
- echo "no_changes"
366
- fi
367
- }
368
-
369
- # ============================================================
370
- # Commands
371
- # ============================================================
372
-
373
- cmd_detect() {
374
- prizm_check_common_dependencies
375
- prizm_ensure_git_repo "$PROJECT_ROOT"
376
-
377
- local detection_json
378
- detection_json=$(run_detection) || {
379
- log_error "Detection failed"
380
- exit 1
381
- }
382
-
383
- display_report "$detection_json"
384
- }
385
-
386
- cmd_run() {
387
- local dry_run=false
388
- local skip_confirm=false
389
- local model_override=""
390
-
391
- # Parse options
392
- while [[ $# -gt 0 ]]; do
393
- case "$1" in
394
- --dry-run)
395
- dry_run=true
396
- shift
397
- ;;
398
- --yes|-y)
399
- skip_confirm=true
400
- shift
401
- ;;
402
- --model)
403
- model_override="$2"
404
- shift 2
405
- ;;
406
- *)
407
- log_error "Unknown option: $1"
408
- show_help
409
- exit 1
410
- ;;
411
- esac
412
- done
413
-
414
- # Step 1: Check dependencies
415
- prizm_check_common_dependencies
416
- prizm_ensure_git_repo "$PROJECT_ROOT"
417
-
418
- # Step 2: Run detection
419
- log_info "Detecting interrupted workflow..."
420
- local detection_json
421
- detection_json=$(run_detection) || {
422
- log_error "Detection failed"
423
- exit 1
424
- }
425
-
426
- # Step 3: Display report
427
- if ! display_report "$detection_json"; then
428
- exit 0 # No workflow detected, clean exit
429
- fi
430
-
431
- local workflow_type phase phase_name main_branch
432
- workflow_type=$(echo "$detection_json" | jq -r '.workflow_type')
433
- phase=$(echo "$detection_json" | jq -r '.phase')
434
- phase_name=$(echo "$detection_json" | jq -r '.phase_name')
435
-
436
- # Detect main branch (used for post-session commit check)
437
- main_branch="main"
438
- if ! git -C "$PROJECT_ROOT" rev-parse --verify main >/dev/null 2>&1; then
439
- if git -C "$PROJECT_ROOT" rev-parse --verify master >/dev/null 2>&1; then
440
- main_branch="master"
441
- fi
442
- fi
443
-
444
- # Step 4: User confirmation
445
- if [[ "$skip_confirm" != true ]]; then
446
- echo -n "Ready to resume from Phase $phase ($phase_name). Continue? [y/N] "
447
- read -r answer
448
- if [[ ! "$answer" =~ ^[Yy]$ ]]; then
449
- log_info "Recovery cancelled by user."
450
- exit 0
451
- fi
452
- else
453
- log_info "Confirmation skipped (--yes flag)"
454
- fi
455
-
456
- # Step 5: Create session directory
457
- local timestamp session_id session_dir
458
- timestamp=$(date +%Y%m%d-%H%M%S)
459
- session_id="recovery-${workflow_type}-${timestamp}"
460
- session_dir="$RECOVERY_STATE_DIR/$session_id"
461
- _SESSION_DIR="$session_dir"
462
- mkdir -p "$session_dir/logs"
463
-
464
- # Save detection JSON for reference
465
- local detection_file="$session_dir/detection.json"
466
- echo "$detection_json" > "$detection_file"
467
-
468
- # Step 6: Generate bootstrap prompt
469
- log_info "Generating recovery bootstrap prompt..."
470
- local bootstrap_prompt="$session_dir/bootstrap-prompt.md"
471
- local gen_stderr_file="$session_dir/logs/prompt-gen-stderr.log"
472
- local gen_output
473
- gen_output=$(python3 "$SCRIPTS_DIR/generate-recovery-prompt.py" \
474
- --detection-json "$detection_file" \
475
- --output "$bootstrap_prompt" \
476
- --project-root "$PROJECT_ROOT" \
477
- --session-id "$session_id" \
478
- 2>"$gen_stderr_file") || {
479
- log_error "Failed to generate recovery prompt"
480
- if [[ -s "$gen_stderr_file" ]]; then
481
- log_error "Details: $(cat "$gen_stderr_file")"
482
- fi
483
- exit 1
484
- }
485
-
486
- local gen_success
487
- gen_success=$(echo "$gen_output" | jq -r '.success // false')
488
- if [[ "$gen_success" != "true" ]]; then
489
- local gen_error
490
- gen_error=$(echo "$gen_output" | jq -r '.error // "unknown error"')
491
- log_error "Prompt generation failed: $gen_error"
492
- exit 1
493
- fi
494
-
495
- local prompt_lines
496
- prompt_lines=$(wc -l < "$bootstrap_prompt" | tr -d ' ')
497
- log_success "Bootstrap prompt generated: $prompt_lines lines"
498
- log_info "Prompt: $bootstrap_prompt"
499
-
500
- # Step 7: Dry run exits here
501
- if [[ "$dry_run" == true ]]; then
502
- echo ""
503
- log_success "Dry run complete. Inspect the prompt with:"
504
- echo " cat $bootstrap_prompt"
505
- echo ""
506
- echo "To execute recovery:"
507
- echo " ./run-recovery.sh run --yes"
508
- exit 0
509
- fi
510
-
511
- # Step 8: Record current branch
512
- local current_branch
513
- current_branch=$(git -C "$PROJECT_ROOT" branch --show-current 2>/dev/null || echo "unknown")
514
- log_info "Current branch: $current_branch"
515
- log_info "NOTE: Recovery continues on current branch (no new branch created)"
516
-
517
- # Step 9: Spawn AI CLI session
518
- echo ""
519
- log_info "Starting recovery session..."
520
- log_info "Workflow: $workflow_type"
521
- log_info "Resuming from: Phase $phase ($phase_name)"
522
- echo ""
523
-
524
- local exit_code=0
525
- spawn_recovery_session "$bootstrap_prompt" "$session_dir" "$model_override" || exit_code=$?
526
-
527
- # Step 10: Detect outcome
528
- local outcome
529
- outcome=$(detect_session_outcome "$exit_code" "$session_dir" "$workflow_type" "$main_branch")
530
-
531
- # Step 11: Post-session report
532
- echo ""
533
- echo "═══════════════════════════════════════════════════"
534
- echo " Recovery Result"
535
- echo "═══════════════════════════════════════════════════"
536
- echo ""
537
- echo " Workflow: $workflow_type"
538
- echo " Recovered from: Phase $phase ($phase_name)"
539
- echo " Outcome: $outcome"
540
- echo " Session log: $session_dir/logs/session.log"
541
- echo ""
542
-
543
- case "$outcome" in
544
- success)
545
- log_success "Recovery completed successfully!"
546
- # Auto-push if configured
547
- if [[ "$AUTO_PUSH" == "1" ]]; then
548
- log_info "Auto-pushing to remote (AUTO_PUSH=1)..."
549
- if git -C "$PROJECT_ROOT" push 2>/dev/null; then
550
- log_success "Pushed to remote"
551
- else
552
- log_warn "Push failed — push manually: git push"
553
- fi
554
- fi
555
- echo ""
556
- echo " Next steps:"
557
- echo " • Review changes: git log --oneline -5"
558
- echo " • Run tests: npm test"
559
- if [[ "$workflow_type" == "bug-fix-workflow" && "$current_branch" == fix/* ]]; then
560
- echo " • Merge to main: git checkout main && git merge $current_branch"
561
- fi
562
- if [[ "$AUTO_PUSH" != "1" ]]; then
563
- echo " • Push when ready: git push"
564
- fi
565
- echo ""
566
- ;;
567
- success_wip)
568
- log_warn "Recovery session interrupted — work auto-saved as WIP commit."
569
- echo ""
570
- echo " The session was interrupted but uncommitted changes were saved."
571
- echo " The WIP commit preserves your progress."
572
- echo ""
573
- echo " Next steps:"
574
- echo " • Run recovery again to complete remaining phases: ./run-recovery.sh"
575
- echo " • Or review the WIP commit: git log --oneline -1"
576
- echo ""
577
- ;;
578
- partial)
579
- log_warn "Session completed but has uncommitted changes."
580
- echo ""
581
- echo " The session did work but didn't finish committing."
582
- echo " Check uncommitted changes:"
583
- echo " git status"
584
- echo " git diff"
585
- echo ""
586
- echo " Options:"
587
- echo " • Run recovery again: ./run-recovery.sh"
588
- echo " • Commit manually: git add <files> && git commit"
589
- echo ""
590
- ;;
591
- no_changes)
592
- log_warn "Session completed but produced no changes."
593
- echo ""
594
- echo " The session may have already been fully recovered,"
595
- echo " or the AI couldn't make progress."
596
- echo " Check the session log for details:"
597
- echo " cat $session_dir/logs/session.log"
598
- echo ""
599
- ;;
600
- *)
601
- log_error "Recovery session failed."
602
- echo ""
603
- echo " Check session log for errors:"
604
- echo " cat $session_dir/logs/session.log"
605
- echo ""
606
- echo " Options:"
607
- echo " • Run recovery again: ./run-recovery.sh"
608
- echo " • Start fresh: /<workflow> command"
609
- echo ""
610
- ;;
611
- esac
612
-
613
- echo "═══════════════════════════════════════════════════"
614
-
615
- if [[ "$outcome" == "success" ]]; then
616
- exit 0
617
- else
618
- exit 1
619
- fi
620
- }
621
-
622
- # ============================================================
623
- # Main
624
- # ============================================================
625
-
626
- main() {
627
- local command="${1:-run}"
628
- shift || true
629
-
630
- case "$command" in
631
- run)
632
- cmd_run "$@"
633
- ;;
634
- detect)
635
- cmd_detect
636
- ;;
637
- help|--help|-h)
638
- show_help
639
- ;;
640
- *)
641
- log_error "Unknown command: $command"
642
- show_help
643
- exit 1
644
- ;;
645
- esac
646
- }
647
-
648
- main "$@"