From 1594e3a1ff73bca6fbf34fa4d04618d5e98786d8 Mon Sep 17 00:00:00 2001 From: Markus Graf Date: Fri, 23 Oct 2026 09:25:41 +0200 Subject: [PATCH] Add code-gurix-dev skill: Gitea access via API (code.gurix.dev) and SSH (tailnet :2222) --- integrations/code-gurix-dev/SKILL.md | 101 +++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 integrations/code-gurix-dev/SKILL.md diff --git a/integrations/code-gurix-dev/SKILL.md b/integrations/code-gurix-dev/SKILL.md new file mode 100644 index 0000000..ec583b8 --- /dev/null +++ b/integrations/code-gurix-dev/SKILL.md @@ -0,0 +1,101 @@ +--- +name: code-gurix-dev +description: Zugriff auf die private Gitea-Instanz code.gurix.dev — Repos klonen/pushen via SSH (Tailnet, Port 2222), API via HTTPS für Repos/Issues/PRs. Nutzen, wenn mit Repositories auf code.gurix.dev gearbeitet wird (clone, push, Issues, PRs) oder der Zugang dafür eingerichtet werden soll. +--- + +# Gitea auf code.gurix.dev + +Gitea (v1.27.x), läuft als Docker-Container auf Host **carson**. +Zwei Zugangswege: + +| Weg | URL | Wofür | +|-------|----------------------------------------------|--------------------------------| +| API | `https://code.gurix.dev` | Issues, PRs, Releases, Suche | +| Git | `ssh://git@carson.monster-wezen.ts.net:2222` | Clone / Pull / Push (Tailnet!) | + +**Wichtig:** `code.gurix.dev:2222` funktioniert **nicht** — die öffentliche IP +(89.167.88.65) forwarded keinen SSH-Port. Git immer über den Tailnet-Namen von +carson (`carson.monster-wezen.ts.net`, Tailscale-IP `100.109.222.33`). +Auf carson selbst ist die API zusätzlich unter `http://localhost:3001` erreichbar. + +## Voraussetzungen (einmalig pro Agent/Maschine) + +1. **API-Token** ablegen: + - Pfad: `~/.pi/agent/.credentials/gitea-token` (nur der Token, `chmod 600`) + - Erzeugen in Gitea: Profil → Einstellungen → Anwendungen → *Token generieren* + (Scopes: repository read/write, user read). +2. **SSH-Key** deponieren und in Gitea hinterlegen: + - Key z. B. unter `~/.ssh/id_ed25519` bzw. dedizierter Key `~/.ssh/gitea_ed25519` + - Public Key in Gitea: Profil → Einstellungen → SSH-Schlüssel +3. **SSH-Host-Alias** in `~/.ssh/config` — damit funktionieren die + `ssh://git@code.gurix.dev:2222/...`-URLs aus der API unverändert: + + ``` + Host code.gurix.dev + HostName carson.monster-wezen.ts.net + Port 2222 + User git + IdentityFile ~/.ssh/gitea_ed25519 + IdentitiesOnly yes + ``` +4. Host-Key einmalig aufnehmen: + ```bash + ssh-keyscan -p 2222 -t ed25519 carson.monster-wezen.ts.net >> ~/.ssh/known_hosts + ``` + +## Verbindung testen + +```bash +TOKEN_FILE=~/.pi/agent/.credentials/gitea-token + +# 1) API (erwartet: Username als JSON, HTTP 200) +curl -s -H "Authorization: token $(cat $TOKEN_FILE)" https://code.gurix.dev/api/v1/user + +# 2) SSH (erwartet: "Hi there, ! ... Gitea does not provide shell access.") +ssh -p 2222 git@carson.monster-wezen.ts.net + +# 3) Git (erwartet: HEAD-Commit-Hash) +git ls-remote ssh://git@carson.monster-wezen.ts.net:2222//.git HEAD +``` + +## Git-URLs + +```bash +# SSH (empfohlen, nur im Tailnet — Via Host-Alias geht auch: git@code.gurix.dev:...) +git clone ssh://git@carson.monster-wezen.ts.net:2222//.git + +# HTTPS mit Token (Fallback; Token nie in Shellhistory/Logs/Remotes committen) +git clone https://:$(cat $TOKEN_FILE)@code.gurix.dev//.git +``` + +Hinweis: Die `ssh_url` aus der API nennt `code.gurix.dev:2222` — mit dem +Host-Alias aus Schritt 3 passt sie so, sonst Host durch +`carson.monster-wezen.ts.net` ersetzen. + +## API-Beispiele + +```bash +API=https://code.gurix.dev/api/v1 +AUTH="Authorization: token $(cat ~/.pi/agent/.credentials/gitea-token)" + +# Eigene Repos listen (Namen) +curl -s -H "$AUTH" "$API/user/repos?limit=50" | python3 -c \ + "import json,sys; [print(r['full_name']) for r in json.load(sys.stdin)]" + +# Repo anlegen +curl -s -X POST -H "$AUTH" -H 'Content-Type: application/json' \ + -d '{"name":"neues-repo","private":true,"auto_init":true}' \ + "$API/user/repos" + +# Issues / Pull Requests +curl -s -H "$AUTH" "$API/repos///issues?state=open" +curl -s -H "$AUTH" "$API/repos///pulls?state=open" +``` + +## Regeln + +- Token **niemals** in Chat-Ausgaben, Logs, URLs oder Commits ausgeben — + immer via `$(cat ...)`. +- Außerhalb des Tailnet: erst Tailscale/WireGuard verbinden (oder SSH-Jump über + carson), sonst schlägt Port 2222 fehl. +- API funktioniert von überall (HTTPS); Git/Push nur im Tailnet.