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

Function selectWorkflowIds

src/cli/commands/setup.ts:351–429  ·  view source on GitHub ↗
(opts: {
  debug: boolean;
  existingConfig?: ProjectConfig;
  existingEnabledWorkflows: string[];
  platforms: SetupPlatform[];
  prompter: Prompter;
  quietOutput: boolean;
})

Source from the content-addressed store, hash-verified

349}
350
351async function selectWorkflowIds(opts: {
352 debug: boolean;
353 existingConfig?: ProjectConfig;
354 existingEnabledWorkflows: string[];
355 platforms: SetupPlatform[];
356 prompter: Prompter;
357 quietOutput: boolean;
358}): Promise<string[]> {
359 const workflows = getWorkflowOptions(opts.debug, opts.existingConfig);
360 if (workflows.length === 0) {
361 return [];
362 }
363
364 const recommendedIds = new Set(getRecommendedWorkflowIds(workflows, opts.platforms));
365 const workflowOptions = toWorkflowSelectOptions(workflows);
366 const defaults =
367 opts.existingEnabledWorkflows.length > 0
368 ? opts.existingEnabledWorkflows
369 : getDefaultWorkflowIdsForPlatforms(workflows, opts.platforms);
370
371 if (opts.existingEnabledWorkflows.length > 0 || recommendedIds.size === 0) {
372 showPromptHelp(
373 'Select workflows to choose which groups of tools are enabled by default in this project.',
374 opts.quietOutput,
375 );
376 return opts.prompter.selectMany({
377 message: 'Select workflows to enable',
378 options: workflowOptions,
379 initialSelectedKeys: new Set(defaults),
380 getKey: (value) => value,
381 minSelected: 1,
382 });
383 }
384
385 const recommendedOptions = workflowOptions.filter((option) => recommendedIds.has(option.value));
386 const otherOptions = workflowOptions.filter((option) => !recommendedIds.has(option.value));
387
388 showPromptHelp(
389 'Recommended workflows are based on your selected platform(s).\n' +
390 'Only the core default workflow is selected automatically; you can adjust the recommendation list freely.',
391 opts.quietOutput,
392 );
393 const selectedRecommended = await opts.prompter.selectMany({
394 message: 'Select recommended workflows to enable',
395 options: recommendedOptions,
396 initialSelectedKeys: new Set(defaults),
397 getKey: (value) => value,
398 minSelected: otherOptions.length > 0 ? 0 : 1,
399 });
400
401 if (otherOptions.length === 0) {
402 return selectedRecommended;
403 }
404
405 showPromptHelp(
406 'Additional workflows are not specifically recommended for your selected platform(s),\n' +
407 'but you can still enable them if they fit your project.',
408 opts.quietOutput,

Callers 1

collectSetupSelectionFunction · 0.85

Calls 8

getWorkflowOptionsFunction · 0.85
toWorkflowSelectOptionsFunction · 0.85
showPromptHelpFunction · 0.85
mergeWorkflowSelectionsFunction · 0.85
selectManyMethod · 0.80
confirmMethod · 0.80

Tested by

no test coverage detected