@@ -5,23 +5,23 @@ nav_order: 1
5
5
parent : Design Patterns
6
6
---
7
7
8
- 根据当前的用户习惯,寻找待生成的内容作为示例,而后作为生成式 AI 的输入。
8
+ > Finding example content as context to generate as input for the generative AI, based on current user habits.
9
9
10
- ## 提交信息示例
10
+ ## Git Commit message Example
11
11
12
- 步骤:
12
+ Implementation steps:
13
13
14
- 1 . 获取当前项目的版本控制系统( VCS)日志提供者。
15
- 2 . 获取当前分支和用户。
16
- 3 . 根据用户或分支过滤日志。
17
- 4 . 收集示例提交信息。
14
+ 1 . Retrieve version control system ( VCS) log providers for the current project.
15
+ 2 . Get the current branch and user.
16
+ 3 . Filter logs based on user or branch.
17
+ 4 . Collect example submission information.
18
18
19
- 代码示例:
19
+ ### Code Implementation
20
20
21
21
``` kotlin
22
22
private fun findExampleCommitMessages (project : Project ): String? {
23
23
val logProviders = VcsProjectLog .getLogProviders(project)
24
- val entry = logProviders.entries.firstOrNull() ? : return null
24
+ logProviders.entries.firstOrNull() ? : return null
25
25
26
26
val logProvider = entry.value
27
27
val branch = logProvider.getCurrentBranch(entry.key) ? : return null
@@ -37,18 +37,43 @@ private fun findExampleCommitMessages(project: Project): String? {
37
37
}
38
38
```
39
39
40
- ## 代码示例:测试代码示例
40
+ ### Template Example
41
+
42
+ Write a cohesive yet descriptive commit message for a given diff.
43
+ - Make sure to include both information What was changed and Why.
44
+ - Start with a short sentence in imperative form, no more than 50 characters long.
45
+ - Then leave an empty line and continue with a more detailed explanation, if necessary.
46
+ - Explanation should have less than 200 characters.
47
+
48
+ Follow the Conventional Commits specification, examples:
49
+ - fix(authentication): fix password regex pattern case
50
+ - feat(storage): add support for S3 storage
51
+ - test(java): fix test case for user controller
52
+ - docs(docs): add architecture diagram to home page
53
+
54
+ #if( $context.historyExamples.length() > 0 )
55
+ Here is History Examples:
56
+ $context.historyExamples
57
+ #end
58
+
59
+ Diff:
60
+
61
+ ```diff
62
+ ${context.diffContent}
41
63
42
- 参考语言实现: ` JavaTestContextProvider ` 、 ` KotlinTestContextProvider ` 。
64
+ ## Code Example: Testing Code Samples
43
65
44
- 步骤:
66
+ Reference language implementations: ` JavaTestContextProvider ` , ` KotlinTestContextProvider ` .
45
67
46
- 1 . 获取当前项目的被测试代码。
47
- 2 . 根据被测试代码寻找模板:` Controller ` 、` Service ` 、默认测试等。
48
- - Kotlin:` ControllerTest.kt ` , ` ServiceTest.kt ` , ` Test.kt `
49
- - Java: ` ControllerTest.java ` , ` ServiceTest.java ` , ` Test.java `
50
- 3 . 根据模板生成测试代码。
68
+ Steps:
51
69
52
- ## 文档示例
70
+ 1 . Retrieve the tested code for the current project.
71
+ 2 . Find templates based on the tested code: ` Controller ` , ` Service ` , default tests, etc.
72
+ - Kotlin: ` ControllerTest.kt ` , ` ServiceTest.kt ` , ` Test.kt `
73
+ - Java: ` ControllerTest.java ` , ` ServiceTest.java ` , ` Test.java `
74
+ 3 . Generate testing code based on templates.
75
+
76
+ ## Document Example
53
77
54
78
DOC TODO
79
+ ```
0 commit comments