Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: CI

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
Expand Down Expand Up @@ -33,7 +34,7 @@ jobs:
run: bash scripts/preflight.sh --base "${{ github.event.pull_request.base.sha }}" --skip-release-state

- name: Run main preflight
if: github.event_name == 'push'
if: github.event_name != 'pull_request'
run: bash scripts/preflight.sh --skip-payload-source --skip-release-state

windows-install-smoke:
Expand Down Expand Up @@ -76,6 +77,10 @@ jobs:
- name: Verify Linux native baseline
run: node scripts/verify-upstream-compat.js --skip-latest --native-linux-x64 --fail-on-skip --json --verify-install

- name: Verify upgrade through the installed launcher
shell: bash
run: bash scripts/verify-native-upgrade.sh

windows-native-compat:
name: windows-native-compat (${{ matrix.shard }})
runs-on: windows-2022
Expand All @@ -95,6 +100,11 @@ jobs:
- name: Install native verification dependency
run: npm install --global node-lief@1.3.2

- name: Verify upgrade through the installed launcher
if: matrix.shard == 0
shell: bash
run: bash scripts/verify-native-upgrade.sh

- name: Verify Windows native support window
shell: powershell
env:
Expand Down Expand Up @@ -122,3 +132,7 @@ jobs:
VERSIONS="$(node -p 'require("./scripts/upstream-compat.config.json").support.macosNativeExperimental.representatives.filter(v => Number(v.split(".")[2]) >= 242).join(",")')"
test -n "$VERSIONS"
node scripts/verify-upstream-compat.js --baseline "$VERSIONS" --skip-latest --native-macos-arm64 --fail-on-skip --json --verify-install

- name: Verify upgrade through the installed launcher
shell: bash
run: bash scripts/verify-native-upgrade.sh
63 changes: 63 additions & 0 deletions .github/workflows/native-latest-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,66 @@ jobs:
name: linux-native-latest-candidate
path: ${{ steps.verify.outputs.json_path }}
if-no-files-found: error

propose-update:
name: Open verified native support PR
needs: [verify, verify-windows, verify-linux]
if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
actions: write
concurrency:
group: native-support-pr
cancel-in-progress: false
steps:
- uses: actions/checkout@v6
with:
ref: main
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: actions/download-artifact@v6
with:
pattern: '*native-latest-candidate*'
path: /tmp/native-candidates
merge-multiple: true
- name: Promote the three verified reports
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
mac=(/tmp/native-candidates/native-latest-candidate-*.json)
win=(/tmp/native-candidates/windows-native-latest-candidate-*.json)
linux=(/tmp/native-candidates/linux-native-candidate-*.json)
test "${#mac[@]}" = 1 && test "${#win[@]}" = 1 && test "${#linux[@]}" = 1
node scripts/promote-native-candidate.js --candidate "${mac[0]}" --platform macos --write
node scripts/promote-native-candidate.js --candidate "${win[0]}" --platform windows --write
node scripts/promote-native-candidate.js --candidate "${linux[0]}" --platform linux --write
if git diff --quiet; then exit 0; fi
VERSION="$(node -e 'const s=require("./scripts/upstream-compat.config.json").support;const v=[s.macosNativeExperimental.ceiling,s.windowsNativeExperimental.ceiling,s.linuxNativeExperimental.ceiling];if(new Set(v).size!==1)process.exit(1);process.stdout.write(v[0]);')"
BRANCH="codex/native-latest-${VERSION}"
if [ -n "$(gh pr list --head "$BRANCH" --state open --json number --jq '.[].number')" ]; then exit 0; fi
node scripts/generate-plugin-support-window.js --write
node scripts/generate-support-matrix.js
node scripts/sync-readme-support-window.js --write
node scripts/prepare-native-release-closeout.js --native-version "$VERSION"
node scripts/sync-doc-derived-counts.js --write
git switch -c "$BRANCH"
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add scripts/upstream-compat.config.json plugin/support-window.json docs/support-matrix.md README.md plugin/manifest.json plugin/.claude-plugin/plugin.json CHANGELOG.md AGENTS.md CLAUDE.md
git commit -m "chore: verify Claude Code ${VERSION} on three platforms"
bash scripts/preflight.sh --base origin/main --skip-release-state
git push origin "$BRANCH"
cat > /tmp/native-pr.md <<BODY
三个平台的新版验证均通过,更新 Claude Code ${VERSION} 的发布验证清单。

已运行本地预检;自动触发分支 CI。新增文案仍需审核,不代表完整中文覆盖;本 PR 不自动合并或发布。
BODY
gh pr create --head "$BRANCH" --base main --title "跟进 Claude Code ${VERSION} 三平台验证" --body-file /tmp/native-pr.md
# GITHUB_TOKEN 创建 PR 不触发 pull_request;显式运行同一提交的完整 CI。
gh workflow run ci.yml --ref "$BRANCH"
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
- **次版本号**:新增功能或显著改进(比如新增 patch、新增翻译)
- **修订号**:Bug 修复和小调整(比如修正一条翻译)

## [2.17.0] - 2026-09-16

### 改进

- 原生 Claude Code 接入启动前汉化:通过安装器配置一次启动入口后,普通升级和同版本重装在下次 `claude` 启动时自动检测并修复,无需重新安装插件。
- 安装器与 Unix 会话 Hook 共用补丁事务;验证副本后才替换实际程序,通过文件指纹识别更新、备份和规则变更,保护运行中的文件与并发更新。
- Linux x64 glibc 未收录版本也能按程序结构进行本机验证;发布支持清单仍仅记录已验证版本,不增加 arm64 / musl 支持。
- 启动器从正式插件安装记录选择当前版本,市场更新后在下一次启动使用新规则,并尊重停用设置;启动前不请求网络。
- 三平台新版检查成功后自动生成适配 PR,并显式运行分支 CI;不自动合并或发布。

### 修复

- 移除以禁用 Claude Code 自动更新维持汉化的安装提示和开关。
- Windows 原生程序已被占用时明确提示关闭占用窗口后再次启动,不再要求重复安装插件。

## [2.16.1] - 2026-09-14

### 修复
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ install.ps1 会自动完成与 install.sh 相同的步骤:正式插件注册

> **Windows native .exe 用户先装 node-lief**:如果当前 Claude Code 是 2.1.113+ native `.exe`,请先运行 `npm install -g node-lief` 再装插件。未安装时 Layer 4 CLI Patch 会跳过,Layer 1~3 不受影响。也可以继续通过 [WSL](https://learn.microsoft.com/zh-cn/windows/wsl/install) 使用 `install.sh`。

Claude Code 在 Windows 更新后,插件不会现场改写正在运行并被系统锁定的 `claude.exe`。先照常使用;方便时关闭所有 Claude Code 窗口,再回到本项目目录重跑上面的 `install.ps1`,安装器会完成补丁、启动自检和失败回滚。
Claude Code 在 Windows 更新后,插件不会现场改写正在运行并被系统锁定的 `claude.exe`。关闭占用窗口后,再通过已安装的 `claude` 启动器启动,会在启动前完成补丁和自检,无需重装插件。


### 各安装方式的中文化程度
Expand All @@ -226,13 +226,13 @@ Claude Code 在 Windows 更新后,插件不会现场改写正在运行并被
| 安装方式 | 中文化程度 |
|---------|-----------|
| `npm install -g @anthropic-ai/claude-code@2.1.112` | 最完整(推荐) |
| `npm install -g @anthropic-ai/claude-code`(latest) | macOS / Windows native 新版先本机自检;Linux native 仅启用已发布窗口 |
| `npm install -g @anthropic-ai/claude-code`(latest) | macOS / Windows native 新版先本机自检;Linux x64 glibc 新版先本机自检 |
| `curl -fsSL https://claude.ai/install.sh \| bash -s 2.1.112` | 官方安装器指定已验证旧版本(需要 `node-lief`) |
| `curl -fsSL https://claude.ai/install.sh \| sh`(latest) | macOS 新版先本机自检;Linux x64 glibc 仅启用支持矩阵列出的实际版本 |
| `curl -fsSL https://claude.ai/install.sh \| sh`(latest) | macOS 新版先本机自检;Linux x64 glibc 新版先本机自检 |
| `curl -fsSL https://claude.ai/install.sh \| bash -s 2.1.265` | Linux x64 glibc 已验证版本(需要 `node-lief >=1.3.0`);不含 arm64、musl 或未验证版本 |
| `powershell -File install.ps1` | Windows:旧 npm cli.js 最完整;native .exe `2.1.113 - 2.1.265` 内已验证版本需 `node-lief`;Claude 更新后关闭所有窗口并重跑 |

> **native binary 说明**:官方安装器和新版 npm 包安装的是原生程序。插件会按容器格式翻译:源码构建提取并写回 JS,字节码构建在原字符串占位内写入中文;译文超过占位长度时保留英文。两条路径均在启动自检通过后记录成功,macOS 还会重新签名。已验证版本见[支持矩阵](./docs/support-matrix.md),不代表完整中文覆盖。Linux x64 glibc 仅启用矩阵列出的版本,需要 `node-lief >=1.3.0`。Windows 更新 Claude Code 后,请关闭所有 Claude Code 窗口,再重跑 `install.ps1`。
> **native binary 说明**:官方安装器和新版 npm 包安装的是原生程序。插件会按容器格式翻译:源码构建提取并写回 JS,字节码构建在原字符串占位内写入中文;译文超过占位长度时保留英文。两条路径均在启动自检通过后记录成功,macOS 还会重新签名。已验证版本见[支持矩阵](./docs/support-matrix.md),不代表完整中文覆盖。Linux x64 glibc 未收录版本须通过本机验证,需要 `node-lief >=1.3.0`。Windows 更新 Claude Code 后,请关闭所有 Claude Code 窗口,再通过已安装的 `claude` 启动器启动。

安装脚本会自动检测安装方式,无需手动选择。
<!-- readme-support-window:install-advice:end -->
Expand Down Expand Up @@ -268,7 +268,7 @@ powershell -NoProfile -ExecutionPolicy Bypass -File .\doctor.ps1 # Windows

### 更新

Claude Code 更新后,npm / macOS native 安装会在首次会话启动时**自动检测版本变更并重新 patch**;Windows native 会保留原版可用,并提示关闭窗口后重跑安装器。新版先本机自检;只有格式、依赖、提取或自检失败才跳过原生 Layer 4,不会让 CLI 失效。
通过安装器安装启动入口后,Claude Code 更新或同版本重装会在下次运行 `claude` 时**先检测文件变化,再验证并补汉化**;Windows 文件被其他窗口占用时,需要关闭占用窗口后再次启动。新版先本机自检;只有格式、依赖、提取或自检失败才跳过原生 Layer 4,不会让 CLI 失效。

插件本体发布新 Release 后,正式安装态由 Claude Code 插件管理器更新。独立兜底安装只做限时检查并提示,不会在会话启动途中原地覆盖自身;本地源码安装用户在会话结束后运行 `git pull && ./install.sh`(Windows:`git pull` 后重跑 `install.ps1`)。

Expand All @@ -280,15 +280,15 @@ Claude Code 更新后,npm / macOS native 安装会在首次会话启动时**
| macOS / Linux / WSL · npm 全局安装 | `2.1.92 - 2.1.112` | 翻译最完整;launcher 启动前自修复 + `session-start` 兜底 |
| macOS · 官方安装器(native) | `2.1.110 - 2.1.112` | 需要 `node-lief` |
| macOS · native binary(arm64) | `2.1.113 - 2.1.265` 内的已验证版本 | 需要 `node-lief`;个别版本未收录,见支持矩阵 |
| Linux · native binary(x64 glibc) | `2.1.220 - 2.1.265` | 需要 `node-lief >=1.3.0`;仅支持矩阵列出的版本,不含 arm64、musl |
| Linux · native binary(x64 glibc) | `2.1.220 - 2.1.265` | 需要 `node-lief >=1.3.0`;未收录版本先本机验证,不含 arm64、musl |
| Windows · npm(PowerShell) | `2.1.92 - 2.1.112` | 用 install.ps1,需 PowerShell 5.1+ |
| Windows · native .exe(x64) | `2.1.113 - 2.1.265` 内的已验证版本 | 需要 `node-lief`;个别版本未收录,见支持矩阵 |
| Linux · 其他官方安装器形态 | 暂无已验证版本 | 仅 Layer 1~3 生效 |

> - **macOS / Windows 版本号不是运行门禁**:高于已知 native 下限、且仍能被识别的新版会先在本机临时副本上翻译并执行启动自检;通过后才替换。已有词条继续中文,新文案原样保留英文。
> - **Linux 不走 provisional**:Linux x64 glibc 仅启用支持矩阵列出的已验证版本;arm64、musl 和未验证的新版本不执行 CLI Patch。
> - **Linux 本机验证**:Linux x64 glibc 的未收录版本先按程序结构和启动自检验证;不支持 arm64、musl,不代表未来版本全量兼容。
> - **失败不伤 CLI**:补丁、重打包或启动自检任一步失败,都会保留或恢复原文件;失败只影响中文覆盖,不影响 Claude Code 使用。
> - **Windows 不热改运行中的 exe**:Claude Code 更新后先保持原版可用;关闭所有 Claude Code 窗口,再按 Windows 安装命令重跑 `install.ps1`,由安装器补丁并自检。
> - **Windows 不热改运行中的 exe**:Claude Code 更新后先保持原版可用;关闭占用窗口后通过已安装的 `claude` 启动器再次启动,自动补丁并自检,无需重装。
> - **格式变化才停手**:如果未来版本不再是可识别的 native 格式、依赖缺失、提取失败或启动自检失败,只跳过 Layer 4,Layer 1~3 继续生效。
> - **矩阵只记录证据**:纯上游兼容证据可以更新支持矩阵,不要求插件升版;只有插件代码、翻译或 manifest 变化才发布新版。
> - **已验证版本完整清单**(含个别未收录版本)见 [docs/support-matrix.md](./docs/support-matrix.md),由脚本自动生成。
Expand Down
1 change: 1 addition & 0 deletions compute-patch-revision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const files = [
"bun-binary-io.js",
"compute-patch-revision.sh",
"scripts/patch-bytecode.js",
"scripts/native-repair.js",
];
const hash = crypto.createHash("sha256");

Expand Down
Loading