From 920c68087e0c2c3f3fdbd697132776a41026befb Mon Sep 17 00:00:00 2001 From: Jeffery Date: Thu, 27 Aug 2026 16:34:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat(wiki):=20=E6=94=AF=E6=8F=B4=20SKILLSET?= =?UTF-8?q?=20=E9=A0=81=E9=9D=A2=E9=A1=9E=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:`tools/gitea.sh` 的 `resolve_wiki_repo()` 允許清單加入 `SKILLSET`,`wiki-repo` 的用法註解同步。`skills/wiki/SKILL.md` 第 2 步的允許頁型補上 `SKILLSET`,同時補上先前漏列的 `CHECK` 與 `REPORT`;`description` 的呼叫端清單補上「`jsc-meta` 的 `SKILLSET` 頁」。 Why:`jsc-meta` 的四支異動技能收尾要把驗證結果寫進 `SKILLSET_{HASH}`,而所有 wiki 讀寫都走這一支技能與這一支腳本。頁型不在允許清單裡,`wiki-repo` 會直接 exit 2,報告一個字也寫不進去。`CHECK` 與 `REPORT` 是另一件事:腳本早就支援,技能的允許清單卻沒補,照技能寫的走會以為那兩種頁型不合法。 How:只加類型名,解析規則不動——`JSC_WIKI_REPO_SKILLSET` 優先,未設定才退回 `JSC_WIKI_REPO`,不做跨類型代用,兩個都沒有仍是 exit 3 交回技能問使用者。雜湊來源是被改動的 domain 存取庫 `{owner}/{repo}`,用的是同一支 `hash-id`,所以這裡不必為它多寫一條特例(`CHECK` 那種主機加帳號的例外才需要)。 Who:`jsc-gitea:wiki` 技能與 `jsc-meta` 四支異動技能的異動報告寫入路徑。 --- skills/wiki/SKILL.md | 4 ++-- tools/gitea.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/skills/wiki/SKILL.md b/skills/wiki/SKILL.md index 77af67f..7b5a641 100644 --- a/skills/wiki/SKILL.md +++ b/skills/wiki/SKILL.md @@ -1,6 +1,6 @@ --- name: wiki -description: Read or write a Gitea wiki page through tools/gitea.sh and tools/hash-id. Resolve the wiki repo per page type with JSC_WIKI_REPO_{TYPE} first, then JSC_WIKI_REPO, and ask only when neither is set. Page content is chart-first - prefer mermaid diagrams and markdown tables over plain prose. Callers are jsc-ask, jsc-sdlc, jsc-log, jsc-hooks for its ERROR pages, and jsc-cli for its CHECK pages. Use for any wiki page in the skill set; not for repo code files. +description: Read or write a Gitea wiki page through tools/gitea.sh and tools/hash-id. Resolve the wiki repo per page type with JSC_WIKI_REPO_{TYPE} first, then JSC_WIKI_REPO, and ask only when neither is set. Page content is chart-first - prefer mermaid diagrams and markdown tables over plain prose. Callers are jsc-ask, jsc-sdlc, jsc-log, jsc-hooks for its ERROR pages, jsc-cli for its CHECK pages, and jsc-meta for its SKILLSET pages. Use for any wiki page in the skill set; not for repo code files. --- # wiki — read and write Gitea wiki pages @@ -12,7 +12,7 @@ Every wiki operation in the jsc skill set goes through this skill. One entry poi Different page types can live in different `{owner}/{repo}` repos, classified by the page-name prefix. 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` (also check `tea login list` for a usable login token when `GITEA_TOKEN` is unset). Use inherited shell values first; only ask when the needed repo or connection value cannot be resolved after that check. Done when every one of those variables is either resolved from the environment or listed as missing. -2. Run `tools/gitea.sh wiki-repo {TYPE}` (TYPE = the page-name prefix). Allowed types are `QUESTION`, `PLAN`, `ANALYZE`, `DELIVER`, `MAINTAIN`, `REPO`, `LOG`, `LEARN`, and `ERROR`. Resolution order is `JSC_WIKI_REPO_{TYPE}` first, then `JSC_WIKI_REPO`. Never borrow another type's repo. Done when the command has printed exactly one `{owner}/{repo}`, or exited 3 and sent this page type to step 3. +2. Run `tools/gitea.sh wiki-repo {TYPE}` (TYPE = the page-name prefix). Allowed types are `QUESTION`, `PLAN`, `ANALYZE`, `DELIVER`, `MAINTAIN`, `REPO`, `LOG`, `LEARN`, `ERROR`, `CHECK`, `REPORT`, and `SKILLSET`. Resolution order is `JSC_WIKI_REPO_{TYPE}` first, then `JSC_WIKI_REPO`. Never borrow another type's repo. Done when the command has printed exactly one `{owner}/{repo}`, or exited 3 and sent this page type to step 3. 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). Done when the user has supplied one `{owner}/{repo}` for that page type. ## Operations diff --git a/tools/gitea.sh b/tools/gitea.sh index b5b952a..9b4470a 100755 --- a/tools/gitea.sh +++ b/tools/gitea.sh @@ -7,7 +7,7 @@ # gitea.sh clone-url / # 印出 clone URL # gitea.sh hash-id # 產生 8 碼大寫 SHA-1 hash;首碼為 0-9/A/B/C 時改成 Hxxxxxxx # gitea.sh wiki-repo # 解析頁面類型的 wiki 位置: -# TYPE = QUESTION|PLAN|ANALYZE|DELIVER|MAINTAIN|REPO|LOG|LEARN|ERROR|CHECK|REPORT(即頁名前綴) +# TYPE = QUESTION|PLAN|ANALYZE|DELIVER|MAINTAIN|REPO|LOG|LEARN|ERROR|CHECK|REPORT|SKILLSET(即頁名前綴) # 依序取 JSC_WIKI_REPO_{TYPE} > JSC_WIKI_REPO;不得跨類型代用;都未設定 exit 3 # gitea.sh wiki-list / # 列出 wiki 頁名 # gitea.sh wiki-get / # 印出 wiki 頁 markdown;不存在時 exit 4 @@ -33,7 +33,7 @@ script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) resolve_wiki_repo() { # TYPE -> JSC_WIKI_REPO_{TYPE} -> JSC_WIKI_REPO type=$(printf '%s' "${1:?TYPE required}" | tr a-z A-Z) case "$type" in - QUESTION|PLAN|ANALYZE|DELIVER|MAINTAIN|REPO|LOG|LEARN|ERROR|CHECK|REPORT) ;; + QUESTION|PLAN|ANALYZE|DELIVER|MAINTAIN|REPO|LOG|LEARN|ERROR|CHECK|REPORT|SKILLSET) ;; *) echo "unknown wiki type: $type" >&2; exit 2 ;; esac eval "v=\${JSC_WIKI_REPO_${type}:-}" From 653d54476b7c34c486e9ca01701107ec84a6bf35 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Thu, 27 Aug 2026 16:34:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?test(check-wiki-rules):=20=E9=A0=81?= =?UTF-8?q?=E5=9E=8B=E9=A9=97=E8=AD=89=E6=B6=B5=E8=93=8B=20SKILLSET?= =?UTF-8?q?=EF=BC=8C=E8=AA=AA=E6=98=8E=E6=94=B9=E7=82=BA=E4=B8=8D=E7=B6=81?= =?UTF-8?q?=E9=A1=9E=E5=9E=8B=E6=95=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:`tools/check-wiki-rules.sh` 的 `TYPES` 加入 `SKILLSET`,檔頭的「涵蓋全部十一種頁面類型」改成「涵蓋 `TYPES` 列的每一種頁面類型」,誘餌值那段註解的「其他八個類型」改成「其餘每一個類型」。 Why:驗證清單沒跟上,新頁型的三項判定(專用變數優先、退回共用變數、不得跨類型代用)就一次都沒驗到。註解裡寫死數字更麻煩:每加一種頁型就要記得改兩個數字,忘了改註解就開始騙人——事實上加 `CHECK` 與 `REPORT` 那次就已經漏了一個。 How:只加 `TYPES` 一個字串,三項判定與誘餌值都是照 `TYPES` 展開的,加進去就自動涵蓋,不必另外寫測項。註解一律改成指向 `TYPES` 這個變數,不再寫死數量,日後加頁型只要改一個地方。 Who:`jsc-gitea` 的 wiki 頁型解析驗證,以及日後新增頁面類型的人。 --- tools/check-wiki-rules.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/check-wiki-rules.sh b/tools/check-wiki-rules.sh index 44c4374..f11074c 100755 --- a/tools/check-wiki-rules.sh +++ b/tools/check-wiki-rules.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh # check-wiki-rules — 驗證 wiki repo 解析與 hash-id 規則。 -# 涵蓋全部十一種頁面類型,每種三項:專用變數優先、退回共用變數、不得跨類型代用。 +# 涵蓋 TYPES 列的每一種頁面類型,每種三項:專用變數優先、退回共用變數、不得跨類型代用。 # 全部通過印 OK 並 exit 0;任一項不符印出差異並 exit 1。 set -eu @@ -8,7 +8,7 @@ dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) gitea="$dir/gitea.sh" hash_id="$dir/hash-id" -TYPES='QUESTION PLAN ANALYZE DELIVER MAINTAIN REPO LOG LEARN ERROR CHECK REPORT' +TYPES='QUESTION PLAN ANALYZE DELIVER MAINTAIN REPO LOG LEARN ERROR CHECK REPORT SKILLSET' fail() { printf '%s\n' "$1" >&2 @@ -51,7 +51,7 @@ check_hash() { expect_eq "$got" "$want" "hash-id $input" } -# 其他八個類型的誘餌值。跨類型代用一旦發生,回傳的就會是 decoy/{別的類型}。 +# 其餘每一個類型的誘餌值。跨類型代用一旦發生,回傳的就會是 decoy/{別的類型}。 decoys() { # $1=要排除的類型 for t in $TYPES; do [ "$t" = "$1" ] || printf 'JSC_WIKI_REPO_%s=decoy/%s ' "$t" "$t" From c3b46c982f17e2b3c5a163939942acb3c6562630 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Thu, 27 Aug 2026 16:34:17 +0800 Subject: [PATCH 3/4] =?UTF-8?q?docs(gitea):=20README=20=E8=A3=9C=E4=B8=8A?= =?UTF-8?q?=20SKILLSET=20=E9=A0=81=E5=9E=8B=E8=88=87=E5=B0=88=E7=94=A8?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E8=AE=8A=E6=95=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:`README.md` 兩處增修。`wiki-repo` 的用法說明把允許的 `TYPE` 清單補到十二種(加上 `CHECK`、`REPORT`、`SKILLSET`);環境變數表新增 `JSC_WIKI_REPO_SKILLSET` 一列,寫明對應 `SKILLSET_CONTENTS`、`SKILLSET_{HASH}`(技能組異動報告)與雜湊來源 `{owner}/{repo}`。 Why:README 的類型清單停在九種,`CHECK` 與 `REPORT` 支援了卻沒補上。照 README 設定環境變數的人會以為這幾種頁型沒有專用變數,只能全塞進共用的 `JSC_WIKI_REPO`。 How:`SKILLSET` 單獨列一列而不是併進 `JSC_WIKI_REPO_{TYPE}` 那一行,因為它要多寫雜湊來源;`JSC_WIKI_REPO_{TYPE}` 那一行只補清單,退回規則不動,兩列都保留「不做跨類型代用」這句。 Who:讀 `jsc-gitea` 說明設定 wiki 位置的操作者。 --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ad8065..4c9fc30 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ gitea.sh repos # 列出 owner 的 repo 全名 gitea.sh default-branch / gitea.sh clone-url / gitea.sh hash-id # 產生 8 碼大寫 SHA-1;首碼 0-9/A/B/C 時改成 Hxxxxxxx -gitea.sh wiki-repo # 解析頁面類型的 wiki 位置(TYPE = QUESTION / PLAN / ANALYZE / DELIVER / MAINTAIN / REPO / LOG / LEARN / ERROR) +gitea.sh wiki-repo # 解析頁面類型的 wiki 位置(TYPE = QUESTION / PLAN / ANALYZE / DELIVER / MAINTAIN / REPO / LOG / LEARN / ERROR / CHECK / REPORT / SKILLSET) gitea.sh wiki-list / gitea.sh wiki-get / # 不存在 exit 4 gitea.sh wiki-put / # 自動判斷新建或更新 @@ -131,7 +131,8 @@ Gitea wiki 頁讀寫的統一入口:依頁面類型(QUESTION / PLAN / ANALYZ | --- | --- | --- | | `GITEA_HOST` | Gitea 站台(可省略 scheme,預設 https) | 詢問使用者 | | `GITEA_TOKEN` | Gitea API token;缺少或遇 401/403 時自動退回 tea CLI 登入 token | 詢問使用者 | -| `JSC_WIKI_REPO_{TYPE}` | 各類型 wiki 頁的 `{owner}/{repo}`;TYPE = QUESTION / PLAN / ANALYZE / DELIVER / MAINTAIN / REPO / LOG / LEARN / ERROR | 退回 `JSC_WIKI_REPO`,不做跨類型代用 | +| `JSC_WIKI_REPO_{TYPE}` | 各類型 wiki 頁的 `{owner}/{repo}`;TYPE = QUESTION / PLAN / ANALYZE / DELIVER / MAINTAIN / REPO / LOG / LEARN / ERROR / CHECK / REPORT | 退回 `JSC_WIKI_REPO`,不做跨類型代用 | +| `JSC_WIKI_REPO_SKILLSET` | `SKILLSET_CONTENTS`、`SKILLSET_{HASH}`(技能組異動報告)的 `{owner}/{repo}`;雜湊來源為 `{owner}/{repo}` | 退回 `JSC_WIKI_REPO`,不做跨類型代用 | | `JSC_WIKI_REPO` | 共用預設的 wiki `{owner}/{repo}` | 詢問使用者 | | `JSC_HOME` | `pr-watch.sh` 狀態檔的根目錄 | 預設 `~/.jsc` | | `JSC_PR_WATCH_INTERVAL` | `pr-watch.sh` 的輪詢間隔秒數(正整數) | 預設 60 | From 1db01ca0f1cf3e90e90233226c7a3611995b6deb Mon Sep 17 00:00:00 2001 From: Jeffery Date: Thu, 27 Aug 2026 16:34:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?chore(manifest):=20=E4=B8=89=E4=BB=BD=20man?= =?UTF-8?q?ifest=20=E7=89=88=E6=9C=AC=E5=8D=87=E5=88=B0=200.1.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:`plugin.json`、`.claude-plugin/plugin.json`、`.codex-plugin/plugin.json` 的 `version` 由 0.1.5 改為 0.1.6。 Why:本次 `wiki-repo` 多支援一種頁面類型,`wiki` 技能的允許頁型也跟著補齊,屬於行為變更,版本要跟著往上走,各 CLI 才知道要更新。 How:三份只改 `version` 一個欄位,其餘內容不動,三份保持同一版號。 Who:`jsc-gitea` 外掛的套件描述檔。 --- .claude-plugin/plugin.json | 2 +- .codex-plugin/plugin.json | 2 +- plugin.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 8b857f3..fc5f906 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "jsc-gitea", - "version": "0.1.5", + "version": "0.1.6", "description": "Gitea API 工具、Wiki 讀寫、議題轉換、HTML 匯出與存取庫批次同步", "skills": "./skills", "author": { diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 7f78991..f54c018 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "jsc-gitea", - "version": "0.1.5", + "version": "0.1.6", "description": "Gitea API 工具、Wiki 讀寫、議題轉換、HTML 匯出與存取庫批次同步", "skills": "./skills" } diff --git a/plugin.json b/plugin.json index 06aefb8..39cc9c0 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "name": "jsc-gitea", - "version": "0.1.5", + "version": "0.1.6", "description": "Gitea API 工具、Wiki 讀寫、議題轉換、HTML 匯出與存取庫批次同步", "skills": "./skills/" }