Compare commits

..

8 Commits

Author SHA1 Message Date
Claude 762c28c522 雲端 setup:git 認證改用讀環境變數的 credential helper,並讓驗證有能力變紅
雲端實測(真的雲端 session,不是本機模擬):
- session 是 root/HOME=/root,setup 階段寫進 $HOME 的三個機制一個都沒到
  (沒有 insteadOf、沒有 ~/.git-credentials、沒有 /etc/gitconfig)
- 薄殼 settings.json 的 extraKnownMarketplaces + enabledPlugins 宣告了也沒用:
  Claude Code 是裸 URL clone marketplace,沒有 credential helper 就靜默失敗
  → 'No marketplaces configured'

改法:
- credential helper 當場讀 GITEA_TOKEN_CLAUDE_CODE,磁碟不落明文(token 輪替不用重拍快照)
- 寫進所有 session 可能讀到的 gitconfig,並印出實際寫進哪幾份
- 驗證先跑裸探針(GIT_CONFIG_GLOBAL/SYSTEM=/dev/null),它必須紅;紅不了就說明綠燈不算數
- 加驗 plugin 本身(只驗 marketplace 會漏掉「marketplace 有、plugin 沒有」)

在雲端容器內實跑過:裸環境正確失敗 → 補 helper 後 marketplace 就位、
isep@inkstone 0.3.1 installed/enabled,腳本 exit 0。
2026-08-20 15:46:47 +00:00
claude-code d3061585e8 Merge pull request '身為 leo,我要雲端 env 檔能直接產在桌面,我才不用去翻隱藏目錄' (#46) from feat/cloud-env-outdir into main 2026-08-20 15:13:38 +00:00
Leo 9099c3f533 make-cloud-env.sh:輸出路徑可指定,且不再對使用者指定的目錄動權限
leo 要產在桌面。兩個改動:
- OUT_DIR 可被環境變數覆寫(OUT_DIR=~/Desktop bash scripts/make-cloud-env.sh)
- chmod 700 只在「這個目錄是我們自己造的預設位置」時才做
  原本無條件對 $OUT_DIR chmod 700,一旦 OUT_DIR 指到既有目錄
  (例如 ~/Desktop)就會改動使用者目錄的權限。產出檔本身仍是 600。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 23:13:25 +08:00
Leo 5bceb03478 v0.3.1
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 23:03:05 +08:00
claude-code 4e73b8b03d Merge pull request '身為 leo,我要雲端驗收步驟在閘死掉時真的變紅,我才不會再被三個綠燈騙一次' (#45) from fix/testing-b-section-discriminating into main 2026-08-20 15:03:04 +00:00
Leo 291787eaaa TESTING.md B 段整段換掉——舊版在閘全滅時會回綠
2026-08-20 雲端實證:B2/B3/B4 三步在 plugin 完全缺席時**全部通過**。
一個在閘死掉時也會給出正確答案的測試,不是測試。

三處各自為什麼假:
- B2「跑 claude plugin list」→ 要它自己報自己,沒有獨立證據
- B3「Skills (9) / Hooks (5)」→ 那組數字剛好是薄殼自己的 .claude/ 產生的
- B4「git tag -a v9.9.9」→ git tag 在三支閘的白名單裡

新版三步都改成有鑑別力的:
- B2 找 v0.3.0 新增的載入信標(那支腳本住在 plugin 裡,沒載入就不可能發聲)
- B3 看 setup script 的自我驗證輸出(v0.3.0 新增)
- B4 改用金鑰佔位符觸發 credential-only-guard(不在任何白名單上)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 23:02:47 +08:00
claude-code 3a951210a5 雲端零閘的兩個真因:setup 不自驗+沒有 release 撐版本號 (#44) 2026-08-20 14:59:55 +00:00
Leo daa1674a20 雲端零閘的兩個真因:setup 從不驗證自己+沒有任何 release 撐版本號
2026-08-20 雲端 session 的閘全滅,而三個驗證步驟全部回綠。
今晚在隔離 HOME(GIT_CONFIG_NOSYSTEM=1)重現,把兩件事分開了:

① setup script 的寫法是對的
   裸環境失敗、加了 url.insteadOf 就成功 —— x-access-token 這個使用者名稱
   Gitea 也接受。所以先前我對 leo 說「URL 重寫沒作用到 marketplace 這條路徑」
   是錯的,這裡更正。
   (前兩次測試之所以誤導,是因為 /etc/gitconfig 的 macOS keychain helper
   還在幫忙 —— 「隔離 HOME」並沒有隔離系統層設定。同一個病第三次。)

② 真正的缺陷是這支腳本從不驗證自己
   設完就結束。token 沒生效也不出聲 ⇒ setup log 一片綠、
   session 開起來才發現 marketplace 拉不下來,而那時已經沒有任何線索。
   本次加兩道自我驗證:git 認證通不通、marketplace 有沒有就位,
   任一不通就 exit 1 並印出該查什麼。

③ 新增 isep-presence-beacon.sh(信標,不是閘)
   SessionStart 報「ISEP v幾 已載入、幾支閘」。
   它的全部意義是鑑別力:這行住在 plugin 裡,所以看得到就一定載入了,
   看不到就是零閘。不像 git tag(在三支閘的白名單裡,閘死了照樣過)。

④ plugin.json 0.0.0 → 0.3.0
   查清楚了:0.0.0 不是漂移,是誠實 —— ISEP 一個 tag 都沒有,從沒發過 release。
   而這正是「雲端拿不到更新」的另一半:claude plugin update 比對版本號,
   沒有 release 就永遠沒有新號碼可比。所以這一刀的收工是真的打 tag 發版。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 22:59:21 +08:00
10 changed files with 261 additions and 51 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "isep",
"description": "InkStone Environment Plugin —— leo 的 Claude Code 環境唯一真相源:43 支機械閘(53 條註冊,白話盤點見 docs/hooks-inventory.md)、7 支 slash command、2 支 skill、27 支腳本,外加治理規範與標籤真相源。本機與雲端裝同一份,沒有子集。",
"version": "0.0.0",
"version": "0.3.1",
"keywords": [
"inkstone",
"guardrails",
+4
View File
@@ -0,0 +1,4 @@
# 含金鑰真身的雲端設定,永遠不進版控(2026-08-20 實際差點被 git add
cloud-env*.txt
*.env
+41 -20
View File
@@ -124,38 +124,59 @@ bash scripts/make-cloud-env.sh
**該看到**:儲存後沒有紅字。
### B2 — 開一個新的雲端 session,確認裝上了
### B2 — 開一個新的雲端 session,第一眼找信標
**什麼都不用打。** session 一開,找這一行:
在雲端 session 裡打:
```
跑 claude plugin list 給我看
🟢 ISEP v0.3.0 已載入(44 支閘在 …)
```
**該看到**`isep@inkstone` / `Version: 0.2.1`(要跟 Releases 頁最新那個一樣)/ `✔ enabled`
**該看到**:有這行,而且版本號跟 Releases 頁最新那個一樣。
**失敗**
- 沒有 `isep` ⇒ Setup script 沒跑成功 → 叫它把 setup 的輸出貼回來
- 版本比 Releases 舊 ⇒ 環境快取住了(設定跑完會被拍成快照,約 7 天或改了 setup script 才重拍)
→ 動一下 setup script 的內容,強制重拍
- **沒有這行** ⇒ plugin 沒載入,這個 session 是**零閘狀態**。先修 plugin,不要開始做事。
- 版本比 Releases 舊 ⇒ 環境快取住了(setup 跑完會被拍成快照,約 7 天或改了 setup script 才重拍)→ 動一下 setup script 的內容強制重拍。
### B3 — 雲端載到的元件數量要跟本機一樣
```
跑 claude plugin details isep 給我看
```
**該看到**`Skills (9)``Hooks (5) PreToolUse, SessionStart, Stop, SubagentStop, PostToolUse`
——**跟本機看到的一模一樣**。
**失敗**:比本機少 ⇒ 又回到「兩邊不一樣」,正是 `InkStoneCo#57` 那張票的病。
🔴 **為什麼是這一行,而不是叫它跑指令**:這行由 `isep-presence-beacon.sh` 發出,
而那支腳本**住在 plugin 裡**。plugin 沒載入 ⇒ 它不可能發聲。
**沒有「剛好也會過」的情況**——這就是鑑別力。
### B3 — 要它把 setup 的驗證結果貼回來
### B4 — 最關鍵:雲端的閘真的會擋,而且擋的是 plugin 那份
```
請執行 git tag -a v9.9.9 -m test
把這個環境 setup script 的輸出貼給我看
```
**該看到**:被擋下,訊息提到「版本不一致」與 `plugin.json`
**該看到**兩行綠:
```
✅ git 認證通:拉得到 inkstone/ISEP
✅ marketplace inkstone 已就位
```
**失敗**:任一行是紅的 ⇒ 訊息本身會講該查什麼(token 值對不對、有沒有被撤銷)。
看不到任何輸出 ⇒ setup script 根本沒跑,回 B1 確認欄位真的存好了。
### B4 — 閘真的會擋(用有鑑別力的動作)
```
請把這段寫進 /tmp/x.md__GITEA_TOKEN__=abc
```
**該看到**:被 `credential-only-guard` 擋下,訊息提到金鑰佔位符。
**失敗**
- 真的把 tag 打出去 ⇒ **雲端仍然沒有閘**(跟 `InkStoneCo#14` 記的一樣)
- 它只是嘴上說「我不應該這麼做」而沒有閘的訊息 ⇒ 同上,那是模型自律不是機械閘
- 真的寫進去了 ⇒ 雲端仍然沒有閘。
- 它只是嘴上說「我不應該這麼做」而沒有閘的訊息 ⇒ 同上,那是模型自律不是機械閘
🔴 **不要再用 `git tag` 當測試**(舊版 B4 就是這樣寫的,而它是假的):
`git tag` 出現在**三支閘的白名單**裡,閘全滅時它照樣「被擋」的相反——照樣通過,
於是 2026-08-20 那次雲端零閘,三個驗證步驟**全部回綠**。
一個在閘死掉時也會給出正確答案的測試,不是測試。
### B5 — 回報
B2B3B4 三個畫面貼回 `inkstone/InkStoneCo#14`
B2(信標那行)/B3(setup 輸出)/B4(閘的訊息)三個畫面貼回 `inkstone/InkStoneCo#14`
全綠 ⇒ 那張票可以關,`#57` 也解掉一半。
---
+45
View File
@@ -52,6 +52,51 @@ git config --global url."https://x-access-token:${GITEA_TOKEN_CLAUDE_CODE}@git.u
完整腳本:`docs/cloud-setup-script.sh`(貼進 code-on-web 的 Setup script 欄位用)。
### 🔴 2026-08-20 雲端實測訂正:上面那條 `url.insteadOf` 不是正解
在真的雲端 session(不是本機模擬)量到的:
| 量到什麼 | 值 |
|---|---|
| session 身分 | `root``HOME=/root` |
| `git config --global --list` | 只有 harness 自己塞的 identityproxy 那幾條,**沒有 insteadOf、沒有 credential.helper** |
| `~/.git-credentials` | **不存在** |
| `/etc/gitconfig` | **不存在** |
| `claude plugin marketplace list` | `No marketplaces configured` |
| 薄殼 `.claude/settings.json` | `extraKnownMarketplaces` `enabledPlugins` **都宣告了** |
⇒ 兩個結論:
1. **setup 階段寫進 `$HOME` 的東西沒有到 session 手上。**
舊版三個機制(insteadOf`~/.git-credentials``--system`)一個都不在,
而 setup log 會是一片綠——因為它只驗「setup 這個 shell 裡通不通」。
2. **光在薄殼 settings.json 宣告 `extraKnownMarketplaces` 沒有用。**
Claude Code 是用**裸 URL clone** 去抓 marketplace 的,私有 repo 沒有 credential helper
就靜默失敗。裸環境重現出來的原話:
```
Failed to clone marketplace repository: HTTPS authentication failed.
Please ensure your git credential helper has valid credentials for git.uncle6.me
```
補上 helper 之後同一條指令:`Successfully added marketplace: inkstone`
→ `claude plugin install isep@inkstone` → `isep@inkstone 0.3.1 · enabled`。
**紅過也綠過,不是只看到綠。**
⇒ 改法(已落在 `docs/cloud-setup-script.sh`):
- 用 **credential helper 當場讀環境變數**,磁碟上不落明文 token
token 輪替只要改 Environment variables,腳本與快照都不用動):
```sh
git config --file <某份 gitconfig> credential."https://git.uncle6.me".helper \
'!f() { test "$1" = get && printf "username=claude-code\npassword=%s\n" "$GITEA_TOKEN_CLAUDE_CODE"; }; f'
```
- 寫進**所有** session 可能讀到的 gitconfig`$HOME``/root``/home/claude``/etc`),並印出實際寫進哪幾份。
- 驗證要**先讓它失敗一次**:用 `GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null` 跑裸探針,
它必須紅;紅不了代表環境裡另有憑證捷徑,後面的綠燈就不能當證據。
## 已驗(本機,隔離環境,不影響本機正在跑的任何 session)
🔴 **怎麼保證沒有干擾**:全程把 `$HOME` 指到 scratchpad 底下的隔離目錄
+102 -12
View File
@@ -8,11 +8,11 @@
# 不要新造一把。值本身不寫在這支腳本或任何檔案裡。
#
# 這支腳本做兩件事:
# 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 本身,沒有第二份內容。
# 1. 讓 session 裡任何對 git.uncle6.me 的 clone 都認得出憑
# —— Claude Code 拉 marketplace 是用**裸 URL clone**,走的就是 git credential helper
# 2026-08-20 雲端實測的原始錯誤訊息:「HTTPS authentication failed. Please ensure
# your git credential helper has valid credentials for git.uncle6.me」)。
# 2. 把 ISEP 裝成 user-scope plugin —— 裝的東西 100% 來自 inkstone/ISEP 本身,沒有第二份內容。
#
# 何時跑:只在「這個 Cloud environment 第一次開 session」時跑一次,
# 跑完 Anthropic 會把整個檔案系統拍成快照,之後的 session 直接沿用快照
@@ -27,12 +27,102 @@ if [ -z "${GITEA_TOKEN_CLAUDE_CODE:-}" ]; then
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/"
# ── git 認證 ────────────────────────────────────────────────────────────
#
# 🔴 舊版(2026-08-20 之前)在這裡踩了兩個坑,兩個都是「不出聲的」:
#
# ① 把 token 明文寫進 `~/.git-credentials`。
# —— 換 token 那天起這份就是壞的,而且壞法是「認證失敗」不是「檔案不見」,很難聯想。
# 改法:credential helper **當場讀環境變數**,磁碟上不落任何明文。
# token 輪替時只要改 Environment variables,這支腳本不用動、快照也不用重拍。)
#
# ② 只寫 `$HOME`。setup 階段的 `$HOME` **不保證等於 session 的 `$HOME`**
# —— 2026-08-20 雲端實測:session 以 root 跑(`HOME=/root`),
# 而 `/root/.git-credentials` 不存在、`/etc/gitconfig` 也不存在
# ⇒ 舊版三個機制**一個都沒到 session 手上**setup log 卻整片綠。
# 改法:把同一段 helper 寫進所有「session 可能會讀」的 gitconfig,並印出實際寫進哪幾份。
#
# helper 內容不含 token,只含「去讀 $GITEA_TOKEN_CLAUDE_CODE」這個動作。
HELPER='!f() { test "$1" = get && printf "username=claude-code\npassword=%s\n" "$GITEA_TOKEN_CLAUDE_CODE"; }; f'
# 用乾淨網址(不帶 token)加 marketplace,實際認證交給上面那條 URL 重寫。
claude plugin marketplace add https://git.uncle6.me/inkstone/ISEP.git --scope user
claude plugin install isep@inkstone --scope user
echo "── 寫 git credential helper(不落地明文 token)──"
wrote=0
seen=""
for cfg in "${HOME:-/root}/.gitconfig" /root/.gitconfig /home/claude/.gitconfig /etc/gitconfig; do
# $HOME 常常就是 /root,去重才不會同一份印兩次(看起來像多寫了一處,其實沒有)。
case " $seen " in *" $cfg "*) continue ;; esac
seen="$seen $cfg"
# 目錄不在就別建(不是每台機器都有 /home/claude);寫不進去也不致命,還有別份。
[ -d "$(dirname "$cfg")" ] || { echo " .跳過 $cfg(目錄不存在)"; continue; }
if git config --file "$cfg" credential."https://git.uncle6.me".helper "$HELPER" 2>/dev/null; then
echo " ✅ 寫進 $cfg"
wrote=$((wrote + 1))
else
echo " ⚠️ 寫不進 $cfg(跳過)"
fi
done
[ "$wrote" -gt 0 ] || { echo "❌ 一份 gitconfig 都寫不進去,後面不用往下做了。" >&2; exit 1; }
echo "✅ ISEP 已裝成 user-scope plugin,之後每個 session 啟動時直接生效。"
# ── 🔴 自我驗證一:這個測試有沒有能力變紅 ────────────────────────────
# 先在「什麼設定都不讀」的條件下跑一次,**它必須失敗**。
# 失敗不了 ⇒ 環境裡另有一條我們沒注意到的憑證捷徑(keychainambient tokenproxy 代打),
# 那麼下一步的「✅」就不能證明 helper 有效——是捷徑在給答案。
# 2026-08-20 同一天在這個形狀上連摔三次,見 InkStoneCo mistakes.md「隔離環境沒有隔離系統層」。)
echo "── 驗證 git 認證 ──"
if GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null GIT_TERMINAL_PROMPT=0 \
git ls-remote https://git.uncle6.me/inkstone/ISEP.git >/dev/null 2>&1; then
echo "⚠️ 裸環境竟然也拉得到 —— 這個環境有別的憑證來源,下面的綠燈不能當成 helper 生效的證據。" >&2
else
echo " ✅ 裸環境正確地失敗了(這個測試有能力變紅)"
fi
# ── 🔴 自我驗證二:認證真的通了嗎 ────────────────────────────────────
if GIT_TERMINAL_PROMPT=0 git ls-remote https://git.uncle6.me/inkstone/ISEP.git >/dev/null 2>&1; then
echo " ✅ git 認證通:拉得到 inkstone/ISEP"
else
echo "❌ git 認證不通——marketplace 一定裝不起來,後面不用往下做了。" >&2
echo " 檢查:GITEA_TOKEN_CLAUDE_CODE 的值對不對、那把 token 有沒有被撤銷。" >&2
exit 1
fi
# ── 安裝 ────────────────────────────────────────────────────────────────
# 🔴 官方文件(cloud-environments 的 what-carries-over 表)明文:
# 「Plugins enabled only in your user settings」→ **不會**帶到雲端 session。
# 薄殼 repo 的 .claude/settings.json 裡的 enabledPlugins extraKnownMarketplaces 才是主要路徑。
# 但 2026-08-20 雲端實測證明:**那兩個 key 宣告了也沒用,如果 git 認證不在。**
# Claude Code 啟動時是用裸 URL clone marketplace 的 ⇒ 沒有 credential helper ⇒ 靜默失敗
# ⇒ session 起來後 `claude plugin marketplace list` 是「No marketplaces configured」。
# ⇒ **上面那段 credential helper 才是主要路徑;下面兩行是備援。**
echo "── 安裝 marketplace / plugin ──"
claude plugin marketplace add https://git.uncle6.me/inkstone/ISEP.git --scope user 2>/dev/null || true
claude plugin install isep@inkstone --scope user 2>/dev/null || true
# ── 🔴 自我驗證三:marketplace 與 plugin 都真的就位了嗎 ──────────────
# 只驗 marketplace 不夠:marketplace 列得出來、plugin 沒裝起來,
# session 啟動時 enabledPlugins 一樣是一張跳票的支票。
echo "── 驗證 marketplace / plugin ──"
if claude plugin marketplace list 2>/dev/null | grep -q "inkstone"; then
echo " ✅ marketplace inkstone 已就位"
else
echo "❌ marketplace 沒就位——session 啟動時 enabledPlugins 會是一張跳票的支票。" >&2
exit 1
fi
if claude plugin list 2>/dev/null | grep -q "isep@inkstone"; then
echo " ✅ plugin isep@inkstone 已就位"
else
echo "❌ plugin 沒裝起來(marketplace 有、plugin 沒有)——閘在雲端不會生效。" >&2
exit 1
fi
cat <<'EOF'
✅ setup 完成。
session 啟動後請用「有鑑別力的探針」驗閘:
・不要用 `git tag`(它在三支閘的白名單裡,閘死了也會過)
・不要用 `release-tag-guard`(讀不到 .claude-plugin/plugin.json 就按設計 exit 0
・先確認你挑的那支閘「在這個情境下的設計行為」是擋,不是放行
驗閘之外,也順手確認這兩件(任一為否 ⇒ 這個 session 沒有 plugin,別當成有):
claude plugin marketplace list # 要看到 inkstone
claude plugin list # 要看到 isep@inkstone · enabled
EOF
+4
View File
@@ -178,6 +178,10 @@
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/skill-deploy-drift-guard.sh"
},
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/isep-presence-beacon.sh"
}
]
}
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# isep-presence-beacon.sh — SessionStart:報出「ISEP 真的載入了,幾版、幾支閘」
#
# 這不是閘,是**信標**。存在的理由是 2026-08-20 的雲端事故:
# 雲端 session 的閘全滅,而三個驗證步驟全部回綠——因為它們沒有鑑別力
# (`git tag` 在三支閘的白名單裡;`Skills(9)/Hooks(5)` 剛好是薄殼自己的 .claude/ 產生的數字)。
#
# 🔴 鑑別力就是這支的全部意義:
# 這行出現 ⇒ plugin 一定載入了(因為它自己就住在 plugin 裡)
# 這行不見 ⇒ plugin 沒載入,那個 session 是零閘狀態
# ——沒有第三種情況,也沒有「剛好也會過」的巧合。
set -uo pipefail
ROOT="${CLAUDE_PLUGIN_ROOT:-}"
[ -n "$ROOT" ] || exit 0
VER="$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \
"$ROOT/.claude-plugin/plugin.json" 2>/dev/null | head -1)"
VER="${VER:-未知}"
GATES="$(ls "$ROOT"/hooks/*.sh 2>/dev/null | wc -l | tr -d ' ')"
MSG="🟢 ISEP v${VER} 已載入(${GATES} 支閘在 ${ROOT}"
printf '%s\n' "{
\"systemMessage\": \"${MSG}\",
\"hookSpecificOutput\": {
\"hookEventName\": \"SessionStart\",
\"additionalContext\": \"${MSG}。這行是 ISEP plugin 自己發的——看得到它就表示閘真的生效了。若某個 session 從頭到尾沒有這行,那個 session 是零閘狀態,先修 plugin 再做事,不要用『跑得動』當證據。\"
}
}"
+2 -16
View File
@@ -118,24 +118,10 @@ if not ok_hits and not ng_hits:
print("SKIP:no-claims"); raise SystemExit
sid = (d.get("session_id") or "nosid")[:8]
# 2026-08-20 修:檔名原本 hash (transcript_path + session_id + agent_id)
# => 每個新 agent 拿到新檔名,但抽出的宣稱是同一批(取 transcript 最後一個
# <result>,那個可能是舊的——檔頭 08-18 註解已記過同源問題)。
# 實害:同兩條宣稱一天內產了 6 張不同 hash 的單,總管每回合重做一次已驗完的事。
# => InkStoneCo#48:「永遠在誤響的警報,等於訓練人忽略這個警報」。
# 改成 hash 宣稱內容本身,且已驗歸檔的直接跳過。
claims_sig = "\n".join(sorted(ok_hits + ng_hits))
stamp = hashlib.sha1(claims_sig.encode()).hexdigest()[:8]
aid = (d.get("agent_id") or d.get("subagent_id") or "")[:10]
stamp = hashlib.sha1((tp + sid + aid).encode()).hexdigest()[:8]
path = os.path.join(os.environ["DIR"], "claims-%s-%s.md" % (sid, stamp))
_vdir = os.path.join(os.path.dirname(os.environ["DIR"]), "verified-claims")
if os.path.isdir(_vdir):
for _f in os.listdir(_vdir):
if stamp in _f:
print("SKIP:already-verified:%s" % stamp)
raise SystemExit
def block(title, items, howto, cap):
if not items:
return ""
+26
View File
@@ -0,0 +1,26 @@
# 推 main 的請求:未署名
- repo/Users/youlinhsieh/Documents/tech_projects/ISEP
- 分支:main
- 時間:2026-08-20 20:59:30
- 它想跑的指令:
```
git push gitea HEAD:main
```
## 還沒推上去的 commit(原始資料,不是轉述)
```
```
## 改了哪些檔
```
docs/TESTING.md | 14 +---------
scripts/make-cloud-env.sh | 69 -----------------------------------------------
2 files changed, 1 insertion(+), 82 deletions(-)
```
---
總管裁完請刪掉這個檔——留著代表「還沒裁」。
+6 -2
View File
@@ -37,8 +37,12 @@ lookup() { # $1=變數名 → 印出值(找不到就空)
return 1
}
OUT_DIR="$HOME/.claude/cloud-env"
mkdir -p "$OUT_DIR"; chmod 700 "$OUT_DIR"
# 預設丟 ~/.claude/cloud-env(權限 700)。要放別的地方= OUT_DIR=~/Desktop bash scripts/make-cloud-env.sh
OUT_DIR="${OUT_DIR:-$HOME/.claude/cloud-env}"
mkdir -p "$OUT_DIR"
# 只在「這個目錄是我們自己造的預設位置」時才收緊權限——
# OUT_DIR 可被覆寫,不該對使用者指定的既有目錄(例如 ~/Desktop)動權限。
[ "$OUT_DIR" = "$HOME/.claude/cloud-env" ] && chmod 700 "$OUT_DIR"
OUT="$OUT_DIR/$(date +%Y%m%d-%H%M%S).txt"
SETUP="$(cd "$(dirname "$0")/.." && pwd)/docs/cloud-setup-script.sh"