gitcode-cli 0.2.8__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.
@@ -0,0 +1,28 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 gitcode-cli contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ This project is inspired by and references the GitHub CLI (https://github.com/cli/cli),
26
+ which is also licensed under the MIT License.
27
+
28
+ Copyright (c) 2019 GitHub, Inc.
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include gc_cli/bin *
@@ -0,0 +1,378 @@
1
+ Metadata-Version: 2.4
2
+ Name: gitcode-cli
3
+ Version: 0.2.8
4
+ Summary: GitCode CLI - Command line tool for GitCode
5
+ Author-email: GitCode CLI Contributors <support@gitcode.com>
6
+ Maintainer-email: GitCode CLI Contributors <support@gitcode.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://gitcode.com/gitcode-cli/cli
9
+ Project-URL: Documentation, https://gitcode.com/gitcode-cli/cli
10
+ Project-URL: Repository, https://gitcode.com/gitcode-cli/cli
11
+ Project-URL: Issues, https://gitcode.com/gitcode-cli/cli/issues
12
+ Keywords: gitcode,cli,git,devops
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Software Development
25
+ Classifier: Topic :: Utilities
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Dynamic: license-file
30
+
31
+ # GitCode CLI
32
+
33
+ [![Go Version](https://img.shields.io/badge/Go-1.22+-00ADD8?style=flat&logo=go)](https://golang.org)
34
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
35
+ [![Release](https://img.shields.io/github/v/release/gitcode-cli/cli?include_prereleases)](https://gitcode.com/gitcode-cli/cli/releases)
36
+
37
+ GitCode 命令行工具,为 GitCode 用户提供便捷的命令行操作体验。
38
+
39
+ ## 安装
40
+
41
+ ### 从源码构建
42
+
43
+ **前置要求:**
44
+ - Go 1.22+
45
+
46
+ ```bash
47
+ # 克隆仓库
48
+ git clone https://gitcode.com/gitcode-cli/cli.git
49
+ cd cli
50
+
51
+ # 构建
52
+ go build -o gc ./cmd/gc
53
+
54
+ # 安装到用户目录
55
+ mkdir -p ~/.local/bin
56
+ mv gc ~/.local/bin/
57
+ export PATH="$HOME/.local/bin:$PATH"
58
+ ```
59
+
60
+ ### Linux 包管理器
61
+
62
+ **DEB (Debian/Ubuntu):**
63
+
64
+ ```bash
65
+ # 从 Releases 下载 .deb 包
66
+ wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.2.5/gc_0.2.5_amd64.deb
67
+
68
+ # 安装
69
+ sudo dpkg -i gc_0.2.5_amd64.deb
70
+ ```
71
+
72
+ **RPM (RHEL/CentOS/Fedora):**
73
+
74
+ ```bash
75
+ # 从 Releases 下载 .rpm 包
76
+ wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.2.5/gc-0.2.5-1.x86_64.rpm
77
+
78
+ # 安装
79
+ sudo rpm -i gc-0.2.5-1.x86_64.rpm
80
+ ```
81
+
82
+ ### PyPI (跨平台)
83
+
84
+ ```bash
85
+ # 使用 pip 安装
86
+ pip install gitcode-cli
87
+
88
+ # 或指定版本
89
+ pip install gitcode-cli==0.2.5
90
+ ```
91
+
92
+ ### 规划中的安装方式
93
+
94
+ 以下安装方式正在开发中:
95
+
96
+ - [ ] 预编译二进制文件(Linux/macOS/Windows)
97
+ - [ ] Homebrew (macOS/Linux)
98
+ - [ ] Scoop (Windows)
99
+ - [ ] Docker 镜像
100
+
101
+ ## 快速开始
102
+
103
+ ### 认证
104
+
105
+ **方式一:设置环境变量(推荐)**
106
+
107
+ ```bash
108
+ # 设置 Token 环境变量
109
+ export GC_TOKEN="your_gitcode_token"
110
+
111
+ # 或使用备用变量名
112
+ export GITCODE_TOKEN="your_gitcode_token"
113
+
114
+ # 添加到 shell 配置文件(永久生效)
115
+ echo 'export GC_TOKEN="your_gitcode_token"' >> ~/.bashrc
116
+ source ~/.bashrc
117
+ ```
118
+
119
+ **方式二:交互式登录**
120
+
121
+ ```bash
122
+ # 交互式登录(需输入 Token)
123
+ gc auth login
124
+
125
+ # 使用 Token 参数登录
126
+ gc auth login --token YOUR_TOKEN
127
+ ```
128
+
129
+ **获取 Token:**
130
+ 1. 登录 [GitCode](https://gitcode.com)
131
+ 2. 进入 设置 -> 私人令牌
132
+ 3. 点击"生成新令牌",选择所需权限
133
+ 4. 复制生成的 Token
134
+
135
+ **验证认证:**
136
+
137
+ ```bash
138
+ # 查看认证状态
139
+ gc auth status
140
+ ```
141
+
142
+ > 📖 **完整命令指南**: 查看 [COMMANDS.md](./docs/COMMANDS.md) 获取所有命令的详细使用说明和示例。
143
+
144
+ ## 命令示例
145
+
146
+ ### 仓库操作
147
+
148
+ ```bash
149
+ # 克隆仓库
150
+ gc repo clone owner/repo
151
+
152
+ # 创建新仓库
153
+ gc repo create my-repo --public
154
+
155
+ # 查看仓库信息
156
+ gc repo view owner/repo
157
+
158
+ # Fork 仓库
159
+ gc repo fork owner/repo
160
+
161
+ # 删除仓库
162
+ gc repo delete owner/repo
163
+ ```
164
+
165
+ ### Issue 管理
166
+
167
+ ```bash
168
+ # 创建 Issue
169
+ gc issue create --title "Bug report" --body "Description"
170
+
171
+ # 列出 Issues
172
+ gc issue list --state open
173
+
174
+ # 查看 Issue 详情
175
+ gc issue view 123
176
+
177
+ # 关闭 Issue
178
+ gc issue close 123
179
+
180
+ # 重开 Issue
181
+ gc issue reopen 123
182
+
183
+ # 添加评论
184
+ gc issue comment 123 --body "Comment text"
185
+
186
+ # 管理 Issue 标签
187
+ gc issue label 123 --add bug,enhancement
188
+ ```
189
+
190
+ ### Pull Request 管理
191
+
192
+ ```bash
193
+ # 创建 PR
194
+ gc pr create --title "New feature" --base main
195
+
196
+ # 列出 PR
197
+ gc pr list --state open
198
+
199
+ # 查看 PR 详情
200
+ gc pr view 456
201
+
202
+ # 检出 PR 分支
203
+ gc pr checkout 456
204
+
205
+ # 合并 PR
206
+ gc pr merge 456 --squash
207
+
208
+ # 关闭/重开 PR
209
+ gc pr close 456
210
+ gc pr reopen 456
211
+
212
+ # 编辑 PR
213
+ gc pr edit 456 --title "New title"
214
+ gc pr edit 456 --draft true
215
+
216
+ # 代码检视
217
+ gc pr review 456 --approve
218
+ gc pr review 456 --request
219
+ gc pr review 456 --comment "Review comment"
220
+ ```
221
+
222
+ ### Release 管理
223
+
224
+ ```bash
225
+ # 创建 Release(建议包含 --notes 参数)
226
+ gc release create v1.0.0 --title "Version 1.0" --notes "Release notes"
227
+
228
+ # 列出 Releases
229
+ gc release list -R owner/repo
230
+
231
+ # 查看 Release 详情
232
+ gc release view v1.0.0 -R owner/repo
233
+
234
+ # 上传资产到 Release
235
+ gc release upload v1.0.0 app.zip -R owner/repo
236
+ gc release upload v1.0.0 file1.tar.gz file2.rpm -R owner/repo
237
+
238
+ # 下载 Release 资产
239
+ gc release download v1.0.0 -R owner/repo
240
+ gc release download v1.0.0 app.zip -R owner/repo -o ./downloads/
241
+
242
+ # 删除 Release
243
+ gc release delete v1.0.0 -R owner/repo
244
+ ```
245
+
246
+ > **注意**: `release create` 命令建议包含 `--notes` 参数,否则可能返回错误。
247
+
248
+ ## 功能特性
249
+
250
+ | 功能 | 描述 |
251
+ |------|------|
252
+ | 🔐 认证管理 | Token 认证、多账户支持、安全存储 |
253
+ | 📦 仓库操作 | 克隆、创建、Fork、查看、删除 |
254
+ | 🐛 Issue 管理 | 创建、列表、查看、关闭、重开、评论 |
255
+ | 🔀 PR 管理 | 创建、列表、查看、检出、合并、关闭 |
256
+ | 👀 代码检视 | 批准、请求修改、添加评论 |
257
+ | 🏷️ 标签管理 | 创建、列表、删除 |
258
+ | 🎯 里程碑管理 | 创建、列表、查看、删除 |
259
+ | 🚀 Release 管理 | 创建、列表、查看、上传资产、下载资产 |
260
+
261
+ ## 命令概览
262
+
263
+ ```
264
+ gc <command> <subcommand> [flags]
265
+
266
+ Commands:
267
+ auth 认证管理 (login, logout, status, token)
268
+ repo 仓库操作 (clone, create, list, view, fork, delete)
269
+ issue Issue 管理 (create, list, view, close, reopen, comment)
270
+ pr PR 管理 (create, list, view, checkout, merge, close, reopen, review, diff, ready)
271
+ label 标签管理 (create, list, delete)
272
+ milestone 里程碑管理 (create, list, view, delete)
273
+ release Release 管理 (create, list, view, upload, download, delete)
274
+ version 显示版本信息
275
+ ```
276
+
277
+ ## 配置
278
+
279
+ 配置文件位置: `~/.config/gc/config.yaml`
280
+
281
+ ```yaml
282
+ # 默认主机
283
+ host: gitcode.com
284
+
285
+ # Git 协议
286
+ git_protocol: https
287
+
288
+ # 默认编辑器
289
+ editor: vim
290
+
291
+ # 分页器
292
+ pager: less
293
+ ```
294
+
295
+ ### 环境变量
296
+
297
+ | 变量 | 描述 |
298
+ |------|------|
299
+ | `GC_TOKEN` | 认证 Token |
300
+ | `GITCODE_TOKEN` | 备用 Token |
301
+ | `GC_HOST` | 默认主机 |
302
+ | `NO_COLOR` | 禁用颜色输出 |
303
+
304
+ ## Shell 补全
305
+
306
+ ```bash
307
+ # Bash
308
+ gc completion bash > /etc/bash_completion.d/gc
309
+ source ~/.bashrc
310
+
311
+ # Zsh
312
+ gc completion zsh > "${fpath[1]}/_gc"
313
+ source ~/.zshrc
314
+
315
+ # Fish
316
+ gc completion fish > ~/.config/fish/completions/gc.fish
317
+ source ~/.config/fish/config.fish
318
+ ```
319
+
320
+ ## 文档
321
+
322
+ - [命令指南](./docs/COMMANDS.md) - 所有命令的详细使用说明和示例
323
+ - [版本发布](./RELEASE.md) - 发布流程和产物说明
324
+ - [打包发布](./docs/PACKAGING.md) - DEB/RPM 包构建和发布流程
325
+ - [贡献指南](./CONTRIBUTING.md) - 开发和发布流程
326
+ - [安全策略](./SECURITY.md) - 敏感信息保护和安全规范
327
+ - [CLAUDE.md](./CLAUDE.md) - AI 辅助开发指南
328
+ - [需求文档](./issues-plan/) - 完整需求规格和里程碑规划
329
+
330
+ ## 技术栈
331
+
332
+ | 组件 | 技术 |
333
+ |------|------|
334
+ | 语言 | Go 1.22+ |
335
+ | 命令框架 | Cobra |
336
+ | 配置格式 | YAML |
337
+ | 目标平台 | Linux, macOS, Windows |
338
+
339
+ ## 开发
340
+
341
+ ```bash
342
+ # 克隆仓库
343
+ git clone https://gitcode.com/gitcode-cli/cli.git
344
+ cd gitcode-cli
345
+
346
+ # 安装依赖
347
+ make deps
348
+
349
+ # 构建
350
+ make build
351
+
352
+ # 运行测试
353
+ make test
354
+
355
+ # 代码检查
356
+ make lint
357
+
358
+ # 运行
359
+ make run
360
+ ```
361
+
362
+ ## 贡献
363
+
364
+ 欢迎贡献代码!请查看 [贡献指南](./CONTRIBUTING.md)。
365
+
366
+ ## 许可证
367
+
368
+ [MIT License](./LICENSE)
369
+
370
+ ## 致谢
371
+
372
+ 本项目参考了 [GitHub CLI](https://github.com/cli/cli) 的设计与实现,感谢 GitHub 团队的开源贡献。
373
+
374
+ ## 相关链接
375
+
376
+ - [GitCode](https://gitcode.com) - GitCode 平台
377
+ - [API 文档](https://gitcode.com/docs/api) - GitCode API 参考
378
+ - [问题反馈](https://gitcode.com/gitcode-cli/cli/issues) - 提交 Bug 或建议
@@ -0,0 +1,348 @@
1
+ # GitCode CLI
2
+
3
+ [![Go Version](https://img.shields.io/badge/Go-1.22+-00ADD8?style=flat&logo=go)](https://golang.org)
4
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+ [![Release](https://img.shields.io/github/v/release/gitcode-cli/cli?include_prereleases)](https://gitcode.com/gitcode-cli/cli/releases)
6
+
7
+ GitCode 命令行工具,为 GitCode 用户提供便捷的命令行操作体验。
8
+
9
+ ## 安装
10
+
11
+ ### 从源码构建
12
+
13
+ **前置要求:**
14
+ - Go 1.22+
15
+
16
+ ```bash
17
+ # 克隆仓库
18
+ git clone https://gitcode.com/gitcode-cli/cli.git
19
+ cd cli
20
+
21
+ # 构建
22
+ go build -o gc ./cmd/gc
23
+
24
+ # 安装到用户目录
25
+ mkdir -p ~/.local/bin
26
+ mv gc ~/.local/bin/
27
+ export PATH="$HOME/.local/bin:$PATH"
28
+ ```
29
+
30
+ ### Linux 包管理器
31
+
32
+ **DEB (Debian/Ubuntu):**
33
+
34
+ ```bash
35
+ # 从 Releases 下载 .deb 包
36
+ wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.2.5/gc_0.2.5_amd64.deb
37
+
38
+ # 安装
39
+ sudo dpkg -i gc_0.2.5_amd64.deb
40
+ ```
41
+
42
+ **RPM (RHEL/CentOS/Fedora):**
43
+
44
+ ```bash
45
+ # 从 Releases 下载 .rpm 包
46
+ wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.2.5/gc-0.2.5-1.x86_64.rpm
47
+
48
+ # 安装
49
+ sudo rpm -i gc-0.2.5-1.x86_64.rpm
50
+ ```
51
+
52
+ ### PyPI (跨平台)
53
+
54
+ ```bash
55
+ # 使用 pip 安装
56
+ pip install gitcode-cli
57
+
58
+ # 或指定版本
59
+ pip install gitcode-cli==0.2.5
60
+ ```
61
+
62
+ ### 规划中的安装方式
63
+
64
+ 以下安装方式正在开发中:
65
+
66
+ - [ ] 预编译二进制文件(Linux/macOS/Windows)
67
+ - [ ] Homebrew (macOS/Linux)
68
+ - [ ] Scoop (Windows)
69
+ - [ ] Docker 镜像
70
+
71
+ ## 快速开始
72
+
73
+ ### 认证
74
+
75
+ **方式一:设置环境变量(推荐)**
76
+
77
+ ```bash
78
+ # 设置 Token 环境变量
79
+ export GC_TOKEN="your_gitcode_token"
80
+
81
+ # 或使用备用变量名
82
+ export GITCODE_TOKEN="your_gitcode_token"
83
+
84
+ # 添加到 shell 配置文件(永久生效)
85
+ echo 'export GC_TOKEN="your_gitcode_token"' >> ~/.bashrc
86
+ source ~/.bashrc
87
+ ```
88
+
89
+ **方式二:交互式登录**
90
+
91
+ ```bash
92
+ # 交互式登录(需输入 Token)
93
+ gc auth login
94
+
95
+ # 使用 Token 参数登录
96
+ gc auth login --token YOUR_TOKEN
97
+ ```
98
+
99
+ **获取 Token:**
100
+ 1. 登录 [GitCode](https://gitcode.com)
101
+ 2. 进入 设置 -> 私人令牌
102
+ 3. 点击"生成新令牌",选择所需权限
103
+ 4. 复制生成的 Token
104
+
105
+ **验证认证:**
106
+
107
+ ```bash
108
+ # 查看认证状态
109
+ gc auth status
110
+ ```
111
+
112
+ > 📖 **完整命令指南**: 查看 [COMMANDS.md](./docs/COMMANDS.md) 获取所有命令的详细使用说明和示例。
113
+
114
+ ## 命令示例
115
+
116
+ ### 仓库操作
117
+
118
+ ```bash
119
+ # 克隆仓库
120
+ gc repo clone owner/repo
121
+
122
+ # 创建新仓库
123
+ gc repo create my-repo --public
124
+
125
+ # 查看仓库信息
126
+ gc repo view owner/repo
127
+
128
+ # Fork 仓库
129
+ gc repo fork owner/repo
130
+
131
+ # 删除仓库
132
+ gc repo delete owner/repo
133
+ ```
134
+
135
+ ### Issue 管理
136
+
137
+ ```bash
138
+ # 创建 Issue
139
+ gc issue create --title "Bug report" --body "Description"
140
+
141
+ # 列出 Issues
142
+ gc issue list --state open
143
+
144
+ # 查看 Issue 详情
145
+ gc issue view 123
146
+
147
+ # 关闭 Issue
148
+ gc issue close 123
149
+
150
+ # 重开 Issue
151
+ gc issue reopen 123
152
+
153
+ # 添加评论
154
+ gc issue comment 123 --body "Comment text"
155
+
156
+ # 管理 Issue 标签
157
+ gc issue label 123 --add bug,enhancement
158
+ ```
159
+
160
+ ### Pull Request 管理
161
+
162
+ ```bash
163
+ # 创建 PR
164
+ gc pr create --title "New feature" --base main
165
+
166
+ # 列出 PR
167
+ gc pr list --state open
168
+
169
+ # 查看 PR 详情
170
+ gc pr view 456
171
+
172
+ # 检出 PR 分支
173
+ gc pr checkout 456
174
+
175
+ # 合并 PR
176
+ gc pr merge 456 --squash
177
+
178
+ # 关闭/重开 PR
179
+ gc pr close 456
180
+ gc pr reopen 456
181
+
182
+ # 编辑 PR
183
+ gc pr edit 456 --title "New title"
184
+ gc pr edit 456 --draft true
185
+
186
+ # 代码检视
187
+ gc pr review 456 --approve
188
+ gc pr review 456 --request
189
+ gc pr review 456 --comment "Review comment"
190
+ ```
191
+
192
+ ### Release 管理
193
+
194
+ ```bash
195
+ # 创建 Release(建议包含 --notes 参数)
196
+ gc release create v1.0.0 --title "Version 1.0" --notes "Release notes"
197
+
198
+ # 列出 Releases
199
+ gc release list -R owner/repo
200
+
201
+ # 查看 Release 详情
202
+ gc release view v1.0.0 -R owner/repo
203
+
204
+ # 上传资产到 Release
205
+ gc release upload v1.0.0 app.zip -R owner/repo
206
+ gc release upload v1.0.0 file1.tar.gz file2.rpm -R owner/repo
207
+
208
+ # 下载 Release 资产
209
+ gc release download v1.0.0 -R owner/repo
210
+ gc release download v1.0.0 app.zip -R owner/repo -o ./downloads/
211
+
212
+ # 删除 Release
213
+ gc release delete v1.0.0 -R owner/repo
214
+ ```
215
+
216
+ > **注意**: `release create` 命令建议包含 `--notes` 参数,否则可能返回错误。
217
+
218
+ ## 功能特性
219
+
220
+ | 功能 | 描述 |
221
+ |------|------|
222
+ | 🔐 认证管理 | Token 认证、多账户支持、安全存储 |
223
+ | 📦 仓库操作 | 克隆、创建、Fork、查看、删除 |
224
+ | 🐛 Issue 管理 | 创建、列表、查看、关闭、重开、评论 |
225
+ | 🔀 PR 管理 | 创建、列表、查看、检出、合并、关闭 |
226
+ | 👀 代码检视 | 批准、请求修改、添加评论 |
227
+ | 🏷️ 标签管理 | 创建、列表、删除 |
228
+ | 🎯 里程碑管理 | 创建、列表、查看、删除 |
229
+ | 🚀 Release 管理 | 创建、列表、查看、上传资产、下载资产 |
230
+
231
+ ## 命令概览
232
+
233
+ ```
234
+ gc <command> <subcommand> [flags]
235
+
236
+ Commands:
237
+ auth 认证管理 (login, logout, status, token)
238
+ repo 仓库操作 (clone, create, list, view, fork, delete)
239
+ issue Issue 管理 (create, list, view, close, reopen, comment)
240
+ pr PR 管理 (create, list, view, checkout, merge, close, reopen, review, diff, ready)
241
+ label 标签管理 (create, list, delete)
242
+ milestone 里程碑管理 (create, list, view, delete)
243
+ release Release 管理 (create, list, view, upload, download, delete)
244
+ version 显示版本信息
245
+ ```
246
+
247
+ ## 配置
248
+
249
+ 配置文件位置: `~/.config/gc/config.yaml`
250
+
251
+ ```yaml
252
+ # 默认主机
253
+ host: gitcode.com
254
+
255
+ # Git 协议
256
+ git_protocol: https
257
+
258
+ # 默认编辑器
259
+ editor: vim
260
+
261
+ # 分页器
262
+ pager: less
263
+ ```
264
+
265
+ ### 环境变量
266
+
267
+ | 变量 | 描述 |
268
+ |------|------|
269
+ | `GC_TOKEN` | 认证 Token |
270
+ | `GITCODE_TOKEN` | 备用 Token |
271
+ | `GC_HOST` | 默认主机 |
272
+ | `NO_COLOR` | 禁用颜色输出 |
273
+
274
+ ## Shell 补全
275
+
276
+ ```bash
277
+ # Bash
278
+ gc completion bash > /etc/bash_completion.d/gc
279
+ source ~/.bashrc
280
+
281
+ # Zsh
282
+ gc completion zsh > "${fpath[1]}/_gc"
283
+ source ~/.zshrc
284
+
285
+ # Fish
286
+ gc completion fish > ~/.config/fish/completions/gc.fish
287
+ source ~/.config/fish/config.fish
288
+ ```
289
+
290
+ ## 文档
291
+
292
+ - [命令指南](./docs/COMMANDS.md) - 所有命令的详细使用说明和示例
293
+ - [版本发布](./RELEASE.md) - 发布流程和产物说明
294
+ - [打包发布](./docs/PACKAGING.md) - DEB/RPM 包构建和发布流程
295
+ - [贡献指南](./CONTRIBUTING.md) - 开发和发布流程
296
+ - [安全策略](./SECURITY.md) - 敏感信息保护和安全规范
297
+ - [CLAUDE.md](./CLAUDE.md) - AI 辅助开发指南
298
+ - [需求文档](./issues-plan/) - 完整需求规格和里程碑规划
299
+
300
+ ## 技术栈
301
+
302
+ | 组件 | 技术 |
303
+ |------|------|
304
+ | 语言 | Go 1.22+ |
305
+ | 命令框架 | Cobra |
306
+ | 配置格式 | YAML |
307
+ | 目标平台 | Linux, macOS, Windows |
308
+
309
+ ## 开发
310
+
311
+ ```bash
312
+ # 克隆仓库
313
+ git clone https://gitcode.com/gitcode-cli/cli.git
314
+ cd gitcode-cli
315
+
316
+ # 安装依赖
317
+ make deps
318
+
319
+ # 构建
320
+ make build
321
+
322
+ # 运行测试
323
+ make test
324
+
325
+ # 代码检查
326
+ make lint
327
+
328
+ # 运行
329
+ make run
330
+ ```
331
+
332
+ ## 贡献
333
+
334
+ 欢迎贡献代码!请查看 [贡献指南](./CONTRIBUTING.md)。
335
+
336
+ ## 许可证
337
+
338
+ [MIT License](./LICENSE)
339
+
340
+ ## 致谢
341
+
342
+ 本项目参考了 [GitHub CLI](https://github.com/cli/cli) 的设计与实现,感谢 GitHub 团队的开源贡献。
343
+
344
+ ## 相关链接
345
+
346
+ - [GitCode](https://gitcode.com) - GitCode 平台
347
+ - [API 文档](https://gitcode.com/docs/api) - GitCode API 参考
348
+ - [问题反馈](https://gitcode.com/gitcode-cli/cli/issues) - 提交 Bug 或建议
@@ -0,0 +1,11 @@
1
+ """
2
+ GitCode CLI - Command line tool for GitCode.
3
+
4
+ This package provides a Python wrapper for the gc binary.
5
+ """
6
+
7
+ __version__ = "0.2.8"
8
+ __author__ = "GitCode CLI Contributors"
9
+ __all__ = ["__version__", "main"]
10
+
11
+ from gc_cli.wrapper import main
File without changes
@@ -0,0 +1,81 @@
1
+ """
2
+ Wrapper module for GitCode CLI binary.
3
+
4
+ This module provides a Python entry point that calls the appropriate
5
+ pre-compiled binary based on the current platform.
6
+ """
7
+
8
+ import os
9
+ import platform
10
+ import subprocess
11
+ import sys
12
+ from pathlib import Path
13
+
14
+
15
+ def get_binary_name() -> str:
16
+ """Get the binary name for the current platform."""
17
+ system = platform.system().lower()
18
+ machine = platform.machine().lower()
19
+
20
+ # Map machine architecture
21
+ arch_map = {
22
+ "x86_64": "amd64",
23
+ "amd64": "amd64",
24
+ "aarch64": "arm64",
25
+ "arm64": "arm64",
26
+ }
27
+ arch = arch_map.get(machine, "amd64")
28
+
29
+ # Map system to binary name
30
+ if system == "linux":
31
+ return f"gc-linux-{arch}"
32
+ elif system == "darwin":
33
+ return f"gc-darwin-{arch}"
34
+ elif system == "windows":
35
+ return "gc-windows-amd64.exe"
36
+ else:
37
+ raise RuntimeError(f"Unsupported platform: {system} {machine}")
38
+
39
+
40
+ def get_binary_path() -> Path:
41
+ """Get the path to the binary for the current platform."""
42
+ package_dir = Path(__file__).parent
43
+ binary_name = get_binary_name()
44
+ binary_path = package_dir / "bin" / binary_name
45
+
46
+ if not binary_path.exists():
47
+ raise FileNotFoundError(
48
+ f"Binary not found for your platform: {binary_path}\n"
49
+ f"Supported platforms: linux-amd64, linux-arm64, darwin-amd64, darwin-arm64, windows-amd64"
50
+ )
51
+
52
+ return binary_path
53
+
54
+
55
+ def main() -> int:
56
+ """Main entry point for the gc command."""
57
+ try:
58
+ binary_path = get_binary_path()
59
+
60
+ # Make sure the binary is executable
61
+ if not os.access(binary_path, os.X_OK):
62
+ binary_path.chmod(0o755)
63
+
64
+ # Run the binary with all arguments
65
+ result = subprocess.run(
66
+ [str(binary_path)] + sys.argv[1:],
67
+ cwd=os.getcwd(),
68
+ )
69
+
70
+ return result.returncode
71
+
72
+ except FileNotFoundError as e:
73
+ print(f"Error: {e}", file=sys.stderr)
74
+ return 1
75
+ except Exception as e:
76
+ print(f"Error running gc: {e}", file=sys.stderr)
77
+ return 1
78
+
79
+
80
+ if __name__ == "__main__":
81
+ sys.exit(main())
@@ -0,0 +1,378 @@
1
+ Metadata-Version: 2.4
2
+ Name: gitcode-cli
3
+ Version: 0.2.8
4
+ Summary: GitCode CLI - Command line tool for GitCode
5
+ Author-email: GitCode CLI Contributors <support@gitcode.com>
6
+ Maintainer-email: GitCode CLI Contributors <support@gitcode.com>
7
+ License: MIT
8
+ Project-URL: Homepage, https://gitcode.com/gitcode-cli/cli
9
+ Project-URL: Documentation, https://gitcode.com/gitcode-cli/cli
10
+ Project-URL: Repository, https://gitcode.com/gitcode-cli/cli
11
+ Project-URL: Issues, https://gitcode.com/gitcode-cli/cli/issues
12
+ Keywords: gitcode,cli,git,devops
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Software Development
25
+ Classifier: Topic :: Utilities
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Dynamic: license-file
30
+
31
+ # GitCode CLI
32
+
33
+ [![Go Version](https://img.shields.io/badge/Go-1.22+-00ADD8?style=flat&logo=go)](https://golang.org)
34
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
35
+ [![Release](https://img.shields.io/github/v/release/gitcode-cli/cli?include_prereleases)](https://gitcode.com/gitcode-cli/cli/releases)
36
+
37
+ GitCode 命令行工具,为 GitCode 用户提供便捷的命令行操作体验。
38
+
39
+ ## 安装
40
+
41
+ ### 从源码构建
42
+
43
+ **前置要求:**
44
+ - Go 1.22+
45
+
46
+ ```bash
47
+ # 克隆仓库
48
+ git clone https://gitcode.com/gitcode-cli/cli.git
49
+ cd cli
50
+
51
+ # 构建
52
+ go build -o gc ./cmd/gc
53
+
54
+ # 安装到用户目录
55
+ mkdir -p ~/.local/bin
56
+ mv gc ~/.local/bin/
57
+ export PATH="$HOME/.local/bin:$PATH"
58
+ ```
59
+
60
+ ### Linux 包管理器
61
+
62
+ **DEB (Debian/Ubuntu):**
63
+
64
+ ```bash
65
+ # 从 Releases 下载 .deb 包
66
+ wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.2.5/gc_0.2.5_amd64.deb
67
+
68
+ # 安装
69
+ sudo dpkg -i gc_0.2.5_amd64.deb
70
+ ```
71
+
72
+ **RPM (RHEL/CentOS/Fedora):**
73
+
74
+ ```bash
75
+ # 从 Releases 下载 .rpm 包
76
+ wget https://gitcode.com/gitcode-cli/cli/releases/download/v0.2.5/gc-0.2.5-1.x86_64.rpm
77
+
78
+ # 安装
79
+ sudo rpm -i gc-0.2.5-1.x86_64.rpm
80
+ ```
81
+
82
+ ### PyPI (跨平台)
83
+
84
+ ```bash
85
+ # 使用 pip 安装
86
+ pip install gitcode-cli
87
+
88
+ # 或指定版本
89
+ pip install gitcode-cli==0.2.5
90
+ ```
91
+
92
+ ### 规划中的安装方式
93
+
94
+ 以下安装方式正在开发中:
95
+
96
+ - [ ] 预编译二进制文件(Linux/macOS/Windows)
97
+ - [ ] Homebrew (macOS/Linux)
98
+ - [ ] Scoop (Windows)
99
+ - [ ] Docker 镜像
100
+
101
+ ## 快速开始
102
+
103
+ ### 认证
104
+
105
+ **方式一:设置环境变量(推荐)**
106
+
107
+ ```bash
108
+ # 设置 Token 环境变量
109
+ export GC_TOKEN="your_gitcode_token"
110
+
111
+ # 或使用备用变量名
112
+ export GITCODE_TOKEN="your_gitcode_token"
113
+
114
+ # 添加到 shell 配置文件(永久生效)
115
+ echo 'export GC_TOKEN="your_gitcode_token"' >> ~/.bashrc
116
+ source ~/.bashrc
117
+ ```
118
+
119
+ **方式二:交互式登录**
120
+
121
+ ```bash
122
+ # 交互式登录(需输入 Token)
123
+ gc auth login
124
+
125
+ # 使用 Token 参数登录
126
+ gc auth login --token YOUR_TOKEN
127
+ ```
128
+
129
+ **获取 Token:**
130
+ 1. 登录 [GitCode](https://gitcode.com)
131
+ 2. 进入 设置 -> 私人令牌
132
+ 3. 点击"生成新令牌",选择所需权限
133
+ 4. 复制生成的 Token
134
+
135
+ **验证认证:**
136
+
137
+ ```bash
138
+ # 查看认证状态
139
+ gc auth status
140
+ ```
141
+
142
+ > 📖 **完整命令指南**: 查看 [COMMANDS.md](./docs/COMMANDS.md) 获取所有命令的详细使用说明和示例。
143
+
144
+ ## 命令示例
145
+
146
+ ### 仓库操作
147
+
148
+ ```bash
149
+ # 克隆仓库
150
+ gc repo clone owner/repo
151
+
152
+ # 创建新仓库
153
+ gc repo create my-repo --public
154
+
155
+ # 查看仓库信息
156
+ gc repo view owner/repo
157
+
158
+ # Fork 仓库
159
+ gc repo fork owner/repo
160
+
161
+ # 删除仓库
162
+ gc repo delete owner/repo
163
+ ```
164
+
165
+ ### Issue 管理
166
+
167
+ ```bash
168
+ # 创建 Issue
169
+ gc issue create --title "Bug report" --body "Description"
170
+
171
+ # 列出 Issues
172
+ gc issue list --state open
173
+
174
+ # 查看 Issue 详情
175
+ gc issue view 123
176
+
177
+ # 关闭 Issue
178
+ gc issue close 123
179
+
180
+ # 重开 Issue
181
+ gc issue reopen 123
182
+
183
+ # 添加评论
184
+ gc issue comment 123 --body "Comment text"
185
+
186
+ # 管理 Issue 标签
187
+ gc issue label 123 --add bug,enhancement
188
+ ```
189
+
190
+ ### Pull Request 管理
191
+
192
+ ```bash
193
+ # 创建 PR
194
+ gc pr create --title "New feature" --base main
195
+
196
+ # 列出 PR
197
+ gc pr list --state open
198
+
199
+ # 查看 PR 详情
200
+ gc pr view 456
201
+
202
+ # 检出 PR 分支
203
+ gc pr checkout 456
204
+
205
+ # 合并 PR
206
+ gc pr merge 456 --squash
207
+
208
+ # 关闭/重开 PR
209
+ gc pr close 456
210
+ gc pr reopen 456
211
+
212
+ # 编辑 PR
213
+ gc pr edit 456 --title "New title"
214
+ gc pr edit 456 --draft true
215
+
216
+ # 代码检视
217
+ gc pr review 456 --approve
218
+ gc pr review 456 --request
219
+ gc pr review 456 --comment "Review comment"
220
+ ```
221
+
222
+ ### Release 管理
223
+
224
+ ```bash
225
+ # 创建 Release(建议包含 --notes 参数)
226
+ gc release create v1.0.0 --title "Version 1.0" --notes "Release notes"
227
+
228
+ # 列出 Releases
229
+ gc release list -R owner/repo
230
+
231
+ # 查看 Release 详情
232
+ gc release view v1.0.0 -R owner/repo
233
+
234
+ # 上传资产到 Release
235
+ gc release upload v1.0.0 app.zip -R owner/repo
236
+ gc release upload v1.0.0 file1.tar.gz file2.rpm -R owner/repo
237
+
238
+ # 下载 Release 资产
239
+ gc release download v1.0.0 -R owner/repo
240
+ gc release download v1.0.0 app.zip -R owner/repo -o ./downloads/
241
+
242
+ # 删除 Release
243
+ gc release delete v1.0.0 -R owner/repo
244
+ ```
245
+
246
+ > **注意**: `release create` 命令建议包含 `--notes` 参数,否则可能返回错误。
247
+
248
+ ## 功能特性
249
+
250
+ | 功能 | 描述 |
251
+ |------|------|
252
+ | 🔐 认证管理 | Token 认证、多账户支持、安全存储 |
253
+ | 📦 仓库操作 | 克隆、创建、Fork、查看、删除 |
254
+ | 🐛 Issue 管理 | 创建、列表、查看、关闭、重开、评论 |
255
+ | 🔀 PR 管理 | 创建、列表、查看、检出、合并、关闭 |
256
+ | 👀 代码检视 | 批准、请求修改、添加评论 |
257
+ | 🏷️ 标签管理 | 创建、列表、删除 |
258
+ | 🎯 里程碑管理 | 创建、列表、查看、删除 |
259
+ | 🚀 Release 管理 | 创建、列表、查看、上传资产、下载资产 |
260
+
261
+ ## 命令概览
262
+
263
+ ```
264
+ gc <command> <subcommand> [flags]
265
+
266
+ Commands:
267
+ auth 认证管理 (login, logout, status, token)
268
+ repo 仓库操作 (clone, create, list, view, fork, delete)
269
+ issue Issue 管理 (create, list, view, close, reopen, comment)
270
+ pr PR 管理 (create, list, view, checkout, merge, close, reopen, review, diff, ready)
271
+ label 标签管理 (create, list, delete)
272
+ milestone 里程碑管理 (create, list, view, delete)
273
+ release Release 管理 (create, list, view, upload, download, delete)
274
+ version 显示版本信息
275
+ ```
276
+
277
+ ## 配置
278
+
279
+ 配置文件位置: `~/.config/gc/config.yaml`
280
+
281
+ ```yaml
282
+ # 默认主机
283
+ host: gitcode.com
284
+
285
+ # Git 协议
286
+ git_protocol: https
287
+
288
+ # 默认编辑器
289
+ editor: vim
290
+
291
+ # 分页器
292
+ pager: less
293
+ ```
294
+
295
+ ### 环境变量
296
+
297
+ | 变量 | 描述 |
298
+ |------|------|
299
+ | `GC_TOKEN` | 认证 Token |
300
+ | `GITCODE_TOKEN` | 备用 Token |
301
+ | `GC_HOST` | 默认主机 |
302
+ | `NO_COLOR` | 禁用颜色输出 |
303
+
304
+ ## Shell 补全
305
+
306
+ ```bash
307
+ # Bash
308
+ gc completion bash > /etc/bash_completion.d/gc
309
+ source ~/.bashrc
310
+
311
+ # Zsh
312
+ gc completion zsh > "${fpath[1]}/_gc"
313
+ source ~/.zshrc
314
+
315
+ # Fish
316
+ gc completion fish > ~/.config/fish/completions/gc.fish
317
+ source ~/.config/fish/config.fish
318
+ ```
319
+
320
+ ## 文档
321
+
322
+ - [命令指南](./docs/COMMANDS.md) - 所有命令的详细使用说明和示例
323
+ - [版本发布](./RELEASE.md) - 发布流程和产物说明
324
+ - [打包发布](./docs/PACKAGING.md) - DEB/RPM 包构建和发布流程
325
+ - [贡献指南](./CONTRIBUTING.md) - 开发和发布流程
326
+ - [安全策略](./SECURITY.md) - 敏感信息保护和安全规范
327
+ - [CLAUDE.md](./CLAUDE.md) - AI 辅助开发指南
328
+ - [需求文档](./issues-plan/) - 完整需求规格和里程碑规划
329
+
330
+ ## 技术栈
331
+
332
+ | 组件 | 技术 |
333
+ |------|------|
334
+ | 语言 | Go 1.22+ |
335
+ | 命令框架 | Cobra |
336
+ | 配置格式 | YAML |
337
+ | 目标平台 | Linux, macOS, Windows |
338
+
339
+ ## 开发
340
+
341
+ ```bash
342
+ # 克隆仓库
343
+ git clone https://gitcode.com/gitcode-cli/cli.git
344
+ cd gitcode-cli
345
+
346
+ # 安装依赖
347
+ make deps
348
+
349
+ # 构建
350
+ make build
351
+
352
+ # 运行测试
353
+ make test
354
+
355
+ # 代码检查
356
+ make lint
357
+
358
+ # 运行
359
+ make run
360
+ ```
361
+
362
+ ## 贡献
363
+
364
+ 欢迎贡献代码!请查看 [贡献指南](./CONTRIBUTING.md)。
365
+
366
+ ## 许可证
367
+
368
+ [MIT License](./LICENSE)
369
+
370
+ ## 致谢
371
+
372
+ 本项目参考了 [GitHub CLI](https://github.com/cli/cli) 的设计与实现,感谢 GitHub 团队的开源贡献。
373
+
374
+ ## 相关链接
375
+
376
+ - [GitCode](https://gitcode.com) - GitCode 平台
377
+ - [API 文档](https://gitcode.com/docs/api) - GitCode API 参考
378
+ - [问题反馈](https://gitcode.com/gitcode-cli/cli/issues) - 提交 Bug 或建议
@@ -0,0 +1,17 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ gc_cli/__init__.py
6
+ gc_cli/wrapper.py
7
+ gc_cli/bin/.gitkeep
8
+ gc_cli/bin/gc-darwin-amd64
9
+ gc_cli/bin/gc-darwin-arm64
10
+ gc_cli/bin/gc-linux-amd64
11
+ gc_cli/bin/gc-linux-arm64
12
+ gc_cli/bin/gc-windows-amd64.exe
13
+ gitcode_cli.egg-info/PKG-INFO
14
+ gitcode_cli.egg-info/SOURCES.txt
15
+ gitcode_cli.egg-info/dependency_links.txt
16
+ gitcode_cli.egg-info/entry_points.txt
17
+ gitcode_cli.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ gc = gc_cli.wrapper:main
@@ -0,0 +1 @@
1
+ gc_cli
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "gitcode-cli"
7
+ version = "0.2.8"
8
+ description = "GitCode CLI - Command line tool for GitCode"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "GitCode CLI Contributors", email = "support@gitcode.com"}
13
+ ]
14
+ maintainers = [
15
+ {name = "GitCode CLI Contributors", email = "support@gitcode.com"}
16
+ ]
17
+ keywords = ["gitcode", "cli", "git", "devops"]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Environment :: Console",
21
+ "Intended Audience :: Developers",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Operating System :: OS Independent",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.8",
26
+ "Programming Language :: Python :: 3.9",
27
+ "Programming Language :: Python :: 3.10",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
30
+ "Topic :: Software Development",
31
+ "Topic :: Utilities",
32
+ ]
33
+ requires-python = ">=3.8"
34
+
35
+ [project.scripts]
36
+ gc = "gc_cli.wrapper:main"
37
+
38
+ [project.urls]
39
+ Homepage = "https://gitcode.com/gitcode-cli/cli"
40
+ Documentation = "https://gitcode.com/gitcode-cli/cli"
41
+ Repository = "https://gitcode.com/gitcode-cli/cli"
42
+ Issues = "https://gitcode.com/gitcode-cli/cli/issues"
43
+
44
+ [tool.setuptools.packages.find]
45
+ where = ["."]
46
+ include = ["gc_cli*"]
47
+
48
+ [tool.setuptools.package-data]
49
+ gc_cli = ["bin/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+