Commit graph

1212 commits

Author SHA1 Message Date
yushen
680668ffdb feat(workspace): add context field for AI agent background info
Add a `context` text field to workspaces, allowing users to provide
background information and context for AI agents working in the
workspace. Full stack: migration, sqlc queries, Go handler, TS types,
SDK, and settings page UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:59:11 +08:00
yushen
3293607bef fix(cli): address code review findings
1. Add Client.SendHeartbeat/Register methods — no more direct postJSON calls
2. Use url.Values for query params to prevent URL injection
3. Unexport helpers (envOrDefault, durationFromEnv, sleepWithContext)
4. CLI resolveWorkspaceID falls back to daemon.json
5. Implement agent stop (PUT /api/agents/{id} with status=offline)
6. Add --output flag to agent get for consistent UX
7. Add server/multica to .gitignore for stray builds
8. Inject version/commit via -ldflags in Makefile build target

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:49:32 +08:00
yushen
707b5ac6e7 refactor(cli): unify daemon into multica-cli binary with cobra subcommands
Extract daemon logic from cmd/daemon/ into internal/daemon/ package and
create a new unified CLI entry point at cmd/multica/ using cobra. The CLI
supports `daemon` as a long-running subcommand plus ctrl subcommands for
agent/runtime management, config, status, and version.

Server, migrate, and seed binaries remain unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 15:44:49 +08:00
yushen
41b9698dbf chore: update Makefile daemon target to use MULTICA_REPOS_ROOT
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:41:38 +08:00
yushen
edbe474807 chore: gitignore .claude/ and dist-electron
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:37:52 +08:00
yushen
f2228e4f22 refactor(daemon): rename DefaultWorkdir to ReposRoot for clarity
MULTICA_AGENT_WORKDIR → MULTICA_REPOS_ROOT to make it clear this is
the parent directory containing all repos, not a single project workdir.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:36:09 +08:00
yushen
d1e4228aa7 chore: add server/daemon binary to .gitignore
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:26:53 +08:00
yushen
b7728ff802 docs: expand CLAUDE.md with architecture details and update lockfile
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:25:33 +08:00
yushen
96cfdc2e27 fix(agent): fix data races, add tests, and fix raw protocol detection
- Fix data race on output strings.Builder in codex backend by adding
  mutex and waiting for reader goroutine before reading final output
- Fix data race on onTurnDone by initializing it before reader starts
- Fix bug where notificationProtocol zero value "" never matched
  "unknown", silently dropping all raw v2 notifications from codex
- Add round-robin polling to prevent runtime starvation in poll loop
- Log errors in claude handleControlRequest instead of silently dropping
- Add 35 tests for pkg/agent covering claude parsing, codex JSON-RPC,
  protocol detection, event handling, and helper functions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:21:10 +08:00
yushen
0d9b687d92 fix(agent): address code review feedback
- Replace deprecated strings.Title with manual capitalize
- Fix race: set codexClient.onMessage before starting reader goroutine
- Remove unused msgCh parameter from codexClient.handleLine
- Route agent stderr through logger instead of dumping to os.Stderr
- Use deterministic agent order in ensurePaired (prefer codex)
- Increase message channel buffer from 64 to 256
- Rename test to match function rename (buildPrompt)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:10:08 +08:00
yushen
bb45f17cf9 feat(daemon): unified agent SDK supporting Claude Code and Codex
Add a reusable Go agent package (server/pkg/agent/) that provides a
unified Backend interface for executing prompts via either Claude Code
or Codex. The daemon now auto-detects which CLIs are available at
startup, registers a runtime for each, and routes tasks to the correct
backend based on task.Context.Runtime.Provider.

Key changes:
- server/pkg/agent/agent.go: Backend interface, Message/Result types, factory
- server/pkg/agent/claude.go: Spawns claude CLI with stream-json, parses output
- server/pkg/agent/codex.go: Spawns codex app-server, JSON-RPC 2.0 protocol
- server/cmd/daemon/daemon.go: Multi-runtime registration, round-robin polling,
  provider-based backend selection. Removes old runCodexExec/codexResultSchema.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:05:03 +08:00
Jiayuan Zhang
94c9b07bfb
Merge pull request #242 from multica-ai/codex/local-codex-runtime-pairing
Add local Codex daemon pairing flow
2026-03-24 12:08:54 +08:00
Jiayuan Zhang
20f5022664 fix(web): wrap search params pages in suspense 2026-03-24 12:07:20 +08:00
Jiayuan Zhang
cdfa63af15 feat(runtime): add local codex daemon pairing 2026-03-24 12:03:14 +08:00
Jiayuan Zhang
c6960d39b9 chore(claude): default to replacing stale flows 2026-03-24 12:02:44 +08:00
Naiyuan Qing
5d993531d1
Merge pull request #240 from multica-ai/feature/issue-ui-ux
feat: issue UI/UX enhancements with comment CRUD and tab navigation
2026-03-23 20:34:24 +08:00
Naiyuan Qing
8668b1e3c1 docs: update CLAUDE.md with E2E test patterns and env.example
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 20:23:33 +08:00
Naiyuan Qing
0afff49728 feat(web): enhance issue detail page with comment editing, deletion, and real-time updates
- Add inline comment editing and delete functionality
- Wire up WebSocket events for comment create/update/delete
- Expand issue property editing (due date, acceptance criteria, context refs)
- Add real-time issue updates via WebSocket

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 20:23:33 +08:00
Jiayuan Zhang
1a1f18ce8e
Merge pull request #241 from multica-ai/codex/disable-setup-seeding
Stop seeding example data during setup
2026-03-23 20:20:23 +08:00
Naiyuan Qing
6185b7571e refactor(web): extract shared components, add tab system, and restructure issues page
- Extract AppSidebar, TabBar, TabLink into dashboard _components
- Add tab-store for browser-like tab navigation state
- Move StatusIcon/PriorityIcon to issues/_components, config to _config
- Replace inline CreateIssueForm with Dialog (status/priority selection)
- Add calendar component to packages/ui
- Simplify dashboard layout with SidebarProvider

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 20:19:59 +08:00
Jiayuan Zhang
e26a78c6e4 chore: stop seeding during setup 2026-03-23 20:18:39 +08:00
Naiyuan Qing
cc2281416e feat(server): add comment CRUD endpoints and issue filter/update enhancements
- Add UpdateComment and DeleteComment handlers with /api/comments/{commentId} routes
- Add broadcast for comment create/update/delete WebSocket events
- Support status, priority, and assignee_id filters on ListIssues
- Extend UpdateIssue to handle due_date, acceptance_criteria, context_refs, repository
- Properly distinguish "field not sent" vs "field sent as null" in UpdateIssue
- Add corresponding SDK methods and TypeScript types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 20:15:09 +08:00
Jiayuan Zhang
fff7753a0c
Merge pull request #239 from multica-ai/forrestchang/jakarta
feat: agent management UI + task service layer + daemon protocol
2026-03-23 18:58:03 +08:00
Jiayuan Zhang
5a3a72c411 feat(server): add task service layer and daemon REST protocol
- Extract TaskService (server/internal/service/task.go) for task lifecycle:
  enqueue with context snapshot, claim, start, complete, fail, progress
- Add daemon protocol endpoints under /api/daemon/:
  register, heartbeat, claim task, start/progress/complete/fail task
- Task ↔ Issue status sync: running→in_progress, completed→in_review, failed→blocked
- Agent status auto-management: reconcile idle/working based on running tasks
- Enforce max_concurrent_tasks on task claiming (FOR UPDATE SKIP LOCKED)
- Add UpdateIssueStatus query (fixes bug where UpdateIssue nulls assignee)
- Extract shared pgx utils to server/internal/util/ to avoid circular imports
- Migration 003: add context JSONB to agent_task_queue, daemon unique constraint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:34:51 +08:00
Jiayuan Zhang
b4303f9bec feat(agent): add agent management UI, skills/tools/triggers, and issue assignment
- Complete agents management page with create dialog, runtime device selector,
  skills/tools/triggers/tasks tabs, and agent detail view
- Add AssigneePicker to issue detail page for assigning to members or agents
- Extend agent types with description, skills, tools, triggers, RuntimeDevice
- Add SDK methods for agent CRUD and task listing
- Add migration 002 for agent config columns (skills, tools, triggers)
- Update seed data with realistic agent configurations
- Use auth context as single source of truth for agents (fixes state sync)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 18:31:25 +08:00
Jiayuan Zhang
88ca7848b5
Merge pull request #238 from multica-ai/codex/workspace-user-and-worktree-isolation
Add workspace management and isolated worktree environments
2026-03-23 18:16:26 +08:00
Jiayuan Zhang
81e64e9fce Add workspace management and isolated worktree environments 2026-03-23 18:12:11 +08:00
Jiayuan Zhang
e9555b8a22
Merge pull request #237 from multica-ai/forrestchang/remove-fe-mocks
refactor(web): remove frontend mock data
2026-03-23 15:53:08 +08:00
Jiayuan Zhang
ada5687ed5 refactor(web): remove frontend mock data, extract issue config
Remove mock data files for issues and knowledge base that are no longer
needed now that the issues page uses real API calls. Extract STATUS_CONFIG
and PRIORITY_CONFIG into a dedicated config file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 15:28:12 +08:00
Jiayuan Zhang
4a273bcb83
Merge pull request #236 from multica-ai/forrestchang/analyze-next-steps
feat(web): add multi-workspace switching and creation
2026-03-23 11:27:08 +08:00
Jiayuan Zhang
cbb1712e73 feat(web): add multi-workspace switching and creation UI
Add workspace list to sidebar dropdown with switching support, and a
create workspace dialog. Initialization now respects stored workspace ID.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 11:26:03 +08:00
Jiayuan Zhang
c6e34c5e04
Merge pull request #235 from multica-ai/forrestchang/fix-kanban-width
fix(web): fix stale state bugs, add real-time updates, and verification pipeline
2026-03-22 13:07:27 +08:00
Jiayuan Zhang
1ba0fb071a fix(web): fix stale state bugs, add real-time updates, and build verification pipeline
- Fix kanban board columns not adapting to available width (w-64 → flex-1)
- Fix workspace name not updating in sidebar after save in settings
- Fix comments leaking across issues when navigating between issue details
- Fix duplicate issue appearing on create (race between callback and WebSocket)
- Add real-time WebSocket listeners for agents and inbox pages
- Add `make check` one-click verification pipeline (typecheck + tests + E2E)
- Add E2E test fixtures for self-contained test data setup/teardown
- Add settings E2E test and updateWorkspace unit test
- Make `make start/setup` reuse existing PostgreSQL if already running
- Update CLAUDE.md with AI agent verification loop and E2E test patterns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 12:44:49 +08:00
Jiayuan Zhang
317e87fb97
Merge pull request #234 from multica-ai/forrestchang/impl-plan
feat: implement full-stack business logic with API, auth, real-time, and tests
2026-03-22 11:59:03 +08:00
Jiayuan Zhang
18cd938e01 fix(web): resolve TypeScript errors in test mocks and knowledge-base page
- Add missing Issue fields (parent_issue_id, acceptance_criteria, etc.) to test mocks
- Fix Agent mock fields to match actual type (runtime_config, owner_id, avatar_url)
- Import vi in test/helpers.tsx and add type annotation for mockAuthValue
- Add non-null assertions for array indexing in knowledge-base markdown renderer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:57:23 +08:00
Jiayuan Zhang
c9285035d1 fix(e2e): use .first() for create issue assertion to avoid strict mode violation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:53:29 +08:00
Jiayuan Zhang
b5b0605e9a chore: add one-click setup/start/stop scripts, migration CLI, and seed tool
- Add idempotent seed tool with duplicate detection for agents/issues/comments
- Add migration CLI supporting up/down with schema_migrations tracking
- Add Makefile targets: make setup (first-time), make start, make stop
- Update .gitignore for test artifacts and compiled binaries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:50:33 +08:00
Jiayuan Zhang
6dfc61fa86 test: add comprehensive test suite (Go unit/integration, Vitest, Playwright E2E)
- Add JWT middleware unit tests (8 tests covering all auth edge cases)
- Add WebSocket hub tests (5 tests for client lifecycle and broadcast)
- Add full HTTP integration tests (12 tests through real Chi router with DB)
- Add frontend component tests for login, issues, and issue detail pages
- Add auth context unit tests (9 tests for login/logout/name resolution)
- Add Playwright E2E tests for auth, issues, comments, and navigation
- Configure Vitest with jsdom, React plugin, and path aliases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:50:25 +08:00
Jiayuan Zhang
78f4d88aa1 feat(web): integrate frontend with live API and add auth context
- Replace all mock data with real API calls across pages (issues, agents, inbox, settings)
- Add AuthProvider context with JWT login/logout, member/agent name resolution
- Implement login page with email-based auth flow
- Add settings page with workspace editing and member list
- Wire up real-time WebSocket for live issue updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:50:14 +08:00
Jiayuan Zhang
1e61c1974c feat(server): implement full REST API with JWT auth and real-time WebSocket
- Add HTTP handlers for issues, comments, agents, workspaces, inbox, members, and activity
- Implement JWT authentication middleware with Bearer token validation
- Add sqlc queries for all entities (CRUD operations)
- Extract router into reusable NewRouter() for testability
- Expand SDK with full API client methods (CRUD for all resources)
- Add updateWorkspace to SDK, add Member type to shared types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:50:03 +08:00
Jiayuan Zhang
d75746021f
Merge pull request #233 from multica-ai/forrestchang/linear-sidebar-ui
feat(web): Linear-inspired UI with Inbox, Agents, Issues, and Knowledge Base
2026-03-21 14:53:32 +08:00
Jiayuan Zhang
9b1e75311b feat(web): implement Knowledge Base two-column UI
- Left column: searchable document list with title, author, time
- Right column: document viewer with simple Markdown rendering
  (headings, code blocks, tables, lists, inline code)
- Referenced-by section at bottom showing linked issue keys
- Content centered with max-w-3xl for readability

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:45:13 +08:00
Jiayuan Zhang
1e18a80d61 feat(web): add mock data for Knowledge Base documents
7 documents covering product vision, architecture, API conventions,
agent onboarding, database schema, PR guidelines, and WebSocket
protocol. Each includes cross-references to related issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:44:37 +08:00
Jiayuan Zhang
ce95f73ed7 refactor(web): redesign Activity section and comment input
- Comments: avatar + name on same line, body indented below (pl-38px)
- Status changes: small dot (5px) aligned with avatar column, compact
- Comment input: minimal style matching Linear — small dot + plain
  text, no border/box, just a subtle separator line above
- Consistent 28px avatar column for vertical alignment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:38:04 +08:00
Jiayuan Zhang
fd3694c43e fix(web): center issue content and make width responsive
Use mx-auto with max-w-3xl so content stays centered in the
available space and scales with window width instead of being
pinned to the left with fixed padding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:33:31 +08:00
Jiayuan Zhang
b1140e9d40 refactor(web): redesign Issue detail page to closely match Linear
- Properties sidebar: remove uppercase header, interactive hover rows,
  right-aligned values, no divider lines between items
- Content area: wider left padding (px-12), max-width 720px for
  readability, issue key above title, proper separator before activity
- Activity: lowercase "Activity" heading, comments rendered without
  border box (inline text), tighter avatar sizing
- Breadcrumb: sticky header bar
- Comment input: hover border effect
- Overall: 13-14px body text, proper line-height, tracking-tight title

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:30:18 +08:00
Jiayuan Zhang
f5c520835a feat(web): add drag-and-drop to kanban board
- Cards can be dragged between status columns to change issue status
- Drag overlay shows tilted card preview while dragging
- Drop target columns highlight on hover
- 5px activation distance prevents accidental drags on click
- Issue state updates on successful drop
- List view also uses the shared stateful issue list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:27:23 +08:00
Jiayuan Zhang
332a9b6bcc chore(web): add @dnd-kit for drag-and-drop support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:27:15 +08:00
Jiayuan Zhang
44c3cecc8e refactor(web): polish Issue detail page to match Linear design
- Properties sidebar: compact rows with icon-based status/priority
- Activity timeline: tighter spacing, smaller avatars, cleaner
  separation between comments and status changes
- Breadcrumb: minimal, text-only navigation
- Content area: max-width constraint for readability
- Typography: 13px body text, refined heading sizes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:24:18 +08:00
Jiayuan Zhang
8fd149231a refactor(web): polish Issues page UI to match Linear design
- Status: use Lucide circle-variant icons (CircleDashed, Circle,
  CircleDot, Eye, CircleCheck) instead of colored dots
- Priority: use SVG bar indicators (4-bar urgent → 1-bar low)
  instead of P0/P1 text badges
- Board cards: cleaner layout, tighter spacing, comment count icon
- List rows: compact 36px height, proper alignment
- Toolbar: smaller, denser header with refined toggle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:24:02 +08:00