Files
orca/src/shared/worktree-scan-failure.ts
T
Jinwoo Hong c45b2c94c6 fix: make worktree scan failures actionable (#21291)
* fix: make worktree scan failures actionable

* fix: preserve remote worktree scan diagnostics
2026-09-17 22:52:49 -04:00

26 lines
823 B
TypeScript

export const WORKTREE_SCAN_FAILURE_KINDS = [
'xcode-license',
'developer-tools',
'architecture-mismatch',
'unknown'
] as const
export type WorktreeScanFailureKind = (typeof WORKTREE_SCAN_FAILURE_KINDS)[number]
export function isWorktreeScanFailureKind(value: unknown): value is WorktreeScanFailureKind {
return WORKTREE_SCAN_FAILURE_KINDS.some((kind) => kind === value)
}
export function classifyWorktreeScanFailure(reason: string): WorktreeScanFailureKind {
if (/Agreeing to the Xcode\/iOS license requires admin privileges/i.test(reason)) {
return 'xcode-license'
}
if (/no developer tools were found/i.test(reason)) {
return 'developer-tools'
}
if (/Unknown system error -86|EBADARCH|Bad CPU type in executable/i.test(reason)) {
return 'architecture-mismatch'
}
return 'unknown'
}