Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(projects): show descriptions in repository pickers (MUL-7575) (#8668)
hutiefang76570f8f82a171
diff --git a/packages/views/modals/create-project.test.tsx b/packages/views/modals/create-project.test.tsxindex a7d983f20c..b6cef05a57 100644--- a/packages/views/modals/create-project.test.tsx+++ b/packages/views/modals/create-project.test.tsx@@ -7,6 +7,7 @@ import { renderWithI18n } from "../test/i18n";const longRepoUrl ="https://github.com/multica-ai/a-very-long-repository-name-that-needs-a-tooltip";const apiRepoUrl = "https://github.com/multica-ai/api";+const apiRepoDescription = "API and daemon runtime";const webRepoUrl = "https://github.com/multica-ai/web";vi.mock("@tanstack/react-query", () => ({@@ -48,7 +49,11 @@ vi.mock("@multica/core/paths", () => ({id: "workspace-1",name: "Test Workspace",slug: "test-workspace",- repos: [{ url: longRepoUrl }, { url: apiRepoUrl }, { url: webRepoUrl }],+ repos: [+ { url: longRepoUrl },+ { url: apiRepoUrl, description: apiRepoDescription },+ { url: webRepoUrl },+ ],}),useWorkspacePaths: () => ({projectDetail: (id: string) => `/test-workspace/projects/${id}`,@@ -214,6 +219,34 @@ describe("CreateProjectModal", () => {expect(screen.queryByTitle(longRepoUrl)).toBeNull();});+ it("shows a workspace repository description without copying it to the resource label", async () => {+ createProjectMock.mockClear();+ const user = userEvent.setup();+ renderWithI18n(<CreateProjectModal onClose={vi.fn()} />);++ expect(screen.getByText(apiRepoDescription)).toBeInTheDocument();++ await user.type(screen.getByPlaceholderText(/project title/i), "API delivery");+ await user.click(+ screen.getByRole("button", { name: (name) => name.includes(apiRepoUrl) }),+ );+ await user.click(screen.getByRole("button", { name: /^create project$/i }));++ expect(createProjectMock).toHaveBeenCalledTimes(1);+ const payload = createProjectMock.mock.calls[0]?.[0] as {+ resources?: Array<{+ resource_type: string;+ resource_ref: Record<string, unknown>;+ }>;+ };+ expect(payload.resources).toEqual([+ {+ resource_type: "github_repo",+ resource_ref: { url: apiRepoUrl },+ },+ ]);+ });+it("reveals the start/due date pickers from the ⋯ overflow menu", async () => {const user = userEvent.setup();renderWithI18n(<CreateProjectModal onClose={vi.fn()} />);diff --git a/packages/views/modals/create-project.tsx b/packages/views/modals/create-project.tsxindex 52effd8e52..40de5b887c 100644--- a/packages/views/modals/create-project.tsx+++ b/packages/views/modals/create-project.tsx@@ -110,17 +110,25 @@ export function buildLocalDirectoryResourceRef({function RepoUrlText({url,+ description,className,}: {url: string;+ description?: string;className?: string;}) {+ const label = description?.trim();return (<Tooltip><TooltipTriggerrender={- <span className={cn("truncate flex-1 text-left", className)}>- {githubShortLabel(url)}+ <span className={cn("min-w-0 flex-1 text-left", className)}>+ <span className="block truncate">{githubShortLabel(url)}</span>+ {label && (+ <span className="block truncate text-micro text-muted-foreground">+ {label}+ </span>+ )}</span>}/>@@ -830,7 +838,7 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {className="size-3.5"/><GithubIcon className="size-3.5" />- <RepoUrlText url={repo.url} />+ <RepoUrlText url={repo.url} description={repo.description} /></button>);})}@@ -887,7 +895,10 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {<div key={url} className="space-y-1"><div className="flex items-center gap-2 text-caption"><GithubIcon className="size-3 shrink-0 text-muted-foreground" />- <RepoUrlText url={url} />+ <RepoUrlText+ url={url}+ description={workspaceRepos.find((repo) => repo.url === url)?.description}+ />{/* The ref rides beside the repo it belongs to,not in one field for the whole list: each repocan start somewhere different. */}diff --git a/packages/views/projects/components/project-resources-github-ref.test.tsx b/packages/views/projects/components/project-resources-github-ref.test.tsxindex 4396abbd46..8ac32fec7e 100644--- a/packages/views/projects/components/project-resources-github-ref.test.tsx+++ b/packages/views/projects/components/project-resources-github-ref.test.tsx@@ -25,13 +25,28 @@ const PINNED = {created_by: "u1",};+const AVAILABLE_REPO = {+ url: "https://github.com/multica-ai/api",+ description: "API and daemon runtime",+};++const ATTACHABLE_REPO = {+ url: "https://github.com/multica-ai/daemon",+ description: "Background task runner",+};++const PINNED_REPO = {+ url: "https://github.com/multica-ai/multica",+ description: "The main monorepo",+};+// The common case: no ref, so tasks use the repository's default branch.const PLAIN = {id: "res-2",project_id: "p1",workspace_id: "workspace-1",resource_type: "github_repo",- resource_ref: { url: "https://github.com/multica-ai/docs" },+ resource_ref: { url: AVAILABLE_REPO.url },label: null,position: 1,created_at: "2026-09-19T00:00:00Z",@@ -64,7 +79,11 @@ vi.mock("@multica/core/runtimes", () => ({}));vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "workspace-1" }));vi.mock("@multica/core/paths", () => ({- useCurrentWorkspace: () => ({ id: "workspace-1", slug: "ws", repos: [] }),+ useCurrentWorkspace: () => ({+ id: "workspace-1",+ slug: "ws",+ repos: [AVAILABLE_REPO, ATTACHABLE_REPO, PINNED_REPO],+ }),}));vi.mock("../../platform/local-directory", () => ({isDesktopShell: () => false,@@ -88,6 +107,25 @@ describe("ProjectResourcesSection — github_repo checkout ref", () => {renderWithI18n(<ProjectResourcesSection projectId="p1" />);expect(screen.getByText("Release line")).toBeTruthy();expect(screen.getByText("release/2026-09")).toBeTruthy();+ expect(screen.queryByText(PINNED_REPO.description)).toBeNull();+ });++ it("shows a live workspace repository description and keeps it out of the attached resource label", async () => {+ renderWithI18n(<ProjectResourcesSection projectId="p1" />);+ expect(screen.getAllByText("multica-ai/api")).not.toHaveLength(0);+ expect(screen.getByText(AVAILABLE_REPO.description)).toBeTruthy();++ fireEvent.click(screen.getByRole("button", { name: /add resource/i }));+ expect(screen.getByText(ATTACHABLE_REPO.description)).toBeTruthy();+ fireEvent.click(+ screen.getByRole("button", { name: /multica-ai\/daemon/i }),+ );++ await waitFor(() => expect(createMock).toHaveBeenCalledTimes(1));+ expect(createMock.mock.calls[0]?.[0]).toEqual({+ resource_type: "github_repo",+ resource_ref: { url: ATTACHABLE_REPO.url },+ });});it("saves a new ref while preserving the rest of the stored ref", async () => {@@ -265,7 +303,7 @@ describe("ProjectResourcesSection — github_repo checkout ref", () => {expect(within(pinnedRow).queryByText("release/2026-09")).toBeTruthy();expect(within(pinnedRow).queryByText(/default branch/i)).toBeNull();- const plainRow = screen.getByText("multica-ai/docs").closest(".group") as HTMLElement;+ const plainRow = screen.getAllByText("multica-ai/api")[0]?.closest(".group") as HTMLElement;expect(within(plainRow).queryByText(/default branch/i)).toBeTruthy();expect(within(plainRow).queryByText("release/2026-09")).toBeNull();});diff --git a/packages/views/projects/components/project-resources-section.tsx b/packages/views/projects/components/project-resources-section.tsxindex 4c46d33211..1c10c80a2b 100644--- a/packages/views/projects/components/project-resources-section.tsx+++ b/packages/views/projects/components/project-resources-section.tsx@@ -399,6 +399,12 @@ export function ProjectResourcesSection({ projectId }: { projectId: string }) {<ResourceRowkey={resource.id}resource={resource}+ githubRepoDescription={+ isGithubRef(resource)+ ? workspace?.repos?.find((repo) => repo.url === resource.resource_ref.url)+ ?.description+ : undefined+ }localDaemonId={localDaemonId}onRemove={() => handleRemove(resource)}onEditGithubRef={(target) => {@@ -484,14 +490,23 @@ export function ProjectResourcesSection({ projectId }: { projectId: string }) {className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-caption text-left hover:bg-accent transition-colors aria-disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:hover:bg-transparent"><FolderGit className="size-3.5" />- <Tooltip>- <TooltipTrigger- render={- <span className="truncate flex-1">{githubShortLabel(repo.url)}</span>- }- />- <TooltipContent side="top">{repo.url}</TooltipContent>- </Tooltip>+ <span className="min-w-0 flex-1">+ <Tooltip>+ <TooltipTrigger+ render={+ <span className="block truncate">+ {githubShortLabel(repo.url)}+ </span>+ }+ />+ <TooltipContent side="top">{repo.url}</TooltipContent>+ </Tooltip>+ {repo.description?.trim() && (+ <span className="block truncate text-micro text-muted-foreground">+ {repo.description.trim()}+ </span>+ )}+ </span>{isAttached && (<span className="text-micro text-muted-foreground">{t(($) => $.resources.attached_badge)}@@ -614,6 +629,7 @@ function worktreeUnavailableReason(interface ResourceRowProps {resource: ProjectResource;+ githubRepoDescription?: string;localDaemonId: string | null;onRemove: () => void;onEditGithubRef: (@@ -626,6 +642,7 @@ interface ResourceRowProps {function ResourceRow({resource,+ githubRepoDescription,localDaemonId,onRemove,onEditGithubRef,@@ -635,26 +652,37 @@ function ResourceRow({if (isGithubRef(resource)) {const ref = resource.resource_ref;const display = resource.label || githubShortLabel(ref.url);+ // Workspace repository descriptions are source-of-truth metadata. They stay+ // live here rather than being copied into the resource label, while an+ // explicit resource label remains the user's preferred primary text.+ const description = resource.label ? undefined : githubRepoDescription?.trim();const tooltip = ref.ref ? `${ref.url}\nref: ${ref.ref}` : ref.url;return (<div className="text-caption group"><div className="flex items-center gap-2"><FolderGit className="size-3.5 text-muted-foreground shrink-0" />- <Tooltip>- <TooltipTrigger- render={- <a- href={ref.url}- target="_blank"- rel="noopener noreferrer"- className="truncate min-w-0 flex-1 hover:underline"- >- {display}- </a>- }- />- <TooltipContent side="top" className="whitespace-pre-line">{tooltip}</TooltipContent>- </Tooltip>+ <div className="min-w-0 flex-1">+ <Tooltip>+ <TooltipTrigger+ render={+ <a+ href={ref.url}+ target="_blank"+ rel="noopener noreferrer"+ className="block truncate hover:underline"+ >+ {display}+ </a>+ }+ />+ <TooltipContent side="top" className="whitespace-pre-line">{tooltip}</TooltipContent>+ </Tooltip>+ {description && (+ <span className="block truncate text-micro text-muted-foreground">+ {description}+ </span>+ )}+ </div><buttontype="button"onClick={() => onEditGithubRef(resource)}