| ... | ... | @@ -11,6 +11,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; |
| 11 | 11 | |
| 12 | 12 | import { |
| 13 | 13 | isCommandMissingCause, |
| 14 | parseGenericCliVersion, |
| 14 | 15 | providerModelsFromSettings, |
| 15 | 16 | spawnAndCollect, |
| 16 | 17 | } from "./providerSnapshot.ts"; |
| ... | ... | @@ -93,6 +94,29 @@ describe("providerModelsFromSettings", () => { |
| 93 | 94 | }); |
| 94 | 95 | }); |
| 95 | 96 | |
| 97 | describe("parseGenericCliVersion", () => { |
| 98 | it("parses a bare version", () => { |
| 99 | expect(parseGenericCliVersion("1.14.19")).toBe("1.14.19"); |
| 100 | }); |
| 101 | |
| 102 | it("parses a v-prefixed version", () => { |
| 103 | expect(parseGenericCliVersion("opencode v2.0.3")).toBe("2.0.3"); |
| 104 | expect(parseGenericCliVersion("v22.19.0")).toBe("22.19.0"); |
| 105 | }); |
| 106 | |
| 107 | it("parses a version embedded in other output", () => { |
| 108 | expect(parseGenericCliVersion("codex-cli 0.53.0 (build abc)")).toBe("0.53.0"); |
| 109 | }); |
| 110 | |
| 111 | it("returns null when no version is present", () => { |
| 112 | expect(parseGenericCliVersion("no version here")).toBeNull(); |
| 113 | }); |
| 114 | |
| 115 | it("ignores versions glued to other word characters", () => { |
| 116 | expect(parseGenericCliVersion("build2.0.3artifact")).toBeNull(); |
| 117 | }); |
| 118 | }); |
| 119 | |
| 96 | 120 | describe("ProviderCommandNotFoundError", () => { |
| 97 | 121 | it("classifies normalized platform failures without parsing messages", () => { |
| 98 | 122 | expect( |