Guanghu Domestic Migration d1e47f4565
Some checks are pending
自动更新代码和重启 / update-and-restart (push) Waiting to run
CI检查 + 自动部署 / check (push) Waiting to run
CI检查 + 自动部署 / deploy (push) Blocked by required conditions
重启聊天服务 / restart (push) Waiting to run
chore: import sanitized domestic snapshot for REPO-002
Source snapshot: ca48d3ddf926d79aa138306164169baf764bb829
2026-07-17 15:54:41 +08:00

50 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# isomorphic-git 拆零件实验报告
## 实验结论
**验证通过。isomorphic-git 可以完全替代 Forgejo Web 界面层。**
## 实验数据
| 实验 | 验证能力 | 结果 | Forgejo 对应功能 |
|------|---------|------|-----------------|
| 实验1 | 读取文件内容 | ✅ README.md (4695字符) + entry-protocol.json (2738字符) | 文件浏览器 |
| 实验2 | 查看提交历史 | ✅ 最近5条提交含完整信息 | 提交页面 |
| 实验3 | 查看仓库状态 | ✅ 发现5个变更文件 | 变更页面 |
| 实验4 | 列出目录 | ✅ brain/ 目录 195 个文件 | 文件列表 |
## 技术要点
- **无依赖**:仅需 `isomorphic-git` (纯 JS约 2MB)
- **零配置**:直接操作 .git 目录,不需要 Forgejo 服务进程
- **Node.js 原生**:不需要额外的数据库或中间件
- **轻量**:一个 Node 进程即可支持所有操作
## 可替代 Forgejo 的全部界面功能
| Forgejo 功能 | isomorphic-git 替代方案 |
|-------------|----------------------|
| 文件浏览 | `git.listFiles()` + `readFile()` |
| 提交历史 | `git.log()` |
| 变更状态 | `git.statusMatrix()` |
| 分支管理 | `git.listBranches()` + `git.branch()` |
| 文件差异 | `fs.readFile()` 对比 |
| 拉取/推送 | `git.push()` + `git.fetch()` |
## 下一步
- 将 isomorphic-git 集成到统一AI交互面板前端直接用 JS 操作 Git
- 保留 Forgejo 的 Git 核心(.git 目录结构),替换界面层
- 用户代码仓库只需要 .git 目录 + 轻量服务器,不需要安装 Forgejo
## 运行命令
```bash
cd /data/guanghulab/repo
npm install isomorphic-git
node scripts/experiments/isomorphic-git-poc/poc.js
```
---
*实验日期: 2026-05-27 · D115 · 铸渊 ICE-GL-ZY001*