65120a1c65
- docs/permissions-allow.json + scripts/settings-allow-sync:四個 Gitea 正門工具的權限白名單一份, setup script 裝完 plugin 寫一次、SessionStart 每次再對一次(只加不減、冪等) - hooks/lib/mainline.py/scripts/mainline:家目錄沒主線就讀 InkStoneCo/system-dev/mainline.json; set/adopt/clear 兩份一起寫,refresh 只寫家目錄 - hooks/leo21c-write-guard.sh:唯讀 -d(tr/cut/sort…)先剪掉再判、notify_leo trigger 放行 (與 prod-write-guard 同一份白名單)、改法段改印 09-02 起的 youlin 子網域;補第一支測試(26 條) - prod-write-guard/main-and-prod-push-guard/kbdb-live-exam:認得 youlin 新子網域 arcrun-yuga3bse - scripts/ticket:收件 repo 寫 inkstone/ISEP 不再 404(org 寫錯當場講) - scripts/isep-notify:有 TELEGRAM_BOT_TOKEN/TELEGRAM_CHAT_ID 先走 Bot API 直送(雲端唯一通的路) - 測試:A31–A35 共 79 條;README/plugin.json/hooks-inventory 數字實數(61 支、85 條、53 支腳本) 假設(記在這裡等 review):權限規則的形狀沿用 leo 09-07 親手加、實測有效的那四條; 「分類器真的不擋」要雲端一趟 run 的 permission_denials 才驗得到,本 PR 驗不了。 版本:待總管定版(plugin.json 仍 0.22.0)。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DTZ9QtvjY7MNxjfQbexAm7
50 lines
2.8 KiB
Bash
50 lines
2.8 KiB
Bash
#!/usr/bin/env bash
|
||
# 貼進 claude.ai → Cloud environments → 你的環境 → Setup script 欄位。
|
||
#
|
||
# 🔴 2026-08-21:這支腳本從「要 token」變成「不要 token」,因為查文件查出兩件事——
|
||
#
|
||
# ① **setup script 讀不到 Environment variables。**
|
||
# 官方原文:「Each session copies the environment's values once, **at startup**,
|
||
# into ordinary environment variables」,而 setup script 是
|
||
# 「**before Claude Code launches**」跑的 ⇒ 注入發生在它之後。
|
||
# ⇒ 舊版把 token 放進 Environment variables 再要這裡讀,永遠讀不到。
|
||
#
|
||
# ② **非零結束會讓整個 session 開不起來。**
|
||
# 官方原文:「**Exit zero**: if the script exits non-zero, the session fails to start.」
|
||
# ⇒ 這裡一律 exit 0。任何失敗只記錄,不擋門。
|
||
#
|
||
# 解法是拿掉憑證需求本身:`inkstone` org 與 `inkstone/ISEP` 都改成 Public
|
||
# ⇒ 匿名 clone 得到(2026-08-21 實測:匿名 git-upload-pack HTTP 200、
|
||
# 真隔離環境(無憑證、GIT_CONFIG_NOSYSTEM=1)ls-remote 成功)
|
||
# ⇒ **雲端不再需要任何金鑰就能裝 ISEP。**
|
||
#
|
||
# 真正讓 plugin 生效的是薄殼 repo 的 .claude/settings.json
|
||
# (extraKnownMarketplaces + enabledPlugins)——官方文件:
|
||
# 「Installed at session start from the marketplace you declared.」
|
||
# 下面兩行是備援,讓 marketplace 在 session 啟動前就已經在快照裡。
|
||
|
||
set -uo pipefail
|
||
|
||
claude plugin marketplace add https://git.uncle6.me/inkstone/ISEP.git --scope user 2>&1 || true
|
||
claude plugin install isep@inkstone --scope user 2>&1 || true
|
||
|
||
# 🔴 權限白名單(inkstone/ISEP#130):四個 Gitea 正門工具(ticket/mainline/gate-ok/gitea-pr-merge)
|
||
# 要進這台的 ~/.claude/settings.json,auto mode 的分類器才不擋(09-04 run log:permission_denials=6)。
|
||
# 清單住 ISEP `docs/permissions-allow.json` 一份,本機與雲端都由同一支腳本寫——薄殼 repo 不再各養一份。
|
||
# plugin 快取的路徑帶版本號,挑最新的那份跑;沒裝成也不擋門,SessionStart 會再對一次。
|
||
ISEP_DIR=$(ls -d "$HOME"/.claude/plugins/cache/inkstone/isep/*/ 2>/dev/null | sort -V | tail -1)
|
||
if [ -n "$ISEP_DIR" ] && [ -f "$ISEP_DIR/scripts/settings-allow-sync" ]; then
|
||
python3 "$ISEP_DIR/scripts/settings-allow-sync" 2>&1 || true
|
||
else
|
||
echo "⚠️ 找不到裝好的 ISEP,白名單沒寫進 ~/.claude/settings.json——session 開頭 SessionStart 會再試一次。"
|
||
fi
|
||
|
||
if claude plugin marketplace list 2>/dev/null | grep -q "inkstone"; then
|
||
echo "✅ marketplace inkstone 已就位"
|
||
else
|
||
echo "⚠️ marketplace 沒就位——session 啟動時會再試一次(薄殼 settings.json 宣告的那條路)。"
|
||
echo " 若 session 開頭看不到「🟢 ISEP v… 已載入」,就是這條也失敗了。"
|
||
fi
|
||
|
||
exit 0
|