mirror of
https://github.com/coleam00/Archon.git
synced 2025-12-23 18:29:18 -05:00
* Add improved development environment with backend in Docker and frontend locally - Created dev.bat script to run backend services in Docker and frontend locally - Added docker-compose.backend.yml for backend-only Docker setup - Updated package.json to run frontend on port 3737 - Fixed api.ts to use default port 8181 instead of throwing error - Script automatically stops production containers to avoid port conflicts - Provides instant HMR for frontend development * Refactor development environment setup: replace dev.bat with Makefile for cross-platform support and enhanced commands * Enhance development environment: add environment variable checks and update test commands for frontend and backend * Improve development environment with Docker Compose profiles This commit enhances the development workflow by replacing the separate docker-compose.backend.yml file with Docker Compose profiles, fixing critical service discovery issues, and adding comprehensive developer tooling through an improved Makefile system. Key improvements: - Replace docker-compose.backend.yml with cleaner profile approach - Fix service discovery by maintaining consistent container names - Fix port mappings (3737:3737 instead of 3737:5173) - Add make doctor for environment validation - Fix port configuration and frontend HMR - Improve error handling with .SHELLFLAGS in Makefile - Add comprehensive port configuration via environment variables - Simplify make dev-local to only run essential services - Add logging directory creation for local development - Document profile strategy in docker-compose.yml These changes provide three flexible development modes: - Hybrid mode (default): Backend in Docker, frontend local with HMR - Docker mode: Everything in Docker for production-like testing - Local mode: API server and UI run locally Co-authored-by: Zak Stam <zaksnet@users.noreply.github.com> * Fix make stop command to properly handle Docker Compose profiles The stop command now explicitly specifies all profiles to ensure all containers are stopped regardless of how they were started. * Fix README to document correct make commands - Changed 'make lint' to 'make lint-frontend' and 'make lint-backend' - Removed non-existent 'make logs-server' command - Added 'make watch-mcp' and 'make watch-agents' commands - All documented make commands now match what's available in Makefile * fix: Address critical issues from code review #435 - Create robust environment validation script (check-env.js) that properly parses .env files - Fix Docker healthcheck port mismatch (5173 -> 3737) - Remove hard-coded port flags from package.json to allow environment configuration - Fix Docker detection logic using /.dockerenv instead of HOSTNAME - Normalize container names to lowercase (archon-server, archon-mcp, etc.) - Improve stop-local command with port-based fallback for process killing - Fix API configuration fallback chain to include VITE_PORT - Fix Makefile shell variable expansion using runtime evaluation - Update .PHONY targets with comprehensive list - Add --profile flags to Docker Compose commands in README - Add VITE_ARCHON_SERVER_PORT to docker-compose.yml - Add Node.js 18+ to prerequisites - Use dynamic ports in Makefile help messages - Add lint alias combining frontend and backend linting - Update .env.example documentation - Scope .gitignore logs entry to /logs/ Co-Authored-By: Claude <noreply@anthropic.com> * Fix container name resolution for MCP server - Add dynamic container name resolution with three-tier strategy - Support environment variables for custom container names - Add service discovery labels to docker-compose services - Update BackendStartupError with correct container name references * Fix frontend test failures in API configuration tests - Update environment variable names to use VITE_ prefix that matches production code - Fix MCP client service tests to use singleton instance export - Update default behavior tests to expect fallback to port 8181 - All 77 frontend tests now pass * Fix make stop-local to avoid Docker daemon interference Replace aggressive kill -9 with targeted process termination: - Filter processes by command name (node/vite/python/uvicorn) before killing - Use graceful SIGTERM instead of SIGKILL - Add process verification to avoid killing Docker-related processes - Improve logging with descriptive step messages * refactor: Simplify development workflow based on comprehensive review - Reduced Makefile from 344 lines (43 targets) to 83 lines (8 essential targets) - Removed unnecessary environment variables (*_CONTAINER_NAME variables) - Fixed Windows compatibility by removing Unix-specific commands - Added security fixes to check-env.js (path validation) - Simplified MCP container discovery to use fixed container names - Fixed 'make stop' to properly handle Docker Compose profiles - Updated documentation to reflect simplified workflow - Restored original .env.example with comprehensive Supabase key documentation This addresses all critical issues from code review: - Cross-platform compatibility ✅ - Security vulnerabilities fixed ✅ - 81% reduction in complexity ✅ - Maintains all essential functionality ✅ All tests pass: Frontend (77/77), Backend (267/267) * feat: Add granular test and lint commands to Makefile - Split test command into test-fe and test-be for targeted testing - Split lint command into lint-fe and lint-be for targeted linting - Keep original test and lint commands that run both - Update help text with new commands for better developer experience * feat: Improve Docker Compose detection and prefer modern syntax - Prefer 'docker compose' (plugin) over 'docker-compose' (standalone) - Add better error handling in Makefile with proper exit on failures - Add Node.js check before running environment scripts - Pass environment variables correctly to frontend in hybrid mode - Update all documentation to use modern 'docker compose' syntax - Auto-detect which Docker Compose version is available * docs: Update CONTRIBUTING.md to reflect simplified development workflow - Add Node.js 18+ as prerequisite for hybrid development - Mark Make as optional throughout the documentation - Update all docker-compose commands to modern 'docker compose' syntax - Add Make command alternatives for testing (make test, test-fe, test-be) - Document make dev for hybrid development mode - Remove linting requirements until codebase errors are resolved * fix: Rename frontend service to archon-frontend for consistency Aligns frontend service naming with other services (archon-server, archon-mcp, archon-agents) for better consistency in Docker image naming patterns. --------- Co-authored-by: Zak Stam <zakscomputers@hotmail.com> Co-authored-by: Zak Stam <zaksnet@users.noreply.github.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