@aibyzero/cm-workflow 0.10.5
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 +30 -0
- package/AGENTS.md +74 -0
- package/CONTRIBUTING.md +62 -0
- package/LICENSE +21 -0
- package/README.md +263 -0
- package/SECURITY.md +49 -0
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/VERSION +1 -0
- package/agents/cm-backend-agent.md +34 -0
- package/agents/cm-contract-agent.md +34 -0
- package/agents/cm-database-agent.md +34 -0
- package/agents/cm-frontend-agent.md +33 -0
- package/agents/cm-miniprogram-agent.md +33 -0
- package/agents/cm-ui-agent.md +34 -0
- package/assets/docs/command-picker-mobile.svg +56 -0
- package/assets/docs/command-picker.svg +56 -0
- package/assets/docs/user-guide-hero-mobile.svg +35 -0
- package/assets/docs/user-guide-hero.svg +36 -0
- package/assets/readme/delivery-flow.svg +86 -0
- package/assets/readme/hero.svg +77 -0
- package/assets/readme/recovery-record.svg +73 -0
- package/assets/readme/test-evidence.svg +64 -0
- package/compat/claude-commands/cm-ai.md +3 -0
- package/compat/claude-commands/cm-check.md +3 -0
- package/compat/claude-commands/cm-fix.md +3 -0
- package/compat/claude-commands/cm-idea.md +3 -0
- package/compat/claude-commands/cm-init.md +3 -0
- package/compat/claude-commands/cm-prd.md +3 -0
- package/compat/claude-commands/cm-refactor.md +3 -0
- package/compat/claude-commands/cm-test.md +3 -0
- package/docs/architecture.md +155 -0
- package/docs/fixes/.reviews/fix-cancel-throw-T-FIX-cancel-throw-a1-handoff.json +57 -0
- package/docs/fixes/.reviews/fix-cancel-throw-T-FIX-cancel-throw-a2-handoff.json +58 -0
- package/docs/fixes/.reviews/fix-cancel-throw-T-FIX-cancel-throw-r1.md +121 -0
- package/docs/fixes/.reviews/fix-cancel-throw-v2-T-FIX-cancel-throw-v2-a1-handoff.json +56 -0
- package/docs/fixes/.reviews/fix-cancel-throw-v2-T-FIX-cancel-throw-v2-r1.md +100 -0
- package/docs/fixes/.reviews/fix-cm-js-n1n2-admission-successor-T-FIX-cm-js-n1n2-admission-successor-a1-handoff.json +61 -0
- package/docs/fixes/.reviews/fix-cm-js-n1n2-admission-successor-T-FIX-cm-js-n1n2-admission-successor-a2-handoff.json +63 -0
- package/docs/fixes/.reviews/fix-cm-js-n1n2-admission-successor-T-FIX-cm-js-n1n2-admission-successor-r1.md +58 -0
- package/docs/fixes/.reviews/fix-cm-js-n1n2-admission-successor-T-FIX-cm-js-n1n2-admission-successor-r2.md +55 -0
- package/docs/fixes/.reviews/fix-f01-dual-failure-terminal-T-FIX-f01-dual-failure-terminal-a1-handoff.json +65 -0
- package/docs/fixes/.reviews/fix-f01-dual-failure-terminal-T-FIX-f01-dual-failure-terminal-r1.md +88 -0
- package/docs/fixes/.reviews/fix-manifest-runtime-checkbox-drift-r1.md +33 -0
- package/docs/fixes/.reviews/fix-manifest-runtime-checkbox-drift-r2.md +31 -0
- package/docs/fixes/.reviews/fix-model-call-boundary-identity-T-FIX-model-call-boundary-identity-a1-handoff.json +56 -0
- package/docs/fixes/.reviews/fix-model-call-boundary-identity-T-FIX-model-call-boundary-identity-a2-handoff.json +85 -0
- package/docs/fixes/.reviews/fix-model-call-boundary-identity-T-FIX-model-call-boundary-identity-r1.md +53 -0
- package/docs/fixes/.reviews/fix-model-call-boundary-identity-T-FIX-model-call-boundary-identity-r2.md +80 -0
- package/docs/fixes/.reviews/fix-review-evidence-scope-honesty-T-FIX-review-evidence-scope-honesty-a1-handoff.json +35 -0
- package/docs/fixes/.reviews/fix-review-evidence-scope-honesty-T-FIX-review-evidence-scope-honesty-r1.md +33 -0
- package/docs/fixes/.reviews/fix-windows-cp1252-log-output-r1.md +30 -0
- package/docs/fixes/.reviews/fix-windows-cp1252-log-output-r2.md +16 -0
- package/docs/fixes/.reviews/openai-compatible-depth-fixture-T-FIX-openai-compatible-depth-fixture-a1-handoff.json +40 -0
- package/docs/fixes/.reviews/openai-compatible-depth-fixture-T-FIX-openai-compatible-depth-fixture-r1.md +30 -0
- package/docs/fixes/20260729-windows-cp1252-log-output.md +65 -0
- package/docs/fixes/20260804-manifest-runtime-checkbox-drift.md +67 -0
- package/docs/fixes/20260806-model-call-boundary-identity.md +80 -0
- package/docs/fixes/20260807-prelanding-integrity.md +58 -0
- package/docs/fixes/20260826-openai-compatible-depth-fixture.md +39 -0
- package/docs/fixes/20260903-cm-js-n1n2-admission-r1.md +64 -0
- package/docs/fixes/20260903-cm-js-n1n2-admission-successor.md +83 -0
- package/docs/fixes/20260903-s4c1b-v3-cancel-throw.md +89 -0
- package/docs/fixes/20260904-f01-codex-dual-failure-terminal.md +89 -0
- package/docs/fixes/20260907-wip-triage-log.md +44 -0
- package/docs/installation.md +202 -0
- package/docs/js-workflow-control.md +1010 -0
- package/docs/sample-prd/prd-funding-rate-alert.md +42 -0
- package/docs/sample-specs/docs//351/234/200/346/261/202/347/244/272/344/276/213.md +24 -0
- package/docs/user-guide.md +526 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/README.md +19 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.excalidraw +3650 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.mp4 +0 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.png +0 -0
- package/docs//351/207/215/346/236/204/346/265/201/347/250/213/350/256/276/350/256/241/refactor-flow.spec.json +223 -0
- package/install-codex.sh +184 -0
- package/install.ps1 +206 -0
- package/install.sh +244 -0
- package/package.json +58 -0
- package/runtime/external-expert.md +302 -0
- package/runtime/js/cm-ai/accepted-fix.mjs +28 -0
- package/runtime/js/cm-ai/claude-developer-adapter.mjs +6 -0
- package/runtime/js/cm-ai/claude-review-adapter.mjs +16 -0
- package/runtime/js/cm-ai/claude-review-stream.mjs +53 -0
- package/runtime/js/cm-ai/claude-tool-preview.mjs +107 -0
- package/runtime/js/cm-ai/cm-ai-admission.mjs +353 -0
- package/runtime/js/cm-ai/cm-ai-context-refresh.mjs +217 -0
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +538 -0
- package/runtime/js/cm-ai/cm-ai-learning-handoff-writer.mjs +119 -0
- package/runtime/js/cm-ai/cm-ai-learning-writer.mjs +172 -0
- package/runtime/js/cm-ai/cm-ai-qa-log.mjs +320 -0
- package/runtime/js/cm-ai/cm-ai-run-finalizer.mjs +107 -0
- package/runtime/js/cm-ai/code-projects.mjs +85 -0
- package/runtime/js/cm-ai/codex-config.mjs +48 -0
- package/runtime/js/cm-ai/codex-developer-adapter.mjs +5 -0
- package/runtime/js/cm-ai/codex-developer-basic-output.schema.json +6 -0
- package/runtime/js/cm-ai/codex-developer-output.schema.json +37 -0
- package/runtime/js/cm-ai/codex-review-adapter.mjs +73 -0
- package/runtime/js/cm-ai/contracts.mjs +156 -0
- package/runtime/js/cm-ai/developer-adapter.mjs +93 -0
- package/runtime/js/cm-ai/durable-runner-state.mjs +504 -0
- package/runtime/js/cm-ai/effect-contract.mjs +102 -0
- package/runtime/js/cm-ai/execution-platform.mjs +7 -0
- package/runtime/js/cm-ai/execution-store.mjs +211 -0
- package/runtime/js/cm-ai/fix-code-association.mjs +40 -0
- package/runtime/js/cm-ai/gate-bridge.mjs +25 -0
- package/runtime/js/cm-ai/host-bootstrap.mjs +170 -0
- package/runtime/js/cm-ai/host-check.mjs +89 -0
- package/runtime/js/cm-ai/host-conversation-execution.mjs +125 -0
- package/runtime/js/cm-ai/host-documentation.mjs +40 -0
- package/runtime/js/cm-ai/host-handoff.mjs +71 -0
- package/runtime/js/cm-ai/host-project-execution.mjs +58 -0
- package/runtime/js/cm-ai/host-qa-executor.mjs +238 -0
- package/runtime/js/cm-ai/host-qa-fix-owner.mjs +131 -0
- package/runtime/js/cm-ai/host-qa-fix.mjs +30 -0
- package/runtime/js/cm-ai/host-qa-policy.mjs +70 -0
- package/runtime/js/cm-ai/host-review-authority.mjs +36 -0
- package/runtime/js/cm-ai/host-review-file.mjs +56 -0
- package/runtime/js/cm-ai/host-role-routing.mjs +41 -0
- package/runtime/js/cm-ai/host-session.mjs +96 -0
- package/runtime/js/cm-ai/host-tool-bridge.mjs +53 -0
- package/runtime/js/cm-ai/host-workflow-capabilities.mjs +45 -0
- package/runtime/js/cm-ai/host.mjs +20 -0
- package/runtime/js/cm-ai/index.mjs +7 -0
- package/runtime/js/cm-ai/provider-review-observation.mjs +86 -0
- package/runtime/js/cm-ai/qa-fix-definition.mjs +21 -0
- package/runtime/js/cm-ai/review-evidence-file.mjs +38 -0
- package/runtime/js/cm-ai/review-package.mjs +426 -0
- package/runtime/js/cm-ai/review-result.schema.json +40 -0
- package/runtime/js/cm-ai/review-runner.mjs +35 -0
- package/runtime/js/cm-ai/task-commit-codec.mjs +54 -0
- package/runtime/js/cm-ai/task-commit.mjs +201 -0
- package/runtime/js/cm-ai/task-owner.mjs +97 -0
- package/runtime/js/cm-ai/task-runner.mjs +766 -0
- package/runtime/js/cm-ai/tool-preview.mjs +205 -0
- package/runtime/js/cm-ai/worker-claude.mjs +104 -0
- package/runtime/js/cm-ai/worker-codex-developer.mjs +124 -0
- package/runtime/js/cm-ai/worker-codex.mjs +143 -0
- package/runtime/js/cm-check/host.mjs +101 -0
- package/runtime/js/cm-fix/baseline.mjs +70 -0
- package/runtime/js/cm-fix/cause-evidence.mjs +24 -0
- package/runtime/js/cm-fix/cause-invocation.mjs +40 -0
- package/runtime/js/cm-fix/cause-package.mjs +68 -0
- package/runtime/js/cm-fix/dossier.mjs +140 -0
- package/runtime/js/cm-fix/execution.mjs +1549 -0
- package/runtime/js/cm-fix/final-review-evidence.mjs +20 -0
- package/runtime/js/cm-fix/final-review.mjs +156 -0
- package/runtime/js/cm-fix/finish.mjs +124 -0
- package/runtime/js/cm-fix/handoff.mjs +64 -0
- package/runtime/js/cm-fix/host-review.mjs +38 -0
- package/runtime/js/cm-fix/host.mjs +96 -0
- package/runtime/js/cm-fix/investigation.mjs +25 -0
- package/runtime/js/cm-fix/layout.mjs +17 -0
- package/runtime/js/cm-fix/learning-writeback.mjs +86 -0
- package/runtime/js/cm-fix/learning.mjs +31 -0
- package/runtime/js/cm-fix/metrics.mjs +75 -0
- package/runtime/js/cm-fix/progress.mjs +64 -0
- package/runtime/js/cm-fix/protected-edits.mjs +95 -0
- package/runtime/js/cm-fix/qa-source.mjs +58 -0
- package/runtime/js/cm-fix/red-test.mjs +92 -0
- package/runtime/js/cm-fix/regression-evidence.mjs +64 -0
- package/runtime/js/cm-fix/regression.mjs +41 -0
- package/runtime/js/cm-fix/repair.mjs +95 -0
- package/runtime/js/cm-fix/reproduce.mjs +54 -0
- package/runtime/js/cm-fix/retrospective.mjs +41 -0
- package/runtime/js/cm-fix/review-baseline.mjs +47 -0
- package/runtime/js/cm-fix/start.mjs +49 -0
- package/runtime/js/cm-fix/test-author.mjs +63 -0
- package/runtime/js/cm-fix/visual.mjs +72 -0
- package/runtime/js/cm-fix/walkthrough.mjs +126 -0
- package/runtime/js/cm-idea/session.mjs +79 -0
- package/runtime/js/cm-init/draft-generation.mjs +66 -0
- package/runtime/js/cm-init/draft-inspection.mjs +70 -0
- package/runtime/js/cm-init/project-analysis.mjs +60 -0
- package/runtime/js/cm-init/project-scan.mjs +55 -0
- package/runtime/js/cm-init/review-evidence.mjs +80 -0
- package/runtime/js/cm-prd/accepted-design.mjs +46 -0
- package/runtime/js/cm-prd/analysis.mjs +260 -0
- package/runtime/js/cm-prd/change.mjs +268 -0
- package/runtime/js/cm-prd/correction-check.mjs +49 -0
- package/runtime/js/cm-prd/design-risk.mjs +30 -0
- package/runtime/js/cm-prd/disposition-plan.mjs +33 -0
- package/runtime/js/cm-prd/draft-save.mjs +122 -0
- package/runtime/js/cm-prd/draft.mjs +70 -0
- package/runtime/js/cm-prd/materials.mjs +48 -0
- package/runtime/js/cm-prd/review-correction.mjs +158 -0
- package/runtime/js/cm-prd/review-disposition.mjs +96 -0
- package/runtime/js/cm-prd/review-findings.mjs +36 -0
- package/runtime/js/cm-prd/review-host.mjs +48 -0
- package/runtime/js/cm-prd/review-preparation.mjs +49 -0
- package/runtime/js/cm-prd/review-publication.mjs +56 -0
- package/runtime/js/cm-prd/self-check.mjs +75 -0
- package/runtime/js/cm-prd/session.mjs +74 -0
- package/runtime/js/cm-prd/summary.mjs +133 -0
- package/runtime/js/cm-refactor/host.mjs +2 -0
- package/runtime/js/cm-refactor/records.mjs +86 -0
- package/runtime/js/cm-refactor/workflow.mjs +478 -0
- package/runtime/js/cm-test/declared-command.mjs +32 -0
- package/runtime/js/cm-test/host.mjs +319 -0
- package/runtime/js/cm-test/logic-results.mjs +39 -0
- package/runtime/js/cm-test/recovery.mjs +58 -0
- package/runtime/js/cm-test/session.mjs +56 -0
- package/runtime/js/cm-test/source-snapshot.mjs +136 -0
- package/runtime/logging.md +207 -0
- package/runtime/model-efficiency.md +201 -0
- package/runtime/orchestration.md +113 -0
- package/runtime/project-context.md +43 -0
- package/runtime/project-learning.md +49 -0
- package/runtime/review.md +140 -0
- package/runtime/steelman-review.md +111 -0
- package/runtime/task-gates.md +283 -0
- package/runtime/task-handoff.schema.json +103 -0
- package/runtime/test-contract.md +212 -0
- package/runtime/workflow-config.md +118 -0
- package/runtime/workflow-routing.md +82 -0
- package/scripts/cm-ai-admission.mjs +50 -0
- package/scripts/cm-ai-admission.test.mjs +38 -0
- package/scripts/cm-ai-batch-host.mjs +77 -0
- package/scripts/cm-ai-batch-host.test.mjs +155 -0
- package/scripts/cm-ai-batch-run.mjs +136 -0
- package/scripts/cm-ai-batch-run.test.mjs +128 -0
- package/scripts/cm-ai-bootstrap.test.mjs +228 -0
- package/scripts/cm-ai-fix-integration.test.mjs +233 -0
- package/scripts/cm-ai-host.mjs +175 -0
- package/scripts/cm-ai-host.test.mjs +368 -0
- package/scripts/cm-ai-multi-root.test.mjs +289 -0
- package/scripts/cm-ai-nested-execution.test.mjs +313 -0
- package/scripts/cm-ai-run.mjs +293 -0
- package/scripts/cm-ai-run.test.mjs +336 -0
- package/scripts/cm-check-entry.mjs +120 -0
- package/scripts/cm-check-host.mjs +29 -0
- package/scripts/cm-check-host.test.mjs +71 -0
- package/scripts/cm-check-runtime.ps1 +69 -0
- package/scripts/cm-check-runtime.sh +910 -0
- package/scripts/cm-claude-probe.test.mjs +54 -0
- package/scripts/cm-claude-review-stream.test.mjs +45 -0
- package/scripts/cm-claude-worker.test.mjs +92 -0
- package/scripts/cm-codex-developer-adapter.test.mjs +85 -0
- package/scripts/cm-codex-developer-worker.test.mjs +128 -0
- package/scripts/cm-codex-review-progress.test.mjs +96 -0
- package/scripts/cm-execution-platform.test.mjs +47 -0
- package/scripts/cm-fix-cause-invocation.test.mjs +72 -0
- package/scripts/cm-fix-cause-package.test.mjs +68 -0
- package/scripts/cm-fix-code-association.test.mjs +55 -0
- package/scripts/cm-fix-entry.mjs +132 -0
- package/scripts/cm-fix-execution.test.mjs +63 -0
- package/scripts/cm-fix-final-review.test.mjs +124 -0
- package/scripts/cm-fix-host-review-assembly.test.mjs +34 -0
- package/scripts/cm-fix-host-review.test.mjs +261 -0
- package/scripts/cm-fix-host-sequence.test.mjs +26 -0
- package/scripts/cm-fix-host.mjs +89 -0
- package/scripts/cm-fix-host.test.mjs +105 -0
- package/scripts/cm-fix-learning-writeback.test.mjs +73 -0
- package/scripts/cm-fix-learning.test.mjs +66 -0
- package/scripts/cm-fix-metrics.test.mjs +58 -0
- package/scripts/cm-fix-no-existing-tests.test.mjs +92 -0
- package/scripts/cm-fix-observation-dossier.test.mjs +452 -0
- package/scripts/cm-fix-progress.test.mjs +45 -0
- package/scripts/cm-fix-protected-edits.test.mjs +54 -0
- package/scripts/cm-fix-qa-source.test.mjs +206 -0
- package/scripts/cm-fix-red-owner.test.mjs +143 -0
- package/scripts/cm-fix-red-test.test.mjs +38 -0
- package/scripts/cm-fix-regression.test.mjs +57 -0
- package/scripts/cm-fix-repair-owner.test.mjs +370 -0
- package/scripts/cm-fix-repair.test.mjs +68 -0
- package/scripts/cm-fix-reproduce.test.mjs +31 -0
- package/scripts/cm-fix-retrospective.test.mjs +46 -0
- package/scripts/cm-fix-review-baseline.test.mjs +54 -0
- package/scripts/cm-fix-review-recovery.test.mjs +197 -0
- package/scripts/cm-fix-test-author.test.mjs +105 -0
- package/scripts/cm-fix-visual-bare.test.mjs +171 -0
- package/scripts/cm-fix-walkthrough.test.mjs +45 -0
- package/scripts/cm-host-check.test.mjs +113 -0
- package/scripts/cm-host-documentation.test.mjs +45 -0
- package/scripts/cm-host-handoff.test.mjs +58 -0
- package/scripts/cm-host-qa-executor.test.mjs +156 -0
- package/scripts/cm-host-qa-policy.test.mjs +59 -0
- package/scripts/cm-host-review-authority.test.mjs +60 -0
- package/scripts/cm-host-role-routing.test.mjs +33 -0
- package/scripts/cm-idea-entry.mjs +104 -0
- package/scripts/cm-idea-host.mjs +144 -0
- package/scripts/cm-idea-host.test.mjs +75 -0
- package/scripts/cm-idea-recovery.test.mjs +90 -0
- package/scripts/cm-init-analysis-host.test.mjs +50 -0
- package/scripts/cm-init-draft-generation.test.mjs +52 -0
- package/scripts/cm-init-draft-inspection.test.mjs +41 -0
- package/scripts/cm-init-entry.mjs +170 -0
- package/scripts/cm-init-host.mjs +284 -0
- package/scripts/cm-init-host.test.mjs +231 -0
- package/scripts/cm-init-project-analysis.test.mjs +47 -0
- package/scripts/cm-init-project-scan.test.mjs +41 -0
- package/scripts/cm-init-revision-host.test.mjs +61 -0
- package/scripts/cm-init-session.test.mjs +122 -0
- package/scripts/cm-log-event.mjs +538 -0
- package/scripts/cm-log-event.py +133 -0
- package/scripts/cm-log-event.test.mjs +70 -0
- package/scripts/cm-openai-compatible-call.py +661 -0
- package/scripts/cm-prd-analysis.test.mjs +67 -0
- package/scripts/cm-prd-completion.test.mjs +190 -0
- package/scripts/cm-prd-design-phase.test.mjs +296 -0
- package/scripts/cm-prd-draft-save.test.mjs +63 -0
- package/scripts/cm-prd-draft.test.mjs +39 -0
- package/scripts/cm-prd-entry.mjs +245 -0
- package/scripts/cm-prd-host.mjs +273 -0
- package/scripts/cm-prd-host.test.mjs +169 -0
- package/scripts/cm-prd-materials.test.mjs +41 -0
- package/scripts/cm-prd-review-claim.test.mjs +42 -0
- package/scripts/cm-prd-review-disposition.test.mjs +196 -0
- package/scripts/cm-prd-review-gate.mjs +194 -0
- package/scripts/cm-prd-review-gate.py +26 -0
- package/scripts/cm-prd-review-host.test.mjs +30 -0
- package/scripts/cm-prd-review-preparation.test.mjs +69 -0
- package/scripts/cm-prd-review-publication.test.mjs +95 -0
- package/scripts/cm-prd-revision.test.mjs +32 -0
- package/scripts/cm-prd-self-check.test.mjs +23 -0
- package/scripts/cm-prd-sources.test.mjs +76 -0
- package/scripts/cm-prd-timing.py +272 -0
- package/scripts/cm-refactor-entry.mjs +145 -0
- package/scripts/cm-refactor-host.mjs +26 -0
- package/scripts/cm-refactor-host.test.mjs +201 -0
- package/scripts/cm-review-dependency-snapshot.test.mjs +67 -0
- package/scripts/cm-review-inventory.test.mjs +109 -0
- package/scripts/cm-spec-manifest.mjs +104 -0
- package/scripts/cm-spec-manifest.py +26 -0
- package/scripts/cm-task-gate.mjs +879 -0
- package/scripts/cm-task-gate.py +312 -0
- package/scripts/cm-task-gate.test.mjs +202 -0
- package/scripts/cm-test-declared-command.test.mjs +18 -0
- package/scripts/cm-test-entry.mjs +231 -0
- package/scripts/cm-test-host.mjs +40 -0
- package/scripts/cm-test-host.test.mjs +169 -0
- package/scripts/cm-test-logic-results.test.mjs +26 -0
- package/scripts/cm-test-session.test.mjs +138 -0
- package/scripts/cm-usage-report.py +516 -0
- package/scripts/cm-workflow-config.mjs +463 -0
- package/scripts/cm-workflow-config.test.mjs +181 -0
- package/scripts/cm-workflow.mjs +36 -0
- package/scripts/cm-workflow.test.mjs +51 -0
- package/scripts/cm_workflow_config.py +52 -0
- package/scripts/fixtures/claude-review-process.mjs +35 -0
- package/scripts/fixtures/codex-review-process.mjs +22 -0
- package/scripts/fixtures/prd-review-gate-python-oracle.py +320 -0
- package/scripts/fixtures/spec-manifest-python-oracle.py +172 -0
- package/scripts/scan-public-safety.py +117 -0
- package/scripts/test-cm-log-event.py +1213 -0
- package/scripts/test-cm-openai-compatible-call.py +1185 -0
- package/scripts/test-cm-prd-review-gate.py +272 -0
- package/scripts/test-cm-prd-timing.py +168 -0
- package/scripts/test-cm-usage-report.py +584 -0
- package/scripts/test-npm-install.py +171 -0
- package/scripts/test-scan-public-safety.py +76 -0
- package/scripts/test-shell-compat.sh +365 -0
- package/scripts/test-spec-manifest.py +263 -0
- package/scripts/test-task-gate.py +46 -0
- package/scripts/test-workflow-config.py +30 -0
- package/scripts/validate-public-repo.py +245 -0
- package/scripts/validate-test-cases.mjs +71 -0
- package/scripts/validate-test-cases.py +27 -0
- package/scripts/validate-test-cases.test.mjs +36 -0
- package/skills/cm-ai/SKILL.md +137 -0
- package/skills/cm-ai/references/N1-init.md +108 -0
- package/skills/cm-ai/references/N2-enter-feature.md +38 -0
- package/skills/cm-ai/references/N3-execute-task.md +123 -0
- package/skills/cm-ai/references/N4-review.md +103 -0
- package/skills/cm-ai/references/N5-mark-done.md +117 -0
- package/skills/cm-ai/references/N6-qa-eval.md +102 -0
- package/skills/cm-ai/references/N7-context.md +23 -0
- package/skills/cm-ai/references/N8-finish.md +103 -0
- package/skills/cm-ai/references/js-host.md +126 -0
- package/skills/cm-backend-engineer/SKILL.md +100 -0
- package/skills/cm-check/SKILL.md +52 -0
- package/skills/cm-check/references/js-host.md +44 -0
- package/skills/cm-contract-engineer/SKILL.md +136 -0
- package/skills/cm-database-engineer/SKILL.md +89 -0
- package/skills/cm-devops-engineer/SKILL.md +137 -0
- package/skills/cm-doc-syncer/SKILL.md +150 -0
- package/skills/cm-finance-expert/SKILL.md +85 -0
- package/skills/cm-fix/SKILL.md +199 -0
- package/skills/cm-fix/references/cross-boundary-debugging.md +44 -0
- package/skills/cm-fix/references/js-host.md +135 -0
- package/skills/cm-frontend-engineer/SKILL.md +127 -0
- package/skills/cm-idea/SKILL.md +55 -0
- package/skills/cm-idea/references/domains/trading.md +97 -0
- package/skills/cm-idea/references/example-prd.md +92 -0
- package/skills/cm-idea/references/idea-to-prd.md +282 -0
- package/skills/cm-idea/references/js-host.md +63 -0
- package/skills/cm-init/SKILL.md +191 -0
- package/skills/cm-init/references/js-host.md +123 -0
- package/skills/cm-miniprogram-engineer/SKILL.md +141 -0
- package/skills/cm-miniprogram-engineer/references/platform-readiness.md +58 -0
- package/skills/cm-miniprogram-engineer/references/release-checklist.md +59 -0
- package/skills/cm-prd/SKILL.md +548 -0
- package/skills/cm-prd/references/brownfield.md +13 -0
- package/skills/cm-prd/references/change-mode.md +145 -0
- package/skills/cm-prd/references/context-scope.md +62 -0
- package/skills/cm-prd/references/greenfield.md +80 -0
- package/skills/cm-prd/references/js-change-recovery.md +57 -0
- package/skills/cm-prd/references/js-host.md +98 -0
- package/skills/cm-prd/references/phase-timing.md +68 -0
- package/skills/cm-prd/references/spec-self-check.md +22 -0
- package/skills/cm-product-manager/SKILL.md +83 -0
- package/skills/cm-qa-engineer/SKILL.md +142 -0
- package/skills/cm-refactor/SKILL.md +236 -0
- package/skills/cm-refactor/references/js-batch.md +75 -0
- package/skills/cm-refactor/references/js-host.md +78 -0
- package/skills/cm-test/SKILL.md +288 -0
- package/skills/cm-test/references/js-host.md +118 -0
- package/skills/cm-ui-engineer/SKILL.md +105 -0
- package/skills/codebase-context/SKILL.md +489 -0
- package/skills/darwin-skill/NOTICE.md +26 -0
- package/skills/darwin-skill/README.md +272 -0
- package/skills/darwin-skill/SKILL.md +492 -0
- package/skills/darwin-skill/references/runtime-neutrality.md +68 -0
- package/skills/darwin-skill/references/skilllens-evidence.md +142 -0
- package/skills/darwin-skill/scripts/screenshot.mjs +71 -0
- package/skills/darwin-skill/templates/result-card-dark.html +698 -0
- package/skills/darwin-skill/templates/result-card-white.html +444 -0
- package/skills/darwin-skill/templates/result-card.html +616 -0
- package/skills/external-expert/SKILL.md +250 -0
- package/templates/arch-reference.md +68 -0
- package/templates/auto-update/cm-announce.sh +19 -0
- package/templates/auto-update/cm-update.sh +274 -0
- package/templates/cm-workflow.yml +52 -0
- package/templates/dashboard/dashboard.html +153 -0
- package/templates/dashboard/serve.sh +10 -0
- package/templates/hooks/pre-commit-cm-task-check +67 -0
- package/templates/pixel/cm-pixel.html +388 -0
- package/templates/pixel/cm-pixel.sh +212 -0
- package/templates/pixel/dev/README.md +20 -0
- package/templates/pixel/dev/atlas-preview.png +0 -0
- package/templates/pixel/dev/build.py +55 -0
- package/templates/pixel/dev/sheets/roguelikeChar_transparent.png +0 -0
- package/templates/pixel/dev/sheets/roguelikeCity_tilemap.png +0 -0
- package/templates/pixel/dev/sheets/roguelikeIndoor_transparent.png +0 -0
- package/templates/pixel/dev/template.html +388 -0
- package/templates/pixel/serve.sh +12 -0
- package/templates/refactor/cm-refactor-denies.json +14 -0
- package/templates/rules/backend-api.md +36 -0
- package/templates/rules/coding-style.md +44 -0
- package/templates/rules/database.md +27 -0
- package/templates/rules/finance.md +32 -0
- package/templates/rules/frontend.md +32 -0
- package/templates/rules/git-workflow.md +25 -0
- package/templates/rules/miniprogram.md +31 -0
- package/templates/rules/security.md +31 -0
- package/templates/rules/smart-contract.md +28 -0
- package/templates/rules/testing.md +36 -0
- package/templates/statusline/cm-statusline.sh +73 -0
- package/templates/ui-lens/cm-ui-lens-extract.mjs +55 -0
|
@@ -0,0 +1,66 @@
|
|
|
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 {createFixLearningPreparation} from '../runtime/js/cm-fix/learning.mjs';
|
|
7
|
+
import {openFixExecution} from '../runtime/js/cm-fix/execution.mjs';
|
|
8
|
+
import {createHostToolBridge} from '../runtime/js/cm-ai/host-tool-bridge.mjs';
|
|
9
|
+
|
|
10
|
+
test('fix learning rereads nested instructions on resume and preserves reproduction history',async()=>{
|
|
11
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'fix-learning-')));
|
|
12
|
+
const cwd=path.join(root,'code'),specsRoot=path.join(root,'specs');fs.mkdirSync(cwd);fs.mkdirSync(specsRoot);
|
|
13
|
+
fs.mkdirSync(path.join(cwd,'src'));fs.writeFileSync(path.join(cwd,'src','AGENTS.md'),'First instruction');
|
|
14
|
+
const identity={repositoryId:'fixture',runId:'learning-run',taskId:'T-FIX-learning',attempt:1};
|
|
15
|
+
const options={specsRoot,identity,create:true,configuration:{hostContextId:'fixture-host',defect:'Synthetic',applicableAgentFiles:['src/AGENTS.md'],
|
|
16
|
+
reproduction:{cwd,command:[process.execPath,'-e',"require('node:fs').appendFileSync('visits','1');process.stderr.write('BUG');process.exit(3)"],
|
|
17
|
+
expectedFailure:{exitCode:3,outputIncludes:'BUG'},timeoutMs:2000}}};
|
|
18
|
+
const seen=[];const bridge={async call(kind,payload){
|
|
19
|
+
assert.equal(kind,'fix_learning');seen.push(payload.context);
|
|
20
|
+
return {contextDigest:payload.contextDigest,status:'applied',summary:'src/AGENTS.md: preserve exact reproduction evidence'};
|
|
21
|
+
}};
|
|
22
|
+
const prepare=createFixLearningPreparation({bridge,codeProject:cwd,applicableAgentFiles:['src/AGENTS.md']});
|
|
23
|
+
let owner;
|
|
24
|
+
try{
|
|
25
|
+
owner=openFixExecution(options,{prepare});assert.equal((await owner.advance({authorized:true})).stage,'diagnose');
|
|
26
|
+
const before=owner.status().learning.contextDigest;owner.close();
|
|
27
|
+
owner=null;
|
|
28
|
+
assert.throws(()=>openFixExecution({...options,create:false,configuration:{...options.configuration,applicableAgentFiles:[]}}),
|
|
29
|
+
{code:'fingerprint_mismatch'});
|
|
30
|
+
fs.writeFileSync(path.join(cwd,'src','AGENTS.md'),'Second instruction');
|
|
31
|
+
// A diagnosis bridge is supplied only now, so the recovered pending stage can proceed.
|
|
32
|
+
const diagnosisBridge={async call(){return {status:'needs_evidence',rootCause:'Need more evidence',
|
|
33
|
+
affectedPaths:['src/value.mjs'],affectedModules:['src'],plan:'Observe next failure',crossLayer:false};}};
|
|
34
|
+
owner=openFixExecution({...options,create:false},{prepare,bridge:diagnosisBridge});
|
|
35
|
+
assert.equal((await owner.advance({authorized:true})).stage,'observation');
|
|
36
|
+
const observed=owner.publishDossier();assert.equal(observed.stage,'observation');assert.equal(observed.completionEligible,false);
|
|
37
|
+
assert.match(fs.readFileSync(observed.dossier.path,'utf8'),/Observe next failure/);
|
|
38
|
+
assert.match(fs.readFileSync(observed.dossier.path,'utf8'),/needs_evidence/);
|
|
39
|
+
assert.notEqual(owner.status().learning.contextDigest,before);
|
|
40
|
+
assert.equal(seen[1][0].content,'Second instruction');
|
|
41
|
+
assert.equal(fs.readFileSync(path.join(cwd,'visits'),'utf8'),'1');
|
|
42
|
+
owner.close();owner=null;
|
|
43
|
+
const unanswered=createHostToolBridge();unanswered.attach(()=>{});
|
|
44
|
+
owner=openFixExecution({...options,identity:{...identity,runId:'learning-timeout'},configuration:{...options.configuration,
|
|
45
|
+
reproduction:{...options.configuration.reproduction,timeoutMs:25}}},
|
|
46
|
+
{prepare:createFixLearningPreparation({bridge:unanswered,codeProject:cwd,applicableAgentFiles:['src/AGENTS.md']})});
|
|
47
|
+
try{
|
|
48
|
+
await assert.rejects(owner.advance({authorized:true}),{code:'fix_learning_interrupted'});
|
|
49
|
+
assert.equal(owner.status().stage,'reproduce');
|
|
50
|
+
assert.equal(fs.readFileSync(path.join(cwd,'visits'),'utf8'),'1');
|
|
51
|
+
}finally{unanswered.close();}
|
|
52
|
+
owner.close();owner=null;
|
|
53
|
+
const mutate={async call(kind,payload){fs.writeFileSync(path.join(cwd,'src','AGENTS.md'),'Changed while reading');
|
|
54
|
+
return {contextDigest:payload.contextDigest,status:'no_relevant_lesson',summary:'No relevant lesson'};}};
|
|
55
|
+
await assert.rejects(createFixLearningPreparation({bridge:mutate,codeProject:cwd,applicableAgentFiles:['src/AGENTS.md']})
|
|
56
|
+
({identity,defect:'Synthetic'},new AbortController().signal),{code:'fix_learning_context_changed'});
|
|
57
|
+
const fresh={...options,identity:{...identity,runId:'learning-failed'}};
|
|
58
|
+
owner=openFixExecution(fresh,{prepare:createFixLearningPreparation({bridge:{async call(kind,payload){
|
|
59
|
+
fs.writeFileSync(path.join(cwd,'src','AGENTS.md'),'Concurrent change during owner preparation');
|
|
60
|
+
return {contextDigest:payload.contextDigest,status:'no_relevant_lesson',summary:'No relevant lesson'};
|
|
61
|
+
}},codeProject:cwd,applicableAgentFiles:['src/AGENTS.md']})});
|
|
62
|
+
await assert.rejects(owner.advance({authorized:true}),{code:'fix_learning_context_changed'});
|
|
63
|
+
assert.equal(owner.status().stage,'reproduce');assert.equal(owner.status().learning,null);
|
|
64
|
+
assert.equal(fs.readFileSync(path.join(cwd,'visits'),'utf8'),'1');
|
|
65
|
+
}finally{owner?.close();fs.rmSync(root,{recursive:true,force:true});}
|
|
66
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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 {createHash} from 'node:crypto';
|
|
7
|
+
import {appendFixMetrics,fixMetricsRow} from '../runtime/js/cm-fix/metrics.mjs';
|
|
8
|
+
import {fixCompletionProjection} from '../runtime/js/cm-fix/finish.mjs';
|
|
9
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
10
|
+
|
|
11
|
+
test('FIX metrics projects completed log evidence, preserves content, deduplicates and rejects conflicts',async()=>{
|
|
12
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'fix-metrics-')));
|
|
13
|
+
try{
|
|
14
|
+
fs.mkdirSync(path.join(root,'fixes'));
|
|
15
|
+
const dossierFile='20260907-value.md',body='Synthetic completed dossier, fixture only.\n';
|
|
16
|
+
fs.writeFileSync(path.join(root,'fixes',dossierFile),body);
|
|
17
|
+
const identity={repositoryId:'fixture',runId:'metrics-run',taskId:'T-FIX-value',attempt:1};
|
|
18
|
+
const common={workflow:'cm-fix',node:'FIX',repository_id:identity.repositoryId,run_id:identity.runId,task:identity.taskId,attempt:1};
|
|
19
|
+
const events=[{...common,event:'task_start',at:'2026-09-07T01:00:00Z',event_id:'start'},
|
|
20
|
+
{...common,event:'review',phase:'complete',review_kind:'implementation',round:1,result:'approved',finding_count:0,package_digest:'a'.repeat(64),event_id:'review'},
|
|
21
|
+
{...common,event:'task_done',at:'2026-09-07T01:01:00Z',event_id:'done',result:'completed',dossier_file:`fixes/${dossierFile}`,
|
|
22
|
+
dossier_sha256:createHash('sha256').update(body).digest('hex'),package_digest:'a'.repeat(64),walkthrough_result:'passed'}];
|
|
23
|
+
assert.throws(()=>fixMetricsRow({events:events.slice(0,-1),identity,dossierFile}),{code:'metrics_completion_required'});
|
|
24
|
+
assert.throws(()=>fixMetricsRow({events:[events[0],{...events[1],attempt:2},events[2]],identity,dossierFile}),{code:'metrics_review_required'});
|
|
25
|
+
const second=[events[0],{...events[1],result:'changes_requested',finding_count:2},
|
|
26
|
+
{...events[0],attempt:2,event_id:'start-two',at:'2026-09-07T01:00:30Z'},
|
|
27
|
+
{...events[1],attempt:2,round:2,event_id:'review-two'}, {...events[2],attempt:2}];
|
|
28
|
+
assert.match(fixMetricsRow({events:second,identity:{...identity,attempt:2},dossierFile}).line,/\| 2 \| 2 \| PASS \|/);
|
|
29
|
+
fs.writeFileSync(path.join(root,'运行日志.jsonl'),events.map(row=>JSON.stringify(row)).join('\n')+'\n');
|
|
30
|
+
const header='| 任务 | Feature | 开始 | 结束 | 审查轮次 | 独立审查拦截 | QA | 人工介入(次:原因) |';
|
|
31
|
+
const existing=`User notes stay.\n\n${header}\n| --- | --- | --- | --- | --- | --- | --- | --- |\n| T-other | other | a | b | 1 | 0 | — | 0 |\n`;
|
|
32
|
+
fs.writeFileSync(path.join(root,'METRICS.md'),existing);let checks=0;
|
|
33
|
+
const options={specsRoot:root,identity,dossierFile},control={assertOwned(){checks++;}};
|
|
34
|
+
assert.throws(()=>appendFixMetrics(options,{async assertOwned(){throw new Error('async denial');}}),{code:'metrics_owner_required'});
|
|
35
|
+
await new Promise(resolve=>setImmediate(resolve));assert.equal(fs.readFileSync(path.join(root,'METRICS.md'),'utf8'),existing);
|
|
36
|
+
const written=appendFixMetrics(options,control);assert.equal(written.deduplicated,false);
|
|
37
|
+
const bytes=fs.readFileSync(written.path,'utf8');assert(bytes.startsWith(existing));assert.match(bytes,/未知:未记录完整人工介入/);assert(checks>=3);
|
|
38
|
+
assert.equal(appendFixMetrics(options,control).deduplicated,true);assert.equal(fs.readFileSync(written.path,'utf8'),bytes);
|
|
39
|
+
const status={stage:'closeout_required',completionEligible:false,handoffEvidenceCoverage:'defect_and_learning',
|
|
40
|
+
walkthrough:{status:'passed'},diagnosis:{crossLayer:false,investigation:{}},retrospective:{content:{candidates:[]}},n5:{packageDigest:'a'.repeat(64)}};
|
|
41
|
+
const observing={...common,event:'run_done',phase:'observation',result:'observing',event_id:'observing'};
|
|
42
|
+
const completed={...common,event:'run_done',result:'completed',event_id:'completed',completion_event_id:'done',
|
|
43
|
+
metrics_row_digest:digest(written.line),package_digest:'a'.repeat(64)};
|
|
44
|
+
const project=rows=>{fs.writeFileSync(path.join(root,'运行日志.jsonl'),rows.map(row=>JSON.stringify(row)).join('\n')+'\n');return fixCompletionProjection({specsRoot:root,identity,status});};
|
|
45
|
+
assert.deepEqual(project([events[0],observing]),status); // observation alone is not completion history
|
|
46
|
+
assert.equal(project([events[0],observing,...events.slice(1)]).stage,'closeout_incomplete');
|
|
47
|
+
const projected=project([events[0],observing,...events.slice(1),completed]);
|
|
48
|
+
assert.equal(projected.stage,'completed');assert.equal(projected.completionEligible,true);
|
|
49
|
+
assert.deepEqual(projected.completionHistory.runDoneEventIds,['completed']);
|
|
50
|
+
assert.equal(project([events[0],{...observing,result:'completed'},...events.slice(1),completed]).stage,'closeout_incomplete');
|
|
51
|
+
assert.equal(project([events[0],{...observing,phase:'other'},...events.slice(1),completed]).stage,'closeout_incomplete');
|
|
52
|
+
project(events);
|
|
53
|
+
fs.appendFileSync(written.path,written.line+'\n');assert.throws(()=>appendFixMetrics(options,control),{code:'metrics_row_conflict'});
|
|
54
|
+
fs.unlinkSync(written.path);const created=appendFixMetrics(options,control);assert(fs.readFileSync(created.path,'utf8').startsWith(header));
|
|
55
|
+
fs.unlinkSync(written.path);fs.symlinkSync(path.join(root,'fixes',dossierFile),written.path);
|
|
56
|
+
assert.throws(()=>appendFixMetrics(options,control));assert.equal(fs.readFileSync(path.join(root,'fixes',dossierFile),'utf8'),body);
|
|
57
|
+
}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
58
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
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 {openFixExecution} from '../runtime/js/cm-fix/execution.mjs';
|
|
7
|
+
import {createFixBaseline,inspectFixBaseline} from '../runtime/js/cm-fix/baseline.mjs';
|
|
8
|
+
import {createFixRegression} from '../runtime/js/cm-fix/regression.mjs';
|
|
9
|
+
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
10
|
+
|
|
11
|
+
const identity={repositoryId:'fixture',runId:'no-existing-tests',taskId:'T-FIX-value',attempt:1};
|
|
12
|
+
const control={authorized:true,signal:new AbortController().signal};
|
|
13
|
+
|
|
14
|
+
test('no old tests uses actual red/repair/green, persists declaration and reaches original independent review gate',async()=>{
|
|
15
|
+
const root=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'fix-no-tests-')));
|
|
16
|
+
const cwd=path.join(root,'code'),specsRoot=path.join(root,'specs');fs.mkdirSync(cwd);fs.mkdirSync(specsRoot);
|
|
17
|
+
fs.writeFileSync(path.join(cwd,'value.mjs'),'export const value=1;');
|
|
18
|
+
fs.writeFileSync(path.join(cwd,'red.mjs'),"import {value} from './value.mjs';if(value!==2){console.error('BUG');process.exit(1)}");
|
|
19
|
+
const redTest={cwd,testFiles:['red.mjs'],command:[process.execPath,'red.mjs'],expectedFailure:{exitCode:1,outputIncludes:'BUG'},timeoutMs:2000};
|
|
20
|
+
const baseline={cwd,testFiles:[],commands:[],timeoutMs:2000,noExistingTests:'Host inspected project; red.mjs is the first regression test.'};
|
|
21
|
+
const configuration={hostContextId:'fixture-host',defect:'Wrong value',reproduction:{cwd,command:redTest.command,
|
|
22
|
+
expectedFailure:redTest.expectedFailure,timeoutMs:2000},redTest,baseline,repair:{scope:['value.mjs'],requirements:['value.mjs']}};
|
|
23
|
+
const options={specsRoot,identity,configuration,create:true};let owner,writes=0,calls=0;
|
|
24
|
+
const bridge={call:async kind=>{
|
|
25
|
+
calls++;
|
|
26
|
+
if(kind==='fix_diagnose')return {status:'diagnosed',rootCause:'Wrong constant',affectedPaths:['value.mjs'],
|
|
27
|
+
plan:'Correct constant',crossLayer:false,affectedModules:['value']};
|
|
28
|
+
if(kind==='fix_repair'){writes++;fs.writeFileSync(path.join(cwd,'value.mjs'),'export const value=2;');return {outcome:'repaired'};}
|
|
29
|
+
if(kind==='fix_retrospective')return {status:'no_new_lesson',candidates:[],reason:null};
|
|
30
|
+
assert.fail(`Unexpected host request: ${kind}`);
|
|
31
|
+
}};
|
|
32
|
+
const prepare=async()=>({contextDigest:digest([]),files:[],application:{contextDigest:digest([]),
|
|
33
|
+
status:'no_relevant_lesson',summary:'Synthetic empty instruction context'}});
|
|
34
|
+
const dependencies={bridge,prepare,assertReviewReady(){}};
|
|
35
|
+
try{
|
|
36
|
+
owner=openFixExecution(options,dependencies);
|
|
37
|
+
assert.equal((await owner.advance(control)).stage,'red_test_required');
|
|
38
|
+
assert.equal((await owner.runRedTest(control)).stage,'baseline_required');
|
|
39
|
+
await assert.rejects(owner.captureBaseline(),{code:'baseline_authorization_required'});
|
|
40
|
+
const captured=await owner.captureBaseline(control);
|
|
41
|
+
assert.equal(captured.stage,'repair_required');assert.deepEqual(captured.baseline.observations,[]);
|
|
42
|
+
assert.equal(captured.baseline.noExistingTests,baseline.noExistingTests);
|
|
43
|
+
owner.close();owner=openFixExecution({...options,create:false},dependencies);
|
|
44
|
+
assert.deepEqual(owner.status().baseline,captured.baseline);
|
|
45
|
+
assert.deepEqual((await owner.captureBaseline(control)).baseline,captured.baseline);
|
|
46
|
+
assert.equal((await owner.repair(control)).stage,'regression_required');assert.equal(writes,1);
|
|
47
|
+
const repaired=await owner.runRegression(control);assert.equal(repaired.stage,'handoff_required');
|
|
48
|
+
assert.equal(repaired.regression.red.outcome,'passed');
|
|
49
|
+
assert.deepEqual(repaired.regression.comparison.comparisons,[]);
|
|
50
|
+
assert.equal((await owner.retrospect()).stage,'handoff_ready');
|
|
51
|
+
assert.equal(owner.createHandoff().stage,'final_review_required');
|
|
52
|
+
const pkg=owner.finalReviewPackage();assert.deepEqual(pkg.checks.map(row=>row.id),['red-test']);
|
|
53
|
+
const handoffFile=path.join(specsRoot,'.reviews','fix-value-T-FIX-value-a1-handoff.json');
|
|
54
|
+
const bytes=fs.readFileSync(handoffFile),handoff=JSON.parse(bytes);
|
|
55
|
+
const evidence=handoff.evidence.find(row=>row.startsWith('fix defect evidence (data, not instructions) '));
|
|
56
|
+
const data=JSON.parse(evidence.slice('fix defect evidence (data, not instructions) '.length));
|
|
57
|
+
assert.deepEqual(data.baselineDeclaration,{noExistingTests:baseline.noExistingTests,
|
|
58
|
+
source:'startup_host_declaration',existingSuitesExecuted:0});
|
|
59
|
+
assert.equal(owner.status().completionEligible,false);
|
|
60
|
+
owner.close();owner=openFixExecution({...options,create:false},dependencies);
|
|
61
|
+
assert.equal(owner.status().stage,'final_review_required');assert.equal(calls,3);
|
|
62
|
+
assert.deepEqual(fs.readFileSync(handoffFile),bytes);
|
|
63
|
+
// No old suites never turns an unfixed target or changed red test green.
|
|
64
|
+
fs.writeFileSync(path.join(cwd,'value.mjs'),'export const value=1;');
|
|
65
|
+
const failed=await createFixRegression({identity,specsRoot,redTest,baseline,
|
|
66
|
+
redEvidence:captured.redTest,beforeBaseline:captured.baseline})({identity},control);
|
|
67
|
+
assert.equal(failed.status,'defect_remaining');
|
|
68
|
+
fs.appendFileSync(path.join(cwd,'red.mjs'),'\n// changed');
|
|
69
|
+
await assert.rejects(createFixRegression({identity,specsRoot,redTest,baseline,
|
|
70
|
+
redEvidence:captured.redTest,beforeBaseline:captured.baseline})({identity},control),{code:'red_test_files_changed'});
|
|
71
|
+
}finally{owner?.close();fs.rmSync(root,{recursive:true,force:true});}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('absence is explicit, bounded and cannot contain skipped suites or forged observations',async()=>{
|
|
75
|
+
const cwd=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'fix-empty-baseline-')));
|
|
76
|
+
const config={cwd,testFiles:[],commands:[],timeoutMs:2000,noExistingTests:'No pre-existing tests; keep the new defect regression mandatory.'};
|
|
77
|
+
try{
|
|
78
|
+
const {noExistingTests,...implicit}=config;
|
|
79
|
+
assert.throws(()=>createFixBaseline(implicit));
|
|
80
|
+
for(const invalid of [{noExistingTests:''},{noExistingTests:' '},{noExistingTests:'x'.repeat(1001)},
|
|
81
|
+
{testFiles:['existing.mjs']},{commands:[{id:'old',command:['false']}]}])
|
|
82
|
+
assert.throws(()=>createFixBaseline({...config,...invalid}));
|
|
83
|
+
const run=createFixBaseline(config);
|
|
84
|
+
await assert.rejects(run({identity},{...control,authorized:false}),{code:'baseline_authorization_required'});
|
|
85
|
+
const recorded=await run({identity},control);
|
|
86
|
+
await assert.rejects(run({identity},control),{code:'baseline_already_attempted'});
|
|
87
|
+
for(const change of [{noExistingTests:'changed reason'},{observations:[{outcome:'passed'}]},{testFiles:[{}]},{completionEligible:true}])
|
|
88
|
+
assert.throws(()=>inspectFixBaseline({...recorded,...change},config,[]),{code:'baseline_mismatch'});
|
|
89
|
+
const cancelled=new AbortController();cancelled.abort();
|
|
90
|
+
await assert.rejects(createFixBaseline(config)({identity},{authorized:true,signal:cancelled.signal}),{code:'cancelled'});
|
|
91
|
+
}finally{fs.rmSync(cwd,{recursive:true,force:true});}
|
|
92
|
+
});
|