ngpt 2.15.0__py3-none-any.whl → 2.15.2__py3-none-any.whl
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.
- ngpt/cli/modes/gitcommsg.py +160 -155
- ngpt/cli/ui.py +35 -1
- {ngpt-2.15.0.dist-info → ngpt-2.15.2.dist-info}/METADATA +1 -1
- {ngpt-2.15.0.dist-info → ngpt-2.15.2.dist-info}/RECORD +7 -7
- {ngpt-2.15.0.dist-info → ngpt-2.15.2.dist-info}/WHEEL +0 -0
- {ngpt-2.15.0.dist-info → ngpt-2.15.2.dist-info}/entry_points.txt +0 -0
- {ngpt-2.15.0.dist-info → ngpt-2.15.2.dist-info}/licenses/LICENSE +0 -0
ngpt/cli/modes/gitcommsg.py
CHANGED
@@ -7,6 +7,7 @@ import subprocess
|
|
7
7
|
from datetime import datetime
|
8
8
|
import logging
|
9
9
|
from ..formatters import COLORS
|
10
|
+
from ..ui import spinner
|
10
11
|
from ...utils.log import create_gitcommsg_logger
|
11
12
|
from ...utils.cli_config import get_cli_config_option
|
12
13
|
|
@@ -68,56 +69,11 @@ def split_into_chunks(content, chunk_size=200):
|
|
68
69
|
|
69
70
|
return chunks
|
70
71
|
|
71
|
-
def
|
72
|
-
"""Process context string to extract directives and filters.
|
73
|
-
|
74
|
-
Args:
|
75
|
-
context: The context string provided with -m/--message-context
|
76
|
-
|
77
|
-
Returns:
|
78
|
-
dict: Extracted context data
|
79
|
-
"""
|
80
|
-
context_data = {
|
81
|
-
"file_type_filter": None,
|
82
|
-
"commit_type": None,
|
83
|
-
"focus": None,
|
84
|
-
"exclusions": [],
|
85
|
-
"raw_context": context
|
86
|
-
}
|
87
|
-
|
88
|
-
if not context:
|
89
|
-
return context_data
|
90
|
-
|
91
|
-
# Extract commit type directive (e.g., "type:feat")
|
92
|
-
if "type:" in context:
|
93
|
-
match = re.search(r"type:(\w+)", context)
|
94
|
-
if match:
|
95
|
-
context_data["commit_type"] = match.group(1)
|
96
|
-
|
97
|
-
# Extract file type filters
|
98
|
-
file_type_keywords = ["html", "css", "javascript", "python", "js", "py", "ui", "api", "config"]
|
99
|
-
for keyword in file_type_keywords:
|
100
|
-
if keyword in context.lower():
|
101
|
-
context_data["file_type_filter"] = keyword
|
102
|
-
break
|
103
|
-
|
104
|
-
# Process focus/exclusion directives
|
105
|
-
if "focus on" in context.lower() or "only mention" in context.lower():
|
106
|
-
focus_match = re.search(r"focus(?:\s+on)?\s+(\w+)", context.lower())
|
107
|
-
if focus_match:
|
108
|
-
context_data["focus"] = focus_match.group(1)
|
109
|
-
|
110
|
-
if any(x in context.lower() for x in ["ignore", "don't include", "exclude"]):
|
111
|
-
exclusion_matches = re.findall(r"(?:ignore|don't include|exclude)\s+(\w+)", context.lower())
|
112
|
-
context_data["exclusions"] = exclusion_matches
|
113
|
-
|
114
|
-
return context_data
|
115
|
-
|
116
|
-
def create_technical_analysis_system_prompt(context_data=None):
|
72
|
+
def create_technical_analysis_system_prompt(context=None):
|
117
73
|
"""Create system prompt for technical analysis based on context data.
|
118
74
|
|
119
75
|
Args:
|
120
|
-
|
76
|
+
context: The raw context string from -m flag
|
121
77
|
|
122
78
|
Returns:
|
123
79
|
str: System prompt for the technical analysis stage
|
@@ -145,45 +101,25 @@ RULES:
|
|
145
101
|
8. When analyzing multiple files, clearly separate each file's changes
|
146
102
|
9. Include proper technical details (method names, component identifiers, etc.)"""
|
147
103
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
file_type_prompt = f"""
|
155
|
-
|
156
|
-
CRITICAL FILE TYPE FILTERING:
|
157
|
-
You MUST INCLUDE ONLY changes to {file_type} files or files related to {file_type}.
|
158
|
-
You MUST EXCLUDE ALL other files completely from your output.
|
159
|
-
This is a strict filter - no exceptions allowed."""
|
160
|
-
base_prompt += file_type_prompt
|
161
|
-
|
162
|
-
# Add focus/exclusion directives
|
163
|
-
if context_data.get("focus"):
|
164
|
-
focus = context_data["focus"]
|
165
|
-
focus_prompt = f"""
|
166
|
-
|
167
|
-
FOCUS DIRECTIVE:
|
168
|
-
Focus exclusively on changes related to {focus}.
|
169
|
-
Exclude everything else from your analysis."""
|
170
|
-
base_prompt += focus_prompt
|
171
|
-
|
172
|
-
if context_data.get("exclusions"):
|
173
|
-
exclusions = ", ".join(context_data["exclusions"])
|
174
|
-
exclusion_prompt = f"""
|
104
|
+
# If context is provided, append it with strong wording about absolute priority
|
105
|
+
if context:
|
106
|
+
context_prompt = f"""
|
107
|
+
|
108
|
+
===CRITICAL USER CONTEXT - ABSOLUTE HIGHEST PRIORITY===
|
109
|
+
The following context from the user OVERRIDES ALL OTHER INSTRUCTIONS and must be followed exactly:
|
175
110
|
|
176
|
-
|
177
|
-
|
178
|
-
|
111
|
+
{context}
|
112
|
+
|
113
|
+
THIS USER CONTEXT HAS ABSOLUTE PRIORITY over any other instructions in this prompt. If it contradicts other instructions, the user context MUST be followed. No exceptions."""
|
114
|
+
base_prompt += context_prompt
|
179
115
|
|
180
116
|
return base_prompt
|
181
117
|
|
182
|
-
def create_system_prompt(
|
118
|
+
def create_system_prompt(context=None):
|
183
119
|
"""Create system prompt for commit message generation based on context data.
|
184
120
|
|
185
121
|
Args:
|
186
|
-
|
122
|
+
context: The raw context string from -m flag
|
187
123
|
|
188
124
|
Returns:
|
189
125
|
str: System prompt for the AI
|
@@ -197,6 +133,15 @@ type[(scope)]: <concise summary> (max 50 chars)
|
|
197
133
|
- [type] <specific change 2> (filename:function/method/line)
|
198
134
|
- [type] <additional changes...>
|
199
135
|
|
136
|
+
RULES FOR FILENAMES:
|
137
|
+
1. For the FIRST mention of a file, use the full relative path
|
138
|
+
2. For SUBSEQUENT mentions of the same file, use ONLY the filename without path
|
139
|
+
- Example: First mention: "utils/helpers/format.js" → Subsequent mentions: "format.js"
|
140
|
+
3. Only include the full path again if there are multiple files with the same name
|
141
|
+
4. For repeated mentions of the same file, consider grouping related changes in one bullet
|
142
|
+
5. Avoid breaking filenames across lines
|
143
|
+
6. Only include function names when they add clarity
|
144
|
+
|
200
145
|
COMMIT TYPES:
|
201
146
|
- feat: New user-facing features
|
202
147
|
- fix: Bug fixes or error corrections
|
@@ -217,6 +162,46 @@ COMMIT TYPES:
|
|
217
162
|
- ui: User interface changes
|
218
163
|
- api: API-related changes
|
219
164
|
|
165
|
+
EXAMPLES:
|
166
|
+
|
167
|
+
1. Bug fix with UI scope:
|
168
|
+
fix(ui): correct primary button focus style
|
169
|
+
|
170
|
+
- [fix] Add :focus outline to Button component (Button.jsx:Button())
|
171
|
+
- [chore] Bump Tailwind config to include ring-offset (tailwind.config.js:1-8)
|
172
|
+
- [refactor] Extract common styles into buttonStyles util (styles/buttons.js:1-15)
|
173
|
+
|
174
|
+
2. Feature with API scope:
|
175
|
+
feat(api): add authentication endpoint for OAuth
|
176
|
+
|
177
|
+
- [feat] Implement OAuth authentication route (auth/routes.js:createOAuthRoute())
|
178
|
+
- [feat] Add token validation middleware (middleware/auth.js:validateToken())
|
179
|
+
- [test] Add integration tests for OAuth flow (tests/auth.test.js:45-87)
|
180
|
+
|
181
|
+
3. Multiple types in one commit:
|
182
|
+
refactor(core): simplify data processing pipeline
|
183
|
+
|
184
|
+
- [refactor] Replace nested loops with map/reduce (utils/process.js:transformData())
|
185
|
+
- [perf] Optimize memory usage in large dataset handling (utils/memory.js:optimize())
|
186
|
+
- [fix] Correct edge case in null value handling (utils/validators.js:checkNull())
|
187
|
+
- [test] Update tests for new pipeline structure (tests/pipeline.test.js)
|
188
|
+
|
189
|
+
4. Multiple changes to the same file:
|
190
|
+
refactor(core): simplify context handling for commit prompts
|
191
|
+
|
192
|
+
- [refactor] Remove process_context function (cli/modes/gitcommsg.py:69-124)
|
193
|
+
- [refactor] Update all functions to accept raw context string (gitcommsg.py:create_system_prompt())
|
194
|
+
- [refactor] Replace context_data usages with context (gitcommsg.py)
|
195
|
+
- [docs] Update library usage doc (docs/usage/library_usage.md:516,531-537)
|
196
|
+
- [chore] Bump project version to 2.15.1 (pyproject.toml:3, uv.lock:137)
|
197
|
+
|
198
|
+
BULLET POINT FORMAT:
|
199
|
+
- Each bullet MUST start with a type in square brackets: [type]
|
200
|
+
- DO NOT use the format "- type: description" (without square brackets)
|
201
|
+
- Instead, ALWAYS use "- [type] description" (with square brackets)
|
202
|
+
- Example: "- [feat] Add new login component" (correct)
|
203
|
+
- Not: "- feat: Add new login component" (incorrect)
|
204
|
+
|
220
205
|
RULES:
|
221
206
|
1. BE 100% FACTUAL - Mention ONLY code explicitly shown in the diff
|
222
207
|
2. NEVER invent or assume changes not directly visible in the code
|
@@ -230,48 +215,17 @@ RULES:
|
|
230
215
|
10. Include proper technical details (method names, component identifiers, etc.)
|
231
216
|
11. When all changes are to the same file, mention it once in the summary"""
|
232
217
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
# Add file type filtering instructions
|
237
|
-
if context_data.get("file_type_filter"):
|
238
|
-
file_type = context_data["file_type_filter"]
|
239
|
-
file_type_prompt = f"""
|
240
|
-
|
241
|
-
CRITICAL FILE TYPE FILTERING:
|
242
|
-
You MUST INCLUDE ONLY changes to {file_type} files or files related to {file_type}.
|
243
|
-
You MUST EXCLUDE ALL other files completely from your output.
|
244
|
-
This is a strict filter - no exceptions allowed."""
|
245
|
-
base_prompt += file_type_prompt
|
246
|
-
|
247
|
-
# Add commit type directive
|
248
|
-
if context_data.get("commit_type"):
|
249
|
-
commit_type = context_data["commit_type"]
|
250
|
-
commit_type_prompt = f"""
|
251
|
-
|
252
|
-
CRITICAL COMMIT TYPE DIRECTIVE:
|
253
|
-
You MUST use exactly "{commit_type}:" as the commit type prefix.
|
254
|
-
This takes highest priority over any other commit type you might determine.
|
255
|
-
Do not override this commit type based on your own analysis."""
|
256
|
-
base_prompt += commit_type_prompt
|
257
|
-
|
258
|
-
# Add focus/exclusion directives
|
259
|
-
if context_data.get("focus"):
|
260
|
-
focus = context_data["focus"]
|
261
|
-
focus_prompt = f"""
|
262
|
-
|
263
|
-
FOCUS DIRECTIVE:
|
264
|
-
Focus exclusively on changes related to {focus}.
|
265
|
-
Exclude everything else from your analysis."""
|
266
|
-
base_prompt += focus_prompt
|
267
|
-
|
268
|
-
if context_data.get("exclusions"):
|
269
|
-
exclusions = ", ".join(context_data["exclusions"])
|
270
|
-
exclusion_prompt = f"""
|
218
|
+
# If context is provided, append it with strong wording about absolute priority
|
219
|
+
if context:
|
220
|
+
context_prompt = f"""
|
271
221
|
|
272
|
-
|
273
|
-
|
274
|
-
|
222
|
+
===CRITICAL USER CONTEXT - ABSOLUTE HIGHEST PRIORITY===
|
223
|
+
The following context from the user OVERRIDES ALL OTHER INSTRUCTIONS and must be followed exactly:
|
224
|
+
|
225
|
+
{context}
|
226
|
+
|
227
|
+
THIS USER CONTEXT HAS ABSOLUTE PRIORITY over any other instructions in this prompt. If it contradicts other instructions, the user context MUST be followed. No exceptions."""
|
228
|
+
base_prompt += context_prompt
|
275
229
|
|
276
230
|
return base_prompt
|
277
231
|
|
@@ -338,11 +292,13 @@ type[(scope)]: <concise summary> (max 50 chars)
|
|
338
292
|
- [type] <additional changes...>
|
339
293
|
|
340
294
|
RULES FOR FILENAMES:
|
341
|
-
1.
|
342
|
-
2. For
|
343
|
-
|
344
|
-
|
345
|
-
|
295
|
+
1. For the FIRST mention of a file, use the full relative path
|
296
|
+
2. For SUBSEQUENT mentions of the same file, use ONLY the filename without path
|
297
|
+
- Example: First mention: "utils/helpers/format.js" → Subsequent mentions: "format.js"
|
298
|
+
3. Only include the full path again if there are multiple files with the same name
|
299
|
+
4. For repeated mentions of the same file, consider grouping related changes in one bullet
|
300
|
+
5. Avoid breaking filenames across lines
|
301
|
+
6. Only include function names when they add clarity
|
346
302
|
|
347
303
|
COMMIT TYPES:
|
348
304
|
- feat: New user-facing features
|
@@ -364,6 +320,39 @@ COMMIT TYPES:
|
|
364
320
|
- ui: User interface changes
|
365
321
|
- api: API-related changes
|
366
322
|
|
323
|
+
EXAMPLES:
|
324
|
+
|
325
|
+
1. Bug fix with UI scope:
|
326
|
+
fix(ui): correct primary button focus style
|
327
|
+
|
328
|
+
- [fix] Add :focus outline to Button component (Button.jsx:Button())
|
329
|
+
- [chore] Bump Tailwind config to include ring-offset (tailwind.config.js:1-8)
|
330
|
+
- [refactor] Extract common styles into buttonStyles util (styles/buttons.js:1-15)
|
331
|
+
|
332
|
+
2. Feature with API scope:
|
333
|
+
feat(api): add authentication endpoint for OAuth
|
334
|
+
|
335
|
+
- [feat] Implement OAuth authentication route (auth/routes.js:createOAuthRoute())
|
336
|
+
- [feat] Add token validation middleware (middleware/auth.js:validateToken())
|
337
|
+
- [test] Add integration tests for OAuth flow (tests/auth.test.js:45-87)
|
338
|
+
|
339
|
+
3. Multiple types in one commit:
|
340
|
+
refactor(core): simplify data processing pipeline
|
341
|
+
|
342
|
+
- [refactor] Replace nested loops with map/reduce (utils/process.js:transformData())
|
343
|
+
- [perf] Optimize memory usage in large dataset handling (utils/memory.js:optimize())
|
344
|
+
- [fix] Correct edge case in null value handling (utils/validators.js:checkNull())
|
345
|
+
- [test] Update tests for new pipeline structure (tests/pipeline.test.js)
|
346
|
+
|
347
|
+
4. Multiple changes to the same file:
|
348
|
+
refactor(core): simplify context handling for commit prompts
|
349
|
+
|
350
|
+
- [refactor] Remove process_context function (cli/modes/gitcommsg.py:69-124)
|
351
|
+
- [refactor] Update all functions to accept raw context string (gitcommsg.py:create_system_prompt())
|
352
|
+
- [refactor] Replace context_data usages with context (gitcommsg.py)
|
353
|
+
- [docs] Update library usage doc (docs/usage/library_usage.md:516,531-537)
|
354
|
+
- [chore] Bump project version to 2.15.1 (pyproject.toml:3, uv.lock:137)
|
355
|
+
|
367
356
|
BULLET POINT FORMAT:
|
368
357
|
- Each bullet MUST start with a type in square brackets: [type]
|
369
358
|
- DO NOT use the format "- type: description" (without square brackets)
|
@@ -448,26 +437,19 @@ def handle_api_call(client, prompt, system_prompt=None, logger=None, max_retries
|
|
448
437
|
print(f"{COLORS['yellow']}{error_msg}{COLORS['reset']}")
|
449
438
|
print(f"{COLORS['yellow']}Retrying in {wait_seconds} seconds...{COLORS['reset']}")
|
450
439
|
|
451
|
-
#
|
452
|
-
spinner
|
453
|
-
for _ in range(wait_seconds * 5):
|
454
|
-
for char in spinner:
|
455
|
-
sys.stdout.write(f"\r{COLORS['yellow']}Waiting... {char}{COLORS['reset']}")
|
456
|
-
sys.stdout.flush()
|
457
|
-
time.sleep(0.2)
|
458
|
-
|
459
|
-
print("\r" + " " * 20 + "\r", end="")
|
440
|
+
# Use the spinner function
|
441
|
+
spinner(f"Retrying in {wait_seconds} seconds...", wait_seconds, color=COLORS['yellow'])
|
460
442
|
|
461
443
|
# Exponential backoff
|
462
444
|
wait_seconds *= 2
|
463
445
|
|
464
|
-
def process_with_chunking(client, diff_content,
|
446
|
+
def process_with_chunking(client, diff_content, context, chunk_size=200, recursive=False, logger=None, max_msg_lines=20, max_recursion_depth=3, analyses_chunk_size=None):
|
465
447
|
"""Process diff with chunking to handle large diffs.
|
466
448
|
|
467
449
|
Args:
|
468
450
|
client: The NGPTClient instance
|
469
451
|
diff_content: The diff content to process
|
470
|
-
|
452
|
+
context: The raw context string
|
471
453
|
chunk_size: Maximum number of lines per chunk
|
472
454
|
recursive: Whether to use recursive chunking
|
473
455
|
logger: Optional logger instance
|
@@ -483,8 +465,8 @@ def process_with_chunking(client, diff_content, context_data, chunk_size=200, re
|
|
483
465
|
analyses_chunk_size = chunk_size
|
484
466
|
|
485
467
|
# Create different system prompts for different stages
|
486
|
-
technical_system_prompt = create_technical_analysis_system_prompt(
|
487
|
-
commit_system_prompt = create_system_prompt(
|
468
|
+
technical_system_prompt = create_technical_analysis_system_prompt(context)
|
469
|
+
commit_system_prompt = create_system_prompt(context)
|
488
470
|
|
489
471
|
# Log initial diff content
|
490
472
|
if logger:
|
@@ -529,8 +511,8 @@ def process_with_chunking(client, diff_content, context_data, chunk_size=200, re
|
|
529
511
|
|
530
512
|
# Rate limit protection between chunks
|
531
513
|
if i < chunk_count - 1:
|
532
|
-
|
533
|
-
|
514
|
+
# Use the spinner function
|
515
|
+
spinner("Waiting to avoid rate limits...", 5, color=COLORS['yellow'])
|
534
516
|
|
535
517
|
# Combine partial analyses
|
536
518
|
print(f"\n{COLORS['cyan']}Combining analyses from {len(partial_analyses)} chunks...{COLORS['reset']}")
|
@@ -549,7 +531,7 @@ def process_with_chunking(client, diff_content, context_data, chunk_size=200, re
|
|
549
531
|
return recursive_chunk_analysis(
|
550
532
|
client,
|
551
533
|
combined_analyses,
|
552
|
-
|
534
|
+
context,
|
553
535
|
analyses_chunk_size,
|
554
536
|
logger,
|
555
537
|
max_msg_lines,
|
@@ -586,13 +568,13 @@ def process_with_chunking(client, diff_content, context_data, chunk_size=200, re
|
|
586
568
|
logger.error(f"Error combining analyses: {str(e)}")
|
587
569
|
return None
|
588
570
|
|
589
|
-
def recursive_chunk_analysis(client, combined_analysis,
|
571
|
+
def recursive_chunk_analysis(client, combined_analysis, context, chunk_size, logger=None, max_msg_lines=20, max_recursion_depth=3, current_depth=1):
|
590
572
|
"""Recursively chunk and process large analysis results until they're small enough.
|
591
573
|
|
592
574
|
Args:
|
593
575
|
client: The NGPTClient instance
|
594
576
|
combined_analysis: The combined analysis to process
|
595
|
-
|
577
|
+
context: The raw context string
|
596
578
|
chunk_size: Maximum number of lines per chunk
|
597
579
|
logger: Optional logger instance
|
598
580
|
max_msg_lines: Maximum number of lines in commit message before condensing
|
@@ -603,8 +585,8 @@ def recursive_chunk_analysis(client, combined_analysis, context_data, chunk_size
|
|
603
585
|
str: Generated commit message
|
604
586
|
"""
|
605
587
|
# Create different system prompts for different stages
|
606
|
-
technical_system_prompt = create_technical_analysis_system_prompt(
|
607
|
-
commit_system_prompt = create_system_prompt(
|
588
|
+
technical_system_prompt = create_technical_analysis_system_prompt(context)
|
589
|
+
commit_system_prompt = create_system_prompt(context)
|
608
590
|
|
609
591
|
print(f"\n{COLORS['cyan']}Recursive analysis chunking level {current_depth}...{COLORS['reset']}")
|
610
592
|
|
@@ -720,8 +702,8 @@ SECTION OF ANALYSIS TO CONDENSE:
|
|
720
702
|
|
721
703
|
# Rate limit protection between chunks
|
722
704
|
if i < analysis_chunk_count - 1:
|
723
|
-
|
724
|
-
|
705
|
+
# Use the spinner function
|
706
|
+
spinner("Waiting to avoid rate limits...", 5, color=COLORS['yellow'])
|
725
707
|
|
726
708
|
# Combine condensed chunks
|
727
709
|
combined_condensed = "\n\n".join(condensed_chunks)
|
@@ -737,7 +719,7 @@ SECTION OF ANALYSIS TO CONDENSE:
|
|
737
719
|
return recursive_chunk_analysis(
|
738
720
|
client,
|
739
721
|
combined_condensed,
|
740
|
-
|
722
|
+
context,
|
741
723
|
chunk_size,
|
742
724
|
logger,
|
743
725
|
max_msg_lines,
|
@@ -888,6 +870,29 @@ The analyses to combine:
|
|
888
870
|
|
889
871
|
{all_analyses}
|
890
872
|
|
873
|
+
RULES FOR FILENAMES:
|
874
|
+
1. For the FIRST mention of a file, use the full relative path
|
875
|
+
2. For SUBSEQUENT mentions of the same file, use ONLY the filename without path
|
876
|
+
- Example: First mention: "utils/helpers/format.js" → Subsequent mentions: "format.js"
|
877
|
+
3. Only include the full path again if there are multiple files with the same name
|
878
|
+
4. For repeated mentions of the same file, consider grouping related changes in one bullet
|
879
|
+
|
880
|
+
BULLET POINT FORMAT:
|
881
|
+
- Each bullet MUST start with a type in square brackets: [type]
|
882
|
+
- DO NOT use the format "- type: description" (without square brackets)
|
883
|
+
- Instead, ALWAYS use "- [type] description" (with square brackets)
|
884
|
+
- Example: "- [feat] Add new login component" (correct)
|
885
|
+
- Not: "- feat: Add new login component" (incorrect)
|
886
|
+
|
887
|
+
EXAMPLE OF PROPERLY FORMATTED COMMIT MESSAGE:
|
888
|
+
refactor(core): simplify context handling for commit prompts
|
889
|
+
|
890
|
+
- [refactor] Remove process_context function (cli/modes/gitcommsg.py:69-124)
|
891
|
+
- [refactor] Update all functions to accept raw context string (gitcommsg.py:create_system_prompt())
|
892
|
+
- [refactor] Replace context_data usages with context (gitcommsg.py)
|
893
|
+
- [docs] Update library usage doc (docs/usage/library_usage.md:516,531-537)
|
894
|
+
- [chore] Bump project version to 2.15.1 (pyproject.toml:3, uv.lock:137)
|
895
|
+
|
891
896
|
REMINDER:
|
892
897
|
- First line must be under 50 characters
|
893
898
|
- Include a blank line after the first line
|
@@ -958,16 +963,16 @@ def gitcommsg_mode(client, args, logger=None):
|
|
958
963
|
active_logger.log_diff("DEBUG", diff_content)
|
959
964
|
|
960
965
|
# Process context if provided
|
961
|
-
|
966
|
+
context = None
|
962
967
|
if args.message_context:
|
963
|
-
|
968
|
+
context = args.message_context
|
964
969
|
if active_logger:
|
965
|
-
active_logger.debug(f"
|
966
|
-
active_logger.log_content("DEBUG", "
|
970
|
+
active_logger.debug(f"Using raw context: {context}")
|
971
|
+
active_logger.log_content("DEBUG", "CONTEXT", context)
|
967
972
|
|
968
973
|
# Create system prompts for different stages
|
969
|
-
technical_system_prompt = create_technical_analysis_system_prompt(
|
970
|
-
commit_system_prompt = create_system_prompt(
|
974
|
+
technical_system_prompt = create_technical_analysis_system_prompt(context)
|
975
|
+
commit_system_prompt = create_system_prompt(context)
|
971
976
|
|
972
977
|
# Log system prompts
|
973
978
|
if active_logger:
|
@@ -1006,7 +1011,7 @@ def gitcommsg_mode(client, args, logger=None):
|
|
1006
1011
|
result = process_with_chunking(
|
1007
1012
|
client,
|
1008
1013
|
diff_content,
|
1009
|
-
|
1014
|
+
context,
|
1010
1015
|
chunk_size=args.chunk_size,
|
1011
1016
|
recursive=True,
|
1012
1017
|
logger=active_logger,
|
ngpt/cli/ui.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import sys
|
2
|
+
import time
|
2
3
|
import shutil
|
3
4
|
|
4
5
|
# Optional imports for enhanced UI
|
@@ -151,4 +152,37 @@ def get_multiline_input():
|
|
151
152
|
|
152
153
|
except KeyboardInterrupt:
|
153
154
|
print("\nInput cancelled by user. Exiting gracefully.")
|
154
|
-
return None
|
155
|
+
return None
|
156
|
+
|
157
|
+
def spinner(message, duration=5, spinner_chars="⣾⣽⣻⢿⡿⣟⣯⣷", color=None):
|
158
|
+
"""Display a spinner animation with a message.
|
159
|
+
|
160
|
+
Args:
|
161
|
+
message: The message to display alongside the spinner
|
162
|
+
duration: Duration in seconds to show the spinner
|
163
|
+
spinner_chars: Characters to use for the spinner animation
|
164
|
+
color: Optional color from COLORS dict to use for the message
|
165
|
+
"""
|
166
|
+
# Default color handling
|
167
|
+
color_start = ""
|
168
|
+
color_end = ""
|
169
|
+
if color:
|
170
|
+
color_start = color
|
171
|
+
color_end = "\033[0m" # Reset
|
172
|
+
|
173
|
+
# Each character shows for 0.2 seconds
|
174
|
+
char_duration = 0.2
|
175
|
+
# Total number of characters to show (not iterations through the entire spinner sequence)
|
176
|
+
total_chars = int(duration / char_duration)
|
177
|
+
|
178
|
+
# Run the spinner
|
179
|
+
for i in range(total_chars):
|
180
|
+
# Get the appropriate character by cycling through the spinner characters
|
181
|
+
char = spinner_chars[i % len(spinner_chars)]
|
182
|
+
sys.stdout.write(f"\r{color_start}{message} {char}{color_end}")
|
183
|
+
sys.stdout.flush()
|
184
|
+
time.sleep(char_duration)
|
185
|
+
|
186
|
+
# Clear the line when done
|
187
|
+
sys.stdout.write("\r" + " " * (len(message) + 10) + "\r")
|
188
|
+
sys.stdout.flush()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version: 2.15.
|
3
|
+
Version: 2.15.2
|
4
4
|
Summary: A lightweight Python CLI and library for interacting with OpenAI-compatible APIs, supporting both official and self-hosted LLM endpoints.
|
5
5
|
Project-URL: Homepage, https://github.com/nazdridoy/ngpt
|
6
6
|
Project-URL: Repository, https://github.com/nazdridoy/ngpt
|
@@ -8,11 +8,11 @@ ngpt/cli/formatters.py,sha256=HBYGlx_7eoAKyzfy0Vq5L0yn8yVKjngqYBukMmXCcz0,9401
|
|
8
8
|
ngpt/cli/interactive.py,sha256=DZFbExcXd7RylkpBiZBhiI6N8FBaT0m_lBes0Pvhi48,10894
|
9
9
|
ngpt/cli/main.py,sha256=6GO4r9e9su7FFukj9JeVmJt1bJsqPOJBj6xo3iyMZXU,28911
|
10
10
|
ngpt/cli/renderers.py,sha256=gJ3WdVvCGkNxrLEkLCh6gk9HBFMK8y7an6CsEkqt2Z8,10535
|
11
|
-
ngpt/cli/ui.py,sha256=
|
11
|
+
ngpt/cli/ui.py,sha256=gTtxg2E1WJg4W9JQxrUaM83OYjKjv6pOFTOaWlfa6Mw,6548
|
12
12
|
ngpt/cli/modes/__init__.py,sha256=R3aO662RIzWEOvr3moTrEI8Tpg0zDDyMGGh1-OxiRgM,285
|
13
13
|
ngpt/cli/modes/chat.py,sha256=4a5EgM_5A1zCSrLrjgQMDnBwIHd1Rnu5_BjSKSm7p24,4255
|
14
14
|
ngpt/cli/modes/code.py,sha256=RjOAj7BDO5vLUdIPkUfPtyIkI_W6qEHsZvYh-sIdVaM,4293
|
15
|
-
ngpt/cli/modes/gitcommsg.py,sha256=
|
15
|
+
ngpt/cli/modes/gitcommsg.py,sha256=dbT9_Y1RiahJxBXvrKC0IIEddzd7CXjMae7txauOK7Q,44840
|
16
16
|
ngpt/cli/modes/rewrite.py,sha256=Zb0PFvWRKXs4xJCF3GEdYc-LSmy6qRszz8-QJuldHc0,8595
|
17
17
|
ngpt/cli/modes/shell.py,sha256=lF9f7w-0bl_FdZl-WJnZuV736BKrWQtrwoKr3ejPXFE,2682
|
18
18
|
ngpt/cli/modes/text.py,sha256=ncYnfLFMdTPuHiOvAaHNiOWhox6GF6S-2fTwMIrAz-g,3140
|
@@ -20,8 +20,8 @@ ngpt/utils/__init__.py,sha256=E46suk2-QgYBI0Qrs6WXOajOUOebF3ETAFY7ah8DTWs,942
|
|
20
20
|
ngpt/utils/cli_config.py,sha256=tQxR3a2iXyc5TfRBPQHSUXPInO2dv_zTPGn04eWfmoo,11285
|
21
21
|
ngpt/utils/config.py,sha256=WYOk_b1eiYjo6hpV3pfXr2RjqhOnmKqwZwKid1T41I4,10363
|
22
22
|
ngpt/utils/log.py,sha256=f1jg2iFo35PAmsarH8FVL_62plq4VXH0Mu2QiP6RJGw,15934
|
23
|
-
ngpt-2.15.
|
24
|
-
ngpt-2.15.
|
25
|
-
ngpt-2.15.
|
26
|
-
ngpt-2.15.
|
27
|
-
ngpt-2.15.
|
23
|
+
ngpt-2.15.2.dist-info/METADATA,sha256=ZUt1VWznWOfW3-kOB9EgIV8Xkw0x2LdoR8Q9BTMeOkg,23523
|
24
|
+
ngpt-2.15.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
25
|
+
ngpt-2.15.2.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
|
26
|
+
ngpt-2.15.2.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
|
27
|
+
ngpt-2.15.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|