AI-powered code analysis and enhancement tool with multi-language support for docstrings, type hints, magic numbers, and dead code detection.
Project description
Zenco
Zenco is an AI-powered code analysis and enhancement tool that supports multiple programming languages. It automatically generates docstrings, adds type hints, detects magic numbers, removes dead code, and provides intelligent refactoring suggestions using Large Language Models (LLMs).
This project was built on a foundation of solid Object-Oriented Programming principles and design patterns, including the Visitor, Strategy, Factory, and Adapter patterns.
Core Features
Multi-Language Support
- Python, JavaScript, Java, Go, C++ - Full support across major programming languages
- Tree-sitter powered - Fast, accurate parsing for all supported languages
AI-Powered Code Enhancement
- Docstring Generation: Context-aware docstrings for functions and classes
- Type Hint Addition: Intelligent type annotations for Python functions
- Magic Number Detection: Identifies and replaces numeric literals with named constants
- Dead Code Removal: Detects and removes unused imports, variables, and functions
- Strict Mode: Advanced cleanup including unused local variables and private methods
Developer Experience
- Multiple LLM Providers: Support for Groq, OpenAI, Anthropic, and Google Gemini
- Colorful Terminal Output: Rich, beautiful command-line interface
- Umbrella Commands:
--refactorand--refactor-strictfor comprehensive code improvement - Git Integration: Process only changed files with
--diff - Safe Preview Mode: See changes before applying with dry-run by default
Installation
Install Zenco directly from PyPI:
pip install zenco
Quick Start
- Initialize your project:
zenco init
This interactive wizard helps you configure your preferred AI provider (Groq, OpenAI, Anthropic, or Gemini).
- Preview changes on a file:
zenco run myfile.py --refactor
- Apply comprehensive improvements:
zenco run . --refactor-strict --in-place
Configuration
Zenco uses a .env file for secrets and a pyproject.toml file for project-wide settings.
1. API Credentials (.env)
The zenco init command will create this for you. Example:
GROQ_API_KEY="gsk_YourActualGroqApiKeyHere"
GROQ_MODEL_NAME="llama3-8b-8192"
ZENCO_PROVIDER="groq"
Usage Examples
Basic Commands
# Get help
zenco --help
zenco run --help
# Preview changes (dry run)
zenco run myfile.py --docstrings
zenco run . --refactor
# Apply changes
zenco run myfile.py --docstrings --in-place
zenco run . --refactor-strict --in-place
Feature-Specific Usage
# Add type hints to Python files
zenco run . --add-type-hints --in-place
# Fix magic numbers across languages
zenco run . --fix-magic-numbers --in-place
# Remove dead code (safe mode)
zenco run . --dead-code --in-place
# Remove dead code (strict mode - includes locals)
zenco run . --dead-code --dead-code-strict --in-place
# Process only Git-changed files
zenco run . --diff --refactor --in-place
Umbrella Commands
# Safe refactor: docstrings + type hints + magic numbers + dead code
zenco run . --refactor --in-place
# Strict refactor: includes unused local variables and private methods
zenco run . --refactor-strict --in-place
How It Works
Zenco uses a "Tree-sitter + AI" architecture for fast, accurate multi-language support:
- Tree-sitter Parsing: Fast, incremental parsing for Python, JavaScript, Java, Go, and C++
- Pattern Detection: Identifies missing docstrings, magic numbers, unused code, and type annotation opportunities
- AI Enhancement: Sends relevant code context to your chosen LLM for intelligent suggestions
- Safe Transformation: Applies changes using precise byte-level edits with the CodeTransformer
- Multi-Provider Support: Works with Groq, OpenAI, Anthropic, and Google Gemini APIs
🤝 Contributors
We thank all the people who contribute to Zenco! Your contributions make this project better.
🎉 How to Contribute
- 🐛 Report bugs - Open an issue
- ✨ Request features - Start a discussion
- 🔧 Submit PRs - Check CONTRIBUTING.md
- 📝 Improve docs - Help us make documentation better
🏆 Notable Contributions
- Initial Development: @paudelnirajan - Core architecture, multi-language support
- Future contributors will be listed here as they join the project!
Made with ❤️ by the Zenco community
License
This project is licensed under the MIT License.
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 zenco-1.2.0.tar.gz.
File metadata
- Download URL: zenco-1.2.0.tar.gz
- Upload date:
- Size: 38.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81256d0540a91a50905ac3aefdd129053af6feb89b14259e02cf31298040218b
|
|
| MD5 |
404ef3c192a18911326a552181d53108
|
|
| BLAKE2b-256 |
5965453f560a34a322281d61bff4949ae623b4921131ed4fe9745be94732b0eb
|
File details
Details for the file zenco-1.2.0-py3-none-any.whl.
File metadata
- Download URL: zenco-1.2.0-py3-none-any.whl
- Upload date:
- Size: 34.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eea0059a9b955e22f873c19d873929b07c6274c45396f90e2e6cf978d5ddd882
|
|
| MD5 |
b8f6018d2b91afe34a7dab75252ae350
|
|
| BLAKE2b-256 |
554bc17b5aa7f1ee375dca464cb4eee7185066d694b4aab45769ac13bb13bc0c
|