mini migrate to v2 (#35526)

This commit is contained in:
Simon Klee
2026-07-06 11:03:30 +02:00
committed by GitHub
parent fb75ea2cf6
commit 32cf36de9d
93 changed files with 2246 additions and 2335 deletions
+31
View File
@@ -0,0 +1,31 @@
import { ServerProcess } from "@opencode-ai/cli/server-process"
import { Effect } from "effect"
import { cmd } from "./cmd"
export const V2ServeCommand = cmd({
command: "__v2-serve",
describe: false,
builder: (yargs) =>
yargs
.option("stdio", { type: "boolean", hidden: true })
.option("port", { type: "number", hidden: true }),
handler: async (args) => {
const controller = new AbortController()
const interrupt = () => controller.abort()
process.once("SIGINT", interrupt)
process.once("SIGTERM", interrupt)
process.once("SIGHUP", interrupt)
try {
await Effect.runPromise(
ServerProcess.run({ mode: args.stdio ? "stdio" : "service", port: args.port }),
{ signal: controller.signal },
)
} catch (error) {
if (!controller.signal.aborted) throw error
} finally {
process.off("SIGINT", interrupt)
process.off("SIGTERM", interrupt)
process.off("SIGHUP", interrupt)
}
},
})