@elevasis/sdk 1.22.1 → 1.23.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 +681 -29
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -3
- package/dist/test-utils/index.d.ts +1 -0
- package/dist/test-utils/index.js +4 -3
- package/dist/worker/index.js +4 -3
- package/package.json +2 -2
- package/reference/claude-config/rules/organization-model.md +77 -80
- package/reference/claude-config/rules/organization-os.md +104 -104
- package/reference/claude-config/rules/vibe.md +235 -235
- package/reference/claude-config/skills/om/SKILL.md +324 -0
- package/reference/claude-config/skills/{knowledge → om}/operations/customers.md +110 -109
- package/reference/claude-config/skills/{knowledge → om}/operations/features.md +77 -76
- package/reference/claude-config/skills/{knowledge → om}/operations/goals.md +119 -118
- package/reference/claude-config/skills/{knowledge → om}/operations/identity.md +94 -93
- package/reference/claude-config/skills/{knowledge → om}/operations/labels.md +94 -94
- package/reference/claude-config/skills/{knowledge → om}/operations/offerings.md +110 -109
- package/reference/claude-config/skills/{knowledge → om}/operations/roles.md +100 -99
- package/reference/claude-config/skills/{knowledge → om}/operations/techStack.md +30 -30
- package/reference/claude-config/skills/project/SKILL.md +1088 -1088
- package/reference/claude-config/skills/setup/SKILL.md +275 -275
- package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
- package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
- package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
- package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
- package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +52 -0
- package/reference/scaffold/recipes/query-the-knowledge-graph.md +189 -185
- package/reference/scaffold/reference/contracts.md +94 -94
- package/reference/scaffold/reference/glossary.md +71 -69
- package/reference/claude-config/skills/knowledge/SKILL.md +0 -345
- /package/reference/claude-config/skills/{knowledge → om}/operations/codify-level-a.md +0 -0
- /package/reference/claude-config/skills/{knowledge → om}/operations/codify-level-b.md +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -5246,7 +5246,7 @@ var require_buffer_list = __commonJS({
|
|
|
5246
5246
|
}
|
|
5247
5247
|
}, {
|
|
5248
5248
|
key: "join",
|
|
5249
|
-
value: function
|
|
5249
|
+
value: function join7(s) {
|
|
5250
5250
|
if (this.length === 0) return "";
|
|
5251
5251
|
var p = this.head;
|
|
5252
5252
|
var ret = "" + p.data;
|
|
@@ -10756,10 +10756,10 @@ var require_schemas = __commonJS({
|
|
|
10756
10756
|
const shape = def.shape;
|
|
10757
10757
|
const propValues = {};
|
|
10758
10758
|
for (const key in shape) {
|
|
10759
|
-
const
|
|
10760
|
-
if (
|
|
10759
|
+
const field2 = shape[key]._zod;
|
|
10760
|
+
if (field2.values) {
|
|
10761
10761
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
10762
|
-
for (const v of
|
|
10762
|
+
for (const v of field2.values)
|
|
10763
10763
|
propValues[key].add(v);
|
|
10764
10764
|
}
|
|
10765
10765
|
}
|
|
@@ -26924,10 +26924,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
26924
26924
|
const shape = def.shape;
|
|
26925
26925
|
const propValues = {};
|
|
26926
26926
|
for (const key in shape) {
|
|
26927
|
-
const
|
|
26928
|
-
if (
|
|
26927
|
+
const field2 = shape[key]._zod;
|
|
26928
|
+
if (field2.values) {
|
|
26929
26929
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
26930
|
-
for (const v of
|
|
26930
|
+
for (const v of field2.values)
|
|
26931
26931
|
propValues[key].add(v);
|
|
26932
26932
|
}
|
|
26933
26933
|
}
|
|
@@ -36620,6 +36620,7 @@ var ORGANIZATION_MODEL_ICON_TOKENS = [
|
|
|
36620
36620
|
"crm",
|
|
36621
36621
|
"lead-gen",
|
|
36622
36622
|
"projects",
|
|
36623
|
+
"clients",
|
|
36623
36624
|
"operations",
|
|
36624
36625
|
"monitoring",
|
|
36625
36626
|
"knowledge",
|
|
@@ -39553,9 +39554,9 @@ function getModelInfo(model) {
|
|
|
39553
39554
|
|
|
39554
39555
|
// ../core/src/execution/engine/llm/errors.ts
|
|
39555
39556
|
var ModelConfigError = class extends ExecutionError {
|
|
39556
|
-
constructor(message,
|
|
39557
|
-
super(message, { ...context, field, model });
|
|
39558
|
-
this.field =
|
|
39557
|
+
constructor(message, field2, model, context) {
|
|
39558
|
+
super(message, { ...context, field: field2, model });
|
|
39559
|
+
this.field = field2;
|
|
39559
39560
|
this.model = model;
|
|
39560
39561
|
}
|
|
39561
39562
|
type = "model_config_error";
|
|
@@ -39585,11 +39586,11 @@ function validateModelConfig(config3) {
|
|
|
39585
39586
|
|
|
39586
39587
|
// ../core/src/platform/registry/validation.ts
|
|
39587
39588
|
var RegistryValidationError = class extends Error {
|
|
39588
|
-
constructor(orgName, resourceId,
|
|
39589
|
+
constructor(orgName, resourceId, field2, message) {
|
|
39589
39590
|
super(message);
|
|
39590
39591
|
this.orgName = orgName;
|
|
39591
39592
|
this.resourceId = resourceId;
|
|
39592
|
-
this.field =
|
|
39593
|
+
this.field = field2;
|
|
39593
39594
|
this.name = "RegistryValidationError";
|
|
39594
39595
|
}
|
|
39595
39596
|
};
|
|
@@ -39936,9 +39937,9 @@ function validateExecutionInterface(orgName, resourceId, executionInterface, inp
|
|
|
39936
39937
|
}
|
|
39937
39938
|
const schemaFieldNames = Object.keys(schemaShape);
|
|
39938
39939
|
const formToSchemaMap = /* @__PURE__ */ new Map();
|
|
39939
|
-
for (const
|
|
39940
|
-
const schemaKey = fieldMappings[
|
|
39941
|
-
formToSchemaMap.set(
|
|
39940
|
+
for (const field2 of form.fields) {
|
|
39941
|
+
const schemaKey = fieldMappings[field2.name] ?? field2.name;
|
|
39942
|
+
formToSchemaMap.set(field2.name, schemaKey);
|
|
39942
39943
|
}
|
|
39943
39944
|
for (const schemaFieldName of schemaFieldNames) {
|
|
39944
39945
|
const schemaField = schemaShape[schemaFieldName];
|
|
@@ -43422,7 +43423,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
43422
43423
|
business: {
|
|
43423
43424
|
type: "group",
|
|
43424
43425
|
label: "Business",
|
|
43425
|
-
icon: "
|
|
43426
|
+
icon: "briefcase",
|
|
43426
43427
|
order: 20,
|
|
43427
43428
|
children: {
|
|
43428
43429
|
sales: {
|
|
@@ -43439,7 +43440,7 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
43439
43440
|
label: "Clients",
|
|
43440
43441
|
path: "/clients",
|
|
43441
43442
|
surfaceType: "list",
|
|
43442
|
-
icon: "
|
|
43443
|
+
icon: "clients",
|
|
43443
43444
|
order: 20,
|
|
43444
43445
|
targets: { systems: ["clients"] }
|
|
43445
43446
|
},
|
|
@@ -43813,7 +43814,7 @@ var DEFAULT_ORGANIZATION_MODEL = {
|
|
|
43813
43814
|
enabled: true,
|
|
43814
43815
|
lifecycle: "active",
|
|
43815
43816
|
color: "orange",
|
|
43816
|
-
icon: "
|
|
43817
|
+
icon: "clients",
|
|
43817
43818
|
path: "/clients"
|
|
43818
43819
|
},
|
|
43819
43820
|
operations: {
|
|
@@ -45334,7 +45335,7 @@ function wrapAction(commandName, fn) {
|
|
|
45334
45335
|
// package.json
|
|
45335
45336
|
var package_default = {
|
|
45336
45337
|
name: "@elevasis/sdk",
|
|
45337
|
-
version: "1.
|
|
45338
|
+
version: "1.23.0",
|
|
45338
45339
|
description: "SDK for building Elevasis organization resources",
|
|
45339
45340
|
type: "module",
|
|
45340
45341
|
bin: {
|
|
@@ -48039,6 +48040,425 @@ function parsePath(pathString) {
|
|
|
48039
48040
|
`parsePath: unrecognized path pattern "${pathString}". Supported: /by-system/<id>, /by-kind/<kind>, /by-owner/<id>, /graph/<nodeId>/governs, /graph/<nodeId>/governed-by, /<nodeId>`
|
|
48040
48041
|
);
|
|
48041
48042
|
}
|
|
48043
|
+
function omSearch(model, query, options = {}) {
|
|
48044
|
+
const limit = options.limit ?? 10;
|
|
48045
|
+
const kinds = options.kinds ? new Set(options.kinds) : null;
|
|
48046
|
+
const terms = tokenize(query);
|
|
48047
|
+
if (terms.length === 0) return [];
|
|
48048
|
+
const entries = collectSearchable(model, kinds);
|
|
48049
|
+
const scored = [];
|
|
48050
|
+
for (const entry of entries) {
|
|
48051
|
+
const score = scoreEntry(entry, terms);
|
|
48052
|
+
if (score > 0) {
|
|
48053
|
+
scored.push({
|
|
48054
|
+
kind: entry.kind,
|
|
48055
|
+
id: entry.id,
|
|
48056
|
+
title: entry.title,
|
|
48057
|
+
summary: entry.summary,
|
|
48058
|
+
score,
|
|
48059
|
+
subKind: entry.subKind
|
|
48060
|
+
});
|
|
48061
|
+
}
|
|
48062
|
+
}
|
|
48063
|
+
scored.sort((a, b) => b.score - a.score || a.id.localeCompare(b.id));
|
|
48064
|
+
return limit > 0 ? scored.slice(0, limit) : scored;
|
|
48065
|
+
}
|
|
48066
|
+
function tokenize(query) {
|
|
48067
|
+
return query.toLowerCase().split(/[\s,/]+/).map((t) => t.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g, "")).filter((t) => t.length >= 2);
|
|
48068
|
+
}
|
|
48069
|
+
function structuralTokens(text) {
|
|
48070
|
+
return new Set(
|
|
48071
|
+
text.toLowerCase().split(/[\s.\-_:/,;]+/).map((t) => t.replace(/^[^a-z0-9]+|[^a-z0-9]+$/g, "")).filter((t) => t.length >= 2)
|
|
48072
|
+
);
|
|
48073
|
+
}
|
|
48074
|
+
function setsEqual(a, b) {
|
|
48075
|
+
if (a.size !== b.size) return false;
|
|
48076
|
+
for (const item of a) if (!b.has(item)) return false;
|
|
48077
|
+
return true;
|
|
48078
|
+
}
|
|
48079
|
+
function countOccurrences(haystack, needle) {
|
|
48080
|
+
if (!haystack || !needle) return 0;
|
|
48081
|
+
const lower = haystack.toLowerCase();
|
|
48082
|
+
let count = 0;
|
|
48083
|
+
let idx = 0;
|
|
48084
|
+
while ((idx = lower.indexOf(needle, idx)) !== -1) {
|
|
48085
|
+
count++;
|
|
48086
|
+
idx += needle.length;
|
|
48087
|
+
}
|
|
48088
|
+
return count;
|
|
48089
|
+
}
|
|
48090
|
+
var KIND_BOOST = {
|
|
48091
|
+
system: 5,
|
|
48092
|
+
resource: 3,
|
|
48093
|
+
role: 3,
|
|
48094
|
+
policy: 3,
|
|
48095
|
+
ontology: 1,
|
|
48096
|
+
knowledge: 0
|
|
48097
|
+
};
|
|
48098
|
+
function scoreEntry(entry, terms) {
|
|
48099
|
+
let total = 0;
|
|
48100
|
+
const idLower = entry.id.toLowerCase();
|
|
48101
|
+
for (const term of terms) {
|
|
48102
|
+
for (const text of entry.high) total += 8 * countOccurrences(text, term);
|
|
48103
|
+
for (const text of entry.mid) total += 4 * countOccurrences(text, term);
|
|
48104
|
+
for (const text of entry.meta) total += 3 * countOccurrences(text, term);
|
|
48105
|
+
for (const text of entry.low) total += 1 * countOccurrences(text, term);
|
|
48106
|
+
}
|
|
48107
|
+
if (total === 0) return 0;
|
|
48108
|
+
const queryTokenSet = new Set(terms);
|
|
48109
|
+
if (terms.length === 1 && idLower === terms[0]) total += 50;
|
|
48110
|
+
const titleTokens = structuralTokens(entry.title);
|
|
48111
|
+
if (setsEqual(queryTokenSet, titleTokens)) total += 25;
|
|
48112
|
+
const lastSegment = idLower.split(".").pop() ?? idLower;
|
|
48113
|
+
if (setsEqual(queryTokenSet, structuralTokens(lastSegment))) total += 20;
|
|
48114
|
+
if (terms.every((t) => idLower.includes(t))) total += 5;
|
|
48115
|
+
total += KIND_BOOST[entry.kind];
|
|
48116
|
+
return total;
|
|
48117
|
+
}
|
|
48118
|
+
function collectSearchable(model, kinds) {
|
|
48119
|
+
const entries = [];
|
|
48120
|
+
const include = (kind) => kinds === null || kinds.has(kind);
|
|
48121
|
+
if (include("knowledge")) {
|
|
48122
|
+
for (const node of Object.values(model.knowledge ?? {})) {
|
|
48123
|
+
entries.push({
|
|
48124
|
+
kind: "knowledge",
|
|
48125
|
+
id: node.id,
|
|
48126
|
+
title: node.title,
|
|
48127
|
+
summary: node.summary,
|
|
48128
|
+
subKind: node.kind,
|
|
48129
|
+
high: [node.id, node.title],
|
|
48130
|
+
mid: [node.summary],
|
|
48131
|
+
meta: [node.kind, ...node.ownerIds ?? []],
|
|
48132
|
+
low: [node.body]
|
|
48133
|
+
});
|
|
48134
|
+
}
|
|
48135
|
+
}
|
|
48136
|
+
if (include("system")) {
|
|
48137
|
+
for (const { path: path3, system } of listAllSystems(model)) {
|
|
48138
|
+
const title = system.label ?? system.title ?? path3;
|
|
48139
|
+
const description = system.description ?? "";
|
|
48140
|
+
entries.push({
|
|
48141
|
+
kind: "system",
|
|
48142
|
+
id: path3,
|
|
48143
|
+
title,
|
|
48144
|
+
summary: description,
|
|
48145
|
+
subKind: system.kind,
|
|
48146
|
+
high: [path3, title],
|
|
48147
|
+
mid: [description],
|
|
48148
|
+
meta: [system.kind ?? "", system.lifecycle ?? "", system.responsibleRoleId ?? ""],
|
|
48149
|
+
low: []
|
|
48150
|
+
});
|
|
48151
|
+
if (include("ontology") && system.ontology) {
|
|
48152
|
+
entries.push(...collectOntologyEntries(system.ontology));
|
|
48153
|
+
}
|
|
48154
|
+
}
|
|
48155
|
+
} else if (include("ontology")) {
|
|
48156
|
+
for (const { system } of listAllSystems(model)) {
|
|
48157
|
+
if (system.ontology) entries.push(...collectOntologyEntries(system.ontology));
|
|
48158
|
+
}
|
|
48159
|
+
}
|
|
48160
|
+
if (include("ontology") && model.ontology) {
|
|
48161
|
+
entries.push(...collectOntologyEntries(model.ontology));
|
|
48162
|
+
}
|
|
48163
|
+
if (include("resource")) {
|
|
48164
|
+
for (const resource of Object.values(model.resources ?? {})) {
|
|
48165
|
+
const title = resource.title ?? resource.id;
|
|
48166
|
+
const description = resource.description ?? "";
|
|
48167
|
+
entries.push({
|
|
48168
|
+
kind: "resource",
|
|
48169
|
+
id: resource.id,
|
|
48170
|
+
title,
|
|
48171
|
+
summary: description,
|
|
48172
|
+
subKind: resource.kind,
|
|
48173
|
+
high: [resource.id, title],
|
|
48174
|
+
mid: [description],
|
|
48175
|
+
meta: [resource.kind, resource.systemPath, resource.status, resource.ownerRoleId ?? ""],
|
|
48176
|
+
low: []
|
|
48177
|
+
});
|
|
48178
|
+
}
|
|
48179
|
+
}
|
|
48180
|
+
if (include("role")) {
|
|
48181
|
+
for (const role of Object.values(model.roles ?? {})) {
|
|
48182
|
+
const responsibilities = role.responsibilities ?? [];
|
|
48183
|
+
entries.push({
|
|
48184
|
+
kind: "role",
|
|
48185
|
+
id: role.id,
|
|
48186
|
+
title: role.title,
|
|
48187
|
+
summary: responsibilities[0] ?? "",
|
|
48188
|
+
high: [role.id, role.title],
|
|
48189
|
+
mid: [],
|
|
48190
|
+
meta: responsibilities,
|
|
48191
|
+
low: []
|
|
48192
|
+
});
|
|
48193
|
+
}
|
|
48194
|
+
}
|
|
48195
|
+
if (include("policy")) {
|
|
48196
|
+
for (const policy of Object.values(model.policies ?? {})) {
|
|
48197
|
+
const description = policy.description ?? "";
|
|
48198
|
+
entries.push({
|
|
48199
|
+
kind: "policy",
|
|
48200
|
+
id: policy.id,
|
|
48201
|
+
title: policy.label,
|
|
48202
|
+
summary: description,
|
|
48203
|
+
subKind: policy.trigger?.kind,
|
|
48204
|
+
high: [policy.id, policy.label],
|
|
48205
|
+
mid: [description],
|
|
48206
|
+
meta: [policy.trigger?.kind ?? ""],
|
|
48207
|
+
low: []
|
|
48208
|
+
});
|
|
48209
|
+
}
|
|
48210
|
+
}
|
|
48211
|
+
return entries;
|
|
48212
|
+
}
|
|
48213
|
+
function collectOntologyEntries(scope) {
|
|
48214
|
+
const entries = [];
|
|
48215
|
+
const buckets = [
|
|
48216
|
+
["object", scope.objectTypes],
|
|
48217
|
+
["link", scope.linkTypes],
|
|
48218
|
+
["action", scope.actionTypes],
|
|
48219
|
+
["catalog", scope.catalogTypes],
|
|
48220
|
+
["event", scope.eventTypes],
|
|
48221
|
+
["interface", scope.interfaceTypes],
|
|
48222
|
+
["value-type", scope.valueTypes],
|
|
48223
|
+
["property", scope.sharedProperties],
|
|
48224
|
+
["group", scope.groups],
|
|
48225
|
+
["surface", scope.surfaces]
|
|
48226
|
+
];
|
|
48227
|
+
for (const [subKind, records] of buckets) {
|
|
48228
|
+
if (!records) continue;
|
|
48229
|
+
for (const [recordId, record2] of Object.entries(records)) {
|
|
48230
|
+
const id = record2.id ?? recordId;
|
|
48231
|
+
const title = record2.label ?? id;
|
|
48232
|
+
const description = record2.description ?? "";
|
|
48233
|
+
entries.push({
|
|
48234
|
+
kind: "ontology",
|
|
48235
|
+
id,
|
|
48236
|
+
title,
|
|
48237
|
+
summary: description,
|
|
48238
|
+
subKind,
|
|
48239
|
+
high: [id, title],
|
|
48240
|
+
mid: [description],
|
|
48241
|
+
meta: [subKind],
|
|
48242
|
+
low: []
|
|
48243
|
+
});
|
|
48244
|
+
}
|
|
48245
|
+
}
|
|
48246
|
+
return entries;
|
|
48247
|
+
}
|
|
48248
|
+
function detectKind(model, id) {
|
|
48249
|
+
if (/:(object|action|event|catalog|link|interface|value-type|property|group|surface)\//.test(id)) {
|
|
48250
|
+
return "ontology";
|
|
48251
|
+
}
|
|
48252
|
+
if (id.startsWith("knowledge.")) return "knowledge";
|
|
48253
|
+
if (id.startsWith("role.")) return "role";
|
|
48254
|
+
if (id.startsWith("policy.")) return "policy";
|
|
48255
|
+
if (model.systems && getSystemByPath(model.systems, id)) return "system";
|
|
48256
|
+
if (model.resources?.[id]) return "resource";
|
|
48257
|
+
return void 0;
|
|
48258
|
+
}
|
|
48259
|
+
function getSystemByPath(systems, path3) {
|
|
48260
|
+
const segments = path3.split(".");
|
|
48261
|
+
let current = systems;
|
|
48262
|
+
for (const seg of segments) {
|
|
48263
|
+
const node = current[seg];
|
|
48264
|
+
if (node === void 0 || typeof node !== "object" || node === null) return void 0;
|
|
48265
|
+
const next = node;
|
|
48266
|
+
if (seg === segments[segments.length - 1]) return next;
|
|
48267
|
+
current = next.systems ?? next.subsystems ?? {};
|
|
48268
|
+
}
|
|
48269
|
+
return void 0;
|
|
48270
|
+
}
|
|
48271
|
+
function omDescribe(model, id) {
|
|
48272
|
+
const kind = detectKind(model, id);
|
|
48273
|
+
if (kind === void 0) return void 0;
|
|
48274
|
+
switch (kind) {
|
|
48275
|
+
case "system":
|
|
48276
|
+
return describeSystem(model, id);
|
|
48277
|
+
case "resource":
|
|
48278
|
+
return describeResource(model, id);
|
|
48279
|
+
case "knowledge":
|
|
48280
|
+
return describeKnowledge(model, id);
|
|
48281
|
+
case "ontology":
|
|
48282
|
+
return describeOntology(model, id);
|
|
48283
|
+
case "role":
|
|
48284
|
+
return describeRole(model, id);
|
|
48285
|
+
case "policy":
|
|
48286
|
+
return describePolicy(model, id);
|
|
48287
|
+
}
|
|
48288
|
+
}
|
|
48289
|
+
function describeSystem(model, path3) {
|
|
48290
|
+
const allSystems = listAllSystems(model);
|
|
48291
|
+
const match = allSystems.find((s) => s.path === path3);
|
|
48292
|
+
if (!match) return void 0;
|
|
48293
|
+
const { system } = match;
|
|
48294
|
+
const prefix = path3 + ".";
|
|
48295
|
+
const childSystemPaths = allSystems.filter((s) => s.path.startsWith(prefix) && !s.path.slice(prefix.length).includes(".")).map((s) => s.path);
|
|
48296
|
+
const resources = Object.values(model.resources ?? {}).filter((r) => r.systemPath === path3);
|
|
48297
|
+
const resourceCountsByKind = {};
|
|
48298
|
+
const resourceIdsByKind = {};
|
|
48299
|
+
for (const r of resources) {
|
|
48300
|
+
resourceCountsByKind[r.kind] = (resourceCountsByKind[r.kind] ?? 0) + 1;
|
|
48301
|
+
if (!resourceIdsByKind[r.kind]) resourceIdsByKind[r.kind] = [];
|
|
48302
|
+
resourceIdsByKind[r.kind].push(r.id);
|
|
48303
|
+
}
|
|
48304
|
+
const governingKnowledgeIds = [];
|
|
48305
|
+
for (const node of Object.values(model.knowledge ?? {})) {
|
|
48306
|
+
if ((node.links ?? []).some((link) => link.nodeId === `system:${path3}`)) {
|
|
48307
|
+
governingKnowledgeIds.push(node.id);
|
|
48308
|
+
}
|
|
48309
|
+
}
|
|
48310
|
+
const ontologyCountsByKind = {};
|
|
48311
|
+
const ontology = system.ontology;
|
|
48312
|
+
if (ontology) {
|
|
48313
|
+
const buckets = [
|
|
48314
|
+
["object", ontology.objectTypes],
|
|
48315
|
+
["action", ontology.actionTypes],
|
|
48316
|
+
["event", ontology.eventTypes],
|
|
48317
|
+
["catalog", ontology.catalogTypes],
|
|
48318
|
+
["link", ontology.linkTypes],
|
|
48319
|
+
["interface", ontology.interfaceTypes],
|
|
48320
|
+
["value-type", ontology.valueTypes],
|
|
48321
|
+
["property", ontology.sharedProperties],
|
|
48322
|
+
["group", ontology.groups],
|
|
48323
|
+
["surface", ontology.surfaces]
|
|
48324
|
+
];
|
|
48325
|
+
for (const [k, records] of buckets) {
|
|
48326
|
+
const count = records ? Object.keys(records).length : 0;
|
|
48327
|
+
if (count > 0) ontologyCountsByKind[k] = count;
|
|
48328
|
+
}
|
|
48329
|
+
}
|
|
48330
|
+
return {
|
|
48331
|
+
kind: "system",
|
|
48332
|
+
id: path3,
|
|
48333
|
+
label: system.label ?? system.title ?? path3,
|
|
48334
|
+
description: system.description ?? "",
|
|
48335
|
+
systemKind: system.kind,
|
|
48336
|
+
lifecycle: system.lifecycle,
|
|
48337
|
+
parentSystemId: system.parentSystemId,
|
|
48338
|
+
responsibleRoleId: system.responsibleRoleId,
|
|
48339
|
+
childSystemPaths,
|
|
48340
|
+
governingKnowledgeIds,
|
|
48341
|
+
resourceCountsByKind,
|
|
48342
|
+
resourceIdsByKind,
|
|
48343
|
+
ontologyCountsByKind
|
|
48344
|
+
};
|
|
48345
|
+
}
|
|
48346
|
+
function describeResource(model, id) {
|
|
48347
|
+
const r = model.resources?.[id];
|
|
48348
|
+
if (!r) return void 0;
|
|
48349
|
+
return {
|
|
48350
|
+
kind: "resource",
|
|
48351
|
+
id: r.id,
|
|
48352
|
+
resourceKind: r.kind,
|
|
48353
|
+
systemPath: r.systemPath,
|
|
48354
|
+
title: r.title ?? r.id,
|
|
48355
|
+
description: r.description ?? "",
|
|
48356
|
+
status: r.status,
|
|
48357
|
+
ownerRoleId: r.ownerRoleId,
|
|
48358
|
+
ontology: r.ontology ? {
|
|
48359
|
+
primaryAction: r.ontology.primaryAction,
|
|
48360
|
+
actions: r.ontology.actions,
|
|
48361
|
+
reads: r.ontology.reads,
|
|
48362
|
+
writes: r.ontology.writes,
|
|
48363
|
+
emits: r.ontology.emits,
|
|
48364
|
+
usesCatalogs: r.ontology.usesCatalogs
|
|
48365
|
+
} : void 0,
|
|
48366
|
+
codeRefPaths: (r.codeRefs ?? []).map((c) => c.path)
|
|
48367
|
+
};
|
|
48368
|
+
}
|
|
48369
|
+
function describeKnowledge(model, id) {
|
|
48370
|
+
const node = model.knowledge?.[id];
|
|
48371
|
+
if (!node) return void 0;
|
|
48372
|
+
const bodyLines = node.body.split("\n");
|
|
48373
|
+
const bodyExcerpt = bodyLines.slice(0, 6).join("\n") + (bodyLines.length > 6 ? "\n..." : "");
|
|
48374
|
+
return {
|
|
48375
|
+
kind: "knowledge",
|
|
48376
|
+
id: node.id,
|
|
48377
|
+
knowledgeKind: node.kind,
|
|
48378
|
+
title: node.title,
|
|
48379
|
+
summary: node.summary,
|
|
48380
|
+
bodyExcerpt,
|
|
48381
|
+
bodyLineCount: bodyLines.length,
|
|
48382
|
+
ownerIds: node.ownerIds ?? [],
|
|
48383
|
+
governs: (node.links ?? []).map((link) => link.nodeId),
|
|
48384
|
+
updatedAt: node.updatedAt
|
|
48385
|
+
};
|
|
48386
|
+
}
|
|
48387
|
+
function describeOntology(model, id) {
|
|
48388
|
+
const parsed = id.match(/^([^:]+):([a-z-]+)\/(.+)$/);
|
|
48389
|
+
if (!parsed) return void 0;
|
|
48390
|
+
const [, scope, ontologyKind, localId] = parsed;
|
|
48391
|
+
const buckets = [
|
|
48392
|
+
["object", "objectTypes"],
|
|
48393
|
+
["action", "actionTypes"],
|
|
48394
|
+
["event", "eventTypes"],
|
|
48395
|
+
["catalog", "catalogTypes"],
|
|
48396
|
+
["link", "linkTypes"],
|
|
48397
|
+
["interface", "interfaceTypes"],
|
|
48398
|
+
["value-type", "valueTypes"],
|
|
48399
|
+
["property", "sharedProperties"],
|
|
48400
|
+
["group", "groups"],
|
|
48401
|
+
["surface", "surfaces"]
|
|
48402
|
+
];
|
|
48403
|
+
const bucketKey = buckets.find((b) => b[0] === ontologyKind)?.[1];
|
|
48404
|
+
if (!bucketKey) return void 0;
|
|
48405
|
+
function findIn(scopeObj) {
|
|
48406
|
+
if (!scopeObj) return void 0;
|
|
48407
|
+
const records = scopeObj[bucketKey];
|
|
48408
|
+
return records?.[id];
|
|
48409
|
+
}
|
|
48410
|
+
let record2;
|
|
48411
|
+
for (const { system } of listAllSystems(model)) {
|
|
48412
|
+
record2 = findIn(system.ontology);
|
|
48413
|
+
if (record2) break;
|
|
48414
|
+
}
|
|
48415
|
+
if (!record2) record2 = findIn(model.ontology);
|
|
48416
|
+
if (!record2) return void 0;
|
|
48417
|
+
const governingKnowledgeIds = [];
|
|
48418
|
+
for (const node of Object.values(model.knowledge ?? {})) {
|
|
48419
|
+
if ((node.links ?? []).some((link) => link.nodeId === `ontology:${id}`)) {
|
|
48420
|
+
governingKnowledgeIds.push(node.id);
|
|
48421
|
+
}
|
|
48422
|
+
}
|
|
48423
|
+
return {
|
|
48424
|
+
kind: "ontology",
|
|
48425
|
+
id,
|
|
48426
|
+
ontologyKind,
|
|
48427
|
+
scope,
|
|
48428
|
+
localId,
|
|
48429
|
+
label: record2.label ?? id,
|
|
48430
|
+
description: record2.description ?? "",
|
|
48431
|
+
governingKnowledgeIds
|
|
48432
|
+
};
|
|
48433
|
+
}
|
|
48434
|
+
function describeRole(model, id) {
|
|
48435
|
+
const role = model.roles?.[id];
|
|
48436
|
+
if (!role) return void 0;
|
|
48437
|
+
return {
|
|
48438
|
+
kind: "role",
|
|
48439
|
+
id: role.id,
|
|
48440
|
+
title: role.title,
|
|
48441
|
+
responsibilities: role.responsibilities ?? [],
|
|
48442
|
+
responsibleFor: role.responsibleFor ?? [],
|
|
48443
|
+
reportsToId: role.reportsToId
|
|
48444
|
+
};
|
|
48445
|
+
}
|
|
48446
|
+
function describePolicy(model, id) {
|
|
48447
|
+
const policy = model.policies?.[id];
|
|
48448
|
+
if (!policy) return void 0;
|
|
48449
|
+
return {
|
|
48450
|
+
kind: "policy",
|
|
48451
|
+
id: policy.id,
|
|
48452
|
+
label: policy.label,
|
|
48453
|
+
description: policy.description ?? "",
|
|
48454
|
+
triggerKind: policy.trigger?.kind ?? "unknown",
|
|
48455
|
+
appliesToSystemIds: policy.appliesTo?.systemIds ?? [],
|
|
48456
|
+
appliesToActionIds: policy.appliesTo?.actionIds ?? [],
|
|
48457
|
+
appliesToResourceIds: policy.appliesTo?.resourceIds ?? [],
|
|
48458
|
+
appliesToRoleIds: policy.appliesTo?.roleIds ?? [],
|
|
48459
|
+
effectKinds: (policy.actions ?? []).map((a) => a.kind)
|
|
48460
|
+
};
|
|
48461
|
+
}
|
|
48042
48462
|
|
|
48043
48463
|
// ../core/src/knowledge/format.ts
|
|
48044
48464
|
function formatText(results) {
|
|
@@ -48069,6 +48489,159 @@ function formatIdsOnly(results) {
|
|
|
48069
48489
|
const ids = results.map((r) => typeof r === "string" ? r : r.id);
|
|
48070
48490
|
return ids.join("\n");
|
|
48071
48491
|
}
|
|
48492
|
+
function formatOmSearchHits(hits) {
|
|
48493
|
+
if (hits.length === 0) return "(no results)";
|
|
48494
|
+
const kindWidth = Math.max(...hits.map((h) => labelForKind(h).length), 6);
|
|
48495
|
+
const idWidth = Math.max(...hits.map((h) => h.id.length), 4);
|
|
48496
|
+
const rows = hits.map((hit) => {
|
|
48497
|
+
const summary = hit.summary.length > 80 ? hit.summary.slice(0, 77) + "..." : hit.summary;
|
|
48498
|
+
const kindLabel = labelForKind(hit).padEnd(kindWidth);
|
|
48499
|
+
const idLabel = hit.id.padEnd(idWidth);
|
|
48500
|
+
const tail = summary ? ` \u2014 ${hit.title} \u2014 ${summary}` : ` \u2014 ${hit.title}`;
|
|
48501
|
+
return `${kindLabel} ${idLabel}${tail}`;
|
|
48502
|
+
});
|
|
48503
|
+
return rows.join("\n");
|
|
48504
|
+
}
|
|
48505
|
+
function labelForKind(hit) {
|
|
48506
|
+
return hit.subKind ? `[${hit.kind}/${hit.subKind}]` : `[${hit.kind}]`;
|
|
48507
|
+
}
|
|
48508
|
+
function formatOmDescribe(result) {
|
|
48509
|
+
if (!result) return "(node not found)";
|
|
48510
|
+
switch (result.kind) {
|
|
48511
|
+
case "system":
|
|
48512
|
+
return formatSystemDescribe(result);
|
|
48513
|
+
case "resource":
|
|
48514
|
+
return formatResourceDescribe(result);
|
|
48515
|
+
case "knowledge":
|
|
48516
|
+
return formatKnowledgeDescribe(result);
|
|
48517
|
+
case "ontology":
|
|
48518
|
+
return formatOntologyDescribe(result);
|
|
48519
|
+
case "role":
|
|
48520
|
+
return formatRoleDescribe(result);
|
|
48521
|
+
case "policy":
|
|
48522
|
+
return formatPolicyDescribe(result);
|
|
48523
|
+
}
|
|
48524
|
+
}
|
|
48525
|
+
function section(title, body) {
|
|
48526
|
+
return body ? `${title}:
|
|
48527
|
+
${body}` : "";
|
|
48528
|
+
}
|
|
48529
|
+
function bullet(items) {
|
|
48530
|
+
if (items.length === 0) return " (none)";
|
|
48531
|
+
return items.map((i) => ` - ${i}`).join("\n");
|
|
48532
|
+
}
|
|
48533
|
+
function field(label, value) {
|
|
48534
|
+
return value === void 0 || value === null || value === "" ? "" : `${label}: ${value}`;
|
|
48535
|
+
}
|
|
48536
|
+
function join3(parts) {
|
|
48537
|
+
return parts.filter((p) => p.length > 0).join("\n\n");
|
|
48538
|
+
}
|
|
48539
|
+
function formatSystemDescribe(r) {
|
|
48540
|
+
const header = join3([
|
|
48541
|
+
`System: ${r.id}`,
|
|
48542
|
+
[
|
|
48543
|
+
field("Label", r.label),
|
|
48544
|
+
field("Kind", r.systemKind),
|
|
48545
|
+
field("Lifecycle", r.lifecycle),
|
|
48546
|
+
field("Parent", r.parentSystemId),
|
|
48547
|
+
field("Responsible role", r.responsibleRoleId)
|
|
48548
|
+
].filter((s) => s.length > 0).join("\n"),
|
|
48549
|
+
r.description ? `Description: ${r.description}` : ""
|
|
48550
|
+
]);
|
|
48551
|
+
const govSection = section("Governed by knowledge", bullet(r.governingKnowledgeIds));
|
|
48552
|
+
const resourceLines = [];
|
|
48553
|
+
const totalResources = Object.values(r.resourceCountsByKind).reduce((a, b) => a + b, 0);
|
|
48554
|
+
if (totalResources > 0) {
|
|
48555
|
+
for (const [kind, count] of Object.entries(r.resourceCountsByKind)) {
|
|
48556
|
+
const ids = r.resourceIdsByKind[kind] ?? [];
|
|
48557
|
+
const preview = ids.slice(0, 5).join(", ");
|
|
48558
|
+
const tail = ids.length > 5 ? `, ... (+${ids.length - 5})` : "";
|
|
48559
|
+
resourceLines.push(` ${kind}s (${count}): ${preview}${tail}`);
|
|
48560
|
+
}
|
|
48561
|
+
} else {
|
|
48562
|
+
resourceLines.push(" (none)");
|
|
48563
|
+
}
|
|
48564
|
+
const resourceSection = `Resources (${totalResources}):
|
|
48565
|
+
${resourceLines.join("\n")}`;
|
|
48566
|
+
const ontologyEntries = Object.entries(r.ontologyCountsByKind);
|
|
48567
|
+
const ontologySection = ontologyEntries.length ? `Ontology: ${ontologyEntries.map(([k, n]) => `${k}s: ${n}`).join(", ")}` : "";
|
|
48568
|
+
const childSection = section("Subsystems", bullet(r.childSystemPaths));
|
|
48569
|
+
return join3([header, govSection, resourceSection, ontologySection, childSection]);
|
|
48570
|
+
}
|
|
48571
|
+
function formatResourceDescribe(r) {
|
|
48572
|
+
const header = join3([
|
|
48573
|
+
`Resource: ${r.id}`,
|
|
48574
|
+
[
|
|
48575
|
+
field("Kind", r.resourceKind),
|
|
48576
|
+
field("System", r.systemPath),
|
|
48577
|
+
field("Title", r.title),
|
|
48578
|
+
field("Status", r.status),
|
|
48579
|
+
field("Owner role", r.ownerRoleId)
|
|
48580
|
+
].filter((s) => s.length > 0).join("\n"),
|
|
48581
|
+
r.description ? `Description: ${r.description}` : ""
|
|
48582
|
+
]);
|
|
48583
|
+
const ontologyLines = [];
|
|
48584
|
+
if (r.ontology) {
|
|
48585
|
+
if (r.ontology.primaryAction) ontologyLines.push(` primary action: ${r.ontology.primaryAction}`);
|
|
48586
|
+
if (r.ontology.actions?.length) ontologyLines.push(` actions: ${r.ontology.actions.join(", ")}`);
|
|
48587
|
+
if (r.ontology.reads?.length) ontologyLines.push(` reads: ${r.ontology.reads.join(", ")}`);
|
|
48588
|
+
if (r.ontology.writes?.length) ontologyLines.push(` writes: ${r.ontology.writes.join(", ")}`);
|
|
48589
|
+
if (r.ontology.emits?.length) ontologyLines.push(` emits: ${r.ontology.emits.join(", ")}`);
|
|
48590
|
+
if (r.ontology.usesCatalogs?.length) ontologyLines.push(` uses catalogs: ${r.ontology.usesCatalogs.join(", ")}`);
|
|
48591
|
+
}
|
|
48592
|
+
const ontologySection = ontologyLines.length ? `Ontology bindings:
|
|
48593
|
+
${ontologyLines.join("\n")}` : "";
|
|
48594
|
+
const codeRefsSection = r.codeRefPaths.length ? `Code refs:
|
|
48595
|
+
${bullet(r.codeRefPaths)}` : "";
|
|
48596
|
+
return join3([header, ontologySection, codeRefsSection]);
|
|
48597
|
+
}
|
|
48598
|
+
function formatKnowledgeDescribe(r) {
|
|
48599
|
+
const header = join3([
|
|
48600
|
+
`Knowledge: ${r.id}`,
|
|
48601
|
+
[field("Kind", r.knowledgeKind), field("Title", r.title), field("Updated", r.updatedAt)].filter((s) => s.length > 0).join("\n"),
|
|
48602
|
+
r.summary ? `Summary: ${r.summary}` : ""
|
|
48603
|
+
]);
|
|
48604
|
+
const ownerSection = r.ownerIds.length ? `Owned by:
|
|
48605
|
+
${bullet(r.ownerIds)}` : "";
|
|
48606
|
+
const govSection = section("Governs", bullet(r.governs));
|
|
48607
|
+
const bodySection = `Body excerpt (${r.bodyLineCount} lines total \u2014 use knowledge:cat for full):
|
|
48608
|
+
${r.bodyExcerpt}`;
|
|
48609
|
+
return join3([header, ownerSection, govSection, bodySection]);
|
|
48610
|
+
}
|
|
48611
|
+
function formatOntologyDescribe(r) {
|
|
48612
|
+
const header = join3([
|
|
48613
|
+
`Ontology: ${r.id}`,
|
|
48614
|
+
[field("Kind", r.ontologyKind), field("Scope", r.scope), field("Local id", r.localId), field("Label", r.label)].filter((s) => s.length > 0).join("\n"),
|
|
48615
|
+
r.description ? `Description: ${r.description}` : ""
|
|
48616
|
+
]);
|
|
48617
|
+
const govSection = section("Governed by knowledge", bullet(r.governingKnowledgeIds));
|
|
48618
|
+
return join3([header, govSection]);
|
|
48619
|
+
}
|
|
48620
|
+
function formatRoleDescribe(r) {
|
|
48621
|
+
const header = join3([
|
|
48622
|
+
`Role: ${r.id}`,
|
|
48623
|
+
[field("Title", r.title), field("Reports to", r.reportsToId)].filter((s) => s.length > 0).join("\n")
|
|
48624
|
+
]);
|
|
48625
|
+
const respSection = section("Responsibilities", bullet(r.responsibilities));
|
|
48626
|
+
const responsibleForSection = section("Responsible for systems", bullet(r.responsibleFor));
|
|
48627
|
+
return join3([header, respSection, responsibleForSection]);
|
|
48628
|
+
}
|
|
48629
|
+
function formatPolicyDescribe(r) {
|
|
48630
|
+
const header = join3([
|
|
48631
|
+
`Policy: ${r.id}`,
|
|
48632
|
+
[field("Label", r.label), field("Trigger", r.triggerKind)].filter((s) => s.length > 0).join("\n"),
|
|
48633
|
+
r.description ? `Description: ${r.description}` : ""
|
|
48634
|
+
]);
|
|
48635
|
+
const effectSection = section("Effect kinds", bullet(r.effectKinds));
|
|
48636
|
+
const appliesLines = [];
|
|
48637
|
+
if (r.appliesToSystemIds.length) appliesLines.push(` systems: ${r.appliesToSystemIds.join(", ")}`);
|
|
48638
|
+
if (r.appliesToActionIds.length) appliesLines.push(` actions: ${r.appliesToActionIds.join(", ")}`);
|
|
48639
|
+
if (r.appliesToResourceIds.length) appliesLines.push(` resources: ${r.appliesToResourceIds.join(", ")}`);
|
|
48640
|
+
if (r.appliesToRoleIds.length) appliesLines.push(` roles: ${r.appliesToRoleIds.join(", ")}`);
|
|
48641
|
+
const appliesSection = appliesLines.length ? `Applies to:
|
|
48642
|
+
${appliesLines.join("\n")}` : "";
|
|
48643
|
+
return join3([header, effectSection, appliesSection]);
|
|
48644
|
+
}
|
|
48072
48645
|
|
|
48073
48646
|
// src/cli/commands/knowledge/load-org-model.ts
|
|
48074
48647
|
var import_path3 = require("path");
|
|
@@ -48126,8 +48699,8 @@ async function loadOrgModel(projectRoot) {
|
|
|
48126
48699
|
|
|
48127
48700
|
// src/cli/commands/knowledge/ls.ts
|
|
48128
48701
|
function registerKnowledgeLs(program3) {
|
|
48129
|
-
program3.command("knowledge:ls <path>").description(
|
|
48130
|
-
"List knowledge nodes for a Knowledge Map path\n Examples:\n elevasis-sdk
|
|
48702
|
+
program3.command("knowledge:ls <path>").alias("om:ls").description(
|
|
48703
|
+
"List knowledge nodes for a Knowledge Map path\n Examples:\n elevasis-sdk om:ls /by-kind/playbook\n elevasis-sdk om:ls /by-system/sales.crm\n elevasis-sdk om:ls /by-ontology/sales.crm:object/deal\n elevasis-sdk om:ls /by-owner/role.ops-lead\n elevasis-sdk om:ls /graph/knowledge.outreach-playbook/governs\n elevasis-sdk om:ls /graph/system:sales.crm/governed-by"
|
|
48131
48704
|
).option("--json", "Print wrapped JSON envelope { path, mount, args, results }").option("--ids-only", "Print one ID per line (for piping)").action(
|
|
48132
48705
|
wrapAction("knowledge:ls", async (pathArg, options) => {
|
|
48133
48706
|
let parsed;
|
|
@@ -48206,8 +48779,8 @@ function registerKnowledgeLs(program3) {
|
|
|
48206
48779
|
|
|
48207
48780
|
// src/cli/commands/knowledge/cat.ts
|
|
48208
48781
|
function registerKnowledgeCat(program3) {
|
|
48209
|
-
program3.command("knowledge:cat <id>").description(
|
|
48210
|
-
"Print the raw MDX body of a knowledge node\n Example: elevasis-sdk
|
|
48782
|
+
program3.command("knowledge:cat <id>").alias("om:cat").description(
|
|
48783
|
+
"Print the raw MDX body of a knowledge node\n Example: elevasis-sdk om:cat knowledge.outreach-playbook\n Use --json for structured output"
|
|
48211
48784
|
).option("--json", "Return structured JSON with node fields").action(
|
|
48212
48785
|
wrapAction("knowledge:cat", async (id, options) => {
|
|
48213
48786
|
const projectRoot = getProjectRoot();
|
|
@@ -48229,8 +48802,8 @@ function registerKnowledgeCat(program3) {
|
|
|
48229
48802
|
|
|
48230
48803
|
// src/cli/commands/knowledge/graph.ts
|
|
48231
48804
|
function registerKnowledgeGraph(program3) {
|
|
48232
|
-
program3.command("knowledge:graph <id>").description(
|
|
48233
|
-
"Show outgoing and incoming edges for a knowledge node\n Example: elevasis-sdk
|
|
48805
|
+
program3.command("knowledge:graph <id>").alias("om:graph").description(
|
|
48806
|
+
"Show outgoing and incoming edges for a knowledge node\n Example: elevasis-sdk om:graph knowledge.outreach-playbook\n Accepts bare OM node id or graph node id (knowledge:<id>)"
|
|
48234
48807
|
).option("--json", "Print JSON: { nodeId, outgoing: string[], incoming: string[] }").option("--ids-only", "Print one edge ID per line (outgoing first, then incoming)").action(
|
|
48235
48808
|
wrapAction("knowledge:graph", async (id, options) => {
|
|
48236
48809
|
const projectRoot = getProjectRoot();
|
|
@@ -48364,8 +48937,8 @@ function resolveKnowledgeInvocationNeighbors(model, id) {
|
|
|
48364
48937
|
};
|
|
48365
48938
|
}
|
|
48366
48939
|
function registerKnowledgeSkills(program3) {
|
|
48367
|
-
program3.command("knowledge:skills <id>").description(
|
|
48368
|
-
"Show callable invocations on graph neighbors for a knowledge node\n Example: elevasis-sdk
|
|
48940
|
+
program3.command("knowledge:skills <id>").alias("om:skills").description(
|
|
48941
|
+
"Show callable invocations on graph neighbors for a knowledge node\n Example: elevasis-sdk om:skills knowledge.new-vertical-launch-playbook"
|
|
48369
48942
|
).option("--json", "Print JSON: { id, title, invocationSources }").action(
|
|
48370
48943
|
wrapAction("knowledge:skills", async (id, options) => {
|
|
48371
48944
|
const projectRoot = getProjectRoot();
|
|
@@ -48764,8 +49337,8 @@ function generateKnowledgeNodes(options) {
|
|
|
48764
49337
|
|
|
48765
49338
|
// src/cli/commands/knowledge/generate.ts
|
|
48766
49339
|
function registerKnowledgeGenerate(program3) {
|
|
48767
|
-
program3.command("knowledge:generate").description(
|
|
48768
|
-
"Generate OrganizationModel knowledge nodes from MDX source files\n Example: elevasis-sdk
|
|
49340
|
+
program3.command("knowledge:generate").alias("om:generate").description(
|
|
49341
|
+
"Generate OrganizationModel knowledge nodes from MDX source files\n Example: elevasis-sdk om:generate"
|
|
48769
49342
|
).option("--source <path>", "MDX source directory relative to project root", "core/config/knowledge/nodes").option(
|
|
48770
49343
|
"--output <path>",
|
|
48771
49344
|
"Generated TS file relative to project root",
|
|
@@ -48804,6 +49377,83 @@ function registerKnowledgeGenerate(program3) {
|
|
|
48804
49377
|
);
|
|
48805
49378
|
}
|
|
48806
49379
|
|
|
49380
|
+
// src/cli/commands/knowledge/search.ts
|
|
49381
|
+
var ALL_KINDS = ["system", "resource", "knowledge", "ontology", "role", "policy"];
|
|
49382
|
+
function parseLimit(raw) {
|
|
49383
|
+
if (raw === void 0) return 10;
|
|
49384
|
+
const n = Number.parseInt(raw, 10);
|
|
49385
|
+
if (Number.isNaN(n) || n < 0) {
|
|
49386
|
+
throw new Error(`knowledge:search: --limit must be a non-negative integer (got "${raw}")`);
|
|
49387
|
+
}
|
|
49388
|
+
return n;
|
|
49389
|
+
}
|
|
49390
|
+
function parseKinds(raw) {
|
|
49391
|
+
if (raw === void 0) return void 0;
|
|
49392
|
+
const requested = raw.split(",").map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0);
|
|
49393
|
+
const valid = [];
|
|
49394
|
+
const invalid = [];
|
|
49395
|
+
for (const kind of requested) {
|
|
49396
|
+
if (ALL_KINDS.includes(kind)) {
|
|
49397
|
+
valid.push(kind);
|
|
49398
|
+
} else {
|
|
49399
|
+
invalid.push(kind);
|
|
49400
|
+
}
|
|
49401
|
+
}
|
|
49402
|
+
if (invalid.length > 0) {
|
|
49403
|
+
throw new Error(`knowledge:search: unknown kind(s) "${invalid.join(", ")}". Valid: ${ALL_KINDS.join(", ")}`);
|
|
49404
|
+
}
|
|
49405
|
+
return valid.length > 0 ? valid : void 0;
|
|
49406
|
+
}
|
|
49407
|
+
function registerKnowledgeSearch(program3) {
|
|
49408
|
+
program3.command("knowledge:search <query>").alias("om:search").description(
|
|
49409
|
+
'Universal keyword search across the entire Organization Model\n (systems, resources, knowledge, ontology, roles, policies)\n Example: elevasis-sdk om:search "lead gen"\n Example: elevasis-sdk om:search outreach --kinds knowledge\n Example: elevasis-sdk om:search apollo --ids-only'
|
|
49410
|
+
).option("--limit <n>", "max number of hits to return (0 = unlimited)", "10").option("--kinds <list>", "comma-separated kinds filter (system,resource,knowledge,ontology,role,policy)").option("--json", "Print wrapped JSON envelope").option("--ids-only", "Print one ID per line (for piping)").action(
|
|
49411
|
+
wrapAction("knowledge:search", async (query, options) => {
|
|
49412
|
+
const limit = parseLimit(options.limit);
|
|
49413
|
+
const kinds = parseKinds(options.kinds);
|
|
49414
|
+
const projectRoot = getProjectRoot();
|
|
49415
|
+
const model = await loadOrgModel(projectRoot);
|
|
49416
|
+
const hits = omSearch(model, query, { limit, kinds });
|
|
49417
|
+
if (options.json) {
|
|
49418
|
+
const envelope = { query, limit, kinds: kinds ?? null, count: hits.length, results: hits };
|
|
49419
|
+
process.stdout.write(JSON.stringify(envelope, null, 2) + "\n");
|
|
49420
|
+
return;
|
|
49421
|
+
}
|
|
49422
|
+
if (options.idsOnly) {
|
|
49423
|
+
const output = formatIdsOnly(hits);
|
|
49424
|
+
if (output) process.stdout.write(output + "\n");
|
|
49425
|
+
return;
|
|
49426
|
+
}
|
|
49427
|
+
process.stdout.write(formatOmSearchHits(hits) + "\n");
|
|
49428
|
+
})
|
|
49429
|
+
);
|
|
49430
|
+
}
|
|
49431
|
+
|
|
49432
|
+
// src/cli/commands/knowledge/describe.ts
|
|
49433
|
+
function registerKnowledgeDescribe(program3) {
|
|
49434
|
+
program3.command("knowledge:describe <nodeId>").alias("om:describe").description(
|
|
49435
|
+
"Show a structured neighborhood view for any OM node id\n (system, resource, knowledge, ontology, role, policy \u2014 auto-detected from id shape)\n Example: elevasis-sdk om:describe sales.lead-gen\n Example: elevasis-sdk om:describe knowledge.outreach-playbook"
|
|
49436
|
+
).option("--json", "Print as JSON").action(
|
|
49437
|
+
wrapAction("knowledge:describe", async (nodeId2, options) => {
|
|
49438
|
+
const projectRoot = getProjectRoot();
|
|
49439
|
+
const model = await loadOrgModel(projectRoot);
|
|
49440
|
+
const result = omDescribe(model, nodeId2);
|
|
49441
|
+
if (!result) {
|
|
49442
|
+
process.stderr.write(
|
|
49443
|
+
`knowledge:describe: no OM node found for id "${nodeId2}". Use knowledge:search (alias: om:search) to discover nodes by keyword.
|
|
49444
|
+
`
|
|
49445
|
+
);
|
|
49446
|
+
process.exit(1);
|
|
49447
|
+
}
|
|
49448
|
+
if (options.json) {
|
|
49449
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
49450
|
+
return;
|
|
49451
|
+
}
|
|
49452
|
+
process.stdout.write(formatOmDescribe(result) + "\n");
|
|
49453
|
+
})
|
|
49454
|
+
);
|
|
49455
|
+
}
|
|
49456
|
+
|
|
48807
49457
|
// src/cli/commands/knowledge/index.ts
|
|
48808
49458
|
function registerKnowledgeCommands(program3) {
|
|
48809
49459
|
registerKnowledgeGenerate(program3);
|
|
@@ -48811,6 +49461,8 @@ function registerKnowledgeCommands(program3) {
|
|
|
48811
49461
|
registerKnowledgeCat(program3);
|
|
48812
49462
|
registerKnowledgeGraph(program3);
|
|
48813
49463
|
registerKnowledgeSkills(program3);
|
|
49464
|
+
registerKnowledgeSearch(program3);
|
|
49465
|
+
registerKnowledgeDescribe(program3);
|
|
48814
49466
|
}
|
|
48815
49467
|
|
|
48816
49468
|
// src/cli/commands/request/request.ts
|