@elevasis/sdk 1.33.0 → 1.34.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 +587 -294
- package/dist/index.d.ts +8 -9
- package/dist/index.js +23 -14
- package/dist/node/index.d.ts +3 -4
- package/dist/test-utils/index.d.ts +2 -3
- package/dist/test-utils/index.js +22 -13
- package/package.json +4 -4
- package/reference/claude-config/Overview.md +2 -2
- package/reference/claude-config/skills/om/SKILL.md +85 -47
- package/reference/claude-config/skills/project/SKILL.md +16 -14
- package/reference/claude-config/sync-notes/2026-06-04-scaffold-registry-lane-severity.md +34 -0
- package/reference/claude-config/sync-notes/2026-06-05-appearance-app-mode-decouple.md +29 -0
- package/reference/claude-config/sync-notes/2026-06-05-ontology-endpoint-rename-and-knowledge-browser-ui.md +86 -0
- package/reference/claude-config/sync-notes/2026-06-06-om-item-copy-references.md +50 -0
- package/reference/scaffold/core/organization-graph.mdx +9 -8
- package/reference/scaffold/operations/propagation-pipeline.md +13 -9
- package/reference/scaffold/operations/scaffold-maintenance.md +8 -7
- package/reference/sdk/cli-management.mdx +44 -2
- package/reference/sdk/cli.mdx +2 -1
package/dist/cli.cjs
CHANGED
|
@@ -7142,14 +7142,14 @@ var require_async_iterator = __commonJS({
|
|
|
7142
7142
|
};
|
|
7143
7143
|
}
|
|
7144
7144
|
function readAndResolve(iter) {
|
|
7145
|
-
var
|
|
7146
|
-
if (
|
|
7145
|
+
var resolve6 = iter[kLastResolve];
|
|
7146
|
+
if (resolve6 !== null) {
|
|
7147
7147
|
var data = iter[kStream].read();
|
|
7148
7148
|
if (data !== null) {
|
|
7149
7149
|
iter[kLastPromise] = null;
|
|
7150
7150
|
iter[kLastResolve] = null;
|
|
7151
7151
|
iter[kLastReject] = null;
|
|
7152
|
-
|
|
7152
|
+
resolve6(createIterResult(data, false));
|
|
7153
7153
|
}
|
|
7154
7154
|
}
|
|
7155
7155
|
}
|
|
@@ -7157,13 +7157,13 @@ var require_async_iterator = __commonJS({
|
|
|
7157
7157
|
process.nextTick(readAndResolve, iter);
|
|
7158
7158
|
}
|
|
7159
7159
|
function wrapForNext(lastPromise, iter) {
|
|
7160
|
-
return function(
|
|
7160
|
+
return function(resolve6, reject) {
|
|
7161
7161
|
lastPromise.then(function() {
|
|
7162
7162
|
if (iter[kEnded]) {
|
|
7163
|
-
|
|
7163
|
+
resolve6(createIterResult(void 0, true));
|
|
7164
7164
|
return;
|
|
7165
7165
|
}
|
|
7166
|
-
iter[kHandlePromise](
|
|
7166
|
+
iter[kHandlePromise](resolve6, reject);
|
|
7167
7167
|
}, reject);
|
|
7168
7168
|
};
|
|
7169
7169
|
}
|
|
@@ -7183,12 +7183,12 @@ var require_async_iterator = __commonJS({
|
|
|
7183
7183
|
return Promise.resolve(createIterResult(void 0, true));
|
|
7184
7184
|
}
|
|
7185
7185
|
if (this[kStream].destroyed) {
|
|
7186
|
-
return new Promise(function(
|
|
7186
|
+
return new Promise(function(resolve6, reject) {
|
|
7187
7187
|
process.nextTick(function() {
|
|
7188
7188
|
if (_this[kError]) {
|
|
7189
7189
|
reject(_this[kError]);
|
|
7190
7190
|
} else {
|
|
7191
|
-
|
|
7191
|
+
resolve6(createIterResult(void 0, true));
|
|
7192
7192
|
}
|
|
7193
7193
|
});
|
|
7194
7194
|
});
|
|
@@ -7211,13 +7211,13 @@ var require_async_iterator = __commonJS({
|
|
|
7211
7211
|
return this;
|
|
7212
7212
|
}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
|
|
7213
7213
|
var _this2 = this;
|
|
7214
|
-
return new Promise(function(
|
|
7214
|
+
return new Promise(function(resolve6, reject) {
|
|
7215
7215
|
_this2[kStream].destroy(null, function(err) {
|
|
7216
7216
|
if (err) {
|
|
7217
7217
|
reject(err);
|
|
7218
7218
|
return;
|
|
7219
7219
|
}
|
|
7220
|
-
|
|
7220
|
+
resolve6(createIterResult(void 0, true));
|
|
7221
7221
|
});
|
|
7222
7222
|
});
|
|
7223
7223
|
}), _Object$setPrototypeO), AsyncIteratorPrototype);
|
|
@@ -7239,15 +7239,15 @@ var require_async_iterator = __commonJS({
|
|
|
7239
7239
|
value: stream._readableState.endEmitted,
|
|
7240
7240
|
writable: true
|
|
7241
7241
|
}), _defineProperty(_Object$create, kHandlePromise, {
|
|
7242
|
-
value: function value(
|
|
7242
|
+
value: function value(resolve6, reject) {
|
|
7243
7243
|
var data = iterator[kStream].read();
|
|
7244
7244
|
if (data) {
|
|
7245
7245
|
iterator[kLastPromise] = null;
|
|
7246
7246
|
iterator[kLastResolve] = null;
|
|
7247
7247
|
iterator[kLastReject] = null;
|
|
7248
|
-
|
|
7248
|
+
resolve6(createIterResult(data, false));
|
|
7249
7249
|
} else {
|
|
7250
|
-
iterator[kLastResolve] =
|
|
7250
|
+
iterator[kLastResolve] = resolve6;
|
|
7251
7251
|
iterator[kLastReject] = reject;
|
|
7252
7252
|
}
|
|
7253
7253
|
},
|
|
@@ -7266,12 +7266,12 @@ var require_async_iterator = __commonJS({
|
|
|
7266
7266
|
iterator[kError] = err;
|
|
7267
7267
|
return;
|
|
7268
7268
|
}
|
|
7269
|
-
var
|
|
7270
|
-
if (
|
|
7269
|
+
var resolve6 = iterator[kLastResolve];
|
|
7270
|
+
if (resolve6 !== null) {
|
|
7271
7271
|
iterator[kLastPromise] = null;
|
|
7272
7272
|
iterator[kLastResolve] = null;
|
|
7273
7273
|
iterator[kLastReject] = null;
|
|
7274
|
-
|
|
7274
|
+
resolve6(createIterResult(void 0, true));
|
|
7275
7275
|
}
|
|
7276
7276
|
iterator[kEnded] = true;
|
|
7277
7277
|
});
|
|
@@ -7286,7 +7286,7 @@ var require_async_iterator = __commonJS({
|
|
|
7286
7286
|
var require_from = __commonJS({
|
|
7287
7287
|
"../../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
|
|
7288
7288
|
"use strict";
|
|
7289
|
-
function asyncGeneratorStep(gen,
|
|
7289
|
+
function asyncGeneratorStep(gen, resolve6, reject, _next, _throw, key, arg) {
|
|
7290
7290
|
try {
|
|
7291
7291
|
var info = gen[key](arg);
|
|
7292
7292
|
var value = info.value;
|
|
@@ -7295,7 +7295,7 @@ var require_from = __commonJS({
|
|
|
7295
7295
|
return;
|
|
7296
7296
|
}
|
|
7297
7297
|
if (info.done) {
|
|
7298
|
-
|
|
7298
|
+
resolve6(value);
|
|
7299
7299
|
} else {
|
|
7300
7300
|
Promise.resolve(value).then(_next, _throw);
|
|
7301
7301
|
}
|
|
@@ -7303,13 +7303,13 @@ var require_from = __commonJS({
|
|
|
7303
7303
|
function _asyncToGenerator(fn) {
|
|
7304
7304
|
return function() {
|
|
7305
7305
|
var self2 = this, args = arguments;
|
|
7306
|
-
return new Promise(function(
|
|
7306
|
+
return new Promise(function(resolve6, reject) {
|
|
7307
7307
|
var gen = fn.apply(self2, args);
|
|
7308
7308
|
function _next(value) {
|
|
7309
|
-
asyncGeneratorStep(gen,
|
|
7309
|
+
asyncGeneratorStep(gen, resolve6, reject, _next, _throw, "next", value);
|
|
7310
7310
|
}
|
|
7311
7311
|
function _throw(err) {
|
|
7312
|
-
asyncGeneratorStep(gen,
|
|
7312
|
+
asyncGeneratorStep(gen, resolve6, reject, _next, _throw, "throw", err);
|
|
7313
7313
|
}
|
|
7314
7314
|
_next(void 0);
|
|
7315
7315
|
});
|
|
@@ -23629,18 +23629,18 @@ var init_config = __esm({
|
|
|
23629
23629
|
// src/cli/commands/om/project-layout.ts
|
|
23630
23630
|
function assertSplitLayout(projectDir) {
|
|
23631
23631
|
const omDir = (0, import_node_path9.join)(projectDir, "core", "config", "organization-model");
|
|
23632
|
-
const missing = REQUIRED_FILES.filter((f) => !(0,
|
|
23632
|
+
const missing = REQUIRED_FILES.filter((f) => !(0, import_node_fs10.existsSync)((0, import_node_path9.join)(omDir, f)));
|
|
23633
23633
|
if (missing.length > 0) {
|
|
23634
23634
|
throw new Error(
|
|
23635
23635
|
"Legacy single-file OM layout detected. Split into `core/config/organization-model/{profile.ts, systems.ts, navigation.ts}` before scaffolding."
|
|
23636
23636
|
);
|
|
23637
23637
|
}
|
|
23638
23638
|
}
|
|
23639
|
-
var
|
|
23639
|
+
var import_node_fs10, import_node_path9, REQUIRED_FILES;
|
|
23640
23640
|
var init_project_layout = __esm({
|
|
23641
23641
|
"src/cli/commands/om/project-layout.ts"() {
|
|
23642
23642
|
"use strict";
|
|
23643
|
-
|
|
23643
|
+
import_node_fs10 = require("node:fs");
|
|
23644
23644
|
import_node_path9 = require("node:path");
|
|
23645
23645
|
REQUIRED_FILES = ["profile.ts", "systems.ts", "navigation.ts"];
|
|
23646
23646
|
}
|
|
@@ -23656,11 +23656,11 @@ async function promptIfAbsent(value, question, options) {
|
|
|
23656
23656
|
input: process.stdin,
|
|
23657
23657
|
output: process.stdout
|
|
23658
23658
|
});
|
|
23659
|
-
return new Promise((
|
|
23659
|
+
return new Promise((resolve6) => {
|
|
23660
23660
|
const prompt = options?.default ? `${question} [${options.default}]: ` : `${question}: `;
|
|
23661
23661
|
rl.question(prompt, (answer) => {
|
|
23662
23662
|
rl.close();
|
|
23663
|
-
|
|
23663
|
+
resolve6(answer.trim() || (options?.default ?? ""));
|
|
23664
23664
|
});
|
|
23665
23665
|
});
|
|
23666
23666
|
}
|
|
@@ -23715,7 +23715,6 @@ function emitSystemEntry(opts) {
|
|
|
23715
23715
|
const apiInterfaceBlock = opts.apiBacked ? `
|
|
23716
23716
|
apiInterface: {
|
|
23717
23717
|
lifecycle: 'active',
|
|
23718
|
-
readinessProfile: 'standard',
|
|
23719
23718
|
resourceIds: []
|
|
23720
23719
|
},` : "";
|
|
23721
23720
|
const code = ` {
|
|
@@ -23742,7 +23741,7 @@ async function withSnapshotRollback(filePaths, op) {
|
|
|
23742
23741
|
const snapshots = /* @__PURE__ */ new Map();
|
|
23743
23742
|
for (const filePath of filePaths) {
|
|
23744
23743
|
try {
|
|
23745
|
-
snapshots.set(filePath, (0,
|
|
23744
|
+
snapshots.set(filePath, (0, import_node_fs11.readFileSync)(filePath, "utf8"));
|
|
23746
23745
|
} catch {
|
|
23747
23746
|
snapshots.set(filePath, null);
|
|
23748
23747
|
}
|
|
@@ -23753,7 +23752,7 @@ async function withSnapshotRollback(filePaths, op) {
|
|
|
23753
23752
|
for (const [filePath, snapshot] of snapshots) {
|
|
23754
23753
|
if (snapshot !== null) {
|
|
23755
23754
|
try {
|
|
23756
|
-
(0,
|
|
23755
|
+
(0, import_node_fs11.writeFileSync)(filePath, snapshot, "utf8");
|
|
23757
23756
|
} catch {
|
|
23758
23757
|
}
|
|
23759
23758
|
}
|
|
@@ -23774,14 +23773,14 @@ function insertBeforeAnchorInContent(content, code, anchor) {
|
|
|
23774
23773
|
return lines.join("\n");
|
|
23775
23774
|
}
|
|
23776
23775
|
async function appendBeforeAnchor(filePath, code, anchor) {
|
|
23777
|
-
const content = (0,
|
|
23776
|
+
const content = (0, import_node_fs11.readFileSync)(filePath, "utf8");
|
|
23778
23777
|
const updated = insertBeforeAnchorInContent(content, code, anchor);
|
|
23779
|
-
(0,
|
|
23778
|
+
(0, import_node_fs11.writeFileSync)(filePath, updated, "utf8");
|
|
23780
23779
|
}
|
|
23781
23780
|
async function applyConstImport(systemsFilePath, importLine, fieldLine, importAnchor, fieldAnchor, newConstFilePath, newConstFileCode) {
|
|
23782
|
-
(0,
|
|
23783
|
-
(0,
|
|
23784
|
-
const systemsContent = (0,
|
|
23781
|
+
(0, import_node_fs11.mkdirSync)((0, import_node_path10.dirname)(newConstFilePath), { recursive: true });
|
|
23782
|
+
(0, import_node_fs11.writeFileSync)(newConstFilePath, newConstFileCode, "utf8");
|
|
23783
|
+
const systemsContent = (0, import_node_fs11.readFileSync)(systemsFilePath, "utf8");
|
|
23785
23784
|
const afterImport = insertBeforeAnchorInContent(systemsContent, importLine + "\n", importAnchor);
|
|
23786
23785
|
const lines = afterImport.split("\n");
|
|
23787
23786
|
const fieldAnchorIndex = lines.findIndex((line) => fieldAnchor.test(line));
|
|
@@ -23791,13 +23790,13 @@ async function applyConstImport(systemsFilePath, importLine, fieldLine, importAn
|
|
|
23791
23790
|
);
|
|
23792
23791
|
}
|
|
23793
23792
|
lines.splice(fieldAnchorIndex + 1, 0, fieldLine);
|
|
23794
|
-
(0,
|
|
23793
|
+
(0, import_node_fs11.writeFileSync)(systemsFilePath, lines.join("\n"), "utf8");
|
|
23795
23794
|
}
|
|
23796
|
-
var
|
|
23795
|
+
var import_node_fs11, import_node_path10;
|
|
23797
23796
|
var init_splice = __esm({
|
|
23798
23797
|
"src/cli/commands/om/splice.ts"() {
|
|
23799
23798
|
"use strict";
|
|
23800
|
-
|
|
23799
|
+
import_node_fs11 = require("node:fs");
|
|
23801
23800
|
import_node_path10 = require("node:path");
|
|
23802
23801
|
}
|
|
23803
23802
|
});
|
|
@@ -24169,24 +24168,24 @@ async function scaffoldKnowledge(opts) {
|
|
|
24169
24168
|
return;
|
|
24170
24169
|
}
|
|
24171
24170
|
const absoluteFilePath = (0, import_node_path14.join)(projectDir, relativeFilePath);
|
|
24172
|
-
if ((0,
|
|
24171
|
+
if ((0, import_node_fs12.existsSync)(absoluteFilePath)) {
|
|
24173
24172
|
process.stderr.write(
|
|
24174
24173
|
source_default.red(`Knowledge node file already exists at \`${relativeFilePath}\`. Choose a different id.
|
|
24175
24174
|
`)
|
|
24176
24175
|
);
|
|
24177
24176
|
process.exit(1);
|
|
24178
24177
|
}
|
|
24179
|
-
(0,
|
|
24180
|
-
(0,
|
|
24178
|
+
(0, import_node_fs12.mkdirSync)((0, import_node_path14.join)(projectDir, "core", "config", "knowledge", "nodes"), { recursive: true });
|
|
24179
|
+
(0, import_node_fs12.writeFileSync)(absoluteFilePath, content, "utf8");
|
|
24181
24180
|
console.log(source_default.green(`Knowledge node \`${id}\` written to \`${relativeFilePath}\``));
|
|
24182
24181
|
console.log(source_default.yellow("Run `elevasis-sdk om:generate` to register this node."));
|
|
24183
24182
|
}
|
|
24184
|
-
var import_node_path14,
|
|
24183
|
+
var import_node_path14, import_node_fs12, VALID_KINDS;
|
|
24185
24184
|
var init_scaffold_knowledge = __esm({
|
|
24186
24185
|
"src/cli/commands/om/scaffold-knowledge.ts"() {
|
|
24187
24186
|
"use strict";
|
|
24188
24187
|
import_node_path14 = require("node:path");
|
|
24189
|
-
|
|
24188
|
+
import_node_fs12 = require("node:fs");
|
|
24190
24189
|
init_source();
|
|
24191
24190
|
init_config();
|
|
24192
24191
|
init_project_layout();
|
|
@@ -24210,7 +24209,6 @@ function emitApiInterfaceBlock(gap) {
|
|
|
24210
24209
|
|
|
24211
24210
|
export const ${constName} = {
|
|
24212
24211
|
lifecycle: 'active' as const,
|
|
24213
|
-
readinessProfile: 'standard' as const,
|
|
24214
24212
|
resourceIds: ${resourceIdsLiteral}
|
|
24215
24213
|
}
|
|
24216
24214
|
`;
|
|
@@ -24263,7 +24261,7 @@ async function scaffoldFill(opts) {
|
|
|
24263
24261
|
process.stderr.write(source_default.red("Missing gaps file. Pass --gaps <path> pointing to a conformance gap JSON file.\n"));
|
|
24264
24262
|
process.exit(1);
|
|
24265
24263
|
}
|
|
24266
|
-
if (!(0,
|
|
24264
|
+
if (!(0, import_node_fs13.existsSync)(options.gaps)) {
|
|
24267
24265
|
process.stderr.write(
|
|
24268
24266
|
source_default.red(
|
|
24269
24267
|
`Missing gaps file. Pass --gaps <path> pointing to a conformance gap JSON file.
|
|
@@ -24275,7 +24273,7 @@ async function scaffoldFill(opts) {
|
|
|
24275
24273
|
}
|
|
24276
24274
|
let payload;
|
|
24277
24275
|
try {
|
|
24278
|
-
const raw = (0,
|
|
24276
|
+
const raw = (0, import_node_fs13.readFileSync)(options.gaps, "utf8");
|
|
24279
24277
|
payload = JSON.parse(raw);
|
|
24280
24278
|
} catch {
|
|
24281
24279
|
process.stderr.write(
|
|
@@ -24396,7 +24394,7 @@ async function scaffoldFill(opts) {
|
|
|
24396
24394
|
}
|
|
24397
24395
|
if (skippedGaps.length > 0) {
|
|
24398
24396
|
const skippedPath = options.skipped ?? (0, import_node_path15.join)(os2.tmpdir(), `elevasis-fill-skipped-${systemPath}-${Date.now()}.json`);
|
|
24399
|
-
(0,
|
|
24397
|
+
(0, import_node_fs13.writeFileSync)(skippedPath, JSON.stringify({ systemPath, skipped: skippedGaps }, null, 2), "utf8");
|
|
24400
24398
|
console.log(
|
|
24401
24399
|
source_default.yellow(
|
|
24402
24400
|
`Partial fill: ${appliedGaps.length} gap(s) applied, ${skippedGaps.length} skipped \u2014 see \`${skippedPath}\` for fields requiring manual input.`
|
|
@@ -24410,13 +24408,13 @@ async function scaffoldFill(opts) {
|
|
|
24410
24408
|
)
|
|
24411
24409
|
);
|
|
24412
24410
|
}
|
|
24413
|
-
var import_node_path15, os2,
|
|
24411
|
+
var import_node_path15, os2, import_node_fs13, import_node_child_process5;
|
|
24414
24412
|
var init_scaffold_fill = __esm({
|
|
24415
24413
|
"src/cli/commands/om/scaffold-fill.ts"() {
|
|
24416
24414
|
"use strict";
|
|
24417
24415
|
import_node_path15 = require("node:path");
|
|
24418
24416
|
os2 = __toESM(require("node:os"), 1);
|
|
24419
|
-
|
|
24417
|
+
import_node_fs13 = require("node:fs");
|
|
24420
24418
|
import_node_child_process5 = require("node:child_process");
|
|
24421
24419
|
init_source();
|
|
24422
24420
|
init_config();
|
|
@@ -37535,16 +37533,13 @@ var OntologyKindSchema = external_exports.enum([
|
|
|
37535
37533
|
"value-type",
|
|
37536
37534
|
"property",
|
|
37537
37535
|
"group",
|
|
37538
|
-
"
|
|
37536
|
+
"endpoint"
|
|
37539
37537
|
]);
|
|
37540
37538
|
var SYSTEM_PATH_PATTERN = "[a-z0-9][a-z0-9-]*(?:\\.[a-z0-9][a-z0-9-]*)*";
|
|
37541
37539
|
var LOCAL_ID_PATTERN = "[a-z0-9][a-z0-9._-]*";
|
|
37542
37540
|
var ONTOLOGY_ID_PATTERN = `^(global|${SYSTEM_PATH_PATTERN}):(${OntologyKindSchema.options.join("|")})\\/(${LOCAL_ID_PATTERN})$`;
|
|
37543
37541
|
var ONTOLOGY_ID_REGEX = new RegExp(ONTOLOGY_ID_PATTERN);
|
|
37544
|
-
var OntologyIdSchema = external_exports.string().trim().min(1).max(300).regex(
|
|
37545
|
-
ONTOLOGY_ID_REGEX,
|
|
37546
|
-
"Ontology IDs must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>"
|
|
37547
|
-
);
|
|
37542
|
+
var OntologyIdSchema = external_exports.string().trim().min(1).max(300).regex(ONTOLOGY_ID_REGEX, "Ontology IDs must use <system-path>:<kind>/<local-id> or global:<kind>/<local-id>");
|
|
37548
37543
|
function parseOntologyId(id) {
|
|
37549
37544
|
const normalized = OntologyIdSchema.parse(id);
|
|
37550
37545
|
const match = ONTOLOGY_ID_REGEX.exec(normalized);
|
|
@@ -37607,7 +37602,7 @@ var OntologySharedPropertySchema = OntologyRecordBaseSchema.extend({
|
|
|
37607
37602
|
var OntologyGroupSchema = OntologyRecordBaseSchema.extend({
|
|
37608
37603
|
members: OntologyReferenceListSchema
|
|
37609
37604
|
});
|
|
37610
|
-
var
|
|
37605
|
+
var OntologyEndpointTypeSchema = OntologyRecordBaseSchema.extend({
|
|
37611
37606
|
route: external_exports.string().trim().min(1).max(500).optional()
|
|
37612
37607
|
});
|
|
37613
37608
|
var OntologyScopeSchema = external_exports.object({
|
|
@@ -37620,7 +37615,7 @@ var OntologyScopeSchema = external_exports.object({
|
|
|
37620
37615
|
valueTypes: external_exports.record(OntologyIdSchema, OntologyValueTypeSchema).default({}).optional(),
|
|
37621
37616
|
sharedProperties: external_exports.record(OntologyIdSchema, OntologySharedPropertySchema).default({}).optional(),
|
|
37622
37617
|
groups: external_exports.record(OntologyIdSchema, OntologyGroupSchema).default({}).optional(),
|
|
37623
|
-
|
|
37618
|
+
endpoints: external_exports.record(OntologyIdSchema, OntologyEndpointTypeSchema).default({}).optional()
|
|
37624
37619
|
}).default({});
|
|
37625
37620
|
var DEFAULT_ONTOLOGY_SCOPE = {
|
|
37626
37621
|
valueTypes: {
|
|
@@ -37656,7 +37651,7 @@ var SCOPE_KIND = {
|
|
|
37656
37651
|
valueTypes: "value-type",
|
|
37657
37652
|
sharedProperties: "property",
|
|
37658
37653
|
groups: "group",
|
|
37659
|
-
|
|
37654
|
+
endpoints: "endpoint"
|
|
37660
37655
|
};
|
|
37661
37656
|
var SCOPE_KEYS = Object.keys(SCOPE_KIND);
|
|
37662
37657
|
function ontologyGraphNodeId(id) {
|
|
@@ -37692,7 +37687,7 @@ function createEmptyIndex() {
|
|
|
37692
37687
|
valueTypes: {},
|
|
37693
37688
|
sharedProperties: {},
|
|
37694
37689
|
groups: {},
|
|
37695
|
-
|
|
37690
|
+
endpoints: {}
|
|
37696
37691
|
};
|
|
37697
37692
|
}
|
|
37698
37693
|
function sortResolvedOntologyIndex(index) {
|
|
@@ -37925,10 +37920,11 @@ var ONTOLOGY_REFERENCE_KEY_KINDS = {
|
|
|
37925
37920
|
interfaceType: "interface",
|
|
37926
37921
|
propertyType: "property",
|
|
37927
37922
|
groupType: "group",
|
|
37928
|
-
|
|
37923
|
+
endpointType: "endpoint",
|
|
37929
37924
|
stepCatalog: "catalog"
|
|
37930
37925
|
};
|
|
37931
|
-
|
|
37926
|
+
var omCompilationContextCache = /* @__PURE__ */ new WeakMap();
|
|
37927
|
+
function buildOmCrossRefIndexFromOntology(model, ontologyCompilation) {
|
|
37932
37928
|
const systemsById = /* @__PURE__ */ new Map();
|
|
37933
37929
|
for (const { path: path3, system } of listAllSystems(model)) {
|
|
37934
37930
|
systemsById.set(path3, system);
|
|
@@ -37942,7 +37938,6 @@ function buildOmCrossRefIndex(model) {
|
|
|
37942
37938
|
const actionIds = new Set(Object.keys(model.actions ?? {}));
|
|
37943
37939
|
const customerSegmentIds = new Set(Object.keys(model.customers ?? {}));
|
|
37944
37940
|
const offeringIds = new Set(Object.keys(model.offerings ?? {}));
|
|
37945
|
-
const ontologyCompilation = compileOrganizationOntology(model);
|
|
37946
37941
|
const ontologyIndexByKind = {
|
|
37947
37942
|
object: ontologyCompilation.ontology.objectTypes,
|
|
37948
37943
|
link: ontologyCompilation.ontology.linkTypes,
|
|
@@ -37953,7 +37948,7 @@ function buildOmCrossRefIndex(model) {
|
|
|
37953
37948
|
"value-type": ontologyCompilation.ontology.valueTypes,
|
|
37954
37949
|
property: ontologyCompilation.ontology.sharedProperties,
|
|
37955
37950
|
group: ontologyCompilation.ontology.groups,
|
|
37956
|
-
|
|
37951
|
+
endpoint: ontologyCompilation.ontology.endpoints
|
|
37957
37952
|
};
|
|
37958
37953
|
const ontologyIds = new Set(Object.values(ontologyIndexByKind).flatMap((index) => Object.keys(index)));
|
|
37959
37954
|
const stageIds = /* @__PURE__ */ new Set();
|
|
@@ -37981,6 +37976,15 @@ function buildOmCrossRefIndex(model) {
|
|
|
37981
37976
|
stageIds
|
|
37982
37977
|
};
|
|
37983
37978
|
}
|
|
37979
|
+
function buildOmCompilationContext(model) {
|
|
37980
|
+
const cached2 = omCompilationContextCache.get(model);
|
|
37981
|
+
if (cached2 !== void 0) return cached2;
|
|
37982
|
+
const ontologyCompilation = compileOrganizationOntology(model);
|
|
37983
|
+
const crossRefIndex = buildOmCrossRefIndexFromOntology(model, ontologyCompilation);
|
|
37984
|
+
const context = { crossRefIndex, ontologyCompilation };
|
|
37985
|
+
omCompilationContextCache.set(model, context);
|
|
37986
|
+
return context;
|
|
37987
|
+
}
|
|
37984
37988
|
function knowledgeTargetExists(index, kind, id) {
|
|
37985
37989
|
if (kind === "system") return index.systemsById.has(id);
|
|
37986
37990
|
if (kind === "client") return index.clientIds.has(id);
|
|
@@ -38632,8 +38636,6 @@ var SystemEntrySchema = external_exports.object({
|
|
|
38632
38636
|
path: PathSchema.optional(),
|
|
38633
38637
|
/** @deprecated Use ui.icon. Kept for one-cycle Feature compatibility. */
|
|
38634
38638
|
icon: IconNameSchema.optional(),
|
|
38635
|
-
/** @deprecated Feature color token, retained for one-cycle compatibility. */
|
|
38636
|
-
color: ColorTokenSchema.optional(),
|
|
38637
38639
|
/** @deprecated UI placement hint, retained for one-cycle compatibility. */
|
|
38638
38640
|
uiPosition: UiPositionSchema.optional(),
|
|
38639
38641
|
/** @deprecated Use lifecycle. */
|
|
@@ -38730,7 +38732,7 @@ var ResourceOntologyBindingSchema = external_exports.object({
|
|
|
38730
38732
|
/**
|
|
38731
38733
|
* Optional typed contract binding for this resource's workflow I/O.
|
|
38732
38734
|
* Each ref is a `package/subpath#ExportName` string that resolves to a
|
|
38733
|
-
* Zod schema in
|
|
38735
|
+
* Zod schema in the tenant-owned organization model package.
|
|
38734
38736
|
*
|
|
38735
38737
|
* Absence of this field preserves all existing behavior — it is additive + optional.
|
|
38736
38738
|
* Tier-1 validation (schema.ts): ref-string shape only (browser-safe, no imports).
|
|
@@ -39489,9 +39491,8 @@ function refineOrganizationModel(model, ctx) {
|
|
|
39489
39491
|
}
|
|
39490
39492
|
});
|
|
39491
39493
|
});
|
|
39492
|
-
const idx =
|
|
39494
|
+
const { crossRefIndex: idx, ontologyCompilation } = buildOmCompilationContext(model);
|
|
39493
39495
|
const { ontologyIndexByKind, ontologyIds } = idx;
|
|
39494
|
-
const ontologyCompilation = compileOrganizationOntology(model);
|
|
39495
39496
|
function topologyTargetExists(ref) {
|
|
39496
39497
|
if (ref.kind === "system") return systemsById.has(ref.id);
|
|
39497
39498
|
if (ref.kind === "resource") return resourcesById.has(ref.id);
|
|
@@ -41869,8 +41870,8 @@ function ontologyIndexForKind(index, kind) {
|
|
|
41869
41870
|
return index.sharedProperties;
|
|
41870
41871
|
case "group":
|
|
41871
41872
|
return index.groups;
|
|
41872
|
-
case "
|
|
41873
|
-
return index.
|
|
41873
|
+
case "endpoint":
|
|
41874
|
+
return index.endpoints;
|
|
41874
41875
|
}
|
|
41875
41876
|
}
|
|
41876
41877
|
function sameJson(left, right) {
|
|
@@ -42173,6 +42174,20 @@ function validateDeclaredSystemInterfaceReadiness(orgName, organizationModel) {
|
|
|
42173
42174
|
for (const { path: path3, system } of listAllSystems(model)) {
|
|
42174
42175
|
if (system.apiInterface === void 0) continue;
|
|
42175
42176
|
const interfaceKey = "api";
|
|
42177
|
+
const resourceIds = system.apiInterface.resourceIds ?? [];
|
|
42178
|
+
if (resourceIds.length === 0) {
|
|
42179
|
+
const readinessProfile = system.apiInterface.readinessProfile;
|
|
42180
|
+
if (readinessProfile !== void 0 && !SYSTEM_INTERFACE_PROFILES.some((profile) => profile.readinessProfile === readinessProfile)) {
|
|
42181
|
+
addSystemInterfaceIssue(issues, orgName, path3, interfaceKey, {
|
|
42182
|
+
family: "SYSTEM_INTERFACE_INVALID",
|
|
42183
|
+
code: "unknown-readiness-profile",
|
|
42184
|
+
path: `systems.${path3}.apiInterface.readinessProfile`,
|
|
42185
|
+
ref: readinessProfile,
|
|
42186
|
+
message: `System Interface "${path3}/${interfaceKey}" references unknown readiness profile "${readinessProfile}".`
|
|
42187
|
+
});
|
|
42188
|
+
}
|
|
42189
|
+
continue;
|
|
42190
|
+
}
|
|
42176
42191
|
const result = computeInterfaceReadiness(model, { systemPath: path3, interfaceKey });
|
|
42177
42192
|
for (const issue2 of result.issues) {
|
|
42178
42193
|
addSystemInterfaceIssue(issues, orgName, path3, interfaceKey, issue2);
|
|
@@ -45716,7 +45731,7 @@ function wrapAction(commandName, fn) {
|
|
|
45716
45731
|
// package.json
|
|
45717
45732
|
var package_default = {
|
|
45718
45733
|
name: "@elevasis/sdk",
|
|
45719
|
-
version: "1.
|
|
45734
|
+
version: "1.34.0",
|
|
45720
45735
|
description: "SDK for building Elevasis organization resources",
|
|
45721
45736
|
type: "module",
|
|
45722
45737
|
bin: {
|
|
@@ -46559,7 +46574,7 @@ async function pollForCompletion(resourceId, executionId, apiUrl) {
|
|
|
46559
46574
|
if (interrupted) {
|
|
46560
46575
|
return;
|
|
46561
46576
|
}
|
|
46562
|
-
await new Promise((
|
|
46577
|
+
await new Promise((resolve6) => setTimeout(resolve6, POLL_INTERVAL_MS));
|
|
46563
46578
|
if (interrupted) {
|
|
46564
46579
|
return;
|
|
46565
46580
|
}
|
|
@@ -47195,10 +47210,10 @@ init_source();
|
|
|
47195
47210
|
var import_readline = require("readline");
|
|
47196
47211
|
function confirm(message) {
|
|
47197
47212
|
const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
47198
|
-
return new Promise((
|
|
47213
|
+
return new Promise((resolve6) => {
|
|
47199
47214
|
rl.question(message, (answer) => {
|
|
47200
47215
|
rl.close();
|
|
47201
|
-
|
|
47216
|
+
resolve6(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
47202
47217
|
});
|
|
47203
47218
|
});
|
|
47204
47219
|
}
|
|
@@ -47952,8 +47967,28 @@ Project ${id} deleted.`));
|
|
|
47952
47967
|
}
|
|
47953
47968
|
|
|
47954
47969
|
// src/cli/commands/project/milestones.ts
|
|
47970
|
+
var import_node_fs3 = require("node:fs");
|
|
47955
47971
|
init_source();
|
|
47956
47972
|
init_config();
|
|
47973
|
+
function parseChecklistOption(options) {
|
|
47974
|
+
if (options.checklist !== void 0 && options.checklistFile !== void 0) {
|
|
47975
|
+
process.stderr.write(
|
|
47976
|
+
JSON.stringify({
|
|
47977
|
+
error: "Provide only one of --checklist or --checklist-file",
|
|
47978
|
+
code: "CONFLICTING_FLAGS"
|
|
47979
|
+
}) + "\n"
|
|
47980
|
+
);
|
|
47981
|
+
process.exit(1);
|
|
47982
|
+
}
|
|
47983
|
+
const raw = options.checklistFile !== void 0 ? (0, import_node_fs3.readFileSync)(resolveProjectRelative(options.checklistFile), "utf8") : options.checklist;
|
|
47984
|
+
if (raw === void 0) return void 0;
|
|
47985
|
+
try {
|
|
47986
|
+
return JSON.parse(raw);
|
|
47987
|
+
} catch {
|
|
47988
|
+
process.stderr.write(JSON.stringify({ error: "Checklist must be valid JSON", code: "INVALID_JSON" }) + "\n");
|
|
47989
|
+
process.exit(1);
|
|
47990
|
+
}
|
|
47991
|
+
}
|
|
47957
47992
|
function registerMilestoneList(program3) {
|
|
47958
47993
|
program3.command("project:milestone:list").description("List milestones for a project\n Example: elevasis-sdk project:milestone:list --project <uuid>").requiredOption("--project <project-id>", "Project ID (UUID)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
47959
47994
|
wrapAction("project:milestone:list", async (options) => {
|
|
@@ -48013,7 +48048,10 @@ Milestone created: ${m.name}`));
|
|
|
48013
48048
|
);
|
|
48014
48049
|
}
|
|
48015
48050
|
function registerMilestoneUpdate(program3) {
|
|
48016
|
-
program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--description <description>", "New description").option("--due-date <date>", "New due date (ISO 8601)").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48051
|
+
program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--description <description>", "New description").option("--due-date <date>", "New due date (ISO 8601)").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48052
|
+
"--checklist-file <path>",
|
|
48053
|
+
"Read replacement checklist from a JSON file. Relative paths resolve against the project root."
|
|
48054
|
+
).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
48017
48055
|
wrapAction(
|
|
48018
48056
|
"project:milestone:update",
|
|
48019
48057
|
async (id, options) => {
|
|
@@ -48022,20 +48060,12 @@ function registerMilestoneUpdate(program3) {
|
|
|
48022
48060
|
if (options.status !== void 0) body.status = options.status;
|
|
48023
48061
|
if (options.description !== void 0) body.description = options.description;
|
|
48024
48062
|
if (options.dueDate !== void 0) body.due_date = options.dueDate;
|
|
48025
|
-
|
|
48026
|
-
|
|
48027
|
-
body.checklist = JSON.parse(options.checklist);
|
|
48028
|
-
} catch {
|
|
48029
|
-
process.stderr.write(
|
|
48030
|
-
JSON.stringify({ error: "--checklist must be valid JSON", code: "INVALID_JSON" }) + "\n"
|
|
48031
|
-
);
|
|
48032
|
-
process.exit(1);
|
|
48033
|
-
}
|
|
48034
|
-
}
|
|
48063
|
+
const checklist = parseChecklistOption(options);
|
|
48064
|
+
if (checklist !== void 0) body.checklist = checklist;
|
|
48035
48065
|
if (Object.keys(body).length === 0) {
|
|
48036
48066
|
process.stderr.write(
|
|
48037
48067
|
JSON.stringify({
|
|
48038
|
-
error: "At least one field must be provided (--name, --status, --description, --due-date, --checklist)",
|
|
48068
|
+
error: "At least one field must be provided (--name, --status, --description, --due-date, --checklist, --checklist-file)",
|
|
48039
48069
|
code: "MISSING_FIELDS"
|
|
48040
48070
|
}) + "\n"
|
|
48041
48071
|
);
|
|
@@ -48073,8 +48103,28 @@ Milestone ${id} deleted.`));
|
|
|
48073
48103
|
}
|
|
48074
48104
|
|
|
48075
48105
|
// src/cli/commands/project/tasks.ts
|
|
48106
|
+
var import_node_fs4 = require("node:fs");
|
|
48076
48107
|
init_source();
|
|
48077
48108
|
init_config();
|
|
48109
|
+
function parseChecklistOption2(options) {
|
|
48110
|
+
if (options.checklist !== void 0 && options.checklistFile !== void 0) {
|
|
48111
|
+
process.stderr.write(
|
|
48112
|
+
JSON.stringify({
|
|
48113
|
+
error: "Provide only one of --checklist or --checklist-file",
|
|
48114
|
+
code: "CONFLICTING_FLAGS"
|
|
48115
|
+
}) + "\n"
|
|
48116
|
+
);
|
|
48117
|
+
process.exit(1);
|
|
48118
|
+
}
|
|
48119
|
+
const raw = options.checklistFile !== void 0 ? (0, import_node_fs4.readFileSync)(resolveProjectRelative(options.checklistFile), "utf8") : options.checklist;
|
|
48120
|
+
if (raw === void 0) return void 0;
|
|
48121
|
+
try {
|
|
48122
|
+
return JSON.parse(raw);
|
|
48123
|
+
} catch {
|
|
48124
|
+
process.stderr.write(JSON.stringify({ error: "Checklist must be valid JSON", code: "INVALID_JSON" }) + "\n");
|
|
48125
|
+
process.exit(1);
|
|
48126
|
+
}
|
|
48127
|
+
}
|
|
48078
48128
|
function registerTaskList(program3) {
|
|
48079
48129
|
program3.command("project:task:list").description(
|
|
48080
48130
|
"List tasks for a project\n Example: elevasis-sdk project:task:list --project <uuid> --status in_progress"
|
|
@@ -48142,7 +48192,10 @@ function registerTaskCreate(program3) {
|
|
|
48142
48192
|
).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--title <title>", "Task title / name").option("--status <status>", "Status: planned | in_progress | blocked | completed | cancelled").option(
|
|
48143
48193
|
"--type <type>",
|
|
48144
48194
|
"Type: documentation | code | report | design | refactor | feature | bug | research | other"
|
|
48145
|
-
).option("--milestone <milestone-id>", "Milestone ID (UUID)").option("--parent <parent-task-id>", "Parent task ID (UUID) for subtasks").option("--description <description>", "Task description").option("--checklist <json>", `Checklist items as JSON array: '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48195
|
+
).option("--milestone <milestone-id>", "Milestone ID (UUID)").option("--parent <parent-task-id>", "Parent task ID (UUID) for subtasks").option("--description <description>", "Task description").option("--checklist <json>", `Checklist items as JSON array: '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48196
|
+
"--checklist-file <path>",
|
|
48197
|
+
"Read checklist items from a JSON file. Relative paths resolve against the project root."
|
|
48198
|
+
).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
48146
48199
|
wrapAction(
|
|
48147
48200
|
"project:task:create",
|
|
48148
48201
|
async (options) => {
|
|
@@ -48155,16 +48208,8 @@ function registerTaskCreate(program3) {
|
|
|
48155
48208
|
if (options.milestone) body.milestone_id = options.milestone;
|
|
48156
48209
|
if (options.parent) body.parent_task_id = options.parent;
|
|
48157
48210
|
if (options.description) body.description = options.description;
|
|
48158
|
-
|
|
48159
|
-
|
|
48160
|
-
body.checklist = JSON.parse(options.checklist);
|
|
48161
|
-
} catch {
|
|
48162
|
-
process.stderr.write(
|
|
48163
|
-
JSON.stringify({ error: "--checklist must be valid JSON", code: "INVALID_JSON" }) + "\n"
|
|
48164
|
-
);
|
|
48165
|
-
process.exit(1);
|
|
48166
|
-
}
|
|
48167
|
-
}
|
|
48211
|
+
const checklist = parseChecklistOption2(options);
|
|
48212
|
+
if (checklist !== void 0) body.checklist = checklist;
|
|
48168
48213
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
48169
48214
|
const result = await apiPost("/api/external/project-tasks", body, apiUrl);
|
|
48170
48215
|
if (options.pretty) {
|
|
@@ -48185,7 +48230,10 @@ function registerTaskUpdate(program3) {
|
|
|
48185
48230
|
program3.command("project:task:update <id>").description("Update a task\n Example: elevasis-sdk project:task:update <uuid> --status completed").option("--title <title>", "New task title").option(
|
|
48186
48231
|
"--status <status>",
|
|
48187
48232
|
"New status: planned | in_progress | blocked | completed | cancelled | submitted | approved | rejected | revision_requested"
|
|
48188
|
-
).option("--milestone <milestone-id>", "New milestone ID (UUID)").option("--description <description>", "New description").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48233
|
+
).option("--milestone <milestone-id>", "New milestone ID (UUID)").option("--description <description>", "New description").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
|
|
48234
|
+
"--checklist-file <path>",
|
|
48235
|
+
"Read replacement checklist from a JSON file. Relative paths resolve against the project root."
|
|
48236
|
+
).option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
48189
48237
|
wrapAction(
|
|
48190
48238
|
"project:task:update",
|
|
48191
48239
|
async (id, options) => {
|
|
@@ -48194,20 +48242,12 @@ function registerTaskUpdate(program3) {
|
|
|
48194
48242
|
if (options.status !== void 0) body.status = options.status;
|
|
48195
48243
|
if (options.milestone !== void 0) body.milestone_id = options.milestone;
|
|
48196
48244
|
if (options.description !== void 0) body.description = options.description;
|
|
48197
|
-
|
|
48198
|
-
|
|
48199
|
-
body.checklist = JSON.parse(options.checklist);
|
|
48200
|
-
} catch {
|
|
48201
|
-
process.stderr.write(
|
|
48202
|
-
JSON.stringify({ error: "--checklist must be valid JSON", code: "INVALID_JSON" }) + "\n"
|
|
48203
|
-
);
|
|
48204
|
-
process.exit(1);
|
|
48205
|
-
}
|
|
48206
|
-
}
|
|
48245
|
+
const checklist = parseChecklistOption2(options);
|
|
48246
|
+
if (checklist !== void 0) body.checklist = checklist;
|
|
48207
48247
|
if (Object.keys(body).length === 0) {
|
|
48208
48248
|
process.stderr.write(
|
|
48209
48249
|
JSON.stringify({
|
|
48210
|
-
error: "At least one field must be provided (--title, --status, --milestone, --description, --checklist)",
|
|
48250
|
+
error: "At least one field must be provided (--title, --status, --milestone, --description, --checklist, --checklist-file)",
|
|
48211
48251
|
code: "MISSING_FIELDS"
|
|
48212
48252
|
}) + "\n"
|
|
48213
48253
|
);
|
|
@@ -48634,6 +48674,15 @@ function registerProjectCommands(program3) {
|
|
|
48634
48674
|
}
|
|
48635
48675
|
|
|
48636
48676
|
// ../core/src/knowledge/queries.ts
|
|
48677
|
+
var DOMAIN_ITEM_KINDS = ["clients", "roles", "policies", "customers", "offerings", "goals"];
|
|
48678
|
+
var BARE_PREFIX_TO_DOMAIN = {
|
|
48679
|
+
client: "clients",
|
|
48680
|
+
role: "roles",
|
|
48681
|
+
policy: "policies",
|
|
48682
|
+
customer: "customers",
|
|
48683
|
+
offering: "offerings",
|
|
48684
|
+
goal: "goals"
|
|
48685
|
+
};
|
|
48637
48686
|
function toGraphNodeId(omNodeId) {
|
|
48638
48687
|
return `knowledge:${omNodeId}`;
|
|
48639
48688
|
}
|
|
@@ -48782,11 +48831,32 @@ function parsePath(pathString) {
|
|
|
48782
48831
|
if (first === "all-roles" && rest.length === 0) {
|
|
48783
48832
|
return { mount: "all-roles", args: [] };
|
|
48784
48833
|
}
|
|
48834
|
+
if (first === "by-domain") {
|
|
48835
|
+
if (rest.length === 0) {
|
|
48836
|
+
throw new Error(`parsePath: /by-domain requires a domain argument, got: "${pathString}"`);
|
|
48837
|
+
}
|
|
48838
|
+
const domain2 = rest[0];
|
|
48839
|
+
if (!DOMAIN_ITEM_KINDS.includes(domain2)) {
|
|
48840
|
+
throw new Error(`parsePath: /by-domain unknown domain "${domain2}". Supported: ${DOMAIN_ITEM_KINDS.join(", ")}`);
|
|
48841
|
+
}
|
|
48842
|
+
return { mount: "by-domain", args: [domain2] };
|
|
48843
|
+
}
|
|
48844
|
+
if (first === "by-item") {
|
|
48845
|
+
if (rest.length < 2) {
|
|
48846
|
+
throw new Error(`parsePath: /by-item requires <domain>/<itemId>, got: "${pathString}"`);
|
|
48847
|
+
}
|
|
48848
|
+
const domain2 = rest[0];
|
|
48849
|
+
if (!DOMAIN_ITEM_KINDS.includes(domain2)) {
|
|
48850
|
+
throw new Error(`parsePath: /by-item unknown domain "${domain2}". Supported: ${DOMAIN_ITEM_KINDS.join(", ")}`);
|
|
48851
|
+
}
|
|
48852
|
+
const itemId = rest.slice(1).join("/");
|
|
48853
|
+
return { mount: "by-item", args: [domain2, itemId] };
|
|
48854
|
+
}
|
|
48785
48855
|
if (segments.length === 1) {
|
|
48786
48856
|
return { mount: "node", args: [first] };
|
|
48787
48857
|
}
|
|
48788
48858
|
throw new Error(
|
|
48789
|
-
`parsePath: unrecognized path pattern "${pathString}". Supported: /by-system/<id>, /by-kind/<kind>, /by-owner/<id>, /graph/<nodeId>/governs, /graph/<nodeId>/governed-by, /<nodeId>, /all-systems, /all-resources, /all-roles`
|
|
48859
|
+
`parsePath: unrecognized path pattern "${pathString}". Supported: /by-system/<id>, /by-kind/<kind>, /by-owner/<id>, /by-domain/<domain>, /by-item/<domain>/<itemId>, /graph/<nodeId>/governs, /graph/<nodeId>/governed-by, /<nodeId>, /all-systems, /all-resources, /all-roles`
|
|
48790
48860
|
);
|
|
48791
48861
|
}
|
|
48792
48862
|
function omSearch(model, query, options = {}) {
|
|
@@ -48971,7 +49041,7 @@ function collectOntologyEntries(scope) {
|
|
|
48971
49041
|
["value-type", scope.valueTypes],
|
|
48972
49042
|
["property", scope.sharedProperties],
|
|
48973
49043
|
["group", scope.groups],
|
|
48974
|
-
["
|
|
49044
|
+
["endpoint", scope.endpoints]
|
|
48975
49045
|
];
|
|
48976
49046
|
for (const [subKind, records] of buckets) {
|
|
48977
49047
|
if (!records) continue;
|
|
@@ -48995,12 +49065,26 @@ function collectOntologyEntries(scope) {
|
|
|
48995
49065
|
return entries;
|
|
48996
49066
|
}
|
|
48997
49067
|
function detectKind(model, id) {
|
|
48998
|
-
if (/:(object|action|event|catalog|link|interface|value-type|property|group|
|
|
49068
|
+
if (/:(object|action|event|catalog|link|interface|value-type|property|group|endpoint)\//.test(id)) {
|
|
48999
49069
|
return "ontology";
|
|
49000
49070
|
}
|
|
49001
49071
|
if (id.startsWith("knowledge.")) return "knowledge";
|
|
49002
49072
|
if (id.startsWith("role.")) return "role";
|
|
49003
49073
|
if (id.startsWith("policy.")) return "policy";
|
|
49074
|
+
if (id.startsWith("item:")) {
|
|
49075
|
+
const afterItem = id.slice("item:".length);
|
|
49076
|
+
const colonIdx = afterItem.indexOf(":");
|
|
49077
|
+
if (colonIdx > 0) {
|
|
49078
|
+
const domain2 = afterItem.slice(0, colonIdx);
|
|
49079
|
+
if (DOMAIN_ITEM_KINDS.includes(domain2)) return "domain-item";
|
|
49080
|
+
}
|
|
49081
|
+
return void 0;
|
|
49082
|
+
}
|
|
49083
|
+
const firstColon = id.indexOf(":");
|
|
49084
|
+
if (firstColon > 0) {
|
|
49085
|
+
const prefix = id.slice(0, firstColon);
|
|
49086
|
+
if (prefix in BARE_PREFIX_TO_DOMAIN) return "domain-item";
|
|
49087
|
+
}
|
|
49004
49088
|
if (model.systems && getSystemByPath(model.systems, id)) return "system";
|
|
49005
49089
|
if (model.resources?.[id]) return "resource";
|
|
49006
49090
|
return void 0;
|
|
@@ -49033,6 +49117,8 @@ function omDescribe(model, id) {
|
|
|
49033
49117
|
return describeRole(model, id);
|
|
49034
49118
|
case "policy":
|
|
49035
49119
|
return describePolicy(model, id);
|
|
49120
|
+
case "domain-item":
|
|
49121
|
+
return describeDomainItem(model, id);
|
|
49036
49122
|
}
|
|
49037
49123
|
}
|
|
49038
49124
|
function describeSystem(model, path3) {
|
|
@@ -49069,7 +49155,7 @@ function describeSystem(model, path3) {
|
|
|
49069
49155
|
["value-type", ontology.valueTypes],
|
|
49070
49156
|
["property", ontology.sharedProperties],
|
|
49071
49157
|
["group", ontology.groups],
|
|
49072
|
-
["
|
|
49158
|
+
["endpoint", ontology.endpoints]
|
|
49073
49159
|
];
|
|
49074
49160
|
for (const [k, records] of buckets) {
|
|
49075
49161
|
const count = records ? Object.keys(records).length : 0;
|
|
@@ -49147,7 +49233,7 @@ function describeOntology(model, id) {
|
|
|
49147
49233
|
["value-type", "valueTypes"],
|
|
49148
49234
|
["property", "sharedProperties"],
|
|
49149
49235
|
["group", "groups"],
|
|
49150
|
-
["
|
|
49236
|
+
["endpoint", "endpoints"]
|
|
49151
49237
|
];
|
|
49152
49238
|
const bucketKey = buckets.find((b) => b[0] === ontologyKind)?.[1];
|
|
49153
49239
|
if (!bucketKey) return void 0;
|
|
@@ -49208,6 +49294,77 @@ function describePolicy(model, id) {
|
|
|
49208
49294
|
effectKinds: (policy.actions ?? []).map((a) => a.kind)
|
|
49209
49295
|
};
|
|
49210
49296
|
}
|
|
49297
|
+
var DOMAIN_LABEL = {
|
|
49298
|
+
clients: "Clients",
|
|
49299
|
+
roles: "Roles",
|
|
49300
|
+
policies: "Policies",
|
|
49301
|
+
customers: "Customers",
|
|
49302
|
+
offerings: "Offerings",
|
|
49303
|
+
goals: "Goals"
|
|
49304
|
+
};
|
|
49305
|
+
var DOMAIN_GRAPH_PREFIX = {
|
|
49306
|
+
clients: "client",
|
|
49307
|
+
roles: "role",
|
|
49308
|
+
policies: "policy",
|
|
49309
|
+
customers: "customer-segment",
|
|
49310
|
+
offerings: "offering",
|
|
49311
|
+
goals: "goal"
|
|
49312
|
+
};
|
|
49313
|
+
function parseDomainItemRef(id) {
|
|
49314
|
+
if (id.startsWith("item:")) {
|
|
49315
|
+
const afterItem = id.slice("item:".length);
|
|
49316
|
+
const colonIdx = afterItem.indexOf(":");
|
|
49317
|
+
if (colonIdx <= 0) return void 0;
|
|
49318
|
+
const domain3 = afterItem.slice(0, colonIdx);
|
|
49319
|
+
const itemId2 = afterItem.slice(colonIdx + 1);
|
|
49320
|
+
if (!DOMAIN_ITEM_KINDS.includes(domain3) || !itemId2) return void 0;
|
|
49321
|
+
return { domain: domain3, itemId: itemId2 };
|
|
49322
|
+
}
|
|
49323
|
+
const firstColon = id.indexOf(":");
|
|
49324
|
+
if (firstColon <= 0) return void 0;
|
|
49325
|
+
const prefix = id.slice(0, firstColon);
|
|
49326
|
+
const domain2 = BARE_PREFIX_TO_DOMAIN[prefix];
|
|
49327
|
+
if (!domain2) return void 0;
|
|
49328
|
+
const itemId = id.slice(firstColon + 1);
|
|
49329
|
+
if (!itemId) return void 0;
|
|
49330
|
+
return { domain: domain2, itemId };
|
|
49331
|
+
}
|
|
49332
|
+
function describeDomainItem(model, id) {
|
|
49333
|
+
const parsed = parseDomainItemRef(id);
|
|
49334
|
+
if (!parsed) return void 0;
|
|
49335
|
+
const { domain: domain2, itemId } = parsed;
|
|
49336
|
+
const collection = model[domain2];
|
|
49337
|
+
const record2 = collection?.[itemId];
|
|
49338
|
+
if (!record2) return void 0;
|
|
49339
|
+
const name = domain2 === "clients" ? String(record2["name"] ?? itemId) : domain2 === "roles" ? String(record2["title"] ?? itemId) : domain2 === "policies" ? String(record2["label"] ?? itemId) : domain2 === "goals" ? String(record2["description"] ?? itemId) : String(record2["name"] ?? itemId);
|
|
49340
|
+
const graphNodeId = `${DOMAIN_GRAPH_PREFIX[domain2]}:${itemId}`;
|
|
49341
|
+
const containsParentIds = ["organization-model"];
|
|
49342
|
+
const governingKnowledge = [];
|
|
49343
|
+
for (const node of Object.values(model.knowledge ?? {})) {
|
|
49344
|
+
const governs2 = (node.links ?? []).some((link) => link.nodeId === graphNodeId);
|
|
49345
|
+
if (governs2) {
|
|
49346
|
+
governingKnowledge.push({
|
|
49347
|
+
id: node.id,
|
|
49348
|
+
title: node.title,
|
|
49349
|
+
knowledgeKind: node.kind
|
|
49350
|
+
});
|
|
49351
|
+
}
|
|
49352
|
+
}
|
|
49353
|
+
const canonicalId = `item:${domain2}:${itemId}`;
|
|
49354
|
+
return {
|
|
49355
|
+
kind: "domain-item",
|
|
49356
|
+
id: canonicalId,
|
|
49357
|
+
domain: domain2,
|
|
49358
|
+
name,
|
|
49359
|
+
location: {
|
|
49360
|
+
domainLabel: DOMAIN_LABEL[domain2],
|
|
49361
|
+
graphNodeId,
|
|
49362
|
+
containsParentIds
|
|
49363
|
+
},
|
|
49364
|
+
record: record2,
|
|
49365
|
+
governingKnowledge
|
|
49366
|
+
};
|
|
49367
|
+
}
|
|
49211
49368
|
|
|
49212
49369
|
// ../core/src/knowledge/format.ts
|
|
49213
49370
|
function formatText(results) {
|
|
@@ -49269,6 +49426,8 @@ function formatOmDescribe(result) {
|
|
|
49269
49426
|
return formatRoleDescribe(result);
|
|
49270
49427
|
case "policy":
|
|
49271
49428
|
return formatPolicyDescribe(result);
|
|
49429
|
+
case "domain-item":
|
|
49430
|
+
return formatDomainItemDescribe(result);
|
|
49272
49431
|
}
|
|
49273
49432
|
}
|
|
49274
49433
|
function section(title, body) {
|
|
@@ -49391,6 +49550,180 @@ function formatPolicyDescribe(r) {
|
|
|
49391
49550
|
${appliesLines.join("\n")}` : "";
|
|
49392
49551
|
return join5([header, effectSection, appliesSection]);
|
|
49393
49552
|
}
|
|
49553
|
+
function formatDomainItemDescribe(r) {
|
|
49554
|
+
const header = join5([
|
|
49555
|
+
`Domain Item: ${r.id}`,
|
|
49556
|
+
[
|
|
49557
|
+
field("Domain", r.location.domainLabel),
|
|
49558
|
+
field("Name", r.name),
|
|
49559
|
+
field("Graph node", r.location.graphNodeId),
|
|
49560
|
+
field("Parent nodes", r.location.containsParentIds.join(", "))
|
|
49561
|
+
].filter((s) => s.length > 0).join("\n")
|
|
49562
|
+
]);
|
|
49563
|
+
const recordLines = [];
|
|
49564
|
+
for (const [k, v] of Object.entries(r.record)) {
|
|
49565
|
+
if (v === void 0 || v === null) continue;
|
|
49566
|
+
if (typeof v === "object" && !Array.isArray(v) && Object.keys(v).length === 0) continue;
|
|
49567
|
+
const display = Array.isArray(v) ? v.length === 0 ? null : `[${v.slice(0, 5).join(", ")}${v.length > 5 ? `, ...+${v.length - 5}` : ""}]` : typeof v === "object" ? JSON.stringify(v).slice(0, 120) : String(v);
|
|
49568
|
+
if (display === null) continue;
|
|
49569
|
+
recordLines.push(` ${k}: ${display}`);
|
|
49570
|
+
}
|
|
49571
|
+
const recordSection = recordLines.length ? `Record:
|
|
49572
|
+
${recordLines.join("\n")}` : "";
|
|
49573
|
+
const govLines = r.governingKnowledge.map((g) => ` - ${g.id} [${g.knowledgeKind}] ${g.title}`);
|
|
49574
|
+
const govSection = govLines.length ? `Governing knowledge:
|
|
49575
|
+
${govLines.join("\n")}` : "Governing knowledge:\n (none)";
|
|
49576
|
+
return join5([header, recordSection, govSection]);
|
|
49577
|
+
}
|
|
49578
|
+
|
|
49579
|
+
// ../core/src/knowledge/cli-helpers.ts
|
|
49580
|
+
var OM_SEARCH_HIT_KINDS = ["system", "resource", "knowledge", "ontology", "role", "policy"];
|
|
49581
|
+
function parseKnowledgeSearchLimit(raw, commandName = "knowledge:search") {
|
|
49582
|
+
if (raw === void 0) return 10;
|
|
49583
|
+
const n = Number.parseInt(raw, 10);
|
|
49584
|
+
if (Number.isNaN(n) || n < 0) {
|
|
49585
|
+
throw new Error(`${commandName}: --limit must be a non-negative integer (got "${raw}")`);
|
|
49586
|
+
}
|
|
49587
|
+
return n;
|
|
49588
|
+
}
|
|
49589
|
+
function parseKnowledgeSearchKinds(raw, commandName = "knowledge:search") {
|
|
49590
|
+
if (raw === void 0) return void 0;
|
|
49591
|
+
const requested = raw.split(",").map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0);
|
|
49592
|
+
const valid = [];
|
|
49593
|
+
const invalid = [];
|
|
49594
|
+
for (const kind of requested) {
|
|
49595
|
+
if (OM_SEARCH_HIT_KINDS.includes(kind)) {
|
|
49596
|
+
valid.push(kind);
|
|
49597
|
+
} else {
|
|
49598
|
+
invalid.push(kind);
|
|
49599
|
+
}
|
|
49600
|
+
}
|
|
49601
|
+
if (invalid.length > 0) {
|
|
49602
|
+
throw new Error(`${commandName}: unknown kind(s) "${invalid.join(", ")}". Valid: ${OM_SEARCH_HIT_KINDS.join(", ")}`);
|
|
49603
|
+
}
|
|
49604
|
+
return valid.length > 0 ? valid : void 0;
|
|
49605
|
+
}
|
|
49606
|
+
function formatKnowledgeSystemsList(entries) {
|
|
49607
|
+
if (entries.length === 0) return "(no results)";
|
|
49608
|
+
const pathWidth = Math.max(...entries.map((e) => e.path.length), 4);
|
|
49609
|
+
const header = `${"PATH".padEnd(pathWidth)} LABEL`;
|
|
49610
|
+
const divider = "-".repeat(header.length + 20);
|
|
49611
|
+
const rows = entries.map((e) => {
|
|
49612
|
+
const label = e.system.label ?? e.system.title ?? e.path;
|
|
49613
|
+
return `${e.path.padEnd(pathWidth)} ${label}`;
|
|
49614
|
+
});
|
|
49615
|
+
return [header, divider, ...rows].join("\n");
|
|
49616
|
+
}
|
|
49617
|
+
function formatKnowledgeResourcesList(resources) {
|
|
49618
|
+
if (resources.length === 0) return "(no results)";
|
|
49619
|
+
const idWidth = Math.max(...resources.map((r) => r.id.length), 4);
|
|
49620
|
+
const kindWidth = Math.max(...resources.map((r) => r.kind.length), 4);
|
|
49621
|
+
const header = `${"ID".padEnd(idWidth)} ${"KIND".padEnd(kindWidth)} TITLE`;
|
|
49622
|
+
const divider = "-".repeat(header.length + 20);
|
|
49623
|
+
const rows = resources.map((r) => {
|
|
49624
|
+
const title = r.title ?? r.id;
|
|
49625
|
+
return `${r.id.padEnd(idWidth)} ${r.kind.padEnd(kindWidth)} ${title}`;
|
|
49626
|
+
});
|
|
49627
|
+
return [header, divider, ...rows].join("\n");
|
|
49628
|
+
}
|
|
49629
|
+
function formatKnowledgeRolesList(roles) {
|
|
49630
|
+
if (roles.length === 0) return "(no results)";
|
|
49631
|
+
const idWidth = Math.max(...roles.map((r) => r.id.length), 4);
|
|
49632
|
+
const header = `${"ID".padEnd(idWidth)} TITLE`;
|
|
49633
|
+
const divider = "-".repeat(header.length + 20);
|
|
49634
|
+
const rows = roles.map((r) => `${r.id.padEnd(idWidth)} ${r.title}`);
|
|
49635
|
+
return [header, divider, ...rows].join("\n");
|
|
49636
|
+
}
|
|
49637
|
+
function normalizeKnowledgeNodeId(id) {
|
|
49638
|
+
return id.startsWith("knowledge:") ? id.slice("knowledge:".length) : id;
|
|
49639
|
+
}
|
|
49640
|
+
function formatKnowledgeInvocationLabel(invocation) {
|
|
49641
|
+
switch (invocation.kind) {
|
|
49642
|
+
case "slash-command":
|
|
49643
|
+
return invocation.command;
|
|
49644
|
+
case "mcp-tool":
|
|
49645
|
+
return `${invocation.server}/${invocation.name}`;
|
|
49646
|
+
case "api-endpoint":
|
|
49647
|
+
return `${invocation.method} ${invocation.path}`;
|
|
49648
|
+
case "script-execution":
|
|
49649
|
+
return invocation.resourceId;
|
|
49650
|
+
}
|
|
49651
|
+
}
|
|
49652
|
+
function pushActionSource(sources, seen, action) {
|
|
49653
|
+
if (!action || action.invocations.length === 0) return;
|
|
49654
|
+
const key = `action:${action.id}`;
|
|
49655
|
+
if (seen.has(key)) return;
|
|
49656
|
+
seen.add(key);
|
|
49657
|
+
sources.push({
|
|
49658
|
+
kind: "action",
|
|
49659
|
+
id: action.id,
|
|
49660
|
+
label: action.label,
|
|
49661
|
+
targetNodeId: `action:${action.id}`,
|
|
49662
|
+
invocations: action.invocations
|
|
49663
|
+
});
|
|
49664
|
+
}
|
|
49665
|
+
function pushAgentResourceSource(sources, seen, resource) {
|
|
49666
|
+
if (!resource || resource.kind !== "agent" || resource.invocations.length === 0) return;
|
|
49667
|
+
const agentResource = resource;
|
|
49668
|
+
const key = `agent-resource:${agentResource.id}`;
|
|
49669
|
+
if (seen.has(key)) return;
|
|
49670
|
+
seen.add(key);
|
|
49671
|
+
sources.push({
|
|
49672
|
+
kind: "agent-resource",
|
|
49673
|
+
id: agentResource.id,
|
|
49674
|
+
label: agentResource.id,
|
|
49675
|
+
targetNodeId: `resource:${agentResource.id}`,
|
|
49676
|
+
invocations: agentResource.invocations
|
|
49677
|
+
});
|
|
49678
|
+
}
|
|
49679
|
+
function resolveKnowledgeInvocationNeighbors(model, id) {
|
|
49680
|
+
const normalizedNodeId = normalizeKnowledgeNodeId(id);
|
|
49681
|
+
const node = model.knowledge[normalizedNodeId];
|
|
49682
|
+
if (!node) return void 0;
|
|
49683
|
+
const sources = [];
|
|
49684
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49685
|
+
for (const link of node.links) {
|
|
49686
|
+
const target = link.target;
|
|
49687
|
+
if (target.kind === "action") {
|
|
49688
|
+
pushActionSource(sources, seen, model.actions[target.id]);
|
|
49689
|
+
continue;
|
|
49690
|
+
}
|
|
49691
|
+
if (target.kind === "resource") {
|
|
49692
|
+
pushAgentResourceSource(sources, seen, model.resources[target.id]);
|
|
49693
|
+
continue;
|
|
49694
|
+
}
|
|
49695
|
+
if (target.kind === "system") {
|
|
49696
|
+
const system = getSystem(model, target.id);
|
|
49697
|
+
for (const actionRef of system?.actions ?? []) {
|
|
49698
|
+
pushActionSource(sources, seen, model.actions[actionRef.actionId]);
|
|
49699
|
+
}
|
|
49700
|
+
for (const resource of Object.values(model.resources)) {
|
|
49701
|
+
if (resource.systemPath === target.id) {
|
|
49702
|
+
pushAgentResourceSource(sources, seen, resource);
|
|
49703
|
+
}
|
|
49704
|
+
}
|
|
49705
|
+
}
|
|
49706
|
+
}
|
|
49707
|
+
return {
|
|
49708
|
+
id: node.id,
|
|
49709
|
+
title: node.title,
|
|
49710
|
+
invocationSources: sources.sort((a, b) => a.targetNodeId.localeCompare(b.targetNodeId))
|
|
49711
|
+
};
|
|
49712
|
+
}
|
|
49713
|
+
function formatKnowledgeInvocationNeighbors(result) {
|
|
49714
|
+
const lines = [`Invocation-bearing graph neighbors for ${result.id}`, ""];
|
|
49715
|
+
if (result.invocationSources.length === 0) {
|
|
49716
|
+
lines.push(" (none)");
|
|
49717
|
+
} else {
|
|
49718
|
+
for (const source of result.invocationSources) {
|
|
49719
|
+
lines.push(`${source.kind}: ${source.id}`);
|
|
49720
|
+
for (const invocation of source.invocations) {
|
|
49721
|
+
lines.push(` ${invocation.kind}: ${formatKnowledgeInvocationLabel(invocation)}`);
|
|
49722
|
+
}
|
|
49723
|
+
}
|
|
49724
|
+
}
|
|
49725
|
+
return lines.join("\n");
|
|
49726
|
+
}
|
|
49394
49727
|
|
|
49395
49728
|
// src/cli/commands/knowledge/ls.ts
|
|
49396
49729
|
init_config();
|
|
@@ -49450,37 +49783,9 @@ async function loadOrgModel(projectRoot) {
|
|
|
49450
49783
|
}
|
|
49451
49784
|
|
|
49452
49785
|
// src/cli/commands/knowledge/ls.ts
|
|
49453
|
-
function formatAllSystems(entries) {
|
|
49454
|
-
if (entries.length === 0) return "(no results)";
|
|
49455
|
-
const pathWidth = Math.max(...entries.map((e) => e.path.length), 4);
|
|
49456
|
-
const header = `${"PATH".padEnd(pathWidth)} LABEL`;
|
|
49457
|
-
const divider = "-".repeat(header.length + 20);
|
|
49458
|
-
const rows = entries.map((e) => {
|
|
49459
|
-
const label = e.system.label ?? e.system.title ?? e.path;
|
|
49460
|
-
return `${e.path.padEnd(pathWidth)} ${label}`;
|
|
49461
|
-
});
|
|
49462
|
-
return [header, divider, ...rows].join("\n");
|
|
49463
|
-
}
|
|
49464
|
-
function formatAllResources(resources) {
|
|
49465
|
-
if (resources.length === 0) return "(no results)";
|
|
49466
|
-
const idWidth = Math.max(...resources.map((r) => r.id.length), 4);
|
|
49467
|
-
const kindWidth = Math.max(...resources.map((r) => r.kind.length), 4);
|
|
49468
|
-
const header = `${"ID".padEnd(idWidth)} ${"KIND".padEnd(kindWidth)} TITLE`;
|
|
49469
|
-
const divider = "-".repeat(header.length + 20);
|
|
49470
|
-
const rows = resources.map((r) => `${r.id.padEnd(idWidth)} ${r.kind.padEnd(kindWidth)} ${r.title}`);
|
|
49471
|
-
return [header, divider, ...rows].join("\n");
|
|
49472
|
-
}
|
|
49473
|
-
function formatAllRoles(roles) {
|
|
49474
|
-
if (roles.length === 0) return "(no results)";
|
|
49475
|
-
const idWidth = Math.max(...roles.map((r) => r.id.length), 4);
|
|
49476
|
-
const header = `${"ID".padEnd(idWidth)} TITLE`;
|
|
49477
|
-
const divider = "-".repeat(header.length + 20);
|
|
49478
|
-
const rows = roles.map((r) => `${r.id.padEnd(idWidth)} ${r.title}`);
|
|
49479
|
-
return [header, divider, ...rows].join("\n");
|
|
49480
|
-
}
|
|
49481
49786
|
function registerKnowledgeLs(program3) {
|
|
49482
49787
|
program3.command("knowledge:ls <path>").alias("om:ls").description(
|
|
49483
|
-
"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\n elevasis-sdk om:ls /all-systems\n elevasis-sdk om:ls /all-resources\n elevasis-sdk om:ls /all-roles"
|
|
49788
|
+
"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\n elevasis-sdk om:ls /all-systems\n elevasis-sdk om:ls /all-resources\n elevasis-sdk om:ls /all-roles\n elevasis-sdk om:ls /by-domain/clients\n elevasis-sdk om:ls /by-item/clients/<uuid>"
|
|
49484
49789
|
).option("--json", "Print wrapped JSON envelope { path, mount, args, results }").option("--ids-only", "Print one ID per line (for piping)").action(
|
|
49485
49790
|
wrapAction("knowledge:ls", async (pathArg, options) => {
|
|
49486
49791
|
let parsed;
|
|
@@ -49501,7 +49806,7 @@ function registerKnowledgeLs(program3) {
|
|
|
49501
49806
|
const out = entries.map((e) => e.path).join("\n");
|
|
49502
49807
|
if (out) process.stdout.write(out + "\n");
|
|
49503
49808
|
} else {
|
|
49504
|
-
process.stdout.write(
|
|
49809
|
+
process.stdout.write(formatKnowledgeSystemsList(entries) + "\n");
|
|
49505
49810
|
}
|
|
49506
49811
|
return;
|
|
49507
49812
|
}
|
|
@@ -49513,7 +49818,7 @@ function registerKnowledgeLs(program3) {
|
|
|
49513
49818
|
const out = resources.map((r) => r.id).join("\n");
|
|
49514
49819
|
if (out) process.stdout.write(out + "\n");
|
|
49515
49820
|
} else {
|
|
49516
|
-
process.stdout.write(
|
|
49821
|
+
process.stdout.write(formatKnowledgeResourcesList(resources) + "\n");
|
|
49517
49822
|
}
|
|
49518
49823
|
return;
|
|
49519
49824
|
}
|
|
@@ -49525,7 +49830,50 @@ function registerKnowledgeLs(program3) {
|
|
|
49525
49830
|
const out = roles.map((r) => r.id).join("\n");
|
|
49526
49831
|
if (out) process.stdout.write(out + "\n");
|
|
49527
49832
|
} else {
|
|
49528
|
-
process.stdout.write(
|
|
49833
|
+
process.stdout.write(formatKnowledgeRolesList(roles) + "\n");
|
|
49834
|
+
}
|
|
49835
|
+
return;
|
|
49836
|
+
}
|
|
49837
|
+
if (parsed.mount === "by-domain") {
|
|
49838
|
+
const domain2 = parsed.args[0];
|
|
49839
|
+
const collection = model[domain2] ?? {};
|
|
49840
|
+
const ids = Object.keys(collection).map((id) => `item:${domain2}:${id}`);
|
|
49841
|
+
if (options.json) {
|
|
49842
|
+
process.stdout.write(formatJson({ path: pathArg, parsed, results: ids }) + "\n");
|
|
49843
|
+
} else if (options.idsOnly) {
|
|
49844
|
+
if (ids.length > 0) process.stdout.write(ids.join("\n") + "\n");
|
|
49845
|
+
} else {
|
|
49846
|
+
if (ids.length === 0) {
|
|
49847
|
+
process.stdout.write(`(no items in domain "${domain2}")
|
|
49848
|
+
`);
|
|
49849
|
+
} else {
|
|
49850
|
+
process.stdout.write(`Domain: ${domain2} (${ids.length} item${ids.length === 1 ? "" : "s"})
|
|
49851
|
+
`);
|
|
49852
|
+
for (const id of ids) process.stdout.write(` ${id}
|
|
49853
|
+
`);
|
|
49854
|
+
}
|
|
49855
|
+
}
|
|
49856
|
+
return;
|
|
49857
|
+
}
|
|
49858
|
+
if (parsed.mount === "by-item") {
|
|
49859
|
+
const domain2 = parsed.args[0];
|
|
49860
|
+
const itemId = parsed.args[1];
|
|
49861
|
+
const canonicalId = `item:${domain2}:${itemId}`;
|
|
49862
|
+
const result = omDescribe(model, canonicalId);
|
|
49863
|
+
if (!result) {
|
|
49864
|
+
process.stderr.write(
|
|
49865
|
+
`knowledge:ls: no item found for "${canonicalId}".
|
|
49866
|
+
Use om:ls /by-domain/${domain2} to list all items in this domain.
|
|
49867
|
+
`
|
|
49868
|
+
);
|
|
49869
|
+
process.exit(1);
|
|
49870
|
+
}
|
|
49871
|
+
if (options.json) {
|
|
49872
|
+
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
49873
|
+
} else if (options.idsOnly) {
|
|
49874
|
+
process.stdout.write(result.id + "\n");
|
|
49875
|
+
} else {
|
|
49876
|
+
process.stdout.write(formatOmDescribe(result) + "\n");
|
|
49529
49877
|
}
|
|
49530
49878
|
return;
|
|
49531
49879
|
}
|
|
@@ -49679,82 +50027,6 @@ function registerKnowledgeGraph(program3) {
|
|
|
49679
50027
|
|
|
49680
50028
|
// src/cli/commands/knowledge/skills.ts
|
|
49681
50029
|
init_config();
|
|
49682
|
-
function normalizeKnowledgeId(id) {
|
|
49683
|
-
return id.startsWith("knowledge:") ? id.slice("knowledge:".length) : id;
|
|
49684
|
-
}
|
|
49685
|
-
function invocationLabel2(invocation) {
|
|
49686
|
-
switch (invocation.kind) {
|
|
49687
|
-
case "slash-command":
|
|
49688
|
-
return invocation.command;
|
|
49689
|
-
case "mcp-tool":
|
|
49690
|
-
return `${invocation.server}/${invocation.name}`;
|
|
49691
|
-
case "api-endpoint":
|
|
49692
|
-
return `${invocation.method} ${invocation.path}`;
|
|
49693
|
-
case "script-execution":
|
|
49694
|
-
return invocation.resourceId;
|
|
49695
|
-
}
|
|
49696
|
-
}
|
|
49697
|
-
function pushActionSource(sources, seen, action) {
|
|
49698
|
-
if (!action || action.invocations.length === 0) return;
|
|
49699
|
-
const key = `action:${action.id}`;
|
|
49700
|
-
if (seen.has(key)) return;
|
|
49701
|
-
seen.add(key);
|
|
49702
|
-
sources.push({
|
|
49703
|
-
kind: "action",
|
|
49704
|
-
id: action.id,
|
|
49705
|
-
label: action.label,
|
|
49706
|
-
targetNodeId: `action:${action.id}`,
|
|
49707
|
-
invocations: action.invocations
|
|
49708
|
-
});
|
|
49709
|
-
}
|
|
49710
|
-
function pushAgentResourceSource(sources, seen, resource) {
|
|
49711
|
-
if (!resource || resource.kind !== "agent" || resource.invocations.length === 0) return;
|
|
49712
|
-
const agentResource = resource;
|
|
49713
|
-
const key = `agent-resource:${agentResource.id}`;
|
|
49714
|
-
if (seen.has(key)) return;
|
|
49715
|
-
seen.add(key);
|
|
49716
|
-
sources.push({
|
|
49717
|
-
kind: "agent-resource",
|
|
49718
|
-
id: agentResource.id,
|
|
49719
|
-
label: agentResource.id,
|
|
49720
|
-
targetNodeId: `resource:${agentResource.id}`,
|
|
49721
|
-
invocations: agentResource.invocations
|
|
49722
|
-
});
|
|
49723
|
-
}
|
|
49724
|
-
function resolveKnowledgeInvocationNeighbors(model, id) {
|
|
49725
|
-
const normalizedNodeId = normalizeKnowledgeId(id);
|
|
49726
|
-
const node = model.knowledge[normalizedNodeId];
|
|
49727
|
-
if (!node) return void 0;
|
|
49728
|
-
const sources = [];
|
|
49729
|
-
const seen = /* @__PURE__ */ new Set();
|
|
49730
|
-
for (const link of node.links) {
|
|
49731
|
-
const target = link.target;
|
|
49732
|
-
if (target.kind === "action") {
|
|
49733
|
-
pushActionSource(sources, seen, model.actions[target.id]);
|
|
49734
|
-
continue;
|
|
49735
|
-
}
|
|
49736
|
-
if (target.kind === "resource") {
|
|
49737
|
-
pushAgentResourceSource(sources, seen, model.resources[target.id]);
|
|
49738
|
-
continue;
|
|
49739
|
-
}
|
|
49740
|
-
if (target.kind === "system") {
|
|
49741
|
-
const system = getSystem(model, target.id);
|
|
49742
|
-
for (const actionRef of system?.actions ?? []) {
|
|
49743
|
-
pushActionSource(sources, seen, model.actions[actionRef.actionId]);
|
|
49744
|
-
}
|
|
49745
|
-
for (const resource of Object.values(model.resources)) {
|
|
49746
|
-
if (resource.systemPath === target.id) {
|
|
49747
|
-
pushAgentResourceSource(sources, seen, resource);
|
|
49748
|
-
}
|
|
49749
|
-
}
|
|
49750
|
-
}
|
|
49751
|
-
}
|
|
49752
|
-
return {
|
|
49753
|
-
id: node.id,
|
|
49754
|
-
title: node.title,
|
|
49755
|
-
invocationSources: sources.sort((a, b) => a.targetNodeId.localeCompare(b.targetNodeId))
|
|
49756
|
-
};
|
|
49757
|
-
}
|
|
49758
50030
|
function registerKnowledgeSkills(program3) {
|
|
49759
50031
|
program3.command("knowledge:skills <id>").alias("om:skills").description(
|
|
49760
50032
|
"Show callable invocations on graph neighbors for a knowledge node\n Example: elevasis-sdk om:skills knowledge.new-vertical-launch-playbook"
|
|
@@ -49772,28 +50044,17 @@ function registerKnowledgeSkills(program3) {
|
|
|
49772
50044
|
process.stdout.write(JSON.stringify(result, null, 2) + "\n");
|
|
49773
50045
|
return;
|
|
49774
50046
|
}
|
|
49775
|
-
|
|
49776
|
-
if (result.invocationSources.length === 0) {
|
|
49777
|
-
lines.push(" (none)");
|
|
49778
|
-
} else {
|
|
49779
|
-
for (const source of result.invocationSources) {
|
|
49780
|
-
lines.push(`${source.kind}: ${source.id}`);
|
|
49781
|
-
for (const invocation of source.invocations) {
|
|
49782
|
-
lines.push(` ${invocation.kind}: ${invocationLabel2(invocation)}`);
|
|
49783
|
-
}
|
|
49784
|
-
}
|
|
49785
|
-
}
|
|
49786
|
-
process.stdout.write(lines.join("\n") + "\n");
|
|
50047
|
+
process.stdout.write(formatKnowledgeInvocationNeighbors(result) + "\n");
|
|
49787
50048
|
})
|
|
49788
50049
|
);
|
|
49789
50050
|
}
|
|
49790
50051
|
|
|
49791
50052
|
// src/cli/commands/knowledge/generate.ts
|
|
49792
|
-
var
|
|
50053
|
+
var import_node_fs6 = require("node:fs");
|
|
49793
50054
|
var import_node_path5 = require("node:path");
|
|
49794
50055
|
|
|
49795
50056
|
// src/knowledge-codegen.ts
|
|
49796
|
-
var
|
|
50057
|
+
var import_node_fs5 = require("node:fs");
|
|
49797
50058
|
var import_node_path4 = require("node:path");
|
|
49798
50059
|
function targetFromNodeId2(nodeId2) {
|
|
49799
50060
|
const [kind, ...idParts] = nodeId2.split(":");
|
|
@@ -49812,7 +50073,7 @@ function canonicalizeKnowledgeNodeLinks(node) {
|
|
|
49812
50073
|
};
|
|
49813
50074
|
}
|
|
49814
50075
|
function listMdxFiles(directory) {
|
|
49815
|
-
return (0,
|
|
50076
|
+
return (0, import_node_fs5.readdirSync)(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
49816
50077
|
const path3 = (0, import_node_path4.join)(directory, entry.name);
|
|
49817
50078
|
if (entry.isDirectory()) return listMdxFiles(path3);
|
|
49818
50079
|
return entry.isFile() && (0, import_node_path4.extname)(entry.name) === ".mdx" ? [path3] : [];
|
|
@@ -50010,7 +50271,7 @@ function readCommandForNode(node, cliCommand = "elevasis") {
|
|
|
50010
50271
|
];
|
|
50011
50272
|
}
|
|
50012
50273
|
function readKnowledgeNodeMdx(filePath) {
|
|
50013
|
-
const raw = (0,
|
|
50274
|
+
const raw = (0, import_node_fs5.readFileSync)(filePath, "utf8");
|
|
50014
50275
|
const { frontmatter, body } = parseFrontmatter(raw, filePath);
|
|
50015
50276
|
return {
|
|
50016
50277
|
id: assertString(frontmatter, "id", filePath),
|
|
@@ -50125,8 +50386,8 @@ function generateKnowledgeNodes(options) {
|
|
|
50125
50386
|
if (ids.has(node.id)) throw new Error(`[knowledge-node-codegen] Duplicate knowledge node id: ${node.id}`);
|
|
50126
50387
|
ids.add(node.id);
|
|
50127
50388
|
}
|
|
50128
|
-
(0,
|
|
50129
|
-
(0,
|
|
50389
|
+
(0, import_node_fs5.mkdirSync)((0, import_node_path4.dirname)(options.outputPath), { recursive: true });
|
|
50390
|
+
(0, import_node_fs5.writeFileSync)(
|
|
50130
50391
|
options.outputPath,
|
|
50131
50392
|
generateKnowledgeNodesTs({
|
|
50132
50393
|
nodes,
|
|
@@ -50137,8 +50398,8 @@ function generateKnowledgeNodes(options) {
|
|
|
50137
50398
|
"utf8"
|
|
50138
50399
|
);
|
|
50139
50400
|
if (options.knowledgeFlagsOutputPath) {
|
|
50140
|
-
(0,
|
|
50141
|
-
(0,
|
|
50401
|
+
(0, import_node_fs5.mkdirSync)((0, import_node_path4.dirname)(options.knowledgeFlagsOutputPath), { recursive: true });
|
|
50402
|
+
(0, import_node_fs5.writeFileSync)(
|
|
50142
50403
|
options.knowledgeFlagsOutputPath,
|
|
50143
50404
|
`${JSON.stringify(
|
|
50144
50405
|
generateKnowledgeFlagRegistry(nodes, sourcePaths, {
|
|
@@ -50176,7 +50437,7 @@ function registerKnowledgeGenerate(program3) {
|
|
|
50176
50437
|
projectRoot,
|
|
50177
50438
|
options.flagsOutput ?? ".claude/registries/knowledge-flags.json"
|
|
50178
50439
|
);
|
|
50179
|
-
if (!(0,
|
|
50440
|
+
if (!(0, import_node_fs6.existsSync)(sourceDir)) {
|
|
50180
50441
|
process.stderr.write(`knowledge:generate: source directory not found: ${sourceDir}
|
|
50181
50442
|
`);
|
|
50182
50443
|
process.exitCode = 1;
|
|
@@ -50199,39 +50460,13 @@ function registerKnowledgeGenerate(program3) {
|
|
|
50199
50460
|
|
|
50200
50461
|
// src/cli/commands/knowledge/search.ts
|
|
50201
50462
|
init_config();
|
|
50202
|
-
var ALL_KINDS = ["system", "resource", "knowledge", "ontology", "role", "policy"];
|
|
50203
|
-
function parseLimit(raw) {
|
|
50204
|
-
if (raw === void 0) return 10;
|
|
50205
|
-
const n = Number.parseInt(raw, 10);
|
|
50206
|
-
if (Number.isNaN(n) || n < 0) {
|
|
50207
|
-
throw new Error(`knowledge:search: --limit must be a non-negative integer (got "${raw}")`);
|
|
50208
|
-
}
|
|
50209
|
-
return n;
|
|
50210
|
-
}
|
|
50211
|
-
function parseKinds(raw) {
|
|
50212
|
-
if (raw === void 0) return void 0;
|
|
50213
|
-
const requested = raw.split(",").map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0);
|
|
50214
|
-
const valid = [];
|
|
50215
|
-
const invalid = [];
|
|
50216
|
-
for (const kind of requested) {
|
|
50217
|
-
if (ALL_KINDS.includes(kind)) {
|
|
50218
|
-
valid.push(kind);
|
|
50219
|
-
} else {
|
|
50220
|
-
invalid.push(kind);
|
|
50221
|
-
}
|
|
50222
|
-
}
|
|
50223
|
-
if (invalid.length > 0) {
|
|
50224
|
-
throw new Error(`knowledge:search: unknown kind(s) "${invalid.join(", ")}". Valid: ${ALL_KINDS.join(", ")}`);
|
|
50225
|
-
}
|
|
50226
|
-
return valid.length > 0 ? valid : void 0;
|
|
50227
|
-
}
|
|
50228
50463
|
function registerKnowledgeSearch(program3) {
|
|
50229
50464
|
program3.command("knowledge:search <query>").alias("om:search").description(
|
|
50230
50465
|
'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'
|
|
50231
50466
|
).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(
|
|
50232
50467
|
wrapAction("knowledge:search", async (query, options) => {
|
|
50233
|
-
const limit =
|
|
50234
|
-
const kinds =
|
|
50468
|
+
const limit = parseKnowledgeSearchLimit(options.limit);
|
|
50469
|
+
const kinds = parseKnowledgeSearchKinds(options.kinds);
|
|
50235
50470
|
const projectRoot = getProjectRoot();
|
|
50236
50471
|
const model = await loadOrgModel(projectRoot);
|
|
50237
50472
|
const hits = omSearch(model, query, { limit, kinds });
|
|
@@ -50254,7 +50489,7 @@ function registerKnowledgeSearch(program3) {
|
|
|
50254
50489
|
init_config();
|
|
50255
50490
|
function registerKnowledgeDescribe(program3) {
|
|
50256
50491
|
program3.command("knowledge:describe <nodeId>").alias("om:describe").description(
|
|
50257
|
-
"Show a structured neighborhood view for any OM node id\n (system, resource, knowledge, ontology, role, policy \u2014 auto-detected
|
|
50492
|
+
"Show a structured neighborhood view for any OM node id\n (system, resource, knowledge, ontology, role, policy, domain-item \u2014 auto-detected)\n Domain items: item:<domain>:<id> OR bare client:<uuid>, role:<id>, etc.\n Example: elevasis-sdk om:describe sales.lead-gen\n Example: elevasis-sdk om:describe knowledge.outreach-playbook\n Example: elevasis-sdk om:describe item:clients:<uuid>\n Example: elevasis-sdk om:describe client:<uuid> (back-compat bare form)\n Note: for portfolio/DB data (deals, lineage) use client:get <id> instead."
|
|
50258
50493
|
).option("--json", "Print as JSON").action(
|
|
50259
50494
|
wrapAction("knowledge:describe", async (nodeId2, options) => {
|
|
50260
50495
|
const projectRoot = getProjectRoot();
|
|
@@ -50262,7 +50497,11 @@ function registerKnowledgeDescribe(program3) {
|
|
|
50262
50497
|
const result = omDescribe(model, nodeId2);
|
|
50263
50498
|
if (!result) {
|
|
50264
50499
|
process.stderr.write(
|
|
50265
|
-
`knowledge:describe: no OM node found for id "${nodeId2}".
|
|
50500
|
+
`knowledge:describe: no OM node found for id "${nodeId2}".
|
|
50501
|
+
- For domain items use: om:describe item:<domain>:<id> (domains: clients, roles, policies, customers, offerings, goals)
|
|
50502
|
+
- Bare forms also work: om:describe client:<uuid>, om:describe role:<id>, etc.
|
|
50503
|
+
- To find nodes by keyword: om:search <keyword>
|
|
50504
|
+
- To list all items in a domain: om:ls /by-domain/<domain>
|
|
50266
50505
|
`
|
|
50267
50506
|
);
|
|
50268
50507
|
process.exit(1);
|
|
@@ -50288,7 +50527,7 @@ function registerKnowledgeCommands(program3) {
|
|
|
50288
50527
|
}
|
|
50289
50528
|
|
|
50290
50529
|
// src/cli/commands/request/request.ts
|
|
50291
|
-
var
|
|
50530
|
+
var import_node_fs7 = require("node:fs");
|
|
50292
50531
|
var import_node_path6 = require("node:path");
|
|
50293
50532
|
init_source();
|
|
50294
50533
|
init_config();
|
|
@@ -50353,7 +50592,7 @@ function registerRequestCommands(program3) {
|
|
|
50353
50592
|
throw new Error("Provide --input <json> or --input-file <path>");
|
|
50354
50593
|
}
|
|
50355
50594
|
const resolvedInputFile = options.inputFile ? resolveProjectRelative(options.inputFile) : void 0;
|
|
50356
|
-
const raw = resolvedInputFile ? JSON.parse((0,
|
|
50595
|
+
const raw = resolvedInputFile ? JSON.parse((0, import_node_fs7.readFileSync)(resolvedInputFile, "utf8")) : JSON.parse(options.input);
|
|
50357
50596
|
const parsed = CreateRequestInputSchema.safeParse(raw);
|
|
50358
50597
|
if (!parsed.success) {
|
|
50359
50598
|
const issues = parsed.error.issues.map((i) => ` - ${i.path.join(".") || "(root)"}: ${i.message}`).join("\n");
|
|
@@ -50377,7 +50616,7 @@ ${issues}`);
|
|
|
50377
50616
|
const tmpDir = (0, import_node_path6.join)(getProjectRoot(), "tmp");
|
|
50378
50617
|
if (resolvedInputFile.startsWith(tmpDir + "/") || resolvedInputFile.startsWith(tmpDir + "\\")) {
|
|
50379
50618
|
try {
|
|
50380
|
-
(0,
|
|
50619
|
+
(0, import_node_fs7.unlinkSync)(resolvedInputFile);
|
|
50381
50620
|
} catch {
|
|
50382
50621
|
}
|
|
50383
50622
|
} else {
|
|
@@ -50446,7 +50685,7 @@ ${rows.length} request${rows.length === 1 ? "" : "s"}`));
|
|
|
50446
50685
|
|
|
50447
50686
|
// src/cli/commands/ui/ui-switcher.ts
|
|
50448
50687
|
var import_node_child_process = require("node:child_process");
|
|
50449
|
-
var
|
|
50688
|
+
var import_node_fs8 = __toESM(require("node:fs"), 1);
|
|
50450
50689
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
50451
50690
|
init_config();
|
|
50452
50691
|
function run(command, args, cwd) {
|
|
@@ -50457,10 +50696,10 @@ function run(command, args, cwd) {
|
|
|
50457
50696
|
});
|
|
50458
50697
|
}
|
|
50459
50698
|
function readJson(filePath) {
|
|
50460
|
-
return JSON.parse(
|
|
50699
|
+
return JSON.parse(import_node_fs8.default.readFileSync(filePath, "utf8"));
|
|
50461
50700
|
}
|
|
50462
50701
|
function writeJson(filePath, value) {
|
|
50463
|
-
|
|
50702
|
+
import_node_fs8.default.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}
|
|
50464
50703
|
`);
|
|
50465
50704
|
}
|
|
50466
50705
|
function requireDependencies(packageJson, filePath) {
|
|
@@ -50471,7 +50710,7 @@ function requireDependencies(packageJson, filePath) {
|
|
|
50471
50710
|
}
|
|
50472
50711
|
function resolveExistingDir(label, dir) {
|
|
50473
50712
|
const resolved = import_node_path7.default.resolve(dir);
|
|
50474
|
-
if (!
|
|
50713
|
+
if (!import_node_fs8.default.existsSync(resolved) || !import_node_fs8.default.statSync(resolved).isDirectory()) {
|
|
50475
50714
|
throw new Error(`${label} not found: ${resolved}`);
|
|
50476
50715
|
}
|
|
50477
50716
|
return resolved;
|
|
@@ -50479,7 +50718,7 @@ function resolveExistingDir(label, dir) {
|
|
|
50479
50718
|
function findRepoRootFromProject(projectRoot) {
|
|
50480
50719
|
let dir = projectRoot;
|
|
50481
50720
|
while (true) {
|
|
50482
|
-
if (
|
|
50721
|
+
if (import_node_fs8.default.existsSync(import_node_path7.default.join(dir, "packages", "ui", "package.json"))) return dir;
|
|
50483
50722
|
const parent = import_node_path7.default.dirname(dir);
|
|
50484
50723
|
if (parent === dir) return null;
|
|
50485
50724
|
dir = parent;
|
|
@@ -50496,10 +50735,10 @@ function resolveUiPackageRoot(projectRoot, explicitRoot) {
|
|
|
50496
50735
|
return import_node_path7.default.join(repoRoot, "packages", "ui");
|
|
50497
50736
|
}
|
|
50498
50737
|
function removeLocalUiTarballs(templateTmpDir) {
|
|
50499
|
-
if (!
|
|
50500
|
-
for (const entry of
|
|
50738
|
+
if (!import_node_fs8.default.existsSync(templateTmpDir)) return;
|
|
50739
|
+
for (const entry of import_node_fs8.default.readdirSync(templateTmpDir)) {
|
|
50501
50740
|
if (entry.startsWith("elevasis-ui-") && entry.endsWith(".tgz")) {
|
|
50502
|
-
|
|
50741
|
+
import_node_fs8.default.rmSync(import_node_path7.default.join(templateTmpDir, entry), { force: true });
|
|
50503
50742
|
}
|
|
50504
50743
|
}
|
|
50505
50744
|
}
|
|
@@ -50524,24 +50763,24 @@ function useLocalUi(options = {}) {
|
|
|
50524
50763
|
const templateTmpDir = import_node_path7.default.join(projectRoot, "tmp");
|
|
50525
50764
|
const uiPackageJsonPath = import_node_path7.default.join(uiPackageRoot, "package.json");
|
|
50526
50765
|
const uiPackageBackupPath = import_node_path7.default.join(uiPackageRoot, "package.json.local-pack.bak");
|
|
50527
|
-
if (!
|
|
50766
|
+
if (!import_node_fs8.default.existsSync(templateUiPackageJsonPath)) {
|
|
50528
50767
|
throw new Error(`Template UI package.json not found: ${templateUiPackageJsonPath}`);
|
|
50529
50768
|
}
|
|
50530
|
-
|
|
50769
|
+
import_node_fs8.default.mkdirSync(templateTmpDir, { recursive: true });
|
|
50531
50770
|
removeLocalUiTarballs(templateTmpDir);
|
|
50532
50771
|
run("pnpm", ["--filter", "@repo/ui", "build:publish"], commandRoot);
|
|
50533
50772
|
try {
|
|
50534
|
-
const raw =
|
|
50535
|
-
|
|
50773
|
+
const raw = import_node_fs8.default.readFileSync(uiPackageJsonPath, "utf8");
|
|
50774
|
+
import_node_fs8.default.writeFileSync(uiPackageBackupPath, raw);
|
|
50536
50775
|
writeJson(uiPackageJsonPath, prepareUiPackageForPack(JSON.parse(raw)));
|
|
50537
50776
|
run("pnpm", ["-C", uiPackageRoot, "pack", "--pack-destination", templateTmpDir], commandRoot);
|
|
50538
50777
|
} finally {
|
|
50539
|
-
if (
|
|
50540
|
-
|
|
50541
|
-
|
|
50778
|
+
if (import_node_fs8.default.existsSync(uiPackageBackupPath)) {
|
|
50779
|
+
import_node_fs8.default.copyFileSync(uiPackageBackupPath, uiPackageJsonPath);
|
|
50780
|
+
import_node_fs8.default.rmSync(uiPackageBackupPath, { force: true });
|
|
50542
50781
|
}
|
|
50543
50782
|
}
|
|
50544
|
-
const tarballName =
|
|
50783
|
+
const tarballName = import_node_fs8.default.readdirSync(templateTmpDir).find((entry) => entry.startsWith("elevasis-ui-") && entry.endsWith(".tgz"));
|
|
50545
50784
|
if (!tarballName) {
|
|
50546
50785
|
throw new Error(`Failed to create local @elevasis/ui tarball in ${templateTmpDir}`);
|
|
50547
50786
|
}
|
|
@@ -50562,7 +50801,7 @@ function usePublishedUi(options = {}) {
|
|
|
50562
50801
|
if (!uiVersion) {
|
|
50563
50802
|
throw new Error("Could not determine @elevasis/ui version. Pass --version <version>.");
|
|
50564
50803
|
}
|
|
50565
|
-
if (!
|
|
50804
|
+
if (!import_node_fs8.default.existsSync(templateUiPackageJsonPath)) {
|
|
50566
50805
|
throw new Error(`Template UI package.json not found: ${templateUiPackageJsonPath}`);
|
|
50567
50806
|
}
|
|
50568
50807
|
const templateUiPackageJson = readJson(templateUiPackageJsonPath);
|
|
@@ -50588,7 +50827,7 @@ function registerUiCommands(program3) {
|
|
|
50588
50827
|
}
|
|
50589
50828
|
|
|
50590
50829
|
// src/cli/commands/doctor.ts
|
|
50591
|
-
var
|
|
50830
|
+
var import_node_fs9 = require("node:fs");
|
|
50592
50831
|
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
50593
50832
|
init_source();
|
|
50594
50833
|
init_config();
|
|
@@ -50628,7 +50867,7 @@ function registerDoctorCommand(program3) {
|
|
|
50628
50867
|
process.exit(1);
|
|
50629
50868
|
}
|
|
50630
50869
|
const envPath2 = import_node_path8.default.join(projectRoot, ".env");
|
|
50631
|
-
const envExists = (0,
|
|
50870
|
+
const envExists = (0, import_node_fs9.existsSync)(envPath2);
|
|
50632
50871
|
if (!envExists) {
|
|
50633
50872
|
fail(".env", `Not found at ${envPath2}. Create it from .env.example and fill in ELEVASIS_PLATFORM_KEY.`);
|
|
50634
50873
|
if (isVerbose) verbose(`Checked: ${envPath2}`);
|
|
@@ -51851,6 +52090,52 @@ function registerSkillScaffoldCommand(program3) {
|
|
|
51851
52090
|
);
|
|
51852
52091
|
}
|
|
51853
52092
|
|
|
52093
|
+
// src/cli/json-file-argv.ts
|
|
52094
|
+
var import_node_fs14 = require("node:fs");
|
|
52095
|
+
var import_node_path16 = require("node:path");
|
|
52096
|
+
init_config();
|
|
52097
|
+
var JSON_FILE_PREFIX = "@json:";
|
|
52098
|
+
var JsonFileArgError = class extends Error {
|
|
52099
|
+
constructor(message, code) {
|
|
52100
|
+
super(message);
|
|
52101
|
+
this.code = code;
|
|
52102
|
+
this.name = "JsonFileArgError";
|
|
52103
|
+
}
|
|
52104
|
+
};
|
|
52105
|
+
function resolveJsonFilePath(path3, options) {
|
|
52106
|
+
if (path3.trim() === "") {
|
|
52107
|
+
throw new JsonFileArgError("@json: requires a file path", "EMPTY_JSON_FILE_REF");
|
|
52108
|
+
}
|
|
52109
|
+
if ((0, import_node_path16.isAbsolute)(path3)) return path3;
|
|
52110
|
+
const cwd = options.cwd ?? process.cwd();
|
|
52111
|
+
const projectRoot = (options.findProjectRoot ?? tryFindProjectRoot)(cwd);
|
|
52112
|
+
return (0, import_node_path16.resolve)(projectRoot ?? cwd, path3);
|
|
52113
|
+
}
|
|
52114
|
+
function readJsonFileReference(ref, options) {
|
|
52115
|
+
const relativeOrAbsolutePath = ref.slice(JSON_FILE_PREFIX.length);
|
|
52116
|
+
const resolvedPath = resolveJsonFilePath(relativeOrAbsolutePath, options);
|
|
52117
|
+
const raw = (options.readFile ?? ((path3) => (0, import_node_fs14.readFileSync)(path3, "utf8")))(resolvedPath);
|
|
52118
|
+
try {
|
|
52119
|
+
JSON.parse(raw);
|
|
52120
|
+
} catch {
|
|
52121
|
+
throw new JsonFileArgError(`@json file must contain valid JSON: ${relativeOrAbsolutePath}`, "INVALID_JSON_FILE");
|
|
52122
|
+
}
|
|
52123
|
+
return raw;
|
|
52124
|
+
}
|
|
52125
|
+
function expandArg(arg, options) {
|
|
52126
|
+
if (arg.startsWith(JSON_FILE_PREFIX)) {
|
|
52127
|
+
return readJsonFileReference(arg, options);
|
|
52128
|
+
}
|
|
52129
|
+
const equalsRefIndex = arg.indexOf(`=${JSON_FILE_PREFIX}`);
|
|
52130
|
+
if (equalsRefIndex === -1) return arg;
|
|
52131
|
+
const prefix = arg.slice(0, equalsRefIndex + 1);
|
|
52132
|
+
const ref = arg.slice(equalsRefIndex + 1);
|
|
52133
|
+
return `${prefix}${readJsonFileReference(ref, options)}`;
|
|
52134
|
+
}
|
|
52135
|
+
function expandJsonFileArgs(args, options = {}) {
|
|
52136
|
+
return args.map((arg) => expandArg(arg, options));
|
|
52137
|
+
}
|
|
52138
|
+
|
|
51854
52139
|
// src/cli/index.ts
|
|
51855
52140
|
init_config();
|
|
51856
52141
|
var PREFLIGHT_SKIP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h", "--version", "-V"]);
|
|
@@ -51986,7 +52271,15 @@ registerCliCatalogCommand(program2);
|
|
|
51986
52271
|
registerOmScaffoldCommands(program2);
|
|
51987
52272
|
registerSkillScaffoldCommand(program2);
|
|
51988
52273
|
registerSkillCheckCoverageCommand(program2);
|
|
51989
|
-
|
|
52274
|
+
try {
|
|
52275
|
+
program2.parse(expandJsonFileArgs(process.argv), { from: "node" });
|
|
52276
|
+
} catch (error46) {
|
|
52277
|
+
if (error46 instanceof JsonFileArgError) {
|
|
52278
|
+
process.stderr.write(JSON.stringify({ error: error46.message, code: error46.code }) + "\n");
|
|
52279
|
+
process.exit(1);
|
|
52280
|
+
}
|
|
52281
|
+
throw error46;
|
|
52282
|
+
}
|
|
51990
52283
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51991
52284
|
0 && (module.exports = {
|
|
51992
52285
|
getProjectRoot
|