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