1a734adb4d
Moves effect logging, observability, runtime utilities, flags, installation version info, and process utilities from opencode to core package. This enables better code sharing across packages and establishes core as the single source of truth for foundational utilities. All internal imports updated to use @opencode-ai/core paths for consistency.
22 lines
763 B
TypeScript
22 lines
763 B
TypeScript
import { Server } from "../../server/server"
|
|
import { cmd } from "./cmd"
|
|
import { withNetworkOptions, resolveNetworkOptions } from "../network"
|
|
import { Flag } from "@opencode-ai/core/flag/flag"
|
|
|
|
export const ServeCommand = cmd({
|
|
command: "serve",
|
|
builder: (yargs) => withNetworkOptions(yargs),
|
|
describe: "starts a headless opencode server",
|
|
handler: async (args) => {
|
|
if (!Flag.OPENCODE_SERVER_PASSWORD) {
|
|
console.log("Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured.")
|
|
}
|
|
const opts = await resolveNetworkOptions(args)
|
|
const server = await Server.listen(opts)
|
|
console.log(`opencode server listening on http://${server.hostname}:${server.port}`)
|
|
|
|
await new Promise(() => {})
|
|
await server.stop()
|
|
},
|
|
})
|