gitcode-cli 0.5.9__py3-none-any.whl → 0.5.14__py3-none-any.whl

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.
gc_cli/__init__.py CHANGED
@@ -1,11 +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.5.9"
8
- __author__ = "GitCode CLI Contributors"
9
- __all__ = ["__version__", "main"]
10
-
11
- from gc_cli.wrapper import main
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.5.14"
8
+ __author__ = "GitCode CLI Contributors"
9
+ __all__ = ["__version__", "main"]
10
+
11
+ from gc_cli.wrapper import main
gc_cli/__main__.py CHANGED
@@ -1,9 +1,9 @@
1
- """Allow running GitCode CLI with ``python -m gc_cli``."""
2
-
3
- import sys
4
-
5
- from gc_cli.wrapper import main
6
-
7
-
8
- if __name__ == "__main__":
9
- sys.exit(main())
1
+ """Allow running GitCode CLI with ``python -m gc_cli``."""
2
+
3
+ import sys
4
+
5
+ from gc_cli.wrapper import main
6
+
7
+
8
+ if __name__ == "__main__":
9
+ sys.exit(main())
gc_cli/bin/.gitkeep CHANGED
File without changes
Binary file
Binary file
gc_cli/bin/gc-linux-amd64 CHANGED
Binary file
gc_cli/bin/gc-linux-arm64 CHANGED
Binary file
Binary file
gc_cli/wrapper.py CHANGED
@@ -1,102 +1,102 @@
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
- COMMAND_NAME_ENV = "GITCODE_CLI_COMMAND_NAME"
15
-
16
-
17
- def get_binary_name() -> str:
18
- """Get the binary name for the current platform."""
19
- system = platform.system().lower()
20
- machine = platform.machine().lower()
21
-
22
- # Map machine architecture
23
- arch_map = {
24
- "x86_64": "amd64",
25
- "amd64": "amd64",
26
- "aarch64": "arm64",
27
- "arm64": "arm64",
28
- }
29
- arch = arch_map.get(machine, "amd64")
30
-
31
- # Map system to binary name
32
- if system == "linux":
33
- return f"gc-linux-{arch}"
34
- elif system == "darwin":
35
- return f"gc-darwin-{arch}"
36
- elif system == "windows":
37
- return "gc-windows-amd64.exe"
38
- else:
39
- raise RuntimeError(f"Unsupported platform: {system} {machine}")
40
-
41
-
42
- def get_binary_path() -> Path:
43
- """Get the path to the binary for the current platform."""
44
- package_dir = Path(__file__).parent
45
- binary_name = get_binary_name()
46
- binary_path = package_dir / "bin" / binary_name
47
-
48
- if not binary_path.exists():
49
- raise FileNotFoundError(
50
- f"Binary not found for your platform: {binary_path}\n"
51
- f"Supported platforms: linux-amd64, linux-arm64, darwin-amd64, darwin-arm64, windows-amd64"
52
- )
53
-
54
- return binary_path
55
-
56
-
57
- def get_command_name() -> str:
58
- """Get the command name that should appear in CLI output."""
59
- command = Path(sys.argv[0]).stem.lower()
60
- if command in {"gc", "gitcode"}:
61
- return command
62
- if platform.system() == "Windows":
63
- return "gitcode"
64
- return "gc"
65
-
66
-
67
- def ensure_executable(binary_path: Path) -> None:
68
- """Ensure packaged binaries are executable on POSIX platforms."""
69
- if platform.system() == "Windows":
70
- return
71
- if not os.access(binary_path, os.X_OK):
72
- binary_path.chmod(0o755)
73
-
74
-
75
- def main() -> int:
76
- """Main entry point for the GitCode CLI command."""
77
- try:
78
- binary_path = get_binary_path()
79
-
80
- ensure_executable(binary_path)
81
- env = os.environ.copy()
82
- env.setdefault(COMMAND_NAME_ENV, get_command_name())
83
-
84
- # Run the binary with all arguments
85
- result = subprocess.run(
86
- [str(binary_path)] + sys.argv[1:],
87
- cwd=os.getcwd(),
88
- env=env,
89
- )
90
-
91
- return result.returncode
92
-
93
- except FileNotFoundError as e:
94
- print(f"Error: {e}", file=sys.stderr)
95
- return 1
96
- except Exception as e:
97
- print(f"Error running GitCode CLI: {e}", file=sys.stderr)
98
- return 1
99
-
100
-
101
- if __name__ == "__main__":
102
- sys.exit(main())
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
+ COMMAND_NAME_ENV = "GITCODE_CLI_COMMAND_NAME"
15
+
16
+
17
+ def get_binary_name() -> str:
18
+ """Get the binary name for the current platform."""
19
+ system = platform.system().lower()
20
+ machine = platform.machine().lower()
21
+
22
+ # Map machine architecture
23
+ arch_map = {
24
+ "x86_64": "amd64",
25
+ "amd64": "amd64",
26
+ "aarch64": "arm64",
27
+ "arm64": "arm64",
28
+ }
29
+ arch = arch_map.get(machine, "amd64")
30
+
31
+ # Map system to binary name
32
+ if system == "linux":
33
+ return f"gc-linux-{arch}"
34
+ elif system == "darwin":
35
+ return f"gc-darwin-{arch}"
36
+ elif system == "windows":
37
+ return "gc-windows-amd64.exe"
38
+ else:
39
+ raise RuntimeError(f"Unsupported platform: {system} {machine}")
40
+
41
+
42
+ def get_binary_path() -> Path:
43
+ """Get the path to the binary for the current platform."""
44
+ package_dir = Path(__file__).parent
45
+ binary_name = get_binary_name()
46
+ binary_path = package_dir / "bin" / binary_name
47
+
48
+ if not binary_path.exists():
49
+ raise FileNotFoundError(
50
+ f"Binary not found for your platform: {binary_path}\n"
51
+ f"Supported platforms: linux-amd64, linux-arm64, darwin-amd64, darwin-arm64, windows-amd64"
52
+ )
53
+
54
+ return binary_path
55
+
56
+
57
+ def get_command_name() -> str:
58
+ """Get the command name that should appear in CLI output."""
59
+ command = Path(sys.argv[0]).stem.lower()
60
+ if command in {"gc", "gitcode"}:
61
+ return command
62
+ if platform.system() == "Windows":
63
+ return "gitcode"
64
+ return "gc"
65
+
66
+
67
+ def ensure_executable(binary_path: Path) -> None:
68
+ """Ensure packaged binaries are executable on POSIX platforms."""
69
+ if platform.system() == "Windows":
70
+ return
71
+ if not os.access(binary_path, os.X_OK):
72
+ binary_path.chmod(0o755)
73
+
74
+
75
+ def main() -> int:
76
+ """Main entry point for the GitCode CLI command."""
77
+ try:
78
+ binary_path = get_binary_path()
79
+
80
+ ensure_executable(binary_path)
81
+ env = os.environ.copy()
82
+ env.setdefault(COMMAND_NAME_ENV, get_command_name())
83
+
84
+ # Run the binary with all arguments
85
+ result = subprocess.run(
86
+ [str(binary_path)] + sys.argv[1:],
87
+ cwd=os.getcwd(),
88
+ env=env,
89
+ )
90
+
91
+ return result.returncode
92
+
93
+ except FileNotFoundError as e:
94
+ print(f"Error: {e}", file=sys.stderr)
95
+ return 1
96
+ except Exception as e:
97
+ print(f"Error running GitCode CLI: {e}", file=sys.stderr)
98
+ return 1
99
+
100
+
101
+ if __name__ == "__main__":
102
+ sys.exit(main())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitcode-cli
3
- Version: 0.5.9
3
+ Version: 0.5.14
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>
@@ -254,6 +254,8 @@ gc auth status
254
254
  # 结构化输出
255
255
  gc issue list -R owner/repo --json
256
256
  gc issue list -R owner/repo --format json
257
+ gc repo log -R owner/repo --file README.md --branch main --json
258
+ gc pr list -R owner/repo --paginate --per-page 100 --json
257
259
 
258
260
  # 常规文本与表格
259
261
  gc issue list -R owner/repo --format simple
@@ -265,6 +267,9 @@ gc issue list -R owner/repo --time-format relative
265
267
 
266
268
  # 自定义模板输出
267
269
  gc issue list -R owner/repo --template '{{range .}}#{{.Number}} {{.Title}}{{"\n"}}{{end}}'
270
+
271
+ # typed command 尚未覆盖的 API,可用 gc api 读取原始响应
272
+ gc api repos/owner/repo
268
273
  ```
269
274
 
270
275
  `issue view` 和 `pr view` 的文本详情展示也会保持稳定布局,而 `--json` 仍然是面向机器调用的首选入口。
@@ -277,6 +282,9 @@ gc issue list -R owner/repo --template '{{range .}}#{{.Number}} {{.Title}}{{"\n"
277
282
  # 查看仓库
278
283
  gc repo view
279
284
 
285
+ # 查看文件提交历史
286
+ gc repo log -R owner/repo --file README.md --branch main
287
+
280
288
  # 创建 Issue
281
289
  gc issue create --title "Bug report" --body "Description"
282
290
 
@@ -286,6 +294,12 @@ gc issue list --state open
286
294
  # 创建 PR
287
295
  gc pr create --title "New feature" --base main
288
296
 
297
+ # 按提交信息反查 PR
298
+ gc pr list -R owner/repo --commit-message "fix login"
299
+
300
+ # 调用 GitCode API 原始响应
301
+ gc api repos/owner/repo
302
+
289
303
  # 查看认证状态
290
304
  gc auth status
291
305
  ```
@@ -0,0 +1,15 @@
1
+ gc_cli/__init__.py,sha256=s7CqTQr3874eS2b3sL_YArG_1x1xr1VlpbJkc1T1wSQ,243
2
+ gc_cli/__main__.py,sha256=fqZ9iOh0ac8K_B9WmHydaxokzIivd5QBPJoNqgXnugo,154
3
+ gc_cli/wrapper.py,sha256=vq6JZIs7nZx_FugIljMjpNb0nxTiC0lQqfZ7Dhz6aMw,2744
4
+ gc_cli/bin/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ gc_cli/bin/gc-darwin-amd64,sha256=DcQYJRQ4OamMiAO8wD3qzN8SkOEam0rdp3lk4zZwYAw,8579248
6
+ gc_cli/bin/gc-darwin-arm64,sha256=OAjdRq-LAm8HQHcK2Y5yJwPH8qsGf-_ARjfshx5v7YU,8249954
7
+ gc_cli/bin/gc-linux-amd64,sha256=tF5Hro4iOKRHmJRxS7WYOCebvEY3XLbbe5Cbw2ShoUw,8355992
8
+ gc_cli/bin/gc-linux-arm64,sha256=JZ2XTQFP6Rrpt9nXa99X1FT0fjNG2mp8EDK9pckpUik,8061080
9
+ gc_cli/bin/gc-windows-amd64.exe,sha256=_0RR_-ej27PBlsjcKds22y41nqXt1Deg1N7n8aGLmOQ,8647680
10
+ gitcode_cli-0.5.14.dist-info/licenses/LICENSE,sha256=WsjkQaj0PPK_TKVoHDok218rd8JZdj1GIJ5TrrZD6jE,1253
11
+ gitcode_cli-0.5.14.dist-info/METADATA,sha256=Xc1CNG3wfJhS3UeeDKJfB41J4J2GH6BK1f1fuiQBxq8,10799
12
+ gitcode_cli-0.5.14.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
13
+ gitcode_cli-0.5.14.dist-info/entry_points.txt,sha256=DresfT5jkpwU3fPn8n0MTao1m5QZi3XEulKFbQ8BYYY,73
14
+ gitcode_cli-0.5.14.dist-info/top_level.txt,sha256=2fSmR3kQ-XhdgFQdVvWmZcEyERJKVZVxOhk7tna1Sus,7
15
+ gitcode_cli-0.5.14.dist-info/RECORD,,
@@ -1,28 +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
-
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
28
  Copyright (c) 2019 GitHub, Inc.
@@ -1,15 +0,0 @@
1
- gc_cli/__init__.py,sha256=fqkd0rDARF5RgvBcotyw5xy0M0cLV9xBN9MvPz0cmFg,253
2
- gc_cli/__main__.py,sha256=4IoaQc5w_ZsLDqiDifrGjllM76LLLUM2CSz2ifmwMmY,163
3
- gc_cli/wrapper.py,sha256=-nQsDyCvTunhgK24tuJ_tjqJJ1ErRs0hPfdHmUh1JDM,2846
4
- gc_cli/bin/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- gc_cli/bin/gc-darwin-amd64,sha256=PxcsPCJYe5MCz0GG3t8l3s3YeGaHomb4M1Twt9NXjyo,8537776
6
- gc_cli/bin/gc-darwin-arm64,sha256=KeW6WsCl22SqmUPsFWqsOJnDcVYZChhIxcknfC6j5RA,8199906
7
- gc_cli/bin/gc-linux-amd64,sha256=uCfWPcCsTfr6_fQ4lQUUz0iDu70rDVVeXNJNwf8_jVw,8315032
8
- gc_cli/bin/gc-linux-arm64,sha256=etO5RV116KswyC2wu-nyt-kjm0RMdmIxbC4qQG-0L14,7930008
9
- gc_cli/bin/gc-windows-amd64.exe,sha256=iKpMFHjMFo-7raB2wtcBtCFEyxrKhvr_s0tAzOGxZFg,8604672
10
- gitcode_cli-0.5.9.dist-info/licenses/LICENSE,sha256=23d4Rfrm1CLX092oLjzs2UTYcy5Sp-dpaji0IAHIsiE,1280
11
- gitcode_cli-0.5.9.dist-info/METADATA,sha256=ExyD2ACnESLHpBAiXhdp05LSuVXcnhQFypNbyEdk9jY,10354
12
- gitcode_cli-0.5.9.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
13
- gitcode_cli-0.5.9.dist-info/entry_points.txt,sha256=DresfT5jkpwU3fPn8n0MTao1m5QZi3XEulKFbQ8BYYY,73
14
- gitcode_cli-0.5.9.dist-info/top_level.txt,sha256=2fSmR3kQ-XhdgFQdVvWmZcEyERJKVZVxOhk7tna1Sus,7
15
- gitcode_cli-0.5.9.dist-info/RECORD,,