convez.ai
Agente
loongxjin

forksync

loongxjin/forksync

Ver no GitHub
InicialPluginScore Β· de 0 a 100

πŸ”„ Auto-sync GitHub fork repos with upstream. Resolve merge conflicts using AI agents (Claude Code, OpenCode, Codex). Desktop app (Electron) + CLI.

InstalaΓ§Γ£o

$npx convez-ai loongxjin/forksync

1 comando no terminal: detecta o formato do repositΓ³rio (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

MΓ©tricas

Estrelas
3
Forks
0
Acompanhando
0
SaΓΊde
28%
Último commit
hΓ‘ 4 meses
VersΓ£o
v0.6.0
Issues abertas
0
Contribuidores
1

README

A traduΓ§Γ£o para o portuguΓͺs deste README ainda estΓ‘ na fila.

ForkSync

Auto-sync your GitHub fork repos β€” resolve conflicts with AI.

English Β· δΈ­ζ–‡

Go Electron React License


Why ForkSync?

Maintaining forked repositories is tedious. Upstream authors keep shipping changes, and every sync risks merge conflicts. You either:

  • Forget to sync β€” your fork falls behind, missing bug fixes and features
  • Resolve conflicts manually β€” reading <<<<<<< markers for hours
  • Give up and re-fork β€” losing your local modifications

ForkSync solves this. It automatically syncs your forks and uses AI coding agents (Claude Code, OpenCode, Codex) to resolve merge conflicts β€” so you never have to touch conflict markers again.

Key Features

FeatureDescription
Auto SyncPeriodically fetches and merges upstream changes (configurable interval)
AI Conflict ResolutionDelegates merge conflicts to AI agents with git-aware prompts
Workflow-guided UIStep-by-step workflow: fetch β†’ merge β†’ detect conflicts β†’ agent resolve β†’ review β†’ commit
Live Agent TerminalReal-time streaming view of agent output (stdout, tool calls, errors) during resolution
Desktop AppPolished Electron GUI β€” dashboard, workflow steps, settings
CLIFull-featured command-line tool for terminal workflows
Directory ScannerRecursively scans any directory to discover and batch-add fork repos
Sync HistorySQLite-backed history with filters, AI-generated summaries, and cleanup
System NotificationsDesktop native alerts on sync success, conflicts, or errors
IDE IntegrationOpen repos directly in VSCode, Cursor, or Trae
Post-sync CommandsExecute custom scripts after a successful sync (e.g. pip install, npm build)
i18nMulti-language interface (Chinese / English)
Multiple AgentsSwitch between Claude Code and OpenCode freely

Install

Download

Grab the latest release for your platform:

PlatformFormatLink
macOS.dmgReleases
Linux.AppImageReleases
Windows.exe (NSIS)Releases

Build from Source

git clone https://github.com/loongxjin/forksync.git
cd forksync

# Full build (Go engine + Electron app)
make build
# Output: app/dist/

CLI Only

cd engine && go build -o forksync . && ./forksync --help

Quick Start

1. Configure GitHub Token (Recommended)

mkdir -p ~/.forksync

Edit ~/.forksync/config.yaml:

github:
  token: "ghp_your_token_here"

Token is optional but recommended β€” it enables automatic upstream detection via GitHub API.

2. Add Repos

# Add a single repo
forksync add ~/projects/my-fork

# Scan a directory to batch-discover fork repos
forksync scan ~/projects

3. Sync

# Sync all repos
forksync sync --all

# Sync a specific repo
forksync sync my-fork

# Start background sync service (every 30 min)
forksync serve

4. Resolve Conflicts with AI

# Resolve conflicts using AI (interactive)
forksync resolve my-fork

# Use a specific agent, auto-commit
forksync resolve my-fork --agent opencode --no-confirm

# Accept / reject a resolution
forksync resolve my-fork --accept
forksync resolve my-fork --reject

5. Launch Desktop App

cd app && npm install && npm run dev

AI Conflict Resolution

This is the core feature that sets ForkSync apart. When a sync produces merge conflicts, ForkSync can automatically delegate resolution to an AI coding agent:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    conflict     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    resolve    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Upstream   β”‚ ──────────────▢ β”‚  ForkSync     β”‚ ────────────▢│  AI Agent      β”‚
β”‚   Change     β”‚                 β”‚  detects      β”‚              β”‚  (Claude /     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β”‚  conflict     β”‚              β”‚   OpenCode)    β”‚
                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                                       β”‚ resolved
                                                                       β–Ό
                                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                β”‚  ForkSync     β”‚ ◀───────────│  Verify &      β”‚
                                β”‚  commits      β”‚   commit    β”‚  Stage         β”‚
                                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Supported Agents:

AgentBinaryAuto-detected
Claude Codeclaudeβœ…
OpenCodeopencodeβœ…
Codexcodexβœ…

Agents are auto-discovered via PATH. Set a preferred agent in config:

agent:
  preferred: "claude"

Conflict resolution strategies:

StrategyConfig keyBehavior
Auto-resolve with agentconflict_strategy: agent_resolveAgent resolves conflicts automatically
Manual resolveconflict_strategy: manualPause at workflow β€” user chooses to resolve with agent or manually
Preserve localresolve_strategy: preserve_oursAgent told to keep local changes, accept upstream non-conflicting
Preserve upstreamresolve_strategy: preserve_theirsAgent told to prefer upstream changes
Balancedresolve_strategy: balancedAgent told to smart-merge preserving both sides

Confirmation modes:

ConfigBehavior
confirm_before_commit: trueAfter agent resolves, wait for user review and accept/reject
confirm_before_commit: falseAuto-commit immediately after agent resolves

Post-sync Commands:

Run custom scripts after each successful sync:

forksync post-sync add my-repo --name "install" --cmd "pip install -e ."
forksync post-sync list my-repo
forksync post-sync remove my-repo --id <cmd-id>

Desktop App

Built with Electron + React + TypeScript + Tailwind CSS + shadcn/ui.

SectionDescription
DashboardOverview: repo statuses, recent sync activity
Repo ListExpandable repo cards with workflow steps or detail panel
Workflow StepsStep-by-step progress: fetch β†’ merge β†’ check conflicts β†’ resolve strategy β†’ agent resolve β†’ accept β†’ commit
Agent TerminalReal-time streaming view of agent output during resolution
AI SummaryAfter resolution, agent's git-history-aware summary in workflow
Diff ViewerSide-by-side diff preview when reviewing changes
HistorySync timeline with filters, AI-generated summaries, and cleanup
SettingsGeneral, agent config, post-sync commands, IDE preferences

Architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       Electron UI (React)          β”‚
β”‚  Dashboard Β· Repos Β· Workflow      β”‚
β”‚  Agent Terminal Β· History          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚ IPC (contextBridge)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     EngineClient (TypeScript)      β”‚
β”‚  Spawns Go binary, parses JSON     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚ --json / --stream flag
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        Go CLI Engine (Cobra)       β”‚
β”‚  add Β· sync Β· resolve Β· serve      β”‚
β”‚  agent Β· config Β· history          β”‚
β”‚  workflow Β· post-sync Β· summarize  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

CLI Reference

All commands support --json for structured output.

# Repository management
forksync add <path> [--upstream <url>]       # Add repo
forksync remove <name>                        # Remove from tracking
forksync scan <directory>                     # Batch-discover fork repos

# Sync
forksync sync [--all | <name>]               # Sync repos
forksync serve [--interval 15m]              # Background sync service
forksync status                              # Show all repo statuses

# AI conflict resolution
forksync resolve <name> [--agent claude] [--no-confirm] [--accept] [--reject]
forksync resolve <name> --stream             # Stream agent output as NDJSON (Electron)

# Workflow management
forksync workflow continue <name> --action {accept|reject|abort|resolve_with_agent|retry_commit|continue_manual}

# Post-sync commands
forksync post-sync list <name>
forksync post-sync add <name> --name <name> --cmd <command>
forksync post-sync remove <name> --id <cmd-id>

# AI summarization
forksync summarize <name> [--retry]          # Generate AI summary for last sync

# Agent management
forksync agent list                          # Detect installed agents
forksync agent sessions                      # List active sessions
forksync agent cleanup                       # Remove expired sessions
forksync agent reset <name>                  # Remove session for specific repo

# Configuration
forksync config get                          # Show all config
forksync config set <key> <value>            # Set config value
forksync config keys                         # List available keys

# History
forksync history [--limit 20] [--cleanup [--keep-days 30]]

Configuration

Location: ~/.forksync/config.yaml

sync:
  default_interval: "30m"
  sync_on_startup: true
  auto_launch: false
  auto_summary: true
  summary_agent: "claude"
  summary_language: "zh"               # zh / en
  summary_timeout: "3m"

agent:
  preferred: "claude"
  priority: [claude, opencode, codex]
  timeout: "10m"
  conflict_strategy: "agent_resolve"   # agent_resolve / manual
  resolve_strategy: "preserve_ours"    # preserve_ours / preserve_theirs / balanced
  confirm_before_commit: true
  session_ttl: "24h"

github:
  token: ""

notification:
  enabled: true

proxy:
  enabled: false
  url: ""

Data files:

PathPurpose
~/.forksync/config.yamlUser configuration
~/.forksync/repos.jsonManaged repository list
~/.forksync/sessions/<id>.jsonAgent session records
~/.forksync/agent-logs/<repo>/Agent stream log files (NDJSON)
~/.forksync/db/sync_history.dbSQLite sync history
~/.forksync/logs/sync-*.logDaily-rotated log files

Project Structure

forksync/
β”œβ”€β”€ engine/                      # Go CLI engine
β”‚   β”œβ”€β”€ cmd/                     # Cobra commands (sync, resolve, workflow, agent, etc.)
β”‚   β”œβ”€β”€ internal/
β”‚   β”‚   β”œβ”€β”€ agent/               # AI agent adapters (Claude, OpenCode, Codex)
β”‚   β”‚   β”‚   └── session/         # Session lifecycle management
β”‚   β”‚   β”œβ”€β”€ config/              # Viper-based YAML config
β”‚   β”‚   β”œβ”€β”€ conflict/            # Merge conflict detection
β”‚   β”‚   β”œβ”€β”€ git/                 # Git operations (native + CLI)
β”‚   β”‚   β”œβ”€β”€ history/             # SQLite sync history store
β”‚   β”‚   β”œβ”€β”€ logger/              # File logger with daily rotation
β”‚   β”‚   β”œβ”€β”€ notify/              # Desktop system notifications
β”‚   β”‚   β”œβ”€β”€ repo/                # Repository JSON store (thread-safe)
β”‚   β”‚   β”œβ”€β”€ scheduler/           # Background sync scheduler
β”‚   β”‚   β”œβ”€β”€ summarizer/          # AI-powered sync commit summarizer
β”‚   β”‚   └── sync/                # Core sync pipeline
β”‚   └── pkg/types/               # Shared types
β”‚
β”œβ”€β”€ app/                         # Electron desktop app
β”‚   β”œβ”€β”€ src/main/                # Electron main process + EngineClient
β”‚   β”œβ”€β”€ src/preload/             # Context bridge (window.api)
β”‚   └── src/renderer/            # React UI (pages, components, contexts)
β”‚
β”œβ”€β”€ build/                       # Build scripts
└── docs/                        # Documentation

Testing

cd engine && go test ./... -v

146 tests across 15 test files β€” covering sync pipeline, agent adapters, session management, git operations, conflict detection, config, history, and more.


Development

See Development Guide for setup instructions and architecture details.

License

MIT

Ver o original no GitHub

Bom para

Relacionados