Skip to content

armgit / cogit

Public Imported from GitHub
0

Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.

feat(template): add experimental outline side view

Eren5389816e8dcf
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d7e146..bbe4641 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
+- Experimental outline side view in the map: a collapsible epoch → session → node tree behind a "Show outline" toggle (off by default); selecting a row expands the graph groups it needs, centres that node and opens the drill-down panel, while graph clicks highlight the matching row.
- Drill-down side panel in the map: clicking a node or session shows title, kind, summary, why, timestamps and the owning session, with a "Copy resume command" button (`cd '<path>' && claude --resume <id>`, clipboard plus a `file://` fallback). `build` marks sessions whose Claude Code transcript no longer exists, disabling the button with "session no longer available".
- Nested lineage graph in the map: React Flow 12 renders epochs → sessions → nodes as collapsible groups, ELK lays them out top-down in the page, with a minimap, controls and kind colours; the latest session opens expanded. 495 nodes lay out in ~96–155 ms per change in Chromium from `file://`.
- Status card at the top of the map: goal, done, pending and next from the most recently updated session, with `needsUser` items merged from every session active within 7 days (deduplicated by text, newest first).
diff --git a/docs/qa/test-plan.md b/docs/qa/test-plan.md
new file mode 100644
index 0000000..92b0605
--- /dev/null
+++ b/docs/qa/test-plan.md
@@ -0,0 +1,5 @@
+# Test plan
+
+| ID | Kova | Notlar / case'ler | Durum |
+|----|------|-------------------|-------|
+| 2.6 | unit | `outlinePath`: epoch → epoch, session → epoch, nested node → tam ancestor zinciri, unassigned grubu, bilinmeyen id. Outline UI akışı (toggle, grafik odağı, drill-down, console) `browse` MCP ile `file://` üzerinde elle doğrulandı; template UI için otomatik e2e harness yok. | yazıldı |
diff --git a/packages/template/README.md b/packages/template/README.md
index d145f74..00e2ede 100644
--- a/packages/template/README.md
+++ b/packages/template/README.md
@@ -16,6 +16,14 @@ npm run build -w template # writes dist/index.html (embedded by the CLI build)
and returns React Flow nodes with parent-relative positions. Only expanded groups
send their children to ELK; the page opens with the most recent session expanded.
+## Outline (experimental)
+
+The map can show an outline tree (epoch → session → node) next to the graph. It is
+off by default and toggled with "Show outline". Selecting a row expands the graph
+groups the item lives in, centres it and opens the drill-down panel; clicking a
+graph node highlights the matching row. The tree keeps its own expand/collapse
+state so a wide graph can stay collapsed while the outline browses it.
+
## Layout budget
Measured 2026-10-21 in Chromium from `file://`, 495 nodes across 15 sessions in 3
diff --git a/packages/template/src/Graph.tsx b/packages/template/src/Graph.tsx
index 2d54fd4..c0e0836 100644
--- a/packages/template/src/Graph.tsx
+++ b/packages/template/src/Graph.tsx
@@ -12,7 +12,16 @@ import {
useReactFlow,
} from "@xyflow/react";
import "@xyflow/react/dist/style.css";
-import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
+import {
+ createContext,
+ type ReactNode,
+ useCallback,
+ useContext,
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+} from "react";
import type { LineageViewModel } from "../../cli/src/view/model.js";
import { formatTime } from "./format.js";
import {
@@ -23,6 +32,7 @@ import {
layoutGraph,
type SessionFlowNode,
} from "./graph.js";
+import { Outline, type OutlineTarget } from "./Outline.js";
import { DrillDown, type Selection } from "./SidePanel.js";
/** Toggle callback reaches the group headers without threading props through React Flow. */
@@ -137,8 +147,35 @@ function Flow({ model }: { model: LineageViewModel }) {
const [selection, setSelection] = useState<Selection | null>(null);
const [layout, setLayout] = useState<Awaited<ReturnType<typeof layoutGraph>> | null>(null);
const [error, setError] = useState<string | null>(null);
+ const [showOutline, setShowOutline] = useState(false);
+ const [focusedId, setFocusedId] = useState<string | null>(null);
+ /** Wait for the layout that contains this node, then centre on it. */
+ const pendingFocus = useRef<string | null>(null);
+ const focusTimer = useRef<number | null>(null);
+ /** Outline selection just re-fitted the view; don't let the generic fit undo it. */
+ const lastFocusRequest = useRef(Number.NEGATIVE_INFINITY);
+ /** The first run belongs to mount; only React to the user toggling the outline. */
+ const firstOutlineToggle = useRef(true);
const { fitView } = useReactFlow();
+ const scheduleFocus = useCallback(
+ (id: string) => {
+ if (focusTimer.current !== null) window.clearTimeout(focusTimer.current);
+ focusTimer.current = window.setTimeout(() => {
+ focusTimer.current = null;
+ void fitView({ nodes: [{ id }], padding: 0.6, duration: 300, maxZoom: 1.2 });
+ }, 80);
+ },
+ [fitView],
+ );
+
+ useEffect(
+ () => () => {
+ if (focusTimer.current !== null) window.clearTimeout(focusTimer.current);
+ },
+ [],
+ );
+
useEffect(() => {
let cancelled = false;
setError(null);
@@ -148,6 +185,11 @@ function Flow({ model }: { model: LineageViewModel }) {
setLayout(result);
// Survives into the single-file build so a 500-node run can be measured.
document.documentElement.dataset.layoutMs = result.layoutMs.toFixed(1);
+ const focus = pendingFocus.current;
+ if (focus && result.nodes.some((node) => node.id === focus)) {
+ pendingFocus.current = null;
+ scheduleFocus(focus);
+ }
})
.catch((err: unknown) => {
if (cancelled) return;
@@ -156,16 +198,29 @@ function Flow({ model }: { model: LineageViewModel }) {
return () => {
cancelled = true;
};
- }, [model, expanded]);
+ }, [model, expanded, scheduleFocus]);
useEffect(() => {
if (!layout) return;
+ if (performance.now() - lastFocusRequest.current < 1000) return;
const timer = setTimeout(() => {
void fitView({ padding: 0.15, duration: 200 });
}, 60);
return () => clearTimeout(timer);
}, [layout, fitView]);
+ // Opening or closing the outline changes the canvas width, so re-frame the map.
+ useEffect(() => {
+ if (firstOutlineToggle.current) {
+ firstOutlineToggle.current = false;
+ return;
+ }
+ const timer = setTimeout(() => {
+ void fitView({ padding: 0.15, duration: 200 });
+ }, 80);
+ return () => clearTimeout(timer);
+ }, [showOutline, fitView]);
+
const toggle = useCallback((id: string) => {
setExpanded((previous) => {
const next = new Set(previous);
@@ -176,7 +231,9 @@ function Flow({ model }: { model: LineageViewModel }) {
}, []);
const actions = useMemo(() => ({ toggle }), [toggle]);
const closePanel = useCallback(() => setSelection(null), []);
+ const toggleOutline = useCallback(() => setShowOutline((value) => !value), []);
const onNodeClick = useCallback<NodeMouseHandler<GraphNode>>((_event, node) => {
+ setFocusedId(node.id);
if (node.type === "lineage") {
setSelection({ type: "node", node: node.data });
} else if (node.type === "session") {
@@ -184,14 +241,41 @@ function Flow({ model }: { model: LineageViewModel }) {
}
}, []);
- if (error) return <p className="error graph-status">{error}</p>;
- if (!layout) return <p className="graph-status">Laying out the map…</p>;
- if (layout.nodes.length === 0) {
- return <p className="graph-status empty">No sessions recorded yet.</p>;
- }
+ /**
+ * Selecting in the outline must reveal the target's group chain in the graph
+ * first: a collapsed group has no flow node at all, so its child cannot be
+ * focused until the next layout lands.
+ */
+ const selectFromOutline = useCallback(
+ (target: OutlineTarget) => {
+ const needsLayout = target.expand.some((id) => !expanded.has(id));
+ setExpanded((previous) => {
+ const next = new Set(previous);
+ for (const id of target.expand) next.add(id);
+ return next;
+ });
+ setSelection(target.selection);
+ setFocusedId(target.focusId);
+ lastFocusRequest.current = performance.now();
+ if (needsLayout) {
+ pendingFocus.current = target.focusId;
+ } else {
+ pendingFocus.current = null;
+ scheduleFocus(target.focusId);
+ }
+ },
+ [expanded, scheduleFocus],
+ );
- return (
- <GraphActions.Provider value={actions}>
+ let content: ReactNode;
+ if (error) {
+ content = <p className="error graph-status">{error}</p>;
+ } else if (!layout) {
+ content = <p className="graph-status">Laying out the map…</p>;
+ } else if (layout.nodes.length === 0) {
+ content = <p className="graph-status empty">No sessions recorded yet.</p>;
+ } else {
+ content = (
<ReactFlow
nodes={layout.nodes}
edges={layout.edges}
@@ -210,7 +294,35 @@ function Flow({ model }: { model: LineageViewModel }) {
<MiniMap pannable zoomable nodeColor={minimapColor} />
<Controls showInteractive={false} />
</ReactFlow>
- <DrillDown model={model} selection={selection} onClose={closePanel} />
+ );
+ }
+
+ return (
+ <GraphActions.Provider value={actions}>
+ <div className="map-toolbar">
+ <button
+ type="button"
+ className="outline-button"
+ aria-pressed={showOutline}
+ onClick={toggleOutline}
+ >
+ {showOutline ? "Hide outline" : "Show outline"}
+ </button>
+ </div>
+ <div className="graph-wrap">
+ {showOutline ? (
+ <Outline
+ model={model}
+ activeId={focusedId}
+ onSelect={selectFromOutline}
+ onClose={toggleOutline}
+ />
+ ) : null}
+ <div className="graph-canvas">
+ {content}
+ <DrillDown model={model} selection={selection} onClose={closePanel} />
+ </div>
+ </div>
</GraphActions.Provider>
);
}
@@ -218,7 +330,7 @@ function Flow({ model }: { model: LineageViewModel }) {
/** Nested epoch → session → node map; layout runs in the page from embedded data. */
export function Graph({ model }: { model: LineageViewModel }) {
return (
- <section className="graph-wrap" aria-label="Project lineage graph">
+ <section className="lineage-map" aria-label="Project lineage graph">
<ReactFlowProvider>
<Flow model={model} />
</ReactFlowProvider>
diff --git a/packages/template/src/Outline.tsx b/packages/template/src/Outline.tsx
new file mode 100644
index 0000000..6cf4243
--- /dev/null
+++ b/packages/template/src/Outline.tsx
@@ -0,0 +1,341 @@
+import { useEffect, useMemo, useState } from "react";
+import type { LineageViewModel, ViewNode, ViewSession } from "../../cli/src/view/model.js";
+import { countNodes, epochId, nodeId, sessionId, UNASSIGNED_EPOCH_ID } from "./graph.js";
+import type { Selection } from "./SidePanel.js";
+
+/**
+ * Experimental outline tree (epoch → session → nodes) that sits next to the
+ * graph. Selecting a row expands the graph groups the row lives in, centres the
+ * matching React Flow node and opens the same drill-down panel a click would.
+ * Epochs have no panel of their own: focusing the group is their detail view.
+ */
+
+export interface OutlineTarget {
+ /** React Flow node id to centre on. */
+ focusId: string;
+ /** Graph group ids that must be expanded for `focusId` to exist. */
+ expand: string[];
+ /** Drill-down content; `null` for epochs. */
+ selection: Selection | null;
+}
+
+interface Group {
+ id: string;
+ title: string;
+ sessions: ViewSession[];
+}
+
+function groups(model: LineageViewModel): Group[] {
+ const result: Group[] = model.epochs.map((epoch) => ({
+ id: epochId(epoch.id),
+ title: epoch.title,
+ sessions: epoch.sessions,
+ }));
+ if (model.unassigned.length > 0) {
+ result.push({ id: UNASSIGNED_EPOCH_ID, title: "Unassigned", sessions: model.unassigned });
+ }
+ return result;
+}
+
+/** Ids from the first matching node down to the target, or `null`. */
+function findNodePath(nodes: ViewNode[], group: string, targetId: string): string[] | null {
+ for (const node of nodes) {
+ const id = nodeId(group, node.id);
+ if (id === targetId) return [id];
+ const childPath = findNodePath(node.children, group, targetId);
+ if (childPath) return [id, ...childPath];
+ }
+ return null;
+}
+
+/**
+ * Ancestor chain of an outline item, including the item itself: the epoch for a
+ * session, the epoch, session and node ancestors for a node. `null` when the id
+ * does not belong to this model.
+ */
+export function outlinePath(model: LineageViewModel, targetId: string): string[] | null {
+ for (const group of groups(model)) {
+ if (group.id === targetId) return [group.id];
+ for (const session of group.sessions) {
+ const key = sessionId(session.sessionId);
+ if (key === targetId) return [group.id];
+ const nodePath = findNodePath(session.nodes, key, targetId);
+ if (nodePath) return [group.id, key, ...nodePath];
+ }
+ }
+ return null;
+}
+
+function ExpandToggle({
+ id,
+ hasChildren,
+ expanded,
+ onToggle,
+}: {
+ id: string;
+ hasChildren: boolean;
+ expanded: boolean;
+ onToggle: (id: string) => void;
+}) {
+ if (!hasChildren) return <span className="outline-toggle is-empty" aria-hidden="true" />;
+ return (
+ <button
+ type="button"
+ className="outline-toggle"
+ aria-expanded={expanded}
+ aria-label={expanded ? "Collapse" : "Expand"}
+ onClick={() => onToggle(id)}
+ >
+ {expanded ? "▾" : "▸"}
+ </button>
+ );
+}
+
+function NodeRows({
+ nodes,
+ epoch,
+ sessionKey,
+ rawSessionId,
+ activeId,
+ expanded,
+ onToggle,
+ onSelect,
+}: {
+ nodes: ViewNode[];
+ epoch: string;
+ sessionKey: string;
+ rawSessionId: string;
+ activeId: string | null;
+ expanded: ReadonlySet<string>;
+ onToggle: (id: string) => void;
+ onSelect: (target: OutlineTarget) => void;
+}) {
+ return (
+ <>
+ {nodes.map((node) => {
+ const id = nodeId(sessionKey, node.id);
+ const hasChildren = node.children.length > 0;
+ const open = hasChildren && expanded.has(id);
+ return (
+ <li key={id}>
+ <div className="outline-row">
+ <ExpandToggle
+ id={id}
+ hasChildren={hasChildren}
+ expanded={expanded.has(id)}
+ onToggle={onToggle}
+ />
+ <button
+ type="button"
+ className={`outline-item${activeId === id ? " is-active" : ""}`}
+ onClick={() =>
+ onSelect({
+ focusId: id,
+ expand: [epoch, sessionKey],
+ selection: {
+ type: "node",
+ node: {
+ kind: node.kind,
+ title: node.title,
+ ...(node.summary === undefined ? {} : { summary: node.summary }),
+ ...(node.why === undefined ? {} : { why: node.why }),
+ ...(node.at === undefined ? {} : { at: node.at }),
+ sessionId: rawSessionId,
+ },
+ },
+ })
+ }
+ >
+ <span className={`kind kind-${node.kind}`}>{node.kind}</span>
+ <span className="label">{node.title}</span>
+ </button>
+ </div>
+ {open ? (
+ <ul>
+ <NodeRows
+ nodes={node.children}
+ epoch={epoch}
+ sessionKey={sessionKey}
+ rawSessionId={rawSessionId}
+ activeId={activeId}
+ expanded={expanded}
+ onToggle={onToggle}
+ onSelect={onSelect}
+ />
+ </ul>
+ ) : null}
+ </li>
+ );
+ })}
+ </>
+ );
+}
+
+function SessionRow({
+ group,
+ session,
+ activeId,
+ expanded,
+ onToggle,
+ onSelect,
+}: {
+ group: string;
+ session: ViewSession;
+ activeId: string | null;
+ expanded: ReadonlySet<string>;
+ onToggle: (id: string) => void;
+ onSelect: (target: OutlineTarget) => void;
+}) {
+ const key = sessionId(session.sessionId);
+ const hasChildren = session.nodes.length > 0;
+ const open = hasChildren && expanded.has(key);
+ return (
+ <li>
+ <div className="outline-row">
+ <ExpandToggle
+ id={key}
+ hasChildren={hasChildren}
+ expanded={expanded.has(key)}
+ onToggle={onToggle}
+ />
+ <button
+ type="button"
+ className={`outline-item${activeId === key ? " is-active" : ""}`}
+ onClick={() =>
+ onSelect({
+ focusId: key,
+ expand: [group],
+ selection: { type: "session", sessionId: session.sessionId },
+ })
+ }
+ >
+ <span className="label">{session.title || session.sessionId}</span>
+ <span className="outline-count">{countNodes(session.nodes)}</span>
+ </button>
+ </div>
+ {open ? (
+ <ul>
+ <NodeRows
+ nodes={session.nodes}
+ epoch={group}
+ sessionKey={key}
+ rawSessionId={session.sessionId}
+ activeId={activeId}
+ expanded={expanded}
+ onToggle={onToggle}
+ onSelect={onSelect}
+ />
+ </ul>
+ ) : null}
+ </li>
+ );
+}
+
+export function Outline({
+ model,
+ activeId,
+ onSelect,
+ onClose,
+}: {
+ model: LineageViewModel;
+ activeId: string | null;
+ onSelect: (target: OutlineTarget) => void;
+ onClose: () => void;
+}) {
+ const allGroups = useMemo(() => groups(model), [model]);
+ // Epochs start open so the tree lists every session; sessions and nodes close
+ // their own children until asked, mirroring the graph's collapsed default.
+ const [expanded, setExpanded] = useState<Set<string>>(
+ () => new Set(allGroups.map((group) => group.id)),
+ );
+
+ // Graph clicks drive the highlight too; reveal the row when it is nested.
+ useEffect(() => {
+ if (!activeId) return;
+ const path = outlinePath(model, activeId);
+ if (!path) return;
+ // Reveal the target: expand its ancestors, never its own children.
+ const reveal = path.slice(0, -1);
+ if (reveal.length === 0) return;
+ setExpanded((previous) => {
+ if (reveal.every((id) => previous.has(id))) return previous;
+ const next = new Set(previous);
+ for (const id of reveal) next.add(id);
+ return next;
+ });
+ }, [activeId, model]);
+
+ const toggle = (id: string): void => {
+ setExpanded((previous) => {
+ const next = new Set(previous);
+ if (next.has(id)) next.delete(id);
+ else next.add(id);
+ return next;
+ });
+ };
+
+ return (
+ <nav className="outline" aria-label="Project outline">
+ <header className="outline-head">
+ <span className="outline-title">Outline</span>
+ <span className="outline-badge">experimental</span>
+ <button
+ type="button"
+ className="drilldown-close"
+ aria-label="Hide outline"
+ onClick={onClose}
+ >
+ ×
+ </button>
+ </header>
+ <div className="outline-scroll">
+ {allGroups.length === 0 ? (
+ <p className="empty">No sessions recorded yet.</p>
+ ) : (
+ <ul className="outline-list">
+ {allGroups.map((group) => {
+ const open = expanded.has(group.id) && group.sessions.length > 0;
+ return (
+ <li key={group.id}>
+ <div className="outline-row">
+ <ExpandToggle
+ id={group.id}
+ hasChildren={group.sessions.length > 0}
+ expanded={expanded.has(group.id)}
+ onToggle={toggle}
+ />
+ <button
+ type="button"
+ className={`outline-item${activeId === group.id ? " is-active" : ""}`}
+ onClick={() =>
+ onSelect({ focusId: group.id, expand: [group.id], selection: null })
+ }
+ >
+ <span className="label">{group.title}</span>
+ <span className="outline-count">{group.sessions.length}</span>
+ </button>
+ </div>
+ {open ? (
+ <ul>
+ {group.sessions.map((session) => (
+ <SessionRow
+ key={session.sessionId}
+ group={group.id}
+ session={session}
+ activeId={activeId}
+ expanded={expanded}
+ onToggle={toggle}
+ onSelect={onSelect}
+ />
+ ))}
+ </ul>
+ ) : null}
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </div>
+ </nav>
+ );
+}
diff --git a/packages/template/src/graph.ts b/packages/template/src/graph.ts
index c7ead31..c61205d 100644
--- a/packages/template/src/graph.ts
+++ b/packages/template/src/graph.ts
@@ -73,7 +73,11 @@ export function sessionId(id: string): string {
return `session:${id}`;
}
-function nodeId(sessionGroup: string, id: string): string {
+/**
+ * Node ids are flat per session (not per parent): the outline and the graph
+ * must agree on the same id to focus each other's items.
+ */
+export function nodeId(sessionGroup: string, id: string): string {
return `node:${sessionGroup}:${id}`;
}
@@ -208,7 +212,7 @@ function collectSizes(elk: ElkNode, out: Map<string, Sized>): void {
}
}
-function countNodes(nodes: ViewNode[]): number {
+export function countNodes(nodes: ViewNode[]): number {
return nodes.reduce((sum, node) => sum + 1 + countNodes(node.children), 0);
}
diff --git a/packages/template/src/styles.css b/packages/template/src/styles.css
index 896eb52..d6a735b 100644
--- a/packages/template/src/styles.css
+++ b/packages/template/src/styles.css
@@ -114,16 +114,47 @@ ul {
white-space: nowrap;
}
+.map-toolbar {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: 24px;
+}
+
+.outline-button {
+ padding: 5px 12px;
+ color: var(--muted);
+ background: #1a1e27;
+ border: 1px solid var(--line);
+ border-radius: 7px;
+ font: inherit;
+ font-size: 13px;
+ cursor: pointer;
+}
+
+.outline-button:hover,
+.outline-button[aria-pressed="true"] {
+ color: var(--text);
+ border-color: var(--accent);
+}
+
.graph-wrap {
position: relative;
+ display: flex;
height: clamp(480px, 72vh, 900px);
- margin-top: 24px;
+ margin-top: 8px;
background: #12151b;
border: 1px solid var(--line);
border-radius: 12px;
overflow: hidden;
}
+.graph-canvas {
+ position: relative;
+ flex: 1;
+ min-width: 0;
+ height: 100%;
+}
+
.graph-status {
display: flex;
align-items: center;
@@ -133,6 +164,132 @@ ul {
padding: 24px;
}
+/* Experimental outline tree beside the graph. */
+.outline {
+ display: flex;
+ flex: none;
+ flex-direction: column;
+ width: 270px;
+ height: 100%;
+ background: rgba(17, 20, 26, 0.94);
+ border-right: 1px solid var(--line);
+}
+
+.outline-head {
+ display: flex;
+ flex: none;
+ align-items: center;
+ gap: 8px;
+ padding: 10px 10px 10px 14px;
+ border-bottom: 1px solid var(--line);
+}
+
+.outline-title {
+ font-size: 12px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.08em;
+ color: var(--muted);
+}
+
+.outline-badge {
+ padding: 1px 6px;
+ color: var(--muted);
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ font-size: 10px;
+}
+
+.outline-head .drilldown-close {
+ margin-left: auto;
+}
+
+.outline-scroll {
+ flex: 1;
+ padding: 6px 6px 12px;
+ overflow-y: auto;
+}
+
+.outline-list,
+.outline-list ul {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.outline-list ul {
+ padding-left: 14px;
+}
+
+.outline-row {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+ min-width: 0;
+}
+
+.outline-toggle {
+ flex: none;
+ width: 18px;
+ height: 18px;
+ padding: 0;
+ color: var(--muted);
+ background: transparent;
+ border: 0;
+ font-size: 11px;
+ line-height: 1;
+ cursor: pointer;
+}
+
+.outline-toggle:hover {
+ color: var(--text);
+}
+
+.outline-toggle.is-empty {
+ display: inline-block;
+ cursor: default;
+}
+
+.outline-item {
+ display: flex;
+ flex: 1;
+ align-items: center;
+ gap: 6px;
+ min-width: 0;
+ padding: 4px 6px;
+ overflow: hidden;
+ color: var(--text);
+ background: transparent;
+ border: 0;
+ border-radius: 5px;
+ font: inherit;
+ font-size: 13px;
+ text-align: left;
+ cursor: pointer;
+}
+
+.outline-item:hover {
+ background: #1d222c;
+}
+
+.outline-item.is-active {
+ background: #243040;
+ outline: 1px solid var(--accent);
+}
+
+.outline-item .label {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+
+.outline-count {
+ flex: none;
+ margin-left: auto;
+ color: var(--muted);
+ font-size: 11px;
+}
+
/* React Flow group nodes: epoch and session boxes that contain their children. */
.flow-group {
width: 100%;
@@ -450,4 +607,20 @@ time {
.meta {
align-items: flex-start;
}
+
+ .graph-wrap {
+ flex-direction: column;
+ height: auto;
+ }
+
+ .outline {
+ width: 100%;
+ height: 220px;
+ border-right: 0;
+ border-bottom: 1px solid var(--line);
+ }
+
+ .graph-canvas {
+ height: 480px;
+ }
}
diff --git a/packages/template/test/outline.test.ts b/packages/template/test/outline.test.ts
new file mode 100644
index 0000000..25abf97
--- /dev/null
+++ b/packages/template/test/outline.test.ts
@@ -0,0 +1,66 @@
+import { describe, expect, it } from "vitest";
+import type { LineageViewModel, ViewNode, ViewSession } from "../../cli/src/view/model.js";
+import { outlinePath } from "../src/Outline.js";
+
+const AT = "2026-10-21T10:00:00.000Z";
+
+function node(id: string, title: string, children: ViewNode[] = []): ViewNode {
+ return { id, kind: "step", title, children };
+}
+
+function session(id: string, epoch: string | null, nodes: ViewNode[]): ViewSession {
+ return {
+ sessionId: id,
+ agent: "claude-code",
+ title: id,
+ epoch,
+ startedAt: AT,
+ updatedAt: AT,
+ status: { goal: "", done: [], pending: [], next: "" },
+ nodes,
+ transcriptAvailable: true,
+ };
+}
+
+const model: LineageViewModel = {
+ kind: "lineage",
+ schema: 1,
+ project: { name: "p", path: "/tmp/p", generatedAt: AT },
+ status: { goal: "", done: [], pending: [], next: "", lastActivity: null },
+ epochs: [
+ {
+ id: "e1",
+ title: "Epoch one",
+ createdAt: AT,
+ sessions: [session("s1", "e1", [node("n1", "A", [node("n2", "B")]), node("n3", "C")])],
+ },
+ ],
+ unassigned: [session("u1", null, [])],
+};
+
+describe("outlinePath", () => {
+ it("returns the epoch for an epoch row", () => {
+ expect(outlinePath(model, "epoch:e1")).toEqual(["epoch:e1"]);
+ });
+
+ it("returns the owning epoch for a session row", () => {
+ expect(outlinePath(model, "session:s1")).toEqual(["epoch:e1"]);
+ });
+
+ it("returns every ancestor of a nested node, including the node itself", () => {
+ expect(outlinePath(model, "node:session:s1:n2")).toEqual([
+ "epoch:e1",
+ "session:s1",
+ "node:session:s1:n1",
+ "node:session:s1:n2",
+ ]);
+ });
+
+ it("places unassigned sessions under the unassigned group", () => {
+ expect(outlinePath(model, "session:u1")).toEqual(["unassigned"]);
+ });
+
+ it("returns null for an id outside the model", () => {
+ expect(outlinePath(model, "session:missing")).toBeNull();
+ });
+});