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

Method handlePRDUpdate

internal/tui/app.go:2297–2320  ·  view source on GitHub ↗

handlePRDUpdate handles PRD file change events.

(msg PRDUpdateMsg)

Source from the content-addressed store, hash-verified

2295
2296// handlePRDUpdate handles PRD file change events.
2297func (a App) handlePRDUpdate(msg PRDUpdateMsg) (tea.Model, tea.Cmd) {
2298 if msg.Error != nil {
2299 // File error - could be temporary, keep watching
2300 a.lastActivity = "PRD file error: " + msg.Error.Error()
2301 } else if msg.PRD != nil {
2302 // Update the PRD
2303 a.prd = msg.PRD
2304
2305 // Adjust selected index if it's now out of bounds
2306 if a.selectedIndex >= len(a.prd.UserStories) {
2307 a.selectedIndex = len(a.prd.UserStories) - 1
2308 if a.selectedIndex < 0 {
2309 a.selectedIndex = 0
2310 }
2311 }
2312
2313 // Auto-select the in-progress story so the user sees its details
2314 a.selectInProgressStory()
2315 a.adjustStoriesScroll()
2316 }
2317
2318 // Continue listening for changes
2319 return a, a.listenForPRDChanges()
2320}
2321
2322// stopWatcher stops the file watchers.
2323func (a *App) stopWatcher() {

Callers 1

UpdateMethod · 0.95

Calls 3

selectInProgressStoryMethod · 0.95
adjustStoriesScrollMethod · 0.95
listenForPRDChangesMethod · 0.95

Tested by

no test coverage detected