1---
2name: bundle-analysis
3description: Bundle analysis. Use when measuring current bundle size, comparing stable or selected fixtures, inspecting composition, or cleaning retained comparison state.
4---
5
6Read `packages/tools/bundle/README.md`, then select one workflow:
7
8- **Stable comparison:** `pnpm bundle-compare <base-ref>`. Use `HEAD~1` for the
9 latest commit. Read `tmp/bundle-stats.txt` and report non-zero differences.
10- **Selected comparison:** `pnpm bundle-compare-selected --base <ref>
11 scratchpad/<fixture>.ts`. Use only user-named or investigation-local fixtures;
12 keep temporary fixtures out of the stable corpus.
13- **Composition:** `pnpm bundle-analyze scratchpad/<fixture>.ts`. Read raw data
14 first and report the largest modules, dependency groups, and surprising
15 inclusions. Its readable-name output is not an exact size measurement.
16- **Current size:** Build immediately before the direct bundle report so Effect
17 packages resolve from current `dist` output.
18- **Cleanup:** Stable comparisons retain `tmp/bundle-base` for reuse unless
19 cleanup is requested. Remove selected-comparison state retained with
20 `--keep-base` after its final use. Verify cleanup without disturbing unrelated
21 worktrees.
22
23The task is complete when the selected artifact is inspected, requested size or
24composition findings are reported, generated paths are named, and comparison
25state follows the selected workflow's retention policy.