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

Function buildYargsApp

src/cli/yargs-app.ts:28–100  ·  view source on GitHub ↗
(opts: YargsAppOptions)

Source from the content-addressed store, hash-verified

26 * Build the main yargs application with all commands registered.
27 */
28export function buildYargsApp(opts: YargsAppOptions): ReturnType<typeof yargs> {
29 const app = yargs(hideBin(process.argv))
30 .scriptName('')
31 .usage('Usage: xcodebuildmcp <command> [options]')
32 .strict()
33 .recommendCommands()
34 .wrap(Math.min(120, yargs().terminalWidth()))
35 .parserConfiguration({
36 // Accept --derived-data-path -> derivedDataPath
37 'camel-case-expansion': true,
38 })
39 .option('socket', {
40 type: 'string',
41 describe: 'Override daemon unix socket path',
42 default: opts.defaultSocketPath,
43 hidden: true,
44 })
45 .option('log-level', {
46 type: 'string',
47 describe: 'Set log verbosity level',
48 choices: ['none', 'error', 'warn', 'info', 'debug'] as const,
49 coerce: coerceLogLevel,
50 default: 'none',
51 })
52 .option('style', {
53 type: 'string',
54 describe: 'Output style (normal is detailed; minimal is compact MCP-like output)',
55 choices: ['normal', 'minimal'] as const,
56 default: 'normal',
57 })
58 .option('file-path-render-style', {
59 type: 'string',
60 describe: 'Render file artifacts as a compact tree or labeled list in text output',
61 choices: ['tree', 'list'] as const,
62 })
63 .middleware((argv) => {
64 const level = argv['log-level'] as LogLevel | undefined;
65 if (level) {
66 setLogLevel(level);
67 }
68 })
69 .version(String(version))
70 .help()
71 .alias('h', 'help')
72 .alias('v', 'version')
73 .demandCommand(1, '')
74 .epilogue(
75 `Run 'xcodebuildmcp mcp' to start the MCP server.\n` +
76 `Run 'xcodebuildmcp tools' to see all available tools.\n` +
77 `Run 'xcodebuildmcp <workflow> <tool> --help' for tool-specific help.`,
78 );
79
80 // Register command groups with workspace context
81 registerMcpCommand(app);
82 registerInitCommand(app, { workspaceRoot: opts.workspaceRoot });
83 registerSetupCommand(app);
84 registerUpgradeCommand(app);
85 registerToolsCommand(app);

Callers 1

mainFunction · 0.90

Calls 8

setLogLevelFunction · 0.90
registerMcpCommandFunction · 0.90
registerInitCommandFunction · 0.90
registerSetupCommandFunction · 0.90
registerUpgradeCommandFunction · 0.90
registerToolsCommandFunction · 0.90
registerToolCommandsFunction · 0.90
registerDaemonCommandsFunction · 0.90

Tested by

no test coverage detected