mirror of
https://github.com/coleam00/Archon.git
synced 2025-12-24 02:39:17 -05:00
* feat: decouple task priority from task order This implements a dedicated priority system that operates independently from the existing task_order system, allowing users to set task priority without affecting visual drag-and-drop positioning. ## Changes Made ### Database - Add priority column to archon_tasks table with enum type (critical, high, medium, low) - Create database migration with safe enum handling and data backfill - Add proper indexing for performance ### Backend - Update UpdateTaskRequest to include priority field - Add priority validation in TaskService with enum checking - Include priority field in task list responses and ETag generation - Fix cache invalidation for priority updates ### Frontend - Update TaskPriority type from "urgent" to "critical" for consistency - Add changePriority method to useTaskActions hook - Update TaskCard to use direct priority field instead of task_order conversion - Update TaskEditModal priority form to use direct priority values - Fix TaskPriorityComponent to use correct priority enum values - Update buildTaskUpdates to include priority field changes - Add priority field to Task interface as required field - Update test fixtures to include priority field ## Key Features - ✅ Users can change task priority without affecting drag-and-drop order - ✅ Users can drag tasks to reorder without changing priority level - ✅ Priority persists correctly in database with dedicated column - ✅ All existing priority functionality continues working identically - ✅ Cache invalidation works properly for priority changes - ✅ Both TaskCard priority button and TaskEditModal priority work 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add priority column to complete_setup.sql for fresh installations - Add task_priority enum type (low, medium, high, critical) - Add priority column to archon_tasks table with default 'medium' - Add index for priority column performance - Add documentation comment for priority field This ensures fresh installations include the priority system without needing to run the separate migration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: include priority field in task creation payload When creating new tasks via TaskEditModal, the buildCreateRequest function was not including the priority field, causing new tasks to fall back to the database default ('medium') instead of respecting the user's selected priority in the modal. Added priority: localTask.priority || 'medium' to ensure the user's chosen priority is sent to the API during task creation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: make priority migration safe and idempotent Replaced destructive DROP TYPE CASCADE with safe migration patterns: - Use DO blocks with EXCEPTION handling for enum and column creation - Prevent conflicts with complete_setup.sql for fresh installations - Enhanced backfill logic to preserve user-modified priorities - Only update tasks that haven't been modified (updated_at = created_at) - Add comprehensive error handling with informative notices - Migration can now be run multiple times safely This ensures the migration works for both existing installations (incremental migration) and fresh installations (complete_setup.sql) without data loss or conflicts. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: enforce NOT NULL constraint on priority column Data integrity improvements: Migration (add_priority_column_to_tasks.sql): - Add column as nullable first with DEFAULT 'medium' - Update any NULL values to 'medium' - Set NOT NULL constraint to enforce application invariants - Safe handling for existing columns with proper constraint checking Complete Setup (complete_setup.sql): - Priority column now DEFAULT 'medium' NOT NULL for fresh installations - Ensures consistency between migration and fresh install paths Both paths now enforce priority field as required, matching the frontend Task interface where priority is a required field. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add priority support to task creation API Complete priority support for task creation: API Routes (projects_api.py): - Add priority field to CreateTaskRequest Pydantic model - Pass request.priority to TaskService.create_task call Task Service (task_service.py): - Add priority parameter to create_task method signature - Add priority validation using existing validate_priority method - Include priority field in database INSERT task_data - Include priority field in API response task object This ensures that new tasks created via TaskEditModal respect the user's selected priority instead of falling back to database default. Validation ensures only valid priority values (low, medium, high, critical) are accepted and stored in the database. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: implement clean slate priority migration (no backward compatibility) Remove all task_order to priority mapping logic for true decoupling: - All existing tasks get 'medium' priority (clean slate) - No complex CASE logic or task_order relationships - Users explicitly set priorities as needed after migration - Truly independent priority and visual ordering systems - Simpler, safer migration with no coupling logic This approach prioritizes clean architecture over preserving implied user intentions from the old coupled system. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: rename TaskPriority.tsx to TaskPriorityComponent.tsx for consistency - Renamed file to match the exported component name - Updated import in index.ts barrel export - Maintains consistency with other component naming patterns --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Rasmus Widing <rasmus.widing@gmail.com>
Archon UI - Knowledge Engine Web Interface
A modern React-based web interface for the Archon Knowledge Engine MCP Server. Built with TypeScript, Vite, and Tailwind CSS.
🎨 UI Overview
Archon UI provides a comprehensive dashboard for managing your AI's knowledge base:
Key Features
- 📊 MCP Dashboard: Monitor and control the MCP server
- ⚙️ Settings Management: Configure credentials and RAG strategies
- 🕷️ Web Crawling: Crawl documentation sites and build knowledge base
- 📚 Knowledge Management: Browse, search, and organize knowledge items
- 💬 Interactive Chat: Test RAG queries with real-time responses
- 📈 Real-time Updates: WebSocket-based live updates across the UI
🏗️ Architecture
Technology Stack
- React 18.3: Modern React with hooks and functional components
- TypeScript: Full type safety and IntelliSense support
- Vite: Fast build tool and dev server
- Tailwind CSS: Utility-first styling
- Framer Motion: Smooth animations and transitions
- Lucide Icons: Beautiful and consistent iconography
- React Router: Client-side routing
Project Structure
archon-ui-main/
├── src/
│ ├── components/ # Reusable UI components
│ │ ├── ui/ # Base UI components (Button, Card, etc.)
│ │ ├── layouts/ # Layout components (Sidebar, Header)
│ │ └── animations/ # Animation components
│ ├── pages/ # Page components
│ │ ├── MCPPage.tsx # MCP Dashboard
│ │ ├── Settings.tsx # Settings page
│ │ ├── Crawl.tsx # Web crawling interface
│ │ ├── KnowledgeBase.tsx # Knowledge management
│ │ └── Chat.tsx # RAG chat interface
│ ├── services/ # API and service layers
│ │ ├── api.ts # Base API configuration
│ │ ├── mcpService.ts # MCP server communication
│ │ └── chatService.ts # Chat/RAG service
│ ├── contexts/ # React contexts
│ │ └── ToastContext.tsx # Toast notifications
│ ├── hooks/ # Custom React hooks
│ │ └── useStaggeredEntrance.ts # Animation hook
│ ├── types/ # TypeScript type definitions
│ └── lib/ # Utility functions
├── public/ # Static assets
└── test/ # Test files
📄 Pages Documentation
1. MCP Dashboard (/mcp)
The central control panel for the MCP server.
Components:
- Server Control Panel: Start/stop server, view status, select transport mode
- Server Logs Viewer: Real-time log streaming with auto-scroll
- Available Tools Table: Dynamic tool discovery and documentation
- MCP Test Panel: Interactive tool testing interface
Features:
- Dual transport support (SSE/stdio)
- Real-time status polling (5-second intervals)
- WebSocket-based log streaming
- Copy-to-clipboard configuration
- Tool parameter validation
2. Settings (/settings)
Comprehensive configuration management.
Sections:
- Credentials:
- OpenAI API key (encrypted storage)
- Supabase connection details
- MCP server configuration
- RAG Strategies:
- Contextual Embeddings toggle
- Hybrid Search toggle
- Agentic RAG (code extraction) toggle
- Reranking toggle
Features:
- Secure credential storage with encryption
- Real-time validation
- Toast notifications for actions
- Default value management
3. Web Crawling (/crawl)
Interface for crawling documentation sites.
Components:
- URL Input: Smart URL validation
- Crawl Options: Max depth, concurrent sessions
- Progress Monitoring: Real-time crawl status
- Results Summary: Pages crawled, chunks stored
Features:
- Intelligent URL type detection
- Sitemap support
- Recursive crawling
- Batch processing
4. Knowledge Base (/knowledge)
Browse and manage your knowledge items.
Components:
- Knowledge Grid: Card-based knowledge display
- Search/Filter: Search by title, type, tags
- Knowledge Details: View full item details
- Actions: Delete, refresh, organize
Features:
- Pagination support
- Real-time updates via WebSocket
- Type-based filtering (technical/business)
- Metadata display
5. RAG Chat (/chat)
Interactive chat interface for testing RAG queries.
Components:
- Chat Messages: Threaded conversation view
- Input Area: Query input with source selection
- Results Display: Formatted RAG results
- Source Selector: Filter by knowledge source
Features:
- Real-time streaming responses
- Source attribution
- Markdown rendering
- Copy functionality
🧩 Component Library
Base UI Components
Button
<Button
variant="primary|secondary|ghost"
size="sm|md|lg"
accentColor="blue|green|purple|orange|pink"
onClick={handleClick}
>
Click me
</Button>
Card
<Card accentColor="blue" className="p-6">
<h3>Card Title</h3>
<p>Card content</p>
</Card>
LoadingSpinner
<LoadingSpinner size="sm|md|lg" />
Layout Components
Sidebar
- Collapsible navigation
- Active route highlighting
- Icon + text navigation items
- Responsive design
Header
- Dark mode toggle
- User menu
- Breadcrumb navigation
Animation Components
PageTransition
Wraps pages with smooth fade/slide animations:
<PageTransition>
<YourPageContent />
</PageTransition>
🔌 Services
mcpService
Handles all MCP server communication:
startServer(): Start the MCP serverstopServer(): Stop the MCP servergetStatus(): Get current server statusstreamLogs(): WebSocket log streaminggetAvailableTools(): Fetch MCP tools
api
Base API configuration with:
- Automatic error handling
- Request/response interceptors
- Base URL configuration
- TypeScript generics
chatService
RAG query interface:
sendMessage(): Send RAG querystreamResponse(): Stream responsesgetSources(): Get available sources
🎨 Styling
Tailwind Configuration
- Custom color palette
- Dark mode support
- Custom animations
- Responsive breakpoints
Theme Variables
--primary: Blue accent colors
--secondary: Gray/neutral colors
--success: Green indicators
--warning: Orange indicators
--error: Red indicators
🚀 Development
Setup
# Install dependencies
npm install
# Start dev server
npm run dev
# Build for production
npm run build
# Run tests
npm test
Environment Variables
VITE_API_URL=http://localhost:8080
Hot Module Replacement
Vite provides instant HMR for:
- React components
- CSS modules
- TypeScript files
🧪 Testing
Unit Tests
- Component testing with React Testing Library
- Service mocking with MSW
- Hook testing with @testing-library/react-hooks
Integration Tests
- Page-level testing
- API integration tests
- WebSocket testing
📦 Build & Deployment
Docker Support
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
EXPOSE 5173
CMD ["npm", "run", "preview"]
Production Optimization
- Code splitting by route
- Lazy loading for pages
- Image optimization
- Bundle size analysis
🔧 Configuration Files
vite.config.ts
- Path aliases
- Build optimization
- Development server config
tsconfig.json
- Strict type checking
- Path mappings
- Compiler options
tailwind.config.js
- Custom theme
- Plugin configuration
- Purge settings
🤝 Contributing
Code Style
- ESLint configuration
- Prettier formatting
- TypeScript strict mode
- Component naming conventions
Git Workflow
- Feature branches
- Conventional commits
- PR templates
- Code review process