Spaces:
Running
Running
# Project Structure | |
AI-assisted iterative game development environment with real-time feedback | |
## Stack | |
- Runtime: Bun | |
- Language: TypeScript | |
- UI Framework: Svelte | |
- Game Engine: VibeGame (3D physics, ECS) | |
- Code Editor: Monaco Editor | |
- AI Agent: LangGraph.js with Hugging Face Inference | |
- WebSocket: ws (for real-time communication) | |
- Build: Vite | |
- Animation: GSAP (bundled with VibeGame) | |
- Physics: Rapier (via VibeGame) | |
- Rendering: Three.js (via VibeGame) | |
## Commands | |
- `bun dev` - Development server with hot reload on port 7860 | |
- `bun run build` - Build for production | |
- `bun run preview` - Preview production build | |
- `bun run check` - TypeScript + Svelte type checking | |
- `bun run lint` - ESLint code quality check | |
- `bun run format` - Auto-format with Prettier | |
- `bun run validate` - Complete validation (format, lint, type check) | |
## Layout | |
``` | |
vibegame/ | |
βββ CLAUDE.md # Global context (Tier 0) | |
βββ PLAN.md # Development roadmap | |
βββ layers/ | |
β βββ structure.md # Project structure (Tier 1) | |
β βββ context-template.md | |
βββ src/ | |
β βββ main.ts # Svelte app initialization | |
β βββ App.svelte # Root UI component (declarative) | |
β βββ lib/ | |
β βββ stores/ # State management | |
β βββ services/ # Business logic | |
β βββ server/ # WebSocket server & agent | |
β βββ components/ # UI components | |
β β βββ chat/ # AI chat interface | |
β β βββ console/ | |
β β βββ editor/ | |
β β βββ game/ | |
β β βββ layout/ | |
β βββ config/ # Configuration | |
βββ index.html # Entry point | |
βββ package.json # Dependencies and scripts | |
βββ tsconfig.json # TypeScript configuration | |
βββ vite.config.ts # Vite + Svelte + VibeGame config | |
βββ bun.lock # Dependency lock file | |
βββ agents.md # VibeGame documentation | |
βββ README.md | |
``` | |
## Architecture | |
Three-layer architecture: UI (Svelte) β Agent (Hugging Face) β Game (VibeGame) | |
- **UI Layer**: Svelte components for chat, code editing, console display | |
- **Agent Layer**: LangGraph.js agent via WebSocket with Read/Write tools | |
- **Game Layer**: VibeGame ECS with declarative XML scene definition | |
## Entry points | |
- Main entry: `index.html` (HTML shell) | |
- UI entry: `src/main.ts` (Svelte app mount) | |
- App root: `src/App.svelte` (Component tree root) | |
- Game definition: `<world>` tag in editor (Live-editable XML) | |
## Naming Conventions | |
TypeScript/Web standards with Svelte and ECS conventions | |
- Files: kebab-case for utilities, PascalCase for components (e.g., `Chat.svelte`, `mcp-tools.js`) | |
- Directories: lowercase (e.g., `src/`, `components/`, `stores/`) | |
- Svelte components: PascalCase (e.g., `Editor.svelte`, `Preview.svelte`) | |
- Stores: camelCase (e.g., `gameState`, `consoleMessages`) | |
- ECS Components: PascalCase (e.g., `Health`, `Transform`) | |
- Systems: PascalCase with "System" suffix (e.g., `HealthSystem`) | |
## Configuration | |
- TypeScript: `tsconfig.json` (Strict mode, ESNext target) | |
- Build: `vite.config.ts` (Vite with Svelte, VibeGame, WebSocket plugins) | |
- Dependencies: `package.json` (Svelte, VibeGame, Monaco, Hugging Face, ws) | |
- Game Scene: Live-editable in Monaco editor | |
## Where to add code | |
- UI components β `src/lib/components/[feature]/[Component].svelte` | |
- State management β `src/lib/stores/[store].ts` | |
- Business logic β `src/lib/services/[service].ts` | |
- Server/Agent logic β `src/lib/server/[module].ts` | |
- Configuration β `src/lib/config/[config].ts` | |
- Game entities β XML in Monaco editor | |
- Custom ECS components β `src/lib/game/components/[Component].ts` | |
- Custom systems β `src/lib/game/systems/[System].ts` | |