diff --git a/AGENTS.md b/AGENTS.md index d7728e6..62996db 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -33,7 +33,7 @@ - Public report lookup is `GET /api/reports?character_id=`; it searches saved report participant IDs, returns at most 100 newest rows without `actor_id`, and is covered by `tests/test_report_lookup.py`. VK `/мои-отчёты` uses the callback sender ID and the same history store; validate with `python -m unittest tests.test_report_lookup tests.test_history tests.test_vk_bot -q`. ## Notes -- LU trainer is implemented at `/lu-trainer` and `/lu-trainer/` through both Python and Nginx. `web/lu-trainer/engine.js` is DOM-free; UI consumes public snapshots without hidden hazards/values. Keep notes separate from facts, map selection separate from jumping, eight-neighbor availability relative to any opened cell, and transition cells outside victory counts. Preserve documented training formulas; do not claim they are verified CatWar rules. Original art provenance is in `web/lu-trainer/assets/README.md`. +- LU trainer is implemented at `/trainer` and `/trainer/` through both Python and Nginx. `web/lu-trainer/engine.js` is DOM-free; UI consumes public snapshots without hidden hazards/values. Keep notes separate from facts, map selection separate from jumping, eight-neighbor availability relative to any opened cell, and transition cells outside victory counts. Preserve documented training formulas; do not claim they are verified CatWar rules. Original art provenance is in `web/lu-trainer/assets/README.md`. - LU checks (prefer remote test-zone MCP when exposed): Node 24 `node --test tests/lu-trainer/engine.test.mjs`; isolated Python `python -m unittest tests.test_lu_trainer tests.test_calculator_web -q`; `node --check web/lu-trainer/ui.js`; `node tests/browser/lu-trainer.cjs` with the same bundled Playwright, loopback server and temporary stores as the calculator suite. No npm install or runtime dependency is needed. Browser coverage includes 1920/1366/768/390 widths, mouse/touch/keyboard, map projection, clear/restart confirmation, result locks, hints/timers, 200% layout and failed images. Inspect screenshots outside Git. Nginx aliases must serve the same HTML and correct asset MIME types; do not deploy to validate a client-only change. - `app/belki/weather.py` reads only the fixed public ULLI raw METAR endpoint (3-second timeout, 64 KiB bound, 5-minute process cache, 1-minute failure cache). `/api/weather/ulli` exposes only decoration settings; shared CSS/JS live at `/api/weather/effect.css` and `/api/weather/effect.js` so the existing gateway `/api/` route handles them. Keep weather independent of reports/storage, skip trend/remark/vicinity groups, reject observations older than 2 hours, and retain leaves on failure. Do not disable TLS verification. - VK scheduler lives in `app/belki/vk_scheduler.py`; use `BELKI_DATABASE_URL` in production and `BELKI_HISTORY_DB` for local SQLite checks. Keep mailing disabled until an administrator explicitly enables a conversation and schedule. diff --git a/LU_TRAINER_PROJECT.md b/LU_TRAINER_PROJECT.md index 531e008..663dcce 100644 --- a/LU_TRAINER_PROJECT.md +++ b/LU_TRAINER_PROJECT.md @@ -2,7 +2,7 @@ Дата: 2026-11-17. Статус: первая версия реализована по последующему запросу владельца «Реализуй LU_TRAINER_PROJECT.md». Публикация и развёртывание не выполнялись. -Текущая реализация: `/lu-trainer` и `/lu-trainer/`, файлы из таблицы ниже, оригинальные изображения с происхождением в `web/lu-trainer/assets/README.md`. Поддерживаются параметры, прыжки, подсказки, победа/падение, синхронная карта заметок, история и адаптивное управление. Проверки и их границы записаны в `structure_and_data.md`. Подробный текст ниже сохраняет основания первоначального проекта; историческое ограничение «только документация» относилось к предыдущему этапу. +Текущая реализация: `/trainer` и `/trainer/`, файлы из таблицы ниже, оригинальные изображения с происхождением в `web/lu-trainer/assets/README.md`. Поддерживаются параметры, прыжки, подсказки, победа/падение, синхронная карта заметок, история и адаптивное управление. Проверки и их границы записаны в `structure_and_data.md`. Подробный текст ниже сохраняет основания первоначального проекта; историческое ограничение «только документация» относилось к предыдущему этапу. ## Цель и подтверждённый объём @@ -124,7 +124,7 @@ ## Предлагаемое устройство реализации -В текущем репозитории реализована самостоятельная клиентская страница без новых runtime-зависимостей и БД. Реализованные публичные пути — `/lu-trainer` и `/lu-trainer/`. Файлы первой версии: +В текущем репозитории реализована самостоятельная клиентская страница без новых runtime-зависимостей и БД. Реализованные публичные пути — `/trainer` и `/trainer/`. Файлы первой версии: | Файл/область | Назначение | | --- | --- | diff --git a/MEMORY.md b/MEMORY.md index 5a42a0d..3541779 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -1,5 +1,7 @@ # MEMORY +- 2026-11-17: owner renamed the trainer public page to `/trainer` (also `/trainer/`). Homepage navigation, Python/Nginx page aliases and browser entry URLs follow that address. Internal `web/lu-trainer.html` and `/lu-trainer/` asset URLs are unchanged; the prior `/lu-trainer` page address below is historical. No push/deployment. + - 2026-11-17: implemented the owner-requested LU trainer at `/lu-trainer` and `/lu-trainer/`. The DOM-free original JS engine preserves the documented upstream training model (not verified CatWar rules); both grids consume snapshots without hidden hazards, with temporary hints disclosed only as action results. One in-memory attempt, separate notes, confirmed resets, terminal action locks and no CatWar account/report integration. Original imagegen forest/cat provenance is in `web/lu-trainer/assets/README.md`. No new runtime dependency. Local Node/Python/Chromium and isolated Nginx checks are recorded in `structure_and_data.md`; no registry push or deployment. - 2026-11-17: the owner-provided community chat link is maintained in `web/index.html` beside VK: `https://matrix.to/#/!hQAD8j0wKv51OhvyeAPqRBNyBzvzoZsqBIWYR_OgNxw?via=nyan404.ru`. Preserve both the room ID and `via` parameter when editing it. diff --git a/README.md b/README.md index e6a22a7..6ebca49 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Генератор отчётов и калькулятор -Тренажёр ЛУ «Лесные уступы» доступен по `/lu-trainer` и `/lu-trainer/`: игровая локация, персонаж, журнал и карта «Минное поле». Подробности модели и границы проверки — в [LU_TRAINER_PROJECT.md](./LU_TRAINER_PROJECT.md). +Тренажёр ЛУ «Лесные уступы» доступен по `/trainer` и `/trainer/`: игровая локация, персонаж, журнал и карта «Минное поле». Подробности модели и границы проверки — в [LU_TRAINER_PROJECT.md](./LU_TRAINER_PROJECT.md). Отдельный калькулятор для отчётов по прокачке ЛУ/ЗУ, тренировкам и осмотрам. Старые CatWar userscript-файлы остаются в `web/` и продолжают раздаваться по своим URL. diff --git a/app/main.py b/app/main.py index 9023d5f..85bffef 100644 --- a/app/main.py +++ b/app/main.py @@ -417,7 +417,7 @@ class Handler(BaseHTTPRequestHandler): if path in ("/sudoku", "/sudoku/"): self._file(WEB_ROOT / "sudoku.html") return - if path in ("/lu-trainer", "/lu-trainer/"): + if path in ("/trainer", "/trainer/"): self._file(WEB_ROOT / "lu-trainer.html") return if path == "/api/reports": diff --git a/docs/staging/specs/2026-11-17-lu-trainer.md b/docs/staging/specs/2026-11-17-lu-trainer.md index 7b32efc..4c05747 100644 --- a/docs/staging/specs/2026-11-17-lu-trainer.md +++ b/docs/staging/specs/2026-11-17-lu-trainer.md @@ -2,7 +2,7 @@ Authorization: the owner requested implementation of root `LU_TRAINER_PROJECT.md` on 2026-11-17. That existing design is the approved specification; this file records implementation choices within its scope. -contract: standalone `/lu-trainer` and `/lu-trainer/`, shared HTML/CSS/ES-module assets served by Python and Nginx. No new runtime dependency or storage. Gateway serves the page with `try_files`; assets use the existing static serving. +contract: standalone `/trainer` and `/trainer/`, shared HTML/CSS/ES-module assets served by Python and Nginx. No new runtime dependency or storage. Gateway serves the page with `try_files`; assets use the existing static serving. convention: native buttons/radios/dialogs, CSS tokens, Verdana/Georgia, Russian copy, DOM-independent ES-module engine, no upstream code or asset copying. state: engine owns 60 cells, hazards, opened set, marks set, last successful position, ready/playing/won/lost status and action log. A public snapshot omits hidden hazards/values. UI owns selection, action mode, map visibility and mark projection. invariant: 6x10, entrance (5,0), exit (3,9); transition cells do not count toward victory and cannot be opened/marked. Top-row first 5/3 cells are safe and initially available; any other cell requires an opened neighbor. Eight-neighbor counts; safe path connects entrance, base and exit. Preserve documented hazard formula and 0/10/20/30% hint probabilities. Win by all non-transition safe cells or all and only hazards marked; loss ends actions. Repeat safe visits produce feedback and may hint. The character tracks the last successful non-transition visit. diff --git a/nginx.conf b/nginx.conf index dd564be..a7633d5 100644 --- a/nginx.conf +++ b/nginx.conf @@ -50,11 +50,11 @@ http { # The trainer is entirely client-side; serve both aliases without # a redirect to the asset directory or a dependency on Belki's API. - location = /lu-trainer { + location = /trainer { try_files /lu-trainer.html =404; } - location = /lu-trainer/ { + location = /trainer/ { try_files /lu-trainer.html =404; } diff --git a/project_mind_map.md b/project_mind_map.md index 2ae6bc3..e63bd40 100644 --- a/project_mind_map.md +++ b/project_mind_map.md @@ -18,7 +18,7 @@ mindmap ui.js — public snapshots and two grids Original generated forest and cat assets No persistence or CatWar account access - /lu-trainer and /lu-trainer/ via Python and Nginx + /trainer and /trainer/ via Python and Nginx Node engine and Playwright acceptance Belki Domain diff --git a/structure_and_data.md b/structure_and_data.md index 523d817..3ef9f72 100644 --- a/structure_and_data.md +++ b/structure_and_data.md @@ -1,5 +1,10 @@ # Structure and Data +## Trainer public route — 2026-11-17 + +- Owner requested `/trainer` instead of `/lu-trainer`. Python and Nginx now expose `/trainer` and `/trainer/`; the homepage link and browser entry URLs use `/trainer`. Internal `web/lu-trainer.html` and `/lu-trainer/` asset URLs are retained. No game mechanics, runtime dependencies or deployment changes. +- Validation passed: 3 targeted Python routing/asset tests, Nginx syntax check, JS test-script syntax and diff checks, plus Chromium navigation from the homepage to `/trainer`, one rendered jump and the `/trainer/` alias. The gameplay suite changed only its entry URLs. Remote test-zone/token-optimizer MCP remain unavailable. Temporary venv/data and Nginx container/image were removed after verification. No push or deployment. + ## LU trainer implementation — 2026-11-17 - Implemented root `LU_TRAINER_PROJECT.md` after the owner's follow-up request to implement it. `/lu-trainer`, `/lu-trainer/` and `/lu-trainer.html` serve the same standalone page. Python aliases are explicit in `app/main.py`; Nginx aliases use `try_files /lu-trainer.html`. `Dockerfile` and `Dockerfile.gateway` already copy all `web/`; the gateway release Dockerfile also copies `nginx.conf`. Production images, cluster manifests and registry state were not changed. Existing gateway base publishing requirements still apply before a release. diff --git a/tests/browser/lu-trainer.cjs b/tests/browser/lu-trainer.cjs index 9379e28..210c55b 100644 --- a/tests/browser/lu-trainer.cjs +++ b/tests/browser/lu-trainer.cjs @@ -26,7 +26,7 @@ async function run() { const page = await context.newPage(), errors = []; page.on('pageerror',error => errors.push(error.message)); page.on('console',message => { if (message.type() === 'error') errors.push(message.text()); }); - await page.goto(`${origin}/lu-trainer${width === 768 ? '/' : ''}`); + await page.goto(`${origin}/trainer${width === 768 ? '/' : ''}`); await page.locator('#scene-grid button').last().waitFor(); assert.equal(await page.title(),'Тренажёр ЛУ — Лесные уступы'); assert.equal(await page.locator('#scene-grid button').count(),60); @@ -122,7 +122,7 @@ async function run() { try { await context.addInitScript(() => { let seed=19; Math.random=()=>{seed=(Math.imul(seed,1664525)+1013904223)>>>0;return seed/2**32;}; }); const page = await context.newPage(); - await page.goto(`${origin}/lu-trainer`); + await page.goto(`${origin}/trainer`); await page.locator('#scene-grid button').last().waitFor(); const cell = id=>page.locator(`#scene-grid button[data-id="${id}"]`); // Open safe reachable cells until a known adjacent hazard can be reached. @@ -192,7 +192,7 @@ async function run() { try { const page = await broken.newPage(); await page.route('**/lu-trainer/assets/*',route=>route.abort()); - await page.goto(`${origin}/lu-trainer`); + await page.goto(`${origin}/trainer`); await page.locator('#scene-grid button').last().waitFor(); assert(await page.locator('.forest').isHidden()); assert(await page.locator('#character > span').isVisible()); diff --git a/tests/test_lu_trainer.py b/tests/test_lu_trainer.py index edb7fda..c4259cf 100644 --- a/tests/test_lu_trainer.py +++ b/tests/test_lu_trainer.py @@ -29,7 +29,7 @@ class TrainerRoutesTests(unittest.TestCase): connection.close() def test_page_aliases_return_the_same_trainer(self): - pages = [self.get(path) for path in ['/lu-trainer', '/lu-trainer/', '/lu-trainer.html']] + pages = [self.get(path) for path in ['/trainer', '/trainer/', '/lu-trainer.html']] for status, content_type, content in pages: self.assertEqual(status, 200) self.assertEqual(content_type, 'text/html') diff --git a/web/index.html b/web/index.html index 83d4fbc..14f3832 100644 --- a/web/index.html +++ b/web/index.html @@ -75,7 +75,7 @@