File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -359,6 +359,7 @@ opencode serve --hostname 0.0.0.0 --port 4096
359359opencode serve [--port <number>] [--hostname <string>] [--cors <origin>]
360360opencode session [command]
361361opencode session list
362+ opencode session delete <sessionID>
362363opencode stats
363364opencode uninstall
364365opencode upgrade
Original file line number Diff line number Diff line change @@ -38,10 +38,34 @@ function pagerCmd(): string[] {
3838export const SessionCommand = cmd ( {
3939 command : "session" ,
4040 describe : "manage sessions" ,
41- builder : ( yargs : Argv ) => yargs . command ( SessionListCommand ) . demandCommand ( ) ,
41+ builder : ( yargs : Argv ) => yargs . command ( SessionListCommand ) . command ( SessionDeleteCommand ) . demandCommand ( ) ,
4242 async handler ( ) { } ,
4343} )
4444
45+ export const SessionDeleteCommand = cmd ( {
46+ command : "delete <sessionID>" ,
47+ describe : "delete a session" ,
48+ builder : ( yargs : Argv ) => {
49+ return yargs . positional ( "sessionID" , {
50+ describe : "session ID to delete" ,
51+ type : "string" ,
52+ demandOption : true ,
53+ } )
54+ } ,
55+ handler : async ( args ) => {
56+ await bootstrap ( process . cwd ( ) , async ( ) => {
57+ try {
58+ await Session . get ( args . sessionID )
59+ } catch {
60+ UI . error ( `Session not found: ${ args . sessionID } ` )
61+ process . exit ( 1 )
62+ }
63+ await Session . remove ( args . sessionID )
64+ UI . println ( UI . Style . TEXT_SUCCESS_BOLD + `Session ${ args . sessionID } deleted` + UI . Style . TEXT_NORMAL )
65+ } )
66+ } ,
67+ } )
68+
4569export const SessionListCommand = cmd ( {
4670 command : "list" ,
4771 describe : "list sessions" ,
You can’t perform that action at this time.
0 commit comments