mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 02:27:43 +00:00
* chore: shorten process-host comments * chore: audit CLI parsing and host-routing comments * chore: remove stale host-selector restriction comment * chore: shorten remaining CLI root comments * Shorten CLI handler comments * Shorten CLI runtime and command specification comments * Shorten top-level main process A–G comments * [comment audit] Shorten main process H–K comments --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { parseWslPath, toLinuxPath } from './wsl'
|
|
import type { ProjectExecutionRuntimeResolution } from '../shared/project-execution-runtime'
|
|
|
|
export type HookRuntimeTarget = {
|
|
wslDistro?: string | null
|
|
}
|
|
|
|
export function getHookRuntimeTarget(
|
|
projectRuntime?: ProjectExecutionRuntimeResolution | HookRuntimeTarget
|
|
): HookRuntimeTarget | undefined {
|
|
if (!projectRuntime) {
|
|
return undefined
|
|
}
|
|
|
|
if ('status' in projectRuntime) {
|
|
if (projectRuntime.status === 'repair-required') {
|
|
return projectRuntime.repair.preferredRuntime.kind === 'wsl'
|
|
? { wslDistro: projectRuntime.repair.preferredRuntime.distro }
|
|
: undefined
|
|
}
|
|
return projectRuntime.runtime.kind === 'wsl'
|
|
? { wslDistro: projectRuntime.runtime.distro }
|
|
: undefined
|
|
}
|
|
|
|
return projectRuntime.wslDistro ? { wslDistro: projectRuntime.wslDistro } : undefined
|
|
}
|
|
|
|
export function getHookWslContext(
|
|
cwd: string,
|
|
runtimeTarget?: HookRuntimeTarget
|
|
): { distro: string | null; linuxPath: string } | null {
|
|
const pathInfo = parseWslPath(cwd)
|
|
if (pathInfo) {
|
|
return pathInfo
|
|
}
|
|
|
|
const wslDistro = runtimeTarget?.wslDistro?.trim()
|
|
if (!wslDistro) {
|
|
return null
|
|
}
|
|
|
|
// Project runtime may route a Windows checkout through WSL; hooks need its Linux path.
|
|
return {
|
|
distro: wslDistro,
|
|
linuxPath: toLinuxPath(cwd)
|
|
}
|
|
}
|