Repository navigation
Releases
v0.9.0 — passthrough args + shared env
cce v0.9.0 — 参数透传 + 共享 env · passthrough args + shared env
这次更新让启动参数更贴近 Claude Code 本身:常用会话参数可以直接使用,其他 Claude 参数统一放在 -- 后透传;同时新增根级共享 env,让所有服务商配置共用一层与模型无关的环境变量。
This release makes launch arguments feel native to Claude Code: common session flags work directly, while every other Claude argument goes after --. It also adds a root-level shared env layer for model-independent variables used by every provider config.
新增 / New
- 标准参数透传 / standard passthrough:
cce -- <claude args...>会把--后的 token 原样追加到 Claude 参数;-o/--only可丢弃配置中的全局和按 env 默认参数。/ Put Claude arguments after--; add-o/--onlyto drop configured defaults. - 会话快捷参数 / session shortcuts:新增
-c/--continue、-r/--resume [id]、-n/--name <name>,无需再包进参数字符串。/ Common continue, resume, and session-name flags now work directly. - 根级共享 env / root shared env:配置根部新增
env,先作为所有命名 env 的公共基底,再由所选 env 逐 key 覆盖。/ A rootenvnow acts as the shared base for every named env, with the selected env overriding per key.
env 合并语义 / env merge semantics
- CCE 先合并根级
env与所选 env;null会规范化为"",表示显式清空,而不是删除该 key。/ CCE first merges root and selected env values;nullbecomes"", an explicit clear rather than key deletion. override/merge-cce下,显式空值会覆盖settings.json的同名值。/ Underoverride/merge-cce, explicit empty values override matchingsettings.jsonvalues.merge-claude下,冲突仍由settings.json胜出。/ Undermerge-claude,settings.jsonstill wins conflicts.cce show会展示合并后的 env、空字符串以及值来自根级还是具体 env。/cce showdisplays merged values, explicit empty strings, and their root/per-env source.
变化 / Changes
- 旧的
-a/-A已移除;分别改用--和-o --。命中旧参数时会显示迁移提示。/ Legacy-a/-Aare removed; use--and-o --instead. Migration hints are printed for old invocations. - Bash、Zsh、Fish、PowerShell 补全及中英文帮助、README、使用文档已同步新参数和共享 env。/ Shell completions, bilingual help, READMEs, and usage docs now reflect the new arguments and shared env layer.
示例 / Examples
cce -e kimi -c
cce -e kimi -- --permission-mode default
cce -e kimi -o -- --resume SESSION_ID升级 / Upgrade
cce update 或 / or npm i -g @xiaofuzhou/cce@latest
Full changelog: v0.8.0...v0.9.0
v0.8.0 — parameterized templates (plans & models)
cce v0.8.0 — 参数化模板:一个模板,多套餐 / 多模型 · parameterized templates (plans & models)
模板从「一份固定配置」升级为「一张带选择的表单」。同一个服务商的不同套餐(如小米 MiMo 的按量付费 / Token Plan 订阅)和不同模型版本(如 Kimi 的 k2.7-code / k2.6)合并进一个模板——cce add 时弹菜单选一选、填个 Key 即可,env 名也按你的选择自动生成(mimo-tp、kimi-k2.7-code)。
Templates go from "one fixed config" to "a form with choices". A provider's different plans (Xiaomi MiMo pay-as-you-go vs Token Plan) and model versions (Kimi k2.7-code vs k2.6) now live in one template — cce add shows menus, you pick and paste a key, and the env is auto-named from your choices (mimo-tp, kimi-k2.7-code).
新增 / New
- 参数化模板(v2)/ parameterized templates:模板支持
inputs表单树——select(单选,可嵌套)、env/var(提问输入)、const(固定值);最终env用${var}渲染,把「选择」与「配置」解耦。一份模板表达多套餐 × 多模型,零重复。/ Templates gain aninputstree —select(nestable),env/varprompts,const— and the finalenvis rendered from${var}, so one template covers plans × models with no duplication. - 交互更顺 + 自动命名 / smarter prompts + auto-naming:
cce add mimo先选套餐、cce add kimi先选模型,env 默认名由模板的name表达式生成(如kimi-${model})。/cce addasks the right questions; the default env name comes from the template'snameexpression. - 非交互
--set/ non-interactive--set:cce add mimo --set plan=tp --set ANTHROPIC_AUTH_TOKEN=tp-xxxxx,适合脚本 / CI。/ Pre-answer every choice and field for scripts/CI. cce template show树状展示 / tree view:跑之前先看清这个模板有哪些维度可选、会问哪些字段。/ See a template's choices and prompted fields before you run it.
变化 / Changes
- 模板源按版本分文件 / versioned template source:默认源 URL 改为
builtin.v${version}.json,每个 cce 只拉它能解析的格式;URL 支持官方${var}(目前version),cce template url设置时校验。老客户端继续拉冻结的builtin.json,互不影响。/ The default source URL is nowbuiltin.v${version}.json; each cce only fetches the format it understands. Old clients keep using the frozenbuiltin.json. - 缓存有效期 24h → 3h / cache TTL 24h → 3h:过期后联网刷新(5 秒超时),5 秒内拿到就用最新、否则降级用本地缓存。/ Refetch after 3h with a 5s timeout; fall back to the cached copy on timeout.
- 各服务商 Key 获取地址补全 / direct API-key links:DeepSeek、Kimi、小米 MiMo(按套餐区分)、智谱(按中英文区分)的 Key 页面直链都写进了提示。/ Each provider's API-key page is now linked in the prompt.
- README 示例加
args说明 / READMEargstip:示例配置里演示了常用的"args": "--permission-mode bypassPermissions"(跳过权限确认)。
升级 / Upgrade
cce update 或 / or npm i -g @xiaofuzhou/cce@latest
v2 的交互式表单需要升级 cce 本体才能用上;旧版本仍走冻结的 v1 模板,正常工作。/ The v2 interactive forms require updating cce itself; older versions keep working off the frozen v1 templates.
Full changelog: v0.7.0...v0.8.0
v0.7.0 — template docs links + cce template docs + Xiaomi MiMo
cce v0.7.0 — 模板文档直达 + 小米 MiMo 模板 / template docs links + Xiaomi MiMo templates
每个内置模板现在都带官方文档链接,新命令 cce template docs 一键在浏览器打开,配置对不对、模型名变没变,跳过去一比就知道。同时新增小米 MiMo 两套模板(按量付费 / Token Plan),智谱 GLM 模板按官方文档补齐模型映射。
Every builtin template now carries its official docs URL, and the new cce template docs command opens it in your browser — one jump to verify your config against the provider's own page. Also new: two Xiaomi MiMo templates (pay-as-you-go / Token Plan), and the GLM template gains the official model mappings.
新增 / New
cce template docs <名> [--print](别名doc)/ (aliasdoc)浏览器打开失败时自动降级为打印链接;仅放行 http(s) 链接。/ Falls back to printing the URL when no browser is available; only http(s) URLs are ever handed to the OS.cce template docs deepseek # 在浏览器打开官方接入文档 / open the official docs in your browser cce template docs # 不带名字:弹出模板选择菜单 / no name: interactive picker cce template docs glm -p # 只打印 URL(SSH/无图形环境)/ just print the URL (headless)
- 模板新增
docs字段 /docsfield on templates:cce template show会显示文档链接,cce add创建成功后也会附上,方便对照官方文档确认配置。/ Shown incce template showand aftercce add, so you can verify the config against the provider's docs. - 小米 MiMo 模板 / Xiaomi MiMo templates:
mimo(按量付费 API / pay-as-you-go)与mimo-tp(Token Plan 订阅 / subscription),模型预置mimo-v2.5-pro[1m](1M 上下文 / 1M context)。
变化 / Changes
- glm 模板对齐官方文档 / GLM template synced with official docs:补上
ANTHROPIC_DEFAULT_OPUS_MODEL=glm-5.1、SONNET=glm-5-turbo、HAIKU=glm-4.5-air。 - README 重写(中英)/ README rewritten (zh + en):开头一眼看懂定位,「30 秒接入第三方 API」快速上手,与 cc-switch 的逐项对比表。/ Lead with what/why, a "30s third-party API" quickstart, and a point-by-point cc-switch comparison.
- 四种 shell 的补全、help、中英文界面文案均已更新。/ Completion for all four shells, help, and both UI languages updated.
模板(含文档链接与 MiMo)从 GitHub 实时获取,老版本 cce 也能在缓存刷新后用上新模板;但
cce template docs命令本身需要升级到 v0.7.0。/ Templates (docs links + MiMo) are fetched live from GitHub, so older cce versions pick them up after a cache refresh — but thecce template docscommand itself requires v0.7.0.
升级 / Upgrade
cce update 或 / or npm i -g @xiaofuzhou/cce@latest
Full changelog: v0.6.1...v0.7.0
v0.6.1 — fix UTF-8 BOM in settings.json parsing
cce v0.6.1 — 修复带 BOM 的 settings.json 解析 / fix BOM-prefixed settings.json parsing
带 UTF-8 BOM 的 ~/.claude/settings.json 会被 cce 误判为无法解析、当成空配置处理(Unexpected token '')。Windows 上不少编辑器写文件会自动加 BOM。Claude 本体会先剥掉 BOM 再解析,cce 现在行为对齐。
A ~/.claude/settings.json carrying a UTF-8 BOM was wrongly reported as unparseable and treated as empty (Unexpected token ''). Many editors on Windows add a BOM when saving. Claude itself strips the BOM before parsing — cce now matches that behavior.
修复 / Fixes
- BOM 容错 / BOM tolerance:新增
parseJson(),解析前剥掉开头的 U+FEFF。用户可编辑文件的读取(settings.json的 env 读取、cce 主配置加载与语言探测)统一走它。非法 JSON 仍照常报错。/ NewparseJson()strips a leading U+FEFF before parsing; all user-editable file reads (settings.json env, cce config load + language peek) route through it. Genuinely invalid JSON still errors as before.
升级 / Upgrade
cce update 或 / or npm i -g @xiaofuzhou/cce@latest
Full changelog: v0.6.0...v0.6.1
v0.6.0 — remote templates + cce template subcommand
cce v0.6.0 — 远端模板 + cce template / remote templates + cce template
模板不再随 npm 包发布,而是从 GitHub 实时获取并本地缓存——你总能拿到最新的,改模板也不用发版。新增 cce template 子命令集中管理来源、缓存与离线。
Templates are no longer bundled in the npm package — they're fetched live from GitHub (jsDelivr, with a GitHub raw fallback) and cached locally, so you always get the latest without a release. A new cce template subcommand manages the source, cache, and offline mode.
新增 / New
cce template(别名tpl)/ (aliastpl)cce template # 状态总览 / status: url, offline, cache count + age cce template ls # 列出模板(= 旧的 cce add --list)/ list templates cce template show <名> # 看某模板的 env + 待填项 / show a template's env + fields cce template refresh # 立刻重新下载(忽略 TTL/离线)/ re-download now cce template url <url> # 设内网镜像(设了就不走默认源)/ set a mirror URL cce template url --none # 清除,回到默认源 / clear, back to defaults cce template offline on # 离线:永不联网、只用缓存 / offline: cache only, no network
变化 / Changes
cce add --templates <path>→cce add --from <path|url>:一次性指定模板来源,自动判断本地路径还是 URL。cce add --list移除,改用cce template ls。/--templatesrenamed to--from(path or URL, auto-detected);--listremoved in favor ofcce template ls.- 默认模板从远端获取 + 24h 缓存:首次
cce add下载到~/.claude/cce/templates.remote.json,24 小时内复用。下载失败会打印链接和应保存的路径,方便在有网设备上手动下载。/ Default templates fetched remotely with a 24h cache; on failure cce prints the URL + the path to drop a manual download. - 内网 / 离线支持:
cce template url <镜像>指向内网镜像,或cce template offline on+ 手放缓存文件。/ Intranet via a mirror URL, or offline mode + a hand-placed cache file. - 统一缓存文件
cache.json:所有机器态(更新检查 + 模板元数据)合并到一个文件;旧的update-check.json弃用。/ All machine state unified intocache.json; oldupdate-check.jsondeprecated.
升级 / Upgrade
cce update 或 / or npm i -g @xiaofuzhou/cce@latest
Full changelog: v0.5.0...v0.6.0
v0.5.0 — cce remove (alias rm) + auto-update fixes
cce v0.5.0 — cce remove: 安全删除 env / safely remove envs
新增 cce remove(别名 rm)子命令,配合二次确认避免误删;另含 auto-update 在 Windows 上的多个修复。
A new cce remove subcommand (alias rm) with confirmation prompts; plus several auto-update fixes for Windows.
用法 / Usage
cce remove kimi # 删指定 env,二次确认 / direct delete with confirm
cce remove # TTY 下弹出选择菜单 / interactive picker (TTY)
cce remove kimi -y # 跳过确认(脚本场景) / skip confirm (scripting)
cce rm kimi # 等价别名 / alias行为细节 / Behavior details
- 默认会问
Remove env "kimi"? [y/N](默认 No)/ always prompts before deleting (default No). - 删的是当前默认 env 时,同步把
default清空 / clearsdefaultif the removed env was the default. - 选择器模式选完仍要二次确认(防 Enter 误触)/ picker path still requires explicit confirm.
- 非交互(管道 / CI / 脚本)下必须显式
-y,否则直接报错 / non-TTY requires-yor errors out. - Tab 补全已为 bash / zsh / fish / powershell 四端补上 / shell completions updated.
其它修复 / Other fixes
- Auto-update 在 Windows 不再弹 cmd 窗口 —— 后台
npm install加了windowsHide/ no more cmd flashes during silent auto-update. - Auto-update 失败可重试 —— 后台安装 1 小时内没装上目标版本,下次启动自动重试(之前会被永久标记为已尝试而不再重试)/ failed background installs now retry after 1h (previously they were stuck pending forever until a newer release).
cce add覆盖同名 env 时保留用户字段 —— 只替换模板拥有的description+env,手工添加的args/argsOverride/settingsMode不再被擦掉 / overwrite preserves user-added fields.- 内部清理:移除未使用的
setEnv/removeEnvhelper / dropped dead helpers inconfig.js. - 同步
package-lock.json到当前版本(自 0.2.0 起一直漂着)/ resyncedpackage-lock.json(drifted since 0.2.0).
升级 / Upgrade: cce update 或 / or npm i -g @xiaofuzhou/cce@latest
Full changelog: v0.4.0...v0.5.0
v0.4.0 — cce add: create env from templates
cce v0.4.0 — cce add: 从模板创建 env / create an env from a template
新增 cce add 子命令:照一份模板快速生成一套 env —— 固定项(接口地址、模型等)已填好,你只需补上自己的几项(通常是 API Key),即可写入 config.json。
A new cce add subcommand scaffolds an env from a template: the fixed parts (base URL, model, …) are pre-filled, you supply only your own fields (usually an API key), and it writes the env into config.json.
用法 / Usage
cce add # 选模板 → 填字段 → 起名 → 写入 / pick → fill → name → write
cce add deepseek # 直接用某模板 / use a template by name
cce add deepseek ds # 预设 env 名 / preset the env name
cce add --list # 只列出可用模板 / just list available templates
cce add --templates ./team.json # 本次挂载外部模板文件 / mount an external file for this run内容 / What's in it
- 内置模板 / Built-in templates: DeepSeek、Kimi K2.5、GLM,开箱即用 / usable out of the box.
- 模板解析链 / Resolution chain: 内置 →
~/.claude/cce/templates.json→--templates <path>,后者按模板名覆盖前者 / later overrides earlier by name. - 多语言描述 / Multilingual descriptions: 模板的
description与待填项说明可写成{ "en": …, "zh-CN": … },按当前界面语言显示(回退 en → 第一个非空值)/ shown in the current UI language with fallbacks. - 安全 / Safety: env 名按 schema 规则校验;重名时二选一「覆盖 / 重命名」;交互需 TTY,非交互场景给全参数即可 / schema-validated names, overwrite-or-rename on collision, TTY-gated with a non-interactive path.
文档(README / 使用指南 / 设计文档,中英双语)已同步。/ Docs (README / usage / design, both languages) updated.
升级 / Upgrade: cce update 或 / or npm i -g @xiaofuzhou/cce@latest
Full changelog: v0.3.0...v0.4.0
v0.3.0 — 自我更新 / Self-update
✨ 新功能:cce 自我更新
cce 现在可以把自己升级到 npm 最新版,分手动和启动时自动两种。
手动更新
cce update— 检查并安装最新版cce update --check— 只检查、不安装
启动时自动检查(配置项 updateMode,默认 auto)
| 模式 | 行为 |
|---|---|
auto(默认) |
发现新版后后台静默更新,下次启动提示一句「已在后台更新到 vX.Y.Z」 |
prompt |
下次在终端启动时弹「立即更新 / 跳过此版本」菜单;跳过的版本不再提示 |
off |
启动时完全不检查(仍可手动 cce update) |
细节:
- 启动时的检查走后台,不拖慢启动;结果缓存约 3 小时
- 「立即更新 / 跳过」菜单**仅在交互式终端(TTY)**出现;脚本、管道、CI 里不打扰
- 单次关闭:环境变量
CCE_NO_UPDATE_CHECK=1 - 从源码(
git clone)运行时,cce update会提示用git pull,不会乱装
📖 文档
- 中文文档新增术语速查表,把
provider(服务商)、env(启动配置)等概念讲清楚,并修正了「env ≠ 服务商」(同一服务商可建多套 env) schema.json新增updateMode,编辑器可补全/校验
✨ New: cce self-update
cce can now upgrade itself to the latest npm version — manually or automatically at launch.
Manual
cce update— check and install the latest versioncce update --check— check only, don't install
Automatic at launch (updateMode config, default auto)
| Mode | Behavior |
|---|---|
auto (default) |
Silently update in the background; the next launch prints "cce was updated to vX.Y.Z" |
prompt |
Show an Update now / Skip this version menu on the next interactive launch |
off |
Never check at launch (manual cce update still works) |
Notes: the launch check runs in the background (never slows startup, cached ~3h), the menu only appears in a TTY, CCE_NO_UPDATE_CHECK=1 disables it for one run, and source checkouts are told to use git pull.
⬆️ 升级 / Upgrade
npm i -g @xiaofuzhou/cce@latest # 或老用户直接 / or simply: cce updateFull changelog: v0.2.0...v0.3.0
v0.2.0 — settings.json 合并 + 多语言 / settings.json reconciliation + i18n
✨ settings.json env 合并(解决「切了 env 仍命中旧端点」)
Claude Code 自己也会读 ~/.claude/settings.json 的 env,里面残留的 ANTHROPIC_BASE_URL 等可能反向盖掉 cce 注入的值,导致切换静默失效。本版彻底解决:
- cce 从不改写你真实的
settings.json;它读取后按模式重组,写一份临时文件,用claude --settings <tmpfile>启动,claude 退出即删。 - 三种合并模式,可全局设、按 env 设、或按次用
-m设:
| 模式 | 效果 |
|---|---|
override(默认) |
完全以本 env 为准;settings.json 里残留的 anthropic 键被屏蔽 |
merge-cce |
与 settings.json 取并集,冲突时本 env 优先 |
merge-claude |
与 settings.json 取并集,冲突时 settings.json 优先 |
- 新增
-m / --merge-mode <override|cce|claude>启动选项,配置项settingsMode(全局)与envs.<name>.settingsMode(按 env)。 - env 泄漏防护:启动前从子进程环境剥离残留的
ANTHROPIC_*变量,shell 里的export不会再静默覆盖。 - 临时文件带
pid+随机名(并发窗口互不干扰)、chmod 600、全退出路径清理、启动时清扫 6h 以上的孤儿文件。
🌐 多语言界面(中文 / English)
- cce 的帮助、警告、错误、菜单提示支持英文和简体中文。
- 检测优先级:
CCE_LANG环境变量 > 配置lang> 系统 locale > 英文。 - 新增
cce lang [en|zh-CN|auto]子命令持久切换;CCE_LANG=zh-CN cce按次切换。
📖 文档与其它
- README 拆分中英双语;新增
docs/usage.md、docs/DESIGN.md双语完整文档。 schema.json增加settingsMode,编辑器可补全/校验。- 新增 settings / i18n / parser 单元测试。
✨ settings.json env reconciliation
Fixes the "switched env but still hitting the old endpoint" trap. Claude Code also reads env from ~/.claude/settings.json, where a stale ANTHROPIC_BASE_URL could silently override cce's injection.
- cce never edits your real
settings.json; it builds a temp file and launches withclaude --settings <tmpfile>(deleted on exit). - Three modes, settable globally, per-env, or per-run via
-m:
| Mode | Effect |
|---|---|
override (default) |
This env fully wins; stale anthropic keys in settings.json are neutralized |
merge-cce |
Union with settings.json, this env wins on conflicts |
merge-claude |
Union with settings.json, settings.json wins on conflicts |
- New
-m / --merge-modeflag;settingsMode(global) andenvs.<name>.settingsMode(per-env) config. - Env-leak protection: stale
ANTHROPIC_*vars are stripped from the child env so shellexports can't shadow your env. - Temp files use a
pid+random name,chmod 600, cleanup on every exit path, and orphan sweeping (>6h).
🌐 Bilingual UI (English / 简体中文)
- Help, warnings, errors, and prompts in English and Simplified Chinese.
- Resolution:
CCE_LANGenv > configlang> OS locale > English. - New
cce lang [en|zh-CN|auto]to persist;CCE_LANG=zh-CN ccefor a single run.
📖 Docs & misc
- README split into zh/en; full bilingual
docs/usage.mdanddocs/DESIGN.md. schema.jsongainssettingsModefor editor validation.- Added settings / i18n / parser unit tests.
⬆️ 升级 / Upgrade
npm i -g @xiaofuzhou/cce@latestFull changelog: v0.1.0...v0.2.0
v0.1.0 — Initial release
What is cce?
cce is a per-process environment launcher for Claude Code. One command to inject any
provider's env (DeepSeek / Kimi / GLM / CCR / official Anthropic) and start claude,
with default CLI args managed in config.
npm install -g @xiaofuzhou/cce
cce -e deepseek
cce pick
Features
- Per-process env injection — env vars are injected only into the claude child
process, so every terminal window can use a different provider in parallel
- Three-layer args merging — global defaults → per-env args → CLI -a/-A,
with pure concatenation semantics
- Interactive picker — cce pick opens a keyboard-navigable menu; bare cce
also falls back to the picker when no default is set
- Shell completion — bash, zsh, fish, and PowerShell tab-completion for
subcommands, flags, and your own env names
- Env-leak protection — ANTHROPIC_* vars are stripped from the inherited
environment before injection, preventing shell-level leaks from silently
taking effect
- API key masking — token/key values are masked in all terminal output
- Atomic config writes — config saved via tmp-file + rename; corrupted configs
are backed up before erroring
- Cross-platform — Windows (PS 7+, cmd), macOS, Linux
Included in this release
- cce CLI with subcommands: list, show, edit, use, current, pick,
completion, help
- Configuration: ~/.claude/cce/config.json
- Zero runtime dependencies beyond cross-spawn and picocolors
Links
- npm: https://www.npmjs.com/package/@xiaofuzhou/cce
- README: https://github.com/zhouxiaofu/claude-code-env/blob/v0.1.0/README.md