@elevasis/sdk 1.10.0 → 1.12.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.
- package/dist/cli.cjs +52 -149
- package/dist/index.d.ts +468 -198
- package/dist/index.js +225 -147
- package/dist/test-utils/index.d.ts +272 -99
- package/dist/test-utils/index.js +4756 -125
- package/dist/types/worker/adapters/llm.d.ts +1 -1
- package/dist/worker/index.js +14 -6
- package/package.json +2 -2
- package/reference/claude-config/rules/agent-start-here.md +14 -14
- package/reference/claude-config/skills/configure/SKILL.md +3 -3
- package/reference/claude-config/skills/setup/SKILL.md +6 -6
- package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -0
- package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +101 -0
- package/reference/cli.mdx +57 -0
- package/reference/deployment/provided-features.mdx +40 -267
- package/reference/examples/organization-model.ts +99 -564
- package/reference/packages/core/src/organization-model/README.md +102 -97
- package/reference/resources/types.mdx +72 -163
- package/reference/scaffold/core/organization-graph.mdx +92 -272
- package/reference/scaffold/core/organization-model.mdx +155 -320
- package/reference/scaffold/index.mdx +3 -0
- package/reference/scaffold/operations/propagation-pipeline.md +4 -1
- package/reference/scaffold/operations/scaffold-maintenance.md +3 -0
- package/reference/scaffold/operations/workflow-recipes.md +13 -10
- package/reference/scaffold/recipes/add-a-feature.md +105 -158
- package/reference/scaffold/recipes/add-a-resource.md +88 -158
- package/reference/scaffold/recipes/customize-organization-model.md +144 -400
- package/reference/scaffold/recipes/extend-a-base-entity.md +11 -8
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +117 -158
- package/reference/scaffold/recipes/index.md +3 -0
- package/reference/scaffold/reference/contracts.md +107 -435
- package/reference/scaffold/reference/feature-registry.md +11 -8
- package/reference/scaffold/reference/glossary.md +74 -105
- package/reference/scaffold/ui/composition-extensibility.mdx +3 -0
- package/reference/scaffold/ui/customization.md +3 -0
- package/reference/scaffold/ui/feature-flags-and-gating.md +29 -231
- package/reference/scaffold/ui/feature-shell.mdx +53 -219
- package/reference/scaffold/ui/recipes.md +65 -397
- package/reference/claude-config/logs/pre-edit-vibe-gate.log +0 -40
- package/reference/claude-config/logs/scaffold-registry-reminder.log +0 -38
|
@@ -1,158 +1,105 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Add a Feature
|
|
3
|
-
description:
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Layout file (`ui/src/routes/analytics.tsx`) owns the subshell guard and renders `<Outlet />`:
|
|
107
|
-
|
|
108
|
-
```tsx
|
|
109
|
-
import { createFileRoute, Outlet } from '@tanstack/react-router'
|
|
110
|
-
import { ProtectedRoute } from '@/features/auth'
|
|
111
|
-
import { FeatureGuard } from '@/features/auth/guards/FeatureGuard'
|
|
112
|
-
|
|
113
|
-
export const Route = createFileRoute('/analytics')({
|
|
114
|
-
component: AnalyticsLayout
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
function AnalyticsLayout() {
|
|
118
|
-
return (
|
|
119
|
-
<ProtectedRoute>
|
|
120
|
-
<FeatureGuard featureKey="analytics">
|
|
121
|
-
<Outlet />
|
|
122
|
-
</FeatureGuard>
|
|
123
|
-
</ProtectedRoute>
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Child pages go under `ui/src/routes/analytics/`. See [UI Recipes](../ui/recipes.md) recipe 2 for the nested page pattern.
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## 5. Gate the route
|
|
133
|
-
|
|
134
|
-
Two independent mechanisms -- use both:
|
|
135
|
-
|
|
136
|
-
- `FeatureGuard` (feature-level): blocks access when the org model has the feature key disabled or when the member's `MembershipFeatureConfig` disables it. Always nest inside `ProtectedRoute`.
|
|
137
|
-
- `AdminGuard` (admin-level): blocks access for non-admin members. Add this if the feature should only be accessible to admins.
|
|
138
|
-
|
|
139
|
-
Full decision table and import paths are in [gate-by-feature-or-admin.md](gate-by-feature-or-admin.md).
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
## 6. (Optional) Add operations resources that back the feature
|
|
144
|
-
|
|
145
|
-
If the feature drives automation (e.g., an analytics pipeline workflow), create the resources in `operations/src/` and optionally map them into the org model via `resourceMappings`. See [add-a-resource.md](add-a-resource.md).
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## 7. Verify
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
pnpm -C ui dev
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
- Feature appears in the nav sidebar.
|
|
156
|
-
- Route is accessible and the subshell sidebar renders.
|
|
157
|
-
- Toggle `features.enabled.analytics` to `false` in `core/config/organization-model.ts` and confirm the nav item disappears and the route redirects.
|
|
158
|
-
- Check `FeatureGuard` by navigating directly to `/analytics` with the feature disabled.
|
|
1
|
+
---
|
|
2
|
+
title: Add a Feature
|
|
3
|
+
description: Add a shell feature using the flat Organization Model feature list, manifest registration, routes, and guards.
|
|
4
|
+
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Add a Feature
|
|
10
|
+
|
|
11
|
+
Shell navigation is derived from `OrganizationModel.features`. Feature manifests attach implementation details to those feature IDs; they do not declare sidebar nav structure.
|
|
12
|
+
|
|
13
|
+
## 1. Add the feature node
|
|
14
|
+
|
|
15
|
+
Edit `core/config/organization-model.ts` and add a feature to the `features` override.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
const organizationOverride = defineOrganizationModel({
|
|
19
|
+
features: [
|
|
20
|
+
{
|
|
21
|
+
id: 'analytics',
|
|
22
|
+
label: 'Analytics',
|
|
23
|
+
enabled: true,
|
|
24
|
+
path: '/analytics',
|
|
25
|
+
icon: 'chart',
|
|
26
|
+
uiPosition: 'sidebar-primary'
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
})
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Use dotted IDs for hierarchy:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
{ id: 'analytics', label: 'Analytics', enabled: true, uiPosition: 'sidebar-primary' },
|
|
36
|
+
{ id: 'analytics.reports', label: 'Reports', enabled: true, path: '/analytics/reports' }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Containers omit `path`; leaves provide `path`.
|
|
40
|
+
|
|
41
|
+
## 2. Add the manifest
|
|
42
|
+
|
|
43
|
+
Create `ui/src/features/analytics/manifest.ts`.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import type { FeatureModule } from '@elevasis/ui/provider'
|
|
47
|
+
import { IconChartBar } from '@tabler/icons-react'
|
|
48
|
+
import { AnalyticsSidebar } from './sidebar'
|
|
49
|
+
|
|
50
|
+
export const analyticsManifest: FeatureModule = {
|
|
51
|
+
key: 'analytics',
|
|
52
|
+
featureId: 'analytics',
|
|
53
|
+
icon: IconChartBar,
|
|
54
|
+
sidebar: AnalyticsSidebar
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Register it in the `FEATURE_MANIFESTS` array in `ui/src/routes/__root.tsx`.
|
|
59
|
+
|
|
60
|
+
## 3. Add routes
|
|
61
|
+
|
|
62
|
+
Create TanStack routes whose paths match the feature nodes.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { createFileRoute, Outlet } from '@tanstack/react-router'
|
|
66
|
+
import { ProtectedRoute, FeatureGuard } from '@elevasis/ui/features/auth'
|
|
67
|
+
|
|
68
|
+
export const Route = createFileRoute('/analytics')({
|
|
69
|
+
component: AnalyticsLayout
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
function AnalyticsLayout() {
|
|
73
|
+
return (
|
|
74
|
+
<ProtectedRoute>
|
|
75
|
+
<FeatureGuard featureKey="analytics">
|
|
76
|
+
<Outlet />
|
|
77
|
+
</FeatureGuard>
|
|
78
|
+
</ProtectedRoute>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 4. Add backing resources
|
|
84
|
+
|
|
85
|
+
For workflows or agents that power the feature, declare graph links on the resource metadata:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
config: {
|
|
89
|
+
resourceId: 'analytics-refresh',
|
|
90
|
+
name: 'Analytics Refresh',
|
|
91
|
+
type: 'workflow',
|
|
92
|
+
version: '1.0.0',
|
|
93
|
+
status: 'prod',
|
|
94
|
+
links: [{ nodeId: 'feature:analytics', kind: 'operates-on' }],
|
|
95
|
+
category: 'production'
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 5. Verify
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pnpm -C ui check-types
|
|
103
|
+
pnpm -C ui test
|
|
104
|
+
pnpm -C operations check
|
|
105
|
+
```
|
|
@@ -1,158 +1,88 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Add a Resource
|
|
3
|
-
description:
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
If the resource triggers another resource, uses a human checkpoint, or depends on an integration, declare those relationships on the `DeploymentSpec`. See [glossary.md](../reference/glossary.md) under **Topology** for the three edge types (`triggers`, `uses`, `approval`).
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
const org: DeploymentSpec = {
|
|
93
|
-
// ...
|
|
94
|
-
relationships: {
|
|
95
|
-
'my-workflow': {
|
|
96
|
-
triggers: { workflows: ['email-notification'] }
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
humanCheckpoints: [
|
|
100
|
-
{
|
|
101
|
-
resourceId: 'approval-gate',
|
|
102
|
-
name: 'Approve before sending',
|
|
103
|
-
type: 'human',
|
|
104
|
-
version: '1.0.0',
|
|
105
|
-
status: 'prod',
|
|
106
|
-
routesTo: { workflows: ['my-workflow'] }
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
Full relationship and checkpoint types are defined in `@elevasis/sdk` (`DeploymentSpec`). Resources are discovered live via `pnpm elevasis-sdk project:list` or by globbing `operations/resources/**` directly.
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## 4. (Optional) Map to a domain
|
|
117
|
-
|
|
118
|
-
To make the resource referenceable from the org model (so the Operations graph and Command View can link to it), add an entry to `resourceMappings` in `core/config/organization-model.ts`:
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
resourceMappings: [
|
|
122
|
-
{
|
|
123
|
-
id: 'my-workflow',
|
|
124
|
-
resourceId: 'my-workflow',
|
|
125
|
-
resourceType: 'workflow',
|
|
126
|
-
featureIds: ['operations'],
|
|
127
|
-
label: 'My Workflow'
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
See `OrganizationModelResourceMapping` in [contracts.md](../reference/contracts.md) for the full shape.
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## 5. Verify resource inventory
|
|
137
|
-
|
|
138
|
-
Resources are discovered live via `pnpm elevasis-sdk project:list` or by globbing `operations/resources/**` directly. Confirm the new resource appears with the correct `resourceId`, `version`, and `status`.
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## 6. Verify
|
|
143
|
-
|
|
144
|
-
Validate and deploy:
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
pnpm -C operations run check # validate resource definitions
|
|
148
|
-
pnpm -C operations run deploy # deploy to dev
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Execute via the platform CLI from the project root:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
pnpm exec elevasis describe Elevasis/my-workflow
|
|
155
|
-
pnpm exec elevasis exec Elevasis/my-workflow --input '{"field": "value"}'
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Use `--async` for long-running resources. Use `pnpm exec elevasis --prod exec ...` (flag before `exec`) for production. See [workflow-recipes.md](../operations/workflow-recipes.md) recipe 3 for the low-level frontend trigger pattern (`useApiClient` + `useMutation`). For the higher-level UI pattern using `RunResourceButton`, `useExecuteResource`, and `ZodFormRenderer`, see [../ui/recipes.md](../ui/recipes.md) recipe 6.
|
|
1
|
+
---
|
|
2
|
+
title: Add a Resource
|
|
3
|
+
description: Add a workflow or agent with resource metadata, graph links, and deployment verification.
|
|
4
|
+
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Add a Resource
|
|
10
|
+
|
|
11
|
+
Resources are workflows, agents, triggers, integrations, external systems, or human checkpoints collected in a `DeploymentSpec`. They link into the Organization Model graph through resource metadata, not through `OrganizationModel` mapping tables.
|
|
12
|
+
|
|
13
|
+
## 1. Author the resource
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import type { WorkflowDefinition } from '@elevasis/sdk'
|
|
17
|
+
|
|
18
|
+
export const myWorkflow: WorkflowDefinition = {
|
|
19
|
+
config: {
|
|
20
|
+
resourceId: 'my-workflow',
|
|
21
|
+
name: 'My Workflow',
|
|
22
|
+
type: 'workflow',
|
|
23
|
+
version: '1.0.0',
|
|
24
|
+
status: 'dev',
|
|
25
|
+
links: [{ nodeId: 'feature:operations', kind: 'operates-on' }],
|
|
26
|
+
category: 'production'
|
|
27
|
+
},
|
|
28
|
+
contract: {
|
|
29
|
+
inputSchema,
|
|
30
|
+
outputSchema
|
|
31
|
+
},
|
|
32
|
+
steps: {
|
|
33
|
+
run: {
|
|
34
|
+
id: 'run',
|
|
35
|
+
name: 'Run',
|
|
36
|
+
handler: async (_input, context) => {
|
|
37
|
+
context.logger.info('[my-workflow] starting')
|
|
38
|
+
return { ok: true }
|
|
39
|
+
},
|
|
40
|
+
inputSchema,
|
|
41
|
+
outputSchema,
|
|
42
|
+
next: null
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
entryPoint: 'run'
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`links[].nodeId` uses the kind-prefixed graph grammar, such as `feature:sales.crm`, `integration:instantly`, or `capability:operations.queue.review`.
|
|
50
|
+
|
|
51
|
+
`category` is one of `production`, `diagnostic`, `internal`, or `testing`.
|
|
52
|
+
|
|
53
|
+
## 2. Register in the deployment spec
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { myWorkflow } from './my-workflow/index.js'
|
|
57
|
+
|
|
58
|
+
export const org = {
|
|
59
|
+
version: '0.1.0',
|
|
60
|
+
workflows: [myWorkflow],
|
|
61
|
+
agents: []
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Use `.js` extensions in TypeScript source imports for ESM compatibility.
|
|
66
|
+
|
|
67
|
+
## 3. Declare runtime relationships
|
|
68
|
+
|
|
69
|
+
Use `DeploymentSpec.relationships` for execution topology:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
relationships: {
|
|
73
|
+
'my-workflow': {
|
|
74
|
+
triggers: { workflows: ['email-notification'] },
|
|
75
|
+
uses: { integrations: ['hubspot'] }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Use `config.links` for semantic graph binding and `relationships` for runtime execution relationships.
|
|
81
|
+
|
|
82
|
+
## 4. Verify
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pnpm -C operations check
|
|
86
|
+
pnpm -C operations deploy
|
|
87
|
+
pnpm exec elevasis describe Elevasis/my-workflow
|
|
88
|
+
```
|