gitcode-cli 0.6.1__tar.gz → 0.9.0__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.0}/LICENSE +1 -1
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/MANIFEST.in +1 -1
- {gitcode_cli-0.6.1/gitcode_cli.egg-info → gitcode_cli-0.9.0}/PKG-INFO +106 -56
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/README.md +105 -55
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/__init__.py +1 -1
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/bin/gc-darwin-amd64 +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/bin/gc-darwin-arm64 +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/bin/gc-linux-amd64 +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/bin/gc-linux-arm64 +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/bin/gc-windows-amd64.exe +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0/gitcode_cli.egg-info}/PKG-INFO +106 -56
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/pyproject.toml +2 -2
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/__main__.py +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/bin/.gitkeep +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gc_cli/wrapper.py +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gitcode_cli.egg-info/SOURCES.txt +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gitcode_cli.egg-info/dependency_links.txt +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gitcode_cli.egg-info/entry_points.txt +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/gitcode_cli.egg-info/top_level.txt +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/setup.cfg +0 -0
- {gitcode_cli-0.6.1 → gitcode_cli-0.9.0}/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.0
|
|
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.0/gc_0.9.0_amd64.deb
|
|
103
106
|
|
|
104
107
|
# 安装
|
|
105
|
-
sudo dpkg -i gc_0.
|
|
108
|
+
sudo dpkg -i gc_0.9.0_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.0/gc-0.9.0-1.x86_64.rpm
|
|
115
118
|
|
|
116
119
|
# 安装
|
|
117
|
-
sudo rpm -i gc-0.
|
|
120
|
+
sudo rpm -i gc-0.9.0-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.0/gitcode_cli-0.9.0-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.0
|
|
160
166
|
|
|
161
167
|
# Windows PowerShell 中推荐使用 gitcode
|
|
162
168
|
gitcode version
|
|
@@ -183,42 +189,59 @@ 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
|
+
|
|
186
216
|
### 规划中的安装方式
|
|
187
217
|
|
|
188
218
|
以下安装方式正在开发中:
|
|
189
219
|
|
|
190
220
|
- [ ] Homebrew (macOS/Linux)
|
|
191
221
|
- [ ] Scoop (Windows)
|
|
192
|
-
- [ ] Docker 镜像
|
|
193
222
|
|
|
194
223
|
## 快速开始
|
|
195
224
|
|
|
196
225
|
### 认证
|
|
197
226
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# 设置 Token 环境变量
|
|
202
|
-
export GC_TOKEN="your_gitcode_token"
|
|
227
|
+
以下示例使用安装包提供的 `gitcode` 入口;从源码构建或使用独立二进制时,请将命令名改为 `gc`。
|
|
203
228
|
|
|
204
|
-
|
|
205
|
-
export GITCODE_TOKEN="your_gitcode_token"
|
|
229
|
+
**方式一:打开令牌页面并登录**
|
|
206
230
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
source ~/.bashrc
|
|
231
|
+
```bash
|
|
232
|
+
gitcode auth login --web
|
|
210
233
|
```
|
|
211
234
|
|
|
212
|
-
|
|
235
|
+
当前 `--web` 会打开 GitCode 的新建访问令牌页面,生成令牌后仍需回到终端粘贴。当前版本不会隐藏输入,因此必须由用户本人在私有、未录制且不由 AI 控制的本地终端中执行。
|
|
213
236
|
|
|
214
|
-
|
|
215
|
-
# 交互式登录(需输入 Token)
|
|
216
|
-
gc auth login
|
|
237
|
+
**方式二:交互式 Token 登录**
|
|
217
238
|
|
|
218
|
-
|
|
219
|
-
|
|
239
|
+
```bash
|
|
240
|
+
gitcode auth login
|
|
220
241
|
```
|
|
221
242
|
|
|
243
|
+
浏览器不可用时,可在同样受控的本地交互终端中输入 Token。不要把 Token 值直接写进命令、shell history 或配置脚本。CI 场景应通过平台 Secret 注入 `GC_TOKEN` 或 `GITCODE_TOKEN`。
|
|
244
|
+
|
|
222
245
|
当前版本认证优先级:
|
|
223
246
|
|
|
224
247
|
1. `GC_TOKEN`
|
|
@@ -233,43 +256,43 @@ echo "YOUR_TOKEN" | gc auth login --with-token
|
|
|
233
256
|
|
|
234
257
|
**获取 Token:**
|
|
235
258
|
1. 登录 [GitCode](https://gitcode.com)
|
|
236
|
-
2. 进入
|
|
237
|
-
3.
|
|
259
|
+
2. 进入 个人设置 -> 访问令牌
|
|
260
|
+
3. 点击“新建访问令牌”,选择所需权限
|
|
238
261
|
4. 复制生成的 Token
|
|
239
262
|
|
|
240
263
|
**验证认证:**
|
|
241
264
|
|
|
242
265
|
```bash
|
|
243
266
|
# 查看认证状态
|
|
244
|
-
|
|
267
|
+
gitcode auth status
|
|
245
268
|
```
|
|
246
269
|
|
|
247
270
|
> 详细命令行为和完整示例请查看 [docs/COMMANDS.md](./docs/COMMANDS.md)。
|
|
248
271
|
|
|
249
272
|
## 输出格式
|
|
250
273
|
|
|
251
|
-
`
|
|
274
|
+
`gitcode` 的只读命令继续以文本输出为默认体验,同时为脚本和代理保留稳定的结构化入口。
|
|
252
275
|
|
|
253
276
|
```bash
|
|
254
277
|
# 结构化输出
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
278
|
+
gitcode issue list -R owner/repo --json
|
|
279
|
+
gitcode issue list -R owner/repo --format json
|
|
280
|
+
gitcode repo log -R owner/repo --file README.md --branch main --json
|
|
281
|
+
gitcode pr list -R owner/repo --paginate --per-page 100 --json
|
|
259
282
|
|
|
260
283
|
# 常规文本与表格
|
|
261
|
-
|
|
262
|
-
|
|
284
|
+
gitcode issue list -R owner/repo --format simple
|
|
285
|
+
gitcode issue list -R owner/repo --format table
|
|
263
286
|
|
|
264
287
|
# 时间格式切换
|
|
265
|
-
|
|
266
|
-
|
|
288
|
+
gitcode issue list -R owner/repo --time-format absolute
|
|
289
|
+
gitcode issue list -R owner/repo --time-format relative
|
|
267
290
|
|
|
268
291
|
# 自定义模板输出
|
|
269
|
-
|
|
292
|
+
gitcode issue list -R owner/repo --template '{{range .}}#{{.Number}} {{.Title}}{{"\n"}}{{end}}'
|
|
270
293
|
|
|
271
|
-
# typed command 尚未覆盖的 API,可用
|
|
272
|
-
|
|
294
|
+
# typed command 尚未覆盖的 API,可用 gitcode api 读取原始响应
|
|
295
|
+
gitcode api repos/owner/repo
|
|
273
296
|
```
|
|
274
297
|
|
|
275
298
|
`issue view` 和 `pr view` 的文本详情展示也会保持稳定布局,而 `--json` 仍然是面向机器调用的首选入口。
|
|
@@ -280,31 +303,58 @@ gc api repos/owner/repo
|
|
|
280
303
|
|
|
281
304
|
```bash
|
|
282
305
|
# 查看仓库
|
|
283
|
-
|
|
306
|
+
gitcode repo view
|
|
284
307
|
|
|
285
308
|
# 查看文件提交历史
|
|
286
|
-
|
|
309
|
+
gitcode repo log -R owner/repo --file README.md --branch main
|
|
287
310
|
|
|
288
311
|
# 创建 Issue
|
|
289
|
-
|
|
312
|
+
gitcode issue create --title "Bug report" --body "Description"
|
|
290
313
|
|
|
291
314
|
# 列出 Issues
|
|
292
|
-
|
|
315
|
+
gitcode issue list --state open
|
|
293
316
|
|
|
294
317
|
# 创建 PR
|
|
295
|
-
|
|
318
|
+
gitcode pr create --title "New feature" --base main
|
|
296
319
|
|
|
297
320
|
# 按提交信息反查 PR
|
|
298
|
-
|
|
321
|
+
gitcode pr list -R owner/repo --commit-message "fix login"
|
|
299
322
|
|
|
300
323
|
# 提交前检查 pre-commit 配置与本地环境
|
|
301
|
-
|
|
324
|
+
gitcode precommit check
|
|
325
|
+
|
|
326
|
+
# 查看流水线运行记录
|
|
327
|
+
gitcode actions run list -R owner/repo --status FAILED
|
|
328
|
+
|
|
329
|
+
# 查看流水线运行详情
|
|
330
|
+
gitcode actions run view <run-id> -R owner/repo
|
|
331
|
+
|
|
332
|
+
# 列出流水线运行的 jobs
|
|
333
|
+
gitcode actions job list <run-id> -R owner/repo
|
|
334
|
+
|
|
335
|
+
# 查看工作流 job 详情
|
|
336
|
+
gitcode actions job view <run-id> <job-id> -R owner/repo
|
|
337
|
+
|
|
338
|
+
# 下载 job 日志归档
|
|
339
|
+
gitcode actions job log <run-id> <job-id> -R owner/repo --output job-log.zip
|
|
340
|
+
|
|
341
|
+
# 列出仓库 artifacts
|
|
342
|
+
gitcode actions artifact list -R owner/repo
|
|
343
|
+
|
|
344
|
+
# 查看 artifact 详情
|
|
345
|
+
gitcode actions artifact view <artifact-id> -R owner/repo
|
|
346
|
+
|
|
347
|
+
# 下载 artifact
|
|
348
|
+
gitcode actions artifact download <artifact-id> -R owner/repo --output artifact.zip
|
|
349
|
+
|
|
350
|
+
# 删除 artifact
|
|
351
|
+
gitcode actions artifact delete <artifact-id> -R owner/repo --yes
|
|
302
352
|
|
|
303
353
|
# 调用 GitCode API 原始响应
|
|
304
|
-
|
|
354
|
+
gitcode api repos/owner/repo
|
|
305
355
|
|
|
306
356
|
# 查看认证状态
|
|
307
|
-
|
|
357
|
+
gitcode auth status
|
|
308
358
|
```
|
|
309
359
|
|
|
310
360
|
完整命令说明、参数细节、平台限制和更多示例,请直接查看:
|
|
@@ -343,7 +393,7 @@ source ~/.config/fish/config.fish
|
|
|
343
393
|
|
|
344
394
|
补充说明:
|
|
345
395
|
|
|
346
|
-
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gc
|
|
396
|
+
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gitcode`(或源码构建的 `gc`)
|
|
347
397
|
- gitcode-cli 仓库内部 AI 开发请看 `AGENTS.md`、`CLAUDE.md` 和 `spec/workflows/ai-local-development-workflow.md`
|
|
348
398
|
- `issues-plan/PROGRESS.md` 只作为阶段说明,不作为单个 issue / PR 的实时事实依据
|
|
349
399
|
|
|
@@ -385,5 +435,5 @@ make run
|
|
|
385
435
|
## 相关链接
|
|
386
436
|
|
|
387
437
|
- [GitCode](https://gitcode.com) - GitCode 平台
|
|
388
|
-
- [API 文档](https://gitcode.com/docs/
|
|
438
|
+
- [API 文档](https://docs.gitcode.com/docs/apis/) - GitCode API 参考
|
|
389
439
|
- [问题反馈](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.0/gc_0.9.0_amd64.deb
|
|
74
77
|
|
|
75
78
|
# 安装
|
|
76
|
-
sudo dpkg -i gc_0.
|
|
79
|
+
sudo dpkg -i gc_0.9.0_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.0/gc-0.9.0-1.x86_64.rpm
|
|
86
89
|
|
|
87
90
|
# 安装
|
|
88
|
-
sudo rpm -i gc-0.
|
|
91
|
+
sudo rpm -i gc-0.9.0-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.0/gitcode_cli-0.9.0-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.0
|
|
131
137
|
|
|
132
138
|
# Windows PowerShell 中推荐使用 gitcode
|
|
133
139
|
gitcode version
|
|
@@ -154,42 +160,59 @@ 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
|
+
|
|
157
187
|
### 规划中的安装方式
|
|
158
188
|
|
|
159
189
|
以下安装方式正在开发中:
|
|
160
190
|
|
|
161
191
|
- [ ] Homebrew (macOS/Linux)
|
|
162
192
|
- [ ] Scoop (Windows)
|
|
163
|
-
- [ ] Docker 镜像
|
|
164
193
|
|
|
165
194
|
## 快速开始
|
|
166
195
|
|
|
167
196
|
### 认证
|
|
168
197
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
# 设置 Token 环境变量
|
|
173
|
-
export GC_TOKEN="your_gitcode_token"
|
|
198
|
+
以下示例使用安装包提供的 `gitcode` 入口;从源码构建或使用独立二进制时,请将命令名改为 `gc`。
|
|
174
199
|
|
|
175
|
-
|
|
176
|
-
export GITCODE_TOKEN="your_gitcode_token"
|
|
200
|
+
**方式一:打开令牌页面并登录**
|
|
177
201
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
source ~/.bashrc
|
|
202
|
+
```bash
|
|
203
|
+
gitcode auth login --web
|
|
181
204
|
```
|
|
182
205
|
|
|
183
|
-
|
|
206
|
+
当前 `--web` 会打开 GitCode 的新建访问令牌页面,生成令牌后仍需回到终端粘贴。当前版本不会隐藏输入,因此必须由用户本人在私有、未录制且不由 AI 控制的本地终端中执行。
|
|
184
207
|
|
|
185
|
-
|
|
186
|
-
# 交互式登录(需输入 Token)
|
|
187
|
-
gc auth login
|
|
208
|
+
**方式二:交互式 Token 登录**
|
|
188
209
|
|
|
189
|
-
|
|
190
|
-
|
|
210
|
+
```bash
|
|
211
|
+
gitcode auth login
|
|
191
212
|
```
|
|
192
213
|
|
|
214
|
+
浏览器不可用时,可在同样受控的本地交互终端中输入 Token。不要把 Token 值直接写进命令、shell history 或配置脚本。CI 场景应通过平台 Secret 注入 `GC_TOKEN` 或 `GITCODE_TOKEN`。
|
|
215
|
+
|
|
193
216
|
当前版本认证优先级:
|
|
194
217
|
|
|
195
218
|
1. `GC_TOKEN`
|
|
@@ -204,43 +227,43 @@ echo "YOUR_TOKEN" | gc auth login --with-token
|
|
|
204
227
|
|
|
205
228
|
**获取 Token:**
|
|
206
229
|
1. 登录 [GitCode](https://gitcode.com)
|
|
207
|
-
2. 进入
|
|
208
|
-
3.
|
|
230
|
+
2. 进入 个人设置 -> 访问令牌
|
|
231
|
+
3. 点击“新建访问令牌”,选择所需权限
|
|
209
232
|
4. 复制生成的 Token
|
|
210
233
|
|
|
211
234
|
**验证认证:**
|
|
212
235
|
|
|
213
236
|
```bash
|
|
214
237
|
# 查看认证状态
|
|
215
|
-
|
|
238
|
+
gitcode auth status
|
|
216
239
|
```
|
|
217
240
|
|
|
218
241
|
> 详细命令行为和完整示例请查看 [docs/COMMANDS.md](./docs/COMMANDS.md)。
|
|
219
242
|
|
|
220
243
|
## 输出格式
|
|
221
244
|
|
|
222
|
-
`
|
|
245
|
+
`gitcode` 的只读命令继续以文本输出为默认体验,同时为脚本和代理保留稳定的结构化入口。
|
|
223
246
|
|
|
224
247
|
```bash
|
|
225
248
|
# 结构化输出
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
249
|
+
gitcode issue list -R owner/repo --json
|
|
250
|
+
gitcode issue list -R owner/repo --format json
|
|
251
|
+
gitcode repo log -R owner/repo --file README.md --branch main --json
|
|
252
|
+
gitcode pr list -R owner/repo --paginate --per-page 100 --json
|
|
230
253
|
|
|
231
254
|
# 常规文本与表格
|
|
232
|
-
|
|
233
|
-
|
|
255
|
+
gitcode issue list -R owner/repo --format simple
|
|
256
|
+
gitcode issue list -R owner/repo --format table
|
|
234
257
|
|
|
235
258
|
# 时间格式切换
|
|
236
|
-
|
|
237
|
-
|
|
259
|
+
gitcode issue list -R owner/repo --time-format absolute
|
|
260
|
+
gitcode issue list -R owner/repo --time-format relative
|
|
238
261
|
|
|
239
262
|
# 自定义模板输出
|
|
240
|
-
|
|
263
|
+
gitcode issue list -R owner/repo --template '{{range .}}#{{.Number}} {{.Title}}{{"\n"}}{{end}}'
|
|
241
264
|
|
|
242
|
-
# typed command 尚未覆盖的 API,可用
|
|
243
|
-
|
|
265
|
+
# typed command 尚未覆盖的 API,可用 gitcode api 读取原始响应
|
|
266
|
+
gitcode api repos/owner/repo
|
|
244
267
|
```
|
|
245
268
|
|
|
246
269
|
`issue view` 和 `pr view` 的文本详情展示也会保持稳定布局,而 `--json` 仍然是面向机器调用的首选入口。
|
|
@@ -251,31 +274,58 @@ gc api repos/owner/repo
|
|
|
251
274
|
|
|
252
275
|
```bash
|
|
253
276
|
# 查看仓库
|
|
254
|
-
|
|
277
|
+
gitcode repo view
|
|
255
278
|
|
|
256
279
|
# 查看文件提交历史
|
|
257
|
-
|
|
280
|
+
gitcode repo log -R owner/repo --file README.md --branch main
|
|
258
281
|
|
|
259
282
|
# 创建 Issue
|
|
260
|
-
|
|
283
|
+
gitcode issue create --title "Bug report" --body "Description"
|
|
261
284
|
|
|
262
285
|
# 列出 Issues
|
|
263
|
-
|
|
286
|
+
gitcode issue list --state open
|
|
264
287
|
|
|
265
288
|
# 创建 PR
|
|
266
|
-
|
|
289
|
+
gitcode pr create --title "New feature" --base main
|
|
267
290
|
|
|
268
291
|
# 按提交信息反查 PR
|
|
269
|
-
|
|
292
|
+
gitcode pr list -R owner/repo --commit-message "fix login"
|
|
270
293
|
|
|
271
294
|
# 提交前检查 pre-commit 配置与本地环境
|
|
272
|
-
|
|
295
|
+
gitcode precommit check
|
|
296
|
+
|
|
297
|
+
# 查看流水线运行记录
|
|
298
|
+
gitcode actions run list -R owner/repo --status FAILED
|
|
299
|
+
|
|
300
|
+
# 查看流水线运行详情
|
|
301
|
+
gitcode actions run view <run-id> -R owner/repo
|
|
302
|
+
|
|
303
|
+
# 列出流水线运行的 jobs
|
|
304
|
+
gitcode actions job list <run-id> -R owner/repo
|
|
305
|
+
|
|
306
|
+
# 查看工作流 job 详情
|
|
307
|
+
gitcode actions job view <run-id> <job-id> -R owner/repo
|
|
308
|
+
|
|
309
|
+
# 下载 job 日志归档
|
|
310
|
+
gitcode actions job log <run-id> <job-id> -R owner/repo --output job-log.zip
|
|
311
|
+
|
|
312
|
+
# 列出仓库 artifacts
|
|
313
|
+
gitcode actions artifact list -R owner/repo
|
|
314
|
+
|
|
315
|
+
# 查看 artifact 详情
|
|
316
|
+
gitcode actions artifact view <artifact-id> -R owner/repo
|
|
317
|
+
|
|
318
|
+
# 下载 artifact
|
|
319
|
+
gitcode actions artifact download <artifact-id> -R owner/repo --output artifact.zip
|
|
320
|
+
|
|
321
|
+
# 删除 artifact
|
|
322
|
+
gitcode actions artifact delete <artifact-id> -R owner/repo --yes
|
|
273
323
|
|
|
274
324
|
# 调用 GitCode API 原始响应
|
|
275
|
-
|
|
325
|
+
gitcode api repos/owner/repo
|
|
276
326
|
|
|
277
327
|
# 查看认证状态
|
|
278
|
-
|
|
328
|
+
gitcode auth status
|
|
279
329
|
```
|
|
280
330
|
|
|
281
331
|
完整命令说明、参数细节、平台限制和更多示例,请直接查看:
|
|
@@ -314,7 +364,7 @@ source ~/.config/fish/config.fish
|
|
|
314
364
|
|
|
315
365
|
补充说明:
|
|
316
366
|
|
|
317
|
-
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gc
|
|
367
|
+
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gitcode`(或源码构建的 `gc`)
|
|
318
368
|
- gitcode-cli 仓库内部 AI 开发请看 `AGENTS.md`、`CLAUDE.md` 和 `spec/workflows/ai-local-development-workflow.md`
|
|
319
369
|
- `issues-plan/PROGRESS.md` 只作为阶段说明,不作为单个 issue / PR 的实时事实依据
|
|
320
370
|
|
|
@@ -356,5 +406,5 @@ make run
|
|
|
356
406
|
## 相关链接
|
|
357
407
|
|
|
358
408
|
- [GitCode](https://gitcode.com) - GitCode 平台
|
|
359
|
-
- [API 文档](https://gitcode.com/docs/
|
|
409
|
+
- [API 文档](https://docs.gitcode.com/docs/apis/) - GitCode API 参考
|
|
360
410
|
- [问题反馈](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.0
|
|
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.0/gc_0.9.0_amd64.deb
|
|
103
106
|
|
|
104
107
|
# 安装
|
|
105
|
-
sudo dpkg -i gc_0.
|
|
108
|
+
sudo dpkg -i gc_0.9.0_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.0/gc-0.9.0-1.x86_64.rpm
|
|
115
118
|
|
|
116
119
|
# 安装
|
|
117
|
-
sudo rpm -i gc-0.
|
|
120
|
+
sudo rpm -i gc-0.9.0-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.0/gitcode_cli-0.9.0-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.0
|
|
160
166
|
|
|
161
167
|
# Windows PowerShell 中推荐使用 gitcode
|
|
162
168
|
gitcode version
|
|
@@ -183,42 +189,59 @@ 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
|
+
|
|
186
216
|
### 规划中的安装方式
|
|
187
217
|
|
|
188
218
|
以下安装方式正在开发中:
|
|
189
219
|
|
|
190
220
|
- [ ] Homebrew (macOS/Linux)
|
|
191
221
|
- [ ] Scoop (Windows)
|
|
192
|
-
- [ ] Docker 镜像
|
|
193
222
|
|
|
194
223
|
## 快速开始
|
|
195
224
|
|
|
196
225
|
### 认证
|
|
197
226
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# 设置 Token 环境变量
|
|
202
|
-
export GC_TOKEN="your_gitcode_token"
|
|
227
|
+
以下示例使用安装包提供的 `gitcode` 入口;从源码构建或使用独立二进制时,请将命令名改为 `gc`。
|
|
203
228
|
|
|
204
|
-
|
|
205
|
-
export GITCODE_TOKEN="your_gitcode_token"
|
|
229
|
+
**方式一:打开令牌页面并登录**
|
|
206
230
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
source ~/.bashrc
|
|
231
|
+
```bash
|
|
232
|
+
gitcode auth login --web
|
|
210
233
|
```
|
|
211
234
|
|
|
212
|
-
|
|
235
|
+
当前 `--web` 会打开 GitCode 的新建访问令牌页面,生成令牌后仍需回到终端粘贴。当前版本不会隐藏输入,因此必须由用户本人在私有、未录制且不由 AI 控制的本地终端中执行。
|
|
213
236
|
|
|
214
|
-
|
|
215
|
-
# 交互式登录(需输入 Token)
|
|
216
|
-
gc auth login
|
|
237
|
+
**方式二:交互式 Token 登录**
|
|
217
238
|
|
|
218
|
-
|
|
219
|
-
|
|
239
|
+
```bash
|
|
240
|
+
gitcode auth login
|
|
220
241
|
```
|
|
221
242
|
|
|
243
|
+
浏览器不可用时,可在同样受控的本地交互终端中输入 Token。不要把 Token 值直接写进命令、shell history 或配置脚本。CI 场景应通过平台 Secret 注入 `GC_TOKEN` 或 `GITCODE_TOKEN`。
|
|
244
|
+
|
|
222
245
|
当前版本认证优先级:
|
|
223
246
|
|
|
224
247
|
1. `GC_TOKEN`
|
|
@@ -233,43 +256,43 @@ echo "YOUR_TOKEN" | gc auth login --with-token
|
|
|
233
256
|
|
|
234
257
|
**获取 Token:**
|
|
235
258
|
1. 登录 [GitCode](https://gitcode.com)
|
|
236
|
-
2. 进入
|
|
237
|
-
3.
|
|
259
|
+
2. 进入 个人设置 -> 访问令牌
|
|
260
|
+
3. 点击“新建访问令牌”,选择所需权限
|
|
238
261
|
4. 复制生成的 Token
|
|
239
262
|
|
|
240
263
|
**验证认证:**
|
|
241
264
|
|
|
242
265
|
```bash
|
|
243
266
|
# 查看认证状态
|
|
244
|
-
|
|
267
|
+
gitcode auth status
|
|
245
268
|
```
|
|
246
269
|
|
|
247
270
|
> 详细命令行为和完整示例请查看 [docs/COMMANDS.md](./docs/COMMANDS.md)。
|
|
248
271
|
|
|
249
272
|
## 输出格式
|
|
250
273
|
|
|
251
|
-
`
|
|
274
|
+
`gitcode` 的只读命令继续以文本输出为默认体验,同时为脚本和代理保留稳定的结构化入口。
|
|
252
275
|
|
|
253
276
|
```bash
|
|
254
277
|
# 结构化输出
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
278
|
+
gitcode issue list -R owner/repo --json
|
|
279
|
+
gitcode issue list -R owner/repo --format json
|
|
280
|
+
gitcode repo log -R owner/repo --file README.md --branch main --json
|
|
281
|
+
gitcode pr list -R owner/repo --paginate --per-page 100 --json
|
|
259
282
|
|
|
260
283
|
# 常规文本与表格
|
|
261
|
-
|
|
262
|
-
|
|
284
|
+
gitcode issue list -R owner/repo --format simple
|
|
285
|
+
gitcode issue list -R owner/repo --format table
|
|
263
286
|
|
|
264
287
|
# 时间格式切换
|
|
265
|
-
|
|
266
|
-
|
|
288
|
+
gitcode issue list -R owner/repo --time-format absolute
|
|
289
|
+
gitcode issue list -R owner/repo --time-format relative
|
|
267
290
|
|
|
268
291
|
# 自定义模板输出
|
|
269
|
-
|
|
292
|
+
gitcode issue list -R owner/repo --template '{{range .}}#{{.Number}} {{.Title}}{{"\n"}}{{end}}'
|
|
270
293
|
|
|
271
|
-
# typed command 尚未覆盖的 API,可用
|
|
272
|
-
|
|
294
|
+
# typed command 尚未覆盖的 API,可用 gitcode api 读取原始响应
|
|
295
|
+
gitcode api repos/owner/repo
|
|
273
296
|
```
|
|
274
297
|
|
|
275
298
|
`issue view` 和 `pr view` 的文本详情展示也会保持稳定布局,而 `--json` 仍然是面向机器调用的首选入口。
|
|
@@ -280,31 +303,58 @@ gc api repos/owner/repo
|
|
|
280
303
|
|
|
281
304
|
```bash
|
|
282
305
|
# 查看仓库
|
|
283
|
-
|
|
306
|
+
gitcode repo view
|
|
284
307
|
|
|
285
308
|
# 查看文件提交历史
|
|
286
|
-
|
|
309
|
+
gitcode repo log -R owner/repo --file README.md --branch main
|
|
287
310
|
|
|
288
311
|
# 创建 Issue
|
|
289
|
-
|
|
312
|
+
gitcode issue create --title "Bug report" --body "Description"
|
|
290
313
|
|
|
291
314
|
# 列出 Issues
|
|
292
|
-
|
|
315
|
+
gitcode issue list --state open
|
|
293
316
|
|
|
294
317
|
# 创建 PR
|
|
295
|
-
|
|
318
|
+
gitcode pr create --title "New feature" --base main
|
|
296
319
|
|
|
297
320
|
# 按提交信息反查 PR
|
|
298
|
-
|
|
321
|
+
gitcode pr list -R owner/repo --commit-message "fix login"
|
|
299
322
|
|
|
300
323
|
# 提交前检查 pre-commit 配置与本地环境
|
|
301
|
-
|
|
324
|
+
gitcode precommit check
|
|
325
|
+
|
|
326
|
+
# 查看流水线运行记录
|
|
327
|
+
gitcode actions run list -R owner/repo --status FAILED
|
|
328
|
+
|
|
329
|
+
# 查看流水线运行详情
|
|
330
|
+
gitcode actions run view <run-id> -R owner/repo
|
|
331
|
+
|
|
332
|
+
# 列出流水线运行的 jobs
|
|
333
|
+
gitcode actions job list <run-id> -R owner/repo
|
|
334
|
+
|
|
335
|
+
# 查看工作流 job 详情
|
|
336
|
+
gitcode actions job view <run-id> <job-id> -R owner/repo
|
|
337
|
+
|
|
338
|
+
# 下载 job 日志归档
|
|
339
|
+
gitcode actions job log <run-id> <job-id> -R owner/repo --output job-log.zip
|
|
340
|
+
|
|
341
|
+
# 列出仓库 artifacts
|
|
342
|
+
gitcode actions artifact list -R owner/repo
|
|
343
|
+
|
|
344
|
+
# 查看 artifact 详情
|
|
345
|
+
gitcode actions artifact view <artifact-id> -R owner/repo
|
|
346
|
+
|
|
347
|
+
# 下载 artifact
|
|
348
|
+
gitcode actions artifact download <artifact-id> -R owner/repo --output artifact.zip
|
|
349
|
+
|
|
350
|
+
# 删除 artifact
|
|
351
|
+
gitcode actions artifact delete <artifact-id> -R owner/repo --yes
|
|
302
352
|
|
|
303
353
|
# 调用 GitCode API 原始响应
|
|
304
|
-
|
|
354
|
+
gitcode api repos/owner/repo
|
|
305
355
|
|
|
306
356
|
# 查看认证状态
|
|
307
|
-
|
|
357
|
+
gitcode auth status
|
|
308
358
|
```
|
|
309
359
|
|
|
310
360
|
完整命令说明、参数细节、平台限制和更多示例,请直接查看:
|
|
@@ -343,7 +393,7 @@ source ~/.config/fish/config.fish
|
|
|
343
393
|
|
|
344
394
|
补充说明:
|
|
345
395
|
|
|
346
|
-
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gc
|
|
396
|
+
- `docs/AI-GUIDE.md` 只服务外部项目通过 AI 使用 `gitcode`(或源码构建的 `gc`)
|
|
347
397
|
- gitcode-cli 仓库内部 AI 开发请看 `AGENTS.md`、`CLAUDE.md` 和 `spec/workflows/ai-local-development-workflow.md`
|
|
348
398
|
- `issues-plan/PROGRESS.md` 只作为阶段说明,不作为单个 issue / PR 的实时事实依据
|
|
349
399
|
|
|
@@ -385,5 +435,5 @@ make run
|
|
|
385
435
|
## 相关链接
|
|
386
436
|
|
|
387
437
|
- [GitCode](https://gitcode.com) - GitCode 平台
|
|
388
|
-
- [API 文档](https://gitcode.com/docs/
|
|
438
|
+
- [API 文档](https://docs.gitcode.com/docs/apis/) - GitCode API 参考
|
|
389
439
|
- [问题反馈](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.0"
|
|
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
|