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

Method loadTabEntry

internal/tui/tabbar.go:93–124  ·  view source on GitHub ↗

loadTabEntry creates a TabEntry for a given name and path.

(name, prdPath string)

Source from the content-addressed store, hash-verified

91
92// loadTabEntry creates a TabEntry for a given name and path.
93func (t *TabBar) loadTabEntry(name, prdPath string) TabEntry {
94 tabEntry := TabEntry{
95 Name: name,
96 Path: prdPath,
97 LoopState: loop.LoopStateReady,
98 IsActive: name == t.currentPRD,
99 }
100
101 // Try to load the PRD for progress info
102 loadedPRD, err := prd.LoadPRD(prdPath)
103 if err == nil {
104 tabEntry.Total = len(loadedPRD.UserStories)
105 for _, story := range loadedPRD.UserStories {
106 if story.Passes {
107 tabEntry.Completed++
108 }
109 }
110 }
111
112 // Get loop state and branch from manager if available
113 if t.manager != nil {
114 if state, iteration, _ := t.manager.GetState(name); state != 0 || iteration != 0 {
115 tabEntry.LoopState = state
116 tabEntry.Iteration = iteration
117 }
118 if inst := t.manager.GetInstance(name); inst != nil {
119 tabEntry.Branch = inst.Branch
120 }
121 }
122
123 return tabEntry
124}
125
126// SetActiveByName sets the active tab by PRD name.
127func (t *TabBar) SetActiveByName(name string) {

Callers 1

RefreshMethod · 0.95

Calls 3

LoadPRDFunction · 0.92
GetInstanceMethod · 0.80
GetStateMethod · 0.45

Tested by

no test coverage detected