Add mobile app support and opening training feature
This commit implements iOS/Android mobile app support using Capacitor and adds a comprehensive opening training feature with LLM-powered explanations. ## Mobile App Infrastructure - Add Capacitor configuration for iOS/Android builds - Create mobile build script that excludes API routes - Update Next.js config for conditional static export - Add layout components with generateStaticParams for static builds - Generate 500+ static pages for offline mobile use ## Chess Engine Abstraction - Create ChessEngine interface for pluggable implementations - Add LocalEngine (GPL - uses stockfish.js in browser) - Add RemoteEngine (proprietary - calls API server) - Factory pattern selects engine based on environment - Enables GPL compliance for web, proprietary for mobile ## Opening Training Feature - Interactive opening repertoire training - Move validation with engine-backed feedback - LLM explanations using Gemini API - Wikipedia integration for opening context - Opening family grouping (e4, d4, c4, etc.) - Session state management - Real-time move feedback with evaluation Components: - OpeningSelector: Browse and select openings by family - OpeningTrainer: Main training interface with chessboard - MoveFeedback: Display move quality and LLM explanations - WikipediaSummary: Show opening history and context - ErrorBoundary: Graceful error handling Services: - openingLoader: Load and filter opening database - engineService: Engine evaluation wrapper - moveValidator: Validate moves against repertoire - feedbackGenerator: Generate contextual feedback - wikipediaService: Fetch and cache Wikipedia data - sessionManager: Track training session state ## Wikipedia Integration - Automatic Wikipedia article fetching for openings - Client-side and server-side caching - Sanitized summaries with proper formatting - Link opening database to Wikipedia slugs - API endpoints for on-demand fetching ## Docker Improvements - Add entrypoint script for automatic data setup - Fetch Wikipedia data on first container startup - Generate opening move index automatically - Remove generated data from git (public/openings/*.json, public/wikipedia/*.json) - Add READMEs explaining data requirements - Update .gitignore for generated files ## Dual Licensing Strategy - Add LICENSING.md explaining dual licensing approach - GPL-3.0 for web builds (includes Stockfish) - Proprietary option for mobile builds (no GPL code) - Single codebase, multiple licensing models - Legal compliance documented ## API Endpoints - POST /api/v1/llm/opening-explanation - Get LLM move explanations - GET /api/v1/wikipedia/summary - Fetch Wikipedia summaries ## Type Updates - Add openingTraining types - Update Tutor component to use ChessEngine interface - Add Gemini error handling types 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
+18
-2
@@ -12,14 +12,27 @@
|
||||
"test:e2e": "playwright test",
|
||||
"test:e2e:ui": "playwright test --ui",
|
||||
"test:e2e:headed": "playwright test --headed",
|
||||
"test:all": "npm test && npm run test:e2e"
|
||||
"test:all": "npm test && npm run test:e2e",
|
||||
"build:opening-index": "node scripts/buildOpeningIndex.js",
|
||||
"cache:wikipedia": "tsx scripts/fetch-wikipedia-openings.ts",
|
||||
"update:wikipedia-slugs": "tsx scripts/add-wikipedia-to-openings.ts",
|
||||
"build:mobile": "./scripts/build-mobile.sh",
|
||||
"mobile:build": "npm run build:mobile && npx cap sync",
|
||||
"mobile:ios": "npm run mobile:build && npx cap open ios",
|
||||
"mobile:android": "npm run mobile:build && npx cap open android",
|
||||
"cap:sync": "npx cap sync",
|
||||
"cap:copy": "npx cap copy"
|
||||
},
|
||||
"dependencies": {
|
||||
"@capacitor/android": "^7.4.4",
|
||||
"@capacitor/cli": "^7.4.4",
|
||||
"@capacitor/core": "^7.4.4",
|
||||
"@capacitor/ios": "^7.4.4",
|
||||
"@google/generative-ai": "^0.24.1",
|
||||
"chess.js": "^1.4.0",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.554.0",
|
||||
"next": "16.0.3",
|
||||
"next": "^16.0.7",
|
||||
"react": "19.2.0",
|
||||
"react-chessboard": "^5.8.4",
|
||||
"react-dom": "19.2.0",
|
||||
@@ -37,6 +50,8 @@
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"baseline-browser-mapping": "^2.9.4",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.0.3",
|
||||
"jest": "^30.2.0",
|
||||
@@ -44,6 +59,7 @@
|
||||
"tailwindcss": "^4",
|
||||
"ts-jest": "^29.4.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsx": "^4.19.2",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user