You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dispatch open --last resumes the single most recently active session across everything, and dispatch open <id> resumes an exact session. Neither helps the common case: "resume the last session I had in this repo" or "in this branch". Today you have to run dispatch search --repo owner/repo --ids, read the first line, and pass it back to dispatch open. That is two commands and a copy/paste for something people do many times a day, and it is awkward to bind to a shell alias.
flowchart TD
A[dispatch open --current] --> B[Detect git repo and branch from cwd]
A2[dispatch open --repo/--branch/--folder] --> C[Build FilterOptions]
B --> C
C --> D[List sessions, updated desc, limit 1]
D --> E{Match found?}
E -->|yes| F[Resume with existing launch path]
E -->|no| G[Clear error, exit non-zero]
Loading
Proposed solution
Teach dispatch open to resume the most recently active session that matches a filter, reusing the same filter fields as dispatch search and the same git detection as the --current startup filter:
dispatch open --current resumes the newest session for the current git repo and branch (read from the working dir, or --cwd <path>).
dispatch open --repo owner/repo, --branch <name>, and --folder <path> resume the newest session matching those filters, and can be combined.
All of these keep working with --mode and --print, so dispatch open --current --print writes the resume command without launching.
When no session matches, print a clear message and exit non-zero (do not fall through to launching something unrelated).
This complements --last rather than replacing it. --last stays the "newest anywhere" shortcut; the new filters scope it.
Acceptance criteria
dispatch open --repo owner/repo resumes the most recently active session for that repo.
dispatch open --branch <name> and --folder <path> scope the same way and can be combined with --repo.
dispatch open --current resumes the newest session for the git repo and branch detected from the working dir, honoring --cwd.
--mode and --print work with the scoped forms.
A non-git dir with --current, or no matching session, prints a helpful error and exits non-zero.
--last still behaves as before and cannot be combined with the scoped filters (clear error if it is).
Help text and completion list the new flags; unit tests cover match, no-match, and flag-conflict cases.
Notes
The git repo/branch detection already exists for the --current startup filter in startup.go. Session selection can reuse the ListSessions path with SortByUpdated/Descending and limit 1, the same ordering defaultOpenGetLastSession uses.
Problem
dispatch open --lastresumes the single most recently active session across everything, anddispatch open <id>resumes an exact session. Neither helps the common case: "resume the last session I had in this repo" or "in this branch". Today you have to rundispatch search --repo owner/repo --ids, read the first line, and pass it back todispatch open. That is two commands and a copy/paste for something people do many times a day, and it is awkward to bind to a shell alias.flowchart TD A[dispatch open --current] --> B[Detect git repo and branch from cwd] A2[dispatch open --repo/--branch/--folder] --> C[Build FilterOptions] B --> C C --> D[List sessions, updated desc, limit 1] D --> E{Match found?} E -->|yes| F[Resume with existing launch path] E -->|no| G[Clear error, exit non-zero]Proposed solution
Teach
dispatch opento resume the most recently active session that matches a filter, reusing the same filter fields asdispatch searchand the same git detection as the--currentstartup filter:dispatch open --currentresumes the newest session for the current git repo and branch (read from the working dir, or--cwd <path>).dispatch open --repo owner/repo,--branch <name>, and--folder <path>resume the newest session matching those filters, and can be combined.--modeand--print, sodispatch open --current --printwrites the resume command without launching.This complements
--lastrather than replacing it.--laststays the "newest anywhere" shortcut; the new filters scope it.Acceptance criteria
dispatch open --repo owner/reporesumes the most recently active session for that repo.dispatch open --branch <name>and--folder <path>scope the same way and can be combined with--repo.dispatch open --currentresumes the newest session for the git repo and branch detected from the working dir, honoring--cwd.--modeand--printwork with the scoped forms.--current, or no matching session, prints a helpful error and exits non-zero.--laststill behaves as before and cannot be combined with the scoped filters (clear error if it is).Notes
The git repo/branch detection already exists for the
--currentstartup filter instartup.go. Session selection can reuse theListSessionspath withSortByUpdated/Descendingandlimit 1, the same orderingdefaultOpenGetLastSessionuses.