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

Function main

src/entrypoints/cli.tsx:33–299  ·  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

31 * Fast-path for --version has zero imports beyond this file.
32 */
33async function main(): Promise<void> {
34 const args = process.argv.slice(2);
35
36 // Fast-path for --version/-v: zero module loading needed
37 if (args.length === 1 && (args[0] === '--version' || args[0] === '-v' || args[0] === '-V')) {
38 // MACRO.VERSION is inlined at build time
39 // biome-ignore lint/suspicious/noConsole:: intentional console output
40 console.log(`${MACRO.VERSION} (Claude Code)`);
41 return;
42 }
43
44 // For all other paths, load the startup profiler
45 const {
46 profileCheckpoint
47 } = await import('../utils/startupProfiler.js');
48 profileCheckpoint('cli_entry');
49
50 // Fast-path for --dump-system-prompt: output the rendered system prompt and exit.
51 // Used by prompt sensitivity evals to extract the system prompt at a specific commit.
52 // Ant-only: eliminated from external builds via feature flag.
53 if (feature('DUMP_SYSTEM_PROMPT') && args[0] === '--dump-system-prompt') {
54 profileCheckpoint('cli_dump_system_prompt_path');
55 const {
56 enableConfigs
57 } = await import('../utils/config.js');
58 enableConfigs();
59 const {
60 getMainLoopModel
61 } = await import('../utils/model/model.js');
62 const modelIdx = args.indexOf('--model');
63 const model = modelIdx !== -1 && args[modelIdx + 1] || getMainLoopModel();
64 const {
65 getSystemPrompt
66 } = await import('../constants/prompts.js');
67 const prompt = await getSystemPrompt([], model);
68 // biome-ignore lint/suspicious/noConsole:: intentional console output
69 console.log(prompt.join('\n'));
70 return;
71 }
72 if (process.argv[2] === '--claude-in-chrome-mcp') {
73 profileCheckpoint('cli_claude_in_chrome_mcp_path');
74 const {
75 runClaudeInChromeMcpServer
76 } = await import('../utils/claudeInChrome/mcpServer.js');
77 await runClaudeInChromeMcpServer();
78 return;
79 } else if (process.argv[2] === '--chrome-native-host') {
80 profileCheckpoint('cli_chrome_native_host_path');
81 const {
82 runChromeNativeHost
83 } = await import('../utils/claudeInChrome/chromeNativeHost.js');
84 await runChromeNativeHost();
85 return;
86 } else if (feature('CHICAGO_MCP') && process.argv[2] === '--computer-use-mcp') {
87 profileCheckpoint('cli_computer_use_mcp_path');
88 const {
89 runComputerUseMcpServer
90 } = await import('../utils/computerUse/mcpServer.js');

Callers 1

cli.tsxFile · 0.70

Calls 15

profileCheckpointFunction · 0.85
featureFunction · 0.85
enableConfigsFunction · 0.85
getMainLoopModelFunction · 0.85
runChromeNativeHostFunction · 0.85
runComputerUseMcpServerFunction · 0.85
getBridgeDisabledReasonFunction · 0.85
checkBridgeMinVersionFunction · 0.85
isPolicyAllowedFunction · 0.85
bridgeMainFunction · 0.85

Tested by

no test coverage detected