step 8.3: done

This commit is contained in:
bepis
2026-10-21 08:16:07 +11:00
parent b8fef0629b
commit 11f7829946
6 changed files with 472 additions and 19 deletions
+16 -16
View File
@@ -4,8 +4,8 @@
> If this file disagrees with the code, trust the code and fix this file.
## 1. Where we are
- **Last completed step:** 8.2 (Public profile: `GET /api/heroes/:name`) — TICKED in STATUS.md
- **Next step:** 8.3 — UI page for public hero profile.
- **Last completed step:** 8.3 (Public profile UI page) — TICKED in STATUS.md
- **Next step:** Phase 9 — Hardening & Polish (9.1 first)
- **Updated:** 2026-10-21
- **Was the last session cut off mid-task?** No
@@ -14,11 +14,13 @@
|---|---|
| `npm install` | succeeds |
| `npm run migrate` | applies 001–006 / "nothing to do" |
| `npm test` | **167 passing, 0 failing** (85 unit + 72 integration) |
| `npm test` | **172 passing, 0 failing** (85 unit + 87 integration) |
## 3. What exists now (files that matter)
- `src/services/heroProfileService.js` — `getHeroProfile(heroName)`: case-insensitive lookup, returns name/class/level/xp/gold/str/agi/int/vit/kills/deaths/equipment (equipped item names by slot). Uses WeakMap stmt cache.
- `src/routes/heroProfile.js` — `GET /api/heroes/:name` (public, no auth). Returns 404 if hero not found.
- `public/profile.html` — Public hero profile page (reads ?name=, displays stats/equipment).
- `public/js/profile.js` — Fetches GET /api/heroes/:name, renders profile, handles 404.
- `src/services/heroProfileService.js` — `getHeroProfile(heroName)`: case-insensitive lookup, returns name/class/level/xp/gold/str/agi/int/vit/kills/deaths/equipment.
- `src/routes/heroProfile.js` — `GET /api/heroes/:name` (public, no auth).
- `src/services/leaderboardService.js` — `getLeaderboard(type, page, limit)`.
- `src/routes/leaderboard.js` — `GET /api/leaderboard?type=level|gold|kills&page=1`.
- `src/services/expeditionService.js` — start, getActive, claim, listDefinitions.
@@ -36,17 +38,18 @@
- `public/game.html` — dashboard with stats panel, tabbed action panel (Hunt/Inventory/Expedition).
- `public/js/game.js` — hunt UI + inventory UI + expedition UI.
- `public/shop.html` — dedicated shop page.
- `tests/integration/hero-profile.test.js` — 5 integration tests.
- `public/login.html`, `public/register.html`, `public/create-hero.html` — auth & hero creation.
- `tests/integration/profile.test.js` — 5 integration tests.
## 4. Half-finished / fragile things
- No leaderboard UI yet (Phase 8).
- No public profile UI page (step 8.3 next).
- No leaderboard UI yet (Phase 8, but 8.1/8.2 API done — could add UI if desired).
- HP never regenerates naturally; only level-up restores it.
- No restart-persistence test for sessions.
- `npm run seed` script in package.json points to nonexistent `scripts/seed.js`.
- Equipment bonuses not yet passed into combat (Issue #5 in STATUS.md).
- Starter gear (GAME_DESIGN.md §Items) documented but not auto-created on character creation.
- `GET /api/zones` documented in API.md but not implemented (Issue #2).
- Phase 9 (hardening) not started.
## 5. Decisions & deviations from the docs
- D-004..D-007 in `docs/DECISIONS.md` (combat rounds, equipment counted once, session store, clock).
@@ -73,12 +76,9 @@
- Shop stock items have flat fields (`itemId`, `buyPrice`), not nested (`item.id`).
- New characters have NO inventory items (starter gear not auto-created yet).
- Hero profile endpoint is PUBLIC — no `requireAuth` middleware.
- Profile page is public: no auth.js guard needed; uses ?name= query param for lookup.
## 7. Next-step briefing (8.3)
- **Goal:** Public profile UI page — a standalone HTML page showing the hero profile returned by `GET /api/heroes/:name`.
- **Docs:** GAME_DESIGN.md §Leaderboards, UI_GUIDE.
- **Files to create:** `public/profile.html`, `public/js/profile.js`.
- **No new backend needed** — the API endpoint already exists.
## 8. Open Known Issues
STATUS.md issues 1–6 (balance, dangling `seed` script, restart test, equipment-in-combat, HP regen, zone min_level balance).
## 7. Next-step briefing (9.1)
- **Goal:** Walk the SECURITY.md checklist; fix gaps.
- **Docs:** SECURITY.md, CODING_STANDARDS.
- Phase 9 is hardening & polish — review security, add error pages, loading states, mobile responsive pass, final playable run.