@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
@@ -0,0 +1,200 @@
1
+ <!-- @generated by packages/sdk/scripts/copy-reference-docs.mjs -- DO NOT EDIT -->
2
+ <!-- Regenerate: pnpm scaffold:sync -->
3
+
4
+ ---
5
+ title: Query the Knowledge Graph
6
+ description: Use the `knowledge:*` CLI subcommands on `elevasis-sdk` (external projects) and `elevasis` (monorepo) to browse, inspect, and traverse the OrganizationModel knowledge graph via five mount axes.
7
+ ---
8
+
9
+ # Query the Knowledge Graph
10
+
11
+ The `knowledge:*` subcommands expose the OrganizationModel as a virtual filesystem. Paths are query strings -- `/by-system/sales/crm/` dispatches to a graph query, not a directory on disk. Three verbs cover all access patterns: `ls` (list), `cat` (read a node body), and `graph` (traverse edges).
12
+
13
+ Both CLIs share the same query layer (`@repo/core/knowledge/queries`). The only difference is which OrganizationModel they load:
14
+
15
+ - `elevasis-sdk` -- runs from inside `external/<project>/`, walks up to `.elevasis`, loads the project's `core/config/organization-model.ts`.
16
+ - `elevasis` -- runs from the monorepo root, loads `canonicalOrganizationModel` from `@repo/elevasis-core`.
17
+
18
+ ## Before you start
19
+
20
+ The `knowledge:*` commands require `elevasis-sdk >= 1.4.0`. Check with:
21
+
22
+ ```bash
23
+ pnpm exec elevasis-sdk --version
24
+ ```
25
+
26
+ If you are running on Windows, **use PowerShell** for all `knowledge:*` commands. MSYS Bash rewrites the leading `/by-system/...` path argument to a Windows filesystem path, mangling the query. PowerShell passes the argument through verbatim.
27
+
28
+ ## Three Verbs
29
+
30
+ | Verb | Behavior |
31
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------- |
32
+ | `knowledge:ls <path>` | List nodes or edges for the mount. Default: id + summary table. `--json` for the wrapped envelope. `--ids-only` for piping. |
33
+ | `knowledge:cat <id>` | Print a node's raw MDX `body` to stdout. |
34
+ | `knowledge:graph <id>` | Show outgoing and incoming edges for a node, grouped by edge kind. |
35
+
36
+ All three accept `--json` for machine-readable output. `knowledge:ls` additionally accepts `--ids-only` to print one node ID per line.
37
+
38
+ ## Five Mount Axes
39
+
40
+ The path argument to `knowledge:ls` determines the query. Five axes are available:
41
+
42
+ | Path prefix | Query | Returns |
43
+ | ------------------------------ | ----------------------------- | --------------------------------------------------- |
44
+ | `/by-system/<dotted-id>/` | `bySystem(graph, systemId)` | nodes with incoming `governs` edges to this system |
45
+ | `/by-kind/<kind>/` | `byKind(graph, kind)` | nodes where `node.kind === kind` |
46
+ | `/by-owner/<id>/` | `byOwner(graph, ownerId)` | nodes where `node.ownerIds.includes(id)` |
47
+ | `/graph/<nodeId>/governs/` | `governs(graph, nodeId)` | outgoing `governs` edges from `nodeId` |
48
+ | `/graph/<nodeId>/governed-by/` | `governedBy(graph, nodeId)` | incoming `governs` edges to `nodeId` |
49
+
50
+ ## Examples
51
+
52
+ Each example is shown for both CLIs.
53
+
54
+ ### 1. List by system (`/by-system/<dotted-id>/`)
55
+
56
+ List all knowledge nodes that govern the `sales.crm` system:
57
+
58
+ ```bash
59
+ # External project (from inside external/<project>/)
60
+ pnpm exec elevasis-sdk knowledge:ls /by-system/sales.crm/
61
+
62
+ # Monorepo (from monorepo root)
63
+ pnpm exec elevasis knowledge:ls /by-system/sales.crm/
64
+ ```
65
+
66
+ Nested system ids use dots, not slashes: `sales.crm`, `sales.lead-gen`, `projects`.
67
+
68
+ ### 2. List by kind (`/by-kind/<kind>/`)
69
+
70
+ List all nodes of kind `playbook`:
71
+
72
+ ```bash
73
+ # External project
74
+ pnpm exec elevasis-sdk knowledge:ls /by-kind/playbook
75
+
76
+ # Monorepo
77
+ pnpm exec elevasis knowledge:ls /by-kind/playbook
78
+ ```
79
+
80
+ Common kinds: `playbook`, `strategy`, and `reference`. The available kinds are defined on `OrgKnowledgeNode.kind` in `@elevasis/core/knowledge`.
81
+
82
+ Machine-readable output for piping:
83
+
84
+ ```bash
85
+ pnpm exec elevasis knowledge:ls /by-kind/playbook --ids-only
86
+ ```
87
+
88
+ ### 3. List by owner (`/by-owner/<id>/`)
89
+
90
+ List all knowledge nodes owned by a specific member or team:
91
+
92
+ ```bash
93
+ # External project
94
+ pnpm exec elevasis-sdk knowledge:ls /by-owner/operations-team
95
+
96
+ # Monorepo
97
+ pnpm exec elevasis knowledge:ls /by-owner/operations-team
98
+ ```
99
+
100
+ The `<id>` matches against `node.ownerIds`. Owner IDs are declared on each knowledge node in the OrganizationModel.
101
+
102
+ ### 4. Traverse outgoing edges (`/graph/<nodeId>/governs/`)
103
+
104
+ List what a specific node governs (outgoing `governs` edges):
105
+
106
+ ```bash
107
+ # External project
108
+ pnpm exec elevasis-sdk knowledge:ls /graph/knowledge.new-vertical-launch-playbook/governs/
109
+
110
+ # Monorepo
111
+ pnpm exec elevasis knowledge:ls /graph/knowledge.new-vertical-launch-playbook/governs/
112
+ ```
113
+
114
+ Knowledge node IDs use the `knowledge.<slug>` source id. Graph node IDs may be kind-prefixed,
115
+ such as `knowledge:knowledge.new-vertical-launch-playbook` or `system:sales.crm`, when traversing
116
+ graph edges.
117
+
118
+ ### 5. Traverse incoming edges (`/graph/<nodeId>/governed-by/`)
119
+
120
+ List what governs a specific node (incoming `governs` edges):
121
+
122
+ ```bash
123
+ # External project
124
+ pnpm exec elevasis-sdk knowledge:ls /graph/knowledge.new-vertical-launch-playbook/governed-by/
125
+
126
+ # Monorepo
127
+ pnpm exec elevasis knowledge:ls /graph/knowledge.new-vertical-launch-playbook/governed-by/
128
+ ```
129
+
130
+ ## Read a Node Body
131
+
132
+ `knowledge:cat` prints the raw MDX `body` string for a node. The body is not rendered -- it is the source MDX as stored in the OrganizationModel.
133
+
134
+ ```bash
135
+ # External project
136
+ pnpm exec elevasis-sdk knowledge:cat knowledge.new-vertical-launch-playbook
137
+
138
+ # Monorepo
139
+ pnpm exec elevasis knowledge:cat knowledge.new-vertical-launch-playbook
140
+ ```
141
+
142
+ Pipe to a pager for long bodies:
143
+
144
+ ```bash
145
+ pnpm exec elevasis knowledge:cat knowledge.platform-composition-patterns | less
146
+ ```
147
+
148
+ ## Inspect a Node's Edges
149
+
150
+ `knowledge:graph` shows all edges for a node grouped by kind:
151
+
152
+ ```bash
153
+ # External project
154
+ pnpm exec elevasis-sdk knowledge:graph knowledge.new-vertical-launch-playbook
155
+
156
+ # Monorepo
157
+ pnpm exec elevasis knowledge:graph knowledge.new-vertical-launch-playbook
158
+ ```
159
+
160
+ This combines the `governs` and `governed-by` views in one output, useful for understanding a node's full graph position.
161
+
162
+ ## JSON Output
163
+
164
+ All three verbs accept `--json`. The output uses the wrapped envelope format:
165
+
166
+ ```json
167
+ {
168
+ "path": "/by-system/sales.crm",
169
+ "mount": "by-system",
170
+ "args": ["sales.crm"],
171
+ "results": [...]
172
+ }
173
+ ```
174
+
175
+ This is the format consumed by the `/knowledge` agent skill. Use it when scripting or building tooling that reads knowledge graph data programmatically.
176
+
177
+ ```bash
178
+ pnpm exec elevasis knowledge:ls /by-kind/playbook --json | jq '.results[].id'
179
+ ```
180
+
181
+ ## Windows Note
182
+
183
+ On Windows, MSYS Bash rewrites path arguments starting with `/` to Windows filesystem paths before the CLI sees them. Use PowerShell:
184
+
185
+ ```powershell
186
+ # Correct on Windows -- PowerShell leaves the path arg intact
187
+ pnpm exec elevasis knowledge:ls /by-kind/playbook
188
+
189
+ # Wrong on Windows -- MSYS Bash mangles to C:\by-kind\playbook or similar
190
+ bash -c "pnpm exec elevasis knowledge:ls /by-kind/playbook"
191
+ ```
192
+
193
+ All other `elevasis` and `elevasis-sdk` commands are unaffected; this gotcha is specific to path arguments that start with `/`.
194
+
195
+ ## See Also
196
+
197
+ - [Query functions API](../reference/contracts.md) -- `bySystem`, `byKind`, `byOwner`, `governs`, `governedBy` TypeScript signatures
198
+ - [Glossary](../reference/glossary.md) -- `systemId`, `nodeId`, `kind`, `ownerIds`
199
+ - [Knowledge Browser](../../../../apps/docs/content/docs/in-progress/active-development/sdk-changes/knowledge/index.mdx) -- task doc for the full Knowledge Map bundle
200
+