@elevasis/sdk 1.20.1 → 1.21.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.
Files changed (58) hide show
  1. package/dist/cli.cjs +3388 -1530
  2. package/dist/index.d.ts +412 -149
  3. package/dist/index.js +955 -721
  4. package/dist/node/index.d.ts +0 -3
  5. package/dist/node/index.js +22 -49
  6. package/dist/test-utils/index.d.ts +395 -128
  7. package/dist/test-utils/index.js +599 -368
  8. package/dist/worker/index.js +536 -323
  9. package/package.json +4 -4
  10. package/reference/_navigation.md +9 -7
  11. package/reference/_reference-manifest.json +1 -1
  12. package/reference/claude-config/rules/agent-start-here.md +4 -0
  13. package/reference/claude-config/rules/frontend.md +2 -2
  14. package/reference/claude-config/rules/organization-model.md +44 -2
  15. package/reference/claude-config/rules/organization-os.md +12 -12
  16. package/reference/claude-config/rules/ui.md +14 -14
  17. package/reference/claude-config/rules/vibe.md +37 -33
  18. package/reference/claude-config/skills/explore/SKILL.md +6 -6
  19. package/reference/claude-config/skills/knowledge/SKILL.md +73 -29
  20. package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +1 -1
  21. package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +25 -24
  22. package/reference/claude-config/skills/knowledge/operations/features.md +56 -93
  23. package/reference/claude-config/skills/knowledge/operations/labels.md +19 -14
  24. package/reference/claude-config/skills/knowledge/operations/offerings.md +6 -6
  25. package/reference/claude-config/skills/save/SKILL.md +2 -2
  26. package/reference/claude-config/skills/setup/SKILL.md +1 -1
  27. package/reference/claude-config/skills/tutorial/technical.md +23 -26
  28. package/reference/claude-config/skills/tutorial/vibe-coder.md +9 -9
  29. package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -0
  30. package/reference/cli.mdx +140 -0
  31. package/reference/deployment/provided-features.mdx +29 -15
  32. package/reference/examples/organization-model.ts +1 -1
  33. package/reference/packages/core/src/knowledge/README.md +8 -7
  34. package/reference/packages/core/src/organization-model/README.md +66 -26
  35. package/reference/packages/ui/src/provider/README.md +5 -5
  36. package/reference/scaffold/core/organization-graph.mdx +16 -15
  37. package/reference/scaffold/core/organization-model.mdx +89 -41
  38. package/reference/scaffold/index.mdx +9 -9
  39. package/reference/scaffold/operations/propagation-pipeline.md +3 -3
  40. package/reference/scaffold/operations/scaffold-maintenance.md +11 -11
  41. package/reference/scaffold/recipes/add-a-feature.md +26 -24
  42. package/reference/scaffold/recipes/add-a-resource.md +10 -14
  43. package/reference/scaffold/recipes/customize-crm-actions.md +439 -439
  44. package/reference/scaffold/recipes/customize-knowledge-browser.md +384 -0
  45. package/reference/scaffold/recipes/customize-organization-model.md +72 -44
  46. package/reference/scaffold/recipes/extend-crm.md +40 -39
  47. package/reference/scaffold/recipes/extend-lead-gen.md +15 -16
  48. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +34 -30
  49. package/reference/scaffold/recipes/index.md +13 -12
  50. package/reference/scaffold/recipes/query-the-knowledge-graph.md +200 -0
  51. package/reference/scaffold/reference/contracts.md +362 -99
  52. package/reference/scaffold/reference/feature-registry.md +9 -20
  53. package/reference/scaffold/reference/glossary.md +18 -18
  54. package/reference/scaffold/ui/composition-extensibility.mdx +23 -23
  55. package/reference/scaffold/ui/customization.md +11 -11
  56. package/reference/scaffold/ui/feature-flags-and-gating.md +8 -8
  57. package/reference/scaffold/ui/feature-shell.mdx +19 -19
  58. package/reference/scaffold/ui/recipes.md +29 -28
@@ -9,15 +9,12 @@ interface KnowledgeCodegenNode {
9
9
  links: {
10
10
  nodeId: string;
11
11
  }[];
12
- skills: string[];
13
- domain?: string;
14
12
  ownerIds: string[];
15
13
  updatedAt: string;
16
14
  }
17
15
  interface GenerateKnowledgeNodesOptions {
18
16
  sourceDir: string;
19
17
  outputPath: string;
20
- graphSkillsOutputPath?: string;
21
18
  knowledgeFlagsOutputPath?: string;
22
19
  knowledgeFlagsCliCommand?: string;
23
20
  typeImportPath?: string;
@@ -4,6 +4,22 @@ import { compile } from '@mdx-js/mdx';
4
4
  import remarkGfm from 'remark-gfm';
5
5
 
6
6
  // src/knowledge-codegen.ts
7
+ function targetFromNodeId(nodeId) {
8
+ const [kind, ...idParts] = nodeId.split(":");
9
+ return {
10
+ kind,
11
+ id: idParts.join(":")
12
+ };
13
+ }
14
+ function canonicalizeKnowledgeNodeLinks(node) {
15
+ return {
16
+ ...node,
17
+ links: node.links.map((link) => ({
18
+ target: targetFromNodeId(link.nodeId),
19
+ nodeId: link.nodeId
20
+ }))
21
+ };
22
+ }
7
23
  function listMdxFiles(directory) {
8
24
  return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {
9
25
  const path = join(directory, entry.name);
@@ -161,24 +177,20 @@ function nodeRoutingTerms(node, sourcePath, limit) {
161
177
  node.title,
162
178
  node.summary,
163
179
  node.body,
164
- node.domain ?? "",
165
180
  sourcePath,
166
- ...node.links.map((link) => link.nodeId),
167
- ...node.skills
181
+ ...node.links.map((link) => link.nodeId)
168
182
  ),
169
183
  limit
170
184
  );
171
185
  }
172
186
  function nodeTags(node, sourcePath) {
173
187
  return uniqueSorted([
174
- ...node.domain ? [node.domain] : [],
175
188
  node.kind,
176
189
  ...tokenizeRoutingText(
177
190
  node.title,
178
191
  node.summary,
179
192
  sourcePath,
180
- ...node.links.map((link) => link.nodeId),
181
- ...node.skills
193
+ ...node.links.map((link) => link.nodeId)
182
194
  ).map(slugify).filter((term) => term && !ROUTING_STOPWORDS.has(term) && (term.length >= 3 || term === "ai")).slice(0, 20)
183
195
  ]);
184
196
  }
@@ -205,58 +217,30 @@ function readKnowledgeNodeMdx(filePath) {
205
217
  icon: optionalString(frontmatter, "icon", filePath),
206
218
  body,
207
219
  links: optionalStringArray(frontmatter, "links", filePath).map((nodeId) => ({ nodeId })),
208
- skills: optionalStringArray(frontmatter, "skills", filePath),
209
- domain: optionalString(frontmatter, "domain", filePath),
210
220
  ownerIds: optionalStringArray(frontmatter, "ownerIds", filePath),
211
221
  updatedAt: assertString(frontmatter, "updatedAt", filePath)
212
222
  };
213
223
  }
214
- function generateGraphSkillsRegistry(nodes) {
215
- const domains = {};
216
- for (const node of nodes) {
217
- if (!node.domain) continue;
218
- const domain = domains[node.domain] ?? { skills: [], nodes: [] };
219
- const skills = [...new Set(node.skills)].sort((a, b) => a.localeCompare(b));
220
- domain.nodes.push({
221
- id: node.id,
222
- title: node.title,
223
- kind: node.kind,
224
- skills
225
- });
226
- domain.skills = [.../* @__PURE__ */ new Set([...domain.skills, ...skills])].sort((a, b) => a.localeCompare(b));
227
- domains[node.domain] = domain;
228
- }
229
- for (const domain of Object.values(domains)) {
230
- domain.nodes.sort((a, b) => a.id.localeCompare(b.id));
231
- }
232
- return {
233
- generatedBy: "generate-knowledge-nodes",
234
- domains: Object.fromEntries(Object.entries(domains).sort(([a], [b]) => a.localeCompare(b)))
235
- };
236
- }
237
224
  function generateKnowledgeFlagRegistry(nodes, sourcePaths = {}, options = {}) {
238
225
  const routes = /* @__PURE__ */ new Map();
239
226
  for (const node of nodes) {
240
- const routeKey = node.domain ?? `kind-${node.kind}`;
227
+ const routeKey = `kind-${node.kind}`;
241
228
  const flag = `--${slugify(routeKey)}`;
242
229
  const sourcePath = toRegistryPath(sourcePaths[node.id] ?? "");
243
230
  const routingTerms = nodeRoutingTerms(node, sourcePath, 24);
244
231
  const tags = nodeTags(node, sourcePath);
245
- const skills = uniqueSorted(node.skills);
246
232
  const cliBindings = readCommandForNode(node, options.cliCommand);
247
233
  const route = routes.get(flag) ?? {
248
234
  flag,
249
235
  label: toTitle(routeKey),
250
- ...node.domain ? { domain: node.domain } : { kind: node.kind },
236
+ kind: node.kind,
251
237
  tags: [],
252
238
  queryTerms: [],
253
- skills: [],
254
239
  cliBindings: [],
255
240
  nodes: []
256
241
  };
257
242
  route.tags = uniqueSorted([...route.tags, ...tags]);
258
243
  route.queryTerms = rankedTerms([...route.queryTerms, ...routingTerms], 40);
259
- route.skills = uniqueSorted([...route.skills, ...skills]);
260
244
  route.cliBindings = [...route.cliBindings, ...cliBindings].filter(
261
245
  (binding, index, bindings) => bindings.findIndex((candidate) => candidate.command === binding.command) === index
262
246
  );
@@ -264,12 +248,10 @@ function generateKnowledgeFlagRegistry(nodes, sourcePaths = {}, options = {}) {
264
248
  id: node.id,
265
249
  title: node.title,
266
250
  kind: node.kind,
267
- ...node.domain ? { domain: node.domain } : {},
268
251
  sourcePath,
269
252
  tags,
270
253
  routingTerms,
271
254
  links: node.links.map((link) => link.nodeId),
272
- skills,
273
255
  cliBindings
274
256
  });
275
257
  routes.set(flag, route);
@@ -317,7 +299,7 @@ function generateKnowledgeNodesTs(options) {
317
299
  `// Source: ${options.sourceLabel ?? "knowledge/nodes/**/*.mdx"}`,
318
300
  "",
319
301
  ...typeImport,
320
- `export const ${exportedName} = ${JSON.stringify(options.nodes, null, 2)}${typeSatisfies}`,
302
+ `export const ${exportedName} = ${JSON.stringify(options.nodes.map(canonicalizeKnowledgeNodeLinks), null, 2)}${typeSatisfies}`,
321
303
  ""
322
304
  ].join("\n");
323
305
  }
@@ -345,22 +327,13 @@ function generateKnowledgeNodes(options) {
345
327
  }),
346
328
  "utf8"
347
329
  );
348
- if (options.graphSkillsOutputPath) {
349
- mkdirSync(dirname(options.graphSkillsOutputPath), { recursive: true });
350
- writeFileSync(
351
- options.graphSkillsOutputPath,
352
- `${JSON.stringify(generateGraphSkillsRegistry(nodes), null, 2)}
353
- `,
354
- "utf8"
355
- );
356
- }
357
330
  if (options.knowledgeFlagsOutputPath) {
358
331
  mkdirSync(dirname(options.knowledgeFlagsOutputPath), { recursive: true });
359
332
  writeFileSync(
360
333
  options.knowledgeFlagsOutputPath,
361
334
  `${JSON.stringify(
362
335
  generateKnowledgeFlagRegistry(nodes, sourcePaths, {
363
- cliCommand: options.knowledgeFlagsCliCommand ?? "elevasis-sdk"
336
+ cliCommand: options.knowledgeFlagsCliCommand ?? "elevasis"
364
337
  }),
365
338
  null,
366
339
  2