gitea-cli-skill 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/REFERENCE.md +273 -0
- package/assets/SKILL.md +47 -365
- package/package.json +1 -1
- package/src/index.js +8 -1
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# gitea-cli Reference
|
|
2
|
+
|
|
3
|
+
Full command reference and workflow details. This file is loaded on demand — the core rules and binary location are in SKILL.md.
|
|
4
|
+
|
|
5
|
+
## Workflow: Issue 处理
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. 查看 open issues
|
|
9
|
+
gitea-cli issue list --state open --output json
|
|
10
|
+
|
|
11
|
+
# 2. 查看 issue 详情
|
|
12
|
+
gitea-cli issue get <number> --output json
|
|
13
|
+
|
|
14
|
+
# 3. 查找 label/milestone ID
|
|
15
|
+
gitea-cli label list --output json
|
|
16
|
+
gitea-cli milestone list --output json
|
|
17
|
+
|
|
18
|
+
# 4. 更新 issue
|
|
19
|
+
gitea-cli issue update <number> --label <id> --milestone <id>
|
|
20
|
+
|
|
21
|
+
# 5. 添加评论
|
|
22
|
+
gitea-cli issue comment create <number> -b "分析原因:..."
|
|
23
|
+
|
|
24
|
+
# 6. 上传附件(图片自动嵌入为 markdown)
|
|
25
|
+
gitea-cli issue attachment upload <number> ./screenshot.png
|
|
26
|
+
|
|
27
|
+
# 7. 关闭 issue
|
|
28
|
+
gitea-cli issue close <number>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Workflow: PR 工作流
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 1. 创建 feature 分支
|
|
35
|
+
gitea-cli branch create feature/xyz --from main
|
|
36
|
+
|
|
37
|
+
# 2. 创建 PR
|
|
38
|
+
gitea-cli pr create --title "feat: xxx" --head feature/xyz --base main --body "## Summary\n- Changes"
|
|
39
|
+
|
|
40
|
+
# 3. 查看 PR 状态
|
|
41
|
+
gitea-cli pr get <index> --output json
|
|
42
|
+
|
|
43
|
+
# 4. 检查 CI
|
|
44
|
+
gitea-cli actions run list --output json
|
|
45
|
+
gitea-cli actions run jobs <run-id> --output json
|
|
46
|
+
|
|
47
|
+
# 5. 合并 PR
|
|
48
|
+
gitea-cli pr merge <index> --strategy squash --delete-branch
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Workflow: Release 发布
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 1. 查看最近提交
|
|
55
|
+
gitea-cli commit list --branch main --limit 20 --output json
|
|
56
|
+
|
|
57
|
+
# 2. 查看 tags/releases
|
|
58
|
+
gitea-cli tag list --output json
|
|
59
|
+
gitea-cli release list --output json
|
|
60
|
+
|
|
61
|
+
# 3. 创建 tag + release
|
|
62
|
+
gitea-cli tag create v1.0.0 --target main -m "Release v1.0.0"
|
|
63
|
+
gitea-cli release create --tag v1.0.0 --name "v1.0.0" --body "## Changes\n- ..." --target main
|
|
64
|
+
|
|
65
|
+
# 4. 上传 assets
|
|
66
|
+
gitea-cli release asset upload v1.0.0 ./dist/binary --name binary-linux-amd64
|
|
67
|
+
|
|
68
|
+
# 5. 确认
|
|
69
|
+
gitea-cli release get v1.0.0 --output json
|
|
70
|
+
gitea-cli release asset list v1.0.0 --output json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Workflow: CI/CD 排障
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
gitea-cli actions run list --limit 10 --output json
|
|
77
|
+
gitea-cli actions run jobs <run-id> --output json
|
|
78
|
+
gitea-cli actions job logs <job-id> -o ./logs/
|
|
79
|
+
gitea-cli actions job get <job-id> --output json
|
|
80
|
+
gitea-cli actions workflow dispatch <workflow-id> --ref main
|
|
81
|
+
gitea-cli actions artifact list --output json
|
|
82
|
+
gitea-cli actions artifact download <artifact-id> -o ./dist/
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Workflow: 仓库文件修改
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# 读取
|
|
89
|
+
gitea-cli content get src/config.yaml --output json
|
|
90
|
+
|
|
91
|
+
# 创建新文件
|
|
92
|
+
gitea-cli content create src/config.yaml --content "new: value" -m "add config"
|
|
93
|
+
|
|
94
|
+
# 更新(SHA 自动获取)
|
|
95
|
+
gitea-cli content update src/config.yaml --content "updated: value" -m "update config"
|
|
96
|
+
|
|
97
|
+
# 从本地文件上传
|
|
98
|
+
gitea-cli content update src/config.yaml --file ./local-config.yaml -m "update from local"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Workflow: 配置管理
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
gitea-cli config list --output json
|
|
105
|
+
gitea-cli config set --name work --host <url> --token <tok> --default-owner myorg
|
|
106
|
+
gitea-cli config get work
|
|
107
|
+
# 临时使用其他 context
|
|
108
|
+
gitea-cli issue list --context personal --output json
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Command Reference
|
|
112
|
+
|
|
113
|
+
### Config
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
gitea-cli config list # List all contexts
|
|
117
|
+
gitea-cli config get <name> # Get context details
|
|
118
|
+
gitea-cli config set --name <ctx> --host <url> --token <tok> # Create/update context
|
|
119
|
+
# Additional flags: --default-owner, --default-repo
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Repository
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
gitea-cli repo list --owner <org> --output json
|
|
126
|
+
gitea-cli repo get --owner <org> --repo <repo> --output json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Branch
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
gitea-cli branch list --output json
|
|
133
|
+
gitea-cli branch get <name> --output json
|
|
134
|
+
gitea-cli branch create <name> --from <base>
|
|
135
|
+
gitea-cli branch delete <name> --force
|
|
136
|
+
gitea-cli branch protect list --output json
|
|
137
|
+
gitea-cli branch protect create <name> --enable-push --required-approvals 2
|
|
138
|
+
gitea-cli branch protect delete <name> --force
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### File Content
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
gitea-cli content list [--path] --ref <branch> --output json
|
|
145
|
+
gitea-cli content get <path> --ref <branch> --output json # --raw for decoded content
|
|
146
|
+
gitea-cli content create <path> --content "text" -m "msg" # or --file <local>
|
|
147
|
+
gitea-cli content update <path> --content "text" -m "msg" # --sha auto-fetched
|
|
148
|
+
gitea-cli content delete <path> -m "msg" --force
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Commit
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
gitea-cli commit list --branch <ref> --limit 10 --output json
|
|
155
|
+
gitea-cli commit get <sha> --output json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Issue
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
gitea-cli issue list --state open --output json
|
|
162
|
+
gitea-cli issue get <number> --output json
|
|
163
|
+
gitea-cli issue create -t "Title" -b "Body" --label <id> --milestone <id>
|
|
164
|
+
gitea-cli issue create -t "Title" --attach ./image.png --attach ./log.txt
|
|
165
|
+
gitea-cli issue update <number> -t "New Title" --state closed
|
|
166
|
+
gitea-cli issue close <number>
|
|
167
|
+
|
|
168
|
+
# Comments
|
|
169
|
+
gitea-cli issue comment list <number> --output json
|
|
170
|
+
gitea-cli issue comment create <number> -b "Comment text"
|
|
171
|
+
gitea-cli issue comment update <comment-id> -b "Updated text"
|
|
172
|
+
gitea-cli issue comment delete <comment-id> --force
|
|
173
|
+
|
|
174
|
+
# Attachments
|
|
175
|
+
gitea-cli issue attachment list <number> --output json
|
|
176
|
+
gitea-cli issue attachment upload <number> <file> --name <filename>
|
|
177
|
+
gitea-cli issue attachment download <number> <attach-id> -o ./save/
|
|
178
|
+
gitea-cli issue attachment delete <number> <attach-id> --force
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Pull Request
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
gitea-cli pr list --state open --output json
|
|
185
|
+
gitea-cli pr get <index> --output json
|
|
186
|
+
gitea-cli pr create --title "Title" --head <src> --base <target> --body "Desc"
|
|
187
|
+
gitea-cli pr close <index>
|
|
188
|
+
gitea-cli pr reopen <index>
|
|
189
|
+
gitea-cli pr merge <index> --strategy merge --delete-branch
|
|
190
|
+
# Strategies: merge, rebase, squash, fast-forward-only
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Label
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
gitea-cli label list --output json
|
|
197
|
+
gitea-cli label get <id> --output json
|
|
198
|
+
gitea-cli label create --name "bug" --color "#ff0000" --description "Bug report"
|
|
199
|
+
gitea-cli label delete <id> --force
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Milestone
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
gitea-cli milestone list --state open --output json
|
|
206
|
+
gitea-cli milestone get <id> --output json
|
|
207
|
+
gitea-cli milestone create --title "v1.0" --description "First release" --due-on 2025-12-31T00:00:00Z
|
|
208
|
+
gitea-cli milestone close <id>
|
|
209
|
+
gitea-cli milestone delete <id> --force
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Tag
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
gitea-cli tag list --output json
|
|
216
|
+
gitea-cli tag get <name> --output json
|
|
217
|
+
gitea-cli tag create <name> --target <ref> -m "Annotated tag message"
|
|
218
|
+
gitea-cli tag delete <name> --force
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Actions (CI/CD)
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Workflows
|
|
225
|
+
gitea-cli actions workflow list --output json
|
|
226
|
+
gitea-cli actions workflow get <id-or-filename> --output json
|
|
227
|
+
gitea-cli actions workflow enable <id-or-filename>
|
|
228
|
+
gitea-cli actions workflow disable <id-or-filename>
|
|
229
|
+
gitea-cli actions workflow dispatch <id-or-filename> --ref main --input key=value
|
|
230
|
+
|
|
231
|
+
# Runs
|
|
232
|
+
gitea-cli actions run list --status completed --output json
|
|
233
|
+
gitea-cli actions run get <run-id> --output json
|
|
234
|
+
gitea-cli actions run jobs <run-id> --output json
|
|
235
|
+
gitea-cli actions run artifacts <run-id> --output json
|
|
236
|
+
gitea-cli actions run delete <run-id> --force
|
|
237
|
+
|
|
238
|
+
# Jobs
|
|
239
|
+
gitea-cli actions job get <job-id> --output json
|
|
240
|
+
gitea-cli actions job logs <job-id> -o ./logs/
|
|
241
|
+
|
|
242
|
+
# Artifacts
|
|
243
|
+
gitea-cli actions artifact list --output json
|
|
244
|
+
gitea-cli actions artifact download <id> -o ./dist/
|
|
245
|
+
gitea-cli actions artifact delete <id> --force
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Webhook
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
gitea-cli webhook list --output json
|
|
252
|
+
gitea-cli webhook get <id> --output json
|
|
253
|
+
gitea-cli webhook create --url <endpoint> --secret <secret> --event push --event issues --active
|
|
254
|
+
gitea-cli webhook update <id> --url <new-url> --active false
|
|
255
|
+
gitea-cli webhook delete <id> --force
|
|
256
|
+
gitea-cli webhook test <id>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Release
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
gitea-cli release list --output json
|
|
263
|
+
gitea-cli release get <tag> --output json
|
|
264
|
+
gitea-cli release create --tag <tag> --name "Title" --body "Notes" --target <ref> --draft --prerelease
|
|
265
|
+
gitea-cli release create --tag <tag> --body-file changelog.md # avoids encoding issues
|
|
266
|
+
gitea-cli release delete <tag> --force
|
|
267
|
+
|
|
268
|
+
# Assets
|
|
269
|
+
gitea-cli release asset list <tag> --output json
|
|
270
|
+
gitea-cli release asset upload <tag> <file> --name <asset-name>
|
|
271
|
+
gitea-cli release asset download <tag> <asset-id> -o ./downloads/
|
|
272
|
+
gitea-cli release asset delete <tag> <asset-id> --force
|
|
273
|
+
```
|
package/assets/SKILL.md
CHANGED
|
@@ -5,404 +5,86 @@ description: Use when needing to interact with Gitea repositories, branches, iss
|
|
|
5
5
|
|
|
6
6
|
# gitea-cli
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Binaries for all platforms are bundled under the `scripts/` directory relative to this skill:
|
|
8
|
+
Stateless CLI for Gitea HTTP API. Every call is an independent request, safe for concurrent use.
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|----------|------|
|
|
14
|
-
| Linux amd64 | `scripts/linux-amd64/gitea-cli` |
|
|
15
|
-
| Linux arm64 | `scripts/linux-arm64/gitea-cli` |
|
|
16
|
-
| macOS amd64 | `scripts/darwin-amd64/gitea-cli` |
|
|
17
|
-
| macOS arm64 | `scripts/darwin-arm64/gitea-cli` |
|
|
18
|
-
| Windows amd64 | `scripts/windows-amd64/gitea-cli.exe` |
|
|
19
|
-
| Windows arm64 | `scripts/windows-arm64/gitea-cli.exe` |
|
|
10
|
+
## Binary Location
|
|
20
11
|
|
|
21
|
-
|
|
12
|
+
Resolve `gitea-cli` to the platform binary in skill directory `~/.claude/skills/gitea-cli/`:
|
|
22
13
|
|
|
23
14
|
```bash
|
|
24
|
-
SKILL_DIR="$HOME/.claude/skills/gitea-cli"
|
|
25
|
-
|
|
26
15
|
# Linux / macOS
|
|
16
|
+
SKILL_DIR="$HOME/.claude/skills/gitea-cli"
|
|
27
17
|
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
|
28
|
-
ARCH="$(uname -m)"
|
|
29
|
-
[[ "$ARCH" == "x86_64" ]] && ARCH="amd64"
|
|
30
|
-
[[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]] && ARCH="arm64"
|
|
18
|
+
ARCH="$(uname -m)" && [[ "$ARCH" == "x86_64" ]] && ARCH="amd64" && [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]] && ARCH="arm64"
|
|
31
19
|
GITEA_CLI="$SKILL_DIR/scripts/${OS}-${ARCH}/gitea-cli"
|
|
32
|
-
|
|
33
|
-
# Windows (PowerShell)
|
|
34
|
-
# $GITEA_CLI = "$env:USERPROFILE\.claude\skills\gitea-cli\scripts\windows-amd64\gitea-cli.exe"
|
|
20
|
+
# Windows: %USERPROFILE%\.claude\skills\gitea-cli\scripts\windows-amd64\gitea-cli.exe
|
|
35
21
|
```
|
|
36
22
|
|
|
37
|
-
If
|
|
38
|
-
|
|
39
|
-
## Overview
|
|
40
|
-
|
|
41
|
-
`gitea-cli` is a stateless CLI tool that manages Gitea repositories through the HTTP API. Each call is an independent API request, making it safe for concurrent use. It supports both human-friendly table output and machine-friendly JSON output (`--output json`).
|
|
23
|
+
If available in PATH, `gitea-cli` can be used directly.
|
|
42
24
|
|
|
43
25
|
## Agent Rules
|
|
44
26
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 2. Never switch context autonomously
|
|
52
|
-
|
|
53
|
-
Use `--owner`/`--repo` flags to target different repos. Do NOT call `config use` without user supervision.
|
|
54
|
-
|
|
55
|
-
### 3. Destructive operations require confirmation
|
|
56
|
-
|
|
57
|
-
Always run a list/get command first to verify the target exists before deleting.
|
|
58
|
-
|
|
59
|
-
### 4. Branch/ref auto-detection
|
|
60
|
-
|
|
61
|
-
When inside a git repo, `--branch` and `--ref` default to the current branch. `--owner`/`--repo` auto-detect from git remote.
|
|
27
|
+
1. **Always `--output json`** — All calls must include this flag
|
|
28
|
+
2. **Never switch context** — Use `--owner`/`--repo` flags; do NOT call `config use` autonomously
|
|
29
|
+
3. **Verify before delete** — Run `list`/`get` first, then `--force` for non-interactive
|
|
30
|
+
4. **Auto-detection** — In a git repo, `--branch`/`--ref`/`--owner`/`--repo` auto-detect from `.git`
|
|
62
31
|
|
|
63
32
|
## Global Flags
|
|
64
33
|
|
|
65
34
|
| Flag | Short | Description |
|
|
66
35
|
|------|-------|-------------|
|
|
67
|
-
| `--output` | `-o` | `json`
|
|
68
|
-
| `--owner` | | Repository owner |
|
|
69
|
-
| `--repo` | `-r` | Repository name |
|
|
36
|
+
| `--output` | `-o` | `json` (agents: always) or `table` |
|
|
37
|
+
| `--owner` | | Repository owner (auto-detect from git) |
|
|
38
|
+
| `--repo` | `-r` | Repository name (auto-detect from git) |
|
|
70
39
|
| `--context` | `-c` | Context name (override, no save) |
|
|
71
|
-
| `--config` | | Config file path |
|
|
72
40
|
| `--host` | | Gitea host URL |
|
|
73
41
|
| `--token` | | API token |
|
|
74
42
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
## Common Workflows
|
|
78
|
-
|
|
79
|
-
### Workflow 1: Issue 处理
|
|
80
|
-
|
|
81
|
-
处理用户反馈或 bug 报告的标准流程。
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
# 1. 查看当前 open 的 issues
|
|
85
|
-
gitea-cli issue list --state open --output json
|
|
86
|
-
|
|
87
|
-
# 2. 查看具体 issue 详情
|
|
88
|
-
gitea-cli issue get <number> --output json
|
|
89
|
-
|
|
90
|
-
# 3. 如果需要 label/milestone,先查找 ID
|
|
91
|
-
gitea-cli label list --output json
|
|
92
|
-
gitea-cli milestone list --output json
|
|
93
|
-
|
|
94
|
-
# 4. 更新 issue(添加 label、milestone 等)
|
|
95
|
-
gitea-cli issue update <number> --label <id> --milestone <id>
|
|
96
|
-
|
|
97
|
-
# 5. 处理过程中添加评论记录进展
|
|
98
|
-
gitea-cli issue comment create <number> -b "分析原因:..."
|
|
99
|
-
|
|
100
|
-
# 6. 如果需要上传截图或日志
|
|
101
|
-
gitea-cli issue attachment upload <number> ./screenshot.png
|
|
102
|
-
|
|
103
|
-
# 7. 处理完成后关闭 issue
|
|
104
|
-
gitea-cli issue close <number>
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Workflow 2: PR 工作流
|
|
108
|
-
|
|
109
|
-
从创建分支到合并 PR 的完整流程。
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# 1. 创建 feature 分支
|
|
113
|
-
gitea-cli branch create feature/xyz --from main
|
|
114
|
-
|
|
115
|
-
# 2. (本地开发完成后)查看当前分支列表确认
|
|
116
|
-
gitea-cli branch list --output json
|
|
117
|
-
|
|
118
|
-
# 3. 创建 PR
|
|
119
|
-
gitea-cli pr create --title "feat: add new feature" --head feature/xyz --base main --body "## Summary\n- Changes made\n\n## Test plan\n- [ ] Unit tests pass"
|
|
120
|
-
|
|
121
|
-
# 4. 查看 PR 状态
|
|
122
|
-
gitea-cli pr get <index> --output json
|
|
123
|
-
|
|
124
|
-
# 5. 检查 CI 状态(如果有 Actions 配置)
|
|
125
|
-
gitea-cli actions run list --output json
|
|
126
|
-
gitea-cli actions run jobs <run-id> --output json
|
|
127
|
-
|
|
128
|
-
# 6. CI 通过后合并 PR
|
|
129
|
-
gitea-cli pr merge <index> --strategy squash --delete-branch
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Workflow 3: Release 发布
|
|
133
|
-
|
|
134
|
-
创建版本发布的完整流程。
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
# 1. 查看最近的提交,确定版本范围
|
|
138
|
-
gitea-cli commit list --branch main --limit 20 --output json
|
|
139
|
-
|
|
140
|
-
# 2. 查看现有 tags 和 releases
|
|
141
|
-
gitea-cli tag list --output json
|
|
142
|
-
gitea-cli release list --output json
|
|
143
|
-
|
|
144
|
-
# 3. 创建 tag
|
|
145
|
-
gitea-cli tag create v1.0.0 --target main -m "Release v1.0.0"
|
|
146
|
-
|
|
147
|
-
# 4. 创建 release
|
|
148
|
-
gitea-cli release create --tag v1.0.0 --name "v1.0.0" --body "## New Features\n- Feature A\n\n## Bug Fixes\n- Fix B" --target main
|
|
149
|
-
|
|
150
|
-
# 5. 上传构建产物
|
|
151
|
-
gitea-cli release asset upload v1.0.0 ./dist/binary-linux-amd64 --name binary-linux-amd64
|
|
152
|
-
gitea-cli release asset upload v1.0.0 ./dist/binary-darwin-arm64 --name binary-darwin-arm64
|
|
153
|
-
|
|
154
|
-
# 6. 确认 release 内容
|
|
155
|
-
gitea-cli release get v1.0.0 --output json
|
|
156
|
-
gitea-cli release asset list v1.0.0 --output json
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Workflow 4: CI/CD 监控与排障
|
|
160
|
-
|
|
161
|
-
监控 pipeline 状态和排查失败的任务。
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
# 1. 查看最近的 runs
|
|
165
|
-
gitea-cli actions run list --limit 10 --output json
|
|
166
|
-
|
|
167
|
-
# 2. 查看失败 run 的 jobs
|
|
168
|
-
gitea-cli actions run jobs <run-id> --output json
|
|
169
|
-
|
|
170
|
-
# 3. 获取失败 job 的日志
|
|
171
|
-
gitea-cli actions job logs <job-id> -o ./logs/
|
|
172
|
-
|
|
173
|
-
# 4. 查看 job 详情(含步骤状态)
|
|
174
|
-
gitea-cli actions job get <job-id> --output json
|
|
175
|
-
|
|
176
|
-
# 5. 重新触发 workflow
|
|
177
|
-
gitea-cli actions workflow dispatch <workflow-id> --ref main
|
|
178
|
-
|
|
179
|
-
# 6. 查看构建产物
|
|
180
|
-
gitea-cli actions artifact list --output json
|
|
181
|
-
gitea-cli actions artifact download <artifact-id> -o ./dist/
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Workflow 5: 仓库文件修改
|
|
185
|
-
|
|
186
|
-
通过 API 读取、修改、写回仓库文件。
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
# 1. 读取文件内容(获取当前版本)
|
|
190
|
-
gitea-cli content get src/config.yaml --output json
|
|
191
|
-
|
|
192
|
-
# 2. 在 feature 分支上创建新版本(--branch 省略时用当前分支)
|
|
193
|
-
gitea-cli content create src/config.yaml --content "new: value" -m "add config"
|
|
43
|
+
Env vars: `GITEA_HOST`, `GITEA_TOKEN`, `GITEA_OWNER`, `GITEA_REPO`
|
|
194
44
|
|
|
195
|
-
|
|
196
|
-
gitea-cli content update src/config.yaml --content "updated: value" -m "update config"
|
|
45
|
+
## Command Summary
|
|
197
46
|
|
|
198
|
-
# 4. 或从本地文件上传
|
|
199
|
-
gitea-cli content update src/config.yaml --file ./local-config.yaml -m "update config from local"
|
|
200
|
-
|
|
201
|
-
# 5. 确认修改
|
|
202
|
-
gitea-cli content get src/config.yaml --output json
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Workflow 6: 配置与多环境管理
|
|
206
|
-
|
|
207
|
-
管理多个 Gitea 实例的 context 配置。
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
# 1. 查看当前配置
|
|
211
|
-
gitea-cli config list --output json
|
|
212
|
-
|
|
213
|
-
# 2. 添加新的 context
|
|
214
|
-
gitea-cli config set --name work --host https://git.company.com --token <token> --default-owner myorg
|
|
215
|
-
|
|
216
|
-
# 3. 临时使用另一个 context(不保存)
|
|
217
|
-
gitea-cli issue list --context personal --output json
|
|
218
|
-
|
|
219
|
-
# 4. 查看特定 context 详情
|
|
220
|
-
gitea-cli config get work
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
## Command Quick Reference
|
|
224
|
-
|
|
225
|
-
### Config
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
gitea-cli config list # List all contexts
|
|
229
|
-
gitea-cli config get <name> # Get context details
|
|
230
|
-
gitea-cli config set --name <ctx> --host <url> --token <tok> # Create/update context
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Repository
|
|
234
|
-
|
|
235
|
-
```bash
|
|
236
|
-
gitea-cli repo list --owner <org> --output json
|
|
237
|
-
gitea-cli repo get --owner <org> --repo <repo> --output json
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
### Branch
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
gitea-cli branch list --output json
|
|
244
|
-
gitea-cli branch get <name> --output json
|
|
245
|
-
gitea-cli branch create <name> --from <base>
|
|
246
|
-
gitea-cli branch delete <name> --force
|
|
247
|
-
gitea-cli branch protect list --output json
|
|
248
|
-
gitea-cli branch protect create <name> --enable-push --required-approvals 2
|
|
249
|
-
gitea-cli branch protect delete <name> --force
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### File Content
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
gitea-cli content list [--path] --ref <branch> --output json
|
|
256
|
-
gitea-cli content get <path> --ref <branch> --output json # --raw for decoded content in json
|
|
257
|
-
gitea-cli content create <path> --content "text" -m "msg" # or --file <local>
|
|
258
|
-
gitea-cli content update <path> --content "text" -m "msg" # --sha auto-fetched
|
|
259
|
-
gitea-cli content delete <path> -m "msg" --force
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Commit
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
gitea-cli commit list --branch <ref> --limit 10 --output json
|
|
266
|
-
gitea-cli commit get <sha> --output json
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### Issue
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
gitea-cli issue list --state open --output json
|
|
273
|
-
gitea-cli issue get <number> --output json
|
|
274
|
-
gitea-cli issue create -t "Title" -b "Body" --label <id> --milestone <id>
|
|
275
|
-
gitea-cli issue create -t "Title" --attach ./image.png --attach ./log.txt # embed attachments in body
|
|
276
|
-
gitea-cli issue update <number> -t "New Title" --state closed
|
|
277
|
-
gitea-cli issue close <number>
|
|
278
|
-
|
|
279
|
-
# Comments
|
|
280
|
-
gitea-cli issue comment list <number> --output json
|
|
281
|
-
gitea-cli issue comment create <number> -b "Comment text"
|
|
282
|
-
gitea-cli issue comment update <comment-id> -b "Updated text"
|
|
283
|
-
gitea-cli issue comment delete <comment-id> --force
|
|
284
|
-
|
|
285
|
-
# Attachments
|
|
286
|
-
gitea-cli issue attachment list <number> --output json
|
|
287
|
-
gitea-cli issue attachment upload <number> <file> --name <filename>
|
|
288
|
-
gitea-cli issue attachment download <number> <attach-id> -o ./save/
|
|
289
|
-
gitea-cli issue attachment delete <number> <attach-id> --force
|
|
290
47
|
```
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
48
|
+
config set/list/get/use — Context configuration
|
|
49
|
+
issue list/get/create/update/close — Issues + comments + attachments
|
|
50
|
+
pr list/get/create/close/reopen/merge — Pull requests
|
|
51
|
+
branch list/get/create/delete — Branches + protection rules
|
|
52
|
+
content list/get/create/update/delete — Repo file CRUD
|
|
53
|
+
commit list/get — Commit history
|
|
54
|
+
label list/get/create/delete — Labels
|
|
55
|
+
milestone list/get/create/close/delete — Milestones
|
|
56
|
+
tag list/get/create/delete — Tags
|
|
57
|
+
release list/get/create/delete — Releases + assets
|
|
58
|
+
actions workflow/run/job/artifact — CI/CD management
|
|
59
|
+
webhook list/get/create/update/delete/test — Webhooks
|
|
301
60
|
```
|
|
302
61
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
```bash
|
|
306
|
-
gitea-cli label list --output json
|
|
307
|
-
gitea-cli label get <id> --output json
|
|
308
|
-
gitea-cli label create --name "bug" --color "#ff0000" --description "Bug report"
|
|
309
|
-
gitea-cli label delete <id> --force
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
### Milestone
|
|
313
|
-
|
|
314
|
-
```bash
|
|
315
|
-
gitea-cli milestone list --state open --output json
|
|
316
|
-
gitea-cli milestone get <id> --output json
|
|
317
|
-
gitea-cli milestone create --title "v1.0" --description "First release" --due-on 2025-12-31T00:00:00Z
|
|
318
|
-
gitea-cli milestone close <id>
|
|
319
|
-
gitea-cli milestone delete <id> --force
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
### Tag
|
|
62
|
+
## Common Workflows
|
|
323
63
|
|
|
324
|
-
|
|
325
|
-
gitea-cli tag list --output json
|
|
326
|
-
gitea-cli tag get <name> --output json
|
|
327
|
-
gitea-cli tag create <name> --target <ref> -m "Annotated tag message"
|
|
328
|
-
gitea-cli tag delete <name> --force
|
|
329
|
-
```
|
|
64
|
+
When performing a task, follow the matching workflow. Read `REFERENCE.md` in the same skill directory for full command details and flags.
|
|
330
65
|
|
|
331
|
-
|
|
66
|
+
**Issue** — `issue list` → `issue get <n>` → `comment create <n>` → `issue close <n>`
|
|
67
|
+
**PR** — `branch create <name> --from <base>` → `pr create` → `actions run list` → `pr merge <idx>`
|
|
68
|
+
**Release** — `tag create <v>` → `release create --tag <v>` → `release asset upload <v> <file>`
|
|
69
|
+
**CI/CD** — `actions run list` → `actions run jobs <run>` → `actions job logs <job>`
|
|
70
|
+
**File edit** — `content get <path>` → `content update <path> --content "..." -m "msg"`
|
|
71
|
+
**Config** — `config set --name <ctx> --host <url> --token <tok>`
|
|
332
72
|
|
|
333
|
-
|
|
334
|
-
# Workflows
|
|
335
|
-
gitea-cli actions workflow list --output json
|
|
336
|
-
gitea-cli actions workflow get <id-or-filename> --output json
|
|
337
|
-
gitea-cli actions workflow enable <id-or-filename>
|
|
338
|
-
gitea-cli actions workflow disable <id-or-filename>
|
|
339
|
-
gitea-cli actions workflow dispatch <id-or-filename> --ref main --input key=value
|
|
73
|
+
## Error Handling
|
|
340
74
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
75
|
+
| Error | Fix |
|
|
76
|
+
|-------|-----|
|
|
77
|
+
| `host is required` | Run `config set` |
|
|
78
|
+
| `API 404` | Verify owner/repo/index |
|
|
79
|
+
| `API 409` | Already exists, skip |
|
|
80
|
+
| `API 401` | Check token |
|
|
347
81
|
|
|
348
|
-
|
|
349
|
-
gitea-cli actions job get <job-id> --output json
|
|
350
|
-
gitea-cli actions job logs <job-id> -o ./logs/
|
|
82
|
+
Destructive ops: always `list`/`get` first, then `--force`. Deleted resources cannot be recovered.
|
|
351
83
|
|
|
352
|
-
|
|
353
|
-
gitea-cli actions artifact list --output json
|
|
354
|
-
gitea-cli actions artifact download <id> -o ./dist/
|
|
355
|
-
gitea-cli actions artifact delete <id> --force
|
|
356
|
-
```
|
|
84
|
+
## On-Demand Reference
|
|
357
85
|
|
|
358
|
-
|
|
86
|
+
For full command flags and detailed workflow steps, read the reference file:
|
|
359
87
|
|
|
360
|
-
```bash
|
|
361
|
-
gitea-cli webhook list --output json
|
|
362
|
-
gitea-cli webhook get <id> --output json
|
|
363
|
-
gitea-cli webhook create --url <endpoint> --secret <secret> --event push --event issues --active
|
|
364
|
-
gitea-cli webhook update <id> --url <new-url> --active false
|
|
365
|
-
gitea-cli webhook delete <id> --force
|
|
366
|
-
gitea-cli webhook test <id>
|
|
367
88
|
```
|
|
368
|
-
|
|
369
|
-
### Release
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
gitea-cli release list --output json
|
|
373
|
-
gitea-cli release get <tag> --output json
|
|
374
|
-
gitea-cli release create --tag <tag> --name "Title" --body "Notes" --target <ref> --draft --prerelease
|
|
375
|
-
gitea-cli release create --tag <tag> --body-file changelog.md # use file for release notes (avoids encoding issues)
|
|
376
|
-
gitea-cli release delete <tag> --force
|
|
377
|
-
|
|
378
|
-
# Assets
|
|
379
|
-
gitea-cli release asset list <tag> --output json
|
|
380
|
-
gitea-cli release asset upload <tag> <file> --name <asset-name>
|
|
381
|
-
gitea-cli release asset download <tag> <asset-id> -o ./downloads/
|
|
382
|
-
gitea-cli release asset delete <tag> <asset-id> --force
|
|
89
|
+
~/.claude/skills/gitea-cli/REFERENCE.md
|
|
383
90
|
```
|
|
384
|
-
|
|
385
|
-
## Error Handling
|
|
386
|
-
|
|
387
|
-
| Exit Code | Meaning |
|
|
388
|
-
|-----------|---------|
|
|
389
|
-
| `0` | Success |
|
|
390
|
-
| `1` | Error (see stderr) |
|
|
391
|
-
|
|
392
|
-
JSON errors on stderr: `{"error": "API 404: repository not found"}`
|
|
393
|
-
|
|
394
|
-
| Error | Cause | Fix |
|
|
395
|
-
|-------|-------|-----|
|
|
396
|
-
| `host is required` | No context configured | Run `config set` |
|
|
397
|
-
| `API 404` | Resource not found | Verify owner/repo/index |
|
|
398
|
-
| `API 409` | Resource already exists | Skip duplicate creation |
|
|
399
|
-
| `API 401` | Invalid/expired token | Check context token |
|
|
400
|
-
|
|
401
|
-
## Destructive Operations Checklist
|
|
402
|
-
|
|
403
|
-
Before running any delete, always verify:
|
|
404
|
-
|
|
405
|
-
1. Run the corresponding `list` or `get` command first
|
|
406
|
-
2. Confirm the resource ID/name matches the intended target
|
|
407
|
-
3. Use `--force` flag to skip interactive prompts (required for agent use)
|
|
408
|
-
4. Consider irreversibility — deleted resources cannot be recovered
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -170,13 +170,20 @@ async function install(args) {
|
|
|
170
170
|
|
|
171
171
|
console.log(`Installing gitea-cli skill (${osArch.os}-${osArch.arch}) to ${skillDir}...`);
|
|
172
172
|
|
|
173
|
-
// 1. Copy SKILL.md
|
|
173
|
+
// 1. Copy SKILL.md and REFERENCE.md
|
|
174
174
|
fs.mkdirSync(skillDir, { recursive: true });
|
|
175
175
|
const srcSkill = path.resolve(__dirname, '..', 'assets', 'SKILL.md');
|
|
176
176
|
const destSkill = path.join(skillDir, 'SKILL.md');
|
|
177
177
|
fs.copyFileSync(srcSkill, destSkill);
|
|
178
178
|
console.log(` SKILL.md -> ${destSkill}`);
|
|
179
179
|
|
|
180
|
+
const srcRef = path.resolve(__dirname, '..', 'assets', 'REFERENCE.md');
|
|
181
|
+
const destRef = path.join(skillDir, 'REFERENCE.md');
|
|
182
|
+
if (fs.existsSync(srcRef)) {
|
|
183
|
+
fs.copyFileSync(srcRef, destRef);
|
|
184
|
+
console.log(` REFERENCE.md -> ${destRef}`);
|
|
185
|
+
}
|
|
186
|
+
|
|
180
187
|
// 2. Check existing binary
|
|
181
188
|
const binaryName = osArch.os === 'windows' ? 'gitea-cli.exe' : 'gitea-cli';
|
|
182
189
|
const destBinary = path.join(scriptsDir, binaryName);
|