Cite → open in the Code browser
Make <Cite> refs open the cited file in kolu's Code-tab tree (line-highlighted) when a note is previewed inside kolu — wiring three pieces that already exist.
Goal. Inside kolu’s Code-tab preview, clicking a <Cite> ref jumps to that
file at the line in the Code browser tree (with Pierre’s line highlight) —
not a GitHub blob in a new tab. Outside kolu (GitHub, a plain browser), it stays
an ordinary blob link.
Why defer, not drop — this is wiring, not new infra
Three pieces already exist; the feature just connects them, and <Cite> is the
single producer, so it’s a localized change:
<Cite>centralizes everyfile:lineref → one component + one host handler.- Opening a
file:lineis solved — packages/client/src/right-panel/openInCodeTab.ts:71 exposesopenInCodeTab({ ref, repoRoot, targetMode }), which opens apath:linein the Code tab with the line highlighted (already used by terminal-link clicks and the right-click “Open path:N” menu). - The iframe↔host bridge already exists — packages/artifact-sdk/src/client/bridge.ts:103 (
observeIframeNavigation) carries in-iframe events to the host, and packages/solid-browser/src/previewPath.ts:30 (pathFromPreviewPathname, from@kolu/solid-browser) maps a preview URL back to a repo path — that’s how the preview already follows links (packages/client/src/right-panel/BrowseIframeRenderer.tsx:50).
Mechanism — two options
- A — dedicated bridge message (preferred). Add a
kolu-artifact-sdk:open-source { path, line }message.<Cite>posts it on click; the host handler callsopenInCodeTab. Keeps “open source in the tree” separate from the existing “navigate/swap the previewed file” semantics. - B — piggyback on navigation.
<Cite>links into the file route with#Lnn; reuseobserveIframeNavigation+ parse the line. Cheaper, but overloads the preview-swap path with a second meaning (needs a discriminator).
Roadmap
- 1Confirm the artifact-sdk is injected into Atlas previews and a
<Cite>click can reach the bridge. - 2Add
open-source { path, line }to the artifact-sdk bridge (both ends). - 3Host handler maps it to
openInCodeTab({ ref, repoRoot, targetMode: "browse" }). - 4
<Cite>progressive enhancement — blob href by default; intercept + post when the bridge is present. - 5Test (analogous to
file-ref-link.feature): click a cite in a previewed note → the tree opens the file + line highlight.
Seedling plan — deferred from the component-kit work. The kit’s <Cite> is what
makes this a localized change rather than a cross-cutting one.