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,99 @@
# OpenSpec Change: enterprise-gaming-react-social-game
- **Change ID**: enterprise-gaming-react-social-game
- **Package**: `@suaveplan/react-social-game`
- **Category**: gaming/react
- **Target path**: `gaming/react/react-social-game`
- **Status**: PROPOSED
- **Date**: 2026-04-24
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/react-social-game.md`
---
## Summary
Deliver `@suaveplan/react-social-game` on the genesis branch from scratch at enterprise quality. The package provides social game state management: friends lists, friend requests, user blocking, online-status tracking, activity strings, and search. A framework-agnostic `FriendListManager` class (built on `@suaveplan/events`) manages state; `useSocialGame()` backed by `useSyncExternalStore` provides React access; components render a friend panel, search results, status badges, and activity labels. Genesis adds Storybook stories, Vitest DOM tests, and 100% coverage.
---
## Current-state audit (genesis)
Package does not exist on genesis yet — fresh build.
---
## Available workspace deps on genesis
| Package | Role |
|---|---|
| `@suaveplan/events` (`workspace:^`) | Social state change events |
| `@suaveplan/party` (`workspace:^`) | Party invite integration |
| `react` (`catalog:react`) | React 18 |
---
## Public API surface
```ts
type OnlineStatus = 'online' | 'away' | 'busy' | 'offline'
interface Friend {
playerId: string
displayName: string
status: OnlineStatus
activity?: string
avatarUrl?: string
}
function createFriendListManager(options?: { playerId: string }): FriendListManager
interface FriendListManager {
getSnapshot(): SocialState
subscribe(cb: () => void): () => void
addFriend(friend: Friend): void
removeFriend(playerId: string): void
updateStatus(playerId: string, status: OnlineStatus, activity?: string): void
blockPlayer(playerId: string): void
unblockPlayer(playerId: string): void
sendFriendRequest(toId: string): void
acceptFriendRequest(fromId: string): void
search(query: string): Friend[]
}
function useSocialGame(): SocialState & { manager: FriendListManager }
// Components
function FriendPanel(props): JSX.Element
function FriendRow(props): JSX.Element
function StatusBadge(props): JSX.Element
function FriendSearch(props): JSX.Element
function FriendRequestList(props): JSX.Element
```
---
## File layout
```text
gaming/react/react-social-game/
package.json
tsconfig.json
vitest.config.ts
src/
index.ts
types/common.ts + md
state/friend-list-manager.ts + md + test
hooks/use-social-game.ts + md + test
components/
friend-panel/ (tsx + md + test + stories + index)
friend-row/ (tsx + md + test + stories + index)
status-badge/ (tsx + md + test + stories + index)
friend-search/ (tsx + md + test + stories + index)
friend-request-list/ (tsx + md + test + stories + index)
```
---
## Impact
**Downstream**: composable in game lobby and social hub UIs. Prerequisites: `@suaveplan/events`, `@suaveplan/party`, react.

View File

@@ -0,0 +1,36 @@
# Tasks: enterprise-gaming-react-social-game
## 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/react/react-social-game/` (`@suaveplan/react-social-game`, `0.1.0`, `sideEffects: false`)
## Phase 2 — Types
- [ ] `src/types/common.ts` + `common.md`
## Phase 3 — FriendListManager + hook
- [ ] Manager with add/remove/updateStatus/block/search/requests
- [ ] `useSocialGame` hook
- [ ] Tests + docs for both
## Phase 4 — Components
- [ ] `StatusBadge` — colored dot with tooltip
- [ ] `FriendRow` — avatar + name + status + actions (invite, message, block)
- [ ] `FriendPanel` — scrollable list with search input
- [ ] `FriendSearch` — debounced query with results
- [ ] `FriendRequestList` — pending incoming/outgoing requests
- [ ] Tests + Storybook stories for each
## Phase 5 — Pre-publish gate
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/react-social-game` green
- [ ] 100% coverage
- [ ] Publish: `bun scripts/publish.ts --package @suaveplan/react-social-game`