upsync
Cross-language project porting and synchronization tool powered by AI agents.
Overview
upsync automates the process of porting projects between programming languages and keeping ports synchronized with upstream changes. It uses AI coding agents (Claude Code, Gemini CLI, or Codex CLI) to translate code while maintaining behavioral equivalence.
Installation
Or build from source:
Prerequisites
At least one AI coding agent must be installed:
- Claude Code (
claude) - Gemini CLI (
gemini) - Codex CLI (
codex)
Usage
Port a New Project
Create a new port of an upstream project:
This will:
- Clone the upstream repository
- Detect the source language
- Create a new project in the target language
- Set up tracking for future synchronization
Initialize an Existing Port
If you've already manually ported a project and want to track upstream changes:
This will:
- Clone the upstream repository to
.upstream-cache/ - Detect source and target languages
- Create configuration files for sync tracking
Check for Upstream Changes
Fetches the latest upstream commits and reports how many lines have changed since the last sync.
Sync with Upstream
The sync command:
- Fetches upstream changes
- Generates a diff since the last sync
- Invokes the AI agent to apply equivalent changes
- Runs verification to ensure the build passes
- Updates the sync state
Configuration
upstream-sync.yml
Created in your project root:
upstream: https://github.com/org/project
agent: claude # Optional: claude, gemini, or codex (auto-detected if not set)
target_language: rust # Optional: override detected language
verify_command: cargo check # Optional: custom verification command
.upstream-sync/state.json
Tracks synchronization state (managed automatically):
.upstream-cache/
Local clone of the upstream repository used for fetching changes.
Supported Languages
| Language | Extensions | Default Verify Command |
|---|---|---|
| Rust | .rs |
cargo check |
| Go | .go |
go build ./... |
| TypeScript | .ts, .tsx |
npm run build |
| JavaScript | .js, .jsx |
npm run build |
| Python | .py |
python -m py_compile |
| Ruby | .rb |
- |
| Java | .java |
- |
| Kotlin | .kt, .kts |
- |
| Swift | .swift |
- |
| C | .c, .h |
- |
| C++ | .cpp, .hpp, .cc |
- |
| C# | .cs |
- |
How It Works
- Language Detection: Counts file extensions to determine the dominant language
- Diff Generation: Uses git to track changes between synced commits
- AI Translation: Sends structured prompts to AI agents with:
- Source and target language context
- The upstream diff (for sync) or full codebase (for port)
- Verification commands to run
- Retry Loop: If verification fails, the agent is re-invoked with error context (up to 3 attempts)
License
MIT