git-commit-msg-ai 1.4.0__py3-none-any.whl → 1.4.1__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.1
4
4
  Summary: AI-powered git commit message generator following Conventional Commits
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -53,9 +53,9 @@ The tool will:
53
53
  [a]ccept / [e]dit / [r]eject:
54
54
  ```
55
55
 
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
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
59
59
 
60
60
  ## Commit message format
61
61
 
@@ -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.1.dist-info/METADATA,sha256=9kdehx_hvkMAnv_TOUix-TxdPAU3Xd4ogCquDtJCWSg,2060
8
+ git_commit_msg_ai-1.4.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
9
+ git_commit_msg_ai-1.4.1.dist-info/entry_points.txt,sha256=KTu6wUhl0p3nf27k8L4vpSH_hpeRQpwzMPSmKv7K5Cs,65
10
+ git_commit_msg_ai-1.4.1.dist-info/top_level.txt,sha256=XYQC2BXvrcREGKEG7sm9nbwO7ifqcUSVgU7SW8BTURs,18
11
+ git_commit_msg_ai-1.4.1.dist-info/RECORD,,