mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Add a Codex-style global search dialog (Cmd+K / sidebar button) that full-text searches across all session transcripts, replacing the old title-only sidebar filter. Backend: rewrite searchService.searchSessions as a two-phase engine — ripgrep finds candidate files + matched lines, then those lines are parsed to keep only user/assistant text, re-confirmed against the cleaned text to drop JSON/UUID/base64 false positives, and windowed into highlighted snippets. Results carry real session titles (new sessionService.getSessionTitleAndMeta reusing the list title precedence), project path, mtime, role and match counts; falls back to a JS scan when ripgrep is unavailable. Frontend: new GlobalSearchModal (debounced, stale-response-safe, keyboard nav, role badges, highlighting, recent-chats empty state); Cmd+K now opens it; the sidebar input is replaced by a search trigger button. Tests: 15 backend cases (searchService.sessions) + 12 frontend cases (GlobalSearchModal); existing Sidebar/pages tests updated for the new trigger.