@aibyzero/cm-workflow 0.21.0 → 0.21.2
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 +18 -0
- package/README.md +12 -1
- package/VERSION +1 -1
- package/docs/installation.md +1 -1
- package/docs/js-workflow-control.md +1 -1
- package/package.json +1 -1
- package/runtime/js/cm-ai/codex-config.mjs +6 -1
- package/runtime/js/cm-ai/durable-runner-state.mjs +4 -0
- package/runtime/js/cm-ai/spec-amendment.mjs +20 -0
- package/runtime/js/cm-ai/task-commit-codec.mjs +4 -2
- package/runtime/js/cm-ai/task-runner.mjs +2 -1
- package/runtime/js/cm-ai/worker-codex-developer.mjs +3 -1
- 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/cm-ai-admission.test.mjs +5 -5
- package/scripts/cm-ai-batch-run-fixture.mjs +5 -1
- package/scripts/cm-ai-drive.mjs +1 -1
- package/scripts/cm-ai-review-failure.test.mjs +3 -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 +9 -4
- 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.json +1 -1
- package/scripts/cm-skill-hints.mjs +66 -3
- package/scripts/cm-skill-hints.test.mjs +96 -0
- package/scripts/cm-spec-amend.test.mjs +107 -1
- package/scripts/cm-specs-status.test.mjs +5 -5
- package/scripts/cm-tool-preview-context.test.mjs +20 -1
- package/scripts/cm-upgrade-compat.test.mjs +7 -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
|
@@ -16,11 +16,11 @@ import {loadConfig} from './cm-workflow-config.mjs';
|
|
|
16
16
|
import {TASK_GRAMMAR} from '../runtime/js/spec-task-line.mjs';
|
|
17
17
|
import {writeSpecsStatus} from '../runtime/js/specs-status.mjs';
|
|
18
18
|
// Spec approvals write a round ledger under CM_WORKFLOW_HOME; keep it off the real home.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
19
|
+
// Always, not only when unset: an exported CM_WORKFLOW_HOME may be the tester's real home
|
|
20
|
+
// (review 2026-11-17: these suites left 11 approval records in an externally named home).
|
|
21
|
+
const isolatedHome=fs.mkdtempSync(path.join(os.tmpdir(),'cm-approval-home-'));
|
|
22
|
+
process.env.CM_WORKFLOW_HOME=isolatedHome;
|
|
23
|
+
process.on('exit',()=>fs.rmSync(isolatedHome,{recursive:true,force:true}));
|
|
24
24
|
const sha=content=>createHash('sha256').update(content).digest('hex');
|
|
25
25
|
function fixture(t,{pendingCorrection=false,mandatory=false}={}){
|
|
26
26
|
const specs=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-prd-summary-marks-')));
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"invoke": {"mode": "direct", "when": "要结束或切换当前会话:请求写交接文档、交接摘要或接手说明,把当前进度和上下文留给新会话、新窗口或另一个 agent 接着做"},
|
|
27
27
|
"keywords": ["会话太长", "上下文太长", "上下文快满", "换个会话", "开个新会话", "新开一个会话", "context is getting long", "start a new session", "上下文不够了", "上下文要满了", "上下文快爆了", "上下文快用完", "下个会话接着做", "新会话接着做", "hand off to a new session", "running out of context", "context window is almost full", "continue in a new session"],
|
|
28
28
|
"reason": "先写交接摘要,再换新会话接着做",
|
|
29
|
-
"patterns": ["^(?=[\\s\\S]*(新会话|新的会话|下个会话|下一个会话|换(个|一个)?会话|开(个|一个)?新会话|(上下文|会话)((快|要)(满|爆|用完)|不够|满了|爆了|用完了|太长)))[\\s\\S]
|
|
29
|
+
"patterns": ["^(?=[\\s\\S]*(新会话|新的会话|下个会话|下一个会话|换(个|一个)?会话|开(个|一个)?新会话|(上下文|会话)((快|要)(满|爆|用完)|不够|满了|爆了|用完了|太长)|\\b(new|fresh|next|another) session|running out of context|context (window )?is (almost |getting )?(full|long)))[\\s\\S]*(交接|\\bhand-? ?off\\b)"]
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"id": "multi-session-work",
|
|
@@ -156,6 +156,45 @@ export function loadRules({env=process.env,rulesFile=defaultRulesPath()}={}){
|
|
|
156
156
|
// Pasted logs and code are where stray keywords live, so fenced blocks never match.
|
|
157
157
|
export const stripCode=text=>text.replace(/```[\s\S]*?(?:```|$)/g,' ');
|
|
158
158
|
|
|
159
|
+
// Keyword-fallback guards for invoke rules only (方案-否定句 2026-11-16). Hints and the Jev
|
|
160
|
+
// path are untouched: changing what Jev is sent would void the recorded exam answers.
|
|
161
|
+
// Real misfire: "不要换个会话,继续当前任务" told the model to start handoff.
|
|
162
|
+
// Quoted or inline-code words are being talked about, not asked for. ASCII ' is left
|
|
163
|
+
// alone because English contractions use it.
|
|
164
|
+
const QUOTED=[/`[^`\n]*`/g,/“[^”]*”/g,/「[^」]*」/g,/『[^』]*』/g,/"[^"\n]*"/g];
|
|
165
|
+
export const stripQuoted=text=>QUOTED.reduce((out,re)=>out.replace(re,' '),text);
|
|
166
|
+
// A negation masks only the few characters (Chinese) or words (English) right after it,
|
|
167
|
+
// within its own clause: "不要继续当前任务,换个会话交接" still asks for a handoff.
|
|
168
|
+
// "别忘了/不要忘了/别忘记" mean "do", so a negation followed by 忘 is not one.
|
|
169
|
+
export const NEGATION_WINDOW={zh:4,en:3};
|
|
170
|
+
const CLAUSE_END=/[,,。.!!??;;::\n]/;
|
|
171
|
+
// A lone 别 inside a word (别人、特别、分别、区别、告别、别名…) is not a negation (review r1),
|
|
172
|
+
// nor are A-not-A questions (要不要、用不用、想不想) or "why not" (review r2).
|
|
173
|
+
const ZH_NEGATION=/(?:先别|(?<!(?<!只)要)不要|(?<!用)不用|(?<!想)不想|无需|不必|(?<![特分区识级类个告差辨鉴性派道送判甄离])别(?![人处的致墅名扭样具]))(?!忘)/g;
|
|
174
|
+
const EN_NEGATION=/\b(?:(?<!why\s+)don['’]?t|do not|no need to|(?<!why\s+)not)\b/g;
|
|
175
|
+
const EN_WORD=/^[ \t]+[^\s,,。.!!??;;::]+/;
|
|
176
|
+
export function maskNegated(text){
|
|
177
|
+
let out=text;
|
|
178
|
+
const blank=(from,to)=>{out=out.slice(0,from)+' '.repeat(to-from)+out.slice(to);};
|
|
179
|
+
for(const match of text.matchAll(ZH_NEGATION)){
|
|
180
|
+
const start=match.index+match[0].length;
|
|
181
|
+
let end=start;
|
|
182
|
+
while(end<text.length&&end-start<NEGATION_WINDOW.zh&&!CLAUSE_END.test(text[end]))end++;
|
|
183
|
+
blank(start,end);
|
|
184
|
+
}
|
|
185
|
+
for(const match of text.matchAll(EN_NEGATION)){
|
|
186
|
+
const start=match.index+match[0].length;
|
|
187
|
+
let end=start;
|
|
188
|
+
for(let words=0;words<NEGATION_WINDOW.en;words++){
|
|
189
|
+
const next=EN_WORD.exec(text.slice(end));
|
|
190
|
+
if(!next)break;
|
|
191
|
+
end+=next[0].length;
|
|
192
|
+
}
|
|
193
|
+
blank(start,end);
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
|
|
159
198
|
// A user regex can backtrack for minutes; it runs in a context with a hard time
|
|
160
199
|
// budget, and on timeout no pattern counts as matched (keywords still do).
|
|
161
200
|
export function patternMatches(rules,text,budget=PATTERN_BUDGET_MS){
|
|
@@ -269,8 +308,31 @@ export async function pickInvoke({prompt,rules,host,env,authorCheck,judgeModule,
|
|
|
269
308
|
choices:candidates.map(rule=>({skill:rule.skill,when:rule.invoke.when,near:rule.invoke.near}))});
|
|
270
309
|
}
|
|
271
310
|
if(!verdict.error)return {rule:candidates.find(rule=>rule.skill===verdict.skill)??null,via:'jev',candidates};
|
|
272
|
-
const
|
|
273
|
-
|
|
311
|
+
const fallback={via:'keyword',error:verdict.error,candidates};
|
|
312
|
+
const unquoted=stripQuoted(stripCode(prompt.toLowerCase()));
|
|
313
|
+
const guarded=splitHits(candidates,maskNegated(unquoted));
|
|
314
|
+
// Guards only take matches away: masking can also hide a pattern's exclusion words
|
|
315
|
+
// ("不要重构一下,架构太乱了"), so a guarded hit counts only where the plain text hit too.
|
|
316
|
+
const plain=splitHits(candidates,stripCode(prompt.toLowerCase()));
|
|
317
|
+
const raw=plain.map(hit=>hit.keyword||hit.pattern);
|
|
318
|
+
const index=guarded.findIndex((hit,at)=>raw[at]&&(hit.keyword||hit.pattern));
|
|
319
|
+
if(index>=0){
|
|
320
|
+
const rule=candidates[index];
|
|
321
|
+
// A rule with patterns keeps its mode only when a pattern matched both before and after
|
|
322
|
+
// the guards; its bare keywords ("换个会话" without "交接") make the model ask first.
|
|
323
|
+
const strong=guarded[index].pattern&&plain[index].pattern;
|
|
324
|
+
return {...fallback,rule,mode:rule.patterns.length&&!strong?'ask':rule.invoke.mode};
|
|
325
|
+
}
|
|
326
|
+
// What the guards held back, for the log (rule and reason only, never the text).
|
|
327
|
+
const first=raw.findIndex(Boolean);
|
|
328
|
+
if(first<0)return {...fallback,rule:null};
|
|
329
|
+
const unguarded=splitHits([candidates[first]],unquoted)[0];
|
|
330
|
+
return {...fallback,rule:null,suppressed:{rule:candidates[first].id,skill:candidates[first].skill,
|
|
331
|
+
reason:unguarded.keyword||unguarded.pattern?'negated':'quoted'}};
|
|
332
|
+
}
|
|
333
|
+
function splitHits(rules,text){
|
|
334
|
+
const byPattern=patternMatches(rules,text);
|
|
335
|
+
return rules.map((rule,index)=>({keyword:rule.keywords.some(word=>text.includes(word)),pattern:byPattern[index]}));
|
|
274
336
|
}
|
|
275
337
|
|
|
276
338
|
export const messageText=(hints,host)=>
|
|
@@ -304,13 +366,14 @@ export async function hook(input,{env=process.env,host='claude',rulesFile=defaul
|
|
|
304
366
|
// An installed invoke rule is handled above only; the rest hint as before.
|
|
305
367
|
const handled=new Set(invoked.candidates.map(rule=>rule.id));
|
|
306
368
|
const hints=short?pickHints({prompt,rules:loaded.rules.filter(rule=>!handled.has(rule.id)),host,env,hinted:state.hinted,authorCheck}):[];
|
|
307
|
-
const start=invoked.rule?{skill:invoked.rule.skill,mode:invoked.rule.invoke.mode,reason:invoked.rule.reason}:null;
|
|
369
|
+
const start=invoked.rule?{skill:invoked.rule.skill,mode:invoked.mode??invoked.rule.invoke.mode,reason:invoked.rule.reason}:null;
|
|
308
370
|
// Bookkeeping failures cost the statistics, never the hint itself.
|
|
309
371
|
try{
|
|
310
372
|
for(const item of adopted)appendLog(env,{t:time,event:'adopted',host,rule:item.rule,skill:item.skill});
|
|
311
373
|
// A missing key is the normal state for most users, not worth a line per message.
|
|
312
374
|
if(invoked.error&&!['no-key','off'].includes(invoked.error))appendLog(env,{t:time,event:'judge-error',host,error:invoked.error});
|
|
313
375
|
if(start)appendLog(env,{t:time,event:'invoke',host,rule:invoked.rule.id,skill:start.skill,mode:start.mode,via:invoked.via});
|
|
376
|
+
if(invoked.suppressed)appendLog(env,{t:time,event:'suppressed',host,...invoked.suppressed});
|
|
314
377
|
for(const hint of hints)appendLog(env,{t:time,event:'hint',host,rule:hint.rule,skill:hint.skill});
|
|
315
378
|
}catch{/* 统计丢一条 */}
|
|
316
379
|
// Session state is never removed (decided 2026-10-24): a session resumed months
|
|
@@ -829,3 +829,99 @@ test('the shipped table marks only handoff direct and the two heavy skills ask',
|
|
|
829
829
|
assert.deepEqual(Object.fromEntries(rules.filter(rule=>rule.invoke).map(rule=>[rule.skill,rule.invoke.mode])),
|
|
830
830
|
{handoff:'direct',wayfinder:'ask','improve-codebase-architecture':'ask'});
|
|
831
831
|
});
|
|
832
|
+
|
|
833
|
+
// ---- keyword-fallback guards (方案-否定句 2026-11-16) ----
|
|
834
|
+
// Real misfire: "不要换个会话,继续当前任务" told the model to start handoff (Jev off).
|
|
835
|
+
function guarded(t,rules=readJson(defaultRulesPath()).value){
|
|
836
|
+
const f=fixture(t,{rules,local:{judge:false},authorNames:['handoff','wayfinder','improve-codebase-architecture'],
|
|
837
|
+
authorSkills:[['.claude/skills','handoff'],['.claude/skills','wayfinder'],['.claude/skills','improve-codebase-architecture']]});
|
|
838
|
+
let session=0;
|
|
839
|
+
const run=async prompt=>{
|
|
840
|
+
const out=await hook({prompt,session_id:`g${session++}`},{env:f.env,host:'claude',rulesFile:f.rulesFile,now:NOW,
|
|
841
|
+
loadAuthor:async()=>({...(await loadAuthorCheck()),skills:f.authorOptions.skills,license:f.authorOptions.license})});
|
|
842
|
+
const parsed=out?JSON.parse(out):null;
|
|
843
|
+
if(!parsed?.hookSpecificOutput)return null;
|
|
844
|
+
const line=parsed.systemMessage.split('\n')[0];
|
|
845
|
+
const ask=/先问你要不要用 \/(\S+)$/.exec(line);
|
|
846
|
+
return ask?`ask:${ask[1]}`:`direct:${/已让模型用 \/(\S+)$/.exec(line)[1]}`;
|
|
847
|
+
};
|
|
848
|
+
return {...f,run};
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
test('guards: negation, quotes and bare keywords decide direct, ask or nothing for the shipped handoff rule',async t=>{
|
|
852
|
+
const f=guarded(t);
|
|
853
|
+
const cases=[
|
|
854
|
+
['不要换个会话,继续当前任务',null],
|
|
855
|
+
['不要继续当前任务,换个会话交接一下','direct:handoff'],
|
|
856
|
+
['上下文快满了,帮我写个交接','direct:handoff'],
|
|
857
|
+
['上下文快满了','ask:handoff'],
|
|
858
|
+
['不用交接,换个会话就行','ask:handoff'],
|
|
859
|
+
['我们讨论 “换个会话” 这个关键词',null],
|
|
860
|
+
['`换个会话` 是个关键词',null],
|
|
861
|
+
['别忘了换个会话前先交接','direct:handoff'],
|
|
862
|
+
['先别管测试,换个会话交接吧','direct:handoff'],
|
|
863
|
+
["don't start a new session, keep going",null],
|
|
864
|
+
['/handoff 下个会话接着做',null],
|
|
865
|
+
['帮我把这个大改造拆成多个会话','ask:wayfinder'],
|
|
866
|
+
// "handoff" counts as 交接, and English session phrases count as 会话 (user decision 2026-11-17).
|
|
867
|
+
['上下文快满了,写个 handoff 吧','direct:handoff'],
|
|
868
|
+
['context window is almost full, write a handoff doc for a fresh session','direct:handoff'],
|
|
869
|
+
['hand off to a new session','direct:handoff'],
|
|
870
|
+
["don't hand off, start a new session",'ask:handoff'],
|
|
871
|
+
['我们讨论 handoff 这个技能',null],
|
|
872
|
+
];
|
|
873
|
+
const got=[];
|
|
874
|
+
for(const [prompt] of cases)got.push([prompt,await f.run(prompt)]);
|
|
875
|
+
assert.deepEqual(got,cases);
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
test('guards: window edges, case, everyday words with 别, and guards never add a match (review r1)',async t=>{
|
|
879
|
+
const f=guarded(t);
|
|
880
|
+
const cases=[
|
|
881
|
+
['跟别人换个会话交接','direct:handoff'],
|
|
882
|
+
['特别是上下文快满了,帮我写交接','direct:handoff'],
|
|
883
|
+
['你别换个会话,继续',null],
|
|
884
|
+
// Chinese: a hit starting within 4 characters of the negation is masked, from the 5th it is not.
|
|
885
|
+
['不要啊啊啊上下文快满了',null],
|
|
886
|
+
['不要啊啊啊啊上下文快满了','ask:handoff'],
|
|
887
|
+
// English: up to 3 words after the negation.
|
|
888
|
+
["don't a b start a new session",null],
|
|
889
|
+
["don't a b c start a new session",'ask:handoff'],
|
|
890
|
+
['no need to start a new session',null],
|
|
891
|
+
['START A NEW SESSION','ask:handoff'],
|
|
892
|
+
// Masking a pattern's exclusion words must not create a new trigger.
|
|
893
|
+
// A-not-A questions and "why not" are not negations (review r2); plain "not"/"do not" are.
|
|
894
|
+
['要不要换个会话交接','direct:handoff'],
|
|
895
|
+
['用不用换个会话交接','direct:handoff'],
|
|
896
|
+
['想不想换个会话交接','direct:handoff'],
|
|
897
|
+
['why not start a new session','ask:handoff'],
|
|
898
|
+
["why don't we start a new session",'ask:handoff'],
|
|
899
|
+
['只要不要换个会话交接就行',null],
|
|
900
|
+
['i will not start a new session',null],
|
|
901
|
+
['do not start a new session',null],
|
|
902
|
+
['用别名换个会话交接','direct:handoff'],
|
|
903
|
+
['道别前换个会话交接','direct:handoff'],
|
|
904
|
+
['不要重构一下,架构太乱了',null],
|
|
905
|
+
['架构太乱了,我说的不是`重构一下`',null],
|
|
906
|
+
];
|
|
907
|
+
const got=[];
|
|
908
|
+
for(const [prompt] of cases)got.push([prompt,await f.run(prompt)]);
|
|
909
|
+
assert.deepEqual(got,cases);
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
test('guards: what they hold back is logged with rule and reason only, never the text',async t=>{
|
|
913
|
+
const f=guarded(t);
|
|
914
|
+
await f.run('不要换个会话,继续当前任务');
|
|
915
|
+
await f.run('我们讨论 “换个会话” 这个关键词');
|
|
916
|
+
assert.deepEqual(f.log().filter(entry=>entry.event==='suppressed').map(({rule,skill,reason})=>({rule,skill,reason})),[
|
|
917
|
+
{rule:'long-session',skill:'handoff',reason:'negated'},
|
|
918
|
+
{rule:'long-session',skill:'handoff',reason:'quoted'}]);
|
|
919
|
+
assert.doesNotMatch(fs.readFileSync(logFile(f.env),'utf8'),/换个会话|继续当前任务/);
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
test('guards: masking a pattern\'s exclusion words never upgrades ask to direct (review r2)',async t=>{
|
|
923
|
+
const f=guarded(t,{version:1,rules:[{id:'long-session',skill:'handoff',author:true,keywords:['换个会话'],
|
|
924
|
+
patterns:['^(?![\\s\\S]*只是问问)[\\s\\S]*会话'],reason:'写交接',invoke:{mode:'direct',when:'写交接'}}]});
|
|
925
|
+
assert.equal(await f.run('换个会话,不要只是问问'),'ask:handoff');
|
|
926
|
+
assert.equal(await f.run('换个会话吧'),'direct:handoff');
|
|
927
|
+
});
|
|
@@ -9,7 +9,9 @@ import path from 'node:path';
|
|
|
9
9
|
import {spawnSync} from 'node:child_process';
|
|
10
10
|
import {fileURLToPath} from 'node:url';
|
|
11
11
|
import {approveCmAiSpecs} from '../runtime/js/cm-ai/cm-ai-admission.mjs';
|
|
12
|
-
import {applySpecAmendment,withApprovalLock} from '../runtime/js/cm-ai/spec-amendment.mjs';
|
|
12
|
+
import {applySpecAmendment,withApprovalLock,roundLedgerPath} from '../runtime/js/cm-ai/spec-amendment.mjs';
|
|
13
|
+
import {recordPrdReview} from './cm-prd-review-gate.mjs';
|
|
14
|
+
import {assertPrdReviewsSettled} from '../runtime/js/cm-prd/change.mjs';
|
|
13
15
|
|
|
14
16
|
// The round ledger lives under CM_WORKFLOW_HOME; never touch the real home.
|
|
15
17
|
const isolatedHome=fs.mkdtempSync(path.join(os.tmpdir(),'cm-spec-amend-home-'));
|
|
@@ -508,3 +510,107 @@ test('a failed approval snapshot write leaves no round to restore',()=>fixture((
|
|
|
508
510
|
reset();fs.writeFileSync(target,roundA);edit('tasks.md',addTask);
|
|
509
511
|
assert.deepEqual(inspect().reasons,['snapshot_round_missing']);
|
|
510
512
|
}));
|
|
513
|
+
|
|
514
|
+
// wue 实跑事故(2026-11-17):拆分审查回执之后,设计稿经用户重新批准、任务经 1 级补正换绑,
|
|
515
|
+
// cm-prd --change 的 save_draft 仍拿最早回执指纹比对,误报 prd_review_artifact_changed。
|
|
516
|
+
function splitReceipt(specs,names=['requirements.md','design.md','tasks.md','test-cases.json']){
|
|
517
|
+
const reviews=path.join(specs,'.reviews');fs.mkdirSync(reviews,{recursive:true});
|
|
518
|
+
const args={stage:'split',feature:'login',evidence:path.join(reviews,'prd-login-split-r1.md'),receipt:path.join(reviews,'prd-login-split-disposition.json')};
|
|
519
|
+
fs.writeFileSync(args.evidence,'---\nat: 2026-11-01T00:00:00Z\nreviewer: codex-subagent\nindependent: true\nscope:\n - tasks.md\n---\nSynthetic split review\n');
|
|
520
|
+
recordPrdReview({...args,disposition:'no_findings',finding_count:0,unresolved_count:0,
|
|
521
|
+
artifact:names.map(name=>path.join(specs,'1.login',name))});
|
|
522
|
+
}
|
|
523
|
+
test('change save accepts specs re-bound by a later approval or applied amendment after the split receipt',()=>fixture(({specs,approve,inspect,apply,review,edit})=>{
|
|
524
|
+
splitReceipt(specs);assert.equal(approve().status,0);
|
|
525
|
+
const settled=()=>assertPrdReviewsSettled(specs,['1.login']);
|
|
526
|
+
assert.doesNotThrow(settled);
|
|
527
|
+
edit('design.md',text=>text+'\n模块 2:设计稿换版。\n');
|
|
528
|
+
// The design swap goes back through cm-prd (awaiting_review) and a fresh human 「开始」.
|
|
529
|
+
fs.writeFileSync(path.join(specs,'.cm-specs-status'),JSON.stringify({status:'awaiting_review',features:['1.login'],testCases:[]}));
|
|
530
|
+
const again=approve();assert.equal(again.status,0,JSON.stringify(again.json));
|
|
531
|
+
assert.doesNotThrow(settled);
|
|
532
|
+
edit('tasks.md',addTask);const {tier,deltaDigest}=inspect();assert.equal(tier,1);
|
|
533
|
+
assert.equal(apply(['--review-output',review(deltaDigest),'--reviewer','codex']).status,0);
|
|
534
|
+
assert.doesNotThrow(settled);
|
|
535
|
+
// Runtime completion marks stay outside the comparison, as for the receipt itself.
|
|
536
|
+
edit('tasks.md',text=>text.replace('- [ ] T-001: 登录页','- [x] T-001: 登录页'));
|
|
537
|
+
assert.doesNotThrow(settled);
|
|
538
|
+
},{cases:true}));
|
|
539
|
+
test('change save still refuses specs that match no approved version',()=>{
|
|
540
|
+
fixture(({specs,approve,edit})=>{
|
|
541
|
+
splitReceipt(specs);assert.equal(approve().status,0);
|
|
542
|
+
edit('tasks.md',addTask);
|
|
543
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact changed after disposition/);
|
|
544
|
+
},{cases:true});
|
|
545
|
+
// An approved snapshot whose round ledger is gone (or a restored older one) is no baseline.
|
|
546
|
+
fixture(({specs,approve,edit})=>{
|
|
547
|
+
splitReceipt(specs);edit('design.md',text=>text+'\n换版\n');assert.equal(approve().status,0);
|
|
548
|
+
fs.rmSync(roundLedgerPath(specs));
|
|
549
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact changed after disposition/);
|
|
550
|
+
},{cases:true});
|
|
551
|
+
// A snapshot never approved (status back to awaiting_review) is no baseline either.
|
|
552
|
+
fixture(({specs,approve,edit})=>{
|
|
553
|
+
splitReceipt(specs);edit('design.md',text=>text+'\n换版\n');assert.equal(approve().status,0);
|
|
554
|
+
const status=path.join(specs,'.cm-specs-status');
|
|
555
|
+
fs.writeFileSync(status,JSON.stringify({...JSON.parse(fs.readFileSync(status,'utf8')),status:'awaiting_review'}));
|
|
556
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact changed after disposition/);
|
|
557
|
+
},{cases:true});
|
|
558
|
+
});
|
|
559
|
+
// Codex 审查 #2:同一功能不能拼接旧回执字节与新批准字节。
|
|
560
|
+
test('change save refuses mixing receipt bytes with a later approved round',()=>fixture(({specs,approve,edit})=>{
|
|
561
|
+
splitReceipt(specs);const original=fs.readFileSync(path.join(specs,'1.login/tasks.md'));
|
|
562
|
+
edit('design.md',text=>text+'\n换版\n');edit('tasks.md',addTask);assert.equal(approve().status,0);
|
|
563
|
+
assert.doesNotThrow(()=>assertPrdReviewsSettled(specs,['1.login']));
|
|
564
|
+
fs.writeFileSync(path.join(specs,'1.login/tasks.md'),original);
|
|
565
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact changed after disposition/);
|
|
566
|
+
},{cases:true}));
|
|
567
|
+
// Codex 审查 #3:批准轮次已合法去掉 test-cases.json 时不再误拦;未批准的删除仍拦。
|
|
568
|
+
test('change save follows an approved round that no longer has test-cases.json',()=>{
|
|
569
|
+
fixture(({specs,approve})=>{
|
|
570
|
+
splitReceipt(specs);fs.rmSync(path.join(specs,'1.login/test-cases.json'));assert.equal(approve().status,0);
|
|
571
|
+
assert.doesNotThrow(()=>assertPrdReviewsSettled(specs,['1.login']));
|
|
572
|
+
},{cases:true});
|
|
573
|
+
fixture(({specs,approve})=>{
|
|
574
|
+
splitReceipt(specs);assert.equal(approve().status,0);fs.rmSync(path.join(specs,'1.login/test-cases.json'));
|
|
575
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact is missing or unsafe/);
|
|
576
|
+
},{cases:true});
|
|
577
|
+
});
|
|
578
|
+
// Codex 审查 #4:畸形状态清单不是基线,也不能打断原回执校验。
|
|
579
|
+
test('malformed approved status falls back to the strict receipt check',()=>fixture(({specs,approve,edit})=>{
|
|
580
|
+
splitReceipt(specs);assert.equal(approve().status,0);
|
|
581
|
+
const status=path.join(specs,'.cm-specs-status');
|
|
582
|
+
fs.writeFileSync(status,JSON.stringify({...JSON.parse(fs.readFileSync(status,'utf8')),specFiles:{}}));
|
|
583
|
+
assert.doesNotThrow(()=>assertPrdReviewsSettled(specs,['1.login']));
|
|
584
|
+
edit('tasks.md',addTask);
|
|
585
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact changed after disposition/);
|
|
586
|
+
},{cases:true}));
|
|
587
|
+
// Codex 复审 #1:两份清单都没有的 test-cases.json 后来出现,也要拦。
|
|
588
|
+
test('change save refuses a test-cases.json no approval or receipt bound',()=>fixture(({specs,approve,edit})=>{
|
|
589
|
+
splitReceipt(specs,['requirements.md','design.md','tasks.md']);edit('design.md',text=>text+'\n换版\n');assert.equal(approve().status,0);
|
|
590
|
+
assert.doesNotThrow(()=>assertPrdReviewsSettled(specs,['1.login']));
|
|
591
|
+
fs.writeFileSync(path.join(specs,'1.login/test-cases.json'),JSON.stringify(CASES));
|
|
592
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact changed after disposition/);
|
|
593
|
+
}));
|
|
594
|
+
// Codex 复审 #2:批准清单范围外的回执产物仍按回执指纹核对,删除不能借基线放行。
|
|
595
|
+
test('approved baseline never covers receipt artifacts outside the approved spec files',()=>fixture(({specs,approve,edit})=>{
|
|
596
|
+
fs.writeFileSync(path.join(specs,'1.login/api-schema.json'),'{"type":"object"}\n');
|
|
597
|
+
splitReceipt(specs,['requirements.md','design.md','tasks.md','test-cases.json','api-schema.json']);
|
|
598
|
+
edit('design.md',text=>text+'\n换版\n');assert.equal(approve().status,0);
|
|
599
|
+
assert.doesNotThrow(()=>assertPrdReviewsSettled(specs,['1.login']));
|
|
600
|
+
fs.rmSync(path.join(specs,'1.login/api-schema.json'));
|
|
601
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact is missing or unsafe/);
|
|
602
|
+
},{cases:true}));
|
|
603
|
+
// Codex 复审第 3 轮:规格根目录下指纹未变的辅助产物不是功能目录,不能被误拦。
|
|
604
|
+
test('approved baseline keeps root-level receipt artifacts on their own fingerprints',()=>fixture(({specs,approve,edit})=>{
|
|
605
|
+
const extra=path.join(specs,'api-schema.json');fs.writeFileSync(extra,'{"type":"object"}\n');
|
|
606
|
+
splitReceipt(specs);
|
|
607
|
+
const receipt=path.join(specs,'.reviews/prd-login-split-disposition.json'),value=JSON.parse(fs.readFileSync(receipt,'utf8'));
|
|
608
|
+
// Old `record` accepted any file inside the specs root; model such a receipt directly.
|
|
609
|
+
fs.rmSync(receipt);
|
|
610
|
+
recordPrdReview({stage:'split',feature:'login',evidence:path.join(specs,'.reviews/prd-login-split-r1.md'),receipt,
|
|
611
|
+
disposition:'no_findings',finding_count:0,unresolved_count:0,artifact:[...value.artifacts.map(item=>path.join(specs,item.path)),extra]});
|
|
612
|
+
edit('design.md',text=>text+'\n换版\n');assert.equal(approve().status,0);
|
|
613
|
+
assert.doesNotThrow(()=>assertPrdReviewsSettled(specs,['1.login']));
|
|
614
|
+
fs.appendFileSync(extra,' ');
|
|
615
|
+
assert.throws(()=>assertPrdReviewsSettled(specs,['1.login']),/PRD review artifact changed after disposition/);
|
|
616
|
+
},{cases:true}));
|
|
@@ -14,11 +14,11 @@ import {publishPrdReview} from '../runtime/js/cm-prd/review-publication.mjs';
|
|
|
14
14
|
import {recordPrdHostDisposition} from '../runtime/js/cm-prd/review-disposition.mjs';
|
|
15
15
|
import {createPrdSummaryOwner,publishPrdAwaitingReview} from '../runtime/js/cm-prd/summary.mjs';
|
|
16
16
|
// Spec approvals write a round ledger under CM_WORKFLOW_HOME; keep it off the real home.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
17
|
+
// Always, not only when unset: an exported CM_WORKFLOW_HOME may be the tester's real home
|
|
18
|
+
// (review 2026-11-17: these suites left 11 approval records in an externally named home).
|
|
19
|
+
const isolatedHome=fs.mkdtempSync(path.join(os.tmpdir(),'cm-approval-home-'));
|
|
20
|
+
process.env.CM_WORKFLOW_HOME=isolatedHome;
|
|
21
|
+
process.on('exit',()=>fs.rmSync(isolatedHome,{recursive:true,force:true}));
|
|
22
22
|
const entry=fileURLToPath(new URL('./cm-ai-admission.mjs',import.meta.url));
|
|
23
23
|
const at='2026-09-18T00:00:00.000Z';
|
|
24
24
|
const keys=['status','summaryDigest','at','features','specFiles','testCases','approval'];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import test from 'node:test';
|
|
2
2
|
import assert from 'node:assert/strict';
|
|
3
|
-
import {
|
|
3
|
+
import {createHash} from 'node:crypto';
|
|
4
|
+
import {skillContext,requestTools} from '../runtime/js/cm-ai/tool-preview.mjs';
|
|
5
|
+
import {commonArgs,configFingerprint,NO_USER_INPUT_TOOL} from '../runtime/js/cm-ai/codex-config.mjs';
|
|
4
6
|
const retainedPreamble = "Each entry includes a name, description, and location for its `SKILL.md`. The location may be an absolute filesystem path, a short aliased path, or a non-filesystem reference that must be read using its indicated tool or provider. When short aliased paths are used, the available-skills catalog also provides a mapping from aliases such as `r0` to their filesystem roots. Expand the alias before accessing the skill.\n\nThe user's instructions take precedence over guidelines provided in a skill. If explicit user instructions conflict with a skill's instructions, prioritize the user's instructions.\n\nThe first time in a conversation that you decide to apply a skill, inform the user in the commentary channel.\n\nIf a skill causes you to ask for permission or confirmation, pause, or leave requested work unfinished, name the skill and summarize the specific instruction in the skill that led to your decision. Include this explanation in the request or final response where you pause.";
|
|
5
7
|
const input = text => ({input:[{content:[{text}]}]});
|
|
6
8
|
test('Codex 0.159.2 retained empty skill preamble is not a catalog',()=>{
|
|
@@ -10,3 +12,20 @@ test('real, unresolved and unknown catalogs remain blocked',()=>{
|
|
|
10
12
|
for(const content of ['- sample (file: /tmp/sample/SKILL.md)','- sample (file: r99/sample/SKILL.md)','Unrecognized catalog content'])
|
|
11
13
|
assert.equal(skillContext(input('<skills_instructions>\n### Available skills\n'+retainedPreamble+'\n'+content+'\n</skills_instructions>')).present,true);
|
|
12
14
|
});
|
|
15
|
+
// codex-cli 0.167.0 / gpt-6.2-sol 实跑请求形状:两个默认工具必须被零工具判定看见。
|
|
16
|
+
test('a request carrying the Codex 0.167 default tools is not zero tools',()=>{
|
|
17
|
+
const body={model:'gpt-6.2-sol',input:[],tools:[{type:'function',name:'request_user_input'},{type:'function',name:'view_image'}]};
|
|
18
|
+
assert.deepEqual(requestTools(body).map(tool=>tool.name),['request_user_input','view_image']);
|
|
19
|
+
assert.deepEqual(requestTools({...body,tools:[]}),[]);
|
|
20
|
+
assert.equal(requestTools({...body,tools:{}}),null);
|
|
21
|
+
});
|
|
22
|
+
test('the fingerprint binds each review-only tool removal, so older preflight receipts no longer match',()=>{
|
|
23
|
+
const options={cwd:'/fixture',model:'gpt-6.2-sol',effort:'high'},args=commonArgs(options);
|
|
24
|
+
const hash=list=>createHash('sha256').update(JSON.stringify(list)).digest('hex');
|
|
25
|
+
const without=(flag,value)=>args.filter((arg,i)=>!(arg===flag&&args[i+1]===value||arg===value&&args[i-1]===flag));
|
|
26
|
+
assert.equal(configFingerprint(options),hash(args));
|
|
27
|
+
for(const [flag,value] of [['--disable','view_image'],['-c',NO_USER_INPUT_TOOL]]){
|
|
28
|
+
const older=without(flag,value);assert.equal(older.length,args.length-2);
|
|
29
|
+
assert.notEqual(configFingerprint(options),hash(older));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -23,6 +23,13 @@ import {checkPrdDraftMechanics,matchesPrdDraftMechanics} from '../runtime/js/cm-
|
|
|
23
23
|
import {digest} from '../runtime/js/cm-ai/effect-contract.mjs';
|
|
24
24
|
import {buildManifest} from './cm-spec-manifest.mjs';
|
|
25
25
|
|
|
26
|
+
// Spec approvals write a round ledger under CM_WORKFLOW_HOME; keep it off the real home.
|
|
27
|
+
// Always, not only when unset: an exported CM_WORKFLOW_HOME may be the tester's real home
|
|
28
|
+
// (review 2026-11-17: these suites left 11 approval records in an externally named home).
|
|
29
|
+
const isolatedHome=fs.mkdtempSync(path.join(os.tmpdir(),'cm-approval-home-'));
|
|
30
|
+
process.env.CM_WORKFLOW_HOME=isolatedHome;
|
|
31
|
+
process.on('exit',()=>fs.rmSync(isolatedHome,{recursive:true,force:true}));
|
|
32
|
+
|
|
26
33
|
const TIMEOUT=Number(process.env.CM_TEST_FIXTURE_TIMEOUT_MS??120000);
|
|
27
34
|
const root=path.resolve(path.dirname(fileURLToPath(import.meta.url)),'..');
|
|
28
35
|
const UPGRADE_BASE='f73402d';
|
package/skills/cm-prd/SKILL.md
CHANGED
|
@@ -16,7 +16,7 @@ allowed-tools:
|
|
|
16
16
|
新建和变更模式都读取 `references/phase-timing.md`,只为实际执行的阶段写配对
|
|
17
17
|
`progress/start|complete`;人工等待前关闭 segment,恢复后递增,不手算耗时。
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
通过 `references/cm-optout.md` 核对后,用户明确要求外部专家或为本次规格任务开启 AUTO 时,读取
|
|
20
20
|
`../../runtime/external-expert.md` 并执行 `../external-expert/SKILL.md` 的任务路由。
|
|
21
21
|
AUTO 可把复杂方案比较路由到 CONSULT、权威事实查证路由到 VERIFY,其余保持 LOCAL。
|
|
22
22
|
外部结论属于需求/设计输入,必须在本地对照项目事实并进入正常规格人审;AUTO 不
|
|
@@ -44,7 +44,7 @@ AUTO 可把复杂方案比较路由到 CONSULT、权威事实查证路由到 VER
|
|
|
44
44
|
|
|
45
45
|
## JS 准入与当前会话执行
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
先按 `references/cm-optout.md` 核对项目规则是否禁用 CM(两种模式都做);通过后,在读取需求正文、解析角色、写 `run_start`、创建或修改 specs 之前,把已解析路径和模式传给:
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
node "{CM_WORKFLOW_ROOT}/scripts/cm-prd-entry.mjs" \
|
|
@@ -148,8 +148,8 @@ node {CM_WORKFLOW_ROOT}/scripts/cm-workflow-config.mjs \
|
|
|
148
148
|
### Step 4: 读取项目上下文(存量项目 = 二开模式,叠加 B 规则)
|
|
149
149
|
|
|
150
150
|
- 按 `runtime/project-context.md` 读取项目约束和本需求相关规则,扫描两层目录了解模块划分
|
|
151
|
-
- 读取 `references/context-scope.md
|
|
152
|
-
`CONTEXT_SCOPE=targeted|full
|
|
151
|
+
- 读取 `references/context-scope.md`:按下方 B1 读取适用地图或索引,再定向搜索代码,最后设置
|
|
152
|
+
`CONTEXT_SCOPE=targeted|full`、加载补充地图/代码,并写 `decision/context_scope` 日志
|
|
153
153
|
- **B1 代码库参考文档判定**:先读代码项目根 CLAUDE.md 的「业务地图」字段(多层仓库
|
|
154
154
|
下以代码项目根为准,仓库根 CLAUDE.md 无此字段再看地图 00-index 头部;init 已判定过,
|
|
155
155
|
仍须核对相关内容与当前代码)。字段=已生成/已刷新或目录存在 → 按 context-scope 渐进加载并核实;字段=
|
|
@@ -162,7 +162,7 @@ node {CM_WORKFLOW_ROOT}/scripts/cm-workflow-config.mjs \
|
|
|
162
162
|
|
|
163
163
|
### Step 5: 分析需求
|
|
164
164
|
|
|
165
|
-
**调用 `cm-product-manager` skill 执行本步和 Step 5.5
|
|
165
|
+
**调用 `cm-product-manager` skill 执行本步和 Step 5.5**——用户故事、编号功能需求、验收标准的编写方法、歧义五问和七项倒推清单以该 skill 为准。
|
|
166
166
|
|
|
167
167
|
需求涉及**交易/资产/支付/代币/证券/金融营销**时,同时加载 `cm-finance-expert` skill 协同:领域正确性审核 + 营销合规红线扫描 + 合规开放问题(并入 Step 5.5)。法域确认结果须写入代码项目 `.claude/rules/finance.md` 头部字段;文件不存在时,以 `{CM_WORKFLOW_ROOT}/templates/rules/finance.md` 为骨架现场补生成,并在 AGENTS.md 与 CLAUDE.md 的相关规则说明中补充引用。
|
|
168
168
|
|
|
@@ -170,34 +170,15 @@ node {CM_WORKFLOW_ROOT}/scripts/cm-workflow-config.mjs \
|
|
|
170
170
|
|
|
171
171
|
命中重要歧义或方案分歧时,按 `../../runtime/steelman-review.md` 区分已观察事实、参与者主张、当前推断和未知项;“用户真正想要什么”只能写成可修正假设,不能替用户补全业务规则。
|
|
172
172
|
|
|
173
|
-
### Step 5.5:
|
|
173
|
+
### Step 5.5: 需求倒推与逐轮追问
|
|
174
174
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
- 需求描述模糊或有歧义的功能点
|
|
178
|
-
- 多种技术实现方案且差异较大
|
|
179
|
-
- 缺少关键信息(如目标平台、兼容性要求、第三方服务选型)
|
|
180
|
-
- 业务逻辑有矛盾或不完整
|
|
181
|
-
- 涉及权限、支付、敏感操作等需要明确确认的功能
|
|
175
|
+
读取 `references/requirement-grilling.md` 执行 G1–G4:对照现有业务倒推缺口,按设计树逐轮提问(每题带出处与推荐答案),满足其 G4 停止条件后才进入 Step 6,不得自行假设。
|
|
182
176
|
|
|
183
177
|
`DELIVERY_SHAPE=wechat-miniprogram` 时追加平台就绪检查:账号主体、服务类目/资质、
|
|
184
178
|
变现路径、权限与隐私、后端/合法域名和发布通道。会改变功能可行性或范围但未确认的
|
|
185
179
|
项目必须暂停;只影响后续提审的材料可记为发布待决,不阻塞本地规格与开发。平台政策
|
|
186
180
|
结论须记录当前官方查证日期与来源,无法查证时保留开放问题。
|
|
187
181
|
|
|
188
|
-
格式:
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
❓ 需要确认以下问题:
|
|
192
|
-
|
|
193
|
-
1. {问题描述} — {为什么需要确认}
|
|
194
|
-
2. {问题描述} — {为什么需要确认}
|
|
195
|
-
|
|
196
|
-
请逐一回复后继续生成 specs
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
所有问题确认完毕后再进入 Step 6。
|
|
200
|
-
|
|
201
182
|
双向钢人审查只用于暴露假设和失败场景:支持方与反方都取最强版本,但按证据质量加权;无法验证的反方写入开放问题,不强迫给确定结论。
|
|
202
183
|
|
|
203
184
|
### Step 6: 推断 feature 名称
|
|
@@ -267,6 +248,12 @@ node {CM_WORKFLOW_ROOT}/scripts/cm-workflow-config.mjs \
|
|
|
267
248
|
{按 cm-miniprogram-engineer/references/platform-readiness.md 记录状态、证据与负责人;
|
|
268
249
|
不写任何密钥、证件、Cookie 或测试账号密码}
|
|
269
250
|
|
|
251
|
+
## 范围与覆盖核对
|
|
252
|
+
|
|
253
|
+
- 本期做: {范围}
|
|
254
|
+
- 明确不做: {排除项}
|
|
255
|
+
- 追问补齐项: {检查项 — 问题 → 用户答案(出处: 位置)};无缺口写「倒推核对 7 项无缺口」
|
|
256
|
+
|
|
270
257
|
## 开放问题
|
|
271
258
|
|
|
272
259
|
- {待确认事项}
|
|
@@ -518,7 +505,7 @@ AC、design 和 tasks 补齐,保证 AC→TC→Task 可追踪。纯文档/注
|
|
|
518
505
|
│ Feature: {N 个}: {名称列表}
|
|
519
506
|
│ 历史 feature:{N} 个已登记,{M} 个含旧版归档说明
|
|
520
507
|
│ 功能点: {N} 个 | AC: {N} 条 | 任务: {N} 个(预估 {x}h)
|
|
521
|
-
│ 开放问题: {
|
|
508
|
+
│ 开放问题: {倒推核对结果(见 requirement-grilling G4);已答 N / 共 N}——{逐条一行: 问题→答案}
|
|
522
509
|
│ 风险点: {金融/合规/破坏性操作等敏感项,无则"无"}
|
|
523
510
|
│ 上下文范围: {定向 / 完整 / 定向→完整(reason_code)}
|
|
524
511
|
│ 平台就绪: {就绪/待官方核验 N 项/不适用}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# $cm-prd 项目规则禁用 CM 时的确认
|
|
2
|
+
|
|
3
|
+
> 新建与变更模式在外部专家路由、调用 `cm-prd-entry.mjs` 准入、启动 JS 宿主之前执行本文件(实跑教训:aihot 的
|
|
4
|
+
> AGENTS.md 先后写过「只用 CM」和「不用 CM」,流程没有规定怎么处理)。本步只读,不读需求正文。
|
|
5
|
+
|
|
6
|
+
1. 以代码项目根(Step 3 的判定,不是当前会话所在仓库)为准,读其 AGENTS.md 链、根目录 `CLAUDE.md`、`.claude/CLAUDE.md`
|
|
7
|
+
和 `.claude/rules/` 下全部文件(本步不按相关性筛选),只找不用 CM 工作流的条款;没有 → 照常继续准入。
|
|
8
|
+
2. 按规则自身声明的优先级(如「本节优先」「已被覆盖」)判断该条款是否仍生效;已被后续条款明确覆盖 → 照常继续。
|
|
9
|
+
3. 仍生效、无法判断,或条款只限某类需求而本步不读正文无法确定是否适用 → 在对话里问用户一次,问题里引用条款的文件与行号,等真实答复;不调用准入。
|
|
10
|
+
4. 用户明确同意运行 cm-prd,或说明本次需求不在条款限定范围内 → 继续准入;
|
|
11
|
+
其余回复 → 不启动准入与宿主、不写 specs,说明原因后结束。
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
`coding-style.md`、`testing.md`、`security.md` 和本需求已命中层的规则。需求源、项目
|
|
10
10
|
描述文件和两层目录概览已经由 Step 1–3 读取,不重复打开。
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
地图读取顺序以主 `SKILL.md` Step 4 的 B1 为准:先看代码项目根 CLAUDE.md 的「业务地图」字段,
|
|
13
|
+
再按字段结果读项目指定地图或存在的 `docs/codebase-context/00-index.md`;然后用需求中的页面名、路由、可见
|
|
13
14
|
文案、接口名、类型名和业务术语做代码搜索,定位候选模块、直接调用方与最近测试。
|
|
14
15
|
搜索只用于定位,不把命中源码或需求正文写入运行日志。
|
|
15
16
|
|
|
@@ -69,13 +69,13 @@ result必须填真实结果,不留空对象。不同kind的合同见当前请
|
|
|
69
69
|
|
|
70
70
|
| kind | 当前宿主执行 |
|
|
71
71
|
| --- | --- |
|
|
72
|
-
| prd_analyze | 按原Step 0–5
|
|
72
|
+
| prd_analyze | 按原Step 0–5.5分析,并按requirement-grilling.md逐轮追问(每轮一个question,阻断项答完才回analyzed);保留用户用例、形态、平台与范围约束。question交给用户,不能代答。 |
|
|
73
73
|
| prd_materials | 用已可用、已授权的实际工具处理材料;HTML交互只走Codex内置浏览器,PDF逐页覆盖,不伪造截图/页数/证据。能力不足返回blocked。 |
|
|
74
74
|
| prd_generate | 按payload.phase执行:design只做Step6–9的需求/设计;tasks_after_design默认保留acceptedDesign原feature及正文,每个feature只回tasks.md和适用的test-cases.json,省略的requirements.md/design.md由宿主按原字节补回(64KB只算新回的文档;照旧回全文也须逐字一致);整稿自检失败时按下文登记同清单修订;full_draft走原Step6–10。保留UI基准与原粒度约束,只回正文不写文件。 |
|
|
75
75
|
| prd_self_check | 读取spec-self-check.md与相关真实代码/地图/用例,逐项返回有依据的结果;机械通过不等于语义通过,不能用自检冒充独立审查。 |
|
|
76
76
|
| prd_review | 按原9.5或10.6,使用实际授权的新上下文独立审查,核对作者与审查者上下文标识、材料摘要并原样回传。无法独立时只允许预先选定的显式self-degraded;开始后不换模式或补审。 |
|
|
77
77
|
| prd_correct | 对原findings提出完整原路径清单与逐项采纳/升级决定;不自行写规格,不新增范围/勾任务/再次review。 |
|
|
78
|
-
| prd_summary | 按原Step11
|
|
78
|
+
| prd_summary | 按原Step11核对交付形态、开放问题(先写requirement-grilling G4的倒推结果)、风险、平台/UI基准及原9.5风险信号;未知明确写待核对,不能推断人工批准。 |
|
|
79
79
|
|
|
80
80
|
读取角色Skill不代表配置模型已调用;非当前runtime角色路由被JS阻断时如实报告。
|
|
81
81
|
JS拥有日志、草稿保存、修订写入、自检轮次、审查记录、处置和审批位写入;宿主不再运行
|