Skip to content

commit.md

来自 cli/templates/level-1/

markdown
---
name: commit
description: >
  智能提交。完成功能并通过审查后使用。
  生成语义化的 commit message 并执行提交。
---

# 智能提交

## 步骤

1. 运行 `git status``git diff --staged` 查看变更
2. 如果没有 staged 文件,先 `git add` 相关文件(不要用 `git add .`
3. 分析变更内容,生成 Conventional Commits 格式的 message:
   `type(scope): 描述`
   - type: feat / fix / refactor / docs / test / chore
   - scope: 取模块名
   - 描述: 英文 50 字符以内,说明 why 而非 what

## 提交前检查

提交前确认以下全部通过:
- `npm run lint` — 零警告
- `npx tsc --noEmit` — 零类型错误
- `npm run test` — 全部通过

任何一项不通过,不允许提交。

## 大变更处理

如果变更超过 10 个文件,建议拆分为多次提交,按逻辑单元分组。

IMPORTANT:
- 不要 `git add .`,逐个添加相关文件
- 不要提交 .env 或包含密钥的文件
- commit message 用英文

面向个人开发者的 AI 辅助编程工程化方案