codemate-cli 1.0.0__py3-none-any.whl

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.
@@ -0,0 +1,452 @@
1
+ Metadata-Version: 2.4
2
+ Name: codemate-cli
3
+ Version: 1.0.0
4
+ Summary: AI-powered CLI assistant with rich streaming interface
5
+ Home-page: https://codemate.ai/
6
+ Author: Codemate.ai
7
+ Author-email: "Codemate.ai" <developers.codemate@gmail.com>
8
+ Project-URL: Homepage, https://codemate.ai/
9
+ Project-URL: Documentation, https://docs.codemate.ai/
10
+ Keywords: cli,ai,assistant,llm
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: rich>=13.7.0
23
+ Requires-Dist: click>=8.1.0
24
+ Requires-Dist: httpx>=0.25.0
25
+ Requires-Dist: pydantic>=2.5.0
26
+ Requires-Dist: python-dotenv>=1.0.0
27
+ Requires-Dist: prompt-toolkit>=3.0.43
28
+ Requires-Dist: pygments>=2.17.0
29
+ Requires-Dist: python-socketio>=5.8.0
30
+ Requires-Dist: aiohttp>=3.8.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
33
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
34
+ Requires-Dist: black>=23.0.0; extra == "dev"
35
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
36
+ Dynamic: author
37
+ Dynamic: home-page
38
+ Dynamic: license-file
39
+ Dynamic: requires-python
40
+
41
+ # 🚀 CodeMate CLI
42
+
43
+ AI-powered command-line assistant with beautiful streaming responses and rich markdown formatting.
44
+
45
+ ![Version](https://img.shields.io/badge/version-1.0.0-blue)
46
+ ![Python](https://img.shields.io/badge/python-3.8+-green)
47
+ ![License](https://img.shields.io/badge/license-MIT-blue)
48
+
49
+ ## ✨ Features
50
+
51
+ - 🎨 **Rich Terminal UI** - Beautiful, colorful interface with syntax highlighting
52
+ - 📝 **Markdown Rendering** - Real-time markdown formatting in your terminal
53
+ - 🌊 **Streaming Responses** - See responses as they're generated
54
+ - 💬 **Interactive Mode** - Maintain conversation context across multiple messages
55
+ - 🔧 **Cross-Platform** - Works on macOS, Linux, and Windows
56
+ - ⚡ **Fast & Efficient** - Minimal latency with async streaming
57
+ - 🔐 **Secure** - API keys stored safely in your local config
58
+
59
+ ## 📦 Installation
60
+
61
+ ### Using pip (Recommended)
62
+
63
+ ```bash
64
+ pip install codemate-cli
65
+ ```
66
+
67
+ ### From Source
68
+
69
+ ```bash
70
+ git clone https://github.com/yourusername/codemate-cli.git
71
+ cd codemate-cli
72
+ pip install -e .
73
+ ```
74
+
75
+ ### For Development
76
+
77
+ ```bash
78
+ pip install -e ".[dev]"
79
+ ```
80
+
81
+ ## 🚀 Quick Start
82
+
83
+ ### 1. Configure Your API Key
84
+
85
+ ```bash
86
+ codemate config set-key YOUR_API_KEY
87
+ ```
88
+
89
+ ### 2. Set Your Endpoint (if different from default)
90
+
91
+ ```bash
92
+ codemate config set-endpoint http://localhost:45223
93
+ ```
94
+
95
+ ### 3. Start Chatting!
96
+
97
+ ```bash
98
+ # One-off question
99
+ codemate chat "Explain async/await in Python"
100
+
101
+ # Interactive mode
102
+ codemate interactive
103
+
104
+ # With specific model
105
+ codemate chat --model openai/gpt-4 "Write a binary search algorithm"
106
+ ```
107
+
108
+ ## 📖 Usage Guide
109
+
110
+ ### Basic Commands
111
+
112
+ #### Chat Command
113
+
114
+ Send a single message to the AI:
115
+
116
+ ```bash
117
+ # Basic usage
118
+ codemate chat "Your question here"
119
+
120
+ # Specify model
121
+ codemate chat --model openai/gpt-4 "Your question"
122
+
123
+ # Disable streaming
124
+ codemate chat --no-stream "Your question"
125
+ ```
126
+
127
+ #### Interactive Mode
128
+
129
+ Start a persistent conversation:
130
+
131
+ ```bash
132
+ codemate interactive
133
+
134
+ # In interactive mode:
135
+ # - Type your message and press Enter
136
+ # - Use /clear to clear conversation history
137
+ # - Use /help for commands
138
+ # - Use /exit or Ctrl+C to quit
139
+ ```
140
+
141
+ #### Configuration Management
142
+
143
+ ```bash
144
+ # View all settings
145
+ codemate config show
146
+
147
+ # Set API key
148
+ codemate config set-key YOUR_API_KEY
149
+
150
+ # View masked API key
151
+ codemate config get-key
152
+
153
+ # Set custom endpoint
154
+ codemate config set-endpoint http://your-server:port
155
+ ```
156
+
157
+ #### List Available Models
158
+
159
+ ```bash
160
+ codemate models
161
+ ```
162
+
163
+ #### Clear History
164
+
165
+ ```bash
166
+ codemate clear
167
+ ```
168
+
169
+ ### Advanced Usage
170
+
171
+ #### Environment Variables
172
+
173
+ You can also configure via environment variables:
174
+
175
+ ```bash
176
+ export CODEMATE_API_KEY="your-api-key"
177
+ export CODEMATE_ENDPOINT="http://localhost:45223"
178
+ ```
179
+
180
+ #### Configuration File
181
+
182
+ Config is stored in:
183
+ - **macOS/Linux**: `~/.config/codemate/config.json`
184
+ - **Windows**: `%APPDATA%\CodeMate\config.json`
185
+
186
+ Example config:
187
+ ```json
188
+ {
189
+ "api_key": "your-key",
190
+ "endpoint": "http://localhost:45223",
191
+ "default_model": "chat_c0_cli",
192
+ "stream": true,
193
+ "theme": "monokai",
194
+ "save_history": true
195
+ }
196
+ ```
197
+
198
+ ## 🎨 Rich UI Features
199
+
200
+ ### Markdown Rendering
201
+
202
+ The CLI automatically renders:
203
+ - **Headers** with proper hierarchy
204
+ - **Code blocks** with syntax highlighting
205
+ - **Lists** (ordered and unordered)
206
+ - **Tables** formatted beautifully
207
+ - **Bold**, *italic*, and `inline code`
208
+ - **Links**
209
+
210
+ ### Code Highlighting
211
+
212
+ Supports 100+ languages including:
213
+ - Python, JavaScript, TypeScript
214
+ - Go, Rust, C++, Java
215
+ - HTML, CSS, SQL
216
+ - And many more!
217
+
218
+ ### Streaming Display
219
+
220
+ Watch responses appear in real-time with:
221
+ - Live markdown rendering
222
+ - Smooth scrolling
223
+ - Progress indicators
224
+ - Error handling
225
+
226
+ ## 🔧 Architecture
227
+
228
+ ### Component Overview
229
+
230
+ ```
231
+ ┌─────────────────────────────────┐
232
+ │ CLI Interface (cli.py) │
233
+ │ - Command parsing & routing │
234
+ │ - User interaction │
235
+ └────────────┬────────────────────┘
236
+
237
+ ┌────────────▼────────────────────┐
238
+ │ HTTP Client (client.py) │
239
+ │ - API communication │
240
+ │ - Request/response handling │
241
+ └────────────┬────────────────────┘
242
+
243
+ ┌────────────▼────────────────────┐
244
+ │ Streaming Handler (streaming.py)│
245
+ │ - Real-time rendering │
246
+ │ - Markdown processing │
247
+ └──────────────────────────────────┘
248
+ ```
249
+
250
+ ### Key Components
251
+
252
+ 1. **CLI Layer** (`cli.py`)
253
+ - Built with Click for robust command parsing
254
+ - Rich console integration
255
+ - Interactive prompts
256
+
257
+ 2. **HTTP Client** (`client.py`)
258
+ - Async/sync dual support
259
+ - Streaming and non-streaming modes
260
+ - Error handling
261
+
262
+ 3. **UI Layer** (`ui/`)
263
+ - `streaming.py`: Live response rendering
264
+ - `markdown.py`: Enhanced markdown formatting
265
+ - `renderer.py`: Rich component rendering
266
+
267
+ 4. **Configuration** (`config.py`)
268
+ - Cross-platform config storage
269
+ - Environment variable support
270
+ - Persistent settings
271
+
272
+ ## 🛠️ API Integration
273
+
274
+ ### Your Backend Requirements
275
+
276
+ Your FastAPI server should expose:
277
+
278
+ ```python
279
+ @app.post("/v1/chat/completions")
280
+ async def handle_chat(request: Request):
281
+ # Handle both streaming and non-streaming
282
+ # Return SSE format for streaming:
283
+ # data: {"choices": [{"delta": {"content": "text"}}]}
284
+ # data: [DONE]
285
+ ```
286
+
287
+ ### Request Format
288
+
289
+ ```json
290
+ {
291
+ "model": "chat_c0_cli",
292
+ "messages": [
293
+ {"role": "user", "content": "Hello"}
294
+ ],
295
+ "stream": true,
296
+ "call_for": "chat_c0_cli"
297
+ }
298
+ ```
299
+
300
+ ### Response Format (Streaming)
301
+
302
+ ```
303
+ data: {"choices": [{"delta": {"content": "Hello"}}]}
304
+ data: {"choices": [{"delta": {"content": " there!"}}]}
305
+ data: [DONE]
306
+ ```
307
+
308
+ ## 🧪 Testing
309
+
310
+ ```bash
311
+ # Run tests
312
+ pytest
313
+
314
+ # With coverage
315
+ pytest --cov=codemate
316
+
317
+ # Run specific test
318
+ pytest tests/test_client.py
319
+ ```
320
+
321
+ ## 📝 Development
322
+
323
+ ### Project Structure
324
+
325
+ ```
326
+ codemate-cli/
327
+ ├── codemate/
328
+ │ ├── __init__.py
329
+ │ ├── cli.py # Main CLI entry
330
+ │ ├── client.py # API client
331
+ │ ├── config.py # Configuration
332
+ │ ├── ui/ # UI components
333
+ │ │ ├── streaming.py
334
+ │ │ ├── markdown.py
335
+ │ │ └── renderer.py
336
+ │ ├── commands/ # Command handlers
337
+ │ └── utils/ # Utilities
338
+ ├── tests/ # Test suite
339
+ ├── pyproject.toml # Project config
340
+ └── README.md
341
+ ```
342
+
343
+ ### Adding New Commands
344
+
345
+ 1. Create command handler in `codemate/commands/`
346
+ 2. Register in `cli.py`:
347
+
348
+ ```python
349
+ @main.command()
350
+ @click.option('--option', help='Description')
351
+ def your_command(option):
352
+ """Command description"""
353
+ # Implementation
354
+ ```
355
+
356
+ ### Customizing UI
357
+
358
+ Modify `ui/streaming.py` for rendering behavior:
359
+
360
+ ```python
361
+ class StreamingHandler:
362
+ def _render_content(self, text: str):
363
+ # Custom rendering logic
364
+ pass
365
+ ```
366
+
367
+ ## 🤝 Contributing
368
+
369
+ Contributions welcome! Please:
370
+
371
+ 1. Fork the repository
372
+ 2. Create a feature branch
373
+ 3. Make your changes
374
+ 4. Add tests
375
+ 5. Submit a pull request
376
+
377
+ ## 📄 License
378
+
379
+ MIT License - see LICENSE file
380
+
381
+ ## 🆘 Troubleshooting
382
+
383
+ ### Connection Issues
384
+
385
+ ```bash
386
+ # Check endpoint
387
+ codemate config show
388
+
389
+ # Test with curl
390
+ curl http://localhost:45223/v1/chat/completions
391
+ ```
392
+
393
+ ### API Key Issues
394
+
395
+ ```bash
396
+ # Verify key is set
397
+ codemate config get-key
398
+
399
+ # Reset configuration
400
+ rm ~/.config/codemate/config.json # Linux/macOS
401
+ ```
402
+
403
+ ### Installation Issues
404
+
405
+ ```bash
406
+ # Use virtual environment
407
+ python -m venv venv
408
+ source venv/bin/activate # Linux/macOS
409
+ venv\Scripts\activate # Windows
410
+ pip install codemate-cli
411
+ ```
412
+
413
+ ## 🔗 Links
414
+
415
+ - [Documentation](https://docs.codemate-cli.dev)
416
+ - [GitHub](https://github.com/yourusername/codemate-cli)
417
+ - [Issues](https://github.com/yourusername/codemate-cli/issues)
418
+
419
+ ## 💡 Examples
420
+
421
+ ### Code Generation
422
+
423
+ ```bash
424
+ codemate chat "Write a Python function to calculate fibonacci numbers"
425
+ ```
426
+
427
+ ### Code Explanation
428
+
429
+ ```bash
430
+ codemate chat "Explain this code: $(cat script.py)"
431
+ ```
432
+
433
+ ### Debugging Help
434
+
435
+ ```bash
436
+ codemate chat "I'm getting this error: ImportError: No module named 'requests'"
437
+ ```
438
+
439
+ ### Interactive Coding Session
440
+
441
+ ```bash
442
+ codemate interactive
443
+
444
+ # Then ask follow-up questions:
445
+ # "Now add error handling"
446
+ # "How do I test this?"
447
+ # "Refactor this to be more efficient"
448
+ ```
449
+
450
+ ---
451
+
452
+ Made with ❤️ by the CodeMate team
@@ -0,0 +1,25 @@
1
+ codemate/__init__.py,sha256=cNucdshQJCvEznGi2BpCG1fQzM__oCQalU_A0vmCUDs,346
2
+ codemate/__main__.py,sha256=lA_JuSS6JIFTseGhx3PQaU3-JnrvPu-qiQlr7qO3dKU,252
3
+ codemate/cli.py,sha256=4h1CR2U36vYQvnhZgKDhqiiKJu9j_CYEVg6J3VKrnpI,29638
4
+ codemate/client.py,sha256=H0kg_Td-aQRmLyed-IrIBvglUnC5W_agUUYr0SoxDgs,11931
5
+ codemate/config.py,sha256=5PLAOYnArJxXW9q2pIFLysqNx5JinuamG6IYE-9xNfk,8170
6
+ codemate/commands/__init__.py,sha256=6GPFJ7Xk2zZSBdykksuovOzOzPlMJGvx-jdagc9wDQc,165
7
+ codemate/commands/chat.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ codemate/commands/config.py,sha256=8gNwIVVyrF91mL1LvAb5Fylt1h4dsjYODPgdAFaoF0E,3728
9
+ codemate/commands/help.py,sha256=l5OY94IQB9gVe10Jt1VRx34WK21iEDwlsTNQbRCtT7Q,6559
10
+ codemate/commands/kb_commands.py,sha256=hvwO1h2xJls0ONQOWCLm4aVCxc_uwUqqZrrgBLP3peA,26497
11
+ codemate/ui/__init__.py,sha256=gr01xC-70Sr2aob0CmSCqZvh__USyHRUuLe8mm8mFYY,180
12
+ codemate/ui/markdown.py,sha256=vALHLA-LBMun4SKVxrasu9HieA8oMfNfxDPWXYRPDHk,6685
13
+ codemate/ui/renderer.py,sha256=kumri_jIn2qa4e7aWXhYRsycXsZpbQMIij3ZrUY0Yys,5027
14
+ codemate/ui/streaming.py,sha256=tCxkMbg-3j26GIcdBVIxUJ5YfUQw4jyX5AWuirCEWCc,17233
15
+ codemate/utils/__init__.py,sha256=7oHtWEkSUzGfHz4ADXO1d7d_5jW8YKPlxrDR_XYsqEI,352
16
+ codemate/utils/auth.py,sha256=mYq31vRiEFm2VxFcs4tW7_Dx7jGJdso6zojIL13hm90,4741
17
+ codemate/utils/error_handler.py,sha256=GFFVJfQuj8iA9uR8HOJRruv9M8GDdk8cuOQe3ztL9ZQ,11029
18
+ codemate/utils/errors.py,sha256=2q_me72K_VktxNABboovssF4T3YYw4Cj3fgiFQFr3RI,5427
19
+ codemate/utils/kb_parser.py,sha256=CVSoshD15kSuAesYsBPdUjaLOaUM2CZacpxEsfMLmm8,4060
20
+ codemate_cli-1.0.0.dist-info/licenses/LICENSE,sha256=1TG2sv8vN5JRBVqCBb7YVBrLgyYVDbyahDoR0-CMBk8,1101
21
+ codemate_cli-1.0.0.dist-info/METADATA,sha256=0AfS4Bdwj_hKI1QV_jlDHM23d-lS0QeY4oP-bxqZoh4,10464
22
+ codemate_cli-1.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
23
+ codemate_cli-1.0.0.dist-info/entry_points.txt,sha256=k6khbqCETqWwAdHtuX3KB9aPTPnVPIddLh2T7WbmZEk,80
24
+ codemate_cli-1.0.0.dist-info/top_level.txt,sha256=kEouIYTIdhRBjZ7jpCjHzg8E1Thg5EH11-pNzGeGCIY,9
25
+ codemate_cli-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ codemate = codemate.cli:main
3
+ codemate-cli = codemate.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 CodeMate CLI Contributors
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 @@
1
+ codemate