refactor(renderer): organize work-item and review defining owners (#40562)

This commit is contained in:
Neil
2026-11-09 17:08:01 -08:00
committed by GitHub
parent 08c0ffdec0
commit 31eff247fa
286 changed files with 533 additions and 1093 deletions
@@ -6361,8 +6361,7 @@
"src/renderer/src/lib/agent-session/accounts/codex/codex-session-restart.test.ts": 2039,
"src/renderer/src/lib/codex-stale-pane-account-identity.test.ts": 1823,
"src/renderer/src/lib/codex-stale-pane-sweep.test.ts": 1817,
"src/renderer/src/lib/comment-body-line-count.test.ts": 84,
"src/renderer/src/lib/comment-body-submit-state.test.ts": 55,
"src/renderer/src/lib/source-control/review/comments/comment-body-submit-state.test.ts": 55,
"src/renderer/src/lib/composer-submit-cancellation.test.ts": 41,
"src/renderer/src/lib/workspace/ownership/connection-context.test.ts": 1817,
"src/renderer/src/lib/crash-diagnostics.test.ts": 176,
@@ -6385,9 +6384,9 @@
"src/renderer/src/lib/finished-agent-resume-resurrection.test.ts": 1872,
"src/renderer/src/lib/focus-terminal-tab-surface.split-focus.test.ts": 331,
"src/renderer/src/lib/foreground-terminal-tabs.test.ts": 55,
"src/renderer/src/lib/github-links.test.ts": 76,
"src/renderer/src/lib/github-source-runtime-context.test.ts": 62,
"src/renderer/src/lib/gitlab-links.test.ts": 56,
"src/shared/new-workspace/github-links.test.ts": 76,
"src/renderer/src/lib/work-items/github/github-source-runtime-context.test.ts": 62,
"src/shared/new-workspace/gitlab-links.test.ts": 56,
"src/renderer/src/lib/hook-command-delayed-delivery.test.ts": 1904,
"src/renderer/src/lib/host-chat-program.test.ts": 2419,
"src/renderer/src/lib/host-mirror-handle-gap-drain.test.ts": 1706,
@@ -6415,11 +6414,10 @@
"src/renderer/src/lib/lazy-with-retry.never-landed-reload.test.ts": 194,
"src/renderer/src/lib/lazy-with-retry.preload.test.tsx": 208,
"src/renderer/src/lib/lazy-with-retry.test.ts": 282,
"src/renderer/src/lib/linear-board-drag-payload.test.ts": 58,
"src/renderer/src/lib/work-items/linear/linear-issue-context-snapshot.test.ts": 55,
"src/renderer/src/lib/work-items/linear/linear-board-drag-payload.test.ts": 58,
"src/renderer/src/lib/work-items/linear/linear-issue-workspace-attachment.test.ts": 99,
"src/renderer/src/lib/link-source-local-open-owner.test.ts": 433,
"src/renderer/src/lib/linked-work-item-context.test.ts": 64,
"src/renderer/src/lib/work-items/linked-work-item-context.test.ts": 64,
"src/renderer/src/lib/editor/monaco/monaco-editor-gutter-disposal.test.ts": 295,
"src/renderer/src/lib/monaco-languages/markdown-heading-outline.test.ts": 70,
"src/renderer/src/lib/monaco-languages/monarch-embed-entry-recursion.test.ts": 697,
@@ -6510,7 +6508,7 @@
"src/renderer/src/lib/plugin-command-replacements.test.ts": 95,
"src/renderer/src/lib/plugin-icons/plugin-icon-svg.test.ts": 231,
"src/renderer/src/lib/plugin-monaco-token-rules.test.ts": 51,
"src/renderer/src/lib/pr-bot-author-overrides.test.ts": 349,
"src/renderer/src/lib/source-control/review/pr-bot-author-overrides.test.ts": 349,
"src/renderer/src/lib/source-control/review/comments/pr-comment-thread-resolution.test.ts": 48,
"src/renderer/src/lib/project-clone-url-prefill.test.ts": 61,
"src/renderer/src/lib/project-host-workspace-target.jira-mapping.test.ts": 76,
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo } from 'react'
import { toast } from 'sonner'
import * as VisuallyHidden from 'radix-ui/visually-hidden'
import { Sheet, SheetContent, SheetDescription, SheetTitle } from '@/components/ui/sheet'
import { hasBoundedCommentBodyText } from '@/lib/comment-body-submit-state'
import { hasBoundedCommentBodyText } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { useAppStore } from '@/store'
import {
jiraGetIssueForTarget,
@@ -20,7 +20,7 @@ import { JiraIssueCommentComposer, JiraIssueWorkspaceContent } from './jira-issu
import { useJiraIssueWorkspaceActions } from './jira-issue-workspace-actions'
import { getJiraReadIdentity } from '@/store/slices/jira/jira-read-coordination'
import { defaultScopeHost } from '@/runtime/hosts/selection/default-creation-host'
import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import { getEnvironmentRuntimeContextKey } from '@/runtime/hosts/observations/provider-runtime-context'
import { runtimeTargetEnvironmentId } from '@/runtime/rpc/targets/runtime-client-target'
import { editedJiraIssueFields } from './jira-issue-workspace-hydration'
@@ -1,5 +1,5 @@
import { writeLinearIssue } from '@/lib/work-items/linear/linear-issue-write'
import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import { ImeTextarea } from '@/lib/text-input/ime/ime-text-field'
import React, { useCallback, useRef, useState } from 'react'
import { LoaderCircle } from 'lucide-react'
@@ -1,4 +1,4 @@
import { gitGraphSupport, openGitGraph } from '@/lib/git-graph-tab'
import { gitGraphSupport, openGitGraph } from '@/lib/source-control/graph/git-graph-tab'
import {
GitGraph,
FileText,
@@ -11,7 +11,7 @@ import {
getLinkedWorkItemSuggestedName,
type LinkedWorkItemSummary
} from '@/lib/new-workspace'
import { buildLinearIssueLinkedWorkItem } from '@/lib/linear-linked-work-item'
import { buildLinearIssueLinkedWorkItem } from '@/lib/work-items/linear/linear-linked-work-item'
import type { Worktree } from '../../../../shared/worktree/types'
import {
haveConflictingTaskSourceAccounts,
@@ -8,7 +8,7 @@ import { jiraStatusForTarget } from '@/runtime/jira/runtime-jira-project-client'
import { ipcOrRuntimeTargetForHostId } from '@/runtime/rpc/targets/runtime-client-target'
import { gitLabApiFor } from '@/runtime/repository-gitlab/gitlab-owner-api'
import { resolveJiraSourceHostId } from '../../../../shared/jira/jira-source-host'
import { getJiraAccountLabel } from '@/lib/jira-account-label'
import { getJiraAccountLabel } from '@/lib/work-items/jira/jira-account-label'
import {
getRepoExecutionHostId,
parseExecutionHostId,
@@ -28,7 +28,7 @@ import type { GlobalSettings } from '../../../../shared/global-settings-types'
import type { PaletteFilterState } from './palette-filter'
import { getTaskEligibleRepos } from '../task-page/task-page-default-repo-selection'
import { getRepoBackedProviderAvailability } from '../task-source-provider-availability'
import { getTaskPageRepoSourceContext } from '../../lib/task-repo-source-context'
import { getTaskPageRepoSourceContext } from '../../lib/work-items/task-repo-source-context'
import { searchJiraIssuesByKeyOrText } from '../jira-key-or-text-search'
import { bindTaskPageJiraItemSourceContext } from '../task-page/jira/task-page-jira-item-source-context'
import { makeCmdJTaskSearchResult, type CmdJTaskSearchResult } from './task-search-results'
@@ -1,4 +1,4 @@
import { branchName } from '@/lib/git-utils'
import { branchName } from '@/lib/source-control/branches/branch-name'
import { getHostedReviewCacheKey } from '@/store/slices/hosted-review/hosted-review-cache-identity'
import type { AppState } from '@/store/types'
import type { DashboardCardReview } from '../../../../shared/dashboard-snapshot'
@@ -10,7 +10,7 @@ import { useTranslate } from '@/i18n/use-translate'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
} from '@/lib/comment-body-submit-state'
} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { toast } from 'sonner'
import { installOpenDraftAddReviewNoteGuard } from '../editor/editor-shortcuts'
@@ -7,7 +7,7 @@ import { useMountedRef } from '@/hooks/useMountedRef'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
} from '@/lib/comment-body-submit-state'
} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { useTranslate } from '@/i18n/use-translate'
import { installOpenDraftAddReviewNoteGuard } from '../editor/editor-shortcuts'
import { resolveDiffCommentPopoverTop } from './diff-comment-popover-position'
@@ -3,7 +3,7 @@
import { act } from 'react'
import { createRoot, type Root } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { COMMENT_BODY_NONBLANK_SCAN_MAX_BYTES } from '@/lib/comment-body-submit-state'
import { COMMENT_BODY_NONBLANK_SCAN_MAX_BYTES } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { DiffCommentPopover } from './DiffCommentPopover'
const roots: Root[] = []
@@ -6,7 +6,7 @@ import {
import { useCallback, useEffect, useMemo, useRef } from 'react'
import type { editor as monacoEditor } from 'monaco-editor'
import { createRoot, type Root } from 'react-dom/client'
import { getCommentBodyLayoutLineCount } from '@/lib/comment-body-line-count'
import { getCommentBodyLayoutLineCount } from '@/lib/source-control/review/comments/comment-body-line-count'
import { translate } from '@/i18n/i18n'
import { useAppStore } from '@/store'
import {
@@ -10,7 +10,7 @@ import {
} from './check-run-details-fix-context'
import { openSourceControlAiSettingsTarget } from '@/components/right-sidebar/source-control/panel/source-control-ai-settings-navigation'
import { getConnectionId } from '@/lib/workspace/ownership/connection-context'
import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch'
import { startFixChecksAgent } from '@/lib/source-control/checks/fix-checks-agent-launch'
import { readSourceControlLaunchRecipeAgentId } from '../../../../../../shared/source-control/ai/source-control-launch-agent-selection'
import { resolveRepoWorktreeLaunchPlatform } from '@/runtime/hosts/platform/execution-host-facts'
import { useAppStore } from '@/store/index'
@@ -1,6 +1,6 @@
import { createElement, memo } from 'react'
import { ChevronDown } from 'lucide-react'
import { STATUS_COLORS } from '@/lib/git-path-decoration'
import { STATUS_COLORS } from '@/lib/source-control/paths/git-path-decoration'
import { STATUS_LABELS } from '../../../../../../shared/git/status/git-status-labels'
import type { SourceControlTreeNode } from '../../../../../../shared/source-control/listing/source-control-tree'
import { FileTypeIcon, FolderIcon } from '@/components/FileTypeIcon'
@@ -9,7 +9,7 @@ import {
DialogHeader,
DialogTitle
} from '@/components/ui/dialog'
import { getDiffCommentLineLabel } from '@/lib/diff-comment-compat'
import { getDiffCommentLineLabel } from '@/lib/source-control/review/comments/diff-comment-compat'
import { useTranslate } from '@/i18n/use-translate'
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
@@ -4,7 +4,7 @@ import { useOwnedDiffComments } from '@/components/diff-comments/use-diff-commen
import { withoutMarkdownReviewNotes } from '@/lib/editor/markdown/review-notes/markdown-review-notes-setting'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { toast } from 'sonner'
import { formatDiffComments } from '@/lib/diff-comments-format'
import { formatDiffComments } from '../../../../../../shared/diff-comments-format'
import { translate } from '@/i18n/i18n'
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
@@ -13,7 +13,7 @@ import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
import { applyDiffEditorLineNumberOptions } from './diff-editor-line-number-options'
import { isDiffComment } from '@/lib/diff-comment-compat'
import { isDiffComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import { installEditorSaveShortcut, installMonacoEditorFindShortcut } from '../../editor-shortcuts'
import { diffEditorScrollbarOptions } from './diff-editor-scrollbar-options'
import { LargeDiffFallback } from '../large-files/LargeDiffFallback'
@@ -9,7 +9,7 @@ import { useEditorTypography } from '@/hooks/use-editor-typography'
import { useDiffCommentDecorator } from '../../../diff-comments/useDiffCommentDecorator'
import { applyDiffEditorLineNumberOptions } from '../monaco-view/diff-editor-line-number-options'
import { DiffSectionHeader } from './DiffSectionHeader'
import { isDiffComment } from '@/lib/diff-comment-compat'
import { isDiffComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import { installEditorSaveShortcut, installMonacoEditorFindShortcut } from '../../editor-shortcuts'
import { DiffSectionBody } from './DiffSectionBody'
import { useDiffSectionLayoutMetrics } from './useDiffSectionLayoutMetrics'
@@ -4,7 +4,7 @@ import type { BranchSwitchTarget } from '../../../../../shared/git/branch-switch
import { createStore } from 'zustand/vanilla'
import { toast } from 'sonner'
import { useAppStore } from '@/store'
import { gitGraphScope } from '@/lib/git-graph-tab'
import { gitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { gitGraphOwnerKey } from './git-graph-workspace-navigation'
import { gitCommitActionsSupported } from '@/runtime/source-control/git/git-commit-actions-capability'
import {
@@ -6,7 +6,7 @@ import { Checkbox } from '@/components/ui/checkbox'
import { getRuntimeGitRefs } from '@/runtime/source-control/git/runtime-git-status-client'
import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof'
import { GIT_HISTORY_REFS_CAPABILITY } from '../../../../../shared/source-control/runtime/git-graph-capabilities'
import { gitGraphScope, useGitGraphScope } from '@/lib/git-graph-tab'
import { gitGraphScope, useGitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { useTranslate } from '@/i18n/use-translate'
import type {
GitHistoryItemRef,
@@ -4,7 +4,8 @@ import { gitGraphOwnerKey, switchGitGraphWorkspace } from './git-graph-workspace
import { createStore } from 'zustand/vanilla'
import { shallow } from 'zustand/shallow'
import { useAppStore } from '@/store'
import { gitGraphScope, gitGraphScopeInputs, GIT_GRAPH_REFRESH_EVENT } from '@/lib/git-graph-tab'
import { gitGraphScope, gitGraphScopeInputs } from '@/lib/source-control/graph/git-graph-tab'
import { GIT_GRAPH_REFRESH_EVENT } from '@/lib/source-control/graph/git-graph-refresh-event'
import { getRuntimeGitHistory } from '@/runtime/source-control/git/runtime-git-status-client'
import { translate } from '@/i18n/i18n'
import type {
@@ -13,7 +13,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { useAppStore } from '@/store'
import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields'
import type { gitGraphScope } from '@/lib/git-graph-tab'
import type { gitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { gitGraphWorkspaceCatalog } from './git-graph-workspace-navigation'
import { useTranslate } from '@/i18n/use-translate'
import type { GitHistoryItemRef } from '../../../../../shared/git/history/git-history-types'
@@ -2,10 +2,7 @@ import { workspaceId, local, repo } from './git-graph-workspace.test-fixtures'
// @vitest-environment happy-dom
import { useAppStore } from '@/store'
import { gitGraphHistoryForTab, disposeGitGraphHistory } from './git-graph-tab-controllers'
import { attachClosedEditorTabCleanup } from '../model-lifetime/retention/closed-editor-tab-controller'
import { gitGraphScope } from '@/lib/git-graph-tab'
import { captureWorktreeOperationGenerationSnapshot } from '@/lib/workspace/ownership/worktree-operation-generation'
import type { OpenFile } from '@/store/slices/editor/types/open-file'
import { act } from 'react'
import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
@@ -327,115 +324,6 @@ it('keeps a newer selection and its details during refresh and after a partial f
expect(container.querySelector('aside h2')?.textContent).toBe('Commit 120')
})
it.each(['local', 'ssh:A'] as const)(
'retains %s twin history across workspace switches, then follows its tab owner move',
async (hostId) => {
useAppStore.setState({
repos: [
...useAppStore.getState().repos,
{ ...repo, executionHostId: 'ssh:A', connectionId: 'A' }
],
worktreesByRepo: { r: [local, { ...local, hostId: 'ssh:A' }] },
activeWorkspaceExecutionHostId: hostId
})
const cleanup = attachClosedEditorTabCleanup(useAppStore)
const original = useAppStore.getState().openFiles
const file: OpenFile = {
id: `${workspaceId}::git-graph`,
worktreeId: workspaceId,
mode: 'git-graph',
relativePath: 'Git Graph',
language: 'plaintext',
isDirty: false,
filePath: `${workspaceId}::git-graph`,
operationProvenance: {
ownershipProjection: 'explicit',
generation: captureWorktreeOperationGenerationSnapshot({
executionHostId: hostId,
runtimeEnvironmentId: null
})
}
}
useAppStore.setState({ openFiles: [...original, file] })
const render = () => (
<TooltipProvider>
<GitGraphTab worktreeId={workspaceId} />
</TooltipProvider>
)
const page = {
...result,
items: [...result.items, { id: 'b', subject: 'second', message: 'second', parentIds: [] }],
refs: 'all' as const
}
getHistory.mockReset().mockResolvedValueOnce(page)
try {
await act(async () => root.render(render()))
expect(getHistory.mock.calls[0]?.[0].connectionId).toBe(hostId === 'ssh:A' ? 'A' : undefined)
await act(async () => {
const commit = Array.from(container.querySelectorAll('button')).find(
(button) => button.textContent === 'second'
)!
commit.click()
const scroll = container.querySelector<HTMLDivElement>('div.overflow-y-auto')!
scroll.scrollTop = 144
scroll.dispatchEvent(new Event('scroll'))
})
await act(async () => root.render(null))
await act(async () =>
useAppStore.setState({ activeWorktreeId: 'other', activeWorkspaceExecutionHostId: 'local' })
)
expect(gitGraphScope(workspaceId)).toBeNull()
expect(gitGraphHistoryForTab(workspaceId).view.getState().selectedId).toBe('b')
await act(async () =>
useAppStore.setState({
activeWorktreeId: workspaceId,
activeWorkspaceExecutionHostId: hostId
})
)
await act(async () => root.render(render()))
expect(container.querySelector('[data-current="true"]')?.textContent).toContain('second')
expect(container.querySelector<HTMLDivElement>('div.overflow-y-auto')?.scrollTop).toBe(144)
expect(getHistory).toHaveBeenCalledTimes(1)
await act(async () => root.render(null))
useAppStore.setState({
worktreesByRepo: { r: [{ ...local, hostId: hostId === 'local' ? 'ssh:A' : 'local' }] }
})
expect(gitGraphHistoryForTab(workspaceId).view.getState().result).toBeUndefined()
expect(gitGraphHistoryForTab(workspaceId).scrollOffset).toBe(0)
await act(async () => root.render(render()))
const movedHost = hostId === 'local' ? 'ssh:A' : 'local'
getHistory.mockResolvedValueOnce({ ...result, refs: 'all' })
await act(async () =>
useAppStore.setState({
openFiles: [
...original,
{
...file,
operationProvenance: {
ownershipProjection: 'explicit',
generation: captureWorktreeOperationGenerationSnapshot({
executionHostId: movedHost,
runtimeEnvironmentId: null
})
}
}
]
})
)
expect(getHistory.mock.calls.at(-1)?.[0].connectionId).toBe(
movedHost === 'ssh:A' ? 'A' : undefined
)
expect(gitGraphHistoryForTab(workspaceId).view.getState().selectedId).toBe('a')
await act(async () => root.render(null))
useAppStore.setState({ openFiles: original })
expect(gitGraphHistoryForTab(workspaceId).view.getState().result).toBeUndefined()
} finally {
cleanup()
useAppStore.setState({ openFiles: original })
}
}
)
it('waits for an in-flight page before retrieving a distant parent in one operation', async () => {
let history: ReturnType<typeof useGitGraphHistory>
function History() {
@@ -632,23 +520,3 @@ it('keeps the confirm strip across tab switches, discarding it on navigation, fi
await act(async () => root.render(render()))
expect(container.textContent).not.toContain('Revert a?')
})
it('canonicalizes selected refs before requesting history', async () => {
let history: ReturnType<typeof useGitGraphHistory>
function History() {
history = useGitGraphHistory(workspaceId)
return null
}
getHistory.mockReset().mockResolvedValue({ ...result, refs: 'all' })
await act(async () => root.render(<History />))
getHistory.mockClear().mockResolvedValue({
...result,
refs: ['refs/heads/main', 'refs/heads/topic'],
resolvedRefs: ['refs/heads/main', 'refs/heads/topic']
})
await act(async () => {
history!.changeFilter(['refs/heads/topic', 'refs/heads/main', 'refs/heads/topic'])
await history!.controller.settledResult()
})
expect(getHistory.mock.calls[0]?.[1].refs).toEqual(['refs/heads/main', 'refs/heads/topic'])
})
@@ -5,7 +5,7 @@ import { getWorktreeExecutionHostId } from '../../../../../shared/execution-host
import { findIndexedRepoOwnerForHost } from '@/lib/workspace/ownership/repo-owner-index'
import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields'
import { useAppStore } from '@/store'
import { gitGraphScope } from '@/lib/git-graph-tab'
import { gitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { getRuntimeGitRefs } from '@/runtime/source-control/git/runtime-git-status-client'
export const gitGraphOwnerKey = (scope: ReturnType<typeof gitGraphScope>) =>
@@ -1,7 +1,7 @@
import { useEffect } from 'react'
import { useStore } from 'zustand'
import { useAppStore } from '@/store'
import { useGitGraphScope } from '@/lib/git-graph-tab'
import { useGitGraphScope } from '@/lib/source-control/graph/git-graph-tab'
import { gitGraphHistoryForTab } from './git-graph-tab-controllers'
import type {
GitHistoryRefs,
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { createConnectionIdForFileSelector } from '@/lib/workspace/ownership/connection-owner-resolution'
import { computeEditorFontSize } from '@/lib/editor/appearance/editor-font-zoom'
import type { HttpLinkSourceOwner } from '@/lib/browser/navigation/http-link-routing'
import { isMarkdownComment } from '@/lib/diff-comment-compat'
import { isMarkdownComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import { useFileOwnerRuntimeTarget } from '@/runtime/rpc/targets/use-worktree-runtime-target'
import { useAppStore } from '@/store/index'
import { exceedsMarkdownRichModeSizeLimit } from '../../markdown/render-mode/markdown-rich-size-limit'
@@ -18,7 +18,7 @@ import type { WorkspaceResource } from '@/lib/workspace/ownership/workspace-copy
import { toast } from 'sonner'
import { useTranslate } from '@/i18n/use-translate'
import { useAppStore } from '@/store/index'
import { isMarkdownComment } from '@/lib/diff-comment-compat'
import { isMarkdownComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import {
formatMarkdownReviewNotes,
type MarkdownReviewNote
@@ -1,5 +1,5 @@
import type { DiffComment } from '../../../../../../shared/diff-comment-types'
import { getCommentBodyLayoutLineCount } from '@/lib/comment-body-line-count'
import { getCommentBodyLayoutLineCount } from '@/lib/source-control/review/comments/comment-body-line-count'
export type RichMarkdownReviewNotePosition = {
comment: DiffComment
@@ -1,7 +1,7 @@
import { useMemo } from 'react'
import { getRelativePathInsideRoot } from '@/lib/path'
import { normalizeRelativePath } from '../../../../../../shared/cross-platform-path'
import { isMarkdownComment } from '@/lib/diff-comment-compat'
import { isMarkdownComment } from '@/lib/source-control/review/comments/diff-comment-compat'
import {
formatMarkdownReviewNotes,
sortMarkdownReviewNotes,
@@ -8,7 +8,7 @@ import type { GitHubImageUploadAddress } from '@/components/github/github-image-
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
} from '@/lib/comment-body-submit-state'
} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
@@ -6,7 +6,7 @@ import {
getPRCommentAudienceCounts,
type PRCommentAudienceFilter
} from '../../../../../shared/source-control/review-comments/pr-comment-audience'
import { usePRBotAuthorOverrides } from '@/lib/pr-bot-author-overrides'
import { usePRBotAuthorOverrides } from '@/lib/source-control/review/pr-bot-author-overrides'
import { groupPRComments } from '../../../../../shared/source-control/review-comments/pr-comment-groups'
import {
getCommentReplyTargetCandidates,
@@ -18,9 +18,9 @@ import {
} from '@/components/right-sidebar/checks-panel/comments/pr-comments-ai-launch-ack'
import { buildPRCommentConversationReplyBody } from '@/components/right-sidebar/checks-panel/comments/pr-comment-fixing-reply-body'
import { useAppStore } from '@/store'
import { canUseGitHubRepoContext } from '@/lib/github-source-runtime-context'
import { canUseGitHubRepoContext } from '@/lib/work-items/github/github-source-runtime-context'
import { getGitHubMutationTarget } from '@/components/github/github-work-item-mutation-target'
import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import { githubCommentImageUploadAddress } from '@/components/github/github-comment-image-upload-address'
import {
resolveGitHubBodyDraft,
@@ -57,7 +57,7 @@ import { GHCommentComposer } from './gh-comment-composer'
import { ConversationTabDescription } from './conversation-tab-description'
import { ConversationTabActivity } from './conversation-tab-activity'
import { ConversationTabPRSidebar } from './conversation-tab-pr-sidebar'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function ConversationTab({
item,
@@ -10,14 +10,14 @@ import { githubCommentImageUploadAddress } from '@/components/github/github-comm
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
} from '@/lib/comment-body-submit-state'
} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { addIssueCommentForRepo } from '@/components/github/github-work-item-comment-mutations'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function GHCommentComposer({
className,
@@ -5,7 +5,7 @@ import { useRepoLabels, useRepoAssignees } from '@/hooks/useGitHubRepoMetadata'
import { useImmediateMutation } from '@/hooks/useIssueMetadata'
import { useRepoLabelsBySlug, useRepoAssigneesBySlug } from '@/hooks/useGitHubSlugMetadata'
import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key'
import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import {
getTaskPageGitHubDuplicateCandidates,
getTaskPageGitHubDuplicateTargetErrorMessage,
@@ -1,5 +1,5 @@
import { useAppStore } from '@/store'
import { getWorkItemRepo } from '@/lib/work-item-repo-row'
import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { untrackedTaskOperation, type TaskChange } from '@/store/github/task-records/task-change'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
@@ -1,4 +1,4 @@
import { readPRCheckRefreshOwner } from '@/lib/pr-check-refresh-owner'
import { readPRCheckRefreshOwner } from '@/lib/source-control/checks/pr-check-refresh-owner'
import type React from 'react'
import { toast } from 'sonner'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
@@ -8,15 +8,18 @@ import {
type GitHubChecksContextOwner,
type GitHubChecksTabState
} from '@/components/github-checks-tab-state'
import { getGitHubRuntimeRepoId, type GitHubRuntimeHost } from '@/lib/github-source-runtime-context'
import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch'
import {
getGitHubRuntimeRepoId,
type GitHubRuntimeHost
} from '@/lib/work-items/github/github-source-runtime-context'
import { startFixChecksAgent } from '@/lib/source-control/checks/fix-checks-agent-launch'
import { buildFixBrokenChecksPrompt } from '../../../../../shared/source-control/checks/pr-checks-fix-prompt'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { translate } from '@/i18n/i18n'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
type RuntimeHost = GitHubRuntimeHost | null
@@ -11,7 +11,7 @@ import {
settleGitHubChecksTabDetails,
type CheckDetailsLoadState
} from '@/components/github-checks-tab-state'
import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
import { translate } from '@/i18n/i18n'
import type { ChecksTabActionContext } from './checks-tab-actions'
@@ -14,7 +14,7 @@ import {
import {
canUseGitHubRepoContext,
getGitHubSourceRuntimeHost
} from '@/lib/github-source-runtime-context'
} from '@/lib/work-items/github/github-source-runtime-context'
import { getBrokenChecks } from '../../../../../shared/source-control/checks/pr-checks-fix-prompt'
import { githubRepoIdentityKey } from '../../../../../shared/github/repository-identity-key'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
@@ -21,7 +21,7 @@ import type {
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { translate } from '@/i18n/i18n'
import { loadPRFileContents } from '../load-item-details/pr-file-content-cache'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
type LoadSectionArgs = {
index: number
@@ -10,7 +10,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import {
getGitHubRepoRoutingTarget,
getGitHubRuntimeRepoId
} from '@/lib/github-source-runtime-context'
} from '@/lib/work-items/github/github-source-runtime-context'
import { presentGitHubPRMergeState } from '@/components/github-pr-merge-state'
import { resolveGitHubPRMergeMethods } from '../../../../../shared/github/pull-request-merge-methods'
import type { GitHubPRMergeMethod } from '../../../../../shared/github/pull-request-types'
@@ -29,7 +29,7 @@ import { runPullRequestStateUpdate } from '@/components/github/github-work-item-
import type { GitHubItemDialogProjectOrigin } from '../load-item-details/github-item-dialog-types'
import { PRActionsMergeMenu } from './pr-actions-merge-menu'
import { WorkItemStateBadge } from '../load-item-details/work-item-state-badge'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function PRActionsPanel({
item,
@@ -15,7 +15,7 @@ import type { GitHubAssignableUser } from '../../../../../shared/github/pull-req
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { useTranslate } from '@/i18n/use-translate'
import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { resolvePullRequestRepo } from '@/components/github/github-work-item-identity'
import { mergeReviewerSuggestions } from '@/components/github/work-item-state-presentation'
import type { GitHubItemDialogProjectOrigin } from '../load-item-details/github-item-dialog-types'
@@ -1,7 +1,7 @@
import { toast } from 'sonner'
import { useAppStore } from '@/store'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import {
normalizeGitHubReviewerLogins,
parseGitHubReviewerInputLogins
@@ -16,7 +16,7 @@ import type { GitHubWorkItem } from '../../../../../shared/github/work-item-type
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { translate } from '@/i18n/i18n'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
type ReviewerRequestArgs = {
submitting: boolean
@@ -1,5 +1,5 @@
import { useGitHubOperationOwner } from '@/hooks/useGitHubOperationScope'
import { canUseGitHubRepoContext } from '@/lib/github-source-runtime-context'
import { canUseGitHubRepoContext } from '@/lib/work-items/github/github-source-runtime-context'
import {
resolvePullRequestRepo,
parseOwnerRepoFromItemUrl
@@ -2,7 +2,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
} from '@/lib/github-source-runtime-context'
} from '@/lib/work-items/github/github-source-runtime-context'
import {
PR_FILE_CONTENT_CACHE_MAX_BYTES,
getRetainedPRFileContentsByteCount
@@ -2,9 +2,12 @@ import { useGitHubItemTargetIdentity } from './github-work-item-target-context'
import { toast } from 'sonner'
import { translate } from '@/i18n/i18n'
import { runtimeEnvironmentSupportsCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof'
import { getGitHubSourceRuntimeHost } from '@/lib/github-source-runtime-context'
import { getGitHubSourceRuntimeHost } from '@/lib/work-items/github/github-source-runtime-context'
import { GITHUB_CANONICAL_DETAILS_RUNTIME_CAPABILITY } from '../../../../../shared/work-items/task-source-runtime-capabilities'
import { githubTaskExecutionIdentity, captureGitHubTaskTarget } from '@/lib/github-task-target'
import {
githubTaskExecutionIdentity,
captureGitHubTaskTarget
} from '@/lib/work-items/github/github-task-target'
import {
useCallback,
useLayoutEffect,
@@ -25,7 +28,7 @@ import {
startWorkItemDetailsFetch,
loadCanonicalGitHubTaskDetails
} from './work-item-details-fetch-settle'
import { getWorkItemRepo } from '@/lib/work-item-repo-row'
import { getWorkItemRepo } from '@/lib/work-items/work-item-repo-row'
import { useMountedRef } from '@/hooks/useMountedRef'
export function useGitHubTaskRefresh({
@@ -8,7 +8,7 @@ import {
import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from 'react'
import { useGitHubTaskItems } from '@/hooks/useGitHubTaskItems'
import { useGitHubTaskRefresh } from './use-github-task-refresh'
import { addressedGitHubIssueItem } from '@/lib/github-task-target'
import { addressedGitHubIssueItem } from '@/lib/work-items/github/github-task-target'
import {
normalizeItemDialogTab,
type ItemDialogTab
@@ -12,7 +12,10 @@ import type {
} from '../../../../../shared/github/work-item-types'
import type { GitHubTaskRecordCache } from '@/store/github/task-records/task-record-cache'
import type { TaskBinding } from '@/store/github/task-records/task-record-model'
import { githubTaskRpcOptions, type GitHubTaskTarget } from '@/lib/github-task-target'
import {
githubTaskRpcOptions,
type GitHubTaskTarget
} from '@/lib/work-items/github/github-task-target'
import { useAppStore } from '@/store'
import { lookupGitHubWorkItemDetailsForSource } from '@/lib/work-items/github/github-work-item-source-lookup'
import {
@@ -6,7 +6,7 @@ import {
resolvePullRequestRepo,
type ItemDialogTab
} from '@/components/github/github-work-item-identity'
import { canUseGitHubRepoContext } from '@/lib/github-source-runtime-context'
import { canUseGitHubRepoContext } from '@/lib/work-items/github/github-source-runtime-context'
import { useTranslate } from '@/i18n/use-translate'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { GitHubAssignableUser } from '../../../../../shared/github/pull-request-types'
@@ -22,7 +22,7 @@ import type {
GitHubProjectRow
} from '../../../../shared/github/project-types'
import type { ExecutionHostId } from '../../../../shared/execution-host'
import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import { openAppHttpLink } from '@/lib/browser/navigation/app-http-link-open'
type Props = {
@@ -1,5 +1,5 @@
import type { Repo } from '../../../../shared/repo-types'
import { getWorkItemRepo, type WorkItemRepoRef } from '@/lib/work-item-repo-row'
import { getWorkItemRepo, type WorkItemRepoRef } from '@/lib/work-items/work-item-repo-row'
type RepoBackedProjectDialogState = {
repoId: string
@@ -8,7 +8,7 @@ import { gitHubSlugApiForTarget } from '@/runtime/repository-github/github-slug-
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
} from '@/lib/comment-body-submit-state'
} from '@/lib/source-control/review/comments/comment-body-submit-state'
import type { PRComment } from '../../../../../shared/github/comment-types'
import { useTranslate } from '@/i18n/use-translate'
import { projectViewErrorMessage } from '../project-view-error-copy'
@@ -9,7 +9,7 @@ import { useAppStore } from '@/store'
import { useImmediateMutation } from '@/hooks/useIssueMetadata'
import { useRepoAssignees } from '@/hooks/useGitHubRepoMetadata'
import { useRepoAssigneesBySlug } from '@/hooks/useGitHubSlugMetadata'
import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import {
parseOwnerRepoFromItemUrl,
resolvePullRequestRepo,
@@ -4,7 +4,7 @@ import type { GitHubOwnerRepo } from '../../../../shared/github/pull-request-typ
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
} from '@/lib/github-source-runtime-context'
} from '@/lib/work-items/github/github-source-runtime-context'
export function githubCommentImageUploadAddress(args: {
repoId?: string | null
@@ -9,7 +9,7 @@ import { emitGitHubWorkItemDetailsCacheMutation } from '@/lib/work-items/github/
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
} from '@/lib/github-source-runtime-context'
} from '@/lib/work-items/github/github-source-runtime-context'
import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context'
import type { GitHubOwnerRepo } from '../../../../shared/github/pull-request-types'
@@ -8,8 +8,8 @@ import {
getGitHubRepoRoutingTarget,
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
} from '@/lib/github-source-runtime-context'
import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
} from '@/lib/work-items/github/github-source-runtime-context'
import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import {
resolvePullRequestRepo,
type GitHubWorkItemProjectOrigin
@@ -19,7 +19,7 @@ import { githubProjectHost } from '../../../../shared/github/project-identity'
import type { TaskSourceContext } from '../../../../shared/work-items/task-source-context'
import type { GitHubOwnerRepo } from '../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export async function runIssueUpdate(args: {
repoPath: string | null
@@ -2,7 +2,7 @@ import { LoaderCircle, Send } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { TabsContent } from '@/components/ui/tabs'
import { useTranslate } from '@/i18n/use-translate'
import { hasBoundedCommentBodyText } from '@/lib/comment-body-submit-state'
import { hasBoundedCommentBodyText } from '@/lib/source-control/review/comments/comment-body-submit-state'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
import type { GitLabReviewActions } from './use-gitlab-review-actions'
@@ -11,7 +11,7 @@ import {
} from '@/components/ui/sheet'
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'
import { useTranslate } from '@/i18n/use-translate'
import { hasBoundedCommentBodyText } from '@/lib/comment-body-submit-state'
import { hasBoundedCommentBodyText } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { isScreenSubmitShortcut } from '@/lib/screen-submit-shortcut'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import { normalizeGitLabLabels, StateBadge } from '../gitlab-item-dialog-parts'
@@ -12,7 +12,7 @@ import {
} from '../gitlab-item-dialog-parts'
import type { GitLabDialogRepoSelector } from './gitlab-item-dialog-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabDetailsEditing(
item: GitLabWorkItem | null,
@@ -6,7 +6,7 @@ import type { GitLabPipelineJob, GitLabWorkItem } from '../../../../shared/gitla
import { showGitLabMutationError } from '../gitlab-item-dialog-parts'
import type { GitLabDialogRepoSelector } from './gitlab-item-dialog-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabPipelineActions(
item: GitLabWorkItem | null,
@@ -1,14 +1,14 @@
import { gitLabApiFor } from '@/runtime/repository-gitlab/gitlab-owner-api'
import { useCallback } from 'react'
import { toast } from 'sonner'
import { getCommentBodySubmitState } from '@/lib/comment-body-submit-state'
import { getCommentBodySubmitState } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { useAppStore } from '@/store'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import { showGitLabMutationError } from '../gitlab-item-dialog-parts'
import type { GitLabDialogRepoSelector } from './gitlab-item-dialog-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabPrimaryActions(
item: GitLabWorkItem | null,
@@ -1,14 +1,14 @@
import { gitLabApiFor } from '@/runtime/repository-gitlab/gitlab-owner-api'
import { useCallback } from 'react'
import { toast } from 'sonner'
import { getCommentBodySubmitState } from '@/lib/comment-body-submit-state'
import { getCommentBodySubmitState } from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { useAppStore } from '@/store'
import type { GitLabAssignableUser, GitLabWorkItem } from '../../../../shared/gitlab-types'
import { dedupeGitLabUsers, showGitLabMutationError } from '../gitlab-item-dialog-parts'
import type { GitLabDialogRepoSelector } from './gitlab-item-dialog-types'
import type { GitLabItemDialogState } from './use-gitlab-item-dialog-state'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function useGitLabReviewActions(
item: GitLabWorkItem | null,
@@ -18,7 +18,7 @@ import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'
import { cn } from '@/lib/utils'
import { hasRemoteProviderRuntime } from '@/runtime/hosts/observations/provider-runtime-context'
import { preventOutsideDismissWhenDirty } from '@/lib/outside-dismiss-guard'
import { bitbucketConnectErrorText } from '@/lib/bitbucket-connect-error-copy'
import { bitbucketConnectErrorText } from '@/lib/source-control/remote/bitbucket-connect-error-copy'
import { useTranslate } from '@/i18n/use-translate'
import { BitbucketApiTokenScopes } from './bitbucket-api-token-scopes'
@@ -1,4 +1,4 @@
import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import { UnsealedCredentialNotice } from '../../provider-accounts/UnsealedCredentialNotice'
import { useState } from 'react'
import { AlertCircle, CheckCircle2, LoaderCircle, Unlink } from 'lucide-react'
@@ -1,4 +1,4 @@
import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import { UnsealedCredentialNotice } from '../../provider-accounts/UnsealedCredentialNotice'
import { useState } from 'react'
import { AlertCircle, CheckCircle2, LoaderCircle, Unlink } from 'lucide-react'
@@ -1,5 +1,8 @@
import { jiraCredentialStorageCopy } from './jira-credential-storage-copy'
import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
import {
taskProviderErrorMessage,
taskProviderErrorText
} from '@/lib/work-items/task-provider-error-copy'
import { useId, useState } from 'react'
import { LoaderCircle, Lock } from 'lucide-react'
import { useAppStore } from '@/store'
@@ -1,4 +1,4 @@
import { taskProviderErrorMessage } from '@/lib/task-provider-error-copy'
import { taskProviderErrorMessage } from '@/lib/work-items/task-provider-error-copy'
import type { JiraIssue, JiraMutationResult } from '../../../shared/jira/jira-types'
import type { GlobalSettings } from '../../../shared/global-settings-types'
import type { TaskSourceContext } from '../../../shared/work-items/task-source-context'
@@ -1,4 +1,7 @@
import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
import {
taskProviderErrorMessage,
taskProviderErrorText
} from '@/lib/work-items/task-provider-error-copy'
import { useState } from 'react'
import { ChevronDown, CircleAlert, ExternalLink, Loader2 } from 'lucide-react'
import { Button } from '@/components/ui/button'
@@ -10,7 +10,7 @@ import type {
} from '../../../shared/jira/jira-types'
import { applyJiraIssueKeyCasing } from '../../../shared/workspace-name'
import type { WorkspaceSeedNameOptions } from '../../../shared/workspace-name'
import { getJiraIssueKeyCasingSeedOptions } from '@/lib/jira-issue-key-casing'
import { getJiraIssueKeyCasingSeedOptions } from '@/lib/work-items/jira/jira-issue-key-casing'
import { buildJiraIssuePrompt } from './jira-prompt-templates'
import {
issueCopiedMessage,
@@ -10,7 +10,7 @@ import {
} from '@/components/ui/select'
import { Textarea } from '@/components/ui/textarea'
import { useTranslate } from '@/i18n/use-translate'
import { getCommentBodySubmitState } from '@/lib/comment-body-submit-state'
import { getCommentBodySubmitState } from '@/lib/source-control/review/comments/comment-body-submit-state'
import {
buildResolutionFieldValue,
classifyTransitionRequirements,
@@ -1,4 +1,7 @@
import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
import {
taskProviderErrorMessage,
taskProviderErrorText
} from '@/lib/work-items/task-provider-error-copy'
import { useId, useMemo, useState } from 'react'
import { ExternalLink, LoaderCircle, Lock } from 'lucide-react'
import type { LinearWorkspace } from '../../../shared/linear/workspace-types'
@@ -1,6 +1,9 @@
import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { confirmLinearIssueWrite } from '@/store/slices/linear/linear-issue-publication'
import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
import {
taskProviderErrorMessage,
taskProviderErrorText
} from '@/lib/work-items/task-provider-error-copy'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { Check, ChevronDown, FolderKanban, LoaderCircle } from 'lucide-react'
import { toast } from 'sonner'
@@ -1,5 +1,8 @@
import { observeLinearIssueRead } from '@/store/slices/linear/linear-issue-publication'
import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
import {
taskProviderErrorMessage,
taskProviderErrorText
} from '@/lib/work-items/task-provider-error-copy'
import { ImeInput } from '@/lib/text-input/ime/ime-text-field'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { ArrowRight, LoaderCircle, Plus } from 'lucide-react'
@@ -3,7 +3,7 @@ import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { observeLinearIssueRead } from '@/store/slices/linear/linear-issue-publication'
import { useLinearIssuePublication } from '@/hooks/useLinearIssuePublication'
import { translate } from '@/i18n/i18n'
import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import { useCallback, useEffect, useRef, useState } from 'react'
import { createNonSecureContextUuid as createBrowserUuid } from '../../../shared/non-secure-context-uuid'
@@ -4,7 +4,7 @@ import { ChevronDown, Clipboard, FolderOpen, GitBranch } from 'lucide-react'
import { LinearIssueEditSection, type LinearEditState } from '@/components/LinearItemDrawer'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { buildLinearIssueContextSnapshot } from '@/lib/work-items/linear/linear-issue-context-snapshot'
import { buildContainedLinkedContextBlock } from '@/lib/linked-work-item-context'
import { buildContainedLinkedContextBlock } from '@/lib/work-items/linked-work-item-context'
import { useTranslate } from '@/i18n/use-translate'
import { buildLinearIssueBranchName } from '@/components/linear-issue-workspace-text'
import type { LinearComment, LinearIssue } from '../../../shared/linear/issue-types'
@@ -1,4 +1,4 @@
import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import { ImeTextarea } from '@/lib/text-input/ime/ime-text-field'
import React, { useCallback, useRef, useState } from 'react'
import { LoaderCircle, Send } from 'lucide-react'
@@ -8,7 +8,7 @@ import { Button } from '@/components/ui/button'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
} from '@/lib/comment-body-submit-state'
} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { getScreenSubmitShortcutLabel, isScreenSubmitShortcut } from '@/lib/screen-submit-shortcut'
import { createNonSecureContextUuid as createBrowserUuid } from '../../../shared/non-secure-context-uuid'
import { useAppStore } from '@/store'
@@ -1,6 +1,9 @@
import { getLinearSourceScope } from '@/store/slices/linear/linear-slice-scope'
import { writeLinearIssue } from '@/lib/work-items/linear/linear-issue-write'
import { taskProviderErrorMessage, taskProviderErrorText } from '@/lib/task-provider-error-copy'
import {
taskProviderErrorMessage,
taskProviderErrorText
} from '@/lib/work-items/task-provider-error-copy'
import { useCallback, useState } from 'react'
import { toast } from 'sonner'
@@ -1,5 +1,5 @@
import { linearIssueReadError } from '@/lib/linear-read-error'
import { taskProviderErrorText } from '@/lib/task-provider-error-copy'
import { linearIssueReadError } from '@/lib/work-items/linear/linear-read-error'
import { taskProviderErrorText } from '@/lib/work-items/task-provider-error-copy'
import React from 'react'
import { ArrowLeft, ArrowRight, ExternalLink, Layers3, LoaderCircle, RefreshCw } from 'lucide-react'
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from 'vitest'
import { parseGitHubIssueOrPRLink } from '@/lib/github-links'
import { parseGitHubIssueOrPRLink } from '../../../../shared/github/links'
import type { RepoOption } from './smart-workspace-name-field-model'
import { resolveSmartWorkspaceGithubDirectLink } from './smart-workspace-github-direct-link'
@@ -1,10 +1,10 @@
import type React from 'react'
import type { parseGitHubIssueOrPRLink } from '@/lib/github-links'
import type { parseGitHubIssueOrPRLink } from '../../../../shared/github/links'
import {
lookupGitHubWorkItemByOwnerRepoForSource,
lookupGitHubWorkItemForSource
} from '@/lib/work-items/github/github-work-item-source-lookup'
import { lookupSmartGitHubSubmitItem } from '@/lib/smart-github-submit'
import { lookupSmartGitHubSubmitItem } from '@/lib/work-items/github/smart-github-submit'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import {
buildTaskSourceContextFromRepo,
@@ -1,6 +1,6 @@
import type React from 'react'
import type { useAppStore } from '@/store'
import type { parseGitHubIssueOrPRLink, RepoSlug } from '@/lib/github-links'
import type { parseGitHubIssueOrPRLink, RepoSlug } from '../../../../shared/github/links'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import type { JiraIssue, JiraSite } from '../../../../shared/jira/jira-types'
@@ -1,9 +1,9 @@
import type { RepoSlug } from '@/lib/github-links'
import type { RepoSlug } from '../../../../shared/github/links'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeTarget
} from '@/lib/github-source-runtime-context'
} from '@/lib/work-items/github/github-source-runtime-context'
import { githubRepoIdentityKey } from '../../../../shared/github/repository-identity-key'
import {
getTaskSourceCacheScope,
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useAppStore } from '@/store'
import { getJiraAccountLabel } from '@/lib/jira-account-label'
import { getJiraAccountLabel } from '@/lib/work-items/jira/jira-account-label'
import { assertRuntimeEnvironmentCapability } from '@/runtime/rpc/compatibility/runtime-capability-proof'
import {
getMatchingJiraSites,
@@ -1,11 +1,12 @@
import { useEffect, useMemo } from 'react'
import { useAppStore } from '@/store'
import { normalizeGitHubLinkQuery, parseGitHubIssueOrPRLink } from '@/lib/github-links'
import { normalizeGitHubLinkQuery } from '../../../../shared/new-workspace/github-links'
import { parseGitHubIssueOrPRLink } from '../../../../shared/github/links'
import {
lookupGitHubWorkItemByOwnerRepoForSource,
lookupGitHubWorkItemForSource
} from '@/lib/work-items/github/github-work-item-source-lookup'
import { lookupSmartGitHubSubmitItem } from '@/lib/smart-github-submit'
import { lookupSmartGitHubSubmitItem } from '@/lib/work-items/github/smart-github-submit'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import { RESULT_LIMIT } from './smart-workspace-name-field-model'
import { resolveSmartWorkspaceGithubDirectLink } from './smart-workspace-github-direct-link'
@@ -2,8 +2,8 @@ import { useEffect, useMemo } from 'react'
import {
listGitLabWorkItemsForSource,
lookupGitLabWorkItemByPathForSource
} from '@/lib/gitlab-work-item-source-lookup'
import { parseGitLabIssueOrMRLink } from '@/lib/gitlab-links'
} from '@/lib/work-items/gitlab/gitlab-work-item-source-lookup'
import { parseGitLabIssueOrMRLink } from '../../../../shared/new-workspace/gitlab-links'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import { RESULT_LIMIT } from './smart-workspace-name-field-model'
import type { useWorkItemSourceFoundation } from './use-work-item-source-foundation'
@@ -34,7 +34,7 @@ const mocks = vi.hoisted(() => ({
}
}))
vi.mock('@/runtime/linear/runtime-linear-client', () => ({ linearStatus: mocks.readStatus }))
vi.mock('@/lib/gitlab-work-item-source-lookup', () => ({
vi.mock('@/lib/work-items/gitlab/gitlab-work-item-source-lookup', () => ({
listGitLabWorkItemsForSource: mocks.listGitlabWorkItems,
lookupGitLabWorkItemByPathForSource: vi.fn()
}))
@@ -6,7 +6,7 @@ import {
} from '@/store/slices/linear/linear-issue-publication'
import type { LinearIssue } from '../../../../shared/linear/issue-types'
import type { LinearCollectionResult } from '../../../../shared/linear/workspace-types'
import { linearIssueViewError } from '@/lib/linear-read-error'
import { linearIssueViewError } from '@/lib/work-items/linear/linear-read-error'
import { getRepoExecutionHostId } from '../../../../shared/execution-host'
import { useEffect, useMemo, useRef } from 'react'
import { searchRuntimeRepoBaseRefDetails } from '@/runtime/source-control/references/runtime-repo-client'
@@ -1,7 +1,7 @@
import { useEffect, useMemo } from 'react'
import { CaseSensitive, LoaderCircle, Search } from 'lucide-react'
import { parseGitHubIssueOrPRLink } from '@/lib/github-links'
import { parseGitLabIssueOrMRLink } from '@/lib/gitlab-links'
import { parseGitHubIssueOrPRLink } from '../../../../shared/github/links'
import { parseGitLabIssueOrMRLink } from '../../../../shared/new-workspace/gitlab-links'
import {
isSmartWorkspaceLinearIssueIntentMatch,
parseBoundedSmartWorkspaceLinearIssueInput,
@@ -1,6 +1,6 @@
import { useGitHubTaskItems } from '@/hooks/useGitHubTaskItems'
import { useRef, useState } from 'react'
import type { RepoSlug } from '@/lib/github-links'
import type { RepoSlug } from '../../../../shared/github/links'
import type { GitHubWorkItem } from '../../../../shared/github/work-item-types'
import type { GitLabWorkItem } from '../../../../shared/gitlab-types'
import type { JiraIssue } from '../../../../shared/jira/jira-types'
@@ -3,7 +3,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import type { RuntimeClientTarget } from '../../../../../shared/runtime-client-target'
import { notifyWorkItemDetailsMutation } from '@/components/github/github-work-item-comment-mutations'
import { runPullRequestStateUpdate } from '@/components/github/github-work-item-edit-mutations'
import { getGitHubRuntimeRepoId } from '@/lib/github-source-runtime-context'
import { getGitHubRuntimeRepoId } from '@/lib/work-items/github/github-source-runtime-context'
import {
getPullRequestMergeConfirmationTitle,
getPullRequestMergeMethodLabel,
@@ -19,7 +19,7 @@ import type { TaskSourceContext } from '../../../../../shared/work-items/task-so
import type { PullRequestPageProjectOrigin } from '../page-types'
import { translate } from '@/i18n/i18n'
import type { GitHubPRMergeStatePresentation } from '@/components/github-pr-merge-state'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export async function changePullRequestState(args: {
canMutateState: boolean
@@ -21,7 +21,7 @@ import {
import { useConfirmationDialog } from '@/components/confirmation-dialog-context'
import { cn } from '@/lib/utils'
import { useAppStore } from '@/store'
import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { presentGitHubPRMergeState } from '@/components/github-pr-merge-state'
import { resolveGitHubPRMergeMethods } from '../../../../../shared/github/pull-request-merge-methods'
import { resolvePullRequestRepo } from '@/components/github/github-work-item-identity'
@@ -10,7 +10,7 @@ import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import {
getGitHubRuntimeRepoId,
getGitHubSourceRuntimeHost
} from '@/lib/github-source-runtime-context'
} from '@/lib/work-items/github/github-source-runtime-context'
import {
PR_FILE_CONTENT_CACHE_MAX_BYTES,
getRetainedPRFileContentsByteCount
@@ -12,7 +12,10 @@ import {
type CheckDetailsLoadState,
type GitHubChecksTabState
} from '@/components/github-checks-tab-state'
import { getGitHubRuntimeRepoId, type GitHubRuntimeHost } from '@/lib/github-source-runtime-context'
import {
getGitHubRuntimeRepoId,
type GitHubRuntimeHost
} from '@/lib/work-items/github/github-source-runtime-context'
import { translate } from '@/i18n/i18n'
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
@@ -5,7 +5,7 @@ import {
import type { DirectWorkItemLaunchResult } from '@/lib/workspace/creation/work-item/direct-work-item-setup'
import { toast } from 'sonner'
import { useAppStore } from '@/store'
import { startFixChecksAgent } from '@/lib/fix-checks-agent-launch'
import { startFixChecksAgent } from '@/lib/source-control/checks/fix-checks-agent-launch'
import { launchWorkItemDirect } from '@/lib/workspace/creation/work-item/launch-work-item-direct'
import { buildFixBrokenChecksPrompt } from '../../../../../shared/source-control/checks/pr-checks-fix-prompt'
import type { SourceControlAiWriteTarget } from '../../../../../shared/source-control/ai/settings/source-control-ai-recipe-save'
@@ -1,7 +1,10 @@
import { readPRCheckRefreshOwner } from '@/lib/pr-check-refresh-owner'
import { readPRCheckRefreshOwner } from '@/lib/source-control/checks/pr-check-refresh-owner'
import { toast } from 'sonner'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import { getGitHubRuntimeRepoId, type GitHubRuntimeHost } from '@/lib/github-source-runtime-context'
import {
getGitHubRuntimeRepoId,
type GitHubRuntimeHost
} from '@/lib/work-items/github/github-source-runtime-context'
import {
resetGitHubChecksTabForSource,
updateGitHubChecksTabLocalChecks,
@@ -1,13 +1,16 @@
import { toast } from 'sonner'
import { callRuntimeRpc } from '@/runtime/rpc/calls/runtime-rpc-call'
import { getGitHubRuntimeRepoId, type GitHubRuntimeHost } from '@/lib/github-source-runtime-context'
import {
getGitHubRuntimeRepoId,
type GitHubRuntimeHost
} from '@/lib/work-items/github/github-source-runtime-context'
import { translate } from '@/i18n/i18n'
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { PRCheckDetail } from '../../../../../shared/github/check-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { GitHubChecksTabState } from '../../github-checks-tab-state'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
/** The checks tab mints one of these per context; only its reference identity is ever read. */
type ChecksContextOwner = GitHubChecksTabState['contextOwner']
@@ -25,7 +25,7 @@ import { resolvePullRequestRepo } from '@/components/github/github-work-item-ide
import {
canUseGitHubRepoContext,
getGitHubSourceRuntimeHost
} from '@/lib/github-source-runtime-context'
} from '@/lib/work-items/github/github-source-runtime-context'
import { getLocalRepoProjectExecutionRuntimeContext } from '@/lib/local-preflight-context'
import { CLIENT_PLATFORM } from '@/lib/new-workspace'
import { resolveRepoExecutionHostPlatform } from '@/runtime/hosts/platform/execution-host-facts'
@@ -11,7 +11,7 @@ import { isScreenSubmitShortcut } from '@/lib/screen-submit-shortcut'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
} from '@/lib/comment-body-submit-state'
} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { addIssueCommentForRepo } from '@/components/github/github-work-item-comment-mutations'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
@@ -20,7 +20,7 @@ import type { PRComment } from '../../../../../shared/github/comment-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { MentionOption } from '../page-types'
import { MentionTextarea } from '../mentions/textarea'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export function GHCommentComposer({
className,
@@ -9,7 +9,7 @@ import { isScreenSubmitShortcut } from '@/lib/screen-submit-shortcut'
import {
getCommentBodySubmitState,
hasBoundedCommentBodyText
} from '@/lib/comment-body-submit-state'
} from '@/lib/source-control/review/comments/comment-body-submit-state'
import { translate } from '@/i18n/i18n'
import { useTranslate } from '@/i18n/use-translate'
import type { MentionOption } from '../page-types'
@@ -13,7 +13,7 @@ import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export async function postConversationReply(args: {
canUseRepoMutationContext: boolean
@@ -1,6 +1,6 @@
import { githubCommentImageUploadAddress } from '@/components/github/github-comment-image-upload-address'
import { getGitHubMutationTarget } from '@/components/github/github-work-item-mutation-target'
import { taskSourceRuntimeTarget } from '@/lib/task-source-runtime-target'
import { taskSourceRuntimeTarget } from '@/lib/work-items/task-source-runtime-target'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useShallow } from 'zustand/react/shallow'
import { toast } from 'sonner'
@@ -10,8 +10,8 @@ import { useRepoAssignees } from '@/hooks/useGitHubRepoMetadata'
import {
canUseGitHubRepoContext,
getGitHubRepoRoutingTarget
} from '@/lib/github-source-runtime-context'
import { usePRBotAuthorOverrides } from '@/lib/pr-bot-author-overrides'
} from '@/lib/work-items/github/github-source-runtime-context'
import { usePRBotAuthorOverrides } from '@/lib/source-control/review/pr-bot-author-overrides'
import {
filterPRCommentsByAudience,
getPRCommentAudienceCounts,
@@ -10,7 +10,7 @@ import { useRepoAssignees, useRepoLabels } from '@/hooks/useGitHubRepoMetadata'
import { useRepoAssigneesBySlug, useRepoLabelsBySlug } from '@/hooks/useGitHubSlugMetadata'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import type { GitHubWorkItem } from '../../../../../shared/github/work-item-types'
import { getGitHubRepoRoutingTarget } from '@/lib/github-source-runtime-context'
import { getGitHubRepoRoutingTarget } from '@/lib/work-items/github/github-source-runtime-context'
import { getStateLabel } from '@/components/github/work-item-state-presentation'
import { useTranslate } from '@/i18n/use-translate'
import type { PullRequestPageProjectOrigin } from '../page-types'
@@ -5,7 +5,7 @@ import type { DiffSection } from '@/components/editor/diff/sections/diff-section
import type { GitHubOwnerRepo } from '../../../../../shared/github/pull-request-types'
import type { PRComment } from '../../../../../shared/github/comment-types'
import type { TaskSourceContext } from '../../../../../shared/work-items/task-source-context'
import { codeHostErrorText } from '@/lib/code-host-error-copy'
import { codeHostErrorText } from '@/lib/source-control/remote/code-host-error-copy'
export async function addPullRequestLineComment(args: {
headSha: string | undefined

Some files were not shown because too many files have changed in this diff Show More