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

Method handleLoopFinished

internal/tui/app.go:1026–1057  ·  view source on GitHub ↗

handleLoopFinished handles when a loop finishes.

(prdName string, err error)

Source from the content-addressed store, hash-verified

1024
1025// handleLoopFinished handles when a loop finishes.
1026func (a App) handleLoopFinished(prdName string, err error) (tea.Model, tea.Cmd) {
1027 // Only update state if this is the current PRD
1028 if prdName == a.prdName {
1029 // Get the actual state from the manager
1030 if state, _, _ := a.manager.GetState(prdName); state != 0 {
1031 switch state {
1032 case loop.LoopStateError:
1033 a.state = StateError
1034 a.err = err
1035 if err != nil {
1036 a.lastActivity = "Error: " + err.Error()
1037 }
1038 case loop.LoopStatePaused:
1039 a.state = StatePaused
1040 a.lastActivity = "Paused"
1041 case loop.LoopStateStopped:
1042 a.state = StateStopped
1043 a.lastActivity = "Stopped"
1044 case loop.LoopStateComplete:
1045 a.state = StateComplete
1046 a.lastActivity = "All stories complete!"
1047 }
1048 }
1049
1050 // Reload PRD to reflect any changes
1051 if p, err := prd.LoadPRD(a.prdPath); err == nil {
1052 a.prd = p
1053 }
1054 }
1055
1056 return a, nil
1057}
1058
1059// View renders the TUI.
1060func (a App) View() string {

Callers 1

UpdateMethod · 0.95

Calls 2

LoadPRDFunction · 0.92
GetStateMethod · 0.45

Tested by

no test coverage detected