Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
# OpenSpec Change: enterprise-gaming-r3f-performance
- **Change ID**: enterprise-gaming-r3f-performance
- **Package**: `@suaveplan/r3f-performance`
- **Category**: gaming/effects
- **Target path**: `gaming/effects/r3f-performance`
- **Status**: PROPOSED
- **Date**: 2026-04-24
---
## Summary
Deliver `@suaveplan/r3f-performance` on the genesis branch from scratch at enterprise quality. The package provides performance monitoring and optimization utilities for React Three Fiber. A `PerformanceMonitor` component tracks FPS, draw calls, triangle count, GPU memory, and frame budget; a `PerformanceHUD` overlay renders the stats panel; an `AdaptiveQuality` component automatically reduces quality settings (shadow map size, particle count, LOD distance) when FPS drops below threshold. A `usePerformance()` hook exposes current metrics. Genesis adds structured errors, OTel metrics export, and 100% coverage.
---
## Available workspace deps
`@suaveplan/error`, `@suaveplan/types`, react, `@react-three/fiber`, `@react-three/drei`, three, `@opentelemetry/api`.
---
## Public API surface
```ts
function PerformanceMonitor(props: PerformanceMonitorProps): JSX.Element
// onDrop, onRecover, flipflops, bounds
function PerformanceHUD(props: PerformanceHUDProps): JSX.Element
// visible, position
function AdaptiveQuality(props: AdaptiveQualityProps): JSX.Element
// minFps, targetFps, qualityLevels
function usePerformance(): PerformanceMetrics
// fps, drawCalls, triangles, frameTime, gpuMemoryMb
```
---
## File layout
```text
gaming/effects/r3f-performance/
package.json / tsconfig.json / vitest.config.ts
src/
index.ts / error-codes.ts
types/common.ts + md
core/metrics-collector/ (ts + md + types + test + index)
components/
PerformanceMonitor/ (tsx + md + test + stories + index)
PerformanceHUD/ (tsx + md + test + stories + index)
AdaptiveQuality/ (tsx + md + test + stories + index)
hooks/use-performance.ts + md + test
tests/integration.test.ts
```

View File

@@ -0,0 +1,26 @@
# Tasks: enterprise-gaming-r3f-performance
## 0. Pre-flight (non-negotiable)
- [ ] 0.1 Confirm clean working tree (`git status` reports nothing) and no in-flight worktrees with uncommitted work (`git worktree list` then `git status` in each)
- [ ] 0.2 If any worktrees exist under `.claude/worktrees/`, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (`git worktree remove`) before opening a new one — code that has been lost twice on main is the failure mode this guards against.
- [ ] 0.3 Confirm the package set in `MANIFEST.md` matches `find packages -maxdepth 3 -name package.json` count. Drift here means a prior change archived without regenerating the manifest.
## Phase 1 — Scaffold + types
## Phase 2 — Metrics collector
- [ ] FPS rolling average, draw calls from renderer.info, OTel export
- [ ] Tests + docs
## Phase 3 — Components + stories
- [ ] `PerformanceMonitor` + `PerformanceHUD` + `AdaptiveQuality`
## Phase 4 — `usePerformance` hook
## Phase 5 — Pre-publish gate
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/r3f-performance` green
- [ ] 100% coverage
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/r3f-performance`