MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / createStopResultItems

Function createStopResultItems

src/utils/renderers/domain-result-text.ts:855–911  ·  view source on GitHub ↗
(
  result: Extract<ToolDomainResult, { kind: 'stop-result' }>,
)

Source from the content-addressed store, hash-verified

853}
854
855function createStopResultItems(
856 result: Extract<ToolDomainResult, { kind: 'stop-result' }>,
857): TextRenderableItem[] {
858 const isSimulator = typeof result.artifacts.simulatorId === 'string';
859 const isDevice = typeof result.artifacts.deviceId === 'string';
860 const isSwiftPackage =
861 !isSimulator &&
862 !isDevice &&
863 typeof result.artifacts.processId === 'number' &&
864 !result.artifacts.appName &&
865 !result.artifacts.bundleId;
866 const isMac = !isSimulator && !isDevice && !isSwiftPackage;
867
868 const title = isSwiftPackage ? 'Swift Package Stop' : isMac ? 'Stop macOS App' : 'Stop App';
869 const params: HeaderRenderItem['params'] = [];
870 if (isSimulator) {
871 params.push({ label: 'Simulator', value: result.artifacts.simulatorId! });
872 if (result.artifacts.bundleId) {
873 params.push({ label: 'Bundle ID', value: result.artifacts.bundleId });
874 }
875 } else if (isDevice) {
876 params.push({
877 label: 'Device',
878 value: result.didError
879 ? result.artifacts.deviceId!
880 : formatDeviceId(result.artifacts.deviceId!),
881 });
882 if (typeof result.artifacts.processId === 'number') {
883 params.push({ label: 'PID', value: String(result.artifacts.processId) });
884 }
885 } else if (isSwiftPackage) {
886 params.push({ label: 'PID', value: String(result.artifacts.processId) });
887 } else {
888 params.push({
889 label: 'App',
890 value:
891 result.artifacts.appName ??
892 (typeof result.artifacts.processId === 'number'
893 ? `PID ${result.artifacts.processId}`
894 : 'unknown'),
895 });
896 }
897
898 const items: TextRenderableItem[] = [createHeader(title, params)];
899 if (result.didError) {
900 items.push(...createFailureStatusWithDiagnostics(result, 'Stop failed.'));
901 return items;
902 }
903
904 items.push(
905 createStatus(
906 'success',
907 isSwiftPackage ? 'Swift package process stopped successfully' : 'App stopped successfully',
908 ),
909 );
910 return items;
911}
912

Callers 1

createSpecialCaseItemsFunction · 0.85

Calls 5

formatDeviceIdFunction · 0.90
createHeaderFunction · 0.85
createStatusFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected