Files
ISEP/scripts/git-bundle-backup.sh
T
Leo c2638668e3 ISEP 0.1.0:環境設定收成一個 plugin,本機與雲端共用一份
leo 2026-08-20:「同一個 plugin 你用,薄殼也用,保證兩邊同步」
              「我要你幫雲端做薄殼,永遠都有問題,你要做的就是這組設定
                你自己可以 dogfooding」

搬進來:41 支 hook(51 條註冊)/7 支 command/2 支 skill/23 支腳本。
不搬 .env、wiki、docs——那些是知識不是環境。

51 條 hook 路徑全部從 $CLAUDE_PROJECT_DIR/.claude/hooks/ 改成 ${CLAUDE_PLUGIN_ROOT}/hooks/,
零漏網。那正是薄殼一直壞掉的根:雲端 cwd 不是真身,寫死路徑就斷。

尚未驗證:Claude Code 能不能從私有 Gitea repo 裝 marketplace(要憑證)。
下一步就是在本機實際裝一次,通了才動雲端 bootstrap.sh。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 11:41:46 +08:00

42 lines
1.6 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
# B1 備援三件套之二:每日 git bundle 備份(de-Gitea brief B1
# 對本機所有 repogit fsck 驗完整 → git bundle 打包全部 refs → 存 ~/Backups/git-bundles/
# R2 上傳段:等 youlin 帳號 R2 開通後補(TODO 標記處)。保留最近 7 份。
set -uo pipefail
ROOT="/Users/youlinhsieh/Documents/tech_projects/InkStoneCo"
DEST="$HOME/Backups/git-bundles"
STAMP=$(date +%Y%m%d)
KEEP=7
mkdir -p "$DEST"
REPOS=(. matrix/arcrun matrix/arcrun-components matrix/arcrun-gui matrix/arcrun-mcp
matrix/inkstone-admin matrix/kbdb-graph-plugin matrix/kbdb-ingest-plugin
products/arcrun-rag products/dev-finally-click products/finally-click products/u6u-studio
polaris/AI-Meka polaris/OpenHarness polaris/mira arcrun_harness)
fail=0
for r in "${REPOS[@]}"; do
dir="$ROOT/$r"
[ -d "$dir/.git" ] || { echo "SKIP $r (no .git)"; continue; }
name=$(basename "$(cd "$dir" && pwd)")
[ "$r" = "." ] && name="InkStoneCo"
if ! git -C "$dir" fsck --no-progress --no-dangling >/dev/null 2>&1; then
echo "❌ FSCK FAIL $r"; fail=1; continue
fi
out="$DEST/${name}-${STAMP}.bundle"
if git -C "$dir" bundle create "$out" --all >/dev/null 2>&1; then
echo "✅ $name $(du -h "$out" | cut -f1)"
else
echo "❌ BUNDLE FAIL $r"; fail=1
fi
# 保留最近 KEEP 份
ls -t "$DEST/${name}-"*.bundle 2>/dev/null | tail -n +$((KEEP+1)) | xargs rm -f 2>/dev/null
done
# TODO(R2)youlin 帳號 R2 開通後,在此加 rclone/wrangler 上傳 $DEST 至獨立 bucket(與 git server 不同桶)
echo "---"
echo "bundles at $DEST"
exit $fail