Files
multica/AGENTS.md
Naiyuan Qing 43466a6402 refactor: migrate workspace list from Zustand to React Query
- Remove workspaces[] from workspace store — list is server state, belongs in React Query
- Change switchWorkspace(id) → switchWorkspace(ws) — caller provides full object from Query
- Remove createWorkspace/leaveWorkspace/deleteWorkspace store actions (duplicated mutations)
- Remove refreshWorkspaces store action — replaced by qc.fetchQuery + hydrateWorkspace
- Enhance useLeaveWorkspace/useDeleteWorkspace mutations to re-select workspace when current is removed
- useCreateWorkspace mutation now switches to new workspace on success
- AuthInitializer seeds React Query cache on boot to avoid double fetch
- Realtime sync: replace refreshWorkspaces() calls with qc.fetchQuery + hydrateWorkspace
- Sidebar reads workspace list from useQuery(workspaceListOptions()) instead of Zustand
- create-workspace modal and workspace settings tab use mutations directly
- AGENTS.md: rewrite to match current monorepo architecture, pointing to CLAUDE.md

Fixes workspace rename not updating sidebar without page refresh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 13:38:02 +08:00

1.8 KiB

Repository Guidelines

This file provides guidance to AI agents when working with code in this repository.

Single source of truth: This file is a concise pointer document. All authoritative architecture, coding rules, commands, and conventions live in CLAUDE.md at the project root. Read that file first.

Quick Reference

Architecture

Go backend + monorepo frontend (pnpm workspaces + Turborepo) with shared packages.

  • server/ — Go backend (Chi router, sqlc, gorilla/websocket)
  • apps/web/ — Next.js frontend (App Router)
  • apps/desktop/ — Electron desktop app
  • packages/core/ — Headless business logic (Zustand stores, React Query hooks, API client)
  • packages/ui/ — Atomic UI components (shadcn/Base UI, zero business logic)
  • packages/views/ — Shared business pages/components
  • packages/tsconfig/ — Shared TypeScript config

State Management (critical)

  • React Query owns all server state (issues, members, agents, inbox, workspace list)
  • Zustand owns all client state (current workspace selection, view filters, drafts, modals)
  • All Zustand stores live in packages/core/ — never in packages/views/ or app directories
  • WS events invalidate React Query — never write directly to stores

Package Boundaries (hard rules)

  • packages/core/ — zero react-dom, zero localStorage, zero process.env
  • packages/ui/ — zero @multica/core imports
  • packages/views/ — zero next/*, zero react-router-dom, use NavigationAdapter for routing
  • apps/web/platform/ — only place for Next.js APIs

Commands

make dev              # Auto-setup + start everything
pnpm typecheck        # TypeScript check
pnpm test             # TS unit tests (Vitest)
make test             # Go tests
make check            # Full verification pipeline

See CLAUDE.md for the complete command reference.