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.
- package/bin/create-prizmkit.js +4 -4
- package/bundled/VERSION.json +3 -3
- package/bundled/adapters/antigravity/assets/prizmkit-hook.cjs +150 -0
- package/bundled/adapters/antigravity/hooks-adapter.js +195 -0
- package/bundled/adapters/antigravity/paths.js +14 -0
- package/bundled/adapters/antigravity/rules-adapter.js +54 -0
- package/bundled/adapters/antigravity/skill-adapter.js +38 -0
- package/bundled/adapters/codex/skill-adapter.js +28 -8
- package/bundled/adapters/cursor/skill-adapter.js +13 -4
- package/bundled/adapters/pi/skill-adapter.js +28 -7
- package/bundled/dev-pipeline/.env.example +4 -12
- package/bundled/dev-pipeline/README.md +21 -15
- package/bundled/dev-pipeline/assets/skill-subagent-integration.md +3 -6
- package/bundled/dev-pipeline/prizmkit_runtime/atomic_io.py +48 -0
- package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +66 -23
- package/bundled/dev-pipeline/prizmkit_runtime/cli.py +10 -7
- package/bundled/dev-pipeline/prizmkit_runtime/commands.py +2 -21
- package/bundled/dev-pipeline/prizmkit_runtime/config.py +29 -70
- package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +125 -67
- package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +89 -442
- package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +93 -49
- package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -3
- package/bundled/dev-pipeline/prizmkit_runtime/paths.py +0 -6
- package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +49 -18
- package/bundled/dev-pipeline/prizmkit_runtime/processes.py +206 -151
- package/bundled/dev-pipeline/prizmkit_runtime/reset.py +2 -23
- package/bundled/dev-pipeline/prizmkit_runtime/reset_preserve.py +15 -134
- package/bundled/dev-pipeline/prizmkit_runtime/results.py +25 -0
- package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +68 -83
- package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +15 -5
- package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +1 -29
- package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runner_status.py +7 -2
- package/bundled/dev-pipeline/prizmkit_runtime/runners.py +282 -217
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +124 -122
- package/bundled/dev-pipeline/prizmkit_runtime/runtime_helper.py +90 -9
- package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +369 -154
- package/bundled/dev-pipeline/prizmkit_runtime/status.py +3 -3
- package/bundled/dev-pipeline/prizmkit_runtime/stream_progress.py +2780 -0
- package/bundled/dev-pipeline/prizmkit_runtime/task_checkout.py +27 -101
- package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +58 -4
- package/bundled/dev-pipeline/scripts/check-session-status.py +43 -19
- package/bundled/dev-pipeline/scripts/continuation.py +6 -4
- package/bundled/dev-pipeline/scripts/detect-stuck.py +28 -28
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -2
- package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +10 -7
- package/bundled/dev-pipeline/scripts/init-change-artifact.py +8 -2
- package/bundled/dev-pipeline/scripts/init-pipeline.py +14 -69
- package/bundled/dev-pipeline/scripts/parse-stream-progress.py +31 -2328
- package/bundled/dev-pipeline/scripts/patch-completion-notes.py +4 -24
- package/bundled/dev-pipeline/scripts/prompt_framework.py +56 -9
- package/bundled/dev-pipeline/scripts/status_common.py +591 -0
- package/bundled/dev-pipeline/scripts/update-bug-status.py +85 -463
- package/bundled/dev-pipeline/scripts/update-checkpoint.py +227 -65
- package/bundled/dev-pipeline/scripts/update-feature-status.py +76 -509
- package/bundled/dev-pipeline/scripts/utils.py +10 -15
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +4 -4
- package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +7 -0
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
- package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +1 -1
- package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +2 -2
- package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +2 -1
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +1 -1
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -6
- package/bundled/dev-pipeline/templates/session-status-schema.json +2 -5
- package/bundled/dev-pipeline/tests/_helpers.py +418 -0
- package/bundled/dev-pipeline/tests/conftest.py +45 -1
- package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +1 -0
- package/bundled/dev-pipeline/tests/test_auto_skip.py +4 -69
- package/bundled/dev-pipeline/tests/test_checkpoint_state.py +126 -1
- package/bundled/dev-pipeline/tests/test_daemon_and_scripts.py +257 -0
- package/bundled/dev-pipeline/tests/test_e2e_pipeline_run.py +500 -0
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +59 -117
- package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +12 -10
- package/bundled/dev-pipeline/tests/test_python_runner_parity.py +561 -3094
- package/bundled/dev-pipeline/tests/test_recovery_workflow.py +7 -8
- package/bundled/dev-pipeline/tests/test_repository_bootstrap.py +0 -1
- package/bundled/dev-pipeline/tests/test_reset_modes.py +15 -27
- package/bundled/dev-pipeline/tests/test_reset_preserve.py +54 -139
- package/bundled/dev-pipeline/tests/test_runner_bookkeeping.py +766 -0
- package/bundled/dev-pipeline/tests/test_runner_lifecycle.py +1257 -0
- package/bundled/dev-pipeline/tests/test_runtime_helper.py +97 -20
- package/bundled/dev-pipeline/tests/test_session_launch.py +1101 -0
- package/bundled/dev-pipeline/tests/test_stream_progress.py +585 -0
- package/bundled/dev-pipeline/tests/test_unified_cli.py +490 -2006
- package/bundled/dev-pipeline/tests/test_utils.py +3 -3
- package/bundled/rules/USAGE.md +1 -0
- package/bundled/skills/_metadata.json +9 -63
- package/bundled/skills/app-planner/SKILL.md +32 -303
- package/bundled/skills/app-planner/references/app-design-guide.md +0 -4
- package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
- package/bundled/skills/app-planner/references/project-brief-guide.md +14 -0
- package/bundled/skills/app-planner/references/project-conventions-discovery.md +4 -6
- package/bundled/skills/app-planner/references/project-state-detection.md +2 -3
- package/bundled/skills/bug-fix-workflow/SKILL.md +1 -2
- package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +4 -7
- package/bundled/skills/bug-planner/SKILL.md +54 -435
- package/bundled/skills/bug-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/bug-planner/references/input-formats.md +32 -0
- package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-pipeline-launcher/SKILL.md +4 -6
- package/bundled/skills/feature-pipeline-launcher/references/configuration.md +4 -28
- package/bundled/skills/feature-planner/SKILL.md +60 -439
- package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
- package/bundled/skills/feature-planner/references/completeness-review.md +34 -0
- package/bundled/skills/feature-planner/references/decomposition-patterns.md +2 -2
- package/bundled/skills/feature-planner/references/error-recovery.md +1 -1
- package/bundled/skills/feature-planner/references/generated-plan-review.md +3 -2
- package/bundled/skills/feature-planner/references/incremental-feature-planning.md +3 -1
- package/bundled/skills/feature-workflow/SKILL.md +1 -2
- package/bundled/skills/prizmkit/SKILL.md +7 -1
- package/bundled/skills/prizmkit-code-review/SKILL.md +14 -6
- package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +7 -4
- package/bundled/skills/prizmkit-code-review/references/review-report-template.md +16 -0
- package/bundled/skills/prizmkit-code-review/scripts/render_review_report.py +58 -20
- package/bundled/skills/prizmkit-implement/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +25 -128
- package/bundled/skills/prizmkit-init/assets/project-brief-template.md +3 -3
- package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
- package/bundled/skills/prizmkit-plan/SKILL.md +6 -8
- package/bundled/skills/prizmkit-plan/references/clarify-guide.md +1 -1
- package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +5 -2
- package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +6 -5
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +1 -13
- package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
- package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +1 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +6 -4
- package/bundled/skills/prizmkit-test/SKILL.md +25 -133
- package/bundled/skills/prizmkit-test/references/independent-test-review.md +5 -2
- package/bundled/skills/prizmkit-test/references/test-coverage-model.md +6 -0
- package/bundled/skills/prizmkit-workflow/SKILL.md +2 -3
- package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +4 -3
- package/bundled/skills/recovery-workflow/SKILL.md +7 -7
- package/bundled/skills/recovery-workflow/evals/evals.json +1 -1
- package/bundled/skills/recovery-workflow/references/detection.md +1 -3
- package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +0 -6
- package/bundled/templates/project-memory-template.md +1 -2
- package/package.json +1 -1
- package/src/ai-cli-launch.js +1 -1
- package/src/clean.js +40 -4
- package/src/config.js +64 -4
- package/src/detect-platform.js +10 -6
- package/src/external-skills.js +2 -2
- package/src/index.js +1 -0
- package/src/manifest.js +1 -1
- package/src/platforms.js +6 -2
- package/src/prompts.js +11 -3
- package/src/scaffold.js +87 -11
- package/src/upgrade.js +9 -3
- package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +0 -53
- package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +0 -649
- package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +0 -463
- package/bundled/dev-pipeline/scripts/update-refactor-status.py +0 -1512
- package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +0 -240
- package/bundled/dev-pipeline/templates/refactor-list-schema.json +0 -266
- package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +0 -15
- package/bundled/dev-pipeline/templates/sections/refactor-mission.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +0 -16
- package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +0 -9
- package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +0 -22
- package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +0 -19
- package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +0 -24
- package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +0 -12
- package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -6
- package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +0 -52
- package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +0 -478
- package/bundled/skills/feature-planner/assets/evaluation-guide.md +0 -44
- package/bundled/skills/refactor-pipeline-launcher/SKILL.md +0 -219
- package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +0 -78
- package/bundled/skills/refactor-planner/SKILL.md +0 -467
- package/bundled/skills/refactor-planner/assets/planning-guide.md +0 -291
- package/bundled/skills/refactor-planner/references/behavior-preservation.md +0 -187
- package/bundled/skills/refactor-planner/references/error-recovery.md +0 -45
- package/bundled/skills/refactor-planner/references/fast-path.md +0 -59
- package/bundled/skills/refactor-planner/references/generated-plan-review.md +0 -107
- package/bundled/skills/refactor-planner/references/planning-phases.md +0 -172
- package/bundled/skills/refactor-planner/references/refactor-scoping-guide.md +0 -230
- package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +0 -1120
- package/bundled/skills/refactor-workflow/SKILL.md +0 -205
|
@@ -23,7 +23,6 @@ DETECTOR_PATH = (
|
|
|
23
23
|
STATE_DIRS = {
|
|
24
24
|
"feature": "features",
|
|
25
25
|
"bugfix": "bugfix",
|
|
26
|
-
"refactor": "refactor",
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
|
|
@@ -208,7 +207,7 @@ def test_zero_candidates_filters_invalid_records_without_history_fallback_or_ses
|
|
|
208
207
|
state="completed",
|
|
209
208
|
)
|
|
210
209
|
_write_checkout(project, "feature", "B-999", wrong_family_branch)
|
|
211
|
-
_write_checkout(project, "
|
|
210
|
+
_write_checkout(project, "feature", "F-008", "dev/F-008-missing")
|
|
212
211
|
|
|
213
212
|
historical = project / ".prizmkit" / "state" / "recovery" / "historical-only"
|
|
214
213
|
historical.mkdir(parents=True)
|
|
@@ -260,14 +259,14 @@ def test_detector_rejects_malformed_or_mismatched_checkout_identity(tmp_path):
|
|
|
260
259
|
},
|
|
261
260
|
),
|
|
262
261
|
(
|
|
263
|
-
"
|
|
264
|
-
"
|
|
265
|
-
"
|
|
262
|
+
"bugfix",
|
|
263
|
+
"B-005",
|
|
264
|
+
"bugfix/B-005-wrong-type",
|
|
266
265
|
{
|
|
267
266
|
"task_type": "feature",
|
|
268
|
-
"task_id": "
|
|
267
|
+
"task_id": "B-005",
|
|
269
268
|
"state": "active",
|
|
270
|
-
"active_dev_branch": "
|
|
269
|
+
"active_dev_branch": "bugfix/B-005-wrong-type",
|
|
271
270
|
"base_branch": "main",
|
|
272
271
|
"checkout_mode": "branch",
|
|
273
272
|
},
|
|
@@ -301,7 +300,7 @@ def test_recovery_workflow_metadata_matches_detector_only_contract():
|
|
|
301
300
|
description = recovery["description"].lower()
|
|
302
301
|
|
|
303
302
|
assert recovery["hasScripts"] is True
|
|
304
|
-
assert "active feature
|
|
303
|
+
assert "active feature or bugfix checkout records" in description
|
|
305
304
|
assert "operation-first" in description
|
|
306
305
|
assert "direct requirement" not in description
|
|
307
306
|
|
|
@@ -199,7 +199,6 @@ def test_runner_uses_real_master_when_recorded_base_main_does_not_exist(monkeypa
|
|
|
199
199
|
from prizmkit_runtime.runner_models import family_for, parse_invocation
|
|
200
200
|
from prizmkit_runtime.task_checkout import TaskCheckout, load_task_checkout, persist_task_checkout
|
|
201
201
|
|
|
202
|
-
monkeypatch.delenv("USE_WORKTREE", raising=False)
|
|
203
202
|
monkeypatch.delenv("DEV_BRANCH", raising=False)
|
|
204
203
|
monkeypatch.setattr(
|
|
205
204
|
runners,
|
|
@@ -249,16 +249,6 @@ FAMILY_CONTRACTS = {
|
|
|
249
249
|
"branch_prefix": "bugfix",
|
|
250
250
|
"artifact_root": "bugfix",
|
|
251
251
|
},
|
|
252
|
-
"refactor": {
|
|
253
|
-
"prefix": "R-",
|
|
254
|
-
"list_key": "refactors",
|
|
255
|
-
"list_arg": "--refactor-list",
|
|
256
|
-
"id_arg": "--refactor-id",
|
|
257
|
-
"schema": "dev-pipeline-refactor-list-v1",
|
|
258
|
-
"script": "update-refactor-status.py",
|
|
259
|
-
"branch_prefix": "refactor",
|
|
260
|
-
"artifact_root": "refactor",
|
|
261
|
-
},
|
|
262
252
|
}
|
|
263
253
|
|
|
264
254
|
|
|
@@ -353,11 +343,11 @@ def _init_git_repository(project_root):
|
|
|
353
343
|
return source
|
|
354
344
|
|
|
355
345
|
|
|
356
|
-
@pytest.mark.parametrize("kind", ("feature", "bugfix"
|
|
346
|
+
@pytest.mark.parametrize("kind", ("feature", "bugfix"))
|
|
357
347
|
def test_state_only_resets_exact_causal_records_and_preserves_checkout_git_and_artifacts(tmp_path, kind):
|
|
358
348
|
from prizmkit_runtime.reset import run_reset_command
|
|
359
349
|
from prizmkit_runtime.task_checkout import (
|
|
360
|
-
|
|
350
|
+
CHECKOUT_MODE_BRANCH,
|
|
361
351
|
TaskCheckout,
|
|
362
352
|
persist_task_checkout,
|
|
363
353
|
)
|
|
@@ -384,17 +374,16 @@ def test_state_only_resets_exact_causal_records_and_preserves_checkout_git_and_a
|
|
|
384
374
|
branch_name = f"{contract['branch_prefix']}/{root_id}-preserved"
|
|
385
375
|
_git(paths.project_root, "branch", branch_name, "main")
|
|
386
376
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
377
|
+
extra_dir = paths.project_root / ".task-worktrees" / root_id
|
|
378
|
+
extra_dir.mkdir(parents=True)
|
|
379
|
+
extra_marker = extra_dir / "keep.txt"
|
|
380
|
+
extra_marker.write_text("checkout files remain\n", encoding="utf-8")
|
|
391
381
|
checkout = TaskCheckout.active(
|
|
392
382
|
kind,
|
|
393
383
|
root_id,
|
|
394
384
|
branch_name,
|
|
395
385
|
"main",
|
|
396
|
-
checkout_mode=
|
|
397
|
-
worktree_path=str(worktree_path),
|
|
386
|
+
checkout_mode=CHECKOUT_MODE_BRANCH,
|
|
398
387
|
)
|
|
399
388
|
persist_task_checkout(family.state_dir, checkout)
|
|
400
389
|
checkout_path = family.state_dir / root_id / "checkout.json"
|
|
@@ -425,7 +414,7 @@ def test_state_only_resets_exact_causal_records_and_preserves_checkout_git_and_a
|
|
|
425
414
|
"session": session_log.read_bytes(),
|
|
426
415
|
"checkpoint": checkpoint.read_bytes(),
|
|
427
416
|
"artifact": artifact.read_bytes(),
|
|
428
|
-
"
|
|
417
|
+
"extra": extra_marker.read_bytes(),
|
|
429
418
|
"other_status": other_status_path.read_bytes(),
|
|
430
419
|
"completed_status": completed_status_path.read_bytes(),
|
|
431
420
|
"source": source_path.read_bytes(),
|
|
@@ -489,7 +478,7 @@ def test_state_only_resets_exact_causal_records_and_preserves_checkout_git_and_a
|
|
|
489
478
|
assert session_log.read_bytes() == protected_bytes["session"]
|
|
490
479
|
assert checkpoint.read_bytes() == protected_bytes["checkpoint"]
|
|
491
480
|
assert artifact.read_bytes() == protected_bytes["artifact"]
|
|
492
|
-
assert
|
|
481
|
+
assert extra_marker.read_bytes() == protected_bytes["extra"]
|
|
493
482
|
assert other_status_path.read_bytes() == protected_bytes["other_status"]
|
|
494
483
|
assert completed_status_path.read_bytes() == protected_bytes["completed_status"]
|
|
495
484
|
assert source_path.read_bytes() == protected_bytes["source"]
|
|
@@ -501,7 +490,7 @@ def test_state_only_resets_exact_causal_records_and_preserves_checkout_git_and_a
|
|
|
501
490
|
|
|
502
491
|
@pytest.mark.parametrize(
|
|
503
492
|
("kind", "second_root_status"),
|
|
504
|
-
(("feature", "skipped"), ("bugfix", "needs_info")
|
|
493
|
+
(("feature", "skipped"), ("bugfix", "needs_info")),
|
|
505
494
|
)
|
|
506
495
|
def test_state_only_all_recovers_all_supported_chains_without_pipeline_state(tmp_path, kind, second_root_status):
|
|
507
496
|
from prizmkit_runtime.reset import run_reset_command
|
|
@@ -542,7 +531,7 @@ def test_state_only_all_recovers_all_supported_chains_without_pipeline_state(tmp
|
|
|
542
531
|
assert not (family.state_dir / "pipeline.json").exists()
|
|
543
532
|
|
|
544
533
|
|
|
545
|
-
@pytest.mark.parametrize("kind", ("feature", "bugfix"
|
|
534
|
+
@pytest.mark.parametrize("kind", ("feature", "bugfix"))
|
|
546
535
|
def test_state_only_all_recovers_rootless_auto_skipped_chain(tmp_path, kind):
|
|
547
536
|
from prizmkit_runtime.reset import run_reset_command
|
|
548
537
|
|
|
@@ -581,7 +570,7 @@ def test_state_only_all_recovers_rootless_auto_skipped_chain(tmp_path, kind):
|
|
|
581
570
|
assert json.loads(child_status_path.read_text(encoding="utf-8"))["custom_diagnostic"] == {"keep": True}
|
|
582
571
|
|
|
583
572
|
|
|
584
|
-
@pytest.mark.parametrize("kind", ("feature", "bugfix"
|
|
573
|
+
@pytest.mark.parametrize("kind", ("feature", "bugfix"))
|
|
585
574
|
def test_state_only_selected_orphan_recovers_only_its_causal_descendants(tmp_path, kind):
|
|
586
575
|
from prizmkit_runtime.reset import run_reset_command
|
|
587
576
|
|
|
@@ -621,7 +610,7 @@ def test_state_only_selected_orphan_recovers_only_its_causal_descendants(tmp_pat
|
|
|
621
610
|
}
|
|
622
611
|
|
|
623
612
|
|
|
624
|
-
@pytest.mark.parametrize("kind", ("feature", "bugfix"
|
|
613
|
+
@pytest.mark.parametrize("kind", ("feature", "bugfix"))
|
|
625
614
|
def test_reset_without_mode_fails_before_any_mutation(tmp_path, kind):
|
|
626
615
|
from prizmkit_runtime.reset import run_reset_command
|
|
627
616
|
|
|
@@ -749,7 +738,7 @@ def test_state_only_invalid_target_or_graph_is_fail_closed(tmp_path, items, args
|
|
|
749
738
|
assert _tree_snapshot(family.state_dir) == before_state
|
|
750
739
|
|
|
751
740
|
|
|
752
|
-
@pytest.mark.parametrize("kind", ("feature", "bugfix"
|
|
741
|
+
@pytest.mark.parametrize("kind", ("feature", "bugfix"))
|
|
753
742
|
@pytest.mark.parametrize("mode", ("--fresh-checkout", "--clean"))
|
|
754
743
|
@pytest.mark.parametrize(
|
|
755
744
|
("selector", "expected_numbers"),
|
|
@@ -806,7 +795,7 @@ def test_fresh_checkout_and_clean_keep_id_range_and_filter_selection(
|
|
|
806
795
|
assert all(entry[3] is (mode == "--clean") for entry in captured)
|
|
807
796
|
|
|
808
797
|
|
|
809
|
-
@pytest.mark.parametrize("kind", ("feature", "bugfix"
|
|
798
|
+
@pytest.mark.parametrize("kind", ("feature", "bugfix"))
|
|
810
799
|
def test_clean_uses_item_state_without_pipeline_state_but_fresh_checkout_still_requires_it(
|
|
811
800
|
monkeypatch,
|
|
812
801
|
tmp_path,
|
|
@@ -1187,7 +1176,6 @@ def test_canonical_reset_guidance_documents_every_explicit_mode_without_generate
|
|
|
1187
1176
|
launchers = {
|
|
1188
1177
|
"feature-pipeline-launcher": ("feature", "F-001"),
|
|
1189
1178
|
"bugfix-pipeline-launcher": ("bugfix", "B-001"),
|
|
1190
|
-
"refactor-pipeline-launcher": ("refactor", "R-001"),
|
|
1191
1179
|
}
|
|
1192
1180
|
for launcher, (family, item_id) in launchers.items():
|
|
1193
1181
|
source = (launcher_root / launcher / "SKILL.md").read_text(encoding="utf-8")
|
|
@@ -27,7 +27,6 @@ def _write_family_plan(paths, kind, items):
|
|
|
27
27
|
plan_config = {
|
|
28
28
|
"feature": (paths.feature_plan, "features", "dev-pipeline-feature-list-v1"),
|
|
29
29
|
"bugfix": (paths.bugfix_plan, "bugs", "dev-pipeline-bug-fix-list-v1"),
|
|
30
|
-
"refactor": (paths.refactor_plan, "refactors", "dev-pipeline-refactor-list-v1"),
|
|
31
30
|
}
|
|
32
31
|
plan_path, list_key, schema = plan_config[kind]
|
|
33
32
|
plan_path.write_text(
|
|
@@ -53,14 +52,6 @@ def _write_semantic_completion_checkpoint(project_root, artifact_dir, workflow_t
|
|
|
53
52
|
"prizmkit-retrospective", "prizmkit-committer", "bug-report",
|
|
54
53
|
],
|
|
55
54
|
),
|
|
56
|
-
"refactor-pipeline": (
|
|
57
|
-
"refactor_state",
|
|
58
|
-
[
|
|
59
|
-
"prizmkit-implement", "prizmkit-code-review", "prizmkit-test",
|
|
60
|
-
"prizmkit-retrospective", "prizmkit-committer", "refactor-report",
|
|
61
|
-
"completion-summary",
|
|
62
|
-
],
|
|
63
|
-
),
|
|
64
55
|
}
|
|
65
56
|
state_key, skills = contracts[workflow_type]
|
|
66
57
|
steps = []
|
|
@@ -143,7 +134,6 @@ def _preserve_family_contract(kind):
|
|
|
143
134
|
return {
|
|
144
135
|
"feature": ("F-", "dev", "feature-pipeline", "specs"),
|
|
145
136
|
"bugfix": ("B-", "bugfix", "bugfix-pipeline", "bugfix"),
|
|
146
|
-
"refactor": ("R-", "refactor", "refactor-pipeline", "refactor"),
|
|
147
137
|
}[kind]
|
|
148
138
|
|
|
149
139
|
|
|
@@ -213,7 +203,7 @@ def _write_preserve_runtime_state(paths, kind, item_id, branch, *, base_branch="
|
|
|
213
203
|
return family, status_path, status, checkout
|
|
214
204
|
|
|
215
205
|
|
|
216
|
-
@pytest.mark.parametrize("kind", ["feature", "bugfix"
|
|
206
|
+
@pytest.mark.parametrize("kind", ["feature", "bugfix"])
|
|
217
207
|
def test_preserve_runtime_restores_failed_chain_and_preserves_existing_checkout_history(tmp_path, kind):
|
|
218
208
|
from prizmkit_runtime.reset import run_reset_command
|
|
219
209
|
from prizmkit_runtime.task_checkout import load_task_checkout
|
|
@@ -271,7 +261,7 @@ def test_preserve_runtime_restores_failed_chain_and_preserves_existing_checkout_
|
|
|
271
261
|
assert "Reset did not start a runner" in result.render()
|
|
272
262
|
|
|
273
263
|
|
|
274
|
-
@pytest.mark.parametrize("kind", ["feature", "bugfix"
|
|
264
|
+
@pytest.mark.parametrize("kind", ["feature", "bugfix"])
|
|
275
265
|
def test_preserve_runtime_no_failed_root_is_a_noop_without_checkout_state(tmp_path, kind):
|
|
276
266
|
from prizmkit_runtime.reset import run_reset_command
|
|
277
267
|
from prizmkit_runtime.runner_models import family_for
|
|
@@ -414,7 +404,7 @@ def test_preserve_runtime_respects_existing_task_guard_without_mutation(tmp_path
|
|
|
414
404
|
|
|
415
405
|
@pytest.mark.parametrize(
|
|
416
406
|
("kind", "item_id"),
|
|
417
|
-
[("feature", "F-001"), ("bugfix", "B-001")
|
|
407
|
+
[("feature", "F-001"), ("bugfix", "B-001")],
|
|
418
408
|
)
|
|
419
409
|
def test_public_reset_cli_hard_rejects_run_for_every_family_without_state_change(tmp_path, kind, item_id):
|
|
420
410
|
project = tmp_path / kind
|
|
@@ -638,7 +628,6 @@ def _add_completed_plan_step(checkpoint):
|
|
|
638
628
|
state_key = {
|
|
639
629
|
"feature-pipeline": "feature_state",
|
|
640
630
|
"bugfix-pipeline": "bugfix_state",
|
|
641
|
-
"refactor-pipeline": "refactor_state",
|
|
642
631
|
}[payload["workflow_type"]]
|
|
643
632
|
payload[state_key]["completed_stages"] = ["plan", "implement", "code-review", "test"]
|
|
644
633
|
checkpoint.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")
|
|
@@ -712,7 +701,6 @@ def test_preserve_runtime_missing_branch_creates_replacement_and_rewinds_checkpo
|
|
|
712
701
|
("kind", "item_id", "branch_prefix", "workflow_type", "artifact_root", "state_key"),
|
|
713
702
|
[
|
|
714
703
|
("bugfix", "B-001", "bugfix", "bugfix-pipeline", "bugfix", "bugfix_state"),
|
|
715
|
-
("refactor", "R-001", "refactor", "refactor-pipeline", "refactor", "refactor_state"),
|
|
716
704
|
],
|
|
717
705
|
)
|
|
718
706
|
def test_missing_branch_checkpoint_rewind_has_cross_family_parity(
|
|
@@ -760,22 +748,16 @@ def test_missing_branch_checkpoint_rewind_has_cross_family_parity(
|
|
|
760
748
|
assert all(step["status"] == "pending" for step in persisted["steps"][1:])
|
|
761
749
|
assert persisted[state_key]["stage"] == "implement"
|
|
762
750
|
assert persisted[state_key]["current_stage"] == "prizmkit-implement"
|
|
763
|
-
collection = {"bugfix": "bugs"
|
|
751
|
+
collection = {"bugfix": "bugs"}[kind]
|
|
764
752
|
assert json.loads(plan.read_text(encoding="utf-8"))[collection][0]["status"] == "pending"
|
|
765
753
|
|
|
766
754
|
|
|
767
|
-
def
|
|
768
|
-
from prizmkit_runtime.gitops import
|
|
769
|
-
BranchContext,
|
|
770
|
-
WorktreePolicy,
|
|
771
|
-
ensure_linked_worktree,
|
|
772
|
-
registered_worktrees,
|
|
773
|
-
worktree_runtime_context,
|
|
774
|
-
)
|
|
755
|
+
def test_preserve_runtime_reuses_branch_checkout_without_cleanup(tmp_path):
|
|
756
|
+
from prizmkit_runtime.gitops import create_branch_from_base, local_branch_exists, registered_worktrees
|
|
775
757
|
from prizmkit_runtime.reset import run_reset_command
|
|
776
758
|
from prizmkit_runtime.runner_models import family_for
|
|
777
759
|
from prizmkit_runtime.task_checkout import (
|
|
778
|
-
|
|
760
|
+
CHECKOUT_MODE_BRANCH,
|
|
779
761
|
TaskCheckout,
|
|
780
762
|
load_task_checkout,
|
|
781
763
|
persist_task_checkout,
|
|
@@ -789,107 +771,64 @@ def test_preserve_runtime_reuses_registered_worktree_without_cleanup(tmp_path):
|
|
|
789
771
|
[{"id": "F-001", "title": "Root", "status": "failed", "dependencies": []}],
|
|
790
772
|
)
|
|
791
773
|
family, status_path, _before_status, _old_checkout = _write_preserve_runtime_state(
|
|
792
|
-
paths, "feature", "F-001", "dev/F-001-
|
|
793
|
-
)
|
|
794
|
-
runtime = worktree_runtime_context(
|
|
795
|
-
BranchContext("main", "dev/F-001-worktree", paths.project_root),
|
|
796
|
-
WorktreePolicy(True, True, True, tmp_path / "worktrees"),
|
|
774
|
+
paths, "feature", "F-001", "dev/F-001-branch"
|
|
797
775
|
)
|
|
798
|
-
assert
|
|
799
|
-
|
|
776
|
+
assert create_branch_from_base(paths.project_root, "dev/F-001-branch", "main").return_code == 0
|
|
777
|
+
branch_checkout = TaskCheckout.active(
|
|
800
778
|
"feature",
|
|
801
779
|
"F-001",
|
|
802
|
-
"dev/F-001-
|
|
780
|
+
"dev/F-001-branch",
|
|
803
781
|
"main",
|
|
804
|
-
checkout_mode=
|
|
805
|
-
worktree_path=str(runtime.worktree_path),
|
|
782
|
+
checkout_mode=CHECKOUT_MODE_BRANCH,
|
|
806
783
|
)
|
|
807
|
-
persist_task_checkout(family.state_dir,
|
|
808
|
-
artifact =
|
|
784
|
+
persist_task_checkout(family.state_dir, branch_checkout)
|
|
785
|
+
artifact = paths.project_root / ".prizmkit" / "specs" / "001-root"
|
|
809
786
|
artifact.mkdir(parents=True)
|
|
810
787
|
marker = artifact / "partial.md"
|
|
811
|
-
marker.write_text("
|
|
788
|
+
marker.write_text("branch WIP\n", encoding="utf-8")
|
|
812
789
|
registrations_before = registered_worktrees(paths.project_root)
|
|
813
790
|
|
|
814
791
|
result = run_reset_command("feature", ("--failed", "--preserve-runtime"), paths)
|
|
815
792
|
|
|
816
793
|
assert result.exit_code == 0, result.render()
|
|
817
|
-
assert load_task_checkout(family.state_dir, "feature", "F-001") ==
|
|
818
|
-
assert
|
|
819
|
-
assert marker.read_text(encoding="utf-8") == "
|
|
794
|
+
assert load_task_checkout(family.state_dir, "feature", "F-001") == branch_checkout
|
|
795
|
+
assert local_branch_exists(paths.project_root, "dev/F-001-branch")
|
|
796
|
+
assert marker.read_text(encoding="utf-8") == "branch WIP\n"
|
|
820
797
|
assert registered_worktrees(paths.project_root) == registrations_before
|
|
821
798
|
assert json.loads(status_path.read_text(encoding="utf-8"))["continuation_pending"] is True
|
|
822
799
|
assert json.loads(plan.read_text(encoding="utf-8"))["features"][0]["status"] == "pending"
|
|
823
800
|
|
|
824
801
|
|
|
825
|
-
def
|
|
802
|
+
def test_replacement_branch_skips_registered_branch_collision(monkeypatch, tmp_path):
|
|
826
803
|
from prizmkit_runtime import reset_preserve
|
|
827
|
-
from prizmkit_runtime.gitops import
|
|
828
|
-
BranchContext,
|
|
829
|
-
RegisteredWorktree,
|
|
830
|
-
WorktreePolicy,
|
|
831
|
-
worktree_runtime_context,
|
|
832
|
-
)
|
|
804
|
+
from prizmkit_runtime.gitops import RegisteredWorktree
|
|
833
805
|
from prizmkit_runtime.runner_models import family_for
|
|
834
|
-
from prizmkit_runtime.task_checkout import CHECKOUT_MODE_WORKTREE, TaskCheckout
|
|
835
806
|
|
|
836
807
|
paths = _make_paths(tmp_path)
|
|
837
808
|
_init_preserve_runtime_repo(paths)
|
|
838
809
|
family = family_for("feature", paths)
|
|
839
|
-
worktree_root = tmp_path / "worktrees"
|
|
840
|
-
old_runtime = worktree_runtime_context(
|
|
841
|
-
BranchContext("main", "dev/F-001-old", paths.project_root),
|
|
842
|
-
WorktreePolicy(True, True, True, worktree_root),
|
|
843
|
-
)
|
|
844
|
-
checkout = TaskCheckout.active(
|
|
845
|
-
"feature",
|
|
846
|
-
"F-001",
|
|
847
|
-
"dev/F-001-old",
|
|
848
|
-
"main",
|
|
849
|
-
checkout_mode=CHECKOUT_MODE_WORKTREE,
|
|
850
|
-
worktree_path=str(old_runtime.worktree_path),
|
|
851
|
-
)
|
|
852
810
|
item = reset_preserve.PreservePlanItem(
|
|
853
811
|
"F-001", "Root", "001-root", "failed", (), 0
|
|
854
812
|
)
|
|
855
813
|
monkeypatch.setattr(reset_preserve.time, "strftime", lambda *_args: "20260725120000")
|
|
856
|
-
colliding_runtime = worktree_runtime_context(
|
|
857
|
-
BranchContext(
|
|
858
|
-
"main",
|
|
859
|
-
"dev/F-001-resume-20260725120000",
|
|
860
|
-
paths.project_root,
|
|
861
|
-
),
|
|
862
|
-
WorktreePolicy(True, True, True, worktree_root),
|
|
863
|
-
)
|
|
864
814
|
registration = RegisteredWorktree(
|
|
865
|
-
|
|
866
|
-
"
|
|
815
|
+
tmp_path / "other-checkout",
|
|
816
|
+
"dev/F-001-resume-20260725120000",
|
|
867
817
|
)
|
|
868
818
|
|
|
869
|
-
branch
|
|
819
|
+
branch = reset_preserve._replacement_identity(
|
|
870
820
|
family,
|
|
871
821
|
item,
|
|
872
|
-
checkout,
|
|
873
822
|
paths.project_root,
|
|
874
823
|
(registration,),
|
|
875
|
-
old_runtime,
|
|
876
824
|
)
|
|
877
825
|
|
|
878
826
|
assert branch == "dev/F-001-resume-20260725120000-1"
|
|
879
|
-
assert runtime is not None
|
|
880
|
-
assert runtime.worktree_path != colliding_runtime.worktree_path
|
|
881
827
|
|
|
882
828
|
|
|
883
|
-
def
|
|
884
|
-
from prizmkit_runtime.gitops import BranchContext, WorktreePolicy, worktree_runtime_context
|
|
829
|
+
def test_preserve_runtime_rejects_legacy_worktree_checkout(tmp_path):
|
|
885
830
|
from prizmkit_runtime.reset import run_reset_command
|
|
886
|
-
from prizmkit_runtime.
|
|
887
|
-
from prizmkit_runtime.task_checkout import (
|
|
888
|
-
CHECKOUT_MODE_WORKTREE,
|
|
889
|
-
TaskCheckout,
|
|
890
|
-
load_task_checkout,
|
|
891
|
-
persist_task_checkout,
|
|
892
|
-
)
|
|
831
|
+
from prizmkit_runtime.task_checkout import TaskCheckoutError, load_task_checkout
|
|
893
832
|
|
|
894
833
|
paths = _make_paths(tmp_path)
|
|
895
834
|
_init_preserve_runtime_repo(paths)
|
|
@@ -898,60 +837,36 @@ def test_preserve_runtime_missing_worktree_copies_reference_artifacts_without_de
|
|
|
898
837
|
"feature",
|
|
899
838
|
[{"id": "F-001", "title": "Root", "status": "failed", "dependencies": []}],
|
|
900
839
|
)
|
|
901
|
-
family, status_path,
|
|
902
|
-
paths, "feature", "F-001", "dev/F-001-
|
|
903
|
-
)
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
840
|
+
family, status_path, _before_status, _branch_checkout = _write_preserve_runtime_state(
|
|
841
|
+
paths, "feature", "F-001", "dev/F-001-legacy-worktree"
|
|
842
|
+
)
|
|
843
|
+
legacy_worktree = tmp_path / "legacy-worktrees" / "dev-F-001-legacy-worktree"
|
|
844
|
+
legacy_checkout_path = family.state_dir / "F-001" / "checkout.json"
|
|
845
|
+
legacy_checkout_path.write_text(
|
|
846
|
+
json.dumps(
|
|
847
|
+
{
|
|
848
|
+
"task_type": "feature",
|
|
849
|
+
"task_id": "F-001",
|
|
850
|
+
"state": "active",
|
|
851
|
+
"active_dev_branch": "dev/F-001-legacy-worktree",
|
|
852
|
+
"base_branch": "main",
|
|
853
|
+
"checkout_mode": "worktree",
|
|
854
|
+
"worktree_path": str(legacy_worktree),
|
|
855
|
+
}
|
|
856
|
+
),
|
|
857
|
+
encoding="utf-8",
|
|
907
858
|
)
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
"feature",
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
checkout_mode=CHECKOUT_MODE_WORKTREE,
|
|
915
|
-
worktree_path=str(old_runtime.worktree_path),
|
|
916
|
-
)
|
|
917
|
-
persist_task_checkout(family.state_dir, old_checkout)
|
|
918
|
-
old_artifact = old_runtime.worktree_path / ".prizmkit" / "specs" / "001-root"
|
|
919
|
-
old_checkpoint = _write_semantic_completion_checkpoint(old_runtime.worktree_path, old_artifact)
|
|
920
|
-
_add_completed_plan_step(old_checkpoint)
|
|
921
|
-
old_marker = old_artifact / "partial.md"
|
|
922
|
-
old_marker.write_text("old reference\n", encoding="utf-8")
|
|
923
|
-
external_reference = tmp_path / "external-reference.txt"
|
|
924
|
-
external_reference.write_text("do not copy through symlink\n", encoding="utf-8")
|
|
925
|
-
old_link = old_artifact / "external-reference"
|
|
926
|
-
old_link.symlink_to(external_reference)
|
|
927
|
-
old_checkpoint_before = old_checkpoint.read_bytes()
|
|
859
|
+
|
|
860
|
+
with pytest.raises(TaskCheckoutError, match="retired worktree checkout mode"):
|
|
861
|
+
load_task_checkout(family.state_dir, "feature", "F-001")
|
|
862
|
+
|
|
863
|
+
status_before = status_path.read_bytes()
|
|
864
|
+
plan_before = plan.read_bytes()
|
|
928
865
|
|
|
929
866
|
result = run_reset_command("feature", ("--failed", "--preserve-runtime"), paths)
|
|
930
867
|
|
|
931
|
-
assert result.exit_code
|
|
932
|
-
|
|
933
|
-
assert
|
|
934
|
-
assert
|
|
935
|
-
assert
|
|
936
|
-
assert Path(checkout.worktree_path).is_dir()
|
|
937
|
-
assert old_runtime.worktree_path.is_dir()
|
|
938
|
-
assert old_checkpoint.read_bytes() == old_checkpoint_before
|
|
939
|
-
assert old_marker.read_text(encoding="utf-8") == "old reference\n"
|
|
940
|
-
copied_artifact = Path(checkout.worktree_path) / ".prizmkit" / "specs" / "001-root"
|
|
941
|
-
assert (copied_artifact / "partial.md").read_text(encoding="utf-8") == "old reference\n"
|
|
942
|
-
copied_link = copied_artifact / "external-reference"
|
|
943
|
-
assert copied_link.is_symlink()
|
|
944
|
-
assert copied_link.resolve() == external_reference.resolve()
|
|
945
|
-
copied_checkpoint = json.loads((copied_artifact / "workflow-checkpoint.json").read_text(encoding="utf-8"))
|
|
946
|
-
assert copied_checkpoint["steps"][0]["status"] == "completed"
|
|
947
|
-
assert all(step["status"] == "pending" for step in copied_checkpoint["steps"][1:])
|
|
948
|
-
expected_status = dict(before_status)
|
|
949
|
-
expected_status.update(
|
|
950
|
-
retry_count=0,
|
|
951
|
-
infra_error_count=0,
|
|
952
|
-
continuation_pending=True,
|
|
953
|
-
active_dev_branch=checkout.active_dev_branch,
|
|
954
|
-
base_branch="main",
|
|
955
|
-
)
|
|
956
|
-
assert json.loads(status_path.read_text(encoding="utf-8")) == expected_status
|
|
957
|
-
assert json.loads(plan.read_text(encoding="utf-8"))["features"][0]["status"] == "pending"
|
|
868
|
+
assert result.exit_code != 0
|
|
869
|
+
assert "retired worktree checkout mode" in result.render()
|
|
870
|
+
assert str(legacy_worktree) in result.render()
|
|
871
|
+
assert status_path.read_bytes() == status_before
|
|
872
|
+
assert plan.read_bytes() == plan_before
|