Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b5ca531800 | |||
| 0e38d42cf9 | |||
| af2ad63a18 |
@@ -539,7 +539,20 @@ export default function LaneCard({
|
|||||||
<span className="shrink-0 text-fg-muted">{git.head}</span>
|
<span className="shrink-0 text-fg-muted">{git.head}</span>
|
||||||
<span className="truncate text-fg-muted">{git.subject}</span>
|
<span className="truncate text-fg-muted">{git.subject}</span>
|
||||||
{(git.dirty > 0 || git.untracked > 0) && (
|
{(git.dirty > 0 || git.untracked > 0) && (
|
||||||
<span className="shrink-0 text-status-warning/80">
|
<span
|
||||||
|
className="shrink-0 cursor-help text-status-warning/80"
|
||||||
|
/* Native title: the counts' own file list, capped server-side.
|
||||||
|
A hover card would need a portal to escape this truncating
|
||||||
|
row — the browser's tooltip already escapes it for free. */
|
||||||
|
title={
|
||||||
|
git.files?.length
|
||||||
|
? git.files.join("\n") +
|
||||||
|
(git.dirty + git.untracked > git.files.length
|
||||||
|
? `\n… +${git.dirty + git.untracked - git.files.length}`
|
||||||
|
: "")
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
>
|
||||||
{t("git.uncommitted", { dirty: git.dirty, untracked: git.untracked })}
|
{t("git.uncommitted", { dirty: git.dirty, untracked: git.untracked })}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ describe("LaneCard git block", () => {
|
|||||||
subject: "free-text rule mode in the form",
|
subject: "free-text rule mode in the form",
|
||||||
dirty: 2,
|
dirty: 2,
|
||||||
untracked: 1,
|
untracked: 1,
|
||||||
|
files: [" M server/lib/alerts.js", " M client/src/lib/api.ts", "?? scratch.txt"],
|
||||||
};
|
};
|
||||||
|
|
||||||
it("renders the live branch, head, subject and uncommitted counts", async () => {
|
it("renders the live branch, head, subject and uncommitted counts", async () => {
|
||||||
@@ -218,6 +219,10 @@ describe("LaneCard git block", () => {
|
|||||||
expect(block.textContent).toContain("9b3e74a");
|
expect(block.textContent).toContain("9b3e74a");
|
||||||
expect(block.textContent).toContain("free-text rule mode in the form");
|
expect(block.textContent).toContain("free-text rule mode in the form");
|
||||||
expect(block.textContent).toContain("2");
|
expect(block.textContent).toContain("2");
|
||||||
|
// Hovering the counts names the files behind them.
|
||||||
|
expect(screen.getByText(/modified/).title).toBe(
|
||||||
|
" M server/lib/alerts.js\n M client/src/lib/api.ts\n?? scratch.txt"
|
||||||
|
);
|
||||||
// The live branch replaces the lane's recorded one rather than doubling it.
|
// The live branch replaces the lane's recorded one rather than doubling it.
|
||||||
expect(screen.queryByText(/stale\/recorded/)).toBeNull();
|
expect(screen.queryByText(/stale\/recorded/)).toBeNull();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2592,6 +2592,8 @@ export type LaneGitFacts =
|
|||||||
dirty: number;
|
dirty: number;
|
||||||
/** Files git has never seen. */
|
/** Files git has never seen. */
|
||||||
untracked: number;
|
untracked: number;
|
||||||
|
/** Raw `git status --porcelain` lines, capped; the counts stay exact. */
|
||||||
|
files: string[];
|
||||||
}
|
}
|
||||||
| { available: false };
|
| { available: false };
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
* @file Workspace.tsx
|
* @file Workspace.tsx
|
||||||
* @description Merged workspace page combining lanes (agent work units) and runs
|
* @description Merged workspace page combining lanes (agent work units) and runs
|
||||||
* (CLI spawns: Claude Code or Codex, determined per lane). Displays a horizontal
|
* (CLI spawns: Claude Code or Codex, determined per lane). Displays a horizontal
|
||||||
* lane strip at the top with counters, the selected lane's pipeline map, and run
|
* lane strip at the top (its first tile creates a lane), the selected lane's
|
||||||
* configuration/console/history below. Runs are tied to lanes: starting a run
|
* pipeline map, and run configuration/console/history below. Runs are tied to lanes: starting a run
|
||||||
* posts to POST /api/lanes/:id/start with tool-appropriate fields. When a cwd
|
* posts to POST /api/lanes/:id/start with tool-appropriate fields. When a cwd
|
||||||
* isn't owned by any lane, calls POST /api/lanes/ensure first. Polls GET
|
* isn't owned by any lane, calls POST /api/lanes/ensure first. Polls GET
|
||||||
* /api/sessions?status=active alongside the run list so Claude Code sessions
|
* /api/sessions?status=active alongside the run list so Claude Code sessions
|
||||||
@@ -45,15 +45,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Plus, Square, Columns2, Grid2x2 } from "lucide-react";
|
import { Plus, Square, Columns2, Grid2x2 } from "lucide-react";
|
||||||
import { api } from "../lib/api";
|
import { api } from "../lib/api";
|
||||||
import type { CwdSuggestion, RunListResponse } from "../lib/api";
|
import type { CwdSuggestion, RunListResponse } from "../lib/api";
|
||||||
import type {
|
import type { Lane, LaneFeature, ProofFeature, Session, WSMessage, LaneTool } from "../lib/types";
|
||||||
Lane,
|
|
||||||
LaneFeature,
|
|
||||||
LaneCounts,
|
|
||||||
ProofFeature,
|
|
||||||
Session,
|
|
||||||
WSMessage,
|
|
||||||
LaneTool,
|
|
||||||
} from "../lib/types";
|
|
||||||
import { eventBus } from "../lib/eventBus";
|
import { eventBus } from "../lib/eventBus";
|
||||||
import { keepIfSame } from "../lib/keepIfSame";
|
import { keepIfSame } from "../lib/keepIfSame";
|
||||||
import { LaneConsolePane } from "../components/run/LaneConsolePane";
|
import { LaneConsolePane } from "../components/run/LaneConsolePane";
|
||||||
@@ -203,7 +195,6 @@ export function Workspace() {
|
|||||||
|
|
||||||
// Lane state
|
// Lane state
|
||||||
const [lanes, setLanes] = useState<Lane[]>([]);
|
const [lanes, setLanes] = useState<Lane[]>([]);
|
||||||
const [counts, setCounts] = useState<LaneCounts>({ total: 0, running: 0, needs_you: 0, dead: 0 });
|
|
||||||
const [selectedLaneId, setSelectedLaneId] = useState<number | null>(null);
|
const [selectedLaneId, setSelectedLaneId] = useState<number | null>(null);
|
||||||
const [laneActionError, setLaneActionError] = useState<string | null>(null);
|
const [laneActionError, setLaneActionError] = useState<string | null>(null);
|
||||||
const [addLaneOpen, setAddLaneOpen] = useState(false);
|
const [addLaneOpen, setAddLaneOpen] = useState(false);
|
||||||
@@ -263,7 +254,6 @@ export function Workspace() {
|
|||||||
try {
|
try {
|
||||||
const r = await api.lanes.list();
|
const r = await api.lanes.list();
|
||||||
setLanes(keepIfSame(r.lanes));
|
setLanes(keepIfSame(r.lanes));
|
||||||
setCounts(keepIfSame(r.counts));
|
|
||||||
setSelectedLaneId((cur) =>
|
setSelectedLaneId((cur) =>
|
||||||
cur !== null && r.lanes.some((l) => l.id === cur) ? cur : (r.lanes[0]?.id ?? null)
|
cur !== null && r.lanes.some((l) => l.id === cur) ? cur : (r.lanes[0]?.id ?? null)
|
||||||
);
|
);
|
||||||
@@ -515,60 +505,25 @@ export function Workspace() {
|
|||||||
: "space-y-5"
|
: "space-y-5"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{/* Page header: what this screen is, and the four numbers that say
|
|
||||||
whether anything needs a human right now. */}
|
|
||||||
<div className="flex flex-wrap items-center gap-3 border-b border-border pb-3">
|
|
||||||
<h2 className="text-base font-semibold tracking-tight text-fg-primary">
|
|
||||||
{tLanes("title")}
|
|
||||||
</h2>
|
|
||||||
<div className="flex flex-wrap items-center gap-1.5 text-xs">
|
|
||||||
<span
|
|
||||||
data-testid="count-total"
|
|
||||||
className="rounded-full bg-surface-2 px-2.5 py-0.5 text-fg-secondary"
|
|
||||||
>
|
|
||||||
{counts.total} {tLanes("countTotal")}
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
data-testid="count-running"
|
|
||||||
className="rounded-full bg-blue-600/20 px-2.5 py-0.5 text-blue-400"
|
|
||||||
>
|
|
||||||
{counts.running} {tLanes("countRunning")}
|
|
||||||
</span>
|
|
||||||
{counts.needs_you > 0 && (
|
|
||||||
<span
|
|
||||||
data-testid="count-needs-you"
|
|
||||||
className="rounded-full bg-status-warning/20 px-2.5 py-0.5 text-status-warning"
|
|
||||||
>
|
|
||||||
{counts.needs_you} {tLanes("countNeedsYou")}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{counts.dead > 0 && (
|
|
||||||
<span
|
|
||||||
data-testid="count-dead"
|
|
||||||
className="rounded-full bg-status-danger/20 px-2.5 py-0.5 text-status-danger"
|
|
||||||
>
|
|
||||||
{counts.dead} {tLanes("countDead")}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
<div className="ml-auto flex items-center gap-2">
|
|
||||||
{currentLane && <LaneToolsMenu lane={currentLane} />}
|
|
||||||
<button
|
|
||||||
onClick={() => setAddLaneOpen(true)}
|
|
||||||
className="flex items-center gap-1.5 rounded border border-border-light px-3 py-1 text-xs text-fg-secondary transition-colors hover:border-border-light hover:text-fg-primary"
|
|
||||||
title={tLanes("addLane")}
|
|
||||||
>
|
|
||||||
<Plus className="h-3.5 w-3.5" />
|
|
||||||
{tLanes("add")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Lane strip + detail stack vertically: the strip is a horizontally
|
{/* Lane strip + detail stack vertically: the strip is a horizontally
|
||||||
scrolling row (holds any number of lanes), the detail/console area
|
scrolling row (holds any number of lanes), the detail/console area
|
||||||
below it gets the full width and never competes for it. */}
|
below it gets the full width and never competes for it. */}
|
||||||
<div className="flex min-h-0 flex-1 flex-col gap-4">
|
<div className="flex min-h-0 flex-1 flex-col gap-4">
|
||||||
<div data-testid="lane-strip" className="flex shrink-0 flex-row gap-2 overflow-x-auto pb-1">
|
<div data-testid="lane-strip" className="flex shrink-0 flex-row gap-2 overflow-x-auto pb-1">
|
||||||
|
{/* "Add lane" is a tile in the strip rather than a header button:
|
||||||
|
creating a lane is the same kind of act as picking one, so it
|
||||||
|
reads as the empty slot at the head of the row. Dashed border and
|
||||||
|
no liveness dot keep it from being mistaken for a lane. */}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-testid="lane-tile-add"
|
||||||
|
onClick={() => setAddLaneOpen(true)}
|
||||||
|
title={tLanes("addLane")}
|
||||||
|
className="flex w-56 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-dashed border-border-light p-3 text-[13px] font-medium text-fg-secondary transition-colors hover:border-accent hover:bg-accent/5 hover:text-fg-primary"
|
||||||
|
>
|
||||||
|
<Plus className="h-4 w-4" />
|
||||||
|
{tLanes("add")}
|
||||||
|
</button>
|
||||||
{lanes.map((l) => (
|
{lanes.map((l) => (
|
||||||
<LaneStripCard
|
<LaneStripCard
|
||||||
key={l.id}
|
key={l.id}
|
||||||
@@ -690,6 +645,9 @@ export function Workspace() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<div className="ml-auto flex items-center gap-2">
|
<div className="ml-auto flex items-center gap-2">
|
||||||
|
{/* Per-lane actions (agents install, mcp sync, sync-base check)
|
||||||
|
belong beside the lane they act on, not in a page header. */}
|
||||||
|
<LaneToolsMenu lane={currentLane} />
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
data-testid="lane-detail-toggle"
|
data-testid="lane-detail-toggle"
|
||||||
|
|||||||
@@ -328,19 +328,11 @@ afterEach(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Workspace page — lane integration", () => {
|
describe("Workspace page — lane integration", () => {
|
||||||
it("lane strip lists lanes and counters match the API response", async () => {
|
it("lane strip lists the lanes the API returned", async () => {
|
||||||
await renderWorkspace();
|
await renderWorkspace();
|
||||||
|
|
||||||
// Verify lanes are rendered
|
|
||||||
expect(screen.getByTestId("lane-tile-1").textContent).toContain("Lane A");
|
expect(screen.getByTestId("lane-tile-1").textContent).toContain("Lane A");
|
||||||
expect(screen.getByTestId("lane-tile-2").textContent).toContain("Lane B");
|
expect(screen.getByTestId("lane-tile-2").textContent).toContain("Lane B");
|
||||||
|
|
||||||
// Verify counters are rendered with correct values
|
|
||||||
const counterTexts = screen.getAllByText((_, element) => {
|
|
||||||
if (!element) return false;
|
|
||||||
return element.textContent?.includes("2 lanes") || false;
|
|
||||||
});
|
|
||||||
expect(counterTexts.length).toBeGreaterThan(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("selecting a lane switches the pipeline and run id", async () => {
|
it("selecting a lane switches the pipeline and run id", async () => {
|
||||||
@@ -497,22 +489,16 @@ describe("Workspace page — lane integration", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("Workspace layout", () => {
|
describe("Workspace layout", () => {
|
||||||
it("shows the four counters with the values the API reported", async () => {
|
it("opens the add-lane modal from the strip's first tile", async () => {
|
||||||
countsToReturn = { total: 2, running: 1, needs_you: 3, dead: 4 };
|
const user = userEvent.setup();
|
||||||
await renderWorkspace();
|
await renderWorkspace();
|
||||||
|
|
||||||
expect(screen.getByTestId("count-total").textContent).toContain("2");
|
// The tile leads the strip, so it is reachable without scrolling past lanes.
|
||||||
expect(screen.getByTestId("count-running").textContent).toContain("1");
|
const strip = screen.getByTestId("lane-strip");
|
||||||
expect(screen.getByTestId("count-needs-you").textContent).toContain("3");
|
expect(strip.firstElementChild).toBe(screen.getByTestId("lane-tile-add"));
|
||||||
expect(screen.getByTestId("count-dead").textContent).toContain("4");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("hides the needs-you and dead counters when they are zero", async () => {
|
await user.click(screen.getByTestId("lane-tile-add"));
|
||||||
countsToReturn = { total: 2, running: 1, needs_you: 0, dead: 0 };
|
expect(await screen.findByText("Create a lane from a working directory")).toBeInTheDocument();
|
||||||
await renderWorkspace();
|
|
||||||
|
|
||||||
expect(screen.queryByTestId("count-needs-you")).toBeNull();
|
|
||||||
expect(screen.queryByTestId("count-dead")).toBeNull();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("gives every lane a tile in the carousel", async () => {
|
it("gives every lane a tile in the carousel", async () => {
|
||||||
|
|||||||
@@ -5097,42 +5097,20 @@ exports[`screen snapshots > Run 1`] = `
|
|||||||
class="space-y-5"
|
class="space-y-5"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex flex-wrap items-center gap-3 border-b border-border pb-3"
|
class="flex min-h-0 flex-1 flex-col gap-4"
|
||||||
>
|
>
|
||||||
<h2
|
|
||||||
class="text-base font-semibold tracking-tight text-fg-primary"
|
|
||||||
>
|
|
||||||
Lanes
|
|
||||||
</h2>
|
|
||||||
<div
|
<div
|
||||||
class="flex flex-wrap items-center gap-1.5 text-xs"
|
class="flex shrink-0 flex-row gap-2 overflow-x-auto pb-1"
|
||||||
>
|
data-testid="lane-strip"
|
||||||
<span
|
|
||||||
class="rounded-full bg-surface-2 px-2.5 py-0.5 text-fg-secondary"
|
|
||||||
data-testid="count-total"
|
|
||||||
>
|
|
||||||
0
|
|
||||||
|
|
||||||
lanes
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
class="rounded-full bg-blue-600/20 px-2.5 py-0.5 text-blue-400"
|
|
||||||
data-testid="count-running"
|
|
||||||
>
|
|
||||||
0
|
|
||||||
|
|
||||||
running
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="ml-auto flex items-center gap-2"
|
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="flex items-center gap-1.5 rounded border border-border-light px-3 py-1 text-xs text-fg-secondary transition-colors hover:border-border-light hover:text-fg-primary"
|
class="flex w-56 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-dashed border-border-light p-3 text-[13px] font-medium text-fg-secondary transition-colors hover:border-accent hover:bg-accent/5 hover:text-fg-primary"
|
||||||
|
data-testid="lane-tile-add"
|
||||||
title="Create a lane from a working directory"
|
title="Create a lane from a working directory"
|
||||||
|
type="button"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
class="lucide lucide-plus h-3.5 w-3.5"
|
class="lucide lucide-plus h-4 w-4"
|
||||||
fill="none"
|
fill="none"
|
||||||
height="24"
|
height="24"
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
@@ -5152,15 +5130,6 @@ exports[`screen snapshots > Run 1`] = `
|
|||||||
</svg>
|
</svg>
|
||||||
Add lane
|
Add lane
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="flex min-h-0 flex-1 flex-col gap-4"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="flex shrink-0 flex-row gap-2 overflow-x-auto pb-1"
|
|
||||||
data-testid="lane-strip"
|
|
||||||
>
|
|
||||||
<p
|
<p
|
||||||
class="text-sm text-fg-muted"
|
class="text-sm text-fg-muted"
|
||||||
>
|
>
|
||||||
@@ -9609,7 +9578,7 @@ exports[`screen snapshots > Settings 1`] = `
|
|||||||
<p
|
<p
|
||||||
class="text-[10px] text-status-warning/90 mt-1"
|
class="text-[10px] text-status-warning/90 mt-1"
|
||||||
>
|
>
|
||||||
UI build v1.6.6 (rebuild client to match)
|
UI build v1.6.7 (rebuild client to match)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|||||||
+10
-2
@@ -370,7 +370,9 @@ A missing source `.env` falls back to `.env.example` with a loud warning, never
|
|||||||
|
|
||||||
The dashboard web UI merges lanes and runs into a single **Workspace** page accessible at `/run` (the old `/lanes` route now redirects here). Top to bottom:
|
The dashboard web UI merges lanes and runs into a single **Workspace** page accessible at `/run` (the old `/lanes` route now redirects here). Top to bottom:
|
||||||
|
|
||||||
- **Header** — the page title and four counters (`lanes`, `running`, `needs you`, `dead`), plus Add lane. The `needs you` and `dead` counters appear only when they are non-zero, so a quiet header means nothing is waiting on a human.
|
- **No page header.** The page title and the four counters (`lanes`, `running`, `needs you`, `dead`) are gone: the lane strip below already shows every lane with its own liveness dot and its ⚠ marker, so the counters restated it a row higher and cost height on a screen whose point is the terminal. `GET /api/lanes` still returns `counts` for other callers.
|
||||||
|
- **Lane strip** — the horizontally scrolling row of lane tiles. Its FIRST tile is **Add lane** (dashed border, no liveness dot), not a header button: creating a lane is the same kind of act as picking one, so it reads as the empty slot at the head of the row.
|
||||||
|
- **Lane-detail header row** — one row, and every per-lane control lives on it: liveness + status, the lane's name, time-on-stage, the pipeline picker, the Model (AI Router) select, stage badges, the feature picker, and on the right the **Tools** menu (agents install / mcp sync / sync-base check, hidden when the lane declares no runtime profile), the info toggle, the split-view toggle and Remove. Tools sits here rather than in Settings because all three of its actions run against one lane's `cwd` — in Settings it would need a lane picker just to say which.
|
||||||
- **Detail panel** — the selected lane's declared stage, its inferred stage when detection leads, a full-width pipeline map, and a legend naming all five node states plus the dashed-amber inferred treatment.
|
- **Detail panel** — the selected lane's declared stage, its inferred stage when detection leads, a full-width pipeline map, and a legend naming all five node states plus the dashed-amber inferred treatment.
|
||||||
- **Terminal** — a real interactive terminal (xterm.js) displaying the tmux session's PTY output, with full support for interactive commands, editors, and pagers. A live run keeps its rendered history and scroll position when scrolling.
|
- **Terminal** — a real interactive terminal (xterm.js) displaying the tmux session's PTY output, with full support for interactive commands, editors, and pagers. A live run keeps its rendered history and scroll position when scrolling.
|
||||||
- **Split view** — a layout toggle (one pane / two side by side / a 2×2 grid, drawn as icons rather than the words, with the count kept as each button's `aria-label` and tooltip) renders that many independent terminal panes side by side (`grid-cols-2` for 2, a 2×2 grid for 4). Layout 1 is bound to the lane strip's selection, same as always; layouts 2 and 4 give each pane its own lane picker, independent of the strip. The chosen layout and each pane's lane persist to `localStorage` (`agenthub.workspace.splitView`) across reloads.
|
- **Split view** — a layout toggle (one pane / two side by side / a 2×2 grid, drawn as icons rather than the words, with the count kept as each button's `aria-label` and tooltip) renders that many independent terminal panes side by side (`grid-cols-2` for 2, a 2×2 grid for 4). Layout 1 is bound to the lane strip's selection, same as always; layouts 2 and 4 give each pane its own lane picker, independent of the strip. The chosen layout and each pane's lane persist to `localStorage` (`agenthub.workspace.splitView`) across reloads.
|
||||||
@@ -442,7 +444,8 @@ curl http://localhost:4820/api/lanes/5/git
|
|||||||
"head": "9b3e74a",
|
"head": "9b3e74a",
|
||||||
"subject": "free-text rule mode in the form",
|
"subject": "free-text rule mode in the form",
|
||||||
"dirty": 2,
|
"dirty": 2,
|
||||||
"untracked": 1
|
"untracked": 1,
|
||||||
|
"files": [" M server/lib/alerts.js", " M client/src/lib/api.ts", "?? scratch.txt"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -451,6 +454,11 @@ curl http://localhost:4820/api/lanes/5/git
|
|||||||
is a normal state, not a fault, and the card simply renders without a git row.
|
is a normal state, not a fault, and the card simply renders without a git row.
|
||||||
- A detached checkout reports the literal `HEAD` that git returns, rather than a
|
- A detached checkout reports the literal `HEAD` that git returns, rather than a
|
||||||
prettier invention.
|
prettier invention.
|
||||||
|
- `files` holds the raw `git status --porcelain` lines the two counts came from,
|
||||||
|
**capped at 20** — the card hovers them as a tooltip on the
|
||||||
|
`N modified · N untracked` text, and a lane mid-`npm install` would otherwise
|
||||||
|
ship thousands of paths through a polled endpoint. The counts are never
|
||||||
|
capped, so the tooltip appends `… +N` when it is showing less than all of it.
|
||||||
- An unknown lane id is a `404`.
|
- An unknown lane id is a `404`.
|
||||||
|
|
||||||
This is **not** folded into `GET /api/lanes` on purpose: it shells out to git
|
This is **not** folded into `GET /api/lanes` on purpose: it shells out to git
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@
|
|||||||
openapi: 3.0.3
|
openapi: 3.0.3
|
||||||
info:
|
info:
|
||||||
title: Agent Dashboard for Claude Code API
|
title: Agent Dashboard for Claude Code API
|
||||||
version: 1.6.6
|
version: 1.6.7
|
||||||
description: HTTP API for real-time Claude Code session monitoring, agent lifecycle tracking, analytics, pricing, hooks ingestion, and workflow intelligence.
|
description: HTTP API for real-time Claude Code session monitoring, agent lifecycle tracking, analytics, pricing, hooks ingestion, and workflow intelligence.
|
||||||
contact:
|
contact:
|
||||||
name: Nguyễn Ngọc Trí Vĩ
|
name: Nguyễn Ngọc Trí Vĩ
|
||||||
@@ -10700,7 +10700,7 @@ paths:
|
|||||||
type: integer
|
type: integer
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: available:true with {branch, head, subject, dirty, untracked}, or available:false alone.
|
description: available:true with {branch, head, subject, dirty, untracked, files}, or available:false alone. files holds the raw `git status --porcelain` lines behind those counts, capped at 20; the counts themselves are never capped.
|
||||||
'404':
|
'404':
|
||||||
description: Lane not found.
|
description: Lane not found.
|
||||||
/api/lanes/{id}/runtime:
|
/api/lanes/{id}/runtime:
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "agenthub",
|
"name": "agenthub",
|
||||||
"version": "1.6.6",
|
"version": "1.6.7",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "agenthub",
|
"name": "agenthub",
|
||||||
"version": "1.6.6",
|
"version": "1.6.7",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "agenthub",
|
"name": "agenthub",
|
||||||
"version": "1.6.6",
|
"version": "1.6.7",
|
||||||
"bin": {
|
"bin": {
|
||||||
"agenthub": "bin/agenthub.js"
|
"agenthub": "bin/agenthub.js"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ describe("worktree", () => {
|
|||||||
assert.equal(s.dirty, 1);
|
assert.equal(s.dirty, 1);
|
||||||
assert.equal(s.untracked, 1); // node_modules is ignored, so it does not count
|
assert.equal(s.untracked, 1); // node_modules is ignored, so it does not count
|
||||||
assert.match(s.head, /^[0-9a-f]{7,40}$/);
|
assert.match(s.head, /^[0-9a-f]{7,40}$/);
|
||||||
|
// The same lines the counts came from, so a caller can name the files.
|
||||||
|
assert.deepEqual(s.files.sort(), [" M README.md", "?? scratch.txt"]);
|
||||||
// The fixture has no remotes. Given the lane's base branch, unpushedCount
|
// The fixture has no remotes. Given the lane's base branch, unpushedCount
|
||||||
// measures base..HEAD — this worktree has committed nothing of its own, so 0.
|
// measures base..HEAD — this worktree has committed nothing of its own, so 0.
|
||||||
assert.equal(await wt.unpushedCount(dir, "main"), 0);
|
assert.equal(await wt.unpushedCount(dir, "main"), 0);
|
||||||
|
|||||||
+11
-3
@@ -16,6 +16,8 @@ const execFileAsync = promisify(execFile);
|
|||||||
|
|
||||||
const LANES_ROOT = process.env.LANES_ROOT || path.join(os.homedir(), ".claude", "agenthub-lanes");
|
const LANES_ROOT = process.env.LANES_ROOT || path.join(os.homedir(), ".claude", "agenthub-lanes");
|
||||||
const PROTECTED_BRANCHES = new Set(["main", "master"]);
|
const PROTECTED_BRANCHES = new Set(["main", "master"]);
|
||||||
|
/** Most status lines `statusCounts` reports by name; the counts stay exact. */
|
||||||
|
const STATUS_FILE_CAP = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Promisified git wrapper. On failure, throws an Error with err.git = { args, code, stderr }.
|
* Promisified git wrapper. On failure, throws an Error with err.git = { args, code, stderr }.
|
||||||
@@ -549,11 +551,16 @@ async function removeWorktree(lane) {
|
|||||||
/**
|
/**
|
||||||
* Parse git status --porcelain to count dirty, untracked, and get HEAD commit.
|
* Parse git status --porcelain to count dirty, untracked, and get HEAD commit.
|
||||||
* Lines starting with ?? are untracked; others are dirty.
|
* Lines starting with ?? are untracked; others are dirty.
|
||||||
|
*
|
||||||
|
* `files` carries the same lines back verbatim so a caller can show WHICH
|
||||||
|
* files the counts mean, capped because this rides a polled endpoint and a
|
||||||
|
* lane mid-`npm install` can report thousands.
|
||||||
*/
|
*/
|
||||||
async function statusCounts(dir) {
|
async function statusCounts(dir) {
|
||||||
const result = await git(dir, ["status", "--porcelain=v1", "--untracked-files=normal"]);
|
const result = await git(dir, ["status", "--porcelain=v1", "--untracked-files=normal"]);
|
||||||
let dirty = 0;
|
let dirty = 0;
|
||||||
let untracked = 0;
|
let untracked = 0;
|
||||||
|
const files = [];
|
||||||
|
|
||||||
for (const line of result.stdout.split("\n")) {
|
for (const line of result.stdout.split("\n")) {
|
||||||
if (!line.trim()) continue;
|
if (!line.trim()) continue;
|
||||||
@@ -562,13 +569,14 @@ async function statusCounts(dir) {
|
|||||||
} else {
|
} else {
|
||||||
dirty++;
|
dirty++;
|
||||||
}
|
}
|
||||||
|
if (files.length < STATUS_FILE_CAP) files.push(line.trimEnd());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get short commit hash
|
// Get short commit hash
|
||||||
const headResult = await git(dir, ["rev-parse", "--short", "HEAD"]);
|
const headResult = await git(dir, ["rev-parse", "--short", "HEAD"]);
|
||||||
const head = headResult.stdout.trim();
|
const head = headResult.stdout.trim();
|
||||||
|
|
||||||
return { dirty, untracked, head };
|
return { dirty, untracked, head, files };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -581,10 +589,10 @@ async function statusCounts(dir) {
|
|||||||
* caller shows what git says rather than inventing a nicer word for it.
|
* caller shows what git says rather than inventing a nicer word for it.
|
||||||
*/
|
*/
|
||||||
async function gitFacts(dir) {
|
async function gitFacts(dir) {
|
||||||
const { dirty, untracked, head } = await statusCounts(dir);
|
const { dirty, untracked, head, files } = await statusCounts(dir);
|
||||||
const branch = (await git(dir, ["rev-parse", "--abbrev-ref", "HEAD"])).stdout.trim();
|
const branch = (await git(dir, ["rev-parse", "--abbrev-ref", "HEAD"])).stdout.trim();
|
||||||
const subject = (await git(dir, ["log", "-1", "--format=%s"])).stdout.trim();
|
const subject = (await git(dir, ["log", "-1", "--format=%s"])).stdout.trim();
|
||||||
return { branch, head, subject, dirty, untracked };
|
return { branch, head, subject, dirty, untracked, files };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ const paths = {
|
|||||||
responses: {
|
responses: {
|
||||||
200: {
|
200: {
|
||||||
description:
|
description:
|
||||||
"available:true with {branch, head, subject, dirty, untracked}, or available:false alone.",
|
"available:true with {branch, head, subject, dirty, untracked, files}, or available:false alone. files holds the raw `git status --porcelain` lines behind those counts, capped at 20; the counts themselves are never capped.",
|
||||||
},
|
},
|
||||||
404: { description: "Lane not found." },
|
404: { description: "Lane not found." },
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user