Show worktree names in workspace hover cards (#2711)
* fix(app): show worktree names in workspace hover cards Managed worktree paths exposed Paseo's internal directory layout instead of the useful worktree name. Carry the owned worktree root through the sidebar model while preserving the full workspace path as the copy target. * fix(workspaces): source owned worktree names from daemon The daemon owns worktree path semantics, so expose the managed worktree slug and let the sidebar model produce a display-ready label. This keeps path parsing out of the hover-card component while preserving the full path for copying. * fix(app): preserve worktree labels in replica cache
This commit is contained in:
@@ -17,7 +17,8 @@ function ws(
|
||||
projectViewKey: input.projectViewKey ?? "proj",
|
||||
projectName: input.projectName ?? "Project",
|
||||
projectRootPath: input.projectRootPath,
|
||||
workspaceDirectory: input.workspaceDirectory,
|
||||
workspaceDirectory: input.workspaceDirectory ?? "",
|
||||
workspaceDirectoryLabel: input.workspaceDirectoryLabel ?? "",
|
||||
projectKind: input.projectKind ?? "git",
|
||||
workspaceKind: input.workspaceKind ?? "worktree",
|
||||
name: input.name ?? "main",
|
||||
|
||||
@@ -64,6 +64,27 @@ describe("createSidebarWorkspaceEntry forge threading", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("createSidebarWorkspaceEntry workspace directory label", () => {
|
||||
it("uses the daemon-provided slug for a Paseo-owned worktree", () => {
|
||||
const descriptor = workspaceWithForge(undefined, "https://github.com/acme/repo/pull/42");
|
||||
descriptor.workspaceDirectory = "/worktrees/feature/packages/app";
|
||||
descriptor.worktreeSlug = "feature";
|
||||
|
||||
const entry = createSidebarWorkspaceEntry({ serverId: "srv", workspace: descriptor });
|
||||
|
||||
expect(entry.workspaceDirectoryLabel).toBe("feature");
|
||||
});
|
||||
|
||||
it("shortens the workspace path when the daemon omits a worktree slug", () => {
|
||||
const descriptor = workspaceWithForge(undefined, "https://github.com/acme/repo/pull/42");
|
||||
descriptor.workspaceDirectory = "/home/alice/external/feature";
|
||||
|
||||
const entry = createSidebarWorkspaceEntry({ serverId: "srv", workspace: descriptor });
|
||||
|
||||
expect(entry.workspaceDirectoryLabel).toBe("~/external/feature");
|
||||
});
|
||||
});
|
||||
|
||||
interface OrderedItem {
|
||||
key: string;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import type {
|
||||
WorkspaceStructureProject,
|
||||
} from "@/projects/workspace-structure";
|
||||
import { projectDisplayNameFromProjectId } from "@/utils/project-display-name";
|
||||
import { shortenPath } from "@/utils/shorten-path";
|
||||
import type { WorkspaceAgentActivity } from "@/utils/workspace-agent-activity";
|
||||
import { resolveWorkspaceMapKeyByIdentity } from "@/utils/workspace-identity";
|
||||
|
||||
@@ -34,6 +35,8 @@ export interface SidebarStatusWorkspacePlacement extends SidebarWorkspacePlaceme
|
||||
}
|
||||
|
||||
export interface SidebarWorkspaceEntry extends SidebarStatusWorkspacePlacement {
|
||||
workspaceDirectory: string;
|
||||
workspaceDirectoryLabel: string;
|
||||
// Raw user-set title (null when the name is derived from branch/directory).
|
||||
// Prefills the rename input and signals whether a reset is available.
|
||||
title: string | null;
|
||||
@@ -155,6 +158,8 @@ export function createSidebarWorkspaceEntry(input: {
|
||||
projectName: projectNameForWorkspace(input.workspace),
|
||||
projectRootPath: input.workspace.projectRootPath,
|
||||
workspaceDirectory: input.workspace.workspaceDirectory,
|
||||
workspaceDirectoryLabel:
|
||||
input.workspace.worktreeSlug ?? shortenPath(input.workspace.workspaceDirectory),
|
||||
projectKind: input.workspace.projectKind,
|
||||
workspaceKind: input.workspace.workspaceKind,
|
||||
name: input.workspace.name,
|
||||
|
||||
@@ -21,6 +21,7 @@ function workspace(projectKey: string, workspaceId: string): SidebarWorkspaceEnt
|
||||
projectName: projectKey,
|
||||
projectRootPath: `/repo/${projectKey}`,
|
||||
workspaceDirectory: `/repo/${projectKey}/${workspaceId}`,
|
||||
workspaceDirectoryLabel: `/repo/${projectKey}/${workspaceId}`,
|
||||
projectKind: "git",
|
||||
workspaceKind: "worktree",
|
||||
name: workspaceId,
|
||||
|
||||
Reference in New Issue
Block a user