cmt-cli 1.0.2__tar.gz → 1.1.0__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.
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/PKG-INFO +2 -2
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/pyproject.toml +2 -2
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/ai/openai.py +13 -15
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/ai/prompt.py +1 -17
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/uv.lock +1 -1
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/.github/workflows/test.yml +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/.gitignore +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/.python-version +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/LICENSE +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/README.md +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/art/cmt-cli.svg +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/ai/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/ai/cache.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/ai/provider.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/analysis/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/analysis/analyzer.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/cli.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/core/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/core/logging.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/core/settings.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/enums/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/enums/config.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/exceptions.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/git/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/git/repository.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/models/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/models/changes.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/models/suggestion.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/schemas/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/schemas/config.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/schemas/general.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/services/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/services/pypi.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/src/cmt/utils.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/tests/__init__.py +0 -0
- {cmt_cli-1.0.2 → cmt_cli-1.1.0}/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
|
|
3
|
+
Version: 1.1.0
|
|
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
|
|
@@ -10,7 +10,7 @@ Project-URL: Changelog, https://github.com/bijaydas/cmt/releases
|
|
|
10
10
|
Author-email: Bijay Das <me@bijaydas.com>
|
|
11
11
|
License: MIT
|
|
12
12
|
License-File: LICENSE
|
|
13
|
-
Classifier: Development Status ::
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: License :: OSI Approved :: MIT License
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cmt-cli"
|
|
3
|
-
version = "1.0
|
|
3
|
+
version = "1.1.0"
|
|
4
4
|
description = "AI-powered Git commit message generator"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -14,7 +14,7 @@ dependencies = [
|
|
|
14
14
|
"typer>=0.27.1",
|
|
15
15
|
]
|
|
16
16
|
classifiers = [
|
|
17
|
-
"Development Status ::
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
18
|
"Intended Audience :: Developers",
|
|
19
19
|
"License :: OSI Approved :: MIT License",
|
|
20
20
|
"Programming Language :: 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.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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)
|
|
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
|
|
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
|