MCPcopy Create free account
hub / github.com/diillson/chatcli / ListSessions

Method ListSessions

cli/session_manager.go:198–212  ·  view source on GitHub ↗

ListSessions lista todas as sessões salvas.

()

Source from the content-addressed store, hash-verified

196
197// ListSessions lista todas as sessões salvas.
198func (sm *SessionManager) ListSessions() ([]string, error) {
199 entries, err := os.ReadDir(sm.sessionsDir)
200 if err != nil {
201 return nil, fmt.Errorf("erro ao ler o diretório de sessões: %w", err)
202 }
203
204 var sessions []string
205 for _, entry := range entries {
206 if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".json") {
207 sessionName := strings.TrimSuffix(entry.Name(), ".json")
208 sessions = append(sessions, sessionName)
209 }
210 }
211 return sessions, nil
212}
213
214// SessionSearchHit is one session that matched a search, with the strongest
215// snippets for context.

Callers 1

SearchSessionsMethod · 0.95

Calls 2

ErrorfMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected