Add Gitea repository management skill
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
80
skills/gitea/SKILL.md
Normal file
80
skills/gitea/SKILL.md
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
---
|
||||||
|
name: gitea
|
||||||
|
description: Gitea repository management via REST API. Use when user explicitly mentions "gitea" for: (1) Creating repositories, (2) Listing repositories, (3) Deleting repositories, (4) Pushing code to Gitea. Default server: https://gitea.server10086.icu, default account: admin. Requires GITEA_TOKEN environment variable.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Gitea Repository Management
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
- **Server**: `https://gitea.server10086.icu`
|
||||||
|
- **API Base**: `https://gitea.server10086.icu/api/v1`
|
||||||
|
- **Default Account**: `admin`
|
||||||
|
- **Auth Header**: `Authorization: token $GITEA_TOKEN`
|
||||||
|
|
||||||
|
**Always verify GITEA_TOKEN exists before any operation:**
|
||||||
|
```bash
|
||||||
|
if [ -z "$GITEA_TOKEN" ]; then
|
||||||
|
echo "Error: GITEA_TOKEN environment variable not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
## Repository Operations
|
||||||
|
|
||||||
|
### List Repositories
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List all repos for current user
|
||||||
|
curl -s -X GET "https://gitea.server10086.icu/api/v1/user/repos" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create Repository
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X POST "https://gitea.server10086.icu/api/v1/admin/repos" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"name": "repo-name",
|
||||||
|
"description": "Repository description",
|
||||||
|
"private": false,
|
||||||
|
"auto_init": false
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Delete Repository
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -X DELETE "https://gitea.server10086.icu/api/v1/repos/admin/repo-name" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Create and Push Current Directory
|
||||||
|
|
||||||
|
```bash
|
||||||
|
REPO_NAME=$(basename $(pwd))
|
||||||
|
|
||||||
|
# Create repo via API
|
||||||
|
curl -X POST "https://gitea.server10086.icu/api/v1/admin/repos" \
|
||||||
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"name\":\"$REPO_NAME\",\"auto_init\":false}"
|
||||||
|
|
||||||
|
# Initialize and push
|
||||||
|
git init
|
||||||
|
git add .
|
||||||
|
git commit -m "Initial commit"
|
||||||
|
git remote add origin "https://gitea.server10086.icu/admin/$REPO_NAME.git"
|
||||||
|
git push -u origin main
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Handling
|
||||||
|
|
||||||
|
| Status | Meaning |
|
||||||
|
|--------|---------|
|
||||||
|
| 401 | Invalid or missing GITEA_TOKEN |
|
||||||
|
| 409 | Repository already exists |
|
||||||
|
| 404 | Repository not found |
|
||||||
|
| 204 | Successful deletion (expected) |
|
||||||
Reference in New Issue
Block a user