feat: add pr edit, close, and reopen (task 0011) #11
Reference in New Issue
Block a user
Delete Branch "task-0011-pr-edit-close-reopen"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements
.claude/tasks/0011-pr-edit-close-reopen.md.Summary
Adds the PR-side state mutations, mirroring the issue-side slice with the two PR-specific differences:
pr edit <n>— applies--title,--body/--body-file,--base,--milestone(name-resolved), and the recomputed assignee list in a single PATCH;--add-label/--remove-labeluse Gitea's dedicated additive/removal endpoints (unapplied-label 404 is silent success);--add-reviewer/--remove-reviewergo through the dedicated requested-reviewers POST/DELETE endpoints with{ reviewers: [...] }(ADR 0007 amendment —EditPullRequestOptionhas no reviewers field). Outputedited: { number, status: "ok" }.pr close <n> [--comment]— PATCHesstate: "closed", then posts the comment as a second call whose failure is surfaced, not swallowed. An already-closed or merged PR is analready: trueno-op reporting the actual state (mergedfor a merged PR).pr reopen <n>—already: trueno-op when already open, elsereopened: { number, status: "ok" }.Extracts the fetch-then-patch assignee merge into a shared
src/assignees.ts(mergeAssignees+assigneeLogins), now used by bothissue editandpr edit.Three fixture-server test files cover edit (labels, assignees, reviewer add/remove, no-change guard), the merged-PR close no-op and close-comment partial failure, and the reopen paths. Full suite: 277 tests pass.
Deviations
pr reopenintentionally has no merged-guard (per spec): reopening a merged PR falls through to the PATCH and surfaces Gitea's rejection.Review
Risk
Overall: Medium
prsubcommands plus a sharedmergeAssigneesrefactored out ofissue.ts, touching issue-edit callers too.Unaddressed findings
Standards (both judgement calls):
{state}→ render) is still duplicated betweenissue.tsandpr.ts. Left unextracted because the two sides diverge in no-op shape, help suggestions, and the PR-only merged handling, which would make a shared helper leaky.message: "Already closed"while the PR side reportsalready: true+state. Spec-driven (the spec fixesalready: truefor PRs), so not aligned here; the CLI's no-op output is not uniform across the two entities.Spec: no violations.