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
66 lines
2.1 KiB
TypeScript
66 lines
2.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { spawnSimilarProjectSeed, spawnSimilarSeed } from "./spawnSimilar.js";
|
|
import type { Session } from "../../types.js";
|
|
|
|
function session(overrides: Partial<Session> = {}): Session {
|
|
return {
|
|
id: "s1",
|
|
cwd: "/repos/app",
|
|
command: "claude",
|
|
env: {},
|
|
metadata: {},
|
|
status: "Running",
|
|
created_at: "2026-01-01T00:00:00Z",
|
|
...overrides,
|
|
} as Session;
|
|
}
|
|
|
|
describe("spawnSimilarSeed (#28)", () => {
|
|
it("seeds the project picker, not the free-text hatch", () => {
|
|
const seed = spawnSimilarSeed(session());
|
|
expect(seed.cwd).toBe("/repos/app");
|
|
expect(seed.command).toBe("claude");
|
|
expect(seed.cwdRawVisible).toBe(false);
|
|
});
|
|
|
|
it("keeps the worktree toggle off for a session that has no worktree", () => {
|
|
expect(spawnSimilarSeed(session()).worktreeEnabled).toBe(false);
|
|
});
|
|
|
|
it("clones a worktree session as a new worktree of its base repo", () => {
|
|
const seed = spawnSimilarSeed(
|
|
session({
|
|
cwd: "/repos/app-worktrees/feature",
|
|
worktree: { path: "/repos/app-worktrees/feature", base_repo: "/repos/app" },
|
|
}),
|
|
);
|
|
expect(seed.cwd).toBe("/repos/app");
|
|
expect(seed.worktreeEnabled).toBe(true);
|
|
});
|
|
|
|
it("never carries the cloned session's name", () => {
|
|
const seed = spawnSimilarSeed(session({ metadata: { name: "amber-falcon" } }));
|
|
expect(seed.name).toBeUndefined();
|
|
});
|
|
});
|
|
|
|
describe("spawnSimilarProjectSeed", () => {
|
|
it("seeds the project alone, leaving command and worktree at their defaults", () => {
|
|
const seed = spawnSimilarProjectSeed(session());
|
|
expect(seed.cwd).toBe("/repos/app");
|
|
expect(seed.cwdRawVisible).toBe(false);
|
|
expect(seed.command).toBeUndefined();
|
|
expect(seed.worktreeEnabled).toBeUndefined();
|
|
});
|
|
|
|
it("seeds a worktree session's base repository", () => {
|
|
const seed = spawnSimilarProjectSeed(
|
|
session({
|
|
cwd: "/repos/app-worktrees/feature",
|
|
worktree: { path: "/repos/app-worktrees/feature", base_repo: "/repos/app" },
|
|
}),
|
|
);
|
|
expect(seed.cwd).toBe("/repos/app");
|
|
});
|
|
});
|