gcop-rs 0.4.2__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,33 @@
1
+ # Generated by Cargo
2
+ # will have compiled files and executables
3
+ debug
4
+ target
5
+
6
+ # These are backup files generated by rustfmt
7
+ **/*.rs.bk
8
+
9
+ # MSVC Windows builds of rustc generate these, which store debugging information
10
+ *.pdb
11
+
12
+ # Generated by cargo mutants
13
+ # Contains mutation testing data
14
+ **/mutants.out*/
15
+
16
+ # RustRover
17
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
20
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
21
+ #.idea/
22
+
23
+
24
+ # Added by cargo
25
+
26
+ /target
27
+
28
+ # gcop-rs 配置文件(可能包含 API key)
29
+ config.toml
30
+ *.toml.local
31
+
32
+ # macOS system files
33
+ .DS_Store
gcop_rs-0.4.2/PKG-INFO ADDED
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: gcop-rs
3
+ Version: 0.4.2
4
+ Summary: AI-powered Git commit message generator and code reviewer (Rust version)
5
+ Project-URL: Homepage, https://github.com/AptS-1547/gcop-rs
6
+ Project-URL: Repository, https://github.com/AptS-1547/gcop-rs
7
+ Project-URL: Issues, https://github.com/AptS-1547/gcop-rs/issues
8
+ Author-email: AptS-1547 <apts-1547@esaps.net>
9
+ License-Expression: MIT
10
+ Keywords: ai,cli,code-review,commit,git
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Rust
18
+ Classifier: Topic :: Software Development :: Version Control :: Git
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+
22
+ # gcop-rs
23
+
24
+ [![PyPI](https://img.shields.io/pypi/v/gcop-rs)](https://pypi.org/project/gcop-rs/)
25
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
26
+
27
+ AI-powered Git commit message generator and code reviewer, written in Rust.
28
+
29
+ This is a Python wrapper that automatically downloads and runs the pre-compiled Rust binary.
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ # Using pipx (recommended)
35
+ pipx install gcop-rs
36
+
37
+ # Using pip
38
+ pip install gcop-rs
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```bash
44
+ # Generate commit message
45
+ gcop-rs commit
46
+
47
+ # Code review
48
+ gcop-rs review
49
+
50
+ # Show help
51
+ gcop-rs --help
52
+ ```
53
+
54
+ ## Other Installation Methods
55
+
56
+ For native installation without Python:
57
+
58
+ ```bash
59
+ # Homebrew (macOS/Linux)
60
+ brew tap AptS-1547/gcop-rs
61
+ brew install gcop-rs
62
+
63
+ # cargo-binstall
64
+ cargo binstall gcop-rs
65
+
66
+ # cargo install
67
+ cargo install gcop-rs
68
+ ```
69
+
70
+ ## Documentation
71
+
72
+ See the [main repository](https://github.com/AptS-1547/gcop-rs) for full documentation.
73
+
74
+ ## License
75
+
76
+ MIT License
@@ -0,0 +1,55 @@
1
+ # gcop-rs
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/gcop-rs)](https://pypi.org/project/gcop-rs/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ AI-powered Git commit message generator and code reviewer, written in Rust.
7
+
8
+ This is a Python wrapper that automatically downloads and runs the pre-compiled Rust binary.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ # Using pipx (recommended)
14
+ pipx install gcop-rs
15
+
16
+ # Using pip
17
+ pip install gcop-rs
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```bash
23
+ # Generate commit message
24
+ gcop-rs commit
25
+
26
+ # Code review
27
+ gcop-rs review
28
+
29
+ # Show help
30
+ gcop-rs --help
31
+ ```
32
+
33
+ ## Other Installation Methods
34
+
35
+ For native installation without Python:
36
+
37
+ ```bash
38
+ # Homebrew (macOS/Linux)
39
+ brew tap AptS-1547/gcop-rs
40
+ brew install gcop-rs
41
+
42
+ # cargo-binstall
43
+ cargo binstall gcop-rs
44
+
45
+ # cargo install
46
+ cargo install gcop-rs
47
+ ```
48
+
49
+ ## Documentation
50
+
51
+ See the [main repository](https://github.com/AptS-1547/gcop-rs) for full documentation.
52
+
53
+ ## License
54
+
55
+ MIT License
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "gcop-rs"
7
+ version = "0.4.2"
8
+ description = "AI-powered Git commit message generator and code reviewer (Rust version)"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ authors = [
12
+ { name = "AptS-1547", email = "apts-1547@esaps.net" }
13
+ ]
14
+ keywords = ["git", "commit", "ai", "code-review", "cli"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Rust",
23
+ "Topic :: Software Development :: Version Control :: Git",
24
+ ]
25
+ requires-python = ">=3.8"
26
+ dependencies = []
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/AptS-1547/gcop-rs"
30
+ Repository = "https://github.com/AptS-1547/gcop-rs"
31
+ Issues = "https://github.com/AptS-1547/gcop-rs/issues"
32
+
33
+ [project.scripts]
34
+ gcop-rs = "gcop_rs:main"
35
+
36
+ [tool.hatch.build.targets.wheel]
37
+ packages = ["src/gcop_rs"]
@@ -0,0 +1,117 @@
1
+ """
2
+ gcop-rs: AI-powered Git commit message generator and code reviewer.
3
+
4
+ This is a Python wrapper that downloads and runs the pre-compiled Rust binary.
5
+ """
6
+
7
+ import os
8
+ import platform
9
+ import stat
10
+ import subprocess
11
+ import sys
12
+ import urllib.request
13
+ from pathlib import Path
14
+
15
+ __version__ = "0.4.2"
16
+
17
+ GITHUB_RELEASE_URL = "https://github.com/AptS-1547/gcop-rs/releases/download"
18
+
19
+
20
+ def get_binary_name() -> tuple[str, str]:
21
+ """Get the binary name for the current platform."""
22
+ system = platform.system().lower()
23
+ machine = platform.machine().lower()
24
+
25
+ # Normalize machine architecture
26
+ if machine in ("x86_64", "amd64"):
27
+ arch = "amd64"
28
+ elif machine in ("arm64", "aarch64"):
29
+ arch = "arm64"
30
+ else:
31
+ raise RuntimeError(f"Unsupported architecture: {machine}")
32
+
33
+ # Determine platform string
34
+ if system == "darwin":
35
+ platform_str = f"macos-{arch}"
36
+ binary_name = "gcop-rs"
37
+ elif system == "linux":
38
+ platform_str = f"linux-{arch}"
39
+ binary_name = "gcop-rs"
40
+ elif system == "windows":
41
+ if arch == "arm64":
42
+ platform_str = "windows-aarch64.exe"
43
+ else:
44
+ platform_str = "windows-amd64.exe"
45
+ binary_name = "gcop-rs.exe"
46
+ else:
47
+ raise RuntimeError(f"Unsupported operating system: {system}")
48
+
49
+ return platform_str, binary_name
50
+
51
+
52
+ def get_binary_path() -> Path:
53
+ """Get the path where the binary should be stored."""
54
+ # Store in user's cache directory
55
+ if platform.system() == "Windows":
56
+ cache_dir = Path(os.environ.get("LOCALAPPDATA", Path.home() / "AppData" / "Local"))
57
+ elif platform.system() == "Darwin":
58
+ cache_dir = Path.home() / "Library" / "Caches"
59
+ else:
60
+ cache_dir = Path(os.environ.get("XDG_CACHE_HOME", Path.home() / ".cache"))
61
+
62
+ return cache_dir / "gcop-rs" / "bin"
63
+
64
+
65
+ def download_binary() -> Path:
66
+ """Download the binary for the current platform."""
67
+ platform_str, binary_name = get_binary_name()
68
+ bin_dir = get_binary_path()
69
+ bin_dir.mkdir(parents=True, exist_ok=True)
70
+
71
+ binary_path = bin_dir / binary_name
72
+ version_file = bin_dir / "version"
73
+
74
+ # Check if we already have the correct version
75
+ if binary_path.exists() and version_file.exists():
76
+ current_version = version_file.read_text().strip()
77
+ if current_version == __version__:
78
+ return binary_path
79
+
80
+ # Download the binary
81
+ url = f"{GITHUB_RELEASE_URL}/v{__version__}/gcop-rs-v{__version__}-{platform_str}"
82
+ print(f"Downloading gcop-rs v{__version__} for {platform_str}...", file=sys.stderr)
83
+
84
+ try:
85
+ urllib.request.urlretrieve(url, binary_path)
86
+ except Exception as e:
87
+ raise RuntimeError(f"Failed to download binary from {url}: {e}") from e
88
+
89
+ # Make executable on Unix
90
+ if platform.system() != "Windows":
91
+ binary_path.chmod(binary_path.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
92
+
93
+ # Save version
94
+ version_file.write_text(__version__)
95
+
96
+ print(f"Downloaded to {binary_path}", file=sys.stderr)
97
+ return binary_path
98
+
99
+
100
+ def main() -> int:
101
+ """Main entry point - download binary if needed and run it."""
102
+ try:
103
+ binary_path = download_binary()
104
+ except Exception as e:
105
+ print(f"Error: {e}", file=sys.stderr)
106
+ return 1
107
+
108
+ # Run the binary with all arguments
109
+ try:
110
+ result = subprocess.run([str(binary_path)] + sys.argv[1:])
111
+ return result.returncode
112
+ except KeyboardInterrupt:
113
+ return 130
114
+
115
+
116
+ if __name__ == "__main__":
117
+ sys.exit(main())