70 lines
2.4 KiB
Markdown
70 lines
2.4 KiB
Markdown
# Gitea API – lokales CLI
|
||
|
||
Dient dazu, **Issues** auf deiner Gitea-Instanz zu lesen und anzulegen – mit den in **`.env`** gesetzten Variablen (nicht committen).
|
||
|
||
## Umgebungsvariablen (Root `.env`)
|
||
|
||
| Variable | Beispiel |
|
||
|----------|----------|
|
||
| `GITEA_BASE_URL` | `http://192.168.2.144:3000` |
|
||
| `GITEA_TOKEN` | Personal Access Token (nur Scope **repo** + **issue** nötig) |
|
||
| `GITEA_OWNER` | `Lars` |
|
||
| `GITEA_REPO` | `mitai-jinkendo` |
|
||
|
||
## Voraussetzung
|
||
|
||
Python 3.10+ (nur Standardbibliothek).
|
||
|
||
## Aufruf (im Repo-Root)
|
||
|
||
```powershell
|
||
# Issues auflisten (offen)
|
||
python scripts/gitea/gitea_api.py issues list
|
||
|
||
# Issues mit State
|
||
python scripts/gitea/gitea_api.py issues list --state all
|
||
|
||
# Ein Issue lesen
|
||
python scripts/gitea/gitea_api.py issues get 42
|
||
|
||
# Issue anlegen (Titel + Body aus Datei oder direkt)
|
||
python scripts/gitea/gitea_api.py issues create --title "Fix: …" --body "…"
|
||
|
||
python scripts/gitea/gitea_api.py issues create --title "Fix: …" --body-file path/to/body.md
|
||
|
||
# Kommentar
|
||
python scripts/gitea/gitea_api.py issues comment 42 --body "…"
|
||
python scripts/gitea/gitea_api.py issues comment 42 --body-file path/to/comment.md
|
||
|
||
# Schließen / wieder öffnen
|
||
python scripts/gitea/gitea_api.py issues close 42
|
||
python scripts/gitea/gitea_api.py issues reopen 42
|
||
|
||
# Alle Issues (alle Seiten, Vorsicht bei großen Repos)
|
||
python scripts/gitea/gitea_api.py issues list --all-pages --state open
|
||
|
||
# Markdown-Datei (z. B. Audit-Template) als Issue-Body
|
||
python scripts/gitea/gitea_api.py issues create --title "…" --body-file .claude/docs/audit/.../gitea/TEMPLATE_P0-....md
|
||
```
|
||
|
||
## Repository-Inhalt (read-only)
|
||
|
||
```powershell
|
||
# Datei über Gitea-API (bei Dateien: Text-Inhalt; bei Verzeichnissen: JSON-Listing)
|
||
python scripts/gitea/gitea_api.py repo file README.md
|
||
|
||
python scripts/gitea/gitea_api.py repo file backend/main.py --ref develop
|
||
|
||
# Clone/Push: normales `git remote` – Token nicht dauerhaft in der Remote-URL; SSH oder Credential Helper.
|
||
```
|
||
|
||
## Sicherheit
|
||
|
||
- **Niemals** `GITEA_TOKEN` ins Git oder in Issues/Pastebins.
|
||
- Token, das in Chat oder Logs gelandet ist, in Gitea **widerrufen** und **neu erzeugen**.
|
||
- Cursor-Agenten können das CLI über das Terminal nutzen, wenn `.env` gesetzt und Netzwerk zu `GITEA_BASE_URL` erreichbar ist.
|
||
|
||
## MCP (Tools direkt im Agent)
|
||
|
||
Siehe [`MCP_SETUP.md`](./MCP_SETUP.md) und [`../.cursor/mcp.json.example`](../../.cursor/mcp.json.example).
|