feat(maestro): wire React app as sole web entry point

Deletes the vanilla shell and mounts App.tsx on #root. main.ts and the
23 views it drove are gone; App.tsx composes the ported components —
sidebar, multi-view, command bar, spawn modal, help and restart
overlays, daemon link, drawer — around the catalog and layout stores.

The pure parts of four deleted modules moved next to the components
that still use them: the spawn-form model and spawnSimilar into
components/spawn, the transcript's markdown/format helpers and the diff
into components/structured, the help overlay's grouping into
components/dialogs. Document-level event names now live in uiEvents.ts.

Deduplicated two pairs the migration left side by side: the sidebar
uses dialogs/KillDialog and common/ContextMenu. It also listens for the
command bar's kill/rename events, which nothing had picked up since
catalog.ts went away.

styles.css stays as the token and base layer, with `#app` renamed to
`#root` and the pane-body rules re-keyed off the classes the React
panes actually carry.

Closes #253
This commit is contained in:
Miguel Palhas
2026-09-09 02:27:42 +01:00
parent ad71147bd9
commit 8a05ef2eb7
101 changed files with 855 additions and 18942 deletions
+37 -7
View File
@@ -10,9 +10,10 @@ import type { CatalogStore, CatalogStoreApi } from "../../stores/catalogStore.js
import type { InTheWay, Session } from "../../types.js";
import { sessionBlockers, sessionName } from "../../types.js";
import { buildTree, type TreeNode } from "../../tree.js";
import { ContextMenu, type ContextMenuItem } from "./ContextMenu.js";
import { KILL_SESSION_EVENT, RENAME_SESSION_EVENT } from "../../uiEvents.js";
import { ContextMenu, type ContextMenuItem } from "../common/ContextMenu.js";
import { FolderNode } from "./FolderNode.js";
import { KillConfirm } from "./KillConfirm.js";
import { KillDialog } from "../dialogs/KillDialog.js";
import { SessionCard } from "./SessionCard.js";
import { SidebarSearch } from "./SidebarSearch.js";
import { filterSessions, firstRowUnder, navRows, sessionKey } from "./model.js";
@@ -58,6 +59,8 @@ interface KillState {
session: Session;
blockers: InTheWay | null;
force: boolean;
/** The daemon's refusal message, once an unforced kill has been refused. */
reason?: string;
}
export function Sidebar(props: SidebarProps) {
@@ -158,6 +161,27 @@ export function Sidebar(props: SidebarProps) {
return sessions.find((s) => s.id === row.id);
}, [rows, navKey, sessions]);
// The command bar's action page raises these rather than reimplementing
// either flow (docs/COMMAND-BAR.md): a kill from the bar goes through the
// same confirm-and-blockers dialog the card's ✕ does, and a rename from the
// bar opens the card's own inline field.
useEffect(() => {
const onKillRequest = (e: Event) => {
const s = (e as CustomEvent<Session>).detail;
if (s) beginKill(s);
};
const onRenameRequest = (e: Event) => {
const s = (e as CustomEvent<Session>).detail;
if (s) setRenamingId(s.id);
};
document.addEventListener(KILL_SESSION_EVENT, onKillRequest);
document.addEventListener(RENAME_SESSION_EVENT, onRenameRequest);
return () => {
document.removeEventListener(KILL_SESSION_EVENT, onKillRequest);
document.removeEventListener(RENAME_SESSION_EVENT, onRenameRequest);
};
}, [beginKill]);
const onKeyDown = (e: React.KeyboardEvent) => {
// The inline rename field owns its own keys; the walk stays out of it.
if (e.target instanceof HTMLInputElement) return;
@@ -296,15 +320,18 @@ export function Sidebar(props: SidebarProps) {
/>
)}
{kill && (
<KillConfirm
<KillDialog
name={sessionName(kill.session)}
blockers={kill.blockers}
force={kill.force}
reason={kill.reason}
onCancel={() => setKill(null)}
onConfirm={() => {
onConfirm={async () => {
const { session: s, force } = kill;
setKill(null);
void killSession(s.id, force).catch((e: unknown) => {
try {
await killSession(s.id, force);
setKill(null);
} catch (e: unknown) {
// The daemon refuses an unforced kill over a worktree holding
// unsaved work; that refusal needs its own prompt
// (docs/WORKTREES.md).
@@ -313,9 +340,12 @@ export function Sidebar(props: SidebarProps) {
session: s,
blockers: e.unsavedWork ?? sessionBlockers(s),
force: true,
reason: e.message,
});
return;
}
});
throw e;
}
}}
/>
)}