Add startup filters for current repo and branch#252
Merged
Conversation
Add CLI flags that seed the initial session list so developers can jump straight to the sessions for the repo or branch they are working in: - --current reads the git repo and branch from the working directory - --cwd <path> filters to sessions under a folder and is the base dir for --current - --repo <name> and --branch <name> filter to a repository or branch - --query <text> pre-fills the search box with free text Filters route through the existing search-token grammar (repo:, branch:, folder:) so they appear in the search header and drive the first query. Non-git directories and missing --cwd paths print a clear error and do not start the TUI. Explicit --repo/--branch win over detected values. Closes #177 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
5 tasks
The deadcode CI check flagged startupOptions.active as unreachable: it was only referenced from tests, never from production code, since SeedQuery already handles the empty-filter case. Drop the method and its test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
# Conflicts: # cmd/dispatch/cli.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds startup filter flags so
dispatchcan open straight into the sessions for a repo, branch, or folder instead of the global list.--currentreads the git repository and branch from the working directory (or from--cwd <path>when given).--cwd <path>filters to sessions under a folder and doubles as the base directory for--current.--repo <name>filters to a repository inowner/repoform.--branch <name>filters to a branch.--query <text>pre-fills the search box with free text.Flags can be combined, for example
dispatch --repo owner/repo --branch main --query auth.Why
Closes #177. Dispatch is most useful when opened from inside a project, but it starts at the global session list. Binding
dispatch --currentto a shell alias jumps to the sessions for the repo you are already in and cuts repeated filtering.How
The filters route through the existing search-token grammar (
repo:,branch:,folder:plus free text).handleArgsparses the flags into astartupOptionsvalue whoseSeedQuery()renders the token string that seeds the model, so the active filters show up in the search header and drive the first query. Values with spaces are quoted so the tokenizer keeps them intact.Repository detection reuses the same
owner/reponormalization used for reference URLs, so a detected remote matches the form stored on sessions. Explicit--repoand--branchflags take precedence over detected values. Git detection sits behind a seam for testing.A non-git directory or a missing
--cwdpath prints a clear error and does not start the TUI.Testing
go build ./...go test ./...(all packages pass)go vet ./...golangci-lint run--cwdvalidation,--currentdetection and precedence, and the non-git and missing-value error paths.Docs
README gains a "Startup filters" section and the new flags are listed in the CLI flags table, the usage banner, and all four shell completion scripts.