@elevasis/sdk 1.39.0 → 1.41.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.
@@ -1,52 +1,52 @@
1
- # Entities
2
-
3
- Published base entity contracts for the Elevasis platform. Each entity ships as a TypeScript interface, a matching Zod schema, and an inferred `Input` type, generic over a `<TMeta>` extension slot.
4
-
5
- External projects extend these in `core/types/entities.ts` to attach project-specific metadata while keeping the canonical shape stable.
6
-
7
- ## Published Exports
8
-
9
- The published entry point exposes six entity contracts:
10
-
11
- - `BaseProject<TMeta>`, `BaseProjectSchema`, `BaseProjectInput`
12
- - `BaseMilestone<TMeta>`, `BaseMilestoneSchema`, `BaseMilestoneInput`
13
- - `BaseTask<TMeta>`, `BaseTaskSchema`, `BaseTaskInput`
14
- - `BaseDeal<TMeta>`, `BaseDealSchema`, `BaseDealInput`
15
- - `BaseCompany<TMeta>`, `BaseCompanySchema`, `BaseCompanyInput`
16
- - `BaseContact<TMeta>`, `BaseContactSchema`, `BaseContactInput`
17
-
18
- Import them from the published subpath:
19
-
20
- ```ts
21
- import { BaseDealSchema, type BaseDeal } from '@elevasis/core/entities'
22
- ```
23
-
24
- ## Extension Pattern
25
-
26
- Each base interface accepts a generic metadata type. Extend the schema with `.extend({ metadata: ... })` and infer the type with `BaseProject<z.infer<typeof MetaSchema>>`.
27
-
28
- ```ts
29
- import { z } from 'zod'
30
- import { BaseProjectSchema, type BaseProject } from '@elevasis/core/entities'
31
-
32
- const ProjectMetaSchema = z.object({
33
- budget: z.number().int().nonnegative(),
34
- clientPriority: z.enum(['low', 'medium', 'high'])
35
- })
36
-
37
- export const ProjectSchema = BaseProjectSchema.extend({ metadata: ProjectMetaSchema })
38
- export type Project = BaseProject<z.infer<typeof ProjectMetaSchema>>
39
- ```
40
-
41
- Use the base shape as-is when no extension is needed:
42
-
43
- ```ts
44
- export const DealSchema = BaseDealSchema
45
- export type Deal = BaseDeal
46
- ```
47
-
48
- ## Recipe
49
-
50
- The full pattern is documented in the SDK scaffold bundle: `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-a-base-entity.md`.
51
-
52
- The canonical template demo lives at `external/_template/core/types/entities.ts`.
1
+ # Entities
2
+
3
+ Published base entity contracts for the Elevasis platform. Each entity ships as a TypeScript interface, a matching Zod schema, and an inferred `Input` type, generic over a `<TMeta>` extension slot.
4
+
5
+ External projects extend these in `core/types/entities.ts` to attach project-specific metadata while keeping the canonical shape stable.
6
+
7
+ ## Published Exports
8
+
9
+ The published entry point exposes six entity contracts:
10
+
11
+ - `BaseProject<TMeta>`, `BaseProjectSchema`, `BaseProjectInput`
12
+ - `BaseMilestone<TMeta>`, `BaseMilestoneSchema`, `BaseMilestoneInput`
13
+ - `BaseTask<TMeta>`, `BaseTaskSchema`, `BaseTaskInput`
14
+ - `BaseDeal<TMeta>`, `BaseDealSchema`, `BaseDealInput`
15
+ - `BaseCompany<TMeta>`, `BaseCompanySchema`, `BaseCompanyInput`
16
+ - `BaseContact<TMeta>`, `BaseContactSchema`, `BaseContactInput`
17
+
18
+ Import them from the published subpath:
19
+
20
+ ```ts
21
+ import { BaseDealSchema, type BaseDeal } from '@elevasis/core/entities'
22
+ ```
23
+
24
+ ## Extension Pattern
25
+
26
+ Each base interface accepts a generic metadata type. Extend the schema with `.extend({ metadata: ... })` and infer the type with `BaseProject<z.infer<typeof MetaSchema>>`.
27
+
28
+ ```ts
29
+ import { z } from 'zod'
30
+ import { BaseProjectSchema, type BaseProject } from '@elevasis/core/entities'
31
+
32
+ const ProjectMetaSchema = z.object({
33
+ budget: z.number().int().nonnegative(),
34
+ clientPriority: z.enum(['low', 'medium', 'high'])
35
+ })
36
+
37
+ export const ProjectSchema = BaseProjectSchema.extend({ metadata: ProjectMetaSchema })
38
+ export type Project = BaseProject<z.infer<typeof ProjectMetaSchema>>
39
+ ```
40
+
41
+ Use the base shape as-is when no extension is needed:
42
+
43
+ ```ts
44
+ export const DealSchema = BaseDealSchema
45
+ export type Deal = BaseDeal
46
+ ```
47
+
48
+ ## Recipe
49
+
50
+ The full pattern is documented in the SDK scaffold bundle: `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-a-base-entity.md`.
51
+
52
+ The canonical template demo lives at `external/_template/core/types/entities.ts`.
@@ -12,7 +12,7 @@ paths:
12
12
  ## Safety Invariants
13
13
 
14
14
  - `ElevasisUIProvider` in `ui/src/main.tsx` auto-composes shared UI, auth, and API surface -- route files do not wire providers manually
15
- - `useApiClient()` from `@/lib/hooks/useApiClient` for authenticated API calls -- never raw `fetch` with auth headers
15
+ - `useApiClient()` from `@elevasis/ui/api` for authenticated API calls, passing `API_URL` from `@/lib/constants/api` -- never raw `fetch` with auth headers. There is no `ui/src/lib/hooks/` directory; see `ui.md` "API and Streaming"
16
16
  - `routeTree.gen.ts` is auto-generated on `pnpm dev` -- never edit manually
17
17
  - Auth protection: wrap page content with `ProtectedRoute` from `@elevasis/ui/auth`. Admin pages nest `AdminGuard` inside `ProtectedRoute`
18
18
  - Never fork `@elevasis/ui` components -- if a published component needs a tweak, that missing capability is a bug in `@elevasis/ui`
@@ -36,5 +36,5 @@ This project's own org-model and workflows live in `core/config/organization-mod
36
36
 
37
37
  ## References
38
38
 
39
- - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` — full SDK scaffold reference
39
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` — full SDK scaffold reference
40
40
  - Monorepo source rule: `.claude/rules/package-taxonomy.md` in the elevasis-monorepo (when working across both)
@@ -39,7 +39,7 @@ paths:
39
39
 
40
40
  ## Detailed Reference
41
41
 
42
- - `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- workflow anatomy, adapter patterns, trigger patterns
43
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md` -- end-to-end resource authoring guide
44
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- lead-gen UI, hooks, list/member state, artifacts, and workflow adapter extension guide
42
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- workflow anatomy, adapter patterns, trigger patterns
43
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md` -- end-to-end resource authoring guide
44
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- lead-gen UI, hooks, list/member state, artifacts, and workflow adapter extension guide
45
45
  - SDK reference docs: `operations/node_modules/@elevasis/sdk/reference/` (concepts, framework, platform-tools, runtime, CLI)
@@ -1,63 +1,63 @@
1
- ---
2
- title: Scaffold Maintenance
3
- description: How scaffold documentation is organized, generated, and bundled into the SDK -- content placement map, auto-generation pipeline, and instructions for adding new scaffold docs.
4
- ---
1
+ ---
2
+ title: Scaffold Maintenance
3
+ description: How scaffold documentation is organized, generated, and bundled into the SDK -- content placement map, auto-generation pipeline, and instructions for adding new scaffold docs.
4
+ ---
5
5
  <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
6
6
  <!-- Regenerate: pnpm scaffold:sync -->
7
7
 
8
-
9
- # Scaffold Maintenance
10
-
11
- `🟢 Stable` -- Use this when adding or modifying scaffold documentation.
12
-
13
- ---
14
-
15
- ## Content Placement Model
16
-
17
- Scaffold docs are co-located with their owning package and copied into the SDK reference at build time. This makes each package owner responsible for their docs and avoids a single monolithic directory.
18
-
19
- ### Placement Rules
20
-
21
- - If a doc explains a single abstraction boundary, **co-locate it** with the owning package.
22
- - If a doc explains relationships between multiple abstractions, **centralize it** in `packages/sdk/docs/scaffold/`.
23
- - If a doc can be derived from code or manifests, **generate it**.
24
- - Hand-authored docs should point to generated maps rather than restating them.
25
-
26
- ### Source-to-Destination Map
27
-
28
- | Content | Source | SDK Reference Destination |
29
- | --------------------------- | --------------------------------------------------------------- | --------------------------------------------- |
30
- | Organization Model | `packages/core/src/organization-model/organization-model.mdx` | `scaffold/core/organization-model.mdx` |
31
- | Organization Graph | `packages/core/src/organization-model/organization-graph.mdx` | `scaffold/core/organization-graph.mdx` |
8
+
9
+ # Scaffold Maintenance
10
+
11
+ `🟢 Stable` -- Use this when adding or modifying scaffold documentation.
12
+
13
+ ---
14
+
15
+ ## Content Placement Model
16
+
17
+ Scaffold docs are co-located with their owning package and copied into the SDK reference at build time. This makes each package owner responsible for their docs and avoids a single monolithic directory.
18
+
19
+ ### Placement Rules
20
+
21
+ - If a doc explains a single abstraction boundary, **co-locate it** with the owning package.
22
+ - If a doc explains relationships between multiple abstractions, **centralize it** in `packages/sdk/docs/scaffold/`.
23
+ - If a doc can be derived from code or manifests, **generate it**.
24
+ - Hand-authored docs should point to generated maps rather than restating them.
25
+
26
+ ### Source-to-Destination Map
27
+
28
+ | Content | Source | SDK Reference Destination |
29
+ | --------------------------- | --------------------------------------------------------------- | --------------------------------------------- |
30
+ | Organization Model | `packages/core/src/organization-model/organization-model.mdx` | `scaffold/core/organization-model.mdx` |
31
+ | Organization Graph | `packages/core/src/organization-model/organization-graph.mdx` | `scaffold/core/organization-graph.mdx` |
32
32
  | Glossary | `packages/core/src/reference/glossary.md` | `scaffold/reference/glossary.md` |
33
33
  | Contracts (auto-gen) | `packages/core/src/reference/_generated/contracts.md` | `scaffold/reference/contracts.md` |
34
34
  | System Interface Capabilities (auto-gen) | `packages/core/src/reference/_generated/system-interface-capabilities.md` | `scaffold/reference/system-interface-capabilities.md` |
35
35
  | UI Recipes | `packages/ui/src/scaffold/recipes.md` | `scaffold/ui/recipes.md` |
36
- | System Flags & Gating | `packages/ui/src/scaffold/feature-flags-and-gating.md` | `scaffold/ui/feature-flags-and-gating.md` |
37
- | Customization | `packages/ui/src/scaffold/customization.md` | `scaffold/ui/customization.md` |
38
- | System Shell | `packages/ui/src/scaffold/feature-shell.mdx` | `scaffold/ui/feature-shell.mdx` |
39
- | Composition & Extensibility | `packages/ui/src/scaffold/composition-extensibility.mdx` | `scaffold/ui/composition-extensibility.mdx` |
40
- | System Registry (auto-gen) | `packages/ui/src/scaffold/_generated/feature-registry.md` | `scaffold/reference/feature-registry.md` |
41
- | Scaffold Index | `packages/sdk/docs/scaffold/index.mdx` | `scaffold/index.mdx` |
42
- | Pathway Recipes | `packages/sdk/docs/scaffold/recipes/` | `scaffold/recipes/` |
43
- | Workflow Recipes | `packages/sdk/docs/scaffold/operations/workflow-recipes.md` | `scaffold/operations/workflow-recipes.md` |
44
- | Propagation Pipeline | `packages/sdk/docs/scaffold/operations/propagation-pipeline.md` | `scaffold/operations/propagation-pipeline.md` |
45
- | This doc | `packages/sdk/docs/scaffold/operations/scaffold-maintenance.md` | `scaffold/operations/scaffold-maintenance.md` |
46
-
47
- ---
48
-
49
- ## Auto-Generation Pipeline
50
-
51
- Two types of docs are auto-generated from source:
52
-
53
- ### Contracts (`contracts.md`)
54
-
55
- Generated by `scripts/monorepo/generate-scaffold-contracts.js` from TypeScript source types:
56
-
57
- - `packages/core/src/organization-model/types.ts` -- Organization Model, System Model
58
- - `packages/ui/src/features/registry/types.ts` -- System Registry
59
- - `packages/core/src/platform/registry/types.ts` -- Resource Registry, Deployment Spec
60
-
36
+ | System Flags & Gating | `packages/ui/src/scaffold/feature-flags-and-gating.md` | `scaffold/ui/feature-flags-and-gating.md` |
37
+ | Customization | `packages/ui/src/scaffold/customization.md` | `scaffold/ui/customization.md` |
38
+ | System Shell | `packages/ui/src/scaffold/feature-shell.mdx` | `scaffold/ui/feature-shell.mdx` |
39
+ | Composition & Extensibility | `packages/ui/src/scaffold/composition-extensibility.mdx` | `scaffold/ui/composition-extensibility.mdx` |
40
+ | System Registry (auto-gen) | `packages/ui/src/scaffold/_generated/feature-registry.md` | `scaffold/reference/feature-registry.md` |
41
+ | Scaffold Index | `packages/sdk/docs/scaffold/index.mdx` | `scaffold/index.mdx` |
42
+ | Pathway Recipes | `packages/sdk/docs/scaffold/recipes/` | `scaffold/recipes/` |
43
+ | Workflow Recipes | `packages/sdk/docs/scaffold/operations/workflow-recipes.md` | `scaffold/operations/workflow-recipes.md` |
44
+ | Propagation Pipeline | `packages/sdk/docs/scaffold/operations/propagation-pipeline.md` | `scaffold/operations/propagation-pipeline.md` |
45
+ | This doc | `packages/sdk/docs/scaffold/operations/scaffold-maintenance.md` | `scaffold/operations/scaffold-maintenance.md` |
46
+
47
+ ---
48
+
49
+ ## Auto-Generation Pipeline
50
+
51
+ Two types of docs are auto-generated from source:
52
+
53
+ ### Contracts (`contracts.md`)
54
+
55
+ Generated by `scripts/monorepo/generate-scaffold-contracts.js` from TypeScript source types:
56
+
57
+ - `packages/core/src/organization-model/types.ts` -- Organization Model, System Model
58
+ - `packages/ui/src/features/registry/types.ts` -- System Registry
59
+ - `packages/core/src/platform/registry/types.ts` -- Resource Registry, Deployment Spec
60
+
61
61
  Output: `packages/core/src/reference/_generated/contracts.md`
62
62
 
63
63
  ### System Interface Capabilities (`system-interface-capabilities.md`)
@@ -68,37 +68,37 @@ Generated by `scripts/monorepo/generate-scaffold-contracts.js` from:
68
68
  - `packages/core/src/business/acquisition/ontology-validation.ts` -- derived-readiness validation constants and checks
69
69
 
70
70
  Output: `packages/core/src/reference/_generated/system-interface-capabilities.md`
71
-
72
- ### System Registry (`feature-registry.md`)
73
-
74
- Generated by `scripts/monorepo/generate-scaffold-feature-registry.js` from system manifests:
75
-
76
- - `packages/ui/src/features/*/manifest.ts` -- individual system manifests
77
- - `packages/ui/src/features/registry/manifests.ts` -- `SYSTEM_MANIFESTS`
78
-
79
- Output: `packages/ui/src/scaffold/_generated/feature-registry.md`
80
-
81
- ### Reference Artifacts
82
-
83
- Generated by `scripts/monorepo/generate-reference-artifacts.js`:
84
-
85
- - `packages/sdk/reference/_reference-manifest.json` -- machine-readable catalog of all reference entries
86
- - `packages/sdk/reference/_navigation.md` -- navigation table
87
-
88
- ### Running Generators
89
-
90
- ```bash
91
- pnpm scaffold:generate # Run both generators
92
- pnpm scaffold:sync # Generate + validate (the full loop)
93
- pnpm sdk-ref:generate # Reference artifacts only
94
- ```
95
-
96
- Generated files should never be edited manually. If the output is wrong, fix the source types or the generator script.
97
-
98
- ---
99
-
100
- ## SDK Build Pipeline (Reference Copy)
101
-
71
+
72
+ ### System Registry (`feature-registry.md`)
73
+
74
+ Generated by `scripts/monorepo/generate-scaffold-feature-registry.js` from system manifests:
75
+
76
+ - `packages/ui/src/features/*/manifest.ts` -- individual system manifests
77
+ - `packages/ui/src/features/registry/manifests.ts` -- `SYSTEM_MANIFESTS`
78
+
79
+ Output: `packages/ui/src/scaffold/_generated/feature-registry.md`
80
+
81
+ ### Reference Artifacts
82
+
83
+ Generated by `scripts/monorepo/generate-reference-artifacts.js`:
84
+
85
+ - `packages/sdk/reference/_reference-manifest.json` -- machine-readable catalog of all reference entries
86
+ - `packages/sdk/reference/_navigation.md` -- navigation table
87
+
88
+ ### Running Generators
89
+
90
+ ```bash
91
+ pnpm scaffold:generate # Run both generators
92
+ pnpm scaffold:sync # Generate + validate (the full loop)
93
+ pnpm sdk-ref:generate # Reference artifacts only
94
+ ```
95
+
96
+ Generated files should never be edited manually. If the output is wrong, fix the source types or the generator script.
97
+
98
+ ---
99
+
100
+ ## SDK Build Pipeline (Reference Copy)
101
+
102
102
  `packages/sdk/scripts/copy-reference-docs.mjs` runs during `pnpm --filter @elevasis/sdk build` and has four phases:
103
103
 
104
104
  1. **Phase 1:** Copies SDK public docs from `apps/docs/content/docs/sdk/` with link rewriting and MDX escape stripping
@@ -106,31 +106,31 @@ Generated files should never be edited manually. If the output is wrong, fix the
106
106
  3. **Phase 3:** Copies scaffold docs from co-located package sources using the `SCAFFOLD_COPIES` map
107
107
  4. **Phase 4:** Copies `external/_template/.claude` into `packages/sdk/reference/claude-config` for tenant-facing agent configuration
108
108
 
109
- The output lands in `packages/sdk/reference/` which is included in the npm package's `files` array. External projects access it via `node_modules/@elevasis/sdk/reference/`.
110
-
111
- ---
112
-
113
- ## Adding New Scaffold Docs
114
-
115
- 1. **Create the source doc** in the appropriate package:
116
- - Core concepts: `packages/core/src/...`
117
- - UI patterns: `packages/ui/src/scaffold/...`
118
- - Cross-package or SDK-owned: `packages/sdk/docs/scaffold/...`
119
-
120
- 2. **Add to `SCAFFOLD_COPIES`** in `packages/sdk/scripts/copy-reference-docs.mjs`:
121
-
122
- ```javascript
123
- { source: 'packages/sdk/docs/scaffold/operations/my-doc.md', target: 'scaffold/operations/my-doc.md' }
124
- ```
125
-
126
- 3. **Update the scaffold index** in `packages/sdk/docs/scaffold/index.mdx` with a link and description.
127
-
128
- 4. **Rebuild the SDK** to verify: `pnpm --filter @elevasis/sdk build`
129
-
130
- 5. **Update the permanent architecture docs** if the new doc covers a concept already referenced in `apps/docs/content/docs/technical/architecture/scaffold-reference.mdx`.
131
-
132
- ---
133
-
134
- ## Freshness Validation
135
-
136
- At the monorepo level, `pnpm scaffold:sync` followed by `pnpm sync:verify` confirms that all artifacts are current and all downstream projects are consistent. The SDK no longer ships doc validation because external projects no longer carry a `docs/` tree.
109
+ The output lands in `packages/sdk/reference/` which is included in the npm package's `files` array. External projects access it via `operations/node_modules/@elevasis/sdk/reference/`.
110
+
111
+ ---
112
+
113
+ ## Adding New Scaffold Docs
114
+
115
+ 1. **Create the source doc** in the appropriate package:
116
+ - Core concepts: `packages/core/src/...`
117
+ - UI patterns: `packages/ui/src/scaffold/...`
118
+ - Cross-package or SDK-owned: `packages/sdk/docs/scaffold/...`
119
+
120
+ 2. **Add to `SCAFFOLD_COPIES`** in `packages/sdk/scripts/copy-reference-docs.mjs`:
121
+
122
+ ```javascript
123
+ { source: 'packages/sdk/docs/scaffold/operations/my-doc.md', target: 'scaffold/operations/my-doc.md' }
124
+ ```
125
+
126
+ 3. **Update the scaffold index** in `packages/sdk/docs/scaffold/index.mdx` with a link and description.
127
+
128
+ 4. **Rebuild the SDK** to verify: `pnpm --filter @elevasis/sdk build`
129
+
130
+ 5. **Update the permanent architecture docs** if the new doc covers a concept already referenced in `apps/docs/content/docs/technical/architecture/scaffold-reference.mdx`.
131
+
132
+ ---
133
+
134
+ ## Freshness Validation
135
+
136
+ At the monorepo level, `pnpm scaffold:sync` followed by `pnpm sync:verify` confirms that all artifacts are current and all downstream projects are consistent. The SDK no longer ships doc validation because external projects no longer carry a `docs/` tree.