rabukasim / docs /PROJECT_STRUCTURE.md
trioskosmos's picture
Upload folder using huggingface_hub
463f868 verified

Lovecasim Project Structure

This document defines the Single Source of Truth for all file locations. Do NOT create duplicate files in other locations.

πŸ“‚ Source of Truth Map

Component Canonical Identity Location Notes
Frontend Web UI Assets frontend/web_ui/ ONLY edit here. Served by Flask.
Backend Flask Server backend/server.py The only active server file.
Data Game Data data/ cards.json lives here. Compiler syncs to engine/data/.
Engine Python Logic engine/ Game state, logic, tests.
Engine (Rust) Rust Core engine_rust_src/ Rust source code.
Compiler Data Compiler compiler/ main.py compiles JSON.
Tools Scripts/Utils tools/ All utility scripts.
AI RL Agents ai/ Training and inference code.
Reports Analysis Outputs reports/ Generated analysis and audit reports.

🚫 Forbidden / Legacy Paths

Path Status Action
css/ DELETED Use frontend/web_ui/css/
js/ DELETED Use frontend/web_ui/js/
scripts/ MOVED Moved to tools/_legacy_scripts/
engine/data/ READ-ONLY Auto-synced from data/. Do not edit manually.
backend/server_old.py DELETED Use backend/server.py
compiler/parser_legacy.py DELETED Use compiler/parser.py

πŸ› οΈ Workflow Rules

  1. Editing Frontend:

    • Always work in frontend/web_ui/.
    • Do NOT create frontend/css or frontend/js (without web_ui).
  2. Editing Data:

    • Edit data/cards.json.
    • Run uv run python -m compiler.main to compile.
    • This automatically updates engine/data/cards_compiled.json.
  3. Running Scripts:

    • Scripts in tools/ should reference data/ for input/output where possible.
    • Legacy scripts in tools/_legacy_scripts/ may need migration.
  4. Tests:

    • Run cargo test --manifest-path engine_rust_src/Cargo.toml --no-fail-fast -- --nocapture.
    • Rust tests read from engine/data/ (which is synced from data/).

🌳 Detailed Tree

loveca-copy/
β”œβ”€β”€ ai/                 # AI Agents & Training
β”œβ”€β”€ backend/            # Flask Server
β”‚   └── server.py       # Main Entry Point
β”œβ”€β”€ compiler/           # Card Data Compiler
β”œβ”€β”€ data/               # MASTER Data Directory
β”‚   β”œβ”€β”€ cards.json      # Edited by Humans
β”‚   └── cards_compiled.json # Generated
β”œβ”€β”€ docs/               # Documentation
β”œβ”€β”€ engine/             # Python Game Engine
β”‚   β”œβ”€β”€ data/           # Symlinked/Synced from ../data
β”‚   β”œβ”€β”€ game/           # Game Logic
β”‚   └── tests/          # Engine support code, not the canonical test suite
β”œβ”€β”€ engine_rust_src/    # Rust Implementation
β”œβ”€β”€ frontend/           # Web Interface
β”‚   └── web_ui/         # SERVED Directory
β”‚       β”œβ”€β”€ css/
β”‚       β”œβ”€β”€ js/
β”‚       └── index.html
β”œβ”€β”€ reports/            # Analysis Reports
└── tools/              # Utilities & Scripts
    └── _legacy_scripts/ # Archived scripts