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,60 @@
# OpenSpec Change: enterprise-gaming-r3f-npc
- **Change ID**: enterprise-gaming-r3f-npc
- **Package**: `@suaveplan/r3f-npc`
- **Category**: gaming/gameplay
- **Target path**: `gaming/gameplay/r3f-npc`
- **Status**: PROPOSED
- **Date**: 2026-04-24
---
## Summary
Deliver `@suaveplan/r3f-npc` on the genesis branch from scratch at enterprise quality. The package is the R3F rendering layer for `@suaveplan/npc`: `NpcMesh` composing `@suaveplan/r3f-character` locomotion with NPC state from the NpcRegistry, `BehaviorTreeDebug` overlay visualizing node states (running/success/failure) in a floating tree panel, `NpcNameplate` billboarded nameplate with health bar and status icon, `DialogueTrigger` component showing proximity-based interaction prompt and wiring into `@suaveplan/dialogue`, and `NpcMarker` minimap dot. Genesis adds 100% coverage and Storybook stories.
---
## Available workspace deps
`@suaveplan/npc`, `@suaveplan/behavior-tree`, `@suaveplan/dialogue`, `@suaveplan/r3f-character`, `@suaveplan/r3f-ui`, `@suaveplan/error`, `@suaveplan/types`, react, `@react-three/fiber`, `@react-three/drei`, three.
---
## Public API surface
```ts
function NpcMesh(props: NpcMeshProps): JSX.Element
// npcId, model, showNameplate, showDebug
function BehaviorTreeDebug(props: BehaviorTreeDebugProps): JSX.Element
// treeRef, visible, position
function NpcNameplate(props: NpcNameplateProps): JSX.Element
// name, health, maxHealth, statusIcon
function DialogueTrigger(props: DialogueTriggerProps): JSX.Element
// npcId, triggerRadius, prompt
function NpcMarker(props: NpcMarkerProps): JSX.Element
// npcId, icon, color
```
---
## File layout
```text
gaming/gameplay/r3f-npc/
package.json / tsconfig.json / vitest.config.ts
src/
index.ts / error-codes.ts
types/common.ts + md
components/
NpcMesh/ (tsx + md + test + stories + index)
BehaviorTreeDebug/ (tsx + md + test + stories + index)
NpcNameplate/ (tsx + md + test + stories + index)
DialogueTrigger/ (tsx + md + test + stories + index)
NpcMarker/ (tsx + md + test + stories + index)
tests/integration.test.ts
```

View File

@@ -0,0 +1,35 @@
# Tasks: enterprise-gaming-r3f-npc
## 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/gameplay/r3f-npc/` (`@suaveplan/r3f-npc`, `0.1.0`, `sideEffects: false`)
## Phase 2 — Types + error codes
- [ ] `src/types/common.ts` + `common.md`
- [ ] `src/error-codes.ts`
## Phase 3 — Components
- [ ] `NpcMesh` — composes r3f-character with NpcRegistry state
- [ ] `BehaviorTreeDebug` — floating tree panel with node status colors
- [ ] `NpcNameplate` — billboarded name + health bar + status icon
- [ ] `DialogueTrigger` — proximity interaction prompt wired to @suaveplan/dialogue
- [ ] `NpcMarker` — minimap dot with icon/color
- [ ] Tests + Storybook stories for each
## Phase 4 — Integration tests
- [ ] `tests/integration.test.ts` — NPC state → mesh, dialogue trigger proximity
## Phase 5 — Pre-publish gate
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/r3f-npc` green
- [ ] 100% coverage
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/r3f-npc`