@aibyzero/cm-workflow 0.17.0 → 0.18.0
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/.codex-plugin/plugin.json +1 -1
- package/AGENTS.md +27 -0
- package/CHANGELOG.md +230 -1
- package/CONTRIBUTING.md +47 -0
- package/README.md +21 -3
- package/THIRD_PARTY_NOTICES.md +13 -0
- package/VERSION +1 -1
- package/compat/claude-commands/cm-challenge.md +3 -0
- package/docs/architecture.md +40 -13
- package/docs/cm-control-policy-v2.md +127 -9
- package/docs/fixes/20261013-claude-preinit-ui-invalidate.md +48 -0
- package/docs/installation.md +310 -4
- package/docs/js-workflow-control.md +153 -16
- package/docs/live-evidence-drivers.md +28 -4
- package/docs/out-of-scope/README.md +25 -0
- package/docs/out-of-scope/background-supervisor.md +32 -0
- package/docs/reviewed-integration.md +48 -0
- package/docs/user-guide.md +50 -21
- package/install-codex.sh +331 -18
- package/install.ps1 +28 -2
- package/install.sh +321 -17
- package/package.json +2 -1
- package/runtime/js/cm-ai/batch-location.mjs +55 -0
- package/runtime/js/cm-ai/batch-plan.mjs +242 -0
- package/runtime/js/cm-ai/checkpoint-package-material.mjs +162 -0
- package/runtime/js/cm-ai/claude-developer-proposal.schema.json +55 -1
- package/runtime/js/cm-ai/claude-review-stream.mjs +94 -21
- package/runtime/js/cm-ai/claude-tool-preview.mjs +11 -9
- package/runtime/js/cm-ai/cm-ai-admission.mjs +18 -12
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +91 -6
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +5 -1
- package/runtime/js/cm-ai/codex-config.mjs +6 -2
- package/runtime/js/cm-ai/codex-developer-basic-output.schema.json +3 -2
- package/runtime/js/cm-ai/codex-developer-output.schema.json +2 -1
- package/runtime/js/cm-ai/codex-reconnect-notice.mjs +6 -0
- package/runtime/js/cm-ai/codex-review-adapter.mjs +27 -7
- package/runtime/js/cm-ai/control-policy.mjs +24 -6
- package/runtime/js/cm-ai/developer-adapter.mjs +19 -5
- package/runtime/js/cm-ai/drive-core.mjs +236 -34
- package/runtime/js/cm-ai/drive-rate-limit.mjs +105 -0
- package/runtime/js/cm-ai/durable-runner-state.mjs +234 -33
- package/runtime/js/cm-ai/effect-contract.mjs +11 -2
- package/runtime/js/cm-ai/execution-policy.mjs +3 -1
- package/runtime/js/cm-ai/execution-snapshot.mjs +4 -2
- package/runtime/js/cm-ai/execution-store-limits.mjs +14 -7
- package/runtime/js/cm-ai/execution-store.mjs +60 -17
- package/runtime/js/cm-ai/fix-code-association.mjs +73 -2
- package/runtime/js/cm-ai/host-check.mjs +14 -6
- package/runtime/js/cm-ai/host-conversation-execution.mjs +70 -28
- package/runtime/js/cm-ai/host-qa-executor.mjs +38 -5
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +2 -2
- package/runtime/js/cm-ai/host-qa-policy.mjs +19 -2
- package/runtime/js/cm-ai/host-replay.mjs +148 -0
- package/runtime/js/cm-ai/host-session.mjs +42 -9
- package/runtime/js/cm-ai/host-stage-observer.mjs +26 -0
- package/runtime/js/cm-ai/host-tool-bridge.mjs +22 -9
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +19 -2
- package/runtime/js/cm-ai/host.mjs +1 -1
- package/runtime/js/cm-ai/implicit-qa-decision.mjs +5 -0
- package/runtime/js/cm-ai/integration-snapshots.mjs +50 -0
- package/runtime/js/cm-ai/live-evidence.mjs +28 -6
- package/runtime/js/cm-ai/operator-guidance.mjs +63 -30
- package/runtime/js/cm-ai/owned-process-cleanup.mjs +27 -9
- package/runtime/js/cm-ai/process-group-exit.mjs +46 -0
- package/runtime/js/cm-ai/provider-review-observation.mjs +3 -2
- package/runtime/js/cm-ai/qa-attachment.mjs +22 -0
- package/runtime/js/cm-ai/qa-config-revision.mjs +7 -2
- package/runtime/js/cm-ai/requirement-evidence.mjs +102 -0
- package/runtime/js/cm-ai/review-package.mjs +79 -7
- package/runtime/js/cm-ai/review-presentation-delta.mjs +166 -0
- package/runtime/js/cm-ai/review-presentation.mjs +177 -8
- package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +70 -2
- package/runtime/js/cm-ai/reviewed-integration.mjs +260 -0
- package/runtime/js/cm-ai/scope-revision.mjs +38 -0
- package/runtime/js/cm-ai/specification-material.mjs +2 -2
- package/runtime/js/cm-ai/task-runner.mjs +247 -41
- package/runtime/js/cm-ai/verification-auto.mjs +38 -0
- package/runtime/js/cm-ai/worker-claude-developer.mjs +39 -15
- package/runtime/js/cm-ai/worker-claude.mjs +35 -13
- package/runtime/js/cm-ai/worker-codex-developer.mjs +43 -17
- package/runtime/js/cm-ai/worker-codex.mjs +41 -7
- package/runtime/js/cm-fix/cause-invocation.mjs +16 -2
- package/runtime/js/cm-fix/cause-package.mjs +46 -1
- package/runtime/js/cm-fix/command-correction.mjs +37 -0
- package/runtime/js/cm-fix/cooperative.mjs +12 -0
- package/runtime/js/cm-fix/dossier.mjs +8 -2
- package/runtime/js/cm-fix/execution.mjs +578 -100
- package/runtime/js/cm-fix/final-review.mjs +39 -8
- package/runtime/js/cm-fix/finish.mjs +15 -11
- package/runtime/js/cm-fix/host-review.mjs +65 -10
- package/runtime/js/cm-fix/host.mjs +35 -12
- package/runtime/js/cm-fix/jest-command-correction.mjs +69 -0
- package/runtime/js/cm-fix/metrics.mjs +18 -5
- package/runtime/js/cm-fix/regression-evidence.mjs +3 -2
- package/runtime/js/cm-fix/regression.mjs +16 -7
- package/runtime/js/cm-fix/repair.mjs +29 -8
- package/runtime/js/cm-fix/review-verification-command.mjs +135 -0
- package/runtime/js/cm-fix/review-verification-contract.mjs +54 -0
- package/runtime/js/cm-fix/review-verification-diagnostic.mjs +75 -0
- package/runtime/js/cm-fix/review-verification-recovery.mjs +44 -0
- package/runtime/js/cm-fix/review-verification-server.mjs +38 -0
- package/runtime/js/cm-fix/review-verification.mjs +214 -0
- package/runtime/js/cm-fix/source-correction-recovery.mjs +65 -0
- package/runtime/js/cm-fix/start.mjs +6 -3
- package/runtime/js/cm-fix/test-type-correction.mjs +86 -0
- package/runtime/js/cm-fix/test-type-recovery.mjs +51 -0
- package/runtime/js/cm-fix/type-import-correction.mjs +89 -0
- package/runtime/js/cm-prd/accepted-design.mjs +8 -0
- package/runtime/js/cm-prd/analysis.mjs +13 -9
- package/runtime/js/cm-prd/change.mjs +37 -16
- package/runtime/js/cm-prd/draft-save.mjs +13 -6
- package/runtime/js/cm-prd/draft.mjs +31 -3
- package/runtime/js/cm-prd/failed-correction.mjs +19 -3
- package/runtime/js/cm-prd/inputs-replaced.mjs +3 -0
- package/runtime/js/cm-prd/review-correction.mjs +6 -4
- package/runtime/js/cm-prd/review-disposition.mjs +7 -1
- package/runtime/js/cm-prd/self-check-revision.mjs +2 -2
- package/runtime/js/cm-prd/self-check.mjs +125 -6
- package/runtime/js/cm-prd/session.mjs +30 -1
- package/runtime/js/cm-prd/summary.mjs +38 -17
- package/runtime/js/cm-prd/task-scope-record.mjs +97 -0
- package/runtime/js/cm-prd/tree-digest.mjs +34 -0
- package/runtime/js/cm-prd/validation-reason.mjs +8 -4
- package/runtime/js/cm-security/scan.mjs +1 -1
- package/runtime/js/commander/decision.mjs +44 -0
- package/runtime/js/commander/dispatch-registry.mjs +110 -0
- package/runtime/js/commander/ledger.mjs +265 -0
- package/runtime/js/commander/preflight.mjs +107 -0
- package/runtime/js/notify-later.mjs +13 -0
- package/runtime/js/notify-send.mjs +6 -2
- package/runtime/js/notify.mjs +570 -63
- package/runtime/js/review-findings.mjs +38 -0
- package/runtime/js/session-boundary.mjs +56 -0
- package/runtime/js/session-handoff.mjs +68 -0
- package/runtime/js/spec-task-line.mjs +27 -13
- package/runtime/js/specs-status.mjs +1 -1
- package/runtime/js/task-scope.mjs +197 -0
- package/runtime/logging.md +6 -1
- package/runtime/model-efficiency.md +69 -10
- package/runtime/orchestration.md +3 -1
- package/runtime/project-learning.md +2 -0
- package/runtime/review.md +12 -2
- package/runtime/test-contract.md +1 -0
- package/scripts/ci-test-weights.json +3 -0
- package/scripts/cm-ai-admission.mjs +11 -5
- package/scripts/cm-ai-admission.test.mjs +23 -2
- package/scripts/cm-ai-batch-drive.mjs +79 -18
- package/scripts/cm-ai-batch-drive.test.mjs +169 -3
- package/scripts/cm-ai-batch-host.mjs +38 -9
- package/scripts/cm-ai-batch-host.test.mjs +27 -14
- package/scripts/cm-ai-batch-learning-merge.test.mjs +36 -0
- package/scripts/cm-ai-batch-location.test.mjs +57 -0
- package/scripts/cm-ai-batch-plan.mjs +52 -0
- package/scripts/cm-ai-batch-plan.test.mjs +397 -0
- package/scripts/cm-ai-batch-run-fixture.mjs +446 -35
- package/scripts/cm-ai-batch-run-member-stops.test.mjs +16 -0
- package/scripts/cm-ai-batch-run-parallel.test.mjs +28 -1
- package/scripts/cm-ai-batch-run.mjs +483 -63
- package/scripts/cm-ai-batch-run.test.mjs +23 -4
- package/scripts/cm-ai-batch-session-e2e.test.mjs +235 -0
- package/scripts/cm-ai-batch-session-member.test.mjs +293 -0
- package/scripts/cm-ai-batch-session-recovery.test.mjs +423 -0
- package/scripts/cm-ai-check-recheck-cancellation.test.mjs +247 -0
- package/scripts/cm-ai-checklist-coverage.test.mjs +4 -2
- package/scripts/cm-ai-checkpoint-package-material.test.mjs +221 -0
- package/scripts/cm-ai-checkpoint-package-owner.test.mjs +193 -0
- package/scripts/cm-ai-control-launch.test.mjs +21 -0
- package/scripts/cm-ai-control-policy.test.mjs +82 -0
- package/scripts/cm-ai-control-v2-drive.test.mjs +398 -3
- package/scripts/cm-ai-control-v2-supersede-race.mjs +25 -0
- package/scripts/cm-ai-control-v2-supersede.test.mjs +318 -0
- package/scripts/cm-ai-develop-driver-gaps.test.mjs +163 -0
- package/scripts/cm-ai-development-rework.test.mjs +423 -0
- package/scripts/cm-ai-drive-bootstrap-rules.test.mjs +3 -2
- package/scripts/cm-ai-drive.mjs +73 -17
- package/scripts/cm-ai-drive.test.mjs +37 -5
- package/scripts/cm-ai-execution-store-legacy-probe.test.mjs +84 -0
- package/scripts/cm-ai-host-fixture.mjs +9 -6
- package/scripts/cm-ai-host-protected.test.mjs +1 -1
- package/scripts/cm-ai-host.mjs +60 -19
- package/scripts/cm-ai-host.test.mjs +15 -0
- package/scripts/cm-ai-integration-adoption.test.mjs +223 -0
- package/scripts/cm-ai-integration-independence.test.mjs +23 -0
- package/scripts/cm-ai-integration-launch.test.mjs +240 -0
- package/scripts/cm-ai-integration-preview.mjs +41 -0
- package/scripts/cm-ai-integration-snapshots.test.mjs +197 -0
- package/scripts/cm-ai-nested-execution.test.mjs +29 -1
- package/scripts/cm-ai-operator-guidance.test.mjs +71 -0
- package/scripts/cm-ai-prefinal-delivery.test.mjs +278 -0
- package/scripts/cm-ai-project-qa-gate.test.mjs +56 -0
- package/scripts/cm-ai-qa-fingerprint-config.test.mjs +28 -0
- package/scripts/cm-ai-qa-rerun-timeouts.test.mjs +36 -2
- package/scripts/cm-ai-requirement-evidence.test.mjs +65 -0
- package/scripts/cm-ai-review-failure.test.mjs +150 -5
- package/scripts/cm-ai-review-timeout.test.mjs +20 -0
- package/scripts/cm-ai-run.mjs +88 -21
- package/scripts/cm-ai-scope-revision.test.mjs +341 -0
- package/scripts/cm-ai-spec-rebind.test.mjs +13 -0
- package/scripts/cm-ai-supersede.test.mjs +28 -0
- package/scripts/cm-ai-verification-auto.test.mjs +99 -0
- package/scripts/cm-announce-hook.mjs +35 -8
- package/scripts/cm-announce-hook.test.mjs +25 -0
- package/scripts/cm-challenge.test.mjs +61 -0
- package/scripts/cm-check-drive-files.mjs +2 -2
- package/scripts/cm-check-host.test.mjs +1 -1
- package/scripts/cm-check-runtime.sh +58 -1
- package/scripts/cm-claude-developer-worker.test.mjs +56 -7
- package/scripts/cm-claude-install-layout.test.mjs +1 -1
- package/scripts/cm-claude-probe.test.mjs +26 -0
- package/scripts/cm-claude-review-diagnostics.test.mjs +235 -0
- package/scripts/cm-claude-review-stream.test.mjs +49 -0
- package/scripts/cm-claude-worker.test.mjs +16 -0
- package/scripts/cm-codex-developer-reconnect-notice.test.mjs +98 -0
- package/scripts/cm-codex-developer-worker.test.mjs +120 -0
- package/scripts/cm-codex-install-local-edit-guard.test.mjs +436 -0
- package/scripts/cm-codex-prompt-input.test.mjs +153 -0
- package/scripts/cm-codex-reconnect-notice.test.mjs +167 -0
- package/scripts/cm-commander-ledger.test.mjs +260 -0
- package/scripts/cm-commander-p2.test.mjs +295 -0
- package/scripts/cm-commander-preflight.mjs +84 -0
- package/scripts/cm-commander.mjs +116 -0
- package/scripts/cm-config-lock.mjs +35 -0
- package/scripts/cm-controlled-correction.test.mjs +10 -1
- package/scripts/cm-developer-failure-code.test.mjs +62 -0
- package/scripts/cm-display-task-id.test.mjs +41 -0
- package/scripts/cm-drive-liveness.test.mjs +83 -0
- package/scripts/cm-efficiency-presentation-delta.test.mjs +218 -0
- package/scripts/cm-execution-snapshot-reuse.test.mjs +115 -0
- package/scripts/cm-external-batch-host.test.mjs +12 -9
- package/scripts/cm-external-process-cleanup.test.mjs +128 -0
- package/scripts/cm-external-qa-fix.test.mjs +89 -7
- package/scripts/cm-external-review-reconciliation.test.mjs +11 -0
- package/scripts/cm-failover.mjs +48 -10
- package/scripts/cm-failover.test.mjs +46 -0
- package/scripts/cm-fix-cause-invocation.test.mjs +19 -4
- package/scripts/cm-fix-command-correction.mjs +17 -0
- package/scripts/cm-fix-command-correction.test.mjs +211 -0
- package/scripts/cm-fix-cooperative-closeout.test.mjs +87 -0
- package/scripts/cm-fix-diagnosis-module-correction.test.mjs +217 -0
- package/scripts/cm-fix-drive.mjs +33 -5
- package/scripts/cm-fix-drive.test.mjs +49 -0
- package/scripts/cm-fix-host-review-assembly.test.mjs +197 -1
- package/scripts/cm-fix-host-review.test.mjs +21 -9
- package/scripts/cm-fix-host.mjs +26 -8
- package/scripts/cm-fix-monorepo-map.test.mjs +92 -0
- package/scripts/cm-fix-observation-task-id.test.mjs +122 -0
- package/scripts/cm-fix-regression-input-budget.test.mjs +111 -0
- package/scripts/cm-fix-repair-input-budget.test.mjs +119 -0
- package/scripts/cm-fix-review-file-paging.test.mjs +91 -0
- package/scripts/cm-fix-review-preflight.mjs +24 -0
- package/scripts/cm-fix-review-storage.test.mjs +233 -0
- package/scripts/cm-fix-review-verification-command.test.mjs +242 -0
- package/scripts/cm-fix-review-verification-evidence.test.mjs +218 -0
- package/scripts/cm-fix-review-verification-integration.test.mjs +81 -0
- package/scripts/cm-fix-review-verification-recovery.test.mjs +198 -0
- package/scripts/cm-fix-review-verification.test.mjs +146 -0
- package/scripts/cm-fix-revision-transport.test.mjs +81 -0
- package/scripts/cm-fix-source-correction.test.mjs +296 -0
- package/scripts/cm-fix-test-type-correction.mjs +18 -0
- package/scripts/cm-fix-test-type-correction.test.mjs +123 -0
- package/scripts/cm-fix-test-type-owner.test.mjs +208 -0
- package/scripts/cm-fix-test-type-verification-cost.test.mjs +66 -0
- package/scripts/cm-fix-type-import-correction.test.mjs +95 -0
- package/scripts/cm-fix-verification-diagnostic.test.mjs +200 -0
- package/scripts/cm-fix-verification-recovery.mjs +33 -0
- package/scripts/cm-host-diagnostic.test.mjs +33 -0
- package/scripts/cm-host-liveness.test.mjs +150 -0
- package/scripts/cm-host-qa-executor.test.mjs +77 -0
- package/scripts/cm-host-replay.test.mjs +176 -0
- package/scripts/cm-host-stage-observer.test.mjs +41 -0
- package/scripts/cm-install-local-edit-guard.test.mjs +621 -0
- package/scripts/cm-install-manifest.sh +351 -0
- package/scripts/cm-live-evidence.test.mjs +59 -1
- package/scripts/cm-log-event.mjs +61 -10
- package/scripts/cm-log-event.test.mjs +121 -1
- package/scripts/cm-matt-skills.mjs +576 -0
- package/scripts/cm-matt-skills.test.mjs +550 -0
- package/scripts/cm-notify-command.test.mjs +42 -10
- package/scripts/cm-notify.mjs +14 -10
- package/scripts/cm-notify.test.mjs +625 -75
- package/scripts/cm-patrol.mjs +4 -1
- package/scripts/cm-patrol.test.mjs +23 -5
- package/scripts/cm-prd-answer-gaps.test.mjs +2 -2
- package/scripts/cm-prd-completion.test.mjs +56 -13
- package/scripts/cm-prd-design-phase.test.mjs +78 -8
- package/scripts/cm-prd-draft-save.test.mjs +12 -0
- package/scripts/cm-prd-draft.test.mjs +1 -1
- package/scripts/cm-prd-drive.mjs +13 -6
- package/scripts/cm-prd-drive.test.mjs +46 -2
- package/scripts/cm-prd-gate-diagnostic.test.mjs +2 -2
- package/scripts/cm-prd-host.mjs +10 -5
- package/scripts/cm-prd-host.test.mjs +4 -2
- package/scripts/cm-prd-inputs-replaced.test.mjs +1 -1
- package/scripts/cm-prd-review-disposition.test.mjs +124 -8
- package/scripts/cm-prd-revision.test.mjs +1 -1
- package/scripts/cm-prd-self-check-revision.test.mjs +16 -1
- package/scripts/cm-prd-self-check-rules.test.mjs +239 -0
- package/scripts/cm-prd-self-check.test.mjs +105 -5
- package/scripts/cm-prd-session-recovery.test.mjs +5 -3
- package/scripts/cm-prd-summary.test.mjs +55 -3
- package/scripts/cm-prd-task-grouping.test.mjs +6 -6
- package/scripts/cm-prd-tree-digest.test.mjs +74 -0
- package/scripts/cm-refactor-drive.mjs +2 -1
- package/scripts/cm-refactor-drive.test.mjs +9 -0
- package/scripts/cm-release-smoke.sh +3 -15
- package/scripts/cm-skill-hints-autowire.test.mjs +394 -0
- package/scripts/cm-skill-hints-exam.mjs +149 -0
- package/scripts/cm-skill-hints-install.test.mjs +168 -0
- package/scripts/cm-skill-hints.exam.json +706 -0
- package/scripts/cm-skill-hints.json +119 -0
- package/scripts/cm-skill-hints.mjs +669 -0
- package/scripts/cm-skill-hints.test.mjs +831 -0
- package/scripts/cm-skill-judge.mjs +181 -0
- package/scripts/cm-skill-judge.test.mjs +255 -0
- package/scripts/cm-specs-status.test.mjs +4 -2
- package/scripts/cm-start-check.mjs +208 -0
- package/scripts/cm-start-check.test.mjs +321 -0
- package/scripts/cm-task-gate.mjs +150 -29
- package/scripts/cm-task-gate.test.mjs +73 -1
- package/scripts/cm-task-id-grammar.test.mjs +66 -0
- package/scripts/cm-task-scope.test.mjs +308 -0
- package/scripts/cm-test-suite.mjs +109 -0
- package/scripts/cm-test-suite.test.mjs +162 -0
- package/scripts/cm-upgrade-compat-batch.test.mjs +172 -0
- package/scripts/cm-upgrade-compat.test.mjs +239 -0
- package/scripts/cm-workflow-config.mjs +12 -2
- package/scripts/fixtures/fix-verification-claude.mjs +44 -0
- package/scripts/fixtures/host-diagnostic.mjs +33 -0
- package/scripts/fixtures/reviewed-integration.mjs +202 -0
- package/scripts/scan-public-safety.py +1 -0
- package/scripts/session-boundary.test.mjs +170 -0
- package/scripts/test-npm-install.py +14 -3
- package/scripts/test-shell-compat.sh +2 -0
- package/scripts/validate-public-repo.py +1 -0
- package/scripts/validate-test-cases.mjs +3 -2
- package/skills/cm-ai/SKILL.md +5 -2
- package/skills/cm-ai/references/N4-review.md +2 -1
- package/skills/cm-ai/references/N6-qa-eval.md +3 -1
- package/skills/cm-ai/references/N8-finish.md +22 -0
- package/skills/cm-ai/references/js-host-qa-recovery.md +1 -1
- package/skills/cm-ai/references/js-host-recovery.md +79 -3
- package/skills/cm-ai/references/js-host.md +89 -17
- package/skills/cm-challenge/SKILL.md +65 -0
- package/skills/cm-challenge/evals/README.md +18 -0
- package/skills/cm-challenge/evals/trigger-cases.json +20 -0
- package/skills/cm-challenge/evals/trigger-config.json +28 -0
- package/skills/cm-challenge/references/examples.md +15 -0
- package/skills/cm-check/SKILL.md +5 -0
- package/skills/cm-check/references/js-host.md +2 -0
- package/skills/cm-fix/SKILL.md +12 -3
- package/skills/cm-fix/references/command-correction.md +67 -0
- package/skills/cm-fix/references/isolated-review.md +54 -0
- package/skills/cm-fix/references/js-host.md +62 -2
- package/skills/cm-fix/references/test-type-correction.md +72 -0
- package/skills/cm-fix/references/verification-recovery.md +114 -0
- package/skills/cm-idea/SKILL.md +2 -0
- package/skills/cm-idea/references/js-host.md +2 -0
- package/skills/cm-notify/SKILL.md +2 -0
- package/skills/cm-prd/SKILL.md +12 -8
- package/skills/cm-prd/references/brownfield.md +8 -1
- package/skills/cm-prd/references/change-mode.md +6 -0
- package/skills/cm-prd/references/greenfield.md +4 -0
- package/skills/cm-prd/references/js-host.md +4 -2
- package/skills/cm-prd/references/spec-self-check.md +5 -1
- package/skills/cm-refactor/SKILL.md +8 -0
- package/skills/cm-refactor/references/js-host.md +2 -0
- package/skills/cm-test/SKILL.md +4 -0
- package/templates/dashboard/dashboard.html +2 -2
- package/templates/pixel/cm-pixel.html +1 -1
- package/templates/pixel/cm-pixel.sh +1 -1
- package/templates/pixel/dev/template.html +1 -1
- package/templates/statusline/cm-statusline.sh +1 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Synthetic fixture support. Every provider response and verification receipt
|
|
2
|
+
// below is test data, never a real review or product completion claim.
|
|
3
|
+
import assert from 'node:assert/strict';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import {createHash} from 'node:crypto';
|
|
8
|
+
import {spawnSync} from 'node:child_process';
|
|
9
|
+
import {buildManifest} from '../cm-spec-manifest.mjs';
|
|
10
|
+
import {openControlRun} from '../cm-ai-run.mjs';
|
|
11
|
+
import {createDeveloperRun} from '../../runtime/js/cm-ai/developer-adapter.mjs';
|
|
12
|
+
import {createHostCheck} from '../../runtime/js/cm-ai/host-check.mjs';
|
|
13
|
+
import {createHostHandoff} from '../../runtime/js/cm-ai/host-handoff.mjs';
|
|
14
|
+
import {createHostReviewAuthority} from '../../runtime/js/cm-ai/host-review-authority.mjs';
|
|
15
|
+
import {captureReviewBaseline,createReviewPackage} from '../../runtime/js/cm-ai/review-package.mjs';
|
|
16
|
+
import {reviewPaths} from '../../runtime/js/cm-ai/review-runner.mjs';
|
|
17
|
+
import {readExecutionSnapshot} from '../../runtime/js/cm-ai/execution-snapshot.mjs';
|
|
18
|
+
import {readRunnerHistory} from '../../runtime/js/cm-ai/durable-runner-state.mjs';
|
|
19
|
+
import {digest} from '../../runtime/js/cm-ai/effect-contract.mjs';
|
|
20
|
+
import {createFixFinalReview,fixFinalReviewConfiguration} from '../../runtime/js/cm-fix/final-review.mjs';
|
|
21
|
+
|
|
22
|
+
export const canonical=value=>JSON.stringify(value)+'\n';
|
|
23
|
+
export const sha=value=>createHash('sha256').update(value).digest('hex');
|
|
24
|
+
export const fileRecord=(name,bytes,mode=0o644)=>({path:name,type:'file',mode,size:Buffer.byteLength(bytes),sha256:sha(bytes)});
|
|
25
|
+
export const syntheticEvents=(onEvent,thread)=>{
|
|
26
|
+
for(const event of [{event:'thread.started',provider_thread:thread},{event:'turn.started',item_type:null},
|
|
27
|
+
{event:'item.completed',item_type:'agent_message'},{event:'turn.completed',item_type:null},
|
|
28
|
+
{event:'process_closed',exit_code:0,signal:null,timed_out:false}])onEvent(event);
|
|
29
|
+
};
|
|
30
|
+
const checks=[{id:'synthetic',command:['synthetic-check'],outcome:'passed',exitCode:0,evidence:'Synthetic fixture only'}];
|
|
31
|
+
|
|
32
|
+
function git(cwd,...args){
|
|
33
|
+
const run=spawnSync('/usr/bin/git',['-c','core.fsmonitor=false','-c','core.hooksPath=/dev/null','-c','commit.gpgsign=false',...args],
|
|
34
|
+
{cwd,encoding:'utf8',timeout:10000});
|
|
35
|
+
assert.equal(run.status,0,run.stderr);return run.stdout.trim();
|
|
36
|
+
}
|
|
37
|
+
function put(root,file,bytes){fs.mkdirSync(path.dirname(path.join(root,file)),{recursive:true});fs.writeFileSync(path.join(root,file),bytes);}
|
|
38
|
+
|
|
39
|
+
export async function syntheticIntegrationReview(root,plan,documentBytes,{includeVerification=true,threadId='synthetic-integration-review-thread',snapshotEvidence=null}={}){
|
|
40
|
+
const proofRoot=fs.mkdtempSync(path.join(root,'proof-'));
|
|
41
|
+
const planPath='integration/plan.json',probe='integration/probe.mjs';
|
|
42
|
+
put(proofRoot,planPath,canonical(plan));put(proofRoot,probe,'export const probe=0;\n');
|
|
43
|
+
const requirements=[planPath];
|
|
44
|
+
if(snapshotEvidence!==null){
|
|
45
|
+
const provenancePath='integration/snapshot-provenance.json';
|
|
46
|
+
put(proofRoot,provenancePath,snapshotEvidence.provenance);requirements.push(provenancePath);
|
|
47
|
+
for(const [hash,bytes] of Object.entries(snapshotEvidence.contents)){
|
|
48
|
+
assert.match(hash,/^[a-f0-9]{64}$/);assert.equal(sha(bytes),hash);
|
|
49
|
+
const name=`integration/snapshots/${hash}.txt`;put(proofRoot,name,bytes);requirements.push(name);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for(const [file,bytes] of Object.entries(documentBytes))put(proofRoot,`integration/documents/${file}`,bytes.before);
|
|
53
|
+
const identity={repositoryId:plan.target.identity.repositoryId,runId:'synthetic-integration-review',taskId:'T-FIX-integration',attempt:1};
|
|
54
|
+
const baseline=captureReviewBaseline({root:proofRoot,identity,
|
|
55
|
+
scope:[probe,...Object.keys(documentBytes).map(file=>`integration/documents/${file}`)],requirements});
|
|
56
|
+
put(proofRoot,probe,'export const probe=1;\n');
|
|
57
|
+
for(const [file,bytes] of Object.entries(documentBytes))put(proofRoot,`integration/documents/${file}`,bytes.after);
|
|
58
|
+
const handoffPath=path.join(root,`synthetic-handoff-${path.basename(proofRoot)}.json`);
|
|
59
|
+
createHostHandoff({root:proofRoot,baseline,checks,handoffPath,
|
|
60
|
+
evidence:['learning: no_relevant_lesson','learning: retrospective no_new_lesson','Synthetic integration test only']});
|
|
61
|
+
const pkg=createReviewPackage({root:proofRoot,baseline,checks,handoffPath});
|
|
62
|
+
const materials=[...pkg.changes.filter(c=>c.after).map(c=>({...c.after,path:c.path})),
|
|
63
|
+
...(pkg.unchangedScope??[]),...pkg.requirements,...(pkg.instructions??[])];
|
|
64
|
+
const files=[...new Map(materials.map(file=>[file.path,{path:file.path,sha256:file.sha256,mode:file.mode}])).values()]
|
|
65
|
+
.sort((a,b)=>a.path.localeCompare(b.path));
|
|
66
|
+
const verification={files:files.map(file=>file.path),checks:[{id:'unit',command:[process.execPath,'--check',probe]}],
|
|
67
|
+
mutationPaths:[probe],timeoutMs:1000};
|
|
68
|
+
const causeReview={reviewerId:'synthetic-cause-reviewer',adapterId:'claude-cause-review-adapter',provider:'claude',
|
|
69
|
+
requestedModel:'synthetic',contextId:'synthetic-cause-review',excludedThreadIds:[]};
|
|
70
|
+
const configuration=fixFinalReviewConfiguration({hostContextId:plan.author.contextId,causeReview,
|
|
71
|
+
...(includeVerification?{reviewVerification:verification}:{})});
|
|
72
|
+
const authority=createHostReviewAuthority({hostContextId:configuration.hostContextId,
|
|
73
|
+
reviewerId:configuration.reviewer.reviewerId,adapterId:configuration.reviewer.adapterId,
|
|
74
|
+
decide:async()=>({status:'approved'})});
|
|
75
|
+
await authority.hostDecisionProvider.decide({identity,packageDigest:pkg.packageDigest},new AbortController().signal);
|
|
76
|
+
let registration,started;
|
|
77
|
+
const review=createFixFinalReview({reviewPackage:pkg,configuration,timeoutMs:1000},{authorize:authority.authorize,
|
|
78
|
+
async run(request,{onEvent,onVerification}){
|
|
79
|
+
syntheticEvents(onEvent,threadId);
|
|
80
|
+
if(includeVerification){
|
|
81
|
+
const before=files.find(file=>file.path===probe).sha256;
|
|
82
|
+
onVerification({version:1,requestDigest:request.requestDigest,packageDigest:pkg.packageDigest,
|
|
83
|
+
profileDigest:digest(verification),providerThreadId:threadId,files,snapshotDigest:digest(files),
|
|
84
|
+
checks:[{id:'unit',commandDigest:digest(verification.checks[0].command),exitCode:0,outputSha256:sha('synthetic check'),startedAt:1,endedAt:2}],
|
|
85
|
+
mutations:[{path:probe,beforeSha256:before,afterSha256:sha('synthetic mutation'),checkId:'unit',
|
|
86
|
+
baselineExitCode:0,mutatedExitCode:1,restoredExitCode:0,restoredSha256:before,startedAt:3,endedAt:4}]});
|
|
87
|
+
}
|
|
88
|
+
return {status:'succeeded',value:{verdict:'approved',packageDigest:pkg.packageDigest,
|
|
89
|
+
examinedPaths:reviewPaths(pkg),findings:[],summary:'Synthetic integration test observation, not independent review'}};
|
|
90
|
+
}});
|
|
91
|
+
const result=await review({signal:new AbortController().signal,register(value){registration=value;},onStarted(value){started=value;}});
|
|
92
|
+
assert.equal(result.inspection?.review?.verdict,'approved',JSON.stringify(result));
|
|
93
|
+
return {configuration,registration,started,result:result.value};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function createReviewedIntegrationFixture(t,{unrelated=false,premature=false,controlPolicy=null,sourceBeforeRename=false,providerDevelopment=false,developerProvider='claude'}={}){
|
|
97
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-reviewed-integration-')));
|
|
98
|
+
const env={CM_WORKFLOW_HOME:process.env.CM_WORKFLOW_HOME,CM_WORKFLOW_LOG_HOME:process.env.CM_WORKFLOW_LOG_HOME};
|
|
99
|
+
process.env.CM_WORKFLOW_HOME=path.join(root,'home');process.env.CM_WORKFLOW_LOG_HOME=path.join(root,'logs');
|
|
100
|
+
t.after(()=>{
|
|
101
|
+
for(const [key,value] of Object.entries(env)){if(value===undefined)delete process.env[key];else process.env[key]=value;}
|
|
102
|
+
fs.rmSync(root,{recursive:true,force:true});
|
|
103
|
+
});
|
|
104
|
+
const codeProject=path.join(root,'code'),sourceRoot=path.join(root,'source'),specsDir=path.join(root,'specs');
|
|
105
|
+
fs.mkdirSync(codeProject);
|
|
106
|
+
const originalFiles={'parent.mjs':'export const parent=0;\n','source.mjs':'export const source=0;\n',
|
|
107
|
+
'next.mjs':'export const next=0;\n','docs/guide.md':'# Guide\n','req.md':'Synthetic requirements\n',
|
|
108
|
+
'package.json':canonical({name:'oldrepo'}),'.cm-workflow.json':canonical({version:1,policies:{delivery:'diff'}})};
|
|
109
|
+
for(const [file,bytes] of Object.entries(originalFiles))put(codeProject,file,bytes);
|
|
110
|
+
git(codeProject,'init','--quiet');git(codeProject,'add','.');
|
|
111
|
+
git(codeProject,'-c','user.name=Synthetic Fixture','-c','user.email=fixture@example.invalid','commit','--quiet','-m','Synthetic baseline');
|
|
112
|
+
git(codeProject,'worktree','add','--quiet','--detach',sourceRoot);
|
|
113
|
+
const names=['parent','cross','rename','renamed',...(premature?['premature']:[]),...(unrelated?['unrelated']:[])];
|
|
114
|
+
const features=names.map((name,index)=>`${index+1}.${name}`);
|
|
115
|
+
for(const [index,name] of names.entries()){
|
|
116
|
+
const feature=features[index],taskId=`T-${String(index+1).padStart(3,'0')}`;
|
|
117
|
+
for(const file of ['requirements.md','design.md'])put(specsDir,`${feature}/${file}`,'# Synthetic fixture\n');
|
|
118
|
+
put(specsDir,`${feature}/tasks.md`,`- [ ] ${taskId}: implement ${name}\n`);
|
|
119
|
+
}
|
|
120
|
+
put(specsDir,'.cm-specs-status',canonical({status:'approved',features,specFiles:buildManifest(specsDir)}));
|
|
121
|
+
let unrelatedRoot=null;
|
|
122
|
+
if(unrelated){
|
|
123
|
+
unrelatedRoot=path.join(root,'unrelated');fs.mkdirSync(unrelatedRoot);
|
|
124
|
+
for(const [file,bytes] of Object.entries(originalFiles))put(unrelatedRoot,file,bytes);
|
|
125
|
+
git(unrelatedRoot,'init','--quiet');git(unrelatedRoot,'add','.');
|
|
126
|
+
git(unrelatedRoot,'-c','user.name=Synthetic Fixture','-c','user.email=fixture@example.invalid','commit','--quiet','-m','Separate synthetic baseline');
|
|
127
|
+
}
|
|
128
|
+
const calls={develop:0,review:0,check:0},definitions={},executions={},approvedBytes={};let sealed=false;
|
|
129
|
+
const changes={parent:{'parent.mjs':'export const parent=1;\n','docs/guide.md':'# Guide\nParent reviewed paragraph.\n'},
|
|
130
|
+
cross:{'source.mjs':'export const source=1;\n'},rename:{'package.json':canonical({name:'newrepo'})},
|
|
131
|
+
renamed:{'next.mjs':'export const next=1;\n'},premature:{'next.mjs':'export const next=1;\n'},unrelated:{'source.mjs':'export const source=1;\n'}};
|
|
132
|
+
const statePath=name=>path.join(specsDir,'.reviews','.execution',definitions[name].identity.runId,'state.json');
|
|
133
|
+
const snapshot=name=>readExecutionSnapshot({specsRoot:specsDir,identity:{repositoryId:definitions[name].identity.repositoryId,
|
|
134
|
+
runId:definitions[name].identity.runId}});
|
|
135
|
+
const history=name=>{const saved=snapshot(name);return {saved,...readRunnerHistory(saved.records,saved.records[0].payload.config,3)};};
|
|
136
|
+
const request=(name,operation,extra={})=>({version:1,requestId:`synthetic-${name}-${operation}`,operation,identity:definitions[name].identity,...extra});
|
|
137
|
+
for(const [index,name] of names.entries()){
|
|
138
|
+
const targetRoot=name==='cross'?sourceRoot:name==='unrelated'?unrelatedRoot:codeProject;
|
|
139
|
+
const identity={repositoryId:['renamed','premature'].includes(name)?'newrepo':'oldrepo',runId:`integration-${name}`,taskId:`T-${String(index+1).padStart(3,'0')}`,attempt:1};
|
|
140
|
+
definitions[name]={version:1,specsDir,codeProject:targetRoot,feature:features[index],identity,
|
|
141
|
+
featureSelection:{version:1,feature:features[index]},scope:Object.keys(changes[name]),requirements:['req.md']};
|
|
142
|
+
const check=createHostCheck({cwd:targetRoot,commands:[{id:'syntax',command:[process.execPath,'--check','parent.mjs']}]});
|
|
143
|
+
executions[name]={configuration:{kind:'synthetic-integration-fixture',...(controlPolicy?{controlPolicy}:{}),
|
|
144
|
+
...(providerDevelopment?{providerDevelopment:true}:{})},timeoutMs:3000,excludedContexts:['synthetic-host'],
|
|
145
|
+
developer:{provider:developerProvider,requestedModel:'synthetic',contextId:`${name}-author`,
|
|
146
|
+
run:createDeveloperRun({provider:developerProvider,requestedModel:'synthetic',worker:async()=>{
|
|
147
|
+
assert.equal(sealed,false,'adoption must not call a developer');calls.develop++;
|
|
148
|
+
for(const [file,bytes] of Object.entries(changes[name]))put(targetRoot,file,bytes);
|
|
149
|
+
return {status:'succeeded',value:{outcome:'implemented',application:{status:'no_relevant_lesson',note:null},
|
|
150
|
+
retrospective:{status:'no_new_lesson',candidates:[],reason:null}}};
|
|
151
|
+
}})},
|
|
152
|
+
reviewers:[{id:'reviewer',adapterId:'codex-review-adapter',provider:'codex',requestedModel:'synthetic',allowed:true,available:true,
|
|
153
|
+
contexts:[`${name}-review-1`,`${name}-review-2`],run:async(reviewRequest,{onEvent})=>{
|
|
154
|
+
assert.equal(sealed,false,'adoption must not call a reviewer');calls.review++;
|
|
155
|
+
syntheticEvents(onEvent,`synthetic-${name}-review-thread`);
|
|
156
|
+
return {status:'succeeded',value:{verdict:'approved',packageDigest:reviewRequest.payload.reviewPackage.packageDigest,
|
|
157
|
+
examinedPaths:reviewPaths(reviewRequest.payload.reviewPackage),findings:[],summary:'Synthetic fixture review'}};
|
|
158
|
+
}}],reviewInvocation:{developerThreadId:`${name}-author`,excludedThreadIds:['synthetic-host']},
|
|
159
|
+
check:async(...args)=>{assert.equal(sealed,false,'adoption must not execute checks');calls.check++;return check(...args);},applicableAgentFiles:[]};
|
|
160
|
+
}
|
|
161
|
+
// All operations use real durable V3 owners. No journal is fabricated to make
|
|
162
|
+
// a source eligible, and no product provider is invoked.
|
|
163
|
+
const runOrder=sourceBeforeRename?names.filter(name=>name!=='rename').concat('rename'):
|
|
164
|
+
premature?['parent','cross','premature',...names.filter(name=>!['parent','cross','premature'].includes(name))]:names;
|
|
165
|
+
for(const name of runOrder){
|
|
166
|
+
const run=await openControlRun(definitions[name],'create',executions[name]);
|
|
167
|
+
try{
|
|
168
|
+
assert.ok(run.host,JSON.stringify(run.blocked));
|
|
169
|
+
const start=await run.host.handle(request(name,'start'));assert.equal(start.state,'awaiting_review',JSON.stringify(start));
|
|
170
|
+
const decision=await run.host.handle(request(name,'decision',{packageDigest:start.packageDigest}));
|
|
171
|
+
assert.equal(decision.state,'approved',JSON.stringify(decision));approvedBytes[name]=fs.readFileSync(statePath(name));
|
|
172
|
+
const complete=await run.host.handle(request(name,'complete',{packageDigest:start.packageDigest}));
|
|
173
|
+
assert.equal(complete.state,'fixture_completed',JSON.stringify(complete));
|
|
174
|
+
}finally{run.close();}
|
|
175
|
+
// Fixture-only shelving retains a valid historical package with an earlier
|
|
176
|
+
// new-name review. The later legitimate source starts from the same bytes.
|
|
177
|
+
if(name==='premature')put(codeProject,'next.mjs',originalFiles['next.mjs']);
|
|
178
|
+
}
|
|
179
|
+
sealed=true;
|
|
180
|
+
const parent=history('parent'),before=changes.parent['docs/guide.md'],after=before+'Reviewed integration paragraph.\n';
|
|
181
|
+
const documents={'docs/guide.md':{before,after}};
|
|
182
|
+
const makePlan=(targetName='parent',sourceNames=['cross','renamed'],withDocument=true)=>{
|
|
183
|
+
const target=history(targetName);
|
|
184
|
+
return {version:1,kind:'cm-reviewed-integration-v1',author:{provider:'codex',contextId:'synthetic-integration-author'},target:{identity:target.state.reviewPackage.identity,
|
|
185
|
+
rootDigest:target.original.rootDigest,baselineDigest:target.original.baselineDigest,packageDigest:target.state.reviewPackage.packageDigest,
|
|
186
|
+
recordCount:target.saved.records.length,lastDigest:target.saved.records.at(-1).digest},
|
|
187
|
+
sources:sourceNames.map(name=>{const source=history(name);return {identity:source.state.reviewPackage.identity,
|
|
188
|
+
root:definitions[name].codeProject,revision:source.saved.revision,packageDigest:source.state.reviewPackage.packageDigest};}),
|
|
189
|
+
documents:withDocument?[{path:'docs/guide.md',before:fileRecord('docs/guide.md',before),after:fileRecord('docs/guide.md',after)}]:[]};
|
|
190
|
+
};
|
|
191
|
+
const plan=makePlan(),review=await syntheticIntegrationReview(root,plan,documents);
|
|
192
|
+
put(codeProject,'source.mjs',changes.cross['source.mjs']);put(codeProject,'docs/guide.md',after);
|
|
193
|
+
const evidenceFile=path.join(root,'integration-evidence.json');fs.writeFileSync(evidenceFile,canonical({plan,review}),{mode:0o600});
|
|
194
|
+
const input={root:codeProject,specsRoot:specsDir,baseline:parent.original,parentPackage:parent.state.reviewPackage,
|
|
195
|
+
records:parent.saved.records,plan,review};
|
|
196
|
+
const record={version:1,plan,reviewFile:{path:evidenceFile,sha256:sha(fs.readFileSync(evidenceFile))},
|
|
197
|
+
reason:'Explicit reviewed integration',planDigest:digest(plan)};
|
|
198
|
+
return {root,codeProject,sourceRoot,unrelatedRoot,specsDir,definitions,executions,calls,approvedBytes,
|
|
199
|
+
statePath,snapshot,history,request,makePlan,plan,review,documents,evidenceFile,record,input,
|
|
200
|
+
write:(file,bytes)=>put(codeProject,file,bytes),
|
|
201
|
+
openParent:(options={})=>openControlRun(definitions.parent,'resume',executions.parent,options)};
|
|
202
|
+
}
|
|
@@ -43,6 +43,7 @@ ALLOW_LOOPBACK_ENDPOINT_FILES = {
|
|
|
43
43
|
Path("scripts/cm-ai-multi-root.test.mjs"),
|
|
44
44
|
Path("scripts/cm-ai-nested-execution.test.mjs"),
|
|
45
45
|
Path("scripts/cm-claude-probe.test.mjs"),
|
|
46
|
+
Path("scripts/cm-fix-review-verification-command.test.mjs"),
|
|
46
47
|
Path("scripts/cm-fix-visual-bare.test.mjs"),
|
|
47
48
|
Path("scripts/cm-fix-walkthrough.test.mjs"),
|
|
48
49
|
Path("scripts/cm-notify-command.test.mjs"),
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {test} from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import {spawnSync} from 'node:child_process';
|
|
7
|
+
import {cmAiSessionBoundary,cmFixSessionBoundary,openTasks} from '../runtime/js/session-boundary.mjs';
|
|
8
|
+
import {handoffPath,printHandoff,readHandoff,writeHandoff} from '../runtime/js/session-handoff.mjs';
|
|
9
|
+
|
|
10
|
+
const specs=t=>{const root=fs.mkdtempSync(path.join(os.tmpdir(),'cm-boundary-'));t.after(()=>fs.rmSync(root,{recursive:true,force:true}));
|
|
11
|
+
fs.mkdirSync(path.join(root,'1.slug'));return root;};
|
|
12
|
+
const lines=block=>block.split('\n').slice(1);
|
|
13
|
+
|
|
14
|
+
const write=(root,text)=>fs.writeFileSync(path.join(root,'1.slug','tasks.md'),text);
|
|
15
|
+
const boundary=root=>lines(cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug'}));
|
|
16
|
+
|
|
17
|
+
test('cm-ai run_done with every task done says there is nothing next',t=>{
|
|
18
|
+
const root=specs(t);write(root,'- [x] T-001: done\n- [x] T-002: done\n');
|
|
19
|
+
assert.deepEqual(boundary(root),['会话边界:换新会话。','新会话里运行:无,1.slug 的任务已全部完成','原因:本运行已到 run_done,记录都已落盘,下一项是新单元。']);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('open tasks are listed with their full ids, without naming one as the next executable task',t=>{
|
|
23
|
+
const root=specs(t);write(root,'- [x] T-001: done\n- [ ] T-002a: open\n- [ ] T-OBS: observe\n');
|
|
24
|
+
assert.deepEqual(openTasks(root,'1.slug'),['T-002a','T-OBS']);
|
|
25
|
+
assert.equal(boundary(root)[1],'新会话里运行:$cm-ai(1.slug 仍有未完成任务:T-002a、T-OBS)');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('fenced examples and dropped tasks are not open work',t=>{
|
|
29
|
+
// Fences count under the grammar a taskGrammar-2 approval binds; older approvals keep the legacy parse.
|
|
30
|
+
const root=specs(t);fs.writeFileSync(path.join(root,'.cm-specs-status'),JSON.stringify({status:'approved',taskGrammar:2}));write(root,'- [x] T-001: done\n- [ ] T-002: ~~[DROPPED 不做]~~\n```\n- [ ] T-999: example\n```\n');
|
|
31
|
+
assert.deepEqual(openTasks(root,'1.slug'),[]);
|
|
32
|
+
assert.equal(boundary(root)[1],'新会话里运行:无,1.slug 的任务已全部完成');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('an unreadable, empty or invalid task list is "cannot tell", never "all done"',t=>{
|
|
36
|
+
const root=specs(t);
|
|
37
|
+
assert.equal(openTasks(root,'1.slug'),null);
|
|
38
|
+
assert.match(boundary(root)[1],/无法确定/);
|
|
39
|
+
write(root,'');assert.equal(openTasks(root,'1.slug'),null);assert.match(boundary(root)[1],/无法确定/);
|
|
40
|
+
write(root,'- [ ] T-001: a\n- [x] T-001: duplicate\n');assert.equal(openTasks(root,'1.slug'),null);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('the header keeps both exceptions of the judgement table',()=>{
|
|
44
|
+
const header=cmFixSessionBoundary({stage:'completed',completionEligible:true},'advance').split('\n')[0];
|
|
45
|
+
assert.match(header,/会话边界:继续本会话。/);assert.match(header,/会话边界:留在本会话/);assert.match(header,/删掉「新会话里运行」那一行/);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// The real drivers are wired: cm-ai is also covered end to end in cm-ai-drive.test.mjs
|
|
49
|
+
// (run_done prints the block on stderr); cm-fix has no completion fixture, so the
|
|
50
|
+
// wiring is checked statically here.
|
|
51
|
+
test('both drivers pass their session-boundary callback to the shared core',()=>{
|
|
52
|
+
const read=name=>fs.readFileSync(new URL(`./${name}`,import.meta.url),'utf8');
|
|
53
|
+
assert.match(read('cm-ai-drive.mjs'),/sessionBoundary:result=>cmAiSessionBoundary\(result,\{specsDir:definition\.specsDir,feature:definition\.feature,identity:definition\.identity\}\)/);
|
|
54
|
+
assert.match(read('cm-fix-drive.mjs'),/sessionBoundary:\(result,op\)=>cmFixSessionBoundary\(result,op,\{archive,runId:config\.identity\?\.runId\}\)/);
|
|
55
|
+
// A new run (mode:create) prints the previous handoff before the host starts.
|
|
56
|
+
assert.match(read('cm-ai-drive.mjs'),/if\(plan\.mode==='create'\)printHandoff\(definition\.specsDir\);\n driveHost\(/);
|
|
57
|
+
assert.match(read('cm-fix-drive.mjs'),/if\(plan\.mode==='create'\)printHandoff\(archive\);/);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('no verdict before run_done, for another workflow, or for an unfinished fix',()=>{
|
|
61
|
+
assert.equal(cmAiSessionBoundary({workflow:'cm-ai',state:'fixture_completed'},{}),null);
|
|
62
|
+
assert.equal(cmAiSessionBoundary({workflow:'cm-prd',state:'run_done'},{}),null);
|
|
63
|
+
assert.equal(cmFixSessionBoundary({stage:'completed',completionEligible:false},'advance'),null);
|
|
64
|
+
assert.equal(cmFixSessionBoundary({stage:'regression_required'},'advance'),null);
|
|
65
|
+
assert.equal(cmFixSessionBoundary({stage:'completed',completionEligible:true},'status'),null,'a status query is not the closing boundary');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('a finished cm-fix gets the three lines',()=>{
|
|
69
|
+
assert.deepEqual(lines(cmFixSessionBoundary({stage:'completed',completionEligible:true},'advance')),
|
|
70
|
+
['会话边界:换新会话。','新会话里运行:无(有下一个缺陷时,在新会话里运行 $cm-fix)','原因:本缺陷已收口,记录都已落盘。']);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// The shared driver core prints the block to stderr after a final result,
|
|
74
|
+
// keeps stdout a single JSON result, and prints nothing for other results.
|
|
75
|
+
for(const [name,state,expect] of [['prints the verdict at run_done','run_done',true],['stays silent before run_done','fixture_completed',false]]){
|
|
76
|
+
test(`driver core ${name}`,t=>{
|
|
77
|
+
const root=specs(t),host=path.join(root,'host.mjs'),wrapper=path.join(root,'drive.mjs');
|
|
78
|
+
fs.writeFileSync(path.join(root,'1.slug','tasks.md'),'- [x] T-001: done\n');
|
|
79
|
+
fs.writeFileSync(host,`process.stdout.write(JSON.stringify({type:'host_ready',sessionId:'s'})+'\\n');
|
|
80
|
+
let text='';process.stdin.on('data',chunk=>{text+=chunk;let at;while((at=text.indexOf('\\n'))>=0){const line=text.slice(0,at);text=text.slice(at+1);
|
|
81
|
+
if(!line)continue;const row=JSON.parse(line);if(row.requestId==='drive')process.stdout.write(JSON.stringify({requestId:'drive',result:{workflow:'cm-ai',state:${JSON.stringify(state)}}})+'\\n');}});`);
|
|
82
|
+
fs.writeFileSync(wrapper,`import {driveHost} from ${JSON.stringify(new URL('../runtime/js/cm-ai/drive-core.mjs',import.meta.url).href)};
|
|
83
|
+
import {cmAiSessionBoundary} from ${JSON.stringify(new URL('../runtime/js/session-boundary.mjs',import.meta.url).href)};
|
|
84
|
+
driveHost({host:${JSON.stringify(host)},args:[],cwd:${JSON.stringify(root)},operation:'advance',answers:{},answerFor:()=>null,
|
|
85
|
+
sessionBoundary:result=>cmAiSessionBoundary(result,{specsDir:${JSON.stringify(root)},feature:'1.slug'})});`);
|
|
86
|
+
const run=spawnSync(process.execPath,[wrapper],{encoding:'utf8',timeout:10000});
|
|
87
|
+
assert.equal(run.status,0,run.stderr);
|
|
88
|
+
assert.equal(JSON.parse(run.stdout).result.state,state,'stdout stays one JSON result');
|
|
89
|
+
assert.equal(run.stderr.includes('新会话里运行:无,1.slug 的任务已全部完成'),expect,run.stderr);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Session handoff: written at the closing boundary, printed when the next run is created.
|
|
94
|
+
const withReviews=t=>{const root=specs(t);fs.mkdirSync(path.join(root,'.reviews'));return root;};
|
|
95
|
+
const identity={runId:'run-7',taskId:'T-002',repositoryId:'repo'};
|
|
96
|
+
|
|
97
|
+
test('cm-ai run_done writes the handoff with done, open tasks and the next command, and names it in the verdict',t=>{
|
|
98
|
+
const root=withReviews(t);write(root,'- [x] T-001: done\n- [x] T-002: done\n- [ ] T-003: open\n');
|
|
99
|
+
const block=cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug',identity});
|
|
100
|
+
assert.equal(lines(block)[3],`交接摘要:${handoffPath(root)}(新会话开新运行时驾驶员会先打印它)`);
|
|
101
|
+
const text=fs.readFileSync(handoffPath(root),'utf8');
|
|
102
|
+
assert.match(text,/运行编号:run-7/);assert.match(text,/## 已做\n- 1\.slug T-002:已到 run_done/);
|
|
103
|
+
assert.match(text,/## 待做\n- 1\.slug T-003\n/);assert.match(text,/## 下一条命令\n- \$cm-ai(1\.slug 仍有未完成任务:T-003)/);
|
|
104
|
+
assert.doesNotMatch(text,/repo/,'no identity beyond the run id is written');
|
|
105
|
+
assert.deepEqual(fs.readdirSync(path.join(root,'.reviews')),['session-handoff.md'],'no temporary file is left behind');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('an unreadable task list is written as "cannot tell", never as nothing left',t=>{
|
|
109
|
+
const root=withReviews(t);
|
|
110
|
+
cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug',identity});
|
|
111
|
+
assert.match(fs.readFileSync(handoffPath(root),'utf8'),/## 待做\n- 无法确定/);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('a handoff that cannot be written is reported in the verdict, not swallowed, and the verdict still prints',t=>{
|
|
115
|
+
const root=specs(t);write(root,'- [x] T-001: done\n');
|
|
116
|
+
const block=cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug',identity});
|
|
117
|
+
assert.equal(lines(block)[0],'会话边界:换新会话。');
|
|
118
|
+
assert.match(lines(block)[3],/^交接摘要:未写成(ENOENT)/);
|
|
119
|
+
assert.equal(fs.existsSync(path.join(root,'.reviews')),false,'the records directory is not invented');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('no handoff and no extra line when the caller passes no identity or archive',t=>{
|
|
123
|
+
const root=withReviews(t);write(root,'- [x] T-001: done\n');
|
|
124
|
+
assert.equal(lines(cmAiSessionBoundary({workflow:'cm-ai',state:'run_done'},{specsDir:root,feature:'1.slug'})).length,3);
|
|
125
|
+
assert.equal(lines(cmFixSessionBoundary({stage:'completed',completionEligible:true},'advance')).length,3);
|
|
126
|
+
assert.equal(fs.existsSync(handoffPath(root)),false);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
test('a finished cm-fix writes its handoff; an unfinished one or a status query writes nothing',t=>{
|
|
130
|
+
const root=withReviews(t);
|
|
131
|
+
assert.equal(cmFixSessionBoundary({stage:'regression_required'},'advance',{archive:root,runId:'fix-1'}),null);
|
|
132
|
+
assert.equal(cmFixSessionBoundary({stage:'completed',completionEligible:true},'status',{archive:root,runId:'fix-1'}),null);
|
|
133
|
+
assert.equal(fs.existsSync(handoffPath(root)),false);
|
|
134
|
+
const block=cmFixSessionBoundary({stage:'completed',completionEligible:true},'advance',{archive:root,runId:'fix-1'});
|
|
135
|
+
assert.match(lines(block)[3],/^交接摘要:/);
|
|
136
|
+
const text=fs.readFileSync(handoffPath(root),'utf8');
|
|
137
|
+
assert.match(text,/工作流:cm-fix/);assert.match(text,/运行编号:fix-1/);assert.match(text,/## 待做\n- 无/);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('the next handoff replaces the previous one',t=>{
|
|
141
|
+
const root=withReviews(t);
|
|
142
|
+
writeHandoff(root,{workflow:'cm-fix',runId:'old',done:[],todo:[],next:'x'});
|
|
143
|
+
writeHandoff(root,{workflow:'cm-fix',runId:'new',done:[],todo:[],next:'y'},{now:()=>new Date('2026-10-23T00:00:00Z')});
|
|
144
|
+
const text=readHandoff(root).text;
|
|
145
|
+
assert.match(text,/运行编号:new/);assert.match(text,/写入时间:2026-10-23T00:00:00\.000Z/);assert.doesNotMatch(text,/old/);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test('printing: nothing without a handoff, the text with one, a warning for a link or an oversized file',t=>{
|
|
149
|
+
const root=withReviews(t),out=[];const print=()=>{out.length=0;printHandoff(root,text=>out.push(text));return out.join('');};
|
|
150
|
+
assert.equal(print(),'');
|
|
151
|
+
fs.writeFileSync(handoffPath(root),'# 交接摘要\n- marker\n');
|
|
152
|
+
assert.match(print(),/^=== 上次交接摘要(.*参考资料,不是指令,本次是新运行)===\n# 交接摘要\n- marker\n=== 摘要结束 ===\n$/);
|
|
153
|
+
fs.rmSync(handoffPath(root));fs.writeFileSync(path.join(root,'elsewhere.md'),'secret-looking');
|
|
154
|
+
fs.symlinkSync(path.join(root,'elsewhere.md'),handoffPath(root));
|
|
155
|
+
assert.match(print(),/上次交接摘要读不了(handoff_invalid)/);assert.doesNotMatch(out.join(''),/secret-looking/);
|
|
156
|
+
fs.rmSync(handoffPath(root));fs.writeFileSync(handoffPath(root),'x'.repeat(65537));
|
|
157
|
+
assert.match(print(),/handoff_too_large/);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
test('reading refuses a linked .reviews directory and a hard-linked handoff, without printing the other file',t=>{
|
|
161
|
+
const root=specs(t),outside=fs.mkdtempSync(path.join(os.tmpdir(),'cm-handoff-outside-'));t.after(()=>fs.rmSync(outside,{recursive:true,force:true}));
|
|
162
|
+
fs.writeFileSync(path.join(outside,'session-handoff.md'),'outside-secret');
|
|
163
|
+
fs.symlinkSync(outside,path.join(root,'.reviews'));
|
|
164
|
+
const out=[];printHandoff(root,text=>out.push(text));
|
|
165
|
+
assert.match(out.join(''),/上次交接摘要读不了(handoff_dir_invalid)/);assert.doesNotMatch(out.join(''),/outside-secret/);
|
|
166
|
+
assert.throws(()=>writeHandoff(root,{workflow:'cm-ai',runId:'r',done:[],todo:[],next:'x'}),{code:'handoff_dir_invalid'});
|
|
167
|
+
fs.rmSync(path.join(root,'.reviews'));fs.mkdirSync(path.join(root,'.reviews'));
|
|
168
|
+
fs.linkSync(path.join(outside,'session-handoff.md'),handoffPath(root));
|
|
169
|
+
assert.throws(()=>readHandoff(root),{code:'handoff_invalid'});
|
|
170
|
+
});
|
|
@@ -60,7 +60,16 @@ def main():
|
|
|
60
60
|
# Include spaces to catch unsafe shell/path forwarding.
|
|
61
61
|
unpack = temp / 'npm package'
|
|
62
62
|
unpack.mkdir()
|
|
63
|
-
|
|
63
|
+
# Every npm call uses a disposable cache, logs and config, never the real ~/.npm or ~/.npmrc.
|
|
64
|
+
(temp / 'npmrc').write_text('')
|
|
65
|
+
(temp / 'global-npmrc').write_text('')
|
|
66
|
+
npm_env = {**os.environ, 'npm_config_cache': str(temp / 'npm-cache'),
|
|
67
|
+
'npm_config_logs_dir': str(temp / 'npm-logs'),
|
|
68
|
+
'npm_config_userconfig': str(temp / 'npmrc'),
|
|
69
|
+
'npm_config_globalconfig': str(temp / 'global-npmrc'),
|
|
70
|
+
'npm_config_update_notifier': 'false'}
|
|
71
|
+
info = json.loads(run(['npm', 'pack', '--ignore-scripts', '--json', '--pack-destination', str(temp)],
|
|
72
|
+
env=npm_env))[0]
|
|
64
73
|
archive = temp / info['filename']
|
|
65
74
|
packed_paths = {f['path'] for f in info['files']}
|
|
66
75
|
assert {'.codex-plugin/plugin.json', 'install-codex.sh', 'install.sh', 'install.ps1',
|
|
@@ -75,7 +84,7 @@ def main():
|
|
|
75
84
|
outside = temp / 'unrelated project'
|
|
76
85
|
outside.mkdir()
|
|
77
86
|
help_text = run(['npm', 'exec', '--offline', '--yes', '--cache', str(temp / 'npm-cache'),
|
|
78
|
-
'--package', str(archive), '--', 'cm-workflow', '--help'], cwd=outside)
|
|
87
|
+
'--package', str(archive), '--', 'cm-workflow', '--help'], cwd=outside, env=npm_env)
|
|
79
88
|
assert 'Usage: cm-workflow install' in help_text, help_text
|
|
80
89
|
(outside / 'tasks.md').write_text('T-001 remains pending\n')
|
|
81
90
|
project_before = tree(outside)
|
|
@@ -97,8 +106,10 @@ with pathlib.Path(os.environ['CM_NPM_FIXTURE_CALLS']).open('a') as out:
|
|
|
97
106
|
sys.exit(17 if os.environ.get('CM_NPM_FIXTURE_FAIL') == '1' else 0)
|
|
98
107
|
''')
|
|
99
108
|
fake.chmod(0o755)
|
|
109
|
+
# The relocated installer really runs; the companion-skill download must stay off so
|
|
110
|
+
# nothing reaches the network or the real skills directories (covered offline elsewhere).
|
|
100
111
|
env = {**os.environ, 'PATH': str(bin_dir) + os.pathsep + os.environ['PATH'],
|
|
101
|
-
'CM_NPM_FIXTURE_CALLS': str(temp / 'calls.jsonl')}
|
|
112
|
+
'CM_NPM_FIXTURE_CALLS': str(temp / 'calls.jsonl'), 'CM_MATT_SKILLS_INSTALL': 'off'}
|
|
102
113
|
# The shipped Node entry still chooses the original script and arguments.
|
|
103
114
|
# Its injected subprocess executes only our relocated fixture copy.
|
|
104
115
|
bridge = temp / 'entry-fixture.mjs'
|
|
@@ -7,6 +7,8 @@ TMP_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/cm-shell-compat.XXXXXX")"
|
|
|
7
7
|
trap 'rm -rf "$TMP_ROOT"' EXIT HUP INT TERM
|
|
8
8
|
FAILURES=0
|
|
9
9
|
export CM_WORKFLOW_HOME="$TMP_ROOT/user-config"
|
|
10
|
+
# The companion-skill download is covered offline by cm-matt-skills.test.mjs; installers here stay off the network.
|
|
11
|
+
export CM_MATT_SKILLS_INSTALL=off
|
|
10
12
|
|
|
11
13
|
fail() {
|
|
12
14
|
echo "FAIL: $*" >&2
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import {fileURLToPath} from 'node:url';
|
|
6
|
+
import {isTaskId} from '../runtime/js/spec-task-line.mjs';
|
|
6
7
|
|
|
7
8
|
const CASE_ID=/^TC-(\d{3,})$/;
|
|
8
9
|
const FEATURE=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
9
|
-
const REF_IDS={acIds:/^AC-\d{3,}
|
|
10
|
+
const REF_IDS={acIds:/^AC-\d{3,}$/};
|
|
10
11
|
const CASE_FIELDS=new Set(['id','origin','kind','blocking','acIds','taskIds','title','preconditions','steps','expected','cleanup']);
|
|
11
12
|
const STRING_LISTS=['acIds','taskIds','preconditions','steps','expected','cleanup'];
|
|
12
13
|
const pythonRepr=value=>`'${value.replaceAll('\\','\\\\').replaceAll("'","\\'")}'`;
|
|
@@ -18,7 +19,7 @@ function validateStringList(item,field,index,failures){
|
|
|
18
19
|
}
|
|
19
20
|
if(['steps','expected'].includes(field)&&value.length===0)failures.push(`cases[${index}].${field} must not be empty`);
|
|
20
21
|
const pattern=REF_IDS[field];
|
|
21
|
-
if(pattern)for(const entry of value)if(
|
|
22
|
+
if(pattern||field==='taskIds')for(const entry of value)if(field==='taskIds'?!isTaskId(entry):!pattern.test(entry))
|
|
22
23
|
failures.push(`cases[${index}].${field} has invalid id: ${pythonRepr(entry)}`);
|
|
23
24
|
}
|
|
24
25
|
|
package/skills/cm-ai/SKILL.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cm-ai
|
|
3
3
|
description: 用户明确说“规格已确认,开始实现”或要求按已审批 CM specs 开发时使用。新任务默认由 JS workflow 驱动 N1-N8,完成开发、独立审查、QA 与文档同步;模糊点子、未审规格和单独一句“继续”不能触发编码批准。
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash(node ~/.claude/scripts/cm-ai-drive.mjs *)
|
|
6
|
+
- Bash(node ~/.claude/scripts/cm-ai-batch-drive.mjs *)
|
|
4
7
|
---
|
|
5
8
|
|
|
6
9
|
# cm-ai — 自动开发
|
|
@@ -113,7 +116,7 @@ detail 用一句大白话;不直接拼 JSON,避免跨会话格式漂移。
|
|
|
113
116
|
测试/审查/外部回答只写专项凭证,不灌主日志。长步骤和临时资源严格按
|
|
114
117
|
`runtime/logging.md` 配对,禁止用后台心跳制造虚假活跃。
|
|
115
118
|
|
|
116
|
-
**会话边界(省 token):** 单任务运行以 `run_done`
|
|
119
|
+
**会话边界(省 token):** 单任务运行以 `run_done` 收尾时,按 `runtime/model-efficiency.md`「Session boundary」的判断表给出结论;批次只在整批结束后给。驾驶员同时把已做、待做与下一条命令写进 `{SPECS_DIR}/.reviews/session-handoff.md`,结论多一行「交接摘要:…」;新会话建运行(`mode:create`)时驾驶员先打印它,只作参考,不续接旧运行、不带授权。换新会话时,新会话作为新运行的 `--host-context`;单任务运行中途换会话按 `--original-host-context` 规则接手。不得为换会话改写记录、跳过审查或重置授权。
|
|
117
120
|
|
|
118
121
|
**角色路由投影:** N1 用代码项目根读取有效配置;N3 每个实现任务解析 `coder`,N3
|
|
119
122
|
任务检查解析 `tester`,N4 解析 `reviewer`,并在 N6 QA 解析 `tester`。使用:
|
|
@@ -140,4 +143,4 @@ node {CM_WORKFLOW_ROOT}/scripts/cm-workflow-config.mjs \
|
|
|
140
143
|
|
|
141
144
|
**任务状态镜像:** `tasks.md` 是唯一权威任务源。运行时支持任务面板时,可将未完成任务镜像到 Codex/OMX 计划或 Claude 任务清单;N3/N5 同步状态。断点恢复必须由磁盘重建镜像:`[x]` 跳过或标为 completed,`[DROPPED]` 不镜像,不得重复创建条目。
|
|
142
145
|
|
|
143
|
-
**执行策略:** 遵守 `runtime/orchestration.md
|
|
146
|
+
**执行策略:** 遵守 `runtime/orchestration.md`。单代码根默认先用 `cm-ai-batch-plan.mjs` 按已批准 `tasks.md` 生成批次:默认每个任务都在自己的 worktree 里开发、做完按任务顺序合回主目录;无依赖、`- 范围:` 不重叠的任务同组并行。功能最后一个任务、批次最后执行的任务和 `- 设备: 需要` 的任务留在主目录串行;功能有浏览器等交互式验收用例、主目录项目配置文件与当前提交里的不一致(未跟踪或本地改动被藏起来)、或任务可能在中途触发固定检查点 QA(命中工作流登记的关键路径或可能成为连续第 5 个未 QA 任务;生成时用 `--workflow-config` 传入关键路径)时不单独开 worktree(同组并行不受影响);任何任务没写范围或是脚手架功能时整个功能串行。单独进 worktree 的任务照常按固定检查点判定 QA,触发就在它的 worktree 里跑、通过才合回,失败时批次以 `batch_solo_qa_failed` 停下并给出合并分支、`/cm-fix` 修复、新批次继续的出口;只有 2 人及以上同组并行的任务 QA 延后到功能末任务统一跑。项目 `parallel.worktree_all: false` 只保留真正的并行组,`parallel.enabled: false` 不建任何 worktree。
|
|
@@ -80,7 +80,8 @@ scope:
|
|
|
80
80
|
|
|
81
81
|
`attempt` 必须等于 `round`,`handoff` 必须指向本轮 N3 的执行证据,
|
|
82
82
|
`handoff_sha256` 必须逐字使用 `check-n4` 的输出。`scope` 必须逐项覆盖 handoff
|
|
83
|
-
里的全部 `changed_files`;正文必须写实际 findings
|
|
83
|
+
里的全部 `changed_files`;正文必须写实际 findings 或明确的「零发现」(门禁认可的全部说法见 `runtime/review.md`)。
|
|
84
|
+
`reviewer` 只原样写一个允许值,模型等说明写进正文;零阻塞结论必须写在正文第一行、顶格、整行只写结论,例如「结论:零阻塞发现。」。手写凭证由审查方完整产出、主执行者原样保存;门禁报格式错时交回审查方重出,不自行改写。宿主按已绑定审查结果生成的凭证不在此列,但同样不得改结论。
|
|
84
85
|
`approved` 必须写 `blocking_findings: 0`;其他 verdict 至少为 1。
|
|
85
86
|
`self-degraded` 必须写 `independent: false`,并用非空 `degraded_reason` 记录所选独立
|
|
86
87
|
通道为何不可用。
|
|
@@ -66,7 +66,9 @@ taskIds 全部是 `[DROPPED]` 任务的用例(blocking 与否)不适用:
|
|
|
66
66
|
|
|
67
67
|
本版本不输出 `docs_only` 或类型定义专属理由;会话自报不能证明这类条件。
|
|
68
68
|
每个任务均写 `qa` 事件,detail 为 `触发:{reason}` / `跳过:{reason}` / `阻塞:{reason}`,不可静默跳过。
|
|
69
|
-
|
|
69
|
+
并行成员(2 人及以上同组开发)沿用原 `parallel_member_deferred` 延后合同,新行同样为 `score: null`;合并后末任务触发 feature QA。
|
|
70
|
+
单独在 worktree 开发的 1 人组成员不适用该延后,按上表固定必跑点判定,触发时在其 worktree 执行,通过后才合并。批次没有 QA 修复出口,
|
|
71
|
+
生成器与宿主用本表规则预先把可能触发的任务留在主目录;预测落空且 QA 失败时批次停在 `batch_solo_qa_failed`(见 docs/js-workflow-control.md「1 人组」)。
|
|
70
72
|
旧整数行继续按原 4–20 范围与状态约束读取;旧日志和旧 METRICS 不改写,已绑定决策不重新裁决。三种 status 的新行均可使用 null,不新增运行协议号。
|
|
71
73
|
|
|
72
74
|
## 触发格式
|
|
@@ -93,6 +93,20 @@ staging/体验版验证。
|
|
|
93
93
|
|
|
94
94
|
**成本落盘(灰度门槛「单任务成本 < 人工工时」的数据源)**:如果当前 Codex/Claude 界面提供 usage 或会话费用,将总费用与总耗时写入 `{SPECS_DIR}/度量汇总.md`(`成本: ${x} / {N} 任务 ≈ ${x/N} 每任务`);无法获得就标注 `成本: 未采集`,不许编造。
|
|
95
95
|
|
|
96
|
+
## 3.5 复盘提示
|
|
97
|
+
|
|
98
|
+
写完 `run_done` 后运行 `node "{CM_WORKFLOW_ROOT}/scripts/cm-matt-skills.mjs" status`(只读,不装)。
|
|
99
|
+
先判命令结果,再判状态,写成总结里的 `🔁 复盘` 行。固定命令指
|
|
100
|
+
`node "{CM_WORKFLOW_ROOT}/scripts/cm-matt-skills.mjs" install`;「输出里的安装命令」指 `recommended skills install` 那一行里的命令,没有这一行就用固定命令。
|
|
101
|
+
1. 命令没跑起来、退出码非 0、或输出里没有当前运行时的 `recommended skills [claude|codex] N/M author versions` 行
|
|
102
|
+
→「无法确认作者版 `retro` 状态;可选安装:{固定命令}」。
|
|
103
|
+
2. 命令正常,再看当前运行时下有没有 `retro:` 状态行:
|
|
104
|
+
- 没有(即已装作者版)→「可运行 `/retro`(Codex `$retro`)看这一轮哪些错该交给脚本拦、哪些该写进指引」;
|
|
105
|
+
- `retro: missing` 或 `retro: same name, different content` →「未装作者版 `retro`;可选安装:{输出里的安装命令}」;
|
|
106
|
+
- `retro: cannot be read` →「无法确认作者版 `retro` 状态;可选安装:{输出里的安装命令}」。
|
|
107
|
+
只提示,不运行 `retro`,不代为安装,不读取作者技能内容;该行不影响完成状态和 `run_done`。
|
|
108
|
+
`runtime/project-learning.md` 已借鉴它「机械性错误交给脚本」的分类,`retro` 是面向整个环境的全量版本。
|
|
109
|
+
|
|
96
110
|
## 4. 输出总结
|
|
97
111
|
|
|
98
112
|
```text
|
|
@@ -103,8 +117,16 @@ staging/体验版验证。
|
|
|
103
117
|
📝 文档同步: 已完成
|
|
104
118
|
🔎 收尾核对: {按原结果附六行报告,或未完成原因/已关闭;不能据此代替 Review/QA}
|
|
105
119
|
🚀 生产发布待决清单: 已编制,等待人工决策
|
|
120
|
+
🔁 复盘: {按 3.5 的结果写一行}
|
|
106
121
|
|
|
107
122
|
各 Feature 摘要:
|
|
108
123
|
- 1.{name}: {N} 个任务 ✅ (发布验证: {staging/体验版已验证 | 未执行/待人工 | 不适用})
|
|
109
124
|
- 2.{name}: {N} 个任务 ✅ (发布验证: {staging/体验版已验证 | 未执行/待人工 | 不适用})
|
|
125
|
+
|
|
126
|
+
会话边界:换新会话。
|
|
127
|
+
新会话里运行:{下一个单任务或 feature 的 $cm-ai 入口;没有下一项时写「无,本轮已全部完成」}
|
|
128
|
+
原因:{一句话,例如「本运行记录已全部落盘,下一项是新单元」}
|
|
110
129
|
```
|
|
130
|
+
|
|
131
|
+
最后三行是会话边界结论,每次都输出,批次只在整批结束后输出。按顺序取首个命中:用户还要在本会话讨论本次结果 → 结论行改为 `会话边界:继续本会话。`;用户拒绝换会话或宿主开不了新会话 → 改为 `会话边界:留在本会话({原因})。`;其余用上面的默认三行。前两种只删「新会话里运行」那一行,保留「原因」行。JS 驾驶员还会多打一行「交接摘要:…」,一并原样放在最后。
|
|
132
|
+
判断表见 `runtime/model-efficiency.md`「Session boundary」。走 JS 驾驶员时,驾驶员在 `run_done` 后把默认三行打印到标准错误输出;默认分支原样放在回复最后,例外分支按上面规则改写。
|
|
@@ -26,7 +26,7 @@ QA 修复子操作使用原已配置 `qaFix:"manual"|"auto"`;先 fix_status
|
|
|
26
26
|
|
|
27
27
|
## 补挂 QA
|
|
28
28
|
|
|
29
|
-
**v2:** 不能靠补挂把冻结的 qa:disabled 改为 qa:run,也不能用 legacy
|
|
29
|
+
**v2:** 不能靠补挂把冻结的 qa:disabled 改为 qa:run,也不能用 legacy 权限绕开策略/配置指纹。没给 `--workflow-config` 的 v2 运行也有 `qa_assess` 判定;本修复前创建的这类运行恢复时按原样打开,仍会停在 `qa_decision_required`,只能按「卡死任务重开」用新 runId 重做。没有可用 QA 配置/执行能力时保留 qa_triggered 或具体准入阻断,报告当前缺口;本轮未提供切换策略的补挂恢复入口。下面一次性附加步骤仅用于 legacy 的原运行。
|
|
30
30
|
|
|
31
31
|
legacy:原无workflow或`qa:null`且任务已为`fixture_completed`时,可在`--mode resume`显式提供
|
|
32
32
|
含QA的`--workflow-config`与`--allow-qa`,一次性附加N6;原definition/scope/requirements/identity、
|