ci: enforce bundle size budget with size-limit [closes #217]#275
Open
EmersonBraun wants to merge 1 commit intomainfrom
Open
ci: enforce bundle size budget with size-limit [closes #217]#275EmersonBraun wants to merge 1 commit intomainfrom
EmersonBraun wants to merge 1 commit intomainfrom
Conversation
Adds size-limit (file plugin) checking gzipped sizes of every package's published dist on every PR. Workflow blocks merge if any package exceeds its declared budget. Budgets per package: - @agentskit/core (ESM + CJS): 10 KB — Manifesto principle 1 - adapters: 20 KB - react / runtime / memory / tools / ink / templates: 15 KB - rag / skills / observability / eval / sandbox: 10 KB - cli: 20 KB Current measured sizes (all under budget): - core ESM: 5.22 KB ✓ - core CJS: 5.30 KB ✓ - adapters: 4.32 KB ✓ - react: 2.58 KB ✓ - runtime: 2.34 KB ✓ - memory: 2.73 KB ✓ - rag: 852 B ✓ - tools: 2.27 KB ✓ - skills: 5.19 KB ✓ - observability: 2.95 KB ✓ - eval: 556 B ✓ - sandbox: 1.53 KB ✓ - ink: 1.33 KB ✓ - cli: 177 B ✓ - templates: 2.89 KB ✓ Local commands: - pnpm size — verify all packages - pnpm size:why — bundle inspector CI workflow .github/workflows/size.yml runs on every PR + push to main. Closes #217
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
size-limitto enforce gzipped bundle sizes on every PR. Closes #217 and verifies Manifesto principle 1 (@agentskit/core< 10 KB gzipped).How it works
.size-limit.jsondeclares budgets per package (gzipped, ESM + CJS where relevant)pnpm size— verify all packagespnpm size:why— bundle inspector.github/workflows/size.ymlruns on every PR + push to main; blocks merge if any package exceeds its budgetCurrent measured sizes (all under budget)
@agentskit/core(ESM)@agentskit/core(CJS)@agentskit/adapters@agentskit/react@agentskit/runtime@agentskit/memory@agentskit/rag@agentskit/tools@agentskit/skills@agentskit/observability@agentskit/eval@agentskit/sandbox@agentskit/ink@agentskit/cli@agentskit/templatesWhy
@size-limit/fileinstead ofpreset-small-libThe small-lib preset bundles via esbuild expecting browser code. Most AgentsKit packages use Node builtins (
fs/promises,path,child_process) which esbuild can't resolve withoutplatform: 'node'. Since these are libs published to npm (consumers bundle them, not us), measuring the published file gzipped is the right metric.@size-limit/filedoes exactly that.Trade-offs
Test plan
pnpm sizeruns locally and passespnpm build && pnpm exec size-limitproduces correct numbersFollow-ups
size-limit-actionfrom andresz1/size-limit-action for delta reporting (size went up by X% in this PR)Closes #217
Refs #211