Skip to content

refactor(build): bundle with cli-base's cli-dev bundle; drop scripts/bundle.ts - #775

Merged
leemour merged 4 commits into
mainfrom
refactor/shared-bundle
Oct 27, 2026
Merged

leemour merged 4 commits into
mainfrom
refactor/shared-bundle

Conversation

@leemour

@leemour leemour commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Task

Build tg's bundle with cli-base's shared cli-dev bundle (0.65.0) and delete scripts/bundle.ts, which moved there (cli-base#382).

Why

One build for every WireCat CLI. cli-base 0.65 also fixes the loader for a server started with a flag before mcp serve (cli-base#389): tg's own script looks at three words and misses tg work --read-only mcp serve, which then preloads no chunks and can fail after an in-place upgrade.

What

  • build: tsc --build --force && cli-dev bundle --bin dist/bin/tg.js --external '@mtcute/*' --external undici; scripts/bundle.ts deleted.
  • The loader also answers --version itself; smoke.ts checks it equals the bundle's answer.
  • ARCHITECTURE.md names the shared command; changelog line.

Testing

Results follow in a comment: identity under npm and pnpm, the upgrade test with and without a flag before mcp serve, timings.

🤖 Generated with Claude Code

leemour and others added 4 commits October 27, 2026 18:29
…bundle.ts

tg's script moved into cli-base 0.64 as cli-dev bundle (WC-LAY-10). Same chunks and outputs; the loader now also answers --version alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@leemour

leemour commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

Results (cli-core 0.469.0, cli-base 0.65.0)

Installed from npm pack tarballs; before = main (tg's own scripts/bundle.ts), after = this branch (cli-dev bundle).

  • Identity: 27 commands plus an MCP session (smoke mcp serve), under npm and pnpm: byte-identical after normalising paths, run ids and timings. The only difference is the stack frames in a failed run's record. All 14 rewritten asset paths exist in both layouts.
  • Upgrade with an MCP server running, bundle A → B with every chunk renamed: smoke mcp serve and smoke --quiet mcp serve both preloaded the chunks (148 bundle loads each) and answered all 8 calls after the upgrade; none crashed.
  • Timing, warm, median of 10, taskset -c 0-3, load 2.6–4.2: --version 34 → 20 ms (the loader answers it); --help 217 → 224, messages list --help 204 → 208, bench chats list --offline 243 → 237: within noise, as expected for the same bundle.
  • Package: 3.04 MB → 3.04 MB.
  • smoke:node and smoke:bun pass on this branch.

🤖 Generated with Claude Code

@leemour
leemour merged commit 878a7e5 into main Oct 27, 2026
14 checks passed
@leemour
leemour deleted the refactor/shared-bundle branch October 29, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant