Initial Commit
This commit is contained in:
55
openspec/changes/enterprise-gaming-r3f-building/proposal.md
Normal file
55
openspec/changes/enterprise-gaming-r3f-building/proposal.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# OpenSpec Change: enterprise-gaming-r3f-building
|
||||
|
||||
- **Change ID**: enterprise-gaming-r3f-building
|
||||
- **Package**: `@suaveplan/r3f-building`
|
||||
- **Category**: gaming/scene
|
||||
- **Target path**: `gaming/scene/r3f-building`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-24
|
||||
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/r3f-building.md`
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Deliver `@suaveplan/r3f-building` on the genesis branch from scratch at enterprise quality. The package provides R3F building mode UI: ghost preview of the piece being placed, snap socket highlight spheres, invalid placement red tint, confirm/cancel keybind integration, and structural instability shake effect. It wires directly to `@suaveplan/building`'s `PlacementEngine` and `StructureGraph`. A `BuildingMode` component activates the placement mode context; `PlacementGhost` renders the translucent preview mesh. Genesis adds structured errors, OTel placement counter, and 100% coverage.
|
||||
|
||||
---
|
||||
|
||||
## Available workspace deps
|
||||
|
||||
`@suaveplan/error`, `@suaveplan/building`, `@suaveplan/controller`, react, `@react-three/fiber`, `@react-three/drei`, three.
|
||||
|
||||
---
|
||||
|
||||
## Public API surface
|
||||
|
||||
```ts
|
||||
function BuildingMode(props: BuildingModeProps): JSX.Element
|
||||
// registry, onPlaced, onCancel, controllerManager
|
||||
|
||||
function PlacementGhost(props: PlacementGhostProps): JSX.Element
|
||||
function SnapIndicator(props: SnapIndicatorProps): JSX.Element
|
||||
function PlacedPieces(props: PlacedPiecesProps): JSX.Element
|
||||
|
||||
function useBuildingMode(): BuildingModeCon```text
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
```text
|
||||
gaming/scene/r3f-building/
|
||||
package.json / tsconfig.json / vitest.config.ts
|
||||
src/
|
||||
index.ts / error-codes.ts
|
||||
types/common.ts + md
|
||||
context/building-mode-provider.tsx + md + test
|
||||
hooks/use-building-mode.ts + md + test
|
||||
components/
|
||||
BuildingMode/ (tsx + md + test + stories + index)
|
||||
PlacementGhost/ (tsx + md + test + stories + index)
|
||||
SnapIndicator/ (tsx + md + test + stories + index)
|
||||
PlacedPieces/ (tsx + md + test + stories + index)
|
||||
tests/integration.test.ts
|
||||
```
|
||||
29
openspec/changes/enterprise-gaming-r3f-building/tasks.md
Normal file
29
openspec/changes/enterprise-gaming-r3f-building/tasks.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Tasks: enterprise-gaming-r3f-building
|
||||
|
||||
## 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-building/` (`@suaveplan/r3f-building`, `0.1.0`, `sideEffects: false`)
|
||||
|
||||
## Phase 2 — Types + context/hook
|
||||
|
||||
- [ ] `BuildingModeProvider`, `useBuildingMode`
|
||||
- [ ] Tests + docs
|
||||
|
||||
## Phase 3 — Components + stories
|
||||
|
||||
- [ ] `PlacementGhost` — translucent mesh + valid/invalid color
|
||||
- [ ] `SnapIndicator` — sphere at snap socket
|
||||
- [ ] `PlacedPieces` — instanced placed pieces
|
||||
- [ ] `BuildingMode` — orchestrator + controller keybind wiring
|
||||
|
||||
## Phase 4 — Pre-publish gate
|
||||
|
||||
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/r3f-building` green
|
||||
- [ ] 100% coverage
|
||||
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/r3f-building`
|
||||
Reference in New Issue
Block a user