diff --git a/skills/commit/SKILL.md b/skills/commit/SKILL.md new file mode 100644 index 0000000..b079d6b --- /dev/null +++ b/skills/commit/SKILL.md @@ -0,0 +1,40 @@ +--- +name: commit +description: Group all pending file changes by conventional type and feature, then commit each group as {type}({scope}): {message}. Message style is full (What/Why/How/Who), brief (one line from git diff), or custom, chosen via decision tree. Use whenever changes must be committed; not for push or PR creation. +--- + +# commit — 分組認可檔案變更 + +## 步驟 + +1. 追蹤所有檔案變更:先 `git status --porcelain` 檢視全部變更,再逐組 `git add`(不可盲目 `git add -A` 後一次 commit)。 +2. 依「同類型 + 同需求/功能」將檔案變更分組,一組一個 commit。 +3. 每組依格式認可:`{類型}({需求 or 功能}): {訊息}`。 + +## 類型表 + +| 類型 | 用途 | +| --- | --- | +| feat | 新增/修改功能 | +| fix | 修補 bug | +| docs | 文件 | +| style | 格式(不影響程式碼運行的變動) | +| refactor | 重構(既不是新增功能,也不是修補 bug 的程式碼變動) | +| perf | 改善效能 | +| test | 增加測試 | +| chore | 建構程序或輔助工具的變動 | +| revert | 撤銷回覆先前的 commit | + +## 訊息格式(三選一) + +依 `jsc-ask:ask` 規則詢問使用者;問詢紀錄或本 session 已有慣例就不再問。 + +1. **完整版**:包含做什麼(What)、為什麼做(Why)、怎麼做(How)、哪個功能做(Who)。 +2. **簡易版**:根據 `git diff` 總結出一句描述。 +3. **自訂**:使用者自行輸入訊息。 + +## 規則 + +1. 分組與訊息草擬的細節**必須以 sub agent 執行**,主 agent 只確認分組結果與執行 commit。 +2. 訊息一律 UTF-8 繁體中文(類型與 scope 除外)。 +3. 不可 push;push 與 PR 由 `jsc-git:pr` 負責。 diff --git a/skills/pr/SKILL.md b/skills/pr/SKILL.md new file mode 100644 index 0000000..edac96f --- /dev/null +++ b/skills/pr/SKILL.md @@ -0,0 +1,26 @@ +--- +name: pr +description: Commit all changes via jsc-git:commit, create a target branch named from the highest-priority commit type plus a summarized title, push, then open a Gitea PR with the templated description. Branch priority is revert > fix > feat > perf > refactor > test > docs > style > chore. Use when work is ready for review; not for plain commits. +--- + +# pr — 建立 Push Request + +## 步驟 + +1. 呼叫 `jsc-git:commit` 將所有檔案變更認可完成。 +2. 決定來源分支:遠端存在 `develop` 就用 `develop`,否則用 `main`(再否則用 `master`)。 +3. 從遠端來源分支建立目標分支: + 1. 類型取所有 commit 中優先度最高者:`revert > fix > feat > perf > refactor > test > docs > style > chore`。 + 2. 標題從所有 commit 的訊息總結出一句。 + 3. 分支名**只允許 ASCII**,一律 slug 化:`{類型}/{需求 or 功能}-{標題}`。需求/功能與標題先翻譯成英文短語,再轉小寫、非 `a-z0-9` 字元以連字號取代、連續連字號合併、頭尾連字號移除(例:`feat/order-匯出報表` → `feat/order-export-report`)。不可含空白、括號、冒號與任何非 ASCII 字元。 +4. `git push -u origin {目標分支}`。 +5. 建立 PR:`jsc-gitea/tools/gitea.sh pr-create {owner}/{repo} {目標分支} {來源分支} "{分支名}" {描述檔}`。 + - 標題 = 分支名。 + - 描述先套用 `templates/pr-description.md` 寫入暫存檔再帶入。 +6. 回報 PR URL。 + +## 規則 + +1. 描述範本各節不可留空:沒有計畫/分析頁就填「無」,沒有前置 PR 就填「無」。 +2. 計畫頁與分析頁連結由 `jsc-sdlc` 的 wiki 頁取得;分析頁連結必須導向工作包標題錨點。 +3. 描述草擬的細節**必須以 sub agent 執行**。 diff --git a/templates/pr-description.md b/templates/pr-description.md new file mode 100644 index 0000000..236fb25 --- /dev/null +++ b/templates/pr-description.md @@ -0,0 +1,27 @@ +# PR 描述範本 + + +## 摘要 + +- 需求描述:{需求描述} +- 計畫名稱:{計畫名稱,無計畫填「無」} +- 計畫頁:{PLAN 頁連結,無填「無」} +- 分析頁:{ANALYZE 頁連結(導向工作包標題錨點),無填「無」} + +## 變更內容 + +| 檔案 | 為什麼改 | +| --- | --- | +| {檔案路徑} | {原因} | + +## 設計重點 + +- {重點 1} + +## 測試結果 + +- {測試指令與結果;未測試需說明原因} + +## 前置 Push Request + +- {前置 PR 連結,無填「無」}