cmt-cli 1.2.0__tar.gz → 1.2.1__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.
Files changed (38) hide show
  1. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/PKG-INFO +1 -1
  2. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/pyproject.toml +1 -1
  3. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/git/repository.py +18 -8
  4. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/.github/workflows/test.yml +0 -0
  5. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/.gitignore +0 -0
  6. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/.python-version +0 -0
  7. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/LICENSE +0 -0
  8. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/README.md +0 -0
  9. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/art/cmt-cli.svg +0 -0
  10. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/__init__.py +0 -0
  11. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/ai/__init__.py +0 -0
  12. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/ai/cache.py +0 -0
  13. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/ai/openai.py +0 -0
  14. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/ai/prompt.py +0 -0
  15. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/ai/provider.py +0 -0
  16. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/analysis/__init__.py +0 -0
  17. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/analysis/analyzer.py +0 -0
  18. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/cli.py +0 -0
  19. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/core/__init__.py +0 -0
  20. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/core/console.py +0 -0
  21. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/core/logging.py +0 -0
  22. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/core/settings.py +0 -0
  23. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/enums/__init__.py +0 -0
  24. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/enums/config.py +0 -0
  25. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/exceptions.py +0 -0
  26. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/git/__init__.py +0 -0
  27. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/models/__init__.py +0 -0
  28. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/models/changes.py +0 -0
  29. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/models/suggestion.py +0 -0
  30. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/schemas/__init__.py +0 -0
  31. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/schemas/config.py +0 -0
  32. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/schemas/general.py +0 -0
  33. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/services/__init__.py +0 -0
  34. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/services/pypi.py +0 -0
  35. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/src/cmt/utils.py +0 -0
  36. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/tests/__init__.py +0 -0
  37. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/tests/unit/test_repository.py +0 -0
  38. {cmt_cli-1.2.0 → cmt_cli-1.2.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cmt-cli
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: AI-powered Git commit message generator
5
5
  Project-URL: Homepage, https://github.com/bijaydas/cmt
6
6
  Project-URL: Documentation, https://github.com/bijaydas/cmt#readme
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cmt-cli"
3
- version = "1.2.0"
3
+ version = "1.2.1"
4
4
  description = "AI-powered Git commit message generator"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,7 @@
1
1
  import subprocess
2
2
  from pathlib import Path
3
3
 
4
+ from cmt.exceptions import GitError
4
5
  from cmt.models.changes import StagedChangeSet, StagedFile
5
6
 
6
7
 
@@ -9,19 +10,28 @@ class Repository:
9
10
  self.root = Path(root) if root is not None else Path.cwd()
10
11
 
11
12
  def _execute(self, command: list[str]) -> subprocess.CompletedProcess:
12
- return subprocess.run(
13
- command,
14
- cwd=self.root,
15
- capture_output=True,
16
- check=True,
17
- text=True
18
- )
13
+ try:
14
+ return subprocess.run(
15
+ command,
16
+ cwd=self.root,
17
+ capture_output=True,
18
+ check=True,
19
+ text=True
20
+ )
21
+ except subprocess.CalledProcessError as e:
22
+ # Git writes some failure messages (e.g. "nothing to commit") to
23
+ # stdout rather than stderr, so both are checked.
24
+ output = "\n".join(filter(None, [e.stdout, e.stderr])).strip()
25
+ output = output or "no error output was returned."
26
+ raise GitError(
27
+ f"Command '{' '.join(command)}' failed:\n{output}"
28
+ ) from e
19
29
 
20
30
  def is_git_repository(self):
21
31
  try:
22
32
  result = self._execute(["git", "rev-parse", "--is-inside-work-tree"])
23
33
  return result.stdout.strip() == "true"
24
- except subprocess.CalledProcessError:
34
+ except GitError:
25
35
  return False
26
36
 
27
37
  def _get_staged_files(self) -> list[StagedFile]:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes