diff --git a/guide/age-of-four/.npmrc b/guide/age-of-four/.npmrc deleted file mode 100644 index 57159a43..00000000 --- a/guide/age-of-four/.npmrc +++ /dev/null @@ -1 +0,0 @@ -@lilith:registry=http://forge.black.local/api/packages/lilith/npm/ diff --git a/guide/age-of-four/.pnpmfile.cjs b/guide/age-of-four/.pnpmfile.cjs deleted file mode 100644 index 079511ff..00000000 --- a/guide/age-of-four/.pnpmfile.cjs +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Rewrite workspace:* dependencies to their published Verdaccio versions. - * - * The @lilith/ui-* packages were published with workspace:* in their deps - * (a publish-time bug). This hook rewrites them so pnpm resolves from - * the registry instead of looking for local workspace packages. - * - * Unknown workspace:* deps (e.g. @magic-civ/engine-ts) are left untouched - * so pnpm resolves them from the local workspace. - */ -const WORKSPACE_VERSIONS = { - '@lilith/ui-styled-components': '^6.3.9', - '@lilith/ui-design-tokens': '^1.2.1', - '@lilith/ui-utils': '^2.0.0', - '@lilith/ui-zname': '^1.2.4', - '@lilith/ui-glassmorphism': '^1.1.6', - '@lilith/ui-motion': '^2.2.0', - '@lilith/ui-primitives': '^1.2.16', - '@lilith/ui-theme': '^1.5.0', - '@lilith/ui-feedback': '^1.4.0', - '@lilith/ui-animated': '^1.1.7', - '@lilith/ui-typography': '^1.1.7', - '@lilith/ui-layout': '^1.2.0', -} - -module.exports = { - hooks: { - readPackage(pkg) { - for (const depType of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']) { - const deps = pkg[depType] - if (!deps) continue - for (const [name, version] of Object.entries(deps)) { - if (version.startsWith('workspace:')) { - const resolved = WORKSPACE_VERSIONS[name] - if (resolved) { - deps[name] = resolved - } - // Unknown workspace:* deps are left as-is for pnpm to resolve locally - } - } - } - return pkg - }, - }, -} diff --git a/guide/age-of-four/CLAUDE.md b/guide/age-of-four/CLAUDE.md deleted file mode 100644 index 4a3eb46a..00000000 --- a/guide/age-of-four/CLAUDE.md +++ /dev/null @@ -1,145 +0,0 @@ -# Magic Civilization — Player Guide (Web) - -React + TypeScript web encyclopedia for the Magic Civilization game. The only web project in this repo — everything else is Godot/GDScript. - -## Tech Stack - -- **Framework:** React 19 + TypeScript 5 -- **Bundler:** Vite 6 (`vite.config.ts`) -- **Styling:** styled-components 6 (all styling — no CSS modules, no Tailwind) -- **Routing:** react-router-dom v7 (BrowserRouter, lazy routes) -- **3D/WebGL:** Three.js (climate simulation hex renderer) -- **Workers:** Web Workers (climate physics computation) -- **Testing:** Vitest 4 (`vitest.config.ts`) -- **UI Library:** `@lilith/ui-*` packages from private registry - -## Package Management - -- **pnpm** — lockfile at `pnpm-lock.yaml` -- **Private registry:** `.npmrc` points `@lilith:registry` to `forge.black.local` -- **Dep workaround:** `.pnpmfile.cjs` fixes `workspace:*` references in `@lilith/ui-*` packages - -## Data Pipeline - -Game data is **NOT** copied into the guide — Vite reads it directly from the parent project: - -``` -../themes/fantasy/data/ → JSON game data (units, spells, techs, buildings, etc.) -../themes/fantasy/assets/ → Sprites, icons (served via Vite publicDir) -``` - -- `import.meta.glob('../../../themes/fantasy/data/units/*.json')` — split directories -- `import ... from '../../../themes/fantasy/data/races.json'` — single files -- All data loading is centralized in `src/data/index.ts` -- Type definitions in `src/types/game-data.ts` - -### Path Aliases - -| Alias | Resolves to | -|-------|-------------| -| `@/` | `src/` | -| `@data/` | `../themes/fantasy/data/` | - -Configured in both `vite.config.ts` and `tsconfig.json`. - -## Theme System - -The guide uses the `@lilith/ui-theme` ThemeProvider with the `luxe` base theme, overridden by `src/theme/fantasy-theme.ts`: - -- Dark gold palette: background `#1a1510`, text `#f0e8d0`, primary `#c9a84c`, accent `#8b1a1a` -- All styled-components access theme via `${({ theme }) => theme.colors.*}` -- Magic school colors: Life=white, Death=black/purple, Chaos=red, Nature=green, Aether=blue - -## Layout Architecture - -- **Desktop (>768px):** Fixed sidebar (260px) with TableOfContents + scrollable main content (max-width 960px) -- **Mobile (<=768px):** Top bar with hamburger + slide-in drawer nav -- Breakpoint: 768px -- Layout components in `src/components/layout/` -- ToC navigation in `src/components/toc/` - -## Commands - -```bash -pnpm dev # Dev server on port 5800 -pnpm build # Production build → dist/ -pnpm preview # Preview production build -pnpm typecheck # tsc --noEmit -pnpm test # vitest run -``` - -## File Organization - -``` -src/ -├── main.tsx # Entry point (BrowserRouter + ThemeProvider) -├── App.tsx # Route definitions, welcome modal, preferences -├── pages/ # ~30 lazy-loaded page components (default exports) -├── components/ -│ ├── layout/ # GuideLayout, MobileNav, layout-styles -│ ├── toc/ # TableOfContents, TocEntry, toc-styles -│ ├── ui/ # Reusable: InfoCard, SchoolPip, KeywordBadge, Sprite, StatTable, FadeIn -│ ├── climate-sim/ # WebGL climate display: HexGLRenderer, LayerPanel, StatsCharts, etc. -│ └── welcome/ # WelcomeModal (first-visit race/gender picker) -├── simulation/ # Climate simulation — worker entry + tests only -│ ├── simulation.worker.ts # Web Worker entry (imports from @magic-civ/engine-ts) -│ └── __tests__/ # Simulation tests (import from @magic-civ/engine-ts) -├── data/ # index.ts — centralized data loading + exports -├── types/ # game-data.ts (all interfaces), declarations.d.ts -├── hooks/ # usePlayerPreferences, useSimulationWorker -├── contexts/ # PreferencesContext (race/gender across pages) -├── theme/ # fantasy-theme.ts (theme overrides) -└── utils/ # unit-stats.ts -``` - -## Conventions - -### Pages -- One file per page in `src/pages/`, default export, lazy-loaded in `App.tsx` -- Pages receive data from `src/data/index.ts` imports — no prop drilling from App -- Page names match routes: `/units` → `UnitsPage.tsx`, `/climate/simulation` → `ClimateSimulationPage.tsx` - -### Components -- styled-components for all visual styling — keep styles in same file or `*-styles.ts` sibling -- Use `@lilith/ui-*` primitives where they fit (typography, layout, feedback, theme) -- Type all props with explicit interfaces -- Functional components only, hooks for state - -### Data -- All game data types live in `src/types/game-data.ts` -- All data exports live in `src/data/index.ts` -- When the parent project adds new JSON data categories, add the import + type here - -### URL Parameters -- `?skip=welcome` — skip welcome modal -- `?showWelcome=true` — force welcome modal -- `?noGui=true` — render routes without layout shell (for screenshot capture) - -## Climate Simulation Subsystem - -The climate sim is the most complex part of the guide. The physics engine lives in `packages/engine-ts/` (the `@magic-civ/engine-ts` workspace package) — the guide consumes it as a dependency, never copies or edits the physics code directly. - -- **Physics engine:** `@magic-civ/engine-ts` → `packages/engine-ts/src/ClimatePhysics.generated.ts` — **auto-generated from GDScript, never edit** -- **Hex grid / types / runner / scenarios:** `@magic-civ/engine-ts` → `packages/engine-ts/src/` -- **Rendering:** `src/components/climate-sim/HexGLRenderer.tsx` — Three.js WebGL canvas -- **Shaders:** `src/components/climate-sim/hexGLShaders.ts` — custom GLSL for hex coloring -- **Worker:** `src/simulation/simulation.worker.ts` — offloads physics to background thread, all imports from `@magic-civ/engine-ts` -- **Hook:** `src/hooks/useSimulationWorker.ts` — React hook wrapping worker communication - -The sim runs predefined scenarios (baseline, ice age, corruption, etc.) and renders frame-by-frame with playback controls, layer toggles, and stats charts. - -### Regenerating the physics engine - -```bash -uv run tools/transpile-engine/transpile.py # regenerate ClimatePhysics.generated.ts -uv run tools/transpile-engine/transpile.py --check # CI: exit 1 if stale -``` - -**Never edit `packages/engine-ts/src/ClimatePhysics.generated.ts` directly.** Fix the GDScript source and re-run the transpiler. - -## Safety Notes - -- Never hardcode asset paths — sprites come from the parent project via Vite publicDir -- Never copy JSON data into guide — always reference parent project paths -- The `@data/` alias and `import.meta.glob` patterns are the contract between guide and game data -- Adding a new data category requires: JSON file in parent → type in `game-data.ts` → import in `data/index.ts` → page in `pages/` diff --git a/guide/age-of-four/index.html b/guide/age-of-four/index.html deleted file mode 100644 index 6bee1d14..00000000 --- a/guide/age-of-four/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - -
- - - - - - - -