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 renamed file wraps everything in one top-level function expression that contains 23,365 statements. Bun emits each original ESM module as a var loaderName = T(() => { /* setup */ }); loader, preceded by the module’s forward function / class / var declarations and j$(module, { semanticName: () => obfuscatedName, ... }) export tables.

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 loadervar loaderName = T(() => { ... }) in cli.renamed.jsEach loader call marks one original ESM module; statements above it (up to the previous loader) form its forward declarations.
Module export tablej$(module, { semanticName: () => obfuscatedBinding, ... })Maps the original ESM export name (now also the binding identifier after rename) onto its internal implementation.
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 var loaderName = T(...) statement. Function definitions usually sit a few hundred lines earlier in the same partition.

Coverage summary

MetricValue
Top-level statements in wrapping IIFE23,365
Bun module loaders (T(() => { ... }))3,814
Modules with explicit j$ export table387
Modules with any semantic decl or export918
Modules currently classified into a theme232
Modules with semantic info but no theme yet686
Fully opaque modules (still all minified)2,896
Themes recognized37

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
SessionRuntimeStateHub23398, 118553switchSession, setUserMsgOptIn, waitForScrollIdle, setSessionOverridesGetter, regenerateSessionId, getParentSessionId, setTracerProvider, setTeleportedSessionInfo, snapshotOutputTokensForTurn, setThinkingTypeOverride, setTerminalFocusForState, setTeamMemoryServerStatus, setSystemPromptSectionCacheEntrySession API, events, and storage
TranscriptAgentMetadataStore1623491writeRemoteAgentMetadata, writeAgentMetadata, readAgentMetadata, getMaterializedSessionFile, getTranscriptPathForSession, transcriptCursorEnd, trackSessionWrite, subscribeSessionTitleChanged, subscribeSessionAgentNameChanged, setInternalEventWriter, setInternalEventReader, worktreeStateSignal, sessionIdExistsSession resume and transcripts
TeammateMailboxIpc1286598writeToMailbox, sendShutdownRequestToMailbox, readUnreadMessages, readMailbox, markMessagesAsRead, markMessageAsReadByIndex, markMessagesAsReadByPredicate, formatTeammateMessages, createIdleNotification, isIdleNotification, isTeamPermissionUpdate, isTaskAssignment, isStructuredProtocolMessage, isShutdownRequest, isShutdownRejected, getInboxPathRemote control and teleport
TeamFileMemberModes1476236writeTeamFileAsync, updateTeamFile, unregisterTeamForSessionCleanup, syncTeammateMode, setMultipleMemberModes, setMemberMode, setMemberActive, sanitizeNameRemote control and teleport
SdkQueryAndSessionApi757255, 57368, 57451, 603841, 603910, 604195, 605109query, startup, resolveSettings, tool, createSdkMcpServer, parseDirectConnectUrl, DirectConnectTransport, DirectConnectError, InMemorySessionStore, HOOK_EVENTS, EXIT_REASONS, SYSTEM_PROMPT_DYNAMIC_BOUNDARY, filterEscalatingDefaultMode, foldSessionSummary, importSessionToStore, forkSession, deleteSession, tagSession, renameSession, getSessionMessages, getSessionInfo, listSessions, getSubagentMessages, listSubagents, AbortErrorSDK query, session API, and subagent surface

Permission, trust, hooks, and policy

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
PermissionRuleEngine1507251toolAlwaysAllowedRule, syncPermissionRulesFromDisk, permissionRuleSourceDisplayString, hasPermissionsToUseTool, guardHookUpdatedInput, getRuleByContentsForToolName, getRuleByContentsForTool, getDenyRules, getDenyRuleForTool, getDenyRuleForAgent, getAskRules, getAskRuleForToolBuilt-in tools and permissions
PermissionModeTransitions1508105verifyAutoModeGateAccess, transitionPlanAutoMode, transitionPermissionMode, stripDangerousPermissionsForAutoMode, shouldPlanUseAutoMode, shouldDisableBypassPermissions, setPermissionModeWithGuards, restoreDangerousPermissions, removeDangerousPermissions, prepareContextForPlanMode, parseToolListFromCLI, parseBaseToolsFromCLIBuilt-in tools and permissions
HookEventDispatcher1629735shouldSkipHookDueToTrust, hasWorktreeCreateHook, hasInstructionsLoadedHook, hasHookForEvent, hasBlockingResult, getUserPromptSubmitHookBlockingMessage, getTeammateIdleHookMessage, getTaskCreatedHookMessage, getTaskCompletedHookMessage, getTelemetryHookName, persistHookOutput, parseElicitationHookOutputHooks and events reference, MCP, plugins, and hooks
TrustedPathGlobalConfig1169401isPathTrusted, setPathTrusted, checkHasTrustDialogAccepted, resetTrustDialogAcceptedCache, isGlobalConfigKey, saveGlobalConfig, saveCurrentProjectConfig, isProjectConfigKey, getRemoteControlAtStartup, getDaemonColdStart, isAutoUpdaterDisabled, shouldSkipPluginAutoupdate, recordFirstStartTimeSettings, policy, and integrations
SettingsFileLoader262036, 62450updateSettingsForSource, shouldIncludeParentTier, settingsMergeCustomizer, rawSettingsContainsKey, parseSettingsFileUncached, parseSettingsFile, parseRemoteManagedSettings, loadManagedFileSettingsFromDirSettings schema reference
SecretRedaction111510redact, redactObject, redactSensitiveKeys, redactedJsonPreview, stripUrlSecrets, scanDiagnostics and debug logs

Git, worktree, and daemon

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
GitRepoOperations155226stashToCleanState, redactGitRemoteCredentials, preserveGitStateForIssue, normalizeGitRemoteUrl, isLinkedWorktree, isCurrentDirectoryBareGitRepo, isBranchOnOrigin, isAtGitRootCLI main paths
GitRefWatcher154518resolveRef, resolveGitDir, resetGitFileWatcher, removeWatchedRepo, readWorktreeHeadSha, readRawSymref, readGitHead, onRepoBranchChangeDaemon and background service
AgentWorktreeManager1631021worktreeBranchName, validateWorktreeSlug, restoreWorktreeSession, persistWorktreeSession, removeAgentWorktree, listRegisteredWorktrees, parsePRReference, killTmuxSessionAgents, tasks, and subagents
WorktreeDaemonJobScheduler1686644summarizeEvent, stateBucket, spawnOrigin, sortJobs, seedLastJobs, repoGroup, repoGroupLabel, rollupChildColor, rollupJobColor, pruneMap, formatJobAge, jobLabel, deriveActivity, deriveBand, needsRespawn, labelReplaceFrameDaemon and background service

Models, prompts, and memory

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
ModelSelectionConfig1118207resolveSkillModelOverride, renderModelSetting, renderModelName, renderDefaultModelSetting, parseUserSpecifiedModel, normalizeModelStringForAPI, modelDisplayString, isOpus1mMergeEnabled, isNonCustomOpusModel, isLegacyOpusFirstParty, isLegacyModelRemapEnabled, getUserSpecifiedModelSettingModel selection, calls, usage, quota, and billing
MemoryFileRules1259680processMemoryFile, processMdRules, processConditionedMdRules, isMemoryFilePath, isSyntheticMemoryPath, resetGetMemoryFilesCache, shouldShowClaudeMdExternalIncludesWarning, stripHtmlCommentsPrompt, context, and memory

Integrations (MCP, plugins, MCPB, LSP)

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
McpChromeBridge413823, 13838, 39107, 39134localPlatformLabel, createClaudeForChromeMcpServer, createChromeSocketClient, createBridgeClient, clearBrowserResolution, BridgeClient, BROWSER_TOOLS, ToolCallTimeoutError, SocketConnectionError, NoExtensionConnectedError, ExtensionDisconnectedMidCallError, PEER_WAIT_TIMEOUT_MS, DISCOVERY_TIMEOUT_MS, WAIT_MAX_DURATION_SMCP, plugins, and hooks, Tool runtime, events, and integration flows
McpbExtensionPackaging5268617, 271802, 271894, 272295, 272401verifyMcpbFile, verifyCertificateChain, validateManifest, unsignMcpbFile, unpackExtension, signMcpbFile, shouldExclude, replaceVariables, readPackageJson, readMcpbIgnorePatterns, promptVisualAssets, promptUserConfigMCP, plugins, and hooks
PluginLoader1276711resolvePluginPath, resolveContainedPluginPath, probeSeedCacheAnyVersion, mergePluginSources, loadSkillsAsPlugins, loadPluginManifest, loadAllPluginsCacheOnly, loadAllPluginsMCP, plugins, and hooks
PluginCommandHandlers1644148pluginValidateHandler, pluginUpdateHandler, pluginUninstallHandler, pluginTagHandler, pluginPruneHandler, pluginListHandler, pluginInstallHandler, pluginInitHandlerCommands and flags
LspIdeClient1428870createLSPClientSettings, policy, and integrations

Auth (multi-cloud)

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
GatewayAuthRefresh2110458, 157847withOAuthRefreshLock, validateForceLoginOrg, shouldUseWIFAuth, saveOAuthTokensIfNeeded, saveApiKey, restoreGatewayAuth, resetAwsAuthRefreshCooldown, removeApiKey, refreshGcpCredentialsIfNeeded, refreshGcpAuth, getAnthropicApiKey, hasAnthropicApiKeyAuth, getAuthTokenSource, isAnthropicAuthEnabledModels, providers, and auth
LoginFlow1409636Login, runPostLoginHooks, callModels, providers, and auth

Remote control, feature flags, networking

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
RemoteControlFeatureGates1325388isRunningInRemoteEnvironment, isRemoteControlInternalEventsEnabled, isRemoteControlHardDisabled, isPreviewHmrEnabled, isPersistentRemoteSessionEnabled, isCseShimEnabled, isCcrV2SendEventsEnabled, isCcrMirrorEnabledRemote control and teleport, Feature gates reference
GrowthBookFeatureFlags1167597refreshGrowthBookFeatures, refreshGrowthBookAfterAuthChange, setupPeriodicGrowthBookRefresh, stopPeriodicGrowthBookRefresh, setGrowthBookConfigOverride, onGrowthBookRefresh, isGrowthBookEnabled, resetGrowthBookFeature gates reference
ProxyClientFactory191577shouldBypassProxy, prefetchProxyAuthFromHelperIfSafe, getWebSocketProxyUrl, getProxyUrl, getProxyFetchOptions, getProxyAuthFromHelperCached, getProxyAuthFromHelper, getProxyAgentSettings, policy, and integrations

TUI and rendering

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
TerminalTextFormatting312130, 12130 (helpers), 199851wrapText, truncateToWidth, truncateToWidthNoEllipsis, truncateStartToWidth, truncatePathMiddle, formatTokens, formatTokenEstimate, formatSecondsShort, formatResetTimeCLI main paths
InkTerminalHooks8173046 – 199781useTheme, useTerminalViewport, useTerminalFocus, useTerminalTitle, useTabStatus, useStdin, useSelection, useResolvedTheme, useThemeSetting, useTimeout, usePreviewTheme, useCustomThemes, ThemeProviderCLI main paths

Observability and ops

Semantic alias / themeModulesLoader line rangeRepresentative exportsCompanion doc
AnalyticsEventSink13474logEvent, logEventAsync, createAnalyticsState, attachAnalyticsSink, stripProtoFields, _setGlobalAnalyticsStateForTesting, setGlobalAnalyticsStateForTestingTelemetry and tracing
StartupPerformanceProfiler112438profileReport, profileCheckpoint, logStartupPerf, isDetailedProfilingEnabled, getStartupPerfLogPathDiagnostics and debug logs
ProcessIoErrorHandlers211183, 11235writeToStdout, writeToStderr, registerProcessOutputErrorHandlers, peekForStdinData, exitWithError, 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 / Smithy15470461 – 117003*Command classes, httpAuthSchemeMiddleware, resolveDefaultRuntimeConfig, getDefaultClientConfiguration, AutomatedReasoning*, BedrockRuntime*
MSAL (Microsoft Identity)104322 – 143196UsernamePasswordClient, TokenCache, TokenCacheContext, BrokerClient, ClientAuthErrorCodes, instrumentBrokerParams, X_CLIENT_VER, tokenRefreshRequired
Zod schema validation1314503 – 28588ZodSchema, ZodString, ZodNumber, parseAsync, safeParse, toJSONSchema, setErrorMap, ZodISODate*, datetimeRegex
Ink React hooks (terminal UI runtime)8173046 – 199781See InkTerminalHooks above; Ink itself is bundled with the Claude Code TUI hooks
Axios HTTP239541 – 41297hasStandardBrowserWebWorkerEnv, hasStandardBrowserEnv, hasBrowserEnv, isBuffer, isArrayBufferView, isSpecCompliantForm
fflate zip/zlib codec1267623zlibSync, unzlibSync, zipSync, unzipSync, deflate, inflate, gunzipSync, strFromU8, strToU8
i18n locales table125400zhTW, zhCN, ja, ko, en, de, fr, es, plus 30+ ISO short 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|processMemoryFile|parseUserSpecifiedModel|worktreeBranchName|refreshGcpAuth|getProxyAgent|refreshGrowthBookFeatures|isRunningInRemoteEnvironment|setMemberMode|getInboxPath|persistHookOutput|profileReport|logEvent|redactObject|truncateToWidth|useTheme)\b" claude-code-pkg/src/entrypoints/cli.renamed.js

For the build under claude-code-pkg/ checked in here, all 23 anchors resolve. Replacement bundles regenerated by scripts/semantic-rename-cli.mjs should reproduce the same names while line numbers may shift.

Caveats

  • Each loader fingerprint is var X = T(() => { ... }). Statements between two loaders are attributed to the second loader (the module being initialized). Forward declarations for a module therefore precede its loader, sometimes by several thousand lines (e.g. the Session hub forwards from line 2015 forward but its loader sits at 3398).
  • 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.
  • 686 modules with semantic content remain unclassified because they hold subsystem-specific names we have not yet promoted to a theme (proxy auth helpers, slash-command tables, etc.). They are recorded verbatim in data/cli-modules.json and are good seeds for further atlas passes.
  • 2,896 modules are still fully opaque (no semantic names yet) and are intentionally not surfaced here. Further rename evidence (additional call-path patterns, registry inspection) 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.