feat(cmd): argless :Forge {pr,issue,release} browse opens forge list pages#292
Merged
barrettruth merged 2 commits intomainfrom Apr 17, 2026
Merged
feat(cmd): argless :Forge {pr,issue,release} browse opens forge list pages#292barrettruth merged 2 commits intomainfrom
barrettruth merged 2 commits intomainfrom
Conversation
…pages
Problem: The `browse` verb on `pr`, `issue`, and `release` requires a
subject (number or tag), so invoking `:Forge pr browse` alone errors
out. The only way to reach a forge's repo-level list page today is the
in-editor picker; there is no command-line path even though every
backend can construct that URL via `list_web_url`.
Solution: Relax each of the three `browse` subject specs from
`min = 1` to `min = 0, max = 1` and branch each dispatcher on whether
a subject was provided. Argful invocations continue to route through
`ops.{pr,issue,release}_browse` unchanged; argless invocations call
the new `ops.list_browse(f, kind, opts)` helper, which consumes
`f:list_web_url(kind, scope)` and opens the result via `vim.ui.open`.
When a source has no landing page for the kind, `list_browse` warns
with `"<forge> does not support <kind> landing pages"` rather than
constructing a bogus URL. Strictly additive for existing callers.
Problem: Review feedback flagged that the browse cluster in `ops.lua` was inconsistently annotated — `browse_repo`, `browse_commit`, `browse_branch`, `browse_contextual`, `browse_location`, and `browse_file` had no `@param` / `@return` annotations, and the new `list_browse` was missing `@param f forge.Forge`. Adding annotations also exposed that `browse_file` is called from `cmd.lua` with a possibly-nil `ctx_branch`, so the function's real contract accepts `string?` but its inner `f:browse` call expects `string`. Solution: Add `---@param` / `---@return` annotations to every public browse helper in `ops.lua` and complete the ones on `list_browse`. Refactor `browse_file` to assign `trim(file_loc)` / `trim(branch)` into their own names up front, which narrows the types from `string?` to `string` by the time the inner `f:browse` call runs — preserving the existing nil-tolerant behavior without a cast. No functional change; selene, luals, and busted stay green.
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.
Problem
The
browseverb onpr,issue, andreleaserequires a subject(number or tag), so invoking
:Forge pr browsealone errors out. Theonly way to reach a forge's repo-level list page today is the in-editor
picker; there is no command-line path even though every backend can
construct that URL via
list_web_url.Solution
Relax each of the three
browsesubject specs frommin = 1tomin = 0, max = 1and branch each dispatcher on whether a subject wasprovided. Argful invocations continue to route through
ops.{pr,issue,release}_browseunchanged; argless invocations callthe new
ops.list_browse(f, kind, opts)helper, which consumesf:list_web_url(kind, scope)and opens the result viavim.ui.open.When a source has no landing page for the kind,
list_browsewarnswith
"<forge> does not support <kind> landing pages"rather thanconstructing a bogus URL. Strictly additive for existing callers.
Closes #286.