Files
yourpart-daemon/AGENTS.md

30 lines
2.2 KiB
Markdown

# Repository Guidelines
## Project Structure & Module Organization
- **Daemon-Worker Architecture**: A standalone Rust daemon for the Falukant game backend, managing game mechanics through background workers.
- **Workers (`./src/worker/`)**: Modular task handlers (e.g., `PoliticsWorker`, `FalukantFamilyWorker`, `EventsWorker`) that execute periodic game logic ("ticks"). Most workers extend the `BaseWorker` logic.
- **Database Layer**: Uses PostgreSQL for persistence. Core SQL queries are centralized in `./src/worker/sql.rs`, while connection management resides in `./src/db/`.
- **Real-time Communication**: `./src/websocket_server.rs` manages client connections, broadcasting game state updates via `./src/message_broker.rs`.
- **Migrations**: Database schema changes are managed manually via SQL scripts in `./migrations/`.
- **Documentation**: Detailed technical specs and handoff notes are located in `./docs/`.
## Build, Test, and Development Commands
- `cargo build`: Compile the project.
- `cargo clippy`: Run the linter to ensure code quality.
- `cargo run`: Start the daemon.
- `cargo fmt`: Format the codebase according to Rust standards.
- `cargo check`: Rapidly check for compilation errors.
## Coding Style & Naming Conventions
- **Rust Standards**: Follows idiomatic Rust conventions (snake_case for variables/functions, PascalCase for types).
- **Linter**: Enforced via `clippy`. Use `cargo clippy` before committing.
- **Database Logic**: Prefer centralizing complex SQL queries in `./src/worker/sql.rs` rather than inlining them in worker logic.
## Testing Guidelines
- **Manual Verification**: No automated test suite exists (`cargo test` returns no results). Verify changes by running the daemon and inspecting database state or WebSocket output.
- **Smoke Tests**: Follow instructions in `./docs/` for feature-specific manual testing (e.g., `./docs/FALUKANT_DEATH_SUCCESSION_SMOKE_TEST.md`).
## Commit & Pull Request Guidelines
- **Commit Messages**: Primarily written in German, though English is acceptable. Messages typically start with an imperative verb (e.g., "Füge", "Verbessere", "Behebe", "Refactor", "Enhance").
- **Context**: Reference specific features or workers in the commit subject to maintain clarity in the history.