@elevasis/sdk 1.11.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 +31 -8
- package/dist/index.d.ts +345 -48
- package/dist/index.js +210 -8
- package/dist/test-utils/index.d.ts +216 -40
- package/dist/test-utils/index.js +4756 -125
- package/dist/types/worker/adapters/llm.d.ts +1 -1
- package/dist/worker/index.js +10 -4
- 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/examples/organization-model.ts +3 -0
- package/reference/packages/core/src/organization-model/README.md +1 -0
- package/reference/scaffold/core/organization-graph.mdx +5 -2
- package/reference/scaffold/core/organization-model.mdx +6 -0
- 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 +3 -0
- package/reference/scaffold/recipes/add-a-resource.md +3 -0
- package/reference/scaffold/recipes/customize-organization-model.md +3 -0
- package/reference/scaffold/recipes/extend-a-base-entity.md +11 -8
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +3 -0
- package/reference/scaffold/recipes/index.md +3 -0
- package/reference/scaffold/reference/contracts.md +62 -304
- package/reference/scaffold/reference/feature-registry.md +5 -2
- package/reference/scaffold/reference/glossary.md +3 -0
- 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 +3 -0
- package/reference/scaffold/ui/feature-shell.mdx +3 -0
- package/reference/scaffold/ui/recipes.md +3 -0
- package/reference/claude-config/logs/pre-edit-vibe-gate.log +0 -40
- package/reference/claude-config/logs/scaffold-registry-reminder.log +0 -38
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
title: Workflow Recipes
|
|
3
3
|
description: Anatomy of a workflow, adapter usage, and trigger patterns -- runnable email-notification example replaces the trivial echo workflow. Resolves eval score 2/5 on workflow authoring.
|
|
4
4
|
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
# Workflow Recipes
|
|
7
10
|
|
|
@@ -32,7 +35,7 @@ config: {
|
|
|
32
35
|
### Contract
|
|
33
36
|
|
|
34
37
|
```typescript
|
|
35
|
-
//
|
|
38
|
+
// core/types/index.ts -- shared with frontend
|
|
36
39
|
export const emailNotificationInputSchema = z.object({
|
|
37
40
|
recipientEmail: z.string().email(),
|
|
38
41
|
recipientName: z.string().min(1),
|
|
@@ -54,7 +57,7 @@ export type EmailNotificationOutput = z.infer<typeof emailNotificationOutputSche
|
|
|
54
57
|
|
|
55
58
|
```typescript
|
|
56
59
|
// operations/src/email-notification/index.ts
|
|
57
|
-
import { emailNotificationInputSchema, emailNotificationOutputSchema } from '@
|
|
60
|
+
import { emailNotificationInputSchema, emailNotificationOutputSchema } from '@core/types'
|
|
58
61
|
|
|
59
62
|
contract: {
|
|
60
63
|
inputSchema: emailNotificationInputSchema,
|
|
@@ -64,16 +67,16 @@ contract: {
|
|
|
64
67
|
|
|
65
68
|
**Rules:**
|
|
66
69
|
|
|
67
|
-
- Define schemas in `
|
|
68
|
-
- Both runtimes (frontend and platform) import from `@
|
|
69
|
-
- `@
|
|
70
|
+
- Define schemas in `core/types/index.ts` -- never inline Zod schemas in workflow files.
|
|
71
|
+
- Both runtimes (frontend and platform) import from `@core/types`, keeping validation consistent.
|
|
72
|
+
- `@core/types` resolves to `core/types/index.ts` via the tsconfig path alias.
|
|
70
73
|
|
|
71
74
|
**Entity-backed workflows:** for workflows that operate on a domain entity, reference the entity contract rather than redeclaring it.
|
|
72
75
|
|
|
73
76
|
```typescript
|
|
74
|
-
//
|
|
77
|
+
// core/types/index.ts
|
|
75
78
|
import { BaseDealSchema } from '@elevasis/core/entities'
|
|
76
|
-
import { DealSchema } from '@
|
|
79
|
+
import { DealSchema } from '@core/types/entities' // project-local extended version
|
|
77
80
|
|
|
78
81
|
export const closeDealInputSchema = z.object({
|
|
79
82
|
deal: DealSchema,
|
|
@@ -83,7 +86,7 @@ export const closeDealInputSchema = z.object({
|
|
|
83
86
|
export type CloseDealInput = z.infer<typeof closeDealInputSchema>
|
|
84
87
|
```
|
|
85
88
|
|
|
86
|
-
`DealSchema` is defined in `
|
|
89
|
+
`DealSchema` is defined in `core/types/entities.ts` by extending `BaseDealSchema` with project-specific metadata. See [../recipes/extend-a-base-entity.md](../recipes/extend-a-base-entity.md) for the pattern.
|
|
87
90
|
|
|
88
91
|
### Steps
|
|
89
92
|
|
|
@@ -291,7 +294,7 @@ Use this pattern in React components and hooks. `apiRequest` automatically attac
|
|
|
291
294
|
// ui/src/features/notifications/hooks/useSendEmailNotification.ts
|
|
292
295
|
import { useMutation } from '@tanstack/react-query'
|
|
293
296
|
import { useApiClient } from '@/lib/hooks/useApiClient'
|
|
294
|
-
import type { EmailNotificationInput, EmailNotificationOutput } from '@
|
|
297
|
+
import type { EmailNotificationInput, EmailNotificationOutput } from '@core/types'
|
|
295
298
|
|
|
296
299
|
export function useSendEmailNotification() {
|
|
297
300
|
const { apiRequest } = useApiClient()
|
|
@@ -457,7 +460,7 @@ Use `runWorkflow` for project-owned workflows. This tests the workflow contract,
|
|
|
457
460
|
import { describe, expect, it } from 'vitest'
|
|
458
461
|
import { runWorkflow, mockNotifications } from '@elevasis/sdk/test-utils'
|
|
459
462
|
import { emailNotification } from './index'
|
|
460
|
-
import type { EmailNotificationOutput } from '@
|
|
463
|
+
import type { EmailNotificationOutput } from '@core/types'
|
|
461
464
|
|
|
462
465
|
describe('emailNotification workflow', () => {
|
|
463
466
|
it('runs the notify step with a mocked notification adapter', async () => {
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
title: Add a Feature
|
|
3
3
|
description: Add a shell feature using the flat Organization Model feature list, manifest registration, routes, and guards.
|
|
4
4
|
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
# Add a Feature
|
|
7
10
|
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
title: Add a Resource
|
|
3
3
|
description: Add a workflow or agent with resource metadata, graph links, and deployment verification.
|
|
4
4
|
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
# Add a Resource
|
|
7
10
|
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
title: Customize organization-model.ts
|
|
3
3
|
description: Annotated walkthrough for customizing the flat Organization Model in template-derived projects.
|
|
4
4
|
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
# Customize organization-model.ts
|
|
7
10
|
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
title: Extend a Base Entity
|
|
3
3
|
description: Add project-specific metadata to the canonical entity shapes (Project, Deal, Company, etc.) from @elevasis/core/entities using the TMeta extension slot.
|
|
4
4
|
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
# Extend a Base Entity
|
|
7
10
|
|
|
8
11
|
Workflows and UI features often operate on domain entities such as projects, deals, companies, or contacts. Rather than each project declaring its own shape from scratch, `@elevasis/core/entities` provides typed base interfaces generic over a `<TMeta>` slot. External projects extend these to add project-specific fields while keeping the canonical shape stable and interoperable with platform tooling.
|
|
9
12
|
|
|
10
|
-
The canonical demo lives in `
|
|
13
|
+
The canonical demo lives in `core/types/entities.ts` of any scaffold project.
|
|
11
14
|
|
|
12
15
|
---
|
|
13
16
|
|
|
@@ -30,7 +33,7 @@ All imports come from `@elevasis/core/entities`.
|
|
|
30
33
|
|
|
31
34
|
## Recipe 1 -- Extend a base entity with custom metadata
|
|
32
35
|
|
|
33
|
-
Place this in `
|
|
36
|
+
Place this in `core/types/entities.ts`. This is the primary pattern -- the scaffold template ships this exact example.
|
|
34
37
|
|
|
35
38
|
```ts
|
|
36
39
|
import { z } from 'zod'
|
|
@@ -56,7 +59,7 @@ Key points:
|
|
|
56
59
|
- `BaseProjectSchema.extend({ metadata: ... })` merges your metadata Zod schema into the validated shape. Zod handles the rest.
|
|
57
60
|
- `BaseProject<ProjectMeta>` infers the TypeScript type with your metadata typed correctly.
|
|
58
61
|
- Only the `metadata` field is extended -- all other base fields (`id`, `organizationId`, `name`, `status`, `createdAt`, `updatedAt`, etc.) are inherited unchanged.
|
|
59
|
-
- This file is the single source of truth for entity shapes across `
|
|
62
|
+
- This file is the single source of truth for entity shapes across `core/`, `operations/`, and `ui/`.
|
|
60
63
|
|
|
61
64
|
---
|
|
62
65
|
|
|
@@ -84,7 +87,7 @@ Workflows that operate on projects or deals should reference the project-local e
|
|
|
84
87
|
```ts
|
|
85
88
|
import { z } from 'zod'
|
|
86
89
|
import type { WorkflowDefinition } from '@elevasis/sdk'
|
|
87
|
-
import { ProjectSchema } from '@
|
|
90
|
+
import { ProjectSchema } from '@core/types/entities'
|
|
88
91
|
|
|
89
92
|
export const myWorkflow: WorkflowDefinition = {
|
|
90
93
|
id: 'my-workflow',
|
|
@@ -96,16 +99,16 @@ export const myWorkflow: WorkflowDefinition = {
|
|
|
96
99
|
}
|
|
97
100
|
```
|
|
98
101
|
|
|
99
|
-
The `@
|
|
102
|
+
The `@core/*` alias maps to the `core/` workspace package. This keeps entity contracts in one place and ensures the workflow input type matches whatever the UI passes as the execution payload.
|
|
100
103
|
|
|
101
104
|
---
|
|
102
105
|
|
|
103
106
|
## Recipe 4 -- Reference entity types from the UI
|
|
104
107
|
|
|
105
|
-
UI components accept entity types directly in props. The entity type flows from the `
|
|
108
|
+
UI components accept entity types directly in props. The entity type flows from the `core` package through the component into the workflow execution payload:
|
|
106
109
|
|
|
107
110
|
```tsx
|
|
108
|
-
import type { Project } from '@
|
|
111
|
+
import type { Project } from '@core/types/entities'
|
|
109
112
|
|
|
110
113
|
interface ProjectCardProps {
|
|
111
114
|
project: Project
|
|
@@ -127,7 +130,7 @@ When wiring this to a `RunResourceButton`, the entity instance becomes the workf
|
|
|
127
130
|
|
|
128
131
|
## Verification
|
|
129
132
|
|
|
130
|
-
- **
|
|
133
|
+
- **Test core contracts:** `pnpm -C core test` runs the Vitest suite. The template ships `core/types/entities.test.ts` as a working smoke-check -- it `safeParse`s a valid project (expects success) and an invalid one (expects failure). Run this after any schema change.
|
|
131
134
|
- **Round-trip safeParse:** Call `ProjectSchema.safeParse(candidateObject)` in a test or REPL to confirm the Zod shape accepts the data your workflows and UI will produce.
|
|
132
135
|
- **Cross-package type check:** `pnpm -C ui build` will surface any TypeScript errors if a UI component or hook passes a mismatched entity type to a workflow input.
|
|
133
136
|
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
title: Gate by Feature or Admin
|
|
3
3
|
description: Decision table and recipes for gating routes, sidebar entries, and UI elements by Organization Model feature ID or admin role.
|
|
4
4
|
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
# Gate by Feature or Admin
|
|
7
10
|
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
title: Pathway Recipes
|
|
3
3
|
description: Terse end-to-end walkthroughs for the three most common authoring tasks -- adding a feature, adding a resource, and gating access.
|
|
4
4
|
---
|
|
5
|
+
<!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
|
|
6
|
+
<!-- Regenerate: pnpm scaffold:sync -->
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
# Pathway Recipes
|
|
7
10
|
|