Files
image-workbench-desktop/scripts/preflight.sh
T
qiqi 036865a201
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 38s
chore(plugins+preflight): white-bg-800 1.2.3 / blank-canvas 1.0.1 产物 + preflight B1/B2/B3
插件批次(插件仓 e2982e3,产物同步到 plugins/):
- white-bg-800 1.2.3:覆盖模式走 saveNodeImage(落盘校验/失败回滚/可读原因),老宿主回退同步 setNodeImage;
  harness 改为双形态(new/old)并把两处过期断言改对
- blank-canvas 1.0.1:空白判定补 localRef/ref,避免只有本地引用的节点被白图覆盖

preflight / 守卫:
- B1 preflight 第 6 项:扫现行文档里已下线的路径与命令(functions/api、verify:release、plugins-publish、_inbox、wrangler),
  删除线/已弃用豁免;首次运行抓到 4 处仍在教 NAS _inbox 取件的过期说明,改为 tailnet HTTP 流程
- B2 source-text-ratchet 增加 src global.* 写入口棘轮(实测 122,只减不增)
- B3 棘轮上限行必须带「日期 + 相对上一版的差(或基线说明)+ 原因」,否则红(防"谁写谁抬")
2026-12-02 08:53:02 +08:00

32 lines
2.2 KiB
Bash
Executable File
Raw 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.
#!/usr/bin/env bash
# 发版/构建前的统一体检(只读)。
set -uo pipefail
cd "$(dirname "$0")/.."
fail=0
ok() { printf " ok %s\n" "$1"; }
bad() { printf " FAIL %s\n" "$1"; fail=1; }
echo "== 1. 工作区"
dirty=$(git status --porcelain | grep -v -E '^(\?\? (PLUGIN-API-GOVERNANCE-ISSUE|docs/ISSUE-REPLIES|icon\.png))' || true)
if [ -z "$dirty" ]; then ok "无未提交改动(长期未跟踪文件除外)"; else bad "存在未提交改动"; printf "%s\n" "$dirty" | sed 's/^/ /'; fi
echo "== 2. 版本号三处一致"
v1=$(node -p 'require("./package.json").version' 2>/dev/null)
v2=$(node -p 'require("./src-tauri/tauri.conf.json").version' 2>/dev/null)
v3=$(grep -m1 '^version = ' src-tauri/Cargo.toml | cut -d'"' -f2)
if [ "$v1" = "$v2" ] && [ "$v1" = "$v3" ]; then ok "版本 $v1"; else bad "版本不一致 pkg=$v1 tauri=$v2 cargo=$v3"; fi
echo "== 3. 构建单实例"
if pgrep -f 'tauri build|cargo build --bins' >/dev/null 2>&1; then bad "已有构建在跑(等它结束,避免抢锁)"; else ok "无并行构建"; fi
echo "== 4. 插件两仓一致"
if node scripts/check-plugins-sync.js >/dev/null 2>&1; then ok "plugins/ 与源仓一致"; else bad "插件两仓不一致(跑 sync-plugins-from-repo.js)"; fi
echo "== 5. 设计 token 快照"
if npm run -s tokens:check >/dev/null 2>&1; then ok "tokens 无漂移"; else bad "tokens 漂移(npm run tokens:check 看详情)"; fi
echo "== 6. 文档过期写法"
# B1(2026-12-02):现行文档里不得再出现已下线的路径/命令;历史说明用 ~~删除线~~ 或「已弃用/已移除」等词豁免。
stale=$(grep -rnE 'functions/api|functions/plugins|verify:release|plugins-publish|wrangler|_inbox' \
README.md CONTRIBUTING.md PUBLISHING.md docs/standards docs/reference 2>/dev/null \
| grep -v '~~' \
| grep -vE '已删除|已下线|已停用|已移除|已废弃|已弃用|已不存在|已无|不再|删除|废弃|历史|旧|曾' || true)
if [ -z "$stale" ]; then ok "无过期写法(functions/api、verify:release、plugins-publish、_inbox、wrangler)"; else bad "仍有过期写法"; printf "%s\n" "$stale" | sed 's/^/ /' | head -8; fi
echo
if [ "$fail" = "0" ]; then echo "preflight: 通过"; else echo "preflight: 有问题,见上"; fi
exit "$fail"