Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(views): extract packages/views — shared business UI + navigation adapter

Naiyuan Qingf41a0cf4236c
diff --git a/apps/web/app/(dashboard)/_components/app-sidebar.tsx b/apps/web/app/(dashboard)/_components/app-sidebar.tsx
index 43f9ff7f36..55bcb2611d 100644
--- a/apps/web/app/(dashboard)/_components/app-sidebar.tsx
+++ b/apps/web/app/(dashboard)/_components/app-sidebar.tsx
@@ -17,7 +17,7 @@ import {
SquarePen,
CircleUser,
} from "lucide-react";
-import { WorkspaceAvatar } from "@/features/workspace";
+import { WorkspaceAvatar } from "@multica/views/workspace/workspace-avatar";
import { useIssueDraftStore } from "@multica/core/issues/stores/draft-store";
import {
Sidebar,
diff --git a/apps/web/app/(dashboard)/inbox/page.tsx b/apps/web/app/(dashboard)/inbox/page.tsx
index 8b2ae96cd4..39ca1a195c 100644
--- a/apps/web/app/(dashboard)/inbox/page.tsx
+++ b/apps/web/app/(dashboard)/inbox/page.tsx
@@ -17,7 +17,7 @@ import {
useArchiveAllReadInbox,
useArchiveCompletedInbox,
} from "@multica/core/inbox/mutations";
-import { IssueDetail, StatusIcon, PriorityIcon } from "@/features/issues/components";
+import { IssueDetail, StatusIcon, PriorityIcon } from "@multica/views/issues/components";
import { STATUS_CONFIG, PRIORITY_CONFIG } from "@multica/core/issues/config";
import { useActorName } from "@multica/core/workspace/hooks";
import { ActorAvatar } from "@/components/common/actor-avatar";
diff --git a/apps/web/app/(dashboard)/issues/[id]/page.test.tsx b/apps/web/app/(dashboard)/issues/[id]/page.test.tsx
index f2a56d9cda..16e017da99 100644
--- a/apps/web/app/(dashboard)/issues/[id]/page.test.tsx
+++ b/apps/web/app/(dashboard)/issues/[id]/page.test.tsx
@@ -38,6 +38,121 @@ vi.mock("@/platform/auth", () => ({
}),
}));
+// Mock @multica/core/workspace (used by @multica/views components)
+vi.mock("@multica/core/workspace", () => ({
+ useWorkspaceStore: Object.assign(
+ (selector: (s: any) => any) =>
+ selector({
+ workspace: { id: "ws-1", name: "Test WS" },
+ workspaces: [{ id: "ws-1", name: "Test WS" }],
+ members: [{ user_id: "user-1", name: "Test User", email: "[email protected]" }],
+ agents: [{ id: "agent-1", name: "Claude Agent" }],
+ }),
+ { getState: () => ({
+ workspace: { id: "ws-1", name: "Test WS" },
+ workspaces: [{ id: "ws-1", name: "Test WS" }],
+ members: [{ user_id: "user-1", name: "Test User", email: "[email protected]" }],
+ agents: [{ id: "agent-1", name: "Claude Agent" }],
+ }),
+ },
+ ),
+ registerWorkspaceStore: vi.fn(),
+}));
+
+// Mock @multica/core/auth (used by @multica/views components)
+vi.mock("@multica/core/auth", () => ({
+ useAuthStore: Object.assign(
+ (selector: (s: any) => any) =>
+ selector({
+ user: { id: "user-1", name: "Test User", email: "[email protected]" },
+ isLoading: false,
+ }),
+ { getState: () => ({
+ user: { id: "user-1", name: "Test User", email: "[email protected]" },
+ isLoading: false,
+ }),
+ },
+ ),
+ registerAuthStore: vi.fn(),
+ createAuthStore: vi.fn(),
+}));
+
+// Mock @multica/views/navigation (AppLink used by views components)
+vi.mock("@multica/views/navigation", () => ({
+ AppLink: ({ children, href, ...props }: any) => <a href={href} {...props}>{children}</a>,
+ useNavigation: () => ({ push: vi.fn(), pathname: "/issues/issue-1" }),
+ NavigationProvider: ({ children }: { children: React.ReactNode }) => children,
+}));
+
+// Mock @multica/views/editor (ContentEditor, TitleEditor used by IssueDetail)
+vi.mock("@multica/views/editor", () => ({
+ ReadonlyContent: ({ content }: { content: string }) => (
+ <div data-testid="readonly-content">{content}</div>
+ ),
+ ContentEditor: forwardRef(({ defaultValue, onUpdate, placeholder, onSubmit }: any, ref: any) => {
+ const valueRef = useRef(defaultValue || "");
+ const [value, setValue] = useState(defaultValue || "");
+ useImperativeHandle(ref, () => ({
+ 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"
+ />
+ );
+ }),
+ TitleEditor: forwardRef(({ defaultValue, placeholder, onBlur, onChange }: any, ref: any) => {
+ const valueRef = useRef(defaultValue || "");
+ const [value, setValue] = useState(defaultValue || "");
+ useImperativeHandle(ref, () => ({
+ getText: () => valueRef.current,
+ focus: () => {},
+ }));
+ return (
+ <input
+ value={value}
+ onChange={(e) => {
+ valueRef.current = e.target.value;
+ setValue(e.target.value);
+ onChange?.(e.target.value);
+ }}
+ onBlur={() => onBlur?.(valueRef.current)}
+ placeholder={placeholder}
+ data-testid="title-editor"
+ />
+ );
+ }),
+}));
+
+// Mock @multica/views/workspace/workspace-avatar
+vi.mock("@multica/views/workspace/workspace-avatar", () => ({
+ WorkspaceAvatar: ({ name }: { name: string }) => <span>{name.charAt(0)}</span>,
+}));
+
+// Mock @multica/views/common/actor-avatar
+vi.mock("@multica/views/common/actor-avatar", () => ({
+ ActorAvatar: ({ actorType, actorId }: any) => <span data-testid="actor-avatar">{actorType}:{actorId}</span>,
+}));
+
+// Mock @multica/views/common/markdown
+vi.mock("@multica/views/common/markdown", () => ({
+ Markdown: ({ children }: { children: string }) => <div>{children}</div>,
+}));
+
// Mock workspace feature
vi.mock("@/features/workspace", () => ({
useWorkspaceStore: (selector: (s: any) => any) =>
diff --git a/apps/web/app/(dashboard)/issues/[id]/page.tsx b/apps/web/app/(dashboard)/issues/[id]/page.tsx
index 210e24be2e..a60ac2228d 100644
--- a/apps/web/app/(dashboard)/issues/[id]/page.tsx
+++ b/apps/web/app/(dashboard)/issues/[id]/page.tsx
@@ -1,7 +1,7 @@
"use client";
import { use } from "react";
-import { IssueDetail } from "@/features/issues/components";
+import { IssueDetail } from "@multica/views/issues/components";
export default function IssueDetailPage({
params,
diff --git a/apps/web/app/(dashboard)/issues/page.test.tsx b/apps/web/app/(dashboard)/issues/page.test.tsx
index fc42655456..f1d28acaf3 100644
--- a/apps/web/app/(dashboard)/issues/page.test.tsx
+++ b/apps/web/app/(dashboard)/issues/page.test.tsx
@@ -48,6 +48,32 @@ vi.mock("@/features/workspace", () => ({
WorkspaceAvatar: ({ name }: { name: string }) => <span>{name.charAt(0)}</span>,
}));
+// Mock @multica/core/auth (used by @multica/views pickers like AssigneePicker)
+const mockAuthUser = { id: "user-1", email: "[email protected]", name: "Test User" };
+vi.mock("@multica/core/auth", () => ({
+ useAuthStore: Object.assign(
+ (selector?: any) => {
+ const state = { user: mockAuthUser, isAuthenticated: true };
+ return selector ? selector(state) : state;
+ },
+ { getState: () => ({ user: mockAuthUser, isAuthenticated: true }) },
+ ),
+ registerAuthStore: vi.fn(),
+ createAuthStore: vi.fn(),
+}));
+
+// Mock @multica/core/workspace (used by @multica/views components)
+vi.mock("@multica/core/workspace", () => ({
+ useWorkspaceStore: Object.assign(
+ (selector?: any) => {
+ const state = { workspace: { id: "ws-1", name: "Test", slug: "test" }, agents: [], members: [] };
+ return selector ? selector(state) : state;
+ },
+ { getState: () => ({ workspace: { id: "ws-1", name: "Test", slug: "test" }, agents: [], members: [] }) },
+ ),
+ registerWorkspaceStore: vi.fn(),
+}));
+
vi.mock("@/platform/workspace", () => ({
useWorkspaceStore: Object.assign(
(selector?: any) => {
@@ -58,6 +84,18 @@ vi.mock("@/platform/workspace", () => ({
),
}));
+// Mock @multica/views/navigation (AppLink used by views components)
+vi.mock("@multica/views/navigation", () => ({
+ AppLink: ({ children, href, ...props }: any) => <a href={href} {...props}>{children}</a>,
+ useNavigation: () => ({ push: vi.fn(), pathname: "/issues" }),
+ NavigationProvider: ({ children }: { children: React.ReactNode }) => children,
+}));
+
+// Mock @multica/views/workspace/workspace-avatar
+vi.mock("@multica/views/workspace/workspace-avatar", () => ({
+ WorkspaceAvatar: ({ name }: { name: string }) => <span>{name.charAt(0)}</span>,
+}));
+
// Mock WebSocket context
vi.mock("@/features/realtime", () => ({
useWSEvent: vi.fn(),
@@ -79,10 +117,14 @@ vi.mock("@multica/core/api", () => ({
api: {
listIssues: (...args: any[]) => mockListIssues(...args),
updateIssue: (...args: any[]) => mockUpdateIssue(...args),
+ listMembers: () => Promise.resolve([]),
+ listAgents: () => Promise.resolve([]),
},
getApi: () => ({
listIssues: (...args: any[]) => mockListIssues(...args),
updateIssue: (...args: any[]) => mockUpdateIssue(...args),
+ listMembers: () => Promise.resolve([]),
+ listAgents: () => Promise.resolve([]),
}),
setApiInstance: vi.fn(),
}));
diff --git a/apps/web/app/(dashboard)/issues/page.tsx b/apps/web/app/(dashboard)/issues/page.tsx
index 546ca001b7..af5cbb2909 100644
--- a/apps/web/app/(dashboard)/issues/page.tsx
+++ b/apps/web/app/(dashboard)/issues/page.tsx
@@ -1,6 +1,6 @@
"use client";
-import { IssuesPage } from "@/features/issues/components/issues-page";
+import { IssuesPage } from "@multica/views/issues/components";
export default function Page() {
return <IssuesPage />;
diff --git a/apps/web/app/(dashboard)/layout.tsx b/apps/web/app/(dashboard)/layout.tsx
index b50ba533f0..5c3a330cc7 100644
--- a/apps/web/app/(dashboard)/layout.tsx
+++ b/apps/web/app/(dashboard)/layout.tsx
@@ -7,6 +7,8 @@ import { useNavigationStore } from "@multica/core/navigation";
import { SidebarProvider, SidebarInset } from "@multica/ui/components/ui/sidebar";
import { useAuthStore } from "@/platform/auth";
import { useWorkspaceStore } from "@/platform/workspace";
+import { WorkspaceIdProvider } from "@multica/core/hooks";
+import { ModalRegistry } from "@multica/views/modals/registry";
import { AppSidebar } from "./_components/app-sidebar";
export default function DashboardLayout({
@@ -45,7 +47,10 @@ export default function DashboardLayout({
<AppSidebar />
<SidebarInset className="overflow-hidden">
{workspace ? (
- children
+ <WorkspaceIdProvider wsId={workspace.id}>
+ {children}
+ <ModalRegistry />
+ </WorkspaceIdProvider>
) : (
<div className="flex flex-1 items-center justify-center">
<MulticaIcon className="size-6 animate-pulse" />
diff --git a/apps/web/app/(dashboard)/my-issues/page.tsx b/apps/web/app/(dashboard)/my-issues/page.tsx
index d8870b002d..dc0161d8d5 100644
--- a/apps/web/app/(dashboard)/my-issues/page.tsx
+++ b/apps/web/app/(dashboard)/my-issues/page.tsx
@@ -1,6 +1,6 @@
"use client";
-import { MyIssuesPage } from "@/features/my-issues";
+import { MyIssuesPage } from "@multica/views/my-issues";
export default function Page() {
return <MyIssuesPage />;
diff --git a/apps/web/app/(dashboard)/runtimes/page.tsx b/apps/web/app/(dashboard)/runtimes/page.tsx
index 621147a534..8fce8b6dc1 100644
--- a/apps/web/app/(dashboard)/runtimes/page.tsx
+++ b/apps/web/app/(dashboard)/runtimes/page.tsx
@@ -1 +1 @@
-export { RuntimesPage as default } from "@/features/runtimes";
+export { RuntimesPage as default } from "@multica/views/runtimes";
diff --git a/apps/web/app/(dashboard)/skills/page.tsx b/apps/web/app/(dashboard)/skills/page.tsx
index 309fe556ef..8261409187 100644
--- a/apps/web/app/(dashboard)/skills/page.tsx
+++ b/apps/web/app/(dashboard)/skills/page.tsx
@@ -1 +1 @@
-export { SkillsPage as default } from "@/features/skills";
+export { SkillsPage as default } from "@multica/views/skills";
diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css
index 2a1cb7a50c..5e0ad0bd20 100644
--- a/apps/web/app/globals.css
+++ b/apps/web/app/globals.css
@@ -6,8 +6,9 @@
@custom-variant dark (&:is(.dark *));
-@source "../../packages/ui/**/*.tsx";
-@source "../../packages/core/**/*.tsx";
+@source "../../../packages/ui/**/*.tsx";
+@source "../../../packages/core/**/*.tsx";
+@source "../../../packages/views/**/*.tsx";
@layer base {
* {
diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx
index 574bb1ee78..caf0d8439c 100644
--- a/apps/web/app/layout.tsx
+++ b/apps/web/app/layout.tsx
@@ -6,7 +6,7 @@ import { cn } from "@multica/ui/lib/utils";
import { QueryProvider } from "@multica/core/provider";
import { AuthInitializer } from "@/features/auth";
import { WebWSProvider } from "@/platform/ws-provider";
-import { ModalRegistry } from "@/features/modals";
+import { WebNavigationProvider } from "@/platform/navigation";
import { LocaleSync } from "@/components/locale-sync";
import "./globals.css";
@@ -66,10 +66,11 @@ export default function RootLayout({
<LocaleSync />
<ThemeProvider>
<QueryProvider>
- <AuthInitializer>
- <WebWSProvider>{children}</WebWSProvider>
- </AuthInitializer>
- <ModalRegistry />
+ <WebNavigationProvider>
+ <AuthInitializer>
+ <WebWSProvider>{children}</WebWSProvider>
+ </AuthInitializer>
+ </WebNavigationProvider>
<Toaster />
</QueryProvider>
</ThemeProvider>
diff --git a/apps/web/components/markdown/Markdown.tsx b/apps/web/components/markdown/Markdown.tsx
index 0410fc27c1..5487924b32 100644
--- a/apps/web/components/markdown/Markdown.tsx
+++ b/apps/web/components/markdown/Markdown.tsx
@@ -5,7 +5,7 @@ import {
type MarkdownProps as MarkdownBaseProps,
type RenderMode
} from '@multica/ui/markdown'
-import { IssueMentionCard } from '@/features/issues/components/issue-mention-card'
+import { IssueMentionCard } from '@multica/views/issues/components'
export type { RenderMode }
diff --git a/apps/web/components/markdown/StreamingMarkdown.tsx b/apps/web/components/markdown/StreamingMarkdown.tsx
index cc1e2a4afa..c55711ae84 100644
--- a/apps/web/components/markdown/StreamingMarkdown.tsx
+++ b/apps/web/components/markdown/StreamingMarkdown.tsx
@@ -3,7 +3,7 @@ import {
StreamingMarkdown as StreamingMarkdownBase,
type StreamingMarkdownProps as StreamingMarkdownBaseProps
} from '@multica/ui/markdown'
-import { IssueMentionCard } from '@/features/issues/components/issue-mention-card'
+import { IssueMentionCard } from '@multica/views/issues/components'
export type StreamingMarkdownProps = StreamingMarkdownBaseProps
diff --git a/apps/web/features/issues/index.ts b/apps/web/features/issues/index.ts
index 8c6058d60b..7a8708ebba 100644
--- a/apps/web/features/issues/index.ts
+++ b/apps/web/features/issues/index.ts
@@ -1,5 +1,5 @@
export { useIssueStore } from "@multica/core/issues";
export { useIssueViewStore, createIssueViewStore } from "@multica/core/issues/stores/view-store";
export { ViewStoreProvider, useViewStore } from "@multica/core/issues/stores/view-store-context";
-export { StatusIcon, PriorityIcon, StatusPicker, PriorityPicker, AssigneePicker } from "./components";
+export { StatusIcon, PriorityIcon, StatusPicker, PriorityPicker, AssigneePicker } from "@multica/views/issues/components";
export * from "@multica/core/issues/config";
diff --git a/apps/web/features/landing/components/features-section.tsx b/apps/web/features/landing/components/features-section.tsx
index 777a3a736d..fd917e0554 100644
--- a/apps/web/features/landing/components/features-section.tsx
+++ b/apps/web/features/landing/components/features-section.tsx
@@ -22,8 +22,7 @@ import { cn } from "@multica/ui/lib/utils";
import { ImageIcon } from "./shared";
import { useLocale } from "../i18n";
import type { LandingDict } from "../i18n";
-import { StatusIcon } from "@/features/issues/components/status-icon";
-import { PriorityIcon } from "@/features/issues/components/priority-icon";
+import { StatusIcon, PriorityIcon } from "@multica/views/issues/components";
import { STATUS_CONFIG } from "@multica/core/issues/config/status";
import { PRIORITY_CONFIG } from "@multica/core/issues/config/priority";
import type { IssueStatus, IssuePriority } from "@multica/core/types";
diff --git a/apps/web/features/modals/index.ts b/apps/web/features/modals/index.ts
index abdf3447fd..1e3f7f6906 100644
--- a/apps/web/features/modals/index.ts
+++ b/apps/web/features/modals/index.ts
@@ -1,2 +1,2 @@
export { useModalStore } from "@multica/core/modals";
-export { ModalRegistry } from "./registry";
+export { ModalRegistry } from "@multica/views/modals/registry";
diff --git a/apps/web/features/workspace/index.ts b/apps/web/features/workspace/index.ts
index ed150d52cb..d04bb92ee0 100644
--- a/apps/web/features/workspace/index.ts
+++ b/apps/web/features/workspace/index.ts
@@ -1,3 +1,3 @@
export { useWorkspaceStore } from "@/platform/workspace";
export { useActorName } from "@multica/core/workspace/hooks";
-export { WorkspaceAvatar } from "./components/workspace-avatar";
+export { WorkspaceAvatar } from "@multica/views/workspace/workspace-avatar";
diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts
index ed0346557a..7ad1a5ae5a 100644
--- a/apps/web/next.config.ts
+++ b/apps/web/next.config.ts
@@ -22,7 +22,7 @@ const allowedDevOrigins = process.env.CORS_ALLOWED_ORIGINS
: undefined;
const nextConfig: NextConfig = {
- transpilePackages: ["@multica/core", "@multica/ui"],
+ transpilePackages: ["@multica/core", "@multica/ui", "@multica/views"],
...(allowedDevOrigins && allowedDevOrigins.length > 0
? { allowedDevOrigins }
: {}),
diff --git a/apps/web/package.json b/apps/web/package.json
index 0141a0407d..fdd1fbb0cf 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -14,6 +14,7 @@
"dependencies": {
"@multica/core": "workspace:*",
"@multica/ui": "workspace:*",
+ "@multica/views": "workspace:*",
"@base-ui/react": "^1.3.0",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
diff --git a/apps/web/platform/auth.ts b/apps/web/platform/auth.ts
index 114e41761a..50f6072920 100644
--- a/apps/web/platform/auth.ts
+++ b/apps/web/platform/auth.ts
@@ -1,4 +1,4 @@
-import { createAuthStore } from "@multica/core/auth";
+import { createAuthStore, registerAuthStore } from "@multica/core/auth";
import { api } from "./api";
import {
setLoggedInCookie,
@@ -10,3 +10,5 @@ export const useAuthStore = createAuthStore({
onLogin: setLoggedInCookie,
onLogout: clearLoggedInCookie,
});
+
+registerAuthStore(useAuthStore);
diff --git a/apps/web/platform/navigation.tsx b/apps/web/platform/navigation.tsx
new file mode 100644
index 0000000000..6e7468c144
--- /dev/null
+++ b/apps/web/platform/navigation.tsx
@@ -0,0 +1,40 @@
+"use client";
+
+import { Suspense } from "react";
+import { useRouter, usePathname, useSearchParams } from "next/navigation";
+import {
+ NavigationProvider,
+ type NavigationAdapter,
+} from "@multica/views/navigation";
+
+function NavigationProviderInner({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const router = useRouter();
+ const pathname = usePathname();
+ const searchParams = useSearchParams();
+
+ const adapter: NavigationAdapter = {
+ push: router.push,
+ replace: router.replace,
+ back: router.back,
+ pathname,
+ searchParams: new URLSearchParams(searchParams.toString()),
+ };
+
+ return <NavigationProvider value={adapter}>{children}</NavigationProvider>;
+}
+
+export function WebNavigationProvider({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ return (
+ <Suspense>
+ <NavigationProviderInner>{children}</NavigationProviderInner>
+ </Suspense>
+ );
+}
diff --git a/apps/web/platform/workspace.ts b/apps/web/platform/workspace.ts
index b727868c61..3c16a6d834 100644
--- a/apps/web/platform/workspace.ts
+++ b/apps/web/platform/workspace.ts
@@ -1,4 +1,6 @@
-import { createWorkspaceStore } from "@multica/core/workspace";
+import { createWorkspaceStore, registerWorkspaceStore } from "@multica/core/workspace";
import { api } from "./api";
export const useWorkspaceStore = createWorkspaceStore(api);
+
+registerWorkspaceStore(useWorkspaceStore);
diff --git a/docs/design.md b/docs/design.md
new file mode 100644
index 0000000000..3a0bb9a65f
--- /dev/null
+++ b/docs/design.md
@@ -0,0 +1,421 @@
+# Multica Design System
+
+本文档定义 Multica 的视觉语言和交互规范。所有 UI 开发以此为准。
+
+---
+
+## 1. 设计哲学
+
+三条核心原则:
+
+1. **克制即高级。** 默认做减法。每个元素必须有存在的理由——多余的分割线、装饰性图标、"以防万一"的提示文字,都是噪音。留白本身就是设计。
+2. **层次靠灰度,颜色是信号。** 界面的主体是中性色。颜色只在需要传递语义时出现(状态、品牌、错误)。如果两个区域在视觉上竞争注意力,解法是让一个退后,而不是两个都加色。
+3. **一致性大于个性。** 同类交互必须有相同的视觉反馈。一个 hover 效果在 sidebar、dropdown、table row 里应该"感觉一样"。这种一致性通过 token 而非硬编码实现。
+
+---
+
+## 2. 颜色体系
+
+基于 OKLCh 色彩空间,通过 CSS 变量定义。所有颜色使用 shadcn token,**禁止硬编码 Tailwind 色值**(如 `text-gray-500`、`bg-blue-600`)。
+
+### 2.1 中性色阶梯
+
+界面 90% 的面积由中性色构成。灰度等级即信息层级:
+
+| 角色 | Light Token | Dark Token | 用途 |
+|------|-------------|------------|------|
+| 背景 | `background` | `background` | 页面底色 |
+| 卡片/浮层 | `card` / `popover` | `card` / `popover` | 容器表面 |
+| 次级表面 | `muted` / `secondary` | `muted` / `secondary` | hover 背景、标签底色 |
+| 边框 | `border` | `border` | 分隔线、输入框边框 |
+| 输入框边框 | `input` | `input` | 比 border 略重 |
+| 主要文字 | `foreground` | `foreground` | 标题、正文 |
+| 次要文字 | `muted-foreground` | `muted-foreground` | 描述、元数据、placeholder |
+| 最强调文字 | `primary` | `primary` | 按钮文字(反色)、关键标签 |
+
+**规则:** 同一屏幕内,文字颜色最多使用 3 个层级(`foreground` / `muted-foreground` / 某个语义色)。超过 3 级说明层次设计有问题。
+
+### 2.2 语义色
+
+颜色只用于传递含义,不做装饰:
+
+| Token | 含义 | 使用场景 |
+|-------|------|----------|
+| `brand` | 品牌标识 | Logo、品牌按钮、极少量强调 |
+| `destructive` | 危险/错误 | 删除按钮、表单校验错误、危险操作 |
+| `success` | 成功 | 状态标签(完成、已解决) |
+| `warning` | 警告 | 注意状态、到期提醒 |
+| `info` | 信息 | 提示、链接、次要信息标记 |
+| `priority` | 优先级 | 高优先级标签 |
+
+**规则:**
+- 语义色主要用于小面积元素(badge、icon、border)。大面积着色用该色的 10%-20% 透明度变体(如 `bg-destructive/10`)。
+- 每屏同时出现的语义色不宜超过 2-3 种。如果一个界面同时有红黄绿蓝紫,说明信息密度过高,需要重新组织。
+
+### 2.3 暗色模式
+
+暗色模式不是简单的反转。它是独立设计的一套配色:
+
+- 背景使用深灰(`oklch(0.18 ...)`),不是纯黑——纯黑在 LCD 屏上刺眼。
+- 边框使用 `oklch(1 0 0 / 10%)`(白色 10% 透明度),比 light 模式更微妙。
+- 语义色在 dark 模式下适当提亮(如 `success` 从 `0.55` 提到 `0.65`),保证对比度。
+- 所有 UI 变更必须同时在两个模式下验证。
+
+---
+
+## 3. 字体规范
+
+### 3.1 字体家族
+
+| 角色 | 字体 | 用途 |
+|------|------|------|
+| 正文/UI | Geist Sans (`--font-sans`) | 所有界面文字的默认字体 |
+| 代码/数据 | Geist Mono (`--font-mono`) | 代码块、ID、时间戳、等宽数据 |
+| 标题 | `--font-heading`(= `--font-sans`) | 页面标题、区块标题 |
+
+### 3.2 字号纪律
+
+**整个项目只使用 3 个核心字号 + 1 个特殊字号:**
+
+| Tailwind Class | 大小 | 角色 | 使用场景 |
+|----------------|------|------|----------|
+| `text-base` (16px) | 正文 | 页面标题、主要内容 | 页面标题、编辑器正文、空状态说明 |
+| `text-sm` (14px) | 默认 | 界面的主力字号 | 菜单项、按钮、表单、列表项、正文 |
+| `text-xs` (12px) | 辅助 | 元数据、标签 | badge 文字、时间戳、状态栏、次要信息 |
+| `text-[0.8rem]` | 过渡 | 仅限 sm 按钮 | shadcn button size="sm" 专用 |
+
+**禁止:**
+- 使用 `text-lg`、`text-xl`、`text-2xl` 等——任务管理工具追求信息密度,不需要大字号。
+- 使用任意像素值如 `text-[11px]`、`text-[13px]`——坚持 Tailwind 内置 scale。
+- 在同一个区块里混用超过 2 个字号。如果需要第 3 个字号来区分层次,先试试用 `font-medium` vs `font-normal` 或 `text-muted-foreground` 来解决。
+
+### 3.3 字重
+
+只使用两个:
+
+| 字重 | 用途 |
+|------|------|
+| `font-normal` (400) | 正文、描述、大部分文字 |
+| `font-medium` (500) | 标签、按钮、导航项、标题、选中状态 |
+
+**禁止** `font-bold` / `font-semibold`——它们在 Geist 字体下显得突兀,破坏界面的"轻"感。如果需要更强的强调,用更大的字号或 `foreground` 色值,而不是加粗。
+
+---
+
+## 4. 间距体系
+
+基于 Tailwind 的 4px 基础网格。间距传递信息——它不只是"好看",而是告诉用户"什么属于什么"。
+
+### 4.1 间距语义
+
+| 间距 | Tailwind | 含义 |
+|------|----------|------|
+| 4px | `gap-1` / `p-1` | **紧密关联** — icon 与文字、label 与值 |
+| 6px | `gap-1.5` / `p-1.5` | **组件内部** — 按钮内部 padding、列表项间距 |
+| 8px | `gap-2` / `p-2` | **同组不同项** — 表单字段间、列表项间 |
+| 12px | `gap-3` / `p-3` | **小节内** — 卡片内部 padding |
+| 16px | `gap-4` / `p-4` | **组间分隔** — 不同区块之间 |
+| 24px | `gap-6` / `p-6` | **大节分隔** — 页面主要区域间 |
+
+**规则:如果需要分割线,说明间距不够。** 优先通过增大间距来分隔内容,而不是加 `<Separator />`。分割线应该是最后手段。
+
+### 4.2 容器策略(按优先级排序)
+
+当需要在视觉上分隔两个区域时:
+
+1. **仅间距** — 增大两个区域的间距(首选)
+2. **单条分割线** — 一根细线 `border-border`
+3. **背景色变化** — 一个区域用 `bg-muted` 或 `bg-card`
+4. **完整卡片** — border + radius + padding(最重手段)
+
+用最轻的工具完成分隔。
+
+---
+
+## 5. 交互状态
+
+这是设计一致性的核心。每种状态必须在所有组件中表现一致。
+
+### 5.1 状态层级概览
+
+```
+默认 (rest) → hover → active/pressed → selected/active → focused → disabled
+```
+
+### 5.2 Hover 状态
+
+Hover 是"我注意到你了",视觉变化应该轻微、即时:
+
+| 元素类型 | Hover 效果 | Token |
+|----------|-----------|-------|
+| 列表项/菜单项 | 背景变浅灰 | `hover:bg-muted` |
+| Ghost 按钮 | 背景变浅灰 + 文字变前景色 | `hover:bg-muted hover:text-foreground` |
+| 次要按钮 | 背景加深 20% | `hover:bg-secondary/80` |
+| 主按钮 | 背景加深 20% | `hover:bg-primary/80` |
+| 文字链接 | 下划线出现 | `hover:underline` |
+| Tab 标签 | 文字从次要变主要 | `hover:text-foreground`(从 `text-muted-foreground`) |
+| 图标按钮 | 背景变浅灰 | `hover:bg-muted` |
+| 危险按钮 | 背景透明度加深 | `hover:bg-destructive/20` |
+
+**规则:**
+- hover 时不改变尺寸(无 `scale`)、不加阴影(无 `shadow`)。
+- hover 的背景色永远比 selected/active 更淡。这样用户能区分"悬停"和"已选中"。
+- 所有 hover 使用 `transition-colors` 或 `transition-all`,时长由 Tailwind 默认值(150ms)处理,不需要自定义。
+
+### 5.3 Active / Selected 状态
+
+Active 是"我已经被选中了",视觉比 hover 更重:
+
+| 元素类型 | Active 效果 | Token |
+|----------|------------|-------|
+| Sidebar 菜单项 | 背景 + 文字加重 + font-medium | `data-active:bg-sidebar-accent data-active:font-medium` |
+| Tab | 下方指示条 + 文字变前景色 + font-medium | `data-[state=active]:text-foreground` |
+| 列表选中行 | 背景加深 | `bg-muted` 或 `bg-accent` |
+| Toggle(开) | 背景反色 | `data-[state=on]:bg-primary data-[state=on]:text-primary-foreground` |
+
+**关键区分:** Hover = `bg-muted`,Active = `bg-muted` + `font-medium` + `text-foreground`。Active 始终比 hover 多一个视觉维度(字重或颜色变化),而不仅仅是背景更深。
+
+### 5.3.1 Active 不被 Hover 覆盖
+
+这是最容易出 bug 的地方:用户 hover 到一个已选中的项目上,hover 样式覆盖了 active 样式,导致选中态"闪回"普通 hover 态,视觉上像取消了选中。
+
+**原则:Active 状态在任何时候都必须保持可辨识——包括被 hover 时。**
+
+实现方式:
+
+**方式一:Active 使用 hover 不涉及的维度**
+
+如果 hover 只改背景,那 active 用字重 + 文字颜色来区分。即使 hover 背景叠上去,字重和颜色不变,用户仍能识别"这个是选中的":
+
+```
+// ✅ hover 只管背景,active 靠字重和颜色
+hover:bg-muted // hover:浅灰背景
+data-active:font-medium data-active:text-foreground // active:字重+颜色(hover 不会覆盖)
+```
+
+**方式二:Active + Hover 组合样式**
+
+当 active 也用了背景色时,需要显式定义 "active 且 hover" 的复合状态,确保 hover 不会把 active 的背景拉回低层级:
+
+```tsx
+// ✅ 显式处理 active+hover 复合态
+cn(
+ "hover:bg-muted/50", // 普通 hover
+ "data-active:bg-muted data-active:text-foreground", // active
+ "data-active:hover:bg-muted" // active+hover:保持 active 背景,不降级
+)
+```
+
+```tsx
+// ❌ 反例:hover 覆盖 active
+cn(
+ "hover:bg-muted/50", // hover 背景比 active 更淡
+ "data-active:bg-muted", // active 背景
+ // 没有处理复合态 → hover 到 active 项时背景从 muted 闪回 muted/50
+)
+```
+
+**方式三:CSS 选择器优先级**
+
+利用 `:not()` 让 hover 只作用于非 active 的元素:
+
+```
+// ✅ hover 不作用于 active 项
+[data-active]:bg-muted [data-active]:text-foreground
+not-data-active:hover:bg-muted/50
+```
+
+**检查方法:** 写完任何带 hover + active 状态的组件后,必须手动验证——先点击选中一项,然后鼠标移到该项上再移开,确认视觉不会"闪烁"或"降级"。
+
+### 5.4 Pressed 状态
+
+物理反馈感——按下按钮时有微小的位移:
+
+```
+active:not-aria-[haspopup]:translate-y-px
+```
+
+这个 1px 的下移在 shadcn button 上已全局配置。对于触发弹出菜单的按钮不添加(因为弹出即松开,位移会闪烁)。
+
+### 5.5 Focus 状态
+
+Focus 为键盘导航服务。所有可交互元素统一使用:
+
+```
+focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50
+```
+
+- 使用 `focus-visible`(非 `focus`),避免鼠标点击时出现 focus ring。
+- ring 颜色使用 `ring` token(中灰),不跟组件颜色走——保持全局一致。
+
+### 5.6 Disabled 状态
+
+```
+disabled:pointer-events-none disabled:opacity-50
+```
+
+简单统一。不需要为每个组件定制 disabled 样式。
+
+### 5.7 Error / Invalid 状态
+
+```
+aria-invalid:border-destructive aria-invalid:ring-destructive/20
+```
+
+- 使用 `aria-invalid` 属性触发,与表单校验库自然对接。
+- 只改变边框和 ring,不改背景。错误信息用内联文字展示,不用 toast 或 alert banner。
+
+---
+
+## 6. 图标规范
+
+### 6.1 图标库
+
+统一使用 **Lucide React**(`lucide-react`)。
+
+禁止混用其他图标库(Heroicons、Phosphor 等),也禁止自制 SVG 图标(除非 Lucide 确实没有合适的)。
+
+### 6.2 图标尺寸
+
+图标尺寸与组件尺寸绑定:
+
+| 组件尺寸 | 图标尺寸 | 示例 |
+|----------|---------|------|
+| xs(h-6) | `size-3` (12px) | 紧凑按钮、badge 内图标 |
+| sm(h-7) | `size-3.5` (14px) | 小按钮、紧凑列表 |
+| default(h-8) | `size-4` (16px) | 标准按钮、菜单项、表格操作 |
+| lg(h-9) | `size-4` (16px) | 大按钮(图标不需要更大) |
+
+**规则:**
+- 独立装饰性图标(如空状态插图)最大 `size-8` (32px)。
+- 所有图标默认继承父元素文字颜色。需要弱化时用 `text-muted-foreground`。
+- 图标与文字的间距:`gap-1`(xs)/ `gap-1.5`(sm/default)/ `gap-2`(宽松排列)。
+
+### 6.3 图标颜色
+
+- **导航/操作图标:** `text-muted-foreground`,hover 时跟随文字变为 `text-foreground`
+- **状态图标:** 使用对应语义色(如 `text-success`、`text-destructive`)
+- **Active 状态图标:** `text-foreground`
+
+---
+
+## 7. 圆角规范
+
+基于 `--radius: 0.625rem`(10px)的动态 scale:
+
+| Token | 值 | 用途 |
+|-------|-----|------|
+| `rounded-sm` | 6px | Checkbox、小标签 |
+| `rounded-md` | 8px | 输入框、小按钮、dropdown item |
+| `rounded-lg` | 10px | 标准按钮、卡片、dialog |
+| `rounded-xl` | 14px | 大卡片、sheet |
+| `rounded-full` | 999px | 头像、pill badge |
+
+**禁止** 硬编码像素值如 `rounded-[6px]`(除非 shadcn 组件内部需要响应式计算如 `rounded-[min(var(--radius-md),12px)]`)。
+
+---
+
+## 8. 动效规范
+
+### 8.1 原则
+
+- **快速、克制。** 动效是为了帮助用户理解变化,不是展示技术。
+- **淡入淡出优先。** 元素出现/消失优先用 opacity 过渡,而不是滑动。
+- **无弹跳。** 不使用 spring / bounce 缓动。缓动曲线统一用 `ease-out`。
+
+### 8.2 时长
+
+| 场景 | 时长 | 示例 |
+|------|------|------|
+| 颜色/透明度变化 | 150ms | hover 背景变化、文字颜色变化 |
+| 展开/收起 | 200ms | accordion、collapsible |
+| 弹层出入 | 150-200ms | dialog、dropdown、popover |
+| 页面切换 | 无动效 | 路由跳转无过渡动画 |
+
+### 8.3 使用的 transition
+
+| Tailwind Class | 用途 |
+|----------------|------|
+| `transition-colors` | 纯颜色变化(hover、active)— 首选 |
+| `transition-all` | 多属性同时变化 |
+| `transition-opacity` | 元素淡入淡出 |
+| `transition-transform` | 位移动画(pressed 效果) |
+
+---
+
+## 9. 组件使用规范
+
+### 9.1 shadcn 优先
+
+所有 UI 组件优先使用已安装的 shadcn 组件(55 个可用)。新增 UI 需求时:
+
+1. 先查 shadcn 是否有对应组件 → `npx shadcn add <component>`
+2. 需要变体 → 用 CVA 在现有组件上扩展
+3. 确实没有 → 自建组件,但必须遵循本规范的 token / 交互状态
+
+### 9.2 按钮层级
+
+从最强调到最弱:
+
+| 变体 | 视觉重量 | 使用场景 |
+|------|---------|----------|
+| `default`(primary) | ██████ | 页面主操作(每屏最多 1 个) |
+| `outline` | ████░░ | 次要操作 |
+| `secondary` | ███░░░ | 辅助操作、工具栏 |
+| `ghost` | █░░░░░ | 图标按钮、内联操作、紧凑工具栏 |
+| `destructive` | ████░░ | 删除、危险操作(红色调) |
+| `link` | █░░░░░ | 内联文字链接 |
+
+**规则:** 一个视图里的 primary 按钮最多 1 个。其他都用更弱的变体。如果有多个同等重要的操作,全部用 `outline` 或 `secondary`。
+
+### 9.3 Dropdown / Popover
+
+- 内容宽度使用 `w-auto`,**禁止** 固定宽度如 `w-52`、`w-56`(会导致文字换行)。
+- 菜单项统一 `text-sm`,图标 `size-4`。
+- 选中项通过 checkmark 图标或左侧指示条标记,不改变背景色。
+- 危险操作项使用 `text-destructive`,放在最底部,上方用分割线隔开。
+
+### 9.4 表单输入
+
+- 输入框统一使用 `border-input` 边框,focus 时 `border-ring` + ring。
+- Label 使用 `text-sm font-medium`。
+- 描述/帮助文字使用 `text-xs text-muted-foreground`。
+- 错误信息使用 `text-xs text-destructive`,放在输入框正下方。
+
+---
+
+## 10. 反模式清单
+
+以下做法**禁止**出现在代码中:
+
+| 禁止 | 原因 | 替代 |
+|------|------|------|
+| 硬编码颜色 `text-red-500`、`bg-gray-100` | 破坏主题一致性 | 使用 token:`text-destructive`、`bg-muted` |
+| 任意像素 `text-[11px]`、`w-[137px]` | 脱离设计系统 | 使用 Tailwind 内置 scale |
+| `font-bold` / `font-semibold` | 过重,破坏轻感 | `font-medium` + `text-foreground` |
+| `text-lg` / `text-xl` / `text-2xl` | 信息密度型工具不需要大字 | `text-base` 已是最大 |
+| `shadow-sm` / `shadow-md` / `shadow-lg` | 拟物风格,与扁平设计冲突 | 使用 `border` 分隔层级 |
+| hover 时 `scale-105` | 突兀,与克制风格冲突 | `hover:bg-muted` |
+| 多色 gradient 背景 | 装饰性,分散注意力 | 纯色 token |
+| Skeleton loading | 与简洁风格不匹配 | Spinner(`Loader2Icon animate-spin`)或内联 loading 文字 |
+| Toast 做操作确认 | 转瞬即逝,用户容易错过 | 内联状态文字或 Sonner 仅用于错误/重要提示 |
+| 固定宽度 dropdown `w-52` | 文字换行不可控 | `w-auto` |
+| 纯黑背景 `#000` / `oklch(0 0 0)` | LCD 上刺眼 | Dark 模式用深灰 `background` token |
+
+---
+
+## 11. 检查清单
+
+在提交任何 UI 变更前,过一遍:
+
+- [ ] 所有颜色是否使用 token?有没有硬编码?
+- [ ] 字号是否只在 `text-xs` / `text-sm` / `text-base` 范围内?
+- [ ] 字重是否只用了 `font-normal` 和 `font-medium`?
+- [ ] Hover 状态是否比 active 状态更淡?
+- [ ] Active 项被 hover 时,active 样式是否仍然可辨识(不被 hover 覆盖)?
+- [ ] 图标尺寸是否与组件尺寸匹配?
+- [ ] 间距是否使用 Tailwind 内置 scale(无任意值)?
+- [ ] Dark 模式下是否正常?
+- [ ] 有没有不必要的分割线(可以用间距替代)?
+- [ ] Dropdown / Popover 是否 `w-auto`?
+- [ ] 一个视图里 primary 按钮是否不超过 1 个?
diff --git a/docs/plans/2026-04-08-monorepo-extraction.md b/docs/plans/2026-04-08-monorepo-extraction.md
new file mode 100644
index 0000000000..3e5627cef3
--- /dev/null
+++ b/docs/plans/2026-04-08-monorepo-extraction.md
@@ -0,0 +1,489 @@
+# Monorepo Extraction Implementation Plan
+
+> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
+
+**Goal:** Extract shared code into monorepo packages (`packages/core/`, `packages/ui/`, `packages/views/`), set up Turborepo, ensure `apps/web/` runs identically.
+
+**Architecture:** Three packages, single-direction dependencies: `views/ → core/ + ui/`. Core is headless (zero react-dom). UI is atomic (zero business logic). Views is shared pages/components.
+
+**Tech Stack:** pnpm workspaces + catalog, Turborepo, TypeScript internal packages (export TS source, no build), Tailwind CSS v4, shadcn/ui.
+
+**Scope:** Monorepo extraction only. Desktop app is a separate future plan.
+
+**Branch:** `feat/monorepo-extraction` (from latest `main` at f57cf44e)
+
+---
+
+## Work Breakdown
+
+| Category | Files | Nature |
+|---|---|---|
+| Pure file moves | ~170 | Copy + fix relative imports |
+| Code changes needed | ~17 | ApiClient callback, store factories, props refactor, nav adapter |
+| Bulk import updates | ~140 consumer files | Mechanical find-and-replace |
+| New files to create | ~15 | package.json, tsconfig, turbo.json, platform layer, nav adapter |
+
+---
+
+## Phase 1: Infrastructure (Tasks 1-3)
+
+### Task 1: Turborepo + workspace
+
+**Files:**
+- Modify: `pnpm-workspace.yaml` — add `"packages/*"` to packages list, add `@tanstack/react-query` to catalog
+- Create: `turbo.json`
+- Modify: `package.json` (root) — add turbo devDep, update scripts to use turbo
+- Modify: `.gitignore` — add `.turbo`
+
+**turbo.json:**
+```json
+{
+ "$schema": "https://turbo.build/schema.json",
+ "tasks": {
+ "build": {
+ "dependsOn": ["^build"],
+ "inputs": ["src/**", "app/**", "**/*.ts", "**/*.tsx", "**/*.css"],
+ "outputs": [".next/**", "!.next/cache/**", "dist/**"]
+ },
+ "dev": { "cache": false, "persistent": true },
+ "typecheck": { "dependsOn": ["^typecheck"] },
+ "test": { "dependsOn": ["^typecheck"] },
+ "lint": { "dependsOn": ["^typecheck"] }
+ }
+}
+```
+
+**Verify:** `pnpm typecheck` passes through turbo.
+
+**Commit:** `chore: add Turborepo and configure workspace for packages/*`
+
+---
+
+### Task 2: Shared TypeScript config
+
+**Files:**
+- Create: `packages/tsconfig/package.json`
+- Create: `packages/tsconfig/base.json`
+- Create: `packages/tsconfig/react-library.json`
+
+**base.json** — strict, ESNext, bundler resolution, declaration maps.
+**react-library.json** — extends base, adds jsx: react-jsx and DOM lib.
+
+All other packages will `"extends": "@multica/tsconfig/react-library.json"`.
+
+**Commit:** `chore: add shared TypeScript config package`
+
+---
+
+### Task 3: Clean up empty package dirs
+
+**Action:** `rm -rf packages/sdk packages/types packages/utils packages/ui`
+
+These are leftover empty dirs (only contain node_modules).
+
+---
+
+## Phase 2: packages/core/ (Tasks 4-10)
+
+### Task 4: Scaffold + move types/utils/logger
+
+**Files:**
+- Create: `packages/core/package.json` (name: @multica/core, deps: react, zustand, @tanstack/react-query, sonner)
+- Create: `packages/core/tsconfig.json` (extends @multica/tsconfig/react-library.json)
+- Move: `apps/web/shared/types/` → `packages/core/types/` (11 files, no changes needed)
+- Move: `apps/web/shared/logger.ts` → `packages/core/logger.ts` (no changes)
+- Move: `apps/web/shared/utils.ts` → `packages/core/utils.ts` (no changes)
+
+**Verify:** `cd packages/core && npx tsc --noEmit`
+
+---
+
+### Task 5: Move API client (with onUnauthorized abstraction)
+
+**Files:**
+- Move: `apps/web/shared/api/ws-client.ts` → `packages/core/api/ws-client.ts` (no changes)
+- Move: `apps/web/shared/api/client.ts` → `packages/core/api/client.ts` (**3 changes**)
+- Create: `packages/core/api/index.ts`
+
+**Code changes in client.ts:**
+1. `import type { ... } from "@/shared/types"` → `from "../types"`
+2. `import { ... } from "@/shared/logger"` → `from "../logger"`
+3. Add `onUnauthorized?: () => void` to options, replace `handleUnauthorized()` body:
+ ```typescript
+ // Before: localStorage.removeItem + window.location.href = "/"
+ // After: this.token = null; this.workspaceId = null; this.options.onUnauthorized?.();
+ ```
+
+**NOT moved:** `apps/web/shared/api/index.ts` (the singleton) — replaced by `apps/web/platform/api.ts` in Task 9.
+
+---
+
+### Task 6: Move stores
+
+**Pure moves (fix imports only):**
+- `features/issues/store.ts` → `packages/core/issues/store.ts`
+- `features/issues/config/*.ts` → `packages/core/issues/config/` — fix `@/shared/types` → `../../types`
+- `features/issues/stores/view-store.ts` → `packages/core/issues/stores/view-store.ts` — fix imports
+- `features/issues/stores/view-store-context.tsx` → `packages/core/issues/stores/view-store-context.tsx`
+- `features/issues/stores/draft-store.ts` → `packages/core/issues/stores/draft-store.ts`
+- `features/issues/stores/issues-scope-store.ts` → `packages/core/issues/stores/issues-scope-store.ts`
+- `features/issues/stores/selection-store.ts` → `packages/core/issues/stores/selection-store.ts`
+- `features/navigation/store.ts` → `packages/core/navigation/store.ts` (no changes)
+- `features/modals/store.ts` → `packages/core/modals/store.ts` (no changes)
+
+**Factory refactor (code changes):**
+- `features/auth/store.ts` → `packages/core/auth/store.ts` — change to `createAuthStore({ api, onLogin?, onLogout? })` factory
+- `features/workspace/store.ts` → `packages/core/workspace/store.ts` — change to `createWorkspaceStore(api)` factory
+
+**Also move:**
+- `features/workspace/hooks.ts` → `packages/core/workspace/hooks.ts` — fix imports to relative
+
+**view-store.ts special handling:** The dynamic `import("@/features/workspace")` for workspace sync — change to accept workspace store instance via `registerViewStoreForWorkspaceSync(viewStore, workspaceStore)`.
+
+---
+
+### Task 7: Move TanStack Query modules
+
+**Pure moves (fix import paths only):**
+- `apps/web/core/issues/{queries,mutations,ws-updaters}.ts` → `packages/core/issues/`
+- `apps/web/core/inbox/{queries,mutations,ws-updaters}.ts` → `packages/core/inbox/`
+- `apps/web/core/workspace/{queries,mutations}.ts` → `packages/core/workspace/`
+- `apps/web/core/runtimes/queries.ts` → `packages/core/runtimes/`
+- `apps/web/core/query-client.ts` → `packages/core/query-client.ts`
+- `apps/web/core/provider.tsx` → `packages/core/provider.tsx`
+
+All changes: `@/shared/api` → `../api`, `@/shared/types` → `../types`, `@core/xxx` → `./xxx` or `../xxx`
+
+**Code change:**
+- `apps/web/core/hooks.ts` → `packages/core/hooks.ts` — refactor `useWorkspaceId()` to use React Context instead of importing workspace store directly:
+ ```typescript
+ const WorkspaceIdContext = createContext<string | null>(null);
+ export function WorkspaceIdProvider({ wsId, children }) { ... }
+ export function useWorkspaceId() { return useContext(WorkspaceIdContext); }
+ ```
+
+---
+
+### Task 8: Move realtime + shared hooks
+
+**Pure moves (fix imports):**
+- `features/realtime/hooks.ts` → `packages/core/realtime/hooks.ts`
+- `features/realtime/use-realtime-sync.ts` → `packages/core/realtime/use-realtime-sync.ts`
+- `shared/hooks/use-file-upload.ts` → `packages/core/hooks/use-file-upload.ts`
+
+**Code change:**
+- `features/realtime/provider.tsx` → `packages/core/realtime/provider.tsx` — accept `wsUrl` prop instead of reading `process.env.NEXT_PUBLIC_WS_URL`
+
+**Note:** `use-realtime-sync.ts` needs auth/workspace store access. Since these are now factories, the realtime provider should receive the store instances. Simplest: WSProvider accepts `authStore` and `workspaceStore` props, passes them to `useRealtimeSync`.
+
+---
+
+### Task 9: Create platform bridge in apps/web/
+
+**New files (all new code):**
+- `apps/web/platform/api.ts` — creates api singleton with `NEXT_PUBLIC_API_URL`, `onUnauthorized` with `window.location.href`
+- `apps/web/platform/auth.ts` — `export const useAuthStore = createAuthStore({ api, onLogin: setLoggedInCookie, onLogout: clearLoggedInCookie })`
+- `apps/web/platform/workspace.ts` — `export const useWorkspaceStore = createWorkspaceStore(api)`
+- `apps/web/platform/index.ts` — re-exports
+
+---
+
+### Task 10: Update imports in apps/web/ + delete old files
+
+**Bulk find-and-replace across ~94 files:**
+
+| Pattern | Replacement |
+|---|---|
+| `@/shared/types` | `@multica/core/types` |
+| `@/shared/api"` (singleton usage) | `@/platform/api"` |
+| `@/shared/logger` | `@multica/core/logger` |
+| `@/shared/utils` | `@multica/core/utils` |
+| `@/shared/hooks/` | `@multica/core/hooks/` |
+| `@core/` | `@multica/core/` |
+| `@/features/auth"` (useAuthStore) | `@/platform/auth"` |
+| `@/features/workspace"` (useWorkspaceStore) | `@/platform/workspace"` |
+| `@/features/workspace"` (useActorName) | `@multica/core/workspace/hooks"` |
+| `@/features/realtime` | `@multica/core/realtime` |
+| `@/features/navigation` | `@multica/core/navigation` |
+| `@/features/modals"` (store) | `@multica/core/modals"` |
+| `@/features/issues/store` | `@multica/core/issues` |
+| `@/features/issues/stores/` | `@multica/core/issues/stores/` |
+| `@/features/issues/config` | `@multica/core/issues/config` |
+
+**Also:**
+- Add `"@multica/core": "workspace:*"` to `apps/web/package.json`
+- Add `transpilePackages: ["@multica/core"]` to `next.config.ts`
+- Remove `"@core/*"` alias from `apps/web/tsconfig.json`
+
+**Delete old files:**
+```
+apps/web/shared/types/, apps/web/shared/api/, apps/web/shared/logger.ts,
+apps/web/shared/utils.ts, apps/web/shared/hooks/, apps/web/core/,
+features/auth/store.ts, features/workspace/store.ts, features/workspace/hooks.ts,
+features/realtime/, features/navigation/store.ts, features/modals/store.ts,
+features/issues/store.ts, features/issues/stores/, features/issues/config/
+```
+
+**Keep:** `features/auth/auth-cookie.ts`, `features/auth/initializer.tsx`, `features/landing/`
+
+**Verify:** `pnpm typecheck && pnpm test`
+
+**Commit:** `feat(core): extract packages/core — headless business logic layer`
+
+---
+
+## Phase 3: packages/ui/ (Tasks 11-16)
+
+### Task 11: Scaffold packages/ui/
+
+**Files:**
+- Create: `packages/ui/package.json` (name: @multica/ui, deps: all @radix-ui/*, clsx, tailwind-merge, lucide-react, emoji-mart, react-markdown, shiki, etc.)
+- Create: `packages/ui/tsconfig.json` (extends shared config, with `@/lib/utils`, `@/hooks/*`, `@/components/ui/*` path aliases for internal shadcn imports)
+- Create: `packages/ui/components.json` (shadcn config for this package)
+
+---
+
+### Task 12: Move shadcn + lib + hooks
+
+**Pure moves (no code changes):**
+- `apps/web/components/ui/*.tsx` (56 files) → `packages/ui/components/ui/`
+- `apps/web/lib/utils.ts` → `packages/ui/lib/utils.ts`
+- `apps/web/hooks/{use-auto-scroll,use-mobile,use-scroll-fade}.ts` → `packages/ui/hooks/`
+
+---
+
+### Task 13: Extract CSS tokens
+
+- Copy `@theme inline { ... }` + `:root` + `.dark` blocks from `globals.css` → `packages/ui/styles/tokens.css`
+- Update `globals.css`: replace inline tokens with `@import "@multica/ui/styles/tokens.css"` + add `@source` directives for packages
+
+---
+
+### Task 14: Refactor + move common components
+
+**Code changes (3 files):**
+- `actor-avatar.tsx` — remove `useActorName()`, accept `name/initials/avatarUrl/isAgent` props
+- `mention-hover-card.tsx` — remove `useQuery`, accept resolved data props
+- `reaction-bar.tsx` — remove `useActorName()`, add `getActorName` prop
+
+**Pure moves (3 files):**
+- `file-upload-button.tsx`, `emoji-picker.tsx`, `quick-emoji-picker.tsx` → direct copy
+
+All go to `packages/ui/components/common/`.
+
+---
+
+### Task 15: Move markdown components
+
+**Code change (1 file):**
+- `Markdown.tsx` — add `renderMention?: (props: { type: string; id: string }) => ReactNode` prop, remove hardcoded `IssueMentionCard` import
+
+**Pure moves (5 files):**
+- `CodeBlock.tsx`, `StreamingMarkdown.tsx`, `linkify.ts`, `mentions.ts`, `index.ts`
+
+All go to `packages/ui/markdown/`.
+
+---
+
+### Task 16: Update imports + delete old files
+
+**Bulk find-and-replace across ~118 files:**
+
+| Pattern | Replacement |
+|---|---|
+| `@/components/ui/` | `@multica/ui/components/ui/` |
+| `@/components/common/` | `@multica/ui/components/common/` |
+| `@/components/markdown` | `@multica/ui/markdown` |
+| `@/lib/utils` | `@multica/ui/lib/utils` |
+| `@/hooks/use-mobile` | `@multica/ui/hooks/use-mobile` |
+| `@/hooks/use-auto-scroll` | `@multica/ui/hooks/use-auto-scroll` |
+| `@/hooks/use-scroll-fade` | `@multica/ui/hooks/use-scroll-fade` |
+
+**Also:**
+- Add `"@multica/ui": "workspace:*"` to `apps/web/package.json`
+- Add `"@multica/ui"` to `transpilePackages` in `next.config.ts`
+- Update `apps/web/components.json` aliases to point to `@multica/ui`
+
+**Delete:** `components/ui/`, `components/common/`, `components/markdown/`, `hooks/`, `lib/utils.ts`
+
+**Keep:** `components/{theme-provider,theme-toggle,multica-icon,loading-indicator,spinner,locale-sync}.tsx`
+
+**Verify:** `pnpm typecheck && pnpm test`
+
+**Commit:** `feat(ui): extract packages/ui — shared atomic UI layer`
+
+---
+
+## Phase 4: packages/views/ + navigation (Tasks 17-22)
+
+### Task 17: Create navigation adapter
+
+**New files (all new code, ~60 lines total):**
+- `packages/views/package.json` (deps: @multica/core, @multica/ui, @dnd-kit/*, @tiptap/*, sonner, recharts)
+- `packages/views/tsconfig.json`
+- `packages/views/navigation/types.ts` — `NavigationAdapter` interface (push, replace, back, pathname, searchParams)
+- `packages/views/navigation/context.tsx` — `NavigationProvider` + `useNavigation()` hook
+- `packages/views/navigation/app-link.tsx` — `<AppLink>` component (replaces `next/link`)
+- `packages/views/navigation/index.ts`
+
+---
+
+### Task 18: Create WebNavigationProvider
+
+**New file:**
+- `apps/web/platform/navigation.tsx` — wraps `useRouter`/`usePathname`/`useSearchParams` into `NavigationAdapter`
+
+Wire into dashboard layout.
+
+---
+
+### Task 19: Move feature UI components
+
+**Next.js decouple (7 files, ~2 lines each):**
+
+| File | Import change | JSX change |
+|---|---|---|
+| `issue-mention-card.tsx` | `next/link` → `../navigation` | `<Link` → `<AppLink` |
+| `board-card.tsx` | same | same |
+| `list-row.tsx` | same | same |
+| `issue-detail.tsx` | `next/link` + `next/navigation` → `../navigation` | `<Link` → `<AppLink`, `router.push` → `nav.push` |
+| `create-issue.tsx` | `next/navigation` → `../navigation` | `router.push` → `nav.push` |
+| `create-workspace.tsx` | same | same |
+
+**Pure moves (~85 files, fix import paths only):**
+- `features/issues/components/` (24 files) → `packages/views/issues/components/`
+- `features/issues/hooks/` (3 files) → `packages/views/issues/hooks/`
+- `features/issues/utils/` (5 files) → `packages/views/issues/utils/`
+- `features/editor/` (16 files incl CSS) → `packages/views/editor/`
+- `features/modals/{create-issue,create-workspace,registry}.tsx` → `packages/views/modals/`
+- `features/my-issues/` (4 files) → `packages/views/my-issues/`
+- `features/skills/` (5 files) → `packages/views/skills/`
+- `features/runtimes/` (16 files) → `packages/views/runtimes/`
+- `features/workspace/components/workspace-avatar.tsx` → `packages/views/workspace/`
+
+---
+
+### Task 20: Extract fat pages
+
+Move logic from page.tsx files into packages/views/:
+
+| Page | Lines | Target |
+|---|---|---|
+| `(dashboard)/agents/page.tsx` | 1,280 | `packages/views/agents/agents-page.tsx` |
+| `(dashboard)/inbox/page.tsx` | 468 | `packages/views/inbox/inbox-page.tsx` |
+| `(auth)/login/page.tsx` | 389 | `packages/views/auth/login-page.tsx` |
+
+Each original page.tsx becomes a 3-line thin shell:
+```typescript
+"use client";
+import { AgentsPage } from "@multica/views/agents";
+export default function Page() { return <AgentsPage />; }
+```
+
+Login page: pass `googleClientId` as prop instead of reading env var.
+
+---
+
+### Task 21: Update imports + delete old files
+
+**Bulk find-and-replace across ~18 files:**
+
+| Pattern | Replacement |
+|---|---|
+| `@/features/issues/components` | `@multica/views/issues/components` |
+| `@/features/issues/hooks/` | `@multica/views/issues/hooks/` |
+| `@/features/editor` | `@multica/views/editor` |
+| `@/features/modals/` (components) | `@multica/views/modals/` |
+| `@/features/my-issues` | `@multica/views/my-issues` |
+| `@/features/skills` | `@multica/views/skills` |
+| `@/features/runtimes` | `@multica/views/runtimes` |
+
+**Also:**
+- Add `"@multica/views": "workspace:*"` to `apps/web/package.json`
+- Add `"@multica/views"` to `transpilePackages`
+- Add `@source "../../packages/views/**/*.tsx"` to `globals.css`
+
+**Delete old feature files.**
+
+**Verify:** `pnpm typecheck && pnpm test`
+
+**Commit:** `feat(views): extract packages/views — shared business UI + navigation adapter`
+
+---
+
+### Task 22: Final verification
+
+```bash
+make check # typecheck + unit tests + Go tests + E2E
+cd apps/web && npx shadcn@latest add --dry-run badge # shadcn CLI works
+
+# Package constraints
+grep -r "@multica/core" packages/ui/ || echo "PASS: ui/ has zero core imports"
+grep -r "react-dom" packages/core/ || echo "PASS: core/ has zero react-dom"
+grep -r "from \"next/" packages/views/ || echo "PASS: views/ has zero next/* imports"
+```
+
+**Commit:** `chore: monorepo extraction complete — all checks pass`
+
+---
+
+## Final Directory Structure
+
+```
+multica/
+├── packages/
+│ ├── tsconfig/ # Shared TS config
+│ ├── core/ # @multica/core — 三端共用 (零 react-dom)
+│ │ ├── api/ # ApiClient class + WSClient
+│ │ ├── types/ # 所有领域类型
+│ │ ├── auth/ # createAuthStore factory
+│ │ ├── workspace/ # createWorkspaceStore factory + useActorName
+│ │ ├── issues/ # stores, config, queries, mutations, ws-updaters
+│ │ ├── inbox/ # queries, mutations, ws-updaters
+│ │ ├── runtimes/ # queries
+│ │ ├── realtime/ # WSProvider, hooks, sync
+│ │ ├── navigation/ # useNavigationStore
+│ │ ├── modals/ # useModalStore
+│ │ └── hooks.ts # useWorkspaceId (Context-based)
+│ ├── ui/ # @multica/ui — Web+Desktop 共用 (零业务逻辑)
+│ │ ├── components/ui/ # 56 shadcn 组件
+│ │ ├── components/common/ # actor-avatar, emoji-picker... (纯 props)
+│ │ ├── markdown/ # Markdown, StreamingMarkdown (renderMention slot)
+│ │ ├── hooks/ # use-auto-scroll, use-mobile, use-scroll-fade
+│ │ ├── lib/utils.ts # cn()
+│ │ └── styles/tokens.css
+│ └── views/ # @multica/views — Web+Desktop 共用页面
+│ ├── navigation/ # NavigationAdapter + AppLink
+│ ├── issues/ # IssuesPage, IssueDetail, BoardView...
+│ ├── editor/ # ContentEditor, TitleEditor
+│ ├── modals/ # CreateIssue, CreateWorkspace
+│ ├── agents/ # AgentsPage (从 1280 行 page.tsx 提取)
+│ ├── inbox/ # InboxPage (从 468 行 page.tsx 提取)
+│ ├── auth/ # LoginPage (从 389 行 page.tsx 提取)
+│ ├── my-issues/ # MyIssuesPage
+│ ├── skills/ # SkillsPage
+│ └── runtimes/ # RuntimesPage
+├── apps/
+│ └── web/
+│ ├── app/ # Next.js 路由薄壳 (每个 page < 15 行)
+│ ├── platform/ # Web 平台适配 (api 单例, auth store, nav provider)
+│ ├── features/
+│ │ ├── auth/ # auth-cookie.ts (Web 独有) + initializer.tsx
+│ │ └── landing/ # Landing 页面 (Web 独有, 用 next/image)
+│ └── components/ # theme-provider, multica-icon 等 app 级组件
+├── turbo.json
+└── pnpm-workspace.yaml
+```
+
+---
+
+## Execution Order & Commits
+
+| # | Commit | 影响范围 | 风险 |
+|---|---|---|---|
+| 1 | `chore: Turborepo + workspace` | 配置文件 | 低 |
+| 2 | `chore: shared TypeScript config` | 新文件 | 低 |
+| 3 | `feat(core): extract packages/core` | 94 文件 import 变更 | 中 — 最大批量替换 |
+| 4 | `feat(ui): extract packages/ui` | 118 文件 import 变更 | 中 — 最多文件 |
+| 5 | `feat(views): extract packages/views` | 18 文件 + 3 胖壳 | 中 |
+| 6 | `chore: final verification` | 0 | 低 |
diff --git a/packages/core/api/index.ts b/packages/core/api/index.ts
index 232cfbf666..9efbffb471 100644
--- a/packages/core/api/index.ts
+++ b/packages/core/api/index.ts
@@ -23,8 +23,9 @@ export function getApi(): ApiClientType {
*/
export const api = new Proxy({} as ApiClientType, {
get(_target, prop, receiver) {
- const instance = getApi();
- const value = Reflect.get(instance, prop, receiver);
- return typeof value === "function" ? value.bind(instance) : value;
+ // Allow property inspection (HMR/React Refresh) before initialisation
+ if (!_api) return undefined;
+ const value = Reflect.get(_api, prop, receiver);
+ return typeof value === "function" ? value.bind(_api) : value;
},
});
diff --git a/packages/core/auth/index.ts b/packages/core/auth/index.ts
index 609dc1d21f..5d5e5f96fc 100644
--- a/packages/core/auth/index.ts
+++ b/packages/core/auth/index.ts
@@ -1,2 +1,39 @@
export { createAuthStore } from "./store";
export type { AuthStoreOptions, AuthState } from "./store";
+
+import type { createAuthStore as CreateAuthStoreFn } from "./store";
+
+type AuthStoreInstance = ReturnType<typeof CreateAuthStoreFn>;
+
+/** Module-level singleton — set once at app boot via `registerAuthStore()`. */
+let _store: AuthStoreInstance | null = null;
+
+/**
+ * Register the auth store instance created by the app.
+ * Must be called at boot before any component renders.
+ */
+export function registerAuthStore(store: AuthStoreInstance) {
+ _store = store;
+}
+
+/**
+ * Singleton accessor — a Zustand hook backed by the registered instance.
+ * Supports `useAuthStore(selector)` and `useAuthStore.getState()`.
+ */
+export const useAuthStore: AuthStoreInstance = new Proxy(
+ (() => {}) as unknown as AuthStoreInstance,
+ {
+ apply(_target, _thisArg, args) {
+ if (!_store)
+ throw new Error(
+ "Auth store not initialised — call registerAuthStore() first",
+ );
+ return (_store as unknown as (...a: unknown[]) => unknown)(...args);
+ },
+ get(_target, prop) {
+ // Allow property inspection (HMR/React Refresh) before registration
+ if (!_store) return undefined;
+ return Reflect.get(_store, prop);
+ },
+ },
+);
diff --git a/packages/core/workspace/index.ts b/packages/core/workspace/index.ts
index 09535cfcd3..b02f220565 100644
--- a/packages/core/workspace/index.ts
+++ b/packages/core/workspace/index.ts
@@ -2,3 +2,40 @@ export * from "./store";
export * from "./queries";
export * from "./mutations";
export * from "./hooks";
+
+import type { createWorkspaceStore as CreateWorkspaceStoreFn } from "./store";
+
+type WorkspaceStoreInstance = ReturnType<typeof CreateWorkspaceStoreFn>;
+
+/** Module-level singleton — set once at app boot via `registerWorkspaceStore()`. */
+let _store: WorkspaceStoreInstance | null = null;
+
+/**
+ * Register the workspace store instance created by the app.
+ * Must be called at boot before any component renders.
+ */
+export function registerWorkspaceStore(store: WorkspaceStoreInstance) {
+ _store = store;
+}
+
+/**
+ * Singleton accessor — a Zustand hook backed by the registered instance.
+ * Supports `useWorkspaceStore(selector)` and `useWorkspaceStore.getState()`.
+ */
+export const useWorkspaceStore: WorkspaceStoreInstance = new Proxy(
+ (() => {}) as unknown as WorkspaceStoreInstance,
+ {
+ apply(_target, _thisArg, args) {
+ if (!_store)
+ throw new Error(
+ "Workspace store not initialised — call registerWorkspaceStore() first",
+ );
+ return (_store as unknown as (...a: unknown[]) => unknown)(...args);
+ },
+ get(_target, prop) {
+ // Allow property inspection (HMR/React Refresh) before registration
+ if (!_store) return undefined;
+ return Reflect.get(_store, prop);
+ },
+ },
+);
diff --git a/packages/views/common/actor-avatar.tsx b/packages/views/common/actor-avatar.tsx
new file mode 100644
index 0000000000..036074118e
--- /dev/null
+++ b/packages/views/common/actor-avatar.tsx
@@ -0,0 +1,25 @@
+"use client";
+
+import { ActorAvatar as ActorAvatarBase } from "@multica/ui/components/common/actor-avatar";
+import { useActorName } from "@multica/core/workspace/hooks";
+
+interface ActorAvatarProps {
+ actorType: string;
+ actorId: string;
+ size?: number;
+ className?: string;
+}
+
+export function ActorAvatar({ actorType, actorId, size, className }: ActorAvatarProps) {
+ const { getActorName, getActorInitials, getActorAvatarUrl } = useActorName();
+ return (
+ <ActorAvatarBase
+ name={getActorName(actorType, actorId)}
+ initials={getActorInitials(actorType, actorId)}
+ avatarUrl={getActorAvatarUrl(actorType, actorId)}
+ isAgent={actorType === "agent"}
+ size={size}
+ className={className}
+ />
+ );
+}
diff --git a/packages/views/common/markdown.tsx b/packages/views/common/markdown.tsx
new file mode 100644
index 0000000000..1519183e20
--- /dev/null
+++ b/packages/views/common/markdown.tsx
@@ -0,0 +1,57 @@
+"use client";
+
+import * as React from "react";
+import {
+ Markdown as MarkdownBase,
+ MemoizedMarkdown as MemoizedMarkdownBase,
+ type MarkdownProps as MarkdownBaseProps,
+ type RenderMode,
+} from "@multica/ui/markdown";
+import { IssueMentionCard } from "../issues/components/issue-mention-card";
+
+export type { RenderMode };
+
+export type MarkdownProps = MarkdownBaseProps;
+
+/**
+ * Default renderMention that delegates to IssueMentionCard for issue mentions
+ * and renders a styled span for other mention types.
+ */
+function defaultRenderMention({
+ type,
+ id,
+}: {
+ type: string;
+ id: string;
+}): React.ReactNode {
+ if (type === "issue") {
+ return <IssueMentionCard issueId={id} />;
+ }
+ return null;
+}
+
+/**
+ * App-level Markdown wrapper that injects IssueMentionCard via renderMention.
+ * Callers that need custom mention rendering can pass their own renderMention prop.
+ */
+export function Markdown(props: MarkdownProps): React.JSX.Element {
+ return <MarkdownBase renderMention={defaultRenderMention} {...props} />;
+}
+
+export const MemoizedMarkdown = React.memo(
+ Markdown,
+ (prevProps, nextProps) => {
+ if (prevProps.id && nextProps.id) {
+ return (
+ prevProps.id === nextProps.id &&
+ prevProps.children === nextProps.children &&
+ prevProps.mode === nextProps.mode
+ );
+ }
+ return (
+ prevProps.children === nextProps.children &&
+ prevProps.mode === nextProps.mode
+ );
+ },
+);
+MemoizedMarkdown.displayName = "MemoizedMarkdown";
diff --git a/apps/web/features/editor/content-editor.css b/packages/views/editor/content-editor.css
similarity index 100%
rename from apps/web/features/editor/content-editor.css
rename to packages/views/editor/content-editor.css
diff --git a/apps/web/features/editor/content-editor.tsx b/packages/views/editor/content-editor.tsx
similarity index 100%
rename from apps/web/features/editor/content-editor.tsx
rename to packages/views/editor/content-editor.tsx
diff --git a/apps/web/features/editor/extensions/code-block-view.tsx b/packages/views/editor/extensions/code-block-view.tsx
similarity index 100%
rename from apps/web/features/editor/extensions/code-block-view.tsx
rename to packages/views/editor/extensions/code-block-view.tsx
diff --git a/apps/web/features/editor/extensions/file-card.tsx b/packages/views/editor/extensions/file-card.tsx
similarity index 100%
rename from apps/web/features/editor/extensions/file-card.tsx
rename to packages/views/editor/extensions/file-card.tsx
diff --git a/apps/web/features/editor/extensions/file-upload.ts b/packages/views/editor/extensions/file-upload.ts
similarity index 100%
rename from apps/web/features/editor/extensions/file-upload.ts
rename to packages/views/editor/extensions/file-upload.ts
diff --git a/apps/web/features/editor/extensions/image-view.tsx b/packages/views/editor/extensions/image-view.tsx
similarity index 100%
rename from apps/web/features/editor/extensions/image-view.tsx
rename to packages/views/editor/extensions/image-view.tsx
diff --git a/apps/web/features/editor/extensions/index.ts b/packages/views/editor/extensions/index.ts
similarity index 100%
rename from apps/web/features/editor/extensions/index.ts
rename to packages/views/editor/extensions/index.ts
diff --git a/apps/web/features/editor/extensions/markdown-paste.ts b/packages/views/editor/extensions/markdown-paste.ts
similarity index 100%
rename from apps/web/features/editor/extensions/markdown-paste.ts
rename to packages/views/editor/extensions/markdown-paste.ts
diff --git a/apps/web/features/editor/extensions/mention-extension.ts b/packages/views/editor/extensions/mention-extension.ts
similarity index 100%
rename from apps/web/features/editor/extensions/mention-extension.ts
rename to packages/views/editor/extensions/mention-extension.ts
diff --git a/apps/web/features/editor/extensions/mention-suggestion.tsx b/packages/views/editor/extensions/mention-suggestion.tsx
similarity index 98%
rename from apps/web/features/editor/extensions/mention-suggestion.tsx
rename to packages/views/editor/extensions/mention-suggestion.tsx
index 94091140ec..91c71314e6 100644
--- a/apps/web/features/editor/extensions/mention-suggestion.tsx
+++ b/packages/views/editor/extensions/mention-suggestion.tsx
@@ -11,12 +11,12 @@ import {
import { ReactRenderer } from "@tiptap/react";
import { computePosition, offset, flip, shift } from "@floating-ui/dom";
import type { QueryClient } from "@tanstack/react-query";
-import { useWorkspaceStore } from "@/platform/workspace";
+import { useWorkspaceStore } from "@multica/core/workspace";
import { issueKeys } from "@multica/core/issues/queries";
import { workspaceKeys } from "@multica/core/workspace/queries";
import type { Issue, ListIssuesResponse, MemberWithUser, Agent } from "@multica/core/types";
-import { ActorAvatar } from "@/components/common/actor-avatar";
-import { StatusIcon } from "@/features/issues/components/status-icon";
+import { ActorAvatar } from "../../common/actor-avatar";
+import { StatusIcon } from "../../issues/components/status-icon";
import { Badge } from "@multica/ui/components/ui/badge";
import type { IssueStatus } from "@multica/core/types";
import type { SuggestionOptions, SuggestionProps } from "@tiptap/suggestion";
diff --git a/apps/web/features/editor/extensions/mention-view.tsx b/packages/views/editor/extensions/mention-view.tsx
similarity index 97%
rename from apps/web/features/editor/extensions/mention-view.tsx
rename to packages/views/editor/extensions/mention-view.tsx
index 692d305739..81c124ab0c 100644
--- a/apps/web/features/editor/extensions/mention-view.tsx
+++ b/packages/views/editor/extensions/mention-view.tsx
@@ -23,7 +23,7 @@ import type { NodeViewProps } from "@tiptap/react";
import { useQuery } from "@tanstack/react-query";
import { issueListOptions } from "@multica/core/issues/queries";
import { useWorkspaceId } from "@multica/core/hooks";
-import { StatusIcon } from "@/features/issues/components/status-icon";
+import { StatusIcon } from "../../issues/components/status-icon";
export function MentionView({ node }: NodeViewProps) {
const { type, id, label } = node.attrs;
diff --git a/apps/web/features/editor/extensions/submit-shortcut.ts b/packages/views/editor/extensions/submit-shortcut.ts
similarity index 100%
rename from apps/web/features/editor/extensions/submit-shortcut.ts
rename to packages/views/editor/extensions/submit-shortcut.ts
diff --git a/apps/web/features/editor/index.ts b/packages/views/editor/index.ts
similarity index 100%
rename from apps/web/features/editor/index.ts
rename to packages/views/editor/index.ts
diff --git a/apps/web/features/editor/readonly-content.tsx b/packages/views/editor/readonly-content.tsx
similarity index 99%
rename from apps/web/features/editor/readonly-content.tsx
rename to packages/views/editor/readonly-content.tsx
index aa2877eb13..da52a9313d 100644
--- a/apps/web/features/editor/readonly-content.tsx
+++ b/packages/views/editor/readonly-content.tsx
@@ -28,7 +28,7 @@ import { toHtml } from "hast-util-to-html";
import { Maximize2, Download, Link as LinkIcon, FileText } from "lucide-react";
import { toast } from "sonner";
import { cn } from "@multica/ui/lib/utils";
-import { IssueMentionCard } from "@/features/issues/components/issue-mention-card";
+import { IssueMentionCard } from "../issues/components/issue-mention-card";
import { ImageLightbox } from "./extensions/image-view";
import { preprocessMarkdown } from "./utils/preprocess";
import "./content-editor.css";
diff --git a/apps/web/features/editor/title-editor.css b/packages/views/editor/title-editor.css
similarity index 100%
rename from apps/web/features/editor/title-editor.css
rename to packages/views/editor/title-editor.css
diff --git a/apps/web/features/editor/title-editor.tsx b/packages/views/editor/title-editor.tsx
similarity index 100%
rename from apps/web/features/editor/title-editor.tsx
rename to packages/views/editor/title-editor.tsx
diff --git a/apps/web/features/editor/utils/clipboard.ts b/packages/views/editor/utils/clipboard.ts
similarity index 100%
rename from apps/web/features/editor/utils/clipboard.ts
rename to packages/views/editor/utils/clipboard.ts
diff --git a/apps/web/features/editor/utils/preprocess.ts b/packages/views/editor/utils/preprocess.ts
similarity index 92%
rename from apps/web/features/editor/utils/preprocess.ts
rename to packages/views/editor/utils/preprocess.ts
index 17f341a564..db96c52eed 100644
--- a/apps/web/features/editor/utils/preprocess.ts
+++ b/packages/views/editor/utils/preprocess.ts
@@ -1,5 +1,5 @@
-import { preprocessLinks } from "@/components/markdown/linkify";
-import { preprocessMentionShortcodes } from "@/components/markdown/mentions";
+import { preprocessLinks } from "@multica/ui/markdown";
+import { preprocessMentionShortcodes } from "@multica/ui/markdown";
import { isFileCardUrl } from "../extensions/file-card";
/**
diff --git a/apps/web/features/issues/components/agent-live-card.tsx b/packages/views/issues/components/agent-live-card.tsx
similarity index 99%
rename from apps/web/features/issues/components/agent-live-card.tsx
rename to packages/views/issues/components/agent-live-card.tsx
index c9fd557edc..85fba7ebab 100644
--- a/apps/web/features/issues/components/agent-live-card.tsx
+++ b/packages/views/issues/components/agent-live-card.tsx
@@ -2,13 +2,13 @@
import { useState, useEffect, useCallback, useRef } from "react";
import { Bot, ChevronRight, ChevronDown, Loader2, ArrowDown, Brain, AlertCircle, Clock, CheckCircle2, XCircle, Square, Maximize2 } from "lucide-react";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import { useWSEvent } from "@multica/core/realtime";
import type { TaskMessagePayload, TaskCompletedPayload, TaskFailedPayload, TaskCancelledPayload } from "@multica/core/types/events";
import type { AgentTask } from "@multica/core/types/agent";
import { cn } from "@multica/ui/lib/utils";
import { toast } from "sonner";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../../common/actor-avatar";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@multica/ui/components/ui/collapsible";
import { useActorName } from "@multica/core/workspace/hooks";
import { redactSecrets } from "../utils/redact";
diff --git a/apps/web/features/issues/components/agent-transcript-dialog.tsx b/packages/views/issues/components/agent-transcript-dialog.tsx
similarity index 99%
rename from apps/web/features/issues/components/agent-transcript-dialog.tsx
rename to packages/views/issues/components/agent-transcript-dialog.tsx
index fafef95a88..3e5d900698 100644
--- a/apps/web/features/issues/components/agent-transcript-dialog.tsx
+++ b/packages/views/issues/components/agent-transcript-dialog.tsx
@@ -20,8 +20,8 @@ import {
import { cn } from "@multica/ui/lib/utils";
import { Dialog, DialogContent, DialogTitle } from "@multica/ui/components/ui/dialog";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@multica/ui/components/ui/collapsible";
-import { ActorAvatar } from "@/components/common/actor-avatar";
-import { api } from "@/platform/api";
+import { ActorAvatar } from "../../common/actor-avatar";
+import { api } from "@multica/core/api";
import type { AgentTask, Agent, AgentRuntime } from "@multica/core/types/agent";
import { redactSecrets } from "../utils/redact";
diff --git a/apps/web/features/issues/components/batch-action-toolbar.tsx b/packages/views/issues/components/batch-action-toolbar.tsx
similarity index 100%
rename from apps/web/features/issues/components/batch-action-toolbar.tsx
rename to packages/views/issues/components/batch-action-toolbar.tsx
diff --git a/apps/web/features/issues/components/board-card.tsx b/packages/views/issues/components/board-card.tsx
similarity index 98%
rename from apps/web/features/issues/components/board-card.tsx
rename to packages/views/issues/components/board-card.tsx
index 1d23e3f3b0..eb47f97179 100644
--- a/apps/web/features/issues/components/board-card.tsx
+++ b/packages/views/issues/components/board-card.tsx
@@ -1,14 +1,14 @@
"use client";
import { useCallback, memo } from "react";
-import Link from "next/link";
+import { AppLink } from "../../navigation";
import { useSortable, defaultAnimateLayoutChanges } from "@dnd-kit/sortable";
import type { AnimateLayoutChanges } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { toast } from "sonner";
import type { Issue, UpdateIssueRequest } from "@multica/core/types";
import { CalendarDays } from "lucide-react";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../../common/actor-avatar";
import { useUpdateIssue } from "@multica/core/issues/mutations";
import { PriorityIcon } from "./priority-icon";
import { PriorityPicker, AssigneePicker, DueDatePicker } from "./pickers";
@@ -200,12 +200,12 @@ export const DraggableBoardCard = memo(function DraggableBoardCard({ issue }: {
{...listeners}
className={isDragging ? "opacity-30" : ""}
>
- <Link
+ <AppLink
href={`/issues/${issue.id}`}
className={`group block transition-colors ${isDragging ? "pointer-events-none" : ""}`}
>
<BoardCardContent issue={issue} editable />
- </Link>
+ </AppLink>
</div>
);
});
diff --git a/apps/web/features/issues/components/board-column.tsx b/packages/views/issues/components/board-column.tsx
similarity index 100%
rename from apps/web/features/issues/components/board-column.tsx
rename to packages/views/issues/components/board-column.tsx
diff --git a/apps/web/features/issues/components/board-view.tsx b/packages/views/issues/components/board-view.tsx
similarity index 99%
rename from apps/web/features/issues/components/board-view.tsx
rename to packages/views/issues/components/board-view.tsx
index 2f5c75c69f..ce7b9da169 100644
--- a/apps/web/features/issues/components/board-view.tsx
+++ b/packages/views/issues/components/board-view.tsx
@@ -28,7 +28,7 @@ import {
import { ALL_STATUSES, STATUS_CONFIG } from "@multica/core/issues/config";
import { useViewStoreApi, useViewStore } from "@multica/core/issues/stores/view-store-context";
import type { SortField, SortDirection } from "@multica/core/issues/stores/view-store";
-import { sortIssues } from "@/features/issues/utils/sort";
+import { sortIssues } from "../utils/sort";
import { StatusIcon } from "./status-icon";
import { BoardColumn } from "./board-column";
import { BoardCardContent } from "./board-card";
diff --git a/apps/web/features/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsx
similarity index 99%
rename from apps/web/features/issues/components/comment-card.tsx
rename to packages/views/issues/components/comment-card.tsx
index b5b62ee9a3..3f7769344c 100644
--- a/apps/web/features/issues/components/comment-card.tsx
+++ b/packages/views/issues/components/comment-card.tsx
@@ -24,16 +24,16 @@ import {
AlertDialogTitle,
} from "@multica/ui/components/ui/alert-dialog";
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "@multica/ui/components/ui/collapsible";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../../common/actor-avatar";
import { ReactionBar } from "@multica/ui/components/common/reaction-bar";
import { QuickEmojiPicker } from "@multica/ui/components/common/quick-emoji-picker";
import { cn } from "@multica/ui/lib/utils";
import { useActorName } from "@multica/core/workspace/hooks";
import { timeAgo } from "@multica/core/utils";
-import { ContentEditor, type ContentEditorRef, copyMarkdown, ReadonlyContent } from "@/features/editor";
+import { ContentEditor, type ContentEditorRef, copyMarkdown, ReadonlyContent } from "../../editor";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
import { useFileUpload } from "@multica/core/hooks/use-file-upload";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import { ReplyInput } from "./reply-input";
import type { TimelineEntry } from "@multica/core/types";
diff --git a/apps/web/features/issues/components/comment-input.tsx b/packages/views/issues/components/comment-input.tsx
similarity index 95%
rename from apps/web/features/issues/components/comment-input.tsx
rename to packages/views/issues/components/comment-input.tsx
index 032f297c9e..83639b0b30 100644
--- a/apps/web/features/issues/components/comment-input.tsx
+++ b/packages/views/issues/components/comment-input.tsx
@@ -3,10 +3,10 @@
import { useRef, useState } from "react";
import { ArrowUp, Loader2 } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
-import { ContentEditor, type ContentEditorRef } from "@/features/editor";
+import { ContentEditor, type ContentEditorRef } from "../../editor";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
import { useFileUpload } from "@multica/core/hooks/use-file-upload";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
interface CommentInputProps {
issueId: string;
diff --git a/apps/web/features/issues/components/index.ts b/packages/views/issues/components/index.ts
similarity index 100%
rename from apps/web/features/issues/components/index.ts
rename to packages/views/issues/components/index.ts
diff --git a/apps/web/features/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
similarity index 98%
rename from apps/web/features/issues/components/issue-detail.tsx
rename to packages/views/issues/components/issue-detail.tsx
index 6f3068604f..3593599562 100644
--- a/apps/web/features/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -2,8 +2,8 @@
import { useState, useEffect, useCallback, useRef, memo } from "react";
import { useDefaultLayout, usePanelRef } from "react-resizable-panels";
-import Link from "next/link";
-import { useRouter } from "next/navigation";
+import { AppLink } from "../../navigation";
+import { useNavigation } from "../../navigation";
import {
Calendar,
Check,
@@ -45,9 +45,9 @@ import {
DropdownMenuSubContent,
} from "@multica/ui/components/ui/dropdown-menu";
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "@multica/ui/components/ui/resizable";
-import { ContentEditor, type ContentEditorRef } from "@/features/editor";
+import { ContentEditor, type ContentEditorRef } from "../../editor";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
-import { TitleEditor } from "@/features/editor";
+import { TitleEditor } from "../../editor";
import {
Tooltip,
TooltipTrigger,
@@ -57,27 +57,27 @@ import { Popover, PopoverTrigger, PopoverContent } from "@multica/ui/components/
import { Checkbox } from "@multica/ui/components/ui/checkbox";
import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@multica/ui/components/ui/command";
import { AvatarGroup, AvatarGroupCount } from "@multica/ui/components/ui/avatar";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../../common/actor-avatar";
import type { Issue, UpdateIssueRequest, IssueStatus, IssuePriority, TimelineEntry } from "@multica/core/types";
import { ALL_STATUSES, STATUS_CONFIG, PRIORITY_ORDER, PRIORITY_CONFIG } from "@multica/core/issues/config";
-import { StatusIcon, PriorityIcon, DueDatePicker, AssigneePicker, canAssignAgent } from "@/features/issues/components";
+import { StatusIcon, PriorityIcon, DueDatePicker, AssigneePicker, canAssignAgent } from ".";
import { CommentCard } from "./comment-card";
import { CommentInput } from "./comment-input";
import { AgentLiveCard, TaskRunHistory } from "./agent-live-card";
import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { useAuthStore } from "@/platform/auth";
-import { useWorkspaceStore } from "@/platform/workspace";
+import { useAuthStore } from "@multica/core/auth";
+import { useWorkspaceStore } from "@multica/core/workspace";
import { useActorName } from "@multica/core/workspace/hooks";
import { useWorkspaceId } from "@multica/core/hooks";
import { issueListOptions, issueDetailOptions, childIssuesOptions } from "@multica/core/issues/queries";
import { memberListOptions, agentListOptions } from "@multica/core/workspace/queries";
import { useUpdateIssue, useDeleteIssue } from "@multica/core/issues/mutations";
-import { useIssueTimeline } from "@/features/issues/hooks/use-issue-timeline";
-import { useIssueReactions } from "@/features/issues/hooks/use-issue-reactions";
-import { useIssueSubscribers } from "@/features/issues/hooks/use-issue-subscribers";
+import { useIssueTimeline } from "../hooks/use-issue-timeline";
+import { useIssueReactions } from "../hooks/use-issue-reactions";
+import { useIssueSubscribers } from "../hooks/use-issue-subscribers";
import { ReactionBar } from "@multica/ui/components/common/reaction-bar";
import { useFileUpload } from "@multica/core/hooks/use-file-upload";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import { useModalStore } from "@multica/core/modals";
import { timeAgo } from "@multica/core/utils";
import { cn } from "@multica/ui/lib/utils";
@@ -233,7 +233,7 @@ interface IssueDetailProps {
export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layoutId = "multica_issue_detail_layout", highlightCommentId }: IssueDetailProps) {
const id = issueId;
- const router = useRouter();
+ const router = useNavigation();
const user = useAuthStore((s) => s.user);
const workspace = useWorkspaceStore((s) => s.workspace);
@@ -429,23 +429,23 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layo
<div className="flex items-center gap-1.5 min-w-0">
{workspace && (
<>
- <Link
+ <AppLink
href="/issues"
className="text-muted-foreground hover:text-foreground transition-colors truncate shrink-0"
>
{workspace.name}
- </Link>
+ </AppLink>
<ChevronRight className="h-3 w-3 text-muted-foreground/50 shrink-0" />
</>
)}
{parentIssue && (
<>
- <Link
+ <AppLink
href={`/issues/${parentIssue.id}`}
className="text-muted-foreground hover:text-foreground transition-colors truncate shrink-0"
>
{parentIssue.identifier}
- </Link>
+ </AppLink>
<ChevronRight className="h-3 w-3 text-muted-foreground/50 shrink-0" />
</>
)}
@@ -711,7 +711,7 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layo
/>
{parentIssue && (
- <Link
+ <AppLink
href={`/issues/${parentIssue.id}`}
className="mt-2 inline-flex max-w-full items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors group/parent"
>
@@ -732,7 +732,7 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layo
</span>
);
})()}
- </Link>
+ </AppLink>
)}
<ContentEditor
@@ -838,7 +838,7 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layo
const isDone =
child.status === "done" || child.status === "cancelled";
return (
- <Link
+ <AppLink
key={child.id}
href={`/issues/${child.id}`}
className="flex items-center gap-2.5 px-3 py-2 hover:bg-accent/50 transition-colors group/row"
@@ -873,7 +873,7 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layo
className="h-5 w-5 rounded-full border border-dashed border-muted-foreground/30 shrink-0"
/>
)}
- </Link>
+ </AppLink>
);
})}
</div>
@@ -1224,14 +1224,14 @@ export function IssueDetail({ issueId, onDelete, defaultSidebarOpen = true, layo
Parent issue
</div>
<div className="pl-2">
- <Link
+ <AppLink
href={`/issues/${parentIssue.id}`}
className="flex items-center gap-1.5 rounded-md px-2 py-1.5 -mx-2 text-xs hover:bg-accent/50 transition-colors group"
>
<StatusIcon status={parentIssue.status} className="h-3.5 w-3.5 shrink-0" />
<span className="text-muted-foreground shrink-0">{parentIssue.identifier}</span>
<span className="truncate group-hover:text-foreground">{parentIssue.title}</span>
- </Link>
+ </AppLink>
</div>
</div>
)}
diff --git a/apps/web/features/issues/components/issue-mention-card.tsx b/packages/views/issues/components/issue-mention-card.tsx
similarity index 93%
rename from apps/web/features/issues/components/issue-mention-card.tsx
rename to packages/views/issues/components/issue-mention-card.tsx
index fc53ef0710..8f5d1a9741 100644
--- a/apps/web/features/issues/components/issue-mention-card.tsx
+++ b/packages/views/issues/components/issue-mention-card.tsx
@@ -1,6 +1,6 @@
"use client";
-import Link from "next/link";
+import { AppLink } from "../../navigation";
import { useQuery } from "@tanstack/react-query";
import { issueListOptions } from "@multica/core/issues/queries";
import { useWorkspaceId } from "@multica/core/hooks";
@@ -19,25 +19,25 @@ export function IssueMentionCard({ issueId, fallbackLabel }: IssueMentionCardPro
if (!issue) {
return (
- <Link
+ <AppLink
href={`/issues/${issueId}`}
className="issue-mention inline-flex items-center gap-1.5 rounded-md border mx-0.5 px-2 py-0.5 text-xs hover:bg-accent transition-colors cursor-pointer max-w-72"
>
<span className="font-medium text-muted-foreground">
{fallbackLabel ?? issueId.slice(0, 8)}
</span>
- </Link>
+ </AppLink>
);
}
return (
- <Link
+ <AppLink
href={`/issues/${issueId}`}
className="issue-mention inline-flex items-center gap-1.5 rounded-md border mx-0.5 px-2 py-0.5 text-xs hover:bg-accent transition-colors cursor-pointer max-w-72"
>
<StatusIcon status={issue.status} className="h-3.5 w-3.5 shrink-0" />
<span className="font-medium text-muted-foreground shrink-0">{issue.identifier}</span>
<span className="text-foreground truncate">{issue.title}</span>
- </Link>
+ </AppLink>
);
}
diff --git a/apps/web/features/issues/components/issues-header.tsx b/packages/views/issues/components/issues-header.tsx
similarity index 99%
rename from apps/web/features/issues/components/issues-header.tsx
rename to packages/views/issues/components/issues-header.tsx
index d6596adefd..35e3ebb771 100644
--- a/apps/web/features/issues/components/issues-header.tsx
+++ b/packages/views/issues/components/issues-header.tsx
@@ -42,11 +42,11 @@ import {
PRIORITY_ORDER,
PRIORITY_CONFIG,
} from "@multica/core/issues/config";
-import { StatusIcon, PriorityIcon } from "@/features/issues/components";
+import { StatusIcon, PriorityIcon } from ".";
import { useQuery } from "@tanstack/react-query";
import { useWorkspaceId } from "@multica/core/hooks";
import { memberListOptions, agentListOptions } from "@multica/core/workspace/queries";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../../common/actor-avatar";
import {
useIssueViewStore,
SORT_OPTIONS,
@@ -57,7 +57,7 @@ import {
useIssuesScopeStore,
type IssuesScope,
} from "@multica/core/issues/stores/issues-scope-store";
-import { filterIssues } from "@/features/issues/utils/filter";
+import { filterIssues } from "../utils/filter";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
import type { Issue } from "@multica/core/types";
diff --git a/apps/web/features/issues/components/issues-page.tsx b/packages/views/issues/components/issues-page.tsx
similarity index 97%
rename from apps/web/features/issues/components/issues-page.tsx
rename to packages/views/issues/components/issues-page.tsx
index de761ef47f..d919dfabdf 100644
--- a/apps/web/features/issues/components/issues-page.tsx
+++ b/packages/views/issues/components/issues-page.tsx
@@ -9,10 +9,10 @@ import { useQuery } from "@tanstack/react-query";
import { useIssueViewStore, initFilterWorkspaceSync } from "@multica/core/issues/stores/view-store";
import { useIssuesScopeStore } from "@multica/core/issues/stores/issues-scope-store";
import { ViewStoreProvider } from "@multica/core/issues/stores/view-store-context";
-import { filterIssues } from "@/features/issues/utils/filter";
+import { filterIssues } from "../utils/filter";
import { BOARD_STATUSES } from "@multica/core/issues/config";
-import { useWorkspaceStore } from "@/platform/workspace";
-import { WorkspaceAvatar } from "@/features/workspace";
+import { useWorkspaceStore } from "@multica/core/workspace";
+import { WorkspaceAvatar } from "../../workspace/workspace-avatar";
import { useWorkspaceId } from "@multica/core/hooks";
import { issueListOptions } from "@multica/core/issues/queries";
import { useUpdateIssue } from "@multica/core/issues/mutations";
diff --git a/apps/web/features/issues/components/list-row.tsx b/packages/views/issues/components/list-row.tsx
similarity index 93%
rename from apps/web/features/issues/components/list-row.tsx
rename to packages/views/issues/components/list-row.tsx
index 4f4afff6da..3e24c60c80 100644
--- a/apps/web/features/issues/components/list-row.tsx
+++ b/packages/views/issues/components/list-row.tsx
@@ -1,9 +1,9 @@
"use client";
import { memo } from "react";
-import Link from "next/link";
+import { AppLink } from "../../navigation";
import type { Issue } from "@multica/core/types";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../../common/actor-avatar";
import { useIssueSelectionStore } from "@multica/core/issues/stores/selection-store";
import { PriorityIcon } from "./priority-icon";
@@ -38,7 +38,7 @@ export const ListRow = memo(function ListRow({ issue }: { issue: Issue }) {
}`}
/>
</div>
- <Link
+ <AppLink
href={`/issues/${issue.id}`}
className="flex flex-1 items-center gap-2 min-w-0"
>
@@ -58,7 +58,7 @@ export const ListRow = memo(function ListRow({ issue }: { issue: Issue }) {
size={20}
/>
)}
- </Link>
+ </AppLink>
</div>
);
});
diff --git a/apps/web/features/issues/components/list-view.tsx b/packages/views/issues/components/list-view.tsx
similarity index 99%
rename from apps/web/features/issues/components/list-view.tsx
rename to packages/views/issues/components/list-view.tsx
index 42d7f5d7cc..ba0a296127 100644
--- a/apps/web/features/issues/components/list-view.tsx
+++ b/packages/views/issues/components/list-view.tsx
@@ -10,7 +10,7 @@ import { STATUS_CONFIG } from "@multica/core/issues/config";
import { useModalStore } from "@multica/core/modals";
import { useViewStore } from "@multica/core/issues/stores/view-store-context";
import { useIssueSelectionStore } from "@multica/core/issues/stores/selection-store";
-import { sortIssues } from "@/features/issues/utils/sort";
+import { sortIssues } from "../utils/sort";
import { StatusIcon } from "./status-icon";
import { ListRow } from "./list-row";
diff --git a/apps/web/features/issues/components/pickers/assignee-picker.tsx b/packages/views/issues/components/pickers/assignee-picker.tsx
similarity index 97%
rename from apps/web/features/issues/components/pickers/assignee-picker.tsx
rename to packages/views/issues/components/pickers/assignee-picker.tsx
index 10ff024eed..1e961edd7f 100644
--- a/apps/web/features/issues/components/pickers/assignee-picker.tsx
+++ b/packages/views/issues/components/pickers/assignee-picker.tsx
@@ -4,11 +4,11 @@ import { useState } from "react";
import { Lock, UserMinus } from "lucide-react";
import type { Agent, IssueAssigneeType, UpdateIssueRequest } from "@multica/core/types";
import { useQuery } from "@tanstack/react-query";
-import { useAuthStore } from "@/platform/auth";
+import { useAuthStore } from "@multica/core/auth";
import { useActorName } from "@multica/core/workspace/hooks";
import { useWorkspaceId } from "@multica/core/hooks";
import { memberListOptions, agentListOptions } from "@multica/core/workspace/queries";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../../../common/actor-avatar";
import {
PropertyPicker,
PickerItem,
diff --git a/apps/web/features/issues/components/pickers/due-date-picker.tsx b/packages/views/issues/components/pickers/due-date-picker.tsx
similarity index 100%
rename from apps/web/features/issues/components/pickers/due-date-picker.tsx
rename to packages/views/issues/components/pickers/due-date-picker.tsx
diff --git a/apps/web/features/issues/components/pickers/index.ts b/packages/views/issues/components/pickers/index.ts
similarity index 100%
rename from apps/web/features/issues/components/pickers/index.ts
rename to packages/views/issues/components/pickers/index.ts
diff --git a/apps/web/features/issues/components/pickers/priority-picker.tsx b/packages/views/issues/components/pickers/priority-picker.tsx
similarity index 100%
rename from apps/web/features/issues/components/pickers/priority-picker.tsx
rename to packages/views/issues/components/pickers/priority-picker.tsx
diff --git a/apps/web/features/issues/components/pickers/property-picker.tsx b/packages/views/issues/components/pickers/property-picker.tsx
similarity index 100%
rename from apps/web/features/issues/components/pickers/property-picker.tsx
rename to packages/views/issues/components/pickers/property-picker.tsx
diff --git a/apps/web/features/issues/components/pickers/status-picker.tsx b/packages/views/issues/components/pickers/status-picker.tsx
similarity index 100%
rename from apps/web/features/issues/components/pickers/status-picker.tsx
rename to packages/views/issues/components/pickers/status-picker.tsx
diff --git a/apps/web/features/issues/components/priority-icon.tsx b/packages/views/issues/components/priority-icon.tsx
similarity index 100%
rename from apps/web/features/issues/components/priority-icon.tsx
rename to packages/views/issues/components/priority-icon.tsx
diff --git a/apps/web/features/issues/components/reply-input.tsx b/packages/views/issues/components/reply-input.tsx
similarity index 95%
rename from apps/web/features/issues/components/reply-input.tsx
rename to packages/views/issues/components/reply-input.tsx
index ea11f404e1..ffb6e548bd 100644
--- a/apps/web/features/issues/components/reply-input.tsx
+++ b/packages/views/issues/components/reply-input.tsx
@@ -2,11 +2,11 @@
import { useRef, useState, useEffect } from "react";
import { ArrowUp, Loader2 } from "lucide-react";
-import { ContentEditor, type ContentEditorRef } from "@/features/editor";
+import { ContentEditor, type ContentEditorRef } from "../../editor";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../../common/actor-avatar";
import { useFileUpload } from "@multica/core/hooks/use-file-upload";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import { cn } from "@multica/ui/lib/utils";
// ---------------------------------------------------------------------------
diff --git a/apps/web/features/issues/components/status-icon.tsx b/packages/views/issues/components/status-icon.tsx
similarity index 100%
rename from apps/web/features/issues/components/status-icon.tsx
rename to packages/views/issues/components/status-icon.tsx
diff --git a/apps/web/features/issues/hooks/index.ts b/packages/views/issues/hooks/index.ts
similarity index 100%
rename from apps/web/features/issues/hooks/index.ts
rename to packages/views/issues/hooks/index.ts
diff --git a/apps/web/features/issues/hooks/use-issue-reactions.ts b/packages/views/issues/hooks/use-issue-reactions.ts
similarity index 100%
rename from apps/web/features/issues/hooks/use-issue-reactions.ts
rename to packages/views/issues/hooks/use-issue-reactions.ts
diff --git a/apps/web/features/issues/hooks/use-issue-subscribers.ts b/packages/views/issues/hooks/use-issue-subscribers.ts
similarity index 100%
rename from apps/web/features/issues/hooks/use-issue-subscribers.ts
rename to packages/views/issues/hooks/use-issue-subscribers.ts
diff --git a/apps/web/features/issues/hooks/use-issue-timeline.ts b/packages/views/issues/hooks/use-issue-timeline.ts
similarity index 100%
rename from apps/web/features/issues/hooks/use-issue-timeline.ts
rename to packages/views/issues/hooks/use-issue-timeline.ts
diff --git a/apps/web/features/issues/utils/filter.test.ts b/packages/views/issues/utils/filter.test.ts
similarity index 100%
rename from apps/web/features/issues/utils/filter.test.ts
rename to packages/views/issues/utils/filter.test.ts
diff --git a/apps/web/features/issues/utils/filter.ts b/packages/views/issues/utils/filter.ts
similarity index 100%
rename from apps/web/features/issues/utils/filter.ts
rename to packages/views/issues/utils/filter.ts
diff --git a/apps/web/features/issues/utils/redact.test.ts b/packages/views/issues/utils/redact.test.ts
similarity index 100%
rename from apps/web/features/issues/utils/redact.test.ts
rename to packages/views/issues/utils/redact.test.ts
diff --git a/apps/web/features/issues/utils/redact.ts b/packages/views/issues/utils/redact.ts
similarity index 100%
rename from apps/web/features/issues/utils/redact.ts
rename to packages/views/issues/utils/redact.ts
diff --git a/apps/web/features/issues/utils/sort.ts b/packages/views/issues/utils/sort.ts
similarity index 100%
rename from apps/web/features/issues/utils/sort.ts
rename to packages/views/issues/utils/sort.ts
diff --git a/apps/web/features/modals/create-issue.tsx b/packages/views/modals/create-issue.tsx
similarity index 97%
rename from apps/web/features/modals/create-issue.tsx
rename to packages/views/modals/create-issue.tsx
index 089f997de4..0785d44c24 100644
--- a/apps/web/features/modals/create-issue.tsx
+++ b/packages/views/modals/create-issue.tsx
@@ -1,7 +1,7 @@
"use client";
import { useState, useRef } from "react";
-import { useRouter } from "next/navigation";
+import { useNavigation } from "../navigation";
import { CalendarDays, Check, ChevronRight, Maximize2, Minimize2, UserMinus, X as XIcon } from "lucide-react";
import { cn } from "@multica/ui/lib/utils";
import { toast } from "sonner";
@@ -25,11 +25,11 @@ import {
import { Calendar } from "@multica/ui/components/ui/calendar";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
import { Button } from "@multica/ui/components/ui/button";
-import { ContentEditor, type ContentEditorRef } from "@/features/editor";
-import { TitleEditor } from "@/features/editor";
-import { StatusIcon, PriorityIcon } from "@/features/issues/components";
+import { ContentEditor, type ContentEditorRef } from "../editor";
+import { TitleEditor } from "../editor";
+import { StatusIcon, PriorityIcon } from "../issues/components";
import { ALL_STATUSES, STATUS_CONFIG, PRIORITY_ORDER, PRIORITY_CONFIG } from "@multica/core/issues/config";
-import { useWorkspaceStore } from "@/platform/workspace";
+import { useWorkspaceStore } from "@multica/core/workspace";
import { useActorName } from "@multica/core/workspace/hooks";
import { useQuery } from "@tanstack/react-query";
import { useWorkspaceId } from "@multica/core/hooks";
@@ -37,9 +37,9 @@ import { memberListOptions, agentListOptions } from "@multica/core/workspace/que
import { useIssueDraftStore } from "@multica/core/issues/stores/draft-store";
import { useCreateIssue } from "@multica/core/issues/mutations";
import { useFileUpload } from "@multica/core/hooks/use-file-upload";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import { FileUploadButton } from "@multica/ui/components/common/file-upload-button";
-import { ActorAvatar } from "@/components/common/actor-avatar";
+import { ActorAvatar } from "../common/actor-avatar";
// ---------------------------------------------------------------------------
// Pill trigger — shared rounded-full button style for toolbar
@@ -70,7 +70,7 @@ function PillButton({
// ---------------------------------------------------------------------------
export function CreateIssueModal({ onClose, data }: { onClose: () => void; data?: Record<string, unknown> | null }) {
- const router = useRouter();
+ const router = useNavigation();
const workspaceName = useWorkspaceStore((s) => s.workspace?.name);
const wsId = useWorkspaceId();
const { data: members = [] } = useQuery(memberListOptions(wsId));
diff --git a/apps/web/features/modals/create-workspace.tsx b/packages/views/modals/create-workspace.tsx
similarity index 96%
rename from apps/web/features/modals/create-workspace.tsx
rename to packages/views/modals/create-workspace.tsx
index 5f68b0eead..f2e623a5e0 100644
--- a/apps/web/features/modals/create-workspace.tsx
+++ b/packages/views/modals/create-workspace.tsx
@@ -1,7 +1,7 @@
"use client";
import { useState } from "react";
-import { useRouter } from "next/navigation";
+import { useNavigation } from "../navigation";
import { toast } from "sonner";
import { ArrowLeft } from "lucide-react";
import { Input } from "@multica/ui/components/ui/input";
@@ -14,12 +14,12 @@ import {
DialogDescription,
} from "@multica/ui/components/ui/dialog";
import { Card, CardContent } from "@multica/ui/components/ui/card";
-import { useWorkspaceStore } from "@/platform/workspace";
+import { useWorkspaceStore } from "@multica/core/workspace";
const SLUG_REGEX = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
export function CreateWorkspaceModal({ onClose }: { onClose: () => void }) {
- const router = useRouter();
+ const router = useNavigation();
const [name, setName] = useState("");
const [slug, setSlug] = useState("");
const [creating, setCreating] = useState(false);
diff --git a/apps/web/features/modals/registry.tsx b/packages/views/modals/registry.tsx
similarity index 100%
rename from apps/web/features/modals/registry.tsx
rename to packages/views/modals/registry.tsx
diff --git a/apps/web/features/my-issues/components/my-issues-header.tsx b/packages/views/my-issues/components/my-issues-header.tsx
similarity index 99%
rename from apps/web/features/my-issues/components/my-issues-header.tsx
rename to packages/views/my-issues/components/my-issues-header.tsx
index 50da3c32dc..cf3f3373da 100644
--- a/apps/web/features/my-issues/components/my-issues-header.tsx
+++ b/packages/views/my-issues/components/my-issues-header.tsx
@@ -40,12 +40,12 @@ import {
PRIORITY_ORDER,
PRIORITY_CONFIG,
} from "@multica/core/issues/config";
-import { StatusIcon, PriorityIcon } from "@/features/issues/components";
+import { StatusIcon, PriorityIcon } from "../../issues/components";
import {
SORT_OPTIONS,
CARD_PROPERTY_OPTIONS,
} from "@multica/core/issues/stores/view-store";
-import { filterIssues } from "@/features/issues/utils/filter";
+import { filterIssues } from "../../issues/utils/filter";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
import type { Issue } from "@multica/core/types";
import { myIssuesViewStore, type MyIssuesScope } from "../stores/my-issues-view-store";
diff --git a/apps/web/features/my-issues/components/my-issues-page.tsx b/packages/views/my-issues/components/my-issues-page.tsx
similarity index 93%
rename from apps/web/features/my-issues/components/my-issues-page.tsx
rename to packages/views/my-issues/components/my-issues-page.tsx
index 901a093aba..c2dd6425cc 100644
--- a/apps/web/features/my-issues/components/my-issues-page.tsx
+++ b/packages/views/my-issues/components/my-issues-page.tsx
@@ -6,18 +6,18 @@ import { toast } from "sonner";
import { ChevronRight, ListTodo } from "lucide-react";
import type { IssueStatus } from "@multica/core/types";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
-import { useAuthStore } from "@/platform/auth";
-import { useWorkspaceStore } from "@/platform/workspace";
-import { WorkspaceAvatar } from "@/features/workspace";
+import { useAuthStore } from "@multica/core/auth";
+import { useWorkspaceStore } from "@multica/core/workspace";
+import { WorkspaceAvatar } from "../../workspace/workspace-avatar";
import { useQuery } from "@tanstack/react-query";
import { agentListOptions } from "@multica/core/workspace/queries";
-import { filterIssues } from "@/features/issues/utils/filter";
+import { filterIssues } from "../../issues/utils/filter";
import { BOARD_STATUSES } from "@multica/core/issues/config";
import { ViewStoreProvider } from "@multica/core/issues/stores/view-store-context";
import { useIssueSelectionStore } from "@multica/core/issues/stores/selection-store";
-import { BoardView } from "@/features/issues/components/board-view";
-import { ListView } from "@/features/issues/components/list-view";
-import { BatchActionToolbar } from "@/features/issues/components/batch-action-toolbar";
+import { BoardView } from "../../issues/components/board-view";
+import { ListView } from "../../issues/components/list-view";
+import { BatchActionToolbar } from "../../issues/components/batch-action-toolbar";
import { registerViewStoreForWorkspaceSync } from "@multica/core/issues/stores/view-store";
import { useWorkspaceId } from "@multica/core/hooks";
import { issueListOptions } from "@multica/core/issues/queries";
diff --git a/apps/web/features/my-issues/index.ts b/packages/views/my-issues/index.ts
similarity index 100%
rename from apps/web/features/my-issues/index.ts
rename to packages/views/my-issues/index.ts
diff --git a/apps/web/features/my-issues/stores/my-issues-view-store.ts b/packages/views/my-issues/stores/my-issues-view-store.ts
similarity index 100%
rename from apps/web/features/my-issues/stores/my-issues-view-store.ts
rename to packages/views/my-issues/stores/my-issues-view-store.ts
diff --git a/packages/views/navigation/app-link.tsx b/packages/views/navigation/app-link.tsx
new file mode 100644
index 0000000000..715f33d6ab
--- /dev/null
+++ b/packages/views/navigation/app-link.tsx
@@ -0,0 +1,31 @@
+"use client";
+
+import { useNavigation } from "./context";
+
+interface AppLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
+ href: string;
+ children: React.ReactNode;
+}
+
+export function AppLink({
+ href,
+ children,
+ onClick,
+ ...props
+}: AppLinkProps) {
+ const { push } = useNavigation();
+
+ const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
+ // Allow ctrl/cmd+click to open in new tab
+ if (e.metaKey || e.ctrlKey || e.shiftKey) return;
+ e.preventDefault();
+ onClick?.(e);
+ push(href);
+ };
+
+ return (
+ <a href={href} onClick={handleClick} {...props}>
+ {children}
+ </a>
+ );
+}
diff --git a/packages/views/navigation/context.tsx b/packages/views/navigation/context.tsx
new file mode 100644
index 0000000000..d55abcb610
--- /dev/null
+++ b/packages/views/navigation/context.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import { createContext, useContext } from "react";
+import type { NavigationAdapter } from "./types";
+
+const NavigationContext = createContext<NavigationAdapter | null>(null);
+
+export function NavigationProvider({
+ value,
+ children,
+}: {
+ value: NavigationAdapter;
+ children: React.ReactNode;
+}) {
+ return (
+ <NavigationContext.Provider value={value}>
+ {children}
+ </NavigationContext.Provider>
+ );
+}
+
+export function useNavigation(): NavigationAdapter {
+ const ctx = useContext(NavigationContext);
+ if (!ctx)
+ throw new Error("useNavigation must be used within NavigationProvider");
+ return ctx;
+}
diff --git a/packages/views/navigation/index.ts b/packages/views/navigation/index.ts
new file mode 100644
index 0000000000..c4debad93d
--- /dev/null
+++ b/packages/views/navigation/index.ts
@@ -0,0 +1,3 @@
+export { NavigationProvider, useNavigation } from "./context";
+export { AppLink } from "./app-link";
+export type { NavigationAdapter } from "./types";
diff --git a/packages/views/navigation/types.ts b/packages/views/navigation/types.ts
new file mode 100644
index 0000000000..9e825fa617
--- /dev/null
+++ b/packages/views/navigation/types.ts
@@ -0,0 +1,7 @@
+export interface NavigationAdapter {
+ push(path: string): void;
+ replace(path: string): void;
+ back(): void;
+ pathname: string;
+ searchParams: URLSearchParams;
+}
diff --git a/packages/views/package.json b/packages/views/package.json
new file mode 100644
index 0000000000..047af9c557
--- /dev/null
+++ b/packages/views/package.json
@@ -0,0 +1,41 @@
+{
+ "name": "@multica/views",
+ "version": "0.0.0",
+ "private": true,
+ "type": "module",
+ "exports": {
+ "./navigation": "./navigation/index.ts",
+ "./common/actor-avatar": "./common/actor-avatar.tsx",
+ "./common/markdown": "./common/markdown.tsx",
+ "./editor": "./editor/index.ts",
+ "./issues/components": "./issues/components/index.ts",
+ "./issues/hooks": "./issues/hooks/index.ts",
+ "./issues/utils/filter": "./issues/utils/filter.ts",
+ "./issues/utils/sort": "./issues/utils/sort.ts",
+ "./issues/utils/redact": "./issues/utils/redact.ts",
+ "./modals/registry": "./modals/registry.tsx",
+ "./modals/create-issue": "./modals/create-issue.tsx",
+ "./modals/create-workspace": "./modals/create-workspace.tsx",
+ "./my-issues": "./my-issues/index.ts",
+ "./skills": "./skills/index.ts",
+ "./runtimes": "./runtimes/index.ts",
+ "./workspace/workspace-avatar": "./workspace/workspace-avatar.tsx"
+ },
+ "dependencies": {
+ "@multica/core": "workspace:*",
+ "@multica/ui": "workspace:*"
+ },
+ "peerDependencies": {
+ "@tanstack/react-query": "catalog:",
+ "lucide-react": "catalog:",
+ "react": "catalog:",
+ "react-dom": "catalog:",
+ "zustand": "catalog:"
+ },
+ "devDependencies": {
+ "@multica/tsconfig": "workspace:*",
+ "@types/react": "catalog:",
+ "@types/react-dom": "catalog:",
+ "typescript": "catalog:"
+ }
+}
diff --git a/apps/web/features/runtimes/components/charts/activity-heatmap.tsx b/packages/views/runtimes/components/charts/activity-heatmap.tsx
similarity index 100%
rename from apps/web/features/runtimes/components/charts/activity-heatmap.tsx
rename to packages/views/runtimes/components/charts/activity-heatmap.tsx
diff --git a/apps/web/features/runtimes/components/charts/daily-cost-chart.tsx b/packages/views/runtimes/components/charts/daily-cost-chart.tsx
similarity index 100%
rename from apps/web/features/runtimes/components/charts/daily-cost-chart.tsx
rename to packages/views/runtimes/components/charts/daily-cost-chart.tsx
diff --git a/apps/web/features/runtimes/components/charts/daily-token-chart.tsx b/packages/views/runtimes/components/charts/daily-token-chart.tsx
similarity index 100%
rename from apps/web/features/runtimes/components/charts/daily-token-chart.tsx
rename to packages/views/runtimes/components/charts/daily-token-chart.tsx
diff --git a/apps/web/features/runtimes/components/charts/hourly-activity-chart.tsx b/packages/views/runtimes/components/charts/hourly-activity-chart.tsx
similarity index 98%
rename from apps/web/features/runtimes/components/charts/hourly-activity-chart.tsx
rename to packages/views/runtimes/components/charts/hourly-activity-chart.tsx
index 2ebf4f58b0..f6b271610f 100644
--- a/apps/web/features/runtimes/components/charts/hourly-activity-chart.tsx
+++ b/packages/views/runtimes/components/charts/hourly-activity-chart.tsx
@@ -13,7 +13,7 @@ import {
ChartTooltipContent,
type ChartConfig,
} from "@multica/ui/components/ui/chart";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import type { RuntimeHourlyActivity } from "@multica/core/types";
const hourlyChartConfig = {
diff --git a/apps/web/features/runtimes/components/charts/index.ts b/packages/views/runtimes/components/charts/index.ts
similarity index 100%
rename from apps/web/features/runtimes/components/charts/index.ts
rename to packages/views/runtimes/components/charts/index.ts
diff --git a/apps/web/features/runtimes/components/charts/model-distribution-chart.tsx b/packages/views/runtimes/components/charts/model-distribution-chart.tsx
similarity index 100%
rename from apps/web/features/runtimes/components/charts/model-distribution-chart.tsx
rename to packages/views/runtimes/components/charts/model-distribution-chart.tsx
diff --git a/apps/web/features/runtimes/components/index.ts b/packages/views/runtimes/components/index.ts
similarity index 100%
rename from apps/web/features/runtimes/components/index.ts
rename to packages/views/runtimes/components/index.ts
diff --git a/apps/web/features/runtimes/components/ping-section.tsx b/packages/views/runtimes/components/ping-section.tsx
similarity index 98%
rename from apps/web/features/runtimes/components/ping-section.tsx
rename to packages/views/runtimes/components/ping-section.tsx
index d72e975046..372c0bbb04 100644
--- a/apps/web/features/runtimes/components/ping-section.tsx
+++ b/packages/views/runtimes/components/ping-section.tsx
@@ -1,7 +1,7 @@
import { useState, useEffect, useCallback, useRef } from "react";
import { Loader2, CheckCircle2, XCircle, Zap } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import type { RuntimePingStatus } from "@multica/core/types";
const pingStatusConfig: Record<
diff --git a/apps/web/features/runtimes/components/runtime-detail.tsx b/packages/views/runtimes/components/runtime-detail.tsx
similarity index 100%
rename from apps/web/features/runtimes/components/runtime-detail.tsx
rename to packages/views/runtimes/components/runtime-detail.tsx
diff --git a/apps/web/features/runtimes/components/runtime-list.tsx b/packages/views/runtimes/components/runtime-list.tsx
similarity index 100%
rename from apps/web/features/runtimes/components/runtime-list.tsx
rename to packages/views/runtimes/components/runtime-list.tsx
diff --git a/apps/web/features/runtimes/components/runtimes-page.tsx b/packages/views/runtimes/components/runtimes-page.tsx
similarity index 98%
rename from apps/web/features/runtimes/components/runtimes-page.tsx
rename to packages/views/runtimes/components/runtimes-page.tsx
index 62ff7a4fd4..245c951b37 100644
--- a/apps/web/features/runtimes/components/runtimes-page.tsx
+++ b/packages/views/runtimes/components/runtimes-page.tsx
@@ -10,7 +10,7 @@ import {
ResizableHandle,
} from "@multica/ui/components/ui/resizable";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
-import { useAuthStore } from "@/platform/auth";
+import { useAuthStore } from "@multica/core/auth";
import { useWorkspaceId } from "@multica/core/hooks";
import { runtimeListOptions, runtimeKeys } from "@multica/core/runtimes/queries";
import { useWSEvent } from "@multica/core/realtime";
diff --git a/apps/web/features/runtimes/components/shared.tsx b/packages/views/runtimes/components/shared.tsx
similarity index 100%
rename from apps/web/features/runtimes/components/shared.tsx
rename to packages/views/runtimes/components/shared.tsx
diff --git a/apps/web/features/runtimes/components/update-section.tsx b/packages/views/runtimes/components/update-section.tsx
similarity index 99%
rename from apps/web/features/runtimes/components/update-section.tsx
rename to packages/views/runtimes/components/update-section.tsx
index 38783ba629..d14d4e5bc4 100644
--- a/apps/web/features/runtimes/components/update-section.tsx
+++ b/packages/views/runtimes/components/update-section.tsx
@@ -7,7 +7,7 @@ import {
Check,
} from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import type { RuntimeUpdateStatus } from "@multica/core/types";
const GITHUB_RELEASES_URL =
diff --git a/apps/web/features/runtimes/components/usage-section.tsx b/packages/views/runtimes/components/usage-section.tsx
similarity index 99%
rename from apps/web/features/runtimes/components/usage-section.tsx
rename to packages/views/runtimes/components/usage-section.tsx
index 99373d9527..56a4d92308 100644
--- a/apps/web/features/runtimes/components/usage-section.tsx
+++ b/packages/views/runtimes/components/usage-section.tsx
@@ -4,7 +4,7 @@ import { useState, useEffect } from "react";
import { BarChart3 } from "lucide-react";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
import type { RuntimeUsage } from "@multica/core/types";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import { formatTokens, estimateCost, aggregateByDate } from "../utils";
import { TokenCard } from "./shared";
import {
diff --git a/apps/web/features/runtimes/index.ts b/packages/views/runtimes/index.ts
similarity index 100%
rename from apps/web/features/runtimes/index.ts
rename to packages/views/runtimes/index.ts
diff --git a/apps/web/features/runtimes/utils.ts b/packages/views/runtimes/utils.ts
similarity index 100%
rename from apps/web/features/runtimes/utils.ts
rename to packages/views/runtimes/utils.ts
diff --git a/apps/web/features/skills/components/file-tree.tsx b/packages/views/skills/components/file-tree.tsx
similarity index 100%
rename from apps/web/features/skills/components/file-tree.tsx
rename to packages/views/skills/components/file-tree.tsx
diff --git a/apps/web/features/skills/components/file-viewer.tsx b/packages/views/skills/components/file-viewer.tsx
similarity index 98%
rename from apps/web/features/skills/components/file-viewer.tsx
rename to packages/views/skills/components/file-viewer.tsx
index 47db3cb97a..25ea61a17b 100644
--- a/apps/web/features/skills/components/file-viewer.tsx
+++ b/packages/views/skills/components/file-viewer.tsx
@@ -5,7 +5,7 @@ import { Pencil, Eye } from "lucide-react";
import { Button } from "@multica/ui/components/ui/button";
import { Textarea } from "@multica/ui/components/ui/textarea";
import { Tooltip, TooltipTrigger, TooltipContent } from "@multica/ui/components/ui/tooltip";
-import { Markdown } from "@/components/markdown/Markdown";
+import { Markdown } from "../../common/markdown";
function isMarkdown(path: string) {
return path.endsWith(".md") || path.endsWith(".mdx");
diff --git a/apps/web/features/skills/components/index.ts b/packages/views/skills/components/index.ts
similarity index 100%
rename from apps/web/features/skills/components/index.ts
rename to packages/views/skills/components/index.ts
diff --git a/apps/web/features/skills/components/skills-page.tsx b/packages/views/skills/components/skills-page.tsx
similarity index 99%
rename from apps/web/features/skills/components/skills-page.tsx
rename to packages/views/skills/components/skills-page.tsx
index c5eecf2797..a852d75459 100644
--- a/apps/web/features/skills/components/skills-page.tsx
+++ b/packages/views/skills/components/skills-page.tsx
@@ -32,9 +32,9 @@ import { Label } from "@multica/ui/components/ui/label";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@multica/ui/components/ui/tabs";
import { toast } from "sonner";
import { Skeleton } from "@multica/ui/components/ui/skeleton";
-import { api } from "@/platform/api";
+import { api } from "@multica/core/api";
import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { useAuthStore } from "@/platform/auth";
+import { useAuthStore } from "@multica/core/auth";
import { useWorkspaceId } from "@multica/core/hooks";
import { skillListOptions, workspaceKeys } from "@multica/core/workspace/queries";
diff --git a/apps/web/features/skills/index.ts b/packages/views/skills/index.ts
similarity index 100%
rename from apps/web/features/skills/index.ts
rename to packages/views/skills/index.ts
diff --git a/packages/views/tsconfig.json b/packages/views/tsconfig.json
new file mode 100644
index 0000000000..5aa3f57f74
--- /dev/null
+++ b/packages/views/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "@multica/tsconfig/react-library.json",
+ "compilerOptions": {
+ "outDir": "dist",
+ "rootDir": "."
+ },
+ "include": ["**/*.ts", "**/*.tsx"],
+ "exclude": ["node_modules", "dist"]
+}
diff --git a/apps/web/features/workspace/components/workspace-avatar.tsx b/packages/views/workspace/workspace-avatar.tsx
similarity index 100%
rename from apps/web/features/workspace/components/workspace-avatar.tsx
rename to packages/views/workspace/workspace-avatar.tsx
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 992ad416f5..881055ddf2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -93,6 +93,12 @@ importers:
'@multica/core':
specifier: workspace:*
version: link:../../packages/core
+ '@multica/ui':
+ specifier: workspace:*
+ version: link:../../packages/ui
+ '@multica/views':
+ specifier: workspace:*
+ version: link:../../packages/views
'@tanstack/react-query':
specifier: ^5.96.2
version: 5.96.2([email protected])
@@ -387,6 +393,43 @@ importers:
specifier: 'catalog:'
version: 5.9.3
+ packages/views:
+ dependencies:
+ '@multica/core':
+ specifier: workspace:*
+ version: link:../core
+ '@multica/ui':
+ specifier: workspace:*
+ version: link:../ui
+ '@tanstack/react-query':
+ specifier: 'catalog:'
+ version: 5.96.2([email protected])
+ lucide-react:
+ specifier: 'catalog:'
+ version: 1.0.1([email protected])
+ react:
+ specifier: 'catalog:'
+ version: 19.2.3
+ react-dom:
+ specifier: 'catalog:'
+ version: 19.2.3([email protected])
+ zustand:
+ specifier: 'catalog:'
+ devDependencies:
+ '@multica/tsconfig':
+ specifier: workspace:*
+ version: link:../tsconfig
+ '@types/react':
+ specifier: ^19.2.0
+ version: 19.2.14
+ '@types/react-dom':
+ specifier: ^19.2.0
+ version: 19.2.3(@types/[email protected])
+ typescript:
+ specifier: 'catalog:'
+ version: 5.9.3
+
packages: