A CLI tool for software development tasks powered by AI
Project description
Janito
AI-powered CLI tool for code modifications and analysis. Janito helps you modify, analyze, and understand your codebase using natural language commands.
Table of Contents
✨ Features
- Natural language code modifications
- Codebase analysis and question answering
- Smart search and replace with indentation awareness
- Git-aware operations
- Interactive shell mode
- Change preview and validation
- Automatic backup and restore
🚀 Installation
Prerequisites
- Python 3.8 or higher
- pip package manager
- An Anthropic API key (default) or OpenAI API key
Steps
- Install using pip:
pip install janito
- Configure your API key:
For Anthropic Claude (default):
export ANTHROPIC_API_KEY=your_api_key_here
For OpenAI:
export OPENAI_API_KEY=your_api_key_here
export AI_BACKEND=openai
💡 Usage
Basic Commands
# Modify code
janito "add docstrings to this file"
# Ask questions about the codebase
janito --ask "explain the main function in this file"
# Preview files that would be analyzed
janito --scan
# Start interactive shell
janito
Common Use Cases
- Code Documentation:
janito "add type hints to all functions"
janito "improve docstrings with more details"
- Code Analysis:
janito --ask "what are the main classes in this project?"
janito --ask "explain the error handling flow"
- Code Refactoring:
janito "convert this class to use dataclasses"
janito "split this large function into smaller ones"
⚙️ Configuration
Environment Variables
ANTHROPIC_API_KEY: Anthropic API keyOPENAI_API_KEY: OpenAI API key (if using OpenAI backend)AI_BACKEND: AI provider ('claudeai' or 'openai')JANITO_TEST_CMD: Default test command to run after changes
Command Line Options
-w, --workspace_dir: Set working directory-i, --include: Additional paths to include--debug: Show debug information--verbose: Show verbose output--auto-apply: Apply changes without confirmation--history: Display history of requests
🔧 Troubleshooting
Common Issues
- API Key Issues:
# Verify API key is set
echo $ANTHROPIC_API_KEY
# Temporarily set API key for single command
ANTHROPIC_API_KEY=your_key janito "your request"
- Path Issues:
# Use absolute paths if having issues with relative paths
janito -w /full/path/to/project "your request"
# Specify additional paths explicitly
janito -i ./src -i ./tests "your request"
- Debug Mode:
# Enable debug output for troubleshooting
janito --debug "your request"
Error Messages
- "No command given": Provide a change request or command
- "No input provided": Check if using --input mode correctly
- "Duplicate path provided": Remove duplicate paths from includes
👥 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
MIT License - see LICENSE
Project details
Release history Release notifications | RSS feed
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 janito-0.6.0.tar.gz.
File metadata
- Download URL: janito-0.6.0.tar.gz
- Upload date:
- Size: 69.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99d07d2d758311706630c3c8cf006ac57b5688eb8bde8f1e099c91a70806efbc
|
|
| MD5 |
ea06041710f5db7c013565dc315a8150
|
|
| BLAKE2b-256 |
e9a9c7349f3e3798f949333c433c2dafb57f0c87c53e904526a39a6338e51620
|
File details
Details for the file janito-0.6.0-py3-none-any.whl.
File metadata
- Download URL: janito-0.6.0-py3-none-any.whl
- Upload date:
- Size: 101.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
401a0d75ae23848fbd96c762108c4265243974cb32895c774d12c2744a8e0d4d
|
|
| MD5 |
408da3271114865bf612cd13b72d4814
|
|
| BLAKE2b-256 |
14169438bd10ff25ab1f7e758a5110abf9dc9b0c2ee42d5934afdc13e02405e6
|