@elevasis/sdk 1.20.1 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/cli.cjs +3388 -1530
  2. package/dist/index.d.ts +412 -149
  3. package/dist/index.js +955 -721
  4. package/dist/node/index.d.ts +0 -3
  5. package/dist/node/index.js +22 -49
  6. package/dist/test-utils/index.d.ts +395 -128
  7. package/dist/test-utils/index.js +599 -368
  8. package/dist/worker/index.js +536 -323
  9. package/package.json +4 -4
  10. package/reference/_navigation.md +9 -7
  11. package/reference/_reference-manifest.json +1 -1
  12. package/reference/claude-config/rules/agent-start-here.md +4 -0
  13. package/reference/claude-config/rules/frontend.md +2 -2
  14. package/reference/claude-config/rules/organization-model.md +44 -2
  15. package/reference/claude-config/rules/organization-os.md +12 -12
  16. package/reference/claude-config/rules/ui.md +14 -14
  17. package/reference/claude-config/rules/vibe.md +37 -33
  18. package/reference/claude-config/skills/explore/SKILL.md +6 -6
  19. package/reference/claude-config/skills/knowledge/SKILL.md +73 -29
  20. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +1 -1
  21. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +25 -24
  22. package/reference/claude-config/skills/knowledge/operations/features.md +56 -93
  23. package/reference/claude-config/skills/knowledge/operations/labels.md +19 -14
  24. package/reference/claude-config/skills/knowledge/operations/offerings.md +6 -6
  25. package/reference/claude-config/skills/save/SKILL.md +2 -2
  26. package/reference/claude-config/skills/setup/SKILL.md +1 -1
  27. package/reference/claude-config/skills/tutorial/technical.md +23 -26
  28. package/reference/claude-config/skills/tutorial/vibe-coder.md +9 -9
  29. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -0
  30. package/reference/cli.mdx +140 -0
  31. package/reference/deployment/provided-features.mdx +29 -15
  32. package/reference/examples/organization-model.ts +1 -1
  33. package/reference/packages/core/src/knowledge/README.md +8 -7
  34. package/reference/packages/core/src/organization-model/README.md +66 -26
  35. package/reference/packages/ui/src/provider/README.md +5 -5
  36. package/reference/scaffold/core/organization-graph.mdx +16 -15
  37. package/reference/scaffold/core/organization-model.mdx +89 -41
  38. package/reference/scaffold/index.mdx +9 -9
  39. package/reference/scaffold/operations/propagation-pipeline.md +3 -3
  40. package/reference/scaffold/operations/scaffold-maintenance.md +11 -11
  41. package/reference/scaffold/recipes/add-a-feature.md +26 -24
  42. package/reference/scaffold/recipes/add-a-resource.md +10 -14
  43. package/reference/scaffold/recipes/customize-crm-actions.md +439 -439
  44. package/reference/scaffold/recipes/customize-knowledge-browser.md +384 -0
  45. package/reference/scaffold/recipes/customize-organization-model.md +72 -44
  46. package/reference/scaffold/recipes/extend-crm.md +40 -39
  47. package/reference/scaffold/recipes/extend-lead-gen.md +15 -16
  48. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +34 -30
  49. package/reference/scaffold/recipes/index.md +13 -12
  50. package/reference/scaffold/recipes/query-the-knowledge-graph.md +200 -0
  51. package/reference/scaffold/reference/contracts.md +362 -99
  52. package/reference/scaffold/reference/feature-registry.md +9 -20
  53. package/reference/scaffold/reference/glossary.md +18 -18
  54. package/reference/scaffold/ui/composition-extensibility.mdx +23 -23
  55. package/reference/scaffold/ui/customization.md +11 -11
  56. package/reference/scaffold/ui/feature-flags-and-gating.md +8 -8
  57. package/reference/scaffold/ui/feature-shell.mdx +19 -19
  58. package/reference/scaffold/ui/recipes.md +29 -28
@@ -1,10 +1,10 @@
1
- ---
2
- title: Build and Extend CRM
3
- description: Map the CRM platform primitives available to SDK projects: shared UI pages, sidebar composition, data hooks, action definitions, workflow adapters, contracts, and org-model extension boundaries.
4
- ---
5
1
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
2
  <!-- Regenerate: pnpm scaffold:sync -->
7
3
 
4
+ ---
5
+ title: Build and Extend CRM
6
+ description: Map the CRM platform primitives available to SDK projects: shared UI pages, sidebar composition, data hooks, action definitions, workflow adapters, contracts, and org-model extension boundaries.
7
+ ---
8
8
 
9
9
  # Build and Extend CRM
10
10
 
@@ -20,7 +20,7 @@ Good trigger phrases:
20
20
 
21
21
  CRM is a layered platform surface, not one component:
22
22
 
23
- - **Organization OS:** feature gates, sales pipeline semantics, quick access, and labels live in the organization model.
23
+ - **Organization OS:** System access, sales pipeline semantics, quick access, and labels live in the organization model.
24
24
  - **Shared UI:** CRM pages, sidebars, workbench panels, overview widgets, and Kanban/detail components live in `@elevasis/ui`.
25
25
  - **Headless hooks:** deal, company, contact, note, task, list, transition, and action hooks live under `@elevasis/ui/hooks`.
26
26
  - **Action system:** `ActionDef`, `DEFAULT_CRM_ACTIONS`, `deriveActions`, and provider-level `crmActions` configure deal actions.
@@ -31,7 +31,7 @@ CRM is a layered platform surface, not one component:
31
31
 
32
32
  | User wants | Start here | Notes |
33
33
  | --- | --- | --- |
34
- | Change CRM feature availability, labels, pipeline stages, or resource descriptors | `core/config/organization-model.ts` | Treat this as Organization OS work. Use the project's configure ceremony if available. |
34
+ | Change CRM System availability, labels, pipeline stages, or resource descriptors | `core/config/organization-model.ts` | Treat this as Organization OS work. Use the project's configure ceremony if available. |
35
35
  | Add CRM sidebar nav or a CRM route | `@elevasis/ui/features/crm` and `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` | Prefer manifest/sidebar composition. Do not fork shared source first. |
36
36
  | Wrap a shared CRM page with project chrome | `DealsListPage`, `DealDetailPage`, `CrmOverview` from `@elevasis/ui/features/crm` | Keep route files thin and put project-specific logic in local feature modules. |
37
37
  | Build a custom deal page | `useDealDetail`, `useDealNotes`, `useDealTasks`, `useExecuteAction` from `@elevasis/ui/hooks` | Use hooks for platform data and compose your own UI. |
@@ -58,18 +58,18 @@ Read the generated contracts before changing typed boundaries:
58
58
 
59
59
  `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
60
60
 
61
- Look for the **CRM Platform Primitives** section. It includes deal stages, deal rows, task shapes, API schemas, action definitions, and the focused CRM workflow adapter map. The broader acquisition/list adapter maps live under **Lead Gen Platform Primitives**.
62
-
63
- Deal list and detail responses include a server-derived `priority` object. Use `deal.priority.bucketKey`, `rank`, `label`, `reason`, `latestActivityAt`, and `nextActionAt` when composing custom deal workspaces or workflow-side follow-up logic instead of re-deriving priority from `updated_at`.
61
+ Look for the **CRM Platform Primitives** section. It includes deal stages, deal rows, task shapes, API schemas, action definitions, and the focused CRM workflow adapter map. The broader acquisition/list adapter maps live under **Lead Gen Platform Primitives**.
62
+
63
+ Deal list and detail responses include a server-derived `priority` object. Use `deal.priority.bucketKey`, `rank`, `label`, `reason`, `latestActivityAt`, and `nextActionAt` when composing custom deal workspaces or workflow-side follow-up logic instead of re-deriving priority from `updated_at`.
64
64
 
65
65
  ## 1. Extend CRM Navigation or Sidebar
66
66
 
67
- For a simple nav addition, extend `CRM_ITEMS` and override the CRM feature manifest:
67
+ For a simple nav addition, extend `CRM_ITEMS` and override the CRM system manifest:
68
68
 
69
69
  ```tsx
70
70
  // ui/src/routes/__root.tsx
71
71
  import { crmManifest, CRM_ITEMS, CrmSidebar, CrmSidebarMiddle } from '@elevasis/ui/features/crm'
72
- import type { FeatureModule } from '@elevasis/ui/provider'
72
+ import type { SystemModule } from '@elevasis/ui/provider'
73
73
  import type { NavItem } from '@elevasis/ui/layout'
74
74
  import { IconFileText } from '@tabler/icons-react'
75
75
 
@@ -84,13 +84,13 @@ const CustomCrmSidebar = () => (
84
84
  </CrmSidebar>
85
85
  )
86
86
 
87
- export const customCrmManifest: FeatureModule = {
87
+ export const customCrmManifest: SystemModule = {
88
88
  ...crmManifest,
89
89
  sidebar: CustomCrmSidebar
90
90
  }
91
91
  ```
92
92
 
93
- Then replace `crmManifest` with `customCrmManifest` in the local `FEATURE_MANIFESTS` array and add the matching route under `ui/src/routes/crm/`.
93
+ Then replace `crmManifest` with `customCrmManifest` in the local `SYSTEM_MANIFESTS` array and add the matching route under `ui/src/routes/crm/`.
94
94
 
95
95
  For structural changes, compose `CrmSidebarTop`, `SubshellNavList`, `SubshellSidebarSection`, `MyTasksPanel`, and `QuickCreateActions`. The full sidebar decision tree lives in `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md`.
96
96
 
@@ -164,10 +164,10 @@ Inside deployed workflows, use worker adapters instead of browser hooks or direc
164
164
 
165
165
  ```ts
166
166
  // operations/src/sales/follow-up-stale-deals.ts
167
- import type { WorkflowDefinition } from '@elevasis/sdk'
168
- import { crm } from '@elevasis/sdk/worker'
169
- import { resourceDescriptors } from '@core/config/organization-model'
170
- import { z } from 'zod'
167
+ import type { WorkflowDefinition } from '@elevasis/sdk'
168
+ import { crm } from '@elevasis/sdk/worker'
169
+ import { resourceDescriptors } from '@core/config/organization-model'
170
+ import { z } from 'zod'
171
171
 
172
172
  const inputSchema = z.object({
173
173
  stage: z.string().default('proposal')
@@ -177,15 +177,14 @@ const outputSchema = z.object({
177
177
  touched: z.number()
178
178
  })
179
179
 
180
- export const followUpStaleDealsWorkflow: WorkflowDefinition = {
181
- config: {
182
- resource: resourceDescriptors.followUpStaleDeals,
183
- resourceId: resourceDescriptors.followUpStaleDeals.id,
184
- name: 'Follow Up Stale Deals',
185
- type: resourceDescriptors.followUpStaleDeals.kind,
186
- version: '1.0.0',
187
- status: 'dev',
188
- links: [{ nodeId: 'feature:sales.crm', kind: 'operates-on' }]
180
+ export const followUpStaleDealsWorkflow: WorkflowDefinition = {
181
+ config: {
182
+ resource: resourceDescriptors.followUpStaleDeals,
183
+ resourceId: resourceDescriptors.followUpStaleDeals.id,
184
+ name: 'Follow Up Stale Deals',
185
+ type: resourceDescriptors.followUpStaleDeals.kind,
186
+ version: '1.0.0',
187
+ status: 'dev',
189
188
  },
190
189
  contract: { inputSchema, outputSchema },
191
190
  steps: {
@@ -196,15 +195,15 @@ export const followUpStaleDealsWorkflow: WorkflowDefinition = {
196
195
  outputSchema,
197
196
  next: null,
198
197
  handler: async (input) => {
199
- const deals = await crm.listDeals({ stage: input.stage })
200
-
201
- for (const deal of deals) {
202
- if (!['follow_up_due', 'stale'].includes(deal.priority.bucketKey)) continue
203
-
204
- await crm.createDealTask({
205
- dealId: deal.id,
206
- title: 'Follow up',
207
- kind: 'email'
198
+ const deals = await crm.listDeals({ stage: input.stage })
199
+
200
+ for (const deal of deals) {
201
+ if (!['follow_up_due', 'stale'].includes(deal.priority.bucketKey)) continue
202
+
203
+ await crm.createDealTask({
204
+ dealId: deal.id,
205
+ title: 'Follow up',
206
+ kind: 'email'
208
207
  })
209
208
  await crm.recordActivity({
210
209
  dealId: deal.id,
@@ -226,11 +225,11 @@ Use `crm` for focused CRM deal reads, notes, tasks, activity, and cleanup. Use `
226
225
 
227
226
  ## 5. Customize Pipeline Semantics
228
227
 
229
- CRM feature identity remains `sales.crm`, but the organization-model domain is `sales`.
228
+ CRM System identity is `sales.crm`, but the organization-model domain is `sales`.
230
229
 
231
- For stage labels or stage sets, update the project model:
232
-
233
- `core/config/organization-model.ts`
230
+ For stage labels or stage sets, update the project model:
231
+
232
+ `core/config/organization-model.ts`
234
233
 
235
234
  Keep these boundaries straight:
236
235
 
@@ -255,3 +254,5 @@ If you changed platform-level CRM contracts in the monorepo, the platform mainta
255
254
  pnpm scaffold:sync
256
255
  pnpm scaffold:verify
257
256
  ```
257
+
258
+
@@ -1,10 +1,10 @@
1
- ---
2
- title: Build and Extend Lead Gen
3
- description: Map the lead-gen platform primitives available to SDK projects: shared UI pages, sidebar composition, data hooks, list/member state, artifacts, workflow adapters, contracts, and org-model extension boundaries.
4
- ---
5
1
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
2
  <!-- Regenerate: pnpm scaffold:sync -->
7
3
 
4
+ ---
5
+ title: Build and Extend Lead Gen
6
+ description: Map the lead-gen platform primitives available to SDK projects: shared UI pages, sidebar composition, data hooks, list/member state, artifacts, workflow adapters, contracts, and org-model extension boundaries.
7
+ ---
8
8
 
9
9
  # Build and Extend Lead Gen
10
10
 
@@ -21,7 +21,7 @@ Good trigger phrases:
21
21
 
22
22
  Lead gen is a layered platform surface, not one component:
23
23
 
24
- - **Organization OS:** prospecting semantics, feature gates, pipeline labels, and quick access live in the organization model.
24
+ - **Organization OS:** prospecting semantics, System access, pipeline labels, and quick access live in the organization model.
25
25
  - **Shared UI:** lead-gen overview, lists, list detail, companies, contacts, sidebars, and drawer components live in `@elevasis/ui`.
26
26
  - **Headless hooks:** lists, companies, contacts, artifacts, list members, transitions, and derived actions live under `@elevasis/ui/hooks`.
27
27
  - **Acquisition substrate:** `acq_lists`, `acq_companies`, `acq_contacts`, `acq_artifacts`, list members, list companies, telemetry, and stateful transition shapes are exposed through generated contracts.
@@ -32,7 +32,7 @@ Lead gen is a layered platform surface, not one component:
32
32
 
33
33
  | User wants | Start here | Notes |
34
34
  | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
35
- | Change lead-gen feature availability, labels, quick access, pipeline semantics, or resource descriptors | `core/config/organization-model.ts` | Treat this as Organization OS work. Use the project's configure ceremony if available. |
35
+ | Change lead-gen System availability, labels, quick access, pipeline semantics, or resource descriptors | `core/config/organization-model.ts` | Treat this as Organization OS work. Use the project's configure ceremony if available. |
36
36
  | Add lead-gen sidebar nav or a lead-gen route | `@elevasis/ui/features/lead-gen` and `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` | Prefer manifest/sidebar composition. Do not fork shared source first. |
37
37
  | Wrap a shared lead-gen page with project chrome | `LeadGenOverviewPage`, `LeadGenListsPage`, `LeadGenListDetailPage`, `ListBuilderPage`, `LeadGenCompaniesPage`, `LeadGenContactsPage` | Keep route files thin and put project-specific behavior in local feature modules. |
38
38
  | Build a custom campaign/list workspace | `ListBuilderPage`, `useLists`, `useList`, `useListProgress`, `useListExecutions`, `useWorkflowExecution`, `useExecutionSSE` from `@elevasis/ui` | Use the shared builder when possible; otherwise compose hooks for platform data and workflow execution. |
@@ -46,7 +46,7 @@ Lead gen is a layered platform surface, not one component:
46
46
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
47
47
  | `leadGenManifest`, `LEAD_GEN_ITEMS`, `LeadGenSidebar`, `LeadGenSidebarTop`, `LeadGenSidebarMiddle` | `@elevasis/ui/features/lead-gen` | Feature registration and sidebar composition |
48
48
  | `LeadGenOverviewPage`, `LeadGenListsPage`, `LeadGenListDetailPage`, `ListBuilderPage`, `LeadGenCompaniesPage`, `LeadGenContactsPage` | `@elevasis/ui/features/lead-gen` | Shared lead-gen pages you can route to or wrap |
49
- | `ListActionsProvider`, `useListActions`, `ListBuilderWorkflow`, `ListBuilderRegistry`, `LeadGenCapabilityKey` | `@elevasis/ui/features/lead-gen` | List Builder workflow registry, slot-based field contracts, and project-owned action wiring |
49
+ | `ListActionsProvider`, `useListActions`, `ListBuilderWorkflow`, `ListBuilderRegistry`, `LeadGenActionKey` | `@elevasis/ui/features/lead-gen` | List Builder workflow registry, slot-based field contracts, and project-owned action wiring |
50
50
  | `LeadGenRouteShell`, `LIST_TEMPLATE_OPTIONS`, `buildListConfig` | `@elevasis/ui/features/lead-gen` | Route shell helpers and list creation config helpers (contact/company detail surfaces are now `ContactDetailPage` / `CompanyDetailPage` from `@elevasis/ui/features/crm`) |
51
51
  | `useLists`, `useList`, `useListsTelemetry`, `useListProgress`, `useListExecutions`, `useCreateList`, `useUpdateList`, `useUpdateListConfig`, `useDeleteList` | `@elevasis/ui/hooks` | Headless list and telemetry data access |
52
52
  | `useWorkflowExecution`, `useExecutionSSE`, `useAddCompaniesToList`, `useRemoveCompaniesFromList`, `useAddContactsToList` | `@elevasis/ui/hooks` | List Builder workflow triggering, live execution tailing, and list membership mutations |
@@ -64,12 +64,12 @@ Look for the **Lead Gen Platform Primitives** section. It includes list shapes,
64
64
 
65
65
  ## 1. Extend Lead-Gen Navigation or Sidebar
66
66
 
67
- For a simple nav addition, extend `LEAD_GEN_ITEMS` and override the lead-gen feature manifest:
67
+ For a simple nav addition, extend `LEAD_GEN_ITEMS` and override the lead-gen system manifest:
68
68
 
69
69
  ```tsx
70
70
  // ui/src/routes/__root.tsx
71
71
  import { leadGenManifest, LEAD_GEN_ITEMS, LeadGenSidebar, LeadGenSidebarMiddle } from '@elevasis/ui/features/lead-gen'
72
- import type { FeatureModule } from '@elevasis/ui/provider'
72
+ import type { SystemModule } from '@elevasis/ui/provider'
73
73
  import type { NavItem } from '@elevasis/ui/layout'
74
74
  import { IconChartBar } from '@tabler/icons-react'
75
75
 
@@ -84,13 +84,13 @@ const CustomLeadGenSidebar = () => (
84
84
  </LeadGenSidebar>
85
85
  )
86
86
 
87
- export const customLeadGenManifest: FeatureModule = {
87
+ export const customLeadGenManifest: SystemModule = {
88
88
  ...leadGenManifest,
89
89
  sidebar: CustomLeadGenSidebar
90
90
  }
91
91
  ```
92
92
 
93
- Then replace `leadGenManifest` with `customLeadGenManifest` in the local `FEATURE_MANIFESTS` array and add the matching route under `ui/src/routes/lead-gen/`.
93
+ Then replace `leadGenManifest` with `customLeadGenManifest` in the local `SYSTEM_MANIFESTS` array and add the matching route under `ui/src/routes/lead-gen/`.
94
94
 
95
95
  For structural changes, compose `LeadGenSidebarTop`, `SubshellNavList`, and `SubshellSidebarSection`. The full sidebar decision tree lives in `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md`.
96
96
 
@@ -153,9 +153,9 @@ function ListBuilderRoute() {
153
153
  }
154
154
  ```
155
155
 
156
- Register project workflow actions at the provider boundary. The shared UI owns the contract; each project owns workflow ids, capability keys, default inputs, and field components.
156
+ Register project workflow actions at the provider boundary. The shared UI owns the contract; each project owns workflow ids, action keys, default inputs, and field components.
157
157
 
158
- Each registry entry declares a Zod `schema` and a `layout` of declarative field hints (`StepConfigLayout<Input>`). The shared `StepConfigForm` renders the layout, validates against the schema, and wires `value`/`onChange` for you no per-action React components. The List Builder right column renders the form as `Configuration | Advanced | Runs` tabs with a sticky action footer; `RunWorkflowModal` renders the same form inline. Omit the `advanced:` section when a step has none.
158
+ Each registry entry declares a Zod `schema` and a `layout` of declarative field hints (`StepConfigLayout<Input>`). The shared `StepConfigForm` renders the layout, validates against the schema, and wires `value`/`onChange` for you — no per-action React components. The List Builder right column renders the form as `Configuration | Advanced | Runs` tabs with a sticky action footer; `RunWorkflowModal` renders the same form inline. Omit the `advanced:` section when a step has none.
159
159
 
160
160
  Available field component variants: `textinput`, `textarea`, `numberinput`, `switch`, `segmented`, `select`, `multiselect`, `tags`, `json`. Field hints support `label`, `description`, `placeholder`, `min`/`max`/`step` (numbers), `options` (selects), and `when: (values) => boolean` for conditional visibility.
161
161
 
@@ -213,7 +213,7 @@ const listActions: ListBuilderRegistry = [
213
213
  {
214
214
  resourceId: companyCleanupResource.id,
215
215
  workflowId: companyCleanupResource.id,
216
- capabilityKey: 'lead-gen.company.cleanup',
216
+ actionKey: 'lead-gen.company.cleanup',
217
217
  label: 'Company Cleanup',
218
218
  description: 'Normalize and clean company records for the list.',
219
219
  category: 'utility',
@@ -322,7 +322,6 @@ export const qualifyListWorkflow: WorkflowDefinition = {
322
322
  type: resourceDescriptors.qualifyList.kind,
323
323
  version: '1.0.0',
324
324
  status: 'dev',
325
- links: [{ nodeId: 'feature:sales.lead-gen', kind: 'operates-on' }]
326
325
  },
327
326
  contract: { inputSchema: qualifyListInputSchema, outputSchema: qualifyListOutputSchema },
328
327
  steps: {
@@ -370,7 +369,7 @@ Keep these boundaries straight:
370
369
 
371
370
  ## 5. Customize Lead-Gen Semantics
372
371
 
373
- The lead-gen shell feature key is `lead-gen`, the Organization OS feature id is `sales.lead-gen`, and the capability currently used by the shared manifest is `leadgen.lists.manage`.
372
+ The lead-gen shell module key is `lead-gen`, the Organization OS System id is `sales.lead-gen`, and the action currently used by the shared manifest is `leadgen.lists.manage`.
374
373
 
375
374
  For feature toggles, labels, lifecycle semantics, or resource descriptors, update the project model:
376
375
 
@@ -1,47 +1,48 @@
1
1
  ---
2
- title: Gate by Feature or Admin
3
- description: Decision table and recipes for gating routes, sidebar entries, and UI elements by Organization Model feature ID or admin role.
2
+ title: Gate by System or Admin
3
+ description: Decision table and recipes for gating routes, sidebar entries, and UI elements by Organization Model system ID or admin role.
4
4
  ---
5
5
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
6
  <!-- Regenerate: pnpm scaffold:sync -->
7
7
 
8
8
 
9
- # Gate by Feature or Admin
9
+ # Gate by System or Admin
10
10
 
11
- Feature visibility starts in `core/config/organization-model.ts`. Routes still enforce access with guards.
11
+ System visibility starts in `core/config/organization-model.ts`. Routes still enforce access with guards.
12
12
 
13
13
  ## Decide the gate
14
14
 
15
15
  | Scenario | Gate to use |
16
16
  | --- | --- |
17
- | Surface can be enabled or disabled per organization/member | `FeatureGuard` with the feature ID |
18
- | Surface is always available to members but restricted to admins | `AdminGuard` plus `requiresAdmin: true` on the feature node |
19
- | Surface is both feature-gated and admin-only | Both guards, plus `requiresAdmin: true` on the feature node |
17
+ | Surface can be enabled or disabled per organization/member | `SystemGuard` with the system ID |
18
+ | Surface is always available to members but restricted to admins | `AdminGuard` plus `requiresAdmin: true` on the system node |
19
+ | Surface is both system-gated and admin-only | Both guards, plus `requiresAdmin: true` on the system node |
20
20
 
21
- ## Feature gate in the org model
21
+ ## System gate in the org model
22
22
 
23
- Add or update the feature in `features`.
23
+ Add or update the system in the id-keyed `systems` map.
24
24
 
25
25
  ```ts
26
- features: [
27
- {
26
+ systems: {
27
+ analytics: {
28
28
  id: 'analytics',
29
+ order: 10,
29
30
  label: 'Analytics',
30
31
  enabled: false,
31
32
  path: '/analytics',
32
33
  icon: 'custom.analytics',
33
34
  uiPosition: 'sidebar-primary'
34
35
  }
35
- ]
36
+ }
36
37
  ```
37
38
 
38
- Set `enabled: true` to enable it for all members by default. Dotted IDs such as `analytics.reports` inherit feature state and shell placement from their ancestors unless they declare their own value.
39
+ Set `enabled: true` to enable it for all members by default. Dotted IDs such as `analytics.reports` inherit system state and shell placement from their ancestors unless they declare their own value.
39
40
 
40
- ## Route-level feature gate
41
+ ## Route-level system gate
41
42
 
42
43
  ```tsx
43
44
  import { ProtectedRoute } from '@/features/auth'
44
- import { FeatureGuard } from '@/features/auth/guards/FeatureGuard'
45
+ import { SystemGuard } from '@elevasis/ui/features/auth'
45
46
  import { createFileRoute, Outlet } from '@tanstack/react-router'
46
47
 
47
48
  export const Route = createFileRoute('/analytics')({ component: AnalyticsLayout })
@@ -49,15 +50,15 @@ export const Route = createFileRoute('/analytics')({ component: AnalyticsLayout
49
50
  function AnalyticsLayout() {
50
51
  return (
51
52
  <ProtectedRoute>
52
- <FeatureGuard featureKey="analytics">
53
+ <SystemGuard systemKey="analytics">
53
54
  <Outlet />
54
- </FeatureGuard>
55
+ </SystemGuard>
55
56
  </ProtectedRoute>
56
57
  )
57
58
  }
58
59
  ```
59
60
 
60
- The sidebar is derived from `OrganizationModel.features`; hiding a node there is display behavior only. Keep route guards in place for direct URL access.
61
+ The sidebar is derived from `OrganizationModel.systems`; hiding a node there is display behavior only. Keep route guards in place for direct URL access.
61
62
 
62
63
  ## Admin-only route
63
64
 
@@ -79,36 +80,39 @@ function AdminLayout() {
79
80
  }
80
81
  ```
81
82
 
82
- Pair the route guard with the feature node:
83
+ Pair the route guard with the system node:
83
84
 
84
85
  ```ts
85
- {
86
- id: 'admin',
87
- label: 'Admin',
88
- enabled: true,
89
- path: '/admin',
90
- uiPosition: 'sidebar-bottom',
91
- requiresAdmin: true
86
+ systems: {
87
+ admin: {
88
+ id: 'admin',
89
+ order: 10,
90
+ label: 'Admin',
91
+ enabled: true,
92
+ path: '/admin',
93
+ uiPosition: 'sidebar-bottom',
94
+ requiresAdmin: true
95
+ }
92
96
  }
93
97
  ```
94
98
 
95
99
  ## Per-member override
96
100
 
97
- `MembershipFeatureConfig.features` in `org_memberships.config` overrides enabled state per member.
101
+ Membership config overrides enabled state per member.
98
102
 
99
103
  ```ts
100
104
  {
101
- features: { analytics: false }
105
+ systems: { analytics: false }
102
106
  }
103
107
  ```
104
108
 
105
- Settings and admin-only pages should use admin checks, not per-member feature flags.
109
+ Settings and admin-only pages should use admin checks, not per-member system flags.
106
110
 
107
111
  ## Verify
108
112
 
109
113
  Check the state matrix:
110
114
 
111
- | Org feature enabled | Member override | Admin | Expected result |
115
+ | Org system enabled | Member override | Admin | Expected result |
112
116
  | --- | --- | --- | --- |
113
117
  | true | absent | any | Route accessible, sidebar visible |
114
118
  | true | false | any | Route redirects, sidebar hidden |
@@ -1,29 +1,29 @@
1
- ---
2
- title: Pathway Recipes
3
- description: Terse end-to-end walkthroughs for the three most common authoring tasks -- adding a feature, adding a resource, and gating access.
4
- ---
5
1
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
2
  <!-- Regenerate: pnpm scaffold:sync -->
7
3
 
4
+ ---
5
+ title: Pathway Recipes
6
+ description: Terse end-to-end walkthroughs for the three most common authoring tasks -- adding a system, adding a resource, and gating access.
7
+ ---
8
8
 
9
9
  # Pathway Recipes
10
10
 
11
11
  Three sequential walkthroughs for common authoring tasks. Each recipe links into the reference docs rather than duplicating them.
12
12
 
13
- Before starting, read [glossary.md](../reference/glossary.md) to disambiguate overloaded terms (Feature, Resource, featureId, Settings asymmetry, Topology).
13
+ Before starting, read [glossary.md](../reference/glossary.md) to disambiguate overloaded terms (System, Resource, systemId, Settings asymmetry, Topology).
14
14
 
15
15
  ---
16
16
 
17
17
  ## Recipes
18
18
 
19
- **[Add a Feature](add-a-feature.md)**
20
- You want a new shell feature (e.g., `analytics`) with its own nav entry, sidebar, routes, and org-model gate. Covers adding a feature object to the org model, `FeatureModule` manifest authoring, route creation, and gating.
19
+ **[Add a System](add-a-feature.md)**
20
+ You want a new shell system (e.g., `analytics`) with its own nav entry, sidebar, routes, and org-model gate. Covers adding a system object to the org model, `SystemModule` manifest authoring, route creation, and gating.
21
21
 
22
22
  **[Add a Resource](add-a-resource.md)**
23
23
  You want a new workflow or agent deployed to the platform. Covers OM Resource descriptor authoring, descriptor-backed `WorkflowDefinition` binding, `DeploymentSpec` assembly, relationship declarations, and CLI verification.
24
24
 
25
- **[Gate by Feature or Admin](gate-by-feature-or-admin.md)**
26
- You want to restrict a route, nav item, or UI element by feature flag or admin role. Covers the decision table, `FeatureGuard`, `AdminGuard`, nav-entry visibility fields, per-member `MembershipFeatureConfig` overrides, and the settings-asymmetry gotcha.
25
+ **[Gate by System or Admin](gate-by-feature-or-admin.md)**
26
+ You want to restrict a route, nav item, or UI element by system flag or admin role. Covers the decision table, `SystemGuard`, `AdminGuard`, nav-entry visibility fields, per-member system overrides, and the settings-asymmetry gotcha.
27
27
 
28
28
  **[Build and Extend CRM](extend-crm.md)**
29
29
  You want to build on the shared CRM without forking it: add CRM routes, compose sidebars/pages, use deal/company/contact hooks, mutate CRM data from workflows, or understand which contracts and adapters form the extension surface.
@@ -38,13 +38,14 @@ You want to add, hide, or replace CRM deal action buttons, configure the shared
38
38
  You want to mount, extend, or replace the default Knowledge Browser. Covers the three customization tiers (default manifest mount, sidebar composition via `KnowledgeSidebarMiddle` + `KNOWLEDGE_ITEMS`, and direct query access via `@elevasis/core/knowledge`), the one-line `vite.config.ts` plugin add (`knowledgePlugin()` from `@elevasis/ui/vite-plugin-knowledge`), and the CSS import requirement.
39
39
 
40
40
  **[Query the Knowledge Graph](query-the-knowledge-graph.md)**
41
- You want to browse, inspect, or traverse the OrganizationModel knowledge graph from the command line. Covers the three verbs (`knowledge:ls`, `knowledge:cat`, `knowledge:graph`), all five mount axes (`/by-feature/`, `/by-kind/`, `/by-owner/`, `/graph/.../governs/`, `/graph/.../governed-by/`), dual-CLI invocation patterns (`elevasis-sdk` for external projects, `elevasis` for the monorepo), and the Windows/MSYS PowerShell gotcha.
41
+ You want to browse, inspect, or traverse the OrganizationModel knowledge graph from the command line. Covers the three verbs (`knowledge:ls`, `knowledge:cat`, `knowledge:graph`), all five mount axes (`/by-system/`, `/by-kind/`, `/by-owner/`, `/graph/.../governs/`, `/graph/.../governed-by/`), dual-CLI invocation patterns (`elevasis-sdk` for external projects, `elevasis` for the monorepo), and the Windows/MSYS PowerShell gotcha.
42
42
 
43
43
  ---
44
44
 
45
45
  ## Reference docs these recipes link into
46
46
 
47
- - [glossary.md](../reference/glossary.md) -- term disambiguation for Feature, Resource, featureId, Topology, Settings asymmetry
48
- - [contracts.md](../reference/contracts.md) -- TypeScript shapes: `FeatureModule`, `FeatureNavEntry`, `OrganizationModel`, `MembershipFeatureConfig`, CRM deal types, lead-gen list/member/artifact types, `CrmToolMap`, `LeadToolMap`, `ListToolMap`, `ActionDef`
47
+ - [glossary.md](../reference/glossary.md) -- term disambiguation for System, Resource, systemId, Topology, Settings asymmetry
48
+ - [contracts.md](../reference/contracts.md) -- TypeScript shapes: `SystemModule`, `OrganizationModel`, CRM deal types, lead-gen list/member/artifact types, `CrmToolMap`, `LeadToolMap`, `ListToolMap`, `ActionDef`
49
49
  - [feature-flags-and-gating.md](../ui/feature-flags-and-gating.md) -- full three-concept gating model
50
50
  - [workflow-recipes.md](../operations/workflow-recipes.md) -- workflow anatomy, adapters, trigger patterns
51
+