prizmkit 1.1.162 → 1.1.164

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 (58) hide show
  1. package/bin/create-prizmkit.js +4 -4
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/cursor/assets/prizmkit-hook.cjs +65 -0
  4. package/bundled/adapters/cursor/hooks-adapter.js +139 -0
  5. package/bundled/adapters/cursor/paths.js +11 -0
  6. package/bundled/adapters/cursor/rules-adapter.js +49 -0
  7. package/bundled/adapters/cursor/skill-adapter.js +27 -0
  8. package/bundled/dev-pipeline/README.md +18 -5
  9. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +3 -25
  10. package/bundled/dev-pipeline/prizmkit_runtime/config.py +71 -14
  11. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +28 -4
  12. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +5 -2
  13. package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +21 -3
  14. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +19 -5
  15. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +123 -28
  16. package/bundled/dev-pipeline/prizmkit_runtime/status.py +2 -0
  17. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +1 -42
  18. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +43 -6
  19. package/bundled/dev-pipeline/scripts/init-pipeline.py +46 -8
  20. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +41 -6
  21. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +143 -27
  22. package/bundled/dev-pipeline/scripts/update-feature-status.py +2 -2
  23. package/bundled/dev-pipeline/scripts/utils.py +3 -12
  24. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +4 -2
  25. package/bundled/dev-pipeline/templates/feature-list-schema.json +4 -2
  26. package/bundled/dev-pipeline/templates/refactor-list-schema.json +4 -2
  27. package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +2 -1
  28. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +5 -23
  29. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +2 -2
  30. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +231 -0
  31. package/bundled/dev-pipeline/tests/test_unified_cli.py +406 -30
  32. package/bundled/dev-pipeline/tests/test_utils.py +23 -0
  33. package/bundled/rules/USAGE.md +3 -0
  34. package/bundled/skills/_metadata.json +1 -1
  35. package/bundled/skills/bug-planner/SKILL.md +0 -1
  36. package/bundled/skills/bug-planner/references/verification.md +0 -2
  37. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +37 -7
  38. package/bundled/skills/feature-planner/SKILL.md +5 -8
  39. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +43 -19
  40. package/bundled/skills/prizmkit-init/SKILL.md +1 -1
  41. package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
  42. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +2 -3
  43. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
  44. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
  45. package/bundled/skills/refactor-planner/SKILL.md +1 -3
  46. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +38 -9
  47. package/package.json +4 -2
  48. package/src/ai-cli-launch.js +9 -2
  49. package/src/clean.js +42 -6
  50. package/src/config.js +51 -10
  51. package/src/detect-platform.js +30 -8
  52. package/src/external-skills.js +33 -99
  53. package/src/index.js +5 -0
  54. package/src/manifest.js +30 -4
  55. package/src/platforms.js +11 -4
  56. package/src/prompts.js +12 -4
  57. package/src/scaffold.js +75 -4
  58. package/src/upgrade.js +15 -14
@@ -463,6 +463,30 @@ def test_python_env_resolution_scenarios_match_snapshot_contracts(tmp_path):
463
463
  assert codex_support.enabled is True
464
464
  assert codex_support.format == "codex-json"
465
465
 
466
+ cursor = build_ai_session_command(
467
+ AISessionConfig(
468
+ cli_command="agent",
469
+ platform="cursor",
470
+ model="cursor-model",
471
+ prompt_path=prompt,
472
+ cwd=tmp_path,
473
+ use_stream_json=True,
474
+ )
475
+ )
476
+ assert cursor.argv == (
477
+ "agent", "--print", "--force", "--trust", "--output-format", "stream-json",
478
+ "--model", "cursor-model",
479
+ )
480
+ assert cursor.stdin_text == "hello"
481
+ assert "hello" not in cursor.argv
482
+ cursor_support = detect_stream_json_support(
483
+ "agent",
484
+ "cursor",
485
+ lambda command: "Cursor Agent --print --force --trust --output-format stream-json",
486
+ )
487
+ assert cursor_support.enabled is True
488
+ assert cursor_support.format == "cursor-stream-json"
489
+
466
490
 
467
491
  def test_windows_structural_paths_use_installed_python_runtime_layout(tmp_path):
468
492
  from prizmkit_runtime.paths import resolve_runtime_paths
@@ -720,6 +744,163 @@ def test_init_scripts_reject_missing_self_and_cycle_dependencies(tmp_path):
720
744
  assert any(expected_fragments[scenario] in error for error in payload["errors"])
721
745
 
722
746
 
747
+ def test_init_scripts_reject_unknown_item_fields(tmp_path):
748
+ script_config = {
749
+ "feature": ("init-pipeline.py", "--feature-list", "F-"),
750
+ "bugfix": ("init-bugfix-pipeline.py", "--bug-list", "B-"),
751
+ "refactor": ("init-refactor-pipeline.py", "--refactor-list", "R-"),
752
+ }
753
+
754
+ for kind, (script_name, list_arg, prefix) in script_config.items():
755
+ paths = _make_paths(tmp_path / f"init-{kind}-unknown-field")
756
+ items = _family_items(kind, [(f"{prefix}001", [], "pending")])
757
+ items[0]["unexpected_field"] = True
758
+ plan_path = _write_family_plan(paths, kind, items)
759
+ result = subprocess.run(
760
+ [
761
+ PYTHON_310_PLUS,
762
+ str(PIPELINE_ROOT / "scripts" / script_name),
763
+ list_arg,
764
+ str(plan_path),
765
+ "--state-dir",
766
+ str(paths.project_root / ".prizmkit" / "state" / f"init-{kind}-unknown-field"),
767
+ ],
768
+ cwd=REPO_ROOT,
769
+ stdout=subprocess.PIPE,
770
+ stderr=subprocess.PIPE,
771
+ text=True,
772
+ check=False,
773
+ )
774
+
775
+ assert result.returncode == 1, (kind, result.stdout, result.stderr)
776
+ payload = json.loads(result.stdout)
777
+ assert any("unknown fields: unexpected_field" in error for error in payload["errors"])
778
+
779
+
780
+ @pytest.mark.parametrize("location", ("root", "global_context"))
781
+ def test_init_scripts_reject_unknown_list_fields(tmp_path, location):
782
+ script_config = {
783
+ "feature": ("init-pipeline.py", "--feature-list", "F-"),
784
+ "bugfix": ("init-bugfix-pipeline.py", "--bug-list", "B-"),
785
+ "refactor": ("init-refactor-pipeline.py", "--refactor-list", "R-"),
786
+ }
787
+
788
+ for kind, (script_name, list_arg, prefix) in script_config.items():
789
+ paths = _make_paths(tmp_path / f"init-{kind}-unknown-{location}")
790
+ items = _family_items(kind, [(f"{prefix}001", [], "pending")])
791
+ plan_path = _write_family_plan(paths, kind, items)
792
+ payload = json.loads(plan_path.read_text(encoding="utf-8"))
793
+ if location == "root":
794
+ payload["unexpected_field"] = True
795
+ else:
796
+ payload["global_context"] = {"unexpected_field": True}
797
+ plan_path.write_text(json.dumps(payload), encoding="utf-8")
798
+
799
+ result = subprocess.run(
800
+ [
801
+ PYTHON_310_PLUS,
802
+ str(PIPELINE_ROOT / "scripts" / script_name),
803
+ list_arg,
804
+ str(plan_path),
805
+ "--state-dir",
806
+ str(paths.project_root / ".prizmkit" / "state" / f"init-{kind}-unknown-{location}"),
807
+ ],
808
+ cwd=REPO_ROOT,
809
+ stdout=subprocess.PIPE,
810
+ stderr=subprocess.PIPE,
811
+ text=True,
812
+ check=False,
813
+ )
814
+
815
+ assert result.returncode == 1, (kind, location, result.stdout, result.stderr)
816
+ output = json.loads(result.stdout)
817
+ assert any("unknown fields: unexpected_field" in error for error in output["errors"])
818
+
819
+
820
+ def test_planner_validators_reject_unknown_item_fields():
821
+ from importlib.util import module_from_spec, spec_from_file_location
822
+
823
+ planner_config = {
824
+ "feature": (
825
+ "core/skills/orchestration-skill/pipelines/feature-planner/scripts/validate-and-generate.py",
826
+ "validate_feature_list",
827
+ "features",
828
+ "dev-pipeline-feature-list-v1",
829
+ "F-",
830
+ ),
831
+ "bugfix": (
832
+ "core/skills/orchestration-skill/pipelines/bug-planner/scripts/validate-bug-list.py",
833
+ "validate",
834
+ "bugs",
835
+ "dev-pipeline-bug-fix-list-v1",
836
+ "B-",
837
+ ),
838
+ "refactor": (
839
+ "core/skills/orchestration-skill/pipelines/refactor-planner/scripts/validate-and-generate-refactor.py",
840
+ "validate_refactor_list",
841
+ "refactors",
842
+ "dev-pipeline-refactor-list-v1",
843
+ "R-",
844
+ ),
845
+ }
846
+
847
+ for kind, (relative_path, function_name, list_key, schema, prefix) in planner_config.items():
848
+ script_path = REPO_ROOT / relative_path
849
+ spec = spec_from_file_location(f"{kind}_planner_unknown_field", script_path)
850
+ module = module_from_spec(spec)
851
+ spec.loader.exec_module(module)
852
+ items = _family_items(kind, [(f"{prefix}001", [], "pending")])
853
+ items[0]["unexpected_field"] = True
854
+ result = getattr(module, function_name)({
855
+ "$schema": schema,
856
+ "project_name": "Fake",
857
+ list_key: items,
858
+ })
859
+
860
+ assert result["valid"] is False
861
+ assert any("unknown fields: unexpected_field" in error for error in result["errors"])
862
+
863
+
864
+ @pytest.mark.parametrize("location", ("root", "global_context"))
865
+ def test_planner_validators_reject_unknown_list_fields(location):
866
+ from importlib.util import module_from_spec, spec_from_file_location
867
+
868
+ planner_config = {
869
+ "feature": (
870
+ "core/skills/orchestration-skill/pipelines/feature-planner/scripts/validate-and-generate.py",
871
+ "validate_feature_list", "features", "dev-pipeline-feature-list-v1", "F-",
872
+ ),
873
+ "bugfix": (
874
+ "core/skills/orchestration-skill/pipelines/bug-planner/scripts/validate-bug-list.py",
875
+ "validate", "bugs", "dev-pipeline-bug-fix-list-v1", "B-",
876
+ ),
877
+ "refactor": (
878
+ "core/skills/orchestration-skill/pipelines/refactor-planner/scripts/validate-and-generate-refactor.py",
879
+ "validate_refactor_list", "refactors", "dev-pipeline-refactor-list-v1", "R-",
880
+ ),
881
+ }
882
+
883
+ for kind, (relative_path, function_name, list_key, schema, prefix) in planner_config.items():
884
+ script_path = REPO_ROOT / relative_path
885
+ spec = spec_from_file_location(f"{kind}_planner_unknown_{location}", script_path)
886
+ module = module_from_spec(spec)
887
+ spec.loader.exec_module(module)
888
+ payload = {
889
+ "$schema": schema,
890
+ "project_name": "Fake",
891
+ list_key: _family_items(kind, [(f"{prefix}001", [], "pending")]),
892
+ }
893
+ if location == "root":
894
+ payload["unexpected_field"] = True
895
+ else:
896
+ payload["global_context"] = {"unexpected_field": True}
897
+
898
+ result = getattr(module, function_name)(payload)
899
+
900
+ assert result["valid"] is False
901
+ assert any("unknown fields: unexpected_field" in error for error in result["errors"])
902
+
903
+
723
904
  def test_bug_planner_validator_rejects_dependency_cycles():
724
905
  from importlib.util import module_from_spec, spec_from_file_location
725
906
 
@@ -1408,6 +1589,56 @@ def _install_runner_session_fakes(monkeypatch, runners, *, statuses=("success",)
1408
1589
 
1409
1590
 
1410
1591
 
1592
+ def test_outer_runner_routes_cursor_through_native_preflight_and_session_config(monkeypatch, tmp_path):
1593
+ from prizmkit_runtime import runners
1594
+ from prizmkit_runtime.runner_models import family_for, parse_invocation
1595
+
1596
+ paths = _make_paths(tmp_path / "cursor-outer-runtime")
1597
+ family = family_for("feature", paths)
1598
+ invocation = parse_invocation(family, "run", ())
1599
+ invocation = invocation.__class__(**{**invocation.__dict__, "list_path": paths.feature_plan})
1600
+ observed = _install_runner_session_fakes(
1601
+ monkeypatch,
1602
+ runners,
1603
+ statuses=("workflow_skipped",),
1604
+ update_status="completed",
1605
+ )
1606
+ monkeypatch.setattr(
1607
+ runners,
1608
+ "load_runtime_config",
1609
+ lambda _paths: SimpleNamespace(
1610
+ ai_client=SimpleNamespace(command="agent", platform="cursor", launch_profile=None),
1611
+ model="cursor-model",
1612
+ effort=None,
1613
+ effort_validation=SimpleNamespace(valid=True, message=""),
1614
+ ),
1615
+ )
1616
+ probes = []
1617
+
1618
+ def cursor_preflight(command, platform):
1619
+ probes.append((command, platform))
1620
+ return SimpleNamespace(enabled=True, notes=())
1621
+
1622
+ monkeypatch.setattr(runners, "detect_stream_json_support", cursor_preflight)
1623
+ monkeypatch.setattr(
1624
+ runners,
1625
+ "run_git_plan",
1626
+ lambda *args, **kwargs: SimpleNamespace(ok=True, reason="", results=()),
1627
+ )
1628
+
1629
+ status = runners._process_item(family, invocation, "F-001", paths, initial_metadata={})
1630
+
1631
+ assert status == "completed"
1632
+ assert probes == [("agent", "cursor")]
1633
+ assert len(observed.launch_configs) == 1
1634
+ launch = observed.launch_configs[0]
1635
+ assert launch.platform == "cursor"
1636
+ assert launch.cli_command == "agent"
1637
+ assert launch.use_stream_json is True
1638
+ assert launch.model == "per-item-model"
1639
+ assert launch.cwd == paths.project_root
1640
+
1641
+
1411
1642
  def test_workflow_skipped_is_finalized_as_completed_with_one_warning(monkeypatch, tmp_path, capsys):
1412
1643
  from prizmkit_runtime import runners
1413
1644
  from prizmkit_runtime.runner_models import family_for, parse_invocation