@aibyzero/cm-workflow 0.15.3 → 0.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-workflow",
3
- "version": "0.15.3",
3
+ "version": "0.15.5",
4
4
  "description": "Spec-driven product development workflow for Codex: external research, PRD, implementation, read-only feature testing, review, QA, fixes, refactors, and documentation.",
5
5
  "author": {
6
6
  "name": "cm-workflow maintainers",
package/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@
7
7
 
8
8
  (暂无)
9
9
 
10
+ ## 0.15.5 — 2026-09-20
11
+
12
+ - **安装时按实际状态询问是否开启更新播报**。安装器结尾此前无条件打印「自动更新器未自动启用」:对已启用的人这句是错的(实测 hook 已配、后台更新器也在跑,仍这么说),对未启用的人它读着像普通说明而不像少配了一步——两边都没起作用,这才是装了包的人收不到新版提示的真实原因,不是缺功能。现改为检测后再说话:已配好则确认一句;未配好且交互安装则询问一次,答 y 才写入;`--yes` 与非交互安装不写任何东西,改为打印确切的 hook 条目;此前拒绝过则不再打扰(记在 `~/.cm-workflow/announce-hook-declined`,删掉该文件并重装即可重新被问)。
13
+ - 只添加播报 hook,**绝不添加后台升级器**——告知有新版与让工具自我替换是两个决定。`settings.json` 属于用户:无法解析时原文件逐字节不动、写入走临时文件加原子改名、已存在则不重复添加。安装器此前从不碰该文件,本次开的口子范围写死,只加这一条 hook 且只在明确同意时。
14
+ - 注意:只开播报而不开后台升级器时没有东西会产生播报内容(`cm-announce.sh` 只消费 `cm-update.sh` 留下的文件),两者需一起开启才有效果,详见 `docs/installation.md`。
15
+
16
+ ## 0.15.4 — 2026-09-20
17
+
18
+ - **`cm-check --quick`:约 12 秒收口的快速检查**。完整检查耗时拆分为查更新 0.7 秒、机械检查 12.4 秒,其余几乎全在八组语义检查上——那不是程序在跑,而是执行者逐个文件读取并取证行号,且控制器强制八组齐全、passed 必须附真实行号,慢是设计换来的。日常「装没装对、版本对不对」这类问题机械检查已能回答,`--quick` 让更新与机械检查照常跑、机械通过后直接收口,不进语义检查。结论为 `MECHANICAL_ONLY` 而**不是 PASSED**:八组一组没读,不得据此宣称安装完整无断链;结果带 `semanticChecked:false` 与 `reason:quick_mode_semantic_not_run`。机械失败仍照常报 FAILED/BLOCKED,快速模式不跳过任何失败。默认不带该参数时行为不变。
19
+
10
20
  ## 0.15.3 — 2026-09-20
11
21
 
12
22
  - **cm-check 在 Claude 安装上可以拿到 PASSED**:第 1 组查 `.codex-plugin/plugin.json`、第 7 组查根 `VERSION` 与根 `README.md`,三者都是 Codex 插件模式的产物,claude-compat 安装本就不该有(`install.sh` 只写 `templates/cm-VERSION`)。此前这两组只能判 blocked,健康的 Claude 安装永远停在 BLOCKED。现按安装模式分流:控制器推出 `installMode` 并下发给语义检查,语义结果新增 `not_applicable` 状态,仅第 1、7 组可用且必须写明缺的是哪个产物、为何本模式不该有;汇总时它既不算失败也不算阻塞。本模式确实拥有的产物证据不足仍记 blocked,不得借它放行。
package/README.md CHANGED
@@ -17,6 +17,15 @@
17
17
 
18
18
  ## 最近更新
19
19
 
20
+ **0.15.5**
21
+
22
+ - **安装时会问你要不要开启新版提示**。此前安装完只有一句含糊的「自动更新器未自动启用」,已经开启的人也会看到这句(是错的),没开启的人又不会当回事,结果几乎没人用上这个功能。现在安装器会先看你实际配没配,再决定说什么;没配且是手动安装时,问一句、你答 y 才写入。用 `--yes` 静默安装的不会被改动任何配置,只会打印该加什么。
23
+ - 它**只加一条「有新版就告诉你」的提示**,不会顺手打开后台自动升级——那是另一回事,仍需你自己决定。你的 `settings.json` 里原有的内容(比如自定义状态栏)不会被动。
24
+
25
+ **0.15.4**
26
+
27
+ - **`/cm-check` 新增快速模式**:日常只想确认「装没装对、版本对不对」时,跑快速检查约 12 秒出结果,不再等十几分钟。完整检查的时间几乎全花在逐个文件核对引用关系上,快速模式跳过这一段。结论会明确标为「仅机械检查」而不是「通过」——跳过的部分不会被说成检查过了。机械检查本身发现的问题照常报错,不会被跳过。
28
+
20
29
  **0.15.3**
21
30
 
22
31
  - **`/cm-check` 在 Claude 版安装上不再假报 BLOCKED**:有两组检查查的是 Codex 插件专属文件,Claude 版安装本来就没有,此前只能算「查不了」,于是健康的安装也永远拿不到 PASSED。现在按安装方式区分:不属于本安装方式的产物记为「不适用」,而真正证据不足的仍然照常阻塞——不是靠放水换来的通过。
@@ -139,7 +148,7 @@ $cm-check
139
148
 
140
149
  仓库直接分发 Skills 和脚本,无需在仓库根目录运行 `npm install` 或构建。完整安装行为、覆盖范围和卸载说明见[安装指南](docs/installation.md)。
141
150
 
142
- 需要固定版本时可使用 `npx @aibyzero/cm-workflow@0.15.3 install`,请在 CM Workflow 源码仓库以外的目录执行,例如用户主目录。npm 安装入口复用原安装器,要求与覆盖范围见[安装指南](docs/installation.md#npm-installation-macos-codex)。
151
+ 需要固定版本时可使用 `npx @aibyzero/cm-workflow@0.15.5 install`,请在 CM Workflow 源码仓库以外的目录执行,例如用户主目录。npm 安装入口复用原安装器,要求与覆盖范围见[安装指南](docs/installation.md#npm-installation-macos-codex)。
143
152
 
144
153
  ## 升级旧版本
145
154
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.15.3
1
+ 0.15.5
@@ -73,7 +73,7 @@ Install or upgrade with the same command:
73
73
  npx @aibyzero/cm-workflow@latest install
74
74
  ```
75
75
 
76
- To pin a version, use `npx @aibyzero/cm-workflow@0.15.3 install` from outside
76
+ To pin a version, use `npx @aibyzero/cm-workflow@0.15.5 install` from outside
77
77
  the CM Workflow source checkout (for example, your home directory). Inside a
78
78
  checkout with the same package name and version, npm can select the local
79
79
  uninstalled package and report `cm-workflow: command not found`.
@@ -181,7 +181,14 @@ platforms; any admitted task still uses the shared Review/N5 gates.
181
181
  ## Optional Claude auto-update (macOS/Linux)
182
182
 
183
183
  The Bash installer copies the updater on a best-effort basis but does not activate
184
- it. A copy failure is reported as a warning and does not invalidate a core runtime
184
+ it. An interactive install now asks once whether to enable the **announcement** hook
185
+ and, on yes, adds that single `hooks.SessionStart` entry for you; it never adds the
186
+ background updater, and it never edits `settings.json` without that yes. A refusal is
187
+ remembered in `~/.cm-workflow/announce-hook-declined`; delete that file and reinstall
188
+ to be asked again. `--yes` and non-interactive installs write nothing and print the
189
+ exact entry to add. Announcing a new version and letting the tool replace itself are
190
+ separate decisions, so enabling the announcement alone leaves the updater off: with no
191
+ updater scheduled there is nothing to announce, so enable it below if you want both. A copy failure is reported as a warning and does not invalidate a core runtime
185
192
  that already passed its installed self-check. The PowerShell
186
193
  installer intentionally does not copy this Bash-based updater; Windows users who
187
194
  want it must run the Bash installer from WSL or Git Bash. To enable it on a
package/install.sh CHANGED
@@ -246,4 +246,15 @@ echo
246
246
  echo "完成(已安装版本: v${VERSION})。"
247
247
  echo "建议在 Claude Code 中运行 /cm-check 校验;macOS/Linux 也保留 /cm:check 别名。"
248
248
  echo "使用手册: $DEST/cm-workflow/docs/user-guide.md"
249
- echo "自动更新器未自动启用;按 docs/installation.md 手工配置 SessionStart hook。"
249
+ # 播报 hook 的实际状态由脚本判断后再说话:此前这行无条件打印,对已启用的人是错的,
250
+ # 对未启用的人又读着像普通说明,两边都没起作用。仅在交互安装时询问,且只加播报 hook。
251
+ if [ -x "$DEST/scripts/cm-announce-hook.mjs" ] || [ -f "$DEST/scripts/cm-announce-hook.mjs" ]; then
252
+ if [ "$ASSUME_YES" -ne 1 ] && [ -t 0 ] && [ -t 1 ]; then
253
+ node "$DEST/scripts/cm-announce-hook.mjs" || true
254
+ else
255
+ CM_NONINTERACTIVE=1 node "$DEST/scripts/cm-announce-hook.mjs" </dev/null || true
256
+ fi
257
+ else
258
+ echo "自动更新器未自动启用;按 docs/installation.md 手工配置 SessionStart hook。"
259
+ fi
260
+ echo "后台自动升级仍需另行开启,见 docs/installation.md。"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibyzero/cm-workflow",
3
- "version": "0.15.3",
3
+ "version": "0.15.5",
4
4
  "description": "Spec-driven business development workflow for Pi, Codex, and Claude Code",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -38,7 +38,10 @@ function snapshot(root){
38
38
  return {files,digest:digest(files)};
39
39
  }
40
40
  export function createCmCheckHost(raw,{call}){
41
- const invocation=createCmCheckInvocation(raw),root=invocation.workflowRoot;
41
+ // --quick is a host launch choice, not part of the checker invocation contract.
42
+ const {quick=false,...invocationInput}=raw&&typeof raw==='object'&&!Array.isArray(raw)?raw:{};
43
+ need(typeof quick==='boolean','invalid_input');
44
+ const invocation=createCmCheckInvocation(invocationInput),root=invocation.workflowRoot;
42
45
  need(typeof call==='function','check_host_required');
43
46
  const controller=new AbortController();let stage='ready',mechanical=null,result=null;
44
47
  const capture=()=>{
@@ -68,6 +71,12 @@ export function createCmCheckHost(raw,{call}){
68
71
  mechanical={source:'current_host_execution_report',...response};current(baseline);
69
72
  if(response.exitCode!==0){stage='reported';result={overall:response.exitCode===null?'BLOCKED':'FAILED',mechanical,checks:[],optional:[],
70
73
  semanticChecked:false,completionAuthorized:false};return status();}
74
+ // Quick mode stops here. MECHANICAL_ONLY is deliberately not PASSED: the eight
75
+ // semantic groups were never read, so the verdict must not be quotable as a full pass.
76
+ if(quick){stage='reported';result={overall:'MECHANICAL_ONLY',installMode,
77
+ version:(readCmInitSource(root,installMode==='plugin'?'VERSION':'templates/cm-VERSION')?.toString('utf8').trim())??null,
78
+ mechanical,checks:[],optional:[],semanticChecked:false,
79
+ reason:'quick_mode_semantic_not_run',completionAuthorized:false};return status();}
71
80
  stage='semantic';
72
81
  const assessment=json(await call('check_semantic',{workflowRoot:root,project:invocation.project,sourceDigest:baseline.digest,
73
82
  scope:{directories,files:topFiles},checklist,optionalIds,installMode,
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ // Reports whether the update announcement hook is wired, and — only when the user
3
+ // says yes — adds that one SessionStart hook to their Claude settings.
4
+ //
5
+ // Scope is deliberately narrow. The installer otherwise never touches settings.json,
6
+ // which belongs to the user: it may carry their own statusline and hooks. This adds
7
+ // the announcement hook alone and never the background updater, because announcing a
8
+ // new version is not the same decision as letting the tool replace itself.
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
11
+ import os from 'node:os';
12
+ import {createInterface} from 'node:readline';
13
+
14
+ export const ANNOUNCE_COMMAND='~/.cm-workflow/cm-announce.sh';
15
+ const DECLINED='announce-hook-declined';
16
+
17
+ export const settingsPath=(env=process.env)=>
18
+ path.join(path.resolve(env.CLAUDE_HOME||path.join(env.HOME||os.homedir(),'.claude')),'settings.json');
19
+ export const declinedPath=(env=process.env)=>
20
+ path.join(path.resolve(env.CM_WORKFLOW_HOME||path.join(env.HOME||os.homedir(),'.cm-workflow')),DECLINED);
21
+
22
+ export function readSettings(file){
23
+ let text;
24
+ try{text=fs.readFileSync(file,'utf8');}catch(error){if(error.code==='ENOENT')return {};throw error;}
25
+ if(!text.trim())return {};
26
+ // A settings file we cannot parse is never rewritten: that would destroy user content.
27
+ return JSON.parse(text);
28
+ }
29
+
30
+ export const hasAnnounceHook=settings=>
31
+ (settings?.hooks?.SessionStart??[]).some(group=>
32
+ Array.isArray(group?.hooks)&&group.hooks.some(hook=>hook?.command===ANNOUNCE_COMMAND));
33
+
34
+ // Append to the existing SessionStart list; every other key and hook is preserved.
35
+ export function withAnnounceHook(settings){
36
+ const next=structuredClone(settings??{});
37
+ next.hooks??={};
38
+ const sessionStart=Array.isArray(next.hooks.SessionStart)?[...next.hooks.SessionStart]:[];
39
+ sessionStart.push({hooks:[{type:'command',command:ANNOUNCE_COMMAND,timeout:5}]});
40
+ next.hooks.SessionStart=sessionStart;
41
+ return next;
42
+ }
43
+
44
+ export function writeSettings(file,settings){
45
+ fs.mkdirSync(path.dirname(file),{recursive:true});
46
+ const temporary=`${file}.cm-announce.${process.pid}.tmp`;
47
+ fs.writeFileSync(temporary,JSON.stringify(settings,null,2)+'\n',{mode:0o600});
48
+ try{fs.renameSync(temporary,file);}finally{if(fs.existsSync(temporary))fs.unlinkSync(temporary);}
49
+ }
50
+
51
+ export async function main({env=process.env,input=process.stdin,output=process.stdout,
52
+ interactive=Boolean(process.stdin.isTTY&&process.stdout.isTTY)}={}){
53
+ const file=settingsPath(env);
54
+ let settings;
55
+ try{settings=readSettings(file);}
56
+ catch{output.write(`⚠ 无法解析 ${file},未改动它。更新播报可按 docs/installation.md 手工开启。\n`);return 0;}
57
+ if(hasAnnounceHook(settings)){output.write('更新播报已启用(新版本会在下次启动时告知)。\n');return 0;}
58
+
59
+ const declined=declinedPath(env);
60
+ if(fs.existsSync(declined)){output.write(`更新播报未启用(此前已选择不开启)。要开启:删除 ${declined} 后重新安装。\n`);return 0;}
61
+
62
+ const manual=`要开启:在 ${file} 的 hooks.SessionStart 增加 {"type":"command","command":"${ANNOUNCE_COMMAND}","timeout":5}`;
63
+ if(!interactive){output.write(`更新播报未启用。${manual}\n`);return 0;}
64
+
65
+ const rl=createInterface({input,output,terminal:false});
66
+ let answer;
67
+ try{answer=await new Promise(resolve=>{
68
+ output.write(' 开启更新播报?新版本会在下次启动 Claude Code 时告知一次。这只增加一条播报 hook,不会自动升级。[y/N] ');
69
+ rl.once('line',line=>resolve(line));rl.once('close',()=>resolve(null));
70
+ });}finally{rl.close();}
71
+
72
+ if(!/^y(es)?$/i.test((answer??'').trim())){
73
+ try{fs.mkdirSync(path.dirname(declined),{recursive:true});fs.writeFileSync(declined,'');}catch{/* 记不住也只是下次再问一次 */}
74
+ output.write(` 未开启。${manual}\n`);return 0;
75
+ }
76
+ try{writeSettings(file,withAnnounceHook(settings));}
77
+ catch{output.write(` ⚠ 写入 ${file} 失败,未改动它。${manual}\n`);return 0;}
78
+ output.write(' 已开启:下次启动 Claude Code 时会告知更新。\n');
79
+ return 0;
80
+ }
81
+
82
+ if(process.argv[1]&&fs.realpathSync(process.argv[1])===fs.realpathSync(new URL(import.meta.url).pathname))
83
+ process.exitCode=await main();
@@ -0,0 +1,90 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import {Readable,Writable} from 'node:stream';
7
+ import {main,settingsPath,declinedPath,hasAnnounceHook,withAnnounceHook,ANNOUNCE_COMMAND} from './cm-announce-hook.mjs';
8
+
9
+ function fixture(t,settings){
10
+ const home=fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(),'cm-announce-')));
11
+ t.after(()=>fs.rmSync(home,{recursive:true,force:true}));
12
+ const env={HOME:home,CLAUDE_HOME:path.join(home,'.claude'),CM_WORKFLOW_HOME:path.join(home,'.cm-workflow')};
13
+ if(settings!==undefined){
14
+ fs.mkdirSync(env.CLAUDE_HOME,{recursive:true});
15
+ fs.writeFileSync(settingsPath(env),typeof settings==='string'?settings:JSON.stringify(settings,null,2));
16
+ }
17
+ return {env,read:()=>JSON.parse(fs.readFileSync(settingsPath(env),'utf8'))};
18
+ }
19
+ const run=async(env,answer,interactive=true)=>{
20
+ let text='';
21
+ const output=new Writable({write(chunk,_e,cb){text+=chunk;cb();}});
22
+ await main({env,input:Readable.from(answer===null?[]:[`${answer}\n`]),output,interactive});
23
+ return text;
24
+ };
25
+
26
+ test('an existing hook is reported, never duplicated',async t=>{
27
+ const existing={hooks:{SessionStart:[{hooks:[{type:'command',command:ANNOUNCE_COMMAND,timeout:5}]}]}};
28
+ const f=fixture(t,existing);
29
+ const text=await run(f.env,'y');
30
+ assert.match(text,/已启用/);
31
+ assert.deepEqual(f.read(),existing,'settings must be untouched');
32
+ });
33
+
34
+ test('yes adds only the announcement hook and preserves every other setting',async t=>{
35
+ const original={statusLine:{type:'command',command:'~/.claude/statusline.sh'},
36
+ env:{FOO:'bar'},hooks:{SessionStart:[{hooks:[{type:'command',command:'~/mine.sh'}]}],
37
+ PreToolUse:[{hooks:[{type:'command',command:'~/guard.sh'}]}]}};
38
+ const f=fixture(t,original);
39
+ await run(f.env,'y');
40
+ const after=f.read();
41
+ assert.deepEqual(after.statusLine,original.statusLine,'the user statusline survives');
42
+ assert.deepEqual(after.env,original.env);
43
+ assert.deepEqual(after.hooks.PreToolUse,original.hooks.PreToolUse,'other hook kinds survive');
44
+ assert.deepEqual(after.hooks.SessionStart[0],original.hooks.SessionStart[0],'the existing SessionStart hook survives');
45
+ assert.equal(hasAnnounceHook(after),true);
46
+ assert.equal(after.hooks.SessionStart.length,2);
47
+ // The background updater is a separate decision and must never be added here.
48
+ assert.equal(JSON.stringify(after).includes('cm-update.sh'),false);
49
+ });
50
+
51
+ test('no answer leaves settings alone and is remembered',async t=>{
52
+ const f=fixture(t,{statusLine:{type:'command',command:'~/mine.sh'}});
53
+ const text=await run(f.env,'n');
54
+ assert.equal(hasAnnounceHook(f.read()),false);
55
+ assert.match(text,/未开启/);
56
+ assert.equal(fs.existsSync(declinedPath(f.env)),true);
57
+ const again=await run(f.env,'y');
58
+ assert.match(again,/此前已选择不开启/);
59
+ assert.equal(hasAnnounceHook(f.read()),false,'a remembered refusal is not overridden');
60
+ });
61
+
62
+ test('non-interactive installs never write and print the exact manual step',async t=>{
63
+ const f=fixture(t,{});
64
+ const text=await run(f.env,null,false);
65
+ assert.equal(hasAnnounceHook(f.read()),false);
66
+ assert.match(text,/hooks\.SessionStart/);
67
+ assert.match(text,new RegExp(ANNOUNCE_COMMAND.replace(/[.*+?^${}()|[\]\\]/g,'\\$&')));
68
+ assert.equal(fs.existsSync(declinedPath(f.env)),false,'declining was never asked, so nothing is remembered');
69
+ });
70
+
71
+ test('unparsable settings are reported and left byte-identical',async t=>{
72
+ const broken='{ this is not json';
73
+ const f=fixture(t,broken);
74
+ const text=await run(f.env,'y');
75
+ assert.match(text,/无法解析/);
76
+ assert.equal(fs.readFileSync(settingsPath(f.env),'utf8'),broken);
77
+ });
78
+
79
+ test('a missing settings file is created with just the hook',async t=>{
80
+ const f=fixture(t);
81
+ await run(f.env,'y');
82
+ assert.deepEqual(f.read(),{hooks:{SessionStart:[{hooks:[{type:'command',command:ANNOUNCE_COMMAND,timeout:5}]}]}});
83
+ });
84
+
85
+ test('withAnnounceHook does not mutate its input',()=>{
86
+ const input={hooks:{SessionStart:[]}};
87
+ const snapshot=JSON.stringify(input);
88
+ withAnnounceHook(input);
89
+ assert.equal(JSON.stringify(input),snapshot);
90
+ });
@@ -11,13 +11,15 @@ export async function main(argv=process.argv.slice(2),{input=process.stdin,outpu
11
11
  let bridge;
12
12
  try{
13
13
  if(argv.length===1&&argv[0]==='--help'){
14
- output.write('cm-check-host.mjs serve --skill-dir ABS_PATH --project ABS_PATH [--config ABS_PATH]\nJSONL start/status/cancel. Current host executes check_runtime once using the existing platform checker; only exitCode 0 permits check_semantic. Eight original groups + optional degradation; complete coverage and local evidence required. No provider, install, repair, task completion or persistent state. Unknown/disconnected operations never retry.\n');return 0;
14
+ output.write('cm-check-host.mjs serve --skill-dir ABS_PATH --project ABS_PATH [--config ABS_PATH] [--quick]\n--quick stops after the mechanical checker and reports MECHANICAL_ONLY; it never claims PASSED and never skips a failure.\nJSONL start/status/cancel. Current host executes check_runtime once using the existing platform checker; only exitCode 0 permits check_semantic. Eight original groups + optional degradation; complete coverage and local evidence required. No provider, install, repair, task completion or persistent state. Unknown/disconnected operations never retry.\n');return 0;
15
15
  }
16
- need(argv[0]==='serve'&&(argv.length===5||argv.length===7),'invalid_arguments');const request={};
17
- for(let i=1;i<argv.length;i+=2){
16
+ need(argv[0]==='serve','invalid_arguments');const request={};
17
+ for(let i=1;i<argv.length;){
18
+ if(argv[i]==='--quick'){need(!Object.hasOwn(request,'quick'),'invalid_arguments');request.quick=true;i+=1;continue;}
18
19
  need(['--skill-dir','--project','--config'].includes(argv[i])&&argv[i+1],'invalid_arguments');
19
- const key=argv[i]==='--skill-dir'?'skillDir':argv[i].slice(2);need(!Object.hasOwn(request,key),'invalid_arguments');request[key]=argv[i+1];
20
+ const key=argv[i]==='--skill-dir'?'skillDir':argv[i].slice(2);need(!Object.hasOwn(request,key),'invalid_arguments');request[key]=argv[i+1];i+=2;
20
21
  }
22
+ need(request.skillDir&&request.project,'invalid_arguments');
21
23
  need(path.resolve(request.skillDir??'', '../..','scripts/cm-check-host.mjs')===fileURLToPath(import.meta.url),'entry_path_invalid');
22
24
  bridge=createHostToolBridge();const host=createCmCheckHost(request,{call:(...args)=>bridge.call(...args)});
23
25
  const rawMode=input.isTTY&&typeof input.setRawMode==='function';if(rawMode)input.setRawMode(true);
@@ -133,3 +133,34 @@ test('a plugin installation keeps reporting the root VERSION', {timeout:5000}, a
133
133
  assert.equal(report.result.version,'0.0.0');
134
134
  assert.equal(report.result.overall,'PASSED');
135
135
  });
136
+
137
+ test('quick mode stops after the mechanical checker and never claims PASSED',{timeout:5000},async t=>{
138
+ const f=fixture(t);
139
+ fs.mkdirSync(path.join(f.dir,'templates'),{recursive:true});
140
+ fs.writeFileSync(path.join(f.dir,'templates/cm-VERSION'),'7.7.7\n');
141
+ const kinds=[];
142
+ const host=createCmCheckHost({...f.input,quick:true},{call:async(kind,payload)=>{
143
+ kinds.push(kind);
144
+ if(kind==='check_runtime')return mechanical(payload);
145
+ throw Error('quick mode must not request the semantic groups');
146
+ }});
147
+ const report=await host.handle({requestId:'q-1',operation:'start'});
148
+ assert.deepEqual(kinds,['check_runtime'],'the eight groups must never be requested');
149
+ assert.equal(report.result.overall,'MECHANICAL_ONLY');
150
+ assert.notEqual(report.result.overall,'PASSED','a quick run must not be quotable as a full pass');
151
+ assert.equal(report.result.semanticChecked,false);
152
+ assert.equal(report.result.reason,'quick_mode_semantic_not_run');
153
+ assert.equal(report.result.version,'7.7.7');
154
+ assert.deepEqual(report.result.checks,[]);
155
+ assert.equal(report.result.completionAuthorized,false);
156
+ });
157
+
158
+ test('quick mode still reports an actual mechanical failure',{timeout:5000},async t=>{
159
+ const f=fixture(t,3);
160
+ const host=createCmCheckHost({...f.input,quick:true},{call:async(kind,payload)=>{
161
+ assert.equal(kind,'check_runtime');return mechanical(payload);
162
+ }});
163
+ const report=await host.handle({requestId:'q-2',operation:'start'});
164
+ assert.equal(report.result.overall,'FAILED','quick mode must not swallow a failing checker');
165
+ assert.equal(report.result.semanticChecked,false);
166
+ });
@@ -46,6 +46,12 @@ node "{CM_WORKFLOW_ROOT}/scripts/cm-check-host.mjs" serve \
46
46
  --skill-dir "{CM_WORKFLOW_ROOT}/skills/cm-check" --project "$PWD"
47
47
  ```
48
48
 
49
+ 用户说「快速检查」「只看装没装对」「别跑全套」时追加 `--quick`:更新与机械检查照常跑,
50
+ 机械通过后直接收口,不进八组语义检查。结论为 `MECHANICAL_ONLY`,**不是 PASSED**——
51
+ 语义八组一组没读,不得据此宣称安装完整无断链。机械失败仍照常报 FAILED/BLOCKED,
52
+ 快速模式不跳过任何失败。默认(不带该参数)仍是完整检查。
53
+ 耗时差别很大:更新约 1 秒、机械检查约 12 秒,其余时间几乎全在语义八组逐文件取证上。
54
+
49
55
  如果配置文件不在项目根目录,可额外传 `--config {CONFIG_PATH}`;不传时会读取项目根
50
56
  目录的 `.cm-workflow.yml` / `.yaml` / `.json`。
51
57
 
@@ -83,7 +89,7 @@ Claude 兼容: {通过/失败}
83
89
  状态与审查: {通过/断链清单}
84
90
  模板与版本: {通过/不一致清单}
85
91
  可选增强: {已配置/降级项}
86
- 结论: PASSED / FAILED ({N} 处) / BLOCKED(附未查完的组)
92
+ 结论: PASSED / FAILED ({N} 处) / BLOCKED(附未查完的组) / MECHANICAL_ONLY(--quick,未做语义检查)
87
93
  ```
88
94
 
89
95
  第 1、7 组的 `not_applicable` 只适用于另一种安装模式独有的产物,且必须写明缺的是哪个文件、为何本模式不该有;