cli-comet 1.2.0__tar.gz → 1.2.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.
- cli_comet-1.2.3/PKG-INFO +102 -0
- cli_comet-1.2.3/README.md +83 -0
- cli_comet-1.2.3/cli_comet.egg-info/PKG-INFO +102 -0
- {cli_comet-1.2.0 → cli_comet-1.2.3}/comet/cli.py +104 -16
- {cli_comet-1.2.0 → cli_comet-1.2.3}/comet/system.md +14 -4
- {cli_comet-1.2.0 → cli_comet-1.2.3}/pyproject.toml +2 -2
- {cli_comet-1.2.0 → cli_comet-1.2.3}/setup.cfg +2 -2
- cli_comet-1.2.0/PKG-INFO +0 -81
- cli_comet-1.2.0/README.md +0 -62
- cli_comet-1.2.0/cli_comet.egg-info/PKG-INFO +0 -81
- {cli_comet-1.2.0 → cli_comet-1.2.3}/LICENSE +0 -0
- {cli_comet-1.2.0 → cli_comet-1.2.3}/MANIFEST.in +0 -0
- {cli_comet-1.2.0 → cli_comet-1.2.3}/cli_comet.egg-info/SOURCES.txt +0 -0
- {cli_comet-1.2.0 → cli_comet-1.2.3}/cli_comet.egg-info/dependency_links.txt +0 -0
- {cli_comet-1.2.0 → cli_comet-1.2.3}/cli_comet.egg-info/entry_points.txt +0 -0
- {cli_comet-1.2.0 → cli_comet-1.2.3}/cli_comet.egg-info/requires.txt +0 -0
- {cli_comet-1.2.0 → cli_comet-1.2.3}/cli_comet.egg-info/top_level.txt +0 -0
- {cli_comet-1.2.0 → cli_comet-1.2.3}/comet/__init__.py +0 -0
cli_comet-1.2.3/PKG-INFO
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cli-comet
|
|
3
|
+
Version: 1.2.3
|
|
4
|
+
Summary: A terminal UI that automatically generates git commit messages using local language models via Ollama.
|
|
5
|
+
Home-page: https://github.com/razoring/CometCLI
|
|
6
|
+
Author: razoring
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: ollama
|
|
15
|
+
Requires-Dist: textual
|
|
16
|
+
Requires-Dist: colorama
|
|
17
|
+
Requires-Dist: openai
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Comet CLI
|
|
21
|
+
|
|
22
|
+
Comet helps you save tokens! Comet is a terminal user interface application that automatically generates descriptive git commit messages using local language models via Ollama or LMStudio. It analyzes your staged git diffs and provides a clean interface to review, edit, regenerate, and commit your changes instantly.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **Instant Boot**: The UI renders instantly with zero latency, utilizing background threading for network auto-detection and initialization.
|
|
27
|
+
- **Provider Auto-Detection**: Automatically detects whether you are running Ollama or LMStudio locally without requiring configuration, while allowing overrides via the `--provider` flag.
|
|
28
|
+
- **Persistent Settings**: Comet remembers your last successfully used provider and model in a `settings.json` file inside the installation directory, skipping auto-detection on future boot-ups.
|
|
29
|
+
- **Local Model Generation**: Connects to your local AI servers to generate commit messages entirely privately.
|
|
30
|
+
- **Model Swapping**: Press `tab` to cycle through available local models directly from the interface.
|
|
31
|
+
- **Context Aware**: Automatically pulls in the last 5 commits to understand the tone and style of your project.
|
|
32
|
+
- **Terminal User Interface**: Built with Textual. It provides a dedicated text area to edit the generated message.
|
|
33
|
+
- **Dynamic Newlines**: Use the down arrow key on the last line to seamlessly add new lines to your commit message, and the up arrow key to remove them.
|
|
34
|
+
- **Quick Undo**: Press `ctrl+z` to instantly undo the last local commit if you need to make changes.
|
|
35
|
+
- **Direct Syncing**: Commit your changes and immediately push them to your remote repository with a second press of the commit button.
|
|
36
|
+
- **Customizable Prompts**: The instructions provided to the language model are stored in `comet/system.md` and can be edited to fit your specific workflow.
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
|
|
40
|
+
- Python 3.10 or higher
|
|
41
|
+
- Git installed and accessible in your system path
|
|
42
|
+
- Ollama or LMStudio installed and running locally
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
The recommended way to install Comet is globally using `pipx`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pipx install cli-comet
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Installation from Source
|
|
53
|
+
|
|
54
|
+
Clone the repository and install the required dependencies:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/razoring/CometCLI.git
|
|
58
|
+
cd CometCLI
|
|
59
|
+
python -m venv .venv
|
|
60
|
+
|
|
61
|
+
# On Windows
|
|
62
|
+
.venv\Scripts\activate
|
|
63
|
+
|
|
64
|
+
# On Unix/macOS
|
|
65
|
+
source .venv/bin/activate
|
|
66
|
+
|
|
67
|
+
pip install -e .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
Ensure you have staged your changes using `git add` and that Ollama or LMStudio is running in the background.
|
|
73
|
+
|
|
74
|
+
Run the Comet application:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
comet
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
You can optionally force a specific provider:
|
|
81
|
+
```bash
|
|
82
|
+
comet --provider ollama
|
|
83
|
+
comet --provider lmstudio
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Keyboard Shortcuts
|
|
87
|
+
|
|
88
|
+
- `enter`: Commit the current text. If pressed again, it will push the commit to the remote repository.
|
|
89
|
+
- `tab`: Swap the active language model.
|
|
90
|
+
- `ctrl+r`: Regenerate the commit message with the current model.
|
|
91
|
+
- `ctrl+z`: Undo the most recent local commit.
|
|
92
|
+
- `ctrl+t`: Terminate the application.
|
|
93
|
+
- `down arrow`: Add a new line when at the bottom of the text area.
|
|
94
|
+
- `up arrow`: Remove the previous empty line.
|
|
95
|
+
|
|
96
|
+
## Architecture
|
|
97
|
+
|
|
98
|
+
Comet uses the `subprocess` module to run git commands and capture diffs. It reads the local `comet/system.md` file for system instructions and sends the diff to the selected provider's API. The interface is built using Textual, providing responsive keyboard bindings and a resilient terminal layout. All blocking network logic runs in an asynchronous `@work` thread to ensure 0ms UI start latency.
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the `LICENSE` file for details.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Comet CLI
|
|
2
|
+
|
|
3
|
+
Comet helps you save tokens! Comet is a terminal user interface application that automatically generates descriptive git commit messages using local language models via Ollama or LMStudio. It analyzes your staged git diffs and provides a clean interface to review, edit, regenerate, and commit your changes instantly.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Instant Boot**: The UI renders instantly with zero latency, utilizing background threading for network auto-detection and initialization.
|
|
8
|
+
- **Provider Auto-Detection**: Automatically detects whether you are running Ollama or LMStudio locally without requiring configuration, while allowing overrides via the `--provider` flag.
|
|
9
|
+
- **Persistent Settings**: Comet remembers your last successfully used provider and model in a `settings.json` file inside the installation directory, skipping auto-detection on future boot-ups.
|
|
10
|
+
- **Local Model Generation**: Connects to your local AI servers to generate commit messages entirely privately.
|
|
11
|
+
- **Model Swapping**: Press `tab` to cycle through available local models directly from the interface.
|
|
12
|
+
- **Context Aware**: Automatically pulls in the last 5 commits to understand the tone and style of your project.
|
|
13
|
+
- **Terminal User Interface**: Built with Textual. It provides a dedicated text area to edit the generated message.
|
|
14
|
+
- **Dynamic Newlines**: Use the down arrow key on the last line to seamlessly add new lines to your commit message, and the up arrow key to remove them.
|
|
15
|
+
- **Quick Undo**: Press `ctrl+z` to instantly undo the last local commit if you need to make changes.
|
|
16
|
+
- **Direct Syncing**: Commit your changes and immediately push them to your remote repository with a second press of the commit button.
|
|
17
|
+
- **Customizable Prompts**: The instructions provided to the language model are stored in `comet/system.md` and can be edited to fit your specific workflow.
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Python 3.10 or higher
|
|
22
|
+
- Git installed and accessible in your system path
|
|
23
|
+
- Ollama or LMStudio installed and running locally
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
The recommended way to install Comet is globally using `pipx`:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pipx install cli-comet
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Installation from Source
|
|
34
|
+
|
|
35
|
+
Clone the repository and install the required dependencies:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git clone https://github.com/razoring/CometCLI.git
|
|
39
|
+
cd CometCLI
|
|
40
|
+
python -m venv .venv
|
|
41
|
+
|
|
42
|
+
# On Windows
|
|
43
|
+
.venv\Scripts\activate
|
|
44
|
+
|
|
45
|
+
# On Unix/macOS
|
|
46
|
+
source .venv/bin/activate
|
|
47
|
+
|
|
48
|
+
pip install -e .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
Ensure you have staged your changes using `git add` and that Ollama or LMStudio is running in the background.
|
|
54
|
+
|
|
55
|
+
Run the Comet application:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
comet
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
You can optionally force a specific provider:
|
|
62
|
+
```bash
|
|
63
|
+
comet --provider ollama
|
|
64
|
+
comet --provider lmstudio
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Keyboard Shortcuts
|
|
68
|
+
|
|
69
|
+
- `enter`: Commit the current text. If pressed again, it will push the commit to the remote repository.
|
|
70
|
+
- `tab`: Swap the active language model.
|
|
71
|
+
- `ctrl+r`: Regenerate the commit message with the current model.
|
|
72
|
+
- `ctrl+z`: Undo the most recent local commit.
|
|
73
|
+
- `ctrl+t`: Terminate the application.
|
|
74
|
+
- `down arrow`: Add a new line when at the bottom of the text area.
|
|
75
|
+
- `up arrow`: Remove the previous empty line.
|
|
76
|
+
|
|
77
|
+
## Architecture
|
|
78
|
+
|
|
79
|
+
Comet uses the `subprocess` module to run git commands and capture diffs. It reads the local `comet/system.md` file for system instructions and sends the diff to the selected provider's API. The interface is built using Textual, providing responsive keyboard bindings and a resilient terminal layout. All blocking network logic runs in an asynchronous `@work` thread to ensure 0ms UI start latency.
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the `LICENSE` file for details.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cli-comet
|
|
3
|
+
Version: 1.2.3
|
|
4
|
+
Summary: A terminal UI that automatically generates git commit messages using local language models via Ollama.
|
|
5
|
+
Home-page: https://github.com/razoring/CometCLI
|
|
6
|
+
Author: razoring
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: ollama
|
|
15
|
+
Requires-Dist: textual
|
|
16
|
+
Requires-Dist: colorama
|
|
17
|
+
Requires-Dist: openai
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Comet CLI
|
|
21
|
+
|
|
22
|
+
Comet helps you save tokens! Comet is a terminal user interface application that automatically generates descriptive git commit messages using local language models via Ollama or LMStudio. It analyzes your staged git diffs and provides a clean interface to review, edit, regenerate, and commit your changes instantly.
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **Instant Boot**: The UI renders instantly with zero latency, utilizing background threading for network auto-detection and initialization.
|
|
27
|
+
- **Provider Auto-Detection**: Automatically detects whether you are running Ollama or LMStudio locally without requiring configuration, while allowing overrides via the `--provider` flag.
|
|
28
|
+
- **Persistent Settings**: Comet remembers your last successfully used provider and model in a `settings.json` file inside the installation directory, skipping auto-detection on future boot-ups.
|
|
29
|
+
- **Local Model Generation**: Connects to your local AI servers to generate commit messages entirely privately.
|
|
30
|
+
- **Model Swapping**: Press `tab` to cycle through available local models directly from the interface.
|
|
31
|
+
- **Context Aware**: Automatically pulls in the last 5 commits to understand the tone and style of your project.
|
|
32
|
+
- **Terminal User Interface**: Built with Textual. It provides a dedicated text area to edit the generated message.
|
|
33
|
+
- **Dynamic Newlines**: Use the down arrow key on the last line to seamlessly add new lines to your commit message, and the up arrow key to remove them.
|
|
34
|
+
- **Quick Undo**: Press `ctrl+z` to instantly undo the last local commit if you need to make changes.
|
|
35
|
+
- **Direct Syncing**: Commit your changes and immediately push them to your remote repository with a second press of the commit button.
|
|
36
|
+
- **Customizable Prompts**: The instructions provided to the language model are stored in `comet/system.md` and can be edited to fit your specific workflow.
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
|
|
40
|
+
- Python 3.10 or higher
|
|
41
|
+
- Git installed and accessible in your system path
|
|
42
|
+
- Ollama or LMStudio installed and running locally
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
The recommended way to install Comet is globally using `pipx`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pipx install cli-comet
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Installation from Source
|
|
53
|
+
|
|
54
|
+
Clone the repository and install the required dependencies:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/razoring/CometCLI.git
|
|
58
|
+
cd CometCLI
|
|
59
|
+
python -m venv .venv
|
|
60
|
+
|
|
61
|
+
# On Windows
|
|
62
|
+
.venv\Scripts\activate
|
|
63
|
+
|
|
64
|
+
# On Unix/macOS
|
|
65
|
+
source .venv/bin/activate
|
|
66
|
+
|
|
67
|
+
pip install -e .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
Ensure you have staged your changes using `git add` and that Ollama or LMStudio is running in the background.
|
|
73
|
+
|
|
74
|
+
Run the Comet application:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
comet
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
You can optionally force a specific provider:
|
|
81
|
+
```bash
|
|
82
|
+
comet --provider ollama
|
|
83
|
+
comet --provider lmstudio
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Keyboard Shortcuts
|
|
87
|
+
|
|
88
|
+
- `enter`: Commit the current text. If pressed again, it will push the commit to the remote repository.
|
|
89
|
+
- `tab`: Swap the active language model.
|
|
90
|
+
- `ctrl+r`: Regenerate the commit message with the current model.
|
|
91
|
+
- `ctrl+z`: Undo the most recent local commit.
|
|
92
|
+
- `ctrl+t`: Terminate the application.
|
|
93
|
+
- `down arrow`: Add a new line when at the bottom of the text area.
|
|
94
|
+
- `up arrow`: Remove the previous empty line.
|
|
95
|
+
|
|
96
|
+
## Architecture
|
|
97
|
+
|
|
98
|
+
Comet uses the `subprocess` module to run git commands and capture diffs. It reads the local `comet/system.md` file for system instructions and sends the diff to the selected provider's API. The interface is built using Textual, providing responsive keyboard bindings and a resilient terminal layout. All blocking network logic runs in an asynchronous `@work` thread to ensure 0ms UI start latency.
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the `LICENSE` file for details.
|
|
@@ -7,6 +7,7 @@ import os
|
|
|
7
7
|
import json
|
|
8
8
|
import urllib.request
|
|
9
9
|
import urllib.error
|
|
10
|
+
import importlib.metadata
|
|
10
11
|
|
|
11
12
|
def get_settings_path():
|
|
12
13
|
return os.path.join(os.path.dirname(__file__), "settings.json")
|
|
@@ -65,13 +66,10 @@ from textual import work, events
|
|
|
65
66
|
import subprocess, colorama
|
|
66
67
|
|
|
67
68
|
class CustomTextArea(TextArea):
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if event.key == "enter":
|
|
73
|
-
self.app.action_commit_action()
|
|
74
|
-
event.prevent_default()
|
|
69
|
+
BINDINGS = [
|
|
70
|
+
Binding("ctrl+r", "regenerate_action", "Regenerate", priority=True),
|
|
71
|
+
Binding("escape", "exit_action", "Terminate", priority=True)
|
|
72
|
+
]
|
|
75
73
|
|
|
76
74
|
def action_cursor_down(self, select: bool = False) -> None:
|
|
77
75
|
if self.cursor_location[0] == self.document.line_count - 1:
|
|
@@ -125,7 +123,18 @@ class CometTUI(App):
|
|
|
125
123
|
height: auto;
|
|
126
124
|
padding: 1;
|
|
127
125
|
background: $surface;
|
|
128
|
-
border: $
|
|
126
|
+
border: solid $panel;
|
|
127
|
+
border-title-color: $text-muted;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
#input_row:focus-within {
|
|
131
|
+
border: solid $primary;
|
|
132
|
+
border-title-color: $primary;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
#input_row.committed {
|
|
136
|
+
border: solid $panel;
|
|
137
|
+
border-title-color: $text-muted;
|
|
129
138
|
}
|
|
130
139
|
|
|
131
140
|
#input {
|
|
@@ -158,6 +167,14 @@ class CometTUI(App):
|
|
|
158
167
|
border: none;
|
|
159
168
|
}
|
|
160
169
|
|
|
170
|
+
#undoBtn {
|
|
171
|
+
width: 1fr;
|
|
172
|
+
margin-left: 1;
|
|
173
|
+
height: 3;
|
|
174
|
+
background: $secondary;
|
|
175
|
+
border: none;
|
|
176
|
+
}
|
|
177
|
+
|
|
161
178
|
#cancelBtn {
|
|
162
179
|
margin-left: 1;
|
|
163
180
|
height: 3;
|
|
@@ -168,7 +185,7 @@ class CometTUI(App):
|
|
|
168
185
|
#shortcuts {
|
|
169
186
|
width: 100%;
|
|
170
187
|
text-align: center;
|
|
171
|
-
color:
|
|
188
|
+
color: $text-muted;
|
|
172
189
|
margin-top: 1;
|
|
173
190
|
}
|
|
174
191
|
|
|
@@ -182,9 +199,10 @@ class CometTUI(App):
|
|
|
182
199
|
|
|
183
200
|
BINDINGS = [
|
|
184
201
|
Binding("ctrl+r", "regenerate_action", "Regenerate", priority=True),
|
|
185
|
-
Binding("
|
|
202
|
+
Binding("escape", "exit_action", "Quit", priority=True),
|
|
186
203
|
Binding("ctrl+z", "undo_commit", "Undo Commit", priority=True),
|
|
187
|
-
Binding("tab", "swap_model", "Swap Model", priority=True)
|
|
204
|
+
Binding("tab", "swap_model", "Swap Model", priority=True),
|
|
205
|
+
Binding("enter", "commit_action", "Continue", priority=True)
|
|
188
206
|
]
|
|
189
207
|
|
|
190
208
|
def __init__(self, commit: str, model: str, diff: str, commits: str, allModels: list[str], provider: str = "ollama", client = None):
|
|
@@ -205,11 +223,16 @@ class CometTUI(App):
|
|
|
205
223
|
yield CustomTextArea(self.commit, id="input", show_line_numbers=False)
|
|
206
224
|
yield Button(" ₊✦ Regenerate ", id="regenBtn")
|
|
207
225
|
with Horizontal(id="action_row"):
|
|
208
|
-
|
|
209
|
-
yield Button("
|
|
210
|
-
|
|
226
|
+
undo = Button(" ↺ Undo ", id="undoBtn")
|
|
227
|
+
yield Button(" ✔ Commit ", id="commitBtn")
|
|
228
|
+
undo.display = False
|
|
229
|
+
yield undo
|
|
230
|
+
yield Button(" 🗙 Quit ", id="cancelBtn")
|
|
231
|
+
yield Label("[$text][b]ctrl+r[/b][/] regenerate [$text][b]enter[/b][/] continue [$text][b]tab[/b][/] swap model [$text][b]ctrl+z[/b][/] undo [$text][b]↓/↑[/b][/] move lines [$text][b]esc[/b][/] quit", id="shortcuts")
|
|
211
232
|
|
|
212
233
|
def action_swap_model(self) -> None:
|
|
234
|
+
if self.query_one("#input_row").has_class("committed"):
|
|
235
|
+
return
|
|
213
236
|
if not self.allModels: return
|
|
214
237
|
try:
|
|
215
238
|
currentIndex = self.allModels.index(self.model)
|
|
@@ -226,7 +249,7 @@ class CometTUI(App):
|
|
|
226
249
|
regenBtn.press()
|
|
227
250
|
|
|
228
251
|
def action_exit_action(self) -> None:
|
|
229
|
-
self.
|
|
252
|
+
self.exit(f"{colorama.Fore.RED}User cancelled the operation. {colorama.Style.RESET_ALL}")
|
|
230
253
|
|
|
231
254
|
def action_commit_action(self) -> None:
|
|
232
255
|
commitBtn = self.query_one("#commitBtn", Button)
|
|
@@ -237,13 +260,68 @@ class CometTUI(App):
|
|
|
237
260
|
commitBtn = self.query_one("#commitBtn", Button)
|
|
238
261
|
if str(commitBtn.label).strip() == "Sync ➤":
|
|
239
262
|
subprocess.run(["git", "reset", "HEAD~1"], capture_output=True)
|
|
240
|
-
commitBtn.label = " ✔ Commit"
|
|
263
|
+
commitBtn.label = " ✔ Commit "
|
|
264
|
+
self.query_one("#undoBtn").display = False
|
|
265
|
+
self.query_one("#cancelBtn").display = True
|
|
266
|
+
|
|
267
|
+
textArea = self.query_one("#input", TextArea)
|
|
268
|
+
textArea.disabled = False
|
|
269
|
+
input_row = self.query_one("#input_row")
|
|
270
|
+
input_row.remove_class("committed")
|
|
271
|
+
self.query_one("#regenBtn").disabled = False
|
|
241
272
|
|
|
242
273
|
def on_mount(self) -> None:
|
|
274
|
+
if self.provider == "auto" or self.model == "Loading...":
|
|
275
|
+
self.notify("Welcome! This is the longest it'll take to load. :D", title="Scanning Providers", severity="information", timeout=3.0)
|
|
243
276
|
self.query_one("#input_row").border_title = f"{self.model}"
|
|
244
277
|
self.query_one("#regenBtn").disabled = True
|
|
245
278
|
self.query_one("#commitBtn").disabled = True
|
|
279
|
+
|
|
280
|
+
try:
|
|
281
|
+
from textual.color import Color
|
|
282
|
+
v = self.get_css_variables()
|
|
283
|
+
|
|
284
|
+
def resolve_color(val, default_hex):
|
|
285
|
+
if val.startswith("auto") or not val: return default_hex
|
|
286
|
+
return val
|
|
287
|
+
|
|
288
|
+
# Default to dark mode colors (#1e1e1e surface, #ffffff text) if unresolved
|
|
289
|
+
surface_str = resolve_color(v.get("surface", "#1E1E1E"), "#1E1E1E")
|
|
290
|
+
text_str = resolve_color(v.get("text", "#ffffff"), "#ffffff")
|
|
291
|
+
|
|
292
|
+
surface = Color.parse(surface_str)
|
|
293
|
+
text = Color.parse(text_str)
|
|
294
|
+
blended = surface.blend(text, 0.6)
|
|
295
|
+
|
|
296
|
+
css = f"""
|
|
297
|
+
#input_row {{ border: solid {blended.hex}; }}
|
|
298
|
+
#input_row.committed {{ border: solid {blended.hex}; }}
|
|
299
|
+
#input_row:focus-within {{ border: solid $primary; border-title-color: $primary; }}
|
|
300
|
+
"""
|
|
301
|
+
self.stylesheet.add_source(css)
|
|
302
|
+
self.stylesheet.update(self)
|
|
303
|
+
except Exception:
|
|
304
|
+
pass
|
|
305
|
+
|
|
246
306
|
self.initialize_llm()
|
|
307
|
+
self.check_for_updates()
|
|
308
|
+
|
|
309
|
+
@work(thread=True)
|
|
310
|
+
def check_for_updates(self) -> None:
|
|
311
|
+
try:
|
|
312
|
+
current_version = importlib.metadata.version("cli-comet")
|
|
313
|
+
req = urllib.request.Request("https://pypi.org/pypi/cli-comet/json")
|
|
314
|
+
with urllib.request.urlopen(req, timeout=2.0) as response:
|
|
315
|
+
data = json.loads(response.read().decode())
|
|
316
|
+
latest_version = data["info"]["version"]
|
|
317
|
+
|
|
318
|
+
curr_tuple = tuple(map(int, current_version.split(".")))
|
|
319
|
+
latest_tuple = tuple(map(int, latest_version.split(".")))
|
|
320
|
+
|
|
321
|
+
if latest_tuple > curr_tuple:
|
|
322
|
+
self.call_from_thread(self.notify, f"Update available: v{latest_version}! Run `pipx upgrade cli-comet` to install.", title="Update Available", severity="warning", timeout=15.0)
|
|
323
|
+
except Exception:
|
|
324
|
+
pass
|
|
247
325
|
|
|
248
326
|
@work(thread=True)
|
|
249
327
|
def initialize_llm(self) -> None:
|
|
@@ -303,9 +381,19 @@ class CometTUI(App):
|
|
|
303
381
|
|
|
304
382
|
subprocess.run(["git", "commit", "-a", "-m", finalMessage], capture_output=True)
|
|
305
383
|
event.button.label = "Sync ➤"
|
|
384
|
+
self.query_one("#undoBtn").display = True
|
|
385
|
+
self.query_one("#cancelBtn").display = False
|
|
386
|
+
|
|
387
|
+
textArea.disabled = True
|
|
388
|
+
input_row = self.query_one("#input_row")
|
|
389
|
+
input_row.add_class("committed")
|
|
390
|
+
self.query_one("#regenBtn").disabled = True
|
|
306
391
|
|
|
307
392
|
elif event.button.id == "cancelBtn":
|
|
308
393
|
self.exit(f"{colorama.Fore.RED}User cancelled the operation. {colorama.Style.RESET_ALL}")
|
|
394
|
+
|
|
395
|
+
elif event.button.id == "undoBtn":
|
|
396
|
+
self.action_undo_commit()
|
|
309
397
|
|
|
310
398
|
elif event.button.id == "regenBtn":
|
|
311
399
|
event.button.disabled = True
|
|
@@ -33,8 +33,18 @@ Read the diff carefully and choose exactly ONE of the following standard convent
|
|
|
33
33
|
Analyze the diff to understand the *high-level intent* and *functional purpose* of the changes. Do not just blindly list what lines were added or removed. Instead, explain *what the code actually accomplishes* in the context of the larger project.
|
|
34
34
|
Use the imperative, present tense mood. Be concise but highly descriptive. If the diff shows the introduction of a new library or UI framework, mention its purpose. Keep it abstract and functional rather than a literal line-by-line translation.
|
|
35
35
|
|
|
36
|
-
###
|
|
37
|
-
You
|
|
38
|
-
|
|
36
|
+
### CRITICAL OUTPUT FORMAT RULES
|
|
37
|
+
You MUST adhere to the following rules or your output will break the system:
|
|
38
|
+
1. OUTPUT EXACTLY ONE LINE. Do NOT output a list of multiple options or types.
|
|
39
|
+
2. DO NOT use any markdown formatting whatsoever (no bold `**`, no italics, no code blocks ` ``` `).
|
|
40
|
+
3. DO NOT start the line with a bullet point, dash (`-`), or asterisk (`*`).
|
|
41
|
+
4. DO NOT add any introductory or concluding text (e.g. no "Here is the commit message:").
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
The ONLY output you provide should be the raw, plain-text string matching this exact pattern:
|
|
44
|
+
type: description
|
|
45
|
+
|
|
46
|
+
Example of CORRECT output:
|
|
47
|
+
feat: implement asynchronous network checking for zero latency boot
|
|
48
|
+
|
|
49
|
+
Example of INCORRECT output:
|
|
50
|
+
- **feat:** implement asynchronous network checking
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cli-comet"
|
|
7
|
-
version = "1.2.
|
|
7
|
+
version = "1.2.3"
|
|
8
8
|
description = "A terminal UI that automatically generates git commit messages using local language models via Ollama."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -13,7 +13,7 @@ authors = [
|
|
|
13
13
|
]
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Programming Language :: Python :: 3",
|
|
16
|
-
"License :: OSI Approved ::
|
|
16
|
+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
|
17
17
|
"Operating System :: OS Independent",
|
|
18
18
|
"Environment :: Console",
|
|
19
19
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = cli-comet
|
|
3
|
-
version = 1.2.
|
|
3
|
+
version = 1.2.3
|
|
4
4
|
description = A terminal UI that automatically generates git commit messages using local language models via Ollama.
|
|
5
5
|
long_description = file: README.md
|
|
6
6
|
long_description_content_type = text/markdown
|
|
@@ -9,7 +9,7 @@ license = GPL-3.0 license
|
|
|
9
9
|
url = https://github.com/razoring/CometCLI
|
|
10
10
|
classifiers =
|
|
11
11
|
Programming Language :: Python :: 3
|
|
12
|
-
License :: OSI Approved ::
|
|
12
|
+
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
13
13
|
Operating System :: OS Independent
|
|
14
14
|
Environment :: Console
|
|
15
15
|
|
cli_comet-1.2.0/PKG-INFO
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: cli-comet
|
|
3
|
-
Version: 1.2.0
|
|
4
|
-
Summary: A terminal UI that automatically generates git commit messages using local language models via Ollama.
|
|
5
|
-
Home-page: https://github.com/razoring/CometCLI
|
|
6
|
-
Author: razoring
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Classifier: Environment :: Console
|
|
11
|
-
Requires-Python: >=3.10
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Requires-Dist: ollama
|
|
15
|
-
Requires-Dist: textual
|
|
16
|
-
Requires-Dist: colorama
|
|
17
|
-
Requires-Dist: openai
|
|
18
|
-
Dynamic: license-file
|
|
19
|
-
|
|
20
|
-
# Comet
|
|
21
|
-
|
|
22
|
-
Comet is a terminal user interface application that automatically generates descriptive git commit messages using local language models via Ollama. It analyzes your staged git diffs and provides a clean interface to review, edit, regenerate, and commit your changes.
|
|
23
|
-
|
|
24
|
-
## Features
|
|
25
|
-
|
|
26
|
-
- Local Model Generation: Connects to your local Ollama instance to generate commit messages privately.
|
|
27
|
-
- Model Swapping: Press `tab` to cycle through available local models directly from the interface. Comet defaults to your currently loaded model to save time.
|
|
28
|
-
- Context Aware: Automatically pulls in the last 5 commits to understand the tone and style of your project.
|
|
29
|
-
- Terminal User Interface: Built with Textual. It provides a dedicated text area to edit the generated message.
|
|
30
|
-
- Dynamic Newlines: Use the down arrow key on the last line to seamlessly add new lines to your commit message, and the up arrow key to remove them.
|
|
31
|
-
- Quick Undo: Press `ctrl+z` to instantly undo the last local commit if you need to make changes.
|
|
32
|
-
- Direct Syncing: Commit your changes and immediately push them to your remote repository with a second press of the commit button.
|
|
33
|
-
- Customizable Prompts: The instructions provided to the language model are stored in `comet/system.md` and can be edited to fit your specific workflow.
|
|
34
|
-
|
|
35
|
-
## Requirements
|
|
36
|
-
|
|
37
|
-
- Python 3.10 or higher
|
|
38
|
-
- Git installed and accessible in your system path
|
|
39
|
-
- Ollama installed and running locally
|
|
40
|
-
|
|
41
|
-
## Installation
|
|
42
|
-
|
|
43
|
-
Clone the repository and install the required dependencies:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
git clone <repository_url>
|
|
47
|
-
cd Comet
|
|
48
|
-
python -m venv .venv
|
|
49
|
-
|
|
50
|
-
# On Windows
|
|
51
|
-
.venv\Scripts\activate
|
|
52
|
-
|
|
53
|
-
# On Unix/macOS
|
|
54
|
-
source .venv/bin/activate
|
|
55
|
-
|
|
56
|
-
pip install -r requirements.txt
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Usage
|
|
60
|
-
|
|
61
|
-
Ensure you have staged your changes using `git add` and that Ollama is running in the background.
|
|
62
|
-
|
|
63
|
-
Run the Comet application:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
comet
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Keyboard Shortcuts
|
|
70
|
-
|
|
71
|
-
- `enter`: Commit the current text. If pressed again, it will push the commit to the remote repository.
|
|
72
|
-
- `tab`: Swap the active language model.
|
|
73
|
-
- `ctrl+r`: Regenerate the commit message with the current model.
|
|
74
|
-
- `ctrl+z`: Undo the most recent local commit.
|
|
75
|
-
- `ctrl+t`: Terminate the application.
|
|
76
|
-
- `down arrow`: Add a new line when at the bottom of the text area.
|
|
77
|
-
- `up arrow`: Remove the previous empty line.
|
|
78
|
-
|
|
79
|
-
## Architecture
|
|
80
|
-
|
|
81
|
-
Comet uses the `subprocess` module to run git commands and capture diffs. It reads the local `comet/system.md` file for system instructions and sends the diff to the Ollama Python client. The interface is built using Textual, providing responsive keyboard bindings and a resilient terminal layout.
|
cli_comet-1.2.0/README.md
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Comet
|
|
2
|
-
|
|
3
|
-
Comet is a terminal user interface application that automatically generates descriptive git commit messages using local language models via Ollama. It analyzes your staged git diffs and provides a clean interface to review, edit, regenerate, and commit your changes.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Local Model Generation: Connects to your local Ollama instance to generate commit messages privately.
|
|
8
|
-
- Model Swapping: Press `tab` to cycle through available local models directly from the interface. Comet defaults to your currently loaded model to save time.
|
|
9
|
-
- Context Aware: Automatically pulls in the last 5 commits to understand the tone and style of your project.
|
|
10
|
-
- Terminal User Interface: Built with Textual. It provides a dedicated text area to edit the generated message.
|
|
11
|
-
- Dynamic Newlines: Use the down arrow key on the last line to seamlessly add new lines to your commit message, and the up arrow key to remove them.
|
|
12
|
-
- Quick Undo: Press `ctrl+z` to instantly undo the last local commit if you need to make changes.
|
|
13
|
-
- Direct Syncing: Commit your changes and immediately push them to your remote repository with a second press of the commit button.
|
|
14
|
-
- Customizable Prompts: The instructions provided to the language model are stored in `comet/system.md` and can be edited to fit your specific workflow.
|
|
15
|
-
|
|
16
|
-
## Requirements
|
|
17
|
-
|
|
18
|
-
- Python 3.10 or higher
|
|
19
|
-
- Git installed and accessible in your system path
|
|
20
|
-
- Ollama installed and running locally
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
Clone the repository and install the required dependencies:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
git clone <repository_url>
|
|
28
|
-
cd Comet
|
|
29
|
-
python -m venv .venv
|
|
30
|
-
|
|
31
|
-
# On Windows
|
|
32
|
-
.venv\Scripts\activate
|
|
33
|
-
|
|
34
|
-
# On Unix/macOS
|
|
35
|
-
source .venv/bin/activate
|
|
36
|
-
|
|
37
|
-
pip install -r requirements.txt
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Usage
|
|
41
|
-
|
|
42
|
-
Ensure you have staged your changes using `git add` and that Ollama is running in the background.
|
|
43
|
-
|
|
44
|
-
Run the Comet application:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
comet
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Keyboard Shortcuts
|
|
51
|
-
|
|
52
|
-
- `enter`: Commit the current text. If pressed again, it will push the commit to the remote repository.
|
|
53
|
-
- `tab`: Swap the active language model.
|
|
54
|
-
- `ctrl+r`: Regenerate the commit message with the current model.
|
|
55
|
-
- `ctrl+z`: Undo the most recent local commit.
|
|
56
|
-
- `ctrl+t`: Terminate the application.
|
|
57
|
-
- `down arrow`: Add a new line when at the bottom of the text area.
|
|
58
|
-
- `up arrow`: Remove the previous empty line.
|
|
59
|
-
|
|
60
|
-
## Architecture
|
|
61
|
-
|
|
62
|
-
Comet uses the `subprocess` module to run git commands and capture diffs. It reads the local `comet/system.md` file for system instructions and sends the diff to the Ollama Python client. The interface is built using Textual, providing responsive keyboard bindings and a resilient terminal layout.
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: cli-comet
|
|
3
|
-
Version: 1.2.0
|
|
4
|
-
Summary: A terminal UI that automatically generates git commit messages using local language models via Ollama.
|
|
5
|
-
Home-page: https://github.com/razoring/CometCLI
|
|
6
|
-
Author: razoring
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Classifier: Environment :: Console
|
|
11
|
-
Requires-Python: >=3.10
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
|
-
Requires-Dist: ollama
|
|
15
|
-
Requires-Dist: textual
|
|
16
|
-
Requires-Dist: colorama
|
|
17
|
-
Requires-Dist: openai
|
|
18
|
-
Dynamic: license-file
|
|
19
|
-
|
|
20
|
-
# Comet
|
|
21
|
-
|
|
22
|
-
Comet is a terminal user interface application that automatically generates descriptive git commit messages using local language models via Ollama. It analyzes your staged git diffs and provides a clean interface to review, edit, regenerate, and commit your changes.
|
|
23
|
-
|
|
24
|
-
## Features
|
|
25
|
-
|
|
26
|
-
- Local Model Generation: Connects to your local Ollama instance to generate commit messages privately.
|
|
27
|
-
- Model Swapping: Press `tab` to cycle through available local models directly from the interface. Comet defaults to your currently loaded model to save time.
|
|
28
|
-
- Context Aware: Automatically pulls in the last 5 commits to understand the tone and style of your project.
|
|
29
|
-
- Terminal User Interface: Built with Textual. It provides a dedicated text area to edit the generated message.
|
|
30
|
-
- Dynamic Newlines: Use the down arrow key on the last line to seamlessly add new lines to your commit message, and the up arrow key to remove them.
|
|
31
|
-
- Quick Undo: Press `ctrl+z` to instantly undo the last local commit if you need to make changes.
|
|
32
|
-
- Direct Syncing: Commit your changes and immediately push them to your remote repository with a second press of the commit button.
|
|
33
|
-
- Customizable Prompts: The instructions provided to the language model are stored in `comet/system.md` and can be edited to fit your specific workflow.
|
|
34
|
-
|
|
35
|
-
## Requirements
|
|
36
|
-
|
|
37
|
-
- Python 3.10 or higher
|
|
38
|
-
- Git installed and accessible in your system path
|
|
39
|
-
- Ollama installed and running locally
|
|
40
|
-
|
|
41
|
-
## Installation
|
|
42
|
-
|
|
43
|
-
Clone the repository and install the required dependencies:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
git clone <repository_url>
|
|
47
|
-
cd Comet
|
|
48
|
-
python -m venv .venv
|
|
49
|
-
|
|
50
|
-
# On Windows
|
|
51
|
-
.venv\Scripts\activate
|
|
52
|
-
|
|
53
|
-
# On Unix/macOS
|
|
54
|
-
source .venv/bin/activate
|
|
55
|
-
|
|
56
|
-
pip install -r requirements.txt
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Usage
|
|
60
|
-
|
|
61
|
-
Ensure you have staged your changes using `git add` and that Ollama is running in the background.
|
|
62
|
-
|
|
63
|
-
Run the Comet application:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
comet
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Keyboard Shortcuts
|
|
70
|
-
|
|
71
|
-
- `enter`: Commit the current text. If pressed again, it will push the commit to the remote repository.
|
|
72
|
-
- `tab`: Swap the active language model.
|
|
73
|
-
- `ctrl+r`: Regenerate the commit message with the current model.
|
|
74
|
-
- `ctrl+z`: Undo the most recent local commit.
|
|
75
|
-
- `ctrl+t`: Terminate the application.
|
|
76
|
-
- `down arrow`: Add a new line when at the bottom of the text area.
|
|
77
|
-
- `up arrow`: Remove the previous empty line.
|
|
78
|
-
|
|
79
|
-
## Architecture
|
|
80
|
-
|
|
81
|
-
Comet uses the `subprocess` module to run git commands and capture diffs. It reads the local `comet/system.md` file for system instructions and sends the diff to the Ollama Python client. The interface is built using Textual, providing responsive keyboard bindings and a resilient terminal layout.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|