clawdex-mobile 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/docs/setup-and-operations.md +3 -1
- package/docs/troubleshooting.md +1 -0
- package/package.json +18 -8
- package/scripts/setup-secure-dev.sh +26 -17
- package/services/rust-bridge/Cargo.lock +1 -1
- package/services/rust-bridge/Cargo.toml +1 -1
- package/vendor/bridge-binaries/darwin-arm64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/darwin-x64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/linux-x64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/win32-x64/codex-rust-bridge.exe +0 -0
- package/.artifacts/bridge-binaries/bridge-binaries-darwin-arm64/codex-rust-bridge +0 -0
- package/.artifacts/bridge-binaries/bridge-binaries-darwin-x64/codex-rust-bridge +0 -0
- package/.artifacts/bridge-binaries/bridge-binaries-linux-x64/codex-rust-bridge +0 -0
- package/.artifacts/bridge-binaries/bridge-binaries-win32-x64/codex-rust-bridge.exe +0 -0
- package/.github/workflows/ci.yml +0 -80
- package/.github/workflows/npm-release.yml +0 -208
- package/.github/workflows/pages.yml +0 -41
- package/AGENTS.md +0 -273
- package/STATUS.md +0 -115
- package/apps/mobile/.env.example +0 -6
- package/apps/mobile/App.tsx +0 -943
- package/apps/mobile/app.json +0 -77
- package/apps/mobile/assets/brand/adaptive-icon.png +0 -0
- package/apps/mobile/assets/brand/app-icon.png +0 -0
- package/apps/mobile/assets/brand/favicon.png +0 -0
- package/apps/mobile/assets/brand/mark.png +0 -0
- package/apps/mobile/assets/brand/splash-icon-white.png +0 -0
- package/apps/mobile/assets/brand/splash-icon.png +0 -0
- package/apps/mobile/babel.config.js +0 -7
- package/apps/mobile/eas.json +0 -40
- package/apps/mobile/eslint.config.cjs +0 -28
- package/apps/mobile/index.js +0 -5
- package/apps/mobile/package.json +0 -57
- package/apps/mobile/plugins/withAndroidCleartextTraffic.js +0 -14
- package/apps/mobile/src/api/__tests__/chatMapping.test.ts +0 -351
- package/apps/mobile/src/api/__tests__/client.test.ts +0 -1494
- package/apps/mobile/src/api/__tests__/ws.test.ts +0 -640
- package/apps/mobile/src/api/account.ts +0 -47
- package/apps/mobile/src/api/chatMapping.ts +0 -1048
- package/apps/mobile/src/api/client.ts +0 -1430
- package/apps/mobile/src/api/rateLimits.ts +0 -143
- package/apps/mobile/src/api/types.ts +0 -435
- package/apps/mobile/src/api/ws.ts +0 -852
- package/apps/mobile/src/bridgeUrl.ts +0 -105
- package/apps/mobile/src/components/ActivityBar.tsx +0 -95
- package/apps/mobile/src/components/ApprovalBanner.tsx +0 -207
- package/apps/mobile/src/components/BrandMark.tsx +0 -43
- package/apps/mobile/src/components/ChatHeader.tsx +0 -107
- package/apps/mobile/src/components/ChatInput.tsx +0 -457
- package/apps/mobile/src/components/ChatMessage.tsx +0 -959
- package/apps/mobile/src/components/ComposerUsageLimits.tsx +0 -167
- package/apps/mobile/src/components/SelectionSheet.tsx +0 -466
- package/apps/mobile/src/components/StatusLine.tsx +0 -52
- package/apps/mobile/src/components/ToolBlock.tsx +0 -67
- package/apps/mobile/src/components/TypingIndicator.tsx +0 -64
- package/apps/mobile/src/components/VoiceRecordingWaveform.tsx +0 -181
- package/apps/mobile/src/components/WorkspacePickerModal.tsx +0 -812
- package/apps/mobile/src/components/__tests__/chat-input-layout.test.ts +0 -35
- package/apps/mobile/src/components/__tests__/chatImageSource.test.ts +0 -44
- package/apps/mobile/src/components/__tests__/composerUsageLimits.test.ts +0 -138
- package/apps/mobile/src/components/__tests__/voiceWaveform.test.ts +0 -31
- package/apps/mobile/src/components/chat-input-layout.ts +0 -59
- package/apps/mobile/src/components/chatImageSource.ts +0 -86
- package/apps/mobile/src/components/usageLimitBadges.ts +0 -109
- package/apps/mobile/src/components/voiceWaveform.ts +0 -46
- package/apps/mobile/src/config.ts +0 -64
- package/apps/mobile/src/hooks/useVoiceRecorder.ts +0 -271
- package/apps/mobile/src/navigation/DrawerContent.tsx +0 -1129
- package/apps/mobile/src/navigation/__tests__/chatThreadTree.test.ts +0 -89
- package/apps/mobile/src/navigation/__tests__/drawerChats.test.ts +0 -65
- package/apps/mobile/src/navigation/chatThreadTree.ts +0 -191
- package/apps/mobile/src/navigation/drawerChats.ts +0 -9
- package/apps/mobile/src/screens/GitScreen.tsx +0 -1489
- package/apps/mobile/src/screens/MainScreen.tsx +0 -10511
- package/apps/mobile/src/screens/OnboardingScreen.tsx +0 -1746
- package/apps/mobile/src/screens/PrivacyScreen.tsx +0 -196
- package/apps/mobile/src/screens/SettingsScreen.tsx +0 -870
- package/apps/mobile/src/screens/TerminalScreen.tsx +0 -248
- package/apps/mobile/src/screens/TermsScreen.tsx +0 -192
- package/apps/mobile/src/screens/__tests__/agentThreadDisplay.test.ts +0 -80
- package/apps/mobile/src/screens/__tests__/agentThreads.test.ts +0 -170
- package/apps/mobile/src/screens/__tests__/gitDiff.test.ts +0 -131
- package/apps/mobile/src/screens/__tests__/planCardState.test.ts +0 -88
- package/apps/mobile/src/screens/__tests__/subAgentTranscript.test.ts +0 -102
- package/apps/mobile/src/screens/__tests__/transcriptMessages.test.ts +0 -97
- package/apps/mobile/src/screens/agentThreadDisplay.ts +0 -261
- package/apps/mobile/src/screens/agentThreads.ts +0 -167
- package/apps/mobile/src/screens/gitDiff.ts +0 -380
- package/apps/mobile/src/screens/planCardState.ts +0 -40
- package/apps/mobile/src/screens/subAgentTranscript.ts +0 -149
- package/apps/mobile/src/screens/transcriptMessages.ts +0 -102
- package/apps/mobile/src/theme.ts +0 -106
- package/apps/mobile/src/types/assets.d.ts +0 -4
- package/apps/mobile/tsconfig.json +0 -33
- package/docs/app-review-notes.md +0 -116
- package/docs/codex-app-server-cli-gap-tracker.md +0 -90
- package/docs/eas-builds.md +0 -91
- package/docs/open-source-license-requirements.md +0 -32
- package/docs/plans/2026-02-20-codex-desktop-style-redesign.md +0 -190
- package/docs/plans/2026-02-20-codex-mobile-implementation.md +0 -1630
- package/docs/plans/2026-02-21-codex-ui-redesign-design.md +0 -101
- package/docs/plans/2026-02-21-codex-ui-redesign.md +0 -1229
- package/docs/privacy-policy.md +0 -54
- package/docs/realtime-streaming-limitations.md +0 -161
- package/docs/terms-of-service.md +0 -33
- package/docs/voice-transcription.md +0 -87
- package/scripts/codex-live-demo.sh +0 -69
- package/scripts/start-bridge-secure.sh +0 -5
- package/scripts/start-expo.sh +0 -176
- package/scripts/sync-versions.js +0 -63
- package/scripts/teardown.sh +0 -136
- package/services/mac-bridge/.env.example +0 -10
- package/services/mac-bridge/codex-types/AbsolutePathBuf.ts +0 -14
- package/services/mac-bridge/codex-types/AddConversationListenerParams.ts +0 -6
- package/services/mac-bridge/codex-types/AddConversationSubscriptionResponse.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageContent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageContentDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentMessageItem.ts +0 -21
- package/services/mac-bridge/codex-types/AgentReasoningDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentReasoningEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentReasoningRawContentDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentReasoningRawContentEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentReasoningSectionBreakEvent.ts +0 -5
- package/services/mac-bridge/codex-types/AgentStatus.ts +0 -8
- package/services/mac-bridge/codex-types/ApplyPatchApprovalParams.ts +0 -21
- package/services/mac-bridge/codex-types/ApplyPatchApprovalRequestEvent.ts +0 -23
- package/services/mac-bridge/codex-types/ApplyPatchApprovalResponse.ts +0 -6
- package/services/mac-bridge/codex-types/ArchiveConversationParams.ts +0 -6
- package/services/mac-bridge/codex-types/ArchiveConversationResponse.ts +0 -5
- package/services/mac-bridge/codex-types/AskForApproval.ts +0 -9
- package/services/mac-bridge/codex-types/AuthMode.ts +0 -8
- package/services/mac-bridge/codex-types/AuthStatusChangeNotification.ts +0 -9
- package/services/mac-bridge/codex-types/BackgroundEventEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ByteRange.ts +0 -13
- package/services/mac-bridge/codex-types/CallToolResult.ts +0 -9
- package/services/mac-bridge/codex-types/CancelLoginChatGptParams.ts +0 -5
- package/services/mac-bridge/codex-types/CancelLoginChatGptResponse.ts +0 -5
- package/services/mac-bridge/codex-types/ClientInfo.ts +0 -5
- package/services/mac-bridge/codex-types/ClientNotification.ts +0 -5
- package/services/mac-bridge/codex-types/ClientRequest.ts +0 -60
- package/services/mac-bridge/codex-types/CodexErrorInfo.ts +0 -8
- package/services/mac-bridge/codex-types/CollabAgentInteractionBeginEvent.ts +0 -23
- package/services/mac-bridge/codex-types/CollabAgentInteractionEndEvent.ts +0 -28
- package/services/mac-bridge/codex-types/CollabAgentSpawnBeginEvent.ts +0 -19
- package/services/mac-bridge/codex-types/CollabAgentSpawnEndEvent.ts +0 -28
- package/services/mac-bridge/codex-types/CollabCloseBeginEvent.ts +0 -18
- package/services/mac-bridge/codex-types/CollabCloseEndEvent.ts +0 -24
- package/services/mac-bridge/codex-types/CollabResumeBeginEvent.ts +0 -18
- package/services/mac-bridge/codex-types/CollabResumeEndEvent.ts +0 -24
- package/services/mac-bridge/codex-types/CollabWaitingBeginEvent.ts +0 -18
- package/services/mac-bridge/codex-types/CollabWaitingEndEvent.ts +0 -19
- package/services/mac-bridge/codex-types/CollaborationMode.ts +0 -10
- package/services/mac-bridge/codex-types/CollaborationModeMask.ts +0 -11
- package/services/mac-bridge/codex-types/ContentItem.ts +0 -5
- package/services/mac-bridge/codex-types/ContextCompactedEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ContextCompactionItem.ts +0 -5
- package/services/mac-bridge/codex-types/ConversationGitInfo.ts +0 -5
- package/services/mac-bridge/codex-types/ConversationSummary.ts +0 -8
- package/services/mac-bridge/codex-types/CreditsSnapshot.ts +0 -5
- package/services/mac-bridge/codex-types/CustomPrompt.ts +0 -5
- package/services/mac-bridge/codex-types/DeprecationNoticeEvent.ts +0 -13
- package/services/mac-bridge/codex-types/DynamicToolCallRequest.ts +0 -6
- package/services/mac-bridge/codex-types/ElicitationRequestEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ErrorEvent.ts +0 -6
- package/services/mac-bridge/codex-types/EventMsg.ts +0 -78
- package/services/mac-bridge/codex-types/ExecApprovalRequestEvent.ts +0 -44
- package/services/mac-bridge/codex-types/ExecCommandApprovalParams.ts +0 -16
- package/services/mac-bridge/codex-types/ExecCommandApprovalResponse.ts +0 -6
- package/services/mac-bridge/codex-types/ExecCommandBeginEvent.ts +0 -35
- package/services/mac-bridge/codex-types/ExecCommandEndEvent.ts +0 -64
- package/services/mac-bridge/codex-types/ExecCommandOutputDeltaEvent.ts +0 -18
- package/services/mac-bridge/codex-types/ExecCommandSource.ts +0 -5
- package/services/mac-bridge/codex-types/ExecCommandStatus.ts +0 -5
- package/services/mac-bridge/codex-types/ExecOneOffCommandParams.ts +0 -6
- package/services/mac-bridge/codex-types/ExecOneOffCommandResponse.ts +0 -5
- package/services/mac-bridge/codex-types/ExecOutputStream.ts +0 -5
- package/services/mac-bridge/codex-types/ExecPolicyAmendment.ts +0 -12
- package/services/mac-bridge/codex-types/ExitedReviewModeEvent.ts +0 -6
- package/services/mac-bridge/codex-types/FileChange.ts +0 -5
- package/services/mac-bridge/codex-types/ForcedLoginMethod.ts +0 -5
- package/services/mac-bridge/codex-types/ForkConversationParams.ts +0 -7
- package/services/mac-bridge/codex-types/ForkConversationResponse.ts +0 -7
- package/services/mac-bridge/codex-types/FunctionCallOutputBody.ts +0 -6
- package/services/mac-bridge/codex-types/FunctionCallOutputContentItem.ts +0 -9
- package/services/mac-bridge/codex-types/FunctionCallOutputPayload.ts +0 -12
- package/services/mac-bridge/codex-types/FuzzyFileSearchParams.ts +0 -5
- package/services/mac-bridge/codex-types/FuzzyFileSearchResponse.ts +0 -6
- package/services/mac-bridge/codex-types/FuzzyFileSearchResult.ts +0 -8
- package/services/mac-bridge/codex-types/FuzzyFileSearchSessionCompletedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/FuzzyFileSearchSessionUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/GetAuthStatusParams.ts +0 -5
- package/services/mac-bridge/codex-types/GetAuthStatusResponse.ts +0 -6
- package/services/mac-bridge/codex-types/GetConversationSummaryParams.ts +0 -6
- package/services/mac-bridge/codex-types/GetConversationSummaryResponse.ts +0 -6
- package/services/mac-bridge/codex-types/GetHistoryEntryResponseEvent.ts +0 -10
- package/services/mac-bridge/codex-types/GetUserAgentResponse.ts +0 -5
- package/services/mac-bridge/codex-types/GetUserSavedConfigResponse.ts +0 -6
- package/services/mac-bridge/codex-types/GhostCommit.ts +0 -8
- package/services/mac-bridge/codex-types/GitDiffToRemoteParams.ts +0 -5
- package/services/mac-bridge/codex-types/GitDiffToRemoteResponse.ts +0 -6
- package/services/mac-bridge/codex-types/GitSha.ts +0 -5
- package/services/mac-bridge/codex-types/HistoryEntry.ts +0 -5
- package/services/mac-bridge/codex-types/InitializeCapabilities.ts +0 -17
- package/services/mac-bridge/codex-types/InitializeParams.ts +0 -7
- package/services/mac-bridge/codex-types/InitializeResponse.ts +0 -5
- package/services/mac-bridge/codex-types/InputItem.ts +0 -10
- package/services/mac-bridge/codex-types/InputModality.ts +0 -8
- package/services/mac-bridge/codex-types/InterruptConversationParams.ts +0 -6
- package/services/mac-bridge/codex-types/InterruptConversationResponse.ts +0 -6
- package/services/mac-bridge/codex-types/ItemCompletedEvent.ts +0 -7
- package/services/mac-bridge/codex-types/ItemStartedEvent.ts +0 -7
- package/services/mac-bridge/codex-types/ListConversationsParams.ts +0 -5
- package/services/mac-bridge/codex-types/ListConversationsResponse.ts +0 -6
- package/services/mac-bridge/codex-types/ListCustomPromptsResponseEvent.ts +0 -9
- package/services/mac-bridge/codex-types/ListRemoteSkillsResponseEvent.ts +0 -9
- package/services/mac-bridge/codex-types/ListSkillsResponseEvent.ts +0 -9
- package/services/mac-bridge/codex-types/LocalShellAction.ts +0 -6
- package/services/mac-bridge/codex-types/LocalShellExecAction.ts +0 -5
- package/services/mac-bridge/codex-types/LocalShellStatus.ts +0 -5
- package/services/mac-bridge/codex-types/LoginApiKeyParams.ts +0 -5
- package/services/mac-bridge/codex-types/LoginApiKeyResponse.ts +0 -5
- package/services/mac-bridge/codex-types/LoginChatGptCompleteNotification.ts +0 -8
- package/services/mac-bridge/codex-types/LoginChatGptResponse.ts +0 -5
- package/services/mac-bridge/codex-types/LogoutChatGptResponse.ts +0 -5
- package/services/mac-bridge/codex-types/McpAuthStatus.ts +0 -5
- package/services/mac-bridge/codex-types/McpInvocation.ts +0 -18
- package/services/mac-bridge/codex-types/McpListToolsResponseEvent.ts +0 -25
- package/services/mac-bridge/codex-types/McpStartupCompleteEvent.ts +0 -6
- package/services/mac-bridge/codex-types/McpStartupFailure.ts +0 -5
- package/services/mac-bridge/codex-types/McpStartupStatus.ts +0 -5
- package/services/mac-bridge/codex-types/McpStartupUpdateEvent.ts +0 -14
- package/services/mac-bridge/codex-types/McpToolCallBeginEvent.ts +0 -10
- package/services/mac-bridge/codex-types/McpToolCallEndEvent.ts +0 -15
- package/services/mac-bridge/codex-types/MessagePhase.ts +0 -11
- package/services/mac-bridge/codex-types/ModeKind.ts +0 -8
- package/services/mac-bridge/codex-types/ModelRerouteEvent.ts +0 -6
- package/services/mac-bridge/codex-types/ModelRerouteReason.ts +0 -5
- package/services/mac-bridge/codex-types/NetworkAccess.ts +0 -8
- package/services/mac-bridge/codex-types/NetworkApprovalContext.ts +0 -6
- package/services/mac-bridge/codex-types/NetworkApprovalProtocol.ts +0 -5
- package/services/mac-bridge/codex-types/NewConversationParams.ts +0 -8
- package/services/mac-bridge/codex-types/NewConversationResponse.ts +0 -7
- package/services/mac-bridge/codex-types/ParsedCommand.ts +0 -12
- package/services/mac-bridge/codex-types/PatchApplyBeginEvent.ts +0 -23
- package/services/mac-bridge/codex-types/PatchApplyEndEvent.ts +0 -36
- package/services/mac-bridge/codex-types/PatchApplyStatus.ts +0 -5
- package/services/mac-bridge/codex-types/Personality.ts +0 -5
- package/services/mac-bridge/codex-types/PlanDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/PlanItem.ts +0 -5
- package/services/mac-bridge/codex-types/PlanItemArg.ts +0 -6
- package/services/mac-bridge/codex-types/PlanType.ts +0 -5
- package/services/mac-bridge/codex-types/Profile.ts +0 -9
- package/services/mac-bridge/codex-types/RateLimitSnapshot.ts +0 -8
- package/services/mac-bridge/codex-types/RateLimitWindow.ts +0 -17
- package/services/mac-bridge/codex-types/RawResponseItemEvent.ts +0 -6
- package/services/mac-bridge/codex-types/ReadOnlyAccess.ts +0 -19
- package/services/mac-bridge/codex-types/ReasoningContentDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningEffort.ts +0 -8
- package/services/mac-bridge/codex-types/ReasoningItem.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningItemContent.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningItemReasoningSummary.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningRawContentDeltaEvent.ts +0 -5
- package/services/mac-bridge/codex-types/ReasoningSummary.ts +0 -10
- package/services/mac-bridge/codex-types/RemoteSkillDownloadedEvent.ts +0 -8
- package/services/mac-bridge/codex-types/RemoteSkillSummary.ts +0 -5
- package/services/mac-bridge/codex-types/RemoveConversationListenerParams.ts +0 -5
- package/services/mac-bridge/codex-types/RemoveConversationSubscriptionResponse.ts +0 -5
- package/services/mac-bridge/codex-types/RequestId.ts +0 -5
- package/services/mac-bridge/codex-types/RequestUserInputEvent.ts +0 -15
- package/services/mac-bridge/codex-types/RequestUserInputQuestion.ts +0 -6
- package/services/mac-bridge/codex-types/RequestUserInputQuestionOption.ts +0 -5
- package/services/mac-bridge/codex-types/Resource.ts +0 -9
- package/services/mac-bridge/codex-types/ResourceTemplate.ts +0 -9
- package/services/mac-bridge/codex-types/ResponseItem.ts +0 -18
- package/services/mac-bridge/codex-types/ResumeConversationParams.ts +0 -8
- package/services/mac-bridge/codex-types/ResumeConversationResponse.ts +0 -7
- package/services/mac-bridge/codex-types/ReviewCodeLocation.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewDecision.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewFinding.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewLineRange.ts +0 -8
- package/services/mac-bridge/codex-types/ReviewOutputEvent.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewRequest.ts +0 -9
- package/services/mac-bridge/codex-types/ReviewTarget.ts +0 -9
- package/services/mac-bridge/codex-types/SandboxMode.ts +0 -5
- package/services/mac-bridge/codex-types/SandboxPolicy.ts +0 -44
- package/services/mac-bridge/codex-types/SandboxSettings.ts +0 -6
- package/services/mac-bridge/codex-types/SendUserMessageParams.ts +0 -7
- package/services/mac-bridge/codex-types/SendUserMessageResponse.ts +0 -5
- package/services/mac-bridge/codex-types/SendUserTurnParams.ts +0 -16
- package/services/mac-bridge/codex-types/SendUserTurnResponse.ts +0 -5
- package/services/mac-bridge/codex-types/ServerNotification.ts +0 -45
- package/services/mac-bridge/codex-types/ServerRequest.ts +0 -16
- package/services/mac-bridge/codex-types/SessionConfiguredEvent.ts +0 -57
- package/services/mac-bridge/codex-types/SessionConfiguredNotification.ts +0 -8
- package/services/mac-bridge/codex-types/SessionNetworkProxyRuntime.ts +0 -5
- package/services/mac-bridge/codex-types/SessionSource.ts +0 -6
- package/services/mac-bridge/codex-types/SetDefaultModelParams.ts +0 -6
- package/services/mac-bridge/codex-types/SetDefaultModelResponse.ts +0 -5
- package/services/mac-bridge/codex-types/Settings.ts +0 -9
- package/services/mac-bridge/codex-types/SkillDependencies.ts +0 -6
- package/services/mac-bridge/codex-types/SkillErrorInfo.ts +0 -5
- package/services/mac-bridge/codex-types/SkillInterface.ts +0 -5
- package/services/mac-bridge/codex-types/SkillMetadata.ts +0 -12
- package/services/mac-bridge/codex-types/SkillScope.ts +0 -5
- package/services/mac-bridge/codex-types/SkillToolDependency.ts +0 -5
- package/services/mac-bridge/codex-types/SkillsListEntry.ts +0 -7
- package/services/mac-bridge/codex-types/StepStatus.ts +0 -5
- package/services/mac-bridge/codex-types/StreamErrorEvent.ts +0 -12
- package/services/mac-bridge/codex-types/SubAgentSource.ts +0 -6
- package/services/mac-bridge/codex-types/TerminalInteractionEvent.ts +0 -17
- package/services/mac-bridge/codex-types/TextElement.ts +0 -14
- package/services/mac-bridge/codex-types/ThreadId.ts +0 -5
- package/services/mac-bridge/codex-types/ThreadNameUpdatedEvent.ts +0 -6
- package/services/mac-bridge/codex-types/ThreadRolledBackEvent.ts +0 -9
- package/services/mac-bridge/codex-types/TokenCountEvent.ts +0 -7
- package/services/mac-bridge/codex-types/TokenUsage.ts +0 -5
- package/services/mac-bridge/codex-types/TokenUsageInfo.ts +0 -6
- package/services/mac-bridge/codex-types/Tool.ts +0 -9
- package/services/mac-bridge/codex-types/Tools.ts +0 -5
- package/services/mac-bridge/codex-types/TurnAbortReason.ts +0 -5
- package/services/mac-bridge/codex-types/TurnAbortedEvent.ts +0 -6
- package/services/mac-bridge/codex-types/TurnCompleteEvent.ts +0 -5
- package/services/mac-bridge/codex-types/TurnDiffEvent.ts +0 -5
- package/services/mac-bridge/codex-types/TurnItem.ts +0 -11
- package/services/mac-bridge/codex-types/TurnStartedEvent.ts +0 -6
- package/services/mac-bridge/codex-types/UndoCompletedEvent.ts +0 -5
- package/services/mac-bridge/codex-types/UndoStartedEvent.ts +0 -5
- package/services/mac-bridge/codex-types/UpdatePlanArgs.ts +0 -10
- package/services/mac-bridge/codex-types/UserInfoResponse.ts +0 -5
- package/services/mac-bridge/codex-types/UserInput.ts +0 -16
- package/services/mac-bridge/codex-types/UserMessageEvent.ts +0 -22
- package/services/mac-bridge/codex-types/UserMessageItem.ts +0 -6
- package/services/mac-bridge/codex-types/UserSavedConfig.ts +0 -14
- package/services/mac-bridge/codex-types/Verbosity.ts +0 -9
- package/services/mac-bridge/codex-types/ViewImageToolCallEvent.ts +0 -13
- package/services/mac-bridge/codex-types/WarningEvent.ts +0 -5
- package/services/mac-bridge/codex-types/WebSearchAction.ts +0 -5
- package/services/mac-bridge/codex-types/WebSearchBeginEvent.ts +0 -5
- package/services/mac-bridge/codex-types/WebSearchEndEvent.ts +0 -6
- package/services/mac-bridge/codex-types/WebSearchItem.ts +0 -6
- package/services/mac-bridge/codex-types/WebSearchMode.ts +0 -5
- package/services/mac-bridge/codex-types/index.ts +0 -234
- package/services/mac-bridge/codex-types/serde_json/JsonValue.ts +0 -5
- package/services/mac-bridge/codex-types/v2/Account.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AccountLoginCompletedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AccountRateLimitsUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AccountUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AgentMessageDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AnalyticsConfig.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AppBranding.ts +0 -8
- package/services/mac-bridge/codex-types/v2/AppDisabledReason.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AppInfo.ts +0 -19
- package/services/mac-bridge/codex-types/v2/AppListUpdatedNotification.ts +0 -9
- package/services/mac-bridge/codex-types/v2/AppMetadata.ts +0 -7
- package/services/mac-bridge/codex-types/v2/AppReview.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AppScreenshot.ts +0 -5
- package/services/mac-bridge/codex-types/v2/AppsConfig.ts +0 -6
- package/services/mac-bridge/codex-types/v2/AppsListParams.ts +0 -24
- package/services/mac-bridge/codex-types/v2/AppsListResponse.ts +0 -14
- package/services/mac-bridge/codex-types/v2/AskForApproval.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ByteRange.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CancelLoginAccountParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CancelLoginAccountResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CancelLoginAccountStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ChatgptAuthTokensRefreshParams.ts +0 -16
- package/services/mac-bridge/codex-types/v2/ChatgptAuthTokensRefreshReason.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ChatgptAuthTokensRefreshResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CodexErrorInfo.ts +0 -11
- package/services/mac-bridge/codex-types/v2/CollabAgentState.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CollabAgentStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CollabAgentTool.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CollabAgentToolCallStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CommandAction.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CommandExecParams.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CommandExecResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CommandExecutionApprovalDecision.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CommandExecutionOutputDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/CommandExecutionRequestApprovalParams.ts +0 -37
- package/services/mac-bridge/codex-types/v2/CommandExecutionRequestApprovalResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/CommandExecutionStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/Config.ts +0 -17
- package/services/mac-bridge/codex-types/v2/ConfigBatchWriteParams.ts +0 -10
- package/services/mac-bridge/codex-types/v2/ConfigEdit.ts +0 -7
- package/services/mac-bridge/codex-types/v2/ConfigLayer.ts +0 -7
- package/services/mac-bridge/codex-types/v2/ConfigLayerMetadata.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ConfigLayerSource.ts +0 -16
- package/services/mac-bridge/codex-types/v2/ConfigReadParams.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ConfigReadResponse.ts +0 -8
- package/services/mac-bridge/codex-types/v2/ConfigRequirements.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ConfigRequirementsReadResponse.ts +0 -10
- package/services/mac-bridge/codex-types/v2/ConfigValueWriteParams.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ConfigWarningNotification.ts +0 -22
- package/services/mac-bridge/codex-types/v2/ConfigWriteResponse.ts +0 -12
- package/services/mac-bridge/codex-types/v2/ContextCompactedNotification.ts +0 -8
- package/services/mac-bridge/codex-types/v2/CreditsSnapshot.ts +0 -5
- package/services/mac-bridge/codex-types/v2/DeprecationNoticeNotification.ts +0 -13
- package/services/mac-bridge/codex-types/v2/DynamicToolCallOutputContentItem.ts +0 -5
- package/services/mac-bridge/codex-types/v2/DynamicToolCallParams.ts +0 -6
- package/services/mac-bridge/codex-types/v2/DynamicToolCallResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/DynamicToolSpec.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ErrorNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ExecPolicyAmendment.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ExperimentalFeature.ts +0 -37
- package/services/mac-bridge/codex-types/v2/ExperimentalFeatureListParams.ts +0 -13
- package/services/mac-bridge/codex-types/v2/ExperimentalFeatureListResponse.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ExperimentalFeatureStage.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FeedbackUploadParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FeedbackUploadResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FileChangeApprovalDecision.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FileChangeOutputDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/FileChangeRequestApprovalParams.ts +0 -14
- package/services/mac-bridge/codex-types/v2/FileChangeRequestApprovalResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/FileUpdateChange.ts +0 -6
- package/services/mac-bridge/codex-types/v2/GetAccountParams.ts +0 -13
- package/services/mac-bridge/codex-types/v2/GetAccountRateLimitsResponse.ts +0 -14
- package/services/mac-bridge/codex-types/v2/GetAccountResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/GitInfo.ts +0 -5
- package/services/mac-bridge/codex-types/v2/HazelnutScope.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ItemCompletedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ItemStartedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ListMcpServerStatusParams.ts +0 -13
- package/services/mac-bridge/codex-types/v2/ListMcpServerStatusResponse.ts +0 -11
- package/services/mac-bridge/codex-types/v2/LoginAccountParams.ts +0 -21
- package/services/mac-bridge/codex-types/v2/LoginAccountResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/LogoutAccountResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpAuthStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerOauthLoginCompletedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerOauthLoginParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerOauthLoginResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerRefreshResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpServerStatus.ts +0 -9
- package/services/mac-bridge/codex-types/v2/McpToolCallError.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpToolCallProgressNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/McpToolCallResult.ts +0 -6
- package/services/mac-bridge/codex-types/v2/McpToolCallStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/MergeStrategy.ts +0 -5
- package/services/mac-bridge/codex-types/v2/Model.ts +0 -8
- package/services/mac-bridge/codex-types/v2/ModelListParams.ts +0 -17
- package/services/mac-bridge/codex-types/v2/ModelListResponse.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ModelRerouteReason.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ModelReroutedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/NetworkAccess.ts +0 -5
- package/services/mac-bridge/codex-types/v2/NetworkRequirements.ts +0 -5
- package/services/mac-bridge/codex-types/v2/OverriddenMetadata.ts +0 -7
- package/services/mac-bridge/codex-types/v2/PatchApplyStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/PatchChangeKind.ts +0 -5
- package/services/mac-bridge/codex-types/v2/PlanDeltaNotification.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ProductSurface.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ProfileV2.ts +0 -11
- package/services/mac-bridge/codex-types/v2/RateLimitSnapshot.ts +0 -8
- package/services/mac-bridge/codex-types/v2/RateLimitWindow.ts +0 -5
- package/services/mac-bridge/codex-types/v2/RawResponseItemCompletedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ReadOnlyAccess.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ReasoningEffortOption.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ReasoningSummaryPartAddedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ReasoningSummaryTextDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ReasoningTextDeltaNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/RemoteSkillSummary.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ResidencyRequirement.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ReviewDelivery.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ReviewStartParams.ts +0 -12
- package/services/mac-bridge/codex-types/v2/ReviewStartResponse.ts +0 -13
- package/services/mac-bridge/codex-types/v2/ReviewTarget.ts +0 -9
- package/services/mac-bridge/codex-types/v2/SandboxMode.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SandboxPolicy.ts +0 -8
- package/services/mac-bridge/codex-types/v2/SandboxWorkspaceWrite.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SessionSource.ts +0 -6
- package/services/mac-bridge/codex-types/v2/SkillDependencies.ts +0 -6
- package/services/mac-bridge/codex-types/v2/SkillErrorInfo.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillInterface.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillMetadata.ts +0 -12
- package/services/mac-bridge/codex-types/v2/SkillScope.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillToolDependency.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsConfigWriteParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsConfigWriteResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsListEntry.ts +0 -7
- package/services/mac-bridge/codex-types/v2/SkillsListExtraRootsForCwd.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsListParams.ts +0 -18
- package/services/mac-bridge/codex-types/v2/SkillsListResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/SkillsRemoteReadParams.ts +0 -7
- package/services/mac-bridge/codex-types/v2/SkillsRemoteReadResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/SkillsRemoteWriteParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/SkillsRemoteWriteResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TerminalInteractionNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TextElement.ts +0 -14
- package/services/mac-bridge/codex-types/v2/TextPosition.ts +0 -13
- package/services/mac-bridge/codex-types/v2/TextRange.ts +0 -6
- package/services/mac-bridge/codex-types/v2/Thread.ts +0 -51
- package/services/mac-bridge/codex-types/v2/ThreadArchiveParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadArchiveResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadArchivedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadCompactStartParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadCompactStartResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadForkParams.ts +0 -28
- package/services/mac-bridge/codex-types/v2/ThreadForkResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ThreadItem.ts +0 -81
- package/services/mac-bridge/codex-types/v2/ThreadListParams.ts +0 -39
- package/services/mac-bridge/codex-types/v2/ThreadListResponse.ts +0 -11
- package/services/mac-bridge/codex-types/v2/ThreadLoadedListParams.ts +0 -13
- package/services/mac-bridge/codex-types/v2/ThreadLoadedListResponse.ts +0 -14
- package/services/mac-bridge/codex-types/v2/ThreadNameUpdatedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadReadParams.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ThreadReadResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadResumeParams.ts +0 -37
- package/services/mac-bridge/codex-types/v2/ThreadResumeResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ThreadRollbackParams.ts +0 -12
- package/services/mac-bridge/codex-types/v2/ThreadRollbackResponse.ts +0 -14
- package/services/mac-bridge/codex-types/v2/ThreadSetNameParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadSetNameResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadSortKey.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadSourceKind.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadStartParams.ts +0 -17
- package/services/mac-bridge/codex-types/v2/ThreadStartResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ThreadStartedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadTokenUsage.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadTokenUsageUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadUnarchiveParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ThreadUnarchiveResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/ThreadUnarchivedNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TokenUsageBreakdown.ts +0 -5
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputAnswer.ts +0 -8
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputOption.ts +0 -8
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputParams.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputQuestion.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ToolRequestUserInputResponse.ts +0 -9
- package/services/mac-bridge/codex-types/v2/ToolsV2.ts +0 -5
- package/services/mac-bridge/codex-types/v2/Turn.ts +0 -18
- package/services/mac-bridge/codex-types/v2/TurnCompletedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnDiffUpdatedNotification.ts +0 -9
- package/services/mac-bridge/codex-types/v2/TurnError.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnInterruptParams.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TurnInterruptResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TurnPlanStep.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnPlanStepStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TurnPlanUpdatedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnStartParams.ts +0 -44
- package/services/mac-bridge/codex-types/v2/TurnStartResponse.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnStartedNotification.ts +0 -6
- package/services/mac-bridge/codex-types/v2/TurnStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/TurnSteerParams.ts +0 -11
- package/services/mac-bridge/codex-types/v2/TurnSteerResponse.ts +0 -5
- package/services/mac-bridge/codex-types/v2/UserInput.ts +0 -10
- package/services/mac-bridge/codex-types/v2/WebSearchAction.ts +0 -5
- package/services/mac-bridge/codex-types/v2/WindowsWorldWritableWarningNotification.ts +0 -5
- package/services/mac-bridge/codex-types/v2/WriteStatus.ts +0 -5
- package/services/mac-bridge/codex-types/v2/index.ts +0 -204
- package/services/mac-bridge/eslint.config.cjs +0 -22
- package/services/mac-bridge/package.json +0 -30
- package/services/mac-bridge/schema.ts +0 -0
- package/services/mac-bridge/src/index.ts +0 -18
- package/services/mac-bridge/src/server.ts +0 -426
- package/services/mac-bridge/src/services/__tests__/gitService.test.ts +0 -157
- package/services/mac-bridge/src/services/__tests__/realtimeHub.test.ts +0 -116
- package/services/mac-bridge/src/services/__tests__/terminalService.test.ts +0 -51
- package/services/mac-bridge/src/services/codexAppServerClient.ts +0 -507
- package/services/mac-bridge/src/services/codexCliAdapter.ts +0 -622
- package/services/mac-bridge/src/services/gitService.ts +0 -61
- package/services/mac-bridge/src/services/realtimeHub.ts +0 -25
- package/services/mac-bridge/src/services/terminalService.ts +0 -226
- package/services/mac-bridge/src/types.ts +0 -151
- package/services/mac-bridge/src/utils/__tests__/threadMapping.test.ts +0 -397
- package/services/mac-bridge/src/utils/threadMapping.ts +0 -176
- package/services/mac-bridge/tsconfig.json +0 -16
- package/services/mac-bridge/vitest.config.ts +0 -9
- package/services/rust-bridge/.env.example +0 -14
- package/services/rust-bridge/package.json +0 -13
- package/services/rust-bridge/security_best_practices_report.md +0 -24
- package/site/index.html +0 -54
- package/site/privacy/index.html +0 -80
- package/site/styles.css +0 -135
- package/site/support/index.html +0 -51
- package/site/terms/index.html +0 -68
- package/tsconfig.json +0 -4
|
@@ -1,1489 +0,0 @@
|
|
|
1
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ActivityIndicator,
|
|
5
|
-
Pressable,
|
|
6
|
-
ScrollView,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
Text,
|
|
9
|
-
TextInput,
|
|
10
|
-
useWindowDimensions,
|
|
11
|
-
View,
|
|
12
|
-
} from 'react-native';
|
|
13
|
-
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
14
|
-
|
|
15
|
-
import type { HostBridgeApiClient } from '../api/client';
|
|
16
|
-
import type {
|
|
17
|
-
Chat,
|
|
18
|
-
GitDiffResponse,
|
|
19
|
-
GitStatusFile,
|
|
20
|
-
GitStatusResponse,
|
|
21
|
-
} from '../api/types';
|
|
22
|
-
import { colors, radius, spacing, typography } from '../theme';
|
|
23
|
-
import {
|
|
24
|
-
parseUnifiedGitDiff,
|
|
25
|
-
type UnifiedDiffFile,
|
|
26
|
-
} from './gitDiff';
|
|
27
|
-
|
|
28
|
-
interface GitScreenProps {
|
|
29
|
-
api: HostBridgeApiClient;
|
|
30
|
-
chat: Chat;
|
|
31
|
-
onBack: () => void;
|
|
32
|
-
onChatUpdated?: (chat: Chat) => void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function GitScreen({ api, chat, onBack, onChatUpdated }: GitScreenProps) {
|
|
36
|
-
const [activeChat, setActiveChat] = useState(chat);
|
|
37
|
-
const [status, setStatus] = useState<GitStatusResponse | null>(null);
|
|
38
|
-
const [diff, setDiff] = useState<GitDiffResponse | null>(null);
|
|
39
|
-
const [commitMessage, setCommitMessage] = useState('chore: checkpoint');
|
|
40
|
-
const [workspaceDraft, setWorkspaceDraft] = useState(chat.cwd ?? '');
|
|
41
|
-
const [loading, setLoading] = useState(true);
|
|
42
|
-
const [savingWorkspace, setSavingWorkspace] = useState(false);
|
|
43
|
-
const [committing, setCommitting] = useState(false);
|
|
44
|
-
const [pushing, setPushing] = useState(false);
|
|
45
|
-
const [stagingPath, setStagingPath] = useState<string | null>(null);
|
|
46
|
-
const [unstagingPath, setUnstagingPath] = useState<string | null>(null);
|
|
47
|
-
const [stagingAll, setStagingAll] = useState(false);
|
|
48
|
-
const [unstagingAll, setUnstagingAll] = useState(false);
|
|
49
|
-
const [bodyScrollEnabled, setBodyScrollEnabled] = useState(true);
|
|
50
|
-
const [selectedDiffFileId, setSelectedDiffFileId] = useState<string | null>(null);
|
|
51
|
-
const [pendingDiffFileId, setPendingDiffFileId] = useState<string | null>(null);
|
|
52
|
-
const [switchingDiffFile, setSwitchingDiffFile] = useState(false);
|
|
53
|
-
const [error, setError] = useState<string | null>(null);
|
|
54
|
-
const diffSelectionRequestRef = useRef(0);
|
|
55
|
-
const diffSelectionTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
56
|
-
const { height: windowHeight } = useWindowDimensions();
|
|
57
|
-
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
setActiveChat(chat);
|
|
60
|
-
setWorkspaceDraft(chat.cwd ?? '');
|
|
61
|
-
setError(null);
|
|
62
|
-
}, [chat]);
|
|
63
|
-
|
|
64
|
-
const workspaceCwd = useMemo(
|
|
65
|
-
() => activeChat.cwd?.trim() ?? '',
|
|
66
|
-
[activeChat.cwd]
|
|
67
|
-
);
|
|
68
|
-
const requestedCwd = useMemo(() => {
|
|
69
|
-
const draft = workspaceDraft.trim();
|
|
70
|
-
if (draft.length > 0) {
|
|
71
|
-
return draft;
|
|
72
|
-
}
|
|
73
|
-
return workspaceCwd.length > 0 ? workspaceCwd : undefined;
|
|
74
|
-
}, [workspaceCwd, workspaceDraft]);
|
|
75
|
-
const hasWorkspace = Boolean(requestedCwd);
|
|
76
|
-
|
|
77
|
-
const refresh = useCallback(async () => {
|
|
78
|
-
try {
|
|
79
|
-
setLoading(true);
|
|
80
|
-
const [nextStatus, nextDiff] = await Promise.all([
|
|
81
|
-
api.gitStatus(requestedCwd),
|
|
82
|
-
api.gitDiff(requestedCwd),
|
|
83
|
-
]);
|
|
84
|
-
setStatus(nextStatus);
|
|
85
|
-
setDiff(nextDiff);
|
|
86
|
-
setError(null);
|
|
87
|
-
} catch (err) {
|
|
88
|
-
setError((err as Error).message);
|
|
89
|
-
} finally {
|
|
90
|
-
setLoading(false);
|
|
91
|
-
}
|
|
92
|
-
}, [api, requestedCwd]);
|
|
93
|
-
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
setLoading(true);
|
|
96
|
-
void refresh();
|
|
97
|
-
}, [refresh]);
|
|
98
|
-
|
|
99
|
-
const saveWorkspace = useCallback(async () => {
|
|
100
|
-
const nextWorkspace = workspaceDraft.trim();
|
|
101
|
-
if (!nextWorkspace || savingWorkspace) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
setSavingWorkspace(true);
|
|
107
|
-
const updated = await api.setChatWorkspace(activeChat.id, nextWorkspace);
|
|
108
|
-
setActiveChat(updated);
|
|
109
|
-
setWorkspaceDraft(updated.cwd ?? nextWorkspace);
|
|
110
|
-
setError(null);
|
|
111
|
-
onChatUpdated?.(updated);
|
|
112
|
-
} catch (err) {
|
|
113
|
-
setError((err as Error).message);
|
|
114
|
-
} finally {
|
|
115
|
-
setSavingWorkspace(false);
|
|
116
|
-
}
|
|
117
|
-
}, [activeChat.id, api, onChatUpdated, savingWorkspace, workspaceDraft]);
|
|
118
|
-
|
|
119
|
-
const commit = useCallback(async () => {
|
|
120
|
-
const trimmedMessage = commitMessage.trim();
|
|
121
|
-
if (!trimmedMessage) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
try {
|
|
126
|
-
setCommitting(true);
|
|
127
|
-
const result = await api.gitCommit({
|
|
128
|
-
message: trimmedMessage,
|
|
129
|
-
cwd: requestedCwd,
|
|
130
|
-
});
|
|
131
|
-
if (!result.committed) {
|
|
132
|
-
setError(result.stderr || 'Commit failed.');
|
|
133
|
-
} else {
|
|
134
|
-
setError(null);
|
|
135
|
-
}
|
|
136
|
-
await refresh();
|
|
137
|
-
} catch (err) {
|
|
138
|
-
setError((err as Error).message);
|
|
139
|
-
} finally {
|
|
140
|
-
setCommitting(false);
|
|
141
|
-
}
|
|
142
|
-
}, [api, commitMessage, refresh, requestedCwd]);
|
|
143
|
-
|
|
144
|
-
const push = useCallback(async () => {
|
|
145
|
-
try {
|
|
146
|
-
setPushing(true);
|
|
147
|
-
const result = await api.gitPush(requestedCwd);
|
|
148
|
-
if (!result.pushed) {
|
|
149
|
-
setError(result.stderr || 'Push failed.');
|
|
150
|
-
} else {
|
|
151
|
-
setError(null);
|
|
152
|
-
}
|
|
153
|
-
await refresh();
|
|
154
|
-
} catch (err) {
|
|
155
|
-
setError((err as Error).message);
|
|
156
|
-
} finally {
|
|
157
|
-
setPushing(false);
|
|
158
|
-
}
|
|
159
|
-
}, [api, refresh, requestedCwd]);
|
|
160
|
-
|
|
161
|
-
const stageFile = useCallback(
|
|
162
|
-
async (path: string) => {
|
|
163
|
-
if (!path.trim()) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
try {
|
|
168
|
-
setStagingPath(path);
|
|
169
|
-
const result = await api.gitStage({
|
|
170
|
-
path,
|
|
171
|
-
cwd: requestedCwd,
|
|
172
|
-
});
|
|
173
|
-
if (!result.staged) {
|
|
174
|
-
setError(result.stderr || `Failed to stage ${path}.`);
|
|
175
|
-
} else {
|
|
176
|
-
setError(null);
|
|
177
|
-
}
|
|
178
|
-
await refresh();
|
|
179
|
-
} catch (err) {
|
|
180
|
-
setError((err as Error).message);
|
|
181
|
-
} finally {
|
|
182
|
-
setStagingPath((current) => (current === path ? null : current));
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
[api, refresh, requestedCwd]
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
const unstageFile = useCallback(
|
|
189
|
-
async (path: string) => {
|
|
190
|
-
if (!path.trim()) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
try {
|
|
195
|
-
setUnstagingPath(path);
|
|
196
|
-
const result = await api.gitUnstage({
|
|
197
|
-
path,
|
|
198
|
-
cwd: requestedCwd,
|
|
199
|
-
});
|
|
200
|
-
if (!result.unstaged) {
|
|
201
|
-
setError(result.stderr || `Failed to unstage ${path}.`);
|
|
202
|
-
} else {
|
|
203
|
-
setError(null);
|
|
204
|
-
}
|
|
205
|
-
await refresh();
|
|
206
|
-
} catch (err) {
|
|
207
|
-
setError((err as Error).message);
|
|
208
|
-
} finally {
|
|
209
|
-
setUnstagingPath((current) => (current === path ? null : current));
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
[api, refresh, requestedCwd]
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
const stageAll = useCallback(async () => {
|
|
216
|
-
try {
|
|
217
|
-
setStagingAll(true);
|
|
218
|
-
const result = await api.gitStageAll(requestedCwd);
|
|
219
|
-
if (!result.staged) {
|
|
220
|
-
setError(result.stderr || 'Failed to stage all files.');
|
|
221
|
-
} else {
|
|
222
|
-
setError(null);
|
|
223
|
-
}
|
|
224
|
-
await refresh();
|
|
225
|
-
} catch (err) {
|
|
226
|
-
setError((err as Error).message);
|
|
227
|
-
} finally {
|
|
228
|
-
setStagingAll(false);
|
|
229
|
-
}
|
|
230
|
-
}, [api, refresh, requestedCwd]);
|
|
231
|
-
|
|
232
|
-
const unstageAll = useCallback(async () => {
|
|
233
|
-
try {
|
|
234
|
-
setUnstagingAll(true);
|
|
235
|
-
const result = await api.gitUnstageAll(requestedCwd);
|
|
236
|
-
if (!result.unstaged) {
|
|
237
|
-
setError(result.stderr || 'Failed to unstage all files.');
|
|
238
|
-
} else {
|
|
239
|
-
setError(null);
|
|
240
|
-
}
|
|
241
|
-
await refresh();
|
|
242
|
-
} catch (err) {
|
|
243
|
-
setError((err as Error).message);
|
|
244
|
-
} finally {
|
|
245
|
-
setUnstagingAll(false);
|
|
246
|
-
}
|
|
247
|
-
}, [api, refresh, requestedCwd]);
|
|
248
|
-
|
|
249
|
-
const workspaceChanged = workspaceDraft.trim() !== workspaceCwd;
|
|
250
|
-
const commitWorkspaceIfChanged = useCallback(() => {
|
|
251
|
-
if (!workspaceChanged || !workspaceDraft.trim() || savingWorkspace) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
void saveWorkspace();
|
|
256
|
-
}, [saveWorkspace, savingWorkspace, workspaceChanged, workspaceDraft]);
|
|
257
|
-
|
|
258
|
-
const changedFiles = useMemo(() => {
|
|
259
|
-
if (status?.files?.length) {
|
|
260
|
-
return status.files.map(mapStatusFileToChangedEntry);
|
|
261
|
-
}
|
|
262
|
-
return parseChangedFiles(status?.raw ?? '');
|
|
263
|
-
}, [status?.files, status?.raw]);
|
|
264
|
-
const parsedDiff = useMemo(
|
|
265
|
-
() => parseUnifiedGitDiff(diff?.diff ?? ''),
|
|
266
|
-
[diff?.diff]
|
|
267
|
-
);
|
|
268
|
-
const diffStatsByPath = useMemo(() => {
|
|
269
|
-
const map = new Map<string, { additions: number; deletions: number }>();
|
|
270
|
-
for (const file of parsedDiff.files) {
|
|
271
|
-
const stats = {
|
|
272
|
-
additions: file.additions,
|
|
273
|
-
deletions: file.deletions,
|
|
274
|
-
};
|
|
275
|
-
const keys = getDiffFileLookupKeys(file);
|
|
276
|
-
for (const key of keys) {
|
|
277
|
-
map.set(key, stats);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return map;
|
|
281
|
-
}, [parsedDiff.files]);
|
|
282
|
-
const changedFilesWithStats = useMemo(
|
|
283
|
-
() =>
|
|
284
|
-
changedFiles.map((entry) => ({
|
|
285
|
-
...entry,
|
|
286
|
-
stats: diffStatsByPath.get(entry.path) ?? null,
|
|
287
|
-
diffFileId: findDiffFileIdForEntry(entry, parsedDiff.files),
|
|
288
|
-
})),
|
|
289
|
-
[changedFiles, diffStatsByPath, parsedDiff.files]
|
|
290
|
-
);
|
|
291
|
-
const hasChanges = changedFiles.length > 0;
|
|
292
|
-
const hasStagedFiles = useMemo(
|
|
293
|
-
() => changedFiles.some((entry) => entry.staged),
|
|
294
|
-
[changedFiles]
|
|
295
|
-
);
|
|
296
|
-
const hasUnstagedFiles = useMemo(
|
|
297
|
-
() => changedFiles.some((entry) => entry.unstaged),
|
|
298
|
-
[changedFiles]
|
|
299
|
-
);
|
|
300
|
-
const aheadCount = useMemo(
|
|
301
|
-
() => parseAheadCount(status?.raw ?? ''),
|
|
302
|
-
[status?.raw]
|
|
303
|
-
);
|
|
304
|
-
const canPush = aheadCount > 0;
|
|
305
|
-
const selectedDiffFile = useMemo(() => {
|
|
306
|
-
if (parsedDiff.files.length === 0) {
|
|
307
|
-
return null;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
return (
|
|
311
|
-
parsedDiff.files.find((file) => file.id === selectedDiffFileId) ??
|
|
312
|
-
parsedDiff.files[0]
|
|
313
|
-
);
|
|
314
|
-
}, [parsedDiff.files, selectedDiffFileId]);
|
|
315
|
-
const diffFileForView = useMemo(() => {
|
|
316
|
-
if (parsedDiff.files.length === 0) {
|
|
317
|
-
return null;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const targetId = pendingDiffFileId ?? selectedDiffFile?.id ?? parsedDiff.files[0].id;
|
|
321
|
-
return parsedDiff.files.find((file) => file.id === targetId) ?? parsedDiff.files[0];
|
|
322
|
-
}, [parsedDiff.files, pendingDiffFileId, selectedDiffFile]);
|
|
323
|
-
const activeDiffTabId = pendingDiffFileId ?? diffFileForView?.id ?? null;
|
|
324
|
-
const showDiffFileSwitching = switchingDiffFile && Boolean(pendingDiffFileId);
|
|
325
|
-
const filesListMaxHeight = useMemo(() => {
|
|
326
|
-
const proposed = Math.floor(windowHeight * 0.4);
|
|
327
|
-
return Math.max(200, Math.min(360, proposed));
|
|
328
|
-
}, [windowHeight]);
|
|
329
|
-
const diffViewerMaxHeight = useMemo(() => {
|
|
330
|
-
const proposed = Math.floor(windowHeight * 0.5);
|
|
331
|
-
return Math.max(220, Math.min(480, proposed));
|
|
332
|
-
}, [windowHeight]);
|
|
333
|
-
|
|
334
|
-
const disableBodyScroll = useCallback(() => {
|
|
335
|
-
setBodyScrollEnabled((previous) => (previous ? false : previous));
|
|
336
|
-
}, []);
|
|
337
|
-
|
|
338
|
-
const enableBodyScroll = useCallback(() => {
|
|
339
|
-
setBodyScrollEnabled((previous) => (previous ? previous : true));
|
|
340
|
-
}, []);
|
|
341
|
-
|
|
342
|
-
useEffect(() => {
|
|
343
|
-
if ((loading || !hasChanges) && !bodyScrollEnabled) {
|
|
344
|
-
setBodyScrollEnabled(true);
|
|
345
|
-
}
|
|
346
|
-
}, [bodyScrollEnabled, hasChanges, loading]);
|
|
347
|
-
|
|
348
|
-
useEffect(() => {
|
|
349
|
-
if (stagingPath && !changedFiles.some((entry) => entry.stagePath === stagingPath)) {
|
|
350
|
-
setStagingPath(null);
|
|
351
|
-
}
|
|
352
|
-
if (unstagingPath && !changedFiles.some((entry) => entry.stagePath === unstagingPath)) {
|
|
353
|
-
setUnstagingPath(null);
|
|
354
|
-
}
|
|
355
|
-
}, [changedFiles, stagingPath, unstagingPath]);
|
|
356
|
-
|
|
357
|
-
useEffect(() => {
|
|
358
|
-
if (parsedDiff.files.length === 0) {
|
|
359
|
-
if (selectedDiffFileId) {
|
|
360
|
-
setSelectedDiffFileId(null);
|
|
361
|
-
}
|
|
362
|
-
if (pendingDiffFileId) {
|
|
363
|
-
setPendingDiffFileId(null);
|
|
364
|
-
}
|
|
365
|
-
if (switchingDiffFile) {
|
|
366
|
-
setSwitchingDiffFile(false);
|
|
367
|
-
}
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
if (!selectedDiffFileId) {
|
|
372
|
-
setSelectedDiffFileId(parsedDiff.files[0].id);
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
const stillExists = parsedDiff.files.some((file) => file.id === selectedDiffFileId);
|
|
377
|
-
if (!stillExists) {
|
|
378
|
-
setSelectedDiffFileId(parsedDiff.files[0].id);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
if (pendingDiffFileId) {
|
|
382
|
-
const pendingStillExists = parsedDiff.files.some((file) => file.id === pendingDiffFileId);
|
|
383
|
-
if (!pendingStillExists) {
|
|
384
|
-
setPendingDiffFileId(null);
|
|
385
|
-
setSwitchingDiffFile(false);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}, [parsedDiff.files, pendingDiffFileId, selectedDiffFileId, switchingDiffFile]);
|
|
389
|
-
|
|
390
|
-
const selectDiffFile = useCallback(
|
|
391
|
-
(fileId: string) => {
|
|
392
|
-
if (!fileId || fileId === activeDiffTabId) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
diffSelectionRequestRef.current += 1;
|
|
397
|
-
const requestId = diffSelectionRequestRef.current;
|
|
398
|
-
setPendingDiffFileId(fileId);
|
|
399
|
-
setSwitchingDiffFile(true);
|
|
400
|
-
if (diffSelectionTimerRef.current) {
|
|
401
|
-
clearTimeout(diffSelectionTimerRef.current);
|
|
402
|
-
}
|
|
403
|
-
diffSelectionTimerRef.current = setTimeout(() => {
|
|
404
|
-
if (diffSelectionRequestRef.current !== requestId) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
setSelectedDiffFileId(fileId);
|
|
409
|
-
setSwitchingDiffFile(false);
|
|
410
|
-
setPendingDiffFileId(null);
|
|
411
|
-
diffSelectionTimerRef.current = null;
|
|
412
|
-
}, 120);
|
|
413
|
-
},
|
|
414
|
-
[activeDiffTabId]
|
|
415
|
-
);
|
|
416
|
-
|
|
417
|
-
useEffect(() => {
|
|
418
|
-
return () => {
|
|
419
|
-
if (diffSelectionTimerRef.current) {
|
|
420
|
-
clearTimeout(diffSelectionTimerRef.current);
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
}, []);
|
|
424
|
-
|
|
425
|
-
return (
|
|
426
|
-
<SafeAreaView style={styles.container}>
|
|
427
|
-
<View style={styles.header}>
|
|
428
|
-
<Pressable onPress={onBack} hitSlop={8} style={styles.backBtn}>
|
|
429
|
-
<Ionicons name="chevron-back" size={22} color={colors.textPrimary} />
|
|
430
|
-
</Pressable>
|
|
431
|
-
<View style={styles.headerTitles}>
|
|
432
|
-
<Text style={styles.headerTitle}>Git</Text>
|
|
433
|
-
<Text style={styles.headerSubtitle} numberOfLines={1}>
|
|
434
|
-
{activeChat.title || 'Untitled chat'}
|
|
435
|
-
</Text>
|
|
436
|
-
</View>
|
|
437
|
-
<Pressable
|
|
438
|
-
onPress={() => void refresh()}
|
|
439
|
-
hitSlop={8}
|
|
440
|
-
style={({ pressed }) => [
|
|
441
|
-
styles.refreshBtn,
|
|
442
|
-
pressed && styles.refreshBtnPressed,
|
|
443
|
-
loading && styles.refreshBtnDisabled,
|
|
444
|
-
]}
|
|
445
|
-
disabled={loading}
|
|
446
|
-
>
|
|
447
|
-
<Ionicons name="refresh" size={16} color={colors.textMuted} />
|
|
448
|
-
</Pressable>
|
|
449
|
-
</View>
|
|
450
|
-
|
|
451
|
-
<ScrollView
|
|
452
|
-
style={styles.body}
|
|
453
|
-
contentContainerStyle={styles.bodyContent}
|
|
454
|
-
scrollEnabled={bodyScrollEnabled}
|
|
455
|
-
nestedScrollEnabled
|
|
456
|
-
keyboardShouldPersistTaps="handled"
|
|
457
|
-
>
|
|
458
|
-
<View style={styles.card}>
|
|
459
|
-
<Text style={styles.sectionLabel}>Workspace</Text>
|
|
460
|
-
<TextInput
|
|
461
|
-
style={styles.input}
|
|
462
|
-
value={workspaceDraft}
|
|
463
|
-
onChangeText={setWorkspaceDraft}
|
|
464
|
-
keyboardAppearance="dark"
|
|
465
|
-
onSubmitEditing={commitWorkspaceIfChanged}
|
|
466
|
-
onBlur={commitWorkspaceIfChanged}
|
|
467
|
-
placeholder="/path/to/project"
|
|
468
|
-
placeholderTextColor={colors.textMuted}
|
|
469
|
-
autoCapitalize="none"
|
|
470
|
-
autoCorrect={false}
|
|
471
|
-
returnKeyType="done"
|
|
472
|
-
editable={!savingWorkspace}
|
|
473
|
-
/>
|
|
474
|
-
|
|
475
|
-
{hasWorkspace ? (
|
|
476
|
-
<Text style={styles.metaText}>{requestedCwd}</Text>
|
|
477
|
-
) : (
|
|
478
|
-
<Text style={styles.warningText}>Using bridge root workspace.</Text>
|
|
479
|
-
)}
|
|
480
|
-
{savingWorkspace ? (
|
|
481
|
-
<Text style={styles.metaText}>Saving workspace...</Text>
|
|
482
|
-
) : null}
|
|
483
|
-
</View>
|
|
484
|
-
|
|
485
|
-
{loading ? (
|
|
486
|
-
<ActivityIndicator color={colors.textPrimary} style={styles.loader} />
|
|
487
|
-
) : (
|
|
488
|
-
<>
|
|
489
|
-
<View style={styles.card}>
|
|
490
|
-
<View style={styles.infoRow}>
|
|
491
|
-
<Text style={styles.infoLabel}>Branch</Text>
|
|
492
|
-
<Text style={styles.infoValue}>{status?.branch ?? '—'}</Text>
|
|
493
|
-
</View>
|
|
494
|
-
<View style={styles.separator} />
|
|
495
|
-
<View style={styles.infoRow}>
|
|
496
|
-
<Text style={styles.infoLabel}>Status</Text>
|
|
497
|
-
<Text
|
|
498
|
-
style={[styles.infoValue, status?.clean ? styles.clean : styles.dirty]}
|
|
499
|
-
>
|
|
500
|
-
{status?.clean ? 'clean' : 'changes'}
|
|
501
|
-
</Text>
|
|
502
|
-
</View>
|
|
503
|
-
{canPush ? (
|
|
504
|
-
<>
|
|
505
|
-
<View style={styles.separator} />
|
|
506
|
-
<View style={styles.infoRow}>
|
|
507
|
-
<Text style={styles.infoLabel}>Ahead</Text>
|
|
508
|
-
<Text style={styles.infoValue}>{aheadCount}</Text>
|
|
509
|
-
</View>
|
|
510
|
-
</>
|
|
511
|
-
) : null}
|
|
512
|
-
</View>
|
|
513
|
-
|
|
514
|
-
<Text style={styles.sectionLabel}>Commit message</Text>
|
|
515
|
-
<TextInput
|
|
516
|
-
style={styles.input}
|
|
517
|
-
value={commitMessage}
|
|
518
|
-
onChangeText={setCommitMessage}
|
|
519
|
-
keyboardAppearance="dark"
|
|
520
|
-
placeholder="Commit message..."
|
|
521
|
-
placeholderTextColor={colors.textMuted}
|
|
522
|
-
/>
|
|
523
|
-
|
|
524
|
-
<Pressable
|
|
525
|
-
onPress={() => void commit()}
|
|
526
|
-
disabled={committing || !commitMessage.trim() || !hasChanges}
|
|
527
|
-
style={({ pressed }) => [
|
|
528
|
-
styles.actionBtn,
|
|
529
|
-
pressed && styles.actionBtnPressed,
|
|
530
|
-
(committing || !commitMessage.trim() || !hasChanges) &&
|
|
531
|
-
styles.actionBtnDisabled,
|
|
532
|
-
]}
|
|
533
|
-
>
|
|
534
|
-
<Text style={styles.actionBtnText}>
|
|
535
|
-
{committing ? 'Committing...' : 'Commit'}
|
|
536
|
-
</Text>
|
|
537
|
-
</Pressable>
|
|
538
|
-
|
|
539
|
-
{canPush ? (
|
|
540
|
-
<Pressable
|
|
541
|
-
onPress={() => void push()}
|
|
542
|
-
disabled={pushing || committing || loading}
|
|
543
|
-
style={({ pressed }) => [
|
|
544
|
-
styles.actionBtn,
|
|
545
|
-
styles.pushBtn,
|
|
546
|
-
pressed && styles.actionBtnPressed,
|
|
547
|
-
(pushing || committing || loading) && styles.actionBtnDisabled,
|
|
548
|
-
]}
|
|
549
|
-
>
|
|
550
|
-
<Text style={styles.actionBtnText}>
|
|
551
|
-
{pushing ? 'Pushing...' : `Push (${aheadCount})`}
|
|
552
|
-
</Text>
|
|
553
|
-
</Pressable>
|
|
554
|
-
) : null}
|
|
555
|
-
|
|
556
|
-
<View style={styles.filesHeaderRow}>
|
|
557
|
-
<Text style={[styles.sectionLabel, styles.sectionLabelResetMargin]}>
|
|
558
|
-
{hasChanges ? `Changed files (${changedFiles.length})` : 'Changed files'}
|
|
559
|
-
</Text>
|
|
560
|
-
{hasChanges ? (
|
|
561
|
-
<View style={styles.filesHeaderActions}>
|
|
562
|
-
{hasUnstagedFiles ? (
|
|
563
|
-
<Pressable
|
|
564
|
-
onPress={() => void stageAll()}
|
|
565
|
-
disabled={
|
|
566
|
-
loading ||
|
|
567
|
-
committing ||
|
|
568
|
-
pushing ||
|
|
569
|
-
stagingAll ||
|
|
570
|
-
unstagingAll ||
|
|
571
|
-
Boolean(stagingPath) ||
|
|
572
|
-
Boolean(unstagingPath)
|
|
573
|
-
}
|
|
574
|
-
style={({ pressed }) => [
|
|
575
|
-
styles.bulkActionBtn,
|
|
576
|
-
styles.bulkActionBtnStage,
|
|
577
|
-
pressed && styles.fileActionBtnPressed,
|
|
578
|
-
(loading ||
|
|
579
|
-
committing ||
|
|
580
|
-
pushing ||
|
|
581
|
-
stagingAll ||
|
|
582
|
-
unstagingAll ||
|
|
583
|
-
Boolean(stagingPath) ||
|
|
584
|
-
Boolean(unstagingPath)) &&
|
|
585
|
-
styles.fileActionBtnDisabled,
|
|
586
|
-
]}
|
|
587
|
-
>
|
|
588
|
-
<Text style={styles.bulkActionText}>
|
|
589
|
-
{stagingAll ? 'Staging all...' : 'Stage all'}
|
|
590
|
-
</Text>
|
|
591
|
-
</Pressable>
|
|
592
|
-
) : null}
|
|
593
|
-
{hasStagedFiles ? (
|
|
594
|
-
<Pressable
|
|
595
|
-
onPress={() => void unstageAll()}
|
|
596
|
-
disabled={
|
|
597
|
-
loading ||
|
|
598
|
-
committing ||
|
|
599
|
-
pushing ||
|
|
600
|
-
unstagingAll ||
|
|
601
|
-
stagingAll ||
|
|
602
|
-
Boolean(stagingPath) ||
|
|
603
|
-
Boolean(unstagingPath)
|
|
604
|
-
}
|
|
605
|
-
style={({ pressed }) => [
|
|
606
|
-
styles.bulkActionBtn,
|
|
607
|
-
styles.bulkActionBtnUnstage,
|
|
608
|
-
pressed && styles.fileActionBtnPressed,
|
|
609
|
-
(loading ||
|
|
610
|
-
committing ||
|
|
611
|
-
pushing ||
|
|
612
|
-
unstagingAll ||
|
|
613
|
-
stagingAll ||
|
|
614
|
-
Boolean(stagingPath) ||
|
|
615
|
-
Boolean(unstagingPath)) &&
|
|
616
|
-
styles.fileActionBtnDisabled,
|
|
617
|
-
]}
|
|
618
|
-
>
|
|
619
|
-
<Text style={styles.bulkActionText}>
|
|
620
|
-
{unstagingAll ? 'Unstaging all...' : 'Unstage all'}
|
|
621
|
-
</Text>
|
|
622
|
-
</Pressable>
|
|
623
|
-
) : null}
|
|
624
|
-
</View>
|
|
625
|
-
) : null}
|
|
626
|
-
</View>
|
|
627
|
-
<View style={styles.filesCard}>
|
|
628
|
-
{changedFiles.length === 0 ? (
|
|
629
|
-
<Text style={styles.emptyFilesText}>No changes.</Text>
|
|
630
|
-
) : (
|
|
631
|
-
<ScrollView
|
|
632
|
-
style={[styles.filesScroll, { maxHeight: filesListMaxHeight }]}
|
|
633
|
-
contentContainerStyle={styles.filesScrollContent}
|
|
634
|
-
showsVerticalScrollIndicator
|
|
635
|
-
nestedScrollEnabled
|
|
636
|
-
keyboardShouldPersistTaps="handled"
|
|
637
|
-
onTouchStart={disableBodyScroll}
|
|
638
|
-
onTouchCancel={enableBodyScroll}
|
|
639
|
-
onTouchEnd={enableBodyScroll}
|
|
640
|
-
onScrollBeginDrag={disableBodyScroll}
|
|
641
|
-
onScrollEndDrag={enableBodyScroll}
|
|
642
|
-
onMomentumScrollEnd={enableBodyScroll}
|
|
643
|
-
>
|
|
644
|
-
{changedFilesWithStats.map((entry) => (
|
|
645
|
-
<View key={`${entry.code}:${entry.path}`} style={styles.fileRow}>
|
|
646
|
-
<Text style={styles.fileCode}>{formatStatusCode(entry.code)}</Text>
|
|
647
|
-
{entry.diffFileId ? (
|
|
648
|
-
<Pressable
|
|
649
|
-
style={styles.filePathPressable}
|
|
650
|
-
onPress={() => {
|
|
651
|
-
if (entry.diffFileId) {
|
|
652
|
-
selectDiffFile(entry.diffFileId);
|
|
653
|
-
}
|
|
654
|
-
}}
|
|
655
|
-
disabled={switchingDiffFile}
|
|
656
|
-
>
|
|
657
|
-
<Text
|
|
658
|
-
style={[
|
|
659
|
-
styles.filePath,
|
|
660
|
-
styles.filePathInteractive,
|
|
661
|
-
switchingDiffFile && styles.filePathDisabled,
|
|
662
|
-
]}
|
|
663
|
-
>
|
|
664
|
-
{entry.path}
|
|
665
|
-
</Text>
|
|
666
|
-
</Pressable>
|
|
667
|
-
) : (
|
|
668
|
-
<Text style={styles.filePath}>
|
|
669
|
-
{entry.path}
|
|
670
|
-
</Text>
|
|
671
|
-
)}
|
|
672
|
-
{entry.stats ? (
|
|
673
|
-
<View style={styles.fileStats}>
|
|
674
|
-
<Text style={styles.fileAdded}>+{entry.stats.additions}</Text>
|
|
675
|
-
<Text style={styles.fileRemoved}>-{entry.stats.deletions}</Text>
|
|
676
|
-
</View>
|
|
677
|
-
) : null}
|
|
678
|
-
<View style={styles.fileActions}>
|
|
679
|
-
{entry.unstaged ? (
|
|
680
|
-
<Pressable
|
|
681
|
-
onPress={() => void stageFile(entry.stagePath)}
|
|
682
|
-
disabled={
|
|
683
|
-
loading ||
|
|
684
|
-
committing ||
|
|
685
|
-
pushing ||
|
|
686
|
-
stagingAll ||
|
|
687
|
-
unstagingAll ||
|
|
688
|
-
stagingPath === entry.stagePath ||
|
|
689
|
-
unstagingPath === entry.stagePath
|
|
690
|
-
}
|
|
691
|
-
style={({ pressed }) => [
|
|
692
|
-
styles.fileActionBtn,
|
|
693
|
-
styles.fileActionBtnStage,
|
|
694
|
-
pressed && styles.fileActionBtnPressed,
|
|
695
|
-
(loading ||
|
|
696
|
-
committing ||
|
|
697
|
-
pushing ||
|
|
698
|
-
stagingAll ||
|
|
699
|
-
unstagingAll ||
|
|
700
|
-
stagingPath === entry.stagePath ||
|
|
701
|
-
unstagingPath === entry.stagePath) &&
|
|
702
|
-
styles.fileActionBtnDisabled,
|
|
703
|
-
]}
|
|
704
|
-
>
|
|
705
|
-
<Text style={styles.fileActionText}>
|
|
706
|
-
{stagingPath === entry.stagePath ? 'Staging...' : 'Stage'}
|
|
707
|
-
</Text>
|
|
708
|
-
</Pressable>
|
|
709
|
-
) : null}
|
|
710
|
-
{entry.staged ? (
|
|
711
|
-
<Pressable
|
|
712
|
-
onPress={() => void unstageFile(entry.stagePath)}
|
|
713
|
-
disabled={
|
|
714
|
-
loading ||
|
|
715
|
-
committing ||
|
|
716
|
-
pushing ||
|
|
717
|
-
stagingAll ||
|
|
718
|
-
unstagingAll ||
|
|
719
|
-
unstagingPath === entry.stagePath ||
|
|
720
|
-
stagingPath === entry.stagePath
|
|
721
|
-
}
|
|
722
|
-
style={({ pressed }) => [
|
|
723
|
-
styles.fileActionBtn,
|
|
724
|
-
styles.fileActionBtnUnstage,
|
|
725
|
-
pressed && styles.fileActionBtnPressed,
|
|
726
|
-
(loading ||
|
|
727
|
-
committing ||
|
|
728
|
-
pushing ||
|
|
729
|
-
stagingAll ||
|
|
730
|
-
unstagingAll ||
|
|
731
|
-
unstagingPath === entry.stagePath ||
|
|
732
|
-
stagingPath === entry.stagePath) &&
|
|
733
|
-
styles.fileActionBtnDisabled,
|
|
734
|
-
]}
|
|
735
|
-
>
|
|
736
|
-
<Text style={styles.fileActionText}>
|
|
737
|
-
{unstagingPath === entry.stagePath
|
|
738
|
-
? 'Unstaging...'
|
|
739
|
-
: 'Unstage'}
|
|
740
|
-
</Text>
|
|
741
|
-
</Pressable>
|
|
742
|
-
) : null}
|
|
743
|
-
</View>
|
|
744
|
-
</View>
|
|
745
|
-
))}
|
|
746
|
-
</ScrollView>
|
|
747
|
-
)}
|
|
748
|
-
</View>
|
|
749
|
-
|
|
750
|
-
<Text style={styles.sectionLabel}>Diff summary</Text>
|
|
751
|
-
<View style={styles.diffSummaryRow}>
|
|
752
|
-
<View style={styles.diffSummaryPill}>
|
|
753
|
-
<Text style={styles.diffSummaryLabel}>Files</Text>
|
|
754
|
-
<Text style={styles.diffSummaryValue}>{parsedDiff.files.length}</Text>
|
|
755
|
-
</View>
|
|
756
|
-
<View style={styles.diffSummaryPill}>
|
|
757
|
-
<Text style={styles.diffSummaryLabel}>Added</Text>
|
|
758
|
-
<Text style={[styles.diffSummaryValue, styles.fileAdded]}>
|
|
759
|
-
+{parsedDiff.totalAdditions}
|
|
760
|
-
</Text>
|
|
761
|
-
</View>
|
|
762
|
-
<View style={styles.diffSummaryPill}>
|
|
763
|
-
<Text style={styles.diffSummaryLabel}>Removed</Text>
|
|
764
|
-
<Text style={[styles.diffSummaryValue, styles.fileRemoved]}>
|
|
765
|
-
-{parsedDiff.totalDeletions}
|
|
766
|
-
</Text>
|
|
767
|
-
</View>
|
|
768
|
-
</View>
|
|
769
|
-
|
|
770
|
-
<Text style={styles.sectionLabel}>Unified diff</Text>
|
|
771
|
-
<View style={styles.diffCard}>
|
|
772
|
-
{parsedDiff.files.length === 0 ? (
|
|
773
|
-
<Text style={styles.emptyFilesText}>
|
|
774
|
-
{hasChanges
|
|
775
|
-
? 'No patch output for current changes yet (likely untracked files only).'
|
|
776
|
-
: 'No diff to show.'}
|
|
777
|
-
</Text>
|
|
778
|
-
) : (
|
|
779
|
-
<>
|
|
780
|
-
<ScrollView
|
|
781
|
-
horizontal
|
|
782
|
-
style={styles.diffTabsScroll}
|
|
783
|
-
contentContainerStyle={styles.diffTabsContent}
|
|
784
|
-
showsHorizontalScrollIndicator={false}
|
|
785
|
-
nestedScrollEnabled
|
|
786
|
-
keyboardShouldPersistTaps="handled"
|
|
787
|
-
onTouchStart={disableBodyScroll}
|
|
788
|
-
onTouchCancel={enableBodyScroll}
|
|
789
|
-
onTouchEnd={enableBodyScroll}
|
|
790
|
-
>
|
|
791
|
-
{parsedDiff.files.map((file) => {
|
|
792
|
-
const selected = file.id === activeDiffTabId;
|
|
793
|
-
return (
|
|
794
|
-
<Pressable
|
|
795
|
-
key={file.id}
|
|
796
|
-
onPress={() => selectDiffFile(file.id)}
|
|
797
|
-
style={({ pressed }) => [
|
|
798
|
-
styles.diffTab,
|
|
799
|
-
selected && styles.diffTabActive,
|
|
800
|
-
pressed && styles.diffTabPressed,
|
|
801
|
-
]}
|
|
802
|
-
>
|
|
803
|
-
<Text style={styles.diffTabTitle}>
|
|
804
|
-
{file.displayPath}
|
|
805
|
-
</Text>
|
|
806
|
-
<View style={styles.diffTabStats}>
|
|
807
|
-
<Text style={styles.fileAdded}>+{file.additions}</Text>
|
|
808
|
-
<Text style={styles.fileRemoved}>-{file.deletions}</Text>
|
|
809
|
-
</View>
|
|
810
|
-
</Pressable>
|
|
811
|
-
);
|
|
812
|
-
})}
|
|
813
|
-
</ScrollView>
|
|
814
|
-
|
|
815
|
-
{diffFileForView ? (
|
|
816
|
-
<>
|
|
817
|
-
<View style={styles.diffFileHeader}>
|
|
818
|
-
<Text style={styles.diffFilePath}>
|
|
819
|
-
{diffFileForView.displayPath}
|
|
820
|
-
</Text>
|
|
821
|
-
<Text style={styles.diffFileStatus}>{diffFileForView.status}</Text>
|
|
822
|
-
</View>
|
|
823
|
-
|
|
824
|
-
{showDiffFileSwitching ? (
|
|
825
|
-
<View style={styles.diffLoadingContainer}>
|
|
826
|
-
<ActivityIndicator color={colors.textPrimary} size="small" />
|
|
827
|
-
<Text style={styles.diffLoadingText}>Loading diff…</Text>
|
|
828
|
-
</View>
|
|
829
|
-
) : diffFileForView.hunks.length === 0 ? (
|
|
830
|
-
<Text style={styles.emptyFilesText}>
|
|
831
|
-
No textual hunks available for this file.
|
|
832
|
-
</Text>
|
|
833
|
-
) : (
|
|
834
|
-
<ScrollView
|
|
835
|
-
style={[styles.diffVerticalScroll, { maxHeight: diffViewerMaxHeight }]}
|
|
836
|
-
contentContainerStyle={styles.diffVerticalContent}
|
|
837
|
-
showsVerticalScrollIndicator
|
|
838
|
-
nestedScrollEnabled
|
|
839
|
-
keyboardShouldPersistTaps="handled"
|
|
840
|
-
onTouchStart={disableBodyScroll}
|
|
841
|
-
onTouchCancel={enableBodyScroll}
|
|
842
|
-
onTouchEnd={enableBodyScroll}
|
|
843
|
-
onScrollBeginDrag={disableBodyScroll}
|
|
844
|
-
onScrollEndDrag={enableBodyScroll}
|
|
845
|
-
onMomentumScrollEnd={enableBodyScroll}
|
|
846
|
-
>
|
|
847
|
-
<ScrollView
|
|
848
|
-
horizontal
|
|
849
|
-
showsHorizontalScrollIndicator
|
|
850
|
-
nestedScrollEnabled
|
|
851
|
-
keyboardShouldPersistTaps="handled"
|
|
852
|
-
onTouchStart={disableBodyScroll}
|
|
853
|
-
onTouchCancel={enableBodyScroll}
|
|
854
|
-
onTouchEnd={enableBodyScroll}
|
|
855
|
-
>
|
|
856
|
-
<View style={styles.diffLines}>
|
|
857
|
-
{diffFileForView.hunks.map((hunk) => (
|
|
858
|
-
<View
|
|
859
|
-
key={`${hunk.header}:${hunk.oldStart}:${hunk.newStart}`}
|
|
860
|
-
style={styles.hunkBlock}
|
|
861
|
-
>
|
|
862
|
-
<Text style={styles.hunkHeader}>{hunk.header}</Text>
|
|
863
|
-
{hunk.lines.map((line, lineIndex) => (
|
|
864
|
-
<View
|
|
865
|
-
key={`${hunk.header}:${lineIndex}`}
|
|
866
|
-
style={[
|
|
867
|
-
styles.diffLineRow,
|
|
868
|
-
line.kind === 'add' && styles.diffLineRowAdd,
|
|
869
|
-
line.kind === 'remove' && styles.diffLineRowRemove,
|
|
870
|
-
line.kind === 'meta' && styles.diffLineRowMeta,
|
|
871
|
-
]}
|
|
872
|
-
>
|
|
873
|
-
<Text style={styles.diffLineNumber}>
|
|
874
|
-
{formatDiffLineNumber(line.oldLineNumber)}
|
|
875
|
-
</Text>
|
|
876
|
-
<Text style={styles.diffLineNumber}>
|
|
877
|
-
{formatDiffLineNumber(line.newLineNumber)}
|
|
878
|
-
</Text>
|
|
879
|
-
<Text
|
|
880
|
-
style={[
|
|
881
|
-
styles.diffLinePrefix,
|
|
882
|
-
line.kind === 'add' && styles.diffLinePrefixAdd,
|
|
883
|
-
line.kind === 'remove' && styles.diffLinePrefixRemove,
|
|
884
|
-
line.kind === 'meta' && styles.diffLinePrefixMeta,
|
|
885
|
-
]}
|
|
886
|
-
>
|
|
887
|
-
{line.prefix}
|
|
888
|
-
</Text>
|
|
889
|
-
<Text selectable style={styles.diffLineText}>
|
|
890
|
-
{line.content || ' '}
|
|
891
|
-
</Text>
|
|
892
|
-
</View>
|
|
893
|
-
))}
|
|
894
|
-
</View>
|
|
895
|
-
))}
|
|
896
|
-
</View>
|
|
897
|
-
</ScrollView>
|
|
898
|
-
</ScrollView>
|
|
899
|
-
)}
|
|
900
|
-
</>
|
|
901
|
-
) : null}
|
|
902
|
-
</>
|
|
903
|
-
)}
|
|
904
|
-
</View>
|
|
905
|
-
</>
|
|
906
|
-
)}
|
|
907
|
-
|
|
908
|
-
{error ? <Text style={styles.errorText}>{error}</Text> : null}
|
|
909
|
-
</ScrollView>
|
|
910
|
-
</SafeAreaView>
|
|
911
|
-
);
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
const styles = StyleSheet.create({
|
|
915
|
-
container: {
|
|
916
|
-
flex: 1,
|
|
917
|
-
backgroundColor: colors.bgMain,
|
|
918
|
-
},
|
|
919
|
-
header: {
|
|
920
|
-
flexDirection: 'row',
|
|
921
|
-
alignItems: 'center',
|
|
922
|
-
gap: spacing.sm,
|
|
923
|
-
paddingHorizontal: spacing.lg,
|
|
924
|
-
paddingVertical: spacing.md,
|
|
925
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
926
|
-
borderBottomColor: colors.borderLight,
|
|
927
|
-
},
|
|
928
|
-
backBtn: {
|
|
929
|
-
padding: spacing.xs,
|
|
930
|
-
},
|
|
931
|
-
headerTitles: {
|
|
932
|
-
flex: 1,
|
|
933
|
-
},
|
|
934
|
-
headerTitle: {
|
|
935
|
-
...typography.headline,
|
|
936
|
-
color: colors.textPrimary,
|
|
937
|
-
},
|
|
938
|
-
headerSubtitle: {
|
|
939
|
-
...typography.caption,
|
|
940
|
-
color: colors.textMuted,
|
|
941
|
-
},
|
|
942
|
-
refreshBtn: {
|
|
943
|
-
padding: spacing.xs,
|
|
944
|
-
borderRadius: radius.full,
|
|
945
|
-
},
|
|
946
|
-
refreshBtnPressed: {
|
|
947
|
-
backgroundColor: colors.bgItem,
|
|
948
|
-
},
|
|
949
|
-
refreshBtnDisabled: {
|
|
950
|
-
opacity: 0.4,
|
|
951
|
-
},
|
|
952
|
-
body: {
|
|
953
|
-
flex: 1,
|
|
954
|
-
},
|
|
955
|
-
bodyContent: {
|
|
956
|
-
padding: spacing.lg,
|
|
957
|
-
gap: spacing.md,
|
|
958
|
-
},
|
|
959
|
-
loader: {
|
|
960
|
-
marginTop: spacing.lg,
|
|
961
|
-
},
|
|
962
|
-
card: {
|
|
963
|
-
borderRadius: radius.md,
|
|
964
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
965
|
-
borderColor: colors.borderLight,
|
|
966
|
-
padding: spacing.md,
|
|
967
|
-
backgroundColor: colors.bgItem,
|
|
968
|
-
gap: spacing.sm,
|
|
969
|
-
},
|
|
970
|
-
sectionLabel: {
|
|
971
|
-
...typography.caption,
|
|
972
|
-
textTransform: 'uppercase',
|
|
973
|
-
letterSpacing: 0.7,
|
|
974
|
-
marginTop: spacing.sm,
|
|
975
|
-
marginBottom: spacing.xs,
|
|
976
|
-
},
|
|
977
|
-
sectionLabelResetMargin: {
|
|
978
|
-
marginTop: 0,
|
|
979
|
-
marginBottom: 0,
|
|
980
|
-
},
|
|
981
|
-
input: {
|
|
982
|
-
backgroundColor: colors.bgInput,
|
|
983
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
984
|
-
borderColor: colors.borderLight,
|
|
985
|
-
borderRadius: radius.md,
|
|
986
|
-
paddingHorizontal: spacing.lg,
|
|
987
|
-
paddingVertical: spacing.md,
|
|
988
|
-
color: colors.textPrimary,
|
|
989
|
-
fontSize: 15,
|
|
990
|
-
},
|
|
991
|
-
actionBtn: {
|
|
992
|
-
backgroundColor: colors.accent,
|
|
993
|
-
borderRadius: radius.md,
|
|
994
|
-
paddingVertical: spacing.md,
|
|
995
|
-
alignItems: 'center',
|
|
996
|
-
marginTop: spacing.sm,
|
|
997
|
-
},
|
|
998
|
-
actionBtnPressed: {
|
|
999
|
-
backgroundColor: colors.accentPressed,
|
|
1000
|
-
},
|
|
1001
|
-
actionBtnDisabled: {
|
|
1002
|
-
backgroundColor: colors.bgInput,
|
|
1003
|
-
opacity: 0.6,
|
|
1004
|
-
},
|
|
1005
|
-
pushBtn: {
|
|
1006
|
-
marginTop: spacing.xs,
|
|
1007
|
-
},
|
|
1008
|
-
actionBtnText: {
|
|
1009
|
-
...typography.headline,
|
|
1010
|
-
color: colors.black,
|
|
1011
|
-
fontSize: 15,
|
|
1012
|
-
},
|
|
1013
|
-
metaText: {
|
|
1014
|
-
...typography.caption,
|
|
1015
|
-
color: colors.textSecondary,
|
|
1016
|
-
},
|
|
1017
|
-
warningText: {
|
|
1018
|
-
...typography.caption,
|
|
1019
|
-
color: colors.textMuted,
|
|
1020
|
-
},
|
|
1021
|
-
infoRow: {
|
|
1022
|
-
flexDirection: 'row',
|
|
1023
|
-
justifyContent: 'space-between',
|
|
1024
|
-
alignItems: 'center',
|
|
1025
|
-
paddingVertical: spacing.sm,
|
|
1026
|
-
},
|
|
1027
|
-
separator: {
|
|
1028
|
-
height: StyleSheet.hairlineWidth,
|
|
1029
|
-
backgroundColor: colors.borderLight,
|
|
1030
|
-
},
|
|
1031
|
-
infoLabel: {
|
|
1032
|
-
...typography.body,
|
|
1033
|
-
color: colors.textMuted,
|
|
1034
|
-
},
|
|
1035
|
-
infoValue: {
|
|
1036
|
-
...typography.body,
|
|
1037
|
-
fontWeight: '600',
|
|
1038
|
-
color: colors.textPrimary,
|
|
1039
|
-
},
|
|
1040
|
-
clean: {
|
|
1041
|
-
color: colors.statusComplete,
|
|
1042
|
-
},
|
|
1043
|
-
dirty: {
|
|
1044
|
-
color: colors.statusError,
|
|
1045
|
-
},
|
|
1046
|
-
filesCard: {
|
|
1047
|
-
backgroundColor: colors.bgItem,
|
|
1048
|
-
borderRadius: radius.md,
|
|
1049
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
1050
|
-
borderColor: colors.borderLight,
|
|
1051
|
-
overflow: 'hidden',
|
|
1052
|
-
},
|
|
1053
|
-
filesHeaderRow: {
|
|
1054
|
-
flexDirection: 'row',
|
|
1055
|
-
alignItems: 'center',
|
|
1056
|
-
justifyContent: 'space-between',
|
|
1057
|
-
gap: spacing.sm,
|
|
1058
|
-
marginTop: spacing.sm,
|
|
1059
|
-
},
|
|
1060
|
-
filesHeaderActions: {
|
|
1061
|
-
flexDirection: 'row',
|
|
1062
|
-
alignItems: 'center',
|
|
1063
|
-
gap: spacing.xs,
|
|
1064
|
-
},
|
|
1065
|
-
filesScroll: {
|
|
1066
|
-
minHeight: 56,
|
|
1067
|
-
},
|
|
1068
|
-
filesScrollContent: {
|
|
1069
|
-
paddingVertical: spacing.xs,
|
|
1070
|
-
},
|
|
1071
|
-
fileRow: {
|
|
1072
|
-
flexDirection: 'row',
|
|
1073
|
-
alignItems: 'flex-start',
|
|
1074
|
-
gap: spacing.sm,
|
|
1075
|
-
paddingHorizontal: spacing.md,
|
|
1076
|
-
paddingVertical: spacing.sm,
|
|
1077
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
1078
|
-
borderTopColor: colors.borderLight,
|
|
1079
|
-
},
|
|
1080
|
-
fileCode: {
|
|
1081
|
-
...typography.mono,
|
|
1082
|
-
color: colors.textMuted,
|
|
1083
|
-
width: 24,
|
|
1084
|
-
fontSize: 12,
|
|
1085
|
-
lineHeight: 18,
|
|
1086
|
-
},
|
|
1087
|
-
filePath: {
|
|
1088
|
-
...typography.body,
|
|
1089
|
-
color: colors.textSecondary,
|
|
1090
|
-
flex: 1,
|
|
1091
|
-
flexShrink: 1,
|
|
1092
|
-
lineHeight: 18,
|
|
1093
|
-
},
|
|
1094
|
-
filePathPressable: {
|
|
1095
|
-
flex: 1,
|
|
1096
|
-
},
|
|
1097
|
-
filePathInteractive: {
|
|
1098
|
-
color: colors.textPrimary,
|
|
1099
|
-
},
|
|
1100
|
-
filePathDisabled: {
|
|
1101
|
-
opacity: 0.6,
|
|
1102
|
-
},
|
|
1103
|
-
fileStats: {
|
|
1104
|
-
flexDirection: 'row',
|
|
1105
|
-
alignItems: 'center',
|
|
1106
|
-
gap: spacing.xs,
|
|
1107
|
-
marginLeft: spacing.sm,
|
|
1108
|
-
},
|
|
1109
|
-
fileActions: {
|
|
1110
|
-
flexDirection: 'row',
|
|
1111
|
-
alignItems: 'center',
|
|
1112
|
-
gap: spacing.xs,
|
|
1113
|
-
marginLeft: spacing.sm,
|
|
1114
|
-
},
|
|
1115
|
-
fileActionBtn: {
|
|
1116
|
-
borderRadius: radius.sm,
|
|
1117
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
1118
|
-
paddingHorizontal: spacing.sm,
|
|
1119
|
-
paddingVertical: 6,
|
|
1120
|
-
},
|
|
1121
|
-
fileActionBtnStage: {
|
|
1122
|
-
borderColor: 'rgba(136, 218, 149, 0.45)',
|
|
1123
|
-
backgroundColor: 'rgba(86, 182, 92, 0.16)',
|
|
1124
|
-
},
|
|
1125
|
-
fileActionBtnUnstage: {
|
|
1126
|
-
borderColor: 'rgba(242, 155, 155, 0.45)',
|
|
1127
|
-
backgroundColor: 'rgba(239, 68, 68, 0.16)',
|
|
1128
|
-
},
|
|
1129
|
-
fileActionBtnPressed: {
|
|
1130
|
-
opacity: 0.8,
|
|
1131
|
-
},
|
|
1132
|
-
fileActionBtnDisabled: {
|
|
1133
|
-
opacity: 0.55,
|
|
1134
|
-
},
|
|
1135
|
-
fileActionText: {
|
|
1136
|
-
...typography.caption,
|
|
1137
|
-
color: colors.textPrimary,
|
|
1138
|
-
fontWeight: '600',
|
|
1139
|
-
},
|
|
1140
|
-
bulkActionBtn: {
|
|
1141
|
-
borderRadius: radius.sm,
|
|
1142
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
1143
|
-
paddingHorizontal: spacing.sm,
|
|
1144
|
-
paddingVertical: 7,
|
|
1145
|
-
},
|
|
1146
|
-
bulkActionBtnStage: {
|
|
1147
|
-
borderColor: 'rgba(136, 218, 149, 0.5)',
|
|
1148
|
-
backgroundColor: 'rgba(86, 182, 92, 0.2)',
|
|
1149
|
-
},
|
|
1150
|
-
bulkActionBtnUnstage: {
|
|
1151
|
-
borderColor: 'rgba(242, 155, 155, 0.5)',
|
|
1152
|
-
backgroundColor: 'rgba(239, 68, 68, 0.2)',
|
|
1153
|
-
},
|
|
1154
|
-
bulkActionText: {
|
|
1155
|
-
...typography.caption,
|
|
1156
|
-
color: colors.textPrimary,
|
|
1157
|
-
fontWeight: '600',
|
|
1158
|
-
},
|
|
1159
|
-
fileAdded: {
|
|
1160
|
-
...typography.mono,
|
|
1161
|
-
color: '#88DA95',
|
|
1162
|
-
fontSize: 12,
|
|
1163
|
-
},
|
|
1164
|
-
fileRemoved: {
|
|
1165
|
-
...typography.mono,
|
|
1166
|
-
color: '#F29B9B',
|
|
1167
|
-
fontSize: 12,
|
|
1168
|
-
},
|
|
1169
|
-
diffSummaryRow: {
|
|
1170
|
-
flexDirection: 'row',
|
|
1171
|
-
gap: spacing.sm,
|
|
1172
|
-
},
|
|
1173
|
-
diffSummaryPill: {
|
|
1174
|
-
flex: 1,
|
|
1175
|
-
backgroundColor: colors.bgItem,
|
|
1176
|
-
borderRadius: radius.md,
|
|
1177
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
1178
|
-
borderColor: colors.borderLight,
|
|
1179
|
-
paddingHorizontal: spacing.md,
|
|
1180
|
-
paddingVertical: spacing.sm,
|
|
1181
|
-
gap: 2,
|
|
1182
|
-
},
|
|
1183
|
-
diffSummaryLabel: {
|
|
1184
|
-
...typography.caption,
|
|
1185
|
-
color: colors.textMuted,
|
|
1186
|
-
},
|
|
1187
|
-
diffSummaryValue: {
|
|
1188
|
-
...typography.body,
|
|
1189
|
-
fontWeight: '700',
|
|
1190
|
-
color: colors.textPrimary,
|
|
1191
|
-
},
|
|
1192
|
-
diffCard: {
|
|
1193
|
-
backgroundColor: colors.bgItem,
|
|
1194
|
-
borderRadius: radius.md,
|
|
1195
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
1196
|
-
borderColor: colors.borderLight,
|
|
1197
|
-
overflow: 'hidden',
|
|
1198
|
-
},
|
|
1199
|
-
diffTabsScroll: {
|
|
1200
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
1201
|
-
borderBottomColor: colors.borderLight,
|
|
1202
|
-
},
|
|
1203
|
-
diffTabsContent: {
|
|
1204
|
-
paddingHorizontal: spacing.sm,
|
|
1205
|
-
paddingVertical: spacing.sm,
|
|
1206
|
-
gap: spacing.sm,
|
|
1207
|
-
},
|
|
1208
|
-
diffTab: {
|
|
1209
|
-
minWidth: 140,
|
|
1210
|
-
maxWidth: 220,
|
|
1211
|
-
backgroundColor: colors.bgInput,
|
|
1212
|
-
borderRadius: radius.sm,
|
|
1213
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
1214
|
-
borderColor: colors.borderLight,
|
|
1215
|
-
paddingHorizontal: spacing.sm,
|
|
1216
|
-
paddingVertical: spacing.sm,
|
|
1217
|
-
gap: spacing.xs,
|
|
1218
|
-
},
|
|
1219
|
-
diffTabActive: {
|
|
1220
|
-
borderColor: colors.borderHighlight,
|
|
1221
|
-
backgroundColor: 'rgba(255, 255, 255, 0.12)',
|
|
1222
|
-
},
|
|
1223
|
-
diffTabPressed: {
|
|
1224
|
-
opacity: 0.85,
|
|
1225
|
-
},
|
|
1226
|
-
diffTabTitle: {
|
|
1227
|
-
...typography.body,
|
|
1228
|
-
color: colors.textPrimary,
|
|
1229
|
-
flexShrink: 1,
|
|
1230
|
-
fontSize: 13,
|
|
1231
|
-
lineHeight: 18,
|
|
1232
|
-
},
|
|
1233
|
-
diffTabStats: {
|
|
1234
|
-
flexDirection: 'row',
|
|
1235
|
-
alignItems: 'center',
|
|
1236
|
-
gap: spacing.xs,
|
|
1237
|
-
},
|
|
1238
|
-
diffFileHeader: {
|
|
1239
|
-
flexDirection: 'row',
|
|
1240
|
-
alignItems: 'center',
|
|
1241
|
-
gap: spacing.md,
|
|
1242
|
-
justifyContent: 'space-between',
|
|
1243
|
-
paddingHorizontal: spacing.md,
|
|
1244
|
-
paddingVertical: spacing.sm,
|
|
1245
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
1246
|
-
borderBottomColor: colors.borderLight,
|
|
1247
|
-
},
|
|
1248
|
-
diffFilePath: {
|
|
1249
|
-
...typography.body,
|
|
1250
|
-
color: colors.textSecondary,
|
|
1251
|
-
flex: 1,
|
|
1252
|
-
flexShrink: 1,
|
|
1253
|
-
fontSize: 13,
|
|
1254
|
-
lineHeight: 18,
|
|
1255
|
-
},
|
|
1256
|
-
diffFileStatus: {
|
|
1257
|
-
...typography.caption,
|
|
1258
|
-
textTransform: 'uppercase',
|
|
1259
|
-
letterSpacing: 0.5,
|
|
1260
|
-
color: colors.textMuted,
|
|
1261
|
-
},
|
|
1262
|
-
diffLoadingContainer: {
|
|
1263
|
-
minHeight: 120,
|
|
1264
|
-
alignItems: 'center',
|
|
1265
|
-
justifyContent: 'center',
|
|
1266
|
-
paddingHorizontal: spacing.md,
|
|
1267
|
-
paddingVertical: spacing.lg,
|
|
1268
|
-
gap: spacing.sm,
|
|
1269
|
-
},
|
|
1270
|
-
diffLoadingText: {
|
|
1271
|
-
...typography.caption,
|
|
1272
|
-
color: colors.textMuted,
|
|
1273
|
-
},
|
|
1274
|
-
diffVerticalScroll: {
|
|
1275
|
-
minHeight: 120,
|
|
1276
|
-
},
|
|
1277
|
-
diffVerticalContent: {
|
|
1278
|
-
paddingVertical: spacing.sm,
|
|
1279
|
-
},
|
|
1280
|
-
diffLines: {
|
|
1281
|
-
minWidth: '100%',
|
|
1282
|
-
},
|
|
1283
|
-
hunkBlock: {
|
|
1284
|
-
marginBottom: spacing.sm,
|
|
1285
|
-
},
|
|
1286
|
-
hunkHeader: {
|
|
1287
|
-
...typography.mono,
|
|
1288
|
-
color: '#AFC6F7',
|
|
1289
|
-
backgroundColor: 'rgba(175, 198, 247, 0.14)',
|
|
1290
|
-
paddingHorizontal: spacing.md,
|
|
1291
|
-
paddingVertical: spacing.xs,
|
|
1292
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
1293
|
-
borderTopColor: colors.borderLight,
|
|
1294
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
1295
|
-
borderBottomColor: colors.borderLight,
|
|
1296
|
-
},
|
|
1297
|
-
diffLineRow: {
|
|
1298
|
-
flexDirection: 'row',
|
|
1299
|
-
alignItems: 'flex-start',
|
|
1300
|
-
minWidth: '100%',
|
|
1301
|
-
},
|
|
1302
|
-
diffLineRowAdd: {
|
|
1303
|
-
backgroundColor: 'rgba(86, 182, 92, 0.14)',
|
|
1304
|
-
},
|
|
1305
|
-
diffLineRowRemove: {
|
|
1306
|
-
backgroundColor: 'rgba(239, 68, 68, 0.14)',
|
|
1307
|
-
},
|
|
1308
|
-
diffLineRowMeta: {
|
|
1309
|
-
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
|
1310
|
-
},
|
|
1311
|
-
diffLineNumber: {
|
|
1312
|
-
...typography.mono,
|
|
1313
|
-
width: 44,
|
|
1314
|
-
textAlign: 'right',
|
|
1315
|
-
color: colors.textMuted,
|
|
1316
|
-
paddingHorizontal: spacing.xs,
|
|
1317
|
-
paddingVertical: 3,
|
|
1318
|
-
fontSize: 11,
|
|
1319
|
-
lineHeight: 17,
|
|
1320
|
-
},
|
|
1321
|
-
diffLinePrefix: {
|
|
1322
|
-
...typography.mono,
|
|
1323
|
-
width: 16,
|
|
1324
|
-
color: colors.textMuted,
|
|
1325
|
-
paddingVertical: 3,
|
|
1326
|
-
fontSize: 11,
|
|
1327
|
-
lineHeight: 17,
|
|
1328
|
-
},
|
|
1329
|
-
diffLinePrefixAdd: {
|
|
1330
|
-
color: '#88DA95',
|
|
1331
|
-
},
|
|
1332
|
-
diffLinePrefixRemove: {
|
|
1333
|
-
color: '#F29B9B',
|
|
1334
|
-
},
|
|
1335
|
-
diffLinePrefixMeta: {
|
|
1336
|
-
color: '#B8C4D8',
|
|
1337
|
-
},
|
|
1338
|
-
diffLineText: {
|
|
1339
|
-
...typography.mono,
|
|
1340
|
-
color: colors.textPrimary,
|
|
1341
|
-
paddingRight: spacing.md,
|
|
1342
|
-
paddingVertical: 3,
|
|
1343
|
-
fontSize: 12,
|
|
1344
|
-
lineHeight: 17,
|
|
1345
|
-
},
|
|
1346
|
-
emptyFilesText: {
|
|
1347
|
-
...typography.caption,
|
|
1348
|
-
color: colors.textMuted,
|
|
1349
|
-
paddingHorizontal: spacing.md,
|
|
1350
|
-
paddingVertical: spacing.sm,
|
|
1351
|
-
},
|
|
1352
|
-
errorText: {
|
|
1353
|
-
...typography.caption,
|
|
1354
|
-
color: colors.error,
|
|
1355
|
-
marginTop: spacing.xs,
|
|
1356
|
-
},
|
|
1357
|
-
});
|
|
1358
|
-
|
|
1359
|
-
interface ChangedFileEntry {
|
|
1360
|
-
code: string;
|
|
1361
|
-
path: string;
|
|
1362
|
-
stagePath: string;
|
|
1363
|
-
staged: boolean;
|
|
1364
|
-
unstaged: boolean;
|
|
1365
|
-
untracked: boolean;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
function parseChangedFiles(rawStatus: string): ChangedFileEntry[] {
|
|
1369
|
-
const lines = rawStatus
|
|
1370
|
-
.split('\n')
|
|
1371
|
-
.map((line) => line.trimEnd())
|
|
1372
|
-
.filter(Boolean);
|
|
1373
|
-
|
|
1374
|
-
const files: ChangedFileEntry[] = [];
|
|
1375
|
-
for (const line of lines) {
|
|
1376
|
-
if (line.startsWith('## ')) {
|
|
1377
|
-
continue;
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
if (line.length < 3) {
|
|
1381
|
-
continue;
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
const indexStatus = line[0] ?? ' ';
|
|
1385
|
-
const worktreeStatus = line[1] ?? ' ';
|
|
1386
|
-
const code = `${indexStatus}${worktreeStatus}`;
|
|
1387
|
-
const path = line.slice(3).trim();
|
|
1388
|
-
if (!path) {
|
|
1389
|
-
continue;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
const stagePath = extractStagePath(path);
|
|
1393
|
-
const untracked = code === '??';
|
|
1394
|
-
const staged = !untracked && indexStatus !== ' ';
|
|
1395
|
-
const unstaged = untracked || worktreeStatus !== ' ';
|
|
1396
|
-
|
|
1397
|
-
files.push({
|
|
1398
|
-
code,
|
|
1399
|
-
path,
|
|
1400
|
-
stagePath,
|
|
1401
|
-
staged,
|
|
1402
|
-
unstaged,
|
|
1403
|
-
untracked,
|
|
1404
|
-
});
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
return files;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
function mapStatusFileToChangedEntry(file: GitStatusFile): ChangedFileEntry {
|
|
1411
|
-
const displayPath = file.originalPath ? `${file.originalPath} -> ${file.path}` : file.path;
|
|
1412
|
-
return {
|
|
1413
|
-
code: `${file.indexStatus}${file.worktreeStatus}`,
|
|
1414
|
-
path: displayPath,
|
|
1415
|
-
stagePath: file.path,
|
|
1416
|
-
staged: file.staged,
|
|
1417
|
-
unstaged: file.unstaged,
|
|
1418
|
-
untracked: file.untracked,
|
|
1419
|
-
};
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
function parseAheadCount(rawStatus: string): number {
|
|
1423
|
-
const header = rawStatus
|
|
1424
|
-
.split('\n')
|
|
1425
|
-
.map((line) => line.trim())
|
|
1426
|
-
.find((line) => line.startsWith('## '));
|
|
1427
|
-
if (!header) {
|
|
1428
|
-
return 0;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
const match = header.match(/\bahead\s+(\d+)\b/i);
|
|
1432
|
-
if (!match) {
|
|
1433
|
-
return 0;
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
const value = Number.parseInt(match[1], 10);
|
|
1437
|
-
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
function formatDiffLineNumber(value: number | null): string {
|
|
1441
|
-
if (value === null || value <= 0) {
|
|
1442
|
-
return '';
|
|
1443
|
-
}
|
|
1444
|
-
return String(value);
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
function formatStatusCode(code: string): string {
|
|
1448
|
-
if (!code) {
|
|
1449
|
-
return '??';
|
|
1450
|
-
}
|
|
1451
|
-
if (code === '??') {
|
|
1452
|
-
return code;
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
const normalized = code.replace(/ /g, '·');
|
|
1456
|
-
return normalized.trim() ? normalized : '··';
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
function getDiffFileLookupKeys(file: UnifiedDiffFile): string[] {
|
|
1460
|
-
const keys = [file.displayPath, file.oldPath, file.newPath].filter(
|
|
1461
|
-
(value): value is string => Boolean(value)
|
|
1462
|
-
);
|
|
1463
|
-
return Array.from(new Set(keys));
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
function findDiffFileIdForEntry(
|
|
1467
|
-
entry: Pick<ChangedFileEntry, 'path' | 'stagePath'>,
|
|
1468
|
-
files: UnifiedDiffFile[]
|
|
1469
|
-
): string | null {
|
|
1470
|
-
if (files.length === 0) {
|
|
1471
|
-
return null;
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
const lookupCandidates = new Set<string>([entry.path, entry.stagePath]);
|
|
1475
|
-
for (const file of files) {
|
|
1476
|
-
const keys = getDiffFileLookupKeys(file);
|
|
1477
|
-
if (keys.some((key) => lookupCandidates.has(key))) {
|
|
1478
|
-
return file.id;
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
return null;
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
function extractStagePath(path: string): string {
|
|
1486
|
-
const parts = path.split(' -> ');
|
|
1487
|
-
const candidate = parts[parts.length - 1]?.trim() ?? path.trim();
|
|
1488
|
-
return candidate || path.trim();
|
|
1489
|
-
}
|