Files
nudt-compiler-cpp/.codex/skills/git-submit/SKILL.md
2025-12-26 13:07:59 +08:00

91 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: git-submit
description: 执行 Git 提交和推送工作流
---
# Git 提交/推送工作流Codex CLI
当用户明确要求提交/推送时使用。
## 操作流程
### 1检查当前状态不需要用户确认
- 查看分支/干净程度:`git status -sb`
- 查看变更概要:`git diff --stat`
如发现明显问题,优先在提交前处理:
- 误把生成物/大文件加入:先移除或补 `.gitignore`
- 变更跨度过大:提醒用户是否需要拆分提交
### 2起草提交信息中文这是唯一一次需要用户确认的环节
根据对话历史和修改的文件信息,按下方规范先给出“建议的提交信息”,然后询问用户:**“是否确认/需要修改?”**
#### Git Commit Message 规范
##### 1格式
```text
<type>(<scope>): <subject>
```
说明:
- `<type>`:提交类型(必填)
- `<scope>`:影响范围/模块(必填)
- `<subject>`:一句话说明“做了什么”(必填)
---
##### 2type 列表
统一使用小写:
| type | 含义 |
|---|---|
| `feat` | 新功能 |
| `fix` | 修复 bug |
| `docs` | 文档变更 |
| `style` | 仅格式/风格(不改语义) |
| `refactor` | 重构(不改变外部行为) |
| `perf` | 性能优化 |
| `test` | 测试相关 |
| `build` | 构建系统 |
| `ci` | CI 相关 |
| `chore` | 杂项维护 |
| `revert` | 回滚提交 |
---
##### 3scope 列表
建议从以下范围中选择(保持一致即可):
| scope | 含义 |
|---|---|
| `frontend` | 前端ANTLR 驱动、AST 构建入口等) |
| `ast` | AST 相关 |
| `sema` | 语义分析(符号表、常量求值等) |
| `ir` | IR 核心结构 |
| `irgen` | AST → IR 生成 |
| `mir` | Machine IR指令选择、寄存器分配、栈帧等 |
| `backend` | 后端目标相关(如需要可细化 `aarch64` |
| `antlr` | 语法文件/ANTLR 相关 |
| `build` | 构建配置 |
| `test` | 测试 |
| `doc` | 文档 |
| `misc` | 其他无法归类但需要说明的范围 |
提交信息示例:
```text
refactor(irgen): 简化 AST → IR 构建流程
```
### 3后续流程均不需要用户确认
- 暂存所有改动:`git add -A`
- 单行摘要:`git commit -m "<type>(<scope>): <subject>"`,需要补充说明时用多行:`git commit -m "<summary>" -m "<detail 1>" -m "<detail 2>"`
- 推送:`git push`,推送完成后立即停止,不要再运行其他命令