doStartLoop actually starts the loop (after branch check).
(prdName, prdDir string)
| 781 | |
| 782 | // doStartLoop actually starts the loop (after branch check). |
| 783 | func (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. |
| 814 | func (a App) pauseLoop() (tea.Model, tea.Cmd) { |
no test coverage detected