Files
GitManager/components/pr-list/pr-list.md
T
TBNilles ad00654487 Slice 10: create_pr (open a pull request)
forge CreatePullRequest (Gitea; empty base resolves to the repo default branch). Service CreatePR records a pr-created event. HTTP POST /api/repo/pr/create; MCP tool create_pr; <pr-list> New pull request button (head = selected repo current branch, base = default). Live-tested end-to-end: app create_pr opened a real PR (base auto-resolved), listed, then cleaned up; main untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-20 17:34:13 -04:00

31 lines
1.5 KiB
Markdown

# pr-list
## Intent
Shows the open pull requests for the selected repository and provides the
**"Merge & clean up"** action (AGENT.md §8.4) — the feature that makes PRs usable
for someone who otherwise finds them clutter: squash-merge and delete the branch
in one click. The merge is DESTRUCTIVE (§1.4), so the button confirms first,
naming the PR, base, and branch to be deleted.
## Public surface
- **Tag:** `<pr-list>`
- **Attributes/properties:** none. Hides itself (`hidden`) when no forge is
configured or the repo isn't on the forge host.
- **Listens:** `repo:select` on `document` — loads PRs for `event.detail.path`.
- **Fetches:** `GET /api/repo/prs?path=…` (`{supported:false}` → hidden).
- **Writes:** `POST /api/repo/pr/merge {path, number}` after a `confirm()`;
`POST /api/repo/pr/create {path, head, base, title}` via the "New pull request…"
button (head = the selected repo's current branch, base = the repo default).
## History
- 2026-09-20: created — slice 5 (forge); list open PRs + "Merge & clean up".
- 2026-09-20: added "New pull request…" (create_pr) — opens a PR from the
selected repo's current branch into the default branch (slice 10).
## Notes / gotchas
- Requires `GITEA_URL` + `GITEA_TOKEN` on the server; otherwise the component
stays hidden (graceful degradation).
- Fork PRs are labelled; their branch lives in the fork, so cleanup only deletes
branches in the same repo (the server enforces this too).
- All server-derived text is escaped; the PR link opens in a new tab.