Agach Frontend (internal/server/ux/)
Structure
internal/server/ux/src/
main.tsx - React app entry point
App.tsx - Route configuration with protected routes, auth checks
lib/
api.ts - HTTP client for all backend endpoints (token refresh with 401 retry dedup)
auth.ts - Auth helpers (JWT in localStorage: agach_access_token)
types.ts - TypeScript interfaces mirroring pkg/server/types.go
ws.ts - WebSocket client (reconnect with exponential backoff, token auth in query string)
utils.ts - formatDuration() utility
hooks/
useChat.ts - Chat session management (messages, stats, tokens, cost, WebSocket events)
useWebSocket.ts - Generic WebSocket subscription hook
useSeenTasks.ts - Deprecated (server-side now)
useImageUpload.ts - Image upload with state management
pages/ (22 pages)
HomePage.tsx - Dashboard: project list, creation dialog, WebSocket updates
LoginPage.tsx - Email/password auth form, remember me, theme-aware
KanbanPage.tsx - Main board: drag-and-drop columns, search, role filters, multi-select, context menus
BacklogPage.tsx - Backlog view with move-to-todo, feature filtering
FeaturesPage.tsx - Feature/sub-project management
FeatureDetailPage.tsx - Single feature detail view
FeatureChatPage.tsx - Chat interface for collaborative feature discussions
StatisticsPage.tsx - Analytics: tool usage, timeline, token stats, model pricing
ProjectSettingsPage.tsx - Project configuration and agent management
RolesPage.tsx - Global/per-project agent management
SkillsPage.tsx - Skill management
DockerfilesPage.tsx - Docker template management
AccountPage.tsx - User profile, password management
ApiKeysPage.tsx - API key generation/management
NotificationsPage.tsx - Notification center with filtering
NodesPage.tsx - Node/daemon registration and management
NodeSettingsPage.tsx - Individual node settings
OnboardingPage.tsx - Onboarding code generation
ExportGeminiPage.tsx - Export project to Gemini format
ExportClaudePage.tsx - Export project to Claude format
SpecializedAgentDetailPage.tsx - Specialized agent configuration
SubProjectsPage.tsx - Sub-project listing
components/
Layout.tsx - Navigation sidebar, project context, features list, user menu, theme toggle, mobile responsive
AuthContext.tsx - Auth state management (login/logout, token persistence, 401 handling)
ThemeContext.tsx - Light/dark theme management, localStorage persistence
NotificationBell.tsx - Notification bell with unread count
AgentSkillsPanel.tsx - Display and manage agent skills
kanban/
Column.tsx - Individual kanban column with task list
TaskCard.tsx - Task card: priority badge, status, role color
TaskDrawer.tsx - Side panel: full task details, comments, dependencies, edit (62.9K)
TaskContextMenu.tsx - Right-click: priority, role assignment, duplicate, move
TaskActions.tsx - Action modals: block, unblock, complete, wont-do, delete
NewTaskModal.tsx - Create task form with feature assignment (17.3K)
CommentSection.tsx - Task comments with edit capability (10.3K)
FeatureDetailDrawer.tsx - Feature details and related tasks (10.3K)
FeatureCard.tsx - Feature card display
BlockedBanner.tsx - Blocked task information banner
BulkActionsBar.tsx - Multi-select task actions bar
modals/ (8 task modals)
BlockTaskModal.tsx - Block task with reason
UnblockTaskModal.tsx - Unblock task
CompleteTaskModal.tsx - Mark done with completion summary
DeleteTaskModal.tsx - Delete confirmation
MarkWontDoModal.tsx - Request won't-do with reason
ApproveWontDoModal.tsx - Approve won't-do
CommentWontDoModal.tsx - Comment on won't-do request
MoveToProjectModal.tsx - Move task to different project
dialogs/
CreateProjectDialog.tsx - Project creation form
AddAgentToProjectDialog.tsx - Assign agents to projects
RemoveAgentDialog.tsx - Remove agents from projects
CloneAgentDialog.tsx - Clone agent with new name
EditSpecializedAgentDialog.tsx - Edit specialized agent
DeleteConfirmModal.tsx - Generic confirmation modal
settings/ - Settings layout components
ui/ - Reusable UI primitives
Key Patterns
data-qa attributes on interactive elements for Playwright tests
- JSend response wrapper (status/data/error)
- Task drawer URL-driven via searchParams
?task=
- Search debouncing (300ms)
- Multi-select with Ctrl+click, bulk actions bar
- Role-based UI with color coding
- WebSocket event types: task_created, task_updated, task_deleted, task_moved, task_completed,
project_created/updated/deleted, comment_added/edited, agent/skill/feature CRUD, notification,
wip_slot_available, wont_do_rejected, task_wont_do
1---2name: doc-frontend3description: Agach frontend: React/TypeScript pages, components, kanban UI, auth context, API client, WebSocket, hooks, modals4---56# Agach Frontend (`internal/server/ux/`)78## Structure9```10internal/server/ux/src/11 main.tsx - React app entry point12 App.tsx - Route configuration with protected routes, auth checks1314 lib/15 api.ts - HTTP client for all backend endpoints (token refresh with 401 retry dedup)16 auth.ts - Auth helpers (JWT in localStorage: agach_access_token)17 types.ts - TypeScript interfaces mirroring pkg/server/types.go18 ws.ts - WebSocket client (reconnect with exponential backoff, token auth in query string)19 utils.ts - formatDuration() utility2021 hooks/22 useChat.ts - Chat session management (messages, stats, tokens, cost, WebSocket events)23 useWebSocket.ts - Generic WebSocket subscription hook24 useSeenTasks.ts - Deprecated (server-side now)25 useImageUpload.ts - Image upload with state management2627 pages/ (22 pages)28 HomePage.tsx - Dashboard: project list, creation dialog, WebSocket updates29 LoginPage.tsx - Email/password auth form, remember me, theme-aware30 KanbanPage.tsx - Main board: drag-and-drop columns, search, role filters, multi-select, context menus31 BacklogPage.tsx - Backlog view with move-to-todo, feature filtering32 FeaturesPage.tsx - Feature/sub-project management33 FeatureDetailPage.tsx - Single feature detail view34 FeatureChatPage.tsx - Chat interface for collaborative feature discussions35 StatisticsPage.tsx - Analytics: tool usage, timeline, token stats, model pricing36 ProjectSettingsPage.tsx - Project configuration and agent management37 RolesPage.tsx - Global/per-project agent management38 SkillsPage.tsx - Skill management39 DockerfilesPage.tsx - Docker template management40 AccountPage.tsx - User profile, password management41 ApiKeysPage.tsx - API key generation/management42 NotificationsPage.tsx - Notification center with filtering43 NodesPage.tsx - Node/daemon registration and management44 NodeSettingsPage.tsx - Individual node settings45 OnboardingPage.tsx - Onboarding code generation46 ExportGeminiPage.tsx - Export project to Gemini format47 ExportClaudePage.tsx - Export project to Claude format48 SpecializedAgentDetailPage.tsx - Specialized agent configuration49 SubProjectsPage.tsx - Sub-project listing5051 components/52 Layout.tsx - Navigation sidebar, project context, features list, user menu, theme toggle, mobile responsive53 AuthContext.tsx - Auth state management (login/logout, token persistence, 401 handling)54 ThemeContext.tsx - Light/dark theme management, localStorage persistence55 NotificationBell.tsx - Notification bell with unread count56 AgentSkillsPanel.tsx - Display and manage agent skills5758 kanban/59 Column.tsx - Individual kanban column with task list60 TaskCard.tsx - Task card: priority badge, status, role color61 TaskDrawer.tsx - Side panel: full task details, comments, dependencies, edit (62.9K)62 TaskContextMenu.tsx - Right-click: priority, role assignment, duplicate, move63 TaskActions.tsx - Action modals: block, unblock, complete, wont-do, delete64 NewTaskModal.tsx - Create task form with feature assignment (17.3K)65 CommentSection.tsx - Task comments with edit capability (10.3K)66 FeatureDetailDrawer.tsx - Feature details and related tasks (10.3K)67 FeatureCard.tsx - Feature card display68 BlockedBanner.tsx - Blocked task information banner69 BulkActionsBar.tsx - Multi-select task actions bar7071 modals/ (8 task modals)72 BlockTaskModal.tsx - Block task with reason73 UnblockTaskModal.tsx - Unblock task74 CompleteTaskModal.tsx - Mark done with completion summary75 DeleteTaskModal.tsx - Delete confirmation76 MarkWontDoModal.tsx - Request won't-do with reason77 ApproveWontDoModal.tsx - Approve won't-do78 CommentWontDoModal.tsx - Comment on won't-do request79 MoveToProjectModal.tsx - Move task to different project8081 dialogs/82 CreateProjectDialog.tsx - Project creation form83 AddAgentToProjectDialog.tsx - Assign agents to projects84 RemoveAgentDialog.tsx - Remove agents from projects85 CloneAgentDialog.tsx - Clone agent with new name86 EditSpecializedAgentDialog.tsx - Edit specialized agent87 DeleteConfirmModal.tsx - Generic confirmation modal8889 settings/ - Settings layout components90 ui/ - Reusable UI primitives91```9293## Key Patterns94- `data-qa` attributes on interactive elements for Playwright tests95- JSend response wrapper (status/data/error)96- Task drawer URL-driven via searchParams `?task=`97- Search debouncing (300ms)98- Multi-select with Ctrl+click, bulk actions bar99- Role-based UI with color coding100- WebSocket event types: task_created, task_updated, task_deleted, task_moved, task_completed,101 project_created/updated/deleted, comment_added/edited, agent/skill/feature CRUD, notification,102 wip_slot_available, wont_do_rejected, task_wont_do