Skip to content

fix(graph): keyboard-navigable search with separator-tolerant matching - #175

Merged
AkashGoenka merged 1 commit into
mainfrom
claude/festive-johnson-28snoc
Sep 29, 2026
Merged

AkashGoenka merged 1 commit into
mainfrom
claude/festive-johnson-28snoc

Conversation

@AkashGoenka

Copy link
Copy Markdown
Owner

Summary

  • The graph viewer's file search panel only matched literal substrings against filenames/paths, so a multi-word query like "kb elicit" failed to find kb-elicit.mjs since the hyphen in the filename never matched the space in the query.
  • The hit list had no keyboard navigation: Enter always picked the first result regardless of what the user was looking at, and there was no way to move a selection with the arrow keys.

Changes

  • scripts/graph-viewer/sphere.template.html (source of the generated viewer):
    • Added a token-matching fallback tier to the search ranking: query terms are split on whitespace and compared against filenames/paths with -, _, ., / normalized to spaces, so "kb elicit" now matches kb-elicit.mjs. Existing exact-substring tiers are tried first and still rank highest.
    • Added ArrowUp/ArrowDown handling on the search input to move a highlighted selection through the current hit list (wrapping at the ends), with a .hit.sel style so the highlighted row is visible. Enter now activates the highlighted hit instead of always the first one, falling back to the first hit if nothing is highlighted yet.
  • src/graph/view-template.ts regenerated via node scripts/graph-viewer/build-template.mjs (this file is generated — never hand-edited).

Test plan

  • npx tsc --noEmit — clean
  • npx vitest run tests/graph.test.ts — 14/14 passing
  • npx vitest run (full suite) — 856 passing / 3 pre-existing failures on main unrelated to this change (tests/cursor-hooks.test.ts, tests/nudge-arming.test.ts), confirmed by stashing this diff and re-running
  • Manual verification in a browser (not run in this environment)

Generated by Claude Code

The graph viewer's file search only matched literal substrings, so a
query like "kb elicit" missed kb-elicit.mjs because the hyphen didn't
match the space. It also had no arrow-key navigation through the hit
list, so Enter always picked the first result. Add a token-matching
fallback tier that normalizes -, _, ., / to spaces before comparing,
and wire ArrowUp/ArrowDown to move a highlighted selection that Enter
now respects.
@AkashGoenka
AkashGoenka merged commit d339b46 into main Sep 29, 2026
8 checks passed
@AkashGoenka
AkashGoenka deleted the claude/festive-johnson-28snoc branch September 29, 2026 16:46
@AkashGoenka AkashGoenka mentioned this pull request Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants