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

Function collectInitSelection

src/cli/commands/init.ts:316–420  ·  view source on GitHub ↗
(
  argv: { skill?: string; client?: string; dest?: string },
  prompter: Prompter,
)

Source from the content-addressed store, hash-verified

314}
315
316async function collectInitSelection(
317 argv: { skill?: string; client?: string; dest?: string },
318 prompter: Prompter,
319): Promise<InitSelection> {
320 const destProvided = argv.dest !== undefined;
321
322 const interactive = isInteractiveTTY();
323
324 let skillType: SkillType;
325 if (argv.skill !== undefined) {
326 skillType = argv.skill as SkillType;
327 } else if (interactive) {
328 skillType = await prompter.selectOne<SkillType>({
329 message: 'Which skill variant to install?',
330 options: [
331 {
332 value: 'cli',
333 label: 'XcodeBuildMCP CLI',
334 description: 'Recommended for most users',
335 },
336 {
337 value: 'mcp',
338 label: 'XcodeBuildMCP MCP Server',
339 description: 'For MCP server usage',
340 },
341 ],
342 initialIndex: 0,
343 });
344 } else {
345 skillType = 'cli';
346 }
347
348 if (destProvided) {
349 const resolvedDest = resolvePathFromCwd(argv.dest!);
350 if (resolvedDest === path.parse(resolvedDest).root) {
351 throw new Error(
352 'Refusing to use filesystem root as skills destination. Use a dedicated directory.',
353 );
354 }
355 return {
356 skillType,
357 targets: [{ name: 'Custom', id: 'custom', skillsDir: resolvedDest }],
358 selectionMode: 'flags_or_dest',
359 };
360 }
361
362 if (argv.client !== undefined) {
363 const targets = resolveTargets(argv.client, undefined, 'install');
364 return { skillType, targets, selectionMode: 'flags_or_dest' };
365 }
366
367 if (!interactive) {
368 throw new Error(
369 'Non-interactive mode requires --client or --dest for init. Use --print to output the skill content without installing.',
370 );
371 }
372
373 const home = os.homedir();

Callers 1

registerInitCommandFunction · 0.85

Calls 6

isInteractiveTTYFunction · 0.90
resolvePathFromCwdFunction · 0.90
resolveTargetsFunction · 0.85
detectClientsFunction · 0.85
promptCustomPathFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected