docs: expand README quick start with full dev/debug setup
- Step-by-step backend setup: venv, secret key generation (openssl + Fernet), .env configuration with annotated minimum values - VS Code launch.json snippets for backend (debugpy/uvicorn) and frontend (Chrome with source maps) - Vite proxy detail (/api → :8000, /ws → ws://:8000) - Backend pytest commands alongside existing frontend test section - Playwright headed/UI mode instructions for E2E debugging - Updated unit test count to 173; removed stale E2E count - CLAUDE.md quick start trimmed to point at README for full setup
This commit is contained in:
45
CLAUDE.md
45
CLAUDE.md
@@ -3,16 +3,17 @@
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Backend (from backend/)
|
||||
python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
||||
# Backend (from backend/, venv must be active)
|
||||
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
||||
|
||||
# Frontend (from frontend/)
|
||||
npx vite --host
|
||||
npm run dev
|
||||
```
|
||||
|
||||
- Backend API: http://localhost:8000 (docs: http://localhost:8000/docs)
|
||||
- Frontend: http://localhost:5173
|
||||
- Default admin: `admin` / (random, printed at first startup; reset via `python -c "from core.auth.utils import hash_password; print(hash_password('admin123'))"` then update SQLite)
|
||||
- Frontend: http://localhost:5173 (Vite proxies /api and /ws to :8000)
|
||||
- Default admin: `admin` / (random, printed at first startup)
|
||||
- Full setup instructions (secrets, venv, debug configs): see README.md
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -94,29 +95,13 @@ cd frontend && npx tsc --noEmit
|
||||
- **Arma 3 per-mission params**: `ServerConfig.missions` is now `list[MissionRotationItem]` (adds optional `params: dict`). A new `default_mission_params` field holds server-wide defaults. Config version bumped to `"1.1.0"`. `_render_server_cfg()` now emits a `class Missions { ... }` block when the rotation is non-empty; `class Params` inside each mission uses per-mission params → global defaults → omit (in that priority order). The `MissionRotationEntry.params` is edited per-row in the Missions tab via `MissionParamsEditor`; `default_mission_params` is edited in the Config tab via the `key-value` widget.
|
||||
- **Config version migration**: `migrate_config("1.0.0", ...)` backfills `params: {}` on each existing rotation entry and adds `default_mission_params: {}`. `normalize_section()` does the same on reads for stored rows that pre-date the migration run.
|
||||
|
||||
## Known Bugs — Mods Tab (fix next session)
|
||||
## Mods Tab — Implementation Notes
|
||||
|
||||
Three bugs prevent the Mods tab from working correctly:
|
||||
|
||||
### Bug 1 — Save fails with TypeError (critical)
|
||||
`Arma3ModManager.set_enabled_mods()` calls `config_repo.upsert_section()` with wrong keyword argument names:
|
||||
- Passes `data=` → should be `config_data=`
|
||||
- Passes `expected_version=` → should be `expected_config_version=`
|
||||
- Missing required `game_type=` argument
|
||||
- Missing required `schema_version=` argument
|
||||
|
||||
**File:** `backend/adapters/arma3/mod_manager.py`, `set_enabled_mods()` method (~line 127)
|
||||
|
||||
### Bug 2 — Mods not applied on server start (critical)
|
||||
`service.py` `start_server()` reads mods from a `server_mods` JOIN `mods` table (SQLAlchemy query, ~line 246) — but those tables are never populated by the Mods tab UI. The correct source is `config_repo.get_section(server_id, "mods")["enabled_mods"]`. The start flow needs to read from `config_repo` instead of the dead `server_mods` table join.
|
||||
|
||||
**File:** `backend/core/servers/service.py`, `start_server()` method (~line 242–255)
|
||||
|
||||
### Bug 3 — Wrong mod folder location (UX)
|
||||
`list_available_mods()` scans the server root (`get_server_dir()`) for `@*` folders. Mods should live in a `mods/` subfolder: `{server_dir}/mods/@ModName`. Needs:
|
||||
1. Change scan path: `server_dir / "mods"` instead of `server_dir`
|
||||
2. Ensure the `mods/` subdirectory is created by `ensure_server_dirs` (add `"mods"` to the Arma3 `get_server_dir_layout()`)
|
||||
3. Update CLAUDE.md + user docs to say mods go in `D:/ImContainer/Arma3Server/{id}/mods/@ModName`
|
||||
|
||||
**File:** `backend/adapters/arma3/mod_manager.py`, `list_available_mods()` and `_server_dir()` (~line 47–88)
|
||||
Also: `backend/adapters/arma3/adapter.py`, `get_server_dir_layout()` (add `"mods"` entry)
|
||||
- Mods go in `{server_data_dir}/{server_id}/mods/@ModName` (e.g. `D:/ImContainer/Arma3Server/1/mods/@CBA_A3/`)
|
||||
- Enabled mods config schema: `{"enabled_mods": [{"name": "@CBA_A3", "is_server_mod": false}]}`
|
||||
- Old string-list format is auto-migrated to the dict format on read
|
||||
- `is_server_mod: true` → `-serverMod=` arg; `false` → `-mod=` arg
|
||||
- `list_available_mods()` scans `{server_dir}/mods/` for `@*` directories
|
||||
- `set_enabled_mods()` stores the new dict format; validates names against disk
|
||||
- Server start reads mods from `game_configs` via `config_repo`, NOT from the dead `server_mods` table
|
||||
- Directory scaffold: all 4 Arma3 subdirs (`server/`, `battleye/`, `mpmissions/`, `mods/`) are created on server create and backfilled on startup; each gets a `README.txt` if not already present
|
||||
Reference in New Issue
Block a user