@elevasis/sdk 1.52.1 → 1.54.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 CHANGED
@@ -34,12 +34,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  ));
35
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
36
 
37
- // ../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/package.json
37
+ // ../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json
38
38
  var require_package = __commonJS({
39
- "../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/package.json"(exports2, module2) {
39
+ "../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/package.json"(exports2, module2) {
40
40
  module2.exports = {
41
41
  name: "dotenv",
42
- version: "16.6.1",
42
+ version: "17.2.3",
43
43
  description: "Loads environment variables from .env file",
44
44
  main: "lib/main.js",
45
45
  types: "lib/main.d.ts",
@@ -61,8 +61,8 @@ var require_package = __commonJS({
61
61
  "dts-check": "tsc --project tests/types/tsconfig.json",
62
62
  lint: "standard",
63
63
  pretest: "npm run lint && npm run dts-check",
64
- test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
65
- "test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
64
+ test: "tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000",
65
+ "test:coverage": "tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
66
66
  prerelease: "npm test",
67
67
  release: "standard-version"
68
68
  },
@@ -102,15 +102,48 @@ var require_package = __commonJS({
102
102
  }
103
103
  });
104
104
 
105
- // ../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js
105
+ // ../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js
106
106
  var require_main = __commonJS({
107
- "../../node_modules/.pnpm/dotenv@16.6.1/node_modules/dotenv/lib/main.js"(exports2, module2) {
107
+ "../../node_modules/.pnpm/dotenv@17.2.3/node_modules/dotenv/lib/main.js"(exports2, module2) {
108
108
  var fs2 = require("fs");
109
109
  var path3 = require("path");
110
110
  var os3 = require("os");
111
111
  var crypto = require("crypto");
112
112
  var packageJson = require_package();
113
113
  var version2 = packageJson.version;
114
+ var TIPS = [
115
+ "\u{1F510} encrypt with Dotenvx: https://dotenvx.com",
116
+ "\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit",
117
+ "\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild",
118
+ "\u{1F4E1} add observability to secrets: https://dotenvx.com/ops",
119
+ "\u{1F465} sync secrets across teammates & machines: https://dotenvx.com/ops",
120
+ "\u{1F5C2}\uFE0F backup and recover secrets: https://dotenvx.com/ops",
121
+ "\u2705 audit secrets and track compliance: https://dotenvx.com/ops",
122
+ "\u{1F504} add secrets lifecycle management: https://dotenvx.com/ops",
123
+ "\u{1F511} add access controls to secrets: https://dotenvx.com/ops",
124
+ "\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`",
125
+ "\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }",
126
+ "\u2699\uFE0F enable debug logging with { debug: true }",
127
+ "\u2699\uFE0F override existing env vars with { override: true }",
128
+ "\u2699\uFE0F suppress all logs with { quiet: true }",
129
+ "\u2699\uFE0F write to custom object with { processEnv: myObject }",
130
+ "\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"
131
+ ];
132
+ function _getRandomTip() {
133
+ return TIPS[Math.floor(Math.random() * TIPS.length)];
134
+ }
135
+ function parseBoolean(value) {
136
+ if (typeof value === "string") {
137
+ return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
138
+ }
139
+ return Boolean(value);
140
+ }
141
+ function supportsAnsi() {
142
+ return process.stdout.isTTY;
143
+ }
144
+ function dim(text) {
145
+ return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
146
+ }
114
147
  var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
115
148
  function parse3(src) {
116
149
  const obj = {};
@@ -159,7 +192,7 @@ var require_main = __commonJS({
159
192
  return DotenvModule.parse(decrypted);
160
193
  }
161
194
  function _warn(message) {
162
- console.log(`[dotenv@${version2}][WARN] ${message}`);
195
+ console.error(`[dotenv@${version2}][WARN] ${message}`);
163
196
  }
164
197
  function _debug(message) {
165
198
  console.log(`[dotenv@${version2}][DEBUG] ${message}`);
@@ -233,8 +266,8 @@ var require_main = __commonJS({
233
266
  return envPath2[0] === "~" ? path3.join(os3.homedir(), envPath2.slice(1)) : envPath2;
234
267
  }
235
268
  function _configVault(options) {
236
- const debug = Boolean(options && options.debug);
237
- const quiet = options && "quiet" in options ? options.quiet : true;
269
+ const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
270
+ const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
238
271
  if (debug || !quiet) {
239
272
  _log("Loading env from encrypted .env.vault");
240
273
  }
@@ -249,8 +282,12 @@ var require_main = __commonJS({
249
282
  function configDotenv(options) {
250
283
  const dotenvPath = path3.resolve(process.cwd(), ".env");
251
284
  let encoding = "utf8";
252
- const debug = Boolean(options && options.debug);
253
- const quiet = options && "quiet" in options ? options.quiet : true;
285
+ let processEnv = process.env;
286
+ if (options && options.processEnv != null) {
287
+ processEnv = options.processEnv;
288
+ }
289
+ let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
290
+ let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
254
291
  if (options && options.encoding) {
255
292
  encoding = options.encoding;
256
293
  } else {
@@ -282,13 +319,11 @@ var require_main = __commonJS({
282
319
  lastError = e;
283
320
  }
284
321
  }
285
- let processEnv = process.env;
286
- if (options && options.processEnv != null) {
287
- processEnv = options.processEnv;
288
- }
289
- DotenvModule.populate(processEnv, parsedAll, options);
322
+ const populated = DotenvModule.populate(processEnv, parsedAll, options);
323
+ debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
324
+ quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
290
325
  if (debug || !quiet) {
291
- const keysCount = Object.keys(parsedAll).length;
326
+ const keysCount = Object.keys(populated).length;
292
327
  const shortPaths = [];
293
328
  for (const filePath of optionPaths) {
294
329
  try {
@@ -301,7 +336,7 @@ var require_main = __commonJS({
301
336
  lastError = e;
302
337
  }
303
338
  }
304
- _log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
339
+ _log(`injecting env (${keysCount}) from ${shortPaths.join(",")} ${dim(`-- tip: ${_getRandomTip()}`)}`);
305
340
  }
306
341
  if (lastError) {
307
342
  return { parsed: parsedAll, error: lastError };
@@ -350,6 +385,7 @@ var require_main = __commonJS({
350
385
  function populate(processEnv, parsed, options = {}) {
351
386
  const debug = Boolean(options && options.debug);
352
387
  const override = Boolean(options && options.override);
388
+ const populated = {};
353
389
  if (typeof parsed !== "object") {
354
390
  const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
355
391
  err.code = "OBJECT_REQUIRED";
@@ -359,6 +395,7 @@ var require_main = __commonJS({
359
395
  if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
360
396
  if (override === true) {
361
397
  processEnv[key] = parsed[key];
398
+ populated[key] = parsed[key];
362
399
  }
363
400
  if (debug) {
364
401
  if (override === true) {
@@ -369,8 +406,10 @@ var require_main = __commonJS({
369
406
  }
370
407
  } else {
371
408
  processEnv[key] = parsed[key];
409
+ populated[key] = parsed[key];
372
410
  }
373
411
  }
412
+ return populated;
374
413
  }
375
414
  var DotenvModule = {
376
415
  configDotenv,
@@ -22369,16 +22408,9 @@ var init_define_contract = __esm({
22369
22408
  }
22370
22409
  });
22371
22410
 
22372
- // src/define-step.ts
22373
- var init_define_step = __esm({
22374
- "src/define-step.ts"() {
22375
- "use strict";
22376
- }
22377
- });
22378
-
22379
- // src/define-workflow.ts
22380
- var init_define_workflow = __esm({
22381
- "src/define-workflow.ts"() {
22411
+ // src/define-single-step-workflow.ts
22412
+ var init_define_single_step_workflow = __esm({
22413
+ "src/define-single-step-workflow.ts"() {
22382
22414
  "use strict";
22383
22415
  }
22384
22416
  });
@@ -26861,7 +26893,7 @@ function createPayloadSizeValidator(maxSizeBytes, options) {
26861
26893
  }
26862
26894
  });
26863
26895
  }
26864
- var UuidSchema, NonEmptyStringSchema, ResourceTypeSchema, OriginResourceTypeSchema, CredentialNameSchema, OAuthProviderSchema, OAuthCodeSchema, OAuthStateParamSchema, SanitizedStringSchema, EmailSchema, UrlSchema, PaginationSchema, TimestampSchema, DateRangeSchema;
26896
+ var UuidSchema, NonEmptyStringSchema, ResourceTypeSchema, OriginResourceTypeSchema, CredentialNameSchema, OAuthProviderSchema, OAuthCodeSchema, OAuthStateParamSchema, SanitizedStringSchema, EmailSchema, UrlSchema, PaginationSchema, DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT, PageLimitSchema, PageOffsetSchema, PaginationQuerySchema, TimestampSchema, DateRangeSchema;
26865
26897
  var init_validation = __esm({
26866
26898
  "../core/src/platform/utils/validation.ts"() {
26867
26899
  "use strict";
@@ -26884,6 +26916,14 @@ var init_validation = __esm({
26884
26916
  limit: external_exports.coerce.number().int().min(1).max(100).default(20),
26885
26917
  offset: external_exports.coerce.number().int().min(0).default(0)
26886
26918
  });
26919
+ DEFAULT_PAGE_LIMIT = 50;
26920
+ MAX_PAGE_LIMIT = 100;
26921
+ PageLimitSchema = external_exports.coerce.number().int().min(1).max(MAX_PAGE_LIMIT);
26922
+ PageOffsetSchema = external_exports.coerce.number().int().min(0).default(0);
26923
+ PaginationQuerySchema = external_exports.object({
26924
+ limit: PageLimitSchema.default(DEFAULT_PAGE_LIMIT),
26925
+ offset: PageOffsetSchema
26926
+ });
26887
26927
  TimestampSchema = external_exports.string().datetime();
26888
26928
  DateRangeSchema = external_exports.object({
26889
26929
  startDate: external_exports.string().datetime(),
@@ -46947,10 +46987,64 @@ var init_sse = __esm({
46947
46987
  }
46948
46988
  });
46949
46989
 
46990
+ // ../core/src/platform/api/describe-error.ts
46991
+ function parseAPIErrorEnvelope(body) {
46992
+ try {
46993
+ const parsed = JSON.parse(body);
46994
+ if (parsed && typeof parsed === "object" && typeof parsed.error === "string") {
46995
+ return parsed;
46996
+ }
46997
+ } catch {
46998
+ }
46999
+ return null;
47000
+ }
47001
+ function describeAPIError(status, envelope, options = {}) {
47002
+ const trailer = [];
47003
+ if (options.endpoint) trailer.push(` Endpoint: ${options.endpoint}`);
47004
+ if (envelope.requestId) trailer.push(` Request ID: ${envelope.requestId}`);
47005
+ if (envelope.fields) {
47006
+ for (const [field2, messages] of Object.entries(envelope.fields)) {
47007
+ trailer.push(` ${field2}: ${messages.join("; ")}`);
47008
+ }
47009
+ }
47010
+ const suffix = trailer.length > 0 ? `
47011
+ ${trailer.join("\n")}` : "";
47012
+ if (status === 403) {
47013
+ return `403 Access denied: ${envelope.error}
47014
+ The API refused this deliberately -- the request reached the handler and was rejected,
47015
+ so nothing was written. Usual causes, in order of likelihood:
47016
+ - the role on this organization membership lacks the required permission
47017
+ - a row-level security policy refused the row
47018
+ - the credential is scoped to a different organization than the one addressed` + suffix;
47019
+ }
47020
+ if (status === 401) {
47021
+ return `401 Unauthorized: ${envelope.error}
47022
+ The credential was missing, malformed, or not accepted. This is authentication,
47023
+ not permission -- a valid credential that lacks access returns 403 instead.` + suffix;
47024
+ }
47025
+ if (status === 404) {
47026
+ return `404 Not found: ${envelope.error}
47027
+ Check the identifier. Deployed resources carry a suffix (e.g. '-workflow'), and a
47028
+ resource in another organization reads as absent rather than forbidden.` + suffix;
47029
+ }
47030
+ if (status === 429) {
47031
+ const retry = envelope.retryAfter ? ` Retry in ${envelope.retryAfter}s.` : "";
47032
+ return `429 Rate limited: ${envelope.error}${retry}${suffix}`;
47033
+ }
47034
+ const label = envelope.code ? `${status} ${envelope.code}` : String(status);
47035
+ return `API request failed (${label}): ${envelope.error}${suffix}`;
47036
+ }
47037
+ var init_describe_error = __esm({
47038
+ "../core/src/platform/api/describe-error.ts"() {
47039
+ "use strict";
47040
+ }
47041
+ });
47042
+
46950
47043
  // ../core/src/platform/api/index.ts
46951
47044
  var init_api2 = __esm({
46952
47045
  "../core/src/platform/api/index.ts"() {
46953
47046
  "use strict";
47047
+ init_describe_error();
46954
47048
  }
46955
47049
  });
46956
47050
 
@@ -47410,7 +47504,7 @@ var init_api_schemas = __esm({
47410
47504
  }).strict();
47411
47505
  ListCommandQueueTasksSchema = external_exports.object({
47412
47506
  status: external_exports.enum(["pending", "approved", "rejected", "expired"]).optional(),
47413
- limit: external_exports.coerce.number().int().min(1).max(100).default(20)
47507
+ limit: PageLimitSchema.default(20)
47414
47508
  }).strict();
47415
47509
  ListExecutionsSchema = external_exports.object({
47416
47510
  resourceStatus: external_exports.enum(["dev", "prod", "all"]).default("all")
@@ -47973,8 +48067,7 @@ var init_api_schemas2 = __esm({
47973
48067
  init_validation();
47974
48068
  NotificationCategorySchema = external_exports.enum(["info", "queue", "alert", "error", "system"]);
47975
48069
  GetNotificationsQuerySchema = external_exports.object({
47976
- limit: external_exports.coerce.number().int().min(1).max(100).default(50),
47977
- offset: external_exports.coerce.number().int().min(0).default(0)
48070
+ ...PaginationQuerySchema.shape
47978
48071
  });
47979
48072
  MarkAsReadParamsSchema = external_exports.object({
47980
48073
  id: UuidSchema
@@ -48133,8 +48226,7 @@ var init_api_schemas3 = __esm({
48133
48226
  endDate: external_exports.string().datetime().optional()
48134
48227
  }).strict();
48135
48228
  ListActivitiesQuerySchema = external_exports.object({
48136
- limit: external_exports.coerce.number().int().min(1).max(100).default(50),
48137
- offset: external_exports.coerce.number().int().min(0).default(0),
48229
+ ...PaginationQuerySchema.shape,
48138
48230
  activityType: ActivityTypeSchema.optional(),
48139
48231
  entityType: external_exports.string().max(100).optional(),
48140
48232
  entityId: external_exports.string().max(255).optional(),
@@ -48452,6 +48544,9 @@ function getLeadGenCrmHandoffResourceIds(model) {
48452
48544
  (resource) => resource.systemPath === LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath && resource.ontology?.usesCatalogs?.includes(CRM_PIPELINE_CATALOG_ONTOLOGY_ID) === true
48453
48545
  ).map((resource) => resource.id);
48454
48546
  }
48547
+ function isLeadGenCrmHandoffAdopted(model) {
48548
+ return getSystem(model, LEAD_GEN_API_INTERFACE.systemPath)?.apiInterface !== void 0 && getSystem(model, CRM_API_INTERFACE.systemPath)?.apiInterface !== void 0;
48549
+ }
48455
48550
  function mergeLeadGenDerivedCatalogs(model) {
48456
48551
  const baseCatalogTypes = model.ontology?.catalogTypes ?? {};
48457
48552
  const derivedCatalogTypes = {};
@@ -48482,6 +48577,7 @@ var init_ontology_validation = __esm({
48482
48577
  init_ontology();
48483
48578
  init_systems();
48484
48579
  init_migration_helpers();
48580
+ init_helpers();
48485
48581
  init_engine();
48486
48582
  LEAD_GEN_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[0];
48487
48583
  CRM_API_INTERFACE = SYSTEM_INTERFACE_PROFILES[1];
@@ -48563,11 +48659,14 @@ var init_ontology_validation = __esm({
48563
48659
  registerReadinessInterfaceMarker(
48564
48660
  LEAD_GEN_CRM_HANDOFF_INTERFACE.systemPath,
48565
48661
  LEAD_GEN_CRM_HANDOFF_INTERFACE.interfaceKey,
48566
- (model) => ({
48567
- lifecycle: "active",
48568
- readinessProfile: LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile,
48569
- resourceIds: getLeadGenCrmHandoffResourceIds(model)
48570
- })
48662
+ (model) => {
48663
+ if (!isLeadGenCrmHandoffAdopted(model)) return void 0;
48664
+ return {
48665
+ lifecycle: "active",
48666
+ readinessProfile: LEAD_GEN_CRM_HANDOFF_INTERFACE.readinessProfile,
48667
+ resourceIds: getLeadGenCrmHandoffResourceIds(model)
48668
+ };
48669
+ }
48571
48670
  );
48572
48671
  }
48573
48672
  });
@@ -48604,8 +48703,7 @@ var init_api_schemas4 = __esm({
48604
48703
  status: ClientStatusSchema.optional(),
48605
48704
  source: ClientSourceSchema.optional(),
48606
48705
  search: external_exports.string().trim().min(1).max(255).optional(),
48607
- limit: external_exports.coerce.number().int().min(1).max(100).default(50),
48608
- offset: external_exports.coerce.number().int().min(0).default(0)
48706
+ ...PaginationQuerySchema.shape
48609
48707
  }).strict();
48610
48708
  ClientRefSchema = external_exports.object({
48611
48709
  id: external_exports.string(),
@@ -49001,8 +49099,7 @@ var init_index = __esm({
49001
49099
  init_types();
49002
49100
  init_config();
49003
49101
  init_define_contract();
49004
- init_define_step();
49005
- init_define_workflow();
49102
+ init_define_single_step_workflow();
49006
49103
  init_contract_ref();
49007
49104
  init_utils();
49008
49105
  init_runtime();
@@ -49035,6 +49132,12 @@ function resolveApiKey(prod) {
49035
49132
  function isProdApiUrl(apiUrl) {
49036
49133
  return !apiUrl.includes("localhost");
49037
49134
  }
49135
+ function withTarget(command, options = {}) {
49136
+ return command.option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", options.apiUrlDescription ?? "API base URL");
49137
+ }
49138
+ function printJson(value) {
49139
+ console.log(JSON.stringify(value, null, 2));
49140
+ }
49038
49141
  function resolveApiKeyForUrl(apiUrl) {
49039
49142
  return resolveApiKey(isProdApiUrl(apiUrl));
49040
49143
  }
@@ -49273,7 +49376,12 @@ async function request(method, endpoint, apiUrl, body) {
49273
49376
  if (GATEWAY_STATUSES.has(response.status)) {
49274
49377
  throw new Error(describeGatewayFailure(response.status, endpoint, elapsedMs));
49275
49378
  }
49276
- throw new Error(`API request failed (${response.status}): ${errorText}`);
49379
+ const envelope = parseAPIErrorEnvelope(errorText);
49380
+ if (envelope) {
49381
+ throw new Error(describeAPIError(response.status, envelope, { endpoint }));
49382
+ }
49383
+ throw new Error(`API request failed (${response.status}): ${errorText}
49384
+ Endpoint: ${endpoint}`);
49277
49385
  }
49278
49386
  if (response.status === 204) {
49279
49387
  return {};
@@ -49296,6 +49404,7 @@ var DEFAULT_TIMEOUT_MS, GATEWAY_STATUSES;
49296
49404
  var init_api_client = __esm({
49297
49405
  "src/cli/api-client.ts"() {
49298
49406
  "use strict";
49407
+ init_src();
49299
49408
  init_config2();
49300
49409
  init_readiness_failure();
49301
49410
  DEFAULT_TIMEOUT_MS = 2 * 60 * 60 * 1e3;
@@ -49308,7 +49417,7 @@ function wrapAction(commandName, fn) {
49308
49417
  return async (...args) => {
49309
49418
  try {
49310
49419
  await fn(...args);
49311
- process.exitCode = 0;
49420
+ process.exitCode ??= 0;
49312
49421
  } catch (error46) {
49313
49422
  const errorMessage = error46 instanceof Error ? error46.message : String(error46);
49314
49423
  console.error(source_default.red("\nError:"), errorMessage);
@@ -49330,7 +49439,7 @@ var init_package = __esm({
49330
49439
  "package.json"() {
49331
49440
  package_default = {
49332
49441
  name: "@elevasis/sdk",
49333
- version: "1.52.1",
49442
+ version: "1.54.0",
49334
49443
  description: "SDK for building Elevasis organization resources",
49335
49444
  type: "module",
49336
49445
  bin: {
@@ -49369,14 +49478,14 @@ var init_package = __esm({
49369
49478
  scripts: {
49370
49479
  lint: "eslint src --max-warnings 0",
49371
49480
  build: `node -e "require('fs').rmSync('dist',{recursive:true,force:true})" && tsc -p tsconfig.core-dts.json && tsc -p tsconfig.build.json && tsup && rollup -c rollup.dts.config.mjs && esbuild src/cli/index.ts --bundle --platform=node --outfile=dist/cli.cjs --format=cjs --external:esbuild --banner:js="#!/usr/bin/env node" && node scripts/verify-skill-coverage.mjs && node scripts/copy-reference-docs.mjs && node ../../scripts/monorepo/generate-reference-artifacts.js`,
49372
- "type-check": "tsc --noEmit",
49373
- "check-types": "pnpm type-check",
49481
+ "check-types": "tsc --noEmit",
49374
49482
  test: "pnpm test:bundle",
49375
49483
  "test:source": "vitest run --config vitest.config.ts",
49376
49484
  "test:dist": "pnpm build && node ../../scripts/monorepo/validate-reference-artifacts.js && vitest run --config vitest.bundle.config.ts",
49377
49485
  "test:bundle": "pnpm test:source && pnpm test:dist"
49378
49486
  },
49379
49487
  dependencies: {
49488
+ "@alcyone-labs/zod-to-json-schema": "^4.0.10",
49380
49489
  "@mdx-js/mdx": "^3.1.1",
49381
49490
  esbuild: "^0.25.0",
49382
49491
  "remark-gfm": "^4.0.1"
@@ -49397,8 +49506,7 @@ var init_package = __esm({
49397
49506
  "@types/node": "^22.0.0",
49398
49507
  chalk: "^5.3.0",
49399
49508
  commander: "^11.0.0",
49400
- dotenv: "^16.0.0",
49401
- "gray-matter": "^4.0.3",
49509
+ dotenv: "^17.2.3",
49402
49510
  ora: "^7.0.1",
49403
49511
  rollup: "^4.59.0",
49404
49512
  "rollup-plugin-dts": "^6.3.0",
@@ -49406,6 +49514,15 @@ var init_package = __esm({
49406
49514
  typescript: "5.9.2",
49407
49515
  vitest: "^3.2.4",
49408
49516
  zod: "^4.1.0"
49517
+ },
49518
+ license: "MIT",
49519
+ engines: {
49520
+ node: ">=22"
49521
+ },
49522
+ repository: {
49523
+ type: "git",
49524
+ url: "git+https://github.com/Elevasis/elevasis-monorepo.git",
49525
+ directory: "packages/sdk"
49409
49526
  }
49410
49527
  };
49411
49528
  }
@@ -51157,12 +51274,7 @@ function formatRuntimeArguments(args) {
51157
51274
  }).join(" ");
51158
51275
  }
51159
51276
  function renderCliCatalogMarkdown(catalog) {
51160
- const lines = [
51161
- "# elevasis-sdk CLI Catalog",
51162
- "",
51163
- `Source: \`${catalog.sourceRoot}\``,
51164
- ""
51165
- ];
51277
+ const lines = ["# elevasis-sdk CLI Catalog", "", `Source: \`${catalog.sourceRoot}\``, ""];
51166
51278
  if (catalog.domains.length === 0) {
51167
51279
  lines.push("No commands found.");
51168
51280
  return lines.join("\n");
@@ -51467,11 +51579,11 @@ async function pollForCompletion(resourceId, executionId, apiUrl) {
51467
51579
  }
51468
51580
  }
51469
51581
  function registerExecCommand(program3) {
51470
- program3.command("exec <resourceId>").description(`Execute a deployed resource
51582
+ withTarget(program3.command("exec <resourceId>").description(`Execute a deployed resource
51471
51583
  Example: elevasis-sdk exec my-workflow -i '{"key":"value"}'`).option("-i, --input <json>", "Input data as JSON string").option(
51472
51584
  "-f, --input-file <path>",
51473
51585
  "Read input from a JSON file (avoids shell escaping issues). Relative paths resolve against the project root."
51474
- ).option("--async", "Execute asynchronously with polling").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").option(
51586
+ ).option("--async", "Execute asynchronously with polling"), { apiUrlDescription: "API URL" }).option(
51475
51587
  "--cleanup-input",
51476
51588
  "Delete the input file after a successful execution (only files under <projectRoot>/tmp/ are eligible; files outside tmp/ produce a warning and are left untouched)"
51477
51589
  ).action(
@@ -51569,7 +51681,7 @@ function getResourceType(resource) {
51569
51681
  return resource.type ?? resource.resourceType;
51570
51682
  }
51571
51683
  function registerResourcesCommand(program3) {
51572
- program3.command("resources").description("List deployed resources for your organization").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(wrapAction("resources", async (options) => {
51684
+ withTarget(program3.command("resources").description("List deployed resources for your organization"), { apiUrlDescription: "API URL" }).option("--json", "Output as JSON").action(wrapAction("resources", async (options) => {
51573
51685
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
51574
51686
  const spinner = ora("Fetching resources...").start();
51575
51687
  const data = await apiGet(
@@ -51620,7 +51732,7 @@ init_api_client();
51620
51732
  init_config2();
51621
51733
  init_wrap_action();
51622
51734
  function registerExecutionsCommand(program3) {
51623
- program3.command("executions <resourceId>").description("List execution history for a resource\n Example: elevasis-sdk executions my-workflow --limit 10").option("--prod", "Target production (overrides NODE_ENV=development)").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) => {
51735
+ withTarget(program3.command("executions <resourceId>").description("List execution history for a resource\n Example: elevasis-sdk executions my-workflow --limit 10"), { apiUrlDescription: "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) => {
51624
51736
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
51625
51737
  const spinner = ora(`Fetching executions for ${resourceId}...`).start();
51626
51738
  const params = new URLSearchParams();
@@ -51683,7 +51795,7 @@ init_api_client();
51683
51795
  init_config2();
51684
51796
  init_wrap_action();
51685
51797
  function registerExecutionCommand(program3) {
51686
- 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("--prod", "Target production (overrides NODE_ENV=development)").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) => {
51798
+ withTarget(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"), { apiUrlDescription: "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) => {
51687
51799
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
51688
51800
  const spinner = ora("Fetching execution details...").start();
51689
51801
  const execution = await apiGet(
@@ -51790,9 +51902,9 @@ init_api_client();
51790
51902
  init_config2();
51791
51903
  init_wrap_action();
51792
51904
  function registerExecutionCancelCommand(program3) {
51793
- program3.command("execution:cancel <resourceId> <executionId>").description(
51905
+ withTarget(program3.command("execution:cancel <resourceId> <executionId>").description(
51794
51906
  "Cancel a running execution\n Example: elevasis-sdk execution:cancel my-workflow 9c47c944-67eb-4c84-98cb-bb951d05ede3"
51795
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output raw JSON response").action(
51907
+ )).option("--json", "Output raw JSON response").action(
51796
51908
  wrapAction("execution:cancel", async (resourceId, executionId, options) => {
51797
51909
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
51798
51910
  const spinner = options.json ? void 0 : ora("Cancelling execution...").start();
@@ -51833,9 +51945,9 @@ init_api_client();
51833
51945
  init_config2();
51834
51946
  init_wrap_action();
51835
51947
  function registerExecutionsDeleteCommand(program3) {
51836
- program3.command("executions:delete <resourceId>").description(
51948
+ withTarget(program3.command("executions:delete <resourceId>").description(
51837
51949
  "Delete a resource\u2019s execution history (destructive)\n Example: elevasis-sdk executions:delete my-workflow --force"
51838
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--resource-status <status>", "Only delete runs from this deployment lane (dev|prod)").option("--force", "Skip the typed confirmation prompt").option("--json", "Output raw JSON response").action(
51950
+ )).option("--resource-status <status>", "Only delete runs from this deployment lane (dev|prod)").option("--force", "Skip the typed confirmation prompt").option("--json", "Output raw JSON response").action(
51839
51951
  wrapAction("executions:delete", async (resourceId, options) => {
51840
51952
  if (options.resourceStatus && options.resourceStatus !== "dev" && options.resourceStatus !== "prod") {
51841
51953
  throw new Error('--resource-status must be "dev" or "prod"');
@@ -51883,7 +51995,7 @@ init_api_client();
51883
51995
  init_config2();
51884
51996
  init_wrap_action();
51885
51997
  function registerDeploymentsCommand(program3) {
51886
- program3.command("deployments").description("List deployments for your organization").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(wrapAction("deployments", async (options) => {
51998
+ withTarget(program3.command("deployments").description("List deployments for your organization"), { apiUrlDescription: "API URL" }).option("--json", "Output as JSON").action(wrapAction("deployments", async (options) => {
51887
51999
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
51888
52000
  const spinner = ora("Fetching deployments...").start();
51889
52001
  const data = await apiGet(
@@ -51967,7 +52079,7 @@ function formatJsonSchema(schema, indent = 2) {
51967
52079
  return JSON.stringify(schema, null, 2);
51968
52080
  }
51969
52081
  function registerDescribeCommand(program3) {
51970
- program3.command("describe <resourceId>").description("Show resource definition (metadata + schemas)\n Example: elevasis-sdk describe my-workflow").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").option("--json", "Output raw JSON response").action(
52082
+ withTarget(program3.command("describe <resourceId>").description("Show resource definition (metadata + schemas)\n Example: elevasis-sdk describe my-workflow"), { apiUrlDescription: "API URL" }).option("--json", "Output raw JSON response").action(
51971
52083
  wrapAction("describe", async (resourceId, options) => {
51972
52084
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
51973
52085
  const spinner = ora("Fetching resource definition...").start();
@@ -52228,27 +52340,27 @@ Credential '${name}' deleted successfully.`));
52228
52340
  // src/cli/commands/creds/creds.ts
52229
52341
  function registerCredsCommand(program3) {
52230
52342
  const creds = program3.command("creds").description("Manage organization credentials");
52231
- creds.command("list").description("List all credentials (metadata only, no secrets)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(
52343
+ withTarget(creds.command("list").description("List all credentials (metadata only, no secrets)"), { apiUrlDescription: "API URL" }).option("--json", "Output as JSON").action(
52232
52344
  wrapAction("creds list", async (options) => {
52233
52345
  await listCreds(resolveApiUrl(options.apiUrl, options.prod), options.json);
52234
52346
  })
52235
52347
  );
52236
- creds.command("create").description("Create a new credential").requiredOption("--name <name>", "Credential name (lowercase, digits, hyphens)").requiredOption("--type <type>", "Credential type (api-key, webhook-secret, api-key-secret, clickup, instagram)").option("--value <json>", "Credential value as JSON string (or @json:<path> to read it from a file)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52348
+ withTarget(creds.command("create").description("Create a new credential").requiredOption("--name <name>", "Credential name (lowercase, digits, hyphens)").requiredOption("--type <type>", "Credential type (api-key, webhook-secret, api-key-secret, clickup, instagram)").option("--value <json>", "Credential value as JSON string (or @json:<path> to read it from a file)"), { apiUrlDescription: "API URL" }).action(
52237
52349
  wrapAction("creds create", async (options) => {
52238
52350
  await createCreds(resolveApiUrl(options.apiUrl, options.prod), options.name, options.type, options.value);
52239
52351
  })
52240
52352
  );
52241
- creds.command("update <name>").description("Update a credential value").requiredOption("--value <json>", "New credential value as JSON string (or @json:<path> to read it from a file)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52353
+ withTarget(creds.command("update <name>").description("Update a credential value").requiredOption("--value <json>", "New credential value as JSON string (or @json:<path> to read it from a file)"), { apiUrlDescription: "API URL" }).action(
52242
52354
  wrapAction("creds update", async (name, options) => {
52243
52355
  await updateCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.value);
52244
52356
  })
52245
52357
  );
52246
- creds.command("rename <name>").description("Rename a credential").requiredOption("--to <newName>", "New credential name").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52358
+ withTarget(creds.command("rename <name>").description("Rename a credential").requiredOption("--to <newName>", "New credential name"), { apiUrlDescription: "API URL" }).action(
52247
52359
  wrapAction("creds rename", async (name, options) => {
52248
52360
  await renameCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.to);
52249
52361
  })
52250
52362
  );
52251
- creds.command("delete <name>").description("Delete a credential").option("--force", "Skip confirmation prompt").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52363
+ withTarget(creds.command("delete <name>").description("Delete a credential").option("--force", "Skip confirmation prompt"), { apiUrlDescription: "API URL" }).action(
52252
52364
  wrapAction("creds delete", async (name, options) => {
52253
52365
  await deleteCreds(resolveApiUrl(options.apiUrl, options.prod), name, options.force);
52254
52366
  })
@@ -52285,12 +52397,12 @@ ${result.count} error(s) resolved for execution '${executionId}'.`));
52285
52397
  // src/cli/commands/error/error.ts
52286
52398
  function registerErrorCommand(program3) {
52287
52399
  const error46 = program3.command("error").description("Manage execution errors");
52288
- error46.command("resolve <errorId>").description("Mark a specific execution error as resolved").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52400
+ withTarget(error46.command("resolve <errorId>").description("Mark a specific execution error as resolved"), { apiUrlDescription: "API URL" }).action(
52289
52401
  wrapAction("error resolve", async (errorId, options) => {
52290
52402
  await resolveError(resolveApiUrl(options.apiUrl, options.prod), errorId);
52291
52403
  })
52292
52404
  );
52293
- error46.command("resolve-execution <executionId>").description("Mark all errors for an execution as resolved").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
52405
+ withTarget(error46.command("resolve-execution <executionId>").description("Mark all errors for an execution as resolved"), { apiUrlDescription: "API URL" }).action(
52294
52406
  wrapAction("error resolve-execution", async (executionId, options) => {
52295
52407
  await resolveErrorsByExecution(resolveApiUrl(options.apiUrl, options.prod), executionId);
52296
52408
  })
@@ -52304,7 +52416,7 @@ init_api_client();
52304
52416
  init_config2();
52305
52417
  init_wrap_action();
52306
52418
  function registerRenameCommand(program3) {
52307
- 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(
52419
+ withTarget(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)"), { apiUrlDescription: "API URL" }).action(
52308
52420
  wrapAction("rename", async (oldResourceId, options) => {
52309
52421
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
52310
52422
  const dryRun = !options.execute;
@@ -52634,9 +52746,6 @@ async function resolveClient(query, apiUrl) {
52634
52746
  }
52635
52747
  throw new Error(`Multiple clients matched "${trimmedQuery}": ${formatClientCandidates(clients)}`);
52636
52748
  }
52637
- function printJson(value) {
52638
- console.log(JSON.stringify(value, null, 2));
52639
- }
52640
52749
  function appendQuery(params, key, value) {
52641
52750
  if (value === void 0 || value === null || value === "") return;
52642
52751
  params.set(key, String(value));
@@ -52646,7 +52755,7 @@ function endpointWithQuery(endpoint, params) {
52646
52755
  return query ? `${endpoint}?${query}` : endpoint;
52647
52756
  }
52648
52757
  function registerClientList(program3) {
52649
- program3.command("client:list").description("List clients\n Example: elevasis-sdk client:list --status active").option("--status <status>", "Filter by status: active | onboarding | paused | completed | churned").option("--search <query>", "Search by client name").option("--limit <limit>", "Maximum number of clients to return").option("--offset <offset>", "Number of clients to skip").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
52758
+ withTarget(program3.command("client:list").description("List clients\n Example: elevasis-sdk client:list --status active").option("--status <status>", "Filter by status: active | onboarding | paused | completed | churned").option("--search <query>", "Search by client name").option("--limit <limit>", "Maximum number of clients to return").option("--offset <offset>", "Number of clients to skip")).option("--pretty", "Render human-readable output instead of raw JSON").action(
52650
52759
  wrapAction(
52651
52760
  "client:list",
52652
52761
  async (options) => {
@@ -52679,7 +52788,7 @@ Clients (${result.data.length} of ${result.total}):
52679
52788
  );
52680
52789
  }
52681
52790
  function registerClientGet(program3) {
52682
- program3.command("client:get <id>").description("Get a client by ID\n Example: elevasis-sdk client:get <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
52791
+ withTarget(program3.command("client:get <id>").description("Get a client by ID\n Example: elevasis-sdk client:get <uuid>")).option("--pretty", "Render human-readable output instead of raw JSON").action(
52683
52792
  wrapAction("client:get", async (id, options) => {
52684
52793
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
52685
52794
  const result = await apiGet(`/api/external/clients/${id}`, apiUrl);
@@ -52698,7 +52807,7 @@ Client: ${result.name}`));
52698
52807
  );
52699
52808
  }
52700
52809
  function registerClientStatus(program3) {
52701
- program3.command("client:status").description("Show client portfolio status").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
52810
+ withTarget(program3.command("client:status").description("Show client portfolio status")).option("--pretty", "Render human-readable output instead of raw JSON").action(
52702
52811
  wrapAction("client:status", async (options) => {
52703
52812
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
52704
52813
  const result = await apiGet("/api/external/clients/status", apiUrl);
@@ -52723,9 +52832,9 @@ function registerClientStatus(program3) {
52723
52832
  );
52724
52833
  }
52725
52834
  function registerClientResolve(program3) {
52726
- program3.command("client:resolve <query>").description(
52835
+ withTarget(program3.command("client:resolve <query>").description(
52727
52836
  'Resolve a client ID from a name, UUID, or search query\n Example: elevasis-sdk client:resolve "Acme"'
52728
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render client details instead of only the resolved ID").action(
52837
+ )).option("--pretty", "Render client details instead of only the resolved ID").action(
52729
52838
  wrapAction("client:resolve", async (query, options) => {
52730
52839
  const client = await resolveClient(query, resolveApiUrl(options.apiUrl, options.prod));
52731
52840
  if (options.pretty) {
@@ -52742,11 +52851,10 @@ Resolved client: ${client.name}`));
52742
52851
  }
52743
52852
 
52744
52853
  // src/cli/commands/project/projects.ts
52745
- function printJson2(value) {
52746
- console.log(JSON.stringify(value, null, 2));
52747
- }
52748
52854
  function registerProjectList(program3) {
52749
- program3.command("project:list").description("List projects\n Example: elevasis-sdk project:list --search alpha").option("--kind <kind>", "Filter by kind: client_engagement | internal | research | other").option("--status <status>", "Filter by status: active | on_track | at_risk | blocked | completed | paused").option("--search <query>", "Search by project name or description").option("--client <id-or-name>", "Filter by client hub record (UUID or fuzzy name)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
52855
+ withTarget(
52856
+ program3.command("project:list").description("List projects\n Example: elevasis-sdk project:list --search alpha").option("--kind <kind>", "Filter by kind: client_engagement | internal | research | other").option("--status <status>", "Filter by status: active | on_track | at_risk | blocked | completed | paused").option("--search <query>", "Search by project name or description").option("--client <id-or-name>", "Filter by client hub record (UUID or fuzzy name)")
52857
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
52750
52858
  wrapAction(
52751
52859
  "project:list",
52752
52860
  async (options) => {
@@ -52764,10 +52872,6 @@ function registerProjectList(program3) {
52764
52872
  const qs = params.toString();
52765
52873
  const endpoint = `/api/external/projects${qs ? `?${qs}` : ""}`;
52766
52874
  const result = await apiGet(endpoint, apiUrl);
52767
- if (options.json) {
52768
- printJson2(result);
52769
- return;
52770
- }
52771
52875
  if (options.pretty) {
52772
52876
  const projects = result.projects;
52773
52877
  if (projects.length === 0) {
@@ -52791,13 +52895,15 @@ Projects (${projects.length}):
52791
52895
  );
52792
52896
  }
52793
52897
  function registerProjectResolve(program3) {
52794
- program3.command("project:resolve <query>").description(
52795
- 'Resolve a project ID from a name, UUID, or search query\n Example: elevasis-sdk project:resolve "Alpha"'
52796
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render project details instead of only the resolved ID").option("--json", "Output as JSON").action(
52898
+ withTarget(
52899
+ program3.command("project:resolve <query>").description(
52900
+ 'Resolve a project ID from a name, UUID, or search query\n Example: elevasis-sdk project:resolve "Alpha"'
52901
+ )
52902
+ ).option("--pretty", "Render project details instead of only the resolved ID").option("--json", "Output as JSON").action(
52797
52903
  wrapAction("project:resolve", async (query, options) => {
52798
52904
  const project = await resolveProject(query, resolveApiUrl(options.apiUrl, options.prod));
52799
52905
  if (options.json) {
52800
- printJson2(project);
52906
+ printJson(project);
52801
52907
  return;
52802
52908
  }
52803
52909
  if (options.pretty) {
@@ -52815,9 +52921,11 @@ Resolved project: ${project.name}`));
52815
52921
  );
52816
52922
  }
52817
52923
  function registerProjectWork(program3) {
52818
- program3.command("project:work <query>").alias("project:open").description(
52819
- 'Resolve a project and print a lifecycle-aware work brief\n Example: elevasis-sdk project:work "Alpha"'
52820
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Render the structured work brief as JSON").action(
52924
+ withTarget(
52925
+ program3.command("project:work <query>").alias("project:open").description(
52926
+ 'Resolve a project and print a lifecycle-aware work brief\n Example: elevasis-sdk project:work "Alpha"'
52927
+ )
52928
+ ).option("--json", "Render the structured work brief as JSON").action(
52821
52929
  wrapAction("project:work", async (query, options) => {
52822
52930
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
52823
52931
  const resolved = await resolveProject(query, apiUrl);
@@ -52837,14 +52945,12 @@ ${renderProjectWorkBrief(brief)}
52837
52945
  );
52838
52946
  }
52839
52947
  function registerProjectGet(program3) {
52840
- program3.command("project:get <id>").description("Get a project by ID\n Example: elevasis-sdk project:get <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
52948
+ withTarget(
52949
+ program3.command("project:get <id>").description("Get a project by ID\n Example: elevasis-sdk project:get <uuid>")
52950
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
52841
52951
  wrapAction("project:get", async (id, options) => {
52842
52952
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
52843
52953
  const result = await apiGet(`/api/external/projects/${id}`, apiUrl);
52844
- if (options.json) {
52845
- printJson2(result);
52846
- return;
52847
- }
52848
52954
  if (options.pretty) {
52849
52955
  const p = result.project;
52850
52956
  console.log(source_default.cyan(`
@@ -52861,7 +52967,9 @@ Project: ${p.name}`));
52861
52967
  );
52862
52968
  }
52863
52969
  function registerProjectCreate(program3) {
52864
- program3.command("project:create").description('Create a new project\n Example: elevasis-sdk project:create --name "My Project" --kind internal').requiredOption("--name <name>", "Project name").requiredOption("--kind <kind>", "Project kind: client_engagement | internal | research | other").option("--status <status>", "Project status: active | on_track | at_risk | blocked | completed | paused").option("--description <description>", "Project description").option("--deal-id <uuid>", "Link to a deal (UUID)").option("--client <id-or-name>", "Link to a client hub record (UUID or fuzzy name)").option("--client-company-id <uuid>", "Link to a client company (UUID)").option("--start-date <date>", "Start date (ISO 8601, e.g. 2026-06-01)").option("--target-end-date <date>", "Target end date (ISO 8601, e.g. 2026-12-31)").option("--contract-value <amount>", "Contract value (number)", parseFloat).option("--metadata <json>", "Arbitrary metadata (JSON string)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
52970
+ withTarget(
52971
+ program3.command("project:create").description('Create a new project\n Example: elevasis-sdk project:create --name "My Project" --kind internal').requiredOption("--name <name>", "Project name").requiredOption("--kind <kind>", "Project kind: client_engagement | internal | research | other").option("--status <status>", "Project status: active | on_track | at_risk | blocked | completed | paused").option("--description <description>", "Project description").option("--deal-id <uuid>", "Link to a deal (UUID)").option("--client <id-or-name>", "Link to a client hub record (UUID or fuzzy name)").option("--client-company-id <uuid>", "Link to a client company (UUID)").option("--start-date <date>", "Start date (ISO 8601, e.g. 2026-06-01)").option("--target-end-date <date>", "Target end date (ISO 8601, e.g. 2026-12-31)").option("--contract-value <amount>", "Contract value (number)", parseFloat).option("--metadata <json>", "Arbitrary metadata (JSON string)")
52972
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
52865
52973
  wrapAction(
52866
52974
  "project:create",
52867
52975
  async (options) => {
@@ -52885,10 +52993,6 @@ function registerProjectCreate(program3) {
52885
52993
  if (options.contractValue !== void 0) body.contract_value = options.contractValue;
52886
52994
  if (options.metadata) body.metadata = JSON.parse(options.metadata);
52887
52995
  const result = await apiPost("/api/external/projects", body, apiUrl);
52888
- if (options.json) {
52889
- printJson2(result);
52890
- return;
52891
- }
52892
52996
  if (options.pretty) {
52893
52997
  const p = result.project;
52894
52998
  console.log(source_default.green(`
@@ -52905,7 +53009,9 @@ Project created: ${p.name}`));
52905
53009
  );
52906
53010
  }
52907
53011
  function registerProjectUpdate(program3) {
52908
- program3.command("project:update <id>").description("Update a project\n Example: elevasis-sdk project:update <uuid> --status completed").option("--name <name>", "New project name").option("--status <status>", "New status: active | on_track | at_risk | blocked | completed | paused").option("--description <description>", "New description").option("--deal-id <uuid>", "Link to a deal (UUID)").option("--client <id-or-name>", "Link to a client hub record (UUID or fuzzy name)").option("--clear-client", "Remove the client hub link (sets client_id to null)").option("--client-company-id <uuid>", "Link to a client company (UUID)").option("--start-date <date>", "Start date (ISO 8601, e.g. 2026-06-01)").option("--target-end-date <date>", "Target end date (ISO 8601, e.g. 2026-12-31)").option("--actual-end-date <date>", "Actual end date (ISO 8601)").option("--contract-value <amount>", "Contract value (number)", parseFloat).option("--metadata <json>", "Arbitrary metadata (JSON string)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53012
+ withTarget(
53013
+ program3.command("project:update <id>").description("Update a project\n Example: elevasis-sdk project:update <uuid> --status completed").option("--name <name>", "New project name").option("--status <status>", "New status: active | on_track | at_risk | blocked | completed | paused").option("--description <description>", "New description").option("--deal-id <uuid>", "Link to a deal (UUID)").option("--client <id-or-name>", "Link to a client hub record (UUID or fuzzy name)").option("--clear-client", "Remove the client hub link (sets client_id to null)").option("--client-company-id <uuid>", "Link to a client company (UUID)").option("--start-date <date>", "Start date (ISO 8601, e.g. 2026-06-01)").option("--target-end-date <date>", "Target end date (ISO 8601, e.g. 2026-12-31)").option("--actual-end-date <date>", "Actual end date (ISO 8601)").option("--contract-value <amount>", "Contract value (number)", parseFloat).option("--metadata <json>", "Arbitrary metadata (JSON string)")
53014
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
52909
53015
  wrapAction(
52910
53016
  "project:update",
52911
53017
  async (id, options) => {
@@ -52948,10 +53054,6 @@ function registerProjectUpdate(program3) {
52948
53054
  process.exit(1);
52949
53055
  }
52950
53056
  const result = await apiPatch(`/api/external/projects/${id}`, body, apiUrl);
52951
- if (options.json) {
52952
- printJson2(result);
52953
- return;
52954
- }
52955
53057
  if (options.pretty) {
52956
53058
  const p = result.project;
52957
53059
  console.log(source_default.green(`
@@ -52966,14 +53068,12 @@ Project updated: ${p.name}`));
52966
53068
  );
52967
53069
  }
52968
53070
  function registerProjectDelete(program3) {
52969
- program3.command("project:delete <id>").description("Delete a project\n Example: elevasis-sdk project:delete <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53071
+ withTarget(
53072
+ program3.command("project:delete <id>").description("Delete a project\n Example: elevasis-sdk project:delete <uuid>")
53073
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
52970
53074
  wrapAction("project:delete", async (id, options) => {
52971
53075
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
52972
53076
  const result = await apiDelete(`/api/external/projects/${id}`, apiUrl);
52973
- if (options.json) {
52974
- printJson2(result);
52975
- return;
52976
- }
52977
53077
  if (options.pretty) {
52978
53078
  console.log(source_default.green(`
52979
53079
  Project ${id} deleted.`));
@@ -52991,9 +53091,6 @@ init_source();
52991
53091
  init_wrap_action();
52992
53092
  init_config2();
52993
53093
  init_api_client();
52994
- function printJson3(value) {
52995
- console.log(JSON.stringify(value, null, 2));
52996
- }
52997
53094
  function parseSequenceOption(value) {
52998
53095
  const parsed = Number(value);
52999
53096
  if (!Number.isInteger(parsed) || parsed < 0) {
@@ -53024,14 +53121,12 @@ function parseChecklistOption(options) {
53024
53121
  }
53025
53122
  }
53026
53123
  function registerMilestoneList(program3) {
53027
- 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("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53124
+ withTarget(
53125
+ 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)")
53126
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53028
53127
  wrapAction("project:milestone:list", async (options) => {
53029
53128
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53030
53129
  const result = await apiGet(`/api/external/projects/${options.project}/milestones`, apiUrl);
53031
- if (options.json) {
53032
- printJson3(result);
53033
- return;
53034
- }
53035
53130
  if (options.pretty) {
53036
53131
  const milestones = result.milestones;
53037
53132
  if (milestones.length === 0) {
@@ -53054,9 +53149,11 @@ Milestones (${milestones.length}):
53054
53149
  );
53055
53150
  }
53056
53151
  function registerMilestoneCreate(program3) {
53057
- program3.command("project:milestone:create").description(
53058
- 'Create a milestone\n Example: elevasis-sdk project:milestone:create --project <uuid> --name "Phase 1"'
53059
- ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--name <name>", "Milestone name").option("--status <status>", "Status: upcoming | in_progress | completed | overdue | blocked").option("--due-date <date>", "Due date (ISO 8601, e.g. 2026-06-01)").option("--sequence <n>", "Display order within the project (non-negative integer)", parseSequenceOption).option("--description <description>", "Milestone description").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53152
+ withTarget(
53153
+ program3.command("project:milestone:create").description(
53154
+ 'Create a milestone\n Example: elevasis-sdk project:milestone:create --project <uuid> --name "Phase 1"'
53155
+ ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--name <name>", "Milestone name").option("--status <status>", "Status: upcoming | in_progress | completed | overdue | blocked").option("--due-date <date>", "Due date (ISO 8601, e.g. 2026-06-01)").option("--sequence <n>", "Display order within the project (non-negative integer)", parseSequenceOption).option("--description <description>", "Milestone description")
53156
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53060
53157
  wrapAction(
53061
53158
  "project:milestone:create",
53062
53159
  async (options) => {
@@ -53071,10 +53168,6 @@ function registerMilestoneCreate(program3) {
53071
53168
  body,
53072
53169
  apiUrl
53073
53170
  );
53074
- if (options.json) {
53075
- printJson3(result);
53076
- return;
53077
- }
53078
53171
  if (options.pretty) {
53079
53172
  const m = result.milestone;
53080
53173
  console.log(source_default.green(`
@@ -53091,10 +53184,12 @@ Milestone created: ${m.name}`));
53091
53184
  );
53092
53185
  }
53093
53186
  function registerMilestoneUpdate(program3) {
53094
- program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--description <description>", "New description").option("--due-date <date>", "New due date (ISO 8601)").option("--sequence <n>", "New display order within the project (non-negative integer)", parseSequenceOption).option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
53095
- "--checklist-file <path>",
53096
- "Read replacement checklist from a JSON file. Relative paths resolve against the project root."
53097
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53187
+ withTarget(
53188
+ program3.command("project:milestone:update <id>").description("Update a milestone\n Example: elevasis-sdk project:milestone:update <uuid> --status completed").option("--name <name>", "New milestone name").option("--status <status>", "New status: upcoming | in_progress | completed | overdue | blocked").option("--description <description>", "New description").option("--due-date <date>", "New due date (ISO 8601)").option("--sequence <n>", "New display order within the project (non-negative integer)", parseSequenceOption).option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
53189
+ "--checklist-file <path>",
53190
+ "Read replacement checklist from a JSON file. Relative paths resolve against the project root."
53191
+ )
53192
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53098
53193
  wrapAction(
53099
53194
  "project:milestone:update",
53100
53195
  async (id, options) => {
@@ -53117,10 +53212,6 @@ function registerMilestoneUpdate(program3) {
53117
53212
  }
53118
53213
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53119
53214
  const result = await apiPatch(`/api/external/milestones/${id}`, body, apiUrl);
53120
- if (options.json) {
53121
- printJson3(result);
53122
- return;
53123
- }
53124
53215
  if (options.pretty) {
53125
53216
  const m = result.milestone;
53126
53217
  console.log(source_default.green(`
@@ -53135,14 +53226,12 @@ Milestone updated: ${m.name}`));
53135
53226
  );
53136
53227
  }
53137
53228
  function registerMilestoneDelete(program3) {
53138
- program3.command("project:milestone:delete <id>").description("Delete a milestone\n Example: elevasis-sdk project:milestone:delete <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53229
+ withTarget(
53230
+ program3.command("project:milestone:delete <id>").description("Delete a milestone\n Example: elevasis-sdk project:milestone:delete <uuid>")
53231
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53139
53232
  wrapAction("project:milestone:delete", async (id, options) => {
53140
53233
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53141
53234
  const result = await apiDelete(`/api/external/milestones/${id}`, apiUrl);
53142
- if (options.json) {
53143
- printJson3(result);
53144
- return;
53145
- }
53146
53235
  if (options.pretty) {
53147
53236
  console.log(source_default.green(`
53148
53237
  Milestone ${id} deleted.`));
@@ -53160,9 +53249,6 @@ init_source();
53160
53249
  init_wrap_action();
53161
53250
  init_config2();
53162
53251
  init_api_client();
53163
- function printJson4(value) {
53164
- console.log(JSON.stringify(value, null, 2));
53165
- }
53166
53252
  function failConflictingFlags(message) {
53167
53253
  process.stderr.write(JSON.stringify({ error: message, code: "CONFLICTING_FLAGS" }) + "\n");
53168
53254
  process.exit(1);
@@ -53181,12 +53267,14 @@ function parseChecklistOption2(options) {
53181
53267
  }
53182
53268
  }
53183
53269
  function registerTaskList(program3) {
53184
- program3.command("project:task:list").description(
53185
- "List tasks for a project\n Example: elevasis-sdk project:task:list --project <uuid> --status in_progress"
53186
- ).requiredOption("--project <project-id>", "Project ID (UUID)").option(
53187
- "--status <status>",
53188
- "Filter by status: planned | in_progress | blocked | completed | cancelled | submitted | approved | rejected | revision_requested"
53189
- ).option("--milestone <milestone-id>", "Filter by milestone ID (UUID)").option("--parent <parent-task-id>", "Filter by parent task ID (UUID)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53270
+ withTarget(
53271
+ program3.command("project:task:list").description(
53272
+ "List tasks for a project\n Example: elevasis-sdk project:task:list --project <uuid> --status in_progress"
53273
+ ).requiredOption("--project <project-id>", "Project ID (UUID)").option(
53274
+ "--status <status>",
53275
+ "Filter by status: planned | in_progress | blocked | completed | cancelled | submitted | approved | rejected | revision_requested"
53276
+ ).option("--milestone <milestone-id>", "Filter by milestone ID (UUID)").option("--parent <parent-task-id>", "Filter by parent task ID (UUID)")
53277
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53190
53278
  wrapAction(
53191
53279
  "project:task:list",
53192
53280
  async (options) => {
@@ -53198,10 +53286,6 @@ function registerTaskList(program3) {
53198
53286
  const qs = params.toString();
53199
53287
  const endpoint = `/api/external/projects/${options.project}/tasks${qs ? `?${qs}` : ""}`;
53200
53288
  const result = await apiGet(endpoint, apiUrl);
53201
- if (options.json) {
53202
- printJson4(result);
53203
- return;
53204
- }
53205
53289
  if (options.pretty) {
53206
53290
  const tasks = result.tasks;
53207
53291
  if (tasks.length === 0) {
@@ -53225,14 +53309,12 @@ Tasks (${tasks.length}):
53225
53309
  );
53226
53310
  }
53227
53311
  function registerTaskGet(program3) {
53228
- program3.command("project:task:get <id>").description("Get a task by ID\n Example: elevasis-sdk project:task:get <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53312
+ withTarget(
53313
+ program3.command("project:task:get <id>").description("Get a task by ID\n Example: elevasis-sdk project:task:get <uuid>")
53314
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53229
53315
  wrapAction("project:task:get", async (id, options) => {
53230
53316
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53231
53317
  const result = await apiGet(`/api/external/project-tasks/${id}`, apiUrl);
53232
- if (options.json) {
53233
- printJson4(result);
53234
- return;
53235
- }
53236
53318
  if (options.pretty) {
53237
53319
  const t = result.task;
53238
53320
  console.log(source_default.cyan(`
@@ -53250,15 +53332,17 @@ Task: ${t.name}`));
53250
53332
  );
53251
53333
  }
53252
53334
  function registerTaskCreate(program3) {
53253
- program3.command("project:task:create").description(
53254
- 'Create a task\n Example: elevasis-sdk project:task:create --project <uuid> --title "Implement feature"'
53255
- ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--title <title>", "Task title / name").option("--status <status>", "Status: planned | in_progress | blocked | completed | cancelled").option(
53256
- "--type <type>",
53257
- "Type: documentation | code | report | design | refactor | feature | bug | research | other"
53258
- ).option("--milestone <milestone-id>", "Milestone ID (UUID)").option("--parent <parent-task-id>", "Parent task ID (UUID) for subtasks").option("--due-date <date>", "Due date (ISO 8601, e.g. 2026-06-01)").option("--description <description>", "Task description").option("--checklist <json>", `Checklist items as JSON array: '[{"id":"1","label":"Step","completed":false}]'`).option(
53259
- "--checklist-file <path>",
53260
- "Read checklist items from a JSON file. Relative paths resolve against the project root."
53261
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53335
+ withTarget(
53336
+ program3.command("project:task:create").description(
53337
+ 'Create a task\n Example: elevasis-sdk project:task:create --project <uuid> --title "Implement feature"'
53338
+ ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--title <title>", "Task title / name").option("--status <status>", "Status: planned | in_progress | blocked | completed | cancelled").option(
53339
+ "--type <type>",
53340
+ "Type: documentation | code | report | design | refactor | feature | bug | research | other"
53341
+ ).option("--milestone <milestone-id>", "Milestone ID (UUID)").option("--parent <parent-task-id>", "Parent task ID (UUID) for subtasks").option("--due-date <date>", "Due date (ISO 8601, e.g. 2026-06-01)").option("--description <description>", "Task description").option("--checklist <json>", `Checklist items as JSON array: '[{"id":"1","label":"Step","completed":false}]'`).option(
53342
+ "--checklist-file <path>",
53343
+ "Read checklist items from a JSON file. Relative paths resolve against the project root."
53344
+ )
53345
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53262
53346
  wrapAction(
53263
53347
  "project:task:create",
53264
53348
  async (options) => {
@@ -53283,10 +53367,6 @@ function registerTaskCreate(program3) {
53283
53367
  )
53284
53368
  );
53285
53369
  }
53286
- if (options.json) {
53287
- printJson4(result);
53288
- return;
53289
- }
53290
53370
  if (options.pretty) {
53291
53371
  const t = result.task;
53292
53372
  console.log(source_default.green(`
@@ -53302,16 +53382,18 @@ Task created: ${t.name}`));
53302
53382
  );
53303
53383
  }
53304
53384
  function registerTaskUpdate(program3) {
53305
- program3.command("project:task:update <id>").description("Update a task\n Example: elevasis-sdk project:task:update <uuid> --status completed").option("--title <title>", "New task title").option(
53306
- "--status <status>",
53307
- "New status: planned | in_progress | blocked | completed | cancelled | submitted | approved | rejected | revision_requested"
53308
- ).option(
53309
- "--type <type>",
53310
- "New type: documentation | code | report | design | refactor | feature | bug | research | other"
53311
- ).option("--milestone <milestone-id>", "New milestone ID (UUID)").option("--clear-milestone", "Detach from its milestone (sets milestone_id to null)").option("--parent <parent-task-id>", "New parent task ID (UUID) \u2014 re-parents this task as a subtask").option("--clear-parent", "Detach from its parent task (sets parent_task_id to null)").option("--due-date <date>", "New due date (ISO 8601, e.g. 2026-06-01)").option("--description <description>", "New description").option("--file-url <url>", "Link to a deliverable file").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
53312
- "--checklist-file <path>",
53313
- "Read replacement checklist from a JSON file. Relative paths resolve against the project root."
53314
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53385
+ withTarget(
53386
+ program3.command("project:task:update <id>").description("Update a task\n Example: elevasis-sdk project:task:update <uuid> --status completed").option("--title <title>", "New task title").option(
53387
+ "--status <status>",
53388
+ "New status: planned | in_progress | blocked | completed | cancelled | submitted | approved | rejected | revision_requested"
53389
+ ).option(
53390
+ "--type <type>",
53391
+ "New type: documentation | code | report | design | refactor | feature | bug | research | other"
53392
+ ).option("--milestone <milestone-id>", "New milestone ID (UUID)").option("--clear-milestone", "Detach from its milestone (sets milestone_id to null)").option("--parent <parent-task-id>", "New parent task ID (UUID) \u2014 re-parents this task as a subtask").option("--clear-parent", "Detach from its parent task (sets parent_task_id to null)").option("--due-date <date>", "New due date (ISO 8601, e.g. 2026-06-01)").option("--description <description>", "New description").option("--file-url <url>", "Link to a deliverable file").option("--checklist <json>", `Replace checklist (full array): '[{"id":"1","label":"Step","completed":false}]'`).option(
53393
+ "--checklist-file <path>",
53394
+ "Read replacement checklist from a JSON file. Relative paths resolve against the project root."
53395
+ )
53396
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53315
53397
  wrapAction(
53316
53398
  "project:task:update",
53317
53399
  async (id, options) => {
@@ -53345,10 +53427,6 @@ function registerTaskUpdate(program3) {
53345
53427
  }
53346
53428
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53347
53429
  const result = await apiPatch(`/api/external/project-tasks/${id}`, body, apiUrl);
53348
- if (options.json) {
53349
- printJson4(result);
53350
- return;
53351
- }
53352
53430
  if (options.pretty) {
53353
53431
  const t = result.task;
53354
53432
  console.log(source_default.green(`
@@ -53363,14 +53441,12 @@ Task updated: ${t.name}`));
53363
53441
  );
53364
53442
  }
53365
53443
  function registerTaskDelete(program3) {
53366
- program3.command("project:task:delete <id>").description("Delete a task\n Example: elevasis-sdk project:task:delete <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53444
+ withTarget(
53445
+ program3.command("project:task:delete <id>").description("Delete a task\n Example: elevasis-sdk project:task:delete <uuid>")
53446
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53367
53447
  wrapAction("project:task:delete", async (id, options) => {
53368
53448
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53369
53449
  const result = await apiDelete(`/api/external/project-tasks/${id}`, apiUrl);
53370
- if (options.json) {
53371
- printJson4(result);
53372
- return;
53373
- }
53374
53450
  if (options.pretty) {
53375
53451
  console.log(source_default.green(`
53376
53452
  Task ${id} deleted.`));
@@ -53382,18 +53458,16 @@ Task ${id} deleted.`));
53382
53458
  );
53383
53459
  }
53384
53460
  function registerTaskResume(program3) {
53385
- program3.command("project:task:resume <id>").description(
53386
- "Fetch the resume_context JSONB for a task (used by /work resume)\n Example: elevasis-sdk project:task:resume <uuid>"
53387
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render a human-readable resume briefing instead of raw JSON").option("--json", "Output as JSON").action(
53461
+ withTarget(
53462
+ program3.command("project:task:resume <id>").description(
53463
+ "Fetch the resume_context JSONB for a task (used by /work resume)\n Example: elevasis-sdk project:task:resume <uuid>"
53464
+ )
53465
+ ).option("--pretty", "Render a human-readable resume briefing instead of raw JSON").action(
53388
53466
  wrapAction("project:task:resume", async (id, options) => {
53389
53467
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53390
53468
  const result = await apiGet(`/api/external/project-tasks/${id}`, apiUrl);
53391
53469
  const task = result.task;
53392
53470
  const ctx = task.resume_context ?? {};
53393
- if (options.json) {
53394
- printJson4(ctx);
53395
- return;
53396
- }
53397
53471
  if (options.pretty) {
53398
53472
  console.log(source_default.cyan(`
53399
53473
  Resume briefing for task: ${task.name}`));
@@ -53434,10 +53508,12 @@ Resume briefing for task: ${task.name}`));
53434
53508
  );
53435
53509
  }
53436
53510
  function registerTaskSave(program3) {
53437
- program3.command("project:task:save <id>").description(
53438
- `Merge fields into resume_context for a task (used by /work save)
53511
+ withTarget(
53512
+ program3.command("project:task:save <id>").description(
53513
+ `Merge fields into resume_context for a task (used by /work save)
53439
53514
  Example: elevasis-sdk project:task:save <uuid> --current-state "Implemented X" --files-modified '["src/foo.ts"]'`
53440
- ).requiredOption("--current-state <text>", "Current state description").option("--files-modified <json>", "JSON array of modified file paths").option("--next-steps <text>", "Next steps description").option("--key-docs <json>", "JSON array of key doc paths").option("--tools <json>", "JSON array of tool names used").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53515
+ ).requiredOption("--current-state <text>", "Current state description").option("--files-modified <json>", "JSON array of modified file paths").option("--next-steps <text>", "Next steps description").option("--key-docs <json>", "JSON array of key doc paths").option("--tools <json>", "JSON array of tool names used")
53516
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53441
53517
  wrapAction(
53442
53518
  "project:task:save",
53443
53519
  async (id, options) => {
@@ -53479,10 +53555,6 @@ function registerTaskSave(program3) {
53479
53555
  }
53480
53556
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53481
53557
  const result = await apiPatch(`/api/external/project-tasks/${id}/resume-context`, body, apiUrl);
53482
- if (options.json) {
53483
- printJson4(result);
53484
- return;
53485
- }
53486
53558
  if (options.pretty) {
53487
53559
  console.log(source_default.green(`
53488
53560
  Resume context saved for task ${id}`));
@@ -53765,19 +53837,14 @@ var DeleteSuccessResponseSchema = external_exports.object({ success: external_ex
53765
53837
  init_wrap_action();
53766
53838
  init_config2();
53767
53839
  init_api_client();
53768
- function printJson5(value) {
53769
- console.log(JSON.stringify(value, null, 2));
53770
- }
53771
53840
  var NOTE_TYPE_HELP = NoteTypeSchema.options.join(" | ");
53772
53841
  function registerNoteList(program3) {
53773
- 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("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53842
+ withTarget(
53843
+ 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)")
53844
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53774
53845
  wrapAction("project:note:list", async (options) => {
53775
53846
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53776
53847
  const result = await apiGet(`/api/external/projects/${options.project}/notes`, apiUrl);
53777
- if (options.json) {
53778
- printJson5(result);
53779
- return;
53780
- }
53781
53848
  if (options.pretty) {
53782
53849
  const notes = result.notes;
53783
53850
  if (notes.length === 0) {
@@ -53800,9 +53867,11 @@ Notes (${notes.length}):
53800
53867
  );
53801
53868
  }
53802
53869
  function registerNoteCreate(program3) {
53803
- program3.command("project:note:create").description(
53804
- 'Create a note\n Example: elevasis-sdk project:note:create --project <uuid> --content "Status update"'
53805
- ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--content <content>", "Note content").option("--task <task-id>", "Attach to a task (UUID)").option("--milestone <milestone-id>", "Attach to a milestone (UUID)").option("--type <type>", `Note type: ${NOTE_TYPE_HELP}`).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53870
+ withTarget(
53871
+ program3.command("project:note:create").description(
53872
+ 'Create a note\n Example: elevasis-sdk project:note:create --project <uuid> --content "Status update"'
53873
+ ).requiredOption("--project <project-id>", "Project ID (UUID)").requiredOption("--content <content>", "Note content").option("--task <task-id>", "Attach to a task (UUID)").option("--milestone <milestone-id>", "Attach to a milestone (UUID)").option("--type <type>", `Note type: ${NOTE_TYPE_HELP}`)
53874
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53806
53875
  wrapAction(
53807
53876
  "project:note:create",
53808
53877
  async (options) => {
@@ -53815,10 +53884,6 @@ function registerNoteCreate(program3) {
53815
53884
  if (options.type) body.type = options.type;
53816
53885
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53817
53886
  const result = await apiPost("/api/external/project-notes", body, apiUrl);
53818
- if (options.json) {
53819
- printJson5(result);
53820
- return;
53821
- }
53822
53887
  if (options.pretty) {
53823
53888
  const n = result.note;
53824
53889
  console.log(source_default.green(`
@@ -53834,7 +53899,9 @@ Note created`));
53834
53899
  );
53835
53900
  }
53836
53901
  function registerNoteUpdate(program3) {
53837
- program3.command("project:note:update <id>").description('Update a note\n Example: elevasis-sdk project:note:update <uuid> --content "Updated content"').requiredOption("--content <content>", "New note content").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53902
+ withTarget(
53903
+ program3.command("project:note:update <id>").description('Update a note\n Example: elevasis-sdk project:note:update <uuid> --content "Updated content"').requiredOption("--content <content>", "New note content")
53904
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53838
53905
  wrapAction("project:note:update", async (id, options) => {
53839
53906
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53840
53907
  const result = await apiPatch(
@@ -53842,10 +53909,6 @@ function registerNoteUpdate(program3) {
53842
53909
  { content: options.content },
53843
53910
  apiUrl
53844
53911
  );
53845
- if (options.json) {
53846
- printJson5(result);
53847
- return;
53848
- }
53849
53912
  if (options.pretty) {
53850
53913
  console.log(source_default.green(`
53851
53914
  Note ${id} updated.`));
@@ -53857,14 +53920,12 @@ Note ${id} updated.`));
53857
53920
  );
53858
53921
  }
53859
53922
  function registerNoteDelete(program3) {
53860
- program3.command("project:note:delete <id>").description("Delete a note\n Example: elevasis-sdk project:note:delete <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option("--json", "Output as JSON").action(
53923
+ withTarget(
53924
+ program3.command("project:note:delete <id>").description("Delete a note\n Example: elevasis-sdk project:note:delete <uuid>")
53925
+ ).option("--pretty", "Render human-readable output instead of raw JSON").action(
53861
53926
  wrapAction("project:note:delete", async (id, options) => {
53862
53927
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
53863
53928
  const result = await apiDelete(`/api/external/project-notes/${id}`, apiUrl);
53864
- if (options.json) {
53865
- printJson5(result);
53866
- return;
53867
- }
53868
53929
  if (options.pretty) {
53869
53930
  console.log(source_default.green(`
53870
53931
  Note ${id} deleted.`));
@@ -55730,7 +55791,7 @@ var REQUEST_CATEGORY_HELP = RequestCategoryEnum.options.join(" | ");
55730
55791
  var REQUEST_SEVERITY_HELP = RequestSeverityEnum.options.join(" | ");
55731
55792
  var REQUEST_STATUS_HELP = RequestStatusEnum.options.join(" | ");
55732
55793
  function registerRequestCommands(program3) {
55733
- program3.command("request:submit").description(
55794
+ withTarget(program3.command("request:submit").description(
55734
55795
  `Submit a structured request report via POST /api/external/requests
55735
55796
  Example: elevasis-sdk request:submit -f ./request-report.json
55736
55797
  type: ${REQUEST_TYPE_HELP}
@@ -55739,7 +55800,7 @@ function registerRequestCommands(program3) {
55739
55800
  ).option("-i, --input <json>", "Request body as JSON string").option(
55740
55801
  "-f, --input-file <path>",
55741
55802
  "Read request body from a JSON file (e.g. request-report.json, avoids shell escaping). Relative paths resolve against the project root."
55742
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").option(
55803
+ )).option("--pretty", "Render human-readable output instead of raw JSON").option(
55743
55804
  "--cleanup-input",
55744
55805
  "Delete the input file after a successful submission (only files under <projectRoot>/tmp/ are eligible; files outside tmp/ produce a warning and are left untouched)"
55745
55806
  ).action(
@@ -55784,12 +55845,12 @@ ${issues}`);
55784
55845
  }
55785
55846
  })
55786
55847
  );
55787
- program3.command("request:list").description(
55848
+ withTarget(program3.command("request:list").description(
55788
55849
  `List reported requests via GET /api/external/requests
55789
55850
  Example: elevasis-sdk request:list --status open --severity critical
55790
55851
  status: ${REQUEST_STATUS_HELP}
55791
55852
  severity: ${REQUEST_SEVERITY_HELP}`
55792
- ).option("--status <status>", `Filter by status (${REQUEST_STATUS_HELP})`).option("--severity <severity>", `Filter by severity (${REQUEST_SEVERITY_HELP})`).option("--project-id <uuid>", "Filter by project id").option("--limit <n>", "Max rows to return (1-200, default 50)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
55853
+ ).option("--status <status>", `Filter by status (${REQUEST_STATUS_HELP})`).option("--severity <severity>", `Filter by severity (${REQUEST_SEVERITY_HELP})`).option("--project-id <uuid>", "Filter by project id").option("--limit <n>", "Max rows to return (1-200, default 50)")).option("--pretty", "Render human-readable output instead of raw JSON").action(
55793
55854
  wrapAction("request:list", async (options) => {
55794
55855
  const params = new URLSearchParams();
55795
55856
  if (options.status) params.set("status", options.status);
@@ -55816,9 +55877,9 @@ ${rows.length} request${rows.length === 1 ? "" : "s"}`));
55816
55877
  }
55817
55878
  })
55818
55879
  );
55819
- program3.command("request:get <id>").description(
55880
+ withTarget(program3.command("request:get <id>").description(
55820
55881
  "Get a reported request by id via GET /api/external/requests/:id\n Example: elevasis-sdk request:get 1a2b3c4d-5e6f-7890-abcd-ef1234567890"
55821
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
55882
+ )).option("--pretty", "Render human-readable output instead of raw JSON").action(
55822
55883
  wrapAction("request:get", async (id, options) => {
55823
55884
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
55824
55885
  const result = await apiGet(`/api/external/requests/${encodeURIComponent(id)}`, apiUrl);
@@ -55837,7 +55898,7 @@ ${rows.length} request${rows.length === 1 ? "" : "s"}`));
55837
55898
  }
55838
55899
  })
55839
55900
  );
55840
- program3.command("request:update <id>").description(
55901
+ withTarget(program3.command("request:update <id>").description(
55841
55902
  `Amend a request you filed via PATCH /api/external/requests/:id
55842
55903
  Example: elevasis-sdk request:update <uuid> -i '{"project_id":"<uuid>"}'
55843
55904
  Backfills project_id / task_id on rows filed before those were populated.
@@ -55848,7 +55909,7 @@ ${rows.length} request${rows.length === 1 ? "" : "s"}`));
55848
55909
  ).option("-i, --input <json>", "Fields to change, as a JSON object").option(
55849
55910
  "-f, --input-file <path>",
55850
55911
  "Read the changed fields from a JSON file (avoids shell escaping). Relative paths resolve against the project root."
55851
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
55912
+ )).option("--pretty", "Render human-readable output instead of raw JSON").action(
55852
55913
  wrapAction("request:update", async (id, options) => {
55853
55914
  if (!options.input && !options.inputFile) {
55854
55915
  throw new Error("Provide --input <json> or --input-file <path>");
@@ -55881,9 +55942,9 @@ ${issues}`);
55881
55942
  }
55882
55943
  })
55883
55944
  );
55884
- program3.command("request:delete <id>").description(
55945
+ withTarget(program3.command("request:delete <id>").description(
55885
55946
  "Withdraw a request you filed via DELETE /api/external/requests/:id\n Example: elevasis-sdk request:delete <uuid>\n Permanent - the row is removed, not archived. Use request:update to amend instead."
55886
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
55947
+ )).option("--pretty", "Render human-readable output instead of raw JSON").action(
55887
55948
  wrapAction("request:delete", async (id, options) => {
55888
55949
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
55889
55950
  const result = await apiDelete(`/api/external/requests/${encodeURIComponent(id)}`, apiUrl);
@@ -56063,7 +56124,11 @@ function listDeployedReadinessTargets(model) {
56063
56124
  const targets = SYSTEM_INTERFACE_PROFILES.map((profile) => ({
56064
56125
  systemPath: profile.systemPath,
56065
56126
  interfaceKey: profile.interfaceKey,
56066
- declaredLocally: declared.has(profile.systemPath)
56127
+ // `declared` is built from apiInterface declarations, which are statements about
56128
+ // the `api` interface only. A System can carry several catalog profiles (sales.lead-gen
56129
+ // has both `api` and the derived `crm-handoff`), so matching on systemPath alone marked
56130
+ // a tenant as having declared a bridge it cannot author, and cost it the not-adopted opt-out.
56131
+ declaredLocally: profile.interfaceKey === "api" && declared.has(profile.systemPath)
56067
56132
  }));
56068
56133
  const covered = new Set(targets.map((target) => `${target.systemPath}::${target.interfaceKey}`));
56069
56134
  for (const systemPath of declared) {
@@ -56360,9 +56425,6 @@ function endpointWithQuery2(endpoint, params) {
56360
56425
  const query = params.toString();
56361
56426
  return query ? `${endpoint}?${query}` : endpoint;
56362
56427
  }
56363
- function printJson6(value) {
56364
- console.log(JSON.stringify(value, null, 2));
56365
- }
56366
56428
  function dealEmail(deal) {
56367
56429
  return deal.contactEmail ?? deal.contact_email ?? "unknown contact";
56368
56430
  }
@@ -56376,7 +56438,7 @@ function dealListId(deal) {
56376
56438
  return deal.sourceListId ?? deal.source_list_id ?? null;
56377
56439
  }
56378
56440
  function registerAcquisitionDealList(program3) {
56379
- program3.command("acquisition:deal:list").description("List acquisition deals\n Example: elevasis-sdk acquisition:deal:list --stage discovery").option("--stage <stage>", "Filter by CRM stage").option("--list <id>", "Filter by source acquisition list ID").option("--batch <batch>", "Filter by source batch ID").option("--stale-since <datetime>", "Filter to deals stale since an ISO datetime").option("--search <query>", "Search by contact, company, or deal label").option("--limit <limit>", "Maximum number of deals to return").option("--offset <offset>", "Number of deals to skip").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56441
+ withTarget(program3.command("acquisition:deal:list").description("List acquisition deals\n Example: elevasis-sdk acquisition:deal:list --stage discovery").option("--stage <stage>", "Filter by CRM stage").option("--list <id>", "Filter by source acquisition list ID").option("--batch <batch>", "Filter by source batch ID").option("--stale-since <datetime>", "Filter to deals stale since an ISO datetime").option("--search <query>", "Search by contact, company, or deal label").option("--limit <limit>", "Maximum number of deals to return").option("--offset <offset>", "Number of deals to skip")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56380
56442
  wrapAction(
56381
56443
  "acquisition:deal:list",
56382
56444
  async (options) => {
@@ -56391,7 +56453,7 @@ function registerAcquisitionDealList(program3) {
56391
56453
  appendQuery2(params, "offset", options.offset);
56392
56454
  const result = await apiGet(endpointWithQuery2("/api/external/deals", params), apiUrl);
56393
56455
  if (!options.pretty) {
56394
- printJson6(result);
56456
+ printJson(result);
56395
56457
  return;
56396
56458
  }
56397
56459
  if (result.data.length === 0) {
@@ -56414,12 +56476,12 @@ Acquisition deals (${result.data.length} of ${result.total}):
56414
56476
  );
56415
56477
  }
56416
56478
  function registerAcquisitionDealGet(program3) {
56417
- program3.command("acquisition:deal:get <id>").description("Get an acquisition deal by ID\n Example: elevasis-sdk acquisition:deal:get <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56479
+ withTarget(program3.command("acquisition:deal:get <id>").description("Get an acquisition deal by ID\n Example: elevasis-sdk acquisition:deal:get <uuid>")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56418
56480
  wrapAction("acquisition:deal:get", async (id, options) => {
56419
56481
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56420
56482
  const result = await apiGet("/api/external/deals/" + id, apiUrl);
56421
56483
  if (!options.pretty) {
56422
- printJson6(result);
56484
+ printJson(result);
56423
56485
  return;
56424
56486
  }
56425
56487
  console.log(source_default.cyan(`
@@ -56436,12 +56498,12 @@ Acquisition deal: ${dealEmail(result)}`));
56436
56498
  );
56437
56499
  }
56438
56500
  function registerAcquisitionDealStatus(program3) {
56439
- program3.command("acquisition:deal:status").description("Show CRM funnel status for acquisition deals").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56501
+ withTarget(program3.command("acquisition:deal:status").description("Show CRM funnel status for acquisition deals")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56440
56502
  wrapAction("acquisition:deal:status", async (options) => {
56441
56503
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56442
56504
  const result = await apiGet("/api/external/deals/summary", apiUrl);
56443
56505
  if (!options.pretty) {
56444
- printJson6(result);
56506
+ printJson(result);
56445
56507
  return;
56446
56508
  }
56447
56509
  console.log(source_default.cyan("\nAcquisition deal status"));
@@ -56473,9 +56535,6 @@ function endpointWithQuery3(endpoint, params) {
56473
56535
  const query = params.toString();
56474
56536
  return query ? `${endpoint}?${query}` : endpoint;
56475
56537
  }
56476
- function printJson7(value) {
56477
- console.log(JSON.stringify(value, null, 2));
56478
- }
56479
56538
  function renderListSummary(list) {
56480
56539
  const batches = list.batchIds?.length ? `${list.batchIds.length} batch(es)` : "no batches";
56481
56540
  const vertical = typeof list.scrapingConfig?.vertical === "string" ? ` ${list.scrapingConfig.vertical}` : "";
@@ -56485,7 +56544,7 @@ function renderListSummary(list) {
56485
56544
  if (list.description) console.log(source_default.gray(` ${list.description}`));
56486
56545
  }
56487
56546
  function registerAcquisitionListList(program3) {
56488
- program3.command("acquisition:list:list").description("List acquisition lists\n Example: elevasis-sdk acquisition:list:list --status launched").option("--status <status>", "Filter by status: draft | enriching | launched | closing | archived").option("--batch <batch>", "Filter by batch ID").option("--vertical <vertical>", "Filter by scraping vertical").option("--limit <limit>", "Maximum number of lists to return").option("--offset <offset>", "Number of lists to skip").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56547
+ withTarget(program3.command("acquisition:list:list").description("List acquisition lists\n Example: elevasis-sdk acquisition:list:list --status launched").option("--status <status>", "Filter by status: draft | enriching | launched | closing | archived").option("--batch <batch>", "Filter by batch ID").option("--vertical <vertical>", "Filter by scraping vertical").option("--limit <limit>", "Maximum number of lists to return").option("--offset <offset>", "Number of lists to skip")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56489
56548
  wrapAction(
56490
56549
  "acquisition:list:list",
56491
56550
  async (options) => {
@@ -56501,7 +56560,7 @@ function registerAcquisitionListList(program3) {
56501
56560
  apiUrl
56502
56561
  );
56503
56562
  if (!options.pretty) {
56504
- printJson7(result);
56563
+ printJson(result);
56505
56564
  return;
56506
56565
  }
56507
56566
  if (result.length === 0) {
@@ -56518,7 +56577,7 @@ Acquisition lists (${result.length}):
56518
56577
  );
56519
56578
  }
56520
56579
  function registerAcquisitionListGet(program3) {
56521
- program3.command("acquisition:list:get <id>").description("Get an acquisition list by ID\n Example: elevasis-sdk acquisition:list:get <uuid>").option("--no-include-deals", "Exclude thin deal lineage refs").option("--deal-limit <limit>", "Maximum number of thin deal refs to include").option("--include-progress", "Include processing progress aggregates").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56580
+ withTarget(program3.command("acquisition:list:get <id>").description("Get an acquisition list by ID\n Example: elevasis-sdk acquisition:list:get <uuid>").option("--no-include-deals", "Exclude thin deal lineage refs").option("--deal-limit <limit>", "Maximum number of thin deal refs to include").option("--include-progress", "Include processing progress aggregates")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56522
56581
  wrapAction(
56523
56582
  "acquisition:list:get",
56524
56583
  async (id, options) => {
@@ -56532,7 +56591,7 @@ function registerAcquisitionListGet(program3) {
56532
56591
  apiUrl
56533
56592
  );
56534
56593
  if (!options.pretty) {
56535
- printJson7(result);
56594
+ printJson(result);
56536
56595
  return;
56537
56596
  }
56538
56597
  console.log(source_default.cyan(`
@@ -56549,12 +56608,12 @@ Acquisition list: ${result.name}`));
56549
56608
  );
56550
56609
  }
56551
56610
  function registerAcquisitionListStatus(program3) {
56552
- program3.command("acquisition:list:status").description("Show portfolio status across acquisition lists").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56611
+ withTarget(program3.command("acquisition:list:status").description("Show portfolio status across acquisition lists")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56553
56612
  wrapAction("acquisition:list:status", async (options) => {
56554
56613
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56555
56614
  const result = await apiGet("/api/external/acquisition/lists/status", apiUrl);
56556
56615
  if (!options.pretty) {
56557
- printJson7(result);
56616
+ printJson(result);
56558
56617
  return;
56559
56618
  }
56560
56619
  console.log(source_default.cyan("\nAcquisition list status"));
@@ -56587,7 +56646,7 @@ init_wrap_action();
56587
56646
  init_config2();
56588
56647
  init_api_client();
56589
56648
  function registerClientCreate(program3) {
56590
- 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 <source>", "Client source (for example: acquisition | word_of_mouth)").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("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56649
+ withTarget(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 <source>", "Client source (for example: acquisition | word_of_mouth)").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("--pretty", "Render human-readable output instead of raw JSON").action(
56591
56650
  wrapAction(
56592
56651
  "client:create",
56593
56652
  async (options) => {
@@ -56614,7 +56673,7 @@ Client created: ${result.name}`));
56614
56673
  );
56615
56674
  }
56616
56675
  function registerClientUpdate(program3) {
56617
- program3.command("client:update <id>").description("Update a client\n Example: elevasis-sdk client:update <uuid> --status active").option("--name <name>", "New client name").option("--status <status>", "New status: active | onboarding | paused | completed | churned").option("--source <source>", "Set client source (for example: acquisition | word_of_mouth)").option("--source-deal-id <uuid>", "Set source deal (UUID)").option("--clear-source-deal", "Remove the source deal link (sets sourceDealId to null)").option("--primary-company-id <uuid>", "Set primary company (UUID)").option("--clear-primary-company", "Remove the primary company link (sets primaryCompanyId to null)").option("--primary-contact-id <uuid>", "Set primary contact (UUID)").option("--clear-primary-contact", "Remove the primary contact link (sets primaryContactId to null)").option("--metadata <json>", "Arbitrary metadata (JSON string)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56676
+ withTarget(program3.command("client:update <id>").description("Update a client\n Example: elevasis-sdk client:update <uuid> --status active").option("--name <name>", "New client name").option("--status <status>", "New status: active | onboarding | paused | completed | churned").option("--source <source>", "Set client source (for example: acquisition | word_of_mouth)").option("--source-deal-id <uuid>", "Set source deal (UUID)").option("--clear-source-deal", "Remove the source deal link (sets sourceDealId to null)").option("--primary-company-id <uuid>", "Set primary company (UUID)").option("--clear-primary-company", "Remove the primary company link (sets primaryCompanyId to null)").option("--primary-contact-id <uuid>", "Set primary contact (UUID)").option("--clear-primary-contact", "Remove the primary contact link (sets primaryContactId to null)").option("--metadata <json>", "Arbitrary metadata (JSON string)")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56618
56677
  wrapAction(
56619
56678
  "client:update",
56620
56679
  async (id, options) => {
@@ -56691,7 +56750,7 @@ Client updated: ${result.name}`));
56691
56750
  );
56692
56751
  }
56693
56752
  function registerClientDelete(program3) {
56694
- program3.command("client:delete <id>").description("Delete a client\n Example: elevasis-sdk client:delete <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56753
+ withTarget(program3.command("client:delete <id>").description("Delete a client\n Example: elevasis-sdk client:delete <uuid>")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56695
56754
  wrapAction("client:delete", async (id, options) => {
56696
56755
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56697
56756
  const client = await resolveClient(id, apiUrl);
@@ -56728,9 +56787,9 @@ function appendQuery4(params, key, value) {
56728
56787
  params.set(key, String(value));
56729
56788
  }
56730
56789
  function registerContentList(program3) {
56731
- program3.command("content:list").description(
56790
+ withTarget(program3.command("content:list").description(
56732
56791
  'List content pipeline items\n Example: elevasis-sdk content:list --status <status> --pipeline-id <pipelineId>\n Note: both values come from the org model this project declares, not a platform enum --\n read them from the content:catalog/status catalog and content:pipeline.\n Note: "awaiting review" is not a status -- that read is content:queue.'
56733
- ).option("--status <status>", "Filter by content item status").option("--pillar <pillar>", "Filter by content pillar").option("--pipeline-id <id>", "Filter by pipeline template id").option("--client-id <id>", "Filter by client id").option("--reviewed-by <id>", "Filter by reviewer user id").option("--search <query>", "Search by title").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56792
+ ).option("--status <status>", "Filter by content item status").option("--pillar <pillar>", "Filter by content pillar").option("--pipeline-id <id>", "Filter by pipeline template id").option("--client-id <id>", "Filter by client id").option("--reviewed-by <id>", "Filter by reviewer user id").option("--search <query>", "Search by title").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset")).option("--pretty", "Render human-readable output instead of raw JSON").action(
56734
56793
  wrapAction("content:list", async (options) => {
56735
56794
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56736
56795
  const params = new URLSearchParams();
@@ -56773,9 +56832,9 @@ init_api_client();
56773
56832
  init_config2();
56774
56833
  init_wrap_action();
56775
56834
  function registerContentGet(program3) {
56776
- program3.command("content:get <itemId>").description(
56835
+ withTarget(program3.command("content:get <itemId>").description(
56777
56836
  "Get a content item, its attempts, and its distributions in one call\n Example: elevasis-sdk content:get <uuid>"
56778
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
56837
+ )).option("--pretty", "Render human-readable output instead of raw JSON").action(
56779
56838
  wrapAction("content:get", async (itemId, options) => {
56780
56839
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56781
56840
  const result = await apiGet(`/api/external/content/items/${itemId}`, apiUrl);
@@ -56966,9 +57025,9 @@ function printCards(cards, stepsByKey) {
56966
57025
  }
56967
57026
  }
56968
57027
  function registerContentBoard(program3) {
56969
- program3.command("content:board <pipelineId>").description(
57028
+ withTarget(program3.command("content:board <pipelineId>").description(
56970
57029
  "Render one pipeline as a board -- columns, review gates, and waiting counts\n Example: elevasis-sdk content:board <pipelineId> --pretty\n Note: pipeline ids come from the org model this project declares -- list them with content:pipeline."
56971
- ).option("--limit <n>", `Items to pull before deriving (default and API maximum ${DEFAULT_ITEM_LIMIT})`).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57030
+ ).option("--limit <n>", `Items to pull before deriving (default and API maximum ${DEFAULT_ITEM_LIMIT})`)).option("--pretty", "Render human-readable output instead of raw JSON").action(
56972
57031
  wrapAction("content:board", async (pipelineId, options) => {
56973
57032
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
56974
57033
  const limit = options.limit ?? String(DEFAULT_ITEM_LIMIT);
@@ -57025,7 +57084,7 @@ init_api_client();
57025
57084
  init_config2();
57026
57085
  init_wrap_action();
57027
57086
  function registerContentQueue(program3) {
57028
- program3.command("content:queue").description("List content items awaiting a `queued`-gate review\n Example: elevasis-sdk content:queue --pretty").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57087
+ withTarget(program3.command("content:queue").description("List content items awaiting a `queued`-gate review\n Example: elevasis-sdk content:queue --pretty")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57029
57088
  wrapAction("content:queue", async (options) => {
57030
57089
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57031
57090
  const result = await apiGet("/api/external/content/queue", apiUrl);
@@ -57067,9 +57126,9 @@ Pipeline: ${pipeline.id}`));
57067
57126
  console.log();
57068
57127
  }
57069
57128
  function registerContentPipeline(program3) {
57070
- program3.command("content:pipeline [id]").description(
57129
+ withTarget(program3.command("content:pipeline [id]").description(
57071
57130
  "List content pipeline templates, or show one pipeline's step contract\n Example: elevasis-sdk content:pipeline <pipelineId>\n Note: run without an id to list the pipeline ids this project declares in its org model."
57072
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57131
+ )).option("--pretty", "Render human-readable output instead of raw JSON").action(
57073
57132
  wrapAction("content:pipeline", async (id, options) => {
57074
57133
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57075
57134
  if (!id) {
@@ -57112,9 +57171,9 @@ function appendQuery5(params, key, value) {
57112
57171
  params.set(key, String(value));
57113
57172
  }
57114
57173
  function registerContentDistributions(program3) {
57115
- program3.command("content:distributions").description(
57174
+ withTarget(program3.command("content:distributions").description(
57116
57175
  "List content distributions\n Example: elevasis-sdk content:distributions --pipeline-id <pipelineId>\n Note: pipeline ids come from the org model this project declares -- list them with content:pipeline."
57117
- ).option("--content-item-id <id>", "Filter by content item id").option("--pipeline-id <id>", "Filter by pipeline template id").option("--platform <platform>", "Filter by distribution platform").option("--status <status>", "Filter by distribution status").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57176
+ ).option("--content-item-id <id>", "Filter by content item id").option("--pipeline-id <id>", "Filter by pipeline template id").option("--platform <platform>", "Filter by distribution platform").option("--status <status>", "Filter by distribution status").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57118
57177
  wrapAction("content:distributions", async (options) => {
57119
57178
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57120
57179
  const params = new URLSearchParams();
@@ -57156,12 +57215,12 @@ init_api_client();
57156
57215
  init_config2();
57157
57216
  init_wrap_action();
57158
57217
  function registerContentReview(program3) {
57159
- program3.command("content:review <itemId>").description(
57218
+ withTarget(program3.command("content:review <itemId>").description(
57160
57219
  "Clear a queued review gate on a content item\n Example: elevasis-sdk content:review <uuid> --step draft-review --approve --user reviewer@example.com"
57161
57220
  ).requiredOption("--step <key>", "The stepKey of the queued gate to clear (from `content:queue`)").requiredOption(
57162
57221
  "--user <email>",
57163
57222
  "The acting reviewer\u2019s email -- must be an active member of the API key\u2019s organization"
57164
- ).option("--approve", "Approve the item at this step").option("--reject", "Reject the item at this step (requires --reason)").option("--feedback <text>", "Optional reviewer feedback (1..5000 chars)").option("--reason <text>", "Reason for rejection -- required when --reject is set").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57223
+ ).option("--approve", "Approve the item at this step").option("--reject", "Reject the item at this step (requires --reason)").option("--feedback <text>", "Optional reviewer feedback (1..5000 chars)").option("--reason <text>", "Reason for rejection -- required when --reject is set")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57165
57224
  wrapAction("content:review", async (itemId, options) => {
57166
57225
  if (options.approve && options.reject) {
57167
57226
  throw new Error("Pass exactly one of --approve or --reject, not both");
@@ -57209,9 +57268,9 @@ function appendQuery6(params, key, value) {
57209
57268
  params.set(key, String(value));
57210
57269
  }
57211
57270
  function registerContentSourceAssets(program3) {
57212
- program3.command("content:source-assets").description(
57271
+ withTarget(program3.command("content:source-assets").description(
57213
57272
  "List content source assets (raw material)\n Example: elevasis-sdk content:source-assets --kind transcript --limit 10"
57214
- ).option("--kind <kind>", "Filter by source asset kind (e.g. transcript)").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57273
+ ).option("--kind <kind>", "Filter by source asset kind (e.g. transcript)").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57215
57274
  wrapAction("content:source-assets", async (options) => {
57216
57275
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57217
57276
  const params = new URLSearchParams();
@@ -57249,9 +57308,9 @@ init_api_client();
57249
57308
  init_config2();
57250
57309
  init_wrap_action();
57251
57310
  function registerContentSourceAsset(program3) {
57252
- program3.command("content:source-asset <sourceAssetId>").description(
57311
+ withTarget(program3.command("content:source-asset <sourceAssetId>").description(
57253
57312
  "Get one content source asset, including its payload\n Example: elevasis-sdk content:source-asset <uuid>"
57254
- ).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57313
+ )).option("--pretty", "Render human-readable output instead of raw JSON").action(
57255
57314
  wrapAction("content:source-asset", async (sourceAssetId, options) => {
57256
57315
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57257
57316
  const asset = await apiGet(`/api/external/content/source-assets/${sourceAssetId}`, apiUrl);
@@ -57328,7 +57387,7 @@ function resolveMetadataOption(options) {
57328
57387
  return parsed;
57329
57388
  }
57330
57389
  function registerContentSourceAssetCreate(program3) {
57331
- program3.command("content:source-asset:create").description(
57390
+ withTarget(program3.command("content:source-asset:create").description(
57332
57391
  'Create a content source asset from inline text or a URL, optionally linking it to an item\n Example: elevasis-sdk content:source-asset:create --kind transcript --title "Episode 12" --text @transcript.txt --item <uuid>'
57333
57392
  ).requiredOption("--kind <kind>", "Source asset kind (e.g. transcript) -- validated against the org model catalog").requiredOption("--title <title>", "Human-readable title (1..500 chars)").option("--text <value>", "Inline text, or @path to read a local file. Mutually exclusive with --url").option(
57334
57393
  "--field <key>",
@@ -57336,7 +57395,7 @@ function registerContentSourceAssetCreate(program3) {
57336
57395
  ).option("--url <url>", "External URL the asset references. Mutually exclusive with --text").option("--duration <seconds>", "Duration in seconds, for time-based referenced media").option("--storage-path <path>", "Storage path the asset references (1..2000 chars)").option("--metadata <json>", "Arbitrary metadata as a JSON object string. Mutually exclusive with --metadata-file").option(
57337
57396
  "--metadata-file <path>",
57338
57397
  "Path to a JSON file containing metadata (project-relative unless absolute). Mutually exclusive with --metadata"
57339
- ).option("--item <itemId>", "Link the new asset to this content item after creating it").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57398
+ ).option("--item <itemId>", "Link the new asset to this content item after creating it")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57340
57399
  wrapAction("content:source-asset:create", async (options) => {
57341
57400
  if (options.text !== void 0 && options.url !== void 0) {
57342
57401
  throw new Error("Pass exactly one of --text or --url, not both");
@@ -57415,9 +57474,6 @@ init_source();
57415
57474
  init_api_client();
57416
57475
  init_config2();
57417
57476
  init_wrap_action();
57418
- function printJson8(value) {
57419
- console.log(JSON.stringify(value, null, 2));
57420
- }
57421
57477
  function appendQuery7(params, key, value) {
57422
57478
  if (value === void 0 || value === null || value === "") return;
57423
57479
  params.set(key, String(value));
@@ -57438,7 +57494,7 @@ function taskTitle(task) {
57438
57494
  return task.description || task.humanCheckpoint || task.id;
57439
57495
  }
57440
57496
  function registerQueueList(program3) {
57441
- program3.command("queue:list").description("List HITL command queue tasks\n Example: elevasis-sdk queue:list --status pending --pretty").option("--status <status>", "Filter by status: pending | processing | completed | failed | expired").option("--human-checkpoint <id>", 'Filter by checkpoint ID, or "ungrouped" for tasks without a checkpoint').option("--time-range <range>", "Filter by created time range: 1h | 24h | 7d | 30d").option("--priority-min <number>", "Minimum priority, 1-10").option("--priority-max <number>", "Maximum priority, 1-10").option("--limit <limit>", "Maximum number of tasks to return").option("--offset <offset>", "Number of tasks to skip").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57497
+ withTarget(program3.command("queue:list").description("List HITL command queue tasks\n Example: elevasis-sdk queue:list --status pending --pretty").option("--status <status>", "Filter by status: pending | processing | completed | failed | expired").option("--human-checkpoint <id>", 'Filter by checkpoint ID, or "ungrouped" for tasks without a checkpoint').option("--time-range <range>", "Filter by created time range: 1h | 24h | 7d | 30d").option("--priority-min <number>", "Minimum priority, 1-10").option("--priority-max <number>", "Maximum priority, 1-10").option("--limit <limit>", "Maximum number of tasks to return").option("--offset <offset>", "Number of tasks to skip")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57442
57498
  wrapAction(
57443
57499
  "queue:list",
57444
57500
  async (options) => {
@@ -57456,7 +57512,7 @@ function registerQueueList(program3) {
57456
57512
  apiUrl
57457
57513
  );
57458
57514
  if (!options.pretty) {
57459
- printJson8(result);
57515
+ printJson(result);
57460
57516
  return;
57461
57517
  }
57462
57518
  if (result.tasks.length === 0) {
@@ -57479,12 +57535,12 @@ Queue tasks (${result.tasks.length} of ${result.total}):
57479
57535
  );
57480
57536
  }
57481
57537
  function registerQueueGet(program3) {
57482
- program3.command("queue:get <id>").description("Get a HITL command queue task\n Example: elevasis-sdk queue:get <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57538
+ withTarget(program3.command("queue:get <id>").description("Get a HITL command queue task\n Example: elevasis-sdk queue:get <uuid>")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57483
57539
  wrapAction("queue:get", async (id, options) => {
57484
57540
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57485
57541
  const result = await apiGet(`/api/external/command-queue/${id}`, apiUrl);
57486
57542
  if (!options.pretty) {
57487
- printJson8(result);
57543
+ printJson(result);
57488
57544
  return;
57489
57545
  }
57490
57546
  const task = result.task;
@@ -57500,9 +57556,9 @@ Queue task: ${taskTitle(task)}`));
57500
57556
  );
57501
57557
  }
57502
57558
  function registerQueueSelect(program3) {
57503
- program3.command("queue:select <id>").description(
57559
+ withTarget(program3.command("queue:select <id>").description(
57504
57560
  "Select and execute a HITL queue action\n Example: elevasis-sdk queue:select <uuid> --action-id approve"
57505
- ).requiredOption("--action-id <id>", "Action ID to select").option("--payload <json>", "Optional action payload as JSON").option("--notes <notes>", "Optional human decision notes").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57561
+ ).requiredOption("--action-id <id>", "Action ID to select").option("--payload <json>", "Optional action payload as JSON").option("--notes <notes>", "Optional human decision notes")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57506
57562
  wrapAction(
57507
57563
  "queue:select",
57508
57564
  async (id, options) => {
@@ -57517,7 +57573,7 @@ function registerQueueSelect(program3) {
57517
57573
  apiUrl
57518
57574
  );
57519
57575
  if (!options.pretty) {
57520
- printJson8(result);
57576
+ printJson(result);
57521
57577
  return;
57522
57578
  }
57523
57579
  console.log(source_default.green(`
@@ -57529,7 +57585,7 @@ Selected action ${options.actionId} for queue task ${id}.`));
57529
57585
  );
57530
57586
  }
57531
57587
  function registerQueueExpire(program3) {
57532
- program3.command("queue:expire <id>").description("Mark a HITL queue task as expired\n Example: elevasis-sdk queue:expire <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57588
+ withTarget(program3.command("queue:expire <id>").description("Mark a HITL queue task as expired\n Example: elevasis-sdk queue:expire <uuid>")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57533
57589
  wrapAction("queue:expire", async (id, options) => {
57534
57590
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57535
57591
  const result = await apiPatch(
@@ -57538,7 +57594,7 @@ function registerQueueExpire(program3) {
57538
57594
  apiUrl
57539
57595
  );
57540
57596
  if (!options.pretty) {
57541
- printJson8(result);
57597
+ printJson(result);
57542
57598
  return;
57543
57599
  }
57544
57600
  console.log(source_default.green(`
@@ -57549,7 +57605,7 @@ Expired queue task ${id}.`));
57549
57605
  );
57550
57606
  }
57551
57607
  function registerQueueStatus(program3) {
57552
- program3.command("queue:status").description("Show HITL queue checkpoint and status counts").option("--time-range <range>", "Filter by created time range: 1h | 24h | 7d | 30d").option("--priority-min <number>", "Minimum priority, 1-10").option("--priority-max <number>", "Maximum priority, 1-10").option("--status <status>", "Filter checkpoint totals by status: pending | completed | expired").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57608
+ withTarget(program3.command("queue:status").description("Show HITL queue checkpoint and status counts").option("--time-range <range>", "Filter by created time range: 1h | 24h | 7d | 30d").option("--priority-min <number>", "Minimum priority, 1-10").option("--priority-max <number>", "Maximum priority, 1-10").option("--status <status>", "Filter checkpoint totals by status: pending | completed | expired")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57553
57609
  wrapAction(
57554
57610
  "queue:status",
57555
57611
  async (options) => {
@@ -57564,7 +57620,7 @@ function registerQueueStatus(program3) {
57564
57620
  apiUrl
57565
57621
  );
57566
57622
  if (!options.pretty) {
57567
- printJson8(result);
57623
+ printJson(result);
57568
57624
  return;
57569
57625
  }
57570
57626
  console.log(source_default.cyan("\nQueue status"));
@@ -57604,9 +57660,6 @@ init_source();
57604
57660
  init_api_client();
57605
57661
  init_config2();
57606
57662
  init_wrap_action();
57607
- function printJson9(value) {
57608
- console.log(JSON.stringify(value, null, 2));
57609
- }
57610
57663
  function appendQuery8(params, key, value) {
57611
57664
  if (value === void 0 || value === null || value === "") return;
57612
57665
  params.set(key, String(value));
@@ -57630,7 +57683,7 @@ function printSchedule(schedule) {
57630
57683
  if (schedule.nextRunAt) console.log(source_default.gray(` Next: ${new Date(schedule.nextRunAt).toLocaleString()}`));
57631
57684
  }
57632
57685
  function registerScheduleList(program3) {
57633
- program3.command("schedule:list").description("List task schedules\n Example: elevasis-sdk schedule:list --status active --pretty").option("--status <status>", "Filter by status: active | paused | completed | cancelled").option("--target-resource-type <type>", "Filter by target resource type: agent | workflow").option("--target-resource-id <id>", "Filter by target resource ID").option("--limit <limit>", "Maximum number of schedules to return").option("--offset <offset>", "Number of schedules to skip").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57686
+ withTarget(program3.command("schedule:list").description("List task schedules\n Example: elevasis-sdk schedule:list --status active --pretty").option("--status <status>", "Filter by status: active | paused | completed | cancelled").option("--target-resource-type <type>", "Filter by target resource type: agent | workflow").option("--target-resource-id <id>", "Filter by target resource ID").option("--limit <limit>", "Maximum number of schedules to return").option("--offset <offset>", "Number of schedules to skip")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57634
57687
  wrapAction(
57635
57688
  "schedule:list",
57636
57689
  async (options) => {
@@ -57646,7 +57699,7 @@ function registerScheduleList(program3) {
57646
57699
  apiUrl
57647
57700
  );
57648
57701
  if (!options.pretty) {
57649
- printJson9(result);
57702
+ printJson(result);
57650
57703
  return;
57651
57704
  }
57652
57705
  if (result.schedules.length === 0) {
@@ -57665,7 +57718,7 @@ Schedules (${result.schedules.length} of ${result.total}):
57665
57718
  );
57666
57719
  }
57667
57720
  function registerScheduleGet(program3) {
57668
- program3.command("schedule:get <id>").description("Get a task schedule\n Example: elevasis-sdk schedule:get <uuid>").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57721
+ withTarget(program3.command("schedule:get <id>").description("Get a task schedule\n Example: elevasis-sdk schedule:get <uuid>")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57669
57722
  wrapAction("schedule:get", async (id, options) => {
57670
57723
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57671
57724
  const result = await apiGet(
@@ -57673,7 +57726,7 @@ function registerScheduleGet(program3) {
57673
57726
  apiUrl
57674
57727
  );
57675
57728
  if (!options.pretty) {
57676
- printJson9(result);
57729
+ printJson(result);
57677
57730
  return;
57678
57731
  }
57679
57732
  console.log(source_default.cyan(`
@@ -57691,10 +57744,10 @@ Schedule: ${result.schedule.name}`));
57691
57744
  );
57692
57745
  }
57693
57746
  function registerScheduleCreate(program3) {
57694
- program3.command("schedule:create").description(
57747
+ withTarget(program3.command("schedule:create").description(
57695
57748
  `Create a task schedule
57696
57749
  Example: elevasis-sdk schedule:create --name "Weekly report" --target-resource-type workflow --target-resource-id weekly-report --schedule-config '{"type":"recurring","interval":"weekly","time":"09:00","timezone":"America/New_York","payload":{}}'`
57697
- ).requiredOption("--name <name>", "Schedule name").option("--description <description>", "Schedule description").requiredOption("--target-resource-type <type>", "Target resource type: agent | workflow").requiredOption("--target-resource-id <id>", "Target resource ID").requiredOption("--schedule-config <json>", "Schedule config JSON").option("--max-retries <number>", "Maximum retry attempts, 0-10").option("--idempotency-key <key>", "Idempotency key").option("--origin-execution-id <uuid>", "Origin execution UUID").option("--origin-resource-type <type>", "Origin resource type").option("--origin-resource-id <id>", "Origin resource ID").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57750
+ ).requiredOption("--name <name>", "Schedule name").option("--description <description>", "Schedule description").requiredOption("--target-resource-type <type>", "Target resource type: agent | workflow").requiredOption("--target-resource-id <id>", "Target resource ID").requiredOption("--schedule-config <json>", "Schedule config JSON").option("--max-retries <number>", "Maximum retry attempts, 0-10").option("--idempotency-key <key>", "Idempotency key").option("--origin-execution-id <uuid>", "Origin execution UUID").option("--origin-resource-type <type>", "Origin resource type").option("--origin-resource-id <id>", "Origin resource ID")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57698
57751
  wrapAction(
57699
57752
  "schedule:create",
57700
57753
  async (options) => {
@@ -57723,7 +57776,7 @@ function registerScheduleCreate(program3) {
57723
57776
  apiUrl
57724
57777
  );
57725
57778
  if (!options.pretty) {
57726
- printJson9(result);
57779
+ printJson(result);
57727
57780
  return;
57728
57781
  }
57729
57782
  console.log(source_default.green(`
@@ -57736,7 +57789,7 @@ Schedule created: ${result.schedule.name}`));
57736
57789
  );
57737
57790
  }
57738
57791
  function registerScheduleUpdate(program3) {
57739
- program3.command("schedule:update <id>").description('Update a task schedule\n Example: elevasis-sdk schedule:update <uuid> --name "New name"').option("--name <name>", "New schedule name").option("--description <description>", "New schedule description").option("--clear-description", "Remove the schedule description").option("--schedule-config <json>", "Replacement schedule config JSON").option("--max-retries <number>", "Maximum retry attempts, 0-10").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57792
+ withTarget(program3.command("schedule:update <id>").description('Update a task schedule\n Example: elevasis-sdk schedule:update <uuid> --name "New name"').option("--name <name>", "New schedule name").option("--description <description>", "New schedule description").option("--clear-description", "Remove the schedule description").option("--schedule-config <json>", "Replacement schedule config JSON").option("--max-retries <number>", "Maximum retry attempts, 0-10")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57740
57793
  wrapAction(
57741
57794
  "schedule:update",
57742
57795
  async (id, options) => {
@@ -57775,7 +57828,7 @@ function registerScheduleUpdate(program3) {
57775
57828
  apiUrl
57776
57829
  );
57777
57830
  if (!options.pretty) {
57778
- printJson9(result);
57831
+ printJson(result);
57779
57832
  return;
57780
57833
  }
57781
57834
  console.log(source_default.green(`
@@ -57788,8 +57841,8 @@ Schedule updated: ${result.schedule.name}`));
57788
57841
  );
57789
57842
  }
57790
57843
  function registerScheduleStatusMutation(program3, commandName, description) {
57791
- program3.command(`schedule:${commandName} <id>`).description(`${description}
57792
- Example: elevasis-sdk schedule:${commandName} <uuid>`).option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57844
+ withTarget(program3.command(`schedule:${commandName} <id>`).description(`${description}
57845
+ Example: elevasis-sdk schedule:${commandName} <uuid>`)).option("--pretty", "Render human-readable output instead of raw JSON").action(
57793
57846
  wrapAction(`schedule:${commandName}`, async (id, options) => {
57794
57847
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57795
57848
  const result = await apiPost(
@@ -57798,7 +57851,7 @@ function registerScheduleStatusMutation(program3, commandName, description) {
57798
57851
  apiUrl
57799
57852
  );
57800
57853
  if (!options.pretty) {
57801
- printJson9(result);
57854
+ printJson(result);
57802
57855
  return;
57803
57856
  }
57804
57857
  const verb = commandName === "pause" ? "paused" : commandName === "resume" ? "resumed" : "cancelled";
@@ -57838,9 +57891,9 @@ init_config2();
57838
57891
  init_api_client();
57839
57892
  var PRIORITY_HELP = "low | normal | high | urgent";
57840
57893
  function registerNoteCreate2(program3) {
57841
- program3.command("note:create").description(
57894
+ withTarget(program3.command("note:create").description(
57842
57895
  'Create a personal note for a user\n Example: elevasis-sdk note:create --content "Deal X stalled" --user agent@example.com'
57843
- ).requiredOption("--content <text>", "Note content").option("--user <email>", "Target user email (required -- the API rejects the call without it)").option("--title <text>", "Optional note title").option("--priority <priority>", `Priority: ${PRIORITY_HELP}`).option("--pinned", "Pin the note to the top of the panel").option("--source <id>", "Source identifier (e.g. workflow or agent ID)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57896
+ ).requiredOption("--content <text>", "Note content").option("--user <email>", "Target user email (required -- the API rejects the call without it)").option("--title <text>", "Optional note title").option("--priority <priority>", `Priority: ${PRIORITY_HELP}`).option("--pinned", "Pin the note to the top of the panel").option("--source <id>", "Source identifier (e.g. workflow or agent ID)")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57844
57897
  wrapAction(
57845
57898
  "note:create",
57846
57899
  async (options) => {
@@ -57870,7 +57923,7 @@ Note created`));
57870
57923
  );
57871
57924
  }
57872
57925
  function registerNoteList2(program3) {
57873
- program3.command("note:list").description("List notes for a user\n Example: elevasis-sdk note:list --user agent@example.com").requiredOption("--user <email>", "User email to list notes for (required by the external API)").option("--priority <priority>", `Filter by priority: ${PRIORITY_HELP}`).option("--pinned", "Return only pinned notes").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
57926
+ withTarget(program3.command("note:list").description("List notes for a user\n Example: elevasis-sdk note:list --user agent@example.com").requiredOption("--user <email>", "User email to list notes for (required by the external API)").option("--priority <priority>", `Filter by priority: ${PRIORITY_HELP}`).option("--pinned", "Return only pinned notes").option("--limit <n>", "Maximum number of results").option("--offset <n>", "Pagination offset")).option("--pretty", "Render human-readable output instead of raw JSON").action(
57874
57927
  wrapAction(
57875
57928
  "note:list",
57876
57929
  async (options) => {
@@ -57919,17 +57972,14 @@ init_wrap_action();
57919
57972
  function getResourceType2(resource) {
57920
57973
  return resource.type ?? resource.resourceType;
57921
57974
  }
57922
- function printJson10(value) {
57923
- console.log(JSON.stringify(value, null, 2));
57924
- }
57925
57975
  function registerAgentList(program3) {
57926
- program3.command("agent:list").description("List deployed agents for your organization").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
57976
+ withTarget(program3.command("agent:list").description("List deployed agents for your organization")).option("--json", "Output as JSON").action(
57927
57977
  wrapAction("agent:list", async (options) => {
57928
57978
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57929
57979
  const result = await apiGet("/api/external/resources", apiUrl);
57930
57980
  const agents = result.resources.filter((resource) => getResourceType2(resource) === "agent");
57931
57981
  if (options.json) {
57932
- printJson10({ agents, total: agents.length });
57982
+ printJson({ agents, total: agents.length });
57933
57983
  return;
57934
57984
  }
57935
57985
  if (agents.length === 0) {
@@ -57952,12 +58002,12 @@ function registerAgentList(program3) {
57952
58002
  );
57953
58003
  }
57954
58004
  function registerAgentGet(program3) {
57955
- program3.command("agent:get <id>").description("Get full agent metadata and organization model linkage").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58005
+ withTarget(program3.command("agent:get <id>").description("Get full agent metadata and organization model linkage")).option("--json", "Output as JSON").action(
57956
58006
  wrapAction("agent:get", async (id, options) => {
57957
58007
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
57958
58008
  const definition = await apiGet(`/api/external/resources/${id}/definition`, apiUrl);
57959
58009
  if (options.json) {
57960
- printJson10(definition);
58010
+ printJson(definition);
57961
58011
  return;
57962
58012
  }
57963
58013
  const config3 = definition.config ?? {};
@@ -57993,9 +58043,6 @@ init_source();
57993
58043
  init_api_client();
57994
58044
  init_config2();
57995
58045
  init_wrap_action();
57996
- function printJson11(value) {
57997
- console.log(JSON.stringify(value, null, 2));
57998
- }
57999
58046
  function appendQuery9(params, key, value) {
58000
58047
  if (value === void 0 || value === null || value === "") return;
58001
58048
  params.set(key, String(value));
@@ -58093,7 +58140,7 @@ function printMessage(message) {
58093
58140
  }
58094
58141
  }
58095
58142
  function registerSessionCreate(program3) {
58096
- program3.command("session:create <resourceId>").description("Create a multi-turn agent session").option("--user-id <id>", "User ID for the session").option("--metadata <json>", "Session metadata as JSON").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58143
+ withTarget(program3.command("session:create <resourceId>").description("Create a multi-turn agent session").option("--user-id <id>", "User ID for the session").option("--metadata <json>", "Session metadata as JSON")).option("--json", "Output as JSON").action(
58097
58144
  wrapAction("session:create", async (resourceId, options) => {
58098
58145
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58099
58146
  const body = { resourceId };
@@ -58101,7 +58148,7 @@ function registerSessionCreate(program3) {
58101
58148
  if (options.metadata) body.metadata = parseJson(options.metadata, "--metadata");
58102
58149
  const session = await apiPost("/api/external/sessions", body, apiUrl);
58103
58150
  if (options.json) {
58104
- printJson11(session);
58151
+ printJson(session);
58105
58152
  return;
58106
58153
  }
58107
58154
  console.log(source_default.green(`Created session ${session.sessionId}.`));
@@ -58112,7 +58159,7 @@ function registerSessionCreate(program3) {
58112
58159
  );
58113
58160
  }
58114
58161
  function registerSessionList(program3) {
58115
- program3.command("session:list").description("List multi-turn agent sessions").option("--resource-id <id>", "Filter by agent resource ID").option("--user-id <id>", "Filter by user ID").option("--limit <limit>", "Maximum number of sessions to return").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58162
+ withTarget(program3.command("session:list").description("List multi-turn agent sessions").option("--resource-id <id>", "Filter by agent resource ID").option("--user-id <id>", "Filter by user ID").option("--limit <limit>", "Maximum number of sessions to return")).option("--json", "Output as JSON").action(
58116
58163
  wrapAction("session:list", async (options) => {
58117
58164
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58118
58165
  const params = new URLSearchParams();
@@ -58121,7 +58168,7 @@ function registerSessionList(program3) {
58121
58168
  appendQuery9(params, "limit", options.limit);
58122
58169
  const result = await apiGet(endpointWithQuery6("/api/external/sessions", params), apiUrl);
58123
58170
  if (options.json) {
58124
- printJson11(result);
58171
+ printJson(result);
58125
58172
  return;
58126
58173
  }
58127
58174
  if (result.sessions.length === 0) {
@@ -58142,12 +58189,12 @@ function registerSessionList(program3) {
58142
58189
  );
58143
58190
  }
58144
58191
  function registerSessionGet(program3) {
58145
- program3.command("session:get <id>").description("Get session details").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58192
+ withTarget(program3.command("session:get <id>").description("Get session details")).option("--json", "Output as JSON").action(
58146
58193
  wrapAction("session:get", async (id, options) => {
58147
58194
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58148
58195
  const session = await apiGet(`/api/external/sessions/${id}`, apiUrl);
58149
58196
  if (options.json) {
58150
- printJson11(session);
58197
+ printJson(session);
58151
58198
  return;
58152
58199
  }
58153
58200
  console.log(source_default.cyan(`Session: ${session.title ?? session.sessionId}`));
@@ -58163,13 +58210,13 @@ function registerSessionGet(program3) {
58163
58210
  );
58164
58211
  }
58165
58212
  function registerSessionTurn(program3) {
58166
- program3.command("session:turn <id>").description("Execute a turn in an active agent session").option("-i, --input <json>", "Turn input as JSON").option("-f, --input-file <path>", "Read turn input from a JSON file").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58213
+ withTarget(program3.command("session:turn <id>").description("Execute a turn in an active agent session").option("-i, --input <json>", "Turn input as JSON").option("-f, --input-file <path>", "Read turn input from a JSON file")).option("--json", "Output as JSON").action(
58167
58214
  wrapAction("session:turn", async (id, options) => {
58168
58215
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58169
58216
  const input = resolveTurnInput(options);
58170
58217
  const result = await apiPost(`/api/external/sessions/${id}/turns`, { input }, apiUrl);
58171
58218
  if (options.json) {
58172
- printJson11(result);
58219
+ printJson(result);
58173
58220
  return;
58174
58221
  }
58175
58222
  console.log(source_default.green(`Turn ${result.turnNumber} complete.`));
@@ -58196,12 +58243,12 @@ function registerSessionTurn(program3) {
58196
58243
  );
58197
58244
  }
58198
58245
  function registerSessionMessages(program3) {
58199
- program3.command("session:messages <id>").description("Export session transcript messages").option("--limit <limit>", "Messages per API page").option("--cursor <cursor>", "Message_index cursor to start after").option("--page", "Fetch one API page instead of the full transcript").option("--all", "Fetch all pages (default)").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58246
+ withTarget(program3.command("session:messages <id>").description("Export session transcript messages").option("--limit <limit>", "Messages per API page").option("--cursor <cursor>", "Message_index cursor to start after").option("--page", "Fetch one API page instead of the full transcript").option("--all", "Fetch all pages (default)")).option("--json", "Output as JSON").action(
58200
58247
  wrapAction("session:messages", async (id, options) => {
58201
58248
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58202
58249
  const result = await fetchSessionMessages(id, apiUrl, options);
58203
58250
  if (options.json) {
58204
- printJson11(result);
58251
+ printJson(result);
58205
58252
  return;
58206
58253
  }
58207
58254
  const total = result.total === void 0 ? result.messages.length : result.total;
@@ -58218,7 +58265,7 @@ function registerSessionMessages(program3) {
58218
58265
  );
58219
58266
  }
58220
58267
  function registerSessionEnd(program3) {
58221
- program3.command("session:end <id>").description("End an active agent session").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58268
+ withTarget(program3.command("session:end <id>").description("End an active agent session")).option("--json", "Output as JSON").action(
58222
58269
  wrapAction("session:end", async (id, options) => {
58223
58270
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58224
58271
  const result = await apiPost(
@@ -58227,7 +58274,7 @@ function registerSessionEnd(program3) {
58227
58274
  apiUrl
58228
58275
  );
58229
58276
  if (options.json) {
58230
- printJson11(result);
58277
+ printJson(result);
58231
58278
  return;
58232
58279
  }
58233
58280
  console.log(source_default.green(`Ended session ${result.sessionId ?? id}.`));
@@ -58250,9 +58297,6 @@ init_source();
58250
58297
  init_api_client();
58251
58298
  init_config2();
58252
58299
  init_wrap_action();
58253
- function printJson12(value) {
58254
- console.log(JSON.stringify(value, null, 2));
58255
- }
58256
58300
  function appendQuery10(params, key, value) {
58257
58301
  if (value === void 0 || value === null || value === "" || value === false) return;
58258
58302
  params.set(key, String(value));
@@ -58314,7 +58358,7 @@ function printGrant(grant) {
58314
58358
  if (grant.disabledAt) console.log(source_default.gray(` Disabled: ${new Date(grant.disabledAt).toLocaleString()}`));
58315
58359
  }
58316
58360
  function registerGrantList(program3) {
58317
- program3.command("grant:list").description("List public/code-gated agent access grants").option("--resource-id <id>", "Filter by agent resource ID").option("--include-disabled", "Include disabled grants").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58361
+ withTarget(program3.command("grant:list").description("List public/code-gated agent access grants").option("--resource-id <id>", "Filter by agent resource ID").option("--include-disabled", "Include disabled grants")).option("--json", "Output as JSON").action(
58318
58362
  wrapAction("grant:list", async (options) => {
58319
58363
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58320
58364
  const params = new URLSearchParams();
@@ -58325,7 +58369,7 @@ function registerGrantList(program3) {
58325
58369
  apiUrl
58326
58370
  );
58327
58371
  if (options.json) {
58328
- printJson12(result);
58372
+ printJson(result);
58329
58373
  return;
58330
58374
  }
58331
58375
  if (result.grants.length === 0) {
@@ -58341,7 +58385,7 @@ function registerGrantList(program3) {
58341
58385
  );
58342
58386
  }
58343
58387
  function registerGrantCreate(program3) {
58344
- program3.command("grant:create").description("Create a public/code-gated agent access grant").requiredOption("--resource <id>", "Agent resource ID to expose").option("--slug <slug>", "Public slug; defaults to normalized --resource").option("--mode <mode>", "Access mode: public | code", "public").option("--code <code>", "Access code for --mode code").option("--origins <origins>", "Comma-separated allowed origins; omit for any origin").option("--expires-at <iso>", "ISO timestamp when the grant expires").option("--max-turns <number>", "Maximum turns per public session").option("--max-sessions <number>", "Maximum sessions per visitor").option("--branding <json>", "Branding metadata JSON object").option("--capture-fields <json>", "Capture fields JSON array").option("--tool-policy <json>", "Tool policy JSON object").option("--public-base-url <url>", "Client public app base URL for printed public URL").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58388
+ withTarget(program3.command("grant:create").description("Create a public/code-gated agent access grant").requiredOption("--resource <id>", "Agent resource ID to expose").option("--slug <slug>", "Public slug; defaults to normalized --resource").option("--mode <mode>", "Access mode: public | code", "public").option("--code <code>", "Access code for --mode code").option("--origins <origins>", "Comma-separated allowed origins; omit for any origin").option("--expires-at <iso>", "ISO timestamp when the grant expires").option("--max-turns <number>", "Maximum turns per public session").option("--max-sessions <number>", "Maximum sessions per visitor").option("--branding <json>", "Branding metadata JSON object").option("--capture-fields <json>", "Capture fields JSON array").option("--tool-policy <json>", "Tool policy JSON object").option("--public-base-url <url>", "Client public app base URL for printed public URL")).option("--json", "Output as JSON").action(
58345
58389
  wrapAction("grant:create", async (options) => {
58346
58390
  const mode = options.mode ?? "public";
58347
58391
  if (mode !== "public" && mode !== "code") {
@@ -58373,7 +58417,7 @@ function registerGrantCreate(program3) {
58373
58417
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58374
58418
  const result = await apiPost("/api/external/agent-access-grants", body, apiUrl);
58375
58419
  if (options.json) {
58376
- printJson12(result.grant);
58420
+ printJson(result.grant);
58377
58421
  return;
58378
58422
  }
58379
58423
  console.log(source_default.green(`Created agent access grant ${result.grant.slug}.`));
@@ -58383,7 +58427,7 @@ function registerGrantCreate(program3) {
58383
58427
  );
58384
58428
  }
58385
58429
  function registerGrantUpdate(program3) {
58386
- program3.command("grant:update <slug>").description("Update mutable fields on an existing agent access grant (branding, limits, mode, origins)").option("--mode <mode>", "Access mode: public | code").option("--code <code>", "Access code; required when switching --mode code without an existing code").option("--origins <origins>", "Comma-separated allowed origins (replaces existing)").option("--expires-at <iso>", "ISO timestamp when the grant expires").option("--max-turns <number>", "Maximum turns per public session").option("--max-sessions <number>", "Maximum sessions per visitor").option("--branding <json>", "Branding metadata JSON object (full replace)").option("--capture-fields <json>", "Capture fields JSON array (full replace)").option("--tool-policy <json>", "Tool policy JSON object (full replace)").option("--public-base-url <url>", "Client public app base URL for printed public URL").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58430
+ withTarget(program3.command("grant:update <slug>").description("Update mutable fields on an existing agent access grant (branding, limits, mode, origins)").option("--mode <mode>", "Access mode: public | code").option("--code <code>", "Access code; required when switching --mode code without an existing code").option("--origins <origins>", "Comma-separated allowed origins (replaces existing)").option("--expires-at <iso>", "ISO timestamp when the grant expires").option("--max-turns <number>", "Maximum turns per public session").option("--max-sessions <number>", "Maximum sessions per visitor").option("--branding <json>", "Branding metadata JSON object (full replace)").option("--capture-fields <json>", "Capture fields JSON array (full replace)").option("--tool-policy <json>", "Tool policy JSON object (full replace)").option("--public-base-url <url>", "Client public app base URL for printed public URL")).option("--json", "Output as JSON").action(
58387
58431
  wrapAction("grant:update", async (slug, options) => {
58388
58432
  const body = {};
58389
58433
  if (options.mode !== void 0) {
@@ -58416,7 +58460,7 @@ function registerGrantUpdate(program3) {
58416
58460
  apiUrl
58417
58461
  );
58418
58462
  if (options.json) {
58419
- printJson12(result.grant);
58463
+ printJson(result.grant);
58420
58464
  return;
58421
58465
  }
58422
58466
  console.log(source_default.green(`Updated agent access grant ${result.grant.slug}.`));
@@ -58426,7 +58470,7 @@ function registerGrantUpdate(program3) {
58426
58470
  );
58427
58471
  }
58428
58472
  function registerGrantDisable(program3) {
58429
- program3.command("grant:disable <slug>").description("Disable an agent access grant without deleting it").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API base URL").option("--json", "Output as JSON").action(
58473
+ withTarget(program3.command("grant:disable <slug>").description("Disable an agent access grant without deleting it")).option("--json", "Output as JSON").action(
58430
58474
  wrapAction("grant:disable", async (slug, options) => {
58431
58475
  const apiUrl = resolveApiUrl(options.apiUrl, options.prod);
58432
58476
  const result = await apiPost(
@@ -58435,7 +58479,7 @@ function registerGrantDisable(program3) {
58435
58479
  apiUrl
58436
58480
  );
58437
58481
  if (options.json) {
58438
- printJson12(result.grant);
58482
+ printJson(result.grant);
58439
58483
  return;
58440
58484
  }
58441
58485
  console.log(source_default.green(`Disabled agent access grant ${result.grant.slug}.`));
@@ -58735,6 +58779,13 @@ function mergeOmDoctorDiagnostics(report, extra, options = {}) {
58735
58779
  const summary = summarize(merged);
58736
58780
  return { ...report, ok: summary.error === 0, summary, diagnostics: merged };
58737
58781
  }
58782
+ function requireDeployedUnavailableDiagnostic(unavailableReason) {
58783
+ return {
58784
+ severity: "error",
58785
+ code: "deployed-readiness-unavailable",
58786
+ message: `--require-deployed was set but the deployed-snapshot readiness check did not run: ${unavailableReason}`
58787
+ };
58788
+ }
58738
58789
  function formatDiagnostic(diagnostic) {
58739
58790
  const target = diagnostic.targetId ? ` (${diagnostic.targetId})` : "";
58740
58791
  const source = diagnostic.source ? ` [${diagnostic.source}]` : "";
@@ -58768,10 +58819,16 @@ function formatOmDoctorReport(report) {
58768
58819
 
58769
58820
  // src/cli/commands/om/doctor.ts
58770
58821
  function registerOmDoctorCommand(program3) {
58771
- program3.command("om:doctor").description(
58772
- "Reduced model doctor \u2014 runs 3 of the platform's 5 checks, plus deployed readiness\n Checks: ontology references, knowledge links, rename-orphan hints\n NOT run (monorepo-only): UI-manifest consistency, contract-ref resolution\n Readiness is read from the deployed snapshot; it reports NOT RUN when offline\n Example: elevasis-sdk om:doctor\n Example: elevasis-sdk om:doctor --scope sales.crm\n Example: elevasis-sdk om:doctor --skip-deployed\n Example: elevasis-sdk om:doctor --json"
58773
- ).option("--json", "Output as grouped JSON envelope").option("--scope <systemPath>", "Limit diagnostics to a system path and descendants").option("--skip-deployed", "Structural checks only \u2014 do not ask the API about readiness").option("--prod", "Target production (overrides NODE_ENV=development)").option("--api-url <url>", "API URL").action(
58822
+ withTarget(program3.command("om:doctor").description(
58823
+ "Reduced model doctor \u2014 runs 3 of the platform's 5 checks, plus deployed readiness\n Checks: ontology references, knowledge links, rename-orphan hints\n NOT run (monorepo-only): UI-manifest consistency, contract-ref resolution\n Readiness is read from the deployed snapshot; it reports NOT RUN when offline\n Example: elevasis-sdk om:doctor\n Example: elevasis-sdk om:doctor --scope sales.crm\n Example: elevasis-sdk om:doctor --skip-deployed\n Example: elevasis-sdk om:doctor --require-deployed\n Example: elevasis-sdk om:doctor --json"
58824
+ ).option("--json", "Output as grouped JSON envelope").option("--scope <systemPath>", "Limit diagnostics to a system path and descendants").option("--skip-deployed", "Structural checks only \u2014 do not ask the API about readiness").option(
58825
+ "--require-deployed",
58826
+ "Fail (non-zero exit) if the deployed-snapshot readiness check is unavailable \u2014 API unreachable or no platform key \u2014 instead of the default degraded pass. Opt-in: default behavior is unchanged, and this is rejected together with --skip-deployed."
58827
+ ), { apiUrlDescription: "API URL" }).action(
58774
58828
  wrapAction("om:doctor", async (options) => {
58829
+ if (options.requireDeployed && options.skipDeployed) {
58830
+ throw new Error("--require-deployed and --skip-deployed are mutually exclusive");
58831
+ }
58775
58832
  let report;
58776
58833
  try {
58777
58834
  const projectRoot = getProjectRoot();
@@ -58786,6 +58843,13 @@ function registerOmDoctorCommand(program3) {
58786
58843
  });
58787
58844
  if (readiness.unavailableReason !== void 0) {
58788
58845
  report.sources.readinessUnavailableReason = readiness.unavailableReason;
58846
+ if (options.requireDeployed) {
58847
+ report = mergeOmDoctorDiagnostics(
58848
+ report,
58849
+ [requireDeployedUnavailableDiagnostic(readiness.unavailableReason)],
58850
+ { scope: options.scope }
58851
+ );
58852
+ }
58789
58853
  } else {
58790
58854
  report.sources.readiness = {
58791
58855
  activeDeploymentId: readiness.activeDeploymentId,
@@ -59572,7 +59636,7 @@ function runPreflight() {
59572
59636
  }
59573
59637
  var envPath = findEnvFile();
59574
59638
  if (envPath) {
59575
- const result = (0, import_dotenv.config)({ path: envPath, override: true });
59639
+ const result = (0, import_dotenv.config)({ path: envPath, override: true, quiet: true });
59576
59640
  if (result.error) {
59577
59641
  console.error(source_default.yellow(`\u26A0 Found .env at ${envPath} but failed to load it: ${result.error.message}`));
59578
59642
  }