什麼:tools/worklog-target.sh 不再自行重算 SHA-1,改為直接接收呼叫端算好的 hash 參數;skills/worklog/SKILL.md、README.md 同步更新呼叫方式與工具說明;plugin.json、.claude-plugin/plugin.json、.codex-plugin/plugin.json 版本號由 0.0.3 升至 0.0.4。
為什麼:原本 worklog-target.sh 重複實作了共享的 SHA-1 wiki-hash 演算法,與 jsc-gitea/tools/hash-id 的邏輯重複,違反單一事實來源原則,也和 learn 技能已採用的正確呼叫模式不一致。
如何:移除腳本內建的 sha1sum/shasum 計算與 hash 前綴修正邏輯,改為直接使用傳入的 hash 參數組出 LOG_{HASH}、LOG_CONTENTS;SKILL.md 改為先呼叫 jsc-gitea/tools/hash-id 算出 HASH 再傳給 worklog-target.sh;輸出行為與結果不變。
誰:jsc-meta:skill-check 例行合規稽核(worklog 技能)。
35 lines
699 B
Bash
Executable File
35 lines
699 B
Bash
Executable File
#!/usr/bin/env sh
|
|
# worklog-target.sh: 由已算好的 hash 組出 worklog wiki 目標頁名稱。
|
|
# hash 一律由 jsc-gitea/tools/hash-id 算出後傳入,本腳本不再自行計算 SHA-1。
|
|
# 用法:
|
|
# worklog-target.sh <hash> [page|contents|all]
|
|
set -eu
|
|
|
|
usage() {
|
|
echo 'usage: worklog-target.sh <hash> [page|contents|all]' >&2
|
|
exit 2
|
|
}
|
|
|
|
[ "$#" -ge 1 ] || usage
|
|
[ "$#" -le 2 ] || usage
|
|
|
|
hash=$1
|
|
field=${2:-page}
|
|
|
|
if [ -z "$hash" ]; then
|
|
usage
|
|
fi
|
|
|
|
page="LOG_${hash}"
|
|
contents='LOG_CONTENTS'
|
|
|
|
case "$field" in
|
|
page) printf '%s\n' "$page" ;;
|
|
contents) printf '%s\n' "$contents" ;;
|
|
all)
|
|
printf 'PAGE=%s\n' "$page"
|
|
printf 'CONTENTS=%s\n' "$contents"
|
|
;;
|
|
*) usage ;;
|
|
esac
|