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

Function formatNextStepForCli

src/utils/responses/next-step-formatting.ts:37–67  ·  view source on GitHub ↗
(step: NextStep)

Source from the content-addressed store, hash-verified

35}
36
37function formatNextStepForCli(step: NextStep): string {
38 const commandName = step.cliTool ?? (step.tool ? toKebabCase(step.tool) : undefined);
39 if (!commandName) {
40 return resolveLabel(step);
41 }
42
43 const parts = ['xcodebuildmcp'];
44 if (step.workflow) {
45 parts.push(step.workflow);
46 }
47 parts.push(commandName);
48
49 const params = step.params ?? {};
50 if (Object.values(params).some(hasComplexCliParamValue)) {
51 parts.push('--json', formatCliParamValue(params));
52 return parts.join(' ');
53 }
54
55 for (const [key, value] of Object.entries(params)) {
56 const flagName = toKebabCase(key);
57 if (typeof value === 'boolean') {
58 if (value) {
59 parts.push(`--${flagName}`);
60 }
61 } else {
62 parts.push(`--${flagName}`, formatCliParamValue(value));
63 }
64 }
65
66 return parts.join(' ');
67}
68
69function formatMcpValue(value: NextStepParamValue): string {
70 if (typeof value === 'string' || (typeof value === 'object' && value !== null)) {

Callers 1

formatNextStepFunction · 0.85

Calls 4

toKebabCaseFunction · 0.90
resolveLabelFunction · 0.85
formatCliParamValueFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected