ai-engineering-init 1.4.2 → 1.5.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.
- package/.claude/skills/leniu-java-export/SKILL.md +389 -95
- package/.codex/skills/leniu-java-export/SKILL.md +389 -95
- package/.cursor/skills/bug-detective/SKILL.md +19 -19
- package/.cursor/skills/leniu-java-export/SKILL.md +389 -95
- package/.cursor/skills/project-navigator/SKILL.md +164 -258
- package/package.json +7 -1
- package/scripts/build-skills.js +180 -0
- package/src/platform-map.json +56 -0
- package/src/skills/add-skill/SKILL.md +488 -0
- package/src/skills/add-todo/SKILL.md +269 -0
- package/src/skills/api-development/SKILL.md +266 -0
- package/src/skills/architecture-design/SKILL.md +262 -0
- package/src/skills/backend-annotations/SKILL.md +302 -0
- package/src/skills/banana-image/CHANGELOG.md +37 -0
- package/src/skills/banana-image/README.md +146 -0
- package/src/skills/banana-image/SKILL.md +171 -0
- package/src/skills/banana-image/assets/logo.png +0 -0
- package/src/skills/banana-image/references/advanced-usage.md +189 -0
- package/src/skills/banana-image/scripts/apply_template.py +125 -0
- package/src/skills/banana-image/scripts/banana_image_exec.ts +412 -0
- package/src/skills/banana-image/scripts/batch_prep.py +82 -0
- package/src/skills/banana-image/scripts/package-lock.json +1437 -0
- package/src/skills/banana-image/scripts/package.json +18 -0
- package/src/skills/banana-image/scripts/requirements.txt +10 -0
- package/src/skills/banana-image/templates/poster.json +22 -0
- package/src/skills/banana-image/templates/product.json +17 -0
- package/src/skills/banana-image/templates/social.json +22 -0
- package/src/skills/banana-image/templates/thumbnail.json +17 -0
- package/src/skills/brainstorm/SKILL.md +216 -0
- package/src/skills/bug-detective/SKILL.md +256 -0
- package/src/skills/bug-detective/references/error-patterns.md +242 -0
- package/src/skills/check/SKILL.md +367 -0
- package/src/skills/code-patterns/SKILL.md +280 -0
- package/src/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/src/skills/codex-code-review/SKILL.md +135 -0
- package/src/skills/collaborating-with-codex/SKILL.md +174 -0
- package/src/skills/collaborating-with-codex/scripts/codex_bridge.py +275 -0
- package/src/skills/collaborating-with-gemini/SKILL.md +194 -0
- package/src/skills/collaborating-with-gemini/scripts/gemini_bridge.py +275 -0
- package/src/skills/crud/SKILL.md +265 -0
- package/src/skills/crud-development/SKILL.md +409 -0
- package/src/skills/data-permission/SKILL.md +292 -0
- package/src/skills/data-permission/references/custom-data-scope.md +90 -0
- package/src/skills/database-ops/SKILL.md +407 -0
- package/src/skills/dev/SKILL.md +187 -0
- package/src/skills/error-handler/SKILL.md +371 -0
- package/src/skills/file-oss-management/SKILL.md +255 -0
- package/src/skills/file-oss-management/references/entities.md +105 -0
- package/src/skills/file-oss-management/references/service-impl.md +104 -0
- package/src/skills/git-workflow/SKILL.md +397 -0
- package/src/skills/init-docs/SKILL.md +194 -0
- package/src/skills/json-serialization/SKILL.md +357 -0
- package/src/skills/leniu-api-development/SKILL.md +319 -0
- package/src/skills/leniu-api-development/references/real-examples.md +273 -0
- package/src/skills/leniu-architecture-design/SKILL.md +383 -0
- package/src/skills/leniu-backend-annotations/SKILL.md +277 -0
- package/src/skills/leniu-brainstorm/SKILL.md +242 -0
- package/src/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/src/skills/leniu-code-patterns/SKILL.md +411 -0
- package/src/skills/leniu-crud-development/SKILL.md +404 -0
- package/src/skills/leniu-crud-development/references/templates.md +597 -0
- package/src/skills/leniu-customization-location/SKILL.md +410 -0
- package/src/skills/leniu-data-permission/SKILL.md +341 -0
- package/src/skills/leniu-database-ops/SKILL.md +426 -0
- package/src/skills/leniu-error-handler/SKILL.md +462 -0
- package/src/skills/leniu-java-amount-handling/SKILL.md +461 -0
- package/src/skills/leniu-java-code-style/SKILL.md +510 -0
- package/src/skills/leniu-java-concurrent/SKILL.md +400 -0
- package/src/skills/leniu-java-entity/SKILL.md +237 -0
- package/src/skills/leniu-java-entity/references/templates.md +237 -0
- package/src/skills/leniu-java-export/SKILL.md +570 -0
- package/src/skills/leniu-java-logging/SKILL.md +229 -0
- package/src/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/src/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/src/skills/leniu-java-mq/SKILL.md +338 -0
- package/src/skills/leniu-java-mybatis/SKILL.md +267 -0
- package/src/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/src/skills/leniu-java-report-query-param/SKILL.md +291 -0
- package/src/skills/leniu-java-task/SKILL.md +367 -0
- package/src/skills/leniu-java-total-line/SKILL.md +196 -0
- package/src/skills/leniu-marketing-price-rule-customizer/SKILL.md +301 -0
- package/src/skills/leniu-marketing-recharge-rule-customizer/SKILL.md +285 -0
- package/src/skills/leniu-mealtime/SKILL.md +215 -0
- package/src/skills/leniu-redis-cache/SKILL.md +331 -0
- package/src/skills/leniu-report-customization/SKILL.md +335 -0
- package/src/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/src/skills/leniu-report-standard-customization/SKILL.md +328 -0
- package/src/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/src/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/src/skills/leniu-security-guard/SKILL.md +306 -0
- package/src/skills/leniu-utils-toolkit/SKILL.md +380 -0
- package/src/skills/mysql-debug/SKILL.md +364 -0
- package/src/skills/next/SKILL.md +137 -0
- package/src/skills/openspec-apply-change/SKILL.md +165 -0
- package/src/skills/openspec-archive-change/SKILL.md +122 -0
- package/src/skills/openspec-bulk-archive-change/SKILL.md +254 -0
- package/src/skills/openspec-continue-change/SKILL.md +126 -0
- package/src/skills/openspec-explore/SKILL.md +299 -0
- package/src/skills/openspec-ff-change/SKILL.md +109 -0
- package/src/skills/openspec-new-change/SKILL.md +82 -0
- package/src/skills/openspec-onboard/SKILL.md +414 -0
- package/src/skills/openspec-sync-specs/SKILL.md +146 -0
- package/src/skills/openspec-verify-change/SKILL.md +176 -0
- package/src/skills/performance-doctor/SKILL.md +303 -0
- package/src/skills/progress/SKILL.md +193 -0
- package/src/skills/project-navigator/SKILL.md +211 -0
- package/src/skills/redis-cache/SKILL.md +333 -0
- package/src/skills/redis-cache/references/listeners.md +23 -0
- package/src/skills/scheduled-jobs/SKILL.md +314 -0
- package/src/skills/security-guard/SKILL.md +353 -0
- package/src/skills/security-guard/references/encrypt-config.md +103 -0
- package/src/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/src/skills/sms-mail/SKILL.md +308 -0
- package/src/skills/sms-mail/references/mail-config.md +88 -0
- package/src/skills/sms-mail/references/sms-config.md +74 -0
- package/src/skills/social-login/SKILL.md +266 -0
- package/src/skills/social-login/references/provider-configs.md +118 -0
- package/src/skills/start/SKILL.md +154 -0
- package/src/skills/store-pc/SKILL.md +366 -0
- package/src/skills/sync/SKILL.md +149 -0
- package/src/skills/task-tracker/SKILL.md +307 -0
- package/src/skills/tech-decision/SKILL.md +393 -0
- package/src/skills/tenant-management/SKILL.md +288 -0
- package/src/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/src/skills/test-development/SKILL.md +301 -0
- package/src/skills/test-development/references/parameterized-examples.md +119 -0
- package/src/skills/ui-pc/SKILL.md +438 -0
- package/src/skills/update-status/SKILL.md +159 -0
- package/src/skills/utils-toolkit/SKILL.md +362 -0
- package/src/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/src/skills/websocket-sse/SKILL.md +271 -0
- package/src/skills/workflow-engine/SKILL.md +321 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# OSS 数据库实体类定义
|
|
2
|
+
|
|
3
|
+
## SysOss 实体
|
|
4
|
+
|
|
5
|
+
```java
|
|
6
|
+
@Data
|
|
7
|
+
@EqualsAndHashCode(callSuper = true)
|
|
8
|
+
@TableName("sys_oss")
|
|
9
|
+
public class SysOss extends TenantEntity {
|
|
10
|
+
|
|
11
|
+
@TableId(value = "oss_id")
|
|
12
|
+
private Long ossId;
|
|
13
|
+
|
|
14
|
+
private String fileName; // OSS对象键
|
|
15
|
+
private String originalName; // 原始文件名
|
|
16
|
+
private String fileSuffix; // 后缀名(如 .jpg)
|
|
17
|
+
private String url; // URL地址
|
|
18
|
+
private String ext1; // 扩展字段(JSON)
|
|
19
|
+
private String service; // 服务商标识
|
|
20
|
+
|
|
21
|
+
// 继承自 TenantEntity: tenantId, createTime, createBy, updateTime, updateBy, delFlag
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## SysOssVo 视图对象
|
|
26
|
+
|
|
27
|
+
```java
|
|
28
|
+
@Data
|
|
29
|
+
@AutoMapper(target = SysOss.class)
|
|
30
|
+
public class SysOssVo implements Serializable {
|
|
31
|
+
|
|
32
|
+
private Long ossId;
|
|
33
|
+
private String fileName;
|
|
34
|
+
private String originalName;
|
|
35
|
+
private String fileSuffix;
|
|
36
|
+
private String url;
|
|
37
|
+
private String ext1;
|
|
38
|
+
private Date createTime;
|
|
39
|
+
private Long createBy;
|
|
40
|
+
|
|
41
|
+
@Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "createBy")
|
|
42
|
+
private String createByName; // 上传人名称(自动翻译)
|
|
43
|
+
|
|
44
|
+
private String service;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## SysOssBo 业务对象
|
|
49
|
+
|
|
50
|
+
```java
|
|
51
|
+
@Data
|
|
52
|
+
@EqualsAndHashCode(callSuper = true)
|
|
53
|
+
@AutoMapper(target = SysOss.class, reverseConvertGenerate = false)
|
|
54
|
+
public class SysOssBo extends BaseEntity {
|
|
55
|
+
|
|
56
|
+
private Long ossId;
|
|
57
|
+
private String fileName;
|
|
58
|
+
private String originalName;
|
|
59
|
+
private String fileSuffix;
|
|
60
|
+
private String url;
|
|
61
|
+
private String ext1;
|
|
62
|
+
private String service;
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## SysOssExt 扩展信息对象
|
|
67
|
+
|
|
68
|
+
> 以 JSON 字符串形式存储在 ext1 字段中
|
|
69
|
+
|
|
70
|
+
```java
|
|
71
|
+
@Data
|
|
72
|
+
public class SysOssExt implements Serializable {
|
|
73
|
+
|
|
74
|
+
private String bizType; // 业务类型(avatar、report等)
|
|
75
|
+
private Long fileSize; // 文件大小(字节)
|
|
76
|
+
private String contentType; // MIME类型
|
|
77
|
+
private String source; // 来源标识
|
|
78
|
+
private String uploadIp; // 上传IP
|
|
79
|
+
private String remark; // 备注
|
|
80
|
+
private List<String> tags; // 标签
|
|
81
|
+
private String refId; // 绑定业务ID
|
|
82
|
+
private String refType; // 绑定业务类型
|
|
83
|
+
private Boolean isTemp; // 是否临时文件
|
|
84
|
+
private String md5; // 文件MD5值
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## OssProperties 配置类
|
|
89
|
+
|
|
90
|
+
```java
|
|
91
|
+
@Data
|
|
92
|
+
public class OssProperties {
|
|
93
|
+
|
|
94
|
+
private String tenantId;
|
|
95
|
+
private String endpoint; // 访问站点
|
|
96
|
+
private String domain; // 自定义域名
|
|
97
|
+
private String prefix; // 文件前缀
|
|
98
|
+
private String accessKey;
|
|
99
|
+
private String secretKey;
|
|
100
|
+
private String bucketName;
|
|
101
|
+
private String region;
|
|
102
|
+
private String isHttps; // Y/N
|
|
103
|
+
private String accessPolicy; // 0-private, 1-public, 2-custom
|
|
104
|
+
}
|
|
105
|
+
```
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# SysOssServiceImpl 完整实现
|
|
2
|
+
|
|
3
|
+
> 位置:`ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysOssServiceImpl.java`
|
|
4
|
+
|
|
5
|
+
## 文件上传
|
|
6
|
+
|
|
7
|
+
```java
|
|
8
|
+
@RequiredArgsConstructor
|
|
9
|
+
@Service
|
|
10
|
+
public class SysOssServiceImpl implements ISysOssService {
|
|
11
|
+
|
|
12
|
+
private final SysOssMapper baseMapper;
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public SysOssVo upload(MultipartFile file) {
|
|
16
|
+
if (ObjectUtil.isNull(file) || file.isEmpty()) {
|
|
17
|
+
throw new ServiceException("上传文件不能为空");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
String originalfileName = file.getOriginalFilename();
|
|
21
|
+
String suffix = StringUtils.substring(originalfileName,
|
|
22
|
+
originalfileName.lastIndexOf("."),
|
|
23
|
+
originalfileName.length());
|
|
24
|
+
|
|
25
|
+
OssClient storage = OssFactory.instance();
|
|
26
|
+
|
|
27
|
+
UploadResult uploadResult;
|
|
28
|
+
try {
|
|
29
|
+
uploadResult = storage.uploadSuffix(file.getBytes(), suffix, file.getContentType());
|
|
30
|
+
} catch (IOException e) {
|
|
31
|
+
throw new ServiceException(e.getMessage());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
SysOssExt ext1 = new SysOssExt();
|
|
35
|
+
ext1.setFileSize(file.getSize());
|
|
36
|
+
ext1.setContentType(file.getContentType());
|
|
37
|
+
|
|
38
|
+
return buildResultEntity(originalfileName, suffix,
|
|
39
|
+
storage.getConfigKey(), uploadResult, ext1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private SysOssVo buildResultEntity(String originalfileName, String suffix,
|
|
43
|
+
String configKey, UploadResult uploadResult, SysOssExt ext1) {
|
|
44
|
+
|
|
45
|
+
SysOss oss = new SysOss();
|
|
46
|
+
oss.setUrl(uploadResult.getUrl());
|
|
47
|
+
oss.setFileSuffix(suffix);
|
|
48
|
+
oss.setFileName(uploadResult.getFilename()); // 小写 'n'
|
|
49
|
+
oss.setOriginalName(originalfileName);
|
|
50
|
+
oss.setService(configKey);
|
|
51
|
+
oss.setExt1(JsonUtils.toJsonString(ext1));
|
|
52
|
+
|
|
53
|
+
baseMapper.insert(oss);
|
|
54
|
+
SysOssVo sysOssVo = MapstructUtils.convert(oss, SysOssVo.class);
|
|
55
|
+
return this.matchingUrl(sysOssVo);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 文件下载
|
|
61
|
+
|
|
62
|
+
```java
|
|
63
|
+
@Override
|
|
64
|
+
public void download(Long ossId, HttpServletResponse response) throws IOException {
|
|
65
|
+
SysOssVo sysOss = SpringUtils.getAopProxy(this).getById(ossId);
|
|
66
|
+
if (ObjectUtil.isNull(sysOss)) {
|
|
67
|
+
throw new ServiceException("文件数据不存在!");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName());
|
|
71
|
+
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
|
|
72
|
+
|
|
73
|
+
OssClient storage = OssFactory.instance(sysOss.getService());
|
|
74
|
+
storage.download(sysOss.getFileName(),
|
|
75
|
+
response.getOutputStream(),
|
|
76
|
+
response::setContentLengthLong);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 文件删除
|
|
81
|
+
|
|
82
|
+
```java
|
|
83
|
+
@Override
|
|
84
|
+
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
85
|
+
List<SysOss> list = baseMapper.selectByIds(ids);
|
|
86
|
+
for (SysOss sysOss : list) {
|
|
87
|
+
OssClient storage = OssFactory.instance(sysOss.getService());
|
|
88
|
+
storage.delete(sysOss.getUrl());
|
|
89
|
+
}
|
|
90
|
+
return baseMapper.deleteByIds(ids) > 0;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 私有桶预签名URL
|
|
95
|
+
|
|
96
|
+
```java
|
|
97
|
+
private SysOssVo matchingUrl(SysOssVo oss) {
|
|
98
|
+
OssClient storage = OssFactory.instance(oss.getService());
|
|
99
|
+
if (AccessPolicyType.PRIVATE == storage.getAccessPolicy()) {
|
|
100
|
+
oss.setUrl(storage.createPresignedGetUrl(oss.getFileName(), Duration.ofSeconds(120)));
|
|
101
|
+
}
|
|
102
|
+
return oss;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-workflow
|
|
3
|
+
description: |
|
|
4
|
+
当需要进行 Git 版本控制操作时自动使用此 Skill。
|
|
5
|
+
|
|
6
|
+
触发场景:
|
|
7
|
+
- 提交代码
|
|
8
|
+
- 创建/合并分支
|
|
9
|
+
- 查看提交历史
|
|
10
|
+
- 解决冲突
|
|
11
|
+
- 回滚代码
|
|
12
|
+
|
|
13
|
+
触发词:git、提交、commit、分支、合并、push、pull、冲突、回滚、版本、历史
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Git 工作流指南
|
|
17
|
+
|
|
18
|
+
## ⚠️ 本项目提交规范(必须遵守)
|
|
19
|
+
|
|
20
|
+
### 核心原则
|
|
21
|
+
|
|
22
|
+
1. **只提交当前会话的改动**:只 `git add` 当前聊天中修改或新增的文件
|
|
23
|
+
2. **不提交配置文件**:排除 `.env*`、`application*.yml` 等配置
|
|
24
|
+
3. **默认只提交到本地**:执行 `git add` + `git commit`,**不自动 push**
|
|
25
|
+
4. **明确指定才推送**:只有用户明确说"推送"、"push"、"提交到远程"时才执行 `git push`
|
|
26
|
+
|
|
27
|
+
### 提交信息格式
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
<type>(<scope>): <subject>
|
|
31
|
+
```
|
|
32
|
+
|
|
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
|
+
```
|
|
56
|
+
|
|
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
|
|
99
|
+
|
|
100
|
+
# ❌ 本地临时文件
|
|
101
|
+
*.log
|
|
102
|
+
target/
|
|
103
|
+
logs/
|
|
104
|
+
```
|
|
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> # 首次推送并设置上游
|
|
157
|
+
```
|
|
158
|
+
|
|
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>
|
|
174
|
+
|
|
175
|
+
# 合并分支
|
|
176
|
+
git merge <name>
|
|
177
|
+
|
|
178
|
+
# 删除分支
|
|
179
|
+
git branch -d <name> # 删除本地
|
|
180
|
+
git push origin -d <name> # 删除远程
|
|
181
|
+
```
|
|
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>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## 分支策略
|
|
222
|
+
|
|
223
|
+
### 主要分支
|
|
224
|
+
|
|
225
|
+
| 分支 | 用途 | 说明 |
|
|
226
|
+
|------|------|------|
|
|
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): 新增用户反馈功能"
|
|
244
|
+
|
|
245
|
+
# 3. 用户明确要求时才推送到远程
|
|
246
|
+
git push -u origin feature/user-feedback
|
|
247
|
+
|
|
248
|
+
# 4. 创建 Pull Request 合并到 dev
|
|
249
|
+
|
|
250
|
+
# 5. 合并后删除功能分支
|
|
251
|
+
git checkout dev
|
|
252
|
+
git pull
|
|
253
|
+
git branch -d feature/user-feedback
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 冲突解决
|
|
259
|
+
|
|
260
|
+
### 合并冲突
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# 1. 拉取最新代码
|
|
264
|
+
git pull
|
|
265
|
+
|
|
266
|
+
# 2. 如果有冲突,Git 会提示
|
|
267
|
+
# Auto-merging xxx.java
|
|
268
|
+
# CONFLICT (content): Merge conflict in xxx.java
|
|
269
|
+
|
|
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. 如果有冲突,解决后
|
|
289
|
+
git add .
|
|
290
|
+
git rebase --continue
|
|
291
|
+
|
|
292
|
+
# 3. 放弃变基
|
|
293
|
+
git rebase --abort
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## 实用技巧
|
|
299
|
+
|
|
300
|
+
### 暂存修改
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
# 暂存当前修改
|
|
304
|
+
git stash
|
|
305
|
+
|
|
306
|
+
# 查看暂存列表
|
|
307
|
+
git stash list
|
|
308
|
+
|
|
309
|
+
# 恢复暂存
|
|
310
|
+
git stash pop # 恢复并删除
|
|
311
|
+
git stash apply # 恢复但保留
|
|
312
|
+
|
|
313
|
+
# 删除暂存
|
|
314
|
+
git stash drop
|
|
315
|
+
git stash clear # 清空所有
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### 修改提交
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# 修改最后一次提交信息
|
|
322
|
+
git commit --amend -m "新的提交信息"
|
|
323
|
+
|
|
324
|
+
# 追加到最后一次提交
|
|
325
|
+
git add .
|
|
326
|
+
git commit --amend --no-edit
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Cherry-pick
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
# 把某个提交应用到当前分支
|
|
333
|
+
git cherry-pick <commit-id>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### 查看某人的提交
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
git log --author="作者名"
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
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 合并代码
|