@elevasis/sdk 1.8.2 → 1.8.3

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 (57) hide show
  1. package/dist/cli.cjs +1 -1
  2. package/dist/index.d.ts +88 -39
  3. package/dist/types/worker/adapters/lead.d.ts +1 -1
  4. package/dist/worker/index.js +2 -0
  5. package/package.json +2 -2
  6. package/reference/_navigation.md +7 -1
  7. package/reference/_reference-manifest.json +14 -0
  8. package/reference/claude-config/logs/scaffold-registry-reminder.log +3 -0
  9. package/reference/claude-config/rules/agent-start-here.md +254 -254
  10. package/reference/claude-config/rules/frontend.md +43 -43
  11. package/reference/claude-config/rules/operations.md +64 -64
  12. package/reference/claude-config/rules/organization-model.md +42 -43
  13. package/reference/claude-config/rules/organization-os.md +107 -107
  14. package/reference/claude-config/rules/shared-types.md +2 -2
  15. package/reference/claude-config/rules/task-tracking.md +1 -1
  16. package/reference/claude-config/rules/ui.md +202 -202
  17. package/reference/claude-config/rules/vibe.md +202 -202
  18. package/reference/claude-config/skills/configure/SKILL.md +98 -98
  19. package/reference/claude-config/skills/configure/operations/codify-level-a.md +100 -100
  20. package/reference/claude-config/skills/configure/operations/codify-level-b.md +158 -158
  21. package/reference/claude-config/skills/configure/operations/customers.md +150 -150
  22. package/reference/claude-config/skills/configure/operations/features.md +162 -162
  23. package/reference/claude-config/skills/configure/operations/goals.md +147 -147
  24. package/reference/claude-config/skills/configure/operations/identity.md +133 -133
  25. package/reference/claude-config/skills/configure/operations/labels.md +128 -128
  26. package/reference/claude-config/skills/configure/operations/offerings.md +159 -159
  27. package/reference/claude-config/skills/configure/operations/roles.md +153 -153
  28. package/reference/claude-config/skills/configure/operations/techStack.md +139 -139
  29. package/reference/claude-config/skills/explore/SKILL.md +78 -78
  30. package/reference/claude-config/skills/git-sync/SKILL.md +126 -0
  31. package/reference/claude-config/skills/save/SKILL.md +183 -183
  32. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  33. package/reference/claude-config/skills/sync/SKILL.md +10 -44
  34. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -0
  35. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -0
  36. package/reference/claude-config/sync-notes/README.md +43 -0
  37. package/reference/packages/core/src/README.md +39 -36
  38. package/reference/packages/core/src/business/README.md +52 -52
  39. package/reference/packages/core/src/organization-model/README.md +97 -97
  40. package/reference/packages/core/src/test-utils/README.md +42 -0
  41. package/reference/scaffold/core/organization-graph.mdx +272 -272
  42. package/reference/scaffold/core/organization-model.mdx +320 -320
  43. package/reference/scaffold/index.mdx +64 -64
  44. package/reference/scaffold/operations/propagation-pipeline.md +125 -104
  45. package/reference/scaffold/operations/scaffold-maintenance.md +122 -122
  46. package/reference/scaffold/operations/workflow-recipes.md +436 -436
  47. package/reference/scaffold/recipes/add-a-feature.md +158 -158
  48. package/reference/scaffold/recipes/add-a-resource.md +158 -158
  49. package/reference/scaffold/recipes/customize-organization-model.md +400 -400
  50. package/reference/scaffold/recipes/extend-a-base-entity.md +140 -140
  51. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +158 -158
  52. package/reference/scaffold/recipes/index.md +32 -32
  53. package/reference/scaffold/reference/contracts.md +608 -607
  54. package/reference/scaffold/reference/feature-registry.md +2 -0
  55. package/reference/scaffold/reference/glossary.md +105 -105
  56. package/reference/scaffold/ui/composition-extensibility.mdx +1 -1
  57. package/reference/scaffold/ui/feature-flags-and-gating.md +1 -1
@@ -1,100 +1,100 @@
1
- # Codify Pipeline: Level A (Config-Only Edits)
2
-
3
- Level A is the codify pipeline for changes that land exclusively in
4
- `foundations/config/organization-model.ts`. No new TypeScript files are created. The entire
5
- ceremony is: snapshot current file, propose the edit, write the edit, validate, and roll back on
6
- failure.
7
-
8
- This pipeline is called by domain operations (identity, customers, offerings, roles, goals,
9
- techStack, features, labels) after the user has confirmed the proposed change. The caller provides
10
- the specific field/block being changed and the proposed new value.
11
-
12
- ---
13
-
14
- ## Pipeline
15
-
16
- ### Step 1: Snapshot
17
-
18
- Before any write, read `foundations/config/organization-model.ts` and keep the full file content
19
- in memory as the rollback snapshot. Do not write any file during this step.
20
-
21
- ```
22
- Read("foundations/config/organization-model.ts")
23
- -- store as ROLLBACK_SNAPSHOT
24
- ```
25
-
26
- ### Step 2: Apply the edit
27
-
28
- Use the Edit tool to apply the caller's proposed change to
29
- `foundations/config/organization-model.ts`.
30
-
31
- Rules for the edit:
32
-
33
- - Edit only the specific field or block the caller specified. Do not reformat or restructure
34
- unrelated sections.
35
- - Preserve all other keys in `defineOrganizationModel({...})` exactly as they are.
36
- - Maintain the existing code style (trailing commas, quote style, indentation) of the file.
37
- - If the target field does not yet exist in the adapter call, add it as a new property in the
38
- appropriate position (following the declared domain order in the schema).
39
-
40
- ### Step 3: TypeScript type-check
41
-
42
- Run the type-check for the operations package:
43
-
44
- ```bash
45
- pnpm -C operations check-types
46
- ```
47
-
48
- Capture stdout and stderr. If the command exits non-zero, proceed to Step 5 (rollback).
49
-
50
- ### Step 4: Runtime schema validation
51
-
52
- Confirm that the adapter's output passes `OrganizationModelSchema.parse()`. The adapter calls
53
- `resolveOrganizationModel()` internally, which merges defaults with overrides and then parses the
54
- result. A successful `check-types` pass is strong evidence that the schema is valid, but
55
- cross-reference checks (segment ID refs in offerings, role reporting refs, period ordering in
56
- goals) are runtime-only.
57
-
58
- If the project exposes a validation script (e.g. `pnpm -C operations check`), run that too:
59
-
60
- ```bash
61
- pnpm -C operations check
62
- ```
63
-
64
- If either validation step fails, proceed to Step 5 (rollback).
65
-
66
- ### Step 5: Rollback (on failure only)
67
-
68
- If Step 3 or Step 4 failed:
69
-
70
- 1. Write the ROLLBACK_SNAPSHOT content back to `foundations/config/organization-model.ts`
71
- verbatim (use the Write tool with the exact snapshot content).
72
- 2. Confirm the file has been restored by checking that the content matches the snapshot.
73
- 3. Return the error message to the caller.
74
-
75
- The caller is responsible for reporting the rollback to the user.
76
-
77
- ### Step 6: Success signal
78
-
79
- If Steps 3 and 4 both passed, return a success signal to the caller with:
80
-
81
- - The fields changed
82
- - `Type-check: PASS`
83
- - `Schema validation: PASS`
84
-
85
- The caller formats and presents the final report.
86
-
87
- ---
88
-
89
- ## Caller Contract
90
-
91
- Callers must provide before invoking this pipeline:
92
-
93
- - **Target file:** always `foundations/config/organization-model.ts`
94
- - **Target block:** the specific domain key or sub-key being changed (e.g. `identity`,
95
- `customers.segments`, `roles.roles`, `resourceMappings[id="rm-hubspot"].techStack`)
96
- - **Proposed value:** the new TypeScript literal to write for that block
97
- - **Confirmed:** the user has already said yes to the proposed change
98
-
99
- This pipeline does not ask the user any questions. All confirmation happens in the domain
100
- operation before this pipeline is invoked.
1
+ # Codify Pipeline: Level A (Config-Only Edits)
2
+
3
+ Level A is the codify pipeline for changes that land exclusively in
4
+ `foundations/config/organization-model.ts`. No new TypeScript files are created. The entire
5
+ ceremony is: snapshot current file, propose the edit, write the edit, validate, and roll back on
6
+ failure.
7
+
8
+ This pipeline is called by domain operations (identity, customers, offerings, roles, goals,
9
+ techStack, features, labels) after the user has confirmed the proposed change. The caller provides
10
+ the specific field/block being changed and the proposed new value.
11
+
12
+ ---
13
+
14
+ ## Pipeline
15
+
16
+ ### Step 1: Snapshot
17
+
18
+ Before any write, read `foundations/config/organization-model.ts` and keep the full file content
19
+ in memory as the rollback snapshot. Do not write any file during this step.
20
+
21
+ ```
22
+ Read("foundations/config/organization-model.ts")
23
+ -- store as ROLLBACK_SNAPSHOT
24
+ ```
25
+
26
+ ### Step 2: Apply the edit
27
+
28
+ Use the Edit tool to apply the caller's proposed change to
29
+ `foundations/config/organization-model.ts`.
30
+
31
+ Rules for the edit:
32
+
33
+ - Edit only the specific field or block the caller specified. Do not reformat or restructure
34
+ unrelated sections.
35
+ - Preserve all other keys in `defineOrganizationModel({...})` exactly as they are.
36
+ - Maintain the existing code style (trailing commas, quote style, indentation) of the file.
37
+ - If the target field does not yet exist in the adapter call, add it as a new property in the
38
+ appropriate position (following the declared domain order in the schema).
39
+
40
+ ### Step 3: TypeScript type-check
41
+
42
+ Run the type-check for the operations package:
43
+
44
+ ```bash
45
+ pnpm -C operations check-types
46
+ ```
47
+
48
+ Capture stdout and stderr. If the command exits non-zero, proceed to Step 5 (rollback).
49
+
50
+ ### Step 4: Runtime schema validation
51
+
52
+ Confirm that the adapter's output passes `OrganizationModelSchema.parse()`. The adapter calls
53
+ `resolveOrganizationModel()` internally, which merges defaults with overrides and then parses the
54
+ result. A successful `check-types` pass is strong evidence that the schema is valid, but
55
+ cross-reference checks (segment ID refs in offerings, role reporting refs, period ordering in
56
+ goals) are runtime-only.
57
+
58
+ If the project exposes a validation script (e.g. `pnpm -C operations check`), run that too:
59
+
60
+ ```bash
61
+ pnpm -C operations check
62
+ ```
63
+
64
+ If either validation step fails, proceed to Step 5 (rollback).
65
+
66
+ ### Step 5: Rollback (on failure only)
67
+
68
+ If Step 3 or Step 4 failed:
69
+
70
+ 1. Write the ROLLBACK_SNAPSHOT content back to `foundations/config/organization-model.ts`
71
+ verbatim (use the Write tool with the exact snapshot content).
72
+ 2. Confirm the file has been restored by checking that the content matches the snapshot.
73
+ 3. Return the error message to the caller.
74
+
75
+ The caller is responsible for reporting the rollback to the user.
76
+
77
+ ### Step 6: Success signal
78
+
79
+ If Steps 3 and 4 both passed, return a success signal to the caller with:
80
+
81
+ - The fields changed
82
+ - `Type-check: PASS`
83
+ - `Schema validation: PASS`
84
+
85
+ The caller formats and presents the final report.
86
+
87
+ ---
88
+
89
+ ## Caller Contract
90
+
91
+ Callers must provide before invoking this pipeline:
92
+
93
+ - **Target file:** always `foundations/config/organization-model.ts`
94
+ - **Target block:** the specific domain key or sub-key being changed (e.g. `identity`,
95
+ `customers.segments`, `roles.roles`, `resourceMappings[id="rm-hubspot"].techStack`)
96
+ - **Proposed value:** the new TypeScript literal to write for that block
97
+ - **Confirmed:** the user has already said yes to the proposed change
98
+
99
+ This pipeline does not ask the user any questions. All confirmation happens in the domain
100
+ operation before this pipeline is invoked.
@@ -1,158 +1,158 @@
1
- # Codify Pipeline: Level B (New Extension TypeScript Files)
2
-
3
- Level B is the codify pipeline for changes that require creating a new TypeScript file under
4
- `foundations/config/extensions/`. This pipeline is used when the user wants to add a custom
5
- feature, a custom entity type, or any structural addition that cannot be expressed as a simple
6
- field override in `foundations/config/organization-model.ts`.
7
-
8
- Level B is **only offered when the user explicitly asks** for something that requires a new file.
9
- Never silently escalate from Level A to Level B. If Level A is sufficient, use it.
10
-
11
- ---
12
-
13
- ## When Level B applies
14
-
15
- - Adding a custom feature that does not exist in the platform defaults (new `FeatureSchema` entry
16
- with a custom ID, manifest wiring, and route references)
17
- - Adding a custom entity extension (new Zod schema extending a base entity type)
18
- - Any structural addition the caller's domain operation has determined cannot be expressed as a
19
- field value in the existing adapter
20
-
21
- The calling operation (e.g. `features.md`) is responsible for deciding when Level B is needed
22
- and for confirming the intent with the user before invoking this pipeline.
23
-
24
- ---
25
-
26
- ## Pipeline
27
-
28
- ### Step 1: Snapshot all files that will be touched
29
-
30
- Before any write, read and snapshot:
31
-
32
- 1. `foundations/config/organization-model.ts` (always touched for wiring)
33
- 2. The target extension file path (if it already exists -- confirm overwrite with user)
34
-
35
- ```
36
- Read("foundations/config/organization-model.ts") -- store as ROLLBACK_ADAPTER
37
- Read("foundations/config/extensions/{target}.ts") -- store as ROLLBACK_EXTENSION (if exists)
38
- ```
39
-
40
- The target extension file path follows the naming convention:
41
- `foundations/config/extensions/{kebab-case-feature-id}.ts`
42
-
43
- ### Step 2: Scaffold the extension file
44
-
45
- Create `foundations/config/extensions/{id}.ts` using the Write tool.
46
-
47
- The file shape depends on the extension type:
48
-
49
- **Custom feature (most common Level B case):**
50
-
51
- ```typescript
52
- /**
53
- * {Feature label} feature extension.
54
- * Registered in foundations/config/organization-model.ts.
55
- */
56
- import type { OrganizationModelFeature } from '@elevasis/core/organization-model'
57
-
58
- export const {FEATURE_CONST}: OrganizationModelFeature = {
59
- id: '{feature-id}',
60
- label: '{Feature Label}',
61
- description: '{optional description}',
62
- enabled: true,
63
- entityIds: [],
64
- surfaceIds: [],
65
- resourceIds: [],
66
- capabilityIds: [],
67
- }
68
- ```
69
-
70
- Replace `{FEATURE_CONST}` with the SCREAMING_SNAKE_CASE version of the feature ID
71
- (e.g. `CLIENT_PORTAL_FEATURE`).
72
-
73
- The caller provides the exact field values based on what the user confirmed.
74
-
75
- ### Step 3: Wire the extension into the adapter
76
-
77
- Edit `foundations/config/organization-model.ts` to:
78
-
79
- 1. Import the new constant from the extension file.
80
- 2. Add it to the `features` array in the `defineOrganizationModel({...})` call.
81
-
82
- Example import addition:
83
-
84
- ```typescript
85
- import { CLIENT_PORTAL_FEATURE } from './extensions/client-portal'
86
- ```
87
-
88
- Example features array addition:
89
-
90
- ```typescript
91
- features: [
92
- ...existingFeatures,
93
- CLIENT_PORTAL_FEATURE,
94
- ],
95
- ```
96
-
97
- ### Step 4: TypeScript type-check
98
-
99
- ```bash
100
- pnpm -C operations check-types
101
- ```
102
-
103
- Capture stdout and stderr. If the command exits non-zero, proceed to Step 6 (rollback).
104
-
105
- ### Step 5: Runtime schema validation
106
-
107
- ```bash
108
- pnpm -C operations check
109
- ```
110
-
111
- If either check fails, proceed to Step 6 (rollback).
112
-
113
- ### Step 6: Rollback (on failure only)
114
-
115
- If Step 4 or Step 5 failed:
116
-
117
- 1. Restore `foundations/config/organization-model.ts` from ROLLBACK_ADAPTER.
118
- 2. If the extension file did not previously exist, delete it. If it previously existed, restore
119
- from ROLLBACK_EXTENSION.
120
- 3. Re-run `pnpm -C operations check-types` to confirm the restore is clean. If the restore
121
- itself fails type-check, report both the original error and the restore state to the user --
122
- do not silently leave the project in a broken state.
123
- 4. Return the error message to the caller.
124
-
125
- ### Step 7: Success signal
126
-
127
- If Steps 4 and 5 both passed, return a success signal to the caller with:
128
-
129
- - Extension file path created
130
- - Adapter wiring changes (import + features array entry)
131
- - `Type-check: PASS`
132
- - `Schema validation: PASS`
133
-
134
- The caller formats and presents the final report to the user.
135
-
136
- ---
137
-
138
- ## Caller Contract
139
-
140
- Callers must provide before invoking this pipeline:
141
-
142
- - **Extension file path:** `foundations/config/extensions/{id}.ts`
143
- - **Extension file content:** the full TypeScript content for the new file
144
- - **Adapter changes:** the exact import line and features-array addition to write into the adapter
145
- - **Confirmed:** the user has already said yes to the proposed change and explicitly requested
146
- a new extension file
147
-
148
- This pipeline does not ask the user any questions. All confirmation and escalation decisions
149
- happen in the domain operation before this pipeline is invoked.
150
-
151
- ---
152
-
153
- ## Constraint: Extension files are Tier 3 (never synced)
154
-
155
- Files under `foundations/config/extensions/` are Tier 3 -- project-specific, never overwritten
156
- by `/external sync`. This means custom features and entity extensions survive template upgrades
157
- automatically. Do not put platform-default overrides in extension files; those belong directly in
158
- `foundations/config/organization-model.ts` (Tier 2, merge-aware).
1
+ # Codify Pipeline: Level B (New Extension TypeScript Files)
2
+
3
+ Level B is the codify pipeline for changes that require creating a new TypeScript file under
4
+ `foundations/config/extensions/`. This pipeline is used when the user wants to add a custom
5
+ feature, a custom entity type, or any structural addition that cannot be expressed as a simple
6
+ field override in `foundations/config/organization-model.ts`.
7
+
8
+ Level B is **only offered when the user explicitly asks** for something that requires a new file.
9
+ Never silently escalate from Level A to Level B. If Level A is sufficient, use it.
10
+
11
+ ---
12
+
13
+ ## When Level B applies
14
+
15
+ - Adding a custom feature that does not exist in the platform defaults (new `FeatureSchema` entry
16
+ with a custom ID, manifest wiring, and route references)
17
+ - Adding a custom entity extension (new Zod schema extending a base entity type)
18
+ - Any structural addition the caller's domain operation has determined cannot be expressed as a
19
+ field value in the existing adapter
20
+
21
+ The calling operation (e.g. `features.md`) is responsible for deciding when Level B is needed
22
+ and for confirming the intent with the user before invoking this pipeline.
23
+
24
+ ---
25
+
26
+ ## Pipeline
27
+
28
+ ### Step 1: Snapshot all files that will be touched
29
+
30
+ Before any write, read and snapshot:
31
+
32
+ 1. `foundations/config/organization-model.ts` (always touched for wiring)
33
+ 2. The target extension file path (if it already exists -- confirm overwrite with user)
34
+
35
+ ```
36
+ Read("foundations/config/organization-model.ts") -- store as ROLLBACK_ADAPTER
37
+ Read("foundations/config/extensions/{target}.ts") -- store as ROLLBACK_EXTENSION (if exists)
38
+ ```
39
+
40
+ The target extension file path follows the naming convention:
41
+ `foundations/config/extensions/{kebab-case-feature-id}.ts`
42
+
43
+ ### Step 2: Scaffold the extension file
44
+
45
+ Create `foundations/config/extensions/{id}.ts` using the Write tool.
46
+
47
+ The file shape depends on the extension type:
48
+
49
+ **Custom feature (most common Level B case):**
50
+
51
+ ```typescript
52
+ /**
53
+ * {Feature label} feature extension.
54
+ * Registered in foundations/config/organization-model.ts.
55
+ */
56
+ import type { OrganizationModelFeature } from '@elevasis/core/organization-model'
57
+
58
+ export const {FEATURE_CONST}: OrganizationModelFeature = {
59
+ id: '{feature-id}',
60
+ label: '{Feature Label}',
61
+ description: '{optional description}',
62
+ enabled: true,
63
+ entityIds: [],
64
+ surfaceIds: [],
65
+ resourceIds: [],
66
+ capabilityIds: [],
67
+ }
68
+ ```
69
+
70
+ Replace `{FEATURE_CONST}` with the SCREAMING_SNAKE_CASE version of the feature ID
71
+ (e.g. `CLIENT_PORTAL_FEATURE`).
72
+
73
+ The caller provides the exact field values based on what the user confirmed.
74
+
75
+ ### Step 3: Wire the extension into the adapter
76
+
77
+ Edit `foundations/config/organization-model.ts` to:
78
+
79
+ 1. Import the new constant from the extension file.
80
+ 2. Add it to the `features` array in the `defineOrganizationModel({...})` call.
81
+
82
+ Example import addition:
83
+
84
+ ```typescript
85
+ import { CLIENT_PORTAL_FEATURE } from './extensions/client-portal'
86
+ ```
87
+
88
+ Example features array addition:
89
+
90
+ ```typescript
91
+ features: [
92
+ ...existingFeatures,
93
+ CLIENT_PORTAL_FEATURE,
94
+ ],
95
+ ```
96
+
97
+ ### Step 4: TypeScript type-check
98
+
99
+ ```bash
100
+ pnpm -C operations check-types
101
+ ```
102
+
103
+ Capture stdout and stderr. If the command exits non-zero, proceed to Step 6 (rollback).
104
+
105
+ ### Step 5: Runtime schema validation
106
+
107
+ ```bash
108
+ pnpm -C operations check
109
+ ```
110
+
111
+ If either check fails, proceed to Step 6 (rollback).
112
+
113
+ ### Step 6: Rollback (on failure only)
114
+
115
+ If Step 4 or Step 5 failed:
116
+
117
+ 1. Restore `foundations/config/organization-model.ts` from ROLLBACK_ADAPTER.
118
+ 2. If the extension file did not previously exist, delete it. If it previously existed, restore
119
+ from ROLLBACK_EXTENSION.
120
+ 3. Re-run `pnpm -C operations check-types` to confirm the restore is clean. If the restore
121
+ itself fails type-check, report both the original error and the restore state to the user --
122
+ do not silently leave the project in a broken state.
123
+ 4. Return the error message to the caller.
124
+
125
+ ### Step 7: Success signal
126
+
127
+ If Steps 4 and 5 both passed, return a success signal to the caller with:
128
+
129
+ - Extension file path created
130
+ - Adapter wiring changes (import + features array entry)
131
+ - `Type-check: PASS`
132
+ - `Schema validation: PASS`
133
+
134
+ The caller formats and presents the final report to the user.
135
+
136
+ ---
137
+
138
+ ## Caller Contract
139
+
140
+ Callers must provide before invoking this pipeline:
141
+
142
+ - **Extension file path:** `foundations/config/extensions/{id}.ts`
143
+ - **Extension file content:** the full TypeScript content for the new file
144
+ - **Adapter changes:** the exact import line and features-array addition to write into the adapter
145
+ - **Confirmed:** the user has already said yes to the proposed change and explicitly requested
146
+ a new extension file
147
+
148
+ This pipeline does not ask the user any questions. All confirmation and escalation decisions
149
+ happen in the domain operation before this pipeline is invoked.
150
+
151
+ ---
152
+
153
+ ## Constraint: Extension files are Tier 3 (never synced)
154
+
155
+ Files under `foundations/config/extensions/` are Tier 3 -- project-specific, never overwritten
156
+ by `/external sync`. This means custom features and entity extensions survive template upgrades
157
+ automatically. Do not put platform-default overrides in extension files; those belong directly in
158
+ `foundations/config/organization-model.ts` (Tier 2, merge-aware).