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

Method doStartLoop

internal/tui/app.go:783–811  ·  view source on GitHub ↗

doStartLoop actually starts the loop (after branch check).

(prdName, prdDir string)

Source from the content-addressed store, hash-verified

781
782// doStartLoop actually starts the loop (after branch check).
783func (a App) doStartLoop(prdName, prdDir string) (tea.Model, tea.Cmd) {
784 // Check if this PRD is registered, if not register it
785 if instance := a.manager.GetInstance(prdName); instance == nil {
786 // Find the PRD path
787 prdPath := filepath.Join(prdDir, "prd.json")
788 a.manager.Register(prdName, prdPath)
789 }
790
791 // Start the loop via manager
792 if err := a.manager.Start(prdName); err != nil {
793 a.lastActivity = "Error starting loop: " + err.Error()
794 return a, nil
795 }
796
797 // Update state if this is the current PRD
798 if prdName == a.prdName {
799 a.state = StateRunning
800 a.startTime = time.Now()
801 a.lastActivity = "Starting loop..."
802 // Reset story timing state
803 a.storyTimings = nil
804 a.currentStoryID = ""
805 a.currentStoryStart = time.Time{}
806 return a, tickElapsed()
807 }
808
809 a.lastActivity = "Started loop for: " + prdName
810 return a, nil
811}
812
813// pauseLoop sets the pause flag so the loop stops after the current iteration.
814func (a App) pauseLoop() (tea.Model, tea.Cmd) {

Callers 3

startLoopForPRDMethod · 0.95
finishWorktreeSetupMethod · 0.95

Calls 4

tickElapsedFunction · 0.85
GetInstanceMethod · 0.80
RegisterMethod · 0.80
StartMethod · 0.45

Tested by

no test coverage detected