fix(cli): validate and detect OpenCode Go install settings
Reject invalid --opencode-go values during non-TUI installs and detect existing OpenCode Go usage from the generated oh-my-opencode config so updates preserve the right defaults. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
|
||||
import { validateNonTuiArgs } from "./install-validators"
|
||||
import type { InstallArgs } from "./types"
|
||||
|
||||
function createArgs(overrides: Partial<InstallArgs> = {}): InstallArgs {
|
||||
return {
|
||||
tui: false,
|
||||
claude: "no",
|
||||
openai: "no",
|
||||
gemini: "no",
|
||||
copilot: "no",
|
||||
opencodeZen: "no",
|
||||
zaiCodingPlan: "no",
|
||||
kimiForCoding: "no",
|
||||
opencodeGo: "no",
|
||||
skipAuth: false,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
describe("validateNonTuiArgs", () => {
|
||||
test("rejects invalid --opencode-go values", () => {
|
||||
// #given
|
||||
const args = createArgs({ opencodeGo: "maybe" as InstallArgs["opencodeGo"] })
|
||||
|
||||
// #when
|
||||
const result = validateNonTuiArgs(args)
|
||||
|
||||
// #then
|
||||
expect(result.valid).toBe(false)
|
||||
expect(result.errors).toContain("Invalid --opencode-go value: maybe (expected: no, yes)")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user