Spot: structural code search, grep, regex, diff, merge

Spot is the search dog: its purview is structural code search, grep, regex, replace, and token-level diff/merge, and it owns the NNNNN.spot.idx trigram and symbol index runs under .be/. The goal is instant search plus token-granular diff and merge, all syntax-highlighted. The method: tokenize source by file extension, build the indexes, seek candidates by trigram, then match by flat token pattern (SPOT), substring (grep), or a Thompson NFA (regex); diff and merge run LCS over token streams.

API

Spot follows the Dog three-call contract; the CAPO layer carries the index and the search/index primitives the verbs dispatch to.

CLI

The spot CLI is the multitool surface — cat, search, replace, diff, merge, and indexing — selectable by flag.

Snippet search (SPOT)

-s matches structurally, not textually, so whitespace and formatting differences are ignored; placeholders bind tokens, and -r rewrites them.

Git integration

Spot plugs into git as a diff and merge driver and a post-commit indexing hook, via .gitattributes and git config.