This repository has been archived on 2026-04-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
claude-code-2026-04-02/docs-site/docs/developer/bun-bundle-and-feature-flags.md
2026-03-31 16:04:03 +05:00

27 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Bun bundle and feature flags
The shipping Claude Code CLI is built with **Bun** and internal **`bun:bundle`** integration. In the recovered source, `src/main.tsx` uses compile-time feature gates such as:
- `feature('KAIROS')` — lazy `require` of `assistant/` (assistant / Agent SDKoriented paths).
- `feature('COORDINATOR_MODE')` — lazy `require` of `coordinator/coordinatorMode`.
- `feature('VOICE_MODE')` — conditional `useVoiceIntegration` in `REPL.tsx`.
## What `feature()` means here
In Anthropics pipeline, `feature('…')` is almost certainly a **constant** resolved at bundle time: dead branches are stripped from the published `cli.js`. The reconstruction **contains all branches** as TypeScript, so you can read “internal” code paths that might not ship in every npm artifact.
## Implications for “building from source”
A normal `tsc` or `bun build` **without** Anthropics bundler will not reproduce:
- The same dead-code elimination.
- The same `bun:bundle` API semantics.
- The same proprietary dependency closure.
That is one reason [Reproducibility and limits](../reproducibility.md) states you cannot rebuild the shipping binary from this mirror.
## See also
- [System design: layers](../system-design/layers.md)
- [CLI entry reference](../reference/cli-entry.md)