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
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
// "Spawn similar" (#28): the seed a cloned session hands to the spawn modal.
|
|
// Pure — the caller owns opening the dialog.
|
|
|
|
import type { SpawnFormSeed } from "./model.js";
|
|
import type { Session } from "../../types.js";
|
|
|
|
/** Clone a session into form values: same project, same command, same
|
|
* worktree decision, fresh name.
|
|
*
|
|
* A worktree session seeds its *base repository*, not the checkout the daemon
|
|
* made for it: "similar" is another session of that project, and the daemon
|
|
* never adopts an existing worktree (docs/WORKTREES.md), so seeding the
|
|
* checkout would ask it to build a worktree out of a worktree. The picker
|
|
* then lands on that repository's box with "+ new" active.
|
|
*
|
|
* `cwdRawVisible: false` keeps the two-step project picker on screen with the
|
|
* cloned project selected, instead of dropping the path into the free-text
|
|
* escape hatch.
|
|
*
|
|
* The name is left out on purpose: a clone is a new session and takes its own
|
|
* generated handle. */
|
|
export function spawnSimilarSeed(s: Session): SpawnFormSeed {
|
|
const wt = s.worktree ?? null;
|
|
return {
|
|
command: s.command,
|
|
cwd: wt ? wt.base_repo : s.cwd,
|
|
worktreeEnabled: wt != null,
|
|
cwdRawVisible: false,
|
|
};
|
|
}
|
|
|
|
/** The project half of a clone: the session's repository, nothing else.
|
|
*
|
|
* The plain spawn modal opens on this so the picker is already parked on the
|
|
* project you were last looking at — one Enter spawns there — while the
|
|
* command, worktree decision and name stay at the form's own defaults. Same
|
|
* base-repository rule as `spawnSimilarSeed`. */
|
|
export function spawnSimilarProjectSeed(s: Session): SpawnFormSeed {
|
|
const wt = s.worktree ?? null;
|
|
return {
|
|
cwd: wt ? wt.base_repo : s.cwd,
|
|
cwdRawVisible: false,
|
|
};
|
|
}
|