docs+tooling: 工程流程优化约定(preflight 体检 / diag-tail 日志过滤)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 41s

This commit is contained in:
qiqi committed 2026-12-02 06:54:16 +08:00
1 parent 32ac08faeb
commit 30cf375ea0
4 files changed
+114 -1

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# 取资料目录 _boot.log 的关键行。
set -uo pipefail
DIR="${IWB_DATA_DIR:-$HOME/Documents/ImageWorkbench}"
LOG="$DIR/_boot.log"
if [ ! -f "$LOG" ]; then echo "找不到 $LOG(可用 IWB_DATA_DIR 指定资料目录)"; exit 2; fi
PAT="${*:-plugin-img|perf |thumb-fail|mem }"
echo "== $LOG (匹配:$PAT)"
tail -n 400 "$LOG" | grep -E "$PAT" | tail -n 40
+24
View File
@@ -0,0 +1,24 @@
#!/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
if [ "$fail" = "0" ]; then echo "preflight: 通过"; else echo "preflight: 有问题,见上"; fi
exit "$fail"