prizmkit 1.1.196 → 1.1.198
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 +1 -7
- 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/claude/settings-adapter.js +3 -8
- 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 +29 -48
- package/src/index.js +2 -9
- package/src/manifest.js +5 -9
- package/src/platforms.js +0 -14
- package/src/prompts.js +0 -13
- package/src/scaffold.js +100 -327
- package/src/upgrade.js +38 -42
- 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
|
@@ -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
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from datetime import datetime, timezone
|
|
4
4
|
import json
|
|
5
5
|
import os
|
|
6
|
+
import re
|
|
6
7
|
import sys
|
|
7
8
|
|
|
8
9
|
from utils import (
|
|
@@ -10,6 +11,7 @@ from utils import (
|
|
|
10
11
|
load_json_file,
|
|
11
12
|
orphaned_auto_skipped_ids,
|
|
12
13
|
read_checkpoint_cursor,
|
|
14
|
+
read_checkpoint_step_display,
|
|
13
15
|
write_json_file,
|
|
14
16
|
)
|
|
15
17
|
|
|
@@ -175,15 +177,23 @@ def reset_continuation_metadata(status_data):
|
|
|
175
177
|
status_data.pop(key, None)
|
|
176
178
|
|
|
177
179
|
|
|
178
|
-
def
|
|
179
|
-
|
|
180
|
-
checkpoint_path = os.path.join(
|
|
180
|
+
def _checkpoint_file_path(project_root, *artifact_parts):
|
|
181
|
+
return os.path.join(
|
|
181
182
|
os.path.abspath(project_root) if project_root else _default_project_root(),
|
|
182
183
|
".prizmkit",
|
|
183
184
|
*artifact_parts,
|
|
184
185
|
"workflow-checkpoint.json",
|
|
185
186
|
)
|
|
186
|
-
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def read_checkpoint_phase(project_root, *artifact_parts):
|
|
190
|
+
"""Read the integer step cursor from a task family workflow checkpoint."""
|
|
191
|
+
return read_checkpoint_cursor(_checkpoint_file_path(project_root, *artifact_parts))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def read_checkpoint_phase_display(project_root, *artifact_parts):
|
|
195
|
+
"""Read (cursor, step_name) from a task family workflow checkpoint."""
|
|
196
|
+
return read_checkpoint_step_display(_checkpoint_file_path(project_root, *artifact_parts))
|
|
187
197
|
|
|
188
198
|
|
|
189
199
|
def _load_progress_fingerprint(raw):
|
|
@@ -589,3 +599,139 @@ def action_pause(state_dir, *, write_json_fn=None):
|
|
|
589
599
|
"paused_at": data["paused_at"],
|
|
590
600
|
}
|
|
591
601
|
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
def _build_feature_slug_name(item_id, title):
|
|
605
|
+
"""Build deterministic spec directory name matching update-feature-status."""
|
|
606
|
+
numeric = item_id.replace("F-", "").replace("f-", "").zfill(3)
|
|
607
|
+
cleaned = re.sub(r"[^a-z0-9\s-]", "", (title or "").lower())
|
|
608
|
+
cleaned = re.sub(r"[\s]+", "-", cleaned.strip())
|
|
609
|
+
cleaned = re.sub(r"-+", "-", cleaned).strip("-")
|
|
610
|
+
if not cleaned:
|
|
611
|
+
cleaned = "feature"
|
|
612
|
+
return "{}-{}".format(numeric, cleaned)
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
def _find_retrospective_result_file(project_root, family, item):
|
|
616
|
+
"""Locate retrospective-result.json for a feature or bugfix item."""
|
|
617
|
+
item_id = item.get("id")
|
|
618
|
+
if not project_root or not isinstance(item_id, str) or not item_id:
|
|
619
|
+
return None, None
|
|
620
|
+
prizm_root = os.path.join(project_root, ".prizmkit")
|
|
621
|
+
if family == "feature":
|
|
622
|
+
specs_root = os.path.join(prizm_root, "specs")
|
|
623
|
+
candidates = []
|
|
624
|
+
raw_slug = item.get("slug")
|
|
625
|
+
if isinstance(raw_slug, str) and raw_slug.strip():
|
|
626
|
+
candidates.append(raw_slug.strip())
|
|
627
|
+
title_slug = _build_feature_slug_name(item_id, item.get("title", ""))
|
|
628
|
+
if title_slug not in candidates:
|
|
629
|
+
candidates.append(title_slug)
|
|
630
|
+
numeric = item_id.replace("F-", "").replace("f-", "").zfill(3)
|
|
631
|
+
prefix = "{}-".format(numeric)
|
|
632
|
+
if os.path.isdir(specs_root):
|
|
633
|
+
try:
|
|
634
|
+
for entry in sorted(os.listdir(specs_root)):
|
|
635
|
+
full_dir = os.path.join(specs_root, entry)
|
|
636
|
+
if os.path.isdir(full_dir) and entry.startswith(prefix) and entry not in candidates:
|
|
637
|
+
candidates.append(entry)
|
|
638
|
+
except OSError:
|
|
639
|
+
pass
|
|
640
|
+
if item_id not in candidates:
|
|
641
|
+
candidates.append(item_id)
|
|
642
|
+
for dirname in candidates:
|
|
643
|
+
candidate_path = os.path.join(specs_root, dirname, "retrospective-result.json")
|
|
644
|
+
if os.path.isfile(candidate_path):
|
|
645
|
+
return candidate_path, ".prizmkit/specs/{}/retrospective-result.json".format(dirname)
|
|
646
|
+
return None, None
|
|
647
|
+
|
|
648
|
+
candidate_path = os.path.join(prizm_root, "bugfix", item_id, "retrospective-result.json")
|
|
649
|
+
if os.path.isfile(candidate_path):
|
|
650
|
+
return candidate_path, ".prizmkit/bugfix/{}/retrospective-result.json".format(item_id)
|
|
651
|
+
return None, None
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
def _extract_pending_rule_proposals(result_path):
|
|
655
|
+
"""Read RULES_PROPOSED proposals safely without failing status on bad files."""
|
|
656
|
+
try:
|
|
657
|
+
with open(result_path, "r", encoding="utf-8") as handle:
|
|
658
|
+
payload = json.load(handle)
|
|
659
|
+
except (OSError, ValueError, TypeError):
|
|
660
|
+
return []
|
|
661
|
+
if not isinstance(payload, dict):
|
|
662
|
+
return []
|
|
663
|
+
rule_evolution = payload.get("rule_evolution")
|
|
664
|
+
if not isinstance(rule_evolution, dict):
|
|
665
|
+
return []
|
|
666
|
+
if rule_evolution.get("status") != "RULES_PROPOSED":
|
|
667
|
+
return []
|
|
668
|
+
proposals = rule_evolution.get("proposals")
|
|
669
|
+
if not isinstance(proposals, list):
|
|
670
|
+
return []
|
|
671
|
+
normalized = []
|
|
672
|
+
for entry in proposals:
|
|
673
|
+
if not isinstance(entry, dict):
|
|
674
|
+
continue
|
|
675
|
+
target_path = entry.get("target_path")
|
|
676
|
+
clause = entry.get("clause")
|
|
677
|
+
reason = entry.get("reason")
|
|
678
|
+
if (
|
|
679
|
+
isinstance(target_path, str)
|
|
680
|
+
and target_path.strip()
|
|
681
|
+
and isinstance(clause, str)
|
|
682
|
+
and clause.strip()
|
|
683
|
+
and isinstance(reason, str)
|
|
684
|
+
and reason.strip()
|
|
685
|
+
):
|
|
686
|
+
normalized.append(
|
|
687
|
+
{
|
|
688
|
+
"target_path": target_path.strip(),
|
|
689
|
+
"clause": clause.strip(),
|
|
690
|
+
"reason": reason.strip(),
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
return normalized
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
def collect_pending_rule_proposals(project_root, family, items):
|
|
697
|
+
"""Collect RULES_PROPOSED entries from retrospective-result.json artifacts."""
|
|
698
|
+
if not project_root or not isinstance(items, list):
|
|
699
|
+
return []
|
|
700
|
+
collected = []
|
|
701
|
+
for item in items:
|
|
702
|
+
if not isinstance(item, dict):
|
|
703
|
+
continue
|
|
704
|
+
item_id = item.get("id")
|
|
705
|
+
if not isinstance(item_id, str) or not item_id:
|
|
706
|
+
continue
|
|
707
|
+
result_path, rel_display = _find_retrospective_result_file(project_root, family, item)
|
|
708
|
+
if not result_path:
|
|
709
|
+
continue
|
|
710
|
+
proposals = _extract_pending_rule_proposals(result_path)
|
|
711
|
+
if proposals:
|
|
712
|
+
collected.append(
|
|
713
|
+
{
|
|
714
|
+
"item_id": item_id,
|
|
715
|
+
"result_path": rel_display,
|
|
716
|
+
"proposals": proposals,
|
|
717
|
+
}
|
|
718
|
+
)
|
|
719
|
+
return collected
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
def format_pending_rule_proposals(entries):
|
|
723
|
+
"""Format collected RULES_PROPOSED entries for human-readable status output."""
|
|
724
|
+
if not entries:
|
|
725
|
+
return []
|
|
726
|
+
lines = ["", "Pending Rule Evolution Proposals (confirm manually):"]
|
|
727
|
+
for entry in entries:
|
|
728
|
+
lines.append(" - {} (see {}):".format(entry["item_id"], entry["result_path"]))
|
|
729
|
+
for proposal in entry["proposals"]:
|
|
730
|
+
lines.append(
|
|
731
|
+
" * [{}] {} — {}".format(
|
|
732
|
+
proposal["target_path"],
|
|
733
|
+
proposal["clause"],
|
|
734
|
+
proposal["reason"],
|
|
735
|
+
)
|
|
736
|
+
)
|
|
737
|
+
return lines
|
|
@@ -45,13 +45,16 @@ from status_common import ( # noqa: E402
|
|
|
45
45
|
auto_skip_blocked_items,
|
|
46
46
|
cleanup_continuation_artifacts as cleanup_continuation_artifacts,
|
|
47
47
|
clear_pending_continuation_metadata as clear_pending_continuation_metadata,
|
|
48
|
+
collect_pending_rule_proposals,
|
|
48
49
|
continuation_metadata_summary as continuation_metadata_summary,
|
|
50
|
+
format_pending_rule_proposals,
|
|
49
51
|
get_item_status_from_list,
|
|
50
52
|
has_pending_continuation_metadata as has_pending_continuation_metadata,
|
|
51
53
|
load_item_status,
|
|
52
54
|
load_session_status as load_session_status,
|
|
53
55
|
now_iso as now_iso,
|
|
54
56
|
read_checkpoint_phase,
|
|
57
|
+
read_checkpoint_phase_display,
|
|
55
58
|
reconcile_orphaned_auto_skipped_items,
|
|
56
59
|
reset_continuation_metadata as reset_continuation_metadata,
|
|
57
60
|
save_item_status,
|
|
@@ -144,6 +147,11 @@ def _read_bugfix_checkpoint_phase(project_root, bug_id):
|
|
|
144
147
|
return read_checkpoint_phase(project_root, "bugfix", bug_id)
|
|
145
148
|
|
|
146
149
|
|
|
150
|
+
def _read_bugfix_checkpoint_phase_display(project_root, bug_id):
|
|
151
|
+
"""Read (phase_index, step_name) from the bugfix checkpoint file."""
|
|
152
|
+
return read_checkpoint_phase_display(project_root, "bugfix", bug_id)
|
|
153
|
+
|
|
154
|
+
|
|
147
155
|
def _checkpoint_phase_or_cached(project_root, bug_id, status_data):
|
|
148
156
|
"""Return live checkpoint phase from the authoritative checkpoint only."""
|
|
149
157
|
return _read_bugfix_checkpoint_phase(project_root, bug_id)
|
|
@@ -714,7 +722,11 @@ def action_status(bug_list_data, state_dir, project_root=None):
|
|
|
714
722
|
retry_count = bs.get("retry_count", 0)
|
|
715
723
|
max_retries_val = bs.get("max_retries", 3)
|
|
716
724
|
# Read the authoritative checkpoint cursor without mutating cached runtime state.
|
|
717
|
-
resume_phase =
|
|
725
|
+
resume_phase, step_name = (
|
|
726
|
+
_read_bugfix_checkpoint_phase_display(project_root, bid)
|
|
727
|
+
if bstatus == "in_progress"
|
|
728
|
+
else (None, "")
|
|
729
|
+
)
|
|
718
730
|
|
|
719
731
|
if bstatus in counts:
|
|
720
732
|
counts[bstatus] += 1
|
|
@@ -747,7 +759,10 @@ def action_status(bug_list_data, state_dir, project_root=None):
|
|
|
747
759
|
if retry_count > 0:
|
|
748
760
|
parts.append("retry {}/{}".format(retry_count, max_retries_val))
|
|
749
761
|
if resume_phase is not None:
|
|
750
|
-
|
|
762
|
+
if step_name:
|
|
763
|
+
parts.append("CP-BF-{}: {}".format(resume_phase, step_name))
|
|
764
|
+
else:
|
|
765
|
+
parts.append("CP-BF-{}".format(resume_phase))
|
|
751
766
|
if parts:
|
|
752
767
|
detail = " ({})".format(", ".join(parts))
|
|
753
768
|
elif bstatus == "failed":
|
|
@@ -821,6 +836,9 @@ def action_status(bug_list_data, state_dir, project_root=None):
|
|
|
821
836
|
for line in bug_lines:
|
|
822
837
|
print("║" + pad_right(" {}".format(line), inner) + " ║")
|
|
823
838
|
print("╚" + "═" * BOX_WIDTH + "╝")
|
|
839
|
+
pending_proposals = collect_pending_rule_proposals(project_root, "bugfix", bugs)
|
|
840
|
+
for proposal_line in format_pending_rule_proposals(pending_proposals):
|
|
841
|
+
print(proposal_line)
|
|
824
842
|
|
|
825
843
|
|
|
826
844
|
# ---------------------------------------------------------------------------
|