feat(ui): saved trails — a walk you named, kept, and still true after a re-index (CG-60)

Save trail on the trail bar writes the walk to .codegraph/ui/trails/ as one
JSON file, listed on the empty screen and on Entry points above the derived
suggestions, reopened at the symbol you left with the whole path restored.

A hop is stored by qualified name, kind and file — never by node id, which
contains a start line and so changes the first time anybody edits above the
symbol. Every hop is re-resolved against the current index on the way out and
each row says what became of it: still here, moved to another file, now
ambiguous, or gone. A hole is never stitched over: the row opens the longest
run of CONSECUTIVE resolved hops and says which ones those are, because the
trail is a path and a skipped hop would draw a call that does not exist.

This is the first write the viewer makes, and the boundary moved with it:
POST/DELETE answer under /api/ only, must carry X-CodeGraph-UI and
application/json (neither of which a cross-origin form can produce without a
preflight this server answers none of), and --read-only refuses both while
still listing what is there. The blanket "read-only" claim is retired from the
banner, the README, the CLI help and the docs site in favour of the narrower
true one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-08-27 08:31:48 -05:00
co-authored by Claude Opus 5
parent 55a33055ee
commit 47576b392e
32 changed files with 3162 additions and 78 deletions
+19 -1
View File
@@ -54,6 +54,7 @@ export type {
LiveHandlers,
MapRequest,
RoutesRequest,
SaveTrailRequest,
SearchRequest,
SourceRequest,
} from './lib/adapter';
@@ -102,8 +103,10 @@ export { default as DeadCodeView } from './views/DeadCodeView.svelte';
/* -------------------------------------------------------- the furniture -- */
/** The path walked, with its arrows and its "read as flow". */
/** The path walked, with its arrows, its "read as flow" and its Save. */
export { default as TrailBar } from './components/TrailBar.svelte';
/** The trails somebody kept, each hop re-resolved against the current graph. */
export { default as SavedTrails } from './components/SavedTrails.svelte';
/** The search box, its keyboard and its results panel — one component. */
export { default as SearchPalette } from './components/SearchPalette.svelte';
/** The results panel alone, for a host that owns the input. */
@@ -124,6 +127,7 @@ export { default as TypeHierarchy } from './components/symbol/TypeHierarchy.svel
export { trail, resolveTrailNames } from './lib/trail.svelte';
export { encodeTrail, decodeTrail, hopLabel } from './lib/trail-codec';
export type { HopDirection, TrailHop } from './lib/trail-codec';
export { trails } from './lib/trails.svelte';
export { live, liveRefresh, touchesFile } from './lib/live.svelte';
export type { LiveChanged, LiveHello, LiveIndexEvent, LiveIndexRevision } from './lib/live.svelte';
export { project } from './lib/project.svelte';
@@ -230,6 +234,20 @@ export {
DEAD_CODE_CAVEAT,
} from './lib/deadcode-model';
export {
hopStatusWord,
isOpenable as isTrailOpenable,
replacedTrail,
trailDecay,
trailExport,
trailMeta,
trailNameProblem,
trailOpens,
trailTitle,
MAX_NAMED_DECAYED,
} from './lib/trails-model';
export type { TrailDecay } from './lib/trails-model';
export { buildEntryPanel, flowPair, matchEntries } from './lib/entry-model';
export type {
EntryGroup,