MCPcopy
hub / github.com/claude-code-best/claude-code / main

Function main

src/entrypoints/cli.tsx:76–360  ·  view source on GitHub ↗

* Bootstrap entrypoint - checks for special flags before loading the full CLI. * All imports are dynamic to minimize module evaluation for fast paths. * Fast-path for --version has zero imports beyond this file.

()

Source from the content-addressed store, hash-verified

74 * Fast-path for --version has zero imports beyond this file.
75 */
76async function main(): Promise<void> {
77 const args = process.argv.slice(2);
78
79 // Fast-path for --version/-v: zero module loading needed
80 if (args.length === 1 && (args[0] === '--version' || args[0] === '-v' || args[0] === '-V')) {
81 // MACRO.VERSION is inlined at build time
82 console.log(`${MACRO.VERSION} (Claude Code)`);
83 return;
84 }
85
86 // For all other paths, load the startup profiler
87 const { profileCheckpoint } = await import('../utils/startupProfiler.js');
88 profileCheckpoint('cli_entry');
89
90 // Fast-path for --dump-system-prompt: output the rendered system prompt and exit.
91 // Used by prompt sensitivity evals to extract the system prompt at a specific commit.
92 // Ant-only: eliminated from external builds via feature flag.
93 if (feature('DUMP_SYSTEM_PROMPT') && args[0] === '--dump-system-prompt') {
94 profileCheckpoint('cli_dump_system_prompt_path');
95 const { enableConfigs } = await import('../utils/config.js');
96 enableConfigs();
97 const { getMainLoopModel } = await import('../utils/model/model.js');
98 const modelIdx = args.indexOf('--model');
99 const model = (modelIdx !== -1 && args[modelIdx + 1]) || getMainLoopModel();
100 const { getSystemPrompt } = await import('../constants/prompts.js');
101 const prompt = await getSystemPrompt([], model);
102 console.log(prompt.join('\n'));
103 return;
104 }
105
106 if (process.argv[2] === '--claude-in-chrome-mcp') {
107 profileCheckpoint('cli_claude_in_chrome_mcp_path');
108 const { runClaudeInChromeMcpServer } = await import('../utils/claudeInChrome/mcpServer.js');
109 await runClaudeInChromeMcpServer();
110 return;
111 } else if (process.argv[2] === '--chrome-native-host') {
112 profileCheckpoint('cli_chrome_native_host_path');
113 const { runChromeNativeHost } = await import('../utils/claudeInChrome/chromeNativeHost.js');
114 await runChromeNativeHost();
115 return;
116 } else if (feature('CHICAGO_MCP') && process.argv[2] === '--computer-use-mcp') {
117 profileCheckpoint('cli_computer_use_mcp_path');
118 const { runComputerUseMcpServer } = await import('../utils/computerUse/mcpServer.js');
119 await runComputerUseMcpServer();
120 return;
121 }
122
123 // Fast-path for `--acp` — ACP (Agent Client Protocol) agent mode over stdio.
124 if (feature('ACP') && process.argv[2] === '--acp') {
125 profileCheckpoint('cli_acp_path');
126 const { runAcpAgent } = await import('../services/acp/entry.js');
127 await runAcpAgent();
128 return;
129 }
130
131 if (args[0] === 'weixin') {
132 profileCheckpoint('cli_weixin_path');
133 const { handleWeixinCli } = await import('@claude-code-best/weixin');

Callers 1

cli.tsxFile · 0.70

Calls 15

profileCheckpointFunction · 0.85
enableConfigsFunction · 0.85
getMainLoopModelFunction · 0.85
runChromeNativeHostFunction · 0.85
runComputerUseMcpServerFunction · 0.85
runAcpAgentFunction · 0.85
handleWeixinCliFunction · 0.85
runDaemonWorkerFunction · 0.85
getBridgeAccessTokenFunction · 0.85
getBridgeDisabledReasonFunction · 0.85
checkBridgeMinVersionFunction · 0.85

Tested by

no test coverage detected