@elevasis/sdk 1.15.0 → 1.16.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 +2325 -124
- package/dist/index.d.ts +882 -794
- package/dist/index.js +170 -46
- package/dist/node/index.d.ts +69 -0
- package/dist/node/index.js +273 -0
- package/dist/test-utils/index.d.ts +857 -711
- package/dist/test-utils/index.js +2 -0
- package/dist/types/worker/adapters/lead.d.ts +1 -1
- package/dist/types/worker/platform.d.ts +2 -9
- package/dist/worker/index.js +1 -0
- package/package.json +12 -3
- package/reference/_navigation.md +23 -1
- package/reference/_reference-manifest.json +98 -0
- package/reference/claude-config/rules/agent-start-here.md +13 -0
- package/reference/claude-config/rules/organization-model.md +40 -40
- package/reference/claude-config/rules/organization-os.md +16 -16
- package/reference/claude-config/rules/ui.md +2 -6
- package/reference/claude-config/rules/vibe.md +13 -13
- package/reference/claude-config/skills/knowledge/SKILL.md +253 -0
- package/reference/claude-config/skills/{configure → knowledge}/operations/codify-level-a.md +100 -100
- package/reference/claude-config/skills/{configure → knowledge}/operations/codify-level-b.md +158 -158
- package/reference/claude-config/skills/knowledge/operations/customers.md +109 -0
- package/reference/claude-config/skills/knowledge/operations/features.md +113 -0
- package/reference/claude-config/skills/knowledge/operations/goals.md +118 -0
- package/reference/claude-config/skills/knowledge/operations/identity.md +93 -0
- package/reference/claude-config/skills/knowledge/operations/labels.md +89 -0
- package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -0
- package/reference/claude-config/skills/knowledge/operations/roles.md +99 -0
- package/reference/claude-config/skills/knowledge/operations/techStack.md +102 -0
- package/reference/claude-config/skills/run-ui/SKILL.md +73 -0
- package/reference/claude-config/skills/setup/SKILL.md +270 -270
- package/reference/claude-config/skills/tutorial/SKILL.md +249 -0
- package/reference/claude-config/skills/tutorial/progress-template.md +74 -0
- package/reference/claude-config/skills/tutorial/technical.md +1309 -0
- package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -0
- package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -0
- package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -0
- package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -0
- package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -0
- package/reference/deployment/index.mdx +5 -5
- package/reference/examples/organization-model.ts +40 -0
- package/reference/framework/index.mdx +1 -1
- package/reference/framework/tutorial-system.mdx +86 -173
- package/reference/packages/core/src/knowledge/README.md +32 -0
- package/reference/packages/ui/src/knowledge/README.md +31 -0
- package/reference/packages/ui/src/theme/presets/README.md +19 -0
- package/reference/scaffold/core/organization-model.mdx +1 -1
- package/reference/scaffold/recipes/add-a-feature.md +1 -1
- package/reference/scaffold/recipes/customize-crm-actions.md +3 -3
- package/reference/scaffold/recipes/customize-organization-model.md +3 -3
- package/reference/scaffold/recipes/extend-crm.md +12 -8
- package/reference/scaffold/recipes/extend-lead-gen.md +129 -20
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +1 -1
- package/reference/scaffold/recipes/index.md +6 -0
- package/reference/scaffold/reference/contracts.md +829 -595
- package/reference/scaffold/reference/feature-registry.md +2 -1
- package/reference/scaffold/ui/composition-extensibility.mdx +17 -0
- package/reference/claude-config/skills/configure/SKILL.md +0 -98
- package/reference/claude-config/skills/configure/operations/customers.md +0 -150
- package/reference/claude-config/skills/configure/operations/features.md +0 -162
- package/reference/claude-config/skills/configure/operations/goals.md +0 -147
- package/reference/claude-config/skills/configure/operations/identity.md +0 -133
- package/reference/claude-config/skills/configure/operations/labels.md +0 -128
- package/reference/claude-config/skills/configure/operations/offerings.md +0 -159
- package/reference/claude-config/skills/configure/operations/roles.md +0 -153
- package/reference/claude-config/skills/configure/operations/techStack.md +0 -139
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: knowledge
|
|
3
|
+
description: |
|
|
4
|
+
TRIGGER this skill when any of the following apply:
|
|
5
|
+
- The user references organization-model entities by name or concept: identity, customers,
|
|
6
|
+
offerings, roles, goals, techStack, features, labels, knowledge nodes, governance edges,
|
|
7
|
+
mounts, playbook, outreach cadence, or any domain in the org model.
|
|
8
|
+
- The user asks to read, list, find, show, query, navigate, describe, codify, add, edit,
|
|
9
|
+
update, toggle, enable, or disable any organization-model domain or knowledge node.
|
|
10
|
+
- The user asks "what governs X?", "what does X control?", "feature governs", "what is our
|
|
11
|
+
identity set to?", "what's our timezone?", "show me all reference docs", "list my roles",
|
|
12
|
+
"where does outreach-cadence apply?", or similar.
|
|
13
|
+
- An agent is editing files matching: core/config/organization-model.ts,
|
|
14
|
+
foundations/config/organization-model.ts, packages/elevasis-core/src/organization-model.ts,
|
|
15
|
+
or packages/core/src/knowledge/**.
|
|
16
|
+
SKIP this skill when the task is purely UI layout, workflow authoring, or infrastructure
|
|
17
|
+
work with no reference to org-model or knowledge-graph entities.
|
|
18
|
+
metadata:
|
|
19
|
+
pathPatterns:
|
|
20
|
+
- "core/config/organization-model.ts"
|
|
21
|
+
- "foundations/config/organization-model.ts"
|
|
22
|
+
- "packages/elevasis-core/src/organization-model.ts"
|
|
23
|
+
- "packages/core/src/knowledge/**"
|
|
24
|
+
promptSignals:
|
|
25
|
+
phrases:
|
|
26
|
+
- playbook
|
|
27
|
+
- knowledge node
|
|
28
|
+
- feature governs
|
|
29
|
+
- outreach cadence
|
|
30
|
+
- identity
|
|
31
|
+
- customer segment
|
|
32
|
+
- codify
|
|
33
|
+
- enable feature
|
|
34
|
+
- toggle feature
|
|
35
|
+
- what governs
|
|
36
|
+
- org model
|
|
37
|
+
- organization model
|
|
38
|
+
- offerings
|
|
39
|
+
- techStack
|
|
40
|
+
- roles
|
|
41
|
+
- goals
|
|
42
|
+
- labels
|
|
43
|
+
- knowledge map
|
|
44
|
+
- governance edge
|
|
45
|
+
- knowledge mount
|
|
46
|
+
- knowledge graph
|
|
47
|
+
- knowledge browser
|
|
48
|
+
- list my roles
|
|
49
|
+
- what is our
|
|
50
|
+
- show me all reference docs
|
|
51
|
+
- where does
|
|
52
|
+
- apply
|
|
53
|
+
context: fork
|
|
54
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
# Knowledge
|
|
58
|
+
|
|
59
|
+
Unified intent-inferring skill for all organization-model interaction. Reads org-model state
|
|
60
|
+
through the `elevasis knowledge:*` CLI tooling; writes run through the codify ceremony absorbed
|
|
61
|
+
from `/configure`. No verb namespace is required -- the skill classifies intent from conversation
|
|
62
|
+
context and routes to the appropriate flow internally.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## When to Invoke
|
|
67
|
+
|
|
68
|
+
This skill auto-invokes whenever:
|
|
69
|
+
|
|
70
|
+
- Conversation references org-model entities (identity, customers, offerings, roles, goals,
|
|
71
|
+
techStack, features, labels, knowledge nodes, governance edges, mounts)
|
|
72
|
+
- The user asks to read, list, find, show, query, navigate, describe, codify, add, edit,
|
|
73
|
+
update, toggle, enable, or disable any of those
|
|
74
|
+
- An agent is editing files matching `core/config/organization-model.ts`,
|
|
75
|
+
`foundations/config/organization-model.ts`, `packages/elevasis-core/src/organization-model.ts`,
|
|
76
|
+
or `packages/core/src/knowledge/**`
|
|
77
|
+
|
|
78
|
+
Auto-invocation is driven by frontmatter `description`, `metadata.pathPatterns`, and
|
|
79
|
+
`metadata.promptSignals` -- no explicit `/knowledge` prefix is required.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Intent Classification
|
|
84
|
+
|
|
85
|
+
Once invoked, classify the user's intent into one of five flows. Read natural-language input and
|
|
86
|
+
pick a flow. On ambiguous input, default to **Describe** (read intent) and ask the user to
|
|
87
|
+
confirm before any write. The codify ceremony has an explicit user-confirm gate -- misclassification
|
|
88
|
+
cannot bypass the write gate.
|
|
89
|
+
|
|
90
|
+
| Flow | Triggers (examples) | Mechanics |
|
|
91
|
+
| -------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
92
|
+
| Read | "what playbooks govern sales.crm?", "show me all reference docs", "list my roles" | Run CLI read commands (monorepo or external); format result |
|
|
93
|
+
| Navigate | "what governs this feature?", "where does outreach-cadence apply?" | Same CLI; pick mount axis from intent; default to `by-feature` for orientation queries |
|
|
94
|
+
| Describe | "what is our identity set to?", "what's our timezone?" | Read current values from OM source; narrate |
|
|
95
|
+
| Codify | "we're an e-commerce company", "add a customer segment", "our outreach goal is..." | Run codify ceremony: snapshot -> propose -> confirm -> write -> typecheck -> Zod parse -> rollback on failure |
|
|
96
|
+
| Toggle | "enable the lead-gen feature", "turn off SEO" | Codify ceremony scoped to `features` domain; flip the boolean; same validation/rollback |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Read Patterns
|
|
101
|
+
|
|
102
|
+
### Monorepo (platform defaults)
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm exec elevasis knowledge:ls
|
|
106
|
+
pnpm exec elevasis knowledge:cat <node-id>
|
|
107
|
+
pnpm exec elevasis knowledge:graph --axis by-feature
|
|
108
|
+
pnpm exec elevasis knowledge:graph --axis by-domain
|
|
109
|
+
pnpm exec elevasis knowledge:graph --mount <mount-id>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### External projects (org instance)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pnpm exec elevasis-sdk knowledge:ls
|
|
116
|
+
pnpm exec elevasis-sdk knowledge:cat <node-id>
|
|
117
|
+
pnpm exec elevasis-sdk knowledge:graph --axis by-feature
|
|
118
|
+
pnpm exec elevasis-sdk knowledge:graph --axis by-domain
|
|
119
|
+
pnpm exec elevasis-sdk knowledge:graph --mount <mount-id>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Use `knowledge:ls` to enumerate all knowledge nodes. Use `knowledge:cat` to read a specific
|
|
123
|
+
node's content. Use `knowledge:graph` to navigate the governance graph -- `by-feature` is the
|
|
124
|
+
default axis for "what governs X?" queries; `by-domain` for domain-wide surveys.
|
|
125
|
+
|
|
126
|
+
### `/knowledge read-folder` (chat shorthand from the Knowledge Browser)
|
|
127
|
+
|
|
128
|
+
The Knowledge Browser's copy button on a top-level feature or kind group emits a single
|
|
129
|
+
`/knowledge read-folder <axis>:<id>` line instead of N per-node `read` lines. Resolve it by
|
|
130
|
+
listing the folder via `knowledge:ls` and reading each child:
|
|
131
|
+
|
|
132
|
+
| Copy form | Resolution (external) |
|
|
133
|
+
| ------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
134
|
+
| `/knowledge read-folder feature:<id>` | `pnpm exec elevasis-sdk knowledge:ls /by-feature/<id> --ids-only`, then `knowledge:cat` each |
|
|
135
|
+
| `/knowledge read-folder kind:<kind>` | `pnpm exec elevasis-sdk knowledge:ls /by-kind/<kind> --ids-only`, then `knowledge:cat` each |
|
|
136
|
+
|
|
137
|
+
Dotted feature ids may use either dots or slashes (`sales.crm` and `sales/crm` both work
|
|
138
|
+
with `knowledge:ls`). Per-node leaves still copy as `/knowledge read <node-id>`; virtual
|
|
139
|
+
sub-folders inside a feature (regex-grouped UI buckets like Campaigns/Pipeline) keep the
|
|
140
|
+
N-line list since they have no stable folder id.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Codify Ceremony
|
|
145
|
+
|
|
146
|
+
Every write (Codify or Toggle intent) runs the six-step safety ceremony. This ceremony is
|
|
147
|
+
preserved verbatim from `/configure`.
|
|
148
|
+
|
|
149
|
+
### Step 1: Snapshot
|
|
150
|
+
|
|
151
|
+
Read `foundations/config/organization-model.ts` (external) or the appropriate platform OM file
|
|
152
|
+
(monorepo) into memory before any edit. This is the rollback target.
|
|
153
|
+
|
|
154
|
+
### Step 2: Propose
|
|
155
|
+
|
|
156
|
+
Show the diff in chat. Identify which domain and field changes. Present the proposed new value
|
|
157
|
+
in context alongside the current value.
|
|
158
|
+
|
|
159
|
+
### Step 3: Confirm
|
|
160
|
+
|
|
161
|
+
Pause for explicit user confirmation. Do not proceed without a clear yes. Permission prompts
|
|
162
|
+
also gate writes.
|
|
163
|
+
|
|
164
|
+
### Step 4: Write
|
|
165
|
+
|
|
166
|
+
Apply the edit using the Edit or Write tool.
|
|
167
|
+
|
|
168
|
+
### Step 5: Validate
|
|
169
|
+
|
|
170
|
+
Run both checks:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
pnpm -C operations check-types # TypeScript type-check
|
|
174
|
+
pnpm -C operations check # Runtime schema validation (Zod parse)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Step 6: Rollback
|
|
178
|
+
|
|
179
|
+
If any validation step fails, restore the file from the Step 1 snapshot and report the error.
|
|
180
|
+
The rollback is mandatory -- never leave the project in a broken state.
|
|
181
|
+
|
|
182
|
+
**Two-level ceremony:**
|
|
183
|
+
|
|
184
|
+
- **Level A** -- config-only edits to existing schema fields in `foundations/config/organization-model.ts`.
|
|
185
|
+
Execute: `.claude/skills/knowledge/operations/codify-level-a.md`
|
|
186
|
+
- **Level B** -- new Zod extension files in `foundations/config/extensions/`. Gated to explicit
|
|
187
|
+
user ask. On casual second mentions of a new type, suggest Level B and wait for confirmation
|
|
188
|
+
rather than scaffolding automatically.
|
|
189
|
+
Execute: `.claude/skills/knowledge/operations/codify-level-b.md`
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Domain References
|
|
194
|
+
|
|
195
|
+
The following domain reference files document each org-model domain: schema fields, validation
|
|
196
|
+
rules, examples, and how to read or edit them. Load the relevant file when the user's intent
|
|
197
|
+
classification names a specific domain.
|
|
198
|
+
|
|
199
|
+
- `.claude/skills/knowledge/operations/identity.md` -- identity domain
|
|
200
|
+
- `.claude/skills/knowledge/operations/customers.md` -- customer segments
|
|
201
|
+
- `.claude/skills/knowledge/operations/offerings.md` -- products and services
|
|
202
|
+
- `.claude/skills/knowledge/operations/roles.md` -- role chart
|
|
203
|
+
- `.claude/skills/knowledge/operations/goals.md` -- organizational goals
|
|
204
|
+
- `.claude/skills/knowledge/operations/techStack.md` -- external integration registry
|
|
205
|
+
- `.claude/skills/knowledge/operations/features.md` -- feature toggles and Level B extension gate
|
|
206
|
+
- `.claude/skills/knowledge/operations/labels.md` -- inline display labels on enum entries
|
|
207
|
+
|
|
208
|
+
These files are populated by Wave B2 and own the domain-specific schema reference content. The
|
|
209
|
+
codify ceremony files above own the write pipeline. This SKILL.md owns intent classification
|
|
210
|
+
and routing.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Monorepo vs External
|
|
215
|
+
|
|
216
|
+
### External projects (canonical scope -- full power)
|
|
217
|
+
|
|
218
|
+
In external projects (`external/nirvana-marketing`, `external/ZentaraHQ`, etc.) this skill has
|
|
219
|
+
full power: read + write + codify + toggle. The org-model file is
|
|
220
|
+
`foundations/config/organization-model.ts` (or `core/config/organization-model.ts` for
|
|
221
|
+
`external/_template`-derived projects). Extension files live in `foundations/config/extensions/`.
|
|
222
|
+
|
|
223
|
+
This is the environment where Codify and Toggle intents write. All six ceremony steps apply.
|
|
224
|
+
|
|
225
|
+
### Monorepo (read-only pointer for tenants; direct PR for platform)
|
|
226
|
+
|
|
227
|
+
The monorepo-side skill at `.claude/skills/knowledge/SKILL.md` is a read-only pointer. For
|
|
228
|
+
tenant agents reading the platform OM, it reads `packages/elevasis-core/src/organization-model.ts`
|
|
229
|
+
(the workspace-resident platform OM, importable as `@repo/elevasis-core/organization-model`).
|
|
230
|
+
It documents read patterns and explicitly declines write operations for tenant contexts.
|
|
231
|
+
|
|
232
|
+
To modify the Elevasis runtime/platform OM, edit `packages/elevasis-core/src/organization-model.ts`
|
|
233
|
+
via a standard PR in the monorepo -- this is source-controlled workspace code, not an external
|
|
234
|
+
project. To modify your own tenant org-model state, work in `external/<your-project>/` where
|
|
235
|
+
`/knowledge` has full write power via the codify ceremony.
|
|
236
|
+
|
|
237
|
+
Cross-link: `.claude/skills/knowledge/SKILL.md` (monorepo pointer)
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Cross-Links
|
|
242
|
+
|
|
243
|
+
- `/org-os` -- Organization OS architecture overview, seven layers, propagation pipeline,
|
|
244
|
+
feature/surface management. Use `/org-os` when the question is about the architecture or
|
|
245
|
+
propagation system rather than reading or editing org-model values. Cross-link:
|
|
246
|
+
`.claude/skills/org-os/SKILL.md`
|
|
247
|
+
- `/configure` -- Legacy org-model editor (pre-absorption). Absorbed into this skill; all
|
|
248
|
+
Codify and Toggle intents now route here. `/configure` vocabulary still works as a domain
|
|
249
|
+
hint (e.g., "configure identity" is parsed as domain=identity, intent=Describe-or-Codify).
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
**Last Updated:** 2026-05-02
|
|
@@ -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.
|