| name | bundle-safety |
| description | Bundle transform safety — minification variant selection, consumer-constraint verification, identifier preservation, and namespace re-export coverage for build output. |
| triggers | ["minify","minification","bundle","esbuild","build size","re-export","identifier","namespace re-export","exportLines","exportRanges","dist/index.js"] |
| generated_from_knowledge | ["5746c5c9-1330-4fbe-b62e-f564deb1ff77","5d99affe-bdd1-4945-8cd8-fcf37abb8c84","9323a8f0-c07e-41c2-9857-11a24c55dca2"] |
| source_knowledge_ids | ["5746c5c9-1330-4fbe-b62e-f564deb1ff77","5d99affe-bdd1-4945-8cd8-fcf37abb8c84","9323a8f0-c07e-41c2-9857-11a24c55dca2"] |
| generated_at | 2026-07-02T20:47:50.522Z |
| confidence | 0.6 |
| status | active |
| version | 1 |
| skill_origin | generated |
Bundle Safety
Trigger
- minify / minification / bundle / esbuild / build size
- re-export / namespace re-export / exportLines / exportRanges
- dist/index.js conformance checks
- identifier preservation / stack trace readability
- consumer-constraint verification before transforms
Required Procedure
(a) Minification Variant Selection
The standard minification configuration for the plugin bundle is identifier-preserving:
--minify-whitespace --minify-syntax
This yields ~22.3% size reduction on the main bundle (~1.28 MB absolute). The reduction is below the optimistic 35–43% range because identifier mangling is deliberately skipped.
Full identifier mangling (--minify-identifiers) is REJECTED. It breaks two hard constraints:
- 13 grep guardrail assertions — split across
tests/unit/build/full-auto-toolbefore-fail-closed.test.ts (fail-closed hook substring/wrapping checks) and tests/unit/turbo/lean/runtime-conformance.test.ts (Lean Turbo identifier-preservation checks). Mangling would rename these identifiers and cause all 13 assertions to fail.
- Stack-trace readability — preserved identifier names are required for runtime debugging. The release-gate test
tests/unit/build/throw-and-verify-located.test.ts asserts that thrown errors carry readable stack frames with recognizable function names (e.g. initializeOpenCodeSwarm).
Decision is final: identifier-preserving minify is the standard. Do not enable --minify-identifiers without a documented exception approved by the team.
(b) Consumer-Constraint Verification Before Transforms
Before merging any minification or transform change:
- Build the smallest possible test bundle with the proposed transform flags.
- Run the consumer's exact constraint check first — the 13 grep guardrails are split across
tests/unit/build/full-auto-toolbefore-fail-closed.test.ts (fail-closed hook constraints) and tests/unit/turbo/lean/runtime-conformance.test.ts (Lean Turbo identifier-preservation checks). Together they are the authoritative consumer constraint.
- Run the full build conformance suite (
tests/unit/build/throw-and-verify-located.test.ts, tests/unit/turbo/lean/runtime-conformance.test.ts) to verify runtime integrity and stack-trace readability.