cloudaxe-opencode/packages/opencode
Claude e320484774
perf: lazy-load CLI commands via dynamic import for code splitting
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
2026-04-16 13:03:44 +00:00
..
bin cache platform binary in postinstall for faster startup (#14467) 2026-02-20 12:19:17 -06:00
migration chore: generate 2026-04-13 18:02:12 +00:00
script perf: add Rollup tree-shaking pre-pass for export * as barrels 2026-04-16 12:37:49 +00:00
specs docs: add circular import rules to namespace treeshake spec (#22754) 2026-04-15 23:44:08 -04:00
src perf: lazy-load CLI commands via dynamic import for code splitting 2026-04-16 13:03:44 +00:00
test fix: restore .gitignore logic for config dirs and migrate to shared Npm service (#22772) 2026-04-16 03:14:06 -04:00
.gitignore perf: add Rollup tree-shaking pre-pass for export * as barrels 2026-04-16 12:37:49 +00:00
AGENTS.md perf: make vcs init non-blocking by forking git branch resolution (#22771) 2026-04-16 03:02:19 -04:00
BUN_SHELL_MIGRATION_PLAN.md sync 2026-02-25 01:48:10 -05:00
bunfig.toml tui plugins (#19347) 2026-03-27 15:00:26 +01:00
Dockerfile
drizzle.config.ts sqlite again (#10597) 2026-02-14 04:19:02 +00:00
git feat: interactive update flow for non-patch releases (#18662) 2026-03-22 23:12:40 +00:00
package.json perf: add Rollup tree-shaking pre-pass for export * as barrels 2026-04-16 12:37:49 +00:00
parsers-config.ts feat(tui): add syntax highlighting for kotlin, hcl, lua, toml (#18198) 2026-03-23 16:15:24 +01:00
README.md
sst-env.d.ts zen: update sst version 2026-02-18 13:54:23 -05:00
time.ts CLI perf: reduce deps (#22652) 2026-04-16 02:03:03 -04:00
trace-imports.ts CLI perf: reduce deps (#22652) 2026-04-16 02:03:03 -04:00
tsconfig.json CLI perf: reduce deps (#22652) 2026-04-16 02:03:03 -04:00

js

To install dependencies:

bun install

To run:

bun run index.ts

This project was created using bun init in bun v1.2.12. Bun is a fast all-in-one JavaScript runtime.