11
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package cc
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"strings"
|
||||
|
||||
"superwork-tui/internal/config"
|
||||
)
|
||||
|
||||
//go:embed prompts/brainstorm.md
|
||||
var defaultBrainstormPrompt string
|
||||
|
||||
//go:embed prompts/brainstorm-continue.md
|
||||
var defaultBrainstormContinuePrompt string
|
||||
|
||||
//go:embed prompts/implement-plan.md
|
||||
var defaultImplementPlanPrompt string
|
||||
|
||||
//go:embed prompts/review.md
|
||||
var defaultReviewPrompt string
|
||||
|
||||
func BrainstormPrompt(s *config.Settings, vars struct{ UserRequest, Nonce string }) string {
|
||||
tpl := s.BrainstormPrompt
|
||||
if tpl == "" {
|
||||
tpl = defaultBrainstormPrompt
|
||||
}
|
||||
return strings.NewReplacer("{userRequest}", vars.UserRequest, "{nonce}", vars.Nonce).Replace(tpl)
|
||||
}
|
||||
|
||||
func BrainstormContinuePrompt(s *config.Settings, vars struct{ IssueNumber string }) string {
|
||||
tpl := s.BrainstormContinuePrompt
|
||||
if tpl == "" {
|
||||
tpl = defaultBrainstormContinuePrompt
|
||||
}
|
||||
return strings.NewReplacer("{issueNumber}", vars.IssueNumber).Replace(tpl)
|
||||
}
|
||||
|
||||
func ImplementPlanPrompt(s *config.Settings, vars struct{ PlanFile, IssueNumber string }) string {
|
||||
tpl := s.ImplementPlanPrompt
|
||||
if tpl == "" {
|
||||
tpl = defaultImplementPlanPrompt
|
||||
}
|
||||
return strings.NewReplacer("{planFile}", vars.PlanFile, "{issueNumber}", vars.IssueNumber).Replace(tpl)
|
||||
}
|
||||
|
||||
func ReviewPrompt(s *config.Settings, vars struct{ PrNumber string }) string {
|
||||
tpl := s.ReviewPrompt
|
||||
if tpl == "" {
|
||||
tpl = defaultReviewPrompt
|
||||
}
|
||||
return strings.NewReplacer("{prNumber}", vars.PrNumber).Replace(tpl)
|
||||
}
|
||||
Reference in New Issue
Block a user