gitcode-cli 0.6.1__tar.gz → 0.9.1__tar.gz
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.
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/LICENSE +1 -1
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/MANIFEST.in +1 -1
- {gitcode_cli-0.6.1/gitcode_cli.egg-info → gitcode_cli-0.9.1}/PKG-INFO +120 -57
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/README.md +119 -56
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/__init__.py +1 -1
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/bin/gc-darwin-amd64 +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/bin/gc-darwin-arm64 +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/bin/gc-linux-amd64 +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/bin/gc-linux-arm64 +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/bin/gc-windows-amd64.exe +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1/gitcode_cli.egg-info}/PKG-INFO +120 -57
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/pyproject.toml +2 -2
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/__main__.py +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/bin/.gitkeep +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gc_cli/wrapper.py +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gitcode_cli.egg-info/SOURCES.txt +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gitcode_cli.egg-info/dependency_links.txt +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gitcode_cli.egg-info/entry_points.txt +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/gitcode_cli.egg-info/top_level.txt +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/setup.cfg +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.1}/tests/test_wrapper.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: GitCode CLI - Command line tool for GitCode
|
|
5
5
|
Author-email: GitCode CLI Contributors <support@gitcode.com>
|
|
6
6
|
Maintainer-email: GitCode CLI Contributors <support@gitcode.com>
|
|
@@ -33,9 +33,11 @@ Dynamic: license-file
|
|
|
33
33
|
|
|
34
34
|
[](https://golang.org)
|
|
35
35
|
[](LICENSE)
|
|
36
|
-
[](https://gitcode.com/gitcode-cli/cli/releases)
|
|
37
37
|
|
|
38
|
-
GitCode
|
|
38
|
+
GitCode CLI 把仓库、Issue、PR、Release 和 Actions 带回终端,让开发者减少页面切换,也让脚本与 AI 获得结构化、可审计、带安全边界的 GitCode 执行入口。
|
|
39
|
+
|
|
40
|
+
[快速了解核心价值与应用场景,并在五分钟内开始使用](./docs/INTRODUCTION.md)。
|
|
39
41
|
|
|
40
42
|
## 文档导航
|
|
41
43
|
|
|
@@ -50,6 +52,7 @@ GitCode 命令行工具,为 GitCode 用户提供便捷的命令行操作体验
|
|
|
50
52
|
|
|
51
53
|
主要文档:
|
|
52
54
|
|
|
55
|
+
- [产品介绍与快速上手](./docs/INTRODUCTION.md)
|
|
53
56
|
- [命令手册](./docs/COMMANDS.md)
|
|
54
57
|
- [认证说明](./docs/AUTH.md)
|
|
55
58
|
- [回归说明](./docs/REGRESSION.md)
|
|
@@ -99,10 +102,10 @@ export PATH="$HOME/.local/bin:$PATH"
|
|
|
99
102
|
|
|
100
103
|
```bash
|
|
101
104
|
# 从 Releases 下载 .deb 包
|
|
102
|
-
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
105
|
+
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gc_0.9.1_amd64.deb
|
|
103
106
|
|
|
104
107
|
# 安装
|
|
105
|
-
sudo dpkg -i gc_0.
|
|
108
|
+
sudo dpkg -i gc_0.9.1_amd64.deb
|
|
106
109
|
```
|
|
107
110
|
|
|
108
111
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -111,10 +114,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
111
114
|
|
|
112
115
|
```bash
|
|
113
116
|
# 从 Releases 下载 .rpm 包
|
|
114
|
-
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
117
|
+
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gc-0.9.1-1.x86_64.rpm
|
|
115
118
|
|
|
116
119
|
# 安装
|
|
117
|
-
sudo rpm -i gc-0.
|
|
120
|
+
sudo rpm -i gc-0.9.1-1.x86_64.rpm
|
|
118
121
|
```
|
|
119
122
|
|
|
120
123
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -127,10 +130,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
127
130
|
# 创建虚拟环境
|
|
128
131
|
python3 -m venv .venv
|
|
129
132
|
source .venv/bin/activate # Linux/macOS
|
|
130
|
-
#
|
|
133
|
+
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
131
134
|
|
|
132
135
|
# 安装(一行命令)
|
|
133
|
-
pip install https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
136
|
+
pip install https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gitcode_cli-0.9.1-py3-none-any.whl
|
|
134
137
|
|
|
135
138
|
# Windows PowerShell 中推荐使用 gitcode,避免 gc 被内置 Get-Content 别名覆盖
|
|
136
139
|
gitcode version
|
|
@@ -139,7 +142,8 @@ gitcode version
|
|
|
139
142
|
说明:
|
|
140
143
|
- wheel 会同时安装 `gc` 和 `gitcode` 两个命令入口,功能相同。
|
|
141
144
|
- DEB/RPM 包也会同时安装 `gc` 和 `gitcode`;Linux 上二者功能相同。
|
|
142
|
-
- Windows
|
|
145
|
+
- Windows 使用 `py -m pip install --user ...` 时,脚本会安装到 Python user scheme 的 `Scripts` 目录。请运行 `py -c "import os, sysconfig; print(sysconfig.get_path('scripts', os.name + '_user'))"` 获取准确路径,将其加入用户 `PATH` 后重新打开终端;配置前可直接运行 `py -m gc_cli version`。
|
|
146
|
+
- Windows PowerShell 预置 `gc` 作为 `Get-Content` 别名;如果 `gc version` 被解析为读取文件,请改用 `gitcode version`、`gc.exe version` 或 `py -m gc_cli version`。
|
|
143
147
|
- Windows PowerShell 中通过 `--body-file -` / `--comment-file -` 管道传入中文或其他非 ASCII 正文时,推荐使用 UTF-8 文件;如果必须直接管道,先设置 `$OutputEncoding = [System.Text.UTF8Encoding]::new($false)`。CLI 会拦截疑似已被 PowerShell 损坏成 `???` 的输入并提示正确用法。
|
|
144
148
|
|
|
145
149
|
```powershell
|
|
@@ -149,14 +153,16 @@ gitcode issue create -R owner/repo --title "标题" --body-file body.md
|
|
|
149
153
|
|
|
150
154
|
### PyPI(备选)
|
|
151
155
|
|
|
156
|
+
> PyPI 可能晚于 GitCode Release 同步。固定目标版本可避免静默安装旧版本;目标版本暂不可用时,请使用上方 Release wheel。
|
|
157
|
+
|
|
152
158
|
```bash
|
|
153
159
|
# 创建虚拟环境
|
|
154
160
|
python3 -m venv .venv
|
|
155
161
|
source .venv/bin/activate # Linux/macOS
|
|
156
|
-
#
|
|
162
|
+
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
157
163
|
|
|
158
|
-
#
|
|
159
|
-
pip install gitcode-cli
|
|
164
|
+
# 固定版本安装,避免 PyPI 尚未同步时安装旧版本
|
|
165
|
+
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.9.1
|
|
160
166
|
|
|
161
167
|
# Windows PowerShell 中推荐使用 gitcode
|
|
162
168
|
gitcode version
|
|
@@ -183,42 +189,72 @@ gc version
|
|
|
183
189
|
|
|
184
190
|
Windows 和 macOS 用户建议使用上方 wheel 包;wheel 内置 Linux、macOS 和 Windows 二进制,并同时提供 `gc` 与 `gitcode` 两个命令入口。
|
|
185
191
|
|
|
192
|
+
### Docker 镜像
|
|
193
|
+
|
|
194
|
+
仓库已提供 `Dockerfile`、`docker-compose.yml` 和 Makefile 目标:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# 构建并运行
|
|
198
|
+
make docker-build
|
|
199
|
+
make docker-run
|
|
200
|
+
|
|
201
|
+
# 或使用 docker compose
|
|
202
|
+
docker compose up gc
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
认证 Token 通过环境变量传入。请在交互终端中静默读取,避免 Token 值进入 shell history:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
read -rsp "GitCode token: " GC_TOKEN
|
|
209
|
+
export GC_TOKEN
|
|
210
|
+
make docker-run
|
|
211
|
+
unset GC_TOKEN
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
更多用法参见 Makefile 和 `docker-compose.yml`。
|
|
215
|
+
|
|
216
|
+
### Homebrew (macOS/Linux)
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
brew install gitcode-cli/homebrew-tap/gc
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
更新到最新版本:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
brew upgrade gc
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
shell 补全(bash/zsh/fish)随安装自动配置,无需额外操作。
|
|
229
|
+
|
|
186
230
|
### 规划中的安装方式
|
|
187
231
|
|
|
188
232
|
以下安装方式正在开发中:
|
|
189
233
|
|
|
190
|
-
- [ ] Homebrew (macOS/Linux)
|
|
191
234
|
- [ ] Scoop (Windows)
|
|
192
|
-
- [ ] Docker 镜像
|
|
193
235
|
|
|
194
236
|
## 快速开始
|
|
195
237
|
|
|
196
238
|
### 认证
|
|
197
239
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# 设置 Token 环境变量
|
|
202
|
-
export GC_TOKEN="your_gitcode_token"
|
|
240
|
+
以下示例使用安装包提供的 `gitcode` 入口;从源码构建或使用独立二进制时,请将命令名改为 `gc`。
|
|
203
241
|
|
|
204
|
-
|
|
205
|
-
export GITCODE_TOKEN="your_gitcode_token"
|
|
242
|
+
**方式一:打开令牌页面并登录**
|
|
206
243
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
source ~/.bashrc
|
|
244
|
+
```bash
|
|
245
|
+
gitcode auth login --web
|
|
210
246
|
```
|
|
211
247
|
|
|
212
|
-
|
|
248
|
+
当前 `--web` 会打开 GitCode 的新建访问令牌页面,生成令牌后仍需回到终端粘贴。当前版本不会隐藏输入,因此必须由用户本人在私有、未录制且不由 AI 控制的本地终端中执行。
|
|
213
249
|
|
|
214
|
-
|
|
215
|
-
# 交互式登录(需输入 Token)
|
|
216
|
-
gc auth login
|
|
250
|
+
**方式二:交互式 Token 登录**
|
|
217
251
|
|
|
218
|
-
|
|
219
|
-
|
|
252
|
+
```bash
|
|
253
|
+
gitcode auth login
|
|
220
254
|
```
|
|
221
255
|
|
|
256
|
+
浏览器不可用时,可在同样受控的本地交互终端中输入 Token。不要把 Token 值直接写进命令、shell history 或配置脚本。CI 场景应通过平台 Secret 注入 `GC_TOKEN` 或 `GITCODE_TOKEN`。
|
|
257
|
+
|
|
222
258
|
当前版本认证优先级:
|
|
223
259
|
|
|
224
260
|
1. `GC_TOKEN`
|
|
@@ -233,43 +269,43 @@ echo "YOUR_TOKEN" | gc auth login --with-token
|
|
|
233
269
|
|
|
234
270
|
**获取 Token:**
|
|
235
271
|
1. 登录 [GitCode](https://gitcode.com)
|
|
236
|
-
2. 进入
|
|
237
|
-
3.
|
|
272
|
+
2. 进入 个人设置 -> 访问令牌
|
|
273
|
+
3. 点击“新建访问令牌”,选择所需权限
|
|
238
274
|
4. 复制生成的 Token
|
|
239
275
|
|
|
240
276
|
**验证认证:**
|
|
241
277
|
|
|
242
278
|
```bash
|
|
243
279
|
# 查看认证状态
|
|
244
|
-
|
|
280
|
+
gitcode auth status
|
|
245
281
|
```
|
|
246
282
|
|
|
247
283
|
> 详细命令行为和完整示例请查看 [docs/COMMANDS.md](./docs/COMMANDS.md)。
|
|
248
284
|
|
|
249
285
|
## 输出格式
|
|
250
286
|
|
|
251
|
-
`
|
|
287
|
+
`gitcode` 的只读命令继续以文本输出为默认体验,同时为脚本和代理保留稳定的结构化入口。
|
|
252
288
|
|
|
253
289
|
```bash
|
|
254
290
|
# 结构化输出
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
291
|
+
gitcode issue list -R owner/repo --json
|
|
292
|
+
gitcode issue list -R owner/repo --format json
|
|
293
|
+
gitcode repo log -R owner/repo --file README.md --branch main --json
|
|
294
|
+
gitcode pr list -R owner/repo --paginate --per-page 100 --json
|
|
259
295
|
|
|
260
296
|
# 常规文本与表格
|
|
261
|
-
|
|
262
|
-
|
|
297
|
+
gitcode issue list -R owner/repo --format simple
|
|
298
|
+
gitcode issue list -R owner/repo --format table
|
|
263
299
|
|
|
264
300
|
# 时间格式切换
|
|
265
|
-
|
|
266
|
-
|
|
301
|
+
gitcode issue list -R owner/repo --time-format absolute
|
|
302
|
+
gitcode issue list -R owner/repo --time-format relative
|
|
267
303
|
|
|
268
304
|
# 自定义模板输出
|
|
269
|
-
|
|
305
|
+
gitcode issue list -R owner/repo --template '{{range .}}#{{.Number}} {{.Title}}{{"\n"}}{{end}}'
|
|
270
306
|
|
|
271
|
-
# typed command 尚未覆盖的 API,可用
|
|
272
|
-
|
|
307
|
+
# typed command 尚未覆盖的 API,可用 gitcode api 读取原始响应
|
|
308
|
+
gitcode api repos/owner/repo
|
|
273
309
|
```
|
|
274
310
|
|
|
275
311
|
`issue view` 和 `pr view` 的文本详情展示也会保持稳定布局,而 `--json` 仍然是面向机器调用的首选入口。
|
|
@@ -280,31 +316,58 @@ gc api repos/owner/repo
|
|
|
280
316
|
|
|
281
317
|
```bash
|
|
282
318
|
# 查看仓库
|
|
283
|
-
|
|
319
|
+
gitcode repo view
|
|
284
320
|
|
|
285
321
|
# 查看文件提交历史
|
|
286
|
-
|
|
322
|
+
gitcode repo log -R owner/repo --file README.md --branch main
|
|
287
323
|
|
|
288
324
|
# 创建 Issue
|
|
289
|
-
|
|
325
|
+
gitcode issue create --title "Bug report" --body "Description"
|
|
290
326
|
|
|
291
327
|
# 列出 Issues
|
|
292
|
-
|
|
328
|
+
gitcode issue list --state open
|
|
293
329
|
|
|
294
330
|
# 创建 PR
|
|
295
|
-
|
|
331
|
+
gitcode pr create --title "New feature" --base main
|
|
296
332
|
|
|
297
333
|
# 按提交信息反查 PR
|
|
298
|
-
|
|
334
|
+
gitcode pr list -R owner/repo --commit-message "fix login"
|
|
299
335
|
|
|
300
336
|
# 提交前检查 pre-commit 配置与本地环境
|
|
301
|
-
|
|
337
|
+
gitcode precommit check
|
|
338
|
+
|
|
339
|
+
# 查看流水线运行记录
|
|
340
|
+
gitcode actions run list -R owner/repo --status FAILED
|
|
341
|
+
|
|
342
|
+
# 查看流水线运行详情
|
|
343
|
+
gitcode actions run view <run-id> -R owner/repo
|
|
344
|
+
|
|
345
|
+
# 列出流水线运行的 jobs
|
|
346
|
+
gitcode actions job list <run-id> -R owner/repo
|
|
347
|
+
|
|
348
|
+
# 查看工作流 job 详情
|
|
349
|
+
gitcode actions job view <run-id> <job-id> -R owner/repo
|
|
350
|
+
|
|
351
|
+
# 下载 job 日志归档
|
|
352
|
+
gitcode actions job log <run-id> <job-id> -R owner/repo --output job-log.zip
|
|
353
|
+
|
|
354
|
+
# 列出仓库 artifacts
|
|
355
|
+
gitcode actions artifact list -R owner/repo
|
|
356
|
+
|
|
357
|
+
# 查看 artifact 详情
|
|
358
|
+
gitcode actions artifact view <artifact-id> -R owner/repo
|
|
359
|
+
|
|
360
|
+
# 下载 artifact
|
|
361
|
+
gitcode actions artifact download <artifact-id> -R owner/repo --output artifact.zip
|
|
362
|
+
|
|
363
|
+
# 删除 artifact
|
|
364
|
+
gitcode actions artifact delete <artifact-id> -R owner/repo --yes
|
|
302
365
|
|
|
303
366
|
# 调用 GitCode API 原始响应
|
|
304
|
-
|
|
367
|
+
gitcode api repos/owner/repo
|
|
305
368
|
|
|
306
369
|
# 查看认证状态
|
|
307
|
-
|
|
370
|
+
gitcode auth status
|
|
308
371
|
```
|
|
309
372
|
|
|
310
373
|
完整命令说明、参数细节、平台限制和更多示例,请直接查看:
|
|
@@ -343,7 +406,7 @@ source ~/.config/fish/config.fish
|
|
|
343
406
|
|
|
344
407
|
补充说明:
|
|
345
408
|
|
|
346
|
-
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gc
|
|
409
|
+
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gitcode`(或源码构建的 `gc`)
|
|
347
410
|
- gitcode-cli 仓库内部 AI 开发请看 `AGENTS.md`、`CLAUDE.md` 和 `spec/workflows/ai-local-development-workflow.md`
|
|
348
411
|
- `issues-plan/PROGRESS.md` 只作为阶段说明,不作为单个 issue / PR 的实时事实依据
|
|
349
412
|
|
|
@@ -385,5 +448,5 @@ make run
|
|
|
385
448
|
## 相关链接
|
|
386
449
|
|
|
387
450
|
- [GitCode](https://gitcode.com) - GitCode 平台
|
|
388
|
-
- [API 文档](https://gitcode.com/docs/
|
|
451
|
+
- [API 文档](https://docs.gitcode.com/docs/apis/) - GitCode API 参考
|
|
389
452
|
- [问题反馈](https://gitcode.com/gitcode-cli/cli/issues) - 提交 Bug 或建议
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://golang.org)
|
|
6
6
|
[](LICENSE)
|
|
7
|
-
[](https://gitcode.com/gitcode-cli/cli/releases)
|
|
8
8
|
|
|
9
|
-
GitCode
|
|
9
|
+
GitCode CLI 把仓库、Issue、PR、Release 和 Actions 带回终端,让开发者减少页面切换,也让脚本与 AI 获得结构化、可审计、带安全边界的 GitCode 执行入口。
|
|
10
|
+
|
|
11
|
+
[快速了解核心价值与应用场景,并在五分钟内开始使用](./docs/INTRODUCTION.md)。
|
|
10
12
|
|
|
11
13
|
## 文档导航
|
|
12
14
|
|
|
@@ -21,6 +23,7 @@ GitCode 命令行工具,为 GitCode 用户提供便捷的命令行操作体验
|
|
|
21
23
|
|
|
22
24
|
主要文档:
|
|
23
25
|
|
|
26
|
+
- [产品介绍与快速上手](./docs/INTRODUCTION.md)
|
|
24
27
|
- [命令手册](./docs/COMMANDS.md)
|
|
25
28
|
- [认证说明](./docs/AUTH.md)
|
|
26
29
|
- [回归说明](./docs/REGRESSION.md)
|
|
@@ -70,10 +73,10 @@ export PATH="$HOME/.local/bin:$PATH"
|
|
|
70
73
|
|
|
71
74
|
```bash
|
|
72
75
|
# 从 Releases 下载 .deb 包
|
|
73
|
-
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
76
|
+
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gc_0.9.1_amd64.deb
|
|
74
77
|
|
|
75
78
|
# 安装
|
|
76
|
-
sudo dpkg -i gc_0.
|
|
79
|
+
sudo dpkg -i gc_0.9.1_amd64.deb
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -82,10 +85,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
82
85
|
|
|
83
86
|
```bash
|
|
84
87
|
# 从 Releases 下载 .rpm 包
|
|
85
|
-
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
88
|
+
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gc-0.9.1-1.x86_64.rpm
|
|
86
89
|
|
|
87
90
|
# 安装
|
|
88
|
-
sudo rpm -i gc-0.
|
|
91
|
+
sudo rpm -i gc-0.9.1-1.x86_64.rpm
|
|
89
92
|
```
|
|
90
93
|
|
|
91
94
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -98,10 +101,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
98
101
|
# 创建虚拟环境
|
|
99
102
|
python3 -m venv .venv
|
|
100
103
|
source .venv/bin/activate # Linux/macOS
|
|
101
|
-
#
|
|
104
|
+
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
102
105
|
|
|
103
106
|
# 安装(一行命令)
|
|
104
|
-
pip install https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
107
|
+
pip install https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gitcode_cli-0.9.1-py3-none-any.whl
|
|
105
108
|
|
|
106
109
|
# Windows PowerShell 中推荐使用 gitcode,避免 gc 被内置 Get-Content 别名覆盖
|
|
107
110
|
gitcode version
|
|
@@ -110,7 +113,8 @@ gitcode version
|
|
|
110
113
|
说明:
|
|
111
114
|
- wheel 会同时安装 `gc` 和 `gitcode` 两个命令入口,功能相同。
|
|
112
115
|
- DEB/RPM 包也会同时安装 `gc` 和 `gitcode`;Linux 上二者功能相同。
|
|
113
|
-
- Windows
|
|
116
|
+
- Windows 使用 `py -m pip install --user ...` 时,脚本会安装到 Python user scheme 的 `Scripts` 目录。请运行 `py -c "import os, sysconfig; print(sysconfig.get_path('scripts', os.name + '_user'))"` 获取准确路径,将其加入用户 `PATH` 后重新打开终端;配置前可直接运行 `py -m gc_cli version`。
|
|
117
|
+
- Windows PowerShell 预置 `gc` 作为 `Get-Content` 别名;如果 `gc version` 被解析为读取文件,请改用 `gitcode version`、`gc.exe version` 或 `py -m gc_cli version`。
|
|
114
118
|
- Windows PowerShell 中通过 `--body-file -` / `--comment-file -` 管道传入中文或其他非 ASCII 正文时,推荐使用 UTF-8 文件;如果必须直接管道,先设置 `$OutputEncoding = [System.Text.UTF8Encoding]::new($false)`。CLI 会拦截疑似已被 PowerShell 损坏成 `???` 的输入并提示正确用法。
|
|
115
119
|
|
|
116
120
|
```powershell
|
|
@@ -120,14 +124,16 @@ gitcode issue create -R owner/repo --title "标题" --body-file body.md
|
|
|
120
124
|
|
|
121
125
|
### PyPI(备选)
|
|
122
126
|
|
|
127
|
+
> PyPI 可能晚于 GitCode Release 同步。固定目标版本可避免静默安装旧版本;目标版本暂不可用时,请使用上方 Release wheel。
|
|
128
|
+
|
|
123
129
|
```bash
|
|
124
130
|
# 创建虚拟环境
|
|
125
131
|
python3 -m venv .venv
|
|
126
132
|
source .venv/bin/activate # Linux/macOS
|
|
127
|
-
#
|
|
133
|
+
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
128
134
|
|
|
129
|
-
#
|
|
130
|
-
pip install gitcode-cli
|
|
135
|
+
# 固定版本安装,避免 PyPI 尚未同步时安装旧版本
|
|
136
|
+
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.9.1
|
|
131
137
|
|
|
132
138
|
# Windows PowerShell 中推荐使用 gitcode
|
|
133
139
|
gitcode version
|
|
@@ -154,42 +160,72 @@ gc version
|
|
|
154
160
|
|
|
155
161
|
Windows 和 macOS 用户建议使用上方 wheel 包;wheel 内置 Linux、macOS 和 Windows 二进制,并同时提供 `gc` 与 `gitcode` 两个命令入口。
|
|
156
162
|
|
|
163
|
+
### Docker 镜像
|
|
164
|
+
|
|
165
|
+
仓库已提供 `Dockerfile`、`docker-compose.yml` 和 Makefile 目标:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# 构建并运行
|
|
169
|
+
make docker-build
|
|
170
|
+
make docker-run
|
|
171
|
+
|
|
172
|
+
# 或使用 docker compose
|
|
173
|
+
docker compose up gc
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
认证 Token 通过环境变量传入。请在交互终端中静默读取,避免 Token 值进入 shell history:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
read -rsp "GitCode token: " GC_TOKEN
|
|
180
|
+
export GC_TOKEN
|
|
181
|
+
make docker-run
|
|
182
|
+
unset GC_TOKEN
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
更多用法参见 Makefile 和 `docker-compose.yml`。
|
|
186
|
+
|
|
187
|
+
### Homebrew (macOS/Linux)
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
brew install gitcode-cli/homebrew-tap/gc
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
更新到最新版本:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
brew upgrade gc
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
shell 补全(bash/zsh/fish)随安装自动配置,无需额外操作。
|
|
200
|
+
|
|
157
201
|
### 规划中的安装方式
|
|
158
202
|
|
|
159
203
|
以下安装方式正在开发中:
|
|
160
204
|
|
|
161
|
-
- [ ] Homebrew (macOS/Linux)
|
|
162
205
|
- [ ] Scoop (Windows)
|
|
163
|
-
- [ ] Docker 镜像
|
|
164
206
|
|
|
165
207
|
## 快速开始
|
|
166
208
|
|
|
167
209
|
### 认证
|
|
168
210
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
# 设置 Token 环境变量
|
|
173
|
-
export GC_TOKEN="your_gitcode_token"
|
|
211
|
+
以下示例使用安装包提供的 `gitcode` 入口;从源码构建或使用独立二进制时,请将命令名改为 `gc`。
|
|
174
212
|
|
|
175
|
-
|
|
176
|
-
export GITCODE_TOKEN="your_gitcode_token"
|
|
213
|
+
**方式一:打开令牌页面并登录**
|
|
177
214
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
source ~/.bashrc
|
|
215
|
+
```bash
|
|
216
|
+
gitcode auth login --web
|
|
181
217
|
```
|
|
182
218
|
|
|
183
|
-
|
|
219
|
+
当前 `--web` 会打开 GitCode 的新建访问令牌页面,生成令牌后仍需回到终端粘贴。当前版本不会隐藏输入,因此必须由用户本人在私有、未录制且不由 AI 控制的本地终端中执行。
|
|
184
220
|
|
|
185
|
-
|
|
186
|
-
# 交互式登录(需输入 Token)
|
|
187
|
-
gc auth login
|
|
221
|
+
**方式二:交互式 Token 登录**
|
|
188
222
|
|
|
189
|
-
|
|
190
|
-
|
|
223
|
+
```bash
|
|
224
|
+
gitcode auth login
|
|
191
225
|
```
|
|
192
226
|
|
|
227
|
+
浏览器不可用时,可在同样受控的本地交互终端中输入 Token。不要把 Token 值直接写进命令、shell history 或配置脚本。CI 场景应通过平台 Secret 注入 `GC_TOKEN` 或 `GITCODE_TOKEN`。
|
|
228
|
+
|
|
193
229
|
当前版本认证优先级:
|
|
194
230
|
|
|
195
231
|
1. `GC_TOKEN`
|
|
@@ -204,43 +240,43 @@ echo "YOUR_TOKEN" | gc auth login --with-token
|
|
|
204
240
|
|
|
205
241
|
**获取 Token:**
|
|
206
242
|
1. 登录 [GitCode](https://gitcode.com)
|
|
207
|
-
2. 进入
|
|
208
|
-
3.
|
|
243
|
+
2. 进入 个人设置 -> 访问令牌
|
|
244
|
+
3. 点击“新建访问令牌”,选择所需权限
|
|
209
245
|
4. 复制生成的 Token
|
|
210
246
|
|
|
211
247
|
**验证认证:**
|
|
212
248
|
|
|
213
249
|
```bash
|
|
214
250
|
# 查看认证状态
|
|
215
|
-
|
|
251
|
+
gitcode auth status
|
|
216
252
|
```
|
|
217
253
|
|
|
218
254
|
> 详细命令行为和完整示例请查看 [docs/COMMANDS.md](./docs/COMMANDS.md)。
|
|
219
255
|
|
|
220
256
|
## 输出格式
|
|
221
257
|
|
|
222
|
-
`
|
|
258
|
+
`gitcode` 的只读命令继续以文本输出为默认体验,同时为脚本和代理保留稳定的结构化入口。
|
|
223
259
|
|
|
224
260
|
```bash
|
|
225
261
|
# 结构化输出
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
262
|
+
gitcode issue list -R owner/repo --json
|
|
263
|
+
gitcode issue list -R owner/repo --format json
|
|
264
|
+
gitcode repo log -R owner/repo --file README.md --branch main --json
|
|
265
|
+
gitcode pr list -R owner/repo --paginate --per-page 100 --json
|
|
230
266
|
|
|
231
267
|
# 常规文本与表格
|
|
232
|
-
|
|
233
|
-
|
|
268
|
+
gitcode issue list -R owner/repo --format simple
|
|
269
|
+
gitcode issue list -R owner/repo --format table
|
|
234
270
|
|
|
235
271
|
# 时间格式切换
|
|
236
|
-
|
|
237
|
-
|
|
272
|
+
gitcode issue list -R owner/repo --time-format absolute
|
|
273
|
+
gitcode issue list -R owner/repo --time-format relative
|
|
238
274
|
|
|
239
275
|
# 自定义模板输出
|
|
240
|
-
|
|
276
|
+
gitcode issue list -R owner/repo --template '{{range .}}#{{.Number}} {{.Title}}{{"\n"}}{{end}}'
|
|
241
277
|
|
|
242
|
-
# typed command 尚未覆盖的 API,可用
|
|
243
|
-
|
|
278
|
+
# typed command 尚未覆盖的 API,可用 gitcode api 读取原始响应
|
|
279
|
+
gitcode api repos/owner/repo
|
|
244
280
|
```
|
|
245
281
|
|
|
246
282
|
`issue view` 和 `pr view` 的文本详情展示也会保持稳定布局,而 `--json` 仍然是面向机器调用的首选入口。
|
|
@@ -251,31 +287,58 @@ gc api repos/owner/repo
|
|
|
251
287
|
|
|
252
288
|
```bash
|
|
253
289
|
# 查看仓库
|
|
254
|
-
|
|
290
|
+
gitcode repo view
|
|
255
291
|
|
|
256
292
|
# 查看文件提交历史
|
|
257
|
-
|
|
293
|
+
gitcode repo log -R owner/repo --file README.md --branch main
|
|
258
294
|
|
|
259
295
|
# 创建 Issue
|
|
260
|
-
|
|
296
|
+
gitcode issue create --title "Bug report" --body "Description"
|
|
261
297
|
|
|
262
298
|
# 列出 Issues
|
|
263
|
-
|
|
299
|
+
gitcode issue list --state open
|
|
264
300
|
|
|
265
301
|
# 创建 PR
|
|
266
|
-
|
|
302
|
+
gitcode pr create --title "New feature" --base main
|
|
267
303
|
|
|
268
304
|
# 按提交信息反查 PR
|
|
269
|
-
|
|
305
|
+
gitcode pr list -R owner/repo --commit-message "fix login"
|
|
270
306
|
|
|
271
307
|
# 提交前检查 pre-commit 配置与本地环境
|
|
272
|
-
|
|
308
|
+
gitcode precommit check
|
|
309
|
+
|
|
310
|
+
# 查看流水线运行记录
|
|
311
|
+
gitcode actions run list -R owner/repo --status FAILED
|
|
312
|
+
|
|
313
|
+
# 查看流水线运行详情
|
|
314
|
+
gitcode actions run view <run-id> -R owner/repo
|
|
315
|
+
|
|
316
|
+
# 列出流水线运行的 jobs
|
|
317
|
+
gitcode actions job list <run-id> -R owner/repo
|
|
318
|
+
|
|
319
|
+
# 查看工作流 job 详情
|
|
320
|
+
gitcode actions job view <run-id> <job-id> -R owner/repo
|
|
321
|
+
|
|
322
|
+
# 下载 job 日志归档
|
|
323
|
+
gitcode actions job log <run-id> <job-id> -R owner/repo --output job-log.zip
|
|
324
|
+
|
|
325
|
+
# 列出仓库 artifacts
|
|
326
|
+
gitcode actions artifact list -R owner/repo
|
|
327
|
+
|
|
328
|
+
# 查看 artifact 详情
|
|
329
|
+
gitcode actions artifact view <artifact-id> -R owner/repo
|
|
330
|
+
|
|
331
|
+
# 下载 artifact
|
|
332
|
+
gitcode actions artifact download <artifact-id> -R owner/repo --output artifact.zip
|
|
333
|
+
|
|
334
|
+
# 删除 artifact
|
|
335
|
+
gitcode actions artifact delete <artifact-id> -R owner/repo --yes
|
|
273
336
|
|
|
274
337
|
# 调用 GitCode API 原始响应
|
|
275
|
-
|
|
338
|
+
gitcode api repos/owner/repo
|
|
276
339
|
|
|
277
340
|
# 查看认证状态
|
|
278
|
-
|
|
341
|
+
gitcode auth status
|
|
279
342
|
```
|
|
280
343
|
|
|
281
344
|
完整命令说明、参数细节、平台限制和更多示例,请直接查看:
|
|
@@ -314,7 +377,7 @@ source ~/.config/fish/config.fish
|
|
|
314
377
|
|
|
315
378
|
补充说明:
|
|
316
379
|
|
|
317
|
-
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gc
|
|
380
|
+
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gitcode`(或源码构建的 `gc`)
|
|
318
381
|
- gitcode-cli 仓库内部 AI 开发请看 `AGENTS.md`、`CLAUDE.md` 和 `spec/workflows/ai-local-development-workflow.md`
|
|
319
382
|
- `issues-plan/PROGRESS.md` 只作为阶段说明,不作为单个 issue / PR 的实时事实依据
|
|
320
383
|
|
|
@@ -356,5 +419,5 @@ make run
|
|
|
356
419
|
## 相关链接
|
|
357
420
|
|
|
358
421
|
- [GitCode](https://gitcode.com) - GitCode 平台
|
|
359
|
-
- [API 文档](https://gitcode.com/docs/
|
|
422
|
+
- [API 文档](https://docs.gitcode.com/docs/apis/) - GitCode API 参考
|
|
360
423
|
- [问题反馈](https://gitcode.com/gitcode-cli/cli/issues) - 提交 Bug 或建议
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: GitCode CLI - Command line tool for GitCode
|
|
5
5
|
Author-email: GitCode CLI Contributors <support@gitcode.com>
|
|
6
6
|
Maintainer-email: GitCode CLI Contributors <support@gitcode.com>
|
|
@@ -33,9 +33,11 @@ Dynamic: license-file
|
|
|
33
33
|
|
|
34
34
|
[](https://golang.org)
|
|
35
35
|
[](LICENSE)
|
|
36
|
-
[](https://gitcode.com/gitcode-cli/cli/releases)
|
|
37
37
|
|
|
38
|
-
GitCode
|
|
38
|
+
GitCode CLI 把仓库、Issue、PR、Release 和 Actions 带回终端,让开发者减少页面切换,也让脚本与 AI 获得结构化、可审计、带安全边界的 GitCode 执行入口。
|
|
39
|
+
|
|
40
|
+
[快速了解核心价值与应用场景,并在五分钟内开始使用](./docs/INTRODUCTION.md)。
|
|
39
41
|
|
|
40
42
|
## 文档导航
|
|
41
43
|
|
|
@@ -50,6 +52,7 @@ GitCode 命令行工具,为 GitCode 用户提供便捷的命令行操作体验
|
|
|
50
52
|
|
|
51
53
|
主要文档:
|
|
52
54
|
|
|
55
|
+
- [产品介绍与快速上手](./docs/INTRODUCTION.md)
|
|
53
56
|
- [命令手册](./docs/COMMANDS.md)
|
|
54
57
|
- [认证说明](./docs/AUTH.md)
|
|
55
58
|
- [回归说明](./docs/REGRESSION.md)
|
|
@@ -99,10 +102,10 @@ export PATH="$HOME/.local/bin:$PATH"
|
|
|
99
102
|
|
|
100
103
|
```bash
|
|
101
104
|
# 从 Releases 下载 .deb 包
|
|
102
|
-
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
105
|
+
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gc_0.9.1_amd64.deb
|
|
103
106
|
|
|
104
107
|
# 安装
|
|
105
|
-
sudo dpkg -i gc_0.
|
|
108
|
+
sudo dpkg -i gc_0.9.1_amd64.deb
|
|
106
109
|
```
|
|
107
110
|
|
|
108
111
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -111,10 +114,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
111
114
|
|
|
112
115
|
```bash
|
|
113
116
|
# 从 Releases 下载 .rpm 包
|
|
114
|
-
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
117
|
+
wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gc-0.9.1-1.x86_64.rpm
|
|
115
118
|
|
|
116
119
|
# 安装
|
|
117
|
-
sudo rpm -i gc-0.
|
|
120
|
+
sudo rpm -i gc-0.9.1-1.x86_64.rpm
|
|
118
121
|
```
|
|
119
122
|
|
|
120
123
|
DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
@@ -127,10 +130,10 @@ DEB/RPM packages install both `gc` and `gitcode`; on Linux they are equivalent.
|
|
|
127
130
|
# 创建虚拟环境
|
|
128
131
|
python3 -m venv .venv
|
|
129
132
|
source .venv/bin/activate # Linux/macOS
|
|
130
|
-
#
|
|
133
|
+
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
131
134
|
|
|
132
135
|
# 安装(一行命令)
|
|
133
|
-
pip install https://gitcode.com/gitcode-cli/cli/releases/download/v0.
|
|
136
|
+
pip install https://gitcode.com/gitcode-cli/cli/releases/download/v0.9.1/gitcode_cli-0.9.1-py3-none-any.whl
|
|
134
137
|
|
|
135
138
|
# Windows PowerShell 中推荐使用 gitcode,避免 gc 被内置 Get-Content 别名覆盖
|
|
136
139
|
gitcode version
|
|
@@ -139,7 +142,8 @@ gitcode version
|
|
|
139
142
|
说明:
|
|
140
143
|
- wheel 会同时安装 `gc` 和 `gitcode` 两个命令入口,功能相同。
|
|
141
144
|
- DEB/RPM 包也会同时安装 `gc` 和 `gitcode`;Linux 上二者功能相同。
|
|
142
|
-
- Windows
|
|
145
|
+
- Windows 使用 `py -m pip install --user ...` 时,脚本会安装到 Python user scheme 的 `Scripts` 目录。请运行 `py -c "import os, sysconfig; print(sysconfig.get_path('scripts', os.name + '_user'))"` 获取准确路径,将其加入用户 `PATH` 后重新打开终端;配置前可直接运行 `py -m gc_cli version`。
|
|
146
|
+
- Windows PowerShell 预置 `gc` 作为 `Get-Content` 别名;如果 `gc version` 被解析为读取文件,请改用 `gitcode version`、`gc.exe version` 或 `py -m gc_cli version`。
|
|
143
147
|
- Windows PowerShell 中通过 `--body-file -` / `--comment-file -` 管道传入中文或其他非 ASCII 正文时,推荐使用 UTF-8 文件;如果必须直接管道,先设置 `$OutputEncoding = [System.Text.UTF8Encoding]::new($false)`。CLI 会拦截疑似已被 PowerShell 损坏成 `???` 的输入并提示正确用法。
|
|
144
148
|
|
|
145
149
|
```powershell
|
|
@@ -149,14 +153,16 @@ gitcode issue create -R owner/repo --title "标题" --body-file body.md
|
|
|
149
153
|
|
|
150
154
|
### PyPI(备选)
|
|
151
155
|
|
|
156
|
+
> PyPI 可能晚于 GitCode Release 同步。固定目标版本可避免静默安装旧版本;目标版本暂不可用时,请使用上方 Release wheel。
|
|
157
|
+
|
|
152
158
|
```bash
|
|
153
159
|
# 创建虚拟环境
|
|
154
160
|
python3 -m venv .venv
|
|
155
161
|
source .venv/bin/activate # Linux/macOS
|
|
156
|
-
#
|
|
162
|
+
# .\.venv\Scripts\Activate.ps1 # Windows PowerShell
|
|
157
163
|
|
|
158
|
-
#
|
|
159
|
-
pip install gitcode-cli
|
|
164
|
+
# 固定版本安装,避免 PyPI 尚未同步时安装旧版本
|
|
165
|
+
python -m pip install -i https://pypi.org/simple/ gitcode-cli==0.9.1
|
|
160
166
|
|
|
161
167
|
# Windows PowerShell 中推荐使用 gitcode
|
|
162
168
|
gitcode version
|
|
@@ -183,42 +189,72 @@ gc version
|
|
|
183
189
|
|
|
184
190
|
Windows 和 macOS 用户建议使用上方 wheel 包;wheel 内置 Linux、macOS 和 Windows 二进制,并同时提供 `gc` 与 `gitcode` 两个命令入口。
|
|
185
191
|
|
|
192
|
+
### Docker 镜像
|
|
193
|
+
|
|
194
|
+
仓库已提供 `Dockerfile`、`docker-compose.yml` 和 Makefile 目标:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# 构建并运行
|
|
198
|
+
make docker-build
|
|
199
|
+
make docker-run
|
|
200
|
+
|
|
201
|
+
# 或使用 docker compose
|
|
202
|
+
docker compose up gc
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
认证 Token 通过环境变量传入。请在交互终端中静默读取,避免 Token 值进入 shell history:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
read -rsp "GitCode token: " GC_TOKEN
|
|
209
|
+
export GC_TOKEN
|
|
210
|
+
make docker-run
|
|
211
|
+
unset GC_TOKEN
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
更多用法参见 Makefile 和 `docker-compose.yml`。
|
|
215
|
+
|
|
216
|
+
### Homebrew (macOS/Linux)
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
brew install gitcode-cli/homebrew-tap/gc
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
更新到最新版本:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
brew upgrade gc
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
shell 补全(bash/zsh/fish)随安装自动配置,无需额外操作。
|
|
229
|
+
|
|
186
230
|
### 规划中的安装方式
|
|
187
231
|
|
|
188
232
|
以下安装方式正在开发中:
|
|
189
233
|
|
|
190
|
-
- [ ] Homebrew (macOS/Linux)
|
|
191
234
|
- [ ] Scoop (Windows)
|
|
192
|
-
- [ ] Docker 镜像
|
|
193
235
|
|
|
194
236
|
## 快速开始
|
|
195
237
|
|
|
196
238
|
### 认证
|
|
197
239
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# 设置 Token 环境变量
|
|
202
|
-
export GC_TOKEN="your_gitcode_token"
|
|
240
|
+
以下示例使用安装包提供的 `gitcode` 入口;从源码构建或使用独立二进制时,请将命令名改为 `gc`。
|
|
203
241
|
|
|
204
|
-
|
|
205
|
-
export GITCODE_TOKEN="your_gitcode_token"
|
|
242
|
+
**方式一:打开令牌页面并登录**
|
|
206
243
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
source ~/.bashrc
|
|
244
|
+
```bash
|
|
245
|
+
gitcode auth login --web
|
|
210
246
|
```
|
|
211
247
|
|
|
212
|
-
|
|
248
|
+
当前 `--web` 会打开 GitCode 的新建访问令牌页面,生成令牌后仍需回到终端粘贴。当前版本不会隐藏输入,因此必须由用户本人在私有、未录制且不由 AI 控制的本地终端中执行。
|
|
213
249
|
|
|
214
|
-
|
|
215
|
-
# 交互式登录(需输入 Token)
|
|
216
|
-
gc auth login
|
|
250
|
+
**方式二:交互式 Token 登录**
|
|
217
251
|
|
|
218
|
-
|
|
219
|
-
|
|
252
|
+
```bash
|
|
253
|
+
gitcode auth login
|
|
220
254
|
```
|
|
221
255
|
|
|
256
|
+
浏览器不可用时,可在同样受控的本地交互终端中输入 Token。不要把 Token 值直接写进命令、shell history 或配置脚本。CI 场景应通过平台 Secret 注入 `GC_TOKEN` 或 `GITCODE_TOKEN`。
|
|
257
|
+
|
|
222
258
|
当前版本认证优先级:
|
|
223
259
|
|
|
224
260
|
1. `GC_TOKEN`
|
|
@@ -233,43 +269,43 @@ echo "YOUR_TOKEN" | gc auth login --with-token
|
|
|
233
269
|
|
|
234
270
|
**获取 Token:**
|
|
235
271
|
1. 登录 [GitCode](https://gitcode.com)
|
|
236
|
-
2. 进入
|
|
237
|
-
3.
|
|
272
|
+
2. 进入 个人设置 -> 访问令牌
|
|
273
|
+
3. 点击“新建访问令牌”,选择所需权限
|
|
238
274
|
4. 复制生成的 Token
|
|
239
275
|
|
|
240
276
|
**验证认证:**
|
|
241
277
|
|
|
242
278
|
```bash
|
|
243
279
|
# 查看认证状态
|
|
244
|
-
|
|
280
|
+
gitcode auth status
|
|
245
281
|
```
|
|
246
282
|
|
|
247
283
|
> 详细命令行为和完整示例请查看 [docs/COMMANDS.md](./docs/COMMANDS.md)。
|
|
248
284
|
|
|
249
285
|
## 输出格式
|
|
250
286
|
|
|
251
|
-
`
|
|
287
|
+
`gitcode` 的只读命令继续以文本输出为默认体验,同时为脚本和代理保留稳定的结构化入口。
|
|
252
288
|
|
|
253
289
|
```bash
|
|
254
290
|
# 结构化输出
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
291
|
+
gitcode issue list -R owner/repo --json
|
|
292
|
+
gitcode issue list -R owner/repo --format json
|
|
293
|
+
gitcode repo log -R owner/repo --file README.md --branch main --json
|
|
294
|
+
gitcode pr list -R owner/repo --paginate --per-page 100 --json
|
|
259
295
|
|
|
260
296
|
# 常规文本与表格
|
|
261
|
-
|
|
262
|
-
|
|
297
|
+
gitcode issue list -R owner/repo --format simple
|
|
298
|
+
gitcode issue list -R owner/repo --format table
|
|
263
299
|
|
|
264
300
|
# 时间格式切换
|
|
265
|
-
|
|
266
|
-
|
|
301
|
+
gitcode issue list -R owner/repo --time-format absolute
|
|
302
|
+
gitcode issue list -R owner/repo --time-format relative
|
|
267
303
|
|
|
268
304
|
# 自定义模板输出
|
|
269
|
-
|
|
305
|
+
gitcode issue list -R owner/repo --template '{{range .}}#{{.Number}} {{.Title}}{{"\n"}}{{end}}'
|
|
270
306
|
|
|
271
|
-
# typed command 尚未覆盖的 API,可用
|
|
272
|
-
|
|
307
|
+
# typed command 尚未覆盖的 API,可用 gitcode api 读取原始响应
|
|
308
|
+
gitcode api repos/owner/repo
|
|
273
309
|
```
|
|
274
310
|
|
|
275
311
|
`issue view` 和 `pr view` 的文本详情展示也会保持稳定布局,而 `--json` 仍然是面向机器调用的首选入口。
|
|
@@ -280,31 +316,58 @@ gc api repos/owner/repo
|
|
|
280
316
|
|
|
281
317
|
```bash
|
|
282
318
|
# 查看仓库
|
|
283
|
-
|
|
319
|
+
gitcode repo view
|
|
284
320
|
|
|
285
321
|
# 查看文件提交历史
|
|
286
|
-
|
|
322
|
+
gitcode repo log -R owner/repo --file README.md --branch main
|
|
287
323
|
|
|
288
324
|
# 创建 Issue
|
|
289
|
-
|
|
325
|
+
gitcode issue create --title "Bug report" --body "Description"
|
|
290
326
|
|
|
291
327
|
# 列出 Issues
|
|
292
|
-
|
|
328
|
+
gitcode issue list --state open
|
|
293
329
|
|
|
294
330
|
# 创建 PR
|
|
295
|
-
|
|
331
|
+
gitcode pr create --title "New feature" --base main
|
|
296
332
|
|
|
297
333
|
# 按提交信息反查 PR
|
|
298
|
-
|
|
334
|
+
gitcode pr list -R owner/repo --commit-message "fix login"
|
|
299
335
|
|
|
300
336
|
# 提交前检查 pre-commit 配置与本地环境
|
|
301
|
-
|
|
337
|
+
gitcode precommit check
|
|
338
|
+
|
|
339
|
+
# 查看流水线运行记录
|
|
340
|
+
gitcode actions run list -R owner/repo --status FAILED
|
|
341
|
+
|
|
342
|
+
# 查看流水线运行详情
|
|
343
|
+
gitcode actions run view <run-id> -R owner/repo
|
|
344
|
+
|
|
345
|
+
# 列出流水线运行的 jobs
|
|
346
|
+
gitcode actions job list <run-id> -R owner/repo
|
|
347
|
+
|
|
348
|
+
# 查看工作流 job 详情
|
|
349
|
+
gitcode actions job view <run-id> <job-id> -R owner/repo
|
|
350
|
+
|
|
351
|
+
# 下载 job 日志归档
|
|
352
|
+
gitcode actions job log <run-id> <job-id> -R owner/repo --output job-log.zip
|
|
353
|
+
|
|
354
|
+
# 列出仓库 artifacts
|
|
355
|
+
gitcode actions artifact list -R owner/repo
|
|
356
|
+
|
|
357
|
+
# 查看 artifact 详情
|
|
358
|
+
gitcode actions artifact view <artifact-id> -R owner/repo
|
|
359
|
+
|
|
360
|
+
# 下载 artifact
|
|
361
|
+
gitcode actions artifact download <artifact-id> -R owner/repo --output artifact.zip
|
|
362
|
+
|
|
363
|
+
# 删除 artifact
|
|
364
|
+
gitcode actions artifact delete <artifact-id> -R owner/repo --yes
|
|
302
365
|
|
|
303
366
|
# 调用 GitCode API 原始响应
|
|
304
|
-
|
|
367
|
+
gitcode api repos/owner/repo
|
|
305
368
|
|
|
306
369
|
# 查看认证状态
|
|
307
|
-
|
|
370
|
+
gitcode auth status
|
|
308
371
|
```
|
|
309
372
|
|
|
310
373
|
完整命令说明、参数细节、平台限制和更多示例,请直接查看:
|
|
@@ -343,7 +406,7 @@ source ~/.config/fish/config.fish
|
|
|
343
406
|
|
|
344
407
|
补充说明:
|
|
345
408
|
|
|
346
|
-
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gc
|
|
409
|
+
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gitcode`(或源码构建的 `gc`)
|
|
347
410
|
- gitcode-cli 仓库内部 AI 开发请看 `AGENTS.md`、`CLAUDE.md` 和 `spec/workflows/ai-local-development-workflow.md`
|
|
348
411
|
- `issues-plan/PROGRESS.md` 只作为阶段说明,不作为单个 issue / PR 的实时事实依据
|
|
349
412
|
|
|
@@ -385,5 +448,5 @@ make run
|
|
|
385
448
|
## 相关链接
|
|
386
449
|
|
|
387
450
|
- [GitCode](https://gitcode.com) - GitCode 平台
|
|
388
|
-
- [API 文档](https://gitcode.com/docs/
|
|
451
|
+
- [API 文档](https://docs.gitcode.com/docs/apis/) - GitCode API 参考
|
|
389
452
|
- [问题反馈](https://gitcode.com/gitcode-cli/cli/issues) - 提交 Bug 或建议
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools
|
|
2
|
+
requires = ["setuptools==80.9.0", "wheel==0.45.1"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "gitcode-cli"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.9.1"
|
|
8
8
|
description = "GitCode CLI - Command line tool for GitCode"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|