codicent-cli 0.4.4__tar.gz → 0.4.6__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.
File without changes
@@ -1,257 +1,258 @@
1
- Metadata-Version: 2.4
2
- Name: codicent-cli
3
- Version: 0.4.4
4
- Summary: Command-line interface for the Codicent API
5
- Home-page: https://github.com/izaxon/codicent-cli
6
- Author: Johan Isaksson
7
- Author-email: johan@izaxon.com
8
- Project-URL: Bug Reports, https://github.com/izaxon/codicent-cli/issues
9
- Project-URL: Source, https://github.com/izaxon/codicent-cli
10
- Keywords: codicent cli api chat ai
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Intended Audience :: Developers
13
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
- Classifier: License :: OSI Approved :: MIT License
15
- Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.6
17
- Classifier: Programming Language :: Python :: 3.7
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
- Classifier: Programming Language :: Python :: 3.10
21
- Classifier: Programming Language :: Python :: 3.11
22
- Classifier: Programming Language :: Python :: 3.12
23
- Requires-Python: >=3.6
24
- Description-Content-Type: text/markdown
25
- License-File: LICENSE
26
- Requires-Dist: rich
27
- Requires-Dist: codicent-py
28
- Dynamic: author
29
- Dynamic: author-email
30
- Dynamic: classifier
31
- Dynamic: description
32
- Dynamic: description-content-type
33
- Dynamic: home-page
34
- Dynamic: keywords
35
- Dynamic: license-file
36
- Dynamic: project-url
37
- Dynamic: requires-dist
38
- Dynamic: requires-python
39
- Dynamic: summary
40
-
41
- # Codicent CLI
42
-
43
- Codicent CLI is a command-line interface for interacting with the Codicent API. It provides both one-shot command execution and interactive chat sessions with comprehensive error handling and user-friendly features.
44
-
45
- ## Features
46
-
47
- - **One-shot mode**: Execute single commands and get responses
48
- - **Interactive mode**: Continuous chat sessions with conversation tracking
49
- - **Message types**: Support for regular chat and @-prefixed info messages
50
- - **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
51
- - **Rich output**: Markdown-formatted responses with beautiful terminal UI
52
- - **Error handling**: Comprehensive error messages and graceful failure handling
53
- - **Logging**: Configurable logging levels for debugging
54
-
55
- ## Installation
56
-
57
- ### Prerequisites
58
-
59
- - Python 3.6 or higher
60
- - `pip` (Python package installer)
61
-
62
- ### Quick Installation
63
-
64
- ```bash
65
- # Install from PyPI
66
- pip install codicent-py codicent-cli
67
- ```
68
-
69
- ### Development Installation
70
-
71
- #### Steps
72
-
73
- 1. Clone the repository:
74
- ```bash
75
- git clone https://github.com/izaxon/codicent-cli.git
76
- cd codicent-cli
77
- ```
78
-
79
- 2. Install in development mode:
80
- ```bash
81
- pip install -e .
82
- ```
83
-
84
- ### Direct Installation from GitHub
85
-
86
- You can also install directly from GitHub:
87
-
88
- ```bash
89
- # Install the latest version
90
- pip install git+https://github.com/izaxon/codicent-cli.git
91
-
92
- # Install a specific version
93
- pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.4
94
- ```
95
-
96
- ## Usage
97
-
98
- ### Basic Setup
99
-
100
- 1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
101
- ```bash
102
- export CODICENT_TOKEN="YOUR_API_TOKEN"
103
- ```
104
-
105
- ### Command Options
106
-
107
- ```
108
- codicent [OPTIONS] [QUESTION]
109
-
110
- OPTIONS:
111
- -t, --interactive Start interactive chat mode
112
- -h, --help Show help message
113
- -v, --version Show version information
114
- --verbose Enable verbose logging
115
- --quiet Suppress non-essential output
116
- ```
117
-
118
- ### Examples
119
-
120
- **One-shot questions:**
121
- ```bash
122
- codicent "What can you help me with?"
123
- codicent "Explain Python decorators"
124
- ```
125
-
126
- **Interactive mode:**
127
- ```bash
128
- codicent -t
129
- # or
130
- codicent --interactive
131
- ```
132
-
133
- **Piped input:**
134
- ```bash
135
- echo "What is machine learning?" | codicent
136
- codicent < questions.txt
137
- cat code.py | codicent "Review this code"
138
- ```
139
-
140
- **Info messages (@ prefix):**
141
- ```bash
142
- codicent "@mention This is an info message"
143
- ```
144
-
145
- **With logging:**
146
- ```bash
147
- codicent --verbose "Debug this issue"
148
- codicent --quiet "Silent operation"
149
- ```
150
-
151
- ## Interactive Mode
152
-
153
- In interactive mode, you can have ongoing conversations with enhanced visual clarity:
154
-
155
- ```
156
- $ codicent -t
157
- 🤖 Codicent CLI Interactive Mode
158
- Type your questions or use Ctrl+C to exit.
159
- Prefix with @ for info messages.
160
- ──────────────────────────────────────────────────
161
- ¤ What is Python?
162
-
163
- Python is a high-level, interpreted programming language known for its
164
- simplicity and readability. It was created by Guido van Rossum and first
165
- released in 1991.
166
-
167
- Key features:
168
- Easy to learn and use
169
- Extensive standard library
170
- Cross-platform compatibility
171
- Strong community support
172
- ──────────────────────────────────────────────────
173
- ¤ Can you give me an example?
174
-
175
- Here's a simple Python example:
176
-
177
- # Hello World in Python
178
- print("Hello, World!")
179
-
180
- # Working with variables
181
- name = "Alice"
182
- age = 25
183
- print(f"My name is {name} and I am {age} years old.")
184
-
185
- Python's syntax is clean and intuitive!
186
- ──────────────────────────────────────────────────
187
- ¤ @mention Save this conversation
188
- Message posted successfully.
189
- ──────────────────────────────────────────────────
190
- ¤ ^C
191
- 👋 Goodbye!
192
- ```
193
-
194
- **Visual Features:**
195
- - **Colored messages**: User input appears in cyan, bot responses in green
196
- - **Clean prompting**: Original `¤` prompt character maintained
197
- - **Visual separators**: Clear lines between conversations
198
- - **Rich formatting**: Markdown responses with syntax highlighting
199
- - **Status indicators**: Animated thinking indicators and success messages
200
- - **Emojis**: Friendly visual cues throughout the interface
201
-
202
- ## Error Handling
203
-
204
- The CLI provides helpful error messages for common issues:
205
-
206
- - **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
207
- - **Network errors**: Graceful handling of connection issues
208
- - **API errors**: Detailed error messages from the Codicent API
209
- - **Input validation**: Prevents empty or overly long inputs
210
- - **Keyboard interrupts**: Clean exit handling
211
-
212
- ## Development
213
-
214
- ### Running Tests
215
-
216
- ```bash
217
- python -m pytest test_app.py -v
218
- ```
219
-
220
- ### Project Structure
221
-
222
- - `app.py` - Main application logic (single-file architecture)
223
- - `test_app.py` - Comprehensive test suite
224
- - `setup.py` - Package configuration
225
- - `requirements.txt` - Dependencies (now uses PyPI packages)
226
-
227
- ### Dependencies
228
-
229
- - **codicent-py**: Core API client for Codicent services (now available on PyPI)
230
- - **rich**: Terminal formatting, markdown rendering, and animations
231
-
232
- ## Troubleshooting
233
-
234
- ### Common Issues
235
-
236
- 1. **"CODICENT_TOKEN environment variable is not set"**
237
- - Set the token: `export CODICENT_TOKEN="your_token"`
238
- - Verify it's set: `echo $CODICENT_TOKEN`
239
-
240
- 2. **"Network error: Unable to connect to Codicent API"**
241
- - Check your internet connection
242
- - Verify the Codicent API is accessible
243
- - Try again with `--verbose` for more details
244
-
245
- 3. **"Failed to initialize Codicent API client"**
246
- - Verify your token is valid
247
- - Check if the codicent-py package is properly installed
248
-
249
- ### Getting Help
250
-
251
- - Use `codicent --help` for usage information
252
- - Use `codicent --verbose` for detailed logging
253
- - Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
254
-
255
- ## License
256
-
257
- This project is licensed under the MIT License.
1
+ Metadata-Version: 2.4
2
+ Name: codicent-cli
3
+ Version: 0.4.6
4
+ Summary: Command-line interface for the Codicent API
5
+ Home-page: https://github.com/izaxon/codicent-cli
6
+ Author: Johan Isaksson
7
+ Author-email: johan@izaxon.com
8
+ Project-URL: Bug Reports, https://github.com/izaxon/codicent-cli/issues
9
+ Project-URL: Source, https://github.com/izaxon/codicent-cli
10
+ Keywords: codicent cli api chat ai
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.6
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Requires-Python: >=3.6
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: rich
27
+ Requires-Dist: codicent-py
28
+ Requires-Dist: prompt_toolkit
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: keywords
36
+ Dynamic: license-file
37
+ Dynamic: project-url
38
+ Dynamic: requires-dist
39
+ Dynamic: requires-python
40
+ Dynamic: summary
41
+
42
+ # Codicent CLI
43
+
44
+ Codicent CLI is a command-line interface for interacting with the Codicent API. It provides both one-shot command execution and interactive chat sessions with comprehensive error handling and user-friendly features.
45
+
46
+ ## Features
47
+
48
+ - **One-shot mode**: Execute single commands and get responses
49
+ - **Interactive mode**: Continuous chat sessions with conversation tracking
50
+ - **Message types**: Support for regular chat and @-prefixed info messages
51
+ - **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
52
+ - **Rich output**: Markdown-formatted responses with beautiful terminal UI
53
+ - **Error handling**: Comprehensive error messages and graceful failure handling
54
+ - **Logging**: Configurable logging levels for debugging
55
+
56
+ ## Installation
57
+
58
+ ### Prerequisites
59
+
60
+ - Python 3.6 or higher
61
+ - `pip` (Python package installer)
62
+
63
+ ### Quick Installation
64
+
65
+ ```bash
66
+ # Install from PyPI
67
+ pip install codicent-py codicent-cli
68
+ ```
69
+
70
+ ### Development Installation
71
+
72
+ #### Steps
73
+
74
+ 1. Clone the repository:
75
+ ```bash
76
+ git clone https://github.com/izaxon/codicent-cli.git
77
+ cd codicent-cli
78
+ ```
79
+
80
+ 2. Install in development mode:
81
+ ```bash
82
+ pip install -e .
83
+ ```
84
+
85
+ ### Direct Installation from GitHub
86
+
87
+ You can also install directly from GitHub:
88
+
89
+ ```bash
90
+ # Install the latest version
91
+ pip install git+https://github.com/izaxon/codicent-cli.git
92
+
93
+ # Install a specific version
94
+ pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.6
95
+ ```
96
+
97
+ ## Usage
98
+
99
+ ### Basic Setup
100
+
101
+ 1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
102
+ ```bash
103
+ export CODICENT_TOKEN="YOUR_API_TOKEN"
104
+ ```
105
+
106
+ ### Command Options
107
+
108
+ ```
109
+ codicent [OPTIONS] [QUESTION]
110
+
111
+ OPTIONS:
112
+ -t, --interactive Start interactive chat mode
113
+ -h, --help Show help message
114
+ -v, --version Show version information
115
+ --verbose Enable verbose logging
116
+ --quiet Suppress non-essential output
117
+ ```
118
+
119
+ ### Examples
120
+
121
+ **One-shot questions:**
122
+ ```bash
123
+ codicent "What can you help me with?"
124
+ codicent "Explain Python decorators"
125
+ ```
126
+
127
+ **Interactive mode:**
128
+ ```bash
129
+ codicent -t
130
+ # or
131
+ codicent --interactive
132
+ ```
133
+
134
+ **Piped input:**
135
+ ```bash
136
+ echo "What is machine learning?" | codicent
137
+ codicent < questions.txt
138
+ cat code.py | codicent "Review this code"
139
+ ```
140
+
141
+ **Info messages (@ prefix):**
142
+ ```bash
143
+ codicent "@mention This is an info message"
144
+ ```
145
+
146
+ **With logging:**
147
+ ```bash
148
+ codicent --verbose "Debug this issue"
149
+ codicent --quiet "Silent operation"
150
+ ```
151
+
152
+ ## Interactive Mode
153
+
154
+ In interactive mode, you can have ongoing conversations with enhanced visual clarity:
155
+
156
+ ```
157
+ $ codicent -t
158
+ 🤖 Codicent CLI Interactive Mode
159
+ Type your questions or use Ctrl+C to exit.
160
+ Prefix with @ for info messages.
161
+ ──────────────────────────────────────────────────
162
+ ¤ What is Python?
163
+
164
+ Python is a high-level, interpreted programming language known for its
165
+ simplicity and readability. It was created by Guido van Rossum and first
166
+ released in 1991.
167
+
168
+ Key features:
169
+ Easy to learn and use
170
+ Extensive standard library
171
+ Cross-platform compatibility
172
+ • Strong community support
173
+ ──────────────────────────────────────────────────
174
+ ¤ Can you give me an example?
175
+
176
+ Here's a simple Python example:
177
+
178
+ # Hello World in Python
179
+ print("Hello, World!")
180
+
181
+ # Working with variables
182
+ name = "Alice"
183
+ age = 25
184
+ print(f"My name is {name} and I am {age} years old.")
185
+
186
+ Python's syntax is clean and intuitive!
187
+ ──────────────────────────────────────────────────
188
+ ¤ @mention Save this conversation
189
+ ✅ Message posted successfully.
190
+ ──────────────────────────────────────────────────
191
+ ¤ ^C
192
+ 👋 Goodbye!
193
+ ```
194
+
195
+ **Visual Features:**
196
+ - **Colored messages**: User input appears in cyan, bot responses in green
197
+ - **Clean prompting**: Original `¤` prompt character maintained
198
+ - **Visual separators**: Clear lines between conversations
199
+ - **Rich formatting**: Markdown responses with syntax highlighting
200
+ - **Status indicators**: Animated thinking indicators and success messages
201
+ - **Emojis**: Friendly visual cues throughout the interface
202
+
203
+ ## Error Handling
204
+
205
+ The CLI provides helpful error messages for common issues:
206
+
207
+ - **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
208
+ - **Network errors**: Graceful handling of connection issues
209
+ - **API errors**: Detailed error messages from the Codicent API
210
+ - **Input validation**: Prevents empty or overly long inputs
211
+ - **Keyboard interrupts**: Clean exit handling
212
+
213
+ ## Development
214
+
215
+ ### Running Tests
216
+
217
+ ```bash
218
+ python -m pytest test_app.py -v
219
+ ```
220
+
221
+ ### Project Structure
222
+
223
+ - `app.py` - Main application logic (single-file architecture)
224
+ - `test_app.py` - Comprehensive test suite
225
+ - `setup.py` - Package configuration
226
+ - `requirements.txt` - Dependencies (now uses PyPI packages)
227
+
228
+ ### Dependencies
229
+
230
+ - **codicent-py**: Core API client for Codicent services (now available on PyPI)
231
+ - **rich**: Terminal formatting, markdown rendering, and animations
232
+
233
+ ## Troubleshooting
234
+
235
+ ### Common Issues
236
+
237
+ 1. **"CODICENT_TOKEN environment variable is not set"**
238
+ - Set the token: `export CODICENT_TOKEN="your_token"`
239
+ - Verify it's set: `echo $CODICENT_TOKEN`
240
+
241
+ 2. **"Network error: Unable to connect to Codicent API"**
242
+ - Check your internet connection
243
+ - Verify the Codicent API is accessible
244
+ - Try again with `--verbose` for more details
245
+
246
+ 3. **"Failed to initialize Codicent API client"**
247
+ - Verify your token is valid
248
+ - Check if the codicent-py package is properly installed
249
+
250
+ ### Getting Help
251
+
252
+ - Use `codicent --help` for usage information
253
+ - Use `codicent --verbose` for detailed logging
254
+ - Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
255
+
256
+ ## License
257
+
258
+ This project is licensed under the MIT License.
@@ -50,7 +50,7 @@ You can also install directly from GitHub:
50
50
  pip install git+https://github.com/izaxon/codicent-cli.git
51
51
 
52
52
  # Install a specific version
53
- pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.4
53
+ pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.6
54
54
  ```
55
55
 
56
56
  ## Usage
@@ -4,6 +4,10 @@ import logging
4
4
  from codicentpy import Codicent
5
5
  from rich.console import Console
6
6
  from rich.markdown import Markdown
7
+ from prompt_toolkit import prompt
8
+ from prompt_toolkit.key_binding import KeyBindings
9
+ from prompt_toolkit.keys import Keys
10
+ from prompt_toolkit.filters import Condition
7
11
 
8
12
  # Configure logging
9
13
  logging.basicConfig(level=logging.WARNING, format='%(levelname)s: %(message)s')
@@ -41,7 +45,7 @@ For more information, visit: https://github.com/izaxon/codicent-cli
41
45
 
42
46
  def show_version():
43
47
  """Display version information."""
44
- print("Codicent CLI v0.4.4")
48
+ print("Codicent CLI v0.4.6")
45
49
 
46
50
  def validate_input(question):
47
51
  """Validate user input."""
@@ -189,11 +193,31 @@ def main():
189
193
  console.print("\n[bold green]🤖 Codicent CLI Interactive Mode[/bold green]")
190
194
  console.print("[dim]Type your questions or use Ctrl+C to exit.[/dim]")
191
195
  console.print("[dim]Prefix with @ for info messages.[/dim]")
196
+ console.print("[dim]Enter: send | Alt+Enter: new line | Paste: multi-line supported[/dim]")
192
197
  console.print("─" * 50)
193
198
 
199
+ # Create custom key bindings
200
+ bindings = KeyBindings()
201
+
202
+ @bindings.add(Keys.Enter)
203
+ def _(event):
204
+ """Enter submits the input."""
205
+ event.current_buffer.validate_and_handle()
206
+
207
+ @bindings.add(Keys.Escape, Keys.Enter) # Alt+Enter
208
+ def _(event):
209
+ """Alt+Enter inserts a newline."""
210
+ event.current_buffer.insert_text('\n')
211
+
194
212
  while True:
195
213
  try:
196
- question = input("¤ ")
214
+ # Use prompt_toolkit's prompt instead of input()
215
+ question = prompt(
216
+ "¤ ",
217
+ multiline=True,
218
+ key_bindings=bindings,
219
+ prompt_continuation="" # No continuation prompt for clean look
220
+ )
197
221
  except KeyboardInterrupt:
198
222
  console.print("\n[yellow]👋 Goodbye![/yellow]")
199
223
  break
@@ -1,257 +1,258 @@
1
- Metadata-Version: 2.4
2
- Name: codicent-cli
3
- Version: 0.4.4
4
- Summary: Command-line interface for the Codicent API
5
- Home-page: https://github.com/izaxon/codicent-cli
6
- Author: Johan Isaksson
7
- Author-email: johan@izaxon.com
8
- Project-URL: Bug Reports, https://github.com/izaxon/codicent-cli/issues
9
- Project-URL: Source, https://github.com/izaxon/codicent-cli
10
- Keywords: codicent cli api chat ai
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Intended Audience :: Developers
13
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
- Classifier: License :: OSI Approved :: MIT License
15
- Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.6
17
- Classifier: Programming Language :: Python :: 3.7
18
- Classifier: Programming Language :: Python :: 3.8
19
- Classifier: Programming Language :: Python :: 3.9
20
- Classifier: Programming Language :: Python :: 3.10
21
- Classifier: Programming Language :: Python :: 3.11
22
- Classifier: Programming Language :: Python :: 3.12
23
- Requires-Python: >=3.6
24
- Description-Content-Type: text/markdown
25
- License-File: LICENSE
26
- Requires-Dist: rich
27
- Requires-Dist: codicent-py
28
- Dynamic: author
29
- Dynamic: author-email
30
- Dynamic: classifier
31
- Dynamic: description
32
- Dynamic: description-content-type
33
- Dynamic: home-page
34
- Dynamic: keywords
35
- Dynamic: license-file
36
- Dynamic: project-url
37
- Dynamic: requires-dist
38
- Dynamic: requires-python
39
- Dynamic: summary
40
-
41
- # Codicent CLI
42
-
43
- Codicent CLI is a command-line interface for interacting with the Codicent API. It provides both one-shot command execution and interactive chat sessions with comprehensive error handling and user-friendly features.
44
-
45
- ## Features
46
-
47
- - **One-shot mode**: Execute single commands and get responses
48
- - **Interactive mode**: Continuous chat sessions with conversation tracking
49
- - **Message types**: Support for regular chat and @-prefixed info messages
50
- - **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
51
- - **Rich output**: Markdown-formatted responses with beautiful terminal UI
52
- - **Error handling**: Comprehensive error messages and graceful failure handling
53
- - **Logging**: Configurable logging levels for debugging
54
-
55
- ## Installation
56
-
57
- ### Prerequisites
58
-
59
- - Python 3.6 or higher
60
- - `pip` (Python package installer)
61
-
62
- ### Quick Installation
63
-
64
- ```bash
65
- # Install from PyPI
66
- pip install codicent-py codicent-cli
67
- ```
68
-
69
- ### Development Installation
70
-
71
- #### Steps
72
-
73
- 1. Clone the repository:
74
- ```bash
75
- git clone https://github.com/izaxon/codicent-cli.git
76
- cd codicent-cli
77
- ```
78
-
79
- 2. Install in development mode:
80
- ```bash
81
- pip install -e .
82
- ```
83
-
84
- ### Direct Installation from GitHub
85
-
86
- You can also install directly from GitHub:
87
-
88
- ```bash
89
- # Install the latest version
90
- pip install git+https://github.com/izaxon/codicent-cli.git
91
-
92
- # Install a specific version
93
- pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.4
94
- ```
95
-
96
- ## Usage
97
-
98
- ### Basic Setup
99
-
100
- 1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
101
- ```bash
102
- export CODICENT_TOKEN="YOUR_API_TOKEN"
103
- ```
104
-
105
- ### Command Options
106
-
107
- ```
108
- codicent [OPTIONS] [QUESTION]
109
-
110
- OPTIONS:
111
- -t, --interactive Start interactive chat mode
112
- -h, --help Show help message
113
- -v, --version Show version information
114
- --verbose Enable verbose logging
115
- --quiet Suppress non-essential output
116
- ```
117
-
118
- ### Examples
119
-
120
- **One-shot questions:**
121
- ```bash
122
- codicent "What can you help me with?"
123
- codicent "Explain Python decorators"
124
- ```
125
-
126
- **Interactive mode:**
127
- ```bash
128
- codicent -t
129
- # or
130
- codicent --interactive
131
- ```
132
-
133
- **Piped input:**
134
- ```bash
135
- echo "What is machine learning?" | codicent
136
- codicent < questions.txt
137
- cat code.py | codicent "Review this code"
138
- ```
139
-
140
- **Info messages (@ prefix):**
141
- ```bash
142
- codicent "@mention This is an info message"
143
- ```
144
-
145
- **With logging:**
146
- ```bash
147
- codicent --verbose "Debug this issue"
148
- codicent --quiet "Silent operation"
149
- ```
150
-
151
- ## Interactive Mode
152
-
153
- In interactive mode, you can have ongoing conversations with enhanced visual clarity:
154
-
155
- ```
156
- $ codicent -t
157
- 🤖 Codicent CLI Interactive Mode
158
- Type your questions or use Ctrl+C to exit.
159
- Prefix with @ for info messages.
160
- ──────────────────────────────────────────────────
161
- ¤ What is Python?
162
-
163
- Python is a high-level, interpreted programming language known for its
164
- simplicity and readability. It was created by Guido van Rossum and first
165
- released in 1991.
166
-
167
- Key features:
168
- Easy to learn and use
169
- Extensive standard library
170
- Cross-platform compatibility
171
- Strong community support
172
- ──────────────────────────────────────────────────
173
- ¤ Can you give me an example?
174
-
175
- Here's a simple Python example:
176
-
177
- # Hello World in Python
178
- print("Hello, World!")
179
-
180
- # Working with variables
181
- name = "Alice"
182
- age = 25
183
- print(f"My name is {name} and I am {age} years old.")
184
-
185
- Python's syntax is clean and intuitive!
186
- ──────────────────────────────────────────────────
187
- ¤ @mention Save this conversation
188
- Message posted successfully.
189
- ──────────────────────────────────────────────────
190
- ¤ ^C
191
- 👋 Goodbye!
192
- ```
193
-
194
- **Visual Features:**
195
- - **Colored messages**: User input appears in cyan, bot responses in green
196
- - **Clean prompting**: Original `¤` prompt character maintained
197
- - **Visual separators**: Clear lines between conversations
198
- - **Rich formatting**: Markdown responses with syntax highlighting
199
- - **Status indicators**: Animated thinking indicators and success messages
200
- - **Emojis**: Friendly visual cues throughout the interface
201
-
202
- ## Error Handling
203
-
204
- The CLI provides helpful error messages for common issues:
205
-
206
- - **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
207
- - **Network errors**: Graceful handling of connection issues
208
- - **API errors**: Detailed error messages from the Codicent API
209
- - **Input validation**: Prevents empty or overly long inputs
210
- - **Keyboard interrupts**: Clean exit handling
211
-
212
- ## Development
213
-
214
- ### Running Tests
215
-
216
- ```bash
217
- python -m pytest test_app.py -v
218
- ```
219
-
220
- ### Project Structure
221
-
222
- - `app.py` - Main application logic (single-file architecture)
223
- - `test_app.py` - Comprehensive test suite
224
- - `setup.py` - Package configuration
225
- - `requirements.txt` - Dependencies (now uses PyPI packages)
226
-
227
- ### Dependencies
228
-
229
- - **codicent-py**: Core API client for Codicent services (now available on PyPI)
230
- - **rich**: Terminal formatting, markdown rendering, and animations
231
-
232
- ## Troubleshooting
233
-
234
- ### Common Issues
235
-
236
- 1. **"CODICENT_TOKEN environment variable is not set"**
237
- - Set the token: `export CODICENT_TOKEN="your_token"`
238
- - Verify it's set: `echo $CODICENT_TOKEN`
239
-
240
- 2. **"Network error: Unable to connect to Codicent API"**
241
- - Check your internet connection
242
- - Verify the Codicent API is accessible
243
- - Try again with `--verbose` for more details
244
-
245
- 3. **"Failed to initialize Codicent API client"**
246
- - Verify your token is valid
247
- - Check if the codicent-py package is properly installed
248
-
249
- ### Getting Help
250
-
251
- - Use `codicent --help` for usage information
252
- - Use `codicent --verbose` for detailed logging
253
- - Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
254
-
255
- ## License
256
-
257
- This project is licensed under the MIT License.
1
+ Metadata-Version: 2.4
2
+ Name: codicent-cli
3
+ Version: 0.4.6
4
+ Summary: Command-line interface for the Codicent API
5
+ Home-page: https://github.com/izaxon/codicent-cli
6
+ Author: Johan Isaksson
7
+ Author-email: johan@izaxon.com
8
+ Project-URL: Bug Reports, https://github.com/izaxon/codicent-cli/issues
9
+ Project-URL: Source, https://github.com/izaxon/codicent-cli
10
+ Keywords: codicent cli api chat ai
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.6
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Requires-Python: >=3.6
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: rich
27
+ Requires-Dist: codicent-py
28
+ Requires-Dist: prompt_toolkit
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: keywords
36
+ Dynamic: license-file
37
+ Dynamic: project-url
38
+ Dynamic: requires-dist
39
+ Dynamic: requires-python
40
+ Dynamic: summary
41
+
42
+ # Codicent CLI
43
+
44
+ Codicent CLI is a command-line interface for interacting with the Codicent API. It provides both one-shot command execution and interactive chat sessions with comprehensive error handling and user-friendly features.
45
+
46
+ ## Features
47
+
48
+ - **One-shot mode**: Execute single commands and get responses
49
+ - **Interactive mode**: Continuous chat sessions with conversation tracking
50
+ - **Message types**: Support for regular chat and @-prefixed info messages
51
+ - **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
52
+ - **Rich output**: Markdown-formatted responses with beautiful terminal UI
53
+ - **Error handling**: Comprehensive error messages and graceful failure handling
54
+ - **Logging**: Configurable logging levels for debugging
55
+
56
+ ## Installation
57
+
58
+ ### Prerequisites
59
+
60
+ - Python 3.6 or higher
61
+ - `pip` (Python package installer)
62
+
63
+ ### Quick Installation
64
+
65
+ ```bash
66
+ # Install from PyPI
67
+ pip install codicent-py codicent-cli
68
+ ```
69
+
70
+ ### Development Installation
71
+
72
+ #### Steps
73
+
74
+ 1. Clone the repository:
75
+ ```bash
76
+ git clone https://github.com/izaxon/codicent-cli.git
77
+ cd codicent-cli
78
+ ```
79
+
80
+ 2. Install in development mode:
81
+ ```bash
82
+ pip install -e .
83
+ ```
84
+
85
+ ### Direct Installation from GitHub
86
+
87
+ You can also install directly from GitHub:
88
+
89
+ ```bash
90
+ # Install the latest version
91
+ pip install git+https://github.com/izaxon/codicent-cli.git
92
+
93
+ # Install a specific version
94
+ pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.6
95
+ ```
96
+
97
+ ## Usage
98
+
99
+ ### Basic Setup
100
+
101
+ 1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
102
+ ```bash
103
+ export CODICENT_TOKEN="YOUR_API_TOKEN"
104
+ ```
105
+
106
+ ### Command Options
107
+
108
+ ```
109
+ codicent [OPTIONS] [QUESTION]
110
+
111
+ OPTIONS:
112
+ -t, --interactive Start interactive chat mode
113
+ -h, --help Show help message
114
+ -v, --version Show version information
115
+ --verbose Enable verbose logging
116
+ --quiet Suppress non-essential output
117
+ ```
118
+
119
+ ### Examples
120
+
121
+ **One-shot questions:**
122
+ ```bash
123
+ codicent "What can you help me with?"
124
+ codicent "Explain Python decorators"
125
+ ```
126
+
127
+ **Interactive mode:**
128
+ ```bash
129
+ codicent -t
130
+ # or
131
+ codicent --interactive
132
+ ```
133
+
134
+ **Piped input:**
135
+ ```bash
136
+ echo "What is machine learning?" | codicent
137
+ codicent < questions.txt
138
+ cat code.py | codicent "Review this code"
139
+ ```
140
+
141
+ **Info messages (@ prefix):**
142
+ ```bash
143
+ codicent "@mention This is an info message"
144
+ ```
145
+
146
+ **With logging:**
147
+ ```bash
148
+ codicent --verbose "Debug this issue"
149
+ codicent --quiet "Silent operation"
150
+ ```
151
+
152
+ ## Interactive Mode
153
+
154
+ In interactive mode, you can have ongoing conversations with enhanced visual clarity:
155
+
156
+ ```
157
+ $ codicent -t
158
+ 🤖 Codicent CLI Interactive Mode
159
+ Type your questions or use Ctrl+C to exit.
160
+ Prefix with @ for info messages.
161
+ ──────────────────────────────────────────────────
162
+ ¤ What is Python?
163
+
164
+ Python is a high-level, interpreted programming language known for its
165
+ simplicity and readability. It was created by Guido van Rossum and first
166
+ released in 1991.
167
+
168
+ Key features:
169
+ Easy to learn and use
170
+ Extensive standard library
171
+ Cross-platform compatibility
172
+ • Strong community support
173
+ ──────────────────────────────────────────────────
174
+ ¤ Can you give me an example?
175
+
176
+ Here's a simple Python example:
177
+
178
+ # Hello World in Python
179
+ print("Hello, World!")
180
+
181
+ # Working with variables
182
+ name = "Alice"
183
+ age = 25
184
+ print(f"My name is {name} and I am {age} years old.")
185
+
186
+ Python's syntax is clean and intuitive!
187
+ ──────────────────────────────────────────────────
188
+ ¤ @mention Save this conversation
189
+ ✅ Message posted successfully.
190
+ ──────────────────────────────────────────────────
191
+ ¤ ^C
192
+ 👋 Goodbye!
193
+ ```
194
+
195
+ **Visual Features:**
196
+ - **Colored messages**: User input appears in cyan, bot responses in green
197
+ - **Clean prompting**: Original `¤` prompt character maintained
198
+ - **Visual separators**: Clear lines between conversations
199
+ - **Rich formatting**: Markdown responses with syntax highlighting
200
+ - **Status indicators**: Animated thinking indicators and success messages
201
+ - **Emojis**: Friendly visual cues throughout the interface
202
+
203
+ ## Error Handling
204
+
205
+ The CLI provides helpful error messages for common issues:
206
+
207
+ - **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
208
+ - **Network errors**: Graceful handling of connection issues
209
+ - **API errors**: Detailed error messages from the Codicent API
210
+ - **Input validation**: Prevents empty or overly long inputs
211
+ - **Keyboard interrupts**: Clean exit handling
212
+
213
+ ## Development
214
+
215
+ ### Running Tests
216
+
217
+ ```bash
218
+ python -m pytest test_app.py -v
219
+ ```
220
+
221
+ ### Project Structure
222
+
223
+ - `app.py` - Main application logic (single-file architecture)
224
+ - `test_app.py` - Comprehensive test suite
225
+ - `setup.py` - Package configuration
226
+ - `requirements.txt` - Dependencies (now uses PyPI packages)
227
+
228
+ ### Dependencies
229
+
230
+ - **codicent-py**: Core API client for Codicent services (now available on PyPI)
231
+ - **rich**: Terminal formatting, markdown rendering, and animations
232
+
233
+ ## Troubleshooting
234
+
235
+ ### Common Issues
236
+
237
+ 1. **"CODICENT_TOKEN environment variable is not set"**
238
+ - Set the token: `export CODICENT_TOKEN="your_token"`
239
+ - Verify it's set: `echo $CODICENT_TOKEN`
240
+
241
+ 2. **"Network error: Unable to connect to Codicent API"**
242
+ - Check your internet connection
243
+ - Verify the Codicent API is accessible
244
+ - Try again with `--verbose` for more details
245
+
246
+ 3. **"Failed to initialize Codicent API client"**
247
+ - Verify your token is valid
248
+ - Check if the codicent-py package is properly installed
249
+
250
+ ### Getting Help
251
+
252
+ - Use `codicent --help` for usage information
253
+ - Use `codicent --verbose` for detailed logging
254
+ - Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
255
+
256
+ ## License
257
+
258
+ This project is licensed under the MIT License.
@@ -1,2 +1,3 @@
1
1
  rich
2
2
  codicent-py
3
+ prompt_toolkit
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -9,7 +9,7 @@ except FileNotFoundError:
9
9
 
10
10
  setup(
11
11
  name='codicent-cli',
12
- version='0.4.4',
12
+ version='0.4.6',
13
13
  author='Johan Isaksson',
14
14
  author_email='johan@izaxon.com',
15
15
  description='Command-line interface for the Codicent API',
@@ -40,6 +40,7 @@ setup(
40
40
  install_requires=[
41
41
  'rich',
42
42
  'codicent-py',
43
+ 'prompt_toolkit'
43
44
  ],
44
45
  entry_points={
45
46
  'console_scripts': [