Files
gitea-cli/SKILL.md
timmy f28f20ba56 feat(config): support multiple Gitea profiles via GITEA_PROFILE env var
未設時讀 config.env(行為不變);設了讀 config.<profile>.env。
.gitignore 新增 config.*.env 但保留 config.example.env。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 16:18:16 +08:00

61 lines
2.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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` 排除。
### 多組 Gitea 站/帳號
需要切換不同 Gitea 站或帳號時,另外存成 `config.<profile>.env`,呼叫腳本時帶 `GITEA_PROFILE`
```bash
cp config.example.env config.work.env
# 編輯 config.work.env
GITEA_PROFILE=work bash <skill-path>/scripts/list.sh
```
`GITEA_PROFILE` 未設時讀 `config.env`(預設)。`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 / 刪除/建立的項目)