feat(wiki): wiki 頁型允許清單新增 LEARN

What:gitea.sh 的 wiki-repo 允許型別清單、wiki 技能 SKILL.md 的頁型清單,以及 check-wiki-rules.sh 的驗證案例,同步收錄 LEARN 頁型。
Why:jsc-log 新增 LEARN wiki 頁型,若允許清單未收錄,wiki-repo LEARN 會以 unknown type(exit 2)被擋下,學習紀錄頁無法解析存放位置。
How:resolve_wiki_repo 的 case 白名單加入 LEARN,解析順序維持 JSC_WIKI_REPO_LEARN 優先、退回 JSC_WIKI_REPO、不跨型別代用;check-wiki-rules.sh 補上 LEARN 專屬變數優先與退回共用預設兩個案例;SKILL.md 允許頁型清單同步更新。
Who:jsc-gitea wiki 技能與其呼叫方(jsc-log 等)的 wiki 頁型解析功能。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 11:36:49 +08:00
co-authored by Claude Fable 5
parent 11082f648e
commit 653b619ea1
3 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -9,10 +9,10 @@ Every wiki operation in the jsc skill set goes through this skill. One entry poi
## Resolve the wiki location ## Resolve the wiki location
Different page types can live in different `{owner}/{repo}` repos, classified by page-name prefix: `QUESTION`, `PLAN`, `ANALYZE`, `MAINTAIN`, `REPO`, `LOG`, `ERROR`. Different page types can live in different `{owner}/{repo}` repos, classified by page-name prefix: `QUESTION`, `PLAN`, `ANALYZE`, `MAINTAIN`, `REPO`, `LOG`, `LEARN`, `ERROR`.
1. Before asking the user, inspect the current shell environment for the needed repo variables and Gitea connection variables: `JSC_WIKI_REPO_{TYPE}`, `JSC_WIKI_REPO`, `GITEA_HOST`, and `GITEA_TOKEN`. Use inherited shell values first; only ask when the needed repo cannot be resolved after that check. 1. Before asking the user, inspect the current shell environment for the needed repo variables and Gitea connection variables: `JSC_WIKI_REPO_{TYPE}`, `JSC_WIKI_REPO`, `GITEA_HOST`, and `GITEA_TOKEN`. Use inherited shell values first; only ask when the needed repo cannot be resolved after that check.
2. Run `tools/gitea.sh wiki-repo {TYPE}` (TYPE = the page-name prefix). Allowed types are `QUESTION`, `PLAN`, `ANALYZE`, `MAINTAIN`, `REPO`, `LOG`, and `ERROR`. Resolution order is `JSC_WIKI_REPO_{TYPE}` first, then `JSC_WIKI_REPO`. Never borrow another type's repo. 2. Run `tools/gitea.sh wiki-repo {TYPE}` (TYPE = the page-name prefix). Allowed types are `QUESTION`, `PLAN`, `ANALYZE`, `MAINTAIN`, `REPO`, `LOG`, `LEARN`, and `ERROR`. Resolution order is `JSC_WIKI_REPO_{TYPE}` first, then `JSC_WIKI_REPO`. Never borrow another type's repo.
3. On exit 3 (neither is set after env inspection), ask the user for that page type's `{owner}/{repo}` per the `jsc-ask:ask` rules, and suggest setting `JSC_WIKI_REPO_{TYPE}` (can differ per type) or `JSC_WIKI_REPO` (shared default). 3. On exit 3 (neither is set after env inspection), ask the user for that page type's `{owner}/{repo}` per the `jsc-ask:ask` rules, and suggest setting `JSC_WIKI_REPO_{TYPE}` (can differ per type) or `JSC_WIKI_REPO` (shared default).
## Operations ## Operations
+8
View File
@@ -52,6 +52,14 @@ check_repo ANALYZE 'ANALYZE falls back to shared only' 'shared/wiki' \
JSC_WIKI_REPO_REPO='records/REPO' \ JSC_WIKI_REPO_REPO='records/REPO' \
JSC_WIKI_REPO='shared/wiki' JSC_WIKI_REPO='shared/wiki'
check_repo LEARN 'LEARN specific wins' 'lessons/LEARN' \
JSC_WIKI_REPO_LEARN='lessons/LEARN' \
JSC_WIKI_REPO='shared/wiki'
check_repo LEARN 'LEARN falls back to shared only' 'shared/wiki' \
JSC_WIKI_REPO_LOG='records/LOG' \
JSC_WIKI_REPO='shared/wiki'
check_repo ERROR 'ERROR uses its own repo' 'errors/wiki' \ check_repo ERROR 'ERROR uses its own repo' 'errors/wiki' \
JSC_WIKI_REPO_ERROR='errors/wiki' \ JSC_WIKI_REPO_ERROR='errors/wiki' \
JSC_WIKI_REPO='shared/wiki' JSC_WIKI_REPO='shared/wiki'
+2 -2
View File
@@ -7,7 +7,7 @@
# gitea.sh clone-url <owner>/<repo> # 印出 clone URL # gitea.sh clone-url <owner>/<repo> # 印出 clone URL
# gitea.sh hash-id <text> # 產生 8 碼大寫 SHA-1 hash;首碼為 0-9/A/B/C 時改成 Hxxxxxxx # gitea.sh hash-id <text> # 產生 8 碼大寫 SHA-1 hash;首碼為 0-9/A/B/C 時改成 Hxxxxxxx
# gitea.sh wiki-repo <TYPE> # 解析頁面類型的 wiki 位置: # gitea.sh wiki-repo <TYPE> # 解析頁面類型的 wiki 位置:
# TYPE = QUESTION|PLAN|ANALYZE|MAINTAIN|REPO|LOG|ERROR(即頁名前綴) # TYPE = QUESTION|PLAN|ANALYZE|MAINTAIN|REPO|LOG|LEARN|ERROR(即頁名前綴)
# 依序取 JSC_WIKI_REPO_{TYPE} > JSC_WIKI_REPO;不得跨類型代用;都未設定 exit 3 # 依序取 JSC_WIKI_REPO_{TYPE} > JSC_WIKI_REPO;不得跨類型代用;都未設定 exit 3
# gitea.sh wiki-list <owner>/<repo> # 列出 wiki 頁名 # gitea.sh wiki-list <owner>/<repo> # 列出 wiki 頁名
# gitea.sh wiki-get <owner>/<repo> <page> # 印出 wiki 頁 markdown;不存在時 exit 4 # gitea.sh wiki-get <owner>/<repo> <page> # 印出 wiki 頁 markdown;不存在時 exit 4
@@ -27,7 +27,7 @@ script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
resolve_wiki_repo() { # TYPE -> JSC_WIKI_REPO_{TYPE} -> JSC_WIKI_REPO resolve_wiki_repo() { # TYPE -> JSC_WIKI_REPO_{TYPE} -> JSC_WIKI_REPO
type=$(printf '%s' "${1:?TYPE required}" | tr a-z A-Z) type=$(printf '%s' "${1:?TYPE required}" | tr a-z A-Z)
case "$type" in case "$type" in
QUESTION|PLAN|ANALYZE|MAINTAIN|REPO|LOG|ERROR) ;; QUESTION|PLAN|ANALYZE|MAINTAIN|REPO|LOG|LEARN|ERROR) ;;
*) echo "unknown wiki type: $type" >&2; exit 2 ;; *) echo "unknown wiki type: $type" >&2; exit 2 ;;
esac esac
eval "v=\${JSC_WIKI_REPO_${type}:-}" eval "v=\${JSC_WIKI_REPO_${type}:-}"