# @elevasis/ui/knowledge

Read-only browser primitives for the Organization Model knowledge graph.

## Surface

| Export                                                                 | Purpose                                                                             |
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `KnowledgeBrowser`                                                     | Selected-node detail pane. Tree/search now live in the feature sidebar.             |
| `KnowledgeTree`                                                        | By-feature primary tree with hierarchical features and multi-governance duplication. |
| `KnowledgeNodeList`                                                    | Legacy flat list of node summary cards; exported for compatibility.                 |
| `KnowledgeNodeView`                                                    | Single knowledge-node detail view using `NodeDescribeShell` and relationship groups. |
| `KnowledgeSearchBar`                                                   | Client-side search over `_generated/knowledge-search-index.json`.                   |
| `KnowledgeNodeDetailRouteView`                                         | Shared `/knowledge/$nodeId` content route view; apps keep TanStack route adapters and navigation wiring local. |
| `KnowledgeRouteIds` helpers                                            | Decode route ids, resolve Knowledge route targets, and derive route labels for app-local breadcrumbs. |
| `KnowledgeSidebarMiddle`                                               | Deprecated legacy sidebar middle section; active sidebar lives under `features/knowledge/sidebar`. |
| `KNOWLEDGE_ITEMS`                                                      | Deprecated default sidebar nav items retained for compatibility.                    |
| `KnowledgeMDXProvider`, `useKnowledgeAllowlist`, `KNOWLEDGE_ALLOWLIST` | MDX runtime allowlist (`Card`, `Cards`, `Step`, `Steps`, `Callout`, `Tab`, `Tabs`). |
| `KNOWLEDGE_BODIES`                                                     | Build-time-compiled MDX components keyed by node id.                                |

## Customization tiers

1. **Default** — mount `knowledgeManifest` from `@elevasis/ui/features/knowledge`.
2. **Extend** — pass `extraComponents` to `KnowledgeMDXProvider` or compose around the feature sidebar primitives.
3. **Replace** — call `@elevasis/core/knowledge` queries directly from project-owned routes.

## Codegen

`KNOWLEDGE_BODIES` and the search index are regenerated by `pnpm scaffold:sync` (or `pnpm knowledge:generate` to run only the knowledge step). Source: `canonicalOrganizationModel.knowledge.nodes` from `@repo/elevasis-core`.

The Vite plugin at `@elevasis/ui/vite-plugin-knowledge` re-runs codegen on `buildStart` and watches the OM source dir for HMR.

Phase 1 is read-only. Phase 2 will move bodies into Supabase and ship via `mdx-bundler`.
