@aibyzero/cm-workflow 0.17.1 → 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 +23 -0
- package/CHANGELOG.md +224 -0
- package/README.md +14 -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 +11 -0
- package/docs/cm-control-policy-v2.md +127 -9
- package/docs/installation.md +310 -4
- package/docs/js-workflow-control.md +150 -15
- 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 +83 -14
- 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 +21 -4
- package/runtime/js/cm-ai/developer-adapter.mjs +19 -5
- package/runtime/js/cm-ai/drive-core.mjs +114 -11
- 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 +11 -5
- 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 +1 -1
- 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 +9 -2
- 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 +242 -39
- 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 +11 -5
- 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 +3 -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 +6 -5
- 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 +471 -57
- 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 +14 -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.mjs +73 -17
- package/scripts/cm-ai-drive.test.mjs +34 -2
- package/scripts/cm-ai-execution-store-legacy-probe.test.mjs +84 -0
- package/scripts/cm-ai-host.mjs +60 -19
- 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 +16 -1
- 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-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 +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-review-diagnostics.test.mjs +235 -0
- package/scripts/cm-claude-review-stream.test.mjs +13 -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-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 +4 -3
- 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-qa-executor.test.mjs +77 -0
- package/scripts/cm-host-replay.test.mjs +176 -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 +575 -59
- 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 +45 -1
- 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 +1 -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-summary.test.mjs +24 -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 +1 -1
- 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-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/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 +56 -16
- 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
|
@@ -134,6 +134,15 @@ test('bark and pushplus requests: fields, numeric code check, rejected responses
|
|
|
134
134
|
assert.deepEqual(server.targets.at(-1),{hostname:'bark.example.com',path:'/push',rejectUnauthorized:true});
|
|
135
135
|
assert.deepEqual(JSON.parse(server.seen.at(-1).body),{device_key:BARK_SECRET,title:'t'.repeat(100),body:'正文',group:'CM',level:'active'});
|
|
136
136
|
assert.match(server.seen.at(-1).headers['content-type'],/application\/json/);
|
|
137
|
+
// Subtitle, one group per project and the ring level come from the notice; an unknown level falls back to active.
|
|
138
|
+
result=await run({CM_NOTIFY_SUBTITLE:'cm-ai · 1.login T-001 · 会话 4f9fa27f',CM_NOTIFY_GROUP:'work/demo-app',CM_NOTIFY_LEVEL:'timeSensitive'});
|
|
139
|
+
assert.equal(result.code,0,result.err);
|
|
140
|
+
assert.deepEqual(JSON.parse(server.seen.at(-1).body),{device_key:BARK_SECRET,title:'t'.repeat(100),
|
|
141
|
+
subtitle:'cm-ai · 1.login T-001 · 会话 4f9fa27f',body:'正文',group:'work/demo-app',level:'timeSensitive'});
|
|
142
|
+
for(const [level,want] of [['passive','passive'],['critical','active'],['','active']]){
|
|
143
|
+
result=await run({CM_NOTIFY_LEVEL:level});assert.equal(result.code,0,result.err);
|
|
144
|
+
assert.equal(JSON.parse(server.seen.at(-1).body).level,want,level);
|
|
145
|
+
}
|
|
137
146
|
for(const [status,body,type] of [[200,{code:'200',echo:BARK_SECRET},'string'],[200,{code:true},'boolean'],[500,{code:200},'number'],
|
|
138
147
|
[200,`{"code":400,"msg":"${BARK_SECRET}"}`,'number'],[200,'not json '+BARK_SECRET,'not_json']]){
|
|
139
148
|
reply=(req,res)=>json(res,status,body);
|
|
@@ -155,6 +164,9 @@ test('bark and pushplus requests: fields, numeric code check, rejected responses
|
|
|
155
164
|
assert.equal(result.code,0,result.err);
|
|
156
165
|
assert.deepEqual(server.targets.at(-1),{hostname:'www.pushplus.plus',path:'/send',rejectUnauthorized:true});
|
|
157
166
|
assert.deepEqual(JSON.parse(server.seen.at(-1).body),{token:PUSH_SECRET,title:'t'.repeat(100),content:'正文',template:'txt',channel:'wechat'});
|
|
167
|
+
// pushplus has no subtitle field: it becomes the first line of the content.
|
|
168
|
+
result=await run({CM_NOTIFY_SUBTITLE:'cm-ai · T-001 · 会话 4f9fa27f'});assert.equal(result.code,0,result.err);
|
|
169
|
+
assert.equal(JSON.parse(server.seen.at(-1).body).content,'cm-ai · T-001 · 会话 4f9fa27f\n正文');
|
|
158
170
|
});
|
|
159
171
|
|
|
160
172
|
test('network failure exits 3, the deadline (also while waiting on stdin) 5 and unexpected errors 6, without details',async t=>{
|
|
@@ -228,6 +240,11 @@ test('status shows each channel as missing, empty, malformed or filled, marks th
|
|
|
228
240
|
fs.chmodSync(path.join(s.home,'bark.env'),0o644);
|
|
229
241
|
result=s.cli([]);assert.match(result.stdout,/渠道 bark[当前]:格式不对/);assert.match(result.stdout,/chmod 600/);noSecret(result.stdout);
|
|
230
242
|
}
|
|
243
|
+
// 2026-10-27: CM_NOTIFY_OFF silences runs started from this environment; status says so.
|
|
244
|
+
assert.doesNotMatch(s.cli([]).stdout,/CM_NOTIFY_OFF/);
|
|
245
|
+
assert.match(s.cli([],{CM_NOTIFY_OFF:'1'}).stdout,/当前渠道:bark(生效中)[\s\S]*当前环境设置了 CM_NOTIFY_OFF/);
|
|
246
|
+
assert.equal(JSON.parse(s.cli(['status','--json'],{CM_NOTIFY_OFF:'1'}).stdout).envOff,true);
|
|
247
|
+
assert.equal(JSON.parse(s.cli(['status','--json']).stdout).envOff,false);
|
|
231
248
|
assert.equal(s.log(),'','status writes nothing, not even notify.log');
|
|
232
249
|
}
|
|
233
250
|
});
|
|
@@ -794,33 +811,48 @@ test('custom text survives switch, off and on; status shows 文案:默认/自
|
|
|
794
811
|
noSecret(s.cli([]).stdout);
|
|
795
812
|
});
|
|
796
813
|
|
|
814
|
+
test('compact layout: preview shows project, session, why it stopped and what to do',async t=>{
|
|
815
|
+
const s=sandbox(t);
|
|
816
|
+
s.write('notify.json',JSON.stringify({version:1,command:['/bin/true'],layout:'compact',text:{headlines:{default:'要你出手',done:'跑完了'}}}));
|
|
817
|
+
const preview=await previewText(s.home,{now:Date.parse('2026-10-08T08:00:00.000Z'),timeZone:'Asia/Shanghai'});
|
|
818
|
+
assert.deepEqual(preview.messages.map(({title,subtitle,body})=>[title,subtitle,body]),[
|
|
819
|
+
['demo-app','会话:示例会话标题','检查没通过\n你要做:回到会话「示例会话标题」说「继续」,让它修好后重新提交'],
|
|
820
|
+
['demo-app','会话:示例会话标题','在等会话应答\n你要做:回到会话「示例会话标题」看看它是否卡住,需要时说「继续」'],
|
|
821
|
+
['demo-app','会话:示例会话标题','会话没有发下一步\n你要做:回到会话「示例会话标题」说「继续」,让它做下一步'],
|
|
822
|
+
['demo-app','会话:示例会话标题','在等你处理\n你要做:回到会话「示例会话标题」说「继续」,让它做下一步'],
|
|
823
|
+
['demo-app','会话:示例会话标题','宿主进程已退出\n你要做:宿主中途停了:回到会话「示例会话标题」说「继续」,让它查状态后恢复'],
|
|
824
|
+
['demo-app','会话:示例会话标题','跑完了']]);
|
|
825
|
+
});
|
|
826
|
+
|
|
797
827
|
test('preview prints every event from sample fields with the current text; it sends, logs and changes nothing',async t=>{
|
|
798
828
|
const s=sandbox(t);
|
|
799
829
|
const at={now:Date.parse('2026-10-08T08:00:00.000Z'),timeZone:'Asia/Shanghai'};
|
|
800
830
|
let preview=await previewText(s.home,at);
|
|
801
831
|
assert.equal(preview.textState,null);assert.deepEqual(preview.messages.map(m=>m.event),['stuck','waiting','idle','idle_waiting','dead','done']);
|
|
802
|
-
assert.equal(preview.messages[0].title,'CM
|
|
803
|
-
assert.equal(preview.messages[
|
|
832
|
+
assert.equal(preview.messages[0].title,'CM 需要人处理 · demo-app');
|
|
833
|
+
assert.equal(preview.messages[0].subtitle,'cm-ai · 1.demo-feature T-001 · 会话 示例会话标题');
|
|
834
|
+
assert.equal(preview.messages[0].body,'下一步:核对原因后恢复原运行\n卡在:检查没通过(checks_not_passed)\n时间:16:00');
|
|
835
|
+
assert.equal(preview.messages[5].body,'下一步:会话边界:换新会话,下一项在新会话里运行\n时间:16:00');
|
|
804
836
|
assert.match(formatPreview(preview),/^提醒文案预览,用示例字段生成,不发送。文案:默认(没有生效的 notify.json,按默认文案预览)\n/);
|
|
805
837
|
// Point notify.json at a command that would record any run: preview must never run it.
|
|
806
838
|
const ran=path.join(s.root,'ran');
|
|
807
839
|
s.write('notify.json',JSON.stringify({version:1,command:[process.execPath,'-e',`require('fs').writeFileSync(${JSON.stringify(ran)},'x')`],text:CUSTOM_TEXT}));
|
|
808
840
|
preview=await previewText(s.home,at);
|
|
809
841
|
assert.equal(preview.textState,'custom');
|
|
810
|
-
assert.deepEqual(preview.messages.map(m=>m.title),['提醒
|
|
811
|
-
'提醒
|
|
842
|
+
assert.deepEqual(preview.messages.map(m=>m.title),['提醒 卡住了 · demo-app','提醒 等待会话应答 · demo-app','提醒 疑似空转 · demo-app',
|
|
843
|
+
'提醒 在等你 · demo-app','提醒 宿主已退出未收尾 · demo-app','提醒 完工 · demo-app']);
|
|
812
844
|
assert.equal(preview.messages[0].body,'下一步:核对原因后恢复原运行\n工单:T-001\n时间:16:00');
|
|
813
|
-
assert.equal(preview.messages[5].body,'
|
|
845
|
+
assert.equal(preview.messages[5].body,'下一步:会话边界:换新会话,下一项在新会话里运行\n时间:16:00');
|
|
814
846
|
const before=s.snapshot();
|
|
815
847
|
let result=s.cli(['preview']);assert.equal(result.status,0,result.stderr);
|
|
816
|
-
assert.match(result.stdout,/^提醒文案预览,用示例字段生成,不发送。文案:自定义\n\n【卡住,需要人处理】stuck\n标题:提醒
|
|
817
|
-
assert.match(result.stdout,/【流程已结束】done\n标题:提醒
|
|
848
|
+
assert.match(result.stdout,/^提醒文案预览,用示例字段生成,不发送。文案:自定义\n\n【卡住,需要人处理】stuck\n标题:提醒 卡住了 · demo-app\n副标题:cm-ai · 1.demo-feature T-001 · 会话 示例会话标题\n下一步:核对原因后恢复原运行\n工单:T-001\n时间:\d\d:\d\d\n/);
|
|
849
|
+
assert.match(result.stdout,/【流程已结束】done\n标题:提醒 完工 · demo-app\n/);
|
|
818
850
|
assert.equal(JSON.parse(s.cli(['preview','--json']).stdout).messages.length,6);
|
|
819
851
|
// Also allowed on Windows: it reads notify.json only, never a secret file.
|
|
820
852
|
const out=sink();assert.equal(await main(['preview'],{env:s.env,stdout:out.stream,stderr:sink().stream,platform:'win32'}),0);
|
|
821
|
-
assert.match(out.text(),/标题:提醒
|
|
853
|
+
assert.match(out.text(),/标题:提醒 卡住了 · demo-app/);
|
|
822
854
|
s.write('notify.json',JSON.stringify({version:1,command:['/bin/true'],text:{labels:{secret:'x'}}}));
|
|
823
|
-
assert.match(s.cli(['preview']).stdout,/文案:默认(notify.json 里的 text 无效:labels,已改用默认文案,提醒照常发送)\n\n【卡住,需要人处理】stuck\n标题:CM
|
|
855
|
+
assert.match(s.cli(['preview']).stdout,/文案:默认(notify.json 里的 text 无效:labels,已改用默认文案,提醒照常发送)\n\n【卡住,需要人处理】stuck\n标题:CM 需要人处理 · demo-app\n/);
|
|
824
856
|
s.write('notify.json','not json');
|
|
825
857
|
assert.match(s.cli(['preview']).stdout,/文案:默认(notify.json 无效,按默认文案预览)/);
|
|
826
858
|
s.write('notify.json',JSON.stringify({version:1,command:[process.execPath,'-e',`require('fs').writeFileSync(${JSON.stringify(ran)},'x')`],text:CUSTOM_TEXT}));
|
|
@@ -843,7 +875,7 @@ test('status, preview, test and switch never follow a notify.json symlink or rea
|
|
|
843
875
|
assert.match(result.stdout,/发送命令:notify.json 不是普通文件(可能是符号链接),cm-notify 不读取它,无法确认提醒是否生效/);
|
|
844
876
|
const preview=await previewText(s.home,{now:Date.parse('2026-10-08T08:00:00.000Z'),timeZone:'UTC'});
|
|
845
877
|
assert.equal(preview.state,'invalid');assert.equal(preview.textState,null);
|
|
846
|
-
assert.equal(preview.messages[0].title,'CM
|
|
878
|
+
assert.equal(preview.messages[0].title,'CM 需要人处理 · demo-app');
|
|
847
879
|
result=s.cli(['preview']);assert.equal(result.status,0);assert.doesNotMatch(result.stdout,/LEAKED/);
|
|
848
880
|
assert.match(result.stdout,/文案:默认(notify.json 无效,按默认文案预览)/);
|
|
849
881
|
result=s.cli(['test']);assert.equal(result.status,2);assert.match(result.stderr,/notify.json 无效(not_regular_file)/);
|
package/scripts/cm-notify.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import path from 'node:path';
|
|
|
15
15
|
import {spawn} from 'node:child_process';
|
|
16
16
|
import {randomUUID} from 'node:crypto';
|
|
17
17
|
import {fileURLToPath} from 'node:url';
|
|
18
|
-
import {parseNotifyConfig,appendNotifyLog,buildNotifyMessage,localClock,NOTIFY_LIMITS} from '../runtime/js/notify.mjs';
|
|
18
|
+
import {parseNotifyConfig,notifyOffByEnv,appendNotifyLog,buildNotifyMessage,localClock,NOTIFY_LIMITS} from '../runtime/js/notify.mjs';
|
|
19
19
|
import {CHANNELS,CHANNEL_FILE,SEND_EXIT,SendError,WINDOWS_UNSUPPORTED,NODE_UNSUPPORTED,MAX_FILE_BYTES,notifyHome,readChannel,readSecret,readRegularFile,parseAssignments,buildRequest} from '../runtime/js/notify-send.mjs';
|
|
20
20
|
|
|
21
21
|
export const SENDER_SOURCE=fileURLToPath(new URL('../runtime/js/notify-send.mjs',import.meta.url));
|
|
@@ -118,10 +118,10 @@ async function loadConfig(home){
|
|
|
118
118
|
if(bytes===null)return {file,state:lstat(off)?'off':'missing',command:null};
|
|
119
119
|
const parsed=parseNotifyConfig(bytes.toString('utf8'));
|
|
120
120
|
if(parsed.reason)return {file,state:'invalid',reason:parsed.reason,command:null};
|
|
121
|
-
const {command,text}=parsed.config;
|
|
121
|
+
const {command,text,layout='full'}=parsed.config;
|
|
122
122
|
// Optional custom text: default, custom, or invalid (then the default text is used).
|
|
123
123
|
const textState=parsed.textReason?'invalid':text?'custom':'default';
|
|
124
|
-
return {file,state:classifyCommand(home,command),command,textState,...(parsed.textReason?{textReason:parsed.textReason}:{}),textSpec:text??null};
|
|
124
|
+
return {file,state:classifyCommand(home,command),command,textState,...(parsed.textReason?{textReason:parsed.textReason}:{}),textSpec:text??null,layout};
|
|
125
125
|
}
|
|
126
126
|
// Status view of a snapshot; neither the command (custom arguments may hold
|
|
127
127
|
// anything) nor the custom strings are included.
|
|
@@ -182,25 +182,26 @@ const textLine=config=>config.textState==='custom'?'文案:自定义(/cm:not
|
|
|
182
182
|
|
|
183
183
|
// Read-only preview of every event's title and body under the current
|
|
184
184
|
// notify.json text, built from fixed sample fields. Sends and logs nothing.
|
|
185
|
-
const PREVIEW_SAMPLE=Object.freeze({project:'demo-app',workflow:'cm-ai',runId:'run-sample-1',task:'T-001'});
|
|
185
|
+
const PREVIEW_SAMPLE=Object.freeze({project:'demo-app',workflow:'cm-ai',runId:'run-sample-1',feature:'1.demo-feature',task:'T-001',session:'4f9fa27f',sessionTitle:'示例会话标题'});
|
|
186
186
|
export const PREVIEW_EVENTS=Object.freeze([
|
|
187
187
|
{event:'stuck',name:'卡住,需要人处理',stage:'blocked',code:'checks_not_passed',nextAction:'核对原因后恢复原运行'},
|
|
188
188
|
{event:'waiting',name:'等待会话应答',stage:'check',code:'waiting_session_answer',nextAction:'宿主已等待会话应答约 10 分钟,请回到会话处理'},
|
|
189
189
|
{event:'idle',name:'疑似空转',stage:'requirements_analysis',code:'no_next_step',nextAction:'上一步已结束约 45 分钟,会话没有发下一步,请回到会话查看'},
|
|
190
190
|
{event:'idle_waiting',name:'在等你',stage:'blocked',code:'waiting_for_you',nextAction:'上一步停在需要你处理的状态,约 45 分钟没有下一步,请回到会话处理'},
|
|
191
191
|
{event:'dead',name:'宿主已退出未收尾',stage:'1 个宿主进程已不在',code:'host_process_gone',nextAction:'请回到会话用 status 核对运行状态,需要时按恢复说明接手'},
|
|
192
|
-
{event:'done',name:'流程已结束',stage:'run_done',code:'run_done',nextAction:'
|
|
192
|
+
{event:'done',name:'流程已结束',stage:'run_done',code:'run_done',nextAction:'会话边界:换新会话,下一项在新会话里运行'}]);
|
|
193
193
|
export async function previewText(home,{now=Date.now(),timeZone}={}){
|
|
194
|
-
const {state,textState=null,textReason=null,textSpec=null}=await loadConfig(home);
|
|
194
|
+
const {state,textState=null,textReason=null,textSpec=null,layout='full'}=await loadConfig(home);
|
|
195
195
|
const messages=PREVIEW_EVENTS.map(({name,...fields})=>({event:fields.event,name,
|
|
196
|
-
...buildNotifyMessage({...PREVIEW_SAMPLE,...fields},{now,timeZone,text:textSpec})}));
|
|
196
|
+
...buildNotifyMessage({...PREVIEW_SAMPLE,...fields},{now,timeZone,text:textSpec,layout})}));
|
|
197
197
|
return {state,textState,textReason,messages};
|
|
198
198
|
}
|
|
199
199
|
export function formatPreview(preview){
|
|
200
200
|
const head=preview.textState?textLine(preview).replace('(/cm:notify preview 查看效果)','')
|
|
201
201
|
:`文案:默认(${preview.state==='invalid'?'notify.json 无效':'没有生效的 notify.json'},按默认文案预览)`;
|
|
202
202
|
const lines=[`提醒文案预览,用示例字段生成,不发送。${head}`];
|
|
203
|
-
for(const message of preview.messages)lines.push('',`【${message.name}】${message.event}`,`标题:${message.title}`,
|
|
203
|
+
for(const message of preview.messages)lines.push('',`【${message.name}】${message.event}`,`标题:${message.title}`,
|
|
204
|
+
...(message.subtitle?[`副标题:${message.subtitle}`]:[]),message.body);
|
|
204
205
|
return lines.join('\n');
|
|
205
206
|
}
|
|
206
207
|
|
|
@@ -442,8 +443,11 @@ export async function main(argv=process.argv.slice(2),{env=process.env,stdout=pr
|
|
|
442
443
|
const home=notifyHome(env);
|
|
443
444
|
try{
|
|
444
445
|
if(sub==='status'){
|
|
445
|
-
|
|
446
|
-
|
|
446
|
+
// CM_NOTIFY_OFF silences this process tree whatever notify.json says; say so,
|
|
447
|
+
// or a configured channel that never pushes looks like a broken one.
|
|
448
|
+
const status={...await notifyStatus(home,{platform}),envOff:notifyOffByEnv(env)};
|
|
449
|
+
const lines=formatStatus(status)+(status.envOff?'\n当前环境设置了 CM_NOTIFY_OFF:从这里启动的流程一律不发提醒(只影响这个环境,不改任何文件)':'');
|
|
450
|
+
say(stdout,flags.has('--json')?JSON.stringify(status,null,2):lines);return 0;
|
|
447
451
|
}
|
|
448
452
|
if(sub==='preview'){
|
|
449
453
|
const preview=await previewText(home);
|