# 接入包标准 lefthook 配置(炼境分发) # 作用:强制 Conventional Commits + 提交前类型检查 # 安装:pnpm add -D lefthook && pnpm exec lefthook install pre-commit: parallel: true commands: # TODO: 按项目调整 typecheck 命令与 glob(monorepo 用 --filter typecheck) typecheck: glob: "*.{ts,tsx}" run: pnpm typecheck # 🚨 【必填项】项目有 API / 后端层时,必须取消注释并按实际路径配置—— # 否则后端类型错误不会被 pre-commit 拦截(前端 typecheck 只覆盖 src/ 层)。 # 按实际填写一行,其余示例行可删掉: # api-typecheck: # glob: "api/**/*.{ts,tsx}" # run: pnpm --filter api typecheck # monorepo workspace # # run: pnpm exec tsc -p api/tsconfig.json --noEmit # 独立 tsconfig # # run: pnpm -r typecheck # 递归所有包 blueprint-gate: run: node .claude/hooks/blueprint-gate.cjs || true commit-msg: commands: conventional: run: "head -1 .git/COMMIT_EDITMSG | grep -qE '^(feat|fix|docs|chore|refactor|ci|perf|style|test|build|revert)(\\(.+\\))?!?: .+' || exit 1" feature-confirmed: run: | head -1 .git/COMMIT_EDITMSG | grep -qE '^feat' || exit 0 grep -q 'Feature-Confirmed: true' .git/COMMIT_EDITMSG || { printf '\n⚠️ feat: 提交须含 Feature-Confirmed: true trailer\n 在 commit message 末尾加一行:Feature-Confirmed: true\n (确认卡已与用户对齐,方可提交)\n\n' >&2; exit 1; }