@aibyzero/cm-workflow 0.18.0 → 0.20.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 +8 -0
- package/CHANGELOG.md +26 -0
- package/README.md +14 -1
- package/VERSION +1 -1
- package/docs/architecture.md +3 -0
- package/docs/cm-acceptance-completion.md +185 -0
- package/docs/installation.md +1 -1
- package/package.json +1 -1
- package/runtime/js/autonomy.mjs +308 -0
- package/runtime/js/check-coverage.mjs +130 -0
- package/runtime/js/cm-ai/acceptance-contract.mjs +252 -0
- package/runtime/js/cm-ai/claude-developer-proposal.schema.json +18 -0
- package/runtime/js/cm-ai/cm-ai-admission.mjs +53 -12
- package/runtime/js/cm-ai/cm-ai-conversation-entry.mjs +10 -6
- package/runtime/js/cm-ai/cm-ai-run-finalizer.mjs +8 -3
- package/runtime/js/cm-ai/codex-developer-basic-output.schema.json +1 -1
- package/runtime/js/cm-ai/codex-developer-output.schema.json +1 -1
- package/runtime/js/cm-ai/completion-summary.mjs +187 -0
- package/runtime/js/cm-ai/control-policy.mjs +3 -1
- package/runtime/js/cm-ai/delivery-evidence.mjs +173 -0
- package/runtime/js/cm-ai/developer-adapter.mjs +4 -0
- package/runtime/js/cm-ai/drive-core.mjs +8 -3
- package/runtime/js/cm-ai/durable-runner-state.mjs +2 -2
- package/runtime/js/cm-ai/gate-bridge.mjs +13 -1
- package/runtime/js/cm-ai/host-conversation-execution.mjs +26 -14
- package/runtime/js/cm-ai/host-progress.mjs +2 -1
- package/runtime/js/cm-ai/log-rows.mjs +3 -2
- package/runtime/js/cm-ai/operator-guidance.mjs +110 -4
- package/runtime/js/cm-ai/requirement-evidence.mjs +4 -2
- package/runtime/js/cm-ai/review-package.mjs +2 -2
- package/runtime/js/cm-ai/specification-material.mjs +57 -12
- package/runtime/js/cm-ai/task-runner.mjs +38 -13
- package/runtime/js/cm-ai/verification-auto.mjs +6 -4
- package/runtime/js/cm-prd/acceptance-preview.mjs +203 -0
- package/runtime/js/cm-prd/change.mjs +17 -1
- package/runtime/js/cm-prd/summary.mjs +5 -0
- package/runtime/js/node-test-selection.mjs +38 -0
- package/runtime/js/notify.mjs +17 -8
- package/runtime/js/run-analysis.mjs +153 -0
- package/runtime/js/session-boundary.mjs +17 -5
- package/runtime/js/session-handoff.mjs +5 -2
- package/runtime/js/specs-status.mjs +4 -3
- package/scripts/cm-acceptance-preview.mjs +26 -0
- package/scripts/cm-acceptance-preview.test.mjs +156 -0
- package/scripts/cm-ai-acceptance-contract.test.mjs +185 -0
- package/scripts/cm-ai-admission.mjs +10 -2
- package/scripts/cm-ai-admission.test.mjs +151 -1
- package/scripts/cm-ai-blockage.test.mjs +120 -0
- package/scripts/cm-ai-checklist-coverage.test.mjs +5 -2
- package/scripts/cm-ai-completion-summary.test.mjs +154 -0
- package/scripts/cm-ai-conversation-entry-ops.test.mjs +8 -2
- package/scripts/cm-ai-progress.test.mjs +7 -0
- package/scripts/cm-ai-project-qa-gate.test.mjs +55 -4
- package/scripts/cm-ai-run.test.mjs +23 -1
- package/scripts/cm-ai-spec-rebind.test.mjs +51 -15
- package/scripts/cm-ai-verification-auto.test.mjs +33 -8
- package/scripts/cm-ai-verification-gate.test.mjs +1 -1
- package/scripts/cm-autonomy-acceptance.test.mjs +212 -0
- package/scripts/cm-autonomy-review-r1.test.mjs +93 -0
- package/scripts/cm-autonomy.mjs +96 -0
- package/scripts/cm-autonomy.test.mjs +163 -0
- package/scripts/cm-check-runtime.sh +3 -1
- package/scripts/cm-delivery-evidence.mjs +59 -0
- package/scripts/cm-delivery-evidence.test.mjs +177 -0
- package/scripts/cm-drive-liveness.test.mjs +6 -0
- package/scripts/cm-driver-light-import.test.mjs +32 -0
- package/scripts/cm-mandatory-check-coverage.test.mjs +82 -0
- package/scripts/cm-node-test-selection.test.mjs +108 -0
- package/scripts/cm-notify-read-drift.test.mjs +6 -3
- package/scripts/cm-notify.test.mjs +6 -0
- package/scripts/cm-prd-completion.test.mjs +12 -0
- package/scripts/cm-prd-host.mjs +3 -1
- package/scripts/cm-prd-host.test.mjs +18 -1
- package/scripts/cm-prd-summary.test.mjs +19 -4
- package/scripts/cm-review-inventory.test.mjs +21 -6
- package/scripts/cm-run-analysis.mjs +21 -0
- package/scripts/cm-run-analysis.test.mjs +120 -0
- package/scripts/cm-start-check.mjs +128 -6
- package/scripts/cm-start-check.test.mjs +163 -3
- package/scripts/cm-usage-report.py +8 -3
- package/scripts/cm019-r1-contract.test.mjs +137 -0
- package/scripts/cm019-review-gates.test.mjs +97 -0
- package/scripts/validate-public-repo.py +3 -0
- package/skills/cm-ai/references/N3-execute-task.md +1 -1
- package/skills/cm-ai/references/js-host.md +31 -1
- package/skills/cm-prd/SKILL.md +3 -2
- package/skills/cm-prd/references/change-mode.md +3 -2
- package/skills/cm-prd/references/js-change-recovery.md +14 -0
- package/skills/cm-prd/references/js-host.md +1 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// A projection of approved material, never an approval or a second specs store.
|
|
2
|
+
// Free text remains verbatim for independent review; the machine proves set and
|
|
3
|
+
// evidence-kind agreement, not that arbitrary prose or test assertions are true.
|
|
4
|
+
import {digest,need,shape,freeze} from './effect-contract.mjs';
|
|
5
|
+
import {declaredAcceptanceIds} from './cm-ai-admission.mjs';
|
|
6
|
+
import {taskLines} from '../spec-task-line.mjs';
|
|
7
|
+
import {mandatoryCheckCoverage} from '../check-coverage.mjs';
|
|
8
|
+
import {selectedNodeTestFiles} from '../node-test-selection.mjs';
|
|
9
|
+
|
|
10
|
+
const TYPES=['review','host-run','host-check','browser','device'];
|
|
11
|
+
const ENVIRONMENTS=['local','browser','device'];
|
|
12
|
+
const text=v=>typeof v==='string'&&v.trim().length>0;
|
|
13
|
+
export function readAcceptanceContract(value){
|
|
14
|
+
shape(value,['version','taskId','obligations','requiredTests','requiredCommands','unresolved']);
|
|
15
|
+
need(value.version===1&&/^T-[A-Za-z0-9][A-Za-z0-9._-]*$/.test(value.taskId),'invalid_input');
|
|
16
|
+
need(Array.isArray(value.obligations)&&value.obligations.length>0&&value.obligations.length<=64,'invalid_input');
|
|
17
|
+
const ids=new Set();
|
|
18
|
+
for(const item of value.obligations){
|
|
19
|
+
shape(item,['id','requirement','evidenceType','environment','run','result']);
|
|
20
|
+
need(text(item.id)&&!ids.has(item.id)&&text(item.requirement)&&Buffer.byteLength(item.requirement)<=2000,'invalid_input');ids.add(item.id);
|
|
21
|
+
need(TYPES.includes(item.evidenceType)&&ENVIRONMENTS.includes(item.environment)
|
|
22
|
+
&&[null,'red','baseline'].includes(item.run),'invalid_input');
|
|
23
|
+
need((item.run!==null)===(item.evidenceType==='host-run'),'invalid_input');
|
|
24
|
+
need([null,'passed','failed'].includes(item.result),'invalid_input');
|
|
25
|
+
}
|
|
26
|
+
for(const key of ['requiredTests','unresolved'])need(Array.isArray(value[key])&&value[key].every(text)
|
|
27
|
+
&&new Set(value[key]).size===value[key].length,'invalid_input');
|
|
28
|
+
need(Array.isArray(value.requiredCommands)&&value.requiredCommands.every(argv=>Array.isArray(argv)&&argv.length>0&&argv.every(text)),'invalid_input');
|
|
29
|
+
return freeze(value);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Explicit run vocabulary only. Other prose is not silently interpreted as a
|
|
33
|
+
// host-observed result: its full obligation still has to be answered/reviewed.
|
|
34
|
+
function kindFor(requirement,kind=null){
|
|
35
|
+
const redMention=/\bRED\b|先失败|先红/i.test(requirement);
|
|
36
|
+
const negatedRed=/(?:不要求|不需要|无需|不用|禁止|不要)[^,。;;\n]{0,16}(?:\bRED\b|先失败|先红)|(?:\bRED\b|先失败|先红)[^,。;;\n]{0,12}(?:不要求|不需要|无需)|\b(?:not required|need not|do not)\b[^.;\n]{0,24}\b(?:fail|red)\b/i.test(requirement);
|
|
37
|
+
const red=redMention&&!negatedRed;
|
|
38
|
+
const baseline=/\bbaseline\b|基线/i.test(requirement);
|
|
39
|
+
const device=/真机|物理设备|设备[::]\s*需要/.test(requirement);
|
|
40
|
+
const browser=kind==='browser';
|
|
41
|
+
const noOutcome=/(?:不要求|无需|不需要|不用)[^,。;;\n]{0,8}(?:通过|成功|失败)|\b(?:need not|not required to)\s+(?:pass|fail)\b/i.test(requirement);
|
|
42
|
+
const negativePass=/(?:不通过|未通过|不能通过|不得通过|不成功)|\b(?:must|should|shall)\s+not\s+pass\b|\b(?:not pass|must fail)\b/i.test(requirement);
|
|
43
|
+
const negativeFail=/(?:不能失败|不得失败|不失败)|\b(?:must|should|shall)\s+not\s+fail\b/i.test(requirement);
|
|
44
|
+
const outcomeText=requirement.replace(/(?:不通过|未通过|不能通过|不得通过|不成功|不能失败|不得失败|不失败)|\b(?:must|should|shall)\s+not\s+(?:pass|fail)\b|\bnot pass\b/gi,'');
|
|
45
|
+
const passed=baseline&&!noOutcome&&(negativeFail||/通过|成功|\bpass(?:ed)?\b/i.test(outcomeText));
|
|
46
|
+
const failed=baseline&&!noOutcome&&(negativePass||/失败|\bfail(?:ed)?\b/i.test(outcomeText));
|
|
47
|
+
const unknownNegation=(baseline||redMention)&&/(?:\bnot\b|\bnever\b|n't|不|无需|无须|禁止|勿)/i.test(requirement)
|
|
48
|
+
&&!(noOutcome||negativePass||negativeFail||negatedRed);
|
|
49
|
+
const ambiguous=Number(red)+Number(baseline)+Number(device)+Number(browser)>1||passed&&failed||unknownNegation;
|
|
50
|
+
return {ambiguous,evidenceType:device?'device':browser?'browser':red||baseline?'host-run':'review',
|
|
51
|
+
environment:device?'device':browser?'browser':'local',run:device||browser?null:red?'red':baseline?'baseline':null,
|
|
52
|
+
result:unknownNegation?null:red?'failed':baseline&&passed?'passed':baseline&&failed?'failed':null};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Only explicit declaration markers opt a newly created task into mandatory
|
|
56
|
+
// machine evidence. Existing descriptive fields (ACs, 测试文件, 基线, 设备) alone
|
|
57
|
+
// do not migrate an old specification to a new execution contract.
|
|
58
|
+
export const hasMandatoryAcceptance=value=>/(?:必验(?:合同|条款)?|必跑测试|必跑检查|mandatory\s+acceptance)\s*[::]/i.test(value);
|
|
59
|
+
const bareCommand=value=>{
|
|
60
|
+
const tokens=value.trim().split(/\s+/),[engine,...args]=tokens;
|
|
61
|
+
const script=(file,extensions)=>typeof file==='string'&&!file.startsWith('-')&&!file.startsWith('/')
|
|
62
|
+
&&file.replace(/^\.\//,'').split('/').every(part=>part&&part!=='.'&&part!=='..')&&extensions.test(file);
|
|
63
|
+
if(engine==='node'){
|
|
64
|
+
if(args[0]==='--test'||args.some(arg=>arg==='--test')){
|
|
65
|
+
const files=selectedNodeTestFiles([process.execPath,...args]);
|
|
66
|
+
return files!==null&&files.every(file=>script(file,/\.(?:mjs|cjs|js)$/));
|
|
67
|
+
}
|
|
68
|
+
return args.length===1&&script(args[0],/\.(?:mjs|cjs|js)$/)
|
|
69
|
+
||args.length===2&&['--check','-c'].includes(args[0])&&script(args[1],/\.(?:mjs|cjs|js)$/);
|
|
70
|
+
}
|
|
71
|
+
if(/^\.\/[^\s]+$/.test(engine))return args.length===0;
|
|
72
|
+
if(['bash','sh'].includes(engine))return args.length===1&&script(args[0],/\.sh$/);
|
|
73
|
+
if(['python','python3'].includes(engine))return args.length===1&&script(args[0],/\.py$/);
|
|
74
|
+
if(['npm','pnpm','yarn'].includes(engine))return args.length===1&&['test','build','check'].includes(args[0])
|
|
75
|
+
||args.length===2&&args[0]==='run'&&/^[A-Za-z0-9][A-Za-z0-9:_-]*$/.test(args[1]);
|
|
76
|
+
// Other argv needs an explicitly delimited command declaration. In prose an
|
|
77
|
+
// executable name is not enough evidence that the rest of the line is argv.
|
|
78
|
+
return false;
|
|
79
|
+
};
|
|
80
|
+
const commandContext=value=>value.trim().replace(/^#{1,6}\s+/,'').replace(/\s+#+\s*$/,'')
|
|
81
|
+
.replace(/^(?:[-*+]|\d+[.)])\s+/,'').replace(/^\[[ xX]\]\s*/,'')
|
|
82
|
+
.replace(/^T-[\w.-]+\s*[::]\s*/,'').replace(/^\[AC-\d+\]\s*/,'').replace(/^(?:steps|expected):\s*/,'');
|
|
83
|
+
// This is a declaration grammar, not a list of ways to forbid execution.
|
|
84
|
+
// An ancestor only authorizes children when its entire content is this label.
|
|
85
|
+
const commandDeclaration=value=>/^(?:必跑检查|必跑命令|运行|执行|验证命令|检查命令|mandatory\s+acceptance|required\s+(?:checks?|commands?))(?:\s*[::]\s*|\s+|$)(.*)$/i.exec(value)?.[1]??null;
|
|
86
|
+
export function buildAcceptanceContract({taskId,taskText,requirementsText,testCases=[],explicitOnly=false}){
|
|
87
|
+
let mandatory=false;
|
|
88
|
+
const obligations=[],unresolved=[],requiredTests=[],requiredCommands=[],seen=new Map(),referencedCases=new Set();
|
|
89
|
+
const parents=[];let parentSource=null;
|
|
90
|
+
const add=(source,requirement,kind=null,fenced=false)=>{
|
|
91
|
+
if(!requirement.trim())return;
|
|
92
|
+
// The nearest containing list item or heading is authoritative. A closer
|
|
93
|
+
// non-declaration shadows a mandatory ancestor, regardless of its wording.
|
|
94
|
+
const indent=/^[ \t]*/.exec(requirement)[0].length;
|
|
95
|
+
const heading=fenced?null:/^\s*(#{1,6})\s+/.exec(requirement)?.[1].length??null;
|
|
96
|
+
if(parentSource!==source){parents.length=0;parentSource=source;}
|
|
97
|
+
while(parents.length){
|
|
98
|
+
const parent=parents.at(-1);
|
|
99
|
+
if(parent.indent<indent||parent.indent===indent&&parent.heading!==null
|
|
100
|
+
&&(heading===null||parent.heading<heading))break;
|
|
101
|
+
parents.pop();
|
|
102
|
+
}
|
|
103
|
+
const inheritedMandatory=parents.at(-1)?.mandatory===true;
|
|
104
|
+
const standalone=commandContext(requirement),declaration=commandDeclaration(standalone);
|
|
105
|
+
parents.push({indent,heading,mandatory:!fenced&&declaration===''});requirement=requirement.trim();
|
|
106
|
+
if(hasMandatoryAcceptance(requirement))mandatory=true;
|
|
107
|
+
for(const id of requirement.match(/\bTC-\d{3,}\b/g)??[])referencedCases.add(id);
|
|
108
|
+
if(/(?:测试文件|必跑测试)[::]/.test(requirement)){
|
|
109
|
+
const tests=[...requirement.matchAll(/`([^`]+)`/g)].map(match=>match[1]);
|
|
110
|
+
if(!tests.length)unresolved.push(`${source}: test declarations require explicit backtick-delimited identifiers`);
|
|
111
|
+
requiredTests.push(...tests);
|
|
112
|
+
}
|
|
113
|
+
// Parse only a standalone command or a backtick-delimited command. Shell
|
|
114
|
+
// operators/substitutions and ambiguous quoting require approved mapping.
|
|
115
|
+
const command=/^(?:(?:node|npm|pnpm|yarn|python3?|bash|sh|xcodebuild|xcrun|swift|go|cargo)\s|\.\/[^\s]+(?:\s|$))/;
|
|
116
|
+
const commandText=declaration??standalone;
|
|
117
|
+
let candidates=[...commandText.matchAll(/`([^`]+)`/g)].map(match=>match[1]);
|
|
118
|
+
if(command.test(commandText)){
|
|
119
|
+
if(bareCommand(commandText))candidates=[commandText];
|
|
120
|
+
else {unresolved.push(`${source}: command context is not an explicit mandatory declaration`);candidates=[];}
|
|
121
|
+
}
|
|
122
|
+
else if(candidates.some(value=>command.test(value))){
|
|
123
|
+
const context=commandText.replace(/`[^`]+`/g,'<command>');
|
|
124
|
+
if(!/^<command>(?:\s*[,,;;]\s*<command>)*[。.]?$/.test(context)){
|
|
125
|
+
unresolved.push(`${source}: command context is not an explicit mandatory declaration`);candidates=[];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if(!(declaration!==null&&!fenced||inheritedMandatory)&&candidates.some(value=>command.test(value))){
|
|
129
|
+
unresolved.push(`${source}: command context requires an explicit mandatory declaration on this line or its nearest parent/heading`);candidates=[];
|
|
130
|
+
}
|
|
131
|
+
let commandCount=0;
|
|
132
|
+
for(const candidate of candidates.filter(value=>command.test(value))){
|
|
133
|
+
if(!/^[A-Za-z0-9_./:=,@%+ -]+$/.test(candidate)){
|
|
134
|
+
unresolved.push(`${source}: command requires explicit argv mapping; shell syntax is not inferred`);continue;
|
|
135
|
+
}
|
|
136
|
+
requiredCommands.push(candidate.trim().split(/\s+/));commandCount++;
|
|
137
|
+
}
|
|
138
|
+
if(Buffer.byteLength(requirement)>2000||obligations.length>=64){unresolved.push(`${source}: requirement exceeds evidence bounds; split in approved specs`);return;}
|
|
139
|
+
const key=`${source}:${digest(requirement).slice(0,16)}`,n=seen.get(key)??0;seen.set(key,n+1);
|
|
140
|
+
const {ambiguous,...evidence}=kindFor(requirement,kind);
|
|
141
|
+
if(ambiguous||commandCount&&evidence.environment!=='local')unresolved.push(`${source}: compound evidence requirement; split environment/run obligations in approved specs`);
|
|
142
|
+
if(commandCount&&evidence.evidenceType==='review')evidence.evidenceType='host-check';
|
|
143
|
+
obligations.push({id:`${key}:${n+1}`,requirement,...evidence});
|
|
144
|
+
};
|
|
145
|
+
// Keep subclauses, headings and fences; no "short task description" shortcut.
|
|
146
|
+
for(const {body,fenced} of taskLines(taskText))add(`task:${taskId}`,body,null,fenced);
|
|
147
|
+
const linked=new Set(taskText.match(/\bAC-\d{3,}\b/g)??[]);
|
|
148
|
+
for(const item of testCases)for(const id of item.acIds??[])linked.add(id);
|
|
149
|
+
const declared=new Set();let owner=null,ownerIndent=0;
|
|
150
|
+
for(const {body:line,fenced} of taskLines(requirementsText)){
|
|
151
|
+
const match=fenced?[]:[...declaredAcceptanceIds(line)],indent=/^[ \t]*/.exec(line)[0].length;
|
|
152
|
+
if(match.length){owner=match[0];ownerIndent=indent;declared.add(owner);}
|
|
153
|
+
else if(line.trim()&&indent<=ownerIndent)owner=null;
|
|
154
|
+
// Only explicitly linked AC blocks and explicit shared directives are duties.
|
|
155
|
+
// An indented heading never cuts off an AC's environment/expected subclauses.
|
|
156
|
+
if(owner!==null&&linked.has(owner)||owner===null&&/^\s*(?:Shared|共用必验)[::]/i.test(line))add(owner??'requirements:shared',line,null,fenced);
|
|
157
|
+
}
|
|
158
|
+
if(declared.size&&!linked.size)unresolved.push('acceptance criteria have no explicit task/case mapping');
|
|
159
|
+
for(const id of linked)if(!declared.has(id))unresolved.push(`${id}: undeclared acceptance criterion`);
|
|
160
|
+
const compiledCases=new Set(),caseMap=new Map(testCases.map(item=>[item.id,item]));
|
|
161
|
+
if(caseMap.size!==testCases.length)unresolved.push('duplicate case IDs cannot establish acceptance mapping');
|
|
162
|
+
const pending=testCases.filter(item=>item.blocking===true||referencedCases.has(item.id));
|
|
163
|
+
for(let index=0;index<pending.length;index++){
|
|
164
|
+
const item=pending[index];if(compiledCases.has(item.id))continue;compiledCases.add(item.id);
|
|
165
|
+
add(item.id,`${item.id}: ${item.title}`,item.kind);
|
|
166
|
+
for(const field of ['preconditions','steps','expected','cleanup'])for(const entry of item[field]??[])
|
|
167
|
+
add(`${item.id}:${field}`,`${field}: ${entry}`,item.kind);
|
|
168
|
+
for(const id of referencedCases)if(!compiledCases.has(id)&&caseMap.has(id)&&!pending.some(item=>item.id===id))pending.push(caseMap.get(id));
|
|
169
|
+
}
|
|
170
|
+
for(const id of referencedCases)if(!testCases.some(item=>item.id===id))unresolved.push(`${id}: missing task-bound case mapping`);
|
|
171
|
+
if(!obligations.length){
|
|
172
|
+
unresolved.push('no bounded acceptance obligation; split the approved source before execution');
|
|
173
|
+
obligations.push({id:`task:${taskId}:unmapped`,requirement:'Approved source requires explicit bounded acceptance mapping',
|
|
174
|
+
evidenceType:'review',environment:'local',run:null,result:null});
|
|
175
|
+
}
|
|
176
|
+
if(Buffer.byteLength(JSON.stringify(obligations))>40*1024)unresolved.push('acceptance set exceeds report budget; split the approved task');
|
|
177
|
+
const tests=[...new Set(requiredTests)].filter(value=>{
|
|
178
|
+
const valid=!value.startsWith('/')&&!/[\\\x00-\x1f]/.test(value)
|
|
179
|
+
&&value.replace(/^\.\//,'').split('/').every(part=>part&&part!=='.'&&part!=='..');
|
|
180
|
+
if(!valid)unresolved.push('mandatory tests require canonical relative identifiers');return valid;
|
|
181
|
+
});
|
|
182
|
+
if(explicitOnly&&!mandatory)return null;
|
|
183
|
+
return readAcceptanceContract({version:1,taskId,obligations,requiredTests:tests,
|
|
184
|
+
requiredCommands:[...new Map(requiredCommands.map(argv=>[JSON.stringify(argv),argv])).values()],unresolved:[...new Set(unresolved)]});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Commands are taken from approved text and compared with checks actually
|
|
188
|
+
// collected, not developer prose. Only the running Node binary normalizes to
|
|
189
|
+
// `node`; an arbitrary project executable with the same basename does not.
|
|
190
|
+
export function acceptanceCoverage(contract,checks){
|
|
191
|
+
const commands=checks.filter(item=>Array.isArray(item.command)).map(item=>item.command);
|
|
192
|
+
const coverage=mandatoryCheckCoverage({requiredTests:contract.requiredTests,commands});
|
|
193
|
+
const engines=new Map([[process.execPath,'node'],['/usr/bin/xcodebuild','xcodebuild'],['/usr/bin/xcrun','xcrun']]);
|
|
194
|
+
const normalize=argv=>argv.map((token,index)=>index===0?(engines.get(token)??token):token);
|
|
195
|
+
const native=new Set(engines.values());
|
|
196
|
+
const missingCommands=contract.requiredCommands.filter(expected=>!checks.some(check=>check.outcome==='passed'
|
|
197
|
+
&&Array.isArray(check.command)&&(!native.has(normalize(expected)[0])||engines.has(check.command[0]))
|
|
198
|
+
&&digest(normalize(check.command))===digest(normalize(expected))));
|
|
199
|
+
return {...coverage,satisfied:coverage.satisfied&&missingCommands.length===0,missingCommands};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function acceptanceProblems(contract,items,facts=null){
|
|
203
|
+
readAcceptanceContract(contract);
|
|
204
|
+
const problems=[...contract.unresolved];
|
|
205
|
+
if(!Array.isArray(items))return [...problems,'mandatory acceptance report missing'];
|
|
206
|
+
const expected=new Map(contract.obligations.map(item=>[item.id,item])),seen=new Set();
|
|
207
|
+
for(const item of items){
|
|
208
|
+
const obligation=expected.get(item.id);
|
|
209
|
+
if(!obligation||seen.has(item.id)){problems.push('unknown or duplicate acceptance ID');continue;}seen.add(item.id);
|
|
210
|
+
if(item.satisfied!==true||!text(item.evidence))problems.push(`${item.id}: unsatisfied`);
|
|
211
|
+
if(['requirement','evidenceType','environment'].some(key=>item[key]!==obligation[key]))problems.push(`${item.id}: acceptance evidence mismatch`);
|
|
212
|
+
if((item.run??null)!==obligation.run)problems.push(`${item.id}: required run tag mismatch`);
|
|
213
|
+
// An asserted baseline outcome is part of the approved contract, not an
|
|
214
|
+
// optional claim the developer may remove to avoid contradiction checks.
|
|
215
|
+
if(obligation.run==='baseline'&&obligation.result!==null&&facts?.baseline?.outcome!==obligation.result)
|
|
216
|
+
problems.push(`${item.id}: required baseline outcome mismatch`);
|
|
217
|
+
if(obligation.run==='red'&&!(facts?.status==='replayed'&&!facts.red?.skipped&&facts.red?.outcome==='failed'))
|
|
218
|
+
problems.push(`${item.id}: host RED evidence missing`);
|
|
219
|
+
if(obligation.run==='baseline'&&!(facts?.status==='replayed'&&['passed','failed'].includes(facts.baseline?.outcome)))
|
|
220
|
+
problems.push(`${item.id}: host baseline evidence missing`);
|
|
221
|
+
if(item.run==='baseline'&&item.result&&item.result!==facts?.baseline?.outcome)problems.push(`${item.id}: baseline result mismatch`);
|
|
222
|
+
}
|
|
223
|
+
for(const id of expected.keys())if(!seen.has(id))problems.push(`${id}: missing acceptance obligation`);
|
|
224
|
+
return problems;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Describe the validator's exact failures; this adds source text for operators,
|
|
228
|
+
// never a second verdict. Hosts bound/sanitize the final diagnostic for storage.
|
|
229
|
+
export function describeAcceptanceProblems(contract,problems){
|
|
230
|
+
return problems.map(problem=>{
|
|
231
|
+
const obligation=contract.obligations.find(item=>problem.startsWith(`${item.id}: `));
|
|
232
|
+
return obligation?`${problem} [${obligation.requirement}]`:problem;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export const ACCEPTANCE_EVIDENCE_PREFIX='cm-acceptance-contract-v1: ';
|
|
237
|
+
export function encodeAcceptanceEvidence({contract,identity,items,facts,coverage}){
|
|
238
|
+
need(acceptanceProblems(contract,items,facts).length===0,'verification_precheck_failed');
|
|
239
|
+
need(coverage?.satisfied===true,'verification_precheck_failed');
|
|
240
|
+
return ACCEPTANCE_EVIDENCE_PREFIX+JSON.stringify({version:1,contractDigest:digest(contract),identity,items,facts,coverage});
|
|
241
|
+
}
|
|
242
|
+
export function verifyAcceptanceEvidence({contract,identity,evidence}){
|
|
243
|
+
try{
|
|
244
|
+
const records=evidence.filter(item=>typeof item==='string'&&item.startsWith(ACCEPTANCE_EVIDENCE_PREFIX));
|
|
245
|
+
need(records.length===1,'verification_precheck_failed');
|
|
246
|
+
const value=JSON.parse(records[0].slice(ACCEPTANCE_EVIDENCE_PREFIX.length));
|
|
247
|
+
shape(value,['version','contractDigest','identity','items','facts','coverage']);
|
|
248
|
+
need(value.version===1&&value.contractDigest===digest(contract)&&digest(value.identity)===digest(identity),'verification_precheck_failed');
|
|
249
|
+
need(acceptanceProblems(contract,value.items,value.facts).length===0&&value.coverage?.satisfied===true,'verification_precheck_failed');
|
|
250
|
+
return true;
|
|
251
|
+
}catch{need(false,'verification_precheck_failed');}
|
|
252
|
+
}
|
|
@@ -164,6 +164,24 @@
|
|
|
164
164
|
"failed",
|
|
165
165
|
null
|
|
166
166
|
]
|
|
167
|
+
},
|
|
168
|
+
"id": {
|
|
169
|
+
"type": [
|
|
170
|
+
"string",
|
|
171
|
+
"null"
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"evidenceType": {
|
|
175
|
+
"type": [
|
|
176
|
+
"string",
|
|
177
|
+
"null"
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"environment": {
|
|
181
|
+
"type": [
|
|
182
|
+
"string",
|
|
183
|
+
"null"
|
|
184
|
+
]
|
|
167
185
|
}
|
|
168
186
|
}
|
|
169
187
|
}
|
|
@@ -5,6 +5,7 @@ import { createHash } from 'node:crypto';
|
|
|
5
5
|
import { spawnSync } from 'node:child_process';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import {readSpecsStatus,writeSpecsStatus} from '../specs-status.mjs';
|
|
8
|
+
import {readAutonomy,standingArchiveProblem} from '../autonomy.mjs';
|
|
8
9
|
import {identifyApprovedBootstrapFeature} from './bootstrap-feature.mjs';
|
|
9
10
|
import {buildManifest,verifyApprovedManifest} from '../../../scripts/cm-spec-manifest.mjs';
|
|
10
11
|
import {outstandingFeatureQa,describeOutstandingQa} from './project-qa-gate.mjs';
|
|
@@ -379,20 +380,64 @@ export function inspectCmAiAdmission(options){
|
|
|
379
380
|
}
|
|
380
381
|
|
|
381
382
|
// The CLI supplies every code project so no project can be skipped before writing.
|
|
383
|
+
// Shared by approval and its read-only preview; returns diagnostics only.
|
|
384
|
+
export function inspectTaskGrammarTransition(source,{grammar,fromLegacy=false}){
|
|
385
|
+
const parsed=parseFeatureTaskText(source,{allowDependencyPunctuation:true,grammar});
|
|
386
|
+
if(parsed.error)return {parsed,differing:[]};
|
|
387
|
+
if(!fromLegacy)return {parsed,differing:[]};
|
|
388
|
+
const view=version=>taskDeclarations(source,{grammar:version}).map(item=>({line:item.index+1,
|
|
389
|
+
key:`${item.id}\0${item.completed}\0${item.body.trim()}`,text:item.body.trim()}));
|
|
390
|
+
const legacy=view(LEGACY_TASK_GRAMMAR),current=view(grammar);
|
|
391
|
+
const legacyKeys=new Set(legacy.map(item=>item.key)),currentKeys=new Set(current.map(item=>item.key));
|
|
392
|
+
return {parsed,differing:[...current.filter(item=>!legacyKeys.has(item.key)),...legacy.filter(item=>!currentKeys.has(item.key))]
|
|
393
|
+
.sort((a,b)=>a.line-b.line)};
|
|
394
|
+
}
|
|
395
|
+
|
|
382
396
|
export function approveCmAiSpecs(options){
|
|
383
397
|
const projects=options.codeProjects??[options.codeProject];
|
|
384
|
-
|
|
398
|
+
// The standing authorization (autonomy.mjs) stands in for the reply, and only for a bound change proposal.
|
|
399
|
+
const standing=options.standingAuthorization===true?readAutonomy(options.env):null;
|
|
400
|
+
const inspect=()=>projects.map(codeProject=>inspectCmAiAdmission({...options,...(standing?.on?{assumeYes:true}:{}),codeProject}));
|
|
385
401
|
const projectResults=inspect();
|
|
386
402
|
const refuse=(approveRefused,approveReason=null)=>({projectResults,approveRefused,...(approveReason?{approveReason}:{})});
|
|
387
403
|
if(options.assumeYes)return refuse('assume_yes_not_allowed');
|
|
388
|
-
if(
|
|
404
|
+
if(standing&&!standing.on)return refuse('standing_authorization_off');
|
|
405
|
+
if(standing&&(options.expectRevisionDigest===undefined||options.approvalResponse!==undefined))
|
|
406
|
+
return refuse('standing_authorization_not_applicable','常设授权只用于绑定提案摘要的规格变更,且不与用户原话同用');
|
|
407
|
+
const approvalResponse=standing?`常设授权(${standing.value.at}):${standing.value.response}`:options.approvalResponse;
|
|
408
|
+
if(typeof approvalResponse!=='string'||!approvalResponse.trim())
|
|
389
409
|
return refuse('approval_response_required');
|
|
390
410
|
const allowed=new Set(['approval_write_required','spec_features_changed','test_cases_changed']);
|
|
391
411
|
const rejected=projectResults.find(item=>item.state!=='awaiting_spec_approval'
|
|
392
412
|
||item.approvalIntent!=='explicit'||!allowed.has(item.reason));
|
|
393
413
|
if(rejected)return refuse(rejected.approvalIntent!=='explicit'?'explicit_approval_required':rejected.reason);
|
|
394
|
-
const specsDir=projectResults[0].specsDir,status=readSpecsStatus(specsDir);
|
|
414
|
+
const specsDir=projectResults[0].specsDir,status=readSpecsStatus(specsDir,{withBytes:true});
|
|
395
415
|
if(status.kind==='invalid')return refuse('spec_status_invalid');
|
|
416
|
+
// A change confirmed together with "开始" binds this approval to the saved proposal:
|
|
417
|
+
// any other status, or spec bytes that moved since the save, is not what the user saw.
|
|
418
|
+
// The write re-checks both just before its rename, so changes after this check are refused too.
|
|
419
|
+
let bound=null;
|
|
420
|
+
if(options.expectRevisionDigest!==undefined){
|
|
421
|
+
if(status.kind!=='valid'||status.value.status!=='awaiting_review'
|
|
422
|
+
||status.value.revisionDigest!==options.expectRevisionDigest)return refuse('revision_digest_mismatch');
|
|
423
|
+
const statusFile=path.join(specsDir,'.cm-specs-status'),saved=status.value.specFiles;
|
|
424
|
+
const unchanged=()=>{try{return Array.isArray(saved)&&JSON.stringify(saved)===JSON.stringify(buildManifest(specsDir));}catch{return false;}};
|
|
425
|
+
if(!unchanged())return refuse('revision_files_changed');
|
|
426
|
+
if(standing){
|
|
427
|
+
let archive=null;
|
|
428
|
+
try{const file=path.join(specsDir,'.reviews',`prd-change-${options.expectRevisionDigest}.json`);
|
|
429
|
+
if(path.dirname(fs.realpathSync(file))===fs.realpathSync(path.join(specsDir,'.reviews')))archive=JSON.parse(fs.readFileSync(file,'utf8'));}
|
|
430
|
+
catch{}
|
|
431
|
+
const problem=standingArchiveProblem(specsDir,archive,options.expectRevisionDigest);
|
|
432
|
+
if(problem)return refuse('standing_authorization_not_applicable',`${problem},要用户本人确认`);
|
|
433
|
+
}
|
|
434
|
+
// The baseline is the very bytes just validated, never a later re-read.
|
|
435
|
+
bound={statusBytes:status.bytes,saved,check(){
|
|
436
|
+
options.beforeApprovalWrite?.();
|
|
437
|
+
if(!fs.readFileSync(statusFile).equals(this.statusBytes)||!unchanged())
|
|
438
|
+
throw Object.assign(new Error('revision_changed_during_approval'),{code:'revision_changed_during_approval'});
|
|
439
|
+
}};
|
|
440
|
+
}
|
|
396
441
|
try{
|
|
397
442
|
const discovered=discoverFeatures(specsDir);
|
|
398
443
|
if(discovered.error)return refuse(discovered.error);
|
|
@@ -414,24 +459,20 @@ export function approveCmAiSpecs(options){
|
|
|
414
459
|
const grammar=status.kind==='valid'&&!fromLegacy?status.value.taskGrammar:SHARED_TASK_GRAMMAR;
|
|
415
460
|
for(const name of discovered.names){
|
|
416
461
|
const source=fs.readFileSync(path.join(specsDir,name,'tasks.md'),'utf8');
|
|
417
|
-
const parsed=
|
|
462
|
+
const {parsed,differing}=inspectTaskGrammarTransition(source,{grammar,fromLegacy});
|
|
418
463
|
if(parsed.error)return refuse('task_grammar_conflict',`${name}/tasks.md 第 ${parsed.detail.line} 行在新任务行语法下无效(${parsed.error}):`
|
|
419
464
|
+`${parsed.detail.text}。此前的批准把它当作说明文字;把这类示例放进 \`\`\` 围栏或删去后再批准。`);
|
|
420
465
|
if(!fromLegacy)continue;
|
|
421
|
-
const view=grammar=>taskDeclarations(source,{grammar}).map(item=>({line:item.index+1,key:`${item.id}\0${item.completed}\0${item.body.trim()}`,text:item.body.trim()}));
|
|
422
|
-
const legacy=view(LEGACY_TASK_GRAMMAR),current=view(grammar);
|
|
423
|
-
const legacyKeys=new Set(legacy.map(item=>item.key)),currentKeys=new Set(current.map(item=>item.key));
|
|
424
|
-
const differing=[...current.filter(item=>!legacyKeys.has(item.key)),...legacy.filter(item=>!currentKeys.has(item.key))]
|
|
425
|
-
.sort((a,b)=>a.line-b.line);
|
|
426
466
|
if(differing.length)return refuse('task_grammar_conflict',`${name}/tasks.md 在新任务行语法下任务集合会变化:`
|
|
427
467
|
+differing.slice(0,5).map(item=>`第 ${item.line} 行 ${item.text}`).join(';')+`${differing.length>5?` 等 ${differing.length} 行`:''}`
|
|
428
468
|
+'。此前的批准不把这些行当任务(或反之);是示例就放进 ``` 围栏或删去,是任务就改用英文冒号「:」写法后再批准。');
|
|
429
469
|
}
|
|
430
|
-
const specFiles=buildManifest(specsDir),at=new Date().toISOString();
|
|
470
|
+
const specFiles=bound?bound.saved:buildManifest(specsDir),at=new Date().toISOString();
|
|
431
471
|
writeSpecsStatus(specsDir,{status:'approved',summaryDigest:status.value?.summaryDigest??null,at,
|
|
432
472
|
features:discovered.names,specFiles,testCases:specFiles.filter(item=>item.path.endsWith('/test-cases.json')),
|
|
433
|
-
approval:{response:
|
|
434
|
-
...(status.value&&Object.hasOwn(status.value,'revisionDigest')?{revisionDigest:status.value.revisionDigest}:{})}
|
|
473
|
+
approval:{response:approvalResponse,at},taskGrammar:grammar,
|
|
474
|
+
...(status.value&&Object.hasOwn(status.value,'revisionDigest')?{revisionDigest:status.value.revisionDigest}:{})},
|
|
475
|
+
bound?{beforeRename:()=>bound.check()}:{});
|
|
435
476
|
}catch(error){return refuse(error.code??error.message);}
|
|
436
477
|
return {projectResults:inspect()};
|
|
437
478
|
}
|
|
@@ -15,6 +15,7 @@ import {REVIEWED_HANDOFF_HINT} from './host-handoff.mjs';
|
|
|
15
15
|
import {readHostQaFixHandoff} from './host-qa-fix.mjs';
|
|
16
16
|
import {readCloseoutPolicy,readCloseoutReport,closeoutSummary} from './knowledge-closeout.mjs';
|
|
17
17
|
import {digest,freeze,hex,id,json,need,shape,text,validIdentity} from './effect-contract.mjs';
|
|
18
|
+
import {completionSummary,taskCompletion} from './completion-summary.mjs';
|
|
18
19
|
|
|
19
20
|
const sameIdentity=(left,right)=>['repositoryId','runId','taskId','attempt'].every(key=>left[key]===right[key]);
|
|
20
21
|
const sameTask=(left,right)=>['repositoryId','runId','taskId'].every(key=>left[key]===right[key]);
|
|
@@ -97,7 +98,7 @@ export const developFailureClass=status=>{
|
|
|
97
98
|
};
|
|
98
99
|
const summary=(operation,status,outcome)=>freeze({version:1,workflow:'cm-ai',operation:operation.operation,
|
|
99
100
|
requestDigest:digest(operation),identity:status.identity,outcome,state:status.state,code:status.code??null,
|
|
100
|
-
packageDigest:status.packageDigest??null,pendingAction:pendingAction(status),
|
|
101
|
+
packageDigest:status.packageDigest??null,pendingAction:pendingAction(status),completion:{task:taskCompletion(status)},
|
|
101
102
|
...(status.reviewReconciliation?{reviewReconciliation:status.reviewReconciliation}:{}),
|
|
102
103
|
...(status.effectiveScope?{effectiveScope:status.effectiveScope}:{}),
|
|
103
104
|
...(status.acceptedIntegrationDigest?{acceptedIntegrationDigest:status.acceptedIntegrationDigest}:{}),
|
|
@@ -218,7 +219,7 @@ const contextSummary=(operation,status,refresh)=>freeze({version:1,workflow:'cm-
|
|
|
218
219
|
requestDigest:digest(operation),identity:status.identity,outcome:'refreshed',state:status.state,
|
|
219
220
|
code:refresh.state==='complete'?'context_complete':'context_refreshed',packageDigest:status.packageDigest,
|
|
220
221
|
pendingAction:refresh.state==='complete'?'finish':'start_next_task',nextTask:refresh.nextTask,
|
|
221
|
-
contextDigest:refresh.contextDigest,contextFiles:refresh.contextFiles});
|
|
222
|
+
contextDigest:refresh.contextDigest,contextFiles:refresh.contextFiles,completion:{task:taskCompletion(status)}});
|
|
222
223
|
|
|
223
224
|
function validateDocumentationResult(result,status,refresh,policy=null) {
|
|
224
225
|
shape(result,['syncId','identity','packageDigest','contextDigest','status','reason','at',
|
|
@@ -877,13 +878,15 @@ export function createCmAiConversationEntry(options) {
|
|
|
877
878
|
+'宿主只在运行日志记有该命令进程组身份且核对进程组已退出时补记释放;先结束残留进程后重发 run_finalize,记录里没有进程身份的旧资源需人工处理。'},'blocked');
|
|
878
879
|
const input={specsDir:options.specsDir,codeProject:options.codeProject,feature:options.feature,identity,
|
|
879
880
|
packageDigest:operation.packageDigest,contextDigest:refresh.contextDigest,
|
|
880
|
-
documentationSyncId:documentation.syncId
|
|
881
|
+
documentationSyncId:documentation.syncId,
|
|
882
|
+
scopeFeatures:[...new Set(refresh.contextFiles.filter(file=>file.scope==='specs'&&file.path.endsWith('/tasks.md'))
|
|
883
|
+
.map(file=>file.path.split('/')[0]))].sort()};
|
|
881
884
|
if(Object.hasOwn(options,'qaLogHome'))input.logHome=options.qaLogHome;
|
|
882
885
|
const result=recordCmAiRunDone(input);
|
|
883
886
|
return freeze({version:1,workflow:'cm-ai',operation:operation.operation,requestDigest:digest(operation),identity,
|
|
884
887
|
outcome:'finalized',state:'run_done',code:result.degraded?'run_done_degraded':'run_done',
|
|
885
888
|
packageDigest:operation.packageDigest,pendingAction:'none',contextDigest:refresh.contextDigest,
|
|
886
|
-
deduplicated:result.deduplicated,degraded:result.degraded,
|
|
889
|
+
deduplicated:result.deduplicated,degraded:result.degraded,completion:{task:taskCompletion(status)},
|
|
887
890
|
...closeoutSummary(knowledgeCloseout,documentation)});
|
|
888
891
|
}
|
|
889
892
|
need(['start','resume'].includes(operation.operation),'invalid_input');
|
|
@@ -927,8 +930,9 @@ export function createCmAiConversationEntry(options) {
|
|
|
927
930
|
token=Symbol(operation.operation);inFlightHandles.add(token);
|
|
928
931
|
}
|
|
929
932
|
const routed=await route(operation);
|
|
930
|
-
const
|
|
931
|
-
const
|
|
933
|
+
const projected={...routed,completion:completionSummary({specsDir:options.specsDir,feature:options.feature,result:routed})};
|
|
934
|
+
const guidance=operatorGuidance(projected,{executionActive:inFlightHandles.size>(token===null?0:1)});
|
|
935
|
+
const result=freeze({...projected,...(guidance?{guidance}:{})});
|
|
932
936
|
if(!admissionReports.has(routed)&&(epoch===cancellationEpoch||operation.operation==='cancel'))projectHostResult({specsDir:options.specsDir,
|
|
933
937
|
feature:options.feature,result,readCurrent:()=>runner.status()});
|
|
934
938
|
return result;
|
|
@@ -40,15 +40,20 @@ function readResult(stdout,identity,specsDir) {
|
|
|
40
40
|
export function recordCmAiRunDone(input) {
|
|
41
41
|
const keys=['specsDir','codeProject','feature','identity','packageDigest','contextDigest','documentationSyncId'];
|
|
42
42
|
if(input&&Object.hasOwn(input,'logHome'))keys.push('logHome');
|
|
43
|
+
if(input&&Object.hasOwn(input,'scopeFeatures'))keys.push('scopeFeatures');
|
|
43
44
|
shape(input,keys);text(input.specsDir);text(input.codeProject);text(input.feature);validIdentity(input.identity);
|
|
44
45
|
hex(input.packageDigest);hex(input.contextDigest);id(input.documentationSyncId);
|
|
46
|
+
if(Object.hasOwn(input,'scopeFeatures'))need(Array.isArray(input.scopeFeatures)&&input.scopeFeatures.length>0
|
|
47
|
+
&&new Set(input.scopeFeatures).size===input.scopeFeatures.length&&input.scopeFeatures.includes(input.feature)
|
|
48
|
+
&&input.scopeFeatures.every(name=>typeof name==='string'&&/^\d+\.[^/\\\x00-\x1f]+$/.test(name)),'invalid_input');
|
|
45
49
|
need(validRunId(input.identity.runId),'invalid_run_id');
|
|
46
50
|
statusTarget(input.specsDir);
|
|
47
51
|
const data={node:'N8',feature:input.feature,task:input.identity.taskId,package_digest:input.packageDigest,
|
|
48
|
-
context_digest:input.contextDigest,documentation_sync_id:input.documentationSyncId
|
|
52
|
+
context_digest:input.contextDigest,documentation_sync_id:input.documentationSyncId,
|
|
53
|
+
...(input.scopeFeatures?{scope_features:input.scopeFeatures,repository_id:input.identity.repositoryId,attempt:input.identity.attempt}:{})};
|
|
49
54
|
const args=[writer,'--workflow','cm-ai','--event','run_done','--runtime','codex',
|
|
50
55
|
'--project-root',input.codeProject,'--specs-dir',input.specsDir,'--run-id',input.identity.runId,
|
|
51
|
-
'--detail','
|
|
56
|
+
'--detail','本运行选定范围已通过收尾门禁;产品验收与部署另计','--data-json',JSON.stringify(data)];
|
|
52
57
|
const options={timeout:10000,maxBuffer:MiB,killSignal:'SIGKILL'};
|
|
53
58
|
if(Object.hasOwn(input,'logHome')){text(input.logHome);options.env={...process.env,CM_WORKFLOW_LOG_HOME:input.logHome};}
|
|
54
59
|
let result;
|
|
@@ -61,7 +66,7 @@ export function recordCmAiRunDone(input) {
|
|
|
61
66
|
catch{need(false,'run_finalize_unknown');}
|
|
62
67
|
try {
|
|
63
68
|
writeStatusProjection({specsDir:input.specsDir,feature:input.feature,identity:input.identity,node:'N8',
|
|
64
|
-
state:'run_done',detail:'
|
|
69
|
+
state:'run_done',detail:'本运行选定范围已收尾;产品验收与部署未由本记录证明'});
|
|
65
70
|
}catch{need(false,'run_finalize_unknown');}
|
|
66
71
|
return Object.freeze({eventId:receipt.event_id,runId:receipt.run_id,
|
|
67
72
|
deduplicated:receipt.deduplicated,degraded:receipt.degraded});
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"properties": {
|
|
6
6
|
"outcome": {"type": "string", "enum": ["implemented", "blocked"]},
|
|
7
7
|
"reason": {"type": ["string", "null"]},
|
|
8
|
-
"requirements": {"type": ["array", "null"], "maxItems": 64, "items": {"type": "object", "additionalProperties": false, "required": ["requirement", "satisfied", "evidence", "run", "result"], "properties": {"requirement": {"type": "string"}, "satisfied": {"type": "boolean"}, "evidence": {"type": "string"}, "run": {"type": ["string", "null"], "enum": ["red", "baseline", null]}, "result": {"type": ["string", "null"], "enum": ["passed", "failed", null]}}}}
|
|
8
|
+
"requirements": {"type": ["array", "null"], "maxItems": 64, "items": {"type": "object", "additionalProperties": false, "required": ["requirement", "satisfied", "evidence", "run", "result", "id", "evidenceType", "environment"], "properties": {"requirement": {"type": "string"}, "satisfied": {"type": "boolean"}, "evidence": {"type": "string"}, "run": {"type": ["string", "null"], "enum": ["red", "baseline", null]}, "result": {"type": ["string", "null"], "enum": ["passed", "failed", null]}, "id": {"type": ["string", "null"]}, "evidenceType": {"type": ["string", "null"]}, "environment": {"type": ["string", "null"]}}}}
|
|
9
9
|
}
|
|
10
10
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"properties": {
|
|
6
6
|
"outcome": {"type": "string", "enum": ["implemented", "blocked"]},
|
|
7
7
|
"reason": {"type": ["string", "null"]},
|
|
8
|
-
"requirements": {"type": ["array", "null"], "maxItems": 64, "items": {"type": "object", "additionalProperties": false, "required": ["requirement", "satisfied", "evidence", "run", "result"], "properties": {"requirement": {"type": "string"}, "satisfied": {"type": "boolean"}, "evidence": {"type": "string"}, "run": {"type": ["string", "null"], "enum": ["red", "baseline", null]}, "result": {"type": ["string", "null"], "enum": ["passed", "failed", null]}}}},
|
|
8
|
+
"requirements": {"type": ["array", "null"], "maxItems": 64, "items": {"type": "object", "additionalProperties": false, "required": ["requirement", "satisfied", "evidence", "run", "result", "id", "evidenceType", "environment"], "properties": {"requirement": {"type": "string"}, "satisfied": {"type": "boolean"}, "evidence": {"type": "string"}, "run": {"type": ["string", "null"], "enum": ["red", "baseline", null]}, "result": {"type": ["string", "null"], "enum": ["passed", "failed", null]}, "id": {"type": ["string", "null"]}, "evidenceType": {"type": ["string", "null"]}, "environment": {"type": ["string", "null"]}}}},
|
|
9
9
|
"application": {
|
|
10
10
|
"type": "object", "additionalProperties": false,
|
|
11
11
|
"required": ["status", "note"],
|