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

Method handleSearchSessions

cli/cli_session.go:249–272  ·  view source on GitHub ↗

handleSearchSessions runs a full-text search across saved sessions and prints the matching sessions with context snippets. It reuses the existing JSON session store — no separate index.

(query string)

Source from the content-addressed store, hash-verified

247// prints the matching sessions with context snippets. It reuses the existing
248// JSON session store — no separate index.
249func (cli *ChatCLI) handleSearchSessions(query string) {
250 hits, err := cli.sessionManager.SearchSessions(query, 3)
251 if err != nil {
252 fmt.Println(i18n.T("session.search.error", err))
253 return
254 }
255 if len(hits) == 0 {
256 fmt.Println(colorize(" "+i18n.T("session.search.none", query), ColorGray))
257 return
258 }
259
260 fmt.Println()
261 fmt.Println(colorize(" "+i18n.T("session.search.header", query), ColorCyan+ColorBold))
262 fmt.Println(colorize(" ─────────────────────────────────────────", ColorGray))
263 for _, h := range hits {
264 fmt.Printf(" %s %s\n",
265 colorize(h.Session, ColorYellow),
266 colorize(i18n.T("session.search.match_count", h.Matches), ColorGray))
267 for _, snip := range h.Snippets {
268 fmt.Printf(" %s\n", colorize(snip, ColorGray))
269 }
270 }
271 fmt.Println()
272}
273
274func (cli *ChatCLI) handleListSessions(ctx context.Context) {
275 if cli.isRemote {

Callers 1

handleSessionCommandMethod · 0.80

Calls 3

TFunction · 0.92
colorizeFunction · 0.85
SearchSessionsMethod · 0.80

Tested by

no test coverage detected