Skip to main content

Cross-platform AI CLI launcher for managing multiple AI coding assistants

Project description

AI-CLI (Python Edition)

๐ŸŒ English | ไธญๆ–‡ | ๆ—ฅๆœฌ่ชž | Deutsch

Python Version License Status

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 I to install missing tools
  • Manual Refresh: Press R to 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

# Direct launch mode (skip project and tool selection UI)
ai-cli -t kiro-cli                          # Launch kiro-cli in current directory
ai-cli -t claude -p "My Project"            # Launch claude in a configured project
ai-cli -t codewhale -d /path/to/project      # Launch codewhale in a specific directory
ai-cli -t kiro-cli --platform wsl           # Launch in WSL environment

Direct Launch Options:

Option Short Description
--tool NAME -t AI tool name (e.g., kiro-cli, claude). Triggers direct-launch mode.
--project NAME -p Configured project name (used for env-var injection)
--dir PATH -d Working directory path (mutually exclusive with -p)
--platform ENV โ€” Target platform: windows/wsl/linux/macos (default: current)

When --tool is provided, AI-CLI skips the interactive UI, runs the tool directly in the current terminal, and exits when the tool exits. Project-specific environment variables are injected if a matching project is found.

Language Options (--lang / -l):

  • auto - Auto-detect system language (default)
  • en - English
  • zh - 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

Interactive Mode

  1. Launch: Run ai-cli
  2. Select Project: Use arrow keys to select a project, press Enter to confirm
  3. Select Tool: Choose the AI tool you want to use
  4. Start Working: Tool launches in a new window or tab

Direct Launch Mode

Pass --tool to skip the interactive UI and run a tool directly in the current terminal:

# Simplest: launch kiro-cli in the current directory
ai-cli -t kiro-cli

# Launch in a configured project (auto-injects project env vars)
ai-cli -t claude -p "My API Project"

# Launch in a specific directory
ai-cli -t codewhale -d ~/code/myproject

Direct launch mode will:

  1. Resolve the project configuration, injecting matching environment variables
  2. Run the AI tool in the current terminal window (foreground, not a new window)
  3. Exit when the tool exits

Current Directory Awareness

When you launch ai-cli from a terminal:

  • If the current directory matches a configured project, that project is automatically selected.
  • If the current directory is not a configured project, a "current directory" entry appears at the top of the project list, allowing you to launch a tool without any prior configuration.

๐Ÿ”ง 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 name
  • checkCommand: Command to check if tool is installed

Installation Commands (by Platform)

  • windowsInstall: Windows native installation command
  • wslInstall: WSL environment installation command
  • linuxInstall: Linux installation command
  • macosInstall: 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: English
  • zh: Chinese
  • ja: Japanese
  • de: 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 object
  • Settings: Settings options
  • ProjectNode: Project node (supports tree structure)
  • Tool: Tool object
  • ToolConfig: Tool configuration
  • ToolEnvironment: 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:

  1. Auto-detect all worktrees
  2. Display branch and status for each worktree
  3. Allow selection of the worktree to use
  4. 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:

  1. On Startup: Quickly display interface, detect tools in background
  2. Caching: Detection results are cached to avoid repeated checks
  3. Refresh: Press R to 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 tests
  • test_config.py: Configuration management tests
  • test_utils.py: Path conversion tests
  • test_platform.py: Platform adapter tests
  • test_git.py: Git integration tests
  • test_tools.py: Tool detection tests
  • test_projects.py: Project management tests
  • test_ui.py: UI component tests
  • test_app.py: Application integration tests
  • test_cli.py: CLI entry point tests

๐Ÿ“ Development Guide

Requirements

  • Python: 3.8 or higher
  • Dependencies:
    • rich: Terminal UI rendering
    • prompt-toolkit: Keyboard input handling
    • click: CLI framework
    • platformdirs: 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

  1. Report Bugs: Submit issues on GitHub Issues
  2. Feature Requests: Propose new feature ideas
  3. Code Contributions: Submit Pull Requests
  4. Documentation: Improve docs and examples
  5. Translations: Add new language support

Pull Request Process

  1. Fork the project
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. 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

๐Ÿ™ Acknowledgments

Thanks to these open source projects:

๐Ÿ“Š 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

ai_cli_launcher-3.0.12.tar.gz (302.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_cli_launcher-3.0.12-py3-none-any.whl (167.8 kB view details)

Uploaded Python 3

File details

Details for the file ai_cli_launcher-3.0.12.tar.gz.

File metadata

  • Download URL: ai_cli_launcher-3.0.12.tar.gz
  • Upload date:
  • Size: 302.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ai_cli_launcher-3.0.12.tar.gz
Algorithm Hash digest
SHA256 31df0626f0543fca5fe8b31572d7178912b9a8c7bfcbc49e63e3e37b4c9eb1ad
MD5 cee644866e7eb03b6b55adff57016f09
BLAKE2b-256 3e92d0c60d8ec4c24c98dc9c1a9ceb26f5ca76c16daaf8129a958dded8c4db5d

See more details on using hashes here.

File details

Details for the file ai_cli_launcher-3.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_cli_launcher-3.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 d5617c3359242961730ba9651238f48e91049c3dc61ab490553db669a9c8581b
MD5 5e8ce25b70eb532a9e30a9eba94296af
BLAKE2b-256 45baec87af94446fac8947df1ba85936f30d8172d96c6de319c35b9feb909821

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page