AI-powered code assistant with interactive CLI
Project description
lite-code
⚡ Fast, Cost-Effective AI Code Assistant - The lightweight alternative to Claude Code for developers, small teams, and freelancers.
Why lite-code?
Claude Code is powerful but expensive. lite-code gives you the essential AI-powered code refactoring capabilities at a fraction of the cost.
| Feature | Claude Code | lite-code |
|---|---|---|
| Cost | $20/month | Pay-per-use (Cerebras) |
| Speed | Fast | ⚡ Faster (batch processing) |
| Context | 200K tokens | 130K tokens |
| Best For | Enterprise | Developers, Freelancers, Small Teams |
| Setup | Complex | Simple (pip install) |
Features
- ⚡ Lightning Fast: Batch processing reads multiple files in one request
- 💰 Cost Effective: Pay only for what you use with Cerebras API
- 🎯 Focused: Essential refactoring features without bloat
- 🐍 Python Support: Type hints, logging conversion, async patterns
- 📜 JavaScript/TypeScript Support: Modern JS patterns, type annotations
- 💬 Interactive CLI: Simple, intuitive interface
- 📁 Context Management: Reference files and folders with
@and/ - 🔒 Safe Refactoring: In-place editing with optional backup mode
- 💾 Persistent Configuration: Saves your settings between sessions
- 🎨 Beautiful Output: Rich console with colored diffs
- ⌨️ Tab Completion: Auto-complete file and folder references
- ❓ Ask Mode: Ask questions about code and generate diagrams
Installation
Install from PyPI
pip install lite-code
Install from Source
git clone https://github.com/kumarsahil01/lite-code.git
cd lite-code
pip install -e .
Quick Start
# Launch the interactive CLI
lite-code
# First-time setup will prompt for:
# 1. Cerebras API key
# 2. Model name (default: zai-glm-4.7)
Usage
Interactive Mode
lite-code
Commands
@filename- Reference a file (e.g.,@utils.py) - supports tab completion/folder- Reference a folder (e.g.,/src) - supports tab completionask <question>- Ask questions about code (e.g.,ask explain main())?- Show help!- Change settingsclear- Clear contextexit/quit- Save and exit
Example Session
$ lite-code
🚀 Welcome to lite-code!
AI-powered code refactoring assistant
No API key found.
Enter your Cerebras API key: sk-xxxxxxxx
✓ API key saved
lite-code > @utils.py
✓ Added utils.py (python) to context
lite-code > /src
✓ Added folder /src to context (5 files)
lite-code > Add type hints to all functions
✓ Analyzing 5 file(s)...
File 1/5: src/utils.py
--- original
+++ modified
-def greet(name):
+def greet(name: str) -> str:
print("Hello, " + name)
Apply changes? [y/N]: y
✓ Applied changes
File 2/5: src/api.py
--- original
+++ modified
-def fetch_data(url):
+def fetch_data(url: str) -> dict:
Apply changes? [y/N]: y
✓ Applied changes
✓ Completed: 5 files modified
lite-code > !
Settings:
1. Change API key
2. Change model (current: zai-glm-4.7)
3. Toggle backup mode (current: disabled)
4. Back
Select option: 3
✓ Backup mode enabled
lite-code > exit
✓ Configuration saved
Goodbye! 👋
Configuration
Configuration is stored in ~/.lite-code/config.json:
{
"api_key": "your-api-key",
"model": "zai-glm-4.7",
"context": ["utils.py", "src/"],
"backup_mode": false
}
Settings
Access settings by typing ! in the interactive CLI:
- Change API key - Update your Cerebras API key
- Change model - Switch between different models
- Toggle backup mode - Enable/disable automatic backups
- Back - Return to main interface
Supported Refactoring Types
Python
- Type hinting
- Print → logging conversion
- Async conversion
- Dead code removal
- Best practices (f-strings, context managers)
JavaScript/TypeScript
- var → const/let conversion
- Arrow functions
- Template literals
- JSDoc comments
- TypeScript type annotations
Requirements
- Python 3.10+
- Cerebras API key
- Internet connection (for API calls)
Dependencies
cerebras-cloud-sdk- Cerebras API clientrich- Beautiful terminal outputprompt-toolkit- Interactive input with history
Getting Your API Key
Get your Cerebras API key from Cerebras Cloud
Troubleshooting
API Key Not Found
No API key found.
Enter your Cerebras API key:
Solution: Enter your API key when prompted, or set it via settings (! command).
Model Not Found
If you see an error about the model not existing, check the model name in settings (! command).
Context Issues
If files aren't being found, ensure you're in the correct directory and use relative paths.
Development
Setup Development Environment
git clone https://github.com/kumarsahil01/lite-code.git
cd lite-code
pip install -e ".[dev]"
Run Tests
pytest
Build Package
python -m build
Publish to PyPI
twine upload dist/*
Credits
Built by: Sahil Kumar
Special Thanks: Cerebras for providing the zai-glm-4.7 model and API support
GitHub: https://github.com/kumarsahil01/lite-code
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
- Built with Cerebras Cloud SDK
- Inspired by Claude Code
- Uses Rich for beautiful terminal output
- Uses prompt_toolkit for interactive input
Support
For issues and questions, please open an issue on GitHub.
Made with ❤️ by the Sahil Kumar
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lite_code-0.3.2.tar.gz.
File metadata
- Download URL: lite_code-0.3.2.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6593380f10c435a178b108c7b58fdc49599cc48aed3078f835136cedeb9a53e7
|
|
| MD5 |
45924a2da58254e4c320e75989d2fd70
|
|
| BLAKE2b-256 |
7440e6318dffe9ae01e91c656c2af5bd1020d78dbdbcbdf6fec0f648be97e48b
|
File details
Details for the file lite_code-0.3.2-py3-none-any.whl.
File metadata
- Download URL: lite_code-0.3.2-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb3445056063c9dfce7f61a849872763d61c3bf403cc413ea49b1c95dc4ddf76
|
|
| MD5 |
ba674f9fa5cc74ebee3e240a52a4cd18
|
|
| BLAKE2b-256 |
d55239ba59470f400345da523d05e5c29e261fb9f76590ebc47543c15a91f97a
|