Skip to content

Commit 76943cf

Browse files
committed
feat(release-note): add template-based release note generation #256
Introduce a new template-based approach for generating release notes. The `ReleaseNoteSuggestionAction` now uses `TemplateRender` to render release notes from a `release-note.vm` template. Added new template files for both English and Chinese locales. Updated the prompt override documentation to reflect the new template
1 parent 6cdd753 commit 76943cf

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Generate release note based on follow info:
2+
3+
$context.commitMsgs
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
根据如下的提交信息,生成本次发布的 Release Note::
2+
3+
$context.commitMsgs

docs/customize/prompt-override.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ For example, create a file named `prompts/sql/sql-gen-clarify.vm`, will override
3434
│ └── page-gen-design.vm
3535
├── practises
3636
│ ├── code-review.vm
37+
│ ├── gen-commit-msg.vm
3738
│ ├── refactoring.vm
38-
│ ├── shell-suggest.vm
39-
│ └── gen-commit-msg.vm
39+
│ ├── release-note.vm
40+
│ └── shell-suggest.vm
4041
├── quick
4142
│ └── quick-action.vm
4243
├── sql

exts/ext-git/src/main/kotlin/cc/unitmesh/git/actions/vcs/ReleaseNoteSuggestionAction.kt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import cc.unitmesh.devti.gui.chat.ChatCodingPanel
66
import cc.unitmesh.devti.gui.chat.ChatCodingService
77
import cc.unitmesh.devti.provider.ContextPrompter
88
import cc.unitmesh.devti.settings.LanguageChangedCallback.presentationText
9+
import cc.unitmesh.devti.template.GENIUS_MIGRATION
10+
import cc.unitmesh.devti.template.GENIUS_PRACTISES
11+
import cc.unitmesh.devti.template.TemplateRender
12+
import cc.unitmesh.devti.template.context.TemplateContext
913
import com.intellij.openapi.actionSystem.AnAction
1014
import com.intellij.openapi.actionSystem.AnActionEvent
1115
import com.intellij.vcs.log.VcsLogDataKeys
@@ -34,8 +38,15 @@ class ReleaseNoteSuggestionAction : AnAction() {
3438
contentManager?.removeAllContents(true)
3539
contentManager?.addContent(content!!)
3640

41+
val templateRender = TemplateRender(GENIUS_PRACTISES)
42+
val template = templateRender.getTemplate("release-note.vm")
3743
val commitMsgs = stringList.joinToString(",")
38-
val prompt = "generate release note based on follow info: $commitMsgs"
44+
45+
templateRender.context = ReleaseNoteSuggestionContext(
46+
commitMsgs = commitMsgs,
47+
)
48+
49+
val prompt = templateRender.renderTemplate(template)
3950

4051
toolWindowManager?.activate {
4152
chatCodingService.handlePromptAndResponse(contentPanel, object : ContextPrompter() {
@@ -45,3 +56,7 @@ class ReleaseNoteSuggestionAction : AnAction() {
4556
}
4657
}
4758
}
59+
60+
data class ReleaseNoteSuggestionContext(
61+
val commitMsgs: String = "",
62+
) : TemplateContext

0 commit comments

Comments
 (0)