MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / main

Function main

src/cli.ts:117–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115}
116
117async function main(): Promise<void> {
118 const cliBootstrapStartedAt = Date.now();
119 const earlyCommand = findTopLevelCommand(process.argv.slice(2));
120 if (earlyCommand === 'mcp') {
121 await startMcpServer();
122 return;
123 }
124 if (earlyCommand === 'init') {
125 await runInitCommand();
126 return;
127 }
128 if (earlyCommand === 'setup') {
129 await runSetupCommand();
130 return;
131 }
132 if (earlyCommand === 'upgrade') {
133 await runUpgradeCommand();
134 return;
135 }
136
137 await hydrateSentryDisabledEnvFromProjectConfig();
138 initSentry({ mode: 'cli' });
139
140 // CLI mode uses disableSessionDefaults to show all tool parameters as flags
141 const result = await bootstrapRuntime({
142 runtime: 'cli',
143 configOverrides: {
144 disableSessionDefaults: true,
145 },
146 });
147
148 const { workspaceRoot, workspaceKey } = result;
149
150 const socketPath =
151 findGlobalSocketOverride(process.argv.slice(2)) ??
152 getSocketPath({
153 cwd: result.runtime.cwd,
154 projectConfigPath: result.configPath,
155 });
156
157 const cliExposedWorkflowIds = await listCliWorkflowIdsFromManifest({
158 excludeWorkflows: ['session-management', 'workflow-discovery'],
159 });
160 const topLevelCommand = findTopLevelCommand(process.argv.slice(2));
161 const discoveryMode = topLevelCommand === 'xcode-ide' ? 'quick' : 'none';
162
163 // CLI uses a manifest-resolved catalog plus daemon-backed xcode-ide dynamic tools.
164 const catalog = await buildCliToolCatalog({
165 socketPath,
166 workspaceRoot,
167 cliExposedWorkflowIds,
168 discoveryMode,
169 });
170
171 const yargsApp = buildYargsApp({
172 catalog,
173 runtimeConfig: result.runtime.config,
174 defaultSocketPath: socketPath,

Callers 2

run.tsFile · 0.90
cli.tsFile · 0.70

Calls 14

startMcpServerFunction · 0.90
initSentryFunction · 0.90
bootstrapRuntimeFunction · 0.90
getSocketPathFunction · 0.90
buildCliToolCatalogFunction · 0.90
buildYargsAppFunction · 0.90
findTopLevelCommandFunction · 0.85
runInitCommandFunction · 0.85
runSetupCommandFunction · 0.85

Tested by

no test coverage detected