Files
Arcrun/scripts/check-release.sh
T
uncle6me-web 3e65e22775 feat: 薄殼原則落地 + seed 下沉 API + MCP 進主庫 + 部署一致性
壓測四橫向問題修正(docs 壓測報告):

① 薄殼原則成鐵律:能力長在 API,CLI/MCP/lib 只暴露
   - seed 下沉成 API 行為:cypher-executor POST /init/seed(一次灌 API+auth recipe),
     種子資料移到 server src/lib/api-recipe-seeds.ts,CLI 改薄殼一次呼叫
   - 解除 deployFullyOk 連坐 + init 補 seed auth recipe + update 補 seed/全 KV
   - registry SUBMISSIONS_KV 補進 REQUIRED_KV_NAMESPACES(修 20/21)

② MCP 統一帳號來源(單一 remote MCP + .env 切 MCP URL)
   - MCP 從 sibling repo 搬進 arcrun/mcp/(remote Worker,route 改 mcp.arcrun.dev)
   - config 加 mcp_url 三層解析 + getMcpUrl + DEFAULT_MCP_URL
   - 新增 acr mcp-setup:依 config 寫專案 .mcp.json(接案切資料夾自動切 MCP)
   - acr --version 改動態讀 package.json(根治漂移)

③ Deploy 一致性
   - tests/release.feature + scripts/check-release.sh
   - local-deploy.sh:CLI npm publish + auto patch bump + CHANGELOG
   - local-deploy.sh bash 3.2 相容修正(mapfile / 空陣列 set -u)
   - builtins/pnpm-lock.yaml

④ README self-hosted 同步現況(移除 R2 殘留、加 flag/env、多帳號)

CLI bump → 1.3.0

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 15:45:35 +08:00

92 lines
4.5 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.
#!/bin/bash
# check-release.sh — release.feature 的可執行佐證:列出每個 publish target 的目前狀態
#
# 用途:「完成推送」後跑這個,一眼確認所有對外介面是否同步到位(壓測報告第 3 點)。
# - CF workers / landing:是否由 CI 部署(看 deploy.yml 掃描範圍)
# - npm CLI:本機 cli/package.json version vs npm 上的版本(最常漂移的一個)
# - MCP:是否有未部署變動
#
# 不做破壞性動作,只讀狀態。需要 networknpm view / curl)才能查線上版本;
# 無 network 時只比對本機可知的部分,並誠實標「無法查線上」。
#
# 對應:tests/release.feature、.claude/rules/05-deploy-convention.md
set -uo pipefail
cd "$(dirname "$0")/.." || exit 1
GREEN='\033[0;32m'; YELLOW='\033[0;33m'; RED='\033[0;31m'; GRAY='\033[0;90m'; NC='\033[0m'
ok() { echo -e " ${GREEN}${NC} $1"; }
warn() { echo -e " ${YELLOW}${NC} $1"; }
err() { echo -e " ${RED}${NC} $1"; }
info() { echo -e " ${GRAY}·${NC} $1"; }
echo ""
echo "═══ arcrun release 狀態檢查(release.feature 佐證)═══"
echo ""
# ── 1. CF Worker 部署單位(由 scripts/local-deploy.sh 掃描部署)──────────
# 註:GH Actions 2026-05-16 停用、公開 repo 已移除 .github/,現行 deploy 走 local-deploy.sh。
echo "【CF Workersscripts/local-deploy.sh 掃 wrangler.toml 後 wrangler deploy)】"
WORKER_DIRS=$(find . -name 'wrangler.toml' -not -path '*/node_modules/*' -not -name 'wrangler.test.toml' \
| xargs -n1 dirname 2>/dev/null | sort -u)
WORKER_COUNT=$(echo "$WORKER_DIRS" | grep -c . )
info "掃到 $WORKER_COUNT 個部署單位(push 對應目錄即自動 deploy"
echo "$WORKER_DIRS" | sed 's/^/ /'
# ── 2. CLI npm(最常漂移)──────────────────────────────────────────────
echo ""
echo "【npm CLIarcrun / acr)】"
LOCAL_CLI=$(node -p "require('./cli/package.json').version" 2>/dev/null || echo "?")
if command -v npm >/dev/null 2>&1; then
REMOTE_CLI=$(npm view arcrun version 2>/dev/null || echo "無法查線上")
else
REMOTE_CLI="無 npm CLI 可查"
fi
if [ "$LOCAL_CLI" = "$REMOTE_CLI" ]; then
ok "CLI 版本同步:本機 $LOCAL_CLI = npm $REMOTE_CLI"
elif [ "$REMOTE_CLI" = "無法查線上" ] || [ "$REMOTE_CLI" = "無 npm CLI 可查" ]; then
info "本機 CLI $LOCAL_CLI$REMOTE_CLI"
else
warn "CLI 版本漂移:本機 $LOCAL_CLI ≠ npm $REMOTE_CLI"
warn "→ 跑 scripts/local-deploy.sh(含 cli/ 變動時)會 npm publish;或手動 cd cli && npm publish"
fi
# 偵測「cli 有未發佈變動但版本可能未 bump」
if git rev-parse --git-dir >/dev/null 2>&1; then
LAST_CLI_PKG_CHANGE=$(git log -1 --format=%h -- cli/package.json 2>/dev/null || echo "")
LAST_CLI_SRC_CHANGE=$(git log -1 --format=%h -- cli/src 2>/dev/null || echo "")
if [ -n "$LAST_CLI_SRC_CHANGE" ] && [ "$LAST_CLI_SRC_CHANGE" != "$LAST_CLI_PKG_CHANGE" ]; then
info "cli/src 最後變動($LAST_CLI_SRC_CHANGE)晚於 package.json$LAST_CLI_PKG_CHANGE)→ 確認是否需 bump version"
fi
fi
# ── 3. cypher-executor 線上健康 ────────────────────────────────────────
echo ""
echo "【cypher-executorAPI 本體)】"
if command -v curl >/dev/null 2>&1; then
CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 8 https://cypher.arcrun.dev/health 2>/dev/null || echo "000")
if [ "$CODE" = "200" ]; then
ok "https://cypher.arcrun.dev/health → 200"
else
warn "https://cypher.arcrun.dev/health → $CODE(部署中或不可達?)"
fi
else
info "無 curl,跳過線上健康檢查"
fi
# ── 4. MCP server(已搬進主庫 arcrun/mcp/)──────────────────────────────
echo ""
echo "【MCP serverarcrun/mcp/,已進主庫)】"
if [ -d mcp ] && [ -f mcp/wrangler.toml ]; then
MCP_NAME=$(grep '^name' mcp/wrangler.toml | head -1 | sed -E 's/^name[[:space:]]*=[[:space:]]*"([^"]*)".*/\1/')
ok "arcrun/mcp/ 存在(worker: $MCP_NAME);由 local-deploy.sh 一併 wrangler deploy"
info "薄殼一致性:MCP 工具集應對齊 cypher-executor 最新 APIrule 07"
info "用戶連哪台 MCP 由 .mcp.json 決定(acr mcp-setup 依 config mcp_url 產)"
else
warn "找不到 arcrun/mcp/(應已搬進主庫)"
fi
echo ""
echo "═══ 完成。⚠ = 需注意;· = 資訊;✗ = 失敗 ═══"
echo ""