What:在 commit 技能的清點步驟之後、實際認可之前,新增一個掃描步驟,呼叫 jsc-hooks 的 comment-scope.sh sweep 掃過整個工作區,並在 README 的技能目錄補上同一句說明。原步驟編號往後順延。 Why:註解禁止夾帶文件相關資訊這條規則,目前只有 claude 接得到寫檔後的即時掃描;codex、copilot、antigravity、kiro 都得等到每輪結束或工作階段結束才有機會發現。commit 是五支 CLI 共用的提交路徑,在這裡掃一次,違規註解就進不了 commit。 How:新步驟只指向 jsc-review 的 references/comment-scope.md,不抄規則清單。腳本找不到 git 工作區或 jsc-hooks 不在本機時會安靜結束,此時跳過這一步並在回報中說明,不中止認可;exit 2 代表命中,就地修好再重跑到 exit 0 才認可。警告是給人與模型判讀,不是硬性阻擋,確認誤判就照實說明後繼續。步驟附可檢核的完成條件。 Who:jsc-git 的 commit 技能,以及所有經由它提交的 CLI。
3.3 KiB
3.3 KiB
name: commit description: Group all pending file changes by conventional type and feature, then commit each group as {type}({scope}): {message}. Before committing, sweep the working tree with jsc-hooks/hooks/comment-scope.sh so no comment carrying document tracking information enters a commit. 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 — group and commit file changes
Steps
- Track every file change: inspect all changes with
git status --porcelainfirst, thengit addgroup by group.git add -Afollowed by one bulk commit is forbidden. Done when every path listed bygit status --porcelainis assigned to exactly one group, before the first commit runs. - Sweep the comments about to be committed: run
jsc-hooks/hooks/comment-scope.sh sweepover this working tree. A code comment states why the code is written this way, never where the work is documented; the rule text and its allow list live in one place only,jsc-review/references/comment-scope.md.- The script exits 0 in silence when it finds no git working tree and when
jsc-hooksis not on this machine. If the script is not found, skip this step, say so in the report and commit anyway — missing infrastructure is not a violation. - Exit 2 means a hit. Fix every comment line the warning points at, in place, then run the sweep again until it exits 0, and commit only after that.
- The warning is written for a person and a model to judge, not a hard block. When it is a false positive, say plainly why and carry on with the commit; never delete a useful comment just to keep the script quiet.
- Done when one of these is true and reported: the sweep exited 0, or every remaining warning is reported with the reason it is a false positive, or the script was not found on this machine.
- The script exits 0 in silence when it finds no git working tree and when
- Group the changes by same type plus same requirement or feature. One group is one commit. Done when each group carries one type and one requirement or feature, and no path sits in two groups.
- Commit each group with the format
{type}({requirement or feature}): {message}. Done whengit status --porcelainreturns empty; report done only then.
Type table
| Type | Purpose |
|---|---|
| feat | add or change a feature |
| fix | fix a bug |
| docs | documentation |
| style | formatting; no change to how the code runs |
| refactor | code change that neither adds a feature nor fixes a bug |
| perf | improve performance |
| test | add tests |
| chore | build process or tooling change |
| revert | revert an earlier commit |
Message format (pick one of three)
Ask the user per the jsc-ask:ask rules. Skip the question when the question record or this session already holds a convention.
- Full: covers What, Why, How, and Who (which feature).
- Brief: one sentence summarized from
git diff. - Custom: the user types the message.
Rules
- The grouping and message drafting details MUST run as a sub agent. The main agent only confirms the grouping and runs the commits.
- Write messages in UTF-8 Traditional Chinese (the type and scope stay in English), per the STE100 output rule.
- Never push. Push and PR belong to
jsc-git:pr.