cmt-cli 1.0.2__tar.gz → 1.0.3__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 (37) hide show
  1. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/PKG-INFO +1 -1
  2. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/pyproject.toml +1 -1
  3. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/ai/openai.py +13 -15
  4. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/ai/prompt.py +1 -17
  5. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/uv.lock +1 -1
  6. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/.github/workflows/test.yml +0 -0
  7. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/.gitignore +0 -0
  8. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/.python-version +0 -0
  9. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/LICENSE +0 -0
  10. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/README.md +0 -0
  11. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/art/cmt-cli.svg +0 -0
  12. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/__init__.py +0 -0
  13. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/ai/__init__.py +0 -0
  14. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/ai/cache.py +0 -0
  15. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/ai/provider.py +0 -0
  16. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/analysis/__init__.py +0 -0
  17. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/analysis/analyzer.py +0 -0
  18. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/cli.py +0 -0
  19. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/core/__init__.py +0 -0
  20. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/core/logging.py +0 -0
  21. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/core/settings.py +0 -0
  22. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/enums/__init__.py +0 -0
  23. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/enums/config.py +0 -0
  24. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/exceptions.py +0 -0
  25. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/git/__init__.py +0 -0
  26. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/git/repository.py +0 -0
  27. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/models/__init__.py +0 -0
  28. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/models/changes.py +0 -0
  29. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/models/suggestion.py +0 -0
  30. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/schemas/__init__.py +0 -0
  31. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/schemas/config.py +0 -0
  32. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/schemas/general.py +0 -0
  33. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/services/__init__.py +0 -0
  34. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/services/pypi.py +0 -0
  35. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/src/cmt/utils.py +0 -0
  36. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/tests/__init__.py +0 -0
  37. {cmt_cli-1.0.2 → cmt_cli-1.0.3}/tests/unit/test_repository.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cmt-cli
3
- Version: 1.0.2
3
+ Version: 1.0.3
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.0.2"
3
+ version = "1.0.3"
4
4
  description = "AI-powered Git commit message generator"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,7 +1,6 @@
1
1
  import logging
2
2
 
3
3
  from langchain.agents import create_agent
4
- from langchain_core.messages import BaseMessage, get_buffer_string
5
4
  from langchain_openai import ChatOpenAI
6
5
  from pydantic import SecretStr
7
6
 
@@ -19,20 +18,20 @@ class OpenAIProvider(AIProvider):
19
18
  def __init__(self) -> None:
20
19
  self.config = settings.get()
21
20
 
22
- def _build_prompt(
23
- self, changes: StagedChangeSet, analysis: AnalysisResult
24
- ) -> list[BaseMessage]:
21
+ def _build_prompt(self, changes: StagedChangeSet, analysis: AnalysisResult):
25
22
  staged_files = self._process_files(changes.files)
26
23
  staged_diffs = changes.diff
27
24
 
28
- return COMMIT_PROMPT_TEMPLATE.format_messages(
29
- total_files=len(changes.files),
30
- added_files=analysis.added_files,
31
- modified_files=analysis.modified_files,
32
- deleted_files=analysis.deleted_files,
33
- renamed_files=analysis.renamed_files,
34
- staged_files=staged_files,
35
- staged_diffs=staged_diffs,
25
+ return COMMIT_PROMPT_TEMPLATE.invoke(
26
+ {
27
+ "total_files": len(changes.files),
28
+ "added_files": analysis.added_files,
29
+ "modified_files": analysis.modified_files,
30
+ "deleted_files": analysis.deleted_files,
31
+ "renamed_files": analysis.renamed_files,
32
+ "staged_files": staged_files,
33
+ "staged_diffs": staged_diffs,
34
+ }
36
35
  )
37
36
 
38
37
  @staticmethod
@@ -49,9 +48,7 @@ class OpenAIProvider(AIProvider):
49
48
  api_key=SecretStr(self.config.api_key),
50
49
  timeout=30,
51
50
  )
52
- logger.info(
53
- "Invoking %s model with prompt:\n%s", self.config.model, get_buffer_string(prompt)
54
- )
51
+ logger.info("Invoking %s model with prompt:\n%s", self.config.model, prompt.to_string())
55
52
 
56
53
  agent = create_agent(
57
54
  model=model,
@@ -82,6 +79,7 @@ class OpenAIProvider(AIProvider):
82
79
  suggestion.message,
83
80
  )
84
81
  return suggestion
82
+
85
83
  suggestion = self._invoke(prompt)
86
84
 
87
85
  logger.info("Generated new commit suggestion.\n%s", suggestion)
@@ -59,20 +59,4 @@ Renamed: {renamed_files}
59
59
  Generate the commit message now.
60
60
  """
61
61
 
62
- COMMIT_PROMPT1 = ChatPromptTemplate.from_messages(
63
- [
64
- ("human", COMMIT_DATA_PROMPT),
65
- ]
66
- )
67
-
68
- COMMIT_PROMPT_TEMPLATE2 = ChatPromptTemplate(
69
- [
70
- ("human", COMMIT_DATA_PROMPT),
71
- ]
72
- )
73
-
74
- COMMIT_PROMPT_TEMPLATE = ChatPromptTemplate.from_messages(
75
- [
76
- ("human", COMMIT_DATA_PROMPT),
77
- ]
78
- )
62
+ COMMIT_PROMPT_TEMPLATE = ChatPromptTemplate.from_template(COMMIT_DATA_PROMPT)
@@ -175,7 +175,7 @@ wheels = [
175
175
 
176
176
  [[package]]
177
177
  name = "cmt-cli"
178
- version = "1.0.1"
178
+ version = "1.0.3"
179
179
  source = { editable = "." }
180
180
  dependencies = [
181
181
  { name = "langchain" },
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