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(map): move the project switcher under the path and open a map from its card

Eren2294655d230f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2785ae1..3d94ba8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- The panel uses the map's centred 8-of-12 column, and every page names the product: "cogit" with its slogan "Cogito, ergo commit." opens the top bar, and on a served map it leads back to the panel.
+- A calmer map head: the top bar holds only "cogit", the search and Settings; the project switcher (recent projects and Ctrl/Cmd+K, its button now "Switch project") sits under the project's name and path. On the panel a click anywhere on a project's card opens its map.
- A project's map has a visible "← All projects" link above its name, and opening the map, "Left off here", a search step or a file click frame the whole message row (lanes and text) in the middle of the map instead of only its dot, so the message no longer sits off to the right; a row wider than the map starts at its left edge.
### Fixed
diff --git a/packages/template/src/App.tsx b/packages/template/src/App.tsx
index e0bba3a..272626c 100644
--- a/packages/template/src/App.tsx
+++ b/packages/template/src/App.tsx
@@ -55,9 +55,16 @@ export function App({ model }: { model: LineageViewModel }) {
<div className="page-head">
<div className="page-bar">
<Brand />
- <ProjectSwitcher model={model} />
- <SearchBox value={query} state={search} onQuery={change} onStep={move} onClear={clear} />
- <SettingsButton settings={model.settings} />
+ <div className="page-bar-actions">
+ <SearchBox
+ value={query}
+ state={search}
+ onQuery={change}
+ onStep={move}
+ onClear={clear}
+ />
+ <SettingsButton settings={model.settings} />
+ </div>
</div>
<header className="project">
@@ -65,6 +72,7 @@ export function App({ model }: { model: LineageViewModel }) {
<BackToPanel />
<h1>{model.project.name}</h1>
<p className="muted">{model.project.path}</p>
+ <ProjectSwitcher model={model} />
</div>
<div className="meta">
<span>
diff --git a/packages/template/src/Panel.tsx b/packages/template/src/Panel.tsx
index 9768167..1a31cbe 100644
--- a/packages/template/src/Panel.tsx
+++ b/packages/template/src/Panel.tsx
@@ -59,7 +59,9 @@ export function Panel({ model }: { model: PanelViewModel }) {
</div>
</dl>
{href ? (
- <a href={href}>Open the map →</a>
+ <a className="card-open" href={href}>
+ Open the map →
+ </a>
) : (
<p className="empty">Directory not found.</p>
)}
diff --git a/packages/template/src/ProjectSwitcher.tsx b/packages/template/src/ProjectSwitcher.tsx
index 996b911..d20594c 100644
--- a/packages/template/src/ProjectSwitcher.tsx
+++ b/packages/template/src/ProjectSwitcher.tsx
@@ -104,7 +104,7 @@ export function ProjectSwitcher({ model }: { model: LineageViewModel }) {
}}
aria-haspopup="dialog"
>
- All projects <kbd>{shortcutLabel()}</kbd>
+ Switch project <kbd>{shortcutLabel()}</kbd>
</button>
</nav>
diff --git a/packages/template/src/styles.css b/packages/template/src/styles.css
index 3832bc8..71b94cb 100644
--- a/packages/template/src/styles.css
+++ b/packages/template/src/styles.css
@@ -233,9 +233,17 @@ main.map-page {
gap: 12px;
}
-.page-bar .switcher {
- flex: 1 1 auto;
- min-width: 0;
+.page-bar-actions {
+ display: flex;
+ flex: none;
+ align-items: flex-start;
+ gap: 12px;
+}
+
+/* Under the project's name and path: recent projects and Ctrl/Cmd+K. */
+.project .switcher {
+ margin-top: 10px;
+ margin-bottom: 0;
}
/* Map search (Story 8.14): in the page head, beside the project switcher. */
@@ -1322,6 +1330,23 @@ time {
color: var(--accent);
}
+/* The whole card opens the map: the link stretches over it. */
+.card {
+ position: relative;
+}
+
+.card a.card-open::after {
+ position: absolute;
+ inset: 0;
+ border-radius: 10px;
+ content: "";
+}
+
+.card:has(a.card-open):hover {
+ border-color: var(--accent);
+ cursor: pointer;
+}
+
.settings {
padding: 16px;
background: var(--panel);
diff --git a/packages/template/test/panel.test.ts b/packages/template/test/panel.test.ts
index 7f7b32b..dd2323d 100644
--- a/packages/template/test/panel.test.ts
+++ b/packages/template/test/panel.test.ts
@@ -1,6 +1,6 @@
import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
-import { describe, expect, it } from "vitest";
+import { afterEach, describe, expect, it } from "vitest";
import type { PanelViewModel } from "../../cli/src/view/model.js";
import { Panel } from "../src/Panel.js";
@@ -35,3 +35,26 @@ describe("Panel", () => {
expect(html).toContain('class="brand"');
});
});
+
+describe("Panel cards", () => {
+ afterEach(() => {
+ delete (globalThis as { document?: unknown }).document;
+ });
+
+ it("opens a project's map from anywhere on its card", () => {
+ // A served panel: the live-page meta is there.
+ (globalThis as { document?: unknown }).document = { querySelector: () => ({}) };
+ const project = {
+ name: "cogit",
+ path: "/work/cogit",
+ lineageUrl: "file:///work/cogit/.cogit/map.html",
+ lastActivity: "2026-10-26T10:00:00.000Z",
+ needsUserCount: 0,
+ missing: false,
+ } as PanelViewModel["projects"][number];
+ const html = renderToStaticMarkup(
+ createElement(Panel, { model: { ...model, projects: [project] } }),
+ );
+ expect(html).toContain('<a class="card-open" href="/map?dir=%2Fwork%2Fcogit">');
+ });
+});
diff --git a/specs/codelineage-mvp.md b/specs/cogit-mvp.md
similarity index 100%
rename from specs/codelineage-mvp.md
rename to specs/cogit-mvp.md