Repository navigation
feat(cli): add --all to session list - #60895
ColonelToad wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
The flag works as described. I ran a local server with sessions in four directories across three projects (two share the global project). On the base, session list --all is rejected as an unrecognized flag. With this PR, the default listing still shows only the current project, --all lists every project newest first, and -n and --format json work with it. The new test passes, and tsc -b in packages/cli is clean.
Public API: adds the --all boolean flag (default false) to opencode session list, and the help text changes. It is backwards compatible: existing invocations behave the same.
One thing worth fixing: with --all, the default table output (formatList) still prints only id, title and updated time. When sessions from several projects are listed together, you can't tell which project each one belongs to unless you switch to --format json. The visual in the description shows a project column, but table rendering isn't changed in this PR. Adding the session's directory (or project) as a column when --all is set would make the table output usable.
This also edits the same handler and command spec as #59784 (--search), so expect a merge conflict whichever lands second.
75ea0fd to
983026c
Compare
|
Added the session directory as a fourth column in the table output when --all is set, with a test; the default table is unchanged. Amended the commit and updated the description. |
There was a problem hiding this comment.
My earlier point is addressed: with --all, the table now shows each session's directory as a fourth column, and the table without --all is unchanged. I checked this against a local server with sessions in several projects: without --all the output matches the base, and --all (with or without -n) shows the directory on every row. The tests pass and tsc -b in packages/cli is clean.
Public API: adds the --all flag to opencode session list; table output gains a directory column only when --all is set. This is backwards compatible.
No new concerns.
|
Hi! What do you think about that? |
Issue for this PR
Closes #59004
Type of change
What does this PR do?
Adds
--alltoopencode session list.Today the command always resolves the current directory's project and filters the list to it, so sessions from other projects can only be found by changing directory first. With
--allthe command skips the location lookup and omits theprojectfilter, whichsession.listalready treats as optional. The default is unchanged: top-level sessions in the current project, newest first.--max-countand--format jsoncompose with the flag. JSON rows already includeprojectIdanddirectory, so results from different projects stay distinguishable. In the default table output,--alladds the session's directory as a fourth column, because id, title and updated time alone do not say which project a row belongs to. The table without--allis unchanged.I also clarified the command description now that the scope can change.
How did you verify your code works?
packages/cli/test/session-list.test.ts: the default listing scopes to the current project;--alldoes not resolve the location and sends noprojectkey (asserting absence, becauseSessionStore.listfilters whenever the key is present);--max-countbecomeslimit; the table keeps its three columns by default and gains the directory with--all.--alltest fails ifprojectis passed asundefinedinstead of omitted.--alllisted both with the directory as a fourth column, and--all --format jsonkept the same fields as before.bun run checkpasses (35/35 tasks).Visual
Checklist
Added by the opencode bot (AI-generated).
Related: #38451, #57635
Public API: adds the --all flag to
opencode session list(backwards compatible)