1
0
Fork 0
Commit graph

1154 commits

Author SHA1 Message Date
a1a2dbdcac feat(minigames): highlight the selected emplacement and add rotation controls
Ring the selected emplacement's grid cells and document the controls in
the editor help text. Rotate a placed emplacement in place by
double-clicking it or by pressing the Horizontal/Vertical toggle (the
toggle also sets the orientation for a new placement, and is disabled for
the fixed 2x2 Command Post).

Fix: moving an emplacement after rotating it kept the default orientation
instead of the rotated one, so the rotation was lost on the next click.
placeAt now preserves the emplacement's stored orientation when moving it.
2026-10-11 22:18:20 -04:00
d4bf0e9742 fix(minigames): pick up placed emplacements on click instead of overwriting
Clicking a grid cell always placed the currently selected emplacement
there and silently deleted whatever it overlapped, so clicking an
earlier emplacement (after selection auto-advanced) clobbered it. Now
clicking a placed emplacement selects it so it can be moved, and placing
onto an occupied cell is refused with a message instead of deleting the
other emplacement. Adds the pick-up hint to the editor copy.
2026-10-11 22:12:04 -04:00
3ce9677fd0 fix(minigames): square versus grid cells and make the Command Post a 2x2 block
The placement and battle grids inherited a 32px line-height, so any cell
holding the emplacement glyph grew taller than its square width (29x34),
making the row gaps look inconsistent once emplacements were placed. Set
leading-none on the grids so cells stay square.

Add a shape to emplacements ("line" | "square") and lay out the Command
Post as a 2x2 block (size 4) instead of a 3-cell line. cellsForFob resolves
cells per definition; the placement editor, preview, and tests use it.
2026-10-11 22:09:09 -04:00
065018cf3c feat(minigames): color-code versus emplacements and shrink the duel board
Give each emplacement type its own color (Command Post amber, Ammo Depot
rose, Radar Site sky, FOB violet) so it is obvious what is placed where:
the picker chips carry a matching swatch, placement cells and the
in-battle "your fire bases" board use the type color, and struck enemy
cells use the struck type's color. The shot view now carries the struck
assetId so the enemy sector can be colored too.

Cap the board at a compact width (max-w-sm) instead of stretching to fill
the panel, so the 10x10 grid no longer dominates the screen.
2026-10-11 22:01:15 -04:00
005ff0e5df feat(minigames): add Call for Fire: Versus multiplayer artillery duel
Head-to-head artillery duel in a new "multiplayer" registry category
(out of periods). Each operator hides a fire-base fleet on a 10x10 grid,
then takes turns calling fire: the first mission is a grid designation,
every later shot adjusts from that operator's last impact using the
single-player range/deflection controls. First to reduce every enemy
emplacement wins; a cap decides on emplacements then cells.

Pure engine in src/lib/minigames/call-for-fire-versus (engine, views,
types, constants) is client-safe and unit-tested. The server-only
registry mirrors the blackjack table pattern (globalThis-anchored Map,
lobby, per-turn timeout, expiry sweep, single-instance only); its views
are built per viewer so the opponent's fleet layout never leaves the
server. The client polls the match snapshot (the in-memory SSE bus is
unreliable across dev module copies). Rewards on completion update the
callForFireVersus profile group, pay XP and chips, and emit
minigame:call-for-fire-versus.

Wires the game into the registry (new multiplayer category + enum
migration), the sidebar grouping, the command palette, and the profile
XP aggregation. The registry row seed is split into its own migration
because Postgres forbids using a freshly added enum value in the same
transaction.

Verified: 21 new tests (engine + registry) plus the wider minigame suite
pass; tsc clean; a live two-player award run confirmed XP, chips, and
the event.
2026-10-11 21:55:39 -04:00
3e9449971f v0.8.12 - show upcoming minigames with a release countdown 2026-10-11 18:47:57 -04:00
011e846f6e docs: add v0.8.12 changelog entry 2026-10-11 18:47:57 -04:00
0bb9719139 feat(minigames): show upcoming games as disabled with a release countdown
- Optional `estimatedReleaseDate` (date and time) on the minigames registry,
  with a named migration and regenerated types.
- Sidebar: an `upcoming` game renders greyed out and non-interactive, with a
  tooltip carrying the estimate and a live countdown. It is a hoverable row
  rather than a disabled menu item, because a disabled Radix item sets
  `pointer-events: none` and would swallow the tooltip.
- Page gate: each minigame page checks its registry status and renders
  `MinigameComingSoon` instead of the arena while the game is upcoming, so a
  typed URL cannot reach unfinished gameplay. The date is display only: the
  game goes live when an admin flips `status` to active.
- Leaderboards exclude upcoming games, so they get neither a tab nor a board.
- Pure `countdown.ts` formatter plus a client ticker that computes the
  remaining time only after mount, avoiding an SSR hydration mismatch.

Note: `registry.ts`, `payload-types.ts` and `migrations/index.ts` also carry
the Call for Fire registry row and its generated types. That feature was
committed as 6d6a5fb and announced a separate commit for those files; they are
included here because they are entangled with these edits in the same files.

Tests: pure countdown unit tests, registry/gate/leaderboard integration tests,
and an e2e that seeds an upcoming row, hovers the disabled sidebar entry to
assert the tooltip, and checks the coming-soon gate.
2026-10-11 18:47:43 -04:00
6070cb670e v0.8.11 - add Call for Fire artillery observer game 2026-10-11 18:44:54 -04:00
b17bcab786 docs: add v0.8.11 changelog entry 2026-10-11 18:44:49 -04:00
8c428f95f4 test(minigames): derive period board count from CORE_MINIGAME_KEYS 2026-10-11 18:36:34 -04:00
ce7fb97e0e feat(minigames): register Call for Fire in the minigame registry
Adds the callForFire row to BUILTIN_MINIGAMES (core, period-scored,
order 6; poker/blackjack shift to 7/8), adds it to CORE_MINIGAME_KEYS
period-scoring fallback, and maps the key to the callForFire profile
group. Regenerates payload-types and the generated db schema, and
registers the add_call_for_fire_minigame migration.
2026-10-11 18:34:31 -04:00
6d6a5fb0ce feat(minigames): add Call for Fire artillery observer game
Bracket hidden artillery targets across patrol/checkpoint/compound
difficulties. Pure rules in src/lib/minigames/call-for-fire.ts (compass
bearing observer reports, ADD/DROP + RIGHT/LEFT corrections, scoring,
distance-to-target accuracy, injected rng) with a 23-case spec.

Wires the game into the minigame ecosystem: submit action validates the
run, updates the profile callForFire group, pays out XP and chips, emits
minigame:call-for-fire, and records the period ledger entry (accuracy is
distance-to-target on a win, null on a loss). Adds the game page with
period standings and an all-time board, a command palette entry, the
Target icon, and the profiles XP aggregation.

The registry row and regenerated payload types land with the minigame
registry changes in a separate commit.
2026-10-11 18:18:02 -04:00
ee7fc0b5e6 v0.8.10 - tidy past release notes 2026-10-11 17:39:11 -04:00
823ce6c9c7 docs: add v0.8.10 changelog entry 2026-10-11 17:39:11 -04:00
9ebc0c61a6 docs: drop staff-only items from the v0.8.8 changelog entry 2026-10-11 17:38:49 -04:00
63e601992b v0.8.9 - clearer release-note headings 2026-10-11 17:27:57 -04:00
ec2199f97c docs: add v0.8.9 changelog entry 2026-10-11 17:27:57 -04:00
6df285e2e8 feat(changelog): render section headers as Discord markdown headings 2026-10-11 17:27:51 -04:00
bf50dd99a9 v0.8.8 - add minigame periods, achievements, registry and leaderboards hub 2026-10-11 17:08:04 -04:00
3163e9904f docs: add v0.8.8 changelog entry 2026-10-11 17:07:22 -04:00
e59e16344e test(minigames): e2e smoke for the leaderboards page and document periods
Phase 8 of the minigame periods feature:

- e2e smoke: the unified leaderboards page shows the period boards, the Core
  game tabs and the achievements section; switching to All-Time reveals the
  cardtable games; a game page shows its anchored period standings card.
  (Passes with the bundled Chromium via E2E_BROWSER_PATH; Vivaldi crashes under
  automation, as the root guide warns.)
- Integration coverage already added alongside each phase: entry recording,
  the close pipeline and awards, month/year windows, the registry, the read
  model and the in-app notifications, plus a pure bot renderer test.
- Document the periods, achievements and registry invariants in the minigames
  AGENTS guide.
2026-10-11 17:06:52 -04:00
08f2630442 feat(minigames): add an admin close/reopen control for periods
Phase 7 of the minigame periods feature:

- New admin component `PeriodCloseControl` renders above the minigame-periods
  list: it shows the recent periods with their status and a Close now / Reopen
  button that drives POST /api/minigame-periods/close (gated on
  minigame-periods:close; a 403 is shown inline rather than swallowed).
- Registered via `admin.components.beforeListTable` and the import map
  regenerated.

Registry CRUD and the period/entry/achievement review lists already exist as
permission-gated admin collection views, so this was the only missing surface.
Verified end to end in the running admin panel: an open period closed, its
status flipped and closedAt stamped, then reopened.
2026-10-11 17:06:52 -04:00
a1ab247b7b feat(minigames): notify winners and announce achievements on Discord
Phase 6 of the minigame periods feature:

- Muteable `minigame:achievement` notification type; the close pipeline now
  notifies each winner in-app, but only when the achievement row is newly
  written, so a re-run or a concurrent closer never double-sends.
- New bot service `achievementAnnouncements` polls achievements with no
  announcedAt, groups them by window, posts ONE embed per window to
  DISCORD_ANNOUNCE_CHANNEL_ID, then stamps announcedAt + discordMessageId.
  A failed post leaves the rows unannounced so the next tick retries them.
- Pure, testable renderer (bot/lib/achievementRender.ts) for grouping and the
  embed shape; window labels reuse the period/calendar helpers.
- Register the service in the bot registry and add
  DISCORD_ACHIEVEMENT_POLL_MS (default 60s).
- Tests: renderer grouping/ordering/fallbacks and the in-app notification
  path (including idempotency).
2026-10-11 17:06:52 -04:00
316797d27d feat(minigames): add period leaderboards, all-time view and achievements
Phase 5 of the minigame periods feature:

- Read model (lib/minigames/periods/standings.ts) that shapes period boards
  from the ledger (rank, placement points, names) and All-Time boards from the
  untouched profile aggregates into one row type.
- GET /api/minigames/leaderboards: ?period=current|<id>|all-time, returning
  the period, the period list, the boards and the achievements honor roll.
- New /minigames/leaderboards page: period selector (current, every past
  period, All-Time), per-game tabs, and the achievements honor roll. Core-only
  in period mode; every registered game in All-Time.
- Shared client pieces: useLeaderboards hook, StandingsTable,
  PeriodStandingsCard (period by default, All-Time toggle) and
  AchievementsHonorRoll.
- Each Core game page gains an "Anchored period standings" card so the period
  board is visible on the game itself; its existing all-time board and
  mode/difficulty selectors are untouched, and it links to the full page.
  (Plan said replace the inline board; keeping it preserves the per-mode
  selectors, so the period board is added instead. Easy to swap if you prefer.)
- Ledger fetch helper extracted to lib/minigames/periods/ledger.ts.
- Integration test for the period boards, the All-Time path and the honor roll.
2026-10-11 17:06:52 -04:00
deb88ded56 feat(minigames): drive the nav and period scoring from the registry
Phase 4 of the minigame periods feature:

- Server registry loader (lib/minigames/loadRegistry.ts) reads the
  minigames collection and falls back to the built-in seven when it is empty
  or unreadable, so the nav and boards never render blank.
- The sidebar minigames dropdown now renders from the registry (Core and
  Cardtable groups, retired games hidden, registry order), with lucide icons
  resolved from the icon-name string through a client icon map and a
  safe fallback.
- Period scoring is registry-driven: the close pipeline uses core games with
  countsForPeriods instead of a hardcoded list. A retired game simply stops
  accruing entries and drops out of the next period while its history stays.
- Integration tests for the fallback, ordering, retirement filtering and the
  non-scoring-game exclusion; the older minigame specs now wipe the registry
  too so files stay order-independent.
2026-10-11 17:06:52 -04:00
5cf245b855 feat(minigames): crown player of the month and year
Phase 3 of the minigame periods feature:

- Record each ledger row's own instant (`occurredAt`, server clock at
  submit) so calendar windows score runs that actually happened in them.
  Backfilled from createdAt for existing rows.
- Pure UTC calendar windows (lib/minigames/periods/calendar.ts): completed
  month and year windows, with the first window of each kind partial because
  it begins at the anchor, and nothing crowned until the window has ended.
- Close pipeline extended: after the period sweep it crowns Player of the
  Month and Player of the Year for every completed window, scored with the
  same placement ladder as the period champion. Idempotent like the period
  close (achievement unique key plus an existence check).
- period-tick logs the crowned windows; integration tests cover window
  enumeration, both crowns and idempotency.
2026-10-11 17:06:52 -04:00
ccdeebbd35 feat(minigames): close anchored periods and grant period awards
Phase 2 of the minigame periods feature:

- Pure board + award math (lib/minigames/periods/boards.ts): best-performer
  boards from the ledger, a fixed top-N placement ladder summed across the
  five Core boards, and the five period awards (Period Champion, Diligence,
  Dedication, Precision, Most Improved) with the locked tie-break (raw
  period score, then earliest submission).
- Close pipeline (lib/minigames/periods/lifecycle.ts): computes boards for a
  period, writes its achievement rows, and marks it closed. Idempotent: the
  status is re-checked before committing and the achievements unique key
  makes a duplicate close insert nothing, so the tick and the admin override
  cannot double-grant.
- Shared rules resolver (lib/minigames/periods/rules.ts), now used by both
  the entry recorder and the close pipeline.
- New period-tick bin (registered in payload.config.ts) closes every due
  period and materializes the current one, mirroring the mission tick.
- Admin close/reopen route (POST /api/minigame-periods/close), gated on the
  minigame-periods:close permission. Reopen removes the period's awards so a
  future close can re-grant them.
- Integration tests for the pure math and the full close/reopen cycle, plus a
  clean-slate guard so the two minigame specs stay order-independent.
2026-10-11 17:06:52 -04:00
997ae39a59 feat(minigames): record completed runs in the period ledger
Phase 1 of the minigame periods feature:

- Shared server-side recorder (lib/minigames/periods/record.ts) writes one
  minigame-entries row per completed scored run, lazily creating the
  anchored period it belongs to (unique startDate makes it race-safe).
  Failures are swallowed so a ledger hiccup can never break a submission.
- Pure anchored-period math (lib/minigames/periods/derive.ts).
- Wire the recorder into all five Core submit actions after their profile
  update: flappy (passes > 0), EOD (win), radio (>= 1 correct message),
  aim trainer and OPORD (any completed round).
- Server-validated durations for every game: flappy and radio watch now
  report durationMs (with bounds), aim trainer reports its run duration
  (clamped to the 30s course), EOD derives it from seconds, OPORD from
  timeMs.
- Integration test covering derivation, lazy period creation, pre-anchor
  null period and the never-throw guarantee.
2026-10-11 17:06:52 -04:00
d4d121b5a7 feat(minigames): add period, entry, achievement and registry schema
Phase 0 of the minigame periods feature:

- New collections: minigames (registry), minigame-entries (append-only
  ledger), minigame-periods, achievements; new minigame-rules global
  (anchor, 14-day periods, top-10 ladder, precision minimum).
- Pure registry lib with the seven built-in games, achievement
  type/window enums and rule defaults.
- Permissions: extend the Minigames group with registry/entries/
  periods/achievements CRUD (plus minigame-periods:close) and add a
  Minigame Rules (Global) group; mirror both into ALL_PERMISSION_VALUES.
- Migration add_minigame_periods seeds the seven registry rows and the
  minigame-rules defaults idempotently so production seeds from the
  migration chain; dev seed script mirrors it for local resets.
2026-10-11 17:06:52 -04:00
0c00726759 v0.8.7 - tidier release notes 2026-10-11 16:53:29 -04:00
703ba0f1a2 docs: add v0.8.7 changelog entry 2026-10-11 16:51:27 -04:00
88d1d1f6f1 feat(changelog): fall back to a generic line for empty entries and sections 2026-10-11 16:41:04 -04:00
0ef3da018e v0.8.6 - fix /changelog missing file in prod image 2026-10-11 16:28:35 -04:00
a9949aac38 docs: add v0.8.6 changelog entry 2026-10-11 16:26:41 -04:00
bcbfa09d68 fix(deploy): ship CHANGELOG.md in the runtime image for /changelog 2026-10-11 16:26:00 -04:00
be21ca36c2 v0.8.5 - restore Discord bot command responses 2026-10-11 16:15:48 -04:00
3fb21c777c docs: add v0.8.5 changelog entry 2026-10-11 16:13:30 -04:00
32b63d9061 fix(bot): shorten /changelog option description to unblock bot startup, register /rollcall 2026-10-11 16:12:05 -04:00
2298cff2fa v0.8.4 - add /rollcall force command, fix changelog acks 2026-10-11 15:33:43 -04:00
02188b4d44 docs: add v0.8.4 changelog entry 2026-10-11 15:33:43 -04:00
dda9f08f33 feat(bot): add /rollcall to force-send or refresh a mission roll-call 2026-10-11 15:26:17 -04:00
bf36e1e2be fix(deploy): supervise the Discord bot in the entrypoint
The bot ran as an unsupervised background process, so a crash left the unit
with no bot while the web app stayed healthy (and the failure was invisible).
The entrypoint now runs the bot in a restart loop with capped exponential
backoff (5s .. 60s), logs every exit, and stops the loop cleanly on
SIGTERM/SIGINT. The web server still owns the container lifetime. DEPLOYMENT.md
section 5 updated to match.
2026-10-10 16:07:26 -04:00
6bc7413cd7 fix(bot): acknowledge /changelog immediately and surface post-defer errors
Defer the reply before the permission check (uncached member fetch + DB
lookups) so a slow preamble no longer trips Discord's 3-second window and
shows "The application did not respond". Wrap all post-defer work in one
try/catch that editReplies an error, and make channel resolution catch fetch
errors so an unreachable DISCORD_CHANGELOG_CHANNEL_ID replies clearly instead
of hanging the interaction.

Also export compareVersions and make the shipped-file test assert
newest-first rather than a hardcoded version.
2026-10-10 15:57:51 -04:00
16664b6d4e v0.8.3 - correct release-order instructions 2026-10-10 15:15:07 -04:00
9ed63b1031 docs: add v0.8.3 changelog entry 2026-10-10 15:15:02 -04:00
a0213b3c92 docs: correct release-order instructions (version bump is the deploy tip) 2026-10-10 15:08:33 -04:00
fcd3bfe856 v0.8.2 - schedule new main ops for the coming weekend 2026-10-10 15:04:41 -04:00
3bf87172c7 docs: add v0.8.2 changelog entry 2026-10-10 15:04:41 -04:00
eed33de2e9 fix(missions): default new main ops to the upcoming Saturday
The startDateTime default in the Missions collection and the weekly
generate-mission bin both forced the date at least a week out by adding 7
days to the offset to the next Saturday. Generated midweek that landed on
the Saturday AFTER the coming one (a Tuesday generation went 11 days out
instead of 4), which also pushed the bot's roll-call (posted within 3 days
of start) days into the future and read as a missing roll-call.

Add nextSaturdayStart() to the unit-timezone date helpers: the nearest
upcoming Saturday at 20:00 America/New_York, rolling a week only once
today's 20:00 has passed. Use it for the collection default and the
generator, derive the generator codeName datestamp in unit time, and cover
the boundary cases in tests/int/next-saturday-start.int.spec.ts.
2026-10-10 14:54:06 -04:00