Find and open workspaces from the command center (#2096)
* feat(app): add workspaces to command center * fix(app): scale down command center typography * fix(app): avoid workspace theme subscription * fix(app): theme command center bottom sheet * fix(app): tighten command center workspace results
This commit is contained in:
@@ -32,6 +32,8 @@ function workspace(input: {
|
||||
projectId?: string;
|
||||
projectName?: string;
|
||||
remoteUrl?: string | null;
|
||||
currentBranch?: string;
|
||||
archivingAt?: string | null;
|
||||
}): WorkspaceDescriptor {
|
||||
return {
|
||||
id: input.id,
|
||||
@@ -43,12 +45,12 @@ function workspace(input: {
|
||||
workspaceKind: "local_checkout",
|
||||
name: input.id,
|
||||
status: "done",
|
||||
archivingAt: null,
|
||||
archivingAt: input.archivingAt ?? null,
|
||||
statusEnteredAt: null,
|
||||
diffStat: null,
|
||||
scripts: [],
|
||||
gitRuntime: {
|
||||
currentBranch: "main",
|
||||
currentBranch: input.currentBranch ?? "main",
|
||||
remoteUrl: input.remoteUrl ?? input.project?.checkout.remoteUrl ?? null,
|
||||
isPaseoOwnedWorktree: false,
|
||||
isDirty: false,
|
||||
@@ -62,6 +64,50 @@ function workspace(input: {
|
||||
}
|
||||
|
||||
describe("buildProjects", () => {
|
||||
it("normalizes detached and blank branches out of workspace summaries", () => {
|
||||
const result = buildProjects({
|
||||
hosts: [
|
||||
{
|
||||
serverId: "local",
|
||||
serverName: "Local",
|
||||
isOnline: true,
|
||||
workspaces: [
|
||||
workspace({ id: "detached", repoRoot: "/repo/app", currentBranch: "HEAD" }),
|
||||
workspace({ id: "blank", repoRoot: "/repo/app", currentBranch: " " }),
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(result.projects[0]?.hosts[0]?.workspaces).toMatchObject([
|
||||
{ id: "detached", currentBranch: null },
|
||||
{ id: "blank", currentBranch: null },
|
||||
]);
|
||||
});
|
||||
|
||||
it("carries active archive state into workspace summaries", () => {
|
||||
const archivingAt = "2026-07-15T18:00:00.000Z";
|
||||
const result = buildProjects({
|
||||
hosts: [
|
||||
{
|
||||
serverId: "local",
|
||||
serverName: "Local",
|
||||
isOnline: true,
|
||||
workspaces: [
|
||||
workspace({ id: "archiving", repoRoot: "/repo/app", archivingAt }),
|
||||
workspace({ id: "active", repoRoot: "/repo/app" }),
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(result.projects[0]?.hosts[0]?.workspaces).toMatchObject([
|
||||
{ id: "archiving", archivingAt },
|
||||
{ id: "active" },
|
||||
]);
|
||||
expect(result.projects[0]?.hosts[0]?.workspaces[1]).not.toHaveProperty("archivingAt");
|
||||
});
|
||||
|
||||
it("groups two daemons with the same GitHub project key into one project with one host entry per daemon", () => {
|
||||
const result = buildProjects({
|
||||
hosts: [
|
||||
|
||||
@@ -5,9 +5,11 @@ import { buildWorkspaceStructureProjects } from "@/projects/workspace-structure"
|
||||
export interface WorkspaceSummary {
|
||||
id: string;
|
||||
name: string;
|
||||
title?: string;
|
||||
workspaceKind: WorkspaceDescriptor["workspaceKind"];
|
||||
status: WorkspaceDescriptor["status"];
|
||||
currentBranch: string | null;
|
||||
archivingAt?: string;
|
||||
}
|
||||
|
||||
export interface ProjectHostEntry {
|
||||
@@ -116,12 +118,15 @@ function resolveHostRepoRoot(group: HostGroup): string {
|
||||
}
|
||||
|
||||
function toWorkspaceSummary(workspace: WorkspaceDescriptor): WorkspaceSummary {
|
||||
const currentBranch = workspace.gitRuntime?.currentBranch?.trim();
|
||||
return {
|
||||
id: workspace.id,
|
||||
name: workspace.name,
|
||||
...(workspace.title ? { title: workspace.title } : {}),
|
||||
workspaceKind: workspace.workspaceKind,
|
||||
status: workspace.status,
|
||||
currentBranch: workspace.gitRuntime?.currentBranch ?? null,
|
||||
currentBranch: currentBranch && currentBranch !== "HEAD" ? currentBranch : null,
|
||||
...(workspace.archivingAt ? { archivingAt: workspace.archivingAt } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user