Priority: P0
Category: performance, cli
Parent: #3011
Depends on: Startup profiler sub-issue
Problem / 问题
All CLI invocations load the full gemini.tsx + @qwen-code/qwen-code-core (50+ modules) even for --version, --help, or mcp subcommands. No fast-path routing exists.
所有 CLI 调用都全量加载 gemini.tsx + core(50+ 模块),即使是 --version。无快速路径路由。
Proposed Solution / 方案
- Add
packages/cli/src/cli.ts as new bootstrap entry — parses process.argv for fast paths BEFORE loading gemini.tsx
- Fast paths with zero/minimal imports:
--version / -v: print inlined version, exit immediately
--help / -h: dynamic import yargs help only
mcp subcommand: dynamic import MCP handler only
- Default path:
await import('./gemini.js') for full startup
- Update
esbuild.config.js entry point to cli.ts
Reference: Claude Code src/entrypoints/cli.tsx — same pattern, --version has zero imports.
Acceptance Criteria / 验收标准
Problem / 问题
All CLI invocations load the full
gemini.tsx+@qwen-code/qwen-code-core(50+ modules) even for--version,--help, ormcpsubcommands. No fast-path routing exists.所有 CLI 调用都全量加载 gemini.tsx + core(50+ 模块),即使是
--version。无快速路径路由。Proposed Solution / 方案
packages/cli/src/cli.tsas new bootstrap entry — parsesprocess.argvfor fast paths BEFORE loadinggemini.tsx--version/-v: print inlined version, exit immediately--help/-h: dynamic import yargs help onlymcpsubcommand: dynamic import MCP handler onlyawait import('./gemini.js')for full startupesbuild.config.jsentry point tocli.tsReference: Claude Code
src/entrypoints/cli.tsx— same pattern,--versionhas zero imports.Acceptance Criteria / 验收标准
qwen --versionexits in < 50ms (currently loads entire core)qwen --helpdoes not import@qwen-code/qwen-code-core