git proxy: add start/stop/restart daemon lifecycle for FastGitHub.

Background daemons with port/PID tracking and Parallels socat, keep FastGithub logs off the TTY, and document install in the skill.
This commit is contained in:
Zhengshou Lai
2026-08-12 21:12:14 +08:00
parent f6fa1aa93d
commit f8be17fe4f
7 changed files with 611 additions and 106 deletions
+4
View File
@@ -21,6 +21,9 @@ triggers:
- bib转markdown
- avi转mp4
- 更新mytoolkit
- fastgithub
- git proxy
- FastGithub
---
# MyToolkit 个人 CLI 工具集
@@ -72,6 +75,7 @@ mytoolkit completion zsh # 打印 zsh 补全脚本
| LaTeX 编译 | `mytoolkit latex compile paper.tex` |
| BibTeX 转 Markdown | `mytoolkit convert refs.bib -o refs.md` |
| AVI 视频转 MP4 | `mytoolkit convert video.avi -o video.mp4` |
| FastGitHub / git 代理守护 | `mytoolkit git proxy start fastgithub`(安装见 `references/others.md` |
| 更新工具本身 | `cd <xiaohe-agent>/packages/mytoolkit && make install` |
## 安装与更新
+46 -8
View File
@@ -4,12 +4,50 @@
```bash
mytoolkit init paper <dir> # 初始化 LaTeX 论文项目
mytoolkit init manual <dir> # 初始化 LaTeX 手册项目(技术与使用文档)
mytoolkit env # 环境变量管理
mytoolkit git # Git 辅助工具
mytoolkit ssh # SSH 快捷连接
mytoolkit server # 开发服务器管理
mytoolkit update # 从本地仓库更新
mytoolkit uninstall # 卸载
mytoolkit completion # 安装/查看/卸载 shell 补全(install / uninstall / doctor / zsh / bash
mytoolkit env # 环境变量管理
mytoolkit git # Git 辅助(含 proxy 守护进程)
mytoolkit ssh # SSH 快捷连接
mytoolkit server # 开发服务器管理(webpage,非 git proxy
mytoolkit update # 从本地仓库更新
mytoolkit uninstall # 卸载
mytoolkit completion # 安装/查看/卸载 shell 补全(install / uninstall / doctor / zsh / bash
```
## git proxyFastGitHub 等)
配置在 `~/.mytoolkit/config.json``connections.proxy.<name>`(例:`fastgithub``http://127.0.0.1:38457`)。
```bash
mytoolkit git proxy list
mytoolkit git proxy status # 全部守护进程 + git config
mytoolkit git proxy start fastgithub # 后台起进程 + Parallels socat(默认不改 git config
mytoolkit git proxy stop # 停「当前」
mytoolkit git proxy stop fastgithub
mytoolkit git proxy restart # 重启「当前」
mytoolkit git proxy set fastgithub # 仅写 git http(s).proxy
mytoolkit git proxy unset
mytoolkit git proxy run fastgithub # 前台(设 git + Ctrl-C 清理);CI 主机请用 start
```
- `start` / `stop` / `restart`:端口 + PID`lsof`),状态文件 `~/.mytoolkit/run/proxy-current.json`
- CI:主机 `start fastgithub`job 用 `HEYUE_CI_GIT_PROXY=1` / `XIAOHE_CI_GIT_PROXY=1`(勿依赖全局 git proxy
- Parallels guest 需 `brew install socat`;可选 `XIAOHE_CI_PARALLELS_HOST_IP`
### 新机器安装 FastGitHub
上游(自用 fork):https://github.com/creazyboyone/FastGithub
(原 `dotnetcore/fastgithub` 已不可用。)
1. 从 [Releases](https://github.com/creazyboyone/FastGithub/releases) 下载 macOS 包,解压到固定目录(例 `~/Documents/myBin/fastgithub-osx/`)。
2. 把二进制放到 PATH,且命令名与 config 里的 proxy 名一致:
```bash
ln -sf ~/Documents/myBin/fastgithub-osx/fastgithub /opt/homebrew/bin/fastgithub
```
3. 按官方说明信任 `cacert/fastgithub.cer`(macOS 钥匙串);git 走代理时通常还需 `sslVerify=false`CI 已在 `GIT_CONFIG_PARAMETERS` 里处理)。
4. 写入 config(若尚无):
```bash
mytoolkit env set connections.proxy.fastgithub http://127.0.0.1:38457
```
5. 启动:`mytoolkit git proxy start fastgithub` → `mytoolkit git proxy status`
Windows/Linux 也可用官方 `fastgithub start`(系统服务);本 CLI 的 `start` 面向 **Mac 宿主 + Parallels socat** 场景。