mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 09:07:40 +00:00
refactor(renderer): remove the runtime-file-client barrel (#27975)
Co-authored-by: m4air <m4air@Mac.localdomain>
This commit is contained in:
@@ -285,7 +285,7 @@ export const PR_E2E_SOURCE_ROUTES = [
|
||||
specs: ['tests/e2e/paired-quick-open-large-tree.spec.ts'],
|
||||
matches: (file) =>
|
||||
isProductSource(file) &&
|
||||
/^(?:src\/main\/ipc\/filesystem-(?:list-files|search-file-paths)\.ts|src\/main\/ripgrep\/bundled-ripgrep-path\.ts|src\/main\/providers\/(?:filesystem-provider-contract|ssh-filesystem-provider(?:-capabilities)?)\.ts|src\/main\/runtime\/(?:orca-runtime-files|rpc\/methods\/files)\.ts|src\/renderer\/src\/(?:components\/(?:QuickOpen|quick-open-file-list|quick-open-search)\.tsx?|runtime\/(?:runtime-file-client|runtime-legacy-quick-open-inventory)\.ts)|src\/shared\/(?:quick-open-(?:install-rg|path-search|transport-budget)|ripgrep-process-availability|bundled-ripgrep)\.ts)$/.test(
|
||||
/^(?:src\/main\/ipc\/filesystem-(?:list-files|search-file-paths)\.ts|src\/main\/ripgrep\/bundled-ripgrep-path\.ts|src\/main\/providers\/(?:filesystem-provider-contract|ssh-filesystem-provider(?:-capabilities)?)\.ts|src\/main\/runtime\/(?:orca-runtime-files|rpc\/methods\/files)\.ts|src\/renderer\/src\/(?:components\/(?:QuickOpen|quick-open-file-list|quick-open-search)\.tsx?|runtime\/(?:runtime-file-search-client|runtime-legacy-quick-open-inventory)\.ts)|src\/shared\/(?:quick-open-(?:install-rg|path-search|transport-budget)|ripgrep-process-availability|bundled-ripgrep)\.ts)$/.test(
|
||||
file
|
||||
)
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useAttachmentDropState } from '../hooks/composer-state/attachment-drop-
|
||||
import type { ProjectGroup } from '../../../shared/project-group-types'
|
||||
|
||||
const uploads = vi.hoisted(() => ({ importPaths: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: uploads.importPaths
|
||||
}))
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { detectLanguage } from '@/lib/language-detect'
|
||||
import { getConnectionId } from '@/lib/connection-context'
|
||||
import { isPathInsideWorktree, toWorktreeRelativePath } from '@/lib/terminal-links'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import {
|
||||
normalizeBrowserNavigationUrl,
|
||||
redactKagiSessionToken
|
||||
|
||||
@@ -12,7 +12,7 @@ vi.mock('@/store', () => ({
|
||||
getState: vi.fn()
|
||||
}
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: readRuntimeFileContentMock
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-rpc-client', () => ({}))
|
||||
|
||||
@@ -4,7 +4,7 @@ import { toast } from 'sonner'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { getConnectionIdForFile } from '@/lib/connection-context'
|
||||
import { editorTabFileAccess } from '@/lib/local-file-access'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-client'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-read-client'
|
||||
import { getRuntimeTargetForFileOwner } from '@/lib/file-owner-runtime-target'
|
||||
import { useAppStore } from '@/store'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
|
||||
@@ -10,7 +10,7 @@ const mocks = vi.hoisted(() => ({
|
||||
getState: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-rpc-client', () => ({}))
|
||||
|
||||
@@ -13,7 +13,7 @@ import { lazyWithRetry as lazy } from '@/lib/lazy-with-retry'
|
||||
import { getConnectionIdForFile } from '@/lib/connection-context'
|
||||
import { editorTabFileAccess } from '@/lib/local-file-access'
|
||||
import { detectLanguage } from '@/lib/language-detect'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-client'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-read-client'
|
||||
import {
|
||||
FILE_OWNER_UNRESOLVED_MESSAGE,
|
||||
getRuntimeTargetForFileOwner
|
||||
|
||||
@@ -59,7 +59,7 @@ vi.mock('@/runtime/use-worktree-runtime-target', () => ({
|
||||
? { kind: 'environment', environmentId: runtimeEnvironmentId }
|
||||
: { kind: 'local' }
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-metadata-client', () => ({
|
||||
statRuntimePath: vi.fn(async () => ({ isDirectory: false }))
|
||||
}))
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionIdForFile: () => null }))
|
||||
|
||||
+1
-3
@@ -79,9 +79,7 @@ vi.mock('@/runtime/use-worktree-runtime-target', () => ({
|
||||
? { kind: 'environment', environmentId: runtimeEnvironmentId }
|
||||
: { kind: 'local' }
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
statRuntimePath: statRuntimePathMock
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-metadata-client', () => ({ statRuntimePath: statRuntimePathMock }))
|
||||
vi.mock('@/lib/connection-context', () => ({
|
||||
getConnectionIdForFile: (worktreeId: string) => targetConnectionOwners.get(worktreeId)
|
||||
}))
|
||||
|
||||
@@ -65,7 +65,7 @@ vi.mock('@/runtime/use-worktree-runtime-target', () => ({
|
||||
? { kind: 'environment', environmentId: runtimeEnvironmentId }
|
||||
: { kind: 'local' }
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-metadata-client', () => ({
|
||||
statRuntimePath: vi.fn(async () => ({ isDirectory: false }))
|
||||
}))
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionIdForFile: () => null }))
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { detectLanguage } from '@/lib/language-detect'
|
||||
import { joinPath } from '@/lib/path'
|
||||
import { openFilePreviewToSide } from '@/lib/file-preview'
|
||||
import { getEditorFileOperationContext } from '@/lib/editor-file-operation-owner'
|
||||
import { writeRuntimeFile } from '@/runtime/runtime-file-client'
|
||||
import { writeRuntimeFile } from '@/runtime/runtime-file-mutation-client'
|
||||
import { findWorktreeById } from '@/store/slices/worktree-helpers'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
import type { GitBranchChangeEntry } from '../../../../../../shared/git-diff-compare-types'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { RuntimeFileReadArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-client'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-read-client'
|
||||
import {
|
||||
statRuntimeReadTarget,
|
||||
type RuntimeFileSnapshot
|
||||
|
||||
@@ -5,7 +5,7 @@ import { createEditorSaveQueue } from '../editor-save-queue'
|
||||
import { canAutoSaveOpenFile } from '../editor-autosave'
|
||||
|
||||
const { writeFile } = vi.hoisted(() => ({ writeFile: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ writeRuntimeFile: writeFile }))
|
||||
vi.mock('@/runtime/runtime-file-mutation-client', () => ({ writeRuntimeFile: writeFile }))
|
||||
|
||||
it('blocks drafts, dirty state, autosave and explicit writes for paged previews', async () => {
|
||||
const store = createEditorStore()
|
||||
|
||||
@@ -5,10 +5,8 @@ import { useAppStore } from '@/store'
|
||||
import { getConnectionId } from '@/lib/connection-context'
|
||||
import { joinPath } from '@/lib/path'
|
||||
import type { WorktreeRuntimeOwnerState } from '@/lib/worktree-runtime-owner'
|
||||
import {
|
||||
importExternalPathsToRuntime,
|
||||
type RuntimeFileOperationArgs
|
||||
} from '@/runtime/runtime-file-client'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import {
|
||||
runtimeTargetEnvironmentId,
|
||||
type RuntimeClientTarget
|
||||
|
||||
@@ -12,7 +12,7 @@ const mocks = vi.hoisted(() => ({
|
||||
pathExists: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-rpc-client', () => ({}))
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { AppState } from '@/store'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
import { getConnectionIdForFile } from '@/lib/connection-context'
|
||||
import { editorTabFileAccess } from '@/lib/local-file-access'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-client'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-read-client'
|
||||
import {
|
||||
getRuntimeTargetForFileOwner,
|
||||
requireRuntimeTargetForFileOwner
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { StoreApi } from 'zustand'
|
||||
import type { AppState } from '@/store'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
import { findWorktreeById } from '@/store/slices/worktree-helpers'
|
||||
import { writeRuntimeFile } from '@/runtime/runtime-file-client'
|
||||
import { writeRuntimeFile } from '@/runtime/runtime-file-mutation-client'
|
||||
import { getEditorFileOperationContext } from '@/lib/editor-file-operation-owner'
|
||||
import {
|
||||
canAutoSaveOpenFile,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { LocalFileAccess } from '../../../../shared/local-file-access'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import { readRuntimeFilePreview } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { readRuntimeFilePreview } from '@/runtime/runtime-file-read-client'
|
||||
|
||||
export function readLocalImagePreview(
|
||||
absolutePath: string,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import type { MarkdownDocument } from '../../../../shared/filesystem-entry-types'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import {
|
||||
getMarkdownDocumentListRequestKey,
|
||||
requestSharedMarkdownDocumentList
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import type { MarkdownDocument } from '../../../../shared/filesystem-entry-types'
|
||||
import {
|
||||
listRuntimeMarkdownDocuments,
|
||||
type RuntimeFileOperationArgs
|
||||
} from '@/runtime/runtime-file-client'
|
||||
import { listRuntimeMarkdownDocuments } from '@/runtime/runtime-file-metadata-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
|
||||
type MarkdownDocumentListLoader = (
|
||||
context: RuntimeFileOperationArgs,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { getLinkSourceLocalOpenOwner } from '@/lib/link-source-local-open-owner'
|
||||
import { openHttpLink } from '@/lib/http-link-routing'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { requireRuntimeTargetForFileOwner } from '@/lib/file-owner-runtime-target'
|
||||
import { statRuntimePath } from '@/runtime/runtime-file-client'
|
||||
import { statRuntimePath } from '@/runtime/runtime-file-metadata-client'
|
||||
import { useAppStore } from '@/store'
|
||||
import { relativePathInsideRoot } from '../../../../shared/cross-platform-path'
|
||||
import { resolveMarkdownLinkTarget } from './markdown-internal-links'
|
||||
|
||||
@@ -4,7 +4,7 @@ import remarkParse from 'remark-parse'
|
||||
import { unified } from 'unified'
|
||||
import { resolveImageAbsolutePath } from './markdown-preview-links'
|
||||
import { getLocalImageCacheKey, loadLocalImageAbsolutePath } from './useLocalImageSrc'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { documentResourceAccess } from '@/lib/local-file-access'
|
||||
|
||||
export const MARKDOWN_PREVIEW_LOCAL_IMAGE_PREWARM_LIMIT = 64
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as RuntimeFileClient from '@/runtime/runtime-file-client'
|
||||
import type * as RuntimeFileMutationClient from '@/runtime/runtime-file-mutation-client'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { AppState } from '@/store/types'
|
||||
import { attachEditorAutosaveController } from './editor-autosave-controller'
|
||||
@@ -10,8 +10,8 @@ import { migrateRestoredEditorFileOwner } from './migrate-restored-editor-file-o
|
||||
|
||||
const mocks = vi.hoisted(() => ({ writeRuntimeFile: vi.fn() }))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof RuntimeFileClient>()),
|
||||
vi.mock('@/runtime/runtime-file-mutation-client', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof RuntimeFileMutationClient>()),
|
||||
writeRuntimeFile: mocks.writeRuntimeFile
|
||||
}))
|
||||
|
||||
|
||||
@@ -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 * as RuntimeFileClient from '@/runtime/runtime-file-client'
|
||||
import type * as RuntimeFileReadClient from '@/runtime/runtime-file-read-client'
|
||||
import { useAppStore } from '@/store'
|
||||
import { makeWorktree } from '../../store/slices/worktrees-slice-test-fixtures'
|
||||
import type { FileContent } from './editor-panel-content-types'
|
||||
@@ -13,8 +13,8 @@ import {
|
||||
} from './useEditorPanelFileContentLoader'
|
||||
|
||||
const mocks = vi.hoisted(() => ({ readRuntimeFileContent: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-client', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof RuntimeFileClient>()),
|
||||
vi.mock('@/runtime/runtime-file-read-client', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof RuntimeFileReadClient>()),
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { Editor } from '@tiptap/react'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-client'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client'
|
||||
import { toast } from 'sonner'
|
||||
import { createRichMarkdownExtensions } from './rich-markdown-extensions'
|
||||
import { createRichMarkdownEditorCodec } from './rich-markdown-source-transport'
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
type RichMarkdownImageRuntimeContext
|
||||
} from './rich-markdown-image-context'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ importExternalPathsToRuntime: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({ importExternalPathsToRuntime: vi.fn() }))
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionId: vi.fn(() => null) }))
|
||||
vi.mock('@/store', () => ({
|
||||
useAppStore: {
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
import { Editor } from '@tiptap/react'
|
||||
import { CellSelection } from '@tiptap/pm/tables'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-client'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client'
|
||||
import { createRichMarkdownExtensions } from './rich-markdown-extensions'
|
||||
import { createRichMarkdownEditorCodec } from './rich-markdown-source-transport'
|
||||
import { handleRichMarkdownImagePaste } from './rich-markdown-paste-image'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ importExternalPathsToRuntime: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({ importExternalPathsToRuntime: vi.fn() }))
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionId: vi.fn(() => null) }))
|
||||
vi.mock('@/store', () => ({
|
||||
useAppStore: {
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
loadLocalImageSrc,
|
||||
onImageCacheInvalidated
|
||||
} from './useLocalImageSrc'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import {
|
||||
createRawMarkdownHtmlBlock,
|
||||
createRawMarkdownHtmlInline,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Editor } from '@tiptap/core'
|
||||
import { getConnectionId } from '@/lib/connection-context'
|
||||
import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
|
||||
export type RichMarkdownImageRuntimeContext = Omit<RuntimeFileOperationArgs, 'connectionId'> & {
|
||||
connectionId?: string | null
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useLocalImagePick } from './useLocalImagePick'
|
||||
import { handleRichMarkdownImagePaste } from './rich-markdown-paste-image'
|
||||
import { runSlashCommand, slashCommands } from './rich-markdown-slash-commands'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: vi.fn().mockResolvedValue({
|
||||
results: [{ status: 'imported', destPath: '/repo/shot.png' }]
|
||||
})
|
||||
|
||||
@@ -6,12 +6,10 @@ import { toast } from 'sonner'
|
||||
import { insertRichMarkdownImageFromPath } from './rich-markdown-image-insert'
|
||||
import { createRichMarkdownExtensions } from './rich-markdown-extensions'
|
||||
import { createRichMarkdownEditorCodec } from './rich-markdown-source-transport'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-client'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client'
|
||||
import { getConnectionIdForFile } from '@/lib/connection-context'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
importExternalPathsToRuntime: vi.fn()
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({ importExternalPathsToRuntime: vi.fn() }))
|
||||
|
||||
vi.mock('@/lib/connection-context', () => ({
|
||||
getConnectionId: vi.fn(() => null),
|
||||
|
||||
@@ -3,7 +3,7 @@ import { toast } from 'sonner'
|
||||
import { dirname, basename } from '@/lib/path'
|
||||
import { getConnectionId } from '@/lib/connection-context'
|
||||
import { useAppStore } from '@/store'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-client'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client'
|
||||
import { getEditorFileOperationContext } from '@/lib/editor-file-operation-owner'
|
||||
import { editorTabDocumentFolderAccess } from '@/lib/local-file-access'
|
||||
import { requireRuntimeTargetForFileOwner } from '@/lib/file-owner-runtime-target'
|
||||
|
||||
@@ -20,7 +20,7 @@ const mocks = vi.hoisted(() => ({
|
||||
toastError: vi.fn()
|
||||
}))
|
||||
vi.mock('sonner', () => ({ toast: { error: mocks.toastError } }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: mocks.importPaths
|
||||
}))
|
||||
|
||||
|
||||
@@ -17,16 +17,18 @@ const mocks = vi.hoisted(() => ({
|
||||
getState: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-routing', () => ({
|
||||
getRuntimeFileReadScope: vi.fn(
|
||||
(
|
||||
target: { kind: 'local' } | { kind: 'environment'; environmentId: string },
|
||||
connectionId?: string
|
||||
) => connectionId ?? (target.kind === 'environment' ? target.environmentId : null)
|
||||
),
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent,
|
||||
subscribeRuntimeFileChanges: vi.fn()
|
||||
)
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-watch-client', () => ({ subscribeRuntimeFileChanges: vi.fn() }))
|
||||
|
||||
vi.mock('@/runtime/runtime-git-client', () => ({
|
||||
getRuntimeGitBranchDiff: mocks.getRuntimeGitBranchDiff,
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { OpenFile } from '@/store/slices/editor'
|
||||
import { getConnectionIdForFile, isWorktreeConnectionResolved } from '@/lib/connection-context'
|
||||
import { useAppStore } from '@/store'
|
||||
import { getDiskBaselineSignature } from './diff-content-signature'
|
||||
import { getRuntimeFileReadScope } from '@/runtime/runtime-file-client'
|
||||
import { getRuntimeFileReadScope } from '@/runtime/runtime-file-routing'
|
||||
import { readEditorCsvFileContent } from './csv/csv-file-content'
|
||||
import { RuntimeRpcCallError } from '@/runtime/runtime-rpc-client'
|
||||
import type { RuntimeClientTarget } from '@/runtime/runtime-client-target'
|
||||
|
||||
+4
-2
@@ -31,9 +31,11 @@ vi.mock('@/lib/connection-context', () => ({
|
||||
getConnectionIdForFile: () => 'ssh-a',
|
||||
isWorktreeConnectionResolved: () => true
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-routing', () => ({
|
||||
getRuntimeFileReadScope: (_settings: unknown, connectionId: string | undefined) =>
|
||||
connectionId ?? 'local',
|
||||
connectionId ?? 'local'
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
|
||||
|
||||
@@ -13,16 +13,18 @@ const mocks = vi.hoisted(() => ({
|
||||
getState: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-routing', () => ({
|
||||
getRuntimeFileReadScope: vi.fn(
|
||||
(
|
||||
settings: { activeRuntimeEnvironmentId?: string | null } | null | undefined,
|
||||
connectionId?: string
|
||||
) => connectionId ?? settings?.activeRuntimeEnvironmentId ?? null
|
||||
),
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent,
|
||||
subscribeRuntimeFileChanges: vi.fn()
|
||||
)
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-watch-client', () => ({ subscribeRuntimeFileChanges: vi.fn() }))
|
||||
|
||||
vi.mock('@/runtime/runtime-git-client', () => ({
|
||||
getRuntimeGitBranchDiff: vi.fn(),
|
||||
|
||||
+6
-4
@@ -11,14 +11,16 @@ const mocks = vi.hoisted(() => ({
|
||||
readRuntimeFileContent: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-routing', () => ({
|
||||
getRuntimeFileReadScope: vi.fn(
|
||||
(settings: { activeRuntimeEnvironmentId?: string | null } | null | undefined) =>
|
||||
settings?.activeRuntimeEnvironmentId ?? null
|
||||
),
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent,
|
||||
subscribeRuntimeFileChanges: vi.fn()
|
||||
)
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-watch-client', () => ({ subscribeRuntimeFileChanges: vi.fn() }))
|
||||
|
||||
vi.mock('@/runtime/runtime-git-client', () => ({
|
||||
getRuntimeGitBranchDiff: vi.fn(),
|
||||
|
||||
@@ -13,16 +13,18 @@ const mocks = vi.hoisted(() => ({
|
||||
getState: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-routing', () => ({
|
||||
getRuntimeFileReadScope: vi.fn(
|
||||
(
|
||||
settings: { activeRuntimeEnvironmentId?: string | null } | null | undefined,
|
||||
connectionId?: string
|
||||
) => connectionId ?? settings?.activeRuntimeEnvironmentId ?? null
|
||||
),
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent,
|
||||
subscribeRuntimeFileChanges: vi.fn()
|
||||
)
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-watch-client', () => ({ subscribeRuntimeFileChanges: vi.fn() }))
|
||||
|
||||
vi.mock('@/runtime/runtime-git-client', () => ({
|
||||
getRuntimeGitBranchDiff: vi.fn(),
|
||||
|
||||
@@ -13,11 +13,11 @@ const mocks = vi.hoisted(() => ({
|
||||
readRuntimeFileContent: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
getRuntimeFileReadScope: vi.fn(() => null),
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent,
|
||||
subscribeRuntimeFileChanges: vi.fn()
|
||||
vi.mock('@/runtime/runtime-file-routing', () => ({ getRuntimeFileReadScope: vi.fn(() => null) }))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: mocks.readRuntimeFileContent
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-watch-client', () => ({ subscribeRuntimeFileChanges: vi.fn() }))
|
||||
|
||||
vi.mock('@/runtime/runtime-git-client', () => ({
|
||||
getRuntimeGitBranchDiff: vi.fn(),
|
||||
|
||||
@@ -4,12 +4,12 @@ import { Editor } from '@tiptap/react'
|
||||
import { renderHook } from '@testing-library/react'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { toast } from 'sonner'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-client'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client'
|
||||
import { createRichMarkdownExtensions } from './rich-markdown-extensions'
|
||||
import { createRichMarkdownEditorCodec } from './rich-markdown-source-transport'
|
||||
import { useLocalImagePick } from './useLocalImagePick'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ importExternalPathsToRuntime: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({ importExternalPathsToRuntime: vi.fn() }))
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionId: vi.fn(() => null) }))
|
||||
vi.mock('@/store', () => ({
|
||||
useAppStore: {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
resetLocalImageSrcStateForTests,
|
||||
useLocalImageSrc
|
||||
} from './useLocalImageSrc'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import {
|
||||
blobUrlCache,
|
||||
cacheLocalImageBlob,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useEffectEvent, useState } from 'react'
|
||||
import { resolveImageAbsolutePath } from './markdown-preview-links'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { readLocalImagePreview } from './local-image-src-reader'
|
||||
import type { LocalFileAccess } from '../../../../shared/local-file-access'
|
||||
import {
|
||||
|
||||
@@ -32,7 +32,7 @@ vi.mock('@/store', () => ({
|
||||
})
|
||||
}))
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionIdFromState: () => runtimeConnectionId }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ statRuntimePath: runtime.stat }))
|
||||
vi.mock('@/runtime/runtime-file-metadata-client', () => ({ statRuntimePath: runtime.stat }))
|
||||
vi.mock('@/lib/file-owner-runtime-target', () => {
|
||||
const getRuntimeTargetForFileOwner = (
|
||||
_state: unknown,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { MarkdownDocument } from '../../../../shared/filesystem-entry-types
|
||||
import { useAppStore } from '@/store'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { getConnectionIdFromState } from '@/lib/connection-context'
|
||||
import { statRuntimePath } from '@/runtime/runtime-file-client'
|
||||
import { statRuntimePath } from '@/runtime/runtime-file-metadata-client'
|
||||
import {
|
||||
getRuntimeTargetForFileOwner,
|
||||
requireRuntimeTargetForFileOwner
|
||||
|
||||
@@ -20,7 +20,7 @@ vi.mock('@/store', () => ({
|
||||
})
|
||||
}))
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionIdFromState: () => null }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-metadata-client', () => ({
|
||||
listRuntimeMarkdownDocuments: runtime.list,
|
||||
statRuntimePath: runtime.stat
|
||||
}))
|
||||
|
||||
@@ -2,7 +2,8 @@ import { useCallback, useState } from 'react'
|
||||
import { dirname, joinPath } from '@/lib/path'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
import { createRuntimePath, runtimePathExists } from '@/runtime/runtime-file-client'
|
||||
import { createRuntimePath } from '@/runtime/runtime-file-mutation-client'
|
||||
import { runtimePathExists } from '@/runtime/runtime-file-metadata-client'
|
||||
import { executeOpenEditorPathMove } from '@/lib/execute-open-editor-path-move'
|
||||
import { getEditorFileOperationContext } from '@/lib/editor-file-operation-owner'
|
||||
import { requestEditorFileSave, requestEditorSaveQuiesce } from './editor-autosave'
|
||||
|
||||
@@ -15,7 +15,7 @@ import { nativeChatTaskListPredecessors } from './native-chat-task-list-history'
|
||||
import { NativeChatTaskList } from './NativeChatTaskList'
|
||||
import { useNativeChatTurnStatus } from './use-native-chat-turn-status'
|
||||
import { NativeChatAwaitingInputRow } from './NativeChatAwaitingInputRow'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import type { NativeChatTurnActivity } from '../../../../shared/native-chat-turn-activity'
|
||||
import { NativeChatTurnActivityLine } from './NativeChatTurnActivityLine'
|
||||
import {
|
||||
|
||||
@@ -17,7 +17,7 @@ import type {
|
||||
NativeChatSubagentDisclosure,
|
||||
NativeChatSubagentRosterState
|
||||
} from './native-chat-subagent-sections'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { useNativeChatWorkRun } from './use-native-chat-work-run'
|
||||
import { useNativeChatRowNavigation } from './use-native-chat-row-navigation'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { act, createElement } from 'react'
|
||||
import { fireEvent, screen, within } from '@testing-library/react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import {
|
||||
invalidateLocalImageSrcCacheForTests,
|
||||
loadLocalImageSrc,
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
useLocalImageSrc,
|
||||
releaseLocalImageSrcByKey
|
||||
} from '@/components/editor/useLocalImageSrc'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { copyableNativeChatImageSrc, keepPreviewOpenForChatMenu } from './native-chat-image-copy'
|
||||
import { isNativeChatPastedImagePath } from './native-chat-image-paste'
|
||||
import { chatImageAccess } from '@/lib/local-file-access'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { memo, useContext } from 'react'
|
||||
import type { CommentMarkdownLinkClickHandler } from '@/components/sidebar/CommentMarkdown'
|
||||
import { cn } from '@/lib/utils'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { MessageRow, type NativeChatDeliveryNotice } from './NativeChatMessageRow'
|
||||
import { NativeChatResolutionReceipt } from './NativeChatResolutionReceipt'
|
||||
import { NativeChatWorkingStatus } from './NativeChatWorkingStatus'
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import type { CommentMarkdownLinkClickHandler } from '@/components/sidebar/CommentMarkdown'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import type { NativeChatMessage } from '../../../../shared/native-chat-types'
|
||||
import type { NativeChatDeliveryNotice } from './NativeChatMessageRow'
|
||||
import { NativeChatRewindAction } from './NativeChatRewindAction'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useAppStore } from '@/store'
|
||||
import type { AppState } from '@/store/types'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import {
|
||||
runtimeTargetForOwnerEnvironment,
|
||||
type RuntimeClientTarget
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from '../quick-open-file-list-test-harness'
|
||||
import { useNativeChatMentionFiles } from './use-native-chat-mention-files'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', async () => {
|
||||
vi.mock('@/runtime/runtime-file-search-client', async () => {
|
||||
const mocks = await import('../__mocks__/quick-open-runtime-file-client')
|
||||
return {
|
||||
listRuntimeFiles: mocks.listRuntimeFilesMock,
|
||||
|
||||
@@ -12,7 +12,7 @@ import { useRuntimeFileListForWorktree, type RuntimeFileListState } from './quic
|
||||
|
||||
const listRuntimeFilesMock = vi.hoisted(() => vi.fn())
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-search-client', () => ({
|
||||
listRuntimeFiles: listRuntimeFilesMock,
|
||||
cancelRuntimeFileList: vi.fn(),
|
||||
searchRuntimeFilePaths: vi.fn()
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
renderProbe
|
||||
} from './quick-open-file-list-test-harness'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', async () => {
|
||||
vi.mock('@/runtime/runtime-file-search-client', async () => {
|
||||
const mocks = await import('./__mocks__/quick-open-runtime-file-client')
|
||||
return {
|
||||
listRuntimeFiles: mocks.listRuntimeFilesMock,
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
renderProbe
|
||||
} from './quick-open-file-list-test-harness'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', async () => {
|
||||
vi.mock('@/runtime/runtime-file-search-client', async () => {
|
||||
const mocks = await import('./__mocks__/quick-open-runtime-file-client')
|
||||
return {
|
||||
listRuntimeFiles: mocks.listRuntimeFilesMock,
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
cancelRuntimeFileList,
|
||||
listRuntimeFiles,
|
||||
searchRuntimeFilePaths
|
||||
} from '@/runtime/runtime-file-client'
|
||||
} from '@/runtime/runtime-file-search-client'
|
||||
import { debounceRuntimeFileRequest } from '@/runtime/runtime-file-request-debounce'
|
||||
import { splitFileNameFilterTokens } from '../../../shared/file-name-filter-tokens'
|
||||
import {
|
||||
|
||||
@@ -26,12 +26,14 @@ vi.mock('@/store', () => ({
|
||||
})
|
||||
}
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-metadata-client', () => ({
|
||||
statRuntimePath: mocks.stat,
|
||||
isRemoteRuntimeFileOperation: (context: { connectionId?: string }) =>
|
||||
Boolean(context.connectionId),
|
||||
isMissingRuntimePathError: (error: Error) => error.message.includes('ENOENT')
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-routing', () => ({
|
||||
isRemoteRuntimeFileOperation: (context: { connectionId?: string }) =>
|
||||
Boolean(context.connectionId)
|
||||
}))
|
||||
vi.mock('./right-sidebar/file-explorer-operation-owner', () => ({
|
||||
getFileExplorerOperationOwner: () => ({}),
|
||||
captureFileExplorerOperationGuard: () => ({
|
||||
|
||||
@@ -3,7 +3,7 @@ import { statUserOpenedPath } from '@/lib/user-opened-local-path'
|
||||
import { detectLanguage } from '@/lib/language-detect'
|
||||
import { joinPath, getRelativePathInsideRoot } from '@/lib/path'
|
||||
import { useAppStore } from '@/store'
|
||||
import { isMissingRuntimePathError } from '@/runtime/runtime-file-client'
|
||||
import { isMissingRuntimePathError } from '@/runtime/runtime-file-metadata-client'
|
||||
import { callRuntimeRpc } from '@/runtime/runtime-rpc-client'
|
||||
import { toRuntimeWorktreeSelector } from '@/runtime/runtime-worktree-selector'
|
||||
import type { RuntimeTerminalPathResolution } from '../../../shared/runtime-file-contracts'
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
makeRemoteWorktree
|
||||
} from './quick-open-file-list-test-harness'
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', async () => {
|
||||
vi.mock('@/runtime/runtime-file-search-client', async () => {
|
||||
const mocks = await import('./__mocks__/quick-open-runtime-file-client')
|
||||
return {
|
||||
listRuntimeFiles: mocks.listRuntimeFilesMock,
|
||||
|
||||
@@ -7,7 +7,7 @@ vi.mock('@/runtime/runtime-file-request-debounce', () => ({
|
||||
request: () => Promise<unknown>
|
||||
) => request()
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-search-client', () => ({
|
||||
listRuntimeFiles: mocks.list,
|
||||
cancelRuntimeFileList: mocks.cancel
|
||||
}))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { debounceRuntimeFileRequest } from '@/runtime/runtime-file-request-debounce'
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { quickOpenRecentCandidateSet } from '../../../shared/quick-open-recent-candidates'
|
||||
import { cancelRuntimeFileList, listRuntimeFiles } from '@/runtime/runtime-file-client'
|
||||
import { cancelRuntimeFileList, listRuntimeFiles } from '@/runtime/runtime-file-search-client'
|
||||
import { createBrowserUuid } from '@/lib/browser-uuid'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
shouldShowViewFileAction
|
||||
} from './file-explorer-row-action-visibility'
|
||||
import { directoryNode, fileNode } from './file-explorer-tree-node-test-fixtures'
|
||||
import type * as RuntimeFileClient from '@/runtime/runtime-file-client'
|
||||
import type * as RuntimeFileReadClient from '@/runtime/runtime-file-read-client'
|
||||
|
||||
const { downloadRuntimeFileMock, toastErrorMock, toastSuccessMock } = vi.hoisted(() => ({
|
||||
downloadRuntimeFileMock: vi.fn(),
|
||||
@@ -24,8 +24,8 @@ vi.mock('sonner', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof RuntimeFileClient>()
|
||||
vi.mock('@/runtime/runtime-file-read-client', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof RuntimeFileReadClient>()
|
||||
return {
|
||||
...actual,
|
||||
downloadRuntimeFile: downloadRuntimeFileMock
|
||||
|
||||
@@ -25,7 +25,7 @@ import type { TreeNode } from './file-explorer-types'
|
||||
import { useFileExplorerRowDrag } from './useFileExplorerRowDrag'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { CLOSE_ALL_CONTEXT_MENUS_EVENT } from '@/lib/close-all-context-menus'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { createMultiSelectDragGhost } from './file-explorer-multi-drag-image'
|
||||
import { FileExplorerRowContextMenu } from './file-explorer-row-context-menu'
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { InlineInputRow, type InlineInput } from './file-explorer-inline-input-r
|
||||
import { shouldShowIgnoredDecoration, STATUS_COLORS } from './status-display'
|
||||
import type { DirCache, FileExplorerOperationOwner, TreeNode } from './file-explorer-types'
|
||||
import type { FileExplorerRowProjection } from './file-explorer-row-projection'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { getFileExplorerOperationExecutionHostId } from './file-explorer-operation-owner'
|
||||
import type { WorkspaceFileDragSource } from '@/lib/workspace-file-drag'
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ const { writeClipboardFile, toastError } = vi.hoisted(() => ({
|
||||
}))
|
||||
vi.mock('sonner', () => ({ toast: { error: toastError } }))
|
||||
vi.mock('@/i18n/i18n', () => ({ translate: (_key: string, fallback: string) => fallback }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ downloadRuntimeFile: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({ downloadRuntimeFile: vi.fn() }))
|
||||
|
||||
const file: TreeNode = {
|
||||
name: 'file.txt',
|
||||
|
||||
+4
-2
@@ -26,11 +26,13 @@ vi.mock('@/components/editor/editor-autosave', () => ({
|
||||
requestEditorFileSave: save,
|
||||
requestEditorSaveQuiesce: quiesce
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-mutation-client', () => ({
|
||||
deleteRuntimePath: remove,
|
||||
readRuntimeFileContent: vi.fn().mockResolvedValue({ content: 'owner', isBinary: false }),
|
||||
writeRuntimeFile: vi.fn()
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: vi.fn().mockResolvedValue({ content: 'owner', isBinary: false })
|
||||
}))
|
||||
vi.mock('@/components/right-sidebar/fileExplorerUndoRedo', () => ({
|
||||
commitFileExplorerOp: vi.fn()
|
||||
}))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
|
||||
const readRuntimeDirectory = vi.fn()
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-mutation-client', () => ({
|
||||
readRuntimeDirectory: (...args: unknown[]) => readRuntimeDirectory(...args)
|
||||
}))
|
||||
vi.mock('./file-explorer-operation-owner', () => ({
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useAppStore } from '@/store'
|
||||
import { getRelativePathInsideRoot, joinPath } from '@/lib/path'
|
||||
import type { DirEntry } from '../../../../shared/filesystem-entry-types'
|
||||
import { sortDirEntries } from '../../../../shared/file-name-sort'
|
||||
import { readRuntimeDirectory } from '@/runtime/runtime-file-client'
|
||||
import { readRuntimeDirectory } from '@/runtime/runtime-file-mutation-client'
|
||||
import type { FileExplorerOperationOwner, TreeNode } from './file-explorer-types'
|
||||
import { shouldIncludeFileExplorerEntry } from './file-explorer-entries'
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import type { TreeNode } from './file-explorer-types'
|
||||
|
||||
export function shouldShowCollapseFolderAction(node: TreeNode, isExpanded: boolean): boolean {
|
||||
|
||||
@@ -2,7 +2,8 @@ import { LOCAL_EXECUTION_HOST_ID } from '../../../../shared/execution-host'
|
||||
import { toast } from 'sonner'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { extractIpcErrorMessage } from '@/lib/ipc-error'
|
||||
import { downloadRuntimeFile, type RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import { downloadRuntimeFile } from '@/runtime/runtime-file-read-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import type { TreeNode } from './file-explorer-types'
|
||||
import { shouldShowCopyFileAction } from './file-explorer-row-action-visibility'
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ const listRuntimeFilesMock = vi.hoisted(() => vi.fn())
|
||||
const cancelRuntimeFileListMock = vi.hoisted(() => vi.fn())
|
||||
const searchRuntimeFilePathsMock = vi.hoisted(() => vi.fn())
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-search-client', () => ({
|
||||
listRuntimeFiles: listRuntimeFilesMock,
|
||||
cancelRuntimeFileList: cancelRuntimeFileListMock,
|
||||
searchRuntimeFilePaths: searchRuntimeFilePathsMock
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useEffect, useMemo, useRef } from 'react'
|
||||
import { useAppStore } from '@/store'
|
||||
import { getRuntimeEnvironmentIdForWorktree } from '@/lib/worktree-runtime-owner'
|
||||
import { useWorkspaceFileBrowserActionPredicate } from '@/lib/file-preview'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
import type { Repo } from '../../../../shared/repo-types'
|
||||
import type { FileExplorerRowProjection } from './file-explorer-row-projection'
|
||||
|
||||
@@ -22,11 +22,8 @@ import {
|
||||
requestEditorSaveQuiesce
|
||||
} from '@/components/editor/editor-autosave'
|
||||
import { commitFileExplorerOp } from './fileExplorerUndoRedo'
|
||||
import {
|
||||
deleteRuntimePath,
|
||||
readRuntimeFileContent,
|
||||
writeRuntimeFile
|
||||
} from '@/runtime/runtime-file-client'
|
||||
import { deleteRuntimePath, writeRuntimeFile } from '@/runtime/runtime-file-mutation-client'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-read-client'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
|
||||
type UseFileDeletionParams = {
|
||||
|
||||
@@ -2,7 +2,8 @@ import { useCallback } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { basename, dirname, joinPath } from '@/lib/path'
|
||||
import type { TreeNode } from './file-explorer-types'
|
||||
import { copyRuntimePath, runtimePathExists } from '@/runtime/runtime-file-client'
|
||||
import { copyRuntimePath } from '@/runtime/runtime-file-mutation-client'
|
||||
import { runtimePathExists } from '@/runtime/runtime-file-metadata-client'
|
||||
import { captureFileExplorerOperationGuard } from './file-explorer-operation-owner'
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { afterEach, expect, it, vi } from 'vitest'
|
||||
import { useFileExplorerImport } from './useFileExplorerImport'
|
||||
|
||||
const mocks = vi.hoisted(() => ({ importPaths: vi.fn(), prepare: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: mocks.importPaths
|
||||
}))
|
||||
vi.mock('./file-explorer-operation-owner', () => ({
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ const mocks = vi.hoisted(() => ({
|
||||
captureGuard: vi.fn(),
|
||||
prepare: vi.fn()
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: mocks.importPaths
|
||||
}))
|
||||
vi.mock('./file-explorer-operation-owner', () => ({
|
||||
|
||||
@@ -18,7 +18,7 @@ const mocks = vi.hoisted(() => ({
|
||||
prepare: vi.fn(),
|
||||
toastError: vi.fn()
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: mocks.importPaths
|
||||
}))
|
||||
vi.mock('sonner', () => ({ toast: { error: mocks.toastError } }))
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getRelativePathInsideRoot } from '@/lib/path'
|
||||
import { useLayoutEffect, useRef, useState } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { extractIpcErrorMessage } from '@/lib/ipc-error'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-client'
|
||||
import { importExternalPathsToRuntime } from '@/runtime/runtime-file-import-client'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { createOsFileDropSequence, useOsFileDropOwner } from '@/hooks/use-os-file-drop-owner'
|
||||
import { getNativeFileDropRejectionMessage } from '@/lib/native-file-drop-rejection-message'
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { InlineInput } from './file-explorer-inline-input-row'
|
||||
import type { TreeNode } from './file-explorer-types'
|
||||
import type { FileExplorerRowProjection } from './file-explorer-row-projection'
|
||||
import { commitFileExplorerOp } from './fileExplorerUndoRedo'
|
||||
import { createRuntimePath, deleteRuntimePath } from '@/runtime/runtime-file-client'
|
||||
import { createRuntimePath, deleteRuntimePath } from '@/runtime/runtime-file-mutation-client'
|
||||
import {
|
||||
captureFileExplorerOperationGuard,
|
||||
getFileExplorerOperationOwner
|
||||
|
||||
@@ -19,7 +19,9 @@ vi.mock('./file-explorer-operation-owner', () => ({
|
||||
getFileExplorerOperationOwner: () => owner.current,
|
||||
getFileExplorerOperationOwnerFromState: () => owner.current
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ subscribeRuntimeFileChanges: runtime.subscribe }))
|
||||
vi.mock('@/runtime/runtime-file-watch-client', () => ({
|
||||
subscribeRuntimeFileChanges: runtime.subscribe
|
||||
}))
|
||||
|
||||
const refreshDir = vi.fn(async () => {})
|
||||
const refreshTree = vi.fn(async () => 'refreshed' as const)
|
||||
|
||||
@@ -19,7 +19,7 @@ vi.mock('./file-explorer-operation-owner', () => {
|
||||
getFileExplorerOperationOwnerFromState: () => owner
|
||||
}
|
||||
})
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ subscribeRuntimeFileChanges: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-watch-client', () => ({ subscribeRuntimeFileChanges: vi.fn() }))
|
||||
|
||||
const refreshDir = vi.fn(async () => {})
|
||||
const refreshTree = vi.fn(async () => 'refreshed' as const)
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ vi.mock('./file-explorer-operation-owner', () => ({
|
||||
getFileExplorerOperationOwner: () => ownerRef.current,
|
||||
getFileExplorerOperationOwnerFromState: () => ownerRef.current
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-watch-client', () => ({
|
||||
subscribeRuntimeFileChanges: runtimeWatch.subscribe
|
||||
}))
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useFileSearchPanel } from './useFileSearchPanel'
|
||||
import type { SearchResult } from '../../../../shared/code-search-types'
|
||||
|
||||
const { search } = vi.hoisted(() => ({ search: vi.fn() }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({ searchRuntimeFiles: search }))
|
||||
vi.mock('@/runtime/runtime-file-search-client', () => ({ searchRuntimeFiles: search }))
|
||||
const initial = useAppStore.getInitialState()
|
||||
const initialView: { view: 'files' | 'search' } = { view: 'search' }
|
||||
const empty: SearchResult = { files: [], totalMatches: 0, truncated: false }
|
||||
|
||||
@@ -15,7 +15,7 @@ vi.mock('@/lib/connection-context', () => ({
|
||||
getConnectionId: mocks.getConnectionId
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-search-client', () => ({
|
||||
searchRuntimeFiles: mocks.searchRuntimeFiles
|
||||
}))
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
createEmptyRuntimeFileSearchResult,
|
||||
getRuntimeFileSearchRejectedField
|
||||
} from '@/runtime/runtime-file-search-bounds'
|
||||
import { searchRuntimeFiles } from '@/runtime/runtime-file-client'
|
||||
import { searchRuntimeFiles } from '@/runtime/runtime-file-search-client'
|
||||
import { useAppStore } from '@/store'
|
||||
import {
|
||||
getExecutionHostIdForWorktree,
|
||||
|
||||
@@ -13,7 +13,13 @@ const runtimeFiles = vi.hoisted(() => ({
|
||||
readRuntimeFileContent: vi.fn(),
|
||||
writeRuntimeFile: vi.fn()
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-client', () => runtimeFiles)
|
||||
vi.mock('@/runtime/runtime-file-mutation-client', () => ({
|
||||
readRuntimeDirectory: runtimeFiles.readRuntimeDirectory,
|
||||
writeRuntimeFile: runtimeFiles.writeRuntimeFile
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-file-read-client', () => ({
|
||||
readRuntimeFileContent: runtimeFiles.readRuntimeFileContent
|
||||
}))
|
||||
vi.mock('@/i18n/i18n', () => ({ translate: (_key: string, fallback: string) => fallback }))
|
||||
vi.mock('sonner', () => ({ toast: { error: vi.fn(), success: vi.fn() } }))
|
||||
|
||||
|
||||
@@ -32,7 +32,8 @@ import { McpMissingConfigList } from './McpMissingConfigList'
|
||||
import { loadMcpConfigInspections } from './mcp-config-inspection'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { captureDirectSshMutationExpectation } from '@/lib/ssh-mutation-expectation'
|
||||
import { writeRuntimeFile, type RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import { writeRuntimeFile } from '@/runtime/runtime-file-mutation-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { runtimeTargetForOwnerEnvironment } from '@/runtime/runtime-client-target'
|
||||
|
||||
type McpConfigSectionProps = {
|
||||
|
||||
@@ -9,11 +9,9 @@ import {
|
||||
import { joinPath } from '../../lib/path'
|
||||
import { extractIpcErrorMessage } from '../../lib/ipc-error'
|
||||
import type { LoadedMcpConfigInspection } from './McpConfigFileRow'
|
||||
import {
|
||||
readRuntimeDirectory,
|
||||
readRuntimeFileContent,
|
||||
type RuntimeFileOperationArgs
|
||||
} from '@/runtime/runtime-file-client'
|
||||
import { readRuntimeDirectory } from '@/runtime/runtime-file-mutation-client'
|
||||
import { readRuntimeFileContent } from '@/runtime/runtime-file-read-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
|
||||
function isMissingFileError(error: unknown): boolean {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { detectLanguage } from '@/lib/language-detect'
|
||||
import { toWorktreeRelativePath } from '@/lib/terminal-links'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
import {
|
||||
validateNewTabEntryAbsolutePath,
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { detectLanguage } from '@/lib/language-detect'
|
||||
import { joinPath } from '@/lib/path'
|
||||
import { getRendererAppPlatform } from '@/lib/renderer-app-platform'
|
||||
import {
|
||||
createRuntimePath,
|
||||
statRuntimePath,
|
||||
type RuntimeFileOperationArgs
|
||||
} from '@/runtime/runtime-file-client'
|
||||
import { createRuntimePath } from '@/runtime/runtime-file-mutation-client'
|
||||
import { statRuntimePath } from '@/runtime/runtime-file-metadata-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { OpenFile } from '@/store/slices/editor'
|
||||
import {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ const listRuntimeFilesMock = vi.hoisted(() => vi.fn())
|
||||
const cancelRuntimeFileListMock = vi.hoisted(() => vi.fn())
|
||||
const searchRuntimeFilePathsMock = vi.hoisted(() => vi.fn())
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-search-client', () => ({
|
||||
listRuntimeFiles: listRuntimeFilesMock,
|
||||
cancelRuntimeFileList: cancelRuntimeFileListMock,
|
||||
searchRuntimeFilePaths: searchRuntimeFilePathsMock
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getEditorFileOperationContext } from '@/lib/editor-file-operation-owner
|
||||
import { getFolderWorkspaceConnectionId } from '@/lib/folder-workspace-connection'
|
||||
import { getLocalPathOpenOwnerForRoute, isLocalPathOpenBlocked } from '@/lib/local-path-open-guard'
|
||||
import { getResolvedExecutionHostIdForWorktree } from '@/lib/resolved-worktree-execution-host'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client'
|
||||
import type { RuntimeFileOperationArgs } from '@/runtime/runtime-file-client-types'
|
||||
import type { useAppStore } from '@/store'
|
||||
import { parseWorkspaceKey } from '../../../../shared/workspace-scope'
|
||||
import { runtimeTargetEnvironmentId } from '@/runtime/runtime-client-target'
|
||||
|
||||
@@ -63,7 +63,7 @@ vi.mock('@/store', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: mocks.importExternalPathsToRuntime
|
||||
}))
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ vi.mock('@/store', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: mocks.importExternalPathsToRuntime
|
||||
}))
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ const mocks = vi.hoisted(() => ({
|
||||
recordInput: vi.fn()
|
||||
}))
|
||||
vi.mock('@/store', () => ({ useAppStore: { getState: () => mocks.state } }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: mocks.importPaths
|
||||
}))
|
||||
vi.mock('./terminal-input-activity', () => ({ recordTerminalUserInputForLeaf: mocks.recordInput }))
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ const mocks = vi.hoisted(() => {
|
||||
}
|
||||
})
|
||||
vi.mock('@/store', () => ({ useAppStore: { getState: () => mocks.state } }))
|
||||
vi.mock('@/runtime/runtime-file-client', () => ({
|
||||
vi.mock('@/runtime/runtime-file-import-client', () => ({
|
||||
importExternalPathsToRuntime: mocks.importPaths
|
||||
}))
|
||||
vi.mock('./terminal-input-activity', () => ({ recordTerminalUserInputForLeaf: vi.fn() }))
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from '@/lib/terminal-links'
|
||||
import { normalizeAbsolutePath } from '@/lib/terminal-path-normalization'
|
||||
import { parseWslUncPath } from '../../../../shared/wsl-paths'
|
||||
import { isRemoteRuntimeFileOperation } from '@/runtime/runtime-file-client'
|
||||
import { isRemoteRuntimeFileOperation } from '@/runtime/runtime-file-routing'
|
||||
import {
|
||||
getTerminalFileContext,
|
||||
mapTerminalFilePath,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { detectLanguage } from '@/lib/language-detect'
|
||||
import { findWorkspaceFileRoute } from '@/lib/runtime-workspace-file-route'
|
||||
import { isPathInsideWorktree, toWorktreeRelativePath } from '@/lib/terminal-links'
|
||||
import { canClientOsOpenWorkspaceFile } from '@/lib/workspace-file-host-routing'
|
||||
import { isMissingRuntimePathError } from '@/runtime/runtime-file-client'
|
||||
import { isMissingRuntimePathError } from '@/runtime/runtime-file-metadata-client'
|
||||
import { useAppStore } from '@/store'
|
||||
import { activateAndRevealWorkspace, activateAndRevealWorktree } from '@/lib/worktree-activation'
|
||||
import { resolveKnownWorktreeRootPathLink } from './terminal-worktree-path-link'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user