Files
Arcrun/registry/scripts/register-component.sh
T
uncle6me-web 922a57fe34 arcrun — AI workflow execution engine (clean history)
Self-hosted 開源:WASM 零件 + recipe + cypher-executor,跑在你自己的 Cloudflare。

此為重建的乾淨歷史起點(移除曾誤 commit 的 GCP SA 金鑰,舊歷史保留在
richblack/arcrun 與本地 backup 分支)。含:
- acr init --self-hosted installer(建 KV/R2 + codeload 拉預編譯 wasm + wrangler deploy + seed recipe)
- recipe push 把關(資料外流提醒 + 打通檢查)
- 19 個正當零件預編譯 wasm(claude_api/km_writer/kbdb_upsert_block 排除:違反 DECISIONS §1)
- CLI / cypher-executor / registry / 完整 SDD

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

61 lines
1.7 KiB
Bash
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
# 單一 component 註冊到 registry index
# SDD: matrix/arcrun/.agents/specs/component-registry-canon/design.md Phase 2
#
# 用法:
# bash scripts/register-component.sh <component_name>
# REGISTRY_URL=https://registry.arcrun.dev bash scripts/register-component.sh kbdb_ingest
#
# CI deploy 流程內也使用同樣邏輯(見 .github/workflows/deploy.yml 的 Register step
# 此 script 是「本地 / hook 一致性」的 SSOTCI 改邏輯時 script 跟著改
set -uo pipefail
REGISTRY_URL="${REGISTRY_URL:-https://registry.arcrun.dev}"
COMPONENT_NAME="${1:-}"
if [[ -z "$COMPONENT_NAME" ]]; then
echo "Usage: $0 <component_name>" >&2
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
COMPONENT_DIR="$SCRIPT_DIR/../components/$COMPONENT_NAME"
CONTRACT="$COMPONENT_DIR/component.contract.yaml"
if [[ ! -f "$CONTRACT" ]]; then
echo "::warning::no component.contract.yaml at $COMPONENT_DIR" >&2
exit 0
fi
python3 -c "import yaml" 2>/dev/null || {
echo "需要 python3 + pyyaml" >&2
exit 1
}
contract_json=$(python3 -c "
import yaml, json
with open('$CONTRACT') as f:
c = yaml.safe_load(f)
print(json.dumps({'contract': c}))
") || {
echo "::warning::無法解析 $CONTRACT" >&2
exit 0
}
echo "Registering $COMPONENT_NAME to $REGISTRY_URL ..."
http_code=$(curl -s -o /tmp/reg-response.json -w "%{http_code}" \
-X POST "$REGISTRY_URL/components/index-only" \
-H "Content-Type: application/json" \
-d "$contract_json")
if [[ "$http_code" =~ ^(200|201)$ ]]; then
echo "✓ $COMPONENT_NAME registered (HTTP $http_code)"
cat /tmp/reg-response.json
echo
else
echo "::warning::Registry 註冊失敗 HTTP $http_code" >&2
cat /tmp/reg-response.json || true
exit 1
fi