53 lines
2.2 KiB
Markdown
53 lines
2.2 KiB
Markdown
---
|
|
description: Commit staged files with auto-generated message and create version tag
|
|
---
|
|
|
|
Auto-generate a commit message for staged files, commit to the local repository, and create a version tag following semantic versioning.
|
|
|
|
Please follow the git workflow defined in `@skill/git/SKILL.md`:
|
|
|
|
1. **Check staging area** - Verify files are staged with `git diff --cached --name-only`
|
|
- If empty, inform the user and stop
|
|
2. **Collect information** - Run these commands in parallel:
|
|
- `git status`
|
|
- `git diff --cached`
|
|
- `git log --oneline -10`
|
|
- `git tag --list | sort -V | tail -5`
|
|
- Read `@AGENTS.md` if it exists (repository type, version rules, project structure)
|
|
3. **Detect repository type** - Polyrepo (tag: `1.2.0`) or Monorepo (tag: `subproject-1.2.0`)
|
|
4. **Detect project type and version** - Check for version files:
|
|
- iOS: `*.xcodeproj/project.pbxproj` → `MARKETING_VERSION`
|
|
- Node.js: `package.json` → `version`
|
|
- Android: `build.gradle(.kts)` → `versionName`
|
|
- Go: Git tag only
|
|
5. **Generate commit message** following Conventional Commits:
|
|
- Format: `<type>(<scope>): <subject>`
|
|
- Use Chinese for commit messages (macOS/Linux)
|
|
- Types: feat, fix, docs, style, refactor, perf, test, chore, ci, build
|
|
- For monorepo, use subproject as scope if changes affect single subproject
|
|
6. **Update version number** if needed:
|
|
- feat: minor +1 (1.2.0 → 1.3.0)
|
|
- fix/perf: patch +1 (1.2.3 → 1.2.4)
|
|
- Breaking change: major +1 (1.2.3 → 2.0.0)
|
|
- Only for user-perceivable changes (feat, fix, perf, breaking)
|
|
- Add updated version file to staging
|
|
7. **Commit changes** with generated message
|
|
8. **Create version tag** if version was updated (unless user specified "skip tag"):
|
|
- Polyrepo: `git tag -a "1.2.0" -m "commit message"`
|
|
- Monorepo: `git tag -a "subproject-1.2.0" -m "commit message"`
|
|
|
|
**Options:**
|
|
- User can input "skip tag" or "skip" to skip tag creation
|
|
|
|
**Display result in Chinese:**
|
|
```
|
|
✓ 提交成功
|
|
|
|
提交信息:[commit message]
|
|
版本标签:[tag] (如果创建了)
|
|
|
|
要推送到远程仓库,请运行:/git-push
|
|
```
|
|
|
|
**Important:** This command does NOT push to remote. Use `/git-push` to push commits and tags.
|