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

Function buildHeaderParams

src/utils/xcodebuild-pipeline.ts:68–145  ·  view source on GitHub ↗
(
  params: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

66}
67
68function buildHeaderParams(
69 params: Record<string, unknown>,
70): Array<{ label: string; value: string }> {
71 const result: Array<{ label: string; value: string }> = [];
72 const keyLabelMap: Record<string, string> = {
73 scheme: 'Scheme',
74 workspacePath: 'Workspace',
75 projectPath: 'Project',
76 packagePath: 'Package',
77 targetName: 'Target',
78 executableName: 'Executable',
79 configuration: 'Configuration',
80 platform: 'Platform',
81 simulatorName: 'Simulator',
82 simulatorId: 'Simulator',
83 deviceId: 'Device',
84 arch: 'Architecture',
85 derivedDataPath: 'Derived Data',
86 xcresultPath: 'xcresult',
87 file: 'File',
88 targetFilter: 'Target Filter',
89 };
90 const arrayLabelMap: Record<string, string> = {
91 onlyTesting: '-only-testing',
92 skipTesting: '-skip-testing',
93 };
94
95 const pathKeys = new Set(['workspacePath', 'projectPath', 'derivedDataPath', 'xcresultPath']);
96
97 for (const [key, label] of Object.entries(keyLabelMap)) {
98 const value = params[key];
99 if (typeof value === 'string' && value.length > 0) {
100 if (key === 'projectPath' && typeof params.workspacePath === 'string') {
101 continue;
102 }
103 if (key === 'simulatorId' && typeof params.simulatorName === 'string') {
104 continue;
105 }
106 let displayValue: string;
107 if (pathKeys.has(key)) {
108 displayValue = displayPath(value);
109 } else if (key === 'deviceId') {
110 displayValue = formatDeviceId(value);
111 } else {
112 displayValue = value;
113 }
114 result.push({ label, value: displayValue });
115 }
116 }
117
118 for (const [key, label] of Object.entries(arrayLabelMap)) {
119 const value = params[key];
120 if (!Array.isArray(value)) {
121 continue;
122 }
123
124 for (const entry of value) {
125 if (typeof entry === 'string' && entry.length > 0) {

Callers 1

Calls 4

displayPathFunction · 0.90
formatDeviceIdFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected