Files
command-center/agent/managed-skills/gitea-api-pr-operations/SKILL.md
T

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/pulls with JSON {title, head, base, body} (build with jq -n --arg; head = branch name as-is, slashes included).
  • Patch PR (title/body): PATCH .../pulls/<N> — works, returns 201 with full PR JSON (mergeable field handy).
  • Merge PR: POST .../pulls/<N>/merge with body {"Do":"merge"} — capital-D Do is this Gitea's field (mirrors web UI form). {} or {"DoNotMerge":false,...} → 422 [Do]: Required. Success may return EMPTY body — verify with a separate GET .../pulls/<N> for {state:"closed", merged:true, merge_commit_sha}.
  • Issues: POST .../issues {title, body}; patch PATCH .../issues/<N>.
  • Issue/PR bodies MUST end with the AGENTS.md footer: --- line, then cwd: <wd> · session: <id>. Embed the footer inside the body string (a bare --- as a separate shell arg breaks jq arg 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 @file alone 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 tea CLI 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.