Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(web): add repos management UI to workspace settings
yushenbae2926370f4
diff --git a/apps/web/app/(dashboard)/settings/_components/workspace-tab.tsx b/apps/web/app/(dashboard)/settings/_components/workspace-tab.tsxindex bdb2f78d17..f9adfaa2ba 100644--- a/apps/web/app/(dashboard)/settings/_components/workspace-tab.tsx+++ b/apps/web/app/(dashboard)/settings/_components/workspace-tab.tsx@@ -1,7 +1,7 @@"use client";import { useEffect, useState } from "react";-import { Save, LogOut } from "lucide-react";+import { Save, LogOut, Plus, Trash2 } from "lucide-react";import { Input } from "@/components/ui/input";import { Textarea } from "@/components/ui/textarea";import { Label } from "@/components/ui/label";@@ -21,6 +21,7 @@ import { toast } from "sonner";import { useAuthStore } from "@/features/auth";import { useWorkspaceStore } from "@/features/workspace";import { api } from "@/shared/api";+import type { WorkspaceRepo } from "@/shared/types";export function WorkspaceTab() {const user = useAuthStore((s) => s.user);@@ -33,6 +34,7 @@ export function WorkspaceTab() {const [name, setName] = useState(workspace?.name ?? "");const [description, setDescription] = useState(workspace?.description ?? "");const [context, setContext] = useState(workspace?.context ?? "");+ const [repos, setRepos] = useState<WorkspaceRepo[]>(workspace?.repos ?? []);const [saving, setSaving] = useState(false);const [actionId, setActionId] = useState<string | null>(null);const [confirmAction, setConfirmAction] = useState<{@@ -50,6 +52,7 @@ export function WorkspaceTab() {setName(workspace?.name ?? "");setDescription(workspace?.description ?? "");setContext(workspace?.context ?? "");+ setRepos(workspace?.repos ?? []);}, [workspace]);const handleSave = async () => {@@ -60,6 +63,7 @@ export function WorkspaceTab() {name,description,context,+ repos,});updateWorkspace(updated);toast.success("Workspace settings saved");@@ -70,6 +74,18 @@ export function WorkspaceTab() {}};+ const handleAddRepo = () => {+ setRepos([...repos, { url: "", description: "" }]);+ };++ const handleRemoveRepo = (index: number) => {+ setRepos(repos.filter((_, i) => i !== index));+ };++ const handleRepoChange = (index: number, field: keyof WorkspaceRepo, value: string) => {+ setRepos(repos.map((r, i) => (i === index ? { ...r, [field]: value } : r)));+ };+const handleLeaveWorkspace = () => {if (!workspace) return;setConfirmAction({@@ -175,6 +191,59 @@ export function WorkspaceTab() {</Card></section>+ {/* Repositories */}+ <section className="space-y-4">+ <h2 className="text-sm font-semibold">Repositories</h2>++ <Card>+ <CardContent className="space-y-3">+ <p className="text-xs text-muted-foreground">+ GitHub repositories associated with this workspace. Agents use these to clone and work on code.+ </p>++ {repos.map((repo, index) => (+ <div key={index} className="flex gap-2">+ <div className="flex-1 space-y-1.5">+ <Input+ type="url"+ value={repo.url}+ onChange={(e) => handleRepoChange(index, "url", e.target.value)}+ disabled={!canManageWorkspace}+ placeholder="https://github.com/org/repo"+ className="text-sm"+ />+ <Input+ type="text"+ value={repo.description}+ onChange={(e) => handleRepoChange(index, "description", e.target.value)}+ disabled={!canManageWorkspace}+ placeholder="Description (e.g. Go backend + Next.js frontend)"+ className="text-sm"+ />+ </div>+ {canManageWorkspace && (+ <Button+ variant="ghost"+ size="icon"+ className="mt-0.5 shrink-0 text-muted-foreground hover:text-destructive"+ onClick={() => handleRemoveRepo(index)}+ >+ <Trash2 className="h-3.5 w-3.5" />+ </Button>+ )}+ </div>+ ))}++ {canManageWorkspace && (+ <Button variant="outline" size="sm" onClick={handleAddRepo}>+ <Plus className="h-3 w-3" />+ Add repository+ </Button>+ )}+ </CardContent>+ </Card>+ </section>+{/* Danger Zone */}<section className="space-y-4"><div className="flex items-center gap-2">diff --git a/apps/web/shared/api/client.ts b/apps/web/shared/api/client.tsindex 285c12994c..e28cf9d54d 100644--- a/apps/web/shared/api/client.ts+++ b/apps/web/shared/api/client.ts@@ -17,6 +17,7 @@ import type {InboxItem,Comment,Workspace,+ WorkspaceRepo,MemberWithUser,User,Skill,@@ -317,7 +318,7 @@ export class ApiClient {});}- async updateWorkspace(id: string, data: { name?: string; description?: string; context?: string; settings?: Record<string, unknown> }): Promise<Workspace> {+ async updateWorkspace(id: string, data: { name?: string; description?: string; context?: string; settings?: Record<string, unknown>; repos?: WorkspaceRepo[] }): Promise<Workspace> {return this.fetch(`/api/workspaces/${id}`, {method: "PATCH",body: JSON.stringify(data),diff --git a/apps/web/shared/types/index.ts b/apps/web/shared/types/index.tsindex 5d0acc8aa5..c3b1d72a7b 100644--- a/apps/web/shared/types/index.ts+++ b/apps/web/shared/types/index.ts@@ -21,7 +21,7 @@ export type {RuntimePing,RuntimePingStatus,} from "./agent";-export type { Workspace, Member, MemberRole, User, MemberWithUser } from "./workspace";+export type { Workspace, WorkspaceRepo, Member, MemberRole, User, MemberWithUser } from "./workspace";export type { InboxItem, InboxSeverity, InboxItemType } from "./inbox";export type { Comment, CommentType, CommentAuthorType } from "./comment";export type { DaemonPairingSession, DaemonPairingSessionStatus, ApproveDaemonPairingSessionRequest } from "./daemon";diff --git a/apps/web/shared/types/workspace.ts b/apps/web/shared/types/workspace.tsindex 269fe364c2..9fdc45a454 100644--- a/apps/web/shared/types/workspace.ts+++ b/apps/web/shared/types/workspace.ts@@ -1,5 +1,10 @@export type MemberRole = "owner" | "admin" | "member";+export interface WorkspaceRepo {+ url: string;+ description: string;+}+export interface Workspace {id: string;name: string;@@ -7,6 +12,7 @@ export interface Workspace {description: string | null;context: string | null;settings: Record<string, unknown>;+ repos: WorkspaceRepo[];created_at: string;updated_at: string;}diff --git a/apps/web/test/helpers.tsx b/apps/web/test/helpers.tsxindex 312c3bc56c..5bb9fe3fc3 100644--- a/apps/web/test/helpers.tsx+++ b/apps/web/test/helpers.tsx@@ -21,6 +21,7 @@ export const mockWorkspace: Workspace = {description: "A test workspace",context: null,settings: {},+ repos: [],created_at: "2026-01-01T00:00:00Z",updated_at: "2026-01-01T00:00:00Z",};