@aibyzero/cm-workflow 0.21.5 → 0.21.7
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 +13 -0
- package/README.md +14 -3
- package/VERSION +1 -1
- package/docs/installation.md +7 -7
- package/docs/runtime-failover.md +5 -3
- package/docs/user-guide.md +5 -5
- package/install.ps1 +3 -0
- package/install.sh +2 -0
- package/package.json +1 -1
- package/runtime/js/cm-ai/checkpoint-package-material.mjs +9 -2
- package/runtime/js/cm-ai/tool-preview.mjs +6 -0
- package/runtime/js/cm-check/host.mjs +37 -8
- package/runtime/review.md +1 -0
- package/runtime/workflow-config.md +1 -1
- package/scripts/cm-ai-checkpoint-package-material.test.mjs +28 -0
- package/scripts/cm-check-doc-links.mjs +29 -0
- package/scripts/cm-check-host.test.mjs +46 -0
- package/scripts/cm-check-runtime.sh +15 -0
- package/scripts/cm-claude-install-layout.test.mjs +12 -0
- package/scripts/cm-codex-clean-env.test.mjs +40 -0
- package/scripts/cm-doc-links-shared.mjs +139 -0
- package/scripts/cm-doc-links.test.mjs +110 -0
- package/scripts/cm-rewrite-doc-links.mjs +34 -0
- package/scripts/cm-runtime-i18n.mjs +3 -3
- package/scripts/cm-runtime-install.mjs +19 -10
- package/scripts/cm-runtime.mjs +2 -4
- package/scripts/cm-runtime.test.mjs +55 -13
- package/scripts/cm-statusline.test.mjs +54 -0
- package/skills/cm-ai/references/N1-init.md +4 -3
- package/skills/cm-ai/references/N4-review.md +4 -1
- package/skills/cm-ai/references/js-host.md +12 -1
- package/skills/cm-check/SKILL.md +1 -1
- package/skills/cm-runtime/SKILL.md +6 -6
- package/templates/statusline/cm-statusline.sh +63 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cm-workflow",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.7",
|
|
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
|
@@ -5,6 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
## 未发布
|
|
7
7
|
|
|
8
|
+
(暂无)
|
|
9
|
+
|
|
10
|
+
## 0.21.7 — 2026-11-27
|
|
11
|
+
|
|
12
|
+
- **运行时向导默认选 Claude**:安装向导与 `cm-runtime` 直接回车选只用 Claude / Claude 写 Codex 审;保存需每次随机的 8 位确认码,预先粘贴的行丢弃,EOF 无换行尾行取消。
|
|
13
|
+
- **审查通道遵守声明**:声明审查者为 `claude-cli` 时,N1/N4/review 不再先试 Codex;`js-host.md` 说明审查端选择。已知限制:JS 默认入口不强制遵守声明,批次入口在 `claude-only` 项目的 Codex 会话仍由 Codex 审。
|
|
14
|
+
- **状态栏只显示当前会话项目的状态**:按 Claude Code 传入的 cwd 判断,排除过宽根与已删目录;规格与代码目录互不包含时不显示(已知限制)。
|
|
15
|
+
|
|
16
|
+
## 0.21.6 — 2026-11-25
|
|
17
|
+
|
|
18
|
+
- **修复 Claude 兼容安装下技能的 docs 链接失效**:安装时把本包技能里的 `../docs/` 链接改写为 `../cm-workflow/docs/`,并随包写入范围清单,`cm-check` 机器检查链接可达且不误查用户自装技能;`cm-notify` 不属于读取运行时合同的核心技能,第 2 组口径与检查一并改正。
|
|
19
|
+
- **修复 `cm-check-drive` 被大文件误阻断**:快照不再让超过 1MB 的非 CM 文本触发 `init_draft_target_invalid`,超限文件按内容摘要或大小与时间核对漂移,阻断信息带出具体文件路径。
|
|
20
|
+
|
|
8
21
|
## 0.21.5 — 2026-11-25
|
|
9
22
|
|
|
10
23
|
- **cm-prd 设计阶段支持修正后窄审,最多两轮**:设计审查返回问题、原修正保存后,同一份审查包下可用 `narrow_review` 记录窄审(审查方、会话、逐条分级、四个是否题、阻断触发场景),作者据此再修正,每轮修正必须有对应审查记录并逐项写处置;第三轮被拒,第二轮仍有阻断停在「待用户拍板」,不自动放行。有窄审记录时,原处置回执和旧入口 `record` 都要窄审通过。只对新写出的原修正存档生效,在途旧运行与 split 阶段不变。
|
package/README.md
CHANGED
|
@@ -17,6 +17,17 @@
|
|
|
17
17
|
|
|
18
18
|
## 最近更新
|
|
19
19
|
|
|
20
|
+
**0.21.7**
|
|
21
|
+
|
|
22
|
+
- **运行时向导默认选 Claude**:安装向导和 `cm-runtime` 直接回车就是只用 Claude、Claude 写 Claude 审;保存配置要输入每次随机的 8 位确认码,粘贴的旧输入不会误保存。
|
|
23
|
+
- **声明 Claude 审查后不再先试 Codex**:兼容流程的审查通道说明改为遵守声明;JS 默认入口的限制写进 `js-host.md`。
|
|
24
|
+
- **状态栏不再串项目**:只显示属于当前会话项目的 CM 状态,别处的旧状态不显示。详见[更新日志](CHANGELOG.md)。
|
|
25
|
+
|
|
26
|
+
**0.21.6**
|
|
27
|
+
|
|
28
|
+
- **修复 Claude 兼容安装下技能里的文档链接失效**:技能里指向 `docs/` 的链接装完后能打开;`cm-check` 新增链接可达检查,不会误查你自己装的技能。
|
|
29
|
+
- **修复 `cm-check` 被大文件误阻断**:技能目录里有超过 1MB 的文本(如其他技能自带的压缩脚本)时不再启动即报 `init_draft_target_invalid`,阻断信息会指出具体文件。详见[更新日志](CHANGELOG.md)。
|
|
30
|
+
|
|
20
31
|
**0.21.5**
|
|
21
32
|
|
|
22
33
|
- **cm-ai 新任务支持软链**:项目里有软链不再一建基线就报错;开发可以新建、改指向或删除软链,CM 会核对它不指出项目、不指进 `.git` 和规格目录。已有任务不受影响。
|
|
@@ -104,7 +115,7 @@
|
|
|
104
115
|
|
|
105
116
|
- **运行时配置默认保留**:打开 `cm-runtime` 先看当前配置和来源,主动选择修改才进入预设向导;高级模型入口只提供说明和校验方法。
|
|
106
117
|
- **外部模型按 provider 配置**:单任务、批次及修复可显式启用 `cm-model-setup.mjs` 的模型及可选强度;宿主保持当前模型,run 冻结参数,未知调用停止重派。见[配置与恢复边界](docs/external-models.md)。
|
|
107
|
-
-
|
|
118
|
+
- **确认前看清影响**:预览目标、字段变化和项目覆盖关系,最终要输入预览显示的 8 位确认码,回车或输错都不保存;确认期间配置改变会要求重新预览。安装后的配置可跳过,已有用户默认优先保留。
|
|
108
119
|
- **保留模型别名并提示兼容性**:切换预设不改已有模型或正在运行的任务;配置校验不代表新适配器一定支持该模型。
|
|
109
120
|
|
|
110
121
|
**0.16.5**
|
|
@@ -293,7 +304,7 @@ $cm-check
|
|
|
293
304
|
|
|
294
305
|
仓库直接分发 Skills 和脚本,无需在仓库根目录运行 `npm install` 或构建。完整安装行为、覆盖范围和卸载说明见[安装指南](docs/installation.md)。
|
|
295
306
|
|
|
296
|
-
需要固定版本时可使用 `npx @aibyzero/cm-workflow@0.21.
|
|
307
|
+
需要固定版本时可使用 `npx @aibyzero/cm-workflow@0.21.7 install`,请在 CM Workflow 源码仓库以外的目录执行,例如用户主目录。npm 安装入口复用原安装器,要求与覆盖范围见[安装指南](docs/installation.md#npm-installation-macos-codex)。
|
|
297
308
|
|
|
298
309
|
## 升级旧版本
|
|
299
310
|
|
|
@@ -479,7 +490,7 @@ Pi 资源加载器直接发现 Skills 与 Prompts,不运行上述安装器,
|
|
|
479
490
|
|
|
480
491
|
## 配置与深入阅读
|
|
481
492
|
|
|
482
|
-
|
|
493
|
+
交互安装可跳过运行时配置;已有用户默认优先保留,主动配置后再输入预览显示的 8 位确认码确认保存到 `~/.cm-workflow/runtimes.yml`。`--yes` / `-Yes` 或非 TTY 跳过且不写。运行时声明按 **项目 > 用户级默认 > 未声明** 解析。`$cm-runtime` 默认查看并保留,主动修改时预览影响、保留模型别名,配置改变后须重新确认;已创建 run 保留原配置。
|
|
483
494
|
|
|
484
495
|
配置独立审查时,`--review-model` 要写本机 CLI 实际接受的完整模型 id,预检会替你核对;真实审查一次常超过一分钟,建议在审查配置里把 `timeoutMs` 调大(上限一小时)。没等到结果就超时时记为可续跑的审查超时,同一轮最多重派一次;已经收到部分结果的超时要先核对,不会自动重派。
|
|
485
496
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.21.
|
|
1
|
+
0.21.7
|
package/docs/installation.md
CHANGED
|
@@ -76,7 +76,7 @@ Install or upgrade with the same command:
|
|
|
76
76
|
npx @aibyzero/cm-workflow@latest install
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
To pin a version, use `npx @aibyzero/cm-workflow@0.21.
|
|
79
|
+
To pin a version, use `npx @aibyzero/cm-workflow@0.21.7 install` from outside
|
|
80
80
|
the CM Workflow source checkout (for example, your home directory). Inside a
|
|
81
81
|
checkout with the same package name and version, npm can select the local
|
|
82
82
|
uninstalled package and report `cm-workflow: command not found`.
|
|
@@ -566,7 +566,7 @@ offer an optional user-default setup. First-time setup defaults to skipping; an
|
|
|
566
566
|
declaration is displayed and “Keep it? [Y/n]” defaults to keeping it.
|
|
567
567
|
Only opting in asks which tools you have: Codex only, Claude only, or both, and which
|
|
568
568
|
tool codes when both are selected. Preview the target, fields and impact, then explicitly
|
|
569
|
-
|
|
569
|
+
type the 8-character confirmation code shown with the preview to save. Enter or any other input at this final step does not save.
|
|
570
570
|
The shared prompt writes only `~/.cm-workflow/runtimes.yml` using a temporary file
|
|
571
571
|
and atomic rename. It never changes settings.json or CLAUDE.md.
|
|
572
572
|
An invalid existing declaration is reported and preserved; setup does not overwrite it.
|
|
@@ -593,13 +593,13 @@ without arguments to display current effective configuration, source and model a
|
|
|
593
593
|
`[1] Keep current configuration (recommended, default)`, `[2] Change runtime preset`, or
|
|
594
594
|
`[3] Advanced model configuration` (documentation and validation only). Keeping missing
|
|
595
595
|
configuration does not create any file. Only option 2 starts the wizard:
|
|
596
|
-
`[1] Current project / [2] User default` → `[1] Codex only / [2] Claude only / [3] Both`
|
|
597
|
-
(with `[1] Codex writes, Claude reviews
|
|
598
|
-
when both are selected) → preview the fields and effective impact
|
|
596
|
+
`[1] Current project / [2] User default` → `[1] Codex only / [2] Claude only (default) / [3] Both`
|
|
597
|
+
(with `[1] Codex writes, Claude reviews / [2] Claude writes, Codex reviews (default)`
|
|
598
|
+
when both are selected) → preview the fields and effective impact; in the conversation, save only after you explicitly agree in your own reply (the 8-character confirmation code appears only in the terminal wizard).
|
|
599
599
|
In a terminal, `node <workflow-root>/scripts/cm-runtime.mjs [--project PATH]` opens the same wizard.
|
|
600
600
|
Scope defaults to 1 with an existing project config, otherwise 2. Choosing 1 without a config
|
|
601
|
-
announces creation from the template.
|
|
602
|
-
|
|
601
|
+
announces creation from the template. Enter at the tool question or the writer question picks Claude (the default). Ctrl+C,
|
|
602
|
+
EOF, a wrong or empty confirmation code, or Enter at confirmation
|
|
603
603
|
cancels without writing. Invalid configuration is reported and preserved, not automatically repaired.
|
|
604
604
|
Project overrides are shown explicitly. Model aliases are retained across adapter changes;
|
|
605
605
|
validation does not prove provider compatibility, model access or quota.
|
package/docs/runtime-failover.md
CHANGED
|
@@ -84,11 +84,13 @@ cm-ai-host failover: CLI 可解析不等于配额可用;本次切换只决定
|
|
|
84
84
|
### 限制
|
|
85
85
|
|
|
86
86
|
- **只决定起跑运行时**,任务开始后不再切换;中途失效由 L1 交接接手。
|
|
87
|
-
- 与 `--protected-config` 互斥(protected
|
|
87
|
+
- 与 `--protected-config` 互斥(protected 模式按 roles 自行选开发/审查端,不走起跑选路),组合报
|
|
88
88
|
`failover_unsupported_in_protected_mode`。
|
|
89
89
|
- 当前会话 host 下 developer 与 reviewer 共用同一 runtime 参数,选路按
|
|
90
|
-
`developer` 角色进行。要让 N4
|
|
91
|
-
`
|
|
90
|
+
`developer` 角色进行。要让 N4 跨模型,普通宿主显式传 `--review-runtime {另一端}`(并按
|
|
91
|
+
`skills/cm-ai/references/js-host.md` 用审查端生成预检、配 `--review-config`),或走
|
|
92
|
+
`codex-review` skill。与 `--failover` 同用时,起跑端若因故障切到另一端,开发端与声明不符,
|
|
93
|
+
宿主会以 `runtime_selection_mismatch` 拒绝,声明端 CLI 仍不可用时,去掉 `--failover` 并先恢复该端,或改项目声明。
|
|
92
94
|
|
|
93
95
|
## 定点测试
|
|
94
96
|
|
package/docs/user-guide.md
CHANGED
|
@@ -796,7 +796,7 @@ $cm-security {项目路径} --semgrep-rules {外部本地规则文件} --osv-db
|
|
|
796
796
|
|
|
797
797
|
交互安装在核心成功后提供可跳过的用户默认配置入口;已有文件显示当前值并默认保留。
|
|
798
798
|
主动配置才询问“只有 Codex / 只有 Claude / 两个都有”,两家都有再问谁写代码,
|
|
799
|
-
|
|
799
|
+
预览后输入显示的 8 位确认码才保存为 `~/.cm-workflow/runtimes.yml`,回车或输错都不保存。
|
|
800
800
|
`--yes` / `-Yes` 或非 TTY 跳过提问且不写文件。测试时可用 `CM_WORKFLOW_HOME` 覆盖目录。
|
|
801
801
|
|
|
802
802
|
优先级:**项目 > 用户级默认 > 未声明**。项目没有 `runtimes.available` 才读取用户文件;
|
|
@@ -814,11 +814,11 @@ $cm-security {项目路径} --semgrep-rules {外部本地规则文件} --osv-db
|
|
|
814
814
|
直接输入 `$cm-runtime`(Claude Code 为 `/cm-runtime`)会先展示当前有效配置、来源和模型别名,
|
|
815
815
|
提供 `[1] 保留当前配置(推荐,默认)`、`[2] 修改运行时预设`、`[3] 查看高级模型配置说明`。
|
|
816
816
|
保留时不写文件,配置缺失也不会创建;高级选项只显示说明与校验方法。只有选 2 才进入:
|
|
817
|
-
`[1] 当前项目 / [2] 用户级默认` → `[1] 只有 Codex / [2] 只有 Claude / [3] 两个都有`
|
|
818
|
-
(选 3 再选 `[1] Codex 写、Claude
|
|
817
|
+
`[1] 当前项目 / [2] 用户级默认` → `[1] 只有 Codex / [2] 只有 Claude(默认) / [3] 两个都有`
|
|
818
|
+
(选 3 再选 `[1] Codex 写、Claude 审 / [2] Claude 写、Codex 审(默认)`)→ 预览后由你在对话里明确回复同意才保存(8 位确认码只出现在终端向导)。
|
|
819
819
|
终端无参数运行 `node <workflow-root>/scripts/cm-runtime.mjs [--project PATH]` 进入同一向导。
|
|
820
|
-
有项目配置时范围默认 1,否则默认 2;无配置选 1
|
|
821
|
-
Ctrl+C、EOF
|
|
820
|
+
有项目配置时范围默认 1,否则默认 2;无配置选 1 会提示从模板新建。工具问题与写代码问题直接回车默认选 Claude;
|
|
821
|
+
Ctrl+C、EOF、拒绝确认或最终确认直接回车均不写。
|
|
822
822
|
预览显示目标文件/范围、字段前后值、当前项目保存后的实际有效值;项目声明覆盖用户默认时会说明
|
|
823
823
|
当前项目不会切换。模型别名保持原样,但更换适配器后可能不兼容。校验不证明模型可调用或配额可用。
|
|
824
824
|
等待确认时相关配置改变会拒绝旧确认,须重新预览;无效配置报告错误并保留,不自动修复。
|
package/install.ps1
CHANGED
|
@@ -114,6 +114,9 @@ try {
|
|
|
114
114
|
Stage-Tree (Join-Path $Src "docs") "cm-workflow\docs"
|
|
115
115
|
Stage-Tree (Join-Path $Src "assets") "cm-workflow\assets"
|
|
116
116
|
Stage-File (Join-Path $Src "README.md") "cm-workflow\README.md"
|
|
117
|
+
# docs 装在 cm-workflow\docs,技能里的 ../docs/ 相对链接要跟着改写。
|
|
118
|
+
node (Join-Path $Src "scripts\cm-rewrite-doc-links.mjs") $Stage | Out-Null
|
|
119
|
+
if ($LASTEXITCODE -ne 0) { throw "改写文档链接失败。" }
|
|
117
120
|
|
|
118
121
|
foreach ($pair in @(
|
|
119
122
|
@("dashboard", "dashboard"),
|
package/install.sh
CHANGED
|
@@ -374,6 +374,8 @@ done
|
|
|
374
374
|
stage_tree "$SRC_DIR/docs" "cm-workflow/docs"
|
|
375
375
|
stage_tree "$SRC_DIR/assets" "cm-workflow/assets"
|
|
376
376
|
stage_file "$SRC_DIR/README.md" "cm-workflow/README.md"
|
|
377
|
+
# docs 装在 cm-workflow/docs/,技能里的 ../docs/ 相对链接要跟着改写。
|
|
378
|
+
node "$SRC_DIR/scripts/cm-rewrite-doc-links.mjs" "$STAGE" >/dev/null || { echo "改写文档链接失败,安装已停止,未修改任何文件。" >&2; exit 1; }
|
|
377
379
|
|
|
378
380
|
for wrapper in "$SRC_DIR"/compat/claude-commands/cm-*.md; do
|
|
379
381
|
name="$(basename "$wrapper" .md)"
|
package/package.json
CHANGED
|
@@ -17,7 +17,11 @@ const sameRun=(left,right)=>same({...left,attempt:right.attempt},right);
|
|
|
17
17
|
// It is not scope authority, a recovery grant, or a requirement to revise scope.
|
|
18
18
|
export function packageMaterialEligible(rawConfig,version=3){
|
|
19
19
|
try{const config=json(rawConfig,STATE_LIMIT),policy=config.controlPolicy;
|
|
20
|
-
|
|
20
|
+
// verification 是 control policy 的合法可选项(取值规则同 readControlPolicy):漏掉它会让开了验证闸门的运行
|
|
21
|
+
// 永远不能存档审查包,审查包稍大就卡在开工前(实跑实拦)。验证闸门与存储表示正交,这里只放行这一项
|
|
22
|
+
const verifies=policy!==null&&typeof policy==='object'&&Object.hasOwn(policy,'verification');
|
|
23
|
+
validIdentity(config.identity);shape(policy,['version','development','bootstrap','qa','qaFix',...(verifies?['verification']:[])]);
|
|
24
|
+
must(!verifies||['disabled','precheck','auto'].includes(policy.verification));
|
|
21
25
|
must(['disabled','run'].includes(policy.qa)&&['disabled','manual','auto'].includes(policy.qaFix)
|
|
22
26
|
&&(policy.qaFix==='disabled'||policy.qa==='run'));
|
|
23
27
|
return version===3&&typeof config.root==='string'&&path.isAbsolute(config.root)
|
|
@@ -157,7 +161,10 @@ export function checkpointStoragePlan({records:rawRecords,effectId,checkpoint:ra
|
|
|
157
161
|
// Those later records enforce their actual limit, not that future reserve again;
|
|
158
162
|
// a review or completion (including a reconciled review invocation) cannot
|
|
159
163
|
// introduce a first material archive.
|
|
160
|
-
|
|
164
|
+
// 同理,不是合法存档来源的开发检查点(不在待审、或包不属于本轮,如第二轮失败仍保留的第一轮内联包)也不能
|
|
165
|
+
// 开第一份存档:资格可能在运行中途翻转(升级后放行 verification),这时照旧内联,按记录上限落盘(Codex 审查实拦)
|
|
166
|
+
const source=effect.kind==='develop'&&checkpoint.state==='awaiting_review'&&same(pkg.identity,identity)&&checkpoint.attempt===pkg.identity.attempt;
|
|
167
|
+
if(!ref&&!source){
|
|
161
168
|
must(size(payload)<=JOURNAL_PAYLOAD_LIMIT);return freeze({checkpoint,payloadFields:{}});
|
|
162
169
|
}
|
|
163
170
|
const budget=checkpointPackageBudget({inlineBytes:size(payload),packageBytes:size(pkg),reserve,enabled,referenced:ref!==null});
|
|
@@ -136,6 +136,12 @@ export async function previewTools({ cwd, model, effort, fixtureResponse = false
|
|
|
136
136
|
transport.argument];
|
|
137
137
|
const env = cleanEnvironment();
|
|
138
138
|
env.CM_JS_PROBE_AUTH = 'cm-js-synthetic-local-probe';
|
|
139
|
+
// The probe sink only listens on 127.0.0.1. cleanEnvironment drops the host's proxy
|
|
140
|
+
// bypass list, so on a macOS system proxy (e.g. Clash on 127.0.0.1) Codex sent this
|
|
141
|
+
// loopback request through the proxy, got 502 and the preflight failed (2026-11-25,
|
|
142
|
+
// codex-cli 0.167.0). Exempt only the fixed loopback address, never copy host values.
|
|
143
|
+
env.NO_PROXY = '127.0.0.1';
|
|
144
|
+
env.no_proxy = '127.0.0.1';
|
|
139
145
|
let result;
|
|
140
146
|
try {
|
|
141
147
|
result = await new Promise((resolve, reject) => {
|
|
@@ -6,8 +6,17 @@ import {createCmCheckInvocation} from '../../../scripts/cm-check-entry.mjs';
|
|
|
6
6
|
import {readCmInitSource} from '../cm-init/draft-inspection.mjs';
|
|
7
7
|
import {need,shape,json,digest} from '../cm-ai/effect-contract.mjs';
|
|
8
8
|
|
|
9
|
-
const directories=['skills','runtime','agents','compat/claude-commands','templates','scripts','.codex-plugin'];
|
|
10
|
-
const topFiles=['VERSION','README.md','package.json','install.sh','install.ps1','install-codex.sh','install-codex.ps1'];
|
|
9
|
+
const directories=['skills','runtime','agents','compat/claude-commands','templates','scripts','.codex-plugin','docs','cm-workflow/docs'];
|
|
10
|
+
const topFiles=['cm-workflow/doc-links-scope.txt','VERSION','README.md','package.json','install.sh','install.ps1','install-codex.sh','install-codex.ps1'];
|
|
11
|
+
const READ_LIMIT=1048576; // 与 readCmInitSource 的单文件上限一致
|
|
12
|
+
const OVERSIZE_HASH_LIMIT=16*1024*1024;
|
|
13
|
+
function readOversize(file,size){
|
|
14
|
+
const fd=fs.openSync(file,fs.constants.O_RDONLY|fs.constants.O_NOFOLLOW);
|
|
15
|
+
try{
|
|
16
|
+
const opened=fs.fstatSync(fd);need(opened.isFile()&&opened.nlink===1&&opened.size===size,'check_source_changed');
|
|
17
|
+
const bytes=Buffer.alloc(size);need(fs.readSync(fd,bytes,0,size,0)===size,'check_source_changed');return bytes;
|
|
18
|
+
}finally{fs.closeSync(fd);}
|
|
19
|
+
}
|
|
11
20
|
const optionalIds=['statusline','updater','subagents','isolated_review','external_browser'];
|
|
12
21
|
// Groups 1 and 7 inspect the Codex plugin manifest, the root VERSION and the root README.
|
|
13
22
|
// A Claude-compatible installation legitimately owns none of them, so only these two may be
|
|
@@ -24,14 +33,27 @@ function snapshot(root){
|
|
|
24
33
|
if(stat.isDirectory()){
|
|
25
34
|
need(fs.realpathSync(target)===target,'check_source_path_changed');
|
|
26
35
|
files[relative]={directory:true};
|
|
27
|
-
|
|
36
|
+
let names;
|
|
37
|
+
try{names=fs.readdirSync(target).sort();}catch(error){if(error&&typeof error==='object')error.file=relative;throw error;}
|
|
38
|
+
for(const name of names)visit(relative+'/'+name);
|
|
28
39
|
}else{
|
|
29
40
|
need(stat.isFile()&&stat.nlink===1,'check_source_file_invalid');
|
|
30
|
-
|
|
41
|
+
// 超过 readCmInitSource 单文件上限(1MB)的文本(如非 CM 技能自带的 babel.min.js,约 3MB)不再走它,
|
|
42
|
+
// 否则整次检查会以 init_draft_target_invalid 阻断(2026-11 反馈:~/.claude/skills/huashu-design)。
|
|
43
|
+
// 仍要发现检查期间的改动:16MB 内的按内容算摘要,更大的只记大小与修改时间。
|
|
44
|
+
const text=/\.(?:md|mjs|js|json|ya?ml|py|sh|ps1|toml|txt|ts|css|html)$/.test(relative)||relative==='VERSION';
|
|
45
|
+
if(text&&stat.size<=READ_LIMIT){
|
|
31
46
|
bytes+=stat.size;need(bytes<=64*1024*1024,'check_inventory_limit');
|
|
32
|
-
|
|
47
|
+
let data;
|
|
48
|
+
try{data=readCmInitSource(root,relative);need(data!==null,'check_source_changed');}
|
|
49
|
+
catch(error){if(error&&typeof error==='object')error.file=relative;throw error;}
|
|
33
50
|
files[relative]={digest:digest(data.toString('base64')),lines:data.toString('utf8').split('\n').length};
|
|
34
|
-
}else
|
|
51
|
+
}else if(text&&stat.size<=OVERSIZE_HASH_LIMIT){
|
|
52
|
+
bytes+=stat.size;need(bytes<=64*1024*1024,'check_inventory_limit');
|
|
53
|
+
let data;
|
|
54
|
+
try{data=readOversize(target,stat.size);}catch(error){if(error&&typeof error==='object')error.file=relative;throw error;}
|
|
55
|
+
files[relative]={size:stat.size,mode:stat.mode&0o777,oversized:true,digest:digest(data.toString('base64')),lines:data.toString('utf8').split('\n').length};
|
|
56
|
+
}else files[relative]={size:stat.size,mode:stat.mode&0o777,...(text?{oversized:true,mtimeMs:stat.mtimeMs,ctimeMs:stat.ctimeMs}:{})};
|
|
35
57
|
}
|
|
36
58
|
}
|
|
37
59
|
for(const relative of [...directories,...topFiles])visit(relative);
|
|
@@ -51,7 +73,14 @@ export function createCmCheckHost(raw,{call}){
|
|
|
51
73
|
return {...source,digest:digest({source:source.digest,configs})};
|
|
52
74
|
};
|
|
53
75
|
const status=()=>json({stage,mechanical,result,completionAuthorized:false});
|
|
54
|
-
const current=baseline=>
|
|
76
|
+
const current=baseline=>{
|
|
77
|
+
const now=capture();
|
|
78
|
+
if(now.digest===baseline.digest)return;
|
|
79
|
+
const e=new Error('check_source_changed');e.code='check_source_changed';
|
|
80
|
+
const keys=[...new Set([...Object.keys(baseline.files),...Object.keys(now.files)])].sort();
|
|
81
|
+
const file=keys.find(k=>JSON.stringify(baseline.files[k])!==JSON.stringify(now.files[k]));
|
|
82
|
+
if(file)e.file=file;throw e;
|
|
83
|
+
};
|
|
55
84
|
async function start(){
|
|
56
85
|
need(stage==='ready','check_already_started');stage='mechanical';
|
|
57
86
|
try{
|
|
@@ -110,7 +139,7 @@ export function createCmCheckHost(raw,{call}){
|
|
|
110
139
|
findingsCount:assessment.checks.filter(row=>row.status==='failed').reduce((sum,row)=>sum+row.findings.length,0),
|
|
111
140
|
semanticChecked:true,completionAuthorized:false};
|
|
112
141
|
stage='reported';return status();
|
|
113
|
-
}catch(error){stage=controller.signal.aborted?'cancelled':'blocked';result={overall:'BLOCKED',reason:error?.code??'check_failed',completionAuthorized:false};return status();}
|
|
142
|
+
}catch(error){stage=controller.signal.aborted?'cancelled':'blocked';result={overall:'BLOCKED',reason:error?.code??'check_failed',...(typeof error?.file==='string'?{file:error.file}:{}),completionAuthorized:false};return status();}
|
|
114
143
|
}
|
|
115
144
|
return Object.freeze({async handle(request){
|
|
116
145
|
shape(request,['requestId','operation']);
|
package/runtime/review.md
CHANGED
|
@@ -52,6 +52,7 @@ New cm-ai runs additionally bind `specification` into the baseline, developer re
|
|
|
52
52
|
|
|
53
53
|
## Channel order
|
|
54
54
|
|
|
55
|
+
0. Project declares `roles.reviewer.adapter: claude-cli` (including `claude-only`): go straight to item 3; do not try Codex first. This governs the compatibility flow; the ordinary JS host reviews with the current tool unless `--review-runtime` is passed (see `skills/cm-ai/references/js-host.md`).
|
|
55
56
|
1. `codex-subagent`: spawn a fresh reviewer/subagent with the runtime's no-history/fresh-context option (for example `fork_turns: none`) and provide only the review package. Ask for concrete failure scenarios, ordered by severity, and require an explicit zero-findings result when applicable.
|
|
56
57
|
2. `codex-cli`: if subagents are unavailable, run `codex review` only when the task changes are isolated from unrelated dirty work (clean pre-task tree or isolated worktree/commit).
|
|
57
58
|
3. `claude-cli`: when selected by the project declaration, the protected host must actually spawn a fresh Claude reviewer and recover its registered V3 receipt before recording `independent: true`. A two-provider declaration requires coder and reviewer on different providers; a single-provider declaration uses a fresh context on that provider.
|
|
@@ -151,7 +151,7 @@ preset: codex-codes
|
|
|
151
151
|
`cm-runtime show [--project PATH]` 只读;`set <preset> [--project PATH]` 原子改项目;
|
|
152
152
|
`set --user <preset>` 改用户默认;`unset --user` 删除用户默认但不删除项目声明。
|
|
153
153
|
无参数先显示有效配置、来源与模型,默认保留;高级模型入口只提供说明和现有校验方法。
|
|
154
|
-
|
|
154
|
+
终端/会话向导和安装器的最终确认要输入提问时随机生成的 8 位确认码,回车或输错都不写;无效配置保留并报告错误。
|
|
155
155
|
`preview <preset> [--project PATH | --user] [--json]` 只读生成候选,复用同一合并和校验逻辑,
|
|
156
156
|
展示范围、目标、字段前后值、项目覆盖和保留模型。`set ... --expect-preview <preview_sha256>`
|
|
157
157
|
核对项目、范围、预设、候选内容及相关输入快照;漂移后必须重新预览确认。两次调用保持相同
|
|
@@ -175,6 +175,28 @@ test('r2 failed develop may retain the r1 package and exact r1 archive without s
|
|
|
175
175
|
assert.throws(()=>resolveCheckpointPackage(replaced,records,nextIdentity),invalid);
|
|
176
176
|
});
|
|
177
177
|
|
|
178
|
+
// Codex 审查实拦:资格可能在运行中途翻转(升级后 verification 运行才可存档)。第一轮包当时内联、没有存档,
|
|
179
|
+
// 第二轮开发失败仍保留它时,失败检查点不是合法存档来源(不在待审、包不属于本轮):必须照旧内联落盘,
|
|
180
|
+
// 不能标 packageMaterial 让存储失败、把本该持久化的失败结果丢掉
|
|
181
|
+
test('r2 failed develop retaining an inline (unarchived) r1 package stays inline when it cannot source an archive',()=>{
|
|
182
|
+
const material=pkg(700000);let records=append([],{version:3,protocol:'cm-task-runner',type:'init',config:{identity}});
|
|
183
|
+
records=intent(records,'develop-1');records=append(records,payload('develop-1',frame(material)));
|
|
184
|
+
const nextIdentity={...identity,attempt:2};records=intent(records,'develop-2','develop',nextIdentity);
|
|
185
|
+
const checkpoint=frame(material,'develop-2','develop','blocked',nextIdentity);
|
|
186
|
+
checkpoint.code='verification_precheck_failed';checkpoint.receiptPadding='p'.repeat(100000);
|
|
187
|
+
const reserve=272125,inline=Math.min(JOURNAL_PAYLOAD_LIMIT,1024*1024)-reserve;
|
|
188
|
+
const p0=payload('develop-2',checkpoint);
|
|
189
|
+
assert(size(p0)>inline&&size(p0)<=JOURNAL_PAYLOAD_LIMIT,'fixture crosses the inline budget yet fits one record');
|
|
190
|
+
for(const enabled of [false,true]){
|
|
191
|
+
const plan=checkpointStoragePlan({records,effectId:'develop-2',checkpoint,identity:nextIdentity,enabled,reserve});
|
|
192
|
+
assert.deepEqual(plan.payloadFields,{},String(enabled));assert.deepEqual(plan.checkpoint,checkpoint);
|
|
193
|
+
assert.deepEqual(resolveCheckpointPackage(payload('develop-2',plan.checkpoint,plan.payloadFields),records,nextIdentity),checkpoint);
|
|
194
|
+
}
|
|
195
|
+
// 当前轮待审的开发检查点仍是合法来源:照常存档,修复不放过本该存档的大包
|
|
196
|
+
const fresh=frame(pkg(700000,nextIdentity),'develop-2','develop','awaiting_review',nextIdentity);fresh.receiptPadding='p'.repeat(100000);
|
|
197
|
+
assert.deepEqual(checkpointStoragePlan({records,effectId:'develop-2',checkpoint:fresh,identity:nextIdentity,enabled:true,reserve}).payloadFields,{packageMaterial:true});
|
|
198
|
+
});
|
|
199
|
+
|
|
178
200
|
test('a package above the original record limit cannot be admitted by material storage and no reserve is changed',()=>{
|
|
179
201
|
const f=fixture(),oversize=frame(pkg(JOURNAL_PAYLOAD_LIMIT));
|
|
180
202
|
const measured={inlineBytes:815380,packageBytes:789175,reserve:272125};
|
|
@@ -226,6 +248,12 @@ test('eligibility is limited to durable v3 single-project conversation v2 withou
|
|
|
226
248
|
for(const controlPolicy of [{...config.controlPolicy,development:'provider'},{...config.controlPolicy,bootstrap:'write'},
|
|
227
249
|
{...config.controlPolicy,qaFix:'manual'},undefined])assert.equal(packageMaterialEligible({...config,controlPolicy}),false);
|
|
228
250
|
for(const root of ['relative','/fixture/../fixture',null])assert.equal(packageMaterialEligible({...config,root}),false);
|
|
251
|
+
// verification 是 control policy 的合法可选项(control-policy.mjs):带上它不能让大审查包失去存档资格;
|
|
252
|
+
// 存档资格只看执行方式,验证闸门与它正交。非法取值仍由 control policy 自身拒绝,这里不放宽其他未知键
|
|
253
|
+
for(const verification of ['disabled','precheck','auto'])
|
|
254
|
+
assert.equal(packageMaterialEligible({...config,controlPolicy:{...config.controlPolicy,verification}},3),true,verification);
|
|
255
|
+
assert.equal(packageMaterialEligible({...config,controlPolicy:{...config.controlPolicy,verification:'bogus'}},3),false);
|
|
256
|
+
assert.equal(packageMaterialEligible({...config,controlPolicy:{...config.controlPolicy,extra:true}},3),false);
|
|
229
257
|
});
|
|
230
258
|
|
|
231
259
|
test('reconciled review uses the same backward package reference and validates invocation binding',()=>{
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// 校验本包技能 *.md 里指向 docs 的相对引用(Markdown 链接和反引号路径)在当前安装布局下可达。
|
|
3
|
+
// 插件/源码布局 docs 在根目录;Claude 兼容布局在 cm-workflow/docs(安装时已改写)。
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { dirname, relative, resolve } from 'node:path';
|
|
6
|
+
import { pathToFileURL } from 'node:url';
|
|
7
|
+
import { listDocRefs, makeBoundedReader, managedSkillMarkdown, mapOutsideFences } from './cm-doc-links-shared.mjs';
|
|
8
|
+
|
|
9
|
+
export function findBrokenDocLinks(root) {
|
|
10
|
+
const broken = [];
|
|
11
|
+
const read = makeBoundedReader();
|
|
12
|
+
for (const file of managedSkillMarkdown(root)) {
|
|
13
|
+
mapOutsideFences(read(file), (part) => {
|
|
14
|
+
for (const m of listDocRefs(part)) {
|
|
15
|
+
const target = m.up + (m.done || '') + m.rest;
|
|
16
|
+
if (!existsSync(resolve(dirname(file), target))) broken.push(`${relative(root, file)} -> ${target}`);
|
|
17
|
+
}
|
|
18
|
+
return part;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return broken;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
25
|
+
let broken;
|
|
26
|
+
try { broken = findBrokenDocLinks(resolve(process.argv[2] || '.')); } catch (e) { console.error(`broken docs link: ${e.message}`); process.exit(1); }
|
|
27
|
+
for (const b of broken) console.error(`broken docs link: ${b}`);
|
|
28
|
+
process.exit(broken.length ? 1 : 0);
|
|
29
|
+
}
|
|
@@ -49,6 +49,52 @@ test('actual JSONL CLI runs fixture checker once then eight groups; optional deg
|
|
|
49
49
|
assert.equal(result.mechanical.output,'original checker output\noriginal stderr\n');assert.equal(result.result.completionAuthorized,false);
|
|
50
50
|
assert.deepEqual(fs.readdirSync(f.input.project),[]);
|
|
51
51
|
});
|
|
52
|
+
test('snapshot 遇到超过 1MB 的非 CM 技能文本只记大小,不阻断检查',{timeout:5000},async t=>{
|
|
53
|
+
const f=fixture(t);const big=path.join(f.dir,'skills/other-skill/assets/vendor/babel.min.js');
|
|
54
|
+
fs.mkdirSync(path.dirname(big),{recursive:true});fs.writeFileSync(big,Buffer.alloc(1048576+1024,97));
|
|
55
|
+
const host=createCmCheckHost(f.input,{call:async(kind,payload)=>kind==='check_runtime'?mechanical(payload):assessment(payload)});
|
|
56
|
+
const value=await host.handle({requestId:'start',operation:'start'});
|
|
57
|
+
assert.equal(value.result.overall,'PASSED',JSON.stringify(value));
|
|
58
|
+
});
|
|
59
|
+
test('超过 1MB 的 CM 文本在检查期间被等长改一个字节仍判为源码漂移;读失败的阻断带文件路径',{timeout:8000},async t=>{
|
|
60
|
+
const f=fixture(t);const big=path.join(f.dir,'skills/cm-check/big.md');fs.writeFileSync(big,Buffer.alloc(1048576+1024,97));
|
|
61
|
+
const host=createCmCheckHost(f.input,{call:async(kind,payload)=>{
|
|
62
|
+
if(kind==='check_runtime')return mechanical(payload);
|
|
63
|
+
const bytes=fs.readFileSync(big);bytes[10]=98;fs.writeFileSync(big,bytes);return assessment(payload);}});
|
|
64
|
+
const drift=await host.handle({requestId:'start',operation:'start'});
|
|
65
|
+
assert.equal(drift.result.overall,'BLOCKED',JSON.stringify(drift));
|
|
66
|
+
const g=fixture(t);const locked=path.join(g.dir,'skills/cm-check/locked.md');fs.writeFileSync(locked,'x');fs.chmodSync(locked,0o000);
|
|
67
|
+
t.after(()=>{try{fs.chmodSync(locked,0o644);}catch{}});
|
|
68
|
+
if(process.getuid?.()!==0){
|
|
69
|
+
const blocked=await createCmCheckHost(g.input,{call:async()=>{throw Error('must not run');}}).handle({requestId:'start',operation:'start'});
|
|
70
|
+
assert.equal(blocked.result.overall,'BLOCKED');assert.equal(blocked.result.file,'skills/cm-check/locked.md');
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
test('大文件的读取计入 64MiB 预算;超 16MB 的文本等长改写(ctime 变)也判漂移;漂移与目录读失败的阻断带路径;大文件可作证据',{timeout:30000},async t=>{
|
|
74
|
+
const run=async(f,mutate)=>createCmCheckHost(f.input,{call:async(kind,payload)=>{if(kind==='check_runtime')return mechanical(payload);mutate?.(payload);return assessment(payload);}}).handle({requestId:'start',operation:'start'});
|
|
75
|
+
const f=fixture(t);for(let i=0;i<5;i++)fs.writeFileSync(path.join(f.dir,`skills/cm-check/b${i}.md`),Buffer.alloc(14*1024*1024,97));
|
|
76
|
+
assert.equal((await run(f)).result.reason,'check_inventory_limit');
|
|
77
|
+
const g=fixture(t);const huge=path.join(g.dir,'skills/cm-check/huge.md');fs.writeFileSync(huge,Buffer.alloc(17*1024*1024,97));
|
|
78
|
+
const d=await run(g,()=>{const b=fs.readFileSync(huge);b[5]=98;fs.writeFileSync(huge,b);});
|
|
79
|
+
assert.equal(d.result.reason,'check_source_changed');assert.equal(d.result.file,'skills/cm-check/huge.md');
|
|
80
|
+
const h=fixture(t);const mid=path.join(h.dir,'skills/cm-check/mid.md');fs.writeFileSync(mid,Buffer.alloc(1048576+10,97));
|
|
81
|
+
const ok=createCmCheckHost(h.input,{call:async(kind,payload)=>{if(kind==='check_runtime')return mechanical(payload);const v=assessment(payload);v.checks[0].evidence=[{path:'skills/cm-check/mid.md',line:1}];return v;}});
|
|
82
|
+
assert.equal((await ok.handle({requestId:'start',operation:'start'})).result.overall,'PASSED');
|
|
83
|
+
if(process.getuid?.()!==0){
|
|
84
|
+
const k=fixture(t);const dir=path.join(k.dir,'skills/cm-check/locked');fs.mkdirSync(dir);fs.chmodSync(dir,0o000);
|
|
85
|
+
try{assert.equal((await run(k)).result.file,'skills/cm-check/locked');}finally{fs.chmodSync(dir,0o755);}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
test('docs 目录进入快照:检查期间删掉被技能链接指向的文档会被判漂移',{timeout:8000},async t=>{
|
|
89
|
+
const f=fixture(t);fs.mkdirSync(path.join(f.dir,'docs'));const doc=path.join(f.dir,'docs/user-guide.md');fs.writeFileSync(doc,'x');
|
|
90
|
+
const r=await createCmCheckHost(f.input,{call:async(kind,payload)=>{if(kind==='check_runtime')return mechanical(payload);fs.unlinkSync(doc);return assessment(payload);}}).handle({requestId:'start',operation:'start'});
|
|
91
|
+
assert.equal(r.result.reason,'check_source_changed');
|
|
92
|
+
});
|
|
93
|
+
test('范围清单进入快照:检查期间改它(改变受管范围)会被判漂移',{timeout:8000},async t=>{
|
|
94
|
+
const f=fixture(t);fs.mkdirSync(path.join(f.dir,'cm-workflow'));const scope=path.join(f.dir,'cm-workflow/doc-links-scope.txt');fs.writeFileSync(scope,'# cm-workflow doc-links scope v1 count=0\n');
|
|
95
|
+
const r=await createCmCheckHost(f.input,{call:async(kind,payload)=>{if(kind==='check_runtime')return mechanical(payload);fs.writeFileSync(scope,'# cm-workflow doc-links scope v1 count=1\nskills/x/SKILL.md\n');return assessment(payload);}}).handle({requestId:'start',operation:'start'});
|
|
96
|
+
assert.equal(r.result.reason,'check_source_changed');
|
|
97
|
+
});
|
|
52
98
|
test('mechanical failure stops semantics, repeated start never retries',async t=>{
|
|
53
99
|
const f=fixture(t,7);let calls=0;const host=createCmCheckHost(f.input,{call:async(kind,payload)=>{calls++;assert.equal(kind,'check_runtime');return mechanical(payload);}});
|
|
54
100
|
const value=await host.handle({requestId:'start',operation:'start'});assert.equal(value.result.overall,'FAILED');assert.equal(value.result.semanticChecked,false);
|
|
@@ -360,6 +360,12 @@ for correction_command in prepare-human-correction publish-human-correction-revi
|
|
|
360
360
|
grep -Fq "$correction_command" "$ROOT/$HUMAN_CORRECTION_DOC" ||
|
|
361
361
|
fail "human correction command/document pair incomplete: $correction_command"
|
|
362
362
|
done
|
|
363
|
+
# Skill docs links must resolve in this layout (0.21.5: claude-compat links pointed at a missing ~/.claude/docs).
|
|
364
|
+
if [ -n "$NODE_BIN" ] && [ -f "$ROOT/scripts/cm-check-doc-links.mjs" ]; then
|
|
365
|
+
"$NODE_BIN" "$ROOT/scripts/cm-check-doc-links.mjs" "$ROOT" || fail "skills docs links do not resolve in $MODE layout (see broken docs link lines above)"
|
|
366
|
+
else
|
|
367
|
+
fail "missing scripts/cm-check-doc-links.mjs or node for docs link check"
|
|
368
|
+
fi
|
|
363
369
|
require_file "scripts/cm-workflow-config.mjs"
|
|
364
370
|
require_file "scripts/cm-workflow-config.test.mjs"
|
|
365
371
|
# Group 4: user runtimes.yml producers <-> authoritative consumer.
|
|
@@ -708,6 +714,15 @@ for name in cm-challenge cm-idea cm-init cm-prd cm-ai cm-test cm-security cm-fix
|
|
|
708
714
|
fi
|
|
709
715
|
done
|
|
710
716
|
|
|
717
|
+
# cm-check 第 2 组口径:除独立配置工具 cm-notify 外,核心 Skill 必须用链接或反引号路径引用真实存在的 runtime/ 合同。
|
|
718
|
+
for name in cm-idea cm-init cm-prd cm-ai cm-test cm-security cm-fix cm-refactor cm-check cm-runtime; do
|
|
719
|
+
runtime_ref_ok=0
|
|
720
|
+
for ref in $(grep -oE '(\]\(\.\./\.\./runtime/[A-Za-z0-9._/-]+\.(md|json|mjs)[)#]|`\.\./\.\./runtime/[A-Za-z0-9._/-]+\.(md|json|mjs)[`#])' "$ROOT/skills/$name/SKILL.md" | sed -E 's/^(\]\(|`)//; s/.$//'); do
|
|
721
|
+
[ -f "$ROOT/skills/$name/$ref" ] && runtime_ref_ok=1
|
|
722
|
+
done
|
|
723
|
+
[ "$runtime_ref_ok" -eq 1 ] || fail "core skill has no resolvable runtime/ contract reference: skills/$name/SKILL.md"
|
|
724
|
+
done
|
|
725
|
+
|
|
711
726
|
for reference in \
|
|
712
727
|
skills/cm-idea/references/idea-to-prd.md \
|
|
713
728
|
skills/cm-idea/references/example-prd.md \
|
|
@@ -12,12 +12,24 @@ test('real isolated Claude install checks correction docs at its installed layou
|
|
|
12
12
|
t.after(()=>fs.rmSync(home,{recursive:true,force:true}));
|
|
13
13
|
const target=path.join(home,'.claude'),env={...process.env,HOME:home,CLAUDE_HOME:target,
|
|
14
14
|
CM_WORKFLOW_HOME:path.join(home,'user'),CM_WORKFLOW_LOG_HOME:path.join(home,'logs'),CM_MATT_SKILLS_INSTALL:'off'};
|
|
15
|
+
// 用户自装、带断链的技能(首次安装时目标里已存在)不得让安装的自检失败或回滚。
|
|
16
|
+
fs.mkdirSync(path.join(target,'skills/cm-user-own'),{recursive:true});
|
|
17
|
+
fs.writeFileSync(path.join(target,'skills/cm-user-own/SKILL.md'),'---\nname: cm-user-own\ndescription: 用户自装技能\n---\n[x](../../docs/none.md)\n');
|
|
15
18
|
const installed=spawnSync('/bin/bash',[path.join(source,'install.sh'),'--yes'],{cwd:source,env,encoding:'utf8',timeout:120000,maxBuffer:4*1024*1024});
|
|
16
19
|
assert.equal(installed.status,0,installed.stdout+installed.stderr);
|
|
17
20
|
assert.match(installed.stdout,/cm runtime check: PASSED \(claude-compat v/);
|
|
18
21
|
const doc=path.join(target,'cm-workflow/docs/human-correction.md');
|
|
19
22
|
assert.equal(fs.readFileSync(doc,'utf8'),fs.readFileSync(path.join(source,'docs/human-correction.md'),'utf8'));
|
|
20
23
|
assert.equal(fs.existsSync(path.join(target,'docs/human-correction.md')),false);
|
|
24
|
+
const notify=fs.readFileSync(path.join(target,'skills/cm-notify/SKILL.md'),'utf8');
|
|
25
|
+
assert.match(notify,/\.\.\/\.\.\/cm-workflow\/docs\/user-guide\.md/);
|
|
26
|
+
assert.equal(fs.readFileSync(path.join(source,'skills/cm-notify/SKILL.md'),'utf8').includes('../../cm-workflow/docs/'),false);
|
|
27
|
+
const scope=fs.readFileSync(path.join(target,'cm-workflow/doc-links-scope.txt'),'utf8');
|
|
28
|
+
assert.match(scope,/skills\/cm-notify\/SKILL\.md/);
|
|
29
|
+
assert.equal(scope.includes('cm-user-own'),false);
|
|
30
|
+
assert.equal(fs.readFileSync(path.join(target,'skills/cm-user-own/SKILL.md'),'utf8'),'---\nname: cm-user-own\ndescription: 用户自装技能\n---\n[x](../../docs/none.md)\n');
|
|
31
|
+
const links=spawnSync(process.execPath,[path.join(target,'scripts/cm-check-doc-links.mjs'),target],{encoding:'utf8'});
|
|
32
|
+
assert.equal(links.status,0,links.stderr);
|
|
21
33
|
fs.unlinkSync(doc);
|
|
22
34
|
const rejected=spawnSync('/bin/bash',[path.join(target,'scripts/cm-check-runtime.sh'),'--project',source],{cwd:source,env,encoding:'utf8',timeout:120000,maxBuffer:4*1024*1024});
|
|
23
35
|
assert.notEqual(rejected.status,0);
|
|
@@ -0,0 +1,40 @@
|
|
|
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 {previewTools} from '../runtime/js/cm-ai/tool-preview.mjs';
|
|
7
|
+
import {cleanEnvironment} from '../runtime/js/cm-ai/codex-config.mjs';
|
|
8
|
+
|
|
9
|
+
// 2026-11-25: on a macOS system proxy the Codex child of tool-preview sent its loopback
|
|
10
|
+
// probe through the proxy (502). The probe child alone gets a fixed loopback exemption;
|
|
11
|
+
// host proxy values (addresses or bypass lists) reach no CM child.
|
|
12
|
+
const PROXY_KEYS=['NO_PROXY','no_proxy','HTTP_PROXY','http_proxy','HTTPS_PROXY','https_proxy','ALL_PROXY','all_proxy'];
|
|
13
|
+
function withHostProxy(t){
|
|
14
|
+
const saved=Object.fromEntries(PROXY_KEYS.map(k=>[k,process.env[k]]));
|
|
15
|
+
t.after(()=>{for(const [k,v] of Object.entries(saved)){if(v===undefined)delete process.env[k];else process.env[k]=v;}});
|
|
16
|
+
process.env.NO_PROXY='internal.example.test,127.0.0.1';
|
|
17
|
+
process.env.no_proxy='internal.example.test';
|
|
18
|
+
for(const k of PROXY_KEYS.slice(2))process.env[k]='http://proxy.example.test:8080';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
test('tool-preview probe child gets only the fixed loopback proxy exemption',async t=>{
|
|
22
|
+
withHostProxy(t);
|
|
23
|
+
const dir=fs.mkdtempSync(path.join(os.tmpdir(),'cm-js-b1-'));
|
|
24
|
+
t.after(()=>fs.rmSync(dir,{recursive:true,force:true}));
|
|
25
|
+
const dump=path.join(dir,'env.json'),cli=path.join(dir,'fake-codex.mjs');
|
|
26
|
+
fs.writeFileSync(cli,`#!/usr/bin/env node\nimport fs from 'node:fs';\nfs.writeFileSync(${JSON.stringify(dump)},JSON.stringify(process.env));\nprocess.exit(1);\n`,{mode:0o755});
|
|
27
|
+
const receipt=await previewTools({cwd:fs.realpathSync(dir),model:'gpt-6.2-sol',cli,promptTransport:'argument',allowCodeProject:true});
|
|
28
|
+
assert.equal(receipt.passed,false);
|
|
29
|
+
const env=JSON.parse(fs.readFileSync(dump,'utf8'));
|
|
30
|
+
assert.equal(env.NO_PROXY,'127.0.0.1');
|
|
31
|
+
assert.equal(env.no_proxy,'127.0.0.1');
|
|
32
|
+
for(const k of PROXY_KEYS.slice(2))assert.equal(k in env,false,k);
|
|
33
|
+
assert.equal(JSON.stringify(env).includes('internal.example.test'),false);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('other CM children still get no host proxy values',t=>{
|
|
37
|
+
withHostProxy(t);
|
|
38
|
+
const env=cleanEnvironment();
|
|
39
|
+
for(const k of PROXY_KEYS)assert.equal(k in env,false,k);
|
|
40
|
+
});
|