Initial commit

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
timmy
2026-04-21 13:04:09 +08:00
commit faee15bc78
18 changed files with 3278 additions and 0 deletions

47
SKILL.md Normal file
View File

@@ -0,0 +1,47 @@
---
name: gitea-cli
description: 對自架 Gitea 做常見操作:建 repo 並推送、列出 repo、clone、改名、切換公開私有、archive、刪除、設定 description/topics、建 release 並上傳附件、打 tag。當使用者提到 Gitea 相關的 push / clone / list / rename / release / archive / delete / tag 等需求時使用。需先在 config.env 設定 Gitea URL、使用者名稱、access token。
---
# gitea-cli
把自架 Gitea 常見操作封裝成 bash 腳本。Token 絕不落地到 `.git/config`
## 使用前準備(只需做一次)
1. 到自己的 Gitea 產生 access token權限至少 `write:repository`
2. 在本 skill 目錄下:
```bash
cp config.example.env config.env
# 編輯 config.env 填入 GITEA_URL / GITEA_USER / GITEA_TOKEN
```
3. `config.env` 已被 `.gitignore` 排除。
## 常見情境 → 對應腳本
`<skill-path>` 代表本 skill 所在路徑clone 下來的位置或 `~/.claude/skills/gitea-cli` symlink
| 要做什麼 | 指令 |
|---|---|
| 建 repo 並把目前專案推上去 | `bash <skill-path>/scripts/publish.sh [repo] [public\|private] [-m "msg"]` |
| 列出自己所有 repo | `bash <skill-path>/scripts/list.sh [--private\|--public] [--format table\|tsv\|name]` |
| clone 某個 repo 到本地 | `bash <skill-path>/scripts/clone.sh <repo> [target-dir]` |
| 改 repo 名稱 | `bash <skill-path>/scripts/rename.sh <old> <new>` |
| 切換 public/private | `bash <skill-path>/scripts/visibility.sh <repo> <public\|private>` |
| 設定 description / topics | `bash <skill-path>/scripts/meta.sh <repo> [--desc "..."] [--topics "a,b,c"]` |
| archive / unarchive | `bash <skill-path>/scripts/archive.sh <repo> [--unarchive] [-y]` |
| 刪除 repo | `bash <skill-path>/scripts/delete.sh <repo> [-y]` |
| 打 tag 並推上去 | `bash <skill-path>/scripts/tag.sh <tag> [-m "msg"]` |
| 建 release含 asset 上傳) | `bash <skill-path>/scripts/release.sh <tag> [--name ...] [--notes ...] [--asset PATH]... [--repo NAME]` |
## 注意
- `config.env` 絕對不要 commit
- `origin` remote 永遠是乾淨 URLtoken 只在 push/clone 當下透過一次性 credential helper 注入
- 破壞性操作(`archive.sh` / `delete.sh`)預設需要互動確認;自動化場景請帶 `-y` / `--yes` 或設 `GITEA_YES=1`
- 401/403 → 檢查 `config.env` 的 token
## 回覆原則
- 執行前先確認 cwd 就是要操作的目標
- 執行後簡述結果URL / branch / 刪除/建立的項目)