Set up the complete project foundation for ClawX, a graphical AI assistant: - Electron main process with IPC handlers, menu, tray, and gateway management - React renderer with routing, layout components, and page scaffolding - Zustand state management for gateway, settings, channels, skills, chat, and cron - shadcn/ui components with Tailwind CSS and CSS variable theming - Build tooling with Vite, electron-builder, and TypeScript configuration - Testing setup with Vitest and Playwright - Development configurations (ESLint, Prettier, gitignore, env example)
3.9 KiB
3.9 KiB
Commit 1: Project Skeleton
Summary
Initialize the ClawX project with Electron + React + TypeScript architecture, including all foundational components for v0.1.0 Alpha.
Changes
Project Configuration
package.json- Project dependencies and scriptstsconfig.json/tsconfig.node.json- TypeScript configurationvite.config.ts- Vite bundler configuration with Electron pluginstailwind.config.js/postcss.config.js- Tailwind CSS setupelectron-builder.yml- Multi-platform packaging configuration.eslintrc.cjs/.prettierrc- Code style configurationvitest.config.ts- Test framework configuration.gitignore/.env.example- Git and environment setup
Electron Main Process (electron/)
main/index.ts- Main process entry pointmain/window.ts- Window state managementmain/tray.ts- System tray functionalitymain/menu.ts- Application menumain/ipc-handlers.ts- IPC communication handlersgateway/manager.ts- Gateway process lifecycle managementgateway/client.ts- Typed Gateway RPC clientgateway/protocol.ts- JSON-RPC protocol definitionspreload/index.ts- Context bridge for rendererutils/config.ts- Configuration constantsutils/logger.ts- Logging utilityutils/paths.ts- Path resolution helpersutils/store.ts- Persistent storage
React Renderer (src/)
main.tsx/App.tsx- Application entry and root componentstyles/globals.css- Global styles with CSS variables
Components
components/ui/- shadcn/ui base components (Button, Card, Input, Badge, etc.)components/layout/MainLayout.tsx- Main application layoutcomponents/layout/Sidebar.tsx- Navigation sidebarcomponents/layout/Header.tsx- Top header barcomponents/common/- Common components (LoadingSpinner, StatusBadge, ErrorBoundary)
Pages
pages/Dashboard/index.tsx- Overview dashboardpages/Chat/index.tsx- Chat interfacepages/Channels/index.tsx- Channel managementpages/Skills/index.tsx- Skill browserpages/Cron/index.tsx- Scheduled taskspages/Settings/index.tsx- Application settingspages/Setup/index.tsx- First-run setup wizard
State Management
stores/gateway.ts- Gateway connection statestores/settings.ts- Application settingsstores/channels.ts- Channel datastores/skills.ts- Skills datastores/chat.ts- Chat messagesstores/cron.ts- Cron jobs
Types
types/electron.d.ts- Electron API typestypes/gateway.ts- Gateway typestypes/channel.ts- Channel typestypes/skill.ts- Skill typestypes/cron.ts- Cron job types
Resources
resources/icons/.gitkeep- Placeholder for app iconsresources/skills/bundles.json- Predefined skill bundles
Tests
tests/setup.ts- Test environment setuptests/unit/utils.test.ts- Utility function teststests/unit/stores.test.ts- Store tests
Technical Details
Architecture Decisions
- Vite + Electron: Using vite-plugin-electron for fast HMR during development
- Context Isolation: All IPC communication through preload script with strict channel validation
- Zustand Stores: Lightweight state management with persistence support
- shadcn/ui: Customizable, accessible UI components based on Radix primitives
- Dual-port Architecture: Separate ports for GUI (23333) and Gateway (18789)
Key Features Implemented
- ✅ Electron main process with window management
- ✅ System tray integration
- ✅ Gateway process lifecycle management
- ✅ WebSocket communication layer
- ✅ JSON-RPC protocol support
- ✅ React router with all main pages
- ✅ Zustand state management
- ✅ Dark/Light theme support
- ✅ Responsive sidebar navigation
- ✅ Setup wizard flow
- ✅ Unit test setup with Vitest
Version
v0.1.0-alpha
Dependencies
- Electron 33.3.0
- React 19.0.0
- TypeScript 5.7.2
- Vite 6.0.6
- Zustand 5.0.2
- Tailwind CSS 3.4.17