Files
Mana-Loop/docs/phase1-audit-report.md
T

6.0 KiB

Phase 1 Audit Report - Mana-Loop Game

Overview

Audit completed on: 2024-04-24 Scope: /home/user/repos/Mana-Loop/src/ directory Initial build status: Passing (Next.js 16.2.4 build succeeds)


1. Files Over 300 Lines (Splitting Candidates)

File Path Line Count Purpose Split Candidate
src/lib/game/store.ts 2464 Monolithic legacy game store YES (HIGH PRIORITY)
src/lib/game/skill-evolution.ts 2312 All skill talent trees YES (HIGH PRIORITY)
src/lib/game/constants.ts 1436 Mixed game constants YES (HIGH PRIORITY)
src/lib/game/data/enchantment-effects.ts 846 Enchantment effect definitions YES (MEDIUM PRIORITY)
src/components/game/tabs/CraftingTab.tsx 965 Crafting UI (4 stages) YES (MEDIUM PRIORITY)
src/components/game/tabs/DebugTab.tsx 700 Debug/development UI YES (LOW PRIORITY)
src/lib/game/types.ts 516 Central type definitions YES (MEDIUM PRIORITY)
src/lib/game/computed-stats.ts 492 Mixed utility/stat functions YES (MEDIUM PRIORITY)
src/app/page.tsx 465 Main game page component YES (LOW PRIORITY)
src/components/game/GameContext.tsx 405 Unified store context YES (LOW PRIORITY)
src/lib/game/utils.ts 372 Mixed utility functions YES (MEDIUM PRIORITY)

Key Observation: Project is mid-refactor from legacy store.ts to slice-based architecture (lib/game/stores/). Priority should be completing this migration.


2. Unused Exports (207 Total)

Game Components (Never Imported)

  • src/components/game/ComboMeter.tsx - ComboMeter
  • src/components/game/GrimoireTab.tsx - GrimoireTab
  • src/components/game/layout/GameFooter.tsx - GameFooter
  • src/components/game/layout/GameHeader.tsx - GameHeader
  • src/components/game/layout/GameSidebar.tsx - GameSidebar
  • src/components/game/shared/GameOverScreen.tsx - GameOverScreen

Tab Component Props (Unused Type Exports)

  • All Tabs/*TabProps types in src/components/game/tabs/ (12 total)

Library Files (Unused Exports)

  • src/lib/game/attunements.ts - 8 unused exports
  • src/lib/game/constants.ts - 15+ unused exports
  • src/lib/game/computed-stats.ts - 5 unused exports
  • src/lib/game/effects.ts - 5 unused exports
  • src/lib/game/store.ts - 7 unused exports
  • src/lib/game/types.ts - 20+ unused type exports
  • src/lib/game/upgrade-effects.ts - 6 unused exports
  • src/lib/game/utils.ts - 2 unused exports

UI Components (shadcn/ui - Never Imported)

28 unused shadcn/ui components in src/components/ui/ (accordion, alert, calendar, chart, etc.)


3. Dead Imports (56 Total)

Top-Level Components

  • src/app/page.tsx: 5 dead imports (fmtDec, getDamageBreakdown, SKILL_EVOLUTION_PATHS, etc.)
  • src/components/game/SkillsTab.tsx: 4 dead imports
  • src/components/game/SpellsTab.tsx: 4 dead imports
  • src/components/game/StatsTab.tsx: 5 dead imports

Library Files

  • src/lib/game/store.ts: 1 dead import
  • src/lib/game/store/combatSlice.ts: 3 dead imports
  • src/lib/game/store/computed.ts: 4 dead imports
  • src/lib/game/store/skillSlice.ts: 3 dead imports

4. Unreferenced Files (57 Total)

Game Components (Never Imported)

  • 7 game components including ComboMeter.tsx, GameFooter.tsx, etc.

UI Components

  • 28 unused shadcn/ui components

Library Files

  • Old store architecture: src/lib/game/store/*.ts (10 files)
  • Old stores: src/lib/game/stores/*.ts (8 files)
  • Test files: src/lib/game/*test.ts (4 files)
  • src/lib/db.ts (Prisma client, may be runtime-used)

5. TODO/FIXME Comments

None found in source code (only "Temp" substring matches from temporal/tempest references)


6. Unimplemented Stubs & Unused Effects

Critical Issues

  1. EXECUTIONER effect used but not defined (HIGH SEVERITY)
    • Referenced in store.ts:1085, combatSlice.ts:102, gameStore.ts:265
    • Missing from SPECIAL_EFFECTS in upgrade-effects.ts
    • Will cause runtime errors

Unused Effects

  1. 51/59 SPECIAL_EFFECTS constants unused (Medium severity)

    • Only 8/59 effects are actually checked via hasSpecial()
    • Examples: FLOW_SURGE, MANA_OVERFLOW, FIRST_STRIKE, etc.
  2. 5 unused enchantment specialId values

    • spellEcho10, fireBlade, frostBlade, lightningBlade, voidBlade
    • Defined in enchantment-effects.ts but never checked in game logic
  3. ~200+ specialId values in skill-evolution.ts never checked

    • Most specialId values added to specials Set but no corresponding hasSpecial() check

Empty Functions

None found - no empty function stubs detected


7. Summary of Priority Actions

  1. Remove 28 unused shadcn/ui components from src/components/ui/
  2. Remove dead imports (56 total) across all files
  3. Remove old store architecture files if confirmed unused:
    • src/lib/game/store/*.ts
    • src/lib/game/stores/*.ts
  4. Remove unused game components if not needed:
    • ComboMeter.tsx, GameFooter.tsx, GameHeader.tsx, etc.
  1. HIGH PRIORITY: Split src/lib/game/store.ts (2464 lines) - complete migration to slice architecture
  2. Split src/lib/game/skill-evolution.ts (2312 lines) by skill category
  3. Split src/lib/game/constants.ts (1436 lines) into domain-specific files
  4. Split src/components/game/tabs/CraftingTab.tsx (965 lines) by crafting stage

Phase 4 (Implement Missing Effects) - Critical Fixes

  1. CRITICAL: Add EXECUTIONER: 'executioner' to SPECIAL_EFFECTS in upgrade-effects.ts
  2. Either implement or remove 51 unused SPECIAL_EFFECTS constants
  3. Either implement or remove 5 unused enchantment specialId values
  4. Audit ~200 specialId values in skill-evolution.ts

Verification

  • Initial build: Passing
  • No TODO/FIXME comments found
  • No empty function stubs found
  • Runtime error identified: Missing EXECUTIONER effect definition