#!/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:是否有未部署變動 # # 不做破壞性動作,只讀狀態。需要 network(npm 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 Workers(scripts/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 CLI(arcrun / 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-executor(API 本體)】" 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 server(arcrun/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 最新 API(rule 07)" info "用戶連哪台 MCP 由 .mcp.json 決定(acr mcp-setup 依 config mcp_url 產)" else warn "找不到 arcrun/mcp/(應已搬進主庫)" fi echo "" echo "═══ 完成。⚠ = 需注意;· = 資訊;✗ = 失敗 ═══" echo ""