mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
* Add project Windows runtime selection * Fix project Windows runtime selection Co-authored-by: Orca <help@stably.ai> * fix: preserve WSL shell variables --------- Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com> Co-authored-by: Orca <help@stably.ai> Co-authored-by: Neil <neil@stably.ai>
33 lines
1007 B
TypeScript
33 lines
1007 B
TypeScript
import type { ProjectExecutionRuntimeResolution } from '../../shared/project-execution-runtime'
|
|
import type { WslPreflightTarget } from './preflight-wsl-agent-detection'
|
|
|
|
export type PreflightRuntimeContext = {
|
|
wslDistro?: string | null
|
|
wslDefault?: boolean
|
|
projectRuntime?: ProjectExecutionRuntimeResolution
|
|
}
|
|
|
|
export function getPreflightWslTarget(
|
|
context?: PreflightRuntimeContext,
|
|
platform: string = process.platform
|
|
): WslPreflightTarget | null {
|
|
if (platform !== 'win32') {
|
|
return null
|
|
}
|
|
if (context?.projectRuntime) {
|
|
if (context.projectRuntime.status === 'repair-required') {
|
|
throw new Error(
|
|
`Project runtime requires repair before preflight: ${context.projectRuntime.repair.reason}`
|
|
)
|
|
}
|
|
return context.projectRuntime.runtime.kind === 'wsl'
|
|
? { distro: context.projectRuntime.runtime.distro }
|
|
: null
|
|
}
|
|
const distro = context?.wslDistro?.trim()
|
|
if (distro) {
|
|
return { distro }
|
|
}
|
|
return context?.wslDefault ? {} : null
|
|
}
|