diff --git a/packages/opencode/src/app/app.ts b/packages/opencode/src/app/app.ts index fc7f49cb..b54c0893 100644 --- a/packages/opencode/src/app/app.ts +++ b/packages/opencode/src/app/app.ts @@ -15,6 +15,7 @@ export namespace App { hostname: z.string(), git: z.boolean(), path: z.object({ + home: z.string(), config: z.string(), data: z.string(), root: z.string(), @@ -75,6 +76,7 @@ export namespace App { }, git: git !== undefined, path: { + home: os.homedir(), config: Global.Path.config, state: Global.Path.state, data, diff --git a/packages/opencode/src/cli/cmd/debug/app.ts b/packages/opencode/src/cli/cmd/debug/app.ts new file mode 100644 index 00000000..ee5b038d --- /dev/null +++ b/packages/opencode/src/cli/cmd/debug/app.ts @@ -0,0 +1,20 @@ +import { App } from "../../../app/app" +import { bootstrap } from "../../bootstrap" +import { cmd } from "../cmd" + +const AppInfoCommand = cmd({ + command: "info", + builder: (yargs) => yargs, + async handler() { + await bootstrap({ cwd: process.cwd() }, async () => { + const app = App.info() + console.log(JSON.stringify(app, null, 2)) + }) + }, +}) + +export const AppCommand = cmd({ + command: "app", + builder: (yargs) => yargs.command(AppInfoCommand).demandCommand(), + async handler() {}, +}) diff --git a/packages/opencode/src/cli/cmd/debug/index.ts b/packages/opencode/src/cli/cmd/debug/index.ts index 265296f5..d7fbc8fb 100644 --- a/packages/opencode/src/cli/cmd/debug/index.ts +++ b/packages/opencode/src/cli/cmd/debug/index.ts @@ -1,6 +1,7 @@ import { Global } from "../../../global" import { bootstrap } from "../../bootstrap" import { cmd } from "../cmd" +import { AppCommand } from "./app" import { FileCommand } from "./file" import { LSPCommand } from "./lsp" import { RipgrepCommand } from "./ripgrep" @@ -11,6 +12,7 @@ export const DebugCommand = cmd({ command: "debug", builder: (yargs) => yargs + .command(AppCommand) .command(LSPCommand) .command(RipgrepCommand) .command(FileCommand) diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts index c6e7fedb..434606d8 100644 --- a/packages/sdk/js/src/gen/types.gen.ts +++ b/packages/sdk/js/src/gen/types.gen.ts @@ -552,6 +552,7 @@ export type App = { hostname: string git: boolean path: { + home: string config: string data: string root: string