Repository navigation
feat(cli): manage session archive state - #66503
oliver-mee wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Works as described, and I don't see anything blocking. On the base branch, session archive and session list --archived are rejected. With this PR, against a real local server, archive and unarchive round-trip, list --archived / --no-archived filter correctly, and with no flag the list is mixed as it is today. An unknown session ID prints Session not found and exits with 1. The added tests pass. The package's typecheck script couldn't run here (bun check isn't available), but tsc -b in packages/cli reports no errors.
Public API: CLI additions only, all backwards compatible: new opencode session archive <sessionID>, new opencode session unarchive <sessionID>, and new optional --archived / --no-archived flags on opencode session list (with neither flag the output is unchanged). The SDK, HTTP API and config are unchanged.
One thing for the maintainers on #63518: the default for the list filter is still their call. Keeping the mixed list is the backwards-compatible choice. Separately, archiving bumps the session to the top of the plain session list (#63951). That comes from the server and isn't caused by this PR.
Related: #63951
Issue for this PR
Closes #63518
Type of change
What does this PR do?
Session cleanup scripts currently need a raw API request to archive an existing session. This adds
session archive <id>andsession unarchive <id>using the existing session update endpoint.session list --archivedshows archived sessions,--no-archivedshows unarchived sessions, and omitting the flag keeps the mixed list.Design approval is pending on #63518. In particular, feedback on the list flag and its default is welcome.
How did you verify your code works?
Ran the focused CLI tests for archive, unarchive, list filtering, and session targeting. Also verified the round trip and list modes against a local server with disposable sessions.
Screenshots / recordings
CLI only.
Checklist
Developed with AI agents, with a human in the loop. Model: GPT-6.
Added by the opencode bot (AI-generated).
Related: #63951
Public API: adds
session archive/session unarchivesubcommands and--archived/--no-archivedonsession list(backwards compatible)