MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / promptBuilderForPRD

Function promptBuilderForPRD

internal/loop/loop.go:103–123  ·  view source on GitHub ↗

promptBuilderForPRD returns a function that loads the PRD and builds a prompt with the next story inlined. This is called before each iteration so that newly completed stories are skipped. The returned storyID is stored on the Loop.

(prdPath string)

Source from the content-addressed store, hash-verified

101// with the next story inlined. This is called before each iteration so that
102// newly completed stories are skipped. The returned storyID is stored on the Loop.
103func promptBuilderForPRD(prdPath string) func() (string, string, error) {
104 return func() (string, string, error) {
105 p, err := prd.LoadPRD(prdPath)
106 if err != nil {
107 return "", "", fmt.Errorf("failed to load PRD for prompt: %w", err)
108 }
109
110 story := p.NextStory()
111 if story == nil {
112 return "", "", fmt.Errorf("all stories are complete")
113 }
114
115 // Mark the story as in-progress in the markdown file
116 _ = prd.SetStoryStatus(prdPath, story.ID, "in-progress")
117
118 storyCtx := p.NextStoryContext()
119
120 prompt := embed.GetPrompt(prd.ProgressPath(prdPath), *storyCtx, story.ID, story.Title)
121 return prompt, story.ID, nil
122 }
123}
124
125// Events returns the channel for receiving events from the loop.
126func (l *Loop) Events() <-chan Event {

Callers 2

StartMethod · 0.85

Calls 6

LoadPRDFunction · 0.92
SetStoryStatusFunction · 0.92
GetPromptFunction · 0.92
ProgressPathFunction · 0.92
NextStoryMethod · 0.80
NextStoryContextMethod · 0.80

Tested by

no test coverage detected