Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix: resolve merge conflicts with main, preserve PAT functionality
Naiyuan Qingf70b34a50fe1
diff --cc CLAUDE.mdindex b6d94bfb01,179e4728aa..77ef183f5c--- a/CLAUDE.md+++ b/CLAUDE.md@@@ -39,11 -40,10 +39,13 @@@ apps/web| `features/issues/` | Issue state, components, config | `useIssueStore`, icons, pickers, status/priority config || `features/inbox/` | Inbox notification state | `useInboxStore` || `features/realtime/` | WebSocket connection + sync | `WSProvider`, `useWSEvent`, `useRealtimeSync` |+ | `features/modals/` | Modal registry and state | Modal store and components |+ | `features/skills/` | Skill management | Skill components |-**`shared/`** — Code used across multiple features. Currently only `api.ts` (SDK singleton).+**`shared/`** — Code used across multiple features:+- `shared/api/` — `ApiClient` (REST) and `WSClient` (WebSocket) for backend communication, plus the `api` singleton.+- `shared/types/` — Domain types (Issue, Agent, Workspace, etc.) and WebSocket event types.+- `shared/logger.ts` — Logger utility.### State Managementdiff --cc apps/web/app/(auth)/login/page.tsxindex b1c2cee263,de94a4eee6..4fab6b0c7c--- a/apps/web/app/(auth)/login/page.tsx+++ b/apps/web/app/(auth)/login/page.tsx@@@ -38,13 -51,15 +37,12 @@@ function LoginPageContent()setError("");setSubmitting(true);try {- await sendCode(email);- setStep("code");- setCode("");- setCooldown(10);- } catch (err) {- setError(- err instanceof Error ? err.message : "Failed to send code. Make sure the server is running."- );- } finally {+ await login(email, name || undefined);+ const wsList = await api.listWorkspaces();+ await hydrateWorkspace(wsList);- const fallback = useNavigationStore.getState().lastPath;- router.push(searchParams.get("next") || fallback);- } catch (err) {++ router.push(searchParams.get("next") || "/issues");++ } catch {+ setError("Login failed. Make sure the server is running.");setSubmitting(false);}};diff --cc apps/web/app/(dashboard)/issues/[id]/page.test.tsxindex 4840cfc243,c2481acb91..05fd853a41--- a/apps/web/app/(dashboard)/issues/[id]/page.test.tsx+++ b/apps/web/app/(dashboard)/issues/[id]/page.test.tsx@@@ -1,8 -1,8 +1,8 @@@- import { Suspense, forwardRef, useState, useImperativeHandle } from "react";-import { Suspense } from "react";++import { Suspense, forwardRef, useRef, useState, useImperativeHandle } from "react";import { describe, it, expect, vi, beforeEach } from "vitest";--import { render, screen, waitFor, act } from "@testing-library/react";++import { render, screen, waitFor, act, fireEvent } from "@testing-library/react";import userEvent from "@testing-library/user-event";-import type { Issue, Comment } from "@multica/types";+import type { Issue, Comment } from "@/shared/types";// Mock next/navigationvi.mock("next/navigation", () => ({@@@ -71,39 -71,6 +71,41 @@@ vi.mock("@/components/ui/calendar", ()Calendar: () => null,}));+// Mock RichTextEditor (Tiptap needs real DOM)+vi.mock("@/components/common/rich-text-editor", () => ({+ RichTextEditor: forwardRef(({ defaultValue, onUpdate, placeholder, onSubmit }: any, ref: any) => {++ const valueRef = useRef(defaultValue || "");+ const [value, setValue] = useState(defaultValue || "");+ useImperativeHandle(ref, () => ({- getMarkdown: () => value,- clearContent: () => setValue(""),++ getMarkdown: () => valueRef.current,++ clearContent: () => { valueRef.current = ""; setValue(""); },+ focus: () => {},+ }));+ return (+ <textarea+ value={value}+ onChange={(e) => {++ valueRef.current = e.target.value;+ setValue(e.target.value);+ onUpdate?.(e.target.value);+ }}+ onKeyDown={(e) => {+ if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {+ onSubmit?.();+ }+ }}+ placeholder={placeholder}+ data-testid="rich-text-editor"+ />+ );+ }),+}));++// Mock Markdown renderer+vi.mock("@/components/markdown", () => ({+ Markdown: ({ children }: { children: string }) => <div>{children}</div>,+}));+// Mock apiconst mockGetIssue = vi.hoisted(() => vi.fn());const mockListComments = vi.hoisted(() => vi.fn());@@@ -267,12 -234,17 +269,21 @@@ describe("IssueDetailPage", () =>).toBeInTheDocument();});- await user.type(- screen.getByPlaceholderText("Leave a comment..."),- "New test comment",- );+ const commentInput = screen.getByPlaceholderText("Leave a comment...");- await user.type(commentInput, "New test comment");+- // Find the Send button (sibling of the editor wrapper)- const commentSection = commentInput.closest(".flex.items-start")!;- const submitBtn = commentSection.querySelector("button")!;++ // Use fireEvent to update the textarea value and trigger onUpdate++ await act(async () => {++ fireEvent.change(commentInput, { target: { value: "New test comment" } });++ });+- const form = screen- .getByPlaceholderText("Leave a comment...")- .closest("form")!;- const submitBtn = form.querySelector(- 'button[type="submit"]',- ) as HTMLElement;++ // Wait for button to be enabled after commentEmpty state update++ const allButtons = screen.getAllByRole("button");++ const submitBtn = allButtons.find(++ (btn) => btn.querySelector(".lucide-arrow-up") !== null,++ )!;++ await waitFor(() => {++ expect(submitBtn).not.toBeDisabled();++ });await user.click(submitBtn);await waitFor(() => {diff --cc apps/web/app/(dashboard)/settings/page.tsxindex 73c439862a,72d232519c..ac47a5fb4f--- a/apps/web/app/(dashboard)/settings/page.tsx+++ b/apps/web/app/(dashboard)/settings/page.tsx@@@ -1,8 -1,8 +1,8 @@@"use client";- import { useEffect, useState } from "react";- import { Settings, Users, Building2, Save, Crown, Shield, User, Plus, Trash2, LogOut } from "lucide-react";- import type { MemberWithUser, MemberRole } from "@/shared/types";+ import { useEffect, useState, useCallback } from "react";+ import { Settings, Users, Building2, Save, Crown, Shield, User, Plus, Trash2, LogOut, Key, Copy, Check } from "lucide-react";-import type { MemberWithUser, MemberRole, PersonalAccessToken } from "@multica/types";++import type { MemberWithUser, MemberRole, PersonalAccessToken } from "@/shared/types";import { Input } from "@/components/ui/input";import { Textarea } from "@/components/ui/textarea";import { Label } from "@/components/ui/label";diff --cc apps/web/shared/api/client.tsindex 92d87fb109,402d45d804..259e57ae98--- a/apps/web/shared/api/client.ts+++ b/apps/web/shared/api/client.ts@@@ -23,8 -23,11 +23,11 @@@ import typeCreateSkillRequest,UpdateSkillRequest,SetAgentSkillsRequest,+ PersonalAccessToken,+ CreatePersonalAccessTokenRequest,+ CreatePersonalAccessTokenResponse,-} from "@multica/types";-import { type SDKLogger, noopLogger } from "./logger";+} from "@/shared/types";+import { type Logger, noopLogger } from "@/shared/logger";export interface LoginResponse {token: string;diff --cc apps/web/shared/api/index.tsindex 9e82063d4b,e707547302..665e31532a--- a/apps/web/shared/api/index.ts+++ b/apps/web/shared/api/index.ts@@@ -19,4 -15,14 +19,5 @@@ if (typeof window !== "undefined")if (wsId) {api.setWorkspaceId(wsId);}+- api.setOnUnauthorized(() => {- localStorage.removeItem("multica_token");- localStorage.removeItem("multica_workspace_id");- api.setToken(null);- api.setWorkspaceId(null);- if (window.location.pathname !== "/login") {- window.location.href = "/login";- }- });}diff --cc e2e/fixtures.tsindex 2dd1dfdd99,643727bdd4..524124c36f--- a/e2e/fixtures.ts+++ b/e2e/fixtures.ts@@@ -1,10 -1,14 +1,13 @@@/*** TestApiClient — lightweight API helper for E2E test data setup/teardown.*- * Uses raw fetch (no dependency on @multica/sdk build) so E2E tests- * have zero build-time coupling to monorepo packages.+ * Uses raw fetch so E2E tests have zero build-time coupling to the web app.*/+ import pg from "pg";+const API_BASE = process.env.NEXT_PUBLIC_API_URL ?? `http://localhost:${process.env.PORT ?? "8080"}`;+ const DATABASE_URL = process.env.DATABASE_URL ?? "postgres://multica:multica@localhost:5432/multica?sslmode=disable";interface TestWorkspace {id: string;