Repository navigation
refactor(launcher): replace the fifteen buildXxxEnv copies with one preset-table builder (#1440 P3) - #2306
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2479-pr.2306.343744eThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2306.tgz
npm install -g packageInstall instructions are refreshed on each push. |
🔍 Review of PR #2306 (refactor(launcher): preset-table builder · #1440 P3)
结构化七问
非阻塞小观察(不影响合并): 判定:#2306 本身可合 —— 干净单文件 121+/93−,行为保持,测试护栏在位,基于最新 master 无需 rebase( |
…reset-table builder (#1440 P3)
a835786 to
9435ccf
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.111-master.ed24969 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Issue #1440 P3 — collapse the fifteen copy-pasted
buildXxxEnvfunctions insrc/launcher.tsinto one preset table + one private builder. Behavior-preserving: every exported signature stays byte-identical and returned env objects are value-equal (plus key-order-equal) for every client under every parameter combination.Design
One module-private table + builder inserted between
buildPiEnvandbuildCodexEnv:interface EnvClientPreset { caKeys; proxy; httpProxyOnRouteHttp; extras?; baseUrlKeys? }+const ENV_CLIENTS(one entry per table-driven client, every load-bearing per-client comment — 能否新增对traecli的支持 #655, jcode reqwest, 新增 bili aider 启动器 #1048, 新增 bili copilot / bili amp / bili goose 启动器(第三梯队) #1049×2, feat: 新增 qoder 客户端支持(bili qoder) #653, 新增 bili gemini 启动器(Gemini CLI,可扩展覆盖同系 Qwen Code / iFlow) #1047, feat: support Antigravity (CLI / extension) — first-class integration #2115, gateway-mode notes — moved verbatim next to its entry)buildClientEnv(preset, origin, caPath, baseEnv, rewrites?, routeHttp?)emits keys in an order that reproduces each original literal's insertion order exactly (incl. aider'sHTTP_PROXYbetweenHTTPS_PROXYand its CA vars)LAUNCHER_LOOPBACK_NO_PROXYdedups the triple-copied"localhost,127.0.0.1,::1"loopback literalbuildPiEnv— builds a JSON manifest (BILI_PROVIDER_REWRITES) with scheme-dependent wrapping/overwrite semantics plus two list-derived conditional keys; forcing it through the table would smuggle callbacks into "data"buildClaudePluginEnv— different shape entirely (identity pass-through when!directUrl, upstream read FROM baseEnv with a trim-or-default fallback chain); not a member of the proxy/CA skeletonNet:
src/launcher.ts121+/93−, no new exports (table/builder stay module-private → the unused-exports gate from #1443 unaffected), no new deps, call sites untouched.Equivalence proof
diffexit 0, empty output, 43/43 equal. Script was throwaway, not committed.export function …(params): NodeJS.ProcessEnv {blocks byte-identical old vs new.Verification
tests/launcher.test.ts282 ✓ ·launcher-gemini-family28 ✓ ·launcher-plugin-mode9 ✓ ·codex-overlay-env15 ✓ (0 fail)npx tsc --noEmitclean · tsup build OKFollow-up per #1440 P3 after this lands: nothing further in the env family (pi/claude-plugin are the honest bespoke remainder); remaining P3 items are the
runLaunchper-client copies and the plugin-install XInstall/XRemove registry — larger, separate PRs.Rebase note (master moved past v0.1.187)
Rebased onto
95ad8d25— clean, zero conflicts (master's launcher changes since our base are all outside the builder region). Second commit is a one-line gate fix: master's ownunused-exportsjob has been red since #2268 (PiSubagentChildSignalinternal-only) — same mechanical demote this repo already used forcodexRewriteInsertionIndexat release time (371b15b5); separate commit so it can be cherry-picked/dropped independently. Re-verified post-rebase: gate exit 0 · tsc clean · tsup OK · launcher suites 334/334 (launcher / gemini-family / plugin-mode / codex-overlay-env).