Initial Commit
This commit is contained in:
60
openspec/changes/enterprise-gaming-r3f-world/proposal.md
Normal file
60
openspec/changes/enterprise-gaming-r3f-world/proposal.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# OpenSpec Change: enterprise-gaming-r3f-world
|
||||
|
||||
- **Change ID**: enterprise-gaming-r3f-world
|
||||
- **Package**: `@suaveplan/r3f-world`
|
||||
- **Category**: gaming/scene
|
||||
- **Target path**: `gaming/scene/r3f-world`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-24
|
||||
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/r3f-world.md`
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Deliver `@suaveplan/r3f-world` on the genesis branch from scratch at enterprise quality. The package provides world management and scene composition for React Three Fiber. A `WorldManager` orchestrates scene layers (terrain, vegetation, water, buildings, NPCs, effects) in dependency order; a `SceneGraph` maintains a flat registry of mounted scene nodes with bounding volumes; a `WorldProvider` React context exposes the manager to all child R3F components. `useWorld()` accesses the context for scene queries and entity registration. Genesis adds structured errors, OTel scene-node gauge, and 100% coverage.
|
||||
|
||||
---
|
||||
|
||||
## Available workspace deps
|
||||
|
||||
`@suaveplan/error`, `@suaveplan/types`, `@suaveplan/events`, `@suaveplan/spatial-hash`, `@suaveplan/ecs`, react, `@react-three/fiber`, `@react-three/drei`, three.
|
||||
|
||||
---
|
||||
|
||||
## Public API surface
|
||||
|
||||
```ts
|
||||
function WorldProvider(props: WorldProviderProps): JSX.Element
|
||||
function useWorld(): WorldContext
|
||||
|
||||
interface WorldContext {
|
||||
register(node: SceneNode): () => void
|
||||
query(bounds: AABB3): SceneNode[]
|
||||
readonly nodeCount: number
|
||||
}
|
||||
|
||||
// Components
|
||||
function World(props: WorldProps): JSX.Element // root scene orchestrator
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
```text
|
||||
gaming/scene/r3f-world/
|
||||
package.json / tsconfig.json / vitest.config.ts
|
||||
src/
|
||||
index.ts / error-codes.ts / constants/index.ts
|
||||
types/common.ts + md
|
||||
core/
|
||||
world-manager/ (ts + md + types + test + index)
|
||||
scene-graph/ (ts + md + types + test + index)
|
||||
context/
|
||||
world-provider.tsx + md + test
|
||||
use-world.ts + md + test
|
||||
components/
|
||||
World/ (tsx + md + test + stories + index)
|
||||
tests/integration.test.ts
|
||||
```
|
||||
40
openspec/changes/enterprise-gaming-r3f-world/tasks.md
Normal file
40
openspec/changes/enterprise-gaming-r3f-world/tasks.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Tasks: enterprise-gaming-r3f-world
|
||||
|
||||
## 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/scene/r3f-world/` (`@suaveplan/r3f-world`, `0.1.0`, `sideEffects: false`)
|
||||
|
||||
## Phase 2 — Types + error codes
|
||||
|
||||
- [ ] `src/types/common.ts` + `common.md`
|
||||
|
||||
## Phase 3 — Scene graph
|
||||
|
||||
- [ ] Flat registry with spatial-hash AABB queries
|
||||
- [ ] Tests + docs
|
||||
|
||||
## Phase 4 — World manager
|
||||
|
||||
- [ ] Layer ordering, mount/unmount lifecycle, OTel node gauge
|
||||
- [ ] Tests + docs
|
||||
|
||||
## Phase 5 — Context + hook
|
||||
|
||||
- [ ] `WorldProvider`, `useWorld`
|
||||
- [ ] Tests + docs
|
||||
|
||||
## Phase 6 — `World` component + story
|
||||
|
||||
- [ ] Tests + Storybook
|
||||
|
||||
## Phase 7 — Pre-publish gate
|
||||
|
||||
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/r3f-world` green
|
||||
- [ ] 100% coverage
|
||||
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/r3f-world`
|
||||
Reference in New Issue
Block a user