git-ferry

command module
v1.19.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 15 Imported by: 0

README

GitFerry

Chinese name 「摆渡」— ferry your code where it belongs: between intranets, out to the open-source world, and into backup harbors.

CI Release Go Report Card Go Version License Latest Release

中文文档

Install · Web Console · CLI & Agent Skills · Ops · Config · Contributing

GitFerry is a self-hosted hub for Git repositories: sync across platforms, publish to the open-source world (dual-identity module mirrors), and back up — all in one place. Ships with a Vue web console, a gitferry CLI, and AI Agent Skills.

Why GitFerry?

  • Multi-platform sync — GitHub / GitLab / Gitee / GitLink / self-hosted; cron + webhook
  • Mirror hub — open-source publishing (module path rewrite snapshots, pre-check / build gate / divergence confirm) and repo backup
  • Ops-ready — health score, inventory, RPO, drift detection, audit hash chain, DR drills
  • Agent-Native — gitferry CLI with structured Envelope output + installable Agent Skills
  • AI assistant — eino-based chat ops (29 tools, dangerous ops require confirmation)
  • Self-hosted — SQLite or MySQL, Docker or binary, MIT licensed

Features

Area Capabilities
Sync Multi-platform, cron, webhook, wiki, submodules, partial clone
Mirror Module identity rewrite, dual-repo publish, backup channels
Ops Metrics, failure retry, health score, inventory, templates, audit export
Backup Git bundle + rotation, Merkle manifest, S3/WebDAV/Azure destinations, metadata snapshot
DR DR drill (restore + fsck + refs), RPO/RTO, drift detection
Governance RBAC (admin/operator/readonly), OIDC JWT, audit hash chain, legal hold
AI eino assistant, plan mode, memory, permission tiers, confirm cards
Interfaces Web console, REST API, gitferry CLI, Agent Skills

Installation

From Release

Download the latest binary from Releases:

  • git-ferry-{linux,darwin,windows}-{amd64,arm64} — server
  • gitferry_{version}_{os}_{arch}.{tar.gz|zip} — CLI
From Source
git clone https://github.com/yi-nology/git-ferry.git
cd git-ferry
make build        # server: output/git-ferry
make build-cli    # CLI:   output/gitferry

Requires Go 1.26+. Frontend build needs Node.js 20+.

Docker
make docker-build

Quick Start

cp .env.example .env
# set ENCRYPTION_KEY (see Configuration)
make run
# open http://localhost:8890

Web Console

Vue 3 + Ant Design Vue console, styled after GitHub Enterprise / Linear ops tools (neutral palette, metrics-first dashboard).

Entry What it does
Dashboard Metrics + failed tasks “needs attention” + recent sync/repos
Sync tasks / History Task CRUD, filters, batch ops, run detail
Repos / Mirror hub Repo cards, unified config, publish & backup channels
Webhook rules / Events Trigger rules and inbound event stream
Ops center Health score, inventory, templates, deploy keys, cold backup
AI assistant Floating ball / top bar; configure model under System
CLI / Agent System → CLI / Agent: install gitferry, Skills, command cheatsheet
Platforms Git host credentials and connection tests

Login Dashboard Sync tasks

More screenshots: docs/screenshots/. Frontend dev: frontend/README.md.

CLI & Agent Skills

Agent-Native tooling inspired by gitlink-cli.

gitferry CLI
export GITFERRY_BASE_URL=http://127.0.0.1:8890
export GITFERRY_TOKEN=your-api-key        # maps to X-API-Key

gitferry auth status
gitferry task +list --format json
gitferry history +list --task t1 --format json
gitferry ops +health --format json
gitferry api GET /api/v1/system/status --format json
  • Output is a unified Envelope: {ok, data, error, meta}
  • Dangerous shortcuts (task +run, ops +drill, …) require confirmation; scripts pass --yes
  • Shortcuts (+list / +info / …) for high-frequency ops; gitferry api for everything else

Install via npm (after release):

npm install -g gitferry-cli
gitferry-install-skills
Agent Skills

skills/ ships structured knowledge for Claude Code / MiMo / Cursor:

Skill Covers
gitferry-shared Auth, Envelope, safety rules
gitferry-repo / gitferry-task / gitferry-history Repos, tasks, run history
gitferry-ops / gitferry-workflow Ops checks, failure triage, DR drills
make install-skills
# or: npx skills add ./skills -y -g

Design notes: docs/superpowers/plans/2026-09-30-agent-native-cli-skills.md.

Ops Center

Borrowing ideas from gickup / ghorg / Renovate / Scorecards:

Capability Entry
Prometheus metrics GET /metrics
Failure compensation runwatch + auto retry; /api/v1/ops/retry
Notifications ntfy / gotify + success/fail heartbeats (healthchecks.io)
Health score /api/v1/ops/health-score (gold/silver/bronze/basic)
Inventory /api/v1/ops/inventory (orphan repos)
Policy templates /api/v1/ops/templates + preview/apply (dry-run)
Audit export /api/v1/ops/audit-report?format=csv
Deploy keys /api/v1/ops/deploy-key (Ed25519)
Cold backup git_bundle + sync.backup_dir rotation
DR drill /api/v1/ops/dr-drill + RPO /api/v1/ops/rpo
Integrity Merkle root manifest + verify
Metadata snapshot issues/PR/releases + archives + gists
Multi-destination sync.backup_destinations (s3/webdav/azure/local)
Lifecycle auto-discover, drift, force-push policy
Governance RBAC, OIDC, audit chain, legal_hold
Rebuild /api/v1/ops/rebuild (fresh full fetch)
GitHub archive /api/v1/ops/migration (Migration API tar.gz)

Config: conf/config.example.yaml → runwatch / notify sections.

AI Assistant (eino)

Built on CloudWeGo eino. Disabled by default.

Enable in System → AI Assistant: pick a preset (OpenAI / DashScope / DeepSeek / Ollama / vLLM / custom) or set API Base URL, choose model (or fetch list), set API Key, Save (hot reload, no restart).

29 tools covering queries, health, inventory, RPO, integrity, drift, audit, failure diagnosis, memory (plan_mode / remember / recall), and confirmed dangerous ops (run_task, connection tests, DR drill).

Safety: read-only by default; git credentials and model keys never enter prompts/logs; no destructive tools without UI confirmation.

Method Path Notes
GET /api/v1/ai/status 501 = disabled
POST /api/v1/ai/chat SSE chat
GET /api/v1/ai/config config (key masked)
POST /api/v1/ai/config save + hot reload
POST /api/v1/ai/config/test probe OpenAI-compatible endpoint

Configuration

Environment
Variable Required Description
ENCRYPTION_KEY Yes AES-256-GCM key for credential storage
GITFERRY_TOKEN CLI API key for gitferry CLI (X-API-Key)
GIT_SYNC_AI_API_KEY AI AI assistant API key (optional)
GIT_SYNC_TOKEN_<NAME> Ops Injected platform tokens (never in request body)
cp .env.example .env
openssl rand -base64 32   # generate ENCRYPTION_KEY
Config file
server:
  host: "0.0.0.0"
  port: 8890

database:
  driver: sqlite
  dsn: "data/git_sync.db"
Repository Import path Role
git-sync-core github.com/yi-nology/git-ferry-core Sync engine library (no HTTP)
git-ferry (this repo) github.com/yi-nology/git-ferry Public shell: hz API + Vue UI + CLI
git-sync-intranet github.com/yi-nology/git-sync-intranet Intranet shell (gateway/SSO auth)

Single-repo build works (git clone + go build). Local core workspace: go work init . ../git-sync-core (do not commit go.work or replace).

Development

make tidy && make test && make lint
make build && make build-cli
make apidoc          # regenerate docs/openapi.json
cd frontend && npm ci && npm run build

See CONTRIBUTING.md and ARCHITECTURE.md.

Security

Please report vulnerabilities privately — see SECURITY.md.

Contributing

  1. Fork and branch (git checkout -b feature/amazing-feature)
  2. Keep make test / make lint green
  3. Open a PR using the template

License

MIT — see LICENSE.

Project Stats

Metric Value
Test Files 19
Total Tests 104

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
biz
serve
Package serve 提供公网/内网壳共用的 HTTP 启动能力: JSON recovery、gzip、完整路由注册、信号驱动的优雅退出。
Package serve 提供公网/内网壳共用的 HTTP 启动能力: JSON recovery、gzip、完整路由注册、信号驱动的优雅退出。
cmd
aistub command
aistub 是 OpenAI /chat/completions 兼容的本地桩,用于 AI 助手链路实测: 按用户消息关键词脚本化返回「先调工具 → 再总结」两轮行为。
aistub 是 OpenAI /chat/completions 兼容的本地桩,用于 AI 助手链路实测: 按用户消息关键词脚本化返回「先调工具 → 再总结」两轮行为。
apidoc command
apidoc 解析 idl/*.thrift 生成 docs/openapi.json(OpenAPI 3.0), 服务端经 internal/pkg/swagger 内嵌 Swagger UI 消费该文件。
apidoc 解析 idl/*.thrift 生成 docs/openapi.json(OpenAPI 3.0), 服务端经 internal/pkg/swagger 内嵌 Swagger UI 消费该文件。
gitferry command
internal
agent
Package agent 提供 git-ferry 的 AI 助手能力(eino 编排层)。
Package agent 提供 git-ferry 的 AI 助手能力(eino 编排层)。
agent/memory
Package memory 提供 AI 助手的持久记忆(借鉴 zcode memory extraction/recall)。
Package memory 提供 AI 助手的持久记忆(借鉴 zcode memory extraction/recall)。
agent/tools
Package tools 把 corebridge 能力包装为 eino 工具。
Package tools 把 corebridge 能力包装为 eino 工具。
agent/tools/toolstest
Package toolstest 提供跨包共用的测试基建:SyncService mock 与脚本化假模型。
Package toolstest 提供跨包共用的测试基建:SyncService mock 与脚本化假模型。
cli/schema
Package schema 从内嵌 OpenAPI 生成 API 自省视图,供 `gitferry schema` 使用。
Package schema 从内嵌 OpenAPI 生成 API 自省视图,供 `gitferry schema` 使用。
githubapi
Package githubapi 封装 GitHub REST 专属能力(release 附件、gists), 与业务 handler 解耦:只依赖 corebridge 模型与标准库 HTTP。
Package githubapi 封装 GitHub REST 专属能力(release 附件、gists), 与业务 handler 解耦:只依赖 corebridge 模型与标准库 HTTP。
gitserve
Package gitserve 只读 Git Smart HTTP:局域网/灾备场景直接 `git clone` 冷备或 workdir 中的 bare/mirror 仓库,不必先推到另一 forge。
Package gitserve 只读 Git Smart HTTP:局域网/灾备场景直接 `git clone` 冷备或 workdir 中的 bare/mirror 仓库,不必先推到另一 forge。
health
Package health 实现仓库/任务健康评分的可配置规则 DSL(借鉴 Port Scorecards)。
Package health 实现仓库/任务健康评分的可配置规则 DSL(借鉴 Port Scorecards)。
mcp
Package mcp 提供 MCP Streamable HTTP 端点,把 internal/agent/tools 注册表 暴露给 Claude Code / Cursor 等外部客户端。
Package mcp 提供 MCP Streamable HTTP 端点,把 internal/agent/tools 注册表 暴露给 Claude Code / Cursor 等外部客户端。
metrics
Package metrics 提供零依赖的 Prometheus 文本格式指标。
Package metrics 提供零依赖的 Prometheus 文本格式指标。
notify
Package notify 提供同步结果的多通道通知与存活心跳。
Package notify 提供同步结果的多通道通知与存活心跳。
orgmap
Package orgmap 实现仓库 owner 映射策略(对标 gitea-mirror org_mapping)。
Package orgmap 实现仓库 owner 映射策略(对标 gitea-mirror org_mapping)。
pkg/swagger
Package swagger 内嵌 OpenAPI 文档与 Swagger UI,服务启动即可浏览 API 文档。
Package swagger 内嵌 OpenAPI 文档与 Swagger UI,服务启动即可浏览 API 文档。
pkg/textutil
Package textutil 收敛文本/路径安全化、CSV 与小工具,消除散落实现。
Package textutil 收敛文本/路径安全化、CSV 与小工具,消除散落实现。
runwatch
Package runwatch 轮询同步执行历史,把「运行结束」事件转成通知/指标/失败补偿。
Package runwatch 轮询同步执行历史,把「运行结束」事件转成通知/指标/失败补偿。
tpl
Package tpl 提供同步策略模板库(借鉴 Renovate packageRules/presets)。
Package tpl 提供同步策略模板库(借鉴 Renovate packageRules/presets)。
version
Package version 提供服务版本号。
Package version 提供服务版本号。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL