From 4e02caf6f9e3bfb3588ffa2eb2e0263d3db7998d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Feb 2026 16:04:10 +0000 Subject: [PATCH 1/2] refactor: remove deprecated bootstrapDefinitions() function Remove dead code that was marked @deprecated with no callers. The initializeDefinitions() function should be used instead. https://claude.ai/code/session_01XGuZYPx2sC9ZpzhPhrf2yJ --- src/engine/definitions/bootstrap.ts | 31 ----------------------------- src/engine/definitions/index.ts | 7 +++---- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/src/engine/definitions/bootstrap.ts b/src/engine/definitions/bootstrap.ts index 7a21e8af..72063d47 100644 --- a/src/engine/definitions/bootstrap.ts +++ b/src/engine/definitions/bootstrap.ts @@ -51,37 +51,6 @@ export async function waitForDefinitions(): Promise { await DefinitionRegistry.waitForInitialization(); } -// Store the initialization promise so it can be awaited by callers -let initializationPromise: Promise | null = null; - -/** - * @deprecated Use initializeDefinitions() instead. This is kept for backwards compatibility. - * Will internally call initializeDefinitions() to load from JSON. - * - * @returns Promise that resolves when definitions are loaded. - * Callers should await this before accessing definitions. - */ -export function bootstrapDefinitions(): Promise { - if (DefinitionRegistry.isInitialized()) { - return Promise.resolve(); - } - - // Return existing promise if initialization is already in progress - if (initializationPromise) { - return initializationPromise; - } - - debugInitialization.log('[Bootstrap] bootstrapDefinitions() called - starting async JSON load'); - initializationPromise = initializeDefinitions() - .catch((err) => { - console.error('[Bootstrap] Failed to load definitions from JSON:', err); - initializationPromise = null; - throw err; - }); - - return initializationPromise; -} - // ==================== BACKWARDS COMPATIBILITY EXPORTS ==================== // These getters provide backwards-compatible access to definitions. // They pull from the DefinitionRegistry which loads from JSON. diff --git a/src/engine/definitions/index.ts b/src/engine/definitions/index.ts index dc8fef77..8dc6bff5 100644 --- a/src/engine/definitions/index.ts +++ b/src/engine/definitions/index.ts @@ -6,11 +6,11 @@ * * Usage: * - * 1. JSON Loading (recommended for new games): + * 1. Initialize from JSON (call once at app startup): * await initializeDefinitions('/data/game.json'); * - * 2. TypeScript Bootstrapping (backwards compatibility): - * bootstrapDefinitions(); + * 2. Wait if initialization is in progress: + * await waitForDefinitions(); * * 3. Accessing Definitions: * const unit = DefinitionRegistry.getUnit('trooper'); @@ -22,7 +22,6 @@ export { DefinitionRegistry, DefinitionRegistryClass } from './DefinitionRegistr // Bootstrap functions export { - bootstrapDefinitions, initializeDefinitions, definitionsReady, waitForDefinitions, From 3e3c9befa5dd78e4d4b34ac7a53a1fdbf05bd12f Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Feb 2026 16:06:38 +0000 Subject: [PATCH 2/2] refactor: remove unused code from audio config and CSS - Remove COMMAND_AUDIO_CONFIG (only used in tests, not production) - Remove 4 unused CSS variables (void-glow, dominion-glow, etc.) - Remove 7 unused CSS component classes (resource-display, command-card, etc.) - Remove 6 unused animation classes and their keyframes https://claude.ai/code/session_01XGuZYPx2sC9ZpzhPhrf2yJ --- src/app/globals.css | 129 --------------------------------- src/data/audio.config.ts | 7 -- tests/data/audioConfig.test.ts | 11 --- 3 files changed, 147 deletions(-) diff --git a/src/app/globals.css b/src/app/globals.css index 0f2974c9..00d83344 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -3,10 +3,6 @@ @tailwind utilities; :root { - --void-glow: 0 0 20px rgba(132, 61, 255, 0.5); - --dominion-glow: 0 0 20px rgba(74, 144, 217, 0.5); - --synthesis-glow: 0 0 20px rgba(155, 89, 182, 0.5); - --swarm-glow: 0 0 20px rgba(139, 69, 19, 0.5); } * { @@ -74,17 +70,6 @@ main { active:scale-[0.98]; } - .resource-display { - @apply flex items-center gap-2 px-3 py-1.5 bg-black/50 border border-void-700/50 rounded-md; - } - - .control-group-indicator { - @apply w-7 h-7 flex items-center justify-center - bg-gradient-to-b from-void-800 to-void-900 - border border-void-600/50 rounded - text-xs font-mono text-void-200 shadow-inner; - } - /* Minimap with modern border treatment */ .minimap-container { @apply relative w-48 h-48 bg-black/90 rounded-lg overflow-hidden @@ -96,38 +81,6 @@ main { shadow-[0_0_8px_rgba(59,130,246,0.3)]; } - .unit-health-bar { - @apply absolute -top-2 left-1/2 -translate-x-1/2 w-10 h-1.5 - bg-black/80 rounded-full overflow-hidden border border-black/50; - } - - .unit-health-fill { - @apply h-full bg-gradient-to-r from-green-600 to-green-400 transition-all duration-200; - } - - /* Command card with improved grid styling */ - .command-card { - @apply grid grid-cols-4 gap-1.5 p-3 - bg-black/70 border border-void-700 rounded-lg backdrop-blur-sm; - } - - .command-button { - @apply w-12 h-12 relative - bg-gradient-to-b from-void-800 to-void-900 - hover:from-void-700 hover:to-void-800 - border border-void-600/50 rounded-md - flex flex-col items-center justify-center gap-0.5 - transition-all duration-150 - hover:border-blue-500/50 hover:shadow-[0_0_8px_rgba(59,130,246,0.2)] - active:scale-95; - } - - .command-button-disabled { - @apply opacity-40 cursor-not-allowed - hover:from-void-800 hover:to-void-900 - hover:border-void-600/50 hover:shadow-none; - } - /* Tooltip styling */ .tooltip { @apply absolute z-50 px-3 py-2 text-sm @@ -138,26 +91,6 @@ main { } /* Animations */ -@keyframes pulse-glow { - 0%, 100% { - box-shadow: 0 0 10px rgba(132, 61, 255, 0.3); - } - 50% { - box-shadow: 0 0 20px rgba(132, 61, 255, 0.6); - } -} - -@keyframes selection-pulse { - 0%, 100% { - transform: scale(1); - opacity: 1; - } - 50% { - transform: scale(1.1); - opacity: 0.7; - } -} - @keyframes shimmer { 0% { background-position: 200% 0; @@ -178,44 +111,6 @@ main { } } -@keyframes float { - 0%, 100% { - transform: translateY(0px); - } - 50% { - transform: translateY(-10px); - } -} - -@keyframes glow-pulse { - 0%, 100% { - filter: drop-shadow(0 0 10px rgba(132, 61, 255, 0.3)); - } - 50% { - filter: drop-shadow(0 0 25px rgba(132, 61, 255, 0.6)); - } -} - -@keyframes fade-in-up { - from { - opacity: 0; - transform: translateY(20px); - } - to { - opacity: 1; - transform: translateY(0); - } -} - -@keyframes rotate-slow { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - @keyframes scanline { 0% { top: -5%; @@ -233,14 +128,6 @@ main { } } -.animate-pulse-glow { - animation: pulse-glow 2s ease-in-out infinite; -} - -.animate-selection { - animation: selection-pulse 1s ease-in-out infinite; -} - .animate-shimmer { animation: shimmer 8s linear infinite; } @@ -249,22 +136,6 @@ main { animation: pulse-slow 4s ease-in-out infinite; } -.animate-float { - animation: float 3s ease-in-out infinite; -} - -.animate-glow-pulse { - animation: glow-pulse 2s ease-in-out infinite; -} - -.animate-fade-in-up { - animation: fade-in-up 0.6s ease-out forwards; -} - -.animate-rotate-slow { - animation: rotate-slow 20s linear infinite; -} - /* Prevent text selection during gameplay */ .game-container { user-select: none; diff --git a/src/data/audio.config.ts b/src/data/audio.config.ts index f3ba5abf..91a8d2cd 100644 --- a/src/data/audio.config.ts +++ b/src/data/audio.config.ts @@ -64,10 +64,3 @@ export const VOICE_COOLDOWN_CONFIG = { attack: VOICE_COOLDOWN_ATTACK, ready: VOICE_COOLDOWN_READY, } as const; - -/** - * All command audio parameters grouped together. - */ -export const COMMAND_AUDIO_CONFIG = { - debounceWindow: COMMAND_DEBOUNCE_WINDOW, -} as const; diff --git a/tests/data/audioConfig.test.ts b/tests/data/audioConfig.test.ts index d3097643..10bd9f05 100644 --- a/tests/data/audioConfig.test.ts +++ b/tests/data/audioConfig.test.ts @@ -6,7 +6,6 @@ import { VOICE_COOLDOWN_READY, COMMAND_DEBOUNCE_WINDOW, VOICE_COOLDOWN_CONFIG, - COMMAND_AUDIO_CONFIG, } from '@/data/audio.config'; describe('Audio Configuration', () => { @@ -84,16 +83,6 @@ describe('Audio Configuration', () => { }); }); - describe('COMMAND_AUDIO_CONFIG', () => { - it('contains debounce window', () => { - expect(COMMAND_AUDIO_CONFIG).toHaveProperty('debounceWindow', COMMAND_DEBOUNCE_WINDOW); - }); - - it('value matches individual constant', () => { - expect(COMMAND_AUDIO_CONFIG.debounceWindow).toBe(COMMAND_DEBOUNCE_WINDOW); - }); - }); - describe('RTS-style rate limiting', () => { it('selection cooldown prevents spam', () => { // 2 seconds is reasonable for selection spam prevention