3.1 KiB
3.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Build & Test Commands
# Build solution
dotnet build KoogleApp.sln
# Run the application
dotnet run --project KoogleApp/KoogleApp.csproj
# Run all tests
dotnet test
# Run specific test class
dotnet test --filter "FullyQualifiedName~Koogle.Tests.ReducerTests.ThrowPanelStateTests"
# Run specific test method
dotnet test --filter "FullyQualifiedName~Koogle.Tests.GameTraining.GameTrainingServiceTest.ServiceWorksCorrectly"
Entity Framework Migrations
# Create migration
dotnet ef migrations add <MigrationName> --project ./KoogleApp/KoogleApp.csproj
# Update database (Development)
dotnet ef --startup-project ./KoogleApp/KoogleApp.csproj --project ./KoogleApp/KoogleApp.csproj database update -- Development
Architecture Overview
This is a Blazor Server application (.NET 9) for tracking a 9-pin bowling (Kegeln) game. It uses:
- Fluxor for state management (Redux pattern)
- MudBlazor for UI components
- SignalR for real-time synchronization between clients
- Entity Framework Core with SQL Server
Fluxor Store Structure (Store/)
The state is organized into feature slices following the Redux pattern:
Store/Game/- Core game state managementThrowPanel/- Pin states (9 pins), throw counter, throw mode (Reposition/Decrease)Participants/- Active players and turn orderSetup/- Game configuration stateUndoRedo/- History management for game actionsMenus/- Game-specific menu actionsThrowTimer/- Timer state for throws
Store/Player/- Player management (CRUD)Store/DayFeature/- Day/session managementStore/ModelFeature/- Shared model state
Each feature contains: State.cs, Actions.cs, Reducers.cs, Effects.cs, Selectors.cs
Game Plugin System (Games/)
Games are implemented as plugins via IKnownGame interface:
IKnownGame- Defines game metadata and component typesIGameService- Handles game logic (throws, player progression)IGameSetupModel/IGameModel/IGameState- Data contracts with JSON serialization support
Current implementations:
Games/Training/- Training modeGames/Shit/- "Shit" game variant
To add a new game:
- Create folder in
Games/withIKnownGameimplementation - Create setup component (Razor), board component, and
IGameServiceimplementation - Add JSON type discriminator to
IGameStateandIGameSetupModelinterfaces
Key Models
ThrowPanelState- Contains 9 pin states (PinStatus: Standing/Fallen/Disabled), throw mode, throw counterGameProgress- Tracks state transitions during a throw (before/after states)ParticipantsState- Player order and turn tracking
Real-time Sync
SharedModelHub (SignalR) broadcasts state changes between connected clients. HubConnectionService manages client-side connections.
Services Registration
Services/ServiceExtension.cs contains DI registration:
AddDbServices()- Database and IdentityAddAppServices()- Fluxor, repositories, game services (auto-discovered via reflection)