feat/sdlc-model-lock-and-wrapper #5
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jsc-hooks",
|
||||
"version": "0.0.2",
|
||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄",
|
||||
"version": "0.0.3",
|
||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄、SDLC 模型鎖",
|
||||
"skills": "./skills",
|
||||
"author": {
|
||||
"name": "JSC"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jsc-hooks",
|
||||
"version": "0.0.2",
|
||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄",
|
||||
"version": "0.0.3",
|
||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄、SDLC 模型鎖",
|
||||
"skills": "./skills"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# jsc-hooks — 給 AI 助理的指引
|
||||
|
||||
本 repo 是 jsc 技能組的 `hooks` domain(跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄),可同時被 Claude Code / Codex / Copilot / Antigravity / Kiro 使用。
|
||||
本 repo 是 jsc 技能組的 `hooks` domain(跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄、SDLC 模型鎖),可同時被 Claude Code / Codex / Copilot / Antigravity / Kiro 使用。
|
||||
|
||||
## 規則
|
||||
|
||||
|
||||
@@ -23,8 +23,16 @@ Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/jsc.git),安
|
||||
| `hooks/ste100-guard.sh` | UserPromptSubmit | 注入 STE100 繁體中文輸出規則(hook > prompt 強制層) |
|
||||
| `hooks/session-timer.sh` | SessionStart / Stop / SessionEnd | 記錄工作階段起訖;`report` 子指令供 `jsc-log:worklog` 取花費時間 |
|
||||
| `hooks/skill-usage.sh` | PostToolUse(Skill) | 記錄技能使用與呼叫鏈到 `$JSC_HOME/usage/*.jsonl`,供 `jsc-log:stats` 統計 |
|
||||
| `hooks/sdlc-gate.sh` | UserPromptSubmit | SDLC 每 session 模型鎖:`lock`/`unlock` 由 jsc-sdlc 階段技能呼叫,`check` 在模型與鎖不符時注入拒絕提醒 |
|
||||
|
||||
Claude 由 `hooks/hooks.json` 自動接線;其他 CLI 用 `hooks-install` 技能接線或降級為規則檔。
|
||||
Claude 由 `hooks/hooks.json` 自動接線;其他 CLI 用 `hooks-install` 技能接線、改裝包裝啟動器,或降級為規則檔。
|
||||
|
||||
## 工具
|
||||
|
||||
| 腳本 | 用途 |
|
||||
| --- | --- |
|
||||
| `tools/jsc-wrap.sh` | 無 hook 系統 CLI 的包裝啟動器:匯出 `JSC_CLI`、`JSC_SESSION_ID`,前後接 `session-timer.sh`,結束時自動跑 `scan-logs.sh` 回填 |
|
||||
| `tools/scan-logs.sh` | 離線回填:解析 copilot、antigravity、codex 的原生日誌,把技能用量與階段界線補進 `$JSC_HOME`,重掃不重複 |
|
||||
|
||||
## 失敗回報範本
|
||||
|
||||
@@ -44,7 +52,7 @@ Claude 由 `hooks/hooks.json` 自動接線;其他 CLI 用 `hooks-install` 技
|
||||
|
||||
### `hooks-install`
|
||||
|
||||
把三支 hook 接線到所有已安裝的 CLI:偵測 CLI 後逐一套用原生 hook 設定,無 hook 系統的 CLI 降級為規則檔(以 `<!-- jsc-hooks -->` 標記整段取代,不重複追加)。
|
||||
把四支 hook 接線到所有已安裝的 CLI:偵測 CLI 後逐一套用原生 hook 設定(claude 由 `hooks.json` 自動接線)。copilot、antigravity 改用兩段式:以 `tools/jsc-wrap.sh` 包裝啟動器補上計時與用量回填(結束時自動跑 `tools/scan-logs.sh`),語言規則仍追加到各自的規則檔(以 `<!-- jsc-hooks -->` 標記整段取代,不重複追加)。codex、kiro 的 SDLC 模型鎖降級為技能步驟檢查,鎖檔仍由 SDLC 技能直接呼叫 `sdlc-gate.sh lock` 寫入。
|
||||
|
||||
<!-- JSC-SKILLS:END -->
|
||||
|
||||
@@ -53,7 +61,8 @@ Claude 由 `hooks/hooks.json` 自動接線;其他 CLI 用 `hooks-install` 技
|
||||
| 變數 | 用途 | 未設定時 |
|
||||
| --- | --- | --- |
|
||||
| `JSC_HOME` | Hook 資料目錄 | 預設 `~/.jsc` |
|
||||
| `JSC_CLI` / `JSC_SESSION_ID` / `JSC_SKILL` | 非 Claude CLI 接線時由 wrapper 設定 | 安靜降級 |
|
||||
| `JSC_CLI` / `JSC_SESSION_ID` / `JSC_SKILL` | 非 Claude CLI 接線時由 `tools/jsc-wrap.sh` 或接線設定提供 | 安靜降級 |
|
||||
| `JSC_MODEL` | 非 Claude CLI 的目前模型,供 `sdlc-gate.sh check` 比對 | 改讀 `~/.claude/settings.json`,再不行就安靜降級 |
|
||||
|
||||
## 相關 domain
|
||||
|
||||
|
||||
+4
-1
@@ -4,7 +4,10 @@
|
||||
{ "hooks": [ { "type": "command", "command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/session-timer.sh\" start" } ] }
|
||||
],
|
||||
"UserPromptSubmit": [
|
||||
{ "hooks": [ { "type": "command", "command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/ste100-guard.sh\"" } ] }
|
||||
{ "hooks": [
|
||||
{ "type": "command", "command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/ste100-guard.sh\"" },
|
||||
{ "type": "command", "command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/sdlc-gate.sh\" check" }
|
||||
] }
|
||||
],
|
||||
"Stop": [
|
||||
{ "hooks": [ { "type": "command", "command": "sh \"${CLAUDE_PLUGIN_ROOT}/hooks/session-timer.sh\" mark" } ] }
|
||||
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env sh
|
||||
# sdlc-gate.sh — SDLC 每 session 模型鎖(stage ∈ plan/analyze/implement/maintain)。
|
||||
# 狀態檔: $JSC_HOME/sessions/{sid}.stage,單行「{stage} {model}」。
|
||||
# 用法:
|
||||
# sdlc-gate.sh lock {stage} {model} # 階段閘門通過時上鎖(覆寫既有鎖)
|
||||
# sdlc-gate.sh unlock # 移除狀態檔
|
||||
# sdlc-gate.sh check # hook 模式(UserPromptSubmit):模型不符時注入繁中提醒
|
||||
# sdlc-gate.sh report # 印出 {sid} {stage} {model};無鎖不印
|
||||
# 缺資料時安靜降級,永遠 exit 0,不可中斷宿主 CLI。
|
||||
HERE=$(dirname "$0"); . "$HERE/lib.sh"
|
||||
read_stdin
|
||||
sid=$(session_id)
|
||||
state="$JSC_HOME/sessions/$sid.stage"
|
||||
|
||||
case "${1:-check}" in
|
||||
lock)
|
||||
# 需要 stage 與 model 兩個參數,缺一就安靜降級
|
||||
if [ -n "${2:-}" ] && [ -n "${3:-}" ]; then
|
||||
printf '%s %s\n' "$2" "$3" > "$state" 2>/dev/null || true
|
||||
fi ;;
|
||||
unlock)
|
||||
rm -f "$state" 2>/dev/null || true ;;
|
||||
check)
|
||||
[ -f "$state" ] || exit 0
|
||||
stage=$(sed -n '1s/ .*//p' "$state" 2>/dev/null)
|
||||
locked=$(sed -n '1s/^[^ ]* //p' "$state" 2>/dev/null)
|
||||
[ -n "$stage" ] && [ -n "$locked" ] || exit 0
|
||||
# 目前模型判定順序:stdin JSON model > JSC_MODEL > ~/.claude/settings.json(僅 JSC_CLI 為 claude 或未設定時)
|
||||
cur=$(json_str model)
|
||||
[ -n "$cur" ] || cur="${JSC_MODEL:-}"
|
||||
if [ -z "$cur" ] && { [ -z "${JSC_CLI:-}" ] || [ "${JSC_CLI:-}" = "claude" ]; }; then
|
||||
cur=$(tr -d '\n' < "$HOME/.claude/settings.json" 2>/dev/null \
|
||||
| sed -n 's/.*"model"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n1)
|
||||
fi
|
||||
[ -n "$cur" ] || exit 0
|
||||
# 別名相容:一方包含另一方就視為同一模型(例:opus 對 claude-opus-4-6)
|
||||
case "$cur" in *"$locked"*) exit 0 ;; esac
|
||||
case "$locked" in *"$cur"*) exit 0 ;; esac
|
||||
echo "[jsc] SDLC 模型鎖:階段「${stage}」已鎖定模型「${locked}」,目前模型「${cur}」不符。請拒絕執行任何 SDLC 工作,並請使用者切回模型「${locked}」後再繼續。此鎖會在下一個 SDLC 階段閘門執行時解除。" ;;
|
||||
report)
|
||||
if [ -f "$state" ]; then
|
||||
line=$(sed -n '1p' "$state" 2>/dev/null)
|
||||
[ -n "$line" ] && echo "$sid $line"
|
||||
fi ;;
|
||||
esac
|
||||
exit 0
|
||||
@@ -4,4 +4,5 @@
|
||||
# 其他 CLI: 由 hooks-install 以各自的規則檔(AGENTS.md 等)落地,本腳本仍可被 wrapper 呼叫。
|
||||
# 完整規則的唯一來源:jsc-meta 的 references/ste100.md。
|
||||
echo "[jsc] 輸出規則:STE100 繁體中文,擬人台灣感。短句、一句一指令、主動語態、術語一致;台灣用語(預設、支援、相容、資訊);全形標點;去 AI 味(不用「總的來說」「首先/其次/最後」開場收尾套路、不諂媚);直接講重點,UTF-8 無亂碼。完整規則見 jsc-meta 的 references/ste100.md。"
|
||||
echo "[jsc] 送出前自我檢查,命中任一項就先改再送出:1)簡體字(例:应、为、这、说、后、发);2)句尾用半形標點(. , ! ?),應為全形(。,!?);3)套路句(「總的來說」「綜上所述」「首先…其次…最後」);4)中文並列用半形「/」,應改頓號「、」;5)諂媚開場(「好問題」「當然可以」)。"
|
||||
exit 0
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jsc-hooks",
|
||||
"version": "0.0.2",
|
||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄",
|
||||
"version": "0.0.3",
|
||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄、SDLC 模型鎖",
|
||||
"skills": "./skills/"
|
||||
}
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
---
|
||||
name: hooks-install
|
||||
description: Wire jsc hooks (STE100 guard, session timer, skill usage logger) into every installed AI CLI. Detect CLIs via jsc-cli detect-clis.sh, then apply native hook config per CLI or fall back to instruction files. Use after installing or updating the jsc plugin set; not for writing new hooks.
|
||||
description: Wire jsc hooks (STE100 guard, session timer, skill usage logger, SDLC model gate) into every installed AI CLI. Detect CLIs via jsc-cli detect-clis.sh, then apply native hook config, the jsc-wrap.sh launcher, or an instruction-file fallback per CLI. Use after installing or updating the jsc plugin set; not for writing new hooks.
|
||||
---
|
||||
|
||||
# hooks-install — wire jsc hooks into every installed CLI
|
||||
|
||||
Goal: make the three hooks (`ste100-guard.sh`, `session-timer.sh`, `skill-usage.sh`) effective in every CLI.
|
||||
Goal: make the four hooks (`ste100-guard.sh`, `session-timer.sh`, `skill-usage.sh`, `sdlc-gate.sh`) effective in every CLI.
|
||||
Claude wiring is automatic via `hooks.json`. On codex and kiro the SDLC gate degrades to the skill-step check only; the lock file still works because the SDLC skills call `sdlc-gate.sh lock` directly.
|
||||
The detailed flow **MUST run as a sub agent**; the main agent only reports the summary.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Run `jsc-cli/tools/detect-clis.sh` to get the installed CLIs and their paths.
|
||||
2. Wire each CLI per the table below (hooks first; degrade to an instruction file when the CLI has no hook system):
|
||||
1. Run `jsc-cli/tools/detect-clis.sh`. Done when you hold the list of installed CLIs; when the list is empty, report that and stop.
|
||||
2. Wire each CLI per the table below. A row counts as done only when its verify check passes:
|
||||
|
||||
| CLI | Wiring |
|
||||
| --- | --- |
|
||||
| claude | the plugin loads `jsc-hooks/hooks/hooks.json` automatically on install; verify only: `claude plugin list` shows `jsc-hooks` and `/hooks` shows the registrations |
|
||||
| codex | set `notify` in `~/.codex/config.toml` to `session-timer.sh mark` (with `JSC_CLI=codex`); append the STE100 rule to `~/.codex/AGENTS.md` (prompt fallback) |
|
||||
| copilot | no hook system: append the STE100 rule to `~/.config/copilot/copilot-instructions.md` (prompt fallback) |
|
||||
| antigravity | no public hook system: append the STE100 rule to the global rules file (prompt fallback) |
|
||||
| kiro | create an agent hook under the workspace `.kiro/hooks/` that runs the matching script (with `JSC_CLI=kiro`) |
|
||||
| CLI | Wiring | Verify |
|
||||
| --- | --- | --- |
|
||||
| claude | the plugin loads `jsc-hooks/hooks/hooks.json` automatically on install (all four hooks, `sdlc-gate.sh check` included); nothing to write | `claude plugin list` shows `jsc-hooks` and `/hooks` shows the registrations |
|
||||
| codex | set `notify` in `~/.codex/config.toml` to `session-timer.sh mark` (with `JSC_CLI=codex`); append the STE100 rule block to `~/.codex/AGENTS.md` (prompt fallback) | `config.toml` contains the `notify` entry and `AGENTS.md` contains the block |
|
||||
| copilot | (a) install the wrapper: add a shell alias or launcher that starts the CLI via `jsc-hooks/tools/jsc-wrap.sh copilot`, so session timing and usage backfill work — `tools/scan-logs.sh` runs automatically at wrapper exit; (b) keep appending the STE100 rule block to `~/.config/copilot/copilot-instructions.md` (prompt fallback for the language rules) | the alias resolves to `jsc-wrap.sh copilot` and the instruction file contains the block |
|
||||
| antigravity | (a) install the wrapper: add a shell alias or launcher that starts the CLI via `jsc-hooks/tools/jsc-wrap.sh antigravity` — `tools/scan-logs.sh` runs automatically at wrapper exit; (b) keep appending the STE100 rule block to the global rules file (prompt fallback for the language rules) | the alias resolves to `jsc-wrap.sh antigravity` and the rules file contains the block |
|
||||
| kiro | create an agent hook under the workspace `.kiro/hooks/` that runs the matching script (with `JSC_CLI=kiro`) | the hook file exists under `.kiro/hooks/` and names the script |
|
||||
|
||||
3. The appended rule text is always the exact output of `ste100-guard.sh` (a Traditional Chinese literal). Wrap it in `<!-- jsc-hooks -->` markers; on re-run, replace the whole block instead of appending again.
|
||||
4. Report the wiring result for every CLI: succeeded, degraded to prompt, or the skip reason.
|
||||
3. The appended rule text is always the exact output of `ste100-guard.sh` (a Traditional Chinese literal). Wrap it in `<!-- jsc-hooks -->` markers; on re-run, replace the whole block instead of appending again. Done when each touched instruction file contains exactly one `<!-- jsc-hooks -->` block.
|
||||
4. Report the wiring result for every CLI. Done when every detected CLI has exactly one status: succeeded, degraded to prompt, or skipped with a reason.
|
||||
|
||||
## Notes
|
||||
|
||||
- The hook scripts accept both stdin JSON and environment variables (`JSC_CLI`, `JSC_SESSION_ID`, `JSC_SKILL`); a wrapper only needs to set the variables.
|
||||
- The hook scripts accept both stdin JSON and environment variables (`JSC_CLI`, `JSC_SESSION_ID`, `JSC_SKILL`, `JSC_MODEL`); `jsc-wrap.sh` sets the first two itself.
|
||||
- Data lands in `$JSC_HOME` (default `~/.jsc`), consumed by `jsc-log:worklog` and `jsc-log:stats`.
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env sh
|
||||
# jsc-wrap.sh — 無 hook 系統 CLI 的包裝啟動器(例:copilot、antigravity)。
|
||||
# 用法: jsc-wrap.sh {cli} [args...]
|
||||
# 行為: 匯出 JSC_CLI 與 JSC_SESSION_ID → session-timer start → 執行 CLI →
|
||||
# 結束後 session-timer mark 並以 scan-logs.sh 回填用量,最後回傳 CLI 的結束碼。
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
HOOKS="$HERE/../hooks"
|
||||
cli="${1:-}"
|
||||
if [ -z "$cli" ]; then
|
||||
echo "用法:jsc-wrap.sh {cli} [args...]" >&2
|
||||
exit 2
|
||||
fi
|
||||
shift
|
||||
JSC_CLI="$cli"
|
||||
# 未提供 session id 就自動產生({cli}-時間戳-PID),讓計時與用量共用同一個 session
|
||||
[ -n "${JSC_SESSION_ID:-}" ] || JSC_SESSION_ID="$cli-$(date +%Y%m%d%H%M%S)-$$"
|
||||
export JSC_CLI JSC_SESSION_ID
|
||||
sh "$HOOKS/session-timer.sh" start </dev/null
|
||||
"$cli" "$@"
|
||||
rc=$?
|
||||
# 收尾:補記結束時間,並從原生日誌回填技能用量
|
||||
sh "$HOOKS/session-timer.sh" mark </dev/null
|
||||
sh "$HERE/scan-logs.sh" --cli "$cli" --session "$JSC_SESSION_ID" </dev/null || true
|
||||
exit "$rc"
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
#!/usr/bin/env sh
|
||||
# scan-logs.sh — 離線回填:解析各 CLI 的原生日誌,把可辨識的技能使用與工作階段界線
|
||||
# 補進 $JSC_HOME/usage/skills.jsonl(與 skill-usage.sh 同一種紀錄格式)與 $JSC_HOME/sessions/。
|
||||
# 用法: scan-logs.sh --cli {name} [--session {sid}]
|
||||
# 支援: copilot(~/.config/copilot/)、antigravity(全域日誌目錄)、codex(~/.codex/sessions/、~/.codex/log/)。
|
||||
# 去重: 以 $JSC_HOME/usage/scan-state/ 記住每個日誌檔已掃描的位元組數,重掃只讀新增段落。
|
||||
HERE=$(cd "$(dirname "$0")" && pwd); . "$HERE/../hooks/lib.sh"
|
||||
|
||||
cli=""; sid=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--cli) cli="${2:-}"; shift; shift ;;
|
||||
--session) sid="${2:-}"; shift; shift ;;
|
||||
*) shift ;;
|
||||
esac
|
||||
done
|
||||
if [ -z "$cli" ]; then
|
||||
echo "用法:scan-logs.sh --cli {name} [--session {sid}]" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
STATE="$JSC_HOME/usage/scan-state"
|
||||
mkdir -p "$STATE" 2>/dev/null || true
|
||||
|
||||
# 檔案修改時間(epoch),取不到就用現在
|
||||
mtime_epoch() {
|
||||
stat -c %Y "$1" 2>/dev/null || date -r "$1" +%s 2>/dev/null || now_epoch
|
||||
}
|
||||
|
||||
# 回填工作階段界線:start 只補缺,end 取較新值(不覆蓋較新的即時紀錄)
|
||||
record_session() { # $1=sid $2=epoch
|
||||
[ -f "$JSC_HOME/sessions/$1.start" ] || echo "$2" > "$JSC_HOME/sessions/$1.start"
|
||||
old=$(cat "$JSC_HOME/sessions/$1.end" 2>/dev/null || echo 0)
|
||||
if [ "$2" -gt "$old" ] 2>/dev/null; then echo "$2" > "$JSC_HOME/sessions/$1.end"; fi
|
||||
}
|
||||
|
||||
# 印出日誌檔自上次掃描後的新增內容,並更新位移(位移即去重機制)
|
||||
new_content() { # $1=file
|
||||
key=$(printf '%s' "$1" | cksum | tr ' \t' '--')
|
||||
off_f="$STATE/$cli-$key.offset"
|
||||
off=$(cat "$off_f" 2>/dev/null || echo 0)
|
||||
size=$(wc -c < "$1" 2>/dev/null || echo 0)
|
||||
[ "$size" -gt "$off" ] 2>/dev/null || return 0
|
||||
tail -c +"$((off + 1))" "$1" 2>/dev/null
|
||||
echo "$size" > "$off_f"
|
||||
}
|
||||
|
||||
# 從新增內容萃取 jsc 技能代號,逐筆追加(同一批先去重;格式與 skill-usage.sh 完全相同)
|
||||
append_skills() { # stdin=內容 $1=sid
|
||||
grep -oE 'jsc-[a-z]+:[a-z0-9][a-z0-9-]*' 2>/dev/null | sort -u | while IFS= read -r sk; do
|
||||
printf '{"ts":"%s","cli":"%s","session":"%s","skill":"%s"}\n' \
|
||||
"$(now_iso)" "$cli" "$1" "$sk" >> "$JSC_HOME/usage/skills.jsonl"
|
||||
done
|
||||
}
|
||||
|
||||
# 掃描一個日誌目錄;$2=預設 sid(空字串時用檔名當 sid);$3=sessions 時回填階段界線
|
||||
scan_dir() {
|
||||
find "$1" -maxdepth 3 -type f \( -name '*.json' -o -name '*.jsonl' -o -name '*.log' \) 2>/dev/null \
|
||||
| while IFS= read -r f; do
|
||||
s="$2"
|
||||
[ -n "$s" ] || s="$cli-$(basename "$f" | sed 's/\.[^.]*$//')"
|
||||
[ "${3:-}" = "sessions" ] && record_session "$s" "$(mtime_epoch "$f")"
|
||||
new_content "$f" | append_skills "$s"
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$cli" in
|
||||
copilot)
|
||||
d="$HOME/.config/copilot"
|
||||
if [ ! -d "$d" ]; then echo "[jsc] 找不到 copilot 日誌目錄($d),略過回填。"; exit 0; fi
|
||||
[ -d "$d/history-session-state" ] && scan_dir "$d/history-session-state" "$sid" sessions
|
||||
[ -d "$d/history" ] && scan_dir "$d/history" "$sid" sessions
|
||||
[ -d "$d/logs" ] && scan_dir "$d/logs" "$sid" logs ;;
|
||||
antigravity)
|
||||
found=""
|
||||
for d in "$HOME/.antigravity/logs" "$HOME/.config/antigravity/logs" "$HOME/.antigravity"; do
|
||||
if [ -d "$d" ]; then found=1; scan_dir "$d" "$sid" sessions; break; fi
|
||||
done
|
||||
if [ -z "$found" ]; then echo "[jsc] 找不到 antigravity 日誌目錄,略過回填。"; exit 0; fi ;;
|
||||
codex)
|
||||
d1="$HOME/.codex/sessions"; d2="$HOME/.codex/log"
|
||||
if [ ! -d "$d1" ] && [ ! -d "$d2" ]; then
|
||||
echo "[jsc] 找不到 codex 日誌目錄($d1、$d2),略過回填。"; exit 0
|
||||
fi
|
||||
[ -d "$d1" ] && scan_dir "$d1" "$sid" sessions
|
||||
[ -d "$d2" ] && scan_dir "$d2" "$sid" logs ;;
|
||||
*)
|
||||
echo "[jsc] 尚未支援 $cli 的日誌回填,略過。" ;;
|
||||
esac
|
||||
exit 0
|
||||
Reference in New Issue
Block a user