Files
hooks/skills/repair/SKILL.md
T
jiantw83 e2b08f04a3 fix(gates): 修好會蓋掉異常目錄、把修復路徑鎖死與誤擋計畫階段的缺陷
異常回報依 wiki 讀取的結束碼分流,只有頁面確定不存在才套範本建新頁。
版本閘門與重啟閘門的豁免清單各補上 hook 修復技能。
階段閘門把計畫階段移出擋人名單,改成只注入提醒。
錯誤掃描的自家 hook 判定補齊九支腳本,並加一條路徑判定。
修復技能與接線技能的內文改成真的走得到的路徑與真的存在的關卡數。

原本 wiki 讀取失敗會一路落到套範本那一步,金鑰失效或 API 出狀況時,
就拿一份空白範本蓋掉整份異常目錄,而寫入不做合併也不留備份,蓋掉就救不回來。
兩道閘門把唯一的 hook 修復路徑一起擋住,hook 一壞就沒有任何方法修回來,
閘門等於鎖掉解除自己的路徑。工作包閘門擋下計畫階段是誤擋:
計畫是純邏輯階段、不碰程式碼,而閘門只知道有 PR 未合併,判不出跟新計畫有沒有關聯。
自家 hook 判定只認得早期那五支,後來加的四支出錯會被當成第三方的,只回報不修正。
修復技能裡三個指向流程的路徑指到不存在的位置,照著走一定撲空;
接線流程寫四道關卡,實際上有五道,兩段中文說明也混在英文內文裡。

異常目錄改成先讀回舊頁、把新列附在文末、再整頁寫回;讀不回來就放棄寫目錄頁並回報,
寧可少一列索引,也不覆蓋別人的紀錄。兩份豁免清單各補一項,理由逐項寫在腳本檔頭。
計畫階段改印提醒後放行,放棄的在製品上限與代價一併寫在檔頭。
自家 hook 判定逐支列出腳本名,再加一條安裝路徑判定,日後新增 hook 忘了補清單也還認得出來。
三個路徑改指到擁有它的技能組,關卡數改成五道並逐關寫明結束碼,兩段中文說明改回英文。
版本閘門在同一次改動另補唯讀的建議子命令,把版本比對表收斂成一行結論,
部署技能不必自己再解一次那張表。
2026-08-31 11:15:24 +08:00

2.9 KiB

name, description
name description
repair Repair failed hook wiring by delegating diagnosis to installed AI agent CLIs as subagents, patching the hooks repo, syncing manifests, and opening a PR against develop. Use when hooks-install or report-error.sh reports a failed hook, or when a hook keeps failing after rewiring; not for routine wiring or unrelated work.

repair — repair a failed hook

Single source of guidelines: jsc-meta's references/guidelines.md.

This skill is exempt from the version guard and the post-deploy restart gate, because it is the only path back from a broken hook. hooks/version-guard.sh and hooks/restart-gate.sh own those two exemption lists.

Flow

  1. Read the failure context from ERROR_{HASH} through jsc-gitea:wiki, or from the failed status= line when no page was written. A wiki read that fails stops the skill: report which page could not be read and ask for the failure output instead of guessing. Done when the failure context names the script, the exit code and the CLI, and the PR base branch is fixed at develop.
  2. Run jsc-cli/tools/detect-clis.sh. It always exits 0 and prints one name<TAB>path<TAB>version line per installed CLI; empty output means no CLI is installed. Delegate diagnosis to one subagent per detected CLI — each MUST run as a sub agent, must receive the failure context, must stay read-only, and must return root cause, the files to change, and the verification command to run. Done when every detected CLI has returned one proposal, or the output was empty and the main agent has recorded that it diagnoses alone.
  3. Pick the smallest repair that makes the wiring pass, then apply it in the hooks repo. When the fix touches wiring behaviour, update hooks/tools/wire-cli.sh, hooks/skills/hooks-install/SKILL.md and hooks/README.md in the same change. Run tools/wire-cli.sh smoke {cli} for the affected CLI: exit 0 means the repair holds, exit 4 means it does not — go back to step 2 with the new output, exit 2 means a bad CLI name, so fix the name and rerun. Done when the fix is on disk and smoke exits 0.
  4. Run jsc-meta/tools/sync-skill-manifest.sh . from the repo root. Exit 0 means the README skill list and all three manifests carry the same new version. Exit 1 means a missing path, a missing JSC-SKILLS marker or an unreadable manifest — fix the named file and rerun. Exit 2 means a usage error, so pass exactly one path. Any other exit code is an environment fault, never a successful sync: stop and report it. Done when the script exits 0 and the three manifests show the same version.
  5. Commit, push and open a PR with jsc-git:pr against develop. When jsc-git:pr returns no PR URL, report the repair as applied but unmerged, name the branch that holds it, and hand back the failure reason — never claim a PR exists. Done when a PR URL comes back, or the branch name and the failure reason are both reported.