Commit Graph
154 Commits
Author SHA1 Message Date
DorianandClaude Opus 4.6 86bf534f50 fix: type safeColor return in ChoreoContext using Kaplay Color type
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 06:19:55 +00:00
DorianandClaude Opus 4.6 945a776a5a refactor: extract shared FightData interface to fight/types.ts
Move FightData, FightRound, FightBot, FightArenaInfo types from local
definitions in FightViewer.vue to shared fight/types.ts. Replace `any`
typing in HumanFightPage, FightPage, useFightPolling, and useFightCache
with proper typed interfaces. Fix null-safety guards exposed by typing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 06:19:26 +00:00
DorianandClaude Opus 4.6 2f7c10e4b8 fix: defer analytics prepared statements to avoid crash before migrations
The sqlite.prepare() calls ran at module import time, before
runMigrations() created the analytics table, causing a crash loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 01:05:47 +00:00
DorianandClaude Opus 4.6 bd44d5562f chore: final smoke test passed — ready for launch
All end-to-end flows verified: registration, fight queue, SSE
spectating, leaderboard, bot profiles, wallet connect (NWC/LN/Cashu),
admin dashboard, background fight loop, seed/migrations, tournaments.
10 API routers mounted, all endpoints wired and typechecked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:47:11 +00:00
DorianandClaude Opus 4.6 f759bb2161 test: infrastructure launch checklist passed
Verified: SQLite WAL mode, rate limiting (60/min/IP), SSRF blocking
(private IPs, localhost, reserved TLDs), 256KB body limit, security
headers (CSP, X-Frame-Options, HSTS), graceful shutdown (10s drain),
daily backups (7 rotation), monitoring alerts (200/300MB thresholds)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:45:55 +00:00
DorianandClaude Opus 4.6 fae41e72ea test: frontend launch checklist passed
Verified: 18 pages load, mobile responsive (44px touch targets,
bottom nav), initial bundle ~150KB gzip, Kokoro TTS lazy-loaded
in Worker, SSE reconnects with exponential backoff, perf mode
auto-detects + persists, reduced motion respected

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:44:52 +00:00
DorianandClaude Opus 4.6 f964274c02 test: payments launch checklist passed
- Added 'consumed' to payment status enum (was missing from schema)
- Fixed orphan recovery to also find 'consumed' payments on restart
- Verified: NWC + Lightning Address wallet connect, invoice creation,
  21-sat entry fee, 42-sat winner payout, Cashu tokens, bet settlement,
  refund on cancelled/timeout, stuck payment recovery

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:43:16 +00:00
DorianandClaude Opus 4.6 50b85f5171 test: fight engine launch checklist passed
Verified: 17 challenge types with complete scoring, Elo (K=32/12),
7 tiers with dual thresholds, mock bot fights, background loop,
THE CREATOR features (entrance, omni-morph, cameo, 13+4 moves)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:40:17 +00:00
DorianandClaude Opus 4.6 4260dfddfd test: Docker build and PWA installation verified
- Verified multi-stage Dockerfile builds successfully (pnpm build passes)
- Improved .dockerignore for smaller build context
- Graceful shutdown wired: SIGTERM/SIGINT drain active fights (10s timeout)
- Migrations + mock bot seeding run on startup automatically
- PWA: manifest, service worker, icons, offline caching all configured
- Workbox caches app shell + fonts + TTS model, excludes API routes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:38:31 +00:00
DorianandClaude Opus 4.6 69601cce3a feat: automated backup and production monitoring
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:33:35 +00:00
DorianandClaude Opus 4.6 d7d04eb2d7 test: load testing script
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:30:43 +00:00
DorianandClaude Opus 4.6 6e092ee7be feat: offline resilience and connection status
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:27:05 +00:00
DorianandClaude Opus 4.6 627a1a0d9e perf: CDN-ready caching headers and compression
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:24:48 +00:00
DorianandClaude Opus 4.6 aca025a360 feat: mobile UX polish with haptics and reduced motion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:23:39 +00:00
DorianandClaude Opus 4.6 8be71e9929 fix: admin and docs bugs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:20:00 +00:00
DorianandClaude Opus 4.6 c654ff9f73 feat: interactive bot developer documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:18:06 +00:00
DorianandClaude Opus 4.6 e10c1dc8aa feat: privacy-respecting analytics
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:15:20 +00:00
DorianandClaude Opus 4.6 2170e9275c feat: admin dashboard for THE CREATOR
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:12:36 +00:00
DorianandClaude Opus 4.6 e3a4299dae perf: server memory leak audit
Add periodic cleanup of fightReactions Map (clears when >100 entries).
Add RSS/heap logging every 10 fights in fight-loop for memory monitoring.
Set --max-old-space-size=256 in Docker CMD as safety net.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:05:03 +00:00
DorianandClaude Opus 4.6 c8e4fa7a95 perf: SQLite WAL mode and indexes
Add PRAGMA synchronous=NORMAL, temp_store=MEMORY, mmap_size=256MB for
better write throughput and query performance. Create 11 indexes on
commonly queried columns (fights.status, fights.created_at, bots.elo,
rounds.fight_id, payments, tournament_matches). Run PRAGMA optimize
on startup for query planner statistics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:02:47 +00:00
DorianandClaude Opus 4.6 5af5ee1cba perf: adaptive performance mode for mobile
Auto-detect low-end devices (< 4 cores or touch) and reduce visual
complexity: 60% fewer particles, 6 vs 16 speed lines, 15 vs 40 stars,
halved datacenter buildings/racks, skip LED blinking animations,
fewer GPU graveyard chips, reduced afterimages and exhaust particles.

Toggle in fight viewer (LO/HI button), persisted in localStorage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:00:48 +00:00
DorianandClaude Opus 4.6 78f83a7520 perf: fight replay memory leak fixes
Replace 32 bare setTimeout calls with tracked timeouts across all fight
modules (effects, entrances, finishers, choreographies). All timers are
now registered in cleanupTimers Set and cleared on scene destroy.

Enhanced destroy() to also clean up active speech bubbles and explicitly
destroy all remaining game objects before k.quit().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:55:58 +00:00
DorianandClaude Opus 4.6 57703a28ad refactor: remove dead code
Remove 38 unused audio/announce imports from FightScene.ts left over
from the module extraction. All functions are still used by the
extracted modules which import them directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:46:30 +00:00
DorianandClaude Opus 4.6 d8e43d6843 fix: enforce webhook response size limits via named constants
readLimitedBody already enforces 10KB body limit. Answer truncation
(2000 chars) and trash_talk truncation (200 chars) now reference
named constants from lib/constants.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:40:17 +00:00
DorianandClaude Opus 4.6 eb4d52438d refactor: extract FightPage polling and challenge composables
Split FightPage.vue into useFightPolling (SSE, polling, reconnect)
and useHumanChallenge (timer, submission, cooldown) composables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:39:20 +00:00
DorianandClaude Opus 4.6 7c8e404cf1 refactor: extract magic numbers to named constants
Frontend: choreography selection ratios, morph trigger chances,
creator cameo/ultimate chances, dodge/counter probabilities.
Server: HP, K-factors, Elo divisor, tier thresholds, fight loop interval.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:34:05 +00:00
DorianandClaude Opus 4.6 1731a64ae8 refactor: extract morph, entrance, round, and finisher systems from FightScene
Split FightScene.ts from 6514 to 3468 lines by extracting four major
subsystems into dedicated modules with factory functions and ChoreoContext.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:24:20 +00:00
DorianandClaude Opus 4.6 cabe0adb31 refactor: split choreographies into category modules
Extract 457 choreography functions from FightScene.ts into 11 modular files
under fight/choreography/. ChoreoContext interface bundles all closure deps
(k, effects, SFX) so function bodies remain unchanged. Factory pattern
(createFactories) shares prop system and make* helpers across categories.

Categories: basic (72), ranged (94), silly (80), food (45), weapons (45),
ultimates (41), bitcoin (34), heavy (30), creator (16), plus factories
and index. FightScene.ts reduced from 11,917 to 6,515 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 23:00:57 +00:00
DorianandClaude Opus 4.6 08786a9b06 refactor: extract particles, effects, projectiles from FightScene
Move spawnSparks, spawnBulletHoles, spawnExhaust to fight/particles.ts,
glitchRGB, scanlineGlitch, vhsTracking, dimensionalShift to fight/effects.ts,
and spawnProjectile to fight/projectiles.ts. All accept FightContext as first
param. FightScene.ts reduced by ~180 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:23:50 +00:00
DorianandClaude Opus 4.6 020ab3f1f8 refactor: extract fight types and constants
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:16:50 +00:00
DorianandClaude Opus 4.6 954b64ebe9 refactor: remove old sounds.ts (replaced by audio/ modules)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:12:22 +00:00
DorianandClaude Opus 4.6 d998cb3ad0 refactor: split sounds.ts into audio/ modules
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 22:11:58 +00:00
DorianandClaude Opus 4.6 94910820f8 fix: validate SSE event data before parsing
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:49:30 +00:00
DorianandClaude Opus 4.6 7de503a487 refactor: explicit return types on all public functions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:48:22 +00:00
DorianandClaude Opus 4.6 8d93abf36d refactor: separate challenge data from challenge logic
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:45:20 +00:00
DorianandClaude Opus 4.6 4d1e592365 refactor: standardize error handling with toError() helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:44:17 +00:00
DorianandClaude Opus 4.6 ea716c1f0e refactor: extract pick() helper, deduplicate random selection
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:42:11 +00:00
DorianandClaude Opus 4.6 88ceba43b0 feat: victory celebration animations
Normal wins: winner flex pose with camera flash bursts + confetti rain.
Upset wins (100+ Elo underdog): dramatic zoom on winner with golden
flash. Upset tag shown on win overlay. Wired into FightViewer after
KO/Perfect sequence.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:35:04 +00:00
DorianandClaude Opus 4.6 cc0fb4553a feat: tier-gated entrance animations
Tier 0-1: simple entrances (skateboard, backflip, ice slide, moonwalk).
Tier 2: + vehicles (car, shopping cart, girlfriend, bouncer).
Tier 3: + dramatic drops (space fall, helicopter, underground, parachute).
Tier 4: + teleport/effects (portal, lightning, jetpack, crowd surf).
Tier 5+: all entrances including spotlight, robe, cannon.
THE CREATOR golden portal entrance unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:33:41 +00:00
DorianandClaude Opus 4.6 c876998601 feat: 50 new choreographies (430+ total)
15 food (sushiRoll, tacoSlam, iceCreamFreeze, wokToss, cakeSmash, etc.),
15 energy/beam (novaBlast, plasmaWhip, sonicBoom, gravityCrush, etc.),
10 silly (plushiePummel, selfieStun, vibeCheck, touchGrassSmack, etc.),
10 weapon (nunchakuSpin, tridentThrust, boomerangToss, scytheSlash, etc.).
Added to food_fight, magic_duel, space_war, meme_war, medieval_combat pools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:32:23 +00:00
DorianandClaude Opus 4.6 561343164f feat: 30 Bitcoin-themed choreographies
lightningBolt, hashSmash, blockDrop, mempoolFlood, difficultyBomb,
feeSpike, utxoScatter, nodeSync, relayBounce, channelForceClose,
halvingStrike, coldStorage, paperWalletSlash, hardFork, doubleSpend,
proofOfWork, merkleRoot, blockReward, difficultyRetarget, taprootStrike,
segwitSlash, timestampAttack, dustAttack, opReturnBeam, orphanBlock,
miningRig, satPerByte, fullNodeGuard, multisigStrike, nonceGrind,
whitePaperRoll, asicHammer, rugPullYank, stackSatsBlast. Added to
token_economy, hack_battle, math_blitz, speed_blitz themed pools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:29:02 +00:00
DorianandClaude Opus 4.6 9de36a9349 feat: 15 Bitcoin-themed arenas (40 total)
bitcoin_mine, lightning_node, satoshis_garage, mempool, silk_road_ruins,
block_height_tower, hodl_cave, whale_pool, node_farm, genesis_block,
pizza_day_parlor, difficulty_adjustment, fifty_one_percent,
timechain_temple, nostr_relay_room. Each with unique theme colors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:22:37 +00:00
DorianandClaude Opus 4.6 48cf19b438 feat: 10 new music tracks (20 total)
2x Drum & Bass (Jungle Protocol 174bpm, Liquid Lightning 172bpm),
2x Lo-fi (Midnight Stack 92bpm, Satoshi's Lullaby 88bpm),
2x Ska Punk (Skanking Satoshi 210bpm, Rudeboy Relay 205bpm),
2x Boss Fight (Final Hashrate 145bpm, Whale Alert 155bpm),
2x Chiptune (8-Bit Blockwar 190bpm, Pixel Proof 185bpm).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:21:26 +00:00
DorianandClaude Opus 4.6 fbaeeb5f93 feat: scale to 1,330 challenge prompts
Add 526 new prompts across all 16 challenge types with heavy
Bitcoin/cypherpunk themes. Factual types include multiple-choice
options. Separate file for maintainability, merged at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:14:26 +00:00
DorianandClaude Opus 4.6 cb31fdbbae feat: practice mode against mock bots
Tier-selectable practice page at /practice. Fights against classic
bots with dampened Elo. Routes to human fight page or arena based
on bot type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:07:09 +00:00
DorianandClaude Opus 4.6 acbf863e4d feat: mobile-optimized human fight input
Large tap-target multiple-choice buttons (min 48px), full-width text
area for creative responses, countdown timer with color shift
(green/yellow/red) and shake animation at <3s, timer progress bar,
correct/wrong feedback flash overlay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:05:36 +00:00
DorianandClaude Opus 4.6 d0f3780518 feat: scheduled daily and weekly tournaments
Lightning Round (daily 8-bot at noon UTC) and The Halvening
(weekly 32-bot Saturday 20:00 UTC). Auto-fills with mock bots,
runs matches via background loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:02:42 +00:00
DorianandClaude Opus 4.6 b0926db9ed feat: tournament bracket UI
TournamentListPage with status filters, TournamentPage with CSS grid
bracket display, lobby view for open tournaments, champion banner,
live polling for active tournaments. Routes at /tournaments and
/tournament/:id. NavBar link added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:00:48 +00:00
DorianandClaude Opus 4.6 b70c49075e feat: tournament API routes
POST /api/tournaments (create, admin-only),
POST /api/tournaments/:id/join, POST /api/tournaments/:id/start,
GET /api/tournaments (list), GET /api/tournaments/:id (bracket).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:58:23 +00:00
DorianandClaude Opus 4.6 c0978ba4c8 feat: tournament engine with single-elimination brackets
Create, join, seed by Elo, generate bracket matches with byes,
advance rounds on fight completion, finish tournament on champion.
Wire into orchestrator fight finalization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:57:23 +00:00