This commit is contained in:
Dax Raad
2025-05-18 22:30:41 -04:00
parent 020e0ca039
commit 99af6146d5
80 changed files with 13944 additions and 295 deletions

View File

@@ -1,11 +1,34 @@
import { App } from "./app";
import process from "node:process";
import { Server } from "./server/server";
import { Cli, Command, runExit } from "clipanion";
const app = await App.create({
directory: process.cwd(),
const cli = new Cli({
binaryLabel: `opencode`,
binaryName: `opencode`,
binaryVersion: `1.0.0`,
});
App.provide(app, async () => {
const server = Server.listen();
});
cli.register(
class Run extends Command {
async execute() {
const app = await App.create({
directory: process.cwd(),
});
await App.provide(app, async () => {
const server = Server.listen();
});
}
},
);
cli.register(
class OpenApi extends Command {
static paths = [["openapi"]];
async execute() {
const specs = await Server.openapi();
this.context.stdout.write(JSON.stringify(specs, null, 2));
}
},
);
const [_bun, _app, ...args] = process.argv;
cli.runExit(args);