mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-31 14:22:27 +00:00
17 lines
569 B
TypeScript
17 lines
569 B
TypeScript
import { Server } from "../../server/server"
|
|
import { cmd } from "./cmd"
|
|
import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
|
|
|
export const ServeCommand = cmd({
|
|
command: "serve",
|
|
builder: (yargs) => withNetworkOptions(yargs),
|
|
describe: "starts a headless opencode server",
|
|
handler: async (args) => {
|
|
const opts = await resolveNetworkOptions(args)
|
|
const server = Server.listen(opts)
|
|
console.log(`opencode server listening on http://${server.hostname}:${server.port}`)
|
|
await new Promise(() => {})
|
|
await server.stop()
|
|
},
|
|
})
|