(
result: Extract<ToolDomainResult, { kind: 'app-path' }>,
)
| 672 | } |
| 673 | |
| 674 | function createAppPathItems( |
| 675 | result: Extract<ToolDomainResult, { kind: 'app-path' }>, |
| 676 | ): TextRenderableItem[] { |
| 677 | const headerParams: HeaderRenderItem['params'] = []; |
| 678 | if (result.request?.scheme) { |
| 679 | headerParams.push({ label: 'Scheme', value: result.request.scheme }); |
| 680 | } |
| 681 | if (result.request?.workspacePath) { |
| 682 | headerParams.push({ label: 'Workspace', value: displayPath(result.request.workspacePath) }); |
| 683 | } else if (result.request?.projectPath) { |
| 684 | headerParams.push({ label: 'Project', value: displayPath(result.request.projectPath) }); |
| 685 | } |
| 686 | if (result.request?.configuration) { |
| 687 | headerParams.push({ label: 'Configuration', value: result.request.configuration }); |
| 688 | } |
| 689 | if (result.request?.platform) { |
| 690 | headerParams.push({ label: 'Platform', value: result.request.platform }); |
| 691 | } |
| 692 | if (result.request?.simulator) { |
| 693 | headerParams.push({ label: 'Simulator', value: result.request.simulator }); |
| 694 | } |
| 695 | |
| 696 | const items: TextRenderableItem[] = [createHeader('Get App Path', headerParams)]; |
| 697 | const target = result.summary?.target; |
| 698 | |
| 699 | if (result.didError) { |
| 700 | items.push( |
| 701 | ...createFailureStatusWithDiagnostics( |
| 702 | result, |
| 703 | target === 'simulator' ? 'Failed to get app path' : 'Query failed.', |
| 704 | ), |
| 705 | ); |
| 706 | return items; |
| 707 | } |
| 708 | |
| 709 | const durationMs = |
| 710 | typeof result.summary?.durationMs === 'number' ? result.summary.durationMs : undefined; |
| 711 | const appPath = |
| 712 | 'artifacts' in result && result.artifacts && 'appPath' in result.artifacts |
| 713 | ? result.artifacts.appPath |
| 714 | : undefined; |
| 715 | const isSimulatorAppPath = |
| 716 | target === 'simulator' || |
| 717 | (typeof appPath === 'string' && |
| 718 | /(iphonesimulator|watchsimulator|appletvsimulator|xrsimulator|visionossimulator)/i.test( |
| 719 | appPath, |
| 720 | )); |
| 721 | items.push( |
| 722 | createStatus( |
| 723 | 'success', |
| 724 | isSimulatorAppPath && durationMs !== undefined |
| 725 | ? `Get app path successful (⏱️ ${formatDurationSeconds(durationMs)})` |
| 726 | : isSimulatorAppPath |
| 727 | ? 'Get app path successful' |
| 728 | : 'Success', |
| 729 | ), |
| 730 | ); |
| 731 | if (appPath) { |
no test coverage detected