prizmkit 1.1.190 → 1.1.192

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 (189) hide show
  1. package/bin/create-prizmkit.js +4 -4
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/antigravity/assets/prizmkit-hook.cjs +150 -0
  4. package/bundled/adapters/antigravity/hooks-adapter.js +195 -0
  5. package/bundled/adapters/antigravity/paths.js +14 -0
  6. package/bundled/adapters/antigravity/rules-adapter.js +54 -0
  7. package/bundled/adapters/antigravity/skill-adapter.js +38 -0
  8. package/bundled/adapters/codex/skill-adapter.js +28 -8
  9. package/bundled/adapters/cursor/skill-adapter.js +13 -4
  10. package/bundled/adapters/pi/skill-adapter.js +28 -7
  11. package/bundled/dev-pipeline/.env.example +4 -12
  12. package/bundled/dev-pipeline/README.md +21 -15
  13. package/bundled/dev-pipeline/assets/skill-subagent-integration.md +3 -6
  14. package/bundled/dev-pipeline/prizmkit_runtime/atomic_io.py +48 -0
  15. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +66 -23
  16. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +10 -7
  17. package/bundled/dev-pipeline/prizmkit_runtime/commands.py +2 -21
  18. package/bundled/dev-pipeline/prizmkit_runtime/config.py +29 -70
  19. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +125 -67
  20. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +89 -442
  21. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +93 -49
  22. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -3
  23. package/bundled/dev-pipeline/prizmkit_runtime/paths.py +0 -6
  24. package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +49 -18
  25. package/bundled/dev-pipeline/prizmkit_runtime/processes.py +206 -151
  26. package/bundled/dev-pipeline/prizmkit_runtime/reset.py +2 -23
  27. package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +15 -134
  28. package/bundled/dev-pipeline/prizmkit_runtime/results.py +25 -0
  29. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +68 -83
  30. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +15 -5
  31. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +1 -29
  32. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -2
  33. package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +7 -2
  34. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +282 -217
  35. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +124 -122
  36. package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +90 -9
  37. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +369 -154
  38. package/bundled/dev-pipeline/prizmkit_runtime/status.py +3 -3
  39. package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +2780 -0
  40. package/bundled/dev-pipeline/prizmkit_runtime/task_checkout.py +27 -101
  41. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +58 -4
  42. package/bundled/dev-pipeline/scripts/check-session-status.py +43 -19
  43. package/bundled/dev-pipeline/scripts/continuation.py +6 -4
  44. package/bundled/dev-pipeline/scripts/detect-stuck.py +28 -28
  45. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +7 -2
  46. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -2
  47. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +10 -7
  48. package/bundled/dev-pipeline/scripts/init-change-artifact.py +8 -2
  49. package/bundled/dev-pipeline/scripts/init-pipeline.py +14 -69
  50. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +31 -2328
  51. package/bundled/dev-pipeline/scripts/patch-completion-notes.py +4 -24
  52. package/bundled/dev-pipeline/scripts/prompt_framework.py +56 -9
  53. package/bundled/dev-pipeline/scripts/status_common.py +591 -0
  54. package/bundled/dev-pipeline/scripts/update-bug-status.py +85 -463
  55. package/bundled/dev-pipeline/scripts/update-checkpoint.py +227 -65
  56. package/bundled/dev-pipeline/scripts/update-feature-status.py +76 -509
  57. package/bundled/dev-pipeline/scripts/utils.py +10 -15
  58. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +4 -4
  59. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +7 -0
  60. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
  61. package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +1 -1
  62. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +1 -1
  63. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
  64. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -1
  65. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
  66. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
  67. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +2 -2
  68. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -2
  69. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -1
  70. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
  71. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -6
  72. package/bundled/dev-pipeline/templates/session-status-schema.json +2 -5
  73. package/bundled/dev-pipeline/tests/_helpers.py +418 -0
  74. package/bundled/dev-pipeline/tests/conftest.py +45 -1
  75. package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +1 -0
  76. package/bundled/dev-pipeline/tests/test_auto_skip.py +4 -69
  77. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +126 -1
  78. package/bundled/dev-pipeline/tests/test_daemon_and_scripts.py +257 -0
  79. package/bundled/dev-pipeline/tests/test_e2e_pipeline_run.py +500 -0
  80. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +59 -117
  81. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +12 -10
  82. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +561 -3094
  83. package/bundled/dev-pipeline/tests/test_recovery_workflow.py +7 -8
  84. package/bundled/dev-pipeline/tests/test_repository_bootstrap.py +0 -1
  85. package/bundled/dev-pipeline/tests/test_reset_modes.py +15 -27
  86. package/bundled/dev-pipeline/tests/test_reset_preserve.py +54 -139
  87. package/bundled/dev-pipeline/tests/test_runner_bookkeeping.py +766 -0
  88. package/bundled/dev-pipeline/tests/test_runner_lifecycle.py +1257 -0
  89. package/bundled/dev-pipeline/tests/test_runtime_helper.py +97 -20
  90. package/bundled/dev-pipeline/tests/test_session_launch.py +1101 -0
  91. package/bundled/dev-pipeline/tests/test_stream_progress.py +585 -0
  92. package/bundled/dev-pipeline/tests/test_unified_cli.py +490 -2006
  93. package/bundled/dev-pipeline/tests/test_utils.py +3 -3
  94. package/bundled/rules/USAGE.md +1 -0
  95. package/bundled/skills/_metadata.json +9 -63
  96. package/bundled/skills/app-planner/SKILL.md +32 -303
  97. package/bundled/skills/app-planner/references/app-design-guide.md +0 -4
  98. package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
  99. package/bundled/skills/app-planner/references/project-brief-guide.md +14 -0
  100. package/bundled/skills/app-planner/references/project-conventions-discovery.md +4 -6
  101. package/bundled/skills/app-planner/references/project-state-detection.md +2 -3
  102. package/bundled/skills/bug-fix-workflow/SKILL.md +1 -2
  103. package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +4 -7
  104. package/bundled/skills/bug-planner/SKILL.md +54 -435
  105. package/bundled/skills/bug-planner/references/generated-plan-review.md +3 -2
  106. package/bundled/skills/bug-planner/references/input-formats.md +32 -0
  107. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +4 -6
  108. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +4 -28
  109. package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -6
  110. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +4 -28
  111. package/bundled/skills/feature-planner/SKILL.md +60 -439
  112. package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
  113. package/bundled/skills/feature-planner/references/completeness-review.md +34 -0
  114. package/bundled/skills/feature-planner/references/decomposition-patterns.md +2 -2
  115. package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
  116. package/bundled/skills/feature-planner/references/generated-plan-review.md +3 -2
  117. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +3 -1
  118. package/bundled/skills/feature-workflow/SKILL.md +1 -2
  119. package/bundled/skills/prizmkit/SKILL.md +7 -1
  120. package/bundled/skills/prizmkit-code-review/SKILL.md +14 -6
  121. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +7 -4
  122. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +16 -0
  123. package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +58 -20
  124. package/bundled/skills/prizmkit-implement/SKILL.md +1 -1
  125. package/bundled/skills/prizmkit-init/SKILL.md +25 -128
  126. package/bundled/skills/prizmkit-init/assets/project-brief-template.md +3 -3
  127. package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
  128. package/bundled/skills/prizmkit-plan/SKILL.md +6 -8
  129. package/bundled/skills/prizmkit-plan/references/clarify-guide.md +1 -1
  130. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +5 -2
  131. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +6 -5
  132. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +1 -13
  133. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
  134. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
  135. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +1 -1
  136. package/bundled/skills/prizmkit-retrospective/SKILL.md +6 -4
  137. package/bundled/skills/prizmkit-test/SKILL.md +25 -133
  138. package/bundled/skills/prizmkit-test/references/independent-test-review.md +5 -2
  139. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +6 -0
  140. package/bundled/skills/prizmkit-workflow/SKILL.md +2 -3
  141. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +4 -3
  142. package/bundled/skills/recovery-workflow/SKILL.md +7 -7
  143. package/bundled/skills/recovery-workflow/evals/evals.json +1 -1
  144. package/bundled/skills/recovery-workflow/references/detection.md +1 -3
  145. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +0 -6
  146. package/bundled/templates/project-memory-template.md +1 -2
  147. package/package.json +1 -1
  148. package/src/ai-cli-launch.js +1 -1
  149. package/src/clean.js +40 -4
  150. package/src/config.js +64 -4
  151. package/src/detect-platform.js +10 -6
  152. package/src/external-skills.js +2 -2
  153. package/src/index.js +1 -0
  154. package/src/manifest.js +1 -1
  155. package/src/platforms.js +6 -2
  156. package/src/prompts.js +11 -3
  157. package/src/scaffold.js +87 -11
  158. package/src/upgrade.js +9 -3
  159. package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +0 -53
  160. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +0 -649
  161. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +0 -463
  162. package/bundled/dev-pipeline/scripts/update-refactor-status.py +0 -1512
  163. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +0 -240
  164. package/bundled/dev-pipeline/templates/refactor-list-schema.json +0 -266
  165. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +0 -15
  166. package/bundled/dev-pipeline/templates/sections/refactor-mission.md +0 -9
  167. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +0 -24
  168. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +0 -16
  169. package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +0 -9
  170. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +0 -22
  171. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +0 -19
  172. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +0 -24
  173. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +0 -12
  174. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -6
  175. package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +0 -52
  176. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +0 -478
  177. package/bundled/skills/feature-planner/assets/evaluation-guide.md +0 -44
  178. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +0 -219
  179. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +0 -78
  180. package/bundled/skills/refactor-planner/SKILL.md +0 -467
  181. package/bundled/skills/refactor-planner/assets/planning-guide.md +0 -291
  182. package/bundled/skills/refactor-planner/references/behavior-preservation.md +0 -187
  183. package/bundled/skills/refactor-planner/references/error-recovery.md +0 -45
  184. package/bundled/skills/refactor-planner/references/fast-path.md +0 -59
  185. package/bundled/skills/refactor-planner/references/generated-plan-review.md +0 -107
  186. package/bundled/skills/refactor-planner/references/planning-phases.md +0 -172
  187. package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +0 -230
  188. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +0 -1120
  189. package/bundled/skills/refactor-workflow/SKILL.md +0 -205
@@ -31,6 +31,8 @@ from continuation import append_continuation_handoff, checkpoint_cursor
31
31
  from prompt_framework import pipeline_checkpoint_metadata
32
32
  from utils import resolve_prompt_platform
33
33
 
34
+ PIPELINE_ROOT = Path(__file__).resolve().parents[1]
35
+
34
36
  REMOVED_MAX_LOG_ENV = "MAX_" + "LOG_SIZE"
35
37
  REMOVED_MAX_LOG_HUMAN = REMOVED_MAX_LOG_ENV + "_HUMAN"
36
38
 
@@ -631,13 +633,12 @@ class TestHeadlessRecoveryReframing:
631
633
  placeholder = "{{LOG_" + "SIZE_AWARENESS}}"
632
634
  deleted_title = "Session " + "Checkpoint Awareness"
633
635
  active_paths = [
634
- Path("dev-pipeline/scripts/generate-bootstrap-prompt.py"),
635
- Path("dev-pipeline/templates/bootstrap-tier3.md"),
636
- Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md"),
637
- Path("dev-pipeline/templates/refactor-bootstrap-prompt.md"),
636
+ PIPELINE_ROOT / "scripts" / "generate-bootstrap-prompt.py",
637
+ PIPELINE_ROOT / "templates" / "bootstrap-tier3.md",
638
+ PIPELINE_ROOT / "templates" / "bugfix-bootstrap-prompt.md",
638
639
  ]
639
640
 
640
- assert (Path("dev-pipeline/templates/sections") / deleted_section).exists() is False
641
+ assert (PIPELINE_ROOT / "templates" / "sections" / deleted_section).exists() is False
641
642
  for path in active_paths:
642
643
  content = path.read_text(encoding="utf-8")
643
644
  for forbidden in (deleted_section, loader, placeholder, deleted_title):
@@ -647,17 +648,17 @@ class TestHeadlessRecoveryReframing:
647
648
  deleted_section = "subagent-timeout-recovery.md"
648
649
  deleted_title = "Execution-Unit Timeout Recovery"
649
650
  active_paths = [
650
- Path("dev-pipeline/scripts/generate-bootstrap-prompt.py"),
651
- Path("dev-pipeline/templates/bootstrap-tier3.md"),
651
+ PIPELINE_ROOT / "scripts" / "generate-bootstrap-prompt.py",
652
+ PIPELINE_ROOT / "templates" / "bootstrap-tier3.md",
652
653
  ]
653
654
 
654
- assert (Path("dev-pipeline/templates/sections") / deleted_section).exists() is False
655
+ assert (PIPELINE_ROOT / "templates" / "sections" / deleted_section).exists() is False
655
656
  for path in active_paths:
656
657
  content = path.read_text(encoding="utf-8")
657
658
  assert deleted_section not in content
658
659
  assert deleted_title not in content
659
660
 
660
- sections_dir = Path("dev-pipeline/templates/sections").resolve()
661
+ sections_dir = (PIPELINE_ROOT / "templates" / "sections").resolve()
661
662
  rendered = "\n".join(
662
663
  section for _name, section in assemble_sections(
663
664
  str(sections_dir), init_done=True, browser_enabled=False,
@@ -666,7 +667,7 @@ class TestHeadlessRecoveryReframing:
666
667
  assert deleted_title not in rendered
667
668
 
668
669
  def test_assembled_prompts_do_not_spawn_log_monitor_or_require_compact(self):
669
- sections_dir = Path("dev-pipeline/templates/sections").resolve()
670
+ sections_dir = (PIPELINE_ROOT / "templates" / "sections").resolve()
670
671
  deleted_title = "Session " + "Checkpoint Awareness"
671
672
  placeholder = "{{LOG_" + "SIZE_AWARENESS}}"
672
673
 
@@ -692,7 +693,7 @@ class TestHeadlessRecoveryReframing:
692
693
 
693
694
  class TestDirectOrchestratorImplementationPrompts:
694
695
  def test_active_agent_prompt_loader_excludes_retired_dev_implement_prompt(self):
695
- templates_dir = Path("dev-pipeline/templates").resolve()
696
+ templates_dir = (PIPELINE_ROOT / "templates").resolve()
696
697
 
697
698
  replacements = load_active_agent_prompts(str(templates_dir))
698
699
 
@@ -710,7 +711,7 @@ class TestDirectOrchestratorImplementationPrompts:
710
711
  assert (templates_dir / "agent-prompts" / FORBIDDEN_DEV_RESUME_PROMPT).exists() is False
711
712
 
712
713
  def test_canonical_sections_use_direct_orchestrator_implementation(self):
713
- sections_dir = Path("dev-pipeline/templates/sections").resolve()
714
+ sections_dir = (PIPELINE_ROOT / "templates" / "sections").resolve()
714
715
 
715
716
  rendered = "\n".join(
716
717
  section for _name, section in assemble_sections(
@@ -746,14 +747,13 @@ class TestDirectOrchestratorImplementationPrompts:
746
747
  template="bootstrap-tier3.md",
747
748
  ),
748
749
  _render_bugfix_prompt(tmp_path / "bugfix"),
749
- _render_refactor_prompt(tmp_path / "refactor"),
750
750
  ]
751
751
 
752
752
  for prompt in prompts:
753
753
  assert_complete_prompt_rendering(prompt)
754
754
 
755
755
  def test_retained_tier3_fallback_template_uses_direct_orchestrator_implementation(self):
756
- rendered = Path("dev-pipeline/templates/bootstrap-tier3.md").read_text(encoding="utf-8")
756
+ rendered = (PIPELINE_ROOT / "templates" / "bootstrap-tier3.md").read_text(encoding="utf-8")
757
757
 
758
758
  assert "/prizmkit-implement" in rendered
759
759
  assert "Implement — Plan Execution" in rendered
@@ -919,7 +919,7 @@ def _render_feature_prompt(tmp_path, template=None, platform="claude", browser_i
919
919
  if template:
920
920
  template_path = Path(template)
921
921
  if not template_path.is_absolute():
922
- template_path = Path("dev-pipeline/templates") / template_path
922
+ template_path = (PIPELINE_ROOT / "templates") / template_path
923
923
  args.extend(["--template", str(template_path)])
924
924
  old_argv = os.sys.argv
925
925
  old_platform = os.environ.get("PRIZMKIT_PLATFORM")
@@ -1014,65 +1014,6 @@ def _render_bugfix_prompt(
1014
1014
  return output.read_text(encoding="utf-8")
1015
1015
 
1016
1016
 
1017
- def _render_refactor_prompt(tmp_path, platform="claude", explicit_platform=None, refactor_overrides=None):
1018
- from generate_refactor_prompt import main as refactor_main
1019
-
1020
- project = tmp_path / "refactor-project"
1021
- project.mkdir(parents=True)
1022
- (project / ".prizmkit").mkdir(exist_ok=True)
1023
- (project / ".prizmkit" / "config.json").write_text(
1024
- json.dumps({"platform": platform, "ai_cli": platform}), encoding="utf-8"
1025
- )
1026
- _ensure_skill_files(project)
1027
- refactor_list = project / ".prizmkit" / "plans" / "refactor-list.json"
1028
- refactor_list.parent.mkdir(parents=True)
1029
- refactor = {
1030
- "id": "R-001",
1031
- "title": "Restructure",
1032
- "description": "Preserve behavior",
1033
- "acceptance_criteria": ["Behavior preserved"],
1034
- "scope": {"files": ["src/a.py"], "modules": ["src"]},
1035
- }
1036
- if refactor_overrides:
1037
- refactor.update(refactor_overrides)
1038
- refactor_list.write_text(json.dumps({
1039
- "refactors": [refactor],
1040
- "global_context": {"language": "Python"},
1041
- }), encoding="utf-8")
1042
- output = project / "refactor-prompt.md"
1043
- old_argv = os.sys.argv
1044
- old_platform = os.environ.get("PRIZMKIT_PLATFORM")
1045
- try:
1046
- if explicit_platform is None:
1047
- os.environ.pop("PRIZMKIT_PLATFORM", None)
1048
- else:
1049
- os.environ["PRIZMKIT_PLATFORM"] = explicit_platform
1050
- os.sys.argv = [
1051
- "generate-refactor-prompt.py",
1052
- "--refactor-list", str(refactor_list),
1053
- "--refactor-id", "R-001",
1054
- "--session-id", "session-1",
1055
- "--run-id", "run-1",
1056
- "--retry-count", "0",
1057
- "--resume-phase", "null",
1058
- "--state-dir", str(project / ".prizmkit" / "state" / "refactor"),
1059
- "--project-root", str(project),
1060
- "--output", str(output),
1061
- ]
1062
- try:
1063
- refactor_main()
1064
- except SystemExit as exc:
1065
- if exc.code not in (0, None):
1066
- raise
1067
- finally:
1068
- os.sys.argv = old_argv
1069
- if old_platform is None:
1070
- os.environ.pop("PRIZMKIT_PLATFORM", None)
1071
- else:
1072
- os.environ["PRIZMKIT_PLATFORM"] = old_platform
1073
- return output.read_text(encoding="utf-8")
1074
-
1075
-
1076
1017
  class TestFeaturePromptCanonicalGuidance:
1077
1018
  def test_default_sections_prompt_uses_same_guidance_for_all_complexities(self, tmp_path):
1078
1019
  prompts = {
@@ -1181,7 +1122,7 @@ class TestFeaturePromptCanonicalGuidance:
1181
1122
 
1182
1123
 
1183
1124
  class TestBrowserBlockingPromptPolicy:
1184
- def test_feature_bugfix_refactor_blocking_browser_policy_stops_before_commit(self, tmp_path):
1125
+ def test_feature_and_bugfix_blocking_browser_policy_stops_before_commit(self, tmp_path):
1185
1126
  browser_interaction = {
1186
1127
  "tool": "auto",
1187
1128
  "blocking": True,
@@ -1190,13 +1131,11 @@ class TestBrowserBlockingPromptPolicy:
1190
1131
  prompts = [
1191
1132
  _render_feature_prompt(tmp_path / "feature-browser-blocking", browser_interaction=browser_interaction),
1192
1133
  _render_bugfix_prompt(tmp_path / "bugfix-browser-blocking", bug_overrides={"browser_interaction": browser_interaction}),
1193
- _render_refactor_prompt(tmp_path / "refactor-browser-blocking", refactor_overrides={"browser_interaction": browser_interaction}),
1194
1134
  ]
1195
1135
 
1196
1136
  test_markers = (
1197
1137
  "### Scoped Feature Test Gate — PrizmKit Test",
1198
1138
  "### Bugfix Test Gate — PrizmKit Test",
1199
- "### Refactor Test Gate — PrizmKit Test",
1200
1139
  )
1201
1140
  for prompt, test_marker in zip(prompts, test_markers, strict=True):
1202
1141
  assert "Browser blocking policy: `true`" in prompt
@@ -1204,7 +1143,7 @@ class TestBrowserBlockingPromptPolicy:
1204
1143
  assert "Failures do NOT block the commit" not in prompt
1205
1144
  assert prompt.index("### Browser Verification — MANDATORY") < prompt.index(test_marker)
1206
1145
 
1207
- def test_feature_bugfix_refactor_nonblocking_browser_policy_continues(self, tmp_path):
1146
+ def test_feature_and_bugfix_nonblocking_browser_policy_continues(self, tmp_path):
1208
1147
  browser_interaction = {
1209
1148
  "tool": "auto",
1210
1149
  "blocking": False,
@@ -1213,7 +1152,6 @@ class TestBrowserBlockingPromptPolicy:
1213
1152
  prompts = [
1214
1153
  _render_feature_prompt(tmp_path / "feature-browser-nonblocking", browser_interaction=browser_interaction),
1215
1154
  _render_bugfix_prompt(tmp_path / "bugfix-browser-nonblocking", bug_overrides={"browser_interaction": browser_interaction}),
1216
- _render_refactor_prompt(tmp_path / "refactor-browser-nonblocking", refactor_overrides={"browser_interaction": browser_interaction}),
1217
1155
  ]
1218
1156
 
1219
1157
  for prompt in prompts:
@@ -1241,14 +1179,7 @@ class TestBrowserOptInPromptPolicy:
1241
1179
  if browser_interaction is not None else None
1242
1180
  ),
1243
1181
  )
1244
- refactor_prompt = _render_refactor_prompt(
1245
- tmp_path / "refactor",
1246
- refactor_overrides=(
1247
- {"browser_interaction": browser_interaction}
1248
- if browser_interaction is not None else None
1249
- ),
1250
- )
1251
- return feature_prompt, bugfix_prompt, refactor_prompt
1182
+ return feature_prompt, bugfix_prompt
1252
1183
  finally:
1253
1184
  if previous_env is None:
1254
1185
  os.environ.pop("BROWSER_VERIFY", None)
@@ -1262,7 +1193,7 @@ class TestBrowserOptInPromptPolicy:
1262
1193
  elif family == "bugfix":
1263
1194
  pattern = "**/bugfix/B-001/workflow-checkpoint.json"
1264
1195
  else:
1265
- pattern = "**/refactor/R-001/workflow-checkpoint.json"
1196
+ raise ValueError(f"Unsupported family: {family}")
1266
1197
  path = next(project_root.glob(pattern))
1267
1198
  return [step["skill"] for step in json.loads(path.read_text(encoding="utf-8"))["steps"]]
1268
1199
 
@@ -1278,7 +1209,6 @@ class TestBrowserOptInPromptPolicy:
1278
1209
 
1279
1210
  assert "browser-verification" not in self._checkpoint_skills(tmp_path / "omitted" / "feature", "feature")
1280
1211
  assert "browser-verification" not in self._checkpoint_skills(tmp_path / "omitted" / "bugfix", "bugfix")
1281
- assert "browser-verification" not in self._checkpoint_skills(tmp_path / "omitted" / "refactor", "refactor")
1282
1212
 
1283
1213
  def test_explicit_browser_interaction_preserves_configuration_for_all_families(self, tmp_path):
1284
1214
  browser_interaction = {
@@ -1297,7 +1227,6 @@ class TestBrowserOptInPromptPolicy:
1297
1227
 
1298
1228
  assert "browser-verification" in self._checkpoint_skills(tmp_path / "explicit" / "feature", "feature")
1299
1229
  assert "browser-verification" in self._checkpoint_skills(tmp_path / "explicit" / "bugfix", "bugfix")
1300
- assert "browser-verification" in self._checkpoint_skills(tmp_path / "explicit" / "refactor", "refactor")
1301
1230
 
1302
1231
  def test_global_disable_suppresses_explicit_browser_for_all_families(self, tmp_path):
1303
1232
  prompts = self._rendered_outputs(
@@ -1313,7 +1242,6 @@ class TestBrowserOptInPromptPolicy:
1313
1242
 
1314
1243
  assert "browser-verification" not in self._checkpoint_skills(tmp_path / "global-disable" / "feature", "feature")
1315
1244
  assert "browser-verification" not in self._checkpoint_skills(tmp_path / "global-disable" / "bugfix", "bugfix")
1316
- assert "browser-verification" not in self._checkpoint_skills(tmp_path / "global-disable" / "refactor", "refactor")
1317
1245
 
1318
1246
  def test_manual_bugfix_prompt_remains_headless_and_committable(self, tmp_path):
1319
1247
  prompt = _render_bugfix_prompt(
@@ -1342,14 +1270,13 @@ class TestBrowserOptInPromptPolicy:
1342
1270
 
1343
1271
 
1344
1272
  class TestHeadlessPromptCleanupF033:
1345
- def test_rendered_feature_bugfix_refactor_prompts_are_clean(self, tmp_path):
1273
+ def test_rendered_feature_and_bugfix_prompts_are_clean(self, tmp_path):
1346
1274
  prompts = [
1347
1275
  _render_feature_prompt(tmp_path / "low", complexity="low"),
1348
1276
  _render_feature_prompt(tmp_path / "medium", complexity="medium"),
1349
1277
  _render_feature_prompt(tmp_path / "high", complexity="high"),
1350
1278
  ]
1351
1279
  prompts.append(_render_bugfix_prompt(tmp_path))
1352
- prompts.append(_render_refactor_prompt(tmp_path))
1353
1280
 
1354
1281
  for prompt in prompts:
1355
1282
  for forbidden in HEADLESS_FORBIDDEN_PROMPT_STRINGS:
@@ -1360,26 +1287,19 @@ class TestHeadlessPromptCleanupF033:
1360
1287
  assert "test-result.json" in prompt
1361
1288
  assert "{{RUNTIME_HELPER_CMD}}" not in prompt
1362
1289
  assert "prizmkit-runtime-helper.py" in prompt
1363
- # Anti-Bash guardrails for bugfix/refactor branches (F-039)
1290
+ # Anti-Bash guardrails for bugfix branches (F-039)
1364
1291
  if "Bug ID" in prompt:
1365
1292
  assert "{{RUNTIME_HELPER_CMD}}" not in prompt
1366
1293
  assert "prizmkit-runtime-helper.py" in prompt
1367
1294
  assert "2>/dev/null" not in prompt
1368
1295
  assert "lsof -ti" not in prompt
1369
1296
  assert "which " not in prompt # no which-command shell glue
1370
- if "Refactor ID" in prompt:
1371
- assert "{{RUNTIME_HELPER_CMD}}" not in prompt
1372
- assert "prizmkit-runtime-helper.py" in prompt
1373
- assert "2>/dev/null" not in prompt
1374
- assert "lsof -ti" not in prompt
1375
- assert "which " not in prompt # no which-command shell glue
1376
1297
  assert "python3 {{INIT_SCRIPT_PATH}}" not in prompt
1377
1298
 
1378
1299
  def test_all_families_render_shared_manifest_and_precommit_order(self, tmp_path):
1379
1300
  prompts = {
1380
1301
  "feature": _render_feature_prompt(tmp_path / "manifest-feature"),
1381
1302
  "bugfix": _render_bugfix_prompt(tmp_path / "manifest-bugfix"),
1382
- "refactor": _render_refactor_prompt(tmp_path / "manifest-refactor"),
1383
1303
  }
1384
1304
  common_artifacts = (
1385
1305
  "spec.md",
@@ -1396,7 +1316,6 @@ class TestHeadlessPromptCleanupF033:
1396
1316
  test_markers = {
1397
1317
  "feature": "### Scoped Feature Test Gate — PrizmKit Test",
1398
1318
  "bugfix": "### Bugfix Test Gate — PrizmKit Test",
1399
- "refactor": "### Refactor Test Gate — PrizmKit Test",
1400
1319
  }
1401
1320
  for family, prompt in prompts.items():
1402
1321
  assert "## Requirement Artifact Manifest" in prompt
@@ -1418,7 +1337,6 @@ class TestHeadlessPromptCleanupF033:
1418
1337
 
1419
1338
  assert prompts["feature"].index("### Feature Completion Summary") < prompts["feature"].index("### Retrospective")
1420
1339
  assert prompts["bugfix"].index("### Bug Fix Report") < prompts["bugfix"].index("### Retrospective")
1421
- assert prompts["refactor"].index("### Refactor Report") < prompts["refactor"].index("### Retrospective")
1422
1340
 
1423
1341
  def test_retained_tier3_template_is_clean_when_rendered(self, tmp_path):
1424
1342
  prompt = _render_feature_prompt(tmp_path / "bootstrap-tier3.md", template="bootstrap-tier3.md")
@@ -1434,8 +1352,8 @@ class TestHeadlessPromptCleanupF033:
1434
1352
  assert "prizmkit-runtime-helper.py" in prompt
1435
1353
 
1436
1354
  def test_retired_tier1_tier2_templates_are_removed(self):
1437
- assert not Path("dev-pipeline/templates/bootstrap-tier1.md").exists()
1438
- assert not Path("dev-pipeline/templates/bootstrap-tier2.md").exists()
1355
+ assert not (PIPELINE_ROOT / "templates" / "bootstrap-tier1.md").exists()
1356
+ assert not (PIPELINE_ROOT / "templates" / "bootstrap-tier2.md").exists()
1439
1357
 
1440
1358
  def test_retained_tier3_template_with_browser_blocks_is_shell_free(self, tmp_path):
1441
1359
  forbidden = [
@@ -1458,7 +1376,7 @@ class TestHeadlessPromptCleanupF033:
1458
1376
  for snippet in forbidden:
1459
1377
  assert snippet not in prompt
1460
1378
 
1461
- def test_bugfix_refactor_share_claude_platform_resolution(self, tmp_path, monkeypatch):
1379
+ def test_bugfix_claude_platform_resolution(self, tmp_path, monkeypatch):
1462
1380
  from generate_bugfix_prompt import build_replacements as bugfix_build_replacements
1463
1381
 
1464
1382
  monkeypatch.delenv("PRIZMKIT_PLATFORM", raising=False)
@@ -1475,16 +1393,16 @@ class TestHeadlessPromptCleanupF033:
1475
1393
  output="out.md", project_root=str(bug_project), template=None,
1476
1394
  )
1477
1395
  replacements = bugfix_build_replacements(
1478
- args, {"id": "B-001", "title": "Broken"}, {}, str(Path("dev-pipeline/scripts").resolve())
1396
+ args, {"id": "B-001", "title": "Broken"}, {}, str((PIPELINE_ROOT / "scripts").resolve())
1479
1397
  )
1480
- refactor_prompt = _render_refactor_prompt(tmp_path / "refactor-mixed", platform="claude")
1398
+ bugfix_prompt = _render_bugfix_prompt(tmp_path / "bugfix-mixed", platform="claude")
1481
1399
 
1482
1400
  assert "{{" + "REVIEWER_" + "SUBAGENT_PATH" + "}}" not in replacements
1483
- assert "review-report.md" in refactor_prompt
1484
- assert "Final Result" in refactor_prompt
1485
- assert "Reviewer 3" not in refactor_prompt
1401
+ assert "review-report.md" in bugfix_prompt
1402
+ assert "Final Result" in bugfix_prompt
1403
+ assert "Reviewer 3" not in bugfix_prompt
1486
1404
 
1487
- def test_bugfix_refactor_explicit_codex_override(self, tmp_path, monkeypatch):
1405
+ def test_bugfix_explicit_codex_override(self, tmp_path, monkeypatch):
1488
1406
  from generate_bugfix_prompt import build_replacements as bugfix_build_replacements
1489
1407
 
1490
1408
  bug_project = tmp_path / "bugfix-codex-replacements"
@@ -1497,14 +1415,14 @@ class TestHeadlessPromptCleanupF033:
1497
1415
  output="out.md", project_root=str(bug_project), template=None,
1498
1416
  )
1499
1417
  replacements = bugfix_build_replacements(
1500
- args, {"id": "B-001", "title": "Broken"}, {}, str(Path("dev-pipeline/scripts").resolve())
1418
+ args, {"id": "B-001", "title": "Broken"}, {}, str((PIPELINE_ROOT / "scripts").resolve())
1501
1419
  )
1502
- refactor_prompt = _render_refactor_prompt(tmp_path / "refactor-codex", platform="claude", explicit_platform="codex")
1420
+ bugfix_prompt = _render_bugfix_prompt(tmp_path / "bugfix-codex", platform="claude", explicit_platform="codex")
1503
1421
 
1504
1422
  assert "{{" + "REVIEWER_" + "SUBAGENT_PATH" + "}}" not in replacements
1505
- assert "review-report.md" in refactor_prompt
1506
- assert "Final Result" in refactor_prompt
1507
- assert "Reviewer 3" not in refactor_prompt
1423
+ assert "review-report.md" in bugfix_prompt
1424
+ assert "Final Result" in bugfix_prompt
1425
+ assert "Reviewer 3" not in bugfix_prompt
1508
1426
 
1509
1427
 
1510
1428
  class TestFeatureBootstrapShellExtraction:
@@ -1710,3 +1628,27 @@ def test_feature_checkpoint_generation_skips_noop_and_preserves_finalization_ord
1710
1628
  ]
1711
1629
  assert checkpoint["steps"][0]["depends_on"] is None
1712
1630
  assert checkpoint["steps"][1]["depends_on"] == "S01"
1631
+
1632
+
1633
+ def test_feature_test_pass_with_production_changed_routes_to_delta_review():
1634
+ delta = route_feature_repair("TEST_PASS", repair_round=1, production_changed=True)
1635
+ assert delta["blocked"] is False
1636
+ assert delta["resumable"] is True
1637
+ assert delta["next_stage"] == "prizmkit-code-review"
1638
+ assert delta["resume_from"] == "prizmkit-code-review"
1639
+ assert delta["route"] == ["prizmkit-code-review", "prizmkit-test"]
1640
+ assert delta["repair_round"] == 2
1641
+ assert delta["repair_scope"] == "production"
1642
+
1643
+ exhausted = route_feature_repair("TEST_PASS", repair_round=3, production_changed=True)
1644
+ assert exhausted["blocked"] is True
1645
+ assert exhausted["resumable"] is False
1646
+ assert exhausted["blocked_reason"] == "repair_round_limit"
1647
+ assert exhausted["terminal_status"] == "WORKFLOW_BLOCKED"
1648
+
1649
+
1650
+ def test_phase_plan_section_reuses_step_a_context():
1651
+ sections_dir = Path(__file__).resolve().parents[1] / "templates" / "sections"
1652
+ specify_plan = (sections_dir / "phase-specify-plan-full.md").read_text(encoding="utf-8")
1653
+ assert 'text search . --pattern "{{FEATURE_SLUG}}"' not in specify_plan
1654
+ assert "context-snapshot.md" in specify_plan
@@ -22,6 +22,8 @@ from generate_bugfix_prompt import (
22
22
  )
23
23
  from continuation import append_continuation_handoff
24
24
 
25
+ PIPELINE_ROOT = Path(__file__).resolve().parents[1]
26
+
25
27
  REMOVED_MAX_LOG_ENV = "MAX_" + "LOG_SIZE"
26
28
  REMOVED_MAX_LOG_HUMAN = REMOVED_MAX_LOG_ENV + "_HUMAN"
27
29
 
@@ -235,16 +237,16 @@ class TestHeadlessRecoveryReframing:
235
237
  loader = "load_" + "log_size_section"
236
238
  placeholder = "{{LOG_" + "SIZE_AWARENESS}}"
237
239
  deleted_title = "Session " + "Checkpoint Awareness"
238
- source = Path("dev-pipeline/scripts/generate-bugfix-prompt.py").read_text(encoding="utf-8")
239
- template = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
240
+ source = (PIPELINE_ROOT / "scripts" / "generate-bugfix-prompt.py").read_text(encoding="utf-8")
241
+ template = (PIPELINE_ROOT / "templates" / "bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
240
242
 
241
- assert (Path("dev-pipeline/templates/sections") / deleted_section).exists() is False
243
+ assert (PIPELINE_ROOT / "templates" / "sections" / deleted_section).exists() is False
242
244
  for content in (source, template):
243
245
  for forbidden in (deleted_section, loader, placeholder, deleted_title):
244
246
  assert forbidden not in content
245
247
 
246
248
  def test_bugfix_template_does_not_spawn_monitor_or_require_compact(self):
247
- content = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
249
+ content = (PIPELINE_ROOT / "templates" / "bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
248
250
 
249
251
  assert "On execution-unit timeout, preserve the active checkout and artifacts" in content
250
252
  assert "follow the owning contract's recovery or downgrade path" in content
@@ -310,7 +312,7 @@ HEADLESS_FORBIDDEN_PROMPT_STRINGS = [
310
312
 
311
313
 
312
314
  def test_template_source_is_clean_for_headless_prompt_contract():
313
- content = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
315
+ content = (PIPELINE_ROOT / "templates" / "bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
314
316
  for forbidden in HEADLESS_FORBIDDEN_PROMPT_STRINGS:
315
317
  assert forbidden not in content
316
318
  assert "FAST_PATH=true" not in content
@@ -322,7 +324,7 @@ def test_template_source_is_clean_for_headless_prompt_contract():
322
324
 
323
325
 
324
326
  def test_bugfix_prompt_keeps_fine_grained_phases_out_of_external_status_contract():
325
- content = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
327
+ content = (PIPELINE_ROOT / "templates" / "bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
326
328
  old_statuses = ["triaging", "reproducing", "fixing", "verifying"]
327
329
 
328
330
  assert "external bug-list status field" in content
@@ -446,17 +448,17 @@ class TestBugfixBootstrapShellExtraction:
446
448
  assert "text final-verdict .prizmkit/bugfix/B-001/review-report.md" in prompt
447
449
 
448
450
  def test_bugfix_template_source_is_clean_of_helper_covered_snippets(self):
449
- content = Path("dev-pipeline/templates/bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
451
+ content = (PIPELINE_ROOT / "templates" / "bugfix-bootstrap-prompt.md").read_text(encoding="utf-8")
450
452
  for snippet in RETIRED_EXTRACTED_SNIPPETS_BUGFIX:
451
453
  assert snippet not in content, f"Shell snippet in bugfix template: {snippet}"
452
454
 
453
455
  def test_continuation_source_is_clean_of_helper_covered_snippets(self):
454
- content = Path("dev-pipeline/scripts/continuation.py").read_text(encoding="utf-8")
456
+ content = (PIPELINE_ROOT / "scripts" / "continuation.py").read_text(encoding="utf-8")
455
457
  for snippet in RETIRED_EXTRACTED_SNIPPETS_BUGFIX:
456
458
  assert snippet not in content, f"Shell snippet in continuation.py: {snippet}"
457
459
 
458
460
  def test_bugfix_generator_source_is_clean_of_helper_covered_snippets(self):
459
- content = Path("dev-pipeline/scripts/generate-bugfix-prompt.py").read_text(encoding="utf-8")
461
+ content = (PIPELINE_ROOT / "scripts" / "generate-bugfix-prompt.py").read_text(encoding="utf-8")
460
462
  for snippet in RETIRED_EXTRACTED_SNIPPETS_BUGFIX:
461
463
  assert snippet not in content, f"Shell snippet in generate-bugfix-prompt.py: {snippet}"
462
464
 
@@ -556,7 +558,7 @@ class TestBugfixCheckpointGeneration:
556
558
 
557
559
  def test_manual_bugfix_uses_automatic_verification_and_keeps_commit_gate(self):
558
560
  sections = assemble_bugfix_sections(
559
- "dev-pipeline/templates/sections", False, True,
561
+ str(PIPELINE_ROOT / "templates" / "sections"), False, True,
560
562
  )
561
563
  names = [name for name, _ in sections]
562
564