fix(deploy): 優先從穩定路徑尋找重啟閘門
This commit is contained in:
+14
-4
@@ -64,17 +64,27 @@ usage() {
|
||||
exit 2
|
||||
}
|
||||
|
||||
# 找 jsc-hooks 的 restart-gate.sh。順序比照 jsc-sdlc 的 wp-gate.sh:環境變數指定優先,
|
||||
# 再找並排的工作樹,最後找 plugin 快取。找不到就回非零,由呼叫端據實回報。
|
||||
# 找 jsc-hooks 的 restart-gate.sh。優先用穩定連結與安裝後複製目錄,再找並排工作樹,
|
||||
# 最後才掃各 CLI 的 plugin 快取。找不到就回非零,由呼叫端據實回報。
|
||||
restart_gate_sh() {
|
||||
if [ -n "${JSC_HOOKS_DIR:-}" ] && [ -f "$JSC_HOOKS_DIR/restart-gate.sh" ]; then
|
||||
printf '%s\n' "$JSC_HOOKS_DIR/restart-gate.sh"; return 0
|
||||
fi
|
||||
_root=$(cd "$(dirname "$0")/.." 2>/dev/null && pwd) || return 1
|
||||
for _c in "$_root/../hooks/hooks/restart-gate.sh" "$_root/../jsc-hooks/hooks/restart-gate.sh"; do
|
||||
for _c in \
|
||||
"${JSC_HOME:-$HOME/.jsc}/current/jsc-hooks/hooks/restart-gate.sh" \
|
||||
"${JSC_LOCAL_PLUGINS:-${JSC_HOME:-$HOME/.jsc}/plugins}/hooks/hooks/restart-gate.sh" \
|
||||
"${JSC_KIRO_SKILLS:-$HOME/.kiro/skills}/jsc-hooks/hooks/restart-gate.sh" \
|
||||
"$_root/../hooks/hooks/restart-gate.sh" \
|
||||
"$_root/../jsc-hooks/hooks/restart-gate.sh"
|
||||
do
|
||||
[ -f "$_c" ] && { printf '%s\n' "$_c"; return 0; }
|
||||
done
|
||||
_c=$(ls -d "$HOME"/.claude/plugins/cache/*/jsc-hooks/*/hooks/restart-gate.sh 2>/dev/null | sort | tail -n1)
|
||||
_c=$(ls -d \
|
||||
"$HOME"/.claude/plugins/cache/*/jsc-hooks/*/hooks/restart-gate.sh \
|
||||
"$HOME"/.codex/plugins/cache/*/jsc-hooks/*/hooks/restart-gate.sh \
|
||||
"$HOME"/.kiro/skills/jsc-hooks/hooks/restart-gate.sh \
|
||||
2>/dev/null | sort | tail -n1)
|
||||
[ -n "$_c" ] && [ -f "$_c" ] && { printf '%s\n' "$_c"; return 0; }
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user