chore: Set up shared-models library and initial project structure for NowChessSystems

This commit is contained in:
2026-03-21 17:07:28 +01:00
parent a8d457a612
commit 9c2456e928
28 changed files with 815 additions and 12 deletions
+5
View File
@@ -0,0 +1,5 @@
# Architect Agent Memory Index
## Project
- [api-shared-models module](project_api_module.md) — Status and design of `modules/api`; package layout, what belongs/doesn't, ADR location
@@ -0,0 +1,20 @@
---
name: api-shared-models module
description: Status and design decisions for the modules/api shared-models library
type: project
---
`modules/api` is established as the shared-models library for NowChessSystems.
**Why:** All microservices need a common chess domain vocabulary (Square, Move, GameState, etc.) and cross-cutting API envelope types (ApiResponse, ApiError). Without a shared module, types diverge and cause serialisation mismatches.
**How to apply:** When designing any new service, confirm it declares `implementation(project(":modules:api"))` and does not duplicate any of the types already present. New cross-cutting types (used by 2+ services) should go into `modules/api`, not into a service module.
Package layout:
- `de.nowchess.api.board` — Color, PieceType, Piece, File, Rank, Square
- `de.nowchess.api.game` — CastlingRights, GameState, GameResult, GameStatus
- `de.nowchess.api.move` — MoveType, Move, PromotionPiece
- `de.nowchess.api.player` — PlayerId (opaque type), PlayerInfo
- `de.nowchess.api.response` — ApiResponse[A], ApiError, Pagination, PagedResponse[A]
ADR: `docs/adr/ADR-002-api-shared-models.md`
@@ -0,0 +1,4 @@
# Agent Memory Index
## Project
- [project_chess_tui.md](project_chess_tui.md) — Chess TUI in modules/core under de.nowchess.chess: model, renderer, parser, game loop
@@ -0,0 +1,19 @@
---
name: chess_tui_implementation
description: Chess TUI implemented in modules/core under de.nowchess.chess — model, renderer, parser, game loop
type: project
---
Chess TUI standalone app implemented in `modules/core`, package `de.nowchess.chess`.
**Why:** Initial feature to demonstrate the system's TUI capability per ADR-001.
**How to apply:** When extending the chess logic (legality, castling, en passant, promotion), build on the existing `Model.scala` opaque `Board` type and add methods via extension. The `@main` entry point is `chessMain` in `Game.scala`. `Test.scala` still exists as a separate hello-world stub — do not remove it.
Key design choices:
- `Board` is an opaque type over `Map[Square, Piece]` with extension methods
- `Color` and `PieceType` are Scala 3 enums
- `Renderer.render` returns `String`, never prints
- `Parser.parseMove` returns `Option[(Square, Square)]` — coordinate notation only (e.g. `e2e4`)
- No move legality validation — moves are applied as-is
- ANSI 256-colour background codes used for light/dark squares (48;5;223 beige, 48;5;130 brown)