Skip to content

PortifyLabs/codepilot-cli

CodePilot CLI

A powerful CLI tool for code migration and analysis between different programming languages.


🚀 Features

  • 🔄 Code Migration: Migrate code between different programming languages
  • 📊 Code Analysis: Analyze code structure and dependencies
  • 🔍 Code Comparison: Compare source and target code
  • ⚙️ Configuration Management: Manage tool settings

📦 Prerequisites

  • Python >= 3.13
  • uv (Python package installer)

🔧 Installation

1. Install uv if you haven't already:

pip install uv

2. Clone the repository:

git clone <your-repository-url>
cd codepilot-cli

3. Create a virtual environment and install dependencies:

🐧 macOS / Linux

uv venv 
source .venv/bin/activate
uv pip install -e .

🪟 Windows (Command Prompt)

uv venv .venv
.venv\Scripts\activate
uv pip install -e .
pip install python-magic
pip install python-magic-bin
uv tool update-shell

🛠️ Usage

▶️ Migrate Code Across Languages with AI

The migrate command translates source code files or entire projects from one programming language to another using AI, while preserving your folder structure and skipping unsupported or binary files.

Basic Command

codepilot migrate <source_path> --target-lang <language> [options]

Required Arguments:

  • <source_path>: Path to the source file or directory to migrate.
  • --target-lang, -t: Target language (e.g., python, java, javascript).

Optional Arguments:

  • --source-lang, -s: Source language (auto-detected if not specified).
  • --output-dir, -o: Output directory for migrated code. Required unless using --dry-run.
  • --dry-run: Analyze files and show what would be migrated, but do not write any output files.
  • --analysis-report : --analysis-report: Path to an analysis JSON file containing migration configuration such as target framework, version, and custom notes

Examples:

  • Migrate a single file from Python to Java:
codepilot migrate src/main.py --target-lang java -o out/
  • Migrate src from Python to Java:
codepilot migrate ./src -t java -s python -o ./out 
  • Migrate src from Python to Java using custom json file:
codepilot migrate src --analysis-report D:\codepilot-cli\src\codepilot-reports\hi.json --target-lang java --output-dir migrated_code

📊 Analyze Code

codepilot analyze <source_path> [options]

Options:

  • -s, --source-lang: Source language (auto-detected if not specified)

🔍 Compare Code

codepilot compare <source_path> <target_path>

⚙️ Manage Configuration

codepilot config --show                # Show current configuration
codepilot config --set key=value       # Set configuration option

🧪 Development

1. Create a development environment:

uv venv
source .venv/bin/activate  # On Unix/macOS

2. Install development dependencies:

uv tool install -e ".[dev]"

🤝Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Alt

About

A powerful CLI tool for code migration and analysis between different programming languages.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •