git-commit-msg-ai 1.4.0__py3-none-any.whl → 1.4.2__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.
@@ -1,11 +1,19 @@
1
1
  import subprocess
2
+ from typing import Final
2
3
 
3
4
  from git_commit_msg_ai.exceptions import GitError
4
5
 
6
+ GIT_COMMAND: Final[str] = 'git'
7
+ DIFF_SUBCOMMAND: Final[str] = 'diff'
8
+ CACHED_FLAG: Final[str] = '--cached'
9
+ COMMIT_SUBCOMMAND: Final[str] = 'commit'
10
+ MESSAGE_FLAG: Final[str] = '-m'
11
+ UTF8_ENCODING: Final[str] = 'utf-8'
12
+
5
13
 
6
14
  def get_staged_diff() -> str:
7
15
  try:
8
- staged_diff = subprocess.check_output(['git', 'diff', '--cached']).decode('utf-8')
16
+ staged_diff = subprocess.check_output([GIT_COMMAND, DIFF_SUBCOMMAND, CACHED_FLAG]).decode(UTF8_ENCODING)
9
17
  except FileNotFoundError:
10
18
  raise GitError('git is not installed or not on PATH.')
11
19
  except subprocess.CalledProcessError:
@@ -21,7 +29,7 @@ def get_staged_diff() -> str:
21
29
 
22
30
  def commit(message: str) -> None:
23
31
  try:
24
- subprocess.run(['git', 'commit', '-m', message], check=True)
32
+ subprocess.run([GIT_COMMAND, COMMIT_SUBCOMMAND, MESSAGE_FLAG, message], check=True)
25
33
  except FileNotFoundError:
26
34
  raise GitError('git is not installed or not on PATH.')
27
35
  except subprocess.CalledProcessError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commit-msg-ai
3
- Version: 1.4.0
3
+ Version: 1.4.2
4
4
  Summary: AI-powered git commit message generator following Conventional Commits
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -11,6 +11,8 @@ Requires-Dist: mypy; extra == "dev"
11
11
  Requires-Dist: ruff; extra == "dev"
12
12
  Requires-Dist: pytest; extra == "dev"
13
13
  Requires-Dist: pytest-cov; extra == "dev"
14
+ Requires-Dist: build; extra == "dev"
15
+ Requires-Dist: twine; extra == "dev"
14
16
 
15
17
  # git-commit-msg-ai
16
18
 
@@ -29,6 +31,38 @@ AI-powered git commit message generator that follows the [Conventional Commits](
29
31
  [System.Environment]::SetEnvironmentVariable('ANTHROPIC_API_KEY', 'sk-ant-...', 'User') # Windows
30
32
  ```
31
33
 
34
+ ## Development Setup
35
+
36
+ Clone the repository, create a virtual environment, and install the project in editable mode with all dev dependencies:
37
+
38
+ ```sh
39
+ python -m venv .venv
40
+ ```
41
+
42
+ Activate the virtual environment:
43
+
44
+ ```sh
45
+ # macOS/Linux
46
+ source .venv/bin/activate
47
+
48
+ # Windows PowerShell
49
+ .venv\Scripts\Activate.ps1
50
+ ```
51
+
52
+ Install the project and dev dependencies:
53
+
54
+ ```sh
55
+ pip install -e ".[dev]"
56
+ ```
57
+
58
+ After activation the `git-commit-msg-ai` entry-point is on your PATH. You can also run the dev toolchain:
59
+
60
+ ```sh
61
+ pytest # run tests with coverage
62
+ ruff check . # lint
63
+ mypy . # type-check
64
+ ```
65
+
32
66
  ## Installation
33
67
 
34
68
  ```sh
@@ -53,9 +87,9 @@ The tool will:
53
87
  [a]ccept / [e]dit / [r]eject:
54
88
  ```
55
89
 
56
- - **a** commits immediately with the generated message
57
- - **e** opens the message in your `$EDITOR` (defaults to `notepad` on Windows, `vi` on Linux/macOS), lets you modify it, then commits
58
- - **r** exits without committing
90
+ - **a** - commits immediately with the generated message
91
+ - **e** - opens the message in your `$EDITOR` (defaults to `notepad` on Windows, `vi` on Linux/macOS), lets you modify it, then commits
92
+ - **r** - exits without committing
59
93
 
60
94
  ## Commit message format
61
95
 
@@ -3,9 +3,9 @@ git_commit_msg_ai/ai_client.py,sha256=RnzgIx1ieuiiH6w2VijA6_F-cs6tIQR57W1x3avg8l
3
3
  git_commit_msg_ai/cli.py,sha256=s94orvxin-38vqUYWAO-j5_JZTzxBXbZSVOHYZ5KO_k,1059
4
4
  git_commit_msg_ai/editor.py,sha256=JnVm5SZwkunyfOjisDKvTuPm3_NPbijVk_ho_yQy-3o,1430
5
5
  git_commit_msg_ai/exceptions.py,sha256=7Hwluf3zHMjs4lpGktWS-Lwgo8y_4Xbb1WqzPQHkkUA,352
6
- git_commit_msg_ai/git_ops.py,sha256=vYc3sLdpWk8KE2dpSemww8mvga-1DV5Z3eDA7NqPAaE,977
7
- git_commit_msg_ai-1.4.0.dist-info/METADATA,sha256=AYGCKtLplgI_qCA_Uy84JIQSuk1PC7EsylmvXdLByR8,2066
8
- git_commit_msg_ai-1.4.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
9
- git_commit_msg_ai-1.4.0.dist-info/entry_points.txt,sha256=KTu6wUhl0p3nf27k8L4vpSH_hpeRQpwzMPSmKv7K5Cs,65
10
- git_commit_msg_ai-1.4.0.dist-info/top_level.txt,sha256=XYQC2BXvrcREGKEG7sm9nbwO7ifqcUSVgU7SW8BTURs,18
11
- git_commit_msg_ai-1.4.0.dist-info/RECORD,,
6
+ git_commit_msg_ai/git_ops.py,sha256=k2kjwcvj0Ac-WAttSsMP8pIl4-WXUKK47thgjaB62Og,1263
7
+ git_commit_msg_ai-1.4.2.dist-info/METADATA,sha256=BzSJx7Vdzjo9CrRi2-88_HvbR1aQjJnci2deJQvtthQ,2768
8
+ git_commit_msg_ai-1.4.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
9
+ git_commit_msg_ai-1.4.2.dist-info/entry_points.txt,sha256=KTu6wUhl0p3nf27k8L4vpSH_hpeRQpwzMPSmKv7K5Cs,65
10
+ git_commit_msg_ai-1.4.2.dist-info/top_level.txt,sha256=XYQC2BXvrcREGKEG7sm9nbwO7ifqcUSVgU7SW8BTURs,18
11
+ git_commit_msg_ai-1.4.2.dist-info/RECORD,,