ngpt 2.14.0__tar.gz → 2.15.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.
Files changed (58) hide show
  1. {ngpt-2.14.0 → ngpt-2.15.0}/.gitignore +2 -0
  2. {ngpt-2.14.0 → ngpt-2.15.0}/CONTRIBUTING.md +2 -0
  3. {ngpt-2.14.0 → ngpt-2.15.0}/PKG-INFO +22 -2
  4. {ngpt-2.14.0 → ngpt-2.15.0}/README.md +21 -1
  5. {ngpt-2.14.0 → ngpt-2.15.0}/docs/CONTRIBUTING.md +2 -0
  6. {ngpt-2.14.0 → ngpt-2.15.0}/docs/README.md +3 -0
  7. {ngpt-2.14.0 → ngpt-2.15.0}/docs/api/README.md +35 -6
  8. {ngpt-2.14.0 → ngpt-2.15.0}/docs/api/cli.md +75 -0
  9. {ngpt-2.14.0 → ngpt-2.15.0}/docs/api/cli_config.md +129 -20
  10. {ngpt-2.14.0 → ngpt-2.15.0}/docs/api/config.md +74 -10
  11. ngpt-2.15.0/docs/api/logging.md +138 -0
  12. {ngpt-2.14.0 → ngpt-2.15.0}/docs/configuration.md +94 -20
  13. {ngpt-2.14.0 → ngpt-2.15.0}/docs/examples/README.md +19 -5
  14. {ngpt-2.14.0 → ngpt-2.15.0}/docs/examples/advanced.md +288 -23
  15. {ngpt-2.14.0 → ngpt-2.15.0}/docs/examples/basic.md +190 -26
  16. {ngpt-2.14.0 → ngpt-2.15.0}/docs/examples/cli_components.md +136 -0
  17. {ngpt-2.14.0 → ngpt-2.15.0}/docs/installation.md +8 -7
  18. {ngpt-2.14.0 → ngpt-2.15.0}/docs/overview.md +24 -27
  19. {ngpt-2.14.0 → ngpt-2.15.0}/docs/usage/README.md +14 -0
  20. {ngpt-2.14.0 → ngpt-2.15.0}/docs/usage/cli_config.md +105 -3
  21. {ngpt-2.14.0 → ngpt-2.15.0}/docs/usage/cli_framework.md +124 -10
  22. {ngpt-2.14.0 → ngpt-2.15.0}/docs/usage/cli_usage.md +156 -89
  23. ngpt-2.15.0/docs/usage/gitcommsg.md +390 -0
  24. {ngpt-2.14.0 → ngpt-2.15.0}/docs/usage/library_usage.md +236 -73
  25. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/args.py +8 -4
  26. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/main.py +7 -3
  27. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/modes/gitcommsg.py +468 -123
  28. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/utils/cli_config.py +3 -1
  29. {ngpt-2.14.0 → ngpt-2.15.0}/pyproject.toml +1 -1
  30. {ngpt-2.14.0 → ngpt-2.15.0}/uv.lock +1 -1
  31. ngpt-2.14.0/docs/usage/gitcommsg.md +0 -147
  32. {ngpt-2.14.0 → ngpt-2.15.0}/.github/workflows/python-publish.yml +0 -0
  33. {ngpt-2.14.0 → ngpt-2.15.0}/.python-version +0 -0
  34. {ngpt-2.14.0 → ngpt-2.15.0}/COMMIT_GUIDELINES.md +0 -0
  35. {ngpt-2.14.0 → ngpt-2.15.0}/LICENSE +0 -0
  36. {ngpt-2.14.0 → ngpt-2.15.0}/docs/LICENSE.md +0 -0
  37. {ngpt-2.14.0 → ngpt-2.15.0}/docs/_config.yml +0 -0
  38. {ngpt-2.14.0 → ngpt-2.15.0}/docs/api/client.md +0 -0
  39. {ngpt-2.14.0 → ngpt-2.15.0}/docs/assets/css/style.scss +0 -0
  40. {ngpt-2.14.0 → ngpt-2.15.0}/docs/examples/integrations.md +0 -0
  41. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/__init__.py +0 -0
  42. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/__main__.py +0 -0
  43. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/__init__.py +0 -0
  44. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/config_manager.py +0 -0
  45. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/formatters.py +0 -0
  46. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/interactive.py +0 -0
  47. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/modes/__init__.py +0 -0
  48. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/modes/chat.py +0 -0
  49. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/modes/code.py +0 -0
  50. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/modes/rewrite.py +0 -0
  51. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/modes/shell.py +0 -0
  52. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/modes/text.py +0 -0
  53. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/renderers.py +0 -0
  54. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/cli/ui.py +0 -0
  55. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/client.py +0 -0
  56. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/utils/__init__.py +0 -0
  57. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/utils/config.py +0 -0
  58. {ngpt-2.14.0 → ngpt-2.15.0}/ngpt/utils/log.py +0 -0
@@ -11,3 +11,5 @@ wheels/
11
11
 
12
12
  # Environment variables
13
13
  .env
14
+ # Reference files
15
+ ref-*
@@ -30,8 +30,10 @@ Thank you for your interest in contributing to NGPT! This document provides guid
30
30
  - `formatters.py` - Output formatting logic
31
31
  - `interactive.py` - Interactive mode implementation
32
32
  - `modes/` - Different operational modes
33
+ - `__init__.py` - Modes initialization
33
34
  - `chat.py` - Chat mode functionality
34
35
  - `code.py` - Code generation mode
36
+ - `gitcommsg.py` - Git commit message generation
35
37
  - `shell.py` - Shell command generation
36
38
  - `text.py` - Text generation mode
37
39
  - `rewrite.py` - Text rewriting mode
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 2.14.0
3
+ Version: 2.15.0
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
@@ -154,6 +154,13 @@ ngpt --log "Tell me about quantum computing"
154
154
 
155
155
  # Process text from stdin using the {} placeholder
156
156
  cat README.md | ngpt --stdin "Summarize this document: {}"
157
+
158
+ # Use different model providers by specifying the provider name
159
+ ngpt --provider Groq "Explain quantum computing"
160
+
161
+ # Compare outputs from different providers
162
+ ngpt --provider OpenAI "Explain quantum physics" > openai_response.txt
163
+ ngpt --provider Ollama "Explain quantum physics" > ollama_response.txt
157
164
  ```
158
165
 
159
166
  For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage.html).
@@ -162,7 +169,7 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
162
169
 
163
170
  - ✅ **Versatile**: Use as a CLI tool, Python library, or CLI framework for building custom tools
164
171
  - 🪶 **Lightweight**: Minimal dependencies with everything you need included
165
- - 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, and any compatible endpoint
172
+ - 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, Claude, and any compatible endpoint
166
173
  - 💬 **Interactive Chat**: Continuous conversation with memory in modern UI
167
174
  - 📊 **Streaming Responses**: Real-time output for better user experience
168
175
  - 🔍 **Web Search**: Integrated with compatible API endpoints
@@ -179,6 +186,8 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
179
186
  - 📃 **Conversation Logging**: Save your conversations to text files for later reference
180
187
  - 🧰 **CLI Components**: Reusable components for building custom AI-powered command-line tools
181
188
  - 🔌 **Modular Architecture**: Well-structured codebase with clean separation of concerns
189
+ - 🔄 **Provider Switching**: Easily switch between different LLM providers with a single parameter
190
+ - 🚀 **Performance Optimized**: Fast response times and minimal resource usage
182
191
 
183
192
  See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview.html) for more details.
184
193
 
@@ -327,6 +336,16 @@ print(result.stdout)
327
336
  # Returns only code without markdown or explanations
328
337
  code = client.generate_code("function that converts Celsius to Fahrenheit")
329
338
  print(code)
339
+
340
+ # Compare responses from different providers
341
+ openai_config = load_config(config_index=0) # OpenAI
342
+ groq_config = load_config(config_index=1) # Groq
343
+
344
+ openai_client = NGPTClient(**openai_config)
345
+ groq_client = NGPTClient(**groq_config)
346
+
347
+ openai_response = openai_client.chat("Explain quantum computing")
348
+ groq_response = groq_client.chat("Explain quantum computing")
330
349
  ```
331
350
 
332
351
  For advanced usage patterns and integrations, check out the [Advanced Examples](https://nazdridoy.github.io/ngpt/examples/advanced.html).
@@ -392,6 +411,7 @@ You can configure nGPT using the following options:
392
411
  | `-t, --text` | Open interactive multiline editor for complex prompts with syntax highlighting |
393
412
  | `--stdin` | Read from stdin and use content with prompt. Use {} in prompt as placeholder for stdin content |
394
413
  | `--rewrite` | Rewrite text to improve quality while preserving original tone and meaning |
414
+ | `--gitcommsg` | Generate AI-powered git commit messages from staged changes or diff files |
395
415
 
396
416
  #### Global Options
397
417
 
@@ -118,6 +118,13 @@ ngpt --log "Tell me about quantum computing"
118
118
 
119
119
  # Process text from stdin using the {} placeholder
120
120
  cat README.md | ngpt --stdin "Summarize this document: {}"
121
+
122
+ # Use different model providers by specifying the provider name
123
+ ngpt --provider Groq "Explain quantum computing"
124
+
125
+ # Compare outputs from different providers
126
+ ngpt --provider OpenAI "Explain quantum physics" > openai_response.txt
127
+ ngpt --provider Ollama "Explain quantum physics" > ollama_response.txt
121
128
  ```
122
129
 
123
130
  For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdridoy.github.io/ngpt/usage/cli_usage.html).
@@ -126,7 +133,7 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
126
133
 
127
134
  - ✅ **Versatile**: Use as a CLI tool, Python library, or CLI framework for building custom tools
128
135
  - 🪶 **Lightweight**: Minimal dependencies with everything you need included
129
- - 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, and any compatible endpoint
136
+ - 🔄 **API Flexibility**: Works with OpenAI, Ollama, Groq, Claude, and any compatible endpoint
130
137
  - 💬 **Interactive Chat**: Continuous conversation with memory in modern UI
131
138
  - 📊 **Streaming Responses**: Real-time output for better user experience
132
139
  - 🔍 **Web Search**: Integrated with compatible API endpoints
@@ -143,6 +150,8 @@ For more examples and detailed usage, visit the [CLI Usage Guide](https://nazdri
143
150
  - 📃 **Conversation Logging**: Save your conversations to text files for later reference
144
151
  - 🧰 **CLI Components**: Reusable components for building custom AI-powered command-line tools
145
152
  - 🔌 **Modular Architecture**: Well-structured codebase with clean separation of concerns
153
+ - 🔄 **Provider Switching**: Easily switch between different LLM providers with a single parameter
154
+ - 🚀 **Performance Optimized**: Fast response times and minimal resource usage
146
155
 
147
156
  See the [Feature Overview](https://nazdridoy.github.io/ngpt/overview.html) for more details.
148
157
 
@@ -291,6 +300,16 @@ print(result.stdout)
291
300
  # Returns only code without markdown or explanations
292
301
  code = client.generate_code("function that converts Celsius to Fahrenheit")
293
302
  print(code)
303
+
304
+ # Compare responses from different providers
305
+ openai_config = load_config(config_index=0) # OpenAI
306
+ groq_config = load_config(config_index=1) # Groq
307
+
308
+ openai_client = NGPTClient(**openai_config)
309
+ groq_client = NGPTClient(**groq_config)
310
+
311
+ openai_response = openai_client.chat("Explain quantum computing")
312
+ groq_response = groq_client.chat("Explain quantum computing")
294
313
  ```
295
314
 
296
315
  For advanced usage patterns and integrations, check out the [Advanced Examples](https://nazdridoy.github.io/ngpt/examples/advanced.html).
@@ -356,6 +375,7 @@ You can configure nGPT using the following options:
356
375
  | `-t, --text` | Open interactive multiline editor for complex prompts with syntax highlighting |
357
376
  | `--stdin` | Read from stdin and use content with prompt. Use {} in prompt as placeholder for stdin content |
358
377
  | `--rewrite` | Rewrite text to improve quality while preserving original tone and meaning |
378
+ | `--gitcommsg` | Generate AI-powered git commit messages from staged changes or diff files |
359
379
 
360
380
  #### Global Options
361
381
 
@@ -35,8 +35,10 @@ Thank you for your interest in contributing to NGPT! This document provides guid
35
35
  - `formatters.py` - Output formatting logic
36
36
  - `interactive.py` - Interactive mode implementation
37
37
  - `modes/` - Different operational modes
38
+ - `__init__.py` - Modes initialization
38
39
  - `chat.py` - Chat mode functionality
39
40
  - `code.py` - Code generation mode
41
+ - `gitcommsg.py` - Git commit message generation
40
42
  - `shell.py` - Shell command generation
41
43
  - `text.py` - Text generation mode
42
44
  - `rewrite.py` - Text rewriting mode
@@ -14,10 +14,13 @@ Welcome to the documentation for nGPT, a lightweight Python CLI and library for
14
14
  - [CLI Usage](usage/cli_usage.md)
15
15
  - [Library Usage](usage/library_usage.md)
16
16
  - [CLI Framework](usage/cli_framework.md)
17
+ - [CLI Configuration](usage/cli_config.md)
18
+ - [Git Commit Messages](usage/gitcommsg.md)
17
19
  - [API Reference](api/README.md)
18
20
  - [NGPTClient](api/client.md)
19
21
  - [Configuration](api/config.md)
20
22
  - [CLI Components](api/cli.md)
23
+ - [CLI Configuration](api/cli_config.md)
21
24
  - [Examples](examples/README.md)
22
25
  - [Basic Examples](examples/basic.md)
23
26
  - [Advanced Examples](examples/advanced.md)
@@ -10,6 +10,7 @@ nGPT's API consists of several main components:
10
10
  2. **Configuration Utilities**: Functions for managing configuration files and settings
11
11
  3. **CLI Components**: Modular CLI utilities that can be reused in custom applications
12
12
  4. **CLI Configuration Utilities**: Functions for managing CLI-specific configurations
13
+ 5. **Logging Utilities**: Tools for logging conversations and errors
13
14
 
14
15
  ## Table of Contents
15
16
 
@@ -26,14 +27,22 @@ nGPT's API consists of several main components:
26
27
  - [Editing Configurations](config.md#editing-configurations)
27
28
  - [Removing Configurations](config.md#removing-configurations)
28
29
  - [Configuration Paths](config.md#configuration-paths)
30
+ - [Default Configuration](config.md#default-configuration)
29
31
 
30
32
  - [CLI Components](cli.md) - CLI functionality
31
33
  - [Module Structure](cli.md#module-structure)
32
34
  - [Interactive Chat Module](cli.md#interactive-chat-module)
33
35
  - [Formatters Module](cli.md#formatters-module)
34
36
  - [Renderers Module](cli.md#renderers-module)
37
+ - [UI Components](cli.md#ui-components)
35
38
  - [CLI Configuration Utilities](cli.md#cli-configuration-utilities)
36
39
  - [Operation Modes](cli.md#operation-modes)
40
+ - [Chat Mode](cli.md#chat-mode)
41
+ - [Code Mode](cli.md#code-mode)
42
+ - [Shell Mode](cli.md#shell-mode)
43
+ - [Text Mode](cli.md#text-mode)
44
+ - [Rewrite Mode](cli.md#rewrite-mode)
45
+ - [Git Commit Message Mode](cli.md#git-commit-message-mode)
37
46
 
38
47
  - [CLI Configuration](cli_config.md) - Persistent CLI settings
39
48
  - [Loading Configuration](cli_config.md#load_cli_config)
@@ -42,12 +51,20 @@ nGPT's API consists of several main components:
42
51
  - [Removing Options](cli_config.md#unset_cli_config_option)
43
52
  - [Applying Configuration](cli_config.md#apply_cli_config)
44
53
  - [Available Options](cli_config.md#available-cli-configuration-options)
54
+ - [Listing Options](cli_config.md#list_cli_config_options)
55
+ - [Configuration Paths](cli_config.md#configuration-paths)
56
+
57
+ - [Logging](logging.md) - Logging utilities
58
+ - [Creating Loggers](logging.md#create_logger)
59
+ - [Logger Class](logging.md#logger-class)
60
+ - [Log Levels](logging.md#log-levels)
61
+ - [Log Formatting](logging.md#log-formatting)
45
62
 
46
63
  ## Quick Reference
47
64
 
48
65
  ```python
49
66
  # Import core components
50
- from ngpt import NGPTClient, load_config
67
+ from ngpt import NGPTClient, load_config, __version__
51
68
 
52
69
  # Import configuration utilities
53
70
  from ngpt.utils.config import (
@@ -55,7 +72,9 @@ from ngpt.utils.config import (
55
72
  get_config_path,
56
73
  get_config_dir,
57
74
  add_config_entry,
58
- remove_config_entry
75
+ remove_config_entry,
76
+ DEFAULT_CONFIG,
77
+ DEFAULT_CONFIG_ENTRY
59
78
  )
60
79
 
61
80
  # Import CLI configuration utilities
@@ -64,22 +83,32 @@ from ngpt.utils.cli_config import (
64
83
  set_cli_config_option,
65
84
  get_cli_config_option,
66
85
  unset_cli_config_option,
67
- apply_cli_config
86
+ apply_cli_config,
87
+ list_cli_config_options,
88
+ CLI_CONFIG_OPTIONS,
89
+ get_cli_config_dir,
90
+ get_cli_config_path
68
91
  )
69
92
 
93
+ # Import logging utilities
94
+ from ngpt.utils.log import create_logger, Logger
95
+
70
96
  # Import CLI module components
71
97
  from ngpt.cli.interactive import interactive_chat_session
72
98
  from ngpt.cli.formatters import prettify_markdown, ColoredHelpFormatter, COLORS
73
99
  from ngpt.cli.renderers import prettify_streaming_markdown, has_markdown_renderer
100
+ from ngpt.cli.ui import create_progress_bar, create_spinner
74
101
 
75
102
  # Import operation modes
76
103
  from ngpt.cli.modes.chat import chat_mode
77
104
  from ngpt.cli.modes.code import code_mode
78
105
  from ngpt.cli.modes.shell import shell_mode
79
106
  from ngpt.cli.modes.text import text_mode
107
+ from ngpt.cli.modes.rewrite import rewrite_mode
108
+ from ngpt.cli.modes.gitcommsg import git_commit_message_mode
80
109
 
81
- # Import version information
82
- from ngpt import __version__
110
+ # Import main CLI entry point
111
+ from ngpt.cli import main
83
112
  ```
84
113
 
85
- For complete documentation on using these components, see the linked reference pages.
114
+ For complete documentation on using these components, see the linked reference pages. For examples of integrating nGPT into your applications, see the [Examples](../examples/) section.
@@ -22,6 +22,7 @@ The CLI components for nGPT are organized into a modular structure under the `ng
22
22
  - `ngpt.cli.modes.shell`: Shell command generation mode functionality
23
23
  - `ngpt.cli.modes.text`: Text generation mode functionality
24
24
  - `ngpt.cli.modes.rewrite`: Text rewriting mode functionality
25
+ - `ngpt.cli.modes.gitcommsg`: Git commit message generation functionality
25
26
 
26
27
  ## Interactive Chat Module
27
28
 
@@ -675,6 +676,80 @@ else:
675
676
  print("This example would open a multiline editor in a real terminal")
676
677
  ```
677
678
 
679
+ ### Git Commit Message Mode
680
+
681
+ ```python
682
+ from ngpt.cli.modes.gitcommsg import gitcommsg_mode
683
+
684
+ def gitcommsg_mode(client, args, logger=None)
685
+ ```
686
+
687
+ Executes a git commit message generation operation to create commit messages based on staged changes in a git repository.
688
+
689
+ **Parameters:**
690
+ - `client` (NGPTClient): The initialized client for the operation
691
+ - `args` (namespace): Parsed command-line arguments including:
692
+ - `diff_file` (str, optional): Path to diff file to use instead of git diff --staged
693
+ - `message_context` (str, optional): Additional context or instructions for commit message generation
694
+ - `temperature` (float): Temperature setting (0.0-1.0)
695
+ - `max_tokens` (int, optional): Maximum tokens to generate
696
+ - `chunk_size` (int): Number of lines per chunk for large diffs
697
+ - `max_lines` (int): Maximum lines in the generated commit message
698
+ - `recursive` (bool): Whether to use recursive chunking for large diffs
699
+ - `deep_recursive` (bool): Whether to use deeper recursive analysis
700
+ - `web_search` (bool): Whether to enable web search
701
+ - `logger` (object, optional): Logger instance
702
+
703
+ **Features:**
704
+ - **Git Diff Analysis**: Analyzes staged git changes to create relevant commit messages
705
+ - **Conventional Commit Format**: Follows standard commit message format (type(scope): message)
706
+ - **Chunking Strategy**: Handles large diffs by splitting into manageable chunks
707
+ - **Recursive Analysis**: Optional deep analysis of complex changes
708
+ - **Context Directives**: Supports filtering and focusing on specific file types/components
709
+ - **Technical Detail Extraction**: Extracts function names, line numbers, and specific changes
710
+
711
+ **Example:**
712
+ ```python
713
+ from ngpt import NGPTClient, load_config
714
+ from ngpt.cli.modes.gitcommsg import gitcommsg_mode
715
+ import argparse
716
+
717
+ client = NGPTClient(**load_config())
718
+
719
+ # Create args namespace with required parameters
720
+ args = argparse.Namespace()
721
+ args.diff_file = None # Use git staged changes
722
+ args.message_context = "type:feat focus on authentication"
723
+ args.temperature = 0.4
724
+ args.max_tokens = None
725
+ args.chunk_size = 200
726
+ args.max_lines = 20
727
+ args.recursive = True
728
+ args.deep_recursive = False
729
+ args.web_search = False
730
+
731
+ gitcommsg_mode(
732
+ client=client,
733
+ args=args
734
+ )
735
+ ```
736
+
737
+ **Context Directive Examples:**
738
+ - `type:feat` - Set commit type to feature
739
+ - `focus on authentication` - Focus only on authentication-related changes
740
+ - `ignore tests` - Exclude test changes from the commit message
741
+ - `javascript` - Focus only on JavaScript file changes
742
+
743
+ **Output Example:**
744
+ ```
745
+ feat(auth): implement JWT authentication and user session management
746
+
747
+ - Add generateToken function in auth/jwt.js
748
+ - Create validateJWTMiddleware in middleware/auth.js
749
+ - Add token refresh endpoint in routes/auth.js
750
+ - Update user model to store refresh tokens
751
+ ```
752
+
678
753
  ## Reference Tables
679
754
 
680
755
  ### Markdown Renderers
@@ -13,7 +13,7 @@ nGPT provides a set of utilities for managing CLI-specific configuration setting
13
13
  ```python
14
14
  from ngpt.utils.cli_config import load_cli_config
15
15
 
16
- def load_cli_config():
16
+ def load_cli_config() -> Dict[str, Any]:
17
17
  ```
18
18
 
19
19
  Loads the CLI configuration from the configuration file.
@@ -35,14 +35,14 @@ print(f"Current CLI configuration: {cli_config}")
35
35
  ```python
36
36
  from ngpt.utils.cli_config import set_cli_config_option
37
37
 
38
- def set_cli_config_option(option, value):
38
+ def set_cli_config_option(option: str, value: Any) -> Tuple[bool, str]:
39
39
  ```
40
40
 
41
41
  Sets a CLI configuration option.
42
42
 
43
43
  **Parameters:**
44
44
  - `option` (str): The name of the option to set
45
- - `value` (str): The value to set for the option
45
+ - `value` (Any): The value to set for the option
46
46
 
47
47
  **Returns:**
48
48
  - tuple: (success, message) where success is a boolean indicating whether the operation was successful and message is a string explaining the result
@@ -65,7 +65,7 @@ print(message)
65
65
  ```python
66
66
  from ngpt.utils.cli_config import get_cli_config_option
67
67
 
68
- def get_cli_config_option(option=None):
68
+ def get_cli_config_option(option: str = None) -> Tuple[bool, Union[str, Dict[str, Any]]]:
69
69
  ```
70
70
 
71
71
  Gets the value of a CLI configuration option, or all options if none is specified.
@@ -99,7 +99,7 @@ if success:
99
99
  ```python
100
100
  from ngpt.utils.cli_config import unset_cli_config_option
101
101
 
102
- def unset_cli_config_option(option):
102
+ def unset_cli_config_option(option: str) -> Tuple[bool, str]:
103
103
  ```
104
104
 
105
105
  Removes a CLI configuration option.
@@ -124,18 +124,17 @@ print(message)
124
124
  ```python
125
125
  from ngpt.utils.cli_config import apply_cli_config
126
126
 
127
- def apply_cli_config(args, options=None, context="all"):
127
+ def apply_cli_config(args: Any, mode: str) -> Any:
128
128
  ```
129
129
 
130
- Applies CLI configuration options to the provided argument namespace.
130
+ Applies CLI configuration options to the provided argument namespace based on the current mode, respecting context and not overriding explicit args.
131
131
 
132
132
  **Parameters:**
133
- - `args` (namespace): The argument namespace (from argparse)
134
- - `options` (list, optional): List of option names to apply (applies all if None)
135
- - `context` (str): The context for applying the configuration (e.g., "all", "chat", "code", "shell", "text")
133
+ - `args` (Any): The argument namespace (from argparse)
134
+ - `mode` (str): The current mode ('interactive', 'shell', 'code', 'text', 'gitcommsg', or 'all' for default)
136
135
 
137
136
  **Returns:**
138
- - None: Modifies the args namespace in-place
137
+ - Any: The updated argument namespace
139
138
 
140
139
  **Example:**
141
140
  ```python
@@ -150,13 +149,115 @@ parser.add_argument("--markdown-format", action="store_true")
150
149
  args = parser.parse_args()
151
150
 
152
151
  # Apply CLI configuration for code generation context
153
- apply_cli_config(args, context="code")
152
+ apply_cli_config(args, mode="code")
154
153
 
155
154
  # Use the updated arguments
156
155
  print(f"Temperature: {args.temperature}")
157
156
  print(f"Language: {args.language}")
158
157
  ```
159
158
 
159
+ ### `list_cli_config_options`
160
+
161
+ ```python
162
+ from ngpt.utils.cli_config import list_cli_config_options
163
+
164
+ def list_cli_config_options() -> List[str]:
165
+ ```
166
+
167
+ Lists all available CLI configuration options.
168
+
169
+ **Returns:**
170
+ - list: A sorted list of option names
171
+
172
+ **Example:**
173
+ ```python
174
+ from ngpt.utils.cli_config import list_cli_config_options
175
+
176
+ # Get all available options
177
+ options = list_cli_config_options()
178
+ print("Available configuration options:")
179
+ for option in options:
180
+ print(f"- {option}")
181
+ ```
182
+
183
+ ### `get_cli_config_dir`
184
+
185
+ ```python
186
+ from ngpt.utils.cli_config import get_cli_config_dir
187
+
188
+ def get_cli_config_dir() -> Path:
189
+ ```
190
+
191
+ Gets the directory where the CLI configuration is stored.
192
+
193
+ **Returns:**
194
+ - Path: The path to the CLI configuration directory
195
+
196
+ **Example:**
197
+ ```python
198
+ from ngpt.utils.cli_config import get_cli_config_dir
199
+
200
+ # Get the CLI config directory
201
+ config_dir = get_cli_config_dir()
202
+ print(f"CLI configuration directory: {config_dir}")
203
+ ```
204
+
205
+ ### `get_cli_config_path`
206
+
207
+ ```python
208
+ from ngpt.utils.cli_config import get_cli_config_path
209
+
210
+ def get_cli_config_path() -> Path:
211
+ ```
212
+
213
+ Gets the path to the CLI configuration file.
214
+
215
+ **Returns:**
216
+ - Path: The path to the CLI configuration file
217
+
218
+ **Example:**
219
+ ```python
220
+ from ngpt.utils.cli_config import get_cli_config_path
221
+
222
+ # Get the CLI config file path
223
+ config_path = get_cli_config_path()
224
+ print(f"CLI configuration file: {config_path}")
225
+ ```
226
+
227
+ ### `save_cli_config`
228
+
229
+ ```python
230
+ from ngpt.utils.cli_config import save_cli_config
231
+
232
+ def save_cli_config(config: Dict[str, Any]) -> bool:
233
+ ```
234
+
235
+ Saves CLI configuration to the config file.
236
+
237
+ **Parameters:**
238
+ - `config` (Dict[str, Any]): The configuration dictionary to save
239
+
240
+ **Returns:**
241
+ - bool: True if the operation was successful, False otherwise
242
+
243
+ **Example:**
244
+ ```python
245
+ from ngpt.utils.cli_config import load_cli_config, save_cli_config
246
+
247
+ # Load existing config
248
+ config = load_cli_config()
249
+
250
+ # Modify config
251
+ config['temperature'] = 0.9
252
+
253
+ # Save the updated config
254
+ success = save_cli_config(config)
255
+ if success:
256
+ print("Configuration saved successfully")
257
+ else:
258
+ print("Failed to save configuration")
259
+ ```
260
+
160
261
  ## Available CLI Configuration Options
161
262
 
162
263
  The following options are available for configuration:
@@ -164,18 +265,25 @@ The following options are available for configuration:
164
265
  | Option | Type | Context | Description |
165
266
  |--------|------|---------|-------------|
166
267
  | `temperature` | float | all | Controls randomness in the response (0.0-1.0) |
167
- | `top-p` | float | all | Controls diversity via nucleus sampling (0.0-1.0) |
268
+ | `top_p` | float | all | Controls diversity via nucleus sampling (0.0-1.0) |
168
269
  | `no-stream` | bool | all | Disables streaming responses |
169
- | `max-tokens` | int | all | Maximum number of tokens to generate |
170
- | `web-search` | bool | all | Enables web search capability |
171
270
  | `prettify` | bool | all | Enables markdown prettification |
271
+ | `stream-prettify` | bool | all | Enables streaming prettification |
272
+ | `max_tokens` | int | all | Maximum number of tokens to generate |
273
+ | `web-search` | bool | all | Enables web search capability |
172
274
  | `renderer` | string | all | Markdown renderer to use ('auto', 'rich', 'glow') |
173
275
  | `language` | string | code | Programming language for code generation |
174
- | `execute` | bool | shell | Whether to execute generated shell commands |
175
- | `markdown-format` | bool | all | Format responses with markdown |
176
276
  | `provider` | string | all | Default provider to use |
177
277
  | `config-index` | int | all | Default configuration index to use |
178
- | `model` | string | all | Default model to use |
278
+ | `log` | string | all | Path to log file |
279
+ | `preprompt` | string | all | Custom preprompt to use |
280
+ | `message-context` | string | gitcommsg | Context for git commit message generation |
281
+ | `recursive-chunk` | bool | gitcommsg | Enable recursive chunking for large diffs |
282
+ | `diff` | string | gitcommsg | Path to diff file for git commit message generation |
283
+ | `chunk-size` | int | gitcommsg | Maximum number of lines per chunk |
284
+ | `analyses-chunk-size` | int | gitcommsg | Maximum number of lines per chunk for analyses |
285
+ | `max-msg-lines` | int | gitcommsg | Maximum number of lines in commit message |
286
+ | `max-recursion-depth` | int | gitcommsg | Maximum recursion depth for message condensing |
179
287
 
180
288
  ## Configuration File Location
181
289
 
@@ -194,7 +302,8 @@ from ngpt.utils.cli_config import (
194
302
  load_cli_config,
195
303
  set_cli_config_option,
196
304
  get_cli_config_option,
197
- apply_cli_config
305
+ apply_cli_config,
306
+ unset_cli_config_option
198
307
  )
199
308
  from ngpt.cli.formatters import ColoredHelpFormatter, COLORS
200
309
 
@@ -215,7 +324,7 @@ def main():
215
324
  args = parser.parse_args()
216
325
 
217
326
  # Apply existing CLI configuration (for code generation context)
218
- apply_cli_config(args, context="code")
327
+ apply_cli_config(args, mode="code")
219
328
 
220
329
  # If user wants to save current settings
221
330
  if args.save_config: