codemate
An AI-powered CLI tool that helps developers debug and refactor their code efficiently. Using OpenRouter's GPT-4o API, it analyzes source code files to identify bugs, suggest fixes, and recommend refactoring improvements across multiple programming languages.
Features
- Smart Debugging: Automatically detect syntax errors, logical errors, runtime issues, and security vulnerabilities
- Code Refactoring: Get intelligent suggestions to improve code quality, maintainability, and performance
- Multi-file Analysis: Process entire directories or single files
- Inline Code Support: Analyze code snippets directly from command line or stdin
- Wide Language Support: Supports 40+ programming languages and file types
- Fast & Efficient: Powered by GPT-4o through OpenRouter API
Installation
From PyPI (Recommended)
pip install codesmate
From Source
git clone https://github.com/MahdiMirshafiee/codemate.git
cd codemate
pip install .
Setup
Before using codemate, you need to configure your OpenRouter API key:
- Get an API key from OpenRouter
- Configure codemate with your API key:
codemate --config
You'll be prompted to enter your OpenRouter API key. This will be stored in ~/.codemate/config.json .
Usage
Debug Current Directory
Analyze all supported files in the current directory for bugs:
codemate
Debug Specific File
codemate filename.py
codemate src/main.js
Refactor Code
Get refactoring suggestions for a specific file:
codemate -r filename.py
codemate --refactor src/component.jsx
Inline Code Analysis
Analyze code directly from command line:
codemate -i "def hello(): print('Hello World')"
Read code from stdin:
cat myfile.py | codemate -i -
# or
codemate -i -
# Then paste your code and press Ctrl+D (Linux/macOS) or Ctrl+Z+Enter (Windows)
Configuration Management
Set API Key
codemate --config
Delete Configuration
Remove stored API key and configuration:
codemate --delete
Help
To see all available options:
codemate --help
This will display:
usage: codemate [-h] [-r] [-i INLINE] [-c] [-d] [filename]
Codemate CLI: AI Assistant for debug and refactor codes
positional arguments:
filename (optional) filename to debug/refactor (if omitted, debug current dir)
options:
-h, --help show this help message and exit
-r, --refactor Refactor the specified file (use with filename)
-i INLINE, --inline INLINE
Inline code OR use "-" to read code from stdin
-c, --config Set OpenRouter API Key
-d, --delete Delete the codemate config directory (erase API key)
Examples
Debug a Python File
Refactor a JavaScript File
Inline Code Analysis
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Authors
Made with ❤️ for developers by developers
Metadata
Release files for codesmate 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| codesmate-0.1.0.tar.gz | 1.4 MB | Without provenance | Details for codesmate-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| codesmate-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for codesmate-0.1.0-py3-none-any.whl |
Total release size: 1.5 MB
Release files / codesmate-0.1.0.tar.gz
| Download URL | codesmate-0.1.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f78d32afd479413ae11ba59a1d0e525c370f0a844b0cbc7e8ddbe0c5e7e9865
|
|
BLAKE2b-256 checksum How to use checksums |
c727273badd69b61990f97c82ad786988facf59525937478f5214978ca0fe344
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Release files / codesmate-0.1.0-py3-none-any.whl
| Download URL | codesmate-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
910a2a2ccad2e65bc38b6a258e84142402e96b23d7630c9f1407ba798d31ad9b
|
|
BLAKE2b-256 checksum How to use checksums |
9182e3a76f0401ded65fd28743c3b918dbfc59e6f5c2a3f46931aa430b93435c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Security for codesmate 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.