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
fix(map): open a session's card from its row
Eren130699e1cbea
diff --git a/docs/guide/map.md b/docs/guide/map.mdindex c355e96..2254d8d 100644--- a/docs/guide/map.md+++ b/docs/guide/map.md@@ -142,10 +142,11 @@ session with nothing open costs no model call.Each drafted item waits in **To review** until you choose: **Accept** keeps it in **Open**,**Dismiss** closes it without doing it. An open item is closed with **Done**. The last tenclosed items stay under **Done (last 10)**. An item belongs to the whole session it came from,-not to one message. The session's own row carries the number of items it stands for — a button,-whether the session is expanded or folded — and clicking it opens that session's card, where the-items are listed under **Captured work** with their state and age — read-only, so a stray click-cannot close work; accepting, dismissing and closing stay in the Captured list. An item's source+not to one message. Clicking a session's row opens that session's card; the row also carries the+number of items the session stands for, whether it is expanded or folded. The arrow at the left+of the row is the one that opens and folds the session's messages, so the card never covers+them. The card lists the items under **Captured work** with their state and age — read-only, so+a stray click cannot close work; accepting, dismissing and closing stay in the Captured list. An item's sourceline in the list opens the session's **first message**. A session with no messages anchorsnowhere, and its items show only in the list. The model never reopens or rewrites anitem you already saw; closing is your act. In the terminal: `cogit captures`,diff --git a/packages/template/src/SessionMap.tsx b/packages/template/src/SessionMap.tsxindex 81c9184..c20ea5c 100644--- a/packages/template/src/SessionMap.tsx+++ b/packages/template/src/SessionMap.tsx@@ -45,8 +45,9 @@ function SessionRow({searchHit: boolean;/** Suggested + open captured items the session stands for (Story 15.3). */captured?: number | undefined;+ /** Opens or folds the session's messages (the arrow on the left). */onOpen: (sessionId: string) => void;- /** Opens the session's card, with its Captured work in view (the capture badge). */+ /** Opens the session's card (a click anywhere on the row, and the capture badge). */onOpenCard: (sessionId: string) => void;onContinue: (continues: NonNullable<ViewSession["messages"][number]["continues"]>) => void;}) {@@ -66,30 +67,41 @@ function SessionRow({.filter(Boolean).join(" ");return (- // A div, not a button: the row holds the capture badge button (Story 15.3),- // and a button may not nest one.+ // A div, not a button: the row holds the toggle and the capture badge+ // (Story 15.3), and a button may not nest one. The box opens the session's+ // card; the arrow beside it opens the messages.<divrole="button"tabIndex={0}className={className}style={style}- aria-expanded={open}onClick={(event: MouseEvent) => {event.stopPropagation();- onOpen(session.sessionId);+ onOpenCard(session.sessionId);}}onKeyDown={(event) => {- // The badge handles its own keys; only the row's focus reaches here.+ // The toggle and the badge handle their own keys; only the row's own+ // focus reaches here.if (event.target !== event.currentTarget) return;if (event.key !== "Enter" && event.key !== " ") return;event.preventDefault();- onOpen(session.sessionId);+ onOpenCard(session.sessionId);}}title={session.status.goal || session.title}>- <span className="session-toggle" aria-hidden="true">+ <button+ type="button"+ className="session-toggle"+ aria-expanded={open}+ aria-label={open ? "Fold this session's messages" : "Open this session's messages"}+ title={open ? "Fold the messages" : "Open the messages"}+ onClick={(event: MouseEvent) => {+ event.stopPropagation();+ onOpen(session.sessionId);+ }}+ >{open ? "▾" : "▸"}- </span>+ </button><span className="git-time">{session.startedAt ? formatStamp(session.startedAt) : ""}</span><span className="git-title">{session.title || session.sessionId}</span>{badge === undefined ? null : (@@ -158,8 +170,9 @@ export function SessionMap({person?: PersonFilter;/** Suggested + open captured items, by session id (Story 15.3). */captured?: ReadonlyMap<string, number> | undefined;+ /** Opens or folds a session's messages (its arrow). */onOpen: (sessionId: string) => void;- /** Opens the session's card, with its Captured work in view. */+ /** Opens a session's card (its row, or its capture badge). */onOpenCard: (sessionId: string) => void;onContinue: (sessionId: string, messageId: string) => void;}) {diff --git a/packages/template/src/styles.css b/packages/template/src/styles.cssindex 0f317d9..eb96bf3 100644--- a/packages/template/src/styles.css+++ b/packages/template/src/styles.css@@ -2612,9 +2612,20 @@ time {.session-toggle {flex: none;- width: 10px;+ width: 14px;+ padding: 0;+ border: 0;+ background: none;color: var(--muted);+ font: inherit;font-size: 10px;+ line-height: inherit;+ cursor: pointer;+}++.session-toggle:hover,+.session-toggle:focus-visible {+ color: var(--text);}.session-row.is-open {diff --git a/packages/template/test/session-git.test.ts b/packages/template/test/session-git.test.tsindex 49fe5f4..33dbad0 100644--- a/packages/template/test/session-git.test.ts+++ b/packages/template/test/session-git.test.ts@@ -135,13 +135,27 @@ describe("the session row's capture badge (Story 15.3)", () => {expect(render(new Map())).not.toContain("capture-mark");});- it("is a button inside the row, so its click cannot be the row's toggle", () => {+ it("keeps the toggle and the badge as buttons inside the row", () => {const html = render(new Map([["s1", 1]]));- // The row is not a button (a button may not nest one): the badge is the button.+ // The row is not a button (a button may not nest one): its two controls are.expect(html).toMatch(/<div[^>]*class="git-row session-row"[^>]*>/);expect(html).toContain('role="button"');+ expect(html).toMatch(/<button[^>]*class="session-toggle"/);expect(html).toMatch(/<button[^>]*class="capture-mark session-capture"/);- expect(html.match(/<button/g)).toHaveLength(1);+ expect(html.match(/<button/g)).toHaveLength(2);+ });++ it("draws the messages toggle on every session, badge or not", () => {+ // The row opens the card; the toggle beside it is the only way to the messages.+ const html = render(undefined);+ expect(html).toMatch(+ /<button[^>]*class="session-toggle"[^>]*aria-expanded="false"[^>]*aria-label="Open this session/,+ );+ expect(html).not.toContain("capture-mark");+ const folded = render(undefined, new Set(["s1"]));+ expect(folded).toMatch(+ /<button[^>]*class="session-toggle"[^>]*aria-expanded="true"[^>]*aria-label="Fold this session/,+ );});});