SPOT-002: shared/spot.js hunk-substrate locators (#L123, #needle, #/re/, #'pattern')

Now
OPEN

Input

Context

Every view (why:, cat:, diff:, spot:) emits the same {uri, text, toks} hunk stream, so the locator/search layer must consume tokenized hunks, not raw bytes. Hidden link toks U (click-target URI bytes) and O (why's origin-commit link) are zero-width and must be invisible to matching AND to line/col math. Supersedes SPOT-001 (grammar re-ruled by gritzko 2026-07-18).

Goals

shared/spot.js: parse a fragment locator, resolve it over one or many hunks, clip sub-hunks. Fragment grammar (ruling, 2026-07-18):

Constraints

WIP

Design decisions

API sketch (C twins: SPOTTokenize, SPOTInit/SPOTNext, SPOTReplace, CAPOGrep/CAPOPcreGrep, HUNKu32sClip, grepCtx):

TODOs

Blockers and bummers

Outcome