chore: 重构 OpenCode 命令和技能文档体系

- 新增:统一的 git 命令文档(add/commit/push/pull 等)
- 新增:整合的 Gitea 技能文档(API、运行器、工作流等)
- 新增:工作流模板(Android、Go、Node.js 等)
- 移除:已弃用的旧命令脚本和发布脚本
- 改进:.gitignore 添加敏感文件保护规则
- 改进:AGENTS.md 完善了开发规范和示例

此次重组统一了命令和技能的文档结构,便于后续维护和扩展。
This commit is contained in:
Voson
2026-01-13 00:27:14 +08:00
parent 84a3b48d43
commit 5a05d5ab53
35 changed files with 9658 additions and 1609 deletions

189
command/git-commit.md Normal file
View File

@@ -0,0 +1,189 @@
---
description: Commit staged files with auto-generated message and create version tag
---
# git-commit
Auto-generate commit message for staged files, commit to local repository, and create version tag.
## What It Does
- Analyzes staged changes
- Auto-generates meaningful commit message following Conventional Commits
- Detects project type and updates version number if needed
- Creates appropriate git tag (polyrepo or monorepo format)
- Does NOT push to remote (local only)
## Quick Start
Use this command when you have files in staging area and want to commit with proper version tagging.
## Workflow
This command follows the git workflow defined in `skill/git/SKILL.md`:
1. ✓ Check staging area (must have files)
2. ✓ Analyze changes and repository type
3. ✓ Detect project type and version file
4. ✓ Generate commit message (Conventional Commits)
5. ✓ Update version number if needed
6. ✓ Commit with generated message
7. ✓ Create version tag
8. ✗ Skip push (use `/git-push` to push)
## Prerequisites
**Staging area must not be empty:**
```bash
git add <files>
```
## Options
User can optionally input:
- **"skip tag"** or **"skip"**: Skip tag creation, only commit
## Steps
### 1. Check Staging Area
```bash
git diff --cached --name-only
```
**If empty:**
- Display: "暂存区为空,请先使用 `git add` 添加文件。"
- **Terminate execution**
### 2. Collect Information (parallel)
```bash
git status
git diff --cached
git log --oneline -10
git tag --list | sort -V | tail -5
```
If `AGENTS.md` exists, read it for:
- Repository type (polyrepo/monorepo)
- Version update rules
- Project structure
### 3. Detect Repository Type
- **Polyrepo**: Single project, tag format `1.2.0`
- **Monorepo**: Multiple subprojects, tag format `<subproject>-1.2.0`
Detection:
- Check `AGENTS.md` for monorepo indicator
- Check directory structure (`packages/`, `apps/`, etc.)
- Analyze changed file paths for subproject scope
### 4. Detect Project Type and Version
Follow `skill/git/SKILL.md` guidelines:
**Common project types:**
- iOS: `*.xcodeproj/project.pbxproj``MARKETING_VERSION`
- Node.js: `package.json``version`
- Android: `build.gradle(.kts)``versionName`
- Go: Git tag only (no version file)
- etc.
**Version increment rules:**
- `feat`: minor +1 → `1.2.0``1.3.0`
- `fix`: patch +1 → `1.2.3``1.2.4`
- `perf`: patch +1
- Breaking change: major +1 → `1.2.3``2.0.0`
**Only update version for user-perceivable changes:**
- ✓ feat, fix, perf, breaking changes
- ✗ docs, test, refactor, style, chore, ci, build
### 5. Generate Commit Message
Follow Conventional Commits specification:
**Format:**
```
<type>(<scope>): <subject>
<body>
```
**Commit language:**
- macOS/Linux: Chinese (中文)
- Windows: English (encoding issue)
**Monorepo scope:**
- If changes affect single subproject: `feat(ios): 添加新功能`
- If multiple subprojects: `feat: 添加新功能`
### 6. Update Version Number
If version update is needed:
1. Update version file with new version
2. Add version file to staging: `git add <version-file>`
3. Verify: `git diff --cached --name-only`
### 7. Commit Changes
```bash
# macOS/Linux (Chinese)
git commit -m "feat(android): 添加用户认证"
# Windows (English)
git commit -m "feat(android): add user authentication"
# Multi-line (macOS/Linux)
git commit -m "$(cat <<'EOF'
feat: add user authentication
- Add OAuth2 support
- Implement JWT tokens
EOF
)"
```
### 8. Create Tag
**Only if:**
- Version update occurred
- User didn't input "skip tag"
**Tag format:**
- Polyrepo: `git tag -a "1.2.0" -m "feat: add feature"`
- Monorepo: `git tag -a "ios-1.2.0" -m "feat(ios): add feature"`
**Tag annotation:**
- Use same content as commit message
- Multi-line commits → multi-line annotations
### 9. Display Result
Show summary in Chinese:
```
✓ 提交成功
提交信息feat(android): 添加用户认证
版本标签android-1.3.0
要推送到远程仓库,请运行:/git-push
```
## Use Cases
- Commit staged changes with proper versioning
- Create local version tag for release preparation
- Follow semantic versioning automatically
## Related Commands
- `/git-status` - Check file changes before commit
- `/git-push` - Push commits and tags to remote
- `/git-push-tags` - Push tags only
## Reference
Complete workflow documentation: `skill/git/SKILL.md`