feat(shared): 新增14個共用spec、models/todo工具與樣板產生器,收斂跨repo重複規範

依 todo.md 執行的規範治理專案:新增 spec-preflight 等 14 個共用規範(含
conventional-commit/pull-request/git-push/issue-read/todo-list/ask-user/
subagent/no-scratch-files/skill-invocation/script-path/action-scaffold/
node-src-layout/plugin-cli/model),擴充 spec-git-safety 與 spec-gitea(token
優先序、機密遮蔽、Wiki 頁名轉義規則);新增可執行 skill `models`(模型能力
查詢與標籤)與 `todo`(依指定模型產生/附加 todo.md);新增 plugin.meta.json
單一事實來源與 gen-plugin-files.mjs 樣板產生器,統一四個 repo 的 manifest/
README/AGENTS.md 並移除寫死的本機使用者路徑;新增 shared/scripts/lib 的
log/機密遮蔽三語言參考實作。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-11 06:02:30 +00:00
co-authored by Claude Sonnet 5
parent d49ae1085d
commit 1030f9d403
38 changed files with 2329 additions and 139 deletions
+70
View File
@@ -0,0 +1,70 @@
# 5 份 manifest 產生規則 — 給 `gen-plugin-files.mjs` 的權威參照
來源:目標 repo 根目錄的 `plugin.meta.json`。以下規則把 `plugin.meta.json` 的欄位映射成五份實體檔案。所有規則已在 `gen-plugin-files.mjs` 的 `build*()` 函式中實作;本檔只作為人工審核時的對照文件,不是產生器實際讀取的樣板(manifest 用字串組裝,不走 `.tmpl` 檔案)。
## 共通欄位
| meta 欄位 | 用途 |
| --- | --- |
| `name` | 三份 `plugin.json` 的 `name`(`jsc-<shortName>`) |
| `shortName` | 兩份 `marketplace.json` 的 `name`,以及安裝 token `<plugin>@<marketplace>` 的 `<marketplace>` 部分 |
| `version` | 三份 `plugin.json` 的 `version`,**逐字複製,產生器不改版號** |
| `descriptionCore` | 三份 `plugin.json` description 的共同語意基底 |
| `assistants` | 助理清單,順序即統一決議順序:Claude Code / Codex / Antigravity / OpenCode / GitHub Copilot CLI |
| `cliPrefix` | 例如 `/jsc-code:` |
| `callPrefixAssistants.root` / `.claudePlugin` | root、`.claude-plugin` 的 description 結尾呼叫句要指名哪個助理 |
| `codexNote` | `.codex-plugin` description 的專屬補充資訊(可為空字串) |
| `codexNoteAnchor`(可選) | `codexNote` 要插入 `descriptionCore` 的哪個子字串之後;缺省則整句附加在 `descriptionCore` 尾端 |
| `skillsPath` | 三份 `plugin.json` 的 `skills` 欄位,統一不帶尾斜線 `./skills` |
| `author` / `homepage` / `repository` / `keywords` | 原樣搬進 `.claude-plugin/plugin.json`;`repository` 也用於 `.agents/plugins/marketplace.json` 的 `source.url` |
| `marketplace.repoDescription` | `.claude-plugin/marketplace.json` 的頂層 `description` |
| `marketplace.pluginSummary` | `.claude-plugin/marketplace.json` 的 `plugins[0].description` |
## root `plugin.json`(Antigravity)
```
description = strip trailing "。" of descriptionCore
+ ";於 " + callPrefixAssistants.root + " 以 " + cliPrefix + " 前綴呼叫。"
skills = skillsPath
```
## `.claude-plugin/plugin.json`
1. 在 `descriptionCore` 的第一個「,」或「:」之前插入 `(<assistants.join(' / ')>)`。
2. 去掉尾端「。」,補上「;於 `<callPrefixAssistants.claudePlugin>` 以 `<cliPrefix>` 前綴呼叫。」。
## `.codex-plugin/plugin.json`
- `codexNote` 為空字串 → `description = descriptionCore`(不加助理清單、不加呼叫句,Codex 用 `$name` 不用前綴)。
- `codexNote` 非空、有 `codexNoteAnchor` → 在 `descriptionCore` 中該子字串**之後**插入 `codexNote`。
- `codexNote` 非空、無 `codexNoteAnchor` → `description = descriptionCore + codexNote`(附加在句尾)。
## `.claude-plugin/marketplace.json`
```json
{
"name": shortName,
"description": marketplace.repoDescription,
"owner": { "name": author.name },
"plugins": [
{ "name": name, "source": "./", "description": marketplace.pluginSummary }
]
}
```
## `.agents/plugins/marketplace.json`(Codex)
```json
{
"name": shortName,
"plugins": [
{ "name": name, "source": { "source": "url", "url": repository } }
]
}
```
## 已知例外/已裁決的差異(不要「修正」掉)
- `doc` 的 `codexNoteAnchor = "並追加到 Gitea wiki"`:`codexNote`「(自動 Stop hook 僅相容 hook 環境支援)」要插在這句之後、句尾之前,不是整句附加在最後。
- `persona`/`code`/`shared` 的 `codexNote` 目前分別非空/空/空,依上表規則處理,不要假設四個 repo 都一樣。
- **`marketplace` 名稱一律等於 `shortName`**(`jsc-persona@persona`,不是 `jsc-persona@jsc-plugins`)。`shared/skills/spec-plugin-cli/SKILL.md` 目前文中寫「persona 例外,marketplace 名是 `jsc-plugins`」是**過期資訊**(persona README 已明文停用 `jsc-plugins` 這個舊名),套用本規則產生器不採用該例外,此差異已回報人工覆核,是否修正 `spec-plugin-cli/SKILL.md` 由人工決定。