chore: generate

This commit is contained in:
opencode-agent[bot]
2026-03-20 16:11:21 +00:00
parent e78944e9a4
commit 51618e9cef
3 changed files with 170 additions and 182 deletions

View File

@@ -81,11 +81,8 @@ export namespace Installation {
export class Service extends ServiceMap.Service<Service, Interface>()("@opencode/Installation") {} export class Service extends ServiceMap.Service<Service, Interface>()("@opencode/Installation") {}
export const layer: Layer.Layer< export const layer: Layer.Layer<Service, never, HttpClient.HttpClient | ChildProcessSpawner.ChildProcessSpawner> =
Service, Layer.effect(
never,
HttpClient.HttpClient | ChildProcessSpawner.ChildProcessSpawner
> = Layer.effect(
Service, Service,
Effect.gen(function* () { Effect.gen(function* () {
const http = yield* HttpClient.HttpClient const http = yield* HttpClient.HttpClient
@@ -192,8 +189,7 @@ export namespace Installation {
return "unknown" as Method return "unknown" as Method
}) })
const latestImpl = Effect.fn("Installation.latest")( const latestImpl = Effect.fn("Installation.latest")(function* (installMethod?: Method) {
function* (installMethod?: Method) {
const detectedMethod = installMethod || (yield* methodImpl()) const detectedMethod = installMethod || (yield* methodImpl())
if (detectedMethod === "brew") { if (detectedMethod === "brew") {
@@ -251,9 +247,7 @@ export namespace Installation {
) )
const data = yield* HttpClientResponse.schemaBodyJson(GitHubRelease)(response) const data = yield* HttpClientResponse.schemaBodyJson(GitHubRelease)(response)
return data.tag_name.replace(/^v/, "") return data.tag_name.replace(/^v/, "")
}, }, Effect.orDie)
Effect.orDie,
)
const upgradeImpl = Effect.fn("Installation.upgrade")(function* (m: Method, target: string) { const upgradeImpl = Effect.fn("Installation.upgrade")(function* (m: Method, target: string) {
let result: { code: ChildProcessSpawner.ExitCode; stdout: string; stderr: string } | undefined let result: { code: ChildProcessSpawner.ExitCode; stdout: string; stderr: string } | undefined

View File

@@ -178,9 +178,7 @@ it.effect("config sends the selected org header", () =>
}), }),
) )
const cfg = yield* Account.Service.use((s) => s.config(id, OrgID.make("org-9"))).pipe( const cfg = yield* Account.Service.use((s) => s.config(id, OrgID.make("org-9"))).pipe(Effect.provide(live(client)))
Effect.provide(live(client)),
)
expect(Option.getOrThrow(cfg)).toEqual({ theme: "light", seats: 5 }) expect(Option.getOrThrow(cfg)).toEqual({ theme: "light", seats: 5 })
expect(seen).toEqual({ expect(seen).toEqual({

View File

@@ -44,10 +44,7 @@ function testLayer(
httpHandler: (request: HttpClientRequest.HttpClientRequest) => Response, httpHandler: (request: HttpClientRequest.HttpClientRequest) => Response,
spawnHandler?: (cmd: string, args: readonly string[]) => string, spawnHandler?: (cmd: string, args: readonly string[]) => string,
) { ) {
return Installation.layer.pipe( return Installation.layer.pipe(Layer.provide(mockHttpClient(httpHandler)), Layer.provide(mockSpawner(spawnHandler)))
Layer.provide(mockHttpClient(httpHandler)),
Layer.provide(mockSpawner(spawnHandler)),
)
} }
describe("installation", () => { describe("installation", () => {
@@ -139,8 +136,7 @@ describe("installation", () => {
const layer = testLayer( const layer = testLayer(
() => jsonResponse({}), // HTTP not used for tap formula () => jsonResponse({}), // HTTP not used for tap formula
(cmd, args) => { (cmd, args) => {
if (cmd === "brew" && args.includes("anomalyco/tap/opencode") && args.includes("--formula")) if (cmd === "brew" && args.includes("anomalyco/tap/opencode") && args.includes("--formula")) return "opencode"
return "opencode"
if (cmd === "brew" && args.includes("--json=v2")) return brewInfoJson if (cmd === "brew" && args.includes("--json=v2")) return brewInfoJson
return "" return ""
}, },