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,66 @@
# OpenSpec Change: enterprise-gaming-r3f-xr
- **Change ID**: enterprise-gaming-r3f-xr
- **Package**: `@suaveplan/r3f-xr`
- **Category**: gaming/devices
- **Target path**: `gaming/devices/r3f-xr`
- **Status**: PROPOSED
- **Date**: 2026-04-24
---
## Summary
Deliver `@suaveplan/r3f-xr` on the genesis branch from scratch at enterprise quality. The package provides WebXR/VR/AR integration for React Three Fiber: `XRProvider` initializing the WebXR session, `useXR` hook (session type, referenceSpace, frame), `XRController` components for left/right hand meshes with ray pointer and grip pose, `HandTracking` with 25-joint skeleton rendering, `XRButton` for session entry/exit, and `TeleportTarget` for locomotion. Builds on `@react-three/xr` primitives with structured errors from `@suaveplan/error`. Genesis adds 100% coverage and Storybook stories.
---
## Available workspace deps
`@suaveplan/error`, `@suaveplan/types`, react, `@react-three/fiber`, `@react-three/drei`, `@react-three/xr`, three.
---
## Public API surface
```ts
type XRSessionMode = 'immersive-vr' | 'immersive-ar' | 'inline'
function XRProvider(props: XRProviderProps): JSX.Element
// sessionMode, referenceSpace, children
function XRController(props: XRControllerProps): JSX.Element
// hand: 'left' | 'right', showRay, showGrip
function HandTracking(props: HandTrackingProps): JSX.Element
// hand: 'left' | 'right', showJoints, showMesh
function XRButton(props: XRButtonProps): JSX.Element
// sessionMode, onSessionStart, onSessionEnd
function TeleportTarget(props: TeleportTargetProps): JSX.Element
// onTeleport(position: THREE.Vector3)
function useXR(): XRContext
// session, sessionMode, referenceSpace, isPresenting, frame
```
---
## File layout
```text
gaming/devices/r3f-xr/
package.json / tsconfig.json / vitest.config.ts
src/
index.ts / error-codes.ts
types/common.ts + md
context/xr-provider.tsx + md + test
hooks/use-xr.ts + md + test
components/
XRController/ (tsx + md + test + stories + index)
HandTracking/ (tsx + md + test + stories + index)
XRButton/ (tsx + md + test + stories + index)
TeleportTarget/ (tsx + md + test + stories + index)
tests/integration.test.ts
```

View File

@@ -0,0 +1,40 @@
# Tasks: enterprise-gaming-r3f-xr
## 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
- [ ] Create `gaming/devices/r3f-xr/` (`@suaveplan/r3f-xr`, `0.1.0`, `sideEffects: false`)
## Phase 2 — Types + error codes
- [ ] `src/types/common.ts` + `common.md`
- [ ] `src/error-codes.ts`
## Phase 3 — Context + hook
- [ ] `src/context/xr-provider.tsx` — WebXR session initialization, referenceSpace
- [ ] `src/hooks/use-xr.ts` — session, isPresenting, frame
- [ ] Tests + docs
## Phase 4 — Components
- [ ] `XRController` — left/right hand mesh, ray pointer, grip pose
- [ ] `HandTracking` — 25-joint skeleton rendering
- [ ] `XRButton` — session entry/exit
- [ ] `TeleportTarget` — locomotion destination mesh
- [ ] Tests + Storybook stories for each
## Phase 5 — Integration tests
- [ ] `tests/integration.test.ts` — session lifecycle, controller tracking
## Phase 6 — Pre-publish gate
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/r3f-xr` green
- [ ] 100% coverage
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/r3f-xr`