diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json new file mode 100644 index 0000000000..d0f7772d77 --- /dev/null +++ b/.agents/plugins/marketplace.json @@ -0,0 +1,21 @@ +{ + "name": "billion-context", + "interface": { + "displayName": "billion-context" + }, + "plugins": [ + { + "name": "billion-context", + "version": "0.1.205", + "source": { + "source": "local", + "path": "./plugins/codex" + }, + "policy": { + "installation": "AVAILABLE", + "authentication": "ON_INSTALL" + }, + "category": "Developer Tools" + } + ] +} diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index c0f7d6d88c..0345018cac 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -12,7 +12,7 @@ "name": "billion-context", "source": "./", "description": "Context-compression plugin for Claude Code · month-long single sessions (billions of tokens) · high compression quality even in small context windows (100K is enough) · 5× fewer tokens", - "version": "0.1.188", + "version": "0.1.205", "author": { "name": "ranxianglei" }, diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 53ab0bc046..4b5ce9de31 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "billion-context", - "version": "0.1.188", + "version": "0.1.205", "description": "Context-compression plugin for Claude Code · month-long single sessions (billions of tokens) · high compression quality even in small context windows (100K is enough) · 5× fewer tokens", "author": { "name": "ranxianglei" diff --git a/.github/workflows/release-bugfix.yml b/.github/workflows/release-bugfix.yml index 7b5170270c..b3635a55f4 100644 --- a/.github/workflows/release-bugfix.yml +++ b/.github/workflows/release-bugfix.yml @@ -125,6 +125,14 @@ jobs: [ -z "$SHA" ] && SHA="$(git rev-parse HEAD)" echo "::notice::Publishing carve-out from '$REF' @ ${SHA:0:12} -> v$V (master NOT involved)" + - name: Check plugin manifest versions (#4449) + # Same gate as release.yml: the carve-out PR head is a frozen tree + # (last tag + fix + bump), so it must ALREADY carry the synced plugin + # manifests — drift fails fast here instead of shipping a release whose + # marketplace update detection never fires. See reference/release.md. + if: steps.resolve.outputs.proceed == 'true' + run: node scripts/sync-codex-plugin-version.mjs --check + - name: Publish guard (monotonic + not-already-live) if: steps.resolve.outputs.proceed == 'true' run: | diff --git a/.github/workflows/release-manual.yml b/.github/workflows/release-manual.yml index 7cb00a3ad0..e510f94fe1 100644 --- a/.github/workflows/release-manual.yml +++ b/.github/workflows/release-manual.yml @@ -148,15 +148,19 @@ jobs: console.log(`${f}: replaced ${n} occurrence(s)`); } ' "$(node -p "require('./package.json').version")" "${{ steps.version.outputs.version }}" + # #4449: plugin manifests (.agents/.claude-plugin/plugins/codex) carry + # their version from package.json — sync them into the same release + # commit or marketplace update detection sees a stale version. + node scripts/sync-codex-plugin-version.mjs - name: Verify bump diff run: | - git add package.json package-lock.json + git add package.json package-lock.json .agents .claude-plugin plugins/codex CHANGED="$(git diff --cached --name-only)" - EXPECT="package-lock.json - package.json" - if [ "$CHANGED" != "$EXPECT" ]; then - echo "::error::bump touched unexpected files: $CHANGED" + [ -n "$CHANGED" ] || { echo "::error::bump produced no changes"; exit 1; } + BAD="$(printf '%s\n' "$CHANGED" | grep -vE '^(package\.json|package-lock\.json|\.agents/plugins/marketplace\.json|\.claude-plugin/marketplace\.json|\.claude-plugin/plugin\.json|plugins/codex/\.codex-plugin/plugin\.json)$' || true)" + if [ -n "$BAD" ]; then + echo "::error::bump touched unexpected files: $BAD" exit 1 fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c822e9dbe4..914c0c2321 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,6 +34,17 @@ jobs: echo "is_release=false" >> $GITHUB_OUTPUT fi + - name: Check plugin manifest versions (#4449) + # Codex/Claude plugin marketplaces detect updates by the declared + # manifest version vs the installed cache version, so the four + # manifests (.agents/plugins, .claude-plugin x2, plugins/codex) must + # match package.json. The release branch carries the synced manifests + # as their own commit (reference/release.md step 3.5); drift here + # means the branch was prepared without that step — fail fast, before + # any CI dispatch, tag, or publish. + if: steps.check.outputs.is_release == 'true' + run: node scripts/sync-codex-plugin-version.mjs --check + - name: Full CI dispatch (missing lanes, publish sha) # Policy (2026-10-10, after the v0.1.192 carve-out): every release # channel must run the COMPLETE CI set at the exact publish sha before diff --git a/AGENTS.md b/AGENTS.md index b9a5d06c72..3934418a98 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -220,7 +220,8 @@ Split extra findings into their own issues/PRs rather than expanding this one's Releases are fully automated via CI (`.github/workflows/release.yml`): the Agent prepares a release PR; merging it builds, tests, publishes to npm, tags, and creates a GitHub Release. Kernel releases (`acp-kernel`) use the parallel flow in `.github/workflows/release-kernel.yml` (below). There's also a one-click fast path for routine patches. Hard rules (exact steps + internals in [reference/release.md](reference/release.md)): - **Owner-approved start (owner rule 2026-10-12, #2910):** an Agent runs the release flow (steps 1–6 below) ONLY after the owner explicitly approves the release in the trigger thread (「发版 vX」). Triage that ends at "fix stranded on master, users blocked" PROPOSES the release in the issue thread and stops — what ships and when belongs to the owner. Origin: #2906 → a bot autonomously cut v0.1.196 (#2910) mid-triage; every mechanical rule held (no publish, no merge, branch naming, version-only-on-release-branch) yet the decision to ship was never the bot's to make. -- **Branch** `YYYY-MM-DD_release-v{VERSION}`; commit `release v{VERSION}` changing ONLY `version`. The Agent does steps 1–6 (sync master → branch → bump → **release-notes entry if severe (#1870)** → pre-flight typecheck+test+build → commit/push/open PR); HUMAN merges step 7; CI publishes step 8. +- **Branch** `YYYY-MM-DD_release-v{VERSION}`; commit `release v{VERSION}` changing ONLY `version`. The Agent does steps 1–6 (sync master → branch → bump → **sync plugin manifest versions (#4449)** → **release-notes entry if severe (#1870)** → pre-flight typecheck+test+build → commit/push/open PR); HUMAN merges step 7; CI publishes step 8. +- **Plugin manifest versions sync on every release (#4449).** The four plugin manifests (`.agents/plugins/marketplace.json`, `.claude-plugin/marketplace.json` + `.claude-plugin/plugin.json`, `plugins/codex/.codex-plugin/plugin.json`) carry their own `version` fields, which the Codex/Claude marketplaces use for UPDATE DETECTION — they must equal `package.json`. After the version-bump commit, run `node scripts/sync-codex-plugin-version.mjs` and commit the result as its own `chore:` commit on the release branch (the one-click lane runs it inside CI automatically). ALL THREE publish workflows (`release.yml`, `release-manual.yml`, `release-bugfix.yml`) run `--check` BEFORE tag/publish: drift = red release, nothing shipped. Consequence: a bugfix carve-out PR head (last tag + fix + bump) MUST also carry the synced manifests or its gate fails. - **Release-notes entry (#1870, OPT-IN since 2026-10-04):** only SEVERE releases need an entry in `release-notes/package.json`; ordinary releases ship with NO entry (the gates log a notice and pass when absent, validate when present). Add a severe entry as its own commit in the SAME release PR; the one-click fast path needs it already merged to master before dispatching. Full rules: [reference/release.md](reference/release.md) + `release-notes/README.md`. - **Bugfix carve-out channel (#2011, PR-gated since #2851):** emergency hotfixes ship as a normal-looking release PR whose head branch keeps the `bugfix-release/v{VERSION}-{slug}` marker (cut from the last released TAG, containing ONLY the fix + version bump); merging it publishes the PRE-MERGE PR-head tree — strictly excluding master's other unreleased work. Pushing such a branch triggers nothing anymore; a manual `workflow_dispatch` on an explicitly chosen ref remains the emergency fallback. Mechanics and constraints: [reference/release.md](reference/release.md). Batch form: a standing patch train (same `bugfix-release/**` branches + the `backport` label bot routing merged fixes onto it via cherry-pick, 2026-10-24) — see "Dual-lane releases" in the same doc. - **NEVER run `npm publish` manually** — CI does it (§4). diff --git a/plugins/codex/.codex-plugin/plugin.json b/plugins/codex/.codex-plugin/plugin.json new file mode 100644 index 0000000000..8ee8250a7b --- /dev/null +++ b/plugins/codex/.codex-plugin/plugin.json @@ -0,0 +1,34 @@ +{ + "name": "billion-context", + "version": "0.1.205", + "description": "Context-compression plugin for Codex — small context windows (100K is enough), 5x fewer tokens, month-long single sessions (billions of tokens), and high compression quality.", + "author": { + "name": "ranxianglei" + }, + "homepage": "https://github.com/ranxianglei/billion-context", + "license": "MIT", + "keywords": [ + "context", + "compression", + "long-context", + "token-saving", + "acp" + ], + "mcpServers": "./.mcp.json", + "interface": { + "displayName": "billion-context", + "shortDescription": "上下文压缩:100K 窗口跑出十亿 token 的长会话", + "longDescription": "把 Codex 的对话历史做增量分层压缩:模型自己决定何时压缩、压缩什么,被折叠的区段保持摘要、可随时解压还原,前缀缓存不失效。一个上下文窗口连跑数天、累计数十亿 token 而不爆窗。插件注入四个上下文管理工具(compress / decompress / search_context / acp_status),模型会在上下文变长时自行调用。", + "developerName": "ranxianglei", + "category": "Developer Tools", + "capabilities": [ + "Read", + "Write" + ], + "defaultPrompt": [ + "查看当前会话的上下文压缩状态", + "把最近的一段对话压缩掉" + ], + "brandColor": "#10a37f" + } +} diff --git a/plugins/codex/.mcp.json b/plugins/codex/.mcp.json new file mode 100644 index 0000000000..dae68e0853 --- /dev/null +++ b/plugins/codex/.mcp.json @@ -0,0 +1,24 @@ +{ + "mcpServers": { + "bili": { + "command": "node", + "args": [ + "./mcp-server.mjs" + ], + "env_vars": [ + "BILI_MCP_PROXY", + "BILI_CONVERSATION_ID", + "PATH", + "APPDATA", + "LOCALAPPDATA", + "USERPROFILE", + "HOME", + "XDG_CONFIG_HOME", + "XDG_DATA_HOME", + "XDG_STATE_HOME", + "TMPDIR" + ], + "startup_timeout_sec": 30 + } + } +} diff --git a/plugins/codex/README.md b/plugins/codex/README.md new file mode 100644 index 0000000000..d5bc8d8389 --- /dev/null +++ b/plugins/codex/README.md @@ -0,0 +1,85 @@ +# billion-context —— Codex 桌面版插件 + +把 [billion-context](https://github.com/ranxianglei/billion-context) 的上下文压缩 +能力装进 Codex 桌面版:小上下文窗口(100K 就够)也能连跑数天、累计数十亿 token。 + +## 安装 + +从仓库根目录执行: + +```powershell +.\plugins\codex\scripts\install.ps1 +``` + +或者手动执行等价的三步: + +```powershell +codex plugin marketplace add ranxianglei/billion-context +codex plugin add billion-context@billion-context +``` + +装完**重启 Codex**。 + +> marketplace 必须是 **Git 源**。这是更新检测的前提:只有 Git marketplace 才有 +> 版本推进语义,Codex 会把它识别成 `sourceType=git` 并在后台自动拉取上游更新。 +> `local` 和 `npm` 源的版本号恒为 `null`,插件页面永远看不到「有更新」。 + +## 它做了什么 + +插件注入一个 MCP server(`bili`),提供四个上下文管理工具: + +| 工具 | 作用 | +| --- | --- | +| `compress` | 把一段对话折叠成详细摘要 | +| `decompress` | 需要精确细节时把压缩掉的区段还原回来 | +| `search_context` | 在压缩摘要和可见消息里按关键词搜索 | +| `acp_status` | 上下文占用概览,以及还有哪些区段可以压缩 | + +压缩由模型自己决定何时触发、压缩什么;被折叠的区段保持摘要、随时可解压还原, +前缀缓存不失效。 + +## 关于压缩代理 + +插件负责**工具面**(让 Codex 的模型能调用压缩),压缩的**执行面**在 bili 代理里。 +两者分工: + +- 只装插件、不跑代理 → 四个工具会出现在 Codex 里,但 `tools/list` 会报 + `bili proxy unreachable …`,因为没有会话被代理。 +- 想让压缩真正生效,需要代理在跑: + + ```powershell + bili start # 后台代理,监听 8787 + ``` + + 或者用 `bili codex` 启动 Codex —— 它会同时拉起代理并把 Codex 的流量 + 指向代理,压缩与工具一起生效(零配置路线)。 + +## 更新 + +Codex 桌面版会自己拉取上游 Git marketplace 的新提交(内置的 +`plugins-marketplace-auto-upgrade` 任务)。上游发新版本后: + +1. 插件页面的版本号会前进; +2. 点更新(或执行 `codex plugin remove` + `codex plugin add`)即可装上新版本。 + +版本号以仓库的 `package.json` 为唯一真相源, +`scripts/sync-codex-plugin-version.mjs` 负责把它同步到所有插件清单, +发布流程里已经接了这个校验。 + +## 排障 + +**工具列表是空的 / 报 proxy unreachable** + +说明 MCP server 起来了但代理没跑。先 `bili start`,再重启 Codex。 + +**MCP server 起不来** + +插件里的 `mcp-server.mjs` 会依次找 `dist/mcp.js`:`BILI_MCP_ENTRY` 环境变量 → +仓库源码布局(`<插件目录>/../../dist/mcp.js`)→ 插件目录自身(`<插件目录>/dist/mcp.js`) +→ 全局 npm 安装目录。全都找不到时它会把已尝试的路径打到 stderr。 +这时装一下 CLI 即可:`npm install -g billion-context`。 + +**插件页面不显示图标** + +Codex 从插件目录读 `interface` 字段(显示名、简介、品牌色)。本插件的 +`interface` 写在 `.codex-plugin/plugin.json` 里。 diff --git a/plugins/codex/mcp-server.mjs b/plugins/codex/mcp-server.mjs new file mode 100644 index 0000000000..9be314d718 --- /dev/null +++ b/plugins/codex/mcp-server.mjs @@ -0,0 +1,135 @@ +#!/usr/bin/env node +// Codex 插件的 MCP server 启动器。 +// +// Codex 把插件装到 ~/.codex/plugins/cache////, +// 这个目录里只有插件自身的文件。billion-context 的 MCP 外壳(dist/mcp.js) +// 来自 npm 包或者仓库源码,两者都不在这个目录里,所以这里按优先级探测: +// +// 1) BILI_MCP_ENTRY —— 显式指定 dist/mcp.js 的绝对路径(最高优先级) +// 2) 仓库源码布局:<插件目录>/../../dist/mcp.js(开发检出时优先用本仓库 +// 自己的构建,而不是可能过期的全局安装) +// 3) 插件目录自身(dist/mcp.js 就在插件目录里的布局) +// 4) 全局 npm 安装的 billion-context(npm root -g 下的包目录;npm 不在 +// PATH 上时兜底 AppData\npm\node_modules) +// +// 找到之后以 child_process 的 stdio 管道原样转发:Codex 说 JSON-RPC, +// dist/mcp.js 说 JSON-RPC,中间不做任何解析,避免协议漂移。 +// +// 必须用 spawn 而不是 import():dist/mcp.js 里的 stdio 循环只在它 +// "作为脚本被直接执行"时启动(见 src/mcp.ts 末尾的 invokedAsScript 守卫), +// 被 import() 加载时它只会导出 runMcpStdio,不会接管 stdin。 + +import { spawn, spawnSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); + +function isFile(p) { + try { + return fs.statSync(p).isFile(); + } catch { + return false; + } +} + +/** 全局 npm root(可能不止一个:nvm / pnpm / yarn 各自一处)。 */ +function globalNpmRoots() { + const roots = []; + const probe = (cmd, args) => { + try { + const r = spawnSync(cmd, args, { encoding: "utf8", timeout: 8000 }); + const out = (r.stdout || "").trim(); + if (r.status === 0 && out) roots.push(out); + } catch { + /* npm 不在 PATH 上是常态,忽略即可 */ + } + }; + probe("npm", ["root", "-g"]); + // Windows 上 npm 不在 PATH 时的常见全局安装位置(npm root -g 探针失效的兜底) + const appData = process.env.APPDATA; + if (appData) roots.push(path.join(appData, "npm", "node_modules")); + return roots; +} + +function candidates() { + const out = []; + + const explicit = process.env.BILI_MCP_ENTRY?.trim(); + if (explicit) out.push(explicit); + + // 仓库源码布局:插件目录的上两级是仓库根,dist/mcp.js 在那里 + out.push(path.resolve(HERE, "..", "..", "dist", "mcp.js")); + // 插件目录自己就是包根(npm 源安装时 dist/mcp.js 在插件目录里) + out.push(path.join(HERE, "dist", "mcp.js")); + + for (const root of globalNpmRoots()) { + out.push(path.join(root, "billion-context", "dist", "mcp.js")); + } + + return out; +} + +function resolveEntry() { + for (const c of candidates()) { + if (isFile(c)) return c; + } + return null; +} + +// Codex 启动 MCP server 时给的 cwd 可能是插件目录,也可能不是(不同版本的 +// 行为不一样)。mcp-server.mjs 用 import.meta.url 定位自己的位置,所以 +// cwd 无关;但 dist/mcp.js 内部会按 cwd 找配置(~/.config/billion-context 等), +// 那里是绝对路径,所以也不受影响。这里只做一件事:把 cwd 钉到插件目录, +// 让相对路径的引用(比如 README、scripts/)在任何宿主下都指向插件自己的文件。 +process.chdir(HERE); + +const entry = resolveEntry(); + +if (!entry) { + // 不能静默退出:Codex 会看到一个"启动了但立刻消失"的 MCP server, + // 报错信息还指向一个不存在的端口。把缺失说清楚。 + process.stderr.write( + "[bili-codex] 找不到 billion-context 的 MCP 入口(dist/mcp.js)。\n" + + "[bili-codex] 已尝试:\n" + + candidates() + .map((c) => ` - ${c}`) + .join("\n") + + "\n" + + "[bili-codex] 请安装 CLI:npm install -g billion-context\n" + + "[bili-codex] 或设置 BILI_MCP_ENTRY 指向 dist/mcp.js 的绝对路径。\n", + ); + process.exit(1); +} + +const child = spawn(process.execPath, [entry], { + stdio: ["pipe", "pipe", "pipe"], + env: process.env, +}); + +child.on("error", (err) => { + // spawn 本身失败(极少见)时给一个可定位的报错,而不是裸的未处理事件。 + process.stderr.write(`[bili-codex] 无法启动 MCP 入口 ${entry}: ${err.message}\n`); + process.exit(1); +}); + +// stdio 三路直接对接,中间不加任何缓冲或解析。 +process.stdin.pipe(child.stdin); +child.stdout.pipe(process.stdout); +child.stderr.pipe(process.stderr); + +child.on("exit", (code, signal) => { + if (signal) process.kill(process.pid, signal); + else process.exit(code ?? 0); +}); + +for (const sig of ["SIGINT", "SIGTERM"]) { + process.on(sig, () => { + try { + child.kill(sig); + } catch { + /* 子进程已经退出 */ + } + }); +} diff --git a/plugins/codex/scripts/install.ps1 b/plugins/codex/scripts/install.ps1 new file mode 100644 index 0000000000..0d1e1f1ba0 --- /dev/null +++ b/plugins/codex/scripts/install.ps1 @@ -0,0 +1,148 @@ +<# +.SYNOPSIS + 把 billion-context 装成 Codex 桌面版插件。 + +.DESCRIPTION + 做四件事: + 1. 确保 bili CLI 可用(插件的 MCP server 需要 dist/mcp.js) + 2. 把上游仓库注册成 Git marketplace —— 这是"有更新"检测的关键: + 只有 Git 源有版本推进语义,local / npm 源的版本号恒为 null + 3. 安装插件本身 + 4. 打开 features.enable_mcp_apps(渲染 MCP App 组件用) + + 安装后需要重启 Codex。 + +.EXAMPLE + .\install.ps1 + .\install.ps1 -SkipCli # 已经装好 bili CLI 时 +#> + +[CmdletBinding()] +param( + # 跳过 bili CLI 的安装检查 + [switch]$SkipCli, + # 只打印将要执行的操作,不真的执行 + [switch]$WhatIfOnly +) + +$ErrorActionPreference = "Stop" + +function Write-Step { param([string]$Message) Write-Host "==> $Message" -ForegroundColor Cyan } +function Write-Ok { param([string]$Message) Write-Host " $Message" -ForegroundColor Green } +function Write-Warn2{ param([string]$Message) Write-Host " $Message" -ForegroundColor Yellow } + +# ---------------------------------------------------------------- codex 可执行文件 +function Resolve-Codex { + $cmd = Get-Command codex -ErrorAction SilentlyContinue + if ($cmd) { return $cmd.Source } + # 桌面版把 codex.exe 放在 AppData 下,不一定在 PATH + $candidates = @( + (Join-Path $env:LOCALAPPDATA "OpenAI\Codex\bin"), + (Join-Path $env:LOCALAPPDATA "Programs\codex") + ) + foreach ($dir in $candidates) { + if (-not (Test-Path $dir)) { continue } + $hit = Get-ChildItem -Path $dir -Filter "codex.exe" -Recurse -ErrorAction SilentlyContinue | + Sort-Object LastWriteTime -Descending | Select-Object -First 1 + if ($hit) { return $hit.FullName } + } + return $null +} + +function Invoke-Codex { + param([Parameter(ValueFromRemainingArguments = $true)][string[]]$Args) + $global:CodexBin = Resolve-Codex + if (-not $global:CodexBin) { + throw "找不到 codex 可执行文件。请确认已安装 Codex 桌面版或 codex CLI。" + } + & $global:CodexBin @Args + if ($LASTEXITCODE -ne 0) { + throw "codex $($Args -join ' ') 退出码 $LASTEXITCODE" + } +} + +# ---------------------------------------------------------------- 1. bili CLI +if (-not $SkipCli) { + Write-Step "检查 bili CLI" + $bili = Get-Command bili -ErrorAction SilentlyContinue + if ($bili) { + Write-Ok "已安装:$($bili.Source)" + } else { + Write-Warn2 "未找到 bili,正在安装 npm 包 billion-context…" + if (-not $WhatIfOnly) { + npm install -g billion-context + if ($LASTEXITCODE -ne 0) { + throw "npm install -g billion-context 失败" + } + } + } +} + +# ---------------------------------------------------------------- 2. marketplace +# 必须用 Git 源:只有 Git marketplace 才有版本推进语义,Codex 会把它识别成 +# sourceType=git,并在后台自动拉取上游更新(plugins-marketplace-auto-upgrade)。 +# local / npm 源的 PluginSummary.version 恒为 null,插件页面永远看不到"有更新"。 +Write-Step "注册 Git marketplace(更新检测依赖它)" +$repo = "ranxianglei/billion-context" +$codexBin = Resolve-Codex +if (-not $codexBin) { + throw "找不到 codex 可执行文件。请确认已安装 Codex 桌面版或 codex CLI。" +} +$existing = & $codexBin plugin marketplace list 2>&1 | Out-String +if ($existing -match "billion-context") { + Write-Ok "marketplace 已存在" +} else { + if (-not $WhatIfOnly) { + Invoke-Codex plugin marketplace add $repo + } + Write-Ok "已注册 $repo" +} + +# ---------------------------------------------------------------- 3. 安装插件 +Write-Step "安装插件" +if (-not $WhatIfOnly) { + Invoke-Codex plugin add "billion-context@billion-context" +} +Write-Ok "已安装 billion-context 插件" + +# ---------------------------------------------------------------- 4. MCP Apps +Write-Step "开启 features.enable_mcp_apps" +$codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $env:USERPROFILE ".codex" } +$config = Join-Path $codexHome "config.toml" +if (Test-Path $config) { + # 读写都走 .NET API 而不是 Get/Set-Content:PS 5.1 的 Get-Content 默认按 + # ANSI/GBK 解码,会把 config.toml 里的非 ASCII(如中文注释)读成乱码再原样 + # 写回;Set-Content -Encoding UTF8 在 5.1 又会加 BOM(已有 BOM 时变双 BOM)。 + # .NET 这对 API 恒定 UTF-8、不加 BOM、跨版本行为一致。 + $text = [System.IO.File]::ReadAllText($config) + if ($text -notmatch "(?m)^\s*enable_mcp_apps\s*=") { + if (-not $WhatIfOnly) { + # 追加到 [features] 段;没有该段就新建一个 + if ($text -match "(?m)^\[features\]") { + $text = $text -replace "(?m)^(\[features\]\r?\n)", "`$1enable_mcp_apps = true`n" + } else { + $text = $text.TrimEnd() + "`n`n[features]`nenable_mcp_apps = true`n" + } + [System.IO.File]::WriteAllText($config, $text, [System.Text.UTF8Encoding]::new($false)) + } + Write-Ok "已开启" + } else { + Write-Ok "已开启" + } +} else { + Write-Warn2 "找不到 $config,跳过" +} + +Write-Host "" +Write-Host "安装完成。" -ForegroundColor Green +Write-Host "" +Write-Host "接下来:" -ForegroundColor Cyan +Write-Host " 1. 重启 Codex 桌面版" +Write-Host " 2. 打开 插件 页面,确认列表里能看到 billion-context" +Write-Host " 3. 在对话里说「查看上下文压缩状态」即可调用 acp_status 工具" +Write-Host "" +Write-Host "更新检测:Codex 会自动拉取上游 Git marketplace 的新提交。" -ForegroundColor Cyan +Write-Host "上游发新版本后,插件页面会显示新版本号,点更新即可。" +Write-Host "" +Write-Host "注意:压缩功能本身还需要 bili 代理在跑(bili start)," -ForegroundColor Yellow +Write-Host " 或者用 'bili codex' 启动 Codex 以便代理与客户端同时运行。" diff --git a/reference/release.md b/reference/release.md index a357b0b2e3..820fbdc49c 100644 --- a/reference/release.md +++ b/reference/release.md @@ -41,8 +41,28 @@ The Agent does steps 1–6, the human does step 7 (merge). npm install --package-lock-only --ignore-scripts --no-fund --no-audit git diff --exit-code -- package-lock.json # must be clean before you commit ``` - CI enforces this with the `lock-sync` guard (`ci.yml`). -4. **Add the release-notes entry — ONLY for severe releases (#1870, opt-in + CI enforces this with the `lock-sync` guard (`ci.yml`). + 3.5. **Sync plugin manifest versions (#4449)** — run on the release branch, + AFTER the bump commit, and commit the result as its own commit: + ```bash + node scripts/sync-codex-plugin-version.mjs + git add .agents .claude-plugin plugins/codex + git commit -m "chore: sync plugin manifests to v{VERSION}" + ``` + Why: the four plugin manifests (`.agents/plugins/marketplace.json`, + `.claude-plugin/marketplace.json` + `.claude-plugin/plugin.json`, + `plugins/codex/.codex-plugin/plugin.json`) carry their own `version` fields — + Codex/Claude marketplaces detect updates by comparing that declared version + against the installed cache, so a stale manifest means "no update available" + forever for that lane. `package.json` is the single source of truth; the + script copies it into all four (idempotent — if nothing drifted the commit is + empty and you skip it). All three publish workflows run `--check` BEFORE + tag/publish (`release.yml` fails fast before any CI dispatch; `release-manual.yml` + syncs inside CI as part of its own release commit; `release-bugfix.yml` checks + the frozen carve-out head) — drift = red release, nothing shipped. A bugfix + carve-out PR head MUST therefore already carry the synced manifests (see the + carve-out process below). + 4. **Add the release-notes entry — ONLY for severe releases (#1870, opt-in since 2026-10-04)** — ordinary releases skip this step entirely and ship with NO entry. When a release IS severe, add the entry in the SAME release PR, as its own commit (never bundled into the release commit): prepend an @@ -203,9 +223,10 @@ nothing else. **Process:** 1. Cut the hotfix branch from the last released TAG (not master), apply ONLY the fix - plus the version bump (regenerate `package-lock.json` as in step 3 above; plus the - release-notes entry ONLY if the hotfix is severe — step 4 above), then push and - open a PR against master: + plus the version bump (regenerate `package-lock.json` as in step 3 above; sync the + plugin manifests as in step 3.5 above — the publish gate's `--check` runs against + this frozen head, so drift fails the whole lane; plus the release-notes entry ONLY + if the hotfix is severe — step 4 above), then push and open a PR against master: ```bash git checkout -b bugfix-release/v{VERSION}-{slug} v{LAST-RELEASED-TAG} ``` diff --git a/scripts/sync-codex-plugin-version.mjs b/scripts/sync-codex-plugin-version.mjs new file mode 100644 index 0000000000..b8e1955ea9 --- /dev/null +++ b/scripts/sync-codex-plugin-version.mjs @@ -0,0 +1,105 @@ +#!/usr/bin/env node +/** + * 同步 Codex 插件相关的版本号。 + * + * 背景:Codex 的 marketplace 更新检测靠的是「marketplace 清单里宣告的版本」 + * 与「已安装缓存目录的版本」之间的差异。上游仓库的版本号散落在多处 + * (package.json、.claude-plugin/marketplace.json、.claude-plugin/plugin.json), + * 历史上已经出现过 package.json 是 0.1.204 而 .claude-plugin 里还写着 + * 0.1.188 的漂移 —— 这会让 Codex 侧看到过期的版本号。 + * + * 本脚本把 package.json 的 version 作为唯一真相源,写回: + * 1. .agents/plugins/marketplace.json → Codex marketplace 清单 + * 2. plugins/codex/.codex-plugin/plugin.json → Codex 插件清单 + * 3. .claude-plugin/marketplace.json → Claude marketplace 清单 + * 4. .claude-plugin/plugin.json → Claude 插件清单 + * + * 用法: + * node scripts/sync-codex-plugin-version.mjs # 校验 + 写入 + * node scripts/sync-codex-plugin-version.mjs --check # 只校验,有漂移则退出码 1 + */ + +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const CHECK_ONLY = process.argv.includes("--check"); + +function readJson(rel) { + const abs = path.join(ROOT, rel); + if (!fs.existsSync(abs)) return null; + try { + return JSON.parse(fs.readFileSync(abs, "utf8")); + } catch (err) { + console.error(`[sync-codex-plugin-version] ${rel} 不是合法 JSON:${err.message}`); + process.exit(1); + } +} + +function writeJson(rel, data) { + const abs = path.join(ROOT, rel); + fs.mkdirSync(path.dirname(abs), { recursive: true }); + fs.writeFileSync(abs, `${JSON.stringify(data, null, 2)}\n`, "utf8"); +} + +const pkg = readJson("package.json"); +if (!pkg) { + console.error("[sync-codex-plugin-version] 找不到 package.json"); + process.exit(1); +} +const version = pkg.version; +if (typeof version !== "string" || !version.trim()) { + console.error("[sync-codex-plugin-version] package.json 的 version 缺失"); + process.exit(1); +} + +const targets = [ + { rel: ".agents/plugins/marketplace.json", apply: (d) => { + for (const p of d.plugins ?? []) { + if (p.name === "billion-context") p.version = version; + } + } }, + { rel: "plugins/codex/.codex-plugin/plugin.json", apply: (d) => { + d.version = version; + } }, + { rel: ".claude-plugin/marketplace.json", apply: (d) => { + for (const p of d.plugins ?? []) { + if (p.name === "billion-context") p.version = version; + } + } }, + { rel: ".claude-plugin/plugin.json", apply: (d) => { + d.version = version; + } }, +]; + +const drifted = []; + +for (const t of targets) { + const data = readJson(t.rel); + if (!data) { + console.log(`[sync-codex-plugin-version] 跳过(不存在):${t.rel}`); + continue; + } + const before = JSON.stringify(data); + t.apply(data); + const after = JSON.stringify(data); + if (before === after) { + console.log(`[sync-codex-plugin-version] OK ${t.rel} 已是 ${version}`); + continue; + } + drifted.push(t.rel); + if (CHECK_ONLY) { + console.log(`[sync-codex-plugin-version] 漂移 ${t.rel} 需要同步到 ${version}`); + } else { + writeJson(t.rel, data); + console.log(`[sync-codex-plugin-version] 同步 ${t.rel} → ${version}`); + } +} + +if (CHECK_ONLY && drifted.length > 0) { + console.error(`[sync-codex-plugin-version] ${drifted.length} 个文件的版本号与 package.json 不一致`); + process.exit(1); +} + +console.log(`[sync-codex-plugin-version] 完成,唯一真相源版本 = ${version}`); diff --git a/tests/codex-mcp-shell.test.ts b/tests/codex-mcp-shell.test.ts new file mode 100644 index 0000000000..b99cd06a5c --- /dev/null +++ b/tests/codex-mcp-shell.test.ts @@ -0,0 +1,188 @@ +/** + * #4449 — the Codex plugin's MCP launcher shell (plugins/codex/mcp-server.mjs). + * + * Pins the behaviors Codex users depend on, hermetically (the real shell is + * copied into a temp tree two levels deep so its repo-layout probe can never + * hit a real build): + * - no resolvable entry → loud diagnostic listing every attempted path, + * exit 1 (never a silent vanish) + * - documented resolution priority: repo layout beats plugin-dir self + * - byte-exact stdio relay from a foreign cwd (Codex passes unpredictable + * cwds between versions) + * - SIGTERM reaches the MCP child (POSIX; kill() is emulated on Windows) + */ +import { test, after } from "node:test"; +import assert from "node:assert/strict"; +import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const REPO = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const SHELL_SRC = path.join(REPO, "plugins", "codex", "mcp-server.mjs"); + +const roots: string[] = []; +const live: Set = new Set(); + +function freshRoot(): string { + const dir = fs.mkdtempSync(path.join(os.tmpdir(), "bili-mcphost-")); + roots.push(dir); + return dir; +} + +after(() => { + for (const c of live) { + try { c.kill(); } catch { /* already gone */ } + } + for (const dir of roots.splice(0)) fs.rmSync(dir, { recursive: true, force: true }); +}); + +/** Copies the real shell to /nested/inner/ and returns the inner dir. */ +function installShell(root: string): string { + const inner = path.join(root, "nested", "inner"); + fs.mkdirSync(inner, { recursive: true }); + fs.copyFileSync(SHELL_SRC, path.join(inner, "mcp-server.mjs")); + return inner; +} + +function waitFor(label: string, ms: number, fn: () => boolean): Promise { + const deadline = Date.now() + ms; + return new Promise((resolve, reject) => { + const tick = () => { + if (fn()) return resolve(); + if (Date.now() > deadline) return reject(new Error(`timeout waiting: ${label}`)); + setTimeout(tick, 25); + }; + tick(); + }); +} + +interface Proc { + child: ChildProcessWithoutNullStreams; + out: () => string; + err: () => string; + endStdin: () => void; + done: Promise<{ code: number | null; signal: NodeJS.Signals | null }>; +} + +function startShell(shellPath: string, cwd: string, env: Record): Proc { + const child = spawn(process.execPath, [shellPath], { cwd, env: { ...process.env, ...env } as NodeJS.ProcessEnv }); + live.add(child); + let so = ""; + let se = ""; + child.stdout.on("data", (d) => { so += d.toString(); }); + child.stderr.on("data", (d) => { se += d.toString(); }); + const done = new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve) => { + child.on("close", (code, signal) => { + live.delete(child); + resolve({ code, signal }); + }); + }); + return { child, out: () => so, err: () => se, endStdin: () => child.stdin.end(), done }; +} + +async function withDeadline(label: string, ms: number, p: Promise): Promise { + return await Promise.race([ + p, + new Promise((_, reject) => setTimeout(() => reject(new Error(`timeout: ${label}`)), ms).unref()), + ]); +} + +test("no resolvable entry: exit 1, stderr lists every attempted path", async () => { + const root = freshRoot(); + const inner = installShell(root); + // Strip PATH so the global-npm probes cannot find anything anywhere; + // APPDATA/LOCALAPPDATA would add Windows-only fallback roots. + const p = startShell(path.join(inner, "mcp-server.mjs"), root, { + PATH: "", + APPDATA: undefined, + LOCALAPPDATA: undefined, + BILI_MCP_ENTRY: undefined, + }); + const r = await withDeadline("no-entry exit", 15000, p.done); + assert.equal(r.code, 1, `expected exit 1, got ${r.code}\nstdout: ${p.out()}\nstderr: ${p.err()}`); + assert.match(p.err(), /\[bili-codex\] 找不到 billion-context 的 MCP 入口/); + assert.match(p.err(), /已尝试/); + assert.ok(p.err().includes(path.resolve(inner, "..", "..", "dist", "mcp.js")), "repo-layout candidate must be listed"); + assert.ok(p.err().includes(path.join(inner, "dist", "mcp.js")), "plugin-dir candidate must be listed"); + assert.match(p.err(), /BILI_MCP_ENTRY/); +}, ); + +test("resolution priority: repo layout wins over plugin-dir self", async () => { + const root = freshRoot(); + const inner = installShell(root); + const reportFile = path.join(root, "entry-report.txt"); + const entrySrc = (marker: string) => + `import fs from "node:fs";\nfs.writeFileSync(process.env.ENTRY_REPORT_FILE, ${JSON.stringify(marker)});\n`; + fs.mkdirSync(path.join(root, "dist"), { recursive: true }); + fs.mkdirSync(path.join(inner, "dist"), { recursive: true }); + fs.writeFileSync(path.join(root, "dist", "mcp.js"), entrySrc("repo-layout\n")); + fs.writeFileSync(path.join(inner, "dist", "mcp.js"), entrySrc("plugin-dir\n")); + + const p = startShell(path.join(inner, "mcp-server.mjs"), root, { ENTRY_REPORT_FILE: reportFile }); + await withDeadline("entry report", 10000, waitFor("entry report file", 10000, () => fs.existsSync(reportFile))); + assert.equal(fs.readFileSync(reportFile, "utf8"), "repo-layout\n", "documented order: repo layout before plugin-dir"); + p.endStdin(); + await withDeadline("clean exit", 10000, p.done); +}); + +test("stdio is relayed byte-exact from a foreign cwd", async () => { + const root = freshRoot(); + const inner = installShell(root); + const stub = path.join(root, "stub-entry.mjs"); + fs.writeFileSync(stub, [ + 'let buf = "";', + 'process.stdin.setEncoding("utf8");', + 'process.stdin.on("data", (d) => {', + ' buf += d;', + ' let i;', + ' while ((i = buf.indexOf("\\n")) >= 0) {', + ' const line = buf.slice(0, i);', + ' buf = buf.slice(i + 1);', + ' if (line.trim()) process.stdout.write(\'{"jsonrpc":"2.0","id":1,"result":{"stub":"ok"}}\\n\');', + ' }', + '});', + "", + ].join("\n")); + + const p = startShell(path.join(inner, "mcp-server.mjs"), root, { BILI_MCP_ENTRY: stub }); + p.child.stdin.write(`${JSON.stringify({ jsonrpc: "2.0", id: 1, method: "initialize" })}\n`); + await withDeadline("relay", 10000, waitFor("relayed response", 10000, () => p.out().length > 0)); + p.endStdin(); + const r = await withDeadline("exit after EOF", 10000, p.done); + assert.equal(r.code, 0, `expected clean exit, got ${r.code}\nstderr: ${p.err()}`); + assert.equal(p.out(), '{"jsonrpc":"2.0","id":1,"result":{"stub":"ok"}}\n', "relay must be byte-exact"); +}); + +test("SIGTERM on the shell reaches the MCP child (POSIX)", { + skip: process.platform === "win32" ? "kill() is emulated on Windows; forwarding is verified on POSIX runners" : false, +}, async () => { + const root = freshRoot(); + const inner = installShell(root); + const readyFile = path.join(root, "ready.txt"); + const dieFile = path.join(root, "die.txt"); + const stub = path.join(root, "sig-stub.mjs"); + fs.writeFileSync(stub, [ + 'import fs from "node:fs";', + // Signal listeners do not keep a Node process alive; resume() does, which + // mirrors Codex holding the MCP server's stdio open between requests. + 'process.stdin.resume();', + 'for (const sig of ["SIGINT", "SIGTERM"]) {', + ' process.on(sig, () => { fs.writeFileSync(process.env.STUB_DIE_FILE, sig + "\\n"); process.exit(0); });', + '}', + 'fs.writeFileSync(process.env.STUB_READY_FILE, "ready\\n");', + "", + ].join("\n")); + + const p = startShell(path.join(inner, "mcp-server.mjs"), root, { + BILI_MCP_ENTRY: stub, + STUB_READY_FILE: readyFile, + STUB_DIE_FILE: dieFile, + }); + await withDeadline("child ready", 10000, waitFor("child ready", 10000, () => fs.existsSync(readyFile))); + p.child.kill("SIGTERM"); + const r = await withDeadline("shell exit after SIGTERM", 10000, p.done); + assert.ok(r.code === 0 || r.signal !== null, `shell must exit, got code=${r.code} signal=${r.signal}`); + assert.equal(fs.readFileSync(dieFile, "utf8"), "SIGTERM\n", "child must receive the forwarded signal"); +}); diff --git a/tests/codex-plugin-version-sync.test.ts b/tests/codex-plugin-version-sync.test.ts new file mode 100644 index 0000000000..4ec48da9be --- /dev/null +++ b/tests/codex-plugin-version-sync.test.ts @@ -0,0 +1,156 @@ +/** + * #4449 — release gate for plugin manifest versions. + * + * scripts/sync-codex-plugin-version.mjs copies package.json's version into the + * four plugin manifests (Codex marketplace, Codex plugin, Claude marketplace, + * Claude plugin); all three publish workflows run `--check` before tag/publish, + * so this script IS the release gate. These tests pin both directions (gate + * discipline, #3617): drift must fail --check, and write mode must converge + * without clobbering the rest of each manifest. + */ +import { test, after } from "node:test"; +import assert from "node:assert/strict"; +import { execFileSync } from "node:child_process"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const REPO = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const SCRIPT_SRC = path.join(REPO, "scripts", "sync-codex-plugin-version.mjs"); + +const NEW_VERSION = "0.99.42"; +const OLD_VERSION = "0.99.41"; + +const fixtures: string[] = []; + +interface Fixture { + root: string; + script: string; +} + +function makeFixture(pkgVersion: string, manifestVersion: string): Fixture { + const root = fs.mkdtempSync(path.join(os.tmpdir(), "bili-syncgate-")); + fixtures.push(root); + const write = (rel: string, data: unknown) => { + const abs = path.join(root, rel); + fs.mkdirSync(path.dirname(abs), { recursive: true }); + fs.writeFileSync(abs, `${JSON.stringify(data, null, 2)}\n`); + }; + + write("package.json", { name: "billion-context", version: pkgVersion }); + write(".agents/plugins/marketplace.json", { + name: "billion-context", + interface: { displayName: "billion-context" }, + plugins: [ + { + name: "billion-context", + source: "./plugins/codex", + version: manifestVersion, + policy: { installation: "AVAILABLE", authentication: "ON_INSTALL" }, + }, + { + name: "some-other-plugin", + source: "./other", + version: "9.9.9", + }, + ], + }); + write(".claude-plugin/marketplace.json", { + name: "billion-context", + plugins: [{ name: "billion-context", source: "./" , version: manifestVersion }], + }); + write(".claude-plugin/plugin.json", { + name: "billion-context", + version: manifestVersion, + description: "context compression proxy", + }); + write("plugins/codex/.codex-plugin/plugin.json", { + name: "billion-context", + version: manifestVersion, + description: "codex lane", + }); + + const scriptDir = path.join(root, "scripts"); + fs.mkdirSync(scriptDir, { recursive: true }); + const script = path.join(scriptDir, "sync-codex-plugin-version.mjs"); + fs.copyFileSync(SCRIPT_SRC, script); + return { root, script }; +} + +after(() => { + for (const dir of fixtures.splice(0)) fs.rmSync(dir, { recursive: true, force: true }); +}); + +function run(script: string, ...args: string[]): { code: number; out: string; err: string } { + try { + const out = execFileSync(process.execPath, [script, ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }); + return { code: 0, out, err: "" }; + } catch (err) { + const e = err as { status?: number; stdout?: string; stderr?: string }; + return { code: e.status ?? -1, out: e.stdout ?? "", err: e.stderr ?? "" }; + } +} + +test("--check fails (exit 1) when every manifest is behind package.json", () => { + const fx = makeFixture(NEW_VERSION, OLD_VERSION); + const r = run(fx.script, "--check"); + assert.equal(r.code, 1, `expected drift failure, got ${r.code}\n${r.out}${r.err}`); + assert.match(r.out, /漂移/, "drifted files must be listed"); + for (const rel of [ + ".agents/plugins/marketplace.json", + "plugins/codex/.codex-plugin/plugin.json", + ".claude-plugin/marketplace.json", + ".claude-plugin/plugin.json", + ]) { + assert.ok(r.out.includes(rel), `drift report must name ${rel}`); + } +}); + +test("--check passes (exit 0) when everything already matches", () => { + const fx = makeFixture(NEW_VERSION, NEW_VERSION); + const r = run(fx.script, "--check"); + assert.equal(r.code, 0, r.out + r.err); +}); + +test("write mode converges all four manifests, keeps other fields, and is idempotent", () => { + const fx = makeFixture(NEW_VERSION, OLD_VERSION); + const r = run(fx.script); + assert.equal(r.code, 0, r.out + r.err); + + const read = (rel: string) => JSON.parse(fs.readFileSync(path.join(fx.root, rel), "utf8")); + + const agents = read(".agents/plugins/marketplace.json"); + const bc = agents.plugins.find((p: { name: string }) => p.name === "billion-context"); + assert.equal(bc.version, NEW_VERSION); + assert.equal(bc.source, "./plugins/codex", "untouched fields must survive"); + assert.deepEqual(bc.policy, { installation: "AVAILABLE", authentication: "ON_INSTALL" }); + const other = agents.plugins.find((p: { name: string }) => p.name === "some-other-plugin"); + assert.equal(other.version, "9.9.9", "foreign plugin entries must not be rewritten"); + assert.equal(agents.name, "billion-context"); + + assert.equal(read(".claude-plugin/marketplace.json").plugins[0].version, NEW_VERSION); + const claudePlugin = read(".claude-plugin/plugin.json"); + assert.equal(claudePlugin.version, NEW_VERSION); + assert.equal(claudePlugin.description, "context compression proxy"); + assert.equal(read("plugins/codex/.codex-plugin/plugin.json").version, NEW_VERSION); + + const before = fs.readFileSync(path.join(fx.root, ".agents/plugins/marketplace.json"), "utf8"); + const again = run(fx.script); + assert.equal(again.code, 0, again.out + again.err); + assert.equal(fs.readFileSync(path.join(fx.root, ".agents/plugins/marketplace.json"), "utf8"), before, "second run must be a no-op"); + assert.match(again.out, /完成/); + + const recheck = run(fx.script, "--check"); + assert.equal(recheck.code, 0, "post-sync --check must pass"); +}); + +test("marketplace without a billion-context plugin entry is skipped, not drifted", () => { + const fx = makeFixture(NEW_VERSION, NEW_VERSION); + const rel = ".claude-plugin/marketplace.json"; + const data = JSON.parse(fs.readFileSync(path.join(fx.root, rel), "utf8")); + data.plugins = []; + fs.writeFileSync(path.join(fx.root, rel), `${JSON.stringify(data, null, 2)}\n`); + const r = run(fx.script, "--check"); + assert.equal(r.code, 0, `missing entry must not fail the gate: ${r.out}${r.err}`); +});