# AGENTS.md

## Repository Role

This repository contains the C++ server source and build system for:

- `game`
- `db`
- `qc`
- smoke/login test binaries

The current production VPS runs a Debian deployment built from `main`.

## Working Rules

- Prefer small, reviewable changes directly on `main`.
- Keep Debian runtime stability ahead of broad refactors.
- Do not commit `build/`, temporary captures, or host-local debug output.
- Do not commit secrets or production-only credentials.

## Build And Test

Typical local build:

```bash
cmake -S . -B build -G Ninja
cmake --build build
ctest --test-dir build --output-on-failure
```

Important test targets:

- `metin_smoke_tests`
- `metin_login_smoke`

## High-Risk Areas

Changes in these areas require extra care:

- auth/login flow
- packet headers and packet structs
- `SecureCipher`
- `fdwatch` and socket output path
- DB login/account flow

When changing login, auth, packet, or network behavior:

- build and run smoke tests
- keep protocol compatibility with `m2dev-client-src`
- keep client asset behavior in sync with `m2dev-client`

## Production Verification

The current VPS has a root-only end-to-end login check:

```bash
/usr/local/sbin/metin-login-healthcheck
```

Use it after risky auth/network/runtime changes.

## Cross-Repo Boundaries

- server code changes belong here
- runtime/config/systemd/docs changes belong in `m2dev-server`
- client protocol implementation changes belong in `m2dev-client-src`
- client asset/login screen/server list changes belong in `m2dev-client`
