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

Function persistProjectConfigPatch

src/utils/project-config.ts:403–456  ·  view source on GitHub ↗
(
  options: PersistProjectConfigPatchOptions,
)

Source from the content-addressed store, hash-verified

401}
402
403export async function persistProjectConfigPatch(
404 options: PersistProjectConfigPatchOptions,
405): Promise<{ path: string }> {
406 const configDir = getConfigDir(options.cwd);
407 const configPath = getConfigPath(options.cwd);
408
409 await options.fs.mkdir(configDir, { recursive: true });
410 const baseConfig = await readBaseConfigForPersistence({ fs: options.fs, configPath });
411
412 const nextConfig: ProjectConfig = {
413 ...baseConfig,
414 schemaVersion: 1,
415 };
416
417 if (options.patch.enabledWorkflows !== undefined) {
418 nextConfig.enabledWorkflows = normalizeEnabledWorkflows(options.patch.enabledWorkflows);
419 }
420
421 const topLevelPatch = removeUndefined({
422 debug: options.patch.debug,
423 sentryDisabled: options.patch.sentryDisabled,
424 experimentalWorkflowDiscovery: options.patch.experimentalWorkflowDiscovery,
425 disableSessionDefaults: options.patch.disableSessionDefaults,
426 filePathRenderStyle: options.patch.filePathRenderStyle,
427 });
428
429 for (const [key, value] of Object.entries(topLevelPatch)) {
430 nextConfig[key] = value;
431 }
432
433 if (options.patch.setupPreferences === null) {
434 delete nextConfig.setupPreferences;
435 } else if (options.patch.setupPreferences !== undefined) {
436 nextConfig.setupPreferences = options.patch.setupPreferences;
437 }
438
439 if (options.patch.sessionDefaults) {
440 const patch = removeUndefined(options.patch.sessionDefaults as Record<string, unknown>);
441 const nextSessionDefaults: Partial<SessionDefaults> = {
442 ...(nextConfig.sessionDefaults ?? {}),
443 ...patch,
444 };
445
446 for (const key of options.deleteSessionDefaultKeys ?? []) {
447 delete nextSessionDefaults[key];
448 }
449
450 nextConfig.sessionDefaults = nextSessionDefaults;
451 }
452
453 await options.fs.writeFile(configPath, stringifyYaml(nextConfig), 'utf8');
454
455 return { path: configPath };
456}

Callers 2

runSetupWizardFunction · 0.90

Calls 7

removeUndefinedFunction · 0.90
getConfigDirFunction · 0.85
getConfigPathFunction · 0.85
mkdirMethod · 0.80
writeFileMethod · 0.80

Tested by

no test coverage detected