@elevasis/sdk 1.28.1 → 1.30.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 +1611 -595
- package/dist/index.d.ts +105 -1
- package/dist/index.js +30 -25
- package/dist/node/index.d.ts +84 -1
- package/dist/test-utils/index.d.ts +102 -1
- package/dist/test-utils/index.js +242 -23
- package/dist/worker/index.js +1 -0
- package/package.json +4 -4
- package/reference/_navigation.md +4 -4
- package/reference/_reference-manifest.json +8 -8
- package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +3 -3
- package/reference/claude-config/rules/topbar-actions.md +70 -0
- package/reference/claude-config/skills/om/SKILL.md +18 -1
- package/reference/claude-config/skills/tutorial/technical.md +5 -5
- package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
- package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +45 -45
- package/reference/claude-config/sync-notes/2026-05-15-om-skill-rename-and-write-family.md +52 -52
- package/reference/claude-config/sync-notes/2026-05-17-sdk-boundary-consolidation.md +33 -33
- package/reference/claude-config/sync-notes/2026-05-20-om-define-helpers.md +32 -32
- package/reference/claude-config/sync-notes/2026-05-22-access-model-and-right-panel.md +43 -43
- package/reference/claude-config/sync-notes/2026-05-22-lead-gen-tenant-config.md +40 -40
- package/reference/claude-config/sync-notes/2026-05-22-org-model-multi-file-split.md +61 -61
- package/reference/claude-config/sync-notes/2026-05-23-branding-names-to-identity.md +49 -49
- package/reference/claude-config/sync-notes/2026-05-23-lead-gen-manage-access.md +31 -31
- package/reference/claude-config/sync-notes/2026-05-23-om-deployment-drift-detection.md +42 -42
- package/reference/claude-config/sync-notes/2026-05-23-om-full-model-deploy-contract.md +33 -33
- package/reference/claude-config/sync-notes/2026-05-23-ui-sdk-package-fixes.md +37 -37
- package/reference/claude-config/sync-notes/2026-05-24-platform-invite-router-core-baseline.md +28 -0
- package/reference/claude-config/sync-notes/2026-05-24-system-interface-readiness.md +43 -43
- package/reference/claude-config/sync-notes/2026-05-25-invitation-login-loader.md +26 -0
- package/reference/claude-config/sync-notes/2026-05-25-om-topbar-requests.md +33 -0
- package/reference/claude-config/sync-notes/2026-05-25-system-interface-profile-registry-and-substrate.md +35 -0
- package/reference/claude-config/sync-notes/2026-05-25-tenant-om-scaffold-cli.md +49 -0
- package/reference/claude-config/sync-notes/2026-05-25-vibe-operate-intent.md +47 -0
- package/reference/core/exports.mdx +16 -0
- package/reference/core/index.mdx +58 -0
- package/reference/examples/organization-model.ts +18 -0
- package/reference/index.mdx +36 -67
- package/reference/rules/organization-model.md +4 -1
- package/reference/rules/organization-os.md +7 -1
- package/reference/rules/ui.md +207 -207
- package/reference/rules/vibe.md +52 -18
- package/reference/scaffold/index.mdx +9 -7
- package/reference/scaffold/operations/propagation-pipeline.md +152 -152
- package/reference/scaffold/operations/scaffold-maintenance.md +14 -4
- package/reference/scaffold/reference/contracts.md +423 -338
- package/reference/scaffold/reference/glossary.md +14 -2
- package/reference/scaffold/reference/system-interface-capabilities.md +50 -0
- package/reference/{cli-management.mdx → sdk/cli-management.mdx} +159 -13
- package/reference/{cli.mdx → sdk/cli.mdx} +68 -12
- package/reference/sdk/exports.mdx +14 -0
- package/reference/sdk/index.mdx +93 -0
- package/reference/sdk/platform-tools/adapters-integration.mdx +25 -0
- package/reference/sdk/platform-tools/adapters-platform.mdx +24 -0
- package/reference/{platform-tools → sdk/platform-tools}/index.mdx +9 -30
- package/reference/{resources → sdk/resources}/patterns.mdx +29 -11
- package/reference/ui/exports.mdx +60 -0
- package/reference/ui/index.mdx +75 -0
- package/reference/platform-tools/adapters-integration.mdx +0 -300
- package/reference/platform-tools/adapters-platform.mdx +0 -552
- /package/reference/claude-config/skills/deploy/{skill.md → SKILL.md} +0 -0
- /package/reference/{concepts.mdx → sdk/concepts.mdx} +0 -0
- /package/reference/{deployment → sdk/deployment}/command-center.mdx +0 -0
- /package/reference/{deployment → sdk/deployment}/execution-reference.mdx +0 -0
- /package/reference/{deployment → sdk/deployment}/index.mdx +0 -0
- /package/reference/{framework → sdk/framework}/agent.mdx +0 -0
- /package/reference/{framework → sdk/framework}/index.mdx +0 -0
- /package/reference/{framework → sdk/framework}/interaction-guidance.mdx +0 -0
- /package/reference/{framework → sdk/framework}/memory.mdx +0 -0
- /package/reference/{framework → sdk/framework}/project-structure.mdx +0 -0
- /package/reference/{framework → sdk/framework}/resource-documentation.mdx +0 -0
- /package/reference/{framework → sdk/framework}/tutorial-system.mdx +0 -0
- /package/reference/{getting-started.mdx → sdk/getting-started.mdx} +0 -0
- /package/reference/{platform-tools → sdk/platform-tools}/type-safety.mdx +0 -0
- /package/reference/{resources → sdk/resources}/index.mdx +0 -0
- /package/reference/{resources → sdk/resources}/types.mdx +0 -0
- /package/reference/{roadmap.mdx → sdk/roadmap.mdx} +0 -0
- /package/reference/{runtime.mdx → sdk/runtime.mdx} +0 -0
- /package/reference/{templates → sdk/templates}/data-enrichment.mdx +0 -0
- /package/reference/{templates → sdk/templates}/email-sender.mdx +0 -0
- /package/reference/{templates → sdk/templates}/index.mdx +0 -0
- /package/reference/{templates → sdk/templates}/lead-scorer.mdx +0 -0
- /package/reference/{templates → sdk/templates}/pdf-generator.mdx +0 -0
- /package/reference/{templates → sdk/templates}/recurring-job.mdx +0 -0
- /package/reference/{templates → sdk/templates}/text-classifier.mdx +0 -0
- /package/reference/{templates → sdk/templates}/web-scraper.mdx +0 -0
- /package/reference/{troubleshooting.mdx → sdk/troubleshooting.mdx} +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -6,6 +6,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
9
12
|
var __commonJS = (cb, mod) => function __require() {
|
|
10
13
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
14
|
};
|
|
@@ -104,7 +107,7 @@ var require_main = __commonJS({
|
|
|
104
107
|
"../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
105
108
|
var fs2 = require("fs");
|
|
106
109
|
var path3 = require("path");
|
|
107
|
-
var
|
|
110
|
+
var os3 = require("os");
|
|
108
111
|
var crypto = require("crypto");
|
|
109
112
|
var packageJson = require_package();
|
|
110
113
|
var version2 = packageJson.version;
|
|
@@ -227,7 +230,7 @@ var require_main = __commonJS({
|
|
|
227
230
|
return null;
|
|
228
231
|
}
|
|
229
232
|
function _resolveHome(envPath2) {
|
|
230
|
-
return envPath2[0] === "~" ? path3.join(
|
|
233
|
+
return envPath2[0] === "~" ? path3.join(os3.homedir(), envPath2.slice(1)) : envPath2;
|
|
231
234
|
}
|
|
232
235
|
function _configVault(options) {
|
|
233
236
|
const debug = Boolean(options && options.debug);
|
|
@@ -3127,6 +3130,522 @@ var require_commander = __commonJS({
|
|
|
3127
3130
|
}
|
|
3128
3131
|
});
|
|
3129
3132
|
|
|
3133
|
+
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
3134
|
+
function assembleStyles() {
|
|
3135
|
+
const codes = /* @__PURE__ */ new Map();
|
|
3136
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
3137
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
3138
|
+
styles[styleName] = {
|
|
3139
|
+
open: `\x1B[${style[0]}m`,
|
|
3140
|
+
close: `\x1B[${style[1]}m`
|
|
3141
|
+
};
|
|
3142
|
+
group[styleName] = styles[styleName];
|
|
3143
|
+
codes.set(style[0], style[1]);
|
|
3144
|
+
}
|
|
3145
|
+
Object.defineProperty(styles, groupName, {
|
|
3146
|
+
value: group,
|
|
3147
|
+
enumerable: false
|
|
3148
|
+
});
|
|
3149
|
+
}
|
|
3150
|
+
Object.defineProperty(styles, "codes", {
|
|
3151
|
+
value: codes,
|
|
3152
|
+
enumerable: false
|
|
3153
|
+
});
|
|
3154
|
+
styles.color.close = "\x1B[39m";
|
|
3155
|
+
styles.bgColor.close = "\x1B[49m";
|
|
3156
|
+
styles.color.ansi = wrapAnsi16();
|
|
3157
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
3158
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
3159
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
3160
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
3161
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
3162
|
+
Object.defineProperties(styles, {
|
|
3163
|
+
rgbToAnsi256: {
|
|
3164
|
+
value(red, green, blue) {
|
|
3165
|
+
if (red === green && green === blue) {
|
|
3166
|
+
if (red < 8) {
|
|
3167
|
+
return 16;
|
|
3168
|
+
}
|
|
3169
|
+
if (red > 248) {
|
|
3170
|
+
return 231;
|
|
3171
|
+
}
|
|
3172
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
3173
|
+
}
|
|
3174
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
3175
|
+
},
|
|
3176
|
+
enumerable: false
|
|
3177
|
+
},
|
|
3178
|
+
hexToRgb: {
|
|
3179
|
+
value(hex3) {
|
|
3180
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
|
|
3181
|
+
if (!matches) {
|
|
3182
|
+
return [0, 0, 0];
|
|
3183
|
+
}
|
|
3184
|
+
let [colorString] = matches;
|
|
3185
|
+
if (colorString.length === 3) {
|
|
3186
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
3187
|
+
}
|
|
3188
|
+
const integer2 = Number.parseInt(colorString, 16);
|
|
3189
|
+
return [
|
|
3190
|
+
/* eslint-disable no-bitwise */
|
|
3191
|
+
integer2 >> 16 & 255,
|
|
3192
|
+
integer2 >> 8 & 255,
|
|
3193
|
+
integer2 & 255
|
|
3194
|
+
/* eslint-enable no-bitwise */
|
|
3195
|
+
];
|
|
3196
|
+
},
|
|
3197
|
+
enumerable: false
|
|
3198
|
+
},
|
|
3199
|
+
hexToAnsi256: {
|
|
3200
|
+
value: (hex3) => styles.rgbToAnsi256(...styles.hexToRgb(hex3)),
|
|
3201
|
+
enumerable: false
|
|
3202
|
+
},
|
|
3203
|
+
ansi256ToAnsi: {
|
|
3204
|
+
value(code) {
|
|
3205
|
+
if (code < 8) {
|
|
3206
|
+
return 30 + code;
|
|
3207
|
+
}
|
|
3208
|
+
if (code < 16) {
|
|
3209
|
+
return 90 + (code - 8);
|
|
3210
|
+
}
|
|
3211
|
+
let red;
|
|
3212
|
+
let green;
|
|
3213
|
+
let blue;
|
|
3214
|
+
if (code >= 232) {
|
|
3215
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
3216
|
+
green = red;
|
|
3217
|
+
blue = red;
|
|
3218
|
+
} else {
|
|
3219
|
+
code -= 16;
|
|
3220
|
+
const remainder = code % 36;
|
|
3221
|
+
red = Math.floor(code / 36) / 5;
|
|
3222
|
+
green = Math.floor(remainder / 6) / 5;
|
|
3223
|
+
blue = remainder % 6 / 5;
|
|
3224
|
+
}
|
|
3225
|
+
const value = Math.max(red, green, blue) * 2;
|
|
3226
|
+
if (value === 0) {
|
|
3227
|
+
return 30;
|
|
3228
|
+
}
|
|
3229
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
3230
|
+
if (value === 2) {
|
|
3231
|
+
result += 60;
|
|
3232
|
+
}
|
|
3233
|
+
return result;
|
|
3234
|
+
},
|
|
3235
|
+
enumerable: false
|
|
3236
|
+
},
|
|
3237
|
+
rgbToAnsi: {
|
|
3238
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
3239
|
+
enumerable: false
|
|
3240
|
+
},
|
|
3241
|
+
hexToAnsi: {
|
|
3242
|
+
value: (hex3) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex3)),
|
|
3243
|
+
enumerable: false
|
|
3244
|
+
}
|
|
3245
|
+
});
|
|
3246
|
+
return styles;
|
|
3247
|
+
}
|
|
3248
|
+
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
|
3249
|
+
var init_ansi_styles = __esm({
|
|
3250
|
+
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
|
3251
|
+
ANSI_BACKGROUND_OFFSET = 10;
|
|
3252
|
+
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
3253
|
+
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
3254
|
+
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
3255
|
+
styles = {
|
|
3256
|
+
modifier: {
|
|
3257
|
+
reset: [0, 0],
|
|
3258
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
3259
|
+
bold: [1, 22],
|
|
3260
|
+
dim: [2, 22],
|
|
3261
|
+
italic: [3, 23],
|
|
3262
|
+
underline: [4, 24],
|
|
3263
|
+
overline: [53, 55],
|
|
3264
|
+
inverse: [7, 27],
|
|
3265
|
+
hidden: [8, 28],
|
|
3266
|
+
strikethrough: [9, 29]
|
|
3267
|
+
},
|
|
3268
|
+
color: {
|
|
3269
|
+
black: [30, 39],
|
|
3270
|
+
red: [31, 39],
|
|
3271
|
+
green: [32, 39],
|
|
3272
|
+
yellow: [33, 39],
|
|
3273
|
+
blue: [34, 39],
|
|
3274
|
+
magenta: [35, 39],
|
|
3275
|
+
cyan: [36, 39],
|
|
3276
|
+
white: [37, 39],
|
|
3277
|
+
// Bright color
|
|
3278
|
+
blackBright: [90, 39],
|
|
3279
|
+
gray: [90, 39],
|
|
3280
|
+
// Alias of `blackBright`
|
|
3281
|
+
grey: [90, 39],
|
|
3282
|
+
// Alias of `blackBright`
|
|
3283
|
+
redBright: [91, 39],
|
|
3284
|
+
greenBright: [92, 39],
|
|
3285
|
+
yellowBright: [93, 39],
|
|
3286
|
+
blueBright: [94, 39],
|
|
3287
|
+
magentaBright: [95, 39],
|
|
3288
|
+
cyanBright: [96, 39],
|
|
3289
|
+
whiteBright: [97, 39]
|
|
3290
|
+
},
|
|
3291
|
+
bgColor: {
|
|
3292
|
+
bgBlack: [40, 49],
|
|
3293
|
+
bgRed: [41, 49],
|
|
3294
|
+
bgGreen: [42, 49],
|
|
3295
|
+
bgYellow: [43, 49],
|
|
3296
|
+
bgBlue: [44, 49],
|
|
3297
|
+
bgMagenta: [45, 49],
|
|
3298
|
+
bgCyan: [46, 49],
|
|
3299
|
+
bgWhite: [47, 49],
|
|
3300
|
+
// Bright color
|
|
3301
|
+
bgBlackBright: [100, 49],
|
|
3302
|
+
bgGray: [100, 49],
|
|
3303
|
+
// Alias of `bgBlackBright`
|
|
3304
|
+
bgGrey: [100, 49],
|
|
3305
|
+
// Alias of `bgBlackBright`
|
|
3306
|
+
bgRedBright: [101, 49],
|
|
3307
|
+
bgGreenBright: [102, 49],
|
|
3308
|
+
bgYellowBright: [103, 49],
|
|
3309
|
+
bgBlueBright: [104, 49],
|
|
3310
|
+
bgMagentaBright: [105, 49],
|
|
3311
|
+
bgCyanBright: [106, 49],
|
|
3312
|
+
bgWhiteBright: [107, 49]
|
|
3313
|
+
}
|
|
3314
|
+
};
|
|
3315
|
+
modifierNames = Object.keys(styles.modifier);
|
|
3316
|
+
foregroundColorNames = Object.keys(styles.color);
|
|
3317
|
+
backgroundColorNames = Object.keys(styles.bgColor);
|
|
3318
|
+
colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
3319
|
+
ansiStyles = assembleStyles();
|
|
3320
|
+
ansi_styles_default = ansiStyles;
|
|
3321
|
+
}
|
|
3322
|
+
});
|
|
3323
|
+
|
|
3324
|
+
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
3325
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
|
|
3326
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
3327
|
+
const position = argv.indexOf(prefix + flag);
|
|
3328
|
+
const terminatorPosition = argv.indexOf("--");
|
|
3329
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
3330
|
+
}
|
|
3331
|
+
function envForceColor() {
|
|
3332
|
+
if ("FORCE_COLOR" in env) {
|
|
3333
|
+
if (env.FORCE_COLOR === "true") {
|
|
3334
|
+
return 1;
|
|
3335
|
+
}
|
|
3336
|
+
if (env.FORCE_COLOR === "false") {
|
|
3337
|
+
return 0;
|
|
3338
|
+
}
|
|
3339
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
function translateLevel(level) {
|
|
3343
|
+
if (level === 0) {
|
|
3344
|
+
return false;
|
|
3345
|
+
}
|
|
3346
|
+
return {
|
|
3347
|
+
level,
|
|
3348
|
+
hasBasic: true,
|
|
3349
|
+
has256: level >= 2,
|
|
3350
|
+
has16m: level >= 3
|
|
3351
|
+
};
|
|
3352
|
+
}
|
|
3353
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
3354
|
+
const noFlagForceColor = envForceColor();
|
|
3355
|
+
if (noFlagForceColor !== void 0) {
|
|
3356
|
+
flagForceColor = noFlagForceColor;
|
|
3357
|
+
}
|
|
3358
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
3359
|
+
if (forceColor === 0) {
|
|
3360
|
+
return 0;
|
|
3361
|
+
}
|
|
3362
|
+
if (sniffFlags) {
|
|
3363
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
3364
|
+
return 3;
|
|
3365
|
+
}
|
|
3366
|
+
if (hasFlag("color=256")) {
|
|
3367
|
+
return 2;
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
3371
|
+
return 1;
|
|
3372
|
+
}
|
|
3373
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
3374
|
+
return 0;
|
|
3375
|
+
}
|
|
3376
|
+
const min = forceColor || 0;
|
|
3377
|
+
if (env.TERM === "dumb") {
|
|
3378
|
+
return min;
|
|
3379
|
+
}
|
|
3380
|
+
if (import_node_process.default.platform === "win32") {
|
|
3381
|
+
const osRelease = import_node_os.default.release().split(".");
|
|
3382
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
3383
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
3384
|
+
}
|
|
3385
|
+
return 1;
|
|
3386
|
+
}
|
|
3387
|
+
if ("CI" in env) {
|
|
3388
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
3389
|
+
return 3;
|
|
3390
|
+
}
|
|
3391
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
3392
|
+
return 1;
|
|
3393
|
+
}
|
|
3394
|
+
return min;
|
|
3395
|
+
}
|
|
3396
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
3397
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
3398
|
+
}
|
|
3399
|
+
if (env.COLORTERM === "truecolor") {
|
|
3400
|
+
return 3;
|
|
3401
|
+
}
|
|
3402
|
+
if (env.TERM === "xterm-kitty") {
|
|
3403
|
+
return 3;
|
|
3404
|
+
}
|
|
3405
|
+
if (env.TERM === "xterm-ghostty") {
|
|
3406
|
+
return 3;
|
|
3407
|
+
}
|
|
3408
|
+
if (env.TERM === "wezterm") {
|
|
3409
|
+
return 3;
|
|
3410
|
+
}
|
|
3411
|
+
if ("TERM_PROGRAM" in env) {
|
|
3412
|
+
const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
3413
|
+
switch (env.TERM_PROGRAM) {
|
|
3414
|
+
case "iTerm.app": {
|
|
3415
|
+
return version2 >= 3 ? 3 : 2;
|
|
3416
|
+
}
|
|
3417
|
+
case "Apple_Terminal": {
|
|
3418
|
+
return 2;
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
3423
|
+
return 2;
|
|
3424
|
+
}
|
|
3425
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
3426
|
+
return 1;
|
|
3427
|
+
}
|
|
3428
|
+
if ("COLORTERM" in env) {
|
|
3429
|
+
return 1;
|
|
3430
|
+
}
|
|
3431
|
+
return min;
|
|
3432
|
+
}
|
|
3433
|
+
function createSupportsColor(stream, options = {}) {
|
|
3434
|
+
const level = _supportsColor(stream, {
|
|
3435
|
+
streamIsTTY: stream && stream.isTTY,
|
|
3436
|
+
...options
|
|
3437
|
+
});
|
|
3438
|
+
return translateLevel(level);
|
|
3439
|
+
}
|
|
3440
|
+
var import_node_process, import_node_os, import_node_tty, env, flagForceColor, supportsColor, supports_color_default;
|
|
3441
|
+
var init_supports_color = __esm({
|
|
3442
|
+
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
|
3443
|
+
import_node_process = __toESM(require("node:process"), 1);
|
|
3444
|
+
import_node_os = __toESM(require("node:os"), 1);
|
|
3445
|
+
import_node_tty = __toESM(require("node:tty"), 1);
|
|
3446
|
+
({ env } = import_node_process.default);
|
|
3447
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
3448
|
+
flagForceColor = 0;
|
|
3449
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
3450
|
+
flagForceColor = 1;
|
|
3451
|
+
}
|
|
3452
|
+
supportsColor = {
|
|
3453
|
+
stdout: createSupportsColor({ isTTY: import_node_tty.default.isatty(1) }),
|
|
3454
|
+
stderr: createSupportsColor({ isTTY: import_node_tty.default.isatty(2) })
|
|
3455
|
+
};
|
|
3456
|
+
supports_color_default = supportsColor;
|
|
3457
|
+
}
|
|
3458
|
+
});
|
|
3459
|
+
|
|
3460
|
+
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
3461
|
+
function stringReplaceAll(string4, substring, replacer) {
|
|
3462
|
+
let index = string4.indexOf(substring);
|
|
3463
|
+
if (index === -1) {
|
|
3464
|
+
return string4;
|
|
3465
|
+
}
|
|
3466
|
+
const substringLength = substring.length;
|
|
3467
|
+
let endIndex = 0;
|
|
3468
|
+
let returnValue = "";
|
|
3469
|
+
do {
|
|
3470
|
+
returnValue += string4.slice(endIndex, index) + substring + replacer;
|
|
3471
|
+
endIndex = index + substringLength;
|
|
3472
|
+
index = string4.indexOf(substring, endIndex);
|
|
3473
|
+
} while (index !== -1);
|
|
3474
|
+
returnValue += string4.slice(endIndex);
|
|
3475
|
+
return returnValue;
|
|
3476
|
+
}
|
|
3477
|
+
function stringEncaseCRLFWithFirstIndex(string4, prefix, postfix, index) {
|
|
3478
|
+
let endIndex = 0;
|
|
3479
|
+
let returnValue = "";
|
|
3480
|
+
do {
|
|
3481
|
+
const gotCR = string4[index - 1] === "\r";
|
|
3482
|
+
returnValue += string4.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
3483
|
+
endIndex = index + 1;
|
|
3484
|
+
index = string4.indexOf("\n", endIndex);
|
|
3485
|
+
} while (index !== -1);
|
|
3486
|
+
returnValue += string4.slice(endIndex);
|
|
3487
|
+
return returnValue;
|
|
3488
|
+
}
|
|
3489
|
+
var init_utilities = __esm({
|
|
3490
|
+
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js"() {
|
|
3491
|
+
}
|
|
3492
|
+
});
|
|
3493
|
+
|
|
3494
|
+
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
3495
|
+
function createChalk(options) {
|
|
3496
|
+
return chalkFactory(options);
|
|
3497
|
+
}
|
|
3498
|
+
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
|
3499
|
+
var init_source = __esm({
|
|
3500
|
+
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js"() {
|
|
3501
|
+
init_ansi_styles();
|
|
3502
|
+
init_supports_color();
|
|
3503
|
+
init_utilities();
|
|
3504
|
+
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
|
3505
|
+
GENERATOR = Symbol("GENERATOR");
|
|
3506
|
+
STYLER = Symbol("STYLER");
|
|
3507
|
+
IS_EMPTY = Symbol("IS_EMPTY");
|
|
3508
|
+
levelMapping = [
|
|
3509
|
+
"ansi",
|
|
3510
|
+
"ansi",
|
|
3511
|
+
"ansi256",
|
|
3512
|
+
"ansi16m"
|
|
3513
|
+
];
|
|
3514
|
+
styles2 = /* @__PURE__ */ Object.create(null);
|
|
3515
|
+
applyOptions = (object2, options = {}) => {
|
|
3516
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
3517
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
3518
|
+
}
|
|
3519
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
3520
|
+
object2.level = options.level === void 0 ? colorLevel : options.level;
|
|
3521
|
+
};
|
|
3522
|
+
chalkFactory = (options) => {
|
|
3523
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
3524
|
+
applyOptions(chalk2, options);
|
|
3525
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
3526
|
+
return chalk2;
|
|
3527
|
+
};
|
|
3528
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
3529
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
3530
|
+
styles2[styleName] = {
|
|
3531
|
+
get() {
|
|
3532
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
3533
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
3534
|
+
return builder;
|
|
3535
|
+
}
|
|
3536
|
+
};
|
|
3537
|
+
}
|
|
3538
|
+
styles2.visible = {
|
|
3539
|
+
get() {
|
|
3540
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
3541
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
3542
|
+
return builder;
|
|
3543
|
+
}
|
|
3544
|
+
};
|
|
3545
|
+
getModelAnsi = (model, level, type, ...arguments_) => {
|
|
3546
|
+
if (model === "rgb") {
|
|
3547
|
+
if (level === "ansi16m") {
|
|
3548
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
3549
|
+
}
|
|
3550
|
+
if (level === "ansi256") {
|
|
3551
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
3552
|
+
}
|
|
3553
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
3554
|
+
}
|
|
3555
|
+
if (model === "hex") {
|
|
3556
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
3557
|
+
}
|
|
3558
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
3559
|
+
};
|
|
3560
|
+
usedModels = ["rgb", "hex", "ansi256"];
|
|
3561
|
+
for (const model of usedModels) {
|
|
3562
|
+
styles2[model] = {
|
|
3563
|
+
get() {
|
|
3564
|
+
const { level } = this;
|
|
3565
|
+
return function(...arguments_) {
|
|
3566
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
3567
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
3568
|
+
};
|
|
3569
|
+
}
|
|
3570
|
+
};
|
|
3571
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
3572
|
+
styles2[bgModel] = {
|
|
3573
|
+
get() {
|
|
3574
|
+
const { level } = this;
|
|
3575
|
+
return function(...arguments_) {
|
|
3576
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
3577
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
3578
|
+
};
|
|
3579
|
+
}
|
|
3580
|
+
};
|
|
3581
|
+
}
|
|
3582
|
+
proto = Object.defineProperties(() => {
|
|
3583
|
+
}, {
|
|
3584
|
+
...styles2,
|
|
3585
|
+
level: {
|
|
3586
|
+
enumerable: true,
|
|
3587
|
+
get() {
|
|
3588
|
+
return this[GENERATOR].level;
|
|
3589
|
+
},
|
|
3590
|
+
set(level) {
|
|
3591
|
+
this[GENERATOR].level = level;
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
});
|
|
3595
|
+
createStyler = (open, close, parent) => {
|
|
3596
|
+
let openAll;
|
|
3597
|
+
let closeAll;
|
|
3598
|
+
if (parent === void 0) {
|
|
3599
|
+
openAll = open;
|
|
3600
|
+
closeAll = close;
|
|
3601
|
+
} else {
|
|
3602
|
+
openAll = parent.openAll + open;
|
|
3603
|
+
closeAll = close + parent.closeAll;
|
|
3604
|
+
}
|
|
3605
|
+
return {
|
|
3606
|
+
open,
|
|
3607
|
+
close,
|
|
3608
|
+
openAll,
|
|
3609
|
+
closeAll,
|
|
3610
|
+
parent
|
|
3611
|
+
};
|
|
3612
|
+
};
|
|
3613
|
+
createBuilder = (self2, _styler, _isEmpty) => {
|
|
3614
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
3615
|
+
Object.setPrototypeOf(builder, proto);
|
|
3616
|
+
builder[GENERATOR] = self2;
|
|
3617
|
+
builder[STYLER] = _styler;
|
|
3618
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
3619
|
+
return builder;
|
|
3620
|
+
};
|
|
3621
|
+
applyStyle = (self2, string4) => {
|
|
3622
|
+
if (self2.level <= 0 || !string4) {
|
|
3623
|
+
return self2[IS_EMPTY] ? "" : string4;
|
|
3624
|
+
}
|
|
3625
|
+
let styler = self2[STYLER];
|
|
3626
|
+
if (styler === void 0) {
|
|
3627
|
+
return string4;
|
|
3628
|
+
}
|
|
3629
|
+
const { openAll, closeAll } = styler;
|
|
3630
|
+
if (string4.includes("\x1B")) {
|
|
3631
|
+
while (styler !== void 0) {
|
|
3632
|
+
string4 = stringReplaceAll(string4, styler.close, styler.open);
|
|
3633
|
+
styler = styler.parent;
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
const lfIndex = string4.indexOf("\n");
|
|
3637
|
+
if (lfIndex !== -1) {
|
|
3638
|
+
string4 = stringEncaseCRLFWithFirstIndex(string4, closeAll, openAll, lfIndex);
|
|
3639
|
+
}
|
|
3640
|
+
return openAll + string4 + closeAll;
|
|
3641
|
+
};
|
|
3642
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
3643
|
+
chalk = createChalk();
|
|
3644
|
+
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
3645
|
+
source_default = chalk;
|
|
3646
|
+
}
|
|
3647
|
+
});
|
|
3648
|
+
|
|
3130
3649
|
// ../../node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js
|
|
3131
3650
|
var require_mimic_fn = __commonJS({
|
|
3132
3651
|
"../../node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js"(exports2, module2) {
|
|
@@ -5246,7 +5765,7 @@ var require_buffer_list = __commonJS({
|
|
|
5246
5765
|
}
|
|
5247
5766
|
}, {
|
|
5248
5767
|
key: "join",
|
|
5249
|
-
value: function
|
|
5768
|
+
value: function join13(s) {
|
|
5250
5769
|
if (this.length === 0) return "";
|
|
5251
5770
|
var p = this.head;
|
|
5252
5771
|
var ret = "" + p.data;
|
|
@@ -23005,530 +23524,945 @@ var require_zod = __commonJS({
|
|
|
23005
23524
|
}
|
|
23006
23525
|
});
|
|
23007
23526
|
|
|
23008
|
-
// src/cli/
|
|
23009
|
-
|
|
23010
|
-
|
|
23011
|
-
|
|
23527
|
+
// src/cli/config.ts
|
|
23528
|
+
function resolveApiUrl(cliOverride, prod) {
|
|
23529
|
+
if (cliOverride) return cliOverride;
|
|
23530
|
+
if (prod) return PROD_API_URL;
|
|
23531
|
+
if (process.env.ELEVASIS_API_URL) return process.env.ELEVASIS_API_URL;
|
|
23532
|
+
if (process.env.NODE_ENV === "development") return DEV_API_URL;
|
|
23533
|
+
return PROD_API_URL;
|
|
23534
|
+
}
|
|
23535
|
+
function resolveEnvironment(prod) {
|
|
23536
|
+
if (prod) return "production";
|
|
23537
|
+
return process.env.NODE_ENV === "development" ? "development" : "production";
|
|
23538
|
+
}
|
|
23539
|
+
function resolveApiKey(prod) {
|
|
23540
|
+
if (!prod && process.env.NODE_ENV === "development") {
|
|
23541
|
+
return process.env.ELEVASIS_PLATFORM_KEY_DEV ?? process.env.ELEVASIS_PLATFORM_KEY ?? "";
|
|
23542
|
+
}
|
|
23543
|
+
return process.env.ELEVASIS_PLATFORM_KEY ?? "";
|
|
23544
|
+
}
|
|
23545
|
+
function tryFindProjectRoot(startDir) {
|
|
23546
|
+
const raw = (0, import_path.resolve)(startDir);
|
|
23547
|
+
let dir;
|
|
23548
|
+
try {
|
|
23549
|
+
dir = (0, import_fs.realpathSync)(raw);
|
|
23550
|
+
} catch {
|
|
23551
|
+
dir = raw;
|
|
23552
|
+
}
|
|
23553
|
+
while (true) {
|
|
23554
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(dir, ".elevasis"))) return dir;
|
|
23555
|
+
const parent = (0, import_path.dirname)(dir);
|
|
23556
|
+
if (parent === dir) break;
|
|
23557
|
+
dir = parent;
|
|
23558
|
+
}
|
|
23559
|
+
return null;
|
|
23560
|
+
}
|
|
23561
|
+
function findProjectRoot(startDir) {
|
|
23562
|
+
const root = tryFindProjectRoot(startDir);
|
|
23563
|
+
if (root !== null) return root;
|
|
23564
|
+
process.stderr.write(
|
|
23565
|
+
"Not inside an Elevasis project. Run this command from a project directory (an Elevasis project has a .elevasis file at its root).\n"
|
|
23566
|
+
);
|
|
23567
|
+
process.exit(1);
|
|
23568
|
+
}
|
|
23569
|
+
function isHelpOrVersionOnly() {
|
|
23570
|
+
const args = process.argv.slice(2);
|
|
23571
|
+
return args.length > 0 && args.every((a) => ["--help", "-h", "--version", "-V"].includes(a));
|
|
23572
|
+
}
|
|
23573
|
+
function getProjectRoot() {
|
|
23574
|
+
if (_projectRoot !== void 0) return _projectRoot;
|
|
23575
|
+
_projectRoot = isHelpOrVersionOnly() ? process.cwd() : findProjectRoot(process.cwd());
|
|
23576
|
+
return _projectRoot;
|
|
23577
|
+
}
|
|
23578
|
+
function resolveProjectRelative(relOrAbsPath) {
|
|
23579
|
+
if ((0, import_path.isAbsolute)(relOrAbsPath)) return relOrAbsPath;
|
|
23580
|
+
return (0, import_path.resolve)(getProjectRoot(), relOrAbsPath);
|
|
23581
|
+
}
|
|
23582
|
+
function findEnvFile(_startDir) {
|
|
23583
|
+
const projectRoot = tryFindProjectRoot(process.cwd());
|
|
23584
|
+
if (projectRoot === null) return void 0;
|
|
23585
|
+
const candidate = (0, import_path.join)(projectRoot, ".env");
|
|
23586
|
+
return (0, import_fs.existsSync)(candidate) ? candidate : void 0;
|
|
23587
|
+
}
|
|
23588
|
+
function findPackageRoot(startDir) {
|
|
23589
|
+
const raw = (0, import_path.resolve)(startDir);
|
|
23590
|
+
let dir;
|
|
23591
|
+
try {
|
|
23592
|
+
dir = (0, import_fs.realpathSync)(raw);
|
|
23593
|
+
} catch {
|
|
23594
|
+
dir = raw;
|
|
23595
|
+
}
|
|
23596
|
+
const projectRoot = tryFindProjectRoot(dir);
|
|
23597
|
+
while (true) {
|
|
23598
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(dir, "package.json"))) return dir;
|
|
23599
|
+
const parent = (0, import_path.dirname)(dir);
|
|
23600
|
+
if (parent === dir) break;
|
|
23601
|
+
if (projectRoot !== null && dir === projectRoot) break;
|
|
23602
|
+
dir = parent;
|
|
23603
|
+
}
|
|
23604
|
+
process.stderr.write(
|
|
23605
|
+
"No package.json found between the current directory and the project root.\nRemediation: run this command from inside a package directory (one that contains package.json).\n"
|
|
23606
|
+
);
|
|
23607
|
+
process.exit(1);
|
|
23608
|
+
}
|
|
23609
|
+
function getPackageRoot() {
|
|
23610
|
+
if (_packageRoot !== void 0) return _packageRoot;
|
|
23611
|
+
_packageRoot = isHelpOrVersionOnly() ? process.cwd() : findPackageRoot(process.cwd());
|
|
23612
|
+
return _packageRoot;
|
|
23613
|
+
}
|
|
23614
|
+
function resolvePackageRelative(relOrAbsPath) {
|
|
23615
|
+
if ((0, import_path.isAbsolute)(relOrAbsPath)) return relOrAbsPath;
|
|
23616
|
+
return (0, import_path.resolve)(getPackageRoot(), relOrAbsPath);
|
|
23617
|
+
}
|
|
23618
|
+
var import_fs, import_path, DEV_API_URL, PROD_API_URL, _projectRoot, _packageRoot;
|
|
23619
|
+
var init_config = __esm({
|
|
23620
|
+
"src/cli/config.ts"() {
|
|
23621
|
+
"use strict";
|
|
23622
|
+
import_fs = require("fs");
|
|
23623
|
+
import_path = require("path");
|
|
23624
|
+
DEV_API_URL = "http://localhost:5170";
|
|
23625
|
+
PROD_API_URL = "https://api.elevasis.io";
|
|
23626
|
+
}
|
|
23012
23627
|
});
|
|
23013
|
-
module.exports = __toCommonJS(index_exports);
|
|
23014
|
-
var import_dotenv = __toESM(require_main(), 1);
|
|
23015
|
-
var import_fs4 = require("fs");
|
|
23016
|
-
var import_path4 = require("path");
|
|
23017
23628
|
|
|
23018
|
-
//
|
|
23019
|
-
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
|
|
23023
|
-
|
|
23024
|
-
|
|
23025
|
-
|
|
23026
|
-
|
|
23027
|
-
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
|
|
23031
|
-
|
|
23032
|
-
|
|
23033
|
-
|
|
23629
|
+
// src/cli/commands/om/project-layout.ts
|
|
23630
|
+
function assertSplitLayout(projectDir) {
|
|
23631
|
+
const omDir = (0, import_node_path7.join)(projectDir, "core", "config", "organization-model");
|
|
23632
|
+
const missing = REQUIRED_FILES.filter((f) => !(0, import_node_fs7.existsSync)((0, import_node_path7.join)(omDir, f)));
|
|
23633
|
+
if (missing.length > 0) {
|
|
23634
|
+
throw new Error(
|
|
23635
|
+
"Legacy single-file OM layout detected. Split into `core/config/organization-model/{profile.ts, systems.ts, navigation.ts}` before scaffolding."
|
|
23636
|
+
);
|
|
23637
|
+
}
|
|
23638
|
+
}
|
|
23639
|
+
var import_node_fs7, import_node_path7, REQUIRED_FILES;
|
|
23640
|
+
var init_project_layout = __esm({
|
|
23641
|
+
"src/cli/commands/om/project-layout.ts"() {
|
|
23642
|
+
"use strict";
|
|
23643
|
+
import_node_fs7 = require("node:fs");
|
|
23644
|
+
import_node_path7 = require("node:path");
|
|
23645
|
+
REQUIRED_FILES = ["profile.ts", "systems.ts", "navigation.ts"];
|
|
23646
|
+
}
|
|
23647
|
+
});
|
|
23034
23648
|
|
|
23035
|
-
//
|
|
23036
|
-
|
|
23037
|
-
|
|
23038
|
-
|
|
23039
|
-
|
|
23040
|
-
var styles = {
|
|
23041
|
-
modifier: {
|
|
23042
|
-
reset: [0, 0],
|
|
23043
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
23044
|
-
bold: [1, 22],
|
|
23045
|
-
dim: [2, 22],
|
|
23046
|
-
italic: [3, 23],
|
|
23047
|
-
underline: [4, 24],
|
|
23048
|
-
overline: [53, 55],
|
|
23049
|
-
inverse: [7, 27],
|
|
23050
|
-
hidden: [8, 28],
|
|
23051
|
-
strikethrough: [9, 29]
|
|
23052
|
-
},
|
|
23053
|
-
color: {
|
|
23054
|
-
black: [30, 39],
|
|
23055
|
-
red: [31, 39],
|
|
23056
|
-
green: [32, 39],
|
|
23057
|
-
yellow: [33, 39],
|
|
23058
|
-
blue: [34, 39],
|
|
23059
|
-
magenta: [35, 39],
|
|
23060
|
-
cyan: [36, 39],
|
|
23061
|
-
white: [37, 39],
|
|
23062
|
-
// Bright color
|
|
23063
|
-
blackBright: [90, 39],
|
|
23064
|
-
gray: [90, 39],
|
|
23065
|
-
// Alias of `blackBright`
|
|
23066
|
-
grey: [90, 39],
|
|
23067
|
-
// Alias of `blackBright`
|
|
23068
|
-
redBright: [91, 39],
|
|
23069
|
-
greenBright: [92, 39],
|
|
23070
|
-
yellowBright: [93, 39],
|
|
23071
|
-
blueBright: [94, 39],
|
|
23072
|
-
magentaBright: [95, 39],
|
|
23073
|
-
cyanBright: [96, 39],
|
|
23074
|
-
whiteBright: [97, 39]
|
|
23075
|
-
},
|
|
23076
|
-
bgColor: {
|
|
23077
|
-
bgBlack: [40, 49],
|
|
23078
|
-
bgRed: [41, 49],
|
|
23079
|
-
bgGreen: [42, 49],
|
|
23080
|
-
bgYellow: [43, 49],
|
|
23081
|
-
bgBlue: [44, 49],
|
|
23082
|
-
bgMagenta: [45, 49],
|
|
23083
|
-
bgCyan: [46, 49],
|
|
23084
|
-
bgWhite: [47, 49],
|
|
23085
|
-
// Bright color
|
|
23086
|
-
bgBlackBright: [100, 49],
|
|
23087
|
-
bgGray: [100, 49],
|
|
23088
|
-
// Alias of `bgBlackBright`
|
|
23089
|
-
bgGrey: [100, 49],
|
|
23090
|
-
// Alias of `bgBlackBright`
|
|
23091
|
-
bgRedBright: [101, 49],
|
|
23092
|
-
bgGreenBright: [102, 49],
|
|
23093
|
-
bgYellowBright: [103, 49],
|
|
23094
|
-
bgBlueBright: [104, 49],
|
|
23095
|
-
bgMagentaBright: [105, 49],
|
|
23096
|
-
bgCyanBright: [106, 49],
|
|
23097
|
-
bgWhiteBright: [107, 49]
|
|
23649
|
+
// src/cli/commands/om/prompt-helpers.ts
|
|
23650
|
+
async function promptIfAbsent(value, question, options) {
|
|
23651
|
+
if (value !== void 0) return value;
|
|
23652
|
+
if (!process.stdin.isTTY) {
|
|
23653
|
+
return options?.default ?? "";
|
|
23098
23654
|
}
|
|
23099
|
-
|
|
23100
|
-
|
|
23101
|
-
|
|
23102
|
-
|
|
23103
|
-
|
|
23104
|
-
|
|
23105
|
-
|
|
23106
|
-
|
|
23107
|
-
|
|
23108
|
-
styles[styleName] = {
|
|
23109
|
-
open: `\x1B[${style[0]}m`,
|
|
23110
|
-
close: `\x1B[${style[1]}m`
|
|
23111
|
-
};
|
|
23112
|
-
group[styleName] = styles[styleName];
|
|
23113
|
-
codes.set(style[0], style[1]);
|
|
23114
|
-
}
|
|
23115
|
-
Object.defineProperty(styles, groupName, {
|
|
23116
|
-
value: group,
|
|
23117
|
-
enumerable: false
|
|
23655
|
+
const rl = readline2.createInterface({
|
|
23656
|
+
input: process.stdin,
|
|
23657
|
+
output: process.stdout
|
|
23658
|
+
});
|
|
23659
|
+
return new Promise((resolve5) => {
|
|
23660
|
+
const prompt = options?.default ? `${question} [${options.default}]: ` : `${question}: `;
|
|
23661
|
+
rl.question(prompt, (answer) => {
|
|
23662
|
+
rl.close();
|
|
23663
|
+
resolve5(answer.trim() || (options?.default ?? ""));
|
|
23118
23664
|
});
|
|
23119
|
-
}
|
|
23120
|
-
Object.defineProperty(styles, "codes", {
|
|
23121
|
-
value: codes,
|
|
23122
|
-
enumerable: false
|
|
23123
23665
|
});
|
|
23124
|
-
|
|
23125
|
-
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
|
|
23129
|
-
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
|
|
23142
|
-
|
|
23143
|
-
|
|
23144
|
-
|
|
23666
|
+
}
|
|
23667
|
+
var readline2;
|
|
23668
|
+
var init_prompt_helpers = __esm({
|
|
23669
|
+
"src/cli/commands/om/prompt-helpers.ts"() {
|
|
23670
|
+
"use strict";
|
|
23671
|
+
readline2 = __toESM(require("node:readline"), 1);
|
|
23672
|
+
}
|
|
23673
|
+
});
|
|
23674
|
+
|
|
23675
|
+
// src/cli/commands/om/error-map.ts
|
|
23676
|
+
function mapValidationError(stderr) {
|
|
23677
|
+
for (const entry of ERROR_MAP) {
|
|
23678
|
+
if (entry.pattern.test(stderr)) {
|
|
23679
|
+
return entry.friendlyMessage;
|
|
23680
|
+
}
|
|
23681
|
+
}
|
|
23682
|
+
return "Validation failed \u2014 see below. Fix the issue and re-run, or use `om:scaffold:fill` for guided remediation:\n" + stderr;
|
|
23683
|
+
}
|
|
23684
|
+
var ERROR_MAP;
|
|
23685
|
+
var init_error_map = __esm({
|
|
23686
|
+
"src/cli/commands/om/error-map.ts"() {
|
|
23687
|
+
"use strict";
|
|
23688
|
+
ERROR_MAP = [
|
|
23689
|
+
{
|
|
23690
|
+
pattern: /systemPath.*not assignable/i,
|
|
23691
|
+
friendlyMessage: "The system path you entered doesn't match any authored system. Check `templateSystems` in `systems.ts` for valid IDs."
|
|
23145
23692
|
},
|
|
23146
|
-
|
|
23147
|
-
|
|
23148
|
-
|
|
23149
|
-
value(hex3) {
|
|
23150
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex3.toString(16));
|
|
23151
|
-
if (!matches) {
|
|
23152
|
-
return [0, 0, 0];
|
|
23153
|
-
}
|
|
23154
|
-
let [colorString] = matches;
|
|
23155
|
-
if (colorString.length === 3) {
|
|
23156
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
|
23157
|
-
}
|
|
23158
|
-
const integer2 = Number.parseInt(colorString, 16);
|
|
23159
|
-
return [
|
|
23160
|
-
/* eslint-disable no-bitwise */
|
|
23161
|
-
integer2 >> 16 & 255,
|
|
23162
|
-
integer2 >> 8 & 255,
|
|
23163
|
-
integer2 & 255
|
|
23164
|
-
/* eslint-enable no-bitwise */
|
|
23165
|
-
];
|
|
23693
|
+
{
|
|
23694
|
+
pattern: /apiInterface.*required/i,
|
|
23695
|
+
friendlyMessage: "This system is API-backed but is missing the `apiInterface` block. Run `om:scaffold:system --id {path} --api-backed`."
|
|
23166
23696
|
},
|
|
23167
|
-
|
|
23168
|
-
|
|
23169
|
-
|
|
23170
|
-
value: (hex3) => styles.rgbToAnsi256(...styles.hexToRgb(hex3)),
|
|
23171
|
-
enumerable: false
|
|
23172
|
-
},
|
|
23173
|
-
ansi256ToAnsi: {
|
|
23174
|
-
value(code) {
|
|
23175
|
-
if (code < 8) {
|
|
23176
|
-
return 30 + code;
|
|
23177
|
-
}
|
|
23178
|
-
if (code < 16) {
|
|
23179
|
-
return 90 + (code - 8);
|
|
23180
|
-
}
|
|
23181
|
-
let red;
|
|
23182
|
-
let green;
|
|
23183
|
-
let blue;
|
|
23184
|
-
if (code >= 232) {
|
|
23185
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
23186
|
-
green = red;
|
|
23187
|
-
blue = red;
|
|
23188
|
-
} else {
|
|
23189
|
-
code -= 16;
|
|
23190
|
-
const remainder = code % 36;
|
|
23191
|
-
red = Math.floor(code / 36) / 5;
|
|
23192
|
-
green = Math.floor(remainder / 6) / 5;
|
|
23193
|
-
blue = remainder % 6 / 5;
|
|
23194
|
-
}
|
|
23195
|
-
const value = Math.max(red, green, blue) * 2;
|
|
23196
|
-
if (value === 0) {
|
|
23197
|
-
return 30;
|
|
23198
|
-
}
|
|
23199
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
23200
|
-
if (value === 2) {
|
|
23201
|
-
result += 60;
|
|
23202
|
-
}
|
|
23203
|
-
return result;
|
|
23697
|
+
{
|
|
23698
|
+
pattern: /primaryAction.*not in.*actions/i,
|
|
23699
|
+
friendlyMessage: "The primary action you set is not in the resource's `actions` list. Add it to `resource.ontology.actions` first."
|
|
23204
23700
|
},
|
|
23205
|
-
|
|
23206
|
-
|
|
23207
|
-
|
|
23208
|
-
|
|
23209
|
-
|
|
23210
|
-
|
|
23211
|
-
|
|
23212
|
-
|
|
23213
|
-
|
|
23214
|
-
|
|
23215
|
-
|
|
23216
|
-
return styles;
|
|
23217
|
-
}
|
|
23218
|
-
var ansiStyles = assembleStyles();
|
|
23219
|
-
var ansi_styles_default = ansiStyles;
|
|
23701
|
+
{
|
|
23702
|
+
pattern: /ZodError.*required/i,
|
|
23703
|
+
friendlyMessage: "A required field is missing. Run `om:scaffold:fill --system {id}` to see what's needed."
|
|
23704
|
+
},
|
|
23705
|
+
{
|
|
23706
|
+
pattern: /Cannot find module.*organization-model/i,
|
|
23707
|
+
friendlyMessage: "OM config files can't be loaded. Run `pnpm -C operations check-types` directly to see the full TypeScript error."
|
|
23708
|
+
}
|
|
23709
|
+
];
|
|
23710
|
+
}
|
|
23711
|
+
});
|
|
23220
23712
|
|
|
23221
|
-
//
|
|
23222
|
-
|
|
23223
|
-
|
|
23224
|
-
|
|
23225
|
-
|
|
23226
|
-
|
|
23227
|
-
|
|
23228
|
-
|
|
23229
|
-
|
|
23230
|
-
}
|
|
23231
|
-
|
|
23232
|
-
|
|
23233
|
-
|
|
23234
|
-
|
|
23235
|
-
|
|
23236
|
-
|
|
23713
|
+
// src/cli/commands/om/emit-system.ts
|
|
23714
|
+
function emitSystemEntry(opts) {
|
|
23715
|
+
const apiInterfaceBlock = opts.apiBacked ? `
|
|
23716
|
+
apiInterface: {
|
|
23717
|
+
lifecycle: 'active',
|
|
23718
|
+
readinessProfile: 'standard',
|
|
23719
|
+
resourceIds: []
|
|
23720
|
+
},` : "";
|
|
23721
|
+
const code = ` {
|
|
23722
|
+
id: '${opts.id}',
|
|
23723
|
+
title: '${opts.title}',
|
|
23724
|
+
kind: '${opts.kind}',
|
|
23725
|
+
enabled: true,
|
|
23726
|
+
governedByKnowledge: [],
|
|
23727
|
+
drivesGoals: [],
|
|
23728
|
+
lifecycle: 'active',${apiInterfaceBlock}
|
|
23729
|
+
},
|
|
23730
|
+
`;
|
|
23731
|
+
const anchor = /^\] as const\s*$/m;
|
|
23732
|
+
return { code, anchor };
|
|
23237
23733
|
}
|
|
23238
|
-
|
|
23239
|
-
|
|
23240
|
-
|
|
23241
|
-
|
|
23734
|
+
var init_emit_system = __esm({
|
|
23735
|
+
"src/cli/commands/om/emit-system.ts"() {
|
|
23736
|
+
"use strict";
|
|
23737
|
+
}
|
|
23738
|
+
});
|
|
23739
|
+
|
|
23740
|
+
// src/cli/commands/om/splice.ts
|
|
23741
|
+
async function withSnapshotRollback(filePaths, op) {
|
|
23742
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
23743
|
+
for (const filePath of filePaths) {
|
|
23744
|
+
try {
|
|
23745
|
+
snapshots.set(filePath, (0, import_node_fs8.readFileSync)(filePath, "utf8"));
|
|
23746
|
+
} catch {
|
|
23747
|
+
snapshots.set(filePath, null);
|
|
23242
23748
|
}
|
|
23243
|
-
|
|
23244
|
-
|
|
23749
|
+
}
|
|
23750
|
+
try {
|
|
23751
|
+
return await op();
|
|
23752
|
+
} catch (err) {
|
|
23753
|
+
for (const [filePath, snapshot] of snapshots) {
|
|
23754
|
+
if (snapshot !== null) {
|
|
23755
|
+
try {
|
|
23756
|
+
(0, import_node_fs8.writeFileSync)(filePath, snapshot, "utf8");
|
|
23757
|
+
} catch {
|
|
23758
|
+
}
|
|
23759
|
+
}
|
|
23245
23760
|
}
|
|
23246
|
-
|
|
23761
|
+
throw err;
|
|
23247
23762
|
}
|
|
23248
23763
|
}
|
|
23249
|
-
function
|
|
23250
|
-
|
|
23251
|
-
|
|
23764
|
+
function insertBeforeAnchorInContent(content, code, anchor) {
|
|
23765
|
+
const lines = content.split("\n");
|
|
23766
|
+
const anchorIndex = lines.findIndex((line) => anchor.test(line));
|
|
23767
|
+
if (anchorIndex === -1) {
|
|
23768
|
+
throw new Error(
|
|
23769
|
+
`[om:scaffold] Anchor pattern ${anchor} not found in file. The file may have been manually edited. Rollback will restore the original.`
|
|
23770
|
+
);
|
|
23252
23771
|
}
|
|
23253
|
-
|
|
23254
|
-
|
|
23255
|
-
|
|
23256
|
-
has256: level >= 2,
|
|
23257
|
-
has16m: level >= 3
|
|
23258
|
-
};
|
|
23772
|
+
const codeLines = code.endsWith("\n") ? code.slice(0, -1).split("\n") : code.split("\n");
|
|
23773
|
+
lines.splice(anchorIndex, 0, ...codeLines);
|
|
23774
|
+
return lines.join("\n");
|
|
23259
23775
|
}
|
|
23260
|
-
function
|
|
23261
|
-
const
|
|
23262
|
-
|
|
23263
|
-
|
|
23776
|
+
async function appendBeforeAnchor(filePath, code, anchor) {
|
|
23777
|
+
const content = (0, import_node_fs8.readFileSync)(filePath, "utf8");
|
|
23778
|
+
const updated = insertBeforeAnchorInContent(content, code, anchor);
|
|
23779
|
+
(0, import_node_fs8.writeFileSync)(filePath, updated, "utf8");
|
|
23780
|
+
}
|
|
23781
|
+
async function applyConstImport(systemsFilePath, importLine, fieldLine, importAnchor, fieldAnchor, newConstFilePath, newConstFileCode) {
|
|
23782
|
+
(0, import_node_fs8.mkdirSync)((0, import_node_path8.dirname)(newConstFilePath), { recursive: true });
|
|
23783
|
+
(0, import_node_fs8.writeFileSync)(newConstFilePath, newConstFileCode, "utf8");
|
|
23784
|
+
const systemsContent = (0, import_node_fs8.readFileSync)(systemsFilePath, "utf8");
|
|
23785
|
+
const afterImport = insertBeforeAnchorInContent(systemsContent, importLine + "\n", importAnchor);
|
|
23786
|
+
const lines = afterImport.split("\n");
|
|
23787
|
+
const fieldAnchorIndex = lines.findIndex((line) => fieldAnchor.test(line));
|
|
23788
|
+
if (fieldAnchorIndex === -1) {
|
|
23789
|
+
throw new Error(
|
|
23790
|
+
`[om:scaffold] Field anchor pattern ${fieldAnchor} not found in ${systemsFilePath}. The system entry may not exist yet. Run om:scaffold:system first.`
|
|
23791
|
+
);
|
|
23264
23792
|
}
|
|
23265
|
-
|
|
23266
|
-
|
|
23267
|
-
|
|
23793
|
+
lines.splice(fieldAnchorIndex + 1, 0, fieldLine);
|
|
23794
|
+
(0, import_node_fs8.writeFileSync)(systemsFilePath, lines.join("\n"), "utf8");
|
|
23795
|
+
}
|
|
23796
|
+
var import_node_fs8, import_node_path8;
|
|
23797
|
+
var init_splice = __esm({
|
|
23798
|
+
"src/cli/commands/om/splice.ts"() {
|
|
23799
|
+
"use strict";
|
|
23800
|
+
import_node_fs8 = require("node:fs");
|
|
23801
|
+
import_node_path8 = require("node:path");
|
|
23268
23802
|
}
|
|
23269
|
-
|
|
23270
|
-
|
|
23271
|
-
|
|
23272
|
-
|
|
23273
|
-
|
|
23274
|
-
|
|
23803
|
+
});
|
|
23804
|
+
|
|
23805
|
+
// src/cli/commands/om/scaffold-system.ts
|
|
23806
|
+
var scaffold_system_exports = {};
|
|
23807
|
+
__export(scaffold_system_exports, {
|
|
23808
|
+
default: () => scaffoldSystem
|
|
23809
|
+
});
|
|
23810
|
+
function runValidation(projectDir) {
|
|
23811
|
+
for (const script of ["check-types", "check"]) {
|
|
23812
|
+
const result = (0, import_node_child_process2.spawnSync)("pnpm", ["-C", "operations", "run", script], {
|
|
23813
|
+
cwd: projectDir,
|
|
23814
|
+
encoding: "utf8",
|
|
23815
|
+
shell: true
|
|
23816
|
+
});
|
|
23817
|
+
if (result.status !== 0) {
|
|
23818
|
+
return (result.stderr ?? "") + (result.stdout ?? "");
|
|
23275
23819
|
}
|
|
23276
23820
|
}
|
|
23277
|
-
|
|
23278
|
-
|
|
23279
|
-
|
|
23280
|
-
|
|
23281
|
-
|
|
23282
|
-
|
|
23283
|
-
const
|
|
23284
|
-
if (
|
|
23285
|
-
|
|
23821
|
+
return null;
|
|
23822
|
+
}
|
|
23823
|
+
async function scaffoldSystem(opts) {
|
|
23824
|
+
const projectDir = getProjectRoot();
|
|
23825
|
+
assertSplitLayout(projectDir);
|
|
23826
|
+
const options = opts;
|
|
23827
|
+
const id = await promptIfAbsent(options.id, "System path (e.g. sales.crm)");
|
|
23828
|
+
if (!id) {
|
|
23829
|
+
process.stderr.write(source_default.red("System path is required. Pass --id <path> or enter it at the prompt.\n"));
|
|
23830
|
+
process.exit(1);
|
|
23286
23831
|
}
|
|
23287
|
-
|
|
23288
|
-
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
}
|
|
23292
|
-
return 1;
|
|
23832
|
+
const title = await promptIfAbsent(options.title, "Display title");
|
|
23833
|
+
if (!title) {
|
|
23834
|
+
process.stderr.write(source_default.red("Display title is required. Pass --title <text> or enter it at the prompt.\n"));
|
|
23835
|
+
process.exit(1);
|
|
23293
23836
|
}
|
|
23294
|
-
|
|
23295
|
-
|
|
23296
|
-
|
|
23837
|
+
const rawKind = await promptIfAbsent(
|
|
23838
|
+
options.kind,
|
|
23839
|
+
"Kind (operational / analytical / support)",
|
|
23840
|
+
{
|
|
23841
|
+
default: "operational"
|
|
23297
23842
|
}
|
|
23298
|
-
|
|
23299
|
-
|
|
23843
|
+
);
|
|
23844
|
+
const kind = rawKind || "operational";
|
|
23845
|
+
let apiBacked = Boolean(options.apiBacked);
|
|
23846
|
+
if (!apiBacked && process.stdin.isTTY) {
|
|
23847
|
+
const answer = await promptIfAbsent(void 0, "Is this system API-backed? (adds apiInterface) [y/N]", {
|
|
23848
|
+
default: "N"
|
|
23849
|
+
});
|
|
23850
|
+
apiBacked = answer.trim().toLowerCase() === "y";
|
|
23851
|
+
}
|
|
23852
|
+
const { code, anchor } = emitSystemEntry({ id, title, kind, apiBacked });
|
|
23853
|
+
if (options.dryRun) {
|
|
23854
|
+
console.log(source_default.cyan("Dry-run mode \u2014 no files written.\n"));
|
|
23855
|
+
console.log(source_default.gray("Proposed addition to core/config/organization-model/systems.ts:"));
|
|
23856
|
+
console.log(code);
|
|
23857
|
+
if (apiBacked) {
|
|
23858
|
+
console.log(
|
|
23859
|
+
source_default.yellow("Reminder: add resource IDs to the `apiInterface.resourceIds` array after scaffolding resources.")
|
|
23860
|
+
);
|
|
23300
23861
|
}
|
|
23301
|
-
return
|
|
23862
|
+
return;
|
|
23302
23863
|
}
|
|
23303
|
-
|
|
23304
|
-
|
|
23864
|
+
const systemsFilePath = (0, import_node_path9.join)(projectDir, "core", "config", "organization-model", "systems.ts");
|
|
23865
|
+
try {
|
|
23866
|
+
await withSnapshotRollback([systemsFilePath], async () => {
|
|
23867
|
+
await appendBeforeAnchor(systemsFilePath, code, anchor);
|
|
23868
|
+
const validationError = runValidation(projectDir);
|
|
23869
|
+
if (validationError !== null) {
|
|
23870
|
+
throw new Error(validationError);
|
|
23871
|
+
}
|
|
23872
|
+
});
|
|
23873
|
+
} catch (err) {
|
|
23874
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
23875
|
+
process.stderr.write(source_default.red(mapValidationError(raw)) + "\n");
|
|
23876
|
+
process.exit(1);
|
|
23305
23877
|
}
|
|
23306
|
-
|
|
23307
|
-
|
|
23878
|
+
console.log(source_default.green(`System \`${id}\` scaffolded in core/config/organization-model/systems.ts`));
|
|
23879
|
+
if (apiBacked) {
|
|
23880
|
+
console.log(
|
|
23881
|
+
source_default.yellow("Reminder: add resource IDs to the `apiInterface.resourceIds` array after scaffolding resources.")
|
|
23882
|
+
);
|
|
23308
23883
|
}
|
|
23309
|
-
|
|
23310
|
-
|
|
23884
|
+
}
|
|
23885
|
+
var import_node_path9, import_node_child_process2;
|
|
23886
|
+
var init_scaffold_system = __esm({
|
|
23887
|
+
"src/cli/commands/om/scaffold-system.ts"() {
|
|
23888
|
+
"use strict";
|
|
23889
|
+
import_node_path9 = require("node:path");
|
|
23890
|
+
import_node_child_process2 = require("node:child_process");
|
|
23891
|
+
init_source();
|
|
23892
|
+
init_config();
|
|
23893
|
+
init_project_layout();
|
|
23894
|
+
init_prompt_helpers();
|
|
23895
|
+
init_error_map();
|
|
23896
|
+
init_emit_system();
|
|
23897
|
+
init_splice();
|
|
23898
|
+
}
|
|
23899
|
+
});
|
|
23900
|
+
|
|
23901
|
+
// src/cli/commands/om/emit-resource.ts
|
|
23902
|
+
function emitResourceEntry(opts) {
|
|
23903
|
+
const ontologyBlock = opts.primaryAction !== void 0 ? ` ontology: {
|
|
23904
|
+
actions: ['${opts.primaryAction}'],
|
|
23905
|
+
primaryAction: '${opts.primaryAction}'
|
|
23906
|
+
},
|
|
23907
|
+
` : ` ontology: {},
|
|
23908
|
+
`;
|
|
23909
|
+
const code = ` '${opts.id}': {
|
|
23910
|
+
id: '${opts.id}',
|
|
23911
|
+
order: 10,
|
|
23912
|
+
kind: 'workflow',
|
|
23913
|
+
systemPath: '${opts.systemPath}',
|
|
23914
|
+
systemId: '${opts.systemPath}',
|
|
23915
|
+
title: '${opts.title}',
|
|
23916
|
+
description: '',
|
|
23917
|
+
status: 'active',
|
|
23918
|
+
${ontologyBlock} codeRefs: []
|
|
23919
|
+
},
|
|
23920
|
+
`;
|
|
23921
|
+
const anchor = /^export const templateResources\s*=/m;
|
|
23922
|
+
return { code, anchor };
|
|
23923
|
+
}
|
|
23924
|
+
var init_emit_resource = __esm({
|
|
23925
|
+
"src/cli/commands/om/emit-resource.ts"() {
|
|
23926
|
+
"use strict";
|
|
23311
23927
|
}
|
|
23312
|
-
|
|
23313
|
-
|
|
23928
|
+
});
|
|
23929
|
+
|
|
23930
|
+
// src/cli/commands/om/scaffold-resource.ts
|
|
23931
|
+
var scaffold_resource_exports = {};
|
|
23932
|
+
__export(scaffold_resource_exports, {
|
|
23933
|
+
default: () => scaffoldResource
|
|
23934
|
+
});
|
|
23935
|
+
function runValidation2(projectDir) {
|
|
23936
|
+
for (const script of ["check-types", "check"]) {
|
|
23937
|
+
const result = (0, import_node_child_process3.spawnSync)("pnpm", ["-C", "operations", "run", script], {
|
|
23938
|
+
cwd: projectDir,
|
|
23939
|
+
encoding: "utf8",
|
|
23940
|
+
shell: true
|
|
23941
|
+
});
|
|
23942
|
+
if (result.status !== 0) {
|
|
23943
|
+
return (result.stderr ?? "") + (result.stdout ?? "");
|
|
23944
|
+
}
|
|
23314
23945
|
}
|
|
23315
|
-
|
|
23316
|
-
|
|
23946
|
+
return null;
|
|
23947
|
+
}
|
|
23948
|
+
async function scaffoldResource(opts) {
|
|
23949
|
+
const projectDir = getProjectRoot();
|
|
23950
|
+
assertSplitLayout(projectDir);
|
|
23951
|
+
const options = opts;
|
|
23952
|
+
const id = await promptIfAbsent(options.id, "Resource id (e.g. lead-discovery-workflow)");
|
|
23953
|
+
if (!id) {
|
|
23954
|
+
process.stderr.write(source_default.red("Resource id is required. Pass --id <id> or enter it at the prompt.\n"));
|
|
23955
|
+
process.exit(1);
|
|
23317
23956
|
}
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
|
-
|
|
23325
|
-
return 2;
|
|
23326
|
-
}
|
|
23327
|
-
}
|
|
23957
|
+
const systemPath = await promptIfAbsent(
|
|
23958
|
+
options.systemPath,
|
|
23959
|
+
"System path to attach to (e.g. sales.crm)"
|
|
23960
|
+
);
|
|
23961
|
+
if (!systemPath) {
|
|
23962
|
+
process.stderr.write(source_default.red("System path is required. Pass --system-path <path> or enter it at the prompt.\n"));
|
|
23963
|
+
process.exit(1);
|
|
23328
23964
|
}
|
|
23329
|
-
|
|
23330
|
-
|
|
23965
|
+
const title = await promptIfAbsent(options.title, "Resource display title");
|
|
23966
|
+
if (!title) {
|
|
23967
|
+
process.stderr.write(source_default.red("Display title is required. Pass --title <text> or enter it at the prompt.\n"));
|
|
23968
|
+
process.exit(1);
|
|
23331
23969
|
}
|
|
23332
|
-
|
|
23333
|
-
|
|
23970
|
+
const rawPrimaryAction = await promptIfAbsent(
|
|
23971
|
+
options.primaryAction,
|
|
23972
|
+
"Primary action id (leave blank to omit)",
|
|
23973
|
+
{ default: "" }
|
|
23974
|
+
);
|
|
23975
|
+
const primaryAction = rawPrimaryAction || void 0;
|
|
23976
|
+
const { code, anchor } = emitResourceEntry({ id, systemPath, title, primaryAction });
|
|
23977
|
+
if (options.dryRun) {
|
|
23978
|
+
console.log(source_default.cyan("Dry-run mode \u2014 no files written.\n"));
|
|
23979
|
+
console.log(source_default.gray("Proposed addition to core/config/organization-model/systems.ts:"));
|
|
23980
|
+
console.log(code);
|
|
23981
|
+
return;
|
|
23334
23982
|
}
|
|
23335
|
-
|
|
23336
|
-
|
|
23983
|
+
const systemsFilePath = (0, import_node_path10.join)(projectDir, "core", "config", "organization-model", "systems.ts");
|
|
23984
|
+
try {
|
|
23985
|
+
await withSnapshotRollback([systemsFilePath], async () => {
|
|
23986
|
+
await appendBeforeAnchor(systemsFilePath, code, anchor);
|
|
23987
|
+
const validationError = runValidation2(projectDir);
|
|
23988
|
+
if (validationError !== null) {
|
|
23989
|
+
const systemPathHint = /systemPath.*not assignable/i.test(validationError) ? `
|
|
23990
|
+
Resource \`${id}\` references system \`${systemPath}\` which is not in \`templateSystems\`. Run \`om:scaffold:system --id ${systemPath}\` first.` : "";
|
|
23991
|
+
throw new Error(validationError + systemPathHint);
|
|
23992
|
+
}
|
|
23993
|
+
});
|
|
23994
|
+
} catch (err) {
|
|
23995
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
23996
|
+
process.stderr.write(source_default.red(mapValidationError(raw)) + "\n");
|
|
23997
|
+
process.exit(1);
|
|
23337
23998
|
}
|
|
23338
|
-
|
|
23999
|
+
console.log(source_default.green(`Resource \`${id}\` scaffolded in core/config/organization-model/systems.ts`));
|
|
23339
24000
|
}
|
|
23340
|
-
|
|
23341
|
-
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
24001
|
+
var import_node_path10, import_node_child_process3;
|
|
24002
|
+
var init_scaffold_resource = __esm({
|
|
24003
|
+
"src/cli/commands/om/scaffold-resource.ts"() {
|
|
24004
|
+
"use strict";
|
|
24005
|
+
import_node_path10 = require("node:path");
|
|
24006
|
+
import_node_child_process3 = require("node:child_process");
|
|
24007
|
+
init_source();
|
|
24008
|
+
init_config();
|
|
24009
|
+
init_project_layout();
|
|
24010
|
+
init_prompt_helpers();
|
|
24011
|
+
init_error_map();
|
|
24012
|
+
init_emit_resource();
|
|
24013
|
+
init_splice();
|
|
24014
|
+
}
|
|
24015
|
+
});
|
|
24016
|
+
|
|
24017
|
+
// src/cli/commands/om/emit-role.ts
|
|
24018
|
+
function emitRoleEntry(opts) {
|
|
24019
|
+
const code = ` {
|
|
24020
|
+
id: '${opts.id}',
|
|
24021
|
+
title: '${opts.title}',
|
|
24022
|
+
description: '${opts.description}'
|
|
24023
|
+
},
|
|
24024
|
+
`;
|
|
24025
|
+
const anchor = /^ {2}\]\s*$/m;
|
|
24026
|
+
return { code, anchor };
|
|
23346
24027
|
}
|
|
23347
|
-
var
|
|
23348
|
-
|
|
23349
|
-
|
|
23350
|
-
}
|
|
23351
|
-
|
|
24028
|
+
var init_emit_role = __esm({
|
|
24029
|
+
"src/cli/commands/om/emit-role.ts"() {
|
|
24030
|
+
"use strict";
|
|
24031
|
+
}
|
|
24032
|
+
});
|
|
23352
24033
|
|
|
23353
|
-
//
|
|
23354
|
-
|
|
23355
|
-
|
|
23356
|
-
|
|
23357
|
-
|
|
24034
|
+
// src/cli/commands/om/scaffold-role.ts
|
|
24035
|
+
var scaffold_role_exports = {};
|
|
24036
|
+
__export(scaffold_role_exports, {
|
|
24037
|
+
default: () => scaffoldRole
|
|
24038
|
+
});
|
|
24039
|
+
function runValidation3(projectDir) {
|
|
24040
|
+
for (const script of ["check-types", "check"]) {
|
|
24041
|
+
const result = (0, import_node_child_process4.spawnSync)("pnpm", ["-C", "operations", "run", script], {
|
|
24042
|
+
cwd: projectDir,
|
|
24043
|
+
encoding: "utf8",
|
|
24044
|
+
shell: true
|
|
24045
|
+
});
|
|
24046
|
+
if (result.status !== 0) {
|
|
24047
|
+
return (result.stderr ?? "") + (result.stdout ?? "");
|
|
24048
|
+
}
|
|
23358
24049
|
}
|
|
23359
|
-
|
|
23360
|
-
let endIndex = 0;
|
|
23361
|
-
let returnValue = "";
|
|
23362
|
-
do {
|
|
23363
|
-
returnValue += string4.slice(endIndex, index) + substring + replacer;
|
|
23364
|
-
endIndex = index + substringLength;
|
|
23365
|
-
index = string4.indexOf(substring, endIndex);
|
|
23366
|
-
} while (index !== -1);
|
|
23367
|
-
returnValue += string4.slice(endIndex);
|
|
23368
|
-
return returnValue;
|
|
24050
|
+
return null;
|
|
23369
24051
|
}
|
|
23370
|
-
function
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
|
|
23378
|
-
}
|
|
23379
|
-
|
|
23380
|
-
|
|
24052
|
+
async function scaffoldRole(opts) {
|
|
24053
|
+
const projectDir = getProjectRoot();
|
|
24054
|
+
assertSplitLayout(projectDir);
|
|
24055
|
+
const options = opts;
|
|
24056
|
+
const id = await promptIfAbsent(options.id, "Role id (e.g. ops-lead)");
|
|
24057
|
+
if (!id) {
|
|
24058
|
+
process.stderr.write(source_default.red("Role id is required. Pass --id <id> or enter it at the prompt.\n"));
|
|
24059
|
+
process.exit(1);
|
|
24060
|
+
}
|
|
24061
|
+
const title = await promptIfAbsent(options.title, "Display label");
|
|
24062
|
+
if (!title) {
|
|
24063
|
+
process.stderr.write(source_default.red("Display label is required. Pass --title <text> or enter it at the prompt.\n"));
|
|
24064
|
+
process.exit(1);
|
|
24065
|
+
}
|
|
24066
|
+
const description = await promptIfAbsent(options.description, "Short description", {
|
|
24067
|
+
default: ""
|
|
24068
|
+
});
|
|
24069
|
+
const { code, anchor } = emitRoleEntry({ id, title, description: description || "" });
|
|
24070
|
+
if (options.dryRun) {
|
|
24071
|
+
console.log(source_default.cyan("Dry-run mode \u2014 no files written.\n"));
|
|
24072
|
+
console.log(source_default.gray("Proposed addition to core/config/organization-model/profile.ts:"));
|
|
24073
|
+
console.log(code);
|
|
24074
|
+
return;
|
|
24075
|
+
}
|
|
24076
|
+
const profileFilePath = (0, import_node_path11.join)(projectDir, "core", "config", "organization-model", "profile.ts");
|
|
24077
|
+
try {
|
|
24078
|
+
await withSnapshotRollback([profileFilePath], async () => {
|
|
24079
|
+
await appendBeforeAnchor(profileFilePath, code, anchor);
|
|
24080
|
+
const validationError = runValidation3(projectDir);
|
|
24081
|
+
if (validationError !== null) {
|
|
24082
|
+
throw new Error(validationError);
|
|
24083
|
+
}
|
|
24084
|
+
});
|
|
24085
|
+
} catch (err) {
|
|
24086
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
24087
|
+
process.stderr.write(source_default.red(mapValidationError(raw)) + "\n");
|
|
24088
|
+
process.exit(1);
|
|
24089
|
+
}
|
|
24090
|
+
console.log(source_default.green(`Role \`${id}\` scaffolded in core/config/organization-model/profile.ts`));
|
|
24091
|
+
}
|
|
24092
|
+
var import_node_path11, import_node_child_process4;
|
|
24093
|
+
var init_scaffold_role = __esm({
|
|
24094
|
+
"src/cli/commands/om/scaffold-role.ts"() {
|
|
24095
|
+
"use strict";
|
|
24096
|
+
import_node_path11 = require("node:path");
|
|
24097
|
+
import_node_child_process4 = require("node:child_process");
|
|
24098
|
+
init_source();
|
|
24099
|
+
init_config();
|
|
24100
|
+
init_project_layout();
|
|
24101
|
+
init_prompt_helpers();
|
|
24102
|
+
init_error_map();
|
|
24103
|
+
init_emit_role();
|
|
24104
|
+
init_splice();
|
|
24105
|
+
}
|
|
24106
|
+
});
|
|
24107
|
+
|
|
24108
|
+
// src/cli/commands/om/emit-knowledge.ts
|
|
24109
|
+
function emitKnowledgeNode(opts) {
|
|
24110
|
+
const filePath = `core/config/knowledge/nodes/${opts.id}.mdx`;
|
|
24111
|
+
const systemLine = opts.systemPath !== void 0 ? `
|
|
24112
|
+
system: '${opts.systemPath}'` : "";
|
|
24113
|
+
const updatedAt = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
24114
|
+
const content = `---
|
|
24115
|
+
id: '${opts.id}'
|
|
24116
|
+
kind: ${opts.kind}
|
|
24117
|
+
title: ''
|
|
24118
|
+
description: ''${systemLine}
|
|
24119
|
+
updatedAt: ${updatedAt}
|
|
24120
|
+
---
|
|
24121
|
+
|
|
24122
|
+
<!-- Add the content for this knowledge node below. -->
|
|
24123
|
+
`;
|
|
24124
|
+
return { filePath, content };
|
|
23381
24125
|
}
|
|
24126
|
+
var init_emit_knowledge = __esm({
|
|
24127
|
+
"src/cli/commands/om/emit-knowledge.ts"() {
|
|
24128
|
+
"use strict";
|
|
24129
|
+
}
|
|
24130
|
+
});
|
|
23382
24131
|
|
|
23383
|
-
//
|
|
23384
|
-
var
|
|
23385
|
-
|
|
23386
|
-
|
|
23387
|
-
|
|
23388
|
-
|
|
23389
|
-
|
|
23390
|
-
|
|
23391
|
-
|
|
23392
|
-
"
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
23397
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
24132
|
+
// src/cli/commands/om/scaffold-knowledge.ts
|
|
24133
|
+
var scaffold_knowledge_exports = {};
|
|
24134
|
+
__export(scaffold_knowledge_exports, {
|
|
24135
|
+
default: () => scaffoldKnowledge
|
|
24136
|
+
});
|
|
24137
|
+
async function scaffoldKnowledge(opts) {
|
|
24138
|
+
const projectDir = getProjectRoot();
|
|
24139
|
+
assertSplitLayout(projectDir);
|
|
24140
|
+
const options = opts;
|
|
24141
|
+
const id = await promptIfAbsent(options.id, "Knowledge node id (e.g. outreach-playbook)");
|
|
24142
|
+
if (!id) {
|
|
24143
|
+
process.stderr.write(source_default.red("Knowledge node id is required. Pass --id <id> or enter it at the prompt.\n"));
|
|
24144
|
+
process.exit(1);
|
|
23398
24145
|
}
|
|
23399
|
-
const
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
|
|
23403
|
-
|
|
23404
|
-
|
|
23405
|
-
|
|
23406
|
-
|
|
23407
|
-
|
|
23408
|
-
|
|
23409
|
-
|
|
24146
|
+
const rawKind = await promptIfAbsent(
|
|
24147
|
+
options.kind,
|
|
24148
|
+
"Node kind (playbook / strategy / reference / policy)",
|
|
24149
|
+
{ default: "reference" }
|
|
24150
|
+
);
|
|
24151
|
+
const kind = rawKind || "reference";
|
|
24152
|
+
if (!VALID_KINDS.includes(kind)) {
|
|
24153
|
+
process.stderr.write(source_default.red(`Invalid kind \`${kind}\`. Must be one of: ${VALID_KINDS.join(", ")}.
|
|
24154
|
+
`));
|
|
24155
|
+
process.exit(1);
|
|
24156
|
+
}
|
|
24157
|
+
const rawSystemPath = await promptIfAbsent(
|
|
24158
|
+
options.systemPath,
|
|
24159
|
+
"Governing system path (leave blank for global)",
|
|
24160
|
+
{ default: "" }
|
|
24161
|
+
);
|
|
24162
|
+
const systemPath = rawSystemPath || void 0;
|
|
24163
|
+
const { filePath: relativeFilePath, content } = emitKnowledgeNode({ id, kind, systemPath });
|
|
24164
|
+
if (options.dryRun) {
|
|
24165
|
+
console.log(source_default.cyan("Dry-run mode \u2014 no files written.\n"));
|
|
24166
|
+
console.log(source_default.gray(`Proposed file: ${relativeFilePath}`));
|
|
24167
|
+
console.log(content);
|
|
24168
|
+
console.log(source_default.yellow("Run `elevasis-sdk om:generate` to register this node."));
|
|
24169
|
+
return;
|
|
24170
|
+
}
|
|
24171
|
+
const absoluteFilePath = (0, import_node_path12.join)(projectDir, relativeFilePath);
|
|
24172
|
+
if ((0, import_node_fs9.existsSync)(absoluteFilePath)) {
|
|
24173
|
+
process.stderr.write(
|
|
24174
|
+
source_default.red(`Knowledge node file already exists at \`${relativeFilePath}\`. Choose a different id.
|
|
24175
|
+
`)
|
|
24176
|
+
);
|
|
24177
|
+
process.exit(1);
|
|
24178
|
+
}
|
|
24179
|
+
(0, import_node_fs9.mkdirSync)((0, import_node_path12.join)(projectDir, "core", "config", "knowledge", "nodes"), { recursive: true });
|
|
24180
|
+
(0, import_node_fs9.writeFileSync)(absoluteFilePath, content, "utf8");
|
|
24181
|
+
console.log(source_default.green(`Knowledge node \`${id}\` written to \`${relativeFilePath}\``));
|
|
24182
|
+
console.log(source_default.yellow("Run `elevasis-sdk om:generate` to register this node."));
|
|
23410
24183
|
}
|
|
23411
|
-
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
24184
|
+
var import_node_path12, import_node_fs9, VALID_KINDS;
|
|
24185
|
+
var init_scaffold_knowledge = __esm({
|
|
24186
|
+
"src/cli/commands/om/scaffold-knowledge.ts"() {
|
|
24187
|
+
"use strict";
|
|
24188
|
+
import_node_path12 = require("node:path");
|
|
24189
|
+
import_node_fs9 = require("node:fs");
|
|
24190
|
+
init_source();
|
|
24191
|
+
init_config();
|
|
24192
|
+
init_project_layout();
|
|
24193
|
+
init_prompt_helpers();
|
|
24194
|
+
init_emit_knowledge();
|
|
24195
|
+
VALID_KINDS = ["playbook", "strategy", "reference", "policy"];
|
|
24196
|
+
}
|
|
24197
|
+
});
|
|
24198
|
+
|
|
24199
|
+
// src/cli/commands/om/emit-api-interface.ts
|
|
24200
|
+
function toConstName(systemPath) {
|
|
24201
|
+
return systemPath.split(/[.-]/).map((segment, index) => index === 0 ? segment : segment.charAt(0).toUpperCase() + segment.slice(1)).join("") + "ApiInterface";
|
|
24202
|
+
}
|
|
24203
|
+
function emitApiInterfaceBlock(gap) {
|
|
24204
|
+
const constName = toConstName(gap.systemPath);
|
|
24205
|
+
const resourceIdsLiteral = gap.resourceIds.length === 0 ? "[]" : `[
|
|
24206
|
+
${gap.resourceIds.map((id) => `'${id}'`).join(",\n ")}
|
|
24207
|
+
]`;
|
|
24208
|
+
const constFileCode = `// Auto-generated by om:scaffold:fill \u2014 do not edit manually.
|
|
24209
|
+
// Regenerate by running: elevasis-sdk om:scaffold:fill --gaps <path>
|
|
24210
|
+
|
|
24211
|
+
export const ${constName} = {
|
|
24212
|
+
lifecycle: 'active' as const,
|
|
24213
|
+
readinessProfile: 'standard' as const,
|
|
24214
|
+
resourceIds: ${resourceIdsLiteral}
|
|
24215
|
+
}
|
|
24216
|
+
`;
|
|
24217
|
+
const importLine = `import { ${constName} } from './api-interfaces/${gap.systemPath}'`;
|
|
24218
|
+
const fieldLine = ` apiInterface: ${constName},`;
|
|
24219
|
+
const importAnchor = /^\/\/ -{75,}\n\/\/ Feature/m;
|
|
24220
|
+
const escapedId = gap.systemPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
24221
|
+
const fieldAnchor = new RegExp(`id:\\s*['"]${escapedId}['"]`);
|
|
24222
|
+
return {
|
|
24223
|
+
constFileCode,
|
|
24224
|
+
importLine,
|
|
24225
|
+
fieldLine,
|
|
24226
|
+
importAnchor,
|
|
24227
|
+
fieldAnchor
|
|
23419
24228
|
};
|
|
23420
24229
|
}
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
|
|
23424
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
23425
|
-
return builder;
|
|
24230
|
+
var init_emit_api_interface = __esm({
|
|
24231
|
+
"src/cli/commands/om/emit-api-interface.ts"() {
|
|
24232
|
+
"use strict";
|
|
23426
24233
|
}
|
|
23427
|
-
};
|
|
23428
|
-
|
|
23429
|
-
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23434
|
-
|
|
24234
|
+
});
|
|
24235
|
+
|
|
24236
|
+
// src/cli/commands/om/scaffold-fill.ts
|
|
24237
|
+
var scaffold_fill_exports = {};
|
|
24238
|
+
__export(scaffold_fill_exports, {
|
|
24239
|
+
conformanceGapTempPath: () => conformanceGapTempPath,
|
|
24240
|
+
default: () => scaffoldFill
|
|
24241
|
+
});
|
|
24242
|
+
function conformanceGapTempPath(orgName) {
|
|
24243
|
+
return (0, import_node_path13.join)(os2.tmpdir(), `elevasis-conformance-${orgName}-${Date.now()}.json`);
|
|
24244
|
+
}
|
|
24245
|
+
function runValidation4(projectDir) {
|
|
24246
|
+
for (const script of ["check-types", "check"]) {
|
|
24247
|
+
const result = (0, import_node_child_process5.spawnSync)("pnpm", ["-C", "operations", "run", script], {
|
|
24248
|
+
cwd: projectDir,
|
|
24249
|
+
encoding: "utf8",
|
|
24250
|
+
shell: true
|
|
24251
|
+
});
|
|
24252
|
+
if (result.status !== 0) {
|
|
24253
|
+
return (result.stderr ?? "") + (result.stdout ?? "");
|
|
23435
24254
|
}
|
|
23436
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
23437
|
-
}
|
|
23438
|
-
if (model === "hex") {
|
|
23439
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
23440
24255
|
}
|
|
23441
|
-
return
|
|
23442
|
-
};
|
|
23443
|
-
var usedModels = ["rgb", "hex", "ansi256"];
|
|
23444
|
-
for (const model of usedModels) {
|
|
23445
|
-
styles2[model] = {
|
|
23446
|
-
get() {
|
|
23447
|
-
const { level } = this;
|
|
23448
|
-
return function(...arguments_) {
|
|
23449
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
23450
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
23451
|
-
};
|
|
23452
|
-
}
|
|
23453
|
-
};
|
|
23454
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
23455
|
-
styles2[bgModel] = {
|
|
23456
|
-
get() {
|
|
23457
|
-
const { level } = this;
|
|
23458
|
-
return function(...arguments_) {
|
|
23459
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
23460
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
23461
|
-
};
|
|
23462
|
-
}
|
|
23463
|
-
};
|
|
24256
|
+
return null;
|
|
23464
24257
|
}
|
|
23465
|
-
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
|
|
23472
|
-
},
|
|
23473
|
-
set(level) {
|
|
23474
|
-
this[GENERATOR].level = level;
|
|
23475
|
-
}
|
|
24258
|
+
async function scaffoldFill(opts) {
|
|
24259
|
+
const projectDir = getProjectRoot();
|
|
24260
|
+
assertSplitLayout(projectDir);
|
|
24261
|
+
const options = opts;
|
|
24262
|
+
if (!options.gaps) {
|
|
24263
|
+
process.stderr.write(source_default.red("Missing gaps file. Pass --gaps <path> pointing to a conformance gap JSON file.\n"));
|
|
24264
|
+
process.exit(1);
|
|
23476
24265
|
}
|
|
23477
|
-
|
|
23478
|
-
|
|
23479
|
-
|
|
23480
|
-
|
|
23481
|
-
|
|
23482
|
-
|
|
23483
|
-
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
closeAll = close + parent.closeAll;
|
|
24266
|
+
if (!(0, import_node_fs10.existsSync)(options.gaps)) {
|
|
24267
|
+
process.stderr.write(
|
|
24268
|
+
source_default.red(
|
|
24269
|
+
`Missing gaps file. Pass --gaps <path> pointing to a conformance gap JSON file.
|
|
24270
|
+
(File not found: ${options.gaps})
|
|
24271
|
+
`
|
|
24272
|
+
)
|
|
24273
|
+
);
|
|
24274
|
+
process.exit(1);
|
|
23487
24275
|
}
|
|
23488
|
-
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
|
|
23496
|
-
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
23502
|
-
return builder;
|
|
23503
|
-
};
|
|
23504
|
-
var applyStyle = (self2, string4) => {
|
|
23505
|
-
if (self2.level <= 0 || !string4) {
|
|
23506
|
-
return self2[IS_EMPTY] ? "" : string4;
|
|
24276
|
+
let payload;
|
|
24277
|
+
try {
|
|
24278
|
+
const raw = (0, import_node_fs10.readFileSync)(options.gaps, "utf8");
|
|
24279
|
+
payload = JSON.parse(raw);
|
|
24280
|
+
} catch {
|
|
24281
|
+
process.stderr.write(
|
|
24282
|
+
source_default.red(
|
|
24283
|
+
`Missing gaps file. Pass --gaps <path> pointing to a conformance gap JSON file.
|
|
24284
|
+
(File exists but could not be parsed as JSON: ${options.gaps})
|
|
24285
|
+
`
|
|
24286
|
+
)
|
|
24287
|
+
);
|
|
24288
|
+
process.exit(1);
|
|
23507
24289
|
}
|
|
23508
|
-
|
|
23509
|
-
|
|
23510
|
-
|
|
24290
|
+
if (!payload || typeof payload !== "object" || payload.version !== 1 || !Array.isArray(payload.gaps)) {
|
|
24291
|
+
process.stderr.write(
|
|
24292
|
+
source_default.red(
|
|
24293
|
+
`Missing gaps file. Pass --gaps <path> pointing to a conformance gap JSON file.
|
|
24294
|
+
(File does not match expected schema \u2014 must have version:1 and a gaps array)
|
|
24295
|
+
`
|
|
24296
|
+
)
|
|
24297
|
+
);
|
|
24298
|
+
process.exit(1);
|
|
23511
24299
|
}
|
|
23512
|
-
const
|
|
23513
|
-
|
|
23514
|
-
|
|
23515
|
-
|
|
23516
|
-
|
|
24300
|
+
const systemPath = payload.systemPath;
|
|
24301
|
+
const skippedGaps = [];
|
|
24302
|
+
const appliedGaps = [];
|
|
24303
|
+
const systemsFilePath = (0, import_node_path13.join)(projectDir, "core", "config", "organization-model", "systems.ts");
|
|
24304
|
+
const touchedFiles = [systemsFilePath];
|
|
24305
|
+
const emitResults = [];
|
|
24306
|
+
for (const gap of payload.gaps) {
|
|
24307
|
+
if (gap.field === "apiInterface") {
|
|
24308
|
+
const resourceIds = (
|
|
24309
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24310
|
+
Array.isArray(gap.resourceIds) ? (
|
|
24311
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24312
|
+
gap.resourceIds
|
|
24313
|
+
) : gap.resourceId ? [gap.resourceId] : []
|
|
24314
|
+
);
|
|
24315
|
+
const emitResult = emitApiInterfaceBlock({
|
|
24316
|
+
systemPath,
|
|
24317
|
+
resourceIds,
|
|
24318
|
+
message: gap.reason
|
|
24319
|
+
});
|
|
24320
|
+
const constFilePath = (0, import_node_path13.join)(
|
|
24321
|
+
projectDir,
|
|
24322
|
+
"core",
|
|
24323
|
+
"config",
|
|
24324
|
+
"organization-model",
|
|
24325
|
+
"api-interfaces",
|
|
24326
|
+
`${systemPath}.ts`
|
|
24327
|
+
);
|
|
24328
|
+
touchedFiles.push(constFilePath);
|
|
24329
|
+
emitResults.push(emitResult);
|
|
24330
|
+
appliedGaps.push(gap);
|
|
24331
|
+
} else {
|
|
24332
|
+
skippedGaps.push({
|
|
24333
|
+
field: gap.field,
|
|
24334
|
+
resourceId: gap.resourceId,
|
|
24335
|
+
reason: gap.reason
|
|
24336
|
+
});
|
|
24337
|
+
}
|
|
24338
|
+
}
|
|
24339
|
+
if (options.dryRun) {
|
|
24340
|
+
console.log(source_default.cyan("Dry-run mode \u2014 no files written.\n"));
|
|
24341
|
+
for (let i = 0; i < emitResults.length; i++) {
|
|
24342
|
+
const result = emitResults[i];
|
|
24343
|
+
const gap = appliedGaps[i];
|
|
24344
|
+
const constFilePath = `core/config/organization-model/api-interfaces/${systemPath}.ts`;
|
|
24345
|
+
console.log(source_default.gray(`Gap: ${gap.field} \u2014 would write ${constFilePath}`));
|
|
24346
|
+
console.log(result.constFileCode);
|
|
24347
|
+
console.log(source_default.gray(`Import line for systems.ts:`));
|
|
24348
|
+
console.log(result.importLine);
|
|
24349
|
+
console.log(source_default.gray(`Field line for systems.ts entry:`));
|
|
24350
|
+
console.log(result.fieldLine);
|
|
24351
|
+
console.log();
|
|
23517
24352
|
}
|
|
24353
|
+
if (skippedGaps.length > 0) {
|
|
24354
|
+
console.log(source_default.yellow(`Would skip ${skippedGaps.length} gap(s) requiring manual input:`));
|
|
24355
|
+
for (const sg of skippedGaps) {
|
|
24356
|
+
console.log(
|
|
24357
|
+
source_default.yellow(` - ${sg.field}${sg.resourceId ? ` (resource: ${sg.resourceId})` : ""}: ${sg.reason}`)
|
|
24358
|
+
);
|
|
24359
|
+
}
|
|
24360
|
+
}
|
|
24361
|
+
return;
|
|
23518
24362
|
}
|
|
23519
|
-
|
|
23520
|
-
|
|
23521
|
-
|
|
24363
|
+
if (appliedGaps.length > 0) {
|
|
24364
|
+
try {
|
|
24365
|
+
await withSnapshotRollback(touchedFiles, async () => {
|
|
24366
|
+
for (let i = 0; i < emitResults.length; i++) {
|
|
24367
|
+
const result = emitResults[i];
|
|
24368
|
+
const constFilePath = (0, import_node_path13.join)(
|
|
24369
|
+
projectDir,
|
|
24370
|
+
"core",
|
|
24371
|
+
"config",
|
|
24372
|
+
"organization-model",
|
|
24373
|
+
"api-interfaces",
|
|
24374
|
+
`${systemPath}.ts`
|
|
24375
|
+
);
|
|
24376
|
+
await applyConstImport(
|
|
24377
|
+
systemsFilePath,
|
|
24378
|
+
result.importLine,
|
|
24379
|
+
result.fieldLine,
|
|
24380
|
+
result.importAnchor,
|
|
24381
|
+
result.fieldAnchor,
|
|
24382
|
+
constFilePath,
|
|
24383
|
+
result.constFileCode
|
|
24384
|
+
);
|
|
24385
|
+
}
|
|
24386
|
+
const validationError = runValidation4(projectDir);
|
|
24387
|
+
if (validationError !== null) {
|
|
24388
|
+
throw new Error(validationError);
|
|
24389
|
+
}
|
|
24390
|
+
});
|
|
24391
|
+
} catch (err) {
|
|
24392
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
24393
|
+
process.stderr.write(source_default.red(mapValidationError(raw)) + "\n");
|
|
24394
|
+
process.exit(1);
|
|
24395
|
+
}
|
|
23522
24396
|
}
|
|
23523
|
-
|
|
23524
|
-
};
|
|
23525
|
-
|
|
23526
|
-
|
|
23527
|
-
|
|
23528
|
-
|
|
24397
|
+
if (skippedGaps.length > 0) {
|
|
24398
|
+
const skippedPath = options.skipped ?? (0, import_node_path13.join)(os2.tmpdir(), `elevasis-fill-skipped-${systemPath}-${Date.now()}.json`);
|
|
24399
|
+
(0, import_node_fs10.writeFileSync)(skippedPath, JSON.stringify({ systemPath, skipped: skippedGaps }, null, 2), "utf8");
|
|
24400
|
+
console.log(
|
|
24401
|
+
source_default.yellow(
|
|
24402
|
+
`Partial fill: ${appliedGaps.length} gap(s) applied, ${skippedGaps.length} skipped \u2014 see \`${skippedPath}\` for fields requiring manual input.`
|
|
24403
|
+
)
|
|
24404
|
+
);
|
|
24405
|
+
process.exit(2);
|
|
24406
|
+
}
|
|
24407
|
+
console.log(
|
|
24408
|
+
source_default.green(
|
|
24409
|
+
`Fill complete: ${appliedGaps.length} gap(s) resolved in \`core/config/organization-model/systems.ts\`.`
|
|
24410
|
+
)
|
|
24411
|
+
);
|
|
24412
|
+
}
|
|
24413
|
+
var import_node_path13, os2, import_node_fs10, import_node_child_process5;
|
|
24414
|
+
var init_scaffold_fill = __esm({
|
|
24415
|
+
"src/cli/commands/om/scaffold-fill.ts"() {
|
|
24416
|
+
"use strict";
|
|
24417
|
+
import_node_path13 = require("node:path");
|
|
24418
|
+
os2 = __toESM(require("node:os"), 1);
|
|
24419
|
+
import_node_fs10 = require("node:fs");
|
|
24420
|
+
import_node_child_process5 = require("node:child_process");
|
|
24421
|
+
init_source();
|
|
24422
|
+
init_config();
|
|
24423
|
+
init_project_layout();
|
|
24424
|
+
init_error_map();
|
|
24425
|
+
init_emit_api_interface();
|
|
24426
|
+
init_splice();
|
|
24427
|
+
}
|
|
24428
|
+
});
|
|
24429
|
+
|
|
24430
|
+
// src/cli/index.ts
|
|
24431
|
+
var index_exports = {};
|
|
24432
|
+
__export(index_exports, {
|
|
24433
|
+
getProjectRoot: () => getProjectRoot
|
|
24434
|
+
});
|
|
24435
|
+
module.exports = __toCommonJS(index_exports);
|
|
24436
|
+
var import_dotenv = __toESM(require_main(), 1);
|
|
24437
|
+
var import_fs4 = require("fs");
|
|
24438
|
+
var import_path4 = require("path");
|
|
24439
|
+
|
|
24440
|
+
// ../../node_modules/.pnpm/commander@11.1.0/node_modules/commander/esm.mjs
|
|
24441
|
+
var import_index = __toESM(require_commander(), 1);
|
|
24442
|
+
var {
|
|
24443
|
+
program,
|
|
24444
|
+
createCommand,
|
|
24445
|
+
createArgument,
|
|
24446
|
+
createOption,
|
|
24447
|
+
CommanderError,
|
|
24448
|
+
InvalidArgumentError,
|
|
24449
|
+
InvalidOptionArgumentError,
|
|
24450
|
+
// deprecated old name
|
|
24451
|
+
Command,
|
|
24452
|
+
Argument,
|
|
24453
|
+
Option,
|
|
24454
|
+
Help
|
|
24455
|
+
} = import_index.default;
|
|
24456
|
+
|
|
24457
|
+
// src/cli/index.ts
|
|
24458
|
+
init_source();
|
|
24459
|
+
|
|
24460
|
+
// src/cli/commands/check.ts
|
|
24461
|
+
init_source();
|
|
23529
24462
|
|
|
23530
24463
|
// ../../node_modules/.pnpm/ora@7.0.1/node_modules/ora/index.js
|
|
23531
24464
|
var import_node_process6 = __toESM(require("node:process"), 1);
|
|
24465
|
+
init_source();
|
|
23532
24466
|
|
|
23533
24467
|
// ../../node_modules/.pnpm/cli-cursor@4.0.0/node_modules/cli-cursor/index.js
|
|
23534
24468
|
var import_node_process3 = __toESM(require("node:process"), 1);
|
|
@@ -23577,6 +24511,9 @@ var cli_cursor_default = cliCursor;
|
|
|
23577
24511
|
// ../../node_modules/.pnpm/ora@7.0.1/node_modules/ora/index.js
|
|
23578
24512
|
var import_cli_spinners = __toESM(require_cli_spinners(), 1);
|
|
23579
24513
|
|
|
24514
|
+
// ../../node_modules/.pnpm/log-symbols@5.1.0/node_modules/log-symbols/index.js
|
|
24515
|
+
init_source();
|
|
24516
|
+
|
|
23580
24517
|
// ../../node_modules/.pnpm/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js
|
|
23581
24518
|
var import_node_process4 = __toESM(require("node:process"), 1);
|
|
23582
24519
|
function isUnicodeSupported() {
|
|
@@ -24040,6 +24977,7 @@ function ora(options) {
|
|
|
24040
24977
|
var import_path2 = require("path");
|
|
24041
24978
|
var import_promises = require("fs/promises");
|
|
24042
24979
|
var import_fs2 = require("fs");
|
|
24980
|
+
init_source();
|
|
24043
24981
|
|
|
24044
24982
|
// ../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/external.js
|
|
24045
24983
|
var external_exports = {};
|
|
@@ -37105,6 +38043,7 @@ var ORGANIZATION_MODEL_ICON_TOKENS = [
|
|
|
37105
38043
|
"view",
|
|
37106
38044
|
"launch",
|
|
37107
38045
|
"message",
|
|
38046
|
+
"message-plus",
|
|
37108
38047
|
"escalate",
|
|
37109
38048
|
"promote",
|
|
37110
38049
|
"submit",
|
|
@@ -37291,9 +38230,22 @@ var SidebarNavigationSchema = external_exports.object({
|
|
|
37291
38230
|
primary: SidebarSectionSchema,
|
|
37292
38231
|
bottom: SidebarSectionSchema
|
|
37293
38232
|
}).default({ primary: {}, bottom: {} });
|
|
38233
|
+
var TopbarActionNodeSchema = external_exports.object({
|
|
38234
|
+
id: ModelIdSchema,
|
|
38235
|
+
label: LabelSchema,
|
|
38236
|
+
tooltip: DescriptionSchema.optional(),
|
|
38237
|
+
icon: IconNameSchema.optional(),
|
|
38238
|
+
order: external_exports.number().int().optional(),
|
|
38239
|
+
enabled: external_exports.boolean().default(true),
|
|
38240
|
+
devOnly: external_exports.boolean().optional(),
|
|
38241
|
+
requiresAdmin: external_exports.boolean().optional(),
|
|
38242
|
+
targets: SidebarSurfaceTargetsSchema.optional()
|
|
38243
|
+
});
|
|
38244
|
+
var TopbarSectionSchema = external_exports.record(external_exports.string(), TopbarActionNodeSchema).default({});
|
|
37294
38245
|
var OrganizationModelNavigationSchema = external_exports.object({
|
|
37295
|
-
sidebar: SidebarNavigationSchema
|
|
37296
|
-
|
|
38246
|
+
sidebar: SidebarNavigationSchema,
|
|
38247
|
+
topbar: TopbarSectionSchema
|
|
38248
|
+
}).default({ sidebar: { primary: {}, bottom: {} }, topbar: {} });
|
|
37297
38249
|
var NavigationGroupSchema = external_exports.object({
|
|
37298
38250
|
id: ModelIdSchema,
|
|
37299
38251
|
label: LabelSchema,
|
|
@@ -37596,10 +38548,27 @@ var SystemUiSchema = external_exports.object({
|
|
|
37596
38548
|
});
|
|
37597
38549
|
var SystemInterfaceKeySchema = ModelIdSchema;
|
|
37598
38550
|
var SystemInterfaceLifecycleSchema = external_exports.enum(["draft", "active", "disabled", "deprecated", "archived"]).meta({ label: "System interface lifecycle", color: "teal" });
|
|
37599
|
-
var
|
|
37600
|
-
|
|
37601
|
-
|
|
38551
|
+
var SYSTEM_INTERFACE_PROFILES = [
|
|
38552
|
+
{
|
|
38553
|
+
systemPath: "sales.lead-gen",
|
|
38554
|
+
interfaceKey: "api",
|
|
38555
|
+
readinessProfile: "sales.lead-gen.api"
|
|
38556
|
+
},
|
|
38557
|
+
{
|
|
38558
|
+
systemPath: "sales.crm",
|
|
38559
|
+
interfaceKey: "api",
|
|
38560
|
+
readinessProfile: "sales.crm.api"
|
|
38561
|
+
},
|
|
38562
|
+
{
|
|
38563
|
+
systemPath: "sales.lead-gen",
|
|
38564
|
+
interfaceKey: "crm-handoff",
|
|
38565
|
+
readinessProfile: "sales.lead-gen.crm-handoff"
|
|
38566
|
+
}
|
|
38567
|
+
];
|
|
38568
|
+
var SYSTEM_INTERFACE_READINESS_PROFILES = SYSTEM_INTERFACE_PROFILES.map(
|
|
38569
|
+
(profile) => profile.readinessProfile
|
|
37602
38570
|
);
|
|
38571
|
+
var SystemInterfaceReadinessProfileSchema = external_exports.enum(SYSTEM_INTERFACE_READINESS_PROFILES);
|
|
37603
38572
|
var SystemInterfaceResourceScopeSchema = external_exports.array(ModelIdSchema).default([]);
|
|
37604
38573
|
var SystemApiInterfaceSchema = external_exports.object({
|
|
37605
38574
|
lifecycle: SystemInterfaceLifecycleSchema.default("active"),
|
|
@@ -38829,7 +39798,8 @@ var DEFAULT_ORGANIZATION_MODEL_NAVIGATION = {
|
|
|
38829
39798
|
sidebar: {
|
|
38830
39799
|
primary: {},
|
|
38831
39800
|
bottom: {}
|
|
38832
|
-
}
|
|
39801
|
+
},
|
|
39802
|
+
topbar: {}
|
|
38833
39803
|
};
|
|
38834
39804
|
var DEFAULT_ORGANIZATION_MODEL = {
|
|
38835
39805
|
version: 1,
|
|
@@ -38925,7 +39895,9 @@ function getAllBuildTemplates(model) {
|
|
|
38925
39895
|
(catalog) => entriesOf(catalog).map(([templateId, templateEntry]) => {
|
|
38926
39896
|
const stepCatalogId = stringValue(templateEntry.stepCatalog);
|
|
38927
39897
|
const stepCatalog = stepCatalogId !== void 0 ? stepCatalogs.get(stepCatalogId) : void 0;
|
|
38928
|
-
const steps = stepCatalog === void 0 ? [] : entriesOf(stepCatalog)
|
|
39898
|
+
const steps = stepCatalog === void 0 ? [] : entriesOf(stepCatalog).sort(
|
|
39899
|
+
([leftId, left], [rightId, right]) => numberValue(left.order, Number.MAX_SAFE_INTEGER) - numberValue(right.order, Number.MAX_SAFE_INTEGER) || leftId.localeCompare(rightId)
|
|
39900
|
+
);
|
|
38929
39901
|
return {
|
|
38930
39902
|
order: numberValue(templateEntry.order, Number.MAX_SAFE_INTEGER),
|
|
38931
39903
|
template: {
|
|
@@ -40269,21 +41241,9 @@ function validateModelConfig(config3) {
|
|
|
40269
41241
|
}
|
|
40270
41242
|
|
|
40271
41243
|
// ../core/src/business/acquisition/ontology-validation.ts
|
|
40272
|
-
var LEAD_GEN_API_INTERFACE =
|
|
40273
|
-
|
|
40274
|
-
|
|
40275
|
-
readinessProfile: "sales.lead-gen.api"
|
|
40276
|
-
};
|
|
40277
|
-
var CRM_API_INTERFACE = {
|
|
40278
|
-
systemPath: "sales.crm",
|
|
40279
|
-
interfaceKey: "api",
|
|
40280
|
-
readinessProfile: "sales.crm.api"
|
|
40281
|
-
};
|
|
40282
|
-
var LEAD_GEN_CRM_HANDOFF_INTERFACE = {
|
|
40283
|
-
systemPath: "sales.lead-gen",
|
|
40284
|
-
interfaceKey: "crm-handoff",
|
|
40285
|
-
readinessProfile: "sales.lead-gen.crm-handoff"
|
|
40286
|
-
};
|
|
41244
|
+
var LEAD_GEN_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[0];
|
|
41245
|
+
var CRM_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[1];
|
|
41246
|
+
var LEAD_GEN_CRM_HANDOFF_INTERFACE = SYSTEM_INTERFACE_PROFILES[2];
|
|
40287
41247
|
var LEAD_GEN_API_READINESS_LABEL = LEAD_GEN_API_INTERFACE.readinessProfile;
|
|
40288
41248
|
var CRM_API_READINESS_LABEL = CRM_API_INTERFACE.readinessProfile;
|
|
40289
41249
|
var LEAD_GEN_CRM_HANDOFF_READINESS_LABEL = LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile;
|
|
@@ -40364,6 +41324,9 @@ function profileForInterface(systemPath, interfaceKey, readinessProfile) {
|
|
|
40364
41324
|
function readinessMarkerPath(context) {
|
|
40365
41325
|
return context.interfaceKey === "api" ? `systems.${context.systemPath}.apiInterface` : `systems.${context.systemPath}.derivedCrmHandoffReadiness`;
|
|
40366
41326
|
}
|
|
41327
|
+
function formatSupportedReadinessProfiles() {
|
|
41328
|
+
return SYSTEM_INTERFACE_READINESS_PROFILES.map((profile) => `"${profile}"`).join(", ");
|
|
41329
|
+
}
|
|
40367
41330
|
function getActiveScopedResources(model, resourceIds, issues, context) {
|
|
40368
41331
|
const resources = [];
|
|
40369
41332
|
for (const [index, resourceId] of resourceIds.entries()) {
|
|
@@ -40643,18 +41606,13 @@ function computeInterfaceReadiness(model, request) {
|
|
|
40643
41606
|
{ path: `${readinessMarkerPath(request)}.lifecycle` }
|
|
40644
41607
|
);
|
|
40645
41608
|
}
|
|
40646
|
-
const
|
|
40647
|
-
LEAD_GEN_API_INTERFACE.readinessProfile,
|
|
40648
|
-
CRM_API_INTERFACE.readinessProfile,
|
|
40649
|
-
LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile
|
|
40650
|
-
];
|
|
40651
|
-
const supportedProfile = readinessProfile !== void 0 && supportedProfiles.some((profile) => profile === readinessProfile);
|
|
41609
|
+
const supportedProfile = readinessProfile !== void 0 && SYSTEM_INTERFACE_PROFILES.some((profile) => profile.readinessProfile === readinessProfile);
|
|
40652
41610
|
if (!supportedProfile) {
|
|
40653
41611
|
addReadinessIssue(
|
|
40654
41612
|
issues,
|
|
40655
41613
|
"SYSTEM_INTERFACE_INVALID",
|
|
40656
41614
|
"unknown-readiness-profile",
|
|
40657
|
-
`System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" references unknown readiness profile "${readinessProfile}".`,
|
|
41615
|
+
`System Interface "${formatInterfaceIdentity(request.systemPath, request.interfaceKey)}" references unknown readiness profile "${readinessProfile}". Supported profiles: ${formatSupportedReadinessProfiles()}. Custom Systems should not declare apiInterface; route custom behavior through workflows/operations plus ontology, resources, and topology.`,
|
|
40658
41616
|
{ path: `${readinessMarkerPath(request)}.readinessProfile`, ref: readinessProfile }
|
|
40659
41617
|
);
|
|
40660
41618
|
return {
|
|
@@ -41069,6 +42027,35 @@ function addSystemInterfaceIssue(issues, orgName, systemPath, interfaceKey, issu
|
|
|
41069
42027
|
message: `[${orgName}] ${issue2.family}:${issue2.code}: ${issue2.message}`
|
|
41070
42028
|
});
|
|
41071
42029
|
}
|
|
42030
|
+
function detectMissingApiInterfaceDeclarations(orgName, organizationModel) {
|
|
42031
|
+
if (organizationModel === void 0) return [];
|
|
42032
|
+
const apiBoundResourcesBySystemPath = /* @__PURE__ */ new Map();
|
|
42033
|
+
for (const resource of Object.values(organizationModel.resources ?? {})) {
|
|
42034
|
+
const ontology = resource.ontology;
|
|
42035
|
+
if (ontology === void 0) continue;
|
|
42036
|
+
const hasOntologyBindings = ontology.actions !== void 0 && ontology.actions.length > 0 || ontology.writes !== void 0 && ontology.writes.length > 0;
|
|
42037
|
+
if (!hasOntologyBindings) continue;
|
|
42038
|
+
const existing = apiBoundResourcesBySystemPath.get(resource.systemPath);
|
|
42039
|
+
if (existing) {
|
|
42040
|
+
existing.push(resource.id);
|
|
42041
|
+
} else {
|
|
42042
|
+
apiBoundResourcesBySystemPath.set(resource.systemPath, [resource.id]);
|
|
42043
|
+
}
|
|
42044
|
+
}
|
|
42045
|
+
if (apiBoundResourcesBySystemPath.size === 0) return [];
|
|
42046
|
+
const gaps = [];
|
|
42047
|
+
for (const { path: path3, system } of listAllSystems(organizationModel)) {
|
|
42048
|
+
if (system.apiInterface !== void 0) continue;
|
|
42049
|
+
const resourceIds = apiBoundResourcesBySystemPath.get(path3);
|
|
42050
|
+
if (!resourceIds || resourceIds.length === 0) continue;
|
|
42051
|
+
gaps.push({
|
|
42052
|
+
systemPath: path3,
|
|
42053
|
+
resourceIds,
|
|
42054
|
+
message: `[${orgName}] System '${path3}' has ${resourceIds.length} API-backed resource(s) (${resourceIds.join(", ")}) but no apiInterface declaration.`
|
|
42055
|
+
});
|
|
42056
|
+
}
|
|
42057
|
+
return gaps;
|
|
42058
|
+
}
|
|
41072
42059
|
function validateDeclaredSystemInterfaceReadiness(orgName, organizationModel) {
|
|
41073
42060
|
const issues = [];
|
|
41074
42061
|
if (organizationModel === void 0) return { valid: true, issues };
|
|
@@ -44516,105 +45503,11 @@ var ResourceRegistry = class {
|
|
|
44516
45503
|
// src/index.ts
|
|
44517
45504
|
var ListBuilderStageKeySchema = external_exports.string().min(1);
|
|
44518
45505
|
|
|
44519
|
-
// src/cli/
|
|
44520
|
-
|
|
44521
|
-
var import_path = require("path");
|
|
44522
|
-
var DEV_API_URL = "http://localhost:5170";
|
|
44523
|
-
var PROD_API_URL = "https://api.elevasis.io";
|
|
44524
|
-
function resolveApiUrl(cliOverride, prod) {
|
|
44525
|
-
if (cliOverride) return cliOverride;
|
|
44526
|
-
if (prod) return PROD_API_URL;
|
|
44527
|
-
if (process.env.ELEVASIS_API_URL) return process.env.ELEVASIS_API_URL;
|
|
44528
|
-
if (process.env.NODE_ENV === "development") return DEV_API_URL;
|
|
44529
|
-
return PROD_API_URL;
|
|
44530
|
-
}
|
|
44531
|
-
function resolveEnvironment(prod) {
|
|
44532
|
-
if (prod) return "production";
|
|
44533
|
-
return process.env.NODE_ENV === "development" ? "development" : "production";
|
|
44534
|
-
}
|
|
44535
|
-
function resolveApiKey(prod) {
|
|
44536
|
-
if (!prod && process.env.NODE_ENV === "development") {
|
|
44537
|
-
return process.env.ELEVASIS_PLATFORM_KEY_DEV ?? process.env.ELEVASIS_PLATFORM_KEY ?? "";
|
|
44538
|
-
}
|
|
44539
|
-
return process.env.ELEVASIS_PLATFORM_KEY ?? "";
|
|
44540
|
-
}
|
|
44541
|
-
function tryFindProjectRoot(startDir) {
|
|
44542
|
-
const raw = (0, import_path.resolve)(startDir);
|
|
44543
|
-
let dir;
|
|
44544
|
-
try {
|
|
44545
|
-
dir = (0, import_fs.realpathSync)(raw);
|
|
44546
|
-
} catch {
|
|
44547
|
-
dir = raw;
|
|
44548
|
-
}
|
|
44549
|
-
while (true) {
|
|
44550
|
-
if ((0, import_fs.existsSync)((0, import_path.join)(dir, ".elevasis"))) return dir;
|
|
44551
|
-
const parent = (0, import_path.dirname)(dir);
|
|
44552
|
-
if (parent === dir) break;
|
|
44553
|
-
dir = parent;
|
|
44554
|
-
}
|
|
44555
|
-
return null;
|
|
44556
|
-
}
|
|
44557
|
-
function findProjectRoot(startDir) {
|
|
44558
|
-
const root = tryFindProjectRoot(startDir);
|
|
44559
|
-
if (root !== null) return root;
|
|
44560
|
-
process.stderr.write(
|
|
44561
|
-
"Not inside an Elevasis project. Run this command from a project directory (an Elevasis project has a .elevasis file at its root).\n"
|
|
44562
|
-
);
|
|
44563
|
-
process.exit(1);
|
|
44564
|
-
}
|
|
44565
|
-
function isHelpOrVersionOnly() {
|
|
44566
|
-
const args = process.argv.slice(2);
|
|
44567
|
-
return args.length > 0 && args.every((a) => ["--help", "-h", "--version", "-V"].includes(a));
|
|
44568
|
-
}
|
|
44569
|
-
var _projectRoot;
|
|
44570
|
-
function getProjectRoot() {
|
|
44571
|
-
if (_projectRoot !== void 0) return _projectRoot;
|
|
44572
|
-
_projectRoot = isHelpOrVersionOnly() ? process.cwd() : findProjectRoot(process.cwd());
|
|
44573
|
-
return _projectRoot;
|
|
44574
|
-
}
|
|
44575
|
-
function resolveProjectRelative(relOrAbsPath) {
|
|
44576
|
-
if ((0, import_path.isAbsolute)(relOrAbsPath)) return relOrAbsPath;
|
|
44577
|
-
return (0, import_path.resolve)(getProjectRoot(), relOrAbsPath);
|
|
44578
|
-
}
|
|
44579
|
-
function findEnvFile(_startDir) {
|
|
44580
|
-
const projectRoot = tryFindProjectRoot(process.cwd());
|
|
44581
|
-
if (projectRoot === null) return void 0;
|
|
44582
|
-
const candidate = (0, import_path.join)(projectRoot, ".env");
|
|
44583
|
-
return (0, import_fs.existsSync)(candidate) ? candidate : void 0;
|
|
44584
|
-
}
|
|
44585
|
-
function findPackageRoot(startDir) {
|
|
44586
|
-
const raw = (0, import_path.resolve)(startDir);
|
|
44587
|
-
let dir;
|
|
44588
|
-
try {
|
|
44589
|
-
dir = (0, import_fs.realpathSync)(raw);
|
|
44590
|
-
} catch {
|
|
44591
|
-
dir = raw;
|
|
44592
|
-
}
|
|
44593
|
-
const projectRoot = tryFindProjectRoot(dir);
|
|
44594
|
-
while (true) {
|
|
44595
|
-
if ((0, import_fs.existsSync)((0, import_path.join)(dir, "package.json"))) return dir;
|
|
44596
|
-
const parent = (0, import_path.dirname)(dir);
|
|
44597
|
-
if (parent === dir) break;
|
|
44598
|
-
if (projectRoot !== null && dir === projectRoot) break;
|
|
44599
|
-
dir = parent;
|
|
44600
|
-
}
|
|
44601
|
-
process.stderr.write(
|
|
44602
|
-
"No package.json found between the current directory and the project root.\nRemediation: run this command from inside a package directory (one that contains package.json).\n"
|
|
44603
|
-
);
|
|
44604
|
-
process.exit(1);
|
|
44605
|
-
}
|
|
44606
|
-
var _packageRoot;
|
|
44607
|
-
function getPackageRoot() {
|
|
44608
|
-
if (_packageRoot !== void 0) return _packageRoot;
|
|
44609
|
-
_packageRoot = isHelpOrVersionOnly() ? process.cwd() : findPackageRoot(process.cwd());
|
|
44610
|
-
return _packageRoot;
|
|
44611
|
-
}
|
|
44612
|
-
function resolvePackageRelative(relOrAbsPath) {
|
|
44613
|
-
if ((0, import_path.isAbsolute)(relOrAbsPath)) return relOrAbsPath;
|
|
44614
|
-
return (0, import_path.resolve)(getPackageRoot(), relOrAbsPath);
|
|
44615
|
-
}
|
|
45506
|
+
// src/cli/commands/deploy.ts
|
|
45507
|
+
init_config();
|
|
44616
45508
|
|
|
44617
45509
|
// src/cli/api-client.ts
|
|
45510
|
+
init_config();
|
|
44618
45511
|
function getApiKey(apiUrl) {
|
|
44619
45512
|
const isProd = !apiUrl.includes("localhost");
|
|
44620
45513
|
const key = resolveApiKey(isProd);
|
|
@@ -44695,6 +45588,7 @@ async function apiDelete(endpoint, apiUrl = resolveApiUrl()) {
|
|
|
44695
45588
|
}
|
|
44696
45589
|
|
|
44697
45590
|
// src/cli/wrap-action.ts
|
|
45591
|
+
init_source();
|
|
44698
45592
|
function wrapAction(commandName, fn) {
|
|
44699
45593
|
return async (...args) => {
|
|
44700
45594
|
try {
|
|
@@ -44712,7 +45606,7 @@ function wrapAction(commandName, fn) {
|
|
|
44712
45606
|
// package.json
|
|
44713
45607
|
var package_default = {
|
|
44714
45608
|
name: "@elevasis/sdk",
|
|
44715
|
-
version: "1.
|
|
45609
|
+
version: "1.30.0",
|
|
44716
45610
|
description: "SDK for building Elevasis organization resources",
|
|
44717
45611
|
type: "module",
|
|
44718
45612
|
bin: {
|
|
@@ -44964,6 +45858,21 @@ function validateResourceGovernancePreflight(orgName, org, contractRegistry) {
|
|
|
44964
45858
|
if (org.organizationModel !== void 0) {
|
|
44965
45859
|
OrganizationModelSchema.parse(org.organizationModel);
|
|
44966
45860
|
}
|
|
45861
|
+
const conformanceGaps = detectMissingApiInterfaceDeclarations(
|
|
45862
|
+
orgName,
|
|
45863
|
+
org.organizationModel
|
|
45864
|
+
);
|
|
45865
|
+
if (conformanceGaps.length > 0) {
|
|
45866
|
+
const gapLines = conformanceGaps.map((gap) => ` ${gap.systemPath}: resources [${gap.resourceIds.join(", ")}] missing apiInterface`).join("\n");
|
|
45867
|
+
throw new RegistryValidationError(
|
|
45868
|
+
orgName,
|
|
45869
|
+
null,
|
|
45870
|
+
"organizationModel.apiInterface",
|
|
45871
|
+
`${conformanceGaps.length} system(s) have API-backed resources but no apiInterface declaration:
|
|
45872
|
+
${gapLines}
|
|
45873
|
+
Run \`pnpm exec elevasis-sdk om:scaffold:fill --gaps <path>\` to scaffold the missing apiInterface declarations.`
|
|
45874
|
+
);
|
|
45875
|
+
}
|
|
44967
45876
|
validateDeclaredSystemInterfaceReadiness(orgName, org.organizationModel);
|
|
44968
45877
|
if (process.env.ELEVASIS_RESOURCE_VALIDATOR === "warn-only") return;
|
|
44969
45878
|
validateResourceGovernance(orgName, org, org.organizationModel, { mode: "strict" });
|
|
@@ -45216,6 +46125,7 @@ import { startWorker } from '@elevasis/sdk/worker'
|
|
|
45216
46125
|
}
|
|
45217
46126
|
|
|
45218
46127
|
// src/cli/commands/check.ts
|
|
46128
|
+
init_config();
|
|
45219
46129
|
function registerCheckCommand(program3) {
|
|
45220
46130
|
program3.command("check").description(
|
|
45221
46131
|
"Validate project resources against the ResourceRegistry\n Example: elevasis-sdk check --entry ./src/index.ts"
|
|
@@ -45293,6 +46203,8 @@ function registerCheckCommand(program3) {
|
|
|
45293
46203
|
// src/cli/commands/exec.ts
|
|
45294
46204
|
var import_node_fs = require("node:fs");
|
|
45295
46205
|
var import_node_path = require("node:path");
|
|
46206
|
+
init_source();
|
|
46207
|
+
init_config();
|
|
45296
46208
|
var POLL_INTERVAL_MS = 3e3;
|
|
45297
46209
|
async function pollForCompletion(resourceId, executionId, apiUrl) {
|
|
45298
46210
|
const pollSpinner = ora("Waiting for completion...").start();
|
|
@@ -45444,6 +46356,8 @@ function registerExecCommand(program3) {
|
|
|
45444
46356
|
}
|
|
45445
46357
|
|
|
45446
46358
|
// src/cli/commands/resources.ts
|
|
46359
|
+
init_source();
|
|
46360
|
+
init_config();
|
|
45447
46361
|
function registerResourcesCommand(program3) {
|
|
45448
46362
|
program3.command("resources").description("List deployed resources for your organization").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(wrapAction("resources", async (options) => {
|
|
45449
46363
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
@@ -45489,6 +46403,8 @@ function registerResourcesCommand(program3) {
|
|
|
45489
46403
|
}
|
|
45490
46404
|
|
|
45491
46405
|
// src/cli/commands/executions.ts
|
|
46406
|
+
init_source();
|
|
46407
|
+
init_config();
|
|
45492
46408
|
function registerExecutionsCommand(program3) {
|
|
45493
46409
|
program3.command("executions <resourceId>").description("List execution history for a resource\n Example: elevasis-sdk executions my-workflow --limit 10").option("--api-url <url>", "API URL").option("--json", "Output as JSON").option("--limit <number>", "Limit number of results (default: 50)").option("--status <status>", "Filter by status (running|completed|failed)").action(wrapAction("executions", async (resourceId, options) => {
|
|
45494
46410
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
@@ -45547,6 +46463,8 @@ function registerExecutionsCommand(program3) {
|
|
|
45547
46463
|
}
|
|
45548
46464
|
|
|
45549
46465
|
// src/cli/commands/execution.ts
|
|
46466
|
+
init_source();
|
|
46467
|
+
init_config();
|
|
45550
46468
|
function registerExecutionCommand(program3) {
|
|
45551
46469
|
program3.command("execution <resourceId> <executionId>").description("Get detailed information about a specific execution\n Example: elevasis-sdk execution my-workflow abc-123-uuid --logs-only").option("--api-url <url>", "API URL").option("--json", "Output raw JSON response").option("--logs-only", "Show only execution logs").option("--input", "Include input data in output").option("--result", "Include result data in output").action(wrapAction("execution", async (resourceId, executionId, options) => {
|
|
45552
46470
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
@@ -45649,6 +46567,8 @@ function displayLog(log) {
|
|
|
45649
46567
|
}
|
|
45650
46568
|
|
|
45651
46569
|
// src/cli/commands/deployments.ts
|
|
46570
|
+
init_source();
|
|
46571
|
+
init_config();
|
|
45652
46572
|
function registerDeploymentsCommand(program3) {
|
|
45653
46573
|
program3.command("deployments").description("List deployments for your organization").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(wrapAction("deployments", async (options) => {
|
|
45654
46574
|
const apiUrl = resolveApiUrl(options.apiUrl);
|
|
@@ -45709,6 +46629,8 @@ function registerDeploymentsCommand(program3) {
|
|
|
45709
46629
|
}
|
|
45710
46630
|
|
|
45711
46631
|
// src/cli/commands/describe.ts
|
|
46632
|
+
init_source();
|
|
46633
|
+
init_config();
|
|
45712
46634
|
function hasSchemaContent(schema) {
|
|
45713
46635
|
return Object.keys(schema).some((k) => k !== "$schema");
|
|
45714
46636
|
}
|
|
@@ -45781,7 +46703,11 @@ function registerDescribeCommand(program3) {
|
|
|
45781
46703
|
);
|
|
45782
46704
|
}
|
|
45783
46705
|
|
|
46706
|
+
// src/cli/commands/creds/creds.ts
|
|
46707
|
+
init_config();
|
|
46708
|
+
|
|
45784
46709
|
// src/cli/commands/creds/creds-list.ts
|
|
46710
|
+
init_source();
|
|
45785
46711
|
async function listCreds(apiUrl, json2) {
|
|
45786
46712
|
const spinner = ora("Fetching credentials...").start();
|
|
45787
46713
|
const data = await apiGet("/api/external/credentials", apiUrl);
|
|
@@ -45807,6 +46733,7 @@ Credentials (${data.credentials.length}):
|
|
|
45807
46733
|
}
|
|
45808
46734
|
|
|
45809
46735
|
// src/cli/commands/creds/creds-create.ts
|
|
46736
|
+
init_source();
|
|
45810
46737
|
var CREDENTIAL_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
45811
46738
|
var VALID_TYPES = ["api-key", "webhook-secret"];
|
|
45812
46739
|
async function createCreds(apiUrl, name, type, valueJson) {
|
|
@@ -45861,6 +46788,7 @@ Credential created successfully!`));
|
|
|
45861
46788
|
}
|
|
45862
46789
|
|
|
45863
46790
|
// src/cli/commands/creds/creds-update.ts
|
|
46791
|
+
init_source();
|
|
45864
46792
|
async function updateCreds(apiUrl, name, valueJson) {
|
|
45865
46793
|
let value;
|
|
45866
46794
|
try {
|
|
@@ -45894,6 +46822,7 @@ Credential '${name}' updated successfully!`));
|
|
|
45894
46822
|
}
|
|
45895
46823
|
|
|
45896
46824
|
// src/cli/commands/creds/creds-rename.ts
|
|
46825
|
+
init_source();
|
|
45897
46826
|
var CREDENTIAL_NAME_REGEX2 = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
45898
46827
|
async function renameCreds(apiUrl, name, newName) {
|
|
45899
46828
|
if (!newName || newName.length < 1 || newName.length > 100) {
|
|
@@ -45927,6 +46856,7 @@ Credential renamed successfully!`));
|
|
|
45927
46856
|
}
|
|
45928
46857
|
|
|
45929
46858
|
// src/cli/commands/creds/creds-delete.ts
|
|
46859
|
+
init_source();
|
|
45930
46860
|
var import_readline = require("readline");
|
|
45931
46861
|
function confirm(message) {
|
|
45932
46862
|
const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
@@ -45991,7 +46921,11 @@ function registerCredsCommand(program3) {
|
|
|
45991
46921
|
}));
|
|
45992
46922
|
}
|
|
45993
46923
|
|
|
46924
|
+
// src/cli/commands/error/error.ts
|
|
46925
|
+
init_config();
|
|
46926
|
+
|
|
45994
46927
|
// src/cli/commands/error/error-resolve.ts
|
|
46928
|
+
init_source();
|
|
45995
46929
|
async function resolveError(apiUrl, errorId) {
|
|
45996
46930
|
const spinner = ora("Resolving error...").start();
|
|
45997
46931
|
await apiPatch(`/api/external/observability/errors/${errorId}/resolve`, {}, apiUrl);
|
|
@@ -46027,6 +46961,8 @@ function registerErrorCommand(program3) {
|
|
|
46027
46961
|
}
|
|
46028
46962
|
|
|
46029
46963
|
// src/cli/commands/rename.ts
|
|
46964
|
+
init_source();
|
|
46965
|
+
init_config();
|
|
46030
46966
|
function registerRenameCommand(program3) {
|
|
46031
46967
|
program3.command("rename <oldResourceId>").description("Rename a resource ID across all platform tables (dry run by default)").requiredOption("--to <newResourceId>", "New resource ID").option("--execute", "Apply the rename (default: dry run preview only)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
|
|
46032
46968
|
wrapAction("rename", async (oldResourceId, options) => {
|
|
@@ -46064,7 +47000,12 @@ function registerRenameCommand(program3) {
|
|
|
46064
47000
|
);
|
|
46065
47001
|
}
|
|
46066
47002
|
|
|
47003
|
+
// src/cli/commands/project/projects.ts
|
|
47004
|
+
init_source();
|
|
47005
|
+
init_config();
|
|
47006
|
+
|
|
46067
47007
|
// src/cli/commands/project/resolve-project.ts
|
|
47008
|
+
init_config();
|
|
46068
47009
|
function isUuid(value) {
|
|
46069
47010
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
46070
47011
|
}
|
|
@@ -46301,6 +47242,8 @@ function renderProjectWorkBrief(brief) {
|
|
|
46301
47242
|
}
|
|
46302
47243
|
|
|
46303
47244
|
// src/cli/commands/client/client.ts
|
|
47245
|
+
init_source();
|
|
47246
|
+
init_config();
|
|
46304
47247
|
function isUuid2(value) {
|
|
46305
47248
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
46306
47249
|
}
|
|
@@ -46674,6 +47617,8 @@ Project ${id} deleted.`));
|
|
|
46674
47617
|
}
|
|
46675
47618
|
|
|
46676
47619
|
// src/cli/commands/project/milestones.ts
|
|
47620
|
+
init_source();
|
|
47621
|
+
init_config();
|
|
46677
47622
|
function registerMilestoneList(program3) {
|
|
46678
47623
|
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(
|
|
46679
47624
|
wrapAction("project:milestone:list", async (options) => {
|
|
@@ -46793,6 +47738,8 @@ Milestone ${id} deleted.`));
|
|
|
46793
47738
|
}
|
|
46794
47739
|
|
|
46795
47740
|
// src/cli/commands/project/tasks.ts
|
|
47741
|
+
init_source();
|
|
47742
|
+
init_config();
|
|
46796
47743
|
function registerTaskList(program3) {
|
|
46797
47744
|
program3.command("project:task:list").description(
|
|
46798
47745
|
"List tasks for a project\n Example: elevasis-sdk project:task:list --project <uuid> --status in_progress"
|
|
@@ -47071,6 +48018,9 @@ Resume context saved for task ${id}`));
|
|
|
47071
48018
|
);
|
|
47072
48019
|
}
|
|
47073
48020
|
|
|
48021
|
+
// src/cli/commands/project/notes.ts
|
|
48022
|
+
init_source();
|
|
48023
|
+
|
|
47074
48024
|
// ../core/src/projects/api-schemas.ts
|
|
47075
48025
|
var ProjectKindSchema = external_exports.enum(["client_engagement", "internal", "research", "other"]);
|
|
47076
48026
|
var ProjectStatusSchema = external_exports.enum(["active", "on_track", "at_risk", "blocked", "completed", "paused"]);
|
|
@@ -47229,6 +48179,7 @@ var UpdateNoteRequestSchema = external_exports.object({
|
|
|
47229
48179
|
var NoteIdParamsSchema = external_exports.object({ id: UuidSchema });
|
|
47230
48180
|
|
|
47231
48181
|
// src/cli/commands/project/notes.ts
|
|
48182
|
+
init_config();
|
|
47232
48183
|
var NOTE_TYPE_HELP = NoteTypeSchema.options.join(" | ");
|
|
47233
48184
|
function registerNoteList(program3) {
|
|
47234
48185
|
program3.command("project:note:list").description("List notes for a project\n Example: elevasis-sdk project:note: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(
|
|
@@ -48088,6 +49039,9 @@ ${appliesLines.join("\n")}` : "";
|
|
|
48088
49039
|
return join3([header, effectSection, appliesSection]);
|
|
48089
49040
|
}
|
|
48090
49041
|
|
|
49042
|
+
// src/cli/commands/knowledge/ls.ts
|
|
49043
|
+
init_config();
|
|
49044
|
+
|
|
48091
49045
|
// src/cli/commands/knowledge/load-org-model.ts
|
|
48092
49046
|
var import_path3 = require("path");
|
|
48093
49047
|
var import_fs3 = require("fs");
|
|
@@ -48223,6 +49177,7 @@ function registerKnowledgeLs(program3) {
|
|
|
48223
49177
|
}
|
|
48224
49178
|
|
|
48225
49179
|
// src/cli/commands/knowledge/cat.ts
|
|
49180
|
+
init_config();
|
|
48226
49181
|
function registerKnowledgeCat(program3) {
|
|
48227
49182
|
program3.command("knowledge:cat <id>").alias("om:cat").description(
|
|
48228
49183
|
"Print the raw MDX body of a knowledge node\n Example: elevasis-sdk om:cat knowledge.outreach-playbook\n Use --json for structured output"
|
|
@@ -48246,6 +49201,7 @@ function registerKnowledgeCat(program3) {
|
|
|
48246
49201
|
}
|
|
48247
49202
|
|
|
48248
49203
|
// src/cli/commands/knowledge/graph.ts
|
|
49204
|
+
init_config();
|
|
48249
49205
|
function registerKnowledgeGraph(program3) {
|
|
48250
49206
|
program3.command("knowledge:graph <id>").alias("om:graph").description(
|
|
48251
49207
|
"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>)"
|
|
@@ -48305,6 +49261,7 @@ function registerKnowledgeGraph(program3) {
|
|
|
48305
49261
|
}
|
|
48306
49262
|
|
|
48307
49263
|
// src/cli/commands/knowledge/skills.ts
|
|
49264
|
+
init_config();
|
|
48308
49265
|
function normalizeKnowledgeId(id) {
|
|
48309
49266
|
return id.startsWith("knowledge:") ? id.slice("knowledge:".length) : id;
|
|
48310
49267
|
}
|
|
@@ -48781,6 +49738,7 @@ function generateKnowledgeNodes(options) {
|
|
|
48781
49738
|
}
|
|
48782
49739
|
|
|
48783
49740
|
// src/cli/commands/knowledge/generate.ts
|
|
49741
|
+
init_config();
|
|
48784
49742
|
function registerKnowledgeGenerate(program3) {
|
|
48785
49743
|
program3.command("knowledge:generate").alias("om:generate").description(
|
|
48786
49744
|
"Generate OrganizationModel knowledge nodes from MDX source files\n Example: elevasis-sdk om:generate"
|
|
@@ -48823,6 +49781,7 @@ function registerKnowledgeGenerate(program3) {
|
|
|
48823
49781
|
}
|
|
48824
49782
|
|
|
48825
49783
|
// src/cli/commands/knowledge/search.ts
|
|
49784
|
+
init_config();
|
|
48826
49785
|
var ALL_KINDS = ["system", "resource", "knowledge", "ontology", "role", "policy"];
|
|
48827
49786
|
function parseLimit(raw) {
|
|
48828
49787
|
if (raw === void 0) return 10;
|
|
@@ -48875,6 +49834,7 @@ function registerKnowledgeSearch(program3) {
|
|
|
48875
49834
|
}
|
|
48876
49835
|
|
|
48877
49836
|
// src/cli/commands/knowledge/describe.ts
|
|
49837
|
+
init_config();
|
|
48878
49838
|
function registerKnowledgeDescribe(program3) {
|
|
48879
49839
|
program3.command("knowledge:describe <nodeId>").alias("om:describe").description(
|
|
48880
49840
|
"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"
|
|
@@ -48913,6 +49873,8 @@ function registerKnowledgeCommands(program3) {
|
|
|
48913
49873
|
// src/cli/commands/request/request.ts
|
|
48914
49874
|
var import_node_fs4 = require("node:fs");
|
|
48915
49875
|
var import_node_path4 = require("node:path");
|
|
49876
|
+
init_source();
|
|
49877
|
+
init_config();
|
|
48916
49878
|
|
|
48917
49879
|
// ../core/src/requests/api-schemas.ts
|
|
48918
49880
|
var RequestSeverityEnum = external_exports.enum(["critical", "warning", "info"]);
|
|
@@ -49069,6 +50031,7 @@ ${rows.length} request${rows.length === 1 ? "" : "s"}`));
|
|
|
49069
50031
|
var import_node_child_process = require("node:child_process");
|
|
49070
50032
|
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
49071
50033
|
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
50034
|
+
init_config();
|
|
49072
50035
|
function run(command, args, cwd) {
|
|
49073
50036
|
(0, import_node_child_process.execFileSync)(command, args, {
|
|
49074
50037
|
cwd,
|
|
@@ -49210,6 +50173,8 @@ function registerUiCommands(program3) {
|
|
|
49210
50173
|
// src/cli/commands/doctor.ts
|
|
49211
50174
|
var import_node_fs6 = require("node:fs");
|
|
49212
50175
|
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
50176
|
+
init_source();
|
|
50177
|
+
init_config();
|
|
49213
50178
|
function ok(label, detail) {
|
|
49214
50179
|
console.log(`${source_default.green("[OK]")} ${source_default.bold(label)}: ${detail}`);
|
|
49215
50180
|
}
|
|
@@ -49449,6 +50414,8 @@ function registerCliCatalogCommand(program3) {
|
|
|
49449
50414
|
}
|
|
49450
50415
|
|
|
49451
50416
|
// src/cli/commands/acquisition/deals.ts
|
|
50417
|
+
init_source();
|
|
50418
|
+
init_config();
|
|
49452
50419
|
function appendQuery2(params, key, value) {
|
|
49453
50420
|
if (value === void 0 || value === null || value === "") return;
|
|
49454
50421
|
params.set(key, String(value));
|
|
@@ -49558,6 +50525,8 @@ function registerAcquisitionDealStatus(program3) {
|
|
|
49558
50525
|
}
|
|
49559
50526
|
|
|
49560
50527
|
// src/cli/commands/acquisition/lists.ts
|
|
50528
|
+
init_source();
|
|
50529
|
+
init_config();
|
|
49561
50530
|
function appendQuery3(params, key, value) {
|
|
49562
50531
|
if (value === void 0 || value === null || value === "") return;
|
|
49563
50532
|
params.set(key, String(value));
|
|
@@ -49675,6 +50644,8 @@ function registerAcquisitionCommands(program3) {
|
|
|
49675
50644
|
}
|
|
49676
50645
|
|
|
49677
50646
|
// src/cli/commands/client/client-write.ts
|
|
50647
|
+
init_source();
|
|
50648
|
+
init_config();
|
|
49678
50649
|
function registerClientCreate(program3) {
|
|
49679
50650
|
program3.command("client:create").description('Create a new client\n Example: elevasis-sdk client:create --name "Acme Corp"').requiredOption("--name <name>", "Client name").option("--status <status>", "Client status: active | onboarding | paused | completed | churned").option("--source-deal-id <uuid>", "UUID of the source deal").option("--primary-company-id <uuid>", "UUID of the primary company").option("--primary-contact-id <uuid>", "UUID of the primary contact").option("--metadata <json>", "Arbitrary metadata (JSON string)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
|
|
49680
50651
|
wrapAction(
|
|
@@ -49806,6 +50777,8 @@ function registerClientCommands(program3) {
|
|
|
49806
50777
|
}
|
|
49807
50778
|
|
|
49808
50779
|
// src/cli/commands/queue/queue.ts
|
|
50780
|
+
init_source();
|
|
50781
|
+
init_config();
|
|
49809
50782
|
function printJson4(value) {
|
|
49810
50783
|
console.log(JSON.stringify(value, null, 2));
|
|
49811
50784
|
}
|
|
@@ -49991,6 +50964,8 @@ function registerQueueCommands(program3) {
|
|
|
49991
50964
|
}
|
|
49992
50965
|
|
|
49993
50966
|
// src/cli/commands/schedule/schedule.ts
|
|
50967
|
+
init_source();
|
|
50968
|
+
init_config();
|
|
49994
50969
|
function printJson5(value) {
|
|
49995
50970
|
console.log(JSON.stringify(value, null, 2));
|
|
49996
50971
|
}
|
|
@@ -50219,6 +51194,8 @@ function registerScheduleCommands(program3) {
|
|
|
50219
51194
|
}
|
|
50220
51195
|
|
|
50221
51196
|
// src/cli/commands/notes.ts
|
|
51197
|
+
init_source();
|
|
51198
|
+
init_config();
|
|
50222
51199
|
var PRIORITY_HELP = "low | normal | high | urgent";
|
|
50223
51200
|
function registerNoteCreate2(program3) {
|
|
50224
51201
|
program3.command("note:create").description(
|
|
@@ -50295,6 +51272,8 @@ function registerNoteCommands(program3) {
|
|
|
50295
51272
|
}
|
|
50296
51273
|
|
|
50297
51274
|
// src/cli/commands/agent/agent.ts
|
|
51275
|
+
init_source();
|
|
51276
|
+
init_config();
|
|
50298
51277
|
function printJson6(value) {
|
|
50299
51278
|
console.log(JSON.stringify(value, null, 2));
|
|
50300
51279
|
}
|
|
@@ -50356,6 +51335,8 @@ function registerAgentCommands(program3) {
|
|
|
50356
51335
|
}
|
|
50357
51336
|
|
|
50358
51337
|
// src/cli/commands/session/session.ts
|
|
51338
|
+
init_source();
|
|
51339
|
+
init_config();
|
|
50359
51340
|
function printJson7(value) {
|
|
50360
51341
|
console.log(JSON.stringify(value, null, 2));
|
|
50361
51342
|
}
|
|
@@ -50439,10 +51420,44 @@ function registerSessionCommands(program3) {
|
|
|
50439
51420
|
registerSessionEnd(program3);
|
|
50440
51421
|
}
|
|
50441
51422
|
|
|
51423
|
+
// src/cli/commands/om/index.ts
|
|
51424
|
+
function registerOmScaffoldCommands(program3) {
|
|
51425
|
+
program3.command("om:scaffold:system").description("Guide creation of a new system entry in core/config/organization-model/systems.ts").option("--id <path>", "dot-notated system path, e.g. sales.crm (prompted if absent)").option("--title <title>", "display title (prompted if absent)").option("--kind <kind>", "system kind: operational | analytical | support (prompted if absent)").option("--api-backed", "emit apiInterface block and remind to add resource IDs").option("--dry-run", "print proposed TypeScript block without writing").action(async (opts) => {
|
|
51426
|
+
const mod = await Promise.resolve().then(() => (init_scaffold_system(), scaffold_system_exports));
|
|
51427
|
+
await mod.default(opts);
|
|
51428
|
+
});
|
|
51429
|
+
program3.command("om:scaffold:resource").description("Add a new workflow resource descriptor to core/config/organization-model/systems.ts").option("--id <id>", "resource id, e.g. lead-discovery-workflow (prompted if absent)").option("--system-path <path>", "systemPath to attach to (prompted if absent)").option("--title <title>", "resource display title (prompted if absent)").option("--primary-action <action>", "ontology primary action id (prompted; can be skipped)").option("--dry-run", "print proposed TypeScript block without writing").action(async (opts) => {
|
|
51430
|
+
const mod = await Promise.resolve().then(() => (init_scaffold_resource(), scaffold_resource_exports));
|
|
51431
|
+
await mod.default(opts);
|
|
51432
|
+
});
|
|
51433
|
+
program3.command("om:scaffold:role").description("Add a new role to core/config/organization-model/profile.ts").option("--id <id>", "role id, e.g. ops-lead (prompted if absent)").option("--title <title>", "display label (prompted if absent)").option("--description <desc>", "short description (prompted if absent)").option("--dry-run", "print proposed TypeScript block without writing").action(async (opts) => {
|
|
51434
|
+
const mod = await Promise.resolve().then(() => (init_scaffold_role(), scaffold_role_exports));
|
|
51435
|
+
await mod.default(opts);
|
|
51436
|
+
});
|
|
51437
|
+
program3.command("om:scaffold:knowledge").description("Create a new MDX knowledge node file in core/config/knowledge/nodes/").option("--id <id>", "knowledge node id, e.g. outreach-playbook (prompted if absent)").option("--kind <kind>", "node kind: playbook | strategy | reference | policy (prompted if absent)").option("--system-path <path>", "governing system path for mount (prompted; can be blank for global)").option("--dry-run", "print proposed MDX without writing").action(async (opts) => {
|
|
51438
|
+
const mod = await Promise.resolve().then(() => (init_scaffold_knowledge(), scaffold_knowledge_exports));
|
|
51439
|
+
await mod.default(opts);
|
|
51440
|
+
});
|
|
51441
|
+
program3.command("om:scaffold:fill").description("Non-interactive fill-mode: apply conformance gap JSON written by Agent 2a conformance gate").option("--gaps <path>", "path to conformance gap JSON file (required)").option("--skipped <path>", "output path for gaps that require manual input").option("--dry-run", "print proposed changes without writing").action(async (opts) => {
|
|
51442
|
+
const mod = await Promise.resolve().then(() => (init_scaffold_fill(), scaffold_fill_exports));
|
|
51443
|
+
await mod.default(opts);
|
|
51444
|
+
});
|
|
51445
|
+
}
|
|
51446
|
+
|
|
50442
51447
|
// src/cli/index.ts
|
|
51448
|
+
init_config();
|
|
50443
51449
|
var PREFLIGHT_SKIP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h", "--version", "-V"]);
|
|
50444
51450
|
var PREFLIGHT_SKIP_COMMANDS = /* @__PURE__ */ new Set(["cli"]);
|
|
50445
|
-
var LOCAL_PROJECT_COMMANDS = /* @__PURE__ */ new Set([
|
|
51451
|
+
var LOCAL_PROJECT_COMMANDS = /* @__PURE__ */ new Set([
|
|
51452
|
+
"ui:use-local",
|
|
51453
|
+
"ui:use-published",
|
|
51454
|
+
"knowledge:generate",
|
|
51455
|
+
"om:scaffold:system",
|
|
51456
|
+
"om:scaffold:resource",
|
|
51457
|
+
"om:scaffold:role",
|
|
51458
|
+
"om:scaffold:knowledge",
|
|
51459
|
+
"om:scaffold:fill"
|
|
51460
|
+
]);
|
|
50446
51461
|
function shouldSkipPreflight() {
|
|
50447
51462
|
const args = process.argv.slice(2);
|
|
50448
51463
|
if (args.length === 0) return true;
|
|
@@ -50561,6 +51576,7 @@ registerNoteCommands(program2);
|
|
|
50561
51576
|
registerUiCommands(program2);
|
|
50562
51577
|
registerDoctorCommand(program2);
|
|
50563
51578
|
registerCliCatalogCommand(program2);
|
|
51579
|
+
registerOmScaffoldCommands(program2);
|
|
50564
51580
|
program2.parse();
|
|
50565
51581
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50566
51582
|
0 && (module.exports = {
|