prizmkit 1.1.196 → 1.1.197
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.
- package/bin/create-prizmkit.js +0 -2
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/antigravity/assets/prizmkit-hook.cjs +1 -1
- package/bundled/adapters/antigravity/rules-adapter.js +1 -13
- package/bundled/adapters/claude/paths.js +0 -1
- package/bundled/adapters/codex/paths.js +0 -1
- package/bundled/adapters/codex/settings-adapter.js +1 -1
- package/bundled/adapters/cursor/assets/prizmkit-hook.cjs +1 -1
- package/bundled/adapters/cursor/rules-adapter.js +1 -13
- package/bundled/adapters/pi/paths.js +0 -1
- package/bundled/dev-pipeline/.env.example +2 -2
- package/bundled/dev-pipeline/README.md +6 -5
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +2 -2
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +15 -25
- package/bundled/dev-pipeline/prizmkit_runtime/iterate.py +1 -69
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +1 -114
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +2 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +78 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +4 -234
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +0 -5
- package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +9 -1
- package/bundled/dev-pipeline/scripts/feature_list_contract.py +0 -43
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +15 -76
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +9 -112
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +0 -13
- package/bundled/dev-pipeline/scripts/init-pipeline.py +0 -1
- package/bundled/dev-pipeline/scripts/prompt_framework.py +0 -79
- package/bundled/dev-pipeline/scripts/status_common.py +150 -4
- package/bundled/dev-pipeline/scripts/update-bug-status.py +20 -2
- package/bundled/dev-pipeline/scripts/update-feature-status.py +20 -2
- package/bundled/dev-pipeline/scripts/utils.py +6 -0
- package/bundled/dev-pipeline/templates/bootstrap-prompt.md +4 -5
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +5 -101
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +0 -35
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +4 -52
- package/bundled/dev-pipeline/templates/feature-list-schema.json +0 -25
- package/bundled/dev-pipeline/templates/iterate/evaluate-prompt.md +5 -16
- package/bundled/dev-pipeline/templates/iterate/evaluation-schema.json +1 -58
- package/bundled/dev-pipeline/templates/iterate/headless-plan-prompt.md +1 -12
- package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +0 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +0 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +2 -2
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +0 -2
- package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +0 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-task-contract.md +0 -5
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -2
- package/bundled/dev-pipeline/templates/sections/feature-completion-summary.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +3 -3
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +3 -3
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +3 -3
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +1 -1
- package/bundled/dev-pipeline/templates/sections/retrospective.md +3 -3
- package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +1 -1
- package/bundled/rules/USAGE.md +5 -19
- package/bundled/rules/general/coding-baseline.md +2 -2
- package/bundled/rules/prizm/prizm-progressive-loading.md +2 -1
- package/bundled/skills/_metadata.json +4 -4
- package/bundled/skills/app-planner/SKILL.md +1 -1
- package/bundled/skills/app-planner/references/generated-plan-review.md +1 -1
- package/bundled/skills/app-planner/references/rules-configuration.md +6 -7
- package/bundled/skills/app-planner/scripts/validate-rules-configuration.py +2 -20
- package/bundled/skills/bug-planner/SKILL.md +5 -6
- package/bundled/skills/bug-planner/assets/bug-confirmation-template.md +1 -1
- package/bundled/skills/bug-planner/references/input-formats.md +2 -2
- package/bundled/skills/bug-planner/references/schema-validation.md +0 -1
- package/bundled/skills/bug-planner/scripts/validate-bug-list.py +2 -9
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +36 -25
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +32 -26
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +33 -25
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +32 -26
- package/bundled/skills/feature-planner/SKILL.md +4 -10
- package/bundled/skills/feature-planner/references/completeness-review.md +2 -2
- package/bundled/skills/feature-planner/references/new-project-planning.md +0 -1
- package/bundled/skills/feature-planner/scripts/validate-and-generate.py +1 -25
- package/bundled/skills/iterate-pipeline-launcher/SKILL.md +53 -42
- package/bundled/skills/iterate-pipeline-launcher/references/configuration.md +47 -43
- package/bundled/skills/prizmkit-code-review/SKILL.md +1 -1
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +2 -2
- package/bundled/skills/prizmkit-implement/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +6 -7
- package/bundled/skills/prizmkit-init/references/config-schema.md +5 -9
- package/bundled/skills/prizmkit-init/references/rules/layer-detection.md +1 -1
- package/bundled/skills/prizmkit-plan/SKILL.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +3 -3
- package/bundled/skills/prizmkit-retrospective/references/rule-evolution-steps.md +11 -17
- package/bundled/skills/prizmkit-workflow/SKILL.md +6 -3
- package/bundled/skills/prizmkit-workflow/references/cold-start-rules.md +8 -7
- package/bundled/templates/project-memory-template.md +2 -1
- package/package.json +1 -1
- package/src/clean.js +29 -7
- package/src/config.js +13 -15
- package/src/index.js +1 -5
- package/src/manifest.js +3 -6
- package/src/platforms.js +0 -14
- package/src/scaffold.js +93 -313
- package/src/upgrade.js +32 -31
- package/bundled/adapters/claude/rules-adapter.js +0 -25
- package/bundled/adapters/codebuddy/rules-adapter.js +0 -30
- package/bundled/adapters/codex/rules-adapter.js +0 -30
- package/bundled/adapters/pi/rules-adapter.js +0 -13
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +0 -10
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +0 -111
- package/bundled/skills/bug-planner/references/verification.md +0 -26
- package/bundled/skills/feature-planner/references/browser-interaction.md +0 -39
|
@@ -28,11 +28,9 @@ from utils import enrich_global_context, helper_replacements, load_json_file, re
|
|
|
28
28
|
from continuation import add_continuation_args, append_continuation_handoff, is_continuation
|
|
29
29
|
from prompt_framework import (
|
|
30
30
|
artifact_exists,
|
|
31
|
-
browser_enabled_from_item,
|
|
32
31
|
checkpoint_skip,
|
|
33
32
|
checkpoint_step,
|
|
34
33
|
completed_test_artifacts_valid,
|
|
35
|
-
detect_dev_server_port,
|
|
36
34
|
generate_checkpoint_from_sections,
|
|
37
35
|
merge_checkpoint_state as merge_shared_checkpoint_state,
|
|
38
36
|
pipeline_checkpoint_metadata,
|
|
@@ -513,9 +511,8 @@ def process_conditional_blocks(content, resume_phase):
|
|
|
513
511
|
return content
|
|
514
512
|
|
|
515
513
|
|
|
516
|
-
def process_template_blocks(content, init_done
|
|
517
|
-
|
|
518
|
-
"""Process init and browser blocks in an explicit custom template."""
|
|
514
|
+
def process_template_blocks(content, init_done):
|
|
515
|
+
"""Process init blocks in an explicit custom template."""
|
|
519
516
|
# Init blocks
|
|
520
517
|
if init_done:
|
|
521
518
|
content = re.sub(r"\{\{IF_INIT_DONE\}\}\n?", "", content)
|
|
@@ -532,30 +529,6 @@ def process_template_blocks(content, init_done, browser_interaction=False,
|
|
|
532
529
|
"", content, flags=re.DOTALL,
|
|
533
530
|
)
|
|
534
531
|
|
|
535
|
-
# Browser interaction blocks
|
|
536
|
-
browser_open = "{{IF_BROWSER_INTERACTION}}"
|
|
537
|
-
browser_close = "{{END_IF_BROWSER_INTERACTION}}"
|
|
538
|
-
if browser_interaction:
|
|
539
|
-
content = content.replace(browser_open + "\n", "")
|
|
540
|
-
content = content.replace(browser_open, "")
|
|
541
|
-
content = content.replace(browser_close + "\n", "")
|
|
542
|
-
content = content.replace(browser_close, "")
|
|
543
|
-
else:
|
|
544
|
-
pattern = re.escape(browser_open) + r".*?" + re.escape(browser_close) + r"\n?"
|
|
545
|
-
content = re.sub(pattern, "", content, flags=re.DOTALL)
|
|
546
|
-
|
|
547
|
-
# Unwrap optional legacy PLAYWRIGHT conditional block when browser verification is enabled
|
|
548
|
-
tool_open = "{{IF_BROWSER_TOOL_PLAYWRIGHT}}"
|
|
549
|
-
tool_close = "{{END_IF_BROWSER_TOOL_PLAYWRIGHT}}"
|
|
550
|
-
if browser_interaction:
|
|
551
|
-
content = content.replace(tool_open + "\n", "")
|
|
552
|
-
content = content.replace(tool_open, "")
|
|
553
|
-
content = content.replace(tool_close + "\n", "")
|
|
554
|
-
content = content.replace(tool_close, "")
|
|
555
|
-
else:
|
|
556
|
-
pat = re.escape(tool_open) + r".*?" + re.escape(tool_close) + r"\n?"
|
|
557
|
-
content = re.sub(pat, "", content, flags=re.DOTALL)
|
|
558
|
-
|
|
559
532
|
return content
|
|
560
533
|
|
|
561
534
|
|
|
@@ -621,7 +594,6 @@ SECTION_TO_SKILL = {
|
|
|
621
594
|
"prizmkit-code-review", "Code Review",
|
|
622
595
|
[".prizmkit/specs/{slug}/review-report.md"],
|
|
623
596
|
),
|
|
624
|
-
"phase-browser": checkpoint_step("browser-verification", "Browser Verification", []),
|
|
625
597
|
"feature-completion-summary": checkpoint_step(
|
|
626
598
|
"completion-summary", "Completion Summary",
|
|
627
599
|
[".prizmkit/specs/{slug}/completion-summary.json"],
|
|
@@ -675,22 +647,18 @@ def _completed_step_artifacts_valid(project_root, skill_key, artifacts):
|
|
|
675
647
|
return all(artifact_exists(project_root, artifact) for artifact in artifacts)
|
|
676
648
|
|
|
677
649
|
|
|
678
|
-
def _compatibility_checkpoint_sections(init_done=False
|
|
650
|
+
def _compatibility_checkpoint_sections(init_done=False):
|
|
679
651
|
"""Return the canonical stage skeleton for an explicit custom template."""
|
|
680
652
|
sections = [
|
|
681
653
|
("phase0-test-baseline" if init_done else "phase0-init", ""),
|
|
682
654
|
("phase-specify-plan", ""),
|
|
683
655
|
("phase-implement", ""),
|
|
684
656
|
("phase-review", ""),
|
|
685
|
-
]
|
|
686
|
-
if browser_enabled:
|
|
687
|
-
sections.append(("phase-browser", ""))
|
|
688
|
-
sections.extend([
|
|
689
657
|
("phase-prizmkit-test", ""),
|
|
690
658
|
("feature-completion-summary", ""),
|
|
691
659
|
("phase-commit", ""),
|
|
692
660
|
("runtime-commit-handoff", ""),
|
|
693
|
-
]
|
|
661
|
+
]
|
|
694
662
|
return sections
|
|
695
663
|
|
|
696
664
|
|
|
@@ -783,7 +751,7 @@ def _canonical_reminders():
|
|
|
783
751
|
"""Return family-neutral reminders for the canonical guidance profile."""
|
|
784
752
|
lines = [
|
|
785
753
|
"## Reminders\n",
|
|
786
|
-
"- Every formal lifecycle stage is mandatory
|
|
754
|
+
"- Every formal lifecycle stage is mandatory.",
|
|
787
755
|
"- Use context-snapshot.md for navigation and handoff, then inspect current source and diffs when correctness requires it.",
|
|
788
756
|
"- Code Review writes only review-report.md and `/prizmkit-test` exclusively owns the test repair loop and terminal test artifacts.",
|
|
789
757
|
"- Atomic Skills return stage-local results only; this injected session owns checkpoint mapping and routing.",
|
|
@@ -794,9 +762,8 @@ def _canonical_reminders():
|
|
|
794
762
|
return "\n".join(lines) + "\n"
|
|
795
763
|
|
|
796
764
|
|
|
797
|
-
def assemble_sections(sections_dir, init_done
|
|
798
|
-
|
|
799
|
-
"""Assemble the canonical prompt sections and configured optional gates."""
|
|
765
|
+
def assemble_sections(sections_dir, init_done):
|
|
766
|
+
"""Assemble the canonical prompt sections."""
|
|
800
767
|
sections = []
|
|
801
768
|
|
|
802
769
|
title, guidance_desc = _canonical_header()
|
|
@@ -849,10 +816,6 @@ def assemble_sections(sections_dir, init_done, browser_enabled,
|
|
|
849
816
|
sections.append(("phase-review",
|
|
850
817
|
load_section(sections_dir, "phase-review-full.md")))
|
|
851
818
|
|
|
852
|
-
if browser_enabled:
|
|
853
|
-
sections.append(("phase-browser",
|
|
854
|
-
load_section(sections_dir, "phase-browser-verification.md")))
|
|
855
|
-
|
|
856
819
|
sections.append(("phase-prizmkit-test",
|
|
857
820
|
load_section(sections_dir, "phase-prizmkit-test.md")))
|
|
858
821
|
sections.append(("feature-completion-summary",
|
|
@@ -981,13 +944,6 @@ def build_replacements(args, feature, features, global_context, script_dir):
|
|
|
981
944
|
if effective_resume == "null" and artifacts["all_complete"]:
|
|
982
945
|
effective_resume = "6"
|
|
983
946
|
|
|
984
|
-
|
|
985
|
-
# Browser verification is opt-in through a browser_interaction object and
|
|
986
|
-
# can always be disabled globally with BROWSER_VERIFY=false.
|
|
987
|
-
browser_enabled, browser_tool, browser_verify_steps, browser_blocking = browser_enabled_from_item(
|
|
988
|
-
feature, logger=LOGGER,
|
|
989
|
-
)
|
|
990
|
-
|
|
991
947
|
# Auto-detect test commands from project structure
|
|
992
948
|
test_cmd = detect_test_commands(project_root)
|
|
993
949
|
if not test_cmd:
|
|
@@ -1004,11 +960,6 @@ def build_replacements(args, feature, features, global_context, script_dir):
|
|
|
1004
960
|
if isinstance(testing_config, dict):
|
|
1005
961
|
coverage_target = str(testing_config.get("coverage_target", 80))
|
|
1006
962
|
|
|
1007
|
-
# Detect dev server port from project config. Do not guess a default port;
|
|
1008
|
-
# browser prompt sections require the agent to discover it when unknown.
|
|
1009
|
-
dev_port = detect_dev_server_port(project_root)
|
|
1010
|
-
dev_url = "http://localhost:{}".format(dev_port) if dev_port.isdigit() else "<UNKNOWN_DETECT_FROM_PROJECT_CONFIG>"
|
|
1011
|
-
|
|
1012
963
|
replacements = {
|
|
1013
964
|
"{{RUN_ID}}": args.run_id,
|
|
1014
965
|
"{{SESSION_ID}}": args.session_id,
|
|
@@ -1041,17 +992,12 @@ def build_replacements(args, feature, features, global_context, script_dir):
|
|
|
1041
992
|
"{{INIT_DONE}}": "true" if init_done else "false",
|
|
1042
993
|
"{{HAS_SPEC}}": "true" if artifacts["has_spec"] else "false",
|
|
1043
994
|
"{{HAS_PLAN}}": "true" if artifacts["has_plan"] else "false",
|
|
1044
|
-
"{{BROWSER_VERIFY_STEPS}}": browser_verify_steps,
|
|
1045
|
-
"{{BROWSER_TOOL}}": browser_tool,
|
|
1046
|
-
"{{BROWSER_BLOCKING}}": "true" if browser_blocking else "false",
|
|
1047
995
|
"{{AC_CHECKLIST}}": format_ac_checklist(
|
|
1048
996
|
feature.get("acceptance_criteria", [])
|
|
1049
997
|
),
|
|
1050
998
|
"{{TEST_CMD}}": test_cmd,
|
|
1051
999
|
"{{BASELINE_FAILURES}}": baseline_failures,
|
|
1052
1000
|
"{{COVERAGE_TARGET}}": coverage_target,
|
|
1053
|
-
"{{DEV_PORT}}": dev_port,
|
|
1054
|
-
"{{DEV_URL}}": dev_url,
|
|
1055
1001
|
"{{SESSION_LOG_PATH}}": os.path.join(
|
|
1056
1002
|
".prizmkit", "state", "features", args.feature_id,
|
|
1057
1003
|
"sessions", args.session_id, "logs", "session.log",
|
|
@@ -1060,20 +1006,17 @@ def build_replacements(args, feature, features, global_context, script_dir):
|
|
|
1060
1006
|
|
|
1061
1007
|
replacements.update(helper_replacements(script_dir))
|
|
1062
1008
|
|
|
1063
|
-
return replacements, effective_resume
|
|
1009
|
+
return replacements, effective_resume
|
|
1064
1010
|
|
|
1065
1011
|
|
|
1066
|
-
def render_template(template_content, replacements, resume_phase
|
|
1067
|
-
browser_enabled=False, browser_tool="playwright-cli"):
|
|
1012
|
+
def render_template(template_content, replacements, resume_phase):
|
|
1068
1013
|
"""Render the template by processing conditionals and replacing placeholders."""
|
|
1069
1014
|
# Step 1: Process fresh_start/resume conditional blocks
|
|
1070
1015
|
content = process_conditional_blocks(template_content, resume_phase)
|
|
1071
1016
|
|
|
1072
|
-
# Step 2: Process mode
|
|
1017
|
+
# Step 2: Process mode and init conditional blocks
|
|
1073
1018
|
init_done = replacements.get("{{INIT_DONE}}", "false") == "true"
|
|
1074
|
-
content = process_template_blocks(
|
|
1075
|
-
content, init_done, browser_enabled, browser_tool,
|
|
1076
|
-
)
|
|
1019
|
+
content = process_template_blocks(content, init_done)
|
|
1077
1020
|
|
|
1078
1021
|
# Step 3: Replace all {{PLACEHOLDER}} variables (two passes for nested
|
|
1079
1022
|
# agent prompt templates that may contain their own placeholders)
|
|
@@ -1135,7 +1078,7 @@ def main():
|
|
|
1135
1078
|
global_context = {}
|
|
1136
1079
|
|
|
1137
1080
|
# Build replacements (shared by both code paths)
|
|
1138
|
-
replacements, effective_resume
|
|
1081
|
+
replacements, effective_resume = build_replacements(
|
|
1139
1082
|
args, feature, features, global_context, script_dir
|
|
1140
1083
|
)
|
|
1141
1084
|
|
|
@@ -1154,10 +1097,7 @@ def main():
|
|
|
1154
1097
|
# New modular section assembly (code-level conditional logic)
|
|
1155
1098
|
LOGGER.info("Using section assembly from %s", sections_dir)
|
|
1156
1099
|
try:
|
|
1157
|
-
sections = assemble_sections(
|
|
1158
|
-
sections_dir, init_done, browser_enabled,
|
|
1159
|
-
browser_tool=browser_tool,
|
|
1160
|
-
)
|
|
1100
|
+
sections = assemble_sections(sections_dir, init_done)
|
|
1161
1101
|
rendered = render_from_sections(sections, replacements)
|
|
1162
1102
|
except FileNotFoundError as exc:
|
|
1163
1103
|
emit_failure("Section assembly failed: {}".format(exc))
|
|
@@ -1172,8 +1112,7 @@ def main():
|
|
|
1172
1112
|
emit_failure("Template error: {}".format(err))
|
|
1173
1113
|
|
|
1174
1114
|
rendered = render_template(
|
|
1175
|
-
template_content, replacements, effective_resume
|
|
1176
|
-
browser_tool
|
|
1115
|
+
template_content, replacements, effective_resume
|
|
1177
1116
|
)
|
|
1178
1117
|
|
|
1179
1118
|
# ── Validate rendered output ───────────────────────────────────────
|
|
@@ -1195,7 +1134,7 @@ def main():
|
|
|
1195
1134
|
if feature_slug:
|
|
1196
1135
|
checkpoint_sections = (
|
|
1197
1136
|
sections if use_sections
|
|
1198
|
-
else _compatibility_checkpoint_sections(init_done
|
|
1137
|
+
else _compatibility_checkpoint_sections(init_done)
|
|
1199
1138
|
)
|
|
1200
1139
|
checkpoint = generate_checkpoint_definition(
|
|
1201
1140
|
sections=checkpoint_sections,
|
|
@@ -8,14 +8,11 @@ kept only for explicit --template compatibility.
|
|
|
8
8
|
import argparse
|
|
9
9
|
import json
|
|
10
10
|
import os
|
|
11
|
-
import re
|
|
12
11
|
import sys
|
|
13
12
|
|
|
14
13
|
from continuation import add_continuation_args, append_continuation_handoff, is_continuation
|
|
15
14
|
from prompt_framework import (
|
|
16
|
-
browser_enabled_from_item,
|
|
17
15
|
checkpoint_step,
|
|
18
|
-
detect_dev_server_port,
|
|
19
16
|
generate_checkpoint_from_sections,
|
|
20
17
|
load_section,
|
|
21
18
|
merge_checkpoint_state,
|
|
@@ -92,10 +89,6 @@ BUGFIX_SECTION_TO_SKILL = {
|
|
|
92
89
|
".prizmkit/bugfix/{slug}/test-result.json",
|
|
93
90
|
],
|
|
94
91
|
),
|
|
95
|
-
"phase-browser": checkpoint_step("browser-verification", "Browser Verification", []),
|
|
96
|
-
"bugfix-manual-gate": checkpoint_step(
|
|
97
|
-
"manual-verification", "Manual / Hybrid Verification", []
|
|
98
|
-
),
|
|
99
92
|
"bugfix-phase-commit-report": checkpoint_step(
|
|
100
93
|
"bug-report", "Generate Fix Report",
|
|
101
94
|
[".prizmkit/bugfix/{slug}/fix-report.md"],
|
|
@@ -287,15 +280,6 @@ def _args_project_root(args, script_dir):
|
|
|
287
280
|
return resolve_project_root(script_dir)
|
|
288
281
|
|
|
289
282
|
|
|
290
|
-
def is_recovery_like(args):
|
|
291
|
-
retry_count = 0
|
|
292
|
-
try:
|
|
293
|
-
retry_count = int(getattr(args, "retry_count", 0))
|
|
294
|
-
except (TypeError, ValueError):
|
|
295
|
-
retry_count = 0
|
|
296
|
-
return is_continuation(args) or getattr(args, "resume_phase", "null") != "null" or retry_count > 0
|
|
297
|
-
|
|
298
|
-
|
|
299
283
|
def build_replacements(args, bug, global_context, script_dir):
|
|
300
284
|
"""Build the full dict of placeholder -> replacement value."""
|
|
301
285
|
project_root = _args_project_root(args, script_dir)
|
|
@@ -305,20 +289,6 @@ def build_replacements(args, bug, global_context, script_dir):
|
|
|
305
289
|
error_type = error_source.get("type", "unknown") if isinstance(error_source, dict) else "unknown"
|
|
306
290
|
affected_modules = bug.get("affected_modules", [])
|
|
307
291
|
fix_scope = affected_modules[0] if affected_modules else (bug.get("title", "unknown").split()[0].lower() if bug.get("title") else "unknown")
|
|
308
|
-
verification_type = bug.get("verification_type", "automated")
|
|
309
|
-
|
|
310
|
-
browser_enabled, browser_tool, browser_verify_steps, browser_blocking = browser_enabled_from_item(
|
|
311
|
-
bug, logger=LOGGER,
|
|
312
|
-
)
|
|
313
|
-
dev_port = detect_dev_server_port(project_root)
|
|
314
|
-
dev_url = "http://localhost:{}".format(dev_port) if dev_port.isdigit() else "<UNKNOWN_DETECT_FROM_PROJECT_CONFIG>"
|
|
315
|
-
|
|
316
|
-
manual_or_hybrid = verification_type in ("manual", "hybrid")
|
|
317
|
-
manual_policy = (
|
|
318
|
-
"Manual/hybrid verification is executed automatically in headless mode: use available browser, CLI, API, fixture, and test evidence; document the verification evidence and proceed through review, test, retrospective, and commit."
|
|
319
|
-
if manual_or_hybrid
|
|
320
|
-
else "Automated verification: complete tests/review and proceed to commit when gates pass."
|
|
321
|
-
)
|
|
322
292
|
|
|
323
293
|
replacements = {
|
|
324
294
|
"{{SESSION_LOG_PATH}}": os.path.join(".prizmkit", "state", "bugfix", args.bug_id, "sessions", args.session_id, "logs", "session.log"),
|
|
@@ -329,8 +299,6 @@ def build_replacements(args, bug, global_context, script_dir):
|
|
|
329
299
|
"{{TASK_TITLE}}": bug.get("title", ""),
|
|
330
300
|
"{{BUG_TITLE}}": bug.get("title", ""),
|
|
331
301
|
"{{SEVERITY}}": bug.get("severity", "medium"),
|
|
332
|
-
"{{VERIFICATION_TYPE}}": verification_type,
|
|
333
|
-
"{{MANUAL_VERIFICATION_POLICY}}": manual_policy,
|
|
334
302
|
"{{BUG_DESCRIPTION}}": bug.get("description", ""),
|
|
335
303
|
"{{USER_CONTEXT}}": format_user_context(bug.get("user_context", [])),
|
|
336
304
|
"{{ERROR_SOURCE_TYPE}}": error_type,
|
|
@@ -346,60 +314,14 @@ def build_replacements(args, bug, global_context, script_dir):
|
|
|
346
314
|
"{{CHECKPOINT_SYSTEM}}": read_checkpoint_system_section(script_dir),
|
|
347
315
|
"{{FIX_SCOPE}}": fix_scope,
|
|
348
316
|
"{{TIMESTAMP}}": "",
|
|
349
|
-
"{{BROWSER_ENABLED}}": "true" if browser_enabled else "false",
|
|
350
|
-
"{{BROWSER_TOOL}}": browser_tool,
|
|
351
|
-
"{{BROWSER_VERIFY_STEPS}}": browser_verify_steps,
|
|
352
|
-
"{{BROWSER_BLOCKING}}": "true" if browser_blocking else "false",
|
|
353
|
-
"{{DEV_PORT}}": dev_port,
|
|
354
|
-
"{{DEV_URL}}": dev_url,
|
|
355
317
|
}
|
|
356
318
|
replacements.update(helper_replacements(script_dir))
|
|
357
319
|
return replacements
|
|
358
320
|
|
|
359
321
|
|
|
360
|
-
def
|
|
361
|
-
"""
|
|
362
|
-
|
|
363
|
-
is_manual_or_hybrid = vtype in ("manual", "hybrid")
|
|
364
|
-
if is_manual_or_hybrid:
|
|
365
|
-
content = content.replace("{{IF_VERIFICATION_MANUAL_OR_HYBRID}}\n", "")
|
|
366
|
-
content = content.replace("{{IF_VERIFICATION_MANUAL_OR_HYBRID}}", "")
|
|
367
|
-
content = content.replace("{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}\n", "")
|
|
368
|
-
content = content.replace("{{END_IF_VERIFICATION_MANUAL_OR_HYBRID}}", "")
|
|
369
|
-
else:
|
|
370
|
-
content = re.sub(r"\{\{IF_VERIFICATION_MANUAL_OR_HYBRID\}\}.*?\{\{END_IF_VERIFICATION_MANUAL_OR_HYBRID\}\}\n?", "", content, flags=re.DOTALL)
|
|
371
|
-
|
|
372
|
-
if browser_enabled is None:
|
|
373
|
-
browser_enabled, _browser_tool, _steps, _blocking = browser_enabled_from_item(bug, logger=LOGGER)
|
|
374
|
-
browser_open = "{{IF_BROWSER_INTERACTION}}"
|
|
375
|
-
browser_close = "{{END_IF_BROWSER_INTERACTION}}"
|
|
376
|
-
if browser_enabled:
|
|
377
|
-
content = content.replace(browser_open + "\n", "").replace(browser_open, "")
|
|
378
|
-
content = content.replace(browser_close + "\n", "").replace(browser_close, "")
|
|
379
|
-
else:
|
|
380
|
-
content = re.sub(re.escape(browser_open) + r".*?" + re.escape(browser_close) + r"\n?", "", content, flags=re.DOTALL)
|
|
381
|
-
|
|
382
|
-
tool_open = "{{IF_BROWSER_TOOL_PLAYWRIGHT}}"
|
|
383
|
-
tool_close = "{{END_IF_BROWSER_TOOL_PLAYWRIGHT}}"
|
|
384
|
-
if browser_enabled:
|
|
385
|
-
content = content.replace(tool_open + "\n", "").replace(tool_open, "")
|
|
386
|
-
content = content.replace(tool_close + "\n", "").replace(tool_close, "")
|
|
387
|
-
else:
|
|
388
|
-
content = re.sub(re.escape(tool_open) + r".*?" + re.escape(tool_close) + r"\n?", "", content, flags=re.DOTALL)
|
|
389
|
-
return content
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
def render_template(template_content, replacements, bug):
|
|
393
|
-
"""Render the legacy template by processing conditionals and placeholders."""
|
|
394
|
-
browser_enabled = (
|
|
395
|
-
replacements.get("{{BROWSER_ENABLED}}") == "true"
|
|
396
|
-
if "{{BROWSER_ENABLED}}" in replacements
|
|
397
|
-
else None
|
|
398
|
-
)
|
|
399
|
-
return replace_placeholders(
|
|
400
|
-
process_conditional_blocks(template_content, bug, browser_enabled=browser_enabled),
|
|
401
|
-
replacements,
|
|
402
|
-
)
|
|
322
|
+
def render_template(template_content, replacements):
|
|
323
|
+
"""Render the legacy template by replacing placeholders."""
|
|
324
|
+
return replace_placeholders(template_content, replacements)
|
|
403
325
|
|
|
404
326
|
|
|
405
327
|
def _bugfix_header():
|
|
@@ -410,7 +332,7 @@ def _bugfix_header():
|
|
|
410
332
|
)
|
|
411
333
|
|
|
412
334
|
|
|
413
|
-
def assemble_bugfix_sections(sections_dir
|
|
335
|
+
def assemble_bugfix_sections(sections_dir):
|
|
414
336
|
sections = [
|
|
415
337
|
("header", _bugfix_header()),
|
|
416
338
|
("bugfix-session-context", load_section(sections_dir, "bugfix-session-context.md")),
|
|
@@ -422,16 +344,8 @@ def assemble_bugfix_sections(sections_dir, browser_enabled, manual_gate, browser
|
|
|
422
344
|
("execution-header", "---\n\n## Execution\n"),
|
|
423
345
|
("bugfix-phase-init", load_section(sections_dir, "bugfix-phase-init.md")),
|
|
424
346
|
("bugfix-phase-diagnose-plan", load_section(sections_dir, "bugfix-phase-diagnose-plan.md")),
|
|
425
|
-
]
|
|
426
|
-
sections.extend([
|
|
427
347
|
("bugfix-phase-implement", load_section(sections_dir, "bugfix-phase-implement.md")),
|
|
428
348
|
("bugfix-phase-review", load_section(sections_dir, "bugfix-phase-review.md")),
|
|
429
|
-
])
|
|
430
|
-
if browser_enabled:
|
|
431
|
-
sections.append(("phase-browser", load_section(sections_dir, "phase-browser-verification.md")))
|
|
432
|
-
if manual_gate:
|
|
433
|
-
sections.append(("bugfix-manual-gate", load_section(sections_dir, "bugfix-phase-manual-verification.md")))
|
|
434
|
-
sections.extend([
|
|
435
349
|
("bugfix-phase-test", load_section(sections_dir, "bugfix-phase-test.md")),
|
|
436
350
|
("bugfix-phase-commit-report", load_section(sections_dir, "bugfix-phase-commit-report.md")),
|
|
437
351
|
("retrospective", load_section(sections_dir, "retrospective.md")),
|
|
@@ -439,13 +353,11 @@ def assemble_bugfix_sections(sections_dir, browser_enabled, manual_gate, browser
|
|
|
439
353
|
("bugfix-critical-paths", load_section(sections_dir, "bugfix-critical-paths.md")),
|
|
440
354
|
("failure-capture", load_section(sections_dir, "failure-capture.md")),
|
|
441
355
|
("bugfix-reminders", load_section(sections_dir, "bugfix-reminders.md")),
|
|
442
|
-
]
|
|
356
|
+
]
|
|
443
357
|
return sections
|
|
444
358
|
|
|
445
359
|
|
|
446
|
-
def generate_bugfix_checkpoint(
|
|
447
|
-
bug_id, session_id, sections=None, *, browser_enabled=False, manual_gate=False,
|
|
448
|
-
):
|
|
360
|
+
def generate_bugfix_checkpoint(bug_id, session_id, sections=None):
|
|
449
361
|
"""Generate a checkpoint definition for the Bugfix coordinator."""
|
|
450
362
|
if sections is None:
|
|
451
363
|
sections = [
|
|
@@ -453,17 +365,11 @@ def generate_bugfix_checkpoint(
|
|
|
453
365
|
("bugfix-phase-diagnose-plan", ""),
|
|
454
366
|
("bugfix-phase-implement", ""),
|
|
455
367
|
("bugfix-phase-review", ""),
|
|
456
|
-
]
|
|
457
|
-
if browser_enabled:
|
|
458
|
-
sections.append(("phase-browser", ""))
|
|
459
|
-
if manual_gate:
|
|
460
|
-
sections.append(("bugfix-manual-gate", ""))
|
|
461
|
-
sections.extend([
|
|
462
368
|
("bugfix-phase-test", ""),
|
|
463
369
|
("bugfix-phase-commit-report", ""),
|
|
464
370
|
("retrospective", ""),
|
|
465
371
|
("runtime-commit-handoff", ""),
|
|
466
|
-
]
|
|
372
|
+
]
|
|
467
373
|
return generate_checkpoint_from_sections(
|
|
468
374
|
sections,
|
|
469
375
|
BUGFIX_SECTION_TO_SKILL,
|
|
@@ -506,17 +412,12 @@ def main():
|
|
|
506
412
|
global_context = {}
|
|
507
413
|
|
|
508
414
|
replacements = build_replacements(args, bug, global_context, script_dir)
|
|
509
|
-
browser_enabled = replacements["{{BROWSER_ENABLED}}"] == "true"
|
|
510
|
-
manual_gate = bug.get("verification_type", "automated") in ("manual", "hybrid")
|
|
511
415
|
|
|
512
416
|
use_sections = os.path.isdir(sections_dir) and not args.template
|
|
513
417
|
sections = []
|
|
514
418
|
if use_sections:
|
|
515
419
|
try:
|
|
516
|
-
sections = assemble_bugfix_sections(
|
|
517
|
-
sections_dir, browser_enabled, manual_gate,
|
|
518
|
-
browser_tool=replacements["{{BROWSER_TOOL}}"],
|
|
519
|
-
)
|
|
420
|
+
sections = assemble_bugfix_sections(sections_dir)
|
|
520
421
|
rendered = render_from_sections(sections, replacements)
|
|
521
422
|
except FileNotFoundError as exc:
|
|
522
423
|
emit_failure("Bugfix section assembly failed: {}".format(exc))
|
|
@@ -528,7 +429,7 @@ def main():
|
|
|
528
429
|
template_content, err = read_text_file(template_path)
|
|
529
430
|
if err:
|
|
530
431
|
emit_failure("Template error: {}".format(err))
|
|
531
|
-
rendered = render_template(template_content, replacements
|
|
432
|
+
rendered = render_template(template_content, replacements)
|
|
532
433
|
|
|
533
434
|
is_valid, warnings, errors = validate_rendered(
|
|
534
435
|
rendered,
|
|
@@ -554,8 +455,6 @@ def main():
|
|
|
554
455
|
args.bug_id,
|
|
555
456
|
args.session_id,
|
|
556
457
|
sections if use_sections else None,
|
|
557
|
-
browser_enabled=browser_enabled,
|
|
558
|
-
manual_gate=manual_gate,
|
|
559
458
|
)
|
|
560
459
|
if not any(step.get("skill") == "prizmkit-test" for step in checkpoint["steps"]):
|
|
561
460
|
emit_failure("Bugfix checkpoint is missing the mandatory prizmkit-test stage")
|
|
@@ -618,8 +517,6 @@ def main():
|
|
|
618
517
|
"render_mode": "sections" if use_sections else "legacy",
|
|
619
518
|
"validation_warnings": len(warnings),
|
|
620
519
|
"validation_errors": len(errors),
|
|
621
|
-
"browser_enabled": replacements["{{BROWSER_ENABLED}}"] == "true",
|
|
622
|
-
"browser_tool": replacements["{{BROWSER_TOOL}}"],
|
|
623
520
|
}
|
|
624
521
|
print(json.dumps(output, indent=2, ensure_ascii=False))
|
|
625
522
|
sys.exit(0)
|
|
@@ -36,7 +36,6 @@ REQUIRED_BUG_FIELDS = [
|
|
|
36
36
|
"description",
|
|
37
37
|
"severity",
|
|
38
38
|
"error_source",
|
|
39
|
-
"verification_type",
|
|
40
39
|
"acceptance_criteria",
|
|
41
40
|
"status",
|
|
42
41
|
]
|
|
@@ -46,13 +45,11 @@ ALLOWED_BUG_FIELDS = set(REQUIRED_BUG_FIELDS) | {
|
|
|
46
45
|
"affected_modules",
|
|
47
46
|
"dependencies",
|
|
48
47
|
"user_context",
|
|
49
|
-
"browser_interaction",
|
|
50
48
|
"model",
|
|
51
49
|
"completion_notes",
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
VALID_SEVERITIES = ["critical", "high", "medium", "low"]
|
|
55
|
-
VALID_VERIFICATION_TYPES = ["automated", "manual", "hybrid"]
|
|
56
53
|
VALID_STATUSES = [
|
|
57
54
|
"pending", "in_progress", "completed", "failed",
|
|
58
55
|
"skipped", "needs_info", "auto_skipped",
|
|
@@ -188,16 +185,6 @@ def validate_bugs(bugs):
|
|
|
188
185
|
)
|
|
189
186
|
)
|
|
190
187
|
|
|
191
|
-
# Validate verification_type
|
|
192
|
-
vtype = bug.get("verification_type")
|
|
193
|
-
if vtype is not None and vtype not in VALID_VERIFICATION_TYPES:
|
|
194
|
-
errors.append(
|
|
195
|
-
"Bug '{}' has invalid verification_type '{}' "
|
|
196
|
-
"(must be one of {})".format(
|
|
197
|
-
bid or "index {}".format(i), vtype, VALID_VERIFICATION_TYPES
|
|
198
|
-
)
|
|
199
|
-
)
|
|
200
|
-
|
|
201
188
|
# Validate status
|
|
202
189
|
status = bug.get("status")
|
|
203
190
|
if status is not None and status not in VALID_STATUSES:
|
|
@@ -6,7 +6,6 @@ so feature and bugfix prompts do not drift.
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import glob
|
|
9
|
-
import logging
|
|
10
9
|
import os
|
|
11
10
|
import re
|
|
12
11
|
import sys
|
|
@@ -25,7 +24,6 @@ from prizmkit_runtime.test_result import valid_test_artifact_pair # noqa: E402
|
|
|
25
24
|
|
|
26
25
|
|
|
27
26
|
MAX_OUTER_REPAIR_ROUNDS = 3
|
|
28
|
-
_LOGGER = logging.getLogger(__name__)
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
def route_pipeline_repair(stage_result, repair_scope=None, repair_round=0, *, production_changed=False):
|
|
@@ -520,80 +518,3 @@ def merge_checkpoint_state(existing, fresh, project_root, validator=None, logger
|
|
|
520
518
|
fresh[state_key] = merged_state
|
|
521
519
|
|
|
522
520
|
return fresh
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
def detect_dev_server_port(project_root):
|
|
526
|
-
"""Return a detected dev-server port string, or an unknown placeholder."""
|
|
527
|
-
unknown = "<UNKNOWN_DETECT_FROM_PROJECT_CONFIG>"
|
|
528
|
-
pkg_path = os.path.join(project_root, "package.json")
|
|
529
|
-
try:
|
|
530
|
-
if os.path.isfile(pkg_path):
|
|
531
|
-
import json
|
|
532
|
-
with open(pkg_path, "r", encoding="utf-8") as f:
|
|
533
|
-
pkg = json.load(f)
|
|
534
|
-
scripts = pkg.get("scripts", {}) if isinstance(pkg, dict) else {}
|
|
535
|
-
dev_script = scripts.get("dev", "")
|
|
536
|
-
port_match = re.search(r"(?:-p|--port)\s+([0-9]+)", dev_script)
|
|
537
|
-
if port_match:
|
|
538
|
-
return port_match.group(1)
|
|
539
|
-
for env_file in [".env.local", ".env"]:
|
|
540
|
-
env_path = os.path.join(project_root, env_file)
|
|
541
|
-
if not os.path.isfile(env_path):
|
|
542
|
-
continue
|
|
543
|
-
with open(env_path, "r", encoding="utf-8") as env:
|
|
544
|
-
for line in env:
|
|
545
|
-
match = re.match(r"[A-Z0-9_]*(?:URL|ORIGIN|HOST)\s*=\s*.*?:([0-9]+)", line.strip())
|
|
546
|
-
if match:
|
|
547
|
-
return match.group(1)
|
|
548
|
-
except Exception:
|
|
549
|
-
return unknown
|
|
550
|
-
return unknown
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
def browser_enabled_from_item(item, logger=None):
|
|
554
|
-
"""Return browser enabled/tool/steps/blocking with explicit opt-in semantics.
|
|
555
|
-
|
|
556
|
-
Legacy ``browser_interaction.tool`` values (``"auto"`` or ``"opencli"``) are
|
|
557
|
-
normalized to ``"playwright-cli"`` with a logged deprecation warning so
|
|
558
|
-
pre-existing task lists still execute cleanly.
|
|
559
|
-
"""
|
|
560
|
-
browser_interaction = item.get("browser_interaction") if isinstance(item, dict) else None
|
|
561
|
-
env_value = os.environ.get("BROWSER_VERIFY", "").lower()
|
|
562
|
-
if env_value == "false":
|
|
563
|
-
return False, "playwright-cli", "", False
|
|
564
|
-
|
|
565
|
-
enabled = False
|
|
566
|
-
tool = "playwright-cli"
|
|
567
|
-
blocking = False
|
|
568
|
-
steps = []
|
|
569
|
-
active_logger = logger or _LOGGER
|
|
570
|
-
|
|
571
|
-
if isinstance(browser_interaction, dict):
|
|
572
|
-
enabled = True
|
|
573
|
-
raw_tool = browser_interaction.get("tool")
|
|
574
|
-
blocking = bool(browser_interaction.get("blocking", False))
|
|
575
|
-
steps = browser_interaction.get("verify_steps", []) or []
|
|
576
|
-
if raw_tool in ("auto", "opencli"):
|
|
577
|
-
active_logger.warning(
|
|
578
|
-
"Deprecated browser_interaction.tool '%s' is no longer supported; "
|
|
579
|
-
"normalizing to 'playwright-cli'",
|
|
580
|
-
raw_tool,
|
|
581
|
-
)
|
|
582
|
-
elif raw_tool is not None and raw_tool != "playwright-cli":
|
|
583
|
-
active_logger.warning(
|
|
584
|
-
"Unknown browser_interaction.tool '%s'; normalizing to 'playwright-cli'",
|
|
585
|
-
raw_tool,
|
|
586
|
-
)
|
|
587
|
-
|
|
588
|
-
if steps:
|
|
589
|
-
rendered_steps = "\n".join(
|
|
590
|
-
" # Goal {}: {}".format(index + 1, step)
|
|
591
|
-
for index, step in enumerate(steps)
|
|
592
|
-
)
|
|
593
|
-
else:
|
|
594
|
-
rendered_steps = (
|
|
595
|
-
" # (mandatory attempt: discover whether this project exposes "
|
|
596
|
-
"a browser-verifiable app; verify relevant behavior if applicable)"
|
|
597
|
-
)
|
|
598
|
-
|
|
599
|
-
return enabled, tool, rendered_steps, blocking
|