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

Function bootstrapRuntime

src/runtime/bootstrap-runtime.ts:110–170  ·  view source on GitHub ↗
(
  opts: BootstrapRuntimeOptions,
)

Source from the content-addressed store, hash-verified

108}
109
110export async function bootstrapRuntime(
111 opts: BootstrapRuntimeOptions,
112): Promise<BootstrapRuntimeResult> {
113 process.env.XCODEBUILDMCP_RUNTIME = opts.runtime;
114 const cwdOverride = opts.cwd === undefined ? resolveCwdOverride() : undefined;
115 if (cwdOverride !== undefined) {
116 try {
117 process.chdir(cwdOverride);
118 } catch (error) {
119 log(
120 'warn',
121 `XCODEBUILDMCP_CWD points at "${cwdOverride}" but chdir failed: ${
122 error instanceof Error ? error.message : String(error)
123 }. Falling back to existing cwd.`,
124 );
125 }
126 }
127 const cwd = opts.cwd ?? process.cwd();
128 const fs = opts.fs ?? getDefaultFileSystemExecutor();
129
130 const configResult = await initConfigStore({
131 cwd,
132 fs,
133 overrides: opts.configOverrides,
134 });
135
136 if (configResult.found) {
137 log('info', `Loaded project config from ${configResult.path} (cwd: ${cwd})`);
138 } else {
139 log('info', `No project config found (cwd: ${cwd}).`);
140 }
141
142 const config = getConfig();
143 const workspaceIdentity = resolveWorkspaceIdentity({
144 cwd,
145 projectConfigPath: configResult.path,
146 });
147 configureRuntimeWorkspaceKey(workspaceIdentity.workspaceKey);
148
149 if (opts.runtime === 'mcp') {
150 const hydration = hydrateSessionDefaultsForMcp(
151 config.sessionDefaults,
152 config.sessionDefaultsProfiles,
153 config.activeSessionDefaultsProfile,
154 );
155 logHydrationResult(hydration);
156 }
157
158 return {
159 runtime: {
160 runtime: opts.runtime,
161 cwd,
162 config,
163 },
164 workspaceRoot: workspaceIdentity.workspaceRoot,
165 workspaceKey: workspaceIdentity.workspaceKey,
166 configFound: configResult.found,
167 configPath: configResult.path,

Callers 5

mainFunction · 0.90
runDoctorFunction · 0.90
mainFunction · 0.90
bootstrapServerFunction · 0.90

Calls 9

logFunction · 0.90
initConfigStoreFunction · 0.90
getConfigFunction · 0.90
resolveWorkspaceIdentityFunction · 0.90
resolveCwdOverrideFunction · 0.85
logHydrationResultFunction · 0.85

Tested by

no test coverage detected