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

Function createXcodebuildRunState

src/utils/xcodebuild-run-state.ts:133–283  ·  view source on GitHub ↗
(options: RunStateOptions)

Source from the content-addressed store, hash-verified

131}
132
133export function createXcodebuildRunState(options: RunStateOptions): XcodebuildRunStateHandle {
134 const { operation, onEvent } = options;
135
136 const state: XcodebuildRunState = {
137 operation,
138 currentStage: null,
139 milestones: [],
140 warnings: [],
141 errors: [],
142 testFailures: [],
143 testCaseResults: [],
144 completedTests: 0,
145 failedTests: 0,
146 skippedTests: 0,
147 finalStatus: null,
148 wallClockDurationMs: null,
149 };
150
151 let highestRank = options.minimumStage !== undefined ? STAGE_RANK[options.minimumStage] : -1;
152 const seenDiagnostics = new Set<string>();
153
154 function accept(fragment: DomainFragment): void {
155 onEvent?.(fragment);
156 }
157
158 function acceptDedupedDiagnostic(
159 fragment: CompilerDiagnosticFragment,
160 collection: CompilerDiagnosticFragment[],
161 ): void {
162 const key = normalizeDiagnosticKey(fragment.location, fragment.message);
163 if (seenDiagnostics.has(key)) {
164 return;
165 }
166 seenDiagnostics.add(key);
167 collection.push(fragment);
168 accept(fragment);
169 }
170
171 return {
172 push(fragment: XcodebuildRunStateFragment): void {
173 switch (fragment.fragment) {
174 case 'build-stage': {
175 const rank = STAGE_RANK[fragment.stage];
176 if (rank <= highestRank) {
177 return;
178 }
179 highestRank = rank;
180 state.currentStage = fragment.stage;
181 state.milestones.push(fragment);
182 accept(fragment);
183 break;
184 }
185
186 case 'compiler-diagnostic': {
187 if (fragment.severity === 'warning') {
188 acceptDedupedDiagnostic(fragment, state.warnings);
189 } else {
190 acceptDedupedDiagnostic(fragment, state.errors);

Calls

no outgoing calls

Tested by 1

collectRunStateEventsFunction · 0.72