diff --git a/.cursor/skills/gitea-prs/SKILL.md b/.cursor/skills/gitea-prs/SKILL.md
index cf2e2c5..c70cff1 100644
--- a/.cursor/skills/gitea-prs/SKILL.md
+++ b/.cursor/skills/gitea-prs/SKILL.md
@@ -3,8 +3,9 @@ name: gitea-prs
description: >-
Create, merge, and clean up pull requests on this repo's Gitea host using tea
and SSH. Use when the user asks to open a PR, create a pull request, merge a
- PR, push a feature branch, or delete a feature branch after merge. Do not use
- gh (GitHub CLI) for this repository.
+ PR, push a feature branch, or delete a feature branch after merge. Draft PRs
+ use a WIP: title and must be undrafted before merge (tea merge fails otherwise).
+ Do not use gh (GitHub CLI) for this repository.
---
# Gitea pull requests (product-slip)
@@ -58,13 +59,56 @@ For a draft PR, either:
- Create with `--title "WIP:
"`, or
- `POST /api/v1/repos/rhino/product-slip/pulls` with `"draft": true` **and** a `WIP:` title (token from `tea` login in `~/.config/tea/config.yml`).
+Before merge, strip `WIP:` (see **Merge PR**) — drafts are not mergeable.
+
## Merge PR
+**Draft / `WIP:` PRs cannot be merged.** `tea pulls merge` fails with `Failed to merge PR. Is it still open?` while the title still starts with `WIP:` (even though the PR is open). Always undraft first.
+
+1. If the title starts with `WIP:`, remove that prefix via API (token from `tea` login in `~/.config/tea/config.yml`):
+
+```bash
+export PR_INDEX=23 # the PR number
+python3 <<'PY'
+import json, os, urllib.request, yaml
+from pathlib import Path
+pr = os.environ["PR_INDEX"]
+cfg = yaml.safe_load(Path.home().joinpath(".config/tea/config.yml").read_text())
+login = next(l for l in cfg["logins"] if l.get("default"))
+token, base = login["token"], login["url"].rstrip("/")
+req = urllib.request.Request(
+ f"{base}/api/v1/repos/rhino/product-slip/pulls/{pr}",
+ headers={"Authorization": f"token {token}", "Accept": "application/json"},
+)
+with urllib.request.urlopen(req) as resp:
+ data = json.load(resp)
+title = data["title"]
+if title.startswith("WIP:"):
+ title = title[4:].lstrip()
+payload = json.dumps({"title": title, "draft": False}).encode()
+req = urllib.request.Request(
+ f"{base}/api/v1/repos/rhino/product-slip/pulls/{pr}",
+ data=payload,
+ headers={
+ "Authorization": f"token {token}",
+ "Content-Type": "application/json",
+ "Accept": "application/json",
+ },
+ method="PATCH",
+)
+with urllib.request.urlopen(req) as resp:
+ data = json.load(resp)
+print(f"draft={data.get('draft')} mergeable={data.get('mergeable')} title={data['title']!r}")
+PY
+```
+
+2. Merge:
+
```bash
tea pulls merge --style merge
```
-Then update local main:
+3. Update local main:
```bash
git fetch --prune origin
@@ -72,6 +116,8 @@ git checkout main
git pull --ff-only origin main
```
+Then delete the feature branch (next section).
+
## Delete feature branch after merge
Do this automatically after every merge unless the user says to keep the branch.