Files
archived-orca/src/preload/api/git-inspection-api.ts
T
Kelvin Amoaba 0b516b8a9d fix(workspace-cleanup): warn before deleting a workspace's ignored local files like .env (#41446)
* fix(workspace-cleanup): warn before deleting a workspace's ignored local files

git worktree remove deletes ignored files such as .env and local config,
and git status never reports them, so cleanup showed "Clean git" and the
delete dialog said nothing. Read them with a bounded ls-files listing,
skip regenerable output, symlinks and byte-identical copies of the main
checkout, and surface the rest as an approval-only cleanup blocker and a
warning in the delete confirmation.

* fix(workspace-cleanup): show an unchecked warning when the ignored-files check fails

* style(workspace-cleanup): format merged fact status list
2026-11-12 09:23:46 +00:00

159 lines
4.5 KiB
TypeScript

import type {
GitBranchCompareResult,
GitCommitCompareResult,
GitDiffResult
} from '../../shared/git/diff/git-diff-compare-types'
import type { GitMutationInFlight } from '../../shared/git/commands/git-mutation-in-flight'
import type {
GitConflictOperation,
GitStagingArea,
GitStatusResult,
GitUpstreamStatus
} from '../../shared/git/status/git-status-types'
import type { GitPushTarget } from '../../shared/worktree/types'
import type { WorktreeAtRiskLocalFiles } from '../../shared/worktree/at-risk-local-files'
import type {
GitHistoryItemRef,
GitHistoryOptions,
GitHistoryResult
} from '../../shared/git/history/git-history-types'
import type {
CommitMessageAgentCapability,
CommitMessageModelCapability
} from '../../shared/source-control/ai/generation/commit-message-agent-spec'
export type GitInspectionApi = {
status: (args: {
worktreePath: string
connectionId?: string
admissionTier?: 'interactive' | 'status' | 'background'
includeIgnored?: boolean
includeLineStats?: boolean
bypassEffectiveUpstreamNegativeCache?: boolean
reuseLineStats?: boolean
/** Merge-base OID to measure the branch line total against; omit to skip the work. */
branchLineTotalMergeBase?: string
requestToken?: string
/** The active workspace's first status: a user act that may start its WSL distro. */
wakeWslDistro?: boolean
}) => Promise<GitStatusResult>
cancelStatus: (args: { requestToken: string }) => Promise<void>
setStatusUpstreamRefWatch: (args: {
worktreeId: string
worktreePath: string
executionHostId: string
connectionId?: string
branch?: string
upstreamName?: string
}) => Promise<void>
submoduleStatus: (args: {
worktreePath: string
submodulePath: string
connectionId?: string
area?: GitStagingArea
}) => Promise<GitStatusResult>
checkIgnored: (args: {
worktreePath: string
paths: string[]
connectionId?: string
}) => Promise<string[]>
atRiskLocalFiles: (args: {
worktreePath: string
connectionId?: string
}) => Promise<WorktreeAtRiskLocalFiles>
findHugeFoldersToIgnore: (args: { worktreePath: string }) => Promise<string[]>
refs: (args: {
worktreePath: string
connectionId?: string
query?: string
}) => Promise<GitHistoryItemRef[]>
history: (
args: {
worktreePath: string
connectionId?: string
wakeWslDistro?: boolean
} & GitHistoryOptions
) => Promise<GitHistoryResult>
conflictOperation: (args: {
worktreePath: string
connectionId?: string
}) => Promise<GitConflictOperation>
mutationInFlight: (args: {
worktreePath: string
connectionId?: string
}) => Promise<GitMutationInFlight>
diff: (args: {
worktreePath: string
filePath: string
staged: boolean
compareAgainstHead?: boolean
oldPath?: string
connectionId?: string
wakeWslDistro?: boolean
}) => Promise<GitDiffResult>
branchCompare: (args: {
worktreePath: string
baseRef: string
connectionId?: string
admissionTier?: 'interactive' | 'status' | 'background'
}) => Promise<GitBranchCompareResult>
commitCompare: (args: {
worktreePath: string
commitId: string
connectionId?: string
}) => Promise<GitCommitCompareResult>
upstreamStatus: (args: {
worktreePath: string
connectionId?: string
pushTarget?: GitPushTarget
}) => Promise<GitUpstreamStatus>
branchDiff: (args: {
worktreePath: string
compare: {
baseRef: string
baseOid: string
headOid: string
mergeBase: string
}
filePath: string
oldPath?: string
connectionId?: string
wakeWslDistro?: boolean
}) => Promise<GitDiffResult>
commitDiff: (args: {
worktreePath: string
commitOid: string
parentOid?: string | null
filePath: string
oldPath?: string
connectionId?: string
wakeWslDistro?: boolean
}) => Promise<GitDiffResult>
discoverCommitMessageModels: (args: {
agentId: string
worktreePath?: string
connectionId?: string
}) => Promise<
| {
success: true
capability: CommitMessageAgentCapability
models: CommitMessageModelCapability[]
defaultModelId: string
catalogOrigin: 'probe' | 'spec'
}
| { success: false; error: string }
>
remoteFileUrl: (args: {
worktreePath: string
relativePath: string
line: number
endLine?: number
connectionId?: string
}) => Promise<string | null>
remoteCommitUrl: (args: {
worktreePath: string
sha: string
connectionId?: string
}) => Promise<string | null>
}