Skip to content

[P0] Bootstrap entry point with fast paths / 引导入口快速路径 #3220

@doudouOUC

Description

@doudouOUC

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 / 方案

  1. Add packages/cli/src/cli.ts as new bootstrap entry — parses process.argv for fast paths BEFORE loading gemini.tsx
  2. 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
  3. Default path: await import('./gemini.js') for full startup
  4. Update esbuild.config.js entry point to cli.ts

Reference: Claude Code src/entrypoints/cli.tsx — same pattern, --version has zero imports.

Acceptance Criteria / 验收标准

  • qwen --version exits in < 50ms (currently loads entire core)
  • qwen --help does not import @qwen-code/qwen-code-core
  • Default interactive path behavior unchanged

Metadata

Metadata

Assignees

Labels

category/cliCommand line interface and interactioncategory/performancePerformance and optimizationpriority/P0Critical/Blocker - Catastrophic failure, immediate attention

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions