Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ const outdir = "dist";
const { rmSync } = await import("fs");
rmSync(outdir, { recursive: true, force: true });

// Default features that match the official CLI build.
// Additional features can be enabled via FEATURE_<NAME>=1 env vars.
const DEFAULT_BUILD_FEATURES = ["AGENT_TRIGGERS_REMOTE"];

// Collect FEATURE_* env vars → Bun.build features
const features = Object.keys(process.env)
const envFeatures = Object.keys(process.env)
.filter(k => k.startsWith("FEATURE_"))
.map(k => k.replace("FEATURE_", ""));
const features = [...new Set([...DEFAULT_BUILD_FEATURES, ...envFeatures])];
Comment on lines +11 to +19
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if other features like BUDDY, TRANSCRIPT_CLASSIFIER, BRIDGE_MODE are used in production code paths

echo "=== Checking feature gates in src/ ==="
rg -n "feature\(['\"]BUDDY" --type=ts
rg -n "feature\(['\"]TRANSCRIPT_CLASSIFIER" --type=ts
rg -n "feature\(['\"]BRIDGE_MODE" --type=ts

echo "=== Checking if these features have production usage ==="
rg -n "feature\(" src/ --type=ts -C2 | head -50

Repository: claude-code-best/claude-code

Length of output: 19531


Missing features in production build: align DEFAULT_BUILD_FEATURES between build.ts and scripts/dev.ts.

DEFAULT_BUILD_FEATURES in build.ts only enables AGENT_TRIGGERS_REMOTE, but the codebase contains extensive production usage of BUDDY, TRANSCRIPT_CLASSIFIER, and BRIDGE_MODE—features that are enabled by default in scripts/dev.ts.

The shell search confirms these are not experimental flags:

  • TRANSCRIPT_CLASSIFIER: 100+ usages across permission systems, auto-mode, settings, and core permissions logic
  • BUDDY: 30+ usages in UI components (CompanionSprite, REPL, PromptInput)
  • BRIDGE_MODE: 40+ usages in bridge commands, remote control, and core hooks

If disabling these in the production build is intentional, document why and ensure downstream code handles the disabled state gracefully. Otherwise, add them to DEFAULT_BUILD_FEATURES in build.ts to match the dev configuration.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@build.ts` around lines 11 - 19, DEFAULT_BUILD_FEATURES currently only
includes "AGENT_TRIGGERS_REMOTE" causing production builds (the features array
derived from envFeatures and DEFAULT_BUILD_FEATURES) to miss BUDDY,
TRANSCRIPT_CLASSIFIER, and BRIDGE_MODE which are enabled by default in dev;
either add "BUDDY", "TRANSCRIPT_CLASSIFIER", and "BRIDGE_MODE" to
DEFAULT_BUILD_FEATURES in build.ts so the features constant matches the dev
configuration (and update any related docs/tests), or explicitly document the
intentional difference and audit code paths that reference these flags (search
for BUDDY, TRANSCRIPT_CLASSIFIER, BRIDGE_MODE usages) to ensure they handle the
disabled state gracefully.


// Step 2: Bundle with splitting
const result = await Bun.build({
Expand Down
2 changes: 1 addition & 1 deletion scripts/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const defineArgs = Object.entries(defines).flatMap(([k, v]) => [

// Bun --feature flags: enable feature() gates at runtime.
// Default features enabled in dev mode.
const DEFAULT_FEATURES = ["BUDDY", "TRANSCRIPT_CLASSIFIER", "BRIDGE_MODE"];
const DEFAULT_FEATURES = ["BUDDY", "TRANSCRIPT_CLASSIFIER", "BRIDGE_MODE", "AGENT_TRIGGERS_REMOTE"];

// Any env var matching FEATURE_<NAME>=1 will also enable that feature.
// e.g. FEATURE_PROACTIVE=1 bun run dev
Expand Down
Loading