Skip to content

版本探测增加重试与数据降级,新增 --bundle 输出模式 - #2

Merged
RGB-loop merged 1 commit into
mainfrom
feat/bundle-and-probe-fix
Sep 24, 2026
Merged

RGB-loop merged 1 commit into
mainfrom
feat/bundle-and-probe-fix

Conversation

@RGB-loop

Copy link
Copy Markdown
Owner

Summary

  • 版本探测健壮性: probe_version() 失败时等 2s 重试一次(应对 macOS Gatekeeper 首次执行新路径二进制的延迟);仍失败则从二进制数据扫描 semver 常量池条目作为降级方案(probe_version_from_data)
  • quarantine 时序修复: pipeline.run() 在自己的 probe_version 调用之前先清除 quarantine 属性(此前仅 analyze.run 做了这一步,pipeline 的探测在清除之前)
  • --bundle 输出模式: 创建 v{版本号}/ 目录,放入原始二进制和带后缀的换肤二进制;all 和 skin 命令均可用

背景

实际换肤 2.1.281 bytecode 构建时遇到两个问题:

  1. 首次 probe_version 静默失败,导致 rewrite_real_version=true 时版本补丁被整体跳过,只在输出中留了一条 warning;第二次运行同一二进制就成功了(Gatekeeper 首次公证检查)
  2. 用户希望按版本号组织输出(原始+换肤并排放置),而非 in-place 修改

用法

# bundle 模式: 创建 v2.1.281/ 目录
python3 -m patcher all /path/to/claude --apply -y --bundle

# 自定义后缀和输出目录
python3 -m patcher all /path/to/claude --apply -y --bundle --suffix mod --output-dir /tmp/out

# 交互向导也支持
python3 -m patcher skin --bundle

Test plan

  • 73 tests pass (python3 -m unittest discover -s tests -v)
  • all --bundle 在真实二进制上创建正确的目录结构
  • 版本探测重试在 Gatekeeper 延迟场景下成功

probe_version 失败时等 2s 重试一次(应对 macOS Gatekeeper 首次执行延迟);
仍失败则从二进制数据扫描 semver 常量池条目作为降级方案。

pipeline.run 在探测前先去 quarantine(此前仅 analyze.run 做了这一步,
pipeline 自己的探测调用在 quarantine 清除之前)。

新增 --bundle 模式: 创建 v{版本号}/ 目录,放入原始二进制和带后缀的换肤
二进制(默认后缀 skin,可通过 --suffix 自定义)。all 和 skin 命令均可用。
@RGB-loop
RGB-loop merged commit e6e9417 into main Sep 24, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant