Skip to content

chore(package): publish only the bundled CLI, not the whole dist tree - #483

Open
AmrDab wants to merge 1 commit into
mainfrom
chore/trim-extras
Open

AmrDab wants to merge 1 commit into
mainfrom
chore/trim-extras

Conversation

@AmrDab

@AmrDab AmrDab commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Requested by Amr · project thread

Summary

dist/surface/cli.js has been a single esbuild bundle since the cold-start fix (scripts/bundle-cli.mjs), and package.json has no main or exports. That means the other ~150 tsc output files under dist/ are published but never loaded. This PR ships only what runs, and leaves the 346 KB CHANGELOG on GitHub. This is 2 of 5 separate simplification PRs.

before after
tarball 1.94 MB 1.26 MB
unpacked 8.1 MB 5.8 MB
files 193 41

Fewer files also helps the cold-install problem the bundle was built for, since Defender scans every file.

Changes

  • package.json files: dist/ → dist/surface/cli.js, dist/index.js (the v0.x back-compat shim), and dist/guides/ (the app-guide pack, read from disk at runtime). CHANGELOG.md is dropped from the package. README links to it still resolve on npm, which points relative links at the repo.
  • scripts/build-mcpb.mjs: copies the same set, as its comment says it should.

Left out on purpose: I didn't remove the HTTP server, the dashboard, notes/ or the add-on packages. HTTP MCP is a documented feature, so removing it is a product decision. notes/internal/README.md says those notes are kept on purpose, and the add-ons are already opt-in and not part of the core package.

Test plan

  • npm pack, then install the tarball into an empty project:
    • clawdcursor --version and node dist/index.js --version both print 2.3.0
  • With the installed package on Linux (Xvfb):
    • stdio MCP mcp --compact lists 6 tools
    • mcp lists 90 tools, and get_screen_size returns real values, so the lazy-loaded platform code is inside the bundle
    • the dist/index.js shim serves the same result
  • npm run build:mcpb: not run here. The change is one copy list, and CI's extension-bundle job covers it.
  • Windows/macOS: CI matrix. The bundle step is the same on every OS, so I expect no difference, but that's a guess.

Risk / scope

The one risk is a runtime require of a sibling dist/ file outside the bundle. I checked every __dirname, require.resolve, fork and spawn in src/. The only on-disk dist read is dist/guides/pack.json, which ships. No guarantees in SECURITY.md are touched.


Generated by Claude Code

…tree

dist/surface/cli.js has been one esbuild bundle since the cold-start fix,
and package.json has no main/exports, so the 150 other tsc outputs under
dist/ were never loaded. Ship cli.js, the dist/index.js back-compat shim
and dist/guides/pack.json; leave CHANGELOG.md (346 KB) on GitHub.

Tarball 1.94 MB -> 1.26 MB, unpacked 8.1 MB -> 5.8 MB, 193 -> 41 files.
The .mcpb bundle copies the same set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BKm7nbpP8aK35EfAYVt7NL
@AmrDab AmrDab self-assigned this Nov 27, 2026

This branch has not been deployed

No deployments
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.

2 participants