phase-loop-runtime 0.2.0__py3-none-any.whl
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.
- phase_loop_runtime/__init__.py +20 -0
- phase_loop_runtime/_contract_docs/phase-loop/extraction-readiness.md +90 -0
- phase_loop_runtime/_contract_docs/phase-loop/granular-execution-policy.md +137 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-capability-matrix.md +510 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-skill-matrix.md +125 -0
- phase_loop_runtime/_contract_docs/phase-loop/harness-substrate-manifest.md +232 -0
- phase_loop_runtime/_contract_docs/phase-loop/pi-loop-control.md +247 -0
- phase_loop_runtime/_contract_docs/phase-loop/protocol.md +2759 -0
- phase_loop_runtime/_contract_docs/phase-loop/runtime-boundary.md +289 -0
- phase_loop_runtime/_contract_docs/phase-loop/spec-discovery-roots.md +47 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-governed-pipeline.md +42 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-portal-projection.md +34 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-regenesis.md +29 -0
- phase_loop_runtime/_contract_docs/phase-loop/substrate-soak-report.md +32 -0
- phase_loop_runtime/_contract_docs/runtime/verification-evidence-contract.md +52 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/commands.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-mixed-signals/mixed.json +5 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-provider-timeout/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-provider-timeout/timeout-note.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-redacted-summary/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-redacted-summary/redacted-summary.json +6 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-small-sample/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-small-sample/sample.json +7 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-threshold-edge/edge.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/borderline/borderline-threshold-edge/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-a.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-b.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-duplicate-png/shot-c.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-missing-references/claimed-results.json +5 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-missing-references/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-subtle-low-variance/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-subtle-low-variance/metrics.json +9 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-templated-prose/findings.md +10 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-templated-prose/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/scores.json +4 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-fake/fake-uniform-scores/summary.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/bundle-check.json +8 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-adoption-bundle/operator-note.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/events-sample.jsonl +3 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-handoff-ledger/receipt.txt +1 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/evidence.json +13 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-runner-diff/summary.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/matrix.json +9 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-test-matrix/notes.md +4 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/console-summary.txt +2 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/manifest.json +16 -0
- phase_loop_runtime/_test_fixtures/evidence-audit-calibration/known-real/real-ui-screenshot-standin/screenshot-standin.ppm +5 -0
- phase_loop_runtime/adoption_bundle.py +273 -0
- phase_loop_runtime/advisor_board/CONTRACTS.md +257 -0
- phase_loop_runtime/advisor_board/__init__.py +288 -0
- phase_loop_runtime/advisor_board/backing.py +137 -0
- phase_loop_runtime/advisor_board/backing_omnigent.py +498 -0
- phase_loop_runtime/advisor_board/config.py +225 -0
- phase_loop_runtime/advisor_board/events.py +115 -0
- phase_loop_runtime/advisor_board/fixtures/advisor-boards.example.toml +59 -0
- phase_loop_runtime/advisor_board/fixtures.py +91 -0
- phase_loop_runtime/advisor_board/harness_mapping.py +125 -0
- phase_loop_runtime/advisor_board/matrix.py +146 -0
- phase_loop_runtime/advisor_board/observability.py +481 -0
- phase_loop_runtime/advisor_board/presets.py +188 -0
- phase_loop_runtime/advisor_board/registries.py +309 -0
- phase_loop_runtime/advisor_board/resolver.py +253 -0
- phase_loop_runtime/advisor_board/schema.py +269 -0
- phase_loop_runtime/advisor_board/standin.py +166 -0
- phase_loop_runtime/advisor_board/validation.py +159 -0
- phase_loop_runtime/agent_runtime_provider.py +676 -0
- phase_loop_runtime/baml_modular.py +656 -0
- phase_loop_runtime/baml_src/dotfiles_adoption_manifest.baml +37 -0
- phase_loop_runtime/baml_src/dotfiles_c4_document.baml +14 -0
- phase_loop_runtime/baml_src/dotfiles_plan_manifest.baml +50 -0
- phase_loop_runtime/baml_src/dotfiles_runtime_projection.baml +16 -0
- phase_loop_runtime/baml_src/dotfiles_task_catalog.baml +20 -0
- phase_loop_runtime/baml_src/emit_phase_closeout.baml +86 -0
- phase_loop_runtime/baml_src/evaluate_suspected_fake_evidence.baml +36 -0
- phase_loop_runtime/baml_src/verification_evidence.baml +40 -0
- phase_loop_runtime/broker.py +181 -0
- phase_loop_runtime/build_bundle.py +294 -0
- phase_loop_runtime/capability_registry.py +835 -0
- phase_loop_runtime/classifier.py +87 -0
- phase_loop_runtime/claude_agent_view.py +625 -0
- phase_loop_runtime/claude_channel_sidecar.py +1086 -0
- phase_loop_runtime/cli.py +2599 -0
- phase_loop_runtime/closeout.py +865 -0
- phase_loop_runtime/closeout_classifier.py +120 -0
- phase_loop_runtime/closeout_evidence_audit.py +112 -0
- phase_loop_runtime/closeout_validation.py +144 -0
- phase_loop_runtime/closeout_validators.py +203 -0
- phase_loop_runtime/consiliency_gates.py +374 -0
- phase_loop_runtime/consiliency_ingest.py +399 -0
- phase_loop_runtime/consiliency_layout.py +176 -0
- phase_loop_runtime/consiliency_scaffold.py +305 -0
- phase_loop_runtime/cross_repo_channel.py +331 -0
- phase_loop_runtime/discovery.py +2368 -0
- phase_loop_runtime/dispatch_lock.py +167 -0
- phase_loop_runtime/doc_delta_validator.py +98 -0
- phase_loop_runtime/docs_audit.py +285 -0
- phase_loop_runtime/docs_freshness.py +468 -0
- phase_loop_runtime/docs_surfaces.py +150 -0
- phase_loop_runtime/dotfiles_profile_plugin.py +96 -0
- phase_loop_runtime/events.py +154 -0
- phase_loop_runtime/events_migration.py +96 -0
- phase_loop_runtime/evidence_audit.py +1082 -0
- phase_loop_runtime/evidence_audit_config.py +172 -0
- phase_loop_runtime/fleet_map.py +426 -0
- phase_loop_runtime/fleet_metrics.py +298 -0
- phase_loop_runtime/fleet_metrics_export.py +196 -0
- phase_loop_runtime/git_discipline.py +479 -0
- phase_loop_runtime/git_ops.py +122 -0
- phase_loop_runtime/git_topology.py +252 -0
- phase_loop_runtime/governed_bundle.py +137 -0
- phase_loop_runtime/governed_premerge.py +219 -0
- phase_loop_runtime/governed_review.py +264 -0
- phase_loop_runtime/handoff.py +932 -0
- phase_loop_runtime/handoff_path.py +14 -0
- phase_loop_runtime/injection.py +740 -0
- phase_loop_runtime/install_status.py +88 -0
- phase_loop_runtime/lane_scheduler.py +317 -0
- phase_loop_runtime/launcher.py +2760 -0
- phase_loop_runtime/lease_store.py +553 -0
- phase_loop_runtime/maintenance.py +401 -0
- phase_loop_runtime/migrate_handoffs.py +201 -0
- phase_loop_runtime/models.py +2144 -0
- phase_loop_runtime/observability.py +1290 -0
- phase_loop_runtime/panel_invoker.py +1638 -0
- phase_loop_runtime/phase_loop_drift_audit.py +388 -0
- phase_loop_runtime/phase_worktree_executor.py +433 -0
- phase_loop_runtime/pipeline_adapter/__init__.py +12 -0
- phase_loop_runtime/pipeline_adapter/branch_ops.py +274 -0
- phase_loop_runtime/pipeline_adapter/flag.py +55 -0
- phase_loop_runtime/pipeline_adapter/markers.py +13 -0
- phase_loop_runtime/pipeline_adapter/merge_policy.py +72 -0
- phase_loop_runtime/pipeline_adapter/ratification.py +100 -0
- phase_loop_runtime/pipeline_adapter/sibling_matcher.py +123 -0
- phase_loop_runtime/plan_ir.py +523 -0
- phase_loop_runtime/plan_manifest.py +415 -0
- phase_loop_runtime/planner_validation.py +176 -0
- phase_loop_runtime/profiles.py +462 -0
- phase_loop_runtime/prompts.py +365 -0
- phase_loop_runtime/provenance.py +165 -0
- phase_loop_runtime/publishing.py +339 -0
- phase_loop_runtime/py.typed +1 -0
- phase_loop_runtime/reconcile.py +1550 -0
- phase_loop_runtime/redaction.py +184 -0
- phase_loop_runtime/reflection_sync.py +293 -0
- phase_loop_runtime/release_guard.py +186 -0
- phase_loop_runtime/render.py +432 -0
- phase_loop_runtime/repo_validation.py +427 -0
- phase_loop_runtime/review_summary.py +150 -0
- phase_loop_runtime/roadmap_lint.py +425 -0
- phase_loop_runtime/route_log.py +59 -0
- phase_loop_runtime/route_policy/__init__.py +11 -0
- phase_loop_runtime/route_policy/fixtures/route_selection.golden.json +263 -0
- phase_loop_runtime/runner.py +8400 -0
- phase_loop_runtime/runtime_paths.py +225 -0
- phase_loop_runtime/runtime_projection.py +113 -0
- phase_loop_runtime/runtime_resources.py +36 -0
- phase_loop_runtime/schema_export.py +292 -0
- phase_loop_runtime/schemas/phase_loop_closeout.schema.json +366 -0
- phase_loop_runtime/skill_install.py +176 -0
- phase_loop_runtime/skill_inventory.py +662 -0
- phase_loop_runtime/skill_paths.py +42 -0
- phase_loop_runtime/skill_sources_plugin.py +37 -0
- phase_loop_runtime/skills_bundle/claude-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/claude-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/claude-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-execute-detailed/SKILL.md +152 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/SKILL.md +745 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/claude-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/claude-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-phase-loop/SKILL.md +115 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/SKILL.md +439 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/claude-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/SKILL.md +334 -0
- phase_loop_runtime/skills_bundle/claude-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/SKILL.md +776 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/claude-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/claude-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/SKILL.md +243 -0
- phase_loop_runtime/skills_bundle/claude-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/SKILL.md +249 -0
- phase_loop_runtime/skills_bundle/claude-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/SKILL.md +74 -0
- phase_loop_runtime/skills_bundle/claude-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/codex-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/codex-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/codex-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-execute-detailed/SKILL.md +154 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/SKILL.md +231 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/codex-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/codex-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-phase-loop/SKILL.md +248 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/SKILL.md +150 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/codex-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/codex-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/SKILL.md +307 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/codex-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/codex-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/SKILL.md +94 -0
- phase_loop_runtime/skills_bundle/codex-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/SKILL.md +114 -0
- phase_loop_runtime/skills_bundle/codex-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/SKILL.md +102 -0
- phase_loop_runtime/skills_bundle/codex-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/gemini-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-execute-detailed/SKILL.md +144 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/SKILL.md +198 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/gemini-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/gemini-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-phase-loop/SKILL.md +111 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/SKILL.md +147 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/gemini-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/gemini-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/SKILL.md +217 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/gemini-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/gemini-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/SKILL.md +87 -0
- phase_loop_runtime/skills_bundle/gemini-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/SKILL.md +109 -0
- phase_loop_runtime/skills_bundle/gemini-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/SKILL.md +98 -0
- phase_loop_runtime/skills_bundle/gemini-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-board/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-board/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-panel/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-advisor-panel/SKILL.md +38 -0
- phase_loop_runtime/skills_bundle/opencode-execute-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-execute-detailed/SKILL.md +144 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/SKILL.md +196 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/allocate_worktree_name.sh +33 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/audit_lane_file_touches.py +197 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/cleanup_lane_worktrees.sh +103 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/parent_tree_leakage_check.sh +125 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/post_merge_import_smoke.sh +62 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/pre_merge_destructiveness_check.sh +127 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/resolve_branch_from_sha.sh +51 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/state.py +274 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/sweep_stale_worktrees.sh +62 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/team_teardown.sh +32 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/validate_plan_doc.py +642 -0
- phase_loop_runtime/skills_bundle/opencode-execute-phase/scripts/verify_harness.sh +96 -0
- phase_loop_runtime/skills_bundle/opencode-phase-loop/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-phase-loop/SKILL.md +113 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/SKILL.md +147 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/assets/review_prompt.md +19 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/references/parallelization-heuristics.md +111 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/references/roadmap-template.md +193 -0
- phase_loop_runtime/skills_bundle/opencode-phase-roadmap-builder/scripts/validate_roadmap.py +32 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/SKILL.md +119 -0
- phase_loop_runtime/skills_bundle/opencode-plan-detailed/assets/review_prompt.md +25 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/SKILL.md +211 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/assets/review_prompt.md +17 -0
- phase_loop_runtime/skills_bundle/opencode-plan-phase/scripts/validate_plan_doc.py +1092 -0
- phase_loop_runtime/skills_bundle/opencode-run-train/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-run-train/SKILL.md +75 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/SKILL.md +87 -0
- phase_loop_runtime/skills_bundle/opencode-skill-editor/assets/editor_prompt.md +72 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/SKILL.md +109 -0
- phase_loop_runtime/skills_bundle/opencode-skill-improvement-planner/assets/aggregator_prompt.md +79 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/README.md +1 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/SKILL.md +98 -0
- phase_loop_runtime/skills_bundle/opencode-task-contextualizer/references/task-templates.md +103 -0
- phase_loop_runtime/state.py +156 -0
- phase_loop_runtime/state_degradation.py +136 -0
- phase_loop_runtime/state_ops.py +676 -0
- phase_loop_runtime/train_ledger.py +215 -0
- phase_loop_runtime/train_roadmap.py +339 -0
- phase_loop_runtime/train_runner.py +1197 -0
- phase_loop_runtime/verification_evidence.py +650 -0
- phase_loop_runtime/verification_evidence_validator.py +75 -0
- phase_loop_runtime/visual_evidence_validator.py +36 -0
- phase_loop_runtime/worker_pool.py +123 -0
- phase_loop_runtime/worktree_index.py +270 -0
- phase_loop_runtime-0.2.0.data/data/share/phase-loop-runtime/protocol/protocol.md +2475 -0
- phase_loop_runtime-0.2.0.dist-info/METADATA +106 -0
- phase_loop_runtime-0.2.0.dist-info/RECORD +370 -0
- phase_loop_runtime-0.2.0.dist-info/WHEEL +5 -0
- phase_loop_runtime-0.2.0.dist-info/entry_points.txt +9 -0
- phase_loop_runtime-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# resolve_branch_from_sha.sh — map a commit SHA to exactly one local branch.
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# resolve_branch_from_sha.sh <commit-sha>
|
|
6
|
+
#
|
|
7
|
+
# Behavior:
|
|
8
|
+
# - Lists local branches containing the SHA via `git branch --contains`.
|
|
9
|
+
# - Exit 0 with the branch name on stdout if exactly one local branch matches.
|
|
10
|
+
# - Exit 1 with a message on stderr if zero or multiple branches match.
|
|
11
|
+
#
|
|
12
|
+
# Rationale (from the claude-execute-phase SKILL):
|
|
13
|
+
# "Never trust a branch name; resolve by commit SHA from the teammate's
|
|
14
|
+
# reply envelope." This script enforces that rule mechanically so the
|
|
15
|
+
# LLM doesn't have to re-derive branch-discovery logic per phase.
|
|
16
|
+
|
|
17
|
+
set -euo pipefail
|
|
18
|
+
|
|
19
|
+
if [[ $# -ne 1 ]]; then
|
|
20
|
+
echo "usage: resolve_branch_from_sha.sh <commit-sha>" >&2
|
|
21
|
+
exit 2
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
sha="$1"
|
|
25
|
+
|
|
26
|
+
# Validate the SHA exists first; otherwise `git branch --contains` prints
|
|
27
|
+
# a misleading error.
|
|
28
|
+
if ! git cat-file -e "${sha}^{commit}" 2>/dev/null; then
|
|
29
|
+
echo "resolve_branch_from_sha: commit not found: $sha" >&2
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# `--contains` yields lines like " main" or "* feature/x"; strip the marker.
|
|
34
|
+
mapfile -t candidates < <(
|
|
35
|
+
git branch --contains "$sha" --format '%(refname:short)' 2>/dev/null | sort -u
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
case "${#candidates[@]}" in
|
|
39
|
+
0)
|
|
40
|
+
echo "resolve_branch_from_sha: no local branch contains $sha" >&2
|
|
41
|
+
exit 1
|
|
42
|
+
;;
|
|
43
|
+
1)
|
|
44
|
+
echo "${candidates[0]}"
|
|
45
|
+
exit 0
|
|
46
|
+
;;
|
|
47
|
+
*)
|
|
48
|
+
echo "resolve_branch_from_sha: multiple local branches contain $sha: ${candidates[*]}" >&2
|
|
49
|
+
exit 1
|
|
50
|
+
;;
|
|
51
|
+
esac
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
state.py — JSON CRUD for claude-execute-phase's state file.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
state.py read
|
|
7
|
+
state.py init <phase-id> <merge-target>
|
|
8
|
+
state.py set-lane <lane-id> <field>=<value> [<field>=<value> ...]
|
|
9
|
+
state.py transition <lane-id> <from-status> <to-status>
|
|
10
|
+
state.py set-gate <gate-id> <status>
|
|
11
|
+
state.py delete
|
|
12
|
+
|
|
13
|
+
State file path (env-overridable, default is $PWD/.claude/claude-execute-phase-state.json):
|
|
14
|
+
STATE_FILE=/path/to/file state.py read
|
|
15
|
+
|
|
16
|
+
Schema:
|
|
17
|
+
{
|
|
18
|
+
"phase_id": "PHASE-1-repo-identity-default-branch-pinning",
|
|
19
|
+
"merge_target": "main",
|
|
20
|
+
"started_at": "2026-04-18T00:00:00Z",
|
|
21
|
+
"updated_at": "2026-04-18T00:15:00Z",
|
|
22
|
+
"status": "running", # running | complete | halted
|
|
23
|
+
"lanes": {
|
|
24
|
+
"SL-1": {
|
|
25
|
+
"status": "pending", # pending | running | verify-ok | merged | failed
|
|
26
|
+
"commit_sha": null,
|
|
27
|
+
"branch": null,
|
|
28
|
+
"worktree_path": null,
|
|
29
|
+
"retries": 0,
|
|
30
|
+
"notes": []
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"gates": {
|
|
34
|
+
"IF-0-P1-1": { "status": "open" } # open | closed
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Design notes:
|
|
39
|
+
- `transition` is atomic — it fails if the current status doesn't match <from>.
|
|
40
|
+
This is the state-machine contract the orchestrator relies on to avoid
|
|
41
|
+
double-running a lane through a wave.
|
|
42
|
+
- `set-lane` is a permissive write; use it to add commit_sha / branch /
|
|
43
|
+
worktree_path after dispatch-and-return; do NOT use it for status changes
|
|
44
|
+
(use `transition` for those).
|
|
45
|
+
- All mutations update `updated_at`. `started_at` is set once by `init`.
|
|
46
|
+
- The file is written atomically (tmp + rename) so concurrent readers never
|
|
47
|
+
see a truncated file.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
from __future__ import annotations
|
|
51
|
+
|
|
52
|
+
import datetime as _dt
|
|
53
|
+
import json
|
|
54
|
+
import os
|
|
55
|
+
import sys
|
|
56
|
+
from pathlib import Path
|
|
57
|
+
from typing import Any, Dict, List, Optional
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
DEFAULT_STATE_PATH = ".claude/claude-execute-phase-state.json"
|
|
61
|
+
LANE_STATUSES = {"pending", "running", "verify-ok", "merged", "failed"}
|
|
62
|
+
GATE_STATUSES = {"open", "closed"}
|
|
63
|
+
PHASE_STATUSES = {"running", "complete", "halted"}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _state_path() -> Path:
|
|
67
|
+
return Path(os.environ.get("STATE_FILE", DEFAULT_STATE_PATH))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _utc_now() -> str:
|
|
71
|
+
return _dt.datetime.now(_dt.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _load() -> Dict[str, Any]:
|
|
75
|
+
p = _state_path()
|
|
76
|
+
if not p.exists():
|
|
77
|
+
_fail(f"state file not found: {p}")
|
|
78
|
+
try:
|
|
79
|
+
return json.loads(p.read_text(encoding="utf-8"))
|
|
80
|
+
except Exception as exc:
|
|
81
|
+
_fail(f"state file unreadable: {exc}")
|
|
82
|
+
return {} # unreachable
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _save(state: Dict[str, Any]) -> None:
|
|
86
|
+
state["updated_at"] = _utc_now()
|
|
87
|
+
p = _state_path()
|
|
88
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
89
|
+
tmp = p.with_suffix(p.suffix + ".tmp")
|
|
90
|
+
tmp.write_text(json.dumps(state, indent=2, sort_keys=False) + "\n", encoding="utf-8")
|
|
91
|
+
tmp.replace(p)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _fail(msg: str, exit_code: int = 2) -> None:
|
|
95
|
+
print(f"state.py: {msg}", file=sys.stderr)
|
|
96
|
+
sys.exit(exit_code)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _coerce_value(raw: str) -> Any:
|
|
100
|
+
"""Convert CLI string -> JSON value. Supports bare null/true/false/integer/float;
|
|
101
|
+
otherwise treats as string."""
|
|
102
|
+
if raw == "null":
|
|
103
|
+
return None
|
|
104
|
+
if raw == "true":
|
|
105
|
+
return True
|
|
106
|
+
if raw == "false":
|
|
107
|
+
return False
|
|
108
|
+
try:
|
|
109
|
+
return int(raw)
|
|
110
|
+
except ValueError:
|
|
111
|
+
pass
|
|
112
|
+
try:
|
|
113
|
+
return float(raw)
|
|
114
|
+
except ValueError:
|
|
115
|
+
pass
|
|
116
|
+
return raw
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# ---------------------------------------------------------------------------
|
|
120
|
+
# Subcommand handlers
|
|
121
|
+
|
|
122
|
+
def cmd_init(phase_id: str, merge_target: str) -> int:
|
|
123
|
+
if _state_path().exists():
|
|
124
|
+
_fail(f"state file already exists at {_state_path()} — use `delete` first or `transition`")
|
|
125
|
+
state = {
|
|
126
|
+
"phase_id": phase_id,
|
|
127
|
+
"merge_target": merge_target,
|
|
128
|
+
"started_at": _utc_now(),
|
|
129
|
+
"updated_at": _utc_now(),
|
|
130
|
+
"status": "running",
|
|
131
|
+
"lanes": {},
|
|
132
|
+
"gates": {},
|
|
133
|
+
}
|
|
134
|
+
_save(state)
|
|
135
|
+
print(f"state.py: initialized {_state_path()} for {phase_id}")
|
|
136
|
+
return 0
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def cmd_read() -> int:
|
|
140
|
+
state = _load()
|
|
141
|
+
print(json.dumps(state, indent=2, sort_keys=False))
|
|
142
|
+
return 0
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def cmd_set_lane(lane_id: str, assignments: List[str]) -> int:
|
|
146
|
+
state = _load()
|
|
147
|
+
lane = state["lanes"].setdefault(
|
|
148
|
+
lane_id,
|
|
149
|
+
{
|
|
150
|
+
"status": "pending",
|
|
151
|
+
"commit_sha": None,
|
|
152
|
+
"branch": None,
|
|
153
|
+
"worktree_path": None,
|
|
154
|
+
"retries": 0,
|
|
155
|
+
"notes": [],
|
|
156
|
+
},
|
|
157
|
+
)
|
|
158
|
+
for assignment in assignments:
|
|
159
|
+
if "=" not in assignment:
|
|
160
|
+
_fail(f"expected `<field>=<value>`, got {assignment!r}")
|
|
161
|
+
key, _, raw = assignment.partition("=")
|
|
162
|
+
key = key.strip()
|
|
163
|
+
value: Any = _coerce_value(raw.strip())
|
|
164
|
+
if key == "status":
|
|
165
|
+
_fail("use `transition` to change status, not `set-lane`")
|
|
166
|
+
if key == "notes" and isinstance(value, str):
|
|
167
|
+
# Append to notes list instead of replacing.
|
|
168
|
+
lane.setdefault("notes", []).append(value)
|
|
169
|
+
else:
|
|
170
|
+
lane[key] = value
|
|
171
|
+
_save(state)
|
|
172
|
+
return 0
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def cmd_transition(lane_id: str, frm: str, to: str) -> int:
|
|
176
|
+
if frm not in LANE_STATUSES:
|
|
177
|
+
_fail(f"from-status {frm!r} not in {sorted(LANE_STATUSES)}")
|
|
178
|
+
if to not in LANE_STATUSES:
|
|
179
|
+
_fail(f"to-status {to!r} not in {sorted(LANE_STATUSES)}")
|
|
180
|
+
state = _load()
|
|
181
|
+
lane = state["lanes"].get(lane_id)
|
|
182
|
+
if lane is None:
|
|
183
|
+
# Creating on first transition is fine if `from` is "pending".
|
|
184
|
+
if frm != "pending":
|
|
185
|
+
_fail(f"lane {lane_id!r} not found and from-status is not `pending`")
|
|
186
|
+
lane = {
|
|
187
|
+
"status": "pending",
|
|
188
|
+
"commit_sha": None,
|
|
189
|
+
"branch": None,
|
|
190
|
+
"worktree_path": None,
|
|
191
|
+
"retries": 0,
|
|
192
|
+
"notes": [],
|
|
193
|
+
}
|
|
194
|
+
state["lanes"][lane_id] = lane
|
|
195
|
+
if lane["status"] != frm:
|
|
196
|
+
_fail(
|
|
197
|
+
f"{lane_id} is in status {lane['status']!r}, not {frm!r}; "
|
|
198
|
+
f"refusing transition to {to!r}",
|
|
199
|
+
exit_code=1,
|
|
200
|
+
)
|
|
201
|
+
lane["status"] = to
|
|
202
|
+
_save(state)
|
|
203
|
+
return 0
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def cmd_set_gate(gate_id: str, status: str) -> int:
|
|
207
|
+
if status not in GATE_STATUSES:
|
|
208
|
+
_fail(f"gate status {status!r} not in {sorted(GATE_STATUSES)}")
|
|
209
|
+
state = _load()
|
|
210
|
+
state["gates"][gate_id] = {"status": status}
|
|
211
|
+
_save(state)
|
|
212
|
+
return 0
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def cmd_set_phase(status: str) -> int:
|
|
216
|
+
if status not in PHASE_STATUSES:
|
|
217
|
+
_fail(f"phase status {status!r} not in {sorted(PHASE_STATUSES)}")
|
|
218
|
+
state = _load()
|
|
219
|
+
state["status"] = status
|
|
220
|
+
_save(state)
|
|
221
|
+
return 0
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def cmd_delete() -> int:
|
|
225
|
+
p = _state_path()
|
|
226
|
+
if not p.exists():
|
|
227
|
+
return 0 # idempotent
|
|
228
|
+
p.unlink()
|
|
229
|
+
print(f"state.py: deleted {p}")
|
|
230
|
+
return 0
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
# ---------------------------------------------------------------------------
|
|
234
|
+
|
|
235
|
+
def main(argv: List[str]) -> int:
|
|
236
|
+
if len(argv) < 2:
|
|
237
|
+
_fail("usage: state.py <read|init|set-lane|transition|set-gate|set-phase|delete> [args]")
|
|
238
|
+
cmd = argv[1]
|
|
239
|
+
rest = argv[2:]
|
|
240
|
+
try:
|
|
241
|
+
if cmd == "read":
|
|
242
|
+
return cmd_read()
|
|
243
|
+
if cmd == "init":
|
|
244
|
+
if len(rest) != 2:
|
|
245
|
+
_fail("usage: state.py init <phase-id> <merge-target>")
|
|
246
|
+
return cmd_init(rest[0], rest[1])
|
|
247
|
+
if cmd == "set-lane":
|
|
248
|
+
if len(rest) < 2:
|
|
249
|
+
_fail("usage: state.py set-lane <lane-id> <field>=<value> [<field>=<value> ...]")
|
|
250
|
+
return cmd_set_lane(rest[0], rest[1:])
|
|
251
|
+
if cmd == "transition":
|
|
252
|
+
if len(rest) != 3:
|
|
253
|
+
_fail("usage: state.py transition <lane-id> <from-status> <to-status>")
|
|
254
|
+
return cmd_transition(rest[0], rest[1], rest[2])
|
|
255
|
+
if cmd == "set-gate":
|
|
256
|
+
if len(rest) != 2:
|
|
257
|
+
_fail("usage: state.py set-gate <gate-id> <open|closed>")
|
|
258
|
+
return cmd_set_gate(rest[0], rest[1])
|
|
259
|
+
if cmd == "set-phase":
|
|
260
|
+
if len(rest) != 1:
|
|
261
|
+
_fail("usage: state.py set-phase <running|complete|halted>")
|
|
262
|
+
return cmd_set_phase(rest[0])
|
|
263
|
+
if cmd == "delete":
|
|
264
|
+
return cmd_delete()
|
|
265
|
+
_fail(f"unknown subcommand: {cmd!r}")
|
|
266
|
+
except SystemExit:
|
|
267
|
+
raise
|
|
268
|
+
except Exception as exc:
|
|
269
|
+
_fail(f"unexpected error: {exc!r}")
|
|
270
|
+
return 2
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
if __name__ == "__main__":
|
|
274
|
+
sys.exit(main(sys.argv))
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# sweep_stale_worktrees.sh — prune stale claude-execute-phase worktrees from prior sessions.
|
|
3
|
+
#
|
|
4
|
+
# For each worktree (excluding the orchestrator's own checkout), checks whether its
|
|
5
|
+
# HEAD commit has been incorporated into the current merge target (HEAD). Worktrees
|
|
6
|
+
# whose work is already on the target are removed; worktrees with unmerged work are
|
|
7
|
+
# kept and reported.
|
|
8
|
+
#
|
|
9
|
+
# Usage:
|
|
10
|
+
# sweep_stale_worktrees.sh [--dry-run]
|
|
11
|
+
#
|
|
12
|
+
# --dry-run Print PRUNE/KEEP decisions without removing anything.
|
|
13
|
+
#
|
|
14
|
+
# Exit code: 0 on success (even if nothing was pruned); non-zero on git errors.
|
|
15
|
+
|
|
16
|
+
set -euo pipefail
|
|
17
|
+
|
|
18
|
+
DRY_RUN=0
|
|
19
|
+
for arg in "$@"; do
|
|
20
|
+
[[ "$arg" == "--dry-run" ]] && DRY_RUN=1
|
|
21
|
+
done
|
|
22
|
+
|
|
23
|
+
TOPLEVEL=$(git rev-parse --show-toplevel)
|
|
24
|
+
PRUNED=0
|
|
25
|
+
KEPT=0
|
|
26
|
+
|
|
27
|
+
# Collect worktree paths (skip the main checkout)
|
|
28
|
+
while IFS= read -r wt; do
|
|
29
|
+
[[ "$wt" == "$TOPLEVEL" ]] && continue
|
|
30
|
+
|
|
31
|
+
wt_sha=$(git -C "$wt" rev-parse HEAD 2>/dev/null) || {
|
|
32
|
+
echo "WARN: $wt — could not read HEAD, skipping" >&2
|
|
33
|
+
continue
|
|
34
|
+
}
|
|
35
|
+
wt_branch=$(git -C "$wt" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "<detached>")
|
|
36
|
+
|
|
37
|
+
if git merge-base --is-ancestor "$wt_sha" HEAD 2>/dev/null; then
|
|
38
|
+
echo "PRUNE: $wt ($wt_sha, branch $wt_branch) — work incorporated into merge target"
|
|
39
|
+
|
|
40
|
+
if [[ "$DRY_RUN" -eq 0 ]]; then
|
|
41
|
+
git worktree unlock "$wt" 2>/dev/null || true
|
|
42
|
+
git worktree remove -f -f "$wt"
|
|
43
|
+
|
|
44
|
+
# Delete the branch only when it matches an auto-named pattern; leave
|
|
45
|
+
# human-named branches (feature/*, fix/*, skills/*, etc.) intact.
|
|
46
|
+
if [[ "$wt_branch" =~ ^(worktree-agent-|phase/.*/sl-) ]]; then
|
|
47
|
+
git branch -D "$wt_branch" 2>/dev/null || true
|
|
48
|
+
fi
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
PRUNED=$(( PRUNED + 1 ))
|
|
52
|
+
else
|
|
53
|
+
echo "KEEP: $wt ($wt_sha, branch $wt_branch) — unmerged work"
|
|
54
|
+
KEPT=$(( KEPT + 1 ))
|
|
55
|
+
fi
|
|
56
|
+
done < <(git worktree list --porcelain | awk '/^worktree / {print $2}')
|
|
57
|
+
|
|
58
|
+
if [[ "$DRY_RUN" -eq 1 ]]; then
|
|
59
|
+
echo "Dry-run complete: $PRUNED would be pruned, $KEPT would be kept."
|
|
60
|
+
else
|
|
61
|
+
echo "Sweep complete: $PRUNED pruned, $KEPT kept."
|
|
62
|
+
fi
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# team_teardown.sh — filesystem fallback for TeamDelete.
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# team_teardown.sh <team-name>
|
|
6
|
+
#
|
|
7
|
+
# Behavior:
|
|
8
|
+
# - Removes ~/.claude/teams/<team-name>/ and ~/.claude/tasks/<team-name>/.
|
|
9
|
+
# - Idempotent (no-op if dirs don't exist).
|
|
10
|
+
# - Never fails (exit 0 always).
|
|
11
|
+
#
|
|
12
|
+
# Rationale: in-process teammates ignore `shutdown_request`, so `TeamDelete`
|
|
13
|
+
# blocks on active members. After the phase has verified green, removing
|
|
14
|
+
# the team directory and its task directory on the filesystem is the
|
|
15
|
+
# accepted tear-down path. The orchestrator should call TeamDelete first;
|
|
16
|
+
# fall back to this script when TeamDelete fails on active members.
|
|
17
|
+
|
|
18
|
+
set -uo pipefail
|
|
19
|
+
|
|
20
|
+
if [[ $# -ne 1 ]]; then
|
|
21
|
+
echo "usage: team_teardown.sh <team-name>" >&2
|
|
22
|
+
exit 2
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
team="$1"
|
|
26
|
+
team_dir="$HOME/.claude/teams/$team"
|
|
27
|
+
task_dir="$HOME/.claude/tasks/$team"
|
|
28
|
+
|
|
29
|
+
rm -rf "$team_dir" "$task_dir"
|
|
30
|
+
|
|
31
|
+
echo "team_teardown: removed (or already absent): $team_dir $task_dir"
|
|
32
|
+
exit 0
|