#!/usr/bin/env bash
# 合回验证点（本地 CI 触发钩子，2026-10-30 用户裁）——主工作区 git merge 落地后无条件触发
# 全量域闸后台跑批（tools/ci_runner.sh merge，约 4 分钟，不阻塞合并动作本身）。
# 任务 worktree 内的合并不触发（CI 只认 master；worktree 批要提前验证就手动跑 ci_runner.sh）。
# CI 红了不回滚合并——红项记入 game/tests/.gates/ci-status.json，修复提交经 post-commit 追绿。
set -u
_GD="$(cd "$(git rev-parse --git-dir)" && pwd)"
_CD="$(cd "$(git rev-parse --git-common-dir)" && pwd)"
[ "$_GD" = "$_CD" ] || exit 0
REPO="$(git rev-parse --show-toplevel)"
( nohup bash "$REPO/tools/ci_runner.sh" merge >/dev/null 2>&1 & )
exit 0
