diff options
| author | Ariane Emory <[email protected]> | 2026-02-16 15:15:34 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-16 14:15:34 -0600 |
| commit | b0afdf6ea4c016c46762b649adc30c0456814a43 (patch) | |
| tree | d4092d486a4f6cf67e954ec93a66c3fb10e1bff6 /packages | |
| parent | d8c25bfeb44771cc3a3ba17bf8de6ad2add9de2c (diff) | |
| download | opencode-b0afdf6ea4c016c46762b649adc30c0456814a43.tar.gz opencode-b0afdf6ea4c016c46762b649adc30c0456814a43.zip | |
feat(cli): add session delete command (#13571)
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/cli/cmd/session.ts | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/session.ts b/packages/opencode/src/cli/cmd/session.ts index c6a1fd413..1803f8495 100644 --- a/packages/opencode/src/cli/cmd/session.ts +++ b/packages/opencode/src/cli/cmd/session.ts @@ -38,10 +38,34 @@ function pagerCmd(): string[] { export const SessionCommand = cmd({ command: "session", describe: "manage sessions", - builder: (yargs: Argv) => yargs.command(SessionListCommand).demandCommand(), + builder: (yargs: Argv) => yargs.command(SessionListCommand).command(SessionDeleteCommand).demandCommand(), async handler() {}, }) +export const SessionDeleteCommand = cmd({ + command: "delete <sessionID>", + describe: "delete a session", + builder: (yargs: Argv) => { + return yargs.positional("sessionID", { + describe: "session ID to delete", + type: "string", + demandOption: true, + }) + }, + handler: async (args) => { + await bootstrap(process.cwd(), async () => { + try { + await Session.get(args.sessionID) + } catch { + UI.error(`Session not found: ${args.sessionID}`) + process.exit(1) + } + await Session.remove(args.sessionID) + UI.println(UI.Style.TEXT_SUCCESS_BOLD + `Session ${args.sessionID} deleted` + UI.Style.TEXT_NORMAL) + }) + }, +}) + export const SessionListCommand = cmd({ command: "list", describe: "list sessions", |
