Cross-platform AI CLI launcher for managing multiple AI coding assistants
Project description
AI-CLI (Python Edition)
AI-CLI is a cross-platform terminal launcher for managing multiple AI coding assistants. Seamlessly switch between tools like Kiro CLI, Claude Code, Cursor Agent, and more.
โจ Core Features
๐ Cross-Platform Support
- Windows: Native support + WSL integration โ Fully tested
- Linux: Full support for all major distributions โ ๏ธ Not fully tested - may have issues
- macOS: Support for Terminal.app and iTerm2 โ ๏ธ Not fully tested - may have issues
๐ Deep WSL Integration
- Automatic WSL environment detection
- Automatic Windows โ WSL path conversion
- Launch WSL tools from Windows
- Launch Windows tools from WSL
๐ Project Management
- Tree Structure: Organize projects in folders
- Git Worktree: Auto-detect and select Git worktrees
- Environment Variables: Configure per-project environment variables
- Path Normalization: Automatic handling of different platform path formats
โก Tool Detection & Management
- Async Detection: Parallel tool detection using async/await
- Smart Caching: Background detection with result caching
- One-Click Install: Press
Ito install missing tools - Manual Refresh: Press
Rto refresh tool list - Environment Recognition: Auto-detect Windows, WSL, Linux, macOS environments
๐จ User Interface
- Rich UI: Beautiful terminal interface powered by Rich library
- Keyboard Navigation: Full keyboard shortcut support
- Real-time Feedback: Display tool detection and installation progress
- Theme Support: Customizable color themes
๐ Internationalization
- Multi-language: English, Chinese, Japanese, German
- Auto-detection: Automatically select based on system language
- Configurable: Manually specify language in config file
๐ Quick Start
Installation
Method 1: Install from PyPI (Recommended)
# Using pip
pip install ai-cli-launcher
# Or using pipx (isolated environment)
pipx install ai-cli-launcher
Method 2: One-Line Installation Script
Windows:
irm https://raw.githubusercontent.com/hyfhot/AI-CLI/master/install.ps1 | iex
Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/hyfhot/AI-CLI/master/install.sh | bash
The script will automatically:
- Check Python installation (requires Python 3.8+)
- Install AI-CLI from PyPI
- Initialize configuration
- Create desktop shortcut (Windows)
Method 3: Install from Source (For Developers)
# Clone repository
git clone https://github.com/hyfhot/AI-CLI.git
cd AI-CLI
# Install in development mode
pip install -e ".[dev]"
Initialize Configuration
ai-cli --init
This creates a default configuration file with common AI tool configurations.
Run
ai-cli
Uninstall
Complete Uninstall (Recommended):
Windows (PowerShell):
ai-cli --uninstall; pip uninstall ai-cli-launcher
Linux/macOS:
ai-cli --uninstall && pip uninstall ai-cli-launcher
Alternative (Step by Step):
# Step 1: Clean up shortcuts and show config location
ai-cli --uninstall
# Step 2: Uninstall the package
pip uninstall ai-cli-launcher
Quick Uninstall:
# Uninstall package only (shortcuts will remain)
pip uninstall ai-cli-launcher
Manual Cleanup (if needed):
- Windows: Delete
%APPDATA%\AI-CLI\and desktop shortcut - Linux: Delete
~/.config/ai-cli/ - macOS: Delete
~/Library/Application Support/ai-cli/
## ๐ Usage
### Command Line Options
```bash
ai-cli # Start interactive interface
ai-cli --init # Initialize configuration file
ai-cli --config # Edit configuration file
ai-cli --lang zh # Start with Chinese language
ai-cli --lang ja # Start with Japanese language
ai-cli --uninstall # Uninstall AI-CLI
ai-cli --version # Show version information
ai-cli --help # Show help information
Language Options (--lang / -l):
auto- Auto-detect system language (default)en- Englishzh- Chinese (ไธญๆ)ja- Japanese (ๆฅๆฌ่ช)de- German (Deutsch)
Note: CLI language parameter takes priority over config file settings.
Keyboard Shortcuts
Project Selection Screen
| Key | Function |
|---|---|
โ / โ |
Navigate up/down |
Enter |
Select project / Enter folder |
Esc |
Go back to parent folder |
N |
Create new project or folder |
D |
Delete selected project or folder |
Q |
Quit application |
Tool Selection Screen
| Key | Function |
|---|---|
โ / โ |
Navigate up/down |
Enter |
Launch tool (new window) |
Ctrl+Enter |
Launch tool (new tab) |
I |
Install missing tools |
R |
Refresh tool list |
Esc |
Return to project selection |
Q |
Quit application |
Workflow
- Launch: Run
ai-cli - Select Project: Use arrow keys to select a project, press
Enterto confirm - Select Tool: Choose the AI tool you want to use
- Start Working: Tool launches in a new window or tab
๐ง Configuration Guide
Configuration File Location
- Windows:
%APPDATA%\AI-CLI\config.json - Linux:
~/.config/ai-cli/config.json - macOS:
~/Library/Application Support/ai-cli/config.json
Configuration File Structure
{
"projects": [
{
"type": "folder",
"name": "My Projects",
"children": [
{
"type": "project",
"name": "Web App",
"path": "/path/to/project",
"env": {
"API_KEY": "your-api-key",
"DEBUG": "true"
}
}
]
}
],
"tools": [
{
"name": "kiro-cli",
"displayName": "Kiro CLI",
"windowsInstall": "winget install kiro-cli",
"wslInstall": "curl -fsSL https://cli.kiro.dev/install | bash",
"linuxInstall": "curl -fsSL https://cli.kiro.dev/install | bash",
"macosInstall": "brew install kiro-cli",
"checkCommand": "kiro-cli --version",
"url": "https://kiro.dev/cli/"
}
],
"settings": {
"language": "auto",
"terminalEmulator": "default",
"theme": "default"
}
}
Project Configuration
Project Types
Folder:
{
"type": "folder",
"name": "Project Group Name",
"children": [...]
}
Project:
{
"type": "project",
"name": "Project Name",
"path": "/absolute/path/to/project",
"env": {
"KEY": "value"
}
}
Environment Variables
Configure independent environment variables for each project:
{
"type": "project",
"name": "API Project",
"path": "/path/to/api",
"env": {
"API_KEY": "sk-xxx",
"API_BASE_URL": "https://api.example.com",
"DEBUG": "true",
"LOG_LEVEL": "info"
}
}
Tool Configuration
Required Fields
name: Tool command name (used for detection)displayName: Display namecheckCommand: Command to check if tool is installed
Installation Commands (by Platform)
windowsInstall: Windows native installation commandwslInstall: WSL environment installation commandlinuxInstall: Linux installation commandmacosInstall: macOS installation command
Optional Fields
url: Tool's official website (displayed in tool list)
Example Configuration
{
"name": "cursor",
"displayName": "Cursor Agent",
"windowsInstall": "winget install Cursor",
"wslInstall": "curl -fsSL https://cursor.sh/install | bash",
"linuxInstall": "curl -fsSL https://cursor.sh/install | bash",
"macosInstall": "brew install --cask cursor",
"checkCommand": "cursor --version",
"url": "https://cursor.sh"
}
Settings Options
language
auto: Auto-detect system language (default)en: Englishzh: Chineseja: Japanesede: German
terminalEmulator
default: Use system default terminal (default)wt: Windows Terminal (Windows only)iterm: iTerm2 (macOS only)gnome-terminal: GNOME Terminal (Linux only)konsole: Konsole (Linux only)
theme
default: Default dark theme- More themes coming in future versions
๐๏ธ Project Architecture
Directory Structure
ai_cli/
โโโ __init__.py # Package initialization
โโโ cli.py # CLI entry point
โโโ app.py # Main application logic
โโโ models.py # Data models
โโโ config.py # Configuration management
โโโ utils.py # Path conversion utilities
โโโ core/ # Core functionality modules
โ โโโ __init__.py
โ โโโ tools.py # Tool detection
โ โโโ projects.py # Project management
โ โโโ git.py # Git integration
โ โโโ installer.py # Tool installation
โโโ ui/ # User interface modules
โ โโโ __init__.py
โ โโโ theme.py # Theme configuration
โ โโโ menu.py # Menu rendering
โ โโโ input.py # Keyboard input handling
โโโ platform/ # Platform adapter modules
โ โโโ __init__.py
โ โโโ base.py # Abstract base class
โ โโโ windows.py # Windows adapter
โ โโโ linux.py # Linux adapter
โ โโโ macos.py # macOS adapter
โ โโโ factory.py # Platform factory
โโโ i18n/ # Internationalization modules
โโโ __init__.py
โโโ manager.py # Language manager
Core Module Descriptions
models.py - Data Models
Defines all data structures:
Config: Main configuration objectSettings: Settings optionsProjectNode: Project node (supports tree structure)Tool: Tool objectToolConfig: Tool configurationToolEnvironment: Tool runtime environment enum
config.py - Configuration Management
- Cross-platform config file path handling
- Config file loading and saving
- Migration from legacy config versions
- Default config creation
app.py - Main Application
- Application main loop
- Project selection logic
- Tool selection logic
- Tool launch logic
- Project and folder CRUD operations
core/tools.py - Tool Detection
- Async parallel tool detection
- Platform-specific detection logic
- Windows native tool detection
- WSL tool detection
- Tool cache management
core/git.py - Git Integration
- Detect Git worktrees
- Display branch status
- Interactive worktree selection
core/installer.py - Tool Installation
- Select installation command by platform
- Execute installation process
- Post-installation path updates
- Find installed tools
ui/menu.py - Menu Rendering
- Render project tree
- Render tool list
- Display breadcrumb navigation
- Clear screen and refresh
ui/input.py - Keyboard Input
- Cross-platform keyboard input handling
- Different implementations for Windows and Unix
- Text input support
- Special key handling
platform/ - Platform Adapters
- Abstract platform interface
- Windows-specific implementation (Windows Terminal support)
- Linux-specific implementation (multiple terminal support)
- macOS-specific implementation (iTerm2 support)
- Platform factory pattern
i18n/manager.py - Internationalization
- Language detection
- Translation dictionary management
- Text retrieval interface
๐ Advanced Features
Git Worktree Support
When a project path is a Git worktree, AI-CLI will:
- Auto-detect all worktrees
- Display branch and status for each worktree
- Allow selection of the worktree to use
- Show ahead/behind commit counts for branches
WSL Path Conversion
AI-CLI automatically handles path conversion between Windows and WSL:
- Windows path:
C:\Users\username\project - WSL path:
/mnt/c/Users/username/project
Conversion is bidirectional, supporting:
- Launch WSL tools from Windows
- Launch Windows tools from WSL
Async Tool Detection
Tool detection uses async parallel processing:
- On Startup: Quickly display interface, detect tools in background
- Caching: Detection results are cached to avoid repeated checks
- Refresh: Press
Rto clear cache and re-detect
Environment Variable Injection
Environment variables configured for each project are injected when launching tools:
{
"type": "project",
"name": "API Project",
"path": "/path/to/api",
"env": {
"API_KEY": "sk-xxx",
"DEBUG": "true"
}
}
When launching a tool, these environment variables are added to the tool's runtime environment.
๐งช Testing
Running Tests
# Run all tests
pytest
# Run specific test file
pytest tests/test_models.py
# Run specific test
pytest tests/test_models.py::TestConfig::test_from_dict
# Show verbose output
pytest -v
# Show print output
pytest -s
Test Coverage
# Run tests with coverage report
pytest --cov=ai_cli
# Generate HTML coverage report
pytest --cov=ai_cli --cov-report=html
# View report
open htmlcov/index.html # macOS
xdg-open htmlcov/index.html # Linux
start htmlcov/index.html # Windows
Test File Descriptions
test_models.py: Data model teststest_config.py: Configuration management teststest_utils.py: Path conversion teststest_platform.py: Platform adapter teststest_git.py: Git integration teststest_tools.py: Tool detection teststest_projects.py: Project management teststest_ui.py: UI component teststest_app.py: Application integration teststest_cli.py: CLI entry point tests
๐ Development Guide
Requirements
- Python: 3.8 or higher
- Dependencies:
rich: Terminal UI renderingprompt-toolkit: Keyboard input handlingclick: CLI frameworkplatformdirs: Cross-platform paths
Development Environment Setup
# 1. Clone repository
git clone https://github.com/hyfhot/AI-CLI.git
cd AI-CLI
# 2. Create Python version worktree (if needed)
git worktree add ../ai-cli-multi-platform python-migration
cd ../ai-cli-multi-platform
# 3. Create virtual environment (recommended)
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate
# 4. Install development dependencies
pip install -e ".[dev]"
# 5. Run tests to verify environment
pytest
Code Style
Project follows PEP 8 style guide:
# Install code checking tools
pip install flake8 black mypy
# Run code checks
flake8 ai_cli tests
# Auto-format code
black ai_cli tests
# Type checking
mypy ai_cli
Adding New Tools
Add new tool configuration in config.json:
{
"name": "new-tool",
"displayName": "New Tool",
"windowsInstall": "winget install new-tool",
"wslInstall": "curl -fsSL https://example.com/install | bash",
"linuxInstall": "curl -fsSL https://example.com/install | bash",
"macosInstall": "brew install new-tool",
"checkCommand": "new-tool --version",
"url": "https://example.com"
}
Adding New Languages
Add translations in ai_cli/i18n/manager.py:
translations = {
'new_lang': {
'app_title': 'AI-CLI',
'select_project': 'Select Project',
# ... other translations
}
}
Debugging Tips
# Enable debug mode
ai-cli --debug
# Use Python debugger
python -m pdb -m ai_cli.cli
# View detailed logs
import logging
logging.basicConfig(level=logging.DEBUG)
๐ Troubleshooting
Windows Issues
Issue: Cannot detect Windows Terminal
# Solution: Ensure Windows Terminal is installed
winget install Microsoft.WindowsTerminal
Issue: WSL tool detection fails
# Solution: Ensure WSL is enabled
wsl --install
Linux Issues
Issue: Terminal emulator detection fails
# Solution: Install supported terminal
sudo apt install gnome-terminal # Ubuntu/Debian
sudo dnf install gnome-terminal # Fedora
macOS Issues
Issue: iTerm2 not detected
# Solution: Ensure iTerm2 is installed
brew install --cask iterm2
General Issues
Issue: Config file corrupted
# Solution: Reinitialize configuration
ai-cli --init
Issue: Tool detection cache stale
# Solution: Press R key in tool selection screen to refresh
๐ค Contributing
We welcome all forms of contribution!
Ways to Contribute
- Report Bugs: Submit issues on GitHub Issues
- Feature Requests: Propose new feature ideas
- Code Contributions: Submit Pull Requests
- Documentation: Improve docs and examples
- Translations: Add new language support
Pull Request Process
- Fork the project
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
Commit Convention
Follow Conventional Commits:
feat: Add new feature
fix: Fix bug
docs: Documentation update
style: Code formatting
refactor: Code refactoring
test: Test related
chore: Build/toolchain updates
๐ License
This project is licensed under the MIT License - see LICENSE file for details.
๐ Related Links
- Original Project: AI-CLI (PowerShell Edition)
- Documentation: docs/
- Issue Tracker: GitHub Issues
- Changelog: CHANGELOG.md
๐ Acknowledgments
Thanks to these open source projects:
- Rich - Powerful terminal UI library
- Prompt Toolkit - Interactive command-line tools
- Click - Python CLI framework
- platformdirs - Cross-platform directory paths
๐ Project Status
- Version: Beta
- Python Version: 3.8+
- Platforms: Windows, Linux, macOS
- Maintenance: Actively developed
๐บ๏ธ Roadmap
- Support more AI tools
- Plugin system
- Config file validation
- More theme options
- Tool usage statistics
- Cloud config sync
- Project template support
Made with โค๏ธ by AI-CLI Team
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 ai_cli_launcher-3.0.7.tar.gz.
File metadata
- Download URL: ai_cli_launcher-3.0.7.tar.gz
- Upload date:
- Size: 296.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4da904a58d72598d1fbeb8fbe07589ec30b666f699343c847c44545632a8f7b7
|
|
| MD5 |
5bf19a239f618f8bb10e93c17547025b
|
|
| BLAKE2b-256 |
2920c3130878bc0b0b643376759a17fca5f12848f672ecb947ddb2ca2ab39cf4
|
File details
Details for the file ai_cli_launcher-3.0.7-py3-none-any.whl.
File metadata
- Download URL: ai_cli_launcher-3.0.7-py3-none-any.whl
- Upload date:
- Size: 163.3 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 |
80008f82f91d9fc0b6963a0b65cd094ec4ac8d87a019f1ef3c3ce6f67e8092d9
|
|
| MD5 |
7dd927b3f9ce0445ac476d817ff46ba6
|
|
| BLAKE2b-256 |
d50edcdd494f658af45f835cbdf1baf731c7b7b8f8ff47b1706669c2c9767b60
|