2.9 KiB
2.9 KiB
Repository Guidelines
Project Structure & Module Organization
legacy/contains the application source. This is the active codebase.- PHP entry points live under
legacy/andlegacy/hwe/(for examplelegacy/index.php,legacy/hwe/index.php). legacy/is mostly a shell;legacy/src/is largely unused.- Core PHP domain logic lives under
legacy/hwe/sammo/(PSR-4sammo\\namespace). legacy/hwe/sammo/is the game engine core, organized by domain concerns rather than endpoints.Command/contains turn actions (general/nation commands) and their resolution rules.API/exposes engine operations for UI and automation (general, nation, command, message, auction, etc.).Event/andStaticEvent/implement dynamic and scheduled event processing.General*,Nation*,WarUnit*,City*classes model game entities and combat/city state.Action*andSpecial*capture traits, personalities, special actions, and scenario effects.Trigger*and*Triggermanage conditional logic for units, generals, and state changes.Scenario/andScenario.phpdefine scenario loading and rulesets.DTO/,VO/,Enums/,Constraint/are shared types and validation rules.
- Frontend TypeScript/Vue sources are in
legacy/hwe/ts/with shared components inlegacy/hwe/ts/components/. - Styles are split between
legacy/css/and SCSS inlegacy/hwe/scss/. - Tests: PHPUnit in
legacy/tests/, TypeScript tests inlegacy/hwe/test-ts/. - Static data/assets: scenarios in
legacy/hwe/scenario/, templates inlegacy/hwe/templates/.
Build, Test, and Development Commands
Run commands from legacy/ unless noted.
composer installinstalls PHP dependencies.npm installinstalls frontend/tooling dependencies.npm run buildbuilds production JS/CSS via webpack.npm run buildDevbuilds development assets.npm run watchornpm run watchProdruns webpack in watch mode.npm run lintlintslegacy/hwe/tswith ESLint.npm testruns all tests (phpunit+mocha).vendor/bin/phpunit --bootstrap vendor/autoload.php testsruns PHP tests only.npm run test-tsruns TypeScript tests only.
Coding Style & Naming Conventions
- Indentation: 4 spaces, no tabs; line length ~120
- PHP modules follow PSR-4 in
legacy/src/sammo/. - Legacy endpoints are named by role: JSON handlers
legacy/hwe/j_*.php, viewslegacy/hwe/v_*.php, admin pageslegacy/hwe/_admin*.php. - Vue components use PascalCase filenames (e.g.,
legacy/hwe/ts/components/MapViewer.vue).
Commit & Pull Request Guidelines
- Git history is minimal and does not define a strict convention; use short, imperative messages (e.g., "Fix map cache loading").
- PRs should include a concise description, testing notes/commands, and screenshots for UI changes.
- Avoid committing secrets; use templates in
legacy/f_install/templates/and settings files underlegacy/hwe/d_setting/as references.