@aibyzero/cm-workflow 0.21.1 → 0.21.3
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/CHANGELOG.md +19 -0
- package/README.md +13 -1
- package/VERSION +1 -1
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +6 -1
- package/package.json +1 -1
- package/runtime/js/cm-ai/call-timeout.mjs +21 -0
- package/runtime/js/cm-ai/checkpoint-package-material.mjs +3 -2
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +5 -1
- package/runtime/js/cm-ai/codex-config.mjs +6 -1
- package/runtime/js/cm-ai/durable-runner-state.mjs +19 -4
- package/runtime/js/cm-ai/fix-code-association.mjs +5 -5
- package/runtime/js/cm-ai/host-conversation-execution.mjs +22 -15
- package/runtime/js/cm-ai/host-documentation.mjs +4 -3
- package/runtime/js/cm-ai/host-handoff.mjs +3 -2
- package/runtime/js/cm-ai/host-project-execution.mjs +11 -9
- package/runtime/js/cm-ai/host-qa-executor.mjs +3 -2
- package/runtime/js/cm-ai/host-replay.mjs +28 -8
- package/runtime/js/cm-ai/review-package.mjs +101 -33
- package/runtime/js/cm-ai/reviewed-evidence-supersede.mjs +1 -1
- package/runtime/js/cm-ai/reviewed-integration.mjs +1 -1
- package/runtime/js/cm-ai/spec-amendment.mjs +20 -0
- package/runtime/js/cm-ai/symlink-material.mjs +153 -0
- package/runtime/js/cm-ai/task-commit.mjs +6 -3
- package/runtime/js/cm-ai/task-runner.mjs +14 -6
- package/runtime/js/cm-ai/worker-claude-developer.mjs +19 -7
- package/runtime/js/cm-ai/worker-codex-developer.mjs +3 -1
- package/runtime/js/cm-fix/protected-edits.mjs +57 -36
- package/runtime/js/cm-prd/change.mjs +4 -1
- package/runtime/js/cm-prd/review-findings.mjs +3 -2
- package/runtime/js/cm-prd/review-publication.mjs +3 -2
- package/runtime/js/cm-prd/split-design.mjs +4 -4
- package/scripts/ci-test-weights.json +1 -0
- package/scripts/cm-ai-admission.test.mjs +5 -5
- package/scripts/cm-ai-batch-drive.mjs +9 -5
- package/scripts/cm-ai-call-timeout.test.mjs +85 -0
- package/scripts/cm-ai-control-launch.test.mjs +18 -0
- package/scripts/cm-ai-drive.mjs +142 -43
- package/scripts/cm-ai-host.mjs +15 -3
- package/scripts/cm-ai-host.test.mjs +3 -1
- package/scripts/cm-ai-launch-diagnostics.test.mjs +23 -0
- package/scripts/cm-ai-review-failure.test.mjs +3 -0
- package/scripts/cm-ai-run.mjs +2 -1
- package/scripts/cm-ai-scope-revision.test.mjs +35 -3
- package/scripts/cm-ai-supersede.test.mjs +51 -3
- package/scripts/cm-ai-symlink.test.mjs +481 -0
- package/scripts/cm-codex-developer-worker.test.mjs +13 -1
- package/scripts/cm-notify-command.test.mjs +3 -0
- package/scripts/cm-notify.test.mjs +3 -0
- package/scripts/cm-patrol.test.mjs +3 -0
- package/scripts/cm-prd-design-phase.test.mjs +31 -0
- package/scripts/cm-prd-review-gate.mjs +28 -3
- package/scripts/cm-prd-summary.test.mjs +5 -5
- package/scripts/cm-skill-hints.mjs +40 -16
- package/scripts/cm-skill-hints.test.mjs +91 -0
- package/scripts/cm-spec-amend.test.mjs +107 -1
- package/scripts/cm-specs-status.test.mjs +5 -5
- package/scripts/cm-start-check.mjs +53 -15
- package/scripts/cm-start-check.test.mjs +41 -2
- package/scripts/cm-task-gate.mjs +42 -13
- package/scripts/cm-task-gate.test.mjs +33 -0
- package/scripts/cm-tool-preview-context.test.mjs +20 -1
- package/scripts/cm-upgrade-compat.test.mjs +7 -0
- package/skills/cm-ai/references/js-host.md +1 -0
- package/skills/cm-prd/SKILL.md +14 -27
- package/skills/cm-prd/references/change-mode.md +2 -0
- package/skills/cm-prd/references/cm-optout.md +11 -0
- package/skills/cm-prd/references/context-scope.md +2 -1
- package/skills/cm-prd/references/js-host.md +2 -2
- package/skills/cm-prd/references/requirement-grilling.md +116 -0
- package/skills/cm-product-manager/SKILL.md +13 -1
|
@@ -76,6 +76,29 @@ test('fingerprint_mismatch names the launch input that differs',t=>{
|
|
|
76
76
|
'--runtime','claude','--review-config',f.review]}).status,0);
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
+
test('--call-timeout-minutes 恢复时可放宽:现行 main 建的运行恢复时加 60 能重开;缩短(含漏传)按名字拒绝',t=>{
|
|
80
|
+
const f=fixture(t),base=['--runtime','claude','--review-config',f.review];
|
|
81
|
+
assert.equal(f.host('create',{extra:base}).status,0);
|
|
82
|
+
for(const [label,extra] of [['explicit 30',[...base,'--call-timeout-minutes','30']],['raised to 45',[...base,'--call-timeout-minutes','45']],
|
|
83
|
+
['raised to 60',[...base,'--call-timeout-minutes','60']]]){
|
|
84
|
+
const result=f.host('resume',{extra});
|
|
85
|
+
assert.equal(result.status,0,`${label}: ${JSON.stringify(result.error??null)}`);
|
|
86
|
+
assert.match(result.stderr,new RegExp(`本次单次宿主调用期限 ${extra.at(-1)} 分钟`),label);
|
|
87
|
+
}
|
|
88
|
+
// 恢复时放宽不入落盘记录:再次恢复按当次值生效,并在 stderr 明确报出(不悄悄变化)
|
|
89
|
+
const again=f.host('resume',{extra:base});assert.equal(again.status,0);assert.match(again.stderr,/本次单次宿主调用期限 30 分钟/);
|
|
90
|
+
const g=fixture(t),gbase=['--runtime','claude','--review-config',g.review];
|
|
91
|
+
assert.equal(g.host('create',{extra:[...gbase,'--call-timeout-minutes','60']}).status,0);
|
|
92
|
+
assert.equal(g.host('resume',{extra:[...gbase,'--call-timeout-minutes','60']}).status,0,'created at 60, resumed at 60');
|
|
93
|
+
const lowered=g.host('resume',{extra:gbase});
|
|
94
|
+
assert.equal(lowered.status,1,'omitting the flag would shorten the window');assert.equal(lowered.error.code,'invalid_arguments');
|
|
95
|
+
assert.match(lowered.error.reason,/此运行已用 60 分钟,本次为 30 分钟/);
|
|
96
|
+
for(const bad of ['29','61','x']){
|
|
97
|
+
const result=g.host('resume',{extra:[...gbase,'--call-timeout-minutes',bad]});
|
|
98
|
+
assert.equal(result.status,1,bad);assert.equal(result.error.code,'invalid_arguments',bad);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
79
102
|
test('a legacy run created without review config explains why the config cannot be added on resume',async t=>{
|
|
80
103
|
const f=fixture(t),bridge=createHostToolBridge();
|
|
81
104
|
try{
|
|
@@ -24,6 +24,9 @@ import {reviewPaths} from '../runtime/js/cm-ai/review-runner.mjs';
|
|
|
24
24
|
import {isSupportedExecutionPlatform} from '../runtime/js/cm-ai/execution-platform.mjs';
|
|
25
25
|
import {rateLimitRetryEligible} from '../runtime/js/cm-ai/drive-rate-limit.mjs';
|
|
26
26
|
import {guardFixtureSource,killFixtureProcesses} from './fixtures/process-cleanup.mjs';
|
|
27
|
+
// An exported CM_NOTIFY_OFF silences every notice; these fixtures expect notices on
|
|
28
|
+
// (review 2026-11-17). Tests of the switch itself set it explicitly.
|
|
29
|
+
delete process.env.CM_NOTIFY_OFF;
|
|
27
30
|
|
|
28
31
|
// Native V3 runner fixtures require Node 24.14+ on macOS/Linux. Preserve the
|
|
29
32
|
// suite's existing explicit platform gate; only CLI fixtures spawn POSIX shims.
|
package/scripts/cm-ai-run.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Fixed, no-provider control entry. Executing adapters are a subsequent slice.
|
|
3
3
|
import fs from 'node:fs';
|
|
4
|
+
import {SYMLINK_BASELINE_VERSION} from '../runtime/js/cm-ai/symlink-material.mjs';
|
|
4
5
|
import {assertDeclaredScope} from '../runtime/js/task-scope.mjs';
|
|
5
6
|
import {spawn as spawnChild} from 'node:child_process';
|
|
6
7
|
import path from 'node:path';
|
|
@@ -442,7 +443,7 @@ async function openControlRunOwned(definition,mode,execution=null,{supersedeHold
|
|
|
442
443
|
// Reuse the runner's real validator before creating durable state. A failed
|
|
443
444
|
// baseline must not strand an otherwise unused run ID.
|
|
444
445
|
const specification={specsRoot:specsDir,feature};
|
|
445
|
-
const baselineOptions={root:codeProject,specsRoot:specsDir,identity,scope,requirements,specification,
|
|
446
|
+
const baselineOptions={root:codeProject,specsRoot:specsDir,identity,scope,requirements,specification,version:SYMLINK_BASELINE_VERSION,
|
|
446
447
|
...(bootstrapConfig?{bootstrapRequirements:bootstrapConfig.bootstrapRequirements}:{}),
|
|
447
448
|
...(selectedRoots?{codeProjectPaths:selectedRoots}:{})};
|
|
448
449
|
if(mode==='create'){
|
|
@@ -74,8 +74,18 @@ function fixture(t,{qa=false,protectedMode=false,selected=false}={}){
|
|
|
74
74
|
const rows=()=>JSON.parse(fs.readFileSync(stateFile)).records;
|
|
75
75
|
return {root,app,specs,answers,identity,scope,added,drive,deliver,stateFile,rows};
|
|
76
76
|
}
|
|
77
|
-
function blocked(t,options){
|
|
78
|
-
const f=fixture(t,options)
|
|
77
|
+
function blocked(t,{baselineVersion=3,...options}={}){
|
|
78
|
+
const f=fixture(t,options);
|
|
79
|
+
if(baselineVersion===2){
|
|
80
|
+
assert.equal(f.drive('status',{mode:'create'}).value.state,'ready');
|
|
81
|
+
const {revision,...snapshot}=JSON.parse(fs.readFileSync(f.stateFile,'utf8'));
|
|
82
|
+
assert.deepEqual(snapshot.records.map(row=>row.payload.type),['init']);
|
|
83
|
+
snapshot.records[0].payload.baseline=captureReviewBaseline({root:f.app,specsRoot:f.specs,identity:f.identity,
|
|
84
|
+
scope:[...f.scope,'AGENTS.md'],requirements:['requirements.md'],specification:{specsRoot:f.specs,feature:'1.work'},version:2});
|
|
85
|
+
reseal(snapshot.records);
|
|
86
|
+
fs.writeFileSync(f.stateFile,JSON.stringify({...snapshot,revision:digest(snapshot)})+'\n');
|
|
87
|
+
}
|
|
88
|
+
const r=f.drive('start',{mode:baselineVersion===2?'resume':'create'});
|
|
79
89
|
assert.equal(r.status,0,r.stderr);assert.equal(r.value.code,'develop_checks_not_passed',JSON.stringify(r.value));
|
|
80
90
|
f.target=f.drive().value.launchControlTarget;return f;
|
|
81
91
|
}
|
|
@@ -145,7 +155,8 @@ test('newly scoped unchanged files retain complete bytes and modes in review mat
|
|
|
145
155
|
handoffPath:path.join(f.specs,'.reviews','work-T-001-a1-handoff.json')}));
|
|
146
156
|
});
|
|
147
157
|
test('scope refusal leaves source records intact for stale, shrinking, protected and changed additions',t=>{
|
|
148
|
-
const f=blocked(t),before=fs.readFileSync(f.stateFile);
|
|
158
|
+
const f=blocked(t,{baselineVersion:2}),before=fs.readFileSync(f.stateFile);
|
|
159
|
+
assert.equal(f.rows()[0].payload.baseline.version,2);
|
|
149
160
|
const refused=(extra,code)=>{
|
|
150
161
|
const r=revise(f,extra);assert.equal(r.status,71,r.stderr);assert.equal(r.value.code,code,JSON.stringify(r.value));
|
|
151
162
|
assert.ok(fs.readFileSync(f.stateFile).equals(before),'rejection must not append a record');
|
|
@@ -173,6 +184,27 @@ test('scope refusal leaves source records intact for stale, shrinking, protected
|
|
|
173
184
|
assert.equal(revise(f).value.code,'snapshot_changed');
|
|
174
185
|
f.target=f.drive().value.launchControlTarget;assert.equal(revise(f,{scope:[...f.scope,f.added,'another.mjs']}).value.code,'scope_revision_unavailable');
|
|
175
186
|
});
|
|
187
|
+
test('v3 scope revision rejects a file swapped for an external symlink without reading its target',t=>{
|
|
188
|
+
const f=blocked(t),before=fs.readFileSync(f.stateFile),outside=path.join(f.root,'private.txt');
|
|
189
|
+
assert.equal(f.rows()[0].payload.baseline.version,3);
|
|
190
|
+
// Identical file bytes would defeat a check that followed the link and compared only the content.
|
|
191
|
+
fs.copyFileSync(path.join(f.app,f.added),outside);
|
|
192
|
+
const file=path.join(f.app,f.added);
|
|
193
|
+
fs.unlinkSync(file);fs.symlinkSync(outside,file);
|
|
194
|
+
const open=fs.openSync,guard=t.mock.method(fs,'openSync',(candidate,...args)=>{
|
|
195
|
+
assert.ok(![file,outside].includes(candidate),'neither the link nor its referent may be opened');
|
|
196
|
+
return open(candidate,...args);
|
|
197
|
+
});
|
|
198
|
+
assert.throws(()=>captureScopeRevisionSources(f.app,f.rows()[0].payload.baseline,[...f.scope,f.added]),
|
|
199
|
+
{code:'scope_revision_source_changed'});
|
|
200
|
+
guard.mock.restore();
|
|
201
|
+
const result=revise(f);
|
|
202
|
+
assert.equal(result.status,71,result.stderr);
|
|
203
|
+
assert.equal(result.value.code,'scope_revision_source_changed',JSON.stringify(result.value));
|
|
204
|
+
assert.deepEqual(fs.readFileSync(f.stateFile),before);
|
|
205
|
+
assert.equal(fs.readlinkSync(path.join(f.app,f.added)),outside);
|
|
206
|
+
assert.equal(fs.readFileSync(outside,'utf8'),'export const value = 0;\n');
|
|
207
|
+
});
|
|
176
208
|
test('replay validates the revision source and handles prefixes before and after append without filesystem reads',t=>{
|
|
177
209
|
const f=blocked(t);assert.equal(revise(f).value.outcome,'recorded');
|
|
178
210
|
const rows=f.rows(),config=rows[0].payload.config,last=rows.at(-1);
|
|
@@ -844,10 +844,23 @@ function executionFor(f,content,verdict='blocked',qaResult=null){
|
|
|
844
844
|
}
|
|
845
845
|
return execution;
|
|
846
846
|
}
|
|
847
|
-
async function start(f,runId,content,options={},verdict='blocked',qaResult=null){
|
|
847
|
+
async function start(f,runId,content,options={},verdict='blocked',qaResult=null,baselineVersion=3){
|
|
848
848
|
const identity=identityFor(runId),definition={version:1,specsDir:f.specsDir,codeProject:f.codeProject,
|
|
849
849
|
feature:f.feature,identity,scope:['a.mjs'],requirements:['requirements.md']};
|
|
850
|
-
const
|
|
850
|
+
const execution=executionFor(f,content,verdict,qaResult);
|
|
851
|
+
let run=await openControlRun(definition,'create',execution,options);
|
|
852
|
+
if(baselineVersion===2){
|
|
853
|
+
run.close();
|
|
854
|
+
const stateFile=path.join(f.reviewsDir,'.execution',runId,'state.json');
|
|
855
|
+
const {revision,...snapshot}=JSON.parse(fs.readFileSync(stateFile,'utf8'));
|
|
856
|
+
assert.deepEqual(snapshot.records.map(row=>row.payload.type),['init']);
|
|
857
|
+
snapshot.records[0].payload.baseline=captureReviewBaseline({root:f.codeProject,specsRoot:f.specsDir,identity,
|
|
858
|
+
scope:['a.mjs','AGENTS.md'],requirements:definition.requirements,
|
|
859
|
+
specification:{specsRoot:f.specsDir,feature:f.feature},version:2});
|
|
860
|
+
snapshot.records=rechain(snapshot.records);
|
|
861
|
+
fs.writeFileSync(stateFile,JSON.stringify({...snapshot,revision:digest(snapshot)})+'\n');
|
|
862
|
+
run=await openControlRun(definition,'resume',execution,options);
|
|
863
|
+
}
|
|
851
864
|
try{return await run.host.handle(requestFor(identity));}finally{run.close();}
|
|
852
865
|
}
|
|
853
866
|
|
|
@@ -953,7 +966,9 @@ test('supersession drift reason lists only the first 20 of 21 paths',async()=>{
|
|
|
953
966
|
test('supersession refuses a symlink without reading its target outside the code root',async()=>{
|
|
954
967
|
const f=runFixture();
|
|
955
968
|
try{
|
|
956
|
-
assert.equal((await start(f,'run-link-old-0001','written\n')).state,'blocked');
|
|
969
|
+
assert.equal((await start(f,'run-link-old-0001','written\n',{},'blocked',null,2)).state,'blocked');
|
|
970
|
+
const original=JSON.parse(fs.readFileSync(path.join(f.reviewsDir,'.execution','run-link-old-0001','state.json'),'utf8'));
|
|
971
|
+
assert.equal(original.records[0].payload.baseline.version,2);
|
|
957
972
|
fs.writeFileSync(path.join(f.codeProject,'a.mjs'),'old\n');
|
|
958
973
|
const outside=path.join(f.root,'outside.mjs');
|
|
959
974
|
fs.writeFileSync(outside,'private fixture\n');
|
|
@@ -967,6 +982,39 @@ test('supersession refuses a symlink without reading its target outside the code
|
|
|
967
982
|
}finally{fs.rmSync(f.root,{recursive:true,force:true});}
|
|
968
983
|
});
|
|
969
984
|
|
|
985
|
+
test('v3 supersession detects an external symlink as drift and never opens its referent',async t=>{
|
|
986
|
+
const f=runFixture();
|
|
987
|
+
t.after(()=>fs.rmSync(f.root,{recursive:true,force:true}));
|
|
988
|
+
const old='run-link-v3-old',next='run-link-v3-new',file=path.join(f.codeProject,'link.mjs'),outside=path.join(f.root,'outside.mjs');
|
|
989
|
+
const stateFile=id=>path.join(f.reviewsDir,'.execution',id,'state.json');
|
|
990
|
+
assert.equal((await start(f,old,'written\n')).state,'blocked');
|
|
991
|
+
const before=fs.readFileSync(stateFile(old));
|
|
992
|
+
assert.equal(JSON.parse(before).records[0].payload.baseline.version,3);
|
|
993
|
+
fs.writeFileSync(path.join(f.codeProject,'a.mjs'),'old\n');
|
|
994
|
+
fs.writeFileSync(outside,'private fixture\n');fs.symlinkSync(outside,file);
|
|
995
|
+
const open=fs.openSync;
|
|
996
|
+
const guard=t.mock.method(fs,'openSync',(candidate,...args)=>{
|
|
997
|
+
assert.ok(![file,outside].includes(candidate),'neither the link nor its referent may be opened');
|
|
998
|
+
return open(candidate,...args);
|
|
999
|
+
});
|
|
1000
|
+
await assert.rejects(start(f,next,'new\n',{supersedeReason:'restart'}),error=>{
|
|
1001
|
+
assert.equal(error.code,'supersede_code_drift');
|
|
1002
|
+
assert.match(error.reason,/link\.mjs.*手动还原/);
|
|
1003
|
+
return true;
|
|
1004
|
+
});
|
|
1005
|
+
assert.equal(fs.existsSync(stateFile(next)),false);
|
|
1006
|
+
assert.deepEqual(fs.readFileSync(stateFile(old)),before);
|
|
1007
|
+
assert.equal((await start(f,next,'new\n',{supersedeReason:'restart',acceptSupersededCodeDrift:true})).state,'blocked');
|
|
1008
|
+
const rows=JSON.parse(fs.readFileSync(stateFile(next),'utf8')).records;
|
|
1009
|
+
assert.deepEqual(rows[0].payload.baseline.files.find(item=>item.path==='link.mjs'),{
|
|
1010
|
+
path:'link.mjs',type:'symlink',target:outside,size:Buffer.byteLength(outside),
|
|
1011
|
+
sha256:createHash('sha256').update('symlink\0').update(outside).digest('hex')});
|
|
1012
|
+
assert.doesNotMatch(JSON.stringify(rows),/private fixture/);
|
|
1013
|
+
assert.deepEqual(fs.readFileSync(stateFile(old)),before);
|
|
1014
|
+
guard.mock.restore();
|
|
1015
|
+
assert.equal(fs.readFileSync(outside,'utf8'),'private fixture\n');
|
|
1016
|
+
});
|
|
1017
|
+
|
|
970
1018
|
test('host launch prints supersede code drift reason and stderr hint',async()=>{
|
|
971
1019
|
const f=runFixture();
|
|
972
1020
|
try{
|