feat(maestro): project list replaces recents picker in spawn form (#59)
This commit is contained in:
+35
-12
@@ -33,8 +33,8 @@ function sess(
|
||||
};
|
||||
}
|
||||
|
||||
/** Stub the spawn-form backend endpoints (#26) so `?mock&spawn` renders the full
|
||||
* tile-first flow — presets, recents, gitroot — with no daemon running. Dev-only;
|
||||
/** Stub the spawn-form backend endpoints (#26/#59) so `?mock&spawn` renders the
|
||||
* full flow — presets, projects, gitroot — with no daemon running. Dev-only;
|
||||
* delegates every other request to the real `fetch`. */
|
||||
function stubSpawnApi(): void {
|
||||
const real = globalThis.fetch.bind(globalThis);
|
||||
@@ -61,16 +61,39 @@ function stubSpawnApi(): void {
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (path.includes("/recent-dirs")) {
|
||||
if (path.includes("/projects")) {
|
||||
const now = Date.now();
|
||||
const iso = (daysAgo: number) => new Date(now - daysAgo * 86_400_000).toISOString();
|
||||
return Promise.resolve(
|
||||
json({
|
||||
dirs: [
|
||||
{ cwd: "/home/dev/git/maestro", last_command: "claude", last_used: "2026-06-20T10:00:00Z" },
|
||||
{ cwd: "/home/dev/git/dotfiles", last_command: "zsh", last_used: "2026-06-19T18:00:00Z" },
|
||||
{ cwd: "/home/dev/work/acme/api", last_command: "opencode", last_used: "2026-06-18T09:00:00Z" },
|
||||
],
|
||||
truncated: false,
|
||||
}),
|
||||
json([
|
||||
{
|
||||
path: "/home/dev/git/maestro",
|
||||
name: "maestro",
|
||||
is_worktree: false,
|
||||
last_activity: iso(0),
|
||||
last_command: "claude",
|
||||
},
|
||||
{
|
||||
path: "/home/dev/worktrees/maestro-59",
|
||||
name: "maestro-59",
|
||||
is_worktree: true,
|
||||
base_repo: "/home/dev/git/maestro",
|
||||
last_activity: iso(1),
|
||||
last_command: "opencode",
|
||||
},
|
||||
{
|
||||
path: "/home/dev/git/dotfiles",
|
||||
name: "dotfiles",
|
||||
is_worktree: false,
|
||||
last_activity: iso(30),
|
||||
last_command: "zsh",
|
||||
},
|
||||
{
|
||||
path: "/home/dev/work/acme/api",
|
||||
name: "api",
|
||||
is_worktree: false,
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
if (path.includes("/gitroot")) {
|
||||
@@ -113,7 +136,7 @@ export function seedMock(store: CatalogStore): void {
|
||||
});
|
||||
|
||||
// `?mock&spawn` auto-opens the spawn modal for visual review, with the spawn
|
||||
// backend endpoints stubbed so presets/recents/gitroot all render.
|
||||
// backend endpoints stubbed so presets/projects/gitroot all render.
|
||||
if (location.search.includes("spawn")) {
|
||||
stubSpawnApi();
|
||||
void import("./spawn.js").then((m) => m.openSpawnModal());
|
||||
|
||||
Reference in New Issue
Block a user