cmd/completion: make implicit PR action completion availability-aware #455

Closed
opened 2026-04-27 02:25:45 +00:00 by barrettruth · 2 comments
barrettruth commented 2026-04-27 02:25:45 +00:00

Problem

The Ex completion model already reuses picker-aligned availability rules for subject policies, but implicit current-PR verb completion is still essentially static.

That becomes more noticeable as the implicit PR action surface grows.

For example, if :Forge pr merge, close, draft, ready, and reopen can resolve from branch context, then bare :Forge pr <Tab> should not suggest verbs that are unavailable for the current PR state.

Similarly, method= completion for :Forge pr merge is currently static even though merge availability already depends on repo permissions and backend-supported merge methods.

Proposed solution

Make implicit PR action completion availability-aware.

That should include at least:

  • filtering verb completion for implicit PR actions based on the resolved current branch PR state
  • reusing the same availability/state logic already used by picker actions where possible
  • filtering method= values for :Forge pr merge through repo-supported merge methods when repo info is available
  • keeping failure/ambiguity behavior predictable when there is no unique current branch PR to inspect

Examples of the desired behavior:

  • open, non-draft PR: offer approve, merge, close, draft; do not offer ready or reopen
  • open, draft PR: offer approve, close, ready; do not offer merge, draft, or reopen
  • closed PR (if implicit reopen exists): offer reopen
  • merged PR: do not offer reopen

Acceptance criteria

  • bare :Forge pr ... verb completion is filtered by the current branch PR state when implicit PR targeting is in play
  • completion stays aligned with the picker availability helpers rather than inventing a separate state model
  • method= completion for :Forge pr merge prefers repo-supported merge methods over a static union when repo info can be resolved
  • ambiguity/no-match cases degrade predictably instead of advertising obviously wrong actions
  • follow-up to the earlier completion policy work in #314
  • should align with implicit open-PR mutators and any future implicit pr reopen
## Problem The Ex completion model already reuses picker-aligned availability rules for subject policies, but implicit current-PR verb completion is still essentially static. That becomes more noticeable as the implicit PR action surface grows. For example, if `:Forge pr merge`, `close`, `draft`, `ready`, and `reopen` can resolve from branch context, then bare `:Forge pr <Tab>` should not suggest verbs that are unavailable for the current PR state. Similarly, `method=` completion for `:Forge pr merge` is currently static even though merge availability already depends on repo permissions and backend-supported merge methods. ## Proposed solution Make implicit PR action completion availability-aware. That should include at least: - filtering verb completion for implicit PR actions based on the resolved current branch PR state - reusing the same availability/state logic already used by picker actions where possible - filtering `method=` values for `:Forge pr merge` through repo-supported merge methods when repo info is available - keeping failure/ambiguity behavior predictable when there is no unique current branch PR to inspect Examples of the desired behavior: - open, non-draft PR: offer `approve`, `merge`, `close`, `draft`; do not offer `ready` or `reopen` - open, draft PR: offer `approve`, `close`, `ready`; do not offer `merge`, `draft`, or `reopen` - closed PR (if implicit reopen exists): offer `reopen` - merged PR: do not offer `reopen` ## Acceptance criteria - bare `:Forge pr ...` verb completion is filtered by the current branch PR state when implicit PR targeting is in play - completion stays aligned with the picker availability helpers rather than inventing a separate state model - `method=` completion for `:Forge pr merge` prefers repo-supported merge methods over a static union when repo info can be resolved - ambiguity/no-match cases degrade predictably instead of advertising obviously wrong actions ## Related - follow-up to the earlier completion policy work in #314 - should align with implicit open-PR mutators and any future implicit `pr reopen`
barrettruth commented 2026-04-27 17:21:23 +00:00

Tracking note: this stays after #453, #450, and #454. Once the resolver and implicit non-open PR flows land, this can tighten completion so it reflects which implicit PR actions are actually available for the current branch state.

Tracking note: this stays after #453, #450, and #454. Once the resolver and implicit non-open PR flows land, this can tighten completion so it reflects which implicit PR actions are actually available for the current branch state.
barrettruth commented 2026-04-27 18:43:54 +00:00

Fixed by merged PR #461.

Fixed by merged PR #461.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
barrettruth/forge.nvim#455
No description provided.