codicent-cli 0.4.8__tar.gz → 0.5.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.
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/LICENSE +21 -21
- {codicent_cli-0.4.8/codicent_cli.egg-info → codicent_cli-0.5.0}/PKG-INFO +259 -259
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/README.md +217 -217
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/app.py +414 -285
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/auth.py +244 -244
- {codicent_cli-0.4.8 → codicent_cli-0.5.0/codicent_cli.egg-info}/PKG-INFO +259 -259
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/setup.cfg +4 -4
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/setup.py +51 -51
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/codicent_cli.egg-info/SOURCES.txt +0 -0
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/codicent_cli.egg-info/dependency_links.txt +0 -0
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/codicent_cli.egg-info/entry_points.txt +0 -0
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/codicent_cli.egg-info/requires.txt +0 -0
- {codicent_cli-0.4.8 → codicent_cli-0.5.0}/codicent_cli.egg-info/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Johan Isaksson
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Johan Isaksson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,259 +1,259 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: codicent-cli
|
|
3
|
-
Version: 0.
|
|
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
|
-
Requires-Dist: requests
|
|
30
|
-
Dynamic: author
|
|
31
|
-
Dynamic: author-email
|
|
32
|
-
Dynamic: classifier
|
|
33
|
-
Dynamic: description
|
|
34
|
-
Dynamic: description-content-type
|
|
35
|
-
Dynamic: home-page
|
|
36
|
-
Dynamic: keywords
|
|
37
|
-
Dynamic: license-file
|
|
38
|
-
Dynamic: project-url
|
|
39
|
-
Dynamic: requires-dist
|
|
40
|
-
Dynamic: requires-python
|
|
41
|
-
Dynamic: summary
|
|
42
|
-
|
|
43
|
-
# Codicent CLI
|
|
44
|
-
|
|
45
|
-
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.
|
|
46
|
-
|
|
47
|
-
## Features
|
|
48
|
-
|
|
49
|
-
- **One-shot mode**: Execute single commands and get responses
|
|
50
|
-
- **Interactive mode**: Continuous chat sessions with conversation tracking
|
|
51
|
-
- **Message types**: Support for regular chat and @-prefixed info messages
|
|
52
|
-
- **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
|
|
53
|
-
- **Rich output**: Markdown-formatted responses with beautiful terminal UI
|
|
54
|
-
- **Error handling**: Comprehensive error messages and graceful failure handling
|
|
55
|
-
- **Logging**: Configurable logging levels for debugging
|
|
56
|
-
|
|
57
|
-
## Installation
|
|
58
|
-
|
|
59
|
-
### Prerequisites
|
|
60
|
-
|
|
61
|
-
- Python 3.6 or higher
|
|
62
|
-
- `pip` (Python package installer)
|
|
63
|
-
|
|
64
|
-
### Quick Installation
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
# Install from PyPI
|
|
68
|
-
pip install codicent-py codicent-cli
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Development Installation
|
|
72
|
-
|
|
73
|
-
#### Steps
|
|
74
|
-
|
|
75
|
-
1. Clone the repository:
|
|
76
|
-
```bash
|
|
77
|
-
git clone https://github.com/izaxon/codicent-cli.git
|
|
78
|
-
cd codicent-cli
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
2. Install in development mode:
|
|
82
|
-
```bash
|
|
83
|
-
pip install -e .
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Direct Installation from GitHub
|
|
87
|
-
|
|
88
|
-
You can also install directly from GitHub:
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# Install the latest version
|
|
92
|
-
pip install git+https://github.com/izaxon/codicent-cli.git
|
|
93
|
-
|
|
94
|
-
# Install a specific version
|
|
95
|
-
pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.8
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Usage
|
|
99
|
-
|
|
100
|
-
### Basic Setup
|
|
101
|
-
|
|
102
|
-
1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
|
|
103
|
-
```bash
|
|
104
|
-
export CODICENT_TOKEN="YOUR_API_TOKEN"
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Command Options
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
codicent [OPTIONS] [QUESTION]
|
|
111
|
-
|
|
112
|
-
OPTIONS:
|
|
113
|
-
-t, --interactive Start interactive chat mode
|
|
114
|
-
-h, --help Show help message
|
|
115
|
-
-v, --version Show version information
|
|
116
|
-
--verbose Enable verbose logging
|
|
117
|
-
--quiet Suppress non-essential output
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Examples
|
|
121
|
-
|
|
122
|
-
**One-shot questions:**
|
|
123
|
-
```bash
|
|
124
|
-
codicent "What can you help me with?"
|
|
125
|
-
codicent "Explain Python decorators"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Interactive mode:**
|
|
129
|
-
```bash
|
|
130
|
-
codicent -t
|
|
131
|
-
# or
|
|
132
|
-
codicent --interactive
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
**Piped input:**
|
|
136
|
-
```bash
|
|
137
|
-
echo "What is machine learning?" | codicent
|
|
138
|
-
codicent < questions.txt
|
|
139
|
-
cat code.py | codicent "Review this code"
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
**Info messages (@ prefix):**
|
|
143
|
-
```bash
|
|
144
|
-
codicent "@mention This is an info message"
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
**With logging:**
|
|
148
|
-
```bash
|
|
149
|
-
codicent --verbose "Debug this issue"
|
|
150
|
-
codicent --quiet "Silent operation"
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## Interactive Mode
|
|
154
|
-
|
|
155
|
-
In interactive mode, you can have ongoing conversations with enhanced visual clarity:
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
$ codicent -t
|
|
159
|
-
🤖 Codicent CLI Interactive Mode
|
|
160
|
-
Type your questions or use Ctrl+C to exit.
|
|
161
|
-
Prefix with @ for info messages.
|
|
162
|
-
──────────────────────────────────────────────────
|
|
163
|
-
¤ What is Python?
|
|
164
|
-
|
|
165
|
-
Python is a high-level, interpreted programming language known for its
|
|
166
|
-
simplicity and readability. It was created by Guido van Rossum and first
|
|
167
|
-
released in 1991.
|
|
168
|
-
|
|
169
|
-
Key features:
|
|
170
|
-
• Easy to learn and use
|
|
171
|
-
• Extensive standard library
|
|
172
|
-
• Cross-platform compatibility
|
|
173
|
-
• Strong community support
|
|
174
|
-
──────────────────────────────────────────────────
|
|
175
|
-
¤ Can you give me an example?
|
|
176
|
-
|
|
177
|
-
Here's a simple Python example:
|
|
178
|
-
|
|
179
|
-
# Hello World in Python
|
|
180
|
-
print("Hello, World!")
|
|
181
|
-
|
|
182
|
-
# Working with variables
|
|
183
|
-
name = "Alice"
|
|
184
|
-
age = 25
|
|
185
|
-
print(f"My name is {name} and I am {age} years old.")
|
|
186
|
-
|
|
187
|
-
Python's syntax is clean and intuitive!
|
|
188
|
-
──────────────────────────────────────────────────
|
|
189
|
-
¤ @mention Save this conversation
|
|
190
|
-
✅ Message posted successfully.
|
|
191
|
-
──────────────────────────────────────────────────
|
|
192
|
-
¤ ^C
|
|
193
|
-
👋 Goodbye!
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
**Visual Features:**
|
|
197
|
-
- **Colored messages**: User input appears in cyan, bot responses in green
|
|
198
|
-
- **Clean prompting**: Original `¤` prompt character maintained
|
|
199
|
-
- **Visual separators**: Clear lines between conversations
|
|
200
|
-
- **Rich formatting**: Markdown responses with syntax highlighting
|
|
201
|
-
- **Status indicators**: Animated thinking indicators and success messages
|
|
202
|
-
- **Emojis**: Friendly visual cues throughout the interface
|
|
203
|
-
|
|
204
|
-
## Error Handling
|
|
205
|
-
|
|
206
|
-
The CLI provides helpful error messages for common issues:
|
|
207
|
-
|
|
208
|
-
- **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
|
|
209
|
-
- **Network errors**: Graceful handling of connection issues
|
|
210
|
-
- **API errors**: Detailed error messages from the Codicent API
|
|
211
|
-
- **Input validation**: Prevents empty or overly long inputs
|
|
212
|
-
- **Keyboard interrupts**: Clean exit handling
|
|
213
|
-
|
|
214
|
-
## Development
|
|
215
|
-
|
|
216
|
-
### Running Tests
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
python -m pytest test_app.py -v
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Project Structure
|
|
223
|
-
|
|
224
|
-
- `app.py` - Main application logic (single-file architecture)
|
|
225
|
-
- `test_app.py` - Comprehensive test suite
|
|
226
|
-
- `setup.py` - Package configuration
|
|
227
|
-
- `requirements.txt` - Dependencies (now uses PyPI packages)
|
|
228
|
-
|
|
229
|
-
### Dependencies
|
|
230
|
-
|
|
231
|
-
- **codicent-py**: Core API client for Codicent services (now available on PyPI)
|
|
232
|
-
- **rich**: Terminal formatting, markdown rendering, and animations
|
|
233
|
-
|
|
234
|
-
## Troubleshooting
|
|
235
|
-
|
|
236
|
-
### Common Issues
|
|
237
|
-
|
|
238
|
-
1. **"CODICENT_TOKEN environment variable is not set"**
|
|
239
|
-
- Set the token: `export CODICENT_TOKEN="your_token"`
|
|
240
|
-
- Verify it's set: `echo $CODICENT_TOKEN`
|
|
241
|
-
|
|
242
|
-
2. **"Network error: Unable to connect to Codicent API"**
|
|
243
|
-
- Check your internet connection
|
|
244
|
-
- Verify the Codicent API is accessible
|
|
245
|
-
- Try again with `--verbose` for more details
|
|
246
|
-
|
|
247
|
-
3. **"Failed to initialize Codicent API client"**
|
|
248
|
-
- Verify your token is valid
|
|
249
|
-
- Check if the codicent-py package is properly installed
|
|
250
|
-
|
|
251
|
-
### Getting Help
|
|
252
|
-
|
|
253
|
-
- Use `codicent --help` for usage information
|
|
254
|
-
- Use `codicent --verbose` for detailed logging
|
|
255
|
-
- Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
|
|
256
|
-
|
|
257
|
-
## License
|
|
258
|
-
|
|
259
|
-
This project is licensed under the MIT License.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codicent-cli
|
|
3
|
+
Version: 0.5.0
|
|
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
|
+
Requires-Dist: requests
|
|
30
|
+
Dynamic: author
|
|
31
|
+
Dynamic: author-email
|
|
32
|
+
Dynamic: classifier
|
|
33
|
+
Dynamic: description
|
|
34
|
+
Dynamic: description-content-type
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: keywords
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
Dynamic: project-url
|
|
39
|
+
Dynamic: requires-dist
|
|
40
|
+
Dynamic: requires-python
|
|
41
|
+
Dynamic: summary
|
|
42
|
+
|
|
43
|
+
# Codicent CLI
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- **One-shot mode**: Execute single commands and get responses
|
|
50
|
+
- **Interactive mode**: Continuous chat sessions with conversation tracking
|
|
51
|
+
- **Message types**: Support for regular chat and @-prefixed info messages
|
|
52
|
+
- **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
|
|
53
|
+
- **Rich output**: Markdown-formatted responses with beautiful terminal UI
|
|
54
|
+
- **Error handling**: Comprehensive error messages and graceful failure handling
|
|
55
|
+
- **Logging**: Configurable logging levels for debugging
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
### Prerequisites
|
|
60
|
+
|
|
61
|
+
- Python 3.6 or higher
|
|
62
|
+
- `pip` (Python package installer)
|
|
63
|
+
|
|
64
|
+
### Quick Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Install from PyPI
|
|
68
|
+
pip install codicent-py codicent-cli
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Development Installation
|
|
72
|
+
|
|
73
|
+
#### Steps
|
|
74
|
+
|
|
75
|
+
1. Clone the repository:
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/izaxon/codicent-cli.git
|
|
78
|
+
cd codicent-cli
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
2. Install in development mode:
|
|
82
|
+
```bash
|
|
83
|
+
pip install -e .
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Direct Installation from GitHub
|
|
87
|
+
|
|
88
|
+
You can also install directly from GitHub:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Install the latest version
|
|
92
|
+
pip install git+https://github.com/izaxon/codicent-cli.git
|
|
93
|
+
|
|
94
|
+
# Install a specific version
|
|
95
|
+
pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.8
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Usage
|
|
99
|
+
|
|
100
|
+
### Basic Setup
|
|
101
|
+
|
|
102
|
+
1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
|
|
103
|
+
```bash
|
|
104
|
+
export CODICENT_TOKEN="YOUR_API_TOKEN"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Command Options
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
codicent [OPTIONS] [QUESTION]
|
|
111
|
+
|
|
112
|
+
OPTIONS:
|
|
113
|
+
-t, --interactive Start interactive chat mode
|
|
114
|
+
-h, --help Show help message
|
|
115
|
+
-v, --version Show version information
|
|
116
|
+
--verbose Enable verbose logging
|
|
117
|
+
--quiet Suppress non-essential output
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Examples
|
|
121
|
+
|
|
122
|
+
**One-shot questions:**
|
|
123
|
+
```bash
|
|
124
|
+
codicent "What can you help me with?"
|
|
125
|
+
codicent "Explain Python decorators"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Interactive mode:**
|
|
129
|
+
```bash
|
|
130
|
+
codicent -t
|
|
131
|
+
# or
|
|
132
|
+
codicent --interactive
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Piped input:**
|
|
136
|
+
```bash
|
|
137
|
+
echo "What is machine learning?" | codicent
|
|
138
|
+
codicent < questions.txt
|
|
139
|
+
cat code.py | codicent "Review this code"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Info messages (@ prefix):**
|
|
143
|
+
```bash
|
|
144
|
+
codicent "@mention This is an info message"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**With logging:**
|
|
148
|
+
```bash
|
|
149
|
+
codicent --verbose "Debug this issue"
|
|
150
|
+
codicent --quiet "Silent operation"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Interactive Mode
|
|
154
|
+
|
|
155
|
+
In interactive mode, you can have ongoing conversations with enhanced visual clarity:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
$ codicent -t
|
|
159
|
+
🤖 Codicent CLI Interactive Mode
|
|
160
|
+
Type your questions or use Ctrl+C to exit.
|
|
161
|
+
Prefix with @ for info messages.
|
|
162
|
+
──────────────────────────────────────────────────
|
|
163
|
+
¤ What is Python?
|
|
164
|
+
|
|
165
|
+
Python is a high-level, interpreted programming language known for its
|
|
166
|
+
simplicity and readability. It was created by Guido van Rossum and first
|
|
167
|
+
released in 1991.
|
|
168
|
+
|
|
169
|
+
Key features:
|
|
170
|
+
• Easy to learn and use
|
|
171
|
+
• Extensive standard library
|
|
172
|
+
• Cross-platform compatibility
|
|
173
|
+
• Strong community support
|
|
174
|
+
──────────────────────────────────────────────────
|
|
175
|
+
¤ Can you give me an example?
|
|
176
|
+
|
|
177
|
+
Here's a simple Python example:
|
|
178
|
+
|
|
179
|
+
# Hello World in Python
|
|
180
|
+
print("Hello, World!")
|
|
181
|
+
|
|
182
|
+
# Working with variables
|
|
183
|
+
name = "Alice"
|
|
184
|
+
age = 25
|
|
185
|
+
print(f"My name is {name} and I am {age} years old.")
|
|
186
|
+
|
|
187
|
+
Python's syntax is clean and intuitive!
|
|
188
|
+
──────────────────────────────────────────────────
|
|
189
|
+
¤ @mention Save this conversation
|
|
190
|
+
✅ Message posted successfully.
|
|
191
|
+
──────────────────────────────────────────────────
|
|
192
|
+
¤ ^C
|
|
193
|
+
👋 Goodbye!
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Visual Features:**
|
|
197
|
+
- **Colored messages**: User input appears in cyan, bot responses in green
|
|
198
|
+
- **Clean prompting**: Original `¤` prompt character maintained
|
|
199
|
+
- **Visual separators**: Clear lines between conversations
|
|
200
|
+
- **Rich formatting**: Markdown responses with syntax highlighting
|
|
201
|
+
- **Status indicators**: Animated thinking indicators and success messages
|
|
202
|
+
- **Emojis**: Friendly visual cues throughout the interface
|
|
203
|
+
|
|
204
|
+
## Error Handling
|
|
205
|
+
|
|
206
|
+
The CLI provides helpful error messages for common issues:
|
|
207
|
+
|
|
208
|
+
- **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
|
|
209
|
+
- **Network errors**: Graceful handling of connection issues
|
|
210
|
+
- **API errors**: Detailed error messages from the Codicent API
|
|
211
|
+
- **Input validation**: Prevents empty or overly long inputs
|
|
212
|
+
- **Keyboard interrupts**: Clean exit handling
|
|
213
|
+
|
|
214
|
+
## Development
|
|
215
|
+
|
|
216
|
+
### Running Tests
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
python -m pytest test_app.py -v
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Project Structure
|
|
223
|
+
|
|
224
|
+
- `app.py` - Main application logic (single-file architecture)
|
|
225
|
+
- `test_app.py` - Comprehensive test suite
|
|
226
|
+
- `setup.py` - Package configuration
|
|
227
|
+
- `requirements.txt` - Dependencies (now uses PyPI packages)
|
|
228
|
+
|
|
229
|
+
### Dependencies
|
|
230
|
+
|
|
231
|
+
- **codicent-py**: Core API client for Codicent services (now available on PyPI)
|
|
232
|
+
- **rich**: Terminal formatting, markdown rendering, and animations
|
|
233
|
+
|
|
234
|
+
## Troubleshooting
|
|
235
|
+
|
|
236
|
+
### Common Issues
|
|
237
|
+
|
|
238
|
+
1. **"CODICENT_TOKEN environment variable is not set"**
|
|
239
|
+
- Set the token: `export CODICENT_TOKEN="your_token"`
|
|
240
|
+
- Verify it's set: `echo $CODICENT_TOKEN`
|
|
241
|
+
|
|
242
|
+
2. **"Network error: Unable to connect to Codicent API"**
|
|
243
|
+
- Check your internet connection
|
|
244
|
+
- Verify the Codicent API is accessible
|
|
245
|
+
- Try again with `--verbose` for more details
|
|
246
|
+
|
|
247
|
+
3. **"Failed to initialize Codicent API client"**
|
|
248
|
+
- Verify your token is valid
|
|
249
|
+
- Check if the codicent-py package is properly installed
|
|
250
|
+
|
|
251
|
+
### Getting Help
|
|
252
|
+
|
|
253
|
+
- Use `codicent --help` for usage information
|
|
254
|
+
- Use `codicent --verbose` for detailed logging
|
|
255
|
+
- Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
This project is licensed under the MIT License.
|