ngpt 2.16.7__tar.gz → 3.0.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.
- {ngpt-2.16.7 → ngpt-3.0.0}/PKG-INFO +19 -19
- {ngpt-2.16.7 → ngpt-3.0.0}/README.md +17 -17
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/README.md +1 -1
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/api/cli.md +11 -9
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/api/cli_config.md +2 -3
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/configuration.md +12 -12
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/examples/basic.md +9 -9
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/overview.md +1 -1
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/usage/README.md +3 -3
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/usage/cli_config.md +9 -9
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/usage/cli_framework.md +12 -12
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/usage/cli_usage.md +60 -70
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/usage/gitcommsg.md +40 -40
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/usage/library_usage.md +2 -2
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/args.py +6 -8
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/main.py +3 -3
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/modes/chat.py +2 -2
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/modes/gitcommsg.py +55 -54
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/utils/cli_config.py +1 -2
- {ngpt-2.16.7 → ngpt-3.0.0}/pyproject.toml +2 -2
- {ngpt-2.16.7 → ngpt-3.0.0}/uv.lock +1 -1
- {ngpt-2.16.7 → ngpt-3.0.0}/wiki.md +1 -1
- {ngpt-2.16.7 → ngpt-3.0.0}/.github/workflows/python-publish.yml +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/.gitignore +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/.python-version +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/COMMIT_GUIDELINES.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/CONTRIBUTING.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/LICENSE +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/CONTRIBUTING.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/LICENSE.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/_config.yml +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/api/README.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/api/client.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/api/config.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/api/logging.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/assets/css/style.scss +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/examples/README.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/examples/advanced.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/examples/cli_components.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/examples/integrations.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/docs/installation.md +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/__init__.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/__main__.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/__init__.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/config_manager.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/formatters.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/interactive.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/modes/__init__.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/modes/code.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/modes/rewrite.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/modes/shell.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/modes/text.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/renderers.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/cli/ui.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/client.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/utils/__init__.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/utils/config.py +0 -0
- {ngpt-2.16.7 → ngpt-3.0.0}/ngpt/utils/log.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ngpt
|
3
|
-
Version:
|
4
|
-
Summary: Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible Python library. Works with OpenAI, Ollama, Groq, Claude, and any OpenAI-compatible API.
|
3
|
+
Version: 3.0.0
|
4
|
+
Summary: Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible Python library. Works with OpenAI, Ollama, Groq, Claude, Gemini, and any OpenAI-compatible API.
|
5
5
|
Project-URL: Homepage, https://github.com/nazdridoy/ngpt
|
6
6
|
Project-URL: Repository, https://github.com/nazdridoy/ngpt
|
7
7
|
Project-URL: Bug Tracker, https://github.com/nazdridoy/ngpt/issues
|
@@ -36,7 +36,7 @@ Description-Content-Type: text/markdown
|
|
36
36
|
|
37
37
|
# nGPT
|
38
38
|
|
39
|
-
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible library all in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
39
|
+
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible library all in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
40
40
|
|
41
41
|
[](https://pypi.org/project/ngpt/)
|
42
42
|
[](https://opensource.org/licenses/MIT)
|
@@ -109,34 +109,34 @@ ngpt --code --stream-prettify "function to calculate the Fibonacci sequence"
|
|
109
109
|
ngpt --shell "list all files in the current directory"
|
110
110
|
|
111
111
|
# Read from stdin and use the content in your prompt
|
112
|
-
echo "What is this text about?" | ngpt
|
112
|
+
echo "What is this text about?" | ngpt -p "Analyze the following text: {}"
|
113
113
|
|
114
114
|
# Rewrite text to improve quality while preserving tone and meaning
|
115
|
-
echo "your text" | ngpt
|
115
|
+
echo "your text" | ngpt -r
|
116
116
|
|
117
117
|
# Rewrite text from a command-line argument
|
118
|
-
ngpt
|
118
|
+
ngpt -r "your text to rewrite"
|
119
119
|
|
120
120
|
# Rewrite text from a file
|
121
|
-
cat file.txt | ngpt
|
121
|
+
cat file.txt | ngpt -r
|
122
122
|
|
123
123
|
# Generate AI-powered git commit messages for staged changes
|
124
|
-
ngpt
|
124
|
+
ngpt -g
|
125
125
|
|
126
|
-
# Generate commit message with context
|
127
|
-
ngpt --
|
126
|
+
# Generate commit message from staged changes with a context directive
|
127
|
+
ngpt -g --preprompt "type:feat"
|
128
128
|
|
129
129
|
# Process large diffs in chunks with recursive analysis
|
130
|
-
ngpt --
|
130
|
+
ngpt -g --rec-chunk
|
131
131
|
|
132
132
|
# Process a diff file instead of staged changes
|
133
|
-
ngpt
|
133
|
+
ngpt -g --diff /path/to/changes.diff
|
134
134
|
|
135
135
|
# Generate a commit message with logging for debugging
|
136
|
-
ngpt
|
136
|
+
ngpt -g --log commit_log.txt
|
137
137
|
|
138
138
|
# Use interactive multiline editor to enter text to rewrite
|
139
|
-
ngpt
|
139
|
+
ngpt -r
|
140
140
|
|
141
141
|
# Display markdown responses with beautiful formatting
|
142
142
|
ngpt --prettify "Explain markdown syntax with examples"
|
@@ -160,7 +160,7 @@ ngpt --interactive --log conversation.log
|
|
160
160
|
ngpt --log "Tell me about quantum computing"
|
161
161
|
|
162
162
|
# Process text from stdin using the {} placeholder
|
163
|
-
cat README.md | ngpt
|
163
|
+
cat README.md | ngpt -p "Summarize this document: {}"
|
164
164
|
|
165
165
|
# Use different model providers by specifying the provider name
|
166
166
|
ngpt --provider Groq "Explain quantum computing"
|
@@ -176,7 +176,7 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
|
|
176
176
|
|
177
177
|
- ✅ **Versatile**: Use as a CLI tool, Python library, or CLI framework for building custom tools
|
178
178
|
- 🪶 **Lightweight**: Minimal dependencies with everything you need included
|
179
|
-
- 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, Claude, and any compatible endpoint
|
179
|
+
- 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, Claude, Gemini, and any compatible endpoint
|
180
180
|
- 💬 **Interactive Chat**: Continuous conversation with memory in modern UI
|
181
181
|
- 📊 **Streaming Responses**: Real-time output for better user experience
|
182
182
|
- 🔍 **Web Search**: Integrated with compatible API endpoints
|
@@ -442,9 +442,9 @@ You can configure nGPT using the following options:
|
|
442
442
|
| `-s, --shell` | Generate and execute shell commands appropriate for your operating system |
|
443
443
|
| `-c, --code` | Generate clean code without markdown formatting or explanations |
|
444
444
|
| `-t, --text` | Open interactive multiline editor for complex prompts with syntax highlighting |
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
445
|
+
| `-p, --pipe` | Read from stdin and use content with prompt. Use {} in prompt as placeholder for stdin content |
|
446
|
+
| `-r, --rewrite` | Rewrite text to improve quality while preserving original tone and meaning |
|
447
|
+
| `-g, --gitcommsg` | Generate AI-powered git commit messages from staged changes or diff files |
|
448
448
|
|
449
449
|
#### Global Options
|
450
450
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# nGPT
|
2
2
|
|
3
|
-
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible library all in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
3
|
+
🤖 nGPT: A Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible library all in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
4
4
|
|
5
5
|
[](https://pypi.org/project/ngpt/)
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
@@ -73,34 +73,34 @@ ngpt --code --stream-prettify "function to calculate the Fibonacci sequence"
|
|
73
73
|
ngpt --shell "list all files in the current directory"
|
74
74
|
|
75
75
|
# Read from stdin and use the content in your prompt
|
76
|
-
echo "What is this text about?" | ngpt
|
76
|
+
echo "What is this text about?" | ngpt -p "Analyze the following text: {}"
|
77
77
|
|
78
78
|
# Rewrite text to improve quality while preserving tone and meaning
|
79
|
-
echo "your text" | ngpt
|
79
|
+
echo "your text" | ngpt -r
|
80
80
|
|
81
81
|
# Rewrite text from a command-line argument
|
82
|
-
ngpt
|
82
|
+
ngpt -r "your text to rewrite"
|
83
83
|
|
84
84
|
# Rewrite text from a file
|
85
|
-
cat file.txt | ngpt
|
85
|
+
cat file.txt | ngpt -r
|
86
86
|
|
87
87
|
# Generate AI-powered git commit messages for staged changes
|
88
|
-
ngpt
|
88
|
+
ngpt -g
|
89
89
|
|
90
|
-
# Generate commit message with context
|
91
|
-
ngpt --
|
90
|
+
# Generate commit message from staged changes with a context directive
|
91
|
+
ngpt -g --preprompt "type:feat"
|
92
92
|
|
93
93
|
# Process large diffs in chunks with recursive analysis
|
94
|
-
ngpt --
|
94
|
+
ngpt -g --rec-chunk
|
95
95
|
|
96
96
|
# Process a diff file instead of staged changes
|
97
|
-
ngpt
|
97
|
+
ngpt -g --diff /path/to/changes.diff
|
98
98
|
|
99
99
|
# Generate a commit message with logging for debugging
|
100
|
-
ngpt
|
100
|
+
ngpt -g --log commit_log.txt
|
101
101
|
|
102
102
|
# Use interactive multiline editor to enter text to rewrite
|
103
|
-
ngpt
|
103
|
+
ngpt -r
|
104
104
|
|
105
105
|
# Display markdown responses with beautiful formatting
|
106
106
|
ngpt --prettify "Explain markdown syntax with examples"
|
@@ -124,7 +124,7 @@ ngpt --interactive --log conversation.log
|
|
124
124
|
ngpt --log "Tell me about quantum computing"
|
125
125
|
|
126
126
|
# Process text from stdin using the {} placeholder
|
127
|
-
cat README.md | ngpt
|
127
|
+
cat README.md | ngpt -p "Summarize this document: {}"
|
128
128
|
|
129
129
|
# Use different model providers by specifying the provider name
|
130
130
|
ngpt --provider Groq "Explain quantum computing"
|
@@ -140,7 +140,7 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
|
|
140
140
|
|
141
141
|
- ✅ **Versatile**: Use as a CLI tool, Python library, or CLI framework for building custom tools
|
142
142
|
- 🪶 **Lightweight**: Minimal dependencies with everything you need included
|
143
|
-
- 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, Claude, and any compatible endpoint
|
143
|
+
- 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, Claude, Gemini, and any compatible endpoint
|
144
144
|
- 💬 **Interactive Chat**: Continuous conversation with memory in modern UI
|
145
145
|
- 📊 **Streaming Responses**: Real-time output for better user experience
|
146
146
|
- 🔍 **Web Search**: Integrated with compatible API endpoints
|
@@ -406,9 +406,9 @@ You can configure nGPT using the following options:
|
|
406
406
|
| `-s, --shell` | Generate and execute shell commands appropriate for your operating system |
|
407
407
|
| `-c, --code` | Generate clean code without markdown formatting or explanations |
|
408
408
|
| `-t, --text` | Open interactive multiline editor for complex prompts with syntax highlighting |
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
| `-p, --pipe` | Read from stdin and use content with prompt. Use {} in prompt as placeholder for stdin content |
|
410
|
+
| `-r, --rewrite` | Rewrite text to improve quality while preserving original tone and meaning |
|
411
|
+
| `-g, --gitcommsg` | Generate AI-powered git commit messages from staged changes or diff files |
|
412
412
|
|
413
413
|
#### Global Options
|
414
414
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# nGPT Documentation
|
2
2
|
|
3
|
-
Welcome to the documentation for nGPT, a Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible library all in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers. nGPT offers three main modes of use:
|
3
|
+
Welcome to the documentation for nGPT, a Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible library all in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers. nGPT offers three main modes of use:
|
4
4
|
|
5
5
|
- A command-line interface (CLI) tool for quick AI interactions
|
6
6
|
- A Python library for integration into your applications
|
@@ -716,13 +716,14 @@ Executes a git commit message generation operation to create commit messages bas
|
|
716
716
|
- `client` (NGPTClient): The initialized client for the operation
|
717
717
|
- `args` (namespace): Parsed command-line arguments including:
|
718
718
|
- `diff_file` (str, optional): Path to diff file to use instead of git diff --staged
|
719
|
-
- `
|
719
|
+
- `preprompt` (str, optional): Custom system prompt to guide AI behavior (used here as context for gitcommsg)
|
720
720
|
- `temperature` (float): Temperature setting (0.0-1.0)
|
721
721
|
- `max_tokens` (int, optional): Maximum tokens to generate
|
722
722
|
- `chunk_size` (int): Number of lines per chunk for large diffs
|
723
|
-
- `
|
724
|
-
- `
|
725
|
-
- `
|
723
|
+
- `analyses_chunk_size` (int): Number of lines per chunk for recursive analysis chunks
|
724
|
+
- `max_msg_lines` (int): Maximum lines in the generated commit message
|
725
|
+
- `max_recursion_depth` (int): Maximum recursion depth for message condensing
|
726
|
+
- `rec_chunk` (bool): Whether to use recursive chunking for large diffs
|
726
727
|
- `web_search` (bool): Whether to enable web search
|
727
728
|
- `logger` (object, optional): Logger instance
|
728
729
|
|
@@ -730,7 +731,7 @@ Executes a git commit message generation operation to create commit messages bas
|
|
730
731
|
- **Git Diff Analysis**: Analyzes staged git changes to create relevant commit messages
|
731
732
|
- **Conventional Commit Format**: Follows standard commit message format (type(scope): message)
|
732
733
|
- **Chunking Strategy**: Handles large diffs by splitting into manageable chunks
|
733
|
-
- **Recursive Analysis**: Optional
|
734
|
+
- **Recursive Analysis**: Optional analysis of complex changes
|
734
735
|
- **Context Directives**: Supports filtering and focusing on specific file types/components
|
735
736
|
- **Technical Detail Extraction**: Extracts function names, line numbers, and specific changes
|
736
737
|
|
@@ -745,13 +746,14 @@ client = NGPTClient(**load_config())
|
|
745
746
|
# Create args namespace with required parameters
|
746
747
|
args = argparse.Namespace()
|
747
748
|
args.diff_file = None # Use git staged changes
|
748
|
-
args.
|
749
|
+
args.preprompt = "type:feat focus on authentication"
|
749
750
|
args.temperature = 0.4
|
750
751
|
args.max_tokens = None
|
751
752
|
args.chunk_size = 200
|
752
|
-
args.
|
753
|
-
args.
|
754
|
-
args.
|
753
|
+
args.analyses_chunk_size = 200
|
754
|
+
args.max_msg_lines = 20
|
755
|
+
args.max_recursion_depth = 3
|
756
|
+
args.rec_chunk = True
|
755
757
|
args.web_search = False
|
756
758
|
|
757
759
|
gitcommsg_mode(
|
@@ -277,9 +277,8 @@ The following options are available for configuration:
|
|
277
277
|
| `config-index` | int | all | Default configuration index to use |
|
278
278
|
| `log` | string | all | Path to log file |
|
279
279
|
| `preprompt` | string | all | Custom preprompt to use |
|
280
|
-
| `
|
281
|
-
| `
|
282
|
-
| `diff` | string | gitcommsg | Path to diff file for git commit message generation |
|
280
|
+
| `rec-chunk` | bool | gitcommsg | Enable recursive chunking for large diffs |
|
281
|
+
| `diff` | string | gitcommsg | Path to diff file |
|
283
282
|
| `chunk-size` | int | gitcommsg | Maximum number of lines per chunk |
|
284
283
|
| `analyses-chunk-size` | int | gitcommsg | Maximum number of lines per chunk for analyses |
|
285
284
|
| `max-msg-lines` | int | gitcommsg | Maximum number of lines in commit message |
|
@@ -158,9 +158,9 @@ You can also set configuration options directly via command-line arguments:
|
|
158
158
|
- `-c, --code`: Generate code.
|
159
159
|
- `--language <lang>`: Specify the programming language for code generation (default: `python`).
|
160
160
|
- `-t, --text`: Use a multiline editor for input.
|
161
|
-
-
|
162
|
-
-
|
163
|
-
-
|
161
|
+
- `-p, --pipe`: Read from stdin and use content in your prompt with {} placeholder.
|
162
|
+
- `-r, --rewrite`: Rewrite text from stdin to be more natural while preserving tone and meaning.
|
163
|
+
- `-g, --gitcommsg`: Generate AI-powered git commit messages from staged changes or diff file.
|
164
164
|
|
165
165
|
### Output Control Flags
|
166
166
|
|
@@ -180,8 +180,8 @@ You can also set configuration options directly via command-line arguments:
|
|
180
180
|
|
181
181
|
### Git Commit Message Flags
|
182
182
|
|
183
|
-
-
|
184
|
-
- `-r, --
|
183
|
+
- `--preprompt <text>`: Context to guide AI generation (e.g., file types, commit type).
|
184
|
+
- `-r, --rec-chunk`: Process large diffs in chunks with recursive analysis if needed.
|
185
185
|
- `--diff [file]`: Use diff from specified file instead of staged changes.
|
186
186
|
- `--chunk-size <number>`: Number of lines per chunk when chunking is enabled (default: 200).
|
187
187
|
- `--analyses-chunk-size <number>`: Number of lines per chunk when recursively chunking analyses (default: 200).
|
@@ -216,13 +216,13 @@ ngpt --interactive --log conversation.log
|
|
216
216
|
ngpt --log "Tell me about quantum computing"
|
217
217
|
|
218
218
|
# Process text from stdin using the {} placeholder
|
219
|
-
echo "What is this text about?" | ngpt
|
219
|
+
echo "What is this text about?" | ngpt -p "Analyze the following text: {}"
|
220
220
|
|
221
221
|
# Generate git commit message from staged changes
|
222
|
-
ngpt
|
222
|
+
ngpt -g
|
223
223
|
|
224
224
|
# Generate git commit message from a diff file
|
225
|
-
ngpt
|
225
|
+
ngpt -g --diff changes.diff
|
226
226
|
```
|
227
227
|
|
228
228
|
## Environment Variables
|
@@ -297,7 +297,7 @@ The following options can be configured persistently:
|
|
297
297
|
- `top_p`: Set top_p value for generations
|
298
298
|
- `max_tokens`: Set maximum tokens for response
|
299
299
|
- `log`: Set default log file path
|
300
|
-
- `preprompt`: Set default
|
300
|
+
- `preprompt`: Set default preprompt guidance
|
301
301
|
- `no-stream`: Disable streaming by default
|
302
302
|
- `prettify`: Enable formatted output by default
|
303
303
|
- `stream-prettify`: Enable streaming with formatting
|
@@ -309,8 +309,8 @@ The following options can be configured persistently:
|
|
309
309
|
- `language`: Set default programming language
|
310
310
|
|
311
311
|
- Git commit message mode options:
|
312
|
-
- `
|
313
|
-
- `
|
312
|
+
- `preprompt`: Set default preprompt guidance
|
313
|
+
- `rec-chunk`: Enable recursive chunking by default
|
314
314
|
- `diff`: Set default diff file path
|
315
315
|
- `chunk-size`: Set default chunk size
|
316
316
|
- `analyses-chunk-size`: Set default analyses chunk size
|
@@ -333,7 +333,7 @@ ngpt --cli-config set stream-prettify true
|
|
333
333
|
ngpt --cli-config set provider Groq
|
334
334
|
|
335
335
|
# Enable recursive chunking for git commit messages
|
336
|
-
ngpt --cli-config set
|
336
|
+
ngpt --cli-config set rec-chunk true
|
337
337
|
|
338
338
|
# Check current temperature setting
|
339
339
|
ngpt --cli-config get temperature
|
@@ -242,13 +242,13 @@ ngpt -t --preprompt "You are a markdown documentation expert"
|
|
242
242
|
|
243
243
|
```bash
|
244
244
|
# Process text from stdin
|
245
|
-
cat file.txt | ngpt
|
245
|
+
cat file.txt | ngpt -p "Summarize this: {}"
|
246
246
|
|
247
247
|
# Analyze code from stdin
|
248
|
-
cat script.py | ngpt
|
248
|
+
cat script.py | ngpt -p "Review this Python code and suggest improvements: {}"
|
249
249
|
|
250
250
|
# Process JSON data
|
251
|
-
curl https://api.example.com/data | ngpt
|
251
|
+
curl https://api.example.com/data | ngpt -p "Parse this JSON data and explain what it contains: {}"
|
252
252
|
```
|
253
253
|
|
254
254
|
### Text Rewriting
|
@@ -258,10 +258,10 @@ curl https://api.example.com/data | ngpt --stdin "Parse this JSON data and expla
|
|
258
258
|
ngpt --rewrite "This is a draft text that needs to be better written with improved grammar and style"
|
259
259
|
|
260
260
|
# Rewrite text from a file
|
261
|
-
cat draft.txt | ngpt
|
261
|
+
cat draft.txt | ngpt -r
|
262
262
|
|
263
263
|
# Rewrite with specific guidance
|
264
|
-
echo "Text to improve" | ngpt
|
264
|
+
echo "Text to improve" | ngpt -r --preprompt "Improve this text while making it more formal and professional"
|
265
265
|
```
|
266
266
|
|
267
267
|
### Git Commit Message Generation
|
@@ -271,16 +271,16 @@ echo "Text to improve" | ngpt --rewrite --preprompt "Improve this text while mak
|
|
271
271
|
ngpt --gitcommsg
|
272
272
|
|
273
273
|
# Generate commit message with specific type
|
274
|
-
ngpt --
|
274
|
+
ngpt -g --preprompt "type:feat"
|
275
275
|
|
276
276
|
# Generate message for large changes with recursive analysis
|
277
|
-
ngpt --
|
277
|
+
ngpt -g --rec-chunk
|
278
278
|
|
279
279
|
# Process a specific diff file
|
280
|
-
ngpt
|
280
|
+
ngpt -g --diff changes.diff
|
281
281
|
|
282
282
|
# Log the commit message generation process
|
283
|
-
ngpt
|
283
|
+
ngpt -g --log commit_debug.log
|
284
284
|
```
|
285
285
|
|
286
286
|
## Using CLI Config
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## What is nGPT?
|
4
4
|
|
5
|
-
🤖 nGPT is a Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible library all in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
5
|
+
🤖 nGPT is a Swiss army knife for LLMs: powerful CLI, interactive chatbot, and flexible library all in one package. Seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands. Fast, lightweight, and designed for both casual users and developers.
|
6
6
|
|
7
7
|
## Key Features
|
8
8
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Usage Guide
|
2
2
|
|
3
|
-
This section contains comprehensive documentation on how to use nGPT, a Swiss army knife for LLMs that combines a powerful CLI, interactive chatbot, and flexible library in one package. Learn how to seamlessly work with OpenAI, Ollama, Groq, Claude, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands.
|
3
|
+
This section contains comprehensive documentation on how to use nGPT, a Swiss army knife for LLMs that combines a powerful CLI, interactive chatbot, and flexible library in one package. Learn how to seamlessly work with OpenAI, Ollama, Groq, Claude, Gemini, or any OpenAI-compatible API to generate code, craft git commits, rewrite text, and execute shell commands.
|
4
4
|
|
5
5
|
## Table of Contents
|
6
6
|
|
@@ -76,7 +76,7 @@ ngpt --code "function to calculate prime numbers"
|
|
76
76
|
ngpt --gitcommsg
|
77
77
|
|
78
78
|
# Generate commit message with context directive
|
79
|
-
ngpt --
|
79
|
+
ngpt -g --preprompt "type:feat focus on UI"
|
80
80
|
```
|
81
81
|
|
82
82
|
### Library Quick Start
|
@@ -84,7 +84,7 @@ ngpt --gitcommsg -m "type:feat focus on UI"
|
|
84
84
|
```python
|
85
85
|
from ngpt import NGPTClient, load_config
|
86
86
|
|
87
|
-
# Load configuration
|
87
|
+
# Load configuration--gitcommsg
|
88
88
|
config = load_config()
|
89
89
|
|
90
90
|
# Initialize client
|
@@ -73,8 +73,8 @@ Some options only apply in specific modes:
|
|
73
73
|
- `log` - Filepath to log conversation (for interactive and text modes)
|
74
74
|
|
75
75
|
#### Git Commit Message Mode Options
|
76
|
-
- `
|
77
|
-
- `
|
76
|
+
- `preprompt` - Context to guide AI generation (e.g., file types, commit type directive)
|
77
|
+
- `rec-chunk` - Process large diffs in chunks with recursive analysis if needed (default: false)
|
78
78
|
- `diff` - Path to diff file to use instead of staged git changes
|
79
79
|
- `chunk-size` - Number of lines per chunk when chunking is enabled (default: 200)
|
80
80
|
- `analyses-chunk-size` - Number of lines per chunk when recursively chunking analyses (default: 200)
|
@@ -85,26 +85,26 @@ Some options only apply in specific modes:
|
|
85
85
|
|
86
86
|
These options control the behavior of the `--gitcommsg` mode, which helps generate conventional commit messages from git diffs.
|
87
87
|
|
88
|
-
####
|
88
|
+
#### preprompt
|
89
89
|
This option provides contextual information to guide the AI when generating commit messages. It accepts various directives:
|
90
90
|
|
91
91
|
```bash
|
92
|
-
# Set a default
|
93
|
-
ngpt --cli-config set
|
92
|
+
# Set a default preprompt for commit message generation
|
93
|
+
ngpt --cli-config set preprompt "type:feat focus on UI"
|
94
94
|
```
|
95
95
|
|
96
|
-
The
|
96
|
+
The preprompt can include:
|
97
97
|
- **Commit type directives**: `type:feat`, `type:fix`, `type:docs`, etc.
|
98
98
|
- **File type filtering**: `javascript`, `python`, `css`, etc.
|
99
99
|
- **Focus directives**: `focus on auth`, `focus on UI`, etc.
|
100
100
|
- **Exclusion directives**: `ignore formatting`, `exclude tests`, etc.
|
101
101
|
|
102
|
-
####
|
102
|
+
#### rec-chunk
|
103
103
|
When set to `true`, this enables recursive chunking for processing large diffs, which is helpful for large commits:
|
104
104
|
|
105
105
|
```bash
|
106
106
|
# Enable recursive chunking by default
|
107
|
-
ngpt --cli-config set
|
107
|
+
ngpt --cli-config set rec-chunk true
|
108
108
|
```
|
109
109
|
|
110
110
|
With recursive chunking enabled, the system will:
|
@@ -227,7 +227,7 @@ ngpt --cli-config set prettify true
|
|
227
227
|
ngpt --cli-config set provider Gemini
|
228
228
|
|
229
229
|
# Enable recursive chunking for git commit messages by default
|
230
|
-
ngpt --cli-config set
|
230
|
+
ngpt --cli-config set rec-chunk true
|
231
231
|
|
232
232
|
# Set a default diff file path for git commit messages
|
233
233
|
ngpt --cli-config set diff /path/to/changes.diff
|
@@ -305,10 +305,10 @@ gitcommsg_mode(client, args)
|
|
305
305
|
from argparse import Namespace
|
306
306
|
args = Namespace(
|
307
307
|
diff=None, # Use staged changes
|
308
|
-
|
308
|
+
preprompt="focus on UI components, type:feat",
|
309
309
|
log=None,
|
310
310
|
chunk_size=200,
|
311
|
-
|
311
|
+
rec_chunk=True,
|
312
312
|
max_msg_lines=20
|
313
313
|
)
|
314
314
|
gitcommsg_mode(client, args)
|
@@ -714,10 +714,10 @@ client = NGPTClient(**load_config())
|
|
714
714
|
# Create args with desired options
|
715
715
|
args = Namespace(
|
716
716
|
diff=None, # Use staged git changes
|
717
|
-
|
717
|
+
preprompt="focus on authentication",
|
718
718
|
log="commit_generation.log", # Optional logging
|
719
719
|
chunk_size=200, # Lines per chunk for large diffs
|
720
|
-
|
720
|
+
rec_chunk=True, # Enable recursive chunking
|
721
721
|
max_msg_lines=20 # Maximum lines in final message
|
722
722
|
)
|
723
723
|
|
@@ -729,29 +729,29 @@ gitcommsg_mode(client, args)
|
|
729
729
|
|
730
730
|
- **Staged Changes Analysis**: Analyzes git staged changes by default
|
731
731
|
- **External Diff Files**: Can process diff files with `args.diff="path/to/diff.txt"`
|
732
|
-
- **Context Directives**: Supports focusing on specific changes with `
|
732
|
+
- **Context Directives**: Supports focusing on specific changes with `--preprompt`
|
733
733
|
- **Diff Chunking**: Handles large diffs by processing in chunks
|
734
734
|
- **Clipboard Integration**: Automatically copies result to clipboard when available
|
735
735
|
|
736
736
|
### Context Directives
|
737
737
|
|
738
|
-
The
|
738
|
+
The `--preprompt` option supports several helpful directives:
|
739
739
|
|
740
740
|
```python
|
741
741
|
# Focus on specific file types
|
742
|
-
args.
|
742
|
+
args.preprompt = "javascript" # Focus on JS files
|
743
743
|
|
744
744
|
# Specify commit type
|
745
|
-
args.
|
745
|
+
args.preprompt = "type:feat" # Force "feat:" prefix
|
746
746
|
|
747
747
|
# Focus on specific components
|
748
|
-
args.
|
748
|
+
args.preprompt = "focus on authentication"
|
749
749
|
|
750
750
|
# Exclude certain changes
|
751
|
-
args.
|
751
|
+
args.preprompt = "exclude tests"
|
752
752
|
|
753
753
|
# Combine directives
|
754
|
-
args.
|
754
|
+
args.preprompt = "type:fix focus on API exclude logging"
|
755
755
|
```
|
756
756
|
|
757
757
|
### Processing Large Diffs
|
@@ -762,7 +762,7 @@ For large repositories with extensive changes:
|
|
762
762
|
args = Namespace(
|
763
763
|
diff=None,
|
764
764
|
chunk_size=200, # Process 200 lines at a time
|
765
|
-
|
765
|
+
rec_chunk=True, # Enable recursive processing
|
766
766
|
max_msg_lines=20, # Condense final message if needed
|
767
767
|
analyses_chunk_size=300 # Size for recursive analysis chunks
|
768
768
|
)
|