2.2 KiB
2.2 KiB
name, description
| name | description |
|---|---|
| gitea-api-pr-operations | Open, list, merge, and diagnose issues/PRs on the Dankclaw Gitea API (192.168.0.143:3000, dank/command-center) with curl + token — merge payload quirk included |
Gitea API PR operations on Dankclaw
Verified 2026-10-18 on Gitea at http://192.168.0.143:3000, repo dank/command-center (owner dank).
Token handling (never echo)
tok=$(sed -nE 's#^http://[^:/@]+:([^@]+)@192\.168\.0\.143.*#\1#p' ~/.config/secrets/gitea | head -1)
cfg=$(mktemp) && chmod 600 "$cfg" && printf 'header = "Authorization: token %s"\n' "$tok" > "$cfg"
# use: curl -sS -K "$cfg" ... then rm -f "$cfg"
Endpoints that work
- Open PR:
POST /api/v1/repos/dank/command-center/pullswith JSON{title, head, base, body}(build withjq -n --arg;head= branch name as-is, slashes included). - Patch PR (title/body):
PATCH .../pulls/<N>— works, returns 201 with full PR JSON (mergeablefield handy). - Merge PR:
POST .../pulls/<N>/mergewith body{"Do":"merge"}— capital-DDois this Gitea's field (mirrors web UI form).{}or{"DoNotMerge":false,...}→ 422[Do]: Required. Success may return EMPTY body — verify with a separateGET .../pulls/<N>for{state:"closed", merged:true, merge_commit_sha}. - Issues:
POST .../issues{title, body}; patchPATCH .../issues/<N>. - Issue/PR bodies MUST end with the AGENTS.md footer:
---line, thencwd: <wd> · session: <id>. Embed the footer inside the body string (a bare---as a separate shell arg breaksjqarg parsing). xdg-open <url>lands the PR/issue in Frank's Firefox — do it the moment a PR opens.
Gotchas
- POST/PATCH need
-H 'Content-Type: application/json'on the curl command line;-d @filealone with a wrong content type yields 422"model.assignUsers: Bind is required". - Merge-with-empty-response is normal; never conclude failure from blank stdout — GET the PR.
- No
teaCLI anywhere; API + curl is the only path. GITEA_TOKEN env exists in~/.omp/.env(gitignored) as alternative source.
Post-merge propagation
The ~/.omp checkout IS the deployment: git -C ~/.omp fetch && git merge --ff-only origin/main (dirty runtime files don't block ff). Never merge a PR at all without Frank's explicit OK.