commitlisted
Install: claude install-skill YuDefine/nuxt-supabase-starter
<!--
🔒 LOCKED — managed by clade
Source: plugins/hub-core/skills/commit/
Edit at: <clade-central-repo>
Local edits will be reverted by the next sync.
-->
## User Input
```text
$ARGUMENTS
```
政策、禁止事項、commit 類型表見 `.claude/rules/commit.md`。本檔只定義執行流程。
## Step 0-Lock: 單一 session 防呆(**必做第一步**)
```bash
node .claude/scripts/commit-lock.mjs acquire
```
失敗(exit 1)代表另一個 session 正在跑 `/commit` → **停下**,向使用者回報鎖資訊,**不要**自行 `rm` 清鎖或重試。
成功後此 session 取得獨占權,直到最後一步釋放。**中斷處理**:若 `/commit` 流程中途失敗 / 使用者中斷,仍**必須**在終止前呼叫 `node .claude/scripts/commit-lock.mjs release`;漏釋放的鎖會在 30 分鐘後被下次 acquire 自動清除(可用 `COMMIT_LOCK_STALE_MINUTES` 調整)。
## Step 0-Coord: cross-session staged pollution detection(warn-only first pass)
`commit-lock` 只擋同時兩個 `/commit`;**不**擋「commit 跑時別 session 在跑 publish / propagate / wt-helper add / rescue-consumer」造成 staged 區意外污染(已實證 3 條 incident,見 `docs/pitfalls/2026-05-{14,18,22}-*.md`)。Step 0-Coord 跑 3 個 detection signal **warn-only**,命中再用 `request_user_input` 讓 user 決定等候還是強制繼續。
### Signal 1: `.git/index.lock` mtime < 60 秒
別 session 正在 staging(git add / git commit / git checkout 過程中會建這個 lock,正常結束會自動移除)。
```bash
GIT_DIR=$(git rev-parse --git-dir)
LOCK="$GIT_DIR/index.lock"
if [[ -f "$LOCK" ]]; then
NOW=$(date +%s)
LOCK_MTIME=$(stat -f %m "$LOCK" 2>/dev/null || stat -c %Y "$LOCK" 2>/dev/null)
AGE=$((NOW - LOCK_MTIME))
if (( AGE < 60 )); then
echo "SIGNAL_1_HIT: index.lock age=${AGE}s path=$LOCK"
fi
fi
```
**解讀**:`AGE < 60` → 別 session 大機率仍活著正在 staging;`AGE >= 60