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.

fix(view): keep status card, warnings and session headers readable

Erena3eb8094aa28
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa35ba1..6d8f4ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
+### Fixed
+- Status card: goal, done, pending and next now come from the most recently updated session that recorded a status, so a newer session without one no longer blanks the card; last activity still tracks the newest session.
+- `codelineage build` printed each skipped-session warning twice (once for the map, once for the panel); the panel now stays quiet about the project just built.
+- Collapsed session headers in the map show a short date (full time on hover), so the session title is no longer cut off after a few characters.
## [0.4.0] - 2026-10-21
### Added
diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts
index 15bdd4c..7e1ced1 100644
--- a/packages/cli/src/commands/build.ts
+++ b/packages/cli/src/commands/build.ts
@@ -52,7 +52,7 @@ export async function buildProject(opts: BuildOptions): Promise<LineageViewModel
// The panel is derived state: a read-only home or a broken registry warning
// must never turn a successful map build into a failure.
try {
- await buildPanel({ env: io.env, io, templateHtml: template });
+ await buildPanel({ env: io.env, io, templateHtml: template, quietPath: root });
} catch (err) {
io.warn(`could not build panel.html: ${(err as Error).message}`);
}
diff --git a/packages/cli/src/view/lineage.ts b/packages/cli/src/view/lineage.ts
index f91dcac..2619602 100644
--- a/packages/cli/src/view/lineage.ts
+++ b/packages/cli/src/view/lineage.ts
@@ -76,21 +76,27 @@ function byUpdatedAt(a: Session, b: Session): number {
return timestamp(b.updatedAt) - timestamp(a.updatedAt) || a.sessionId.localeCompare(b.sessionId);
}
+function hasStatus(session: Session): boolean {
+ const { goal, done, pending, next } = session.status;
+ return goal !== "" || next !== "" || done.length > 0 || pending.length > 0;
+}
+
/**
* The status card: goal, done, pending and next come from the most recently
- * updated session; `needsUser` items are merged from every other session active
- * within `ACTIVE_WINDOW_DAYS`, newest first and deduplicated by text.
- * `now` is the build time the window is measured against.
+ * updated session that recorded a status, so a newer session without one does not
+ * blank the card; `needsUser` items are merged from every other session active
+ * within `ACTIVE_WINDOW_DAYS`, newest first and deduplicated by text. Last
+ * activity is the newest session overall. `now` is the build time the window is
+ * measured against.
*/
export function statusCard(sessions: Session[], now: string): StatusCard {
- let latest: Session | undefined;
- for (const session of sessions) {
- if (!latest || timestamp(session.updatedAt) > timestamp(latest.updatedAt)) latest = session;
- }
+ const ordered = [...sessions].sort(byUpdatedAt);
+ const newest = ordered[0];
+ const latest = ordered.find(hasStatus);
const pending = (latest?.status.pending ?? []).map((item) => ({ ...item }));
const seen = new Set(pending.map((item) => item.text));
- const others = sessions.filter((session) => session !== latest).sort(byUpdatedAt);
+ const others = ordered.filter((session) => session !== latest);
for (const session of others) {
if (!isActive(session, now)) continue;
for (const item of session.status.pending) {
@@ -105,7 +111,7 @@ export function statusCard(sessions: Session[], now: string): StatusCard {
done: latest?.status.done ?? [],
pending,
next: latest?.status.next ?? "",
- lastActivity: latest?.updatedAt ?? null,
+ lastActivity: newest?.updatedAt ?? null,
};
}
diff --git a/packages/cli/src/view/panel.ts b/packages/cli/src/view/panel.ts
index b6c6d77..90ddcdd 100644
--- a/packages/cli/src/view/panel.ts
+++ b/packages/cli/src/view/panel.ts
@@ -14,6 +14,8 @@ export interface PanelOptions {
io: Io;
/** Replaces the bundled template; tests inject a minimal page. */
templateHtml?: string;
+ /** A project whose session warnings were already printed by the map build. */
+ quietPath?: string;
}
const PANEL_TITLE = "<title>codelineage — panel</title>";
@@ -26,6 +28,7 @@ export async function collectPanelProjects(
entries: RegistryEntry[],
generatedAt: string,
warn: (line: string) => void,
+ quietPath?: string,
): Promise<PanelProject[]> {
const projects: PanelProject[] = [];
for (const entry of entries) {
@@ -41,7 +44,8 @@ export async function collectPanelProjects(
continue;
}
try {
- const card = statusCard(await loadAllSessions(entry.path, warn), generatedAt);
+ const sessionWarn = entry.path === quietPath ? () => {} : warn;
+ const card = statusCard(await loadAllSessions(entry.path, sessionWarn), generatedAt);
projects.push({
name: entry.name,
path: entry.path,
@@ -92,7 +96,7 @@ export async function buildPanel(opts: PanelOptions): Promise<PanelViewModel> {
gitPolicy: config.gitPolicy,
agents: config.agents,
},
- projects: await collectPanelProjects(entries, generatedAt, io.warn),
+ projects: await collectPanelProjects(entries, generatedAt, io.warn, opts.quietPath),
};
// Same safety net as the map: nothing leaves this process unredacted.
diff --git a/packages/cli/test/build.test.ts b/packages/cli/test/build.test.ts
index ec492b5..69e3856 100644
--- a/packages/cli/test/build.test.ts
+++ b/packages/cli/test/build.test.ts
@@ -228,7 +228,11 @@ describe("statusCard", () => {
it("treats unparseable timestamps as inactive instead of merging them", () => {
const sessions = [
- session({ sessionId: "latest", updatedAt: "2026-10-20T00:00:00.000Z" }),
+ session({
+ sessionId: "latest",
+ updatedAt: "2026-10-20T00:00:00.000Z",
+ status: { goal: "goal", done: [], pending: [], next: "" },
+ }),
session({
sessionId: "broken",
updatedAt: "not-a-date",
@@ -238,6 +242,24 @@ describe("statusCard", () => {
expect(statusCard(sessions, NOW).pending).toEqual([]);
expect(statusCard(sessions, "also-broken").pending).toEqual([]);
});
+
+ it("skips a newer session without a status but keeps its time as last activity", () => {
+ const sessions = [
+ session({
+ sessionId: "with-status",
+ updatedAt: "2026-10-20T08:00:00.000Z",
+ status: { goal: "goal", done: ["done"], pending: [], next: "next" },
+ }),
+ session({ sessionId: "bare", updatedAt: "2026-10-20T09:00:00.000Z" }),
+ ];
+ expect(statusCard(sessions, NOW)).toEqual({
+ goal: "goal",
+ done: ["done"],
+ pending: [],
+ next: "next",
+ lastActivity: "2026-10-20T09:00:00.000Z",
+ });
+ });
});
describe("embedViewModel", () => {
@@ -354,6 +376,8 @@ describe("codelineage build", () => {
"redacted 1 secret-looking value(s) in the map",
]),
);
+ // The panel reads the same project again; its warnings must not repeat.
+ expect(io.warnings.filter((line) => line.startsWith("skipping session bad:"))).toHaveLength(1);
expect(model.epochs[0]?.sessions.map((s) => s.sessionId)).toEqual(["s2", "s1", "newer"]);
expect(model.unassigned.map((s) => s.sessionId)).toEqual(["s4", "s3"]);
diff --git a/packages/template/src/Graph.tsx b/packages/template/src/Graph.tsx
index c0e0836..08059ca 100644
--- a/packages/template/src/Graph.tsx
+++ b/packages/template/src/Graph.tsx
@@ -23,7 +23,7 @@ import {
useState,
} from "react";
import type { LineageViewModel } from "../../cli/src/view/model.js";
-import { formatTime } from "./format.js";
+import { formatDate, formatTime } from "./format.js";
import {
defaultExpanded,
type EpochFlowNode,
@@ -101,8 +101,8 @@ function SessionNode({ id, data }: NodeProps<SessionFlowNode>) {
<GroupToggle id={id} data={data} />
<strong className="group-title">{data.title}</strong>
<span className="muted">{data.count}</span>
- <time className="muted" dateTime={data.updatedAt}>
- {formatTime(data.updatedAt)}
+ <time className="muted" dateTime={data.updatedAt} title={formatTime(data.updatedAt)}>
+ {formatDate(data.updatedAt)}
</time>
</div>
</div>
diff --git a/packages/template/src/format.ts b/packages/template/src/format.ts
index fff3812..4b55c13 100644
--- a/packages/template/src/format.ts
+++ b/packages/template/src/format.ts
@@ -4,3 +4,12 @@ export function formatTime(iso: string | null): string {
const date = new Date(iso);
return Number.isNaN(date.getTime()) ? iso : date.toLocaleString();
}
+
+/** A compact date for tight headers; the full time belongs in a tooltip. */
+export function formatDate(iso: string | null): string {
+ if (!iso) return "—";
+ const date = new Date(iso);
+ return Number.isNaN(date.getTime())
+ ? iso
+ : date.toLocaleDateString(undefined, { month: "short", day: "numeric" });
+}
diff --git a/packages/template/src/styles.css b/packages/template/src/styles.css
index ec78e33..c328fdb 100644
--- a/packages/template/src/styles.css
+++ b/packages/template/src/styles.css
@@ -313,12 +313,18 @@ ul {
}
.group-title {
+ flex: 1;
min-width: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
+.group-head .muted {
+ flex: none;
+ white-space: nowrap;
+}
+
.group-toggle {
flex: none;
width: 20px;
diff --git a/packages/template/test/format.test.ts b/packages/template/test/format.test.ts
new file mode 100644
index 0000000..d219fcf
--- /dev/null
+++ b/packages/template/test/format.test.ts
@@ -0,0 +1,21 @@
+import { describe, expect, it } from "vitest";
+import { formatDate, formatTime } from "../src/format.js";
+
+describe("format", () => {
+ it("shows a placeholder for a missing time and an unparseable value as-is", () => {
+ expect(formatTime(null)).toBe("—");
+ expect(formatDate(null)).toBe("—");
+ expect(formatTime("soon")).toBe("soon");
+ expect(formatDate("soon")).toBe("soon");
+ });
+
+ it("renders a short date without the time of day", () => {
+ const iso = "2026-10-21T10:00:00.000Z";
+ const expected = new Date(iso).toLocaleDateString(undefined, {
+ month: "short",
+ day: "numeric",
+ });
+ expect(formatDate(iso)).toBe(expected);
+ expect(formatDate(iso)).not.toContain(":");
+ });
+});