From de504ee2edb1ef3d4431ea581a79483fb6e8340c Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 24 Aug 2026 11:36:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(model-config):=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?SDLC=20=E9=9A=8E=E6=AE=B5=E6=8C=87=E5=AE=9A=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E9=8F=88=E8=A7=A3=E6=9E=90=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:新增 tools/model-config.sh,提供 get {stage} 與 list 兩個子命令,解析 SDLC 各階段(plan、analyze、implement、maintain)的指定模型鏈。 Why:讓 jsc-sdlc 各階段閘門能以角色式模型路由指定模型與遞補鏈,而不是只靠能力標籤比對;同時讓專案能覆寫全域設定。 How:以 POSIX sh 加 awk 實作;先讀專案目錄 .jsc/models,該階段沒設定才退回 $JSC_HOME/models.conf(JSC_HOME 預設 ~/.jsc);設定格式 stage=model[,fallback...],同階段多行取最後一行;get 未設定時空輸出且 exit 0,list 每階段輸出 stage、chain、source(未設定印「-」)。 Who:jsc-cli models 技能與 jsc-sdlc 各階段的模型閘門。 Co-Authored-By: Claude Fable 5 --- tools/model-config.sh | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 tools/model-config.sh diff --git a/tools/model-config.sh b/tools/model-config.sh new file mode 100755 index 0000000..e9108d7 --- /dev/null +++ b/tools/model-config.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env sh +# model-config.sh — 解析 SDLC 各階段的指定模型鏈(角色式路由)。 +# 設定格式(一行一階段):stage=model[,fallback1[,fallback2...]] +# 「#」開頭為註解,空白行忽略。階段限定:plan、analyze、implement、maintain。 +# 解析順序: +# 1. 目前工作目錄的 ./.jsc/models(專案覆寫) +# 2. $JSC_HOME/models.conf(JSC_HOME 預設 ~/.jsc) +# 專案檔有設定的階段完全覆寫全域設定;其餘階段仍讀全域檔。 +# 用法: +# model-config.sh get {stage} 印出該階段解析後的模型鏈(逗號分隔);未設定不印。兩種情況都 exit 0。 +# model-config.sh list 每階段一行:stagechainsource(project 或 global);未設定的 chain 與 source 印「-」。 +set -u + +JSC_HOME="${JSC_HOME:-$HOME/.jsc}" +PROJECT_FILE=./.jsc/models +GLOBAL_FILE="$JSC_HOME/models.conf" +STAGES="plan analyze implement maintain" + +# 取出單一設定檔裡某階段的模型鏈。 +# 同階段出現多行時取最後一行,結果才有確定性。 +read_chain() { # $1=設定檔 $2=階段 + [ -f "$1" ] || return 0 + awk -F= -v stage="$2" ' + { sub(/\r$/, "") } # 去掉 CR + /^[ \t]*#/ { next } # 註解行 + /^[ \t]*$/ { next } # 空白行 + index($0, "=") == 0 { next } + { + key = $1 + gsub(/[ \t]/, "", key) + if (key != stage) next + val = substr($0, index($0, "=") + 1) + gsub(/[ \t]/, "", val) + if (val != "") chain = val + } + END { if (chain != "") print chain } + ' "$1" +} + +# 解析單一階段:專案檔優先,該階段沒設定才退回全域檔。 +# 輸出:chainsource;兩檔都沒設定時不輸出。 +resolve() { # $1=階段 + chain=$(read_chain "$PROJECT_FILE" "$1") + if [ -n "$chain" ]; then + printf '%s\tproject\n' "$chain" + return 0 + fi + chain=$(read_chain "$GLOBAL_FILE" "$1") + if [ -n "$chain" ]; then + printf '%s\tglobal\n' "$chain" + fi + return 0 +} + +usage() { + echo "用法:model-config.sh get {plan|analyze|implement|maintain} | list" >&2 + exit 1 +} + +case "${1:-}" in + get) + stage="${2:-}" + case " $STAGES " in + *" $stage "*) ;; + *) usage ;; + esac + resolve "$stage" | cut -f1 + exit 0 + ;; + list) + for stage in $STAGES; do + line=$(resolve "$stage") + if [ -n "$line" ]; then + printf '%s\t%s\n' "$stage" "$line" + else + printf '%s\t-\t-\n' "$stage" + fi + done + exit 0 + ;; + *) + usage + ;; +esac -- 2.53.0 From 072e01821beb332a44309795b6c998cf844e0c30 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 24 Aug 2026 11:36:45 +0800 Subject: [PATCH 2/3] =?UTF-8?q?docs(models):=20=E8=A3=9C=E4=B8=8A=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=BC=8F=E6=A8=A1=E5=9E=8B=E8=B7=AF=E7=94=B1=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=88=87=E9=9A=8E=E6=AE=B5=E6=8C=87=E5=AE=9A=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E8=BC=B8=E5=87=BA=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:references/model-tags.md 新增「階段指定模型(角色式路由)」章節,說明設定格式、檔案優先序與遞補鏈語意;skills/models/SKILL.md 的 description 與步驟加入 model-config.sh list 的「階段指定模型」輸出表(stage、指定鏈、source 三欄);README.md 補上 tools/model-config.sh 工具列與 models 技能說明。 Why:角色式模型路由需要文件明確定義設定格式與判定順序,jsc-sdlc 閘門與使用者才知道指定模型優先、標籤比對為備援。 How:設定格式 stage=model[,fallback...];優先序為專案 .jsc/models 覆寫 $JSC_HOME/models.conf;解析一律透過 jsc-cli/tools/model-config.sh,不自行讀檔;models 技能輸出表未設定的階段以「-」表示。 Who:models 技能的使用者與依賴模型閘門的 jsc-sdlc 各階段技能。 Co-Authored-By: Claude Fable 5 --- README.md | 3 ++- references/model-tags.md | 23 +++++++++++++++++++++++ skills/models/SKILL.md | 3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac30862..317b7ca 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/jsc.git),安 | 工具 | 用途 | | --- | --- | | `tools/detect-clis.sh` | 列出已安裝的 AI CLI 與執行檔路徑(TSV:name / path / version;kiro 的執行檔為 `kiro-cli`) | +| `tools/model-config.sh` | 解析 SDLC 各階段的指定模型鏈(`get {stage}`、`list`);專案 `.jsc/models` 優先於 `$JSC_HOME/models.conf`,格式見 `references/model-tags.md` | ## Skills 目錄 @@ -30,7 +31,7 @@ Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/jsc.git),安 ### `models` -讀取各已安裝 CLI 可使用的模型並加上能力標籤(`references/model-tags.md`),並列出 SDLC 各階段的必要標籤,供 `jsc-sdlc` 的模型能力閘門使用。 +讀取各已安裝 CLI 可使用的模型並加上能力標籤(`references/model-tags.md`),列出 SDLC 各階段的必要標籤,並用 `tools/model-config.sh` 解析各階段的指定模型鏈(專案 `.jsc/models` 優先於 `$JSC_HOME/models.conf`)。`jsc-sdlc` 閘門先看指定模型,沒有指定才退回標籤比對。 ### `deploy` diff --git a/references/model-tags.md b/references/model-tags.md index 954280d..e1ecfde 100644 --- a/references/model-tags.md +++ b/references/model-tags.md @@ -34,4 +34,27 @@ | 實作(implement) | coding | | 維護(maintain) | 任意 | +## 階段指定模型(角色式路由) + +每個 SDLC 階段可以指定一個模型,並附上遞補模型。設定格式一行一階段: + +``` +stage=model[,fallback1[,fallback2...]] +``` + +「#」開頭為註解,空白行忽略。階段限定 plan、analyze、implement、maintain。 + +設定檔位置與優先序: + +| 順位 | 檔案 | 範圍 | +| --- | --- | --- | +| 1 | 專案目錄的 `.jsc/models` | 專案覆寫 | +| 2 | `$JSC_HOME/models.conf`(`JSC_HOME` 預設 `~/.jsc`) | 全域 | + +專案檔有設定的階段完全覆寫全域設定;其餘階段仍讀全域檔。解析一律用 `jsc-cli/tools/model-config.sh`,不自行讀檔。 + +遞補鏈語意:鏈上第一個模型優先;前面的模型不可用時依序後退到下一個。 + +指定模型優先於標籤比對:階段有指定模型時直接用指定鏈;只有階段沒有指定模型時,才用上表的必要標籤判定。 + 表列以外的模型:依 `jsc-ask:ask` 規則詢問使用者或依供應商文件補表後再判定。 diff --git a/skills/models/SKILL.md b/skills/models/SKILL.md index 2ff0795..9c68060 100644 --- a/skills/models/SKILL.md +++ b/skills/models/SKILL.md @@ -1,6 +1,6 @@ --- name: models -description: List every model usable by each installed AI CLI (claude, codex, copilot, antigravity, kiro) and attach capability tags from references/model-tags.md. Also states which tags each SDLC phase requires, so jsc-sdlc skills can gate execution. Use when checking model fitness or inventorying models; not for switching models. +description: List every model usable by each installed AI CLI (claude, codex, copilot, antigravity, kiro) and attach capability tags from references/model-tags.md. Also resolves each SDLC stage's designated model chain via tools/model-config.sh (project .jsc/models overrides $JSC_HOME/models.conf) and states which tags each phase requires, so jsc-sdlc skills gate on the designated model first and fall back to capability tags. Use when checking model fitness, inventorying models, or reviewing designated-model routing; not for switching models or editing the config files. --- # models — list CLI models with capability tags @@ -22,3 +22,4 @@ description: List every model usable by each installed AI CLI (claude, codex, co 3. Attach capability tags to every model per `references/model-tags.md`. Handle unlisted models per the closing rule of that file. 4. Output a table with four columns: CLI, model, tags, currently in use. 5. Append the SDLC phase requirement table (plan and analyze need `reasoning-high`; implement needs `coding`; maintain accepts any), so `jsc-sdlc` skills can gate on model capability. +6. Run `jsc-cli/tools/model-config.sh list` and append a 「階段指定模型」 table right after the phase requirement table, with three columns: stage, designated chain, source (`project` / `global`). State below the table that `jsc-sdlc` gates resolve the designated model first and fall back to capability tags only when a stage has no designated model. Done when the table shows all four stages, with `-` for unconfigured ones. -- 2.53.0 From cb6df171f6bd92fc1906820d72faa35329724c66 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 24 Aug 2026 11:36:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?chore(manifest):=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=99=9F=E6=8F=90=E5=8D=87=E8=87=B3=200.0.2?= 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 三份 manifest 的 version 由 0.0.1 提升為 0.0.2。 Why:本次新增角色式模型路由功能(model-config.sh 與相關文件),屬功能性變更,需要新版本號讓各 CLI 的插件更新機制辨識。 How:同步修改三份 manifest 的 version 欄位,維持三處版本一致。 Who:jsc-cli 插件的安裝與更新流程(jsc-cli:deploy 及各 CLI 原生插件命令)。 Co-Authored-By: Claude Fable 5 --- .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 75fa4ed..e87112b 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "jsc-cli", - "version": "0.0.1", + "version": "0.0.2", "description": "CLI 偵測、模型能力標籤與技能庫批次部署", "skills": "./skills", "author": { diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index e5039e6..f96f73d 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "jsc-cli", - "version": "0.0.1", + "version": "0.0.2", "description": "CLI 偵測、模型能力標籤與技能庫批次部署", "skills": "./skills" } diff --git a/plugin.json b/plugin.json index ed9ebb1..009a189 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "name": "jsc-cli", - "version": "0.0.1", + "version": "0.0.2", "description": "CLI 偵測、模型能力標籤與技能庫批次部署", "skills": "./skills/" } -- 2.53.0