mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-17 12:56:41 +02:00
e320484774
Replace 23 static command imports with lazy-loaded dynamic imports. Each command's heavy dependencies (Provider, Session, MCP, TUI, AI SDKs) are now only loaded when that specific command is invoked. Combined with the Rollup tree-shaking pre-pass, this produces 45 chunks instead of a single bundle. The entry chunk (what loads on startup) drops from ~9.8MB to ~120KB — a 98.8% reduction in startup load. - Add `lazyCmd` helper to `cli/cmd/cmd.ts` for type-safe lazy commands - Inline all builder options (yargs metadata) in `index.ts` - Dynamic `import()` in handlers defers heavy module loading - `opencode --help` / `--version` no longer loads AI SDK, MCP, TUI, etc. https://claude.ai/code/session_01R7zMpXjsq1R6uR7xpyJ14i