Inspect Angular Bundles.
Enforce Zero-Bloat Budgets.
Analyze Angular esbuild stats.json through a fast CLI, GitHub Actions, a native MCP server, or an installable Agent Skill—then trace dependencies, measure optimizations, and enforce bundle budgets.
Use BundleRadar with AI coding agents
MCP Server
Four typed tools let an agent inspect bundles, trace import paths, measure deltas, and enforce budgets through structured calls.
Agent Skill
An installable optimization workflow guides an agent from baseline and diagnosis through source edits, rebuilds, tests, and measured verification.
Why Angular Bundles Grow Out of Control
Modern Angular applications use esbuild for blazing fast build times, but bundle size regressions remain a major source of slow Time-to-Interactive (TTI) and First Contentful Paint (FCP).
Accidental Entry Point Leaks
Importing a single utility function from a non-tree-shakeable CommonJS library (like lodash or moment) pulls megabytes directly into main.js.
Duplicate Nested Dependencies
Conflicting transitive versions of packages like tslib or rxjs get bundled simultaneously without developer awareness, bloating chunk payloads.
Zero CI Visibility & Gating
Pull requests merge unnoticed size spikes because standard CI logs bury massive JSON outputs instead of surfacing clear byte deltas and failing budgets.
Installation
Install the self-contained binary with zero runtime dependencies directly to /usr/local/bin (or specify --bin-dir ~/.local/bin).
$ curl -fsSL https://raw.githubusercontent.com/sonuKumar03/bundleradar/master/install.sh | sh -s -- --with-skill
Quickstart
Generate Angular stats during your build and run bundleradar in two simple steps:
dist/<project-name>/stats.json.Core Commands to Inspect, Benchmark & Control Bundles
Each command outputs clean, structured ANSI tables and trees designed for both human terminal inspection and automated CI pipelines.
bundleradar scan <stats.json> [--entry <source-or-glob>] [--why <pkg>]
Inspects initial entry points, lazy route chunks, and calculates total NPM package contributions sorted by byte weight. Use --entry / -e (e.g. source path src/main.ts or emitted chunk glob main-*.js) to scope analysis to a specific entrypoint, or --why <pkg> to trace package import roots.
💡 Entrypoint Scoping & TotalJS Invariant: --entry / -e scopes initial versus lazy reachability, package attribution, and root traces strictly to the selected entrypoint. The overall TotalJS metric consistently reflects the whole browser build across all chunks.
bundleradar diff <stats.json> --against <baseline-or-git-ref>
Compares the current build against a baseline file or Git ref (e.g. origin/master), automatically building the baseline in an isolated worktree. Traces the shortest BFS import chain directly to regressing packages with emitted chunk attribution.
bundleradar gate <stats.json> [--entry <entry>] [flags]
Enforces strict size budgets and regression limits in pull request pipelines. Returns exit code 0 on pass, or exit code 1 with budget violation details to block oversized pull requests. Budgets can be scoped to specific entrypoints via --entry / -e (e.g. src/main.ts or main-*.js).
bundleradar workspace [list|scan] [--root <dir>] [--app <name=stats>]
Discovers and scans builds across an Nx monorepo workspace to compare multi-app sizes, shared library costs, duplicate dependencies, and artifact freshness.
bundleradar mcp
Starts a native Model Context Protocol (MCP) server over standard I/O for AI coding assistants (Claude Code, Antigravity, Cursor) to inspect bundles, trace dependency chains, and enforce budgets directly inside agent tool loops.
Configuration (.bundleradar.yml)
Persist project-wide size budgets and optimization rules in your repository root:
# .bundleradar.yml
budgets:
initial_js_max: 250kb
total_max: 1.5mb
rules:
disallow_packages:
- moment
- lodash
GitHub Actions Integration
Drop bundleradar directly into your GitHub Actions workflow to post automated PR comments with delta summaries and fail oversized changes. Use the entry input to scope analysis and budget enforcement to a specific entrypoint (e.g. src/main.ts or main-*.js):
name: Bundle Size Budget Check
on: [pull_request]
jobs:
bundleradar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx ng build --stats-json
- name: Run bundleradar CI
uses: sonuKumar03/bundleradar@v2.0.0
with:
stats: dist/my-app/stats.json
entry: src/main.ts
max-initial: '250kb'
post-comment: true
AI Agents & Model Context Protocol (MCP)
Give your coding agent a measured bundle optimization loop: baseline → diagnose → trace → edit → rebuild/test → measure → gate. The Agent Skill supplies the reasoning workflow, MCP is the preferred structured interface when available, and CLI JSON is the universal fallback.
bundleradar mcp)bundle_scan
Inspection
Analyze bundle sizes (initial JS, async JS, total assets) and top contributing npm packages with optional filters and entrypoint scoping.
bundle_diff
Delta & Attribution
Compare current build against a baseline file or git ref, calculating size deltas with BFS import chain regression attribution and micro-drift grouping.
bundle_gate
CI Budget Gate
Validate bundle sizes, regressions, and architecture rules against policy budgets in CI (max initial, max total, max delta, forbidden packages).
workspace_summary
Monorepo
Discover and summarize all application targets across an Nx or multi-package monorepo workspace, tracking cross-app shared packages.
claude mcp add bundleradar -- bundleradar mcp
Runs instantly without modifying config files directly.
{
"mcpServers": {
"bundleradar": {
"command": "bundleradar",
"args": ["mcp"]
}
}
}
Companion Agent Skill Definition (SKILL.md)
Install the self-contained binary and complete skill tree for generic agents, Claude Code, and Codex. The binary and Angular esbuild stats.json are prerequisites; use --skill-dir <path> for a custom skill location. The installed Skill uses MCP when available and CLI JSON otherwise.
Prompt: “Reduce the initial JavaScript bundle by at least 50 KB without changing application behavior. Establish a baseline first, identify the highest-confidence optimization, trace its import path, make the change, rebuild, run tests, and report the measured delta.”
curl -fsSL https://raw.githubusercontent.com/sonuKumar03/bundleradar/master/install.sh | sh -s -- --with-skill