Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(graph-ui): drop the empty '/' root on Windows, offer the drive instead

Zadakb15dff53a4b8
diff --git a/graph-ui/src/components/StatsTab.test.tsx b/graph-ui/src/components/StatsTab.test.tsx
index 2019181c9..9b0aa41c2 100644
--- a/graph-ui/src/components/StatsTab.test.tsx
+++ b/graph-ui/src/components/StatsTab.test.tsx
@@ -158,6 +158,35 @@ describe("StatsTab index modal", () => {
expect(await screen.findByText("projects")).toBeInTheDocument();
expect(screen.queryByText("Documents")).not.toBeInTheDocument();
});
+
+ it("replaces the meaningless '/' root with the drive on Windows", async () => {
+ const fetchMock = mockProjectsFetch((url) => {
+ if (url.startsWith("/api/browse")) {
+ const m = /[?&]path=([^&]*)/.exec(url);
+ const path = m ? decodeURIComponent(m[1]) : "C:/Users/rap";
+ return new Response(JSON.stringify({
+ path,
+ parent: "C:/",
+ dirs: ["Documents"],
+ roots: ["/"], // older backend: no drive enumeration
+ }), { status: 200, headers: { "Content-Type": "application/json" } });
+ }
+ return undefined;
+ });
+
+ render(<StatsTab onSelectProject={() => {}} />);
+ fireEvent.click(await screen.findByRole("button", { name: "Index your first repository" }));
+
+ /* The bogus "/" quick-jump is gone; the current drive root is offered. */
+ expect(await screen.findByRole("button", { name: "Browse C:/" })).toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Browse /" })).not.toBeInTheDocument();
+
+ /* Clicking it browses to the drive root, not "/". */
+ fireEvent.click(screen.getByRole("button", { name: "Browse C:/" }));
+ await waitFor(() => {
+ expect(fetchMock).toHaveBeenCalledWith("/api/browse?path=C%3A%2F");
+ });
+ });
});
describe("IndexProgress", () => {
diff --git a/graph-ui/src/components/StatsTab.tsx b/graph-ui/src/components/StatsTab.tsx
index 85b630504..7611fec64 100644
--- a/graph-ui/src/components/StatsTab.tsx
+++ b/graph-ui/src/components/StatsTab.tsx
@@ -269,6 +269,20 @@ function CreateIndexModal({ onClose, onCreated }: { onClose: () => void; onCreat
return "/" + parts.join("/");
};
+ /* Root/drive quick-jump buttons. On Windows the POSIX "/" root is meaningless
+ * — browsing it returns an empty listing — so drop it and offer drive roots
+ * instead. An older backend may not enumerate drives, so always include the
+ * current drive; other drives stay reachable by typing a path. */
+ const displayRoots = (() => {
+ if (!isWinPath) return roots;
+ const drives = Array.from(new Set(
+ roots.filter((r) => /^[A-Za-z]:[\\/]?$/.test(r)).map((r) => `${r[0].toUpperCase()}:/`),
+ ));
+ const curRoot = `${displayPath[0].toUpperCase()}:/`;
+ if (!drives.includes(curRoot)) drives.unshift(curRoot);
+ return drives;
+ })();
+
return (
<div className="fixed inset-0 z-50 flex items-center justify-center" onClick={onClose}>
<div className="absolute inset-0 bg-black/60 backdrop-blur-sm" />
@@ -312,7 +326,7 @@ function CreateIndexModal({ onClose, onCreated }: { onClose: () => void; onCreat
className="flex-1 bg-white/[0.04] border border-white/[0.06] rounded-lg px-3 py-2 text-[12px] text-foreground outline-none focus:border-primary/40 placeholder:text-foreground/20"
/>
<div className="flex items-center gap-1">
- {roots.map((root) => (
+ {displayRoots.map((root) => (
<button
key={root}
aria-label={t.index.browseRoot(root)}