rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New

Slice · AI prompt

Workspace Shell — atomic (workspace × menuSet) NavContext

Unified workspace + menu navigation primitive. NavContext = (workspaceId, menuSetId) atomic pair. 2-tier dropdown switcher (workspace radio + menuSet picker), ContextBadge header chip, full editor with tabs (menus / workspace tree / settings), tiered RBAC (admin menus.manage, user menus.fork). Replaces silo'd menu-store + workspace-store slices in superspace. Resolver chain: user nav-context cache > user assignment > workspace default > system. Source: superspace.

Resource detail View source
Copy this prompt into Claude / Codex / Cursor
workspace-shell.prompt.mdmarkdown
# Install `workspace-shell` — Workspace Shell — atomic (workspace × menuSet) NavContext

> Unified workspace + menu navigation primitive.

📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail   : https://resource.rahmanef.com/slices/workspace-shell
🧠 JSON catalog   : https://resource.rahmanef.com/api/knowledge?slice=workspace-shell
🔗 Source         : https://github.com/rahmanef63/resource-site/tree/main/template-base/frontend/slices/workspace-shell

## 1. Install

```bash

# alias: npx rr add workspace-shell
```

The CLI copies `template-base/frontend/slices/workspace-shell/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.

## 2. What it ships

- shadcn primitives: `dropdown-menu`, `popover`, `command`, `tabs`, `switch`
- peer slices (cascade install):
  - `convex-auth` — User session required for menuSet assignment + nav-context cache.
- convex feature paths: `template-base/convex/features/workspaceShell`

## 3. Wire it up

Run `npx rr add workspace-shell`. Tables prefixed `workspaceShell_*` (menuSets, menuItems, itemComponents, wsAssignments, userAssignments, rolePerms, navContext). Mount `<NavContextProvider workspaceId={wsId}>` inside your auth provider; use `useNavContext(wsId)` to read `{workspace, menuSet, source, effectiveMenuItems, setMenuSet, forkMenuSet}`. Drop-in `<WorkspaceSwitcher canFork />` in sidebar header. Tiered RBAC: `menus.manage` for workspace-default editing, `menus.fork` for user-personal copy. Resolver chain: user cache → user assignment → workspace default → none. Pair with audit-log slice for context-switch / fork events (graceful try/catch if absent). Effective items query applies role filter via workspaceShell_rolePerms (no rolePerms → show all, pre-RBAC compat).

## Rules of engagement

- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice

The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.