From 1a44645a0238a676962bf4940344ca70fa81d0e0 Mon Sep 17 00:00:00 2001 From: zyj Date: Mon, 9 Mar 2026 16:49:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20README=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++ README_CN.md | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 296 insertions(+) create mode 100644 README.md create mode 100644 README_CN.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b3d9ec4 --- /dev/null +++ b/README.md @@ -0,0 +1,148 @@ +# GitPilot + +[中文文档](README_CN.md) + +A cross-platform desktop Git repository management tool built with **Go + Wails v3 + Nuxt 4 + Vue 3**. + +Manage multiple Git repositories across different platforms (GitHub, Gitee, Gitea, etc.) from a single unified interface — like a lightweight, standalone version of VS Code's Git panel. + +![Go](https://img.shields.io/badge/Go-1.25-00ADD8?logo=go&logoColor=white) +![Wails](https://img.shields.io/badge/Wails-v3-red?logo=go&logoColor=white) +![Vue](https://img.shields.io/badge/Vue-3.5-4FC08D?logo=vue.js&logoColor=white) +![Nuxt](https://img.shields.io/badge/Nuxt-4-00DC82?logo=nuxt.js&logoColor=white) +![License](https://img.shields.io/badge/License-MIT-blue) + +## ✨ Features + +### Multi-Platform Management +- Manage repositories from **GitHub**, **Gitee**, **Gitea**, and custom Git platforms +- Organize projects by **Platform → User → Project** hierarchy +- Add / remove platforms, users, and projects through the GUI + +### VS Code-Style Git Operations +- **View changed files** with a collapsible directory tree structure +- **Stage / Unstage** files individually, by directory, or all at once +- **Commit changes** with a built-in message editor +- **Discard changes** for tracked and untracked files +- **Diff viewer** with syntax-highlighted additions and deletions +- **Binary file detection** — skips preview for images, executables, etc. + +### Commit History +- Browse commit history with author, time, and message +- Click a commit to view its **changed file list** (like VS Code) +- Select a file to view its **per-file diff** +- **Version rollback** — hard / mixed / soft reset with confirmation dialog + +### Branch Management +- View all local branches with current branch indicator +- **Switch branches** via dropdown selector +- **Pull / Push / Fetch** with current branch awareness + +### Desktop Experience +- **System tray** — close window hides to tray, click tray icon to restore +- **Resizable panels** — drag splitters between sidebar, file list, and viewer +- **Dark theme** — Catppuccin Mocha color scheme with Ant Design Vue +- **Native folder picker** — select project paths via OS file dialog + +## 🏗️ Tech Stack + +| Layer | Technology | +|-------|-----------| +| Backend | Go 1.25, Wails v3 (alpha.74) | +| Frontend | Nuxt 4, Vue 3.5, Vite 7 | +| UI Library | Ant Design Vue 4, @ant-design/icons-vue | +| Git Operations | Git CLI with proxy support, 30s timeout | +| Config | YAML-based persistent configuration | +| Build | Taskfile v3 | + +## 📁 Project Structure + +``` +GitPilot/ +├── main.go # Wails app entry, system tray, window management +├── config.yaml # Platform/user/project configuration +├── Taskfile.yml # Build tasks +├── go.mod +├── cmd/ # CLI utilities +├── config/ +│ └── config.go # YAML config loader/saver +├── internal/ +│ ├── proxy.go # System proxy detection +│ ├── git/ +│ │ └── client.go # Git CLI wrapper (34 operations) +│ └── app/ +│ └── service.go # AppService — 34 methods exposed to frontend +├── frontend/ +│ ├── nuxt.config.ts +│ ├── package.json +│ └── app/ +│ ├── pages/ +│ │ └── index.vue # Main layout with resizable sidebar +│ ├── layouts/ +│ │ └── default.vue # Ant Design dark theme provider +│ └── components/ +│ ├── Sidebar.vue # Platform/user/project tree sidebar +│ ├── ContentArea.vue # Git status, diff, history, branches +│ └── FileTreeNode.vue # Recursive file tree with actions +└── build/ # Wails build configuration +``` + +## 🚀 Getting Started + +### Prerequisites + +- [Go](https://golang.org/dl/) 1.25+ +- [Node.js](https://nodejs.org/) 18+ +- [Git](https://git-scm.com/) +- [Task](https://taskfile.dev/) (optional, for build tasks) +- [Wails v3 CLI](https://v3alpha.wails.io/) + +### Development + +```bash +# Clone the repository +git clone https://github.com/zhuy1228/GitPilot.git +cd GitPilot + +# Install frontend dependencies +cd frontend && npm install && cd .. + +# Generate Wails bindings +wails3 generate bindings + +# Build frontend +cd frontend && npx nuxi generate && cd .. + +# Run in development mode +task dev +# or +wails3 dev -config ./build/config.yml -port 9245 +``` + +### Build for Production + +```bash +task build +``` + +The binary will be output to the `bin/` directory. + +## 📋 API Overview + +GitPilot exposes **34 backend methods** to the frontend via Wails bindings: + +| Category | Methods | +|----------|---------| +| **Projects** | GetProjectTree, AddProject, RemoveProject, SelectDirectory | +| **Platforms** | AddPlatform, UpdatePlatform, RemovePlatform, GetPlatformInfo | +| **Users** | AddUser, UpdateUser, RemoveUser, GetUserInfo | +| **Git Status** | GetProjectStatus, GetProjectChangedFiles, GetFileContent, GetFileDiff, GetFileDiffStaged | +| **Staging** | StageFiles, UnstageFiles, StageAll, UnstageAll | +| **Commit** | CommitChanges, DiscardFiles | +| **Remote** | PullProject, PushProject, FetchProject | +| **History** | GetCommitLog, GetCommitDiff, GetCommitFiles, GetCommitFileDiff | +| **Branches** | GetBranches, SwitchBranch, ResetProject | + +## 📄 License + +[MIT](LICENSE) diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 0000000..0b99bcd --- /dev/null +++ b/README_CN.md @@ -0,0 +1,148 @@ +# GitPilot + +[English](README.md) + +一款跨平台桌面 Git 仓库管理工具,基于 **Go + Wails v3 + Nuxt 4 + Vue 3** 构建。 + +在统一界面中管理来自不同平台(GitHub、Gitee、Gitea 等)的多个 Git 仓库 —— 类似一个独立的、轻量级的 VS Code Git 面板。 + +![Go](https://img.shields.io/badge/Go-1.25-00ADD8?logo=go&logoColor=white) +![Wails](https://img.shields.io/badge/Wails-v3-red?logo=go&logoColor=white) +![Vue](https://img.shields.io/badge/Vue-3.5-4FC08D?logo=vue.js&logoColor=white) +![Nuxt](https://img.shields.io/badge/Nuxt-4-00DC82?logo=nuxt.js&logoColor=white) +![License](https://img.shields.io/badge/License-MIT-blue) + +## ✨ 功能特性 + +### 多平台管理 +- 管理来自 **GitHub**、**Gitee**、**Gitea** 及自建 Git 平台的仓库 +- 按 **平台 → 用户 → 项目** 层级组织 +- 通过图形界面添加/删除平台、用户和项目 + +### VS Code 风格的 Git 操作 +- 以可折叠的**目录树结构**查看变更文件 +- **暂存/取消暂存** — 支持单文件、整个目录或全部操作 +- 内置提交信息编辑器,一键**提交更改** +- **丢弃更改** — 同时支持已跟踪和未跟踪文件 +- **Diff 查看器** — 语法高亮显示增删内容 +- **二进制文件检测** — 自动跳过图片、可执行文件等的预览 + +### 提交历史 +- 浏览提交历史,显示作者、时间和提交信息 +- 点击提交查看该版本的**变更文件列表**(与 VS Code 一致) +- 选中文件查看**单文件 diff** +- **版本回滚** — 支持硬回滚/混合回滚/软回滚,操作前弹出确认对话框 + +### 分支管理 +- 查看所有本地分支,标记当前分支 +- 通过下拉菜单**切换分支** +- **拉取/推送/获取远程信息**,自动识别当前分支 + +### 桌面体验 +- **系统托盘** — 关闭窗口自动隐藏到托盘,点击托盘图标恢复窗口 +- **可拖拽调整面板** — 侧边栏、文件列表、查看器之间的分隔条可拖拽 +- **暗色主题** — Catppuccin Mocha 配色方案 + Ant Design Vue +- **原生文件夹选择器** — 通过系统对话框选择项目路径 + +## 🏗️ 技术栈 + +| 层级 | 技术 | +|------|------| +| 后端 | Go 1.25, Wails v3 (alpha.74) | +| 前端 | Nuxt 4, Vue 3.5, Vite 7 | +| UI 组件库 | Ant Design Vue 4, @ant-design/icons-vue | +| Git 操作 | Git CLI 封装,支持代理,30 秒超时 | +| 配置 | 基于 YAML 的持久化配置 | +| 构建 | Taskfile v3 | + +## 📁 项目结构 + +``` +GitPilot/ +├── main.go # Wails 应用入口,系统托盘,窗口管理 +├── config.yaml # 平台/用户/项目配置文件 +├── Taskfile.yml # 构建任务 +├── go.mod +├── cmd/ # 命令行工具 +├── config/ +│ └── config.go # YAML 配置加载/保存 +├── internal/ +│ ├── proxy.go # 系统代理检测 +│ ├── git/ +│ │ └── client.go # Git CLI 封装(34 个操作) +│ └── app/ +│ └── service.go # AppService — 34 个方法暴露给前端 +├── frontend/ +│ ├── nuxt.config.ts +│ ├── package.json +│ └── app/ +│ ├── pages/ +│ │ └── index.vue # 主布局,可调整侧边栏宽度 +│ ├── layouts/ +│ │ └── default.vue # Ant Design 暗色主题配置 +│ └── components/ +│ ├── Sidebar.vue # 平台/用户/项目树形侧边栏 +│ ├── ContentArea.vue # Git 状态、Diff、历史、分支 +│ └── FileTreeNode.vue # 递归文件树组件(含操作按钮) +└── build/ # Wails 构建配置 +``` + +## 🚀 快速开始 + +### 环境要求 + +- [Go](https://golang.org/dl/) 1.25+ +- [Node.js](https://nodejs.org/) 18+ +- [Git](https://git-scm.com/) +- [Task](https://taskfile.dev/)(可选,用于构建任务) +- [Wails v3 CLI](https://v3alpha.wails.io/) + +### 开发运行 + +```bash +# 克隆仓库 +git clone https://github.com/zhuy1228/GitPilot.git +cd GitPilot + +# 安装前端依赖 +cd frontend && npm install && cd .. + +# 生成 Wails 绑定 +wails3 generate bindings + +# 构建前端 +cd frontend && npx nuxi generate && cd .. + +# 开发模式运行 +task dev +# 或者 +wails3 dev -config ./build/config.yml -port 9245 +``` + +### 生产构建 + +```bash +task build +``` + +构建产物会输出到 `bin/` 目录。 + +## 📋 API 概览 + +GitPilot 通过 Wails 绑定向前端暴露了 **34 个后端方法**: + +| 类别 | 方法 | +|------|------| +| **项目管理** | GetProjectTree, AddProject, RemoveProject, SelectDirectory | +| **平台管理** | AddPlatform, UpdatePlatform, RemovePlatform, GetPlatformInfo | +| **用户管理** | AddUser, UpdateUser, RemoveUser, GetUserInfo | +| **Git 状态** | GetProjectStatus, GetProjectChangedFiles, GetFileContent, GetFileDiff, GetFileDiffStaged | +| **暂存操作** | StageFiles, UnstageFiles, StageAll, UnstageAll | +| **提交操作** | CommitChanges, DiscardFiles | +| **远程操作** | PullProject, PushProject, FetchProject | +| **提交历史** | GetCommitLog, GetCommitDiff, GetCommitFiles, GetCommitFileDiff | +| **分支管理** | GetBranches, SwitchBranch, ResetProject | + +## 📄 开源协议 + +[MIT](LICENSE)