ngpt 3.9.6__py3-none-any.whl → 3.10.0__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 +112 -2
- {ngpt-3.9.6.dist-info → ngpt-3.10.0.dist-info}/METADATA +1 -1
- {ngpt-3.9.6.dist-info → ngpt-3.10.0.dist-info}/RECORD +6 -6
- {ngpt-3.9.6.dist-info → ngpt-3.10.0.dist-info}/WHEEL +0 -0
- {ngpt-3.9.6.dist-info → ngpt-3.10.0.dist-info}/entry_points.txt +0 -0
- {ngpt-3.9.6.dist-info → ngpt-3.10.0.dist-info}/licenses/LICENSE +0 -0
ngpt/cli/modes/gitcommsg.py
CHANGED
@@ -582,7 +582,7 @@ def process_with_chunking(client, diff_content, preprompt, chunk_size=200, recur
|
|
582
582
|
|
583
583
|
# If the commit message is too long, we need to condense it
|
584
584
|
if len(commit_message.splitlines()) > max_msg_lines:
|
585
|
-
|
585
|
+
commit_message = condense_commit_message(
|
586
586
|
client,
|
587
587
|
commit_message,
|
588
588
|
commit_system_prompt,
|
@@ -591,6 +591,10 @@ def process_with_chunking(client, diff_content, preprompt, chunk_size=200, recur
|
|
591
591
|
1, # Start at depth 1
|
592
592
|
logger
|
593
593
|
)
|
594
|
+
|
595
|
+
# Format the final commit message to eliminate path repetition and improve readability
|
596
|
+
commit_message = optimize_file_references(client, commit_message, commit_system_prompt, logger)
|
597
|
+
|
594
598
|
return commit_message
|
595
599
|
except Exception as e:
|
596
600
|
# Stop the spinner
|
@@ -672,7 +676,7 @@ DO NOT include any explanation or commentary outside the commit message format."
|
|
672
676
|
|
673
677
|
# If the commit message is too long, we need to condense it
|
674
678
|
if len(commit_message.splitlines()) > max_msg_lines:
|
675
|
-
|
679
|
+
commit_message = condense_commit_message(
|
676
680
|
client,
|
677
681
|
commit_message,
|
678
682
|
commit_system_prompt,
|
@@ -681,6 +685,10 @@ DO NOT include any explanation or commentary outside the commit message format."
|
|
681
685
|
1, # Start at depth 1
|
682
686
|
logger
|
683
687
|
)
|
688
|
+
|
689
|
+
# Format the final commit message to eliminate path repetition and improve readability
|
690
|
+
commit_message = optimize_file_references(client, commit_message, commit_system_prompt, logger)
|
691
|
+
|
684
692
|
return commit_message
|
685
693
|
|
686
694
|
# Analysis is still too large, need to chunk it
|
@@ -1015,6 +1023,105 @@ def strip_code_block_formatting(text):
|
|
1015
1023
|
return match.group(1).rstrip()
|
1016
1024
|
return text
|
1017
1025
|
|
1026
|
+
def optimize_file_references(client, commit_message, system_prompt=None, logger=None):
|
1027
|
+
"""Optimize the file references in the commit message by eliminating path repetition and improving readability.
|
1028
|
+
|
1029
|
+
Args:
|
1030
|
+
client: The NGPTClient instance
|
1031
|
+
commit_message: The commit message to format
|
1032
|
+
system_prompt: Optional system prompt for formatting
|
1033
|
+
logger: Optional logger instance
|
1034
|
+
|
1035
|
+
Returns:
|
1036
|
+
str: Commit message with optimized file references
|
1037
|
+
"""
|
1038
|
+
# If no system prompt provided, use a minimalist one
|
1039
|
+
if not system_prompt:
|
1040
|
+
system_prompt = """You are an expert Git commit message formatter."""
|
1041
|
+
|
1042
|
+
format_prompt = f"""TASK: Reformat file paths in this commit message to make it more readable while preserving the standard format
|
1043
|
+
|
1044
|
+
COMMIT MESSAGE TO OPTIMIZE:
|
1045
|
+
{commit_message}
|
1046
|
+
|
1047
|
+
MAINTAIN THIS EXACT FORMAT FOR EACH BULLET:
|
1048
|
+
- [type] Description with file references (filepath:line/function)
|
1049
|
+
|
1050
|
+
FILE PATH OPTIMIZATION RULES (CRITICAL PRIORITY):
|
1051
|
+
1. PRESERVE PROPER PARENTHESES FORMAT - File references go in parentheses at the end of each bullet:
|
1052
|
+
• "- [add] Add components (src/components/Button.jsx, Card.jsx)"
|
1053
|
+
• Always keep references in parentheses at the end
|
1054
|
+
|
1055
|
+
2. ELIMINATE PATH REPETITION in file lists:
|
1056
|
+
• "- [add] Add components (src/components/Button.jsx, src/components/Card.jsx)" - BAD
|
1057
|
+
• "- [add] Add components (src/components/*.jsx)" - Use wildcard when appropriate
|
1058
|
+
• "- [add] Add 5 component files (src/components/)" - Use count for many files
|
1059
|
+
|
1060
|
+
3. AVOID REDUNDANT FILENAMES:
|
1061
|
+
• Don't repeat filenames in both description and parentheses
|
1062
|
+
• Group files by category in the description
|
1063
|
+
|
1064
|
+
EXAMPLES THAT FOLLOW THE PROPER FORMAT:
|
1065
|
+
|
1066
|
+
❌ BEFORE (POOR FORMATTING):
|
1067
|
+
- [docs] Add documentation for tawhid, names_of_allah, transcendence (islam/beliefs/tawhid.md, islam/beliefs/names_of_allah.md, islam/beliefs/transcendence.md)
|
1068
|
+
|
1069
|
+
✅ AFTER (GOOD FORMATTING):
|
1070
|
+
- [docs] Add documentation for theological concepts (islam/beliefs/tawhid.md, names_of_allah.md, transcendence.md)
|
1071
|
+
|
1072
|
+
❌ BEFORE (POOR FORMATTING):
|
1073
|
+
- [fix] Update error handling in app/utils/errors.js, app/utils/validation.js, app/utils/formatting.js
|
1074
|
+
|
1075
|
+
✅ AFTER (GOOD FORMATTING):
|
1076
|
+
- [fix] Update error handling (app/utils/errors.js, validation.js, formatting.js)
|
1077
|
+
|
1078
|
+
RULES FOR OUTPUT:
|
1079
|
+
1. PRESERVE proper format with parentheses at the end
|
1080
|
+
2. Keep the same bullet structure and number of bullets
|
1081
|
+
3. DO NOT change type tags or summary line
|
1082
|
+
4. Mention common paths ONCE, then list files
|
1083
|
+
|
1084
|
+
THE STANDARD FORMAT FOR COMMIT MESSAGES IS:
|
1085
|
+
type[(scope)]: concise summary
|
1086
|
+
|
1087
|
+
- [type] Description (filepath:line/function)
|
1088
|
+
- [type] Another description (filepath:line/function)"""
|
1089
|
+
|
1090
|
+
# Log formatting template
|
1091
|
+
if logger:
|
1092
|
+
logger.log_template("DEBUG", "OPTIMIZE_FILE_REFS", format_prompt)
|
1093
|
+
|
1094
|
+
# Start spinner for formatting
|
1095
|
+
stop_spinner = threading.Event()
|
1096
|
+
spinner_thread = threading.Thread(
|
1097
|
+
target=spinner,
|
1098
|
+
args=("Optimizing file references...",),
|
1099
|
+
kwargs={"stop_event": stop_spinner, "color": COLORS['green']}
|
1100
|
+
)
|
1101
|
+
spinner_thread.daemon = True
|
1102
|
+
spinner_thread.start()
|
1103
|
+
|
1104
|
+
try:
|
1105
|
+
formatted_message = handle_api_call(client, format_prompt, system_prompt, logger)
|
1106
|
+
# Stop the spinner
|
1107
|
+
stop_spinner.set()
|
1108
|
+
spinner_thread.join()
|
1109
|
+
|
1110
|
+
if logger:
|
1111
|
+
logger.log_content("DEBUG", "OPTIMIZED_FILE_REFS", formatted_message)
|
1112
|
+
|
1113
|
+
return formatted_message
|
1114
|
+
except Exception as e:
|
1115
|
+
# Stop the spinner
|
1116
|
+
stop_spinner.set()
|
1117
|
+
spinner_thread.join()
|
1118
|
+
|
1119
|
+
print(f"{COLORS['red']}Error optimizing file references: {str(e)}{COLORS['reset']}")
|
1120
|
+
if logger:
|
1121
|
+
logger.error(f"Error optimizing file references: {str(e)}")
|
1122
|
+
# Return the original message if formatting fails
|
1123
|
+
return commit_message
|
1124
|
+
|
1018
1125
|
def gitcommsg_mode(client, args, logger=None):
|
1019
1126
|
"""Handle the Git commit message generation mode.
|
1020
1127
|
|
@@ -1195,6 +1302,9 @@ def gitcommsg_mode(client, args, logger=None):
|
|
1195
1302
|
1, # Start at depth 1
|
1196
1303
|
active_logger
|
1197
1304
|
)
|
1305
|
+
|
1306
|
+
# Format the final commit message to eliminate path repetition and improve readability
|
1307
|
+
result = optimize_file_references(client, result, commit_system_prompt, active_logger)
|
1198
1308
|
|
1199
1309
|
if not result:
|
1200
1310
|
print(f"{COLORS['red']}Failed to generate commit message.{COLORS['reset']}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.10.0
|
4
4
|
Summary: A Swiss army knife for LLMs: A fast, lightweight CLI and interactive chat tool that brings the power of any OpenAI-compatible LLM (OpenAI, Ollama, Groq, Claude, Gemini, etc.) straight to your terminal. rewrite texts or refine code, craft git commit messages, generate and run OS-aware shell commands.
|
5
5
|
Project-URL: Homepage, https://github.com/nazdridoy/ngpt
|
6
6
|
Project-URL: Repository, https://github.com/nazdridoy/ngpt
|
@@ -12,7 +12,7 @@ ngpt/cli/ui.py,sha256=8-WyPMwgQiqLXWO0mGfBhKTRnIDDtPUtm_XCvOnqBJA,11334
|
|
12
12
|
ngpt/cli/modes/__init__.py,sha256=KP7VR6Xw9k1p5Jcu0F38RDxSFvFIzH3j1ThDLNwznUI,363
|
13
13
|
ngpt/cli/modes/chat.py,sha256=x1leClKq7UupA_CdW4tym0AivY2o_II123-I5IcAkxQ,7091
|
14
14
|
ngpt/cli/modes/code.py,sha256=Qj59xq6fZqgUDw7SbvmPKX_gdpc7DHJhNkn1sB5qgUU,12932
|
15
|
-
ngpt/cli/modes/gitcommsg.py,sha256=
|
15
|
+
ngpt/cli/modes/gitcommsg.py,sha256=qFOrll333ebFOkzLP_WD1Qw0VfpphYqeiuHumkP6OB4,54833
|
16
16
|
ngpt/cli/modes/interactive.py,sha256=E0c38NA8xnuRKAce40F35uFYcohFDvaqSB8nf1ywS-4,17958
|
17
17
|
ngpt/cli/modes/rewrite.py,sha256=QQm453X9aoUQP9CAtmeghlMytMJPlsDZPKef9tGfj6g,11181
|
18
18
|
ngpt/cli/modes/shell.py,sha256=it1Brq1-LGeNfPKYBeVAwF-a78g9UP-KscofBZQkbr4,41589
|
@@ -23,8 +23,8 @@ ngpt/utils/config.py,sha256=wsArA4osnh8fKqOvtsPqqBxAz3DpdjtaWUFaRtnUdyc,10452
|
|
23
23
|
ngpt/utils/log.py,sha256=f1jg2iFo35PAmsarH8FVL_62plq4VXH0Mu2QiP6RJGw,15934
|
24
24
|
ngpt/utils/pipe.py,sha256=qRHF-Ma7bbU0cOcb1Yhe4S-kBavivtnnvLA3EYS4FY4,2162
|
25
25
|
ngpt/utils/web_search.py,sha256=w5ke4KJMRxq7r5jtbUXvspja6XhjoPZloVkZ0IvBXIE,30731
|
26
|
-
ngpt-3.
|
27
|
-
ngpt-3.
|
28
|
-
ngpt-3.
|
29
|
-
ngpt-3.
|
30
|
-
ngpt-3.
|
26
|
+
ngpt-3.10.0.dist-info/METADATA,sha256=aQd90ttzPmR6FOrNLBA-Y1RdnInO2Q48R-8WS4Ey650,31175
|
27
|
+
ngpt-3.10.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
28
|
+
ngpt-3.10.0.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
|
29
|
+
ngpt-3.10.0.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
|
30
|
+
ngpt-3.10.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|