From 353532b1c16bd5677efd2c352f502178f0c5094c Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Thu, 23 Apr 2026 16:00:01 +0000 Subject: [PATCH] chore: generate --- packages/opencode/src/installation/index.ts | 4 ++- packages/opencode/src/npm/index.ts | 35 ++++++++++----------- packages/opencode/test/npm.test.ts | 8 +++-- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/packages/opencode/src/installation/index.ts b/packages/opencode/src/installation/index.ts index e39b14b8f3..787f9ea8c5 100644 --- a/packages/opencode/src/installation/index.ts +++ b/packages/opencode/src/installation/index.ts @@ -136,7 +136,9 @@ export const layer: Layer.Layer path.join(global.cache, "packages", sanitize(pkg)) - const runView = Effect.fnUntraced( - function* (cmd: string[]) { - const handle = yield* spawner.spawn( - ChildProcess.make(cmd[0], cmd.slice(1), { - extendEnv: true, - }), - ) - const [stdout, stderr] = yield* Effect.all( - [Stream.mkString(Stream.decodeText(handle.stdout)), Stream.mkString(Stream.decodeText(handle.stderr))], - { concurrency: 2 }, - ) - const code = yield* handle.exitCode - if (code !== 0 || !stdout.trim()) { - return yield* Effect.fail(stderr || stdout || `Failed to run ${cmd.join(" ")}`) - } - return yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.String))(stdout) - }, - Effect.scoped, - ) + const runView = Effect.fnUntraced(function* (cmd: string[]) { + const handle = yield* spawner.spawn( + ChildProcess.make(cmd[0], cmd.slice(1), { + extendEnv: true, + }), + ) + const [stdout, stderr] = yield* Effect.all( + [Stream.mkString(Stream.decodeText(handle.stdout)), Stream.mkString(Stream.decodeText(handle.stderr))], + { concurrency: 2 }, + ) + const code = yield* handle.exitCode + if (code !== 0 || !stdout.trim()) { + return yield* Effect.fail(stderr || stdout || `Failed to run ${cmd.join(" ")}`) + } + return yield* Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.String))(stdout) + }, Effect.scoped) const viewLatestVersion = Effect.fnUntraced(function* (pkg: string) { return yield* runView(["npm", "view", pkg, "dist-tags.latest", "--json"]).pipe( Effect.catch(() => diff --git a/packages/opencode/test/npm.test.ts b/packages/opencode/test/npm.test.ts index b7680bb70d..b27d668c8c 100644 --- a/packages/opencode/test/npm.test.ts +++ b/packages/opencode/test/npm.test.ts @@ -103,7 +103,9 @@ describe("Npm.outdated", () => { return "" }) - const result = await Effect.runPromise(Npm.Service.use((svc) => svc.outdated("example", "1.0.0")).pipe(Effect.provide(layer))) + const result = await Effect.runPromise( + Npm.Service.use((svc) => svc.outdated("example", "1.0.0")).pipe(Effect.provide(layer)), + ) expect(result).toBe(true) expect(calls).toContainEqual(["npm", "view", "example", "dist-tags.latest", "--json"]) @@ -130,7 +132,9 @@ describe("Npm.outdated", () => { return "" }) - const result = await Effect.runPromise(Npm.Service.use((svc) => svc.outdated("example", "1.0.0")).pipe(Effect.provide(layer))) + const result = await Effect.runPromise( + Npm.Service.use((svc) => svc.outdated("example", "1.0.0")).pipe(Effect.provide(layer)), + ) expect(result).toBe(true) expect(calls).toContainEqual(["npm", "view", "example", "dist-tags.latest", "--json"])