mirror of
https://github.com/stablyai/orca.git
synced 2026-10-13 08:02:52 +00:00
* fix(opencode): submit initial prompts for reviewed 2.0.12 Route the reported release through the existing native startup intent. Retain conservative behavior for other unreviewed versions. * Wait for OpenCode startup fixture file reads in the hydration test --------- Co-authored-by: nwparker <nwparker@users.noreply.github.com>
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { isValidAppVersion } from './app-version'
|
|
|
|
export const OPENCODE_NATIVE_PROMPT_VERSIONS = ['2.0.12', '2.0.16'] as const
|
|
|
|
export type OpenCodeCliCapabilities = {
|
|
version: string | null
|
|
pluginApi: 'v1' | 'v2' | 'unknown'
|
|
promptMode: 'submit' | 'prefill' | 'unknown'
|
|
}
|
|
|
|
export function parseOpenCodeCliVersion(output: string | null | undefined): string | null {
|
|
const version = output
|
|
?.trim()
|
|
.match(/^(?:opencode\s+)?v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)$/i)?.[1]
|
|
return version && isValidAppVersion(version) ? version : null
|
|
}
|
|
|
|
export function getOpenCodeCliCapabilities(
|
|
output: string | null | undefined
|
|
): OpenCodeCliCapabilities {
|
|
const version = parseOpenCodeCliVersion(output)
|
|
const major = version?.split('.')[0]
|
|
return {
|
|
version,
|
|
pluginApi: major === '1' ? 'v1' : major === '2' ? 'v2' : 'unknown',
|
|
promptMode:
|
|
major === '1'
|
|
? 'submit'
|
|
: OPENCODE_NATIVE_PROMPT_VERSIONS.some((supported) => supported === version)
|
|
? 'prefill'
|
|
: 'unknown'
|
|
}
|
|
}
|