|
|
@@ -1,5 +1,10 @@
|
|
|
import { Global } from "@opencode-ai/core/global"
|
|
|
+import { InstallationVersion } from "@opencode-ai/core/installation/version"
|
|
|
+import { Flag } from "@opencode-ai/core/flag/flag"
|
|
|
+import os from "os"
|
|
|
import { Duration, Effect } from "effect"
|
|
|
+import { Config } from "@/config/config"
|
|
|
+import { ConfigPlugin } from "@/config/plugin"
|
|
|
import { effectCmd } from "../../effect-cmd"
|
|
|
import { cmd } from "../cmd"
|
|
|
import { ConfigCommand } from "./config"
|
|
|
@@ -26,6 +31,7 @@ export const DebugCommand = cmd({
|
|
|
.command(SnapshotCommand)
|
|
|
.command(StartupCommand)
|
|
|
.command(AgentCommand)
|
|
|
+ .command(InfoCommand)
|
|
|
.command(PathsCommand)
|
|
|
.command(WaitCommand)
|
|
|
.demandCommand(),
|
|
|
@@ -40,6 +46,34 @@ const WaitCommand = effectCmd({
|
|
|
}),
|
|
|
})
|
|
|
|
|
|
+const InfoCommand = effectCmd({
|
|
|
+ command: "info",
|
|
|
+ describe: "show debug information",
|
|
|
+ handler: Effect.fn("Cli.debug.info")(function* () {
|
|
|
+ const config = yield* Config.Service.use((cfg) => cfg.get())
|
|
|
+ const termProgram = process.env.TERM_PROGRAM
|
|
|
+ ? `${process.env.TERM_PROGRAM}${process.env.TERM_PROGRAM_VERSION ? ` ${process.env.TERM_PROGRAM_VERSION}` : ""}`
|
|
|
+ : undefined
|
|
|
+ const terminal = [termProgram, process.env.TERM].filter((item): item is string => Boolean(item)).join(" / ")
|
|
|
+
|
|
|
+ console.log(`opencode version: ${InstallationVersion}`)
|
|
|
+ console.log(`os: ${os.type()} ${os.release()} ${os.arch()}`)
|
|
|
+ console.log(`terminal: ${terminal || "unknown"}`)
|
|
|
+ console.log("plugins:")
|
|
|
+ if (Flag.OPENCODE_PURE) {
|
|
|
+ console.log("external plugins disabled (--pure)")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!config.plugin_origins?.length) {
|
|
|
+ console.log("none")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for (const plugin of config.plugin_origins) {
|
|
|
+ console.log(`- ${ConfigPlugin.pluginSpecifier(plugin.spec)}`)
|
|
|
+ }
|
|
|
+ }),
|
|
|
+})
|
|
|
+
|
|
|
const PathsCommand = cmd({
|
|
|
command: "paths",
|
|
|
describe: "show global paths (data, config, cache, state)",
|