feat: edit existing PR via compose buffer#52
Merged
barrettruth merged 1 commit intomainfrom Apr 4, 2026
Merged
Conversation
Add the ability to edit an existing PR through the same compose buffer
UX used for creation. Three entry points:
- :Forge pr edit {num} command
- <c-e> picker action in the PR list (swapped with manage, now <c-m>)
- Auto-redirect: :Forge pr create on a branch with an existing PR
opens the edit buffer instead of bailing out
Each backend gains fetch_pr_details_cmd(), update_pr_cmd(), and
parse_pr_details() to fetch current PR data and apply updates.
Draft toggle is handled separately after the edit when the draft
state changes.
Closes #21
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.
Summary
Adds the ability to edit an existing PR through the same compose buffer UX used for creation. Closes #21.
Entry points
:Forge pr edit {num}— direct command to edit a specific PR<c-e>in PR picker — new keybinding opens edit buffer for the selected PR:Forge pr createon a branch with an existing PR now opens the edit buffer instead of bailing out with a warningKeybinding changes
edit=<c-e>(previouslymanage)manage=<c-m>(new binding)Backend methods added (all 3 forges)
fetch_pr_details_cmd(num)gh pr view --json ...glab mr view --output jsontea api /repos/:owner/:repo/pulls/{num}update_pr_cmd(...)gh pr editwith--add-*flagsglab mr updatetea pr edit(title/body only)parse_pr_details(json)Compose buffer for editing
open_pr_edit()opens a compose buffer pre-filled with the PR's current title, body, and all metadataforge://pr/{num}/edit:w, callsupdate_pr_cmd()instead ofcreate_pr_cmd()draft_toggle_cmd()when draft state changesFiles changed
lua/forge/github.lua— +3 methodslua/forge/gitlab.lua— +3 methodslua/forge/codeberg.lua— +3 methodslua/forge/compose.lua—update_pr()+open_pr_edit()lua/forge/init.lua—edit_pr()+ auto-redirect increate_pr()lua/forge/pickers.lua—editaction in PR pickerlua/forge/config.lua— type annotations + keybinding defaultsplugin/forge.lua—:Forge pr editdispatch + tab completionTest plan
:Forge pr edit {num}fetches and opens compose buffer<c-e>in PR picker opens edit buffer:Forge pr createon branch with existing PR auto-redirects to edit