MCPcopy Create free account
hub / github.com/freecodexyz/free-code / main

Function main

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

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

Callers 1

cli.tsxFile · 0.70

Calls 15

profileCheckpointFunction · 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
initSinksFunction · 0.85

Tested by

no test coverage detected