Skip to content

docs: make the bun auto-install pin shim self-documenting + deletable #714

Description

@vivek7405

Problem

webjs carries a body of code that exists ONLY to work around bun's auto-install ignoring package.json (it fetches latest for bare imports). That includes the onLoad version-rewrite (#685/#698 bun-pin-rewrite.js, action-seed-bun.js installBunSeedPlugin pinTransform), the cli @webjsdev import retry (#709 import-webjsdev.js), the spawn-tool preload (#704 bun-pin-preload.js), the importmap version fallback (#699 declaredVendorVersions), and the scaffold ranges / banner (#700). All of it is a SHIM: the day bun's runtime honors package.json / bun.lock natively, every line should be removable. Today that removability is implicit knowledge, not documented, so a future agent cannot safely identify and delete the whole shim.

Design / approach

Make the shim self-documenting and centrally tracked so a future agent can remove it confidently when bun closes the gap:

  1. A single canonical doc (e.g. agent-docs/bun-autoinstall-shim.md) that: states WHY the shim exists (bun auto-install ignores package.json, with the empirical evidence and the bun source comment and any upstream bun issue link), ENUMERATES every file / function / flag in the shim with its issue number, describes the capability-probe removal test (when bun run honors package.json / bun.lock natively, the shim is obsolete), and gives the exact deletion checklist.
  2. A consistent code marker (e.g. a WEBJS-BUN-SHIM(#NNN) comment tag) on every shim site so grep WEBJS-BUN-SHIM enumerates the whole surface.
  3. Cross-link from AGENTS.md and agent-docs/runtime.md.

Implementation notes (for the implementing agent)

Acceptance criteria

  • A single canonical shim doc exists enumerating every shim site by file / function / issue, with the WHY, the empirical evidence, the removal / capability-probe test, and a deletion checklist.
  • Every shim code site carries a greppable marker so grep enumerates the full surface.
  • The doc explicitly distinguishes the removable pin-shim from permanent Bun support (the Bun.serve seam, the TS stripper).
  • AGENTS.md and agent-docs/runtime.md cross-link it.

Relates to #685, #698, #699, #700, #703, #704, #709, and the resilience discussion.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions