fix(graph): keyboard-navigable search with separator-tolerant matching - #175
Merged
Merged
Conversation
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.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kb-elicit.mjssince the hyphen in the filename never matched the space in the query.Enteralways 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):-,_,.,/normalized to spaces, so "kb elicit" now matcheskb-elicit.mjs. Existing exact-substring tiers are tried first and still rank highest.ArrowUp/ArrowDownhandling on the search input to move a highlighted selection through the current hit list (wrapping at the ends), with a.hit.selstyle so the highlighted row is visible.Enternow 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.tsregenerated vianode scripts/graph-viewer/build-template.mjs(this file is generated — never hand-edited).Test plan
npx tsc --noEmit— cleannpx vitest run tests/graph.test.ts— 14/14 passingnpx vitest run(full suite) — 856 passing / 3 pre-existing failures onmainunrelated to this change (tests/cursor-hooks.test.ts,tests/nudge-arming.test.ts), confirmed by stashing this diff and re-runningGenerated by Claude Code