codicent-cli 0.4.3__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.3/LICENSE +21 -0
- codicent_cli-0.4.3/PKG-INFO +267 -0
- codicent_cli-0.4.3/README.md +228 -0
- codicent_cli-0.4.3/app.py +216 -0
- codicent_cli-0.4.3/codicent_cli.egg-info/PKG-INFO +267 -0
- codicent_cli-0.4.3/codicent_cli.egg-info/SOURCES.txt +10 -0
- codicent_cli-0.4.3/codicent_cli.egg-info/dependency_links.txt +1 -0
- codicent_cli-0.4.3/codicent_cli.egg-info/entry_points.txt +2 -0
- codicent_cli-0.4.3/codicent_cli.egg-info/requires.txt +1 -0
- codicent_cli-0.4.3/codicent_cli.egg-info/top_level.txt +1 -0
- codicent_cli-0.4.3/setup.cfg +4 -0
- codicent_cli-0.4.3/setup.py +49 -0
|
@@ -0,0 +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.
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codicent-cli
|
|
3
|
+
Version: 0.4.3
|
|
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
|
+
Dynamic: author
|
|
28
|
+
Dynamic: author-email
|
|
29
|
+
Dynamic: classifier
|
|
30
|
+
Dynamic: description
|
|
31
|
+
Dynamic: description-content-type
|
|
32
|
+
Dynamic: home-page
|
|
33
|
+
Dynamic: keywords
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
Dynamic: project-url
|
|
36
|
+
Dynamic: requires-dist
|
|
37
|
+
Dynamic: requires-python
|
|
38
|
+
Dynamic: summary
|
|
39
|
+
|
|
40
|
+
# Codicent CLI
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- **One-shot mode**: Execute single commands and get responses
|
|
47
|
+
- **Interactive mode**: Continuous chat sessions with conversation tracking
|
|
48
|
+
- **Message types**: Support for regular chat and @-prefixed info messages
|
|
49
|
+
- **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
|
|
50
|
+
- **Rich output**: Markdown-formatted responses with beautiful terminal UI
|
|
51
|
+
- **Error handling**: Comprehensive error messages and graceful failure handling
|
|
52
|
+
- **Logging**: Configurable logging levels for debugging
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Prerequisites
|
|
57
|
+
|
|
58
|
+
- Python 3.6 or higher
|
|
59
|
+
- `pip` (Python package installer)
|
|
60
|
+
|
|
61
|
+
### Quick Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Install both dependencies with one command
|
|
65
|
+
pip install git+https://github.com/izaxon/codicent-py.git git+https://github.com/izaxon/codicent-cli.git@v0.4.3
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Development Installation
|
|
69
|
+
|
|
70
|
+
#### Steps
|
|
71
|
+
|
|
72
|
+
1. Clone the repository:
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://github.com/izaxon/codicent-cli.git
|
|
75
|
+
cd codicent-cli
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
2. Install the Git dependency:
|
|
79
|
+
```bash
|
|
80
|
+
pip install git+https://github.com/izaxon/codicent-py.git
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
3. Install the CLI application:
|
|
84
|
+
```bash
|
|
85
|
+
pip install .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For development mode:
|
|
89
|
+
```bash
|
|
90
|
+
pip install -e .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Direct Installation from GitHub
|
|
94
|
+
|
|
95
|
+
You can also install directly from GitHub without cloning:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Install the latest release
|
|
99
|
+
pip install git+https://github.com/izaxon/codicent-py.git
|
|
100
|
+
pip install git+https://github.com/izaxon/codicent-cli.git
|
|
101
|
+
|
|
102
|
+
# Install a specific version
|
|
103
|
+
pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.3
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Usage
|
|
107
|
+
|
|
108
|
+
### Basic Setup
|
|
109
|
+
|
|
110
|
+
1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
|
|
111
|
+
```bash
|
|
112
|
+
export CODICENT_TOKEN="YOUR_API_TOKEN"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Command Options
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
codicent [OPTIONS] [QUESTION]
|
|
119
|
+
|
|
120
|
+
OPTIONS:
|
|
121
|
+
-t, --interactive Start interactive chat mode
|
|
122
|
+
-h, --help Show help message
|
|
123
|
+
-v, --version Show version information
|
|
124
|
+
--verbose Enable verbose logging
|
|
125
|
+
--quiet Suppress non-essential output
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Examples
|
|
129
|
+
|
|
130
|
+
**One-shot questions:**
|
|
131
|
+
```bash
|
|
132
|
+
codicent "What can you help me with?"
|
|
133
|
+
codicent "Explain Python decorators"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Interactive mode:**
|
|
137
|
+
```bash
|
|
138
|
+
codicent -t
|
|
139
|
+
# or
|
|
140
|
+
codicent --interactive
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Piped input:**
|
|
144
|
+
```bash
|
|
145
|
+
echo "What is machine learning?" | codicent
|
|
146
|
+
codicent < questions.txt
|
|
147
|
+
cat code.py | codicent "Review this code"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Info messages (@ prefix):**
|
|
151
|
+
```bash
|
|
152
|
+
codicent "@mention This is an info message"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**With logging:**
|
|
156
|
+
```bash
|
|
157
|
+
codicent --verbose "Debug this issue"
|
|
158
|
+
codicent --quiet "Silent operation"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Interactive Mode
|
|
162
|
+
|
|
163
|
+
In interactive mode, you can have ongoing conversations with enhanced visual clarity:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
$ codicent -t
|
|
167
|
+
🤖 Codicent CLI Interactive Mode
|
|
168
|
+
Type your questions or use Ctrl+C to exit.
|
|
169
|
+
Prefix with @ for info messages.
|
|
170
|
+
──────────────────────────────────────────────────
|
|
171
|
+
¤ What is Python?
|
|
172
|
+
|
|
173
|
+
Python is a high-level, interpreted programming language known for its
|
|
174
|
+
simplicity and readability. It was created by Guido van Rossum and first
|
|
175
|
+
released in 1991.
|
|
176
|
+
|
|
177
|
+
Key features:
|
|
178
|
+
• Easy to learn and use
|
|
179
|
+
• Extensive standard library
|
|
180
|
+
• Cross-platform compatibility
|
|
181
|
+
• Strong community support
|
|
182
|
+
──────────────────────────────────────────────────
|
|
183
|
+
¤ Can you give me an example?
|
|
184
|
+
|
|
185
|
+
Here's a simple Python example:
|
|
186
|
+
|
|
187
|
+
# Hello World in Python
|
|
188
|
+
print("Hello, World!")
|
|
189
|
+
|
|
190
|
+
# Working with variables
|
|
191
|
+
name = "Alice"
|
|
192
|
+
age = 25
|
|
193
|
+
print(f"My name is {name} and I am {age} years old.")
|
|
194
|
+
|
|
195
|
+
Python's syntax is clean and intuitive!
|
|
196
|
+
──────────────────────────────────────────────────
|
|
197
|
+
¤ @mention Save this conversation
|
|
198
|
+
✅ Message posted successfully.
|
|
199
|
+
──────────────────────────────────────────────────
|
|
200
|
+
¤ ^C
|
|
201
|
+
👋 Goodbye!
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Visual Features:**
|
|
205
|
+
- **Colored messages**: User input appears in cyan, bot responses in green
|
|
206
|
+
- **Clean prompting**: Original `¤` prompt character maintained
|
|
207
|
+
- **Visual separators**: Clear lines between conversations
|
|
208
|
+
- **Rich formatting**: Markdown responses with syntax highlighting
|
|
209
|
+
- **Status indicators**: Animated thinking indicators and success messages
|
|
210
|
+
- **Emojis**: Friendly visual cues throughout the interface
|
|
211
|
+
|
|
212
|
+
## Error Handling
|
|
213
|
+
|
|
214
|
+
The CLI provides helpful error messages for common issues:
|
|
215
|
+
|
|
216
|
+
- **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
|
|
217
|
+
- **Network errors**: Graceful handling of connection issues
|
|
218
|
+
- **API errors**: Detailed error messages from the Codicent API
|
|
219
|
+
- **Input validation**: Prevents empty or overly long inputs
|
|
220
|
+
- **Keyboard interrupts**: Clean exit handling
|
|
221
|
+
|
|
222
|
+
## Development
|
|
223
|
+
|
|
224
|
+
### Running Tests
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
python -m pytest test_app.py -v
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Project Structure
|
|
231
|
+
|
|
232
|
+
- `app.py` - Main application logic (single-file architecture)
|
|
233
|
+
- `test_app.py` - Comprehensive test suite
|
|
234
|
+
- `setup.py` - Package configuration
|
|
235
|
+
- `requirements.txt` - Dependencies including git packages
|
|
236
|
+
|
|
237
|
+
### Dependencies
|
|
238
|
+
|
|
239
|
+
- **codicentpy**: Core API client for Codicent services
|
|
240
|
+
- **rich**: Terminal formatting, markdown rendering, and animations
|
|
241
|
+
|
|
242
|
+
## Troubleshooting
|
|
243
|
+
|
|
244
|
+
### Common Issues
|
|
245
|
+
|
|
246
|
+
1. **"CODICENT_TOKEN environment variable is not set"**
|
|
247
|
+
- Set the token: `export CODICENT_TOKEN="your_token"`
|
|
248
|
+
- Verify it's set: `echo $CODICENT_TOKEN`
|
|
249
|
+
|
|
250
|
+
2. **"Network error: Unable to connect to Codicent API"**
|
|
251
|
+
- Check your internet connection
|
|
252
|
+
- Verify the Codicent API is accessible
|
|
253
|
+
- Try again with `--verbose` for more details
|
|
254
|
+
|
|
255
|
+
3. **"Failed to initialize Codicent API client"**
|
|
256
|
+
- Verify your token is valid
|
|
257
|
+
- Check if the codicentpy package is properly installed
|
|
258
|
+
|
|
259
|
+
### Getting Help
|
|
260
|
+
|
|
261
|
+
- Use `codicent --help` for usage information
|
|
262
|
+
- Use `codicent --verbose` for detailed logging
|
|
263
|
+
- Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Codicent CLI
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **One-shot mode**: Execute single commands and get responses
|
|
8
|
+
- **Interactive mode**: Continuous chat sessions with conversation tracking
|
|
9
|
+
- **Message types**: Support for regular chat and @-prefixed info messages
|
|
10
|
+
- **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
|
|
11
|
+
- **Rich output**: Markdown-formatted responses with beautiful terminal UI
|
|
12
|
+
- **Error handling**: Comprehensive error messages and graceful failure handling
|
|
13
|
+
- **Logging**: Configurable logging levels for debugging
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### Prerequisites
|
|
18
|
+
|
|
19
|
+
- Python 3.6 or higher
|
|
20
|
+
- `pip` (Python package installer)
|
|
21
|
+
|
|
22
|
+
### Quick Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install both dependencies with one command
|
|
26
|
+
pip install git+https://github.com/izaxon/codicent-py.git git+https://github.com/izaxon/codicent-cli.git@v0.4.3
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Development Installation
|
|
30
|
+
|
|
31
|
+
#### Steps
|
|
32
|
+
|
|
33
|
+
1. Clone the repository:
|
|
34
|
+
```bash
|
|
35
|
+
git clone https://github.com/izaxon/codicent-cli.git
|
|
36
|
+
cd codicent-cli
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. Install the Git dependency:
|
|
40
|
+
```bash
|
|
41
|
+
pip install git+https://github.com/izaxon/codicent-py.git
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. Install the CLI application:
|
|
45
|
+
```bash
|
|
46
|
+
pip install .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For development mode:
|
|
50
|
+
```bash
|
|
51
|
+
pip install -e .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Direct Installation from GitHub
|
|
55
|
+
|
|
56
|
+
You can also install directly from GitHub without cloning:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Install the latest release
|
|
60
|
+
pip install git+https://github.com/izaxon/codicent-py.git
|
|
61
|
+
pip install git+https://github.com/izaxon/codicent-cli.git
|
|
62
|
+
|
|
63
|
+
# Install a specific version
|
|
64
|
+
pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.3
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
### Basic Setup
|
|
70
|
+
|
|
71
|
+
1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
|
|
72
|
+
```bash
|
|
73
|
+
export CODICENT_TOKEN="YOUR_API_TOKEN"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Command Options
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
codicent [OPTIONS] [QUESTION]
|
|
80
|
+
|
|
81
|
+
OPTIONS:
|
|
82
|
+
-t, --interactive Start interactive chat mode
|
|
83
|
+
-h, --help Show help message
|
|
84
|
+
-v, --version Show version information
|
|
85
|
+
--verbose Enable verbose logging
|
|
86
|
+
--quiet Suppress non-essential output
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Examples
|
|
90
|
+
|
|
91
|
+
**One-shot questions:**
|
|
92
|
+
```bash
|
|
93
|
+
codicent "What can you help me with?"
|
|
94
|
+
codicent "Explain Python decorators"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Interactive mode:**
|
|
98
|
+
```bash
|
|
99
|
+
codicent -t
|
|
100
|
+
# or
|
|
101
|
+
codicent --interactive
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Piped input:**
|
|
105
|
+
```bash
|
|
106
|
+
echo "What is machine learning?" | codicent
|
|
107
|
+
codicent < questions.txt
|
|
108
|
+
cat code.py | codicent "Review this code"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Info messages (@ prefix):**
|
|
112
|
+
```bash
|
|
113
|
+
codicent "@mention This is an info message"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**With logging:**
|
|
117
|
+
```bash
|
|
118
|
+
codicent --verbose "Debug this issue"
|
|
119
|
+
codicent --quiet "Silent operation"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Interactive Mode
|
|
123
|
+
|
|
124
|
+
In interactive mode, you can have ongoing conversations with enhanced visual clarity:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
$ codicent -t
|
|
128
|
+
🤖 Codicent CLI Interactive Mode
|
|
129
|
+
Type your questions or use Ctrl+C to exit.
|
|
130
|
+
Prefix with @ for info messages.
|
|
131
|
+
──────────────────────────────────────────────────
|
|
132
|
+
¤ What is Python?
|
|
133
|
+
|
|
134
|
+
Python is a high-level, interpreted programming language known for its
|
|
135
|
+
simplicity and readability. It was created by Guido van Rossum and first
|
|
136
|
+
released in 1991.
|
|
137
|
+
|
|
138
|
+
Key features:
|
|
139
|
+
• Easy to learn and use
|
|
140
|
+
• Extensive standard library
|
|
141
|
+
• Cross-platform compatibility
|
|
142
|
+
• Strong community support
|
|
143
|
+
──────────────────────────────────────────────────
|
|
144
|
+
¤ Can you give me an example?
|
|
145
|
+
|
|
146
|
+
Here's a simple Python example:
|
|
147
|
+
|
|
148
|
+
# Hello World in Python
|
|
149
|
+
print("Hello, World!")
|
|
150
|
+
|
|
151
|
+
# Working with variables
|
|
152
|
+
name = "Alice"
|
|
153
|
+
age = 25
|
|
154
|
+
print(f"My name is {name} and I am {age} years old.")
|
|
155
|
+
|
|
156
|
+
Python's syntax is clean and intuitive!
|
|
157
|
+
──────────────────────────────────────────────────
|
|
158
|
+
¤ @mention Save this conversation
|
|
159
|
+
✅ Message posted successfully.
|
|
160
|
+
──────────────────────────────────────────────────
|
|
161
|
+
¤ ^C
|
|
162
|
+
👋 Goodbye!
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Visual Features:**
|
|
166
|
+
- **Colored messages**: User input appears in cyan, bot responses in green
|
|
167
|
+
- **Clean prompting**: Original `¤` prompt character maintained
|
|
168
|
+
- **Visual separators**: Clear lines between conversations
|
|
169
|
+
- **Rich formatting**: Markdown responses with syntax highlighting
|
|
170
|
+
- **Status indicators**: Animated thinking indicators and success messages
|
|
171
|
+
- **Emojis**: Friendly visual cues throughout the interface
|
|
172
|
+
|
|
173
|
+
## Error Handling
|
|
174
|
+
|
|
175
|
+
The CLI provides helpful error messages for common issues:
|
|
176
|
+
|
|
177
|
+
- **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
|
|
178
|
+
- **Network errors**: Graceful handling of connection issues
|
|
179
|
+
- **API errors**: Detailed error messages from the Codicent API
|
|
180
|
+
- **Input validation**: Prevents empty or overly long inputs
|
|
181
|
+
- **Keyboard interrupts**: Clean exit handling
|
|
182
|
+
|
|
183
|
+
## Development
|
|
184
|
+
|
|
185
|
+
### Running Tests
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
python -m pytest test_app.py -v
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Project Structure
|
|
192
|
+
|
|
193
|
+
- `app.py` - Main application logic (single-file architecture)
|
|
194
|
+
- `test_app.py` - Comprehensive test suite
|
|
195
|
+
- `setup.py` - Package configuration
|
|
196
|
+
- `requirements.txt` - Dependencies including git packages
|
|
197
|
+
|
|
198
|
+
### Dependencies
|
|
199
|
+
|
|
200
|
+
- **codicentpy**: Core API client for Codicent services
|
|
201
|
+
- **rich**: Terminal formatting, markdown rendering, and animations
|
|
202
|
+
|
|
203
|
+
## Troubleshooting
|
|
204
|
+
|
|
205
|
+
### Common Issues
|
|
206
|
+
|
|
207
|
+
1. **"CODICENT_TOKEN environment variable is not set"**
|
|
208
|
+
- Set the token: `export CODICENT_TOKEN="your_token"`
|
|
209
|
+
- Verify it's set: `echo $CODICENT_TOKEN`
|
|
210
|
+
|
|
211
|
+
2. **"Network error: Unable to connect to Codicent API"**
|
|
212
|
+
- Check your internet connection
|
|
213
|
+
- Verify the Codicent API is accessible
|
|
214
|
+
- Try again with `--verbose` for more details
|
|
215
|
+
|
|
216
|
+
3. **"Failed to initialize Codicent API client"**
|
|
217
|
+
- Verify your token is valid
|
|
218
|
+
- Check if the codicentpy package is properly installed
|
|
219
|
+
|
|
220
|
+
### Getting Help
|
|
221
|
+
|
|
222
|
+
- Use `codicent --help` for usage information
|
|
223
|
+
- Use `codicent --verbose` for detailed logging
|
|
224
|
+
- Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import os
|
|
3
|
+
import logging
|
|
4
|
+
from codicentpy import Codicent
|
|
5
|
+
from rich.console import Console
|
|
6
|
+
from rich.markdown import Markdown
|
|
7
|
+
|
|
8
|
+
# Configure logging
|
|
9
|
+
logging.basicConfig(level=logging.WARNING, format='%(levelname)s: %(message)s')
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
def show_help():
|
|
13
|
+
"""Display help information."""
|
|
14
|
+
help_text = """
|
|
15
|
+
Codicent CLI - Command-line interface for the Codicent API
|
|
16
|
+
|
|
17
|
+
USAGE:
|
|
18
|
+
codicent [OPTIONS] [QUESTION]
|
|
19
|
+
codicent [OPTIONS] < file.txt
|
|
20
|
+
echo "question" | codicent [OPTIONS]
|
|
21
|
+
|
|
22
|
+
OPTIONS:
|
|
23
|
+
-t, --interactive Start interactive chat mode
|
|
24
|
+
-h, --help Show this help message
|
|
25
|
+
-v, --version Show version information
|
|
26
|
+
--verbose Enable verbose logging
|
|
27
|
+
--quiet Suppress non-essential output
|
|
28
|
+
|
|
29
|
+
EXAMPLES:
|
|
30
|
+
codicent "What is Python?"
|
|
31
|
+
codicent -t
|
|
32
|
+
codicent "@mention Hello there"
|
|
33
|
+
echo "Help me debug this" | codicent
|
|
34
|
+
|
|
35
|
+
ENVIRONMENT:
|
|
36
|
+
CODICENT_TOKEN Your Codicent API token (required)
|
|
37
|
+
|
|
38
|
+
For more information, visit: https://github.com/izaxon/codicent-cli
|
|
39
|
+
"""
|
|
40
|
+
print(help_text.strip())
|
|
41
|
+
|
|
42
|
+
def show_version():
|
|
43
|
+
"""Display version information."""
|
|
44
|
+
print("Codicent CLI v0.4.3")
|
|
45
|
+
|
|
46
|
+
def validate_input(question):
|
|
47
|
+
"""Validate user input."""
|
|
48
|
+
if not question or not question.strip():
|
|
49
|
+
return False, "Empty question provided"
|
|
50
|
+
|
|
51
|
+
if len(question) > 10000: # Reasonable limit
|
|
52
|
+
return False, "Question too long (max 10,000 characters)"
|
|
53
|
+
|
|
54
|
+
return True, None
|
|
55
|
+
|
|
56
|
+
def main():
|
|
57
|
+
# Parse command line arguments
|
|
58
|
+
if "-h" in sys.argv or "--help" in sys.argv:
|
|
59
|
+
show_help()
|
|
60
|
+
return 0
|
|
61
|
+
|
|
62
|
+
if "-v" in sys.argv or "--version" in sys.argv:
|
|
63
|
+
show_version()
|
|
64
|
+
return 0
|
|
65
|
+
|
|
66
|
+
# Set logging level based on flags
|
|
67
|
+
if "--verbose" in sys.argv:
|
|
68
|
+
logging.getLogger().setLevel(logging.INFO)
|
|
69
|
+
sys.argv.remove("--verbose")
|
|
70
|
+
logger.info("Verbose logging enabled")
|
|
71
|
+
|
|
72
|
+
if "--quiet" in sys.argv:
|
|
73
|
+
logging.getLogger().setLevel(logging.ERROR)
|
|
74
|
+
sys.argv.remove("--quiet")
|
|
75
|
+
|
|
76
|
+
# Validate environment
|
|
77
|
+
token = os.getenv("CODICENT_TOKEN")
|
|
78
|
+
if not token:
|
|
79
|
+
print("Error: CODICENT_TOKEN environment variable is not set.")
|
|
80
|
+
print("Please set it with your Codicent API token:")
|
|
81
|
+
print(" export CODICENT_TOKEN='your_token_here'")
|
|
82
|
+
print("Or visit the Codicent documentation for setup instructions.")
|
|
83
|
+
return 1
|
|
84
|
+
|
|
85
|
+
# Initialize API client with error handling
|
|
86
|
+
try:
|
|
87
|
+
codicent = Codicent(token)
|
|
88
|
+
logger.info("Codicent API client initialized successfully")
|
|
89
|
+
except Exception as e:
|
|
90
|
+
print(f"Error: Failed to initialize Codicent API client: {e}")
|
|
91
|
+
logger.error(f"API client initialization failed: {e}")
|
|
92
|
+
return 1
|
|
93
|
+
|
|
94
|
+
conversationId = None
|
|
95
|
+
|
|
96
|
+
# Parse interactive mode flags
|
|
97
|
+
interactive = False
|
|
98
|
+
if "-t" in sys.argv or "--interactive" in sys.argv:
|
|
99
|
+
interactive = True
|
|
100
|
+
if "-t" in sys.argv:
|
|
101
|
+
sys.argv.remove("-t")
|
|
102
|
+
if "--interactive" in sys.argv:
|
|
103
|
+
sys.argv.remove("--interactive")
|
|
104
|
+
elif len(sys.argv) == 1:
|
|
105
|
+
interactive = True
|
|
106
|
+
|
|
107
|
+
# Get input based on mode
|
|
108
|
+
if not interactive:
|
|
109
|
+
if len(sys.argv) < 2:
|
|
110
|
+
if sys.stdin.isatty():
|
|
111
|
+
print("Usage: codicent <question> or codicent < chat.txt or cat chat.txt | codicent or codicent (equal to codicent -t)")
|
|
112
|
+
print("Use 'codicent --help' for more information.")
|
|
113
|
+
return 1
|
|
114
|
+
try:
|
|
115
|
+
question = sys.stdin.read().strip()
|
|
116
|
+
except (KeyboardInterrupt, EOFError):
|
|
117
|
+
return 1
|
|
118
|
+
else:
|
|
119
|
+
question = " ".join(sys.argv[1:])
|
|
120
|
+
else:
|
|
121
|
+
if len(sys.argv) > 1:
|
|
122
|
+
question = " ".join(sys.argv[1:])
|
|
123
|
+
elif not sys.stdin.isatty():
|
|
124
|
+
try:
|
|
125
|
+
question = sys.stdin.read().strip()
|
|
126
|
+
except (KeyboardInterrupt, EOFError):
|
|
127
|
+
return 1
|
|
128
|
+
else:
|
|
129
|
+
question = ""
|
|
130
|
+
|
|
131
|
+
def handle_question(question):
|
|
132
|
+
nonlocal conversationId
|
|
133
|
+
|
|
134
|
+
# Validate input
|
|
135
|
+
is_valid, error_msg = validate_input(question)
|
|
136
|
+
if not is_valid:
|
|
137
|
+
print(f"Error: {error_msg}")
|
|
138
|
+
logger.warning(f"Invalid input: {error_msg}")
|
|
139
|
+
return False
|
|
140
|
+
|
|
141
|
+
console = Console()
|
|
142
|
+
|
|
143
|
+
# Show user message in cyan color for interactive mode
|
|
144
|
+
if interactive:
|
|
145
|
+
console.print(f"[cyan]{question}[/cyan]")
|
|
146
|
+
|
|
147
|
+
try:
|
|
148
|
+
if question.strip().startswith("@"):
|
|
149
|
+
logger.info("Sending message to Codicent API")
|
|
150
|
+
with console.status("[dim]Sending message...[/dim]", spinner="dots"):
|
|
151
|
+
response = codicent.post_message(question, type="info")
|
|
152
|
+
console.print("[green]✅ Message posted successfully.[/green]")
|
|
153
|
+
else:
|
|
154
|
+
logger.info("Sending chat reply to Codicent API")
|
|
155
|
+
with console.status("[dim]🤔 Thinking...[/dim]", spinner="dots"):
|
|
156
|
+
response = codicent.post_chat_reply(question, conversationId)
|
|
157
|
+
conversationId = response["id"]
|
|
158
|
+
logger.info(f"Updated conversation ID: {conversationId}")
|
|
159
|
+
|
|
160
|
+
# Show bot response with markdown formatting in green
|
|
161
|
+
if interactive:
|
|
162
|
+
console.print()
|
|
163
|
+
|
|
164
|
+
# Create markdown with green styling
|
|
165
|
+
from rich.text import Text
|
|
166
|
+
markdown_content = Markdown(response["content"])
|
|
167
|
+
console.print(markdown_content, style="green")
|
|
168
|
+
console.print()
|
|
169
|
+
|
|
170
|
+
return True
|
|
171
|
+
|
|
172
|
+
except KeyboardInterrupt:
|
|
173
|
+
console.print("\n[yellow]Operation cancelled by user[/yellow]")
|
|
174
|
+
return False
|
|
175
|
+
except ConnectionError as e:
|
|
176
|
+
console.print(f"[red]Network error: Unable to connect to Codicent API[/red]")
|
|
177
|
+
logger.error(f"Connection error: {e}")
|
|
178
|
+
return False
|
|
179
|
+
except Exception as e:
|
|
180
|
+
console.print(f"[red]API error: {e}[/red]")
|
|
181
|
+
logger.error(f"API call failed: {e}")
|
|
182
|
+
return False
|
|
183
|
+
|
|
184
|
+
# Handle initial question if provided
|
|
185
|
+
if question != "":
|
|
186
|
+
success = handle_question(question)
|
|
187
|
+
if not success and not interactive:
|
|
188
|
+
return 1
|
|
189
|
+
|
|
190
|
+
# Interactive mode loop
|
|
191
|
+
if interactive:
|
|
192
|
+
console = Console()
|
|
193
|
+
console.print("\n[bold green]🤖 Codicent CLI Interactive Mode[/bold green]")
|
|
194
|
+
console.print("[dim]Type your questions or use Ctrl+C to exit.[/dim]")
|
|
195
|
+
console.print("[dim]Prefix with @ for info messages.[/dim]")
|
|
196
|
+
console.print("─" * 50)
|
|
197
|
+
|
|
198
|
+
while True:
|
|
199
|
+
try:
|
|
200
|
+
question = input("¤ ")
|
|
201
|
+
except KeyboardInterrupt:
|
|
202
|
+
console.print("\n[yellow]👋 Goodbye![/yellow]")
|
|
203
|
+
break
|
|
204
|
+
except EOFError:
|
|
205
|
+
break
|
|
206
|
+
|
|
207
|
+
if question.strip() != "":
|
|
208
|
+
handle_question(question)
|
|
209
|
+
# Add a separator line after each interaction
|
|
210
|
+
if question.strip() != "" and not question.strip().startswith("@"):
|
|
211
|
+
console.print("[dim]" + "─" * 50 + "[/dim]")
|
|
212
|
+
|
|
213
|
+
return 0
|
|
214
|
+
|
|
215
|
+
if __name__ == "__main__":
|
|
216
|
+
sys.exit(main())
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codicent-cli
|
|
3
|
+
Version: 0.4.3
|
|
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
|
+
Dynamic: author
|
|
28
|
+
Dynamic: author-email
|
|
29
|
+
Dynamic: classifier
|
|
30
|
+
Dynamic: description
|
|
31
|
+
Dynamic: description-content-type
|
|
32
|
+
Dynamic: home-page
|
|
33
|
+
Dynamic: keywords
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
Dynamic: project-url
|
|
36
|
+
Dynamic: requires-dist
|
|
37
|
+
Dynamic: requires-python
|
|
38
|
+
Dynamic: summary
|
|
39
|
+
|
|
40
|
+
# Codicent CLI
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- **One-shot mode**: Execute single commands and get responses
|
|
47
|
+
- **Interactive mode**: Continuous chat sessions with conversation tracking
|
|
48
|
+
- **Message types**: Support for regular chat and @-prefixed info messages
|
|
49
|
+
- **Input flexibility**: Command arguments, stdin pipes, or interactive prompts
|
|
50
|
+
- **Rich output**: Markdown-formatted responses with beautiful terminal UI
|
|
51
|
+
- **Error handling**: Comprehensive error messages and graceful failure handling
|
|
52
|
+
- **Logging**: Configurable logging levels for debugging
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Prerequisites
|
|
57
|
+
|
|
58
|
+
- Python 3.6 or higher
|
|
59
|
+
- `pip` (Python package installer)
|
|
60
|
+
|
|
61
|
+
### Quick Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Install both dependencies with one command
|
|
65
|
+
pip install git+https://github.com/izaxon/codicent-py.git git+https://github.com/izaxon/codicent-cli.git@v0.4.3
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Development Installation
|
|
69
|
+
|
|
70
|
+
#### Steps
|
|
71
|
+
|
|
72
|
+
1. Clone the repository:
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://github.com/izaxon/codicent-cli.git
|
|
75
|
+
cd codicent-cli
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
2. Install the Git dependency:
|
|
79
|
+
```bash
|
|
80
|
+
pip install git+https://github.com/izaxon/codicent-py.git
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
3. Install the CLI application:
|
|
84
|
+
```bash
|
|
85
|
+
pip install .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For development mode:
|
|
89
|
+
```bash
|
|
90
|
+
pip install -e .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Direct Installation from GitHub
|
|
94
|
+
|
|
95
|
+
You can also install directly from GitHub without cloning:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Install the latest release
|
|
99
|
+
pip install git+https://github.com/izaxon/codicent-py.git
|
|
100
|
+
pip install git+https://github.com/izaxon/codicent-cli.git
|
|
101
|
+
|
|
102
|
+
# Install a specific version
|
|
103
|
+
pip install git+https://github.com/izaxon/codicent-cli.git@v0.4.3
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Usage
|
|
107
|
+
|
|
108
|
+
### Basic Setup
|
|
109
|
+
|
|
110
|
+
1. Set the `CODICENT_TOKEN` environment variable with your Codicent API token:
|
|
111
|
+
```bash
|
|
112
|
+
export CODICENT_TOKEN="YOUR_API_TOKEN"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Command Options
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
codicent [OPTIONS] [QUESTION]
|
|
119
|
+
|
|
120
|
+
OPTIONS:
|
|
121
|
+
-t, --interactive Start interactive chat mode
|
|
122
|
+
-h, --help Show help message
|
|
123
|
+
-v, --version Show version information
|
|
124
|
+
--verbose Enable verbose logging
|
|
125
|
+
--quiet Suppress non-essential output
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Examples
|
|
129
|
+
|
|
130
|
+
**One-shot questions:**
|
|
131
|
+
```bash
|
|
132
|
+
codicent "What can you help me with?"
|
|
133
|
+
codicent "Explain Python decorators"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Interactive mode:**
|
|
137
|
+
```bash
|
|
138
|
+
codicent -t
|
|
139
|
+
# or
|
|
140
|
+
codicent --interactive
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Piped input:**
|
|
144
|
+
```bash
|
|
145
|
+
echo "What is machine learning?" | codicent
|
|
146
|
+
codicent < questions.txt
|
|
147
|
+
cat code.py | codicent "Review this code"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Info messages (@ prefix):**
|
|
151
|
+
```bash
|
|
152
|
+
codicent "@mention This is an info message"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**With logging:**
|
|
156
|
+
```bash
|
|
157
|
+
codicent --verbose "Debug this issue"
|
|
158
|
+
codicent --quiet "Silent operation"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Interactive Mode
|
|
162
|
+
|
|
163
|
+
In interactive mode, you can have ongoing conversations with enhanced visual clarity:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
$ codicent -t
|
|
167
|
+
🤖 Codicent CLI Interactive Mode
|
|
168
|
+
Type your questions or use Ctrl+C to exit.
|
|
169
|
+
Prefix with @ for info messages.
|
|
170
|
+
──────────────────────────────────────────────────
|
|
171
|
+
¤ What is Python?
|
|
172
|
+
|
|
173
|
+
Python is a high-level, interpreted programming language known for its
|
|
174
|
+
simplicity and readability. It was created by Guido van Rossum and first
|
|
175
|
+
released in 1991.
|
|
176
|
+
|
|
177
|
+
Key features:
|
|
178
|
+
• Easy to learn and use
|
|
179
|
+
• Extensive standard library
|
|
180
|
+
• Cross-platform compatibility
|
|
181
|
+
• Strong community support
|
|
182
|
+
──────────────────────────────────────────────────
|
|
183
|
+
¤ Can you give me an example?
|
|
184
|
+
|
|
185
|
+
Here's a simple Python example:
|
|
186
|
+
|
|
187
|
+
# Hello World in Python
|
|
188
|
+
print("Hello, World!")
|
|
189
|
+
|
|
190
|
+
# Working with variables
|
|
191
|
+
name = "Alice"
|
|
192
|
+
age = 25
|
|
193
|
+
print(f"My name is {name} and I am {age} years old.")
|
|
194
|
+
|
|
195
|
+
Python's syntax is clean and intuitive!
|
|
196
|
+
──────────────────────────────────────────────────
|
|
197
|
+
¤ @mention Save this conversation
|
|
198
|
+
✅ Message posted successfully.
|
|
199
|
+
──────────────────────────────────────────────────
|
|
200
|
+
¤ ^C
|
|
201
|
+
👋 Goodbye!
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Visual Features:**
|
|
205
|
+
- **Colored messages**: User input appears in cyan, bot responses in green
|
|
206
|
+
- **Clean prompting**: Original `¤` prompt character maintained
|
|
207
|
+
- **Visual separators**: Clear lines between conversations
|
|
208
|
+
- **Rich formatting**: Markdown responses with syntax highlighting
|
|
209
|
+
- **Status indicators**: Animated thinking indicators and success messages
|
|
210
|
+
- **Emojis**: Friendly visual cues throughout the interface
|
|
211
|
+
|
|
212
|
+
## Error Handling
|
|
213
|
+
|
|
214
|
+
The CLI provides helpful error messages for common issues:
|
|
215
|
+
|
|
216
|
+
- **Missing token**: Clear instructions on setting up `CODICENT_TOKEN`
|
|
217
|
+
- **Network errors**: Graceful handling of connection issues
|
|
218
|
+
- **API errors**: Detailed error messages from the Codicent API
|
|
219
|
+
- **Input validation**: Prevents empty or overly long inputs
|
|
220
|
+
- **Keyboard interrupts**: Clean exit handling
|
|
221
|
+
|
|
222
|
+
## Development
|
|
223
|
+
|
|
224
|
+
### Running Tests
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
python -m pytest test_app.py -v
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Project Structure
|
|
231
|
+
|
|
232
|
+
- `app.py` - Main application logic (single-file architecture)
|
|
233
|
+
- `test_app.py` - Comprehensive test suite
|
|
234
|
+
- `setup.py` - Package configuration
|
|
235
|
+
- `requirements.txt` - Dependencies including git packages
|
|
236
|
+
|
|
237
|
+
### Dependencies
|
|
238
|
+
|
|
239
|
+
- **codicentpy**: Core API client for Codicent services
|
|
240
|
+
- **rich**: Terminal formatting, markdown rendering, and animations
|
|
241
|
+
|
|
242
|
+
## Troubleshooting
|
|
243
|
+
|
|
244
|
+
### Common Issues
|
|
245
|
+
|
|
246
|
+
1. **"CODICENT_TOKEN environment variable is not set"**
|
|
247
|
+
- Set the token: `export CODICENT_TOKEN="your_token"`
|
|
248
|
+
- Verify it's set: `echo $CODICENT_TOKEN`
|
|
249
|
+
|
|
250
|
+
2. **"Network error: Unable to connect to Codicent API"**
|
|
251
|
+
- Check your internet connection
|
|
252
|
+
- Verify the Codicent API is accessible
|
|
253
|
+
- Try again with `--verbose` for more details
|
|
254
|
+
|
|
255
|
+
3. **"Failed to initialize Codicent API client"**
|
|
256
|
+
- Verify your token is valid
|
|
257
|
+
- Check if the codicentpy package is properly installed
|
|
258
|
+
|
|
259
|
+
### Getting Help
|
|
260
|
+
|
|
261
|
+
- Use `codicent --help` for usage information
|
|
262
|
+
- Use `codicent --verbose` for detailed logging
|
|
263
|
+
- Check the [Codicent documentation](https://github.com/izaxon/codicent-py) for API details
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
app.py
|
|
4
|
+
setup.py
|
|
5
|
+
codicent_cli.egg-info/PKG-INFO
|
|
6
|
+
codicent_cli.egg-info/SOURCES.txt
|
|
7
|
+
codicent_cli.egg-info/dependency_links.txt
|
|
8
|
+
codicent_cli.egg-info/entry_points.txt
|
|
9
|
+
codicent_cli.egg-info/requires.txt
|
|
10
|
+
codicent_cli.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rich
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
app
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
# Read README for long description
|
|
4
|
+
try:
|
|
5
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
6
|
+
long_description = fh.read()
|
|
7
|
+
except FileNotFoundError:
|
|
8
|
+
long_description = "Command-line interface for the Codicent API"
|
|
9
|
+
|
|
10
|
+
setup(
|
|
11
|
+
name='codicent-cli',
|
|
12
|
+
version='0.4.3',
|
|
13
|
+
author='Johan Isaksson',
|
|
14
|
+
author_email='johan@izaxon.com',
|
|
15
|
+
description='Command-line interface for the Codicent API',
|
|
16
|
+
long_description=long_description,
|
|
17
|
+
long_description_content_type="text/markdown",
|
|
18
|
+
url='https://github.com/izaxon/codicent-cli',
|
|
19
|
+
project_urls={
|
|
20
|
+
'Bug Reports': 'https://github.com/izaxon/codicent-cli/issues',
|
|
21
|
+
'Source': 'https://github.com/izaxon/codicent-cli',
|
|
22
|
+
},
|
|
23
|
+
classifiers=[
|
|
24
|
+
'Development Status :: 4 - Beta',
|
|
25
|
+
'Intended Audience :: Developers',
|
|
26
|
+
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
27
|
+
'License :: OSI Approved :: MIT License',
|
|
28
|
+
'Programming Language :: Python :: 3',
|
|
29
|
+
'Programming Language :: Python :: 3.6',
|
|
30
|
+
'Programming Language :: Python :: 3.7',
|
|
31
|
+
'Programming Language :: Python :: 3.8',
|
|
32
|
+
'Programming Language :: Python :: 3.9',
|
|
33
|
+
'Programming Language :: Python :: 3.10',
|
|
34
|
+
'Programming Language :: Python :: 3.11',
|
|
35
|
+
'Programming Language :: Python :: 3.12',
|
|
36
|
+
],
|
|
37
|
+
keywords='codicent cli api chat ai',
|
|
38
|
+
py_modules=['app'],
|
|
39
|
+
python_requires='>=3.6',
|
|
40
|
+
install_requires=[
|
|
41
|
+
'rich',
|
|
42
|
+
# Note: codicentpy must be installed separately from GitHub
|
|
43
|
+
],
|
|
44
|
+
entry_points={
|
|
45
|
+
'console_scripts': [
|
|
46
|
+
'codicent=app:main',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
)
|