diff --git a/.github/workflows/pi-provider-runtime.yml b/.github/workflows/pi-provider-runtime.yml index ac652d64e63..6cf69ad911a 100644 --- a/.github/workflows/pi-provider-runtime.yml +++ b/.github/workflows/pi-provider-runtime.yml @@ -3,7 +3,7 @@ on: pull_request: types: [opened, synchronize, reopened, ready_for_review, converted_to_draft] paths: - - 'src/shared/commit-message-agent-specs-primary.ts' + - 'src/shared/source-control/ai/generation/commit-message-agent-specs-primary.ts' - 'tests/tools/pi-provider-runtime-smoke.mjs' - 'src/main/pi/rpc-history-*.ts' - '.github/workflows/pi-provider-runtime.yml' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 29d43151998..be7bb127cb4 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -629,7 +629,7 @@ jobs: export GIT_EXEC_PATH="$HOME/.cache/orca-git-compat/git-$ORCA_GIT_COMPAT_VERSION" fi pnpm exec vitest run --config config/vitest.config.ts \ - src/shared/git-binary-compatibility.test.ts \ + src/shared/git/compatibility/git-binary-compatibility.test.ts \ src/main/git/worktrees/creation/worktree-safety-real-git.test.ts \ src/main/git/worktrees/removal/worktree-rebase-update-refs-real-git.test.ts diff --git a/config/flaky-test-pattern-baseline.txt b/config/flaky-test-pattern-baseline.txt index 8f275ef9f5d..a2541ac5347 100644 --- a/config/flaky-test-pattern-baseline.txt +++ b/config/flaky-test-pattern-baseline.txt @@ -504,7 +504,7 @@ 1 test-no-real-time-wait:src/shared/darwin-terminal-names-real-ps.test.ts 1 test-no-real-time-wait:src/shared/darwin-terminal-names.test.ts 5 test-no-real-time-wait:src/shared/fish-query-reply-child-stdin.node-pty.test.ts -1 test-no-real-time-wait:src/shared/git-branch-line-total-soft-deadline.test.ts +1 test-no-real-time-wait:src/shared/git/status/git-branch-line-total-soft-deadline.test.ts 1 test-no-real-time-wait:src/shared/osc52-clipboard.test.ts 4 test-no-real-time-wait:src/shared/pty-reply-echo-shapes.node-pty.test.ts 2 test-no-real-time-wait:src/shared/remote-runtime/control/remote-runtime-shared-control-auth-refusal.test.ts @@ -1085,7 +1085,7 @@ 1 test-no-wall-clock:src/shared/automation-schedules.test.ts 2 test-no-wall-clock:src/shared/crash-reporting.test.ts 2 test-no-wall-clock:src/shared/fish-query-reply-child-stdin.node-pty.test.ts -1 test-no-wall-clock:src/shared/git-binary-compatibility.test.ts +1 test-no-wall-clock:src/shared/git/compatibility/git-binary-compatibility.test.ts 1 test-no-wall-clock:src/shared/mobile-push-contract.test.ts 2 test-no-wall-clock:src/shared/pty-reply-echo-shapes.node-pty.test.ts 4 test-no-wall-clock:src/shared/sidebar-list/smart-sort.test.ts @@ -1269,7 +1269,7 @@ 1 test-timeout-needs-reason:src/renderer/src/hooks/agent-hook-completion-notifications.test.ts 1 test-timeout-needs-reason:src/renderer/src/lib/check-run-details-log-normalization-performance.test.ts 1 test-timeout-needs-reason:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts -1 test-timeout-needs-reason:src/shared/check-job-log-text-performance.test.ts +1 test-timeout-needs-reason:src/shared/source-control/checks/logs/check-job-log-text-performance.test.ts 1 test-timeout-needs-reason:src/shared/dsh-real-cli.test.ts 1 test-timeout-needs-reason:src/shared/setup-agent-sequencing.windows.test.ts 1 test-timeout-needs-reason:src/shared/workspace-space-entry-traversal.test.ts diff --git a/config/scripts/branch-compare-head-benchmark.mjs b/config/scripts/branch-compare-head-benchmark.mjs index 15091b519cf..8c5b2f3974d 100644 --- a/config/scripts/branch-compare-head-benchmark.mjs +++ b/config/scripts/branch-compare-head-benchmark.mjs @@ -5,7 +5,7 @@ import { execFile } from 'node:child_process' import { performance } from 'node:perf_hooks' import { fileURLToPath } from 'node:url' -import { readBranchCompareHead } from '../../src/shared/git-branch-compare-head.ts' +import { readBranchCompareHead } from '../../src/shared/git/branches/git-branch-compare-head.ts' const REPO_ROOT = fileURLToPath(new URL('../..', import.meta.url)) const ITERATIONS = Number(process.env.ORCA_BRANCH_COMPARE_BENCH_ITERATIONS ?? '8') diff --git a/config/scripts/check-job-log-byte-cap-benchmark.mjs b/config/scripts/check-job-log-byte-cap-benchmark.mjs index 3055d3bbd69..1179de97dcd 100644 --- a/config/scripts/check-job-log-byte-cap-benchmark.mjs +++ b/config/scripts/check-job-log-byte-cap-benchmark.mjs @@ -23,6 +23,10 @@ import { } from './check-job-log-performance-cases.mjs' const shared = Object.keys(BASELINE_SOURCE_HASHES) +const currentSourcePaths = { + 'check-job-log-tail-slice.ts': 'source-control/checks/logs/check-job-log-tail-slice.ts', + 'check-job-log-excerpt.ts': 'source-control/checks/logs/check-job-log-excerpt.ts' +} export const hash = (value) => createHash('sha256').update(value).digest('hex') export const nodeExecutable = () => { const executable = process.versions.bun @@ -56,7 +60,7 @@ export async function prepareBenchmark( const baseline = new Map() const current = new Map() for (const name of [...shared, 'check-job-log-excerpt.ts']) { - const filename = path.join(root, 'src', 'shared', name) + const filename = path.join(root, 'src', 'shared', currentSourcePaths[name] ?? name) current.set(name, await readFile(filename, 'utf8')) if (!compareBaseline || !shared.includes(name)) { continue @@ -125,6 +129,16 @@ export async function prepareBenchmark( { name: 'source-pinned-log-text', setup(builder) { + builder.onResolve({ filter: /^\./ }, ({ path: request }) => { + const basename = path.basename(request) + const name = basename.endsWith('.ts') ? basename : `${basename}.ts` + return sources.has(name) + ? { + path: path.join(root, 'src', 'shared', name), + namespace: 'source-pinned-log-text' + } + : undefined + }) builder.onResolve({ filter: /^check-log-observations$/ }, () => ({ path: 'check-log-observations', namespace: 'observations' @@ -136,7 +150,8 @@ export async function prepareBenchmark( builder.onLoad( { filter: - /[\\/](?:ansi-escape-sequences|check-job-log-tail-slice|check-job-log-excerpt|utf8-byte-limits|own-retained-string|owned-utf16-suffix)\.ts$/ + /[\\/](?:ansi-escape-sequences|check-job-log-tail-slice|check-job-log-excerpt|utf8-byte-limits|own-retained-string|owned-utf16-suffix)\.ts$/, + namespace: 'source-pinned-log-text' }, ({ path: filename }) => { const name = path.basename(filename) diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index d84e0fdda27..76fd8da883f 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -2547,7 +2547,7 @@ "src/main/git/gh-rate-limit-breaker.test.ts": 50, "src/main/git/command-runner/git-capability-state.test.ts": 60, "src/main/git/git-network-safety-real-git.test.ts": 378, - "src/shared/git-status-read-lease-owner.test.ts": 49, + "src/shared/git/status/git-status-read-lease-owner.test.ts": 49, "src/main/git/source-control/git-upstream-status-read-owner.test.ts": 45, "src/main/git/command-runner/git-worktree-mutation-state.test.ts": 74, "src/main/git/remotes/hosted-remote-url.test.ts": 43, @@ -2626,7 +2626,7 @@ "src/main/git/source-control/status-line-stats-host-paths.test.ts": 77, "src/main/git/source-control/status-line-stats-renames-real-git.test.ts": 631, "src/main/git/source-control/status-pathspec-literals.test.ts": 442, - "src/shared/git-status-porcelain-parser.test.ts": 52, + "src/shared/git/status/git-status-porcelain-parser.test.ts": 52, "src/main/git/source-control/status-read-coalescing.test.ts": 258, "src/main/git/source-control/status-read-failure-real-git.test.ts": 307, "src/main/git/source-control/status-shared-symlinks.test.ts": 746, @@ -11525,8 +11525,8 @@ "src/shared/base-ref-search-result.test.ts": 28, "src/shared/binary-file-extensions.test.ts": 43, "src/shared/bounded-map.test.ts": 69, - "src/shared/branch-name-from-work.test.ts": 58, - "src/shared/branch-prefix.test.ts": 55, + "src/shared/source-control/ai/naming/branch-name-from-work.test.ts": 58, + "src/shared/git/branches/branch-prefix.test.ts": 55, "src/shared/browser-annotation-viewport-lifecycle.test.ts": 205, "src/shared/browser-annotation-viewport-live-target.test.ts": 259, "src/shared/browser-client-automation-protocol.test.ts": 92, @@ -11551,13 +11551,13 @@ "src/shared/bundled-web-client-manifest.test.ts": 66, "src/shared/calm-status-reveal.test.ts": 49, "src/shared/cheap-process-table-snapshot.test.ts": 84, - "src/shared/check-job-log-byte-cap.test.ts": 82, - "src/shared/check-job-log-excerpt.test.ts": 114, - "src/shared/check-job-log-marker-candidates.test.ts": 130, - "src/shared/check-job-log-performance-harness.test.ts": 456, - "src/shared/check-job-log-retention.test.ts": 451, - "src/shared/check-job-log-tail-slice.test.ts": 61, - "src/shared/check-job-log-text-performance.test.ts": 132, + "src/shared/source-control/checks/logs/check-job-log-byte-cap.test.ts": 82, + "src/shared/source-control/checks/logs/check-job-log-excerpt.test.ts": 114, + "src/shared/source-control/checks/logs/check-job-log-marker-candidates.test.ts": 130, + "src/shared/source-control/checks/logs/check-job-log-performance-harness.test.ts": 456, + "src/shared/source-control/checks/logs/check-job-log-retention.test.ts": 451, + "src/shared/source-control/checks/logs/check-job-log-tail-slice.test.ts": 61, + "src/shared/source-control/checks/logs/check-job-log-text-performance.test.ts": 132, "src/shared/claimed-agent-pty-owner.test.ts": 72, "src/shared/claude-agent-teams-tmux-compat.test.ts": 46, "src/shared/claude-agent-view-launch.test.ts": 55, @@ -11606,17 +11606,17 @@ "src/shared/command-code-turn-boundary.test.ts": 41, "src/shared/command-environment.test.ts": 120, "src/shared/command-token-scanner.test.ts": 43, - "src/shared/commit-message-agent-spec.test.ts": 138, - "src/shared/commit-message-generation.test.ts": 45, - "src/shared/commit-message-plan-kimi.test.ts": 116, - "src/shared/commit-message-plan.test.ts": 162, - "src/shared/commit-message-prompt.test.ts": 91, + "src/shared/source-control/ai/generation/commit-message-agent-spec.test.ts": 138, + "src/shared/source-control/ai/generation/commit-message-generation.test.ts": 45, + "src/shared/source-control/ai/generation/commit-message-plan-kimi.test.ts": 116, + "src/shared/source-control/ai/generation/commit-message-plan.test.ts": 162, + "src/shared/source-control/ai/generation/commit-message-prompt.test.ts": 91, "src/shared/computer-awake-mode.test.ts": 53, "src/shared/computer-use-error-recovery.test.ts": 52, "src/shared/computer-use-key-spec.test.ts": 44, "src/shared/constants.test.ts": 244, "src/shared/contextual-tours.test.ts": 37, - "src/shared/conversation-name-generation.test.ts": 206, + "src/shared/source-control/ai/generation/conversation-name-generation.test.ts": 206, "src/shared/crash-reporting.test.ts": 78, "src/shared/credit-count-format.test.ts": 50, "src/shared/cross-platform-path-guards.test.ts": 48, @@ -11687,60 +11687,60 @@ "src/shared/foreground-process-selection.test.ts": 100, "src/shared/foreground-wrapper-agent.test.ts": 82, "src/shared/generated-code-path.test.ts": 46, - "src/shared/git-admission-node-compatibility.test.ts": 74, - "src/shared/git-binary-compatibility.test.ts": 377, - "src/shared/git-blob-absence.test.ts": 54, - "src/shared/git-branch-cleanup-real-git.test.ts": 883, - "src/shared/git-branch-cleanup.test.ts": 79, - "src/shared/git-branch-compare-head.test.ts": 41, - "src/shared/git-branch-line-total-soft-deadline.test.ts": 74, - "src/shared/git-branch-line-total.test.ts": 135, - "src/shared/git-capability-cache.test.ts": 48, - "src/shared/git-change-list.test.ts": 133, - "src/shared/git-check-ignore-stdio.test.ts": 43, - "src/shared/git-clone-failure-message.test.ts": 63, - "src/shared/git-config-snapshot-runner.test.ts": 59, - "src/shared/git-configured-branch-target.test.ts": 58, - "src/shared/git-cquoted-path.test.ts": 42, - "src/shared/git-diff-transport-budget.test.ts": 479, - "src/shared/git-discard-path-safety.test.ts": 58, - "src/shared/git-fetch-head-capability.test.ts": 41, - "src/shared/git-fetch-head-lock-key-derivation.test.ts": 128, - "src/shared/git-fetch-head-lock.test.ts": 72, - "src/shared/git-fork-sync.test.ts": 78, - "src/shared/git-history-graph.test.ts": 111, - "src/shared/git-history-message-allocation.test.ts": 63, - "src/shared/git-history-real-repository.test.ts": 758, - "src/shared/git-history-ref-display.test.ts": 65, - "src/shared/git-history.test.ts": 92, - "src/shared/git-lock-contention.test.ts": 48, - "src/shared/git-merge-tree-capability.test.ts": 44, - "src/shared/git-metadata-path.test.ts": 63, - "src/shared/git-object-quarantine.test.ts": 89, - "src/shared/git-progress-records.test.ts": 168, - "src/shared/git-push-target-validation.test.ts": 39, - "src/shared/git-remote-error.test.ts": 88, - "src/shared/git-remote-identity.test.ts": 56, - "src/shared/git-remote-url-index.test.ts": 47, - "src/shared/git-resolution-config-snapshot.test.ts": 72, - "src/shared/git-rev-list-output.test.ts": 50, - "src/shared/git-ssh-policy-env.test.ts": 221, - "src/shared/git-status-branch-line-total-cache.test.ts": 82, - "src/shared/git-status-conflict-entries.test.ts": 56, - "src/shared/git-status-limit.test.ts": 47, - "src/shared/git-status-line-stats-cache.test.ts": 76, - "src/shared/git-status-read-lease-expiry.test.ts": 77, - "src/shared/git-status-upstream-ref.test.ts": 47, - "src/shared/git-tracked-pathspecs.test.ts": 59, - "src/shared/git-uncommitted-line-stats.test.ts": 87, - "src/shared/git-upstream-status.test.ts": 50, - "src/shared/git-worktree-admin.test.ts": 161, - "src/shared/git-worktree-operation-lock.test.ts": 46, + "src/shared/git/admission/git-admission-node-compatibility.test.ts": 74, + "src/shared/git/compatibility/git-binary-compatibility.test.ts": 377, + "src/shared/git/diff/git-blob-absence.test.ts": 54, + "src/shared/git/branches/git-branch-cleanup-real-git.test.ts": 883, + "src/shared/git/branches/git-branch-cleanup.test.ts": 79, + "src/shared/git/branches/git-branch-compare-head.test.ts": 41, + "src/shared/git/status/git-branch-line-total-soft-deadline.test.ts": 74, + "src/shared/git/status/git-branch-line-total.test.ts": 135, + "src/shared/git/commands/git-capability-cache.test.ts": 48, + "src/shared/git/diff/git-change-list.test.ts": 133, + "src/shared/git/paths/git-check-ignore-stdio.test.ts": 43, + "src/shared/git/remotes/git-clone-failure-message.test.ts": 63, + "src/shared/git/commands/git-config-snapshot-runner.test.ts": 59, + "src/shared/git/remotes/git-configured-branch-target.test.ts": 58, + "src/shared/git/paths/git-cquoted-path.test.ts": 42, + "src/shared/git/diff/git-diff-transport-budget.test.ts": 479, + "src/shared/git/paths/git-discard-path-safety.test.ts": 58, + "src/shared/git/fetch/git-fetch-head-capability.test.ts": 41, + "src/shared/git/fetch/git-fetch-head-lock-key-derivation.test.ts": 128, + "src/shared/git/fetch/git-fetch-head-lock.test.ts": 72, + "src/shared/git/remotes/git-fork-sync.test.ts": 78, + "src/shared/git/history/git-history-graph.test.ts": 111, + "src/shared/git/history/git-history-message-allocation.test.ts": 63, + "src/shared/git/history/git-history-real-repository.test.ts": 758, + "src/shared/git/history/git-history-ref-display.test.ts": 65, + "src/shared/git/history/git-history.test.ts": 92, + "src/shared/git/commands/git-lock-contention.test.ts": 48, + "src/shared/git/branches/git-merge-tree-capability.test.ts": 44, + "src/shared/git/metadata/git-metadata-path.test.ts": 63, + "src/shared/git/objects/git-object-quarantine.test.ts": 89, + "src/shared/git/commands/git-progress-records.test.ts": 168, + "src/shared/git/remotes/git-push-target-validation.test.ts": 39, + "src/shared/git/remotes/git-remote-error.test.ts": 88, + "src/shared/git/remotes/git-remote-identity.test.ts": 56, + "src/shared/git/remotes/git-remote-url-index.test.ts": 47, + "src/shared/git/compatibility/git-resolution-config-snapshot.test.ts": 72, + "src/shared/git/refs/git-rev-list-output.test.ts": 50, + "src/shared/git/commands/git-ssh-policy-env.test.ts": 221, + "src/shared/git/status/git-status-branch-line-total-cache.test.ts": 82, + "src/shared/git/status/git-status-conflict-entries.test.ts": 56, + "src/shared/git/status/git-status-limit.test.ts": 47, + "src/shared/git/status/git-status-line-stats-cache.test.ts": 76, + "src/shared/git/status/git-status-read-lease-expiry.test.ts": 77, + "src/shared/git/status/git-status-upstream-ref.test.ts": 47, + "src/shared/git/paths/git-tracked-pathspecs.test.ts": 59, + "src/shared/git/status/git-uncommitted-line-stats.test.ts": 87, + "src/shared/git/remotes/git-upstream-status.test.ts": 50, + "src/shared/git/worktrees/git-worktree-admin.test.ts": 161, + "src/shared/git/worktrees/git-worktree-operation-lock.test.ts": 46, "src/shared/github/account-binding.test.ts": 48, "src/shared/github/api-availability.test.ts": 47, "src/shared/github/owner-slug.test.ts": 45, "src/shared/github/pr-comment-diff-hunk.test.ts": 47, - "src/shared/github/pr-comments-resolution-prompt.test.ts": 49, + "src/shared/source-control/review-comments/pr-comments-resolution-prompt.test.ts": 49, "src/shared/github/pr-reviewer-display.test.ts": 56, "src/shared/github/project-board-columns.test.ts": 64, "src/shared/github/project-identity.test.ts": 33, @@ -11750,9 +11750,9 @@ "src/shared/github/pull-request-for-branch-outcome.test.ts": 43, "src/shared/github/pull-request-merge-methods.test.ts": 41, "src/shared/github/repository-identity-key.test.ts": 39, - "src/shared/gitlab-job-log-excerpt.test.ts": 95, - "src/shared/gitlab-job-trace-check-details.test.ts": 69, - "src/shared/gitlab-pipeline-checks.test.ts": 40, + "src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.test.ts": 95, + "src/shared/source-control/checks/gitlab/gitlab-job-trace-check-details.test.ts": 69, + "src/shared/source-control/checks/gitlab/gitlab-pipeline-checks.test.ts": 40, "src/shared/gitlab-projects.test.ts": 42, "src/shared/grok-model-list-probe.test.ts": 54, "src/shared/grok-session-paths.test.ts": 104, @@ -11770,12 +11770,12 @@ "src/shared/host-operation-ownership.test.ts": 779, "src/shared/host-setting-overrides.test.ts": 55, "src/shared/host-spawn-admission.test.ts": 183, - "src/shared/hosted-review-create-confirmation.test.ts": 43, - "src/shared/hosted-review-create-seed.test.ts": 83, - "src/shared/hosted-review-creation-providers.test.ts": 35, - "src/shared/hosted-review-github.test.ts": 40, - "src/shared/hosted-review-push-target.test.ts": 52, - "src/shared/hosted-review-refs.test.ts": 57, + "src/shared/source-control/hosted-review/hosted-review-create-confirmation.test.ts": 43, + "src/shared/source-control/hosted-review/hosted-review-create-seed.test.ts": 83, + "src/shared/source-control/hosted-review/hosted-review-creation-providers.test.ts": 35, + "src/shared/source-control/hosted-review/hosted-review-github.test.ts": 40, + "src/shared/source-control/hosted-review/hosted-review-push-target.test.ts": 52, + "src/shared/source-control/hosted-review/hosted-review-refs.test.ts": 57, "src/shared/html-file-url.test.ts": 49, "src/shared/image-data-uri.test.ts": 59, "src/shared/image-paste-following-text.test.ts": 41, @@ -12095,13 +12095,13 @@ "src/shared/posix-wait-status.test.ts": 40, "src/shared/powershell-native-argument.test.ts": 34, "src/shared/powershell-native-argument.windows.test.ts": 67, - "src/shared/pr-bot-author-overrides.test.ts": 76, - "src/shared/pr-check-severity-order.test.ts": 51, - "src/shared/pr-check-status.test.ts": 35, - "src/shared/pr-checks-fix-prompt.test.ts": 93, - "src/shared/pr-comment-audience.test.ts": 51, - "src/shared/pr-comment-groups.test.ts": 35, - "src/shared/pr-comment-time.test.ts": 40, + "src/shared/source-control/review-comments/pr-bot-author-overrides.test.ts": 76, + "src/shared/source-control/checks/pr-check-severity-order.test.ts": 51, + "src/shared/source-control/checks/pr-check-status.test.ts": 35, + "src/shared/source-control/checks/pr-checks-fix-prompt.test.ts": 93, + "src/shared/source-control/review-comments/pr-comment-audience.test.ts": 51, + "src/shared/source-control/review-comments/pr-comment-groups.test.ts": 35, + "src/shared/source-control/review-comments/pr-comment-time.test.ts": 40, "src/shared/preferred-git-remote.test.ts": 42, "src/shared/priority-semaphore.test.ts": 43, "src/shared/process-growth-breaker.test.ts": 47, @@ -12138,7 +12138,7 @@ "src/shared/pty-startup-ingress.test.ts": 174, "src/shared/pty-startup-reply-echo-shapes.test.ts": 66, "src/shared/published-pane-agent-identity.test.ts": 89, - "src/shared/pull-request-generation.test.ts": 51, + "src/shared/source-control/ai/generation/pull-request-generation.test.ts": 51, "src/shared/qoder-agent.test.ts": 445, "src/shared/queued-message-edit-lease.test.ts": 257, "src/shared/quick-open-filter.renderer-safety.test.ts": 58, @@ -12302,20 +12302,20 @@ "src/shared/skill-package-manifest.test.ts": 188, "src/shared/skill-path-containment.test.ts": 49, "src/shared/sleeping-record-legacy-pane-key.test.ts": 59, - "src/shared/source-control-ai-action-recipes.test.ts": 346, - "src/shared/source-control-ai-actions.test.ts": 243, - "src/shared/source-control-ai-recipe-save.test.ts": 294, - "src/shared/source-control-ai.test.ts": 249, - "src/shared/source-control-create-review-intent.test.ts": 54, - "src/shared/source-control-discard-all-sequence.test.ts": 50, - "src/shared/source-control-entry-actions.test.ts": 54, - "src/shared/source-control-group-order.test.ts": 31, - "src/shared/source-control-next-step-decision.test.ts": 99, - "src/shared/source-control-plan-contracts.test.ts": 343, - "src/shared/source-control-primary-action-decision.test.ts": 67, - "src/shared/source-control-push-failure.test.ts": 51, - "src/shared/source-control-section-order.test.ts": 63, - "src/shared/source-control-tree.test.ts": 63, + "src/shared/source-control/ai/recipes/source-control-ai-action-recipes.test.ts": 346, + "src/shared/source-control/ai/recipes/source-control-ai-actions.test.ts": 243, + "src/shared/source-control/ai/settings/source-control-ai-recipe-save.test.ts": 294, + "src/shared/source-control/ai/source-control-ai.test.ts": 249, + "src/shared/source-control/decisions/source-control-create-review-intent.test.ts": 54, + "src/shared/source-control/listing/source-control-discard-all-sequence.test.ts": 50, + "src/shared/source-control/listing/source-control-entry-actions.test.ts": 54, + "src/shared/source-control/listing/source-control-group-order.test.ts": 31, + "src/shared/source-control/decisions/source-control-next-step-decision.test.ts": 99, + "src/shared/source-control/ai/source-control-plan-contracts.test.ts": 343, + "src/shared/source-control/decisions/source-control-primary-action-decision.test.ts": 67, + "src/shared/source-control/recovery/source-control-push-failure.test.ts": 51, + "src/shared/source-control/listing/source-control-section-order.test.ts": 63, + "src/shared/source-control/listing/source-control-tree.test.ts": 63, "src/shared/source-scan/source-tree-scan.test.ts": 50, "src/shared/source-scan/source-tree-walk.test.ts": 62, "src/shared/ssh-pending-pty-kill.test.ts": 43, diff --git a/config/scripts/ci-unit-input-ownership.json b/config/scripts/ci-unit-input-ownership.json index 07a75cb78b9..8b87c1d6054 100644 --- a/config/scripts/ci-unit-input-ownership.json +++ b/config/scripts/ci-unit-input-ownership.json @@ -10,7 +10,7 @@ "contextSha256": "747ec5af67a0b60890da900a83fa255d3b96e2fa17d9199f8e483ef5051b213c" }, { - "file": "src/shared/git-fork-sync.ts", + "file": "src/shared/git/remotes/git-fork-sync.ts", "inputs": [], "emptyEnv": [], "sourceClosureSha256": "3e8caddb2b392603cdb3732f1b06c2f97749da0abcac10bce592b30fff4e6ac2", @@ -18,7 +18,7 @@ "contextSha256": "747ec5af67a0b60890da900a83fa255d3b96e2fa17d9199f8e483ef5051b213c" }, { - "file": "src/shared/git-remote-identity.ts", + "file": "src/shared/git/remotes/git-remote-identity.ts", "inputs": [], "emptyEnv": [], "sourceClosureSha256": "cc60ace7dc539e3a52f35a6195ac5712cee358a76d11cbb9486ea90de058b05c", diff --git a/config/scripts/local-repository-worktrees.mjs b/config/scripts/local-repository-worktrees.mjs index 130bccc8f56..cfdee29ce17 100644 --- a/config/scripts/local-repository-worktrees.mjs +++ b/config/scripts/local-repository-worktrees.mjs @@ -1,7 +1,7 @@ import { realpath } from 'node:fs/promises' import { resolve } from 'node:path' import { runProcess } from '@orca/process-host' -import { decodeGitCQuotedPath } from '../../src/shared/git-cquoted-path.ts' +import { decodeGitCQuotedPath } from '../../src/shared/git/paths/git-cquoted-path.ts' async function git(repoRoot, args) { const result = await runProcess({ diff --git a/config/scripts/pr-auxiliary-preflight-admission.test.mjs b/config/scripts/pr-auxiliary-preflight-admission.test.mjs index 6b288e3d78e..d457987c571 100644 --- a/config/scripts/pr-auxiliary-preflight-admission.test.mjs +++ b/config/scripts/pr-auxiliary-preflight-admission.test.mjs @@ -22,7 +22,7 @@ const relaySteps = unit.jobs.relay_integration.steps const chrome = relaySteps.find((step) => step.name === 'Resolve Chrome for the browser provider') const browser = relaySteps.find((step) => step.name === 'Test external Chromium browser provider') const routes = [ - ['git_compatibility', 'src/shared/git-capability-cache.ts'], + ['git_compatibility', 'src/shared/git/commands/git-capability-cache.ts'], ['codex_index_heal_contract', 'src/main/codex/codex-session-index-heal.ts'], ['xterm_patch_sync', 'config/patches/xterm-upstream.json'], ['shell_contracts', 'src/main/pty/pty-manager.ts'], diff --git a/config/scripts/pr-code-change-scope-test-inputs.test.mjs b/config/scripts/pr-code-change-scope-test-inputs.test.mjs index 7c82e9d59bc..73daaeccd7f 100644 --- a/config/scripts/pr-code-change-scope-test-inputs.test.mjs +++ b/config/scripts/pr-code-change-scope-test-inputs.test.mjs @@ -14,7 +14,7 @@ it.each([ 'test' ]) } - const mixed = classifyPrJobs([file, 'src/shared/git-capability-cache.ts']) + const mixed = classifyPrJobs([file, 'src/shared/git/commands/git-capability-cache.ts']) expect(PR_CHECK_JOBS.filter((job) => mixed[job])).toEqual([ 'static_analysis', 'typecheck', diff --git a/config/scripts/pr-code-change-scope.mjs b/config/scripts/pr-code-change-scope.mjs index aafda0e4042..cd5b4977fde 100644 --- a/config/scripts/pr-code-change-scope.mjs +++ b/config/scripts/pr-code-change-scope.mjs @@ -67,6 +67,7 @@ const GLOBAL_FORCE_FILES = new Set(['package.json', 'pnpm-lock.yaml']) const GIT_COMPAT_PREFIXES = [ '.github/actions/prepare-git-compatibility/', 'src/shared/git-', + 'src/shared/git/', 'src/shared/review-head-tracking-ref', 'src/shared/worktree/local-base-branch-fast-forward', 'src/main/git/', diff --git a/config/scripts/renderer-quadratic-scan-benchmark.mjs b/config/scripts/renderer-quadratic-scan-benchmark.mjs index 92c4a794ada..0e76815d809 100644 --- a/config/scripts/renderer-quadratic-scan-benchmark.mjs +++ b/config/scripts/renderer-quadratic-scan-benchmark.mjs @@ -190,7 +190,9 @@ compare({ const importShared = (relativePath) => import(pathToFileURL(path.join(ROOT, 'src/shared', relativePath)).href) -const { buildSourceControlTree } = await importShared('source-control-tree.ts') +const { buildSourceControlTree } = await importShared( + 'source-control/listing/source-control-tree.ts' +) const { normalizeRelativePath, splitPathSegments } = await importShared('cross-platform-path.ts') const { compareFileNames } = await importShared('file-name-sort.ts') diff --git a/config/scripts/source-control-path-sort-benchmark.mjs b/config/scripts/source-control-path-sort-benchmark.mjs index fddda7598a2..34e7bd94f53 100644 --- a/config/scripts/source-control-path-sort-benchmark.mjs +++ b/config/scripts/source-control-path-sort-benchmark.mjs @@ -37,7 +37,9 @@ function compareBefore(a, b) { } const { outputFiles } = await build({ - entryPoints: [fileURLToPath(new URL('../../src/shared/git-status-sort.ts', import.meta.url))], + entryPoints: [ + fileURLToPath(new URL('../../src/shared/git/status/git-status-sort.ts', import.meta.url)) + ], bundle: true, platform: 'node', format: 'esm', diff --git a/config/tsconfig.tc.web.json b/config/tsconfig.tc.web.json index e0ba6983e7a..1e6e453fd9c 100644 --- a/config/tsconfig.tc.web.json +++ b/config/tsconfig.tc.web.json @@ -38,6 +38,7 @@ "../src/packages/process-host/src/__fixtures__/**/*", "../src/main/gitlab/mappers.ts", "../src/main/source-control/hosted-review-branch-cache.ts", + "../src/main/source-control/hosted-review-branch-cache-types.ts", "../src/main/source-control/hosted-review-active-branch-claims.ts", "../src/main/source-control/hosted-review-unsettled-lookups.ts", "../src/main/source-control/hosted-review-inflight-lookups.ts", diff --git a/mobile/src/components/MobileDiffReviewFilesSheet.tsx b/mobile/src/components/MobileDiffReviewFilesSheet.tsx index 0342463ad21..54562435a5e 100644 --- a/mobile/src/components/MobileDiffReviewFilesSheet.tsx +++ b/mobile/src/components/MobileDiffReviewFilesSheet.tsx @@ -6,8 +6,8 @@ import { compactSourceControlTree, flattenSourceControlTree, type SourceControlTreeNode -} from '../../../src/shared/source-control-tree' -import { STATUS_LABELS } from '../../../src/shared/git-status-labels' +} from '../../../src/shared/source-control/listing/source-control-tree' +import { STATUS_LABELS } from '../../../src/shared/git/status/git-status-labels' import { useMobileTranslation } from '../i18n/use-mobile-translation' import type { MobileDiffReviewQueueItem } from '../session/mobile-diff-review-queue' import { statusColor } from '../source-control/mobile-git-status' diff --git a/mobile/src/components/pr-sidebar/PRCommentsSection.tsx b/mobile/src/components/pr-sidebar/PRCommentsSection.tsx index ef4e3f4d3e3..4dd930b7657 100644 --- a/mobile/src/components/pr-sidebar/PRCommentsSection.tsx +++ b/mobile/src/components/pr-sidebar/PRCommentsSection.tsx @@ -19,7 +19,7 @@ import { filterPRCommentsByAudience, getPRCommentAudienceCounts, type PRCommentAudienceFilter -} from '../../../../src/shared/pr-comment-audience' +} from '../../../../src/shared/source-control/review-comments/pr-comment-audience' import { getPRCommentGroupCount, getPRCommentGroupId, @@ -27,7 +27,7 @@ import { groupPRComments, isResolvedPRCommentGroup, type PRCommentGroup -} from '../../../../src/shared/pr-comment-groups' +} from '../../../../src/shared/source-control/review-comments/pr-comment-groups' import { prCommentsStyles as styles } from './pr-comments-styles' import { mobilePrSidebarStyles as shared } from './mobile-pr-sidebar-styles' import { useNow } from '../../hooks/use-now' diff --git a/mobile/src/components/pr-sidebar/PrChecksScreen.tsx b/mobile/src/components/pr-sidebar/PrChecksScreen.tsx index eea3f28f748..fa968914ec2 100644 --- a/mobile/src/components/pr-sidebar/PrChecksScreen.tsx +++ b/mobile/src/components/pr-sidebar/PrChecksScreen.tsx @@ -8,8 +8,8 @@ import { useMobileTranslation } from '../../i18n/use-mobile-translation' import type { Translate } from '../../i18n/mobile-i18n' import { openExternalLink } from '../../platform/external-link' import type { PRCheckDetail } from '../../../../src/shared/github/check-types' -import { isBrokenCheck } from '../../../../src/shared/pr-checks-fix-prompt' -import { sortChecksBySeverity } from '../../../../src/shared/pr-check-severity-order' +import { isBrokenCheck } from '../../../../src/shared/source-control/checks/pr-checks-fix-prompt' +import { sortChecksBySeverity } from '../../../../src/shared/source-control/checks/pr-check-severity-order' import { buildPrFixChecksPrompt } from '../../session/pr-ai-triage-prompt' import { DisclosureChevron } from '../DisclosureChevron' import { ListGroup, ListRow, SectionHeader, LIST_LEADING_INSET } from '../list/ListGroup' diff --git a/mobile/src/components/pr-sidebar/PrCommentsScreen.tsx b/mobile/src/components/pr-sidebar/PrCommentsScreen.tsx index af363ccd4ae..d86ef7471d1 100644 --- a/mobile/src/components/pr-sidebar/PrCommentsScreen.tsx +++ b/mobile/src/components/pr-sidebar/PrCommentsScreen.tsx @@ -10,10 +10,10 @@ import { getPRCommentGroupId, getPRCommentGroupRoot, type PRCommentGroup -} from '../../../../src/shared/pr-comment-groups' -import { isBotPRComment } from '../../../../src/shared/pr-comment-audience' +} from '../../../../src/shared/source-control/review-comments/pr-comment-groups' +import { isBotPRComment } from '../../../../src/shared/source-control/review-comments/pr-comment-audience' import { canAddRootComment } from '../../session/pr-comment-actions' -import { buildPRCommentsResolutionPrompt } from '../../../../src/shared/github/pr-comments-resolution-prompt' +import { buildPRCommentsResolutionPrompt } from '../../../../src/shared/source-control/review-comments/pr-comments-resolution-prompt' import { useMobileLaunchAgentLabel } from '../../session/use-mobile-launch-agent-label' import { useHostProtocolGates } from '../host-protocol-gates-context' import { AgentLaunchNotice } from '../AgentLaunchNotice' diff --git a/mobile/src/components/pr-sidebar/PrCreateSheet.tsx b/mobile/src/components/pr-sidebar/PrCreateSheet.tsx index f158920b7a8..4fd3b0aee8a 100644 --- a/mobile/src/components/pr-sidebar/PrCreateSheet.tsx +++ b/mobile/src/components/pr-sidebar/PrCreateSheet.tsx @@ -10,7 +10,7 @@ import { SheetHeader } from '../nav-bar/SheetHeader' import { SheetPrimaryButton } from '../SheetPrimaryButton' import { ListGroup, ListRow } from '../list/ListGroup' import { MobileSwitch } from '../MobileSwitch' -import { normalizeHostedReviewHeadRef } from '../../../../src/shared/hosted-review-refs' +import { normalizeHostedReviewHeadRef } from '../../../../src/shared/source-control/hosted-review/hosted-review-refs' import { hostedReviewCopy } from '../../source-control/hosted-review-copy' import { mobileHostedReviewCreateIntentProgressMessage, diff --git a/mobile/src/components/pr-sidebar/PrTabBottomAction.tsx b/mobile/src/components/pr-sidebar/PrTabBottomAction.tsx index 6d0224f4a4b..3a150152f41 100644 --- a/mobile/src/components/pr-sidebar/PrTabBottomAction.tsx +++ b/mobile/src/components/pr-sidebar/PrTabBottomAction.tsx @@ -5,7 +5,7 @@ import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme' import { useMobileTranslation } from '../../i18n/use-mobile-translation' import { resolveGitHubPRMergeMethods } from '../../../../src/shared/github/pull-request-merge-methods' import { resolveGitHubPRMergeState } from '../../../../src/shared/github/pull-request-merge-state' -import { MOBILE_GITHUB_MARK_PR_READY_RUNTIME_CAPABILITY } from '../../../../src/shared/source-control-runtime-capabilities' +import { MOBILE_GITHUB_MARK_PR_READY_RUNTIME_CAPABILITY } from '../../../../src/shared/source-control/runtime/source-control-runtime-capabilities' import { useRouteCapability } from '../../transport/use-workspace-client' import { buildResolveConflictsPrompt } from '../../session/pr-ai-triage-prompt' import { useMobileLaunchAgentLabel } from '../../session/use-mobile-launch-agent-label' diff --git a/mobile/src/components/pr-sidebar/PrTabEmptyState.tsx b/mobile/src/components/pr-sidebar/PrTabEmptyState.tsx index dfb37f1502b..d7107b90297 100644 --- a/mobile/src/components/pr-sidebar/PrTabEmptyState.tsx +++ b/mobile/src/components/pr-sidebar/PrTabEmptyState.tsx @@ -4,7 +4,7 @@ import { GitPullRequest, Link2 } from 'lucide-react-native' import { colors } from '../../theme/mobile-theme' import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme' import { useMobileTranslation } from '../../i18n/use-mobile-translation' -import { normalizeHostedReviewHeadRef } from '../../../../src/shared/hosted-review-refs' +import { normalizeHostedReviewHeadRef } from '../../../../src/shared/source-control/hosted-review/hosted-review-refs' import { fetchWorktreeGitHubPRLink } from '../../source-control/mobile-pr-link' import { ListGroup, ListRow } from '../list/ListGroup' import { MobileLinkPrForm } from './MobileLinkPrForm' diff --git a/mobile/src/components/pr-sidebar/PrThreadRow.tsx b/mobile/src/components/pr-sidebar/PrThreadRow.tsx index 5b9e666d41a..e1541022e36 100644 --- a/mobile/src/components/pr-sidebar/PrThreadRow.tsx +++ b/mobile/src/components/pr-sidebar/PrThreadRow.tsx @@ -12,8 +12,8 @@ import type { PRComment } from '../../../../src/shared/github/comment-types' import { getPRCommentGroupRoot, type PRCommentGroup -} from '../../../../src/shared/pr-comment-groups' -import { isBotPRComment } from '../../../../src/shared/pr-comment-audience' +} from '../../../../src/shared/source-control/review-comments/pr-comment-groups' +import { isBotPRComment } from '../../../../src/shared/source-control/review-comments/pr-comment-audience' import { threadDiffLines } from '../../../../src/shared/github/pr-comment-diff-hunk' import { colors, pressedStyle, radii, spacing, typography } from '../../theme/mobile-theme' import { themedStyleSheet } from '../../theme/themed-styles' diff --git a/mobile/src/components/pr-sidebar/PrThreadScreen.tsx b/mobile/src/components/pr-sidebar/PrThreadScreen.tsx index 8373f969c34..0e93dbef621 100644 --- a/mobile/src/components/pr-sidebar/PrThreadScreen.tsx +++ b/mobile/src/components/pr-sidebar/PrThreadScreen.tsx @@ -1,5 +1,5 @@ import { ScrollView, Text, View } from 'react-native' -import type { PRCommentGroup } from '../../../../src/shared/pr-comment-groups' +import type { PRCommentGroup } from '../../../../src/shared/source-control/review-comments/pr-comment-groups' import { threadDiffLines } from '../../../../src/shared/github/pr-comment-diff-hunk' import { colors, spacing, typography } from '../../theme/mobile-theme' import { themedStyleSheet } from '../../theme/themed-styles' diff --git a/mobile/src/components/pr-sidebar/pr-actions-state.test.ts b/mobile/src/components/pr-sidebar/pr-actions-state.test.ts index 5ac868f07d0..ea067a09a8c 100644 --- a/mobile/src/components/pr-sidebar/pr-actions-state.test.ts +++ b/mobile/src/components/pr-sidebar/pr-actions-state.test.ts @@ -1,4 +1,4 @@ -import { summarizeProviderChecks } from '../../../../src/shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../../src/shared/source-control/checks/provider-check-summary' import { describe, expect, it } from 'vitest' import type { PRInfo } from '../../../../src/shared/github/pull-request-types' import { presentPrMerge } from './pr-actions-state' diff --git a/mobile/src/components/pr-sidebar/pr-check-detail-content.ts b/mobile/src/components/pr-sidebar/pr-check-detail-content.ts index d4804483a68..1f226876628 100644 --- a/mobile/src/components/pr-sidebar/pr-check-detail-content.ts +++ b/mobile/src/components/pr-sidebar/pr-check-detail-content.ts @@ -3,7 +3,10 @@ import type { PRCheckJob, PRCheckRunDetails } from '../../../../src/shared/github/check-types' -import { resolveStepOutcome, summarizeJobSteps } from '../../../../src/shared/pr-check-step-status' +import { + resolveStepOutcome, + summarizeJobSteps +} from '../../../../src/shared/source-control/checks/pr-check-step-status' import { translate } from '../../i18n/mobile-i18n' // Map check payload to desktop-equivalent summary/annotations/failed jobs without React/RN imports for Node tests. diff --git a/mobile/src/components/pr-sidebar/pr-checks-presentation.ts b/mobile/src/components/pr-sidebar/pr-checks-presentation.ts index cccdb66c904..3b9cba6a125 100644 --- a/mobile/src/components/pr-sidebar/pr-checks-presentation.ts +++ b/mobile/src/components/pr-sidebar/pr-checks-presentation.ts @@ -3,7 +3,7 @@ import type { PRState } from '../../../../src/shared/github/pull-request-types' import { getProviderChecksOutcome, summarizeProviderChecks -} from '../../../../src/shared/provider-check-summary' +} from '../../../../src/shared/source-control/checks/provider-check-summary' import { prStateToken } from '../pr-state-token' import { translate } from '../../i18n/mobile-i18n' diff --git a/mobile/src/components/pr-sidebar/pr-comment-audience-labels.ts b/mobile/src/components/pr-sidebar/pr-comment-audience-labels.ts index c6fa65d15cd..65ac9d34e68 100644 --- a/mobile/src/components/pr-sidebar/pr-comment-audience-labels.ts +++ b/mobile/src/components/pr-sidebar/pr-comment-audience-labels.ts @@ -1,4 +1,4 @@ -import type { PRCommentAudienceFilter } from '../../../../src/shared/pr-comment-audience' +import type { PRCommentAudienceFilter } from '../../../../src/shared/source-control/review-comments/pr-comment-audience' import { translate } from '../../i18n/mobile-i18n' export const PR_COMMENT_AUDIENCE_FILTERS = [ diff --git a/mobile/src/components/pr-sidebar/pr-tab-gates.ts b/mobile/src/components/pr-sidebar/pr-tab-gates.ts index bf5e114649b..231191c0ab2 100644 --- a/mobile/src/components/pr-sidebar/pr-tab-gates.ts +++ b/mobile/src/components/pr-sidebar/pr-tab-gates.ts @@ -1,8 +1,8 @@ import type { PRCheckDetail } from '../../../../src/shared/github/check-types' import type { PRInfo } from '../../../../src/shared/github/pull-request-types' import type { GitHubWorkItemDetails } from '../../../../src/shared/github/work-item-types' -import { groupPRComments } from '../../../../src/shared/pr-comment-groups' -import { isBotPRComment } from '../../../../src/shared/pr-comment-audience' +import { groupPRComments } from '../../../../src/shared/source-control/review-comments/pr-comment-groups' +import { isBotPRComment } from '../../../../src/shared/source-control/review-comments/pr-comment-audience' import { translate } from '../../i18n/mobile-i18n' import { isPrSidebarDetailsPlaceholder } from '../../session/mobile-pr-sidebar-state' import { checkOutcome, summarizePRChecks } from './pr-checks-presentation' diff --git a/mobile/src/components/pr-sidebar/use-pr-tab-menu.ts b/mobile/src/components/pr-sidebar/use-pr-tab-menu.ts index a60eac0c712..ed7c68639a5 100644 --- a/mobile/src/components/pr-sidebar/use-pr-tab-menu.ts +++ b/mobile/src/components/pr-sidebar/use-pr-tab-menu.ts @@ -10,7 +10,7 @@ import { resolveGitHubPRMergeState } from '../../../../src/shared/github/pull-re import { MOBILE_GITHUB_MARK_PR_DRAFT_RUNTIME_CAPABILITY, MOBILE_GITHUB_MARK_PR_READY_RUNTIME_CAPABILITY -} from '../../../../src/shared/source-control-runtime-capabilities' +} from '../../../../src/shared/source-control/runtime/source-control-runtime-capabilities' import { useRouteCapability } from '../../transport/use-workspace-client' import type { MobilePrTab } from './use-mobile-pr-tab' diff --git a/mobile/src/host-screen/workspace-details-sheet.test.tsx b/mobile/src/host-screen/workspace-details-sheet.test.tsx index d6971522d72..fc05a64bb08 100644 --- a/mobile/src/host-screen/workspace-details-sheet.test.tsx +++ b/mobile/src/host-screen/workspace-details-sheet.test.tsx @@ -1,4 +1,4 @@ -import { summarizeProviderChecks } from '../../../src/shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../src/shared/source-control/checks/provider-check-summary' import { createElement } from 'react' import { act, create, type ReactTestInstance, type ReactTestRenderer } from 'react-test-renderer' import { afterEach, describe, expect, it, vi } from 'vitest' diff --git a/mobile/src/mobile-web-shell/bridge-host-github-requests.test.ts b/mobile/src/mobile-web-shell/bridge-host-github-requests.test.ts index 1901dcb925a..62564e0e372 100644 --- a/mobile/src/mobile-web-shell/bridge-host-github-requests.test.ts +++ b/mobile/src/mobile-web-shell/bridge-host-github-requests.test.ts @@ -2,7 +2,7 @@ import { afterEach, expect, it, vi } from 'vitest' import { BridgeHostRequests } from './bridge-host-requests' import { bridgeId, createFakeRpcClient, rpcSuccess } from './bridge-host-test-fakes' import { bridgePendingRequestCap } from './bridge/bridge-caps' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as capability } from '../../../src/shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as capability } from '../../../src/shared/source-control/runtime/source-control-runtime-capabilities' import { classifyExactGitHubOperation } from '../../../src/shared/github/exact-work-item-operation' import { createPageClient, INIT, GRANTS } from './bridge/bridge-page-client-test-harness' diff --git a/mobile/src/session/github-pr-read-reply-schema.ts b/mobile/src/session/github-pr-read-reply-schema.ts index e5e9b1ccc0e..7e678b6fb99 100644 --- a/mobile/src/session/github-pr-read-reply-schema.ts +++ b/mobile/src/session/github-pr-read-reply-schema.ts @@ -5,7 +5,7 @@ import type { GitHubWorkItem, GitHubWorkItemDetails } from '../../../src/shared/github/work-item-types' -import type { HostedReviewInfo } from '../../../src/shared/hosted-review' +import type { HostedReviewInfo } from '../../../src/shared/source-control/hosted-review/hosted-review-contracts' import { CHECK_STATUS, MERGEABLE_STATE, diff --git a/mobile/src/session/github-pr-rpc.test.ts b/mobile/src/session/github-pr-rpc.test.ts index 28c9fa25f68..6e3384332ad 100644 --- a/mobile/src/session/github-pr-rpc.test.ts +++ b/mobile/src/session/github-pr-rpc.test.ts @@ -14,7 +14,7 @@ import { fetchPRForBranch, fetchWorkItemDetails } from './github-pr-rpc' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../src/shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../src/shared/source-control/runtime/source-control-runtime-capabilities' import { GITHUB_CANONICAL_DETAILS_RUNTIME_CAPABILITY, GITHUB_EXACT_DETAILS_READ_INTENT_RUNTIME_CAPABILITY diff --git a/mobile/src/session/github-pr-rpc.ts b/mobile/src/session/github-pr-rpc.ts index c198e74bad2..64a50404658 100644 --- a/mobile/src/session/github-pr-rpc.ts +++ b/mobile/src/session/github-pr-rpc.ts @@ -8,7 +8,7 @@ import type { PRInfo } from '../../../src/shared/github/pull-request-types' import type { GitHubWorkItemDetails } from '../../../src/shared/github/work-item-types' -import type { HostedReviewInfo } from '../../../src/shared/hosted-review' +import type { HostedReviewInfo } from '../../../src/shared/source-control/hosted-review/hosted-review-contracts' import { refusedRpcMessageOrFallback } from '../transport/rpc-refusal-message' import type { RpcResponse } from '../transport/types' import { mobileRepoSelectorFromWorktreeId } from '../source-control/mobile-pr-create' diff --git a/mobile/src/session/mobile-diff-review-github.ts b/mobile/src/session/mobile-diff-review-github.ts index 9a257af5398..278a27dfa53 100644 --- a/mobile/src/session/mobile-diff-review-github.ts +++ b/mobile/src/session/mobile-diff-review-github.ts @@ -1,7 +1,10 @@ import type { GitHubPRFile } from '../../../src/shared/github/pull-request-types' import type { GitHubWorkItemDetails } from '../../../src/shared/github/work-item-types' import { getPRInlineCommentPlacement } from '../../../src/shared/github/pr-inline-comment-placement' -import { groupPRComments, type PRCommentGroup } from '../../../src/shared/pr-comment-groups' +import { + groupPRComments, + type PRCommentGroup +} from '../../../src/shared/source-control/review-comments/pr-comment-groups' import type { GitHubPrRepoSlug } from './github-pr-rpc' import type { MobileDiffReviewQueueItem } from './mobile-diff-review-queue' diff --git a/mobile/src/session/mobile-pr-sidebar-state.ts b/mobile/src/session/mobile-pr-sidebar-state.ts index fd0781f5d74..b66e38c9eb6 100644 --- a/mobile/src/session/mobile-pr-sidebar-state.ts +++ b/mobile/src/session/mobile-pr-sidebar-state.ts @@ -7,6 +7,7 @@ import type { PRCheckDetail } from '../../../src/shared/github/check-types' import type { PRInfo } from '../../../src/shared/github/pull-request-types' import type { GitPushTarget } from '../../../src/shared/worktree/types' import type { GitHubWorkItemDetails } from '../../../src/shared/github/work-item-types' +import type { HostedReviewInfo } from '../../../src/shared/source-control/hosted-review/hosted-review-contracts' import type { GitHubPrReadOutcome, GitHubPrRepoSlug } from './github-pr-rpc' import { isGitHubPRSuppressed } from '../../../src/shared/worktree/github-pr-suppression' import { @@ -65,9 +66,7 @@ export type PrSidebarLoadDeps = { fetchForBranch: ( worktreeId: string, args: { branch: string; linkedGitHubPR?: number | null } - ) => Promise< - GitHubPrReadOutcome - > + ) => Promise> // Resolve persisted links in parallel so closed/merged PRs add no serial read. fetchWorktreeGitHubPRLink: (worktreeId: string) => Promise clearWorktreeReviewLink: ( diff --git a/mobile/src/session/mobile-source-control-launch-agent.ts b/mobile/src/session/mobile-source-control-launch-agent.ts index a9641ad699a..d89ddd932dc 100644 --- a/mobile/src/session/mobile-source-control-launch-agent.ts +++ b/mobile/src/session/mobile-source-control-launch-agent.ts @@ -3,12 +3,12 @@ import type { Repo } from '../../../src/shared/repo-types' import type { SourceControlActionRecipe, SourceControlLaunchActionId -} from '../../../src/shared/source-control-ai-actions' -import { resolveSourceControlActionRecipe } from '../../../src/shared/source-control-ai' +} from '../../../src/shared/source-control/ai/recipes/source-control-ai-actions' +import { resolveSourceControlActionRecipe } from '../../../src/shared/source-control/ai/source-control-ai-operation-policy' import { pickSourceControlLaunchAgent, readSourceControlLaunchRecipeAgentId -} from '../../../src/shared/source-control-launch-agent-selection' +} from '../../../src/shared/source-control/ai/source-control-launch-agent-selection' import { filterEnabledTuiAgents } from '../../../src/shared/agent-launch/catalog/tui-agent-selection' import type { TuiAgent } from '../../../src/shared/agent-launch/catalog/tui-agent' import { isTuiAgent as isMobileTuiAgent } from '../../../src/shared/agent-launch/catalog/tui-agent-config' diff --git a/mobile/src/session/pr-ai-triage-launch.test.ts b/mobile/src/session/pr-ai-triage-launch.test.ts index 508d17ac9cc..4549f609df5 100644 --- a/mobile/src/session/pr-ai-triage-launch.test.ts +++ b/mobile/src/session/pr-ai-triage-launch.test.ts @@ -1,10 +1,8 @@ import { describe, expect, it, vi } from 'vitest' import type { RpcClient } from '../transport/rpc-client' import type { RpcResponse } from '../transport/types' -import { - getDefaultSourceControlAiSettings, - resolveSourceControlActionRecipe -} from '../../../src/shared/source-control-ai' +import { getDefaultSourceControlAiSettings } from '../../../src/shared/source-control/ai/settings/source-control-ai-settings' +import { resolveSourceControlActionRecipe } from '../../../src/shared/source-control/ai/source-control-ai-operation-policy' import { buildAgentStartupPlan } from '../../../src/shared/agent-launch/startup/tui-agent-startup' import { resolveAgentStartupPlanInputs } from '../../../src/shared/agent-launch/startup/agent-startup-plan-inputs' import { toAgentLaunchPreferences } from '../../../src/shared/agent-launch/choices/agent-launch-preferences' diff --git a/mobile/src/session/pr-ai-triage-launch.ts b/mobile/src/session/pr-ai-triage-launch.ts index 7a7b3012cde..028e57ae7b0 100644 --- a/mobile/src/session/pr-ai-triage-launch.ts +++ b/mobile/src/session/pr-ai-triage-launch.ts @@ -1,4 +1,4 @@ -import type { SourceControlLaunchActionId } from '../../../src/shared/source-control-ai-actions' +import type { SourceControlLaunchActionId } from '../../../src/shared/source-control/ai/recipes/source-control-ai-actions' import type { RpcClient } from '../transport/rpc-client' import { launchAgentInExistingWorkspace, @@ -9,7 +9,7 @@ import { loadMobileAgentLaunchContext } from './mobile-new-tab-agent-loader' import { resolveMobileSourceControlLaunchAgent } from './mobile-source-control-launch-agent' -import { projectSourceControlActionLaunch } from '../../../src/shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../src/shared/source-control/ai/recipes/source-control-action-launch-preferences' import { translate } from '../i18n/mobile-i18n' // Have the host launch and deliver AI prompts; mobile must never type them into a shell. diff --git a/mobile/src/session/pr-ai-triage-prompt.ts b/mobile/src/session/pr-ai-triage-prompt.ts index be7794e1355..5ebccc52c78 100644 --- a/mobile/src/session/pr-ai-triage-prompt.ts +++ b/mobile/src/session/pr-ai-triage-prompt.ts @@ -2,12 +2,12 @@ import { buildFixBrokenChecksPrompt, collectFixChecksPromptDetails, hasGitHubCheckHandle -} from '../../../src/shared/pr-checks-fix-prompt' +} from '../../../src/shared/source-control/checks/pr-checks-fix-prompt' import type { PRInfo } from '../../../src/shared/github/pull-request-types' import type { RpcClient } from '../transport/rpc-client' import { fetchPRCheckDetails } from './github-pr-rpc' import { splitWorktreeIdForFilesystem } from '../../../src/shared/worktree/id' -import { buildResolvePullRequestConflictsPrompt } from '../../../src/shared/source-control-conflict-prompts' +import { buildResolvePullRequestConflictsPrompt } from '../../../src/shared/source-control/recovery/source-control-conflict-prompts' import type { PRCheckDetail, PRCheckRunDetails } from '../../../src/shared/github/check-types' // Like desktop, the agent gets the failing steps' log tails, not just check names. diff --git a/mobile/src/session/session-reply-schema.test.ts b/mobile/src/session/session-reply-schema.test.ts index 0ba8d64a2d6..7df0b92ed8f 100644 --- a/mobile/src/session/session-reply-schema.test.ts +++ b/mobile/src/session/session-reply-schema.test.ts @@ -21,7 +21,7 @@ import { githubWorkItemDetailsSchema, hostedReviewForBranchSchema } from './github-pr-read-reply-schema' -import { getProviderChecksOutcome } from '../../../src/shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../src/shared/source-control/checks/provider-check-summary' import { prChecksSchema } from './github-pr-entity-reply-schema' import { reviewCreatedTerminalSchema, diff --git a/mobile/src/session/use-mobile-launch-agent-label.ts b/mobile/src/session/use-mobile-launch-agent-label.ts index c464e399109..ad04eb11f56 100644 --- a/mobile/src/session/use-mobile-launch-agent-label.ts +++ b/mobile/src/session/use-mobile-launch-agent-label.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react' -import type { SourceControlLaunchActionId } from '../../../src/shared/source-control-ai-actions' +import type { SourceControlLaunchActionId } from '../../../src/shared/source-control/ai/recipes/source-control-ai-actions' import type { RpcClient } from '../transport/rpc-client' import { TUI_AGENT_DISPLAY_NAMES as MOBILE_TUI_AGENT_LABELS } from '../../../src/shared/agent-launch/catalog/tui-agent-display-names' import { diff --git a/mobile/src/session/use-mobile-pr-sidebar-controller.test.ts b/mobile/src/session/use-mobile-pr-sidebar-controller.test.ts index 3cc64b1d088..6ca638aa968 100644 --- a/mobile/src/session/use-mobile-pr-sidebar-controller.test.ts +++ b/mobile/src/session/use-mobile-pr-sidebar-controller.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest' import type { PRCheckDetail } from '../../../src/shared/github/check-types' import type { PRInfo } from '../../../src/shared/github/pull-request-types' import type { GitHubWorkItemDetails } from '../../../src/shared/github/work-item-types' -import type { HostedReviewInfo } from '../../../src/shared/hosted-review' +import type { HostedReviewInfo } from '../../../src/shared/source-control/hosted-review/hosted-review-contracts' import { fetchPRChecks, type GitHubPrReadOutcome } from './github-pr-rpc' import { classifyPrSidebarFailure, diff --git a/mobile/src/session/use-pr-bot-author-overrides.ts b/mobile/src/session/use-pr-bot-author-overrides.ts index 99b6856d744..a35aab57eca 100644 --- a/mobile/src/session/use-pr-bot-author-overrides.ts +++ b/mobile/src/session/use-pr-bot-author-overrides.ts @@ -2,7 +2,7 @@ import { botOverridesRead } from '../transport/settings-read-operations' import { useEffect, useMemo, useRef, useState } from 'react' import type { ConnectionState } from '../transport/types' import type { RpcClient } from '../transport/rpc-client' -import { createBotAuthorOverrideSet } from '../../../src/shared/pr-bot-author-overrides' +import { createBotAuthorOverrideSet } from '../../../src/shared/source-control/review-comments/pr-bot-author-overrides' // Settings have no mobile change stream; refresh overrides alongside PR data so desktop bot classifications stay current. export function usePRBotAuthorOverrides( diff --git a/mobile/src/source-control/MobileCommitDetailPage.tsx b/mobile/src/source-control/MobileCommitDetailPage.tsx index 152d6d4aed7..40487256490 100644 --- a/mobile/src/source-control/MobileCommitDetailPage.tsx +++ b/mobile/src/source-control/MobileCommitDetailPage.tsx @@ -16,7 +16,7 @@ import { openExternalLink } from '../platform/external-link' import { triggerSuccess } from '../platform/haptics' import type { RpcClient } from '../transport/rpc-client' import type { ConnectionState } from '../transport/types' -import { STATUS_LABELS } from '../../../src/shared/git-status-labels' +import { STATUS_LABELS } from '../../../src/shared/git/status/git-status-labels' import { statusColor } from './mobile-git-status' import { gitCommitCompareRead, gitRemoteCommitUrlRead } from './mobile-git-read-operations' import type { MobileGitChangedFile } from './git-compare-reply-schema' diff --git a/mobile/src/source-control/MobileSourceControlChangesHeader.tsx b/mobile/src/source-control/MobileSourceControlChangesHeader.tsx index c7e8e4ccf8f..5c3efd72050 100644 --- a/mobile/src/source-control/MobileSourceControlChangesHeader.tsx +++ b/mobile/src/source-control/MobileSourceControlChangesHeader.tsx @@ -10,7 +10,7 @@ import { colors } from '../theme/mobile-theme' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import type { Translate } from '../i18n/mobile-i18n' import { useMobileTranslation } from '../i18n/use-mobile-translation' -import type { GitConflictOperation } from '../../../src/shared/git-status-types' +import type { GitConflictOperation } from '../../../src/shared/git/status/git-status-types' import { isMobileConflictAborting, mobileConflictAbortLabel diff --git a/mobile/src/source-control/MobileSourceControlFileRows.tsx b/mobile/src/source-control/MobileSourceControlFileRows.tsx index 18c3c7a76a2..869ce8c328d 100644 --- a/mobile/src/source-control/MobileSourceControlFileRows.tsx +++ b/mobile/src/source-control/MobileSourceControlFileRows.tsx @@ -12,8 +12,11 @@ import { SHEET_CURVE } from '../components/sheet-motion-values' import { useDrawerReducedMotion } from '../components/bottom-drawer/bottom-drawer-constants' import { Minus, Plus, Undo2 } from 'lucide-react-native' import { colors } from '../theme/mobile-theme' -import { STATUS_LABELS } from '../../../src/shared/git-status-labels' -import type { GitConflictKind, GitFileStatus } from '../../../src/shared/git-status-types' +import { STATUS_LABELS } from '../../../src/shared/git/status/git-status-labels' +import type { + GitConflictKind, + GitFileStatus +} from '../../../src/shared/git/status/git-status-types' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import type { Translate } from '../i18n/mobile-i18n' import { useMobileTranslation } from '../i18n/use-mobile-translation' diff --git a/mobile/src/source-control/mobile-branch-base-ref.ts b/mobile/src/source-control/mobile-branch-base-ref.ts index 67d6593ed9d..df47d3642d0 100644 --- a/mobile/src/source-control/mobile-branch-base-ref.ts +++ b/mobile/src/source-control/mobile-branch-base-ref.ts @@ -8,7 +8,7 @@ import { worktreeSummaryRead } from './mobile-worktree-metadata-operations' import { resolveSourceControlBaseRef, resolveSourceControlCompareBaseRef -} from '../../../src/shared/source-control-base-ref-resolution' +} from '../../../src/shared/source-control/decisions/source-control-base-ref-resolution' // The branch compare also honours desktop's compare-against-upstream setting. export type MobileBranchCompareTarget = { diff --git a/mobile/src/source-control/mobile-commit-dropdown-copy.ts b/mobile/src/source-control/mobile-commit-dropdown-copy.ts index 1a5c84f0912..6ed43bd8647 100644 --- a/mobile/src/source-control/mobile-commit-dropdown-copy.ts +++ b/mobile/src/source-control/mobile-commit-dropdown-copy.ts @@ -1,4 +1,4 @@ -import type { CommitDropdownCopy } from '../../../src/shared/source-control-dropdown-commit-items' +import type { CommitDropdownCopy } from '../../../src/shared/source-control/dropdown/source-control-dropdown-commit-items' import type { Translate } from '../i18n/mobile-i18n' export function mobileCommitDropdownCopy(t: Translate): CommitDropdownCopy { diff --git a/mobile/src/source-control/mobile-commit-failure-recovery.test.ts b/mobile/src/source-control/mobile-commit-failure-recovery.test.ts index 14f79b8dc65..267594fe3ff 100644 --- a/mobile/src/source-control/mobile-commit-failure-recovery.test.ts +++ b/mobile/src/source-control/mobile-commit-failure-recovery.test.ts @@ -3,7 +3,7 @@ import { buildFixCommitFailurePrompt, hasExpandedCommitFailureDetails, summarizeCommitFailure -} from './mobile-commit-failure-recovery' +} from '../../../src/shared/source-control/recovery/source-control-commit-failure' describe('mobile commit failure recovery', () => { it('summarizes hook and lint failures for the compact panel', () => { diff --git a/mobile/src/source-control/mobile-commit-failure-recovery.ts b/mobile/src/source-control/mobile-commit-failure-recovery.ts index 960d3a1b000..57bf90c8748 100644 --- a/mobile/src/source-control/mobile-commit-failure-recovery.ts +++ b/mobile/src/source-control/mobile-commit-failure-recovery.ts @@ -1,12 +1,5 @@ import type { MobileGitStatusEntry } from './mobile-git-status' -export { - COMMIT_FAILURE_SUMMARY_SCAN_CODE_UNITS, - buildFixCommitFailurePrompt, - hasExpandedCommitFailureDetails, - summarizeCommitFailure -} from '../../../src/shared/source-control-commit-failure' - export type MobileCommitFailureStagedEntry = Pick & { area: 'staged' } diff --git a/mobile/src/source-control/mobile-create-pr-action.test.ts b/mobile/src/source-control/mobile-create-pr-action.test.ts index ec082f81bef..876fac04847 100644 --- a/mobile/src/source-control/mobile-create-pr-action.test.ts +++ b/mobile/src/source-control/mobile-create-pr-action.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { HostedReviewCreationBlockedReason } from '../../../src/shared/hosted-review' +import type { HostedReviewCreationBlockedReason } from '../../../src/shared/source-control/hosted-review/hosted-review-contracts' import type { MobileHostedReviewEligibilityReply } from './hosted-review-reply-schema' import { buildMobileCreatePrAction, diff --git a/mobile/src/source-control/mobile-create-pr-action.ts b/mobile/src/source-control/mobile-create-pr-action.ts index e12b2ef71dc..e0425a2933f 100644 --- a/mobile/src/source-control/mobile-create-pr-action.ts +++ b/mobile/src/source-control/mobile-create-pr-action.ts @@ -1,7 +1,7 @@ import { translate } from '../i18n/mobile-i18n' import type { MobileHostedReviewEligibilityReply } from './hosted-review-reply-schema' -import { supportsHostedReviewCreation } from '../../../src/shared/hosted-review-creation-providers' -import { resolveCreateReviewIntentEligibility } from '../../../src/shared/source-control-create-review-intent' +import { supportsHostedReviewCreation } from '../../../src/shared/source-control/hosted-review/hosted-review-creation-providers' +import { resolveCreateReviewIntentEligibility } from '../../../src/shared/source-control/decisions/source-control-create-review-intent' import { hostedReviewCopy } from './hosted-review-copy' import { getMobilePrCreateBlockMessage } from './mobile-pr-create' diff --git a/mobile/src/source-control/mobile-git-history.test.ts b/mobile/src/source-control/mobile-git-history.test.ts index cfdf1304a3e..cf724f5a145 100644 --- a/mobile/src/source-control/mobile-git-history.test.ts +++ b/mobile/src/source-control/mobile-git-history.test.ts @@ -1,5 +1,8 @@ import { describe, expect, it } from 'vitest' -import type { GitHistoryItem, GitHistoryResult } from '../../../src/shared/git-history-types' +import type { + GitHistoryItem, + GitHistoryResult +} from '../../../src/shared/git/history/git-history-types' import { appendMobileGitHistoryPage, buildMobileCommitsListItems, diff --git a/mobile/src/source-control/mobile-git-status.ts b/mobile/src/source-control/mobile-git-status.ts index 7f3fea4c54d..d95b9dbf01a 100644 --- a/mobile/src/source-control/mobile-git-status.ts +++ b/mobile/src/source-control/mobile-git-status.ts @@ -1,21 +1,21 @@ import { translate } from '../i18n/mobile-i18n' import { colors } from '../theme/mobile-theme' -import type { GitFileStatus, GitStagingArea } from '../../../src/shared/git-status-types' +import type { GitFileStatus, GitStagingArea } from '../../../src/shared/git/status/git-status-types' import { buildSourceControlDisplaySections, groupSourceControlEntries, resolveSourceControlGroupOrder, type SourceControlDisplaySectionArea, type SourceControlDisplaySectionId -} from '../../../src/shared/source-control-section-order' -import { getUnstageAllPaths } from '../../../src/shared/source-control-discard-all-sequence' +} from '../../../src/shared/source-control/listing/source-control-section-order' +import { getUnstageAllPaths } from '../../../src/shared/source-control/listing/source-control-discard-all-sequence' import { canDiscardStatusEntry, canStageStatusEntry, canUnstageStatusEntry, getConflictResolutions, type ConflictResolution -} from '../../../src/shared/source-control-entry-actions' +} from '../../../src/shared/source-control/listing/source-control-entry-actions' import type { SourceControlGroupOrder } from '../../../src/shared/ui-chrome-types' import type { RpcResponse } from '../transport/types' import type { diff --git a/mobile/src/source-control/mobile-hosted-review-create-intent.ts b/mobile/src/source-control/mobile-hosted-review-create-intent.ts index 0dd89a7411c..08a2de1e765 100644 --- a/mobile/src/source-control/mobile-hosted-review-create-intent.ts +++ b/mobile/src/source-control/mobile-hosted-review-create-intent.ts @@ -3,7 +3,7 @@ import { requestMobileCommitMessage } from './mobile-commit-message-ai' import { getStageablePaths, type MobileGitStatusResult } from './mobile-git-status' import { getMobilePrEligibilityReadiness } from './mobile-open-pr-prefill' import { resolveMobilePrPrefill, type MobilePrPrefill } from './mobile-pr-create' -import { isBehindOnlyUpstream } from '../../../src/shared/git-upstream-status' +import { isBehindOnlyUpstream } from '../../../src/shared/git/remotes/git-upstream-status' import { commitMobileHostedReviewStagedChanges, fastForwardMobileHostedReviewBranch, diff --git a/mobile/src/source-control/mobile-hosted-review-remote-prerequisite.ts b/mobile/src/source-control/mobile-hosted-review-remote-prerequisite.ts index 765919a0034..63abf0a8b10 100644 --- a/mobile/src/source-control/mobile-hosted-review-remote-prerequisite.ts +++ b/mobile/src/source-control/mobile-hosted-review-remote-prerequisite.ts @@ -1,5 +1,5 @@ import { translate } from '../i18n/mobile-i18n' -import { resolveCreatePrIntentRemoteStep } from '../../../src/shared/source-control-create-review-intent' +import { resolveCreatePrIntentRemoteStep } from '../../../src/shared/source-control/decisions/source-control-create-review-intent' import type { MobileGitStatusResult } from './mobile-git-status' import type { MobileHostedReviewCreateIntentProgress } from './mobile-hosted-review-create-intent' import type { MobilePrPrefill } from './mobile-pr-create' diff --git a/mobile/src/source-control/mobile-pr-create-draft.ts b/mobile/src/source-control/mobile-pr-create-draft.ts index c8615ec1b42..e23235be740 100644 --- a/mobile/src/source-control/mobile-pr-create-draft.ts +++ b/mobile/src/source-control/mobile-pr-create-draft.ts @@ -1,13 +1,13 @@ import { translate } from '../i18n/mobile-i18n' import { refusedRpcMessageOrFallback } from '../transport/rpc-refusal-message' import type { RpcOperationSender } from '../transport/rpc-operation-sender' -import { resolveCreateReviewSeedFromCommits } from '../../../src/shared/hosted-review-create-seed' +import { resolveCreateReviewSeedFromCommits } from '../../../src/shared/source-control/hosted-review/hosted-review-create-seed' import { normalizeCreateReviewBaseSearchResults, normalizeHostedReviewBaseRef -} from '../../../src/shared/hosted-review-refs' +} from '../../../src/shared/source-control/hosted-review/hosted-review-refs' import { TEXT_GENERATION_CLIENT_TIMEOUT_MS } from '../../../src/shared/text-generation-client-timeout' -import type { HostedReviewProvider } from '../../../src/shared/hosted-review' +import type { HostedReviewProvider } from '../../../src/shared/source-control/hosted-review/hosted-review-contracts' import type { MobileGitStatusResult } from './mobile-git-status' import { fetchMobileGitHistory } from './mobile-git-history' import type { MobileGitHistoryItem, MobileGitHistoryResult } from './git-history-reply-schema' diff --git a/mobile/src/source-control/mobile-pr-create.ts b/mobile/src/source-control/mobile-pr-create.ts index 4172529bac5..2a81efac6b5 100644 --- a/mobile/src/source-control/mobile-pr-create.ts +++ b/mobile/src/source-control/mobile-pr-create.ts @@ -1,5 +1,5 @@ import { translate } from '../i18n/mobile-i18n' -import { isHostedReviewCreateEligibilityConfirmable } from '../../../src/shared/hosted-review-create-confirmation' +import { isHostedReviewCreateEligibilityConfirmable } from '../../../src/shared/source-control/hosted-review/hosted-review-create-confirmation' import { hostedReviewCopy } from './hosted-review-copy' import { buildMobileHostedReviewCreateParams, diff --git a/mobile/src/source-control/mobile-remote-dropdown-copy.ts b/mobile/src/source-control/mobile-remote-dropdown-copy.ts index 058ca2cdbde..a8cea9cbbb3 100644 --- a/mobile/src/source-control/mobile-remote-dropdown-copy.ts +++ b/mobile/src/source-control/mobile-remote-dropdown-copy.ts @@ -1,4 +1,4 @@ -import type { RemoteDropdownCopy } from '../../../src/shared/source-control-dropdown-remote-copy' +import type { RemoteDropdownCopy } from '../../../src/shared/source-control/dropdown/source-control-dropdown-remote-copy' import type { Translate } from '../i18n/mobile-i18n' import { localizedPushCount, diff --git a/mobile/src/source-control/mobile-source-control-actions.ts b/mobile/src/source-control/mobile-source-control-actions.ts index 936eff41189..cd819d69476 100644 --- a/mobile/src/source-control/mobile-source-control-actions.ts +++ b/mobile/src/source-control/mobile-source-control-actions.ts @@ -1,14 +1,16 @@ -import { translate } from '../i18n/mobile-i18n' -import type { Translate } from '../i18n/mobile-i18n' +import { translate, type Translate } from '../i18n/mobile-i18n' + import { mobileCommitDropdownCopy } from './mobile-commit-dropdown-copy' import { mobileRemoteDropdownCopy } from './mobile-remote-dropdown-copy' -import type { GitConflictOperation } from '../../../src/shared/git-status-types' -import { deriveDropdownActionContext } from '../../../src/shared/source-control-dropdown-action-context' -import { buildCommitDropdownItems } from '../../../src/shared/source-control-dropdown-commit-items' -import type { DropdownItem } from '../../../src/shared/source-control-dropdown-item-types' -import { buildRemoteDropdownItems } from '../../../src/shared/source-control-dropdown-remote-items' -import type { SourceControlCommitAreaPrimaryActionDecision } from '../../../src/shared/source-control-primary-action-decision' -import type { SourceControlPrimaryActionDecisionInputs } from '../../../src/shared/source-control-primary-action-decision-types' +import type { GitConflictOperation } from '../../../src/shared/git/status/git-status-types' +import { deriveDropdownActionContext } from '../../../src/shared/source-control/dropdown/source-control-dropdown-action-context' +import { buildCommitDropdownItems } from '../../../src/shared/source-control/dropdown/source-control-dropdown-commit-items' +import type { DropdownItem } from '../../../src/shared/source-control/dropdown/source-control-dropdown-item-types' +import { buildRemoteDropdownItems } from '../../../src/shared/source-control/dropdown/source-control-dropdown-remote-items' +import type { + SourceControlCommitAreaPrimaryActionDecision, + SourceControlPrimaryActionDecisionInputs +} from '../../../src/shared/source-control/decisions/source-control-primary-action-decision-types' // String identifiers keep native lucide imports out of this module. export type MobileSourceControlActionIcon = diff --git a/mobile/src/source-control/mobile-source-control-capped-stage-all.test.tsx b/mobile/src/source-control/mobile-source-control-capped-stage-all.test.tsx index 6b3c64e656c..dcbfabcc7b4 100644 --- a/mobile/src/source-control/mobile-source-control-capped-stage-all.test.tsx +++ b/mobile/src/source-control/mobile-source-control-capped-stage-all.test.tsx @@ -27,7 +27,7 @@ vi.mock('../platform/haptics', () => ({ })) import { useRouteHandoff } from '../navigation/route-handoff' -import { GIT_STAGE_WORKTREE_SCOPE_UNSUPPORTED_MESSAGE } from '../../../src/shared/git-stage-worktree-scope' +import { GIT_STAGE_WORKTREE_SCOPE_UNSUPPORTED_MESSAGE } from '../../../src/shared/git/paths/git-stage-worktree-scope' import { gitStatusHostPayloadSchema } from './git-status-reply-schema' import type { MobileGitStatusResult } from './mobile-git-status' import { useMobileSourceControlRunners } from './use-mobile-source-control-runners' diff --git a/mobile/src/source-control/mobile-source-control-conflict-actions.ts b/mobile/src/source-control/mobile-source-control-conflict-actions.ts index 3c3b8ea4d5a..60600740dbe 100644 --- a/mobile/src/source-control/mobile-source-control-conflict-actions.ts +++ b/mobile/src/source-control/mobile-source-control-conflict-actions.ts @@ -1,4 +1,4 @@ -import type { ConflictResolution } from '../../../src/shared/source-control-entry-actions' +import type { ConflictResolution } from '../../../src/shared/source-control/listing/source-control-entry-actions' import { translate, type Translate } from '../i18n/mobile-i18n' export const MOBILE_COMPLETE_MERGE_ACTION_ID = 'complete-merge' diff --git a/mobile/src/source-control/mobile-source-control-next-step.ts b/mobile/src/source-control/mobile-source-control-next-step.ts index 0c5679f7e2e..5cff6d51750 100644 --- a/mobile/src/source-control/mobile-source-control-next-step.ts +++ b/mobile/src/source-control/mobile-source-control-next-step.ts @@ -3,7 +3,7 @@ import type { PRInfo } from '../../../src/shared/github/pull-request-types' import { resolveGitHubPRMergeMethods } from '../../../src/shared/github/pull-request-merge-methods' import { getGitHubPRPrimaryReviewer } from '../../../src/shared/github/pr-reviewer-display' import type { GitHubWorkItemDetails } from '../../../src/shared/github/work-item-types' -import type { SourceControlNextStep } from '../../../src/shared/source-control-next-step-decision' +import type { SourceControlNextStep } from '../../../src/shared/source-control/decisions/source-control-next-step-decision' import { presentPrMerge } from '../components/pr-sidebar/pr-actions-state' import type { MobileCreatePrAction } from './mobile-create-pr-action' import type { MobileSourceControlPrimaryAction } from './mobile-source-control-primary-action' diff --git a/mobile/src/source-control/mobile-source-control-primary-action-label.ts b/mobile/src/source-control/mobile-source-control-primary-action-label.ts index af0e86522bf..72bb2f30388 100644 --- a/mobile/src/source-control/mobile-source-control-primary-action-label.ts +++ b/mobile/src/source-control/mobile-source-control-primary-action-label.ts @@ -1,5 +1,5 @@ import { translate } from '../i18n/mobile-i18n' -import type { SourceControlCommitAreaPrimaryActionDecision } from '../../../src/shared/source-control-primary-action-decision' +import type { SourceControlCommitAreaPrimaryActionDecision } from '../../../src/shared/source-control/decisions/source-control-primary-action-decision-types' // "Commit 2 files", "Push 3 commits": the commit area's action named with its count. export function getMobilePrimaryActionLabel( diff --git a/mobile/src/source-control/mobile-source-control-primary-action.ts b/mobile/src/source-control/mobile-source-control-primary-action.ts index 9921dbaa976..5f68204aaab 100644 --- a/mobile/src/source-control/mobile-source-control-primary-action.ts +++ b/mobile/src/source-control/mobile-source-control-primary-action.ts @@ -1,16 +1,17 @@ import { getMobilePrimaryActionHint } from './mobile-source-control-actions' import { getMobilePrimaryActionLabel } from './mobile-source-control-primary-action-label' import { getMobileForcePushBlockedReason } from './mobile-source-control-review-copy' -import type { SourceControlPrimaryActionDecisionInputs } from '../../../src/shared/source-control-primary-action-decision-types' -import { - resolveSourceControlCommitAreaPrimaryActionDecision, - type SourceControlCommitAreaPrimaryActionDecision, - type SourceControlRemoteOpKind -} from '../../../src/shared/source-control-primary-action-decision' +import type { + SourceControlPrimaryActionDecisionInputs, + SourceControlCommitAreaPrimaryActionDecision, + SourceControlRemoteOpKind +} from '../../../src/shared/source-control/decisions/source-control-primary-action-decision-types' +import { resolveSourceControlCommitAreaPrimaryActionDecision } from '../../../src/shared/source-control/decisions/source-control-primary-action-decision' + import { hasResolvableHostedReviewPushTargetLink, resolveHostedReviewPushTargetForActions -} from '../../../src/shared/hosted-review-push-target' +} from '../../../src/shared/source-control/hosted-review/hosted-review-push-target' import type { PRState } from '../../../src/shared/github/pull-request-types' import type { GitPushTarget } from '../../../src/shared/worktree/types' import type { PrSidebarState } from '../session/mobile-pr-sidebar-state' diff --git a/mobile/src/source-control/mobile-source-control-screen-state.ts b/mobile/src/source-control/mobile-source-control-screen-state.ts index e6ad5c673e7..5b0962c4a6d 100644 --- a/mobile/src/source-control/mobile-source-control-screen-state.ts +++ b/mobile/src/source-control/mobile-source-control-screen-state.ts @@ -17,7 +17,7 @@ import type { MobileGitBranchCompareReply } from './git-compare-reply-schema' import type { MobileGitStatusHostPayload } from './git-status-reply-schema' -import type { ConflictResolution } from '../../../src/shared/source-control-entry-actions' +import type { ConflictResolution } from '../../../src/shared/source-control/listing/source-control-entry-actions' import { canOpenMobileGitStatusEntry, getMobileConflictResolutions, diff --git a/mobile/src/source-control/mobile-source-control-settings.ts b/mobile/src/source-control/mobile-source-control-settings.ts index b3c21acc49a..ff4ef1cc577 100644 --- a/mobile/src/source-control/mobile-source-control-settings.ts +++ b/mobile/src/source-control/mobile-source-control-settings.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useSyncExternalStore } from 'react' -import { DEFAULT_SOURCE_CONTROL_GROUP_ORDER } from '../../../src/shared/source-control-group-order' +import { DEFAULT_SOURCE_CONTROL_GROUP_ORDER } from '../../../src/shared/source-control/listing/source-control-group-order' import { sourceControlSettingsRead, type MobileSourceControlSettings diff --git a/mobile/src/source-control/use-mobile-commit-failure-recovery.ts b/mobile/src/source-control/use-mobile-commit-failure-recovery.ts index fac5c52aa61..e02f5f06b33 100644 --- a/mobile/src/source-control/use-mobile-commit-failure-recovery.ts +++ b/mobile/src/source-control/use-mobile-commit-failure-recovery.ts @@ -8,10 +8,10 @@ import { launchAgentWithPrompt, promptedLaunchNotice } from '../session/pr-ai-tr import { resolveMobileAgentLaunchAvailability } from '../session/mobile-agent-launch-availability' import { buildFixCommitFailurePrompt, - type MobileCommitFailureRecovery, hasExpandedCommitFailureDetails, summarizeCommitFailure -} from './mobile-commit-failure-recovery' +} from '../../../src/shared/source-control/recovery/source-control-commit-failure' +import type { MobileCommitFailureRecovery } from './mobile-commit-failure-recovery' type Params = { client: RpcClient | null diff --git a/mobile/src/source-control/use-mobile-conflict-runners.ts b/mobile/src/source-control/use-mobile-conflict-runners.ts index 80d9fc1b904..a29cb8a9f04 100644 --- a/mobile/src/source-control/use-mobile-conflict-runners.ts +++ b/mobile/src/source-control/use-mobile-conflict-runners.ts @@ -1,5 +1,5 @@ import { useCallback } from 'react' -import type { ConflictResolution } from '../../../src/shared/source-control-entry-actions' +import type { ConflictResolution } from '../../../src/shared/source-control/listing/source-control-entry-actions' import { isMobileGitUnavailable } from './mobile-git-status' import { translate } from '../i18n/mobile-i18n' import { diff --git a/mobile/src/source-control/use-mobile-source-control-agent-name.ts b/mobile/src/source-control/use-mobile-source-control-agent-name.ts index ff157472037..1febcdad6c4 100644 --- a/mobile/src/source-control/use-mobile-source-control-agent-name.ts +++ b/mobile/src/source-control/use-mobile-source-control-agent-name.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react' -import type { SourceControlLaunchActionId } from '../../../src/shared/source-control-ai-actions' +import type { SourceControlLaunchActionId } from '../../../src/shared/source-control/ai/recipes/source-control-ai-actions' import { tuiAgentDisplayName } from '../../../src/shared/agent-launch/catalog/tui-agent-display-names' import type { RpcClient } from '../transport/rpc-client' import type { ConnectionState } from '../transport/types' diff --git a/mobile/src/source-control/use-mobile-source-control-next-step.ts b/mobile/src/source-control/use-mobile-source-control-next-step.ts index f5816cbcc81..e123bf780f3 100644 --- a/mobile/src/source-control/use-mobile-source-control-next-step.ts +++ b/mobile/src/source-control/use-mobile-source-control-next-step.ts @@ -9,16 +9,16 @@ import { buildResolveConflictsPrompt as buildReviewConflictsPrompt } from '../session/pr-ai-triage-prompt' import type { PrSidebarState } from '../session/mobile-pr-sidebar-state' -import { buildResolveConflictsPrompt } from '../../../src/shared/source-control-conflict-prompts' +import { buildResolveConflictsPrompt } from '../../../src/shared/source-control/recovery/source-control-conflict-prompts' import { resolveGitHubPRMergeMethods } from '../../../src/shared/github/pull-request-merge-methods' import type { GitHubPRMergeMethod } from '../../../src/shared/github/pull-request-types' -import { summarizeProviderChecks } from '../../../src/shared/provider-check-summary' -import { getBrokenChecks } from '../../../src/shared/pr-checks-fix-prompt' -import { resolveSourceControlCommitAreaPrimaryActionDecision } from '../../../src/shared/source-control-primary-action-decision' +import { summarizeProviderChecks } from '../../../src/shared/source-control/checks/provider-check-summary' +import { getBrokenChecks } from '../../../src/shared/source-control/checks/pr-checks-fix-prompt' +import { resolveSourceControlCommitAreaPrimaryActionDecision } from '../../../src/shared/source-control/decisions/source-control-primary-action-decision' import { resolveSourceControlNextStep, type SourceControlNextStepReview -} from '../../../src/shared/source-control-next-step-decision' +} from '../../../src/shared/source-control/decisions/source-control-next-step-decision' import { splitWorktreeIdForFilesystem } from '../../../src/shared/worktree/id' import { MOBILE_COMPLETE_MERGE_ACTION_ID } from './mobile-source-control-conflict-actions' import { diff --git a/mobile/src/source-control/use-mobile-stage-all-runner.ts b/mobile/src/source-control/use-mobile-stage-all-runner.ts index f64de30e8c7..4bbe4f41b1a 100644 --- a/mobile/src/source-control/use-mobile-stage-all-runner.ts +++ b/mobile/src/source-control/use-mobile-stage-all-runner.ts @@ -1,5 +1,5 @@ import { useCallback } from 'react' -import { requireGitStageWorktreeScopeReceipt } from '../../../src/shared/git-stage-worktree-scope' +import { requireGitStageWorktreeScopeReceipt } from '../../../src/shared/git/paths/git-stage-worktree-scope' import type { MobileGitStatusResult } from './mobile-git-status' type Params = { diff --git a/mobile/src/tasks/github-check-summary.ts b/mobile/src/tasks/github-check-summary.ts index 37615513324..5714c080527 100644 --- a/mobile/src/tasks/github-check-summary.ts +++ b/mobile/src/tasks/github-check-summary.ts @@ -1,4 +1,4 @@ -import { summarizeProviderChecks } from '../../../src/shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../src/shared/source-control/checks/provider-check-summary' import type { ProviderCheckSummary } from '../../../src/shared/github/pull-request-types' export type GitHubCheckLike = { diff --git a/mobile/src/tasks/github-work-item-operation.test.ts b/mobile/src/tasks/github-work-item-operation.test.ts index 724f8818478..6dd01e78160 100644 --- a/mobile/src/tasks/github-work-item-operation.test.ts +++ b/mobile/src/tasks/github-work-item-operation.test.ts @@ -5,7 +5,7 @@ import { RpcClientRequestTracker } from '../transport/rpc-client-request-tracker import { createFakeRpcClient } from '../mobile-web-shell/bridge-host-test-fakes' import { createStableLogicalRpcClient } from '../transport/stable-logical-rpc-client' import { GITHUB_DESKTOP_UPDATE_REQUIRED } from '../transport/github-target-invocation' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as capability } from '../../../src/shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as capability } from '../../../src/shared/source-control/runtime/source-control-runtime-capabilities' function deferred() { let resolve = () => {} diff --git a/mobile/src/tasks/gitlab-check-summary.ts b/mobile/src/tasks/gitlab-check-summary.ts index bd1481b6087..b97d1998125 100644 --- a/mobile/src/tasks/gitlab-check-summary.ts +++ b/mobile/src/tasks/gitlab-check-summary.ts @@ -2,8 +2,8 @@ import { gitLabPipelineToPRCheck, mapGitLabPipelineJobStatusToCheckStatus, mapGitLabPipelineJobStatusToConclusion -} from '../../../src/shared/gitlab-pipeline-checks' -import { summarizeProviderChecks } from '../../../src/shared/provider-check-summary' +} from '../../../src/shared/source-control/checks/gitlab/gitlab-pipeline-checks' +import { summarizeProviderChecks } from '../../../src/shared/source-control/checks/provider-check-summary' import type { ProviderCheckSummary } from '../../../src/shared/github/pull-request-types' import type { GitLabPipeline } from '../../../src/shared/gitlab-types' diff --git a/mobile/src/tasks/mobile-hosted-check-status.ts b/mobile/src/tasks/mobile-hosted-check-status.ts index 64e84ce2e42..74434d8a16f 100644 --- a/mobile/src/tasks/mobile-hosted-check-status.ts +++ b/mobile/src/tasks/mobile-hosted-check-status.ts @@ -7,7 +7,7 @@ import { resolveGitHubPRMergeState } from '../../../src/shared/github/pull-reque import { getProviderChecksLabel, getProviderChecksOutcome -} from '../../../src/shared/provider-check-summary' +} from '../../../src/shared/source-control/checks/provider-check-summary' export type MobileHostedReviewStatus = { state?: string diff --git a/mobile/src/tasks/mobile-tasks-dependencies.ts b/mobile/src/tasks/mobile-tasks-dependencies.ts index 3039c6741f7..08710232567 100644 --- a/mobile/src/tasks/mobile-tasks-dependencies.ts +++ b/mobile/src/tasks/mobile-tasks-dependencies.ts @@ -156,7 +156,7 @@ export type { PersistedTrustedOrcaHooks } from '../../../src/shared/orca-yaml-ho export type { SparsePreset } from '../../../src/shared/worktree/create-types' export type { SshConnectionState } from '../../../src/shared/ssh-types' -export type { HostedReviewDecision } from '../../../src/shared/hosted-review' + export { githubProjectHost, githubProjectIdentityKey as githubProjectKey diff --git a/mobile/src/tasks/mobile-tasks-item-detail-content.tsx b/mobile/src/tasks/mobile-tasks-item-detail-content.tsx index 902bca805f1..092da329718 100644 --- a/mobile/src/tasks/mobile-tasks-item-detail-content.tsx +++ b/mobile/src/tasks/mobile-tasks-item-detail-content.tsx @@ -1,6 +1,6 @@ import type { ConnectionPresentationModel } from './use-mobile-tasks-connection-presentation' import { translate } from '../i18n/mobile-i18n' -import { isBrokenCheck } from '../../../src/shared/pr-checks-fix-prompt' +import { isBrokenCheck } from '../../../src/shared/source-control/checks/pr-checks-fix-prompt' import { View, colors, diff --git a/mobile/src/tasks/mobile-tasks-project-review-panels.tsx b/mobile/src/tasks/mobile-tasks-project-review-panels.tsx index ef0b74c300c..499a1610a08 100644 --- a/mobile/src/tasks/mobile-tasks-project-review-panels.tsx +++ b/mobile/src/tasks/mobile-tasks-project-review-panels.tsx @@ -1,6 +1,6 @@ import type { ConnectionPresentationModel } from './use-mobile-tasks-connection-presentation' import { translate } from '../i18n/mobile-i18n' -import { isBrokenCheck } from '../../../src/shared/pr-checks-fix-prompt' +import { isBrokenCheck } from '../../../src/shared/source-control/checks/pr-checks-fix-prompt' import { SHOW_MOBILE_PROJECT_REVIEW_PANELS, getGitHubReviewSummary, diff --git a/mobile/src/tasks/mobile-tasks-provider-detail-types.ts b/mobile/src/tasks/mobile-tasks-provider-detail-types.ts index 9543a16a195..62dd607c9b1 100644 --- a/mobile/src/tasks/mobile-tasks-provider-detail-types.ts +++ b/mobile/src/tasks/mobile-tasks-provider-detail-types.ts @@ -3,9 +3,9 @@ import type { ProviderCheckSummary, GitHubOwnerRepo, RpcClient, - HostedReviewDecision, LinearMobileIssue } from './mobile-tasks-dependencies' +import type { HostedReviewDecision } from '../../../src/shared/source-control/hosted-review/hosted-review-contracts' export type RepoSummary = { id: string diff --git a/mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx b/mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx index c5f6da85d7e..ba30b5337ef 100644 --- a/mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx +++ b/mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx @@ -9,11 +9,8 @@ import type { GitLabWorkItem } from './mobile-tasks-provider-detail-types' import type { ItemDetailMetadataEffectsModel } from './use-mobile-tasks-item-detail-metadata-effects' import { fetchJiraIssueDetail } from './mobile-jira-task-source' import { createJiraTask } from './mobile-tasks-item-mapping' -import { - type HostedReviewDecision, - buildGitLabCheckSummary, - useEffect -} from './mobile-tasks-dependencies' +import type { HostedReviewDecision } from '../../../src/shared/source-control/hosted-review/hosted-review-contracts' +import { buildGitLabCheckSummary, useEffect } from './mobile-tasks-dependencies' import { type TaskItem, createLinearTask } from './mobile-tasks-legacy-foundation' import { githubItemDetailRead, diff --git a/mobile/src/transport/github-target-invocation.ts b/mobile/src/transport/github-target-invocation.ts index b082657d4ea..3c3c822c962 100644 --- a/mobile/src/transport/github-target-invocation.ts +++ b/mobile/src/transport/github-target-invocation.ts @@ -3,7 +3,7 @@ import { bindDeferredRpcOperation, defineRpcOperation } from './rpc-operation' import { rpcResultVariant } from './rpc-operation-result-reader' import type { RpcClient, SendRequestOptions } from './rpc-client' import type { RpcResponse } from './types' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../src/shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../src/shared/source-control/runtime/source-control-runtime-capabilities' import { GITHUB_EXACT_OPERATION_UNSUPPORTED } from '../../../src/shared/github/work-item-target' export const GITHUB_CONNECTION_CHANGED = 'The Orca server connection changed. Try again.' diff --git a/mobile/src/transport/mobile-relay-rpc-session.test.ts b/mobile/src/transport/mobile-relay-rpc-session.test.ts index 0ea05275c98..708a07af74c 100644 --- a/mobile/src/transport/mobile-relay-rpc-session.test.ts +++ b/mobile/src/transport/mobile-relay-rpc-session.test.ts @@ -521,7 +521,7 @@ describe('mobile relay RPC session', () => { import { withGitHubTargetOperation } from '../tasks/github-work-item-operation' import { githubIssueUpdate } from '../tasks/mobile-task-item-state-operations' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as githubExact } from '../../../src/shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as githubExact } from '../../../src/shared/source-control/runtime/source-control-runtime-capabilities' it('carries captured GitHub authority through the production relay physical await without replay', async () => { vi.clearAllMocks() diff --git a/mobile/src/transport/rpc-client-connect-wait-replay.test.ts b/mobile/src/transport/rpc-client-connect-wait-replay.test.ts index 87efb37530f..f8c2201b028 100644 --- a/mobile/src/transport/rpc-client-connect-wait-replay.test.ts +++ b/mobile/src/transport/rpc-client-connect-wait-replay.test.ts @@ -208,7 +208,7 @@ import { createPageClient } from '../mobile-web-shell/bridge/bridge-page-client- import { createFakeRpcClient } from '../mobile-web-shell/bridge-host-test-fakes' import { withGitHubTargetOperation } from '../tasks/github-work-item-operation' import { githubIssueUpdate } from '../tasks/mobile-task-item-state-operations' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as exactCapability } from '../../../src/shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as exactCapability } from '../../../src/shared/source-control/runtime/source-control-runtime-capabilities' const exactRepo = { owner: 'fork', repo: 'widgets', host: 'github.corp' } function boundUpdate(client: RpcClient) { diff --git a/mobile/src/transport/rpc-refusal-message.test.ts b/mobile/src/transport/rpc-refusal-message.test.ts index f8d6f7ca4a0..cd1d1c0d9cc 100644 --- a/mobile/src/transport/rpc-refusal-message.test.ts +++ b/mobile/src/transport/rpc-refusal-message.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { summarizeCommitFailure } from '../../../src/shared/source-control-commit-failure' +import { summarizeCommitFailure } from '../../../src/shared/source-control/recovery/source-control-commit-failure' import { hostReplyErrorTextOrFallback, refusedRpcMessageOrFallback } from './rpc-refusal-message' describe('refusedRpcMessageOrFallback', () => { diff --git a/mobile/src/transport/settings-read-operations.ts b/mobile/src/transport/settings-read-operations.ts index 004020a7b41..73e4a8e9461 100644 --- a/mobile/src/transport/settings-read-operations.ts +++ b/mobile/src/transport/settings-read-operations.ts @@ -1,6 +1,6 @@ import { bindDeferredRpcOperation, defineRpcOperation } from './rpc-operation' import type { RpcCompatibleReader } from './rpc-operation-contract' -import { normalizeSourceControlGroupOrder } from '../../../src/shared/source-control-group-order' +import { normalizeSourceControlGroupOrder } from '../../../src/shared/source-control/listing/source-control-group-order' import type { SourceControlGroupOrder } from '../../../src/shared/ui-chrome-types' function settingsMember(raw: unknown): unknown { diff --git a/mobile/src/worktree/workspace-details-model.ts b/mobile/src/worktree/workspace-details-model.ts index 3ffd801dd00..86a80d4ad33 100644 --- a/mobile/src/worktree/workspace-details-model.ts +++ b/mobile/src/worktree/workspace-details-model.ts @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../../../src/shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../src/shared/source-control/checks/provider-check-summary' import type { CheckStatus } from '../../../src/shared/github/pull-request-types' import { getWorkspaceAttachmentKey, diff --git a/src/cli/handlers/file.ts b/src/cli/handlers/file.ts index a7f67af1d11..e643b577ba2 100644 --- a/src/cli/handlers/file.ts +++ b/src/cli/handlers/file.ts @@ -1,5 +1,5 @@ import { getFileOpenPosition } from './file-open-position' -import type { GitStatusEntry, GitStatusResult } from '../../shared/git-status-types' +import type { GitStatusEntry, GitStatusResult } from '../../shared/git/status/git-status-types' import type { RuntimeFileOpenResult, RuntimeWorktreeRecord } from '../../shared/runtime-types' import type { RuntimeNavigationTarget } from '../../shared/runtime-navigation' import { isRuntimePathAbsolute, relativePathInsideRoot } from '../../shared/cross-platform-path' diff --git a/src/cli/index-worktree-gitlab-links.test.ts b/src/cli/index-worktree-gitlab-links.test.ts index c989d18cab1..09dfb1d2468 100644 --- a/src/cli/index-worktree-gitlab-links.test.ts +++ b/src/cli/index-worktree-gitlab-links.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import { deriveGitRemoteIdentity } from '../shared/git-remote-identity' +import { deriveGitRemoteIdentity } from '../shared/git/remotes/git-remote-identity' import type { Repo } from '../shared/repo-types' const { diff --git a/src/main/agent-hooks/first-work-branch-rename.ts b/src/main/agent-hooks/first-work-branch-rename.ts index d1051b26946..d3f41ef72c7 100644 --- a/src/main/agent-hooks/first-work-branch-rename.ts +++ b/src/main/agent-hooks/first-work-branch-rename.ts @@ -8,8 +8,8 @@ import { humanizeBranchSlug, isAutoGeneratedCreatureBranchName, stripConfiguredBranchPrefix -} from '../../shared/branch-name-from-work' -import { getCommitMessageModelDiscoveryHostKey } from '../../shared/commit-message-host-key' +} from '../../shared/source-control/ai/naming/branch-name-from-work' +import { getCommitMessageModelDiscoveryHostKey } from '../../shared/source-control/ai/generation/commit-message-host-key' import { computeBranchName, getConfiguredBranchPrefix } from '../ipc/worktree-branch-name' import { gitExecFileAsync } from '../git/runner' import { resolveLocalGitUsername } from '../git/git-username' diff --git a/src/main/agent-hooks/first-work-workspace-title-rename.ts b/src/main/agent-hooks/first-work-workspace-title-rename.ts index 3ed0609e0dc..d075d39c219 100644 --- a/src/main/agent-hooks/first-work-workspace-title-rename.ts +++ b/src/main/agent-hooks/first-work-workspace-title-rename.ts @@ -1,4 +1,4 @@ -import { humanizeBranchSlug } from '../../shared/branch-name-from-work' +import { humanizeBranchSlug } from '../../shared/source-control/ai/naming/branch-name-from-work' import { generateBranchNameFromContext, resolveTextGenerationParams diff --git a/src/main/ai-vault/conversation-name-request-sessions.ts b/src/main/ai-vault/conversation-name-request-sessions.ts index e746175b42f..0123a3b0e35 100644 --- a/src/main/ai-vault/conversation-name-request-sessions.ts +++ b/src/main/ai-vault/conversation-name-request-sessions.ts @@ -1,5 +1,5 @@ import type { AiVaultSession } from '../../shared/ai-vault-types' -import { CONVERSATION_NAME_PROMPT_OPENING } from '../../shared/conversation-name-generation' +import { CONVERSATION_NAME_PROMPT_OPENING } from '../../shared/source-control/ai/generation/conversation-name-generation' const MAX_NAME_REQUEST_MESSAGES = 6 diff --git a/src/main/ai-vault/session-scanner-conversation-name-requests.test.ts b/src/main/ai-vault/session-scanner-conversation-name-requests.test.ts index 2a3bc82095f..f666a166800 100644 --- a/src/main/ai-vault/session-scanner-conversation-name-requests.test.ts +++ b/src/main/ai-vault/session-scanner-conversation-name-requests.test.ts @@ -2,7 +2,7 @@ import { mkdtemp, rm } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { buildConversationNamePrompt } from '../../shared/conversation-name-generation' +import { buildConversationNamePrompt } from '../../shared/source-control/ai/generation/conversation-name-generation' import { scanAiVaultSessions } from './session-scanner' import { isolatedScanRoots, writeJsonlFile } from './session-scanner-test-fixtures' diff --git a/src/main/azure-devops/pull-request-creation.ts b/src/main/azure-devops/pull-request-creation.ts index 873586fd70a..75d02c5367b 100644 --- a/src/main/azure-devops/pull-request-creation.ts +++ b/src/main/azure-devops/pull-request-creation.ts @@ -1,11 +1,14 @@ import type { ExecutionHostId } from '../../shared/execution-host' import { hostedReviewSshConnectionId } from '../source-control/hosted-review-execution-host' import { Buffer } from 'node:buffer' -import type { CreateHostedReviewInput, CreateHostedReviewResult } from '../../shared/hosted-review' +import type { + CreateHostedReviewInput, + CreateHostedReviewResult +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { normalizeHostedReviewBaseRef, normalizeHostedReviewHeadRef -} from '../../shared/hosted-review-refs' +} from '../../shared/source-control/hosted-review/hosted-review-refs' import { HostedReviewApiRequestError, requestHostedReviewJson diff --git a/src/main/azure-devops/pull-request-mappers.ts b/src/main/azure-devops/pull-request-mappers.ts index cd6236e3881..4ba68fce2e2 100644 --- a/src/main/azure-devops/pull-request-mappers.ts +++ b/src/main/azure-devops/pull-request-mappers.ts @@ -1,4 +1,4 @@ -import { summarizeProviderChecks } from '../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../shared/source-control/checks/provider-check-summary' import type { CheckStatus, PRMergeableState, diff --git a/src/main/bitbucket/pull-request-creation.ts b/src/main/bitbucket/pull-request-creation.ts index 0d319e132aa..10c0f3fbee8 100644 --- a/src/main/bitbucket/pull-request-creation.ts +++ b/src/main/bitbucket/pull-request-creation.ts @@ -1,10 +1,13 @@ import type { ExecutionHostId } from '../../shared/execution-host' import { hostedReviewSshConnectionId } from '../source-control/hosted-review-execution-host' -import type { CreateHostedReviewInput, CreateHostedReviewResult } from '../../shared/hosted-review' +import type { + CreateHostedReviewInput, + CreateHostedReviewResult +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { normalizeHostedReviewBaseRef, normalizeHostedReviewHeadRef -} from '../../shared/hosted-review-refs' +} from '../../shared/source-control/hosted-review/hosted-review-refs' import { HostedReviewApiRequestError, requestHostedReviewJson diff --git a/src/main/bitbucket/pull-request-mappers.ts b/src/main/bitbucket/pull-request-mappers.ts index 7f3df151e64..bed469a3adb 100644 --- a/src/main/bitbucket/pull-request-mappers.ts +++ b/src/main/bitbucket/pull-request-mappers.ts @@ -1,4 +1,4 @@ -import { summarizeProviderChecks } from '../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../shared/source-control/checks/provider-check-summary' import type { CheckStatus, PRMergeableState, diff --git a/src/main/bitbucket/repository-ref.ts b/src/main/bitbucket/repository-ref.ts index 48f0949afca..2c466ee2cba 100644 --- a/src/main/bitbucket/repository-ref.ts +++ b/src/main/bitbucket/repository-ref.ts @@ -1,4 +1,4 @@ -import { normalizeBitbucketRemoteHost } from '../../shared/git-remote-host-alias' +import { normalizeBitbucketRemoteHost } from '../../shared/git/remotes/git-remote-host-alias' import { createRemoteRefProbeCache } from '../git/remotes/remote-ref-probe-cache' export type BitbucketRepoRef = { diff --git a/src/main/connector-cloud/connector-places.ts b/src/main/connector-cloud/connector-places.ts index 7d8dc7391a4..b56f8403965 100644 --- a/src/main/connector-cloud/connector-places.ts +++ b/src/main/connector-cloud/connector-places.ts @@ -11,7 +11,7 @@ import { parseExecutionHostId, type ExecutionHostId } from '../../shared/execution-host' -import { splitGitRemoteKey } from '../../shared/git-remote-identity' +import { splitGitRemoteKey } from '../../shared/git/remotes/git-remote-identity' import { getRepoIdFromWorktreeId } from '../../shared/worktree/id' import { isFolderRepo } from '../../shared/repo-kind' import type { AgentLaunchParams } from '../../shared/rpc-contract/agent-launch-params' diff --git a/src/main/daemon/pty-subprocess/spawn-environment.ts b/src/main/daemon/pty-subprocess/spawn-environment.ts index 0f69d623e71..12c176e2f02 100644 --- a/src/main/daemon/pty-subprocess/spawn-environment.ts +++ b/src/main/daemon/pty-subprocess/spawn-environment.ts @@ -15,7 +15,7 @@ import { dropInheritedOrcaHistFile } from '../../pty/history/worktree-history-fi import { gitCredentialPromptGuardEnv, mergeGitConfigEnvProtocol -} from '../../../shared/git-credential-prompt-env' +} from '../../../shared/git/commands/git-credential-prompt-env' import { TERMINAL_GIT_CREDENTIAL_GUARD_POLICY_ENV } from '../../../shared/terminal-git-credential-guard' import { ORCA_IMAGE_PROTOCOL_ENV, diff --git a/src/main/git/branch-rename.ts b/src/main/git/branch-rename.ts index 2f8e758890c..df71af04315 100644 --- a/src/main/git/branch-rename.ts +++ b/src/main/git/branch-rename.ts @@ -1,8 +1,11 @@ -import { isNoUpstreamError, stripCredentialsFromMessage } from '../../shared/git-remote-error' +import { + isNoUpstreamError, + stripCredentialsFromMessage +} from '../../shared/git/remotes/git-remote-error' import { resolveEffectiveGitUpstream, type GitCommandRunner -} from '../../shared/git-effective-upstream' +} from '../../shared/git/remotes/git-effective-upstream' export type GitExec = GitCommandRunner diff --git a/src/main/git/command-runner/git-admission-storm-measurement.test.ts b/src/main/git/command-runner/git-admission-storm-measurement.test.ts index 34968460245..1d1353e195a 100644 --- a/src/main/git/command-runner/git-admission-storm-measurement.test.ts +++ b/src/main/git/command-runner/git-admission-storm-measurement.test.ts @@ -7,10 +7,12 @@ import { gitExecFileAsync } from './git-exec-file' import { GENERAL_CAP, GENERAL_HEADROOM, - GitAdmissionScheduler, - _gitAdmissionSnapshotForTests, - _resetGitAdmissionForTests, type GitAdmissionEvent +} from '../../../shared/git/admission/git-admission-state' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' +import { + _gitAdmissionSnapshotForTests, + _resetGitAdmissionForTests } from './git-subprocess-admission' import { assertAdmissionLedger, diff --git a/src/main/git/command-runner/git-admission-storm-test-fixture.ts b/src/main/git/command-runner/git-admission-storm-test-fixture.ts index bdf3f58b4ad..b2329a0a7c3 100644 --- a/src/main/git/command-runner/git-admission-storm-test-fixture.ts +++ b/src/main/git/command-runner/git-admission-storm-test-fixture.ts @@ -6,11 +6,13 @@ import { afterEach, expect } from 'vitest' import { gitExecFileAsync } from './git-exec-file' import { GIT_ADMISSION_AGING_MS, - GitAdmissionScheduler, MAX_GIT_CHILDREN, - _gitAdmissionSnapshotForTests, - _resetGitAdmissionForTests, type GitAdmissionEvent +} from '../../../shared/git/admission/git-admission-state' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' +import { + _gitAdmissionSnapshotForTests, + _resetGitAdmissionForTests } from './git-subprocess-admission' type StormMeasurement = { diff --git a/src/main/git/command-runner/git-capability-state.ts b/src/main/git/command-runner/git-capability-state.ts index b0375f59691..f1c5c051d91 100644 --- a/src/main/git/command-runner/git-capability-state.ts +++ b/src/main/git/command-runner/git-capability-state.ts @@ -1,4 +1,4 @@ -import { GitCapabilityCache } from '../../../shared/git-capability-cache' +import { GitCapabilityCache } from '../../../shared/git/commands/git-capability-cache' import { parseWslUncPath } from '../../../shared/wsl-paths' import { isWslLinkedWorktreeGitRoutingCandidate, diff --git a/src/main/git/command-runner/git-command-resolution.ts b/src/main/git/command-runner/git-command-resolution.ts index 9f33dcf6cad..bc80c83a8c8 100644 --- a/src/main/git/command-runner/git-command-resolution.ts +++ b/src/main/git/command-runner/git-command-resolution.ts @@ -2,7 +2,7 @@ import { wslDistroForCommand } from '../../../shared/wsl-paths' export { wslDistroForCommand } from '../../../shared/wsl-paths' import { waitForPromiseWithSignal } from '../../../shared/abort-signal-reason' import { withTimeout } from '../../../shared/promise-timeout-fallback' -import { isWslDirectGitReadCommand } from '../wsl-direct-git-read-commands' +import { isWslDirectGitReadCommand } from '../../../shared/git/commands/git-command-classification' import { disableWslGitReadEnvironment, getWslGitReadEnvironment, diff --git a/src/main/git/command-runner/git-command-timeout-behavior.test.ts b/src/main/git/command-runner/git-command-timeout-behavior.test.ts index f20d9b6aaa8..8f3b058dc9d 100644 --- a/src/main/git/command-runner/git-command-timeout-behavior.test.ts +++ b/src/main/git/command-runner/git-command-timeout-behavior.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import path from 'node:path' import { afterEach, describe, expect, it } from 'vitest' import { gitExecFileAsync, gitExecFileAsyncBuffer } from './git-exec-file' -import { GitCommandTimeoutError } from './git-command-timeout' +import { GitCommandTimeoutError } from '../../../shared/git/commands/git-command-timeout' import { gitStreamStdout } from './git-stream-stdout' const tempRoots: string[] = [] diff --git a/src/main/git/command-runner/git-command-timeout.test.ts b/src/main/git/command-runner/git-command-timeout.test.ts index 59ac198530a..fc082deaf4f 100644 --- a/src/main/git/command-runner/git-command-timeout.test.ts +++ b/src/main/git/command-runner/git-command-timeout.test.ts @@ -1,5 +1,8 @@ import { describe, expect, it } from 'vitest' -import { GitCommandTimeoutError, gitCommandTimeoutMs } from './git-command-timeout' +import { + GitCommandTimeoutError, + gitCommandTimeoutMs +} from '../../../shared/git/commands/git-command-timeout' describe('gitCommandTimeoutMs', () => { it.each([ diff --git a/src/main/git/command-runner/git-command-timeout.ts b/src/main/git/command-runner/git-command-timeout.ts deleted file mode 100644 index 0a3c8db48f1..00000000000 --- a/src/main/git/command-runner/git-command-timeout.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../shared/git-command-timeout' diff --git a/src/main/git/command-runner/git-exec-admission-exempt.test.ts b/src/main/git/command-runner/git-exec-admission-exempt.test.ts index 5bbd04cf447..7e4f6ac33f2 100644 --- a/src/main/git/command-runner/git-exec-admission-exempt.test.ts +++ b/src/main/git/command-runner/git-exec-admission-exempt.test.ts @@ -10,8 +10,8 @@ vi.mock('node:child_process', async (importOriginal) => ({ })) import { gitExecFileAsync } from './git-exec-file' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' import { - GitAdmissionScheduler, _gitAdmissionSnapshotForTests, _resetGitAdmissionForTests } from './git-subprocess-admission' diff --git a/src/main/git/command-runner/git-exec-admission-lifetime.test.ts b/src/main/git/command-runner/git-exec-admission-lifetime.test.ts index 7b95ac99367..910a224db01 100644 --- a/src/main/git/command-runner/git-exec-admission-lifetime.test.ts +++ b/src/main/git/command-runner/git-exec-admission-lifetime.test.ts @@ -1,7 +1,7 @@ import type { ChildProcess } from 'node:child_process' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { createFakeSpawnedChild } from '../../../shared/__fixtures__/fake-spawned-child' -import type * as GitFetchHeadLockModule from '../../../shared/git-fetch-head-lock' +import type * as GitFetchHeadLockModule from '../../../shared/git/fetch/git-fetch-head-lock' const { execFileMock, @@ -30,9 +30,10 @@ vi.mock('@orca/process-host/process-tree-termination', () => ({ forceTerminateProcessTree: forceTerminateProcessTreeMock })) // Mock only filesystem key derivation so libuv completion order cannot reorder the real FIFO lock. -vi.mock('../../../shared/git-fetch-head-lock', async (importOriginal) => { +vi.mock('../../../shared/git/fetch/git-fetch-head-lock', async (importOriginal) => { const actual = await importOriginal() - const { runWithGitOperationLock } = await import('../../../shared/git-operation-lock') + const { runWithGitOperationLock } = + await import('../../../shared/git/commands/git-operation-lock') return { ...actual, runWithGitFetchHeadLock: ( @@ -49,10 +50,10 @@ import { execFileCapture } from './exec-file-capture' import { isGitWorktreeMutationInFlight } from './git-worktree-mutation-state' import { acquireGitAdmission, - GitAdmissionScheduler, _gitAdmissionSnapshotForTests, _resetGitAdmissionForTests } from './git-subprocess-admission' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' type ExecCallback = (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void diff --git a/src/main/git/command-runner/git-exec-file.ts b/src/main/git/command-runner/git-exec-file.ts index 8c1f00902cf..4111674acc3 100644 --- a/src/main/git/command-runner/git-exec-file.ts +++ b/src/main/git/command-runner/git-exec-file.ts @@ -2,7 +2,7 @@ import { withGitSpan } from '../../observability/instrumentation' import { resolveGitFetchHeadCommand, runWithGitFetchHeadLock -} from '../../../shared/git-fetch-head-lock' +} from '../../../shared/git/fetch/git-fetch-head-lock' import { pendingWslDriveCheckoutGitRouting } from '../wsl-drive-checkout-git-routing' import type { ResolvedCommand } from './wsl-command-resolution' import { annotateWslHostFailure, isTransientWslFailure } from './wsl-host-failure' @@ -20,8 +20,11 @@ import { prepareWindowsHostGitEnvironment } from './windows-host-git-environment import { buildNetworkSshPolicyEnv } from './git-ssh-policy-env' import { nonInteractiveGitEnv, untranslatedGitOutputEnv } from './git-process-env' import { acquireGitAdmission } from './git-subprocess-admission' -import { GitCommandTimeoutError, gitCommandTimeoutMs } from './git-command-timeout' -import { classifyGitCommand } from '../../../shared/git-command-classification' +import { + GitCommandTimeoutError, + gitCommandTimeoutMs +} from '../../../shared/git/commands/git-command-timeout' +import { classifyGitCommand } from '../../../shared/git/commands/git-command-classification' import { createAbortError } from './abort-error' import { readCapturedGitBuffer, readCapturedGitString } from './captured-git-output' import { runUnlessGitCwdKnownMissing } from './missing-git-spawn-cwd' diff --git a/src/main/git/command-runner/git-operation-executor.test.ts b/src/main/git/command-runner/git-operation-executor.test.ts index 68b68d95211..5cb77e999bb 100644 --- a/src/main/git/command-runner/git-operation-executor.test.ts +++ b/src/main/git/command-runner/git-operation-executor.test.ts @@ -2,10 +2,10 @@ import { afterEach, describe, expect, it } from 'vitest' import { resolveGitAdmissionTier } from './git-operation-executor' import { acquireGitAdmission, - GitAdmissionScheduler, _resetGitAdmissionForTests, _gitAdmissionSnapshotForTests } from './git-subprocess-admission' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' import { worktreeCreateGit, worktreePreparationGit diff --git a/src/main/git/command-runner/git-process-env.ts b/src/main/git/command-runner/git-process-env.ts index 1cd361783a1..963feb21943 100644 --- a/src/main/git/command-runner/git-process-env.ts +++ b/src/main/git/command-runner/git-process-env.ts @@ -1,9 +1,6 @@ import { addWslEnvKeys } from '../../../shared/wsl-env' -import { - appendGitConfigEnv, - gitCredentialPromptGuardEnv -} from '../../../shared/git-credential-prompt-env' -import { UNTRANSLATED_GIT_OUTPUT_ENV } from '../../../shared/git-output-locale' +import { gitCredentialPromptGuardEnv } from '../../../shared/git/commands/git-credential-prompt-env' +import { UNTRANSLATED_GIT_OUTPUT_ENV } from '../../../shared/git/commands/git-output-locale' export function gitOptionalLocksDisabledEnv( env: NodeJS.ProcessEnv = process.env @@ -15,7 +12,6 @@ export function gitOptionalLocksDisabledEnv( } /** Append Git >= 2.31 config-env entries without overwriting the caller's existing entries. */ -export { appendGitConfigEnv } /** Pin Git diagnostics to English so parsers work under any user locale. */ export function untranslatedGitOutputEnv(env: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv { diff --git a/src/main/git/command-runner/git-spawn-admission-lifetime.test.ts b/src/main/git/command-runner/git-spawn-admission-lifetime.test.ts index 33f821b2316..241681d787f 100644 --- a/src/main/git/command-runner/git-spawn-admission-lifetime.test.ts +++ b/src/main/git/command-runner/git-spawn-admission-lifetime.test.ts @@ -2,8 +2,8 @@ import { EventEmitter } from 'node:events' import type { ChildProcess } from 'node:child_process' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { withGitAdmission } from './git-spawn' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' import { - GitAdmissionScheduler, _gitAdmissionSnapshotForTests, _resetGitAdmissionForTests } from './git-subprocess-admission' diff --git a/src/main/git/command-runner/git-spawn.ts b/src/main/git/command-runner/git-spawn.ts index 775f4b46aab..56d8243f2ff 100644 --- a/src/main/git/command-runner/git-spawn.ts +++ b/src/main/git/command-runner/git-spawn.ts @@ -8,7 +8,7 @@ import { untranslatedGitOutputEnv } from './git-process-env' import { prepareWindowsHostGitEnvironment } from './windows-host-git-environment' import type { GitAdmissionTier } from './git-exec-options' import { acquireGitAdmission } from './git-subprocess-admission' -import { classifyGitCommand } from '../../../shared/git-command-classification' +import { classifyGitCommand } from '../../../shared/git/commands/git-command-classification' import { buildNetworkSshPolicyEnv } from './git-ssh-policy-env' import { admitWslGit, diff --git a/src/main/git/command-runner/git-ssh-policy-env.ts b/src/main/git/command-runner/git-ssh-policy-env.ts index dfdcd035483..39ed3b29d19 100644 --- a/src/main/git/command-runner/git-ssh-policy-env.ts +++ b/src/main/git/command-runner/git-ssh-policy-env.ts @@ -4,16 +4,14 @@ import { GIT_SSH_CONFIG_ARGS, parseGitSshConfig, type GitSshPolicyMode -} from '../../../shared/git-ssh-policy-env' -import { findGitSubcommandIndex } from '../../../shared/git-command-classification' +} from '../../../shared/git/commands/git-ssh-policy-env' +import { findGitSubcommandIndex } from '../../../shared/git/commands/git-command-classification' import { execFileCapture } from './exec-file-capture' import { resolveGitCommand } from './git-command-resolution' import { DEFAULT_GIT_MAX_BUFFER, type GitExecOptions } from './git-exec-options' import { promptGuardGitEnv } from './git-process-env' import { acquireGitAdmission } from './git-subprocess-admission' -export type { GitSshPolicyMode } from '../../../shared/git-ssh-policy-env' - const CORE_SSH_COMMAND_PROBE_TIMEOUT_MS = 2500 // Cold WSL starts and login rc files need the environment probe's startup budget. const WSL_CORE_SSH_COMMAND_PROBE_TIMEOUT_MS = 10_000 diff --git a/src/main/git/command-runner/git-stream-admission-lifetime.test.ts b/src/main/git/command-runner/git-stream-admission-lifetime.test.ts index ea1b4636721..194944bbb01 100644 --- a/src/main/git/command-runner/git-stream-admission-lifetime.test.ts +++ b/src/main/git/command-runner/git-stream-admission-lifetime.test.ts @@ -15,10 +15,10 @@ vi.mock('./spawned-command-tree-kill', () => ({ import { gitStreamStdout } from './git-stream-stdout' import { acquireGitAdmission, - GitAdmissionScheduler, _gitAdmissionSnapshotForTests, _resetGitAdmissionForTests } from './git-subprocess-admission' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' function mockChild(): ChildProcess { const child = new EventEmitter() as EventEmitter & Record diff --git a/src/main/git/command-runner/git-stream-stdout.ts b/src/main/git/command-runner/git-stream-stdout.ts index 2bd8f482e17..9b7fec7187e 100644 --- a/src/main/git/command-runner/git-stream-stdout.ts +++ b/src/main/git/command-runner/git-stream-stdout.ts @@ -23,7 +23,10 @@ import { prepareWindowsHostGitEnvironment } from './windows-host-git-environment import { nonInteractiveGitEnv, untranslatedGitOutputEnv } from './git-process-env' import { gitSpawn } from './git-spawn' import { acquireGitAdmission } from './git-subprocess-admission' -import { GitCommandTimeoutError, gitCommandTimeoutMs } from './git-command-timeout' +import { + GitCommandTimeoutError, + gitCommandTimeoutMs +} from '../../../shared/git/commands/git-command-timeout' import { routeLocalGitOptions, runAdmittedWslGit } from './local-git-runtime-route' import { gitRunsIn } from './git-runs-in' diff --git a/src/main/git/command-runner/git-subprocess-admission.test.ts b/src/main/git/command-runner/git-subprocess-admission.test.ts index 537458a07dd..0a6acac4fb4 100644 --- a/src/main/git/command-runner/git-subprocess-admission.test.ts +++ b/src/main/git/command-runner/git-subprocess-admission.test.ts @@ -1,12 +1,12 @@ import { afterEach, describe, expect, it } from 'vitest' +import { GENERAL_CAP } from '../../../shared/git/admission/git-admission-state' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' import { - GENERAL_CAP, - GitAdmissionScheduler, _gitAdmissionSnapshotForTests, _resetGitAdmissionForTests, acquireGitAdmission } from './git-subprocess-admission' -import type { GitAdmissionEvent } from '../../../shared/git-admission-state' +import type { GitAdmissionEvent } from '../../../shared/git/admission/git-admission-state' const local = (tier: 'interactive' | 'status' | 'background' = 'status') => ({ args: ['status'], diff --git a/src/main/git/command-runner/git-subprocess-admission.ts b/src/main/git/command-runner/git-subprocess-admission.ts index 13bdf04cf07..24bfd71967d 100644 --- a/src/main/git/command-runner/git-subprocess-admission.ts +++ b/src/main/git/command-runner/git-subprocess-admission.ts @@ -1,10 +1,9 @@ -import { - GitAdmissionScheduler, - type GitAdmissionGrant, - type GitAdmissionRequest -} from '../../../shared/git-admission-scheduler' +import { GitAdmissionScheduler } from '../../../shared/git/admission/git-admission-scheduler' +import type { + GitAdmissionGrant, + GitAdmissionRequest +} from '../../../shared/git/admission/git-admission-state' import { resolveGitAdmissionTier } from './git-operation-executor' -export * from '../../../shared/git-admission-scheduler' let scheduler = new GitAdmissionScheduler() diff --git a/src/main/git/command-runner/git-worktree-mutation-state.ts b/src/main/git/command-runner/git-worktree-mutation-state.ts index db3adb95e44..a8619a87387 100644 --- a/src/main/git/command-runner/git-worktree-mutation-state.ts +++ b/src/main/git/command-runner/git-worktree-mutation-state.ts @@ -3,10 +3,10 @@ import { resolve } from 'node:path' import { classifyGitCommand, findGitSubcommandIndex -} from '../../../shared/git-command-classification' +} from '../../../shared/git/commands/git-command-classification' import { normalizeRuntimePathForComparison } from '../../../shared/cross-platform-path' -import { resolveWorktreeHostPath } from '../../../shared/git-metadata-path' -import { resolveGitFetchHeadCommand } from '../../../shared/git-fetch-head-lock' +import { resolveWorktreeHostPath } from '../../../shared/git/metadata/git-metadata-path' +import { resolveGitFetchHeadCommand } from '../../../shared/git/fetch/git-fetch-head-lock' import { resolveGitDir } from '../source-control/resolve-git-dir' import type { GitRuntimeOptions } from '../git-runtime-options' diff --git a/src/main/git/command-runner/wsl-command-resolution.ts b/src/main/git/command-runner/wsl-command-resolution.ts index 16d55f8d68f..d7a1e8a5b3b 100644 --- a/src/main/git/command-runner/wsl-command-resolution.ts +++ b/src/main/git/command-runner/wsl-command-resolution.ts @@ -9,7 +9,7 @@ import { type WslCapturedLoginShellCommand } from '../../../shared/wsl-login-shell-command' import { quotePosixShell } from '../../../shared/shell-argument-quoting' -import { UNTRANSLATED_GIT_OUTPUT_ENV } from '../../../shared/git-output-locale' +import { UNTRANSLATED_GIT_OUTPUT_ENV } from '../../../shared/git/commands/git-output-locale' import type { WslGitReadEnvironment } from '../wsl-git-read-environment' import { createWslProcessGroupTermination, diff --git a/src/main/git/exact-ref-probe.ts b/src/main/git/exact-ref-probe.ts index cf18d9d1370..9a7a8a5eda8 100644 --- a/src/main/git/exact-ref-probe.ts +++ b/src/main/git/exact-ref-probe.ts @@ -1,7 +1,5 @@ -import { isSafeGitRefName } from '../../shared/git-status-upstream-ref' -import { isShowRefNoMatchError } from '../../shared/git-show-ref-no-match' - -export { isShowRefNoMatchError } +import { isSafeGitRefName } from '../../shared/git/status/git-status-upstream-ref' +import { isShowRefNoMatchError } from '../../shared/git/refs/git-show-ref-no-match' export type ExactRefProbeExecOptions = { maxBuffer?: number diff --git a/src/main/git/fetch-error-classification.test.ts b/src/main/git/fetch-error-classification.test.ts index ef197335d48..583d212f3b5 100644 --- a/src/main/git/fetch-error-classification.test.ts +++ b/src/main/git/fetch-error-classification.test.ts @@ -1,8 +1,6 @@ import { describe, expect, it } from 'vitest' -import { - isMissingRemoteRefGitError, - isTransientReviewHeadFetchError -} from './fetch-error-classification' +import { isMissingRemoteRefGitError } from '../../shared/git/refs/git-missing-remote-ref' +import { isTransientReviewHeadFetchError } from './fetch-error-classification' describe('isMissingRemoteRefGitError', () => { it('does not match auth or network failures', () => { diff --git a/src/main/git/fetch-error-classification.ts b/src/main/git/fetch-error-classification.ts index 21350a5faf8..f7280a3a47c 100644 --- a/src/main/git/fetch-error-classification.ts +++ b/src/main/git/fetch-error-classification.ts @@ -1,7 +1,6 @@ -import { isExecKilledError } from '../../shared/git-remote-error' +import { isExecKilledError } from '../../shared/git/remotes/git-remote-error' -import { isMissingRemoteRefGitError } from '../../shared/git-missing-remote-ref' -export { isMissingRemoteRefGitError } from '../../shared/git-missing-remote-ref' +import { isMissingRemoteRefGitError } from '../../shared/git/refs/git-missing-remote-ref' // Keep durable review heads only after transport failures; auth, deleted refs, and stale RPC failures must surface. const TRANSIENT_FETCH_ERROR_PATTERNS = [ diff --git a/src/main/git/fork-sync.ts b/src/main/git/fork-sync.ts index f14a6c66c27..217d5660d74 100644 --- a/src/main/git/fork-sync.ts +++ b/src/main/git/fork-sync.ts @@ -1,9 +1,9 @@ -import { normalizeGitErrorMessage } from '../../shared/git-remote-error' +import { normalizeGitErrorMessage } from '../../shared/git/remotes/git-remote-error' import { syncForkDefaultBranch, type GitForkSyncExpectedUpstream, type GitForkSyncResult -} from '../../shared/git-fork-sync' +} from '../../shared/git/remotes/git-fork-sync' import type { GitRuntimeOptions } from './git-runtime-options' import { gitOptionsForWorktree } from './git-runtime-options' import { gitExecFileAsync } from './runner' diff --git a/src/main/git/git-username.ts b/src/main/git/git-username.ts index ead682403d5..2fac8bb4b59 100644 --- a/src/main/git/git-username.ts +++ b/src/main/git/git-username.ts @@ -1,7 +1,7 @@ import { extractExecError, ghExecFileAsync, gitExecFileAsync } from './runner' import { parseHostedRemote } from './remotes/hosted-remote-url' -import { resolveDefaultBaseRefViaExec } from './repo' -import { createGitConfigSnapshotRunner } from '../../shared/git-config-snapshot-runner' +import { resolveDefaultBaseRefViaExec } from '../../shared/git/refs/git-default-base-ref' +import { createGitConfigSnapshotRunner } from '../../shared/git/commands/git-config-snapshot-runner' type GitUsernameRunner = ReturnType diff --git a/src/main/git/history.ts b/src/main/git/history.ts index 59260697fd4..932c33ef83c 100644 --- a/src/main/git/history.ts +++ b/src/main/git/history.ts @@ -1,5 +1,8 @@ -import type { GitHistoryOptions, GitHistoryResult } from '../../shared/git-history' -import { loadGitHistoryFromExecutor } from '../../shared/git-history' +import type { + GitHistoryOptions, + GitHistoryResult +} from '../../shared/git/history/git-history-types' +import { loadGitHistoryFromExecutor } from '../../shared/git/history/git-history-execution' import type { GitRuntimeOptions } from './git-runtime-options' import { gitOptionsForWorktree } from './git-runtime-options' import { gitExecFileAsync } from './runner' diff --git a/src/main/git/local-git-object-quarantine.test.ts b/src/main/git/local-git-object-quarantine.test.ts index 34f4eaa2bcf..bf0e404a46d 100644 --- a/src/main/git/local-git-object-quarantine.test.ts +++ b/src/main/git/local-git-object-quarantine.test.ts @@ -1,6 +1,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type * as GitObjectQuarantineModule from '../../shared/git-object-quarantine' -import type { GitObjectQuarantine, GitObjectsDirectory } from '../../shared/git-object-quarantine' +import type * as GitObjectQuarantineModule from '../../shared/git/objects/git-object-quarantine' +import type { + GitObjectQuarantine, + GitObjectsDirectory +} from '../../shared/git/objects/git-object-quarantine' import { createLocalGitObjectQuarantine, inheritedLocalObjectStore, @@ -18,7 +21,7 @@ const { readRepoCommonDirFromGitMock } = vi.hoisted(() => ({ vi.mock('./worktrees/catalog/worktree-list-reader', () => ({ readRepoCommonDirFromGit: readRepoCommonDirFromGitMock })) -vi.mock('../../shared/git-object-quarantine', async (importOriginal) => ({ +vi.mock('../../shared/git/objects/git-object-quarantine', async (importOriginal) => ({ ...(await importOriginal()), createGitObjectQuarantine: ( resolve: () => Promise diff --git a/src/main/git/local-git-object-quarantine.ts b/src/main/git/local-git-object-quarantine.ts index 7fb17f97a1a..4ae45d56106 100644 --- a/src/main/git/local-git-object-quarantine.ts +++ b/src/main/git/local-git-object-quarantine.ts @@ -5,7 +5,7 @@ import { inheritedObjectStore, pathApiForGitPath, type GitObjectsDirectory -} from '../../shared/git-object-quarantine' +} from '../../shared/git/objects/git-object-quarantine' import { toLinuxPath, toWindowsWslPath } from '../../shared/wsl-paths' import { parseWslPath } from '../wsl/filesystem/unc-path-access' import { usesHostGitForWslLinkedWorktree } from './command-runner/wsl-linked-worktree-git-routing' diff --git a/src/main/git/merge-tree-object-quarantine-real-git.test.ts b/src/main/git/merge-tree-object-quarantine-real-git.test.ts index 6a1b52e9144..27f0bfe62ec 100644 --- a/src/main/git/merge-tree-object-quarantine-real-git.test.ts +++ b/src/main/git/merge-tree-object-quarantine-real-git.test.ts @@ -2,11 +2,11 @@ import { existsSync, readdirSync, writeFileSync } from 'node:fs' import type * as NodeFsPromises from 'node:fs/promises' import { basename, dirname, join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { GIT_OBJECT_QUARANTINE_DIR_PREFIX } from '../../shared/git-object-quarantine' +import { GIT_OBJECT_QUARANTINE_DIR_PREFIX } from '../../shared/git/objects/git-object-quarantine' import { createDivergentRepoFixture, type DivergentRepoFixture -} from '../../shared/git-object-quarantine-real-git.test-fixture' +} from '../../shared/git/objects/git-object-quarantine-real-git.test-fixture' import { __resetPRConflictSummaryCachesForTests, getPRConflictSummary diff --git a/src/main/git/push-target-validation.ts b/src/main/git/push-target-validation.ts index 133b1ee8b2b..0b133ebcb88 100644 --- a/src/main/git/push-target-validation.ts +++ b/src/main/git/push-target-validation.ts @@ -1,5 +1,5 @@ import type { GitPushTarget } from '../../shared/worktree/types' -import { assertValidGitPushTarget } from '../../shared/git-push-target-validation' +import { assertValidGitPushTarget } from '../../shared/git/remotes/git-push-target-validation' import { gitExecFileAsync } from './runner' import type { GitExecOptions as GitCommandExecOptions } from './command-runner/git-exec-options' diff --git a/src/main/git/refs/maintenance/repo-maintenance-admission.test.ts b/src/main/git/refs/maintenance/repo-maintenance-admission.test.ts index 7cb868878db..b365009d9c9 100644 --- a/src/main/git/refs/maintenance/repo-maintenance-admission.test.ts +++ b/src/main/git/refs/maintenance/repo-maintenance-admission.test.ts @@ -52,8 +52,8 @@ import { RepoRefMaintenance } from '../../../../shared/repo-ref-maintenance' import { createLocalRepoRefMaintenanceTarget } from './local-repo-ref-maintenance' import { clearRepoPackIndexMaintenanceCache } from './repo-pack-index-maintenance' import { gitExecFileAsync } from '../../command-runner/git-exec-file' -import { GENERAL_CAP } from '../../../../shared/git-admission-state' -import { GitAdmissionScheduler } from '../../../../shared/git-admission-scheduler' +import { GENERAL_CAP } from '../../../../shared/git/admission/git-admission-state' +import { GitAdmissionScheduler } from '../../../../shared/git/admission/git-admission-scheduler' import { acquireGitAdmission, _gitAdmissionSnapshotForTests, diff --git a/src/main/git/remote-rebase.ts b/src/main/git/remote-rebase.ts index 66a7f624349..88facf2a7a4 100644 --- a/src/main/git/remote-rebase.ts +++ b/src/main/git/remote-rebase.ts @@ -1,11 +1,11 @@ import { randomUUID } from 'node:crypto' -import { normalizeGitErrorMessage } from '../../shared/git-remote-error' -import { isNoWriteFetchHeadUnsupportedError } from '../../shared/git-fetch-head-capability' -import { runWithGitWorktreeOperationLock } from '../../shared/git-worktree-operation-lock' +import { normalizeGitErrorMessage } from '../../shared/git/remotes/git-remote-error' +import { isNoWriteFetchHeadUnsupportedError } from '../../shared/git/fetch/git-fetch-head-capability' +import { runWithGitWorktreeOperationLock } from '../../shared/git/worktrees/git-worktree-operation-lock' import { REBASE_SOURCE_FETCH_TIMEOUT_MS, resolveGitRemoteRebaseSource -} from '../../shared/git-rebase-source' +} from '../../shared/git/remotes/git-rebase-source' import type { GitRuntimeOptions } from './git-runtime-options' import { gitOptionsForWorktree } from './git-runtime-options' import { withLocalGitCapabilityCacheForExecution } from './command-runner/git-capability-state' diff --git a/src/main/git/remote.test.ts b/src/main/git/remote.test.ts index 32a904d7d15..81b04618aca 100644 --- a/src/main/git/remote.test.ts +++ b/src/main/git/remote.test.ts @@ -9,7 +9,7 @@ vi.mock('./command-runner/git-exec-file', async (importOriginal) => ({ gitExecFileAsync: gitExecFileAsyncMock })) -import { REBASE_SOURCE_FETCH_TIMEOUT_MS } from '../../shared/git-rebase-source' +import { REBASE_SOURCE_FETCH_TIMEOUT_MS } from '../../shared/git/remotes/git-rebase-source' import { clearGitCapabilityStateForTests } from './command-runner/git-capability-state' import { gitFastForward, gitFetch, gitPull, gitPullRebaseFromBase, gitPush } from './remote' diff --git a/src/main/git/remote.ts b/src/main/git/remote.ts index 2b82971e0bf..99306df355e 100644 --- a/src/main/git/remote.ts +++ b/src/main/git/remote.ts @@ -1,9 +1,9 @@ import { normalizeGitErrorMessage, runPullWithDivergenceFallback -} from '../../shared/git-remote-error' -import { resolveEffectiveGitUpstream } from '../../shared/git-effective-upstream' -import { resolveConfiguredGitPushTarget } from '../../shared/git-push-target-resolution' +} from '../../shared/git/remotes/git-remote-error' +import { resolveEffectiveGitUpstream } from '../../shared/git/remotes/git-effective-upstream' +import { resolveConfiguredGitPushTarget } from '../../shared/git/remotes/git-push-target-resolution' import type { GitPushTarget } from '../../shared/worktree/types' import type { GitRuntimeOptions } from './git-runtime-options' import { gitOptionsForWorktree } from './git-runtime-options' @@ -15,7 +15,7 @@ import { validateGitPushTarget } from './push-target-validation' import { gitExecFileAsync } from './runner' import { fetchForkRemoteWithStaleRefspecRepair } from './refs/fork-remotes/fork-remote-stale-branch-refspec' import { runWithGitReadCacheInvalidation } from './source-control/git-read-cache-invalidation' -import { runWithGitWorktreeOperationLock } from '../../shared/git-worktree-operation-lock' +import { runWithGitWorktreeOperationLock } from '../../shared/git/worktrees/git-worktree-operation-lock' export { gitPullRebaseFromBase } from './remote-rebase' diff --git a/src/main/git/remotes/hosted-remote-url.ts b/src/main/git/remotes/hosted-remote-url.ts index a708d372b10..9f10984fa05 100644 --- a/src/main/git/remotes/hosted-remote-url.ts +++ b/src/main/git/remotes/hosted-remote-url.ts @@ -1,4 +1,4 @@ -import { normalizeForgeWebHost } from '../../../shared/git-remote-host-alias' +import { normalizeForgeWebHost } from '../../../shared/git/remotes/git-remote-host-alias' // Scoped local fork of the hosted-git-info@9.0.3 behavior Orca used. // Keep only the provider parsing and file/commit URL construction needed by source links. diff --git a/src/main/git/remotes/repo-remote-file-target.ts b/src/main/git/remotes/repo-remote-file-target.ts index 11a75332dfe..54020b0c85a 100644 --- a/src/main/git/remotes/repo-remote-file-target.ts +++ b/src/main/git/remotes/repo-remote-file-target.ts @@ -1,8 +1,8 @@ import { parseHostedRemote } from './hosted-remote-url' -import { parseGitRemoteFetchUrls } from '../../../shared/git-remote-url-index' -import { sourceRefsForTarget } from '../../../shared/git-branch-cleanup-fetch' +import { parseGitRemoteFetchUrls } from '../../../shared/git/remotes/git-remote-url-index' +import { sourceRefsForTarget } from '../../../shared/git/branches/git-branch-cleanup-fetch' import { waitForPromiseWithSignal } from '../../../shared/abort-signal-reason' -import { DEFAULT_BASE_REF_PROBES } from '../../../shared/git-default-base-ref' +import { DEFAULT_BASE_REF_PROBES } from '../../../shared/git/refs/git-default-base-ref' import { gitExecOptions, type LocalGitExecOptions } from '../repo-default-base-ref' import { gitExecFileAsync } from '../command-runner/git-exec-file' diff --git a/src/main/git/remotes/worktree-push-target-reconciliation.ts b/src/main/git/remotes/worktree-push-target-reconciliation.ts index 10558113cdf..7767c0b113b 100644 --- a/src/main/git/remotes/worktree-push-target-reconciliation.ts +++ b/src/main/git/remotes/worktree-push-target-reconciliation.ts @@ -6,7 +6,7 @@ import { listWorktrees } from '../worktrees/catalog/worktree-scan-cache' import type { GitPushTarget } from '../../../shared/worktree/types' import { WORKTREE_ID_SEPARATOR } from '../../../shared/pty-session-id-format' import { worktreeIdentityKey } from '../../../shared/worktree/id' -import { parseGitRemoteFetchUrls } from '../../../shared/git-remote-url-index' +import { parseGitRemoteFetchUrls } from '../../../shared/git/remotes/git-remote-url-index' import { findWorktreeMetaReferencingRemote, hasBranchConfigUsingRemote, diff --git a/src/main/git/remotes/worktree-push-target-setup.ts b/src/main/git/remotes/worktree-push-target-setup.ts index 6166a3622bb..4d703ebb38f 100644 --- a/src/main/git/remotes/worktree-push-target-setup.ts +++ b/src/main/git/remotes/worktree-push-target-setup.ts @@ -1,6 +1,6 @@ import type { GitPushTarget } from '../../../shared/worktree/types' -import { findGitRemoteNameByFetchUrl } from '../../../shared/git-remote-url-index' -import { getGitCurrentBranchName } from '../../../shared/git-current-branch' +import { findGitRemoteNameByFetchUrl } from '../../../shared/git/remotes/git-remote-url-index' +import { getGitCurrentBranchName } from '../../../shared/git/refs/git-current-branch' import { sameGitHubRemoteUrl, type GitRemoteExec } from './worktree-push-target-cleanup' import { buildNarrowForkFetchRefspec, diff --git a/src/main/git/repo-base-ref-search.ts b/src/main/git/repo-base-ref-search.ts index 1fb9f01b97d..4bb50c3f2cc 100644 --- a/src/main/git/repo-base-ref-search.ts +++ b/src/main/git/repo-base-ref-search.ts @@ -1,5 +1,5 @@ import type { BaseRefSearchResult } from '../../shared/repo-types' -import { isForEachRefExcludeUnsupportedError } from '../../shared/git-ref-command-capabilities' +import { isForEachRefExcludeUnsupportedError } from '../../shared/git/refs/git-ref-command-capabilities' import { clampRepoSearchRefsLimit, clampRepoSearchRefsScanLimit, @@ -7,8 +7,8 @@ import { isRepoSearchRefsRequestLimit, isRepoSearchRefsScanLimit } from '../../shared/repo-search-limits' -import { isSafeGitRefName } from '../../shared/git-status-upstream-ref' -import { isRemoteHeadRef } from '../../shared/hosted-review-refs' +import { isSafeGitRefName } from '../../shared/git/status/git-status-upstream-ref' +import { isRemoteHeadRef } from '../../shared/source-control/hosted-review/hosted-review-refs' import { getLocalGitCapabilityCache } from './command-runner/git-capability-state' import { gitExecOptions, type LocalGitExecOptions } from './repo-default-base-ref' import { gitExecFileAsync } from './runner' diff --git a/src/main/git/repo-branch-conflict.ts b/src/main/git/repo-branch-conflict.ts index 5b0a5280389..f74390d388b 100644 --- a/src/main/git/repo-branch-conflict.ts +++ b/src/main/git/repo-branch-conflict.ts @@ -1,9 +1,9 @@ import { resolveConfiguredRemoteBranchName } from './repo-base-ref-search' import { gitExecOptions, type LocalGitExecOptions } from './repo-default-base-ref' import { gitExecFileAsync } from './runner' -import { isSafeGitRefName } from '../../shared/git-status-upstream-ref' +import { isSafeGitRefName } from '../../shared/git/status/git-status-upstream-ref' +import { isShowRefNoMatchError } from '../../shared/git/refs/git-show-ref-no-match' import { - isShowRefNoMatchError, probeAnyExactRef, probeAnyExactRefBatched, type ExactRefProbeExec, diff --git a/src/main/git/repo-default-base-ref.ts b/src/main/git/repo-default-base-ref.ts index 77aef711bfe..280f33c526b 100644 --- a/src/main/git/repo-default-base-ref.ts +++ b/src/main/git/repo-default-base-ref.ts @@ -1,12 +1,6 @@ import type { GitAdmissionTier } from '../../shared/rpc-contract/git-admission-tier-params' import { gitExecFileAsync } from './runner' -import { resolveDefaultBaseRefViaExec } from '../../shared/git-default-base-ref' - -export { - DEFAULT_BASE_REF_PROBES, - resolveDefaultBaseRefViaExec -} from '../../shared/git-default-base-ref' -export type { GitExec } from '../../shared/git-default-base-ref' +import { resolveDefaultBaseRefViaExec } from '../../shared/git/refs/git-default-base-ref' export type LocalGitExecOptions = { wslDistro?: string diff --git a/src/main/git/repo-git-marker-scan.ts b/src/main/git/repo-git-marker-scan.ts index dca0a7a8488..683127848f6 100644 --- a/src/main/git/repo-git-marker-scan.ts +++ b/src/main/git/repo-git-marker-scan.ts @@ -1,8 +1,8 @@ import { readFileSync, realpathSync, statSync } from 'node:fs' import { dirname, isAbsolute, join, relative } from 'node:path' import { normalizeRuntimePathSeparators } from '../../shared/cross-platform-path' -import { resolveGitMetadataPath } from '../../shared/git-metadata-path' -import { parseGitdirMarkerPayload } from '../../shared/gitdir-marker-payload' +import { resolveGitMetadataPath } from '../../shared/git/metadata/git-metadata-path' +import { parseGitdirMarkerPayload } from '../../shared/git/metadata/gitdir-marker-payload' export type GitMarkerScanResult = | { status: 'valid'; rootPath: string } diff --git a/src/main/git/repo.test.ts b/src/main/git/repo.test.ts index e2658979d41..5216710b9b2 100644 --- a/src/main/git/repo.test.ts +++ b/src/main/git/repo.test.ts @@ -11,10 +11,10 @@ import { getBranchConflictKind, getRemoteCount, parseAndFilterSearchRefDetails, - resolveDefaultBaseRefViaExec, searchBaseRefDetails, searchBaseRefs } from './repo' +import { resolveDefaultBaseRefViaExec } from '../../shared/git/refs/git-default-base-ref' import { REPO_SEARCH_REFS_MAX_LIMIT, REPO_SEARCH_REFS_MAX_SCAN_LIMIT diff --git a/src/main/git/repo.ts b/src/main/git/repo.ts index 63e24e95c3c..83fbbd21ab1 100644 --- a/src/main/git/repo.ts +++ b/src/main/git/repo.ts @@ -1,5 +1,5 @@ import { basename } from 'node:path' -import { parseGitRevListAheadBehindCounts } from '../../shared/git-rev-list-output' +import { parseGitRevListAheadBehindCounts } from '../../shared/git/refs/git-rev-list-output' import { buildHostedRemoteCommitUrl, buildHostedRemoteFileUrl } from './remotes/hosted-remote-url' import { getRemoteFileTarget } from './remotes/repo-remote-file-target' import { @@ -20,13 +20,8 @@ export { getLinkedWorktreeMainRepoRoot, normalizeGitRepoRootForInputPath } from './repo-detection' -export { - DEFAULT_BASE_REF_PROBES, - getBaseRefDefault, - resolveDefaultBaseRefViaExec, - resolveDefaultBaseRefWithLocalGit -} from './repo-default-base-ref' -export type { GitExec } from './repo-default-base-ref' +export { getBaseRefDefault, resolveDefaultBaseRefWithLocalGit } from './repo-default-base-ref' + export { buildSearchBaseRefsArgv, mergeBaseRefSearchResultGroups, @@ -37,7 +32,6 @@ export { } from './repo-base-ref-search' export { getBranchConflictKind } from './repo-branch-conflict' export type { BranchConflictKind } from './repo-branch-conflict' -export { isForEachRefExcludeUnsupportedError } from '../../shared/git-ref-command-capabilities' export function getRepoName(path: string): string { const name = basename(path) diff --git a/src/main/git/runner-buffer-cancellation.test.ts b/src/main/git/runner-buffer-cancellation.test.ts index 483e65a570a..8129e03855e 100644 --- a/src/main/git/runner-buffer-cancellation.test.ts +++ b/src/main/git/runner-buffer-cancellation.test.ts @@ -9,10 +9,8 @@ vi.mock('node:child_process', () => ({ })) import { gitExecFileAsyncBuffer } from './runner' -import { - GitAdmissionScheduler, - _resetGitAdmissionForTests -} from './command-runner/git-subprocess-admission' +import { GitAdmissionScheduler } from '../../shared/git/admission/git-admission-scheduler' +import { _resetGitAdmissionForTests } from './command-runner/git-subprocess-admission' import { configureWindowsHostGitEnvironmentReadiness } from './command-runner/windows-host-git-environment' beforeEach(() => execFileMock.mockReset()) diff --git a/src/main/git/runner-network-ssh-policy.test.ts b/src/main/git/runner-network-ssh-policy.test.ts index 756f0a1ed5b..05feae57942 100644 --- a/src/main/git/runner-network-ssh-policy.test.ts +++ b/src/main/git/runner-network-ssh-policy.test.ts @@ -9,10 +9,8 @@ vi.mock('node:child_process', () => ({ })) import { gitExecFileAsync } from './runner' -import { - GitAdmissionScheduler, - _resetGitAdmissionForTests -} from './command-runner/git-subprocess-admission' +import { GitAdmissionScheduler } from '../../shared/git/admission/git-admission-scheduler' +import { _resetGitAdmissionForTests } from './command-runner/git-subprocess-admission' class MockChildProcess extends EventEmitter { stdout = new EventEmitter() diff --git a/src/main/git/runner-wsl-direct-read.test.ts b/src/main/git/runner-wsl-direct-read.test.ts index 5005407a53e..581cc3d08c0 100644 --- a/src/main/git/runner-wsl-direct-read.test.ts +++ b/src/main/git/runner-wsl-direct-read.test.ts @@ -20,11 +20,9 @@ vi.mock('../diagnostics/main-thread-churn-probe', () => ({ recordSubprocessSpawn import { getBranchConflictKind } from './repo-branch-conflict' import { pendingWslDirectGitReadEnvironment } from './command-runner/git-command-resolution' import { gitExecFileAsync, gitExecFileAsyncBuffer, gitSpawn, gitStreamStdout } from './runner' -import { - GitAdmissionScheduler, - _resetGitAdmissionForTests, - type GitAdmissionEvent -} from './command-runner/git-subprocess-admission' +import { GitAdmissionScheduler } from '../../shared/git/admission/git-admission-scheduler' +import { _resetGitAdmissionForTests } from './command-runner/git-subprocess-admission' +import type { GitAdmissionEvent } from '../../shared/git/admission/git-admission-state' import { getWslGitReadEnvironment, resetWslGitReadEnvironmentForTests, diff --git a/src/main/git/runner-wsl-network-ssh-policy.test.ts b/src/main/git/runner-wsl-network-ssh-policy.test.ts index 80a1d5b9f93..d0eb762330a 100644 --- a/src/main/git/runner-wsl-network-ssh-policy.test.ts +++ b/src/main/git/runner-wsl-network-ssh-policy.test.ts @@ -9,10 +9,8 @@ vi.mock('node:child_process', () => ({ })) import { gitExecFileAsync } from './runner' -import { - GitAdmissionScheduler, - _resetGitAdmissionForTests -} from './command-runner/git-subprocess-admission' +import { GitAdmissionScheduler } from '../../shared/git/admission/git-admission-scheduler' +import { _resetGitAdmissionForTests } from './command-runner/git-subprocess-admission' const originalPlatform = process.platform const WSL_CWD = String.raw`\\wsl.localhost\Ubuntu\home\alice\repo` diff --git a/src/main/git/runner.test.ts b/src/main/git/runner.test.ts index 72142b7a79f..a46c8035ab6 100644 --- a/src/main/git/runner.test.ts +++ b/src/main/git/runner.test.ts @@ -1,6 +1,9 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { appendGitConfigEnv, + mergeGitConfigEnvProtocol +} from '../../shared/git/commands/git-credential-prompt-env' +import { extractExecError, isTransientGhError, nonInteractiveGitEnv, @@ -10,7 +13,6 @@ import { redirectPortedHostnameToEnv, untranslatedGitOutputEnv } from './runner' -import { mergeGitConfigEnvProtocol } from '../../shared/git-credential-prompt-env' function readGitConfigEnv(env: NodeJS.ProcessEnv): Record { const count = Number.parseInt(env.GIT_CONFIG_COUNT ?? '0', 10) diff --git a/src/main/git/runner.ts b/src/main/git/runner.ts index a3fcbf5f741..01ec6e6ac1b 100644 --- a/src/main/git/runner.ts +++ b/src/main/git/runner.ts @@ -8,9 +8,8 @@ export { configureWindowsHostGitEnvironmentReadiness } from './command-runner/windows-host-git-environment' export { DEFAULT_GIT_MAX_BUFFER } from './command-runner/git-exec-options' -export { GitCommandTimeoutError } from './command-runner/git-command-timeout' + export { - appendGitConfigEnv, gitOptionalLocksDisabledEnv, nonInteractiveGitEnv, promptGuardGitEnv, diff --git a/src/main/git/saved-clone-target.ts b/src/main/git/saved-clone-target.ts index 9304c38aec1..f264f3c173f 100644 --- a/src/main/git/saved-clone-target.ts +++ b/src/main/git/saved-clone-target.ts @@ -1,6 +1,6 @@ import type { ExecutionHostId } from '../../shared/execution-host' -import { normalizeGitRemoteUrl } from '../../shared/git-remote-identity' -import { isShowRefNoMatchError } from '../../shared/git-show-ref-no-match' +import { normalizeGitRemoteUrl } from '../../shared/git/remotes/git-remote-identity' +import { isShowRefNoMatchError } from '../../shared/git/refs/git-show-ref-no-match' import { isFolderRepo } from '../../shared/repo-kind' import type { Repo } from '../../shared/repo-types' import { runGitProbeOnHost } from '../workspaces/catalog/repo-git-remote-identity' diff --git a/src/main/git/source-control/branch-change-entries.ts b/src/main/git/source-control/branch-change-entries.ts index b8b7cdb5a84..cd3a7d0daeb 100644 --- a/src/main/git/source-control/branch-change-entries.ts +++ b/src/main/git/source-control/branch-change-entries.ts @@ -1,5 +1,5 @@ -import type { GitBranchChangeEntry } from '../../../shared/git-diff-compare-types' -import { gitChangeListArgs, parseGitChangeList } from '../../../shared/git-change-list' +import type { GitBranchChangeEntry } from '../../../shared/git/diff/git-diff-compare-types' +import { gitChangeListArgs, parseGitChangeList } from '../../../shared/git/diff/git-change-list' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync } from '../runner' diff --git a/src/main/git/source-control/branch-compare.ts b/src/main/git/source-control/branch-compare.ts index 3853fc1c592..9bbe9cd6a8f 100644 --- a/src/main/git/source-control/branch-compare.ts +++ b/src/main/git/source-control/branch-compare.ts @@ -1,8 +1,8 @@ import type { GitBranchCompareResult, GitBranchCompareSummary -} from '../../../shared/git-diff-compare-types' -import { readBranchCompareHead } from '../../../shared/git-branch-compare-head' +} from '../../../shared/git/diff/git-diff-compare-types' +import { readBranchCompareHead } from '../../../shared/git/branches/git-branch-compare-head' import { resolveWorktreeAddBaseRef } from '../../../shared/worktree/base-ref' import type { GitRuntimeOptions } from '../git-runtime-options' import { resolveWorktreeBaseCommitOid } from '../worktrees/creation/worktree-base-ref-probe' diff --git a/src/main/git/source-control/branch-diff.ts b/src/main/git/source-control/branch-diff.ts index f178ba8c960..0edf1a533e4 100644 --- a/src/main/git/source-control/branch-diff.ts +++ b/src/main/git/source-control/branch-diff.ts @@ -1,4 +1,4 @@ -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' import { stableInFlightKey } from '../../../shared/in-flight-promise-dedupe' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitRuntimeOptionsKey } from './git-runtime-options-cache-key' diff --git a/src/main/git/source-control/bulk-pathspec-command-line-budget.test.ts b/src/main/git/source-control/bulk-pathspec-command-line-budget.test.ts index 551604adc9d..6b303600b30 100644 --- a/src/main/git/source-control/bulk-pathspec-command-line-budget.test.ts +++ b/src/main/git/source-control/bulk-pathspec-command-line-budget.test.ts @@ -15,7 +15,7 @@ vi.mock('../command-runner/git-exec-file', async (importOriginal) => ({ gitExecFileAsync: (args: string[], options: { stdin?: string }) => gitExecFileAsync(args, options) })) vi.mock('./git-read-cache-invalidation', () => ({ invalidateGitReadCaches: vi.fn() })) -vi.mock('../../../shared/git-discard-path-safety', () => ({ +vi.mock('../../../shared/git/paths/git-discard-path-safety', () => ({ removeSafeUntrackedDiscardTarget: vi.fn(), removeSafeUntrackedDiscardTargets: async ( _worktreePath: string, diff --git a/src/main/git/source-control/check-ignored-paths.ts b/src/main/git/source-control/check-ignored-paths.ts index 136dff6270b..a98ec953125 100644 --- a/src/main/git/source-control/check-ignored-paths.ts +++ b/src/main/git/source-control/check-ignored-paths.ts @@ -7,7 +7,7 @@ import { GIT_CHECK_IGNORE_TIMEOUT_MS, parseGitCheckIgnorePaths, splitGitCheckIgnorePathsByStdinBytes -} from '../../../shared/git-check-ignore-stdio' +} from '../../../shared/git/paths/git-check-ignore-stdio' type GitExecError = Error & { stdout?: string; code?: number | string } diff --git a/src/main/git/source-control/commit-compare.ts b/src/main/git/source-control/commit-compare.ts index 60bbfdfa825..418df0c5995 100644 --- a/src/main/git/source-control/commit-compare.ts +++ b/src/main/git/source-control/commit-compare.ts @@ -1,5 +1,5 @@ -import type { GitCommitCompareResult } from '../../../shared/git-diff-compare-types' -import { parseGitRevListFirstParentOid } from '../../../shared/git-rev-list-output' +import type { GitCommitCompareResult } from '../../../shared/git/diff/git-diff-compare-types' +import { parseGitRevListFirstParentOid } from '../../../shared/git/refs/git-rev-list-output' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync } from '../runner' diff --git a/src/main/git/source-control/commit-diff.ts b/src/main/git/source-control/commit-diff.ts index 1a864374984..2d700731d01 100644 --- a/src/main/git/source-control/commit-diff.ts +++ b/src/main/git/source-control/commit-diff.ts @@ -1,4 +1,4 @@ -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' import { stableInFlightKey } from '../../../shared/in-flight-promise-dedupe' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitRuntimeOptionsKey } from './git-runtime-options-cache-key' diff --git a/src/main/git/source-control/diff-result.ts b/src/main/git/source-control/diff-result.ts index 244fae60316..837e5188a2c 100644 --- a/src/main/git/source-control/diff-result.ts +++ b/src/main/git/source-control/diff-result.ts @@ -1,4 +1,4 @@ -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' import { getLargeDiffRenderLimit } from '../../../shared/large-diff-render-limit' import { IMAGE_AND_PDF_PREVIEW_MIME_TYPES, diff --git a/src/main/git/source-control/discard-changes.ts b/src/main/git/source-control/discard-changes.ts index 2222a4b16b2..4337910555c 100644 --- a/src/main/git/source-control/discard-changes.ts +++ b/src/main/git/source-control/discard-changes.ts @@ -2,14 +2,14 @@ import * as path from 'node:path' import { removeSafeUntrackedDiscardTarget, removeSafeUntrackedDiscardTargets -} from '../../../shared/git-discard-path-safety' -import { partitionTrackedPathSpecs } from '../../../shared/git-tracked-pathspecs' +} from '../../../shared/git/paths/git-discard-path-safety' +import { partitionTrackedPathSpecs } from '../../../shared/git/paths/git-tracked-pathspecs' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync } from '../runner' import { invalidateGitReadCaches } from './git-read-cache-invalidation' import { bulkPathspecCommands, literalPathspec } from './git-pathspec' -import { encodeGitPathspecs } from '../../../shared/git-pathspec-stdin' +import { encodeGitPathspecs } from '../../../shared/git/paths/git-pathspec-stdin' import { redoWriteForDriveCheckoutSuspects } from './drive-checkout-suspect-writes' const DISCARD_WRITE = ['restore', '--worktree'] as const diff --git a/src/main/git/source-control/drive-checkout-suspect-status.test.ts b/src/main/git/source-control/drive-checkout-suspect-status.test.ts index e8330f7c947..155389d1dda 100644 --- a/src/main/git/source-control/drive-checkout-suspect-status.test.ts +++ b/src/main/git/source-control/drive-checkout-suspect-status.test.ts @@ -5,7 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type * as CheckoutGitConfig from '../wsl-windows-checkout-git-config' import type * as GitRunner from '../command-runner/git-stream-stdout' import type * as WatcherObservers from '../../ipc/filesystem/watchers/local-watcher-event-observers' -import type { GitStatusEntry } from '../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../shared/git/status/git-status-types' import { notifyLocalWatcherEvents } from '../../ipc/filesystem/watchers/local-watcher-event-observers' import type { WatchedRoot } from '../../ipc/filesystem/watchers/filesystem-watcher-wsl' import { createDebouncedBatch } from '../../ipc/filesystem/watchers/filesystem-watcher-batch-control' diff --git a/src/main/git/source-control/drive-checkout-suspect-status.ts b/src/main/git/source-control/drive-checkout-suspect-status.ts index 82f714d0e10..b3f248c74ee 100644 --- a/src/main/git/source-control/drive-checkout-suspect-status.ts +++ b/src/main/git/source-control/drive-checkout-suspect-status.ts @@ -1,7 +1,7 @@ import * as path from 'node:path' import { lstat } from 'node:fs/promises' -import type { GitStatusEntry } from '../../../shared/git-status-types' -import { StatusPorcelainParser } from '../../../shared/git-status-porcelain-parser' +import type { GitStatusEntry } from '../../../shared/git/status/git-status-types' +import { StatusPorcelainParser } from '../../../shared/git/status/git-status-porcelain-parser' import { isWindowsAbsolutePathLike } from '../../../shared/cross-platform-path' import { mapWithConcurrency } from '../../../shared/map-with-concurrency' import { diff --git a/src/main/git/source-control/effective-upstream-status-cache.ts b/src/main/git/source-control/effective-upstream-status-cache.ts index 58941f79270..4e0fa546219 100644 --- a/src/main/git/source-control/effective-upstream-status-cache.ts +++ b/src/main/git/source-control/effective-upstream-status-cache.ts @@ -1,4 +1,4 @@ -import type { GitUpstreamStatus } from '../../../shared/git-status-types' +import type { GitUpstreamStatus } from '../../../shared/git/status/git-status-types' import type { GitRuntimeOptions } from '../git-runtime-options' import { invalidateGitReadCaches } from './git-read-cache-invalidation' import { resolvedUpstreamNameCache } from './resolved-upstream-name-cache' diff --git a/src/main/git/source-control/effective-upstream-status-probe.ts b/src/main/git/source-control/effective-upstream-status-probe.ts index 734bdd14cd2..fbaf888eaa7 100644 --- a/src/main/git/source-control/effective-upstream-status-probe.ts +++ b/src/main/git/source-control/effective-upstream-status-probe.ts @@ -1,9 +1,9 @@ -import type { GitUpstreamStatus } from '../../../shared/git-status-types' +import type { GitUpstreamStatus } from '../../../shared/git/status/git-status-types' import { getEffectiveGitUpstreamStatus, - getGitUpstreamStatusForUpstreamName, - splitRemoteBranchName -} from '../../../shared/git-effective-upstream' + getGitUpstreamStatusForUpstreamName +} from '../../../shared/git/remotes/git-effective-upstream' +import { splitRemoteBranchName } from '../../../shared/git/remotes/git-remote-branch-name' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitReadOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync } from '../runner' diff --git a/src/main/git/source-control/file-diff.ts b/src/main/git/source-control/file-diff.ts index f8f584f90d9..5d42eb95448 100644 --- a/src/main/git/source-control/file-diff.ts +++ b/src/main/git/source-control/file-diff.ts @@ -1,6 +1,6 @@ import * as path from 'node:path' -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' -import { resolveWorktreeHostPath } from '../../../shared/git-metadata-path' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' +import { resolveWorktreeHostPath } from '../../../shared/git/metadata/git-metadata-path' import { stableInFlightKey } from '../../../shared/in-flight-promise-dedupe' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitRuntimeOptionsKey } from './git-runtime-options-cache-key' diff --git a/src/main/git/source-control/git-blob-read.ts b/src/main/git/source-control/git-blob-read.ts index f0155f76874..f7d329f4d44 100644 --- a/src/main/git/source-control/git-blob-read.ts +++ b/src/main/git/source-control/git-blob-read.ts @@ -1,7 +1,7 @@ import { readFile, stat } from 'node:fs/promises' import { isBinaryBuffer } from '../../../shared/binary-buffer' -import { isMissingGitBlobPath } from '../../../shared/git-blob-absence' -import { readGitCommandFailureStderr } from '../../../shared/git-command-failure-text' +import { isMissingGitBlobPath } from '../../../shared/git/diff/git-blob-absence' +import { readGitCommandFailureStderr } from '../../../shared/git/commands/git-command-failure-text' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitReadOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsyncBuffer } from '../runner' diff --git a/src/main/git/source-control/git-conflict-operation.ts b/src/main/git/source-control/git-conflict-operation.ts index 78614269017..9652a8bf21a 100644 --- a/src/main/git/source-control/git-conflict-operation.ts +++ b/src/main/git/source-control/git-conflict-operation.ts @@ -1,6 +1,6 @@ import { access } from 'node:fs/promises' import * as path from 'node:path' -import type { GitConflictOperation } from '../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../shared/git/status/git-status-types' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync } from '../runner' diff --git a/src/main/git/source-control/git-read-cache-invalidation.ts b/src/main/git/source-control/git-read-cache-invalidation.ts index 078883c24ad..c3e4becd725 100644 --- a/src/main/git/source-control/git-read-cache-invalidation.ts +++ b/src/main/git/source-control/git-read-cache-invalidation.ts @@ -1,9 +1,9 @@ -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' -import type { GitStatusResult } from '../../../shared/git-status-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusResult } from '../../../shared/git/status/git-status-types' import { InFlightPromiseDedupe } from '../../../shared/in-flight-promise-dedupe' -import { clearGitStatusLineStatsCache } from '../../../shared/git-status-line-stats-cache' -import { invalidateGitBranchLineTotalInFlight } from '../../../shared/git-branch-line-total' -import { GitStatusReadLeaseOwner } from '../../../shared/git-status-read-lease-owner' +import { clearGitStatusLineStatsCache } from '../../../shared/git/status/git-status-line-stats-cache' +import { invalidateGitBranchLineTotalInFlight } from '../../../shared/git/status/git-branch-line-total' +import { GitStatusReadLeaseOwner } from '../../../shared/git/status/git-status-read-lease-owner' import { invalidateGitUpstreamStatusReads } from './upstream' import { clearSubmodulePathsCache } from './submodule-paths' import { resolvedUpstreamNameCache } from './resolved-upstream-name-cache' diff --git a/src/main/git/source-control/git-upstream-status-read-owner.test.ts b/src/main/git/source-control/git-upstream-status-read-owner.test.ts index 7ace150653f..c044983529d 100644 --- a/src/main/git/source-control/git-upstream-status-read-owner.test.ts +++ b/src/main/git/source-control/git-upstream-status-read-owner.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { GitUpstreamStatus } from '../../../shared/git-status-types' +import type { GitUpstreamStatus } from '../../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../../shared/worktree/types' import { GitUpstreamStatusReadOwner, diff --git a/src/main/git/source-control/git-upstream-status-read-owner.ts b/src/main/git/source-control/git-upstream-status-read-owner.ts index b4eb0de93bb..d1712cbd6be 100644 --- a/src/main/git/source-control/git-upstream-status-read-owner.ts +++ b/src/main/git/source-control/git-upstream-status-read-owner.ts @@ -1,4 +1,4 @@ -import type { GitUpstreamStatus } from '../../../shared/git-status-types' +import type { GitUpstreamStatus } from '../../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../../shared/worktree/types' import { InFlightPromiseDedupe, stableInFlightKey } from '../../../shared/in-flight-promise-dedupe' diff --git a/src/main/git/source-control/resolve-git-dir.ts b/src/main/git/source-control/resolve-git-dir.ts index e0f49253043..8c529c44fc0 100644 --- a/src/main/git/source-control/resolve-git-dir.ts +++ b/src/main/git/source-control/resolve-git-dir.ts @@ -1,7 +1,10 @@ import { readFile } from 'node:fs/promises' import * as path from 'node:path' -import { resolveGitMetadataPath, resolveWorktreeHostPath } from '../../../shared/git-metadata-path' -import { parseGitdirMarkerPayload } from '../../../shared/gitdir-marker-payload' +import { + resolveGitMetadataPath, + resolveWorktreeHostPath +} from '../../../shared/git/metadata/git-metadata-path' +import { parseGitdirMarkerPayload } from '../../../shared/git/metadata/gitdir-marker-payload' import type { GitRuntimeOptions } from '../git-runtime-options' export async function resolveGitDir( diff --git a/src/main/git/source-control/settled-diff-cache-bounds.test.ts b/src/main/git/source-control/settled-diff-cache-bounds.test.ts index f8b2ec79d26..38633ce18ee 100644 --- a/src/main/git/source-control/settled-diff-cache-bounds.test.ts +++ b/src/main/git/source-control/settled-diff-cache-bounds.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' import { MAX_SETTLED_DIFF_CACHE_RESULT_CHARACTERS, SettledDiffCache } from './settled-diff-cache' import type { WorktreeDiffStamp } from './worktree-diff-stamp' diff --git a/src/main/git/source-control/settled-diff-cache.ts b/src/main/git/source-control/settled-diff-cache.ts index 4af76962699..d42a3104192 100644 --- a/src/main/git/source-control/settled-diff-cache.ts +++ b/src/main/git/source-control/settled-diff-cache.ts @@ -1,5 +1,5 @@ import { BoundedMap } from '../../../shared/bounded-map' -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' import { canProveUnchangedByStamp, isDiffStampClockSkewed, diff --git a/src/main/git/source-control/stage-worktree-changes.test.ts b/src/main/git/source-control/stage-worktree-changes.test.ts index f10bdb44095..7848b51070b 100644 --- a/src/main/git/source-control/stage-worktree-changes.test.ts +++ b/src/main/git/source-control/stage-worktree-changes.test.ts @@ -3,7 +3,7 @@ import { mkdir, mkdtemp, rm, symlink, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import * as path from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { DEFAULT_GIT_STATUS_LIMIT } from '../../../shared/git-status-limit' +import { DEFAULT_GIT_STATUS_LIMIT } from '../../../shared/git/status/git-status-limit' import { getStatus } from './status-read' import { bulkStageFiles, stageWorktreeChanges } from './staging' diff --git a/src/main/git/source-control/staged-commit-context.ts b/src/main/git/source-control/staged-commit-context.ts index b55ed98a132..4b02aab0f48 100644 --- a/src/main/git/source-control/staged-commit-context.ts +++ b/src/main/git/source-control/staged-commit-context.ts @@ -1,4 +1,4 @@ -import type { CommitMessageDraftContext } from '../../../shared/commit-message-generation' +import type { CommitMessageDraftContext } from '../../../shared/source-control/ai/generation/commit-message-generation' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync } from '../runner' diff --git a/src/main/git/source-control/staging.ts b/src/main/git/source-control/staging.ts index dfdbaf36bbb..1943df440a8 100644 --- a/src/main/git/source-control/staging.ts +++ b/src/main/git/source-control/staging.ts @@ -3,20 +3,20 @@ import { gitOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync } from '../runner' import { invalidateGitReadCaches } from './git-read-cache-invalidation' import { gitReportedPath, literalPathspec } from './git-pathspec' -import { encodeGitPathspecs } from '../../../shared/git-pathspec-stdin' +import { encodeGitPathspecs } from '../../../shared/git/paths/git-pathspec-stdin' import { getConflictResolutions, type ConflictResolution -} from '../../../shared/source-control-entry-actions' -import { parseUnmergedEntry } from '../../../shared/git-status-conflict-entries' +} from '../../../shared/source-control/listing/source-control-entry-actions' +import { parseUnmergedEntry } from '../../../shared/git/status/git-status-conflict-entries' import { stageGitWorktreeScope, type GitStageWorktreeScope, type GitStageWorktreeScopeReceipt -} from '../../../shared/git-stage-worktree-scope' +} from '../../../shared/git/paths/git-stage-worktree-scope' import { findExistingWorktreeSymlinkPaths } from '../worktrees/content-paths/worktree-symlink-detection' import { redoWriteForDriveCheckoutSuspects } from './drive-checkout-suspect-writes' -import { runWithGitWorktreeOperationLock } from '../../../shared/git-worktree-operation-lock' +import { runWithGitWorktreeOperationLock } from '../../../shared/git/worktrees/git-worktree-operation-lock' const STAGE_WRITE = ['add', '--update'] as const diff --git a/src/main/git/source-control/status-branch-line-total-exec-contract.test.ts b/src/main/git/source-control/status-branch-line-total-exec-contract.test.ts index e5b57968097..34b4b0ef00a 100644 --- a/src/main/git/source-control/status-branch-line-total-exec-contract.test.ts +++ b/src/main/git/source-control/status-branch-line-total-exec-contract.test.ts @@ -8,9 +8,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { buildGitBranchLineTotalDiffArgs, invalidateGitBranchLineTotalInFlight -} from '../../../shared/git-branch-line-total' +} from '../../../shared/git/status/git-branch-line-total' -import type * as BranchLineTotal from '../../../shared/git-branch-line-total' +import type * as BranchLineTotal from '../../../shared/git/status/git-branch-line-total' // Spy on real Git argv to validate opt-in and coalescing without stubbing results. const { gitExecCalls, execHooks, coalescerJoins } = vi.hoisted(() => ({ @@ -19,7 +19,7 @@ const { gitExecCalls, execHooks, coalescerJoins } = vi.hoisted(() => ({ coalescerJoins: { count: 0, onJoin: undefined as undefined | (() => void) } })) -vi.mock('../../../shared/git-branch-line-total', async (importOriginal) => { +vi.mock('../../../shared/git/status/git-branch-line-total', async (importOriginal) => { const actual = await importOriginal() return { ...actual, diff --git a/src/main/git/source-control/status-branch-line-total-input.ts b/src/main/git/source-control/status-branch-line-total-input.ts index dc8c15d0810..c8947262a15 100644 --- a/src/main/git/source-control/status-branch-line-total-input.ts +++ b/src/main/git/source-control/status-branch-line-total-input.ts @@ -1,12 +1,14 @@ -import type { GitStatusEntry } from '../../../shared/git-status-types' +import type { + GitStatusEntry, + GitBranchLineTotal +} from '../../../shared/git/status/git-status-types' import { computeGitBranchLineTotal, readGitBranchLineTotalMergeBaseParam, - GIT_BRANCH_LINE_TOTAL_TIMEOUT_MS, - type GitBranchLineTotal -} from '../../../shared/git-branch-line-total' -import type { GitRuntimeOptions } from '../git-runtime-options' -import { gitReadOptionsForWorktree } from '../git-runtime-options' + GIT_BRANCH_LINE_TOTAL_TIMEOUT_MS +} from '../../../shared/git/status/git-branch-line-total' + +import { type GitRuntimeOptions, gitReadOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync, gitOptionalLocksDisabledEnv } from '../runner' import { resolveWorktreeFilesystemPath } from './worktree-filesystem-path' import type { GetStatusOptions } from './get-status-options' diff --git a/src/main/git/source-control/status-branch-line-total-real-git.test.ts b/src/main/git/source-control/status-branch-line-total-real-git.test.ts index 9aaa52d4783..f68b32f40c1 100644 --- a/src/main/git/source-control/status-branch-line-total-real-git.test.ts +++ b/src/main/git/source-control/status-branch-line-total-real-git.test.ts @@ -3,7 +3,7 @@ import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import * as path from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { invalidateGitBranchLineTotalInFlight } from '../../../shared/git-branch-line-total' +import { invalidateGitBranchLineTotalInFlight } from '../../../shared/git/status/git-branch-line-total' import { getStatus } from './status-read' import { invalidateGitReadCaches } from './git-read-cache-invalidation' diff --git a/src/main/git/source-control/status-line-stats-host-paths.test.ts b/src/main/git/source-control/status-line-stats-host-paths.test.ts index 419d2806daa..854934b4009 100644 --- a/src/main/git/source-control/status-line-stats-host-paths.test.ts +++ b/src/main/git/source-control/status-line-stats-host-paths.test.ts @@ -3,8 +3,8 @@ import * as path from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type * as FsPromises from 'node:fs/promises' import type * as BoundedFileReader from '../../../shared/node-bounded-file-reader' -import type { GitStatusEntry } from '../../../shared/git-status-types' -import { invalidateGitBranchLineTotalInFlight } from '../../../shared/git-branch-line-total' +import type { GitStatusEntry } from '../../../shared/git/status/git-status-types' +import { invalidateGitBranchLineTotalInFlight } from '../../../shared/git/status/git-branch-line-total' const { lstatPaths, untrackedFiles } = vi.hoisted(() => ({ lstatPaths: [] as string[], diff --git a/src/main/git/source-control/status-line-stats.ts b/src/main/git/source-control/status-line-stats.ts index 450730ee690..554e1af99a1 100644 --- a/src/main/git/source-control/status-line-stats.ts +++ b/src/main/git/source-control/status-line-stats.ts @@ -1,11 +1,11 @@ -import type { GitStatusEntry } from '../../../shared/git-status-types' -import { collectGitStatusLineStatInputs } from '../../../shared/git-status-line-stat-inputs' +import type { GitStatusEntry } from '../../../shared/git/status/git-status-types' +import { collectGitStatusLineStatInputs } from '../../../shared/git/status/git-status-line-stat-inputs' import { applyLineStats, collectUntrackedAdditions, parseNumstat, type GitLineStats -} from '../../../shared/git-uncommitted-line-stats' +} from '../../../shared/git/status/git-uncommitted-line-stats' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitReadOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync, gitOptionalLocksDisabledEnv } from '../runner' diff --git a/src/main/git/source-control/status-read.ts b/src/main/git/source-control/status-read.ts index 8d0670929b8..ccfbc33cdd1 100644 --- a/src/main/git/source-control/status-read.ts +++ b/src/main/git/source-control/status-read.ts @@ -3,17 +3,17 @@ import type { GitStatusEntry, GitStatusResult, GitUpstreamStatus -} from '../../../shared/git-status-types' -import { StatusPorcelainParser } from '../../../shared/git-status-porcelain-parser' -import { resolveGitStatusLimit } from '../../../shared/git-status-limit' +} from '../../../shared/git/status/git-status-types' +import { StatusPorcelainParser } from '../../../shared/git/status/git-status-porcelain-parser' +import { resolveGitStatusLimit } from '../../../shared/git/status/git-status-limit' import { stableInFlightKey } from '../../../shared/in-flight-promise-dedupe' +import { beginGitStatusLineStatsCacheWrite } from '../../../shared/git/status/git-status-line-stats-write-token' import { - beginGitStatusLineStatsCacheWrite, clearGitStatusLineStatsCacheKey, reuseOrRecomputeGitStatusLineStats -} from '../../../shared/git-status-line-stats-cache' -import { resolveWorktreeHostPath } from '../../../shared/git-metadata-path' -import { readGitCommandFailureStderr } from '../../../shared/git-command-failure-text' +} from '../../../shared/git/status/git-status-line-stats-cache' +import { resolveWorktreeHostPath } from '../../../shared/git/metadata/git-metadata-path' +import { readGitCommandFailureStderr } from '../../../shared/git/commands/git-command-failure-text' import { gitOptionalLocksDisabledEnv, gitStreamStdout } from '../runner' import { findExistingWorktreeSymlinkPaths, @@ -22,7 +22,7 @@ import { import type { GetStatusOptions } from './get-status-options' import { statusReadLeaseOwner } from './git-read-cache-invalidation' import { detectConflictOperation } from './git-conflict-operation' -import { parseUnmergedEntry } from '../../../shared/git-status-conflict-entries' +import { parseUnmergedEntry } from '../../../shared/git/status/git-status-conflict-entries' import { getEffectiveUpstreamStatusCacheKey } from './effective-upstream-status-cache' import { getShortBranchName, diff --git a/src/main/git/source-control/status-upstream-ref.ts b/src/main/git/source-control/status-upstream-ref.ts index 54f882ab585..304c14686e2 100644 --- a/src/main/git/source-control/status-upstream-ref.ts +++ b/src/main/git/source-control/status-upstream-ref.ts @@ -1,4 +1,4 @@ -import { isSafeGitRefName } from '../../../shared/git-status-upstream-ref' +import { isSafeGitRefName } from '../../../shared/git/status/git-status-upstream-ref' type GitStatusUpstreamRefExec = ( args: string[], diff --git a/src/main/git/source-control/submodule-diff.ts b/src/main/git/source-control/submodule-diff.ts index dbc6d0b6496..7e59d209988 100644 --- a/src/main/git/source-control/submodule-diff.ts +++ b/src/main/git/source-control/submodule-diff.ts @@ -1,4 +1,4 @@ -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' import type { GitRuntimeOptions } from '../git-runtime-options' import { buildDiffResult } from './diff-result' import { type BlobConversion, blobConversion, readGitBlobAtOidPath } from './git-blob-read' diff --git a/src/main/git/source-control/submodule-restore-recurse-real-git.test.ts b/src/main/git/source-control/submodule-restore-recurse-real-git.test.ts index fa0ae1350d6..582c8b0fcdd 100644 --- a/src/main/git/source-control/submodule-restore-recurse-real-git.test.ts +++ b/src/main/git/source-control/submodule-restore-recurse-real-git.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { runProcess } from '@orca/process-host' import { afterEach, describe, expect, it, vi } from 'vitest' -import { canDiscardStatusEntry } from '../../../shared/source-control-entry-actions' +import { canDiscardStatusEntry } from '../../../shared/source-control/listing/source-control-entry-actions' import { discardChanges } from './discard-changes' import { getStatus } from './status-read' diff --git a/src/main/git/source-control/submodule-restore-recurse.ts b/src/main/git/source-control/submodule-restore-recurse.ts index 69d07614e88..b72334cd8b7 100644 --- a/src/main/git/source-control/submodule-restore-recurse.ts +++ b/src/main/git/source-control/submodule-restore-recurse.ts @@ -1,5 +1,5 @@ -import type { GitStatusEntry } from '../../../shared/git-status-types' -import { isWorktreeUndiscardableGitlink } from '../../../shared/source-control-discard-all-sequence' +import type { GitStatusEntry } from '../../../shared/git/status/git-status-types' +import { isWorktreeUndiscardableGitlink } from '../../../shared/source-control/listing/source-control-discard-all-sequence' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitReadOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync } from '../runner' diff --git a/src/main/git/source-control/submodule-status.ts b/src/main/git/source-control/submodule-status.ts index 60f3c7e3763..0870519ebb5 100644 --- a/src/main/git/source-control/submodule-status.ts +++ b/src/main/git/source-control/submodule-status.ts @@ -1,6 +1,9 @@ -import type { GitStatusEntry, GitStatusResult } from '../../../shared/git-status-types' -import { capGitStatusEntries, resolveGitStatusLimit } from '../../../shared/git-status-limit' -import { gitChangeListArgs, parseGitChangeList } from '../../../shared/git-change-list' +import type { GitStatusEntry, GitStatusResult } from '../../../shared/git/status/git-status-types' +import { + capGitStatusEntries, + resolveGitStatusLimit +} from '../../../shared/git/status/git-status-limit' +import { gitChangeListArgs, parseGitChangeList } from '../../../shared/git/diff/git-change-list' import type { GitRuntimeOptions } from '../git-runtime-options' import { gitOptionsForWorktree } from '../git-runtime-options' import { gitExecFileAsync, gitOptionalLocksDisabledEnv } from '../runner' diff --git a/src/main/git/source-control/upstream.ts b/src/main/git/source-control/upstream.ts index e289a5f07fc..e72349a057b 100644 --- a/src/main/git/source-control/upstream.ts +++ b/src/main/git/source-control/upstream.ts @@ -1,9 +1,12 @@ -import type { GitUpstreamStatus } from '../../../shared/git-status-types' +import type { GitUpstreamStatus } from '../../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../../shared/worktree/types' -import { upstreamOnlyCommitsArePatchEquivalent } from '../../../shared/git-upstream-status' -import { isNoUpstreamError, normalizeGitErrorMessage } from '../../../shared/git-remote-error' -import { getEffectiveGitUpstreamStatus } from '../../../shared/git-effective-upstream' -import { getPublishTargetStatus } from '../../../shared/git-publish-target-status' +import { upstreamOnlyCommitsArePatchEquivalent } from '../../../shared/git/remotes/git-upstream-status' +import { + isNoUpstreamError, + normalizeGitErrorMessage +} from '../../../shared/git/remotes/git-remote-error' +import { getEffectiveGitUpstreamStatus } from '../../../shared/git/remotes/git-effective-upstream' +import { getPublishTargetStatus } from '../../../shared/git/remotes/git-publish-target-status' import { gitExecFileAsync } from '../command-runner/git-exec-file' import { validateGitPushTarget } from '../push-target-validation' import { nativeAndWslGitUpstreamStatusReadOwner } from './git-upstream-status-read-owner' diff --git a/src/main/git/source-control/worktree-diff-stamp.ts b/src/main/git/source-control/worktree-diff-stamp.ts index b4656b63b0c..8de1a246e5b 100644 --- a/src/main/git/source-control/worktree-diff-stamp.ts +++ b/src/main/git/source-control/worktree-diff-stamp.ts @@ -1,6 +1,6 @@ import { readFile, stat } from 'node:fs/promises' import * as path from 'node:path' -import { resolveWorktreeHostPath } from '../../../shared/git-metadata-path' +import { resolveWorktreeHostPath } from '../../../shared/git/metadata/git-metadata-path' import type { GitRuntimeOptions } from '../git-runtime-options' import { resolveGitDir } from './resolve-git-dir' diff --git a/src/main/git/source-control/worktree-filesystem-path.ts b/src/main/git/source-control/worktree-filesystem-path.ts index 42a4babe8c8..fb7a57e29d5 100644 --- a/src/main/git/source-control/worktree-filesystem-path.ts +++ b/src/main/git/source-control/worktree-filesystem-path.ts @@ -1,4 +1,4 @@ -import { resolveGitMetadataPath } from '../../../shared/git-metadata-path' +import { resolveGitMetadataPath } from '../../../shared/git/metadata/git-metadata-path' import type { GitRuntimeOptions } from '../git-runtime-options' const GUEST_ROOTED_PATH = /^\/(?!\/)/ diff --git a/src/main/git/source-control/wsl-tracked-pathspec-banner.test.ts b/src/main/git/source-control/wsl-tracked-pathspec-banner.test.ts index 346df84f1cf..b504df433ac 100644 --- a/src/main/git/source-control/wsl-tracked-pathspec-banner.test.ts +++ b/src/main/git/source-control/wsl-tracked-pathspec-banner.test.ts @@ -17,7 +17,7 @@ vi.mock('../../observability/instrumentation', () => ({ })) vi.mock('../../diagnostics/main-thread-churn-probe', () => ({ recordSubprocessSpawn: vi.fn() })) vi.mock('./git-read-cache-invalidation', () => ({ invalidateGitReadCaches: vi.fn() })) -vi.mock('../../../shared/git-discard-path-safety', () => ({ +vi.mock('../../../shared/git/paths/git-discard-path-safety', () => ({ removeSafeUntrackedDiscardTarget: vi.fn(), removeSafeUntrackedDiscardTargets: async ( _worktreePath: string, diff --git a/src/main/git/task-repository-eligibility.ts b/src/main/git/task-repository-eligibility.ts index 652afee881f..8448b2c63e1 100644 --- a/src/main/git/task-repository-eligibility.ts +++ b/src/main/git/task-repository-eligibility.ts @@ -1,4 +1,4 @@ -import { parseGitRemoteVerboseOutput } from '../../shared/git-remote-identity' +import { parseGitRemoteVerboseOutput } from '../../shared/git/remotes/git-remote-identity' import { isDefaultGitHubHost } from '../../shared/github/repository-identity-key' import { isGitHubHostAuthenticated } from '../github/github-enterprise-repository' import { parseGitHubRemoteIdentity } from '../github/github-remote-identity-parsing' diff --git a/src/main/git/worktrees/catalog/worktree-graph-listing.test.ts b/src/main/git/worktrees/catalog/worktree-graph-listing.test.ts index 73cf9be86cd..7284de99a17 100644 --- a/src/main/git/worktrees/catalog/worktree-graph-listing.test.ts +++ b/src/main/git/worktrees/catalog/worktree-graph-listing.test.ts @@ -8,7 +8,7 @@ const { gitExecFileAsyncMock, gitExecFileSyncMock, translateWslOutputPathsMock } }) ) -vi.mock('../../../../shared/git-worktree-admin', () => ({ +vi.mock('../../../../shared/git/worktrees/git-worktree-admin', () => ({ annotateWorktreeLocksFromAdmin: async (_repoPath: string, rows: unknown[]) => rows })) diff --git a/src/main/git/worktrees/catalog/worktree-list-porcelain.test.ts b/src/main/git/worktrees/catalog/worktree-list-porcelain.test.ts index 3ae8474e7ea..7fd65819628 100644 --- a/src/main/git/worktrees/catalog/worktree-list-porcelain.test.ts +++ b/src/main/git/worktrees/catalog/worktree-list-porcelain.test.ts @@ -17,7 +17,7 @@ const { resolveGitDirMock: vi.fn() })) -vi.mock('../../../../shared/git-worktree-admin', () => ({ +vi.mock('../../../../shared/git/worktrees/git-worktree-admin', () => ({ annotateWorktreeLocksFromAdmin: async (_repoPath: string, rows: unknown[]) => rows })) diff --git a/src/main/git/worktrees/catalog/worktree-list-reader-cancellation.test.ts b/src/main/git/worktrees/catalog/worktree-list-reader-cancellation.test.ts index 75b99593cf4..8d7a5f5b643 100644 --- a/src/main/git/worktrees/catalog/worktree-list-reader-cancellation.test.ts +++ b/src/main/git/worktrees/catalog/worktree-list-reader-cancellation.test.ts @@ -21,7 +21,7 @@ vi.mock('../../command-runner/wsl-path-translation', async (importOriginal) => ( ...(await importOriginal>()), translateWslOutputPaths: (output: string) => output })) -vi.mock('../../../../shared/git-worktree-admin', () => ({ +vi.mock('../../../../shared/git/worktrees/git-worktree-admin', () => ({ annotateWorktreeLocksFromAdmin: async (_repoPath: string, rows: GitWorktreeInfo[]) => rows })) diff --git a/src/main/git/worktrees/catalog/worktree-list-reader.ts b/src/main/git/worktrees/catalog/worktree-list-reader.ts index 5b35b8f4bf1..b2b2e94c34d 100644 --- a/src/main/git/worktrees/catalog/worktree-list-reader.ts +++ b/src/main/git/worktrees/catalog/worktree-list-reader.ts @@ -2,7 +2,7 @@ import { throwIfSignalAborted, waitForPromiseWithSignal } from '../../../../shared/abort-signal-reason' -import { annotateWorktreeLocksFromAdmin } from '../../../../shared/git-worktree-admin' +import { annotateWorktreeLocksFromAdmin } from '../../../../shared/git/worktrees/git-worktree-admin' import { stat } from 'node:fs/promises' import type { GitWorktreeInfo } from '../../../../shared/worktree/types' import { toWslExecutionSpace } from '../../../../shared/wsl-paths' @@ -10,9 +10,9 @@ import { hasUnsupportedRevParsePathFormatEcho, isUnsupportedRevParsePathFormatError, isUnsupportedWorktreeListZError -} from '../../../../shared/git-worktree-command-capabilities' +} from '../../../../shared/git/worktrees/git-worktree-command-capabilities' import { withLocalGitCapabilityCacheForExecution } from '../../command-runner/git-capability-state' -import { parseWorktreeList } from '../../../../shared/git-worktree-porcelain-parser' +import { parseWorktreeList } from '../../../../shared/git/worktrees/git-worktree-porcelain-parser' import type { GitWorktreeExecOptions } from '../worktree-operation-options' import { WORKTREE_LIST_TIMEOUT_MS, diff --git a/src/main/git/worktrees/catalog/worktree-listing-unc-drvfs-identity.test.ts b/src/main/git/worktrees/catalog/worktree-listing-unc-drvfs-identity.test.ts index e2d30698238..bf20378f12e 100644 --- a/src/main/git/worktrees/catalog/worktree-listing-unc-drvfs-identity.test.ts +++ b/src/main/git/worktrees/catalog/worktree-listing-unc-drvfs-identity.test.ts @@ -11,7 +11,7 @@ const { gitExecFileAsyncMock, gitExecFileSyncMock, statMock, readFileMock, resol resolveGitDirMock: vi.fn() })) -vi.mock('../../../../shared/git-worktree-admin', () => ({ +vi.mock('../../../../shared/git/worktrees/git-worktree-admin', () => ({ annotateWorktreeLocksFromAdmin: async (_repoPath: string, rows: unknown[]) => rows })) diff --git a/src/main/git/worktrees/catalog/worktree-listing.ts b/src/main/git/worktrees/catalog/worktree-listing.ts index 5bc06daf2ed..cf85544881a 100644 --- a/src/main/git/worktrees/catalog/worktree-listing.ts +++ b/src/main/git/worktrees/catalog/worktree-listing.ts @@ -5,8 +5,8 @@ import { import { readFile, realpath, stat } from 'node:fs/promises' import { join } from 'node:path' import { isDefinitiveAbsence } from '../../../../shared/definitive-filesystem-absence' -import { resolveGitMetadataPath } from '../../../../shared/git-metadata-path' -import { parseGitdirMarkerPayload } from '../../../../shared/gitdir-marker-payload' +import { resolveGitMetadataPath } from '../../../../shared/git/metadata/git-metadata-path' +import { parseGitdirMarkerPayload } from '../../../../shared/git/metadata/gitdir-marker-payload' import { isWorktreeCreatePreparation } from '../../../../shared/worktree/create-preparation' import { toWslExecutionSpace } from '../../../../shared/wsl-paths' import type { GitWorktreeInfo } from '../../../../shared/worktree/types' diff --git a/src/main/git/worktrees/catalog/worktree-porcelain-parsing.test.ts b/src/main/git/worktrees/catalog/worktree-porcelain-parsing.test.ts index 22652d189ca..5bea0af2143 100644 --- a/src/main/git/worktrees/catalog/worktree-porcelain-parsing.test.ts +++ b/src/main/git/worktrees/catalog/worktree-porcelain-parsing.test.ts @@ -23,7 +23,7 @@ vi.mock('../../command-runner/wsl-path-translation', async (importOriginal) => ( translateWslOutputPaths: translateWslOutputPathsMock })) -import { parseWorktreeList } from '../../../../shared/git-worktree-porcelain-parser' +import { parseWorktreeList } from '../../../../shared/git/worktrees/git-worktree-porcelain-parser' import { registerWorktreeSuiteHooks } from '../testing/worktree-test-harness' registerWorktreeSuiteHooks() diff --git a/src/main/git/worktrees/content-paths/worktree-symlink-detection.ts b/src/main/git/worktrees/content-paths/worktree-symlink-detection.ts index cc54d41899e..b9e71f794b9 100644 --- a/src/main/git/worktrees/content-paths/worktree-symlink-detection.ts +++ b/src/main/git/worktrees/content-paths/worktree-symlink-detection.ts @@ -1,6 +1,6 @@ import { lstat } from 'node:fs/promises' import { resolve, sep } from 'node:path' -import { resolveWorktreeHostPath } from '../../../../shared/git-metadata-path' +import { resolveWorktreeHostPath } from '../../../../shared/git/metadata/git-metadata-path' // Keep read-only symlink detection independent of APFS materialization and child-process imports. diff --git a/src/main/git/worktrees/creation/worktree-add-timeout-override.test.ts b/src/main/git/worktrees/creation/worktree-add-timeout-override.test.ts index 2a921431684..a2529f67eb5 100644 --- a/src/main/git/worktrees/creation/worktree-add-timeout-override.test.ts +++ b/src/main/git/worktrees/creation/worktree-add-timeout-override.test.ts @@ -23,7 +23,7 @@ vi.mock('../../command-runner/wsl-path-translation', async (importOriginal) => ( translateWslOutputPaths: translateWslOutputPathsMock })) -import { GitCommandTimeoutError } from '../../../../shared/git-command-timeout' +import { GitCommandTimeoutError } from '../../../../shared/git/commands/git-command-timeout' import { addWorktree } from './worktree-add' import { resolveWorktreeAddTimeoutMs, diff --git a/src/main/git/worktrees/creation/worktree-add.ts b/src/main/git/worktrees/creation/worktree-add.ts index 621347c3163..dee5d5fc274 100644 --- a/src/main/git/worktrees/creation/worktree-add.ts +++ b/src/main/git/worktrees/creation/worktree-add.ts @@ -1,4 +1,4 @@ -import { GitCommandTimeoutError } from '../../../../shared/git-command-timeout' +import { GitCommandTimeoutError } from '../../../../shared/git/commands/git-command-timeout' import { resolveWorktreeAddBaseRef } from '../../../../shared/worktree/base-ref' import type { LocalBaseRefRefreshResult, diff --git a/src/main/git/worktrees/creation/worktree-base-divergence-real-git.test.ts b/src/main/git/worktrees/creation/worktree-base-divergence-real-git.test.ts index 9858c9307ee..10ffbdc249b 100644 --- a/src/main/git/worktrees/creation/worktree-base-divergence-real-git.test.ts +++ b/src/main/git/worktrees/creation/worktree-base-divergence-real-git.test.ts @@ -3,7 +3,7 @@ import { mkdtemp, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { GIT_FETCH_SKIP_AUTO_MAINTENANCE_CONFIG_ARGS } from '../../../../shared/git-fetch-auto-maintenance' +import { GIT_FETCH_SKIP_AUTO_MAINTENANCE_CONFIG_ARGS } from '../../../../shared/git/fetch/git-fetch-auto-maintenance' import { measureRetargetDivergence, RETARGET_MAX_COMMIT_DIVERGENCE diff --git a/src/main/git/worktrees/creation/worktree-base-divergence.test.ts b/src/main/git/worktrees/creation/worktree-base-divergence.test.ts index b8083ff8896..2965504b74c 100644 --- a/src/main/git/worktrees/creation/worktree-base-divergence.test.ts +++ b/src/main/git/worktrees/creation/worktree-base-divergence.test.ts @@ -7,7 +7,7 @@ vi.mock('../../command-runner/git-exec-file', async (importOriginal) => ({ gitExecFileAsync: mocks.gitExecFileAsync })) -import { GitAdmissionScheduler } from '../../../../shared/git-admission-scheduler' +import { GitAdmissionScheduler } from '../../../../shared/git/admission/git-admission-scheduler' import type { GitAdmissionTier } from '../../../../shared/rpc-contract/git-admission-tier-params' import { measureRetargetDivergence } from './worktree-base-divergence' diff --git a/src/main/git/worktrees/creation/worktree-base-ref-probe.ts b/src/main/git/worktrees/creation/worktree-base-ref-probe.ts index d795880ddeb..1f025cfbe14 100644 --- a/src/main/git/worktrees/creation/worktree-base-ref-probe.ts +++ b/src/main/git/worktrees/creation/worktree-base-ref-probe.ts @@ -1,8 +1,8 @@ import type { GitAdmissionTier } from '../../../../shared/rpc-contract/git-admission-tier-params' import { gitExecFileAsync } from '../../command-runner/git-exec-file' -import { isShowRefNoMatchError } from '../../../../shared/git-show-ref-no-match' +import { isShowRefNoMatchError } from '../../../../shared/git/refs/git-show-ref-no-match' import { hasCommitObjectViaGitExec } from '../../commit-object-ref' -import { isSafeGitRefName } from '../../../../shared/git-status-upstream-ref' +import { isSafeGitRefName } from '../../../../shared/git/status/git-status-upstream-ref' import { resolveWorktreeAddBaseRef } from '../../../../shared/worktree/base-ref' type GitExecOptions = { diff --git a/src/main/git/worktrees/creation/worktree-base-refresh.ts b/src/main/git/worktrees/creation/worktree-base-refresh.ts index 124e0b4f8a1..721d015f428 100644 --- a/src/main/git/worktrees/creation/worktree-base-refresh.ts +++ b/src/main/git/worktrees/creation/worktree-base-refresh.ts @@ -4,7 +4,7 @@ import type { } from '../../../../shared/worktree/base-ref-drift-types' import { normalizeRuntimePathForComparison } from '../../../../shared/cross-platform-path' import { createCoalescingKeyedRunner } from '../../../../shared/coalescing-keyed-runner' -import { parseWorktreeList } from '../../../../shared/git-worktree-porcelain-parser' +import { parseWorktreeList } from '../../../../shared/git/worktrees/git-worktree-porcelain-parser' import { fastForwardLocalBaseBranch, inspectLocalBaseBranch, diff --git a/src/main/git/worktrees/creation/worktree-checkout-progress.ts b/src/main/git/worktrees/creation/worktree-checkout-progress.ts index 05a26c86af2..4b71c73ba9e 100644 --- a/src/main/git/worktrees/creation/worktree-checkout-progress.ts +++ b/src/main/git/worktrees/creation/worktree-checkout-progress.ts @@ -1,5 +1,5 @@ import type { WorktreeCheckoutProgress } from '../../../../shared/worktree/create-types' -import { createGitProgressRecordReader } from '../../../../shared/git-progress-records' +import { createGitProgressRecordReader } from '../../../../shared/git/commands/git-progress-records' /** Receives checkout progress; `null` means git finished writing the files. */ export type WorktreeCheckoutProgressListener = (progress: WorktreeCheckoutProgress | null) => void diff --git a/src/main/git/worktrees/creation/worktree-create-git-executor-real-git.test.ts b/src/main/git/worktrees/creation/worktree-create-git-executor-real-git.test.ts index 71364f6e890..11b0a073fae 100644 --- a/src/main/git/worktrees/creation/worktree-create-git-executor-real-git.test.ts +++ b/src/main/git/worktrees/creation/worktree-create-git-executor-real-git.test.ts @@ -17,8 +17,8 @@ import { acquireGitAdmission, _resetGitAdmissionForTests } from '../../command-runner/git-subprocess-admission' -import { GitAdmissionScheduler } from '../../../../shared/git-admission-scheduler' -import type { GitAdmissionEvent } from '../../../../shared/git-admission-state' +import { GitAdmissionScheduler } from '../../../../shared/git/admission/git-admission-scheduler' +import type { GitAdmissionEvent } from '../../../../shared/git/admission/git-admission-state' const roots: string[] = [] afterEach(async () => { diff --git a/src/main/git/worktrees/creation/worktree-preparation-add.test.ts b/src/main/git/worktrees/creation/worktree-preparation-add.test.ts index 82c7eb3aa68..c9c06f2f02b 100644 --- a/src/main/git/worktrees/creation/worktree-preparation-add.test.ts +++ b/src/main/git/worktrees/creation/worktree-preparation-add.test.ts @@ -1,7 +1,7 @@ import { beforeEach, expect, it, vi } from 'vitest' import type * as FilePromises from 'node:fs/promises' import type * as PreparationLock from './worktree-preparation-lock' -import { isUnsupportedWorktreeAddLockReasonError } from '../../../../shared/git-worktree-command-capabilities' +import { isUnsupportedWorktreeAddLockReasonError } from '../../../../shared/git/worktrees/git-worktree-command-capabilities' const mocks = vi.hoisted(() => ({ git: vi.fn(), diff --git a/src/main/git/worktrees/creation/worktree-preparation-add.ts b/src/main/git/worktrees/creation/worktree-preparation-add.ts index 04bf1a1cc5a..431224193ab 100644 --- a/src/main/git/worktrees/creation/worktree-preparation-add.ts +++ b/src/main/git/worktrees/creation/worktree-preparation-add.ts @@ -1,6 +1,6 @@ import { lstat } from 'node:fs/promises' -import { isUnsupportedWorktreeAddLockReasonError } from '../../../../shared/git-worktree-command-capabilities' -import { resolveWorktreeHostPath } from '../../../../shared/git-metadata-path' +import { isUnsupportedWorktreeAddLockReasonError } from '../../../../shared/git/worktrees/git-worktree-command-capabilities' +import { resolveWorktreeHostPath } from '../../../../shared/git/metadata/git-metadata-path' import { windowsLongPathGitArgs } from '../../../../shared/windows-long-path-git-args' import { toHostFilesystemPath } from '../../../filesystem/host-tree-removal' import { withLocalGitCapabilityCacheForExecution } from '../../command-runner/git-capability-state' diff --git a/src/main/git/worktrees/creation/worktree-preparation-discard.ts b/src/main/git/worktrees/creation/worktree-preparation-discard.ts index 7859336bba5..521278b30d4 100644 --- a/src/main/git/worktrees/creation/worktree-preparation-discard.ts +++ b/src/main/git/worktrees/creation/worktree-preparation-discard.ts @@ -1,8 +1,8 @@ import { lstat } from 'node:fs/promises' import { join } from 'node:path' import { waitForPromiseWithSignal } from '../../../../shared/abort-signal-reason' -import { resolveWorktreeHostPath } from '../../../../shared/git-metadata-path' -import { findLinkedWorktreeGitDirectory } from '../../../../shared/git-worktree-admin' +import { resolveWorktreeHostPath } from '../../../../shared/git/metadata/git-metadata-path' +import { findLinkedWorktreeGitDirectory } from '../../../../shared/git/worktrees/git-worktree-admin' import { windowsLongPathGitArgs } from '../../../../shared/windows-long-path-git-args' import { toHostFilesystemPath } from '../../../filesystem/host-tree-removal' import { gitExecFileAsync } from '../../command-runner/git-exec-file' diff --git a/src/main/git/worktrees/creation/worktree-preparation-lock.ts b/src/main/git/worktrees/creation/worktree-preparation-lock.ts index 637717395c5..dceb75da6c1 100644 --- a/src/main/git/worktrees/creation/worktree-preparation-lock.ts +++ b/src/main/git/worktrees/creation/worktree-preparation-lock.ts @@ -4,7 +4,7 @@ import { isWindowsAbsolutePathLike } from '../../../../shared/cross-platform-pat import { resolveGitMetadataPath, type GitMetadataPathOptions -} from '../../../../shared/git-metadata-path' +} from '../../../../shared/git/metadata/git-metadata-path' import { toHostFilesystemPath } from '../../../filesystem/host-tree-removal' import { gitExecFileAsync } from '../../command-runner/git-exec-file' import { diff --git a/src/main/git/worktrees/creation/worktree-safety-real-git.test.ts b/src/main/git/worktrees/creation/worktree-safety-real-git.test.ts index c949a7321ed..e9c2a5efd95 100644 --- a/src/main/git/worktrees/creation/worktree-safety-real-git.test.ts +++ b/src/main/git/worktrees/creation/worktree-safety-real-git.test.ts @@ -24,7 +24,7 @@ vi.mock('../../source-control/git-read-cache-invalidation', () => ({ import { getBranchConflictKind, getBranchConflictKindViaExec } from '../../repo-branch-conflict' import { clearGitCapabilityStateForTests } from '../../command-runner/git-capability-state' -import { GitBinaryTestFixture } from '../../../../shared/git-binary.test-fixture' +import { GitBinaryTestFixture } from '../../../../shared/git/compatibility/git-binary.test-fixture' const expectedVersion = process.env.ORCA_GIT_COMPAT_VERSION let fixture: GitBinaryTestFixture diff --git a/src/main/git/worktrees/removal/remove-worktree-branch-cleanup.test.ts b/src/main/git/worktrees/removal/remove-worktree-branch-cleanup.test.ts index 726cca0bd63..b8d2765fa31 100644 --- a/src/main/git/worktrees/removal/remove-worktree-branch-cleanup.test.ts +++ b/src/main/git/worktrees/removal/remove-worktree-branch-cleanup.test.ts @@ -1,5 +1,5 @@ // Ref mutation tests use fictitious repositories; administrative reservations have real-Git coverage. -vi.mock('../../../../shared/git-worktree-admin', () => ({ +vi.mock('../../../../shared/git/worktrees/git-worktree-admin', () => ({ isBranchReservedByWorktreeOperation: vi.fn().mockResolvedValue(false) })) diff --git a/src/main/git/worktrees/removal/worktree-branch-removal.ts b/src/main/git/worktrees/removal/worktree-branch-removal.ts index 776bd07bcff..d95262bb9d9 100644 --- a/src/main/git/worktrees/removal/worktree-branch-removal.ts +++ b/src/main/git/worktrees/removal/worktree-branch-removal.ts @@ -3,15 +3,15 @@ import { branchHasNoUnmergedChangesWithLazyTargetRefresh, getBranchCleanupTargetRefs, type GitBranchCleanupExecOptions -} from '../../../../shared/git-branch-cleanup' +} from '../../../../shared/git/branches/git-branch-cleanup' import type { RemoveWorktreeResult } from '../../../../shared/worktree/create-types' import { withLocalGitCapabilityCacheForExecution } from '../../command-runner/git-capability-state' import { withRepoRefMaintenancePaused } from '../../refs/maintenance/local-repo-ref-maintenance' import { gitExecFileAsync } from '../../command-runner/git-exec-file' import { createLocalGitObjectQuarantine } from '../../local-git-object-quarantine' -import { isBranchReservedByWorktreeOperation } from '../../../../shared/git-worktree-admin' -import { parseWorktreeList } from '../../../../shared/git-worktree-porcelain-parser' -import { isBranchCheckedOutInWorktreeError } from '../../../../shared/git-branch-delete-refusal' +import { isBranchReservedByWorktreeOperation } from '../../../../shared/git/worktrees/git-worktree-admin' +import { parseWorktreeList } from '../../../../shared/git/worktrees/git-worktree-porcelain-parser' +import { isBranchCheckedOutInWorktreeError } from '../../../../shared/git/branches/git-branch-delete-refusal' import type { GitWorktreeExecOptions, RemoveWorktreeOptions } from '../worktree-operation-options' import { gitExecOptions, normalizeLocalBranchRef } from '../worktree-operation-options' diff --git a/src/main/git/worktrees/removal/worktree-rebase-update-refs-real-git.test.ts b/src/main/git/worktrees/removal/worktree-rebase-update-refs-real-git.test.ts index c1d7803f3d6..08c4de1dbd7 100644 --- a/src/main/git/worktrees/removal/worktree-rebase-update-refs-real-git.test.ts +++ b/src/main/git/worktrees/removal/worktree-rebase-update-refs-real-git.test.ts @@ -2,7 +2,7 @@ import { mkdir, mkdtemp, readFile, realpath, rm, writeFile } from 'node:fs/promi import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { GitBinaryTestFixture } from '../../../../shared/git-binary.test-fixture' +import { GitBinaryTestFixture } from '../../../../shared/git/compatibility/git-binary.test-fixture' vi.mock('../../command-runner/git-exec-file', async (importOriginal) => ({ ...(await importOriginal>()), diff --git a/src/main/git/worktrees/removal/worktree-removal-preflight.ts b/src/main/git/worktrees/removal/worktree-removal-preflight.ts index 4d4cf74da51..282e3ff9d14 100644 --- a/src/main/git/worktrees/removal/worktree-removal-preflight.ts +++ b/src/main/git/worktrees/removal/worktree-removal-preflight.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import { resolveWorktreeHostPath } from '../../../../shared/git-metadata-path' +import { resolveWorktreeHostPath } from '../../../../shared/git/metadata/git-metadata-path' import { isWorktreePathMissing } from '../../../workspaces/removal/worktree-removal-safety' import { SUBMODULE_DIRTY_REMOVAL_DETAIL, diff --git a/src/main/git/worktrees/worktree-operation-options.ts b/src/main/git/worktrees/worktree-operation-options.ts index 3d68f91844d..cf32b034603 100644 --- a/src/main/git/worktrees/worktree-operation-options.ts +++ b/src/main/git/worktrees/worktree-operation-options.ts @@ -2,7 +2,7 @@ import type { LocalBaseRefRefreshResult, LocalBaseRefUpdateSuggestion } from '../../../shared/worktree/base-ref-drift-types' -import { readGitCommandFailureText } from '../../../shared/git-command-failure-text' +import { readGitCommandFailureText } from '../../../shared/git/commands/git-command-failure-text' import type { GitAdmissionTier } from '../../../shared/rpc-contract/git-admission-tier-params' import type { GitWorktreeInfo } from '../../../shared/worktree/types' import type { WorktreeCheckoutProgressListener } from './creation/worktree-checkout-progress' diff --git a/src/main/git/wsl-direct-git-read-commands.test.ts b/src/main/git/wsl-direct-git-read-commands.test.ts index 0bbd9b994af..e38e1af2236 100644 --- a/src/main/git/wsl-direct-git-read-commands.test.ts +++ b/src/main/git/wsl-direct-git-read-commands.test.ts @@ -1,5 +1,8 @@ import { describe, expect, it } from 'vitest' -import { classifyGitCommand, isWslDirectGitReadCommand } from './wsl-direct-git-read-commands' +import { + classifyGitCommand, + isWslDirectGitReadCommand +} from '../../shared/git/commands/git-command-classification' describe('isWslDirectGitReadCommand', () => { it.each([ diff --git a/src/main/git/wsl-direct-git-read-commands.ts b/src/main/git/wsl-direct-git-read-commands.ts deleted file mode 100644 index e822d1d7aa1..00000000000 --- a/src/main/git/wsl-direct-git-read-commands.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { - classifyGitCommand, - findGitSubcommandIndex, - isWslDirectGitReadCommand -} from '../../shared/git-command-classification' -export type { GitCommandClass } from '../../shared/git-command-classification' diff --git a/src/main/git/wsl-windows-checkout-git-config.ts b/src/main/git/wsl-windows-checkout-git-config.ts index 09d2e412d38..c6a12158fc6 100644 --- a/src/main/git/wsl-windows-checkout-git-config.ts +++ b/src/main/git/wsl-windows-checkout-git-config.ts @@ -1,5 +1,8 @@ import { win32 } from 'node:path' -import { findGitSubcommandIndex, isWslDirectGitReadCommand } from './wsl-direct-git-read-commands' +import { + findGitSubcommandIndex, + isWslDirectGitReadCommand +} from '../../shared/git/commands/git-command-classification' /** autocrlf normalizes CRLF; minimal stat avoids drvfs rehashes from Windows index metadata (Git >=2.25). */ export const WINDOWS_CHECKOUT_GIT_CONFIG_ARGS: readonly string[] = [ diff --git a/src/main/git/wsl-windows-checkout-git-probe.ts b/src/main/git/wsl-windows-checkout-git-probe.ts index 3828a028651..c70f78faa1e 100644 --- a/src/main/git/wsl-windows-checkout-git-probe.ts +++ b/src/main/git/wsl-windows-checkout-git-probe.ts @@ -7,7 +7,7 @@ import { translateArgForWsl } from './command-runner/wsl-path-translation' import { acquireGitAdmission } from './command-runner/git-subprocess-admission' import { nonInteractiveGitEnv } from './command-runner/git-process-env' import type { GitAdmissionTier } from './command-runner/git-exec-options' -import { isWslDirectGitReadCommand } from './wsl-direct-git-read-commands' +import { isWslDirectGitReadCommand } from '../../shared/git/commands/git-command-classification' import { classifyLineEndingSample, forgetLineEndingSample, diff --git a/src/main/gitea/pull-request-creation.ts b/src/main/gitea/pull-request-creation.ts index 68d231f7505..18badccd843 100644 --- a/src/main/gitea/pull-request-creation.ts +++ b/src/main/gitea/pull-request-creation.ts @@ -1,10 +1,13 @@ import type { ExecutionHostId } from '../../shared/execution-host' import { hostedReviewSshConnectionId } from '../source-control/hosted-review-execution-host' -import type { CreateHostedReviewInput, CreateHostedReviewResult } from '../../shared/hosted-review' +import type { + CreateHostedReviewInput, + CreateHostedReviewResult +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { normalizeHostedReviewBaseRef, normalizeHostedReviewHeadRef -} from '../../shared/hosted-review-refs' +} from '../../shared/source-control/hosted-review/hosted-review-refs' import { HostedReviewApiRequestError, requestHostedReviewJson diff --git a/src/main/github/account-binding-required-host.ts b/src/main/github/account-binding-required-host.ts index 7fd38261f8c..ddc1d35dc51 100644 --- a/src/main/github/account-binding-required-host.ts +++ b/src/main/github/account-binding-required-host.ts @@ -1,7 +1,7 @@ import { isUnresolvedSshHostAlias, foldComparableGitHubHost -} from '../../shared/git-remote-host-alias' +} from '../../shared/git/remotes/git-remote-host-alias' import { githubHostFromIdentityKey } from '../../shared/github/repository-identity-key' import { rawSshTransportHost, remoteUrlUsesSshTransport } from './github-remote-identity-parsing' import { diff --git a/src/main/github/client-pr-lookup-coalescing.test.ts b/src/main/github/client-pr-lookup-coalescing.test.ts index 764db814c6c..c8bb5a63d6d 100644 --- a/src/main/github/client-pr-lookup-coalescing.test.ts +++ b/src/main/github/client-pr-lookup-coalescing.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { PRRefreshOutcome } from '../../shared/github/pull-request-refresh-types' import type { GitHubRepoContext, LocalGitExecOptions } from './github-repository-identity' import { getRepoExecutionHostId } from '../../shared/execution-host' -import { hostedReviewInfoFromGitHubPRInfo } from '../../shared/hosted-review-github' +import { hostedReviewInfoFromGitHubPRInfo } from '../../shared/source-control/hosted-review/hosted-review-github' import { makePR } from './pr-refresh-coordinator-test-harness' import { __resetHostedReviewBranchCacheForTests, diff --git a/src/main/github/client/check/check-job-log-shared-pipeline.test.ts b/src/main/github/client/check/check-job-log-shared-pipeline.test.ts index 59d7c206598..720474c24b2 100644 --- a/src/main/github/client/check/check-job-log-shared-pipeline.test.ts +++ b/src/main/github/client/check/check-job-log-shared-pipeline.test.ts @@ -1,7 +1,7 @@ import type { ChildProcess } from 'node:child_process' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import * as excerpt from '../../../../shared/check-job-log-excerpt' -import * as extraction from '../../../../shared/check-job-log-tail-slice' +import * as excerpt from '../../../../shared/source-control/checks/logs/check-job-log-excerpt' +import * as extraction from '../../../../shared/source-control/checks/logs/check-job-log-tail-slice' import { TERMINAL_CONTROL_CHARACTER_PATTERN } from '../../../../shared/ansi-escape-sequences' import { createCheckLogFixture } from '../../../../../config/scripts/check-job-log-test-fixture.mjs' import { diff --git a/src/main/github/client/check/check-job-log-tails.ts b/src/main/github/client/check/check-job-log-tails.ts index 37a9193fbde..12baac336d1 100644 --- a/src/main/github/client/check/check-job-log-tails.ts +++ b/src/main/github/client/check/check-job-log-tails.ts @@ -1,5 +1,5 @@ import type { PRCheckRunDetails } from '../../../../shared/github/check-types' -import { sliceCheckLogTail } from '../../../../shared/check-job-log-tail-slice' +import { sliceCheckLogTail } from '../../../../shared/source-control/checks/logs/check-job-log-tail-slice' import type { GitHubApiRepository } from '../../github-api-repository' import { githubRepoIdentityKey } from '../../../../shared/github/repository-identity-key' import type { GhExecOptions } from './../github-exec-scope' diff --git a/src/main/github/client/create/create-github-pull-request.ts b/src/main/github/client/create/create-github-pull-request.ts index 0d769ac55b8..e92a6716cfb 100644 --- a/src/main/github/client/create/create-github-pull-request.ts +++ b/src/main/github/client/create/create-github-pull-request.ts @@ -3,11 +3,11 @@ import { hostedReviewSshConnectionId } from '../../../source-control/hosted-revi import type { CreateHostedReviewInput, CreateHostedReviewResult -} from '../../../../shared/hosted-review' +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { normalizeHostedReviewBaseRef, normalizeHostedReviewHeadRef -} from '../../../../shared/hosted-review-refs' +} from '../../../../shared/source-control/hosted-review/hosted-review-refs' import { mkdtemp, rm, writeFile } from 'node:fs/promises' import { join } from 'node:path' import { tmpdir } from 'node:os' diff --git a/src/main/github/client/create/create-pr-error-classification.ts b/src/main/github/client/create/create-pr-error-classification.ts index 012b2becde3..e45dfbfb532 100644 --- a/src/main/github/client/create/create-pr-error-classification.ts +++ b/src/main/github/client/create/create-pr-error-classification.ts @@ -1,4 +1,4 @@ -import type { CreateHostedReviewResult } from '../../../../shared/hosted-review' +import type { CreateHostedReviewResult } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { extractExecError } from '../../../git/exec-error' export function classifyCreatePRError(error: unknown): CreateHostedReviewResult { const { stderr, stdout } = extractExecError(error) diff --git a/src/main/github/client/lookup/pr-refresh-outcome-assembly.ts b/src/main/github/client/lookup/pr-refresh-outcome-assembly.ts index 0c9c44afacb..84e9de6c344 100644 --- a/src/main/github/client/lookup/pr-refresh-outcome-assembly.ts +++ b/src/main/github/client/lookup/pr-refresh-outcome-assembly.ts @@ -1,4 +1,4 @@ -import { summarizePRCheckRollup } from '../../../../shared/pr-check-status' +import { summarizePRCheckRollup } from '../../../../shared/source-control/checks/pr-check-status' import type { PRRefreshOutcome } from '../../../../shared/github/pull-request-refresh-types' import type { PRConflictSummary, diff --git a/src/main/github/client/lookup/tracked-upstream-cache.ts b/src/main/github/client/lookup/tracked-upstream-cache.ts index c7e8bf0d792..9e2dc28d2ae 100644 --- a/src/main/github/client/lookup/tracked-upstream-cache.ts +++ b/src/main/github/client/lookup/tracked-upstream-cache.ts @@ -1,4 +1,4 @@ -import { splitRemoteBranchName } from '../../../../shared/git-effective-upstream' +import { splitRemoteBranchName } from '../../../../shared/git/remotes/git-remote-branch-name' import type { OwnerRepo } from '../../gh-utils' import { readLocalGitConfigSignature } from '../../local-git-config-signature' import { githubRepoIdentityKey } from '../../../../shared/github/repository-identity-key' diff --git a/src/main/github/client/map/work-item-field-coercion.ts b/src/main/github/client/map/work-item-field-coercion.ts index 914e8d95361..c002d3a682c 100644 --- a/src/main/github/client/map/work-item-field-coercion.ts +++ b/src/main/github/client/map/work-item-field-coercion.ts @@ -3,7 +3,7 @@ import type { PRReviewDecision } from '../../../../shared/github/pull-request-types' import type { GitHubWorkItem } from '../../../../shared/github/work-item-types' -import { summarizeProviderChecks } from '../../../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../../shared/source-control/checks/provider-check-summary' // The renderer supplies repoId after IPC; main knows only the repository path. export type MainWorkItem = Omit diff --git a/src/main/github/conflict-summary.test.ts b/src/main/github/conflict-summary.test.ts index 212b2041ee1..23144fa02f5 100644 --- a/src/main/github/conflict-summary.test.ts +++ b/src/main/github/conflict-summary.test.ts @@ -28,8 +28,8 @@ vi.mock('node:fs/promises', async (importOriginal) => { } }) -import { findGitSubcommandIndex } from '../../shared/git-command-classification' -import { GIT_CAPABILITY_RETRY_INTERVAL_MS } from '../../shared/git-capability-cache' +import { findGitSubcommandIndex } from '../../shared/git/commands/git-command-classification' +import { GIT_CAPABILITY_RETRY_INTERVAL_MS } from '../../shared/git/commands/git-capability-cache' import { getLocalGitCapabilityCache } from '../git/command-runner/git-capability-state' import { CONFLICT_SUMMARY_BASE_FETCH_WINDOW_MS } from './conflict-summary-cache' import { __resetPRConflictSummaryCachesForTests, getPRConflictSummary } from './conflict-summary' diff --git a/src/main/github/conflict-summary.ts b/src/main/github/conflict-summary.ts index 2d7cc6a7b38..764cb955e62 100644 --- a/src/main/github/conflict-summary.ts +++ b/src/main/github/conflict-summary.ts @@ -2,7 +2,7 @@ import type { PRConflictSummary } from '../../shared/github/pull-request-types' import { isUnsupportedMergeTreeMergeBaseError, isUnsupportedMergeTreeWriteTreeError -} from '../../shared/git-merge-tree-capability' +} from '../../shared/git/branches/git-merge-tree-capability' import { gitExecFileAsync } from '../git/runner' import { gitOptionsForWorktree, type GitRuntimeOptions } from '../git/git-runtime-options' import { createLocalGitObjectQuarantine } from '../git/local-git-object-quarantine' diff --git a/src/main/github/github-remote-identity-parsing.ts b/src/main/github/github-remote-identity-parsing.ts index af9ca3b6254..613d9e0f1a0 100644 --- a/src/main/github/github-remote-identity-parsing.ts +++ b/src/main/github/github-remote-identity-parsing.ts @@ -1,4 +1,4 @@ -import { normalizeGitHubRemoteHost } from '../../shared/git-remote-host-alias' +import { normalizeGitHubRemoteHost } from '../../shared/git/remotes/git-remote-host-alias' import type { GitHubOwnerRepo } from '../../shared/github/pull-request-types' export type GitHubRemoteIdentity = GitHubOwnerRepo & { host: string } diff --git a/src/main/github/github-stack-api-responses.ts b/src/main/github/github-stack-api-responses.ts index 727d72331ef..6d312db90d6 100644 --- a/src/main/github/github-stack-api-responses.ts +++ b/src/main/github/github-stack-api-responses.ts @@ -1,4 +1,4 @@ -import type { HostedReviewSummary } from '../../shared/hosted-review' +import type { HostedReviewSummary } from '../../shared/source-control/hosted-review/hosted-review-contracts' export type NumberedHostedReviewSummary = Omit & { number: number } diff --git a/src/main/github/mappers.ts b/src/main/github/mappers.ts index 60546ae0959..cbaecf02315 100644 --- a/src/main/github/mappers.ts +++ b/src/main/github/mappers.ts @@ -1,6 +1,6 @@ import type { PRCheckDetail } from '../../shared/github/check-types' import type { CheckStatus, IssueInfo, PRInfo } from '../../shared/github/pull-request-types' -import { derivePRCheckStatusFromRollup } from '../../shared/pr-check-status' +import { derivePRCheckStatusFromRollup } from '../../shared/source-control/checks/pr-check-status' // REST check runs separate status/conclusion; gh pr checks combines them into one state. diff --git a/src/main/github/pr-start-point.ts b/src/main/github/pr-start-point.ts index b131725c7f4..504c5904592 100644 --- a/src/main/github/pr-start-point.ts +++ b/src/main/github/pr-start-point.ts @@ -3,10 +3,8 @@ import type { IssueSourcePreference } from '../../shared/repo-types' import type { GhAccountBinding } from '../../shared/github/account-binding' import type { GitHubPrStartPoint, GitPushTarget } from '../../shared/worktree/types' import { fetchCompareBaseRefWithLocalFallback } from '../git/compare-base-ref-fetch' -import { - isMissingRemoteRefGitError, - isTransientReviewHeadFetchError -} from '../git/fetch-error-classification' +import { isMissingRemoteRefGitError } from '../../shared/git/refs/git-missing-remote-ref' +import { isTransientReviewHeadFetchError } from '../git/fetch-error-classification' import { getPullRequestPushTarget, getWorkItem } from './client' import { githubPullRequestHeadLocalRef, diff --git a/src/main/github/stacked-pr-creation.ts b/src/main/github/stacked-pr-creation.ts index 126ccaee27f..025b3c0cb8b 100644 --- a/src/main/github/stacked-pr-creation.ts +++ b/src/main/github/stacked-pr-creation.ts @@ -3,12 +3,12 @@ import { hostedReviewSshConnectionId } from '../source-control/hosted-review-exe import type { CreateStackedHostedReviewInput, CreateStackedHostedReviewResult -} from '../../shared/hosted-review' +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { isDefaultGitHubHost } from '../../shared/github/repository-identity-key' import { normalizeHostedReviewBaseRef, normalizeHostedReviewHeadRef -} from '../../shared/hosted-review-refs' +} from '../../shared/source-control/hosted-review/hosted-review-refs' import { acquire, ghExecFileAsync, ghRepoExecOptions, githubRepoContext, release } from './gh-utils' import { getOriginGitHubApiRepository, @@ -26,7 +26,7 @@ import { type GitHubStackPullRequest, type NumberedHostedReviewSummary } from './github-stack-api-responses' -import { stackedReviewFailure } from '../../shared/stacked-hosted-review-failure-copy' +import { stackedReviewFailure } from '../../shared/source-control/hosted-review/stacked-hosted-review-failure-copy' type StackedPullRequestPlan = | { diff --git a/src/main/gitlab/client-mr-branch-lookup.test.ts b/src/main/gitlab/client-mr-branch-lookup.test.ts index ac7e5f41b98..35dcba02571 100644 --- a/src/main/gitlab/client-mr-branch-lookup.test.ts +++ b/src/main/gitlab/client-mr-branch-lookup.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type * as GlUtils from './gl-utils' import { derivePipelineStatus, mapMRInfo } from './mappers' -import { gitlabMrCheckCases } from '../../shared/gitlab-mr-checks.test-fixture' +import { gitlabMrCheckCases } from '../../shared/source-control/checks/gitlab/gitlab-mr-checks.test-fixture' import { mapGitLabReview } from '../source-control/forge-review-mappers' import { __resetHostedReviewBranchCacheForTests, diff --git a/src/main/gitlab/client-mr-review-actions.test.ts b/src/main/gitlab/client-mr-review-actions.test.ts index 11fcf90049b..b5fea0d39bc 100644 --- a/src/main/gitlab/client-mr-review-actions.test.ts +++ b/src/main/gitlab/client-mr-review-actions.test.ts @@ -55,7 +55,7 @@ import { updateMRReviewers } from './client' import { resetGitLabMrMocks } from './client-mr-test-harness' -import type { HostedReviewInfo } from '../../shared/hosted-review' +import type { HostedReviewInfo } from '../../shared/source-control/hosted-review/hosted-review-contracts' import { __resetHostedReviewBranchCacheForTests, withHostedReviewBranchCache diff --git a/src/main/gitlab/mappers.test.ts b/src/main/gitlab/mappers.test.ts index 88e5e6bbf3d..d32137007ff 100644 --- a/src/main/gitlab/mappers.test.ts +++ b/src/main/gitlab/mappers.test.ts @@ -1,12 +1,9 @@ import { describe, expect, it } from 'vitest' +import { derivePipelineStatus, mapGitLabIssueInfo, mapMRInfo, mapMRState } from './mappers' import { - derivePipelineStatus, - mapGitLabIssueInfo, - mapMRInfo, - mapMRState, - mapPipelineJobStatusToCheckStatus, - mapPipelineJobStatusToConclusion -} from './mappers' + mapGitLabPipelineJobStatusToCheckStatus as mapPipelineJobStatusToCheckStatus, + mapGitLabPipelineJobStatusToConclusion as mapPipelineJobStatusToConclusion +} from '../../shared/source-control/checks/gitlab/gitlab-pipeline-checks' describe('mapPipelineJobStatusToCheckStatus', () => { it('classifies queued lifecycle states', () => { diff --git a/src/main/gitlab/mappers.ts b/src/main/gitlab/mappers.ts index a802c9c9a33..fcbd69bc731 100644 --- a/src/main/gitlab/mappers.ts +++ b/src/main/gitlab/mappers.ts @@ -1,16 +1,14 @@ -import type { CheckStatus } from '../../shared/github/pull-request-types' -import type { GitLabIssueInfo, GitLabWorkItem, MRInfo, MRState } from '../../shared/gitlab-types' import { mapGitLabPipelineJobStatusToCheckStatus, mapGitLabPipelineJobStatusToConclusion -} from '../../shared/gitlab-pipeline-checks' -import { summarizeProviderChecks } from '../../shared/provider-check-summary' +} from '../../shared/source-control/checks/gitlab/gitlab-pipeline-checks' +import type { CheckStatus } from '../../shared/github/pull-request-types' +import type { GitLabIssueInfo, GitLabWorkItem, MRInfo, MRState } from '../../shared/gitlab-types' + +import { summarizeProviderChecks } from '../../shared/source-control/checks/provider-check-summary' // Split GitLab's combined job lifecycle/outcome into the common check-row shape. -export const mapPipelineJobStatusToCheckStatus = mapGitLabPipelineJobStatusToCheckStatus -export const mapPipelineJobStatusToConclusion = mapGitLabPipelineJobStatusToConclusion - export function mapMRState(state: string, isDraft?: boolean, title?: string): MRState { const s = state?.toLowerCase() if (s === 'merged') { @@ -166,8 +164,8 @@ export function derivePipelineStatus( rollup.map((job) => { const s = job.status?.toLowerCase() ?? '' return { - status: mapPipelineJobStatusToCheckStatus(s), - conclusion: mapPipelineJobStatusToConclusion(s) + status: mapGitLabPipelineJobStatusToCheckStatus(s), + conclusion: mapGitLabPipelineJobStatusToConclusion(s) } }) ) diff --git a/src/main/gitlab/merge-request-creation.ts b/src/main/gitlab/merge-request-creation.ts index 84ae80b5220..671688a1d85 100644 --- a/src/main/gitlab/merge-request-creation.ts +++ b/src/main/gitlab/merge-request-creation.ts @@ -2,11 +2,14 @@ import type { ExecutionHostId } from '../../shared/execution-host' import { hostedReviewSshConnectionId } from '../source-control/hosted-review-execution-host' import { readFile } from 'node:fs/promises' import { join } from 'node:path' -import type { CreateHostedReviewInput, CreateHostedReviewResult } from '../../shared/hosted-review' +import type { + CreateHostedReviewInput, + CreateHostedReviewResult +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { normalizeHostedReviewBaseRef, normalizeHostedReviewHeadRef -} from '../../shared/hosted-review-refs' +} from '../../shared/source-control/hosted-review/hosted-review-refs' import { getHostedReviewLocalGitOptions, hasHostedReviewLocalGitOptions, diff --git a/src/main/gitlab/project-ref-parser.ts b/src/main/gitlab/project-ref-parser.ts index d131e0acb3a..051fdf1d062 100644 --- a/src/main/gitlab/project-ref-parser.ts +++ b/src/main/gitlab/project-ref-parser.ts @@ -1,5 +1,5 @@ import type { GitLabProjectRef } from '../../shared/gitlab-types' -import { normalizeGitLabRemoteHost } from '../../shared/git-remote-host-alias' +import { normalizeGitLabRemoteHost } from '../../shared/git/remotes/git-remote-host-alias' export type ProjectRef = GitLabProjectRef diff --git a/src/main/ipc/filesystem/filesystem-git-commit-generation-handlers.ts b/src/main/ipc/filesystem/filesystem-git-commit-generation-handlers.ts index 74fe8476659..d11ac6319d3 100644 --- a/src/main/ipc/filesystem/filesystem-git-commit-generation-handlers.ts +++ b/src/main/ipc/filesystem/filesystem-git-commit-generation-handlers.ts @@ -4,19 +4,19 @@ import { } from '../../../shared/text-generation-failure-copy' import { ipcMain } from 'electron' import type { GlobalSettings } from '../../../shared/global-settings-types' -import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control-ai' +import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control/ai/source-control-ai-operation-resolution' import { cancelGenerateCommitMessageLocal, generateCommitMessageFromContext, resolveCommitMessageSettings, type GenerateCommitMessageResult } from '../../text-generation/commit-message-text-generation' -import { getCommitMessageModelDiscoveryHostKey } from '../../../shared/commit-message-host-key' +import { getCommitMessageModelDiscoveryHostKey } from '../../../shared/source-control/ai/generation/commit-message-host-key' import { getStagedCommitContext } from '../../git/source-control/staged-commit-context' import { SSH_HOST_NOT_SERVED_MESSAGE } from '../../providers/ssh-host-not-served-error' import { resolveRegisteredWorktreePath } from '../worktrees/removal/registered-worktree-roots-cache' import { getLocalGitOptionsForRegisteredWorktree } from '../local-worktree-runtime-options' -import { withLinkedIssueDraftContext } from '../../../shared/source-control-ai-action-variables' +import { withLinkedIssueDraftContext } from '../../../shared/source-control/ai/recipes/source-control-ai-action-variables' import { resolveSourceControlAiLinkedIssue } from '../source-control/source-control-ai-linked-issue' import { prepareLocalCommitMessageAgentEnv } from '../../text-generation/commit-message-agent-environment' import type { FilesystemHandlerContext } from './filesystem-handler-context' diff --git a/src/main/ipc/filesystem/filesystem-git-diff-handlers.ts b/src/main/ipc/filesystem/filesystem-git-diff-handlers.ts index 64d1acc3ee6..e0b4f243bae 100644 --- a/src/main/ipc/filesystem/filesystem-git-diff-handlers.ts +++ b/src/main/ipc/filesystem/filesystem-git-diff-handlers.ts @@ -1,5 +1,5 @@ import { ipcMain } from 'electron' -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' import { getBranchDiff } from '../../git/source-control/branch-diff' import { getCommitDiff } from '../../git/source-control/commit-diff' import { diff --git a/src/main/ipc/filesystem/filesystem-git-index-handlers.ts b/src/main/ipc/filesystem/filesystem-git-index-handlers.ts index 6886b25c278..a86b2c674db 100644 --- a/src/main/ipc/filesystem/filesystem-git-index-handlers.ts +++ b/src/main/ipc/filesystem/filesystem-git-index-handlers.ts @@ -16,13 +16,13 @@ import { import { getWorktreeSharedLinkPaths } from '../../git/worktrees/content-paths/worktree-shared-directories' import { validateGitRelativeFilePath } from './access/filesystem-path-containment' import type { FilesystemHandlerContext } from './filesystem-handler-context' -import { parseGitStageWorktreeScope } from '../../../shared/git-stage-worktree-scope' +import { parseGitStageWorktreeScope } from '../../../shared/git/paths/git-stage-worktree-scope' import { requireReachableGitRoute } from '../../providers/execution-host-provider-dispatch' import { getConnectionExecutionHostId } from '../../../shared/execution-host' import { CONFLICT_RESOLUTIONS, type ConflictResolution -} from '../../../shared/source-control-entry-actions' +} from '../../../shared/source-control/listing/source-control-entry-actions' export function registerFilesystemGitIndexHandlers(context: FilesystemHandlerContext): void { const { store } = context diff --git a/src/main/ipc/filesystem/filesystem-git-pull-request-generation-handlers.ts b/src/main/ipc/filesystem/filesystem-git-pull-request-generation-handlers.ts index a76b1577884..977bd39724a 100644 --- a/src/main/ipc/filesystem/filesystem-git-pull-request-generation-handlers.ts +++ b/src/main/ipc/filesystem/filesystem-git-pull-request-generation-handlers.ts @@ -4,22 +4,22 @@ import { } from '../../../shared/text-generation-failure-copy' import { ipcMain } from 'electron' import type { GlobalSettings } from '../../../shared/global-settings-types' -import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control-ai' -import type { HostedReviewProvider } from '../../../shared/hosted-review' +import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control/ai/source-control-ai-operation-resolution' +import type { HostedReviewProvider } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import { cancelGeneratePullRequestFieldsLocal, generatePullRequestFieldsFromContext, resolveCommitMessageSettings, type GeneratePullRequestFieldsResult } from '../../text-generation/commit-message-text-generation' -import { getCommitMessageModelDiscoveryHostKey } from '../../../shared/commit-message-host-key' +import { getCommitMessageModelDiscoveryHostKey } from '../../../shared/source-control/ai/generation/commit-message-host-key' import { getPullRequestDraftContext } from '../../text-generation/pull-request-context' import { prepareLocalCommitMessageAgentEnv } from '../../text-generation/commit-message-agent-environment' import { SSH_HOST_NOT_SERVED_MESSAGE } from '../../providers/ssh-host-not-served-error' import { resolveRegisteredWorktreePath } from '../worktrees/removal/registered-worktree-roots-cache' import { getLocalGitOptionsForRegisteredWorktree } from '../local-worktree-runtime-options' import { gitExecFileAsync } from '../../git/runner' -import { withLinkedIssueDraftContext } from '../../../shared/source-control-ai-action-variables' +import { withLinkedIssueDraftContext } from '../../../shared/source-control/ai/recipes/source-control-ai-action-variables' import { resolveSourceControlAiLinkedIssueMeta } from '../source-control/source-control-ai-linked-issue' import { resolveHostedReviewBodyForGeneration } from '../../source-control/pull-request-template' import { loadPullRequestLinkedIssue } from '../../source-control/pull-request-linked-issue' diff --git a/src/main/ipc/filesystem/filesystem-git-status-handlers.ts b/src/main/ipc/filesystem/filesystem-git-status-handlers.ts index 1b51400bfc5..7d20c9d7227 100644 --- a/src/main/ipc/filesystem/filesystem-git-status-handlers.ts +++ b/src/main/ipc/filesystem/filesystem-git-status-handlers.ts @@ -3,9 +3,12 @@ import type { GitConflictOperation, GitStagingArea, GitStatusResult -} from '../../../shared/git-status-types' -import type { GitDiffResult } from '../../../shared/git-diff-compare-types' -import type { GitHistoryOptions, GitHistoryResult } from '../../../shared/git-history' +} from '../../../shared/git/status/git-status-types' +import type { GitDiffResult } from '../../../shared/git/diff/git-diff-compare-types' +import type { + GitHistoryOptions, + GitHistoryResult +} from '../../../shared/git/history/git-history-types' import type { GitStatusRefBindingRequest as GitStatusUpstreamRefWatchRequest } from '../worktrees/git/worktree-git-status-ref-watch' import type { GitAdmissionTier } from '../../git/command-runner/git-exec-options' import { getStatus } from '../../git/source-control/status-read' @@ -18,7 +21,7 @@ import { import { getDiff } from '../../git/source-control/file-diff' import { getHistory } from '../../git/history' import { isGitWorktreeMutationInFlight } from '../../git/command-runner/git-worktree-mutation-state' -import type { GitMutationInFlight } from '../../../shared/git-mutation-in-flight' +import type { GitMutationInFlight } from '../../../shared/git/commands/git-mutation-in-flight' import { checkIgnoredPaths } from '../../git/source-control/check-ignored-paths' import { appendFolderToGitignore, diff --git a/src/main/ipc/filesystem/git-remote/compare-handlers.ts b/src/main/ipc/filesystem/git-remote/compare-handlers.ts index 9c4142d8d5a..47788dce98a 100644 --- a/src/main/ipc/filesystem/git-remote/compare-handlers.ts +++ b/src/main/ipc/filesystem/git-remote/compare-handlers.ts @@ -2,7 +2,7 @@ import { ipcMain } from 'electron' import type { GitBranchCompareResult, GitCommitCompareResult -} from '../../../../shared/git-diff-compare-types' +} from '../../../../shared/git/diff/git-diff-compare-types' import { getBranchCompare } from '../../../git/source-control/branch-compare' import { getCommitCompare } from '../../../git/source-control/commit-compare' import { resolveRegisteredWorktreePath } from '../../worktrees/removal/registered-worktree-roots-cache' diff --git a/src/main/ipc/filesystem/git-remote/sync-handlers.ts b/src/main/ipc/filesystem/git-remote/sync-handlers.ts index 9fd0aeeea5d..07da5e284b7 100644 --- a/src/main/ipc/filesystem/git-remote/sync-handlers.ts +++ b/src/main/ipc/filesystem/git-remote/sync-handlers.ts @@ -2,16 +2,16 @@ import { ipcMain } from 'electron' import type { GitForkSyncExpectedUpstream, GitForkSyncResult -} from '../../../../shared/git-fork-sync' +} from '../../../../shared/git/remotes/git-fork-sync' import type { GitPushTarget } from '../../../../shared/worktree/types' -import type { GitUpstreamStatus } from '../../../../shared/git-status-types' +import type { GitUpstreamStatus } from '../../../../shared/git/status/git-status-types' import { gitFetch } from '../../../git/remote' import { gitSyncForkDefaultBranch } from '../../../git/fork-sync' import { getUpstreamStatus } from '../../../git/source-control/upstream' import { validateGitPushTarget } from '../../../git/push-target-validation' import { resolveRegisteredWorktreePath } from '../../worktrees/removal/registered-worktree-roots-cache' import { getLocalGitOptionsForRegisteredWorktree } from '../../local-worktree-runtime-options' -import { validateGitForkSyncExpectedUpstream } from '../../../../shared/git-fork-sync' +import { validateGitForkSyncExpectedUpstream } from '../../../../shared/git/remotes/git-fork-sync' import { ipcGitWorktreeTarget, materializeWorktreePushTargetRemote } from '../../worktree-remote' import type { FilesystemHandlerContext } from '../filesystem-handler-context' import { requireReachableGitRoute } from '../../../providers/execution-host-provider-dispatch' diff --git a/src/main/ipc/repos/repo-clone-lifecycle.ts b/src/main/ipc/repos/repo-clone-lifecycle.ts index 60a02d02b94..93cb4e682ef 100644 --- a/src/main/ipc/repos/repo-clone-lifecycle.ts +++ b/src/main/ipc/repos/repo-clone-lifecycle.ts @@ -7,7 +7,7 @@ import type { Store } from '../../persistence/loading-store/store' import type { Repo } from '../../../shared/repo-types' import { isFolderRepo } from '../../../shared/repo-kind' import { DEFAULT_REPO_BADGE_COLOR } from '../../../shared/constants' -import { getGitCloneFailureMessage } from '../../../shared/git-clone-failure-message' +import { getGitCloneFailureMessage } from '../../../shared/git/remotes/git-clone-failure-message' import { gitSpawnAfterWindowsEnvironmentReady, promptGuardGitEnv } from '../../git/runner' import { reuseSavedCloneTarget } from '../../git/saved-clone-target' import { getRepoName } from '../../git/repo' diff --git a/src/main/ipc/repos/repo-update-handler.ts b/src/main/ipc/repos/repo-update-handler.ts index 4ca6adfd350..76461f0ba37 100644 --- a/src/main/ipc/repos/repo-update-handler.ts +++ b/src/main/ipc/repos/repo-update-handler.ts @@ -10,7 +10,7 @@ import { normalizeRepoBadgeColor } from '../../../shared/repo-badge-color' import { sanitizeRepoIcon } from '../../../shared/repo-icon' import { normalizeGhAccountBinding } from '../../../shared/github/account-binding' import type { GhAccountBinding } from '../../../shared/github/account-binding' -import { normalizeRepoSourceControlAiOverrides } from '../../../shared/source-control-ai' +import { normalizeRepoSourceControlAiOverrides } from '../../../shared/source-control/ai/settings/source-control-ai-repo-settings' import { normalizeCustomWorktreeVisibilitySources, normalizeWorktreeVisibilitySourcePreferences diff --git a/src/main/ipc/settings.ts b/src/main/ipc/settings.ts index 7ce771dbeaa..34a19339f83 100644 --- a/src/main/ipc/settings.ts +++ b/src/main/ipc/settings.ts @@ -28,7 +28,7 @@ import { normalizeDesktopTerminalScrollbackRows } from '../../shared/terminal-sc import { normalizeTerminalLineHeight } from '../../shared/terminal-line-height-settings' import { prepareLocalWorktreeRootsForRepos } from '../workspaces/creation/worktree-root-preparation' import { scheduleCurrentWorktreeBaseDirectoryWatcherSync } from './worktrees/creation/worktree-base-directory-watcher' -import { applyPRBotAuthorOverride } from '../../shared/pr-bot-author-overrides' +import { applyPRBotAuthorOverride } from '../../shared/source-control/review-comments/pr-bot-author-overrides' import { resolveEnvironment } from '../../shared/runtime-environment-store' import { readSettingsWithRuntimeEnvironmentPreference } from './runtime-environments/runtime-environment-preference' import { haveSameDisabledTuiAgents } from '../../shared/agent-launch/catalog/tui-agent-selection' diff --git a/src/main/ipc/source-control/gitlab-ci-job-handlers.ts b/src/main/ipc/source-control/gitlab-ci-job-handlers.ts index c276ec39cd6..ad37b271fdf 100644 --- a/src/main/ipc/source-control/gitlab-ci-job-handlers.ts +++ b/src/main/ipc/source-control/gitlab-ci-job-handlers.ts @@ -1,5 +1,5 @@ import { ipcMain } from 'electron' -import { toGitLabJobLogExcerptResult } from '../../../shared/gitlab-job-log-excerpt' +import { toGitLabJobLogExcerptResult } from '../../../shared/source-control/checks/gitlab/gitlab-job-log-excerpt' import type { Store } from '../../persistence/loading-store/store' import { getJobTrace, retryJob } from '../../gitlab/pipeline-job-mutations' import type { ProjectRef } from '../../gitlab/project-ref-parser' diff --git a/src/main/ipc/source-control/hosted-review.test.ts b/src/main/ipc/source-control/hosted-review.test.ts index 112ca12e95f..e9c8e69b88e 100644 --- a/src/main/ipc/source-control/hosted-review.test.ts +++ b/src/main/ipc/source-control/hosted-review.test.ts @@ -69,7 +69,7 @@ vi.mock('../../workspaces/catalog/repo-worktrees', () => ({ import { registerHostedReviewHandlers } from './hosted-review' import { readHostedReviewForBranch } from '../../source-control/hosted-review' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import { WslDistroStoppedError } from '../../wsl/filesystem/wsl-unc-access-gate' import { WorktreeCatalogUnavailableError } from '../../../shared/worktree/worktree-catalog-availability' diff --git a/src/main/ipc/source-control/hosted-review.ts b/src/main/ipc/source-control/hosted-review.ts index 2623ae0004a..94f41faffa2 100644 --- a/src/main/ipc/source-control/hosted-review.ts +++ b/src/main/ipc/source-control/hosted-review.ts @@ -15,7 +15,7 @@ import { type HostedReviewCreationEligibilityArgs, type HostedReviewForBranchArgs, hostedReviewForBranchReply -} from '../../../shared/hosted-review' +} from '../../../shared/source-control/hosted-review/hosted-review-contracts' import { readHostedReviewForBranch } from '../../source-control/hosted-review' import { resolveRegisteredWorktreePath } from '../worktrees/removal/registered-worktree-roots-cache' import { listRepoWorktreeGraph } from '../../workspaces/catalog/repo-worktrees' diff --git a/src/main/ipc/source-control/source-control-ai-linked-issue.ts b/src/main/ipc/source-control/source-control-ai-linked-issue.ts index c200a4b5e15..65eca44b216 100644 --- a/src/main/ipc/source-control/source-control-ai-linked-issue.ts +++ b/src/main/ipc/source-control/source-control-ai-linked-issue.ts @@ -1,6 +1,6 @@ import { resolve } from 'node:path' import type { Store } from '../../persistence/loading-store/store' -import { isLinkedIssueNumber } from '../../../shared/source-control-ai-action-variables' +import { isLinkedIssueNumber } from '../../../shared/source-control/ai/recipes/source-control-ai-action-variables' import type { WorktreeMeta } from '../../../shared/worktree/meta-types' import { splitWorktreeIdForFilesystem } from '../../../shared/worktree/id' diff --git a/src/main/ipc/workspace-cleanup/workspace-cleanup-activity.ts b/src/main/ipc/workspace-cleanup/workspace-cleanup-activity.ts index 39abd5e245c..736238c6387 100644 --- a/src/main/ipc/workspace-cleanup/workspace-cleanup-activity.ts +++ b/src/main/ipc/workspace-cleanup/workspace-cleanup-activity.ts @@ -1,7 +1,7 @@ import { lstat, open, readFile } from 'node:fs/promises' import path from 'node:path' import type { Worktree } from '../../../shared/worktree/types' -import { resolveGitMetadataPath } from '../../../shared/git-metadata-path' +import { resolveGitMetadataPath } from '../../../shared/git/metadata/git-metadata-path' import { getPersistedWorkspaceCleanupActivityAt } from '../../../shared/workspace-cleanup' import type { WorkspaceCleanupGitRoute } from './workspace-cleanup-git-route' diff --git a/src/main/ipc/workspace-cleanup/workspace-cleanup-broad-scan.test.ts b/src/main/ipc/workspace-cleanup/workspace-cleanup-broad-scan.test.ts index 419a6431025..fb1f72f81a1 100644 --- a/src/main/ipc/workspace-cleanup/workspace-cleanup-broad-scan.test.ts +++ b/src/main/ipc/workspace-cleanup/workspace-cleanup-broad-scan.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import path from 'node:path' import type { Store } from '../../persistence/loading-store/store' import type * as RepoWorktreesModule from '../../workspaces/catalog/repo-worktrees' -import type { GitStatusResult } from '../../../shared/git-status-types' +import type { GitStatusResult } from '../../../shared/git/status/git-status-types' import type { Repo } from '../../../shared/repo-types' import type { GitWorktreeInfo } from '../../../shared/worktree/types' import type { WorktreeMeta } from '../../../shared/worktree/meta-types' diff --git a/src/main/ipc/workspace-cleanup/workspace-cleanup-document-lifetime.test.ts b/src/main/ipc/workspace-cleanup/workspace-cleanup-document-lifetime.test.ts index d52829a28f9..271fcf96c34 100644 --- a/src/main/ipc/workspace-cleanup/workspace-cleanup-document-lifetime.test.ts +++ b/src/main/ipc/workspace-cleanup/workspace-cleanup-document-lifetime.test.ts @@ -1,6 +1,6 @@ import { EventEmitter } from 'node:events' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { GitStatusResult } from '../../../shared/git-status-types' +import type { GitStatusResult } from '../../../shared/git/status/git-status-types' import type { GitWorktreeInfo } from '../../../shared/worktree/types' import type * as RepoWorktrees from '../../workspaces/catalog/repo-worktrees' diff --git a/src/main/ipc/workspace-cleanup/workspace-cleanup-execution-host-routing.test.ts b/src/main/ipc/workspace-cleanup/workspace-cleanup-execution-host-routing.test.ts index 6aa377f14b9..701b75b0cbd 100644 --- a/src/main/ipc/workspace-cleanup/workspace-cleanup-execution-host-routing.test.ts +++ b/src/main/ipc/workspace-cleanup/workspace-cleanup-execution-host-routing.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { Store } from '../../persistence/loading-store/store' -import type { GitStatusResult } from '../../../shared/git-status-types' +import type { GitStatusResult } from '../../../shared/git/status/git-status-types' import type { Repo } from '../../../shared/repo-types' import type { WorktreeMeta } from '../../../shared/worktree/meta-types' diff --git a/src/main/ipc/workspace-cleanup/workspace-cleanup-git-evidence.ts b/src/main/ipc/workspace-cleanup/workspace-cleanup-git-evidence.ts index a8c5c9b8160..7d5e81b1ba0 100644 --- a/src/main/ipc/workspace-cleanup/workspace-cleanup-git-evidence.ts +++ b/src/main/ipc/workspace-cleanup/workspace-cleanup-git-evidence.ts @@ -1,6 +1,6 @@ import { getStatus } from '../../git/source-control/status-read' import { gitExecFileAsync } from '../../git/command-runner/git-exec-file' -import type { GitStatusResult } from '../../../shared/git-status-types' +import type { GitStatusResult } from '../../../shared/git/status/git-status-types' import type { Repo } from '../../../shared/repo-types' import type { Worktree } from '../../../shared/worktree/types' import type { WorkspaceCleanupBlocker } from '../../../shared/workspace-cleanup' diff --git a/src/main/ipc/workspace-cleanup/workspace-cleanup.test.ts b/src/main/ipc/workspace-cleanup/workspace-cleanup.test.ts index 245ee2d82e5..c2c445279b1 100644 --- a/src/main/ipc/workspace-cleanup/workspace-cleanup.test.ts +++ b/src/main/ipc/workspace-cleanup/workspace-cleanup.test.ts @@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { ipcMain } from 'electron' import type { Store } from '../../persistence/loading-store/store' import type { DiffComment } from '../../../shared/diff-comment-types' -import type { GitStatusResult } from '../../../shared/git-status-types' +import type { GitStatusResult } from '../../../shared/git/status/git-status-types' import type { Repo } from '../../../shared/repo-types' import type { WorktreeMeta } from '../../../shared/worktree/meta-types' import type { GitWorktreeInfo } from '../../../shared/worktree/types' diff --git a/src/main/ipc/worktree-branch-name.ts b/src/main/ipc/worktree-branch-name.ts index bf6786abe0c..5922b3d4249 100644 --- a/src/main/ipc/worktree-branch-name.ts +++ b/src/main/ipc/worktree-branch-name.ts @@ -4,7 +4,7 @@ import { normalizeBranchPrefix, selectBranchPrefixInput, type BranchPrefixSettings -} from '../../shared/branch-prefix' +} from '../../shared/git/branches/branch-prefix' /** Expose a normalized prefix so callers avoid double-prefixing and invalid slash combinations. */ export function getConfiguredBranchPrefix( diff --git a/src/main/ipc/worktree-remote.ts b/src/main/ipc/worktree-remote.ts index 3c99d11c8ef..1647b10a362 100644 --- a/src/main/ipc/worktree-remote.ts +++ b/src/main/ipc/worktree-remote.ts @@ -91,7 +91,7 @@ import { getRepoExecutionHostId, type ExecutionHostId } from '../../shared/execution-host' -import type { BranchPrefixSettings } from '../../shared/branch-prefix' +import type { BranchPrefixSettings } from '../../shared/git/branches/branch-prefix' import { parseWorkspaceKey, worktreeWorkspaceKey } from '../../shared/workspace-scope' import { sharesWorktreeLineageBoundary } from '../../shared/resolved-worktree-lineage' import { diff --git a/src/main/ipc/worktrees-authoritative-local-metadata-pruning.test.ts b/src/main/ipc/worktrees-authoritative-local-metadata-pruning.test.ts index 51ad53f1aef..69771cee777 100644 --- a/src/main/ipc/worktrees-authoritative-local-metadata-pruning.test.ts +++ b/src/main/ipc/worktrees-authoritative-local-metadata-pruning.test.ts @@ -41,7 +41,7 @@ vi.mock('../wsl/discovery/wsl-background-distro-gate', async (importOriginal) => vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -97,6 +97,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-automation-create-terminals.test.ts b/src/main/ipc/worktrees-automation-create-terminals.test.ts index c1f22145881..709696faebf 100644 --- a/src/main/ipc/worktrees-automation-create-terminals.test.ts +++ b/src/main/ipc/worktrees-automation-create-terminals.test.ts @@ -23,7 +23,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -79,6 +79,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-background-removal.test.ts b/src/main/ipc/worktrees-background-removal.test.ts index a8723fa03b4..295e0b54a84 100644 --- a/src/main/ipc/worktrees-background-removal.test.ts +++ b/src/main/ipc/worktrees-background-removal.test.ts @@ -29,7 +29,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -85,6 +85,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-create-event-timing.test.ts b/src/main/ipc/worktrees-create-event-timing.test.ts index 17e1266f0ef..3ad220ac40c 100644 --- a/src/main/ipc/worktrees-create-event-timing.test.ts +++ b/src/main/ipc/worktrees-create-event-timing.test.ts @@ -29,7 +29,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -85,6 +85,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-create-label-only-first-work.test.ts b/src/main/ipc/worktrees-create-label-only-first-work.test.ts index 37488a396de..bc4ccdc4c75 100644 --- a/src/main/ipc/worktrees-create-label-only-first-work.test.ts +++ b/src/main/ipc/worktrees-create-label-only-first-work.test.ts @@ -34,7 +34,7 @@ vi.mock('../text-generation/commit-message-agent-environment', () => ({ vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -90,6 +90,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-create-metadata-persistence.test.ts b/src/main/ipc/worktrees-create-metadata-persistence.test.ts index b6e4917eb09..34194db3908 100644 --- a/src/main/ipc/worktrees-create-metadata-persistence.test.ts +++ b/src/main/ipc/worktrees-create-metadata-persistence.test.ts @@ -78,7 +78,7 @@ vi.mock('../text-generation/commit-message-agent-environment', () => ({ vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -134,6 +134,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-create-registry.test.ts b/src/main/ipc/worktrees-create-registry.test.ts index 277927fcc6c..06801ce6d83 100644 --- a/src/main/ipc/worktrees-create-registry.test.ts +++ b/src/main/ipc/worktrees-create-registry.test.ts @@ -18,7 +18,7 @@ vi.mock('../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MA vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -74,6 +74,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-delete-pty-teardown.test.ts b/src/main/ipc/worktrees-delete-pty-teardown.test.ts index 05acafb63b2..0974850fdd4 100644 --- a/src/main/ipc/worktrees-delete-pty-teardown.test.ts +++ b/src/main/ipc/worktrees-delete-pty-teardown.test.ts @@ -28,7 +28,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -84,6 +84,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-detected-scan-cache.test.ts b/src/main/ipc/worktrees-detected-scan-cache.test.ts index 56ef1beefc4..8c10a4268ce 100644 --- a/src/main/ipc/worktrees-detected-scan-cache.test.ts +++ b/src/main/ipc/worktrees-detected-scan-cache.test.ts @@ -27,7 +27,7 @@ vi.mock('../wsl/discovery/wsl-background-distro-gate', async (importOriginal) => vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -83,6 +83,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-discovery-metadata-backfill.test.ts b/src/main/ipc/worktrees-discovery-metadata-backfill.test.ts index 671fb4bea57..7bbf5a00d53 100644 --- a/src/main/ipc/worktrees-discovery-metadata-backfill.test.ts +++ b/src/main/ipc/worktrees-discovery-metadata-backfill.test.ts @@ -18,7 +18,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -74,6 +74,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-existing-branch-checkout.test.ts b/src/main/ipc/worktrees-existing-branch-checkout.test.ts index f5c44808ca7..3e4d963ce61 100644 --- a/src/main/ipc/worktrees-existing-branch-checkout.test.ts +++ b/src/main/ipc/worktrees-existing-branch-checkout.test.ts @@ -23,7 +23,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -79,6 +79,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-failed-removal.test.ts b/src/main/ipc/worktrees-failed-removal.test.ts index 7496f270352..f55357c35fa 100644 --- a/src/main/ipc/worktrees-failed-removal.test.ts +++ b/src/main/ipc/worktrees-failed-removal.test.ts @@ -39,7 +39,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -90,6 +90,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-forget-local.test.ts b/src/main/ipc/worktrees-forget-local.test.ts index a26a90ba491..cf4955b65d8 100644 --- a/src/main/ipc/worktrees-forget-local.test.ts +++ b/src/main/ipc/worktrees-forget-local.test.ts @@ -33,7 +33,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -89,6 +89,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-issue-command-overrides.test.ts b/src/main/ipc/worktrees-issue-command-overrides.test.ts index 4994c83d312..d6ea678d6c5 100644 --- a/src/main/ipc/worktrees-issue-command-overrides.test.ts +++ b/src/main/ipc/worktrees-issue-command-overrides.test.ts @@ -22,7 +22,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -78,6 +78,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-lineage-hydration.test.ts b/src/main/ipc/worktrees-lineage-hydration.test.ts index ff7691ab5c6..63a63394c31 100644 --- a/src/main/ipc/worktrees-lineage-hydration.test.ts +++ b/src/main/ipc/worktrees-lineage-hydration.test.ts @@ -22,7 +22,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -78,6 +78,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-listing-fallback-rows.test.ts b/src/main/ipc/worktrees-listing-fallback-rows.test.ts index 754121d8064..f76ef451432 100644 --- a/src/main/ipc/worktrees-listing-fallback-rows.test.ts +++ b/src/main/ipc/worktrees-listing-fallback-rows.test.ts @@ -21,7 +21,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -77,6 +77,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-local-base-ref-resolution.test.ts b/src/main/ipc/worktrees-local-base-ref-resolution.test.ts index 7d44783c086..9a3d1a5d8ab 100644 --- a/src/main/ipc/worktrees-local-base-ref-resolution.test.ts +++ b/src/main/ipc/worktrees-local-base-ref-resolution.test.ts @@ -6,7 +6,6 @@ import { listWorktreesMock, addWorktreeMock, resolveDefaultBaseRefWithLocalGitMock, - resolveDefaultBaseRefViaExecMock, gitExecFileAsyncMock } from './worktrees-test-module-mocks' import { handlers, setupWorktreeHandlers, store } from './worktrees-test-harness' @@ -26,7 +25,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -82,6 +81,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock @@ -495,7 +495,7 @@ describe('registerWorktreeHandlers', () => { ) expect(addWorktreeMock).not.toHaveBeenCalled() - expect(resolveDefaultBaseRefViaExecMock).not.toHaveBeenCalled() + expect(resolveDefaultBaseRefWithLocalGitMock).not.toHaveBeenCalled() }) it('delegates remote-tracking base freshness to the runtime before create', async () => { diff --git a/src/main/ipc/worktrees-local-create-flow.test.ts b/src/main/ipc/worktrees-local-create-flow.test.ts index a5d6d106cd9..fb253ff17ea 100644 --- a/src/main/ipc/worktrees-local-create-flow.test.ts +++ b/src/main/ipc/worktrees-local-create-flow.test.ts @@ -41,7 +41,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -97,6 +97,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-local-create-path-claim.test.ts b/src/main/ipc/worktrees-local-create-path-claim.test.ts index 3425eb0d690..e272d43794b 100644 --- a/src/main/ipc/worktrees-local-create-path-claim.test.ts +++ b/src/main/ipc/worktrees-local-create-path-claim.test.ts @@ -19,7 +19,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -75,6 +75,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-mutation-scan-generation-order.test.ts b/src/main/ipc/worktrees-mutation-scan-generation-order.test.ts index 9d7a4e70277..7f909b023c7 100644 --- a/src/main/ipc/worktrees-mutation-scan-generation-order.test.ts +++ b/src/main/ipc/worktrees-mutation-scan-generation-order.test.ts @@ -25,7 +25,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -81,6 +81,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-orphan-directory-cleanup.test.ts b/src/main/ipc/worktrees-orphan-directory-cleanup.test.ts index 54d3a3dfab6..c37c5e2c68f 100644 --- a/src/main/ipc/worktrees-orphan-directory-cleanup.test.ts +++ b/src/main/ipc/worktrees-orphan-directory-cleanup.test.ts @@ -29,7 +29,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -85,6 +85,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-removal-recovery.test.ts b/src/main/ipc/worktrees-removal-recovery.test.ts index c44067ce46b..bb9382738cd 100644 --- a/src/main/ipc/worktrees-removal-recovery.test.ts +++ b/src/main/ipc/worktrees-removal-recovery.test.ts @@ -60,7 +60,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -116,6 +116,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-remove-archive-hooks.test.ts b/src/main/ipc/worktrees-remove-archive-hooks.test.ts index d141f32c145..a051eb80d05 100644 --- a/src/main/ipc/worktrees-remove-archive-hooks.test.ts +++ b/src/main/ipc/worktrees-remove-archive-hooks.test.ts @@ -34,7 +34,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -90,6 +90,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-remove-preflight.test.ts b/src/main/ipc/worktrees-remove-preflight.test.ts index 902a0861940..e689f5b512c 100644 --- a/src/main/ipc/worktrees-remove-preflight.test.ts +++ b/src/main/ipc/worktrees-remove-preflight.test.ts @@ -29,7 +29,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -85,6 +85,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-setup-launch-sparse-checkout.test.ts b/src/main/ipc/worktrees-setup-launch-sparse-checkout.test.ts index d4b9935c5e3..4d7ac62fa65 100644 --- a/src/main/ipc/worktrees-setup-launch-sparse-checkout.test.ts +++ b/src/main/ipc/worktrees-setup-launch-sparse-checkout.test.ts @@ -26,7 +26,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -82,6 +82,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-ssh-pr-head-fetch.test.ts b/src/main/ipc/worktrees-ssh-pr-head-fetch.test.ts index 03dbbd333e2..b2697865451 100644 --- a/src/main/ipc/worktrees-ssh-pr-head-fetch.test.ts +++ b/src/main/ipc/worktrees-ssh-pr-head-fetch.test.ts @@ -19,7 +19,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -75,6 +75,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts b/src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts index 70ac4e6d675..d4a529966f6 100644 --- a/src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts +++ b/src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts @@ -33,7 +33,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -89,6 +89,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-test-harness.ts b/src/main/ipc/worktrees-test-harness.ts index c5ad9af6ec9..c3423e6a947 100644 --- a/src/main/ipc/worktrees-test-harness.ts +++ b/src/main/ipc/worktrees-test-harness.ts @@ -28,7 +28,6 @@ import { resolveLocalGitUsernameMock, getBaseRefDefaultMock, resolveDefaultBaseRefWithLocalGitMock, - resolveDefaultBaseRefViaExecMock, getDefaultRemoteMock, getBranchConflictKindMock, getPRForBranchMock, @@ -100,7 +99,6 @@ export function setupWorktreeHandlers(): WorktreeRuntimeStub { resolveLocalGitUsernameMock, getBaseRefDefaultMock, resolveDefaultBaseRefWithLocalGitMock, - resolveDefaultBaseRefViaExecMock, getDefaultRemoteMock, getBranchConflictKindMock, getPRForBranchMock, @@ -225,7 +223,6 @@ export function setupWorktreeHandlers(): WorktreeRuntimeStub { resolveLocalGitUsernameMock.mockResolvedValue('') getBaseRefDefaultMock.mockResolvedValue('origin/main') resolveDefaultBaseRefWithLocalGitMock.mockResolvedValue('origin/main') - resolveDefaultBaseRefViaExecMock.mockResolvedValue('origin/main') getDefaultRemoteMock.mockResolvedValue('origin') getBranchConflictKindMock.mockResolvedValue(null) getPRForBranchMock.mockResolvedValue(null) diff --git a/src/main/ipc/worktrees-test-module-mocks.ts b/src/main/ipc/worktrees-test-module-mocks.ts index 0316a7a983f..1eaf4a4041f 100644 --- a/src/main/ipc/worktrees-test-module-mocks.ts +++ b/src/main/ipc/worktrees-test-module-mocks.ts @@ -53,7 +53,6 @@ export const forceDeleteLocalBranchMock: ModuleMock = vi.fn() export const resolveLocalGitUsernameMock: ModuleMock = vi.fn() export const getBaseRefDefaultMock: ModuleMock = vi.fn() export const resolveDefaultBaseRefWithLocalGitMock: ModuleMock = vi.fn() -export const resolveDefaultBaseRefViaExecMock: ModuleMock = vi.fn() export const getDefaultRemoteMock: ModuleMock = vi.fn() export const getBranchConflictKindMock: RepoBranchMock = vi.fn() export const getPRForBranchMock: RepoBranchMock = vi.fn() @@ -123,7 +122,6 @@ export const gitRunnerModuleMock = (): { export const gitRepoModuleMock = () => ({ getBaseRefDefault: getBaseRefDefaultMock, resolveDefaultBaseRefWithLocalGit: resolveDefaultBaseRefWithLocalGitMock, - resolveDefaultBaseRefViaExec: resolveDefaultBaseRefViaExecMock, getDefaultRemote: getDefaultRemoteMock, getBranchConflictKind: async ( repoPath: string, diff --git a/src/main/ipc/worktrees-windows.test.ts b/src/main/ipc/worktrees-windows.test.ts index 576a29e5b60..893772472e9 100644 --- a/src/main/ipc/worktrees-windows.test.ts +++ b/src/main/ipc/worktrees-windows.test.ts @@ -12,7 +12,6 @@ const { resolveLocalGitUsernameMock, getDefaultBaseRefMock, resolveDefaultBaseRefWithLocalGitMock, - resolveDefaultBaseRefViaExecMock, getBranchConflictKindMock, getPRForBranchMock, createGitHubPullRequestMock, @@ -41,7 +40,6 @@ const { resolveLocalGitUsernameMock: vi.fn(), getDefaultBaseRefMock: vi.fn(), resolveDefaultBaseRefWithLocalGitMock: vi.fn(), - resolveDefaultBaseRefViaExecMock: vi.fn(), getBranchConflictKindMock: vi.fn(), getPRForBranchMock: vi.fn(), createGitHubPullRequestMock: vi.fn(), @@ -130,7 +128,6 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', () => ({ getDefaultBaseRef: getDefaultBaseRefMock, resolveDefaultBaseRefWithLocalGit: resolveDefaultBaseRefWithLocalGitMock, - resolveDefaultBaseRefViaExec: resolveDefaultBaseRefViaExecMock, getBranchConflictKind: getBranchConflictKindMock })) @@ -225,7 +222,6 @@ describe('registerWorktreeHandlers – Windows path handling', () => { resolveLocalGitUsernameMock.mockReset() getDefaultBaseRefMock.mockReset() resolveDefaultBaseRefWithLocalGitMock.mockReset() - resolveDefaultBaseRefViaExecMock.mockReset() getBranchConflictKindMock.mockReset() getPRForBranchMock.mockReset() createGitHubPullRequestMock.mockReset() @@ -315,7 +311,6 @@ describe('registerWorktreeHandlers – Windows path handling', () => { resolveLocalGitUsernameMock.mockResolvedValue('') getDefaultBaseRefMock.mockReturnValue('origin/main') resolveDefaultBaseRefWithLocalGitMock.mockResolvedValue('origin/main') - resolveDefaultBaseRefViaExecMock.mockResolvedValue('origin/main') getBranchConflictKindMock.mockResolvedValue(null) getPRForBranchMock.mockResolvedValue(null) getEffectiveHooksMock.mockReturnValue(null) diff --git a/src/main/ipc/worktrees-wsl-move-fence.test.ts b/src/main/ipc/worktrees-wsl-move-fence.test.ts index 05bdc4a7604..d3578f809c3 100644 --- a/src/main/ipc/worktrees-wsl-move-fence.test.ts +++ b/src/main/ipc/worktrees-wsl-move-fence.test.ts @@ -38,7 +38,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -94,6 +94,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees-wsl-runtime-routing.test.ts b/src/main/ipc/worktrees-wsl-runtime-routing.test.ts index 0dc2b6e9b8a..09e96173a2d 100644 --- a/src/main/ipc/worktrees-wsl-runtime-routing.test.ts +++ b/src/main/ipc/worktrees-wsl-runtime-routing.test.ts @@ -49,7 +49,7 @@ vi.mock('../wsl/discovery/wsl-background-distro-gate', async (importOriginal) => vi.mock('electron', async () => (await import('./worktrees-test-module-mocks')).electronModuleMock() ) -vi.mock('../../shared/git-worktree-porcelain-parser', async (importOriginal) => ({ +vi.mock('../../shared/git/worktrees/git-worktree-porcelain-parser', async (importOriginal) => ({ ...(await importOriginal>()), parseWorktreeList: (await import('./worktrees-test-module-mocks')).parseWorktreeListMock })) @@ -105,6 +105,7 @@ vi.mock('../git/command-runner/git-exec-file-sync', async (importOriginal) => ({ vi.mock('../git/repo', async () => (await import('./worktrees-test-module-mocks')).gitRepoModuleMock() ) + vi.mock('../git/repo-default-base-ref', async (importOriginal) => ({ ...(await importOriginal>()), getBaseRefDefault: (await import('./worktrees-test-module-mocks')).getBaseRefDefaultMock diff --git a/src/main/ipc/worktrees/git/worktree-git-status-ref-watch.ts b/src/main/ipc/worktrees/git/worktree-git-status-ref-watch.ts index b55fb420a84..e56484d5609 100644 --- a/src/main/ipc/worktrees/git/worktree-git-status-ref-watch.ts +++ b/src/main/ipc/worktrees/git/worktree-git-status-ref-watch.ts @@ -1,5 +1,5 @@ import { resolveRuntimePath } from '../../../../shared/cross-platform-path' -import { isSafeGitStatusUpstreamRef } from '../../../../shared/git-status-upstream-ref' +import { isSafeGitStatusUpstreamRef } from '../../../../shared/git/status/git-status-upstream-ref' import { getRepoIdFromWorktreeId } from '../../../../shared/worktree/id' import { pathRelativeToWorktreeWatchRoot, diff --git a/src/main/ipc/worktrees/removal/preserved-branch-cleanup.ts b/src/main/ipc/worktrees/removal/preserved-branch-cleanup.ts index 948e997ccd0..d92b3902bdc 100644 --- a/src/main/ipc/worktrees/removal/preserved-branch-cleanup.ts +++ b/src/main/ipc/worktrees/removal/preserved-branch-cleanup.ts @@ -1,7 +1,7 @@ import type { RemoveWorktreeResult } from '../../../../shared/worktree/create-types' import type { ExecutionHostId } from '../../../../shared/execution-host' import type { GitPushTarget } from '../../../../shared/worktree/types' -import { preservedBranchCleanupScopeKey } from '../../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupScopeKey } from '../../../../shared/git/branches/preserved-branch-cleanup' export type PreservedBranchCleanupTarget = { worktreeId: string diff --git a/src/main/ipc/worktrees/removal/register-worktree-forget-handlers.ts b/src/main/ipc/worktrees/removal/register-worktree-forget-handlers.ts index b6efd2d6332..896d94bd532 100644 --- a/src/main/ipc/worktrees/removal/register-worktree-forget-handlers.ts +++ b/src/main/ipc/worktrees/removal/register-worktree-forget-handlers.ts @@ -13,7 +13,7 @@ import { getLocalPtyProvider } from '../../pty/provider/registry' import { clearProviderPtyState } from '../../pty/provider/state-cleanup' import { killAllProcessesForWorktree } from '../../../runtime/worktree-teardown' import { invalidateAuthorizedRootsCache } from './registered-worktree-roots-cache' -import { preservedBranchCleanupScopeKey } from '../../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupScopeKey } from '../../../../shared/git/branches/preserved-branch-cleanup' import { notifyWorktreesChanged, cleanupUnusedWorktreePushTargetRemote diff --git a/src/main/ipc/worktrees/removal/remove-folder-workspace.ts b/src/main/ipc/worktrees/removal/remove-folder-workspace.ts index 1e51ba8c579..91245648722 100644 --- a/src/main/ipc/worktrees/removal/remove-folder-workspace.ts +++ b/src/main/ipc/worktrees/removal/remove-folder-workspace.ts @@ -3,7 +3,7 @@ import { parseExecutionHostId, type ExecutionHostId } from '../../../../shared/e import type { RemoveWorktreeResult } from '../../../../shared/worktree/create-types' import { killAllProcessesForWorktree } from '../../../runtime/worktree-teardown' import { withWorktreeRemoveStageSpan } from '../../../observability/instrumentation' -import { preservedBranchCleanupScopeKey } from '../../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupScopeKey } from '../../../../shared/git/branches/preserved-branch-cleanup' import { notifyWorktreesChanged } from '../../worktree-remote' import { clearProviderPtyState } from '../../pty/provider/state-cleanup' import { getLocalPtyProvider } from '../../pty/provider/registry' diff --git a/src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts b/src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts index beb06236ded..19a5a367aa7 100644 --- a/src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts +++ b/src/main/ipc/worktrees/removal/remove-registered-local-worktree.ts @@ -36,7 +36,7 @@ import { removeWorktreeMetadataAndTransientState, stopPtysForDestructiveWorktreeRemoval } from './worktree-removal-ownership' -import { preservedBranchCleanupScopeKey } from '../../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupScopeKey } from '../../../../shared/git/branches/preserved-branch-cleanup' import { removesInBackground, startBackgroundWorktreeRemoval diff --git a/src/main/ipc/worktrees/removal/remove-unregistered-worktree.ts b/src/main/ipc/worktrees/removal/remove-unregistered-worktree.ts index 55916349cef..7152845a88f 100644 --- a/src/main/ipc/worktrees/removal/remove-unregistered-worktree.ts +++ b/src/main/ipc/worktrees/removal/remove-unregistered-worktree.ts @@ -6,7 +6,7 @@ import type { RemoveWorktreeResult } from '../../../../shared/worktree/create-ty import type { GitPushTarget, GitWorktreeInfo } from '../../../../shared/worktree/types' import type { WorktreeMeta } from '../../../../shared/worktree/meta-types' import type { LocalProjectWorktreeGitOptions } from '../../../workspaces/execution-host/project-runtime-git-options' -import { preservedBranchCleanupScopeKey } from '../../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupScopeKey } from '../../../../shared/git/branches/preserved-branch-cleanup' import { assertWorktreeDoesNotContainRegisteredWorktree, canCleanupUnregisteredOrcaWorktreeDirectory, diff --git a/src/main/native-chat/structured-chat-naming-execution.test.ts b/src/main/native-chat/structured-chat-naming-execution.test.ts index b20779ca40e..3d6d873da1f 100644 --- a/src/main/native-chat/structured-chat-naming-execution.test.ts +++ b/src/main/native-chat/structured-chat-naming-execution.test.ts @@ -3,7 +3,7 @@ import { AgentSessionJournal } from './agent-session-journal/journal-store' import { computeAgentSessionPayloadFingerprint } from '../../shared/agent-session/lifecycle/agent-session-mutation-envelope' import { structuredChatNamingDeps } from '../runtime/structured-chat-naming-runtime' import { getDefaultSettings } from '../../shared/constants' -import { normalizeSourceControlAiSettings } from '../../shared/source-control-ai-settings' +import { normalizeSourceControlAiSettings } from '../../shared/source-control/ai/settings/source-control-ai-settings' import { setStructuredAgentSessionHost } from './agent-session-wire/structured-agent-session-registry' import * as agentLaunch from '../text-generation/source-control-agent-launch' import * as homeLock from '../codex-cli/codex-home-process-lock' diff --git a/src/main/native-chat/structured-chat-naming.ts b/src/main/native-chat/structured-chat-naming.ts index a02b76dd720..c7a307e080e 100644 --- a/src/main/native-chat/structured-chat-naming.ts +++ b/src/main/native-chat/structured-chat-naming.ts @@ -6,7 +6,7 @@ import type { AgentSessionStatusSummary } from '../../shared/agent-session/agent import { clampConversationNameFirstPrompt, conversationNameSeed -} from '../../shared/conversation-name-generation' +} from '../../shared/source-control/ai/generation/conversation-name-generation' import { hasStructuredChatPromptText } from '../../shared/agent-session/requests/structured-agent-session-first-prompt' import { sliceAtCodeUnitLimit } from '../../shared/surrogate-safe-text-slice' import type { GlobalSettings } from '../../shared/global-settings-types' diff --git a/src/main/persistence/applying-settings/persistence-source-control-ai-migration.test.ts b/src/main/persistence/applying-settings/persistence-source-control-ai-migration.test.ts index 920970bc65e..ef186c469c3 100644 --- a/src/main/persistence/applying-settings/persistence-source-control-ai-migration.test.ts +++ b/src/main/persistence/applying-settings/persistence-source-control-ai-migration.test.ts @@ -13,7 +13,7 @@ import { writeFileSync, readFileSync, rmSync, mkdtempSync, mkdirSync } from 'nod import { join } from 'node:path' import { tmpdir } from 'node:os' import type { PersistedState } from '../../../shared/persisted-state-types' -import { setSourceControlActionDefault } from '../../../shared/source-control-ai-actions' +import { setSourceControlActionDefault } from '../../../shared/source-control/ai/recipes/source-control-ai-actions' const { loadUserSshConfigMock, sshConfigHostsToTargetsMock } = vi.hoisted(() => ({ loadUserSshConfigMock: vi.fn(), diff --git a/src/main/persistence/applying-settings/settings-update.ts b/src/main/persistence/applying-settings/settings-update.ts index cb074b39077..f89144550e7 100644 --- a/src/main/persistence/applying-settings/settings-update.ts +++ b/src/main/persistence/applying-settings/settings-update.ts @@ -22,11 +22,11 @@ import { normalizeTerminalMinimumContrastRatio } from '../../../shared/terminal- import { normalizeTaskProviderSettings } from '../../../shared/task-providers' import { normalizeOpenInApplications } from '../../../shared/open-in-applications' import { normalizeTerminalShortcutPolicy } from '../../../shared/keybindings' -import { normalizeSourceControlGroupOrder } from '../../../shared/source-control-group-order' +import { normalizeSourceControlGroupOrder } from '../../../shared/source-control/listing/source-control-group-order' import { normalizeAppIconId } from '../../../shared/app-icon' import { normalizeUiLanguage } from '../../../shared/ui-language' import { normalizeWorktreeVisibilityDefaults } from '../../../shared/external-worktree-visibility' -import { normalizePRBotAuthorOverrides } from '../../../shared/pr-bot-author-overrides' +import { normalizePRBotAuthorOverrides } from '../../../shared/source-control/review-comments/pr-bot-author-overrides' import { normalizeMachineName } from '../../../shared/machine-name' import type { PersistedState } from '../../../shared/persisted-state-types' import { @@ -34,11 +34,9 @@ import { normalizeMobilePairingCustomAddress, normalizeMobilePairingCustomAddresses } from '../../../shared/mobile-pairing-custom-address' -import { - mergeLegacyCommitMessageAiIntoSourceControlAi, - normalizeSourceControlAiSettings, - projectSourceControlAiToLegacyCommitMessageAi -} from '../../../shared/source-control-ai' +import { mergeLegacyCommitMessageAiIntoSourceControlAi } from '../../../shared/source-control/ai/settings/source-control-ai-legacy-reconciliation' +import { normalizeSourceControlAiSettings } from '../../../shared/source-control/ai/settings/source-control-ai-settings' +import { projectSourceControlAiToLegacyCommitMessageAi } from '../../../shared/source-control/ai/settings/source-control-ai-legacy-projection' import type { ProtectedSecretPersistence } from '../../credentials/protected-secret-persistence' import { normalizeNotificationSettings } from './onboarding-normalization' import { retireLegacyInstructionsForClearedTextActionRecipes } from './source-control-settings' diff --git a/src/main/persistence/applying-settings/source-control-settings.ts b/src/main/persistence/applying-settings/source-control-settings.ts index e3c50679a23..4adb819e970 100644 --- a/src/main/persistence/applying-settings/source-control-settings.ts +++ b/src/main/persistence/applying-settings/source-control-settings.ts @@ -1,9 +1,9 @@ import type { GlobalSettings } from '../../../shared/global-settings-types' -import { normalizeSourceControlAiSettings } from '../../../shared/source-control-ai' +import { normalizeSourceControlAiSettings } from '../../../shared/source-control/ai/settings/source-control-ai-settings' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, SOURCE_CONTROL_TEXT_ACTION_IDS -} from '../../../shared/source-control-ai-actions' +} from '../../../shared/source-control/ai/recipes/source-control-ai-actions' export function retireLegacyInstructionsForClearedTextActionRecipes( sourceControlAi: GlobalSettings['sourceControlAi'], diff --git a/src/main/persistence/loading-store/normalize-loaded-global-settings.ts b/src/main/persistence/loading-store/normalize-loaded-global-settings.ts index c0c747f4924..6d33db07284 100644 --- a/src/main/persistence/loading-store/normalize-loaded-global-settings.ts +++ b/src/main/persistence/loading-store/normalize-loaded-global-settings.ts @@ -1,7 +1,7 @@ import { normalizeAgentDefaultSurface } from '../../../shared/native-chat/native-chat-providers' import { normalizeNativeChatAppearanceSettings } from '../../../shared/native-chat/native-chat-appearance-settings' import { getDefaultVoiceSettings } from '../../../shared/constants' -import { normalizePRBotAuthorOverrides } from '../../../shared/pr-bot-author-overrides' +import { normalizePRBotAuthorOverrides } from '../../../shared/source-control/review-comments/pr-bot-author-overrides' import { normalizeTerminalQuickCommands } from '../../../shared/terminal-quick-commands' import { normalizeOpenInApplications } from '../../../shared/open-in-applications' import { normalizeTerminalShortcutPolicy } from '../../../shared/keybindings' @@ -13,7 +13,7 @@ import { syncLegacyMatchTerminalSidebar } from '../../../shared/plugin-theme-settings' import { normalizeTerminalDefaultShell } from '../../../shared/terminal-default-shell' -import { projectSourceControlAiToLegacyCommitMessageAi } from '../../../shared/source-control-ai' +import { projectSourceControlAiToLegacyCommitMessageAi } from '../../../shared/source-control/ai/settings/source-control-ai-legacy-projection' import { normalizeNativeChatShellEnvironmentVariables } from '../../../shared/native-chat/native-chat-shell-environment' import { publishedLegacyChatPermissionMode } from '../../../shared/agent-launch/permissions/agent-chat-permission-mode' import { diff --git a/src/main/persistence/loading-store/prepare-loaded-profile-settings.ts b/src/main/persistence/loading-store/prepare-loaded-profile-settings.ts index d3c7bac46a5..59575015159 100644 --- a/src/main/persistence/loading-store/prepare-loaded-profile-settings.ts +++ b/src/main/persistence/loading-store/prepare-loaded-profile-settings.ts @@ -10,7 +10,7 @@ import { normalizeMobilePairingCustomAddress, normalizeMobilePairingCustomAddresses } from '../../../shared/mobile-pairing-custom-address' -import { normalizeSourceControlGroupOrder } from '../../../shared/source-control-group-order' +import { normalizeSourceControlGroupOrder } from '../../../shared/source-control/listing/source-control-group-order' import { normalizeProjectGroups } from '../../../shared/project-groups' import { normalizeDisabledTuiAgents } from '../../../shared/agent-launch/catalog/tui-agent-selection' import { hasUnsupportedTuiAgentArgs } from '../../../shared/agent-launch/choices/tui-agent-launch-defaults' diff --git a/src/main/persistence/loading-store/prepare-loaded-terminal-settings.ts b/src/main/persistence/loading-store/prepare-loaded-terminal-settings.ts index 2046d78de79..8750a1d3874 100644 --- a/src/main/persistence/loading-store/prepare-loaded-terminal-settings.ts +++ b/src/main/persistence/loading-store/prepare-loaded-terminal-settings.ts @@ -1,4 +1,4 @@ -import { migrateActionPermissionArgs } from '../../../shared/source-control-action-permission-lift' +import { migrateActionPermissionArgs } from '../../../shared/source-control/ai/recipes/source-control-action-permission-lift' import { homedir } from 'node:os' import type { PersistedState } from '../../../shared/persisted-state-types' import type { @@ -8,10 +8,8 @@ import type { import type { Repo } from '../../../shared/repo-types' import { getDefaultPersistedState } from '../../../shared/constants' import { migrateExternalWorktreeVisibilityDefaults } from '../../../shared/external-worktree-visibility' -import { - mergeLegacyCommitMessageAiIntoSourceControlAi, - sourceControlAiSettingsFromLegacy -} from '../../../shared/source-control-ai' +import { mergeLegacyCommitMessageAiIntoSourceControlAi } from '../../../shared/source-control/ai/settings/source-control-ai-legacy-reconciliation' +import { sourceControlAiSettingsFromLegacy } from '../../../shared/source-control/ai/settings/source-control-ai-settings' import { normalizeOsc52ClipboardDefaultOn, osc52ClipboardDefaultOnOverridesPersistedOff diff --git a/src/main/persistence/persistence-load-repair-durability.test.ts b/src/main/persistence/persistence-load-repair-durability.test.ts index c1f806e894e..91f3ddd617a 100644 --- a/src/main/persistence/persistence-load-repair-durability.test.ts +++ b/src/main/persistence/persistence-load-repair-durability.test.ts @@ -1,5 +1,5 @@ -import { projectSourceControlActionLaunch } from '../../shared/source-control-action-launch-preferences' -import { resolveSourceControlActionRecipe } from '../../shared/source-control-ai-operation-policy' +import { projectSourceControlActionLaunch } from '../../shared/source-control/ai/recipes/source-control-action-launch-preferences' +import { resolveSourceControlActionRecipe } from '../../shared/source-control/ai/source-control-ai-operation-policy' import { resolveAgentStartupPlanInputs } from '../../shared/agent-launch/startup/agent-startup-plan-inputs' import { resolveAgentLaunchCommand } from '../../shared/agent-launch/startup/tui-agent-launch-command' import { isTuiAgent } from '../../shared/agent-launch/catalog/tui-agent-config' diff --git a/src/main/persistence/tracking-repos/repo-hydration.ts b/src/main/persistence/tracking-repos/repo-hydration.ts index ca4fc7d716e..d412b72b0f4 100644 --- a/src/main/persistence/tracking-repos/repo-hydration.ts +++ b/src/main/persistence/tracking-repos/repo-hydration.ts @@ -5,7 +5,7 @@ import { isFolderRepo } from '../../../shared/repo-kind' import { sanitizeRepoIcon } from '../../../shared/repo-icon' import { normalizeGhAccountBinding } from '../../../shared/github/account-binding' import { normalizeJiraProjectReference } from '../../../shared/jira/jira-project-reference' -import { normalizeRepoSourceControlAiOverrides } from '../../../shared/source-control-ai' +import { normalizeRepoSourceControlAiOverrides } from '../../../shared/source-control/ai/settings/source-control-ai-repo-settings' import { normalizeOrcadRetainedMarker } from '../../../shared/orcad-retained-marker' import { sanitizeForkSyncMode, diff --git a/src/main/persistence/tracking-repos/repo-sanitization.ts b/src/main/persistence/tracking-repos/repo-sanitization.ts index cb73ea26483..a203fbdfb7d 100644 --- a/src/main/persistence/tracking-repos/repo-sanitization.ts +++ b/src/main/persistence/tracking-repos/repo-sanitization.ts @@ -1,7 +1,7 @@ import type { RepoProjectHostSetupMethod } from '../../../shared/project-types' import type { Repo } from '../../../shared/repo-types' import { editorFormatterSchema } from '../../../shared/editor-formatter' -import type { GitRemoteIdentity } from '../../../shared/git-remote-identity' +import type { GitRemoteIdentity } from '../../../shared/git/remotes/git-remote-identity' import { normalizeRepoBadgeColor } from '../../../shared/repo-badge-color' import { sanitizeRepoIcon } from '../../../shared/repo-icon' import { normalizeGhAccountBinding } from '../../../shared/github/account-binding' diff --git a/src/main/persistence/tracking-repos/repo-update-operations.ts b/src/main/persistence/tracking-repos/repo-update-operations.ts index e00c3276587..5bed99febcc 100644 --- a/src/main/persistence/tracking-repos/repo-update-operations.ts +++ b/src/main/persistence/tracking-repos/repo-update-operations.ts @@ -4,7 +4,7 @@ import type { ExecutionHostId } from '../../../shared/execution-host' import type { RepoHostTarget } from '../../../shared/repo-host-identity' import { getRepoExecutionHostId } from '../../../shared/execution-host' import { isLegacyRepoForExternalWorktreeVisibility } from '../../../shared/external-worktree-visibility' -import { normalizeRepoSourceControlAiOverrides } from '../../../shared/source-control-ai' +import { normalizeRepoSourceControlAiOverrides } from '../../../shared/source-control/ai/settings/source-control-ai-repo-settings' import { normalizeWorktreeVisibilitySourcePreferences } from '../../../shared/worktree/visibility-sources' import type { GhAccountBinding } from '../../../shared/github/account-binding' import { invalidateGhAccountTokenCache } from '../../github/gh-account-token' diff --git a/src/main/providers/git-provider-contract.ts b/src/main/providers/git-provider-contract.ts index a71c25bb050..f94f07decd3 100644 --- a/src/main/providers/git-provider-contract.ts +++ b/src/main/providers/git-provider-contract.ts @@ -2,20 +2,26 @@ import type { GitBranchCompareResult, GitCommitCompareResult, GitDiffResult -} from '../../shared/git-diff-compare-types' -import type { GitForkSyncExpectedUpstream, GitForkSyncResult } from '../../shared/git-fork-sync' +} from '../../shared/git/diff/git-diff-compare-types' +import type { + GitForkSyncExpectedUpstream, + GitForkSyncResult +} from '../../shared/git/remotes/git-fork-sync' import type { GitConflictOperation, GitStagingArea, GitStatusResult, GitUpstreamStatus -} from '../../shared/git-status-types' -import type { GitStageWorktreeScope } from '../../shared/git-stage-worktree-scope' +} from '../../shared/git/status/git-status-types' +import type { GitStageWorktreeScope } from '../../shared/git/paths/git-stage-worktree-scope' import type { RemoveWorktreeResult } from '../../shared/worktree/create-types' import type { GitPushTarget, GitWorktreeInfo } from '../../shared/worktree/types' -import type { GitHistoryOptions, GitHistoryResult } from '../../shared/git-history' -import type { CommitMessageDraftContext } from '../../shared/commit-message-generation' -import type { ConflictResolution } from '../../shared/source-control-entry-actions' +import type { + GitHistoryOptions, + GitHistoryResult +} from '../../shared/git/history/git-history-types' +import type { CommitMessageDraftContext } from '../../shared/source-control/ai/generation/commit-message-generation' +import type { ConflictResolution } from '../../shared/source-control/listing/source-control-entry-actions' import type { GitProviderStatusOptions } from './git-provider-status-options' import type { GitAdmissionTier } from '../git/command-runner/git-exec-options' diff --git a/src/main/providers/local-pty/local-pty-spawn-environment.ts b/src/main/providers/local-pty/local-pty-spawn-environment.ts index fdac91cf51f..e3ff5478e77 100644 --- a/src/main/providers/local-pty/local-pty-spawn-environment.ts +++ b/src/main/providers/local-pty/local-pty-spawn-environment.ts @@ -1,4 +1,4 @@ -import { mergeGitConfigEnvProtocol } from '../../../shared/git-credential-prompt-env' +import { mergeGitConfigEnvProtocol } from '../../../shared/git/commands/git-credential-prompt-env' import { restoreManagedDataAccountEnvironment } from '../../../shared/managed-data-account-environment' import { ORCA_IMAGE_PROTOCOL_ENV, diff --git a/src/main/rate-limits/codex-rpc-rate-limit-probe.ts b/src/main/rate-limits/codex-rpc-rate-limit-probe.ts index e6c643c7cd9..4d26c9a2525 100644 --- a/src/main/rate-limits/codex-rpc-rate-limit-probe.ts +++ b/src/main/rate-limits/codex-rpc-rate-limit-probe.ts @@ -4,7 +4,7 @@ import { codexSpawnEnoent, isSpawnEnoent } from '../codex-cli/windows-only-agent import { excerptAgentFailureOutput, sanitizeAgentFailureDetail -} from '../../shared/commit-message-agent-output' +} from '../../shared/source-control/ai/generation/commit-message-agent-output' import { withMacTailscaleDnsHint } from '../network/macos-tailscale-dns-diagnostic' import { redactString } from '../observability/redactor' import { diff --git a/src/main/runtime/mobile-desktop-relay/relay-github-authority.ts b/src/main/runtime/mobile-desktop-relay/relay-github-authority.ts index 6682fff6b30..df5b985d8fb 100644 --- a/src/main/runtime/mobile-desktop-relay/relay-github-authority.ts +++ b/src/main/runtime/mobile-desktop-relay/relay-github-authority.ts @@ -3,7 +3,7 @@ import { z } from 'zod' import { classifyExactGitHubOperation } from '../../../shared/github/exact-work-item-operation' import { GITHUB_EXACT_OPERATION_UNSUPPORTED } from '../../../shared/github/work-item-target' import { GITHUB_EXACT_DETAILS_READ_INTENT_RUNTIME_CAPABILITY } from '../../../shared/task-source-runtime-capabilities' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../shared/source-control/runtime/source-control-runtime-capabilities' import type { RemoteRuntimePassthroughSocket } from '../../../shared/remote-runtime/remote-runtime-passthrough-socket' import type { RelayedPhoneReplies } from './relayed-phone-frames' diff --git a/src/main/runtime/orca-runtime-git-diff-budget.test.ts b/src/main/runtime/orca-runtime-git-diff-budget.test.ts index d41942bf4f2..dfce0ba1a7a 100644 --- a/src/main/runtime/orca-runtime-git-diff-budget.test.ts +++ b/src/main/runtime/orca-runtime-git-diff-budget.test.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { REMOTE_RPC_MAX_CONTENT_BYTES } from '../../shared/remote-rpc-content-budget' -import type { GitDiffResult } from '../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../shared/git/diff/git-diff-compare-types' import type { GlobalSettings } from '../../shared/global-settings-types' import { RuntimeGitCommands } from './orca-runtime-git' diff --git a/src/main/runtime/orca-runtime-tests/hooks-and-hosted-review-part-03.spec.ts b/src/main/runtime/orca-runtime-tests/hooks-and-hosted-review-part-03.spec.ts index 9bc2ddbfde1..cdf24df5c6f 100644 --- a/src/main/runtime/orca-runtime-tests/hooks-and-hosted-review-part-03.spec.ts +++ b/src/main/runtime/orca-runtime-tests/hooks-and-hosted-review-part-03.spec.ts @@ -2,7 +2,7 @@ import * as gitExecFile from '../../git/command-runner/git-exec-file' import { describe, expect, it, vi } from 'vitest' import { OrcaRuntimeService, setPlatform } from '../orca-runtime-test-mocks.spec' import { readHostedReviewForBranch } from '../../source-control/hosted-review' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import { TEST_REPO_ID, TEST_REPO_PATH, diff --git a/src/main/runtime/repo-worktree-admin-fingerprint.ts b/src/main/runtime/repo-worktree-admin-fingerprint.ts index 771e9a73ef7..e3e6e6dd6ac 100644 --- a/src/main/runtime/repo-worktree-admin-fingerprint.ts +++ b/src/main/runtime/repo-worktree-admin-fingerprint.ts @@ -1,6 +1,6 @@ import { readdir, readFile, stat } from 'node:fs/promises' import path from 'node:path' -import { resolveGitCommonDirectory } from '../../shared/git-common-directory' +import { resolveGitCommonDirectory } from '../../shared/git/metadata/git-common-directory' import { mapWithConcurrency } from '../../shared/map-with-concurrency' // NUL can appear in neither a path nor a Git ref, so field boundaries stay unambiguous. diff --git a/src/main/runtime/rpc/errors.ts b/src/main/runtime/rpc/errors.ts index 0b0cf5c61ac..572656ee981 100644 --- a/src/main/runtime/rpc/errors.ts +++ b/src/main/runtime/rpc/errors.ts @@ -32,7 +32,7 @@ import { classifySkillInstallFailureCode } from '../../../shared/skill-install-failure' import { PLUGIN_CLI_ERROR_CODES } from '../../../shared/plugins/approval/plugin-cli-approval' -import { GIT_DIFF_TOO_LARGE_CODE } from '../../../shared/git-diff-transport-budget' +import { GIT_DIFF_TOO_LARGE_CODE } from '../../../shared/git/diff/git-diff-transport-budget' import { AUTOMATION_OWNER_CONFLICT_CODES } from '../../../shared/automation-owner-conflict' import { ARCHIVE_HOOK_FAILED_REMOVAL_CODE } from '../../../shared/worktree/archive-hook-removal-gate' import { NESTED_WORKER_DEPTH_EXCEEDED_CODE } from '../../../shared/nested-worker-depth' diff --git a/src/main/runtime/rpc/methods/git-commit-message-generation-methods.ts b/src/main/runtime/rpc/methods/git-commit-message-generation-methods.ts index cb85e3fe8f9..2dc604714fb 100644 --- a/src/main/runtime/rpc/methods/git-commit-message-generation-methods.ts +++ b/src/main/runtime/rpc/methods/git-commit-message-generation-methods.ts @@ -1,6 +1,6 @@ import { defineMethod } from '../core' import type { GlobalSettings } from '../../../../shared/global-settings-types' -import type { ResolvedSourceControlAiGenerationParams } from '../../../../shared/source-control-ai' +import type { ResolvedSourceControlAiGenerationParams } from '../../../../shared/source-control/ai/source-control-ai-operation-resolution' import { GitDiscoverCommitMessageModels, GitGenerateCommitMessage, diff --git a/src/main/runtime/rpc/methods/git-diff-transport-budget.test.ts b/src/main/runtime/rpc/methods/git-diff-transport-budget.test.ts index c925eca97a5..e26ea5e9945 100644 --- a/src/main/runtime/rpc/methods/git-diff-transport-budget.test.ts +++ b/src/main/runtime/rpc/methods/git-diff-transport-budget.test.ts @@ -5,8 +5,8 @@ import { REMOTE_RPC_MAX_CONTENT_BYTES, remoteRpcContentBudget } from '../../../../shared/remote-rpc-content-budget' -import { assertGitDiffWithinTransportBudget } from '../../../../shared/git-diff-transport-budget' -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' +import { assertGitDiffWithinTransportBudget } from '../../../../shared/git/diff/git-diff-transport-budget' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' import type { OrcaRuntimeService } from '../../orca-runtime' import type { RpcRequest, RpcResponse } from '../core' import { RpcDispatcher } from '../dispatcher' diff --git a/src/main/runtime/rpc/methods/gitlab.ts b/src/main/runtime/rpc/methods/gitlab.ts index d3a544079e1..5540a434760 100644 --- a/src/main/runtime/rpc/methods/gitlab.ts +++ b/src/main/runtime/rpc/methods/gitlab.ts @@ -1,6 +1,6 @@ import { defineMethod } from '../core' import { normalizeGitLabIssueListArgs } from '../../../gitlab/gitlab-preload-args' -import { toGitLabJobLogExcerptResult } from '../../../../shared/gitlab-job-log-excerpt' +import { toGitLabJobLogExcerptResult } from '../../../../shared/source-control/checks/gitlab/gitlab-job-log-excerpt' import { AddIssueComment, AddMRComment, diff --git a/src/main/runtime/rpc/methods/hosted-review.ts b/src/main/runtime/rpc/methods/hosted-review.ts index df1878fdbbf..7de8364bea6 100644 --- a/src/main/runtime/rpc/methods/hosted-review.ts +++ b/src/main/runtime/rpc/methods/hosted-review.ts @@ -1,5 +1,5 @@ import { defineMethod } from '../core' -import { supportsHostedReviewCreation } from '../../../../shared/hosted-review-creation-providers' +import { supportsHostedReviewCreation } from '../../../../shared/source-control/hosted-review/hosted-review-creation-providers' import { UNSUPPORTED_HOSTED_REVIEW_PROVIDER } from '../../../source-control/hosted-review-creation' import { HostedReviewCreate, diff --git a/src/main/runtime/rpc/methods/orchestration/worker/worker-worktree-creation.test.ts b/src/main/runtime/rpc/methods/orchestration/worker/worker-worktree-creation.test.ts index 441d8ae6080..86699892d07 100644 --- a/src/main/runtime/rpc/methods/orchestration/worker/worker-worktree-creation.test.ts +++ b/src/main/runtime/rpc/methods/orchestration/worker/worker-worktree-creation.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' import { MARINE_CREATURES } from '../../../../../../shared/marine-creatures' -import { isAutoGeneratedCreatureBranchName } from '../../../../../../shared/branch-name-from-work' +import { isAutoGeneratedCreatureBranchName } from '../../../../../../shared/source-control/ai/naming/branch-name-from-work' import { creatureNameAtTier, creatureNameTier diff --git a/src/main/runtime/runtime-client-settings-shape.ts b/src/main/runtime/runtime-client-settings-shape.ts index b4ec97b937a..edaf328d48c 100644 --- a/src/main/runtime/runtime-client-settings-shape.ts +++ b/src/main/runtime/runtime-client-settings-shape.ts @@ -2,7 +2,7 @@ import type { GlobalSettings } from '../../shared/global-settings-types' import type { ExecutionHostId } from '../../shared/execution-host' -import type { SourceControlAiActionDefaults } from '../../shared/source-control-ai-actions' +import type { SourceControlAiActionDefaults } from '../../shared/source-control/ai/recipes/source-control-ai-actions' export type RuntimeClientSettings = Pick< GlobalSettings, diff --git a/src/main/runtime/runtime-client-settings.ts b/src/main/runtime/runtime-client-settings.ts index 5eb968daaca..dbfab8c589d 100644 --- a/src/main/runtime/runtime-client-settings.ts +++ b/src/main/runtime/runtime-client-settings.ts @@ -3,16 +3,16 @@ import { getClaudeAgentViewService } from '../claude/agent-view/agent-view-servi import { getAppEnvironment } from '../../shared/app-environment' import { isArtifactSharingEnabled } from '../../shared/artifact-sharing-gate' import { isAgentSkillSharingEnabled } from '../../shared/agent-skill-sharing-gate' -import { applyPRBotAuthorOverride } from '../../shared/pr-bot-author-overrides' +import { applyPRBotAuthorOverride } from '../../shared/source-control/review-comments/pr-bot-author-overrides' import { TASK_PROVIDERS } from '../../shared/task-providers' import { applyTerminalQuickCommandMutation, type TerminalQuickCommandMutation } from '../../shared/terminal-quick-commands' import { haveSameDisabledTuiAgents } from '../../shared/agent-launch/catalog/tui-agent-selection' -import { normalizeSourceControlAiSettings } from '../../shared/source-control-ai' -import { normalizeSourceControlGroupOrder } from '../../shared/source-control-group-order' -import { SOURCE_CONTROL_LAUNCH_ACTION_IDS } from '../../shared/source-control-ai-actions' +import { normalizeSourceControlAiSettings } from '../../shared/source-control/ai/settings/source-control-ai-settings' +import { normalizeSourceControlGroupOrder } from '../../shared/source-control/listing/source-control-group-order' +import { SOURCE_CONTROL_LAUNCH_ACTION_IDS } from '../../shared/source-control/ai/recipes/source-control-ai-actions' import type { GlobalSettings } from '../../shared/global-settings-types' import { applyNativeChatSessionOptionSettingsMutation } from '../../shared/native-chat/input/native-chat-session-option-defaults' import type { NativeChatSessionOptionSettingsMutation } from '../../shared/native-chat/input/native-chat-session-options' diff --git a/src/main/runtime/runtime-git-command-target.ts b/src/main/runtime/runtime-git-command-target.ts index 509d0a7dad0..cee00dff3c5 100644 --- a/src/main/runtime/runtime-git-command-target.ts +++ b/src/main/runtime/runtime-git-command-target.ts @@ -1,4 +1,4 @@ -import type { SourceControlAiSettingsInput } from '../../shared/source-control-ai' +import type { SourceControlAiSettingsInput } from '../../shared/source-control/ai/source-control-ai-operation-resolution' import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../shared/execution-host' import type { Repo } from '../../shared/repo-types' import type { GitPushTarget, GitWorktreeInfo, Worktree } from '../../shared/worktree/types' diff --git a/src/main/runtime/runtime-git-diff-commands.ts b/src/main/runtime/runtime-git-diff-commands.ts index eb1dff94836..3fa30eacfae 100644 --- a/src/main/runtime/runtime-git-diff-commands.ts +++ b/src/main/runtime/runtime-git-diff-commands.ts @@ -2,8 +2,8 @@ import type { GitBranchCompareResult, GitCommitCompareResult, GitDiffResult -} from '../../shared/git-diff-compare-types' -import { assertGitDiffWithinTransportBudget } from '../../shared/git-diff-transport-budget' +} from '../../shared/git/diff/git-diff-compare-types' +import { assertGitDiffWithinTransportBudget } from '../../shared/git/diff/git-diff-transport-budget' import { getBranchDiff } from '../git/source-control/branch-diff' import type { GitAdmissionTier } from '../git/command-runner/git-exec-options' import { normalizeRuntimeRelativePath } from './runtime-relative-paths' diff --git a/src/main/runtime/runtime-git-generation-commands.ts b/src/main/runtime/runtime-git-generation-commands.ts index 166536f2ec2..86841d754b8 100644 --- a/src/main/runtime/runtime-git-generation-commands.ts +++ b/src/main/runtime/runtime-git-generation-commands.ts @@ -2,10 +2,10 @@ import { textGenerationFailure, textGenerationFailureCodeFields } from '../../shared/text-generation-failure-copy' -import type { CommitMessageDraftContext } from '../../shared/commit-message-generation' -import { getCommitMessageModelDiscoveryHostKey } from '../../shared/commit-message-host-key' -import type { HostedReviewProvider } from '../../shared/hosted-review' -import { withLinkedIssueDraftContext } from '../../shared/source-control-ai-action-variables' +import type { CommitMessageDraftContext } from '../../shared/source-control/ai/generation/commit-message-generation' +import { getCommitMessageModelDiscoveryHostKey } from '../../shared/source-control/ai/generation/commit-message-host-key' +import type { HostedReviewProvider } from '../../shared/source-control/hosted-review/hosted-review-contracts' +import { withLinkedIssueDraftContext } from '../../shared/source-control/ai/recipes/source-control-ai-action-variables' import type { TuiAgent } from '../../shared/agent-launch/catalog/tui-agent' import { getStagedCommitContext } from '../git/source-control/staged-commit-context' import { SSH_HOST_NOT_SERVED_MESSAGE } from '../providers/ssh-host-not-served-error' diff --git a/src/main/runtime/runtime-git-generation-context.ts b/src/main/runtime/runtime-git-generation-context.ts index 4f50b996061..8edf74e2006 100644 --- a/src/main/runtime/runtime-git-generation-context.ts +++ b/src/main/runtime/runtime-git-generation-context.ts @@ -1,12 +1,12 @@ import type { GlobalSettings } from '../../shared/global-settings-types' import { gitExecFileAsync } from '../git/runner' import type { getPullRequestDraftContext } from '../text-generation/pull-request-context' -import { - mergeLegacyCommitMessageAiIntoSourceControlAi, - type SourceControlAiSettingsInput, - type ResolvedSourceControlAiGenerationParams -} from '../../shared/source-control-ai' -import type { SourceControlAiOperation } from '../../shared/source-control-ai-types' +import { mergeLegacyCommitMessageAiIntoSourceControlAi } from '../../shared/source-control/ai/settings/source-control-ai-legacy-reconciliation' +import type { + SourceControlAiSettingsInput, + ResolvedSourceControlAiGenerationParams +} from '../../shared/source-control/ai/source-control-ai-operation-resolution' +import type { SourceControlAiOperation } from '../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { CommitMessageAgentRuntimeTarget } from '../text-generation/commit-message-agent-environment' import type { CommitMessageGenerationTarget } from '../text-generation/commit-message-text-generation' import type { PullRequestLinkedIssueMeta } from '../source-control/pull-request-linked-issue' diff --git a/src/main/runtime/runtime-git-staging-commands.ts b/src/main/runtime/runtime-git-staging-commands.ts index 87ffd5c549d..8fdc1d10920 100644 --- a/src/main/runtime/runtime-git-staging-commands.ts +++ b/src/main/runtime/runtime-git-staging-commands.ts @@ -1,13 +1,13 @@ import type { GitStageWorktreeScope, GitStageWorktreeScopeReceipt -} from '../../shared/git-stage-worktree-scope' +} from '../../shared/git/paths/git-stage-worktree-scope' import { normalizeRuntimeGitRelativePath, requireRuntimeGitProvider, type RuntimeGitCommandHost } from './runtime-git-command-target' -import type { ConflictResolution } from '../../shared/source-control-entry-actions' +import type { ConflictResolution } from '../../shared/source-control/listing/source-control-entry-actions' export class RuntimeGitStagingCommands { constructor(private readonly host: RuntimeGitCommandHost) {} diff --git a/src/main/runtime/runtime-git-status-commands.ts b/src/main/runtime/runtime-git-status-commands.ts index 9bd98f7e1f6..ea95e098288 100644 --- a/src/main/runtime/runtime-git-status-commands.ts +++ b/src/main/runtime/runtime-git-status-commands.ts @@ -1,11 +1,14 @@ -import type { GitHistoryOptions, GitHistoryResult } from '../../shared/git-history' -import type { GitMutationInFlight } from '../../shared/git-mutation-in-flight' +import type { + GitHistoryOptions, + GitHistoryResult +} from '../../shared/git/history/git-history-types' +import type { GitMutationInFlight } from '../../shared/git/commands/git-mutation-in-flight' import { isGitWorktreeMutationInFlight } from '../git/command-runner/git-worktree-mutation-state' import type { GitConflictOperation, GitStagingArea, GitStatusResult -} from '../../shared/git-status-types' +} from '../../shared/git/status/git-status-types' import type { RuntimeGitCheckoutResult, RuntimeGitLocalBranches } from '../../shared/runtime-types' import type { GitProviderStatusOptions } from '../providers/git-provider-contract' import { diff --git a/src/main/runtime/runtime-git-sync-commands.ts b/src/main/runtime/runtime-git-sync-commands.ts index c56d16c790b..863c918e98e 100644 --- a/src/main/runtime/runtime-git-sync-commands.ts +++ b/src/main/runtime/runtime-git-sync-commands.ts @@ -1,5 +1,8 @@ -import type { GitForkSyncExpectedUpstream, GitForkSyncResult } from '../../shared/git-fork-sync' -import type { GitUpstreamStatus } from '../../shared/git-status-types' +import type { + GitForkSyncExpectedUpstream, + GitForkSyncResult +} from '../../shared/git/remotes/git-fork-sync' +import type { GitUpstreamStatus } from '../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../shared/worktree/types' import { materializeWorktreePushTargetRemote } from '../ipc/worktree-remote' import { assertRuntimeReadWslDistroRunning } from './runtime-wsl-background-read-gate' diff --git a/src/main/runtime/runtime-hosted-review-commands.ts b/src/main/runtime/runtime-hosted-review-commands.ts index 565a0dfac3f..bd887fcf8c1 100644 --- a/src/main/runtime/runtime-hosted-review-commands.ts +++ b/src/main/runtime/runtime-hosted-review-commands.ts @@ -6,7 +6,7 @@ import type { HostedReviewCreationEligibility, HostedReviewCreationEligibilityArgs, HostedReviewForBranchReply -} from '../../shared/hosted-review' +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import type { GitHubOwnerRepo } from '../../shared/github/pull-request-types' import type { GitHubPRRefreshReason, @@ -21,7 +21,7 @@ import { } from '../github/client' import { admissionTierForRefreshReason } from '../github/pr-refresh-candidate-policy' import type { GitAdmissionTier } from '../git/command-runner/git-exec-options' -import { hostedReviewForBranchReply } from '../../shared/hosted-review' +import { hostedReviewForBranchReply } from '../../shared/source-control/hosted-review/hosted-review-contracts' import { readHostedReviewForBranch } from '../source-control/hosted-review' import { getStoredRepoExecutionHostId } from '../workspaces/execution-host/repo-execution-host' import { hostedReviewSshConnectionId } from '../source-control/hosted-review-execution-host' diff --git a/src/main/runtime/runtime-local-worktree-create.test.ts b/src/main/runtime/runtime-local-worktree-create.test.ts index 65995534b69..ab50743579d 100644 --- a/src/main/runtime/runtime-local-worktree-create.test.ts +++ b/src/main/runtime/runtime-local-worktree-create.test.ts @@ -6,9 +6,9 @@ import { getDefaultRepoHookSettings } from '../../shared/constants' import type { AddWorktreeOptions } from '../git/worktrees/worktree-operation-options' import { acquireGitAdmission, - GitAdmissionScheduler, _resetGitAdmissionForTests } from '../git/command-runner/git-subprocess-admission' +import { GitAdmissionScheduler } from '../../shared/git/admission/git-admission-scheduler' const { runtimeCreateMocks: mocks, diff --git a/src/main/runtime/runtime-preserved-branch-cleanup.ts b/src/main/runtime/runtime-preserved-branch-cleanup.ts index f88e9404755..38543f38178 100644 --- a/src/main/runtime/runtime-preserved-branch-cleanup.ts +++ b/src/main/runtime/runtime-preserved-branch-cleanup.ts @@ -3,7 +3,7 @@ import type { RemoveWorktreeResult } from '../../shared/worktree/create-types' import type { GitPushTarget } from '../../shared/worktree/types' -import { preservedBranchCleanupScopeKey } from '../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupScopeKey } from '../../shared/git/branches/preserved-branch-cleanup' import { getRepoRoutingConnectionId, parseExecutionHostId, diff --git a/src/main/runtime/runtime-remote-fetch-controller.ts b/src/main/runtime/runtime-remote-fetch-controller.ts index 9184a750234..58ffd61eb40 100644 --- a/src/main/runtime/runtime-remote-fetch-controller.ts +++ b/src/main/runtime/runtime-remote-fetch-controller.ts @@ -1,7 +1,7 @@ import { waitForPromiseWithSignal } from '../../shared/abort-signal-reason' import type { GitExecOptions } from '../git/command-runner/git-exec-options' import type { LocalGitExecOptions } from '../git/repo-default-base-ref' -import { GIT_FETCH_SKIP_AUTO_MAINTENANCE_CONFIG_ARGS } from '../../shared/git-fetch-auto-maintenance' +import { GIT_FETCH_SKIP_AUTO_MAINTENANCE_CONFIG_ARGS } from '../../shared/git/fetch/git-fetch-auto-maintenance' import { getCanonicalRepoKey, type CanonicalRepoKeyOptions } from '../git/canonical-repo-key' import { armLocalRepoRefMaintenance, diff --git a/src/main/runtime/runtime-repository-clone-controller.ts b/src/main/runtime/runtime-repository-clone-controller.ts index eea50066d13..2657f54ed48 100644 --- a/src/main/runtime/runtime-repository-clone-controller.ts +++ b/src/main/runtime/runtime-repository-clone-controller.ts @@ -5,7 +5,7 @@ import { DEFAULT_REPO_BADGE_COLOR } from '../../shared/constants' import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../shared/execution-host' import type { Repo } from '../../shared/repo-types' import { isFolderRepo } from '../../shared/repo-kind' -import { getGitCloneFailureMessage } from '../../shared/git-clone-failure-message' +import { getGitCloneFailureMessage } from '../../shared/git/remotes/git-clone-failure-message' import { cleanupClaimedCloneTarget, claimCloneTarget, diff --git a/src/main/runtime/structured-chat-naming-contract.test.ts b/src/main/runtime/structured-chat-naming-contract.test.ts index 1a9033228f1..b2b943adbc5 100644 --- a/src/main/runtime/structured-chat-naming-contract.test.ts +++ b/src/main/runtime/structured-chat-naming-contract.test.ts @@ -5,13 +5,13 @@ import { afterEach, beforeEach, expect, it, onTestFinished, vi } from 'vitest' import { getDefaultSettings } from '../../shared/constants' import { agentSessionRecordFixture } from '../../shared/agent-session/lifecycle/agent-session-record.test-fixture' import { isTuiAgent } from '../../shared/agent-launch/catalog/tui-agent-config' -import { getCommitMessageAgentSpec } from '../../shared/commit-message-agent-spec' +import { getCommitMessageAgentSpec } from '../../shared/source-control/ai/generation/commit-message-agent-spec' import { toSshExecutionHostId, type ExecutionHostId } from '../../shared/execution-host' import { savedChatNamingCatalog, observeChatNamingCatalogWork } from '../../shared/chat-naming-catalog-work.test-fixture' -import type { SourceControlActionRecipe } from '../../shared/source-control-ai-actions' +import type { SourceControlActionRecipe } from '../../shared/source-control/ai/recipes/source-control-ai-actions' import type { SpawnSourceControlAgent } from '../text-generation/source-control-text-generation-types' import { createMockDiscoveryChild } from '../text-generation/commit-message-text-generation-test-harness' import { structuredChatNamingDeps } from './structured-chat-naming-runtime' diff --git a/src/main/runtime/structured-chat-naming-runtime.test.ts b/src/main/runtime/structured-chat-naming-runtime.test.ts index 4be7f541c29..4c2bd702444 100644 --- a/src/main/runtime/structured-chat-naming-runtime.test.ts +++ b/src/main/runtime/structured-chat-naming-runtime.test.ts @@ -8,7 +8,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { getDefaultSettings } from '../../shared/constants' import { agentSessionRecordFixture } from '../../shared/agent-session/lifecycle/agent-session-record.test-fixture' import { toSshExecutionHostId } from '../../shared/execution-host' -import { normalizeSourceControlAiSettings } from '../../shared/source-control-ai-settings' +import { normalizeSourceControlAiSettings } from '../../shared/source-control/ai/settings/source-control-ai-settings' import { structuredChatNamingDeps } from './structured-chat-naming-runtime' import { STRUCTURED_AGENT_RUNTIME_CATALOG } from './structured-agent-runtime-metadata' import type { diff --git a/src/main/runtime/structured-chat-naming-runtime.ts b/src/main/runtime/structured-chat-naming-runtime.ts index e18b5c5d818..54ef76c552c 100644 --- a/src/main/runtime/structured-chat-naming-runtime.ts +++ b/src/main/runtime/structured-chat-naming-runtime.ts @@ -1,12 +1,10 @@ -import { - normalizeSourceControlAiSettings, - resolveSourceControlActionRecipe -} from '../../shared/source-control-ai' -import { normalizeSourceControlActionRecipe } from '../../shared/source-control-ai-actions' +import { normalizeSourceControlAiSettings } from '../../shared/source-control/ai/settings/source-control-ai-settings' +import { resolveSourceControlActionRecipe } from '../../shared/source-control/ai/source-control-ai-operation-policy' +import { normalizeSourceControlActionRecipe } from '../../shared/source-control/ai/recipes/source-control-ai-actions' import { renderConversationNamePrompt, sanitizeGeneratedConversationName -} from '../../shared/conversation-name-generation' +} from '../../shared/source-control/ai/generation/conversation-name-generation' import { chatNamingAgentTarget } from './structured-chat-naming-agent-launch' import type { AgentLaunchProfileSettings } from '../../shared/agent-launch/choices/tui-agent-launch-defaults' import { chatNamingFailure } from '../../shared/chat-naming-failure-copy' @@ -18,7 +16,7 @@ import type { StructuredAgentSessionLogger } from '../native-chat/agent-session- import { getStructuredAgentSessionHost } from '../native-chat/agent-session-wire/structured-agent-session-registry' import { firstStructuredChatNamingPrompt } from '../../shared/structured-chat-naming-eligibility' import { firstStructuredAgentSessionPrompt } from '../../shared/agent-session/requests/structured-agent-session-first-prompt' -import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../shared/commit-message-host-key' +import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../shared/source-control/ai/generation/commit-message-host-key' import { generateConversationNameFromContext, resolveTextGenerationParams diff --git a/src/main/runtime/workspaces/workspace-removal.ts b/src/main/runtime/workspaces/workspace-removal.ts index d9562d25c10..7d04a49ecde 100644 --- a/src/main/runtime/workspaces/workspace-removal.ts +++ b/src/main/runtime/workspaces/workspace-removal.ts @@ -14,7 +14,7 @@ import { type ExecutionHostId } from '../../../shared/execution-host' import { finishAcceptedWorktreeRemoval } from '../../workspaces/removal/worktree-background-removal' -import { preservedBranchCleanupScopeKey } from '../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupScopeKey } from '../../../shared/git/branches/preserved-branch-cleanup' import { getRuntimeWorktreeRemovalOptionsKey, type RemoveManagedWorktreeOptions, diff --git a/src/main/source-control/forge-provider.test.ts b/src/main/source-control/forge-provider.test.ts index da24fe3adce..8934148645b 100644 --- a/src/main/source-control/forge-provider.test.ts +++ b/src/main/source-control/forge-provider.test.ts @@ -1,4 +1,4 @@ -import { supportsHostedReviewCreation } from '../../shared/hosted-review-creation-providers' +import { supportsHostedReviewCreation } from '../../shared/source-control/hosted-review/hosted-review-creation-providers' import { beforeEach, describe, expect, it, vi } from 'vitest' const { diff --git a/src/main/source-control/forge-provider.ts b/src/main/source-control/forge-provider.ts index e0cb9a19ad7..89c17b86d58 100644 --- a/src/main/source-control/forge-provider.ts +++ b/src/main/source-control/forge-provider.ts @@ -4,7 +4,7 @@ import type { CreateHostedReviewResult, HostedReviewInfo, HostedReviewProvider -} from '../../shared/hosted-review' +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { getAzureDevOpsPullRequest, getAzureDevOpsPullRequestForBranchOrThrow, diff --git a/src/main/source-control/forge-review-mappers.ts b/src/main/source-control/forge-review-mappers.ts index 3564ac24e2a..7a3cede98a7 100644 --- a/src/main/source-control/forge-review-mappers.ts +++ b/src/main/source-control/forge-review-mappers.ts @@ -1,5 +1,5 @@ -import type { HostedReviewInfo } from '../../shared/hosted-review' -import { hostedReviewInfoFromGitHubPRInfo } from '../../shared/hosted-review-github' +import type { HostedReviewInfo } from '../../shared/source-control/hosted-review/hosted-review-contracts' +import { hostedReviewInfoFromGitHubPRInfo } from '../../shared/source-control/hosted-review/hosted-review-github' import type { PRInfo } from '../../shared/github/pull-request-types' import type { MRInfo } from '../../shared/gitlab-types' import type { AzureDevOpsPullRequestInfo } from '../azure-devops/pull-request-mappers' diff --git a/src/main/source-control/hosted-review-branch-cache-types.ts b/src/main/source-control/hosted-review-branch-cache-types.ts new file mode 100644 index 00000000000..d9a27d74fec --- /dev/null +++ b/src/main/source-control/hosted-review-branch-cache-types.ts @@ -0,0 +1,32 @@ +import type { ExecutionHostId } from '../../shared/execution-host' +import type { HostedReviewInfo } from '../../shared/source-control/hosted-review/hosted-review-contracts' + +export type CacheEntry = { + review: HostedReviewInfo | null + fetchedAt: number + headOid: string | null + /** When the lookup that produced this answer began, for straggler ordering. */ + startedAt: number +} + +export type HostedReviewBranchCacheIdentity = { + repoPath: string + executionHostId: ExecutionHostId + branch: string + linkedGitHubPR?: number | null + fallbackGitHubPR?: number | null + linkedGitLabMR?: number | null + linkedBitbucketPR?: number | null + linkedAzureDevOpsPR?: number | null + linkedGiteaPR?: number | null + localGitExecOptions?: unknown +} + +export type HostedReviewBranchCacheOptions = { + /** The worktree's checked-out HEAD oid, for merged-at-head visibility. */ + headOid: string | null + /** Set by surfaces that only ever render the selected worktree. */ + active?: boolean + force?: boolean + userRefresh?: boolean +} diff --git a/src/main/source-control/hosted-review-branch-cache.test.ts b/src/main/source-control/hosted-review-branch-cache.test.ts index 0275603cdf0..e833fa2dfca 100644 --- a/src/main/source-control/hosted-review-branch-cache.test.ts +++ b/src/main/source-control/hosted-review-branch-cache.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { HostedReviewInfo } from '../../shared/hosted-review' +import type { HostedReviewInfo } from '../../shared/source-control/hosted-review/hosted-review-contracts' import { __resetHostedReviewBranchCacheForTests, invalidateHostedReviewBranchCache, diff --git a/src/main/source-control/hosted-review-branch-cache.ts b/src/main/source-control/hosted-review-branch-cache.ts index 24c8466faf2..ea11461c5f4 100644 --- a/src/main/source-control/hosted-review-branch-cache.ts +++ b/src/main/source-control/hosted-review-branch-cache.ts @@ -1,6 +1,14 @@ +import type { + CacheEntry, + HostedReviewBranchCacheIdentity, + HostedReviewBranchCacheOptions +} from './hosted-review-branch-cache-types' import type { ExecutionHostId } from '../../shared/execution-host' -import type { HostedReviewForBranchOutcome, HostedReviewInfo } from '../../shared/hosted-review' -import { cachedHostedReviewOutcome } from '../../shared/hosted-review' +import type { + HostedReviewForBranchOutcome, + HostedReviewInfo +} from '../../shared/source-control/hosted-review/hosted-review-contracts' +import { cachedHostedReviewOutcome } from '../../shared/source-control/hosted-review/hosted-review-contracts' import { __resetHostedReviewActiveClaimsForTests, isActiveBranch, @@ -51,40 +59,10 @@ import { const FOUND_REVIEW_TTL_MS = 60_000 const MAX_ENTRIES = MAX_BRANCH_MAP_ENTRIES -type CacheEntry = { - review: HostedReviewInfo | null - fetchedAt: number - headOid: string | null - /** When the lookup that produced this answer began, for straggler ordering. */ - startedAt: number -} - const entries = new Map() // NUL cannot occur in paths/branches, preventing invalidation prefixes from crossing identity components. const KEY_SEPARATOR = '\0' -export type HostedReviewBranchCacheIdentity = { - repoPath: string - executionHostId: ExecutionHostId - branch: string - linkedGitHubPR?: number | null - fallbackGitHubPR?: number | null - linkedGitLabMR?: number | null - linkedBitbucketPR?: number | null - linkedAzureDevOpsPR?: number | null - linkedGiteaPR?: number | null - localGitExecOptions?: unknown -} - -export type HostedReviewBranchCacheOptions = { - /** The worktree's checked-out HEAD oid, for merged-at-head visibility. */ - headOid: string | null - /** Set by surfaces that only ever render the selected worktree. */ - active?: boolean - force?: boolean - userRefresh?: boolean -} - export function hostedReviewBranchCacheKey(identity: HostedReviewBranchCacheIdentity): string { return [ hostedReviewRepoScope(identity.repoPath, identity.executionHostId), diff --git a/src/main/source-control/hosted-review-creation-blocking.ts b/src/main/source-control/hosted-review-creation-blocking.ts index fc14144d07e..9da32d32793 100644 --- a/src/main/source-control/hosted-review-creation-blocking.ts +++ b/src/main/source-control/hosted-review-creation-blocking.ts @@ -3,7 +3,7 @@ import type { HostedReviewCreationBlockedReason, HostedReviewCreationEligibility, HostedReviewProvider -} from '../../shared/hosted-review' +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { reviewCopy } from './hosted-review-creation-provider' function blockedCreateResultForReason( diff --git a/src/main/source-control/hosted-review-creation-git-state.ts b/src/main/source-control/hosted-review-creation-git-state.ts index 55929906e4c..fd2a85d0493 100644 --- a/src/main/source-control/hosted-review-creation-git-state.ts +++ b/src/main/source-control/hosted-review-creation-git-state.ts @@ -2,17 +2,18 @@ import { isRemoteHeadRef, normalizeHostedReviewBaseRef, normalizeHostedReviewHeadRef -} from '../../shared/hosted-review-refs' -import { isSafeGitRefName } from '../../shared/git-status-upstream-ref' -import type { GitUpstreamStatus } from '../../shared/git-status-types' +} from '../../shared/source-control/hosted-review/hosted-review-refs' +import { isSafeGitRefName } from '../../shared/git/status/git-status-upstream-ref' +import type { GitUpstreamStatus } from '../../shared/git/status/git-status-types' import { gitExecFileAsync } from '../github/gh-utils' -import { isShowRefNoMatchError, probeExactRefsViaForEachRef } from '../git/exact-ref-probe' +import { isShowRefNoMatchError } from '../../shared/git/refs/git-show-ref-no-match' +import { probeExactRefsViaForEachRef } from '../git/exact-ref-probe' import { gitOptionalLocksDisabledEnv } from '../git/runner' import { parsePorcelainV1Records, type PorcelainV1Record } from '../git/source-control/porcelain-v1-records' -import { resolveDefaultBaseRefViaExec } from '../git/repo' +import { resolveDefaultBaseRefViaExec } from '../../shared/git/refs/git-default-base-ref' import { getUpstreamStatus } from '../git/source-control/upstream' import { findExistingWorktreeSymlinkPaths } from '../git/worktrees/content-paths/worktree-symlink-detection' import { requireReachableGitRoute } from '../providers/execution-host-provider-dispatch' diff --git a/src/main/source-control/hosted-review-creation-provider.ts b/src/main/source-control/hosted-review-creation-provider.ts index 96bbe0ad468..79603f1e102 100644 --- a/src/main/source-control/hosted-review-creation-provider.ts +++ b/src/main/source-control/hosted-review-creation-provider.ts @@ -1,6 +1,6 @@ import type { ExecutionHostId } from '../../shared/execution-host' -import type { HostedReviewProvider } from '../../shared/hosted-review' -import type { HostedReviewCreationProvider } from '../../shared/hosted-review-creation-providers' +import type { HostedReviewProvider } from '../../shared/source-control/hosted-review/hosted-review-contracts' +import type { HostedReviewCreationProvider } from '../../shared/source-control/hosted-review/hosted-review-creation-providers' import { isAzureDevOpsReviewCreationAuthenticated } from '../azure-devops/pull-request-creation' import { isBitbucketReviewCreationAuthenticated } from '../bitbucket/pull-request-creation' import { isGiteaReviewCreationAuthenticated } from '../gitea/pull-request-creation' diff --git a/src/main/source-control/hosted-review-creation.ts b/src/main/source-control/hosted-review-creation.ts index 7819ea31ff8..5e30871fadf 100644 --- a/src/main/source-control/hosted-review-creation.ts +++ b/src/main/source-control/hosted-review-creation.ts @@ -5,9 +5,9 @@ import type { HostedReviewCreationEligibility, HostedReviewCreationEligibilityArgs, HostedReviewLookupOutcome -} from '../../shared/hosted-review' -import { supportsHostedReviewCreation } from '../../shared/hosted-review-creation-providers' -import { normalizeHostedReviewBaseRef } from '../../shared/hosted-review-refs' +} from '../../shared/source-control/hosted-review/hosted-review-contracts' +import { supportsHostedReviewCreation } from '../../shared/source-control/hosted-review/hosted-review-creation-providers' +import { normalizeHostedReviewBaseRef } from '../../shared/source-control/hosted-review/hosted-review-refs' import { getRepoSlug } from '../github/client' import { isDefaultGitHubHost } from '../../shared/github/repository-identity-key' import { detectHostedReviewProvider, getForgeProviderForRepository } from './forge-provider' diff --git a/src/main/source-control/hosted-review-execution-host-routing.test.ts b/src/main/source-control/hosted-review-execution-host-routing.test.ts index b06991e0dd4..9cd69798b3d 100644 --- a/src/main/source-control/hosted-review-execution-host-routing.test.ts +++ b/src/main/source-control/hosted-review-execution-host-routing.test.ts @@ -74,13 +74,15 @@ vi.mock('../git/command-runner/git-process-env', async (importOriginal) => ({ vi.mock('../git/source-control/upstream', () => ({ getUpstreamStatus: getUpstreamStatusMock })) -vi.mock('../git/repo', () => ({ +vi.mock('../git/repo', () => ({})) + +vi.mock('../../shared/git/refs/git-default-base-ref', async (importOriginal) => ({ + ...(await importOriginal>()), resolveDefaultBaseRefViaExec: resolveDefaultBaseRefViaExecMock })) vi.mock('../git/exact-ref-probe', () => ({ - probeAnyExactRef: probeAnyExactRefMock, - isShowRefNoMatchError: vi.fn(() => false) + probeAnyExactRef: probeAnyExactRefMock })) vi.mock('../git/worktrees/content-paths/worktree-symlink-detection', () => ({ diff --git a/src/main/source-control/hosted-review-inflight-invalidation.test.ts b/src/main/source-control/hosted-review-inflight-invalidation.test.ts index 088e9a02a85..0e2200ada17 100644 --- a/src/main/source-control/hosted-review-inflight-invalidation.test.ts +++ b/src/main/source-control/hosted-review-inflight-invalidation.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { HostedReviewInfo } from '../../shared/hosted-review' +import type { HostedReviewInfo } from '../../shared/source-control/hosted-review/hosted-review-contracts' import { __resetHostedReviewBranchCacheForTests, invalidateHostedReviewBranchCache, diff --git a/src/main/source-control/hosted-review-inflight-lookups.ts b/src/main/source-control/hosted-review-inflight-lookups.ts index cfc15a3a9f7..96808279dd5 100644 --- a/src/main/source-control/hosted-review-inflight-lookups.ts +++ b/src/main/source-control/hosted-review-inflight-lookups.ts @@ -1,4 +1,4 @@ -import type { HostedReviewForBranchOutcome } from '../../shared/hosted-review' +import type { HostedReviewForBranchOutcome } from '../../shared/source-control/hosted-review/hosted-review-contracts' import { HOSTED_REVIEW_LOOKUP_DEADLINE_MS, MAX_INFLIGHT_LOOKUPS diff --git a/src/main/source-control/hosted-review.ts b/src/main/source-control/hosted-review.ts index 4174e6e63e1..f920f8b0ab9 100644 --- a/src/main/source-control/hosted-review.ts +++ b/src/main/source-control/hosted-review.ts @@ -4,7 +4,7 @@ import { cachedHostedReviewOutcome, type HostedReviewForBranchOutcome, type HostedReviewInfo -} from '../../shared/hosted-review' +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { assertRemoteUrlReadable } from '../git/remotes/remote-url-probe' import { forgetGiteaPullRequestReads } from '../gitea/pull-request-read-forgetting' import { getForgeProviderForRepository, type ForgeProviderId } from './forge-provider' diff --git a/src/main/source-control/pull-request-linked-issue.ts b/src/main/source-control/pull-request-linked-issue.ts index 90c61930d91..ed5756f0bd0 100644 --- a/src/main/source-control/pull-request-linked-issue.ts +++ b/src/main/source-control/pull-request-linked-issue.ts @@ -1,6 +1,6 @@ -import type { HostedReviewProvider } from '../../shared/hosted-review' -import type { PullRequestLinkedIssue } from '../../shared/pull-request-generation' -import { isLinkedIssueNumber } from '../../shared/source-control-ai-action-variables' +import type { HostedReviewProvider } from '../../shared/source-control/hosted-review/hosted-review-contracts' +import type { PullRequestLinkedIssue } from '../../shared/source-control/ai/generation/pull-request-generation' +import { isLinkedIssueNumber } from '../../shared/source-control/ai/recipes/source-control-ai-action-variables' import type { WorkspaceLinkedItem } from '../../shared/worktree/types' import type { GitRuntimeOptions } from '../git/git-runtime-options' import { getIssue as getGitHubIssue } from '../github/issues' diff --git a/src/main/source-control/pull-request-template.ts b/src/main/source-control/pull-request-template.ts index 5ace4c7e98c..c0f23e75dab 100644 --- a/src/main/source-control/pull-request-template.ts +++ b/src/main/source-control/pull-request-template.ts @@ -1,6 +1,6 @@ import { readFile } from 'node:fs/promises' import { join } from 'node:path' -import type { HostedReviewProvider } from '../../shared/hosted-review' +import type { HostedReviewProvider } from '../../shared/source-control/hosted-review/hosted-review-contracts' const PULL_REQUEST_TEMPLATE_CANDIDATES = [ '.github/pull_request_template.md', diff --git a/src/main/source-control/repo-default-branch.ts b/src/main/source-control/repo-default-branch.ts index 67b67ea0dc2..7af70f71d64 100644 --- a/src/main/source-control/repo-default-branch.ts +++ b/src/main/source-control/repo-default-branch.ts @@ -1,5 +1,9 @@ -import { resolveDefaultBaseRefViaExec } from '../git/repo' -import { resolveRemoteHeadBranchViaExec, type GitExec } from '../../shared/git-default-base-ref' +import { + resolveDefaultBaseRefViaExec, + resolveRemoteHeadBranchViaExec, + type GitExec +} from '../../shared/git/refs/git-default-base-ref' + import { gitExecFileAsync } from '../git/runner' import { getRepoExecutionHostId } from '../../shared/execution-host' import { hostedReviewRepoScope, scopeGeneration } from './hosted-review-scope-generations' diff --git a/src/main/source-control/stacked-hosted-review-creation.ts b/src/main/source-control/stacked-hosted-review-creation.ts index 2360d75d19c..3c6aa158c99 100644 --- a/src/main/source-control/stacked-hosted-review-creation.ts +++ b/src/main/source-control/stacked-hosted-review-creation.ts @@ -6,14 +6,14 @@ import type { CreateStackedHostedReviewInput, CreateStackedHostedReviewResult, HostedReviewSummary -} from '../../shared/hosted-review' +} from '../../shared/source-control/hosted-review/hosted-review-contracts' import { prepareGitHubStackedPullRequest, registerGitHubStackedPullRequest } from '../github/stacked-pr-creation' import { createHostedReview } from './hosted-review-creation' import type { HostedReviewExecutionOptions } from './hosted-review-git-options' -import { stackedReviewFailure } from '../../shared/stacked-hosted-review-failure-copy' +import { stackedReviewFailure } from '../../shared/source-control/hosted-review/stacked-hosted-review-failure-copy' export async function createStackedHostedReview( repoPath: string, diff --git a/src/main/text-generation/agent-failure-output.ts b/src/main/text-generation/agent-failure-output.ts index f849387ab87..7b4e7f6c684 100644 --- a/src/main/text-generation/agent-failure-output.ts +++ b/src/main/text-generation/agent-failure-output.ts @@ -1,4 +1,4 @@ -import { stripAnsiControlSequences } from '../../shared/commit-message-agent-output' +import { stripAnsiControlSequences } from '../../shared/source-control/ai/generation/commit-message-agent-output' /** Bounded failure output is display-on-demand only; never persist or sync it. */ export type AgentGenerationFailureOutput = { diff --git a/src/main/text-generation/agent-generation-request.ts b/src/main/text-generation/agent-generation-request.ts index 9a69e455a20..c2225460fc0 100644 --- a/src/main/text-generation/agent-generation-request.ts +++ b/src/main/text-generation/agent-generation-request.ts @@ -2,15 +2,15 @@ import { textGenerationFailureCodeFields } from '../../shared/text-generation-fa import { runClaudeGenerationAttempts } from '../../shared/claude-background-run-isolation' import { cleanGeneratedCommitMessage, - stripPrefilledReasoningPreamble, - type CommandTemplateBackslash -} from '../../shared/commit-message-prompt' -import { isCustomAgentId } from '../../shared/commit-message-agent-spec' + stripPrefilledReasoningPreamble +} from '../../shared/source-control/ai/generation/commit-message-agent-output' +import type { CommandTemplateBackslash } from '../../shared/source-control/ai/generation/commit-message-prompt' +import { isCustomAgentId } from '../../shared/source-control/ai/generation/commit-message-agent-spec' import { planCommitMessageGeneration, type CommitMessagePlan -} from '../../shared/commit-message-plan' -import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control-ai' +} from '../../shared/source-control/ai/generation/commit-message-plan' +import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control/ai/source-control-ai-operation-resolution' import { openCodeVariantRetryPlan } from '../../shared/opencode-generation-command' import { copilotUnavailableModelRetryPlan } from './copilot-unavailable-model-retry' import { runLocalPlanForAgent } from './source-control-local-generation' diff --git a/src/main/text-generation/commit-message-model-discovery-policy.ts b/src/main/text-generation/commit-message-model-discovery-policy.ts index 77ed960d8e9..5a18527cb1f 100644 --- a/src/main/text-generation/commit-message-model-discovery-policy.ts +++ b/src/main/text-generation/commit-message-model-discovery-policy.ts @@ -1,6 +1,6 @@ import { buildClaudeModelListArgs } from '../../shared/claude-model-list-probe' -import type { CommandTemplateBackslash } from '../../shared/commit-message-prompt' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import type { CommandTemplateBackslash } from '../../shared/source-control/ai/generation/commit-message-prompt' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import { planAgentBinary } from '../../shared/agent-launch/startup/agent-command-plan' import type { AgentModelProbeSpec } from '../../shared/agent-model-probe-spec' import { formatAgentCliFailureMessage } from './source-control-agent-failure' diff --git a/src/main/text-generation/commit-message-model-discovery.ts b/src/main/text-generation/commit-message-model-discovery.ts index c290382bf63..22146fe06a9 100644 --- a/src/main/text-generation/commit-message-model-discovery.ts +++ b/src/main/text-generation/commit-message-model-discovery.ts @@ -1,11 +1,11 @@ import { isMissingProviderExecutable } from '../provider-process/provider-executable-missing' import { mergeCommandEnvironment } from '../../shared/command-environment' -import type { CommandTemplateBackslash } from '../../shared/commit-message-prompt' +import type { CommandTemplateBackslash } from '../../shared/source-control/ai/generation/commit-message-prompt' import { getAgentModelProbeSpec, type AgentModelProbeSpec } from '../../shared/agent-model-probe-spec' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import { runClaudeBackgroundAttempts, type ClaudeBackgroundFailedExit diff --git a/src/main/text-generation/commit-message-text-generation-generated-output.test.ts b/src/main/text-generation/commit-message-text-generation-generated-output.test.ts index cffc0549534..ef56c980b33 100644 --- a/src/main/text-generation/commit-message-text-generation-generated-output.test.ts +++ b/src/main/text-generation/commit-message-text-generation-generated-output.test.ts @@ -10,7 +10,7 @@ import { realKimiPrOutput, sourceShapedKimiOutput } from '../../shared/__fixtures__/kimi-generation-source-shaped' -import { cleanGeneratedCommitMessage } from '../../shared/commit-message-prompt' +import { cleanGeneratedCommitMessage } from '../../shared/source-control/ai/generation/commit-message-agent-output' import { finalizeFromAgentOutput } from './source-control-agent-failure' vi.mock('child_process', async (importOriginal) => { const actual = await importOriginal() diff --git a/src/main/text-generation/commit-message-text-generation.ts b/src/main/text-generation/commit-message-text-generation.ts index e948420f347..dd50593ac2e 100644 --- a/src/main/text-generation/commit-message-text-generation.ts +++ b/src/main/text-generation/commit-message-text-generation.ts @@ -1,19 +1,19 @@ import type { TextGenerationFailureFields } from '../../shared/text-generation-failure-copy' -import type { BranchNameWorkContext } from '../../shared/branch-name-from-work' -import type { ConversationNameContext } from '../../shared/conversation-name-generation' -import type { CommitMessageDraftContext } from '../../shared/commit-message-generation' -import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../shared/commit-message-host-key' -import type { CommandTemplateBackslash } from '../../shared/commit-message-prompt' +import type { BranchNameWorkContext } from '../../shared/source-control/ai/naming/branch-name-from-work' +import type { ConversationNameContext } from '../../shared/source-control/ai/generation/conversation-name-generation' +import type { CommitMessageDraftContext } from '../../shared/source-control/ai/generation/commit-message-generation' +import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../shared/source-control/ai/generation/commit-message-host-key' +import type { CommandTemplateBackslash } from '../../shared/source-control/ai/generation/commit-message-prompt' import type { GeneratedPullRequestFields, PullRequestDraftContext -} from '../../shared/pull-request-generation' +} from '../../shared/source-control/ai/generation/pull-request-generation' import type { Repo } from '../../shared/repo-types' import { resolveSourceControlAiForOperation, type ResolvedSourceControlAiGenerationParams -} from '../../shared/source-control-ai' -import type { AiTextOperation } from '../../shared/source-control-ai-types' +} from '../../shared/source-control/ai/source-control-ai-operation-resolution' +import type { AiTextOperation } from '../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { TuiAgent } from '../../shared/agent-launch/catalog/tui-agent' import { discoverModelsLocal, diff --git a/src/main/text-generation/conversation-name-generation-request.ts b/src/main/text-generation/conversation-name-generation-request.ts index b6541919737..022534aa8cc 100644 --- a/src/main/text-generation/conversation-name-generation-request.ts +++ b/src/main/text-generation/conversation-name-generation-request.ts @@ -2,8 +2,8 @@ import { renderConversationNamePrompt, sanitizeGeneratedConversationName, type ConversationNameContext -} from '../../shared/conversation-name-generation' -import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control-ai' +} from '../../shared/source-control/ai/generation/conversation-name-generation' +import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control/ai/source-control-ai-operation-resolution' import { captureAgentGenerationFailureOutput } from './agent-failure-output' import { runGenerationRequest } from './agent-generation-request' import type { diff --git a/src/main/text-generation/copilot-unavailable-model-retry.ts b/src/main/text-generation/copilot-unavailable-model-retry.ts index ce7dfcfcbc4..65038935df2 100644 --- a/src/main/text-generation/copilot-unavailable-model-retry.ts +++ b/src/main/text-generation/copilot-unavailable-model-retry.ts @@ -1,5 +1,5 @@ import { findOptionOccurrence } from '../../shared/command-option-occurrence' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import { escapeRegex } from '../../shared/string-utils' import type { AgentGenerationFailureOutput } from './agent-failure-output' diff --git a/src/main/text-generation/jira-issue-summary-requests.ts b/src/main/text-generation/jira-issue-summary-requests.ts index d1b198e05e6..eaff34e6c64 100644 --- a/src/main/text-generation/jira-issue-summary-requests.ts +++ b/src/main/text-generation/jira-issue-summary-requests.ts @@ -1,5 +1,5 @@ import os from 'node:os' -import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../shared/commit-message-host-key' +import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../shared/source-control/ai/generation/commit-message-host-key' import type { JiraIssueSummaryGenerationRequest, JiraIssueSummaryGenerationCancellation, diff --git a/src/main/text-generation/jira-issue-summary-text-generation.test.ts b/src/main/text-generation/jira-issue-summary-text-generation.test.ts index 81d37b54ff7..554fbe795e0 100644 --- a/src/main/text-generation/jira-issue-summary-text-generation.test.ts +++ b/src/main/text-generation/jira-issue-summary-text-generation.test.ts @@ -9,8 +9,8 @@ import type { } from './source-control-text-generation-types' import { getAgentModelProbeSpec } from '../../shared/agent-model-probe-spec' import { planModelDiscovery } from './commit-message-model-discovery-policy' -import { planCommitMessageGeneration } from '../../shared/commit-message-plan' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import { planCommitMessageGeneration } from '../../shared/source-control/ai/generation/commit-message-plan' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import { generateJiraIssueSummaryFromContext } from './jira-issue-summary-text-generation' function remoteTarget(execute: (plan: CommitMessagePlan) => Promise) { diff --git a/src/main/text-generation/jira-issue-summary-text-generation.ts b/src/main/text-generation/jira-issue-summary-text-generation.ts index 972a2c98c42..727aa349548 100644 --- a/src/main/text-generation/jira-issue-summary-text-generation.ts +++ b/src/main/text-generation/jira-issue-summary-text-generation.ts @@ -4,7 +4,7 @@ import { type JiraIssueSummaryGenerationContext, type JiraIssueSummaryGenerationResult } from '../../shared/jira/jira-issue-summary-generation' -import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control-ai' +import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control/ai/source-control-ai-operation-resolution' import { textGenerationFailure, textGenerationFailureCodeFields diff --git a/src/main/text-generation/kimi-generation-failure.ts b/src/main/text-generation/kimi-generation-failure.ts index aa9799b778c..fd106d13dad 100644 --- a/src/main/text-generation/kimi-generation-failure.ts +++ b/src/main/text-generation/kimi-generation-failure.ts @@ -1,4 +1,4 @@ -import { stripAnsiControlSequences } from '../../shared/commit-message-agent-output' +import { stripAnsiControlSequences } from '../../shared/source-control/ai/generation/commit-message-agent-output' import { withMacTailscaleDnsHint } from '../network/macos-tailscale-dns-diagnostic' import { textGenerationFailure, diff --git a/src/main/text-generation/pull-request-context.ts b/src/main/text-generation/pull-request-context.ts index 96516c31b66..4753fa44f09 100644 --- a/src/main/text-generation/pull-request-context.ts +++ b/src/main/text-generation/pull-request-context.ts @@ -1,5 +1,5 @@ -import type { PullRequestDraftContext } from '../../shared/pull-request-generation' -import { isSafeGitRefName } from '../../shared/git-status-upstream-ref' +import type { PullRequestDraftContext } from '../../shared/source-control/ai/generation/pull-request-generation' +import { isSafeGitRefName } from '../../shared/git/status/git-status-upstream-ref' import { isSafeReviewHeadFetchRemote } from '../../shared/review-head-tracking-ref' import { ReviewDraftContextError } from '../../shared/review-draft-context-error' import { diff --git a/src/main/text-generation/pull-request-remote-ref-probes.ts b/src/main/text-generation/pull-request-remote-ref-probes.ts index a3da967db02..509e9a74256 100644 --- a/src/main/text-generation/pull-request-remote-ref-probes.ts +++ b/src/main/text-generation/pull-request-remote-ref-probes.ts @@ -1,5 +1,5 @@ -import { isSafeGitRefName } from '../../shared/git-status-upstream-ref' -import { isRemoteHeadRef } from '../../shared/hosted-review-refs' +import { isSafeGitRefName } from '../../shared/git/status/git-status-upstream-ref' +import { isRemoteHeadRef } from '../../shared/source-control/hosted-review/hosted-review-refs' import { isSafeReviewHeadFetchRemote } from '../../shared/review-head-tracking-ref' import { probeExactRefsViaForEachRef, type ExactRefProbeExecOptions } from '../git/exact-ref-probe' diff --git a/src/main/text-generation/source-control-agent-failure.ts b/src/main/text-generation/source-control-agent-failure.ts index 668468720e8..6a0aa9397dd 100644 --- a/src/main/text-generation/source-control-agent-failure.ts +++ b/src/main/text-generation/source-control-agent-failure.ts @@ -2,7 +2,7 @@ import { cleanGeneratedCommitMessage, excerptAgentFailureOutput, sanitizeAgentFailureDetail -} from '../../shared/commit-message-prompt' +} from '../../shared/source-control/ai/generation/commit-message-agent-output' import { withMacTailscaleDnsHint } from '../network/macos-tailscale-dns-diagnostic' import { captureAgentGenerationFailureOutput, @@ -19,7 +19,7 @@ import { parseKimiGenerationOutput } from '../../shared/kimi-generation-output' import { formatKimiGenerationFailure } from './kimi-generation-failure' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import { textGenerationFailure, type TextGenerationFailureFields diff --git a/src/main/text-generation/source-control-command-line-budget.ts b/src/main/text-generation/source-control-command-line-budget.ts index bd2c46fdb9c..35c3b42c461 100644 --- a/src/main/text-generation/source-control-command-line-budget.ts +++ b/src/main/text-generation/source-control-command-line-budget.ts @@ -2,7 +2,7 @@ import { textGenerationFailure, type TextGenerationFailureFields } from '../../shared/text-generation-failure-copy' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import { commandLineLength, MAX_COMMAND_LINE_CHARS } from '../../shared/windows-command-line-budget' // Linux caps each argv entry in bytes (128KiB on 4KiB pages), before total argv capacity; reserve headroom for single-prompt arguments. diff --git a/src/main/text-generation/source-control-local-generation.ts b/src/main/text-generation/source-control-local-generation.ts index 79228176231..6e1a6056f2f 100644 --- a/src/main/text-generation/source-control-local-generation.ts +++ b/src/main/text-generation/source-control-local-generation.ts @@ -1,6 +1,6 @@ import { wslDistroForCommand } from '../../shared/wsl-paths' import { mergeCommandEnvironment } from '../../shared/command-environment' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import { resolveCodexHomeProcessLockKeyForSpawnEnv, withCodexHomeProcessLock diff --git a/src/main/text-generation/source-control-omp-prompt-file.test.ts b/src/main/text-generation/source-control-omp-prompt-file.test.ts index 71c92225d8b..871c5d91dbb 100644 --- a/src/main/text-generation/source-control-omp-prompt-file.test.ts +++ b/src/main/text-generation/source-control-omp-prompt-file.test.ts @@ -1,6 +1,6 @@ import { spawnProcess } from '@orca/process-host' -import * as agentSpecs from '../../shared/commit-message-agent-spec' -import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control-ai' +import * as agentSpecs from '../../shared/source-control/ai/generation/commit-message-agent-spec' +import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control/ai/source-control-ai-operation-resolution' import type { SpawnSourceControlAgent } from './source-control-text-generation-types' import { generateCommitMessage, @@ -16,7 +16,7 @@ import type * as FsPromises from 'node:fs/promises' import { tmpdir } from 'node:os' import { dirname, join } from 'node:path' import { afterEach, expect, it, vi } from 'vitest' -import { planCommitMessageGeneration } from '../../shared/commit-message-plan' +import { planCommitMessageGeneration } from '../../shared/source-control/ai/generation/commit-message-plan' import { cancelLocalGeneration } from './source-control-generation-lanes' import { SOURCE_CONTROL_GENERATION_TIMEOUT_MS } from './source-control-generation-limits' import { runLocalSourceControlPlan } from './source-control-local-process' diff --git a/src/main/text-generation/source-control-prompt-files.ts b/src/main/text-generation/source-control-prompt-files.ts index eb3f9e4677c..9c3b4198641 100644 --- a/src/main/text-generation/source-control-prompt-files.ts +++ b/src/main/text-generation/source-control-prompt-files.ts @@ -5,7 +5,7 @@ import { join } from 'node:path' import { getUtf8ChunkEndIndex } from '../../shared/utf8-byte-limits' import { encodePosixPrintfRecords } from '../../shared/posix-printf-encoding' import { toWindowsWslUncPath } from '../../shared/wsl-paths' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' // Reserve the transport signature under the native text attachment cap. const PAYLOAD_BYTES = 5 * 1024 * 1024 - 3 diff --git a/src/main/text-generation/source-control-remote-generation.ts b/src/main/text-generation/source-control-remote-generation.ts index 3a2c765e15e..f188327c4b5 100644 --- a/src/main/text-generation/source-control-remote-generation.ts +++ b/src/main/text-generation/source-control-remote-generation.ts @@ -1,4 +1,4 @@ -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import { isSshRequestOutcomeUnverifiable } from '../ssh/ssh-channel-multiplexer' import { WINDOWS_BATCH_UNSAFE_ARGUMENTS_ERROR } from '../../shared/windows-batch-spawn' import { diff --git a/src/main/text-generation/source-control-text-generation-requests.ts b/src/main/text-generation/source-control-text-generation-requests.ts index 8e0059bf3d9..8d87c5b60c5 100644 --- a/src/main/text-generation/source-control-text-generation-requests.ts +++ b/src/main/text-generation/source-control-text-generation-requests.ts @@ -2,28 +2,28 @@ import { buildCommitMessagePrompt, splitGeneratedCommitMessage, type CommitMessageDraftContext -} from '../../shared/commit-message-generation' +} from '../../shared/source-control/ai/generation/commit-message-generation' import { buildPullRequestFieldsPrompt, parseGeneratedPullRequestFields, type GeneratedPullRequestFields, type PullRequestDraftContext -} from '../../shared/pull-request-generation' +} from '../../shared/source-control/ai/generation/pull-request-generation' import { buildBranchNamePrompt, sanitizeBranchSlug, type BranchNameWorkContext -} from '../../shared/branch-name-from-work' +} from '../../shared/source-control/ai/naming/branch-name-from-work' import { cleanGeneratedCommitMessage, - STAGED_DIFF_BYTE_BUDGET, stripPrefilledReasoningPreamble -} from '../../shared/commit-message-prompt' -import { isCustomAgentId } from '../../shared/commit-message-agent-spec' -import { planCommitMessageGeneration } from '../../shared/commit-message-plan' -import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control-ai' -import { formatLinkedIssueTemplateValue } from '../../shared/source-control-ai-action-variables' -import { renderSourceControlActionCommandTemplate } from '../../shared/source-control-ai-actions' +} from '../../shared/source-control/ai/generation/commit-message-agent-output' +import { STAGED_DIFF_BYTE_BUDGET } from '../../shared/source-control/ai/generation/commit-message-prompt' +import { isCustomAgentId } from '../../shared/source-control/ai/generation/commit-message-agent-spec' +import { planCommitMessageGeneration } from '../../shared/source-control/ai/generation/commit-message-plan' +import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control/ai/source-control-ai-operation-resolution' +import { formatLinkedIssueTemplateValue } from '../../shared/source-control/ai/recipes/source-control-ai-action-variables' +import { renderSourceControlActionCommandTemplate } from '../../shared/source-control/ai/recipes/source-control-ai-actions' import { textGenerationFailure, textGenerationFailureCodeFields diff --git a/src/main/text-generation/source-control-text-generation-types.ts b/src/main/text-generation/source-control-text-generation-types.ts index b4775440c35..6bfdab779c2 100644 --- a/src/main/text-generation/source-control-text-generation-types.ts +++ b/src/main/text-generation/source-control-text-generation-types.ts @@ -4,8 +4,8 @@ import type { AgentGenerationFailureOutput } from './agent-failure-output' import type { CommitMessageAgentCapability, CommitMessageModelCapability -} from '../../shared/commit-message-agent-spec' -import type { CommitMessagePlan } from '../../shared/commit-message-plan' +} from '../../shared/source-control/ai/generation/commit-message-agent-spec' +import type { CommitMessagePlan } from '../../shared/source-control/ai/generation/commit-message-plan' import type { TextGenerationFailureFields } from '../../shared/text-generation-failure-copy' export type GenerateCommitMessageResult = diff --git a/src/main/text-generation/source-control-wsl-launch.test.ts b/src/main/text-generation/source-control-wsl-launch.test.ts index bc63b8e1786..93d74d836fb 100644 --- a/src/main/text-generation/source-control-wsl-launch.test.ts +++ b/src/main/text-generation/source-control-wsl-launch.test.ts @@ -9,7 +9,7 @@ import { quotePosixShell } from '../../shared/shell-argument-quoting' import { commandLineLength, MAX_COMMAND_LINE_CHARS } from '../../shared/windows-command-line-budget' import { prepareWslPrompt } from './source-control-prompt-files' import { producePromptRecords } from './source-control-prompt-producer' -import { planCommitMessageGeneration } from '../../shared/commit-message-plan' +import { planCommitMessageGeneration } from '../../shared/source-control/ai/generation/commit-message-plan' import { withPlatform, createMockDiscoveryChild diff --git a/src/main/text-generation/source-control-wsl-prompt.test.ts b/src/main/text-generation/source-control-wsl-prompt.test.ts index 7a614c92c03..fb7fad45fec 100644 --- a/src/main/text-generation/source-control-wsl-prompt.test.ts +++ b/src/main/text-generation/source-control-wsl-prompt.test.ts @@ -4,7 +4,7 @@ import { rm } from 'node:fs/promises' import { join } from 'node:path' import { Writable } from 'node:stream' import { afterEach, expect, it, vi } from 'vitest' -import { planCommitMessageGeneration } from '../../shared/commit-message-plan' +import { planCommitMessageGeneration } from '../../shared/source-control/ai/generation/commit-message-plan' import { prepareWslPrompt } from './source-control-prompt-files' import { producePromptRecords } from './source-control-prompt-producer' import { runLocalSourceControlPlan } from './source-control-local-process' diff --git a/src/main/workspaces/catalog/repo-git-remote-avatar-refresh.test.ts b/src/main/workspaces/catalog/repo-git-remote-avatar-refresh.test.ts index 23f99f3e59e..32c7f2b6c65 100644 --- a/src/main/workspaces/catalog/repo-git-remote-avatar-refresh.test.ts +++ b/src/main/workspaces/catalog/repo-git-remote-avatar-refresh.test.ts @@ -1,6 +1,6 @@ import { afterEach, expect, it, vi } from 'vitest' import { getRepoExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host' -import { deriveGitRemoteIdentity } from '../../../shared/git-remote-identity' +import { deriveGitRemoteIdentity } from '../../../shared/git/remotes/git-remote-identity' import { projectHostSetupProjectionFromRepos } from '../../../shared/project-host-setup-projection' import { githubAvatarIcon, type RepoIcon } from '../../../shared/repo-icon' import type { Repo } from '../../../shared/repo-types' diff --git a/src/main/workspaces/catalog/repo-git-remote-identity-enrichment.test.ts b/src/main/workspaces/catalog/repo-git-remote-identity-enrichment.test.ts index eb5bda13961..3bf25eb8ae8 100644 --- a/src/main/workspaces/catalog/repo-git-remote-identity-enrichment.test.ts +++ b/src/main/workspaces/catalog/repo-git-remote-identity-enrichment.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { getRepoExecutionHostId } from '../../../shared/execution-host' -import type { GitRemoteIdentity } from '../../../shared/git-remote-identity' +import type { GitRemoteIdentity } from '../../../shared/git/remotes/git-remote-identity' import type { Repo } from '../../../shared/repo-types' import type { RepoHostTarget } from '../../../shared/repo-host-identity' import { repoTarget } from '../../persistence/repo-host-target-matcher.test-fixture' diff --git a/src/main/workspaces/catalog/repo-git-remote-identity-enrichment.ts b/src/main/workspaces/catalog/repo-git-remote-identity-enrichment.ts index 684d98f4be6..c1ef9a5f50b 100644 --- a/src/main/workspaces/catalog/repo-git-remote-identity-enrichment.ts +++ b/src/main/workspaces/catalog/repo-git-remote-identity-enrichment.ts @@ -7,7 +7,7 @@ import { import type { Repo } from '../../../shared/repo-types' import type { RepoHostTarget } from '../../../shared/repo-host-identity' import { githubAvatarIcon, type RepoIcon } from '../../../shared/repo-icon' -import { isUnresolvedSshHostAlias } from '../../../shared/git-remote-host-alias' +import { isUnresolvedSshHostAlias } from '../../../shared/git/remotes/git-remote-host-alias' import { getProjectProviderIdentity } from '../../../shared/project-host-setup-projection' import { getStoredRepoExecutionHostId } from '../execution-host/repo-execution-host' import { probeGitRemoteIdentity } from './repo-git-remote-identity' diff --git a/src/main/workspaces/catalog/repo-git-remote-identity.ts b/src/main/workspaces/catalog/repo-git-remote-identity.ts index a6669e6bee3..5d0eb8a780c 100644 --- a/src/main/workspaces/catalog/repo-git-remote-identity.ts +++ b/src/main/workspaces/catalog/repo-git-remote-identity.ts @@ -3,7 +3,7 @@ import type { Repo } from '../../../shared/repo-types' import { deriveGitRemoteIdentity, type GitRemoteIdentity -} from '../../../shared/git-remote-identity' +} from '../../../shared/git/remotes/git-remote-identity' import { gitExecFileAsync } from '../../git/command-runner/git-exec-file' import { resolveGitRouteForHost } from '../../providers/execution-host-provider-dispatch' diff --git a/src/main/workspaces/removal/worktree-orphan-gitdir-proof.ts b/src/main/workspaces/removal/worktree-orphan-gitdir-proof.ts index 57fd37471ff..1fa2de8f1a6 100644 --- a/src/main/workspaces/removal/worktree-orphan-gitdir-proof.ts +++ b/src/main/workspaces/removal/worktree-orphan-gitdir-proof.ts @@ -1,6 +1,6 @@ import type { posix } from 'node:path' import { isDefinitiveAbsence } from '../../../shared/definitive-filesystem-absence' -import { resolveGitCommonDirectory } from '../../../shared/git-common-directory' +import { resolveGitCommonDirectory } from '../../../shared/git/metadata/git-common-directory' import { areResolvedPathsEqual, canonicalOwnerPathsEqual, diff --git a/src/preload/api/git-bridge.ts b/src/preload/api/git-bridge.ts index 8f0a6cea62c..ffcfba9cf11 100644 --- a/src/preload/api/git-bridge.ts +++ b/src/preload/api/git-bridge.ts @@ -1,10 +1,16 @@ import { ipcRenderer } from 'electron' -import type { GitForkSyncExpectedUpstream, GitForkSyncResult } from '../../shared/git-fork-sync' -import type { GitStagingArea, GitUpstreamStatus } from '../../shared/git-status-types' -import type { ConflictResolution } from '../../shared/source-control-entry-actions' +import type { + GitForkSyncExpectedUpstream, + GitForkSyncResult +} from '../../shared/git/remotes/git-fork-sync' +import type { GitStagingArea, GitUpstreamStatus } from '../../shared/git/status/git-status-types' +import type { ConflictResolution } from '../../shared/source-control/listing/source-control-entry-actions' import type { GitPushTarget } from '../../shared/worktree/types' -import type { GitStageWorktreeScope } from '../../shared/git-stage-worktree-scope' -import type { GitHistoryOptions, GitHistoryResult } from '../../shared/git-history' +import type { GitStageWorktreeScope } from '../../shared/git/paths/git-stage-worktree-scope' +import type { + GitHistoryOptions, + GitHistoryResult +} from '../../shared/git/history/git-history-types' import type { PreloadApi } from '../api-types' export const gitApi = { diff --git a/src/preload/api/git-inspection-api.ts b/src/preload/api/git-inspection-api.ts index 54f10e88cc6..a7ee8ee5564 100644 --- a/src/preload/api/git-inspection-api.ts +++ b/src/preload/api/git-inspection-api.ts @@ -2,20 +2,23 @@ import type { GitBranchCompareResult, GitCommitCompareResult, GitDiffResult -} from '../../shared/git-diff-compare-types' -import type { GitMutationInFlight } from '../../shared/git-mutation-in-flight' +} from '../../shared/git/diff/git-diff-compare-types' +import type { GitMutationInFlight } from '../../shared/git/commands/git-mutation-in-flight' import type { GitConflictOperation, GitStagingArea, GitStatusResult, GitUpstreamStatus -} from '../../shared/git-status-types' +} from '../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../shared/worktree/types' -import type { GitHistoryOptions, GitHistoryResult } from '../../shared/git-history' +import type { + GitHistoryOptions, + GitHistoryResult +} from '../../shared/git/history/git-history-types' import type { CommitMessageAgentCapability, CommitMessageModelCapability -} from '../../shared/commit-message-agent-spec' +} from '../../shared/source-control/ai/generation/commit-message-agent-spec' export type GitInspectionApi = { status: (args: { diff --git a/src/preload/api/git-operation-api.ts b/src/preload/api/git-operation-api.ts index e9e3ecffa3c..9274f2b7b8f 100644 --- a/src/preload/api/git-operation-api.ts +++ b/src/preload/api/git-operation-api.ts @@ -1,11 +1,14 @@ -import type { GitForkSyncExpectedUpstream, GitForkSyncResult } from '../../shared/git-fork-sync' +import type { + GitForkSyncExpectedUpstream, + GitForkSyncResult +} from '../../shared/git/remotes/git-fork-sync' import type { TuiAgent } from '../../shared/agent-launch/catalog/tui-agent' import type { GitPushTarget } from '../../shared/worktree/types' -import type { GitStageWorktreeScope } from '../../shared/git-stage-worktree-scope' -import type { ConflictResolution } from '../../shared/source-control-entry-actions' -import type { HostedReviewProvider } from '../../shared/hosted-review' -import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control-ai' -import type { SourceControlAiSettings } from '../../shared/source-control-ai-types' +import type { GitStageWorktreeScope } from '../../shared/git/paths/git-stage-worktree-scope' +import type { ConflictResolution } from '../../shared/source-control/listing/source-control-entry-actions' +import type { HostedReviewProvider } from '../../shared/source-control/hosted-review/hosted-review-contracts' +import type { ResolvedSourceControlAiGenerationParams } from '../../shared/source-control/ai/source-control-ai-operation-resolution' +import type { SourceControlAiSettings } from '../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { TextGenerationFailureFields } from '../../shared/text-generation-failure-copy' export type GitOperationApi = { diff --git a/src/preload/api/hosted-review-api.ts b/src/preload/api/hosted-review-api.ts index 9df1fdaa232..78e70ea83b6 100644 --- a/src/preload/api/hosted-review-api.ts +++ b/src/preload/api/hosted-review-api.ts @@ -13,7 +13,7 @@ import type { HostedReviewForBranchArgs, HostedReviewForBranchReply, HostedReviewInfo -} from '../../shared/hosted-review' +} from '../../shared/source-control/hosted-review/hosted-review-contracts' export type HostedReviewApi = { forBranch: { diff --git a/src/preload/api/hosted-review-bridge.ts b/src/preload/api/hosted-review-bridge.ts index b7e0d12af5c..bcb55e31fb1 100644 --- a/src/preload/api/hosted-review-bridge.ts +++ b/src/preload/api/hosted-review-bridge.ts @@ -1,5 +1,5 @@ import { ipcRenderer } from 'electron' -import type { HostedReviewForBranchArgs } from '../../shared/hosted-review' +import type { HostedReviewForBranchArgs } from '../../shared/source-control/hosted-review/hosted-review-contracts' import type { PreloadApi } from '../api-types' export const hostedReviewApi = { diff --git a/src/renderer/src/app-shell/visible-review-twin-hosts.test.ts b/src/renderer/src/app-shell/visible-review-twin-hosts.test.ts index 41a1cf1f59c..6d310229061 100644 --- a/src/renderer/src/app-shell/visible-review-twin-hosts.test.ts +++ b/src/renderer/src/app-shell/visible-review-twin-hosts.test.ts @@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { Repo } from '../../../shared/repo-types' import type { ExecutionHostId } from '../../../shared/execution-host' import type { GitHubPRRefreshCandidate } from '../../../shared/github/pull-request-refresh-types' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import { createGlobalSettingsFixture } from '../../../shared/global-settings-test-fixture' import { createTestStore, diff --git a/src/renderer/src/components/agent/AgentLaunchPicker.form.test.tsx b/src/renderer/src/components/agent/AgentLaunchPicker.form.test.tsx index 985b2f26b7e..364c6f741c4 100644 --- a/src/renderer/src/components/agent/AgentLaunchPicker.form.test.tsx +++ b/src/renderer/src/components/agent/AgentLaunchPicker.form.test.tsx @@ -18,7 +18,7 @@ import { sourceControlPickerDraft, applySourceControlPickerDraft } from '../../lib/source-control-agent-launch-picker' -import { canonicalSourceControlActionSelection } from '../../../../shared/source-control-action-selection' +import { canonicalSourceControlActionSelection } from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import { AgentLaunchSetupButton, useAgentPickerDraftScope } from './AgentLaunchSetupButton' import { AgentLaunchPickerMenu } from './AgentLaunchPickerMenu' import { diff --git a/src/renderer/src/components/agent/launch-settings/AgentChoiceControls.tsx b/src/renderer/src/components/agent/launch-settings/AgentChoiceControls.tsx index 8be5f236559..26ab7bd0964 100644 --- a/src/renderer/src/components/agent/launch-settings/AgentChoiceControls.tsx +++ b/src/renderer/src/components/agent/launch-settings/AgentChoiceControls.tsx @@ -12,7 +12,7 @@ import { import { sourceControlActionAgentPicksModel, sourceControlActionOptions -} from '../../../../../shared/source-control-action-options' +} from '../../../../../shared/source-control/ai/recipes/source-control-action-options' import { encodeCatalogOptionValue } from '../../../../../shared/agent-session/options/structured-agent-session-option-codec' import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' import { AgentChoiceMenu } from './AgentChoiceMenu' diff --git a/src/renderer/src/components/agent/launch-settings/AgentChoiceOptionField.tsx b/src/renderer/src/components/agent/launch-settings/AgentChoiceOptionField.tsx index 696d7fef210..839fc7b1881 100644 --- a/src/renderer/src/components/agent/launch-settings/AgentChoiceOptionField.tsx +++ b/src/renderer/src/components/agent/launch-settings/AgentChoiceOptionField.tsx @@ -3,7 +3,7 @@ import { Label } from '../../ui/label' import { SelectTrigger, SelectValue } from '../../ui/select' import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip' import { translate } from '@/i18n/i18n' -import type { SourceControlActionChoiceRoute } from '../../../../../shared/source-control-action-options' +import type { SourceControlActionChoiceRoute } from '../../../../../shared/source-control/ai/recipes/source-control-action-options' export function SourceControlActionOptionField({ label, diff --git a/src/renderer/src/components/agent/launch-settings/agent-default-env-draft.ts b/src/renderer/src/components/agent/launch-settings/agent-default-env-draft.ts index 644937c3df8..504f30bfe05 100644 --- a/src/renderer/src/components/agent/launch-settings/agent-default-env-draft.ts +++ b/src/renderer/src/components/agent/launch-settings/agent-default-env-draft.ts @@ -1,5 +1,5 @@ import { isClipboardTextByteLengthOverLimit } from '../../../../../shared/clipboard-text' -import { tokenizeCustomCommandTemplate } from '../../../../../shared/commit-message-prompt' +import { tokenizeCustomCommandTemplate } from '../../../../../shared/source-control/ai/generation/commit-message-prompt' import { quotePosixShellDoubleQuotedApostrophe } from '../../../../../shared/shell-argument-quoting' // Reject oversized pasted overrides before tokenization. diff --git a/src/renderer/src/components/browser-pane/new-tab/browser-new-tab-workspace-card.tsx b/src/renderer/src/components/browser-pane/new-tab/browser-new-tab-workspace-card.tsx index 68193bb8137..35512f16880 100644 --- a/src/renderer/src/components/browser-pane/new-tab/browser-new-tab-workspace-card.tsx +++ b/src/renderer/src/components/browser-pane/new-tab/browser-new-tab-workspace-card.tsx @@ -1,7 +1,7 @@ import { getProviderChecksOutcome, type CheckPresentationOutcome -} from '../../../../../shared/provider-check-summary' +} from '../../../../../shared/source-control/checks/provider-check-summary' import { useState } from 'react' import { ChevronRight, CircleDot, GitMerge, GitPullRequest } from 'lucide-react' import { translate } from '@/i18n/i18n' @@ -11,7 +11,7 @@ import { JiraIcon } from '@/components/icons/JiraIcon' import { getReviewStateTone } from '@/components/github/review-state-presentation' import { workspaceAttachmentReferenceLabel } from '../../../../../shared/workspace-attachments' import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' -import type { HostedReviewState } from '../../../../../shared/hosted-review' +import type { HostedReviewState } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { ReviewIcon } from '../../sidebar/worktree-review-helpers' import { workspaceAttachmentLabel } from '../../sidebar/worktree-attachment-editing' import type { WorkspaceLinkedItemRow } from '../../sidebar/workspace-hover-attachments' diff --git a/src/renderer/src/components/cmd-j/worktree-checks-review-index.test.ts b/src/renderer/src/components/cmd-j/worktree-checks-review-index.test.ts index bb11cc26c62..5b009e603ff 100644 --- a/src/renderer/src/components/cmd-j/worktree-checks-review-index.test.ts +++ b/src/renderer/src/components/cmd-j/worktree-checks-review-index.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRInfo } from '../../../../shared/github/pull-request-types' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' diff --git a/src/renderer/src/components/cmd-j/worktree-checks-review-index.ts b/src/renderer/src/components/cmd-j/worktree-checks-review-index.ts index 02628fbcb8e..ab0ae1f68e0 100644 --- a/src/renderer/src/components/cmd-j/worktree-checks-review-index.ts +++ b/src/renderer/src/components/cmd-j/worktree-checks-review-index.ts @@ -3,7 +3,7 @@ import { resolvePaletteRepoForWorktree } from '@/lib/palette-repo-resolution' import { getGitHubPRCacheKey } from '../../../../shared/github/github-cache-key' import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-identity' import type { AppState } from '@/store/types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' import { isGitHubPRSuppressed } from '../../../../shared/worktree/github-pr-suppression' diff --git a/src/renderer/src/components/dashboard/dashboard-card-context.test.ts b/src/renderer/src/components/dashboard/dashboard-card-context.test.ts index a2b47f53a2c..8034ef9cd4c 100644 --- a/src/renderer/src/components/dashboard/dashboard-card-context.test.ts +++ b/src/renderer/src/components/dashboard/dashboard-card-context.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRInfo } from '../../../../shared/github/pull-request-types' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' diff --git a/src/renderer/src/components/dashboard/dashboard-card-context.ts b/src/renderer/src/components/dashboard/dashboard-card-context.ts index 6afd1a5bb07..6168bbe8968 100644 --- a/src/renderer/src/components/dashboard/dashboard-card-context.ts +++ b/src/renderer/src/components/dashboard/dashboard-card-context.ts @@ -2,8 +2,8 @@ import { branchName } from '@/lib/git-utils' import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-identity' import type { AppState } from '@/store/types' import type { DashboardCardReview } from '../../../../shared/dashboard-snapshot' -import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/hosted-review-github' -import { isPositiveHostedReviewNumber } from '../../../../shared/hosted-review' +import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/source-control/hosted-review/hosted-review-github' +import { isPositiveHostedReviewNumber } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import type { WorkspaceStatusDefinition, Worktree } from '../../../../shared/worktree/types' import { diff --git a/src/renderer/src/components/editor/ChangesModeView.tsx b/src/renderer/src/components/editor/ChangesModeView.tsx index bb0705bc676..ab9e24895a9 100644 --- a/src/renderer/src/components/editor/ChangesModeView.tsx +++ b/src/renderer/src/components/editor/ChangesModeView.tsx @@ -1,8 +1,8 @@ import React from 'react' import { lazyWithRetry as lazy } from '@/lib/lazy-with-retry' import type { OpenFile } from '@/store/slices/editor' -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { ConflictBanner } from './ConflictComponents' import { getDiffContentSignature } from './diff-content-signature' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/editor/CheckRunDetailsPanel.copy.test.tsx b/src/renderer/src/components/editor/CheckRunDetailsPanel.copy.test.tsx index 5bcaaeaf768..c8cd621aa26 100644 --- a/src/renderer/src/components/editor/CheckRunDetailsPanel.copy.test.tsx +++ b/src/renderer/src/components/editor/CheckRunDetailsPanel.copy.test.tsx @@ -6,7 +6,7 @@ import { TooltipProvider } from '@/components/ui/tooltip' import type { PRCheckDetail, PRCheckRunDetails } from '../../../../shared/github/check-types' import { CheckRunDetailsPanel } from './CheckRunDetailsPanel' import * as normalization from '@/lib/check-run-details-log-normalization' -import * as sanitation from '../../../../shared/check-job-log-excerpt' +import * as sanitation from '../../../../shared/source-control/checks/logs/check-job-log-excerpt' import { captured, checkLogDetails, diff --git a/src/renderer/src/components/editor/CheckRunJobs.tsx b/src/renderer/src/components/editor/CheckRunJobs.tsx index e5b241570af..285d1ce89b0 100644 --- a/src/renderer/src/components/editor/CheckRunJobs.tsx +++ b/src/renderer/src/components/editor/CheckRunJobs.tsx @@ -8,7 +8,7 @@ import { resolveStepOutcome, summarizeJobSteps, type StepOutcome -} from '../../../../shared/pr-check-step-status' +} from '../../../../shared/source-control/checks/pr-check-step-status' import { formatJobsForClipboard } from './check-run-clipboard-text' import { CheckRunCopyButton } from './CheckRunCopyButton' import { Badge } from '@/components/ui/badge' diff --git a/src/renderer/src/components/editor/ConflictComponents.tsx b/src/renderer/src/components/editor/ConflictComponents.tsx index 38c605350ad..4e7848a0c38 100644 --- a/src/renderer/src/components/editor/ConflictComponents.tsx +++ b/src/renderer/src/components/editor/ConflictComponents.tsx @@ -13,7 +13,10 @@ import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { cn } from '@/lib/utils' import type { ConflictReviewEntry, OpenFile } from '@/store/slices/editor' -import type { GitConflictKind, GitStatusEntry } from '../../../../shared/git-status-types' +import type { + GitConflictKind, + GitStatusEntry +} from '../../../../shared/git/status/git-status-types' import { ConflictReviewFileTree } from './ConflictReviewFileTree' import { getIntlLocale, translate } from '@/i18n/i18n' import { createLocalizedCatalog } from '@/i18n/localized-catalog' diff --git a/src/renderer/src/components/editor/ConflictReviewFileTree.tsx b/src/renderer/src/components/editor/ConflictReviewFileTree.tsx index dfa0e800d9d..14f6bd870aa 100644 --- a/src/renderer/src/components/editor/ConflictReviewFileTree.tsx +++ b/src/renderer/src/components/editor/ConflictReviewFileTree.tsx @@ -8,10 +8,10 @@ import { compactSourceControlTree, flattenSourceControlTree, type SourceControlTreeNode -} from '../../../../shared/source-control-tree' +} from '../../../../shared/source-control/listing/source-control-tree' import { VirtualizedList } from '@/components/virtualized-list' import type { ConflictReviewEntry } from '@/store/slices/editor' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { translate } from '@/i18n/i18n' type ConflictReviewTreeEntry = ConflictReviewEntry & { diff --git a/src/renderer/src/components/editor/EditorConflictReviewSurface.live-record.test.tsx b/src/renderer/src/components/editor/EditorConflictReviewSurface.live-record.test.tsx index 8b49c6e97d0..c6e3e659dd8 100644 --- a/src/renderer/src/components/editor/EditorConflictReviewSurface.live-record.test.tsx +++ b/src/renderer/src/components/editor/EditorConflictReviewSurface.live-record.test.tsx @@ -5,7 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { StoreApi } from 'zustand' import type { AppState } from '@/store' import type { OpenFile, PendingEditorReveal } from '@/store/slices/editor' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures' import { createEditorStore } from './editor-autosave-controller-test-fixture' import { createEditorPanelDraftSelector } from './editor-panel-draft-selector' diff --git a/src/renderer/src/components/editor/EditorConflictReviewSurface.tsx b/src/renderer/src/components/editor/EditorConflictReviewSurface.tsx index 6f4fc4aa086..2946e6145a9 100644 --- a/src/renderer/src/components/editor/EditorConflictReviewSurface.tsx +++ b/src/renderer/src/components/editor/EditorConflictReviewSurface.tsx @@ -4,7 +4,7 @@ import { detectLanguage } from '@/lib/language-detect' import { joinPath } from '@/lib/path' import { useAppStore } from '@/store' import type { OpenFile, PendingEditorReveal } from '@/store/slices/editor' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { ConflictBanner, ConflictPlaceholderView, ConflictReviewPanel } from './ConflictComponents' import { ImageViewer, MonacoEditor } from './editor-lazy-views' import { EditorFileLoadErrorView } from './EditorFileLoadErrorView' diff --git a/src/renderer/src/components/editor/EditorContent.tsx b/src/renderer/src/components/editor/EditorContent.tsx index be9ce23c580..d03a133d42e 100644 --- a/src/renderer/src/components/editor/EditorContent.tsx +++ b/src/renderer/src/components/editor/EditorContent.tsx @@ -1,8 +1,8 @@ import { useAppStore } from '@/store' import type { ActivePluginCustomEditor } from '@/store/plugin-custom-editors' import type { MarkdownViewMode, OpenFile, PendingEditorReveal } from '@/store/slices/editor' -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { CheckRunDetailsPanel } from './CheckRunDetailsPanel' import { CombinedDiffViewer, MarkdownPreview } from './editor-lazy-views' import { EditorConflictReviewSurface } from './EditorConflictReviewSurface' diff --git a/src/renderer/src/components/editor/EditorDiffFileSurface.tsx b/src/renderer/src/components/editor/EditorDiffFileSurface.tsx index dce533d2217..a456612048d 100644 --- a/src/renderer/src/components/editor/EditorDiffFileSurface.tsx +++ b/src/renderer/src/components/editor/EditorDiffFileSurface.tsx @@ -1,7 +1,7 @@ import { DiffTooLargeNotice } from './DiffTooLargeNotice' import { translate } from '@/i18n/i18n' import type { OpenFile } from '@/store/slices/editor' -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' import { getDiffContentSignature } from './diff-content-signature' import { DiffViewer, ImageDiffViewer, MarkdownPreview } from './editor-lazy-views' import { ExternalFileChangeBanner } from './ExternalFileChangeBanner' diff --git a/src/renderer/src/components/editor/EditorEditFileSurface.tsx b/src/renderer/src/components/editor/EditorEditFileSurface.tsx index 2e14e551da1..9291e3fd9d8 100644 --- a/src/renderer/src/components/editor/EditorEditFileSurface.tsx +++ b/src/renderer/src/components/editor/EditorEditFileSurface.tsx @@ -1,8 +1,8 @@ import { translate } from '@/i18n/i18n' import { getConnectionIdForFile } from '@/lib/connection-context' import type { MarkdownViewMode, OpenFile, PendingEditorReveal } from '@/store/slices/editor' -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { ChangesModeView } from './ChangesModeView' import { ConflictBanner, ConflictPlaceholderView } from './ConflictComponents' import { diff --git a/src/renderer/src/components/editor/check-details-reading-cache.ts b/src/renderer/src/components/editor/check-details-reading-cache.ts index efa9b7617e3..1d9bc8651ef 100644 --- a/src/renderer/src/components/editor/check-details-reading-cache.ts +++ b/src/renderer/src/components/editor/check-details-reading-cache.ts @@ -2,7 +2,7 @@ import type { PRCheckJob, PRCheckRunDetails } from '../../../../shared/github/ch import type { OpenCheckRunDetailsState } from '../../../../shared/editor-tab-view-types' import { scrollTopCache, setWithLRU } from '@/lib/scroll-cache' import { sha256 } from '@/lib/sha256' -import { resolveStepOutcome } from '../../../../shared/pr-check-step-status' +import { resolveStepOutcome } from '../../../../shared/source-control/checks/pr-check-step-status' export function checkJobIdentities( jobs: readonly PRCheckJob[] diff --git a/src/renderer/src/components/editor/check-details-reading-owner.ts b/src/renderer/src/components/editor/check-details-reading-owner.ts index 77537f04331..2339a844c7c 100644 --- a/src/renderer/src/components/editor/check-details-reading-owner.ts +++ b/src/renderer/src/components/editor/check-details-reading-owner.ts @@ -1,5 +1,5 @@ import type { OpenFile } from '@/store/slices/editor' -import { resolveStepOutcome } from '../../../../shared/pr-check-step-status' +import { resolveStepOutcome } from '../../../../shared/source-control/checks/pr-check-step-status' import { scrollTopCache, setWithLRU } from '@/lib/scroll-cache' import { cancelCheckReadingIntents, diff --git a/src/renderer/src/components/editor/check-run-details-fix-context.ts b/src/renderer/src/components/editor/check-run-details-fix-context.ts index aa60e99e826..c723f4e0e13 100644 --- a/src/renderer/src/components/editor/check-run-details-fix-context.ts +++ b/src/renderer/src/components/editor/check-run-details-fix-context.ts @@ -2,14 +2,14 @@ import { buildFixBrokenChecksPrompt, getBrokenChecks, getCheckDetailsPromptKey -} from '../../../../shared/pr-checks-fix-prompt' +} from '../../../../shared/source-control/checks/pr-checks-fix-prompt' import { gitHubPRToChecksPanelReview } from '@/components/right-sidebar/checks-panel-review' import { getWorktreeGitIdentityDisplay } from '../../../../shared/worktree/git-identity-display' import { useAppStore } from '@/store' import { getGitHubPRCacheKey } from '../../../../shared/github/github-cache-key' import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-identity' import { findWorktreeById } from '@/store/slices/worktree-helpers' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRCheckDetail, PRCheckRunDetails } from '../../../../shared/github/check-types' import type { Repo } from '../../../../shared/repo-types' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/editor/check-run-details-fix-with-ai.test.ts b/src/renderer/src/components/editor/check-run-details-fix-with-ai.test.ts index f9fff1d0421..7ff2b90c7cf 100644 --- a/src/renderer/src/components/editor/check-run-details-fix-with-ai.test.ts +++ b/src/renderer/src/components/editor/check-run-details-fix-with-ai.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import * as normalization from '@/lib/check-run-details-log-normalization' -import * as sanitation from '../../../../shared/check-job-log-excerpt' +import * as sanitation from '../../../../shared/source-control/checks/logs/check-job-log-excerpt' import { captured, checkLogDetails, diff --git a/src/renderer/src/components/editor/check-run-details-fix-with-ai.ts b/src/renderer/src/components/editor/check-run-details-fix-with-ai.ts index 6935c92bf47..0139382b62b 100644 --- a/src/renderer/src/components/editor/check-run-details-fix-with-ai.ts +++ b/src/renderer/src/components/editor/check-run-details-fix-with-ai.ts @@ -11,19 +11,19 @@ import { import { openSourceControlAiSettingsTarget } from '@/components/right-sidebar/source-control-ai-settings-navigation' import { getConnectionId } from '@/lib/connection-context' import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch' -import { readSourceControlLaunchRecipeAgentId } from '../../../../shared/source-control-launch-agent-selection' +import { readSourceControlLaunchRecipeAgentId } from '../../../../shared/source-control/ai/source-control-launch-agent-selection' import { resolveRepoWorktreeLaunchPlatform } from '@/lib/execution-host-facts' import { useAppStore } from '@/store' import { findWorktreeById } from '@/store/slices/worktree-helpers' -import { resolveSourceControlActionRecipe } from '../../../../shared/source-control-ai' +import { resolveSourceControlActionRecipe } from '../../../../shared/source-control/ai/source-control-ai-operation-policy' import { saveSourceControlActionRecipe, type SourceControlAiWriteTarget -} from '../../../../shared/source-control-ai-recipe-save' +} from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import type { SourceControlActionRecipe, SourceControlLaunchActionId -} from '../../../../shared/source-control-ai-actions' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { PRCheckDetail, PRCheckRunDetails } from '../../../../shared/github/check-types' import { translate } from '@/i18n/i18n' import { selectWorktreesByRepo } from '@/store/workspace-record-selectors' diff --git a/src/renderer/src/components/editor/combined-diff-on-demand-load.ts b/src/renderer/src/components/editor/combined-diff-on-demand-load.ts index 2399c4bb24b..def50e805eb 100644 --- a/src/renderer/src/components/editor/combined-diff-on-demand-load.ts +++ b/src/renderer/src/components/editor/combined-diff-on-demand-load.ts @@ -1,6 +1,6 @@ import { hasBinaryFileExtension } from '../../../../shared/binary-file-extensions' -import type { GitBranchChangeEntry } from '../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' export const MAX_AUTOMATIC_DIFF_CHANGED_LINES = 10_000 diff --git a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-collapsed-work.test.tsx b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-collapsed-work.test.tsx index 1951f69df23..a547aefb4c8 100644 --- a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-collapsed-work.test.tsx +++ b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-collapsed-work.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 type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' vi.mock('@/store', () => ({ useAppStore: (selector: (state: Record) => unknown) => diff --git a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-filter.ts b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-filter.ts index fd4bdb25b96..079608a362e 100644 --- a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-filter.ts +++ b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-filter.ts @@ -1,12 +1,12 @@ import { basename } from '@/lib/path' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' import type { DiffSection } from '../../diff-section-types' import { isClipboardTextByteLengthOverLimit } from '../../../../../../shared/clipboard-text' import { buildSourceControlTree, compactSourceControlTree, flattenSourceControlTree -} from '../../../../../../shared/source-control-tree' +} from '../../../../../../shared/source-control/listing/source-control-tree' import { getCombinedDiffFileTreeSectionKey, isGitStatusEntry, diff --git a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-model.ts b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-model.ts index a8ba21bd76d..ca2b5b5a213 100644 --- a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-model.ts +++ b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-model.ts @@ -1,12 +1,15 @@ -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry, GitStagingArea } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { + GitStatusEntry, + GitStagingArea +} from '../../../../../../shared/git/status/git-status-types' import { buildGitStatusSourceControlTree, buildSourceControlTree, compactSourceControlTree, flattenSourceControlTree, type SourceControlTreeNode -} from '../../../../../../shared/source-control-tree' +} from '../../../../../../shared/source-control/listing/source-control-tree' import { getCombinedDiffFileTreeSectionKey, isGitStatusEntry, diff --git a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-render.test.tsx b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-render.test.tsx index 3889b85260f..d6b97d8ca53 100644 --- a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-render.test.tsx +++ b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-render.test.tsx @@ -3,7 +3,7 @@ import React, { act, useCallback, useMemo, useState, type ReactElement } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' import type { CombinedDiffFileTreeRow as CombinedDiffFileTreeRowComponent } from './combined-diff-file-tree-row' const rowRenders = vi.hoisted(() => ({ count: 0 })) 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 11122e9ce93..4d4a668e0af 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,18 +1,19 @@ import { createElement, memo } from 'react' import { ChevronDown } from 'lucide-react' -import { STATUS_COLORS, STATUS_LABELS } from '@/components/right-sidebar/status-display' -import type { SourceControlTreeNode } from '../../../../../../shared/source-control-tree' +import { STATUS_COLORS } from '@/components/right-sidebar/status-display' +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' import { basename, dirname, joinPath } from '@/lib/path' import { cn } from '@/lib/utils' import { WORKSPACE_FILE_PATH_MIME } from '@/lib/workspace-file-drag' import { writeWorkspaceFileDragSourceForWorkspace } from '@/lib/workspace-file-drag-source' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' import type { GitFileStatus, GitStagingArea, GitStatusEntry -} from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/status/git-status-types' import { getCombinedDiffFileTreeSectionKey, type CombinedDiffBranchTreeArea, diff --git a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-windowing.test.tsx b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-windowing.test.tsx index 407ab024f61..dc259692e36 100644 --- a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-windowing.test.tsx +++ b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree-windowing.test.tsx @@ -4,7 +4,7 @@ import React, { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' import type { CombinedDiffFileTreeRow as CombinedDiffFileTreeRowComponent } from './combined-diff-file-tree-row' const mountedRows = vi.hoisted(() => ({ count: 0 })) diff --git a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree.test.ts b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree.test.ts index 3dfe8b2d3b7..3958c50ab01 100644 --- a/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree.test.ts +++ b/src/renderer/src/components/editor/combined-diff/browse-files/combined-diff-file-tree.test.ts @@ -16,8 +16,8 @@ import { buildCombinedDiffBranchTreeRoots, getViewedCombinedDiffTreeVisibility } from './combined-diff-file-tree-model' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' describe('CombinedDiffFileTree navigation mapping', () => { it('disambiguates uncommitted entries with the same path by area', () => { diff --git a/src/renderer/src/components/editor/combined-diff/browse-files/use-combined-diff-tree-navigation.ts b/src/renderer/src/components/editor/combined-diff/browse-files/use-combined-diff-tree-navigation.ts index 052a18c5c78..80c5e6706bd 100644 --- a/src/renderer/src/components/editor/combined-diff/browse-files/use-combined-diff-tree-navigation.ts +++ b/src/renderer/src/components/editor/combined-diff/browse-files/use-combined-diff-tree-navigation.ts @@ -1,6 +1,6 @@ import React, { useCallback, useRef, useState } from 'react' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { DiffSection } from '../../diff-section-types' import type { CombinedDiffFileTreeMode } from '../resolve-changes/combined-diff-section-identity' import { handleCombinedDiffFileTreeNavigation } from './combined-diff-file-tree-navigation' diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-metadata-retention.test.tsx b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-metadata-retention.test.tsx index cf89e4cb27f..9bae276960b 100644 --- a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-metadata-retention.test.tsx +++ b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-metadata-retention.test.tsx @@ -5,11 +5,11 @@ import { act, cleanup, renderHook } from '@testing-library/react' import { afterEach, expect, it, vi } from 'vitest' import { clearCombinedDiffViewMemory } from '../remember-view/combined-diff-view-cache' import type { OpenFile } from '@/store/slices/editor' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { GitDiffResult, GitDiffTextResult -} from '../../../../../../shared/git-diff-compare-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' import type { DiffSection } from '../../diff-section-types' import { useCombinedDiffEntrySet } from '../resolve-changes/use-combined-diff-entry-set' import { createCombinedDiffSectionIndexMap } from '../resolve-changes/combined-diff-section-identity' diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-section-load-state.test.ts b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-section-load-state.test.ts index c308fbc6da9..e08a489ae9d 100644 --- a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-section-load-state.test.ts +++ b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-section-load-state.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { GitDiffResult } from '../../../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../../../shared/git/diff/git-diff-compare-types' import type { LargeDiffRenderLimit } from '../../large-diff-render-limit' import { isUnchangedDiffSectionReload, diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-stale-analysis-work-budget.test.tsx b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-stale-analysis-work-budget.test.tsx index e18bf4578fc..9929bdf90de 100644 --- a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-stale-analysis-work-budget.test.tsx +++ b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-stale-analysis-work-budget.test.tsx @@ -7,7 +7,7 @@ import type { OpenFile } from '@/store/slices/editor' import type { GitDiffResult, GitDiffTextResult -} from '../../../../../../shared/git-diff-compare-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' import { getLargeDiffRenderLimit } from '../../../../../../shared/large-diff-render-limit' import type { DiffSection } from '../../diff-section-types' import type { CombinedDiffEntrySet } from '../resolve-changes/use-combined-diff-entry-set' diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-viewport-load-order.test.tsx b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-viewport-load-order.test.tsx index cfe9b4d92dd..c5d18eb0b29 100644 --- a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-viewport-load-order.test.tsx +++ b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-viewport-load-order.test.tsx @@ -5,7 +5,7 @@ import { act, cleanup, renderHook } from '@testing-library/react' import { afterEach, beforeEach, expect, it, vi } from 'vitest' import { createTestStore, makeWorktree } from '@/store/slices/store-test-helpers' import type { OpenFile } from '@/store/slices/editor' -import type { GitDiffResult } from '../../../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../../../shared/git/diff/git-diff-compare-types' import type { DiffSection } from '../../diff-section-types' import type { CombinedDiffEntrySet } from '../resolve-changes/use-combined-diff-entry-set' import { useCombinedDiffSectionLoadRegistry } from './combined-diff-section-load-registry' diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/fetch-combined-diff-section.ts b/src/renderer/src/components/editor/combined-diff/load-sections/fetch-combined-diff-section.ts index a1be47280c7..01ca6462d7b 100644 --- a/src/renderer/src/components/editor/combined-diff/load-sections/fetch-combined-diff-section.ts +++ b/src/renderer/src/components/editor/combined-diff/load-sections/fetch-combined-diff-section.ts @@ -7,8 +7,8 @@ import type { OpenFile } from '@/store/slices/editor' import type { GitBranchChangeEntry, GitDiffResult -} from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { acquireCombinedDiffSectionOperation } from './combined-diff-section-connection' import { withDiffSectionLoadTimeout } from './combined-diff-section-load-timeout' diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-loader.ts b/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-loader.ts index 99d1eff91c4..f7123f970ec 100644 --- a/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-loader.ts +++ b/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-loader.ts @@ -4,8 +4,8 @@ import type { OpenFile } from '@/store/slices/editor' import type { GitBranchChangeEntry, GitDiffResult -} from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { DiffSection } from '../../diff-section-types' import { getLargeDiffRenderLimit } from '../../large-diff-render-limit' import { getStoredTextDiffContent, getStoredTextDiffResult } from '../../large-diff-section-content' diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-revalidation.test.tsx b/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-revalidation.test.tsx index be169be3608..59e157e60b8 100644 --- a/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-revalidation.test.tsx +++ b/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-revalidation.test.tsx @@ -4,7 +4,7 @@ import { afterEach, expect, it, vi } from 'vitest' import { ORCA_WORKTREE_FILE_CHANGE_EVENT } from '@/hooks/worktree-file-change-event' import type { OpenFile } from '@/store/slices/editor' import type { FsChangedPayload } from '../../../../../../shared/filesystem-entry-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { useCombinedDiffEntrySet } from '../resolve-changes/use-combined-diff-entry-set' import { useCombinedDiffSectionRevalidation } from './use-combined-diff-section-revalidation' diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-revalidation.ts b/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-revalidation.ts index aa410df46cc..8997ad31094 100644 --- a/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-revalidation.ts +++ b/src/renderer/src/components/editor/combined-diff/load-sections/use-combined-diff-section-revalidation.ts @@ -1,6 +1,6 @@ import React, { useEffect, useRef } from 'react' import type { OpenFile } from '@/store/slices/editor' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { ORCA_EDITOR_EXTERNAL_FILE_CHANGE_EVENT, type EditorPathMutationTarget diff --git a/src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.test.tsx b/src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.test.tsx index d9cf8112433..e8587d3dda9 100644 --- a/src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.test.tsx +++ b/src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.test.tsx @@ -2,8 +2,8 @@ import { afterEach, describe, expect, it } from 'vitest' import { cleanup, renderHook } from '@testing-library/react' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { DiffSection } from '../../diff-section-types' import { useCombinedDiffSectionLoadRegistry } from '../load-sections/combined-diff-section-load-registry' import type { CombinedDiffEntrySet } from '../resolve-changes/use-combined-diff-entry-set' diff --git a/src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.ts b/src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.ts index aa42346ad6a..91f350f4e9e 100644 --- a/src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.ts +++ b/src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.ts @@ -2,7 +2,7 @@ import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react' import type React from 'react' import type { OpenFile } from '@/store/slices/editor' import type { VirtualizedScrollAnchor } from '@/hooks/useVirtualizedScrollAnchor' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { DiffSection } from '../../diff-section-types' import { buildCombinedGitStatusSignature } from '../resolve-changes/combined-diff-git-status-signature' import { combinedDiffSectionsMatchEntryMetadata } from '../resolve-changes/combined-diff-section-cache-match' diff --git a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.test.ts b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.test.ts index 4ad806d032d..b081e103509 100644 --- a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.test.ts +++ b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.test.ts @@ -5,8 +5,8 @@ import { resolveCombinedUncommittedSnapshotEntries, shouldAutoReloadCombinedDiffFromGitStatus } from './combined-diff-entries' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' describe('getCombinedUncommittedEntries', () => { it('filters unresolved conflicts from live entries', () => { diff --git a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.ts b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.ts index 52bd071017a..c7860912054 100644 --- a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.ts +++ b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-entries.ts @@ -1,6 +1,6 @@ import type { OpenFile } from '@/store/slices/editor' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { CombinedDiffFileTreeMode } from './combined-diff-section-identity' /** Filter legacy tabs lacking snapshots; snapshot callers use their captured list after excluding unresolved conflicts. */ diff --git a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-git-status-signature.ts b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-git-status-signature.ts index b458bb4fd9a..b3f5daff821 100644 --- a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-git-status-signature.ts +++ b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-git-status-signature.ts @@ -1,4 +1,4 @@ -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { DiffSection } from '../../diff-section-types' export function buildCombinedGitStatusSignature( diff --git a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-section-cache-match.ts b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-section-cache-match.ts index fc56bc6c2c2..65112b6071b 100644 --- a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-section-cache-match.ts +++ b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-section-cache-match.ts @@ -1,5 +1,5 @@ -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { CombinedDiffFileTreeMode } from './combined-diff-section-identity' import { getCombinedDiffFileTreeSectionKey } from './combined-diff-section-identity' import type { DiffSection } from '../../diff-section-types' diff --git a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-section-identity.ts b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-section-identity.ts index f8e29b6e238..cf7c9fad27c 100644 --- a/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-section-identity.ts +++ b/src/renderer/src/components/editor/combined-diff/resolve-changes/combined-diff-section-identity.ts @@ -1,5 +1,5 @@ -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' export type CombinedDiffFileTreeMode = 'all' | 'uncommitted' | 'branch' | 'commit' export type CombinedDiffFileTreeEntry = GitStatusEntry | GitBranchChangeEntry diff --git a/src/renderer/src/components/editor/combined-diff/resolve-changes/use-combined-diff-entry-set.ts b/src/renderer/src/components/editor/combined-diff/resolve-changes/use-combined-diff-entry-set.ts index 29dce056583..0ce65039a6c 100644 --- a/src/renderer/src/components/editor/combined-diff/resolve-changes/use-combined-diff-entry-set.ts +++ b/src/renderer/src/components/editor/combined-diff/resolve-changes/use-combined-diff-entry-set.ts @@ -1,7 +1,7 @@ import React from 'react' import type { OpenFile } from '@/store/slices/editor' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { DiffSection } from '../../diff-section-types' import type { CombinedDiffFileTreeMode } from './combined-diff-section-identity' import { diff --git a/src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-section-actions.ts b/src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-section-actions.ts index ba82cf4634c..ea41095922b 100644 --- a/src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-section-actions.ts +++ b/src/renderer/src/components/editor/combined-diff/review-controls/use-combined-diff-section-actions.ts @@ -6,7 +6,7 @@ import { detectLanguage } from '@/lib/language-detect' import { joinPath } from '@/lib/path' import { openFilePreviewToSide } from '@/lib/file-preview' import type { OpenFile } from '@/store/slices/editor' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' import { canOpenDiffSectionPreviewToSide } from '../../diff-section-preview' import { getLargeDiffRenderLimit } from '../../large-diff-render-limit' import { diff --git a/src/renderer/src/components/editor/conflict-review-file-tree-windowing.test.tsx b/src/renderer/src/components/editor/conflict-review-file-tree-windowing.test.tsx index a6aa1a9c860..7902fe3e908 100644 --- a/src/renderer/src/components/editor/conflict-review-file-tree-windowing.test.tsx +++ b/src/renderer/src/components/editor/conflict-review-file-tree-windowing.test.tsx @@ -8,7 +8,7 @@ import type { GitConflictKind, GitConflictResolutionStatus, GitStatusEntry -} from '../../../../shared/git-status-types' +} from '../../../../shared/git/status/git-status-types' import { ConflictReviewFileTree, CONFLICT_REVIEW_ROW_HEIGHT_PX } from './ConflictReviewFileTree' const VIEWPORT_HEIGHT_PX = 600 diff --git a/src/renderer/src/components/editor/diff-section-layout.test.ts b/src/renderer/src/components/editor/diff-section-layout.test.ts index 6b3af6171c6..915b514fd81 100644 --- a/src/renderer/src/components/editor/diff-section-layout.test.ts +++ b/src/renderer/src/components/editor/diff-section-layout.test.ts @@ -8,7 +8,7 @@ import { usesLargeDiffFallbackHeight } from './diff-section-layout' import type { DiffSection } from './diff-section-types' -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' const largeTextSection: DiffSection = { key: 'section', diff --git a/src/renderer/src/components/editor/diff-section-layout.ts b/src/renderer/src/components/editor/diff-section-layout.ts index f8f887c87d8..32046015015 100644 --- a/src/renderer/src/components/editor/diff-section-layout.ts +++ b/src/renderer/src/components/editor/diff-section-layout.ts @@ -1,4 +1,4 @@ -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' import { shouldLoadCombinedDiffOnDemand } from './combined-diff-on-demand-load' import type { DiffSection } from './diff-section-types' import { countLinesLikeSplit, type DiffLineCounts } from './large-diff-render-limit' diff --git a/src/renderer/src/components/editor/diff-section-types.ts b/src/renderer/src/components/editor/diff-section-types.ts index 0aa53120e34..4bc669f0533 100644 --- a/src/renderer/src/components/editor/diff-section-types.ts +++ b/src/renderer/src/components/editor/diff-section-types.ts @@ -1,5 +1,5 @@ -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import type { LargeDiffRenderLimit } from './large-diff-render-limit' import type { acquireEditorFileOperation } from '@/lib/editor-file-operation-owner' diff --git a/src/renderer/src/components/editor/editor-header.ts b/src/renderer/src/components/editor/editor-header.ts index aaa955d394f..b3bc21547f6 100644 --- a/src/renderer/src/components/editor/editor-header.ts +++ b/src/renderer/src/components/editor/editor-header.ts @@ -1,6 +1,6 @@ import type { OpenFile } from '@/store/slices/editor' -import type { GitBranchChangeEntry } from '../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { getEditorDisplayLabel } from './editor-labels' import { translate } from '@/i18n/i18n' import { isVirtualEditorFile } from '@/store/slices/editor/tabs/editor-tab-content-type' diff --git a/src/renderer/src/components/editor/editor-panel-content-types.ts b/src/renderer/src/components/editor/editor-panel-content-types.ts index cd208b329a2..24a1c86c9d3 100644 --- a/src/renderer/src/components/editor/editor-panel-content-types.ts +++ b/src/renderer/src/components/editor/editor-panel-content-types.ts @@ -1,7 +1,7 @@ import type { Dispatch, MutableRefObject, SetStateAction } from 'react' import type { OpenFile } from '@/store/slices/editor' import type { EditorPanelContentLoadOptions } from './useEditorPanelExternalContentEvents' -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' import type { CsvFilePreview } from './csv/csv-file-content' import type { RuntimeFileReadArgs } from '@/runtime/runtime-file-client-types' diff --git a/src/renderer/src/components/editor/editor-panel-diff-reload.ts b/src/renderer/src/components/editor/editor-panel-diff-reload.ts index c887ae12ae0..a383b807564 100644 --- a/src/renderer/src/components/editor/editor-panel-diff-reload.ts +++ b/src/renderer/src/components/editor/editor-panel-diff-reload.ts @@ -1,5 +1,5 @@ import type { OpenFile } from '@/store/slices/editor' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' export function isReloadableSingleFileDiffTab(file: OpenFile): boolean { return ( diff --git a/src/renderer/src/components/editor/editor-panel-render-model.test.ts b/src/renderer/src/components/editor/editor-panel-render-model.test.ts index 78d5896784b..1116f44465a 100644 --- a/src/renderer/src/components/editor/editor-panel-render-model.test.ts +++ b/src/renderer/src/components/editor/editor-panel-render-model.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import type { OpenFile } from '@/store/slices/editor' import { RICH_MARKDOWN_MAX_SIZE_BYTES } from '../../../../shared/constants' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import type { FileContent } from './editor-panel-content-types' import { getEditorPanelRenderModel } from './editor-panel-render-model' diff --git a/src/renderer/src/components/editor/large-diff-section-content.ts b/src/renderer/src/components/editor/large-diff-section-content.ts index f5ac4b4a377..6ba9fa0e1c1 100644 --- a/src/renderer/src/components/editor/large-diff-section-content.ts +++ b/src/renderer/src/components/editor/large-diff-section-content.ts @@ -1,4 +1,4 @@ -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' import type { LargeDiffRenderLimit } from './large-diff-render-limit' export function shouldPruneLargeDiffContent( diff --git a/src/renderer/src/components/editor/large-markdown-render-freeze.test.tsx b/src/renderer/src/components/editor/large-markdown-render-freeze.test.tsx index 3a5642951e5..07bf00c0766 100644 --- a/src/renderer/src/components/editor/large-markdown-render-freeze.test.tsx +++ b/src/renderer/src/components/editor/large-markdown-render-freeze.test.tsx @@ -58,7 +58,7 @@ vi.mock('./useEditorConflictNavigation', () => ({ import { EditorContent } from './EditorContent' import { EditorDiffFileSurface } from './EditorDiffFileSurface' import type { useMarkdownDocuments } from './useMarkdownDocuments' -import type { GitDiffResult } from '../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types' import { MARKDOWN_RENDER_OVERRIDE_MAX_SIZE_BYTES } from './markdown-rich-size-limit' import { getEditorPanelRenderModel } from './editor-panel-render-model' const hugeDoc = 'a'.repeat(MARKDOWN_RENDER_OVERRIDE_MAX_SIZE_BYTES + 1) diff --git a/src/renderer/src/components/editor/useEditorPanelActiveTabContentLoad.overview.test.tsx b/src/renderer/src/components/editor/useEditorPanelActiveTabContentLoad.overview.test.tsx index ee9da402ae7..fa425f542ef 100644 --- a/src/renderer/src/components/editor/useEditorPanelActiveTabContentLoad.overview.test.tsx +++ b/src/renderer/src/components/editor/useEditorPanelActiveTabContentLoad.overview.test.tsx @@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { useAppStore } from '@/store' import type { OpenFile } from '@/store/slices/editor' import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { useEditorPanelActiveTabContentLoad } from './useEditorPanelActiveTabContentLoad' // The active tab's load is a user act that may start a stopped WSL distro. diff --git a/src/renderer/src/components/editor/useEditorPanelContentState.test.tsx b/src/renderer/src/components/editor/useEditorPanelContentState.test.tsx index 3e659d3645d..7d4266d9b0c 100644 --- a/src/renderer/src/components/editor/useEditorPanelContentState.test.tsx +++ b/src/renderer/src/components/editor/useEditorPanelContentState.test.tsx @@ -4,7 +4,7 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { OpenFile } from '@/store/slices/editor' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import type { DiffContent, FileContent } from './editor-panel-content-types' const mocks = vi.hoisted(() => ({ diff --git a/src/renderer/src/components/editor/useEditorPanelVisibilityContentState.test.tsx b/src/renderer/src/components/editor/useEditorPanelVisibilityContentState.test.tsx index 816a25b6a39..ef1e44a341b 100644 --- a/src/renderer/src/components/editor/useEditorPanelVisibilityContentState.test.tsx +++ b/src/renderer/src/components/editor/useEditorPanelVisibilityContentState.test.tsx @@ -4,7 +4,7 @@ import { act, useLayoutEffect, useMemo } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { OpenFile } from '@/store/slices/editor' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import type { DiffContent, FileContent } from './editor-panel-content-types' const mocks = vi.hoisted(() => ({ diff --git a/src/renderer/src/components/feature-wall/AiCommitPrSettingsFields.tsx b/src/renderer/src/components/feature-wall/AiCommitPrSettingsFields.tsx index 9ab02f1e766..1ff2d4995a5 100644 --- a/src/renderer/src/components/feature-wall/AiCommitPrSettingsFields.tsx +++ b/src/renderer/src/components/feature-wall/AiCommitPrSettingsFields.tsx @@ -1,14 +1,14 @@ import { sourceControlModelLabel, sourceControlThinkingLabel } from './source-control-model-label' import type { JSX } from 'react' import { Terminal } from 'lucide-react' -import { CUSTOM_PROMPT_PLACEHOLDER } from '../../../../shared/commit-message-prompt' +import { CUSTOM_PROMPT_PLACEHOLDER } from '../../../../shared/source-control/ai/generation/commit-message-prompt' import { CUSTOM_AGENT_ID, listCommitMessageAgentCapabilities, type CommitMessageAgentCapability, type CommitMessageModelCapability -} from '../../../../shared/commit-message-agent-spec' -import type { CommitMessageAiSettings } from '../../../../shared/commit-message-ai-types' +} from '../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import type { CommitMessageAiSettings } from '../../../../shared/source-control/ai/generation/commit-message-ai-types' import { AgentIcon } from '@/lib/agent-catalog' import { cn } from '@/lib/utils' import { Input } from '../ui/input' diff --git a/src/renderer/src/components/feature-wall/ai-commit-pr-settings-helpers.ts b/src/renderer/src/components/feature-wall/ai-commit-pr-settings-helpers.ts index ee4c5c41ec7..7a5f4046b7c 100644 --- a/src/renderer/src/components/feature-wall/ai-commit-pr-settings-helpers.ts +++ b/src/renderer/src/components/feature-wall/ai-commit-pr-settings-helpers.ts @@ -1,4 +1,4 @@ -import type { CommitMessageAiSettings } from '../../../../shared/commit-message-ai-types' +import type { CommitMessageAiSettings } from '../../../../shared/source-control/ai/generation/commit-message-ai-types' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' import { @@ -7,7 +7,7 @@ import { type CommitMessageAgentCapability, type CommitMessageAgentChoice, type CommitMessageModelCapability -} from '../../../../shared/commit-message-agent-spec' +} from '../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { getAgentCatalog } from '@/lib/agent-catalog' export const EMPTY_COMMIT_MESSAGE_AI_SETTINGS: CommitMessageAiSettings = { diff --git a/src/renderer/src/components/feature-wall/use-feature-wall-completion.ts b/src/renderer/src/components/feature-wall/use-feature-wall-completion.ts index 10492ab4828..f09ab66eb8d 100644 --- a/src/renderer/src/components/feature-wall/use-feature-wall-completion.ts +++ b/src/renderer/src/components/feature-wall/use-feature-wall-completion.ts @@ -8,7 +8,7 @@ import { getCommitMessageAgentCapability, isCustomAgentId, resolveCommitMessageAgentChoice -} from '../../../../shared/commit-message-agent-spec' +} from '../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { useAppStore } from '@/store' import { FEATURE_WALL_AGENT_STEP_IDS, diff --git a/src/renderer/src/components/feature-wall/useAiCommitPrSettings.ts b/src/renderer/src/components/feature-wall/useAiCommitPrSettings.ts index 9dc41cdd6ce..b372511c07a 100644 --- a/src/renderer/src/components/feature-wall/useAiCommitPrSettings.ts +++ b/src/renderer/src/components/feature-wall/useAiCommitPrSettings.ts @@ -1,14 +1,14 @@ import { useCallback, useState } from 'react' -import type { CommitMessageAiSettings } from '../../../../shared/commit-message-ai-types' +import type { CommitMessageAiSettings } from '../../../../shared/source-control/ai/generation/commit-message-ai-types' import { CUSTOM_AGENT_ID, getCommitMessageAgentCapability, isCustomAgentId, resolveCommitMessageAgentChoice -} from '../../../../shared/commit-message-agent-spec' -import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../../../shared/commit-message-host-key' -import { normalizeSourceControlAiSettings } from '../../../../shared/source-control-ai' -import { getTextGenerationModels } from '../../../../shared/source-control-ai-model-selection' +} from '../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../../../shared/source-control/ai/generation/commit-message-host-key' +import { normalizeSourceControlAiSettings } from '../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { getTextGenerationModels } from '../../../../shared/source-control/ai/settings/source-control-ai-model-selection' import type { GlobalSettings } from '../../../../shared/global-settings-types' import { isTuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent-config' import { getAgentCatalog } from '@/lib/agent-catalog' diff --git a/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab-activity.tsx b/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab-activity.tsx index 091b125e786..13475486282 100644 --- a/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab-activity.tsx +++ b/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab-activity.tsx @@ -5,8 +5,8 @@ import { getPRCommentAudienceEmptyLabel, getPrCommentAudienceFilters } from '@/lib/pr-comment-audience-labels' -import type { PRCommentAudienceFilter } from '../../../../../shared/pr-comment-audience' -import type { PRCommentGroup } from '../../../../../shared/pr-comment-groups' +import type { PRCommentAudienceFilter } from '../../../../../shared/source-control/review-comments/pr-comment-audience' +import type { PRCommentGroup } from '../../../../../shared/source-control/review-comments/pr-comment-groups' import type { PRComment } from '../../../../../shared/github/comment-types' import type { GitHubOwnerRepo, GitHubPRFile } from '../../../../../shared/github/pull-request-types' import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types' diff --git a/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab-comment-group.tsx b/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab-comment-group.tsx index 03d809db216..37d27f03482 100644 --- a/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab-comment-group.tsx +++ b/src/renderer/src/components/github-item-dialog/discuss-item/conversation-tab-comment-group.tsx @@ -11,7 +11,7 @@ import { getPRCommentGroupRoot, isResolvedPRCommentGroup, type PRCommentGroup -} from '../../../../../shared/pr-comment-groups' +} from '../../../../../shared/source-control/review-comments/pr-comment-groups' import { translate } from '@/i18n/i18n' import { ConversationTabCommentCard, 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 fc887182b5e..a11f4a3d541 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 @@ -5,9 +5,9 @@ import { filterPRCommentsByAudience, getPRCommentAudienceCounts, type PRCommentAudienceFilter -} from '../../../../../shared/pr-comment-audience' +} from '../../../../../shared/source-control/review-comments/pr-comment-audience' import { usePRBotAuthorOverrides } from '@/lib/pr-bot-author-overrides' -import { groupPRComments } from '../../../../../shared/pr-comment-groups' +import { groupPRComments } from '../../../../../shared/source-control/review-comments/pr-comment-groups' import { getCommentReplyTargetCandidates, resolveCommentReplyTarget 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 3cfa9457faf..e23d0b0a3c6 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 @@ -9,7 +9,7 @@ import { } 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 { buildFixBrokenChecksPrompt } from '../../../../../shared/pr-checks-fix-prompt' +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' 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 de4aa9f9bdd..4bc575cbb8f 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 @@ -12,7 +12,7 @@ import { canUseGitHubRepoContext, getGitHubSourceRuntimeHost } from '@/lib/github-source-runtime-context' -import { getBrokenChecks } from '../../../../../shared/pr-checks-fix-prompt' +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' import type { @@ -22,7 +22,7 @@ import type { import type { TaskSourceContext } from '../../../../../shared/task-source-context' import { getTaskSourceCacheScope } from '../../../../../shared/task-source-context' import { translate } from '@/i18n/i18n' -import { sortChecksBySeverity } from '../../../../../shared/pr-check-severity-order' +import { sortChecksBySeverity } from '../../../../../shared/source-control/checks/pr-check-severity-order' import { getCheckCountChips, getCheckCounts, diff --git a/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-body.tsx b/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-body.tsx index 7d6d2465e36..861c6d4002c 100644 --- a/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-body.tsx +++ b/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-body.tsx @@ -12,7 +12,7 @@ import { CombinedDiffFileTree } from '../../editor/combined-diff/browse-files/co import type { DiffSection } from '@/components/editor/diff-section-types' import type { CombinedDiffFileTreeEntry } from '../../editor/combined-diff/resolve-changes/combined-diff-section-identity' import type { GitHubPRFile } from '../../../../../shared/github/pull-request-types' -import type { GitBranchChangeEntry } from '../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../shared/git/diff/git-diff-compare-types' import { PRFilesCombinedDiffToolbar } from './pr-files-combined-diff-toolbar' export function PRFilesCombinedDiffBody({ 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 359432bf0cf..566f80c0618 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 @@ -12,7 +12,7 @@ import { getPRFileContentsRenderLimit, getPRFileDiffResult } from '@/components/github/pr-file-diff-mapping' -import type { GitDiffResult } from '../../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../../shared/git/diff/git-diff-compare-types' import type { GitHubOwnerRepo, GitHubPRFile, diff --git a/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-viewer.tsx b/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-viewer.tsx index 4b9d7fe43cf..d2e6bae41cc 100644 --- a/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-viewer.tsx +++ b/src/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-viewer.tsx @@ -8,7 +8,7 @@ import type { DiffSection } from '@/components/editor/diff-section-types' import { getCombinedDiffBranchEntriesInTreeOrder } from '../../editor/combined-diff/browse-files/combined-diff-file-tree-filter' import type { CombinedDiffFileTreeEntry } from '../../editor/combined-diff/resolve-changes/combined-diff-section-identity' import { useDocumentDarkTheme } from '@/hooks/use-document-dark-theme' -import type { GitBranchChangeEntry } from '../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../shared/git/diff/git-diff-compare-types' import { isPRFileViewed } from '@/components/github/pr-file-content-size' import { PR_DIFF_OVERSCAN, diff --git a/src/renderer/src/components/github-pr-merge-state.test.ts b/src/renderer/src/components/github-pr-merge-state.test.ts index 3928cbff6af..dfc8a6be064 100644 --- a/src/renderer/src/components/github-pr-merge-state.test.ts +++ b/src/renderer/src/components/github-pr-merge-state.test.ts @@ -1,4 +1,4 @@ -import { summarizeProviderChecks } from '../../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../shared/source-control/checks/provider-check-summary' import { describe, expect, it } from 'vitest' import type { GitHubPRMergeStateInput } from '../../../shared/github/pull-request-merge-state' import { presentGitHubPRMergeState } from './github-pr-merge-state' diff --git a/src/renderer/src/components/github-pr-merge-state.ts b/src/renderer/src/components/github-pr-merge-state.ts index 5b33d777521..74a37826a83 100644 --- a/src/renderer/src/components/github-pr-merge-state.ts +++ b/src/renderer/src/components/github-pr-merge-state.ts @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../shared/source-control/checks/provider-check-summary' import { resolveGitHubPRMergeState, type GitHubPRAutoMergeActionIntent, diff --git a/src/renderer/src/components/github/pr-file-diff-mapping.ts b/src/renderer/src/components/github/pr-file-diff-mapping.ts index dc990ed8f69..ff048bcd138 100644 --- a/src/renderer/src/components/github/pr-file-diff-mapping.ts +++ b/src/renderer/src/components/github/pr-file-diff-mapping.ts @@ -5,7 +5,10 @@ import { type LargeDiffRenderLimit } from '@/components/editor/large-diff-render-limit' import type { TaskSourceContext } from '../../../../shared/task-source-context' -import type { GitBranchChangeEntry, GitDiffResult } from '../../../../shared/git-diff-compare-types' +import type { + GitBranchChangeEntry, + GitDiffResult +} from '../../../../shared/git/diff/git-diff-compare-types' import type { PRComment } from '../../../../shared/github/comment-types' import type { GitHubOwnerRepo, diff --git a/src/renderer/src/components/github/review-state-presentation.ts b/src/renderer/src/components/github/review-state-presentation.ts index 2d6ae1d599d..2259538414d 100644 --- a/src/renderer/src/components/github/review-state-presentation.ts +++ b/src/renderer/src/components/github/review-state-presentation.ts @@ -1,5 +1,5 @@ import { GitMerge, GitPullRequestClosed, GitPullRequestDraft, type LucideIcon } from 'lucide-react' -import type { HostedReviewState } from '../../../../shared/hosted-review' +import type { HostedReviewState } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' /** Every review surface renders state from here; `unknown` means we have a number but no fetched state. */ export type ReviewStateForDisplay = HostedReviewState | 'unknown' | null | undefined diff --git a/src/renderer/src/components/gitlab-item-dialog/gitlab-pipeline-tab.tsx b/src/renderer/src/components/gitlab-item-dialog/gitlab-pipeline-tab.tsx index 5a27369d265..8a7b2436f23 100644 --- a/src/renderer/src/components/gitlab-item-dialog/gitlab-pipeline-tab.tsx +++ b/src/renderer/src/components/gitlab-item-dialog/gitlab-pipeline-tab.tsx @@ -5,7 +5,7 @@ import type { GitLabWorkItem } from '../../../../shared/gitlab-types' import { PipelineJobRow } from '../gitlab-item-dialog-parts' import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state' import type { GitLabPipelineActions } from './use-gitlab-pipeline-actions' -import { gitLabPipelineToPRCheck } from '../../../../shared/gitlab-pipeline-checks' +import { gitLabPipelineToPRCheck } from '../../../../shared/source-control/checks/gitlab/gitlab-pipeline-checks' import { getCheckStatusLabel } from '@/components/github/pr-check-presentation' import { CHECK_COLOR, CHECK_ICON } from '@/components/right-sidebar/checks-panel/check-presentation' import { openAppHttpLinkFromAnchor } from '@/lib/app-http-link-open' diff --git a/src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts b/src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts index c94d12ca4c1..b70a1bcce82 100644 --- a/src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts +++ b/src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts @@ -6,7 +6,7 @@ import { getCommitMessageModelDiscoveryHostKeyForLocalRuntime, getCommitMessageModelDiscoveryHostKeyForScope, LOCAL_COMMIT_MESSAGE_HOST_KEY -} from '../../../../shared/commit-message-host-key' +} from '../../../../shared/source-control/ai/generation/commit-message-host-key' import { runtimeTargetForWorkspaceOwner } from '@/lib/resolve-owner' import { hasExplicitTuiLaunchCommand } from '../../../../shared/agent-launch/startup/tui-agent-launch-command-override' import { getConnectionIdFromState } from '@/lib/connection-context' diff --git a/src/renderer/src/components/pr-check-counts.test.ts b/src/renderer/src/components/pr-check-counts.test.ts index 1c25e062a16..3484fc5aa99 100644 --- a/src/renderer/src/components/pr-check-counts.test.ts +++ b/src/renderer/src/components/pr-check-counts.test.ts @@ -3,7 +3,7 @@ import { getCheckCounts, getChecksSummaryLabel } from './pr-check-counts' import { getProviderChecksLabel, summarizeProviderChecks -} from '../../../shared/provider-check-summary' +} from '../../../shared/source-control/checks/provider-check-summary' import type { PRCheckDetail } from '../../../shared/github/check-types' function check(conclusion: PRCheckDetail['conclusion'], name = String(conclusion)): PRCheckDetail { diff --git a/src/renderer/src/components/pr-check-counts.ts b/src/renderer/src/components/pr-check-counts.ts index 12e67de6bee..e0fabc1aa39 100644 --- a/src/renderer/src/components/pr-check-counts.ts +++ b/src/renderer/src/components/pr-check-counts.ts @@ -1,5 +1,5 @@ import { translate } from '../i18n/i18n' -import { summarizeProviderChecks } from '../../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../shared/source-control/checks/provider-check-summary' import type { PRCheckDetail } from '../../../shared/github/check-types' export type PRCheckCounts = { diff --git a/src/renderer/src/components/provider-check-classification-parity.test.ts b/src/renderer/src/components/provider-check-classification-parity.test.ts index 60e855776bb..a022edc9266 100644 --- a/src/renderer/src/components/provider-check-classification-parity.test.ts +++ b/src/renderer/src/components/provider-check-classification-parity.test.ts @@ -2,12 +2,15 @@ import { describe, expect, it } from 'vitest' import { deriveTaskPagePRCheckSummary } from './task-page/task-page-pr-check-summary' import { getCheckCountChips, getCheckCounts } from './pr-check-counts' import { derivePipelineStatus } from '../../../main/gitlab/mappers' -import { gitLabPipelineJobsToPRChecks } from '../../../shared/gitlab-pipeline-checks' -import { derivePRCheckStatus, derivePRCheckStatusFromRollup } from '../../../shared/pr-check-status' +import { gitLabPipelineJobsToPRChecks } from '../../../shared/source-control/checks/gitlab/gitlab-pipeline-checks' +import { + derivePRCheckStatus, + derivePRCheckStatusFromRollup +} from '../../../shared/source-control/checks/pr-check-status' import { getProviderChecksLabel, summarizeProviderChecks -} from '../../../shared/provider-check-summary' +} from '../../../shared/source-control/checks/provider-check-summary' import type { GitLabPipelineJob } from '../../../shared/gitlab-types' import type { PRCheckDetail } from '../../../shared/github/check-types' import type { ProviderCheckSummary } from '../../../shared/github/pull-request-types' diff --git a/src/renderer/src/components/pull-request-page/checks/fix-dialog.tsx b/src/renderer/src/components/pull-request-page/checks/fix-dialog.tsx index 523daa91f49..54fbe808f34 100644 --- a/src/renderer/src/components/pull-request-page/checks/fix-dialog.tsx +++ b/src/renderer/src/components/pull-request-page/checks/fix-dialog.tsx @@ -2,8 +2,8 @@ import React from 'react' import { toast } from 'sonner' import type { useAppStore } from '@/store' import { SourceControlAgentActionDialog } from '@/components/right-sidebar/SourceControlAgentActionDialog' -import { readSourceControlLaunchRecipeAgentId } from '../../../../../shared/source-control-launch-agent-selection' -import type { SourceControlActionRecipe } from '../../../../../shared/source-control-ai-actions' +import { readSourceControlLaunchRecipeAgentId } from '../../../../../shared/source-control/ai/source-control-launch-agent-selection' +import type { SourceControlActionRecipe } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { translate } from '@/i18n/i18n' import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types' import { saveFixChecksActionDefault, startFixChecksFromDialog } from './fix-launch' 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 3954102aa6e..fe489b9605b 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 @@ -3,13 +3,13 @@ import { toast } from 'sonner' import { useAppStore } from '@/store' import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch' import { launchWorkItemDirect } from '@/lib/launch-work-item-direct' -import { buildFixBrokenChecksPrompt } from '../../../../../shared/pr-checks-fix-prompt' -import type { SourceControlAiWriteTarget } from '../../../../../shared/source-control-ai-recipe-save' +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' import { saveSourceControlAiActionRecipeForTarget } from '../../right-sidebar/source-control/ai/recipe-persistence' import type { SourceControlActionRecipe, SourceControlLaunchActionId -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { translate } from '@/i18n/i18n' import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types' import type { PRCheckDetail } from '../../../../../shared/github/check-types' 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 63f5f398107..31454c118fb 100644 --- a/src/renderer/src/components/pull-request-page/checks/tab.tsx +++ b/src/renderer/src/components/pull-request-page/checks/tab.tsx @@ -10,8 +10,8 @@ import { } from '@/components/github-checks-tab-state' import { getCheckDetailsKey } from '@/components/github/pr-check-presentation' import { getCheckCounts, getChecksSummaryLabel } from '@/components/pr-check-counts' -import { getBrokenChecks } from '../../../../../shared/pr-checks-fix-prompt' -import { sortChecksBySeverity } from '../../../../../shared/pr-check-severity-order' +import { getBrokenChecks } from '../../../../../shared/source-control/checks/pr-checks-fix-prompt' +import { sortChecksBySeverity } from '../../../../../shared/source-control/checks/pr-check-severity-order' import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key' import { getTaskSourceCacheScope } from '../../../../../shared/task-source-context' import type { TaskSourceContext } from '../../../../../shared/task-source-context' @@ -23,7 +23,7 @@ import { import { getLocalRepoProjectExecutionRuntimeContext } from '@/lib/local-preflight-context' import { CLIENT_PLATFORM } from '@/lib/new-workspace' import { resolveRepoExecutionHostPlatform } from '@/lib/execution-host-facts' -import { resolveSourceControlActionRecipe } from '../../../../../shared/source-control-ai' +import { resolveSourceControlActionRecipe } from '../../../../../shared/source-control/ai/source-control-ai-operation-policy' import type { GitHubWorkItem, GitHubWorkItemDetails diff --git a/src/renderer/src/components/pull-request-page/conversation/comment-group.tsx b/src/renderer/src/components/pull-request-page/conversation/comment-group.tsx index 9107ca57e05..a13daceb339 100644 --- a/src/renderer/src/components/pull-request-page/conversation/comment-group.tsx +++ b/src/renderer/src/components/pull-request-page/conversation/comment-group.tsx @@ -11,7 +11,7 @@ import { getPRCommentGroupRoot, isResolvedPRCommentGroup, type PRCommentGroup -} from '../../../../../shared/pr-comment-groups' +} from '../../../../../shared/source-control/review-comments/pr-comment-groups' import { translate } from '@/i18n/i18n' import type { GitHubOwnerRepo, GitHubPRFile } from '../../../../../shared/github/pull-request-types' import type { PRComment } from '../../../../../shared/github/comment-types' diff --git a/src/renderer/src/components/pull-request-page/conversation/comments-list.tsx b/src/renderer/src/components/pull-request-page/conversation/comments-list.tsx index 1f20b9ffb2a..724e4f3e188 100644 --- a/src/renderer/src/components/pull-request-page/conversation/comments-list.tsx +++ b/src/renderer/src/components/pull-request-page/conversation/comments-list.tsx @@ -5,8 +5,11 @@ import { getPRCommentAudienceEmptyLabel, getPrCommentAudienceFilters } from '@/lib/pr-comment-audience-labels' -import { getPRCommentGroupId, type PRCommentGroup } from '../../../../../shared/pr-comment-groups' -import type { PRCommentAudienceFilter } from '../../../../../shared/pr-comment-audience' +import { + getPRCommentGroupId, + type PRCommentGroup +} from '../../../../../shared/source-control/review-comments/pr-comment-groups' +import type { PRCommentAudienceFilter } from '../../../../../shared/source-control/review-comments/pr-comment-audience' import type { GitHubOwnerRepo, GitHubPRFile } from '../../../../../shared/github/pull-request-types' import type { PRComment } from '../../../../../shared/github/comment-types' import type { TaskSourceContext } from '../../../../../shared/task-source-context' diff --git a/src/renderer/src/components/pull-request-page/conversation/mention-error.test.tsx b/src/renderer/src/components/pull-request-page/conversation/mention-error.test.tsx index 9e399f2b012..8cb32980266 100644 --- a/src/renderer/src/components/pull-request-page/conversation/mention-error.test.tsx +++ b/src/renderer/src/components/pull-request-page/conversation/mention-error.test.tsx @@ -17,7 +17,7 @@ import { ConfirmationDialogProvider } from '@/components/confirmation-dialog' import { TooltipProvider } from '@/components/ui/tooltip' import { GitHubWorkItemTargetContext } from '@/components/github-item-dialog/load-item-details/github-work-item-target-context' import { GITHUB_EXACT_OPERATION_UNSUPPORTED } from '../../../../../shared/github/work-item-target' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../../../shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../../../shared/source-control/runtime/source-control-runtime-capabilities' import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types' import type { GitHubAssignableUser } from '../../../../../shared/github/pull-request-types' import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target' 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 1878f9baa90..2dbe4573c6f 100644 --- a/src/renderer/src/components/pull-request-page/conversation/tab.tsx +++ b/src/renderer/src/components/pull-request-page/conversation/tab.tsx @@ -13,8 +13,8 @@ import { filterPRCommentsByAudience, getPRCommentAudienceCounts, type PRCommentAudienceFilter -} from '../../../../../shared/pr-comment-audience' -import { groupPRComments } from '../../../../../shared/pr-comment-groups' +} from '../../../../../shared/source-control/review-comments/pr-comment-audience' +import { groupPRComments } from '../../../../../shared/source-control/review-comments/pr-comment-groups' import { resolveCommentReplyTarget } from '@/components/comment-reply-target-state' import { runWorkItemBodyUpdate } from '@/components/github/github-work-item-edit-mutations' import { diff --git a/src/renderer/src/components/pull-request-page/files/section-loader.ts b/src/renderer/src/components/pull-request-page/files/section-loader.ts index 0b6ba75f456..6bfd65f46d4 100644 --- a/src/renderer/src/components/pull-request-page/files/section-loader.ts +++ b/src/renderer/src/components/pull-request-page/files/section-loader.ts @@ -10,7 +10,7 @@ import { getStoredTextDiffResult } from '@/components/editor/large-diff-section-content' import type { DiffSection } from '@/components/editor/diff-section-types' -import type { GitDiffResult } from '../../../../../shared/git-diff-compare-types' +import type { GitDiffResult } from '../../../../../shared/git/diff/git-diff-compare-types' import type { GitHubOwnerRepo, GitHubPRFile, diff --git a/src/renderer/src/components/right-sidebar/CommitArea.generate.test.tsx b/src/renderer/src/components/right-sidebar/CommitArea.generate.test.tsx index d9ea8f4f016..184ffc685a3 100644 --- a/src/renderer/src/components/right-sidebar/CommitArea.generate.test.tsx +++ b/src/renderer/src/components/right-sidebar/CommitArea.generate.test.tsx @@ -8,10 +8,10 @@ import { import { TooltipProvider } from '@/components/ui/tooltip' import { resolvePrimaryAction, type PrimaryActionInputs } from './source-control-primary-action' import { resolveDropdownItems } from './source-control-dropdown-items' -import type { DropdownActionKind } from '../../../../shared/source-control-dropdown-item-types' +import type { DropdownActionKind } from '../../../../shared/source-control/dropdown/source-control-dropdown-item-types' import { getDefaultSettings } from '../../../../shared/constants' -import { CUSTOM_AGENT_ID } from '../../../../shared/commit-message-agent-spec' -import { resolveSourceControlAiForOperation } from '../../../../shared/source-control-ai' +import { CUSTOM_AGENT_ID } from '../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { resolveSourceControlAiForOperation } from '../../../../shared/source-control/ai/source-control-ai-operation-resolution' function buildInputs(overrides: Partial = {}): PrimaryActionInputs { return { diff --git a/src/renderer/src/components/right-sidebar/CommitArea.test.tsx b/src/renderer/src/components/right-sidebar/CommitArea.test.tsx index aac5b507cd8..bb238be32bb 100644 --- a/src/renderer/src/components/right-sidebar/CommitArea.test.tsx +++ b/src/renderer/src/components/right-sidebar/CommitArea.test.tsx @@ -14,7 +14,7 @@ import { type PrimaryActionInputs } from './source-control-primary-action' import { resolveDropdownItems } from './source-control-dropdown-items' -import type { DropdownActionKind } from '../../../../shared/source-control-dropdown-item-types' +import type { DropdownActionKind } from '../../../../shared/source-control/dropdown/source-control-dropdown-item-types' import { TooltipProvider } from '@/components/ui/tooltip' import { deriveSourceControlPushRecovery } from './source-control/sync/push-recovery' diff --git a/src/renderer/src/components/right-sidebar/CreateHostedReviewComposer.tsx b/src/renderer/src/components/right-sidebar/CreateHostedReviewComposer.tsx index 757c9707c28..700ff4bdf92 100644 --- a/src/renderer/src/components/right-sidebar/CreateHostedReviewComposer.tsx +++ b/src/renderer/src/components/right-sidebar/CreateHostedReviewComposer.tsx @@ -25,13 +25,13 @@ import { translate } from '@/i18n/i18n' import { hostedReviewProviderSupportsDraft, type HostedReviewProvider -} from '../../../../shared/hosted-review' +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { stripBaseRef } from './create-pull-request-base-ref-normalization' import type { HostedReviewStackParent } from './useHostedReviewStackParent' import type { DropdownActionKind, DropdownEntry -} from '../../../../shared/source-control-dropdown-item-types' +} from '../../../../shared/source-control/dropdown/source-control-dropdown-item-types' import { CreateHostedReviewComposerFields } from './CreateHostedReviewComposerFields' import { getCreateButtonLabel } from './create-hosted-review-button-label' import { diff --git a/src/renderer/src/components/right-sidebar/FileExplorerRow.tsx b/src/renderer/src/components/right-sidebar/FileExplorerRow.tsx index 3686514b2fd..1869226230e 100644 --- a/src/renderer/src/components/right-sidebar/FileExplorerRow.tsx +++ b/src/renderer/src/components/right-sidebar/FileExplorerRow.tsx @@ -10,8 +10,8 @@ import { writeWorkspaceFileDragSourceIfResolved, type WorkspaceFileDragSource } from '@/lib/workspace-file-drag' -import type { GitFileStatus } from '../../../../shared/git-status-types' -import { STATUS_LABELS } from './status-display' +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' +import { STATUS_LABELS } from '../../../../shared/git/status/git-status-labels' import { RENAME_HOTSPOT_ATTR } from './file-explorer-dir-toggle-timing' import type { TreeNode } from './file-explorer-types' import { useFileExplorerRowDrag } from './useFileExplorerRowDrag' diff --git a/src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.tsx b/src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.tsx index 11ad32dd3a2..f675766dd82 100644 --- a/src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.tsx +++ b/src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.tsx @@ -2,7 +2,7 @@ import React from 'react' import type { Virtualizer } from '@tanstack/react-virtual' import { dirname } from '@/lib/path' import { cn } from '@/lib/utils' -import type { GitFileStatus } from '../../../../shared/git-status-types' +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' import { FileExplorerRow } from './FileExplorerRow' import { InlineInputRow, type InlineInput } from './file-explorer-inline-input-row' import { shouldShowIgnoredDecoration, STATUS_COLORS } from './status-display' diff --git a/src/renderer/src/components/right-sidebar/FolderWorkspacePrChecksPanel.test.tsx b/src/renderer/src/components/right-sidebar/FolderWorkspacePrChecksPanel.test.tsx index a56874fb2ea..88a10691784 100644 --- a/src/renderer/src/components/right-sidebar/FolderWorkspacePrChecksPanel.test.tsx +++ b/src/renderer/src/components/right-sidebar/FolderWorkspacePrChecksPanel.test.tsx @@ -8,7 +8,7 @@ import type { PRCheckDetail } from '../../../../shared/github/check-types' import type { Repo } from '../../../../shared/repo-types' import type { WorkspaceLineage } from '../../../../shared/worktree/lineage-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { folderWorkspaceKey, worktreeWorkspaceKey } from '../../../../shared/workspace-scope' import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-identity' import { getGitHubRepoCacheKey } from '../../../../shared/github/github-cache-key' diff --git a/src/renderer/src/components/right-sidebar/SourceControl.branch-line-total.test.tsx b/src/renderer/src/components/right-sidebar/SourceControl.branch-line-total.test.tsx index cbfacd73a28..5918edc9c70 100644 --- a/src/renderer/src/components/right-sidebar/SourceControl.branch-line-total.test.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControl.branch-line-total.test.tsx @@ -4,7 +4,7 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { TooltipProvider } from '@/components/ui/tooltip' -import type { GitBranchCompareSummary } from '../../../../shared/git-diff-compare-types' +import type { GitBranchCompareSummary } from '../../../../shared/git/diff/git-diff-compare-types' import { clearBranchLineTotalRequestGateForTests, getBranchLineTotalMergeBase diff --git a/src/renderer/src/components/right-sidebar/SourceControl.compare-summary.test.ts b/src/renderer/src/components/right-sidebar/SourceControl.compare-summary.test.ts index e716511ae6b..61b1734cde0 100644 --- a/src/renderer/src/components/right-sidebar/SourceControl.compare-summary.test.ts +++ b/src/renderer/src/components/right-sidebar/SourceControl.compare-summary.test.ts @@ -11,9 +11,9 @@ import { resolveSourceControlCompareBaseRef, resolveSourceControlPickerBaseRef, shouldClearBranchCompareForMissingBase -} from '../../../../shared/source-control-base-ref-resolution' -import type { GitBranchCompareSummary } from '../../../../shared/git-diff-compare-types' -import type { GitUpstreamStatus } from '../../../../shared/git-status-types' +} from '../../../../shared/source-control/decisions/source-control-base-ref-resolution' +import type { GitBranchCompareSummary } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitUpstreamStatus } from '../../../../shared/git/status/git-status-types' type ReactElementLike = { type: unknown diff --git a/src/renderer/src/components/right-sidebar/SourceControl.open-file-highlight.test.tsx b/src/renderer/src/components/right-sidebar/SourceControl.open-file-highlight.test.tsx index df38bd25870..cf780c79e1f 100644 --- a/src/renderer/src/components/right-sidebar/SourceControl.open-file-highlight.test.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControl.open-file-highlight.test.tsx @@ -4,8 +4,8 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { TooltipProvider } from '@/components/ui/tooltip' -import type { GitStatusEntry } from '../../../../shared/git-status-types' -import type { GitBranchCompareSummary } from '../../../../shared/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' +import type { GitBranchCompareSummary } from '../../../../shared/git/diff/git-diff-compare-types' import { toBranchCompareSnapshot } from '@/store/slices/editor/git/git-status-reconciliation' import SourceControl from './SourceControl' diff --git a/src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx b/src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx index 0da6628dbeb..90e238e515e 100644 --- a/src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControl.preview-open.test.tsx @@ -7,8 +7,8 @@ import { TooltipProvider } from '@/components/ui/tooltip' import type { GitBranchChangeEntry, GitBranchCompareSummary -} from '../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +} from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import SourceControl from './SourceControl' const mocks = vi.hoisted(() => { diff --git a/src/renderer/src/components/right-sidebar/SourceControl.resolve-conflicts-prompt.test.ts b/src/renderer/src/components/right-sidebar/SourceControl.resolve-conflicts-prompt.test.ts index c2e046c85d9..1eec21e3294 100644 --- a/src/renderer/src/components/right-sidebar/SourceControl.resolve-conflicts-prompt.test.ts +++ b/src/renderer/src/components/right-sidebar/SourceControl.resolve-conflicts-prompt.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { buildResolvePullRequestConflictsPrompt } from './source-control/ai/prompts' +import { buildResolvePullRequestConflictsPrompt } from '../../../../shared/source-control/recovery/source-control-conflict-prompts' describe('buildResolvePullRequestConflictsPrompt', () => { it('does not emit unquoted git commands for option-looking base branches', () => { diff --git a/src/renderer/src/components/right-sidebar/SourceControl.tsx b/src/renderer/src/components/right-sidebar/SourceControl.tsx index 1aece744b38..e0e88d688da 100644 --- a/src/renderer/src/components/right-sidebar/SourceControl.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControl.tsx @@ -19,12 +19,7 @@ export { ActionButton } from './source-control/listing/action-button' export { BRANCH_REFRESH_INTERVAL_MS } from './source-control/sync/use-branch-compare' export { CommitArea } from './source-control/commit/commit-area' export { handleSourceControlCommitShortcut } from './source-control/commit/commit-shortcut' -export { - resolveSourceControlBaseRef, - resolveSourceControlCompareBaseRef, - resolveSourceControlPickerBaseRef, - shouldClearBranchCompareForMissingBase -} from '../../../../shared/source-control-base-ref-resolution' + export { normalizeSourceControlViewMode, readCommitDraftForWorktree, @@ -39,16 +34,6 @@ export { refreshSourceControlAfterRemoteAction } from './source-control/sync/remote-refresh' -export { - appendCommitFailureCustomInstruction, - appendPushFailureCustomInstruction, - buildCommitFailureAgentCommandInput, - buildFixCommitFailurePrompt, - buildFixPushFailurePrompt, - buildPushFailureAgentCommandInput, - buildResolveConflictsPrompt, - buildResolvePullRequestConflictsPrompt -} from './source-control/ai/prompts' export { hasConfiguredCommitMessageGenerationDefaults, hasConfiguredSourceControlTextGenerationDefaults diff --git a/src/renderer/src/components/right-sidebar/SourceControl.virtual-file-list.test.tsx b/src/renderer/src/components/right-sidebar/SourceControl.virtual-file-list.test.tsx index 5f2e72367bc..f54421c7146 100644 --- a/src/renderer/src/components/right-sidebar/SourceControl.virtual-file-list.test.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControl.virtual-file-list.test.tsx @@ -4,7 +4,7 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { TooltipProvider } from '@/components/ui/tooltip' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import SourceControl from './SourceControl' import { VIRTUALIZED_LIST_MIN_ROWS, diff --git a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.picker.test.tsx b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.picker.test.tsx index 85e0773d81b..4d51b5193a8 100644 --- a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.picker.test.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.picker.test.tsx @@ -17,7 +17,7 @@ import { submittedActionStartupPlan } from './source-control-action-dialog.test-fixture' import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-capabilities' -import { resolveSourceControlActionRecipe } from '../../../../shared/source-control-ai-operation-policy' +import { resolveSourceControlActionRecipe } from '../../../../shared/source-control/ai/source-control-ai-operation-policy' import { resolveAgentStartupPlanInputs } from '../../../../shared/agent-launch/startup/agent-startup-plan-inputs' import { buildAgentStartupPlan } from '../../../../shared/agent-launch/startup/tui-agent-startup' import { tokenizeStartupCommand } from '../../../../shared/agent-launch/startup/tui-agent-startup-shell' diff --git a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.test.tsx b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.test.tsx index 5531fc50807..03673d571c6 100644 --- a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.test.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.test.tsx @@ -6,7 +6,7 @@ import React, { type ReactNode, useState, act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { getDefaultSettings } from '../../../../shared/constants' -import type { SourceControlActionRecipe } from '../../../../shared/source-control-ai-actions' +import type { SourceControlActionRecipe } from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Repo } from '../../../../shared/repo-types' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' diff --git a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.tsx b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.tsx index 715fdfbcfde..b8ac1c8e117 100644 --- a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialog.tsx @@ -1,4 +1,4 @@ -import type { CurrentActionSelection } from '../../../../shared/source-control-action-selection' +import type { CurrentActionSelection } from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import React from 'react' import type { RuntimeGitContext } from '@/runtime/runtime-git-client-context' import { @@ -11,11 +11,11 @@ import { import type { SourceControlActionRecipe, SourceControlLaunchActionId -} from '../../../../shared/source-control-ai-actions' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' import type { RunSourceControlAgentActionStartArgs } from './runSourceControlAgentActionStart' import type { LaunchSource } from '../../../../shared/telemetry-events' -import type { SourceControlAiWriteTarget } from '../../../../shared/source-control-ai-recipe-save' +import type { SourceControlAiWriteTarget } from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { SourceControlAgentActionDialogForm } from './SourceControlAgentActionDialogForm' import { useSourceControlAgentActionDialog } from './useSourceControlAgentActionDialog' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.test.tsx b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.test.tsx index 233294dbd97..1bb22712ea4 100644 --- a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.test.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.test.tsx @@ -1,6 +1,6 @@ import type { AgentPickerEntry } from '../../../../shared/agent-launch/picker/agent-launch-picker' -import { sourceControlActionRecipeEntry } from '../../../../shared/source-control-action-selection' -import type { SourceControlActionRecipe } from '../../../../shared/source-control-ai-actions' +import { sourceControlActionRecipeEntry } from '../../../../shared/source-control/ai/recipes/source-control-action-selection' +import type { SourceControlActionRecipe } from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import React, { type ReactNode } from 'react' import { renderToStaticMarkup } from 'react-dom/server' import { describe, expect, it, vi } from 'vitest' diff --git a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.tsx b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.tsx index 1006a14ed84..6fa3f8a5525 100644 --- a/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.tsx +++ b/src/renderer/src/components/right-sidebar/SourceControlAgentActionDialogForm.tsx @@ -3,7 +3,7 @@ import React, { useCallback, useLayoutEffect, useMemo, useRef } from 'react' import { canonicalSourceControlActionSelection, type SelectedSourceControlActionRecipe -} from '../../../../shared/source-control-action-selection' +} from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import { Info, RefreshCw, RotateCcw, Settings, Sparkles, TriangleAlert } from 'lucide-react' import { AgentLaunchPicker } from '@/components/agent/AgentLaunchPicker' import { sourceControlPickerDraft } from '../../lib/source-control-agent-launch-picker' @@ -19,8 +19,8 @@ import { } from '@/components/ui/select' import type { AgentCatalogEntry } from '@/lib/agent-catalog' import { cn } from '@/lib/utils' -import type { SourceControlLaunchActionId } from '../../../../shared/source-control-ai-actions' -import type { SourceControlAiWriteTarget } from '../../../../shared/source-control-ai-recipe-save' +import type { SourceControlLaunchActionId } from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiWriteTarget } from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Repo } from '../../../../shared/repo-types' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' diff --git a/src/renderer/src/components/right-sidebar/SourceControlTextGenerationDefaults.ts b/src/renderer/src/components/right-sidebar/SourceControlTextGenerationDefaults.ts index cfad0034f24..e71d437f8ef 100644 --- a/src/renderer/src/components/right-sidebar/SourceControlTextGenerationDefaults.ts +++ b/src/renderer/src/components/right-sidebar/SourceControlTextGenerationDefaults.ts @@ -1,10 +1,10 @@ -import { CUSTOM_AGENT_ID } from '../../../../shared/commit-message-agent-spec' -import type { ResolvedSourceControlAiGenerationParams } from '../../../../shared/source-control-ai' +import { CUSTOM_AGENT_ID } from '../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import type { ResolvedSourceControlAiGenerationParams } from '../../../../shared/source-control/ai/source-control-ai-operation-resolution' import { setSourceControlActionDefault, type SourceControlTextActionId -} from '../../../../shared/source-control-ai-actions' -import type { SourceControlAiSettings } from '../../../../shared/source-control-ai-types' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiSettings } from '../../../../shared/source-control/ai/settings/source-control-ai-settings-types' export function applySourceControlTextGenerationDefaults( current: SourceControlAiSettings, diff --git a/src/renderer/src/components/right-sidebar/active-checks-status.ts b/src/renderer/src/components/right-sidebar/active-checks-status.ts index dac014e6dde..98f33cbc4e1 100644 --- a/src/renderer/src/components/right-sidebar/active-checks-status.ts +++ b/src/renderer/src/components/right-sidebar/active-checks-status.ts @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../../shared/source-control/checks/provider-check-summary' import type { AppState } from '../../store/types' import { getRepoMapFromState, getWorktreeMapFromState } from '../../store/selectors' import type { CheckStatus as CoarseCheckStatus } from '../../../../shared/github/pull-request-types' diff --git a/src/renderer/src/components/right-sidebar/check-job-log-captured-fixture.ts b/src/renderer/src/components/right-sidebar/check-job-log-captured-fixture.ts index 4c45ffc62eb..c232f4ba4cc 100644 --- a/src/renderer/src/components/right-sidebar/check-job-log-captured-fixture.ts +++ b/src/renderer/src/components/right-sidebar/check-job-log-captured-fixture.ts @@ -1,5 +1,5 @@ import { createCheckLogFixture } from '../../../../../config/scripts/check-job-log-test-fixture.mjs' -import { sliceCheckLogTail } from '../../../../shared/check-job-log-tail-slice' +import { sliceCheckLogTail } from '../../../../shared/source-control/checks/logs/check-job-log-tail-slice' export const capturedCheckLogFailure = createCheckLogFixture() diff --git a/src/renderer/src/components/right-sidebar/check-job-log-tail.tsx b/src/renderer/src/components/right-sidebar/check-job-log-tail.tsx index c66442a4504..649ebad3c88 100644 --- a/src/renderer/src/components/right-sidebar/check-job-log-tail.tsx +++ b/src/renderer/src/components/right-sidebar/check-job-log-tail.tsx @@ -6,7 +6,7 @@ import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import type { PRCheckJob } from '../../../../shared/github/check-types' import type { CheckDetailsReadingOwner } from '@/components/editor/check-details-reading-owner' -import { resolveStepOutcome } from '../../../../shared/pr-check-step-status' +import { resolveStepOutcome } from '../../../../shared/source-control/checks/pr-check-step-status' import { useCheckLogReadingPosition } from './use-check-log-reading-position' const LOG_EXCERPT_ERROR_LINE_PATTERN = diff --git a/src/renderer/src/components/right-sidebar/check-log-initial-diagnostic-position.test.ts b/src/renderer/src/components/right-sidebar/check-log-initial-diagnostic-position.test.ts index e90fccc3bcf..ce6cbcfe59c 100644 --- a/src/renderer/src/components/right-sidebar/check-log-initial-diagnostic-position.test.ts +++ b/src/renderer/src/components/right-sidebar/check-log-initial-diagnostic-position.test.ts @@ -1,6 +1,6 @@ // @vitest-environment happy-dom import { describe, expect, it, vi } from 'vitest' -import { PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR as separator } from '../../../../shared/check-job-log-tail-slice' +import { PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR as separator } from '../../../../shared/source-control/checks/logs/check-job-log-tail-slice' import { findInitialCheckLogDiagnostic, measureInitialCheckLogScrollTop diff --git a/src/renderer/src/components/right-sidebar/check-log-initial-diagnostic-position.ts b/src/renderer/src/components/right-sidebar/check-log-initial-diagnostic-position.ts index 9417ce2d58e..653292e09e8 100644 --- a/src/renderer/src/components/right-sidebar/check-log-initial-diagnostic-position.ts +++ b/src/renderer/src/components/right-sidebar/check-log-initial-diagnostic-position.ts @@ -1,4 +1,4 @@ -import { PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR } from '../../../../shared/check-job-log-tail-slice' +import { PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR } from '../../../../shared/source-control/checks/logs/check-job-log-tail-slice' export type CheckLogDiagnosticAnchor = { start: number diff --git a/src/renderer/src/components/right-sidebar/checks-panel-blocker-copy.ts b/src/renderer/src/components/right-sidebar/checks-panel-blocker-copy.ts index d9a04dbeb80..aa97b965a3c 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-blocker-copy.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-blocker-copy.ts @@ -1,4 +1,4 @@ -import type { HostedReviewCreationBlockedReason } from '../../../../shared/hosted-review' +import type { HostedReviewCreationBlockedReason } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { translate } from '@/i18n/i18n' import { autoRetrySchedule, diff --git a/src/renderer/src/components/right-sidebar/checks-panel-empty-state.ts b/src/renderer/src/components/right-sidebar/checks-panel-empty-state.ts index 46192833ce6..e4dc16d9085 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-empty-state.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-empty-state.ts @@ -1,4 +1,4 @@ -import type { HostedReviewCreationBlockedReason } from '../../../../shared/hosted-review' +import type { HostedReviewCreationBlockedReason } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { translate } from '@/i18n/i18n' import { autoRetrySchedule, diff --git a/src/renderer/src/components/right-sidebar/checks-panel-git-status-snapshot.ts b/src/renderer/src/components/right-sidebar/checks-panel-git-status-snapshot.ts index 20c6a957301..aa7e0e27865 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-git-status-snapshot.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-git-status-snapshot.ts @@ -1,4 +1,7 @@ -import type { GitStatusEntry, GitUpstreamStatus } from '../../../../shared/git-status-types' +import type { + GitStatusEntry, + GitUpstreamStatus +} from '../../../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../../../shared/worktree/types' export type ChecksPanelGitStatusContextInput = { diff --git a/src/renderer/src/components/right-sidebar/checks-panel-pr-refresh-breadcrumb.ts b/src/renderer/src/components/right-sidebar/checks-panel-pr-refresh-breadcrumb.ts index 674d86ed2f7..fade7505b3f 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-pr-refresh-breadcrumb.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-pr-refresh-breadcrumb.ts @@ -7,7 +7,7 @@ import type { CrashReportBreadcrumbData, CrashReportDetailValue } from '../../../../shared/crash-reporting' -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' type ChecksPanelPRRefreshBreadcrumbEvent = 'start' | 'done' | 'stale_cleared' diff --git a/src/renderer/src/components/right-sidebar/checks-panel-review-creation.ts b/src/renderer/src/components/right-sidebar/checks-panel-review-creation.ts index 94b75d55d68..753f29572c7 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-review-creation.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-review-creation.ts @@ -1,11 +1,10 @@ import type { - HostedReviewCreationBlockedReason, HostedReviewCreationEligibility, HostedReviewLookupOutcome -} from '../../../../shared/hosted-review' +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRRefreshErrorType } from '../../../../shared/github/pull-request-refresh-types' -import { normalizeHostedReviewBaseRef } from '../../../../shared/hosted-review-refs' -import { isHostedReviewCreateEligibilityConfirmable } from '../../../../shared/hosted-review-create-confirmation' +import { normalizeHostedReviewBaseRef } from '../../../../shared/source-control/hosted-review/hosted-review-refs' +import { isHostedReviewCreateEligibilityConfirmable } from '../../../../shared/source-control/hosted-review/hosted-review-create-confirmation' import type { ChecksPanelReviewLookup } from './checks-panel-review-lookup-authority' // Share hard-error definitions so composer gating and empty-state copy cannot drift. import { HARD_REFRESH_ERROR_TYPES } from './checks-panel-review-state-model' @@ -99,5 +98,3 @@ export function computeChecksPanelConfirmedReadiness( } return { confirmed: true, needsPush: eligibility?.blockedReason === 'needs_push' } } - -export type { HostedReviewCreationBlockedReason } diff --git a/src/renderer/src/components/right-sidebar/checks-panel-review-lookup-authority.ts b/src/renderer/src/components/right-sidebar/checks-panel-review-lookup-authority.ts index 3f53439fdd7..1b472fe4e90 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-review-lookup-authority.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-review-lookup-authority.ts @@ -1,6 +1,6 @@ -import type { HostedReviewLookupAuthority } from '../../../../shared/hosted-review-create-confirmation' -import type { HostedReviewLookupOutcome } from '../../../../shared/hosted-review' -import { isPositiveHostedReviewNumber } from '../../../../shared/hosted-review' +import type { HostedReviewLookupAuthority } from '../../../../shared/source-control/hosted-review/hosted-review-create-confirmation' +import type { HostedReviewLookupOutcome } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { isPositiveHostedReviewNumber } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' /** Separate renderable reviews, positive-unresolved evidence, accepted absence, and unknown lookups; only accepted absence permits create. */ export type ChecksPanelReviewLookup = HostedReviewLookupAuthority diff --git a/src/renderer/src/components/right-sidebar/checks-panel-review-state-model.ts b/src/renderer/src/components/right-sidebar/checks-panel-review-state-model.ts index 8dc716cb121..52cd9cc6a53 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-review-state-model.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-review-state-model.ts @@ -1,4 +1,4 @@ -import type { HostedReviewCreationBlockedReason } from '../../../../shared/hosted-review' +import type { HostedReviewCreationBlockedReason } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { GitHubPRRefreshSkippedReason, PRRefreshErrorType diff --git a/src/renderer/src/components/right-sidebar/checks-panel-review.test.ts b/src/renderer/src/components/right-sidebar/checks-panel-review.test.ts index f2ff4dead95..d61c5b76f1c 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-review.test.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-review.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { gitHubPRToChecksPanelReview, selectChecksPanelReview } from './checks-panel-review' import type { PRInfo } from '../../../../shared/github/pull-request-types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' function makePR(overrides: Partial = {}): PRInfo { return { diff --git a/src/renderer/src/components/right-sidebar/checks-panel-review.ts b/src/renderer/src/components/right-sidebar/checks-panel-review.ts index b23f33d6c6e..7aaaa9af726 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-review.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel-review.ts @@ -1,6 +1,6 @@ import type { PRInfo } from '../../../../shared/github/pull-request-types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' -import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/hosted-review-github' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/source-control/hosted-review/hosted-review-github' import { isGitHubPRSuppressed } from '../../../../shared/worktree/github-pr-suppression' export type ChecksPanelReview = HostedReviewInfo diff --git a/src/renderer/src/components/right-sidebar/checks-panel/active-content.tsx b/src/renderer/src/components/right-sidebar/checks-panel/active-content.tsx index 32f421a72ce..1ae9cfb961d 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/active-content.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/active-content.tsx @@ -9,7 +9,10 @@ import { ChecksPanelUpdatedAtMetadata } from '../checks-panel-updated-at-metadat import { getChecksPanelRefreshErrorBannerLine } from '../github-refresh-error-copy' import { resolveChecksPanelHostedReviewModifierDestination } from '../checks-panel-hosted-review-click-routing' import { clearPendingPRCommentAiAck } from '../pr-comments-ai-launch-ack' -import { getBrokenChecks, isBrokenCheck } from '../../../../../shared/pr-checks-fix-prompt' +import { + getBrokenChecks, + isBrokenCheck +} from '../../../../../shared/source-control/checks/pr-checks-fix-prompt' import { PRTriageStrip } from './triage-strip' import { ConflictingFilesSection, MergeConflictNotice } from './conflict-summary' import { ChecksList } from './checks-list' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/check-details-model.ts b/src/renderer/src/components/right-sidebar/checks-panel/check-details-model.ts index 059012aa255..08206013999 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/check-details-model.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel/check-details-model.ts @@ -1,5 +1,5 @@ import type { PRCheckDetail, PRCheckRunDetails } from '../../../../../shared/github/check-types' -import { getCheckConclusion } from '../../../../../shared/pr-check-status-label' +import { getCheckConclusion } from '../../../../../shared/source-control/checks/pr-check-status-label' import { getIntlLocale } from '@/i18n/i18n' export type CheckDetailsLoadState = { diff --git a/src/renderer/src/components/right-sidebar/checks-panel/check-run-details.tsx b/src/renderer/src/components/right-sidebar/checks-panel/check-run-details.tsx index f893022fd66..eb244a76f99 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/check-run-details.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/check-run-details.tsx @@ -10,7 +10,7 @@ import type { GitHubRepositoryIdentity } from '../../../../../shared/github/pull import { CheckJobLogTail } from '../check-job-log-tail' import { translate } from '@/i18n/i18n' import { checkJobIdentities } from '@/components/editor/check-details-reading-cache' -import { resolveStepOutcome } from '../../../../../shared/pr-check-step-status' +import { resolveStepOutcome } from '../../../../../shared/source-control/checks/pr-check-step-status' import { type CheckDetailsLoadState, type CheckDetailsStickySurface, @@ -20,7 +20,7 @@ import { import { getCheckConclusion, getCheckStatusLabel -} from '../../../../../shared/pr-check-status-label' +} from '../../../../../shared/source-control/checks/pr-check-status-label' function ViewFullCheckDetailsButton({ onClick, diff --git a/src/renderer/src/components/right-sidebar/checks-panel/checks-list.tsx b/src/renderer/src/components/right-sidebar/checks-panel/checks-list.tsx index d34a9e350d9..bbe525ac3df 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/checks-list.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/checks-list.tsx @@ -15,7 +15,7 @@ import { observeOffscreenAnimation } from '@/lib/offscreen-animation-pause' import { translate } from '@/i18n/i18n' import { CHECK_COLOR, CHECK_ICON } from './check-presentation' import { CheckRunDetails } from './check-run-details' -import { getCheckStatusLabel } from '../../../../../shared/pr-check-status-label' +import { getCheckStatusLabel } from '../../../../../shared/source-control/checks/pr-check-status-label' import { getCheckStatusLabel as getLocalizedCheckStatusLabel } from '@/components/github/pr-check-presentation' import { type ChecksListProps, useChecksListState } from './use-checks-list-state' import { openAppHttpLink, openAppHttpLinkFromAnchor } from '@/lib/app-http-link-open' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/comment-controls.tsx b/src/renderer/src/components/right-sidebar/checks-panel/comment-controls.tsx index 01f834cd3da..1ee0edeecce 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/comment-controls.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/comment-controls.tsx @@ -21,9 +21,9 @@ import { cn } from '@/lib/utils' import { useAppStore } from '@/store' import { isReviewThreadResolutionInFlight } from '@/store/github/review-thread-resolution-in-flight' import { basename } from '@/lib/path' -import { isBotPRComment } from '../../../../../shared/pr-comment-audience' +import { isBotPRComment } from '../../../../../shared/source-control/review-comments/pr-comment-audience' import { setPRBotAuthorOverride } from '@/lib/pr-bot-author-overrides' -import { normalizePRCommentAuthorLogin } from '../../../../../shared/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/pr-comment-action-state' import type { PRCommentPresentationClasses } from '../pr-comment-presentation' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/comment-group.tsx b/src/renderer/src/components/right-sidebar/checks-panel/comment-group.tsx index 3f531312c18..52cd6d8118a 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/comment-group.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/comment-group.tsx @@ -18,7 +18,10 @@ import { type PRCommentPresentationClasses } from '../pr-comment-presentation' import type { GitHubReactionContent, PRComment } from '../../../../../shared/github/comment-types' -import { getPRCommentGroupId, type PRCommentGroup } from '../../../../../shared/pr-comment-groups' +import { + getPRCommentGroupId, + type PRCommentGroup +} from '../../../../../shared/source-control/review-comments/pr-comment-groups' import type { PRCommentGroupActionState } from '@/lib/pr-comment-action-state' import { RightPanelCommentComposer, diff --git a/src/renderer/src/components/right-sidebar/checks-panel/comment-row.tsx b/src/renderer/src/components/right-sidebar/checks-panel/comment-row.tsx index f0a9ec75971..2c7d548df3f 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/comment-row.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/comment-row.tsx @@ -4,11 +4,11 @@ import { cn } from '@/lib/utils' import CommentMarkdown from '@/components/sidebar/CommentMarkdown' import { reviewCommentMarkdown } from './review-comment-markdown' import { CommentReactions } from '@/components/github/CommentReactions' -import { isBotPRComment } from '../../../../../shared/pr-comment-audience' +import { isBotPRComment } from '../../../../../shared/source-control/review-comments/pr-comment-audience' import type { GitHubReactionContent, PRComment } from '../../../../../shared/github/comment-types' import type { PRCommentGroupActionState } from '@/lib/pr-comment-action-state' import type { PRCommentPresentationClasses } from '../pr-comment-presentation' -import { formatPrCommentRelativeTime } from '../../../../../shared/pr-comment-time' +import { formatPrCommentRelativeTime } from '../../../../../shared/source-control/review-comments/pr-comment-time' import { translate } from '@/i18n/i18n' import { buildCopyText, diff --git a/src/renderer/src/components/right-sidebar/checks-panel/hosted-review-manual-refresh.ts b/src/renderer/src/components/right-sidebar/checks-panel/hosted-review-manual-refresh.ts index 6d601543370..49ec2a60fdc 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/hosted-review-manual-refresh.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel/hosted-review-manual-refresh.ts @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react' import { getRepoExecutionHostId } from '../../../../../shared/execution-host' -import type { HostedReviewProvider } from '../../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { useAppStore } from '@/store' import { latestLookupGeneration } from '@/store/lookup-generation-sequence' import { refreshHostedReviewCard } from '@/store/slices/hosted-review-card-refresh' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/panel-content-rendering.test.tsx b/src/renderer/src/components/right-sidebar/checks-panel/panel-content-rendering.test.tsx index 9db7a5c7ca0..19bb01fd25d 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/panel-content-rendering.test.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/panel-content-rendering.test.tsx @@ -21,7 +21,7 @@ import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures' import { gitLabPipelineJobsToPRChecks, gitLabPipelineToPRCheck -} from '../../../../../shared/gitlab-pipeline-checks' +} from '../../../../../shared/source-control/checks/gitlab/gitlab-pipeline-checks' import { i18n } from '@/i18n/i18n' import { TooltipProvider } from '@/components/ui/tooltip' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/panel-state-types.ts b/src/renderer/src/components/right-sidebar/checks-panel/panel-state-types.ts index acd94e83816..0bdb04856e8 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/panel-state-types.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel/panel-state-types.ts @@ -1,7 +1,7 @@ import type { SourceControlAgentActionDialogProps } from '../SourceControlAgentActionDialog' -import type { HostedReviewCreationEligibility } from '../../../../../shared/hosted-review' +import type { HostedReviewCreationEligibility } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PendingPRCommentAiAck } from '../pr-comments-ai-launch-ack' -import type { SourceControlLaunchActionId } from '../../../../../shared/source-control-ai-actions' +import type { SourceControlLaunchActionId } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' export type HostedReviewCreationSnapshot = { requestKey: string diff --git a/src/renderer/src/components/right-sidebar/checks-panel/saved-action-delivery.test.tsx b/src/renderer/src/components/right-sidebar/checks-panel/saved-action-delivery.test.tsx index 50913b9c420..d3f843112a8 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/saved-action-delivery.test.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/saved-action-delivery.test.tsx @@ -10,7 +10,7 @@ import { afterEach, expect, it, vi } from 'vitest' import { useAppStore } from '@/store' import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures' import { getDefaultSettings } from '../../../../../shared/constants' -import type { HostedReviewInfo } from '../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRComment } from '../../../../../shared/github/comment-types' import type { PRInfo } from '../../../../../shared/github/pull-request-types' import { toast } from 'sonner' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/triage-strip.tsx b/src/renderer/src/components/right-sidebar/checks-panel/triage-strip.tsx index 65d74fe2a29..baef91989ef 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/triage-strip.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/triage-strip.tsx @@ -14,11 +14,14 @@ import type { ConflictReview } from './conflict-summary' import { summarizeProviderChecks, getProviderChecksOutcome -} from '../../../../../shared/provider-check-summary' +} from '../../../../../shared/source-control/checks/provider-check-summary' import { translate } from '@/i18n/i18n' import { cn } from '@/lib/utils' import { CHECK_COLOR } from './check-presentation' -import { getBrokenChecks, isBrokenCheck } from '../../../../../shared/pr-checks-fix-prompt' +import { + getBrokenChecks, + isBrokenCheck +} from '../../../../../shared/source-control/checks/pr-checks-fix-prompt' export function PRTriageStrip({ review, diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-list-state.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-list-state.tsx index ac6c6bc5afe..7e7e0d5fbe3 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-list-state.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-list-state.tsx @@ -4,8 +4,8 @@ import { useActiveWorktree } from '@/store/selectors' import type { GitLabProjectRef } from '../../../../../shared/gitlab-types' import type { PRCheckDetail, PRCheckRunDetails } from '../../../../../shared/github/check-types' import type { GitHubRepositoryIdentity } from '../../../../../shared/github/pull-request-types' -import { sortChecksBySeverity } from '../../../../../shared/pr-check-severity-order' -import { summarizeProviderChecks } from '../../../../../shared/provider-check-summary' +import { sortChecksBySeverity } from '../../../../../shared/source-control/checks/pr-check-severity-order' +import { summarizeProviderChecks } from '../../../../../shared/source-control/checks/provider-check-summary' import { createCheckRunDetailsRequestId } from '@/components/editor/check-run-details-tab' import { translate } from '@/i18n/i18n' import { useCheckDetailsResize } from '../check-details-resize' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-ai-queue.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-ai-queue.tsx index 755af3219b6..4e9c9458b2d 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-ai-queue.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-ai-queue.tsx @@ -1,5 +1,5 @@ import { useSavedSourceControlActionStart } from '../use-saved-source-control-action-start' -import { captureSourceControlActionSelection } from '../../../../../shared/source-control-ai-operation-policy' +import { captureSourceControlActionSelection } from '../../../../../shared/source-control/ai/source-control-ai-operation-policy' import { checksPanelReviewStableKey, clearPendingPRCommentAiAck, @@ -10,10 +10,10 @@ import type { ChecksAgentComposerState } from './panel-state-types' import type { ChecksPanelAiAcknowledgementState } from './use-checks-panel-ai-acknowledgement' import { forgeOwnerHostIdForWorkspace } from '@/runtime/forge-credential-target' import { toast } from 'sonner' -import { buildResolvePullRequestConflictsPrompt } from '../SourceControl' -import { buildPRCommentsResolutionPrompt } from '../../../../../shared/github/pr-comments-resolution-prompt' +import { buildResolvePullRequestConflictsPrompt } from '../../../../../shared/source-control/recovery/source-control-conflict-prompts' +import { buildPRCommentsResolutionPrompt } from '../../../../../shared/source-control/review-comments/pr-comments-resolution-prompt' import { parseGitHubIssueOrPRLink } from '../../../../../shared/github/links' -import type { PRCommentGroup } from '../../../../../shared/pr-comment-groups' +import type { PRCommentGroup } from '../../../../../shared/source-control/review-comments/pr-comment-groups' import { translate } from '@/i18n/i18n' import type { ChecksPanelContextState } from './use-checks-panel-context-state' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-check-and-review-actions.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-check-and-review-actions.tsx index 1ffcc774362..e205c367292 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-check-and-review-actions.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-check-and-review-actions.tsx @@ -9,7 +9,7 @@ import { collectFixChecksPromptDetails, getBrokenChecks, hasGitHubCheckHandle -} from '../../../../../shared/pr-checks-fix-prompt' +} from '../../../../../shared/source-control/checks/pr-checks-fix-prompt' import { loadGitLabJobLogDetails } from '@/runtime/gitlab-job-trace-client' import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-resolution.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-resolution.tsx index b7ac0f9fba1..5c55f0bbd4f 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-resolution.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-comment-resolution.tsx @@ -1,7 +1,7 @@ import { useAgentMenuObservation } from '@/components/tab-bar/use-new-tab-agent-menu-rows' import { useAgentDetectionTargetForWorktree } from '@/hooks/useAgentDetectionTarget' import { resolveChecksActionAgent } from '@/lib/source-control-agent-picker' -import type { SourceControlActionId } from '../../../../../shared/source-control-ai-actions' +import type { SourceControlActionId } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { forgeOwnerHostIdForWorkspace } from '@/runtime/forge-credential-target' import { useCallback, useEffect } from 'react' import { toast } from 'sonner' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-controller-state.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-controller-state.tsx index 1a6b94d187f..0bd125c9cae 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-controller-state.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-controller-state.tsx @@ -12,12 +12,12 @@ import { getWorktreeGitIdentityDisplay } from '../../../../../shared/worktree/gi import { resolveRepoWorktreeLaunchPlatform } from '@/lib/execution-host-facts' import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/worktree-runtime-owner' import { normalizeGlobalWindowsRuntimeDefault } from '../../../../../shared/project-execution-runtime' -import type { SourceControlAiWriteTarget } from '../../../../../shared/source-control-ai-recipe-save' +import type { SourceControlAiWriteTarget } from '../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { saveSourceControlAiActionRecipeForTarget } from '../source-control/ai/recipe-persistence' import type { SourceControlActionRecipe, SourceControlLaunchActionId -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { PRCheckDetail } from '../../../../../shared/github/check-types' import type { PRComment } from '../../../../../shared/github/comment-types' import type { PRRefreshErrorType } from '../../../../../shared/github/pull-request-refresh-types' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-create-review.test.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-create-review.test.tsx index d60e299ce77..792525a5a4d 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-create-review.test.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-create-review.test.tsx @@ -8,8 +8,8 @@ import { resolvePullRequestGenerationSuccess } from '@/store/slices/pull-request-generation' import { getDefaultSettings } from '../../../../../shared/constants' -import type { CreateHostedReviewResult } from '../../../../../shared/hosted-review' -import { getDefaultSourceControlAiSettings } from '../../../../../shared/source-control-ai-settings' +import type { CreateHostedReviewResult } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { getDefaultSourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import type * as AppHttpLinkOpen from '@/lib/app-http-link-open' import { useChecksPanelCreateReview } from './use-checks-panel-create-review' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-create-review.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-create-review.tsx index 4da59520f61..f5220a2ec6f 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-create-review.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-create-review.tsx @@ -2,8 +2,8 @@ import { useCallback } from 'react' import { toast } from 'sonner' import { formatCreateError } from '../create-pull-request-review-copy' import { stripBaseRef } from '../create-pull-request-base-ref-normalization' -import { normalizeHostedReviewHeadRef } from '../../../../../shared/hosted-review-refs' -import { hostedReviewProviderSupportsDraft } from '../../../../../shared/hosted-review' +import { normalizeHostedReviewHeadRef } from '../../../../../shared/source-control/hosted-review/hosted-review-refs' +import { hostedReviewProviderSupportsDraft } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { ChecksPanelReviewState } from './use-checks-panel-review-state' import type { ChecksPanelControllerState } from './use-checks-panel-controller-state' import type { ChecksPanelComposerState } from './use-checks-panel-composer-state' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-created-review.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-created-review.tsx index e998d3ab985..b7d9b4e4c22 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-created-review.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-created-review.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react' import { refreshHostedReviewCard } from '@/store/slices/hosted-review-card-refresh' import { resolveCreatedHostedReviewLink } from '../source-control-created-review-link' -import type { HostedReviewProvider } from '../../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { ChecksPanelControllerState } from './use-checks-panel-controller-state' import type { ChecksPanelContextState } from './use-checks-panel-context-state' import type { ChecksPanelPollingState } from './use-checks-panel-polling' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-entry-refresh-and-title-actions.test.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-entry-refresh-and-title-actions.test.tsx index 48bddfd05a1..d20c02328c3 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-entry-refresh-and-title-actions.test.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-entry-refresh-and-title-actions.test.tsx @@ -7,7 +7,7 @@ import { refreshHostedReviewCard } from '@/store/slices/hosted-review-card-refre import { _clearHostedReviewRequestGenerationsForTest } from '@/store/slices/hosted-review-request-state' import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures' import { getGitHubPRCacheKey } from '../../../../../shared/github/github-cache-key' -import type { HostedReviewInfo } from '../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRInfo } from '../../../../../shared/github/pull-request-types' import { checksPanelHostedReviewAsyncResultKey } from '../checks-panel-async-result-key' import { createModel } from './checks-panel-polling-test-model' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh-recovery.test.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh-recovery.test.tsx index 3d856ad05fe..2cf1ca30f99 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh-recovery.test.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-manual-refresh-recovery.test.tsx @@ -10,7 +10,7 @@ import { hostedReviewForBranchReply, type HostedReviewForBranchArgs, type HostedReviewInfo -} from '../../../../../shared/hosted-review' +} from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { getGitHubPRCacheKey } from '../../../../../shared/github/github-cache-key' import { selectChecksPanelReview } from '../checks-panel-review' import type { PRInfo } from '../../../../../shared/github/pull-request-types' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling.tsx index a7d134f4906..a892c63da01 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-polling.tsx @@ -8,7 +8,7 @@ import { useCallback, useEffect, useRef, useState } from 'react' import { gitLabPipelineJobsToPRChecks, gitLabPipelineToPRCheck -} from '../../../../../shared/gitlab-pipeline-checks' +} from '../../../../../shared/source-control/checks/gitlab/gitlab-pipeline-checks' import { checksPanelAsyncResultKey, checksPanelHostedReviewAsyncResultKey diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-review-state.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-review-state.tsx index 1b661710cd7..9d65fc2089e 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-review-state.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-checks-panel-review-state.tsx @@ -7,7 +7,7 @@ import { readChecksPanelGitStatusSnapshot, readChecksPanelPublishActionGitStatus } from '../checks-panel-git-status-snapshot' -import { resolveHostedReviewCreationProvider } from '../../../../../shared/hosted-review-creation-providers' +import { resolveHostedReviewCreationProvider } from '../../../../../shared/source-control/hosted-review/hosted-review-creation-providers' import { localizedHostedReviewCopy } from '@/i18n/hosted-review-localized-copy' import { resolveChecksPanelReviewLookup } from '../checks-panel-review-lookup-authority' import { @@ -21,13 +21,13 @@ import { markPullRequestGenerationRequiresPushBeforeCreate, type PullRequestGenerationContext } from '@/store/slices/pull-request-generation' -import { getCommitMessageModelDiscoveryHostKeyForScope } from '../../../../../shared/commit-message-host-key' +import { getCommitMessageModelDiscoveryHostKeyForScope } from '../../../../../shared/source-control/ai/generation/commit-message-host-key' +import { DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { - DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS, resolveSourceControlAiEnabled, - resolveSourceControlAiForOperation, resolveSourceControlAiPrCreationDefaults -} from '../../../../../shared/source-control-ai' +} from '../../../../../shared/source-control/ai/source-control-ai-operation-policy' +import { resolveSourceControlAiForOperation } from '../../../../../shared/source-control/ai/source-control-ai-operation-resolution' import { getRuntimeGitScope } from '@/runtime/runtime-git-client-context' import type { ChecksPanelReviewStateInput } from './review-state-dependencies' diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-comments-list-state.tsx b/src/renderer/src/components/right-sidebar/checks-panel/use-comments-list-state.tsx index e0d5a6c7815..c939bd6794c 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-comments-list-state.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-comments-list-state.tsx @@ -5,12 +5,12 @@ import { filterPRCommentsByAudience, getPRCommentAudienceCounts, type PRCommentAudienceFilter -} from '../../../../../shared/pr-comment-audience' +} from '../../../../../shared/source-control/review-comments/pr-comment-audience' import { getPRCommentGroupId, groupPRComments, type PRCommentGroup -} from '../../../../../shared/pr-comment-groups' +} from '../../../../../shared/source-control/review-comments/pr-comment-groups' import { getPRCommentGroupActionState, isPRCommentGroupQueueableForAI, diff --git a/src/renderer/src/components/right-sidebar/checks-panel/use-unlink-github-pull-request.ts b/src/renderer/src/components/right-sidebar/checks-panel/use-unlink-github-pull-request.ts index 48ef034d40b..b0dbc0979f4 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel/use-unlink-github-pull-request.ts +++ b/src/renderer/src/components/right-sidebar/checks-panel/use-unlink-github-pull-request.ts @@ -1,7 +1,7 @@ import { useCallback } from 'react' import { toast } from 'sonner' -import type { HostedReviewInfo } from '../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Worktree } from '../../../../../shared/worktree/types' import type { WorktreeSlice } from '@/store/slices/worktree-helpers' diff --git a/src/renderer/src/components/right-sidebar/commit-failure-summary.test.ts b/src/renderer/src/components/right-sidebar/commit-failure-summary.test.ts index f3eef0e8afd..9413765a893 100644 --- a/src/renderer/src/components/right-sidebar/commit-failure-summary.test.ts +++ b/src/renderer/src/components/right-sidebar/commit-failure-summary.test.ts @@ -3,7 +3,7 @@ import { COMMIT_FAILURE_SUMMARY_SCAN_CODE_UNITS, hasExpandedCommitFailureDetails, summarizeCommitFailure -} from './source-control/commit/commit-failure-summary' +} from '../../../../shared/source-control/recovery/source-control-commit-failure' afterEach(() => { vi.restoreAllMocks() diff --git a/src/renderer/src/components/right-sidebar/create-pull-request-base-ref-normalization.ts b/src/renderer/src/components/right-sidebar/create-pull-request-base-ref-normalization.ts index eb0071ec291..72819b1429e 100644 --- a/src/renderer/src/components/right-sidebar/create-pull-request-base-ref-normalization.ts +++ b/src/renderer/src/components/right-sidebar/create-pull-request-base-ref-normalization.ts @@ -1,4 +1,4 @@ -import { normalizeHostedReviewBaseRef } from '../../../../shared/hosted-review-refs' +import { normalizeHostedReviewBaseRef } from '../../../../shared/source-control/hosted-review/hosted-review-refs' export function stripBaseRef(ref: string): string { return normalizeHostedReviewBaseRef(ref) diff --git a/src/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.ts b/src/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.ts index bea97dbc9cc..7f889dcfe78 100644 --- a/src/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.ts +++ b/src/renderer/src/components/right-sidebar/create-pull-request-dialog-field-model.ts @@ -6,8 +6,8 @@ import type { RuntimeGitContext } from '@/runtime/runtime-git-client-context' import type { Repo } from '../../../../shared/repo-types' -import type { HostedReviewCreationEligibility } from '../../../../shared/hosted-review' -import type { SourceControlAiPrCreationDefaults } from '../../../../shared/source-control-ai-types' +import type { HostedReviewCreationEligibility } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import type { SourceControlAiPrCreationDefaults } from '../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { PullRequestFieldRevisions, PullRequestGenerationFields diff --git a/src/renderer/src/components/right-sidebar/create-pull-request-review-copy.ts b/src/renderer/src/components/right-sidebar/create-pull-request-review-copy.ts index ddcd7fe1c19..f3aa40e7400 100644 --- a/src/renderer/src/components/right-sidebar/create-pull-request-review-copy.ts +++ b/src/renderer/src/components/right-sidebar/create-pull-request-review-copy.ts @@ -2,7 +2,7 @@ import type { CreateHostedReviewResult, CreateStackedHostedReviewResult, HostedReviewProvider -} from '../../../../shared/hosted-review' +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { translate } from '@/i18n/i18n' import { localizedHostedReviewCopy, diff --git a/src/renderer/src/components/right-sidebar/git-status-refresh.test.ts b/src/renderer/src/components/right-sidebar/git-status-refresh.test.ts index 45570fce944..240978047d7 100644 --- a/src/renderer/src/components/right-sidebar/git-status-refresh.test.ts +++ b/src/renderer/src/components/right-sidebar/git-status-refresh.test.ts @@ -5,7 +5,10 @@ import { refreshGitStatusForWorktreeStrict, type GitStatusRefreshDeps } from './git-status-refresh' -import type { GitStatusResult, GitUpstreamStatus } from '../../../../shared/git-status-types' +import type { + GitStatusResult, + GitUpstreamStatus +} from '../../../../shared/git/status/git-status-types' function makeDeps(): GitStatusRefreshDeps { return { diff --git a/src/renderer/src/components/right-sidebar/git-status-refresh.ts b/src/renderer/src/components/right-sidebar/git-status-refresh.ts index 809ecbe241e..0fc1d63845b 100644 --- a/src/renderer/src/components/right-sidebar/git-status-refresh.ts +++ b/src/renderer/src/components/right-sidebar/git-status-refresh.ts @@ -7,7 +7,10 @@ import { invalidateAutomaticPushTargetUpstreamStatusCache, storeCachedAutomaticPushTargetUpstreamStatus } from './push-target-upstream-refresh-cache' -import type { GitStatusResult, GitUpstreamStatus } from '../../../../shared/git-status-types' +import type { + GitStatusResult, + GitUpstreamStatus +} from '../../../../shared/git/status/git-status-types' import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' import type { ExecutionHostId } from '../../../../shared/execution-host' import type { GitPushTarget } from '../../../../shared/worktree/types' diff --git a/src/renderer/src/components/right-sidebar/git-status-twin-copy.test.ts b/src/renderer/src/components/right-sidebar/git-status-twin-copy.test.ts index dcd48c9eb78..657a2d18586 100644 --- a/src/renderer/src/components/right-sidebar/git-status-twin-copy.test.ts +++ b/src/renderer/src/components/right-sidebar/git-status-twin-copy.test.ts @@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { GitStatusResult } from '../../../../shared/git-status-types' +import type { GitStatusResult } from '../../../../shared/git/status/git-status-types' import { useAppStore } from '@/store' import { resolveWorktreeGitCopyNow, worktreeCopyPushTarget } from '@/lib/worktree-git-copy' import { refreshGitStatusForWorktree } from './git-status-refresh' diff --git a/src/renderer/src/components/right-sidebar/github-refresh-error-copy.ts b/src/renderer/src/components/right-sidebar/github-refresh-error-copy.ts index 3c197c6eec5..cc98c791469 100644 --- a/src/renderer/src/components/right-sidebar/github-refresh-error-copy.ts +++ b/src/renderer/src/components/right-sidebar/github-refresh-error-copy.ts @@ -1,4 +1,4 @@ -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { localizedHostedReviewCopy, resolveSupportedHostedReviewCopyProvider diff --git a/src/renderer/src/components/right-sidebar/gitlab-mr-merge-state.ts b/src/renderer/src/components/right-sidebar/gitlab-mr-merge-state.ts index 21ff0e7ddd2..10796a98355 100644 --- a/src/renderer/src/components/right-sidebar/gitlab-mr-merge-state.ts +++ b/src/renderer/src/components/right-sidebar/gitlab-mr-merge-state.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { translate } from '@/i18n/i18n' type GitLabMRMergeStateReview = Pick< diff --git a/src/renderer/src/components/right-sidebar/hosted-review-create-failure-copy.ts b/src/renderer/src/components/right-sidebar/hosted-review-create-failure-copy.ts index 8bab4e5a90c..e68efd4450c 100644 --- a/src/renderer/src/components/right-sidebar/hosted-review-create-failure-copy.ts +++ b/src/renderer/src/components/right-sidebar/hosted-review-create-failure-copy.ts @@ -3,9 +3,9 @@ import type { CreateHostedReviewResult, CreateStackedHostedReviewResult, HostedReviewProvider -} from '../../../../shared/hosted-review' +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { translate } from '@/i18n/i18n' -import { isStackedReviewFailureReason } from '../../../../shared/stacked-hosted-review-failure-copy' +import { isStackedReviewFailureReason } from '../../../../shared/source-control/hosted-review/stacked-hosted-review-failure-copy' import { stackedFailureMessage } from './stacked-review-create-failure-copy' import { authRequiredDetail } from './hosted-review-sign-in-copy' import { diff --git a/src/renderer/src/components/right-sidebar/hosted-review-github-actions.ts b/src/renderer/src/components/right-sidebar/hosted-review-github-actions.ts index 92639ef2a8f..b02f4313b6b 100644 --- a/src/renderer/src/components/right-sidebar/hosted-review-github-actions.ts +++ b/src/renderer/src/components/right-sidebar/hosted-review-github-actions.ts @@ -4,7 +4,7 @@ import { getRepoExecutionHostId, parseExecutionHostId } from '../../../../shared import { GITHUB_MARK_PR_READY_RUNTIME_CAPABILITY, GITHUB_MARK_PR_READY_UPDATE_REQUIRED_MESSAGE -} from '../../../../shared/protocol-version' +} from '../../../../shared/source-control/runtime/source-control-runtime-capabilities' import { assertRuntimeEnvironmentCapability, callRuntimeRpc } from '@/runtime/runtime-rpc-client' import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' diff --git a/src/renderer/src/components/right-sidebar/hosted-review-sign-in-copy.ts b/src/renderer/src/components/right-sidebar/hosted-review-sign-in-copy.ts index e1296967b85..d87a47a2115 100644 --- a/src/renderer/src/components/right-sidebar/hosted-review-sign-in-copy.ts +++ b/src/renderer/src/components/right-sidebar/hosted-review-sign-in-copy.ts @@ -1,4 +1,4 @@ -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { translate } from '@/i18n/i18n' import { resolveSupportedHostedReviewCopyProvider, diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-github-pr-cache.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-github-pr-cache.ts index 40291b80ec1..3837f85ad0c 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-github-pr-cache.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-github-pr-cache.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRInfo } from '../../../../shared/github/pull-request-types' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-hosted-review-cache.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-hosted-review-cache.ts index 356691731fd..70c88dc8be0 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-hosted-review-cache.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-hosted-review-cache.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRInfo } from '../../../../shared/github/pull-request-types' import type { Worktree } from '../../../../shared/worktree/types' import { isGitHubPRSuppressed } from '../../../../shared/worktree/github-pr-suppression' diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-projection-selector.test.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-projection-selector.test.ts index 6706b5ea0ad..9e6d29af9af 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-projection-selector.test.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-projection-selector.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-identity' diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-refresh.test.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-refresh.test.ts index d1f5b685473..c7a39aef6d8 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-refresh.test.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-refresh.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { getParentPrChecksRefreshCandidates, runLimitedParentPrChecksRefreshes diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-refresh.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-refresh.ts index c7daba35dea..86718a284b3 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-refresh.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-refresh.ts @@ -2,7 +2,7 @@ import type { PRCheckDetail } from '../../../../shared/github/check-types' import type { GitHubRepositoryIdentity } from '../../../../shared/github/pull-request-types' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { isFolderRepo } from '../../../../shared/repo-kind' import { getWorktreeGitIdentityDisplay } from '../../../../shared/worktree/git-identity-display' import { compareWorktreeDisplayName } from '@/lib/worktree-display-name-order' diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-row-status.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-row-status.ts index 6fc5cd84766..19413371960 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-row-status.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-row-status.ts @@ -1,6 +1,6 @@ -import { getProviderChecksOutcome } from '../../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../../shared/source-control/checks/provider-check-summary' import type { CheckStatus } from '../../../../shared/github/pull-request-types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { translate } from '@/i18n/i18n' import type { ParentPrChecksGroupKey, diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-row-types.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-row-types.ts index 956195f34e3..e3fe32d1087 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-row-types.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-row-types.ts @@ -7,7 +7,7 @@ import type { } from '../../../../shared/github/pull-request-types' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { AppState } from '@/store' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-rows.test.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-rows.test.ts index fbca4f3c40c..47381ec5c3c 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-rows.test.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-rows.test.ts @@ -3,7 +3,7 @@ import type { PRCheckDetail } from '../../../../shared/github/check-types' import type { PRInfo } from '../../../../shared/github/pull-request-types' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-identity' import { getGitHubPRCacheKey, diff --git a/src/renderer/src/components/right-sidebar/parent-pr-checks-rows.ts b/src/renderer/src/components/right-sidebar/parent-pr-checks-rows.ts index 6253f1d5e4c..285f4e58669 100644 --- a/src/renderer/src/components/right-sidebar/parent-pr-checks-rows.ts +++ b/src/renderer/src/components/right-sidebar/parent-pr-checks-rows.ts @@ -1,8 +1,8 @@ import type { PRCheckDetail } from '../../../../shared/github/check-types' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' -import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/hosted-review-github' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/source-control/hosted-review/hosted-review-github' import { isFolderRepo } from '../../../../shared/repo-kind' import { isGitHubPRSuppressed } from '../../../../shared/worktree/github-pr-suppression' import { getWorktreeCardPrDisplay } from '@/components/sidebar/worktree-card-pr-display' diff --git a/src/renderer/src/components/right-sidebar/pr-comment-snapshotted-thread-resolver.ts b/src/renderer/src/components/right-sidebar/pr-comment-snapshotted-thread-resolver.ts index 81137fbe8be..8ed91ca3a24 100644 --- a/src/renderer/src/components/right-sidebar/pr-comment-snapshotted-thread-resolver.ts +++ b/src/renderer/src/components/right-sidebar/pr-comment-snapshotted-thread-resolver.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PendingPRCommentAiAckGithubResolveTarget, PendingPRCommentAiAckGitlabTarget diff --git a/src/renderer/src/components/right-sidebar/pr-comments-ai-launch-ack.test.ts b/src/renderer/src/components/right-sidebar/pr-comments-ai-launch-ack.test.ts index 645ecab79f0..1e2cac15a5f 100644 --- a/src/renderer/src/components/right-sidebar/pr-comments-ai-launch-ack.test.ts +++ b/src/renderer/src/components/right-sidebar/pr-comments-ai-launch-ack.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' import type { PRComment } from '../../../../shared/github/comment-types' -import type { PRCommentGroup } from '../../../../shared/pr-comment-groups' +import type { PRCommentGroup } from '../../../../shared/source-control/review-comments/pr-comment-groups' import { acknowledgePRCommentsAfterAiLaunch, attachPRReviewReplyParent, diff --git a/src/renderer/src/components/right-sidebar/pr-comments-ai-launch-ack.ts b/src/renderer/src/components/right-sidebar/pr-comments-ai-launch-ack.ts index a4c571b4cc7..e0ec31dee36 100644 --- a/src/renderer/src/components/right-sidebar/pr-comments-ai-launch-ack.ts +++ b/src/renderer/src/components/right-sidebar/pr-comments-ai-launch-ack.ts @@ -1,8 +1,11 @@ import type { PRComment } from '../../../../shared/github/comment-types' import type { PRInfo } from '../../../../shared/github/pull-request-types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' -import { getPRCommentGroupRoot, type PRCommentGroup } from '../../../../shared/pr-comment-groups' -import { isResolvablePRCommentGroup } from '../../../../shared/github/pr-comments-resolution-prompt' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { + getPRCommentGroupRoot, + type PRCommentGroup +} from '../../../../shared/source-control/review-comments/pr-comment-groups' +import { isResolvablePRCommentGroup } from '../../../../shared/source-control/review-comments/pr-comments-resolution-prompt' import { buildPRCommentBatchConversationReplyBody, PR_COMMENT_AI_FIXING_REPLY diff --git a/src/renderer/src/components/right-sidebar/pr-comments-list-selection.test.tsx b/src/renderer/src/components/right-sidebar/pr-comments-list-selection.test.tsx index 2d11ec38337..2a0201e352e 100644 --- a/src/renderer/src/components/right-sidebar/pr-comments-list-selection.test.tsx +++ b/src/renderer/src/components/right-sidebar/pr-comments-list-selection.test.tsx @@ -66,7 +66,7 @@ vi.mock('@/components/ui/dropdown-menu', () => { } }) import type { PRComment } from '../../../../shared/github/comment-types' -import type { PRCommentGroup } from '../../../../shared/pr-comment-groups' +import type { PRCommentGroup } from '../../../../shared/source-control/review-comments/pr-comment-groups' import { MAX_PERSISTED_PR_COMMENTS_LIST_SELECTIONS, clearPRCommentsListSelectionsForTests, diff --git a/src/renderer/src/components/right-sidebar/pr-comments-list-selection.ts b/src/renderer/src/components/right-sidebar/pr-comments-list-selection.ts index 84bc3ad524d..39437128b75 100644 --- a/src/renderer/src/components/right-sidebar/pr-comments-list-selection.ts +++ b/src/renderer/src/components/right-sidebar/pr-comments-list-selection.ts @@ -3,7 +3,7 @@ import { getPRCommentGroupId, groupPRComments, type PRCommentGroup -} from '../../../../shared/pr-comment-groups' +} from '../../../../shared/source-control/review-comments/pr-comment-groups' import { isPRCommentGroupQueueableForAI } from '@/lib/pr-comment-action-state' import type { PRComment } from '../../../../shared/github/comment-types' diff --git a/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.test.ts b/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.test.ts index 66ff4fa5ff5..79d9823231a 100644 --- a/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.test.ts +++ b/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.test.ts @@ -11,7 +11,10 @@ import { storeCachedAutomaticPushTargetUpstreamStatus } from './push-target-upstream-refresh-cache' -import type { GitStatusResult, GitUpstreamStatus } from '../../../../shared/git-status-types' +import type { + GitStatusResult, + GitUpstreamStatus +} from '../../../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../../../shared/worktree/types' const pushTarget: GitPushTarget = { diff --git a/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts b/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts index 959ab460e11..e4e763bc2a0 100644 --- a/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts +++ b/src/renderer/src/components/right-sidebar/push-target-upstream-refresh-cache.ts @@ -1,4 +1,7 @@ -import type { GitStatusResult, GitUpstreamStatus } from '../../../../shared/git-status-types' +import type { + GitStatusResult, + GitUpstreamStatus +} from '../../../../shared/git/status/git-status-types' import type { RuntimeClientTarget } from '../../../../shared/runtime-client-target' import type { GitPushTarget } from '../../../../shared/worktree/types' diff --git a/src/renderer/src/components/right-sidebar/runSourceControlAgentActionStart.test.ts b/src/renderer/src/components/right-sidebar/runSourceControlAgentActionStart.test.ts index bc23b8c84e7..27a3bc62eee 100644 --- a/src/renderer/src/components/right-sidebar/runSourceControlAgentActionStart.test.ts +++ b/src/renderer/src/components/right-sidebar/runSourceControlAgentActionStart.test.ts @@ -1,5 +1,5 @@ -import { sourceControlActionRecipeEntry } from '../../../../shared/source-control-action-selection' -import type { SourceControlActionRecipe } from '../../../../shared/source-control-ai-actions' +import { sourceControlActionRecipeEntry } from '../../../../shared/source-control/ai/recipes/source-control-action-selection' +import type { SourceControlActionRecipe } from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type * as RuntimeGitStatusClientModule from '@/runtime/runtime-git-status-client' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -32,10 +32,10 @@ vi.mock('sonner', () => ({ import { runSourceControlAgentActionStart } from './runSourceControlAgentActionStart' import { getDefaultSettings } from '../../../../shared/constants' -import { saveSourceControlActionRecipe } from '../../../../shared/source-control-ai-recipe-save' -import { resolveSourceControlActionRecipe } from '../../../../shared/source-control-ai-operation-policy' +import { saveSourceControlActionRecipe } from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' +import { resolveSourceControlActionRecipe } from '../../../../shared/source-control/ai/source-control-ai-operation-policy' import { saveSourceControlAiActionRecipeForTarget } from './source-control/ai/recipe-persistence' -import { sourceControlActionLaunchOptions } from '../../../../shared/source-control-action-launch-preferences' +import { sourceControlActionLaunchOptions } from '../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { resolveAgentLaunchCommand, terminalSessionOptionInputs diff --git a/src/renderer/src/components/right-sidebar/runSourceControlAgentActionStart.ts b/src/renderer/src/components/right-sidebar/runSourceControlAgentActionStart.ts index 205ca57fd6b..c09bc0c66e6 100644 --- a/src/renderer/src/components/right-sidebar/runSourceControlAgentActionStart.ts +++ b/src/renderer/src/components/right-sidebar/runSourceControlAgentActionStart.ts @@ -2,7 +2,7 @@ import type { DirectWorkItemLaunchResult } from '@/lib/direct-work-item-setup' import { sourceControlActionRecipeEntry, type SelectedSourceControlActionRecipe -} from '../../../../shared/source-control-action-selection' +} from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import type { AgentLaunchPreferences } from '@/runtime/agent-launch-settings/host-agent-launch-preferences-resource' import { focusTerminalTabSurface } from '@/lib/focus-terminal-tab-surface' import { launchAgentInNewTab } from '@/lib/launch-agent-in-new-tab' @@ -17,16 +17,16 @@ import { normalizeSourceControlActionRecipe, type SourceControlActionRecipe, type SourceControlLaunchActionId -} from '../../../../shared/source-control-ai-actions' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { saveSourceControlActionRecipe, type SourceControlAiWriteTarget -} from '../../../../shared/source-control-ai-recipe-save' +} from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { toast } from 'sonner' import { translate } from '@/i18n/i18n' import { sourceControlActionRecipeSaveMatchesTarget } from './source-control-action-recipe-match' import { resolveSourceControlAgentSaveTarget } from './source-control-agent-action-dialog-support' -import { projectSelectedSourceControlActionLaunch } from '../../../../shared/source-control-action-launch-preferences' +import { projectSelectedSourceControlActionLaunch } from '../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { admitSourceControlRecovery } from './source-control-recovery-admission' export type RunSourceControlAgentActionStartArgs = { diff --git a/src/renderer/src/components/right-sidebar/source-control-action-dialog.test-fixture.tsx b/src/renderer/src/components/right-sidebar/source-control-action-dialog.test-fixture.tsx index a965ceabbad..4e97642cee0 100644 --- a/src/renderer/src/components/right-sidebar/source-control-action-dialog.test-fixture.tsx +++ b/src/renderer/src/components/right-sidebar/source-control-action-dialog.test-fixture.tsx @@ -1,7 +1,7 @@ import { EVERY_AGENT_CHAT } from '../../../../shared/native-chat/every-agent-chat.test-fixture' import { terminalSessionOptionInputs } from '../../../../shared/agent-launch/startup/tui-agent-launch-command' import { buildAgentStartupPlan } from '../../../../shared/agent-launch/startup/tui-agent-startup' -import { resolveSourceControlActionRecipe } from '../../../../shared/source-control-ai-operation-policy' +import { resolveSourceControlActionRecipe } from '../../../../shared/source-control/ai/source-control-ai-operation-policy' import { TooltipProvider } from '@/components/ui/tooltip' import { SourceControlAgentActionDialog, @@ -9,7 +9,7 @@ import { } from './SourceControlAgentActionDialog' import type { RunSourceControlAgentActionStartArgs } from './runSourceControlAgentActionStart' import type { Repo } from '../../../../shared/repo-types' -import { normalizeRepoSourceControlAiOverrides } from '../../../../shared/source-control-ai' +import { normalizeRepoSourceControlAiOverrides } from '../../../../shared/source-control/ai/settings/source-control-ai-repo-settings' import { saveSourceControlAiActionRecipeForTarget } from './source-control/ai/recipe-persistence' import { TEST_REPO } from '@/store/slices/worktrees-slice-test-fixtures' import { getDefaultSettings } from '../../../../shared/constants' @@ -23,7 +23,7 @@ import { import { type SourceControlActionRecipe, normalizeSourceControlActionRecipe -} from '../../../../shared/source-control-ai-actions' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { useSourceControlAgentActionDialog } from './useSourceControlAgentActionDialog' import * as dialogController from './useSourceControlAgentActionDialog' import { diff --git a/src/renderer/src/components/right-sidebar/source-control-action-recipe-match.test.ts b/src/renderer/src/components/right-sidebar/source-control-action-recipe-match.test.ts index 3baf909db78..eecef47a627 100644 --- a/src/renderer/src/components/right-sidebar/source-control-action-recipe-match.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control-action-recipe-match.test.ts @@ -3,7 +3,7 @@ import { getDefaultSettings } from '../../../../shared/constants' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Repo } from '../../../../shared/repo-types' import { sourceControlActionRecipeMatchesTarget } from './source-control-action-recipe-match' -import { resolveSourceControlActionRecipe } from '../../../../shared/source-control-ai-operation-policy' +import { resolveSourceControlActionRecipe } from '../../../../shared/source-control/ai/source-control-ai-operation-policy' function settings(): GlobalSettings { const base = getDefaultSettings('/tmp') diff --git a/src/renderer/src/components/right-sidebar/source-control-action-recipe-match.ts b/src/renderer/src/components/right-sidebar/source-control-action-recipe-match.ts index a6428b944bb..76b807c24a2 100644 --- a/src/renderer/src/components/right-sidebar/source-control-action-recipe-match.ts +++ b/src/renderer/src/components/right-sidebar/source-control-action-recipe-match.ts @@ -1,20 +1,18 @@ -import { sourceControlActionRecipeEntry } from '../../../../shared/source-control-action-selection' -import { isCustomAgentId } from '../../../../shared/commit-message-agent-spec' -import { trimActionArgumentDocument } from '../../../../shared/source-control-action-argument-choices' -import { - normalizeRepoSourceControlAiOverrides, - normalizeSourceControlAiSettings, - resolveSourceControlActionRecipe -} from '../../../../shared/source-control-ai' +import { sourceControlActionRecipeEntry } from '../../../../shared/source-control/ai/recipes/source-control-action-selection' +import { isCustomAgentId } from '../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { trimActionArgumentDocument } from '../../../../shared/source-control/ai/recipes/source-control-action-argument-document' +import { normalizeRepoSourceControlAiOverrides } from '../../../../shared/source-control/ai/settings/source-control-ai-repo-settings' +import { normalizeSourceControlAiSettings } from '../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { resolveSourceControlActionRecipe } from '../../../../shared/source-control/ai/source-control-ai-operation-policy' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, type SourceControlActionId, type SourceControlActionRecipe -} from '../../../../shared/source-control-ai-actions' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { saveSourceControlActionRecipe, type SourceControlAiWriteTarget -} from '../../../../shared/source-control-ai-recipe-save' +} from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Repo } from '../../../../shared/repo-types' diff --git a/src/renderer/src/components/right-sidebar/source-control-actions.ts b/src/renderer/src/components/right-sidebar/source-control-actions.ts index db4efa16b82..5b33dfa8664 100644 --- a/src/renderer/src/components/right-sidebar/source-control-actions.ts +++ b/src/renderer/src/components/right-sidebar/source-control-actions.ts @@ -1,4 +1,4 @@ -import type { GitStagingArea } from '../../../../shared/git-status-types' +import type { GitStagingArea } from '../../../../shared/git/status/git-status-types' export type SourceControlAction = 'discard' | 'stage' | 'unstage' diff --git a/src/renderer/src/components/right-sidebar/source-control-active-open-file-keys.test.ts b/src/renderer/src/components/right-sidebar/source-control-active-open-file-keys.test.ts index 8634e104999..1178e7e4450 100644 --- a/src/renderer/src/components/right-sidebar/source-control-active-open-file-keys.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control-active-open-file-keys.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { GitBranchCompareSummary } from '../../../../shared/git-diff-compare-types' +import type { GitBranchCompareSummary } from '../../../../shared/git/diff/git-diff-compare-types' import { toBranchCompareSnapshot } from '@/store/slices/editor/git/git-status-reconciliation' import { buildActiveOpenFileSignature, diff --git a/src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-result.ts b/src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-result.ts index c25faea0537..7567163025c 100644 --- a/src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-result.ts +++ b/src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-result.ts @@ -5,7 +5,7 @@ import type { import type { CurrentActionSelection, SelectedSourceControlActionRecipe -} from '../../../../shared/source-control-action-selection' +} from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import type { getAgentCatalog } from '@/lib/agent-catalog' import type { useAppStore } from '@/store' import type { useRepoById } from '@/store/selectors' diff --git a/src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-support.ts b/src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-support.ts index bdf215d5c50..dc56721951f 100644 --- a/src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-support.ts +++ b/src/renderer/src/components/right-sidebar/source-control-agent-action-dialog-support.ts @@ -3,7 +3,7 @@ import { ensureDetectedAgentsForWorktree } from '@/lib/agent-detection-target-in import { getAgentCatalog } from '@/lib/agent-catalog' import { isTuiAgentEnabled } from '../../../../shared/agent-launch/catalog/tui-agent-selection' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' -import type { SourceControlAiWriteTarget } from '../../../../shared/source-control-ai-recipe-save' +import type { SourceControlAiWriteTarget } from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { translate } from '@/i18n/i18n' import type { SourceControlAgentActionDeliveryPlanState } from './SourceControlAgentActionDialogForm' import type { SourceControlAgentScopeNote } from './source-control-agent-action-dialog-result' diff --git a/src/renderer/src/components/right-sidebar/source-control-branch-context-row.test.tsx b/src/renderer/src/components/right-sidebar/source-control-branch-context-row.test.tsx index ce7500ca158..c7e426ec76a 100644 --- a/src/renderer/src/components/right-sidebar/source-control-branch-context-row.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control-branch-context-row.test.tsx @@ -2,8 +2,8 @@ import { renderToStaticMarkup } from 'react-dom/server' import type { ReactNode } from 'react' import { describe, expect, it, vi } from 'vitest' import { SourceControlBranchContextRow } from './source-control/panel/branch-context-row' -import type { GitBranchCompareSummary } from '../../../../shared/git-diff-compare-types' -import type { GitBranchLineTotal } from '../../../../shared/git-status-types' +import type { GitBranchCompareSummary } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitBranchLineTotal } from '../../../../shared/git/status/git-status-types' vi.mock('@/components/ui/tooltip', () => ({ Tooltip: ({ children }: { children: ReactNode }) => <>{children}, diff --git a/src/renderer/src/components/right-sidebar/source-control-create-pr-intent-flow.test.ts b/src/renderer/src/components/right-sidebar/source-control-create-pr-intent-flow.test.ts index c566b1fc130..23acadbf1d4 100644 --- a/src/renderer/src/components/right-sidebar/source-control-create-pr-intent-flow.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control-create-pr-intent-flow.test.ts @@ -12,7 +12,7 @@ import { shouldAttemptCreateHostedReviewForIntent, shouldGenerateHostedReviewDetailsForIntent } from './source-control/review/create-pr-intent-flow' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' describe('source-control Create PR intent flow helpers', () => { it('matches async completions only to the original repo, worktree, path, branch, and base', () => { diff --git a/src/renderer/src/components/right-sidebar/source-control-create-review-blocked-action.ts b/src/renderer/src/components/right-sidebar/source-control-create-review-blocked-action.ts index 7ae7eedfd16..f513d8bf797 100644 --- a/src/renderer/src/components/right-sidebar/source-control-create-review-blocked-action.ts +++ b/src/renderer/src/components/right-sidebar/source-control-create-review-blocked-action.ts @@ -1,7 +1,7 @@ import type { HostedReviewCreationBlockedReason, HostedReviewCreationEligibility -} from '../../../../shared/hosted-review' +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { hostedReviewCreateFailureMessage } from './hosted-review-create-failure-copy' type ClickableBlockedCreateReviewReason = Extract< diff --git a/src/renderer/src/components/right-sidebar/source-control-created-review-link.ts b/src/renderer/src/components/right-sidebar/source-control-created-review-link.ts index 0ca3d3db8ad..22fed075490 100644 --- a/src/renderer/src/components/right-sidebar/source-control-created-review-link.ts +++ b/src/renderer/src/components/right-sidebar/source-control-created-review-link.ts @@ -1,4 +1,4 @@ -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' type WorktreeReviewLink = Partial<{ linkedPR: number diff --git a/src/renderer/src/components/right-sidebar/source-control-dropdown-items.create-pr-intent.test.ts b/src/renderer/src/components/right-sidebar/source-control-dropdown-items.create-pr-intent.test.ts index 476dd5c4c3d..7c33300e05d 100644 --- a/src/renderer/src/components/right-sidebar/source-control-dropdown-items.create-pr-intent.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control-dropdown-items.create-pr-intent.test.ts @@ -3,7 +3,7 @@ import { resolveDropdownItems } from './source-control-dropdown-items' import type { DropdownActionInputs, DropdownItem -} from '../../../../shared/source-control-dropdown-item-types' +} from '../../../../shared/source-control/dropdown/source-control-dropdown-item-types' function inputs(overrides: Partial = {}): DropdownActionInputs { return { diff --git a/src/renderer/src/components/right-sidebar/source-control-dropdown-items.test.ts b/src/renderer/src/components/right-sidebar/source-control-dropdown-items.test.ts index f0e8b9ead7f..cbcb821bfbc 100644 --- a/src/renderer/src/components/right-sidebar/source-control-dropdown-items.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control-dropdown-items.test.ts @@ -5,11 +5,11 @@ import { resolveDropdownItems } from './source-control-dropdown-items' import type { DropdownActionInputs, DropdownItem -} from '../../../../shared/source-control-dropdown-item-types' +} from '../../../../shared/source-control/dropdown/source-control-dropdown-item-types' import { hasUsableHostedReviewPushTarget, resolveHostedReviewActionUpstreamStatus -} from '../../../../shared/hosted-review-push-target' +} from '../../../../shared/source-control/hosted-review/hosted-review-push-target' function inputs(overrides: Partial = {}): DropdownActionInputs { return { diff --git a/src/renderer/src/components/right-sidebar/source-control-dropdown-items.ts b/src/renderer/src/components/right-sidebar/source-control-dropdown-items.ts index 5184692716f..3b83f59a2e9 100644 --- a/src/renderer/src/components/right-sidebar/source-control-dropdown-items.ts +++ b/src/renderer/src/components/right-sidebar/source-control-dropdown-items.ts @@ -4,17 +4,17 @@ import { translate } from '@/i18n/i18n' import { COMMIT_MESSAGE_REQUIRED_REASON, type CommitDisabledReason -} from '../../../../shared/source-control-commit-eligibility' +} from '../../../../shared/source-control/decisions/source-control-commit-eligibility' import type { DropdownActionInputs, DropdownEntry -} from '../../../../shared/source-control-dropdown-item-types' -import { deriveDropdownActionContext } from '../../../../shared/source-control-dropdown-action-context' +} from '../../../../shared/source-control/dropdown/source-control-dropdown-item-types' +import { deriveDropdownActionContext } from '../../../../shared/source-control/dropdown/source-control-dropdown-action-context' import { buildCommitDropdownItems, type CommitDropdownCopy -} from '../../../../shared/source-control-dropdown-commit-items' -import { buildRemoteDropdownItems } from '../../../../shared/source-control-dropdown-remote-items' +} from '../../../../shared/source-control/dropdown/source-control-dropdown-commit-items' +import { buildRemoteDropdownItems } from '../../../../shared/source-control/dropdown/source-control-dropdown-remote-items' import { localizedRemoteCopy } from './source-control-dropdown-remote-localized-copy' import { buildHostedReviewDropdownItems } from './source-control-dropdown-review-items' diff --git a/src/renderer/src/components/right-sidebar/source-control-dropdown-remote-localized-copy.ts b/src/renderer/src/components/right-sidebar/source-control-dropdown-remote-localized-copy.ts index eb1c8c7bfc2..8903b7dcbd4 100644 --- a/src/renderer/src/components/right-sidebar/source-control-dropdown-remote-localized-copy.ts +++ b/src/renderer/src/components/right-sidebar/source-control-dropdown-remote-localized-copy.ts @@ -1,5 +1,5 @@ import { translate } from '@/i18n/i18n' -import type { RemoteDropdownCopy } from '../../../../shared/source-control-dropdown-remote-copy' +import type { RemoteDropdownCopy } from '../../../../shared/source-control/dropdown/source-control-dropdown-remote-copy' import { localizedFastForwardCount, localizedForcePushWithLease, diff --git a/src/renderer/src/components/right-sidebar/source-control-dropdown-review-items.ts b/src/renderer/src/components/right-sidebar/source-control-dropdown-review-items.ts index c16c079a365..cb78f3cd7c1 100644 --- a/src/renderer/src/components/right-sidebar/source-control-dropdown-review-items.ts +++ b/src/renderer/src/components/right-sidebar/source-control-dropdown-review-items.ts @@ -1,15 +1,15 @@ // Share creation blockers so Create and Push-before-PR tooltips cannot disagree. import { translate } from '@/i18n/i18n' -import { supportsHostedReviewCreation } from '../../../../shared/hosted-review-creation-providers' +import { supportsHostedReviewCreation } from '../../../../shared/source-control/hosted-review/hosted-review-creation-providers' import { localizedHostedReviewCopy, resolveSupportedHostedReviewCopyProvider } from '@/i18n/hosted-review-localized-copy' import { canClickBlockedCreateReviewReason } from './source-control-create-review-blocked-action' import { hostedReviewSignInHint } from './hosted-review-sign-in-copy' -import type { DropdownItem } from '../../../../shared/source-control-dropdown-item-types' -import type { DropdownActionContext } from '../../../../shared/source-control-dropdown-action-context' +import type { DropdownItem } from '../../../../shared/source-control/dropdown/source-control-dropdown-item-types' +import type { DropdownActionContext } from '../../../../shared/source-control/dropdown/source-control-dropdown-action-context' export type HostedReviewDropdownItems = { createPR: DropdownItem diff --git a/src/renderer/src/components/right-sidebar/source-control-fix-split-button.tsx b/src/renderer/src/components/right-sidebar/source-control-fix-split-button.tsx index 3e4d9ef6f38..e13986fe177 100644 --- a/src/renderer/src/components/right-sidebar/source-control-fix-split-button.tsx +++ b/src/renderer/src/components/right-sidebar/source-control-fix-split-button.tsx @@ -11,10 +11,10 @@ import { cn } from '@/lib/utils' import type { SourceControlActionRecipe, SourceControlLaunchActionId -} from '../../../../shared/source-control-ai-actions' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' import type { LaunchSource } from '../../../../shared/telemetry-events' -import type { SourceControlAiWriteTarget } from '../../../../shared/source-control-ai-recipe-save' +import type { SourceControlAiWriteTarget } from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { translate } from '@/i18n/i18n' import { SourceControlAgentActionDialog } from './SourceControlAgentActionDialog' diff --git a/src/renderer/src/components/right-sidebar/source-control-hosted-review-creation-eligibility-snapshot.test.ts b/src/renderer/src/components/right-sidebar/source-control-hosted-review-creation-eligibility-snapshot.test.ts index 5f8eb6234ea..7f4bde3f6ce 100644 --- a/src/renderer/src/components/right-sidebar/source-control-hosted-review-creation-eligibility-snapshot.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control-hosted-review-creation-eligibility-snapshot.test.ts @@ -4,7 +4,7 @@ import { buildLocalBlockerHostedReviewCreationEligibility, resolveHostedReviewCreationProviderForTarget } from './source-control/review/hosted-review-creation-eligibility-snapshot' -import { resolveCreatePrIntentEligibility } from './source-control/review/create-pr-intent-state' +import { resolveCreateReviewIntentEligibility as resolveCreatePrIntentEligibility } from '../../../../shared/source-control/decisions/source-control-create-review-intent' const featureBranch = { branch: 'feature/create-pr', baseRef: 'main' } diff --git a/src/renderer/src/components/right-sidebar/source-control-primary-action-types.ts b/src/renderer/src/components/right-sidebar/source-control-primary-action-types.ts index f91b2661223..0ffcd2fa7a6 100644 --- a/src/renderer/src/components/right-sidebar/source-control-primary-action-types.ts +++ b/src/renderer/src/components/right-sidebar/source-control-primary-action-types.ts @@ -1,10 +1,10 @@ -import type { HostedReviewCreationEligibility } from '../../../../shared/hosted-review' -import type { GitUpstreamStatus } from '../../../../shared/git-status-types' +import type { HostedReviewCreationEligibility } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import type { GitUpstreamStatus } from '../../../../shared/git/status/git-status-types' import type { PRState } from '../../../../shared/github/pull-request-types' import type { SourceControlPrimaryActionKind, SourceControlRemoteOpKind -} from '../../../../shared/source-control-primary-action-decision-types' +} from '../../../../shared/source-control/decisions/source-control-primary-action-decision-types' // Exclude dropdown-only compound kinds so primary dispatch remains exhaustive over actions it can emit. export type PrimaryActionKind = SourceControlPrimaryActionKind diff --git a/src/renderer/src/components/right-sidebar/source-control-primary-action.ts b/src/renderer/src/components/right-sidebar/source-control-primary-action.ts index 433cb0b516d..b81f3cbc2ff 100644 --- a/src/renderer/src/components/right-sidebar/source-control-primary-action.ts +++ b/src/renderer/src/components/right-sidebar/source-control-primary-action.ts @@ -1,8 +1,8 @@ import { resolveSourceControlCommitAreaPrimaryActionDecision, resolveSourceControlPrimaryActionDecision -} from '../../../../shared/source-control-primary-action-decision' -import type { SourceControlPrimaryActionDecision } from '../../../../shared/source-control-primary-action-decision-types' +} from '../../../../shared/source-control/decisions/source-control-primary-action-decision' +import type { SourceControlPrimaryActionDecision } from '../../../../shared/source-control/decisions/source-control-primary-action-decision-types' import { translate } from '@/i18n/i18n' import { localizedHostedReviewCopy, diff --git a/src/renderer/src/components/right-sidebar/source-control-submodule-expansion.test.ts b/src/renderer/src/components/right-sidebar/source-control-submodule-expansion.test.ts index 293e448af90..71d27adb133 100644 --- a/src/renderer/src/components/right-sidebar/source-control-submodule-expansion.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control-submodule-expansion.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { buildSubmoduleChildNodes, collectListSelectionEntries, diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/controller-types.ts b/src/renderer/src/components/right-sidebar/source-control/ai/controller-types.ts index f171bb99961..8de2e4c6c7d 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/controller-types.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/controller-types.ts @@ -3,7 +3,7 @@ import type { WorktreeAgentInventoryState } from '@/lib/agent-detection-target-i import type { GitConflictOperation, GitStatusEntry -} from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/status/git-status-types' import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import type { Repo } from '../../../../../../shared/repo-types' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/prompts.ts b/src/renderer/src/components/right-sidebar/source-control/ai/prompts.ts deleted file mode 100644 index b4c41e7e9db..00000000000 --- a/src/renderer/src/components/right-sidebar/source-control/ai/prompts.ts +++ /dev/null @@ -1,14 +0,0 @@ -export { buildCommitFailureAgentCommandInput } from '../../../../../../shared/source-control-commit-failure-agent-command' -export { buildPushFailureAgentCommandInput } from '../../../../../../shared/source-control-push-failure-agent-command' -export { - appendCommitFailureCustomInstruction, - buildFixCommitFailurePrompt -} from '../../../../../../shared/source-control-commit-failure' -export { - appendPushFailureCustomInstruction, - buildFixPushFailurePrompt -} from '../../../../../../shared/source-control-push-failure' -export { - buildResolveConflictsPrompt, - buildResolvePullRequestConflictsPrompt -} from '../../../../../../shared/source-control-conflict-prompts' diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/recipe-persistence.ts b/src/renderer/src/components/right-sidebar/source-control/ai/recipe-persistence.ts index 71b3db0eab8..2ee543c26ee 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/recipe-persistence.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/recipe-persistence.ts @@ -1,15 +1,15 @@ import type { AppState } from '@/store' -import { isCustomAgentId } from '../../../../../../shared/commit-message-agent-spec' -import type { ResolvedSourceControlAiGenerationParams } from '../../../../../../shared/source-control-ai' +import { isCustomAgentId } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import type { ResolvedSourceControlAiGenerationParams } from '../../../../../../shared/source-control/ai/source-control-ai-operation-resolution' import type { SourceControlActionRecipe, SourceControlLaunchActionId, SourceControlTextActionId -} from '../../../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { saveSourceControlActionRecipe, type SourceControlAiWriteTarget -} from '../../../../../../shared/source-control-ai-recipe-save' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { generationParamsToActionRecipe } from './text-generation-defaults' type SourceControlAiRecipePersistenceStoreSnapshot = Pick diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/recovery-launch.ts b/src/renderer/src/components/right-sidebar/source-control/ai/recovery-launch.ts index 1a6a70c229f..8b28eab0fae 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/recovery-launch.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/recovery-launch.ts @@ -1,4 +1,4 @@ -import type { SelectedSourceControlActionRecipe } from '../../../../../../shared/source-control-action-selection' +import type { SelectedSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/recipes/source-control-action-selection' import { ensureAgentLaunchPreferences } from '@/runtime/agent-launch-settings/use-host-agent-launch-preferences' import { AgentLaunchChoiceCancelled, @@ -20,14 +20,14 @@ import { import { pickSourceControlLaunchAgent, readSourceControlLaunchRecipeAgentId -} from '../../../../../../shared/source-control-launch-agent-selection' +} from '../../../../../../shared/source-control/ai/source-control-launch-agent-selection' import { isTuiAgentEnabled } from '../../../../../../shared/agent-launch/catalog/tui-agent-selection' import { projectSelectedSourceControlActionLaunch, resolveSourceControlActionPreferredSurface -} from '../../../../../../shared/source-control-action-launch-preferences' -import type { SourceControlLaunchActionId } from '../../../../../../shared/source-control-ai-actions' -import { buildSourceControlRecoveryAgentCommandInput } from '../../../../../../shared/source-control-recovery-agent-command' +} from '../../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' +import type { SourceControlLaunchActionId } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import { buildSourceControlRecoveryAgentCommandInput } from '../../../../../../shared/source-control/recovery/source-control-recovery-agent-command' import { translate } from '@/i18n/i18n' import { agentChoiceMayOpenAsChat } from '@/lib/host-chat-program' import { worktreeLaunchWorkspace } from '@/lib/agent-launch-route-input' diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/source-control-action-model-copy.ts b/src/renderer/src/components/right-sidebar/source-control/ai/source-control-action-model-copy.ts index 3f33a0569f5..a64a2eb3ff2 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/source-control-action-model-copy.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/source-control-action-model-copy.ts @@ -2,13 +2,13 @@ import { findCatalogModel, getAgentSessionOptionCatalog } from '../../../../../../shared/agent-session/options/agent-session-option-catalog' -import type { SourceControlActionLaunchPreferences } from '../../../../../../shared/source-control-ai-actions' +import type { SourceControlActionLaunchPreferences } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' import { sourceControlActionOptions, sourceControlActionPermissionModeRoute -} from '../../../../../../shared/source-control-action-options' -import { sourceControlActionSelectedPreferences } from '../../../../../../shared/source-control-action-launch-preferences' +} from '../../../../../../shared/source-control/ai/recipes/source-control-action-options' +import { sourceControlActionSelectedPreferences } from '../../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { translate } from '@/i18n/i18n' import { AGENT_CATALOG } from '@/lib/agent-catalog' import { agentPermissionChoiceLabel } from '../../../agent/launch-settings/AgentPermissionChoiceControls' diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-defaults.ts b/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-defaults.ts index 9b31aacb7e3..0dc2f80798c 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-defaults.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-defaults.ts @@ -1,13 +1,11 @@ -import { - normalizeRepoSourceControlAiOverrides, - type ResolvedSourceControlAiGenerationParams -} from '../../../../../../shared/source-control-ai' +import { normalizeRepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-repo-settings' +import type { ResolvedSourceControlAiGenerationParams } from '../../../../../../shared/source-control/ai/source-control-ai-operation-resolution' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, type SourceControlActionRecipe, type SourceControlTextActionId -} from '../../../../../../shared/source-control-ai-actions' -import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control-ai-recipe-save' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import type { Repo } from '../../../../../../shared/repo-types' import { sourceControlActionRecipeMatchesTarget } from '../../source-control-action-recipe-match' diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-dialog-form.tsx b/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-dialog-form.tsx index 4e936f9410a..240bdfa91df 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-dialog-form.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-dialog-form.tsx @@ -17,11 +17,11 @@ import { CUSTOM_AGENT_ID, isCustomAgentId, listCommitMessageAgentCapabilities -} from '../../../../../../shared/commit-message-agent-spec' -import type { ResolvedSourceControlAiGenerationParams } from '../../../../../../shared/source-control-ai' -import { formatLinkedIssueTemplateValue } from '../../../../../../shared/source-control-ai-action-variables' -import type { SourceControlTextActionId } from '../../../../../../shared/source-control-ai-actions' -import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control-ai-recipe-save' +} from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import type { ResolvedSourceControlAiGenerationParams } from '../../../../../../shared/source-control/ai/source-control-ai-operation-resolution' +import { formatLinkedIssueTemplateValue } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-action-variables' +import type { SourceControlTextActionId } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import type { Repo } from '../../../../../../shared/repo-types' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-dialog.tsx b/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-dialog.tsx index a72c58dc31b..3a7a0dbe5f7 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-dialog.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-dialog.tsx @@ -11,14 +11,14 @@ import { import { resolveSourceControlAiForOperation, type ResolvedSourceControlAiGenerationParams -} from '../../../../../../shared/source-control-ai' -import type { SourceControlTextActionId } from '../../../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/source-control-ai-operation-resolution' +import type { SourceControlTextActionId } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import type { Repo } from '../../../../../../shared/repo-types' -import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control-ai-recipe-save' -import { buildBranchNamePrompt } from '../../../../../../shared/branch-name-from-work' -import { buildCommitMessagePrompt } from '../../../../../../shared/commit-message-generation' -import { buildPullRequestFieldsPrompt } from '../../../../../../shared/pull-request-generation' +import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' +import { buildBranchNamePrompt } from '../../../../../../shared/source-control/ai/naming/branch-name-from-work' +import { buildCommitMessagePrompt } from '../../../../../../shared/source-control/ai/generation/commit-message-generation' +import { buildPullRequestFieldsPrompt } from '../../../../../../shared/source-control/ai/generation/pull-request-generation' import { SourceControlTextGenerationDialogForm, type SourceControlTextGenerationSaveTarget diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-params.ts b/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-params.ts index fe82e0c3380..8a45a3f43b6 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-params.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/text-generation-params.ts @@ -2,8 +2,8 @@ import { CUSTOM_AGENT_ID, getCommitMessageAgentCapability, isCustomAgentId -} from '../../../../../../shared/commit-message-agent-spec' -import type { ResolvedSourceControlAiGenerationParams } from '../../../../../../shared/source-control-ai' +} from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import type { ResolvedSourceControlAiGenerationParams } from '../../../../../../shared/source-control/ai/source-control-ai-operation-resolution' import type { GlobalSettings } from '../../../../../../shared/global-settings-types' export type CommitMessageGenerationAgentChoice = diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/use-ai.operation-recovery.test.tsx b/src/renderer/src/components/right-sidebar/source-control/ai/use-ai.operation-recovery.test.tsx index 145833c48ee..0f9ac87283f 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/use-ai.operation-recovery.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/ai/use-ai.operation-recovery.test.tsx @@ -1,4 +1,4 @@ -import { sourceControlActionRecipeEntry } from '../../../../../../shared/source-control-action-selection' +import { sourceControlActionRecipeEntry } from '../../../../../../shared/source-control/ai/recipes/source-control-action-selection' import { runtimeStatusEntry } from '@/runtime/server-layout-frames.test-fixture' import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-capabilities' import { getRuntimeAgentInventoryKey } from '@/store/slices/runtime-agent-inventory-key' @@ -18,7 +18,7 @@ import { act, cleanup, renderHook, waitFor } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { useAppStore } from '@/store' import { getDefaultSettings } from '../../../../../../shared/constants' -import type { GitConflictOperation } from '../../../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' import { useSourceControlAi } from './use-ai' import type { SourceControlAiControllerParams } from './controller-types' diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/use-ai.ts b/src/renderer/src/components/right-sidebar/source-control/ai/use-ai.ts index 57d1c7e37ea..cbf56bc55b5 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/use-ai.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/use-ai.ts @@ -1,25 +1,28 @@ -import { captureSourceControlActionSelection } from '../../../../../../shared/source-control-ai-operation-policy' -import type { SelectedSourceControlActionRecipe } from '../../../../../../shared/source-control-action-selection' +import { + captureSourceControlActionSelection, + resolveSourceControlActionRecipe, + resolveSourceControlAiEnabled, + resolveSourceControlAiPrCreationDefaults +} from '../../../../../../shared/source-control/ai/source-control-ai-operation-policy' +import type { SelectedSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/recipes/source-control-action-selection' import { useSavedSourceControlActionStart } from '../../use-saved-source-control-action-start' import type { SourceControlAgentActionDialogProps } from '../../SourceControlAgentActionDialog' import { useCallback, useMemo, useState } from 'react' import { useAppStore } from '@/store' import { getRuntimeGitScope } from '@/runtime/runtime-git-client-context' -import { getCommitMessageModelDiscoveryHostKeyForScope } from '../../../../../../shared/commit-message-host-key' +import { getCommitMessageModelDiscoveryHostKeyForScope } from '../../../../../../shared/source-control/ai/generation/commit-message-host-key' +import { DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' + import { - DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS, - resolveSourceControlActionRecipe, - resolveSourceControlAiEnabled, resolveSourceControlAiForOperation, - resolveSourceControlAiPrCreationDefaults, type ResolvedSourceControlAiGenerationParams -} from '../../../../../../shared/source-control-ai' +} from '../../../../../../shared/source-control/ai/source-control-ai-operation-resolution' import type { SourceControlActionRecipe, SourceControlLaunchActionId, SourceControlTextActionId -} from '../../../../../../shared/source-control-ai-actions' -import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control-ai-recipe-save' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { saveSourceControlAiActionRecipeForTarget, saveSourceControlTextGenerationDefaults diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/use-conflict-recovery-composer.ts b/src/renderer/src/components/right-sidebar/source-control/ai/use-conflict-recovery-composer.ts index 6ea2b117877..c6321b9abd5 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/use-conflict-recovery-composer.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/use-conflict-recovery-composer.ts @@ -7,7 +7,7 @@ import { } from '../../source-control-recovery-admission' import type { RuntimeGitContext } from '@/runtime/runtime-git-client-context' import type { SourceControlAiControllerParams } from './controller-types' -import { buildResolveConflictsPrompt } from './prompts' +import { buildResolveConflictsPrompt } from '../../../../../../shared/source-control/recovery/source-control-conflict-prompts' export function useConflictRecoveryComposer({ target, diff --git a/src/renderer/src/components/right-sidebar/source-control/ai/use-recovery-ai.ts b/src/renderer/src/components/right-sidebar/source-control/ai/use-recovery-ai.ts index 47750626667..ccf747b0fa3 100644 --- a/src/renderer/src/components/right-sidebar/source-control/ai/use-recovery-ai.ts +++ b/src/renderer/src/components/right-sidebar/source-control/ai/use-recovery-ai.ts @@ -1,9 +1,12 @@ -import type { SelectedSourceControlActionRecipe } from '../../../../../../shared/source-control-action-selection' +import type { SelectedSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/recipes/source-control-action-selection' import { useCallback, useMemo, useState } from 'react' -import type { SourceControlLaunchActionId } from '../../../../../../shared/source-control-ai-actions' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' -import { buildFixCommitFailurePrompt } from './prompts' -import { summarizeCommitFailure } from '../commit/commit-failure-summary' +import type { SourceControlLaunchActionId } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' +import { + buildFixCommitFailurePrompt, + summarizeCommitFailure +} from '../../../../../../shared/source-control/recovery/source-control-commit-failure' + import { getDefaultSourceControlRecoveryLaunchCopy, launchSourceControlRecoveryAgentWithDefault diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/commit-area-types.ts b/src/renderer/src/components/right-sidebar/source-control/commit/commit-area-types.ts index 93b2ec23648..8c9f3987cce 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/commit-area-types.ts +++ b/src/renderer/src/components/right-sidebar/source-control/commit/commit-area-types.ts @@ -1,14 +1,14 @@ import type { DropdownActionKind, DropdownEntry -} from '../../../../../../shared/source-control-dropdown-item-types' +} from '../../../../../../shared/source-control/dropdown/source-control-dropdown-item-types' import type { PrimaryAction, RemoteOpKind } from '../../source-control-primary-action' import type { SourceControlPushRecovery } from '../sync/push-recovery' import type { SourceControlActionRecipe, SourceControlLaunchActionId -} from '../../../../../../shared/source-control-ai-actions' -import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control-ai-recipe-save' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' export type CreatePrIntentNotice = { message: string diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/commit-area.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/commit-area.tsx index 73d04b7e9df..a6900dd7ad4 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/commit-area.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/commit/commit-area.tsx @@ -7,8 +7,11 @@ import { } from '@/components/ui/dropdown-menu' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { translate } from '@/i18n/i18n' -import { hasExpandedCommitFailureDetails, summarizeCommitFailure } from './commit-failure-summary' -import { isCommitMessageFieldDisabled } from '../../../../../../shared/source-control-commit-eligibility' +import { + hasExpandedCommitFailureDetails, + summarizeCommitFailure +} from '../../../../../../shared/source-control/recovery/source-control-commit-failure' +import { isCommitMessageFieldDisabled } from '../../../../../../shared/source-control/decisions/source-control-commit-eligibility' import { CommitActionMenu } from './commit-action-menu' import type { CommitAreaProps } from './commit-area-types' import { CommitMessageComposer } from './commit-message-composer' diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/commit-failure-summary.ts b/src/renderer/src/components/right-sidebar/source-control/commit/commit-failure-summary.ts deleted file mode 100644 index e9d9f206759..00000000000 --- a/src/renderer/src/components/right-sidebar/source-control/commit/commit-failure-summary.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { - COMMIT_FAILURE_SUMMARY_SCAN_CODE_UNITS, - hasExpandedCommitFailureDetails, - summarizeCommitFailure -} from '../../../../../../shared/source-control-commit-failure' diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/component-gates.ts b/src/renderer/src/components/right-sidebar/source-control/commit/component-gates.ts index 133f8897091..ccfbac5575d 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/component-gates.ts +++ b/src/renderer/src/components/right-sidebar/source-control/commit/component-gates.ts @@ -1,5 +1,5 @@ -import { pickSourceControlLaunchAgent } from '../../../../../../shared/source-control-launch-agent-selection' -import type { GitConflictOperation } from '../../../../../../shared/git-status-types' +import { pickSourceControlLaunchAgent } from '../../../../../../shared/source-control/ai/source-control-launch-agent-selection' +import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' export function shouldRenderCommitArea( diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/discard-all-failure-description.test.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/discard-all-failure-description.test.tsx index 2ff1bd71f2e..d3f662c948d 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/discard-all-failure-description.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/commit/discard-all-failure-description.test.tsx @@ -6,7 +6,7 @@ import type { DiscardAllDeps, DiscardAllResult, DiscardAllArea -} from '../../../../../../shared/source-control-discard-all-sequence' +} from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import type { SourceControlToastTestOptions } from './source-control-toast-test-options' type DiscardAllRunner = ( area: DiscardAllArea, @@ -24,14 +24,17 @@ vi.mock('@/lib/connection-context', () => ({ getConnectionId: () => undefined }) vi.mock('@/runtime/runtime-git-working-tree-client', () => ({ bulkUnstageRuntimeGitPaths: vi.fn() })) -vi.mock('../../../../../../shared/source-control-discard-all-sequence', () => ({ - getDiscardAllPaths: () => [], - runDiscardAllForArea: (area: DiscardAllArea, paths: readonly string[], deps: DiscardAllDeps) => - mocks.runDiscardAllForArea(area, paths, deps) -})) +vi.mock( + '../../../../../../shared/source-control/listing/source-control-discard-all-sequence', + () => ({ + getDiscardAllPaths: () => [], + runDiscardAllForArea: (area: DiscardAllArea, paths: readonly string[], deps: DiscardAllDeps) => + mocks.runDiscardAllForArea(area, paths, deps) + }) +) import { useSourceControlDiscardConfirmation } from './use-discard-confirmation' -import type { SourceControlEntryGroups } from '../../../../../../shared/source-control-section-order' +import type { SourceControlEntryGroups } from '../../../../../../shared/source-control/listing/source-control-section-order' const EMPTY_GROUPS: SourceControlEntryGroups = { unstaged: [], staged: [], untracked: [] } diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/discard-confirmation.ts b/src/renderer/src/components/right-sidebar/source-control/commit/discard-confirmation.ts index 95bf23e5d56..8ad74fb6057 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/discard-confirmation.ts +++ b/src/renderer/src/components/right-sidebar/source-control/commit/discard-confirmation.ts @@ -1,6 +1,6 @@ import { basename } from '@/lib/path' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' -import type { DiscardAllArea } from '../../../../../../shared/source-control-discard-all-sequence' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' +import type { DiscardAllArea } from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import { translate } from '@/i18n/i18n' export type DiscardConfirmationCopy = { diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/discard-dialog.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/discard-dialog.tsx index b3f57654bcc..048f0fb4c5a 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/discard-dialog.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/commit/discard-dialog.tsx @@ -10,8 +10,8 @@ import { DialogHeader, DialogTitle } from '@/components/ui/dialog' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' -import type { DiscardAllArea } from '../../../../../../shared/source-control-discard-all-sequence' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' +import type { DiscardAllArea } from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import { getDiscardAreaConfirmationCopy, getDiscardEntryConfirmationCopy diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/recovery-notice.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/recovery-notice.tsx index 7a6d8b2a5e2..ebc024b59a0 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/recovery-notice.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/commit/recovery-notice.tsx @@ -12,12 +12,12 @@ import { } from '@/components/ui/dialog' import { translate } from '@/i18n/i18n' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' -import { readSourceControlLaunchRecipeAgentId } from '../../../../../../shared/source-control-launch-agent-selection' +import { readSourceControlLaunchRecipeAgentId } from '../../../../../../shared/source-control/ai/source-control-launch-agent-selection' import type { SourceControlActionRecipe, SourceControlLaunchActionId -} from '../../../../../../shared/source-control-ai-actions' -import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control-ai-recipe-save' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiWriteTarget } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { SourceControlFixSplitButton } from '../../source-control-fix-split-button' export type SourceControlRecoveryKind = 'commit' | 'push' diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/rename-mutation-paths.test.ts b/src/renderer/src/components/right-sidebar/source-control/commit/rename-mutation-paths.test.ts index ecfa2dea320..2219a03c924 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/rename-mutation-paths.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control/commit/rename-mutation-paths.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { getDiscardAllPaths, getUnstageAllPaths -} from '../../../../../../shared/source-control-discard-all-sequence' +} from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' const rename: GitStatusEntry = { path: 'new/file.txt', diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions-capped-stage.test.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions-capped-stage.test.tsx index cbe3e2f4186..303538adcda 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions-capped-stage.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions-capped-stage.test.tsx @@ -2,7 +2,7 @@ import { act, renderHook } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' const mocks = vi.hoisted(() => ({ bulkStage: vi.fn(), stageScope: vi.fn(), toastError: vi.fn() })) @@ -15,7 +15,7 @@ vi.mock('@/runtime/runtime-git-working-tree-client', () => ({ })) import { useSourceControlBulkActions } from './use-bulk-actions' -import type { SourceControlEntryGroups } from '../../../../../../shared/source-control-section-order' +import type { SourceControlEntryGroups } from '../../../../../../shared/source-control/listing/source-control-section-order' function entry(path: string, area: GitStatusEntry['area']): GitStatusEntry { return { path, status: area === 'untracked' ? 'untracked' : 'modified', area } diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.ts b/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.ts index d0b32b2f971..c2f912656c7 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.ts +++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-bulk-actions.ts @@ -14,13 +14,13 @@ import { getStageAllPaths, getUnstageAllPaths, isStageableStatusEntry -} from '../../../../../../shared/source-control-discard-all-sequence' +} from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import type { SourceControlDisplaySectionId, SourceControlEntryGroups -} from '../../../../../../shared/source-control-section-order' +} from '../../../../../../shared/source-control/listing/source-control-section-order' import type { FlatEntry } from '../listing/use-selection' -import type { GitStageWorktreeScope } from '../../../../../../shared/git-stage-worktree-scope' +import type { GitStageWorktreeScope } from '../../../../../../shared/git/paths/git-stage-worktree-scope' /** Handlers run with void; catch Git failures to avoid silent unhandled rejections. */ function reportBulkMutationFailure(error: unknown): void { diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.ts b/src/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.ts index 75555c7a490..058469f99de 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.ts +++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-commit-message-generation.ts @@ -16,7 +16,7 @@ import { resolveCommitMessageGenerationSuccess, type CommitMessageGenerationRecord } from '@/store/slices/commit-message-generation' -import { isCustomAgentId } from '../../../../../../shared/commit-message-agent-spec' +import { isCustomAgentId } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { hasConfiguredCommitMessageGenerationDefaults } from '../ai/text-generation-defaults' import type { SourceControlAi } from '../ai/use-ai' import type { SourceControlStoreActions } from '../listing/use-store-actions' diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.ts b/src/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.ts index 47e16473fbb..64f352d4e0f 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.ts +++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-discard-confirmation.ts @@ -6,12 +6,12 @@ import { getConnectionId } from '@/lib/connection-context' import { basename } from '@/lib/path' import { bulkUnstageRuntimeGitPaths } from '@/runtime/runtime-git-working-tree-client' import { translate } from '@/i18n/i18n' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { getDiscardAllPaths, runDiscardAllForArea, type DiscardAllArea -} from '../../../../../../shared/source-control-discard-all-sequence' +} from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import { discardDeletesEntryFile } from './discard-confirmation' import { readIpcErrorMessage } from '@/lib/ipc-error' import { @@ -19,7 +19,7 @@ import { showSourceControlEntryFailureToast } from './source-control-entry-failure-toast' import type { PendingDiscardConfirmation } from './discard-dialog' -import type { SourceControlEntryGroups } from '../../../../../../shared/source-control-section-order' +import type { SourceControlEntryGroups } from '../../../../../../shared/source-control/listing/source-control-section-order' export function useSourceControlDiscardConfirmation({ activeRepoTarget, diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.ts b/src/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.ts index 2a67532bd17..036a32db750 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.ts +++ b/src/renderer/src/components/right-sidebar/source-control/commit/use-entry-mutations.ts @@ -1,8 +1,8 @@ import { useCallback, useRef } from 'react' import { requireGitOwnerTarget } from '../../worktree-git-owner-target' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' -import type { ConflictResolution } from '../../../../../../shared/source-control-entry-actions' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' +import type { ConflictResolution } from '../../../../../../shared/source-control/listing/source-control-entry-actions' import { editorFileHoldKey, pathMutationHoldKeys } from '@/components/editor/editor-autosave-holds' import { notifyEditorExternalFileChange, diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/active-open-file-keys.ts b/src/renderer/src/components/right-sidebar/source-control/listing/active-open-file-keys.ts index 7b114b9cdc3..0fece09f002 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/active-open-file-keys.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/active-open-file-keys.ts @@ -1,6 +1,6 @@ import type { DiffSource } from '@/store/slices/editor' import type { BranchCompareSnapshot } from '../../../../../../shared/editor-tab-view-types' -import type { GitBranchCompareSummary } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchCompareSummary } from '../../../../../../shared/git/diff/git-diff-compare-types' import { getCompareVersion } from '@/store/slices/editor/git/git-status-reconciliation' const EMPTY_OPEN_ROW_KEYS: ReadonlySet = new Set() 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 ea45b45f9c3..b13880b734d 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 @@ -5,7 +5,7 @@ import { basename, dirname, joinPath } from '@/lib/path' import { cn } from '@/lib/utils' import { WORKSPACE_FILE_PATH_MIME } from '@/lib/workspace-file-drag' import { writeWorkspaceFileDragSourceForWorkspace } from '@/lib/workspace-file-drag-source' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' import { DiffLineCounts } from './diff-line-counts' import { reviewNoteCountTitle } from './review-note-count-title' import { SourceControlEntryContextMenu } from './entry-context-menu' @@ -15,7 +15,8 @@ import { SOURCE_CONTROL_TREE_FILE_PADDING_PX, SOURCE_CONTROL_TREE_INDENT_PX } from './row-layout' -import { STATUS_COLORS, STATUS_LABELS } from '../../status-display' +import { STATUS_COLORS } from '../../status-display' +import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels' export function BranchEntryRow({ entry, diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/branch-section.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/branch-section.tsx index 3ff5211daac..ada1dfdb996 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/branch-section.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/branch-section.tsx @@ -4,9 +4,9 @@ import { translate } from '@/i18n/i18n' import type { GitBranchChangeEntry, GitBranchCompareSummary -} from '../../../../../../shared/git-diff-compare-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' import type { SourceControlViewMode } from '../../../../../../shared/ui-chrome-types' -import type { SourceControlTreeNode } from '../../../../../../shared/source-control-tree' +import type { SourceControlTreeNode } from '../../../../../../shared/source-control/listing/source-control-tree' import type { SourceControlRowOpenEvent } from './split-open' import { BranchEntryRow } from './branch-entry-row' import { SectionHeader } from './section-header' diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/conflict-badge.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/conflict-badge.tsx index 86229dfce23..9179cda14e9 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/conflict-badge.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/conflict-badge.tsx @@ -3,7 +3,7 @@ import { CircleCheck, TriangleAlert } from 'lucide-react' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' import { translate } from '@/i18n/i18n' import { cn } from '@/lib/utils' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { getLocalizedConflictKindLabel } from './conflict-label' function conflictBadgeAriaLabel(unresolved: boolean, kindLabel: string | null): string { diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/conflict-label.ts b/src/renderer/src/components/right-sidebar/source-control/listing/conflict-label.ts index 7d08a39ffcd..401242cae2f 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/conflict-label.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/conflict-label.ts @@ -1,6 +1,6 @@ -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { Check, FileCheck, FileX, type LucideIcon } from 'lucide-react' -import type { ConflictResolution } from '../../../../../../shared/source-control-entry-actions' +import type { ConflictResolution } from '../../../../../../shared/source-control/listing/source-control-entry-actions' import { translate } from '@/i18n/i18n' /** Localized short label for a merge-conflict kind, e.g. `both_modified` → "both modified". */ diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/conflict-status-cards.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/conflict-status-cards.tsx index fded204d048..88a99b9be45 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/conflict-status-cards.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/conflict-status-cards.tsx @@ -3,7 +3,7 @@ import { GitMerge, GitPullRequestArrow, RefreshCw, Sparkles, TriangleAlert } fro import { Button } from '@/components/ui/button' import { translate } from '@/i18n/i18n' import { cn } from '@/lib/utils' -import type { GitConflictOperation } from '../../../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types' export function ConflictSummaryCard({ conflictOperation, diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/content-status.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/content-status.tsx index fab3b306bbd..77f1fd9eff4 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/content-status.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/content-status.tsx @@ -1,7 +1,7 @@ import React from 'react' import { AlertTriangle } from 'lucide-react' import { translate } from '@/i18n/i18n' -import type { GitConflictOperation } from '../../../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types' import { ConflictSummaryCard, OperationBanner } from './conflict-status-cards' import { EmptyState } from './empty-state' import { StatusRetryButton } from './status-retry-button' diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/directory-action-paths.ts b/src/renderer/src/components/right-sidebar/source-control/listing/directory-action-paths.ts index a5d15f15a16..6c691e81f88 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/directory-action-paths.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/directory-action-paths.ts @@ -1,15 +1,15 @@ -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { getDiscardAllPaths, getUnstageAllPaths, isStageableStatusEntry -} from '../../../../../../shared/source-control-discard-all-sequence' +} from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import { collectSourceControlTreeFileEntries, type SourceControlTreeNode -} from '../../../../../../shared/source-control-tree' -import type { SourceControlSectionArea } from '../../../../../../shared/source-control-section-order' +} from '../../../../../../shared/source-control/listing/source-control-tree' +import type { SourceControlSectionArea } from '../../../../../../shared/source-control/listing/source-control-section-order' export type GitStatusSourceControlTreeNode = SourceControlTreeNode< GitStatusEntry, diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/entry-context-menu.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/entry-context-menu.tsx index 4093fde2644..a9cad5d68c8 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/entry-context-menu.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/entry-context-menu.tsx @@ -18,7 +18,7 @@ import { import { isRevealOrEditorOpenBlocked } from '@/lib/local-path-open-guard' import { runtimeEnvironmentIdOrLocalUnlessTwin } from '@/lib/worktree-runtime-owner' import { formatClipboardFilePath } from '@/lib/clipboard-file-path' -import type { ConflictResolution } from '../../../../../../shared/source-control-entry-actions' +import type { ConflictResolution } from '../../../../../../shared/source-control/listing/source-control-entry-actions' import { CONFLICT_RESOLUTION_ICONS, getLocalizedConflictResolutionLabel } from './conflict-label' import { OpenInContextSubmenu } from '@/components/right-sidebar/open-in-context-submenu' diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.test.ts b/src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.test.ts index 0c182d7ecf4..01e84bb4cce 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.test.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' import { createEditorStore } from '@/store/slices/editor-slice-test-harness' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { openUncommittedEntry } from './open-uncommitted-entry' vi.mock('sonner', () => ({ toast: { error: vi.fn() } })) diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.ts b/src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.ts index 99d45ea11fc..df4f9a486e1 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/open-uncommitted-entry.ts @@ -1,4 +1,4 @@ -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { AppState } from '@/store/types' import { detectLanguage } from '@/lib/language-detect' import { joinPath } from '@/lib/path' diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/operation-target.ts b/src/renderer/src/components/right-sidebar/source-control/listing/operation-target.ts index dbdebbb022d..6e08b1acbe7 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/operation-target.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/operation-target.ts @@ -1,7 +1,7 @@ import type { RuntimeGitContext } from '@/runtime/runtime-git-client-context' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' import { requireGitOwnerTarget } from '../../worktree-git-owner-target' -import type { GitConflictOperation } from '../../../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../../../../../shared/worktree/types' import type { ExecutionHostId } from '../../../../../../shared/execution-host' diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/section-file-list.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/section-file-list.tsx index 8819392808b..9a6ecef2863 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/section-file-list.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/section-file-list.tsx @@ -1,8 +1,8 @@ import React from 'react' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' -import type { ConflictResolution } from '../../../../../../shared/source-control-entry-actions' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' +import type { ConflictResolution } from '../../../../../../shared/source-control/listing/source-control-entry-actions' import type { SourceControlViewMode } from '../../../../../../shared/ui-chrome-types' -import type { DiscardAllArea } from '../../../../../../shared/source-control-discard-all-sequence' +import type { DiscardAllArea } from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import { getSubmoduleExpansionKey, isExpandableSubmoduleEntry, diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/submodule-expansion.ts b/src/renderer/src/components/right-sidebar/source-control/listing/submodule-expansion.ts index 24f020b3417..5b7b6e6c9ec 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/submodule-expansion.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/submodule-expansion.ts @@ -1,7 +1,7 @@ -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { basename } from '@/lib/path' -import type { SourceControlSectionArea } from '../../../../../../shared/source-control-section-order' -import type { SourceControlTreeNode } from '../../../../../../shared/source-control-tree' +import type { SourceControlSectionArea } from '../../../../../../shared/source-control/listing/source-control-section-order' +import type { SourceControlTreeNode } from '../../../../../../shared/source-control/listing/source-control-tree' import type { FlatEntry } from './use-selection' export type SubmoduleSectionTreeNode = SourceControlTreeNode< diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/tree-directory-rows.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/tree-directory-rows.tsx index a5b4150fa7c..d4188f66b3f 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/tree-directory-rows.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/tree-directory-rows.tsx @@ -3,7 +3,7 @@ import { ChevronDown, Minus, Plus, Trash, Undo2 } from 'lucide-react' import { FolderIcon } from '@/components/FileTypeIcon' import { cn } from '@/lib/utils' import { translate } from '@/i18n/i18n' -import type { DiscardAllArea } from '../../../../../../shared/source-control-discard-all-sequence' +import type { DiscardAllArea } from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import type { BranchSourceControlTreeDirectoryNode, SourceControlDirectoryActionPaths, 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 94cfc1deefd..144d9ec6481 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 @@ -7,7 +7,7 @@ import { WORKSPACE_FILE_PATH_MIME } from '@/lib/workspace-file-drag' import { writeWorkspaceFileDragSourceForWorkspace } from '@/lib/workspace-file-drag-source' import { translate } from '@/i18n/i18n' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { ActionButton } from './action-button' import { ConflictBadge } from './conflict-badge' import { @@ -24,8 +24,8 @@ import { canUnstageStatusEntry, getConflictResolutions, type ConflictResolution -} from '../../../../../../shared/source-control-entry-actions' -import { isSubmoduleWorktreeOnlyChange } from '../../../../../../shared/source-control-discard-all-sequence' +} from '../../../../../../shared/source-control/listing/source-control-entry-actions' +import { isSubmoduleWorktreeOnlyChange } from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import { toPermanentSourceControlRowOpenEvent, type SourceControlRowOpenEvent } from './split-open' import { getSourceControlRowHighlightClass, @@ -35,7 +35,8 @@ import { getSubmoduleWorktreeOnlyLabel, getSubmoduleWorktreeOnlyTooltip } from './row-layout' -import { STATUS_COLORS, STATUS_LABELS } from '../../status-display' +import { STATUS_COLORS } from '../../status-display' +import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels' export const UncommittedEntryRow = React.memo(function UncommittedEntryRow({ entryKey, diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-sections.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-sections.tsx index 6cc307b8300..c85296ea6a7 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-sections.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/uncommitted-sections.tsx @@ -2,15 +2,15 @@ import React from 'react' import { Minus, Plus, Undo2 } from 'lucide-react' import { Button } from '@/components/ui/button' import { translate } from '@/i18n/i18n' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' -import type { ConflictResolution } from '../../../../../../shared/source-control-entry-actions' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' +import type { ConflictResolution } from '../../../../../../shared/source-control/listing/source-control-entry-actions' import type { SourceControlViewMode } from '../../../../../../shared/ui-chrome-types' import { getDiscardAllPaths, getUnstageAllPaths, isStageableStatusEntry, type DiscardAllArea -} from '../../../../../../shared/source-control-discard-all-sequence' +} from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import { ActionButton } from './action-button' import { SectionHeader } from './section-header' import { SourceControlSectionFileList } from './section-file-list' @@ -20,7 +20,7 @@ import { type SourceControlDisplaySectionId, type SourceControlDisplaySectionArea, type SourceControlSectionViewAction -} from '../../../../../../shared/source-control-section-order' +} from '../../../../../../shared/source-control/listing/source-control-section-order' import type { RenderableSourceControlNode, RenderableSubmoduleListItem diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/use-file-projection-work.test.tsx b/src/renderer/src/components/right-sidebar/source-control/listing/use-file-projection-work.test.tsx index 61d06d3f5b6..541278ff43d 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/use-file-projection-work.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/listing/use-file-projection-work.test.tsx @@ -6,11 +6,11 @@ import { create } from 'zustand' import type { AppState } from '@/store' import { toBranchCompareSnapshot } from '@/store/slices/editor/git/git-status-reconciliation' import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { SourceControlViewMode } from '../../../../../../shared/ui-chrome-types' import type * as FileNameSortModule from '../../../../../../shared/file-name-sort' -import type * as SourceControlTreeModule from '../../../../../../shared/source-control-tree' +import type * as SourceControlTreeModule from '../../../../../../shared/source-control/listing/source-control-tree' import type * as SubmoduleExpansionModule from './submodule-expansion' import type * as FileProjectionModule from './use-file-projection' import type * as RowOpeningModule from './use-row-opening' @@ -44,26 +44,29 @@ vi.mock('../../../../../../shared/file-name-sort', async (importOriginal) => { } }) -vi.mock('../../../../../../shared/source-control-tree', async (importOriginal) => { - const actual = await importOriginal() - return { - ...actual, - buildGitStatusSourceControlTree: ( - ...args: Parameters - ) => { - counters.buildGitStatusSourceControlTree += 1 - return actual.buildGitStatusSourceControlTree(...args) - }, - buildSourceControlTree: ((...args: unknown[]) => { - counters.buildSourceControlTree += 1 - return (actual.buildSourceControlTree as (...a: unknown[]) => unknown)(...args) - }) as typeof actual.buildSourceControlTree, - flattenSourceControlTree: ((...args: unknown[]) => { - counters.flattenSourceControlTree += 1 - return (actual.flattenSourceControlTree as (...a: unknown[]) => unknown)(...args) - }) as typeof actual.flattenSourceControlTree +vi.mock( + '../../../../../../shared/source-control/listing/source-control-tree', + async (importOriginal) => { + const actual = await importOriginal() + return { + ...actual, + buildGitStatusSourceControlTree: ( + ...args: Parameters + ) => { + counters.buildGitStatusSourceControlTree += 1 + return actual.buildGitStatusSourceControlTree(...args) + }, + buildSourceControlTree: ((...args: unknown[]) => { + counters.buildSourceControlTree += 1 + return (actual.buildSourceControlTree as (...a: unknown[]) => unknown)(...args) + }) as typeof actual.buildSourceControlTree, + flattenSourceControlTree: ((...args: unknown[]) => { + counters.flattenSourceControlTree += 1 + return (actual.flattenSourceControlTree as (...a: unknown[]) => unknown)(...args) + }) as typeof actual.flattenSourceControlTree + } } -}) +) vi.mock('./submodule-expansion', async (importOriginal) => { const actual = await importOriginal() diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/use-file-projection.ts b/src/renderer/src/components/right-sidebar/source-control/listing/use-file-projection.ts index 89ffe73f721..16eadd0e4a2 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/use-file-projection.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/use-file-projection.ts @@ -1,6 +1,6 @@ import { useMemo } from 'react' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { SourceControlViewMode } from '../../../../../../shared/ui-chrome-types' import { compareFileNames } from '../../../../../../shared/file-name-sort' import { @@ -16,7 +16,7 @@ import { flattenSourceControlTree, namespaceSourceControlTreeDirectoryKeys, type SourceControlTreeNode -} from '../../../../../../shared/source-control-tree' +} from '../../../../../../shared/source-control/listing/source-control-tree' import { buildSourceControlDisplaySections, groupSourceControlEntries, @@ -24,7 +24,7 @@ import { type SourceControlDisplaySectionId, type SourceControlEntryGroups, type SourceControlDisplaySectionArea -} from '../../../../../../shared/source-control-section-order' +} from '../../../../../../shared/source-control/listing/source-control-section-order' import { collectListSelectionEntries, injectExpandedSubmoduleEntries, diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/use-row-opening.ts b/src/renderer/src/components/right-sidebar/source-control/listing/use-row-opening.ts index 544a8be370f..cad72a776b5 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/use-row-opening.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/use-row-opening.ts @@ -5,8 +5,8 @@ import { useAppStore } from '@/store' import type { GitBranchChangeEntry, GitBranchCompareSummary -} from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { buildActiveOpenFileSignature, buildActiveOpenRowKeys } from './active-open-file-keys' import type { FlatEntry } from './use-selection' import { diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/use-selection.ts b/src/renderer/src/components/right-sidebar/source-control/listing/use-selection.ts index 7dad5119a5d..9888f31b182 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/use-selection.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/use-selection.ts @@ -1,5 +1,5 @@ import { useState, useCallback, useEffect, useMemo, useRef, type RefObject } from 'react' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { SourceControlRowOpenEvent } from './split-open' function isMacPlatform(): boolean { diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts b/src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts index fcce8048f43..fc33b43bb04 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/use-submodule-status.ts @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from 'react' import { requireGitOwnerTarget } from '../../worktree-git-owner-target' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { isWslDistroNotRunningRefusal } from '../../../../../../shared/wsl-distro-not-running-refusal' import { getConnectionId } from '@/lib/connection-context' import { getRuntimeGitSubmoduleStatus } from '@/runtime/runtime-git-status-client' diff --git a/src/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.ts b/src/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.ts index 1be6a8897ee..d6c4c7100f9 100644 --- a/src/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.ts +++ b/src/renderer/src/components/right-sidebar/source-control/listing/use-worktree-context.ts @@ -7,8 +7,8 @@ import { useAppStore } from '@/store' import { useActiveWorktree, useRepoById, useWorktreeMap } from '@/store/selectors' import { getGitHubPRCacheKey } from '../../../../../../shared/github/github-cache-key' import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-identity' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { isFolderRepo } from '../../../../../../shared/repo-kind' import { getRepoExecutionHostId } from '../../../../../../shared/execution-host' import { selectReviewCacheData, selectReviewCacheEntry } from '../../review-cache-entry-selection' 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 a9e8e6d17a6..9e95aca9d83 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 @@ -6,9 +6,9 @@ import { useAppStore } from '@/store' import type { GitBranchChangeEntry, GitBranchCompareSummary -} from '../../../../../../shared/git-diff-compare-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' import type { DiffComment } from '../../../../../../shared/diff-comment-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { cancelSourceControlEditorRevealFrames, requestSourceControlEditorRevealFrame diff --git a/src/renderer/src/components/right-sidebar/source-control/panel/branch-context-row.tsx b/src/renderer/src/components/right-sidebar/source-control/panel/branch-context-row.tsx index 0fc1fcd0dd9..84d064c4cb2 100644 --- a/src/renderer/src/components/right-sidebar/source-control/panel/branch-context-row.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/panel/branch-context-row.tsx @@ -1,7 +1,7 @@ import React from 'react' import { ExternalLink, Loader2, RefreshCw } from 'lucide-react' -import type { GitBranchCompareSummary } from '../../../../../../shared/git-diff-compare-types' -import type { GitBranchLineTotal } from '../../../../../../shared/git-status-types' +import type { GitBranchCompareSummary } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitBranchLineTotal } from '../../../../../../shared/git/status/git-status-types' import { cn } from '@/lib/utils' import { translate } from '@/i18n/i18n' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' diff --git a/src/renderer/src/components/right-sidebar/source-control/panel/branch-context-stats.ts b/src/renderer/src/components/right-sidebar/source-control/panel/branch-context-stats.ts index 2a5b58cb6a7..dbd172dbc6a 100644 --- a/src/renderer/src/components/right-sidebar/source-control/panel/branch-context-stats.ts +++ b/src/renderer/src/components/right-sidebar/source-control/panel/branch-context-stats.ts @@ -1,4 +1,4 @@ -import type { GitBranchCompareSummary } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchCompareSummary } from '../../../../../../shared/git/diff/git-diff-compare-types' import type { WorktreeGitIdentityDisplay } from '../../../../../../shared/worktree/git-identity-display' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/right-sidebar/source-control/panel/branch-line-total-chip.tsx b/src/renderer/src/components/right-sidebar/source-control/panel/branch-line-total-chip.tsx index 4205d5651b0..9d1b87ac587 100644 --- a/src/renderer/src/components/right-sidebar/source-control/panel/branch-line-total-chip.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/panel/branch-line-total-chip.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react' -import type { GitBranchLineTotal } from '../../../../../../shared/git-status-types' +import type { GitBranchLineTotal } from '../../../../../../shared/git/status/git-status-types' import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card' import { getIntlLocale, translate } from '@/i18n/i18n' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' diff --git a/src/renderer/src/components/right-sidebar/source-control/panel/header-toolbar.tsx b/src/renderer/src/components/right-sidebar/source-control/panel/header-toolbar.tsx index c720f3011e3..a59d3dd66fb 100644 --- a/src/renderer/src/components/right-sidebar/source-control/panel/header-toolbar.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/panel/header-toolbar.tsx @@ -1,10 +1,10 @@ import { ImeInput } from '@/lib/ime-text-field' import React, { useCallback, useEffect, useRef } from 'react' import { GitPullRequestArrow, Loader2, Search, X } from 'lucide-react' -import type { GitBranchCompareSummary } from '../../../../../../shared/git-diff-compare-types' -import type { GitBranchLineTotal } from '../../../../../../shared/git-status-types' +import type { GitBranchCompareSummary } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitBranchLineTotal } from '../../../../../../shared/git/status/git-status-types' import type { SourceControlViewMode } from '../../../../../../shared/ui-chrome-types' -import type { HostedReviewInfo } from '../../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PrimaryAction } from '../../source-control-primary-action' import { Button } from '@/components/ui/button' import { cn } from '@/lib/utils' diff --git a/src/renderer/src/components/right-sidebar/source-control/panel/panel-dialogs.tsx b/src/renderer/src/components/right-sidebar/source-control/panel/panel-dialogs.tsx index 095f7ee6f25..c132e4a58f9 100644 --- a/src/renderer/src/components/right-sidebar/source-control/panel/panel-dialogs.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/panel/panel-dialogs.tsx @@ -1,4 +1,4 @@ -import { readSourceControlLaunchRecipeAgentId } from '../../../../../../shared/source-control-launch-agent-selection' +import { readSourceControlLaunchRecipeAgentId } from '../../../../../../shared/source-control/ai/source-control-launch-agent-selection' import { SourceControlDialogLayer } from './dialog-layer' import type { SourceControlPanelReadyProps } from './panel-props' diff --git a/src/renderer/src/components/right-sidebar/source-control/panel/use-panel-view-state.ts b/src/renderer/src/components/right-sidebar/source-control/panel/use-panel-view-state.ts index a3987f16d52..8425ba138c9 100644 --- a/src/renderer/src/components/right-sidebar/source-control/panel/use-panel-view-state.ts +++ b/src/renderer/src/components/right-sidebar/source-control/panel/use-panel-view-state.ts @@ -1,6 +1,6 @@ import { useCallback, useMemo, useRef, useState } from 'react' import { BoundedMap } from '../../../../../../shared/bounded-map' -import { resolveSourceControlGroupOrder } from '../../../../../../shared/source-control-section-order' +import { resolveSourceControlGroupOrder } from '../../../../../../shared/source-control/listing/source-control-section-order' import { getNextSourceControlViewMode } from './header-toolbar' import { normalizeSourceControlViewMode } from '../commit/commit-drafts' import type { SourceControlStoreActions } from '../listing/use-store-actions' diff --git a/src/renderer/src/components/right-sidebar/source-control/panel/use-worktree-operation-state.ts b/src/renderer/src/components/right-sidebar/source-control/panel/use-worktree-operation-state.ts index 07e64d2079e..b365a842ee3 100644 --- a/src/renderer/src/components/right-sidebar/source-control/panel/use-worktree-operation-state.ts +++ b/src/renderer/src/components/right-sidebar/source-control/panel/use-worktree-operation-state.ts @@ -3,7 +3,7 @@ import { loadSessionCommitDrafts, saveSessionCommitDrafts } from '@/lib/source-control-commit-draft-session' -import type { GitConflictOperation } from '../../../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types' import type { SourceControlActionError } from '../sync/action-error' import { createPrIntentCurrentTargetConflictsWithToken, diff --git a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-branch-prep.ts b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-branch-prep.ts index 3c902faaf0c..f341173cb05 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-branch-prep.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-branch-prep.ts @@ -1,5 +1,5 @@ import { translate } from '@/i18n/i18n' -import { isBehindOnlyUpstream } from '../../../../../../shared/git-upstream-status' +import { isBehindOnlyUpstream } from '../../../../../../shared/git/remotes/git-upstream-status' import { readCommitDraftForWorktree, writeCommitDraftForWorktree } from '../commit/commit-drafts' import { getCreatePrIntentCommitFailureNoticeMessage, diff --git a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-flow.ts b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-flow.ts index c77d123a93c..1bdcad3bed7 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-flow.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-flow.ts @@ -2,14 +2,14 @@ import type { WorktreeGitCopy } from '@/lib/worktree-git-copy' import type { HostedReviewCreationEligibility, HostedReviewProvider -} from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { normalizeHostedReviewBaseRef, normalizeHostedReviewHeadRef -} from '../../../../../../shared/hosted-review-refs' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' -import { summarizeCommitFailure } from '../commit/commit-failure-summary' -import { getStageAllPaths } from '../../../../../../shared/source-control-discard-all-sequence' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-refs' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' +import { summarizeCommitFailure } from '../../../../../../shared/source-control/recovery/source-control-commit-failure' +import { getStageAllPaths } from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' export type CreatePrIntentRunToken = { repoId: string diff --git a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-review-step.ts b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-review-step.ts index facb1244c6f..7dfa84cd477 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-review-step.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-review-step.ts @@ -1,6 +1,6 @@ import { translate } from '@/i18n/i18n' import { resolveBlockedCreateReviewNoticeMessage } from '../../source-control-create-review-blocked-action' -import { resolveCreatePrIntentRemoteStep } from '../../../../../../shared/source-control-create-review-intent' +import { resolveCreatePrIntentRemoteStep } from '../../../../../../shared/source-control/decisions/source-control-create-review-intent' import { shouldAttemptCreateHostedReviewForIntent, type CreatePrIntentRunToken diff --git a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-run-snapshot.ts b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-run-snapshot.ts index f6d780d2236..abd6a3b5233 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-run-snapshot.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-run-snapshot.ts @@ -1,6 +1,6 @@ import { bulkStageRuntimeGitPaths } from '@/runtime/runtime-git-working-tree-client' import { operationGitContext } from '../listing/operation-target' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import { createPrIntentGitStatusMatchesToken, getCreatePrIntentStagePaths, diff --git a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-state.ts b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-state.ts index ef9bb2e9f65..e54f86e45c0 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-state.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/create-pr-intent-state.ts @@ -1,7 +1,4 @@ import type { PrimaryAction } from '../../source-control-primary-action-types' -import { resolveCreateReviewIntentEligibility } from '../../../../../../shared/source-control-create-review-intent' - -export const resolveCreatePrIntentEligibility = resolveCreateReviewIntentEligibility export function resolveVisibleCreatePrHeaderAction({ createPrHeaderAction diff --git a/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-creation-eligibility-snapshot.ts b/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-creation-eligibility-snapshot.ts index 1686a7460e5..f3965ea3c69 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-creation-eligibility-snapshot.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-creation-eligibility-snapshot.ts @@ -1,9 +1,9 @@ -import { supportsHostedReviewCreation } from '../../../../../../shared/hosted-review-creation-providers' -import { normalizeHostedReviewBaseRef } from '../../../../../../shared/hosted-review-refs' +import { supportsHostedReviewCreation } from '../../../../../../shared/source-control/hosted-review/hosted-review-creation-providers' +import { normalizeHostedReviewBaseRef } from '../../../../../../shared/source-control/hosted-review/hosted-review-refs' import type { HostedReviewCreationEligibility, HostedReviewProvider -} from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' type UnavailableHostedReviewStatus = { branch: string | null | undefined diff --git a/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-creation-state.ts b/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-creation-state.ts index 343b3b4e641..48e7dfc2c88 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-creation-state.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-creation-state.ts @@ -1,7 +1,7 @@ import type { HostedReviewCreationEligibility, HostedReviewProvider -} from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' // Key every state by repo/worktree/branch to discard late responses after navigation. export type HostedReviewCreationState = { diff --git a/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-header-chrome.tsx b/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-header-chrome.tsx index 2d56057b3fa..ac137a6b5a2 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-header-chrome.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/review/hosted-review-header-chrome.tsx @@ -1,6 +1,6 @@ import React from 'react' import { GitMerge, GitPullRequestClosed, GitPullRequestDraft } from 'lucide-react' -import type { HostedReviewInfo } from '../../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { cn } from '@/lib/utils' import { PullRequestIcon } from '../../checks-panel/check-presentation' import { openAppHttpLinkFromAnchor } from '@/lib/app-http-link-open' diff --git a/src/renderer/src/components/right-sidebar/source-control/review/manual-review-url.ts b/src/renderer/src/components/right-sidebar/source-control/review/manual-review-url.ts index 442f23d1ec9..0007e822ba8 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/manual-review-url.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/manual-review-url.ts @@ -1,4 +1,4 @@ -import type { HostedReviewProvider } from '../../../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { GitPushTarget } from '../../../../../../shared/worktree/types' import { branchFromRef, diff --git a/src/renderer/src/components/right-sidebar/source-control/review/primary-create-pr-intent-action.ts b/src/renderer/src/components/right-sidebar/source-control/review/primary-create-pr-intent-action.ts index b78a9ac267f..4d1806deda4 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/primary-create-pr-intent-action.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/primary-create-pr-intent-action.ts @@ -3,15 +3,15 @@ import { localizedHostedReviewCopy, resolveSupportedHostedReviewCopyProvider } from '@/i18n/hosted-review-localized-copy' -import { supportsHostedReviewCreation } from '../../../../../../shared/hosted-review-creation-providers' +import { supportsHostedReviewCreation } from '../../../../../../shared/source-control/hosted-review/hosted-review-creation-providers' import type { HostedReviewCreationEligibility, HostedReviewInfo, HostedReviewProvider -} from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PrimaryAction, PrimaryActionInputs } from '../../source-control-primary-action-types' import { resolveCrossWorktreeWaitingAction } from '../../source-control-primary-action' -import { resolveCreatePrIntentEligibility } from './create-pr-intent-state' +import { resolveCreateReviewIntentEligibility as resolveCreatePrIntentEligibility } from '../../../../../../shared/source-control/decisions/source-control-create-review-intent' import { canClickBlockedCreateReviewReason, resolveBlockedCreateReviewNoticeMessage diff --git a/src/renderer/src/components/right-sidebar/source-control/review/remote-repo.ts b/src/renderer/src/components/right-sidebar/source-control/review/remote-repo.ts index 888ebad0df5..93af10105fe 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/remote-repo.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/remote-repo.ts @@ -1,5 +1,5 @@ -import type { HostedReviewProvider } from '../../../../../../shared/hosted-review' -import { normalizeForgeWebHost } from '../../../../../../shared/git-remote-host-alias' +import type { HostedReviewProvider } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { normalizeForgeWebHost } from '../../../../../../shared/git/remotes/git-remote-host-alias' export type ManualReviewProvider = Exclude diff --git a/src/renderer/src/components/right-sidebar/source-control/review/suppressed-github-pr.ts b/src/renderer/src/components/right-sidebar/source-control/review/suppressed-github-pr.ts index fe80c748290..7f317657d11 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/suppressed-github-pr.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/suppressed-github-pr.ts @@ -1,9 +1,9 @@ -import { isPositiveHostedReviewNumber } from '../../../../../../shared/hosted-review' +import { isPositiveHostedReviewNumber } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { HostedReviewCreationEligibility, HostedReviewInfo, HostedReviewProvider -} from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Worktree } from '../../../../../../shared/worktree/types' type SourceControlSuppressionWorktree = Pick< diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-action-dispatch.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-action-dispatch.ts index d258081f502..e14810066c3 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-action-dispatch.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-action-dispatch.ts @@ -1,7 +1,7 @@ import type React from 'react' import { useCallback } from 'react' -import { shouldForcePushWithLeaseForUpstream } from '../../../../../../shared/git-upstream-status' -import type { DropdownActionKind } from '../../../../../../shared/source-control-dropdown-item-types' +import { shouldForcePushWithLeaseForUpstream } from '../../../../../../shared/git/remotes/git-upstream-status' +import type { DropdownActionKind } from '../../../../../../shared/source-control/dropdown/source-control-dropdown-item-types' import type { SourceControlCommitAction } from '../commit/use-commit-action' import { handleSourceControlCommitShortcut } from '../commit/commit-shortcut' import type { SourceControlFileListing } from '../listing/use-file-listing' diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-action-model.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-action-model.ts index 315004a9470..ec52ca64499 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-action-model.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-action-model.ts @@ -1,13 +1,13 @@ import { useMemo } from 'react' import { translate } from '@/i18n/i18n' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' -import type { GitBranchCompareSummary } from '../../../../../../shared/git-diff-compare-types' -import { isStageableStatusEntry } from '../../../../../../shared/source-control-discard-all-sequence' +import type { GitBranchCompareSummary } from '../../../../../../shared/git/diff/git-diff-compare-types' +import { isStageableStatusEntry } from '../../../../../../shared/source-control/listing/source-control-discard-all-sequence' import { resolveDropdownItems } from '../../source-control-dropdown-items' import { resolveCommitAreaPrimaryAction } from '../../source-control-primary-action' import { resolveCreatePrHeaderAction } from './primary-create-pr-intent-action' import { resolveVisibleCreatePrHeaderAction } from './create-pr-intent-state' -import type { SourceControlEntryGroups } from '../../../../../../shared/source-control-section-order' +import type { SourceControlEntryGroups } from '../../../../../../shared/source-control/listing/source-control-section-order' type PrimaryInput = Parameters[0] type HeaderInput = Parameters[0] diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-commit-message.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-commit-message.ts index f1e53edfe71..859b1d38e4b 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-commit-message.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-commit-message.ts @@ -2,7 +2,7 @@ import { useCallback } from 'react' import { operationGitContext } from '../listing/operation-target' import { generateRuntimeCommitMessage } from '@/runtime/runtime-git-generation-client' import { useAppStore } from '@/store' -import { isCustomAgentId } from '../../../../../../shared/commit-message-agent-spec' +import { isCustomAgentId } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' import type { CreatePrIntentRunToken } from './create-pr-intent-flow' import { hasConfiguredCommitMessageGenerationDefaults } from '../ai/text-generation-defaults' import type { SourceControlAi } from '../ai/use-ai' diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-jira-title.test.tsx b/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-jira-title.test.tsx index 83c4f169c1c..f763948181b 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-jira-title.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-jira-title.test.tsx @@ -9,8 +9,8 @@ import { getDefaultSettings } from '../../../../../../shared/constants' import { getDefaultSourceControlAiSettings, DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS -} from '../../../../../../shared/source-control-ai-settings' -import type { HostedReviewCreationEligibility } from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import type { HostedReviewCreationEligibility } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { useSourceControlCreatePrIntentReview } from './use-create-pr-intent-review' const runtime = vi.hoisted(() => ({ generate: vi.fn() })) diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-probes.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-probes.ts index 699a934d42f..8df505ca9c3 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-probes.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-probes.ts @@ -2,7 +2,7 @@ import { useCallback } from 'react' import { requireGitOwnerTarget } from '../../worktree-git-owner-target' import { getConnectionId } from '@/lib/connection-context' import { getRuntimeGitBranchCompare } from '@/runtime/runtime-git-diff-client' -import type { HostedReviewCreationEligibility } from '../../../../../../shared/hosted-review' +import type { HostedReviewCreationEligibility } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { refreshGitStatusForWorktreeStrict } from '../../git-status-refresh' import type { CreatePrIntentRunToken } from './create-pr-intent-flow' import { buildCreatePrIntentUnavailableEligibility } from './hosted-review-creation-eligibility-snapshot' diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-review.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-review.ts index 7648794619d..66517202ac4 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-review.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-create-pr-intent-review.ts @@ -8,10 +8,10 @@ import { useAppStore } from '@/store' import { operationGitContext } from '../listing/operation-target' import { translate } from '@/i18n/i18n' import { generateRuntimePullRequestFields } from '@/runtime/runtime-git-generation-client' -import type { HostedReviewCreationEligibility } from '../../../../../../shared/hosted-review' +import type { HostedReviewCreationEligibility } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { localizedCreateFailure } from '../../hosted-review-create-failure-copy' -import { normalizeHostedReviewHeadRef } from '../../../../../../shared/hosted-review-refs' -import { resolveCreateReviewSeedText } from '../../../../../../shared/hosted-review-create-seed' +import { normalizeHostedReviewHeadRef } from '../../../../../../shared/source-control/hosted-review/hosted-review-refs' +import { resolveCreateReviewSeedText } from '../../../../../../shared/source-control/hosted-review/hosted-review-create-seed' import { createPrIntentRunTokenMatches, resolveCreatePrIntentGeneratedReviewFields, diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.test.tsx b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.test.tsx index a66211d13d1..6cf7c6a9e39 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.test.tsx @@ -19,11 +19,11 @@ import { getDefaultSettings } from '../../../../../../shared/constants' import type { CreateHostedReviewResult, HostedReviewCreationEligibility -} from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS, getDefaultSourceControlAiSettings -} from '../../../../../../shared/source-control-ai-settings' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { useSourceControlHostedReviewCreation } from './use-hosted-review-creation' import { useSourceControlHostedReviewEligibility } from './use-hosted-review-eligibility' import { useSourceControlHostedReviewState } from './use-hosted-review-state' diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.ts index c8d832f9d55..e7e78653ba2 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-creation.ts @@ -1,7 +1,7 @@ import { useCallback } from 'react' import { toast } from 'sonner' import { translate } from '@/i18n/i18n' -import { normalizeHostedReviewHeadRef } from '../../../../../../shared/hosted-review-refs' +import { normalizeHostedReviewHeadRef } from '../../../../../../shared/source-control/hosted-review/hosted-review-refs' import { resolveBlockedCreateReviewNoticeMessage } from '../../source-control-create-review-blocked-action' import { localizedCreateFailure } from '../../hosted-review-create-failure-copy' import type { SourceControlAi } from '../ai/use-ai' diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-provider-hint.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-provider-hint.ts index 7edda6cb560..4dcf764db94 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-provider-hint.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-provider-hint.ts @@ -2,7 +2,7 @@ import { useEffect, useMemo } from 'react' import type { HostedReviewCreationEligibility, HostedReviewInfo -} from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { buildLoadingHostedReviewCreationEligibility, resolveHostedReviewCreationProviderForTarget diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-state.test.tsx b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-state.test.tsx index 718a2e7be24..4a5bdfb6d26 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-state.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-state.test.tsx @@ -2,7 +2,7 @@ import { renderHook } from '@testing-library/react' import { describe, expect, it } from 'vitest' -import type { HostedReviewInfo } from '../../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRInfo } from '../../../../../../shared/github/pull-request-types' import { useSourceControlHostedReviewState } from './use-hosted-review-state' import { useSourceControlHostedReviewProviderHint } from './use-hosted-review-provider-hint' diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-state.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-state.ts index 82c30a31e59..9e656d7df98 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-state.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-hosted-review-state.ts @@ -1,8 +1,8 @@ import { useMemo, useRef, useState } from 'react' import { localizedHostedReviewCopy } from '@/i18n/hosted-review-localized-copy' -import type { HostedReviewInfo } from '../../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { isGitHubPRSuppressed } from '../../../../../../shared/worktree/github-pr-suppression' -import { resolveHostedReviewCreationProvider } from '../../../../../../shared/hosted-review-creation-providers' +import { resolveHostedReviewCreationProvider } from '../../../../../../shared/source-control/hosted-review/hosted-review-creation-providers' import { isStaleMergedGitHubReviewForHead } from '@/store/slices/hosted-review-cache-state' import type { SourceControlWorktreeContext } from '../listing/use-worktree-context' import type { diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-linked-reviews.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-linked-reviews.ts index a3abee5f649..79fe4e75be0 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-linked-reviews.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-linked-reviews.ts @@ -2,12 +2,12 @@ import { useMemo } from 'react' import type { HostedReviewCreationEligibility, HostedReviewInfo -} from '../../../../../../shared/hosted-review' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { hasPositiveHostedReviewNumberLink, hasResolvableHostedReviewPushTargetLink, resolveHostedReviewPushTargetForActions -} from '../../../../../../shared/hosted-review-push-target' +} from '../../../../../../shared/source-control/hosted-review/hosted-review-push-target' import { buildSourceControlManualReviewUrlFromContext } from './manual-review-url' import type { SourceControlWorktreeContext } from '../listing/use-worktree-context' diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.test.tsx b/src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.test.tsx index 0d3e8610d0d..55998941f8c 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.test.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.test.tsx @@ -6,7 +6,7 @@ import type * as RuntimeGitGenerationClient from '@/runtime/runtime-git-generati import type { RuntimeGeneratePullRequestFieldsResult } from '@/runtime/runtime-git-client-context' import { useAppStore } from '@/store' import { makeRepo, makeWorktree } from '../../../worktree-jump/worktree-jump-palette-test-fixtures' -import { DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS } from '../../../../../../shared/source-control-ai-settings' +import { DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' const runtime = vi.hoisted(() => ({ cancel: vi.fn().mockResolvedValue(undefined), diff --git a/src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.ts b/src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.ts index 3bd863bb6e8..0e803b62616 100644 --- a/src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.ts +++ b/src/renderer/src/components/right-sidebar/source-control/review/use-pull-request-generation.ts @@ -24,7 +24,7 @@ import { type PullRequestGenerationFields } from '@/store/slices/pull-request-generation' import type { PullRequestGenerationOptions } from '@/store/slices/pull-request-generation-auto-submit' -import type { HostedReviewProvider } from '../../../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { SourceControlAi } from '../ai/use-ai' import { stripBaseRef } from '../../create-pull-request-base-ref-normalization' import type { SourceControlStoreActions } from '../listing/use-store-actions' diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/action-error.ts b/src/renderer/src/components/right-sidebar/source-control/sync/action-error.ts index 2aad59eab00..da6637b99db 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/action-error.ts +++ b/src/renderer/src/components/right-sidebar/source-control/sync/action-error.ts @@ -1,5 +1,5 @@ import type { RemoteOpKind } from '../../source-control-primary-action' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' export type AbortActionErrorKind = 'abort_merge' | 'abort_rebase' export type SourceControlActionErrorKind = RemoteOpKind | AbortActionErrorKind diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/compare-summary.tsx b/src/renderer/src/components/right-sidebar/source-control/sync/compare-summary.tsx index f966cfdf43d..103df7bbcf6 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/compare-summary.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/sync/compare-summary.tsx @@ -3,7 +3,7 @@ import { ArrowUp, RefreshCw, Settings2, type LucideIcon } from 'lucide-react' import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { translate } from '@/i18n/i18n' -import type { GitBranchCompareSummary } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchCompareSummary } from '../../../../../../shared/git/diff/git-diff-compare-types' export type BranchCompareStatusHeadSnapshot = { baseRef: string diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-context-menu.tsx b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-context-menu.tsx index 98d3d15cbb0..375215bfe1d 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-context-menu.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-commit-context-menu.tsx @@ -6,7 +6,7 @@ import { ContextMenuSeparator } from '@/components/ui/context-menu' import { translate } from '@/i18n/i18n' -import type { GitHistoryItem } from '../../../../../../shared/git-history' +import type { GitHistoryItem } from '../../../../../../shared/git/history/git-history-types' import { useAppStore } from '@/store' import { getClientCreationActionPolicy } from '@/lib/client-creation-action-policy' 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 ea73dd9748f..b8278dc101c 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,8 @@ import { createElement } from 'react' import type React from 'react' import { ArrowUpRight, RefreshCw } from 'lucide-react' -import { STATUS_COLORS, STATUS_LABELS } from '../../status-display' +import { STATUS_COLORS } from '../../status-display' +import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels' import { toPermanentSourceControlRowOpenEvent, toSourceControlRowOpenEvent, @@ -11,8 +12,8 @@ import { FileTypeIcon } from '@/components/FileTypeIcon' import { basename, dirname } from '@/lib/path' import { translate } from '@/i18n/i18n' import { formatGitHistoryTimestamp } from './git-history-format' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' -import type { GitFileStatus } from '../../../../../../shared/git-status-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitFileStatus } from '../../../../../../shared/git/status/git-status-types' export type GitHistoryCommitFilesState = | { status: 'loading' } diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-graph-svg.tsx b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-graph-svg.tsx index 395cc68cbe9..26756460c47 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-graph-svg.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-graph-svg.tsx @@ -1,11 +1,11 @@ import React from 'react' -import type { GitHistoryGraphColorId } from '../../../../../../shared/git-history' +import type { GitHistoryGraphColorId } from '../../../../../../shared/git/history/git-history-types' import { getGitHistoryItemColor, getGitHistoryItemLaneIndex, getGitHistoryMergeParentLaneIndex, type GitHistoryItemViewModel -} from '../../../../../../shared/git-history-graph' +} from '../../../../../../shared/git/history/git-history-graph' const SWIMLANE_HEIGHT = 24 const SWIMLANE_WIDTH = 11 diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-panel.tsx b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-panel.tsx index f7472a1e4c8..cd2071398d4 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-panel.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-panel.tsx @@ -4,12 +4,15 @@ import { Button } from '@/components/ui/button' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { cn } from '@/lib/utils' import { ContextMenu, ContextMenuTrigger } from '@/components/ui/context-menu' -import type { GitHistoryItem, GitHistoryResult } from '../../../../../../shared/git-history' -import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types' +import type { + GitHistoryItem, + GitHistoryResult +} from '../../../../../../shared/git/history/git-history-types' +import type { GitBranchChangeEntry } from '../../../../../../shared/git/diff/git-diff-compare-types' import { buildDefaultGitHistoryColorMap, buildGitHistoryViewModels -} from '../../../../../../shared/git-history-graph' +} from '../../../../../../shared/git/history/git-history-graph' import { GitHistoryRow } from './git-history-row' import { GitHistoryCommitFiles, type GitHistoryCommitFilesState } from './git-history-commit-files' import { diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-row.tsx b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-row.tsx index f4eb08d1020..27fc9bb051d 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/git-history-row.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/sync/git-history-row.tsx @@ -2,10 +2,13 @@ import React from 'react' import { ChevronDown } from 'lucide-react' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { cn } from '@/lib/utils' -import type { GitHistoryItem, GitHistoryItemRef } from '../../../../../../shared/git-history' -import type { GitHistoryItemViewModel } from '../../../../../../shared/git-history-graph' +import type { + GitHistoryItem, + GitHistoryItemRef +} from '../../../../../../shared/git/history/git-history-types' +import type { GitHistoryItemViewModel } from '../../../../../../shared/git/history/git-history-graph' import { GitHistoryGraphSvg, graphColor } from './git-history-graph-svg' -import { dedupeRemoteTrackingRefs } from '../../../../../../shared/git-history-ref-display' +import { dedupeRemoteTrackingRefs } from '../../../../../../shared/git/history/git-history-ref-display' import { translate } from '@/i18n/i18n' function GitHistoryRefBadge({ itemRef }: { itemRef: GitHistoryItemRef }): React.JSX.Element { diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/push-recovery.ts b/src/renderer/src/components/right-sidebar/source-control/sync/push-recovery.ts index 682c7fafe86..c9be859b4a2 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/push-recovery.ts +++ b/src/renderer/src/components/right-sidebar/source-control/sync/push-recovery.ts @@ -4,7 +4,7 @@ import { isPushHookFailure, sanitizePushFailureDetails, summarizePushFailure -} from '../../../../../../shared/source-control-push-failure' +} from '../../../../../../shared/source-control/recovery/source-control-push-failure' import type { SourceControlActionError } from './action-error' export type SourceControlPushRecovery = { 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 a1230b0311b..3d6fd34d22f 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 @@ -2,7 +2,7 @@ import { isSyncPushStageError, resolveRemoteOperationErrorMessage } from '@/lib/source-control-remote-error' -import type { GitConflictOperation } from '../../../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types' import type { SourceControlActionError } from './action-error' import type { RemoteOpKind } from '../../source-control-primary-action' diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-base-refs.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-base-refs.ts index f37f63acbdb..7348123ac99 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/use-base-refs.ts +++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-base-refs.ts @@ -1,10 +1,10 @@ -import type { HostedReviewInfo } from '../../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { SourceControlWorktreeContext } from '../listing/use-worktree-context' import { resolveSourceControlBaseRef, resolveSourceControlCompareBaseRef, resolveSourceControlPickerBaseRef -} from '../../../../../../shared/source-control-base-ref-resolution' +} from '../../../../../../shared/source-control/decisions/source-control-base-ref-resolution' import { useSourceControlBaseRefDefault } from './use-base-ref-default' export function useSourceControlBaseRefs({ diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare-refresh-triggers.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare-refresh-triggers.ts index 24b48bd29e5..bae10e6ccc9 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare-refresh-triggers.ts +++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare-refresh-triggers.ts @@ -1,5 +1,5 @@ import { useEffect, useRef, type MutableRefObject } from 'react' -import type { GitUpstreamStatus } from '../../../../../../shared/git-status-types' +import type { GitUpstreamStatus } from '../../../../../../shared/git/status/git-status-types' import { shouldRefreshBranchCompareForRemoteStatus, shouldRefreshBranchCompareForStatusHead, diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.ts index 9aa7dc5a5dd..8f2ed2a67b7 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.ts +++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-branch-compare.ts @@ -6,8 +6,8 @@ import { getConnectionId } from '@/lib/connection-context' import { getRuntimeGitBranchCompare } from '@/runtime/runtime-git-diff-client' import { useAppStore } from '@/store' import { createLoadingBranchCompareSummary } from '@/store/slices/editor/git/branch-compare-state' -import type { GitUpstreamStatus } from '../../../../../../shared/git-status-types' -import { shouldClearBranchCompareForMissingBase } from '../../../../../../shared/source-control-base-ref-resolution' +import type { GitUpstreamStatus } from '../../../../../../shared/git/status/git-status-types' +import { shouldClearBranchCompareForMissingBase } from '../../../../../../shared/source-control/decisions/source-control-base-ref-resolution' import { slowTaskRequiredIdleMs } from '../../coalesced-poll-runner' import { useBranchCompareRefreshTriggers } from './use-branch-compare-refresh-triggers' diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-conflict-abort.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-conflict-abort.ts index fc2ff6d404e..7cedfd5bd60 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/use-conflict-abort.ts +++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-conflict-abort.ts @@ -5,7 +5,7 @@ import { useConfirmationDialog } from '@/components/confirmation-dialog-context' import { translate } from '@/i18n/i18n' import { getConnectionId } from '@/lib/connection-context' import { abortRuntimeGitMerge, abortRuntimeGitRebase } from '@/runtime/runtime-git-sync-client' -import type { GitConflictOperation } from '../../../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types' import type { AbortConflictOperation } from '../listing/operation-target' import type { SourceControlWorktreeContext } from '../listing/use-worktree-context' import type { SourceControlWorktreeOperationState } from '../panel/use-worktree-operation-state' diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts index d480d1aa5af..dc9053316ea 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts +++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-git-history-commit-actions.ts @@ -12,11 +12,11 @@ import { newAgentLaunchRequestId } from '@/lib/agent-launch-request-id' import { resolveDefaultAgentForWorktreeNewTab } from '@/lib/agent-tab-shortcuts' import { getDetectionTargetIdentityForWorktree } from '@/lib/agent-detection-target-inventory' import { translate } from '@/i18n/i18n' -import type { GitHistoryItem } from '../../../../../../shared/git-history' +import type { GitHistoryItem } from '../../../../../../shared/git/history/git-history-types' import type { GitBranchChangeEntry, GitCommitCompareResult -} from '../../../../../../shared/git-diff-compare-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' import { shouldOpenSourceControlRowAsPreview, type SourceControlRowOpenEvent diff --git a/src/renderer/src/components/right-sidebar/source-control/sync/use-remote-action-runner.ts b/src/renderer/src/components/right-sidebar/source-control/sync/use-remote-action-runner.ts index a3a4585d246..ebf48a8ef10 100644 --- a/src/renderer/src/components/right-sidebar/source-control/sync/use-remote-action-runner.ts +++ b/src/renderer/src/components/right-sidebar/source-control/sync/use-remote-action-runner.ts @@ -1,7 +1,7 @@ import { useCallback } from 'react' import { getConnectionId } from '@/lib/connection-context' import { isSyncPushStageError } from '@/lib/source-control-remote-error' -import { shouldForcePushWithLeaseForUpstream } from '../../../../../../shared/git-upstream-status' +import { shouldForcePushWithLeaseForUpstream } from '../../../../../../shared/git/remotes/git-upstream-status' import { captureSourceControlRecoveryEntrySnapshot, type SourceControlActionError, diff --git a/src/renderer/src/components/right-sidebar/stacked-review-create-failure-copy.ts b/src/renderer/src/components/right-sidebar/stacked-review-create-failure-copy.ts index 1278b097205..97767a9fe12 100644 --- a/src/renderer/src/components/right-sidebar/stacked-review-create-failure-copy.ts +++ b/src/renderer/src/components/right-sidebar/stacked-review-create-failure-copy.ts @@ -2,7 +2,7 @@ import { translate } from '@/i18n/i18n' import { STACKED_REVIEW_FAILURE_COPY as EN, type StackedReviewFailureReason -} from '../../../../shared/stacked-hosted-review-failure-copy' +} from '../../../../shared/source-control/hosted-review/stacked-hosted-review-failure-copy' // undefined = the branch name the sentence needs is missing; callers fall back to `error`. export function stackedFailureMessage( diff --git a/src/renderer/src/components/right-sidebar/stale-conflict-operation-poll.test.tsx b/src/renderer/src/components/right-sidebar/stale-conflict-operation-poll.test.tsx index 45ab3abfa63..01b1a01afec 100644 --- a/src/renderer/src/components/right-sidebar/stale-conflict-operation-poll.test.tsx +++ b/src/renderer/src/components/right-sidebar/stale-conflict-operation-poll.test.tsx @@ -3,7 +3,7 @@ import { act, createElement } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { GitConflictOperation } from '../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../shared/git/status/git-status-types' import { useStaleConflictOperationPolling } from './stale-conflict-operation-poll' globalThis.IS_REACT_ACT_ENVIRONMENT = true diff --git a/src/renderer/src/components/right-sidebar/stale-conflict-operation-poll.ts b/src/renderer/src/components/right-sidebar/stale-conflict-operation-poll.ts index 41e9aca0a1f..f4adb708a86 100644 --- a/src/renderer/src/components/right-sidebar/stale-conflict-operation-poll.ts +++ b/src/renderer/src/components/right-sidebar/stale-conflict-operation-poll.ts @@ -1,5 +1,5 @@ import { useEffect, useMemo } from 'react' -import type { GitConflictOperation } from '../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../shared/git/status/git-status-types' import type { Repo } from '../../../../shared/repo-types' import { isGitRepoKind } from '../../../../shared/repo-kind' import { getConnectionId } from '@/lib/connection-context' diff --git a/src/renderer/src/components/right-sidebar/status-display.ts b/src/renderer/src/components/right-sidebar/status-display.ts index 8b25c6fdee4..52ff949adbe 100644 --- a/src/renderer/src/components/right-sidebar/status-display.ts +++ b/src/renderer/src/components/right-sidebar/status-display.ts @@ -1,9 +1,7 @@ -import type { GitFileStatus, GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitFileStatus, GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { joinPath, normalizeRelativePath } from '@/lib/path' import { splitPathSegments } from '../../../../shared/cross-platform-path' -export { STATUS_LABELS } from '../../../../shared/git-status-labels' - export const STATUS_COLORS: Record = { modified: 'var(--git-decoration-modified)', added: 'var(--git-decoration-added)', diff --git a/src/renderer/src/components/right-sidebar/use-create-jira-review-title.test.tsx b/src/renderer/src/components/right-sidebar/use-create-jira-review-title.test.tsx index 3c4972d8027..66640a09971 100644 --- a/src/renderer/src/components/right-sidebar/use-create-jira-review-title.test.tsx +++ b/src/renderer/src/components/right-sidebar/use-create-jira-review-title.test.tsx @@ -3,7 +3,7 @@ import { act, cleanup, renderHook } from '@testing-library/react' import { afterEach, describe, expect, it } from 'vitest' import { useCreatePullRequestDialogFields } from './useCreatePullRequestDialogFields' -import type { HostedReviewCreationEligibility } from '../../../../shared/hosted-review' +import type { HostedReviewCreationEligibility } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { WorkspaceAttachmentMetadata } from '../../../../shared/workspace-attachment-legacy' const workspace: WorkspaceAttachmentMetadata = { diff --git a/src/renderer/src/components/right-sidebar/use-create-pull-request-base-ref-discovery.ts b/src/renderer/src/components/right-sidebar/use-create-pull-request-base-ref-discovery.ts index 23f6932b291..784a4bee0b0 100644 --- a/src/renderer/src/components/right-sidebar/use-create-pull-request-base-ref-discovery.ts +++ b/src/renderer/src/components/right-sidebar/use-create-pull-request-base-ref-discovery.ts @@ -8,7 +8,7 @@ import { searchRuntimeRepoBaseRefDetails } from '@/runtime/runtime-repo-client' import { stripBaseRef } from './create-pull-request-base-ref-normalization' -import { normalizeCreateReviewBaseSearchResults } from '../../../../shared/hosted-review-refs' +import { normalizeCreateReviewBaseSearchResults } from '../../../../shared/source-control/hosted-review/hosted-review-refs' type CreatePullRequestBaseRefDiscoveryOptions = { open: boolean diff --git a/src/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.ts b/src/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.ts index 577ebb1b4f2..3aa05cb1ac3 100644 --- a/src/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.ts +++ b/src/renderer/src/components/right-sidebar/use-create-pull-request-field-generation.ts @@ -9,9 +9,9 @@ import { generateRuntimePullRequestFields } from '@/runtime/runtime-git-generation-client' import type { RuntimeGeneratePullRequestFieldsOverrides } from '@/runtime/runtime-git-client-context' -import type { HostedReviewCreationEligibility } from '../../../../shared/hosted-review' -import type { ResolveSourceControlAiResult } from '../../../../shared/source-control-ai' -import type { SourceControlAiPrCreationDefaults } from '../../../../shared/source-control-ai-types' +import type { HostedReviewCreationEligibility } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import type { ResolveSourceControlAiResult } from '../../../../shared/source-control/ai/source-control-ai-operation-resolution' +import type { SourceControlAiPrCreationDefaults } from '../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { PullRequestFieldRevisions } from '@/store/slices/pull-request-generation' import type { PullRequestGenerationOptions } from '@/store/slices/pull-request-generation-auto-submit' import { stripBaseRef } from './create-pull-request-base-ref-normalization' diff --git a/src/renderer/src/components/right-sidebar/use-create-pull-request-field-seeding.ts b/src/renderer/src/components/right-sidebar/use-create-pull-request-field-seeding.ts index 987698e53d8..20f31ac32af 100644 --- a/src/renderer/src/components/right-sidebar/use-create-pull-request-field-seeding.ts +++ b/src/renderer/src/components/right-sidebar/use-create-pull-request-field-seeding.ts @@ -1,12 +1,12 @@ import { useEffect, type Dispatch, type RefObject, type SetStateAction } from 'react' import { cancelRuntimeGeneratePullRequestFields } from '@/runtime/runtime-git-generation-client' -import type { HostedReviewCreationEligibility } from '../../../../shared/hosted-review' -import type { SourceControlAiPrCreationDefaults } from '../../../../shared/source-control-ai-types' +import type { HostedReviewCreationEligibility } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import type { SourceControlAiPrCreationDefaults } from '../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { PullRequestFieldName, PullRequestFieldRevisions } from '@/store/slices/pull-request-generation' -import { resolveCreateReviewSeedText } from '../../../../shared/hosted-review-create-seed' +import { resolveCreateReviewSeedText } from '../../../../shared/source-control/hosted-review/hosted-review-create-seed' import { stripBaseRef } from './create-pull-request-base-ref-normalization' import { createInitialPullRequestFieldRevisions, diff --git a/src/renderer/src/components/right-sidebar/use-generate-before-create-pull-request-context.test.tsx b/src/renderer/src/components/right-sidebar/use-generate-before-create-pull-request-context.test.tsx index b7ecca4235b..6254a578fbe 100644 --- a/src/renderer/src/components/right-sidebar/use-generate-before-create-pull-request-context.test.tsx +++ b/src/renderer/src/components/right-sidebar/use-generate-before-create-pull-request-context.test.tsx @@ -4,7 +4,7 @@ import { act, cleanup, renderHook } from '@testing-library/react' import { afterEach, describe, expect, it, vi } from 'vitest' import { useAppStore } from '@/store' import { createRunningPullRequestGenerationRecord } from '@/store/slices/pull-request-generation' -import type { HostedReviewCreationEligibility } from '../../../../shared/hosted-review' +import type { HostedReviewCreationEligibility } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { useCreatePullRequestDialogFields } from './useCreatePullRequestDialogFields' import { useGenerateBeforeCreatePullRequest } from './use-generate-before-create-pull-request' diff --git a/src/renderer/src/components/right-sidebar/use-git-status-upstream-ref-watch.ts b/src/renderer/src/components/right-sidebar/use-git-status-upstream-ref-watch.ts index 107aa0184f8..fd63fdb8f63 100644 --- a/src/renderer/src/components/right-sidebar/use-git-status-upstream-ref-watch.ts +++ b/src/renderer/src/components/right-sidebar/use-git-status-upstream-ref-watch.ts @@ -1,7 +1,7 @@ import { useCallback, useEffect } from 'react' import { getConnectionId } from '@/lib/connection-context' import { setRuntimeGitStatusUpstreamRefWatch } from '@/runtime/runtime-git-status-client' -import type { GitStatusResult } from '../../../../shared/git-status-types' +import type { GitStatusResult } from '../../../../shared/git/status/git-status-types' import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target' import { getWorktreeGitOwnerTarget } from './worktree-git-owner-target' diff --git a/src/renderer/src/components/right-sidebar/use-hosted-review-actions.ts b/src/renderer/src/components/right-sidebar/use-hosted-review-actions.ts index bada277068e..2df46a75d00 100644 --- a/src/renderer/src/components/right-sidebar/use-hosted-review-actions.ts +++ b/src/renderer/src/components/right-sidebar/use-hosted-review-actions.ts @@ -4,7 +4,7 @@ import { useCallback, useState } from 'react' import { toast } from 'sonner' import { useConfirmationDialog } from '@/components/confirmation-dialog-context' import type { GitHubPRAutoMergeAction } from '@/components/github-pr-merge-state' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { GitHubPRMergeMethod, PRInfo } from '../../../../shared/github/pull-request-types' import type { Repo } from '../../../../shared/repo-types' import { diff --git a/src/renderer/src/components/right-sidebar/use-saved-source-control-action-start.test.tsx b/src/renderer/src/components/right-sidebar/use-saved-source-control-action-start.test.tsx index e3300da6899..6dcc7b238fc 100644 --- a/src/renderer/src/components/right-sidebar/use-saved-source-control-action-start.test.tsx +++ b/src/renderer/src/components/right-sidebar/use-saved-source-control-action-start.test.tsx @@ -6,7 +6,7 @@ import { useAppStore } from '@/store' import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures' import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-capabilities' import { clearHostAgentMenuSettingsForTests } from '../../runtime/agent-launch-settings/host-agent-launch-preferences-resource' -import { canonicalSourceControlActionSelection } from '../../../../shared/source-control-action-selection' +import { canonicalSourceControlActionSelection } from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import { planAgentSessionLaunch } from '@/lib/agent-session-launch-plan' import { useSavedSourceControlActionStart } from './use-saved-source-control-action-start' import { mountSourceDialog, renderDialog } from './source-control-action-dialog.test-fixture' diff --git a/src/renderer/src/components/right-sidebar/use-saved-source-control-action-start.ts b/src/renderer/src/components/right-sidebar/use-saved-source-control-action-start.ts index cdd386eef8d..7afa8e9801e 100644 --- a/src/renderer/src/components/right-sidebar/use-saved-source-control-action-start.ts +++ b/src/renderer/src/components/right-sidebar/use-saved-source-control-action-start.ts @@ -1,7 +1,7 @@ import { selectSourceControlActionRecipe, type CurrentActionSelection -} from '../../../../shared/source-control-action-selection' +} from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import { AgentLaunchChoiceCancelled, acquireAgentLaunchChoices @@ -18,7 +18,7 @@ import { toast } from 'sonner' import { useAppStore } from '@/store' import { ensureDetectedAgentsForWorktree } from '@/lib/agent-detection-target-inventory' import { isTuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent-config' -import { projectSelectedSourceControlActionLaunch } from '../../../../shared/source-control-action-launch-preferences' +import { projectSelectedSourceControlActionLaunch } from '../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { sourceControlLaunchAppliesAgentArgs } from './source-control-launch-agent-args-applicability' import { buildSourceControlAgentDeliveryPlan } from './buildSourceControlAgentDeliveryPlan' import { diff --git a/src/renderer/src/components/right-sidebar/use-source-control-action-agent-choice.ts b/src/renderer/src/components/right-sidebar/use-source-control-action-agent-choice.ts index 4b6e5f4ab20..a54585a919f 100644 --- a/src/renderer/src/components/right-sidebar/use-source-control-action-agent-choice.ts +++ b/src/renderer/src/components/right-sidebar/use-source-control-action-agent-choice.ts @@ -5,9 +5,9 @@ import { import { AGENT_LAUNCH_SURFACE_RUNTIME_CAPABILITY } from '../../../../shared/agent-launch/contracts/agent-launch-runtime-capability' import { useMemo } from 'react' import { useAppStore } from '@/store' -import { isCustomAgentId } from '../../../../shared/commit-message-agent-spec' -import { pickSourceControlLaunchAgent } from '../../../../shared/source-control-launch-agent-selection' -import type { SelectedSourceControlActionRecipe } from '../../../../shared/source-control-action-selection' +import { isCustomAgentId } from '../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { pickSourceControlLaunchAgent } from '../../../../shared/source-control/ai/source-control-launch-agent-selection' +import type { SelectedSourceControlActionRecipe } from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import type { Repo } from '../../../../shared/repo-types' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' import { isTuiAgentEnabled } from '../../../../shared/agent-launch/catalog/tui-agent-selection' diff --git a/src/renderer/src/components/right-sidebar/use-source-control-branch-compare.test.tsx b/src/renderer/src/components/right-sidebar/use-source-control-branch-compare.test.tsx index f89c967d152..2e16b2894df 100644 --- a/src/renderer/src/components/right-sidebar/use-source-control-branch-compare.test.tsx +++ b/src/renderer/src/components/right-sidebar/use-source-control-branch-compare.test.tsx @@ -38,8 +38,8 @@ import { useSourceControlBranchCompare } from './source-control/sync/use-branch-compare' import { deferred, flush, mountProbe, unmountProbes } from './source-control-hook-test-harness' -import type { GitBranchCompareResult } from '../../../../shared/git-diff-compare-types' -import type { GitUpstreamStatus } from '../../../../shared/git-status-types' +import type { GitBranchCompareResult } from '../../../../shared/git/diff/git-diff-compare-types' +import type { GitUpstreamStatus } from '../../../../shared/git/status/git-status-types' type Api = ReturnType diff --git a/src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx b/src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx index 2e0ae406f37..b6c52a3e828 100644 --- a/src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx +++ b/src/renderer/src/components/right-sidebar/use-source-control-git-history.test.tsx @@ -14,7 +14,7 @@ vi.mock('@/lib/connection-context', () => ({ getConnectionId: () => undefined }) import { useSourceControlGitHistory } from './source-control/sync/use-git-history' import { deferred, flush, mountProbe, unmountProbes } from './source-control-hook-test-harness' -import type { GitHistoryResult } from '../../../../shared/git-history-types' +import type { GitHistoryResult } from '../../../../shared/git/history/git-history-types' function historyResult(subject: string): GitHistoryResult { return { diff --git a/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.repo-default.test.ts b/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.repo-default.test.ts index 890595ce32c..280b124182e 100644 --- a/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.repo-default.test.ts +++ b/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.repo-default.test.ts @@ -3,7 +3,7 @@ import React, { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { HostedReviewCreationEligibility } from '../../../../shared/hosted-review' +import type { HostedReviewCreationEligibility } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' const getRuntimeRepoBaseRefDefault = vi.fn() diff --git a/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.test.ts b/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.test.ts index 4fbd5052f30..10e5c43adaa 100644 --- a/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.test.ts +++ b/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.test.ts @@ -4,9 +4,9 @@ import React, { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { describe, expect, it, vi } from 'vitest' import { getDefaultSettings } from '../../../../shared/constants' -import type { HostedReviewCreationEligibility } from '../../../../shared/hosted-review' -import { getDefaultSourceControlAiSettings } from '../../../../shared/source-control-ai-settings' -import { normalizeCreateReviewBaseSearchResults } from '../../../../shared/hosted-review-refs' +import type { HostedReviewCreationEligibility } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { getDefaultSourceControlAiSettings } from '../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { normalizeCreateReviewBaseSearchResults } from '../../../../shared/source-control/hosted-review/hosted-review-refs' import { useCreatePullRequestDialogFields } from './useCreatePullRequestDialogFields' describe('normalizeCreateReviewBaseSearchResults', () => { diff --git a/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.ts b/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.ts index 23b8fe22351..9e2b6c68e92 100644 --- a/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.ts +++ b/src/renderer/src/components/right-sidebar/useCreatePullRequestDialogFields.ts @@ -3,10 +3,8 @@ import { prefixJiraReviewTitle } from '../../../../shared/jira/jira-review-title' import { useCallback, useMemo, useRef, useState } from 'react' -import { - DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS, - resolveSourceControlAiForOperation -} from '../../../../shared/source-control-ai' +import { DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS } from '../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { resolveSourceControlAiForOperation } from '../../../../shared/source-control/ai/source-control-ai-operation-resolution' import type { PullRequestFieldName, PullRequestFieldRevisions @@ -15,7 +13,7 @@ import { resolveCreateReviewDefaultBaseRef, stripBaseRef } from './create-pull-request-base-ref-normalization' -import { resolveCreateReviewSeedText } from '../../../../shared/hosted-review-create-seed' +import { resolveCreateReviewSeedText } from '../../../../shared/source-control/hosted-review/hosted-review-create-seed' import { createInitialPullRequestFieldRevisions, type GenerationSeed, diff --git a/src/renderer/src/components/right-sidebar/useGitStatusPolling.test.ts b/src/renderer/src/components/right-sidebar/useGitStatusPolling.test.ts index 454701e57d1..16e396bc041 100644 --- a/src/renderer/src/components/right-sidebar/useGitStatusPolling.test.ts +++ b/src/renderer/src/components/right-sidebar/useGitStatusPolling.test.ts @@ -1,9 +1,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import type * as React from 'react' import type { FsChangedPayload } from '../../../../shared/filesystem-entry-types' -import type { GitStatusResult } from '../../../../shared/git-status-types' +import type { GitStatusResult } from '../../../../shared/git/status/git-status-types' import type { GitPushTarget } from '../../../../shared/worktree/types' -import { DEFAULT_GIT_STATUS_LIMIT } from '../../../../shared/git-status-limit' +import { DEFAULT_GIT_STATUS_LIMIT } from '../../../../shared/git/status/git-status-limit' const worktree = { id: 'repo-1::/repo', repoId: 'repo-1', path: '/repo' } const repo = { id: 'repo-1', path: '/repo', kind: 'git', connectionId: null as string | null } diff --git a/src/renderer/src/components/right-sidebar/useHostedReviewStackParent.test.tsx b/src/renderer/src/components/right-sidebar/useHostedReviewStackParent.test.tsx index 048ccc1bee9..90dd3d4d579 100644 --- a/src/renderer/src/components/right-sidebar/useHostedReviewStackParent.test.tsx +++ b/src/renderer/src/components/right-sidebar/useHostedReviewStackParent.test.tsx @@ -2,7 +2,7 @@ import { act, renderHook } from '@testing-library/react' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { useHostedReviewStackParent } from './useHostedReviewStackParent' function makeReview(overrides: Partial = {}): HostedReviewInfo { diff --git a/src/renderer/src/components/right-sidebar/useHostedReviewStackParent.ts b/src/renderer/src/components/right-sidebar/useHostedReviewStackParent.ts index a13dc14feea..0bf17e51adf 100644 --- a/src/renderer/src/components/right-sidebar/useHostedReviewStackParent.ts +++ b/src/renderer/src/components/right-sidebar/useHostedReviewStackParent.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' -import { normalizeHostedReviewBaseRef } from '../../../../shared/hosted-review-refs' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { normalizeHostedReviewBaseRef } from '../../../../shared/source-control/hosted-review/hosted-review-refs' export type HostedReviewStackParent = Pick diff --git a/src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.test.tsx b/src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.test.tsx index 50021a57cd1..3a25e5e05ca 100644 --- a/src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.test.tsx +++ b/src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.test.tsx @@ -4,20 +4,20 @@ import type * as StructuredAgentClient from '@/runtime/structured-agent-session- import { commitSourceControlActionArguments, editSourceControlActionArguments -} from '../../../../shared/source-control-action-selection' +} from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import { captureSourceControlActionSelection, resolveSourceControlActionRecipe -} from '../../../../shared/source-control-ai-operation-policy' -import { projectSourceControlActionLaunch } from '../../../../shared/source-control-action-launch-preferences' +} from '../../../../shared/source-control/ai/source-control-ai-operation-policy' +import { projectSourceControlActionLaunch } from '../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { structuredLaunchRequestedOptions } from '../../../../shared/native-chat/input/native-chat-session-option-defaults' -import { liftActionPermissionArgs } from '../../../../shared/source-control-action-permission-lift' +import { liftActionPermissionArgs } from '../../../../shared/source-control/ai/recipes/source-control-action-permission-lift' import type { Repo } from '../../../../shared/repo-types' import { projectAgentLaunchSettings } from '../../../../shared/agent-launch/choices/agent-launch-settings' import { makeWorktree, TEST_REPO } from '@/store/slices/worktrees-slice-test-fixtures' import { getRuntimeAgentInventoryKey } from '@/store/slices/runtime-agent-inventory-key' import { clearHostAgentMenuSettingsForTests } from '../../runtime/agent-launch-settings/host-agent-launch-preferences-resource' -import type { SourceControlActionRecipe } from '../../../../shared/source-control-ai-actions' +import type { SourceControlActionRecipe } from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { act, cleanup, fireEvent, renderHook, screen, waitFor } from '@testing-library/react' import { afterEach, expect, it, vi } from 'vitest' import { getDefaultSettings } from '../../../../shared/constants' diff --git a/src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.ts b/src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.ts index 1cf8dc013c7..9565bf87c7f 100644 --- a/src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.ts +++ b/src/renderer/src/components/right-sidebar/useSourceControlAgentActionDialog.ts @@ -10,13 +10,13 @@ import { pickSourceControlActionAgent, selectSourceControlActionRecipe, type CurrentActionSelection -} from '../../../../shared/source-control-action-selection' -import { captureSourceControlActionSelection } from '../../../../shared/source-control-ai-operation-policy' +} from '../../../../shared/source-control/ai/recipes/source-control-action-selection' +import { captureSourceControlActionSelection } from '../../../../shared/source-control/ai/source-control-ai-operation-policy' import { useCallback, useMemo, useState } from 'react' -import { resolveSourceControlLaunchAgentScope } from '../../../../shared/source-control-launch-agent-selection' +import { resolveSourceControlLaunchAgentScope } from '../../../../shared/source-control/ai/source-control-launch-agent-selection' import { useAppStore } from '@/store' import { useRepoById } from '@/store/selectors' -import { renderSourceControlActionCommandTemplate } from '../../../../shared/source-control-ai-actions' +import { renderSourceControlActionCommandTemplate } from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' import type { AgentLaunchSurface } from '@/lib/agent-session-launch-plan' import { savedSurfaceForPick } from '@/lib/source-control-agent-picker' diff --git a/src/renderer/src/components/right-sidebar/useSourceControlAgentActionStart.ts b/src/renderer/src/components/right-sidebar/useSourceControlAgentActionStart.ts index b64b6842a5a..0d8aa6b26be 100644 --- a/src/renderer/src/components/right-sidebar/useSourceControlAgentActionStart.ts +++ b/src/renderer/src/components/right-sidebar/useSourceControlAgentActionStart.ts @@ -1,5 +1,5 @@ -import { projectSelectedSourceControlActionLaunch } from '../../../../shared/source-control-action-launch-preferences' -import type { SelectedSourceControlActionRecipe } from '../../../../shared/source-control-action-selection' +import { projectSelectedSourceControlActionLaunch } from '../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' +import type { SelectedSourceControlActionRecipe } from '../../../../shared/source-control/ai/recipes/source-control-action-selection' import type { AgentLaunchPreferences } from '@/runtime/agent-launch-settings/host-agent-launch-preferences-resource' import { useCallback, useEffect, useRef, useState } from 'react' import type { RuntimeGitContext } from '@/runtime/runtime-git-client-context' @@ -7,8 +7,8 @@ import type { LaunchSource } from '../../../../shared/telemetry-events' import type { SourceControlLaunchActionId, SourceControlActionRecipe -} from '../../../../shared/source-control-ai-actions' -import type { SourceControlAiWriteTarget } from '../../../../shared/source-control-ai-recipe-save' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiWriteTarget } from '../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Repo } from '../../../../shared/repo-types' import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' diff --git a/src/renderer/src/components/right-sidebar/useSourceControlSelection.test.ts b/src/renderer/src/components/right-sidebar/useSourceControlSelection.test.ts index 897bea00c6c..34b146efda4 100644 --- a/src/renderer/src/components/right-sidebar/useSourceControlSelection.test.ts +++ b/src/renderer/src/components/right-sidebar/useSourceControlSelection.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { reconcileSourceControlSelectionState, type FlatEntry diff --git a/src/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsx b/src/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsx index 36a0a6404d0..34e168378b6 100644 --- a/src/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsx +++ b/src/renderer/src/components/right-sidebar/useSourceControlSubmoduleStatus.test.tsx @@ -18,7 +18,7 @@ import { useSourceControlSubmoduleStatus, type UseSourceControlSubmoduleStatusResult } from './source-control/listing/use-submodule-status' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' const roots: Root[] = [] diff --git a/src/renderer/src/components/settings/__fixtures__/global-commit-card-test-fixture.tsx b/src/renderer/src/components/settings/__fixtures__/global-commit-card-test-fixture.tsx index 68c36a77f2d..248fb3c42e1 100644 --- a/src/renderer/src/components/settings/__fixtures__/global-commit-card-test-fixture.tsx +++ b/src/renderer/src/components/settings/__fixtures__/global-commit-card-test-fixture.tsx @@ -4,8 +4,8 @@ import { CommitMessageAiPane } from '../source-control/CommitMessageAiPane' import { getDefaultSourceControlAiSettings, normalizeSourceControlAiSettings -} from '../../../../../shared/source-control-ai' -import type { SourceControlAiSettings } from '../../../../../shared/source-control-ai-types' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import type { SourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { useAppStore } from '../../../store/index' import { useSettingsInteractionController } from '../page/use-settings-interaction-controller' import { TooltipProvider } from '../../ui/tooltip' diff --git a/src/renderer/src/components/settings/__fixtures__/settings-persistence-test-fixture.ts b/src/renderer/src/components/settings/__fixtures__/settings-persistence-test-fixture.ts index 1463f7e2600..7e30c7ecc3f 100644 --- a/src/renderer/src/components/settings/__fixtures__/settings-persistence-test-fixture.ts +++ b/src/renderer/src/components/settings/__fixtures__/settings-persistence-test-fixture.ts @@ -6,7 +6,7 @@ import type { GlobalSettings } from '../../../../../shared/global-settings-types import { useAppStore } from '../../../store' import type { SettingsStoreModel } from '../page/use-settings-store-model' import type { SettingsInteractionModel } from '../page/use-settings-interaction-controller' -import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control-ai' +import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { agentLaunchSettingsMutationUpdates, projectAgentLaunchSettings, diff --git a/src/renderer/src/components/settings/chat/ChatNamingSetting.test.tsx b/src/renderer/src/components/settings/chat/ChatNamingSetting.test.tsx index babef3605b9..605ed321616 100644 --- a/src/renderer/src/components/settings/chat/ChatNamingSetting.test.tsx +++ b/src/renderer/src/components/settings/chat/ChatNamingSetting.test.tsx @@ -3,8 +3,8 @@ import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-libra import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { getDefaultSettings } from '../../../../../shared/constants' import type { GlobalSettings } from '../../../../../shared/global-settings-types' -import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control-ai-types' -import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control-ai' +import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { ChatNamingSetting } from './ChatNamingSetting' import { savedChatNamingCatalog, diff --git a/src/renderer/src/components/settings/chat/ChatNamingSetting.tsx b/src/renderer/src/components/settings/chat/ChatNamingSetting.tsx index 8ce903ca9ef..7bd386cf7ec 100644 --- a/src/renderer/src/components/settings/chat/ChatNamingSetting.tsx +++ b/src/renderer/src/components/settings/chat/ChatNamingSetting.tsx @@ -1,23 +1,21 @@ import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react' import { toast } from 'sonner' import type { GlobalSettings } from '../../../../../shared/global-settings-types' -import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control-ai-types' -import { - normalizeSourceControlAiSettings, - resolveSourceControlAiForOperation -} from '../../../../../shared/source-control-ai' +import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { resolveSourceControlAiForOperation } from '../../../../../shared/source-control/ai/source-control-ai-operation-resolution' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, setSourceControlActionDefault -} from '../../../../../shared/source-control-ai-actions' -import { CUSTOM_AGENT_ID } from '../../../../../shared/commit-message-agent-spec' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import { CUSTOM_AGENT_ID } from '../../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { isTuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent-config' import { getAgentLabel } from '@/lib/agent-catalog' import { translate } from '@/i18n/i18n' import { Switch } from '../../ui/switch' import { Card, CardContent } from '../../ui/card' import { SourceControlActionRecipeRow } from '../source-control/SourceControlActionRecipeRow' -import { replayGlobalTextModelEdits } from '../source-control-text-action-model-replay' +import { replayGlobalTextModelEdits } from '../source-control/text-actions/source-control-text-action-model-replay' import { CustomAgentCommandField } from '../source-control/CustomAgentCommandField' import { SettingsSubsectionHeader } from '../form-controls/SettingsFormControls' import { SearchableSetting } from '../section-layout/SearchableSetting' diff --git a/src/renderer/src/components/settings/chat/ChatSettingsSection.tsx b/src/renderer/src/components/settings/chat/ChatSettingsSection.tsx index 36a988e696d..805c706c27c 100644 --- a/src/renderer/src/components/settings/chat/ChatSettingsSection.tsx +++ b/src/renderer/src/components/settings/chat/ChatSettingsSection.tsx @@ -7,7 +7,7 @@ import { SettingsSection } from '../section-layout/SettingsSection' import { SettingsSubsectionHeader } from '../form-controls/SettingsFormControls' import { matchesSettingsSearch, type SettingsSearchEntry } from '../search/settings-search' import type { GlobalSettings } from '../../../../../shared/global-settings-types' -import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control-ai-types' +import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { useAppStore } from '../../../store/index' import { Card, CardContent } from '../../ui/card' diff --git a/src/renderer/src/components/settings/chat/chat-naming-persistence.test.tsx b/src/renderer/src/components/settings/chat/chat-naming-persistence.test.tsx index 75dcc479271..3243580ce3a 100644 --- a/src/renderer/src/components/settings/chat/chat-naming-persistence.test.tsx +++ b/src/renderer/src/components/settings/chat/chat-naming-persistence.test.tsx @@ -4,20 +4,20 @@ import { CommitMessageAiPane } from '../source-control/CommitMessageAiPane' import { act, fireEvent, render, renderHook, screen, waitFor, within } from '@testing-library/react' import { expect, it, vi } from 'vitest' import { toast } from 'sonner' -import { setSourceControlActionDefault } from '../../../../../shared/source-control-ai-actions' +import { setSourceControlActionDefault } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { getDefaultSourceControlAiSettings, - normalizeSourceControlAiSettings, - projectSourceControlAiToLegacyCommitMessageAi, - resolveSourceControlAiForOperation -} from '../../../../../shared/source-control-ai' -import { planCommitMessageGeneration } from '../../../../../shared/commit-message-plan' + normalizeSourceControlAiSettings +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { projectSourceControlAiToLegacyCommitMessageAi } from '../../../../../shared/source-control/ai/settings/source-control-ai-legacy-projection' +import { resolveSourceControlAiForOperation } from '../../../../../shared/source-control/ai/source-control-ai-operation-resolution' +import { planCommitMessageGeneration } from '../../../../../shared/source-control/ai/generation/commit-message-plan' import type { GlobalSettings } from '../../../../../shared/global-settings-types' import type { Repo } from '../../../../../shared/repo-types' import type { SourceControlAiSettings, SourceControlAiSettingsPatch -} from '../../../../../shared/source-control-ai-types' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { useAiCommitPrSettings } from '../../feature-wall/useAiCommitPrSettings' import { useSourceControlActionRecipeDraftState } from '../source-control/source-control-action-recipe-draft-state' import { useAppStore } from '../../../store/index' diff --git a/src/renderer/src/components/settings/navigation/settings-navigation-foundations.ts b/src/renderer/src/components/settings/navigation/settings-navigation-foundations.ts index f3305f9ae0a..e04f28811d2 100644 --- a/src/renderer/src/components/settings/navigation/settings-navigation-foundations.ts +++ b/src/renderer/src/components/settings/navigation/settings-navigation-foundations.ts @@ -1,8 +1,8 @@ import type { MutableRefObject } from 'react' import type { GlobalSettings } from '../../../../../shared/global-settings-types' import type { SpeechModelState } from '../../../../../shared/speech-types' -import type { SourceControlAiSettings } from '../../../../../shared/source-control-ai-types' -import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control-ai' +import type { SourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { getDefaultVoiceSettings } from '../../../../../shared/constants' import type { SettingsNavSection, SettingsNavTarget } from '@/lib/settings-navigation-types' import type { SettingsDeepLinkTargetWatch } from './settings-deep-link-target-watcher' diff --git a/src/renderer/src/components/settings/page/use-settings-interaction-controller.ts b/src/renderer/src/components/settings/page/use-settings-interaction-controller.ts index 574c41f164c..03c45d90db7 100644 --- a/src/renderer/src/components/settings/page/use-settings-interaction-controller.ts +++ b/src/renderer/src/components/settings/page/use-settings-interaction-controller.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef, useState } from 'react' -import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control-ai-types' +import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { useAppStore } from '../../../store/index' import { translate } from '@/i18n/i18n' import { mergeFontSuggestions } from '../appearance/fonts/font-suggestions' diff --git a/src/renderer/src/components/settings/repository/RepositoryPane.tsx b/src/renderer/src/components/settings/repository/RepositoryPane.tsx index 9c2cd44073f..ffb5b707032 100644 --- a/src/renderer/src/components/settings/repository/RepositoryPane.tsx +++ b/src/renderer/src/components/settings/repository/RepositoryPane.tsx @@ -3,7 +3,7 @@ import { useCallback, useRef, useState } from 'react' import type { OrcaHooks, RepoHookSettings } from '../../../../../shared/orca-yaml-hook-types' import type { Project, ProjectUpdateArgs } from '../../../../../shared/project-types' import type { Repo } from '../../../../../shared/repo-types' -import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control-ai-types' +import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { getRepoKindLabel, isFolderRepo } from '../../../../../shared/repo-kind' import { getRepoExecutionHostId, type ExecutionHostId } from '../../../../../shared/execution-host' import { Label } from '../../ui/label' diff --git a/src/renderer/src/components/settings/repository/execution/RepositoryForkSyncSection.tsx b/src/renderer/src/components/settings/repository/execution/RepositoryForkSyncSection.tsx index 79ebd688972..4096bb048ed 100644 --- a/src/renderer/src/components/settings/repository/execution/RepositoryForkSyncSection.tsx +++ b/src/renderer/src/components/settings/repository/execution/RepositoryForkSyncSection.tsx @@ -1,7 +1,10 @@ import { useRef, useState } from 'react' import { RefreshCw } from 'lucide-react' import { toast } from 'sonner' -import type { ForkSyncMode, GitForkSyncResult } from '../../../../../../shared/git-fork-sync' +import type { + ForkSyncMode, + GitForkSyncResult +} from '../../../../../../shared/git/remotes/git-fork-sync' import type { Repo } from '../../../../../../shared/repo-types' import { getRepoMainWorktreeId } from '../../../../../../shared/worktree/id' import { Button } from '../../../ui/button' diff --git a/src/renderer/src/components/settings/repository/repository-settings-targets.ts b/src/renderer/src/components/settings/repository/repository-settings-targets.ts index f89cb9ab4b6..f5dad33c9f3 100644 --- a/src/renderer/src/components/settings/repository/repository-settings-targets.ts +++ b/src/renderer/src/components/settings/repository/repository-settings-targets.ts @@ -1,4 +1,4 @@ -import type { SourceControlActionId } from '../../../../../shared/source-control-ai-actions' +import type { SourceControlActionId } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' export function getRepositoryLocalCommandsSectionId(repoId: string): string { return `repo-${repoId}-local-commands` diff --git a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiActionRows.tsx b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiActionRows.tsx index 3686a4fb61c..d4a53b19b63 100644 --- a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiActionRows.tsx +++ b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiActionRows.tsx @@ -1,16 +1,14 @@ -import { SourceControlTextActionAgentPicker } from '../../SourceControlTextActionAgentPicker' -import { - hasOwnActionOverride, - readActionRecipeTextDraft -} from './repository-source-control-ai-draft' +import { SourceControlTextActionAgentPicker } from '../../source-control/text-actions/SourceControlTextActionAgentPicker' +import { hasOwnActionOverride } from './repository-source-control-ai-draft' +import { readActionRecipeTextDraft } from './repository-source-control-ai-recipe-text' import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' import { useRepositoryActionPickerInputs } from './use-repository-action-picker-inputs' import { shallow } from 'zustand/shallow' import { sameAgentLaunchPickerModel } from '../../../tab-bar/new-tab-agent-menu-model' -import { selectSourceControlActionRecipe } from '../../../../../../shared/source-control-action-selection' +import { selectSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/recipes/source-control-action-selection' import type { RepositorySourceControlAiActionRowsProps } from './repository-source-control-ai-action-rows-props' -import { sourceControlActionExecutionArgs } from '../../../../../../shared/source-control-action-launch-preferences' +import { sourceControlActionExecutionArgs } from '../../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import type { useAgentMenuObservation } from '@/components/tab-bar/use-new-tab-agent-menu-rows' import type { NativeChatDefaultSettings } from '../../../../../../shared/structured-native-chat-launch-route' import { @@ -20,13 +18,13 @@ import { import { memo, useMemo, type JSX } from 'react' import { invalidateAgentPickerDrafts } from '../../../agent/agent-launch-picker-drafts' -import { isCustomAgentId } from '../../../../../../shared/commit-message-agent-spec' +import { isCustomAgentId } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { type SourceControlActionId, SOURCE_CONTROL_ACTION_IDS, SOURCE_CONTROL_ACTION_LABELS -} from '../../../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { Input } from '../../../ui/input' import { Label } from '../../../ui/label' import { RepositorySourceControlAiActionSaveControls } from '../../source-control/RepositorySourceControlAiActionSaveControls' @@ -53,9 +51,9 @@ import { import { getRepositorySourceControlAiActionRecipeSectionId } from '../repository-settings-targets' import { translate } from '@/i18n/i18n' import { SourceControlActionOptionField } from '../../../agent/launch-settings/AgentChoiceOptionField' -import { pickSourceControlLaunchAgent } from '../../../../../../shared/source-control-launch-agent-selection' +import { pickSourceControlLaunchAgent } from '../../../../../../shared/source-control/ai/source-control-launch-agent-selection' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' -import { captureSourceControlActionSelection } from '../../../../../../shared/source-control-ai-operation-policy' +import { captureSourceControlActionSelection } from '../../../../../../shared/source-control/ai/source-control-ai-operation-policy' export function RepositorySourceControlAiActionRows( props: RepositorySourceControlAiActionRowsProps diff --git a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiCustomCommand.tsx b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiCustomCommand.tsx index e7f98094bea..02cf0a4fc35 100644 --- a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiCustomCommand.tsx +++ b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiCustomCommand.tsx @@ -1,6 +1,6 @@ import type React from 'react' import { useState } from 'react' -import type { SourceControlAiSettings } from '../../../../../../shared/source-control-ai-types' +import type { SourceControlAiSettings } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { Input } from '../../../ui/input' import { Label } from '../../../ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../../ui/select' diff --git a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiEnablement.tsx b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiEnablement.tsx index 7b7f3a8dab7..377ee55bd8c 100644 --- a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiEnablement.tsx +++ b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiEnablement.tsx @@ -1,5 +1,5 @@ import type React from 'react' -import type { SourceControlAiSettings } from '../../../../../../shared/source-control-ai-types' +import type { SourceControlAiSettings } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { Label } from '../../../ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../../ui/select' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiHostedReviewDefaults.tsx b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiHostedReviewDefaults.tsx index f8553b68216..8bfd2421016 100644 --- a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiHostedReviewDefaults.tsx +++ b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiHostedReviewDefaults.tsx @@ -2,7 +2,7 @@ import type React from 'react' import type { RepoSourceControlAiOverrides, SourceControlAiSettings -} from '../../../../../../shared/source-control-ai-types' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { Label } from '../../../ui/label' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../../ui/select' import { triStateValue } from './repository-source-control-ai-draft' diff --git a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.test.ts b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.test.ts index b9add2f296e..9c927e31280 100644 --- a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.test.ts +++ b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.test.ts @@ -3,7 +3,7 @@ import { type SourceControlAiRepoUpdate, saveSourceControlActionRecipe, toSourceControlAiRepoUpdate -} from '../../../../../../shared/source-control-ai-recipe-save' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' // @vitest-environment happy-dom import { EVERY_AGENT_CHAT } from '../../../../../../shared/native-chat/every-agent-chat.test-fixture' import { afterEach, describe, expect, it, vi } from 'vitest' @@ -12,15 +12,15 @@ import { pickerLocaleFixture } from '../../__fixtures__/settings-persistence-tes import React from 'react' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' import { createRepoActionTextDraftEditors } from './repository-source-control-ai-text-draft' -import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-types' -import { setSourceControlActionAgentDefault } from '../../../../../../shared/source-control-ai-actions' +import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { setSourceControlActionAgentDefault } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { computeActionDirtyById, withRepoAiActionMode, withRepoAiActionRecipeText } from './repository-source-control-ai-draft' import { withRepoAiActionAgent } from './repository-source-control-ai-action-agent-draft' -import { resolveSourceControlActionRecipe } from '../../../../../../shared/source-control-ai-operation-policy' +import { resolveSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/source-control-ai-operation-policy' import { sourceControlActionRecipeMatchesTarget } from '../../../right-sidebar/source-control-action-recipe-match' import { SourceControlActionAgentPicker } from '../../source-control/SourceControlActionAgentPicker' @@ -30,7 +30,7 @@ import { SourceControlAiActionRecipeDefaults } from '../../source-control/Source import { useAppStore } from '../../../../store/index' import { TooltipProvider } from '../../../ui/tooltip' import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-capabilities' -import { projectSourceControlActionLaunch } from '../../../../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { projectAgentLaunchSettings } from '../../../../../../shared/agent-launch/choices/agent-launch-settings' import { TEST_REPO } from '@/store/slices/worktrees-slice-test-fixtures' import { clearHostAgentMenuSettingsForTests } from '../../../../runtime/agent-launch-settings/host-agent-launch-preferences-resource' diff --git a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.tsx b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.tsx index 2721e4a5685..ebe026f163a 100644 --- a/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.tsx +++ b/src/renderer/src/components/settings/repository/source-control/RepositorySourceControlAiSection.tsx @@ -2,9 +2,9 @@ import { useShallow } from 'zustand/react/shallow' import { useMemo } from 'react' import type React from 'react' import type { Repo } from '../../../../../../shared/repo-types' -import { normalizeSourceControlAiSettings } from '../../../../../../shared/source-control-ai-settings' -import type { SourceControlAiRepoUpdate } from '../../../../../../shared/source-control-ai-recipe-save' -import type { SourceControlAiSettingsPatch } from '../../../../../../shared/source-control-ai-types' +import { normalizeSourceControlAiSettings } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import type { SourceControlAiRepoUpdate } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' +import type { SourceControlAiSettingsPatch } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { useAppStore } from '../../../../store/index' import { getRepositorySourceControlAiSectionId } from '../repository-settings-targets' import { RepositorySourceControlAiActionRows } from './RepositorySourceControlAiActionRows' diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-action-agent-draft.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-action-agent-draft.ts index 843346eed5b..81e47fdfb35 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-action-agent-draft.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-action-agent-draft.ts @@ -1,10 +1,10 @@ -import { demoteActionArgumentChoices } from '../../../../../../shared/source-control-action-argument-document' +import { demoteActionArgumentChoices } from '../../../../../../shared/source-control/ai/recipes/source-control-action-argument-document' import type { SourceControlActionRecipe, SourceControlActionId, SourceControlActionLaunchPreferences -} from '../../../../../../shared/source-control-ai-actions' -import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-types' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { normalizeRepoAiDraft, setActionOverride } from './repository-source-control-ai-draft' diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-action-rows-props.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-action-rows-props.ts index 55900c793a1..abd905cbe54 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-action-rows-props.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-action-rows-props.ts @@ -1,17 +1,17 @@ -import type { SourceControlAiModelEdits } from '../../../../../../shared/source-control-ai-action-model-edits' -import type { ActionArgumentChoices } from '../../../../../../shared/source-control-action-argument-choices' +import type { SourceControlAiModelEdits } from '../../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' +import type { ActionArgumentChoices } from '../../../../../../shared/source-control/ai/recipes/source-control-action-argument-document' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' import type { RepoSourceControlAiOverrides, SourceControlAiModelChoice, SourceControlAiSettingsPatch, SourceControlAiSettings -} from '../../../../../../shared/source-control-ai-types' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import type { SourceControlActionRecipe, SourceControlActionId, SourceControlActionLaunchPreferences -} from '../../../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' export type RepositorySourceControlAiActionRowsProps = { repoId: string diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-draft.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-draft.ts index e686d5ed13d..6a78a4379ce 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-draft.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-draft.ts @@ -4,19 +4,16 @@ import { sameActionRecipeText, type ActionRecipeTextDraft } from './repository-source-control-ai-recipe-text' -export { - readActionRecipeTextDraft, - type ActionRecipeTextDraft -} from './repository-source-control-ai-recipe-text' -import { normalizeRepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-repo-settings' -import { resolveSourceControlActionRecipe } from '../../../../../../shared/source-control-ai-operation-policy' + +import { normalizeRepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-repo-settings' +import { resolveSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/source-control-ai-operation-policy' import { SOURCE_CONTROL_ACTION_IDS, SOURCE_CONTROL_TEXT_ACTION_IDS, type SourceControlActionId -} from '../../../../../../shared/source-control-ai-actions' -import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-types' -import { withRepoTextModelEdits } from '../../source-control-text-action-model-replay' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { withRepoTextModelEdits } from '../../source-control/text-actions/source-control-text-action-model-replay' import type { GlobalSettings } from '../../../../../../shared/global-settings-types' import { completeRepoActionRecipe } from './repository-source-control-ai-labels' import { SOURCE_CONTROL_TEXT_ACTION_ID_SET } from '../../source-control/source-control-action-recipe-options' diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux-types.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux-types.ts new file mode 100644 index 00000000000..94b60f2c354 --- /dev/null +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux-types.ts @@ -0,0 +1,18 @@ +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' +import type { + RepoSourceControlAiOverrides, + SourceControlAiSettings +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import type { SourceControlAiRepoUpdate } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' + +export type HostedReviewDefaultKey = keyof NonNullable< + RepoSourceControlAiOverrides['prCreationDefaults'] +> + +export type UseRepositorySourceControlAiGlobalUxArgs = { + repoId: string + persistedRepoAi: RepoSourceControlAiOverrides + settings: Pick | null + source: SourceControlAiSettings + updateRepo: (repoId: string, updates: SourceControlAiRepoUpdate) => void | Promise +} diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.test.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.test.ts index 32217eb6da0..4a685732dc6 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.test.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.test.ts @@ -1,26 +1,26 @@ // @vitest-environment happy-dom import { act, renderHook } from '@testing-library/react' import { describe, expect, it, vi } from 'vitest' -import { normalizeRepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-repo-settings' -import { normalizeSourceControlAiSettings } from '../../../../../../shared/source-control-ai-settings' -import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-types' +import { normalizeRepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-repo-settings' +import { normalizeSourceControlAiSettings } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { useRepositorySourceControlAiGlobalUx } from './repository-source-control-ai-global-ux' import { withRepoAiActionLaunchPreferences } from './repository-source-control-ai-action-agent-draft' import { dropRepoLegacyInstructionForAction, - readActionRecipeTextDraft, withRepoAiActionRecipeText } from './repository-source-control-ai-draft' +import { readActionRecipeTextDraft } from './repository-source-control-ai-recipe-text' import { type SourceControlAiRepoUpdate, toSourceControlAiRepoUpdate -} from '../../../../../../shared/source-control-ai-recipe-save' -import type { SourceControlActionId } from '../../../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' +import type { SourceControlActionId } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { getDefaultSettings } from '../../../../../../shared/constants' -import { sourceControlActionSelectedPreferences } from '../../../../../../shared/source-control-action-launch-preferences' -import { liftActionPermissionArgs } from '../../../../../../shared/source-control-action-permission-lift' -import { resolveSourceControlActionRecipe } from '../../../../../../shared/source-control-ai-operation-policy' +import { sourceControlActionSelectedPreferences } from '../../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' +import { liftActionPermissionArgs } from '../../../../../../shared/source-control/ai/recipes/source-control-action-permission-lift' +import { resolveSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/source-control-ai-operation-policy' const source = normalizeSourceControlAiSettings(undefined, undefined) diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.ts index faef7cbdf17..399dade1c93 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.ts @@ -1,17 +1,18 @@ -import { liftActionPermissionArgs } from '../../../../../../shared/source-control-action-permission-lift' -import { useEffect, useMemo, useRef, useState } from 'react' -import type { GlobalSettings } from '../../../../../../shared/global-settings-types' -import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' -import { CUSTOM_AGENT_ID } from '../../../../../../shared/commit-message-agent-spec' import type { - RepoSourceControlAiOverrides, - SourceControlAiSettings -} from '../../../../../../shared/source-control-ai-types' -import type { SourceControlAiRepoUpdate } from '../../../../../../shared/source-control-ai-recipe-save' + HostedReviewDefaultKey, + UseRepositorySourceControlAiGlobalUxArgs +} from './repository-source-control-ai-global-ux-types' +import { liftActionPermissionArgs } from '../../../../../../shared/source-control/ai/recipes/source-control-action-permission-lift' +import { useEffect, useMemo, useRef, useState } from 'react' + +import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' +import { CUSTOM_AGENT_ID } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' + import type { SourceControlActionRecipe, SourceControlActionId -} from '../../../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { useMountedRef } from '@/hooks/useMountedRef' import { clearActionTextDraftIfUnchanged, @@ -19,8 +20,6 @@ import { computeActionDirtyById, hasOwnActionOverride, readCompleteRecipeForDraft, - readActionRecipeTextDraft, - type ActionRecipeTextDraft, retainCustomCommandDraft, retainDivergentActionTextDrafts, withRepoAiActionMode, @@ -29,6 +28,10 @@ import { withRepoAiEnabled, withRepoAiHostedReviewDefault } from './repository-source-control-ai-draft' +import { + readActionRecipeTextDraft, + type ActionRecipeTextDraft +} from './repository-source-control-ai-recipe-text' import { ACTION_MODE_INHERIT, DEFAULT_AGENT_VALUE } from './repository-source-control-ai-labels' import { createRepoAiPersistQueue } from './repository-source-control-ai-persist-queue' import { withRepoAiActionAgent } from './repository-source-control-ai-action-agent-draft' @@ -37,16 +40,6 @@ import { resetActionDraftLaunchPreferences } from './repository-source-control-ai-text-draft' -type HostedReviewDefaultKey = keyof NonNullable - -type UseRepositorySourceControlAiGlobalUxArgs = { - repoId: string - persistedRepoAi: RepoSourceControlAiOverrides - settings: Pick | null - source: SourceControlAiSettings - updateRepo: (repoId: string, updates: SourceControlAiRepoUpdate) => void | Promise -} - /** Simple controls save immediately; arguments and templates stay drafts until Save. */ export function useRepositorySourceControlAiGlobalUx({ repoId, diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-labels.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-labels.ts index c20d04cff73..dbde6d29730 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-labels.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-labels.ts @@ -1,25 +1,25 @@ import { lowerActionArgumentChoices, demoteActionArgumentChoices -} from '../../../../../../shared/source-control-action-argument-document' +} from '../../../../../../shared/source-control/ai/recipes/source-control-action-argument-document' import { sourceControlActionSelectedPreferences, sourceControlActionExecutionArgs -} from '../../../../../../shared/source-control-action-launch-preferences' +} from '../../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' -import { readActionModelSelection } from '../../../../../../shared/source-control-action-model-selection' +import { readActionModelSelection } from '../../../../../../shared/source-control/ai/recipes/source-control-action-model-selection' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, resolveSourceControlActionCommandTemplate, type SourceControlActionId, type SourceControlActionRecipe -} from '../../../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { RepoSourceControlAiOverrides, SourceControlAiSettings -} from '../../../../../../shared/source-control-ai-types' -import type { CustomAgentId } from '../../../../../../shared/commit-message-agent-spec' -import { isCustomAgentId } from '../../../../../../shared/commit-message-agent-spec' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import type { CustomAgentId } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { isCustomAgentId } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' export const ACTION_MODE_INHERIT = 'inherit' export const ACTION_MODE_OVERRIDE = 'override' diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-persist-queue.test.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-persist-queue.test.ts index 2e8b73b7d9d..ba576f940f1 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-persist-queue.test.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-persist-queue.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-types' +import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { createRepoAiPersistQueue } from './repository-source-control-ai-persist-queue' type Harness = ReturnType diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-persist-queue.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-persist-queue.ts index 5f5be690d47..30e526ba514 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-persist-queue.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-persist-queue.ts @@ -1,7 +1,7 @@ -import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-types' -import { normalizeRepoSourceControlAiOverrides } from '../../../../../../shared/source-control-ai-repo-settings' -import { toSourceControlAiRepoUpdate } from '../../../../../../shared/source-control-ai-recipe-save' -import type { SourceControlAiRepoUpdate } from '../../../../../../shared/source-control-ai-recipe-save' +import type { RepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { normalizeRepoSourceControlAiOverrides } from '../../../../../../shared/source-control/ai/settings/source-control-ai-repo-settings' +import { toSourceControlAiRepoUpdate } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' +import type { SourceControlAiRepoUpdate } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' type PersistQueueOptions = { getRepoId: () => string diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-recipe-text.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-recipe-text.ts index 02265217553..1d1bf4077af 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-recipe-text.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-recipe-text.ts @@ -1,9 +1,9 @@ import type { RepoSourceControlAiOverrides, SourceControlAiModelChoice -} from '../../../../../../shared/source-control-ai-types' -import type { SourceControlActionId } from '../../../../../../shared/source-control-ai-actions' -import type { SourceControlAiModelEdits } from '../../../../../../shared/source-control-ai-action-model-edits' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import type { SourceControlActionId } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiModelEdits } from '../../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' type RepoActionRecipe = NonNullable< NonNullable[SourceControlActionId] > diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-text-draft.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-text-draft.ts index 814cd4c02b1..87d1c2e44cc 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-text-draft.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-text-draft.ts @@ -1,25 +1,25 @@ -import type { SourceControlAiModelEdits } from '../../../../../../shared/source-control-ai-action-model-edits' +import type { SourceControlAiModelEdits } from '../../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' import { transportActionArgumentChoices, demoteActionArgumentChoices, type ActionArgumentChoices -} from '../../../../../../shared/source-control-action-argument-document' +} from '../../../../../../shared/source-control/ai/recipes/source-control-action-argument-document' import type { Dispatch, SetStateAction } from 'react' import type { SourceControlActionId, SourceControlActionLaunchPreferences, SourceControlActionRecipe -} from '../../../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { RepoSourceControlAiOverrides, SourceControlAiModelChoice, SourceControlAiSettings -} from '../../../../../../shared/source-control-ai-types' -import { liftActionPermissionArgs } from '../../../../../../shared/source-control-action-permission-lift' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { liftActionPermissionArgs } from '../../../../../../shared/source-control/ai/recipes/source-control-action-permission-lift' import { readActionRecipeTextDraft, type ActionRecipeTextDraft -} from './repository-source-control-ai-draft' +} from './repository-source-control-ai-recipe-text' import { retireActionLaunchPreferences } from '../../source-control/source-control-ai-action-recipe-draft' import { readInheritedCommandTemplate } from './repository-source-control-ai-labels' diff --git a/src/renderer/src/components/settings/repository/source-control/repository-source-extent.test-fixture.ts b/src/renderer/src/components/settings/repository/source-control/repository-source-extent.test-fixture.ts index d14059fc06f..03ecefbdde7 100644 --- a/src/renderer/src/components/settings/repository/source-control/repository-source-extent.test-fixture.ts +++ b/src/renderer/src/components/settings/repository/source-control/repository-source-extent.test-fixture.ts @@ -6,9 +6,9 @@ import { TEST_REPO } from '@/store/slices/worktrees-slice-test-fixtures' import { TooltipProvider } from '../../../ui/tooltip' import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-capabilities' import { createRepoActionTextDraftEditors } from './repository-source-control-ai-text-draft' -import { saveSourceControlActionRecipe } from '../../../../../../shared/source-control-ai-recipe-save' -import { projectSourceControlActionLaunch } from '../../../../../../shared/source-control-action-launch-preferences' -import { resolveSourceControlActionRecipe } from '../../../../../../shared/source-control-ai-operation-policy' +import { saveSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save' +import { projectSourceControlActionLaunch } from '../../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' +import { resolveSourceControlActionRecipe } from '../../../../../../shared/source-control/ai/source-control-ai-operation-policy' import { computeActionDirtyById, withRepoAiActionMode, diff --git a/src/renderer/src/components/settings/repository/source-control/use-repository-action-picker-inputs.ts b/src/renderer/src/components/settings/repository/source-control/use-repository-action-picker-inputs.ts index bfc1e6d11e2..80c67aa5a7d 100644 --- a/src/renderer/src/components/settings/repository/source-control/use-repository-action-picker-inputs.ts +++ b/src/renderer/src/components/settings/repository/source-control/use-repository-action-picker-inputs.ts @@ -3,7 +3,7 @@ import { useAppStore } from '@/store/index' import { useAgentMenuObservation } from '@/components/tab-bar/use-new-tab-agent-menu-rows' import { sourceControlRepoAgentRows } from '@/lib/source-control-agent-picker' import { canSaveSourceControlActionSurface } from '../../source-control/SourceControlActionAgentPicker' -import { SOURCE_CONTROL_ACTION_IDS } from '../../../../../../shared/source-control-ai-actions' +import { SOURCE_CONTROL_ACTION_IDS } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { invalidateAgentPickerDrafts } from '../../../agent/agent-launch-picker-drafts' import { useSourceControlActionAgentInventory } from '../../source-control/use-source-control-action-agent' import { readNativeDetectedAgents } from '@/store/slices/local-detected-agent-store-state' diff --git a/src/renderer/src/components/settings/source-control/AutoRenameBranchFromWorkSetting.tsx b/src/renderer/src/components/settings/source-control/AutoRenameBranchFromWorkSetting.tsx index 5394e95d859..e26874bcbbd 100644 --- a/src/renderer/src/components/settings/source-control/AutoRenameBranchFromWorkSetting.tsx +++ b/src/renderer/src/components/settings/source-control/AutoRenameBranchFromWorkSetting.tsx @@ -4,13 +4,13 @@ import type { GlobalSettings } from '../../../../../shared/global-settings-types import type { SourceControlAiSettingsPatch, SourceControlAiSettings -} from '../../../../../shared/source-control-ai-types' -import { buildBranchNamePrompt } from '../../../../../shared/branch-name-from-work' -import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control-ai' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { buildBranchNamePrompt } from '../../../../../shared/source-control/ai/naming/branch-name-from-work' +import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { resolveSourceControlActionCommandTemplate, setSourceControlActionDefault -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { cn } from '@/lib/utils' import { useAppStore } from '../../../store/index' import { Button } from '../../ui/button' diff --git a/src/renderer/src/components/settings/source-control/BranchPrefixFeedback.tsx b/src/renderer/src/components/settings/source-control/BranchPrefixFeedback.tsx index d90de1d24f1..9029a38f457 100644 --- a/src/renderer/src/components/settings/source-control/BranchPrefixFeedback.tsx +++ b/src/renderer/src/components/settings/source-control/BranchPrefixFeedback.tsx @@ -1,5 +1,8 @@ import type { ReactNode } from 'react' -import { getBranchPrefixIssue, normalizeBranchPrefix } from '../../../../../shared/branch-prefix' +import { + getBranchPrefixIssue, + normalizeBranchPrefix +} from '../../../../../shared/git/branches/branch-prefix' import { translate } from '@/i18n/i18n' type BranchPrefixFeedbackProps = { diff --git a/src/renderer/src/components/settings/source-control/CommitMessageAiPane.test.tsx b/src/renderer/src/components/settings/source-control/CommitMessageAiPane.test.tsx index ec3af72775a..6e95f6a58d8 100644 --- a/src/renderer/src/components/settings/source-control/CommitMessageAiPane.test.tsx +++ b/src/renderer/src/components/settings/source-control/CommitMessageAiPane.test.tsx @@ -1,20 +1,20 @@ // @vitest-environment happy-dom import React from 'react' import recordings from '../../../../../shared/fixtures/source-control-launch-recordings.json' -import { normalizeSourceControlActionLaunchPreferences } from '../../../../../shared/source-control-action-model-selection' -import { sourceControlActionLaunchOptions } from '../../../../../shared/source-control-action-launch-preferences' +import { normalizeSourceControlActionLaunchPreferences } from '../../../../../shared/source-control/ai/recipes/source-control-action-model-selection' +import { sourceControlActionLaunchOptions } from '../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { buildAgentStartupPlan } from '../../../../../shared/agent-launch/startup/tui-agent-startup' import { describeSourceControlActionModel } from '../../right-sidebar/source-control/ai/source-control-action-model-copy' import { renderToStaticMarkup } from 'react-dom/server' import { cleanup, render } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it } from 'vitest' import type { GlobalSettings } from '../../../../../shared/global-settings-types' -import type { SourceControlAiSettings } from '../../../../../shared/source-control-ai-types' +import type { SourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { getCommitMessageModelDiscoveryHostKey, getCommitMessageModelDiscoveryHostKeyForLocalRuntime, getCommitMessageModelDiscoveryHostKeyForScope -} from '../../../../../shared/commit-message-host-key' +} from '../../../../../shared/source-control/ai/generation/commit-message-host-key' import { useAppStore } from '../../../store/index' import { CommitMessageAiPane, diff --git a/src/renderer/src/components/settings/source-control/CommitMessageAiPane.tsx b/src/renderer/src/components/settings/source-control/CommitMessageAiPane.tsx index 6a5c96cfef5..4f5ddf57353 100644 --- a/src/renderer/src/components/settings/source-control/CommitMessageAiPane.tsx +++ b/src/renderer/src/components/settings/source-control/CommitMessageAiPane.tsx @@ -6,20 +6,21 @@ import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-ag import type { SourceControlAiSettingsPatch, SourceControlAiSettings -} from '../../../../../shared/source-control-ai-types' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { normalizeSourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { - normalizeSourceControlAiSettings, readSourceControlAiModelChoiceForHost, - selectSourceControlAiModelChoiceForHost -} from '../../../../../shared/source-control-ai' -import { SOURCE_CONTROL_TEXT_ACTION_IDS } from '../../../../../shared/source-control-ai-actions' -import { withDiscoveredModels } from '../../../../../shared/source-control-ai-model-selection' + selectSourceControlAiModelChoiceForHost, + withDiscoveredModels +} from '../../../../../shared/source-control/ai/settings/source-control-ai-model-selection' +import { SOURCE_CONTROL_TEXT_ACTION_IDS } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' + import { CUSTOM_AGENT_ID, isCustomAgentId, type CommitMessageModelCapability -} from '../../../../../shared/commit-message-agent-spec' -import { getCommitMessageModelDiscoveryHostKeyForScope } from '../../../../../shared/commit-message-host-key' +} from '../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { getCommitMessageModelDiscoveryHostKeyForScope } from '../../../../../shared/source-control/ai/generation/commit-message-host-key' import { getRuntimeGitScope } from '../../../runtime/runtime-git-client-context' import { useAppStore } from '../../../store/index' import { CustomAgentCommandField } from './CustomAgentCommandField' diff --git a/src/renderer/src/components/settings/source-control/GitPane.tsx b/src/renderer/src/components/settings/source-control/GitPane.tsx index ea1d12c3cef..0db282d40c1 100644 --- a/src/renderer/src/components/settings/source-control/GitPane.tsx +++ b/src/renderer/src/components/settings/source-control/GitPane.tsx @@ -1,8 +1,8 @@ import { useEffect, useRef, useState } from 'react' import type { GlobalSettings } from '../../../../../shared/global-settings-types' import type { SourceControlGroupOrder } from '../../../../../shared/ui-chrome-types' -import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control-ai-types' -import { normalizeSourceControlGroupOrder } from '../../../../../shared/source-control-group-order' +import type { SourceControlAiSettingsPatch } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { normalizeSourceControlGroupOrder } from '../../../../../shared/source-control/listing/source-control-group-order' import { Input } from '../../ui/input' import { Label } from '../../ui/label' import { Switch } from '../../ui/switch' diff --git a/src/renderer/src/components/settings/source-control/HostedReviewCreationDefaults.tsx b/src/renderer/src/components/settings/source-control/HostedReviewCreationDefaults.tsx index 31f5b8b1440..92455a48ed2 100644 --- a/src/renderer/src/components/settings/source-control/HostedReviewCreationDefaults.tsx +++ b/src/renderer/src/components/settings/source-control/HostedReviewCreationDefaults.tsx @@ -1,4 +1,4 @@ -import type { SourceControlAiSettings } from '../../../../../shared/source-control-ai-types' +import type { SourceControlAiSettings } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { Label } from '../../ui/label' import { SearchableSetting } from '../section-layout/SearchableSetting' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/settings/source-control/SourceControlActionAgentPicker.tsx b/src/renderer/src/components/settings/source-control/SourceControlActionAgentPicker.tsx index c24b8d2f539..6c549b3799f 100644 --- a/src/renderer/src/components/settings/source-control/SourceControlActionAgentPicker.tsx +++ b/src/renderer/src/components/settings/source-control/SourceControlActionAgentPicker.tsx @@ -1,7 +1,7 @@ import { useUiLanguageRevision } from '@/i18n/use-ui-language-revision' import { sameAgentLaunchPickerModel } from '../../tab-bar/new-tab-agent-menu-model' import { memo, useCallback, useLayoutEffect, useRef, type ComponentProps } from 'react' -import { pickSourceControlLaunchAgent } from '../../../../../shared/source-control-launch-agent-selection' +import { pickSourceControlLaunchAgent } from '../../../../../shared/source-control/ai/source-control-launch-agent-selection' import { AgentLaunchPicker } from '@/components/agent/AgentLaunchPicker' import { DropdownMenuItem } from '@/components/ui/dropdown-menu' import { @@ -13,7 +13,7 @@ import { canonicalSourceControlActionSelection, pickSourceControlActionAgent, type CurrentActionSelection -} from '../../../../../shared/source-control-action-selection' +} from '../../../../../shared/source-control/ai/recipes/source-control-action-selection' import { useAgentMenuObservation } from '@/components/tab-bar/use-new-tab-agent-menu-rows' import { useAppStore } from '@/store/index' import { @@ -23,7 +23,7 @@ import { } from '@/lib/source-control-agent-picker' import { buildAgentLaunchRouteInput } from '@/lib/agent-launch-route-input' import { AGENT_LAUNCH_SURFACE_RUNTIME_CAPABILITY } from '../../../../../shared/agent-launch/contracts/agent-launch-runtime-capability' -import type { SourceControlActionRecipe } from '../../../../../shared/source-control-ai-actions' +import type { SourceControlActionRecipe } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/settings/source-control/SourceControlActionArguments.tsx b/src/renderer/src/components/settings/source-control/SourceControlActionArguments.tsx index 3b10f90609d..79b99451ae2 100644 --- a/src/renderer/src/components/settings/source-control/SourceControlActionArguments.tsx +++ b/src/renderer/src/components/settings/source-control/SourceControlActionArguments.tsx @@ -3,20 +3,20 @@ import { findCatalogModel, getAgentSessionOptionLaunchCatalog } from '../../../../../shared/agent-session/options/agent-session-option-catalog' -import { sourceControlActionOptions } from '../../../../../shared/source-control-action-options' +import { sourceControlActionOptions } from '../../../../../shared/source-control/ai/recipes/source-control-action-options' import { agentModelChoiceChips } from '../../agent/launch-settings/agent-model-choice-chips' import type { SourceControlActionLaunchPreferences, SourceControlActionRecipe -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { agentPermissionArgs, agentPermissionChoices, resolveAgentPermission } from '../../../../../shared/agent-launch/permissions/tui-agent-permission-choice' import { agentArgsSetPermission } from '../../../../../shared/agent-launch/permissions/agent-permission-args' -import { editActionArgumentChoices } from '../../../../../shared/source-control-action-argument-choices' -import type { ActionArgumentChoices } from '../../../../../shared/source-control-action-argument-document' +import { editActionArgumentChoices } from '../../../../../shared/source-control/ai/recipes/source-control-action-argument-choices' +import type { ActionArgumentChoices } from '../../../../../shared/source-control/ai/recipes/source-control-action-argument-document' import type { AgentChoicePatch, AgentLaunchChoices diff --git a/src/renderer/src/components/settings/source-control/SourceControlActionModelPicker.tsx b/src/renderer/src/components/settings/source-control/SourceControlActionModelPicker.tsx index 6f5891e6bbd..dc8e976a656 100644 --- a/src/renderer/src/components/settings/source-control/SourceControlActionModelPicker.tsx +++ b/src/renderer/src/components/settings/source-control/SourceControlActionModelPicker.tsx @@ -1,4 +1,4 @@ -import type { SourceControlActionLaunchPreferences } from '../../../../../shared/source-control-ai-actions' +import type { SourceControlActionLaunchPreferences } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { AgentChoiceControls, diff --git a/src/renderer/src/components/settings/source-control/SourceControlActionRecipeRow.tsx b/src/renderer/src/components/settings/source-control/SourceControlActionRecipeRow.tsx index de5146c01de..7aaf87c702a 100644 --- a/src/renderer/src/components/settings/source-control/SourceControlActionRecipeRow.tsx +++ b/src/renderer/src/components/settings/source-control/SourceControlActionRecipeRow.tsx @@ -1,27 +1,27 @@ -import { SourceControlTextActionAgentPicker } from '../SourceControlTextActionAgentPicker' -import type { SourceControlAiModelEdits } from '../../../../../shared/source-control-ai-action-model-edits' +import { SourceControlTextActionAgentPicker } from './text-actions/SourceControlTextActionAgentPicker' +import type { SourceControlAiModelEdits } from '../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' import type { SourceControlAiSettings, SourceControlAiModelChoice, SourceControlAiSettingsPatch -} from '../../../../../shared/source-control-ai-types' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { useAgentPickerDraftScope, invalidateAgentPickerDrafts } from '../../agent/agent-launch-picker-drafts' -import { canonicalSourceControlActionSelection } from '../../../../../shared/source-control-action-selection' -import type { ActionArgumentChoices } from '../../../../../shared/source-control-action-argument-document' +import { canonicalSourceControlActionSelection } from '../../../../../shared/source-control/ai/recipes/source-control-action-selection' +import type { ActionArgumentChoices } from '../../../../../shared/source-control/ai/recipes/source-control-action-argument-document' import { SourceControlActionAgentPicker } from './SourceControlActionAgentPicker' import type { GlobalSettings } from '../../../../../shared/global-settings-types' import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' -import type { CustomAgentId } from '../../../../../shared/commit-message-agent-spec' -import { isCustomAgentId } from '../../../../../shared/commit-message-agent-spec' +import type { CustomAgentId } from '../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { isCustomAgentId } from '../../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { SOURCE_CONTROL_ACTION_LABELS, type SourceControlActionRecipe, type AiActionId, type SourceControlActionLaunchPreferences -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { SourceControlActionVariableChips } from '../../source-control/SourceControlActionVariableChips' import { Button } from '../../ui/button' import { Input } from '../../ui/input' diff --git a/src/renderer/src/components/settings/source-control/SourceControlActionRepoOverrideNote.tsx b/src/renderer/src/components/settings/source-control/SourceControlActionRepoOverrideNote.tsx index 3ee86ff8cf0..2a916288ded 100644 --- a/src/renderer/src/components/settings/source-control/SourceControlActionRepoOverrideNote.tsx +++ b/src/renderer/src/components/settings/source-control/SourceControlActionRepoOverrideNote.tsx @@ -5,7 +5,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip' import type { SourceControlActionRecipeOverrideField, SourceControlActionRecipeOverrideSummary -} from '../../../../../shared/source-control-launch-agent-selection' +} from '../../../../../shared/source-control/ai/source-control-launch-agent-selection' import { translate } from '@/i18n/i18n' type SourceControlActionRepoOverrideNoteProps = { diff --git a/src/renderer/src/components/settings/source-control/SourceControlAiActionRecipeDefaults.tsx b/src/renderer/src/components/settings/source-control/SourceControlAiActionRecipeDefaults.tsx index a3d84df3f24..54836e65d0a 100644 --- a/src/renderer/src/components/settings/source-control/SourceControlAiActionRecipeDefaults.tsx +++ b/src/renderer/src/components/settings/source-control/SourceControlAiActionRecipeDefaults.tsx @@ -7,11 +7,11 @@ import { isFolderRepo } from '../../../../../shared/repo-kind' import type { SourceControlAiSettings, SourceControlAiSettingsPatch -} from '../../../../../shared/source-control-ai-types' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { CUSTOM_AGENT_ID, type CustomAgentId -} from '../../../../../shared/commit-message-agent-spec' +} from '../../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { SOURCE_CONTROL_ACTION_IDS, @@ -19,14 +19,14 @@ import { type SourceControlActionRecipe, type SourceControlActionId, type SourceControlAiActionDefaults -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { Label } from '../../ui/label' import { useAppStore } from '@/store/index' import { useRepos } from '@/store/selectors' import { summarizeReposOverridingActionRecipe, type SourceControlActionRecipeOverrideSummary -} from '../../../../../shared/source-control-launch-agent-selection' +} from '../../../../../shared/source-control/ai/source-control-launch-agent-selection' import { SearchableSetting } from '../section-layout/SearchableSetting' import { getRepositorySourceControlAiActionRecipeSectionId } from '../repository/repository-settings-targets' import { matchesSettingsSearch } from '../search/settings-search' diff --git a/src/renderer/src/components/settings/source-control/source-control-action-card-layout.test.tsx b/src/renderer/src/components/settings/source-control/source-control-action-card-layout.test.tsx index 7c49d12fd87..c1fc6a20b18 100644 --- a/src/renderer/src/components/settings/source-control/source-control-action-card-layout.test.tsx +++ b/src/renderer/src/components/settings/source-control/source-control-action-card-layout.test.tsx @@ -14,7 +14,7 @@ import * as pickerCatalog from '../../../../../shared/agent-session/options/agen import * as reconciliation from '../../../../../shared/agent-launch/choices/agent-choice-reconciliation' import * as launchProfile from '../../../../../shared/agent-launch/choices/agent-launch-profile' import { SourceControlActionAgentPicker } from './SourceControlActionAgentPicker' -import { canonicalSourceControlActionSelection } from '../../../../../shared/source-control-action-selection' +import { canonicalSourceControlActionSelection } from '../../../../../shared/source-control/ai/recipes/source-control-action-selection' import { act, fireEvent, render, screen, within, waitFor } from '@testing-library/react' import { afterEach, beforeEach, expect, it, vi } from 'vitest' import { pickerLocaleFixture } from '../__fixtures__/settings-persistence-test-fixture' @@ -24,7 +24,7 @@ import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-ag import type { AiActionId, SourceControlActionLaunchPreferences -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { STRUCTURED_AGENT_SESSION_REGISTERED_AGENTS_RUNTIME_CAPABILITY } from '../../../../../shared/agent-session/structured-agent-session-surface-capabilities' import { loadHostStructuredAgents, @@ -32,11 +32,11 @@ import { resetHostStructuredAgentsForTests } from '@/runtime/host-structured-agents' import { TooltipProvider } from '../../ui/tooltip' -import type { RepoSourceControlAiOverrides } from '../../../../../shared/source-control-ai-types' +import type { RepoSourceControlAiOverrides } from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { getDefaultSourceControlAiSettings, normalizeSourceControlAiSettings -} from '../../../../../shared/source-control-ai' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { RepositorySourceControlAiActionRows } from '../repository/source-control/RepositorySourceControlAiActionRows' import { SourceControlActionRecipeRow } from './SourceControlActionRecipeRow' @@ -368,7 +368,7 @@ it('labels an own raw Sonnet recipe from the same source as its setup chips', as expect(screen.getByRole('button', { name: 'Remove --model claude-sonnet-5-5' })).toBeDefined() ) const { projectSourceControlActionLaunch } = - await import('../../../../../shared/source-control-action-launch-preferences') + await import('../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences') const { resolveAgentStartupPlanInputs } = await import('../../../../../shared/agent-launch/startup/agent-startup-plan-inputs') const startupModule = await import('../../../../../shared/agent-launch/startup/tui-agent-startup') diff --git a/src/renderer/src/components/settings/source-control/source-control-action-permission-draft.test.tsx b/src/renderer/src/components/settings/source-control/source-control-action-permission-draft.test.tsx index 019958d3df0..44d27ce47b6 100644 --- a/src/renderer/src/components/settings/source-control/source-control-action-permission-draft.test.tsx +++ b/src/renderer/src/components/settings/source-control/source-control-action-permission-draft.test.tsx @@ -1,30 +1,30 @@ import { sourceControlActionSelectedPreferences, sourceControlActionAgentArgs -} from '../../../../../shared/source-control-action-launch-preferences' +} from '../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' // @vitest-environment happy-dom import { useState } from 'react' import { getDefaultSettings } from '../../../../../shared/constants' -import { resolveSourceControlActionRecipe } from '../../../../../shared/source-control-ai-operation-policy' +import { resolveSourceControlActionRecipe } from '../../../../../shared/source-control/ai/source-control-ai-operation-policy' import { act, fireEvent, render, renderHook, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import * as lifts from '../../../../../shared/source-control-action-permission-lift' +import * as lifts from '../../../../../shared/source-control/ai/recipes/source-control-action-permission-lift' import * as shell from '../../../../../shared/agent-launch/startup/tui-agent-startup-shell' import { expect, it, vi } from 'vitest' import '../__fixtures__/settings-persistence-test-fixture' import { getDefaultSourceControlAiSettings, normalizeSourceControlAiSettings -} from '../../../../../shared/source-control-ai' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import type { RepoSourceControlAiOverrides, SourceControlAiSettings -} from '../../../../../shared/source-control-ai-types' -import { liftActionPermissionArgs } from '../../../../../shared/source-control-action-permission-lift' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { liftActionPermissionArgs } from '../../../../../shared/source-control/ai/recipes/source-control-action-permission-lift' import { normalizeSourceControlActionRecipe, type SourceControlActionRecipe -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { agentPermissionArgsForLaunch } from '../../../../../shared/agent-launch/permissions/agent-permission-args' import { SourceControlActionArguments } from './SourceControlActionArguments' import { useRepositorySourceControlAiGlobalUx } from '../repository/source-control/repository-source-control-ai-global-ux' diff --git a/src/renderer/src/components/settings/source-control/source-control-action-recipe-draft-state.ts b/src/renderer/src/components/settings/source-control/source-control-action-recipe-draft-state.ts index b87efe01e4f..2f3c21f0a3e 100644 --- a/src/renderer/src/components/settings/source-control/source-control-action-recipe-draft-state.ts +++ b/src/renderer/src/components/settings/source-control/source-control-action-recipe-draft-state.ts @@ -2,22 +2,22 @@ import { transportActionArgumentChoices, demoteActionArgumentChoices, type ActionArgumentChoices -} from '../../../../../shared/source-control-action-argument-document' -import { liftActionPermissionArgs } from '../../../../../shared/source-control-action-permission-lift' +} from '../../../../../shared/source-control/ai/recipes/source-control-action-argument-document' +import { liftActionPermissionArgs } from '../../../../../shared/source-control/ai/recipes/source-control-action-permission-lift' import { useEffect, useMemo, useRef, useState, type SetStateAction } from 'react' import type { SourceControlAiSettings, SourceControlAiModelChoice, SourceControlAiSettingsPatch -} from '../../../../../shared/source-control-ai-types' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { setSourceControlActionDefault, SOURCE_CONTROL_TEXT_ACTION_IDS, type SourceControlActionLaunchPreferences, type SourceControlActionId -} from '../../../../../shared/source-control-ai-actions' -import type { SourceControlAiModelEdits } from '../../../../../shared/source-control-ai-action-model-edits' -import { replayGlobalTextModelEdits } from '../source-control-text-action-model-replay' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiModelEdits } from '../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' +import { replayGlobalTextModelEdits } from './text-actions/source-control-text-action-model-replay' import { type ActionRecipeDraftState, readActionRecipeInputValues, diff --git a/src/renderer/src/components/settings/source-control-action-recipe-draft-sync.test.tsx b/src/renderer/src/components/settings/source-control/source-control-action-recipe-draft-sync.test.tsx similarity index 94% rename from src/renderer/src/components/settings/source-control-action-recipe-draft-sync.test.tsx rename to src/renderer/src/components/settings/source-control/source-control-action-recipe-draft-sync.test.tsx index 39973c9da8e..15fd75b1de0 100644 --- a/src/renderer/src/components/settings/source-control-action-recipe-draft-sync.test.tsx +++ b/src/renderer/src/components/settings/source-control/source-control-action-recipe-draft-sync.test.tsx @@ -5,14 +5,14 @@ import { useAppStore } from '@/store/index' import { getDefaultSourceControlAiSettings, normalizeSourceControlAiSettings -} from '../../../../shared/source-control-ai-settings' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' import type { SourceControlAiSettings, SourceControlAiSettingsPatch -} from '../../../../shared/source-control-ai-types' -import { useSourceControlActionRecipeDraftState } from './source-control/source-control-action-recipe-draft-state' -import { renderGlobalCommitCard } from './__fixtures__/global-commit-card-test-fixture' -import { persist } from './__fixtures__/settings-persistence-test-fixture' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { useSourceControlActionRecipeDraftState } from './source-control-action-recipe-draft-state' +import { renderGlobalCommitCard } from '../__fixtures__/global-commit-card-test-fixture' +import { persist } from '../__fixtures__/settings-persistence-test-fixture' const initial = (): SourceControlAiSettings => ({ ...getDefaultSourceControlAiSettings(), diff --git a/src/renderer/src/components/settings/source-control/source-control-action-recipe-options.ts b/src/renderer/src/components/settings/source-control/source-control-action-recipe-options.ts index 05552727bd6..e95c89ace64 100644 --- a/src/renderer/src/components/settings/source-control/source-control-action-recipe-options.ts +++ b/src/renderer/src/components/settings/source-control/source-control-action-recipe-options.ts @@ -3,14 +3,14 @@ import { AI_TEXT_ACTION_IDS, SOURCE_CONTROL_TEXT_ACTION_IDS, type AiActionId -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { CUSTOM_AGENT_ID, type CustomAgentId, getCommitMessageAgentCapability, isCustomAgentId, listCommitMessageAgentCapabilities -} from '../../../../../shared/commit-message-agent-spec' +} from '../../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { getAgentCatalog, type AgentCatalogEntry } from '@/lib/agent-catalog' import { createLocalizedCatalog } from '@/i18n/localized-catalog' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/settings/source-control/source-control-ai-action-recipe-draft.ts b/src/renderer/src/components/settings/source-control/source-control-ai-action-recipe-draft.ts index 3f2a88809ec..60823a8d73a 100644 --- a/src/renderer/src/components/settings/source-control/source-control-ai-action-recipe-draft.ts +++ b/src/renderer/src/components/settings/source-control/source-control-ai-action-recipe-draft.ts @@ -1,16 +1,16 @@ import type { SourceControlAiSettings, SourceControlAiModelChoice -} from '../../../../../shared/source-control-ai-types' -import { readActionModelSelection } from '../../../../../shared/source-control-action-model-selection' -import type { SourceControlAiModelEdits } from '../../../../../shared/source-control-ai-action-model-edits' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import { readActionModelSelection } from '../../../../../shared/source-control/ai/recipes/source-control-action-model-selection' +import type { SourceControlAiModelEdits } from '../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, SOURCE_CONTROL_ACTION_IDS, type SourceControlActionLaunchPreferences, type SourceControlActionRecipe, type SourceControlActionId -} from '../../../../../shared/source-control-ai-actions' +} from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' export type ActionRecipeDraftValue = { modelChoice?: SourceControlAiModelChoice diff --git a/src/renderer/src/components/settings/source-control/source-control-ai-settings-persistence.test.tsx b/src/renderer/src/components/settings/source-control/source-control-ai-settings-persistence.test.tsx index 4ec96cb6089..95f68ed3ae2 100644 --- a/src/renderer/src/components/settings/source-control/source-control-ai-settings-persistence.test.tsx +++ b/src/renderer/src/components/settings/source-control/source-control-ai-settings-persistence.test.tsx @@ -12,8 +12,8 @@ import { settingsModel, type SettingsPersistenceModel } from '../__fixtures__/settings-persistence-test-fixture' -import * as selection from '../../../../../shared/source-control-launch-agent-selection' -import * as lifts from '../../../../../shared/source-control-action-permission-lift' +import * as selection from '../../../../../shared/source-control/ai/source-control-launch-agent-selection' +import * as lifts from '../../../../../shared/source-control/ai/recipes/source-control-action-permission-lift' import * as shell from '../../../../../shared/agent-launch/startup/tui-agent-startup-shell' import { TooltipProvider } from '../../ui/tooltip' import { RUNTIME_CAPABILITIES } from '../../../../../shared/protocol-version' @@ -21,7 +21,7 @@ import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-cap import { getDefaultSourceControlAiSettings, normalizeSourceControlAiSettings -} from '../../../../../shared/source-control-ai' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' vi.mock('sonner', () => ({ toast: { error: vi.fn(), success: vi.fn(), info: vi.fn(), dismiss: vi.fn() } @@ -653,7 +653,7 @@ it.each( const { makeWorktree } = await import('@/store/slices/worktrees-slice-test-fixtures') const { planAgentSessionLaunch } = await import('@/lib/agent-session-launch-plan') const { projectSourceControlActionLaunch } = - await import('../../../../../shared/source-control-action-launch-preferences') + await import('../../../../../shared/source-control/ai/recipes/source-control-action-launch-preferences') for (const selected of ['terminal', 'chat'] as const) { if (selected === 'chat') { await open() diff --git a/src/renderer/src/components/settings/source-control/source-control-ai-settings-picker-retention.test.tsx b/src/renderer/src/components/settings/source-control/source-control-ai-settings-picker-retention.test.tsx index c5a34f9ff6f..8f5189563eb 100644 --- a/src/renderer/src/components/settings/source-control/source-control-ai-settings-picker-retention.test.tsx +++ b/src/renderer/src/components/settings/source-control/source-control-ai-settings-picker-retention.test.tsx @@ -17,7 +17,7 @@ import { setLocalRuntimeCapabilitiesForTests } from '@/runtime/local-runtime-cap import { getDefaultSourceControlAiSettings, normalizeSourceControlAiSettings -} from '../../../../../shared/source-control-ai' +} from '../../../../../shared/source-control/ai/settings/source-control-ai-settings' vi.mock('sonner', () => ({ toast: { error: vi.fn(), success: vi.fn(), info: vi.fn(), dismiss: vi.fn() } })) diff --git a/src/renderer/src/components/settings/SourceControlTextActionAgentPicker.tsx b/src/renderer/src/components/settings/source-control/text-actions/SourceControlTextActionAgentPicker.tsx similarity index 87% rename from src/renderer/src/components/settings/SourceControlTextActionAgentPicker.tsx rename to src/renderer/src/components/settings/source-control/text-actions/SourceControlTextActionAgentPicker.tsx index 32121d8792a..9c1e28c835c 100644 --- a/src/renderer/src/components/settings/SourceControlTextActionAgentPicker.tsx +++ b/src/renderer/src/components/settings/source-control/text-actions/SourceControlTextActionAgentPicker.tsx @@ -1,3 +1,7 @@ +import type { + TextModelChange, + TextActionPickerProps +} from './source-control-text-action-picker-props' import { memo, useCallback, useLayoutEffect, useMemo, useRef } from 'react' import { shallow } from 'zustand/shallow' import { useShallow } from 'zustand/react/shallow' @@ -8,71 +12,40 @@ import { translate } from '@/i18n/i18n' import { getRepoExecutionHostId, parseRoutableExecutionHostId -} from '../../../../shared/execution-host' +} from '../../../../../../shared/execution-host' import { getRepoCommitMessageModelDiscoveryHostKey, LOCAL_COMMIT_MESSAGE_HOST_KEY -} from '../../../../shared/commit-message-host-key' +} from '../../../../../../shared/source-control/ai/generation/commit-message-host-key' import { getCommitMessageAgentCapability, isCustomAgentId, resolveCommitMessageAgentChoice -} from '../../../../shared/commit-message-agent-spec' +} from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' import { getDiscoveredModels, readSourceControlAiModelChoiceForHost, resolveThinkingLevel -} from '../../../../shared/source-control-ai-model-selection' -import { - normalizeSourceControlAiSettings, - projectSourceControlAiToLegacyCommitMessageAi, - resolveSourceControlAiActionModelDefault -} from '../../../../shared/source-control-ai' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-model-selection' +import { normalizeSourceControlAiSettings } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { projectSourceControlAiToLegacyCommitMessageAi } from '../../../../../../shared/source-control/ai/settings/source-control-ai-legacy-projection' +import { resolveSourceControlAiActionModelDefault } from '../../../../../../shared/source-control/ai/source-control-ai-operation-resolution' import { saveSourceControlTextPickerDraft } from './source-control-text-action-picker-save' import { registeredRepoTextModelHostKeys } from './source-control-text-action-model-replay' -import type { SourceControlAiModelEdits } from '../../../../shared/source-control-ai-action-model-edits' + import { useTextActionModelDiscovery } from './use-text-action-model-discovery' import { textActionPickerEntryView } from './source-control-text-action-picker-entries' -import { AI_TEXT_ACTION_IDS, type AiActionId } from '../../../../shared/source-control-ai-actions' -import type { - RepoSourceControlAiOverrides, - SourceControlAiModelChoice, - SourceControlAiSettings, - SourceControlAiSettingsPatch -} from '../../../../shared/source-control-ai-types' +import { AI_TEXT_ACTION_IDS } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { SourceControlAiSettingsPatch } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' import { agentPickerDraft, agentPickerEffectiveChoices, type AgentPickerEntry, type AgentPickerDraft -} from '../../../../shared/agent-launch/picker/agent-launch-picker' -import { SourceControlActionAgentPicker } from './source-control/SourceControlActionAgentPicker' -import { getAgentCatalogForAction } from './source-control/source-control-action-recipe-options' -import { DropdownMenuItem } from '../ui/dropdown-menu' -import type { ActionRecipeDraftValue } from './source-control/source-control-ai-action-recipe-draft' -import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' - -type TextModelChange = ( - choice: SourceControlAiModelChoice | undefined, - agentArgs: string, - edits: SourceControlAiModelEdits | undefined -) => void - -type TextActionPickerProps = { - actionId: AiActionId - agent: TuiAgent | 'custom' | null - source?: SourceControlAiSettings - repoId?: string - repoAi?: RepoSourceControlAiOverrides - draft: ActionRecipeDraftValue - draftScope?: object - disabled?: boolean - defaultAgentLabel?: string - onAgentChange: (value: string) => void - onChange?: TextModelChange - /** Saves model lists the CLI reports; without it the menu shows only saved lists. */ - writeSourceControlAiSettings?: (patch: SourceControlAiSettingsPatch) => Promise -} +} from '../../../../../../shared/agent-launch/picker/agent-launch-picker' +import { SourceControlActionAgentPicker } from '../SourceControlActionAgentPicker' +import { getAgentCatalogForAction } from '../source-control-action-recipe-options' +import { DropdownMenuItem } from '../../../ui/dropdown-menu' export function SourceControlTextActionAgentPicker(props: TextActionPickerProps) { const current = useRef(props) diff --git a/src/renderer/src/components/settings/source-control-text-action-model-replay.ts b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-model-replay.ts similarity index 86% rename from src/renderer/src/components/settings/source-control-text-action-model-replay.ts rename to src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-model-replay.ts index 6c7abf7f035..a3a44ddd787 100644 --- a/src/renderer/src/components/settings/source-control-text-action-model-replay.ts +++ b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-model-replay.ts @@ -1,20 +1,20 @@ import { useAppStore } from '@/store/index' import { getIndexedReposById } from '@/store/worktree-repo-index' -import { getRepoCommitMessageModelDiscoveryHostKey } from '../../../../shared/commit-message-host-key' +import { getRepoCommitMessageModelDiscoveryHostKey } from '../../../../../../shared/source-control/ai/generation/commit-message-host-key' import { replaySourceControlAiModelEdits, type SourceControlAiModelEdits -} from '../../../../shared/source-control-ai-action-model-edits' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' import { SOURCE_CONTROL_TEXT_ACTION_IDS, type SourceControlActionId -} from '../../../../shared/source-control-ai-actions' +} from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { AiTextOperation, RepoSourceControlAiOverrides, SourceControlAiModelChoice, SourceControlAiSettings -} from '../../../../shared/source-control-ai-types' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' /** The hosts a global text pick covers: every registered repository's, read when called. */ export function registeredRepoTextModelHostKeys(): string[] { diff --git a/src/renderer/src/components/settings/source-control-text-action-picker-entries.ts b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-entries.ts similarity index 80% rename from src/renderer/src/components/settings/source-control-text-action-picker-entries.ts rename to src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-entries.ts index c9ff789f913..108a316347c 100644 --- a/src/renderer/src/components/settings/source-control-text-action-picker-entries.ts +++ b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-entries.ts @@ -1,7 +1,7 @@ import { translate } from '@/i18n/i18n' -import type { AgentPickerEntry } from '../../../../shared/agent-launch/picker/agent-launch-picker' -import { getCommitMessageAgentSpec } from '../../../../shared/commit-message-agent-spec' -import { removeSourceControlAiArgumentFlag } from '../../../../shared/source-control-ai-argument-flags' +import type { AgentPickerEntry } from '../../../../../../shared/agent-launch/picker/agent-launch-picker' +import { getCommitMessageAgentSpec } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { removeSourceControlAiArgumentFlag } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-argument-flags' /** Per-render facts for a text entry: its default row label and what the card's Arguments own. */ export function textActionPickerEntryView( diff --git a/src/renderer/src/components/settings/source-control-text-action-picker-persistence.test.tsx b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-persistence.test.tsx similarity index 94% rename from src/renderer/src/components/settings/source-control-text-action-picker-persistence.test.tsx rename to src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-persistence.test.tsx index b0fe7561a7f..ff4ba7ada5d 100644 --- a/src/renderer/src/components/settings/source-control-text-action-picker-persistence.test.tsx +++ b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-persistence.test.tsx @@ -1,11 +1,11 @@ // @vitest-environment happy-dom import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react' import { expect, it, vi } from 'vitest' -import { normalizeSourceControlAiSettings } from '../../../../shared/source-control-ai' -import { useAppStore } from '../../store/index' -import { persist, settingsModel } from './__fixtures__/settings-persistence-test-fixture' -import { ChatPersistenceHarness } from './__fixtures__/chat-persistence-harness-test-fixture' -import { renderGlobalCommitCard } from './__fixtures__/global-commit-card-test-fixture' +import { normalizeSourceControlAiSettings } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { useAppStore } from '../../../../store/index' +import { persist, settingsModel } from '../../__fixtures__/settings-persistence-test-fixture' +import { ChatPersistenceHarness } from '../../__fixtures__/chat-persistence-harness-test-fixture' +import { renderGlobalCommitCard } from '../../__fixtures__/global-commit-card-test-fixture' it('keeps inherited Chat naming unbound through configured Use, Discard and Save', async () => { const settings = useAppStore.getState().settings! diff --git a/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-props.ts b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-props.ts new file mode 100644 index 00000000000..1a65a4e2d41 --- /dev/null +++ b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-props.ts @@ -0,0 +1,32 @@ +import type { SourceControlAiModelEdits } from '../../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' +import type { AiActionId } from '../../../../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { + RepoSourceControlAiOverrides, + SourceControlAiModelChoice, + SourceControlAiSettings, + SourceControlAiSettingsPatch +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import type { ActionRecipeDraftValue } from '../source-control-ai-action-recipe-draft' +import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' + +export type TextModelChange = ( + choice: SourceControlAiModelChoice | undefined, + agentArgs: string, + edits: SourceControlAiModelEdits | undefined +) => void + +export type TextActionPickerProps = { + actionId: AiActionId + agent: TuiAgent | 'custom' | null + source?: SourceControlAiSettings + repoId?: string + repoAi?: RepoSourceControlAiOverrides + draft: ActionRecipeDraftValue + draftScope?: object + disabled?: boolean + defaultAgentLabel?: string + onAgentChange: (value: string) => void + onChange?: TextModelChange + /** Saves model lists the CLI reports; without it the menu shows only saved lists. */ + writeSourceControlAiSettings?: (patch: SourceControlAiSettingsPatch) => Promise +} diff --git a/src/renderer/src/components/settings/source-control-text-action-picker-save.ts b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-save.ts similarity index 85% rename from src/renderer/src/components/settings/source-control-text-action-picker-save.ts rename to src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-save.ts index 4a23c3be903..69808f28810 100644 --- a/src/renderer/src/components/settings/source-control-text-action-picker-save.ts +++ b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-save.ts @@ -2,22 +2,22 @@ import { agentPickerEffectiveChoices, type AgentPickerEntry, type AgentPickerDraft -} from '../../../../shared/agent-launch/picker/agent-launch-picker' -import { saveSourceControlAiActionModelChoice } from '../../../../shared/source-control-ai-action-model-choice' +} from '../../../../../../shared/agent-launch/picker/agent-launch-picker' +import { saveSourceControlAiActionModelChoice } from '../../../../../../shared/source-control/ai/settings/source-control-ai-action-model-choice' import { addSourceControlAiModelEdit, type SourceControlAiModelEdit, type SourceControlAiModelEdits -} from '../../../../shared/source-control-ai-action-model-edits' -import { textActionArgumentsOwnEffort } from '../../../../shared/agent-launch/picker/agent-launch-picker-text-action' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-action-model-edits' +import { textActionArgumentsOwnEffort } from '../../../../../../shared/agent-launch/picker/agent-launch-picker-text-action' import type { AiTextOperation, SourceControlAiSettings, SourceControlAiModelChoice, RepoSourceControlAiOverrides -} from '../../../../shared/source-control-ai-types' -import type { GlobalSettings } from '../../../../shared/global-settings-types' -import type { Repo } from '../../../../shared/repo-types' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import type { GlobalSettings } from '../../../../../../shared/global-settings-types' +import type { Repo } from '../../../../../../shared/repo-types' export function saveSourceControlTextPickerDraft({ source, diff --git a/src/renderer/src/components/settings/source-control-text-action-picker-scale.test.tsx b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-scale.test.tsx similarity index 95% rename from src/renderer/src/components/settings/source-control-text-action-picker-scale.test.tsx rename to src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-scale.test.tsx index 4fa7b871650..d6d3350a4a7 100644 --- a/src/renderer/src/components/settings/source-control-text-action-picker-scale.test.tsx +++ b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-picker-scale.test.tsx @@ -3,12 +3,12 @@ import { act, render, screen } from '@testing-library/react' import { beforeEach, expect, it, vi } from 'vitest' import { useAppStore } from '@/store/index' import { TEST_REPO } from '@/store/slices/worktrees-slice-test-fixtures' -import { getDefaultSettings } from '../../../../shared/constants' +import { getDefaultSettings } from '../../../../../../shared/constants' import { getDefaultSourceControlAiSettings, normalizeSourceControlAiSettings -} from '../../../../shared/source-control-ai' -import { TooltipProvider } from '../ui/tooltip' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import { TooltipProvider } from '../../../ui/tooltip' import { SourceControlTextActionAgentPicker } from './SourceControlTextActionAgentPicker' const unused = vi.fn() diff --git a/src/renderer/src/components/settings/source-control-text-action-repo-discovery.test.tsx b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-repo-discovery.test.tsx similarity index 92% rename from src/renderer/src/components/settings/source-control-text-action-repo-discovery.test.tsx rename to src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-repo-discovery.test.tsx index ad049e6583d..41f68a7fa57 100644 --- a/src/renderer/src/components/settings/source-control-text-action-repo-discovery.test.tsx +++ b/src/renderer/src/components/settings/source-control/text-actions/source-control-text-action-repo-discovery.test.tsx @@ -4,14 +4,14 @@ import { afterEach, beforeEach, expect, it, vi } from 'vitest' import { useAppStore } from '@/store/index' import type * as GenerationClient from '@/runtime/runtime-git-generation-client' import { makeWorktree, TEST_REPO } from '@/store/slices/worktrees-slice-test-fixtures' -import { getDefaultSettings } from '../../../../shared/constants' +import { getDefaultSettings } from '../../../../../../shared/constants' import { getDefaultSourceControlAiSettings, normalizeSourceControlAiSettings -} from '../../../../shared/source-control-ai' -import type { SourceControlAiSettingsPatch } from '../../../../shared/source-control-ai-types' -import type { Repo } from '../../../../shared/repo-types' -import { TooltipProvider } from '../ui/tooltip' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' +import type { SourceControlAiSettingsPatch } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import type { Repo } from '../../../../../../shared/repo-types' +import { TooltipProvider } from '../../../ui/tooltip' import { SourceControlTextActionAgentPicker } from './SourceControlTextActionAgentPicker' const discover = vi.hoisted(() => vi.fn()) diff --git a/src/renderer/src/components/settings/use-text-action-model-discovery.ts b/src/renderer/src/components/settings/source-control/text-actions/use-text-action-model-discovery.ts similarity index 81% rename from src/renderer/src/components/settings/use-text-action-model-discovery.ts rename to src/renderer/src/components/settings/source-control/text-actions/use-text-action-model-discovery.ts index 8eb760cf2da..7557f3b2391 100644 --- a/src/renderer/src/components/settings/use-text-action-model-discovery.ts +++ b/src/renderer/src/components/settings/source-control/text-actions/use-text-action-model-discovery.ts @@ -3,16 +3,16 @@ import { useAppStore } from '@/store/index' import { selectWorktreesByRepo } from '@/store/workspace-record-selectors' import { discoverRuntimeCommitMessageModels } from '@/runtime/runtime-git-generation-client' import type { RuntimeGitContext } from '@/runtime/runtime-git-client-context' -import { resolveWorktreeModelDiscoveryRuntime } from '../native-chat/native-chat-session-option-discovery' -import { getCommitMessageAgentCapability } from '../../../../shared/commit-message-agent-spec' -import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../../../shared/commit-message-host-key' -import { normalizeSourceControlAiSettings } from '../../../../shared/source-control-ai' +import { resolveWorktreeModelDiscoveryRuntime } from '../../../native-chat/native-chat-session-option-discovery' +import { getCommitMessageAgentCapability } from '../../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../../../../../../shared/source-control/ai/generation/commit-message-host-key' +import { normalizeSourceControlAiSettings } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings' import { getDiscoveredModels, withDiscoveredModels -} from '../../../../shared/source-control-ai-model-selection' -import type { SourceControlAiSettingsPatch } from '../../../../shared/source-control-ai-types' -import type { TuiAgent } from '../../../../shared/agent-launch/catalog/tui-agent' +} from '../../../../../../shared/source-control/ai/settings/source-control-ai-model-selection' +import type { SourceControlAiSettingsPatch } from '../../../../../../shared/source-control/ai/settings/source-control-ai-settings-types' +import type { TuiAgent } from '../../../../../../shared/agent-launch/catalog/tui-agent' // One listing per host and agent at a time, however many cards open their picker. const pending = new Map>() diff --git a/src/renderer/src/components/settings/source-control/use-source-control-action-agent.ts b/src/renderer/src/components/settings/source-control/use-source-control-action-agent.ts index 7b770f3c946..9dae1e5f710 100644 --- a/src/renderer/src/components/settings/source-control/use-source-control-action-agent.ts +++ b/src/renderer/src/components/settings/source-control/use-source-control-action-agent.ts @@ -1,8 +1,8 @@ import { useEffect } from 'react' import type { TuiAgent } from '../../../../../shared/agent-launch/catalog/tui-agent' -import { isCustomAgentId } from '../../../../../shared/commit-message-agent-spec' -import { pickSourceControlLaunchAgent } from '../../../../../shared/source-control-launch-agent-selection' -import type { SourceControlActionRecipe } from '../../../../../shared/source-control-ai-actions' +import { isCustomAgentId } from '../../../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { pickSourceControlLaunchAgent } from '../../../../../shared/source-control/ai/source-control-launch-agent-selection' +import type { SourceControlActionRecipe } from '../../../../../shared/source-control/ai/recipes/source-control-ai-actions' import type { GlobalSettings } from '../../../../../shared/global-settings-types' import { readNativeDetectedAgents } from '@/store/slices/local-detected-agent-store-state' import { useAppStore } from '@/store/index' diff --git a/src/renderer/src/components/sidebar/DeleteWorktreeDirtyChangeHint.tsx b/src/renderer/src/components/sidebar/DeleteWorktreeDirtyChangeHint.tsx index 186b582edc0..e9a2d481a51 100644 --- a/src/renderer/src/components/sidebar/DeleteWorktreeDirtyChangeHint.tsx +++ b/src/renderer/src/components/sidebar/DeleteWorktreeDirtyChangeHint.tsx @@ -2,7 +2,8 @@ import type { JSX } from 'react' import { AlertTriangle, ChevronRight } from 'lucide-react' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover' import { translate } from '@/i18n/i18n' -import { STATUS_COLORS, STATUS_LABELS } from '../right-sidebar/status-display' +import { STATUS_COLORS } from '../right-sidebar/status-display' +import { STATUS_LABELS } from '../../../../shared/git/status/git-status-labels' import type { DeleteWorktreeChangeCheckState, DeleteWorktreeDirtyChangePreview diff --git a/src/renderer/src/components/sidebar/DeleteWorktreeTargetPreview.test.tsx b/src/renderer/src/components/sidebar/DeleteWorktreeTargetPreview.test.tsx index a93ec554d1b..f34997d40af 100644 --- a/src/renderer/src/components/sidebar/DeleteWorktreeTargetPreview.test.tsx +++ b/src/renderer/src/components/sidebar/DeleteWorktreeTargetPreview.test.tsx @@ -11,7 +11,7 @@ import { getDeleteWorktreeDirtyChangePreview, type DeleteWorktreeDirtyChangePreview } from './delete-worktree-dirty-change-counts' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' function buildHostLabels( diff --git a/src/renderer/src/components/sidebar/PreservedBranchBatchReviewDialog.tsx b/src/renderer/src/components/sidebar/PreservedBranchBatchReviewDialog.tsx index d232bbb25a4..c1bbcb3815b 100644 --- a/src/renderer/src/components/sidebar/PreservedBranchBatchReviewDialog.tsx +++ b/src/renderer/src/components/sidebar/PreservedBranchBatchReviewDialog.tsx @@ -2,7 +2,7 @@ import { useMemo, useState } from 'react' import { Trash2 } from 'lucide-react' import { getRepoIdFromWorktreeId } from '../../../../shared/worktree/id' import { translate } from '@/i18n/i18n' -import type { PreservedBranchCleanup } from '@/lib/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../shared/git/branches/preserved-branch-cleanup' import { useAppStore } from '@/store' import { Button } from '../ui/button' import { Checkbox } from '../ui/checkbox' @@ -15,7 +15,7 @@ import { DialogTitle } from '../ui/dialog' import { Label } from '../ui/label' -import { preservedBranchCleanupKey } from '@/lib/preserved-branch-cleanup' +import { preservedBranchCleanupKey } from '../../../../shared/git/branches/preserved-branch-cleanup' type ActionablePreservedBranch = PreservedBranchCleanup & { expectedHead: string } diff --git a/src/renderer/src/components/sidebar/PreservedBranchBatchReviewModal.tsx b/src/renderer/src/components/sidebar/PreservedBranchBatchReviewModal.tsx index 34bdbc9d4e8..81a60e96655 100644 --- a/src/renderer/src/components/sidebar/PreservedBranchBatchReviewModal.tsx +++ b/src/renderer/src/components/sidebar/PreservedBranchBatchReviewModal.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react' -import type { PreservedBranchCleanup } from '@/lib/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../shared/git/branches/preserved-branch-cleanup' import { useAppStore } from '@/store' import { PreservedBranchBatchReviewDialog } from './PreservedBranchBatchReviewDialog' import { diff --git a/src/renderer/src/components/sidebar/WorkspaceReviewChecksIndicator.tsx b/src/renderer/src/components/sidebar/WorkspaceReviewChecksIndicator.tsx index 6c6e11b83c3..feaba36d928 100644 --- a/src/renderer/src/components/sidebar/WorkspaceReviewChecksIndicator.tsx +++ b/src/renderer/src/components/sidebar/WorkspaceReviewChecksIndicator.tsx @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../../shared/source-control/checks/provider-check-summary' import React from 'react' import { translate } from '@/i18n/i18n' import type { WorkspaceReviewChecksSummary } from '../../../../shared/workspace-review-checks' diff --git a/src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx b/src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx index f8fdafc8c77..825fd3a8242 100644 --- a/src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCard.compact-hover.test.tsx @@ -2,7 +2,7 @@ import { renderToStaticMarkup } from 'react-dom/server' import React, { type ReactNode } from 'react' import { beforeEach, describe, expect, it, vi } from 'vitest' import type { DashboardAgentRow as DashboardAgentRowData } from '@/components/dashboard/useDashboardData' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Repo } from '../../../../shared/repo-types' import type { WorktreeCardProperty } from '../../../../shared/ui-chrome-types' diff --git a/src/renderer/src/components/sidebar/WorktreeCard.pr-display.test.tsx b/src/renderer/src/components/sidebar/WorktreeCard.pr-display.test.tsx index 7b03b8ad777..9f979faf857 100644 --- a/src/renderer/src/components/sidebar/WorktreeCard.pr-display.test.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCard.pr-display.test.tsx @@ -1,7 +1,7 @@ import { renderToStaticMarkup } from 'react-dom/server' import type { ReactNode } from 'react' import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRInfo } from '../../../../shared/github/pull-request-types' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Repo } from '../../../../shared/repo-types' diff --git a/src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx b/src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx index a9696182e27..7aa48a4a702 100644 --- a/src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx @@ -1,7 +1,7 @@ import { renderToStaticMarkup } from 'react-dom/server' import type { ReactNode } from 'react' import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest' -import type { GitConflictOperation } from '../../../../shared/git-status-types' +import type { GitConflictOperation } from '../../../../shared/git/status/git-status-types' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Repo } from '../../../../shared/repo-types' import type { WorktreeCardProperty } from '../../../../shared/ui-chrome-types' diff --git a/src/renderer/src/components/sidebar/WorktreeCardHelpers.tsx b/src/renderer/src/components/sidebar/WorktreeCardHelpers.tsx index 3492ca2e402..0ecd42b7a6a 100644 --- a/src/renderer/src/components/sidebar/WorktreeCardHelpers.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCardHelpers.tsx @@ -1,6 +1,6 @@ import React from 'react' -import type { GitConflictOperation } from '../../../../shared/git-status-types' -import type { CheckPresentationOutcome } from '../../../../shared/provider-check-summary' +import type { GitConflictOperation } from '../../../../shared/git/status/git-status-types' +import type { CheckPresentationOutcome } from '../../../../shared/source-control/checks/provider-check-summary' import type { TerminalTab } from '../../../../shared/terminal-tab-types' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/sidebar/WorktreeCardMetadataStatusBadges.tsx b/src/renderer/src/components/sidebar/WorktreeCardMetadataStatusBadges.tsx index 77eac2f120f..d39d9e77bb0 100644 --- a/src/renderer/src/components/sidebar/WorktreeCardMetadataStatusBadges.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCardMetadataStatusBadges.tsx @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../../shared/source-control/checks/provider-check-summary' import React from 'react' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { getReviewChecksTone } from './worktree-review-helpers' diff --git a/src/renderer/src/components/sidebar/WorktreeCardStatusSlot.test.tsx b/src/renderer/src/components/sidebar/WorktreeCardStatusSlot.test.tsx index 00cc00ec0c1..a806514d52d 100644 --- a/src/renderer/src/components/sidebar/WorktreeCardStatusSlot.test.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCardStatusSlot.test.tsx @@ -5,7 +5,7 @@ import { i18n } from '@/i18n/i18n' import ko from '@/i18n/locales/ko.json' import { WorktreeCardStatusSlot } from './WorktreeCardStatusSlot' import { getWorktreeCardPrDisplay, type WorktreeCardPrDisplay } from './worktree-card-pr-display' -import { gitlabMrCheckCases } from '../../../../shared/gitlab-mr-checks.test-fixture' +import { gitlabMrCheckCases } from '../../../../shared/source-control/checks/gitlab/gitlab-mr-checks.test-fixture' import { buildParentPrChecksProjection } from '../right-sidebar/parent-pr-checks-rows' import { FolderWorkspacePrChecksRow } from '../right-sidebar/FolderWorkspacePrChecksRow' import { presentGitLabMRMergeState } from '../right-sidebar/gitlab-mr-merge-state' diff --git a/src/renderer/src/components/sidebar/WorktreeCardStatusSlot.tsx b/src/renderer/src/components/sidebar/WorktreeCardStatusSlot.tsx index 6d60c195ed3..89925115008 100644 --- a/src/renderer/src/components/sidebar/WorktreeCardStatusSlot.tsx +++ b/src/renderer/src/components/sidebar/WorktreeCardStatusSlot.tsx @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../../shared/source-control/checks/provider-check-summary' import React from 'react' import { Bell, GitBranch, Moon } from 'lucide-react' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' diff --git a/src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx b/src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx index b152f036872..b650f4bf875 100644 --- a/src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx +++ b/src/renderer/src/components/sidebar/WorktreeList.lineage-child-real-card.test.tsx @@ -8,7 +8,7 @@ import { act, type ReactNode } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest' import type { FolderWorkspace } from '../../../../shared/folder-workspace-types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { ProjectGroup } from '../../../../shared/project-group-types' import type { Repo } from '../../../../shared/repo-types' import type { WorktreeCardProperty } from '../../../../shared/ui-chrome-types' diff --git a/src/renderer/src/components/sidebar/WorktreeReferenceStack.test.tsx b/src/renderer/src/components/sidebar/WorktreeReferenceStack.test.tsx index 81c1f1209be..49a088c4543 100644 --- a/src/renderer/src/components/sidebar/WorktreeReferenceStack.test.tsx +++ b/src/renderer/src/components/sidebar/WorktreeReferenceStack.test.tsx @@ -4,7 +4,7 @@ import { afterEach, describe, expect, it } from 'vitest' import { WorktreeReferenceStack } from './WorktreeReferenceStack' import { getWorkspaceAttachmentKey } from '../../../../shared/workspace-attachment-normalization' import { referenceAttachment, referenceReview } from './workspace-reference-fixtures.test-support' -import { summarizeProviderChecks } from '../../../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../../shared/source-control/checks/provider-check-summary' afterEach(cleanup) describe('fixed workspace reference stacks', () => { diff --git a/src/renderer/src/components/sidebar/WorktreeReferenceStack.tsx b/src/renderer/src/components/sidebar/WorktreeReferenceStack.tsx index 22c8bc9f774..e9a602c8612 100644 --- a/src/renderer/src/components/sidebar/WorktreeReferenceStack.tsx +++ b/src/renderer/src/components/sidebar/WorktreeReferenceStack.tsx @@ -3,7 +3,7 @@ import { CircleDot } from 'lucide-react' import { LinearIcon } from '@/components/icons/LinearIcon' import { JiraIcon } from '@/components/icons/JiraIcon' import { getWorkspaceAttachmentKey } from '../../../../shared/workspace-attachment-normalization' -import { getProviderChecksOutcome } from '../../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../../shared/source-control/checks/provider-check-summary' import type { WorkspaceAttachment } from '../../../../shared/worktree/types' import { ReviewIcon } from './worktree-review-helpers' import { workspaceAttachmentLabel } from './worktree-attachment-editing' diff --git a/src/renderer/src/components/sidebar/cancelled-pr-checks.test.tsx b/src/renderer/src/components/sidebar/cancelled-pr-checks.test.tsx index 3005a008376..d7289cc35f1 100644 --- a/src/renderer/src/components/sidebar/cancelled-pr-checks.test.tsx +++ b/src/renderer/src/components/sidebar/cancelled-pr-checks.test.tsx @@ -7,7 +7,7 @@ import { CircleCheck } from 'lucide-react' import { summarizeProviderChecks, getProviderChecksOutcome -} from '../../../../shared/provider-check-summary' +} from '../../../../shared/source-control/checks/provider-check-summary' import { summarizeWorkspaceReviewChecks } from '../../../../shared/workspace-review-checks' import { getWorkspaceAttachmentKey } from '../../../../shared/workspace-attachment-normalization' import type { GitHubWorkItem } from '../../../../shared/github/work-item-types' diff --git a/src/renderer/src/components/sidebar/delete-worktree-dirty-change-counts.test.ts b/src/renderer/src/components/sidebar/delete-worktree-dirty-change-counts.test.ts index 07cb1452332..bc4fd565d5e 100644 --- a/src/renderer/src/components/sidebar/delete-worktree-dirty-change-counts.test.ts +++ b/src/renderer/src/components/sidebar/delete-worktree-dirty-change-counts.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import type { Worktree } from '../../../../shared/worktree/types' import type { Repo } from '../../../../shared/repo-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' import { getDeleteWorktreeChangeCheckStates, diff --git a/src/renderer/src/components/sidebar/delete-worktree-dirty-change-counts.ts b/src/renderer/src/components/sidebar/delete-worktree-dirty-change-counts.ts index a8c23a10025..3a9eb7f5e46 100644 --- a/src/renderer/src/components/sidebar/delete-worktree-dirty-change-counts.ts +++ b/src/renderer/src/components/sidebar/delete-worktree-dirty-change-counts.ts @@ -1,5 +1,5 @@ import type { Repo } from '../../../../shared/repo-types' -import type { GitFileStatus, GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitFileStatus, GitStatusEntry } from '../../../../shared/git/status/git-status-types' import type { Worktree } from '../../../../shared/worktree/types' import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' import type { WorktreeDeleteState } from '../../store/slices/worktree-helpers' diff --git a/src/renderer/src/components/sidebar/delete-worktree-dirty-change-hydration.test.tsx b/src/renderer/src/components/sidebar/delete-worktree-dirty-change-hydration.test.tsx index 7be56891bc7..f07f6281b2b 100644 --- a/src/renderer/src/components/sidebar/delete-worktree-dirty-change-hydration.test.tsx +++ b/src/renderer/src/components/sidebar/delete-worktree-dirty-change-hydration.test.tsx @@ -5,7 +5,7 @@ import { useMemo, type JSX } from 'react' import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { Worktree } from '../../../../shared/worktree/types' -import type { GitStatusResult } from '../../../../shared/git-status-types' +import type { GitStatusResult } from '../../../../shared/git/status/git-status-types' import type { Repo } from '../../../../shared/repo-types' import { DeleteWorktreeTargetPreview } from './DeleteWorktreeTargetPreview' diff --git a/src/renderer/src/components/sidebar/folder-workspace-card-pr-display.test.ts b/src/renderer/src/components/sidebar/folder-workspace-card-pr-display.test.ts index 92b78cefdc1..c7447a39bea 100644 --- a/src/renderer/src/components/sidebar/folder-workspace-card-pr-display.test.ts +++ b/src/renderer/src/components/sidebar/folder-workspace-card-pr-display.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { createElement } from 'react' import { renderToStaticMarkup } from 'react-dom/server' -import { summarizeProviderChecks } from '../../../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../../shared/source-control/checks/provider-check-summary' import type { CheckStatus, PRInfo } from '../../../../shared/github/pull-request-types' import type { Repo } from '../../../../shared/repo-types' import type { WorkspaceLineage, WorktreeLineage } from '../../../../shared/worktree/lineage-types' diff --git a/src/renderer/src/components/sidebar/folder-workspace-card-pr-display.ts b/src/renderer/src/components/sidebar/folder-workspace-card-pr-display.ts index 7355bf0c03e..f1ff6d95ef5 100644 --- a/src/renderer/src/components/sidebar/folder-workspace-card-pr-display.ts +++ b/src/renderer/src/components/sidebar/folder-workspace-card-pr-display.ts @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../../shared/source-control/checks/provider-check-summary' import type { AppState } from '@/store/types' import type { Repo } from '../../../../shared/repo-types' import type { WorkspaceLineage, WorktreeLineage } from '../../../../shared/worktree/lineage-types' diff --git a/src/renderer/src/components/sidebar/preserved-branch-batch-toast.test.tsx b/src/renderer/src/components/sidebar/preserved-branch-batch-toast.test.tsx index 0a3cf2e7dda..3979c26852d 100644 --- a/src/renderer/src/components/sidebar/preserved-branch-batch-toast.test.tsx +++ b/src/renderer/src/components/sidebar/preserved-branch-batch-toast.test.tsx @@ -4,7 +4,7 @@ import { act } from 'react' import { createRoot, type Root } from 'react-dom/client' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { toast } from 'sonner' -import type { PreservedBranchCleanup } from '@/lib/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../shared/git/branches/preserved-branch-cleanup' import PreservedBranchBatchReviewModal from './PreservedBranchBatchReviewModal' import { forceDeletePreservedBranchBatch, diff --git a/src/renderer/src/components/sidebar/preserved-branch-batch-toast.tsx b/src/renderer/src/components/sidebar/preserved-branch-batch-toast.tsx index 46762bf1390..9f1b43b83e3 100644 --- a/src/renderer/src/components/sidebar/preserved-branch-batch-toast.tsx +++ b/src/renderer/src/components/sidebar/preserved-branch-batch-toast.tsx @@ -5,7 +5,7 @@ import { translate } from '@/i18n/i18n' import { mapWithConcurrency } from '../../../../shared/map-with-concurrency' import { getRepoIdFromWorktreeId } from '../../../../shared/worktree/id' import { Button } from '../ui/button' -import type { PreservedBranchCleanup } from '@/lib/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../shared/git/branches/preserved-branch-cleanup' const BRANCH_REPO_DELETE_CONCURRENCY = 4 diff --git a/src/renderer/src/components/sidebar/use-delete-worktree-status-hydration.ts b/src/renderer/src/components/sidebar/use-delete-worktree-status-hydration.ts index 10b40339032..1ffbda24a0e 100644 --- a/src/renderer/src/components/sidebar/use-delete-worktree-status-hydration.ts +++ b/src/renderer/src/components/sidebar/use-delete-worktree-status-hydration.ts @@ -7,7 +7,7 @@ import { getRuntimeGitStatus } from '@/runtime/runtime-git-status-client' import { findRepoForHost } from '@/store/slices/repo-host-identity' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' -import type { GitStatusResult } from '../../../../shared/git-status-types' +import type { GitStatusResult } from '../../../../shared/git/status/git-status-types' import { getWorktreeHostIdentity } from '../../../../shared/worktree/host-qualified-identity' import { isFolderWorkspaceDelete } from './delete-worktree-dialog-copy' import { orderDeleteWorktreeStatusHydrationTargets } from './delete-worktree-dirty-change-counts' diff --git a/src/renderer/src/components/sidebar/use-worktree-card-review-details.ts b/src/renderer/src/components/sidebar/use-worktree-card-review-details.ts index 621cec44e7b..03117461d94 100644 --- a/src/renderer/src/components/sidebar/use-worktree-card-review-details.ts +++ b/src/renderer/src/components/sidebar/use-worktree-card-review-details.ts @@ -8,8 +8,8 @@ import { useAppStore } from '@/store' import { getGitHubPRCacheKey } from '../../../../shared/github/github-cache-key' import { issueCacheKey as getIssueCacheKey } from '@/store/github/cache-identity' import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-identity' -import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/hosted-review-github' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/source-control/hosted-review/hosted-review-github' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { isFolderRepo } from '../../../../shared/repo-kind' import { areTaskSourceContextsEqual } from '../../../../shared/task-source-context' import { parseWorkspaceKey } from '../../../../shared/workspace-scope' diff --git a/src/renderer/src/components/sidebar/workspace-card/default-workspace-card.parity.test.tsx b/src/renderer/src/components/sidebar/workspace-card/default-workspace-card.parity.test.tsx index 8b24d572629..ed789bed02c 100644 --- a/src/renderer/src/components/sidebar/workspace-card/default-workspace-card.parity.test.tsx +++ b/src/renderer/src/components/sidebar/workspace-card/default-workspace-card.parity.test.tsx @@ -5,7 +5,7 @@ import { renderToStaticMarkup } from 'react-dom/server' import { act, cleanup, render, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { GlobalSettings } from '../../../../../shared/global-settings-types' -import type { HostedReviewInfo } from '../../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../../shared/repo-types' import type { WorktreeCardProperty } from '../../../../../shared/ui-chrome-types' import type { Worktree } from '../../../../../shared/worktree/types' diff --git a/src/renderer/src/components/sidebar/workspace-reference-detail-read.test.ts b/src/renderer/src/components/sidebar/workspace-reference-detail-read.test.ts index 672c6279ff4..3d77ad3d06c 100644 --- a/src/renderer/src/components/sidebar/workspace-reference-detail-read.test.ts +++ b/src/renderer/src/components/sidebar/workspace-reference-detail-read.test.ts @@ -1,7 +1,7 @@ // @vitest-environment happy-dom import { linearIssueReadFixture } from '@/store/slices/linear-slice-test-harness' import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { LinearIssue } from '../../../../shared/linear/issue-types' import { normalizeTaskSourceContext } from '../../../../shared/task-source-context' import { readWorkspaceReferenceDetails } from './workspace-reference-detail-read' diff --git a/src/renderer/src/components/sidebar/workspace-reference-details.ts b/src/renderer/src/components/sidebar/workspace-reference-details.ts index c83f302f9a1..dbdfe8649df 100644 --- a/src/renderer/src/components/sidebar/workspace-reference-details.ts +++ b/src/renderer/src/components/sidebar/workspace-reference-details.ts @@ -13,7 +13,7 @@ import { import { getWorkspaceAttachments } from '../../../../shared/workspace-attachments' import { getWorkspaceAttachmentSourceContext } from './workspace-attachment-source-result' import type { WorktreeCardPrDisplay } from './worktree-card-pr-display' -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { getProviderRuntimeContextKey } from '@/lib/provider-runtime-context' import { getRuntimeEnvironmentRevision } from '@/runtime/runtime-environment-revision' diff --git a/src/renderer/src/components/sidebar/workspace-reference-fixtures.test-support.ts b/src/renderer/src/components/sidebar/workspace-reference-fixtures.test-support.ts index 312d8f0010c..d0841ab48a9 100644 --- a/src/renderer/src/components/sidebar/workspace-reference-fixtures.test-support.ts +++ b/src/renderer/src/components/sidebar/workspace-reference-fixtures.test-support.ts @@ -1,6 +1,6 @@ import type { Worktree, WorkspaceAttachment } from '../../../../shared/worktree/types' import type { Repo } from '../../../../shared/repo-types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { LinearIssue } from '../../../../shared/linear/issue-types' export const referenceRepo: Repo = { diff --git a/src/renderer/src/components/sidebar/workspace-reference-review-source.ts b/src/renderer/src/components/sidebar/workspace-reference-review-source.ts index 423a9c98047..bbe9ac20258 100644 --- a/src/renderer/src/components/sidebar/workspace-reference-review-source.ts +++ b/src/renderer/src/components/sidebar/workspace-reference-review-source.ts @@ -1,5 +1,5 @@ import { getRepoExecutionHostId } from '../../../../shared/execution-host' -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { canUseWorkspaceReviewForChecks, isWorkspaceRepositoryAttachment diff --git a/src/renderer/src/components/sidebar/worktree-attachment-editing.ts b/src/renderer/src/components/sidebar/worktree-attachment-editing.ts index ffe70954a0d..4970f2aa363 100644 --- a/src/renderer/src/components/sidebar/worktree-attachment-editing.ts +++ b/src/renderer/src/components/sidebar/worktree-attachment-editing.ts @@ -1,8 +1,8 @@ -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { WorkspaceAttachmentMutation } from '../../../../shared/workspace-attachment-mutation' import { translate } from '@/i18n/i18n' import type { Repo } from '../../../../shared/repo-types' -import { normalizeGitRemoteUrl } from '../../../../shared/git-remote-identity' +import { normalizeGitRemoteUrl } from '../../../../shared/git/remotes/git-remote-identity' import type { WorkspaceAttachment, Worktree } from '../../../../shared/worktree/types' import type { WorktreeMeta } from '../../../../shared/worktree/meta-types' import { diff --git a/src/renderer/src/components/sidebar/worktree-card-pr-display.test.ts b/src/renderer/src/components/sidebar/worktree-card-pr-display.test.ts index f03f540e52d..a53370cc24f 100644 --- a/src/renderer/src/components/sidebar/worktree-card-pr-display.test.ts +++ b/src/renderer/src/components/sidebar/worktree-card-pr-display.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { PRInfo } from '../../../../shared/github/pull-request-types' import { getWorktreeCardPrDisplay, diff --git a/src/renderer/src/components/sidebar/worktree-card-pr-display.ts b/src/renderer/src/components/sidebar/worktree-card-pr-display.ts index b7871caeae6..1270c39fb89 100644 --- a/src/renderer/src/components/sidebar/worktree-card-pr-display.ts +++ b/src/renderer/src/components/sidebar/worktree-card-pr-display.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { translate } from '@/i18n/i18n' import type { PRInfo } from '../../../../shared/github/pull-request-types' import type { Worktree } from '../../../../shared/worktree/types' diff --git a/src/renderer/src/components/sidebar/worktree-delete-execution.ts b/src/renderer/src/components/sidebar/worktree-delete-execution.ts index d44a7e4fb71..f74412cf0c8 100644 --- a/src/renderer/src/components/sidebar/worktree-delete-execution.ts +++ b/src/renderer/src/components/sidebar/worktree-delete-execution.ts @@ -16,7 +16,7 @@ import { } from '../../../../shared/worktree/removal' import { showWorkspaceListChangedToast } from './stale-workspace-list-toast' import { showPreservedBranchBatchToast } from './preserved-branch-batch-toast' -import type { PreservedBranchCleanup } from '@/lib/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../shared/git/branches/preserved-branch-cleanup' import type { WorktreeDeleteWithToastOptions } from './worktree-delete-request' import { beginWorktreeSnapshotPruneBatch } from './worktree-snapshot-prune-batch' import { runWorktreeDeleteWithToast } from './run-worktree-delete-with-toast' diff --git a/src/renderer/src/components/sidebar/worktree-delete-request.ts b/src/renderer/src/components/sidebar/worktree-delete-request.ts index bcf9475015e..504ed4cf752 100644 --- a/src/renderer/src/components/sidebar/worktree-delete-request.ts +++ b/src/renderer/src/components/sidebar/worktree-delete-request.ts @@ -1,6 +1,6 @@ import type { ConfirmedUnsavedDiscards } from '@/store/slices/worktrees/teardown/removed-workspace-unsaved-files' import type { Worktree } from '../../../../shared/worktree/types' -import type { PreservedBranchCleanup } from '@/lib/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../shared/git/branches/preserved-branch-cleanup' import { normalizeExecutionHostId } from '../../../../shared/execution-host' import type { ExecutionHostId } from '../../../../shared/execution-host' import type { WorktreeRemovalTarget } from '../../../../shared/worktree/removal' diff --git a/src/renderer/src/components/sidebar/worktree-review-helpers.tsx b/src/renderer/src/components/sidebar/worktree-review-helpers.tsx index 4edc6304956..4ac0c8bc7bd 100644 --- a/src/renderer/src/components/sidebar/worktree-review-helpers.tsx +++ b/src/renderer/src/components/sidebar/worktree-review-helpers.tsx @@ -1,7 +1,7 @@ import { getProviderChecksOutcome, type CheckPresentationOutcome -} from '../../../../shared/provider-check-summary' +} from '../../../../shared/source-control/checks/provider-check-summary' import { createElement } from 'react' import { GitMerge } from 'lucide-react' import { cn } from '@/lib/utils' diff --git a/src/renderer/src/components/source-control/SourceControlActionVariableChips.tsx b/src/renderer/src/components/source-control/SourceControlActionVariableChips.tsx index 176428e89fc..aa5ff688ccc 100644 --- a/src/renderer/src/components/source-control/SourceControlActionVariableChips.tsx +++ b/src/renderer/src/components/source-control/SourceControlActionVariableChips.tsx @@ -5,8 +5,8 @@ import { SOURCE_CONTROL_ACTION_VARIABLE_INFO, SOURCE_CONTROL_ACTION_VARIABLES, type SourceControlActionVariable -} from '../../../../shared/source-control-ai-action-variables' -import type { AiActionId } from '../../../../shared/source-control-ai-actions' +} from '../../../../shared/source-control/ai/recipes/source-control-ai-action-variables' +import type { AiActionId } from '../../../../shared/source-control/ai/recipes/source-control-ai-actions' import { Button } from '../ui/button' import { HoverCard, HoverCardContent, HoverCardTrigger } from '../ui/hover-card' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/source-control/source-control-variable-description.ts b/src/renderer/src/components/source-control/source-control-variable-description.ts index 59e96158cea..e8c0b1f54c0 100644 --- a/src/renderer/src/components/source-control/source-control-variable-description.ts +++ b/src/renderer/src/components/source-control/source-control-variable-description.ts @@ -1,5 +1,5 @@ import { translate } from '@/i18n/i18n' -import type { SourceControlActionVariable } from '../../../../shared/source-control-ai-action-variables' +import type { SourceControlActionVariable } from '../../../../shared/source-control/ai/recipes/source-control-ai-action-variables' export function sourceControlVariableDescription(variable: SourceControlActionVariable): string { switch (variable) { diff --git a/src/renderer/src/components/status-bar/hosted-review-label.ts b/src/renderer/src/components/status-bar/hosted-review-label.ts index 97428c26206..f0bb752a931 100644 --- a/src/renderer/src/components/status-bar/hosted-review-label.ts +++ b/src/renderer/src/components/status-bar/hosted-review-label.ts @@ -1,6 +1,6 @@ import type { ProviderCheckSummary } from '../../../../shared/github/pull-request-types' -import { getProviderChecksOutcome } from '../../../../shared/provider-check-summary' -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import { getProviderChecksOutcome } from '../../../../shared/source-control/checks/provider-check-summary' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { localizedHostedReviewCopy, resolveSupportedHostedReviewCopyProvider diff --git a/src/renderer/src/components/status-bar/use-workspace-space-manager-bindings.ts b/src/renderer/src/components/status-bar/use-workspace-space-manager-bindings.ts index 282e3e6c0af..29ef0c15aa1 100644 --- a/src/renderer/src/components/status-bar/use-workspace-space-manager-bindings.ts +++ b/src/renderer/src/components/status-bar/use-workspace-space-manager-bindings.ts @@ -1,5 +1,5 @@ import { useRef, useState } from 'react' -import type { GitStatusResult } from '../../../../shared/git-status-types' +import type { GitStatusResult } from '../../../../shared/git/status/git-status-types' import { useAppStore } from '../../store' import { getRepoMapFromState, getWorktreeMapFromState } from '../../store/selectors' import type { 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 f4420c3b949..a343b7ca978 100644 --- a/src/renderer/src/components/status-bar/workspace-space-changes.tsx +++ b/src/renderer/src/components/status-bar/workspace-space-changes.tsx @@ -1,13 +1,14 @@ import { useMemo, useState } from 'react' import { ChevronRight } from 'lucide-react' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import type { WorkspaceSpaceWorktree } from '../../../../shared/workspace-space-types' import { FileTypeIcon } from '../FileTypeIcon' 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, STATUS_LABELS } from '../right-sidebar/status-display' +import { STATUS_COLORS } from '../right-sidebar/status-display' +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' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/status-bar/workspace-space-decision-details.ts b/src/renderer/src/components/status-bar/workspace-space-decision-details.ts index 1b65920cd5b..6c17bdf8958 100644 --- a/src/renderer/src/components/status-bar/workspace-space-decision-details.ts +++ b/src/renderer/src/components/status-bar/workspace-space-decision-details.ts @@ -1,7 +1,7 @@ import type { AgentStatusEntry } from '../../../../shared/agent-status/contracts/agent-status-types' import type { MigrationUnsupportedPtyEntry } from '../../../../shared/agent-status/contracts/agent-status-ipc-payload' import type { ExecutionHostId } from '../../../../shared/execution-host' -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import type { TerminalTab } from '../../../../shared/terminal-tab-types' import type { Worktree } from '../../../../shared/worktree/types' diff --git a/src/renderer/src/components/status-bar/workspace-space-open-change.ts b/src/renderer/src/components/status-bar/workspace-space-open-change.ts index 289e25ea3f5..40d866d0f8d 100644 --- a/src/renderer/src/components/status-bar/workspace-space-open-change.ts +++ b/src/renderer/src/components/status-bar/workspace-space-open-change.ts @@ -1,6 +1,6 @@ import { toast } from 'sonner' import { LOCAL_EXECUTION_HOST_ID, type ExecutionHostId } from '../../../../shared/execution-host' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import type { WorkspaceSpaceWorktree } from '../../../../shared/workspace-space-types' import type { WorkspaceSpaceChange } from '../../../../shared/workspace-space-change' import { useAppStore } from '@/store' diff --git a/src/renderer/src/components/status-bar/workspace-space-state-resolution.ts b/src/renderer/src/components/status-bar/workspace-space-state-resolution.ts index 2883d621b99..e08f7ba278c 100644 --- a/src/renderer/src/components/status-bar/workspace-space-state-resolution.ts +++ b/src/renderer/src/components/status-bar/workspace-space-state-resolution.ts @@ -1,4 +1,4 @@ -import type { GitStatusResult } from '../../../../shared/git-status-types' +import type { GitStatusResult } from '../../../../shared/git/status/git-status-types' import type { WorkspaceSpaceWorktree } from '../../../../shared/workspace-space-types' import { getWorkspaceSpaceWorktreeIdentity } from './workspace-space-delete-selection' import type { WorkspaceSpaceDeleteState } from './workspace-space-manager-state-types' diff --git a/src/renderer/src/components/status-bar/workspace-space-worktree-row.tsx b/src/renderer/src/components/status-bar/workspace-space-worktree-row.tsx index 3944c210fa7..7e270af4701 100644 --- a/src/renderer/src/components/status-bar/workspace-space-worktree-row.tsx +++ b/src/renderer/src/components/status-bar/workspace-space-worktree-row.tsx @@ -1,6 +1,6 @@ import { AlertTriangle, GitBranch, Server, Trash2 } from 'lucide-react' import type { WorkspaceSpaceWorktree } from '../../../../shared/workspace-space-types' -import type { GitStatusEntry } from '../../../../shared/git-status-types' +import type { GitStatusEntry } from '../../../../shared/git/status/git-status-types' import { cn } from '@/lib/utils' import { Badge } from '../ui/badge' import { Button } from '../ui/button' diff --git a/src/renderer/src/components/tab-bar/EditorFileTab.tsx b/src/renderer/src/components/tab-bar/EditorFileTab.tsx index b353a64ad79..8a053fcb8d5 100644 --- a/src/renderer/src/components/tab-bar/EditorFileTab.tsx +++ b/src/renderer/src/components/tab-bar/EditorFileTab.tsx @@ -1,3 +1,4 @@ +import type { EditorFileTabProps } from './editor-file-tab-props' import { ContextMenu, ContextMenuTrigger } from '@/components/ui/context-menu' import { useCallback, useEffect, useRef, useState } from 'react' import { useSortable } from '@dnd-kit/sortable' @@ -12,19 +13,18 @@ import { detectLanguage } from '@/lib/language-detect' import { FileTypeIcon } from '@/components/FileTypeIcon' import { useRepoById, useWorktreeById } from '@/store/selectors' import { useAppStore } from '@/store' -import { STATUS_COLORS, STATUS_LABELS } from '../right-sidebar/status-display' -import type { GitFileStatus } from '../../../../shared/git-status-types' -import type { OpenFile } from '../../store/slices/editor' +import { STATUS_COLORS } from '../right-sidebar/status-display' +import { STATUS_LABELS } from '../../../../shared/git/status/git-status-labels' + import { getUntitledFileRoot } from '@/components/editor/untitled-file-rename-path' import { preventMiddleButtonDefault } from './middle-button-default-guard' import { CLOSE_ALL_CONTEXT_MENUS_EVENT } from '@/lib/close-all-context-menus' -import type { TabDragItemData } from '../tab-group/useTabDragSplit' + import { ACTIVE_TAB_INDICATOR_CLASSES, getDropIndicatorClasses, getTabRootStateClasses, - getTabStripBorderClasses, - type DropIndicator + getTabStripBorderClasses } from './drop-indicator' import { canOpenMarkdownPreview } from '@/components/editor/markdown-preview-controls' import { EditorFileTabContextMenu } from './EditorFileTabContextMenu' @@ -58,27 +58,7 @@ export default function EditorFileTab({ dragData, dropIndicator, includeTopTabBorder = true -}: { - file: OpenFile & { tabId?: string } - isActive: boolean - isPinned: boolean - hasTabsToRight: boolean - hasTabsToLeft: boolean - tabCount: number - gitStatus: GitFileStatus | null - onActivate: () => void - onClose: () => void - onCloseOthers: () => void - onCloseToRight: () => void - onCloseToLeft: () => void - onCloseSplitPane?: () => void - onCloseAll: () => void - onMakePermanent?: () => void - onTogglePin: () => void - dragData: TabDragItemData - dropIndicator?: DropIndicator - includeTopTabBorder?: boolean -}): React.JSX.Element { +}: EditorFileTabProps): React.JSX.Element { const worktree = useWorktreeById(file.worktreeId) const repo = useRepoById(worktree?.repoId ?? null) // Keep dragged tabs anchored; only the insertion bar moves. diff --git a/src/renderer/src/components/tab-bar/TabBarItemRow.tsx b/src/renderer/src/components/tab-bar/TabBarItemRow.tsx index 660fea71316..bbce5ed0954 100644 --- a/src/renderer/src/components/tab-bar/TabBarItemRow.tsx +++ b/src/renderer/src/components/tab-bar/TabBarItemRow.tsx @@ -2,7 +2,7 @@ import { memo } from 'react' import { useAppStore } from '@/store' import { useTranslation } from 'react-i18next' import { shallow } from 'zustand/shallow' -import type { GitFileStatus } from '../../../../shared/git-status-types' +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' import type { OpenFile } from '../../store/slices/editor' import SortableTab from './SortableTab' import TerminalSortableTab from './TerminalSortableTab' diff --git a/src/renderer/src/components/tab-bar/editor-file-tab-props.ts b/src/renderer/src/components/tab-bar/editor-file-tab-props.ts new file mode 100644 index 00000000000..1f5d4b67e70 --- /dev/null +++ b/src/renderer/src/components/tab-bar/editor-file-tab-props.ts @@ -0,0 +1,26 @@ +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' +import type { OpenFile } from '../../store/slices/editor' +import type { TabDragItemData } from '../tab-group/useTabDragSplit' +import type { DropIndicator } from './drop-indicator' + +export type EditorFileTabProps = { + file: OpenFile & { tabId?: string } + isActive: boolean + isPinned: boolean + hasTabsToRight: boolean + hasTabsToLeft: boolean + tabCount: number + gitStatus: GitFileStatus | null + onActivate: () => void + onClose: () => void + onCloseOthers: () => void + onCloseToRight: () => void + onCloseToLeft: () => void + onCloseSplitPane?: () => void + onCloseAll: () => void + onMakePermanent?: () => void + onTogglePin: () => void + dragData: TabDragItemData + dropIndicator?: DropIndicator + includeTopTabBorder?: boolean +} diff --git a/src/renderer/src/components/tab-bar/tab-bar-item-model.git-status.test.ts b/src/renderer/src/components/tab-bar/tab-bar-item-model.git-status.test.ts index 9679e842d83..2bb0b09d036 100644 --- a/src/renderer/src/components/tab-bar/tab-bar-item-model.git-status.test.ts +++ b/src/renderer/src/components/tab-bar/tab-bar-item-model.git-status.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, afterEach, vi } from 'vitest' -import type { GitFileStatus } from '../../../../shared/git-status-types' +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' import { resolveEditorTabGitStatus } from './tab-bar-item-model' const statusByRelativePath = new Map([['index.html', 'modified']]) diff --git a/src/renderer/src/components/tab-bar/tab-bar-item-model.ts b/src/renderer/src/components/tab-bar/tab-bar-item-model.ts index 04d57963ffc..02191ec24e9 100644 --- a/src/renderer/src/components/tab-bar/tab-bar-item-model.ts +++ b/src/renderer/src/components/tab-bar/tab-bar-item-model.ts @@ -5,7 +5,7 @@ import { } from '@/runtime/structured-chat-tab-name' import type { AppState } from '@/store/types' import type { BrowserTab as BrowserTabState } from '../../../../shared/browser-workspace-types' -import type { GitFileStatus } from '../../../../shared/git-status-types' +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' import type { Tab, WorkspaceVisibleTabType } from '../../../../shared/tab-types' import type { TerminalTab } from '../../../../shared/terminal-tab-types' import { resolveTerminalTabTitle } from '../../../../shared/tab-title-resolution' diff --git a/src/renderer/src/components/tab-bar/use-tab-bar-item-projection.ts b/src/renderer/src/components/tab-bar/use-tab-bar-item-projection.ts index 6bb6a727342..25fc23688be 100644 --- a/src/renderer/src/components/tab-bar/use-tab-bar-item-projection.ts +++ b/src/renderer/src/components/tab-bar/use-tab-bar-item-projection.ts @@ -1,6 +1,6 @@ import { useStructuredChatTabNames } from '@/runtime/structured-chat-name-observation' import { useMemo, useState } from 'react' -import type { GitFileStatus } from '../../../../shared/git-status-types' +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' import type { Tab } from '../../../../shared/tab-types' import type { TabBarProps } from './tab-bar-props' import { 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 8edfef53478..a04b684df4b 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 @@ -1,6 +1,6 @@ import { useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' -import type { GitFileStatus } from '../../../../shared/git-status-types' +import type { GitFileStatus } from '../../../../shared/git/status/git-status-types' import type { GlobalSettings } from '../../../../shared/global-settings-types' import type { Tab } from '../../../../shared/tab-types' import type { ProjectExecutionRuntimeResolution } from '../../../../shared/project-execution-runtime' diff --git a/src/renderer/src/components/task-page/github/ChecksCell.tsx b/src/renderer/src/components/task-page/github/ChecksCell.tsx index 07c50221a5b..1967d102a4b 100644 --- a/src/renderer/src/components/task-page/github/ChecksCell.tsx +++ b/src/renderer/src/components/task-page/github/ChecksCell.tsx @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../../../../../shared/provider-check-summary' +import { getProviderChecksOutcome } from '../../../../../shared/source-control/checks/provider-check-summary' import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types' import React, { useRef, useEffect } from 'react' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/components/task-page/task-page-checks-pill.ts b/src/renderer/src/components/task-page/task-page-checks-pill.ts index c658565507d..6a0d165b69b 100644 --- a/src/renderer/src/components/task-page/task-page-checks-pill.ts +++ b/src/renderer/src/components/task-page/task-page-checks-pill.ts @@ -2,7 +2,7 @@ import { translate } from '@/i18n/i18n' import { getProviderChecksLabel, getProviderChecksOutcome -} from '../../../../shared/provider-check-summary' +} from '../../../../shared/source-control/checks/provider-check-summary' import type { ProviderCheckSummary } from '../../../../shared/github/pull-request-types' type ChecksPillItem = { checksSummary?: ProviderCheckSummary } diff --git a/src/renderer/src/components/task-page/task-page-pr-check-summary.ts b/src/renderer/src/components/task-page/task-page-pr-check-summary.ts index d4f39856379..21e593d7053 100644 --- a/src/renderer/src/components/task-page/task-page-pr-check-summary.ts +++ b/src/renderer/src/components/task-page/task-page-pr-check-summary.ts @@ -1,4 +1,4 @@ -import { summarizeProviderChecks } from '../../../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../../shared/source-control/checks/provider-check-summary' import type { PRCheckDetail } from '../../../../shared/github/check-types' import type { ProviderCheckSummary } from '../../../../shared/github/pull-request-types' diff --git a/src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-facet-rows.ts b/src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-facet-rows.ts index 0c32a68c7f8..2e4e28a8804 100644 --- a/src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-facet-rows.ts +++ b/src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-facet-rows.ts @@ -2,7 +2,7 @@ import { useMemo } from 'react' import { useShallow } from 'zustand/react/shallow' import { useAppStore } from '@/store' import { getLiveAgentStatusByWorktreeId } from '@/lib/worktree-activity-state' -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { WorkspaceCleanupCandidate } from '../../../../shared/workspace-cleanup' import type { WorkspaceCleanupFilterState, diff --git a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-labels.ts b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-labels.ts index 98f09a577d2..deabc768a88 100644 --- a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-labels.ts +++ b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-labels.ts @@ -1,5 +1,5 @@ import { translate } from '@/i18n/i18n' -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { WorkspaceCleanupAgentState, WorkspaceCleanupBlockerMode, diff --git a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-panel-model.ts b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-panel-model.ts index 60a097a00e1..a68e8fc73a0 100644 --- a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-panel-model.ts +++ b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-facet-panel-model.ts @@ -1,5 +1,5 @@ import type { ExecutionHostId } from '../../../../shared/execution-host' -import type { HostedReviewProvider } from '../../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { WorkspaceCleanupFilterState } from '../../../../shared/workspace-cleanup-filter-model' export type WorkspaceCleanupFacetCounts = Record< diff --git a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-presentation-fixtures.ts b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-presentation-fixtures.ts index 3abf167b57e..e730da48c34 100644 --- a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-presentation-fixtures.ts +++ b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-presentation-fixtures.ts @@ -1,6 +1,6 @@ import type { AppState } from '@/store/types' import { translate } from '@/i18n/i18n' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' import { diff --git a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-presentation.ts b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-presentation.ts index bf24148cbc1..48368009d8f 100644 --- a/src/renderer/src/components/workspace-cleanup/workspace-cleanup-presentation.ts +++ b/src/renderer/src/components/workspace-cleanup/workspace-cleanup-presentation.ts @@ -2,7 +2,10 @@ import { getHostedReviewCacheKey } from '@/store/slices/hosted-review-cache-iden import type { AppState } from '@/store/types' import { translate } from '@/i18n/i18n' import { getRepoExecutionHostId } from '../../../../shared/execution-host' -import type { HostedReviewInfo, HostedReviewProvider } from '../../../../shared/hosted-review' +import type { + HostedReviewInfo, + HostedReviewProvider +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' import type { WorkspaceCleanupCandidate } from '../../../../shared/workspace-cleanup' diff --git a/src/renderer/src/components/worktree-jump/worktree-jump-palette-document-index.ts b/src/renderer/src/components/worktree-jump/worktree-jump-palette-document-index.ts index 4e3e36f5876..915f3c296db 100644 --- a/src/renderer/src/components/worktree-jump/worktree-jump-palette-document-index.ts +++ b/src/renderer/src/components/worktree-jump/worktree-jump-palette-document-index.ts @@ -12,7 +12,7 @@ import type { AppState } from '@/store/types' import type { Repo } from '../../../../shared/repo-types' import type { Worktree } from '../../../../shared/worktree/types' import type { WorkspacePortScanResult } from '../../../../shared/workspace-ports' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { getRepoExecutionHostId } from '../../../../shared/execution-host' export function buildWorktreeJumpPaletteDocumentIndex({ diff --git a/src/renderer/src/i18n/hosted-review-localized-copy.ts b/src/renderer/src/i18n/hosted-review-localized-copy.ts index 2071d8aa82e..fc6a6d98681 100644 --- a/src/renderer/src/i18n/hosted-review-localized-copy.ts +++ b/src/renderer/src/i18n/hosted-review-localized-copy.ts @@ -1,8 +1,8 @@ -import type { HostedReviewProvider } from '../../../shared/hosted-review' +import type { HostedReviewProvider } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import { resolveHostedReviewCreationProvider, type HostedReviewCreationProvider -} from '../../../shared/hosted-review-creation-providers' +} from '../../../shared/source-control/hosted-review/hosted-review-creation-providers' import { translate } from '@/i18n/i18n' export type SupportedHostedReviewCopyProvider = HostedReviewCreationProvider diff --git a/src/renderer/src/lib/agent-launch-caller-routing.test.ts b/src/renderer/src/lib/agent-launch-caller-routing.test.ts index 8d375ee93a4..e04f4f06f12 100644 --- a/src/renderer/src/lib/agent-launch-caller-routing.test.ts +++ b/src/renderer/src/lib/agent-launch-caller-routing.test.ts @@ -17,7 +17,7 @@ import { } from './agent-launch-funnel-test-harness' import type * as LaunchAdmissionModule from './agent-session/launch/structured-agent-session-launch-admission' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { tokenizeStartupCommand } from '../../../shared/agent-launch/startup/tui-agent-startup-shell' const store = createLaunchFunnelStore() const mockIsWebRuntimeSessionActive = vi.fn(() => false) diff --git a/src/renderer/src/lib/agent-launch-through-host.test.ts b/src/renderer/src/lib/agent-launch-through-host.test.ts index f2d8f215b37..e688e0d02e2 100644 --- a/src/renderer/src/lib/agent-launch-through-host.test.ts +++ b/src/renderer/src/lib/agent-launch-through-host.test.ts @@ -3,7 +3,7 @@ import type * as AgentStatusModule from '@/lib/agent-status' import { createTabsSliceMockApi } from '../store/slices/tabs-slice-test-harness' import { createTestStore } from '../store/slices/store-test-helpers' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { buildAgentStartupPlan } from '../../../shared/agent-launch/startup/tui-agent-startup' import { resolveAgentStartupPlanInputs } from '../../../shared/agent-launch/startup/agent-startup-plan-inputs' diff --git a/src/renderer/src/lib/agent-session-launch-plan.test.ts b/src/renderer/src/lib/agent-session-launch-plan.test.ts index 6b5480ff9e6..48083737a81 100644 --- a/src/renderer/src/lib/agent-session-launch-plan.test.ts +++ b/src/renderer/src/lib/agent-session-launch-plan.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import type { AgentLaunchRouteStore } from './agent-launch-route-input' const mocks = vi.hoisted(() => ({ diff --git a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts index 9200374177d..9d1c65a6906 100644 --- a/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts +++ b/src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-unconfirmed-or-retried.test.ts @@ -1,6 +1,6 @@ // @vitest-environment happy-dom -import { sourceControlActionRecipeEntry } from '../../../../../shared/source-control-action-selection' +import { sourceControlActionRecipeEntry } from '../../../../../shared/source-control/ai/recipes/source-control-action-selection' import type * as LaunchErrors from '@/lib/agent-session/launch/structured-agent-session-launch-errors' import { beforeEach, describe, expect, it, vi } from 'vitest' import type { RuntimeMobileSessionTabsResult } from '../../../../../shared/runtime-session-contracts' diff --git a/src/renderer/src/lib/check-run-details-log-normalization.ts b/src/renderer/src/lib/check-run-details-log-normalization.ts index f246a5df69d..f0e9086d68d 100644 --- a/src/renderer/src/lib/check-run-details-log-normalization.ts +++ b/src/renderer/src/lib/check-run-details-log-normalization.ts @@ -1,5 +1,5 @@ import type { PRCheckRunDetails } from '../../../shared/github/check-types' -import { sanitizeCheckJobLogExcerpt } from '../../../shared/check-job-log-excerpt' +import { sanitizeCheckJobLogExcerpt } from '../../../shared/source-control/checks/logs/check-job-log-excerpt' export function normalizeCheckRunDetailsLogTails( details: PRCheckRunDetails | null diff --git a/src/renderer/src/lib/fix-checks-agent-launch.test.ts b/src/renderer/src/lib/fix-checks-agent-launch.test.ts index 041d013d79c..0fe3976ad45 100644 --- a/src/renderer/src/lib/fix-checks-agent-launch.test.ts +++ b/src/renderer/src/lib/fix-checks-agent-launch.test.ts @@ -117,7 +117,7 @@ vi.mock('@/lib/new-workspace', () => ({ CLIENT_PLATFORM: 'win32' })) -vi.mock('../../../shared/source-control-launch-agent-selection', () => ({ +vi.mock('../../../shared/source-control/ai/source-control-launch-agent-selection', () => ({ pickSourceControlLaunchAgent: mocks.pickSourceControlLaunchAgent, readSourceControlLaunchRecipeAgentId: mocks.readSourceControlLaunchRecipeAgentId })) @@ -136,9 +136,13 @@ vi.mock('@/lib/worktree-activation', () => ({ activateAndRevealWorktree: mocks.activateAndRevealWorktree })) -vi.mock('../../../shared/source-control-ai', () => ({ - resolveSourceControlActionRecipe: mocks.resolveSourceControlActionRecipe -})) +vi.mock( + '../../../shared/source-control/ai/source-control-ai-operation-policy', + async (importOriginal) => ({ + ...(await importOriginal>()), + resolveSourceControlActionRecipe: mocks.resolveSourceControlActionRecipe + }) +) describe('startFixChecksAgent', () => { beforeEach(() => { diff --git a/src/renderer/src/lib/fix-checks-agent-launch.ts b/src/renderer/src/lib/fix-checks-agent-launch.ts index 2419783279f..ba54375db0b 100644 --- a/src/renderer/src/lib/fix-checks-agent-launch.ts +++ b/src/renderer/src/lib/fix-checks-agent-launch.ts @@ -21,23 +21,23 @@ import { findGithubPrWorkspaceAttachment } from '@/lib/github-work-item-workspac import { launchAgentInNewTab } from '@/lib/launch-agent-in-new-tab' import { newAgentLaunchRequestId } from '@/lib/agent-launch-request-id' import { launchWorkItemDirect } from '@/lib/launch-work-item-direct' -import { readSourceControlLaunchRecipeAgentId } from '../../../shared/source-control-launch-agent-selection' +import { readSourceControlLaunchRecipeAgentId } from '../../../shared/source-control/ai/source-control-launch-agent-selection' import { resolveRepoWorktreeLaunchPlatform } from '@/lib/execution-host-facts' import { activateAndRevealWorktree } from '@/lib/worktree-activation' import { useAppStore } from '@/store' -import { resolveSourceControlActionRecipe } from '../../../shared/source-control-ai' +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-actions' +} from '../../../shared/source-control/ai/recipes/source-control-ai-actions' import { isTuiAgentEnabled } from '../../../shared/agent-launch/catalog/tui-agent-selection' import type { GitHubWorkItem } from '../../../shared/github/work-item-types' import type { TuiAgent } from '../../../shared/agent-launch/catalog/tui-agent' import type { WorkspaceSource as WorkspaceCreateTelemetrySource } from '../../../shared/workspace-source' import type { LaunchSource } from '../../../shared/telemetry-events' import { translate } from '@/i18n/i18n' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' type StartFixChecksAgentArgs = { repoId: string diff --git a/src/renderer/src/lib/github-work-item-source-lookup.test.ts b/src/renderer/src/lib/github-work-item-source-lookup.test.ts index a3145ee3677..260b2bf1437 100644 --- a/src/renderer/src/lib/github-work-item-source-lookup.test.ts +++ b/src/renderer/src/lib/github-work-item-source-lookup.test.ts @@ -4,7 +4,7 @@ import { GITHUB_CANONICAL_DETAILS_RUNTIME_CAPABILITY, GITHUB_EXACT_DETAILS_READ_INTENT_RUNTIME_CAPABILITY } from '../../../shared/task-source-runtime-capabilities' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../shared/source-control/runtime/source-control-runtime-capabilities' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { callRuntimeRpc } from '@/runtime/runtime-rpc-client' import type * as RuntimeRpcClient from '@/runtime/runtime-rpc-client' diff --git a/src/renderer/src/lib/github-work-item-target-compatibility.test.ts b/src/renderer/src/lib/github-work-item-target-compatibility.test.ts index 3955d6489b3..2fa9044700c 100644 --- a/src/renderer/src/lib/github-work-item-target-compatibility.test.ts +++ b/src/renderer/src/lib/github-work-item-target-compatibility.test.ts @@ -6,7 +6,7 @@ import { afterEach, beforeEach, expect, it, vi } from 'vitest' import { callGitHubTargetOperation } from './github-work-item-target-request' import { clearRuntimeCompatibilityCache } from '@/runtime/runtime-rpc-client' import { replaceRuntimeEnvironmentRevisions } from '@/runtime/runtime-environment-revision' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as capability } from '../../../shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as capability } from '../../../shared/source-control/runtime/source-control-runtime-capabilities' vi.mock('@/store', () => ({ useAppStore: { getState: () => ({ repos: [] }) } })) const ownerRepo = { owner: 'fork', repo: 'widgets', host: 'github.corp' } diff --git a/src/renderer/src/lib/github-work-item-target-request.ts b/src/renderer/src/lib/github-work-item-target-request.ts index e6a08b3ba8b..62178b4b3ca 100644 --- a/src/renderer/src/lib/github-work-item-target-request.ts +++ b/src/renderer/src/lib/github-work-item-target-request.ts @@ -1,6 +1,6 @@ import type { GhAccountBinding } from '../../../shared/github/account-binding' import { isWebClientLocation } from './web-client-location' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../shared/source-control/runtime/source-control-runtime-capabilities' import { GITHUB_EXACT_OPERATION_UNSUPPORTED } from '../../../shared/github/work-item-target' import type { GitHubOwnerRepo } from '../../../shared/github/pull-request-types' import type { RuntimeClientTarget } from '../../../shared/runtime-client-target' diff --git a/src/renderer/src/lib/github-work-item-workspace-attachment.ts b/src/renderer/src/lib/github-work-item-workspace-attachment.ts index b30c0815b3a..2e74f89fd1f 100644 --- a/src/renderer/src/lib/github-work-item-workspace-attachment.ts +++ b/src/renderer/src/lib/github-work-item-workspace-attachment.ts @@ -1,5 +1,5 @@ import type { Repo } from '../../../shared/repo-types' -import { normalizeGitRemoteUrl } from '../../../shared/git-remote-identity' +import { normalizeGitRemoteUrl } from '../../../shared/git/remotes/git-remote-identity' import { getWorkspaceAttachmentUrlScope } from '../../../shared/workspace-attachment-normalization' import { parseGitHubIssueOrPRLink } from '../../../shared/github/links' import { githubRepoIdentityKey } from '../../../shared/github/repository-identity-key' diff --git a/src/renderer/src/lib/host-chat-program.test.ts b/src/renderer/src/lib/host-chat-program.test.ts index 52cbfab6d35..52cbf754db2 100644 --- a/src/renderer/src/lib/host-chat-program.test.ts +++ b/src/renderer/src/lib/host-chat-program.test.ts @@ -1,7 +1,7 @@ import { EVERY_AGENT_CHAT } from '../../../shared/native-chat/every-agent-chat.test-fixture' import { agentMenuShortcutLabels } from '../components/tab-bar/agent-menu-shortcut-labels' import { makeWorktree, TEST_REPO } from '@/store/slices/worktrees-slice-test-fixtures' -import { getDefaultSourceControlAiSettings } from '../../../shared/source-control-ai-settings' +import { getDefaultSourceControlAiSettings } from '../../../shared/source-control/ai/settings/source-control-ai-settings' import { afterEach, assert, beforeEach, expect, it, vi } from 'vitest' import { getDefaultSettings } from '../../../shared/constants' import { pr } from '@/hooks/composer-state/composer-review-base-test-fixture' diff --git a/src/renderer/src/lib/hosted-review-repo-read.ts b/src/renderer/src/lib/hosted-review-repo-read.ts index 35ce4693cbf..e54340c2fa6 100644 --- a/src/renderer/src/lib/hosted-review-repo-read.ts +++ b/src/renderer/src/lib/hosted-review-repo-read.ts @@ -1,7 +1,10 @@ import { callRuntimeRpc } from '@/runtime/runtime-rpc-client' import { hostedReviewRepoOwnerTarget } from '@/store/slices/hosted-review-cache-state' import { getRepoExecutionHostId } from '../../../shared/execution-host' -import type { HostedReviewForBranchArgs, HostedReviewInfo } from '../../../shared/hosted-review' +import type { + HostedReviewForBranchArgs, + HostedReviewInfo +} from '../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../shared/repo-types' export function readHostedReviewForRepo( diff --git a/src/renderer/src/lib/launch-agent-in-new-tab.test.ts b/src/renderer/src/lib/launch-agent-in-new-tab.test.ts index a90f7b4b2c6..242e3d89dcc 100644 --- a/src/renderer/src/lib/launch-agent-in-new-tab.test.ts +++ b/src/renderer/src/lib/launch-agent-in-new-tab.test.ts @@ -12,7 +12,7 @@ import { } from './launch-agent-in-new-tab-test-fixture' import { toAppSshPtyId } from '../../../shared/ssh-pty-id' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { planAgentSessionLaunch } from './agent-session-launch-plan' import { openDeclinedTerminal } from './agent-session/launch/structured-agent-session-action-launch' import { tokenizeStartupCommand } from '../../../shared/agent-launch/startup/tui-agent-startup-shell' diff --git a/src/renderer/src/lib/launch-work-item-direct-accepted.test.tsx b/src/renderer/src/lib/launch-work-item-direct-accepted.test.tsx index 485dadca189..e12b330e9d9 100644 --- a/src/renderer/src/lib/launch-work-item-direct-accepted.test.tsx +++ b/src/renderer/src/lib/launch-work-item-direct-accepted.test.tsx @@ -2,7 +2,7 @@ import { mocks, hostMocks } from './launch-work-item-direct-test-fixture' import { act, cleanup, fireEvent, render, renderHook, screen } from '@testing-library/react' import { afterEach, beforeEach, expect, it, vi } from 'vitest' -import { sourceControlActionRecipeEntry } from '../../../shared/source-control-action-selection' +import { sourceControlActionRecipeEntry } from '../../../shared/source-control/ai/recipes/source-control-action-selection' import { useAppStore } from '@/store' import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures' import * as preparation from './launch-work-item-direct-route-preparation' diff --git a/src/renderer/src/lib/launch-work-item-direct-defaults.test.ts b/src/renderer/src/lib/launch-work-item-direct-defaults.test.ts index c89b14c2cdf..b796a335888 100644 --- a/src/renderer/src/lib/launch-work-item-direct-defaults.test.ts +++ b/src/renderer/src/lib/launch-work-item-direct-defaults.test.ts @@ -13,11 +13,11 @@ import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures' import { useAppStore } from '@/store' import { RUNTIME_CAPABILITIES } from '../../../shared/protocol-version' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { tokenizeStartupCommand } from '../../../shared/agent-launch/startup/tui-agent-startup-shell' import { runSourceControlAgentActionStart } from '../components/right-sidebar/runSourceControlAgentActionStart' import { startFixChecksFromDialog } from '../components/pull-request-page/checks/fix-launch' -import { sourceControlActionRecipeEntry } from '../../../shared/source-control-action-selection' +import { sourceControlActionRecipeEntry } from '../../../shared/source-control/ai/recipes/source-control-action-selection' import { pr } from '@/hooks/composer-state/composer-review-base-test-fixture' import { launchWorkItemDirect } from './launch-work-item-direct' import { beginDirectWorkItemStructuredLaunch } from './launch-work-item-direct-agent-routing' diff --git a/src/renderer/src/lib/pr-bot-author-overrides.test.ts b/src/renderer/src/lib/pr-bot-author-overrides.test.ts index c59a2b5643f..4d029acf736 100644 --- a/src/renderer/src/lib/pr-bot-author-overrides.test.ts +++ b/src/renderer/src/lib/pr-bot-author-overrides.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import { applyPRBotAuthorOverride } from '../../../shared/pr-bot-author-overrides' +import { applyPRBotAuthorOverride } from '../../../shared/source-control/review-comments/pr-bot-author-overrides' const store = vi.hoisted(() => ({ settings: { prBotAuthorOverrides: [] as string[] }, diff --git a/src/renderer/src/lib/pr-bot-author-overrides.ts b/src/renderer/src/lib/pr-bot-author-overrides.ts index 1e560fbf3cf..9c48f088120 100644 --- a/src/renderer/src/lib/pr-bot-author-overrides.ts +++ b/src/renderer/src/lib/pr-bot-author-overrides.ts @@ -6,7 +6,7 @@ import { createBotAuthorOverrideSet, MAX_PR_BOT_AUTHOR_OVERRIDES, normalizePRCommentAuthorLogin -} from '../../../shared/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/pr-comment-action-state.ts b/src/renderer/src/lib/pr-comment-action-state.ts index 7d2a85f7108..77301293084 100644 --- a/src/renderer/src/lib/pr-comment-action-state.ts +++ b/src/renderer/src/lib/pr-comment-action-state.ts @@ -1,4 +1,7 @@ -import { getPRCommentGroupRoot, type PRCommentGroup } from '../../../shared/pr-comment-groups' +import { + getPRCommentGroupRoot, + type PRCommentGroup +} from '../../../shared/source-control/review-comments/pr-comment-groups' import type { PRComment } from '../../../shared/github/comment-types' /** How a comment group should read in the PR sidebar triage UI. */ diff --git a/src/renderer/src/lib/pr-comment-audience-labels.ts b/src/renderer/src/lib/pr-comment-audience-labels.ts index 50e307cc1c7..13390da51ed 100644 --- a/src/renderer/src/lib/pr-comment-audience-labels.ts +++ b/src/renderer/src/lib/pr-comment-audience-labels.ts @@ -1,4 +1,4 @@ -import type { PRCommentAudienceFilter } from '../../../shared/pr-comment-audience' +import type { PRCommentAudienceFilter } from '../../../shared/source-control/review-comments/pr-comment-audience' import { createLocalizedCatalog } from '@/i18n/localized-catalog' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/lib/preserved-branch-cleanup.ts b/src/renderer/src/lib/preserved-branch-cleanup.ts deleted file mode 100644 index b13830391aa..00000000000 --- a/src/renderer/src/lib/preserved-branch-cleanup.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { - preservedBranchCleanupKey, - preservedBranchCleanupScopeKey, - type PreservedBranchCleanup -} from '../../../shared/preserved-branch-cleanup' diff --git a/src/renderer/src/lib/project-clone-url-prefill.ts b/src/renderer/src/lib/project-clone-url-prefill.ts index 6c200997cb8..ec97d4db2ea 100644 --- a/src/renderer/src/lib/project-clone-url-prefill.ts +++ b/src/renderer/src/lib/project-clone-url-prefill.ts @@ -1,4 +1,4 @@ -import { stripCredentialsFromMessage } from '../../../shared/git-remote-error' +import { stripCredentialsFromMessage } from '../../../shared/git/remotes/git-remote-error' import type { Project } from '../../../shared/project-types' import type { Repo } from '../../../shared/repo-types' diff --git a/src/renderer/src/lib/source-control-agent-launch-picker.source.test.ts b/src/renderer/src/lib/source-control-agent-launch-picker.source.test.ts index af1c2d556c3..df974bda79b 100644 --- a/src/renderer/src/lib/source-control-agent-launch-picker.source.test.ts +++ b/src/renderer/src/lib/source-control-agent-launch-picker.source.test.ts @@ -10,15 +10,15 @@ import { import { getDefaultSettings } from '../../../shared/constants' import { applyAgentPickerEdit } from '../../../shared/agent-launch/picker/agent-launch-picker-edits' -import { captureSourceControlActionSelection } from '../../../shared/source-control-ai-operation-policy' +import { captureSourceControlActionSelection } from '../../../shared/source-control/ai/source-control-ai-operation-policy' import { canonicalSourceControlActionSelection, selectSourceControlActionRecipe -} from '../../../shared/source-control-action-selection' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +} from '../../../shared/source-control/ai/recipes/source-control-action-selection' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { agentPickerPanelArguments } from '../../../shared/agent-launch/picker/agent-launch-picker-arguments' -import { saveSourceControlActionRecipe } from '../../../shared/source-control-ai-recipe-save' +import { saveSourceControlActionRecipe } from '../../../shared/source-control/ai/settings/source-control-ai-recipe-save' import { resolveAgentLaunchCommand } from '../../../shared/agent-launch/startup/tui-agent-launch-command' import { applySourceControlPickerDraft, diff --git a/src/renderer/src/lib/source-control-agent-launch-picker.test.ts b/src/renderer/src/lib/source-control-agent-launch-picker.test.ts index ee9296d1ca9..6dd77aacf39 100644 --- a/src/renderer/src/lib/source-control-agent-launch-picker.test.ts +++ b/src/renderer/src/lib/source-control-agent-launch-picker.test.ts @@ -17,12 +17,12 @@ import { applyAgentPickerEdit, type AgentPickerEdit } from '../../../shared/agent-launch/picker/agent-launch-picker-edits' -import { captureSourceControlActionSelection } from '../../../shared/source-control-ai-operation-policy' +import { captureSourceControlActionSelection } from '../../../shared/source-control/ai/source-control-ai-operation-policy' import { canonicalSourceControlActionSelection, selectSourceControlActionRecipe -} from '../../../shared/source-control-action-selection' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +} from '../../../shared/source-control/ai/recipes/source-control-action-selection' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { tokenizeStartupCommand } from '../../../shared/agent-launch/startup/tui-agent-startup-shell' import { agentPickerPanelArguments } from '../../../shared/agent-launch/picker/agent-launch-picker-arguments' diff --git a/src/renderer/src/lib/source-control-agent-launch-picker.ts b/src/renderer/src/lib/source-control-agent-launch-picker.ts index 98da873e74b..7a02662fbc0 100644 --- a/src/renderer/src/lib/source-control-agent-launch-picker.ts +++ b/src/renderer/src/lib/source-control-agent-launch-picker.ts @@ -8,11 +8,11 @@ import { selectSourceControlActionRecipe, pickSourceControlActionAgent, type CurrentActionSelection -} from '../../../shared/source-control-action-selection' +} from '../../../shared/source-control/ai/recipes/source-control-action-selection' import { sourceControlActionExecutionArgs, selectedSourceControlActionPreferences -} from '../../../shared/source-control-action-launch-preferences' +} from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' export function sourceControlPickerDraft( selection: CurrentActionSelection, diff --git a/src/renderer/src/lib/source-control-agent-picker.ts b/src/renderer/src/lib/source-control-agent-picker.ts index 60d3b5ae403..a1904dccace 100644 --- a/src/renderer/src/lib/source-control-agent-picker.ts +++ b/src/renderer/src/lib/source-control-agent-picker.ts @@ -2,15 +2,15 @@ import type { AppState } from '@/store/types' import type { AgentLaunchPreferences } from '@/runtime/agent-launch-settings/host-agent-launch-preferences-resource' import type { ProspectiveWorkspace } from '@/lib/agent-launch-route-input' import { readAgentLaunchChoice } from '@/lib/host-chat-program' -import { resolveSourceControlActionRecipe } from '../../../shared/source-control-ai' +import { resolveSourceControlActionRecipe } from '../../../shared/source-control/ai/source-control-ai-operation-policy' import type { SourceControlActionId, SourceControlActionRecipe -} from '../../../shared/source-control-ai-actions' +} from '../../../shared/source-control/ai/recipes/source-control-ai-actions' import { pickSourceControlLaunchAgent, readSourceControlLaunchRecipeAgentId -} from '../../../shared/source-control-launch-agent-selection' +} from '../../../shared/source-control/ai/source-control-launch-agent-selection' import { isTuiAgentEnabled } from '../../../shared/agent-launch/catalog/tui-agent-selection' import type { Repo } from '../../../shared/repo-types' import { getRepoExecutionHostId, parseExecutionHostId } from '../../../shared/execution-host' @@ -24,7 +24,7 @@ import type { import type { resolveAgentMenuSelection } from '@/lib/agent-menu-selection' import type { AgentPickerEntry } from '../../../shared/agent-launch/picker/agent-launch-picker' import type { AgentLaunchSurface } from '@/lib/agent-session-launch-plan' -import { resolveSourceControlActionPreferredSurface } from '../../../shared/source-control-action-launch-preferences' +import { resolveSourceControlActionPreferredSurface } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' /** The workspace a Source Control agent picker lists rows for, and the host whose agents it reads. */ export type SourceControlAgentRows = { diff --git a/src/renderer/src/lib/source-control-generation-plan.ts b/src/renderer/src/lib/source-control-generation-plan.ts index 75388761d24..2f4a190f9fb 100644 --- a/src/renderer/src/lib/source-control-generation-plan.ts +++ b/src/renderer/src/lib/source-control-generation-plan.ts @@ -1,10 +1,10 @@ import { textGenerationErrorText } from '@/lib/text-generation-error-copy' -import { planCommitMessageGeneration } from '../../../shared/commit-message-plan' +import { planCommitMessageGeneration } from '../../../shared/source-control/ai/generation/commit-message-plan' import { renderSourceControlActionCommandTemplate, type SourceControlTextActionId -} from '../../../shared/source-control-ai-actions' -import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control-ai' +} from '../../../shared/source-control/ai/recipes/source-control-ai-actions' +import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control/ai/source-control-ai-operation-resolution' import { translate } from '@/i18n/i18n' export type SourceControlGenerationPlanResult = diff --git a/src/renderer/src/lib/source-control-remote-error-copy.ts b/src/renderer/src/lib/source-control-remote-error-copy.ts index a50055793ee..51098162ed8 100644 --- a/src/renderer/src/lib/source-control-remote-error-copy.ts +++ b/src/renderer/src/lib/source-control-remote-error-copy.ts @@ -2,11 +2,11 @@ import { translate } from '@/i18n/i18n' import { classifySubmodulePushFailure, formatSubmodulePushFailureSentence -} from '../../../shared/git-remote-error' +} from '../../../shared/git/remotes/git-remote-error' import { LINT_PUSH_FAILURE_SUMMARY, PRE_PUSH_FAILURE_SUMMARY -} from '../../../shared/source-control-push-failure' +} from '../../../shared/source-control/recovery/source-control-push-failure' export type PushLikeOperation = 'publish' | 'sync' | 'forcePush' | 'push' export type RemoteOperation = PushLikeOperation | 'fetch' | 'fastForward' | 'rebase' | 'pull' diff --git a/src/renderer/src/lib/source-control-remote-error.ts b/src/renderer/src/lib/source-control-remote-error.ts index 781a3e956ec..2069fc3aef4 100644 --- a/src/renderer/src/lib/source-control-remote-error.ts +++ b/src/renderer/src/lib/source-control-remote-error.ts @@ -4,11 +4,11 @@ import { GIT_AUTHENTICATION_FAILED_MESSAGE, formatSubmodulePushFailureDetail, stripCredentialsFromMessage -} from '../../../shared/git-remote-error' +} from '../../../shared/git/remotes/git-remote-error' import { isPushHookFailure, summarizePushFailure -} from '../../../shared/source-control-push-failure' +} from '../../../shared/source-control/recovery/source-control-push-failure' import { type PullLikeOperation, type PushLikeOperation, diff --git a/src/renderer/src/lib/structured-agent-session-launch-action-effort.test-fixture.ts b/src/renderer/src/lib/structured-agent-session-launch-action-effort.test-fixture.ts index d2ffed2e0a7..f5c150badeb 100644 --- a/src/renderer/src/lib/structured-agent-session-launch-action-effort.test-fixture.ts +++ b/src/renderer/src/lib/structured-agent-session-launch-action-effort.test-fixture.ts @@ -3,7 +3,7 @@ import { CreateIntentParams } from '../../../shared/rpc-contract/structured-agen import { projectSourceControlActionLaunch, resolveSourceControlActionSessionOptions -} from '../../../shared/source-control-action-launch-preferences' +} from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { startStructuredAgentLaunch } from './agent-session/launch/structured-agent-session-launch' import { holdStructuredAgentSessionLaunchOption } from './agent-session/launch/structured-agent-session-launch-options' import { recordHostModelCatalogSnapshot } from '@/runtime/host-model-catalog-snapshots' diff --git a/src/renderer/src/lib/worktree-creation-structured-session-host-decline.test.ts b/src/renderer/src/lib/worktree-creation-structured-session-host-decline.test.ts index b574d34ad9b..20da4905173 100644 --- a/src/renderer/src/lib/worktree-creation-structured-session-host-decline.test.ts +++ b/src/renderer/src/lib/worktree-creation-structured-session-host-decline.test.ts @@ -34,7 +34,7 @@ vi.mock('@/lib/agent-session/structured-agent-session-provisional-tab', async (i }) import { useAppStore } from '@/store' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { tokenizeStartupCommand } from '../../../shared/agent-launch/startup/tui-agent-startup-shell' import { submitFolderWorkspaceCreate } from '@/components/sidebar/folder-workspace-composer-submit' import { diff --git a/src/renderer/src/lib/worktree-creation-structured-session.test.ts b/src/renderer/src/lib/worktree-creation-structured-session.test.ts index 803d3977c8d..41b366bdf4b 100644 --- a/src/renderer/src/lib/worktree-creation-structured-session.test.ts +++ b/src/renderer/src/lib/worktree-creation-structured-session.test.ts @@ -94,7 +94,7 @@ vi.mock('@/components/terminal/background-terminal-worktree-mount', () => ({ })) import { launchStructuredWorktreeSession } from './worktree-creation-structured-session' -import { projectSourceControlActionLaunch } from '../../../shared/source-control-action-launch-preferences' +import { projectSourceControlActionLaunch } from '../../../shared/source-control/ai/recipes/source-control-action-launch-preferences' import { requestBackgroundTerminalWorktreeMount } from '@/components/terminal/background-terminal-worktree-mount' const request = { diff --git a/src/renderer/src/lib/worktree-palette-document.ts b/src/renderer/src/lib/worktree-palette-document.ts index c343f5641db..73ef98ad3f7 100644 --- a/src/renderer/src/lib/worktree-palette-document.ts +++ b/src/renderer/src/lib/worktree-palette-document.ts @@ -19,7 +19,7 @@ import { resolveWorktreeBranchLabel, resolveWorktreeDisplayName } from './worktree-default-display-name' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../shared/repo-types' import { getWorkspaceAttachments } from '../../../shared/workspace-attachments' import { getWorkspaceAttachmentKey } from '../../../shared/workspace-attachment-normalization' diff --git a/src/renderer/src/lib/worktree-palette-evidence.ts b/src/renderer/src/lib/worktree-palette-evidence.ts index 1f9515dd6ba..c0686bd4038 100644 --- a/src/renderer/src/lib/worktree-palette-evidence.ts +++ b/src/renderer/src/lib/worktree-palette-evidence.ts @@ -4,7 +4,7 @@ import { } from '../../../shared/palette-match/evidence-composer' import { extractWorktreePaletteCommentSnippet } from './worktree-palette-comment-snippet' import type { MatchRange } from '../../../shared/palette-match/normalized-text' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import type { WorkspaceAttachment, Worktree } from '../../../shared/worktree/types' /** Chip label kinds the worktree row can render for a supporting-evidence unit. */ diff --git a/src/renderer/src/lib/worktree-palette-gitlab-url-match.ts b/src/renderer/src/lib/worktree-palette-gitlab-url-match.ts index 360cb0ef29b..30a78d60b18 100644 --- a/src/renderer/src/lib/worktree-palette-gitlab-url-match.ts +++ b/src/renderer/src/lib/worktree-palette-gitlab-url-match.ts @@ -1,10 +1,10 @@ -import { foldComparableGitLabHost } from '../../../shared/git-remote-host-alias' +import { foldComparableGitLabHost } from '../../../shared/git/remotes/git-remote-host-alias' import { matchGitRemoteKeyParts, splitGitRemoteKey, type GitRemoteKeyParts -} from '../../../shared/git-remote-identity' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +} from '../../../shared/git/remotes/git-remote-identity' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import { parseGitLabIssueOrMRLink, type ProjectSlug diff --git a/src/renderer/src/lib/worktree-palette-review-match.test.ts b/src/renderer/src/lib/worktree-palette-review-match.test.ts index ee4f1b1f44e..a92154d3916 100644 --- a/src/renderer/src/lib/worktree-palette-review-match.test.ts +++ b/src/renderer/src/lib/worktree-palette-review-match.test.ts @@ -3,7 +3,7 @@ import './worktree-palette-review-match' import { searchWorktrees } from './worktree-palette-search' import type { Repo } from '../../../shared/repo-types' import type { Worktree } from '../../../shared/worktree/types' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' function makeWorktree(overrides: Partial = {}): Worktree { return { diff --git a/src/renderer/src/lib/worktree-palette-review-match.ts b/src/renderer/src/lib/worktree-palette-review-match.ts index 726ec1a64d3..edae93857cb 100644 --- a/src/renderer/src/lib/worktree-palette-review-match.ts +++ b/src/renderer/src/lib/worktree-palette-review-match.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' // title is intentionally optional: rehydrated review/PR caches can hold entries without one. type SearchableReview = Pick & { title?: string } diff --git a/src/renderer/src/lib/worktree-palette-search.test.ts b/src/renderer/src/lib/worktree-palette-search.test.ts index 9ed63b21d72..c786a76e78b 100644 --- a/src/renderer/src/lib/worktree-palette-search.test.ts +++ b/src/renderer/src/lib/worktree-palette-search.test.ts @@ -3,7 +3,7 @@ import { searchWorktrees } from './worktree-palette-search' import '../../../shared/palette-match/worktree-palette-query-bounds' import type { Repo } from '../../../shared/repo-types' import type { Worktree } from '../../../shared/worktree/types' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' function makeWorktree(overrides: Partial = {}): Worktree { return { diff --git a/src/renderer/src/lib/worktree-palette-search.ts b/src/renderer/src/lib/worktree-palette-search.ts index ccbb0eb1296..818d6299061 100644 --- a/src/renderer/src/lib/worktree-palette-search.ts +++ b/src/renderer/src/lib/worktree-palette-search.ts @@ -21,7 +21,7 @@ import { applyWorktreeCommentSnippet, type PaletteSupportingKind } from './worktree-palette-evidence' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../shared/repo-types' import type { Worktree } from '../../../shared/worktree/types' import { getWorkspaceLastActiveAt } from '../../../shared/workspace-last-active' diff --git a/src/renderer/src/lib/worktree-palette-task-url-match.ts b/src/renderer/src/lib/worktree-palette-task-url-match.ts index 977035fda07..fb6681d335a 100644 --- a/src/renderer/src/lib/worktree-palette-task-url-match.ts +++ b/src/renderer/src/lib/worktree-palette-task-url-match.ts @@ -1,10 +1,10 @@ -import { foldComparableGitHubHost } from '../../../shared/git-remote-host-alias' +import { foldComparableGitHubHost } from '../../../shared/git/remotes/git-remote-host-alias' import { matchGitRemoteKeyParts, splitGitRemoteKey, type GitRemoteKeyParts -} from '../../../shared/git-remote-identity' -import type { HostedReviewInfo } from '../../../shared/hosted-review' +} from '../../../shared/git/remotes/git-remote-identity' +import type { HostedReviewInfo } from '../../../shared/source-control/hosted-review/hosted-review-contracts' import { parseGitHubIssueOrPRLink, type GitHubIssueOrPRLink, diff --git a/src/renderer/src/runtime/antigravity-generation-compatibility.ts b/src/renderer/src/runtime/antigravity-generation-compatibility.ts index 29e66130428..aba785beace 100644 --- a/src/renderer/src/runtime/antigravity-generation-compatibility.ts +++ b/src/renderer/src/runtime/antigravity-generation-compatibility.ts @@ -1,7 +1,7 @@ -import { ANTIGRAVITY_CONFIGURED_MODEL_RUNTIME_CAPABILITY } from '../../../shared/protocol-version' +import { ANTIGRAVITY_CONFIGURED_MODEL_RUNTIME_CAPABILITY } from '../../../shared/source-control/runtime/source-control-runtime-capabilities' import { hasFlag } from '../../../shared/agent-session/options/agent-cli-flag-detection' -import { planCommitMessageGeneration } from '../../../shared/commit-message-plan' -import { resolveSourceControlAiForOperation } from '../../../shared/source-control-ai' +import { planCommitMessageGeneration } from '../../../shared/source-control/ai/generation/commit-message-plan' +import { resolveSourceControlAiForOperation } from '../../../shared/source-control/ai/source-control-ai-operation-resolution' import { getRuntimeCommitMessageSettings, type RuntimeGitContext, diff --git a/src/renderer/src/runtime/gitlab-job-trace-client.ts b/src/renderer/src/runtime/gitlab-job-trace-client.ts index 8f0e76617da..c3683862a42 100644 --- a/src/renderer/src/runtime/gitlab-job-trace-client.ts +++ b/src/renderer/src/runtime/gitlab-job-trace-client.ts @@ -2,7 +2,7 @@ import { translate } from '@/i18n/i18n' import { gitLabJobCanHaveTrace, gitLabJobTraceToCheckRunDetails -} from '../../../shared/gitlab-job-trace-check-details' +} from '../../../shared/source-control/checks/gitlab/gitlab-job-trace-check-details' 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' diff --git a/src/renderer/src/runtime/runtime-git-client-context.ts b/src/renderer/src/runtime/runtime-git-client-context.ts index 7f2b1591892..548585ca54b 100644 --- a/src/renderer/src/runtime/runtime-git-client-context.ts +++ b/src/renderer/src/runtime/runtime-git-client-context.ts @@ -1,11 +1,11 @@ import type { CommitMessageAgentCapability, CommitMessageModelCapability -} from '../../../shared/commit-message-agent-spec' -import { getCommitMessageModelDiscoveryHostKeyForScope } from '../../../shared/commit-message-host-key' +} from '../../../shared/source-control/ai/generation/commit-message-agent-spec' +import { getCommitMessageModelDiscoveryHostKeyForScope } from '../../../shared/source-control/ai/generation/commit-message-host-key' import type { GlobalSettings } from '../../../shared/global-settings-types' -import type { HostedReviewProvider } from '../../../shared/hosted-review' -import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control-ai' +import type { HostedReviewProvider } from '../../../shared/source-control/hosted-review/hosted-review-contracts' +import type { ResolvedSourceControlAiGenerationParams } from '../../../shared/source-control/ai/source-control-ai-operation-resolution' import { splitWorktreeIdForFilesystem } from '../../../shared/worktree/id' import type { RuntimeClientTarget } from '../../../shared/runtime-client-target' import type { TextGenerationFailureFields } from '../../../shared/text-generation-failure-copy' diff --git a/src/renderer/src/runtime/runtime-git-diff-client.ts b/src/renderer/src/runtime/runtime-git-diff-client.ts index 2c6cafbc232..33fbc229ab6 100644 --- a/src/renderer/src/runtime/runtime-git-diff-client.ts +++ b/src/renderer/src/runtime/runtime-git-diff-client.ts @@ -2,7 +2,7 @@ import type { GitBranchCompareResult, GitCommitCompareResult, GitDiffResult -} from '../../../shared/git-diff-compare-types' +} from '../../../shared/git/diff/git-diff-compare-types' import { resolveLocalWorktreePath, type RuntimeGitContext } from './runtime-git-client-context' import { callRuntimeRpc } from './runtime-rpc-client' import { toRuntimeWorktreeSelector } from './runtime-worktree-selector' diff --git a/src/renderer/src/runtime/runtime-git-status-client.ts b/src/renderer/src/runtime/runtime-git-status-client.ts index ec7d82fe9f8..e65d4b4c7df 100644 --- a/src/renderer/src/runtime/runtime-git-status-client.ts +++ b/src/renderer/src/runtime/runtime-git-status-client.ts @@ -1,10 +1,13 @@ -import type { GitHistoryOptions, GitHistoryResult } from '../../../shared/git-history' -import type { GitMutationInFlight } from '../../../shared/git-mutation-in-flight' +import type { + GitHistoryOptions, + GitHistoryResult +} from '../../../shared/git/history/git-history-types' +import type { GitMutationInFlight } from '../../../shared/git/commands/git-mutation-in-flight' import type { GitConflictOperation, GitStagingArea, GitStatusResult -} from '../../../shared/git-status-types' +} from '../../../shared/git/status/git-status-types' import { resolveLocalWorktreePath, type RuntimeGitContext } from './runtime-git-client-context' import { callRuntimeRpc } from './runtime-rpc-client' import { toRuntimeWorktreeSelector } from './runtime-worktree-selector' diff --git a/src/renderer/src/runtime/runtime-git-sync-client.ts b/src/renderer/src/runtime/runtime-git-sync-client.ts index 729a1bb9170..a8d6f563964 100644 --- a/src/renderer/src/runtime/runtime-git-sync-client.ts +++ b/src/renderer/src/runtime/runtime-git-sync-client.ts @@ -1,6 +1,9 @@ -import type { GitForkSyncExpectedUpstream, GitForkSyncResult } from '../../../shared/git-fork-sync' -import type { GitUpstreamStatus } from '../../../shared/git-status-types' -import { REBASE_FROM_BASE_RPC_TIMEOUT_MS } from '../../../shared/git-rebase-source' +import type { + GitForkSyncExpectedUpstream, + GitForkSyncResult +} from '../../../shared/git/remotes/git-fork-sync' +import type { GitUpstreamStatus } from '../../../shared/git/status/git-status-types' +import { REBASE_FROM_BASE_RPC_TIMEOUT_MS } from '../../../shared/git/remotes/git-rebase-source' import type { GitPushTarget } from '../../../shared/worktree/types' import { resolveLocalWorktreePath, type RuntimeGitContext } from './runtime-git-client-context' import { translate } from '@/i18n/i18n' diff --git a/src/renderer/src/runtime/runtime-git-working-tree-client.ts b/src/renderer/src/runtime/runtime-git-working-tree-client.ts index 820dbb4b00f..54a54d5c743 100644 --- a/src/renderer/src/runtime/runtime-git-working-tree-client.ts +++ b/src/renderer/src/runtime/runtime-git-working-tree-client.ts @@ -1,9 +1,9 @@ import { requireGitStageWorktreeScopeReceipt, type GitStageWorktreeScope -} from '../../../shared/git-stage-worktree-scope' +} from '../../../shared/git/paths/git-stage-worktree-scope' import { resolveLocalWorktreePath, type RuntimeGitContext } from './runtime-git-client-context' -import type { ConflictResolution } from '../../../shared/source-control-entry-actions' +import type { ConflictResolution } from '../../../shared/source-control/listing/source-control-entry-actions' import { translate } from '@/i18n/i18n' import { callRuntimeRpc } from './runtime-rpc-client' import { RuntimeRpcCallError } from './runtime-rpc-result' diff --git a/src/renderer/src/runtime/runtime-gitlab-api.ts b/src/renderer/src/runtime/runtime-gitlab-api.ts index 01d86e429dc..2c9e574d766 100644 --- a/src/renderer/src/runtime/runtime-gitlab-api.ts +++ b/src/renderer/src/runtime/runtime-gitlab-api.ts @@ -1,9 +1,9 @@ import type { PreloadApi } from '../../../preload/api-types' import { GITLAB_READY_FOR_REVIEW_RUNTIME_CAPABILITY, - GITLAB_READY_FOR_REVIEW_UPDATE_REQUIRED_MESSAGE, - type RuntimeCapability -} from '../../../shared/protocol-version' + GITLAB_READY_FOR_REVIEW_UPDATE_REQUIRED_MESSAGE +} from '../../../shared/source-control/runtime/source-control-runtime-capabilities' +import type { RuntimeCapability } from '../../../shared/protocol-version' import { GITLAB_WEB_RPC_METHODS, type WebGitLabRuntimeMethod diff --git a/src/renderer/src/store/github/check-details-failure-mapping.test.ts b/src/renderer/src/store/github/check-details-failure-mapping.test.ts index aa8fe658c1c..95e6cd3f96b 100644 --- a/src/renderer/src/store/github/check-details-failure-mapping.test.ts +++ b/src/renderer/src/store/github/check-details-failure-mapping.test.ts @@ -20,7 +20,7 @@ import { type Surface } from './check-details-loader-test-fixture' import * as normalization from '@/lib/check-run-details-log-normalization' -import * as sanitation from '../../../../shared/check-job-log-excerpt' +import * as sanitation from '../../../../shared/source-control/checks/logs/check-job-log-excerpt' import { checkLogJob, legacyControls, diff --git a/src/renderer/src/store/github/check-details-ingestion.test.ts b/src/renderer/src/store/github/check-details-ingestion.test.ts index a25cb430935..0a97eb8c75d 100644 --- a/src/renderer/src/store/github/check-details-ingestion.test.ts +++ b/src/renderer/src/store/github/check-details-ingestion.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import * as normalization from '@/lib/check-run-details-log-normalization' -import * as sanitation from '../../../../shared/check-job-log-excerpt' +import * as sanitation from '../../../../shared/source-control/checks/logs/check-job-log-excerpt' import * as ansi from '../../../../shared/ansi-escape-sequences' import { captured, diff --git a/src/renderer/src/store/github/pr-check-status-cache.ts b/src/renderer/src/store/github/pr-check-status-cache.ts index 3063ac9e644..7119e589d47 100644 --- a/src/renderer/src/store/github/pr-check-status-cache.ts +++ b/src/renderer/src/store/github/pr-check-status-cache.ts @@ -1,7 +1,7 @@ import type { AppState } from '../types' import type { GitHubPRRefreshAlias } from '../../../../shared/github/pull-request-refresh-types' import type { PRInfo } from '../../../../shared/github/pull-request-types' -import { deriveCheckStatusFromChecks } from '../slices/github-checks' +import { derivePRCheckStatus as deriveCheckStatusFromChecks } from '../../../../shared/source-control/checks/pr-check-status' import { getPRChecksCacheTtl, prChecksCacheSuffix, diff --git a/src/renderer/src/store/github/pr-result-routing.ts b/src/renderer/src/store/github/pr-result-routing.ts index e1d4e9736f6..6be9078c6a3 100644 --- a/src/renderer/src/store/github/pr-result-routing.ts +++ b/src/renderer/src/store/github/pr-result-routing.ts @@ -1,7 +1,7 @@ import type { AppState } from '../types' import type { RuntimeFocusSettings } from '../../../../shared/github/github-cache-key' import type { PRInfo } from '../../../../shared/github/pull-request-types' -import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/hosted-review-github' +import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/source-control/hosted-review/hosted-review-github' import { getHostedReviewCacheKey, linkedReviewHintKey diff --git a/src/renderer/src/store/github/visible-hosted-review-refresh-targets.test.ts b/src/renderer/src/store/github/visible-hosted-review-refresh-targets.test.ts index d62b0251380..eb5a0c01374 100644 --- a/src/renderer/src/store/github/visible-hosted-review-refresh-targets.test.ts +++ b/src/renderer/src/store/github/visible-hosted-review-refresh-targets.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { Repo } from '../../../../shared/repo-types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import '../../../../shared/global-settings-test-fixture' import { getHostedReviewCacheKey } from '../slices/hosted-review-cache-identity' import { diff --git a/src/renderer/src/store/slices/editor-branch-line-total.test.ts b/src/renderer/src/store/slices/editor-branch-line-total.test.ts index c168d374e99..714063b97a6 100644 --- a/src/renderer/src/store/slices/editor-branch-line-total.test.ts +++ b/src/renderer/src/store/slices/editor-branch-line-total.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { createEditorStore } from './editor-slice-test-harness' -import type { GitStatusResult } from '../../../../shared/git-status-types' +import type { GitStatusResult } from '../../../../shared/git/status/git-status-types' const MERGE_BASE = '1f3c0d9a5b6e7f8091a2b3c4d5e6f708192a3b4c' diff --git a/src/renderer/src/store/slices/editor/actions/check-run-details-owner.ts b/src/renderer/src/store/slices/editor/actions/check-run-details-owner.ts index 35d596e6230..4031ba6666e 100644 --- a/src/renderer/src/store/slices/editor/actions/check-run-details-owner.ts +++ b/src/renderer/src/store/slices/editor/actions/check-run-details-owner.ts @@ -9,7 +9,7 @@ import { parseExecutionHostId, toRuntimeExecutionHostId } from '../../../../../../shared/execution-host' -import { checkRunDetailsOwnerScope } from '../../../../../../shared/check-run-details-owner-scope' +import { checkRunDetailsOwnerScope } from '../../../../../../shared/source-control/checks/check-run-details-owner-scope' import { getOpenFileExecutionHostId, hasOpenFileExecutionHostEvidence diff --git a/src/renderer/src/store/slices/editor/actions/git-remote-sync.ts b/src/renderer/src/store/slices/editor/actions/git-remote-sync.ts index 4c684969495..145006d487f 100644 --- a/src/renderer/src/store/slices/editor/actions/git-remote-sync.ts +++ b/src/renderer/src/store/slices/editor/actions/git-remote-sync.ts @@ -13,7 +13,7 @@ import { markSyncPushStageError, resolveRemoteOperationErrorMessage } from '@/lib/source-control-remote-error' -import { shouldForcePushWithLeaseForUpstream } from '../../../../../../shared/git-upstream-status' +import { shouldForcePushWithLeaseForUpstream } from '../../../../../../shared/git/remotes/git-upstream-status' export function createGitRemoteSync( _set: EditorSet, diff --git a/src/renderer/src/store/slices/editor/git/branch-compare-state.ts b/src/renderer/src/store/slices/editor/git/branch-compare-state.ts index e4378cb47cf..dca99b36d85 100644 --- a/src/renderer/src/store/slices/editor/git/branch-compare-state.ts +++ b/src/renderer/src/store/slices/editor/git/branch-compare-state.ts @@ -1,4 +1,4 @@ -import type { GitBranchCompareSummary } from '../../../../../../shared/git-diff-compare-types' +import type { GitBranchCompareSummary } from '../../../../../../shared/git/diff/git-diff-compare-types' export function getKnownGitHead(head: string | null | undefined): string | undefined { const trimmed = head?.trim() diff --git a/src/renderer/src/store/slices/editor/git/git-status-reconciliation.ts b/src/renderer/src/store/slices/editor/git/git-status-reconciliation.ts index b86a5ebb9d3..e2187625e77 100644 --- a/src/renderer/src/store/slices/editor/git/git-status-reconciliation.ts +++ b/src/renderer/src/store/slices/editor/git/git-status-reconciliation.ts @@ -3,7 +3,7 @@ import type { GitConflictKind, GitStatusEntry, GitUpstreamStatus -} from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/status/git-status-types' import type { BranchCompareLike, CommitCompareLike, OpenFile } from '../types/open-file' import type { BranchCompareSnapshot, diff --git a/src/renderer/src/store/slices/editor/types/editor-files-slice.ts b/src/renderer/src/store/slices/editor/types/editor-files-slice.ts index c47aafe07a5..c2a770016bf 100644 --- a/src/renderer/src/store/slices/editor/types/editor-files-slice.ts +++ b/src/renderer/src/store/slices/editor/types/editor-files-slice.ts @@ -10,8 +10,8 @@ import type { GitBranchChangeEntry, GitBranchCompareSummary, GitCommitCompareSummary -} from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { WorkspaceVisibleTabType } from '../../../../../../shared/tab-types' import type { BranchCompareLike, diff --git a/src/renderer/src/store/slices/editor/types/editor-git-slice.ts b/src/renderer/src/store/slices/editor/types/editor-git-slice.ts index b2e05f845b4..909f351baf4 100644 --- a/src/renderer/src/store/slices/editor/types/editor-git-slice.ts +++ b/src/renderer/src/store/slices/editor/types/editor-git-slice.ts @@ -3,7 +3,7 @@ import type { WorkspaceSessionHydrationOptions } from '@/lib/workspace-session-h import type { GitBranchChangeEntry, GitBranchCompareSummary -} from '../../../../../../shared/git-diff-compare-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' import type { GitBranchLineTotal, GitConflictKind, @@ -11,7 +11,7 @@ import type { GitStatusEntry, GitStatusResult, GitUpstreamStatus -} from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/status/git-status-types' import type { WorkspaceSessionState } from '../../../../../../shared/workspace-session-state-types' import type { GitPushTarget } from '../../../../../../shared/worktree/types' import type { PendingEditorFocusRequest, PendingEditorReveal } from './pending-editor-reveal' diff --git a/src/renderer/src/store/slices/editor/types/open-file.ts b/src/renderer/src/store/slices/editor/types/open-file.ts index 5d03ce94f39..ceac587d3a0 100644 --- a/src/renderer/src/store/slices/editor/types/open-file.ts +++ b/src/renderer/src/store/slices/editor/types/open-file.ts @@ -4,8 +4,8 @@ import type { GitBranchChangeEntry, GitBranchCompareSummary, GitCommitCompareSummary -} from '../../../../../../shared/git-diff-compare-types' -import type { GitStatusEntry } from '../../../../../../shared/git-status-types' +} from '../../../../../../shared/git/diff/git-diff-compare-types' +import type { GitStatusEntry } from '../../../../../../shared/git/status/git-status-types' import type { BranchCompareSnapshot, CombinedDiffAlternate, diff --git a/src/renderer/src/store/slices/github-checks.ts b/src/renderer/src/store/slices/github-checks.ts index 58d5fd556eb..da3833457d7 100644 --- a/src/renderer/src/store/slices/github-checks.ts +++ b/src/renderer/src/store/slices/github-checks.ts @@ -7,14 +7,12 @@ import { type RuntimeFocusSettings } from '../../../../shared/github/github-cache-key' import { githubRepoIdentityKey } from '../../../../shared/github/repository-identity-key' -import { derivePRCheckStatus } from '../../../../shared/pr-check-status' +import { derivePRCheckStatus } from '../../../../shared/source-control/checks/pr-check-status' export function normalizeBranchName(branch: string): string { return branch.replace(/^refs\/heads\//, '') } -export const deriveCheckStatusFromChecks = derivePRCheckStatus - export function syncPRChecksStatus( state: AppState, repoPath: string, @@ -54,7 +52,7 @@ export function syncPRChecksStatus( return null } - const nextStatus = deriveCheckStatusFromChecks(checks) + const nextStatus = derivePRCheckStatus(checks) // Detail pages are partial; retain the complete same-head summary until the next PR lookup. if (prEntry.data.checksStatus === nextStatus) { return null diff --git a/src/renderer/src/store/slices/github-pr-branch-direct-refresh-scope.test.ts b/src/renderer/src/store/slices/github-pr-branch-direct-refresh-scope.test.ts index 25d75b100eb..c7262caffd3 100644 --- a/src/renderer/src/store/slices/github-pr-branch-direct-refresh-scope.test.ts +++ b/src/renderer/src/store/slices/github-pr-branch-direct-refresh-scope.test.ts @@ -11,7 +11,7 @@ import { runtimeEnvironmentCall } from './github-slice-test-harness' import type { AppState } from '../types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { getHostedReviewCacheKey } from './hosted-review-cache-identity' beforeEach(() => { diff --git a/src/renderer/src/store/slices/github-pr-branch-hosted-review-cache.test.ts b/src/renderer/src/store/slices/github-pr-branch-hosted-review-cache.test.ts index cc8c14a777f..e24c6c62972 100644 --- a/src/renderer/src/store/slices/github-pr-branch-hosted-review-cache.test.ts +++ b/src/renderer/src/store/slices/github-pr-branch-hosted-review-cache.test.ts @@ -3,7 +3,7 @@ import { createElement } from 'react' import { act, render, cleanup } from '@testing-library/react' import { TooltipProvider } from '@/components/ui/tooltip' import { ReviewChecksIndicator } from '@/components/sidebar/WorktreeCardMetadataStatusBadges' -import { summarizeProviderChecks } from '../../../../shared/provider-check-summary' +import { summarizeProviderChecks } from '../../../../shared/source-control/checks/provider-check-summary' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { prChecksCacheSuffix } from '../github/cache-identity' import { _clearGitHubPRRefreshStartedEntriesForTest } from '../github/request-coordination' @@ -14,7 +14,7 @@ import { resetRemoteRuntimeMocks } from './github-slice-test-harness' import type { AppState } from '../types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { getHostedReviewCacheKey } from './hosted-review-cache-identity' describe('createGitHubSlice.fetchPRForBranch', () => { diff --git a/src/renderer/src/store/slices/github-pr-manual-refresh-broadcast.test.ts b/src/renderer/src/store/slices/github-pr-manual-refresh-broadcast.test.ts index 4971ff41308..76c0844d654 100644 --- a/src/renderer/src/store/slices/github-pr-manual-refresh-broadcast.test.ts +++ b/src/renderer/src/store/slices/github-pr-manual-refresh-broadcast.test.ts @@ -10,7 +10,7 @@ import { import type { PRRefreshOutcome } from '../../../../shared/github/pull-request-refresh-types' import type { PRInfo, CheckStatus } from '../../../../shared/github/pull-request-types' import type { PRCheckDetail } from '../../../../shared/github/check-types' -import '../../../../shared/hosted-review-github' +import '../../../../shared/source-control/hosted-review/hosted-review-github' function createRefreshContext(pr: PRInfo | null = null) { const store = createTestStore() diff --git a/src/renderer/src/store/slices/github-pr-rejected-cache.test.ts b/src/renderer/src/store/slices/github-pr-rejected-cache.test.ts index edf6cfbb419..4a45a082eb6 100644 --- a/src/renderer/src/store/slices/github-pr-rejected-cache.test.ts +++ b/src/renderer/src/store/slices/github-pr-rejected-cache.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { persistGitHubCacheChanges } from '../github/cache-persistence' -import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/hosted-review-github' +import { hostedReviewInfoFromGitHubPRInfo } from '../../../../shared/source-control/hosted-review/hosted-review-github' import { _clearGitHubPRRefreshStartedEntriesForTest } from '../github/request-coordination' import { getHostedReviewCacheKey } from './hosted-review-cache-identity' import { diff --git a/src/renderer/src/store/slices/hosted-review-cache-race.test.ts b/src/renderer/src/store/slices/hosted-review-cache-race.test.ts index 4007ea15721..886350502b5 100644 --- a/src/renderer/src/store/slices/hosted-review-cache-race.test.ts +++ b/src/renderer/src/store/slices/hosted-review-cache-race.test.ts @@ -3,7 +3,7 @@ import { create } from 'zustand' import type { AppState } from '../types' import { createHostedReviewSlice } from './hosted-review' import { getHostedReviewCacheKey } from './hosted-review-cache-identity' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' const runtimeRpc = vi.hoisted(() => ({ callRuntimeRpc: vi.fn() diff --git a/src/renderer/src/store/slices/hosted-review-cache-state.ts b/src/renderer/src/store/slices/hosted-review-cache-state.ts index 4ca42f90702..79ac4cfeff3 100644 --- a/src/renderer/src/store/slices/hosted-review-cache-state.ts +++ b/src/renderer/src/store/slices/hosted-review-cache-state.ts @@ -7,8 +7,8 @@ import type { HostedReviewForBranchOutcome, HostedReviewForBranchReply, HostedReviewInfo -} from '../../../../shared/hosted-review' -import { hostedReviewForBranchOutcome } from '../../../../shared/hosted-review' +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' +import { hostedReviewForBranchOutcome } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import type { PRInfo } from '../../../../shared/github/pull-request-types' import { getRepoExecutionHostId } from '../../../../shared/execution-host' diff --git a/src/renderer/src/store/slices/hosted-review-cache.test.ts b/src/renderer/src/store/slices/hosted-review-cache.test.ts index 7e0783ed371..024cc5d4fd4 100644 --- a/src/renderer/src/store/slices/hosted-review-cache.test.ts +++ b/src/renderer/src/store/slices/hosted-review-cache.test.ts @@ -7,7 +7,7 @@ import { _getHostedReviewRequestGenerationCountForTest } from './hosted-review-request-state' import { getHostedReviewCacheKey } from './hosted-review-cache-identity' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' const runtimeRpc = vi.hoisted(() => ({ callRuntimeRpc: vi.fn() diff --git a/src/renderer/src/store/slices/hosted-review-card-refresh.ts b/src/renderer/src/store/slices/hosted-review-card-refresh.ts index 5289ae7f98d..7db13ca6c78 100644 --- a/src/renderer/src/store/slices/hosted-review-card-refresh.ts +++ b/src/renderer/src/store/slices/hosted-review-card-refresh.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { LinkedReviewHints } from './hosted-review-cache-identity' import type { HostedReviewFetchOptions } from './hosted-review-cache-state' diff --git a/src/renderer/src/store/slices/hosted-review-pr-cache.ts b/src/renderer/src/store/slices/hosted-review-pr-cache.ts index 957438d8f4b..196b5c176ef 100644 --- a/src/renderer/src/store/slices/hosted-review-pr-cache.ts +++ b/src/renderer/src/store/slices/hosted-review-pr-cache.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import type { AppState } from '../types' import { diff --git a/src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts b/src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts index 51be5f268c6..787d072ada6 100644 --- a/src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts +++ b/src/renderer/src/store/slices/hosted-review-request-lifetime.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { create } from 'zustand' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { AppState } from '../types' import { createHostedReviewSlice } from './hosted-review' import { diff --git a/src/renderer/src/store/slices/hosted-review-request-state.ts b/src/renderer/src/store/slices/hosted-review-request-state.ts index fc7a60224d9..6400db32933 100644 --- a/src/renderer/src/store/slices/hosted-review-request-state.ts +++ b/src/renderer/src/store/slices/hosted-review-request-state.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { slowTaskRequiredIdleMs } from '@/components/right-sidebar/coalesced-poll-runner' const HOSTED_REVIEW_REVALIDATION_IDLE_MULTIPLIER = 5 diff --git a/src/renderer/src/store/slices/hosted-review.test.ts b/src/renderer/src/store/slices/hosted-review.test.ts index 9a3b265965b..81c8148b109 100644 --- a/src/renderer/src/store/slices/hosted-review.test.ts +++ b/src/renderer/src/store/slices/hosted-review.test.ts @@ -5,7 +5,7 @@ import { createHostedReviewSlice } from './hosted-review' import './hosted-review-card-refresh' import { getHostedReviewCacheKey } from './hosted-review-cache-identity' import { HostedReviewCreationEligibilityTimeoutError } from './hosted-review-cache-state' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import '../../../../shared/constants' const runtimeRpc = vi.hoisted(() => ({ diff --git a/src/renderer/src/store/slices/hosted-review.ts b/src/renderer/src/store/slices/hosted-review.ts index cf95561a87c..72b1e3c1ddc 100644 --- a/src/renderer/src/store/slices/hosted-review.ts +++ b/src/renderer/src/store/slices/hosted-review.ts @@ -5,7 +5,7 @@ import type { HostedReviewCreationEligibility, HostedReviewCreationEligibilityArgs, HostedReviewInfo -} from '../../../../shared/hosted-review' +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { callRuntimeRpc } from '@/runtime/runtime-rpc-client' import type { AppState } from '../types' import { nextLookupGeneration } from '../lookup-generation-sequence' diff --git a/src/renderer/src/store/slices/workspace-cleanup-removal.ts b/src/renderer/src/store/slices/workspace-cleanup-removal.ts index a5701013f4a..e65451e6671 100644 --- a/src/renderer/src/store/slices/workspace-cleanup-removal.ts +++ b/src/renderer/src/store/slices/workspace-cleanup-removal.ts @@ -10,7 +10,7 @@ import { getWorkspaceCleanupCandidateIdentity, getWorkspaceCleanupHostIdentity } from '../../../../shared/workspace-cleanup-host-identity' -import type { PreservedBranchCleanup } from '@/lib/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../shared/git/branches/preserved-branch-cleanup' import { preflightWorkspaceCleanupCandidates, resolveWorkspaceCleanupRemovalTargets, diff --git a/src/renderer/src/store/slices/worktrees-terminal-pr-exact-observation.test.ts b/src/renderer/src/store/slices/worktrees-terminal-pr-exact-observation.test.ts index c5c30a0a600..1c260c2c516 100644 --- a/src/renderer/src/store/slices/worktrees-terminal-pr-exact-observation.test.ts +++ b/src/renderer/src/store/slices/worktrees-terminal-pr-exact-observation.test.ts @@ -1,6 +1,6 @@ import { beforeEach, expect, it, vi } from 'vitest' import type { GitHubWorkItem } from '../../../../shared/github/work-item-types' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { getWorkspaceAttachments } from '../../../../shared/workspace-attachments' import { makeWorktree } from './worktrees-slice-test-fixtures' import { diff --git a/src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts b/src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts index 2a612bf0ae1..f8a3d106465 100644 --- a/src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts +++ b/src/renderer/src/store/slices/worktrees-terminal-pr-url-linking.test.ts @@ -1,5 +1,8 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { HostedReviewInfo, HostedReviewForBranchArgs } from '../../../../shared/hosted-review' +import type { + HostedReviewInfo, + HostedReviewForBranchArgs +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { makeWorktree } from './worktrees-slice-test-fixtures' import { getWorkspaceAttachments } from '../../../../shared/workspace-attachments' import { diff --git a/src/renderer/src/store/slices/worktrees-terminal-reference-origins.test.ts b/src/renderer/src/store/slices/worktrees-terminal-reference-origins.test.ts index 47d3cf514c6..304c11ec12e 100644 --- a/src/renderer/src/store/slices/worktrees-terminal-reference-origins.test.ts +++ b/src/renderer/src/store/slices/worktrees-terminal-reference-origins.test.ts @@ -1,4 +1,7 @@ -import type { HostedReviewInfo, HostedReviewForBranchArgs } from '../../../../shared/hosted-review' +import type { + HostedReviewInfo, + HostedReviewForBranchArgs +} from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import { singlePaneLayoutSnapshot } from './terminal-helpers' import { beforeEach, describe, expect, it, vi } from 'vitest' import { makeTerminalTab, makeWorktree } from './worktrees-slice-test-fixtures' diff --git a/src/renderer/src/store/slices/worktrees-terminal-reference-source-race.test.ts b/src/renderer/src/store/slices/worktrees-terminal-reference-source-race.test.ts index 513e94c64e2..fd6633ddb9e 100644 --- a/src/renderer/src/store/slices/worktrees-terminal-reference-source-race.test.ts +++ b/src/renderer/src/store/slices/worktrees-terminal-reference-source-race.test.ts @@ -1,5 +1,5 @@ import { beforeEach, expect, it, vi } from 'vitest' -import type { HostedReviewInfo } from '../../../../shared/hosted-review' +import type { HostedReviewInfo } from '../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { Repo } from '../../../../shared/repo-types' import { bumpProviderRuntimeSessionGeneration } from '@/lib/provider-runtime-context' import { makeWorktree } from './worktrees-slice-test-fixtures' diff --git a/src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.ts b/src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.ts index 8b8923dd2e7..0c514db7e00 100644 --- a/src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.ts +++ b/src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target.ts @@ -1,6 +1,6 @@ import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client' import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' -import { isPositiveHostedReviewNumber } from '../../../../../../shared/hosted-review' +import { isPositiveHostedReviewNumber } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import type { GitHubPrStartPoint, GitPushTarget, diff --git a/src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts b/src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts index bc9a80a6ccf..a924ad70ef7 100644 --- a/src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts +++ b/src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts @@ -11,7 +11,7 @@ import { normalizeGitHubPRSuppressionUpdate } from '../../../../../../shared/wor import type { WorktreeSlice } from '../../worktree-helpers' import type { WorktreeSliceGet, WorktreeSliceSet } from '../listing/worktree-slice-types' import { translate } from '@/i18n/i18n' -import { isPositiveHostedReviewNumber } from '../../../../../../shared/hosted-review' +import { isPositiveHostedReviewNumber } from '../../../../../../shared/source-control/hosted-review/hosted-review-contracts' import { displayNameUpdatePinsLabel } from '../../../../../../shared/worktree/display-name-provenance' import { parseWorkspaceKey } from '../../../../../../shared/workspace-scope' import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../../../../shared/sidebar-inputs-switch' diff --git a/src/renderer/src/store/slices/worktrees/teardown/force-delete-preserved-branch.ts b/src/renderer/src/store/slices/worktrees/teardown/force-delete-preserved-branch.ts index 03cd2668a41..f582ce48305 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/force-delete-preserved-branch.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/force-delete-preserved-branch.ts @@ -6,9 +6,9 @@ import { translate } from '@/i18n/i18n' import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client' import { runtimeTargetForWorkspaceOwner } from '@/lib/resolve-owner' import { toRuntimeWorktreeSelector } from '../../../../runtime/runtime-worktree-selector' -import { preservedBranchCleanupKey } from '../../../../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupKey } from '../../../../../../shared/git/branches/preserved-branch-cleanup' import type { ForceDeleteWorktreeBranchResult } from '../../../../../../shared/worktree/create-types' -import type { PreservedBranchCleanup } from '../../../../../../shared/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../../../shared/git/branches/preserved-branch-cleanup' import { preservedBranchRuntimeTargetByCleanupKey } from './preserved-branch-cleanup-target' import { ambiguousWorkspaceOwnerMessage } from '@/lib/duplicate-paired-servers' diff --git a/src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts b/src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts index b2049931fce..2c2ca935e24 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/host-qualified-worktree-removal.ts @@ -20,7 +20,7 @@ import { cleanupEphemeralVmRuntimesForDeleted } from '@/lib/ephemeral-vm-runtime import { purgeOrphanedRuntimeSshProjects } from './orphaned-runtime-ssh-project-purge' import { completePreservedBranchCleanup } from './complete-preserved-branch-cleanup' -import { preservedBranchCleanupKey } from '../../../../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupKey } from '../../../../../../shared/git/branches/preserved-branch-cleanup' import { preservedBranchRuntimeTargetByCleanupKey } from './preserved-branch-cleanup-target' import { worktreeHostMatchOptions, worktreeMatchesHost } from '../listing/worktree-host-ownership' import { diff --git a/src/renderer/src/store/slices/worktrees/teardown/preserved-branch-cleanup-target.ts b/src/renderer/src/store/slices/worktrees/teardown/preserved-branch-cleanup-target.ts index 86e84d77d3e..b4f4484fca9 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/preserved-branch-cleanup-target.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/preserved-branch-cleanup-target.ts @@ -1,5 +1,5 @@ import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target' -import type { PreservedBranchCleanup } from '../../../../../../shared/preserved-branch-cleanup' +import type { PreservedBranchCleanup } from '../../../../../../shared/git/branches/preserved-branch-cleanup' export const preservedBranchRuntimeTargetByCleanupKey = new Map< string, diff --git a/src/renderer/src/store/slices/worktrees/teardown/remove-worktree.ts b/src/renderer/src/store/slices/worktrees/teardown/remove-worktree.ts index f94c42bc24f..4be2dc35109 100644 --- a/src/renderer/src/store/slices/worktrees/teardown/remove-worktree.ts +++ b/src/renderer/src/store/slices/worktrees/teardown/remove-worktree.ts @@ -25,7 +25,7 @@ import { getLockedWorktreeRemovalReason, isLockedWorktreeRemovalError } from '../../../../../../shared/worktree/removal' -import { preservedBranchCleanupKey } from '../../../../../../shared/preserved-branch-cleanup' +import { preservedBranchCleanupKey } from '../../../../../../shared/git/branches/preserved-branch-cleanup' import { getWorktreeDeleteStateKey } from './worktree-delete-state' import { pruneHostedReviewLinkMutationGenerations } from '../metadata/hosted-review-link-mutation' import { rememberAuthoritativelyRemovedWorktrees } from '../listing/authoritative-worktree-removal-memory' diff --git a/src/renderer/src/web/preload-api/web-git-api.ts b/src/renderer/src/web/preload-api/web-git-api.ts index 044994e562d..d5f0530ed6b 100644 --- a/src/renderer/src/web/preload-api/web-git-api.ts +++ b/src/renderer/src/web/preload-api/web-git-api.ts @@ -4,7 +4,7 @@ import { toRuntimeWorktreeSelector } from '../../runtime/runtime-worktree-select import { translate } from '@/i18n/i18n' import { callRuntimeResult } from './web-runtime-calls' import { mutateGitPath, mutateGitPaths, resolveGitConflict } from './web-git-mutations' -import { requireGitStageWorktreeScopeReceipt } from '../../../../shared/git-stage-worktree-scope' +import { requireGitStageWorktreeScopeReceipt } from '../../../../shared/git/paths/git-stage-worktree-scope' import { requireActiveEnvironment, updateEnvironmentFromResponse } from './web-runtime-session' import { resolveRuntimeFilePath, diff --git a/src/renderer/src/web/preload-api/web-git-mutations.ts b/src/renderer/src/web/preload-api/web-git-mutations.ts index 72f8d425044..1bb0c22192a 100644 --- a/src/renderer/src/web/preload-api/web-git-mutations.ts +++ b/src/renderer/src/web/preload-api/web-git-mutations.ts @@ -1,5 +1,5 @@ import { toRuntimeWorktreeSelector } from '../../runtime/runtime-worktree-selector' -import type { ConflictResolution } from '../../../../shared/source-control-entry-actions' +import type { ConflictResolution } from '../../../../shared/source-control/listing/source-control-entry-actions' import { callRuntimeResult } from './web-runtime-calls' import { resolveRuntimeFilePath, diff --git a/src/renderer/src/web/preload-api/web-github-api.ts b/src/renderer/src/web/preload-api/web-github-api.ts index 2c91b699f10..af759371463 100644 --- a/src/renderer/src/web/preload-api/web-github-api.ts +++ b/src/renderer/src/web/preload-api/web-github-api.ts @@ -5,7 +5,7 @@ import type { PreloadApi } from '../../../../preload/api-types' import { GITHUB_MARK_PR_READY_RUNTIME_CAPABILITY, GITHUB_MARK_PR_READY_UPDATE_REQUIRED_MESSAGE -} from '../../../../shared/protocol-version' +} from '../../../../shared/source-control/runtime/source-control-runtime-capabilities' import { translate } from '@/i18n/i18n' import { GITHUB_WEB_RPC_METHODS } from './web-github-routes' import type { WebGitHubRuntimeMethod } from './web-github-routes' diff --git a/src/renderer/src/web/preload-api/web-github-queued-authority.test.ts b/src/renderer/src/web/preload-api/web-github-queued-authority.test.ts index 13dd8dc804d..b00e27d1061 100644 --- a/src/renderer/src/web/preload-api/web-github-queued-authority.test.ts +++ b/src/renderer/src/web/preload-api/web-github-queued-authority.test.ts @@ -7,7 +7,7 @@ import { RUNTIME_PROTOCOL_VERSION, MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION } from '../../../../shared/protocol-version' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as exact } from '../../../../shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY as exact } from '../../../../shared/source-control/runtime/source-control-runtime-capabilities' import { createGitHubApi } from './web-github-api' import { callEnvironmentEnvelope } from './web-runtime-calls' import { diff --git a/src/renderer/src/web/preload-api/web-preferences-store.ts b/src/renderer/src/web/preload-api/web-preferences-store.ts index ea26ba97a84..efb3ecf3e5a 100644 --- a/src/renderer/src/web/preload-api/web-preferences-store.ts +++ b/src/renderer/src/web/preload-api/web-preferences-store.ts @@ -12,7 +12,7 @@ import type { PersistedUIState } from '../../../../shared/persisted-ui-state-typ import { applyPRBotAuthorOverride, normalizePRBotAuthorOverrides -} from '../../../../shared/pr-bot-author-overrides' +} from '../../../../shared/source-control/review-comments/pr-bot-author-overrides' import { readStoredWebRuntimeEnvironment } from '../web-runtime-environment' import { mergeSettings, diff --git a/src/renderer/src/web/web-preload-api-github.test.ts b/src/renderer/src/web/web-preload-api-github.test.ts index c8052d67def..01889cb642c 100644 --- a/src/renderer/src/web/web-preload-api-github.test.ts +++ b/src/renderer/src/web/web-preload-api-github.test.ts @@ -1,5 +1,5 @@ import { GITHUB_EXACT_DETAILS_READ_INTENT_RUNTIME_CAPABILITY } from '../../../shared/task-source-runtime-capabilities' -import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../shared/source-control-runtime-capabilities' +import { GITHUB_EXACT_WORK_ITEM_TARGET_RUNTIME_CAPABILITY } from '../../../shared/source-control/runtime/source-control-runtime-capabilities' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { RuntimeRpcResponse } from '../../../shared/runtime-rpc-envelope' diff --git a/src/shared/agent-launch/choices/agent-launch-choices.test.ts b/src/shared/agent-launch/choices/agent-launch-choices.test.ts index 445b4766bb3..0878544263f 100644 --- a/src/shared/agent-launch/choices/agent-launch-choices.test.ts +++ b/src/shared/agent-launch/choices/agent-launch-choices.test.ts @@ -2,14 +2,14 @@ import { normalizeSourceControlActionRecipe, readSourceControlActionDefault, type SourceControlActionRecipe -} from '../../source-control-ai-actions' -import { liftActionPermissionArgs } from '../../source-control-action-permission-lift' +} from '../../source-control/ai/recipes/source-control-ai-actions' +import { liftActionPermissionArgs } from '../../source-control/ai/recipes/source-control-action-permission-lift' import { lowerActionArgumentChoices, readActionArgumentNode, transportActionArgumentChoices -} from '../../source-control-action-argument-document' -import { editActionArgumentChoices } from '../../source-control-action-argument-choices' +} from '../../source-control/ai/recipes/source-control-action-argument-document' +import { editActionArgumentChoices } from '../../source-control/ai/recipes/source-control-action-argument-choices' import * as startupShell from '../startup/tui-agent-startup-shell' import { tokenizeStartupCommand } from '../startup/tui-agent-startup-shell' import { describe, expect, it, vi } from 'vitest' diff --git a/src/shared/agent-launch/picker/agent-launch-picker-catalog.ts b/src/shared/agent-launch/picker/agent-launch-picker-catalog.ts index 6702fe2276a..6e754ec887e 100644 --- a/src/shared/agent-launch/picker/agent-launch-picker-catalog.ts +++ b/src/shared/agent-launch/picker/agent-launch-picker-catalog.ts @@ -2,7 +2,7 @@ import { discoveredModel } from '../../agent-session/options/structured-agent-se import { createClaudeCatalogOptions } from '../../agent-session/options/agent-session-option-catalog-claude-codex' import type { CatalogOption } from '../../agent-session/options/agent-session-option-catalog-types' import { getAgentSessionOptionLaunchCatalog } from '../../agent-session/options/agent-session-option-catalog' -import { sourceControlActionOptions } from '../../source-control-action-options' +import { sourceControlActionOptions } from '../../source-control/ai/recipes/source-control-action-options' import { agentPermissionChoices, agentPermissionHasTerminalChoice diff --git a/src/shared/agent-launch/picker/agent-launch-picker-receipt.ts b/src/shared/agent-launch/picker/agent-launch-picker-receipt.ts index dbcd9117f80..944b6a9bb11 100644 --- a/src/shared/agent-launch/picker/agent-launch-picker-receipt.ts +++ b/src/shared/agent-launch/picker/agent-launch-picker-receipt.ts @@ -5,18 +5,18 @@ import { editSourceControlActionArguments, selectSourceControlActionRecipe, type CurrentActionSelection -} from '../../source-control-action-selection' +} from '../../source-control/ai/recipes/source-control-action-selection' import { selectedSourceControlActionPreferences, sourceControlActionExecutionArgs, demoteDisplacedActionArgumentChoices -} from '../../source-control-action-launch-preferences' +} from '../../source-control/ai/recipes/source-control-action-launch-preferences' import { editActionArgumentChoices, reconcileActionArgumentDocumentTransaction -} from '../../source-control-action-argument-choices' -import { editActionArgumentChoicePreferences } from '../../source-control-action-choice-preferences' -import { trimActionArgumentDocument } from '../../source-control-action-argument-document' +} from '../../source-control/ai/recipes/source-control-action-argument-choices' +import { editActionArgumentChoicePreferences } from '../../source-control/ai/recipes/source-control-action-choice-preferences' +import { trimActionArgumentDocument } from '../../source-control/ai/recipes/source-control-action-argument-document' type AcceptedChoices = ReturnType diff --git a/src/shared/agent-launch/picker/agent-launch-picker.ts b/src/shared/agent-launch/picker/agent-launch-picker.ts index bdf3141d786..6c2e0e51b4f 100644 --- a/src/shared/agent-launch/picker/agent-launch-picker.ts +++ b/src/shared/agent-launch/picker/agent-launch-picker.ts @@ -20,7 +20,7 @@ import type { } from '../../agent-session/agent-session-wire' import { orderAgentLaunchPickerAgents, type NewTabAgentMenuRow } from './agent-launch-picker-rows' import type { TuiAgent } from '../catalog/tui-agent' -import type { CurrentActionSelection } from '../../source-control-action-selection' +import type { CurrentActionSelection } from '../../source-control/ai/recipes/source-control-action-selection' export type AgentPickerSurface = 'chat' | 'terminal' export type AgentPickerDraftOwner = object diff --git a/src/shared/agent-launch/startup/agent-command-plan.ts b/src/shared/agent-launch/startup/agent-command-plan.ts index 4c398e0fc13..95b7829904c 100644 --- a/src/shared/agent-launch/startup/agent-command-plan.ts +++ b/src/shared/agent-launch/startup/agent-command-plan.ts @@ -2,7 +2,7 @@ import { extractLeadingEnvAssignments } from '../../command-environment' import { tokenizeCustomCommandTemplate, type CommandTemplateBackslash -} from '../../commit-message-prompt' +} from '../../source-control/ai/generation/commit-message-prompt' export function parseAgentCommand( defaultBinary: string, diff --git a/src/shared/agent-launch/startup/tui-agent-launch-command-argument-values.test.ts b/src/shared/agent-launch/startup/tui-agent-launch-command-argument-values.test.ts index 0dd0b995e65..4f8648d1943 100644 --- a/src/shared/agent-launch/startup/tui-agent-launch-command-argument-values.test.ts +++ b/src/shared/agent-launch/startup/tui-agent-launch-command-argument-values.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import recordings from '../../fixtures/source-control-launch-recordings.json' -import { normalizeSourceControlActionLaunchPreferences } from '../../source-control-action-model-selection' -import { sourceControlActionLaunchOptions } from '../../source-control-action-launch-preferences' +import { normalizeSourceControlActionLaunchPreferences } from '../../source-control/ai/recipes/source-control-action-model-selection' +import { sourceControlActionLaunchOptions } from '../../source-control/ai/recipes/source-control-action-launch-preferences' import type { SessionOptionValue } from '../../native-chat/input/native-chat-session-options' import { resolveAgentLaunchCommand, terminalSessionOptionInputs } from './tui-agent-launch-command' import { tokenizeStartupCommand } from './tui-agent-startup-shell' diff --git a/src/shared/agent-launch/startup/tui-agent-startup-shell.ts b/src/shared/agent-launch/startup/tui-agent-startup-shell.ts index 7377742adf0..f5a76a66fed 100644 --- a/src/shared/agent-launch/startup/tui-agent-startup-shell.ts +++ b/src/shared/agent-launch/startup/tui-agent-startup-shell.ts @@ -1,4 +1,7 @@ -import { tokenizeCustomCommandTemplate, type CommandTokenSpan } from '../../commit-message-prompt' +import { + tokenizeCustomCommandTemplate, + type CommandTokenSpan +} from '../../source-control/ai/generation/commit-message-prompt' import { quotePowerShellLiteral } from '../../powershell-native-argument' /** posix output must parse identically across Unix shells including fish; remote/WSL shell detection is not reliable enough to choose a separate dialect. */ diff --git a/src/shared/agent-model-probe-spec.ts b/src/shared/agent-model-probe-spec.ts index 0df658fc1df..2e1693cee47 100644 --- a/src/shared/agent-model-probe-spec.ts +++ b/src/shared/agent-model-probe-spec.ts @@ -1,4 +1,7 @@ -import { getCommitMessageAgentSpec, type CommitMessageAgentSpec } from './commit-message-agent-spec' +import { + getCommitMessageAgentSpec, + type CommitMessageAgentSpec +} from './source-control/ai/generation/commit-message-agent-spec' import { GROK_MODEL_LIST_ARGS, parseGrokModelList } from './grok-model-list-probe' import { OMP_MODEL_LIST_ARGS, parseOmpModelList } from './omp-model-list-probe' import type { TuiAgent } from './agent-launch/catalog/tui-agent' diff --git a/src/shared/ansi-escape-sequences-consumers.test.ts b/src/shared/ansi-escape-sequences-consumers.test.ts index 3657b576846..6c61b5cf57c 100644 --- a/src/shared/ansi-escape-sequences-consumers.test.ts +++ b/src/shared/ansi-escape-sequences-consumers.test.ts @@ -1,6 +1,6 @@ import { beforeAll, describe, expect, it } from 'vitest' import { loadAnsiConsumers } from '../../config/scripts/check-job-log-consumer-oracles.mjs' -import { gitLabJobTraceToLogExcerpt } from './gitlab-job-log-excerpt' +import { gitLabJobTraceToLogExcerpt } from './source-control/checks/gitlab/gitlab-job-log-excerpt' import { surfaceNativeChatCommandOutputs } from './native-chat/tools/native-chat-command-output' import type { NativeChatMessage } from './native-chat/native-chat-types' diff --git a/src/shared/antigravity-generation-plan.test.ts b/src/shared/antigravity-generation-plan.test.ts index 81fa477cac1..64e805bef98 100644 --- a/src/shared/antigravity-generation-plan.test.ts +++ b/src/shared/antigravity-generation-plan.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { planCommitMessageGeneration } from './commit-message-plan' +import { planCommitMessageGeneration } from './source-control/ai/generation/commit-message-plan' describe('Antigravity generation planning', () => { it.each(['-fix: something', '--sandbox', 'line one\n"quoted"\r\n日本語 🐳'])( diff --git a/src/shared/chat-naming-catalog-work.test-fixture.ts b/src/shared/chat-naming-catalog-work.test-fixture.ts index c6bcedfe9e3..547a112f3fb 100644 --- a/src/shared/chat-naming-catalog-work.test-fixture.ts +++ b/src/shared/chat-naming-catalog-work.test-fixture.ts @@ -1,5 +1,5 @@ import { vi } from 'vitest' -import { normalizeSourceControlAiSettings } from './source-control-ai-settings' +import { normalizeSourceControlAiSettings } from './source-control/ai/settings/source-control-ai-settings' export function savedChatNamingCatalog(size: number) { const source = normalizeSourceControlAiSettings(undefined) diff --git a/src/shared/command-environment.test.ts b/src/shared/command-environment.test.ts index 5ddb70e46f4..26942f77ae8 100644 --- a/src/shared/command-environment.test.ts +++ b/src/shared/command-environment.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from 'vitest' import { extractLeadingEnvAssignments, mergeCommandEnvironment } from './command-environment' import { planAgentBinary } from './agent-launch/startup/agent-command-plan' -import { planCommitMessageGeneration } from './commit-message-plan' -import { planCustomCommand } from './commit-message-prompt' +import { planCommitMessageGeneration } from './source-control/ai/generation/commit-message-plan' +import { planCustomCommand } from './source-control/ai/generation/commit-message-prompt' describe('command environment assignments', () => { it('parses only leading valid names and retains literal values', () => { diff --git a/src/shared/default-global-settings.ts b/src/shared/default-global-settings.ts index a06b717b373..433f5571261 100644 --- a/src/shared/default-global-settings.ts +++ b/src/shared/default-global-settings.ts @@ -4,7 +4,7 @@ import type { VoiceSettings } from './speech-types' import { DEFAULT_TERMINAL_FONT_WEIGHT, DEFAULT_TERMINAL_FONT_WEIGHT_BOLD } from './terminal-fonts' import { getDefaultTerminalQuickCommands } from './terminal-quick-commands' import { TASK_PROVIDERS } from './task-providers' -import { getDefaultSourceControlAiSettings } from './source-control-ai-settings' +import { getDefaultSourceControlAiSettings } from './source-control/ai/settings/source-control-ai-settings' import { DEFAULT_APP_ICON_ID } from './app-icon' import { DEFAULT_OPEN_IN_APPLICATIONS } from './open-in-applications' import { DEFAULT_DISABLED_TUI_AGENTS } from './agent-launch/catalog/tui-agent-selection' @@ -13,7 +13,7 @@ import { DEFAULT_LEFT_SIDEBAR_TINT_COLOR, DEFAULT_LEFT_SIDEBAR_TINT_OPACITY } from './left-sidebar-appearance' -import { DEFAULT_SOURCE_CONTROL_GROUP_ORDER } from './source-control-group-order' +import { DEFAULT_SOURCE_CONTROL_GROUP_ORDER } from './source-control/listing/source-control-group-order' import { DESKTOP_TERMINAL_SCROLLBACK_ROWS_DEFAULT } from './terminal-scrollback-policy' export function buildDefaultSettings(args: { diff --git a/src/shared/drop-staging-ignore-real-git.test.ts b/src/shared/drop-staging-ignore-real-git.test.ts index 3bed79934e9..e8c4b5b3961 100644 --- a/src/shared/drop-staging-ignore-real-git.test.ts +++ b/src/shared/drop-staging-ignore-real-git.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest' import { DROP_STAGING_GITIGNORE_CONTENT, DROP_STAGING_RELATIVE_DIR } from './drop-staging-ignore' -import { GitBinaryTestFixture } from './git-binary.test-fixture' +import { GitBinaryTestFixture } from './git/compatibility/git-binary.test-fixture' let fixture: GitBinaryTestFixture let root = '' diff --git a/src/shared/editor-formatter.ts b/src/shared/editor-formatter.ts index 79e231773b1..da65a24d43c 100644 --- a/src/shared/editor-formatter.ts +++ b/src/shared/editor-formatter.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { tokenizeCustomCommandTemplate } from './commit-message-prompt' +import { tokenizeCustomCommandTemplate } from './source-control/ai/generation/commit-message-prompt' export const editorFormatterSchema = z.object({ command: z.string().max(4096), diff --git a/src/shared/editor-tab-view-types.ts b/src/shared/editor-tab-view-types.ts index 403929f4219..68406a25b09 100644 --- a/src/shared/editor-tab-view-types.ts +++ b/src/shared/editor-tab-view-types.ts @@ -4,13 +4,13 @@ import type { GitBranchChangeEntry, GitBranchCompareSummary, GitCommitCompareSummary -} from './git-diff-compare-types' +} from './git/diff/git-diff-compare-types' import type { GitConflictKind, GitConflictResolutionStatus, GitConflictStatusSource, GitStatusEntry -} from './git-status-types' +} from './git/status/git-status-types' import type { GitLabProjectRef } from './gitlab-types' import type { PRCheckDetail, PRCheckRunDetails } from './github/check-types' import type { GitHubRepositoryIdentity } from './github/pull-request-types' diff --git a/src/shared/ephemeral-vm-recipe-diagnostics.ts b/src/shared/ephemeral-vm-recipe-diagnostics.ts index a26f5ec0bd7..5d2147aaab6 100644 --- a/src/shared/ephemeral-vm-recipe-diagnostics.ts +++ b/src/shared/ephemeral-vm-recipe-diagnostics.ts @@ -1,5 +1,5 @@ import { parsePairingCode } from './pairing' -import { stripCredentialsFromMessage } from './git-remote-error' +import { stripCredentialsFromMessage } from './git/remotes/git-remote-error' import { getEphemeralVmRecipeResultConnection, type EphemeralVmRecipeConnection, diff --git a/src/shared/ephemeral-vm-recipe-repo-url.ts b/src/shared/ephemeral-vm-recipe-repo-url.ts index d4089591a4d..49e330a2be4 100644 --- a/src/shared/ephemeral-vm-recipe-repo-url.ts +++ b/src/shared/ephemeral-vm-recipe-repo-url.ts @@ -1,4 +1,4 @@ -import { stripCredentialsFromMessage } from './git-remote-error' +import { stripCredentialsFromMessage } from './git/remotes/git-remote-error' import type { OrcaVmRecipe } from './orca-yaml-hook-types' export function getProvisionedRootRecipeRepoUrl( diff --git a/src/shared/git-admission-candidate-heap.ts b/src/shared/git/admission/git-admission-candidate-heap.ts similarity index 100% rename from src/shared/git-admission-candidate-heap.ts rename to src/shared/git/admission/git-admission-candidate-heap.ts diff --git a/src/shared/git-admission-node-compatibility.test.ts b/src/shared/git/admission/git-admission-node-compatibility.test.ts similarity index 82% rename from src/shared/git-admission-node-compatibility.test.ts rename to src/shared/git/admission/git-admission-node-compatibility.test.ts index ecbfdbfadc3..7c4f80f09ed 100644 --- a/src/shared/git-admission-node-compatibility.test.ts +++ b/src/shared/git/admission/git-admission-node-compatibility.test.ts @@ -14,7 +14,8 @@ it.each([ async (api, capacity) => { vi.resetModules() vi.doMock('node:os', () => ({ availableParallelism: api })) - const { GENERAL_CAP, GitAdmissionScheduler } = await import('./git-admission-scheduler.js') + const { GENERAL_CAP } = await import('./git-admission-state.js') + const { GitAdmissionScheduler } = await import('./git-admission-scheduler.js') expect(GENERAL_CAP).toBe(capacity) const scheduler = new GitAdmissionScheduler() const grant = await scheduler.acquire({ args: ['status'], cwd: '/repo' }) diff --git a/src/shared/git-admission-scheduler.ts b/src/shared/git/admission/git-admission-scheduler.ts similarity index 95% rename from src/shared/git-admission-scheduler.ts rename to src/shared/git/admission/git-admission-scheduler.ts index 276e7307d52..0ee82993c69 100644 --- a/src/shared/git-admission-scheduler.ts +++ b/src/shared/git/admission/git-admission-scheduler.ts @@ -1,5 +1,5 @@ -import { uncRouteKey } from './wsl-paths' -import { classifyGitCommand } from './git-command-classification' +import { uncRouteKey } from '../../wsl-paths' +import { classifyGitCommand } from '../commands/git-command-classification' import { GitAdmissionWaiterQueue } from './git-admission-waiter-queue' import { ADMISSION_TIER_VALUE, @@ -14,22 +14,6 @@ import { type GitAdmissionRequest } from './git-admission-state' -export type { - GitAdmissionEvent, - GitAdmissionGrant, - GitAdmissionRequest -} from './git-admission-state' -export { - GENERAL_CAP, - GENERAL_HEADROOM, - GIT_ADMISSION_AGING_MS, - MAX_GIT_CHILDREN, - NETWORK_CAP, - NETWORK_HEADROOM, - ROUTE_CAP, - ROUTE_HEADROOM -} from './git-admission-state' - function routeKey(request: GitAdmissionRequest): string | null { const distro = request.wslDistro?.trim().toLowerCase() return distro ? `wsl:${distro}` : uncRouteKey(request.cwd) diff --git a/src/shared/git-admission-state.ts b/src/shared/git/admission/git-admission-state.ts similarity index 97% rename from src/shared/git-admission-state.ts rename to src/shared/git/admission/git-admission-state.ts index ece1c22621e..119e7c0e930 100644 --- a/src/shared/git-admission-state.ts +++ b/src/shared/git/admission/git-admission-state.ts @@ -1,5 +1,5 @@ import * as os from 'node:os' -import type { GitAdmissionTier } from './rpc-contract/git-admission-tier-params' +import type { GitAdmissionTier } from '../../rpc-contract/git-admission-tier-params' // Older relay hosts lack availableParallelism; keep their concurrency conservative. const parallelism = typeof os.availableParallelism === 'function' ? os.availableParallelism() : 1 diff --git a/src/shared/git-admission-waiter-queue.ts b/src/shared/git/admission/git-admission-waiter-queue.ts similarity index 98% rename from src/shared/git-admission-waiter-queue.ts rename to src/shared/git/admission/git-admission-waiter-queue.ts index 3edfa14ac94..afb301fe7ac 100644 --- a/src/shared/git-admission-waiter-queue.ts +++ b/src/shared/git/admission/git-admission-waiter-queue.ts @@ -1,6 +1,6 @@ import type { AdmissionClass, AdmissionSlotKind, AdmissionWaiter } from './git-admission-state' import { CandidateHeap, type Candidate, type WaiterLane } from './git-admission-candidate-heap' -import type { GitAdmissionTier } from './rpc-contract/git-admission-tier-params' +import type { GitAdmissionTier } from '../../rpc-contract/git-admission-tier-params' type SelectedWaiter = { waiter: AdmissionWaiter diff --git a/src/shared/branch-prefix.test.ts b/src/shared/git/branches/branch-prefix.test.ts similarity index 100% rename from src/shared/branch-prefix.test.ts rename to src/shared/git/branches/branch-prefix.test.ts diff --git a/src/shared/branch-prefix.ts b/src/shared/git/branches/branch-prefix.ts similarity index 97% rename from src/shared/branch-prefix.ts rename to src/shared/git/branches/branch-prefix.ts index bd3866cd4c3..a1688e38769 100644 --- a/src/shared/branch-prefix.ts +++ b/src/shared/git/branches/branch-prefix.ts @@ -1,4 +1,4 @@ -import type { BranchPrefixStrategy } from './ui-chrome-types' +import type { BranchPrefixStrategy } from '../../ui-chrome-types' /** The branch-prefix settings slice the prefix helpers read. */ export type BranchPrefixSettings = { diff --git a/src/shared/git-branch-cleanup-fetch.ts b/src/shared/git/branches/git-branch-cleanup-fetch.ts similarity index 96% rename from src/shared/git-branch-cleanup-fetch.ts rename to src/shared/git/branches/git-branch-cleanup-fetch.ts index aafcb2d3030..0012096d972 100644 --- a/src/shared/git-branch-cleanup-fetch.ts +++ b/src/shared/git/branches/git-branch-cleanup-fetch.ts @@ -1,6 +1,6 @@ import type { GitBranchCleanupExec } from './git-branch-cleanup' -import { GIT_FETCH_SKIP_AUTO_MAINTENANCE_CONFIG_ARGS } from './git-fetch-auto-maintenance' -import { isMissingRemoteRefGitError } from './git-missing-remote-ref' +import { GIT_FETCH_SKIP_AUTO_MAINTENANCE_CONFIG_ARGS } from '../fetch/git-fetch-auto-maintenance' +import { isMissingRemoteRefGitError } from '../refs/git-missing-remote-ref' function matchRefPattern(pattern: string, ref: string): string | null { const star = pattern.indexOf('*') diff --git a/src/shared/git-branch-cleanup-real-git.test.ts b/src/shared/git/branches/git-branch-cleanup-real-git.test.ts similarity index 96% rename from src/shared/git-branch-cleanup-real-git.test.ts rename to src/shared/git/branches/git-branch-cleanup-real-git.test.ts index 93cc63ac9ac..88ffc63b602 100644 --- a/src/shared/git-branch-cleanup-real-git.test.ts +++ b/src/shared/git/branches/git-branch-cleanup-real-git.test.ts @@ -7,11 +7,11 @@ import { promisify } from 'node:util' import { afterEach, beforeEach, describe, expect, it } from 'vitest' import { branchHasNoUnmergedChangesOnAnyTarget, - refreshBranchCleanupTargetRefs, type GitBranchCleanupExec } from './git-branch-cleanup' -import { GitCapabilityCache } from './git-capability-cache' -import { removeTree } from './windows-transient-lock-removal' +import { refreshBranchCleanupTargetRefs } from './git-branch-cleanup-fetch' +import { GitCapabilityCache } from '../commands/git-capability-cache' +import { removeTree } from '../../windows-transient-lock-removal' const execFileAsync = promisify(execFile) diff --git a/src/shared/git-branch-cleanup.test.ts b/src/shared/git/branches/git-branch-cleanup.test.ts similarity index 98% rename from src/shared/git-branch-cleanup.test.ts rename to src/shared/git/branches/git-branch-cleanup.test.ts index f16a74a5561..8daf207d170 100644 --- a/src/shared/git-branch-cleanup.test.ts +++ b/src/shared/git/branches/git-branch-cleanup.test.ts @@ -2,11 +2,11 @@ import { describe, expect, it, vi } from 'vitest' import { branchHasNoUnmergedChangesOnAnyTarget, branchHasNoUnmergedChangesWithLazyTargetRefresh, - refreshBranchCleanupTargetRefs, type GitBranchCleanupExec } from './git-branch-cleanup' -import { GitCapabilityCache } from './git-capability-cache' -import { GIT_FETCH_SKIP_AUTO_MAINTENANCE_CONFIG_ARGS } from './git-fetch-auto-maintenance' +import { refreshBranchCleanupTargetRefs } from './git-branch-cleanup-fetch' +import { GitCapabilityCache } from '../commands/git-capability-cache' +import { GIT_FETCH_SKIP_AUTO_MAINTENANCE_CONFIG_ARGS } from '../fetch/git-fetch-auto-maintenance' function baseProofResponses( responses: Partial> = {} diff --git a/src/shared/git-branch-cleanup.ts b/src/shared/git/branches/git-branch-cleanup.ts similarity index 98% rename from src/shared/git-branch-cleanup.ts rename to src/shared/git/branches/git-branch-cleanup.ts index e441cf5716a..396fcd9b384 100644 --- a/src/shared/git-branch-cleanup.ts +++ b/src/shared/git/branches/git-branch-cleanup.ts @@ -1,7 +1,6 @@ -import type { GitCapabilityCache } from './git-capability-cache' +import type { GitCapabilityCache } from '../commands/git-capability-cache' import { isUnsupportedMergeTreeWriteTreeError } from './git-merge-tree-capability' import { refreshBranchCleanupTargetRefs } from './git-branch-cleanup-fetch' -export { refreshBranchCleanupTargetRefs } from './git-branch-cleanup-fetch' export type GitBranchCleanupExecOptions = { stdin?: string diff --git a/src/shared/git-branch-compare-head.test.ts b/src/shared/git/branches/git-branch-compare-head.test.ts similarity index 100% rename from src/shared/git-branch-compare-head.test.ts rename to src/shared/git/branches/git-branch-compare-head.test.ts diff --git a/src/shared/git-branch-compare-head.ts b/src/shared/git/branches/git-branch-compare-head.ts similarity index 100% rename from src/shared/git-branch-compare-head.ts rename to src/shared/git/branches/git-branch-compare-head.ts diff --git a/src/shared/git-branch-delete-refusal.ts b/src/shared/git/branches/git-branch-delete-refusal.ts similarity index 83% rename from src/shared/git-branch-delete-refusal.ts rename to src/shared/git/branches/git-branch-delete-refusal.ts index aab5eda6de2..81238ef62f9 100644 --- a/src/shared/git-branch-delete-refusal.ts +++ b/src/shared/git/branches/git-branch-delete-refusal.ts @@ -1,4 +1,4 @@ -import { readGitCommandFailureText } from './git-command-failure-text' +import { readGitCommandFailureText } from '../commands/git-command-failure-text' /** Git through 2.40 says checked out at; 2.43+ says used by worktree at. Both arrive on stderr. * A match permits pruning stale worktree metadata and retrying deletion once. */ diff --git a/src/shared/git-merge-tree-capability.test.ts b/src/shared/git/branches/git-merge-tree-capability.test.ts similarity index 100% rename from src/shared/git-merge-tree-capability.test.ts rename to src/shared/git/branches/git-merge-tree-capability.test.ts diff --git a/src/shared/git-merge-tree-capability.ts b/src/shared/git/branches/git-merge-tree-capability.ts similarity index 100% rename from src/shared/git-merge-tree-capability.ts rename to src/shared/git/branches/git-merge-tree-capability.ts diff --git a/src/shared/preserved-branch-cleanup.ts b/src/shared/git/branches/preserved-branch-cleanup.ts similarity index 91% rename from src/shared/preserved-branch-cleanup.ts rename to src/shared/git/branches/preserved-branch-cleanup.ts index 6199ce52d5e..c12b8002732 100644 --- a/src/shared/preserved-branch-cleanup.ts +++ b/src/shared/git/branches/preserved-branch-cleanup.ts @@ -1,4 +1,4 @@ -import type { ExecutionHostId } from './execution-host' +import type { ExecutionHostId } from '../../execution-host' export type PreservedBranchCleanup = { worktreeId: string diff --git a/src/shared/git-capability-cache.test.ts b/src/shared/git/commands/git-capability-cache.test.ts similarity index 100% rename from src/shared/git-capability-cache.test.ts rename to src/shared/git/commands/git-capability-cache.test.ts diff --git a/src/shared/git-capability-cache.ts b/src/shared/git/commands/git-capability-cache.ts similarity index 88% rename from src/shared/git-capability-cache.ts rename to src/shared/git/commands/git-capability-cache.ts index 8107017070e..38c397fdb99 100644 --- a/src/shared/git-capability-cache.ts +++ b/src/shared/git/commands/git-capability-cache.ts @@ -1,4 +1,4 @@ -import { CapabilityProbeCache } from './capability-probe-cache' +import { CapabilityProbeCache } from '../../capability-probe-cache' // Suppress hot-loop failures while detecting in-place Git upgrades during long sessions. export const GIT_CAPABILITY_RETRY_INTERVAL_MS = 30 * 60_000 diff --git a/src/shared/git-command-classification.ts b/src/shared/git/commands/git-command-classification.ts similarity index 100% rename from src/shared/git-command-classification.ts rename to src/shared/git/commands/git-command-classification.ts diff --git a/src/shared/git-command-failure-text.ts b/src/shared/git/commands/git-command-failure-text.ts similarity index 100% rename from src/shared/git-command-failure-text.ts rename to src/shared/git/commands/git-command-failure-text.ts diff --git a/src/shared/git-command-timeout.ts b/src/shared/git/commands/git-command-timeout.ts similarity index 100% rename from src/shared/git-command-timeout.ts rename to src/shared/git/commands/git-command-timeout.ts diff --git a/src/shared/git-config-snapshot-runner.test.ts b/src/shared/git/commands/git-config-snapshot-runner.test.ts similarity index 100% rename from src/shared/git-config-snapshot-runner.test.ts rename to src/shared/git/commands/git-config-snapshot-runner.test.ts diff --git a/src/shared/git-config-snapshot-runner.ts b/src/shared/git/commands/git-config-snapshot-runner.ts similarity index 97% rename from src/shared/git-config-snapshot-runner.ts rename to src/shared/git/commands/git-config-snapshot-runner.ts index 109c8e030bc..5b6a644e4b5 100644 --- a/src/shared/git-config-snapshot-runner.ts +++ b/src/shared/git/commands/git-config-snapshot-runner.ts @@ -95,4 +95,4 @@ export function createGitConfigSnapshotRunner(runGit: GitCommandRunner): GitComm return { stdout: values.at(-1) ?? '' } } } -import { iterateNulDelimitedFields } from './nul-delimited-fields' +import { iterateNulDelimitedFields } from '../../nul-delimited-fields' diff --git a/src/shared/git-credential-prompt-env.ts b/src/shared/git/commands/git-credential-prompt-env.ts similarity index 98% rename from src/shared/git-credential-prompt-env.ts rename to src/shared/git/commands/git-credential-prompt-env.ts index b63b2b32e5a..7d8c38d906e 100644 --- a/src/shared/git-credential-prompt-env.ts +++ b/src/shared/git/commands/git-credential-prompt-env.ts @@ -1,4 +1,4 @@ -import { addWslEnvKeys } from './wsl-env' +import { addWslEnvKeys } from '../../wsl-env' const GIT_CONFIG_WSLENV_KEY_RE = /^GIT_CONFIG_(?:COUNT|KEY_\d+|VALUE_\d+)$/ const GIT_CONFIG_INDEXED_KEY_RE = /^GIT_CONFIG_(?:KEY|VALUE)_(\d+)$/ diff --git a/src/shared/git-lock-contention.test.ts b/src/shared/git/commands/git-lock-contention.test.ts similarity index 100% rename from src/shared/git-lock-contention.test.ts rename to src/shared/git/commands/git-lock-contention.test.ts diff --git a/src/shared/git-lock-contention.ts b/src/shared/git/commands/git-lock-contention.ts similarity index 100% rename from src/shared/git-lock-contention.ts rename to src/shared/git/commands/git-lock-contention.ts diff --git a/src/shared/git-mutation-in-flight.ts b/src/shared/git/commands/git-mutation-in-flight.ts similarity index 100% rename from src/shared/git-mutation-in-flight.ts rename to src/shared/git/commands/git-mutation-in-flight.ts diff --git a/src/shared/git-operation-lock.ts b/src/shared/git/commands/git-operation-lock.ts similarity index 100% rename from src/shared/git-operation-lock.ts rename to src/shared/git/commands/git-operation-lock.ts diff --git a/src/shared/git-output-locale.ts b/src/shared/git/commands/git-output-locale.ts similarity index 100% rename from src/shared/git-output-locale.ts rename to src/shared/git/commands/git-output-locale.ts diff --git a/src/shared/git-progress-records.test.ts b/src/shared/git/commands/git-progress-records.test.ts similarity index 100% rename from src/shared/git-progress-records.test.ts rename to src/shared/git/commands/git-progress-records.test.ts diff --git a/src/shared/git-progress-records.ts b/src/shared/git/commands/git-progress-records.ts similarity index 100% rename from src/shared/git-progress-records.ts rename to src/shared/git/commands/git-progress-records.ts diff --git a/src/shared/git-ssh-policy-env.test.ts b/src/shared/git/commands/git-ssh-policy-env.test.ts similarity index 99% rename from src/shared/git-ssh-policy-env.test.ts rename to src/shared/git/commands/git-ssh-policy-env.test.ts index ad743360d35..f5d8fafc7fa 100644 --- a/src/shared/git-ssh-policy-env.test.ts +++ b/src/shared/git/commands/git-ssh-policy-env.test.ts @@ -2,7 +2,7 @@ import { chmod, mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import path from 'node:path' import { runProcess } from '@orca/process-host' -import { quotePosixShell } from './shell-argument-quoting' +import { quotePosixShell } from '../../shell-argument-quoting' import { describe, expect, it } from 'vitest' import { buildGitSshPolicyEnv, parseGitSshConfig } from './git-ssh-policy-env' diff --git a/src/shared/git-ssh-policy-env.ts b/src/shared/git/commands/git-ssh-policy-env.ts similarity index 97% rename from src/shared/git-ssh-policy-env.ts rename to src/shared/git/commands/git-ssh-policy-env.ts index 6395e11fadc..f68d77ad969 100644 --- a/src/shared/git-ssh-policy-env.ts +++ b/src/shared/git/commands/git-ssh-policy-env.ts @@ -1,5 +1,5 @@ -import { isWindowsAbsolutePathLike } from './cross-platform-path' -import { quotePosixShell } from './shell-argument-quoting' +import { isWindowsAbsolutePathLike } from '../../cross-platform-path' +import { quotePosixShell } from '../../shell-argument-quoting' export type GitSshPolicyMode = | 'default' diff --git a/src/shared/git-binary-compatibility.test.ts b/src/shared/git/compatibility/git-binary-compatibility.test.ts similarity index 96% rename from src/shared/git-binary-compatibility.test.ts rename to src/shared/git/compatibility/git-binary-compatibility.test.ts index fefbf7385cf..a1f9b76509f 100644 --- a/src/shared/git-binary-compatibility.test.ts +++ b/src/shared/git/compatibility/git-binary-compatibility.test.ts @@ -11,41 +11,41 @@ import { import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' -import * as gitRunner from '../main/git/command-runner/git-exec-file' -import { getRemoteFileUrl } from '../main/git/repo' +import * as gitRunner from '../../../main/git/command-runner/git-exec-file' +import { getRemoteFileUrl } from '../../../main/git/repo' import { isUnsupportedMergeTreeMergeBaseError, isUnsupportedMergeTreeWriteTreeError -} from './git-merge-tree-capability' +} from '../branches/git-merge-tree-capability' import { branchHasNoUnmergedChangesOnAnyTarget, - refreshBranchCleanupTargetRefs, type GitBranchCleanupExec -} from './git-branch-cleanup' -import { GitCapabilityCache } from './git-capability-cache' +} from '../branches/git-branch-cleanup' +import { refreshBranchCleanupTargetRefs } from '../branches/git-branch-cleanup-fetch' +import { GitCapabilityCache } from '../commands/git-capability-cache' import { createGitObjectQuarantine, GIT_OBJECT_QUARANTINE_DIR_PREFIX -} from './git-object-quarantine' -import { isForEachRefExcludeUnsupportedError } from './git-ref-command-capabilities' -import { isNoWriteFetchHeadUnsupportedError } from './git-fetch-head-capability' -import { gitCredentialPromptGuardEnv } from './git-credential-prompt-env' -import { buildGitGrepArgs } from './text-search' -import { parseGitRemoteFetchUrls } from './git-remote-url-index' -import { GIT_HISTORY_COMMIT_FORMAT, parseGitHistoryLog } from './git-history-log-parser' +} from '../objects/git-object-quarantine' +import { isForEachRefExcludeUnsupportedError } from '../refs/git-ref-command-capabilities' +import { isNoWriteFetchHeadUnsupportedError } from '../fetch/git-fetch-head-capability' +import { gitCredentialPromptGuardEnv } from '../commands/git-credential-prompt-env' +import { buildGitGrepArgs } from '../../text-search' +import { parseGitRemoteFetchUrls } from '../remotes/git-remote-url-index' +import { GIT_HISTORY_COMMIT_FORMAT, parseGitHistoryLog } from '../history/git-history-log-parser' import { githubPullRequestHeadLocalRef, gitlabMergeRequestHeadLocalRef, reviewHeadRemoteRefComponent -} from './review-head-tracking-ref' -import { gitChangeListArgs, parseGitChangeList } from './git-change-list' -import { encodeGitPathspecs } from './git-pathspec-stdin' +} from '../../review-head-tracking-ref' +import { gitChangeListArgs, parseGitChangeList } from '../diff/git-change-list' +import { encodeGitPathspecs } from '../paths/git-pathspec-stdin' import { GitBinaryTestFixture } from './git-binary.test-fixture' import { registerGitRepositoryRegistrationBinaryCompatibilityCase } from './git-repository-registration-binary-compatibility.test-cases' import { registerGitLocalBaseBranchBinaryCompatibilityCase } from './git-local-base-branch-binary-compatibility.test-cases' import { registerGitResolutionBinaryCompatibilityCases } from './git-resolution-binary-compatibility.test-cases' -import { registerGitWorktreeBinaryCompatibilityCases } from './git-worktree-binary-compatibility.test-cases' -import { registerPluginGitDownloadBinaryCompatibilityCase } from './plugin-git-download-binary-compatibility.test-cases' +import { registerGitWorktreeBinaryCompatibilityCases } from '../worktrees/git-worktree-binary-compatibility.test-cases' +import { registerPluginGitDownloadBinaryCompatibilityCase } from '../../plugin-git-download-binary-compatibility.test-cases' const image = process.env.ORCA_GIT_COMPAT_IMAGE const binary = process.env.ORCA_GIT_COMPAT_BINARY diff --git a/src/shared/git-binary.test-fixture.ts b/src/shared/git/compatibility/git-binary.test-fixture.ts similarity index 100% rename from src/shared/git-binary.test-fixture.ts rename to src/shared/git/compatibility/git-binary.test-fixture.ts diff --git a/src/shared/git-local-base-branch-binary-compatibility.test-cases.ts b/src/shared/git/compatibility/git-local-base-branch-binary-compatibility.test-cases.ts similarity index 95% rename from src/shared/git-local-base-branch-binary-compatibility.test-cases.ts rename to src/shared/git/compatibility/git-local-base-branch-binary-compatibility.test-cases.ts index 9d626f6ba47..f951d3fdcbf 100644 --- a/src/shared/git-local-base-branch-binary-compatibility.test-cases.ts +++ b/src/shared/git/compatibility/git-local-base-branch-binary-compatibility.test-cases.ts @@ -1,8 +1,8 @@ import { mkdir, readFile, rm, writeFile } from 'node:fs/promises' import { dirname, join } from 'node:path' import { expect, it } from 'vitest' -import { parseWorktreeList } from './git-worktree-porcelain-parser' -import { fastForwardLocalBaseBranch } from './worktree/local-base-branch-fast-forward' +import { parseWorktreeList } from '../worktrees/git-worktree-porcelain-parser' +import { fastForwardLocalBaseBranch } from '../../worktree/local-base-branch-fast-forward' export function registerGitLocalBaseBranchBinaryCompatibilityCase( runGit: (args: string[]) => Promise<{ stdout: string; stderr: string }>, diff --git a/src/shared/git-repository-registration-binary-compatibility.test-cases.ts b/src/shared/git/compatibility/git-repository-registration-binary-compatibility.test-cases.ts similarity index 100% rename from src/shared/git-repository-registration-binary-compatibility.test-cases.ts rename to src/shared/git/compatibility/git-repository-registration-binary-compatibility.test-cases.ts diff --git a/src/shared/git-resolution-binary-compatibility.test-cases.ts b/src/shared/git/compatibility/git-resolution-binary-compatibility.test-cases.ts similarity index 95% rename from src/shared/git-resolution-binary-compatibility.test-cases.ts rename to src/shared/git/compatibility/git-resolution-binary-compatibility.test-cases.ts index b6c56e6b813..c66bcf61ca7 100644 --- a/src/shared/git-resolution-binary-compatibility.test-cases.ts +++ b/src/shared/git/compatibility/git-resolution-binary-compatibility.test-cases.ts @@ -1,10 +1,14 @@ import { expect, it } from 'vitest' -import { resolveConfiguredGitPushTarget } from './git-push-target-resolution' +import { resolveConfiguredGitPushTarget } from '../remotes/git-push-target-resolution' import { resolveDefaultBaseRefViaExec, resolveRemoteHeadBranchViaExec -} from './git-default-base-ref' -import { buildGitSshPolicyEnv, GIT_SSH_CONFIG_ARGS, parseGitSshConfig } from './git-ssh-policy-env' +} from '../refs/git-default-base-ref' +import { + buildGitSshPolicyEnv, + GIT_SSH_CONFIG_ARGS, + parseGitSshConfig +} from '../commands/git-ssh-policy-env' export function registerGitResolutionBinaryCompatibilityCases( runGit: (args: string[]) => Promise<{ stdout: string; stderr: string }>, diff --git a/src/shared/git-resolution-config-snapshot.test.ts b/src/shared/git/compatibility/git-resolution-config-snapshot.test.ts similarity index 94% rename from src/shared/git-resolution-config-snapshot.test.ts rename to src/shared/git/compatibility/git-resolution-config-snapshot.test.ts index 65e85842361..e9d94896133 100644 --- a/src/shared/git-resolution-config-snapshot.test.ts +++ b/src/shared/git/compatibility/git-resolution-config-snapshot.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' -import { getEffectiveGitUpstreamStatus } from './git-effective-upstream' -import { resolveConfiguredGitPushTarget } from './git-push-target-resolution' +import { getEffectiveGitUpstreamStatus } from '../remotes/git-effective-upstream' +import { resolveConfiguredGitPushTarget } from '../remotes/git-push-target-resolution' function createRunner(config = new Map(), snapshotFails = false) { return vi.fn(async (args: string[]) => { diff --git a/src/shared/git-blob-absence.test.ts b/src/shared/git/diff/git-blob-absence.test.ts similarity index 100% rename from src/shared/git-blob-absence.test.ts rename to src/shared/git/diff/git-blob-absence.test.ts diff --git a/src/shared/git-blob-absence.ts b/src/shared/git/diff/git-blob-absence.ts similarity index 88% rename from src/shared/git-blob-absence.ts rename to src/shared/git/diff/git-blob-absence.ts index e6c13b76d18..b59c47f8a02 100644 --- a/src/shared/git-blob-absence.ts +++ b/src/shared/git/diff/git-blob-absence.ts @@ -1,4 +1,7 @@ -import { readGitCommandFailureStderr, readGitCommandFailureText } from './git-command-failure-text' +import { + readGitCommandFailureStderr, + readGitCommandFailureText +} from '../commands/git-command-failure-text' /** A missing path diagnostic proves absence; exit 128 alone also covers corrupt objects. */ export function isMissingGitBlobPath(error: unknown, filePath: string, oid?: string): boolean { diff --git a/src/shared/git-change-list.test.ts b/src/shared/git/diff/git-change-list.test.ts similarity index 100% rename from src/shared/git-change-list.test.ts rename to src/shared/git/diff/git-change-list.test.ts diff --git a/src/shared/git-change-list.ts b/src/shared/git/diff/git-change-list.ts similarity index 93% rename from src/shared/git-change-list.ts rename to src/shared/git/diff/git-change-list.ts index 5e6cb0be4e1..a91c0b04bd9 100644 --- a/src/shared/git-change-list.ts +++ b/src/shared/git/diff/git-change-list.ts @@ -1,6 +1,6 @@ import type { GitBranchChangeEntry } from './git-diff-compare-types' -import type { GitBranchChangeStatus } from './git-status-types' -import { parseNumstat } from './git-uncommitted-line-stats' +import type { GitBranchChangeStatus } from '../status/git-status-types' +import { parseNumstat } from '../status/git-uncommitted-line-stats' const CHANGE_STATUS: Record = { A: 'added', diff --git a/src/shared/git-diff-compare-types.ts b/src/shared/git/diff/git-diff-compare-types.ts similarity index 93% rename from src/shared/git-diff-compare-types.ts rename to src/shared/git/diff/git-diff-compare-types.ts index 91bcb67e5e1..2495c56c552 100644 --- a/src/shared/git-diff-compare-types.ts +++ b/src/shared/git/diff/git-diff-compare-types.ts @@ -1,5 +1,5 @@ -import type { GitBranchChangeStatus } from './git-status-types' -import type { LargeDiffRenderLimit } from './large-diff-render-limit' +import type { GitBranchChangeStatus } from '../status/git-status-types' +import type { LargeDiffRenderLimit } from '../../large-diff-render-limit' // Mobile consumes git-status-types.ts directly to avoid this desktop aggregate. diff --git a/src/shared/git-diff-transport-budget.test.ts b/src/shared/git/diff/git-diff-transport-budget.test.ts similarity index 96% rename from src/shared/git-diff-transport-budget.test.ts rename to src/shared/git/diff/git-diff-transport-budget.test.ts index c142d84139a..4fe13a1ea12 100644 --- a/src/shared/git-diff-transport-budget.test.ts +++ b/src/shared/git/diff/git-diff-transport-budget.test.ts @@ -1,12 +1,15 @@ // JSON escaping can expand controls sixfold while NUL-only sniffing treats them as text; pin each budget branch to JSON.stringify. import { describe, expect, it } from 'vitest' import type { GitDiffResult } from './git-diff-compare-types' -import { REMOTE_RUNTIME_MAX_OUTBOUND_JSON_BYTES } from './remote-runtime/remote-runtime-memory-limits' +import { REMOTE_RUNTIME_MAX_OUTBOUND_JSON_BYTES } from '../../remote-runtime/remote-runtime-memory-limits' import { assertGitDiffWithinTransportBudget, gitDiffExceedsTransportBudget } from './git-diff-transport-budget' -import { REMOTE_RPC_MAX_CONTENT_BYTES, remoteRpcContentBudget } from './remote-rpc-content-budget' +import { + REMOTE_RPC_MAX_CONTENT_BYTES, + remoteRpcContentBudget +} from '../../remote-rpc-content-budget' const BUDGET = REMOTE_RPC_MAX_CONTENT_BYTES diff --git a/src/shared/git-diff-transport-budget.ts b/src/shared/git/diff/git-diff-transport-budget.ts similarity index 91% rename from src/shared/git-diff-transport-budget.ts rename to src/shared/git/diff/git-diff-transport-budget.ts index ac46333c3d4..44a799e8fbe 100644 --- a/src/shared/git-diff-transport-budget.ts +++ b/src/shared/git/diff/git-diff-transport-budget.ts @@ -1,5 +1,5 @@ import type { GitDiffResult } from './git-diff-compare-types' -import { remoteRpcResultExceedsContentBudget } from './remote-rpc-content-budget' +import { remoteRpcResultExceedsContentBudget } from '../../remote-rpc-content-budget' export const GIT_DIFF_TOO_LARGE_CODE = 'diff_too_large' const GIT_DIFF_CONTENT_FIELDS = ['originalContent', 'modifiedContent'] as const diff --git a/src/shared/git-fetch-auto-maintenance.ts b/src/shared/git/fetch/git-fetch-auto-maintenance.ts similarity index 100% rename from src/shared/git-fetch-auto-maintenance.ts rename to src/shared/git/fetch/git-fetch-auto-maintenance.ts diff --git a/src/shared/git-fetch-head-capability.test.ts b/src/shared/git/fetch/git-fetch-head-capability.test.ts similarity index 100% rename from src/shared/git-fetch-head-capability.test.ts rename to src/shared/git/fetch/git-fetch-head-capability.test.ts diff --git a/src/shared/git-fetch-head-capability.ts b/src/shared/git/fetch/git-fetch-head-capability.ts similarity index 100% rename from src/shared/git-fetch-head-capability.ts rename to src/shared/git/fetch/git-fetch-head-capability.ts diff --git a/src/shared/git-fetch-head-lock-key-derivation.test.ts b/src/shared/git/fetch/git-fetch-head-lock-key-derivation.test.ts similarity index 99% rename from src/shared/git-fetch-head-lock-key-derivation.test.ts rename to src/shared/git/fetch/git-fetch-head-lock-key-derivation.test.ts index e5a8cf0dbcd..16924354683 100644 --- a/src/shared/git-fetch-head-lock-key-derivation.test.ts +++ b/src/shared/git/fetch/git-fetch-head-lock-key-derivation.test.ts @@ -13,7 +13,7 @@ vi.mock('node:fs/promises', () => ({ realpath: mocks.realpath, stat: mocks.stat })) -vi.mock('./git-operation-lock', () => ({ +vi.mock('../commands/git-operation-lock', () => ({ runWithGitOperationLock: mocks.runWithGitOperationLock })) diff --git a/src/shared/git-fetch-head-lock.test.ts b/src/shared/git/fetch/git-fetch-head-lock.test.ts similarity index 99% rename from src/shared/git-fetch-head-lock.test.ts rename to src/shared/git/fetch/git-fetch-head-lock.test.ts index 058b83a2853..769995a60d1 100644 --- a/src/shared/git-fetch-head-lock.test.ts +++ b/src/shared/git/fetch/git-fetch-head-lock.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest' import { mkdtemp, mkdir, rm, symlink, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import * as path from 'node:path' -import * as gitOperationLock from './git-operation-lock' +import * as gitOperationLock from '../commands/git-operation-lock' import { resolveGitFetchHeadCommand, runWithGitFetchHeadLock } from './git-fetch-head-lock' function observeLockEntries(expected: number) { diff --git a/src/shared/git-fetch-head-lock.ts b/src/shared/git/fetch/git-fetch-head-lock.ts similarity index 93% rename from src/shared/git-fetch-head-lock.ts rename to src/shared/git/fetch/git-fetch-head-lock.ts index 70ee4e5085e..d8db8ca8e94 100644 --- a/src/shared/git-fetch-head-lock.ts +++ b/src/shared/git/fetch/git-fetch-head-lock.ts @@ -1,14 +1,17 @@ import * as path from 'node:path' import { readFile, realpath, stat } from 'node:fs/promises' -import { waitForPromiseWithSignal } from './abort-signal-reason' -import { parseGitdirMarkerPayload } from './gitdir-marker-payload' -import { runWithGitOperationLock } from './git-operation-lock' -import { findGitSubcommandIndex, GIT_GLOBAL_OPTIONS_WITH_VALUE } from './git-command-classification' +import { waitForPromiseWithSignal } from '../../abort-signal-reason' +import { parseGitdirMarkerPayload } from '../metadata/gitdir-marker-payload' +import { runWithGitOperationLock } from '../commands/git-operation-lock' +import { + findGitSubcommandIndex, + GIT_GLOBAL_OPTIONS_WITH_VALUE +} from '../commands/git-command-classification' import { foldWslUncPathCaseInsensitiveParts, isWslUncPath, toWindowsWslDrivePath -} from './wsl-paths' +} from '../../wsl-paths' function abortError(): Error { const error = new Error('The operation was aborted.') diff --git a/src/shared/git-history-boundary-rows.ts b/src/shared/git/history/git-history-boundary-rows.ts similarity index 98% rename from src/shared/git-history-boundary-rows.ts rename to src/shared/git/history/git-history-boundary-rows.ts index fb49b487bf7..6e5720fa991 100644 --- a/src/shared/git-history-boundary-rows.ts +++ b/src/shared/git/history/git-history-boundary-rows.ts @@ -1,5 +1,5 @@ -import type { GitHistoryGraphColorId, GitHistoryItem, GitHistoryItemRef } from './git-history' -import { GIT_HISTORY_REF_COLOR, GIT_HISTORY_REMOTE_REF_COLOR } from './git-history' +import type { GitHistoryGraphColorId, GitHistoryItem, GitHistoryItemRef } from './git-history-types' +import { GIT_HISTORY_REF_COLOR, GIT_HISTORY_REMOTE_REF_COLOR } from './git-history-types' import type { GitHistoryGraphNode, GitHistoryItemViewModel } from './git-history-graph' export const GIT_HISTORY_INCOMING_CHANGES_ID = 'git-history-incoming-changes' diff --git a/src/shared/git-history-branch-range.ts b/src/shared/git/history/git-history-branch-range.ts similarity index 98% rename from src/shared/git-history-branch-range.ts rename to src/shared/git/history/git-history-branch-range.ts index ec7cb4beb13..9e7f8df9797 100644 --- a/src/shared/git-history-branch-range.ts +++ b/src/shared/git/history/git-history-branch-range.ts @@ -1,7 +1,7 @@ import { resolveEffectiveGitUpstream, splitRemoteBranchNameByKnownRemote -} from './git-effective-upstream' +} from '../remotes/git-effective-upstream' import type { GitHistoryBranchRange, GitHistoryExecutor, diff --git a/src/shared/git-history.ts b/src/shared/git/history/git-history-execution.ts similarity index 91% rename from src/shared/git-history.ts rename to src/shared/git/history/git-history-execution.ts index 11a9aec043c..49c962720e9 100644 --- a/src/shared/git-history.ts +++ b/src/shared/git/history/git-history-execution.ts @@ -12,30 +12,9 @@ import { type GitHistoryOptions, type GitHistoryResult } from './git-history-types' -import { getGitCurrentBranchName } from './git-current-branch' +import { getGitCurrentBranchName } from '../refs/git-current-branch' import { isBaseOfItself, resolveBranchRange } from './git-history-branch-range' -export type { - GitHistoryBranchRange, - GitHistoryExecutor, - GitHistoryGraphColorId, - GitHistoryItem, - GitHistoryItemRef, - GitHistoryItemStatistics, - GitHistoryOptions, - GitHistoryRefCategory, - GitHistoryResult -} from './git-history-types' -export { - GIT_HISTORY_BASE_REF_COLOR, - GIT_HISTORY_DEFAULT_LIMIT, - GIT_HISTORY_LANE_COLORS, - GIT_HISTORY_MAX_LIMIT, - GIT_HISTORY_REF_COLOR, - GIT_HISTORY_REMOTE_REF_COLOR -} from './git-history-types' -export { compareGitHistoryItemRefsByCategory, parseGitHistoryLog } from './git-history-log-parser' - function clampHistoryLimit(limit: number | undefined): number { if (!Number.isFinite(limit)) { return GIT_HISTORY_DEFAULT_LIMIT diff --git a/src/shared/git-history-graph.test.ts b/src/shared/git/history/git-history-graph.test.ts similarity index 98% rename from src/shared/git-history-graph.test.ts rename to src/shared/git/history/git-history-graph.test.ts index 50a4370a8b6..7e379eed410 100644 --- a/src/shared/git-history-graph.test.ts +++ b/src/shared/git/history/git-history-graph.test.ts @@ -1,14 +1,16 @@ import { describe, expect, it } from 'vitest' -import type { GitHistoryItem, GitHistoryItemRef } from './git-history' +import type { GitHistoryItem, GitHistoryItemRef } from './git-history-types' import { GIT_HISTORY_BASE_REF_COLOR, GIT_HISTORY_LANE_COLORS, GIT_HISTORY_REF_COLOR, GIT_HISTORY_REMOTE_REF_COLOR -} from './git-history' +} from './git-history-types' import { GIT_HISTORY_INCOMING_CHANGES_ID, - GIT_HISTORY_OUTGOING_CHANGES_ID, + GIT_HISTORY_OUTGOING_CHANGES_ID +} from './git-history-boundary-rows' +import { buildDefaultGitHistoryColorMap, buildGitHistoryViewModels, getGitHistoryMergeParentLaneIndex diff --git a/src/shared/git-history-graph.ts b/src/shared/git/history/git-history-graph.ts similarity index 98% rename from src/shared/git-history-graph.ts rename to src/shared/git/history/git-history-graph.ts index 89c230b5fe6..6f520cb9ce3 100644 --- a/src/shared/git-history-graph.ts +++ b/src/shared/git/history/git-history-graph.ts @@ -1,4 +1,4 @@ -import type { GitHistoryGraphColorId, GitHistoryItem, GitHistoryItemRef } from './git-history' +import type { GitHistoryGraphColorId, GitHistoryItem, GitHistoryItemRef } from './git-history-types' import { GIT_HISTORY_INCOMING_CHANGES_ID, GIT_HISTORY_OUTGOING_CHANGES_ID, @@ -9,9 +9,7 @@ import { GIT_HISTORY_LANE_COLORS, GIT_HISTORY_REF_COLOR, GIT_HISTORY_REMOTE_REF_COLOR -} from './git-history' - -export { GIT_HISTORY_INCOMING_CHANGES_ID, GIT_HISTORY_OUTGOING_CHANGES_ID } +} from './git-history-types' export type GitHistoryGraphNode = { id: string diff --git a/src/shared/git-history-log-parser.ts b/src/shared/git/history/git-history-log-parser.ts similarity index 98% rename from src/shared/git-history-log-parser.ts rename to src/shared/git/history/git-history-log-parser.ts index ab670593cc8..2ce5e3d733f 100644 --- a/src/shared/git-history-log-parser.ts +++ b/src/shared/git/history/git-history-log-parser.ts @@ -1,5 +1,5 @@ import type { GitHistoryItem, GitHistoryItemRef } from './git-history-types' -import { iterateNulDelimitedFields } from './nul-delimited-fields' +import { iterateNulDelimitedFields } from '../../nul-delimited-fields' const GIT_HISTORY_DECORATION_SEPARATOR = '\x1f' const GIT_HISTORY_LEGACY_DECORATION_SEPARATOR = ', ' diff --git a/src/shared/git-history-message-allocation.test.ts b/src/shared/git/history/git-history-message-allocation.test.ts similarity index 100% rename from src/shared/git-history-message-allocation.test.ts rename to src/shared/git/history/git-history-message-allocation.test.ts diff --git a/src/shared/git-history-real-repository.test.ts b/src/shared/git/history/git-history-real-repository.test.ts similarity index 98% rename from src/shared/git-history-real-repository.test.ts rename to src/shared/git/history/git-history-real-repository.test.ts index 9d4771972b4..2bdfb2a22ea 100644 --- a/src/shared/git-history-real-repository.test.ts +++ b/src/shared/git/history/git-history-real-repository.test.ts @@ -3,8 +3,8 @@ import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { join } from 'node:path' import { runProcess } from '@orca/process-host' -import { resolveExecutableCommand } from './node-cli-command-resolution' -import { loadGitHistoryFromExecutor } from './git-history' +import { resolveExecutableCommand } from '../../node-cli-command-resolution' +import { loadGitHistoryFromExecutor } from './git-history-execution' import { buildDefaultGitHistoryColorMap, buildGitHistoryViewModels } from './git-history-graph' const repositories: string[] = [] diff --git a/src/shared/git-history-ref-display.test.ts b/src/shared/git/history/git-history-ref-display.test.ts similarity index 100% rename from src/shared/git-history-ref-display.test.ts rename to src/shared/git/history/git-history-ref-display.test.ts diff --git a/src/shared/git-history-ref-display.ts b/src/shared/git/history/git-history-ref-display.ts similarity index 96% rename from src/shared/git-history-ref-display.ts rename to src/shared/git/history/git-history-ref-display.ts index cc53cfdcd68..0e58184bc40 100644 --- a/src/shared/git-history-ref-display.ts +++ b/src/shared/git/history/git-history-ref-display.ts @@ -1,4 +1,4 @@ -import { splitRemoteBranchName } from './git-effective-upstream' +import { splitRemoteBranchName } from '../remotes/git-remote-branch-name' import type { GitHistoryItemRef } from './git-history-types' type DedupeRemoteTrackingRefsOptions = { diff --git a/src/shared/git-history-types.ts b/src/shared/git/history/git-history-types.ts similarity index 100% rename from src/shared/git-history-types.ts rename to src/shared/git/history/git-history-types.ts diff --git a/src/shared/git-history.test.ts b/src/shared/git/history/git-history.test.ts similarity index 97% rename from src/shared/git-history.test.ts rename to src/shared/git/history/git-history.test.ts index bae9eae4046..0241470acda 100644 --- a/src/shared/git-history.test.ts +++ b/src/shared/git/history/git-history.test.ts @@ -1,11 +1,8 @@ import { describe, expect, it, vi } from 'vitest' -import type { GitHistoryExecutor } from './git-history' -import { - GIT_HISTORY_MAX_LIMIT, - loadGitHistoryFromExecutor, - parseGitHistoryLog -} from './git-history' -import { GIT_HISTORY_COMMIT_FORMAT } from './git-history-log-parser' +import type { GitHistoryExecutor } from './git-history-types' +import { GIT_HISTORY_MAX_LIMIT } from './git-history-types' +import { loadGitHistoryFromExecutor } from './git-history-execution' +import { parseGitHistoryLog, GIT_HISTORY_COMMIT_FORMAT } from './git-history-log-parser' const HEAD_OID = 'a'.repeat(40) const REMOTE_OID = 'b'.repeat(40) diff --git a/src/shared/git-common-directory.ts b/src/shared/git/metadata/git-common-directory.ts similarity index 97% rename from src/shared/git-common-directory.ts rename to src/shared/git/metadata/git-common-directory.ts index 6750368ba18..09d23998b70 100644 --- a/src/shared/git-common-directory.ts +++ b/src/shared/git/metadata/git-common-directory.ts @@ -1,6 +1,6 @@ import { readFile, stat } from 'node:fs/promises' import path from 'node:path' -import { waitForPromiseWithSignal } from './abort-signal-reason' +import { waitForPromiseWithSignal } from '../../abort-signal-reason' import { resolveGitMetadataPath, type GitMetadataPathOptions } from './git-metadata-path' import { parseGitdirMarkerPayload } from './gitdir-marker-payload' diff --git a/src/shared/git-metadata-path.test.ts b/src/shared/git/metadata/git-metadata-path.test.ts similarity index 100% rename from src/shared/git-metadata-path.test.ts rename to src/shared/git/metadata/git-metadata-path.test.ts diff --git a/src/shared/git-metadata-path.ts b/src/shared/git/metadata/git-metadata-path.ts similarity index 98% rename from src/shared/git-metadata-path.ts rename to src/shared/git/metadata/git-metadata-path.ts index 3b24c9411dc..ad266579201 100644 --- a/src/shared/git-metadata-path.ts +++ b/src/shared/git/metadata/git-metadata-path.ts @@ -1,5 +1,5 @@ import { posix, win32 } from 'node:path' -import { parseWslUncPath, toWindowsWslDrivePath, toWindowsWslPath } from './wsl-paths' +import { parseWslUncPath, toWindowsWslDrivePath, toWindowsWslPath } from '../../wsl-paths' // Only /x is guest-rooted; //x is already host UNC syntax. Match resolveWslRepoWorktreeBasePath to avoid double shares. const GUEST_ROOTED_PATH = /^\/(?!\/)/ diff --git a/src/shared/gitdir-marker-payload.ts b/src/shared/git/metadata/gitdir-marker-payload.ts similarity index 100% rename from src/shared/gitdir-marker-payload.ts rename to src/shared/git/metadata/gitdir-marker-payload.ts diff --git a/src/shared/git-object-quarantine-real-git.test-fixture.ts b/src/shared/git/objects/git-object-quarantine-real-git.test-fixture.ts similarity index 100% rename from src/shared/git-object-quarantine-real-git.test-fixture.ts rename to src/shared/git/objects/git-object-quarantine-real-git.test-fixture.ts diff --git a/src/shared/git-object-quarantine.test.ts b/src/shared/git/objects/git-object-quarantine.test.ts similarity index 100% rename from src/shared/git-object-quarantine.test.ts rename to src/shared/git/objects/git-object-quarantine.test.ts diff --git a/src/shared/git-object-quarantine.ts b/src/shared/git/objects/git-object-quarantine.ts similarity index 96% rename from src/shared/git-object-quarantine.ts rename to src/shared/git/objects/git-object-quarantine.ts index a4129a5dbe6..1ea1c3ae859 100644 --- a/src/shared/git-object-quarantine.ts +++ b/src/shared/git/objects/git-object-quarantine.ts @@ -1,8 +1,8 @@ import { lstat, mkdtemp, readdir, rename, stat } from 'node:fs/promises' import { posix, win32 } from 'node:path' -import { isWindowsAbsolutePathLike } from './cross-platform-path' -import { isDefinitiveAbsence } from './definitive-filesystem-absence' -import { removeTree } from './windows-transient-lock-removal' +import { isWindowsAbsolutePathLike } from '../../cross-platform-path' +import { isDefinitiveAbsence } from '../../definitive-filesystem-absence' +import { removeTree } from '../../windows-transient-lock-removal' /** Run throwaway merge-tree object writes in a scratch store; alternates retain access to real objects without leaving unreachable loose objects. */ diff --git a/src/shared/git-check-ignore-stdio.test.ts b/src/shared/git/paths/git-check-ignore-stdio.test.ts similarity index 100% rename from src/shared/git-check-ignore-stdio.test.ts rename to src/shared/git/paths/git-check-ignore-stdio.test.ts diff --git a/src/shared/git-check-ignore-stdio.ts b/src/shared/git/paths/git-check-ignore-stdio.ts similarity index 94% rename from src/shared/git-check-ignore-stdio.ts rename to src/shared/git/paths/git-check-ignore-stdio.ts index 17d6ce8ebd8..f77826174b8 100644 --- a/src/shared/git-check-ignore-stdio.ts +++ b/src/shared/git/paths/git-check-ignore-stdio.ts @@ -46,4 +46,4 @@ export function parseGitCheckIgnorePaths(stdout: string): string[] { } return paths } -import { iterateNulDelimitedFields } from './nul-delimited-fields' +import { iterateNulDelimitedFields } from '../../nul-delimited-fields' diff --git a/src/shared/git-cquoted-path.test.ts b/src/shared/git/paths/git-cquoted-path.test.ts similarity index 100% rename from src/shared/git-cquoted-path.test.ts rename to src/shared/git/paths/git-cquoted-path.test.ts diff --git a/src/shared/git-cquoted-path.ts b/src/shared/git/paths/git-cquoted-path.ts similarity index 100% rename from src/shared/git-cquoted-path.ts rename to src/shared/git/paths/git-cquoted-path.ts diff --git a/src/shared/git-discard-path-safety.test.ts b/src/shared/git/paths/git-discard-path-safety.test.ts similarity index 100% rename from src/shared/git-discard-path-safety.test.ts rename to src/shared/git/paths/git-discard-path-safety.test.ts diff --git a/src/shared/git-discard-path-safety.ts b/src/shared/git/paths/git-discard-path-safety.ts similarity index 98% rename from src/shared/git-discard-path-safety.ts rename to src/shared/git/paths/git-discard-path-safety.ts index 37a3691003d..bd9df491275 100644 --- a/src/shared/git-discard-path-safety.ts +++ b/src/shared/git/paths/git-discard-path-safety.ts @@ -1,6 +1,6 @@ import { lstat, realpath } from 'node:fs/promises' import * as path from 'node:path' -import { forEachWithConcurrency } from './map-with-concurrency' +import { forEachWithConcurrency } from '../../map-with-concurrency' const DISCARD_PATH_VALIDATION_CONCURRENCY = 16 diff --git a/src/shared/git-pathspec-stdin.ts b/src/shared/git/paths/git-pathspec-stdin.ts similarity index 100% rename from src/shared/git-pathspec-stdin.ts rename to src/shared/git/paths/git-pathspec-stdin.ts diff --git a/src/shared/git-stage-worktree-scope.ts b/src/shared/git/paths/git-stage-worktree-scope.ts similarity index 100% rename from src/shared/git-stage-worktree-scope.ts rename to src/shared/git/paths/git-stage-worktree-scope.ts diff --git a/src/shared/git-tracked-pathspecs.test.ts b/src/shared/git/paths/git-tracked-pathspecs.test.ts similarity index 100% rename from src/shared/git-tracked-pathspecs.test.ts rename to src/shared/git/paths/git-tracked-pathspecs.test.ts diff --git a/src/shared/git-tracked-pathspecs.ts b/src/shared/git/paths/git-tracked-pathspecs.ts similarity index 100% rename from src/shared/git-tracked-pathspecs.ts rename to src/shared/git/paths/git-tracked-pathspecs.ts diff --git a/src/shared/git-current-branch.ts b/src/shared/git/refs/git-current-branch.ts similarity index 100% rename from src/shared/git-current-branch.ts rename to src/shared/git/refs/git-current-branch.ts diff --git a/src/shared/git-default-base-ref.ts b/src/shared/git/refs/git-default-base-ref.ts similarity index 96% rename from src/shared/git-default-base-ref.ts rename to src/shared/git/refs/git-default-base-ref.ts index e7bf9990e42..9eb79510bcb 100644 --- a/src/shared/git-default-base-ref.ts +++ b/src/shared/git/refs/git-default-base-ref.ts @@ -1,4 +1,4 @@ -import { iterateProcessOutputLines } from './process-output-field-scanner' +import { iterateProcessOutputLines } from '../../process-output-field-scanner' export const DEFAULT_BASE_REF_PROBES: readonly { ref: string; returnAs: string }[] = [ { ref: 'refs/remotes/origin/main', returnAs: 'origin/main' }, diff --git a/src/shared/git-missing-remote-ref.ts b/src/shared/git/refs/git-missing-remote-ref.ts similarity index 100% rename from src/shared/git-missing-remote-ref.ts rename to src/shared/git/refs/git-missing-remote-ref.ts diff --git a/src/shared/git-ref-command-capabilities.ts b/src/shared/git/refs/git-ref-command-capabilities.ts similarity index 100% rename from src/shared/git-ref-command-capabilities.ts rename to src/shared/git/refs/git-ref-command-capabilities.ts diff --git a/src/shared/git-rev-list-output.test.ts b/src/shared/git/refs/git-rev-list-output.test.ts similarity index 100% rename from src/shared/git-rev-list-output.test.ts rename to src/shared/git/refs/git-rev-list-output.test.ts diff --git a/src/shared/git-rev-list-output.ts b/src/shared/git/refs/git-rev-list-output.ts similarity index 95% rename from src/shared/git-rev-list-output.ts rename to src/shared/git/refs/git-rev-list-output.ts index 2a745c86b83..a8d6cbbac84 100644 --- a/src/shared/git-rev-list-output.ts +++ b/src/shared/git/refs/git-rev-list-output.ts @@ -1,4 +1,4 @@ -import { getProcessOutputFields } from './process-output-field-scanner' +import { getProcessOutputFields } from '../../process-output-field-scanner' export type GitRevListAheadBehindCounts = { ahead: number diff --git a/src/shared/git-show-ref-no-match.ts b/src/shared/git/refs/git-show-ref-no-match.ts similarity index 100% rename from src/shared/git-show-ref-no-match.ts rename to src/shared/git/refs/git-show-ref-no-match.ts diff --git a/src/shared/git-clone-failure-message.test.ts b/src/shared/git/remotes/git-clone-failure-message.test.ts similarity index 100% rename from src/shared/git-clone-failure-message.test.ts rename to src/shared/git/remotes/git-clone-failure-message.test.ts diff --git a/src/shared/git-clone-failure-message.ts b/src/shared/git/remotes/git-clone-failure-message.ts similarity index 100% rename from src/shared/git-clone-failure-message.ts rename to src/shared/git/remotes/git-clone-failure-message.ts diff --git a/src/shared/git-configured-branch-target.test.ts b/src/shared/git/remotes/git-configured-branch-target.test.ts similarity index 100% rename from src/shared/git-configured-branch-target.test.ts rename to src/shared/git/remotes/git-configured-branch-target.test.ts diff --git a/src/shared/git-configured-branch-target.ts b/src/shared/git/remotes/git-configured-branch-target.ts similarity index 100% rename from src/shared/git-configured-branch-target.ts rename to src/shared/git/remotes/git-configured-branch-target.ts diff --git a/src/shared/git-effective-upstream.ts b/src/shared/git/remotes/git-effective-upstream.ts similarity index 94% rename from src/shared/git-effective-upstream.ts rename to src/shared/git/remotes/git-effective-upstream.ts index 1b04f687474..b3dbc7b2968 100644 --- a/src/shared/git-effective-upstream.ts +++ b/src/shared/git/remotes/git-effective-upstream.ts @@ -1,16 +1,14 @@ import { isNoUpstreamError } from './git-remote-error' -import type { GitUpstreamStatus } from './git-status-types' +import type { GitUpstreamStatus } from '../status/git-status-types' import { getConfiguredBranchRemoteUpstream, hasConfiguredBranchPushTarget } from './git-configured-branch-target' import { splitRemoteBranchName } from './git-remote-branch-name' -import { parseGitRevListAheadBehindCounts } from './git-rev-list-output' -import { iterateProcessOutputLines } from './process-output-field-scanner' -import { createGitConfigSnapshotRunner } from './git-config-snapshot-runner' -import { getGitCurrentBranchName } from './git-current-branch' - -export { gitRefTargetsBranchName, splitRemoteBranchName } from './git-remote-branch-name' +import { parseGitRevListAheadBehindCounts } from '../refs/git-rev-list-output' +import { iterateProcessOutputLines } from '../../process-output-field-scanner' +import { createGitConfigSnapshotRunner } from '../commands/git-config-snapshot-runner' +import { getGitCurrentBranchName } from '../refs/git-current-branch' export type GitCommandRunner = (args: string[]) => Promise<{ stdout: string }> diff --git a/src/shared/git-fork-sync.test.ts b/src/shared/git/remotes/git-fork-sync.test.ts similarity index 100% rename from src/shared/git-fork-sync.test.ts rename to src/shared/git/remotes/git-fork-sync.test.ts diff --git a/src/shared/git-fork-sync.ts b/src/shared/git/remotes/git-fork-sync.ts similarity index 99% rename from src/shared/git-fork-sync.ts rename to src/shared/git/remotes/git-fork-sync.ts index 777be30d620..5f685dd49b6 100644 --- a/src/shared/git-fork-sync.ts +++ b/src/shared/git/remotes/git-fork-sync.ts @@ -1,4 +1,4 @@ -import { getProcessOutputFields } from './process-output-field-scanner' +import { getProcessOutputFields } from '../../process-output-field-scanner' export type ForkSyncMode = 'ask' | 'safe-auto' | 'off' diff --git a/src/shared/git-publish-target-status.ts b/src/shared/git/remotes/git-publish-target-status.ts similarity index 91% rename from src/shared/git-publish-target-status.ts rename to src/shared/git/remotes/git-publish-target-status.ts index 392a7f13291..776e191c6a7 100644 --- a/src/shared/git-publish-target-status.ts +++ b/src/shared/git/remotes/git-publish-target-status.ts @@ -1,6 +1,6 @@ -import type { GitUpstreamStatus } from './git-status-types' -import type { GitPushTarget } from './worktree/types' -import { parseGitRevListAheadBehindCounts } from './git-rev-list-output' +import type { GitUpstreamStatus } from '../status/git-status-types' +import type { GitPushTarget } from '../../worktree/types' +import { parseGitRevListAheadBehindCounts } from '../refs/git-rev-list-output' export type GitCommandRunner = (args: string[]) => Promise<{ stdout: string }> diff --git a/src/shared/git-push-target-resolution.ts b/src/shared/git/remotes/git-push-target-resolution.ts similarity index 96% rename from src/shared/git-push-target-resolution.ts rename to src/shared/git/remotes/git-push-target-resolution.ts index f35505d17b6..5479495fb33 100644 --- a/src/shared/git-push-target-resolution.ts +++ b/src/shared/git/remotes/git-push-target-resolution.ts @@ -1,8 +1,8 @@ import type { GitCommandRunner } from './git-effective-upstream' import { gitRefTargetsBranchOnRemote } from './git-remote-branch-name' import { findGitRemoteNameByFetchUrl } from './git-remote-url-index' -import { createGitConfigSnapshotRunner } from './git-config-snapshot-runner' -import { getGitCurrentBranchName } from './git-current-branch' +import { createGitConfigSnapshotRunner } from '../commands/git-config-snapshot-runner' +import { getGitCurrentBranchName } from '../refs/git-current-branch' export type ResolvedGitPushTarget = { remote: string diff --git a/src/shared/git-push-target-validation.test.ts b/src/shared/git/remotes/git-push-target-validation.test.ts similarity index 100% rename from src/shared/git-push-target-validation.test.ts rename to src/shared/git/remotes/git-push-target-validation.test.ts diff --git a/src/shared/git-push-target-validation.ts b/src/shared/git/remotes/git-push-target-validation.ts similarity index 97% rename from src/shared/git-push-target-validation.ts rename to src/shared/git/remotes/git-push-target-validation.ts index 3a94107b6d7..f24168fc164 100644 --- a/src/shared/git-push-target-validation.ts +++ b/src/shared/git/remotes/git-push-target-validation.ts @@ -1,4 +1,4 @@ -import type { GitPushTarget } from './worktree/types' +import type { GitPushTarget } from '../../worktree/types' const SAFE_REMOTE_NAME_SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]*$/ const GITHUB_CLONE_URL = /^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\.git$/ diff --git a/src/shared/git-rebase-source.ts b/src/shared/git/remotes/git-rebase-source.ts similarity index 100% rename from src/shared/git-rebase-source.ts rename to src/shared/git/remotes/git-rebase-source.ts diff --git a/src/shared/git-remote-branch-name.ts b/src/shared/git/remotes/git-remote-branch-name.ts similarity index 100% rename from src/shared/git-remote-branch-name.ts rename to src/shared/git/remotes/git-remote-branch-name.ts diff --git a/src/shared/git-remote-error.test.ts b/src/shared/git/remotes/git-remote-error.test.ts similarity index 100% rename from src/shared/git-remote-error.test.ts rename to src/shared/git/remotes/git-remote-error.test.ts diff --git a/src/shared/git-remote-error.ts b/src/shared/git/remotes/git-remote-error.ts similarity index 98% rename from src/shared/git-remote-error.ts rename to src/shared/git/remotes/git-remote-error.ts index 580980abd5e..8abe0ed3745 100644 --- a/src/shared/git-remote-error.ts +++ b/src/shared/git/remotes/git-remote-error.ts @@ -1,5 +1,5 @@ -import { stripAnsiEscapeSequences } from './ansi-escape-sequences' -import { isPushHookFailure } from './source-control-push-failure' +import { stripAnsiEscapeSequences } from '../../ansi-escape-sequences' +import { isPushHookFailure } from '../../source-control/recovery/source-control-push-failure' // Why: strip `user:password@` on any scheme, but a lone `user@` only on HTTP(S) — SSH's git@host user-info is required, so stripping breaks the URL. const URL_USERPASS_PATTERN = /[^\s/@:?#]+:[^\s/?#]+@/y diff --git a/src/shared/git-remote-host-alias.ts b/src/shared/git/remotes/git-remote-host-alias.ts similarity index 100% rename from src/shared/git-remote-host-alias.ts rename to src/shared/git/remotes/git-remote-host-alias.ts diff --git a/src/shared/git-remote-identity.test.ts b/src/shared/git/remotes/git-remote-identity.test.ts similarity index 100% rename from src/shared/git-remote-identity.test.ts rename to src/shared/git/remotes/git-remote-identity.test.ts diff --git a/src/shared/git-remote-identity.ts b/src/shared/git/remotes/git-remote-identity.ts similarity index 100% rename from src/shared/git-remote-identity.ts rename to src/shared/git/remotes/git-remote-identity.ts diff --git a/src/shared/git-remote-url-index.test.ts b/src/shared/git/remotes/git-remote-url-index.test.ts similarity index 100% rename from src/shared/git-remote-url-index.test.ts rename to src/shared/git/remotes/git-remote-url-index.test.ts diff --git a/src/shared/git-remote-url-index.ts b/src/shared/git/remotes/git-remote-url-index.ts similarity index 95% rename from src/shared/git-remote-url-index.ts rename to src/shared/git/remotes/git-remote-url-index.ts index 3b99ca35f5d..f199d649eeb 100644 --- a/src/shared/git-remote-url-index.ts +++ b/src/shared/git/remotes/git-remote-url-index.ts @@ -1,7 +1,7 @@ // remote -v replaces serial get-url children with one while preserving insteadOf expansion and the first URL. // Raw config differs: it is unexpanded and returns the last multivar. remote -v predates get-url (2.7), requiring no capability gate. -import { iterateProcessOutputLines } from './process-output-field-scanner' +import { iterateProcessOutputLines } from '../../process-output-field-scanner' export type GitRemoteVerboseEntry = { name: string diff --git a/src/shared/git-upstream-status.test.ts b/src/shared/git/remotes/git-upstream-status.test.ts similarity index 100% rename from src/shared/git-upstream-status.test.ts rename to src/shared/git/remotes/git-upstream-status.test.ts diff --git a/src/shared/git-upstream-status.ts b/src/shared/git/remotes/git-upstream-status.ts similarity index 95% rename from src/shared/git-upstream-status.ts rename to src/shared/git/remotes/git-upstream-status.ts index 60dc04993c6..418f2863302 100644 --- a/src/shared/git-upstream-status.ts +++ b/src/shared/git/remotes/git-upstream-status.ts @@ -1,4 +1,4 @@ -import type { GitUpstreamStatus } from './git-status-types' +import type { GitUpstreamStatus } from '../status/git-status-types' export function upstreamOnlyCommitsArePatchEquivalent(cherryMarkOutput: string): boolean { let hasCommit = false diff --git a/src/shared/git-branch-line-total-soft-deadline.test.ts b/src/shared/git/status/git-branch-line-total-soft-deadline.test.ts similarity index 98% rename from src/shared/git-branch-line-total-soft-deadline.test.ts rename to src/shared/git/status/git-branch-line-total-soft-deadline.test.ts index 34b22d6a464..9ee2f611331 100644 --- a/src/shared/git-branch-line-total-soft-deadline.test.ts +++ b/src/shared/git/status/git-branch-line-total-soft-deadline.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { GIT_BRANCH_LINE_TOTAL_SOFT_DEADLINE_MS } from './git-branch-line-total' +import { beginGitStatusLineStatsCacheWrite } from './git-status-line-stats-write-token' import { - beginGitStatusLineStatsCacheWrite, clearGitStatusLineStatsCache, readCachedGitBranchLineTotal, reuseOrRecomputeGitStatusLineStats, diff --git a/src/shared/git-branch-line-total.test.ts b/src/shared/git/status/git-branch-line-total.test.ts similarity index 100% rename from src/shared/git-branch-line-total.test.ts rename to src/shared/git/status/git-branch-line-total.test.ts diff --git a/src/shared/git-branch-line-total.ts b/src/shared/git/status/git-branch-line-total.ts similarity index 98% rename from src/shared/git-branch-line-total.ts rename to src/shared/git/status/git-branch-line-total.ts index 2b31b88051a..2a7a0dd5e82 100644 --- a/src/shared/git-branch-line-total.ts +++ b/src/shared/git/status/git-branch-line-total.ts @@ -5,10 +5,8 @@ import { parseNumstat, type GitLineStats } from './git-uncommitted-line-stats' -import { isGeneratedCodePath } from './generated-code-path' -import { isTestCodePath } from './test-code-path' - -export type { GitBranchLineTotal } +import { isGeneratedCodePath } from '../../generated-code-path' +import { isTestCodePath } from '../../test-code-path' // Bound large base-to-worktree diffs over SSH; failures invalidate totals instead of publishing partial values. export const GIT_BRANCH_LINE_TOTAL_TIMEOUT_MS = 15_000 diff --git a/src/shared/git-status-branch-line-total-cache.test.ts b/src/shared/git/status/git-status-branch-line-total-cache.test.ts similarity index 99% rename from src/shared/git-status-branch-line-total-cache.test.ts rename to src/shared/git/status/git-status-branch-line-total-cache.test.ts index b15f21db969..d23c97116e9 100644 --- a/src/shared/git-status-branch-line-total-cache.test.ts +++ b/src/shared/git/status/git-status-branch-line-total-cache.test.ts @@ -1,12 +1,12 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { applyCachedGitStatusLineStats, - beginGitStatusLineStatsCacheWrite, clearGitStatusLineStatsCache, readCachedGitBranchLineTotal, reuseOrRecomputeGitStatusLineStats, storeGitStatusLineStats } from './git-status-line-stats-cache' +import { beginGitStatusLineStatsCacheWrite } from './git-status-line-stats-write-token' import type { GitBranchLineTotal } from './git-status-types' const CACHE_KEY = 'native\0/repo' diff --git a/src/shared/git-status-conflict-entries.test.ts b/src/shared/git/status/git-status-conflict-entries.test.ts similarity index 100% rename from src/shared/git-status-conflict-entries.test.ts rename to src/shared/git/status/git-status-conflict-entries.test.ts diff --git a/src/shared/git-status-conflict-entries.ts b/src/shared/git/status/git-status-conflict-entries.ts similarity index 97% rename from src/shared/git-status-conflict-entries.ts rename to src/shared/git/status/git-status-conflict-entries.ts index ee959d4760e..651f5d9ca8b 100644 --- a/src/shared/git-status-conflict-entries.ts +++ b/src/shared/git/status/git-status-conflict-entries.ts @@ -1,7 +1,7 @@ import { access } from 'node:fs/promises' import * as path from 'node:path' import type { GitConflictKind, GitFileStatus, GitStatusEntry } from './git-status-types' -import { decodeGitCQuotedPath } from './git-cquoted-path' +import { decodeGitCQuotedPath } from '../paths/git-cquoted-path' const OCTAL_FILE_MODE = /^[0-7]{6}$/ diff --git a/src/shared/git-status-labels.ts b/src/shared/git/status/git-status-labels.ts similarity index 100% rename from src/shared/git-status-labels.ts rename to src/shared/git/status/git-status-labels.ts diff --git a/src/shared/git-status-limit.test.ts b/src/shared/git/status/git-status-limit.test.ts similarity index 100% rename from src/shared/git-status-limit.test.ts rename to src/shared/git/status/git-status-limit.test.ts diff --git a/src/shared/git-status-limit.ts b/src/shared/git/status/git-status-limit.ts similarity index 100% rename from src/shared/git-status-limit.ts rename to src/shared/git/status/git-status-limit.ts diff --git a/src/shared/git-status-line-stat-inputs.ts b/src/shared/git/status/git-status-line-stat-inputs.ts similarity index 100% rename from src/shared/git-status-line-stat-inputs.ts rename to src/shared/git/status/git-status-line-stat-inputs.ts diff --git a/src/shared/git-status-line-stats-cache.test.ts b/src/shared/git/status/git-status-line-stats-cache.test.ts similarity index 98% rename from src/shared/git-status-line-stats-cache.test.ts rename to src/shared/git/status/git-status-line-stats-cache.test.ts index 80c5a46081d..fec87d97755 100644 --- a/src/shared/git-status-line-stats-cache.test.ts +++ b/src/shared/git/status/git-status-line-stats-cache.test.ts @@ -1,13 +1,13 @@ import { beforeEach, describe, expect, it } from 'vitest' import { applyCachedGitStatusLineStats, - beginGitStatusLineStatsCacheWrite, clearGitStatusLineStatsCache, clearGitStatusLineStatsCacheKey, GIT_STATUS_LINE_STATS_CACHE_MAX_AGE_MS, reuseOrRecomputeGitStatusLineStats, storeGitStatusLineStats } from './git-status-line-stats-cache' +import { beginGitStatusLineStatsCacheWrite } from './git-status-line-stats-write-token' const cachedEntries = [ { diff --git a/src/shared/git-status-line-stats-cache.ts b/src/shared/git/status/git-status-line-stats-cache.ts similarity index 98% rename from src/shared/git-status-line-stats-cache.ts rename to src/shared/git/status/git-status-line-stats-cache.ts index ddf1b29852a..c5e926231d1 100644 --- a/src/shared/git-status-line-stats-cache.ts +++ b/src/shared/git/status/git-status-line-stats-cache.ts @@ -15,11 +15,6 @@ import { type GitStatusLineStatsEntry } from './git-status-line-stats-snapshot' -export { - beginGitStatusLineStatsCacheWrite, - type GitStatusLineStatsWriteToken -} from './git-status-line-stats-write-token' - type BranchLineTotalResult = Pick function branchLineTotalResult( diff --git a/src/shared/git-status-line-stats-snapshot.ts b/src/shared/git/status/git-status-line-stats-snapshot.ts similarity index 100% rename from src/shared/git-status-line-stats-snapshot.ts rename to src/shared/git/status/git-status-line-stats-snapshot.ts diff --git a/src/shared/git-status-line-stats-write-token.ts b/src/shared/git/status/git-status-line-stats-write-token.ts similarity index 100% rename from src/shared/git-status-line-stats-write-token.ts rename to src/shared/git/status/git-status-line-stats-write-token.ts diff --git a/src/shared/git-status-porcelain-parser.test.ts b/src/shared/git/status/git-status-porcelain-parser.test.ts similarity index 100% rename from src/shared/git-status-porcelain-parser.test.ts rename to src/shared/git/status/git-status-porcelain-parser.test.ts diff --git a/src/shared/git-status-porcelain-parser.ts b/src/shared/git/status/git-status-porcelain-parser.ts similarity index 99% rename from src/shared/git-status-porcelain-parser.ts rename to src/shared/git/status/git-status-porcelain-parser.ts index 3c6cc7ddbd9..d5b64692621 100644 --- a/src/shared/git-status-porcelain-parser.ts +++ b/src/shared/git/status/git-status-porcelain-parser.ts @@ -1,5 +1,5 @@ import type { GitStatusEntry } from './git-status-types' -import { decodeGitCQuotedPath } from './git-cquoted-path' +import { decodeGitCQuotedPath } from '../paths/git-cquoted-path' /** Parse porcelain v2 incrementally so callers can stop Git at the entry limit instead of buffering output past V8’s string ceiling. * Carry partial newline-delimited records between chunks. Defer unmerged u rows to caller resolution (using mW presence), but count them toward the cap. */ diff --git a/src/shared/git-status-read-lease-expiry.test.ts b/src/shared/git/status/git-status-read-lease-expiry.test.ts similarity index 100% rename from src/shared/git-status-read-lease-expiry.test.ts rename to src/shared/git/status/git-status-read-lease-expiry.test.ts diff --git a/src/shared/git-status-read-lease-owner.test.ts b/src/shared/git/status/git-status-read-lease-owner.test.ts similarity index 100% rename from src/shared/git-status-read-lease-owner.test.ts rename to src/shared/git/status/git-status-read-lease-owner.test.ts diff --git a/src/shared/git-status-read-lease-owner.ts b/src/shared/git/status/git-status-read-lease-owner.ts similarity index 100% rename from src/shared/git-status-read-lease-owner.ts rename to src/shared/git/status/git-status-read-lease-owner.ts diff --git a/src/shared/git-status-sort.ts b/src/shared/git/status/git-status-sort.ts similarity index 90% rename from src/shared/git-status-sort.ts rename to src/shared/git/status/git-status-sort.ts index 64f280ca734..a3d88e5f5a2 100644 --- a/src/shared/git-status-sort.ts +++ b/src/shared/git/status/git-status-sort.ts @@ -1,5 +1,5 @@ import type { GitStatusEntry } from './git-status-types' -import { compareFileNames } from './file-name-sort' +import { compareFileNames } from '../../file-name-sort' export function compareGitStatusEntries(a: GitStatusEntry, b: GitStatusEntry): number { // Use compareFileNames to break numeric ties (2/02) consistently with File Explorer. diff --git a/src/shared/git-status-types.ts b/src/shared/git/status/git-status-types.ts similarity index 100% rename from src/shared/git-status-types.ts rename to src/shared/git/status/git-status-types.ts diff --git a/src/shared/git-status-upstream-ref.test.ts b/src/shared/git/status/git-status-upstream-ref.test.ts similarity index 100% rename from src/shared/git-status-upstream-ref.test.ts rename to src/shared/git/status/git-status-upstream-ref.test.ts diff --git a/src/shared/git-status-upstream-ref.ts b/src/shared/git/status/git-status-upstream-ref.ts similarity index 100% rename from src/shared/git-status-upstream-ref.ts rename to src/shared/git/status/git-status-upstream-ref.ts diff --git a/src/shared/git-uncommitted-line-stats.test.ts b/src/shared/git/status/git-uncommitted-line-stats.test.ts similarity index 99% rename from src/shared/git-uncommitted-line-stats.test.ts rename to src/shared/git/status/git-uncommitted-line-stats.test.ts index a52b7faf36f..df1911203b0 100644 --- a/src/shared/git-uncommitted-line-stats.test.ts +++ b/src/shared/git/status/git-uncommitted-line-stats.test.ts @@ -8,7 +8,7 @@ const { lstatMock, readFileMock } = vi.hoisted(() => ({ vi.mock('fs/promises', () => ({ lstat: lstatMock })) -vi.mock('./node-bounded-file-reader', () => ({ +vi.mock('../../node-bounded-file-reader', () => ({ readNodeFileWithinLimit: async (path: string) => ({ buffer: await readFileMock(path), stats: mockFileStat(0) diff --git a/src/shared/git-uncommitted-line-stats.ts b/src/shared/git/status/git-uncommitted-line-stats.ts similarity index 96% rename from src/shared/git-uncommitted-line-stats.ts rename to src/shared/git/status/git-uncommitted-line-stats.ts index 7bdc5097a71..932584af9ee 100644 --- a/src/shared/git-uncommitted-line-stats.ts +++ b/src/shared/git/status/git-uncommitted-line-stats.ts @@ -1,10 +1,10 @@ import { lstat } from 'node:fs/promises' import * as path from 'node:path' -import { isBinaryBuffer } from './binary-buffer' -import { decodeGitCQuotedPath } from './git-cquoted-path' +import { isBinaryBuffer } from '../../binary-buffer' +import { decodeGitCQuotedPath } from '../paths/git-cquoted-path' import { DEFAULT_GIT_STATUS_LIMIT } from './git-status-limit' -import { iterateNulDelimitedFields } from './nul-delimited-fields' -import { readNodeFileWithinLimit } from './node-bounded-file-reader' +import { iterateNulDelimitedFields } from '../../nul-delimited-fields' +import { readNodeFileWithinLimit } from '../../node-bounded-file-reader' export type GitLineStats = { added?: number; removed?: number } diff --git a/src/shared/git-worktree-admin.test.ts b/src/shared/git/worktrees/git-worktree-admin.test.ts similarity index 97% rename from src/shared/git-worktree-admin.test.ts rename to src/shared/git/worktrees/git-worktree-admin.test.ts index 090afaf0a21..db131bf4490 100644 --- a/src/shared/git-worktree-admin.test.ts +++ b/src/shared/git/worktrees/git-worktree-admin.test.ts @@ -2,14 +2,14 @@ import { mkdir, mkdtemp, rename, rm, symlink, writeFile } from 'node:fs/promises import { tmpdir } from 'node:os' import path from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import { resolveGitCommonDirectory } from './git-common-directory' +import { resolveGitCommonDirectory } from '../metadata/git-common-directory' import { annotateWorktreeLocksFromAdmin, findLinkedWorktreeGitDirectory, isBranchReservedByWorktreeOperation } from './git-worktree-admin' -import type { GitWorktreeInfo } from './worktree/types' -import { isWorktreeCreatePreparation } from './worktree/create-preparation' +import type { GitWorktreeInfo } from '../../worktree/types' +import { isWorktreeCreatePreparation } from '../../worktree/create-preparation' let root = '' let repo = '' diff --git a/src/shared/git-worktree-admin.ts b/src/shared/git/worktrees/git-worktree-admin.ts similarity index 95% rename from src/shared/git-worktree-admin.ts rename to src/shared/git/worktrees/git-worktree-admin.ts index 8dbdee3b66b..7faf43c4554 100644 --- a/src/shared/git-worktree-admin.ts +++ b/src/shared/git/worktrees/git-worktree-admin.ts @@ -1,17 +1,17 @@ import type { Dirent } from 'node:fs' import { lstat, readdir, realpath } from 'node:fs/promises' import path from 'node:path' -import { waitForPromiseWithSignal } from './abort-signal-reason' +import { waitForPromiseWithSignal } from '../../abort-signal-reason' import { isMissingGitAdminEntry, readGitAdminFile, resolveGitCommonDirectory, type GitAdminReadOptions -} from './git-common-directory' -import { resolveGitMetadataPath, resolveWorktreeHostPath } from './git-metadata-path' -import { mapWithConcurrency } from './map-with-concurrency' -import { foldWslUncPathCaseInsensitiveParts } from './wsl-paths' -import type { GitWorktreeInfo } from './worktree/types' +} from '../metadata/git-common-directory' +import { resolveGitMetadataPath, resolveWorktreeHostPath } from '../metadata/git-metadata-path' +import { mapWithConcurrency } from '../../map-with-concurrency' +import { foldWslUncPathCaseInsensitiveParts } from '../../wsl-paths' +import type { GitWorktreeInfo } from '../../worktree/types' const ADMIN_READ_CONCURRENCY = 8 type WorktreeAdminDirectory = { diff --git a/src/shared/git-worktree-binary-compatibility.test-cases.ts b/src/shared/git/worktrees/git-worktree-binary-compatibility.test-cases.ts similarity index 97% rename from src/shared/git-worktree-binary-compatibility.test-cases.ts rename to src/shared/git/worktrees/git-worktree-binary-compatibility.test-cases.ts index 366b25e2843..85424a74502 100644 --- a/src/shared/git-worktree-binary-compatibility.test-cases.ts +++ b/src/shared/git/worktrees/git-worktree-binary-compatibility.test-cases.ts @@ -1,8 +1,11 @@ import { mkdir, readFile, rm, unlink, writeFile } from 'node:fs/promises' import { join } from 'node:path' import { expect, it } from 'vitest' -import { isBranchCheckedOutInWorktreeError } from './git-branch-delete-refusal' -import { createGitProgressRecordReader, type GitProgressRecord } from './git-progress-records' +import { isBranchCheckedOutInWorktreeError } from '../branches/git-branch-delete-refusal' +import { + createGitProgressRecordReader, + type GitProgressRecord +} from '../commands/git-progress-records' import { hasUnsupportedRevParsePathFormatEcho, isUnsupportedWorktreeAddLockReasonError, diff --git a/src/shared/git-worktree-command-capabilities.ts b/src/shared/git/worktrees/git-worktree-command-capabilities.ts similarity index 100% rename from src/shared/git-worktree-command-capabilities.ts rename to src/shared/git/worktrees/git-worktree-command-capabilities.ts diff --git a/src/shared/git-worktree-operation-lock.test.ts b/src/shared/git/worktrees/git-worktree-operation-lock.test.ts similarity index 100% rename from src/shared/git-worktree-operation-lock.test.ts rename to src/shared/git/worktrees/git-worktree-operation-lock.test.ts diff --git a/src/shared/git-worktree-operation-lock.ts b/src/shared/git/worktrees/git-worktree-operation-lock.ts similarity index 86% rename from src/shared/git-worktree-operation-lock.ts rename to src/shared/git/worktrees/git-worktree-operation-lock.ts index 55491bd2ac5..43252349d92 100644 --- a/src/shared/git-worktree-operation-lock.ts +++ b/src/shared/git/worktrees/git-worktree-operation-lock.ts @@ -1,6 +1,6 @@ import { realpath } from 'node:fs/promises' import { resolve } from 'node:path' -import { runWithGitOperationLock } from './git-operation-lock' +import { runWithGitOperationLock } from '../commands/git-operation-lock' /** Serialize mutations that leave per-worktree state in progress (for example, rebase). */ export async function runWithGitWorktreeOperationLock( diff --git a/src/shared/git-worktree-porcelain-parser.ts b/src/shared/git/worktrees/git-worktree-porcelain-parser.ts similarity index 95% rename from src/shared/git-worktree-porcelain-parser.ts rename to src/shared/git/worktrees/git-worktree-porcelain-parser.ts index ad1e39e727f..8ae11a66dec 100644 --- a/src/shared/git-worktree-porcelain-parser.ts +++ b/src/shared/git/worktrees/git-worktree-porcelain-parser.ts @@ -1,5 +1,5 @@ -import { decodeGitCQuotedPath } from './git-cquoted-path' -import type { GitWorktreeInfo } from './worktree/types' +import { decodeGitCQuotedPath } from '../paths/git-cquoted-path' +import type { GitWorktreeInfo } from '../../worktree/types' export function parseWorktreeList( output: string, diff --git a/src/shared/github/checks-detail-polling-policy.ts b/src/shared/github/checks-detail-polling-policy.ts index 30e389d66ee..1032e957552 100644 --- a/src/shared/github/checks-detail-polling-policy.ts +++ b/src/shared/github/checks-detail-polling-policy.ts @@ -1,6 +1,6 @@ import type { PRCheckDetail } from './check-types' import type { CheckStatus } from './pull-request-types' -import type { HostedReviewState } from '../hosted-review' +import type { HostedReviewState } from '../source-control/hosted-review/hosted-review-contracts' import { reviewRefreshIntervalMs } from '../review-refresh-policy' export function detailedChecksStatus(checks: readonly PRCheckDetail[]): CheckStatus | undefined { diff --git a/src/shared/github/pull-request-merge-state.ts b/src/shared/github/pull-request-merge-state.ts index 3f973c5f911..e480c249ac6 100644 --- a/src/shared/github/pull-request-merge-state.ts +++ b/src/shared/github/pull-request-merge-state.ts @@ -1,4 +1,4 @@ -import { getProviderChecksOutcome } from '../provider-check-summary' +import { getProviderChecksOutcome } from '../source-control/checks/provider-check-summary' import type { CheckStatus, ProviderCheckSummary } from './pull-request-types' import { canShowGitHubPRAutoMergeControl, diff --git a/src/shared/gitlab-types.ts b/src/shared/gitlab-types.ts index 657faa0cb2e..55902cf57e0 100644 --- a/src/shared/gitlab-types.ts +++ b/src/shared/gitlab-types.ts @@ -6,7 +6,7 @@ import type { PRConflictSummary, ProviderCheckSummary } from './github/pull-request-types' -import type { HostedReviewDecision } from './hosted-review' +import type { HostedReviewDecision } from './source-control/hosted-review/hosted-review-contracts' // Why: flat owner/repo is inadequate — projects nest (`group/subgroup/project`) and self-hosted hosts must travel with the path for URL/glab targeting. export type GitLabProjectRef = { host: string; path: string } diff --git a/src/shared/global-settings-types.ts b/src/shared/global-settings-types.ts index 7f4e06ef8e1..b585d91fb37 100644 --- a/src/shared/global-settings-types.ts +++ b/src/shared/global-settings-types.ts @@ -11,7 +11,7 @@ import type { GitLabProjectSettings } from './gitlab-types' import type { TaskProvider } from './task-providers' import type { KeybindingOverrides, TerminalShortcutPolicy } from './keybindings' import type { AppIconId } from './app-icon' -import type { SourceControlAiSettings } from './source-control-ai-types' +import type { SourceControlAiSettings } from './source-control/ai/settings/source-control-ai-settings-types' import type { ClaudeAgentTeamsMode } from './claude-agent-teams-tmux-compat' import type { TerminalCustomTheme } from './terminal-custom-themes' import type { UiLanguage } from './ui-language' @@ -19,7 +19,7 @@ import type { GlobalWindowsRuntimeDefault } from './project-execution-runtime' import type { PersistedNativeChatSessionOptions } from './native-chat/input/native-chat-session-options' import type { AgentChatPermissionMode } from './agent-launch/permissions/agent-chat-permission-mode' import type { ComputerAwakeMode } from './computer-awake-mode' -import type { CommitMessageAiSettings } from './commit-message-ai-types' +import type { CommitMessageAiSettings } from './source-control/ai/generation/commit-message-ai-types' import type { HostSettingOverrides } from './host-setting-overrides' import type { ClaudeManagedAccount, diff --git a/src/shared/grok-model-list-probe.ts b/src/shared/grok-model-list-probe.ts index f1392fa79d5..995ec90170b 100644 --- a/src/shared/grok-model-list-probe.ts +++ b/src/shared/grok-model-list-probe.ts @@ -1,4 +1,4 @@ -import type { CommitMessageModel } from './commit-message-agent-spec' +import type { CommitMessageModel } from './source-control/ai/generation/commit-message-agent-spec' import { labelFromModelId } from './model-id-label' // grok models exposes only human-readable text, with no --json/--format. diff --git a/src/shared/imported-folder-project-identity.test.ts b/src/shared/imported-folder-project-identity.test.ts index 9523adde260..2369723d15c 100644 --- a/src/shared/imported-folder-project-identity.test.ts +++ b/src/shared/imported-folder-project-identity.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { deriveGitRemoteIdentity } from './git-remote-identity' +import { deriveGitRemoteIdentity } from './git/remotes/git-remote-identity' import { resolveImportedFolderProjectLink } from './imported-folder-project-identity' import { getProjectIdentityKey } from './project-host-setup-projection' diff --git a/src/shared/native-chat/input/native-chat-discovered-catalog-models.ts b/src/shared/native-chat/input/native-chat-discovered-catalog-models.ts index 3a286738aa6..1bbd52eba0b 100644 --- a/src/shared/native-chat/input/native-chat-discovered-catalog-models.ts +++ b/src/shared/native-chat/input/native-chat-discovered-catalog-models.ts @@ -9,7 +9,7 @@ import type { CatalogModel } from '../../agent-session/options/agent-session-option-catalog-types' import type { AgentType } from '../../agent-status/contracts/agent-status-types' -import type { CommitMessageModelCapability } from '../../commit-message-agent-spec' +import type { CommitMessageModelCapability } from '../../source-control/ai/generation/commit-message-agent-spec' export type NativeChatModelDiscoveryResult = | { diff --git a/src/shared/omp-model-list-probe.ts b/src/shared/omp-model-list-probe.ts index a5997781951..49dc2a5bca1 100644 --- a/src/shared/omp-model-list-probe.ts +++ b/src/shared/omp-model-list-probe.ts @@ -1,4 +1,4 @@ -import type { CommitMessageModel } from './commit-message-agent-spec' +import type { CommitMessageModel } from './source-control/ai/generation/commit-message-agent-spec' import { labelFromModelId } from './model-id-label' // Use OMP’s only machine-readable listing; provider-grouped tables require brittle parsing. diff --git a/src/shared/opencode-generation-command.test.ts b/src/shared/opencode-generation-command.test.ts index 945300a1c12..1015dd186a9 100644 --- a/src/shared/opencode-generation-command.test.ts +++ b/src/shared/opencode-generation-command.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { planCommitMessageGeneration } from './commit-message-plan' +import { planCommitMessageGeneration } from './source-control/ai/generation/commit-message-plan' import { openCodeVariantRetryPlan } from './opencode-generation-command' const rejection = 'Unrecognized flag: --variant in command opencode run' diff --git a/src/shared/opencode-generation-command.ts b/src/shared/opencode-generation-command.ts index 524cbe5bdbe..b1cf68191b7 100644 --- a/src/shared/opencode-generation-command.ts +++ b/src/shared/opencode-generation-command.ts @@ -1,5 +1,5 @@ import { findOptionOccurrence } from './command-option-occurrence' -import type { CommitMessagePlan } from './commit-message-plan' +import type { CommitMessagePlan } from './source-control/ai/generation/commit-message-plan' export function mergeOpenCodeGenerationArgs( agentId: string, diff --git a/src/shared/powershell-native-argument.windows.test.ts b/src/shared/powershell-native-argument.windows.test.ts index fbd4cdb6d86..a63e118a68a 100644 --- a/src/shared/powershell-native-argument.windows.test.ts +++ b/src/shared/powershell-native-argument.windows.test.ts @@ -1,8 +1,8 @@ import { parse as parseToml } from 'smol-toml' import { getDefaultSettings } from './constants' -import { saveSourceControlActionRecipe } from './source-control-ai-recipe-save' -import { resolveSourceControlActionRecipe } from './source-control-ai-operation-policy' -import { projectSourceControlActionLaunch } from './source-control-action-launch-preferences' +import { saveSourceControlActionRecipe } from './source-control/ai/settings/source-control-ai-recipe-save' +import { resolveSourceControlActionRecipe } from './source-control/ai/source-control-ai-operation-policy' +import { projectSourceControlActionLaunch } from './source-control/ai/recipes/source-control-action-launch-preferences' import { resolveAgentStartupPlanInputs } from './agent-launch/startup/agent-startup-plan-inputs' import { buildAgentStartupPlan } from './agent-launch/startup/tui-agent-startup' import { spawnSync } from 'node:child_process' diff --git a/src/shared/project-host-setup-projection.ts b/src/shared/project-host-setup-projection.ts index eb641768895..2eb7d0e1ab1 100644 --- a/src/shared/project-host-setup-projection.ts +++ b/src/shared/project-host-setup-projection.ts @@ -3,7 +3,7 @@ import { normalizeProjectHostSetupRow, normalizeProjectRow } from './project-catalog-row-normalization' -import { normalizeGitHubRemoteHost } from './git-remote-host-alias' +import { normalizeGitHubRemoteHost } from './git/remotes/git-remote-host-alias' import { githubRepoIdentityKey, isDefaultGitHubHost } from './github/repository-identity-key' import type { Project, ProjectHostSetup, ProjectProviderIdentity } from './project-types' import type { Repo } from './repo-types' diff --git a/src/shared/project-types.ts b/src/shared/project-types.ts index 379fa42f89d..bb30e0cf79e 100644 --- a/src/shared/project-types.ts +++ b/src/shared/project-types.ts @@ -1,9 +1,9 @@ import type { ExecutionHostId } from './execution-host' import type { RepoIcon } from './repo-icon' -import type { GitRemoteIdentity } from './git-remote-identity' +import type { GitRemoteIdentity } from './git/remotes/git-remote-identity' import type { LocalWindowsRuntimePreference } from './project-execution-runtime' import type { RepoHookSettings } from './orca-yaml-hook-types' -import type { RepoSourceControlAiOverrides } from './source-control-ai-types' +import type { RepoSourceControlAiOverrides } from './source-control/ai/settings/source-control-ai-settings-types' import type { Repo, RepoKind } from './repo-types' import type { ProjectHostSetupTarget } from './project-host-setup-target' diff --git a/src/shared/protocol-version.ts b/src/shared/protocol-version.ts index a07e2e65eb3..0671967037e 100644 --- a/src/shared/protocol-version.ts +++ b/src/shared/protocol-version.ts @@ -22,7 +22,7 @@ import { SESSION_TABS_RUNTIME_CAPABILITIES } from './session-tabs-runtime-capabilities' import { SKILL_RUNTIME_CAPABILITIES } from './skill-install-capability' -import { SOURCE_CONTROL_RUNTIME_CAPABILITIES } from './source-control-runtime-capabilities' +import { SOURCE_CONTROL_RUNTIME_CAPABILITIES } from './source-control/runtime/source-control-runtime-capabilities' import { TASK_SOURCE_RUNTIME_CAPABILITIES } from './task-source-runtime-capabilities' import { TERMINAL_RUNTIME_CAPABILITIES } from './terminal-runtime-capabilities' import { WORKSPACE_PORTS_RUNTIME_CAPABILITIES } from './workspace-ports-runtime-capabilities' @@ -50,7 +50,7 @@ export * from './host-runtime-capabilities' export * from './mobile-runtime-capabilities' export * from './preflight-runtime-capabilities' -export * from './source-control-runtime-capabilities' + export * from './task-source-runtime-capabilities' export * from './terminal-runtime-capabilities' export * from './workspace-ports-runtime-capabilities' diff --git a/src/shared/remote-runtime/requests/remote-runtime-request-connection.test.ts b/src/shared/remote-runtime/requests/remote-runtime-request-connection.test.ts index dcdab77eda2..4d2cfef0374 100644 --- a/src/shared/remote-runtime/requests/remote-runtime-request-connection.test.ts +++ b/src/shared/remote-runtime/requests/remote-runtime-request-connection.test.ts @@ -24,7 +24,7 @@ import { _gitAdmissionSnapshotForTests, _resetGitAdmissionForTests } from '../../../main/git/command-runner/git-subprocess-admission' -import { GitAdmissionScheduler } from '../../git-admission-scheduler' +import { GitAdmissionScheduler } from '../../git/admission/git-admission-scheduler' const { execFileMock } = vi.hoisted(() => ({ execFileMock: vi.fn() })) vi.mock('node:child_process', async (original) => ({ diff --git a/src/shared/repo-types.ts b/src/shared/repo-types.ts index e05fd844167..653fc924a24 100644 --- a/src/shared/repo-types.ts +++ b/src/shared/repo-types.ts @@ -2,9 +2,9 @@ import type { RepoIcon } from './repo-icon' import type { GhAccountBinding } from './github/account-binding' import type { GitHubRepositoryIdentity } from './github/pull-request-types' import type { RepoHookSettings } from './orca-yaml-hook-types' -import type { ForkSyncMode } from './git-fork-sync' -import type { GitRemoteIdentity } from './git-remote-identity' -import type { RepoSourceControlAiOverrides } from './source-control-ai-types' +import type { ForkSyncMode } from './git/remotes/git-fork-sync' +import type { GitRemoteIdentity } from './git/remotes/git-remote-identity' +import type { RepoSourceControlAiOverrides } from './source-control/ai/settings/source-control-ai-settings-types' import type { RepoProjectHostSetupMethod } from './project-types' import type { JiraProjectReference } from './jira/jira-project-reference' import type { OrcadRetainedMarker } from './orcad-retained-marker' diff --git a/src/shared/review-refresh-policy.ts b/src/shared/review-refresh-policy.ts index 39ca4427ee5..3905c261b1c 100644 --- a/src/shared/review-refresh-policy.ts +++ b/src/shared/review-refresh-policy.ts @@ -1,4 +1,4 @@ -import type { HostedReviewState } from './hosted-review' +import type { HostedReviewState } from './source-control/hosted-review/hosted-review-contracts' import type { CheckStatus } from './github/pull-request-types' export const REVIEW_REFRESH_COOLDOWN_MS = 10_000 diff --git a/src/shared/rpc-contract/client-settings-params.ts b/src/shared/rpc-contract/client-settings-params.ts index e1d51e0ba40..1451c0e79e8 100644 --- a/src/shared/rpc-contract/client-settings-params.ts +++ b/src/shared/rpc-contract/client-settings-params.ts @@ -8,7 +8,7 @@ import { normalizeTuiAgentEnvRecord } from '../agent-launch/choices/tui-agent-launch-defaults' import { MACHINE_NAME_MAX_LENGTH } from '../machine-name' -import { normalizePRBotAuthorOverrides } from '../pr-bot-author-overrides' +import { normalizePRBotAuthorOverrides } from '../source-control/review-comments/pr-bot-author-overrides' import { WorktreeVisibilityDefaultsUpdate } from './worktree-visibility-defaults-params' import { AGENT_CHAT_PERMISSION_MODES } from '../agent-launch/permissions/agent-chat-permission-mode' diff --git a/src/shared/rpc-contract/git-params.ts b/src/shared/rpc-contract/git-params.ts index 0e8eede547f..677727d3560 100644 --- a/src/shared/rpc-contract/git-params.ts +++ b/src/shared/rpc-contract/git-params.ts @@ -1,8 +1,8 @@ -import { normalizeSourceControlAiActionDefaults } from '../source-control-ai-actions' +import { normalizeSourceControlAiActionDefaults } from '../source-control/ai/recipes/source-control-ai-actions' import { z } from 'zod' import { OptionalGitAdmissionTier } from './git-admission-tier-params' import { OptionalTuiAgent } from './worktree-params' -import { CONFLICT_RESOLUTIONS } from '../source-control-entry-actions' +import { CONFLICT_RESOLUTIONS } from '../source-control/listing/source-control-entry-actions' export const WorktreeSelector = z.object({ worktree: z diff --git a/src/shared/rpc-contract/repo-update-params.ts b/src/shared/rpc-contract/repo-update-params.ts index 2b6e164a184..a67416a733e 100644 --- a/src/shared/rpc-contract/repo-update-params.ts +++ b/src/shared/rpc-contract/repo-update-params.ts @@ -1,5 +1,5 @@ import { z } from 'zod' -import { normalizeRepoSourceControlAiOverrides } from '../source-control-ai' +import { normalizeRepoSourceControlAiOverrides } from '../source-control/ai/settings/source-control-ai-repo-settings' import { normalizeRepoBadgeColor } from '../repo-badge-color' import { sanitizeRepoIcon } from '../repo-icon' import { normalizeGhAccountBinding } from '../github/account-binding' diff --git a/src/shared/antigravity-source-control.spec.ts b/src/shared/source-control/ai/antigravity-source-control.spec.ts similarity index 94% rename from src/shared/antigravity-source-control.spec.ts rename to src/shared/source-control/ai/antigravity-source-control.spec.ts index 71d03d5ce38..900d3088896 100644 --- a/src/shared/antigravity-source-control.spec.ts +++ b/src/shared/source-control/ai/antigravity-source-control.spec.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' -import { getDefaultSettings } from './constants' -import { resolveSourceControlAiForOperation } from './source-control-ai' -import { planCommitMessageGeneration } from './commit-message-plan' +import { getDefaultSettings } from '../../constants' +import { resolveSourceControlAiForOperation } from './source-control-ai-operation-resolution' +import { planCommitMessageGeneration } from './generation/commit-message-plan' describe('Antigravity source-control model selection', () => { for (const host of ['local', 'ssh:verification-host']) { diff --git a/src/shared/conversation-name-action.spec.ts b/src/shared/source-control/ai/conversation-name-action.spec.ts similarity index 92% rename from src/shared/conversation-name-action.spec.ts rename to src/shared/source-control/ai/conversation-name-action.spec.ts index 7557e133d84..62d702ca50a 100644 --- a/src/shared/conversation-name-action.spec.ts +++ b/src/shared/source-control/ai/conversation-name-action.spec.ts @@ -1,12 +1,12 @@ import { describe, expect, it } from 'vitest' -import { getDefaultSettings } from './constants' +import { getDefaultSettings } from '../../constants' import { normalizeSourceControlAiActionDefaults, SOURCE_CONTROL_ACTION_IDS, SOURCE_CONTROL_TEXT_ACTION_IDS -} from './source-control-ai-actions' -import { normalizeSourceControlAiSettings } from './source-control-ai-settings' -import { resolveSourceControlAiForOperation } from './source-control-ai' +} from './recipes/source-control-ai-actions' +import { normalizeSourceControlAiSettings } from './settings/source-control-ai-settings' +import { resolveSourceControlAiForOperation } from './source-control-ai-operation-resolution' describe('conversation name action', () => { it('retains a saved recipe while Git action lists remain Git-only', () => { diff --git a/src/shared/commit-message-agent-output.ts b/src/shared/source-control/ai/generation/commit-message-agent-output.ts similarity index 100% rename from src/shared/commit-message-agent-output.ts rename to src/shared/source-control/ai/generation/commit-message-agent-output.ts diff --git a/src/shared/commit-message-agent-spec.test.ts b/src/shared/source-control/ai/generation/commit-message-agent-spec.test.ts similarity index 100% rename from src/shared/commit-message-agent-spec.test.ts rename to src/shared/source-control/ai/generation/commit-message-agent-spec.test.ts diff --git a/src/shared/commit-message-agent-spec.ts b/src/shared/source-control/ai/generation/commit-message-agent-spec.ts similarity index 96% rename from src/shared/commit-message-agent-spec.ts rename to src/shared/source-control/ai/generation/commit-message-agent-spec.ts index 371e6cf6f5d..a833f2806f0 100644 --- a/src/shared/commit-message-agent-spec.ts +++ b/src/shared/source-control/ai/generation/commit-message-agent-spec.ts @@ -1,7 +1,7 @@ -import { OMP_MODEL_LIST_ARGS, parseOmpModelList } from './omp-model-list-probe' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' -import { isTuiAgentEnabled } from './agent-launch/catalog/tui-agent-selection' -import { labelFromModelId } from './model-id-label' +import { OMP_MODEL_LIST_ARGS, parseOmpModelList } from '../../../omp-model-list-probe' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' +import { isTuiAgentEnabled } from '../../../agent-launch/catalog/tui-agent-selection' +import { labelFromModelId } from '../../../model-id-label' import { buildPrimaryCommitMessageAgentSpecs } from './commit-message-agent-specs-primary' import { buildSecondaryCommitMessageAgentSpecs } from './commit-message-agent-specs-secondary' import { diff --git a/src/shared/commit-message-agent-specs-primary.ts b/src/shared/source-control/ai/generation/commit-message-agent-specs-primary.ts similarity index 98% rename from src/shared/commit-message-agent-specs-primary.ts rename to src/shared/source-control/ai/generation/commit-message-agent-specs-primary.ts index d547794df0d..41079904453 100644 --- a/src/shared/commit-message-agent-specs-primary.ts +++ b/src/shared/source-control/ai/generation/commit-message-agent-specs-primary.ts @@ -1,14 +1,14 @@ import { claudeBackgroundArgs, claudeTextGenerationToolArgs -} from './claude-background-run-isolation' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +} from '../../../claude-background-run-isolation' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' import type { CommitMessageAgentSpec, CommitMessageModel, ThinkingLevel } from './commit-message-agent-spec' -import { CLAUDE_MODEL_LIST_ARGS, CLAUDE_MODEL_LIST_STDIN } from './claude-model-list-probe' +import { CLAUDE_MODEL_LIST_ARGS, CLAUDE_MODEL_LIST_STDIN } from '../../../claude-model-list-probe' type PrimaryAgentSpecDeps = { CLAUDE_THINKING_LEVELS: ThinkingLevel[] diff --git a/src/shared/commit-message-agent-specs-secondary.ts b/src/shared/source-control/ai/generation/commit-message-agent-specs-secondary.ts similarity index 99% rename from src/shared/commit-message-agent-specs-secondary.ts rename to src/shared/source-control/ai/generation/commit-message-agent-specs-secondary.ts index 90ec3cfde5a..64bdaf703ad 100644 --- a/src/shared/commit-message-agent-specs-secondary.ts +++ b/src/shared/source-control/ai/generation/commit-message-agent-specs-secondary.ts @@ -1,4 +1,4 @@ -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' import type { CommitMessageAgentSpec, CommitMessageModel, diff --git a/src/shared/commit-message-ai-types.ts b/src/shared/source-control/ai/generation/commit-message-ai-types.ts similarity index 94% rename from src/shared/commit-message-ai-types.ts rename to src/shared/source-control/ai/generation/commit-message-ai-types.ts index 457cc68dd7d..7b3987fed57 100644 --- a/src/shared/commit-message-ai-types.ts +++ b/src/shared/source-control/ai/generation/commit-message-ai-types.ts @@ -1,4 +1,4 @@ -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' export type CommitMessageAiModelCapability = { id: string diff --git a/src/shared/commit-message-generation-options.ts b/src/shared/source-control/ai/generation/commit-message-generation-options.ts similarity index 96% rename from src/shared/commit-message-generation-options.ts rename to src/shared/source-control/ai/generation/commit-message-generation-options.ts index e25f9edabdb..5e707add865 100644 --- a/src/shared/commit-message-generation-options.ts +++ b/src/shared/source-control/ai/generation/commit-message-generation-options.ts @@ -1,4 +1,4 @@ -import { findOptionOccurrence } from './command-option-occurrence' +import { findOptionOccurrence } from '../../../command-option-occurrence' import { tokenizeCustomCommandTemplate, type CommandTemplateBackslash diff --git a/src/shared/commit-message-generation.test.ts b/src/shared/source-control/ai/generation/commit-message-generation.test.ts similarity index 100% rename from src/shared/commit-message-generation.test.ts rename to src/shared/source-control/ai/generation/commit-message-generation.test.ts diff --git a/src/shared/commit-message-generation.ts b/src/shared/source-control/ai/generation/commit-message-generation.ts similarity index 92% rename from src/shared/commit-message-generation.ts rename to src/shared/source-control/ai/generation/commit-message-generation.ts index 3531f4ea4f2..16f945fe2b6 100644 --- a/src/shared/commit-message-generation.ts +++ b/src/shared/source-control/ai/generation/commit-message-generation.ts @@ -1,5 +1,6 @@ -import { cleanGeneratedCommitMessage, truncateDiffForPrompt } from './commit-message-prompt' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import { cleanGeneratedCommitMessage } from './commit-message-agent-output' +import { truncateDiffForPrompt } from './commit-message-prompt' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' export type CommitMessageDraftAgent = TuiAgent | 'custom' diff --git a/src/shared/commit-message-host-key.ts b/src/shared/source-control/ai/generation/commit-message-host-key.ts similarity index 98% rename from src/shared/commit-message-host-key.ts rename to src/shared/source-control/ai/generation/commit-message-host-key.ts index 3efc71287bb..d14a476ff66 100644 --- a/src/shared/commit-message-host-key.ts +++ b/src/shared/source-control/ai/generation/commit-message-host-key.ts @@ -1,4 +1,4 @@ -import { getRepoExecutionHostId, parseRoutableExecutionHostId } from './execution-host' +import { getRepoExecutionHostId, parseRoutableExecutionHostId } from '../../../execution-host' export const LOCAL_COMMIT_MESSAGE_HOST_KEY = 'local' export const UNKNOWN_COMMIT_MESSAGE_HOST_KEY = 'unknown' diff --git a/src/shared/commit-message-model-parsers.ts b/src/shared/source-control/ai/generation/commit-message-model-parsers.ts similarity index 97% rename from src/shared/commit-message-model-parsers.ts rename to src/shared/source-control/ai/generation/commit-message-model-parsers.ts index 30b88e82e12..4770f7b5735 100644 --- a/src/shared/commit-message-model-parsers.ts +++ b/src/shared/source-control/ai/generation/commit-message-model-parsers.ts @@ -1,6 +1,6 @@ -import { assertJsonTextStructureWithinLimits } from './json-text-structure-limit' -import { parseClaudeModelList } from './claude-model-list-probe' -import { labelFromModelId } from './model-id-label' +import { assertJsonTextStructureWithinLimits } from '../../../json-text-structure-limit' +import { parseClaudeModelList } from '../../../claude-model-list-probe' +import { labelFromModelId } from '../../../model-id-label' import type { CommitMessageModel, ThinkingLevel } from './commit-message-agent-spec' export const COMMIT_MESSAGE_MODEL_JSON_STRUCTURE_LIMITS = { diff --git a/src/shared/commit-message-omp.spec.ts b/src/shared/source-control/ai/generation/commit-message-omp.spec.ts similarity index 94% rename from src/shared/commit-message-omp.spec.ts rename to src/shared/source-control/ai/generation/commit-message-omp.spec.ts index 7ea90d0c0f6..fa66e320a57 100644 --- a/src/shared/commit-message-omp.spec.ts +++ b/src/shared/source-control/ai/generation/commit-message-omp.spec.ts @@ -1,9 +1,9 @@ import { planCommitMessageGeneration } from './commit-message-plan' -import { getAgentModelProbeSpec } from './agent-model-probe-spec' +import { getAgentModelProbeSpec } from '../../../agent-model-probe-spec' import { describe, expect, it } from 'vitest' -import { getDefaultSettings } from './constants' +import { getDefaultSettings } from '../../../constants' import { getCommitMessageAgentSpec } from './commit-message-agent-spec' -import { resolveSourceControlAiForOperation } from './source-control-ai' +import { resolveSourceControlAiForOperation } from '../source-control-ai-operation-resolution' describe('OMP Source Control AI', () => { it.each(['commitMessage', 'pullRequest', 'branchName'] as const)( diff --git a/src/shared/commit-message-plan-kimi.test.ts b/src/shared/source-control/ai/generation/commit-message-plan-kimi.test.ts similarity index 100% rename from src/shared/commit-message-plan-kimi.test.ts rename to src/shared/source-control/ai/generation/commit-message-plan-kimi.test.ts diff --git a/src/shared/commit-message-plan.test.ts b/src/shared/source-control/ai/generation/commit-message-plan.test.ts similarity index 99% rename from src/shared/commit-message-plan.test.ts rename to src/shared/source-control/ai/generation/commit-message-plan.test.ts index f77d079756d..4a8ac964279 100644 --- a/src/shared/commit-message-plan.test.ts +++ b/src/shared/source-control/ai/generation/commit-message-plan.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { planCommitMessageGeneration } from './commit-message-plan' -import { planAgentBinary } from './agent-launch/startup/agent-command-plan' +import { planAgentBinary } from '../../../agent-launch/startup/agent-command-plan' describe('planCommitMessageGeneration', () => { it('keeps extension-provided Pi models available in generated Git text plans', () => { diff --git a/src/shared/commit-message-plan.ts b/src/shared/source-control/ai/generation/commit-message-plan.ts similarity index 95% rename from src/shared/commit-message-plan.ts rename to src/shared/source-control/ai/generation/commit-message-plan.ts index da8c23810c4..97cfb7f421f 100644 --- a/src/shared/commit-message-plan.ts +++ b/src/shared/source-control/ai/generation/commit-message-plan.ts @@ -1,9 +1,9 @@ import { textGenerationFailure, type TextGenerationFailureFields -} from './text-generation-failure-copy' -import { findOptionOccurrence } from './command-option-occurrence' -import { planAgentBinary } from './agent-launch/startup/agent-command-plan' +} from '../../../text-generation-failure-copy' +import { findOptionOccurrence } from '../../../command-option-occurrence' +import { planAgentBinary } from '../../../agent-launch/startup/agent-command-plan' import type { CommandTemplateBackslash } from './commit-message-prompt' import { @@ -18,9 +18,9 @@ import { planAdditionalAgentArgs, compactRecipeOptions } from './commit-message-generation-options' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' -import { mergeOpenCodeGenerationArgs } from './opencode-generation-command' -import { buildAntigravityGenerationInput } from './antigravity-generation-stream' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' +import { mergeOpenCodeGenerationArgs } from '../../../opencode-generation-command' +import { buildAntigravityGenerationInput } from '../../../antigravity-generation-stream' // Share pure request/prompt-to-spawn validation and argv planning between local main and SSH JSON-RPC generators. diff --git a/src/shared/commit-message-prompt.test.ts b/src/shared/source-control/ai/generation/commit-message-prompt.test.ts similarity index 99% rename from src/shared/commit-message-prompt.test.ts rename to src/shared/source-control/ai/generation/commit-message-prompt.test.ts index 904bc3c0791..6d5b24a6873 100644 --- a/src/shared/commit-message-prompt.test.ts +++ b/src/shared/source-control/ai/generation/commit-message-prompt.test.ts @@ -1,14 +1,16 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { buildCommitPrompt, - cleanGeneratedCommitMessage, - excerptAgentFailureOutput, planCustomCommand, STAGED_DIFF_BYTE_BUDGET, - stripPrefilledReasoningPreamble, tokenizeCustomCommandTemplate, truncateDiffForPrompt } from './commit-message-prompt' +import { + cleanGeneratedCommitMessage, + excerptAgentFailureOutput, + stripPrefilledReasoningPreamble +} from './commit-message-agent-output' afterEach(() => { vi.restoreAllMocks() diff --git a/src/shared/commit-message-prompt.ts b/src/shared/source-control/ai/generation/commit-message-prompt.ts similarity index 97% rename from src/shared/commit-message-prompt.ts rename to src/shared/source-control/ai/generation/commit-message-prompt.ts index 5672e9f00b5..f6c8ead8260 100644 --- a/src/shared/commit-message-prompt.ts +++ b/src/shared/source-control/ai/generation/commit-message-prompt.ts @@ -1,4 +1,4 @@ -import { extractLeadingEnvAssignments } from './command-environment' +import { extractLeadingEnvAssignments } from '../../../command-environment' // Share prompt wording between renderer preview/tests and main generation. const COMMIT_MESSAGE_BASE_PROMPT = `You are generating a single git commit message. @@ -16,13 +16,6 @@ Staged diff: \`\`\` ` -export { - cleanGeneratedCommitMessage, - excerptAgentFailureOutput, - sanitizeAgentFailureDetail, - stripPrefilledReasoningPreamble -} from './commit-message-agent-output' - /** Append custom suffix verbatim so user style instructions can override defaults. */ export function buildCommitPrompt(diff: string, customSuffix: string): string { const base = COMMIT_MESSAGE_BASE_PROMPT.replace('{{DIFF}}', diff) diff --git a/src/shared/conversation-name-generation.test.ts b/src/shared/source-control/ai/generation/conversation-name-generation.test.ts similarity index 100% rename from src/shared/conversation-name-generation.test.ts rename to src/shared/source-control/ai/generation/conversation-name-generation.test.ts diff --git a/src/shared/conversation-name-generation.ts b/src/shared/source-control/ai/generation/conversation-name-generation.ts similarity index 92% rename from src/shared/conversation-name-generation.ts rename to src/shared/source-control/ai/generation/conversation-name-generation.ts index 41fbbf70672..abbcf7a4f4d 100644 --- a/src/shared/conversation-name-generation.ts +++ b/src/shared/source-control/ai/generation/conversation-name-generation.ts @@ -1,7 +1,7 @@ -import { normalizeAgentSessionConversationName } from './agent-session/agent-session-conversation-name' +import { normalizeAgentSessionConversationName } from '../../../agent-session/agent-session-conversation-name' import { cleanGeneratedCommitMessage } from './commit-message-agent-output' -import { sliceAtCodeUnitLimit } from './surrogate-safe-text-slice' -import { renderSourceControlActionCommandTemplate } from './source-control-ai-actions' +import { sliceAtCodeUnitLimit } from '../../../surrogate-safe-text-slice' +import { renderSourceControlActionCommandTemplate } from '../recipes/source-control-ai-actions' export type ConversationNameContext = { firstPrompt: string } diff --git a/src/shared/pull-request-generation.test.ts b/src/shared/source-control/ai/generation/pull-request-generation.test.ts similarity index 100% rename from src/shared/pull-request-generation.test.ts rename to src/shared/source-control/ai/generation/pull-request-generation.test.ts diff --git a/src/shared/pull-request-generation.ts b/src/shared/source-control/ai/generation/pull-request-generation.ts similarity index 97% rename from src/shared/pull-request-generation.ts rename to src/shared/source-control/ai/generation/pull-request-generation.ts index 3cc0930410a..3ea4a6164c1 100644 --- a/src/shared/pull-request-generation.ts +++ b/src/shared/source-control/ai/generation/pull-request-generation.ts @@ -1,6 +1,6 @@ import { truncateDiffForPrompt } from './commit-message-prompt' -import { assertJsonTextStructureWithinLimits } from './json-text-structure-limit' -import type { HostedReviewProvider } from './hosted-review' +import { assertJsonTextStructureWithinLimits } from '../../../json-text-structure-limit' +import type { HostedReviewProvider } from '../../hosted-review/hosted-review-contracts' export const GENERATED_PULL_REQUEST_JSON_STRUCTURE_LIMITS = { structuralTokens: 64, diff --git a/src/shared/branch-name-from-work.test.ts b/src/shared/source-control/ai/naming/branch-name-from-work.test.ts similarity index 100% rename from src/shared/branch-name-from-work.test.ts rename to src/shared/source-control/ai/naming/branch-name-from-work.test.ts diff --git a/src/shared/branch-name-from-work.ts b/src/shared/source-control/ai/naming/branch-name-from-work.ts similarity index 98% rename from src/shared/branch-name-from-work.ts rename to src/shared/source-control/ai/naming/branch-name-from-work.ts index c69f33017bb..5660ff70db8 100644 --- a/src/shared/branch-name-from-work.ts +++ b/src/shared/source-control/ai/naming/branch-name-from-work.ts @@ -1,4 +1,4 @@ -import { MARINE_CREATURES } from './marine-creatures' +import { MARINE_CREATURES } from '../../../marine-creatures' // Bound generated leaves after generation; leave prompts general so user naming instructions own style. export const MAX_BRANCH_NAME_WORDS = 4 diff --git a/src/shared/omp-source-control-discovery.spec.ts b/src/shared/source-control/ai/omp-source-control-discovery.spec.ts similarity index 89% rename from src/shared/omp-source-control-discovery.spec.ts rename to src/shared/source-control/ai/omp-source-control-discovery.spec.ts index 1a6d54c9a40..ef287e5594b 100644 --- a/src/shared/omp-source-control-discovery.spec.ts +++ b/src/shared/source-control/ai/omp-source-control-discovery.spec.ts @@ -1,10 +1,8 @@ import { describe, expect, it } from 'vitest' -import { getDefaultSettings } from './constants' -import { getCommitMessageAgentSpec } from './commit-message-agent-spec' -import { - resolveSourceControlAiForOperation, - normalizeSourceControlAiSettings -} from './source-control-ai' +import { getDefaultSettings } from '../../constants' +import { getCommitMessageAgentSpec } from './generation/commit-message-agent-spec' +import { resolveSourceControlAiForOperation } from './source-control-ai-operation-resolution' +import { normalizeSourceControlAiSettings } from './settings/source-control-ai-settings' for (const hostKey of ['local', 'ssh:omp-host']) { describe(`OMP discovery preserves generation choices on ${hostKey}`, () => { diff --git a/src/shared/source-control-action-argument-choices.ts b/src/shared/source-control/ai/recipes/source-control-action-argument-choices.ts similarity index 92% rename from src/shared/source-control-action-argument-choices.ts rename to src/shared/source-control/ai/recipes/source-control-action-argument-choices.ts index db41cc79ae9..ff8ce26d5f0 100644 --- a/src/shared/source-control-action-argument-choices.ts +++ b/src/shared/source-control/ai/recipes/source-control-action-argument-choices.ts @@ -1,17 +1,17 @@ import { editActionArgumentChoicePreferences } from './source-control-action-choice-preferences' -export { editActionArgumentChoicePreferences } from './source-control-action-choice-preferences' -import { reconcileAgentChoiceArgsDetailed } from './agent-launch/choices/agent-choice-reconciliation' + +import { reconcileAgentChoiceArgsDetailed } from '../../../agent-launch/choices/agent-choice-reconciliation' import type { AgentChoicePatch, AgentDedicatedChoices -} from './agent-launch/choices/agent-launch-choices' +} from '../../../agent-launch/choices/agent-launch-choices' import { actionModelSelectionChoices, normalizeActionModelSelection, readActionModelSelection } from './source-control-action-model-selection' -import { isTuiAgent } from './agent-launch/catalog/tui-agent-config' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import { isTuiAgent } from '../../../agent-launch/catalog/tui-agent-config' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' import type { ActionModelSelection, SourceControlActionRecipe } from './source-control-ai-actions' import { @@ -20,17 +20,6 @@ import { readActionArgumentNode, demoteActionArgumentChoices } from './source-control-action-argument-document' -export type { ActionArgumentChoices } from './source-control-action-argument-document' -export { - lowerActionArgumentChoices, - trimActionArgumentDocument, - readActionArgumentNode, - normalizeActionArgumentDocument, - lowerActionArgumentNodes, - actionArgumentChoicesValue, - transportActionArgumentChoices, - demoteActionArgumentChoices -} from './source-control-action-argument-document' function actionCutOffset( text: string, diff --git a/src/shared/source-control-action-argument-document.ts b/src/shared/source-control/ai/recipes/source-control-action-argument-document.ts similarity index 91% rename from src/shared/source-control-action-argument-document.ts rename to src/shared/source-control/ai/recipes/source-control-action-argument-document.ts index c1ad711e4b8..8b67076205d 100644 --- a/src/shared/source-control-action-argument-document.ts +++ b/src/shared/source-control/ai/recipes/source-control-action-argument-document.ts @@ -1,10 +1,10 @@ -import { analyzeAgentChoiceArgs } from './agent-launch/choices/agent-choice-args' -import { reconcileAgentChoiceArgsDetailed } from './agent-launch/choices/agent-choice-reconciliation' -import type { AgentDedicatedChoices } from './agent-launch/choices/agent-launch-choices' -import { PERMISSION_LAUNCH_GRAMMARS } from './agent-launch/permissions/agent-permission-args' -import { tokenizeStartupCommand } from './agent-launch/startup/tui-agent-startup-shell' -import { isTuiAgent } from './agent-launch/catalog/tui-agent-config' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import { analyzeAgentChoiceArgs } from '../../../agent-launch/choices/agent-choice-args' +import { reconcileAgentChoiceArgsDetailed } from '../../../agent-launch/choices/agent-choice-reconciliation' +import type { AgentDedicatedChoices } from '../../../agent-launch/choices/agent-launch-choices' +import { PERMISSION_LAUNCH_GRAMMARS } from '../../../agent-launch/permissions/agent-permission-args' +import { tokenizeStartupCommand } from '../../../agent-launch/startup/tui-agent-startup-shell' +import { isTuiAgent } from '../../../agent-launch/catalog/tui-agent-config' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' import type { SourceControlActionRecipe } from './source-control-ai-actions' export type ActionArgumentChoices = { diff --git a/src/shared/source-control-action-choice-preferences.ts b/src/shared/source-control/ai/recipes/source-control-action-choice-preferences.ts similarity index 93% rename from src/shared/source-control-action-choice-preferences.ts rename to src/shared/source-control/ai/recipes/source-control-action-choice-preferences.ts index 4a18732a21c..691a864efa4 100644 --- a/src/shared/source-control-action-choice-preferences.ts +++ b/src/shared/source-control/ai/recipes/source-control-action-choice-preferences.ts @@ -1,12 +1,12 @@ import type { AgentChoicePatch, AgentDedicatedChoices -} from './agent-launch/choices/agent-launch-choices' +} from '../../../agent-launch/choices/agent-launch-choices' import { normalizeActionModelSelection, readActionModelSelection } from './source-control-action-model-selection' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' import type { ActionModelSelection, SourceControlActionRecipe } from './source-control-ai-actions' /** Fold accepted choice effects into this recipe owner without rewriting another source. */ diff --git a/src/shared/source-control-action-launch-preferences.ts b/src/shared/source-control/ai/recipes/source-control-action-launch-preferences.ts similarity index 90% rename from src/shared/source-control-action-launch-preferences.ts rename to src/shared/source-control/ai/recipes/source-control-action-launch-preferences.ts index 277e7d50e79..bb1a64469ec 100644 --- a/src/shared/source-control-action-launch-preferences.ts +++ b/src/shared/source-control/ai/recipes/source-control-action-launch-preferences.ts @@ -1,9 +1,9 @@ -import { projectAgentLaunchInputViews } from './agent-launch/choices/agent-launch-profile' -import { reconcileAgentChoiceArgsDetailed } from './agent-launch/choices/agent-choice-reconciliation' +import { projectAgentLaunchInputViews } from '../../../agent-launch/choices/agent-launch-profile' +import { reconcileAgentChoiceArgsDetailed } from '../../../agent-launch/choices/agent-choice-reconciliation' import type { AgentDedicatedChoices, AgentLaunchInputViews -} from './agent-launch/choices/agent-launch-choices' +} from '../../../agent-launch/choices/agent-launch-choices' import { sourceControlActionRecipeEntry, type SelectedSourceControlActionRecipe @@ -12,30 +12,23 @@ import { readActionArgumentNode, lowerActionArgumentNodes, lowerActionArgumentChoices -} from './source-control-action-argument-choices' +} from './source-control-action-argument-document' import { actionModelSelectionChoices } from './source-control-action-model-selection' -import { normalizeAgentModelOptionChoices } from './agent-launch/choices/agent-launch-choices' -import type { ExecutionHostId } from './execution-host' +import { normalizeAgentModelOptionChoices } from '../../../agent-launch/choices/agent-launch-choices' +import type { ExecutionHostId } from '../../../execution-host' import { resolveTuiAgentLaunchRawArgs, type AgentLaunchProfileSettings -} from './agent-launch/choices/tui-agent-launch-defaults' -import { getAgentSessionOptionLaunchCatalog } from './agent-session/options/agent-session-option-catalog' +} from '../../../agent-launch/choices/tui-agent-launch-defaults' +import { getAgentSessionOptionLaunchCatalog } from '../../../agent-session/options/agent-session-option-catalog' import { renderSourceControlActionCommandTemplate, type SourceControlActionRecipe } from './source-control-ai-actions' -import { isTuiAgent } from './agent-launch/catalog/tui-agent-config' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' -import { AGENT_CHAT_PERMISSION_MODE_OPTION_ID } from './agent-launch/permissions/agent-chat-permission-mode' -import { agentPermissionChoices } from './agent-launch/permissions/tui-agent-permission-choice' - -export { - sourceControlActionAgentPicksModel, - sourceControlActionPermissionModeRoute, - sourceControlActionOptions, - type SourceControlActionChoiceRoute -} from './source-control-action-options' +import { isTuiAgent } from '../../../agent-launch/catalog/tui-agent-config' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' +import { AGENT_CHAT_PERMISSION_MODE_OPTION_ID } from '../../../agent-launch/permissions/agent-chat-permission-mode' +import { agentPermissionChoices } from '../../../agent-launch/permissions/tui-agent-permission-choice' /** The selected action group's typed inputs; the host composes them with actual raw Args. */ export function sourceControlActionLaunchOptions( diff --git a/src/shared/source-control-action-model-selection.ts b/src/shared/source-control/ai/recipes/source-control-action-model-selection.ts similarity index 93% rename from src/shared/source-control-action-model-selection.ts rename to src/shared/source-control/ai/recipes/source-control-action-model-selection.ts index 8e4f88ae30d..85612b549a8 100644 --- a/src/shared/source-control-action-model-selection.ts +++ b/src/shared/source-control/ai/recipes/source-control-action-model-selection.ts @@ -1,10 +1,10 @@ import { normalizeAgentModelOptionChoices, type AgentDedicatedChoices -} from './agent-launch/choices/agent-launch-choices' -import { agentPermissionChoices } from './agent-launch/permissions/tui-agent-permission-choice' -import { isTuiAgent } from './agent-launch/catalog/tui-agent-config' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +} from '../../../agent-launch/choices/agent-launch-choices' +import { agentPermissionChoices } from '../../../agent-launch/permissions/tui-agent-permission-choice' +import { isTuiAgent } from '../../../agent-launch/catalog/tui-agent-config' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' import type { ActionChoiceValue, ActionModelSelection, diff --git a/src/shared/source-control-action-options.ts b/src/shared/source-control/ai/recipes/source-control-action-options.ts similarity index 77% rename from src/shared/source-control-action-options.ts rename to src/shared/source-control/ai/recipes/source-control-action-options.ts index 0344d97a218..7e81ba8059d 100644 --- a/src/shared/source-control-action-options.ts +++ b/src/shared/source-control/ai/recipes/source-control-action-options.ts @@ -1,17 +1,17 @@ -import type { TuiAgent } from './agent-launch/catalog/tui-agent' -import { isTuiAgent } from './agent-launch/catalog/tui-agent-config' -import { isAgentSessionHandleProvider } from './agent-session/lifecycle/agent-session-provider-handle' -import { STRUCTURED_LAUNCH_SEED_OPTION_IDS } from './native-chat/input/native-chat-session-option-defaults' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' +import { isTuiAgent } from '../../../agent-launch/catalog/tui-agent-config' +import { isAgentSessionHandleProvider } from '../../../agent-session/lifecycle/agent-session-provider-handle' +import { STRUCTURED_LAUNCH_SEED_OPTION_IDS } from '../../../native-chat/input/native-chat-session-option-defaults' import { findCatalogModel, getAgentSessionOptionLaunchCatalog, getAgentSessionOptionCatalog -} from './agent-session/options/agent-session-option-catalog' -import type { CatalogOption } from './agent-session/options/agent-session-option-catalog-types' +} from '../../../agent-session/options/agent-session-option-catalog' +import type { CatalogOption } from '../../../agent-session/options/agent-session-option-catalog-types' import { agentPermissionHasTerminalChoice, type AgentPermissionChoice -} from './agent-launch/permissions/tui-agent-permission-choice' +} from '../../../agent-launch/permissions/tui-agent-permission-choice' /** Agents whose model an action can pick: the ones whose session catalog lists models. */ export function sourceControlActionAgentPicksModel( diff --git a/src/shared/source-control-action-permission-lift.ts b/src/shared/source-control/ai/recipes/source-control-action-permission-lift.ts similarity index 84% rename from src/shared/source-control-action-permission-lift.ts rename to src/shared/source-control/ai/recipes/source-control-action-permission-lift.ts index 6ea65314fd9..bd5b00b5f7a 100644 --- a/src/shared/source-control-action-permission-lift.ts +++ b/src/shared/source-control/ai/recipes/source-control-action-permission-lift.ts @@ -1,15 +1,13 @@ -import { isTuiAgent } from './agent-launch/catalog/tui-agent-config' -import { - normalizeActionArgumentDocument, - reconcileActionArgumentDocument -} from './source-control-action-argument-choices' +import { isTuiAgent } from '../../../agent-launch/catalog/tui-agent-config' +import { normalizeActionArgumentDocument } from './source-control-action-argument-document' +import { reconcileActionArgumentDocument } from './source-control-action-argument-choices' import { SOURCE_CONTROL_LAUNCH_ACTION_IDS, canonicalActionLaunchPreferences, type AiActionId, type SourceControlActionRecipe } from './source-control-ai-actions' -import type { RepoSourceControlAiOverrides } from './source-control-ai-types' +import type { RepoSourceControlAiOverrides } from '../settings/source-control-ai-settings-types' type PermissionRecipe = Pick< SourceControlActionRecipe, diff --git a/src/shared/source-control-action-selection.ts b/src/shared/source-control/ai/recipes/source-control-action-selection.ts similarity index 97% rename from src/shared/source-control-action-selection.ts rename to src/shared/source-control/ai/recipes/source-control-action-selection.ts index bf076df0a97..9577717fc70 100644 --- a/src/shared/source-control-action-selection.ts +++ b/src/shared/source-control/ai/recipes/source-control-action-selection.ts @@ -4,18 +4,20 @@ import type { } from './source-control-ai-actions' import { actionArgumentChoicesValue, - reconcileActionArgumentDocumentTransaction, - retireActionArgumentModelSelection, demoteActionArgumentChoices, readActionArgumentNode, transportActionArgumentChoices +} from './source-control-action-argument-document' +import { + reconcileActionArgumentDocumentTransaction, + retireActionArgumentModelSelection } from './source-control-action-argument-choices' import { actionModelSelectionChoices, readActionModelSelection } from './source-control-action-model-selection' -import { isTuiAgent } from './agent-launch/catalog/tui-agent-config' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import { isTuiAgent } from '../../../agent-launch/catalog/tui-agent-config' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' type CurrentActionSource = { authoredAgentId: SourceControlActionRecipe['agentId'] diff --git a/src/shared/source-control-ai-action-recipes.test.ts b/src/shared/source-control/ai/recipes/source-control-ai-action-recipes.test.ts similarity index 96% rename from src/shared/source-control-ai-action-recipes.test.ts rename to src/shared/source-control/ai/recipes/source-control-ai-action-recipes.test.ts index 7ea6cefd2b7..aece2688639 100644 --- a/src/shared/source-control-ai-action-recipes.test.ts +++ b/src/shared/source-control/ai/recipes/source-control-ai-action-recipes.test.ts @@ -5,18 +5,16 @@ import { projectSourceControlActionLaunch, sourceControlActionLaunchOptions } from './source-control-action-launch-preferences' -import { saveSourceControlActionRecipe } from './source-control-ai-recipe-save' +import { saveSourceControlActionRecipe } from '../settings/source-control-ai-recipe-save' import { describe, expect, it } from 'vitest' -import { getDefaultSettings } from './constants' -import { - mergeLegacyCommitMessageAiIntoSourceControlAi, - projectSourceControlAiToLegacyCommitMessageAi, - resolveSourceControlActionRecipe, - resolveSourceControlAiForOperation -} from './source-control-ai' -import type { GlobalSettings } from './global-settings-types' +import { getDefaultSettings } from '../../../constants' +import { mergeLegacyCommitMessageAiIntoSourceControlAi } from '../settings/source-control-ai-legacy-reconciliation' +import { projectSourceControlAiToLegacyCommitMessageAi } from '../settings/source-control-ai-legacy-projection' +import { resolveSourceControlActionRecipe } from '../source-control-ai-operation-policy' +import { resolveSourceControlAiForOperation } from '../source-control-ai-operation-resolution' +import type { GlobalSettings } from '../../../global-settings-types' import type { SourceControlActionRecipe } from './source-control-ai-actions' -import type { RepoSourceControlAiOverrides } from './source-control-ai-types' +import type { RepoSourceControlAiOverrides } from '../settings/source-control-ai-settings-types' type RepoActionOverride = NonNullable< NonNullable['fixChecks'] diff --git a/src/shared/source-control-ai-action-variables.spec.ts b/src/shared/source-control/ai/recipes/source-control-ai-action-variables.spec.ts similarity index 95% rename from src/shared/source-control-ai-action-variables.spec.ts rename to src/shared/source-control/ai/recipes/source-control-ai-action-variables.spec.ts index 07ef41a85e3..8d07f7c94d7 100644 --- a/src/shared/source-control-ai-action-variables.spec.ts +++ b/src/shared/source-control/ai/recipes/source-control-ai-action-variables.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { CommitMessageDraftContext } from './commit-message-generation' +import type { CommitMessageDraftContext } from '../generation/commit-message-generation' import { formatLinkedIssueTemplateValue, withLinkedIssueDraftContext diff --git a/src/shared/source-control-ai-action-variables.ts b/src/shared/source-control/ai/recipes/source-control-ai-action-variables.ts similarity index 100% rename from src/shared/source-control-ai-action-variables.ts rename to src/shared/source-control/ai/recipes/source-control-ai-action-variables.ts diff --git a/src/shared/source-control-ai-actions.test.ts b/src/shared/source-control/ai/recipes/source-control-ai-actions.test.ts similarity index 100% rename from src/shared/source-control-ai-actions.test.ts rename to src/shared/source-control/ai/recipes/source-control-ai-actions.test.ts diff --git a/src/shared/source-control-ai-actions.ts b/src/shared/source-control/ai/recipes/source-control-ai-actions.ts similarity index 95% rename from src/shared/source-control-ai-actions.ts rename to src/shared/source-control/ai/recipes/source-control-ai-actions.ts index 962137af15e..85e48ae8e55 100644 --- a/src/shared/source-control-ai-actions.ts +++ b/src/shared/source-control/ai/recipes/source-control-ai-actions.ts @@ -3,17 +3,16 @@ import { trimActionArgumentDocument, demoteActionArgumentChoices, type ActionArgumentChoices -} from './source-control-action-argument-choices' -import { isCustomAgentId, type CustomAgentId } from './commit-message-agent-spec' -import { isTuiAgent } from './agent-launch/catalog/tui-agent-config' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' -import type { AgentPermissionChoice } from './agent-launch/permissions/tui-agent-permission-choice' +} from './source-control-action-argument-document' +import { isCustomAgentId, type CustomAgentId } from '../generation/commit-message-agent-spec' +import { isTuiAgent } from '../../../agent-launch/catalog/tui-agent-config' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' +import type { AgentPermissionChoice } from '../../../agent-launch/permissions/tui-agent-permission-choice' import { isRecord, normalizeSourceControlActionLaunchPreferences, readActionModelSelection } from './source-control-action-model-selection' -export { normalizeSourceControlActionLaunchPreferences } from './source-control-action-model-selection' // Keep the variable registry separate for max-lines headroom; no re-export so consumer searches stay complete. diff --git a/src/shared/source-control-ai-argument-flags.test.ts b/src/shared/source-control/ai/recipes/source-control-ai-argument-flags.test.ts similarity index 97% rename from src/shared/source-control-ai-argument-flags.test.ts rename to src/shared/source-control/ai/recipes/source-control-ai-argument-flags.test.ts index e91d9402ec5..1363f292ed2 100644 --- a/src/shared/source-control-ai-argument-flags.test.ts +++ b/src/shared/source-control/ai/recipes/source-control-ai-argument-flags.test.ts @@ -1,5 +1,8 @@ import { expect, it } from 'vitest' -import { COMMIT_MESSAGE_AGENT_SPECS, listCommitMessageAgentIds } from './commit-message-agent-spec' +import { + COMMIT_MESSAGE_AGENT_SPECS, + listCommitMessageAgentIds +} from '../generation/commit-message-agent-spec' import { removeSourceControlAiArgumentFlag } from './source-control-ai-argument-flags' it('removes each text CLI model/effort spelling without changing unrelated Arguments', () => { diff --git a/src/shared/source-control-ai-argument-flags.ts b/src/shared/source-control/ai/recipes/source-control-ai-argument-flags.ts similarity index 84% rename from src/shared/source-control-ai-argument-flags.ts rename to src/shared/source-control/ai/recipes/source-control-ai-argument-flags.ts index fc25450d800..3e84dfd1b7d 100644 --- a/src/shared/source-control-ai-argument-flags.ts +++ b/src/shared/source-control/ai/recipes/source-control-ai-argument-flags.ts @@ -1,11 +1,11 @@ -import type { CommitMessageAgentSpec } from './commit-message-agent-spec' -import { findOptionOccurrence } from './command-option-occurrence' -import { agentRequiredValueOptions } from './agent-session/options/agent-session-option-agent-args' -import { KIMI_VALUE_OPTIONS } from './commit-message-generation-options' +import type { CommitMessageAgentSpec } from '../generation/commit-message-agent-spec' +import { findOptionOccurrence } from '../../../command-option-occurrence' +import { agentRequiredValueOptions } from '../../../agent-session/options/agent-session-option-agent-args' +import { KIMI_VALUE_OPTIONS } from '../generation/commit-message-generation-options' import { tokenizeCustomCommandTemplate, type CommandTemplateBackslash -} from './commit-message-prompt' +} from '../generation/commit-message-prompt' /** Remove only proven flag spans so unrelated arguments retain their spelling and quoting. */ export function removeSourceControlAiArgumentFlag( diff --git a/src/shared/source-control-ai-command-template.ts b/src/shared/source-control/ai/recipes/source-control-ai-command-template.ts similarity index 89% rename from src/shared/source-control-ai-command-template.ts rename to src/shared/source-control/ai/recipes/source-control-ai-command-template.ts index 8597cc1d4a9..b8df9d6a9d7 100644 --- a/src/shared/source-control-ai-command-template.ts +++ b/src/shared/source-control/ai/recipes/source-control-ai-command-template.ts @@ -1,12 +1,19 @@ -import { CUSTOM_AGENT_ID, isCustomAgentId, type CustomAgentId } from './commit-message-agent-spec' -import type { CommitMessageAiSettings } from './commit-message-ai-types' +import { + CUSTOM_AGENT_ID, + isCustomAgentId, + type CustomAgentId +} from '../generation/commit-message-agent-spec' +import type { CommitMessageAiSettings } from '../generation/commit-message-ai-types' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, readSourceControlActionDefault, type SourceControlActionRecipe } from './source-control-ai-actions' -import type { AiTextOperation, SourceControlAiSettings } from './source-control-ai-types' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import type { + AiTextOperation, + SourceControlAiSettings +} from '../settings/source-control-ai-settings-types' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' export function commandTemplateFromInstruction(instruction: string | null | undefined): string { const trimmed = instruction?.trim() diff --git a/src/shared/source-control-ai-action-model-choice.ts b/src/shared/source-control/ai/settings/source-control-ai-action-model-choice.ts similarity index 91% rename from src/shared/source-control-ai-action-model-choice.ts rename to src/shared/source-control/ai/settings/source-control-ai-action-model-choice.ts index 85da4d87909..bc3469173e6 100644 --- a/src/shared/source-control-ai-action-model-choice.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-action-model-choice.ts @@ -1,17 +1,20 @@ -import { getCommitMessageAgentSpec } from './commit-message-agent-spec' -import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from './commit-message-host-key' -import { removeSourceControlAiArgumentFlag } from './source-control-ai-argument-flags' +import { getCommitMessageAgentSpec } from '../generation/commit-message-agent-spec' +import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../generation/commit-message-host-key' +import { removeSourceControlAiArgumentFlag } from '../recipes/source-control-ai-argument-flags' import { normalizeSourceControlAiSettings } from './source-control-ai-settings' import type { SourceControlAiWriteTarget, SourceControlActionRecipeSaveResult } from './source-control-ai-recipe-save' import { toSourceControlAiRepoUpdate } from './source-control-ai-recipe-save' -import type { GlobalSettings } from './global-settings-types' -import type { Repo } from './repo-types' -import type { AiTextOperation, SourceControlAiModelChoice } from './source-control-ai-types' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' -import type { CommandTemplateBackslash } from './commit-message-prompt' +import type { GlobalSettings } from '../../../global-settings-types' +import type { Repo } from '../../../repo-types' +import type { + AiTextOperation, + SourceControlAiModelChoice +} from './source-control-ai-settings-types' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' +import type { CommandTemplateBackslash } from '../generation/commit-message-prompt' type ActionModelChoiceInput = { target: SourceControlAiWriteTarget diff --git a/src/shared/source-control-ai-action-model-edits.test.ts b/src/shared/source-control/ai/settings/source-control-ai-action-model-edits.test.ts similarity index 95% rename from src/shared/source-control-ai-action-model-edits.test.ts rename to src/shared/source-control/ai/settings/source-control-ai-action-model-edits.test.ts index 02e46cc2a0b..cc85109c26a 100644 --- a/src/shared/source-control-ai-action-model-edits.test.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-action-model-edits.test.ts @@ -6,10 +6,10 @@ import { type SourceControlAiModelEdit, type SourceControlAiModelEdits } from './source-control-ai-action-model-edits' -import type { GlobalSettings } from './global-settings-types' +import type { GlobalSettings } from '../../../global-settings-types' import { getDefaultSourceControlAiSettings } from './source-control-ai-settings' -import type { SourceControlAiModelChoice } from './source-control-ai-types' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import type { SourceControlAiModelChoice } from './source-control-ai-settings-types' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' type Edit = { agentId: TuiAgent; change: SourceControlAiModelEdit } diff --git a/src/shared/source-control-ai-action-model-edits.ts b/src/shared/source-control/ai/settings/source-control-ai-action-model-edits.ts similarity index 90% rename from src/shared/source-control-ai-action-model-edits.ts rename to src/shared/source-control/ai/settings/source-control-ai-action-model-edits.ts index d467f090a51..cc6fee1adce 100644 --- a/src/shared/source-control-ai-action-model-edits.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-action-model-edits.ts @@ -3,10 +3,13 @@ import { sourceControlAiModelChoiceHostKeys } from './source-control-ai-action-model-choice' import type { SourceControlAiWriteTarget } from './source-control-ai-recipe-save' -import type { GlobalSettings } from './global-settings-types' -import type { Repo } from './repo-types' -import type { AiTextOperation, SourceControlAiModelChoice } from './source-control-ai-types' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import type { GlobalSettings } from '../../../global-settings-types' +import type { Repo } from '../../../repo-types' +import type { + AiTextOperation, + SourceControlAiModelChoice +} from './source-control-ai-settings-types' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' export type SourceControlAiModelEdit = | { field: 'model'; value: string | undefined } diff --git a/src/shared/source-control-ai-legacy-projection.ts b/src/shared/source-control/ai/settings/source-control-ai-legacy-projection.ts similarity index 88% rename from src/shared/source-control-ai-legacy-projection.ts rename to src/shared/source-control/ai/settings/source-control-ai-legacy-projection.ts index 64f505b894d..3f3ab41e66e 100644 --- a/src/shared/source-control-ai-legacy-projection.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-legacy-projection.ts @@ -1,11 +1,11 @@ -import type { CommitMessageAiSettings } from './commit-message-ai-types' -import { readSourceControlActionDefault } from './source-control-ai-actions' +import type { CommitMessageAiSettings } from '../generation/commit-message-ai-types' +import { readSourceControlActionDefault } from '../recipes/source-control-ai-actions' import { hasActionAgentRecipe, legacyPromptFromCommandTemplate -} from './source-control-ai-command-template' +} from '../recipes/source-control-ai-command-template' import { mergeSelectedModelByAgentByHost } from './source-control-ai-model-selection' -import type { SourceControlAiSettings } from './source-control-ai-types' +import type { SourceControlAiSettings } from './source-control-ai-settings-types' export function projectSourceControlAiToLegacyCommitMessageAi( sourceControlAi: SourceControlAiSettings, diff --git a/src/shared/source-control-ai-legacy-reconciliation.ts b/src/shared/source-control/ai/settings/source-control-ai-legacy-reconciliation.ts similarity index 96% rename from src/shared/source-control-ai-legacy-reconciliation.ts rename to src/shared/source-control/ai/settings/source-control-ai-legacy-reconciliation.ts index 20aad78126c..cf77c899feb 100644 --- a/src/shared/source-control-ai-legacy-reconciliation.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-legacy-reconciliation.ts @@ -1,15 +1,18 @@ -import type { CommitMessageAiSettings } from './commit-message-ai-types' +import type { CommitMessageAiSettings } from '../generation/commit-message-ai-types' import { actionRecipeFromLegacyCommitMessageAi, applyLegacyAgentToActionRecipe, commandTemplateFromOperationInstruction, shouldImportLegacyBranchAgent, shouldImportLegacyBranchPrompt -} from './source-control-ai-command-template' +} from '../recipes/source-control-ai-command-template' import { projectSourceControlAiToLegacyCommitMessageAi } from './source-control-ai-legacy-projection' import { normalizeSourceControlAiSettings } from './source-control-ai-settings' -import type { SourceControlAiModelChoice, SourceControlAiSettings } from './source-control-ai-types' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import type { + SourceControlAiModelChoice, + SourceControlAiSettings +} from './source-control-ai-settings-types' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' type LegacyCoreChanges = Record< 'enabled' | 'agentId' | 'customPrompt' | 'customAgentCommand', diff --git a/src/shared/source-control-ai-model-selection.ts b/src/shared/source-control/ai/settings/source-control-ai-model-selection.ts similarity index 96% rename from src/shared/source-control-ai-model-selection.ts rename to src/shared/source-control/ai/settings/source-control-ai-model-selection.ts index d347fca7063..fe9262214fb 100644 --- a/src/shared/source-control-ai-model-selection.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-model-selection.ts @@ -1,15 +1,15 @@ import type { CommitMessageAiSettings, CommitMessageAiModelCapability -} from './commit-message-ai-types' -import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from './commit-message-host-key' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +} from '../generation/commit-message-ai-types' +import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from '../generation/commit-message-host-key' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' import type { RepoSourceControlAiOverrides, SourceControlAiModelChoice, AiTextOperation, SourceControlAiSettings -} from './source-control-ai-types' +} from './source-control-ai-settings-types' export function readSourceControlAiModelChoiceForHost( choice: SourceControlAiModelChoice | null | undefined, diff --git a/src/shared/source-control-ai-recipe-save.test.ts b/src/shared/source-control/ai/settings/source-control-ai-recipe-save.test.ts similarity index 96% rename from src/shared/source-control-ai-recipe-save.test.ts rename to src/shared/source-control/ai/settings/source-control-ai-recipe-save.test.ts index a7dad04d217..6bc7dd4701c 100644 --- a/src/shared/source-control-ai-recipe-save.test.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-recipe-save.test.ts @@ -1,20 +1,20 @@ import { saveSourceControlAiActionModelChoice } from './source-control-ai-action-model-choice' import { describe, expect, it } from 'vitest' -import { getDefaultSettings } from './constants' +import { getDefaultSettings } from '../../../constants' import { saveSourceControlActionRecipe, toSourceControlAiRepoUpdate } from './source-control-ai-recipe-save' import { getDefaultSourceControlAiSettings, - mergeLegacyCommitMessageAiIntoSourceControlAi, - normalizeSourceControlAiSettings, - projectSourceControlAiToLegacyCommitMessageAi, - resolveSourceControlAiForOperation -} from './source-control-ai' -import type { GlobalSettings } from './global-settings-types' -import type { SourceControlAiSettings } from './source-control-ai-types' -import type { Repo } from './repo-types' + normalizeSourceControlAiSettings +} from './source-control-ai-settings' +import { mergeLegacyCommitMessageAiIntoSourceControlAi } from './source-control-ai-legacy-reconciliation' +import { projectSourceControlAiToLegacyCommitMessageAi } from './source-control-ai-legacy-projection' +import { resolveSourceControlAiForOperation } from '../source-control-ai-operation-resolution' +import type { GlobalSettings } from '../../../global-settings-types' +import type { SourceControlAiSettings } from './source-control-ai-settings-types' +import type { Repo } from '../../../repo-types' function settings(): GlobalSettings { const base = getDefaultSettings('/tmp') diff --git a/src/shared/source-control-ai-recipe-save.ts b/src/shared/source-control/ai/settings/source-control-ai-recipe-save.ts similarity index 92% rename from src/shared/source-control-ai-recipe-save.ts rename to src/shared/source-control/ai/settings/source-control-ai-recipe-save.ts index 45fcfc590c8..dbc3106e3fc 100644 --- a/src/shared/source-control-ai-recipe-save.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-recipe-save.ts @@ -1,26 +1,24 @@ -import { sourceControlActionRecipeEntry } from './source-control-action-selection' -import { trimActionArgumentDocument } from './source-control-action-argument-choices' -import { demoteDisplacedActionArgumentChoices } from './source-control-action-launch-preferences' -import { - normalizeRepoSourceControlAiOverrides, - normalizeSourceControlAiSettings -} from './source-control-ai' +import { sourceControlActionRecipeEntry } from '../recipes/source-control-action-selection' +import { trimActionArgumentDocument } from '../recipes/source-control-action-argument-document' +import { demoteDisplacedActionArgumentChoices } from '../recipes/source-control-action-launch-preferences' +import { normalizeRepoSourceControlAiOverrides } from './source-control-ai-repo-settings' +import { normalizeSourceControlAiSettings } from './source-control-ai-settings' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, SOURCE_CONTROL_TEXT_ACTION_IDS, canonicalActionLaunchPreferences, type SourceControlActionId, type SourceControlActionRecipe -} from './source-control-ai-actions' +} from '../recipes/source-control-ai-actions' import type { CompleteSourceControlActionRecipe, RepoSourceControlAiOverrides, SourceControlAiOperation, SourceControlAiSettings, WritableRepoSourceControlAiOverrides -} from './source-control-ai-types' -import type { GlobalSettings } from './global-settings-types' -import type { Repo } from './repo-types' +} from './source-control-ai-settings-types' +import type { GlobalSettings } from '../../../global-settings-types' +import type { Repo } from '../../../repo-types' export type SourceControlAiWriteTarget = { type: 'repo'; repoId: string } | { type: 'global' } diff --git a/src/shared/source-control-ai-repo-settings.ts b/src/shared/source-control/ai/settings/source-control-ai-repo-settings.ts similarity index 96% rename from src/shared/source-control-ai-repo-settings.ts rename to src/shared/source-control/ai/settings/source-control-ai-repo-settings.ts index df93ce96201..af0e780806d 100644 --- a/src/shared/source-control-ai-repo-settings.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-repo-settings.ts @@ -1,19 +1,19 @@ -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' import { SOURCE_CONTROL_ACTION_IDS, SOURCE_CONTROL_LAUNCH_ACTION_IDS, SOURCE_CONTROL_TEXT_ACTION_IDS, normalizeSourceControlActionRecipe, type SourceControlActionId -} from './source-control-ai-actions' +} from '../recipes/source-control-ai-actions' import { commandTemplateFromOperationInstruction, isLegacyBranchInstructionTemplate -} from './source-control-ai-command-template' +} from '../recipes/source-control-ai-command-template' import type { RepoSourceControlAiOverrides, SourceControlAiModelChoice -} from './source-control-ai-types' +} from './source-control-ai-settings-types' type RepoActionOverride = NonNullable< NonNullable[SourceControlActionId] diff --git a/src/shared/source-control-ai-types.ts b/src/shared/source-control/ai/settings/source-control-ai-settings-types.ts similarity index 92% rename from src/shared/source-control-ai-types.ts rename to src/shared/source-control/ai/settings/source-control-ai-settings-types.ts index 7353d6d7892..2383e400567 100644 --- a/src/shared/source-control-ai-types.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-settings-types.ts @@ -1,6 +1,6 @@ -import type { CommitMessageAiModelCapability } from './commit-message-ai-types' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' -import type { CustomAgentId } from './commit-message-agent-spec' +import type { CommitMessageAiModelCapability } from '../generation/commit-message-ai-types' +import type { TuiAgent } from '../../../agent-launch/catalog/tui-agent' +import type { CustomAgentId } from '../generation/commit-message-agent-spec' import type { SourceControlAiActionDefaults, SourceControlActionLaunchPreferences, @@ -9,7 +9,7 @@ import type { SourceControlActionId, SourceControlTextActionId, AiTextActionId -} from './source-control-ai-actions' +} from '../recipes/source-control-ai-actions' export type AiTextOperation = AiTextActionId export type SourceControlAiOperation = SourceControlTextActionId diff --git a/src/shared/source-control-ai-settings.ts b/src/shared/source-control/ai/settings/source-control-ai-settings.ts similarity index 95% rename from src/shared/source-control-ai-settings.ts rename to src/shared/source-control/ai/settings/source-control-ai-settings.ts index bd421bbf58a..4acb1f4ced8 100644 --- a/src/shared/source-control-ai-settings.ts +++ b/src/shared/source-control/ai/settings/source-control-ai-settings.ts @@ -1,21 +1,21 @@ -import { isCustomAgentId } from './commit-message-agent-spec' -import type { CommitMessageAiSettings } from './commit-message-ai-types' +import { isCustomAgentId } from '../generation/commit-message-agent-spec' +import type { CommitMessageAiSettings } from '../generation/commit-message-ai-types' import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, AI_ACTION_IDS, SOURCE_CONTROL_TEXT_ACTION_IDS, normalizeSourceControlAiActionDefaults, readSourceControlActionDefault -} from './source-control-ai-actions' +} from '../recipes/source-control-ai-actions' import { actionRecipeFromLegacyCommitMessageAi, commandTemplateFromOperationInstruction, isLegacyBranchInstructionTemplate -} from './source-control-ai-command-template' +} from '../recipes/source-control-ai-command-template' import type { SourceControlAiPrCreationDefaults, SourceControlAiSettings -} from './source-control-ai-types' +} from './source-control-ai-settings-types' export const DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS: Required = { diff --git a/src/shared/source-control-ai-operation-policy.ts b/src/shared/source-control/ai/source-control-ai-operation-policy.ts similarity index 92% rename from src/shared/source-control-ai-operation-policy.ts rename to src/shared/source-control/ai/source-control-ai-operation-policy.ts index ae84151ab69..9382b0b284b 100644 --- a/src/shared/source-control-ai-operation-policy.ts +++ b/src/shared/source-control/ai/source-control-ai-operation-policy.ts @@ -1,31 +1,31 @@ -import { trimActionArgumentDocument } from './source-control-action-argument-choices' +import { trimActionArgumentDocument } from './recipes/source-control-action-argument-document' import { selectSourceControlActionRecipe, type CurrentActionSelection, type SelectedSourceControlActionRecipe -} from './source-control-action-selection' -import type { GlobalSettings } from './global-settings-types' -import type { Repo } from './repo-types' +} from './recipes/source-control-action-selection' +import type { GlobalSettings } from '../../global-settings-types' +import type { Repo } from '../../repo-types' import { readSourceControlActionDefault, resolveSourceControlActionCommandTemplate, type AiActionId, type SourceControlTextActionId -} from './source-control-ai-actions' -import { commandTemplateFromOperationInstruction } from './source-control-ai-command-template' -import { normalizeRepoSourceControlAiOverrides } from './source-control-ai-repo-settings' +} from './recipes/source-control-ai-actions' +import { commandTemplateFromOperationInstruction } from './recipes/source-control-ai-command-template' +import { normalizeRepoSourceControlAiOverrides } from './settings/source-control-ai-repo-settings' import { DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS, normalizeSourceControlAiSettings -} from './source-control-ai-settings' +} from './settings/source-control-ai-settings' import type { RepoSourceControlAiOverrides, AiTextOperation, SourceControlAiPrCreationDefaults, SourceControlAiSettings -} from './source-control-ai-types' -import type { CustomAgentId } from './commit-message-agent-spec' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +} from './settings/source-control-ai-settings-types' +import type { CustomAgentId } from './generation/commit-message-agent-spec' +import type { TuiAgent } from '../../agent-launch/catalog/tui-agent' function readRepoInstructionOverride( instructions: RepoSourceControlAiOverrides['instructionsByOperation'], diff --git a/src/shared/source-control-ai.ts b/src/shared/source-control/ai/source-control-ai-operation-resolution.ts similarity index 76% rename from src/shared/source-control-ai.ts rename to src/shared/source-control/ai/source-control-ai-operation-resolution.ts index 90220f39113..6fd3be90910 100644 --- a/src/shared/source-control-ai.ts +++ b/src/shared/source-control/ai/source-control-ai-operation-resolution.ts @@ -5,51 +5,36 @@ import { isCustomAgentId, listCommitMessageAgentCapabilities, resolveCommitMessageAgentChoice -} from './commit-message-agent-spec' -import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from './commit-message-host-key' +} from './generation/commit-message-agent-spec' +import { LOCAL_COMMIT_MESSAGE_HOST_KEY } from './generation/commit-message-host-key' import { textGenerationFailure, type TextGenerationFailureCode, type TextGenerationFailureFields -} from './text-generation-failure-copy' -import type { GlobalSettings } from './global-settings-types' -import type { Repo } from './repo-types' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' -import { mergeLegacyCommitMessageAiIntoSourceControlAi as mergeLegacySettings } from './source-control-ai-legacy-reconciliation' -import { projectSourceControlAiToLegacyCommitMessageAi as projectLegacySettings } from './source-control-ai-legacy-projection' +} from '../../text-generation-failure-copy' +import type { GlobalSettings } from '../../global-settings-types' +import type { Repo } from '../../repo-types' +import type { TuiAgent } from '../../agent-launch/catalog/tui-agent' + +import { projectSourceControlAiToLegacyCommitMessageAi as projectLegacySettings } from './settings/source-control-ai-legacy-projection' import { - clearSourceControlAiModelChoiceForHost as clearModelChoice, getDiscoveredModels, - readSourceControlAiModelChoiceForHost as readModelChoice, resolveThinkingLevel, - selectPersistedModelId, - selectSourceControlAiModelChoiceForHost as selectModelChoice -} from './source-control-ai-model-selection' + selectPersistedModelId +} from './settings/source-control-ai-model-selection' import { - hasConfiguredSourceControlAiInstructions as hasConfiguredInstructions, resolveActionRecipeForTextOperation, resolveInstructionsFromNormalized, - resolvePrCreationDefaults, - resolveSourceControlActionRecipe as resolveActionRecipe, - resolveSourceControlAiEnabled as resolveEnabled, - resolveSourceControlAiInstructions as resolveInstructions, - resolveSourceControlAiPrCreationDefaults as resolvePrDefaults + resolvePrCreationDefaults } from './source-control-ai-operation-policy' -import { normalizeRepoSourceControlAiOverrides as normalizeRepoOverrides } from './source-control-ai-repo-settings' -import { - DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS as DEFAULT_PR_CREATION_DEFAULTS, - getDefaultSourceControlAiSettings as getDefaultSettings, - normalizeSourceControlAiSettings as normalizeSettings, - sourceControlAiSettingsFromLegacy as settingsFromLegacy -} from './source-control-ai-settings' -import { hasActionAgentRecipe } from './source-control-ai-command-template' +import { normalizeRepoSourceControlAiOverrides as normalizeRepoOverrides } from './settings/source-control-ai-repo-settings' +import { normalizeSourceControlAiSettings as normalizeSettings } from './settings/source-control-ai-settings' +import { hasActionAgentRecipe } from './recipes/source-control-ai-command-template' import type { AiTextOperation, SourceControlAiModelChoice, SourceControlAiPrCreationDefaults -} from './source-control-ai-types' - -export const DEFAULT_SOURCE_CONTROL_AI_PR_CREATION_DEFAULTS = DEFAULT_PR_CREATION_DEFAULTS +} from './settings/source-control-ai-settings-types' export type ResolvedSourceControlAiGenerationParams = { agentId: TuiAgent | 'custom' @@ -97,21 +82,6 @@ export type ResolveSourceControlAiPrCreationDefaultsInput = { prCreationProductDefaults?: SourceControlAiPrCreationDefaults } -export const normalizeRepoSourceControlAiOverrides = normalizeRepoOverrides -export const getDefaultSourceControlAiSettings = getDefaultSettings -export const sourceControlAiSettingsFromLegacy = settingsFromLegacy -export const mergeLegacyCommitMessageAiIntoSourceControlAi = mergeLegacySettings -export const normalizeSourceControlAiSettings = normalizeSettings -export const readSourceControlAiModelChoiceForHost = readModelChoice -export const selectSourceControlAiModelChoiceForHost = selectModelChoice -export const clearSourceControlAiModelChoiceForHost = clearModelChoice -export const projectSourceControlAiToLegacyCommitMessageAi = projectLegacySettings -export const resolveSourceControlAiInstructions = resolveInstructions -export const hasConfiguredSourceControlAiInstructions = hasConfiguredInstructions -export const resolveSourceControlAiPrCreationDefaults = resolvePrDefaults -export const resolveSourceControlAiEnabled = resolveEnabled -export const resolveSourceControlActionRecipe = resolveActionRecipe - const COMMAND_TEMPLATE_EMPTY = { commitMessage: 'commandTemplateEmptyCommitMessage', pullRequest: 'commandTemplateEmptyPullRequest', diff --git a/src/shared/source-control-ai-policy-regression.spec.ts b/src/shared/source-control/ai/source-control-ai-policy-regression.spec.ts similarity index 96% rename from src/shared/source-control-ai-policy-regression.spec.ts rename to src/shared/source-control/ai/source-control-ai-policy-regression.spec.ts index 49261e68bf0..62ea3f15ff5 100644 --- a/src/shared/source-control-ai-policy-regression.spec.ts +++ b/src/shared/source-control/ai/source-control-ai-policy-regression.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { getDefaultSettings } from './constants' -import { resolveSourceControlAiForOperation } from './source-control-ai' +import { getDefaultSettings } from '../../constants' +import { resolveSourceControlAiForOperation } from './source-control-ai-operation-resolution' describe('source-control AI policy regressions', () => { it('does not apply a local model choice to an SSH execution host', () => { diff --git a/src/shared/source-control-ai.test.ts b/src/shared/source-control/ai/source-control-ai.test.ts similarity index 96% rename from src/shared/source-control-ai.test.ts rename to src/shared/source-control/ai/source-control-ai.test.ts index ad706af8a99..067cf1f0fca 100644 --- a/src/shared/source-control-ai.test.ts +++ b/src/shared/source-control/ai/source-control-ai.test.ts @@ -1,22 +1,24 @@ import { describe, expect, it } from 'vitest' -import { getDefaultSettings } from './constants' +import { getDefaultSettings } from '../../constants' import { clearSourceControlAiModelChoiceForHost, - mergeLegacyCommitMessageAiIntoSourceControlAi, - normalizeRepoSourceControlAiOverrides, - projectSourceControlAiToLegacyCommitMessageAi, readSourceControlAiModelChoiceForHost, + selectSourceControlAiModelChoiceForHost +} from './settings/source-control-ai-model-selection' +import { mergeLegacyCommitMessageAiIntoSourceControlAi } from './settings/source-control-ai-legacy-reconciliation' +import { normalizeRepoSourceControlAiOverrides } from './settings/source-control-ai-repo-settings' +import { projectSourceControlAiToLegacyCommitMessageAi } from './settings/source-control-ai-legacy-projection' +import { resolveSourceControlAiForOperation, - resolveSourceControlAiActionModelDefault, - resolveSourceControlAiPrCreationDefaults, - selectSourceControlAiModelChoiceForHost, - sourceControlAiSettingsFromLegacy -} from './source-control-ai' + resolveSourceControlAiActionModelDefault +} from './source-control-ai-operation-resolution' +import { resolveSourceControlAiPrCreationDefaults } from './source-control-ai-operation-policy' +import { sourceControlAiSettingsFromLegacy } from './settings/source-control-ai-settings' import type { RepoSourceControlAiOverrides, SourceControlAiOperation -} from './source-control-ai-types' -import type { GlobalSettings } from './global-settings-types' +} from './settings/source-control-ai-settings-types' +import type { GlobalSettings } from '../../global-settings-types' function settings(): GlobalSettings { const base = getDefaultSettings('/tmp') diff --git a/src/shared/source-control-launch-agent-selection.ts b/src/shared/source-control/ai/source-control-launch-agent-selection.ts similarity index 89% rename from src/shared/source-control-launch-agent-selection.ts rename to src/shared/source-control/ai/source-control-launch-agent-selection.ts index bf1f53074b1..9384d72c4c7 100644 --- a/src/shared/source-control-launch-agent-selection.ts +++ b/src/shared/source-control/ai/source-control-launch-agent-selection.ts @@ -1,16 +1,17 @@ -import { isCustomAgentId } from './commit-message-agent-spec' -import { - normalizeRepoSourceControlAiOverrides, - resolveSourceControlActionRecipe -} from './source-control-ai' -import type { SourceControlActionId, SourceControlActionRecipe } from './source-control-ai-actions' +import { isCustomAgentId } from './generation/commit-message-agent-spec' +import { normalizeRepoSourceControlAiOverrides } from './settings/source-control-ai-repo-settings' +import { resolveSourceControlActionRecipe } from './source-control-ai-operation-policy' +import type { + SourceControlActionId, + SourceControlActionRecipe +} from './recipes/source-control-ai-actions' import { filterEnabledTuiAgents, TUI_AGENT_AUTO_PICK_ORDER -} from './agent-launch/catalog/tui-agent-selection' -import type { GlobalSettings } from './global-settings-types' -import type { Repo } from './repo-types' -import type { TuiAgent } from './agent-launch/catalog/tui-agent' +} from '../../agent-launch/catalog/tui-agent-selection' +import type { GlobalSettings } from '../../global-settings-types' +import type { Repo } from '../../repo-types' +import type { TuiAgent } from '../../agent-launch/catalog/tui-agent' export function readSourceControlLaunchRecipeAgentId( recipe: Pick | null | undefined diff --git a/src/shared/source-control-plan-contracts.test.ts b/src/shared/source-control/ai/source-control-plan-contracts.test.ts similarity index 63% rename from src/shared/source-control-plan-contracts.test.ts rename to src/shared/source-control/ai/source-control-plan-contracts.test.ts index f6205e7542e..d9ff1063ec6 100644 --- a/src/shared/source-control-plan-contracts.test.ts +++ b/src/shared/source-control/ai/source-control-plan-contracts.test.ts @@ -1,6 +1,6 @@ import './omp-source-control-discovery.spec' import './source-control-ai-policy-regression.spec' -import './commit-message-omp.spec' +import './generation/commit-message-omp.spec' import './antigravity-source-control.spec' import './conversation-name-action.spec' -import './source-control-ai-action-variables.spec' +import './recipes/source-control-ai-action-variables.spec' diff --git a/src/shared/check-run-details-owner-scope.ts b/src/shared/source-control/checks/check-run-details-owner-scope.ts similarity index 95% rename from src/shared/check-run-details-owner-scope.ts rename to src/shared/source-control/checks/check-run-details-owner-scope.ts index 8491ab359db..ab00e809868 100644 --- a/src/shared/check-run-details-owner-scope.ts +++ b/src/shared/source-control/checks/check-run-details-owner-scope.ts @@ -2,7 +2,7 @@ import { LOCAL_EXECUTION_HOST_ID, toRuntimeExecutionHostId, type ExecutionHostId -} from './execution-host' +} from '../../execution-host' export function checkRunDetailsOwnerScope( hostId: ExecutionHostId, diff --git a/src/shared/gitlab-job-log-excerpt.test.ts b/src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.test.ts similarity index 97% rename from src/shared/gitlab-job-log-excerpt.test.ts rename to src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.test.ts index f54aad843c2..5914c0a7f03 100644 --- a/src/shared/gitlab-job-log-excerpt.test.ts +++ b/src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { gitLabJobTraceToLogExcerpt, toGitLabJobLogExcerptResult } from './gitlab-job-log-excerpt' -import { PR_CHECK_LOG_TAIL_BYTES } from './check-job-log-tail-slice' +import { PR_CHECK_LOG_TAIL_BYTES } from '../logs/check-job-log-excerpt' const CSI_ERASE = '\u001b[0K' const RESET = '\u001b[0;m' diff --git a/src/shared/gitlab-job-log-excerpt.ts b/src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.ts similarity index 90% rename from src/shared/gitlab-job-log-excerpt.ts rename to src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.ts index 59d514facdc..8a22d0d3323 100644 --- a/src/shared/gitlab-job-log-excerpt.ts +++ b/src/shared/source-control/checks/gitlab/gitlab-job-log-excerpt.ts @@ -1,6 +1,6 @@ -import { stripAnsiEscapeSequences } from './ansi-escape-sequences' -import { sliceCheckLogTail } from './check-job-log-tail-slice' -import type { GitLabJobTraceResult } from './gitlab-types' +import { stripAnsiEscapeSequences } from '../../../ansi-escape-sequences' +import { sliceCheckLogTail } from '../logs/check-job-log-tail-slice' +import type { GitLabJobTraceResult } from '../../../gitlab-types' // GitLab wraps collapsible sections in `section_start::\r0K`; // strip only through the CR so the human-readable header on the same line survives. diff --git a/src/shared/gitlab-job-trace-check-details.test.ts b/src/shared/source-control/checks/gitlab/gitlab-job-trace-check-details.test.ts similarity index 96% rename from src/shared/gitlab-job-trace-check-details.test.ts rename to src/shared/source-control/checks/gitlab/gitlab-job-trace-check-details.test.ts index 958e3247c69..c71ce0b3279 100644 --- a/src/shared/gitlab-job-trace-check-details.test.ts +++ b/src/shared/source-control/checks/gitlab/gitlab-job-trace-check-details.test.ts @@ -4,8 +4,8 @@ import { gitLabJobTraceToCheckRunDetails } from './gitlab-job-trace-check-details' import { gitLabPipelineJobsToPRChecks } from './gitlab-pipeline-checks' -import type { GitLabPipelineJob } from './gitlab-types' -import type { PRCheckDetail } from './github/check-types' +import type { GitLabPipelineJob } from '../../../gitlab-types' +import type { PRCheckDetail } from '../../../github/check-types' const STRINGS = { emptyTrace: 'No log is available for this GitLab job.' } diff --git a/src/shared/gitlab-job-trace-check-details.ts b/src/shared/source-control/checks/gitlab/gitlab-job-trace-check-details.ts similarity index 95% rename from src/shared/gitlab-job-trace-check-details.ts rename to src/shared/source-control/checks/gitlab/gitlab-job-trace-check-details.ts index e79297d3564..a70d479faf2 100644 --- a/src/shared/gitlab-job-trace-check-details.ts +++ b/src/shared/source-control/checks/gitlab/gitlab-job-trace-check-details.ts @@ -1,5 +1,5 @@ import { gitLabJobTraceToLogExcerpt } from './gitlab-job-log-excerpt' -import type { PRCheckDetail, PRCheckRunDetails } from './github/check-types' +import type { PRCheckDetail, PRCheckRunDetails } from '../../../github/check-types' export type GitLabJobTraceCheckDetailsStrings = { /** Shown for a job with no log: never ran, waiting on a human, or log erased/expired. */ diff --git a/src/shared/gitlab-mr-checks.test-fixture.ts b/src/shared/source-control/checks/gitlab/gitlab-mr-checks.test-fixture.ts similarity index 95% rename from src/shared/gitlab-mr-checks.test-fixture.ts rename to src/shared/source-control/checks/gitlab/gitlab-mr-checks.test-fixture.ts index 3225e0de5ab..0908fe1bc47 100644 --- a/src/shared/gitlab-mr-checks.test-fixture.ts +++ b/src/shared/source-control/checks/gitlab/gitlab-mr-checks.test-fixture.ts @@ -1,4 +1,4 @@ -import type { HostedReviewInfo } from './hosted-review' +import type { HostedReviewInfo } from '../../hosted-review/hosted-review-contracts' const rawIdentity = { iid: 7, title: 'Release', state: 'opened', has_conflicts: false } const reviewIdentity = { diff --git a/src/shared/gitlab-pipeline-checks.test.ts b/src/shared/source-control/checks/gitlab/gitlab-pipeline-checks.test.ts similarity index 97% rename from src/shared/gitlab-pipeline-checks.test.ts rename to src/shared/source-control/checks/gitlab/gitlab-pipeline-checks.test.ts index f37d2aa1745..4a7a37b18e6 100644 --- a/src/shared/gitlab-pipeline-checks.test.ts +++ b/src/shared/source-control/checks/gitlab/gitlab-pipeline-checks.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { gitLabPipelineJobsToPRChecks } from './gitlab-pipeline-checks' -import type { GitLabPipelineJob } from './gitlab-types' +import type { GitLabPipelineJob } from '../../../gitlab-types' describe('gitLabPipelineJobsToPRChecks', () => { it('maps GitLab pipeline jobs into right-panel check rows', () => { diff --git a/src/shared/gitlab-pipeline-checks.ts b/src/shared/source-control/checks/gitlab/gitlab-pipeline-checks.ts similarity index 92% rename from src/shared/gitlab-pipeline-checks.ts rename to src/shared/source-control/checks/gitlab/gitlab-pipeline-checks.ts index b5ffb7fac78..15f3a11ce37 100644 --- a/src/shared/gitlab-pipeline-checks.ts +++ b/src/shared/source-control/checks/gitlab/gitlab-pipeline-checks.ts @@ -1,6 +1,6 @@ -import type { GitLabPipeline, GitLabPipelineJob } from './gitlab-types' -import type { PRCheckDetail } from './github/check-types' -import type { CheckStatus } from './github/pull-request-types' +import type { GitLabPipeline, GitLabPipelineJob } from '../../../gitlab-types' +import type { PRCheckDetail } from '../../../github/check-types' +import type { CheckStatus } from '../../../github/pull-request-types' export function mapGitLabPipelineJobStatusToCheckStatus(status: string): PRCheckDetail['status'] { const s = status.toLowerCase() diff --git a/src/shared/check-job-log-byte-cap.test.ts b/src/shared/source-control/checks/logs/check-job-log-byte-cap.test.ts similarity index 92% rename from src/shared/check-job-log-byte-cap.test.ts rename to src/shared/source-control/checks/logs/check-job-log-byte-cap.test.ts index 091066d8e13..7bb2877b519 100644 --- a/src/shared/check-job-log-byte-cap.test.ts +++ b/src/shared/source-control/checks/logs/check-job-log-byte-cap.test.ts @@ -1,10 +1,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' -import * as byteLimits from './utf8-byte-limits' -import { - PR_CHECK_LOG_TAIL_BYTES, - PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR, - sliceCheckLogTail -} from './check-job-log-tail-slice' +import * as byteLimits from '../../../utf8-byte-limits' +import { PR_CHECK_LOG_TAIL_BYTES } from './check-job-log-excerpt' +import { PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR, sliceCheckLogTail } from './check-job-log-tail-slice' describe('check log excerpt byte-cap work', () => { afterEach(() => vi.restoreAllMocks()) diff --git a/src/shared/check-job-log-excerpt.test.ts b/src/shared/source-control/checks/logs/check-job-log-excerpt.test.ts similarity index 94% rename from src/shared/check-job-log-excerpt.test.ts rename to src/shared/source-control/checks/logs/check-job-log-excerpt.test.ts index 7a765520902..2a87125b142 100644 --- a/src/shared/check-job-log-excerpt.test.ts +++ b/src/shared/source-control/checks/logs/check-job-log-excerpt.test.ts @@ -1,9 +1,9 @@ import { afterEach, describe, expect, it, vi } from 'vitest' -import { createCheckLogFixture } from '../../config/scripts/check-job-log-test-fixture.mjs' +import { createCheckLogFixture } from '../../../../../config/scripts/check-job-log-test-fixture.mjs' import { PR_CHECK_LOG_TAIL_BYTES, sanitizeCheckJobLogExcerpt } from './check-job-log-excerpt' -import * as ansi from './ansi-escape-sequences' -import * as ownership from './own-retained-string' -import * as bytes from './utf8-byte-limits' +import * as ansi from '../../../ansi-escape-sequences' +import * as ownership from '../../../own-retained-string' +import * as bytes from '../../../utf8-byte-limits' const limit = PR_CHECK_LOG_TAIL_BYTES const fixture = createCheckLogFixture() diff --git a/src/shared/check-job-log-excerpt.ts b/src/shared/source-control/checks/logs/check-job-log-excerpt.ts similarity index 82% rename from src/shared/check-job-log-excerpt.ts rename to src/shared/source-control/checks/logs/check-job-log-excerpt.ts index a27a78ce59b..d0fd64ce213 100644 --- a/src/shared/check-job-log-excerpt.ts +++ b/src/shared/source-control/checks/logs/check-job-log-excerpt.ts @@ -1,9 +1,9 @@ import { stripAnsiEscapeSequences, TERMINAL_CONTROL_CHARACTER_PATTERN -} from './ansi-escape-sequences' -import { ownRetainedString } from './own-retained-string' -import { clampUtf8TextTail, isUtf8ByteLengthWithinLimit } from './utf8-byte-limits' +} from '../../../ansi-escape-sequences' +import { ownRetainedString } from '../../../own-retained-string' +import { clampUtf8TextTail, isUtf8ByteLengthWithinLimit } from '../../../utf8-byte-limits' export const PR_CHECK_LOG_TAIL_BYTES = 16 * 1024 diff --git a/src/shared/check-job-log-marker-candidates.test.ts b/src/shared/source-control/checks/logs/check-job-log-marker-candidates.test.ts similarity index 94% rename from src/shared/check-job-log-marker-candidates.test.ts rename to src/shared/source-control/checks/logs/check-job-log-marker-candidates.test.ts index 39f9d8477fe..bca6d6de949 100644 --- a/src/shared/check-job-log-marker-candidates.test.ts +++ b/src/shared/source-control/checks/logs/check-job-log-marker-candidates.test.ts @@ -1,12 +1,9 @@ import { afterEach, describe, expect, it, vi } from 'vitest' -import * as ansi from './ansi-escape-sequences' -import * as byteLimits from './utf8-byte-limits' -import { createCheckLogFixture } from '../../config/scripts/check-job-log-test-fixture.mjs' -import { - PR_CHECK_LOG_TAIL_BYTES, - PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR, - sliceCheckLogTail -} from './check-job-log-tail-slice' +import * as ansi from '../../../ansi-escape-sequences' +import * as byteLimits from '../../../utf8-byte-limits' +import { createCheckLogFixture } from '../../../../../config/scripts/check-job-log-test-fixture.mjs' +import { PR_CHECK_LOG_TAIL_BYTES } from './check-job-log-excerpt' +import { PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR, sliceCheckLogTail } from './check-job-log-tail-slice' const trailing = Array.from({ length: 210 }, (_, index) => `recent ${index}`).join('\n') const fixture = createCheckLogFixture() diff --git a/src/shared/check-job-log-performance-harness.test.ts b/src/shared/source-control/checks/logs/check-job-log-performance-harness.test.ts similarity index 99% rename from src/shared/check-job-log-performance-harness.test.ts rename to src/shared/source-control/checks/logs/check-job-log-performance-harness.test.ts index baef85b2c29..21dbcd36e61 100644 --- a/src/shared/check-job-log-performance-harness.test.ts +++ b/src/shared/source-control/checks/logs/check-job-log-performance-harness.test.ts @@ -4,13 +4,13 @@ import { auditResults, prepareBenchmark, runDescriptor -} from '../../config/scripts/check-job-log-byte-cap-benchmark.mjs' +} from '../../../../../config/scripts/check-job-log-byte-cap-benchmark.mjs' import { BASELINE_REF, createManifest, selectRequiredDescriptors -} from '../../config/scripts/check-job-log-performance-cases.mjs' -import { adverseCaseKey } from '../../config/scripts/check-job-log-watchdog-protocol.mjs' +} from '../../../../../config/scripts/check-job-log-performance-cases.mjs' +import { adverseCaseKey } from '../../../../../config/scripts/check-job-log-watchdog-protocol.mjs' const launcher = vi.hoisted(() => vi.fn()) vi.mock('@orca/process-host', () => ({ runProcess: launcher })) diff --git a/src/shared/check-job-log-retention.test.ts b/src/shared/source-control/checks/logs/check-job-log-retention.test.ts similarity index 89% rename from src/shared/check-job-log-retention.test.ts rename to src/shared/source-control/checks/logs/check-job-log-retention.test.ts index 8272654160e..37788714c79 100644 --- a/src/shared/check-job-log-retention.test.ts +++ b/src/shared/source-control/checks/logs/check-job-log-retention.test.ts @@ -1,8 +1,9 @@ import { describe, expect, it, vi } from 'vitest' -import { PR_CHECK_LOG_TAIL_BYTES, sliceCheckLogTail } from './check-job-log-tail-slice' -import { gitLabJobTraceToLogExcerpt } from './gitlab-job-log-excerpt' -import { sanitizeCheckJobLogExcerpt } from './check-job-log-excerpt' -import { resetOwnRetainedStringCopier } from './own-retained-string' +import { PR_CHECK_LOG_TAIL_BYTES, sanitizeCheckJobLogExcerpt } from './check-job-log-excerpt' +import { sliceCheckLogTail } from './check-job-log-tail-slice' +import { gitLabJobTraceToLogExcerpt } from '../gitlab/gitlab-job-log-excerpt' + +import { resetOwnRetainedStringCopier } from '../../../own-retained-string' function heapAfterGc(): number { if (!('gc' in globalThis) || typeof globalThis.gc !== 'function') { diff --git a/src/shared/check-job-log-tail-slice.test.ts b/src/shared/source-control/checks/logs/check-job-log-tail-slice.test.ts similarity index 96% rename from src/shared/check-job-log-tail-slice.test.ts rename to src/shared/source-control/checks/logs/check-job-log-tail-slice.test.ts index 3c77fed40a4..f5f98d9c6dd 100644 --- a/src/shared/check-job-log-tail-slice.test.ts +++ b/src/shared/source-control/checks/logs/check-job-log-tail-slice.test.ts @@ -1,9 +1,6 @@ import { describe, expect, it } from 'vitest' -import { - PR_CHECK_LOG_TAIL_BYTES, - PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR, - sliceCheckLogTail -} from './check-job-log-tail-slice' +import { PR_CHECK_LOG_TAIL_BYTES } from './check-job-log-excerpt' +import { PR_CHECK_LOG_TAIL_EARLIER_SEPARATOR, sliceCheckLogTail } from './check-job-log-tail-slice' describe('sliceCheckLogTail', () => { it.each([1, 2, 3, 5, 7, 11, 31, 100])( diff --git a/src/shared/check-job-log-tail-slice.ts b/src/shared/source-control/checks/logs/check-job-log-tail-slice.ts similarity index 97% rename from src/shared/check-job-log-tail-slice.ts rename to src/shared/source-control/checks/logs/check-job-log-tail-slice.ts index 8bc99f3e586..721bb48f404 100644 --- a/src/shared/check-job-log-tail-slice.ts +++ b/src/shared/source-control/checks/logs/check-job-log-tail-slice.ts @@ -3,15 +3,13 @@ import { clampUtf8TextTail, getUtf8ByteLength, isUtf8ByteLengthWithinLimit -} from './utf8-byte-limits' +} from '../../../utf8-byte-limits' import { stripAnsiEscapeSequences, TERMINAL_CONTROL_CHARACTER_PATTERN -} from './ansi-escape-sequences' +} from '../../../ansi-escape-sequences' import { PR_CHECK_LOG_TAIL_BYTES, sanitizeCheckJobLogExcerpt } from './check-job-log-excerpt' -export { PR_CHECK_LOG_TAIL_BYTES } from './check-job-log-excerpt' - export const PR_CHECK_LOG_TAIL_LINES = 200 export const PR_CHECK_LOG_TAIL_RECENT_LINES = 100 export const PR_CHECK_LOG_TAIL_ERROR_CONTEXT_LINES = 2 diff --git a/src/shared/check-job-log-text-performance.test.ts b/src/shared/source-control/checks/logs/check-job-log-text-performance.test.ts similarity index 91% rename from src/shared/check-job-log-text-performance.test.ts rename to src/shared/source-control/checks/logs/check-job-log-text-performance.test.ts index 73f8705aeca..e10ec921f68 100644 --- a/src/shared/check-job-log-text-performance.test.ts +++ b/src/shared/source-control/checks/logs/check-job-log-text-performance.test.ts @@ -3,11 +3,11 @@ import { auditResults, prepareBenchmark, runDescriptor -} from '../../config/scripts/check-job-log-byte-cap-benchmark.mjs' +} from '../../../../../config/scripts/check-job-log-byte-cap-benchmark.mjs' import { createManifest, selectRequiredDescriptors -} from '../../config/scripts/check-job-log-performance-cases.mjs' +} from '../../../../../config/scripts/check-job-log-performance-cases.mjs' const root = process.cwd() const manifest = selectRequiredDescriptors( diff --git a/src/shared/pr-check-severity-order.test.ts b/src/shared/source-control/checks/pr-check-severity-order.test.ts similarity index 97% rename from src/shared/pr-check-severity-order.test.ts rename to src/shared/source-control/checks/pr-check-severity-order.test.ts index 5b43843435e..10242e37325 100644 --- a/src/shared/pr-check-severity-order.test.ts +++ b/src/shared/source-control/checks/pr-check-severity-order.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' -import type { PRCheckDetail } from './github/check-types' +import type { PRCheckDetail } from '../../github/check-types' import { getCheckSeverityRank, sortChecksBySeverity } from './pr-check-severity-order' -import { mapGitLabPipelineJobStatusToConclusion } from './gitlab-pipeline-checks' +import { mapGitLabPipelineJobStatusToConclusion } from './gitlab/gitlab-pipeline-checks' const check = (name: string, conclusion: string | null) => ({ name, conclusion }) as Pick diff --git a/src/shared/pr-check-severity-order.ts b/src/shared/source-control/checks/pr-check-severity-order.ts similarity index 94% rename from src/shared/pr-check-severity-order.ts rename to src/shared/source-control/checks/pr-check-severity-order.ts index 5c01d1db5e5..4e5b0b93df0 100644 --- a/src/shared/pr-check-severity-order.ts +++ b/src/shared/source-control/checks/pr-check-severity-order.ts @@ -1,4 +1,4 @@ -import type { PRCheckDetail } from './github/check-types' +import type { PRCheckDetail } from '../../github/check-types' // Neutral/skipped carry no signal and must sink below success. Map provider values to avoid prototype-name ranks // (e.g. constructor/toString resolving as functions on plain objects). diff --git a/src/shared/pr-check-status-label.ts b/src/shared/source-control/checks/pr-check-status-label.ts similarity index 93% rename from src/shared/pr-check-status-label.ts rename to src/shared/source-control/checks/pr-check-status-label.ts index 74be42075ea..b313e5cfb78 100644 --- a/src/shared/pr-check-status-label.ts +++ b/src/shared/source-control/checks/pr-check-status-label.ts @@ -1,4 +1,4 @@ -import type { PRCheckDetail } from './github/check-types' +import type { PRCheckDetail } from '../../github/check-types' export function getCheckConclusion(check: PRCheckDetail): NonNullable { return check.conclusion ?? 'pending' diff --git a/src/shared/pr-check-status.test.ts b/src/shared/source-control/checks/pr-check-status.test.ts similarity index 98% rename from src/shared/pr-check-status.test.ts rename to src/shared/source-control/checks/pr-check-status.test.ts index 8d60a5ac577..0e4772dbcbe 100644 --- a/src/shared/pr-check-status.test.ts +++ b/src/shared/source-control/checks/pr-check-status.test.ts @@ -5,7 +5,7 @@ import { summarizePRCheckRollup } from './pr-check-status' import { getProviderChecksOutcome } from './provider-check-summary' -import type { PRCheckDetail } from './github/check-types' +import type { PRCheckDetail } from '../../github/check-types' const check = ( status: PRCheckDetail['status'], diff --git a/src/shared/pr-check-status.ts b/src/shared/source-control/checks/pr-check-status.ts similarity index 92% rename from src/shared/pr-check-status.ts rename to src/shared/source-control/checks/pr-check-status.ts index b5e4a1f04dc..349d8d1f2c1 100644 --- a/src/shared/pr-check-status.ts +++ b/src/shared/source-control/checks/pr-check-status.ts @@ -1,6 +1,6 @@ import { summarizeProviderChecks } from './provider-check-summary' -import type { PRCheckDetail } from './github/check-types' -import type { CheckStatus, ProviderCheckSummary } from './github/pull-request-types' +import type { PRCheckDetail } from '../../github/check-types' +import type { CheckStatus, ProviderCheckSummary } from '../../github/pull-request-types' export function derivePRCheckStatus(checks: readonly PRCheckDetail[]): CheckStatus { const { state } = summarizeProviderChecks(checks) diff --git a/src/shared/pr-check-step-status.ts b/src/shared/source-control/checks/pr-check-step-status.ts similarity index 94% rename from src/shared/pr-check-step-status.ts rename to src/shared/source-control/checks/pr-check-step-status.ts index 47bf2e0176e..6ff804b1f9c 100644 --- a/src/shared/pr-check-step-status.ts +++ b/src/shared/source-control/checks/pr-check-step-status.ts @@ -1,4 +1,4 @@ -import type { PRCheckJob, PRCheckStep } from './github/check-types' +import type { PRCheckJob, PRCheckStep } from '../../github/check-types' export type StepOutcome = 'success' | 'failure' | 'skipped' | 'pending' diff --git a/src/shared/pr-checks-fix-prompt.test.ts b/src/shared/source-control/checks/pr-checks-fix-prompt.test.ts similarity index 99% rename from src/shared/pr-checks-fix-prompt.test.ts rename to src/shared/source-control/checks/pr-checks-fix-prompt.test.ts index d3cbb3684a1..05d53ed9ea9 100644 --- a/src/shared/pr-checks-fix-prompt.test.ts +++ b/src/shared/source-control/checks/pr-checks-fix-prompt.test.ts @@ -6,7 +6,7 @@ import { getCheckDetailsPromptKey, truncateLogTailForPrompt } from './pr-checks-fix-prompt' -import type { PRCheckDetail, PRCheckJob, PRCheckRunDetails } from './github/check-types' +import type { PRCheckDetail, PRCheckJob, PRCheckRunDetails } from '../../github/check-types' const failingCheck: PRCheckDetail = { name: 'unit', diff --git a/src/shared/pr-checks-fix-prompt.ts b/src/shared/source-control/checks/pr-checks-fix-prompt.ts similarity index 98% rename from src/shared/pr-checks-fix-prompt.ts rename to src/shared/source-control/checks/pr-checks-fix-prompt.ts index 87b017701d7..dca7aac4ea7 100644 --- a/src/shared/pr-checks-fix-prompt.ts +++ b/src/shared/source-control/checks/pr-checks-fix-prompt.ts @@ -1,4 +1,4 @@ -import type { PRCheckDetail, PRCheckRunDetails } from './github/check-types' +import type { PRCheckDetail, PRCheckRunDetails } from '../../github/check-types' import { getCheckStatusLabel } from './pr-check-status-label' export const PROMPT_LOG_TAIL_LINES = 150 diff --git a/src/shared/provider-check-summary.ts b/src/shared/source-control/checks/provider-check-summary.ts similarity index 98% rename from src/shared/provider-check-summary.ts rename to src/shared/source-control/checks/provider-check-summary.ts index e54e8ff31f3..4dc3ccf5416 100644 --- a/src/shared/provider-check-summary.ts +++ b/src/shared/source-control/checks/provider-check-summary.ts @@ -1,4 +1,4 @@ -import type { CheckStatus, ProviderCheckSummary } from './github/pull-request-types' +import type { CheckStatus, ProviderCheckSummary } from '../../github/pull-request-types' export type CheckOutcome = 'passed' | 'failed' | 'pending' | 'neutral' diff --git a/src/shared/source-control-base-ref-resolution.ts b/src/shared/source-control/decisions/source-control-base-ref-resolution.ts similarity index 98% rename from src/shared/source-control-base-ref-resolution.ts rename to src/shared/source-control/decisions/source-control-base-ref-resolution.ts index 3a0d556bf67..ad574301caf 100644 --- a/src/shared/source-control-base-ref-resolution.ts +++ b/src/shared/source-control/decisions/source-control-base-ref-resolution.ts @@ -1,4 +1,4 @@ -import type { GitUpstreamStatus } from './git-status-types' +import type { GitUpstreamStatus } from '../../git/status/git-status-types' export function resolveSourceControlBaseRef(input: { worktreeBaseRef?: string | null diff --git a/src/shared/source-control-commit-eligibility.ts b/src/shared/source-control/decisions/source-control-commit-eligibility.ts similarity index 100% rename from src/shared/source-control-commit-eligibility.ts rename to src/shared/source-control/decisions/source-control-commit-eligibility.ts diff --git a/src/shared/source-control-create-review-intent.test.ts b/src/shared/source-control/decisions/source-control-create-review-intent.test.ts similarity index 97% rename from src/shared/source-control-create-review-intent.test.ts rename to src/shared/source-control/decisions/source-control-create-review-intent.test.ts index 9e7db1dd0ec..65c07403f91 100644 --- a/src/shared/source-control-create-review-intent.test.ts +++ b/src/shared/source-control/decisions/source-control-create-review-intent.test.ts @@ -4,8 +4,8 @@ import { resolveCreateReviewIntentEligibility, type CreateReviewIntentKind } from './source-control-create-review-intent' -import type { HostedReviewCreationBlockedReason } from './hosted-review' -import type { GitUpstreamStatus } from './git-status-types' +import type { HostedReviewCreationBlockedReason } from '../hosted-review/hosted-review-contracts' +import type { GitUpstreamStatus } from '../../git/status/git-status-types' function unavailableEligibility(blockedReason: HostedReviewCreationBlockedReason) { return { diff --git a/src/shared/source-control-create-review-intent.ts b/src/shared/source-control/decisions/source-control-create-review-intent.ts similarity index 93% rename from src/shared/source-control-create-review-intent.ts rename to src/shared/source-control/decisions/source-control-create-review-intent.ts index 966ef126c8e..c6fb38e00ee 100644 --- a/src/shared/source-control-create-review-intent.ts +++ b/src/shared/source-control/decisions/source-control-create-review-intent.ts @@ -1,6 +1,9 @@ -import { isBehindOnlyUpstream, shouldForcePushWithLeaseForUpstream } from './git-upstream-status' -import { supportsHostedReviewCreation } from './hosted-review-creation-providers' -import type { GitUpstreamStatus } from './git-status-types' +import { + isBehindOnlyUpstream, + shouldForcePushWithLeaseForUpstream +} from '../../git/remotes/git-upstream-status' +import { supportsHostedReviewCreation } from '../hosted-review/hosted-review-creation-providers' +import type { GitUpstreamStatus } from '../../git/status/git-status-types' export type CreateReviewIntentKind = | 'dirty' diff --git a/src/shared/source-control-next-step-decision.test.ts b/src/shared/source-control/decisions/source-control-next-step-decision.test.ts similarity index 98% rename from src/shared/source-control-next-step-decision.test.ts rename to src/shared/source-control/decisions/source-control-next-step-decision.test.ts index 725a4d0d2b2..7f74d7be680 100644 --- a/src/shared/source-control-next-step-decision.test.ts +++ b/src/shared/source-control/decisions/source-control-next-step-decision.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { PRInfo } from './github/pull-request-types' +import type { PRInfo } from '../../github/pull-request-types' import { resolveSourceControlCommitAreaPrimaryActionDecision } from './source-control-primary-action-decision' import type { SourceControlPrimaryActionDecisionInputs } from './source-control-primary-action-decision-types' import { diff --git a/src/shared/source-control-next-step-decision.ts b/src/shared/source-control/decisions/source-control-next-step-decision.ts similarity index 94% rename from src/shared/source-control-next-step-decision.ts rename to src/shared/source-control/decisions/source-control-next-step-decision.ts index 3e2856a192f..ece8744032f 100644 --- a/src/shared/source-control-next-step-decision.ts +++ b/src/shared/source-control/decisions/source-control-next-step-decision.ts @@ -1,10 +1,10 @@ -import type { GitConflictOperation } from './git-status-types' -import type { PRInfo } from './github/pull-request-types' +import type { GitConflictOperation } from '../../git/status/git-status-types' +import type { PRInfo } from '../../github/pull-request-types' import { resolveGitHubPRMergeState, type GitHubPRMergeStateKind -} from './github/pull-request-merge-state' -import { resolveGitHubPRStackMergeDecision } from './github/pull-request-stack-merge' +} from '../../github/pull-request-merge-state' +import { resolveGitHubPRStackMergeDecision } from '../../github/pull-request-stack-merge' import type { SourceControlCommitAreaPrimaryActionDecision } from './source-control-primary-action-decision-types' // What the branch's hosted review creation offers once nothing local is left to do. diff --git a/src/shared/source-control-primary-action-decision-types.ts b/src/shared/source-control/decisions/source-control-primary-action-decision-types.ts similarity index 91% rename from src/shared/source-control-primary-action-decision-types.ts rename to src/shared/source-control/decisions/source-control-primary-action-decision-types.ts index e9eec6e91ce..287009bf53b 100644 --- a/src/shared/source-control-primary-action-decision-types.ts +++ b/src/shared/source-control/decisions/source-control-primary-action-decision-types.ts @@ -1,6 +1,6 @@ -import type { HostedReviewCreationEligibility } from './hosted-review' -import type { GitUpstreamStatus } from './git-status-types' -import type { PRState } from './github/pull-request-types' +import type { HostedReviewCreationEligibility } from '../hosted-review/hosted-review-contracts' +import type { GitUpstreamStatus } from '../../git/status/git-status-types' +import type { PRState } from '../../github/pull-request-types' export type SourceControlPrimaryActionKind = | 'commit' diff --git a/src/shared/source-control-primary-action-decision.test.ts b/src/shared/source-control/decisions/source-control-primary-action-decision.test.ts similarity index 96% rename from src/shared/source-control-primary-action-decision.test.ts rename to src/shared/source-control/decisions/source-control-primary-action-decision.test.ts index b7b47c4a1ea..04687a92e8f 100644 --- a/src/shared/source-control-primary-action-decision.test.ts +++ b/src/shared/source-control/decisions/source-control-primary-action-decision.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest' import { resolveSourceControlCommitAreaPrimaryActionDecision, - resolveSourceControlPrimaryActionDecision, - type SourceControlPrimaryActionDecisionInputs + resolveSourceControlPrimaryActionDecision } from './source-control-primary-action-decision' +import type { SourceControlPrimaryActionDecisionInputs } from './source-control-primary-action-decision-types' function inputs( overrides: Partial = {} diff --git a/src/shared/source-control-primary-action-decision.ts b/src/shared/source-control/decisions/source-control-primary-action-decision.ts similarity index 94% rename from src/shared/source-control-primary-action-decision.ts rename to src/shared/source-control/decisions/source-control-primary-action-decision.ts index 9165622e80f..fb8e18595e9 100644 --- a/src/shared/source-control-primary-action-decision.ts +++ b/src/shared/source-control/decisions/source-control-primary-action-decision.ts @@ -1,5 +1,5 @@ -import { shouldForcePushWithLeaseForUpstream } from './git-upstream-status' -import { supportsHostedReviewCreation } from './hosted-review-creation-providers' +import { shouldForcePushWithLeaseForUpstream } from '../../git/remotes/git-upstream-status' +import { supportsHostedReviewCreation } from '../hosted-review/hosted-review-creation-providers' import { resolveCreateReviewIntentEligibility } from './source-control-create-review-intent' import { resolveSourceControlPrimaryActionDuringRemoteOp } from './source-control-primary-action-in-flight' import type { @@ -9,14 +9,6 @@ import type { } from './source-control-primary-action-decision-types' import { resolveUnpublishedSourceControlPrimaryAction } from './source-control-primary-unpublished-action' -export type { - SourceControlPrimaryActionKind, - SourceControlRemoteOpKind, - SourceControlCommitAreaPrimaryActionDecision, - SourceControlPrimaryActionDecision, - SourceControlPrimaryActionDecisionInputs -} from './source-control-primary-action-decision-types' - export function resolveSourceControlPrimaryActionDecision( inputs: SourceControlPrimaryActionDecisionInputs ): SourceControlPrimaryActionDecision { diff --git a/src/shared/source-control-primary-action-in-flight.ts b/src/shared/source-control/decisions/source-control-primary-action-in-flight.ts similarity index 100% rename from src/shared/source-control-primary-action-in-flight.ts rename to src/shared/source-control/decisions/source-control-primary-action-in-flight.ts diff --git a/src/shared/source-control-primary-unpublished-action.ts b/src/shared/source-control/decisions/source-control-primary-unpublished-action.ts similarity index 100% rename from src/shared/source-control-primary-unpublished-action.ts rename to src/shared/source-control/decisions/source-control-primary-unpublished-action.ts diff --git a/src/shared/source-control-dropdown-action-context.ts b/src/shared/source-control/dropdown/source-control-dropdown-action-context.ts similarity index 93% rename from src/shared/source-control-dropdown-action-context.ts rename to src/shared/source-control/dropdown/source-control-dropdown-action-context.ts index 3eb8e153e1d..a4fe76fd752 100644 --- a/src/shared/source-control-dropdown-action-context.ts +++ b/src/shared/source-control/dropdown/source-control-dropdown-action-context.ts @@ -1,9 +1,12 @@ // Derive shared branch/review facts once so dropdown labels and disabled states cannot disagree. -import type { SourceControlPrimaryActionDecisionInputs } from './source-control-primary-action-decision-types' -import { canSubmitCommit, resolveCommitDisabledReason } from './source-control-commit-eligibility' -import type { GitConflictOperation } from './git-status-types' -import { shouldForcePushWithLeaseForUpstream } from './git-upstream-status' +import type { SourceControlPrimaryActionDecisionInputs } from '../decisions/source-control-primary-action-decision-types' +import { + canSubmitCommit, + resolveCommitDisabledReason +} from '../decisions/source-control-commit-eligibility' +import type { GitConflictOperation } from '../../git/status/git-status-types' +import { shouldForcePushWithLeaseForUpstream } from '../../git/remotes/git-upstream-status' import type { DropdownActionInputs } from './source-control-dropdown-item-types' export type DropdownActionContext = { diff --git a/src/shared/source-control-dropdown-commit-items.ts b/src/shared/source-control/dropdown/source-control-dropdown-commit-items.ts similarity index 98% rename from src/shared/source-control-dropdown-commit-items.ts rename to src/shared/source-control/dropdown/source-control-dropdown-commit-items.ts index f1dbb4d7371..a3a8e50ba14 100644 --- a/src/shared/source-control-dropdown-commit-items.ts +++ b/src/shared/source-control/dropdown/source-control-dropdown-commit-items.ts @@ -1,6 +1,6 @@ // Share commit blockers across Commit, Commit & Push, and Commit & Sync so disabled reasons agree. -import type { CommitDisabledReason } from './source-control-commit-eligibility' +import type { CommitDisabledReason } from '../decisions/source-control-commit-eligibility' import type { DropdownItem } from './source-control-dropdown-item-types' import type { DropdownActionContext } from './source-control-dropdown-action-context' diff --git a/src/shared/source-control-dropdown-item-types.ts b/src/shared/source-control/dropdown/source-control-dropdown-item-types.ts similarity index 87% rename from src/shared/source-control-dropdown-item-types.ts rename to src/shared/source-control/dropdown/source-control-dropdown-item-types.ts index c9740248df6..ac0a2b288a5 100644 --- a/src/shared/source-control-dropdown-item-types.ts +++ b/src/shared/source-control/dropdown/source-control-dropdown-item-types.ts @@ -1,7 +1,7 @@ // Keep row types independent so consumers do not import the full resolver state machine. -import type { SourceControlPrimaryActionDecisionInputs } from './source-control-primary-action-decision-types' -import type { GitConflictOperation } from './git-status-types' +import type { SourceControlPrimaryActionDecisionInputs } from '../decisions/source-control-primary-action-decision-types' +import type { GitConflictOperation } from '../../git/status/git-status-types' export type DropdownActionInputs = SourceControlPrimaryActionDecisionInputs & { conflictOperation?: GitConflictOperation diff --git a/src/shared/source-control-dropdown-labels.ts b/src/shared/source-control/dropdown/source-control-dropdown-labels.ts similarity index 100% rename from src/shared/source-control-dropdown-labels.ts rename to src/shared/source-control/dropdown/source-control-dropdown-labels.ts diff --git a/src/shared/source-control-dropdown-remote-copy.ts b/src/shared/source-control/dropdown/source-control-dropdown-remote-copy.ts similarity index 100% rename from src/shared/source-control-dropdown-remote-copy.ts rename to src/shared/source-control/dropdown/source-control-dropdown-remote-copy.ts diff --git a/src/shared/source-control-dropdown-remote-items.ts b/src/shared/source-control/dropdown/source-control-dropdown-remote-items.ts similarity index 100% rename from src/shared/source-control-dropdown-remote-items.ts rename to src/shared/source-control/dropdown/source-control-dropdown-remote-items.ts diff --git a/src/shared/hosted-review.ts b/src/shared/source-control/hosted-review/hosted-review-contracts.ts similarity index 99% rename from src/shared/hosted-review.ts rename to src/shared/source-control/hosted-review/hosted-review-contracts.ts index 4372975e28c..27ec25599bf 100644 --- a/src/shared/hosted-review.ts +++ b/src/shared/source-control/hosted-review/hosted-review-contracts.ts @@ -6,7 +6,7 @@ import type { PRMergeableState, PRReviewDecision, ProviderCheckSummary -} from './github/pull-request-types' +} from '../../github/pull-request-types' export type HostedReviewProvider = | 'github' diff --git a/src/shared/hosted-review-create-confirmation.test.ts b/src/shared/source-control/hosted-review/hosted-review-create-confirmation.test.ts similarity index 98% rename from src/shared/hosted-review-create-confirmation.test.ts rename to src/shared/source-control/hosted-review/hosted-review-create-confirmation.test.ts index af32587b5c6..94e1ed86a05 100644 --- a/src/shared/hosted-review-create-confirmation.test.ts +++ b/src/shared/source-control/hosted-review/hosted-review-create-confirmation.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { HostedReviewCreationEligibility } from './hosted-review' +import type { HostedReviewCreationEligibility } from './hosted-review-contracts' import { isHostedReviewCreateEligibilityConfirmable } from './hosted-review-create-confirmation' function eligibility( diff --git a/src/shared/hosted-review-create-confirmation.ts b/src/shared/source-control/hosted-review/hosted-review-create-confirmation.ts similarity index 100% rename from src/shared/hosted-review-create-confirmation.ts rename to src/shared/source-control/hosted-review/hosted-review-create-confirmation.ts diff --git a/src/shared/hosted-review-create-seed.test.ts b/src/shared/source-control/hosted-review/hosted-review-create-seed.test.ts similarity index 100% rename from src/shared/hosted-review-create-seed.test.ts rename to src/shared/source-control/hosted-review/hosted-review-create-seed.test.ts diff --git a/src/shared/hosted-review-create-seed.ts b/src/shared/source-control/hosted-review/hosted-review-create-seed.ts similarity index 91% rename from src/shared/hosted-review-create-seed.ts rename to src/shared/source-control/hosted-review/hosted-review-create-seed.ts index ee071fb6e45..dc8a41861b4 100644 --- a/src/shared/hosted-review-create-seed.ts +++ b/src/shared/source-control/hosted-review/hosted-review-create-seed.ts @@ -1,8 +1,8 @@ -import { escapeRegex } from './string-utils' -import { JIRA_ISSUE_KEY_PATTERN } from './jira/jira-issue-url' -import { prefixJiraReviewTitle } from './jira/jira-review-title' -import { humanizeBranchSlug } from './branch-name-from-work' -import type { HostedReviewCreationEligibility } from './hosted-review' +import { escapeRegex } from '../../string-utils' +import { JIRA_ISSUE_KEY_PATTERN } from '../../jira/jira-issue-url' +import { prefixJiraReviewTitle } from '../../jira/jira-review-title' +import { humanizeBranchSlug } from '../ai/naming/branch-name-from-work' +import type { HostedReviewCreationEligibility } from './hosted-review-contracts' import { normalizeHostedReviewHeadRef } from './hosted-review-refs' export function resolveCreateReviewDraftTitle({ diff --git a/src/shared/hosted-review-creation-providers.test.ts b/src/shared/source-control/hosted-review/hosted-review-creation-providers.test.ts similarity index 100% rename from src/shared/hosted-review-creation-providers.test.ts rename to src/shared/source-control/hosted-review/hosted-review-creation-providers.test.ts diff --git a/src/shared/hosted-review-creation-providers.ts b/src/shared/source-control/hosted-review/hosted-review-creation-providers.ts similarity index 91% rename from src/shared/hosted-review-creation-providers.ts rename to src/shared/source-control/hosted-review/hosted-review-creation-providers.ts index c55fb1b112c..5829446b74f 100644 --- a/src/shared/hosted-review-creation-providers.ts +++ b/src/shared/source-control/hosted-review/hosted-review-creation-providers.ts @@ -1,4 +1,4 @@ -import type { HostedReviewProvider } from './hosted-review' +import type { HostedReviewProvider } from './hosted-review-contracts' export type HostedReviewCreationProvider = | 'github' diff --git a/src/shared/hosted-review-github.test.ts b/src/shared/source-control/hosted-review/hosted-review-github.test.ts similarity index 93% rename from src/shared/hosted-review-github.test.ts rename to src/shared/source-control/hosted-review/hosted-review-github.test.ts index 1ad43f32b99..1b789ae3f6c 100644 --- a/src/shared/hosted-review-github.test.ts +++ b/src/shared/source-control/hosted-review/hosted-review-github.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' import { hostedReviewInfoFromGitHubPRInfo } from './hosted-review-github' -import type { PRInfo } from './github/pull-request-types' +import type { PRInfo } from '../../github/pull-request-types' const pr: PRInfo = { number: 12, diff --git a/src/shared/hosted-review-github.ts b/src/shared/source-control/hosted-review/hosted-review-github.ts similarity index 89% rename from src/shared/hosted-review-github.ts rename to src/shared/source-control/hosted-review/hosted-review-github.ts index fc7b348dd53..0624f0e539b 100644 --- a/src/shared/hosted-review-github.ts +++ b/src/shared/source-control/hosted-review/hosted-review-github.ts @@ -1,5 +1,5 @@ -import type { HostedReviewInfo } from './hosted-review' -import type { PRInfo } from './github/pull-request-types' +import type { HostedReviewInfo } from './hosted-review-contracts' +import type { PRInfo } from '../../github/pull-request-types' export function hostedReviewInfoFromGitHubPRInfo(pr: PRInfo): HostedReviewInfo { return { diff --git a/src/shared/hosted-review-push-target.test.ts b/src/shared/source-control/hosted-review/hosted-review-push-target.test.ts similarity index 100% rename from src/shared/hosted-review-push-target.test.ts rename to src/shared/source-control/hosted-review/hosted-review-push-target.test.ts diff --git a/src/shared/hosted-review-push-target.ts b/src/shared/source-control/hosted-review/hosted-review-push-target.ts similarity index 91% rename from src/shared/hosted-review-push-target.ts rename to src/shared/source-control/hosted-review/hosted-review-push-target.ts index 797401ba632..24f8d44edeb 100644 --- a/src/shared/hosted-review-push-target.ts +++ b/src/shared/source-control/hosted-review/hosted-review-push-target.ts @@ -1,9 +1,9 @@ -import type { GitUpstreamStatus } from './git-status-types' -import type { GitPushTarget } from './worktree/types' -import type { HostedReviewState } from './hosted-review' -import { isPositiveHostedReviewNumber } from './hosted-review' -import { getPublishTargetDisplayName } from './git-publish-target-status' -import { gitRefTargetsBranchName } from './git-remote-branch-name' +import type { GitUpstreamStatus } from '../../git/status/git-status-types' +import type { GitPushTarget } from '../../worktree/types' +import type { HostedReviewState } from './hosted-review-contracts' +import { isPositiveHostedReviewNumber } from './hosted-review-contracts' +import { getPublishTargetDisplayName } from '../../git/remotes/git-publish-target-status' +import { gitRefTargetsBranchName } from '../../git/remotes/git-remote-branch-name' export function hasUsableHostedReviewPushTarget(args: { pushTarget?: GitPushTarget diff --git a/src/shared/hosted-review-refs.test.ts b/src/shared/source-control/hosted-review/hosted-review-refs.test.ts similarity index 100% rename from src/shared/hosted-review-refs.test.ts rename to src/shared/source-control/hosted-review/hosted-review-refs.test.ts diff --git a/src/shared/hosted-review-refs.ts b/src/shared/source-control/hosted-review/hosted-review-refs.ts similarity index 96% rename from src/shared/hosted-review-refs.ts rename to src/shared/source-control/hosted-review/hosted-review-refs.ts index 163acea052a..61b4df7d472 100644 --- a/src/shared/hosted-review-refs.ts +++ b/src/shared/source-control/hosted-review/hosted-review-refs.ts @@ -1,4 +1,4 @@ -import type { BaseRefSearchResult } from './repo-types' +import type { BaseRefSearchResult } from '../../repo-types' export function normalizeHostedReviewHeadRef(ref: string): string { return ref diff --git a/src/shared/stacked-hosted-review-failure-copy.ts b/src/shared/source-control/hosted-review/stacked-hosted-review-failure-copy.ts similarity index 99% rename from src/shared/stacked-hosted-review-failure-copy.ts rename to src/shared/source-control/hosted-review/stacked-hosted-review-failure-copy.ts index bd8236b6bae..0995cab686d 100644 --- a/src/shared/stacked-hosted-review-failure-copy.ts +++ b/src/shared/source-control/hosted-review/stacked-hosted-review-failure-copy.ts @@ -1,4 +1,4 @@ -import type { CreateHostedReviewErrorCode } from './hosted-review' +import type { CreateHostedReviewErrorCode } from './hosted-review-contracts' // One English table for stacked PR failures: main builds the wire `error`, the renderer translates by `reason`. export const STACKED_REVIEW_FAILURE_COPY = { diff --git a/src/shared/source-control-discard-all-sequence.test.ts b/src/shared/source-control/listing/source-control-discard-all-sequence.test.ts similarity index 99% rename from src/shared/source-control-discard-all-sequence.test.ts rename to src/shared/source-control/listing/source-control-discard-all-sequence.test.ts index 30dd777be2d..bb6178328fc 100644 --- a/src/shared/source-control-discard-all-sequence.test.ts +++ b/src/shared/source-control/listing/source-control-discard-all-sequence.test.ts @@ -6,7 +6,7 @@ import { isStageableStatusEntry, runDiscardAllForArea } from './source-control-discard-all-sequence' -import type { GitStatusEntry } from './git-status-types' +import type { GitStatusEntry } from '../../git/status/git-status-types' function entry(partial: Partial & { path: string }): GitStatusEntry { return { diff --git a/src/shared/source-control-discard-all-sequence.ts b/src/shared/source-control/listing/source-control-discard-all-sequence.ts similarity index 98% rename from src/shared/source-control-discard-all-sequence.ts rename to src/shared/source-control/listing/source-control-discard-all-sequence.ts index efdf323f105..2a72aa84125 100644 --- a/src/shared/source-control-discard-all-sequence.ts +++ b/src/shared/source-control/listing/source-control-discard-all-sequence.ts @@ -1,4 +1,4 @@ -import type { GitStatusEntry } from './git-status-types' +import type { GitStatusEntry } from '../../git/status/git-status-types' export type DiscardAllArea = 'staged' | 'unstaged' | 'untracked' diff --git a/src/shared/source-control-entry-actions.test.ts b/src/shared/source-control/listing/source-control-entry-actions.test.ts similarity index 95% rename from src/shared/source-control-entry-actions.test.ts rename to src/shared/source-control/listing/source-control-entry-actions.test.ts index e5a58129f09..94877668ce3 100644 --- a/src/shared/source-control-entry-actions.test.ts +++ b/src/shared/source-control/listing/source-control-entry-actions.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { GitStatusEntry } from './git-status-types' +import type { GitStatusEntry } from '../../git/status/git-status-types' import { getConflictResolutions } from './source-control-entry-actions' function conflict(overrides: Partial): GitStatusEntry { diff --git a/src/shared/source-control-entry-actions.ts b/src/shared/source-control/listing/source-control-entry-actions.ts similarity index 95% rename from src/shared/source-control-entry-actions.ts rename to src/shared/source-control/listing/source-control-entry-actions.ts index 27046734e8f..1c729e44c52 100644 --- a/src/shared/source-control-entry-actions.ts +++ b/src/shared/source-control/listing/source-control-entry-actions.ts @@ -1,4 +1,4 @@ -import type { GitStatusEntry } from './git-status-types' +import type { GitStatusEntry } from '../../git/status/git-status-types' import { isStageableStatusEntry, isWorktreeUndiscardableGitlink diff --git a/src/shared/source-control-group-order.test.ts b/src/shared/source-control/listing/source-control-group-order.test.ts similarity index 100% rename from src/shared/source-control-group-order.test.ts rename to src/shared/source-control/listing/source-control-group-order.test.ts diff --git a/src/shared/source-control-group-order.ts b/src/shared/source-control/listing/source-control-group-order.ts similarity index 83% rename from src/shared/source-control-group-order.ts rename to src/shared/source-control/listing/source-control-group-order.ts index 334df608cc4..1e1d4bf396f 100644 --- a/src/shared/source-control-group-order.ts +++ b/src/shared/source-control/listing/source-control-group-order.ts @@ -1,4 +1,4 @@ -import type { SourceControlGroupOrder } from './ui-chrome-types' +import type { SourceControlGroupOrder } from '../../ui-chrome-types' export const DEFAULT_SOURCE_CONTROL_GROUP_ORDER = 'changes-first' satisfies SourceControlGroupOrder diff --git a/src/shared/source-control-section-order.test.ts b/src/shared/source-control/listing/source-control-section-order.test.ts similarity index 98% rename from src/shared/source-control-section-order.test.ts rename to src/shared/source-control/listing/source-control-section-order.test.ts index 62e4e3a2aa4..2eefd91da68 100644 --- a/src/shared/source-control-section-order.test.ts +++ b/src/shared/source-control/listing/source-control-section-order.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { GitStatusEntry } from './git-status-types' +import type { GitStatusEntry } from '../../git/status/git-status-types' import { buildSourceControlDisplaySections, getSourceControlSectionViewAction, diff --git a/src/shared/source-control-section-order.ts b/src/shared/source-control/listing/source-control-section-order.ts similarity index 96% rename from src/shared/source-control-section-order.ts rename to src/shared/source-control/listing/source-control-section-order.ts index 8c124848613..22706f231ed 100644 --- a/src/shared/source-control-section-order.ts +++ b/src/shared/source-control/listing/source-control-section-order.ts @@ -1,7 +1,7 @@ -import { compareGitStatusEntries } from './git-status-sort' +import { compareGitStatusEntries } from '../../git/status/git-status-sort' import { normalizeSourceControlGroupOrder } from './source-control-group-order' -import type { GitStatusEntry } from './git-status-types' -import type { SourceControlGroupOrder } from './ui-chrome-types' +import type { GitStatusEntry } from '../../git/status/git-status-types' +import type { SourceControlGroupOrder } from '../../ui-chrome-types' export const SOURCE_CONTROL_AREAS = ['unstaged', 'staged', 'untracked'] as const export type SourceControlSectionArea = (typeof SOURCE_CONTROL_AREAS)[number] diff --git a/src/shared/source-control-tree.test.ts b/src/shared/source-control/listing/source-control-tree.test.ts similarity index 98% rename from src/shared/source-control-tree.test.ts rename to src/shared/source-control/listing/source-control-tree.test.ts index 99b5dc80a7b..d89f6129cc8 100644 --- a/src/shared/source-control-tree.test.ts +++ b/src/shared/source-control/listing/source-control-tree.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import type { GitStatusEntry } from './git-status-types' +import type { GitStatusEntry } from '../../git/status/git-status-types' import { buildGitStatusSourceControlTree, buildSourceControlTree, diff --git a/src/shared/source-control-tree.ts b/src/shared/source-control/listing/source-control-tree.ts similarity index 96% rename from src/shared/source-control-tree.ts rename to src/shared/source-control/listing/source-control-tree.ts index a19f4a180f9..f1d5a35ab7f 100644 --- a/src/shared/source-control-tree.ts +++ b/src/shared/source-control/listing/source-control-tree.ts @@ -1,7 +1,7 @@ -import { normalizeRelativePath, splitPathSegments } from './cross-platform-path' -import type { GitStagingArea, GitStatusEntry } from './git-status-types' -import { compareFileNames } from './file-name-sort' -import { compareGitStatusEntries } from './git-status-sort' +import { normalizeRelativePath, splitPathSegments } from '../../cross-platform-path' +import type { GitStagingArea, GitStatusEntry } from '../../git/status/git-status-types' +import { compareFileNames } from '../../file-name-sort' +import { compareGitStatusEntries } from '../../git/status/git-status-sort' export type SourceControlTreeArea = Extract // Keep entry shapes generic because committed branch rows lack uncommitted status metadata. diff --git a/src/shared/source-control-commit-failure-agent-command.ts b/src/shared/source-control/recovery/source-control-commit-failure-agent-command.ts similarity index 100% rename from src/shared/source-control-commit-failure-agent-command.ts rename to src/shared/source-control/recovery/source-control-commit-failure-agent-command.ts diff --git a/src/shared/source-control-commit-failure.ts b/src/shared/source-control/recovery/source-control-commit-failure.ts similarity index 98% rename from src/shared/source-control-commit-failure.ts rename to src/shared/source-control/recovery/source-control-commit-failure.ts index 1a12eae16c0..fb6c36254bf 100644 --- a/src/shared/source-control-commit-failure.ts +++ b/src/shared/source-control/recovery/source-control-commit-failure.ts @@ -1,8 +1,8 @@ import { stripAnsiEscapeSequences, TERMINAL_CONTROL_CHARACTER_PATTERN -} from './ansi-escape-sequences' -import type { GitStatusEntry } from './git-status-types' +} from '../../ansi-escape-sequences' +import type { GitStatusEntry } from '../../git/status/git-status-types' const FALLBACK_COMMIT_FAILURE_SUMMARY = 'Commit failed.' const LINT_COMMIT_FAILURE_SUMMARY = 'Lint failed during commit.' diff --git a/src/shared/source-control-conflict-prompts.ts b/src/shared/source-control/recovery/source-control-conflict-prompts.ts similarity index 99% rename from src/shared/source-control-conflict-prompts.ts rename to src/shared/source-control/recovery/source-control-conflict-prompts.ts index f09b11e1900..f5106b809e5 100644 --- a/src/shared/source-control-conflict-prompts.ts +++ b/src/shared/source-control/recovery/source-control-conflict-prompts.ts @@ -1,4 +1,8 @@ -import type { GitConflictKind, GitConflictOperation, GitStatusEntry } from './git-status-types' +import type { + GitConflictKind, + GitConflictOperation, + GitStatusEntry +} from '../../git/status/git-status-types' export const CONFLICT_KIND_LABELS: Record = { both_modified: 'Both modified', diff --git a/src/shared/source-control-push-failure-agent-command.ts b/src/shared/source-control/recovery/source-control-push-failure-agent-command.ts similarity index 100% rename from src/shared/source-control-push-failure-agent-command.ts rename to src/shared/source-control/recovery/source-control-push-failure-agent-command.ts diff --git a/src/shared/source-control-push-failure.test.ts b/src/shared/source-control/recovery/source-control-push-failure.test.ts similarity index 100% rename from src/shared/source-control-push-failure.test.ts rename to src/shared/source-control/recovery/source-control-push-failure.test.ts diff --git a/src/shared/source-control-push-failure.ts b/src/shared/source-control/recovery/source-control-push-failure.ts similarity index 98% rename from src/shared/source-control-push-failure.ts rename to src/shared/source-control/recovery/source-control-push-failure.ts index 0f0694516b3..91f974fa109 100644 --- a/src/shared/source-control-push-failure.ts +++ b/src/shared/source-control/recovery/source-control-push-failure.ts @@ -1,8 +1,8 @@ import { stripAnsiEscapeSequences, TERMINAL_CONTROL_CHARACTER_PATTERN -} from './ansi-escape-sequences' -import type { GitStatusEntry } from './git-status-types' +} from '../../ansi-escape-sequences' +import type { GitStatusEntry } from '../../git/status/git-status-types' const FALLBACK_PUSH_FAILURE_SUMMARY = 'Push failed.' export const LINT_PUSH_FAILURE_SUMMARY = 'Lint failed during push.' diff --git a/src/shared/source-control-recovery-agent-command.ts b/src/shared/source-control/recovery/source-control-recovery-agent-command.ts similarity index 92% rename from src/shared/source-control-recovery-agent-command.ts rename to src/shared/source-control/recovery/source-control-recovery-agent-command.ts index 9928e48c6d2..8e7ca11ee19 100644 --- a/src/shared/source-control-recovery-agent-command.ts +++ b/src/shared/source-control/recovery/source-control-recovery-agent-command.ts @@ -2,7 +2,7 @@ import { DEFAULT_SOURCE_CONTROL_ACTION_COMMAND_TEMPLATES, renderSourceControlActionCommandTemplate, type SourceControlLaunchActionId -} from './source-control-ai-actions' +} from '../ai/recipes/source-control-ai-actions' export function buildSourceControlRecoveryAgentCommandInput({ actionId, diff --git a/src/shared/pr-bot-author-overrides.test.ts b/src/shared/source-control/review-comments/pr-bot-author-overrides.test.ts similarity index 100% rename from src/shared/pr-bot-author-overrides.test.ts rename to src/shared/source-control/review-comments/pr-bot-author-overrides.test.ts diff --git a/src/shared/pr-bot-author-overrides.ts b/src/shared/source-control/review-comments/pr-bot-author-overrides.ts similarity index 100% rename from src/shared/pr-bot-author-overrides.ts rename to src/shared/source-control/review-comments/pr-bot-author-overrides.ts diff --git a/src/shared/pr-comment-audience.test.ts b/src/shared/source-control/review-comments/pr-comment-audience.test.ts similarity index 98% rename from src/shared/pr-comment-audience.test.ts rename to src/shared/source-control/review-comments/pr-comment-audience.test.ts index 76fb50fa888..1788bd9312c 100644 --- a/src/shared/pr-comment-audience.test.ts +++ b/src/shared/source-control/review-comments/pr-comment-audience.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { PRComment } from './github/comment-types' +import type { PRComment } from '../../github/comment-types' import { createBotAuthorOverrideSet } from './pr-bot-author-overrides' import { filterPRCommentsByAudience, diff --git a/src/shared/pr-comment-audience.ts b/src/shared/source-control/review-comments/pr-comment-audience.ts similarity index 97% rename from src/shared/pr-comment-audience.ts rename to src/shared/source-control/review-comments/pr-comment-audience.ts index 7542c17d851..63c80dc84a0 100644 --- a/src/shared/pr-comment-audience.ts +++ b/src/shared/source-control/review-comments/pr-comment-audience.ts @@ -1,4 +1,4 @@ -import type { PRComment } from './github/comment-types' +import type { PRComment } from '../../github/comment-types' import { normalizePRCommentAuthorLogin } from './pr-bot-author-overrides' export type PRCommentAudienceFilter = 'all' | 'human' | 'bot' diff --git a/src/shared/pr-comment-groups.test.ts b/src/shared/source-control/review-comments/pr-comment-groups.test.ts similarity index 94% rename from src/shared/pr-comment-groups.test.ts rename to src/shared/source-control/review-comments/pr-comment-groups.test.ts index 06b801fbf66..8854802d179 100644 --- a/src/shared/pr-comment-groups.test.ts +++ b/src/shared/source-control/review-comments/pr-comment-groups.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { PRComment } from './github/comment-types' +import type { PRComment } from '../../github/comment-types' import { getPRCommentGroupCount, getPRCommentGroupId, diff --git a/src/shared/pr-comment-groups.ts b/src/shared/source-control/review-comments/pr-comment-groups.ts similarity index 96% rename from src/shared/pr-comment-groups.ts rename to src/shared/source-control/review-comments/pr-comment-groups.ts index 119af69c72c..728bb888efa 100644 --- a/src/shared/pr-comment-groups.ts +++ b/src/shared/source-control/review-comments/pr-comment-groups.ts @@ -1,4 +1,4 @@ -import type { PRComment } from './github/comment-types' +import type { PRComment } from '../../github/comment-types' export type PRCommentGroup = | { kind: 'standalone'; comment: PRComment } diff --git a/src/shared/pr-comment-time.test.ts b/src/shared/source-control/review-comments/pr-comment-time.test.ts similarity index 100% rename from src/shared/pr-comment-time.test.ts rename to src/shared/source-control/review-comments/pr-comment-time.test.ts diff --git a/src/shared/pr-comment-time.ts b/src/shared/source-control/review-comments/pr-comment-time.ts similarity index 100% rename from src/shared/pr-comment-time.ts rename to src/shared/source-control/review-comments/pr-comment-time.ts diff --git a/src/shared/github/pr-comments-resolution-prompt.test.ts b/src/shared/source-control/review-comments/pr-comments-resolution-prompt.test.ts similarity index 100% rename from src/shared/github/pr-comments-resolution-prompt.test.ts rename to src/shared/source-control/review-comments/pr-comments-resolution-prompt.test.ts diff --git a/src/shared/github/pr-comments-resolution-prompt.ts b/src/shared/source-control/review-comments/pr-comments-resolution-prompt.ts similarity index 97% rename from src/shared/github/pr-comments-resolution-prompt.ts rename to src/shared/source-control/review-comments/pr-comments-resolution-prompt.ts index 26506b9eaf7..17cd982080b 100644 --- a/src/shared/github/pr-comments-resolution-prompt.ts +++ b/src/shared/source-control/review-comments/pr-comments-resolution-prompt.ts @@ -1,5 +1,5 @@ -import type { PRComment } from './comment-types' -import type { PRCommentGroup } from '../pr-comment-groups' +import type { PRComment } from '../../github/comment-types' +import type { PRCommentGroup } from './pr-comment-groups' export type PRCommentsResolutionReviewKind = 'PR' | 'MR' diff --git a/src/shared/source-control-runtime-capabilities.ts b/src/shared/source-control/runtime/source-control-runtime-capabilities.ts similarity index 100% rename from src/shared/source-control-runtime-capabilities.ts rename to src/shared/source-control/runtime/source-control-runtime-capabilities.ts diff --git a/src/shared/terminal-git-credential-guard.ts b/src/shared/terminal-git-credential-guard.ts index 001b17eb2a4..9c13e6f7f3c 100644 --- a/src/shared/terminal-git-credential-guard.ts +++ b/src/shared/terminal-git-credential-guard.ts @@ -1,5 +1,5 @@ import { recognizeAgentLaunchCommand } from './agent-launch/startup/agent-command-line-intent' -import { gitCredentialPromptGuardEnv } from './git-credential-prompt-env' +import { gitCredentialPromptGuardEnv } from './git/commands/git-credential-prompt-env' const GIT_CONFIG_PROTOCOL_KEY_RE = /^GIT_CONFIG_(?:COUNT|KEY_\d+|VALUE_\d+)$/ diff --git a/src/shared/workspace-cleanup-filter-model.ts b/src/shared/workspace-cleanup-filter-model.ts index edc326c8eac..a7edf42d4e7 100644 --- a/src/shared/workspace-cleanup-filter-model.ts +++ b/src/shared/workspace-cleanup-filter-model.ts @@ -1,5 +1,5 @@ import type { ExecutionHostId } from './execution-host' -import type { HostedReviewProvider } from './hosted-review' +import type { HostedReviewProvider } from './source-control/hosted-review/hosted-review-contracts' import type { WorkspaceCleanupBlocker } from './workspace-cleanup' /** `any` leaves the facet unconstrained; `only`/`exclude` narrow to rows with/without the trait. */ diff --git a/src/shared/workspace-cleanup-filter-state-codec.ts b/src/shared/workspace-cleanup-filter-state-codec.ts index 401d1106f41..d3161dbf4c9 100644 --- a/src/shared/workspace-cleanup-filter-state-codec.ts +++ b/src/shared/workspace-cleanup-filter-state-codec.ts @@ -1,5 +1,5 @@ import { normalizeExecutionHostId, type ExecutionHostId } from './execution-host' -import type { HostedReviewProvider } from './hosted-review' +import type { HostedReviewProvider } from './source-control/hosted-review/hosted-review-contracts' import { WORKSPACE_CLEANUP_AGENT_STATE_VALUES, WORKSPACE_CLEANUP_BLOCKER_MODE_VALUES, diff --git a/src/shared/workspace-layout/workspace-layout-load-workspace.ts b/src/shared/workspace-layout/workspace-layout-load-workspace.ts index 5182003c666..9b3e339a8e9 100644 --- a/src/shared/workspace-layout/workspace-layout-load-workspace.ts +++ b/src/shared/workspace-layout/workspace-layout-load-workspace.ts @@ -1,5 +1,5 @@ import { ORCA_LAYOUT_OWNER_IS_MAIN } from '../layout-owner-switch' -import { checkRunDetailsOwnerScope } from '../check-run-details-owner-scope' +import { checkRunDetailsOwnerScope } from '../source-control/checks/check-run-details-owner-scope' import type { Tab } from '../tab-types' import { normalizeTerminalLayoutPtyOwnership } from '../terminal-layout-pty-ownership' import { sanitizeTerminalLayoutPaneTitles } from '../terminal-pane-title-sanitization' diff --git a/src/shared/workspace-review-checks.test.ts b/src/shared/workspace-review-checks.test.ts index bb33c67f1b0..aec06ca5652 100644 --- a/src/shared/workspace-review-checks.test.ts +++ b/src/shared/workspace-review-checks.test.ts @@ -1,7 +1,10 @@ -import { getProviderChecksOutcome, summarizeProviderChecks } from './provider-check-summary' +import { + getProviderChecksOutcome, + summarizeProviderChecks +} from './source-control/checks/provider-check-summary' import { describe, expect, it } from 'vitest' import type { WorkspaceAttachment } from './worktree/types' -import type { HostedReviewState } from './hosted-review' +import type { HostedReviewState } from './source-control/hosted-review/hosted-review-contracts' import { getWorkspaceAttachmentKey } from './workspace-attachment-normalization' import { summarizeWorkspaceReviewChecks, diff --git a/src/shared/workspace-review-checks.ts b/src/shared/workspace-review-checks.ts index 2b5baa63f7b..26dcd83ad72 100644 --- a/src/shared/workspace-review-checks.ts +++ b/src/shared/workspace-review-checks.ts @@ -1,6 +1,9 @@ import type { CheckStatus, ProviderCheckSummary } from './github/pull-request-types' -import type { HostedReviewState } from './hosted-review' -import { resolveProviderCheckState, getProviderChecksOutcome } from './provider-check-summary' +import type { HostedReviewState } from './source-control/hosted-review/hosted-review-contracts' +import { + resolveProviderCheckState, + getProviderChecksOutcome +} from './source-control/checks/provider-check-summary' import type { WorkspaceAttachment } from './worktree/types' import { getWorkspaceAttachmentKey, diff --git a/src/shared/workspace-space-change.ts b/src/shared/workspace-space-change.ts index 059ed75385e..366c518c717 100644 --- a/src/shared/workspace-space-change.ts +++ b/src/shared/workspace-space-change.ts @@ -1,4 +1,4 @@ -import type { GitStagingArea } from './git-status-types' +import type { GitStagingArea } from './git/status/git-status-types' export type WorkspaceSpaceChange = { path: string; area: GitStagingArea } diff --git a/src/shared/worktree/local-base-branch-fast-forward-real-git.test.ts b/src/shared/worktree/local-base-branch-fast-forward-real-git.test.ts index 29d5bdbf197..37923b25140 100644 --- a/src/shared/worktree/local-base-branch-fast-forward-real-git.test.ts +++ b/src/shared/worktree/local-base-branch-fast-forward-real-git.test.ts @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { pathToFileURL } from 'node:url' import { afterEach, describe, expect, it } from 'vitest' -import { parseWorktreeList } from '../git-worktree-porcelain-parser' +import { parseWorktreeList } from '../git/worktrees/git-worktree-porcelain-parser' import { fastForwardLocalBaseBranch, type LocalBaseBranchGit diff --git a/src/shared/worktree/local-base-branch-fast-forward.ts b/src/shared/worktree/local-base-branch-fast-forward.ts index e7cbbb1335c..56e943fdca8 100644 --- a/src/shared/worktree/local-base-branch-fast-forward.ts +++ b/src/shared/worktree/local-base-branch-fast-forward.ts @@ -1,7 +1,7 @@ -import { readGitCommandFailureText } from '../git-command-failure-text' -import { retryOnGitLockContention } from '../git-lock-contention' -import { parseGitRevListAheadBehindCounts } from '../git-rev-list-output' -import { isShowRefNoMatchError } from '../git-show-ref-no-match' +import { readGitCommandFailureText } from '../git/commands/git-command-failure-text' +import { retryOnGitLockContention } from '../git/commands/git-lock-contention' +import { parseGitRevListAheadBehindCounts } from '../git/refs/git-rev-list-output' +import { isShowRefNoMatchError } from '../git/refs/git-show-ref-no-match' import type { LocalBaseRefRefreshResult } from './base-ref-drift-types' /** Share one policy across local/WSL main and SSH relay. exec rejects nonzero exits with Git output attached. */ diff --git a/src/wsl-guest/relay-command-env.ts b/src/wsl-guest/relay-command-env.ts index d036c83a404..575771871c8 100644 --- a/src/wsl-guest/relay-command-env.ts +++ b/src/wsl-guest/relay-command-env.ts @@ -1,7 +1,7 @@ import { homedir } from 'node:os' import { posix, win32 } from 'node:path' -import { gitCredentialPromptGuardEnv } from '../shared/git-credential-prompt-env' -import { UNTRANSLATED_GIT_OUTPUT_ENV } from '../shared/git-output-locale' +import { gitCredentialPromptGuardEnv } from '../shared/git/commands/git-credential-prompt-env' +import { UNTRANSLATED_GIT_OUTPUT_ENV } from '../shared/git/commands/git-output-locale' const POSIX_RELAY_PATH_FALLBACKS = ['/usr/local/bin', '/opt/homebrew/bin', '/usr/bin', '/bin'] const WINDOWS_RELAY_PATH_FALLBACKS = [ diff --git a/tests/e2e/headless-serve-session-history-naming-requests.spec.ts b/tests/e2e/headless-serve-session-history-naming-requests.spec.ts index 55512f01b0a..0851e3e0f29 100644 --- a/tests/e2e/headless-serve-session-history-naming-requests.spec.ts +++ b/tests/e2e/headless-serve-session-history-naming-requests.spec.ts @@ -5,7 +5,7 @@ import path from 'node:path' import { expect, test } from './helpers/orca-app' import { launchHeadlessPairedRuntimeHost } from './helpers/headless-paired-runtime-host' import { pairMobileClient } from './helpers/paired-mobile-client' -import { buildConversationNamePrompt } from '../../src/shared/conversation-name-generation' +import { buildConversationNamePrompt } from '../../src/shared/source-control/ai/generation/conversation-name-generation' function transcript(sessionId: string, cwd: string, turns: [string, string][]): string { return turns diff --git a/tests/e2e/helpers/pr-comments-sidebar-fixture.ts b/tests/e2e/helpers/pr-comments-sidebar-fixture.ts index 446f8b2c6ef..8374e6f6d01 100644 --- a/tests/e2e/helpers/pr-comments-sidebar-fixture.ts +++ b/tests/e2e/helpers/pr-comments-sidebar-fixture.ts @@ -1,7 +1,7 @@ import type { Page } from '@stablyai/playwright-test' import type { PRComment } from '../../../src/shared/github/comment-types' import type { PRInfo } from '../../../src/shared/github/pull-request-types' -import { getDefaultSourceControlAiSettings } from '../../../src/shared/source-control-ai' +import { getDefaultSourceControlAiSettings } from '../../../src/shared/source-control/ai/settings/source-control-ai-settings' export type PRCommentsSidebarSeed = { worktreeId: string diff --git a/tests/e2e/helpers/worktree-registration.ts b/tests/e2e/helpers/worktree-registration.ts index 86e8dd2d1c2..d8d46cce583 100644 --- a/tests/e2e/helpers/worktree-registration.ts +++ b/tests/e2e/helpers/worktree-registration.ts @@ -1,6 +1,6 @@ import type { Page } from '@stablyai/playwright-test' import { expect } from './orca-app' -import type { CommitMessageAiSettings } from '../../../src/shared/commit-message-ai-types' +import type { CommitMessageAiSettings } from '../../../src/shared/source-control/ai/generation/commit-message-ai-types' // Raw git worktree add bypasses Orca’s 5s scan-cache invalidation; poll for 10s to cross the TTL and allow a slow scan. const WORKTREE_CACHE_TTL_POLL_MS = 10_000 diff --git a/tests/e2e/prepared-action-launch.test-fixture.ts b/tests/e2e/prepared-action-launch.test-fixture.ts index a566440adec..ecc197472c0 100644 --- a/tests/e2e/prepared-action-launch.test-fixture.ts +++ b/tests/e2e/prepared-action-launch.test-fixture.ts @@ -1,8 +1,8 @@ import { eraseRpcMethods, type RpcContext } from '../../src/main/runtime/rpc/core' import { TERMINAL_LIFECYCLE_METHODS } from '../../src/main/runtime/rpc/methods/terminal/terminal-lifecycle-methods' import { expect, vi } from 'vitest' -import { normalizeSourceControlAiActionDefaults } from '../../src/shared/source-control-ai-actions' -import { sourceControlActionLaunchOptions } from '../../src/shared/source-control-action-launch-preferences' +import { normalizeSourceControlAiActionDefaults } from '../../src/shared/source-control/ai/recipes/source-control-ai-actions' +import { sourceControlActionLaunchOptions } from '../../src/shared/source-control/ai/recipes/source-control-action-launch-preferences' import { agentLaunchNeedsPreparedCommand } from '../../src/shared/agent-launch/choices/agent-launch-preferences' import { resolveAgentStartupPlanInputs } from '../../src/shared/agent-launch/startup/agent-startup-plan-inputs' import { buildAgentStartupPlan } from '../../src/shared/agent-launch/startup/tui-agent-startup' diff --git a/tests/e2e/source-control-action-phone-launch.unit.test.ts b/tests/e2e/source-control-action-phone-launch.unit.test.ts index a5fc39cbfb7..43e450845ef 100644 --- a/tests/e2e/source-control-action-phone-launch.unit.test.ts +++ b/tests/e2e/source-control-action-phone-launch.unit.test.ts @@ -3,10 +3,10 @@ import { randomUUID } from 'node:crypto' import type { RpcClient } from '../../mobile/src/transport/rpc-client' import type { RpcResponse } from '../../mobile/src/transport/types' import { launchAgentWithPrompt } from '../../mobile/src/session/pr-ai-triage-launch' -import type { SourceControlActionRecipe } from '../../src/shared/source-control-ai-actions' -import type { RepoSourceControlAiOverrides } from '../../src/shared/source-control-ai-types' +import type { SourceControlActionRecipe } from '../../src/shared/source-control/ai/recipes/source-control-ai-actions' +import type { RepoSourceControlAiOverrides } from '../../src/shared/source-control/ai/settings/source-control-ai-settings-types' import type { TuiAgent } from '../../src/shared/agent-launch/catalog/tui-agent' -import { liftActionPermissionArgs } from '../../src/shared/source-control-action-permission-lift' +import { liftActionPermissionArgs } from '../../src/shared/source-control/ai/recipes/source-control-action-permission-lift' import { AgentLaunchReplay } from '../../src/shared/rpc-contract/agent-launch-params' import { resolveAgentStartupPlanInputs } from '../../src/shared/agent-launch/startup/agent-startup-plan-inputs' import { resolveAgentLaunchCommand } from '../../src/shared/agent-launch/startup/tui-agent-launch-command' diff --git a/tests/e2e/source-control-create-pr.spec.ts b/tests/e2e/source-control-create-pr.spec.ts index 558956b94f8..28dd61005a6 100644 --- a/tests/e2e/source-control-create-pr.spec.ts +++ b/tests/e2e/source-control-create-pr.spec.ts @@ -1,7 +1,7 @@ import type { Locator, Page } from '@stablyai/playwright-test' import { test, expect } from './helpers/orca-app' import { waitForActiveWorktree, waitForSessionReady } from './helpers/store' -import type { CreateHostedReviewResult } from '../../src/shared/hosted-review' +import type { CreateHostedReviewResult } from '../../src/shared/source-control/hosted-review/hosted-review-contracts' type CreatePRPayload = { repoPath: string diff --git a/tests/e2e/source-control-large-file-count.spec.ts b/tests/e2e/source-control-large-file-count.spec.ts index 1bade6bb496..3dad56f47a7 100644 --- a/tests/e2e/source-control-large-file-count.spec.ts +++ b/tests/e2e/source-control-large-file-count.spec.ts @@ -13,7 +13,7 @@ import { removeLargeFileCountRepo, removeLargeFileCountUntrackedTree } from './large-file-count-fixtures' -import { DEFAULT_GIT_STATUS_LIMIT } from '../../src/shared/git-status-limit' +import { DEFAULT_GIT_STATUS_LIMIT } from '../../src/shared/git/status/git-status-limit' import { RIGHT_SIDEBAR_MIN_WIDTH } from '../../src/renderer/src/components/right-sidebar/right-sidebar-width' // A blocking stall over 1s matches the reported unresponsive UI. diff --git a/tests/e2e/worktree.spec.ts b/tests/e2e/worktree.spec.ts index 7f5e72c78a1..8fdae93160b 100644 --- a/tests/e2e/worktree.spec.ts +++ b/tests/e2e/worktree.spec.ts @@ -1,5 +1,4 @@ import { openSidebarWorkspaceComposer } from './helpers/sidebar-project-dialog' -import { isAutoGeneratedCreatureBranchName } from '../../src/shared/branch-name-from-work' // Drive the real Create Workspace composer: old direct store creation missed #1186’s React #31 render crash after #710’s modal replacement. // #1191 removed StartFromField, but console/pageerror checks still reject equivalent render crashes; see tests/e2e/AGENTS.md. @@ -109,7 +108,7 @@ test.describe('Create Workspace', () => { }) for (const autoRenameBranchFromWork of [true, false]) { - test(`creates an emoji-named worktree with automatic branch naming ${autoRenameBranchFromWork ? 'on' : 'off'}`, async ({ + test(`uses a typed emoji workspace name as its branch with automatic branch naming ${autoRenameBranchFromWork ? 'on' : 'off'}`, async ({ orcaPage }) => { const workspaceName = autoRenameBranchFromWork ? '✨🚀🧪' : '🚀🧪✨' @@ -143,20 +142,11 @@ test.describe('Create Workspace', () => { } ) - const worktree = await orcaPage.evaluate((displayName) => { - const worktrees = Object.values(window.__store!.getState().worktreesByRepo).flat() - const created = worktrees.find((worktree) => worktree.displayName === displayName) - return { branch: created?.branch, displayNameMode: created?.displayNameMode } - }, workspaceName) - expect(worktree.displayNameMode).toBe('fixed') - if (autoRenameBranchFromWork) { - expect(worktree.branch).toMatch(/^refs\/heads\//) - expect( - isAutoGeneratedCreatureBranchName(worktree.branch?.replace(/^refs\/heads\//, '') ?? '') - ).toBe(true) - } else { - expect(worktree.branch).toBe('refs/heads/rocket-test-tube-sparkles') - } + await expect( + orcaPage.getByRole('option', { name: new RegExp(workspaceName) }) + ).toContainText( + autoRenameBranchFromWork ? 'sparkles-rocket-test-tube' : 'rocket-test-tube-sparkles' + ) } finally { await orcaPage .evaluate(() => { diff --git a/tests/tools/omp-source-control-runtime-smoke.mjs b/tests/tools/omp-source-control-runtime-smoke.mjs index 9e806320270..73b7f2603a7 100644 --- a/tests/tools/omp-source-control-runtime-smoke.mjs +++ b/tests/tools/omp-source-control-runtime-smoke.mjs @@ -1,7 +1,7 @@ import assert from 'node:assert/strict' import { pathToFileURL } from 'node:url' import { join, resolve } from 'node:path' -import { getCommitMessageAgentSpec } from '../../src/shared/commit-message-agent-spec.ts' +import { getCommitMessageAgentSpec } from '../../src/shared/source-control/ai/generation/commit-message-agent-spec.ts' const reference = process.argv[2] assert.ok(reference, 'Pass the read-only source checkout path') const { parseArgs } = await import( diff --git a/tests/tools/pi-provider-runtime-smoke.mjs b/tests/tools/pi-provider-runtime-smoke.mjs index 7f3402d5e39..b59d66ab2c8 100644 --- a/tests/tools/pi-provider-runtime-smoke.mjs +++ b/tests/tools/pi-provider-runtime-smoke.mjs @@ -51,7 +51,8 @@ try { const bundle = join(bundleDir, 'orca.cjs') await build({ stdin: { - contents: "export {planCommitMessageGeneration} from './src/shared/commit-message-plan';", + contents: + "export {planCommitMessageGeneration} from './src/shared/source-control/ai/generation/commit-message-plan';", resolveDir: process.cwd() }, bundle: true,