Merge pull request #239 from yunyingk/mac15/skill-install-and-wsl-gitea-sync
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Add tool installation to skill and Git mirror sync to WSL worker
This commit is contained in:
6 files changed
+80
-4
No files matched your search
@@ -76,7 +76,7 @@ Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`,
|
||||
4. Release branch creation (`codex/release-vX.Y.Z`), commit, and push to `origin`.
|
||||
5. GitHub PR creation, CI monitoring, and merge.
|
||||
6. Main branch fast-forward (`git pull --ff-only origin main`).
|
||||
7. Annotated tag creation (`vX.Y.Z`) and push to `origin` (`git push origin refs/tags/vX.Y.Z`).
|
||||
7. Annotated tag creation (`vX.Y.Z`) and push to `origin` (`git push origin refs/tags/vX.Y.Z`), with synchronous best-effort mirror to `home` (Gitea).
|
||||
8. Clean removal of temporary release branch.
|
||||
|
||||
2. **Manual Protected-Branch Release & Workspace Isolation (Reference)**:
|
||||
@@ -104,7 +104,7 @@ Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`,
|
||||
git push origin refs/tags/vX.Y.Z
|
||||
```
|
||||
- GitHub Actions (`release.yml`) is responsible only for cross-compiling all 5 target binaries and publishing the GitHub Release.
|
||||
- **Gitea Pull-Based Promotion**: Do not manually push branches or tags to `home` (Gitea). On WSL (`wsl-dev`), `seal-use-release-sync.timer` polls the latest GitHub Release every 15 minutes (or can be triggered immediately via `systemctl start seal-use-release-sync.service`), pulls the release and assets from GitHub into Gitea (`wsl-infra/systemd/`).
|
||||
- **Gitea Pull-Based Promotion & Mirroring**: On WSL (`wsl-dev`), `seal-use-release-sync.timer` polls GitHub every 15 minutes (or can be triggered immediately via `systemctl start seal-use-release-sync.service`), mirrors Git repository refs (branches and tags) and pulls release assets into Gitea (`wsl-infra/systemd/`).
|
||||
- The workflow enforces the merge-before-tag rule rather than trusting the operator: `release.yml` refuses to publish unless the tagged commit is an ancestor of `origin/main`. Actions in both workflows are pinned to commit SHAs rather than moving tags for supply-chain integrity.
|
||||
|
||||
## Security & Configuration Tips
|
||||
|
||||
@@ -203,6 +203,15 @@ try {
|
||||
console.log(`📤 推送 Tag ${tag} 到 origin (GitHub,触发 Release 构建)...`);
|
||||
run(`git push origin refs/tags/${tag}`);
|
||||
|
||||
try {
|
||||
console.log(`📤 同步推送主干分支与 Tag ${tag} 到 home (Gitea)...`);
|
||||
run("git push home main");
|
||||
run(`git push home refs/tags/${tag}`);
|
||||
console.log("✓ Gitea 镜像主干与 Tag 已同步!");
|
||||
} catch (err) {
|
||||
console.warn("⚠️ 同步 Gitea 镜像失败(非致命,将由 WSL 定时服务兜底):", err);
|
||||
}
|
||||
|
||||
// 9. Cleanup
|
||||
console.log("\n🧹 步骤 8/8: 清理临时发布分支...");
|
||||
run(`git branch -d ${releaseBranch}`);
|
||||
|
||||
@@ -10,6 +10,39 @@ metadata:
|
||||
|
||||
CLI 是主执行通道。机器通道 `stdout` 必须是纯 JSON;诊断日志、进度和下一步建议写入 `stderr`。插件不带 MCP;本地 MCP 需显式 `seal-use mcp` 启动。
|
||||
|
||||
## 工具就绪检测与安装 (Bootstrap & Installation)
|
||||
|
||||
在执行具体业务前,先通过 `command -v seal-use` 检查 CLI 是否已就绪。若命令未安装或需要升级:
|
||||
|
||||
### 1. 一键免环境安装(推荐)
|
||||
独立预编译原生二进制分发,无需 Node.js 或 Bun 运行环境,自动识别系统架构(macOS Apple Silicon/Intel、Linux x64/arm64):
|
||||
```bash
|
||||
# 国内高速镜像(免代理推荐,秒级完成)
|
||||
curl -fsSL https://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash
|
||||
|
||||
# GitHub 直连
|
||||
curl -fsSL https://raw.githubusercontent.com/yunyingk/seal-use/main/scripts/install.sh | bash
|
||||
```
|
||||
|
||||
### 2. 下载预编译原生二进制
|
||||
亦可从 Releases 页面直接下载对应平台可执行文件并放入 PATH:
|
||||
- **Gitea Releases(国内高速)**:`https://git.ying-qing.cn/gitea/seal-use/releases`
|
||||
- **GitHub Releases**:`https://github.com/yunyingk/seal-use/releases/latest`
|
||||
|
||||
### 3. 安装后初始化与激活
|
||||
```bash
|
||||
seal-use version # 校验安装版本与架构
|
||||
seal-use skill install # 同步/安装 Agent Skill 到 ~/.agents/skills/seal-use(支持 Codex / Cursor / Antigravity)
|
||||
seal-use mcp-config # 输出 MCP 配置 JSON 片段(供 Cursor / Claude Desktop 使用)
|
||||
seal-use update # 在线自升级至最新版本
|
||||
seal-use doctor # 运行环境与已接入租户健康诊断
|
||||
```
|
||||
|
||||
### 4. 开发者源码覆盖(本地开发环境)
|
||||
```bash
|
||||
bun run dev:override # 编译本机二进制、打版本号并原子覆盖全局命令与本地 Skill
|
||||
```
|
||||
|
||||
## 时间与输出
|
||||
|
||||
- 机器字段统一使用带 `+08:00` 北京时间偏移的 ISO 8601 秒级格式,不带毫秒,例如 `2026-09-28T11:51:09+08:00`。
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ Release. On WSL, `seal-use-release-sync.timer` polls the latest release every
|
||||
|
||||
The first archive becomes available as soon as it is present in Gitea.
|
||||
The remaining assets retry idempotently on later timer runs if needed.
|
||||
Promotion only mirrors release assets; it does not update package-manager repositories.
|
||||
Promotion mirrors all published release assets as well as Git repository branches and tags to the local Gitea mirror. It does not update package-manager repositories.
|
||||
|
||||
The WSL worker uses its local mihomo listener at `http://127.0.0.1:7897` only
|
||||
for GitHub. It does not enable TUN or expose a LAN listener. Local Gitea
|
||||
|
||||
@@ -16,6 +16,7 @@ NO_PROXY_LIST="${NO_PROXY:-127.0.0.1,localhost,100.82.151.105,git.ying-qing.cn}"
|
||||
GITHUB_TOKEN_FILE="${SEAL_USE_GITHUB_TOKEN_FILE:-$HOME/.config/seal-use/github-token}"
|
||||
GITEA_TOKEN_FILE="${SEAL_USE_GITEA_TOKEN_FILE:-$HOME/.config/seal-use/gitea-token}"
|
||||
LOCK_FILE="${SEAL_USE_SYNC_LOCK_FILE:-$STATE_DIR/sync.lock}"
|
||||
GIT_MIRROR_DIR="${SEAL_USE_SYNC_GIT_MIRROR_DIR:-$STATE_DIR/repo.git}"
|
||||
|
||||
mkdir -p "$STATE_DIR" "$WORK_DIR"
|
||||
exec 9>"$LOCK_FILE"
|
||||
@@ -67,6 +68,39 @@ gitea_curl() {
|
||||
return "$rc"
|
||||
}
|
||||
|
||||
sync_git_repo() {
|
||||
log "synchronizing Git repository refs (branches and tags) to Gitea"
|
||||
if [ ! -d "$GIT_MIRROR_DIR" ]; then
|
||||
log "initializing bare mirror repository at $GIT_MIRROR_DIR"
|
||||
mkdir -p "$GIT_MIRROR_DIR"
|
||||
git init --bare "$GIT_MIRROR_DIR" >/dev/null
|
||||
fi
|
||||
|
||||
local gh_url="https://github.com/${GITHUB_REPO}.git"
|
||||
local gitea_url="${GITEA_BASE}/${GITEA_REPO}.git"
|
||||
|
||||
log "fetching latest refs from GitHub ($GITHUB_REPO)"
|
||||
if ! env HTTP_PROXY="$PROXY_URL" HTTPS_PROXY="$PROXY_URL" ALL_PROXY= NO_PROXY="$NO_PROXY_LIST" \
|
||||
git --git-dir="$GIT_MIRROR_DIR" \
|
||||
-c http.extraHeader="Authorization: Bearer ${GITHUB_TOKEN}" \
|
||||
fetch --prune --tags --force "$gh_url" '+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*' >&2; then
|
||||
log "warning: failed to fetch Git refs from GitHub; skipping Git mirror push this run"
|
||||
return 0
|
||||
fi
|
||||
|
||||
log "mirroring refs to Gitea ($GITEA_REPO)"
|
||||
if ! env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY NO_PROXY="$NO_PROXY_LIST" \
|
||||
git --git-dir="$GIT_MIRROR_DIR" \
|
||||
-c http.extraHeader="Authorization: token ${GITEA_TOKEN}" \
|
||||
push --prune --tags --force "$gitea_url" '+refs/heads/*:refs/heads/*' '+refs/tags/*:refs/tags/*' >&2; then
|
||||
log "warning: failed to push Git refs to Gitea; will retry next timer"
|
||||
return 0
|
||||
fi
|
||||
log "Git repository refs successfully synchronized to Gitea"
|
||||
}
|
||||
|
||||
sync_git_repo
|
||||
|
||||
release_json=$(github_curl -H 'Accept: application/vnd.github+json' \
|
||||
"https://api.github.com/repos/$GITHUB_REPO/releases/latest") || die "cannot read latest GitHub release"
|
||||
tag=$(jq -r '.tag_name // empty' <<< "$release_json")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[Unit]
|
||||
Description=Promote GitHub releases to Gitea
|
||||
Description=Promote GitHub releases and mirror repository refs to Gitea
|
||||
After=network-online.target docker.service mihomo.service
|
||||
Wants=network-online.target
|
||||
Requires=mihomo.service
|
||||
|
||||
Reference in new issue
Block a user