cloudaxe-opencode/packages/opencode/src/cli/cmd/debug/index.ts

52 lines
1.4 KiB
TypeScript
Raw Normal View History

import { Global } from "@opencode-ai/core/global"
import { Duration, Effect } from "effect"
import { effectCmd } from "../../effect-cmd"
2025-07-01 16:06:38 +00:00
import { cmd } from "../cmd"
2025-10-04 04:07:58 +00:00
import { ConfigCommand } from "./config"
2025-07-01 16:06:38 +00:00
import { FileCommand } from "./file"
import { LSPCommand } from "./lsp"
import { RipgrepCommand } from "./ripgrep"
2025-07-10 15:25:31 +00:00
import { ScrapCommand } from "./scrap"
import { SkillCommand } from "./skill"
2025-07-01 16:06:38 +00:00
import { SnapshotCommand } from "./snapshot"
import { AgentCommand } from "./agent"
import { StartupCommand } from "./startup"
2025-07-01 16:06:38 +00:00
export const DebugCommand = cmd({
command: "debug",
describe: "debugging and troubleshooting tools",
2025-07-01 16:06:38 +00:00
builder: (yargs) =>
yargs
2025-10-04 04:07:58 +00:00
.command(ConfigCommand)
2025-07-01 16:06:38 +00:00
.command(LSPCommand)
.command(RipgrepCommand)
.command(FileCommand)
2025-07-10 15:25:31 +00:00
.command(ScrapCommand)
.command(SkillCommand)
2025-07-01 16:06:38 +00:00
.command(SnapshotCommand)
.command(StartupCommand)
.command(AgentCommand)
2025-07-23 16:14:54 +00:00
.command(PathsCommand)
.command(WaitCommand)
2025-07-01 16:06:38 +00:00
.demandCommand(),
async handler() {},
})
2025-07-23 16:14:54 +00:00
const WaitCommand = effectCmd({
command: "wait",
describe: "wait indefinitely (for debugging)",
handler: Effect.fn("Cli.debug.wait")(function* () {
yield* Effect.sleep(Duration.days(1))
}),
})
2025-07-23 16:14:54 +00:00
const PathsCommand = cmd({
command: "paths",
describe: "show global paths (data, config, cache, state)",
2025-07-23 16:14:54 +00:00
handler() {
for (const [key, value] of Object.entries(Global.Path)) {
console.log(key.padEnd(10), value)
}
},
})