diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json
index e4e78396958..8df31614436 100644
--- a/config/scripts/ci/sharding/ci-shard-timings.json
+++ b/config/scripts/ci/sharding/ci-shard-timings.json
@@ -6361,8 +6361,7 @@
"src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart.test.ts": 2039,
"src/renderer/src/lib/codex-stale-pane-account-identity.test.ts": 1823,
"src/renderer/src/lib/codex-stale-pane-sweep.test.ts": 1817,
- "src/renderer/src/lib/comment-body-line-count.test.ts": 84,
- "src/renderer/src/lib/comment-body-submit-state.test.ts": 55,
+ "src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.test.ts": 55,
"src/renderer/src/lib/composer-submit-cancellation.test.ts": 41,
"src/renderer/src/lib/workspace/ownership/connection-context.test.ts": 1817,
"src/renderer/src/lib/crash-diagnostics.test.ts": 176,
@@ -6385,9 +6384,9 @@
"src/renderer/src/lib/finished-agent-resume-resurrection.test.ts": 1872,
"src/renderer/src/lib/focus-terminal-tab-surface.split-focus.test.ts": 331,
"src/renderer/src/lib/foreground-terminal-tabs.test.ts": 55,
- "src/renderer/src/lib/github-links.test.ts": 76,
- "src/renderer/src/lib/github-source-runtime-context.test.ts": 62,
- "src/renderer/src/lib/gitlab-links.test.ts": 56,
+ "src/shared/new-workspace/github-links.test.ts": 76,
+ "src/renderer/src/lib/work-items/github/github-source-runtime-context.test.ts": 62,
+ "src/shared/new-workspace/gitlab-links.test.ts": 56,
"src/renderer/src/lib/hook-command-delayed-delivery.test.ts": 1904,
"src/renderer/src/lib/host-chat-program.test.ts": 2419,
"src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts": 1706,
@@ -6415,11 +6414,10 @@
"src/renderer/src/lib/lazy-with-retry.never-landed-reload.test.ts": 194,
"src/renderer/src/lib/lazy-with-retry.preload.test.tsx": 208,
"src/renderer/src/lib/lazy-with-retry.test.ts": 282,
- "src/renderer/src/lib/linear-board-drag-payload.test.ts": 58,
- "src/renderer/src/lib/work-items/linear/linear-issue-context-snapshot.test.ts": 55,
+ "src/renderer/src/lib/work-items/linear/linear-board-drag-payload.test.ts": 58,
"src/renderer/src/lib/work-items/linear/linear-issue-workspace-attachment.test.ts": 99,
"src/renderer/src/lib/link-source-local-open-owner.test.ts": 433,
- "src/renderer/src/lib/linked-work-item-context.test.ts": 64,
+ "src/renderer/src/lib/work-items/linked-work-item-context.test.ts": 64,
"src/renderer/src/lib/editor/monaco/monaco-editor-gutter-disposal.test.ts": 295,
"src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts": 70,
"src/renderer/src/lib/monaco-languages/monarch-embed-entry-recursion.test.ts": 697,
@@ -6510,7 +6508,7 @@
"src/renderer/src/lib/plugin-command-replacements.test.ts": 95,
"src/renderer/src/lib/plugin-icons/plugin-icon-svg.test.ts": 231,
"src/renderer/src/lib/plugin-monaco-token-rules.test.ts": 51,
- "src/renderer/src/lib/pr-bot-author-overrides.test.ts": 349,
+ "src/renderer/src/lib/source-control/review/pr-bot-author-overrides.test.ts": 349,
"src/renderer/src/lib/source-control/review/comments/pr-comment-thread-resolution.test.ts": 48,
"src/renderer/src/lib/project-clone-url-prefill.test.ts": 61,
"src/renderer/src/lib/project-host-workspace-target.jira-mapping.test.ts": 76,
diff --git a/src/renderer/src/components/JiraIssueWorkspace.tsx b/src/renderer/src/components/JiraIssueWorkspace.tsx
index 6740918308b..45cc2029fd4 100644
--- a/src/renderer/src/components/JiraIssueWorkspace.tsx
+++ b/src/renderer/src/components/JiraIssueWorkspace.tsx
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo } from 'react'
import { toast } from 'sonner'
import * as VisuallyHidden from 'radix-ui/visually-hidden'
import { Sheet, SheetContent, SheetDescription, SheetTitle } from '@/components/ui/sheet'
-import { hasBoundedCommentBodyText } from '@/lib/comment-body-submit-state'
+import { hasBoundedCommentBodyText } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { useAppStore } from '@/store'
import {
jiraGetIssueForTarget,
@@ -20,7 +20,7 @@ import { JiraIssueCommentComposer, JiraIssueWorkspaceContent } from './jira-issu
import { useJiraIssueWorkspaceActions } from './jira-issue-workspace-actions'
import { getJiraReadIdentity } from '@/store/slices/jira/jira-read-coordination'
import { defaultScopeHost } from '@/runtime/hosts/selection/default-creation-host'
-import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
+import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import { getEnvironmentRuntimeContextKey } from '@/runtime/hosts/observations/provider-runtime-context'
import { runtimeTargetEnvironmentId } from '@/runtime/rpc/targets/runtime-client-target'
import { editedJiraIssueFields } from './jira-issue-workspace-hydration'
diff --git a/src/renderer/src/components/LinearIssueTextEditor.tsx b/src/renderer/src/components/LinearIssueTextEditor.tsx
index 88cc3851914..110eb89794b 100644
--- a/src/renderer/src/components/LinearIssueTextEditor.tsx
+++ b/src/renderer/src/components/LinearIssueTextEditor.tsx
@@ -1,5 +1,5 @@
import { writeLinearIssue } from '@/lib/work-items/linear/linear-issue-write'
-import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import { ImeTextarea } from '@/lib/text-input/ime/ime-text-field'
import React, { useCallback, useRef, useState } from 'react'
import { LoaderCircle } from 'lucide-react'
diff --git a/src/renderer/src/components/cmd-j/quick-actions.ts b/src/renderer/src/components/cmd-j/quick-actions.ts
index 2925bb5c6cb..f101601efeb 100644
--- a/src/renderer/src/components/cmd-j/quick-actions.ts
+++ b/src/renderer/src/components/cmd-j/quick-actions.ts
@@ -1,4 +1,4 @@
-import { gitGraphSupport, openGitGraph } from '@/lib/git-graph-tab'
+import { gitGraphSupport, openGitGraph } from '@/lib/source-control/graph/git-graph-tab'
import {
GitGraph,
FileText,
diff --git a/src/renderer/src/components/cmd-j/task-search-activation.ts b/src/renderer/src/components/cmd-j/task-search-activation.ts
index 19ab530753b..2b7989e3d56 100644
--- a/src/renderer/src/components/cmd-j/task-search-activation.ts
+++ b/src/renderer/src/components/cmd-j/task-search-activation.ts
@@ -11,7 +11,7 @@ import {
getLinkedWorkItemSuggestedName,
type LinkedWorkItemSummary
} from '@/lib/new-workspace'
-import { buildLinearIssueLinkedWorkItem } from '@/lib/linear-linked-work-item'
+import { buildLinearIssueLinkedWorkItem } from '@/lib/work-items/linear/linear-linked-work-item'
import type { Worktree } from '../../../../shared/worktree/types'
import {
haveConflictingTaskSourceAccounts,
diff --git a/src/renderer/src/components/cmd-j/task-search-requests.ts b/src/renderer/src/components/cmd-j/task-search-requests.ts
index e0530de53bc..46145b59e35 100644
--- a/src/renderer/src/components/cmd-j/task-search-requests.ts
+++ b/src/renderer/src/components/cmd-j/task-search-requests.ts
@@ -8,7 +8,7 @@ import { jiraStatusForTarget } from '@/runtime/jira/runtime-jira-project-client'
import { ipcOrRuntimeTargetForHostId } from '@/runtime/rpc/targets/runtime-client-target'
import { gitLabApiFor } from '@/runtime/repository-gitlab/gitlab-owner-api'
import { resolveJiraSourceHostId } from '../../../../shared/jira/jira-source-host'
-import { getJiraAccountLabel } from '@/lib/jira-account-label'
+import { getJiraAccountLabel } from '@/lib/work-items/jira/jira-account-label'
import {
getRepoExecutionHostId,
parseExecutionHostId,
@@ -28,7 +28,7 @@ import type { GlobalSettings } from '../../../../shared/global-settings-types'
import type { PaletteFilterState } from './palette-filter'
import { getTaskEligibleRepos } from '../task-page/task-page-default-repo-selection'
import { getRepoBackedProviderAvailability } from '../task-source-provider-availability'
-import { getTaskPageRepoSourceContext } from '../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../lib/work-items/task-repo-source-context'
import { searchJiraIssuesByKeyOrText } from '../jira-key-or-text-search'
import { bindTaskPageJiraItemSourceContext } from '../task-page/jira/task-page-jira-item-source-context'
import { makeCmdJTaskSearchResult, type CmdJTaskSearchResult } from './task-search-results'
diff --git a/src/renderer/src/components/dashboard/dashboard-card-context.ts b/src/renderer/src/components/dashboard/dashboard-card-context.ts
index 61a7d836f30..7895505d95c 100644
--- a/src/renderer/src/components/dashboard/dashboard-card-context.ts
+++ b/src/renderer/src/components/dashboard/dashboard-card-context.ts
@@ -1,4 +1,4 @@
-import { branchName } from '@/lib/git-utils'
+import { branchName } from '@/lib/source-control/branches/branch-name'
import { getHostedReviewCacheKey } from '@/store/slices/hosted-review/hosted-review-cache-identity'
import type { AppState } from '@/store/types'
import type { DashboardCardReview } from '../../../../shared/dashboard-snapshot'
diff --git a/src/renderer/src/components/diff-comments/DiffCommentDraftCard.tsx b/src/renderer/src/components/diff-comments/DiffCommentDraftCard.tsx
index ff1a769b293..6db2470e6b6 100644
--- a/src/renderer/src/components/diff-comments/DiffCommentDraftCard.tsx
+++ b/src/renderer/src/components/diff-comments/DiffCommentDraftCard.tsx
@@ -10,7 +10,7 @@ import { useTranslate } from '@/i18n/use-translate'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { toast } from 'sonner'
import { installOpenDraftAddReviewNoteGuard } from '../editor/editor-shortcuts'
diff --git a/src/renderer/src/components/diff-comments/DiffCommentPopover.tsx b/src/renderer/src/components/diff-comments/DiffCommentPopover.tsx
index cedded5ee08..179641303d5 100644
--- a/src/renderer/src/components/diff-comments/DiffCommentPopover.tsx
+++ b/src/renderer/src/components/diff-comments/DiffCommentPopover.tsx
@@ -7,7 +7,7 @@ import { useMountedRef } from '@/hooks/useMountedRef'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { useTranslate } from '@/i18n/use-translate'
import { installOpenDraftAddReviewNoteGuard } from '../editor/editor-shortcuts'
import { resolveDiffCommentPopoverTop } from './diff-comment-popover-position'
diff --git a/src/renderer/src/components/diff-comments/diff-comment-popover-outside-click.test.tsx b/src/renderer/src/components/diff-comments/diff-comment-popover-outside-click.test.tsx
index 9de8cabc908..1e07143007d 100644
--- a/src/renderer/src/components/diff-comments/diff-comment-popover-outside-click.test.tsx
+++ b/src/renderer/src/components/diff-comments/diff-comment-popover-outside-click.test.tsx
@@ -3,7 +3,7 @@
import { act } from 'react'
import { createRoot, type Root } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import { COMMENT_BODY_NONBLANK_SCAN_MAX_BYTES } from '@/lib/comment-body-submit-state'
+import { COMMENT_BODY_NONBLANK_SCAN_MAX_BYTES } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { DiffCommentPopover } from './DiffCommentPopover'
const roots: Root[] = []
diff --git a/src/renderer/src/components/diff-comments/useDiffCommentDecorator.tsx b/src/renderer/src/components/diff-comments/useDiffCommentDecorator.tsx
index 0a85789676d..e61ebac7a0c 100644
--- a/src/renderer/src/components/diff-comments/useDiffCommentDecorator.tsx
+++ b/src/renderer/src/components/diff-comments/useDiffCommentDecorator.tsx
@@ -6,7 +6,7 @@ import {
import { useCallback, useEffect, useMemo, useRef } from 'react'
import type { editor as monacoEditor } from 'monaco-editor'
import { createRoot, type Root } from 'react-dom/client'
-import { getCommentBodyLayoutLineCount } from '@/lib/comment-body-line-count'
+import { getCommentBodyLayoutLineCount } from '@/lib/source-control/review/comments/comment-body-line-count'
import { translate } from '@/i18n/i18n'
import { useAppStore } from '@/store'
import {
diff --git a/src/renderer/src/components/editor/check-details/actions/check-run-details-fix-with-ai.ts b/src/renderer/src/components/editor/check-details/actions/check-run-details-fix-with-ai.ts
index 0d48367b4ae..bb6ecb75dc3 100644
--- a/src/renderer/src/components/editor/check-details/actions/check-run-details-fix-with-ai.ts
+++ b/src/renderer/src/components/editor/check-details/actions/check-run-details-fix-with-ai.ts
@@ -10,7 +10,7 @@ import {
} from './check-run-details-fix-context'
import { openSourceControlAiSettingsTarget } from '@/components/right-sidebar/source-control/panel/source-control-ai-settings-navigation'
import { getConnectionId } from '@/lib/workspace/ownership/connection-context'
-import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch'
+import { startFixChecksAgent } from '@/lib/source-control/checks/fix-checks-agent-launch'
import { readSourceControlLaunchRecipeAgentId } from '../../../../../../shared/source-control/ai/source-control-launch-agent-selection'
import { resolveRepoWorktreeLaunchPlatform } from '@/runtime/hosts/platform/execution-host-facts'
import { useAppStore } from '@/store/index'
diff --git a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-row.tsx b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-row.tsx
index 2f42ab264e8..71909b98da0 100644
--- a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-row.tsx
+++ b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-row.tsx
@@ -1,6 +1,6 @@
import { createElement, memo } from 'react'
import { ChevronDown } from 'lucide-react'
-import { STATUS_COLORS } from '@/lib/git-path-decoration'
+import { STATUS_COLORS } from '@/lib/source-control/paths/git-path-decoration'
import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels'
import type { SourceControlTreeNode } from '../../../../../../shared/source-control/listing/source-control-tree'
import { FileTypeIcon, FolderIcon } from '@/components/FileTypeIcon'
diff --git a/src/renderer/src/components/editor/combined-diff/review-controls/combined-diff-notes-popover.tsx b/src/renderer/src/components/editor/combined-diff/review-controls/combined-diff-notes-popover.tsx
index cbf6f80755d..04fee3e0759 100644
--- a/src/renderer/src/components/editor/combined-diff/review-controls/combined-diff-notes-popover.tsx
+++ b/src/renderer/src/components/editor/combined-diff/review-controls/combined-diff-notes-popover.tsx
@@ -9,7 +9,7 @@ import {
DialogHeader,
DialogTitle
} from '@/components/ui/dialog'
-import { getDiffCommentLineLabel } from '@/lib/diff-comment-compat'
+import { getDiffCommentLineLabel } from '@/lib/source-control/review/comments/diff-comment-compat'
import { useTranslate } from '@/i18n/use-translate'
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
diff --git a/src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-notes-actions.ts b/src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-notes-actions.ts
index 32715254740..a07398b270b 100644
--- a/src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-notes-actions.ts
+++ b/src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-notes-actions.ts
@@ -4,7 +4,7 @@ import { useOwnedDiffComments } from '@/components/diff-comments/use-diff-commen
import { withoutMarkdownReviewNotes } from '@/lib/editor/markdown/review-notes/markdown-review-notes-setting'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { toast } from 'sonner'
-import { formatDiffComments } from '@/lib/diff-comments-format'
+import { formatDiffComments } from '../../../../../../shared/diff-comments-format'
import { translate } from '@/i18n/i18n'
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
diff --git a/src/renderer/src/components/editor/diff/monaco-view/DiffViewer.tsx b/src/renderer/src/components/editor/diff/monaco-view/DiffViewer.tsx
index e02d1627e37..9fb9bf3ab77 100644
--- a/src/renderer/src/components/editor/diff/monaco-view/DiffViewer.tsx
+++ b/src/renderer/src/components/editor/diff/monaco-view/DiffViewer.tsx
@@ -13,7 +13,7 @@ import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
import { applyDiffEditorLineNumberOptions } from './diff-editor-line-number-options'
-import { isDiffComment } from '@/lib/diff-comment-compat'
+import { isDiffComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import { installEditorSaveShortcut, installMonacoEditorFindShortcut } from '../../editor-shortcuts'
import { diffEditorScrollbarOptions } from './diff-editor-scrollbar-options'
import { LargeDiffFallback } from '../large-files/LargeDiffFallback'
diff --git a/src/renderer/src/components/editor/diff/sections/DiffSectionItem.tsx b/src/renderer/src/components/editor/diff/sections/DiffSectionItem.tsx
index 4c980ab1d6d..ab232a7d5ff 100644
--- a/src/renderer/src/components/editor/diff/sections/DiffSectionItem.tsx
+++ b/src/renderer/src/components/editor/diff/sections/DiffSectionItem.tsx
@@ -9,7 +9,7 @@ import { useEditorTypography } from '@/hooks/use-editor-typography'
import { useDiffCommentDecorator } from '../../../diff-comments/useDiffCommentDecorator'
import { applyDiffEditorLineNumberOptions } from '../monaco-view/diff-editor-line-number-options'
import { DiffSectionHeader } from './DiffSectionHeader'
-import { isDiffComment } from '@/lib/diff-comment-compat'
+import { isDiffComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import { installEditorSaveShortcut, installMonacoEditorFindShortcut } from '../../editor-shortcuts'
import { DiffSectionBody } from './DiffSectionBody'
import { useDiffSectionLayoutMetrics } from './useDiffSectionLayoutMetrics'
diff --git a/src/renderer/src/components/editor/git-graph/git-graph-commit-actions-controller.ts b/src/renderer/src/components/editor/git-graph/git-graph-commit-actions-controller.ts
index ac69ad7ee1f..cd4bca04574 100644
--- a/src/renderer/src/components/editor/git-graph/git-graph-commit-actions-controller.ts
+++ b/src/renderer/src/components/editor/git-graph/git-graph-commit-actions-controller.ts
@@ -4,7 +4,7 @@ import type { BranchSwitchTarget } from '../../../../../shared/git/branch-switch
import { createStore } from 'zustand/vanilla'
import { toast } from 'sonner'
import { useAppStore } from '@/store'
-import { gitGraphScope } from '@/lib/git-graph-tab'
+import { gitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { gitGraphOwnerKey } from './git-graph-workspace-navigation'
import { gitCommitActionsSupported } from '@/runtime/source-control/git/git-commit-actions-capability'
import {
diff --git a/src/renderer/src/components/editor/git-graph/git-graph-filter.tsx b/src/renderer/src/components/editor/git-graph/git-graph-filter.tsx
index 4e514ed205f..afe2589dbd9 100644
--- a/src/renderer/src/components/editor/git-graph/git-graph-filter.tsx
+++ b/src/renderer/src/components/editor/git-graph/git-graph-filter.tsx
@@ -6,7 +6,7 @@ import { Checkbox } from '@/components/ui/checkbox'
import { getRuntimeGitRefs } from '@/runtime/source-control/git/runtime-git-status-client'
import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof'
import { GIT_HISTORY_REFS_CAPABILITY } from '../../../../../shared/source-control/runtime/git-graph-capabilities'
-import { gitGraphScope, useGitGraphScope } from '@/lib/git-graph-tab'
+import { gitGraphScope, useGitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { useTranslate } from '@/i18n/use-translate'
import type {
GitHistoryItemRef,
diff --git a/src/renderer/src/components/editor/git-graph/git-graph-history-controller.ts b/src/renderer/src/components/editor/git-graph/git-graph-history-controller.ts
index 3465685eb14..cd5a139ea05 100644
--- a/src/renderer/src/components/editor/git-graph/git-graph-history-controller.ts
+++ b/src/renderer/src/components/editor/git-graph/git-graph-history-controller.ts
@@ -4,7 +4,8 @@ import { gitGraphOwnerKey, switchGitGraphWorkspace } from './git-graph-workspace
import { createStore } from 'zustand/vanilla'
import { shallow } from 'zustand/shallow'
import { useAppStore } from '@/store'
-import { gitGraphScope, gitGraphScopeInputs, GIT_GRAPH_REFRESH_EVENT } from '@/lib/git-graph-tab'
+import { gitGraphScope, gitGraphScopeInputs } from '@/lib/source-control/graph/git-graph-tab'
+import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/source-control/graph/git-graph-refresh-event'
import { getRuntimeGitHistory } from '@/runtime/source-control/git/runtime-git-status-client'
import { translate } from '@/i18n/i18n'
import type {
diff --git a/src/renderer/src/components/editor/git-graph/git-graph-ref-menu.tsx b/src/renderer/src/components/editor/git-graph/git-graph-ref-menu.tsx
index 0b968d353da..428bec78c9e 100644
--- a/src/renderer/src/components/editor/git-graph/git-graph-ref-menu.tsx
+++ b/src/renderer/src/components/editor/git-graph/git-graph-ref-menu.tsx
@@ -13,7 +13,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { useAppStore } from '@/store'
import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields'
-import type { gitGraphScope } from '@/lib/git-graph-tab'
+import type { gitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { gitGraphWorkspaceCatalog } from './git-graph-workspace-navigation'
import { useTranslate } from '@/i18n/use-translate'
import type { GitHistoryItemRef } from '../../../../../shared/git/history/git-history-types'
diff --git a/src/renderer/src/components/editor/git-graph/git-graph-rendering.test.tsx b/src/renderer/src/components/editor/git-graph/git-graph-rendering.test.tsx
index ba96587e12e..61a4f918161 100644
--- a/src/renderer/src/components/editor/git-graph/git-graph-rendering.test.tsx
+++ b/src/renderer/src/components/editor/git-graph/git-graph-rendering.test.tsx
@@ -2,10 +2,7 @@ import { workspaceId, local, repo } from './git-graph-workspace.test-fixtures'
// @vitest-environment happy-dom
import { useAppStore } from '@/store'
import { gitGraphHistoryForTab, disposeGitGraphHistory } from './git-graph-tab-controllers'
-import { attachClosedEditorTabCleanup } from '../model-lifetime/retention/closed-editor-tab-controller'
-import { gitGraphScope } from '@/lib/git-graph-tab'
-import { captureWorktreeOperationGenerationSnapshot } from '@/lib/workspace/ownership/worktree-operation-generation'
-import type { OpenFile } from '@/store/slices/editor/types/open-file'
+
import { act } from 'react'
import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
@@ -327,115 +324,6 @@ it('keeps a newer selection and its details during refresh and after a partial f
expect(container.querySelector('aside h2')?.textContent).toBe('Commit 120')
})
-it.each(['local', 'ssh:A'] as const)(
- 'retains %s twin history across workspace switches, then follows its tab owner move',
- async (hostId) => {
- useAppStore.setState({
- repos: [
- ...useAppStore.getState().repos,
- { ...repo, executionHostId: 'ssh:A', connectionId: 'A' }
- ],
- worktreesByRepo: { r: [local, { ...local, hostId: 'ssh:A' }] },
- activeWorkspaceExecutionHostId: hostId
- })
- const cleanup = attachClosedEditorTabCleanup(useAppStore)
- const original = useAppStore.getState().openFiles
- const file: OpenFile = {
- id: `${workspaceId}::git-graph`,
- worktreeId: workspaceId,
- mode: 'git-graph',
- relativePath: 'Git Graph',
- language: 'plaintext',
- isDirty: false,
- filePath: `${workspaceId}::git-graph`,
- operationProvenance: {
- ownershipProjection: 'explicit',
- generation: captureWorktreeOperationGenerationSnapshot({
- executionHostId: hostId,
- runtimeEnvironmentId: null
- })
- }
- }
- useAppStore.setState({ openFiles: [...original, file] })
- const render = () => (
-
-
-
- )
- const page = {
- ...result,
- items: [...result.items, { id: 'b', subject: 'second', message: 'second', parentIds: [] }],
- refs: 'all' as const
- }
- getHistory.mockReset().mockResolvedValueOnce(page)
- try {
- await act(async () => root.render(render()))
- expect(getHistory.mock.calls[0]?.[0].connectionId).toBe(hostId === 'ssh:A' ? 'A' : undefined)
- await act(async () => {
- const commit = Array.from(container.querySelectorAll('button')).find(
- (button) => button.textContent === 'second'
- )!
- commit.click()
- const scroll = container.querySelector('div.overflow-y-auto')!
- scroll.scrollTop = 144
- scroll.dispatchEvent(new Event('scroll'))
- })
- await act(async () => root.render(null))
- await act(async () =>
- useAppStore.setState({ activeWorktreeId: 'other', activeWorkspaceExecutionHostId: 'local' })
- )
- expect(gitGraphScope(workspaceId)).toBeNull()
- expect(gitGraphHistoryForTab(workspaceId).view.getState().selectedId).toBe('b')
- await act(async () =>
- useAppStore.setState({
- activeWorktreeId: workspaceId,
- activeWorkspaceExecutionHostId: hostId
- })
- )
- await act(async () => root.render(render()))
- expect(container.querySelector('[data-current="true"]')?.textContent).toContain('second')
- expect(container.querySelector('div.overflow-y-auto')?.scrollTop).toBe(144)
- expect(getHistory).toHaveBeenCalledTimes(1)
- await act(async () => root.render(null))
- useAppStore.setState({
- worktreesByRepo: { r: [{ ...local, hostId: hostId === 'local' ? 'ssh:A' : 'local' }] }
- })
- expect(gitGraphHistoryForTab(workspaceId).view.getState().result).toBeUndefined()
- expect(gitGraphHistoryForTab(workspaceId).scrollOffset).toBe(0)
- await act(async () => root.render(render()))
- const movedHost = hostId === 'local' ? 'ssh:A' : 'local'
- getHistory.mockResolvedValueOnce({ ...result, refs: 'all' })
- await act(async () =>
- useAppStore.setState({
- openFiles: [
- ...original,
- {
- ...file,
- operationProvenance: {
- ownershipProjection: 'explicit',
- generation: captureWorktreeOperationGenerationSnapshot({
- executionHostId: movedHost,
- runtimeEnvironmentId: null
- })
- }
- }
- ]
- })
- )
- expect(getHistory.mock.calls.at(-1)?.[0].connectionId).toBe(
- movedHost === 'ssh:A' ? 'A' : undefined
- )
- expect(gitGraphHistoryForTab(workspaceId).view.getState().selectedId).toBe('a')
- await act(async () => root.render(null))
- useAppStore.setState({ openFiles: original })
- expect(gitGraphHistoryForTab(workspaceId).view.getState().result).toBeUndefined()
- } finally {
- cleanup()
- useAppStore.setState({ openFiles: original })
- }
- }
-)
-
it('waits for an in-flight page before retrieving a distant parent in one operation', async () => {
let history: ReturnType
function History() {
@@ -632,23 +520,3 @@ it('keeps the confirm strip across tab switches, discarding it on navigation, fi
await act(async () => root.render(render()))
expect(container.textContent).not.toContain('Revert a?')
})
-
-it('canonicalizes selected refs before requesting history', async () => {
- let history: ReturnType
- function History() {
- history = useGitGraphHistory(workspaceId)
- return null
- }
- getHistory.mockReset().mockResolvedValue({ ...result, refs: 'all' })
- await act(async () => root.render())
- getHistory.mockClear().mockResolvedValue({
- ...result,
- refs: ['refs/heads/main', 'refs/heads/topic'],
- resolvedRefs: ['refs/heads/main', 'refs/heads/topic']
- })
- await act(async () => {
- history!.changeFilter(['refs/heads/topic', 'refs/heads/main', 'refs/heads/topic'])
- await history!.controller.settledResult()
- })
- expect(getHistory.mock.calls[0]?.[1].refs).toEqual(['refs/heads/main', 'refs/heads/topic'])
-})
diff --git a/src/renderer/src/components/editor/git-graph/git-graph-workspace-navigation.ts b/src/renderer/src/components/editor/git-graph/git-graph-workspace-navigation.ts
index dd059828ebe..6867b8a83f0 100644
--- a/src/renderer/src/components/editor/git-graph/git-graph-workspace-navigation.ts
+++ b/src/renderer/src/components/editor/git-graph/git-graph-workspace-navigation.ts
@@ -5,7 +5,7 @@ import { getWorktreeExecutionHostId } from '../../../../../shared/execution-host
import { findIndexedRepoOwnerForHost } from '@/lib/workspace/ownership/repo-owner-index'
import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields'
import { useAppStore } from '@/store'
-import { gitGraphScope } from '@/lib/git-graph-tab'
+import { gitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { getRuntimeGitRefs } from '@/runtime/source-control/git/runtime-git-status-client'
export const gitGraphOwnerKey = (scope: ReturnType) =>
diff --git a/src/renderer/src/components/editor/git-graph/use-git-graph-history.ts b/src/renderer/src/components/editor/git-graph/use-git-graph-history.ts
index 8e87e789707..58cc1cbcd54 100644
--- a/src/renderer/src/components/editor/git-graph/use-git-graph-history.ts
+++ b/src/renderer/src/components/editor/git-graph/use-git-graph-history.ts
@@ -1,7 +1,7 @@
import { useEffect } from 'react'
import { useStore } from 'zustand'
import { useAppStore } from '@/store'
-import { useGitGraphScope } from '@/lib/git-graph-tab'
+import { useGitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { gitGraphHistoryForTab } from './git-graph-tab-controllers'
import type {
GitHistoryRefs,
diff --git a/src/renderer/src/components/editor/markdown-preview/surface/use-markdown-preview-source-foundation.ts b/src/renderer/src/components/editor/markdown-preview/surface/use-markdown-preview-source-foundation.ts
index 7da3e2aa8b2..a098069e424 100644
--- a/src/renderer/src/components/editor/markdown-preview/surface/use-markdown-preview-source-foundation.ts
+++ b/src/renderer/src/components/editor/markdown-preview/surface/use-markdown-preview-source-foundation.ts
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { createConnectionIdForFileSelector } from '@/lib/workspace/ownership/connection-owner-resolution'
import { computeEditorFontSize } from '@/lib/editor/appearance/editor-font-zoom'
import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing'
-import { isMarkdownComment } from '@/lib/diff-comment-compat'
+import { isMarkdownComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import { useFileOwnerRuntimeTarget } from '@/runtime/rpc/targets/use-worktree-runtime-target'
import { useAppStore } from '@/store/index'
import { exceedsMarkdownRichModeSizeLimit } from '../../markdown/render-mode/markdown-rich-size-limit'
diff --git a/src/renderer/src/components/editor/markdown-source-tools/monaco/use-monaco-markdown-annotations.ts b/src/renderer/src/components/editor/markdown-source-tools/monaco/use-monaco-markdown-annotations.ts
index 1aaf08c391b..5ce92cf87e7 100644
--- a/src/renderer/src/components/editor/markdown-source-tools/monaco/use-monaco-markdown-annotations.ts
+++ b/src/renderer/src/components/editor/markdown-source-tools/monaco/use-monaco-markdown-annotations.ts
@@ -18,7 +18,7 @@ import type { WorkspaceResource } from '@/lib/workspace/ownership/workspace-copy
import { toast } from 'sonner'
import { useTranslate } from '@/i18n/use-translate'
import { useAppStore } from '@/store/index'
-import { isMarkdownComment } from '@/lib/diff-comment-compat'
+import { isMarkdownComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import {
formatMarkdownReviewNotes,
type MarkdownReviewNote
diff --git a/src/renderer/src/components/editor/rich-markdown/review/rich-markdown-review-note-layout.ts b/src/renderer/src/components/editor/rich-markdown/review/rich-markdown-review-note-layout.ts
index ba366de1c30..5b9b8f79613 100644
--- a/src/renderer/src/components/editor/rich-markdown/review/rich-markdown-review-note-layout.ts
+++ b/src/renderer/src/components/editor/rich-markdown/review/rich-markdown-review-note-layout.ts
@@ -1,5 +1,5 @@
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
-import { getCommentBodyLayoutLineCount } from '@/lib/comment-body-line-count'
+import { getCommentBodyLayoutLineCount } from '@/lib/source-control/review/comments/comment-body-line-count'
export type RichMarkdownReviewNotePosition = {
comment: DiffComment
diff --git a/src/renderer/src/components/editor/rich-markdown/review/useRichMarkdownReviewData.ts b/src/renderer/src/components/editor/rich-markdown/review/useRichMarkdownReviewData.ts
index 5c1f52edfd5..1227b03d9c5 100644
--- a/src/renderer/src/components/editor/rich-markdown/review/useRichMarkdownReviewData.ts
+++ b/src/renderer/src/components/editor/rich-markdown/review/useRichMarkdownReviewData.ts
@@ -1,7 +1,7 @@
import { useMemo } from 'react'
import { getRelativePathInsideRoot } from '@/lib/path'
import { normalizeRelativePath } from '../../../../../../shared/cross-platform-path'
-import { isMarkdownComment } from '@/lib/diff-comment-compat'
+import { isMarkdownComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import {
formatMarkdownReviewNotes,
sortMarkdownReviewNotes,
diff --git a/src/renderer/src/components/github-item-dialog/discuss-item/comment-reply-form.tsx b/src/renderer/src/components/github-item-dialog/discuss-item/comment-reply-form.tsx
index 2e61e0b98b9..ccd49525724 100644
--- a/src/renderer/src/components/github-item-dialog/discuss-item/comment-reply-form.tsx
+++ b/src/renderer/src/components/github-item-dialog/discuss-item/comment-reply-form.tsx
@@ -8,7 +8,7 @@ import type { GitHubImageUploadAddress } from '@/components/github/github-image-
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
diff --git a/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab.tsx b/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab.tsx
index 970ec2d78e4..6d1183f74f7 100644
--- a/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab.tsx
+++ b/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab.tsx
@@ -6,7 +6,7 @@ import {
getPRCommentAudienceCounts,
type PRCommentAudienceFilter
} from '../../../../../shared/source-control/review-comments/pr-comment-audience'
-import { usePRBotAuthorOverrides } from '@/lib/pr-bot-author-overrides'
+import { usePRBotAuthorOverrides } from '@/lib/source-control/review/pr-bot-author-overrides'
import { groupPRComments } from '../../../../../shared/source-control/review-comments/pr-comment-groups'
import {
getCommentReplyTargetCandidates,
@@ -18,9 +18,9 @@ import {
} from '@/components/right-sidebar/checks-panel/comments/pr-comments-ai-launch-ack'
import { buildPRCommentConversationReplyBody } from '@/components/right-sidebar/checks-panel/comments/pr-comment-fixing-reply-body'
import { useAppStore } from '@/store'
-import { canUseGitHubRepoContext } from '@/lib/github-source-runtime-context'
+import { canUseGitHubRepoContext } from '@/lib/work-items/github/github-source-runtime-context'
import { getGitHubMutationTarget } from '@/components/github/github-work-item-mutation-target'
-import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
+import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import { githubCommentImageUploadAddress } from '@/components/github/github-comment-image-upload-address'
import {
resolveGitHubBodyDraft,
@@ -57,7 +57,7 @@ import { GHCommentComposer } from './gh-comment-composer'
import { ConversationTabDescription } from './conversation-tab-description'
import { ConversationTabActivity } from './conversation-tab-activity'
import { ConversationTabPRSidebar } from './conversation-tab-pr-sidebar'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function ConversationTab({
item,
diff --git a/src/renderer/src/components/github-item-dialog/discuss-item/gh-comment-composer.tsx b/src/renderer/src/components/github-item-dialog/discuss-item/gh-comment-composer.tsx
index 8cc593a2043..26eb86b4117 100644
--- a/src/renderer/src/components/github-item-dialog/discuss-item/gh-comment-composer.tsx
+++ b/src/renderer/src/components/github-item-dialog/discuss-item/gh-comment-composer.tsx
@@ -10,14 +10,14 @@ import { githubCommentImageUploadAddress } from '@/components/github/github-comm
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { addIssueCommentForRepo } from '@/components/github/github-work-item-comment-mutations'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function GHCommentComposer({
className,
diff --git a/src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsx b/src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsx
index 47de49ec951..33995bb59e0 100644
--- a/src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsx
+++ b/src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-section.tsx
@@ -5,7 +5,7 @@ import { useRepoLabels, useRepoAssignees } from '@/hooks/useGitHubRepoMetadata'
import { useImmediateMutation } from '@/hooks/useIssueMetadata'
import { useRepoLabelsBySlug, useRepoAssigneesBySlug } from '@/hooks/useGitHubSlugMetadata'
import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import {
getTaskPageGitHubDuplicateCandidates,
getTaskPageGitHubDuplicateTargetErrorMessage,
diff --git a/src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-task-record.ts b/src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-task-record.ts
index 1c9f635ab46..b2a4d780105 100644
--- a/src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-task-record.ts
+++ b/src/renderer/src/components/github-item-dialog/edit-item-fields/gh-edit-task-record.ts
@@ -1,5 +1,5 @@
import { useAppStore } from '@/store'
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { untrackedTaskOperation, type TaskChange } from '@/store/github/task-records/task-change'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
diff --git a/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-actions.ts b/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-actions.ts
index ecb9b2d7104..b1813f82765 100644
--- a/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-actions.ts
+++ b/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-actions.ts
@@ -1,4 +1,4 @@
-import { readPRCheckRefreshOwner } from '@/lib/pr-check-refresh-owner'
+import { readPRCheckRefreshOwner } from '@/lib/source-control/checks/pr-check-refresh-owner'
import type React from 'react'
import { toast } from 'sonner'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
@@ -8,15 +8,18 @@ import {
type GitHubChecksContextOwner,
type GitHubChecksTabState
} from '@/components/github-checks-tab-state'
-import { getGitHubRuntimeRepoId, type GitHubRuntimeHost } from '@/lib/github-source-runtime-context'
-import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch'
+import {
+ getGitHubRuntimeRepoId,
+ type GitHubRuntimeHost
+} from '@/lib/work-items/github/github-source-runtime-context'
+import { startFixChecksAgent } from '@/lib/source-control/checks/fix-checks-agent-launch'
import { buildFixBrokenChecksPrompt } from '../../../../../shared/source-control/checks/pr-checks-fix-prompt'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { translate } from '@/i18n/i18n'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
type RuntimeHost = GitHubRuntimeHost | null
diff --git a/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-request-details.ts b/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-request-details.ts
index cc4fad7ba1d..c9877e753da 100644
--- a/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-request-details.ts
+++ b/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab-request-details.ts
@@ -11,7 +11,7 @@ import {
settleGitHubChecksTabDetails,
type CheckDetailsLoadState
} from '@/components/github-checks-tab-state'
-import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
+import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
import { translate } from '@/i18n/i18n'
import type { ChecksTabActionContext } from './checks-tab-actions'
diff --git a/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab.tsx b/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab.tsx
index 1c688842f40..807ef270d75 100644
--- a/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab.tsx
+++ b/src/renderer/src/components/github-item-dialog/inspect-pull-request/checks-tab.tsx
@@ -14,7 +14,7 @@ import {
import {
canUseGitHubRepoContext,
getGitHubSourceRuntimeHost
-} from '@/lib/github-source-runtime-context'
+} from '@/lib/work-items/github/github-source-runtime-context'
import { getBrokenChecks } from '../../../../../shared/source-control/checks/pr-checks-fix-prompt'
import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
diff --git a/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-load.ts b/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-load.ts
index 918761d60ff..24c0e89f9c3 100644
--- a/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-load.ts
+++ b/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-load.ts
@@ -21,7 +21,7 @@ import type {
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { translate } from '@/i18n/i18n'
import { loadPRFileContents } from '../load-item-details/pr-file-content-cache'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
type LoadSectionArgs = {
index: number
diff --git a/src/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsx b/src/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsx
index 09e1be54910..287b84a6294 100644
--- a/src/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsx
+++ b/src/renderer/src/components/github-item-dialog/land-pull-request/pr-actions-panel.tsx
@@ -10,7 +10,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import {
getGitHubRepoRoutingTarget,
getGitHubRuntimeRepoId
-} from '@/lib/github-source-runtime-context'
+} from '@/lib/work-items/github/github-source-runtime-context'
import { presentGitHubPRMergeState } from '@/components/github-pr-merge-state'
import { resolveGitHubPRMergeMethods } from '../../../../../shared/github/pull-request-merge-methods'
import type { GitHubPRMergeMethod } from '../../../../../shared/github/pull-request-types'
@@ -29,7 +29,7 @@ import { runPullRequestStateUpdate } from '@/components/github/github-work-item-
import type { GitHubItemDialogProjectOrigin } from '../load-item-details/github-item-dialog-types'
import { PRActionsMergeMenu } from './pr-actions-merge-menu'
import { WorkItemStateBadge } from '../load-item-details/work-item-state-badge'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function PRActionsPanel({
item,
diff --git a/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-panel.tsx b/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-panel.tsx
index d93837961de..b2c0d13782e 100644
--- a/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-panel.tsx
+++ b/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-panel.tsx
@@ -15,7 +15,7 @@ import type { GitHubAssignableUser } from '../../../../../shared/github/pull-req
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { useTranslate } from '@/i18n/use-translate'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { resolvePullRequestRepo } from '@/components/github/github-work-item-identity'
import { mergeReviewerSuggestions } from '@/components/github/work-item-state-presentation'
import type { GitHubItemDialogProjectOrigin } from '../load-item-details/github-item-dialog-types'
diff --git a/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts b/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts
index ec2724fc104..f5a64a990cc 100644
--- a/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts
+++ b/src/renderer/src/components/github-item-dialog/land-pull-request/pr-reviewers-request-actions.ts
@@ -1,7 +1,7 @@
import { toast } from 'sonner'
import { useAppStore } from '@/store'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
-import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
+import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import {
normalizeGitHubReviewerLogins,
parseGitHubReviewerInputLogins
@@ -16,7 +16,7 @@ import type { GitHubWorkItem } from '../../../../../shared/github/work-item-type
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { translate } from '@/i18n/i18n'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
type ReviewerRequestArgs = {
submitting: boolean
diff --git a/src/renderer/src/components/github-item-dialog/load-item-details/github-work-item-target-context.ts b/src/renderer/src/components/github-item-dialog/load-item-details/github-work-item-target-context.ts
index 6f4b98db0fe..e23c482ae78 100644
--- a/src/renderer/src/components/github-item-dialog/load-item-details/github-work-item-target-context.ts
+++ b/src/renderer/src/components/github-item-dialog/load-item-details/github-work-item-target-context.ts
@@ -1,5 +1,5 @@
import { useGitHubOperationOwner } from '@/hooks/useGitHubOperationScope'
-import { canUseGitHubRepoContext } from '@/lib/github-source-runtime-context'
+import { canUseGitHubRepoContext } from '@/lib/work-items/github/github-source-runtime-context'
import {
resolvePullRequestRepo,
parseOwnerRepoFromItemUrl
diff --git a/src/renderer/src/components/github-item-dialog/load-item-details/pr-file-content-cache.ts b/src/renderer/src/components/github-item-dialog/load-item-details/pr-file-content-cache.ts
index 8bf5548abc8..b5a88077926 100644
--- a/src/renderer/src/components/github-item-dialog/load-item-details/pr-file-content-cache.ts
+++ b/src/renderer/src/components/github-item-dialog/load-item-details/pr-file-content-cache.ts
@@ -2,7 +2,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
-} from '@/lib/github-source-runtime-context'
+} from '@/lib/work-items/github/github-source-runtime-context'
import {
PR_FILE_CONTENT_CACHE_MAX_BYTES,
getRetainedPRFileContentsByteCount
diff --git a/src/renderer/src/components/github-item-dialog/load-item-details/use-github-task-refresh.ts b/src/renderer/src/components/github-item-dialog/load-item-details/use-github-task-refresh.ts
index 3ed44582f86..ea74f808637 100644
--- a/src/renderer/src/components/github-item-dialog/load-item-details/use-github-task-refresh.ts
+++ b/src/renderer/src/components/github-item-dialog/load-item-details/use-github-task-refresh.ts
@@ -2,9 +2,12 @@ import { useGitHubItemTargetIdentity } from './github-work-item-target-context'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof'
-import { getGitHubSourceRuntimeHost } from '@/lib/github-source-runtime-context'
+import { getGitHubSourceRuntimeHost } from '@/lib/work-items/github/github-source-runtime-context'
import { GITHUB_CANONICAL_DETAILS_RUNTIME_CAPABILITY } from '../../../../../shared/work-items/task-source-runtime-capabilities'
-import { githubTaskExecutionIdentity, captureGitHubTaskTarget } from '@/lib/github-task-target'
+import {
+ githubTaskExecutionIdentity,
+ captureGitHubTaskTarget
+} from '@/lib/work-items/github/github-task-target'
import {
useCallback,
useLayoutEffect,
@@ -25,7 +28,7 @@ import {
startWorkItemDetailsFetch,
loadCanonicalGitHubTaskDetails
} from './work-item-details-fetch-settle'
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { useMountedRef } from '@/hooks/useMountedRef'
export function useGitHubTaskRefresh({
diff --git a/src/renderer/src/components/github-item-dialog/load-item-details/use-github-work-item-details.ts b/src/renderer/src/components/github-item-dialog/load-item-details/use-github-work-item-details.ts
index 89abe0ab33c..9a170dc3946 100644
--- a/src/renderer/src/components/github-item-dialog/load-item-details/use-github-work-item-details.ts
+++ b/src/renderer/src/components/github-item-dialog/load-item-details/use-github-work-item-details.ts
@@ -8,7 +8,7 @@ import {
import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from 'react'
import { useGitHubTaskItems } from '@/hooks/useGitHubTaskItems'
import { useGitHubTaskRefresh } from './use-github-task-refresh'
-import { addressedGitHubIssueItem } from '@/lib/github-task-target'
+import { addressedGitHubIssueItem } from '@/lib/work-items/github/github-task-target'
import {
normalizeItemDialogTab,
type ItemDialogTab
diff --git a/src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-fetch-settle.ts b/src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-fetch-settle.ts
index 52a9b019549..731bef192ed 100644
--- a/src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-fetch-settle.ts
+++ b/src/renderer/src/components/github-item-dialog/load-item-details/work-item-details-fetch-settle.ts
@@ -12,7 +12,10 @@ import type {
} from '../../../../../shared/github/work-item-types'
import type { GitHubTaskRecordCache } from '@/store/github/task-records/task-record-cache'
import type { TaskBinding } from '@/store/github/task-records/task-record-model'
-import { githubTaskRpcOptions, type GitHubTaskTarget } from '@/lib/github-task-target'
+import {
+ githubTaskRpcOptions,
+ type GitHubTaskTarget
+} from '@/lib/work-items/github/github-task-target'
import { useAppStore } from '@/store'
import { lookupGitHubWorkItemDetailsForSource } from '@/lib/work-items/github/github-work-item-source-lookup'
import {
diff --git a/src/renderer/src/components/github-item-dialog/open-dialog/github-item-dialog-pr-tabs.tsx b/src/renderer/src/components/github-item-dialog/open-dialog/github-item-dialog-pr-tabs.tsx
index d8fb55f4e85..e5aef3265ae 100644
--- a/src/renderer/src/components/github-item-dialog/open-dialog/github-item-dialog-pr-tabs.tsx
+++ b/src/renderer/src/components/github-item-dialog/open-dialog/github-item-dialog-pr-tabs.tsx
@@ -6,7 +6,7 @@ import {
resolvePullRequestRepo,
type ItemDialogTab
} from '@/components/github/github-work-item-identity'
-import { canUseGitHubRepoContext } from '@/lib/github-source-runtime-context'
+import { canUseGitHubRepoContext } from '@/lib/work-items/github/github-source-runtime-context'
import { useTranslate } from '@/i18n/use-translate'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { GitHubAssignableUser } from '../../../../../shared/github/pull-request-types'
diff --git a/src/renderer/src/components/github-project/ProjectViewWrapper.tsx b/src/renderer/src/components/github-project/ProjectViewWrapper.tsx
index c19fe2e6746..31bfc095261 100644
--- a/src/renderer/src/components/github-project/ProjectViewWrapper.tsx
+++ b/src/renderer/src/components/github-project/ProjectViewWrapper.tsx
@@ -22,7 +22,7 @@ import type {
GitHubProjectRow
} from '../../../../shared/github/project-types'
import type { ExecutionHostId } from '../../../../shared/execution-host'
-import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
+import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import { openAppHttpLink } from '@/lib/browser/navigation/app-http-link-open'
type Props = {
diff --git a/src/renderer/src/components/github-project/project-dialog-state.ts b/src/renderer/src/components/github-project/project-dialog-state.ts
index 5e0f68a40c3..cbd76e63136 100644
--- a/src/renderer/src/components/github-project/project-dialog-state.ts
+++ b/src/renderer/src/components/github-project/project-dialog-state.ts
@@ -1,5 +1,5 @@
import type { Repo } from '../../../../shared/repo-types'
-import { getWorkItemRepo, type WorkItemRepoRef } from '@/lib/work-item-repo-row'
+import { getWorkItemRepo, type WorkItemRepoRef } from '@/lib/work-items/work-item-repo-row'
type RepoBackedProjectDialogState = {
repoId: string
diff --git a/src/renderer/src/components/github-project/slug-dialog/Comments.tsx b/src/renderer/src/components/github-project/slug-dialog/Comments.tsx
index eb793aaf212..34898a7015e 100644
--- a/src/renderer/src/components/github-project/slug-dialog/Comments.tsx
+++ b/src/renderer/src/components/github-project/slug-dialog/Comments.tsx
@@ -8,7 +8,7 @@ import { gitHubSlugApiForTarget } from '@/runtime/repository-github/github-slug-
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import type { PRComment } from '../../../../../shared/github/comment-types'
import { useTranslate } from '@/i18n/use-translate'
import { projectViewErrorMessage } from '../project-view-error-copy'
diff --git a/src/renderer/src/components/github/PRAssigneesPanel.tsx b/src/renderer/src/components/github/PRAssigneesPanel.tsx
index 375b3496739..10835e82c6f 100644
--- a/src/renderer/src/components/github/PRAssigneesPanel.tsx
+++ b/src/renderer/src/components/github/PRAssigneesPanel.tsx
@@ -9,7 +9,7 @@ import { useAppStore } from '@/store'
import { useImmediateMutation } from '@/hooks/useIssueMetadata'
import { useRepoAssignees } from '@/hooks/useGitHubRepoMetadata'
import { useRepoAssigneesBySlug } from '@/hooks/useGitHubSlugMetadata'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import {
parseOwnerRepoFromItemUrl,
resolvePullRequestRepo,
diff --git a/src/renderer/src/components/github/github-comment-image-upload-address.ts b/src/renderer/src/components/github/github-comment-image-upload-address.ts
index 5ef4f06ce8b..d732709ac49 100644
--- a/src/renderer/src/components/github/github-comment-image-upload-address.ts
+++ b/src/renderer/src/components/github/github-comment-image-upload-address.ts
@@ -4,7 +4,7 @@ import type { GitHubOwnerRepo } from '../../../../shared/github/pull-request-typ
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
-} from '@/lib/github-source-runtime-context'
+} from '@/lib/work-items/github/github-source-runtime-context'
export function githubCommentImageUploadAddress(args: {
repoId?: string | null
diff --git a/src/renderer/src/components/github/github-work-item-comment-mutations.ts b/src/renderer/src/components/github/github-work-item-comment-mutations.ts
index 539a46f97bb..0fc458701cf 100644
--- a/src/renderer/src/components/github/github-work-item-comment-mutations.ts
+++ b/src/renderer/src/components/github/github-work-item-comment-mutations.ts
@@ -9,7 +9,7 @@ import { emitGitHubWorkItemDetailsCacheMutation } from '@/lib/work-items/github/
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
-} from '@/lib/github-source-runtime-context'
+} from '@/lib/work-items/github/github-source-runtime-context'
import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context'
import type { GitHubOwnerRepo } from '../../../../shared/github/pull-request-types'
diff --git a/src/renderer/src/components/github/github-work-item-edit-mutations.ts b/src/renderer/src/components/github/github-work-item-edit-mutations.ts
index 7fd728fad03..91ddcd150b4 100644
--- a/src/renderer/src/components/github/github-work-item-edit-mutations.ts
+++ b/src/renderer/src/components/github/github-work-item-edit-mutations.ts
@@ -8,8 +8,8 @@ import {
getGitHubRepoRoutingTarget,
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
-} from '@/lib/github-source-runtime-context'
-import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
+} from '@/lib/work-items/github/github-source-runtime-context'
+import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import {
resolvePullRequestRepo,
type GitHubWorkItemProjectOrigin
@@ -19,7 +19,7 @@ import { githubProjectHost } from '../../../../shared/github/project-identity'
import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context'
import type { GitHubOwnerRepo } from '../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export async function runIssueUpdate(args: {
repoPath: string | null
diff --git a/src/renderer/src/components/gitlab-item-dialog/gitlab-files-tab.tsx b/src/renderer/src/components/gitlab-item-dialog/gitlab-files-tab.tsx
index 4e6a073a202..4bf55161799 100644
--- a/src/renderer/src/components/gitlab-item-dialog/gitlab-files-tab.tsx
+++ b/src/renderer/src/components/gitlab-item-dialog/gitlab-files-tab.tsx
@@ -2,7 +2,7 @@ import { LoaderCircle, Send } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { TabsContent } from '@/components/ui/tabs'
import { useTranslate } from '@/i18n/use-translate'
-import { hasBoundedCommentBodyText } from '@/lib/comment-body-submit-state'
+import { hasBoundedCommentBodyText } from '@/lib/source-control/review/comments/comment-body-submit-state'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
import type { GitLabReviewActions } from './use-gitlab-review-actions'
diff --git a/src/renderer/src/components/gitlab-item-dialog/gitlab-item-dialog-view.tsx b/src/renderer/src/components/gitlab-item-dialog/gitlab-item-dialog-view.tsx
index 398a329ef8d..979650d08be 100644
--- a/src/renderer/src/components/gitlab-item-dialog/gitlab-item-dialog-view.tsx
+++ b/src/renderer/src/components/gitlab-item-dialog/gitlab-item-dialog-view.tsx
@@ -11,7 +11,7 @@ import {
} from '@/components/ui/sheet'
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { useTranslate } from '@/i18n/use-translate'
-import { hasBoundedCommentBodyText } from '@/lib/comment-body-submit-state'
+import { hasBoundedCommentBodyText } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { isScreenSubmitShortcut } from '@/lib/screen-submit-shortcut'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import { normalizeGitLabLabels, StateBadge } from '../gitlab-item-dialog-parts'
diff --git a/src/renderer/src/components/gitlab-item-dialog/use-gitlab-details-editing.ts b/src/renderer/src/components/gitlab-item-dialog/use-gitlab-details-editing.ts
index bad709e7959..1c0c77dfa85 100644
--- a/src/renderer/src/components/gitlab-item-dialog/use-gitlab-details-editing.ts
+++ b/src/renderer/src/components/gitlab-item-dialog/use-gitlab-details-editing.ts
@@ -12,7 +12,7 @@ import {
} from '../gitlab-item-dialog-parts'
import type { GitLabDialogRepoSelector } from './gitlab-item-dialog-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabDetailsEditing(
item: GitLabWorkItem | null,
diff --git a/src/renderer/src/components/gitlab-item-dialog/use-gitlab-pipeline-actions.ts b/src/renderer/src/components/gitlab-item-dialog/use-gitlab-pipeline-actions.ts
index d191255dd23..74399d9933f 100644
--- a/src/renderer/src/components/gitlab-item-dialog/use-gitlab-pipeline-actions.ts
+++ b/src/renderer/src/components/gitlab-item-dialog/use-gitlab-pipeline-actions.ts
@@ -6,7 +6,7 @@ import type { GitLabPipelineJob, GitLabWorkItem } from '../../../../shared/gitla
import { showGitLabMutationError } from '../gitlab-item-dialog-parts'
import type { GitLabDialogRepoSelector } from './gitlab-item-dialog-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabPipelineActions(
item: GitLabWorkItem | null,
diff --git a/src/renderer/src/components/gitlab-item-dialog/use-gitlab-primary-actions.ts b/src/renderer/src/components/gitlab-item-dialog/use-gitlab-primary-actions.ts
index 12f7951d25c..b59f1288ddc 100644
--- a/src/renderer/src/components/gitlab-item-dialog/use-gitlab-primary-actions.ts
+++ b/src/renderer/src/components/gitlab-item-dialog/use-gitlab-primary-actions.ts
@@ -1,14 +1,14 @@
import { gitLabApiFor } from '@/runtime/repository-gitlab/gitlab-owner-api'
import { useCallback } from 'react'
import { toast } from 'sonner'
-import { getCommentBodySubmitState } from '@/lib/comment-body-submit-state'
+import { getCommentBodySubmitState } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { useAppStore } from '@/store'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import { showGitLabMutationError } from '../gitlab-item-dialog-parts'
import type { GitLabDialogRepoSelector } from './gitlab-item-dialog-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabPrimaryActions(
item: GitLabWorkItem | null,
diff --git a/src/renderer/src/components/gitlab-item-dialog/use-gitlab-review-actions.ts b/src/renderer/src/components/gitlab-item-dialog/use-gitlab-review-actions.ts
index 74a6b6fde3b..3cf5276d92b 100644
--- a/src/renderer/src/components/gitlab-item-dialog/use-gitlab-review-actions.ts
+++ b/src/renderer/src/components/gitlab-item-dialog/use-gitlab-review-actions.ts
@@ -1,14 +1,14 @@
import { gitLabApiFor } from '@/runtime/repository-gitlab/gitlab-owner-api'
import { useCallback } from 'react'
import { toast } from 'sonner'
-import { getCommentBodySubmitState } from '@/lib/comment-body-submit-state'
+import { getCommentBodySubmitState } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { useAppStore } from '@/store'
import type { GitLabAssignableUser, GitLabWorkItem } from '../../../../shared/gitlab-types'
import { dedupeGitLabUsers, showGitLabMutationError } from '../gitlab-item-dialog-parts'
import type { GitLabDialogRepoSelector } from './gitlab-item-dialog-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabReviewActions(
item: GitLabWorkItem | null,
diff --git a/src/renderer/src/components/integrations/source-control/bitbucket-credentials-dialog.tsx b/src/renderer/src/components/integrations/source-control/bitbucket-credentials-dialog.tsx
index 83b5cee741f..504d987419b 100644
--- a/src/renderer/src/components/integrations/source-control/bitbucket-credentials-dialog.tsx
+++ b/src/renderer/src/components/integrations/source-control/bitbucket-credentials-dialog.tsx
@@ -18,7 +18,7 @@ import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
import { cn } from '@/lib/utils'
import { hasRemoteProviderRuntime } from '@/runtime/hosts/observations/provider-runtime-context'
import { preventOutsideDismissWhenDirty } from '@/lib/outside-dismiss-guard'
-import { bitbucketConnectErrorText } from '@/lib/bitbucket-connect-error-copy'
+import { bitbucketConnectErrorText } from '@/lib/source-control/remote/bitbucket-connect-error-copy'
import { useTranslate } from '@/i18n/use-translate'
import { BitbucketApiTokenScopes } from './bitbucket-api-token-scopes'
diff --git a/src/renderer/src/components/integrations/task-trackers/jira-integration-card.tsx b/src/renderer/src/components/integrations/task-trackers/jira-integration-card.tsx
index 30658c5c339..d67934da8c6 100644
--- a/src/renderer/src/components/integrations/task-trackers/jira-integration-card.tsx
+++ b/src/renderer/src/components/integrations/task-trackers/jira-integration-card.tsx
@@ -1,4 +1,4 @@
-import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import { UnsealedCredentialNotice } from '../../provider-accounts/UnsealedCredentialNotice'
import { useState } from 'react'
import { AlertCircle, CheckCircle2, LoaderCircle, Unlink } from 'lucide-react'
diff --git a/src/renderer/src/components/integrations/task-trackers/linear-integration-card.tsx b/src/renderer/src/components/integrations/task-trackers/linear-integration-card.tsx
index 41c301b5f4f..62e0a092090 100644
--- a/src/renderer/src/components/integrations/task-trackers/linear-integration-card.tsx
+++ b/src/renderer/src/components/integrations/task-trackers/linear-integration-card.tsx
@@ -1,4 +1,4 @@
-import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import { UnsealedCredentialNotice } from '../../provider-accounts/UnsealedCredentialNotice'
import { useState } from 'react'
import { AlertCircle, CheckCircle2, LoaderCircle, Unlink } from 'lucide-react'
diff --git a/src/renderer/src/components/jira-connect-dialog.tsx b/src/renderer/src/components/jira-connect-dialog.tsx
index 808fd39c519..3ae33349c72 100644
--- a/src/renderer/src/components/jira-connect-dialog.tsx
+++ b/src/renderer/src/components/jira-connect-dialog.tsx
@@ -1,5 +1,8 @@
import { jiraCredentialStorageCopy } from './jira-credential-storage-copy'
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import { useId, useState } from 'react'
import { LoaderCircle, Lock } from 'lucide-react'
import { useAppStore } from '@/store'
diff --git a/src/renderer/src/components/jira-issue-mutation-queue.ts b/src/renderer/src/components/jira-issue-mutation-queue.ts
index a2da7cf0264..de77986a4b9 100644
--- a/src/renderer/src/components/jira-issue-mutation-queue.ts
+++ b/src/renderer/src/components/jira-issue-mutation-queue.ts
@@ -1,4 +1,4 @@
-import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import type { JiraIssue, JiraMutationResult } from '../../../shared/jira/jira-types'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
diff --git a/src/renderer/src/components/jira-issue-transition-control.tsx b/src/renderer/src/components/jira-issue-transition-control.tsx
index c43bfcfb515..517a138891e 100644
--- a/src/renderer/src/components/jira-issue-transition-control.tsx
+++ b/src/renderer/src/components/jira-issue-transition-control.tsx
@@ -1,4 +1,7 @@
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import { useState } from 'react'
import { ChevronDown, CircleAlert, ExternalLink, Loader2 } from 'lucide-react'
import { Button } from '@/components/ui/button'
diff --git a/src/renderer/src/components/jira-issue-workspace-actions.ts b/src/renderer/src/components/jira-issue-workspace-actions.ts
index dcf574e9139..58187c693ce 100644
--- a/src/renderer/src/components/jira-issue-workspace-actions.ts
+++ b/src/renderer/src/components/jira-issue-workspace-actions.ts
@@ -10,7 +10,7 @@ import type {
} from '../../../shared/jira/jira-types'
import { applyJiraIssueKeyCasing } from '../../../shared/workspace-name'
import type { WorkspaceSeedNameOptions } from '../../../shared/workspace-name'
-import { getJiraIssueKeyCasingSeedOptions } from '@/lib/jira-issue-key-casing'
+import { getJiraIssueKeyCasingSeedOptions } from '@/lib/work-items/jira/jira-issue-key-casing'
import { buildJiraIssuePrompt } from './jira-prompt-templates'
import {
issueCopiedMessage,
diff --git a/src/renderer/src/components/jira-transition-fields-form.tsx b/src/renderer/src/components/jira-transition-fields-form.tsx
index 1cbef07b564..d3b733df0bd 100644
--- a/src/renderer/src/components/jira-transition-fields-form.tsx
+++ b/src/renderer/src/components/jira-transition-fields-form.tsx
@@ -10,7 +10,7 @@ import {
} from '@/components/ui/select'
import { Textarea } from '@/components/ui/textarea'
import { useTranslate } from '@/i18n/use-translate'
-import { getCommentBodySubmitState } from '@/lib/comment-body-submit-state'
+import { getCommentBodySubmitState } from '@/lib/source-control/review/comments/comment-body-submit-state'
import {
buildResolutionFieldValue,
classifyTransitionRequirements,
diff --git a/src/renderer/src/components/linear-api-key-dialog.tsx b/src/renderer/src/components/linear-api-key-dialog.tsx
index ef8c99daa83..655243e224b 100644
--- a/src/renderer/src/components/linear-api-key-dialog.tsx
+++ b/src/renderer/src/components/linear-api-key-dialog.tsx
@@ -1,4 +1,7 @@
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import { useId, useMemo, useState } from 'react'
import { ExternalLink, LoaderCircle, Lock } from 'lucide-react'
import type { LinearWorkspace } from '../../../shared/linear/workspace-types'
diff --git a/src/renderer/src/components/linear-issue-project-selector.tsx b/src/renderer/src/components/linear-issue-project-selector.tsx
index e84cad7264c..5067124df84 100644
--- a/src/renderer/src/components/linear-issue-project-selector.tsx
+++ b/src/renderer/src/components/linear-issue-project-selector.tsx
@@ -1,6 +1,9 @@
import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { confirmLinearIssueWrite } from '@/store/slices/linear/linear-issue-publication'
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { Check, ChevronDown, FolderKanban, LoaderCircle } from 'lucide-react'
import { toast } from 'sonner'
diff --git a/src/renderer/src/components/linear-issue-sub-issues.tsx b/src/renderer/src/components/linear-issue-sub-issues.tsx
index 93da24ef6eb..94c6fefe105 100644
--- a/src/renderer/src/components/linear-issue-sub-issues.tsx
+++ b/src/renderer/src/components/linear-issue-sub-issues.tsx
@@ -1,5 +1,8 @@
import { observeLinearIssueRead } from '@/store/slices/linear/linear-issue-publication'
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import { ImeInput } from '@/lib/text-input/ime/ime-text-field'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { ArrowRight, LoaderCircle, Plus } from 'lucide-react'
diff --git a/src/renderer/src/components/linear-issue-workspace-detail-state.ts b/src/renderer/src/components/linear-issue-workspace-detail-state.ts
index da7cf56d45e..b63e4d3335d 100644
--- a/src/renderer/src/components/linear-issue-workspace-detail-state.ts
+++ b/src/renderer/src/components/linear-issue-workspace-detail-state.ts
@@ -3,7 +3,7 @@ import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { observeLinearIssueRead } from '@/store/slices/linear/linear-issue-publication'
import { useLinearIssuePublication } from '@/hooks/useLinearIssuePublication'
import { translate } from '@/i18n/i18n'
-import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import { useCallback, useEffect, useRef, useState } from 'react'
import { createNonSecureContextUuid as createBrowserUuid } from '../../../shared/non-secure-context-uuid'
diff --git a/src/renderer/src/components/linear-issue-workspace-sidebar.tsx b/src/renderer/src/components/linear-issue-workspace-sidebar.tsx
index 5eda5753cb9..3e4131b889d 100644
--- a/src/renderer/src/components/linear-issue-workspace-sidebar.tsx
+++ b/src/renderer/src/components/linear-issue-workspace-sidebar.tsx
@@ -4,7 +4,7 @@ import { ChevronDown, Clipboard, FolderOpen, GitBranch } from 'lucide-react'
import { LinearIssueEditSection, type LinearEditState } from '@/components/LinearItemDrawer'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { buildLinearIssueContextSnapshot } from '@/lib/work-items/linear/linear-issue-context-snapshot'
-import { buildContainedLinkedContextBlock } from '@/lib/linked-work-item-context'
+import { buildContainedLinkedContextBlock } from '@/lib/work-items/linked-work-item-context'
import { useTranslate } from '@/i18n/use-translate'
import { buildLinearIssueBranchName } from '@/components/linear-issue-workspace-text'
import type { LinearComment, LinearIssue } from '../../../shared/linear/issue-types'
diff --git a/src/renderer/src/components/linear-item-drawer-comment-footer.tsx b/src/renderer/src/components/linear-item-drawer-comment-footer.tsx
index d531aedbcd8..df0c7ab31e2 100644
--- a/src/renderer/src/components/linear-item-drawer-comment-footer.tsx
+++ b/src/renderer/src/components/linear-item-drawer-comment-footer.tsx
@@ -1,4 +1,4 @@
-import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import { ImeTextarea } from '@/lib/text-input/ime/ime-text-field'
import React, { useCallback, useRef, useState } from 'react'
import { LoaderCircle, Send } from 'lucide-react'
@@ -8,7 +8,7 @@ import { Button } from '@/components/ui/button'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { getScreenSubmitShortcutLabel, isScreenSubmitShortcut } from '@/lib/screen-submit-shortcut'
import { createNonSecureContextUuid as createBrowserUuid } from '../../../shared/non-secure-context-uuid'
import { useAppStore } from '@/store'
diff --git a/src/renderer/src/components/linear-item-drawer-edit-controller.tsx b/src/renderer/src/components/linear-item-drawer-edit-controller.tsx
index 2b748d5d479..73aa076673d 100644
--- a/src/renderer/src/components/linear-item-drawer-edit-controller.tsx
+++ b/src/renderer/src/components/linear-item-drawer-edit-controller.tsx
@@ -1,6 +1,9 @@
import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { writeLinearIssue } from '@/lib/work-items/linear/linear-issue-write'
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import { useCallback, useState } from 'react'
import { toast } from 'sonner'
diff --git a/src/renderer/src/components/linear-project-view-surfaces.tsx b/src/renderer/src/components/linear-project-view-surfaces.tsx
index b437e0d8562..00ecc5477bb 100644
--- a/src/renderer/src/components/linear-project-view-surfaces.tsx
+++ b/src/renderer/src/components/linear-project-view-surfaces.tsx
@@ -1,5 +1,5 @@
-import { linearIssueReadError } from '@/lib/linear-read-error'
-import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import { linearIssueReadError } from '@/lib/work-items/linear/linear-read-error'
+import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import React from 'react'
import { ArrowLeft, ArrowRight, ExternalLink, Layers3, LoaderCircle, RefreshCw } from 'lucide-react'
diff --git a/src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.test.ts b/src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.test.ts
index 3c8d24df21a..5fc53698028 100644
--- a/src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.test.ts
+++ b/src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from 'vitest'
-import { parseGitHubIssueOrPRLink } from '@/lib/github-links'
+import { parseGitHubIssueOrPRLink } from '../../../../shared/github/links'
import type { RepoOption } from './smart-workspace-name-field-model'
import { resolveSmartWorkspaceGithubDirectLink } from './smart-workspace-github-direct-link'
diff --git a/src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.ts b/src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.ts
index 1ed36f311ed..de7a2bc4916 100644
--- a/src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.ts
+++ b/src/renderer/src/components/new-workspace/smart-workspace-github-direct-link.ts
@@ -1,10 +1,10 @@
import type React from 'react'
-import type { parseGitHubIssueOrPRLink } from '@/lib/github-links'
+import type { parseGitHubIssueOrPRLink } from '../../../../shared/github/links'
import {
lookupGitHubWorkItemByOwnerRepoForSource,
lookupGitHubWorkItemForSource
} from '@/lib/work-items/github/github-work-item-source-lookup'
-import { lookupSmartGitHubSubmitItem } from '@/lib/smart-github-submit'
+import { lookupSmartGitHubSubmitItem } from '@/lib/work-items/github/smart-github-submit'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import {
buildTaskSourceContextFromRepo,
diff --git a/src/renderer/src/components/new-workspace/smart-workspace-name-field-model.ts b/src/renderer/src/components/new-workspace/smart-workspace-name-field-model.ts
index 910d868bd6c..79bee1ddd88 100644
--- a/src/renderer/src/components/new-workspace/smart-workspace-name-field-model.ts
+++ b/src/renderer/src/components/new-workspace/smart-workspace-name-field-model.ts
@@ -1,6 +1,6 @@
import type React from 'react'
import type { useAppStore } from '@/store'
-import type { parseGitHubIssueOrPRLink, RepoSlug } from '@/lib/github-links'
+import type { parseGitHubIssueOrPRLink, RepoSlug } from '../../../../shared/github/links'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import type { JiraIssue, JiraSite } from '../../../../shared/jira/jira-types'
diff --git a/src/renderer/src/components/new-workspace/smart-workspace-repo-slug.ts b/src/renderer/src/components/new-workspace/smart-workspace-repo-slug.ts
index 09ee5346092..8dfe4a7a9ae 100644
--- a/src/renderer/src/components/new-workspace/smart-workspace-repo-slug.ts
+++ b/src/renderer/src/components/new-workspace/smart-workspace-repo-slug.ts
@@ -1,9 +1,9 @@
-import type { RepoSlug } from '@/lib/github-links'
+import type { RepoSlug } from '../../../../shared/github/links'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeTarget
-} from '@/lib/github-source-runtime-context'
+} from '@/lib/work-items/github/github-source-runtime-context'
import { githubRepoIdentityKey } from '../../../../shared/github/repository-identity-key'
import {
getTaskSourceCacheScope,
diff --git a/src/renderer/src/components/new-workspace/use-jira-url-source.ts b/src/renderer/src/components/new-workspace/use-jira-url-source.ts
index 48dd7ad1ad5..9baf170761a 100644
--- a/src/renderer/src/components/new-workspace/use-jira-url-source.ts
+++ b/src/renderer/src/components/new-workspace/use-jira-url-source.ts
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useAppStore } from '@/store'
-import { getJiraAccountLabel } from '@/lib/jira-account-label'
+import { getJiraAccountLabel } from '@/lib/work-items/jira/jira-account-label'
import { assertRuntimeEnvironmentCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof'
import {
getMatchingJiraSites,
diff --git a/src/renderer/src/components/new-workspace/use-smart-workspace-github-search.ts b/src/renderer/src/components/new-workspace/use-smart-workspace-github-search.ts
index 0168d7ee78b..c7b10dcdbee 100644
--- a/src/renderer/src/components/new-workspace/use-smart-workspace-github-search.ts
+++ b/src/renderer/src/components/new-workspace/use-smart-workspace-github-search.ts
@@ -1,11 +1,12 @@
import { useEffect, useMemo } from 'react'
import { useAppStore } from '@/store'
-import { normalizeGitHubLinkQuery, parseGitHubIssueOrPRLink } from '@/lib/github-links'
+import { normalizeGitHubLinkQuery } from '../../../../shared/new-workspace/github-links'
+import { parseGitHubIssueOrPRLink } from '../../../../shared/github/links'
import {
lookupGitHubWorkItemByOwnerRepoForSource,
lookupGitHubWorkItemForSource
} from '@/lib/work-items/github/github-work-item-source-lookup'
-import { lookupSmartGitHubSubmitItem } from '@/lib/smart-github-submit'
+import { lookupSmartGitHubSubmitItem } from '@/lib/work-items/github/smart-github-submit'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import { RESULT_LIMIT } from './smart-workspace-name-field-model'
import { resolveSmartWorkspaceGithubDirectLink } from './smart-workspace-github-direct-link'
diff --git a/src/renderer/src/components/new-workspace/use-smart-workspace-gitlab-search.ts b/src/renderer/src/components/new-workspace/use-smart-workspace-gitlab-search.ts
index 9eafa23feeb..62278de3bf5 100644
--- a/src/renderer/src/components/new-workspace/use-smart-workspace-gitlab-search.ts
+++ b/src/renderer/src/components/new-workspace/use-smart-workspace-gitlab-search.ts
@@ -2,8 +2,8 @@ import { useEffect, useMemo } from 'react'
import {
listGitLabWorkItemsForSource,
lookupGitLabWorkItemByPathForSource
-} from '@/lib/gitlab-work-item-source-lookup'
-import { parseGitLabIssueOrMRLink } from '@/lib/gitlab-links'
+} from '@/lib/work-items/gitlab/gitlab-work-item-source-lookup'
+import { parseGitLabIssueOrMRLink } from '../../../../shared/new-workspace/gitlab-links'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import { RESULT_LIMIT } from './smart-workspace-name-field-model'
import type { useWorkItemSourceFoundation } from './use-work-item-source-foundation'
diff --git a/src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx b/src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx
index 64dd0f532b4..0c11b0d2d66 100644
--- a/src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx
+++ b/src/renderer/src/components/new-workspace/use-smart-workspace-name-field-foundation.source.test.tsx
@@ -34,7 +34,7 @@ const mocks = vi.hoisted(() => ({
}
}))
vi.mock('@/runtime/linear/runtime-linear-client', () => ({ linearStatus: mocks.readStatus }))
-vi.mock('@/lib/gitlab-work-item-source-lookup', () => ({
+vi.mock('@/lib/work-items/gitlab/gitlab-work-item-source-lookup', () => ({
listGitLabWorkItemsForSource: mocks.listGitlabWorkItems,
lookupGitLabWorkItemByPathForSource: vi.fn()
}))
diff --git a/src/renderer/src/components/new-workspace/use-smart-workspace-secondary-searches.ts b/src/renderer/src/components/new-workspace/use-smart-workspace-secondary-searches.ts
index 1cbbd4b7c4d..b15ea773cc6 100644
--- a/src/renderer/src/components/new-workspace/use-smart-workspace-secondary-searches.ts
+++ b/src/renderer/src/components/new-workspace/use-smart-workspace-secondary-searches.ts
@@ -6,7 +6,7 @@ import {
} from '@/store/slices/linear/linear-issue-publication'
import type { LinearIssue } from '../../../../shared/linear/issue-types'
import type { LinearCollectionResult } from '../../../../shared/linear/workspace-types'
-import { linearIssueViewError } from '@/lib/linear-read-error'
+import { linearIssueViewError } from '@/lib/work-items/linear/linear-read-error'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import { useEffect, useMemo, useRef } from 'react'
import { searchRuntimeRepoBaseRefDetails } from '@/runtime/source-control/references/runtime-repo-client'
diff --git a/src/renderer/src/components/new-workspace/use-work-item-source-presentation.ts b/src/renderer/src/components/new-workspace/use-work-item-source-presentation.ts
index 133fd2ebe29..71f6d1b6d03 100644
--- a/src/renderer/src/components/new-workspace/use-work-item-source-presentation.ts
+++ b/src/renderer/src/components/new-workspace/use-work-item-source-presentation.ts
@@ -1,7 +1,7 @@
import { useEffect, useMemo } from 'react'
import { CaseSensitive, LoaderCircle, Search } from 'lucide-react'
-import { parseGitHubIssueOrPRLink } from '@/lib/github-links'
-import { parseGitLabIssueOrMRLink } from '@/lib/gitlab-links'
+import { parseGitHubIssueOrPRLink } from '../../../../shared/github/links'
+import { parseGitLabIssueOrMRLink } from '../../../../shared/new-workspace/gitlab-links'
import {
isSmartWorkspaceLinearIssueIntentMatch,
parseBoundedSmartWorkspaceLinearIssueInput,
diff --git a/src/renderer/src/components/new-workspace/use-work-item-source-state.ts b/src/renderer/src/components/new-workspace/use-work-item-source-state.ts
index 91d721ae321..ca66a8e8461 100644
--- a/src/renderer/src/components/new-workspace/use-work-item-source-state.ts
+++ b/src/renderer/src/components/new-workspace/use-work-item-source-state.ts
@@ -1,6 +1,6 @@
import { useGitHubTaskItems } from '@/hooks/useGitHubTaskItems'
import { useRef, useState } from 'react'
-import type { RepoSlug } from '@/lib/github-links'
+import type { RepoSlug } from '../../../../shared/github/links'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import type { JiraIssue } from '../../../../shared/jira/jira-types'
diff --git a/src/renderer/src/components/pull-request-page/actions/merge-actions.ts b/src/renderer/src/components/pull-request-page/actions/merge-actions.ts
index 1aafa675536..38db102669b 100644
--- a/src/renderer/src/components/pull-request-page/actions/merge-actions.ts
+++ b/src/renderer/src/components/pull-request-page/actions/merge-actions.ts
@@ -3,7 +3,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { notifyWorkItemDetailsMutation } from '@/components/github/github-work-item-comment-mutations'
import { runPullRequestStateUpdate } from '@/components/github/github-work-item-edit-mutations'
-import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
+import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import {
getPullRequestMergeConfirmationTitle,
getPullRequestMergeMethodLabel,
@@ -19,7 +19,7 @@ import type { TaskSourceContext } from '../../../../../shared/work-items/task-so
import type { PullRequestPageProjectOrigin } from '../page-types'
import { translate } from '@/i18n/i18n'
import type { GitHubPRMergeStatePresentation } from '@/components/github-pr-merge-state'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export async function changePullRequestState(args: {
canMutateState: boolean
diff --git a/src/renderer/src/components/pull-request-page/actions/panel.tsx b/src/renderer/src/components/pull-request-page/actions/panel.tsx
index 6054d009c84..38a5f8473c6 100644
--- a/src/renderer/src/components/pull-request-page/actions/panel.tsx
+++ b/src/renderer/src/components/pull-request-page/actions/panel.tsx
@@ -21,7 +21,7 @@ import {
import { useConfirmationDialog } from '@/components/confirmation-dialog-context'
import { cn } from '@/lib/utils'
import { useAppStore } from '@/store'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { presentGitHubPRMergeState } from '@/components/github-pr-merge-state'
import { resolveGitHubPRMergeMethods } from '../../../../../shared/github/pull-request-merge-methods'
import { resolvePullRequestRepo } from '@/components/github/github-work-item-identity'
diff --git a/src/renderer/src/components/pull-request-page/cache/file-content.ts b/src/renderer/src/components/pull-request-page/cache/file-content.ts
index de98b15b055..647e15a164d 100644
--- a/src/renderer/src/components/pull-request-page/cache/file-content.ts
+++ b/src/renderer/src/components/pull-request-page/cache/file-content.ts
@@ -10,7 +10,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
-} from '@/lib/github-source-runtime-context'
+} from '@/lib/work-items/github/github-source-runtime-context'
import {
PR_FILE_CONTENT_CACHE_MAX_BYTES,
getRetainedPRFileContentsByteCount
diff --git a/src/renderer/src/components/pull-request-page/checks/details-request.ts b/src/renderer/src/components/pull-request-page/checks/details-request.ts
index 6896ac9e596..ec258b68b6e 100644
--- a/src/renderer/src/components/pull-request-page/checks/details-request.ts
+++ b/src/renderer/src/components/pull-request-page/checks/details-request.ts
@@ -12,7 +12,10 @@ import {
type CheckDetailsLoadState,
type GitHubChecksTabState
} from '@/components/github-checks-tab-state'
-import { getGitHubRuntimeRepoId, type GitHubRuntimeHost } from '@/lib/github-source-runtime-context'
+import {
+ getGitHubRuntimeRepoId,
+ type GitHubRuntimeHost
+} from '@/lib/work-items/github/github-source-runtime-context'
import { translate } from '@/i18n/i18n'
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
diff --git a/src/renderer/src/components/pull-request-page/checks/fix-launch.ts b/src/renderer/src/components/pull-request-page/checks/fix-launch.ts
index 05b033b6298..d6279ea6bdc 100644
--- a/src/renderer/src/components/pull-request-page/checks/fix-launch.ts
+++ b/src/renderer/src/components/pull-request-page/checks/fix-launch.ts
@@ -5,7 +5,7 @@ import {
import type { DirectWorkItemLaunchResult } from '@/lib/workspace/creation/work-item/direct-work-item-setup'
import { toast } from 'sonner'
import { useAppStore } from '@/store'
-import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch'
+import { startFixChecksAgent } from '@/lib/source-control/checks/fix-checks-agent-launch'
import { launchWorkItemDirect } from '@/lib/workspace/creation/work-item/launch-work-item-direct'
import { buildFixBrokenChecksPrompt } from '../../../../../shared/source-control/checks/pr-checks-fix-prompt'
import type { SourceControlAiWriteTarget } from '../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save'
diff --git a/src/renderer/src/components/pull-request-page/checks/refresh.ts b/src/renderer/src/components/pull-request-page/checks/refresh.ts
index b56f366111d..fd647303677 100644
--- a/src/renderer/src/components/pull-request-page/checks/refresh.ts
+++ b/src/renderer/src/components/pull-request-page/checks/refresh.ts
@@ -1,7 +1,10 @@
-import { readPRCheckRefreshOwner } from '@/lib/pr-check-refresh-owner'
+import { readPRCheckRefreshOwner } from '@/lib/source-control/checks/pr-check-refresh-owner'
import { toast } from 'sonner'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
-import { getGitHubRuntimeRepoId, type GitHubRuntimeHost } from '@/lib/github-source-runtime-context'
+import {
+ getGitHubRuntimeRepoId,
+ type GitHubRuntimeHost
+} from '@/lib/work-items/github/github-source-runtime-context'
import {
resetGitHubChecksTabForSource,
updateGitHubChecksTabLocalChecks,
diff --git a/src/renderer/src/components/pull-request-page/checks/rerun.ts b/src/renderer/src/components/pull-request-page/checks/rerun.ts
index 078d996bb54..b422731ef80 100644
--- a/src/renderer/src/components/pull-request-page/checks/rerun.ts
+++ b/src/renderer/src/components/pull-request-page/checks/rerun.ts
@@ -1,13 +1,16 @@
import { toast } from 'sonner'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
-import { getGitHubRuntimeRepoId, type GitHubRuntimeHost } from '@/lib/github-source-runtime-context'
+import {
+ getGitHubRuntimeRepoId,
+ type GitHubRuntimeHost
+} from '@/lib/work-items/github/github-source-runtime-context'
import { translate } from '@/i18n/i18n'
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { GitHubChecksTabState } from '../../github-checks-tab-state'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
/** The checks tab mints one of these per context; only its reference identity is ever read. */
type ChecksContextOwner = GitHubChecksTabState['contextOwner']
diff --git a/src/renderer/src/components/pull-request-page/checks/tab.tsx b/src/renderer/src/components/pull-request-page/checks/tab.tsx
index 45c6ab85d74..6b87113606e 100644
--- a/src/renderer/src/components/pull-request-page/checks/tab.tsx
+++ b/src/renderer/src/components/pull-request-page/checks/tab.tsx
@@ -25,7 +25,7 @@ import { resolvePullRequestRepo } from '@/components/github/github-work-item-ide
import {
canUseGitHubRepoContext,
getGitHubSourceRuntimeHost
-} from '@/lib/github-source-runtime-context'
+} from '@/lib/work-items/github/github-source-runtime-context'
import { getLocalRepoProjectExecutionRuntimeContext } from '@/lib/local-preflight-context'
import { CLIENT_PLATFORM } from '@/lib/new-workspace'
import { resolveRepoExecutionHostPlatform } from '@/runtime/hosts/platform/execution-host-facts'
diff --git a/src/renderer/src/components/pull-request-page/comments/composer.tsx b/src/renderer/src/components/pull-request-page/comments/composer.tsx
index 11f86f70cca..49460ff952d 100644
--- a/src/renderer/src/components/pull-request-page/comments/composer.tsx
+++ b/src/renderer/src/components/pull-request-page/comments/composer.tsx
@@ -11,7 +11,7 @@ import { isScreenSubmitShortcut } from '@/lib/screen-submit-shortcut'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { addIssueCommentForRepo } from '@/components/github/github-work-item-comment-mutations'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
@@ -20,7 +20,7 @@ import type { PRComment } from '../../../../../shared/github/comment-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { MentionOption } from '../page-types'
import { MentionTextarea } from '../mentions/textarea'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function GHCommentComposer({
className,
diff --git a/src/renderer/src/components/pull-request-page/comments/reply-form.tsx b/src/renderer/src/components/pull-request-page/comments/reply-form.tsx
index ffed7d1b4a9..8e37f90ca60 100644
--- a/src/renderer/src/components/pull-request-page/comments/reply-form.tsx
+++ b/src/renderer/src/components/pull-request-page/comments/reply-form.tsx
@@ -9,7 +9,7 @@ import { isScreenSubmitShortcut } from '@/lib/screen-submit-shortcut'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
import type { MentionOption } from '../page-types'
diff --git a/src/renderer/src/components/pull-request-page/conversation/reply.ts b/src/renderer/src/components/pull-request-page/conversation/reply.ts
index d54feaf876c..1b67f437a34 100644
--- a/src/renderer/src/components/pull-request-page/conversation/reply.ts
+++ b/src/renderer/src/components/pull-request-page/conversation/reply.ts
@@ -13,7 +13,7 @@ import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export async function postConversationReply(args: {
canUseRepoMutationContext: boolean
diff --git a/src/renderer/src/components/pull-request-page/conversation/tab.tsx b/src/renderer/src/components/pull-request-page/conversation/tab.tsx
index ef351efdfc7..5c7027d3881 100644
--- a/src/renderer/src/components/pull-request-page/conversation/tab.tsx
+++ b/src/renderer/src/components/pull-request-page/conversation/tab.tsx
@@ -1,6 +1,6 @@
import { githubCommentImageUploadAddress } from '@/components/github/github-comment-image-upload-address'
import { getGitHubMutationTarget } from '@/components/github/github-work-item-mutation-target'
-import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
+import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { toast } from 'sonner'
@@ -10,8 +10,8 @@ import { useRepoAssignees } from '@/hooks/useGitHubRepoMetadata'
import {
canUseGitHubRepoContext,
getGitHubRepoRoutingTarget
-} from '@/lib/github-source-runtime-context'
-import { usePRBotAuthorOverrides } from '@/lib/pr-bot-author-overrides'
+} from '@/lib/work-items/github/github-source-runtime-context'
+import { usePRBotAuthorOverrides } from '@/lib/source-control/review/pr-bot-author-overrides'
import {
filterPRCommentsByAudience,
getPRCommentAudienceCounts,
diff --git a/src/renderer/src/components/pull-request-page/edit/section.tsx b/src/renderer/src/components/pull-request-page/edit/section.tsx
index 36bba8d6349..a145cb298ea 100644
--- a/src/renderer/src/components/pull-request-page/edit/section.tsx
+++ b/src/renderer/src/components/pull-request-page/edit/section.tsx
@@ -10,7 +10,7 @@ import { useRepoAssignees, useRepoLabels } from '@/hooks/useGitHubRepoMetadata'
import { useRepoAssigneesBySlug, useRepoLabelsBySlug } from '@/hooks/useGitHubSlugMetadata'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { getStateLabel } from '@/components/github/work-item-state-presentation'
import { useTranslate } from '@/i18n/use-translate'
import type { PullRequestPageProjectOrigin } from '../page-types'
diff --git a/src/renderer/src/components/pull-request-page/files/line-comment.ts b/src/renderer/src/components/pull-request-page/files/line-comment.ts
index d8a57019938..c569a09c13b 100644
--- a/src/renderer/src/components/pull-request-page/files/line-comment.ts
+++ b/src/renderer/src/components/pull-request-page/files/line-comment.ts
@@ -5,7 +5,7 @@ import type { DiffSection } from '@/components/editor/diff/sections/diff-section
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export async function addPullRequestLineComment(args: {
headSha: string | undefined
diff --git a/src/renderer/src/components/pull-request-page/reviewers/panel.tsx b/src/renderer/src/components/pull-request-page/reviewers/panel.tsx
index 678571b3c1d..960b20ad4f3 100644
--- a/src/renderer/src/components/pull-request-page/reviewers/panel.tsx
+++ b/src/renderer/src/components/pull-request-page/reviewers/panel.tsx
@@ -6,7 +6,7 @@ import { useRepoAssigneesBySlug } from '@/hooks/useGitHubSlugMetadata'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { GitHubAssignableUser } from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { resolvePullRequestRepo } from '@/components/github/github-work-item-identity'
import { getGitHubPRReviewerRows } from '../../../../../shared/github/pr-reviewer-display'
import { mergeReviewerSuggestions } from '@/components/github/work-item-state-presentation'
diff --git a/src/renderer/src/components/pull-request-page/reviewers/request-actions.ts b/src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
index 8bd313480ef..2c13ff20a06 100644
--- a/src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
+++ b/src/renderer/src/components/pull-request-page/reviewers/request-actions.ts
@@ -6,7 +6,7 @@ import {
} from '../../../../../shared/github/pr-reviewer-display'
import { notifyWorkItemDetailsMutation } from '@/components/github/github-work-item-comment-mutations'
import { buildRequestedReviewUsers } from '@/components/github/work-item-state-presentation'
-import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
+import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import { translate } from '@/i18n/i18n'
import type {
GitHubAssignableUser,
@@ -15,7 +15,7 @@ import type {
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
const MAX_REQUESTED_REVIEWERS = 15
diff --git a/src/renderer/src/components/right-sidebar/checks-panel/comments/comment-controls.tsx b/src/renderer/src/components/right-sidebar/checks-panel/comments/comment-controls.tsx
index bf35d6db6cb..43da45f13cb 100644
--- a/src/renderer/src/components/right-sidebar/checks-panel/comments/comment-controls.tsx
+++ b/src/renderer/src/components/right-sidebar/checks-panel/comments/comment-controls.tsx
@@ -22,7 +22,7 @@ import { useAppStore } from '@/store/index'
import { isReviewThreadResolutionInFlight } from '@/store/github/review-threads/review-thread-resolution-in-flight'
import { basename } from '@/lib/path'
import { isBotPRComment } from '../../../../../../shared/source-control/review-comments/pr-comment-audience'
-import { setPRBotAuthorOverride } from '@/lib/pr-bot-author-overrides'
+import { setPRBotAuthorOverride } from '@/lib/source-control/review/pr-bot-author-overrides'
import { normalizePRCommentAuthorLogin } from '../../../../../../shared/source-control/review-comments/pr-bot-author-overrides'
import type { PRComment } from '../../../../../../shared/github/comment-types'
import type { PRCommentGroupActionState } from '@/lib/source-control/review/comments/pr-comment-action-state'
diff --git a/src/renderer/src/components/right-sidebar/checks-panel/comments/right-panel-comment-composer.tsx b/src/renderer/src/components/right-sidebar/checks-panel/comments/right-panel-comment-composer.tsx
index 4c77dab6d56..fb9ab86bde5 100644
--- a/src/renderer/src/components/right-sidebar/checks-panel/comments/right-panel-comment-composer.tsx
+++ b/src/renderer/src/components/right-sidebar/checks-panel/comments/right-panel-comment-composer.tsx
@@ -14,14 +14,14 @@ import { isImeCompositionKeyDown } from '@/lib/text-input/ime/ime-composition-ke
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
-} from '@/lib/comment-body-submit-state'
+} from '@/lib/source-control/review/comments/comment-body-submit-state'
import {
clearRightPanelCommentFocusTimer,
scheduleRightPanelCommentFocusTimer
} from './right-panel-comment-focus-timers'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export type RightPanelCommentSubmitResult = { ok: true } | { ok: false; error: string }
diff --git a/src/renderer/src/components/right-sidebar/checks-panel/comments/use-checks-panel-comment-mutations.tsx b/src/renderer/src/components/right-sidebar/checks-panel/comments/use-checks-panel-comment-mutations.tsx
index 3c52b3a8add..7ccd8d54ec7 100644
--- a/src/renderer/src/components/right-sidebar/checks-panel/comments/use-checks-panel-comment-mutations.tsx
+++ b/src/renderer/src/components/right-sidebar/checks-panel/comments/use-checks-panel-comment-mutations.tsx
@@ -24,7 +24,7 @@ import type {
PRComment
} from '../../../../../../shared/github/comment-types'
import { translate } from '@/i18n/i18n'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
import { gitHubSlugApiForWorkspace } from '@/runtime/repository-github/github-slug-owner-api'
import { errorMessage } from '../../../../../../shared/error-message'
diff --git a/src/renderer/src/components/right-sidebar/checks-panel/comments/use-checks-panel-comment-resolution.tsx b/src/renderer/src/components/right-sidebar/checks-panel/comments/use-checks-panel-comment-resolution.tsx
index 1ab4e5f8d83..07dfa1e3c01 100644
--- a/src/renderer/src/components/right-sidebar/checks-panel/comments/use-checks-panel-comment-resolution.tsx
+++ b/src/renderer/src/components/right-sidebar/checks-panel/comments/use-checks-panel-comment-resolution.tsx
@@ -21,7 +21,7 @@ import { useTranslate } from '@/i18n/use-translate'
import { useAppStore } from '@/store/index'
import { isReviewThreadResolutionInFlight } from '@/store/github/review-threads/review-thread-resolution-in-flight'
import { worktreeLaunchWorkspace } from '@/lib/agent-session/launch/routing/agent-launch-route-input'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
import { errorMessage } from '../../../../../../shared/error-message'
import type { GitLabDiscussionResolveResult } from '../../../../../../shared/gitlab-types'
diff --git a/src/renderer/src/components/right-sidebar/checks-panel/comments/use-comments-list-state.tsx b/src/renderer/src/components/right-sidebar/checks-panel/comments/use-comments-list-state.tsx
index 33c90ee50c5..9f567534d71 100644
--- a/src/renderer/src/components/right-sidebar/checks-panel/comments/use-comments-list-state.tsx
+++ b/src/renderer/src/components/right-sidebar/checks-panel/comments/use-comments-list-state.tsx
@@ -31,7 +31,7 @@ import {
usePRCommentsListSelection,
type PRCommentsListSelectionClearRequest
} from './pr-comments-list-selection'
-import { usePRBotAuthorOverrides } from '@/lib/pr-bot-author-overrides'
+import { usePRBotAuthorOverrides } from '@/lib/source-control/review/pr-bot-author-overrides'
import { translate } from '@/i18n/i18n'
import { useTranslate, type Translate } from '@/i18n/use-translate'
import { PRCommentGroupView } from './comment-group'
diff --git a/src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-entry-refresh-and-title-actions.tsx b/src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-entry-refresh-and-title-actions.tsx
index 558b17ecc5b..3a03c574bf7 100644
--- a/src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-entry-refresh-and-title-actions.tsx
+++ b/src/renderer/src/components/right-sidebar/checks-panel/refresh/use-checks-panel-entry-refresh-and-title-actions.tsx
@@ -11,7 +11,7 @@ import type { ChecksPanelControllerState } from '../use-checks-panel-controller-
import type { ChecksPanelReviewState } from '../use-checks-panel-review-state'
import type { ChecksPanelPollingState } from './use-checks-panel-polling'
import type { ChecksPanelReviewDataState } from '../use-checks-panel-review-data'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
type ChecksPanelEntryRefreshAndTitleActionsInput = Pick<
ChecksPanelContextState,
diff --git a/src/renderer/src/components/right-sidebar/checks-panel/review-actions/use-checks-panel-ai-acknowledgement.tsx b/src/renderer/src/components/right-sidebar/checks-panel/review-actions/use-checks-panel-ai-acknowledgement.tsx
index d732f6cabab..93561b031c3 100644
--- a/src/renderer/src/components/right-sidebar/checks-panel/review-actions/use-checks-panel-ai-acknowledgement.tsx
+++ b/src/renderer/src/components/right-sidebar/checks-panel/review-actions/use-checks-panel-ai-acknowledgement.tsx
@@ -22,7 +22,7 @@ import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
import type { ChecksAgentComposerState } from '../panel-state-types'
import type { ChecksPanelReview } from '../checks-panel-review'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
type ChecksPanelAiAcknowledgementInput = Pick<
ChecksPanelControllerState,
diff --git a/src/renderer/src/components/right-sidebar/checks-panel/review-actions/use-checks-panel-check-and-review-actions.tsx b/src/renderer/src/components/right-sidebar/checks-panel/review-actions/use-checks-panel-check-and-review-actions.tsx
index 11e0f4247bc..d4b8576a42a 100644
--- a/src/renderer/src/components/right-sidebar/checks-panel/review-actions/use-checks-panel-check-and-review-actions.tsx
+++ b/src/renderer/src/components/right-sidebar/checks-panel/review-actions/use-checks-panel-check-and-review-actions.tsx
@@ -12,7 +12,7 @@ import {
} from '../../../../../../shared/source-control/checks/pr-checks-fix-prompt'
import { loadGitLabJobLogDetails } from '@/runtime/repository-gitlab/gitlab-job-trace-client'
-import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch'
+import { startFixChecksAgent } from '@/lib/source-control/checks/fix-checks-agent-launch'
import { openChecksPanelHostedReviewUrl } from './checks-panel-hosted-review-click-routing'
import { isMacPlatform } from '../../../terminal-pane/links/terminal-link-open-hints'
import { translate } from '@/i18n/i18n'
diff --git a/src/renderer/src/components/right-sidebar/file-explorer/panel/FileExplorerVirtualRows.tsx b/src/renderer/src/components/right-sidebar/file-explorer/panel/FileExplorerVirtualRows.tsx
index 61480ffdcaa..e3f13264006 100644
--- a/src/renderer/src/components/right-sidebar/file-explorer/panel/FileExplorerVirtualRows.tsx
+++ b/src/renderer/src/components/right-sidebar/file-explorer/panel/FileExplorerVirtualRows.tsx
@@ -5,7 +5,10 @@ import { cn } from '@/lib/utils'
import type { GitFileStatus } from '../../../../../../shared/git/status/git-status-types'
import { FileExplorerRow } from './FileExplorerRow'
import { InlineInputRow, type InlineInput } from '../mutations/file-explorer-inline-input-row'
-import { shouldShowIgnoredDecoration, STATUS_COLORS } from '../../../../lib/git-path-decoration'
+import {
+ shouldShowIgnoredDecoration,
+ STATUS_COLORS
+} from '../../../../lib/source-control/paths/git-path-decoration'
import type { DirCache, FileExplorerOperationOwner, TreeNode } from '../tree/file-explorer-types'
import type { FileExplorerRowProjection } from '../tree/file-explorer-row-projection'
import type { RuntimeFileOperationArgs } from '@/runtime/files/runtime-file-client-types'
diff --git a/src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-name-filter-projection.test.ts b/src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-name-filter-projection.test.ts
index de9b9d69367..6a5c1e31dcd 100644
--- a/src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-name-filter-projection.test.ts
+++ b/src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-name-filter-projection.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import { createNameFilteredFileExplorerProjection } from './file-explorer-name-filter-projection'
-import { buildIgnoredSet } from '../../../../lib/git-path-decoration'
+import { buildIgnoredSet } from '../../../../lib/source-control/paths/git-path-decoration'
describe('name-filter filename identity', () => {
function project(
diff --git a/src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-name-filter-projection.ts b/src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-name-filter-projection.ts
index 1e3842ce898..7db4e428f49 100644
--- a/src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-name-filter-projection.ts
+++ b/src/renderer/src/components/right-sidebar/file-explorer/tree/file-explorer-name-filter-projection.ts
@@ -16,7 +16,7 @@ import {
type FileExplorerRowProjection
} from './file-explorer-row-projection'
import { isDotfileRelativePath } from './file-explorer-entries'
-import { isPathIgnored } from '../../../../lib/git-path-decoration'
+import { isPathIgnored } from '../../../../lib/source-control/paths/git-path-decoration'
export type FileExplorerNameFilterProjectionSource = {
query: string
diff --git a/src/renderer/src/components/right-sidebar/file-explorer/tree/use-file-explorer-tree-pane-state.ts b/src/renderer/src/components/right-sidebar/file-explorer/tree/use-file-explorer-tree-pane-state.ts
index 96f040e7da1..d34bd9d6b9a 100644
--- a/src/renderer/src/components/right-sidebar/file-explorer/tree/use-file-explorer-tree-pane-state.ts
+++ b/src/renderer/src/components/right-sidebar/file-explorer/tree/use-file-explorer-tree-pane-state.ts
@@ -9,7 +9,10 @@ import type { Repo } from '../../../../../../shared/repo-types'
import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types'
import type { FileExplorerRowProjection } from './file-explorer-row-projection'
import type { TreeNode } from './file-explorer-types'
-import { buildFolderStatusMap, buildStatusMap } from '../../../../lib/git-path-decoration'
+import {
+ buildFolderStatusMap,
+ buildStatusMap
+} from '../../../../lib/source-control/paths/git-path-decoration'
import { useFileDeletion } from '../mutations/useFileDeletion'
import { useFileExplorerDragDrop } from '../mutations/useFileExplorerDragDrop'
import { useFileExplorerHandlers } from '../mutations/useFileExplorerHandlers'
diff --git a/src/renderer/src/components/right-sidebar/file-explorer/tree/useFileExplorerVisibleRowProjection.ts b/src/renderer/src/components/right-sidebar/file-explorer/tree/useFileExplorerVisibleRowProjection.ts
index 6d1365b46b0..39a2e9277f7 100644
--- a/src/renderer/src/components/right-sidebar/file-explorer/tree/useFileExplorerVisibleRowProjection.ts
+++ b/src/renderer/src/components/right-sidebar/file-explorer/tree/useFileExplorerVisibleRowProjection.ts
@@ -6,7 +6,10 @@ import {
createFileExplorerRowProjectionFromParts,
type FileExplorerRowProjection
} from './file-explorer-row-projection'
-import { buildIgnoredSet, isPathIgnored } from '../../../../lib/git-path-decoration'
+import {
+ buildIgnoredSet,
+ isPathIgnored
+} from '../../../../lib/source-control/paths/git-path-decoration'
import {
createNameFilteredFileExplorerProjection,
getFileExplorerNameFilterExpandedPaths,
diff --git a/src/renderer/src/components/right-sidebar/hosted-review/provider-actions/use-hosted-review-actions.ts b/src/renderer/src/components/right-sidebar/hosted-review/provider-actions/use-hosted-review-actions.ts
index e8c3372c464..492b7056a3a 100644
--- a/src/renderer/src/components/right-sidebar/hosted-review/provider-actions/use-hosted-review-actions.ts
+++ b/src/renderer/src/components/right-sidebar/hosted-review/provider-actions/use-hosted-review-actions.ts
@@ -19,7 +19,7 @@ import { translate } from '@/i18n/i18n'
import { getHostedReviewStateChangeCopy } from './hosted-review-state-change-copy'
import { buildGitHubPRStackMergeConfirmation } from './github-pr-stack-confirmation'
import { useReadyHostedReviewAction } from './use-ready-hosted-review-action'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export type HostedReviewActionInfo = Pick<
HostedReviewInfo,
diff --git a/src/renderer/src/components/right-sidebar/hosted-review/provider-actions/use-ready-hosted-review-action.ts b/src/renderer/src/components/right-sidebar/hosted-review/provider-actions/use-ready-hosted-review-action.ts
index 88041058383..28eb23a865e 100644
--- a/src/renderer/src/components/right-sidebar/hosted-review/provider-actions/use-ready-hosted-review-action.ts
+++ b/src/renderer/src/components/right-sidebar/hosted-review/provider-actions/use-ready-hosted-review-action.ts
@@ -5,7 +5,7 @@ import type { Repo } from '../../../../../../shared/repo-types'
import { translate } from '@/i18n/i18n'
import { markGitHubHostedReviewReadyForReview } from './hosted-review-github-actions'
import { markGitLabHostedReviewReadyForReview } from './hosted-review-gitlab-actions'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useReadyHostedReviewAction({
reviewNumber,
diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-commit-action.ts b/src/renderer/src/components/right-sidebar/source-control/commit/use-commit-action.ts
index c19f3ada631..341948f29ac 100644
--- a/src/renderer/src/components/right-sidebar/source-control/commit/use-commit-action.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-commit-action.ts
@@ -1,4 +1,5 @@
-import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/git-graph-tab'
+import '@/lib/source-control/graph/git-graph-tab'
+import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/source-control/graph/git-graph-refresh-event'
import { useCallback } from 'react'
import { toast } from 'sonner'
import { requireGitOwnerTarget } from '../sync/worktree-git-owner-target'
diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsx
index 671eb75db1b..4ab91678aff 100644
--- a/src/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/listing/branch-entry-row.tsx
@@ -15,7 +15,7 @@ import {
SOURCE_CONTROL_TREE_FILE_PADDING_PX,
SOURCE_CONTROL_TREE_INDENT_PX
} from './row-layout'
-import { STATUS_COLORS } from '../../../../lib/git-path-decoration'
+import { STATUS_COLORS } from '../../../../lib/source-control/paths/git-path-decoration'
import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels'
import { useTranslate } from '@/i18n/use-translate'
diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/sequencer-recovery-controls.test.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/sequencer-recovery-controls.test.tsx
index 1e40bcf651c..95849f0b337 100644
--- a/src/renderer/src/components/right-sidebar/source-control/listing/sequencer-recovery-controls.test.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/listing/sequencer-recovery-controls.test.tsx
@@ -4,7 +4,8 @@ import { createRoot } from 'react-dom/client'
import { expect, it, vi } from 'vitest'
import { useAppStore } from '@/store'
import { SequencerRecoveryControls } from './sequencer-recovery-controls'
-import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/git-graph-tab'
+import '@/lib/source-control/graph/git-graph-tab'
+import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/source-control/graph/git-graph-refresh-event'
import { local } from '@/components/editor/git-graph/git-graph-workspace.test-fixtures'
import type * as WorktreeGitCopy from '@/lib/worktree-git-copy'
import type { GitStatusResult } from '../../../../../../shared/git/status/git-status-types'
diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/sequencer-recovery-controls.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/sequencer-recovery-controls.tsx
index 08990451968..2c47a44df77 100644
--- a/src/renderer/src/components/right-sidebar/source-control/listing/sequencer-recovery-controls.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/listing/sequencer-recovery-controls.tsx
@@ -12,7 +12,8 @@ import {
sequencerAbortRuntimeGit,
sequencerContinueRuntimeGit
} from '@/runtime/source-control/git/runtime-git-commit-actions-client'
-import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/git-graph-tab'
+import '@/lib/source-control/graph/git-graph-tab'
+import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/source-control/graph/git-graph-refresh-event'
import { extractIpcErrorMessage } from '@/lib/ipc-error'
import { useSourceControlWorktreeContext } from './use-worktree-context'
import type { GitCommitAction } from '../../../../../../shared/git/commands/git-commit-action'
diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-entry-row.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-entry-row.tsx
index d7cc98880f9..7f0db7f23a5 100644
--- a/src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-entry-row.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-entry-row.tsx
@@ -35,7 +35,7 @@ import {
getSubmoduleWorktreeOnlyLabel,
getSubmoduleWorktreeOnlyTooltip
} from './row-layout'
-import { STATUS_COLORS } from '../../../../lib/git-path-decoration'
+import { STATUS_COLORS } from '../../../../lib/source-control/paths/git-path-decoration'
import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels'
export const UncommittedEntryRow = React.memo(function UncommittedEntryRow({
diff --git a/src/renderer/src/components/right-sidebar/source-control/notes/diff-comments-list.tsx b/src/renderer/src/components/right-sidebar/source-control/notes/diff-comments-list.tsx
index 15fdecb3e7b..bcb9315572a 100644
--- a/src/renderer/src/components/right-sidebar/source-control/notes/diff-comments-list.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/notes/diff-comments-list.tsx
@@ -1,7 +1,10 @@
import React, { useCallback, useMemo } from 'react'
import { Check, Copy, Trash, Trash2 } from 'lucide-react'
-import { getDiffCommentLineLabel, getDiffCommentSource } from '@/lib/diff-comment-compat'
-import { formatDiffComment } from '@/lib/diff-comments-format'
+import {
+ getDiffCommentLineLabel,
+ getDiffCommentSource
+} from '@/lib/source-control/review/comments/diff-comment-compat'
+import { formatDiffComment } from '../../../../../../shared/diff-comments-format'
import { translate } from '@/i18n/i18n'
import { useTranslate, type Translate } from '@/i18n/use-translate'
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
diff --git a/src/renderer/src/components/right-sidebar/source-control/notes/use-diff-comment-notes.ts b/src/renderer/src/components/right-sidebar/source-control/notes/use-diff-comment-notes.ts
index 7b6339dccb6..039cfc053ad 100644
--- a/src/renderer/src/components/right-sidebar/source-control/notes/use-diff-comment-notes.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/notes/use-diff-comment-notes.ts
@@ -5,7 +5,7 @@ import { useCallback, useMemo, useState } from 'react'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
-import { formatDiffComments } from '@/lib/diff-comments-format'
+import { formatDiffComments } from '../../../../../../shared/diff-comments-format'
import { describeClipboardWriteFailure } from '@/lib/clipboard/clipboard-write-failure'
import { useVisibleWorktreeDiffComments } from '../../../diff-comments/use-visible-worktree-diff-comments'
import {
diff --git a/src/renderer/src/components/right-sidebar/source-control/notes/use-note-opening.ts b/src/renderer/src/components/right-sidebar/source-control/notes/use-note-opening.ts
index e1e86bdd797..68d65154cb6 100644
--- a/src/renderer/src/components/right-sidebar/source-control/notes/use-note-opening.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/notes/use-note-opening.ts
@@ -1,6 +1,6 @@
import { useCallback, useRef, type RefObject } from 'react'
import { detectLanguage } from '../../../../../../shared/editor-language/editor-language-detect'
-import { getDiffCommentSource } from '@/lib/diff-comment-compat'
+import { getDiffCommentSource } from '@/lib/source-control/review/comments/diff-comment-compat'
import { joinPath } from '@/lib/path'
import { useAppStore } from '@/store'
import type {
diff --git a/src/renderer/src/components/right-sidebar/source-control/panel/panel-content.tsx b/src/renderer/src/components/right-sidebar/source-control/panel/panel-content.tsx
index 0e104397fea..122388ceffe 100644
--- a/src/renderer/src/components/right-sidebar/source-control/panel/panel-content.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/panel/panel-content.tsx
@@ -10,7 +10,7 @@ import { SourceControlCommitSurface } from './commit-surface'
import { SourceControlForkPushNotice } from './fork-push-notice'
import type { SourceControlPanelReadyProps } from './panel-props'
import { useSourceControlScope } from './worktree-scope'
-import { openGitGraph } from '@/lib/git-graph-tab'
+import { openGitGraph } from '@/lib/source-control/graph/git-graph-tab'
export function SourceControlPanelContent(props: SourceControlPanelReadyProps) {
const { activeWorktree, currentWorktreeId, model, worktreePath } = props
diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/git-graph-open-button.tsx b/src/renderer/src/components/right-sidebar/source-control/sync/git-graph-open-button.tsx
index 36f3bb4a35d..1d94e36e27c 100644
--- a/src/renderer/src/components/right-sidebar/source-control/sync/git-graph-open-button.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/sync/git-graph-open-button.tsx
@@ -8,7 +8,7 @@ import {
gitGraphUpdateMessage,
openGitGraph,
probeGitGraphSupport
-} from '@/lib/git-graph-tab'
+} from '@/lib/source-control/graph/git-graph-tab'
import { toSourceControlRowOpenEvent, type SourceControlRowOpenEvent } from '../listing/split-open'
import { useTranslate } from '@/i18n/use-translate'
import { CommitsHeaderIconButton } from './commits-header-icon-button'
diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-files.tsx b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-files.tsx
index 43fa5957e7b..20b6f9835f3 100644
--- a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-files.tsx
+++ b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-files.tsx
@@ -1,7 +1,7 @@
import { createElement } from 'react'
import type React from 'react'
import { ArrowUpRight } from 'lucide-react'
-import { STATUS_COLORS } from '../../../../lib/git-path-decoration'
+import { STATUS_COLORS } from '../../../../lib/source-control/paths/git-path-decoration'
import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels'
import {
toPermanentSourceControlRowOpenEvent,
diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/remote-refresh.ts b/src/renderer/src/components/right-sidebar/source-control/sync/remote-refresh.ts
index 9b5dce2f275..ee5ae306ccb 100644
--- a/src/renderer/src/components/right-sidebar/source-control/sync/remote-refresh.ts
+++ b/src/renderer/src/components/right-sidebar/source-control/sync/remote-refresh.ts
@@ -1,4 +1,5 @@
-import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/git-graph-tab'
+import '@/lib/source-control/graph/git-graph-tab'
+import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/source-control/graph/git-graph-refresh-event'
import {
isSyncPushStageError,
resolveRemoteOperationErrorMessage
diff --git a/src/renderer/src/components/settings/repository/RepositoryJiraProjectSection.tsx b/src/renderer/src/components/settings/repository/RepositoryJiraProjectSection.tsx
index a71074512db..08f418f4fe8 100644
--- a/src/renderer/src/components/settings/repository/RepositoryJiraProjectSection.tsx
+++ b/src/renderer/src/components/settings/repository/RepositoryJiraProjectSection.tsx
@@ -2,7 +2,7 @@ import { useMemo, useState } from 'react'
import type { Repo } from '../../../../../shared/repo-types'
import type { JiraProjectReference } from '../../../../../shared/jira/jira-project-reference'
import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
-import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
+import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import { useAppStore } from '@/store/index'
import { useJiraProjectInventory } from '../../use-jira-project-inventory'
import { JiraProjectPicker } from '../../jira-project-picker'
diff --git a/src/renderer/src/components/settings/skills/linear/LinearAgentSkillPane.tsx b/src/renderer/src/components/settings/skills/linear/LinearAgentSkillPane.tsx
index 3e987ae496d..164c5cc7dec 100644
--- a/src/renderer/src/components/settings/skills/linear/LinearAgentSkillPane.tsx
+++ b/src/renderer/src/components/settings/skills/linear/LinearAgentSkillPane.tsx
@@ -13,7 +13,7 @@ import { LinearIcon } from '@/components/icons/LinearIcon'
import { Button } from '@/components/ui/button'
import { useAppStore } from '@/store/index'
import { ORCA_LINEAR_SKILL_NAME } from '@/lib/skills/installation/agent-feature-skill-names'
-import { getLinearUsageExamples } from '@/lib/linear-usage-examples'
+import { getLinearUsageExamples } from '@/lib/work-items/linear/linear-usage-examples'
import type { SkillUsageExample } from '@/lib/skill-usage-example'
import { useLinearProviderConnected } from '@/hooks/useLinearProviderConnected'
import { normalizeVisibleTaskProviders } from '../../../../../../shared/work-items/task-providers'
diff --git a/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeDirtyChangeHint.tsx b/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeDirtyChangeHint.tsx
index f6a84b5fb72..b6e8a7dc42c 100644
--- a/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeDirtyChangeHint.tsx
+++ b/src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteWorktreeDirtyChangeHint.tsx
@@ -3,7 +3,7 @@ import type { JSX } from 'react'
import { AlertTriangle, ChevronRight } from 'lucide-react'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { useTranslate } from '@/i18n/use-translate'
-import { STATUS_COLORS } from '../../../../lib/git-path-decoration'
+import { STATUS_COLORS } from '../../../../lib/source-control/paths/git-path-decoration'
import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels'
import type {
DeleteWorktreeChangeCheckState,
diff --git a/src/renderer/src/components/sidebar/workspace-actions/deletion/delete-worktree-dirty-change-counts.ts b/src/renderer/src/components/sidebar/workspace-actions/deletion/delete-worktree-dirty-change-counts.ts
index 5de76b3bf39..4639b5fba93 100644
--- a/src/renderer/src/components/sidebar/workspace-actions/deletion/delete-worktree-dirty-change-counts.ts
+++ b/src/renderer/src/components/sidebar/workspace-actions/deletion/delete-worktree-dirty-change-counts.ts
@@ -7,7 +7,7 @@ import type { Worktree } from '../../../../../../shared/worktree/types'
import { getWorktreeHostIdentity } from '../../../../../../shared/worktree/host-qualified-identity'
import type { WorktreeDeleteState } from '../../../../store/slices/worktrees/teardown/worktree-delete-state-types'
import { normalizeRelativePath } from '../../../../../../shared/cross-platform-path'
-import { buildStatusMap } from '../../../../lib/git-path-decoration'
+import { buildStatusMap } from '../../../../lib/source-control/paths/git-path-decoration'
import { isFolderWorkspaceDelete } from './delete-worktree-dialog-copy'
import { getDeleteStateForWorktreeHost } from './worktree-delete-state-host-match'
diff --git a/src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-agent-startup.ts b/src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-agent-startup.ts
index cada97b508a..a7263c7bb24 100644
--- a/src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-agent-startup.ts
+++ b/src/renderer/src/components/sidebar/workspace-creation/folder/folder-workspace-agent-startup.ts
@@ -6,7 +6,7 @@ import type { LinkedWorkItemSummary } from '@/lib/new-workspace'
import { resolveRepoExecutionHostPlatform } from '@/runtime/hosts/platform/execution-host-facts'
import type { ExecutionHostPlatformFact } from '@/runtime/hosts/platform/execution-host-platform-fact'
import type { AppState } from '@/store/types'
-import { resolveQuickCreateLinkedWorkItemPrompt } from '@/lib/linked-work-item-context'
+import { resolveQuickCreateLinkedWorkItemPrompt } from '@/lib/work-items/linked-work-item-context'
import {
buildAgentDraftLaunchPlan,
buildAgentStartupPlan,
diff --git a/src/renderer/src/components/status-bar/workspace-space-changes.tsx b/src/renderer/src/components/status-bar/workspace-space-changes.tsx
index 3fbe14b977e..7d462d69988 100644
--- a/src/renderer/src/components/status-bar/workspace-space-changes.tsx
+++ b/src/renderer/src/components/status-bar/workspace-space-changes.tsx
@@ -7,7 +7,7 @@ import { VirtualizedList } from '../virtualized-list'
import { Badge } from '../ui/badge'
import { Input } from '../ui/input'
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
-import { STATUS_COLORS } from '../../lib/git-path-decoration'
+import { STATUS_COLORS } from '../../lib/source-control/paths/git-path-decoration'
import { STATUS_LABELS } from '../../../../shared/git/status/git-status-labels'
import { DiffLineCounts } from '../right-sidebar/source-control/listing/diff-line-counts'
import { openWorkspaceSpaceChange } from './workspace-space-open-change'
diff --git a/src/renderer/src/components/tab-bar/EditorFileTab.tsx b/src/renderer/src/components/tab-bar/EditorFileTab.tsx
index d87d57cbf97..bb2ea64f141 100644
--- a/src/renderer/src/components/tab-bar/EditorFileTab.tsx
+++ b/src/renderer/src/components/tab-bar/EditorFileTab.tsx
@@ -16,7 +16,7 @@ import { useWorktreeById } from '@/store/workspaces/selection/use-selected-workt
import { getOpenFileExecutionHostId } from '@/lib/workspace/ownership/unified-tab-host-ownership'
import { resolveReviewRepository } from '@/lib/review-owner'
import { useAppStore } from '@/store'
-import { STATUS_COLORS } from '../../lib/git-path-decoration'
+import { STATUS_COLORS } from '../../lib/source-control/paths/git-path-decoration'
import { STATUS_LABELS } from '../../../../shared/git/status/git-status-labels'
import { getUntitledFileRoot } from '@/components/editor/untitled-file-rename-path'
diff --git a/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts b/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts
index a55426ec7c7..214b32bda3f 100644
--- a/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts
+++ b/src/renderer/src/components/tab-bar/use-tab-bar-runtime-model.ts
@@ -5,7 +5,7 @@ import type { GlobalSettings } from '../../../../shared/global-settings-types'
import type { Tab } from '../../../../shared/tab-types'
import type { ProjectExecutionRuntimeResolution } from '../../../../shared/execution-host/project-execution-runtime'
import { useAppStore } from '../../store'
-import { buildStatusMap } from '../../lib/git-path-decoration'
+import { buildStatusMap } from '../../lib/source-control/paths/git-path-decoration'
import type { AgentDetectionTarget } from '@/hooks/useDetectedAgents'
import { useAgentDetectionTargetForWorktree } from '@/hooks/useAgentDetectionTarget'
import '@/lib/workspace/ownership/connection-context'
diff --git a/src/renderer/src/components/task-page/github/AssigneesCell.tsx b/src/renderer/src/components/task-page/github/AssigneesCell.tsx
index 2fbc866b909..49a6aefdd86 100644
--- a/src/renderer/src/components/task-page/github/AssigneesCell.tsx
+++ b/src/renderer/src/components/task-page/github/AssigneesCell.tsx
@@ -5,8 +5,8 @@ import type { TaskSourceContext } from '../../../../../shared/work-items/task-so
import React, { useMemo, useState, useCallback } from 'react'
import { useAppStore } from '@/store'
import { useShallow } from 'zustand/react/shallow'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
-import { parseGitHubIssueOrPRLink } from '@/lib/github-links'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
+import { parseGitHubIssueOrPRLink } from '../../../../../shared/github/links'
import { useRepoAssigneesBySlug } from '@/hooks/useGitHubSlugMetadata'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
@@ -19,7 +19,7 @@ import { LoaderCircle, ChevronDown, Check } from 'lucide-react'
import type { TaskPageGitHubWorkItemMutationRunner } from '../linear/task-page-linear-jira-list-model'
import { GitHubAssigneeAvatar } from './Avatars'
import { GitHubUserAvatar } from '@/components/github/github-user-avatar'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function GHAssigneesCell({
item,
repo,
diff --git a/src/renderer/src/components/task-page/github/Filters.tsx b/src/renderer/src/components/task-page/github/Filters.tsx
index 121d06fb3ac..a4ce6b59792 100644
--- a/src/renderer/src/components/task-page/github/Filters.tsx
+++ b/src/renderer/src/components/task-page/github/Filters.tsx
@@ -14,7 +14,7 @@ import { Button } from '@/components/ui/button'
import { resolveNewIssueOpenSeed } from '@/components/task-page/task-page-new-issue-draft'
import { useAppStore } from '@/store'
import { useShallow } from 'zustand/react/shallow'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { hasUpstreamCandidateDivergence, hasDivergentSources } from '../task-page-draft-storage'
import IssueSourceIndicator from '@/components/github/IssueSourceIndicator'
import IssueSourceSelector, { issueSourceChipClass } from '@/components/github/IssueSourceSelector'
diff --git a/src/renderer/src/components/task-page/github/IssueDialog.tsx b/src/renderer/src/components/task-page/github/IssueDialog.tsx
index 367161c0f1d..5bbccd592c5 100644
--- a/src/renderer/src/components/task-page/github/IssueDialog.tsx
+++ b/src/renderer/src/components/task-page/github/IssueDialog.tsx
@@ -1,6 +1,6 @@
import type { TaskPageComposerActionsModel } from '../use-task-page-composer-actions'
import { useRef, useState } from 'react'
-import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
+import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import {
Dialog,
DialogContent,
diff --git a/src/renderer/src/components/task-page/github/MergeCell.tsx b/src/renderer/src/components/task-page/github/MergeCell.tsx
index dafa8309829..770f48d0399 100644
--- a/src/renderer/src/components/task-page/github/MergeCell.tsx
+++ b/src/renderer/src/components/task-page/github/MergeCell.tsx
@@ -6,7 +6,7 @@ import React, { useState } from 'react'
import { useConfirmationDialog } from '@/components/confirmation-dialog-context'
import { useAppStore } from '@/store'
import { useShallow } from 'zustand/react/shallow'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { useTranslate } from '@/i18n/use-translate'
import {
getPullRequestMergeConfirmationTitle,
diff --git a/src/renderer/src/components/task-page/github/ReviewCell.tsx b/src/renderer/src/components/task-page/github/ReviewCell.tsx
index 026ec6d0b03..e97746ba058 100644
--- a/src/renderer/src/components/task-page/github/ReviewCell.tsx
+++ b/src/renderer/src/components/task-page/github/ReviewCell.tsx
@@ -5,7 +5,7 @@ import type { TaskSourceContext } from '../../../../../shared/work-items/task-so
import React, { useState, useMemo, useRef, useCallback } from 'react'
import { useAppStore } from '@/store'
import { useShallow } from 'zustand/react/shallow'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { useRepoAssigneesBySlug } from '@/hooks/useGitHubSlugMetadata'
import {
getGitHubPRReviewerQueryState,
diff --git a/src/renderer/src/components/task-page/github/Rows.tsx b/src/renderer/src/components/task-page/github/Rows.tsx
index 82dc2511b8d..38c983ef3e0 100644
--- a/src/renderer/src/components/task-page/github/Rows.tsx
+++ b/src/renderer/src/components/task-page/github/Rows.tsx
@@ -1,6 +1,6 @@
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
import type { TaskPageComposerActionsModel } from '../use-task-page-composer-actions'
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { findGithubWorkItemWorkspaceAttachment } from '@/lib/work-items/github/github-work-item-workspace-attachment'
import { getWorktreeAttachmentLabel } from '@/lib/worktree-attachment-label'
import { formatPRDelta } from '../task-page-pr-delta-summary'
diff --git a/src/renderer/src/components/task-page/github/StatusCell.tsx b/src/renderer/src/components/task-page/github/StatusCell.tsx
index 648c141cd72..342379469f3 100644
--- a/src/renderer/src/components/task-page/github/StatusCell.tsx
+++ b/src/renderer/src/components/task-page/github/StatusCell.tsx
@@ -10,8 +10,8 @@ import {
} from '@/components/task-page/github/task-page-github-status-state'
import { useAppStore } from '@/store'
import { useShallow } from 'zustand/react/shallow'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
-import { parseGitHubIssueOrPRLink } from '@/lib/github-links'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
+import { parseGitHubIssueOrPRLink } from '../../../../../shared/github/links'
import {
getTaskPageGitHubDuplicateCandidates,
validateTaskPageGitHubDuplicateTarget,
diff --git a/src/renderer/src/components/task-page/github/task-page-github-landing-refresh-run.tsx b/src/renderer/src/components/task-page/github/task-page-github-landing-refresh-run.tsx
index 086860b0ce5..121ef25c076 100644
--- a/src/renderer/src/components/task-page/github/task-page-github-landing-refresh-run.tsx
+++ b/src/renderer/src/components/task-page/github/task-page-github-landing-refresh-run.tsx
@@ -6,7 +6,7 @@ import {
TASK_PAGE_GITHUB_RESUME_FRESH_MS
} from '@/components/task-page/github/task-page-github-resume-cache'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
import { sortWorkItemsByNumber } from '../../../../../shared/work-items/work-item-order'
import { taskPageToGitHubApiPage } from '../../../../../shared/work-items/work-item-pagination'
import {
diff --git a/src/renderer/src/components/task-page/github/task-page-github-quiet-refresh-run.tsx b/src/renderer/src/components/task-page/github/task-page-github-quiet-refresh-run.tsx
index 3dc7839fbc9..af199d28ce3 100644
--- a/src/renderer/src/components/task-page/github/task-page-github-quiet-refresh-run.tsx
+++ b/src/renderer/src/components/task-page/github/task-page-github-quiet-refresh-run.tsx
@@ -26,7 +26,7 @@ import {
LAG_BACKOFF_MS
} from '@/components/task-page/github/task-page-github-work-item-quiet-adopt'
import { stripRepoQualifiers } from '../../../../../shared/work-items/task-query'
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import { taskPageToGitHubApiPage } from '../../../../../shared/work-items/work-item-pagination'
import { useAppStore } from '@/store/index'
diff --git a/src/renderer/src/components/task-page/github/use-task-page-github-detail.ts b/src/renderer/src/components/task-page/github/use-task-page-github-detail.ts
index a555ccdf184..33d1ce9948b 100644
--- a/src/renderer/src/components/task-page/github/use-task-page-github-detail.ts
+++ b/src/renderer/src/components/task-page/github/use-task-page-github-detail.ts
@@ -1,7 +1,7 @@
import type { TaskPageGitHubListStateModel } from './use-task-page-github-list-state'
import { useAppStore } from '@/store/index'
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import { useState, useMemo, useLayoutEffect, useCallback, useEffect } from 'react'
import type { ItemDialogTab } from '@/components/github/github-work-item-identity'
import { stripRepoQualifiers } from '../../../../../shared/work-items/task-query'
@@ -9,7 +9,7 @@ import { createTaskPageDialogWorkItemReader } from '@/components/task-page/task-
import { useTaskPageWorkItemsCacheSelection } from './use-task-page-work-items-cache-selection'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { GitLabWorkItem } from '../../../../../shared/gitlab-types'
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
import { startGitHubListScrollRestore } from './task-page-github-list-scroll-restore'
function getTaskPageScrollTop(
diff --git a/src/renderer/src/components/task-page/github/use-task-page-github-issue-creation.ts b/src/renderer/src/components/task-page/github/use-task-page-github-issue-creation.ts
index 5e3c94bb633..b3b9e1608a8 100644
--- a/src/renderer/src/components/task-page/github/use-task-page-github-issue-creation.ts
+++ b/src/renderer/src/components/task-page/github/use-task-page-github-issue-creation.ts
@@ -5,7 +5,7 @@ import { useAppStore } from '@/store/index'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
import { openAppHttpLink } from '@/lib/browser/navigation/app-http-link-open'
type TaskPageGitHubIssueCreationInput = Pick<
TaskPageWorkspaceActionsModel,
diff --git a/src/renderer/src/components/task-page/github/use-task-page-github-issue-draft.ts b/src/renderer/src/components/task-page/github/use-task-page-github-issue-draft.ts
index dc4433d4e1d..dc1a0e3cd2f 100644
--- a/src/renderer/src/components/task-page/github/use-task-page-github-issue-draft.ts
+++ b/src/renderer/src/components/task-page/github/use-task-page-github-issue-draft.ts
@@ -2,13 +2,13 @@ import type { TaskPageGitHubCacheReconciliationModel } from './use-task-page-git
import { useState, useMemo, useEffect } from 'react'
import type { GitHubAssignableUser } from '../../../../../shared/github/pull-request-types'
import { useAppStore } from '@/store/index'
-import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
+import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { useRepoLabels, useRepoAssignees } from '@/hooks/useGitHubRepoMetadata'
import {
resolveVanishedNewIssueRepoReset,
isNewIssueDraftContentful
} from '@/components/task-page/task-page-new-issue-draft'
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
export function useTaskPageGitHubIssueDraft(model: TaskPageGitHubCacheReconciliationModel) {
const { settings, repos, selectedRepos } = model
const [newIssueOpen, setNewIssueOpen] = useState(false)
diff --git a/src/renderer/src/components/task-page/github/use-task-page-github-list-state.ts b/src/renderer/src/components/task-page/github/use-task-page-github-list-state.ts
index 63aea6459bb..c014170602d 100644
--- a/src/renderer/src/components/task-page/github/use-task-page-github-list-state.ts
+++ b/src/renderer/src/components/task-page/github/use-task-page-github-list-state.ts
@@ -8,7 +8,7 @@ import {
getTaskPagePerRepoLimit
} from '../../../../../shared/work-items/work-item-pagination'
import { taskPageGitHubResumeCache } from '@/components/task-page/github/task-page-github-resume-cache'
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import { useAppStore } from '@/store/index'
import type { GitHubListRestoreWrite } from './task-page-github-list-scroll-restore'
export function useTaskPageGitHubListState(model: TaskPageProviderStateModel) {
diff --git a/src/renderer/src/components/task-page/github/use-task-page-github-mutation-state.ts b/src/renderer/src/components/task-page/github/use-task-page-github-mutation-state.ts
index 3dd16349c9a..d4310cf6cad 100644
--- a/src/renderer/src/components/task-page/github/use-task-page-github-mutation-state.ts
+++ b/src/renderer/src/components/task-page/github/use-task-page-github-mutation-state.ts
@@ -11,7 +11,7 @@ import type { TaskPageGitHubPatchWorkItem } from '@/components/task-page/github/
import { useAppStore } from '@/store/index'
import { useTaskPageGitHubWorkItemMutation } from '@/hooks/useTaskPageGitHubWorkItemMutation'
import { rebuildSoftHiddenKeysFromPendingAndSticky } from '@/components/task-page/github/task-page-github-work-item-mutation-composition'
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
import { useTaskPageSourceDisplay } from '../use-task-page-source-display'
export function useTaskPageGitHubMutationState(model: TaskPageLinearCreationStateModel) {
const {
diff --git a/src/renderer/src/components/task-page/github/use-task-page-github-search-pagination.ts b/src/renderer/src/components/task-page/github/use-task-page-github-search-pagination.ts
index 528f45143c0..c122de5c9e1 100644
--- a/src/renderer/src/components/task-page/github/use-task-page-github-search-pagination.ts
+++ b/src/renderer/src/components/task-page/github/use-task-page-github-search-pagination.ts
@@ -12,7 +12,7 @@ import { translate } from '@/i18n/i18n'
import { overlayPendingOnTaskPagePages } from '@/components/task-page/github/task-page-github-work-item-mutation-pages'
import { scopeGitHubTaskSearch } from '../../../../../shared/work-items/task-github-search'
import { useGitHubTaskSearchCommit } from '@/components/use-github-task-search-commit'
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
export function useTaskPageGitHubSearchPagination(model: TaskPageGitHubListProjectionModel) {
const {
setTaskResumeState,
diff --git a/src/renderer/src/components/task-page/github/use-task-page-pr-check-hydration.ts b/src/renderer/src/components/task-page/github/use-task-page-pr-check-hydration.ts
index a636a20f90d..173d259ba8b 100644
--- a/src/renderer/src/components/task-page/github/use-task-page-pr-check-hydration.ts
+++ b/src/renderer/src/components/task-page/github/use-task-page-pr-check-hydration.ts
@@ -11,8 +11,11 @@ import {
subscribeLocalRuntimeCapabilityObservation
} from '@/runtime/hosts/capabilities/local-runtime-capabilities'
import { useAppStore } from '@/store'
-import { capturePRCheckContract, type PRCheckContract } from '@/lib/pr-check-observation-contract'
-import { getGitHubSourceRuntimeTarget } from '@/lib/github-source-runtime-context'
+import {
+ capturePRCheckContract,
+ type PRCheckContract
+} from '@/lib/source-control/checks/pr-check-observation-contract'
+import { getGitHubSourceRuntimeTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { lookupGitHubWorkItemByOwnerRepoForSource } from '@/lib/work-items/github/github-work-item-source-lookup'
import { resolvePullRequestRepo } from '@/components/github/github-work-item-identity'
import {
@@ -20,12 +23,12 @@ import {
projectPRCheckOwner,
completePRCheckOwnerScope
} from '../../../../../shared/github/complete-pr-check-owner'
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskPageJiraCreationMetadataModel } from '../jira/use-task-page-jira-creation-metadata'
import { deriveTaskPagePRCheckSummary } from '../task-page-pr-check-summary'
import { PR_CHECKS_EAGER_PREFETCH_LIMIT } from '../task-page-source-context'
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
import { sameOptionalGitHubOwnerRepo } from './task-page-github-review-model'
import { recomputeOn } from '@/lib/recompute-on'
export function useTaskPagePRCheckHydration(
diff --git a/src/renderer/src/components/task-page/gitlab/use-task-page-gitlab-loading.ts b/src/renderer/src/components/task-page/gitlab/use-task-page-gitlab-loading.ts
index fba2f991ea7..8d55a37517b 100644
--- a/src/renderer/src/components/task-page/gitlab/use-task-page-gitlab-loading.ts
+++ b/src/renderer/src/components/task-page/gitlab/use-task-page-gitlab-loading.ts
@@ -11,7 +11,7 @@ import type { Repo } from '../../../../../shared/repo-types'
import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
import type { GitLabDialogRepoSelector } from '../../gitlab-item-dialog/gitlab-item-dialog-types'
import type { GitLabWorkItem, GitLabTodo } from '../../../../../shared/gitlab-types'
-import { getTaskPageRepoSourceContext } from '../../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../../lib/work-items/task-repo-source-context'
import { isGitLabIssueFilter, isGitLabMRFilter } from '../task-page-source-context'
// Leave headroom below the runtime RPC foreground concurrency of eight for sidebar and other callers.
diff --git a/src/renderer/src/components/task-page/jira/task-page-jira-board.tsx b/src/renderer/src/components/task-page/jira/task-page-jira-board.tsx
index c30c5253538..344c8c8403c 100644
--- a/src/renderer/src/components/task-page/jira/task-page-jira-board.tsx
+++ b/src/renderer/src/components/task-page/jira/task-page-jira-board.tsx
@@ -15,8 +15,8 @@ import {
import {
readJiraBoardIssueDragData,
writeJiraBoardIssueDragData
-} from '@/lib/jira-board-drag-payload'
-import type { JiraBoardIssueDragRef } from '@/lib/jira-board-drag-payload'
+} from '@/lib/work-items/jira/jira-board-drag-payload'
+import type { JiraBoardIssueDragRef } from '@/lib/work-items/jira/jira-board-drag-payload'
import type { JiraIssue, JiraProjectStatusOrder } from '../../../../../shared/jira/jira-types'
import {
buildJiraBoardSections,
diff --git a/src/renderer/src/components/task-page/jira/task-page-jira-item-source-context.ts b/src/renderer/src/components/task-page/jira/task-page-jira-item-source-context.ts
index 41076a67266..570bc86d104 100644
--- a/src/renderer/src/components/task-page/jira/task-page-jira-item-source-context.ts
+++ b/src/renderer/src/components/task-page/jira/task-page-jira-item-source-context.ts
@@ -1,5 +1,5 @@
import type { JiraIssue, JiraSite } from '../../../../../shared/jira/jira-types'
-import { getJiraAccountLabel } from '@/lib/jira-account-label'
+import { getJiraAccountLabel } from '@/lib/work-items/jira/jira-account-label'
import {
normalizeTaskSourceContext,
type TaskSourceContext
diff --git a/src/renderer/src/components/task-page/jira/task-page-jira-linked-issues.ts b/src/renderer/src/components/task-page/jira/task-page-jira-linked-issues.ts
index c11a6852009..f7dd8ccabf2 100644
--- a/src/renderer/src/components/task-page/jira/task-page-jira-linked-issues.ts
+++ b/src/renderer/src/components/task-page/jira/task-page-jira-linked-issues.ts
@@ -1,5 +1,5 @@
import type { JiraIssue } from '../../../../../shared/jira/jira-types'
-import type { LinkedJiraIssueRef } from '@/lib/jira-issue-workspace-attachment'
+import type { LinkedJiraIssueRef } from '@/lib/work-items/jira/jira-issue-workspace-attachment'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { readLinkedTaskIssuesWithLimit } from '../../read-linked-task-issues'
import { createTaskPageJiraLoadFailureState } from './task-page-jira-load-state'
diff --git a/src/renderer/src/components/task-page/jira/use-task-page-jira-issue-creation.ts b/src/renderer/src/components/task-page/jira/use-task-page-jira-issue-creation.ts
index 6439bbc1b56..f7ee09e20de 100644
--- a/src/renderer/src/components/task-page/jira/use-task-page-jira-issue-creation.ts
+++ b/src/renderer/src/components/task-page/jira/use-task-page-jira-issue-creation.ts
@@ -1,4 +1,7 @@
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import type { TaskPageLinearIssueCreationModel } from '../linear/use-task-page-linear-issue-creation'
import { useCallback } from 'react'
import {
diff --git a/src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts b/src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts
index 410b166efed..5e5afd56182 100644
--- a/src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts
+++ b/src/renderer/src/components/task-page/jira/use-task-page-jira-list-projection.ts
@@ -11,7 +11,7 @@ import {
buildJiraIssueWorkspaceAttachmentIndex,
collectLinkedJiraIssueRefs,
findJiraIssueWorkspaceAttachmentsInIndex
-} from '@/lib/jira-issue-workspace-attachment'
+} from '@/lib/work-items/jira/jira-issue-workspace-attachment'
import { filterLinkedJiraIssues } from './task-page-jira-linked-issues'
import { sortJiraIssues } from '../../jira-issue-sorter'
export function useTaskPageJiraListProjection(model: TaskPageLinearBoardModel) {
diff --git a/src/renderer/src/components/task-page/jira/use-task-page-jira-summary-generation.ts b/src/renderer/src/components/task-page/jira/use-task-page-jira-summary-generation.ts
index 6b2a85b70e9..7591e04c784 100644
--- a/src/renderer/src/components/task-page/jira/use-task-page-jira-summary-generation.ts
+++ b/src/renderer/src/components/task-page/jira/use-task-page-jira-summary-generation.ts
@@ -1,4 +1,7 @@
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { createNonSecureContextUuid as createBrowserUuid } from '../../../../../shared/non-secure-context-uuid'
import { isWebClientLocation } from '@/lib/web-client-location'
diff --git a/src/renderer/src/components/task-page/linear/task-page-linear-issue-model.tsx b/src/renderer/src/components/task-page/linear/task-page-linear-issue-model.tsx
index 093c68145f2..708ca04cea6 100644
--- a/src/renderer/src/components/task-page/linear/task-page-linear-issue-model.tsx
+++ b/src/renderer/src/components/task-page/linear/task-page-linear-issue-model.tsx
@@ -1,6 +1,6 @@
import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { writeLinearIssue } from '@/lib/work-items/linear/linear-issue-write'
-import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import type { LinearIssue } from '../../../../../shared/linear/issue-types'
import type { LinearCustomViewModel } from '../../../../../shared/linear/project-types'
import type {
diff --git a/src/renderer/src/components/task-page/linear/use-task-page-linear-board.ts b/src/renderer/src/components/task-page/linear/use-task-page-linear-board.ts
index f3146f40ade..a5abaaf64be 100644
--- a/src/renderer/src/components/task-page/linear/use-task-page-linear-board.ts
+++ b/src/renderer/src/components/task-page/linear/use-task-page-linear-board.ts
@@ -1,13 +1,13 @@
import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { writeLinearIssue } from '@/lib/work-items/linear/linear-issue-write'
-import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import type { TaskPageLinearListProjectionModel } from './use-task-page-linear-list-projection'
import React, { useMemo, useCallback } from 'react'
import type { LinearIssue } from '../../../../../shared/linear/issue-types'
import {
writeLinearBoardIssueDragData,
readLinearBoardIssueDragData
-} from '@/lib/linear-board-drag-payload'
+} from '@/lib/work-items/linear/linear-board-drag-payload'
import { linearTeamStates } from '@/runtime/linear/runtime-linear-project-client'
import { linearUpdateIssue } from '@/runtime/linear/runtime-linear-issue-client'
import { toast } from 'sonner'
diff --git a/src/renderer/src/components/task-page/linear/use-task-page-linear-collection-effects.ts b/src/renderer/src/components/task-page/linear/use-task-page-linear-collection-effects.ts
index 2b009a9d1cd..dcc217fa5f8 100644
--- a/src/renderer/src/components/task-page/linear/use-task-page-linear-collection-effects.ts
+++ b/src/renderer/src/components/task-page/linear/use-task-page-linear-collection-effects.ts
@@ -1,6 +1,6 @@
import { observeLinearIssueRead } from '@/store/slices/linear/linear-issue-read-lifecycle'
-import { linearIssueReadError } from '@/lib/linear-read-error'
-import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import { linearIssueReadError } from '@/lib/work-items/linear/linear-read-error'
+import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import { translate } from '@/i18n/i18n'
import type { TaskPageLinearInOrcaEffectsModel } from './use-task-page-linear-in-orca-effects'
import { useEffect } from 'react'
diff --git a/src/renderer/src/components/task-page/linear/use-task-page-linear-custom-view-effects.ts b/src/renderer/src/components/task-page/linear/use-task-page-linear-custom-view-effects.ts
index 86aef6683dc..097e5fa787d 100644
--- a/src/renderer/src/components/task-page/linear/use-task-page-linear-custom-view-effects.ts
+++ b/src/renderer/src/components/task-page/linear/use-task-page-linear-custom-view-effects.ts
@@ -1,6 +1,6 @@
import { observeLinearIssueRead } from '@/store/slices/linear/linear-issue-read-lifecycle'
-import { linearIssueReadError } from '@/lib/linear-read-error'
-import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import { linearIssueReadError } from '@/lib/work-items/linear/linear-read-error'
+import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import type { TaskPageLinearInOrcaEffectsModel } from './use-task-page-linear-in-orca-effects'
import { useEffect } from 'react'
import {
diff --git a/src/renderer/src/components/task-page/linear/use-task-page-linear-issue-creation.ts b/src/renderer/src/components/task-page/linear/use-task-page-linear-issue-creation.ts
index cc016965807..b803039c4fd 100644
--- a/src/renderer/src/components/task-page/linear/use-task-page-linear-issue-creation.ts
+++ b/src/renderer/src/components/task-page/linear/use-task-page-linear-issue-creation.ts
@@ -1,6 +1,6 @@
import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { observeLinearIssueRead } from '@/store/slices/linear/linear-issue-read-lifecycle'
-import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import type { TaskPageLinearProjectCreationModel } from './use-task-page-linear-project-creation'
import { useCallback, useLayoutEffect, useMemo, useRef } from 'react'
import { toast } from 'sonner'
diff --git a/src/renderer/src/components/task-page/linear/use-task-page-linear-list-effects.ts b/src/renderer/src/components/task-page/linear/use-task-page-linear-list-effects.ts
index 475852081cb..f7365e19ce4 100644
--- a/src/renderer/src/components/task-page/linear/use-task-page-linear-list-effects.ts
+++ b/src/renderer/src/components/task-page/linear/use-task-page-linear-list-effects.ts
@@ -4,7 +4,7 @@ import {
} from '@/store/slices/linear/linear-issue-read-lifecycle'
import type { LinearIssue } from '../../../../../shared/linear/issue-types'
import type { LinearCollectionResult } from '../../../../../shared/linear/workspace-types'
-import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import type { TaskPageGlobalEffectsModel } from '../use-task-page-global-effects'
import { useEffect } from 'react'
import { isIntegrationCredentialDecryptionError } from '../../../../../shared/integration-credential-errors'
@@ -18,7 +18,7 @@ import {
buildLinearIssueListRequestSignature
} from '@/components/task-page/linear/task-page-linear-issue-request'
import { linearIssueAttributeFilterSignature } from '../../../../../shared/linear/issue-attribute-filter'
-import { linearIssueReadError } from '@/lib/linear-read-error'
+import { linearIssueReadError } from '@/lib/work-items/linear/linear-read-error'
import {
taskPageLinearIssuesHaveMore,
reconcileTaskPageLinearIssuesAfterLandingRefresh
diff --git a/src/renderer/src/components/task-page/linear/use-task-page-linear-list-selection.ts b/src/renderer/src/components/task-page/linear/use-task-page-linear-list-selection.ts
index 3ae96b3f058..13a01d43e64 100644
--- a/src/renderer/src/components/task-page/linear/use-task-page-linear-list-selection.ts
+++ b/src/renderer/src/components/task-page/linear/use-task-page-linear-list-selection.ts
@@ -1,4 +1,4 @@
-import { linearIssueReadError } from '@/lib/linear-read-error'
+import { linearIssueReadError } from '@/lib/work-items/linear/linear-read-error'
import type { TaskPageProviderMetadataModel } from '../use-task-page-provider-metadata'
import { useState, useMemo, useEffect } from 'react'
import { LINEAR_ISSUE_LIST_MAX } from '../../../../../shared/linear/issue-read-limits'
diff --git a/src/renderer/src/components/task-page/linear/use-task-page-linear-project-creation.ts b/src/renderer/src/components/task-page/linear/use-task-page-linear-project-creation.ts
index 11de9eecb77..e1b353e3ceb 100644
--- a/src/renderer/src/components/task-page/linear/use-task-page-linear-project-creation.ts
+++ b/src/renderer/src/components/task-page/linear/use-task-page-linear-project-creation.ts
@@ -1,4 +1,7 @@
-import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
+import {
+ taskProviderErrorMessage,
+ taskProviderErrorText
+} from '@/lib/work-items/task-provider-error-copy'
import type { TaskPageGitHubIssueCreationModel } from '../github/use-task-page-github-issue-creation'
import { useCallback } from 'react'
import { linearCreateProject } from '@/runtime/linear/runtime-linear-project-client'
diff --git a/src/renderer/src/components/task-page/task-page-cache-selectors.ts b/src/renderer/src/components/task-page/task-page-cache-selectors.ts
index 333193eb6e6..5f281500fa2 100644
--- a/src/renderer/src/components/task-page/task-page-cache-selectors.ts
+++ b/src/renderer/src/components/task-page/task-page-cache-selectors.ts
@@ -1,6 +1,6 @@
import { shallow } from 'zustand/shallow'
import { workItemsCacheKey } from '@/store/github/cache/cache-identity'
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import type { Repo } from '../../../../shared/repo-types'
import { getRepoExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host'
import type {
diff --git a/src/renderer/src/components/task-page/task-page-source-context.tsx b/src/renderer/src/components/task-page/task-page-source-context.tsx
index 0b4af39c83e..986f4a8f712 100644
--- a/src/renderer/src/components/task-page/task-page-source-context.tsx
+++ b/src/renderer/src/components/task-page/task-page-source-context.tsx
@@ -1,9 +1,9 @@
import { githubCandidateOwner } from '@/store/github/sources/source-preference-ownership'
-import { getTaskPageRepoSourceContext } from '@/lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '@/lib/work-items/task-repo-source-context'
export {
getTaskPageRepoSourceContext,
buildGitLabProviderIdentity
-} from '@/lib/task-repo-source-context'
+} from '@/lib/work-items/task-repo-source-context'
import type {
GitLabTaskFilter,
GitLabIssueFilter
@@ -17,7 +17,7 @@ import {
getLinkedWorkItemWorkspaceName,
getLinkedWorkItemSuggestedName
} from '../../../../shared/workspace-name'
-import { getJiraIssueKeyCasingSeedOptions } from '@/lib/jira-issue-key-casing'
+import { getJiraIssueKeyCasingSeedOptions } from '@/lib/work-items/jira/jira-issue-key-casing'
import {
type TaskSourceContext,
getTaskSourceCacheScope
diff --git a/src/renderer/src/components/task-page/use-task-page-composer-actions.ts b/src/renderer/src/components/task-page/use-task-page-composer-actions.ts
index 6a5d04f11c4..1cc1e63e0c3 100644
--- a/src/renderer/src/components/task-page/use-task-page-composer-actions.ts
+++ b/src/renderer/src/components/task-page/use-task-page-composer-actions.ts
@@ -3,7 +3,7 @@ import { useCallback } from 'react'
import type { LinearIssue } from '../../../../shared/linear/issue-types'
import type { LinearWorkspaceSelection } from '../../../../shared/linear/workspace-types'
import type { JiraIssue } from '../../../../shared/jira/jira-types'
-import { buildLinearIssueLinkedWorkItem } from '@/lib/linear-linked-work-item'
+import { buildLinearIssueLinkedWorkItem } from '@/lib/work-items/linear/linear-linked-work-item'
import { getLinearIssueWorkspaceName } from '../../../../shared/workspace-name'
import { useAppStore } from '@/store'
import { openLinearIssueWorkspaceOrStart } from '@/lib/work-items/linear/linear-issue-workspace-open'
diff --git a/src/renderer/src/components/task-page/use-task-page-repo-selection.ts b/src/renderer/src/components/task-page/use-task-page-repo-selection.ts
index 4dc1783eab9..a3a437f3f21 100644
--- a/src/renderer/src/components/task-page/use-task-page-repo-selection.ts
+++ b/src/renderer/src/components/task-page/use-task-page-repo-selection.ts
@@ -28,7 +28,7 @@ import {
} from '@/components/task-page/task-page-localized-options'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
-import { getTaskPageRepoSourceContext } from '../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../lib/work-items/task-repo-source-context'
export function useTaskPageRepoSelection(model: TaskPageStoreBindingsModel) {
const {
settings,
diff --git a/src/renderer/src/components/task-page/use-task-page-runtime-hosts.ts b/src/renderer/src/components/task-page/use-task-page-runtime-hosts.ts
index f84c139e7c7..76157271df3 100644
--- a/src/renderer/src/components/task-page/use-task-page-runtime-hosts.ts
+++ b/src/renderer/src/components/task-page/use-task-page-runtime-hosts.ts
@@ -14,7 +14,7 @@ import { parseExecutionHostId } from '../../../../shared/execution-host'
import { TASK_SOURCE_CONTEXT_RUNTIME_CAPABILITY } from '../../../../shared/work-items/task-source-runtime-capabilities'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import type { PreflightStatus } from '../../../../preload/api/preflight-api'
-import { getTaskPageRepoSourceContext } from '../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../lib/work-items/task-repo-source-context'
export function useTaskPageRuntimeHosts(model: TaskPageRepoSelectionModel) {
const {
settings,
diff --git a/src/renderer/src/components/task-page/use-task-page-source-availability.ts b/src/renderer/src/components/task-page/use-task-page-source-availability.ts
index 89ae7e65b6f..e0d9ab57bba 100644
--- a/src/renderer/src/components/task-page/use-task-page-source-availability.ts
+++ b/src/renderer/src/components/task-page/use-task-page-source-availability.ts
@@ -1,8 +1,8 @@
import type { TaskPageRuntimeHostsModel } from './use-task-page-runtime-hosts'
import { useCallback, useMemo } from 'react'
-import { getJiraAccountLabel } from '@/lib/jira-account-label'
+import { getJiraAccountLabel } from '@/lib/work-items/jira/jira-account-label'
import type { Repo } from '../../../../shared/repo-types'
-import { getTaskPageRepoSourceContext } from '../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../lib/work-items/task-repo-source-context'
import { getTaskSourceHostAvailabilityForHost } from './task-page-source-context'
import type { TaskSourceHostAvailability } from '../task-source-context-summary'
import { getRepoBackedProviderAvailability } from '@/components/task-source-provider-availability'
diff --git a/src/renderer/src/components/task-page/use-task-page-source-display.test.tsx b/src/renderer/src/components/task-page/use-task-page-source-display.test.tsx
index 0a4a46ca7ba..dbcb631b11b 100644
--- a/src/renderer/src/components/task-page/use-task-page-source-display.test.tsx
+++ b/src/renderer/src/components/task-page/use-task-page-source-display.test.tsx
@@ -10,7 +10,7 @@ import { createGlobalSettingsFixture } from '../../../../shared/global-settings-
import type { GitHubOwnerRepo } from '../../../../shared/github/pull-request-types'
import type { Repo } from '../../../../shared/repo-types'
-import { getTaskPageRepoSourceContext } from '../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../lib/work-items/task-repo-source-context'
import {
Q1,
diff --git a/src/renderer/src/components/task-page/use-task-page-source-summary.ts b/src/renderer/src/components/task-page/use-task-page-source-summary.ts
index 574b4eceeed..52173f7734a 100644
--- a/src/renderer/src/components/task-page/use-task-page-source-summary.ts
+++ b/src/renderer/src/components/task-page/use-task-page-source-summary.ts
@@ -7,7 +7,7 @@ import type {
} from '../task-source-context-summary'
import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context'
import { getTaskSourceHostAvailabilityForHost } from './task-page-source-context'
-import { getTaskPageRepoSourceContext } from '../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../lib/work-items/task-repo-source-context'
import { getRepoBackedProviderAvailability } from '@/components/task-source-provider-availability'
import { getTaskSourceAvailabilityNotice } from '../task-source-context-summary'
import { getRepoBackedTaskEmptyState } from './task-page-empty-state'
diff --git a/src/renderer/src/components/task-page/use-task-page-workspace-actions.ts b/src/renderer/src/components/task-page/use-task-page-workspace-actions.ts
index a9274cb48e9..859366393d8 100644
--- a/src/renderer/src/components/task-page/use-task-page-workspace-actions.ts
+++ b/src/renderer/src/components/task-page/use-task-page-workspace-actions.ts
@@ -4,7 +4,7 @@ import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import type { LinkedWorkItemSummary } from '@/lib/new-workspace'
import { useAppStore } from '@/store'
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { findGithubWorkItemWorkspaceAttachment } from '@/lib/work-items/github/github-work-item-workspace-attachment'
import { activateAndRevealWorktree } from '@/lib/workspace/activation/worktree-activation'
import { toast } from 'sonner'
@@ -13,7 +13,7 @@ import {
getGitHubWorkItemWorkspaceSeed,
getGitLabWorkItemWorkspaceSeed
} from './task-page-source-context'
-import { getTaskPageRepoSourceContext } from '../../lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../../lib/work-items/task-repo-source-context'
type TaskPageWorkspaceActionsInput = Pick
export function useTaskPageWorkspaceActions(
diff --git a/src/renderer/src/components/use-jira-issue-comment-submission.ts b/src/renderer/src/components/use-jira-issue-comment-submission.ts
index c656b319593..9d0c5985da5 100644
--- a/src/renderer/src/components/use-jira-issue-comment-submission.ts
+++ b/src/renderer/src/components/use-jira-issue-comment-submission.ts
@@ -4,7 +4,7 @@ import type { Dispatch, RefObject, SetStateAction } from 'react'
import type { JiraComment, JiraIssue } from '../../../shared/jira/jira-types'
import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import { createNonSecureContextUuid as createBrowserUuid } from '../../../shared/non-secure-context-uuid'
-import { getCommentBodySubmitState } from '@/lib/comment-body-submit-state'
+import { getCommentBodySubmitState } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { jiraAddIssueCommentForTarget } from '@/runtime/jira/runtime-jira-detail-client'
diff --git a/src/renderer/src/components/use-jira-project-inventory.ts b/src/renderer/src/components/use-jira-project-inventory.ts
index 4c04c6b5a11..4d3a5e6d2ff 100644
--- a/src/renderer/src/components/use-jira-project-inventory.ts
+++ b/src/renderer/src/components/use-jira-project-inventory.ts
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
import type { JiraProject } from '../../../shared/jira/jira-types'
import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
-import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
+import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import {
jiraListProjectsForTarget,
jiraStatusForTarget
diff --git a/src/renderer/src/components/worktree-jump/use-worktree-jump-palette-quick-actions.ts b/src/renderer/src/components/worktree-jump/use-worktree-jump-palette-quick-actions.ts
index dfed5ff1c1c..74641f3c290 100644
--- a/src/renderer/src/components/worktree-jump/use-worktree-jump-palette-quick-actions.ts
+++ b/src/renderer/src/components/worktree-jump/use-worktree-jump-palette-quick-actions.ts
@@ -3,7 +3,7 @@ import {
gitGraphSupport,
gitGraphUpdateMessage,
probeGitGraphSupport
-} from '@/lib/git-graph-tab'
+} from '@/lib/source-control/graph/git-graph-tab'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useAppStore } from '@/store/index'
import { runWorktreeDelete } from '@/components/sidebar/workspace-actions/deletion/delete-worktree-flow'
diff --git a/src/renderer/src/components/worktree-jump/worktree-jump-palette-create-worktree.ts b/src/renderer/src/components/worktree-jump/worktree-jump-palette-create-worktree.ts
index f8094cf38dd..b6ac24150d0 100644
--- a/src/renderer/src/components/worktree-jump/worktree-jump-palette-create-worktree.ts
+++ b/src/renderer/src/components/worktree-jump/worktree-jump-palette-create-worktree.ts
@@ -18,7 +18,7 @@ import { getIndexedRepoMap } from '@/store/repos/repository-catalog-index'
import { useAppStore } from '@/store/index'
import { isGitRepoKind } from '../../../../shared/repo-kind'
import { buildTaskSourceContextFromRepo } from '../../../../shared/work-items/task-source-context'
-import { buildLinearIssueComposerData } from '@/lib/linear-linked-work-item'
+import { buildLinearIssueComposerData } from '@/lib/work-items/linear/linear-linked-work-item'
import { isWorktreePaletteCreateActivationAllowed } from '@/lib/workspace/search/worktrees/worktree-palette-create-action'
export function createWorktreeJumpPaletteWorktreeHandler({
diff --git a/src/renderer/src/hooks/composer-state/async-composer-state.ts b/src/renderer/src/hooks/composer-state/async-composer-state.ts
index 0cfcd1d5acb..6f0a3a7b735 100644
--- a/src/renderer/src/hooks/composer-state/async-composer-state.ts
+++ b/src/renderer/src/hooks/composer-state/async-composer-state.ts
@@ -30,7 +30,7 @@ import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import { CONTEXTUAL_TOUR_ENABLE_AUTO_WORKSPACE_NAME_EVENT } from '@/components/contextual-tours/contextual-tour-composer-events'
import type { GitHubRepositoryIdentity } from '../../../../shared/github/pull-request-types'
import { getRepoSetupAgentStartupPolicy } from './setup-policy-decisions'
-import { getJiraIssueKeyCasingSeedOptions } from '@/lib/jira-issue-key-casing'
+import { getJiraIssueKeyCasingSeedOptions } from '@/lib/work-items/jira/jira-issue-key-casing'
import type {
SmartGitHubPrStartPointSelection,
SmartSourceSelection
diff --git a/src/renderer/src/hooks/composer-state/derived-composer-state.ts b/src/renderer/src/hooks/composer-state/derived-composer-state.ts
index 738291040af..1cc8bfba767 100644
--- a/src/renderer/src/hooks/composer-state/derived-composer-state.ts
+++ b/src/renderer/src/hooks/composer-state/derived-composer-state.ts
@@ -4,12 +4,12 @@ import { useMemo } from 'react'
import { normalizeSparseDirectoryLines, sparseDirectoriesMatch } from '@/lib/sparse-paths'
import {
parseGitHubIssueOrPRNumber,
- parseGitHubIssueOrPRLink,
- normalizeGitHubLinkQuery
-} from '@/lib/github-links'
+ parseGitHubIssueOrPRLink
+} from '../../../../shared/github/links'
+import { normalizeGitHubLinkQuery } from '../../../../shared/new-workspace/github-links'
import { githubRepoIdentityKey } from '../../../../shared/github/repository-identity-key'
+import { getWorkspaceSourceProvider } from '../../../../shared/new-workspace/workspace-source'
import {
- getLinkedWorkItemProvider,
canUseIssueCommandForLinkedItemProvider,
getWorkspaceSeedName,
DEFAULT_ISSUE_COMMAND_TEMPLATE,
@@ -139,7 +139,7 @@ export function useDerivedComposerState(input: DerivedComposerStateInput) {
selectedRepoIsGit,
isSetupCheckPending
)
- const linkedWorkItemProvider = linkedWorkItem ? getLinkedWorkItemProvider(linkedWorkItem) : null
+ const linkedWorkItemProvider = linkedWorkItem ? getWorkspaceSourceProvider(linkedWorkItem) : null
// Blank unseeded names need globally unique creature names; exclude retired paths too.
const retiredNamesRefreshKey = useMemo(
diff --git a/src/renderer/src/hooks/composer-state/derived-model.ts b/src/renderer/src/hooks/composer-state/derived-model.ts
index 2e05511fbd7..1c4270b3568 100644
--- a/src/renderer/src/hooks/composer-state/derived-model.ts
+++ b/src/renderer/src/hooks/composer-state/derived-model.ts
@@ -2,7 +2,7 @@ import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import type { OrcaHooks, SetupRunPolicy } from '../../../../shared/orca-yaml-hook-types'
import type { SparsePreset } from '../../../../shared/worktree/create-types'
import type { RetiredNameRegistry } from '../../../../shared/worktree/retired-name-registry'
-import type { GitHubLinkQuery } from '@/lib/github-links'
+import type { GitHubLinkQuery } from '../../../../shared/new-workspace/github-links'
import type { SetupConfig } from '../../../../shared/orca-hook-setup-config'
export type ComposerDerivedModel = {
diff --git a/src/renderer/src/hooks/composer-state/github-provider-selection.ts b/src/renderer/src/hooks/composer-state/github-provider-selection.ts
index 94e72ae067a..d88b96962df 100644
--- a/src/renderer/src/hooks/composer-state/github-provider-selection.ts
+++ b/src/renderer/src/hooks/composer-state/github-provider-selection.ts
@@ -42,7 +42,7 @@ import {
import { getLinkedItemDisplayName } from '@/components/sidebar/workspace-creation/folder/folder-workspace-source-selection'
import { ipcOrRuntimeTargetForHostId } from '@/runtime/rpc/targets/runtime-client-target'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
-import { resolveGitHubPrStartPointForRepo } from '@/lib/github-pr-start-point'
+import { resolveGitHubPrStartPointForRepo } from '@/lib/source-control/review/github-pr-start-point'
import { getForkPushWarning } from '../fork-push-warning'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
diff --git a/src/renderer/src/hooks/composer-state/github-submit-resolution.ts b/src/renderer/src/hooks/composer-state/github-submit-resolution.ts
index a3914b8d34b..c0d2f861f80 100644
--- a/src/renderer/src/hooks/composer-state/github-submit-resolution.ts
+++ b/src/renderer/src/hooks/composer-state/github-submit-resolution.ts
@@ -32,15 +32,15 @@ type GitHubSubmitResolutionInput = Pick<
import { useCallback } from 'react'
import { resolveGitHubWorkItemIdentity } from '../../../../shared/new-workspace/github-work-item-identity'
-import { getLinkedWorkItemProvider } from '@/lib/new-workspace'
-import { resolveGitHubPrStartPointForRepo } from '@/lib/github-pr-start-point'
+import { getWorkspaceSourceProvider } from '../../../../shared/new-workspace/workspace-source'
+import { resolveGitHubPrStartPointForRepo } from '@/lib/source-control/review/github-pr-start-point'
import { ipcOrRuntimeTargetForHostId } from '@/runtime/rpc/targets/runtime-client-target'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import {
getSmartGitHubSubmitResolution,
getSmartGitHubSubmitIntent,
lookupSmartGitHubSubmitItem
-} from '@/lib/smart-github-submit'
+} from '@/lib/work-items/github/smart-github-submit'
import { getForkPushWarning } from '../fork-push-warning'
import { isGitRepoKind } from '../../../../shared/repo-kind'
import { buildTaskSourceContextFromRepo } from '../../../../shared/work-items/task-source-context'
@@ -94,7 +94,7 @@ export function useGitHubSubmitResolution(input: GitHubSubmitResolutionInput) {
!isProjectGroupTarget &&
linkedWorkItemIdentity?.type === 'pr' &&
startPointIdentity?.type === 'pr' &&
- getLinkedWorkItemProvider(linkedWorkItem) === 'github' &&
+ getWorkspaceSourceProvider(linkedWorkItem) === 'github' &&
selectedRepo &&
selectedRepoIsGit &&
startPointSelection?.repoId === selectedRepo.id &&
diff --git a/src/renderer/src/hooks/composer-state/gitlab-provider-selection.ts b/src/renderer/src/hooks/composer-state/gitlab-provider-selection.ts
index 854900456aa..42daef17ccd 100644
--- a/src/renderer/src/hooks/composer-state/gitlab-provider-selection.ts
+++ b/src/renderer/src/hooks/composer-state/gitlab-provider-selection.ts
@@ -41,7 +41,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import type { GitPushTarget } from '../../../../shared/worktree/types'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
-import { reviewStartPointErrorText } from '@/lib/code-host-error-copy'
+import { reviewStartPointErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabProviderSelection(input: GitLabProviderSelectionInput) {
const {
diff --git a/src/renderer/src/hooks/composer-state/issue-source-actions.ts b/src/renderer/src/hooks/composer-state/issue-source-actions.ts
index 8ad9499c80a..184b457bcfd 100644
--- a/src/renderer/src/hooks/composer-state/issue-source-actions.ts
+++ b/src/renderer/src/hooks/composer-state/issue-source-actions.ts
@@ -48,9 +48,9 @@ import {
import {
buildLinearIssueLinkedWorkItem,
getLinearLinkedWorkItemBranchName
-} from '@/lib/linear-linked-work-item'
+} from '@/lib/work-items/linear/linear-linked-work-item'
import { getLinearIssueWorkspaceName } from '../../../../shared/workspace-name'
-import { getJiraIssueKeyCasingSeedOptions } from '@/lib/jira-issue-key-casing'
+import { getJiraIssueKeyCasingSeedOptions } from '@/lib/work-items/jira/jira-issue-key-casing'
import {
getLinkedWorkItemSuggestedName,
getLinkedWorkItemWorkspaceName,
diff --git a/src/renderer/src/hooks/composer-state/quick-creation-execution.ts b/src/renderer/src/hooks/composer-state/quick-creation-execution.ts
index 2363e34cee7..e1bf359ae58 100644
--- a/src/renderer/src/hooks/composer-state/quick-creation-execution.ts
+++ b/src/renderer/src/hooks/composer-state/quick-creation-execution.ts
@@ -1,6 +1,6 @@
import type { QuickCreationExecutionInput } from './composer-model'
-import { resolveQuickCreateLinkedWorkItemPrompt } from '@/lib/linked-work-item-context'
+import { resolveQuickCreateLinkedWorkItemPrompt } from '@/lib/work-items/linked-work-item-context'
import { useCallback } from 'react'
import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent'
import type { WorktreeCreationRequest } from '@/lib/workspace/creation/pending-worktree-creation'
diff --git a/src/renderer/src/hooks/composer-state/quick-startup-plan.ts b/src/renderer/src/hooks/composer-state/quick-startup-plan.ts
index 195355aac43..d5ecff6bf1a 100644
--- a/src/renderer/src/hooks/composer-state/quick-startup-plan.ts
+++ b/src/renderer/src/hooks/composer-state/quick-startup-plan.ts
@@ -6,7 +6,7 @@ import { WORKTREE_CREATE_AGENT_OPTIONS_RUNTIME_CAPABILITY } from '../../../../sh
import { terminalSessionOptionInputs } from '../../../../shared/agent-launch/startup/tui-agent-launch-command'
import { resolveStartupShell } from '../../../../shared/agent-launch/startup/tui-agent-startup-shell'
import { useAppStore } from '@/store/index'
-import { resolveQuickCreateLinkedWorkItemPrompt } from '@/lib/linked-work-item-context'
+import { resolveQuickCreateLinkedWorkItemPrompt } from '@/lib/work-items/linked-work-item-context'
import type { ComposerModel } from './composer-model'
import { ensureAgentLaunchPreferences } from '@/runtime/agent-launch-settings/use-host-agent-launch-preferences'
import type { GlobalSettings } from '../../../../shared/global-settings-types'
diff --git a/src/renderer/src/hooks/composer-state/quick-submit-preparation.ts b/src/renderer/src/hooks/composer-state/quick-submit-preparation.ts
index 97cdb7e856b..36d9bebbade 100644
--- a/src/renderer/src/hooks/composer-state/quick-submit-preparation.ts
+++ b/src/renderer/src/hooks/composer-state/quick-submit-preparation.ts
@@ -2,10 +2,8 @@ import type { QuickSubmitPreparationInput } from './quick-submit-input-contract'
import { useCallback } from 'react'
import { settleComposerSubmit } from '@/lib/composer-submit-cancellation'
-import {
- getLinkedWorkItemProvider,
- canUseIssueCommandForLinkedItemProvider
-} from '@/lib/new-workspace'
+import { getWorkspaceSourceProvider } from '../../../../shared/new-workspace/workspace-source'
+import { canUseIssueCommandForLinkedItemProvider } from '@/lib/new-workspace'
import { getSetupConfig } from '../../../../shared/orca-hook-setup-config'
import {
deriveWorkspaceSetupState,
@@ -108,7 +106,7 @@ export function useQuickSubmitPreparation(input: QuickSubmitPreparationInput) {
? (submitResolvedSetupDecision ?? 'inherit')
: 'skip'
const submitLinkedWorkItemProvider = submitLinkedWorkItem
- ? getLinkedWorkItemProvider(submitLinkedWorkItem)
+ ? getWorkspaceSourceProvider(submitLinkedWorkItem)
: null
const hookPreparation: WorktreeCreationRequest['hookPreparation'] = selectedRepoIsGit
? {
diff --git a/src/renderer/src/hooks/composer-state/quick-submit-source-preparation.ts b/src/renderer/src/hooks/composer-state/quick-submit-source-preparation.ts
index e04ff1061c8..eba8701beb6 100644
--- a/src/renderer/src/hooks/composer-state/quick-submit-source-preparation.ts
+++ b/src/renderer/src/hooks/composer-state/quick-submit-source-preparation.ts
@@ -20,7 +20,7 @@ type QuickSubmitSourcePreparationInput = Pick<
import { useCallback } from 'react'
import { isTuiAgentEnabled } from '../../../../shared/agent-launch/catalog/tui-agent-selection'
import { getLinkedWorkItemWorkspaceName } from '@/lib/new-workspace'
-import { getJiraIssueKeyCasingSeedOptions } from '@/lib/jira-issue-key-casing'
+import { getJiraIssueKeyCasingSeedOptions } from '@/lib/work-items/jira/jira-issue-key-casing'
import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent'
import type { PendingSmartGitHubSubmitResolution } from './source-selection-decisions'
diff --git a/src/renderer/src/hooks/composer-state/source-context-state.ts b/src/renderer/src/hooks/composer-state/source-context-state.ts
index 6e157c32c70..2bb03cfe719 100644
--- a/src/renderer/src/hooks/composer-state/source-context-state.ts
+++ b/src/renderer/src/hooks/composer-state/source-context-state.ts
@@ -26,8 +26,9 @@ type ComposerSourceContextStateInput = Pick<
>
import { useCallback, useMemo, useState } from 'react'
-import { getLinkedWorkItemProvider, type LinkedWorkItemSummary } from '@/lib/new-workspace'
-import { getLinearLinkedWorkItemBranchName } from '@/lib/linear-linked-work-item'
+import { getWorkspaceSourceProvider } from '../../../../shared/new-workspace/workspace-source'
+import type { LinkedWorkItemSummary } from '@/lib/new-workspace'
+import { getLinearLinkedWorkItemBranchName } from '@/lib/work-items/linear/linear-linked-work-item'
import {
type TaskSourceContext,
buildTaskSourceContextFromRepo,
@@ -112,14 +113,14 @@ export function useComposerSourceContextState(input: ComposerSourceContextStateI
const initialLinkedWorkItemSeed =
normalizedInitialLinkedWorkItem &&
- getLinkedWorkItemProvider(normalizedInitialLinkedWorkItem) === 'jira' &&
+ getWorkspaceSourceProvider(normalizedInitialLinkedWorkItem) === 'jira' &&
!initialLinkedTaskSourceContext
? null
: normalizedInitialLinkedWorkItem
const draftLinkedWorkItemSeed =
normalizedDraftLinkedWorkItem &&
- getLinkedWorkItemProvider(normalizedDraftLinkedWorkItem) === 'jira' &&
+ getWorkspaceSourceProvider(normalizedDraftLinkedWorkItem) === 'jira' &&
!draftLinkedTaskSourceContext
? null
: normalizedDraftLinkedWorkItem
@@ -143,7 +144,7 @@ export function useComposerSourceContextState(input: ComposerSourceContextStateI
const derivedGitHubTaskSourceContext = useMemo(() => {
if (
!linkedWorkItem ||
- getLinkedWorkItemProvider(linkedWorkItem) !== 'github' ||
+ getWorkspaceSourceProvider(linkedWorkItem) !== 'github' ||
!selectedRepo ||
selectedWorkspaceTarget.status !== 'ready'
) {
diff --git a/src/renderer/src/hooks/composer-state/source-identity-actions.ts b/src/renderer/src/hooks/composer-state/source-identity-actions.ts
index 430b5547235..5fe6f36db0c 100644
--- a/src/renderer/src/hooks/composer-state/source-identity-actions.ts
+++ b/src/renderer/src/hooks/composer-state/source-identity-actions.ts
@@ -38,7 +38,7 @@ import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import { getLinkedWorkItemSuggestedName, getLinkedWorkItemWorkspaceName } from '@/lib/new-workspace'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import { shouldApplyWorkspaceSourceAutoName } from '../../../../shared/new-workspace/workspace-source'
-import { isLinearLinkedWorkItem } from '@/lib/linear-linked-work-item'
+import { isLinearLinkedWorkItem } from '@/lib/work-items/linear/linear-linked-work-item'
import { resolveComposerManualBranchNameChange } from '../composer-branch-selection'
export function useSourceIdentityActions(input: SourceIdentityActionsInput) {
diff --git a/src/renderer/src/hooks/composer-state/source-selection-decisions.ts b/src/renderer/src/hooks/composer-state/source-selection-decisions.ts
index 62d1cd02a45..fbec826ed11 100644
--- a/src/renderer/src/hooks/composer-state/source-selection-decisions.ts
+++ b/src/renderer/src/hooks/composer-state/source-selection-decisions.ts
@@ -1,9 +1,9 @@
import type { GitHubPrStartPoint, GitPushTarget } from '../../../../shared/worktree/types'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
-import { getLinkedWorkItemProvider } from '@/lib/linked-work-item-provider'
+import { getWorkspaceSourceProvider } from '../../../../shared/new-workspace/workspace-source'
import type { LinkedWorkItemSummary } from '@/lib/new-workspace'
-import type { SmartGitHubSubmitResolution } from '@/lib/smart-github-submit'
+import type { SmartGitHubSubmitResolution } from '@/lib/work-items/github/smart-github-submit'
import {
resolveGitHubWorkItemIdentity,
type GitHubWorkItemIdentity
@@ -35,7 +35,7 @@ export type SmartSourceSelection =
export function getGitHubLinkedWorkItemIdentity(
item: LinkedWorkItemSummary | null | undefined
): GitHubWorkItemIdentity | null {
- if (!item || getLinkedWorkItemProvider(item) !== 'github') {
+ if (!item || getWorkspaceSourceProvider(item) !== 'github') {
return null
}
return resolveGitHubWorkItemIdentity({
@@ -48,7 +48,7 @@ export function getGitHubLinkedWorkItemIdentity(
export function normalizeGitHubLinkedWorkItem(
item: LinkedWorkItemSummary | null | undefined
): LinkedWorkItemSummary | null {
- if (!item || getLinkedWorkItemProvider(item) !== 'github') {
+ if (!item || getWorkspaceSourceProvider(item) !== 'github') {
return item ?? null
}
const identity = getGitHubLinkedWorkItemIdentity(item)
diff --git a/src/renderer/src/hooks/composer-state/target-change-actions.ts b/src/renderer/src/hooks/composer-state/target-change-actions.ts
index c1b0c3c2a98..c0ff8fcb83c 100644
--- a/src/renderer/src/hooks/composer-state/target-change-actions.ts
+++ b/src/renderer/src/hooks/composer-state/target-change-actions.ts
@@ -40,7 +40,7 @@ import { useCallback } from 'react'
import {
isLinearLinkedWorkItem,
getLinearLinkedWorkItemBranchName
-} from '@/lib/linear-linked-work-item'
+} from '@/lib/work-items/linear/linear-linked-work-item'
import { shouldPreserveWorkspaceSourceOnRepoChange } from '../../../../shared/new-workspace/workspace-source'
import {
buildProjectHostSetupOptions,
diff --git a/src/renderer/src/hooks/composer-state/workspace-identity-state.ts b/src/renderer/src/hooks/composer-state/workspace-identity-state.ts
index f3e2f50ad42..8140cdaf14a 100644
--- a/src/renderer/src/hooks/composer-state/workspace-identity-state.ts
+++ b/src/renderer/src/hooks/composer-state/workspace-identity-state.ts
@@ -18,7 +18,10 @@ type WorkspaceIdentityStateInput = Pick<
import { useState, useMemo, useCallback, type SetStateAction } from 'react'
import type { CreateWorktreeArgs } from '../../../../shared/worktree/create-types'
-import { getLinkedWorkItemProvider, isGitLabIssueUrl } from '@/lib/new-workspace'
+import {
+ getWorkspaceSourceProvider,
+ isGitLabIssueUrl
+} from '../../../../shared/new-workspace/workspace-source'
import {
type SmartNameMode,
isBlockingJiraUrlIntent
@@ -65,7 +68,7 @@ export function useWorkspaceIdentityState(input: WorkspaceIdentityStateInput) {
}
if (
initialLinkedWorkItem?.type === 'issue' &&
- getLinkedWorkItemProvider(initialLinkedWorkItem) === 'github'
+ getWorkspaceSourceProvider(initialLinkedWorkItem) === 'github'
) {
return String(initialLinkedWorkItem.number)
}
diff --git a/src/renderer/src/hooks/ipc-events/new-workspace-command.ts b/src/renderer/src/hooks/ipc-events/new-workspace-command.ts
index 98dd2b045c2..0059b95bf18 100644
--- a/src/renderer/src/hooks/ipc-events/new-workspace-command.ts
+++ b/src/renderer/src/hooks/ipc-events/new-workspace-command.ts
@@ -1,4 +1,4 @@
-import { buildLinearIssueLinkedWorkItem } from '@/lib/linear-linked-work-item'
+import { buildLinearIssueLinkedWorkItem } from '@/lib/work-items/linear/linear-linked-work-item'
import type { LinkedWorkItemSummary } from '@/lib/new-workspace'
import { getLinearIssueWorkspaceName } from '../../../../shared/workspace-name'
import type { AppState } from '../../store/types'
diff --git a/src/renderer/src/hooks/useGitHubOperationScope.ts b/src/renderer/src/hooks/useGitHubOperationScope.ts
index ee645cc0c86..f075fd50bf9 100644
--- a/src/renderer/src/hooks/useGitHubOperationScope.ts
+++ b/src/renderer/src/hooks/useGitHubOperationScope.ts
@@ -6,7 +6,7 @@ import { webRuntimeState } from '@/web/preload-api/web-runtime-session'
import { useAppStore } from '@/store'
import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
-import { resolveGitHubRepoOperationOwner } from '@/lib/github-source-runtime-context'
+import { resolveGitHubRepoOperationOwner } from '@/lib/work-items/github/github-source-runtime-context'
import { getRuntimeEnvironmentRevision } from '@/runtime/rpc/environment-revisions/runtime-environment-revision'
import { getRuntimeEnvironmentConnectionGeneration } from '@/store/slices/runtime-status/runtime-status-connection-generation'
diff --git a/src/renderer/src/hooks/useGitHubRepoMetadata.ts b/src/renderer/src/hooks/useGitHubRepoMetadata.ts
index fa440631bb8..9c814be0a90 100644
--- a/src/renderer/src/hooks/useGitHubRepoMetadata.ts
+++ b/src/renderer/src/hooks/useGitHubRepoMetadata.ts
@@ -1,5 +1,5 @@
import { getTaskSourceCacheScope } from '../../../shared/work-items/task-source-context'
-import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
+import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import { callGitHubTargetOperation } from '@/lib/work-items/github/github-work-item-target-request'
import { useGitHubOperationOwner } from './useGitHubOperationScope'
import { useGitHubWorkItemTarget } from '@/components/github-item-dialog/load-item-details/github-work-item-target-context'
diff --git a/src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts b/src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts
index 6772df33ae6..72983353fe3 100644
--- a/src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts
+++ b/src/renderer/src/hooks/useTaskPageGitHubWorkItemMutation.ts
@@ -1,4 +1,4 @@
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { buildTaskPageGitHubWorkItemMutationPatch } from '@/components/task-page/github/task-page-github-work-item-mutation-patches'
import { useCallback, useEffect, useRef, useState } from 'react'
import { toast } from 'sonner'
@@ -24,7 +24,7 @@ import {
setTaskPageGitHubMutationQueryKey
} from '@/components/task-page/github/task-page-github-work-item-mutation-registry'
import { useMountedRef } from './useMountedRef'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export type UseTaskPageGitHubWorkItemMutationArgs = {
queryKey: string
diff --git a/src/renderer/src/lib/comment-body-line-count.test.ts b/src/renderer/src/lib/comment-body-line-count.test.ts
deleted file mode 100644
index 633d1c64e37..00000000000
--- a/src/renderer/src/lib/comment-body-line-count.test.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { afterEach, describe, expect, it, vi } from 'vitest'
-import {
- COMMENT_BODY_LAYOUT_MAX_LINES,
- COMMENT_BODY_LINE_COUNT_SCAN_CODE_UNITS,
- getCommentBodyLayoutLineCount
-} from './comment-body-line-count'
-
-afterEach(() => {
- vi.restoreAllMocks()
-})
-
-describe('comment body layout line count', () => {
- it('caps newline-heavy pasted comments without splitting the body', () => {
- const split = vi.spyOn(String.prototype, 'split')
- const charCodeAt = vi.spyOn(String.prototype, 'charCodeAt')
-
- expect(getCommentBodyLayoutLineCount('\n'.repeat(100_000))).toBe(COMMENT_BODY_LAYOUT_MAX_LINES)
-
- expect(split).not.toHaveBeenCalled()
- expect(charCodeAt.mock.calls.length).toBeLessThan(128)
- })
-
- it('bounds long single-line comment scans used only for layout estimates', () => {
- const split = vi.spyOn(String.prototype, 'split')
- const charCodeAt = vi.spyOn(String.prototype, 'charCodeAt')
- const body = 'x'.repeat(COMMENT_BODY_LINE_COUNT_SCAN_CODE_UNITS + 10_000)
-
- expect(getCommentBodyLayoutLineCount(body)).toBe(1)
-
- expect(split).not.toHaveBeenCalled()
- expect(charCodeAt.mock.calls.length).toBe(COMMENT_BODY_LINE_COUNT_SCAN_CODE_UNITS)
- })
-})
diff --git a/src/renderer/src/lib/diff-comments-format.ts b/src/renderer/src/lib/diff-comments-format.ts
deleted file mode 100644
index 8b8931f2e83..00000000000
--- a/src/renderer/src/lib/diff-comments-format.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { formatDiffComment, formatDiffComments } from '../../../shared/diff-comments-format'
diff --git a/src/renderer/src/lib/editor/markdown/review-notes/markdown-review-notes-setting.ts b/src/renderer/src/lib/editor/markdown/review-notes/markdown-review-notes-setting.ts
index faa7884330b..cbfb8bd63d3 100644
--- a/src/renderer/src/lib/editor/markdown/review-notes/markdown-review-notes-setting.ts
+++ b/src/renderer/src/lib/editor/markdown/review-notes/markdown-review-notes-setting.ts
@@ -1,6 +1,6 @@
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
import type { GlobalSettings } from '../../../../../../shared/global-settings-types'
-import { isMarkdownComment } from '../../../diff-comment-compat'
+import { isMarkdownComment } from '../../../source-control/review/comments/diff-comment-compat'
export function isMarkdownReviewNotesEnabled(
settings: Pick | null | undefined
diff --git a/src/renderer/src/lib/editor/markdown/review-notes/markdown-review-notes.ts b/src/renderer/src/lib/editor/markdown/review-notes/markdown-review-notes.ts
index 66c1dcfd10c..5686442b60d 100644
--- a/src/renderer/src/lib/editor/markdown/review-notes/markdown-review-notes.ts
+++ b/src/renderer/src/lib/editor/markdown/review-notes/markdown-review-notes.ts
@@ -1,5 +1,5 @@
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
-import { getDiffCommentLineLabel } from '../../../diff-comment-compat'
+import { getDiffCommentLineLabel } from '../../../source-control/review/comments/diff-comment-compat'
const MAX_EXCERPT_LINES = 8
const MAX_CARD_QUOTE_LENGTH = 60
diff --git a/src/renderer/src/lib/github-links.ts b/src/renderer/src/lib/github-links.ts
deleted file mode 100644
index 766d8a0eb28..00000000000
--- a/src/renderer/src/lib/github-links.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../../../shared/new-workspace/github-links'
diff --git a/src/renderer/src/lib/gitlab-links.ts b/src/renderer/src/lib/gitlab-links.ts
deleted file mode 100644
index c4cb97e1d9e..00000000000
--- a/src/renderer/src/lib/gitlab-links.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../../../shared/new-workspace/gitlab-links'
diff --git a/src/renderer/src/lib/linked-work-item-provider.ts b/src/renderer/src/lib/linked-work-item-provider.ts
deleted file mode 100644
index 62918eac598..00000000000
--- a/src/renderer/src/lib/linked-work-item-provider.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export {
- getWorkspaceSourceProvider as getLinkedWorkItemProvider,
- isGitLabIssueUrl
-} from '../../../shared/new-workspace/workspace-source'
diff --git a/src/renderer/src/lib/new-workspace.ts b/src/renderer/src/lib/new-workspace.ts
index 0d75895aa06..db1a1de525c 100644
--- a/src/renderer/src/lib/new-workspace.ts
+++ b/src/renderer/src/lib/new-workspace.ts
@@ -3,7 +3,7 @@ import { pasteDraftToAgentPtyWhenReady } from '@/lib/agent-session/messaging/pas
import { sendFollowupPromptWhenAgentReady } from '@/lib/agent-session/messaging/paste/agent-followup-delivery'
import { showAutomationPromptNotSentToast } from '@/lib/agent-session/launch/background/agent-background-session-timeout-toast'
import type { AgentStartupPlan } from '../../../shared/agent-launch/startup/tui-agent-startup'
-import type { LinkedWorkItemContext } from '@/lib/linked-work-item-context'
+import type { LinkedWorkItemContext } from '@/lib/work-items/linked-work-item-context'
import {
beginAgentStartupDeliveryAttempt,
getAgentStartupTabPtyId,
@@ -23,8 +23,6 @@ export const CLIENT_PLATFORM: NodeJS.Platform = navigator.userAgent.includes('Wi
? 'darwin'
: 'linux'
-export { getLinkedWorkItemProvider, isGitLabIssueUrl } from './linked-work-item-provider'
-
export type LinkedWorkItemSummary = Omit & {
provider?: FolderWorkspaceLinkedTask['provider']
linearWorkspaceId?: string
diff --git a/src/renderer/src/lib/git-utils.ts b/src/renderer/src/lib/source-control/branches/branch-name.ts
similarity index 100%
rename from src/renderer/src/lib/git-utils.ts
rename to src/renderer/src/lib/source-control/branches/branch-name.ts
diff --git a/src/renderer/src/lib/fix-checks-agent-launch-request.ts b/src/renderer/src/lib/source-control/checks/fix-checks-agent-launch-request.ts
similarity index 63%
rename from src/renderer/src/lib/fix-checks-agent-launch-request.ts
rename to src/renderer/src/lib/source-control/checks/fix-checks-agent-launch-request.ts
index dbe4ef59249..edf6cc382d7 100644
--- a/src/renderer/src/lib/fix-checks-agent-launch-request.ts
+++ b/src/renderer/src/lib/source-control/checks/fix-checks-agent-launch-request.ts
@@ -1,6 +1,6 @@
-import type { GitHubWorkItem } from '../../../shared/github/work-item-types'
-import type { WorkspaceSource as WorkspaceCreateTelemetrySource } from '../../../shared/workspace-source'
-import type { LaunchSource } from '../../../shared/telemetry-property-schemas'
+import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
+import type { WorkspaceSource as WorkspaceCreateTelemetrySource } from '../../../../../shared/workspace-source'
+import type { LaunchSource } from '../../../../../shared/telemetry-property-schemas'
export type StartFixChecksAgentArgs = {
repoId: string
diff --git a/src/renderer/src/lib/fix-checks-agent-launch.ts b/src/renderer/src/lib/source-control/checks/fix-checks-agent-launch.ts
similarity index 92%
rename from src/renderer/src/lib/fix-checks-agent-launch.ts
rename to src/renderer/src/lib/source-control/checks/fix-checks-agent-launch.ts
index c5cf9674edf..e2a542bb946 100644
--- a/src/renderer/src/lib/fix-checks-agent-launch.ts
+++ b/src/renderer/src/lib/source-control/checks/fix-checks-agent-launch.ts
@@ -5,11 +5,11 @@ import {
resolveChecksActionAgent,
sourceControlRepoAgentRows
} from '@/lib/source-control/ai/source-control-agent-picker'
-export { resolveChecksActionAgent } from '@/lib/source-control/ai/source-control-agent-picker'
+
import {
AgentLaunchChoiceCancelled,
acquireAgentLaunchChoices
-} from './host-chat-program-acquisition'
+} from '../../host-chat-program-acquisition'
import { toast } from 'sonner'
import {
ensureDetectedAgentsForRepo,
@@ -23,21 +23,21 @@ import { findGithubPrWorkspaceAttachment } from '@/lib/work-items/github/github-
import { launchAgentInNewTab } from '@/lib/agent-session/launch/new-tab/launch-agent-in-new-tab'
import { newAgentLaunchRequestId } from '@/lib/agent-session/launch/routing/agent-launch-request-id'
import { launchWorkItemDirect } from '@/lib/workspace/creation/work-item/launch-work-item-direct'
-import { readSourceControlLaunchRecipeAgentId } from '../../../shared/source-control/ai/source-control-launch-agent-selection'
+import { readSourceControlLaunchRecipeAgentId } from '../../../../../shared/source-control/ai/source-control-launch-agent-selection'
import { resolveRepoWorktreeLaunchPlatform } from '@/runtime/hosts/platform/execution-host-facts'
import { reportAgentWorkspaceActivation } from '@/lib/workspace/activation/worktree-activation-outcome'
import { activateAndRevealWorktreeWithOutcome } from '@/lib/workspace/activation/worktree-activation'
-import { useAppStore } from '@/store'
-import { resolveSourceControlActionRecipe } from '../../../shared/source-control/ai/source-control-ai-operation-policy'
+import { useAppStore } from '@/store/index'
+import { resolveSourceControlActionRecipe } from '../../../../../shared/source-control/ai/source-control-ai-operation-policy'
import {
type SourceControlActionRecipe,
DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES,
renderSourceControlActionCommandTemplate
-} from '../../../shared/source-control/ai/recipes/source-control-ai-actions'
-import { isTuiAgentEnabled } from '../../../shared/agent-launch/catalog/tui-agent-selection'
-import type { TuiAgent } from '../../../shared/agent-launch/catalog/tui-agent'
+} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions'
+import { isTuiAgentEnabled } from '../../../../../shared/agent-launch/catalog/tui-agent-selection'
+import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent'
import { translate } from '@/i18n/i18n'
-import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences'
+import { projectSourceControlActionLaunch } from '../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences'
type SavedAgentOverrideResult =
| { kind: 'agent'; agent: TuiAgent }
diff --git a/src/renderer/src/lib/pr-check-observation-contract.ts b/src/renderer/src/lib/source-control/checks/pr-check-observation-contract.ts
similarity index 75%
rename from src/renderer/src/lib/pr-check-observation-contract.ts
rename to src/renderer/src/lib/source-control/checks/pr-check-observation-contract.ts
index f87103ef9d3..49bdb5bf914 100644
--- a/src/renderer/src/lib/pr-check-observation-contract.ts
+++ b/src/renderer/src/lib/source-control/checks/pr-check-observation-contract.ts
@@ -1,16 +1,16 @@
import {
getTaskSourceCacheScope,
type TaskSourceContext
-} from '../../../shared/work-items/task-source-context'
-import { RUNTIME_CONNECTION_CHANGED_MESSAGE } from '../web/web-runtime-request-registry'
-import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
-import type { AppState } from '../store/types'
-import type { callRuntimeRpc } from '../runtime/rpc/calls/runtime-rpc-call'
-import { GITHUB_COMPLETE_PR_CHECK_OBSERVATION_CAPABILITY } from '../../../shared/source-control/runtime/source-control-runtime-capabilities'
-import { lastVerifiedRuntimeStatus } from '../../../shared/remote-runtime/host-status/runtime-host-status'
-import { readLocalRuntimeCapabilitiesOrUnknown } from '../runtime/hosts/capabilities/local-runtime-capabilities'
-import { getRuntimeEnvironmentRevision } from '../runtime/rpc/environment-revisions/runtime-environment-revision'
-import { getRuntimeEnvironmentConnectionGeneration } from '../store/slices/runtime-status/runtime-status-connection-generation'
+} from '../../../../../shared/work-items/task-source-context'
+import { RUNTIME_CONNECTION_CHANGED_MESSAGE } from '../../../web/web-runtime-request-registry'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
+import type { AppState } from '../../../store/types'
+import type { callRuntimeRpc } from '../../../runtime/rpc/calls/runtime-rpc-call'
+import { GITHUB_COMPLETE_PR_CHECK_OBSERVATION_CAPABILITY } from '../../../../../shared/source-control/runtime/source-control-runtime-capabilities'
+import { lastVerifiedRuntimeStatus } from '../../../../../shared/remote-runtime/host-status/runtime-host-status'
+import { readLocalRuntimeCapabilitiesOrUnknown } from '../../../runtime/hosts/capabilities/local-runtime-capabilities'
+import { getRuntimeEnvironmentRevision } from '../../../runtime/rpc/environment-revisions/runtime-environment-revision'
+import { getRuntimeEnvironmentConnectionGeneration } from '../../../store/slices/runtime-status/runtime-status-connection-generation'
export function capturePRCheckContract(
get: () => AppState,
diff --git a/src/renderer/src/lib/pr-check-refresh-owner.ts b/src/renderer/src/lib/source-control/checks/pr-check-refresh-owner.ts
similarity index 68%
rename from src/renderer/src/lib/pr-check-refresh-owner.ts
rename to src/renderer/src/lib/source-control/checks/pr-check-refresh-owner.ts
index 6bbf176cba7..95bfb0af7fd 100644
--- a/src/renderer/src/lib/pr-check-refresh-owner.ts
+++ b/src/renderer/src/lib/source-control/checks/pr-check-refresh-owner.ts
@@ -1,11 +1,11 @@
-import { acceptPRCheckObservation } from '../../../shared/github/complete-pr-check-owner'
-import type { GitHubWorkItem } from '../../../shared/github/work-item-types'
-import type { GitHubOwnerRepo } from '../../../shared/github/pull-request-types'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
+import { acceptPRCheckObservation } from '../../../../../shared/github/complete-pr-check-owner'
+import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
+import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
+import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { capturePRCheckContract } from './pr-check-observation-contract'
-import { getGitHubSourceRuntimeTarget } from './github-source-runtime-context'
-import { lookupGitHubWorkItemByOwnerRepoForSource } from './work-items/github/github-work-item-source-lookup'
-import { useAppStore } from '@/store'
+import { getGitHubSourceRuntimeTarget } from '../../work-items/github/github-source-runtime-context'
+import { lookupGitHubWorkItemByOwnerRepoForSource } from '../../work-items/github/github-work-item-source-lookup'
+import { useAppStore } from '@/store/index'
export async function readPRCheckRefreshOwner(args: {
repoPath: string | null
diff --git a/src/renderer/src/lib/source-control/graph/git-graph-refresh-event.ts b/src/renderer/src/lib/source-control/graph/git-graph-refresh-event.ts
new file mode 100644
index 00000000000..06a04913f2e
--- /dev/null
+++ b/src/renderer/src/lib/source-control/graph/git-graph-refresh-event.ts
@@ -0,0 +1 @@
+export const GIT_GRAPH_REFRESH_EVENT = 'orca:git-graph-refresh'
diff --git a/src/renderer/src/lib/git-graph-tab.ts b/src/renderer/src/lib/source-control/graph/git-graph-tab.ts
similarity index 90%
rename from src/renderer/src/lib/git-graph-tab.ts
rename to src/renderer/src/lib/source-control/graph/git-graph-tab.ts
index c45f2532df6..bc8b7233c8c 100644
--- a/src/renderer/src/lib/git-graph-tab.ts
+++ b/src/renderer/src/lib/source-control/graph/git-graph-tab.ts
@@ -1,12 +1,12 @@
import { useMemo } from 'react'
import { useShallow } from 'zustand/react/shallow'
-import { captureWorktreeOperationGenerationSnapshot } from './workspace/ownership/worktree-operation-generation'
-import { useAppStore } from '@/store'
+import { captureWorktreeOperationGenerationSnapshot } from '../../workspace/ownership/worktree-operation-generation'
+import { useAppStore } from '@/store/index'
import {
findFirstIndexedWorktree,
findIndexedWorktreeOwnerForHost
-} from './workspace/ownership/worktree-runtime-owner-index'
-import { findIndexedRepoOwnerForHost } from './workspace/ownership/repo-owner-index'
+} from '../../workspace/ownership/worktree-runtime-owner-index'
+import { findIndexedRepoOwnerForHost } from '../../workspace/ownership/repo-owner-index'
import {
selectDetectedWorktreesByRepo,
selectFolderWorkspaces,
@@ -16,20 +16,18 @@ import {
resolveWorktreeOperationRoute,
resolveWorktreeOperationRouteForHost,
type WorktreeOperationRouteState
-} from './workspace/ownership/worktree-operation-route'
+} from '../../workspace/ownership/worktree-operation-route'
import { openWorkspaceEditorItem } from '@/store/slices/editor/tabs/workspace-editor-item'
import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target'
import { translate } from '@/i18n/i18n'
import type { Translate } from '@/i18n/use-translate'
-import { GIT_GRAPH_TAB_CAPABILITY } from '../../../shared/source-control/runtime/git-graph-capabilities'
+import { GIT_GRAPH_TAB_CAPABILITY } from '../../../../../shared/source-control/runtime/git-graph-capabilities'
import { readCachedRuntimeEnvironmentCapability } from '@/runtime/rpc/compatibility/runtime-compatibility-cache'
import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof'
import {
getSshTargetIdForExecutionHost,
type ExecutionHostId
-} from '../../../shared/execution-host'
-
-export const GIT_GRAPH_REFRESH_EVENT = 'orca:git-graph-refresh'
+} from '../../../../../shared/execution-host'
type ScopeState = WorktreeOperationRouteState &
Pick, 'repos' | 'worktreesByRepo'>
diff --git a/src/renderer/src/lib/git-path-decoration.ts b/src/renderer/src/lib/source-control/paths/git-path-decoration.ts
similarity index 95%
rename from src/renderer/src/lib/git-path-decoration.ts
rename to src/renderer/src/lib/source-control/paths/git-path-decoration.ts
index 9bcf02d51e8..08ebb89e157 100644
--- a/src/renderer/src/lib/git-path-decoration.ts
+++ b/src/renderer/src/lib/source-control/paths/git-path-decoration.ts
@@ -1,6 +1,9 @@
-import type { GitFileStatus, GitStatusEntry } from '../../../shared/git/status/git-status-types'
+import type {
+ GitFileStatus,
+ GitStatusEntry
+} from '../../../../../shared/git/status/git-status-types'
import { joinPath } from '@/lib/path'
-import { normalizeRelativePath, splitPathSegments } from '../../../shared/cross-platform-path'
+import { normalizeRelativePath, splitPathSegments } from '../../../../../shared/cross-platform-path'
export const STATUS_COLORS: Record = {
modified: 'var(--git-decoration-modified)',
diff --git a/src/renderer/src/lib/bitbucket-connect-error-copy.ts b/src/renderer/src/lib/source-control/remote/bitbucket-connect-error-copy.ts
similarity index 95%
rename from src/renderer/src/lib/bitbucket-connect-error-copy.ts
rename to src/renderer/src/lib/source-control/remote/bitbucket-connect-error-copy.ts
index 7efb7475aff..68f71afc2c1 100644
--- a/src/renderer/src/lib/bitbucket-connect-error-copy.ts
+++ b/src/renderer/src/lib/source-control/remote/bitbucket-connect-error-copy.ts
@@ -2,7 +2,7 @@ import { translate } from '@/i18n/i18n'
import {
BITBUCKET_CONNECT_FAILURE_COPY as EN,
type BitbucketConnectFailureCode
-} from '../../../shared/bitbucket-credentials'
+} from '../../../../../shared/bitbucket-credentials'
const COPY: Record string> = {
invalidInput: () => translate('codeHost.bitbucketConnect.invalidInput', EN.invalidInput),
diff --git a/src/renderer/src/lib/code-host-error-copy.ts b/src/renderer/src/lib/source-control/remote/code-host-error-copy.ts
similarity index 98%
rename from src/renderer/src/lib/code-host-error-copy.ts
rename to src/renderer/src/lib/source-control/remote/code-host-error-copy.ts
index 510009d37a1..1879b0e089f 100644
--- a/src/renderer/src/lib/code-host-error-copy.ts
+++ b/src/renderer/src/lib/source-control/remote/code-host-error-copy.ts
@@ -2,11 +2,11 @@ import { translate } from '@/i18n/i18n'
import {
CODE_HOST_FAILURE_COPY as EN,
type CodeHostFailureCode
-} from '../../../shared/code-host-failure-copy'
+} from '../../../../../shared/code-host-failure-copy'
import {
REVIEW_START_POINT_FAILURE_COPY as START_EN,
type ReviewStartPointFailureCode
-} from '../../../shared/review-start-point-failure-copy'
+} from '../../../../../shared/review-start-point-failure-copy'
// null = required detail missing; caller shows the host's English `error`.
const COPY: Record string | null> = {
diff --git a/src/renderer/src/lib/comment-body-line-count.ts b/src/renderer/src/lib/source-control/review/comments/comment-body-line-count.ts
similarity index 100%
rename from src/renderer/src/lib/comment-body-line-count.ts
rename to src/renderer/src/lib/source-control/review/comments/comment-body-line-count.ts
diff --git a/src/renderer/src/lib/comment-body-submit-state.test.ts b/src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.test.ts
similarity index 100%
rename from src/renderer/src/lib/comment-body-submit-state.test.ts
rename to src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.test.ts
diff --git a/src/renderer/src/lib/comment-body-submit-state.ts b/src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.ts
similarity index 96%
rename from src/renderer/src/lib/comment-body-submit-state.ts
rename to src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.ts
index 460200d3e10..9e8e1e5da5f 100644
--- a/src/renderer/src/lib/comment-body-submit-state.ts
+++ b/src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.ts
@@ -1,7 +1,7 @@
import {
getUtf8ByteLengthForCodePoint,
readUtf8CodePointAt
-} from '../../../shared/utf8-byte-limits'
+} from '../../../../../../shared/utf8-byte-limits'
export const COMMENT_BODY_NONBLANK_SCAN_MAX_BYTES = 64 * 1024
diff --git a/src/renderer/src/lib/diff-comment-compat.ts b/src/renderer/src/lib/source-control/review/comments/diff-comment-compat.ts
similarity index 89%
rename from src/renderer/src/lib/diff-comment-compat.ts
rename to src/renderer/src/lib/source-control/review/comments/diff-comment-compat.ts
index 2f1ab95ed2a..37ea5a27c4a 100644
--- a/src/renderer/src/lib/diff-comment-compat.ts
+++ b/src/renderer/src/lib/source-control/review/comments/diff-comment-compat.ts
@@ -1,4 +1,4 @@
-import type { DiffComment, DiffCommentSource } from '../../../shared/diff-comment-types'
+import type { DiffComment, DiffCommentSource } from '../../../../../../shared/diff-comment-types'
export function getDiffCommentSource(comment: Pick): DiffCommentSource {
return comment.source === 'markdown' ? 'markdown' : 'diff'
diff --git a/src/renderer/src/lib/github-pr-start-point.ts b/src/renderer/src/lib/source-control/review/github-pr-start-point.ts
similarity index 79%
rename from src/renderer/src/lib/github-pr-start-point.ts
rename to src/renderer/src/lib/source-control/review/github-pr-start-point.ts
index 767aada5ff0..adb7536f503 100644
--- a/src/renderer/src/lib/github-pr-start-point.ts
+++ b/src/renderer/src/lib/source-control/review/github-pr-start-point.ts
@@ -1,8 +1,8 @@
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
-import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
-import type { GitHubPrStartPoint } from '../../../shared/worktree/types'
-import type { ReviewStartPointFailure } from '../../../shared/review-start-point-failure-copy'
-import { reviewStartPointErrorText } from '@/lib/code-host-error-copy'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
+import type { GitHubPrStartPoint } from '../../../../../shared/worktree/types'
+import type { ReviewStartPointFailure } from '../../../../../shared/review-start-point-failure-copy'
+import { reviewStartPointErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export type GitHubPrStartPointInput = {
repoId: string
diff --git a/src/renderer/src/lib/hosted-review-repo-read.ts b/src/renderer/src/lib/source-control/review/hosted-review-repo-read.ts
similarity index 80%
rename from src/renderer/src/lib/hosted-review-repo-read.ts
rename to src/renderer/src/lib/source-control/review/hosted-review-repo-read.ts
index 3120989599f..798228d971e 100644
--- a/src/renderer/src/lib/hosted-review-repo-read.ts
+++ b/src/renderer/src/lib/source-control/review/hosted-review-repo-read.ts
@@ -1,11 +1,11 @@
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import { hostedReviewRepoOwnerTarget } from '@/store/slices/hosted-review/hosted-review-cache-state'
-import { getRepoExecutionHostId } from '../../../shared/execution-host'
+import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
import type {
HostedReviewForBranchArgs,
HostedReviewInfo
-} from '../../../shared/source-control/hosted-review/hosted-review-contracts'
-import type { Repo } from '../../../shared/repo-types'
+} from '../../../../../shared/source-control/hosted-review/hosted-review-contracts'
+import type { Repo } from '../../../../../shared/repo-types'
export function readHostedReviewForRepo(
repo: Repo,
diff --git a/src/renderer/src/lib/pr-bot-author-overrides.test.ts b/src/renderer/src/lib/source-control/review/pr-bot-author-overrides.test.ts
similarity index 92%
rename from src/renderer/src/lib/pr-bot-author-overrides.test.ts
rename to src/renderer/src/lib/source-control/review/pr-bot-author-overrides.test.ts
index e53674bd246..39aa2ac6d42 100644
--- a/src/renderer/src/lib/pr-bot-author-overrides.test.ts
+++ b/src/renderer/src/lib/source-control/review/pr-bot-author-overrides.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { applyPRBotAuthorOverride } from '../../../shared/source-control/review-comments/pr-bot-author-overrides'
+import { applyPRBotAuthorOverride } from '../../../../../shared/source-control/review-comments/pr-bot-author-overrides'
const store = vi.hoisted(() => ({
settings: { prBotAuthorOverrides: [] as string[] },
@@ -10,7 +10,7 @@ const store = vi.hoisted(() => ({
vi.mock('sonner', () => ({ toast: { warning: store.warning } }))
-vi.mock('@/store', () => ({
+vi.mock('@/store/index', () => ({
useAppStore: Object.assign(vi.fn(), {
getState: () => ({ settings: store.settings }),
setState: (next: { settings: typeof store.settings }) => {
diff --git a/src/renderer/src/lib/pr-bot-author-overrides.ts b/src/renderer/src/lib/source-control/review/pr-bot-author-overrides.ts
similarity index 92%
rename from src/renderer/src/lib/pr-bot-author-overrides.ts
rename to src/renderer/src/lib/source-control/review/pr-bot-author-overrides.ts
index 9c48f088120..e5ff814724b 100644
--- a/src/renderer/src/lib/pr-bot-author-overrides.ts
+++ b/src/renderer/src/lib/source-control/review/pr-bot-author-overrides.ts
@@ -1,12 +1,12 @@
import { useMemo } from 'react'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
-import { useAppStore } from '@/store'
+import { useAppStore } from '@/store/index'
import {
createBotAuthorOverrideSet,
MAX_PR_BOT_AUTHOR_OVERRIDES,
normalizePRCommentAuthorLogin
-} from '../../../shared/source-control/review-comments/pr-bot-author-overrides'
+} from '../../../../../shared/source-control/review-comments/pr-bot-author-overrides'
let overrideUpdateQueue = Promise.resolve()
diff --git a/src/renderer/src/lib/work-item-link-query-bounds.ts b/src/renderer/src/lib/work-item-link-query-bounds.ts
deleted file mode 100644
index 831c942ef0c..00000000000
--- a/src/renderer/src/lib/work-item-link-query-bounds.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-// Re-export shim: the implementation moved to src/shared so mobile can share it.
-export * from '../../../shared/new-workspace/work-item-link-query-bounds'
diff --git a/src/renderer/src/lib/work-item-lookup-text.ts b/src/renderer/src/lib/work-item-lookup-text.ts
deleted file mode 100644
index 8ef5ae53099..00000000000
--- a/src/renderer/src/lib/work-item-lookup-text.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../../../shared/new-workspace/work-item-lookup-text'
diff --git a/src/renderer/src/lib/github-source-runtime-context.test.ts b/src/renderer/src/lib/work-items/github/github-source-runtime-context.test.ts
similarity index 93%
rename from src/renderer/src/lib/github-source-runtime-context.test.ts
rename to src/renderer/src/lib/work-items/github/github-source-runtime-context.test.ts
index a0182277702..4aace78309a 100644
--- a/src/renderer/src/lib/github-source-runtime-context.test.ts
+++ b/src/renderer/src/lib/work-items/github/github-source-runtime-context.test.ts
@@ -1,12 +1,12 @@
import { describe, expect, it } from 'vitest'
-import type { Repo } from '../../../shared/repo-types'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
-import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
+import type { Repo } from '../../../../../shared/repo-types'
+import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import {
getGitHubRepoRoutingTarget,
resolveGitHubRepoOperationOwner
} from './github-source-runtime-context'
-import type { RepoRuntimeOwnerState } from './workspace/ownership/repo-runtime-owner'
+import type { RepoRuntimeOwnerState } from '../../workspace/ownership/repo-runtime-owner'
const runtimeSourceContext: TaskSourceContext = {
kind: 'task-source',
diff --git a/src/renderer/src/lib/github-source-runtime-context.ts b/src/renderer/src/lib/work-items/github/github-source-runtime-context.ts
similarity index 92%
rename from src/renderer/src/lib/github-source-runtime-context.ts
rename to src/renderer/src/lib/work-items/github/github-source-runtime-context.ts
index a4b192741fd..1839849ffce 100644
--- a/src/renderer/src/lib/github-source-runtime-context.ts
+++ b/src/renderer/src/lib/work-items/github/github-source-runtime-context.ts
@@ -2,20 +2,20 @@ import {
getRepoExecutionHostId,
toRuntimeExecutionHostId,
parseExecutionHostId
-} from '../../../shared/execution-host'
-import type { Repo } from '../../../shared/repo-types'
+} from '../../../../../shared/execution-host'
+import type { Repo } from '../../../../../shared/repo-types'
import { repoMatchesHostIdentity } from '@/store/repos/repo-host-identity'
-import type { ExecutionHostId, ParsedExecutionHost } from '../../../shared/execution-host'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
+import type { ExecutionHostId, ParsedExecutionHost } from '../../../../../shared/execution-host'
+import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { runtimeTargetForOwnerEnvironment } from '@/runtime/rpc/targets/runtime-client-target'
-import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
-import { taskSourceRuntimeTarget } from './task-source-runtime-target'
+import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
+import { taskSourceRuntimeTarget } from '../task-source-runtime-target'
import {
getExplicitRuntimeOwnerEnvironmentId,
resolveRepoRuntimeOwner,
getHostlessSourceRepoOwnerEnvironmentId,
type RepoRuntimeOwnerState
-} from './workspace/ownership/repo-runtime-owner'
+} from '../../workspace/ownership/repo-runtime-owner'
export type GitHubRuntimeHost = Extract
diff --git a/src/renderer/src/lib/github-task-observation.ts b/src/renderer/src/lib/work-items/github/github-task-observation.ts
similarity index 81%
rename from src/renderer/src/lib/github-task-observation.ts
rename to src/renderer/src/lib/work-items/github/github-task-observation.ts
index a3f2b9ce3b2..160677f81da 100644
--- a/src/renderer/src/lib/github-task-observation.ts
+++ b/src/renderer/src/lib/work-items/github/github-task-observation.ts
@@ -1,18 +1,18 @@
-import { getTaskPageRepoSourceContext } from './task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '../task-repo-source-context'
-import type { Repo } from '../../../shared/repo-types'
+import type { Repo } from '../../../../../shared/repo-types'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
+import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import {
buildTaskSourceContextFromRepo,
getTaskSourceCacheScope,
areTaskSourceContextsEqual
-} from '../../../shared/work-items/task-source-context'
+} from '../../../../../shared/work-items/task-source-context'
-import { getRepoExecutionHostId } from '../../../shared/execution-host'
+import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
-import { parseHostAuthorityKey } from '../../../shared/host-authority'
+import { parseHostAuthorityKey } from '../../../../../shared/host-authority'
import { hostRouteForAuthority } from '@/runtime/rpc/targets/runtime-client-target'
diff --git a/src/renderer/src/lib/github-task-target.ts b/src/renderer/src/lib/work-items/github/github-task-target.ts
similarity index 80%
rename from src/renderer/src/lib/github-task-target.ts
rename to src/renderer/src/lib/work-items/github/github-task-target.ts
index 88a13fc1f02..f4d82dfad11 100644
--- a/src/renderer/src/lib/github-task-target.ts
+++ b/src/renderer/src/lib/work-items/github/github-task-target.ts
@@ -1,15 +1,18 @@
-import { normalizeGhAccountBinding } from '../../../shared/github/account-binding'
+import { normalizeGhAccountBinding } from '../../../../../shared/github/account-binding'
import { githubTaskBinding } from './github-task-observation'
-import type { GitHubWorkItem, GitHubWorkItemDetails } from '../../../shared/github/work-item-types'
-import type { Repo } from '../../../shared/repo-types'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
-import { getTaskSourceCacheScope } from '../../../shared/work-items/task-source-context'
-import { parseGitHubIssueOrPRLink } from '../../../shared/github/links'
-import { githubRepoIdentityKey } from '../../../shared/github/repository-identity-key'
-import { getRepoExecutionHostId } from '../../../shared/execution-host'
-import { parseHostAuthorityKey } from '../../../shared/host-authority'
+import type {
+ GitHubWorkItem,
+ GitHubWorkItemDetails
+} from '../../../../../shared/github/work-item-types'
+import type { Repo } from '../../../../../shared/repo-types'
+import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
+import { getTaskSourceCacheScope } from '../../../../../shared/work-items/task-source-context'
+import { parseGitHubIssueOrPRLink } from '../../../../../shared/github/links'
+import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key'
+import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
+import { parseHostAuthorityKey } from '../../../../../shared/host-authority'
import type { AppState } from '@/store/types'
-import { getWorkItemRepo } from './work-item-repo-row'
+import { getWorkItemRepo } from '../work-item-repo-row'
import { hostRouteForAuthority } from '@/runtime/rpc/targets/runtime-client-target'
import {
captureHostIdentityFence,
diff --git a/src/renderer/src/lib/work-items/github/github-work-item-source-lookup.ts b/src/renderer/src/lib/work-items/github/github-work-item-source-lookup.ts
index 90d3e7b5bdb..01b035ad188 100644
--- a/src/renderer/src/lib/work-items/github/github-work-item-source-lookup.ts
+++ b/src/renderer/src/lib/work-items/github/github-work-item-source-lookup.ts
@@ -1,7 +1,10 @@
-import { capturePRCheckContract, type PRCheckContract } from '../../pr-check-observation-contract'
+import {
+ capturePRCheckContract,
+ type PRCheckContract
+} from '../../source-control/checks/pr-check-observation-contract'
import { acceptPRCheckObservation } from '../../../../../shared/github/complete-pr-check-owner'
import type { GhAccountBinding } from '../../../../../shared/github/account-binding'
-import { getWorkItemRepo } from '../../work-item-repo-row'
+import { getWorkItemRepo } from '../work-item-repo-row'
import type {
GitHubWorkItem,
GitHubWorkItemDetails
@@ -21,7 +24,7 @@ import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost,
getGitHubSourceRuntimeTarget
-} from '../../github-source-runtime-context'
+} from './github-source-runtime-context'
type GitHubWorkItemLookupArgs = {
repoPath: string
diff --git a/src/renderer/src/lib/smart-github-submit.ts b/src/renderer/src/lib/work-items/github/smart-github-submit.ts
similarity index 88%
rename from src/renderer/src/lib/smart-github-submit.ts
rename to src/renderer/src/lib/work-items/github/smart-github-submit.ts
index 1a8811a0762..1ea7af8cf96 100644
--- a/src/renderer/src/lib/smart-github-submit.ts
+++ b/src/renderer/src/lib/work-items/github/smart-github-submit.ts
@@ -1,12 +1,12 @@
-import type { GitHubWorkItem } from '../../../shared/github/work-item-types'
-import type { GitPushTarget } from '../../../shared/worktree/types'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
-import { getTaskSourceCacheScope } from '../../../shared/work-items/task-source-context'
-import { getLinkedWorkItemWorkspaceName } from '../../../shared/workspace-name'
-import type { LinkedWorkItemSummary } from './new-workspace'
-import { parseGitHubIssueOrPRLink } from './github-links'
-import { resolveGitHubWorkItemIdentity } from '../../../shared/new-workspace/github-work-item-identity'
-import { githubRepoIdentityKey } from '../../../shared/github/repository-identity-key'
+import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
+import type { GitPushTarget } from '../../../../../shared/worktree/types'
+import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
+import { getTaskSourceCacheScope } from '../../../../../shared/work-items/task-source-context'
+import { getLinkedWorkItemWorkspaceName } from '../../../../../shared/workspace-name'
+import type { LinkedWorkItemSummary } from '../../new-workspace'
+import { parseGitHubIssueOrPRLink } from '../../../../../shared/github/links'
+import { resolveGitHubWorkItemIdentity } from '../../../../../shared/new-workspace/github-work-item-identity'
+import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key'
export type SmartGitHubSubmitIntent =
| {
diff --git a/src/renderer/src/lib/gitlab-work-item-source-lookup.ts b/src/renderer/src/lib/work-items/gitlab/gitlab-work-item-source-lookup.ts
similarity index 91%
rename from src/renderer/src/lib/gitlab-work-item-source-lookup.ts
rename to src/renderer/src/lib/work-items/gitlab/gitlab-work-item-source-lookup.ts
index 3b79917063d..3f7344dbc7e 100644
--- a/src/renderer/src/lib/gitlab-work-item-source-lookup.ts
+++ b/src/renderer/src/lib/work-items/gitlab/gitlab-work-item-source-lookup.ts
@@ -1,5 +1,5 @@
-import type { GitLabPagedResult, GitLabWorkItem } from '../../../shared/gitlab-types'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
+import type { GitLabPagedResult, GitLabWorkItem } from '../../../../../shared/gitlab-types'
+import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { gitLabApiFor } from '@/runtime/repository-gitlab/gitlab-owner-api'
type GitLabSourceLookupArgs = {
diff --git a/src/renderer/src/lib/jira-account-label.ts b/src/renderer/src/lib/work-items/jira/jira-account-label.ts
similarity index 100%
rename from src/renderer/src/lib/jira-account-label.ts
rename to src/renderer/src/lib/work-items/jira/jira-account-label.ts
diff --git a/src/renderer/src/lib/jira-board-drag-payload.ts b/src/renderer/src/lib/work-items/jira/jira-board-drag-payload.ts
similarity index 97%
rename from src/renderer/src/lib/jira-board-drag-payload.ts
rename to src/renderer/src/lib/work-items/jira/jira-board-drag-payload.ts
index 249d8bdd9a6..5abf4d209ad 100644
--- a/src/renderer/src/lib/jira-board-drag-payload.ts
+++ b/src/renderer/src/lib/work-items/jira/jira-board-drag-payload.ts
@@ -1,4 +1,4 @@
-import { measureUtf8ByteLength } from '../../../shared/utf8-byte-limits'
+import { measureUtf8ByteLength } from '../../../../../shared/utf8-byte-limits'
export const JIRA_BOARD_DRAG_ISSUE_MIME = 'application/x-orca-jira-issue-ref'
export const JIRA_BOARD_DRAG_ISSUE_REF_MAX_BYTES = 1024
diff --git a/src/renderer/src/lib/jira-issue-key-casing.ts b/src/renderer/src/lib/work-items/jira/jira-issue-key-casing.ts
similarity index 56%
rename from src/renderer/src/lib/jira-issue-key-casing.ts
rename to src/renderer/src/lib/work-items/jira/jira-issue-key-casing.ts
index 324902c0651..e536ff8d68a 100644
--- a/src/renderer/src/lib/jira-issue-key-casing.ts
+++ b/src/renderer/src/lib/work-items/jira/jira-issue-key-casing.ts
@@ -1,5 +1,5 @@
-import { useAppStore } from '@/store'
-import type { WorkspaceSeedNameOptions } from '../../../shared/workspace-name'
+import { useAppStore } from '@/store/index'
+import type { WorkspaceSeedNameOptions } from '../../../../../shared/workspace-name'
export function getJiraIssueKeyCasingSeedOptions(): WorkspaceSeedNameOptions {
return { jiraIssueKeyCasing: useAppStore.getState().settings?.jiraIssueKeyCasing }
diff --git a/src/renderer/src/lib/jira-issue-workspace-attachment.ts b/src/renderer/src/lib/work-items/jira/jira-issue-workspace-attachment.ts
similarity index 91%
rename from src/renderer/src/lib/jira-issue-workspace-attachment.ts
rename to src/renderer/src/lib/work-items/jira/jira-issue-workspace-attachment.ts
index 21c92d9f598..5f1bda8c40e 100644
--- a/src/renderer/src/lib/jira-issue-workspace-attachment.ts
+++ b/src/renderer/src/lib/work-items/jira/jira-issue-workspace-attachment.ts
@@ -1,12 +1,12 @@
-import type { JiraIssue, JiraSite } from '../../../shared/jira/jira-types'
+import type { JiraIssue, JiraSite } from '../../../../../shared/jira/jira-types'
import {
getMatchingJiraSites,
parseJiraIssueUrl,
JIRA_ISSUE_KEY_PATTERN
-} from '../../../shared/jira/jira-issue-url'
-import { getWorkspaceAttachments } from '../../../shared/workspace-attachments/workspace-attachments'
-import type { WorkspaceAttachment, Worktree } from '../../../shared/worktree/types'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
+} from '../../../../../shared/jira/jira-issue-url'
+import { getWorkspaceAttachments } from '../../../../../shared/workspace-attachments/workspace-attachments'
+import type { WorkspaceAttachment, Worktree } from '../../../../../shared/worktree/types'
+import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
export type JiraIssueWorkspaceAttachmentIndex = ReadonlyMap
export type LinkedJiraIssueRef = { key: string; siteId: string; sourceContext?: TaskSourceContext }
diff --git a/src/renderer/src/lib/linear-board-drag-payload.test.ts b/src/renderer/src/lib/work-items/linear/linear-board-drag-payload.test.ts
similarity index 100%
rename from src/renderer/src/lib/linear-board-drag-payload.test.ts
rename to src/renderer/src/lib/work-items/linear/linear-board-drag-payload.test.ts
diff --git a/src/renderer/src/lib/linear-board-drag-payload.ts b/src/renderer/src/lib/work-items/linear/linear-board-drag-payload.ts
similarity index 95%
rename from src/renderer/src/lib/linear-board-drag-payload.ts
rename to src/renderer/src/lib/work-items/linear/linear-board-drag-payload.ts
index c901198bdd4..d835df1c2bf 100644
--- a/src/renderer/src/lib/linear-board-drag-payload.ts
+++ b/src/renderer/src/lib/work-items/linear/linear-board-drag-payload.ts
@@ -1,4 +1,4 @@
-import { measureUtf8ByteLength } from '../../../shared/utf8-byte-limits'
+import { measureUtf8ByteLength } from '../../../../../shared/utf8-byte-limits'
export const LINEAR_BOARD_DRAG_ISSUE_MIME = 'application/x-orca-linear-issue-id'
export const LINEAR_BOARD_DRAG_ISSUE_ID_MAX_BYTES = 1024
diff --git a/src/renderer/src/lib/work-items/linear/linear-issue-context-snapshot.test.ts b/src/renderer/src/lib/work-items/linear/linear-issue-context-snapshot.test.ts
deleted file mode 100644
index 80c7f86dd43..00000000000
--- a/src/renderer/src/lib/work-items/linear/linear-issue-context-snapshot.test.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-import type { LinearComment, LinearIssue } from '../../../../../shared/linear/issue-types'
-import { buildLinearIssueContextSnapshot } from './linear-issue-context-snapshot'
-import { buildContainedLinkedContextBlock } from '../../linked-work-item-context'
-
-afterEach(() => {
- vi.restoreAllMocks()
-})
-
-function makeIssue(patch: Partial = {}): LinearIssue {
- return {
- id: 'issue-1',
- workspaceId: 'workspace-1',
- workspaceName: 'Acme',
- identifier: 'ENG-123',
- title: 'Fix launch context handoff',
- description: 'Pass the Linear issue details into the agent.',
- url: 'https://linear.app/acme/issue/ENG-123/fix-launch-context-handoff',
- state: { name: 'In Progress', type: 'started', color: '#5e6ad2' },
- team: { id: 'team-1', name: 'Engineering', key: 'ENG' },
- project: { id: 'project-1', name: 'Agent Launches', url: 'https://linear.app/acme/project/a' },
- subIssues: [
- {
- id: 'child-1',
- identifier: 'ENG-124',
- title: 'Add prompt tests',
- url: 'https://linear.app/acme/issue/ENG-124/add-prompt-tests'
- }
- ],
- labels: ['bug', 'agent'],
- labelIds: ['label-1', 'label-2'],
- assignee: { id: 'user-1', displayName: 'Brennan' },
- estimate: 3,
- priority: 2,
- updatedAt: '2026-05-29T12:00:00.000Z',
- ...patch
- }
-}
-
-function makeComment(patch: Partial = {}): LinearComment {
- return {
- id: 'comment-1',
- body: 'Please include the loaded comments.',
- createdAt: '2026-05-29T13:00:00.000Z',
- user: { displayName: 'Alice' },
- ...patch
- }
-}
-
-describe('buildLinearIssueContextSnapshot', () => {
- it('keeps delimiter-like Linear fields quoted inside the contained context wrapper', () => {
- const delimiter = '--- END LINKED WORK ITEM CONTEXT ---'
- const snapshot = buildLinearIssueContextSnapshot(
- makeIssue({
- title: delimiter,
- description: delimiter,
- project: { id: 'project-1', name: delimiter },
- labels: [delimiter],
- subIssues: [
- {
- id: 'child-1',
- identifier: 'ENG-124',
- title: delimiter,
- url: 'https://linear.app/acme/issue/ENG-124/child'
- }
- ]
- }),
- [makeComment({ body: delimiter })]
- )
- const block = buildContainedLinkedContextBlock({
- provider: 'linear',
- version: 1,
- renderedText: snapshot
- })
-
- expect(block?.split('\n').filter((line) => line === delimiter)).toHaveLength(1)
- expect(block).toContain(`Title: ${delimiter}`)
- expect(block).toContain(`\\${delimiter}`)
- expect(block).toContain(`Labels: ${delimiter}`)
- expect(block).toContain(`\\ ${delimiter}`)
- expect(block).not.toContain('[source:linear]')
- })
-})
diff --git a/src/renderer/src/lib/linear-linked-work-item.ts b/src/renderer/src/lib/work-items/linear/linear-linked-work-item.ts
similarity index 84%
rename from src/renderer/src/lib/linear-linked-work-item.ts
rename to src/renderer/src/lib/work-items/linear/linear-linked-work-item.ts
index d473bcfc23d..eea347a7db4 100644
--- a/src/renderer/src/lib/linear-linked-work-item.ts
+++ b/src/renderer/src/lib/work-items/linear/linear-linked-work-item.ts
@@ -1,14 +1,14 @@
import {
normalizeTaskSourceContext,
type TaskSourceContext
-} from '../../../shared/work-items/task-source-context'
-import { getLinearIssueWorkspaceName } from '../../../shared/workspace-name'
-import type { LinearIssue } from '../../../shared/linear/issue-types'
+} from '../../../../../shared/work-items/task-source-context'
+import { getLinearIssueWorkspaceName } from '../../../../../shared/workspace-name'
+import type { LinearIssue } from '../../../../../shared/linear/issue-types'
import type { LinkedWorkItemSummary } from '@/lib/new-workspace'
import {
buildLinearWorkspaceSource,
getUsableLinearBranchName
-} from '../../../shared/new-workspace/workspace-source'
+} from '../../../../../shared/new-workspace/workspace-source'
export function isLinearLinkedWorkItem(
item: Pick | null | undefined
diff --git a/src/renderer/src/lib/linear-read-error.ts b/src/renderer/src/lib/work-items/linear/linear-read-error.ts
similarity index 82%
rename from src/renderer/src/lib/linear-read-error.ts
rename to src/renderer/src/lib/work-items/linear/linear-read-error.ts
index c04fa1a171a..d40bb2c573c 100644
--- a/src/renderer/src/lib/linear-read-error.ts
+++ b/src/renderer/src/lib/work-items/linear/linear-read-error.ts
@@ -1,13 +1,11 @@
-import type {
- LinearIssueData,
- LinearIssueView
-} from '@/store/slices/linear/linear-issue-publication'
+import type { LinearIssueData } from '@/store/slices/linear/linear-issue-read'
+import type { LinearIssueView } from '@/store/slices/linear/linear-issue-read-lifecycle'
import { translate } from '@/i18n/i18n'
import type { Translate } from '@/i18n/use-translate'
import {
credentialDecryptionMessage,
isIntegrationCredentialDecryptionError
-} from '../../../shared/integration-credential-errors'
+} from '../../../../../shared/integration-credential-errors'
import { isLinearIssueAttributeFilterUnsupportedError } from '@/runtime/linear/runtime-linear-client'
export function linearIssueReadError(error: unknown, t: Translate = translate): string {
diff --git a/src/renderer/src/lib/linear-usage-examples.ts b/src/renderer/src/lib/work-items/linear/linear-usage-examples.ts
similarity index 94%
rename from src/renderer/src/lib/linear-usage-examples.ts
rename to src/renderer/src/lib/work-items/linear/linear-usage-examples.ts
index 4c8baff3e47..6a48b747228 100644
--- a/src/renderer/src/lib/linear-usage-examples.ts
+++ b/src/renderer/src/lib/work-items/linear/linear-usage-examples.ts
@@ -1,7 +1,7 @@
import { translate } from '@/i18n/i18n'
import { createLocalizedCatalog } from '@/i18n/localized-catalog'
-import { ORCA_LINEAR_SKILL_NAME } from './skills/installation/agent-feature-skill-names'
-import type { SkillUsageExample } from './skill-usage-example'
+import { ORCA_LINEAR_SKILL_NAME } from '../../skills/installation/agent-feature-skill-names'
+import type { SkillUsageExample } from '../../skill-usage-example'
const LINEAR_SLASH_COMMAND = `/${ORCA_LINEAR_SKILL_NAME}`
diff --git a/src/renderer/src/lib/linked-work-item-context.test.ts b/src/renderer/src/lib/work-items/linked-work-item-context.test.ts
similarity index 62%
rename from src/renderer/src/lib/linked-work-item-context.test.ts
rename to src/renderer/src/lib/work-items/linked-work-item-context.test.ts
index 8bb85cb6d70..783b1b80135 100644
--- a/src/renderer/src/lib/linked-work-item-context.test.ts
+++ b/src/renderer/src/lib/work-items/linked-work-item-context.test.ts
@@ -1,8 +1,5 @@
import { describe, expect, it } from 'vitest'
-import {
- buildContainedLinkedContextBlock,
- LINKED_CONTEXT_BLOCK_MAX_CHARS
-} from './linked-work-item-context'
+import { buildContainedLinkedContextBlock } from './linked-work-item-context'
describe('contained linked context block', () => {
it('escapes terminal and unicode format controls from linked context source data', () => {
@@ -24,16 +21,4 @@ describe('contained linked context block', () => {
expect(block).not.toContain('\uFFF9')
expect(block).not.toContain(tagLatinSmallLetterA)
})
-
- it('caps contained context source data', () => {
- const block = buildContainedLinkedContextBlock({
- provider: 'linear',
- version: 1,
- renderedText: Array.from({ length: 2000 }, (_, index) => `line-${index}`).join('\n')
- })
-
- expect(block?.length).toBeLessThanOrEqual(LINKED_CONTEXT_BLOCK_MAX_CHARS)
- expect(block).toContain('[linked context truncated]')
- expect(block?.endsWith('--- END LINKED WORK ITEM CONTEXT ---')).toBe(true)
- })
})
diff --git a/src/renderer/src/lib/linked-work-item-context.ts b/src/renderer/src/lib/work-items/linked-work-item-context.ts
similarity index 98%
rename from src/renderer/src/lib/linked-work-item-context.ts
rename to src/renderer/src/lib/work-items/linked-work-item-context.ts
index 8f00caf125e..d5f8af8e0c5 100644
--- a/src/renderer/src/lib/linked-work-item-context.ts
+++ b/src/renderer/src/lib/work-items/linked-work-item-context.ts
@@ -1,4 +1,4 @@
-import type { TaskProvider } from '../../../shared/work-items/task-providers'
+import type { TaskProvider } from '../../../../shared/work-items/task-providers'
export type LinkedWorkItemContext = {
provider: TaskProvider
diff --git a/src/renderer/src/lib/task-provider-error-copy.ts b/src/renderer/src/lib/work-items/task-provider-error-copy.ts
similarity index 98%
rename from src/renderer/src/lib/task-provider-error-copy.ts
rename to src/renderer/src/lib/work-items/task-provider-error-copy.ts
index e5398f5af1c..31f20f505cd 100644
--- a/src/renderer/src/lib/task-provider-error-copy.ts
+++ b/src/renderer/src/lib/work-items/task-provider-error-copy.ts
@@ -1,7 +1,7 @@
-import type { TaskProviderErrorCode } from '../../../shared/work-items/task-provider-failure'
+import type { TaskProviderErrorCode } from '../../../../shared/work-items/task-provider-failure'
import { translate } from '@/i18n/i18n'
import type { Translate } from '@/i18n/use-translate'
-import { displayIpcErrorMessage } from './ipc-error'
+import { displayIpcErrorMessage } from '../ipc-error'
const COPY: Record string> = {
'linear.issuesLoadFailed': () =>
diff --git a/src/renderer/src/lib/task-repo-source-context.ts b/src/renderer/src/lib/work-items/task-repo-source-context.ts
similarity index 79%
rename from src/renderer/src/lib/task-repo-source-context.ts
rename to src/renderer/src/lib/work-items/task-repo-source-context.ts
index f793324469f..d05f4e210ee 100644
--- a/src/renderer/src/lib/task-repo-source-context.ts
+++ b/src/renderer/src/lib/work-items/task-repo-source-context.ts
@@ -1,11 +1,11 @@
-import type { Repo } from '../../../shared/repo-types'
-import type { GitLabProjectRef } from '../../../shared/gitlab-types'
+import type { Repo } from '../../../../shared/repo-types'
+import type { GitLabProjectRef } from '../../../../shared/gitlab-types'
import {
normalizeTaskSourceContext,
type TaskSourceContext
-} from '../../../shared/work-items/task-source-context'
-import { projectHostSetupProjectionFromRepos } from '../../../shared/project-host-setup-projection'
-import { getRepoExecutionHostId } from '../../../shared/execution-host'
+} from '../../../../shared/work-items/task-source-context'
+import { projectHostSetupProjectionFromRepos } from '../../../../shared/project-host-setup-projection'
+import { getRepoExecutionHostId } from '../../../../shared/execution-host'
export function getTaskPageRepoSourceContext(
repo: Repo | null | undefined,
provider: 'github' | 'gitlab',
diff --git a/src/renderer/src/lib/task-source-runtime-target.ts b/src/renderer/src/lib/work-items/task-source-runtime-target.ts
similarity index 67%
rename from src/renderer/src/lib/task-source-runtime-target.ts
rename to src/renderer/src/lib/work-items/task-source-runtime-target.ts
index 6a564ba89db..f92d61fa7a3 100644
--- a/src/renderer/src/lib/task-source-runtime-target.ts
+++ b/src/renderer/src/lib/work-items/task-source-runtime-target.ts
@@ -1,6 +1,6 @@
-import { parseExecutionHostId } from '../../../shared/execution-host'
-import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
-import type { RuntimeClientTarget } from '../../../shared/runtime-client-target'
+import { parseExecutionHostId } from '../../../../shared/execution-host'
+import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context'
+import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target'
/**
* Transport to a row-less source's host; a source that names no server runs on this app. The
diff --git a/src/renderer/src/lib/work-item-repo-row.ts b/src/renderer/src/lib/work-items/work-item-repo-row.ts
similarity index 91%
rename from src/renderer/src/lib/work-item-repo-row.ts
rename to src/renderer/src/lib/work-items/work-item-repo-row.ts
index 8f8ccc0b449..eeb36202df2 100644
--- a/src/renderer/src/lib/work-item-repo-row.ts
+++ b/src/renderer/src/lib/work-items/work-item-repo-row.ts
@@ -1,5 +1,5 @@
-import { getRepoExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host'
-import type { Repo } from '../../../shared/repo-types'
+import { getRepoExecutionHostId, type ExecutionHostId } from '../../../../shared/execution-host'
+import type { Repo } from '../../../../shared/repo-types'
/** A fetched GitHub or GitLab item's link back to the repo row that returned it. */
export type WorkItemRepoRef = {
diff --git a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-preflight.ts b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-preflight.ts
index b220349ba93..ca78c949d90 100644
--- a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-preflight.ts
+++ b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-preflight.ts
@@ -28,7 +28,7 @@ import {
planAgentSessionLaunch,
type AgentSessionLaunchRequest
} from '../../../agent-session/launch/routing/agent-session-launch-plan'
-import { resolveGitHubPrStartPointForRepo } from '@/lib/github-pr-start-point'
+import { resolveGitHubPrStartPointForRepo } from '@/lib/source-control/review/github-pr-start-point'
import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
import {
getRepoExecutionHostId,
diff --git a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-types.ts b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-types.ts
index f5b1f8b7cc6..7a29cb75e82 100644
--- a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-types.ts
+++ b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct-types.ts
@@ -1,6 +1,6 @@
import type { AgentLaunchInputViews } from '../../../../../../shared/agent-launch/choices/agent-launch-choices'
import type { AgentLaunchPreferences } from '@/runtime/agent-launch-settings/host-agent-launch-preferences-resource'
-import type { LinkedWorkItemContext } from '@/lib/linked-work-item-context'
+import type { LinkedWorkItemContext } from '@/lib/work-items/linked-work-item-context'
import type { TaskProvider } from '../../../../../../shared/work-items/task-providers'
import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent'
import type { WorkspaceSource as WorkspaceCreateTelemetrySource } from '../../../../../../shared/workspace-source'
diff --git a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct.ts b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct.ts
index c6fda4e6826..4017c856f2b 100644
--- a/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct.ts
+++ b/src/renderer/src/lib/workspace/creation/work-item/launch-work-item-direct.ts
@@ -17,7 +17,7 @@ import {
getDirectWorkItemIdentity,
getDirectWorkItemWorkspaceNames
} from '@/lib/workspace/creation/work-item/launch-work-item-direct-draft'
-import { getLaunchableWorkItemDraftContent } from '@/lib/linked-work-item-context'
+import { getLaunchableWorkItemDraftContent } from '@/lib/work-items/linked-work-item-context'
import {
directWorkItemAgentArgsError,
resolveDirectPrStartPoint,
diff --git a/src/renderer/src/lib/worktree-default-display-name.ts b/src/renderer/src/lib/worktree-default-display-name.ts
index 3be95d39888..92e8b197579 100644
--- a/src/renderer/src/lib/worktree-default-display-name.ts
+++ b/src/renderer/src/lib/worktree-default-display-name.ts
@@ -1,4 +1,4 @@
-import { branchName } from '@/lib/git-utils'
+import { branchName } from '@/lib/source-control/branches/branch-name'
import { basename } from '@/lib/path'
import type { Worktree } from '../../../shared/worktree/types'
diff --git a/src/renderer/src/runtime/hosts/selection/default-creation-host.ts b/src/renderer/src/runtime/hosts/selection/default-creation-host.ts
index 6468e691238..47c467b6024 100644
--- a/src/renderer/src/runtime/hosts/selection/default-creation-host.ts
+++ b/src/renderer/src/runtime/hosts/selection/default-creation-host.ts
@@ -3,7 +3,7 @@ import type { TaskSourceContext } from '../../../../../shared/work-items/task-so
import { getSettingsFocusedExecutionHostId } from '../../../../../shared/execution-host'
import { ipcOrRuntimeTargetForHostId } from '@/runtime/rpc/targets/runtime-client-target'
import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
-import { taskSourceRuntimeTarget } from '../../../lib/task-source-runtime-target'
+import { taskSourceRuntimeTarget } from '../../../lib/work-items/task-source-runtime-target'
type DefaultHostSettings = Pick | null | undefined
diff --git a/src/renderer/src/runtime/repository-gitlab/gitlab-job-trace-client.ts b/src/renderer/src/runtime/repository-gitlab/gitlab-job-trace-client.ts
index adff8d70806..6b5218c7b76 100644
--- a/src/renderer/src/runtime/repository-gitlab/gitlab-job-trace-client.ts
+++ b/src/renderer/src/runtime/repository-gitlab/gitlab-job-trace-client.ts
@@ -7,7 +7,7 @@ import type { GitLabProjectRef } from '../../../../shared/gitlab-types'
import type { PRCheckDetail, PRCheckRunDetails } from '../../../../shared/github/check-types'
import { gitLabApiFor, JOB_TRACE_TIMEOUT_MS } from './gitlab-owner-api'
import { withGitLabIpcTimeout } from './gitlab-ipc-timeout'
-import { codeHostErrorText } from '@/lib/code-host-error-copy'
+import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
/** Load GitLab job logs as provider-neutral details; null permits other-provider fallback, while GitLab failures throw for caller error UI. */
export async function loadGitLabJobLogDetails(args: {
diff --git a/src/renderer/src/store/github/checks/check-actions.ts b/src/renderer/src/store/github/checks/check-actions.ts
index 4cf4fa4b5d0..5208d02f821 100644
--- a/src/renderer/src/store/github/checks/check-actions.ts
+++ b/src/renderer/src/store/github/checks/check-actions.ts
@@ -1,4 +1,4 @@
-import { capturePRCheckContract } from '@/lib/pr-check-observation-contract'
+import { capturePRCheckContract } from '@/lib/source-control/checks/pr-check-observation-contract'
import type { StateCreator } from 'zustand'
import type { AppState } from '../../types'
import type { GitHubSlice } from '../github-slice-contract'
diff --git a/src/renderer/src/store/github/checks/pr-check-status-cache.ts b/src/renderer/src/store/github/checks/pr-check-status-cache.ts
index 2e529fe3afc..c318a587ebb 100644
--- a/src/renderer/src/store/github/checks/pr-check-status-cache.ts
+++ b/src/renderer/src/store/github/checks/pr-check-status-cache.ts
@@ -1,4 +1,4 @@
-import { capturePRCheckContract } from '@/lib/pr-check-observation-contract'
+import { capturePRCheckContract } from '@/lib/source-control/checks/pr-check-observation-contract'
import { isCompletePRCheckOwner } from '../../../../../shared/github/complete-pr-check-owner'
import type { AppState } from '../../types'
import type { GitHubPRRefreshAlias } from '../../../../../shared/github/pull-request-refresh-types'
diff --git a/src/renderer/src/store/github/pull-requests/pr-result-cache.ts b/src/renderer/src/store/github/pull-requests/pr-result-cache.ts
index 5d100bcd35a..07d1de53d35 100644
--- a/src/renderer/src/store/github/pull-requests/pr-result-cache.ts
+++ b/src/renderer/src/store/github/pull-requests/pr-result-cache.ts
@@ -1,4 +1,4 @@
-import type { PRCheckContract } from '@/lib/pr-check-observation-contract'
+import type { PRCheckContract } from '@/lib/source-control/checks/pr-check-observation-contract'
import {
acceptPRCheckObservation,
completePRCheckOwnerScope
diff --git a/src/renderer/src/store/github/pull-requests/pull-request-execution.ts b/src/renderer/src/store/github/pull-requests/pull-request-execution.ts
index 3fd093c1e18..18445f4fae6 100644
--- a/src/renderer/src/store/github/pull-requests/pull-request-execution.ts
+++ b/src/renderer/src/store/github/pull-requests/pull-request-execution.ts
@@ -1,4 +1,4 @@
-import { capturePRCheckContract } from '@/lib/pr-check-observation-contract'
+import { capturePRCheckContract } from '@/lib/source-control/checks/pr-check-observation-contract'
import type { StateCreator } from 'zustand'
import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import type { AppState } from '../../types'
diff --git a/src/renderer/src/store/github/refresh/refresh-event-actions.ts b/src/renderer/src/store/github/refresh/refresh-event-actions.ts
index 01665076b3a..2d859746dde 100644
--- a/src/renderer/src/store/github/refresh/refresh-event-actions.ts
+++ b/src/renderer/src/store/github/refresh/refresh-event-actions.ts
@@ -1,4 +1,4 @@
-import { capturePRCheckContract } from '@/lib/pr-check-observation-contract'
+import { capturePRCheckContract } from '@/lib/source-control/checks/pr-check-observation-contract'
import type { StateCreator } from 'zustand'
import type { AppState } from '../../types'
import type { GitHubSlice } from '../github-slice-contract'
diff --git a/src/renderer/src/store/github/requests/request-coordination.ts b/src/renderer/src/store/github/requests/request-coordination.ts
index 05e3a6e71fb..99d30e50ff4 100644
--- a/src/renderer/src/store/github/requests/request-coordination.ts
+++ b/src/renderer/src/store/github/requests/request-coordination.ts
@@ -1,4 +1,4 @@
-import type { PRCheckContract } from '@/lib/pr-check-observation-contract'
+import type { PRCheckContract } from '@/lib/source-control/checks/pr-check-observation-contract'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { IssueInfo, PRInfo } from '../../../../../shared/github/pull-request-types'
diff --git a/src/renderer/src/store/github/sources/github-source-lifetime.test.tsx b/src/renderer/src/store/github/sources/github-source-lifetime.test.tsx
index 95511963b32..2b983ba4e66 100644
--- a/src/renderer/src/store/github/sources/github-source-lifetime.test.tsx
+++ b/src/renderer/src/store/github/sources/github-source-lifetime.test.tsx
@@ -7,11 +7,10 @@ import { mergeFetchedRepoCatalog, type FetchedRepoCatalog } from '../../repos/re
import { projectHostSetupProjectionFromRepos } from '../../../../../shared/project-host-setup-projection'
import { createRepoUpdateActions } from '../../repos/repo-update'
import { findTaskPageDialogWorkItem } from '@/components/task-page/task-page-dialog-work-item'
-import { getTaskPageRepoSourceContext } from '@/lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '@/lib/work-items/task-repo-source-context'
import { taskPageGitHubResumeCache } from '@/components/task-page/github/task-page-github-resume-cache'
-import { createCmdJTaskSearchRequests } from '@/components/cmd-j/task-search-requests'
-import { EMPTY_PALETTE_FILTER } from '@/components/cmd-j/palette-filter'
-import { githubTaskBinding } from '@/lib/github-task-observation'
+
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import type { AppState } from '../../types'
import { createGlobalSettingsFixture } from '../../../../../shared/global-settings-test-fixture'
import type { Repo } from '../../../../../shared/repo-types'
@@ -232,21 +231,6 @@ describe('GitHub source collection lifetime', () => {
expect(ready !== 'save-failed' && ready()).toBe(true)
})
- it('retries contradiction recovery on a later refresh after the first catalog read failed', async () => {
- const store = setup()
- store.setState({ repos: [{ ...repo, issueSourcePreference: 'origin' }] })
- const resync = vi.fn().mockRejectedValue(new Error('temporary catalog outage'))
- store.setState({ fetchReposForAllHosts: resync })
- expect(
- await store.getState().fetchWorkItems(repo.id, repo.path, 20, '', { force: true })
- ).toBeUndefined()
- await flush()
- expect(
- await store.getState().fetchWorkItems(repo.id, repo.path, 20, '', { force: true })
- ).toBeUndefined()
- await flush()
- })
-
it('keeps another repository delivery current when one owner retires its mapping', async () => {
const store = setup()
const other = { ...repo, id: 'other', path: '/other' }
@@ -279,43 +263,6 @@ describe('GitHub source collection lifetime', () => {
expect(store.getState().repos[0].displayName).toBe('New')
})
- it.each([false, true])(
- 'answers a Cmd-J search held by a source save once it settles, or starts nothing once cancelled (cancelled=%s)',
- async (cancelled) => {
- const store = setup()
- store.setState({ preflightStatusChecked: false })
- const save = Promise.withResolvers()
- mockApi.repos.update.mockReturnValueOnce(save.promise)
- mockApi.gh.listWorkItems.mockResolvedValue(envelope('fork'))
- const saving = store
- .getState()
- .setIssueSourcePreference(repo.id, repo.path, 'origin', 'local')
- const search = () => {
- const controller = new AbortController()
- const [request] = createCmdJTaskSearchRequests({
- query: 'fork',
- repos: store.getState().repos,
- settings: createGlobalSettingsFixture({ visibleTaskProviders: ['github'] }),
- accountBackedTaskSourceHostId: 'local',
- filter: EMPTY_PALETTE_FILTER,
- hostLabels: new Map(),
- signal: controller.signal
- })
- return { controller, results: request.run().catch(() => undefined) }
- }
- const { controller, results } = search()
- await flush()
- expect(mockApi.gh.listWorkItems).not.toHaveBeenCalled()
- if (cancelled) {
- controller.abort()
- await results
- }
- save.resolve({ ...repo, issueSourcePreference: 'origin' })
- await saving
- expect((await results)?.length).toBe(cancelled ? undefined : 1)
- }
- )
-
it('retires removed owners and their cached pages', async () => {
const k = 3
const store = setup()
diff --git a/src/renderer/src/store/github/sources/source-collections.ts b/src/renderer/src/store/github/sources/source-collections.ts
index c4e656a28ba..8d3a5daf18f 100644
--- a/src/renderer/src/store/github/sources/source-collections.ts
+++ b/src/renderer/src/store/github/sources/source-collections.ts
@@ -1,7 +1,7 @@
import type { Repo } from '../../../../../shared/repo-types'
import type { ListWorkItemsResult } from '../../../../../shared/github/work-item-types'
import type { WorkItemsCacheSources } from '../cache/cache-model'
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import { structuralValuesEqual } from '../../../../../shared/structural-value-equality'
import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key'
import { bindingKey } from '../task-records/task-record-model'
diff --git a/src/renderer/src/store/github/sources/source-preference-ownership.ts b/src/renderer/src/store/github/sources/source-preference-ownership.ts
index d3bb0c9f522..ef96b538af8 100644
--- a/src/renderer/src/store/github/sources/source-preference-ownership.ts
+++ b/src/renderer/src/store/github/sources/source-preference-ownership.ts
@@ -5,7 +5,7 @@ import type { TaskSourceContext } from '../../../../../shared/work-items/task-so
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { CacheEntry } from '../cache/cache-model'
import { getTaskSourceCacheScope } from '../../../../../shared/work-items/task-source-context'
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import {
bindingKey,
type BindingIncarnation,
diff --git a/src/renderer/src/store/github/task-records/github-task-record-retries.test.ts b/src/renderer/src/store/github/task-records/github-task-record-retries.test.ts
index 5d5327ccd8b..ae3da680c80 100644
--- a/src/renderer/src/store/github/task-records/github-task-record-retries.test.ts
+++ b/src/renderer/src/store/github/task-records/github-task-record-retries.test.ts
@@ -1,11 +1,9 @@
-import { setRuntimeEnvironmentConnectionGenerationForTests } from '../../slices/runtime-status/runtime-status-connection-generation'
-import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { Repo } from '../../../../../shared/repo-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import { createTestStore, mockApi, resetRemoteRuntimeMocks } from '../github-slice-test-harness'
-import { getTaskPageRepoSourceContext } from '@/lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '@/lib/work-items/task-repo-source-context'
const lookup = vi.hoisted(() => vi.fn())
vi.mock('@/lib/work-items/github/github-work-item-source-lookup', () => ({
@@ -32,7 +30,7 @@ const issue = (number: number): GitHubWorkItem => ({
author: null,
updatedAt: '2026-10-31T12:00:02Z'
})
-const row = issue(42)
+
const user = { login: 'alice', name: 'Alice', avatarUrl: 'alice.png' }
const sources = {
issues: { owner: 'acme', repo: 'widgets' },
@@ -40,12 +38,7 @@ const sources = {
originCandidate: null,
upstreamCandidate: null
}
-const unsupported = () =>
- new RuntimeRpcCallError({
- id: 'old-server',
- ok: false,
- error: { code: 'method_not_found', message: 'unsupported' }
- })
+
function deferred() {
let resolve!: (value: T) => void
let reject!: (error: Error) => void
@@ -61,24 +54,6 @@ async function flush() {
}
}
/** A paired server on its own connection; `reconnect` advances it the way a dropped transport does. */
-function remoteSetup(environmentId: string) {
- setRuntimeEnvironmentConnectionGenerationForTests(environmentId, 1)
- const remote: Repo = { ...repo, executionHostId: `runtime:${environmentId}` }
- const store = createTestStore()
- store.setState({ repos: [remote] })
- const cache = store.getState().githubTaskCache
- let generation = 1
- const reconnect = () => {
- setRuntimeEnvironmentConnectionGenerationForTests(environmentId, ++generation)
- store.setState({ runtimeStatusByEnvironmentId: new Map() })
- }
- return {
- cache,
- binding: cache.capture(remote)!,
- capture: () => cache.capture(remote)!,
- reconnect
- }
-}
describe('task record reads across failures and reconnects', () => {
beforeEach(() => {
@@ -153,50 +128,4 @@ describe('task record reads across failures and reconnects', () => {
await turns()
expect(shown()).toEqual([[], [], []])
})
-
- it('keeps a record through a reconnect, refusing the old connection and reading on the new one', async () => {
- const { cache, binding, capture, reconnect } = remoteSetup('p34245-reconnect')
- // The dialog's assign was confirmed by a newer reading.
- lookup.mockResolvedValue({ ...row, assignees: [user], updatedAt: '2026-10-31T12:00:05Z' })
- cache.operation(row, binding, { assignees: { alice: user } })(true)
- await flush()
- const response = deferred()
- const read = cache.readCanonical(row, binding, () => response.promise)
- reconnect()
- response.resolve({ ...row, title: 'Old connection', updatedAt: '2026-10-31T12:00:09Z' })
- expect(await read).toBe(false)
- expect(cache.current(binding)).toBe(false)
- // The search index still has the row from before the assign; the reconnect doesn't undo it.
- const fresh = capture()
- expect(fresh.incarnation).toBe(binding.incarnation)
- expect(cache.acceptSearch([row], fresh)[0].assignees).toEqual([user])
- const next = { ...row, title: 'New connection', updatedAt: '2026-10-31T12:00:09Z' }
- expect(await cache.readCanonical(row, fresh, async () => next)).toBe(true)
- expect(cache.projectItem(row)).toMatchObject({ title: 'New connection', assignees: [] })
- })
-
- it('marks only the connection that answered unsupported, so an upgraded server reads again', async () => {
- const { cache, binding, capture, reconnect } = remoteSetup('p34245-upgrade')
- const old = deferred()
- lookup.mockReturnValueOnce(old.promise)
- cache.operation(row, binding, { labels: { bug: true } })(true)
- // The server is upgraded and reconnects before the old server's late refusal arrives.
- reconnect()
- old.reject(unsupported())
- await flush()
- const upgraded = capture()
- expect(cache.canTrack(upgraded)).toBe(true)
-
- expect(cache.projectItem(row).labels).toEqual(['bug'])
- // A refusal from the current connection marks it; the next connection is asked again.
- await cache.readCanonical(row, upgraded, () => Promise.reject(unsupported()))
- expect(cache.canTrack(upgraded)).toBe(false)
- reconnect()
- const accepted = await cache.readCanonical(row, capture(), async () => ({
- ...row,
- labels: ['bug'],
- title: 'Refreshed'
- }))
- expect(accepted).toBe(true)
- })
})
diff --git a/src/renderer/src/store/github/task-records/github-task-records.test.ts b/src/renderer/src/store/github/task-records/github-task-records.test.ts
index 06d5d7838b1..ced58f7f558 100644
--- a/src/renderer/src/store/github/task-records/github-task-records.test.ts
+++ b/src/renderer/src/store/github/task-records/github-task-records.test.ts
@@ -5,7 +5,7 @@ import type { Repo } from '../../../../../shared/repo-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { GitHubProjectTable } from '../../../../../shared/github/project-types'
import { createTestStore, mockApi, resetRemoteRuntimeMocks } from '../github-slice-test-harness'
-import { getTaskPageRepoSourceContext } from '@/lib/task-repo-source-context'
+import { getTaskPageRepoSourceContext } from '@/lib/work-items/task-repo-source-context'
import { projectViewCacheKey } from '../cache/cache-identity'
import { getRegistryMergedTaskPageGitHubWorkItem } from '@/components/task-page/github/task-page-github-work-item-mutation-composition'
import {
@@ -88,8 +88,7 @@ const unsupported = () =>
ok: false,
error: { code: 'method_not_found', message: 'unsupported' }
})
-const storedLabels = (store: ReturnType) =>
- Object.values(store.getState().workItemsCache).map((entry) => entry.data?.[0]?.labels)
+
/** An account switch and back: the old binding is disposed and a new incarnation replaces it. */
function rebind(store: ReturnType) {
store.setState({ repos: [{ ...repo, ghAccount: { host: 'github.com', user: 'bob' } }] })
@@ -145,39 +144,11 @@ function projectRow(id = 'r'): GitHubProjectTable['rows'][number] {
}
/** F1 input: the board was fetched after the cached Tasks row and is fresher. */
-function freshBoardRow(): GitHubProjectTable['rows'][number] {
- const source = projectRow()
- return {
- ...source,
- content: {
- ...source.content,
- title: 'Renamed on GitHub',
- state: 'CLOSED',
- labels: [{ name: 'triaged', color: 'abcdef' }]
- }
- }
-}
-function boardFacts(table: GitHubProjectTable) {
- const { title, state, labels } = table.rows[0].content
- return { title, state, labels: labels.map((label) => label.name) }
-}
+
function taskFacts(item: GitHubWorkItem) {
return { title: item.title, state: item.state, labels: item.labels }
}
/** A board in the Project view cache, read back the way the board renders it. */
-function cachedBoard(store: ReturnType) {
- const cacheKey = projectViewCacheKey('organization', 'acme', 1, 'v')
- store.setState({
- projectViewCache: { [cacheKey]: { data: board([freshBoardRow()]), fetchedAt: 1 } }
- })
- const shown = () =>
- boardFacts(
- store
- .getState()
- .githubTaskCache.projectTable(store.getState().projectViewCache[cacheKey].data!, 'local')
- )
- return { cacheKey, shown }
-}
describe('shared GitHub task records through production store actions', () => {
beforeEach(() => {
@@ -190,32 +161,6 @@ describe('shared GitHub task records through production store actions', () => {
lookup.mockResolvedValue(row)
})
- it.each([true, false])(
- 'folds confirmed assignee A once while label B settles (%s), then verifies',
- async (success) => {
- const { cache, binding } = setup()
- const canonical = deferred()
- lookup.mockReturnValue(canonical.promise)
- const a = cache.operation(row, binding, { assignees: { alice: user } })
- const b = cache.operation(row, binding, { labels: { bug: true } })
- a(true)
- a(true)
- expect(lookup).not.toHaveBeenCalled()
- expect(cache.projectItem(row).assignees).toEqual([user])
- b(success)
-
- expect(cache.projectItem(row).labels).toEqual(success ? ['bug'] : [])
- canonical.resolve({
- ...row,
- assignees: [user],
- labels: success ? ['bug'] : [],
- updatedAt: '2026-10-31T12:00:03Z'
- })
- await flush()
- expect(cache.projectItem(row).assignees).toEqual([user])
- }
- )
-
it('rejects pre-edit canonical C and coalesces one replacement after B settles', async () => {
const { cache, binding } = setup()
const c = deferred()
@@ -351,53 +296,7 @@ describe('shared GitHub task records through production store actions', () => {
).items
).toEqual([])
})
- it.each([false, true])(
- 'shows a Project edit only as its own change on every copy until a reading is accepted (ok %s)',
- async (ok) => {
- const { store, cache } = setup()
- const { copy, search } = await tasksRow(store)
- const { cacheKey, shown } = cachedBoard(store)
- const tasks = () => taskFacts(cache.projectItem(copy()))
- const update = deferred<{ ok: boolean }>()
- mockApi.gh.updateIssueBySlug.mockReturnValue(update.promise)
- const verification = deferred()
- lookup.mockReturnValueOnce(verification.promise)
- const edit = store.getState().patchProjectIssueOrPr(cacheKey, 'r', { addLabels: ['bug'] })
- const board = { title: 'Renamed on GitHub', state: 'CLOSED', labels: ['triaged', 'bug'] }
- const taskRow = { title: 'Original', state: 'open', labels: ['bug'] }
- expect(shown()).toEqual(board)
- expect(tasks()).toEqual(taskRow)
- update.resolve({ ok })
- await edit
- await flush()
- if (!ok) {
- expect(shown()).toEqual({ ...board, labels: ['triaged'] })
- expect(tasks()).toEqual({ ...taskRow, labels: [] })
- expect(copy().labels).toEqual([])
- expect(lookup).not.toHaveBeenCalled()
- return
- }
- // Delayed, then failed verification: each copy keeps its own facts plus only the edit.
- expect([shown(), tasks()]).toEqual([board, taskRow])
- verification.reject(new Error('offline'))
- await flush()
- expect([shown(), tasks()]).toEqual([board, taskRow])
- // A stale search can't erase the confirmed change; it wakes the owed read, whose answer then wins.
- const truth = {
- ...row,
- title: 'Renamed on GitHub',
- state: 'closed' as const,
- labels: ['triaged', 'bug']
- }
- lookup.mockResolvedValueOnce({ ...truth, updatedAt: '2026-10-31T12:00:05Z' })
- expect((await search()).labels).toEqual(['bug'])
- await flush()
-
- expect(tasks()).toEqual(taskFacts(truth))
- expect(shown()).toEqual(board)
- }
- )
it('establishes from the read after the last of two overlapping edits', async () => {
const { store, cache } = setup()
const { capture } = await tasksRow(store)
@@ -423,53 +322,7 @@ describe('shared GitHub task records through production store actions', () => {
cache.acceptSearch([after], capture())
await flush()
})
- it.each([
- ['close', true, false],
- ['close', false, false],
- ['label', true, false],
- ['label', false, false],
- ['close', false, true],
- ['label', false, true]
- ] as const)(
- 'settles a disposed owner through its reducer without restoring its collection (%s first, label ok %s, accepted base %s)',
- async (first, labelOk, accepted) => {
- const { store, cache } = setup()
- const { copy, capture } = await tasksRow(store)
- if (accepted) {
- await cache.readCanonical(row, capture(), async () => row)
- }
- const close = cache.operation(row, capture(), { state: 'closed' })
- const label = cache.operation(row, capture(), { labels: { bug: true } })
- expect(cache.projectItem(copy())).toMatchObject({ state: 'closed', labels: ['bug'] })
- rebind(store)
- const settles =
- first === 'close'
- ? [() => close(true), () => label(labelOk)]
- : [() => label(labelOk), () => close(true)]
- expect(settles[0]().state).toBe('closed')
- expect(settles[1]()).toMatchObject({ state: 'closed', labels: labelOk ? ['bug'] : [] })
- expect(copy()).toBeUndefined()
- expect(close(true)).toMatchObject({ state: 'closed', labels: labelOk ? ['bug'] : [] })
- await flush()
- expect(lookup).not.toHaveBeenCalled()
- }
- )
- it.each([false, true])(
- 'settles disjoint edits after disposal without restoring collection membership (accepted base %s)',
- async (accepted) => {
- const { store, cache } = setup()
- const { copy, capture } = await tasksRow(store)
- if (accepted) {
- await cache.readCanonical(row, capture(), async () => row)
- }
- const a = cache.operation(row, capture(), { labels: { a: true } })
- const b = cache.operation(row, capture(), { labels: { b: true } })
- rebind(store)
- expect(a(false).labels).toEqual(['b'])
- expect(b(true).labels).toEqual(['b'])
- expect(copy()).toBeUndefined()
- }
- )
+
it('leaves copies to a replacement incarnation and reconciles them with its own read', async () => {
const { store, cache } = setup()
const { copy, capture } = await tasksRow(store)
@@ -511,47 +364,7 @@ describe('shared GitHub task records through production store actions', () => {
expect(cache.canTrack(binding, row)).toBe(false)
await flush()
})
- it.each([false, true])(
- "keeps a newer reading when an old accepted owner's add settles after disposal (ok %s)",
- async (ok) => {
- const { store, cache } = setup()
- const { copy, capture } = await tasksRow(store)
- const logins = (item: GitHubWorkItem) => item.assignees?.map((u) => u.login)
- await cache.readCanonical(row, capture(), async () => row)
- const settle = cache.operation(row, capture(), { assignees: { alice: user } })
- expect(logins(cache.projectItem(copy()))).toEqual(['alice'])
- expect(logins(copy())).toEqual([])
- rebind(store)
- mockApi.gh.listWorkItems.mockResolvedValue({
- items: [{ ...row, assignees: [user], updatedAt: '2026-10-31T12:10:00Z' }],
- sources
- })
- await store.getState().fetchWorkItems(repo.id, repo.path, 20, '', {
- sourceContext: getTaskPageRepoSourceContext(repo, 'github'),
- force: true
- })
- expect(logins(settle(ok))).toEqual(ok ? ['alice'] : [])
- expect(logins(copy())).toEqual(['alice'])
- expect(lookup).not.toHaveBeenCalled()
- }
- )
- it.each([false, true])(
- "never stores an accepted owner's pending change from a search during the edit (ok %s)",
- async (ok) => {
- const { store, cache } = setup()
- const { copy, capture, search } = await tasksRow(store)
- await cache.readCanonical(row, capture(), async () => row)
- const settle = cache.operation(row, capture(), { labels: { bug: true } })
- expect((await search()).labels).toEqual([])
- expect(copy().labels).toEqual([])
- expect(cache.projectItem(copy()).labels).toEqual(['bug'])
- lookup.mockResolvedValue({ ...row, labels: ['bug'], updatedAt: '2026-10-31T12:00:03Z' })
- settle(ok)
- expect(copy().labels).toEqual(ok ? ['bug'] : [])
- expect(cache.projectItem(copy()).labels).toEqual(ok ? ['bug'] : [])
- await flush()
- }
- )
+
it('lets a Refresh queued behind a discarded one read once that owner retires', async () => {
const { cache, binding } = setup()
const first = deferred()
@@ -563,52 +376,7 @@ describe('shared GitHub task records through production store actions', () => {
expect(cache.projectItem(row).title).toBe('Fresh')
})
- it.each(['binding', 'support'] as const)(
- 'ends a queued Refresh without reading or leaving an owner when %s is lost during its wait',
- async (lost) => {
- const { store, cache, binding } = setup()
- const first = deferred()
- const r1 = cache.readCanonical(row, binding, () => first.promise)
- const second = vi.fn(async () => ({ ...row, title: 'Fresh' }))
- const r2 = cache.readCanonical(row, binding, second)
- if (lost === 'binding') {
- rebind(store)
- first.resolve(null)
- } else {
- first.reject(unsupported())
- }
- expect([await r1, await r2]).toEqual([false, false])
- expect(second).not.toHaveBeenCalled()
- const table = board([freshBoardRow()])
- cache.observeProject(table, { kind: 'local' })
- expect(cache.projectTable(table, 'local')).toBe(table)
- expect(lookup).not.toHaveBeenCalled()
- }
- )
- it.each([false, true])(
- 'keeps Project edits board-only on a server known to lack the item route (ok %s)',
- async (ok) => {
- const { store, cache } = setup()
- const sourceContext = getTaskPageRepoSourceContext(repo, 'github')
- const { capture } = await tasksRow(store)
- mockApi.gh.listWorkItems.mockResolvedValueOnce({
- items: [{ ...row, labels: ['bug'], updatedAt: '2026-10-31T12:10:00Z' }],
- sources
- })
- await store.getState().fetchWorkItems(repo.id, repo.path, 20, 'is:open', { sourceContext })
- await cache.readCanonical(row, capture(), () => Promise.reject(unsupported()))
- const { cacheKey } = cachedBoard(store)
- const before = storedLabels(store)
- expect(before).toEqual([[], ['bug']])
- mockApi.gh.updateIssueBySlug.mockResolvedValue(
- ok ? { ok: true } : { ok: false, error: 'nope' }
- )
- await store.getState().patchProjectIssueOrPr(cacheKey, 'r', { addLabels: ['bug'] })
- await flush()
- expect(storedLabels(store)).toEqual(before)
- expect(lookup).not.toHaveBeenCalled()
- }
- )
+
it('keeps the PR body result through a compound metadata update', async () => {
const { store } = setup()
const cacheKey = projectViewCacheKey('organization', 'acme', 1, 'v')
diff --git a/src/renderer/src/store/github/task-records/task-record-cache.ts b/src/renderer/src/store/github/task-records/task-record-cache.ts
index 25d914567de..53cbc724ccf 100644
--- a/src/renderer/src/store/github/task-records/task-record-cache.ts
+++ b/src/renderer/src/store/github/task-records/task-record-cache.ts
@@ -3,8 +3,8 @@ import type { GitHubAssignableUser } from '../../../../../shared/github/pull-req
import type { Repo } from '../../../../../shared/repo-types'
import type { AppState } from '../../types'
import type { StoreApi } from 'zustand'
-import { githubTaskIdentity } from '@/lib/github-task-target'
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
+import { githubTaskIdentity } from '@/lib/work-items/github/github-task-target'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { lookupReposBySlugFromCache } from '@/lib/repo-slug-cache'
import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
import { structuralValuesEqual } from '../../../../../shared/structural-value-equality'
diff --git a/src/renderer/src/store/github/task-records/task-record-model.ts b/src/renderer/src/store/github/task-records/task-record-model.ts
index 4b5b6585073..ed3fc2bccb3 100644
--- a/src/renderer/src/store/github/task-records/task-record-model.ts
+++ b/src/renderer/src/store/github/task-records/task-record-model.ts
@@ -1,7 +1,7 @@
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { Repo } from '../../../../../shared/repo-types'
import type { GitHubProjectRow } from '../../../../../shared/github/project-types'
-import type { GitHubTaskObservation } from '@/lib/github-task-observation'
+import type { GitHubTaskObservation } from '@/lib/work-items/github/github-task-observation'
import { parseGitHubIssueOrPRLink } from '../../../../../shared/github/links'
import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key'
diff --git a/src/renderer/src/store/github/task-records/task-record-owners.ts b/src/renderer/src/store/github/task-records/task-record-owners.ts
index e2fd6505d69..7f40f61a19a 100644
--- a/src/renderer/src/store/github/task-records/task-record-owners.ts
+++ b/src/renderer/src/store/github/task-records/task-record-owners.ts
@@ -9,9 +9,9 @@ import {
captureGitHubTaskObservation,
githubTaskBinding,
type GitHubTaskObservation
-} from '@/lib/github-task-observation'
-import { githubTaskIdentity } from '@/lib/github-task-target'
-import { getWorkItemRepo } from '@/lib/work-item-repo-row'
+} from '@/lib/work-items/github/github-task-observation'
+import { githubTaskIdentity } from '@/lib/work-items/github/github-task-target'
+import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { parseGitHubIssueOrPRLink } from '../../../../../shared/github/links'
import { getRepoExecutionHostId } from '../../../../../shared/execution-host'
import { nextProviderRequestId } from '../requests/request-coordination'
diff --git a/src/renderer/src/store/github/task-records/task-record-reads.ts b/src/renderer/src/store/github/task-records/task-record-reads.ts
index 97dfbdc61b3..1f8b338e75b 100644
--- a/src/renderer/src/store/github/task-records/task-record-reads.ts
+++ b/src/renderer/src/store/github/task-records/task-record-reads.ts
@@ -1,5 +1,5 @@
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
-import { githubTaskIdentity } from '@/lib/github-task-target'
+import { githubTaskIdentity } from '@/lib/work-items/github/github-task-target'
import { lookupGitHubWorkItemByOwnerRepoForSource } from '@/lib/work-items/github/github-work-item-source-lookup'
import { RuntimeRpcCallError } from '@/runtime/rpc/calls/runtime-rpc-result'
import { parseGitHubIssueOrPRLink } from '../../../../../shared/github/links'
diff --git a/src/renderer/src/store/github/work-items/github-work-items-runtime-routing.test.ts b/src/renderer/src/store/github/work-items/github-work-items-runtime-routing.test.ts
index 8ac214bac67..c8bbef7aacc 100644
--- a/src/renderer/src/store/github/work-items/github-work-items-runtime-routing.test.ts
+++ b/src/renderer/src/store/github/work-items/github-work-items-runtime-routing.test.ts
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import { findRepoForGitHubOwner } from '../repositories/repository-routing'
import { workItemsCacheKey } from '../cache/cache-identity'
import {
diff --git a/src/renderer/src/store/github/work-items/work-item-aggregate-actions.ts b/src/renderer/src/store/github/work-items/work-item-aggregate-actions.ts
index 7c59a3d8513..44375e43bdd 100644
--- a/src/renderer/src/store/github/work-items/work-item-aggregate-actions.ts
+++ b/src/renderer/src/store/github/work-items/work-item-aggregate-actions.ts
@@ -1,4 +1,4 @@
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import { getWorkItemPageErrorTypes } from '../../../../../shared/github/work-item-page-errors'
import type { StateCreator } from 'zustand'
import type { AppState } from '../../types'
diff --git a/src/renderer/src/store/github/work-items/work-item-count-actions.ts b/src/renderer/src/store/github/work-items/work-item-count-actions.ts
index f4a2719d5a4..ece6d2edcac 100644
--- a/src/renderer/src/store/github/work-items/work-item-count-actions.ts
+++ b/src/renderer/src/store/github/work-items/work-item-count-actions.ts
@@ -1,4 +1,4 @@
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import type { StateCreator } from 'zustand'
import type { AppState } from '../../types'
import type { GitHubSlice } from '../github-slice-contract'
diff --git a/src/renderer/src/store/github/work-items/work-item-fetch-actions.ts b/src/renderer/src/store/github/work-items/work-item-fetch-actions.ts
index d155054e1b5..eebf1aebe1b 100644
--- a/src/renderer/src/store/github/work-items/work-item-fetch-actions.ts
+++ b/src/renderer/src/store/github/work-items/work-item-fetch-actions.ts
@@ -1,4 +1,4 @@
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import type { StateCreator } from 'zustand'
import type { AppState } from '../../types'
import type { GitHubSlice } from '../github-slice-contract'
diff --git a/src/renderer/src/store/github/work-items/work-item-routing.ts b/src/renderer/src/store/github/work-items/work-item-routing.ts
index a80f088b87f..34d0a058b25 100644
--- a/src/renderer/src/store/github/work-items/work-item-routing.ts
+++ b/src/renderer/src/store/github/work-items/work-item-routing.ts
@@ -1,5 +1,5 @@
import { getGitHubRepoLookupIndex } from '../repositories/github-repo-lookup-index'
-import { githubTaskBinding } from '@/lib/github-task-observation'
+import { githubTaskBinding } from '@/lib/work-items/github/github-task-observation'
import type { AppState } from '../../types'
import type { RuntimeFocusSettings } from '../../../../../shared/github/github-cache-key'
import type { Repo } from '../../../../../shared/repo-types'
diff --git a/src/renderer/src/store/slices/diff-comments/create-diff-comments-slice.ts b/src/renderer/src/store/slices/diff-comments/create-diff-comments-slice.ts
index 8f6c2ea4318..d681ebda505 100644
--- a/src/renderer/src/store/slices/diff-comments/create-diff-comments-slice.ts
+++ b/src/renderer/src/store/slices/diff-comments/create-diff-comments-slice.ts
@@ -4,7 +4,7 @@ import type { StateCreator } from 'zustand'
import type { AppState } from '../../types'
import type { DiffComment } from '../../../../../shared/diff-comment-types'
import { createNonSecureContextUuid as createBrowserUuid } from '../../../../../shared/non-secure-context-uuid'
-import { isMarkdownComment } from '@/lib/diff-comment-compat'
+import { isMarkdownComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import {
enqueueDiffCommentPersist,
mutateDiffComments,
diff --git a/src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.ts b/src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.ts
index 6e1dcb4595a..3d8bc269bca 100644
--- a/src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.ts
+++ b/src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.ts
@@ -36,7 +36,7 @@ import { getFolderWorkspaceWorktree } from '../../../../../../shared/folder-work
let floatingWorkspaceWorktreeCache: { path: string; worktree: Worktree } | null = null
import { worktreeRowMatchesMetaHost } from './worktree-meta-host-match'
-import { branchName } from '@/lib/git-utils'
+import { branchName } from '@/lib/source-control/branches/branch-name'
import { normalizeWorkspaceAttachmentUpdate } from '../../../../../../shared/workspace-attachments/workspace-attachments'
export function applyDetectedWorktreeUpdates(
diff --git a/src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.ts b/src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.ts
index f30ee71f945..7234c6f0a60 100644
--- a/src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.ts
+++ b/src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.ts
@@ -29,7 +29,7 @@ import { buildWorktreePurgeState } from '../teardown/worktree-purge-state'
import { flushPurgedWorkspaceEdits } from '../teardown/removed-workspace-unsaved-files'
import { hostWorktreeTarget } from '../../../../../../shared/worktree/host-qualified-identity'
import { isDisplayNamePersistencePending } from '../metadata/worktree-meta-persist'
-import { branchName } from '@/lib/git-utils'
+import { branchName } from '@/lib/source-control/branches/branch-name'
import {
forgetAuthoritativelyRemovedWorktrees,
forgetPersistedWorktreeMetaForRemovals,
diff --git a/src/renderer/src/store/slices/worktrees/metadata/worktree-git-identity-update.ts b/src/renderer/src/store/slices/worktrees/metadata/worktree-git-identity-update.ts
index 59e9dc0592e..248fafceddb 100644
--- a/src/renderer/src/store/slices/worktrees/metadata/worktree-git-identity-update.ts
+++ b/src/renderer/src/store/slices/worktrees/metadata/worktree-git-identity-update.ts
@@ -4,7 +4,7 @@ import type { Worktree } from '../../../../../../shared/worktree/types'
import { normalizeWorkspaceAttachmentUpdate } from '../../../../../../shared/workspace-attachments/workspace-attachments'
import type { WorktreeSlice } from '../worktree-slice-contract'
import { getRepoIdFromWorktreeId } from '../../../../../../shared/worktree/id'
-import { branchName } from '@/lib/git-utils'
+import { branchName } from '@/lib/source-control/branches/branch-name'
import { detachedHeadAutoDerivedDisplayNames } from './detached-head-display-name'
import {
applyHostedReviewLinkClear,
diff --git a/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-update-application.ts b/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-update-application.ts
index c3e2961e5a8..28e4fead34d 100644
--- a/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-update-application.ts
+++ b/src/renderer/src/store/slices/worktrees/metadata/worktree-meta-update-application.ts
@@ -3,7 +3,7 @@ import { getRepoIdFromWorktreeId } from '../../../../../../shared/worktree/id'
import type { Worktree } from '../../../../../../shared/worktree/types'
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
import { worktreeRowMatchesMetaHost } from '../listing/worktree-meta-host-match'
-import { branchName } from '@/lib/git-utils'
+import { branchName } from '@/lib/source-control/branches/branch-name'
import { normalizeWorkspaceAttachmentUpdate } from '../../../../../../shared/workspace-attachments/workspace-attachments'
type RequiredKey = { [K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T]
diff --git a/src/renderer/src/store/slices/worktrees/session/worktree-terminal-reference.ts b/src/renderer/src/store/slices/worktrees/session/worktree-terminal-reference.ts
index 1a3c95d8b9d..f40dff18a44 100644
--- a/src/renderer/src/store/slices/worktrees/session/worktree-terminal-reference.ts
+++ b/src/renderer/src/store/slices/worktrees/session/worktree-terminal-reference.ts
@@ -7,7 +7,7 @@ import { getProviderRuntimeContextKey } from '@/runtime/hosts/observations/provi
import { getRuntimeEnvironmentRevision } from '@/runtime/rpc/environment-revisions/runtime-environment-revision'
import type { WorktreeSlice } from '../worktree-slice-contract'
import type { WorktreeSliceGet } from '../listing/worktree-slice-types'
-import { branchName } from '@/lib/git-utils'
+import { branchName } from '@/lib/source-control/branches/branch-name'
import {
getWorkspaceAttachmentObservedOrigin,
resolveWorkspaceReferenceObservationOwner
@@ -22,7 +22,7 @@ import { isGitHubPRSuppressed } from '../../../../../../shared/worktree/github-p
import type { WorkspaceAttachment, Worktree } from '../../../../../../shared/worktree/types'
import { findKnownWorktreeById } from '../listing/detected-worktree-meta'
import { findRepoForHost } from '../../../repos/repo-host-identity'
-import { readHostedReviewForRepo } from '@/lib/hosted-review-repo-read'
+import { readHostedReviewForRepo } from '@/lib/source-control/review/hosted-review-repo-read'
import { lookupGitHubWorkItemByOwnerRepoForSource } from '@/lib/work-items/github/github-work-item-source-lookup'
import { buildTaskSourceContextFromRepo } from '../../../../../../shared/work-items/task-source-context'
import { PrioritySemaphore } from '../../../../../../shared/priority-semaphore'
diff --git a/src/renderer/src/lib/github-links.test.ts b/src/shared/new-workspace/github-links.test.ts
similarity index 100%
rename from src/renderer/src/lib/github-links.test.ts
rename to src/shared/new-workspace/github-links.test.ts
diff --git a/src/renderer/src/lib/gitlab-links.test.ts b/src/shared/new-workspace/gitlab-links.test.ts
similarity index 100%
rename from src/renderer/src/lib/gitlab-links.test.ts
rename to src/shared/new-workspace/gitlab-links.test.ts