Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.
JavaScript ai-codingclaudeclaude-codeclaude-code-pluginclicoding-agentsdeveloper-toolsgitllmtypescript
feat(map): drag the message rows' right edge to widen them
Eren8306dc138cf7
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 34a1189..236f82d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]### Added-- The message rows of an open session stand in columns (time, number, message, commits and changes) under a small head; drag a column's edge in the head to make it wider or narrower, double-click it to reset. The widths apply to every session and are remembered in this browser.+- Drag the right edge of an open session's messages to make the rows wider or narrower, so long titles wrap into fewer lines; double-click the edge to reset. The width applies to every session and is remembered in this browser.## [0.21.2] - 2026-10-29### Changeddiff --git a/packages/template/src/ColumnHead.tsx b/packages/template/src/ColumnHead.tsxdeleted file mode 100644index 7934064..0000000--- a/packages/template/src/ColumnHead.tsx+++ /dev/null@@ -1,110 +0,0 @@-import { useStore } from "@xyflow/react";-import { type PointerEvent, useState } from "react";-import { columnVars } from "./GitGraph.js";-import { clampColumns, DEFAULT_COLUMNS, type GitLayout, type RowColumns } from "./gitLayout.js";--/**- * The head over an open session's message rows: the column names, and a handle- * on each column's right edge to drag it wider or narrower, like a table.- * Double-clicking a handle puts that column back to its default width. The- * widths are the same for every session and stay in this browser.- */--const KEY = "cogit.mapColumns";--export function loadColumns(): RowColumns {- try {- const raw = window.localStorage.getItem(KEY);- return raw ? clampColumns(JSON.parse(raw)) : DEFAULT_COLUMNS;- } catch {- return DEFAULT_COLUMNS;- }-}--export function saveColumns(columns: RowColumns): void {- try {- window.localStorage.setItem(KEY, JSON.stringify(columns));- } catch {- // Private window or blocked storage: the widths last until the page closes.- }-}--/** Keeps the drag on the handle when the pointer leaves it; best effort. */-function capture(event: PointerEvent, on: boolean): void {- try {- if (on) event.currentTarget.setPointerCapture(event.pointerId);- else event.currentTarget.releasePointerCapture(event.pointerId);- } catch {- // The pointer is gone already; the drag still ends on pointerup.- }-}--/** Height of the head; the open session leaves this much room above its rows. */-export const COLUMN_HEAD = 22;--function Handle({- column,- columns,- onResize,-}: {- column: keyof RowColumns;- columns: RowColumns;- onResize: (columns: RowColumns) => void;-}) {- // The canvas may be zoomed: a screen pixel is 1/zoom of a column pixel.- const zoom = useStore((state) => state.transform[2]);- const [start, setStart] = useState<{ x: number; width: number } | null>(null);- return (- <span- className={`column-handle nodrag nopan${start ? " is-dragging" : ""}`}- role="separator"- aria-orientation="vertical"- aria-label={`Resize the ${column} column`}- title="Drag to resize · double-click to reset"- onPointerDown={(event: PointerEvent) => {- event.stopPropagation();- capture(event, true);- setStart({ x: event.clientX, width: columns[column] });- }}- onPointerMove={(event: PointerEvent) => {- if (!start) return;- const width = start.width + (event.clientX - start.x) / (zoom || 1);- onResize(clampColumns({ ...columns, [column]: width }));- }}- onPointerUp={(event: PointerEvent) => {- if (!start) return;- capture(event, false);- setStart(null);- }}- onDoubleClick={(event) => {- event.stopPropagation();- onResize({ ...columns, [column]: DEFAULT_COLUMNS[column] });- }}- />- );-}--export function ColumnHead({- git,- onResize,-}: {- git: GitLayout;- onResize: (columns: RowColumns) => void;-}) {- const columns = git.columns;- if (!columns) return null;- const handle = (column: keyof RowColumns) => (- <Handle column={column} columns={columns} onResize={onResize} />- );- return (- <div- className="column-head"- style={{ marginLeft: git.graphWidth + 8, width: git.rowWidth, ...columnVars(columns) }}- >- <span className="column-name">Time{handle("time")}</span>- <span className="column-name">#</span>- <span className="column-name">Message{handle("title")}</span>- <span className="column-name">Commits · changes{handle("details")}</span>- </div>- );-}diff --git a/packages/template/src/GitGraph.tsx b/packages/template/src/GitGraph.tsxindex ed8ae40..5377169 100644--- a/packages/template/src/GitGraph.tsx+++ b/packages/template/src/GitGraph.tsx@@ -1,4 +1,4 @@-import { type CSSProperties, type MouseEvent, type ReactElement, useMemo } from "react";+import { type MouseEvent, type ReactElement, useMemo } from "react";import { formatChange, isBigChange } from "../../cli/src/view/change.js";import type { ViewNode } from "../../cli/src/view/model.js";import { formatStamp } from "./format.js";@@ -7,11 +7,9 @@ import {type GitLayout,type GitMessageRow,type GitRow,- ID_COLUMN,LANE_COLORS,linkArrow,linkPath,- type RowColumns,} from "./gitLayout.js";/**@@ -24,17 +22,6 @@ function color(index: number): string {return `var(--l${index % LANE_COLORS})`;}-/** The column widths as CSS variables for the rows' grid (`styles.css`). */-export function columnVars(columns: RowColumns | undefined): CSSProperties {- if (!columns) return {};- return {- "--col-time": `${columns.time}px`,- "--col-id": `${ID_COLUMN}px`,- "--col-title": `${columns.title}px`,- "--col-details": `${columns.details}px`,- } as CSSProperties;-}-function rowRange(row: GitRow): string {if (row.kind === "more") return "";return row.message.at ? formatStamp(row.message.at) : "";@@ -133,54 +120,52 @@ function Row({<span className="git-time">{rowRange(row)}</span><span className="git-id">{message.label ?? message.id}</span><span className="git-title">{message.title}</span>- <span className="git-details">- {row.tags.length > 0 ? (- <span className="git-tags">- {row.tags.map((tag) => (- // A span, not a button: the whole row is already a button.- <span- key={tag.hash}- className={`git-tag${tag.missing ? " is-missing" : ""}`}- title={- tag.missing- ? `commit ${tag.short} is not in this repository`- : `${tag.short} ${tag.subject ?? ""}`- }- onClick={(event: MouseEvent) => {- event.stopPropagation();- onSelect(row);- }}- >- {tag.short}- </span>- ))}- </span>- ) : null}- {message.change ? (- <span- className="git-change"- title={`The commits linked to this message changed ${message.change.added} lines added, ${message.change.removed} removed${read ? " (read)" : ""}`}- >- {formatChange(message.change)}- </span>- ) : null}- {message.continues ? (- <span- className="git-continues"- title={`Open ${message.continues.sessionTitle} at ${message.continues.label ?? message.continues.id}`}- onClick={(event: MouseEvent) => {- event.stopPropagation();- onContinue(message.continues as NonNullable<ViewNode["continues"]>);- }}- >- ↑ continues {message.continues.sessionTitle} ·{" "}- {message.continues.label ?? message.continues.id}- </span>- ) : null}- {returnMark(row)}- {row.head ? <span className="left-off">left off here</span> : null}- {message.unsummarized ? <span className="unsummarized">not summarized yet</span> : null}- </span>+ {row.tags.length > 0 ? (+ <span className="git-tags">+ {row.tags.map((tag) => (+ // A span, not a button: the whole row is already a button.+ <span+ key={tag.hash}+ className={`git-tag${tag.missing ? " is-missing" : ""}`}+ title={+ tag.missing+ ? `commit ${tag.short} is not in this repository`+ : `${tag.short} ${tag.subject ?? ""}`+ }+ onClick={(event: MouseEvent) => {+ event.stopPropagation();+ onSelect(row);+ }}+ >+ {tag.short}+ </span>+ ))}+ </span>+ ) : null}+ {message.change ? (+ <span+ className="git-change"+ title={`The commits linked to this message changed ${message.change.added} lines added, ${message.change.removed} removed${read ? " (read)" : ""}`}+ >+ {formatChange(message.change)}+ </span>+ ) : null}+ {message.continues ? (+ <span+ className="git-continues"+ title={`Open ${message.continues.sessionTitle} at ${message.continues.label ?? message.continues.id}`}+ onClick={(event: MouseEvent) => {+ event.stopPropagation();+ onContinue(message.continues as NonNullable<ViewNode["continues"]>);+ }}+ >+ ↑ continues {message.continues.sessionTitle} ·{" "}+ {message.continues.label ?? message.continues.id}+ </span>+ ) : null}+ {returnMark(row)}+ {row.head ? <span className="left-off">left off here</span> : null}+ {message.unsummarized ? <span className="unsummarized">not summarized yet</span> : null}</button>);}@@ -226,10 +211,7 @@ export function GitGraph({}, [git.segments]);return (- <div- className={git.columns ? "git-graph in-columns" : "git-graph"}- style={{ width: git.width, height: git.height }}- >+ <div className="git-graph" style={{ width: git.width, height: git.height }}><svgclassName="git-lanes"width={git.graphWidth}@@ -309,10 +291,7 @@ export function GitGraph({);})}</svg>- <div- className="git-rows"- style={{ left: git.graphWidth + 8, width: git.rowWidth, ...columnVars(git.columns) }}- >+ <div className="git-rows" style={{ left: git.graphWidth + 8, width: git.rowWidth }}>{git.rows.map((row) => {const messageId = row.kind === "message" ? row.message.id : null;return (diff --git a/packages/template/src/Graph.tsx b/packages/template/src/Graph.tsxindex b25db9a..6bbdebd 100644--- a/packages/template/src/Graph.tsx+++ b/packages/template/src/Graph.tsx@@ -14,15 +14,15 @@ import { createContext, useCallback, useContext, useEffect, useMemo, useState }import { unreadViewMessages } from "../../cli/src/view/change.js";import type { LineageViewModel, ViewSession } from "../../cli/src/view/model.js";import { hitMessageIds, hitSessionIds } from "../../cli/src/view/search.js";-import { COLUMN_HEAD, ColumnHead, loadColumns, saveColumns } from "./ColumnHead.js";import { pageToken, saveRead } from "./data.js";import { type FilesTarget, FilesView } from "./FilesView.js";import { useFullscreen } from "./fullscreen.js";import { GitGraph } from "./GitGraph.js";-import { type GitLayout, layoutGitGraph, type RowColumns } from "./gitLayout.js";+import { type GitLayout, layoutGitGraph } from "./gitLayout.js";import { centreViewport, headOf, type MapPoint } from "./graph.js";import type { MapSearchState } from "./MapSearch.js";import { Outline, type OutlineTarget } from "./Outline.js";+import { loadRowWidth, RowEdge, saveRowWidth } from "./RowEdge.js";import { OPEN_LINK_DROP, SessionMap } from "./SessionMap.js";import { DrillDown, type Selection } from "./SidePanel.js";import { usePageWheel } from "./scroll.js";@@ -55,8 +55,8 @@ const GraphActions = createContext<{openNode: (sessionId: string, messageId: string, branchId?: string) => void;openContinue: (sessionId: string, messageId: string) => void;unfold: (segmentId: string) => void;- /** Sets the message rows' column widths (the column head's handles). */- resizeColumns: (columns: RowColumns) => void;+ /** Sets the width of the open sessions' message rows (their right edge). */+ resizeRows: (width: number) => void;}>({selection: null,openIds: new Set(),@@ -66,7 +66,7 @@ const GraphActions = createContext<{openNode: () => {},openContinue: () => {},unfold: () => {},- resizeColumns: () => {},+ resizeRows: () => {},});/** An opened session: its message graph and where it sits on the canvas. */@@ -97,14 +97,13 @@ function SessionMessages({highlights: ReadonlySet<string> | undefined;activeHitId: string | null;}) {- const { selection, readIds, bigChangeLines, openNode, openContinue, unfold, resizeColumns } =+ const { selection, readIds, bigChangeLines, openNode, openContinue, unfold, resizeRows } =useContext(GraphActions);const own = selection?.sessionId === session.sessionId;if (git.rows.length === 0)return <p className="graph-status empty">No messages recorded in this session yet.</p>;return (- <>- <ColumnHead git={git} onResize={resizeColumns} />+ <div className="session-rows"><GitGraphgit={git}selectedId={selection?.type === "node" && own ? selection.nodeId : null}@@ -117,7 +116,8 @@ function SessionMessages({onUnfold={unfold}onContinue={(continues) => openContinue(continues.sessionId, continues.id)}/>- </>+ <RowEdge git={git} onResize={resizeRows} />+ </div>);}@@ -234,9 +234,9 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchStareturn { type: "node", sessionId: initial.sessionId, nodeId: initial.messageId };});const [unfolded, setUnfolded] = useState<Set<string>>(() => new Set());- /** Message rows' column widths; the same for every session, kept in this browser. */- const [columns, setColumns] = useState<RowColumns>(loadColumns);- useEffect(() => saveColumns(columns), [columns]);+ /** Width of the open sessions' message rows; dragged at their right edge. */+ const [rowWidth, setRowWidth] = useState(loadRowWidth);+ useEffect(() => saveRowWidth(rowWidth), [rowWidth]);const [openAll, setOpenAll] = useState(false);const [showOutline, setShowOutline] = useState(true);// The files, unread and outline views share the left column; only one shows.@@ -347,7 +347,7 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchStalet options = {unfolded,openAll,- columns,+ rowWidth,headId: head?.sessionId === sessionId ? head.messageId : null,};// A search hit inside a folded branch must be visible to be highlighted,@@ -383,7 +383,7 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchStaopenIds,unfolded,openAll,- columns,+ rowWidth,highlights,head?.sessionId,head?.messageId,@@ -397,7 +397,7 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchStafor (const [sessionId, git] of messageGits)out.set(sessionId,- OPEN_TOP + (git.rows.length === 0 ? OPEN_EMPTY : COLUMN_HEAD + git.height) + OPEN_BOTTOM,+ OPEN_TOP + (git.rows.length === 0 ? OPEN_EMPTY : git.height) + OPEN_BOTTOM,);return out;}, [messageGits]);@@ -433,7 +433,7 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchSta// Frame the whole row (lanes and text), not only its dot.return {x: opening.left + opening.git.graphWidth / 2,- y: opening.top + COLUMN_HEAD + row.y,+ y: opening.top + row.y,left: opening.left,right: opening.left + opening.git.width,};@@ -591,7 +591,7 @@ function Flow({ model, search }: { model: LineageViewModel; search: MapSearchStaopenNode,openContinue,unfold,- resizeColumns: setColumns,+ resizeRows: setRowWidth,}),[selection, openIds, readIds, bigChangeLines, toggleSession, openNode, openContinue, unfold],);diff --git a/packages/template/src/RowEdge.tsx b/packages/template/src/RowEdge.tsxnew file mode 100644index 0000000..34f0b7b--- /dev/null+++ b/packages/template/src/RowEdge.tsx@@ -0,0 +1,76 @@+import { useStore } from "@xyflow/react";+import { type PointerEvent, useState } from "react";+import { clampRowWidth, type GitLayout, ROW_WIDTH } from "./gitLayout.js";++/**+ * The right edge of an open session's message rows: drag it to make the rows+ * wider or narrower, double-click it to reset. Titles get the room and wrap+ * into fewer lines. The width is the same for every session and stays in this+ * browser.+ */++const KEY = "cogit.mapRowWidth";+/** The grab area stays this wide on screen whatever the zoom. */+const GRAB = 12;++export function loadRowWidth(): number {+ try {+ const raw = window.localStorage.getItem(KEY);+ return raw === null ? ROW_WIDTH : clampRowWidth(Number(raw));+ } catch {+ return ROW_WIDTH;+ }+}++export function saveRowWidth(width: number): void {+ try {+ window.localStorage.setItem(KEY, String(width));+ } catch {+ // Private window or blocked storage: the width lasts until the page closes.+ }+}++/** Keeps the drag on the edge when the pointer leaves it; best effort. */+function capture(event: PointerEvent, on: boolean): void {+ try {+ if (on) event.currentTarget.setPointerCapture(event.pointerId);+ else event.currentTarget.releasePointerCapture(event.pointerId);+ } catch {+ // The pointer is gone already; the drag still ends on pointerup.+ }+}++export function RowEdge({ git, onResize }: { git: GitLayout; onResize: (width: number) => void }) {+ // The canvas may be zoomed: a screen pixel is 1/zoom of a canvas pixel.+ const zoom = useStore((state) => state.transform[2]) || 1;+ const [start, setStart] = useState<{ x: number; width: number } | null>(null);+ const grab = GRAB / zoom;+ return (+ <span+ className={`row-edge nodrag nopan${start ? " is-dragging" : ""}`}+ role="separator"+ aria-orientation="vertical"+ aria-label="Resize the message rows"+ title="Drag to make the rows wider or narrower · double-click to reset"+ style={{ left: git.width - grab / 2, width: grab, height: git.height }}+ onPointerDown={(event: PointerEvent) => {+ event.stopPropagation();+ capture(event, true);+ setStart({ x: event.clientX, width: git.rowWidth });+ }}+ onPointerMove={(event: PointerEvent) => {+ if (!start) return;+ onResize(clampRowWidth(start.width + (event.clientX - start.x) / zoom));+ }}+ onPointerUp={(event: PointerEvent) => {+ if (!start) return;+ capture(event, false);+ setStart(null);+ }}+ onDoubleClick={(event) => {+ event.stopPropagation();+ onResize(ROW_WIDTH);+ }}+ />+ );+}diff --git a/packages/template/src/gitLayout.ts b/packages/template/src/gitLayout.tsindex d977138..854da54 100644--- a/packages/template/src/gitLayout.ts+++ b/packages/template/src/gitLayout.ts@@ -64,39 +64,14 @@ const ROW_GAP = 8;*/export const TITLE_MIN_WIDTH = 180;-/**- * Widths of a message row's resizable columns (px): the time, the title and- * the details after it (commits, changed lines, marks). The user drags them in- * the column head; the message number keeps its own narrow column.- */-export interface RowColumns {- time: number;- title: number;- details: number;-}--export const DEFAULT_COLUMNS: RowColumns = { time: 74, title: 260, details: 150 };-export const COLUMN_MIN: RowColumns = { time: 40, title: TITLE_MIN_WIDTH, details: 60 };-export const COLUMN_MAX = 1200;-/** The message number column, the gap between columns and the row's padding. */-export const ID_COLUMN = 36;-const COLUMN_GAP = 8;-const COLUMN_PAD = 16;--/** Row text width the columns add up to. */-export function columnsWidth(columns: RowColumns): number {- return COLUMN_PAD + columns.time + ID_COLUMN + columns.title + columns.details + 3 * COLUMN_GAP;-}--/** Keeps every column between its minimum and `COLUMN_MAX`; junk falls back to the default. */-export function clampColumns(value: unknown): RowColumns {- const raw = (typeof value === "object" && value !== null ? value : {}) as Record<string, unknown>;- const pick = (key: keyof RowColumns): number => {- const n = raw[key];- if (typeof n !== "number" || !Number.isFinite(n)) return DEFAULT_COLUMNS[key];- return Math.round(Math.min(COLUMN_MAX, Math.max(COLUMN_MIN[key], n)));- };- return { time: pick("time"), title: pick("title"), details: pick("details") };+/** How far the user may drag an open session's message rows narrower or wider. */+export const ROW_WIDTH_MIN = 360;+export const ROW_WIDTH_MAX = 1600;++/** A dragged or stored row width, kept in range; junk falls back to `ROW_WIDTH`. */+export function clampRowWidth(value: unknown): number {+ if (typeof value !== "number" || !Number.isFinite(value)) return ROW_WIDTH;+ return Math.round(Math.min(ROW_WIDTH_MAX, Math.max(ROW_WIDTH_MIN, value)));}/** How many lane colours the page defines (`--l0` … `--l5`). */@@ -236,8 +211,6 @@ export interface GitLayout {graphWidth: number;/** Width of the row text right of the dots. */rowWidth: number;- /** The column widths the rows were laid out with, if any. */- columns?: RowColumns;/** Whole box: graph width, gap, then the row text. */width: number;height: number;@@ -265,11 +238,6 @@ export interface GitLayoutOptions {itemEnd?: (item: GitNode) => number | null;/** Width of the row text area; defaults to `ROW_WIDTH`. */rowWidth?: number;- /**- * Message rows laid out in resizable columns: the title wraps inside its own- * column and the details wrap inside theirs. Replaces `rowWidth`.- */- columns?: RowColumns;/*** Extra height to leave below an item's row, by item id: the project map opens* a session in place by reserving room for its messages under the session's@@ -304,45 +272,6 @@ const TAG_LINE = 18;/** Padding, the time column and the gaps around it. */const ROW_FIXED = 106;-/** The things in a row's details column, as rough widths in px. */-export interface RowDetails {- tags: number;- change: boolean;- continues: string | null;- returns: number;- head: boolean;- unsummarized: boolean;-}--const DETAIL_LINE = 18;--/**- * Height of a message row laid out in columns: the title wraps in its column,- * the details wrap in theirs, and the taller of the two decides.- */-export function columnRowHeight(title: string, details: RowDetails, columns: RowColumns): number {- const titleLines = Math.max(1, Math.ceil((title.length * TITLE_CHAR) / columns.title));- const widths = [- ...Array.from({ length: details.tags }, () => TAG_WIDTH),- ...(details.change ? [120] : []),- ...(details.continues === null ? [] : [150 + details.continues.length * 6.4]),- ...Array.from({ length: details.returns }, () => 44),- ...(details.head ? [92] : []),- ...(details.unsummarized ? [116] : []),- ];- let lines = 0;- let used = columns.details;- for (const wanted of widths) {- const width = Math.min(wanted, columns.details);- if (used + width > columns.details) {- lines += 1;- used = 0;- }- used += width + 4;- }- return Math.max(ROW_HEIGHT, 12 + Math.max(titleLines * TITLE_LINE, lines * DETAIL_LINE));-}-/*** Height of a message row whose title (and branch label) wrap instead of being* cut with an ellipsis: the width left for the title after the fixed parts of@@ -396,8 +325,7 @@ function branchOf(ids: string[], byId: Map<string, GitNode>): GitBranch {}export function layoutGitGraph(messages: GitNode[], options: GitLayoutOptions = {}): GitLayout {- const columns = options.columns;- const rowWidth = columns ? columnsWidth(columns) : (options.rowWidth ?? ROW_WIDTH);+ const rowWidth = options.rowWidth ?? ROW_WIDTH;const index = new Map(messages.map((message, at) => [message.id, at]));const byId = new Map(messages.map((message) => [message.id, message]));const kids = new Map<string | null, string[]>();@@ -517,31 +445,17 @@ export function layoutGitGraph(messages: GitNode[], options: GitLayoutOptions =row.segment.ids[0] === row.id;if (row.gap) cursor += ROOT_GAP;const message = row.kind === "message" ? byId.get(row.id ?? "") : undefined;- const returns = message ? (message.links ?? []).filter((id) => segOf.has(id)).length : 0;- row.height = !message- ? ROW_HEIGHT- : columns- ? columnRowHeight(- message.title,- {- tags: tagsOf(message).length,- change: message.change !== undefined,- continues: message.continues?.sessionTitle ?? null,- returns,- head: message.id === headId,- unsummarized: message.unsummarized === true,- },- columns,- )- : rowHeight(- message,- {- returns,- tags: tagsOf(message).length,- head: message.id === headId,- },- rowWidth,- );+ row.height = message+ ? rowHeight(+ message,+ {+ returns: (message.links ?? []).filter((id) => segOf.has(id)).length,+ tags: tagsOf(message).length,+ head: message.id === headId,+ },+ rowWidth,+ )+ : ROW_HEIGHT;row.y = cursor + row.height / 2;cursor += row.height;const space = row.kind === "message" ? options.spaceAfter?.get(row.id ?? "") : undefined;@@ -659,7 +573,6 @@ export function layoutGitGraph(messages: GitNode[], options: GitLayoutOptions =laneX,graphWidth,rowWidth,- ...(columns ? { columns } : {}),width: graphWidth + ROW_GAP + rowWidth,height: cursor,headId,diff --git a/packages/template/src/styles.css b/packages/template/src/styles.cssindex 29fb4d9..cef02bf 100644--- a/packages/template/src/styles.css+++ b/packages/template/src/styles.css@@ -2185,100 +2185,6 @@ time {background: var(--hover);}-/* Outside columns the details are part of the row's flex line, as before. */-.git-details {- display: contents;-}--/* Message rows in resizable columns: time, number, title, details. The widths- come from `--col-*`, set by `columnVars` from the column head's handles. */-.in-columns .git-row {- display: grid;- grid-template-columns: var(--col-time) var(--col-id) var(--col-title) var(--col-details);- column-gap: 8px;-}--.in-columns .git-time {- width: auto;-}--.in-columns .git-title {- min-width: 0;-}--.in-columns .git-more .git-title {- grid-column: 1 / -1;-}--.in-columns .git-details {- display: flex;- flex-wrap: wrap;- align-items: center;- gap: 2px 4px;- min-width: 0;-}--.in-columns .git-tags {- justify-content: flex-start;- max-width: none;-}--.in-columns .git-continues {- max-width: 100%;-}--.in-columns .left-off,-.in-columns .unsummarized {- margin-top: 0;-}--.column-head {- display: grid;- grid-template-columns: var(--col-time) var(--col-id) var(--col-title) var(--col-details);- column-gap: 8px;- height: 22px;- padding: 0 8px;- color: var(--muted);- font-size: 10px;- font-weight: 600;- letter-spacing: 0.04em;- text-transform: uppercase;- border-bottom: 1px solid var(--line);- align-items: center;-}--.column-name {- position: relative;- white-space: nowrap;-}--/* A thin bar on the column's right edge, inside the 8px gap; wider to grab. */-.column-handle {- position: absolute;- top: -4px;- right: -8px;- width: 8px;- height: 22px;- cursor: col-resize;- touch-action: none;-}--.column-handle::after {- content: "";- position: absolute;- top: 4px;- bottom: 4px;- left: 3px;- width: 2px;- border-radius: 1px;- background: var(--line);-}--.column-handle:hover::after,-.column-handle.is-dragging::after {- background: var(--accent);-}-.git-row.in-branch {background: color-mix(in srgb, var(--accent) 6%, transparent);}@@ -2504,6 +2410,35 @@ time {position: absolute;}+.session-rows {+ position: relative;+}++/* The rows' right edge (RowEdge.tsx): a faint line that lights up to grab. */+.row-edge {+ position: absolute;+ top: 0;+ cursor: col-resize;+ touch-action: none;+}++.row-edge::after {+ content: "";+ position: absolute;+ top: 0;+ bottom: 0;+ left: 50%;+ width: 1px;+ background: var(--line);+}++.row-edge:hover::after,+.row-edge.is-dragging::after {+ width: 3px;+ margin-left: -1px;+ background: var(--accent);+}+.session-toggle {flex: none;width: 10px;diff --git a/packages/template/test/columns.test.ts b/packages/template/test/columns.test.tsdeleted file mode 100644index b591154..0000000--- a/packages/template/test/columns.test.ts+++ /dev/null@@ -1,164 +0,0 @@-import { ReactFlowProvider } from "@xyflow/react";-import { createElement } from "react";-import { renderToStaticMarkup } from "react-dom/server";-import { afterEach, describe, expect, it, vi } from "vitest";-import type { ViewNode } from "../../cli/src/view/model.js";-import { COLUMN_HEAD, ColumnHead, loadColumns, saveColumns } from "../src/ColumnHead.js";-import { columnVars, GitGraph } from "../src/GitGraph.js";-import {- COLUMN_MAX,- COLUMN_MIN,- clampColumns,- columnRowHeight,- columnsWidth,- DEFAULT_COLUMNS,- ID_COLUMN,- layoutGitGraph,- ROW_HEIGHT,-} from "../src/gitLayout.js";--const T0 = "2026-10-26T10:00:00.000Z";-const node = (id: string, parent: string | null, extra: Partial<ViewNode> = {}): ViewNode => ({- id,- kind: "message",- title: `Message ${id}`,- at: T0,- parent,- ...extra,-});-const none = {- tags: 0,- change: false,- continues: null,- returns: 0,- head: false,- unsummarized: false,-};--describe("resizable message columns", () => {- it("clamps each column and falls back to the default for junk", () => {- expect(clampColumns({ time: 1, title: 99_999, details: 120.6 })).toEqual({- time: COLUMN_MIN.time,- title: COLUMN_MAX,- details: 121,- });- expect(clampColumns({ time: "wide", title: Number.NaN })).toEqual(DEFAULT_COLUMNS);- expect(clampColumns(null)).toEqual(DEFAULT_COLUMNS);- });-- it("adds the columns, the number column, the gaps and the padding up to the row width", () => {- const columns = { time: 70, title: 300, details: 100 };- expect(columnsWidth(columns)).toBe(16 + 70 + ID_COLUMN + 300 + 100 + 3 * 8);- const git = layoutGitGraph([node("a", null)], { columns });- expect(git.columns).toEqual(columns);- expect(git.rowWidth).toBe(columnsWidth(columns));- expect(layoutGitGraph([node("a", null)]).columns).toBeUndefined();- });-- it("wraps the title in its own column: a wider column needs fewer lines", () => {- const title = "a".repeat(120);- const narrow = columnRowHeight(title, none, { ...DEFAULT_COLUMNS, title: 200 });- const wide = columnRowHeight(title, none, { ...DEFAULT_COLUMNS, title: 800 });- expect(narrow).toBeGreaterThan(wide);- expect(wide).toBe(ROW_HEIGHT);- });-- it("wraps the details in theirs: chips past the column's width start a new line", () => {- const busy = {- tags: 3,- change: true,- continues: "An earlier session",- returns: 1,- head: true,- unsummarized: true,- };- const short = "Short";- const narrow = columnRowHeight(short, busy, { ...DEFAULT_COLUMNS, details: 80 });- const wide = columnRowHeight(short, busy, { ...DEFAULT_COLUMNS, details: 1200 });- expect(narrow).toBeGreaterThan(wide);- expect(columnRowHeight(short, none, DEFAULT_COLUMNS)).toBe(ROW_HEIGHT);- });-- it("lays rows out with the column heights and draws them as a grid", () => {- const git = layoutGitGraph(- [node("a", null, { title: "b".repeat(200) }), node("b", "a", { unsummarized: true })],- { columns: DEFAULT_COLUMNS },- );- expect(git.rows[0]?.height).toBeGreaterThan(ROW_HEIGHT);- const html = renderToStaticMarkup(- createElement(GitGraph, {- git,- selectedId: null,- activeSegmentId: null,- highlightIds: undefined,- activeHitId: null,- readIds: new Set<string>(),- bigChangeLines: 300,- onSelect: () => {},- onUnfold: () => {},- onContinue: () => {},- }),- );- expect(html).toContain('class="git-graph in-columns"');- expect(html).toContain("--col-title:260px");- expect(html).toMatch(/<span class="git-details">.*not summarized yet/);- expect(columnVars(undefined)).toEqual({});- });-- it("heads the columns with a resize handle on time, message and details", () => {- const git = layoutGitGraph([node("a", null)], { columns: DEFAULT_COLUMNS });- const html = renderToStaticMarkup(- createElement(- ReactFlowProvider,- null,- createElement(ColumnHead, { git, onResize: () => {} }),- ),- );- expect(html).toContain("Time");- expect(html).toContain("Commits · changes");- expect(html.match(/role="separator"/g)).toHaveLength(3);- expect(COLUMN_HEAD).toBe(22);- const plain = layoutGitGraph([node("a", null)]);- expect(- renderToStaticMarkup(- createElement(- ReactFlowProvider,- null,- createElement(ColumnHead, { git: plain, onResize: () => {} }),- ),- ),- ).toBe("");- });-});--describe("column widths in the browser", () => {- afterEach(() => vi.unstubAllGlobals());-- it("keeps the widths and reads junk or a blocked storage as the default", () => {- const store = new Map<string, string>();- vi.stubGlobal("window", {- localStorage: {- getItem: (key: string) => store.get(key) ?? null,- setItem: (key: string, value: string) => store.set(key, value),- },- });- expect(loadColumns()).toEqual(DEFAULT_COLUMNS);- saveColumns({ time: 60, title: 400, details: 90 });- expect(loadColumns()).toEqual({ time: 60, title: 400, details: 90 });- store.set("cogit.mapColumns", "{not json");- expect(loadColumns()).toEqual(DEFAULT_COLUMNS);-- vi.stubGlobal("window", {- localStorage: {- getItem: () => {- throw new Error("blocked");- },- setItem: () => {- throw new Error("blocked");- },- },- });- expect(loadColumns()).toEqual(DEFAULT_COLUMNS);- expect(() => saveColumns(DEFAULT_COLUMNS)).not.toThrow();- });-});diff --git a/packages/template/test/rowEdge.test.ts b/packages/template/test/rowEdge.test.tsnew file mode 100644index 0000000..0b328a5--- /dev/null+++ b/packages/template/test/rowEdge.test.ts@@ -0,0 +1,66 @@+import { ReactFlowProvider } from "@xyflow/react";+import { createElement } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import { afterEach, describe, expect, it, vi } from "vitest";+import {+ clampRowWidth,+ layoutGitGraph,+ ROW_WIDTH,+ ROW_WIDTH_MAX,+ ROW_WIDTH_MIN,+} from "../src/gitLayout.js";+import { loadRowWidth, RowEdge, saveRowWidth } from "../src/RowEdge.js";++const T0 = "2026-10-26T10:00:00.000Z";++describe("dragging the message rows wider", () => {+ afterEach(() => vi.unstubAllGlobals());++ it("keeps a dragged width in range and reads junk as the default", () => {+ expect(clampRowWidth(10)).toBe(ROW_WIDTH_MIN);+ expect(clampRowWidth(99_999)).toBe(ROW_WIDTH_MAX);+ expect(clampRowWidth(700.4)).toBe(700);+ expect(clampRowWidth(Number.NaN)).toBe(ROW_WIDTH);+ expect(clampRowWidth("wide")).toBe(ROW_WIDTH);+ });++ it("puts a full-height grab strip on the rows' right edge", () => {+ const git = layoutGitGraph(+ [{ id: "a", kind: "message", title: "A message", at: T0, parent: null }],+ { rowWidth: 700 },+ );+ const html = renderToStaticMarkup(+ createElement(ReactFlowProvider, null, createElement(RowEdge, { git, onResize: () => {} })),+ );+ expect(html).toContain('role="separator"');+ // At zoom 1 the strip is 12px wide, centred on the edge.+ expect(html).toContain(`left:${git.width - 6}px`);+ expect(html).toContain(`height:${git.height}px`);+ });++ it("remembers the width, and reads a blocked or empty storage as the default", () => {+ const store = new Map<string, string>();+ vi.stubGlobal("window", {+ localStorage: {+ getItem: (key: string) => store.get(key) ?? null,+ setItem: (key: string, value: string) => store.set(key, value),+ },+ });+ expect(loadRowWidth()).toBe(ROW_WIDTH);+ saveRowWidth(840);+ expect(loadRowWidth()).toBe(840);++ vi.stubGlobal("window", {+ localStorage: {+ getItem: () => {+ throw new Error("blocked");+ },+ setItem: () => {+ throw new Error("blocked");+ },+ },+ });+ expect(loadRowWidth()).toBe(ROW_WIDTH);+ expect(() => saveRowWidth(600)).not.toThrow();+ });+});