Files
ISEP/docs/cloud-setup-script.sh
T
Leo 627f924342 docs(cloud): 雲端 session 用 claude plugin marketplace 裝真身 ISEP,不再複製薄殼
inkstone/ISEP#5 —— 用 code-on-web 的 Setup script(session 啟動前跑)+
claude plugin marketplace add/install 把 ISEP 裝成 user-scope plugin,
內容 100% 來自 ISEP repo HEAD,滿足 docs/governance §11.3 三條硬規則。

本機隔離 $HOME 實測兩輪(token-in-URL、git url.insteadOf 重寫兩種認證寫法皆可行),
skills/commands/hooks 逐條數字對上 ISEP 當時的 main HEAD(含途中 main 前進,
下次 marketplace update 立刻拿到新內容,證明非快照複製)。

明確未驗:真實 code-on-web session、hook runtime 攔截、7 天 environment 快照
新鮮度窗口——皆記在 docs/cloud-session-bootstrap.md「沒驗到的」段。

不動 youlinhsieh/inkstoneco(新機制不需要它)、不 push GitHub、不 push main。
2026-08-20 13:41:35 +08:00

39 lines
2.3 KiB
Bash

#!/usr/bin/env bash
# 貼進 code-on-web「Cloud environments → 你的環境 → Setup script」欄位的內容。
# 不是 ISEP 的一部分(不會被 Claude Code 當 hook/command/skill 掃描),
# 純粹是給 leo 複製貼上的參考檔,見 docs/cloud-session-bootstrap.md。
#
# 前提(要先在同一個 Cloud environment 的 Environment variables 欄位加好):
# GITEA_TOKEN_CLAUDE_CODE ← 既有機器帳號 token,名字沿用 InkStoneCo#14 已建立的那把,
# 不要新造一把。值本身不寫在這支腳本或任何檔案裡。
#
# 這支腳本做兩件事:
# 1. 設定 git URL 重寫,讓任何對 git.uncle6.me 的 clone 都能用 GITEA_TOKEN_CLAUDE_CODE 認證
# (官方文件對「CI/CD 裝私有 marketplace」建議的寫法,見 references 段)。
# 2. 直接把 ISEP 裝成 user-scope plugin ——不是「複製一份」,是跟本機一樣走
# `claude plugin marketplace add` + `claude plugin install`,裝的東西
# 100% 來自 inkstone/ISEP 這個 repo 本身,沒有第二份內容。
#
# 何時跑:只在「這個 Cloud environment 第一次開 session」時跑一次,
# 跑完 Anthropic 會把整個檔案系統拍成快照,之後的 session 直接沿用快照
# (不重跑,除非改了這支腳本本身、改了 allowed network hosts、或快照滿 7 天過期)。
# ⇒ 這是唯一會讓「ISEP 改了但雲端還是舊的」重新出現的地方,
# 緩解法見 docs/cloud-session-bootstrap.md「已知限制」段。
set -euo pipefail
if [ -z "${GITEA_TOKEN_CLAUDE_CODE:-}" ]; then
echo "❌ 找不到 GITEA_TOKEN_CLAUDE_CODE —— 去 Cloud environment 的 Environment variables 加這個名字" >&2
exit 1
fi
# 官方文件建議的私有 marketplace 認證寫法:只重寫這個 host 的 URL,不動其他 git 操作。
git config --global url."https://x-access-token:${GITEA_TOKEN_CLAUDE_CODE}@git.uncle6.me/".insteadOf \
"https://git.uncle6.me/"
# 用乾淨網址(不帶 token)加 marketplace,實際認證交給上面那條 URL 重寫。
claude plugin marketplace add https://git.uncle6.me/inkstone/ISEP.git --scope user
claude plugin install isep@inkstone --scope user
echo "✅ ISEP 已裝成 user-scope plugin,之後每個 session 啟動時直接生效。"