ai-engineering-init 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/.claude/agents/code-reviewer.md +3 -130
  2. package/.claude/hooks/skill-forced-eval.js +46 -60
  3. package/.claude/hooks/stop.js +24 -1
  4. package/.claude/settings.json +10 -1
  5. package/.claude/skills/api-development/SKILL.md +179 -130
  6. package/.claude/skills/architecture-design/SKILL.md +102 -212
  7. package/.claude/skills/backend-annotations/SKILL.md +166 -220
  8. package/.claude/skills/bug-detective/SKILL.md +225 -186
  9. package/.claude/skills/code-patterns/SKILL.md +127 -244
  10. package/.claude/skills/codex-code-review/SKILL.md +327 -0
  11. package/.claude/skills/collaborating-with-codex/SKILL.md +96 -113
  12. package/.claude/skills/crud-development/SKILL.md +226 -307
  13. package/.claude/skills/data-permission/SKILL.md +131 -202
  14. package/.claude/skills/database-ops/SKILL.md +158 -355
  15. package/.claude/skills/error-handler/SKILL.md +224 -285
  16. package/.claude/skills/file-oss-management/SKILL.md +174 -169
  17. package/.claude/skills/git-workflow/SKILL.md +123 -341
  18. package/.claude/skills/json-serialization/SKILL.md +121 -137
  19. package/.claude/skills/leniu-report-customization/SKILL.md +82 -2
  20. package/.claude/skills/leniu-report-standard-customization/SKILL.md +65 -2
  21. package/.claude/skills/loki-log-query/SKILL.md +400 -0
  22. package/.claude/skills/mysql-debug/SKILL.md +58 -22
  23. package/.claude/skills/performance-doctor/SKILL.md +83 -89
  24. package/.claude/skills/redis-cache/SKILL.md +134 -185
  25. package/.claude/skills/scheduled-jobs/SKILL.md +187 -224
  26. package/.claude/skills/security-guard/SKILL.md +168 -276
  27. package/.claude/skills/sms-mail/SKILL.md +266 -228
  28. package/.claude/skills/social-login/SKILL.md +257 -195
  29. package/.claude/skills/sync-back-merge/SKILL.md +66 -0
  30. package/.claude/skills/tenant-management/SKILL.md +172 -188
  31. package/.claude/skills/utils-toolkit/SKILL.md +214 -222
  32. package/.claude/skills/websocket-sse/SKILL.md +251 -172
  33. package/.claude/skills/workflow-engine/SKILL.md +178 -250
  34. package/.claude/skills/yunxiao-task-management/SKILL.md +489 -0
  35. package/.codex/skills/api-development/SKILL.md +179 -130
  36. package/.codex/skills/architecture-design/SKILL.md +102 -212
  37. package/.codex/skills/backend-annotations/SKILL.md +166 -220
  38. package/.codex/skills/bug-detective/SKILL.md +225 -186
  39. package/.codex/skills/code-patterns/SKILL.md +127 -244
  40. package/.codex/skills/collaborating-with-codex/SKILL.md +96 -113
  41. package/.codex/skills/crud-development/SKILL.md +226 -307
  42. package/.codex/skills/data-permission/SKILL.md +131 -202
  43. package/.codex/skills/database-ops/SKILL.md +158 -355
  44. package/.codex/skills/error-handler/SKILL.md +224 -285
  45. package/.codex/skills/file-oss-management/SKILL.md +174 -169
  46. package/.codex/skills/git-workflow/SKILL.md +123 -341
  47. package/.codex/skills/json-serialization/SKILL.md +121 -137
  48. package/.codex/skills/leniu-report-customization/SKILL.md +82 -2
  49. package/.codex/skills/leniu-report-standard-customization/SKILL.md +65 -2
  50. package/.codex/skills/loki-log-query/SKILL.md +400 -0
  51. package/.codex/skills/loki-log-query/environments.json +45 -0
  52. package/.codex/skills/mysql-debug/SKILL.md +58 -22
  53. package/.codex/skills/performance-doctor/SKILL.md +83 -89
  54. package/.codex/skills/redis-cache/SKILL.md +134 -185
  55. package/.codex/skills/scheduled-jobs/SKILL.md +187 -224
  56. package/.codex/skills/security-guard/SKILL.md +168 -276
  57. package/.codex/skills/skill-creator/LICENSE.txt +202 -0
  58. package/.codex/skills/skill-creator/SKILL.md +479 -0
  59. package/.codex/skills/skill-creator/agents/analyzer.md +274 -0
  60. package/.codex/skills/skill-creator/agents/comparator.md +202 -0
  61. package/.codex/skills/skill-creator/agents/grader.md +223 -0
  62. package/.codex/skills/skill-creator/assets/eval_review.html +146 -0
  63. package/.codex/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  64. package/.codex/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  65. package/.codex/skills/skill-creator/references/schemas.md +430 -0
  66. package/.codex/skills/skill-creator/scripts/__init__.py +0 -0
  67. package/.codex/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  68. package/.codex/skills/skill-creator/scripts/generate_report.py +326 -0
  69. package/.codex/skills/skill-creator/scripts/improve_description.py +248 -0
  70. package/.codex/skills/skill-creator/scripts/package_skill.py +136 -0
  71. package/.codex/skills/skill-creator/scripts/quick_validate.py +103 -0
  72. package/.codex/skills/skill-creator/scripts/run_eval.py +310 -0
  73. package/.codex/skills/skill-creator/scripts/run_loop.py +332 -0
  74. package/.codex/skills/skill-creator/scripts/utils.py +47 -0
  75. package/.codex/skills/sms-mail/SKILL.md +266 -228
  76. package/.codex/skills/social-login/SKILL.md +257 -195
  77. package/.codex/skills/sync-back-merge/SKILL.md +66 -0
  78. package/.codex/skills/tenant-management/SKILL.md +172 -188
  79. package/.codex/skills/utils-toolkit/SKILL.md +214 -222
  80. package/.codex/skills/websocket-sse/SKILL.md +251 -172
  81. package/.codex/skills/workflow-engine/SKILL.md +178 -250
  82. package/.codex/skills/yunxiao-task-management/SKILL.md +489 -0
  83. package/.cursor/hooks/cursor-skill-eval.js +66 -6
  84. package/.cursor/hooks/stop.js +23 -1
  85. package/.cursor/skills/api-development/SKILL.md +179 -130
  86. package/.cursor/skills/architecture-design/SKILL.md +102 -212
  87. package/.cursor/skills/backend-annotations/SKILL.md +166 -220
  88. package/.cursor/skills/bug-detective/SKILL.md +225 -186
  89. package/.cursor/skills/code-patterns/SKILL.md +127 -244
  90. package/.cursor/skills/collaborating-with-codex/SKILL.md +96 -113
  91. package/.cursor/skills/crud-development/SKILL.md +226 -307
  92. package/.cursor/skills/data-permission/SKILL.md +131 -202
  93. package/.cursor/skills/database-ops/SKILL.md +158 -355
  94. package/.cursor/skills/error-handler/SKILL.md +224 -285
  95. package/.cursor/skills/file-oss-management/SKILL.md +174 -169
  96. package/.cursor/skills/git-workflow/SKILL.md +123 -341
  97. package/.cursor/skills/json-serialization/SKILL.md +121 -137
  98. package/.cursor/skills/leniu-report-customization/SKILL.md +82 -2
  99. package/.cursor/skills/leniu-report-standard-customization/SKILL.md +65 -2
  100. package/.cursor/skills/loki-log-query/SKILL.md +400 -0
  101. package/.cursor/skills/loki-log-query/environments.json +45 -0
  102. package/.cursor/skills/mysql-debug/SKILL.md +58 -22
  103. package/.cursor/skills/performance-doctor/SKILL.md +83 -89
  104. package/.cursor/skills/redis-cache/SKILL.md +134 -185
  105. package/.cursor/skills/scheduled-jobs/SKILL.md +187 -224
  106. package/.cursor/skills/security-guard/SKILL.md +168 -276
  107. package/.cursor/skills/skill-creator/LICENSE.txt +202 -0
  108. package/.cursor/skills/skill-creator/SKILL.md +479 -0
  109. package/.cursor/skills/skill-creator/agents/analyzer.md +274 -0
  110. package/.cursor/skills/skill-creator/agents/comparator.md +202 -0
  111. package/.cursor/skills/skill-creator/agents/grader.md +223 -0
  112. package/.cursor/skills/skill-creator/assets/eval_review.html +146 -0
  113. package/.cursor/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  114. package/.cursor/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  115. package/.cursor/skills/skill-creator/references/schemas.md +430 -0
  116. package/.cursor/skills/skill-creator/scripts/__init__.py +0 -0
  117. package/.cursor/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  118. package/.cursor/skills/skill-creator/scripts/generate_report.py +326 -0
  119. package/.cursor/skills/skill-creator/scripts/improve_description.py +248 -0
  120. package/.cursor/skills/skill-creator/scripts/package_skill.py +136 -0
  121. package/.cursor/skills/skill-creator/scripts/quick_validate.py +103 -0
  122. package/.cursor/skills/skill-creator/scripts/run_eval.py +310 -0
  123. package/.cursor/skills/skill-creator/scripts/run_loop.py +332 -0
  124. package/.cursor/skills/skill-creator/scripts/utils.py +47 -0
  125. package/.cursor/skills/sms-mail/SKILL.md +266 -228
  126. package/.cursor/skills/social-login/SKILL.md +257 -195
  127. package/.cursor/skills/sync-back-merge/SKILL.md +66 -0
  128. package/.cursor/skills/tenant-management/SKILL.md +172 -188
  129. package/.cursor/skills/utils-toolkit/SKILL.md +214 -222
  130. package/.cursor/skills/websocket-sse/SKILL.md +251 -172
  131. package/.cursor/skills/workflow-engine/SKILL.md +178 -250
  132. package/.cursor/skills/yunxiao-task-management/SKILL.md +489 -0
  133. package/AGENTS.md +49 -540
  134. package/CLAUDE.md +73 -119
  135. package/README.md +37 -6
  136. package/bin/index.js +611 -25
  137. package/package.json +1 -1
  138. package/src/platform-map.json +4 -0
  139. package/src/skills/api-development/SKILL.md +179 -130
  140. package/src/skills/architecture-design/SKILL.md +102 -212
  141. package/src/skills/backend-annotations/SKILL.md +166 -220
  142. package/src/skills/bug-detective/SKILL.md +225 -186
  143. package/src/skills/code-patterns/SKILL.md +127 -244
  144. package/src/skills/codex-code-review/SKILL.md +261 -69
  145. package/src/skills/collaborating-with-codex/SKILL.md +96 -113
  146. package/src/skills/crud-development/SKILL.md +226 -307
  147. package/src/skills/data-permission/SKILL.md +131 -202
  148. package/src/skills/database-ops/SKILL.md +158 -355
  149. package/src/skills/error-handler/SKILL.md +224 -285
  150. package/src/skills/file-oss-management/SKILL.md +174 -169
  151. package/src/skills/git-workflow/SKILL.md +123 -341
  152. package/src/skills/json-serialization/SKILL.md +121 -137
  153. package/src/skills/leniu-report-customization/SKILL.md +82 -2
  154. package/src/skills/leniu-report-standard-customization/SKILL.md +65 -2
  155. package/src/skills/loki-log-query/SKILL.md +400 -0
  156. package/src/skills/loki-log-query/environments.json +45 -0
  157. package/src/skills/mysql-debug/SKILL.md +58 -22
  158. package/src/skills/performance-doctor/SKILL.md +83 -89
  159. package/src/skills/redis-cache/SKILL.md +134 -185
  160. package/src/skills/scheduled-jobs/SKILL.md +187 -224
  161. package/src/skills/security-guard/SKILL.md +168 -276
  162. package/src/skills/skill-creator/LICENSE.txt +202 -0
  163. package/src/skills/skill-creator/SKILL.md +479 -0
  164. package/src/skills/skill-creator/agents/analyzer.md +274 -0
  165. package/src/skills/skill-creator/agents/comparator.md +202 -0
  166. package/src/skills/skill-creator/agents/grader.md +223 -0
  167. package/src/skills/skill-creator/assets/eval_review.html +146 -0
  168. package/src/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  169. package/src/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  170. package/src/skills/skill-creator/references/schemas.md +430 -0
  171. package/src/skills/skill-creator/scripts/__init__.py +0 -0
  172. package/src/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  173. package/src/skills/skill-creator/scripts/generate_report.py +326 -0
  174. package/src/skills/skill-creator/scripts/improve_description.py +248 -0
  175. package/src/skills/skill-creator/scripts/package_skill.py +136 -0
  176. package/src/skills/skill-creator/scripts/quick_validate.py +103 -0
  177. package/src/skills/skill-creator/scripts/run_eval.py +310 -0
  178. package/src/skills/skill-creator/scripts/run_loop.py +332 -0
  179. package/src/skills/skill-creator/scripts/utils.py +47 -0
  180. package/src/skills/sms-mail/SKILL.md +266 -228
  181. package/src/skills/social-login/SKILL.md +257 -195
  182. package/src/skills/sync-back-merge/SKILL.md +66 -0
  183. package/src/skills/tenant-management/SKILL.md +172 -188
  184. package/src/skills/utils-toolkit/SKILL.md +214 -222
  185. package/src/skills/websocket-sse/SKILL.md +251 -172
  186. package/src/skills/workflow-engine/SKILL.md +178 -250
  187. package/src/skills/yunxiao-task-management/SKILL.md +489 -0
@@ -1,397 +1,179 @@
1
1
  ---
2
2
  name: git-workflow
3
3
  description: |
4
- 当需要进行 Git 版本控制操作时自动使用此 Skill。
5
-
6
- 触发场景:
7
- - 提交代码
8
- - 创建/合并分支
9
- - 查看提交历史
10
- - 解决冲突
11
- - 回滚代码
12
-
13
- 触发词:git、提交、commit、分支、合并、push、pull、冲突、回滚、版本、历史
4
+ 通用 Git 工作流指南。涵盖分支策略、提交规范、PR 流程、冲突解决等。
5
+ 触发场景:Git 操作、分支管理、提交规范、代码合并。
6
+ 触发词:Git、分支、提交、合并、rebase、PR。
7
+ 注意:如果项目有专属技能(如 `leniu-git-workflow`),优先使用专属版本。
14
8
  ---
15
9
 
16
10
  # Git 工作流指南
17
11
 
18
- ## ⚠️ 本项目提交规范(必须遵守)
12
+ > 通用模板。如果项目有专属技能(如 `leniu-git-workflow`),优先使用。
19
13
 
20
- ### 核心原则
14
+ ## 核心规范
21
15
 
22
- 1. **只提交当前会话的改动**:只 `git add` 当前聊天中修改或新增的文件
23
- 2. **不提交配置文件**:排除 `.env*`、`application*.yml` 等配置
24
- 3. **默认只提交到本地**:执行 `git add` + `git commit`,**不自动 push**
25
- 4. **明确指定才推送**:只有用户明确说"推送"、"push"、"提交到远程"时才执行 `git push`
26
-
27
- ### 提交信息格式
16
+ ### 分支策略(Git Flow)
28
17
 
29
18
  ```
30
- <type>(<scope>): <subject>
19
+ main (production)
20
+
21
+ ├── hotfix/fix-payment-bug ← 紧急修复,从 main 拉出
22
+
23
+ develop (integration)
24
+
25
+ ├── feature/order-export ← 功能开发,从 develop 拉出
26
+ ├── feature/user-profile ← 并行开发
27
+
28
+ └── release/v1.2.0 ← 发布准备,从 develop 拉出
31
29
  ```
32
30
 
33
- > **注意**:本项目是纯后端项目,无需平台前缀。
34
-
35
- ### 提交示例
36
-
37
- ```bash
38
- # 新功能
39
- feat(system): 新增用户反馈功能
40
-
41
- # 修复 Bug
42
- fix(demo): 修复订单状态显示错误
43
-
44
- # 文档更新
45
- docs(readme): 更新安装说明
46
-
47
- # 重构
48
- refactor(common): 重构分页查询工具类
49
-
50
- # 性能优化
51
- perf(system): 优化用户列表查询性能
52
-
53
- # 测试
54
- test(demo): 添加单元测试
55
- ```
31
+ | 分支类型 | 来源 | 合并目标 | 命名 |
32
+ |---------|------|---------|------|
33
+ | `main` | - | - | `main` |
34
+ | `develop` | `main` | `main` | `develop` |
35
+ | `feature/*` | `develop` | `develop` | `feature/功能描述` |
36
+ | `release/*` | `develop` | `main` + `develop` | `release/v1.x.x` |
37
+ | `hotfix/*` | `main` | `main` + `develop` | `hotfix/问题描述` |
56
38
 
57
- ### 提交流程
58
-
59
- ```bash
60
- # 1. 查看当前改动
61
- git status
62
-
63
- # 2. 只添加当前会话修改的业务文件(排除配置)
64
- git add ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/xxx/
65
- # 或者添加具体文件
66
- git add path/to/file1.java path/to/file2.java
67
-
68
- # 3. 提交到本地(不 push!)
69
- git commit -m "feat(system): 新增xxx功能"
70
-
71
- # 4. 只有用户明确要求时才推送
72
- # git push # ← 用户说"推送"时才执行
73
- ```
74
-
75
- ### 不要提交的文件
76
-
77
- ```bash
78
- # ❌ 团队项目配置文件(绝对不提交,包含数据库/中间件/环境信息)
79
- core-base/src/main/resources/bootstrap.yml
80
- core-base/src/main/resources/bootstrap-dev.yml
81
- core-base/src/main/resources/ConfigSource.properties
82
- core-base/src/main/resources/license.dat
83
- core-base/src/main/resources/logback-spring.xml
84
- core-base/src/main/resources/message_*.properties
85
-
86
- # ❌ 通用配置文件(绝对不提交)
87
- ruoyi-admin/src/main/resources/application.yml
88
- ruoyi-admin/src/main/resources/application-*.yml
89
- ruoyi-common/**/resources/*.yml
90
-
91
- # ❌ 测试/迁移基础设施文件(包含本地数据源配置,不提交)
92
- **/WebMvcTestConfig.java
93
- **/DataSourceMigration.java
94
-
95
- # ❌ IDE 配置
96
- .idea/
97
- .vscode/
98
- *.iml
39
+ ### 简化策略(GitHub Flow,适合小团队)
99
40
 
100
- # ❌ 本地临时文件
101
- *.log
102
- target/
103
- logs/
104
41
  ```
105
-
106
- ---
107
-
108
- ## 提交类型说明
109
-
110
- | 类型 | 说明 | 示例 |
111
- |------|------|------|
112
- | feat | 新功能 | `feat(system): 新增用户反馈功能` |
113
- | fix | 修复Bug | `fix(demo): 修复订单状态显示错误` |
114
- | docs | 文档更新 | `docs(readme): 更新安装说明` |
115
- | style | 代码格式 | `style(system): 格式化代码` |
116
- | refactor | 重构 | `refactor(common): 重构用户模块` |
117
- | perf | 性能优化 | `perf(system): 优化查询性能` |
118
- | test | 测试 | `test(demo): 添加单元测试` |
119
- | chore | 构建/工具 | `chore: 更新依赖` |
120
-
121
- ### scope 常用范围
122
-
123
- | scope | 说明 | 对应模块 |
124
- |-------|------|----------|
125
- | system | 系统管理 | `ruoyi-modules/ruoyi-system/` |
126
- | demo | 演示模块 | `ruoyi-modules/ruoyi-demo/` |
127
- | workflow | 工作流 | `ruoyi-modules/ruoyi-workflow/` |
128
- | job | 定时任务 | `ruoyi-modules/ruoyi-job/` |
129
- | generator | 代码生成 | `ruoyi-modules/ruoyi-generator/` |
130
- | common | 通用模块 | `ruoyi-common/` |
131
- | admin | 启动模块 | `ruoyi-admin/` |
132
-
133
- ---
134
-
135
- ## 常用命令
136
-
137
- ### 基础操作
138
-
139
- ```bash
140
- # 查看状态
141
- git status
142
-
143
- # 查看改动
144
- git diff
145
- git diff --staged # 已暂存的改动
146
-
147
- # 添加文件
148
- git add . # 添加所有(谨慎使用!)
149
- git add <file> # 添加指定文件(推荐)
150
-
151
- # 提交
152
- git commit -m "提交信息"
153
-
154
- # 推送(需用户明确要求)
155
- git push
156
- git push -u origin <branch> # 首次推送并设置上游
42
+ main
43
+ ├── feature/order-export
44
+ ├── fix/login-error
45
+ └── chore/upgrade-deps
157
46
  ```
158
47
 
159
- ### 分支操作
160
-
161
- ```bash
162
- # 查看分支
163
- git branch # 本地分支
164
- git branch -r # 远程分支
165
- git branch -a # 所有分支
166
-
167
- # 创建分支
168
- git branch <name>
169
- git checkout -b <name> # 创建并切换
170
-
171
- # 切换分支
172
- git checkout <name>
173
- git switch <name>
48
+ - 只有 `main` 一个长期分支
49
+ - 所有开发从 `main` 拉分支,完成后通过 PR 合并回 `main`
174
50
 
175
- # 合并分支
176
- git merge <name>
51
+ ### 提交规范(Conventional Commits)
177
52
 
178
- # 删除分支
179
- git branch -d <name> # 删除本地
180
- git push origin -d <name> # 删除远程
181
53
  ```
182
-
183
- ### 历史查看
184
-
185
- ```bash
186
- # 查看提交历史
187
- git log
188
- git log --oneline
189
- git log --oneline -10 # 最近10条
190
-
191
- # 查看某文件历史
192
- git log --follow <file>
193
-
194
- # 查看某次提交的内容
195
- git show <commit-id>
196
- ```
197
-
198
- ### 撤销操作
199
-
200
- ```bash
201
- # 撤销工作区修改
202
- git checkout -- <file>
203
- git restore <file>
204
-
205
- # 撤销暂存
206
- git reset HEAD <file>
207
- git restore --staged <file>
208
-
209
- # 撤销提交(保留修改)
210
- git reset --soft HEAD^
211
-
212
- # 撤销提交(丢弃修改)
213
- git reset --hard HEAD^
214
-
215
- # 回滚到某个提交
216
- git reset --hard <commit-id>
54
+ <type>(<scope>): <subject>
217
55
  ```
218
56
 
219
- ---
220
-
221
- ## 分支策略
222
-
223
- ### 主要分支
224
-
225
- | 分支 | 用途 | 说明 |
57
+ | type | 说明 | 示例 |
226
58
  |------|------|------|
227
- | 5.X | 主分支 | 生产/发布代码(本项目主分支) |
228
- | dev | 开发分支 | 日常开发代码 |
229
- | feature/* | 功能分支 | 新功能开发 |
230
- | fix/* | 修复分支 | Bug修复 |
231
- | release/* | 发布分支 | 版本发布 |
232
-
233
- ### 工作流程
234
-
235
- ```bash
236
- # 1. 从 dev 创建功能分支
237
- git checkout dev
238
- git pull
239
- git checkout -b feature/user-feedback
240
-
241
- # 2. 开发并提交(只提交当前会话改动的业务文件)
242
- git add ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/feedback/
243
- git commit -m "feat(system): 新增用户反馈功能"
59
+ | `feat` | 新功能 | `feat(order): 新增订单导出` |
60
+ | `fix` | 修复 Bug | `fix(auth): 修复 token 过期未刷新` |
61
+ | `docs` | 文档 | `docs: 更新 API 文档` |
62
+ | `style` | 格式 | `style: 统一缩进为 4 空格` |
63
+ | `refactor` | 重构 | `refactor(user): 拆分用户服务` |
64
+ | `perf` | 性能 | `perf(query): 优化列表查询 N+1` |
65
+ | `test` | 测试 | `test(order): 补充订单创建单测` |
66
+ | `chore` | 构建/工具 | `chore: 升级 Spring Boot 3.2` |
67
+ | `ci` | CI/CD | `ci: 添加 GitHub Actions 流水线` |
244
68
 
245
- # 3. 用户明确要求时才推送到远程
246
- git push -u origin feature/user-feedback
69
+ **规则**:
70
+ - subject 使用中文或英文,但全项目统一
71
+ - 不超过 72 字符
72
+ - 不以句号结尾
73
+ - 使用祈使语气("添加"而非"添加了")
247
74
 
248
- # 4. 创建 Pull Request 合并到 dev
75
+ ### 提交行为规范
249
76
 
250
- # 5. 合并后删除功能分支
251
- git checkout dev
252
- git pull
253
- git branch -d feature/user-feedback
254
- ```
255
-
256
- ---
77
+ 1. **只提交当前会话的改动**:精确 `git add` 修改的文件,不要 `git add .`
78
+ 2. **不提交配置文件**:排除 `.env*`、`application-*.yml` 等环境配置
79
+ 3. **默认只提交到本地**:执行 `git add` + `git commit`,不自动 push
80
+ 4. **明确指定才推送**:只有用户明确说"推送"、"push"时才执行 `git push`
257
81
 
258
- ## 冲突解决
82
+ ## 代码示例
259
83
 
260
- ### 合并冲突
84
+ ### 常用 Git 操作
261
85
 
262
86
  ```bash
263
- # 1. 拉取最新代码
264
- git pull
87
+ # 创建功能分支
88
+ git checkout develop
89
+ git pull origin develop
90
+ git checkout -b feature/order-export
265
91
 
266
- # 2. 如果有冲突,Git 会提示
267
- # Auto-merging xxx.java
268
- # CONFLICT (content): Merge conflict in xxx.java
92
+ # 开发完成,合并前更新
93
+ git fetch origin
94
+ git rebase origin/develop
269
95
 
270
- # 3. 打开冲突文件,手动解决
271
- # <<<<<<< HEAD
272
- # 当前分支的代码
273
- # =======
274
- # 要合并的代码
275
- # >>>>>>> feature/xxx
276
-
277
- # 4. 解决后添加并提交
278
- git add .
279
- git commit -m "fix: 解决合并冲突"
280
- ```
281
-
282
- ### 变基冲突
283
-
284
- ```bash
285
- # 1. 变基
286
- git rebase dev
287
-
288
- # 2. 如果有冲突,解决后
96
+ # 解决冲突后继续
289
97
  git add .
290
98
  git rebase --continue
291
99
 
292
- # 3. 放弃变基
293
- git rebase --abort
100
+ # 推送并创建 PR
101
+ git push -u origin feature/order-export
102
+ gh pr create --base develop --title "feat(order): 新增订单导出功能"
294
103
  ```
295
104
 
296
- ---
105
+ ### 常用 Git 修复操作
297
106
 
298
- ## 实用技巧
107
+ ```bash
108
+ # 修改最后一次提交信息
109
+ git commit --amend -m "fix(order): 修复订单金额计算"
299
110
 
300
- ### 暂存修改
111
+ # 撤销最后一次提交(保留修改)
112
+ git reset --soft HEAD~1
301
113
 
302
- ```bash
303
114
  # 暂存当前修改
304
115
  git stash
116
+ git stash pop
305
117
 
306
- # 查看暂存列表
307
- git stash list
308
-
309
- # 恢复暂存
310
- git stash pop # 恢复并删除
311
- git stash apply # 恢复但保留
118
+ # 挑选某个提交到当前分支
119
+ git cherry-pick <commit-hash>
312
120
 
313
- # 删除暂存
314
- git stash drop
315
- git stash clear # 清空所有
121
+ # 查看某个文件的修改历史
122
+ git log --oneline -20 -- path/to/file
316
123
  ```
317
124
 
318
- ### 修改提交
125
+ ### PR / Code Review 规范
319
126
 
320
- ```bash
321
- # 修改最后一次提交信息
322
- git commit --amend -m "新的提交信息"
127
+ 1. **PR 大小**:单个 PR 不超过 400 行变更(不含自动生成代码)
128
+ 2. **PR 描述**:说明改了什么、为什么改、如何测试
129
+ 3. **自查清单**:
130
+ - [ ] 代码能编译通过
131
+ - [ ] 新功能有对应测试
132
+ - [ ] 没有遗留 TODO / 调试代码
133
+ - [ ] 数据库变更有迁移脚本
134
+ 4. **Review 要点**:
135
+ - 逻辑正确性 > 代码风格
136
+ - 关注边界条件和异常处理
137
+ - 检查安全隐患(SQL 注入、XSS 等)
323
138
 
324
- # 追加到最后一次提交
325
- git add .
326
- git commit --amend --no-edit
327
- ```
139
+ ### .gitignore 推荐配置
328
140
 
329
- ### Cherry-pick
141
+ ```gitignore
142
+ # IDE
143
+ .idea/
144
+ *.iml
145
+ .vscode/
146
+ *.swp
330
147
 
331
- ```bash
332
- # 把某个提交应用到当前分支
333
- git cherry-pick <commit-id>
334
- ```
148
+ # Build
149
+ target/
150
+ build/
151
+ dist/
152
+ node_modules/
335
153
 
336
- ### 查看某人的提交
154
+ # Environment
155
+ .env
156
+ .env.local
157
+ *.local
337
158
 
338
- ```bash
339
- git log --author="作者名"
159
+ # OS
160
+ .DS_Store
161
+ Thumbs.db
162
+
163
+ # Logs
164
+ *.log
165
+ logs/
340
166
  ```
341
167
 
342
- ---
168
+ ## 常见错误
343
169
 
344
- ## 注意事项
345
-
346
- ### 禁止操作
347
-
348
- 1. **不要强制推送到主分支**
349
- ```bash
350
- # 禁止(团队主分支为 master)
351
- git push --force origin master
352
- git push --force origin main
353
- ```
354
-
355
- 2. **不要在主分支直接开发**
356
- ```bash
357
- # ❌ 禁止(团队主分支为 master,不在此分支直接提交)
358
- git checkout master
359
- # 直接修改代码...
360
- ```
361
-
362
- 3. **不要提交敏感信息和配置文件**
363
- ```bash
364
- # ❌ 禁止提交
365
- application.yml
366
- application-dev.yml
367
- application-prod.yml
368
- bootstrap.yml
369
- bootstrap-dev.yml
370
- ConfigSource.properties
371
- license.dat
372
- logback-spring.xml
373
- message_*.properties
374
- credentials.json
375
- password.txt
376
- # ❌ 禁止提交(包含本地数据源/测试环境配置)
377
- WebMvcTestConfig.java
378
- DataSourceMigration.java
379
- ```
380
-
381
- 4. **不要自动 push(除非用户明确要求)**
382
- ```bash
383
- # ❌ 默认不执行
384
- git push
385
-
386
- # ✅ 只有用户说"推送到远程"时才执行
387
- git push
388
- ```
389
-
390
- ### 最佳实践
391
-
392
- 1. **只提交当前会话改动**:不要 `git add .`,精确添加修改的文件
393
- 2. **排除配置文件**:配置文件包含本地环境信息,不应提交
394
- 3. **清晰的提交信息**:包含类型 + 范围 + 描述
395
- 4. **默认只本地提交**:`git add` + `git commit`,不自动 push
396
- 5. **频繁小步提交**:便于追踪和回滚
397
- 6. **Code Review**:通过 PR 合并代码
170
+ | 错误 | 正确做法 |
171
+ |------|---------|
172
+ | 直接在 main 上开发 | 创建功能分支 |
173
+ | 提交信息写"update"、"fix bug" | 按 Conventional Commits 规范 |
174
+ | 一个 PR 包含多个不相关改动 | 拆分为多个 PR |
175
+ | `git push --force` 到公共分支 | 只对个人分支 force push |
176
+ | 提交 .env、密钥文件 | 加入 .gitignore |
177
+ | merge 前不更新目标分支 | 先 rebase/merge 最新代码 |
178
+ | 忽略 CI 失败直接合并 | 修复 CI 后再合并 |
179
+ | `git add .` 一把梭 | 精确添加修改的业务文件 |