Skip to content

Bundle module map from cli.renamed.js

This page records the Bun module partitioning and feature-theme clustering of the semantically renamed bundle claude-code-pkg/src/entrypoints/cli.renamed.js. It is a research-grade index: every line range below is a concrete anchor a reader can open in the file. Themes here back the higher-level narrative pages under docs/00-start-here/ through docs/06-agents-automation/; the entry point for product-level reading is the main feature map.

How to read this page

cli.renamed.js is the formatted-and-renamed output produced by scripts/normalize-cli-js.mjs and scripts/semantic-rename-cli.mjs. The 2.1.215 renamed file wraps everything in one top-level function expression containing 32,157 statements. Bun emits each original ESM module through a minified lazy-loader helper (named b in this build), preceded by forward function / class / var declarations and an export helper (named nt here) whose second argument maps semantic export names to identifier-returning getters.

The script scripts/extract-cli-module-map.mjs walks every loader boundary, attaches the surrounding declarations and export tables to that loader, then classifies each module by keyword matching on the semantic names. Outputs:

Refresh with:

Terminal window
node scripts/extract-cli-module-map.mjs

Source-anchor policy

Semantic aliasMinified anchorScope
Bun module loaderStructurally detected outer-arrow → inner-arrow lazy initializer (for example var loaderName = b(() => { ... }))Each loader call marks one original ESM module; statements above it (up to the previous loader) form its forward declarations.
Module export tableAny helper call whose second argument is a non-empty object of identifier-returning gettersMaps original ESM export names onto internal implementations without depending on a minified helper name.
Theme classificationRegex match on the set of semantic names per moduleOrder-sensitive priority list in scripts/extract-cli-module-map.mjs.
Line numbers1-based lines in claude-code-pkg/src/entrypoints/cli.renamed.jsLoader line = location of the structurally recognized lazy-loader call. Function definitions usually sit earlier in the same partition.

Coverage summary

MetricValue
Top-level statements in wrapping IIFE32,157
Bun module loaders4,820
Modules with an explicit structural export table564
Modules with any semantic declaration or export1,208
Modules currently classified into a theme228
Modules with semantic info but no theme yet980
Fully opaque modules (still all minified)3,612
Populated themes recognized36

Opaque modules are mostly small vendor helpers or inlined arrow chains whose surface stayed minified after the semantic rename pass. They are tracked but not promoted into the narrative docs.

Claude Code product themes

Each row links a Claude Code subsystem to its loader line range in cli.renamed.js and the docs page that already explains the runtime behavior. Open the file at the listed line, then scroll up to find the corresponding function / class declarations that the loader assembles.

Session, transcript, agent metadata, and teammate IPC

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
SessionRuntimeStateHub24202, 133347switchSession, setUserMsgOptIn, waitForScrollIdle, swapMcpServerTools, snapshotOutputTokensForTurnSession API, events, and storage
TranscriptAgentMetadataStore1584035writeRemoteAgentMetadata, writeAgentMetadata, readAgentMetadata, getMaterializedSessionFile, getTranscriptPathForSession, trackSessionWriteSession resume and transcripts
TeammateMailboxIpc1342045writeToMailbox, readUnreadMessages, readMailbox, formatTeammateMessages, getInboxPathRemote control and teleport
TeamFileMemberModes1340851writeTeamFileAsync, updateTeamFile, syncTeammateMode, setMemberMode, setMemberActiveRemote control and teleport
SdkQueryAndSessionApi758004 – 612322query, startup, resolveSettings, tool, createSdkMcpServer, InMemorySessionStore, HOOK_EVENTS, session/subagent APIsSDK query, session API, and subagent surface

Permission, trust, hooks, and policy

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
PermissionRuleEngine1448537toolAlwaysAllowedRule, syncPermissionRulesFromDisk, permissionRuleSourceDisplayString, hasPermissionsToUseTool, guardHookUpdatedInput, getDenyRulesBuilt-in tools and permissions
PermissionModeTransitions1586810verifyAutoModeGateAccess, transitionPlanAutoMode, transitionPermissionMode, stripDangerousPermissionsForAutoMode, shouldPlanUseAutoMode, shouldDisableBypassPermissionsBuilt-in tools and permissions
HookEventDispatcher2260357, 578190shouldSkipHookDueToTrust, hasWorktreeCreateHook, hasInstructionsLoadedHook, hasHookForEvent, persistHookOutput, parseElicitationHookOutputHooks and events reference, MCP, plugins, and hooks
TrustedPathGlobalConfig1595169isPathTrusted, setPathTrusted, checkHasTrustDialogAccepted, saveGlobalConfig, shouldSkipPluginAutoupdateSettings, policy, and integrations
SettingsFileLoader272934, 74111updateSettingsForSource, settingsMergeCustomizer, parseSettingsFile, parseRemoteManagedSettings, loadManagedFileSettingsFromDirSettings schema reference

Git, worktree, and daemon

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
GitRepoOperations165739stashToCleanState, redactGitRemoteCredentials, preserveGitStateForIssue, normalizeGitRemoteUrl, isLinkedWorktree, isAtGitRootCLI main paths
GitRefWatcher164612resolveRef, resolveGitDir, resetGitFileWatcher, removeWatchedRepo, readWorktreeHeadSha, readGitHeadDaemon and background service
AgentWorktreeManager1262923worktreeBranchName, validateWorktreeSlug, restoreWorktreeSession, persistWorktreeSession, removeAgentWorktree, listRegisteredWorktreesWorktree isolation and handoffs
WorktreeDaemonJobScheduler1909259summarizeEvent, stateBucket, sortJobs, seedLastJobs, rollupJobColor, deriveActivity, deriveBandDaemon and background service

Models, prompts, and memory

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
ModelSelectionConfig1131978vetUserSpecifiedModel, toProviderWireModelId, strip1mTag, stepDownRestrictedFamilyAliasPick, parseUserSpecifiedModelModel selection, calls, usage, quota, and billing

Integrations (MCP, plugins, MCPB, LSP)

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
McpChromeBridge440188 – 52085localPlatformLabel, createClaudeForChromeMcpServer, createChromeSocketClient, createBridgeClient, clearBrowserResolutionBrowser automation and Claude in Chrome
McpbExtensionPackaging5207944 – 227138verifyMcpbFile, verifyCertificateChain, validateManifest, unsignMcpbFile, unpackExtension, signMcpbFileMCP, plugins, and hooks
PluginLoader1473632resolvePluginRoot, resolveContainedPluginPath, mergePluginSources, loadSkillsAsPlugins, loadPluginManifest, loadAllPluginsMCP, plugins, and hooks
PluginCommandHandlers1657701pluginValidateHandler, pluginUpdateHandler, pluginUninstallHandler, pluginTagHandler, pluginPruneHandler, pluginListHandler, pluginInstallHandler, pluginInitHandlerPlugin lifecycle and configuration
LspIdeClient1320957createLSPClientIDE integration and LSP diagnostics

Auth (multi-cloud)

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
GatewayAuthRefresh2127575, 187446withOAuthRefreshLock, validateForceLoginOrg, shouldUseWIFAuth, refreshGcpAuth, getAnthropicApiKey, getAuthTokenSourceModels, providers, and auth
LoginFlow1779039Login, runPostLoginHooks, callModels, providers, and auth

Remote control, feature flags, networking

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
RemoteControlFeatureGates1593815isRunningInRemoteEnvironment, isRemoteControlInternalEventsEnabled, isRemoteControlHardDisabled, isPreviewHmrEnabled, isPersistentRemoteSessionEnabledRemote control and teleport, Feature gates reference
GrowthBookFeatureFlags1188311refreshGrowthBookFeatures, refreshGrowthBookAfterAuthChange, setupPeriodicGrowthBookRefresh, stopPeriodicGrowthBookRefresh, resetGrowthBookFeature gates reference
ProxyClientFactory1101618shouldBypassProxy, prefetchProxyAuthFromHelperIfSafe, getWebSocketProxyUrl, getProxyUrl, getProxyFetchOptions, getProxyAgentSettings, policy, and integrations

TUI and rendering

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
TerminalTextFormatting3192088 – 313926wrapText, truncateToWidth, truncateToWidthNoEllipsis, truncateStartToWidth, truncatePathMiddle, formatTokensCLI main paths
InkTerminalHooks8290209 – 313857useTheme, useTerminalViewport, useTerminalFocus, useTerminalTitle, useStdin, useResolvedTheme, ThemeProviderCLI main paths

Observability and ops

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
AnalyticsEventSink14289logEvent, logEventAsync, createAnalyticsState, attachAnalyticsSink, stripProtoFieldsTelemetry and tracing
StartupPerformanceProfiler138458profileReport, profileCheckpoint, logStartupPerf, isDetailedProfilingEnabled, getStartupPerfLogPathDiagnostics and debug logs
ProcessIoErrorHandlers223465 – 23673writeToStdout, writeToStderr, registerProcessOutputErrorHandlers, setBgExitCause, readAndClearBgExitCauseDiagnostics and debug logs

Third-party dependencies (bundled, not Claude Code logic)

These themes correspond to vendored runtime libraries embedded in cli.renamed.js. They are recorded here so reverse-engineers can skip them quickly and not mistake them for product code.

VendorModulesLoader line rangeAnchor symbols
AWS SDK / Bedrock / Smithy14598069 – 139587*Command classes, httpAuthSchemeMiddleware, resolveDefaultRuntimeConfig, AutomatedReasoning*, BedrockRuntime*
MSAL / Microsoft identity and related auth surface1016918 – 165864identity/auth exports and credential helpers matched by the generated theme pattern
Zod schema validation125720 – 28096Zod*, parseAsync, safeParse, toJSONSchema, treeifyError
Ink React hooks (terminal UI runtime)8290209 – 313857See InkTerminalHooks above; Ink itself is bundled with the Claude Code TUI hooks
Axios HTTP229562 – 31340hasStandardBrowserWebWorkerEnv, hasStandardBrowserEnv, hasBrowserEnv, isBuffer
fflate zip/zlib codec1206949zlibSync, unzlibSync, zipSync, unzipSync, deflate, inflate
i18n locales table112492zhTW, zhCN, vi, ur, tr, plus the bundled locale codes

Verification probe

Run this one-liner to confirm representative function declarations from the table above still resolve in the renamed bundle:

Terminal window
grep -nE "function (switchSession|writeRemoteAgentMetadata|writeToMailbox|toolAlwaysAllowedRule|transitionPermissionMode|pluginInstallHandler|verifyMcpbFile|createBridgeClient|parseUserSpecifiedModel|worktreeBranchName|refreshGcpAuth|getProxyAgent|refreshGrowthBookFeatures|isRunningInRemoteEnvironment|setMemberMode|getInboxPath|persistHookOutput|profileReport|logEvent|truncateToWidth|useTheme)\b" claude-code-pkg/src/entrypoints/cli.renamed.js

For the 2.1.215 build under claude-code-pkg/, these representative semantic anchors resolve. Replacement bundles regenerated by scripts/semantic-rename-cli.mjs can move or lose individual aliases as export/minifier surfaces change.

Caveats

  • Loader and export helper names are minified and changed from T/j$ to b/nt in this update. The extractor detects both structures rather than depending on those names. Statements between two loaders are attributed to the second loader (the module being initialized).
  • Themes are identified by keyword regexes on the per-module set of semantic names. They have priority order; the first match wins. Some modules contain symbols from multiple themes (e.g. session hub + memory). Reclassify by adjusting the patterns in scripts/extract-cli-module-map.mjs.
  • 980 modules with semantic content remain unclassified because they hold subsystem-specific names not yet promoted to a theme. They are recorded verbatim in data/cli-modules.json and are good seeds for further atlas passes.
  • 3,612 modules are still fully opaque (no semantic names yet) and are intentionally not surfaced here. Further rename evidence can lift more of them; see the rename pipeline in scripts/semantic-rename-cli.mjs for the existing evidence classes.

Created and maintained by Yingting Huang.