Files
TehRiehlDeal 66a44354cd
CI / security (push) Failing after 4s
CI / test (push) Failing after 17s
CI / static (push) Failing after 19s
chore: session 4 polish — CI, lint, prestige UI, balance pass
Adds the CI workflow, ESLint flat config, basic prestige action,
and tunes three off-balance numbers in the day-1 content.

CI runs three parallel jobs: `static` (lint, typecheck, prettier,
build), `test` (unit + Postgres-backed integration via service
container, with coverage gate), and `security` (gitleaks + trivy).
Scratch crypto keys are generated per-run from openssl so the
server can boot in CI without any committed secrets.

Prestige UI: a "git commit" / "git tag -a" button in each
prestigeable layer's canvas header, gated on the upstream `best`
threshold. Displays projected gain inline (`// +N `) so the
trade is visible before clicking.

Balance fixes:
- Releases requirement was 1000 commits (≈5B LoC, unreachable)
  with a gain formula that returned 0 at the threshold. Aligned
  both at 100 commits with prestigePoints exponent 0.5.
- Tech Debt accrual was 0.0005 × code/s (500 debt/s at 1M LoC).
  Reduced to 0.0001 — still meaningful, no longer punitive.
- Pay-Down Debt was effect=-10 per buyable, instantly turning the
  production multiplier to -9. Changed to -0.1 (each pay-down
  slows accrual by 10%; 10 pay-downs stops it; further buys
  reverse the flow). Also corrected costLayer to "code" so it
  spends LoC, not Debt.

Schema: added `costLayer` to Buyable to match Upgrade (needed for
the Tech Debt fix). RightPanel now honors `costLayer` for both
upgrades and buyables — the cost-side affordability check and the
spendAmount target both follow the override.

Verification:
- pnpm -r typecheck: clean
- pnpm -r lint: clean
- pnpm format:check: clean
- pnpm -r test: 73 unit tests pass
- pnpm --filter @teh-riehl/server test:integration: 7/7 pass
- 80 tests total

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 12:50:45 -07:00

4.3 KiB

Project Plan: TehRiehlIncremental

This document outlines the architecture, tech stack, game design, and development lifecycle for a new incremental game, TehRiehlIncremental. Built upon the core philosophy of The Modding Tree framework, the game is designed to scale securely while providing long-term engagement.

1. Game Design & Core Features

To maximize player retention right out of the gate, the game will launch with a massive initial content drop, taking inspiration from the deep, multi-layered progression systems found in titles like Idleon. The core loop revolves around unlocking nodes on a highly interconnected tree structure.

  • Extensive Day-1 Content: Multiple resource layers, prestige mechanics, and overlapping progression paths available at launch so players have diverse short-term and long-term goals.
  • Expansion-Ready Architecture: The underlying data structure for the tree will be strictly modular. "Expansions" will function as drop-in content packs that bolt new sub-trees onto existing late-game nodes without requiring a hard reset of base calculations.
  • Integrated Patch Notes System: A dedicated, stylish UI modal parsing markdown/JSON files directly from the repository. This keeps players informed of balancing tweaks and new branches seamlessly between versions.

2. Technical Architecture & Tech Stack

The application will be structured as a monorepo managed by pnpm, optimizing dependency installation and workspace management across both the client and server.

Component Technology Implementation Strategy
Frontend Client React, TypeScript, Vite Highly performant UI rendering utilizing strict TypeScript types to prevent runtime errors during deep tree calculations.
Styling & UI Components TailwindCSS, ShadCN Rapid, consistent design system. ShadCN will provide the accessible primitives (modals for patch notes, tooltips for tree nodes).
State Management Redux Centralized store for the complex game state, handling offline progress calculations, resource ticks, and node unlocks.
Backend API NestJS Enterprise-grade architecture for handling authentication, secure cloud saves, and potential future multiplayer features.
Database PostgreSQL Robust relational storage for user profiles, JSON save blobs, and game economy analytics.

3. Development Methodology: Test-Driven

Given the mathematically intensive nature of incremental games, strict adherence to Test-Driven Development (TDD) ensures formulas remain stable as numbers scale exponentially.

  • TDD Workflow: Tests for resource generation formulas, cost scaling, and unlock requirements will be written before the implementation logic.
  • Coverage Goal: Strict enforcement of 90%+ unit test coverage using Vitest/Jest, particularly focusing on the Redux reducers and the core math utility functions.

4. CI/CD Pipeline (GitHub Actions)

A robust pipeline will automatically secure, format, and validate every pull request before deployment, ensuring high code quality across the monorepo.

# Example workflow structure
name: Monorepo CI Pipeline
on: [push, pull_request]

jobs:
  validate-and-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
      - name: Setup Node & pnpm

      # 1. Security Checks
      - name: Secrets Scan (e.g., GitLeaks)
      - name: Container/Dependency Security (Trivy)

      # 2. Linting & Formatting
      - name: ESLint Check (Frontend & Backend)
      - name: Prettier Format Check

      # 3. Testing
      - name: Run Unit Tests with Coverage
      - name: Enforce 90% Coverage Threshold

5. Next Steps

  • Initialize the pnpm monorepo workspace.
  • Scaffold the Vite/React frontend and NestJS backend.
  • Draft the initial JSON/TypeScript structure for the base "Modding Tree" data format.
  • Establish the GitHub Actions workflow file.