cli-comet 1.2.2__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.2/cli_comet.egg-info → cli_comet-1.2.3}/PKG-INFO +1 -1
- {cli_comet-1.2.2 → cli_comet-1.2.3/cli_comet.egg-info}/PKG-INFO +1 -1
- {cli_comet-1.2.2 → cli_comet-1.2.3}/comet/cli.py +78 -10
- {cli_comet-1.2.2 → cli_comet-1.2.3}/pyproject.toml +1 -1
- {cli_comet-1.2.2 → cli_comet-1.2.3}/setup.cfg +1 -1
- {cli_comet-1.2.2 → cli_comet-1.2.3}/LICENSE +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/MANIFEST.in +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/README.md +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/cli_comet.egg-info/SOURCES.txt +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/cli_comet.egg-info/dependency_links.txt +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/cli_comet.egg-info/entry_points.txt +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/cli_comet.egg-info/requires.txt +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/cli_comet.egg-info/top_level.txt +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/comet/__init__.py +0 -0
- {cli_comet-1.2.2 → cli_comet-1.2.3}/comet/system.md +0 -0
|
@@ -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")
|
|
@@ -70,11 +71,6 @@ class CustomTextArea(TextArea):
|
|
|
70
71
|
Binding("escape", "exit_action", "Terminate", priority=True)
|
|
71
72
|
]
|
|
72
73
|
|
|
73
|
-
def on_key(self, event: events.Key) -> None:
|
|
74
|
-
if event.key == "enter":
|
|
75
|
-
self.app.action_commit_action()
|
|
76
|
-
event.prevent_default()
|
|
77
|
-
|
|
78
74
|
def action_cursor_down(self, select: bool = False) -> None:
|
|
79
75
|
if self.cursor_location[0] == self.document.line_count - 1:
|
|
80
76
|
loc = self.cursor_location
|
|
@@ -127,7 +123,18 @@ class CometTUI(App):
|
|
|
127
123
|
height: auto;
|
|
128
124
|
padding: 1;
|
|
129
125
|
background: $surface;
|
|
130
|
-
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;
|
|
131
138
|
}
|
|
132
139
|
|
|
133
140
|
#input {
|
|
@@ -178,7 +185,7 @@ class CometTUI(App):
|
|
|
178
185
|
#shortcuts {
|
|
179
186
|
width: 100%;
|
|
180
187
|
text-align: center;
|
|
181
|
-
color:
|
|
188
|
+
color: $text-muted;
|
|
182
189
|
margin-top: 1;
|
|
183
190
|
}
|
|
184
191
|
|
|
@@ -194,7 +201,8 @@ class CometTUI(App):
|
|
|
194
201
|
Binding("ctrl+r", "regenerate_action", "Regenerate", priority=True),
|
|
195
202
|
Binding("escape", "exit_action", "Quit", priority=True),
|
|
196
203
|
Binding("ctrl+z", "undo_commit", "Undo Commit", priority=True),
|
|
197
|
-
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)
|
|
198
206
|
]
|
|
199
207
|
|
|
200
208
|
def __init__(self, commit: str, model: str, diff: str, commits: str, allModels: list[str], provider: str = "ollama", client = None):
|
|
@@ -215,14 +223,16 @@ class CometTUI(App):
|
|
|
215
223
|
yield CustomTextArea(self.commit, id="input", show_line_numbers=False)
|
|
216
224
|
yield Button(" ₊✦ Regenerate ", id="regenBtn")
|
|
217
225
|
with Horizontal(id="action_row"):
|
|
218
|
-
yield Button(" ✔ Commit ", id="commitBtn")
|
|
219
226
|
undo = Button(" ↺ Undo ", id="undoBtn")
|
|
227
|
+
yield Button(" ✔ Commit ", id="commitBtn")
|
|
220
228
|
undo.display = False
|
|
221
229
|
yield undo
|
|
222
230
|
yield Button(" 🗙 Quit ", id="cancelBtn")
|
|
223
|
-
yield Label("[
|
|
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")
|
|
224
232
|
|
|
225
233
|
def action_swap_model(self) -> None:
|
|
234
|
+
if self.query_one("#input_row").has_class("committed"):
|
|
235
|
+
return
|
|
226
236
|
if not self.allModels: return
|
|
227
237
|
try:
|
|
228
238
|
currentIndex = self.allModels.index(self.model)
|
|
@@ -253,12 +263,65 @@ class CometTUI(App):
|
|
|
253
263
|
commitBtn.label = " ✔ Commit "
|
|
254
264
|
self.query_one("#undoBtn").display = False
|
|
255
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
|
|
256
272
|
|
|
257
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)
|
|
258
276
|
self.query_one("#input_row").border_title = f"{self.model}"
|
|
259
277
|
self.query_one("#regenBtn").disabled = True
|
|
260
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
|
+
|
|
261
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
|
|
262
325
|
|
|
263
326
|
@work(thread=True)
|
|
264
327
|
def initialize_llm(self) -> None:
|
|
@@ -321,6 +384,11 @@ class CometTUI(App):
|
|
|
321
384
|
self.query_one("#undoBtn").display = True
|
|
322
385
|
self.query_one("#cancelBtn").display = False
|
|
323
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
|
|
391
|
+
|
|
324
392
|
elif event.button.id == "cancelBtn":
|
|
325
393
|
self.exit(f"{colorama.Fore.RED}User cancelled the operation. {colorama.Style.RESET_ALL}")
|
|
326
394
|
|
|
@@ -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"
|
|
@@ -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
|
|
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
|