@superglue/cli 1.1.10 → 1.1.12

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.js CHANGED
@@ -1742,21 +1742,67 @@ var require_json_schema = __commonJS({
1742
1742
  }
1743
1743
  });
1744
1744
 
1745
+ // ../shared/dist/rbac-utils.js
1746
+ var require_rbac_utils = __commonJS({
1747
+ "../shared/dist/rbac-utils.js"(exports2) {
1748
+ "use strict";
1749
+ Object.defineProperty(exports2, "__esModule", { value: true });
1750
+ exports2.RESERVED_ROLE_NAMES = exports2.RESERVED_ROLE_IDS = exports2.PREDEFINED_ROLE_IDS = void 0;
1751
+ exports2.isCustomRulePermission = isCustomRulePermission;
1752
+ exports2.getSystemRules = getSystemRules;
1753
+ exports2.isPredefinedRole = isPredefinedRole;
1754
+ exports2.isReservedRoleId = isReservedRoleId;
1755
+ exports2.isReservedRoleName = isReservedRoleName;
1756
+ exports2.hasRole = hasRole;
1757
+ exports2.getRoleIds = getRoleIds;
1758
+ exports2.getBaseRole = getBaseRole;
1759
+ exports2.getBaseRoleId = getBaseRoleId;
1760
+ function isCustomRulePermission(p) {
1761
+ return typeof p === "object" && p !== null && "rules" in p;
1762
+ }
1763
+ function getSystemRules(systems2, systemId) {
1764
+ if (systems2 === "ALL" || !systems2[systemId])
1765
+ return [];
1766
+ const p = systems2[systemId];
1767
+ return isCustomRulePermission(p) ? p.rules : [];
1768
+ }
1769
+ exports2.PREDEFINED_ROLE_IDS = ["admin", "member", "enduser"];
1770
+ exports2.RESERVED_ROLE_IDS = ["admin", "member", "enduser", "__admin__"];
1771
+ exports2.RESERVED_ROLE_NAMES = ["member", "end user", "enduser", "admin"];
1772
+ function isPredefinedRole(roleId) {
1773
+ return exports2.PREDEFINED_ROLE_IDS.includes(roleId);
1774
+ }
1775
+ function isReservedRoleId(roleId) {
1776
+ return exports2.RESERVED_ROLE_IDS.includes(roleId);
1777
+ }
1778
+ function isReservedRoleName(name) {
1779
+ return exports2.RESERVED_ROLE_NAMES.includes(name.toLowerCase().trim());
1780
+ }
1781
+ function hasRole(roles, roleId) {
1782
+ return roles.some((r) => r.id === roleId);
1783
+ }
1784
+ function getRoleIds(roles) {
1785
+ return roles.map((r) => r.id);
1786
+ }
1787
+ function getBaseRole(roles) {
1788
+ const baseRoles = roles.filter((r) => r.isBaseRole);
1789
+ return baseRoles.length === 1 ? baseRoles[0] : null;
1790
+ }
1791
+ function getBaseRoleId(roles) {
1792
+ const base = getBaseRole(roles);
1793
+ return base ? base.id : null;
1794
+ }
1795
+ }
1796
+ });
1797
+
1745
1798
  // ../shared/dist/types.js
1746
1799
  var require_types = __commonJS({
1747
1800
  "../shared/dist/types.js"(exports2) {
1748
1801
  "use strict";
1749
1802
  Object.defineProperty(exports2, "__esModule", { value: true });
1750
- exports2.ConfirmationAction = exports2.FileStatus = exports2.DiscoveryRunStatus = exports2.RemoveScope = exports2.FilterAction = exports2.FilterTarget = exports2.RequestSource = exports2.RunStatus = exports2.CredentialMode = exports2.UpsertMode = exports2.LogLevel = exports2.PaginationType = exports2.DecompressionMethod = exports2.AuthType = exports2.FileType = exports2.CacheMode = exports2.HttpMethod = exports2.SupportedFileType = exports2.UserRole = void 0;
1803
+ exports2.SystemAccessLevel = exports2.ConfirmationAction = exports2.FileStatus = exports2.DiscoveryRunStatus = exports2.RemoveScope = exports2.FilterAction = exports2.FilterTarget = exports2.RequestSource = exports2.RunStatus = exports2.CredentialMode = exports2.UpsertMode = exports2.LogLevel = exports2.PaginationType = exports2.DecompressionMethod = exports2.AuthType = exports2.FileType = exports2.CacheMode = exports2.HttpMethod = exports2.SupportedFileType = void 0;
1751
1804
  exports2.isRequestConfig = isRequestConfig;
1752
1805
  exports2.isTransformConfig = isTransformConfig;
1753
- exports2.getToolSystemIds = getToolSystemIds;
1754
- exports2.isProductionSystem = isProductionSystem;
1755
- var UserRole;
1756
- (function(UserRole2) {
1757
- UserRole2["ADMIN"] = "admin";
1758
- UserRole2["MEMBER"] = "member";
1759
- })(UserRole || (exports2.UserRole = UserRole = {}));
1760
1806
  var SupportedFileType;
1761
1807
  (function(SupportedFileType2) {
1762
1808
  SupportedFileType2["JSON"] = "JSON";
@@ -1884,20 +1930,6 @@ var require_types = __commonJS({
1884
1930
  function isTransformConfig(config) {
1885
1931
  return config?.type === "transform";
1886
1932
  }
1887
- function getToolSystemIds(tool) {
1888
- if (!tool.steps)
1889
- return [];
1890
- const ids = /* @__PURE__ */ new Set();
1891
- for (const step of tool.steps) {
1892
- if (step.config && isRequestConfig(step.config) && step.config.systemId) {
1893
- ids.add(step.config.systemId);
1894
- }
1895
- }
1896
- return Array.from(ids);
1897
- }
1898
- function isProductionSystem(system) {
1899
- return system.environment !== "dev";
1900
- }
1901
1933
  var DiscoveryRunStatus;
1902
1934
  (function(DiscoveryRunStatus2) {
1903
1935
  DiscoveryRunStatus2["PENDING"] = "PENDING";
@@ -1922,6 +1954,12 @@ var require_types = __commonJS({
1922
1954
  ConfirmationAction2["OAUTH_SUCCESS"] = "oauth_success";
1923
1955
  ConfirmationAction2["OAUTH_FAILURE"] = "oauth_failure";
1924
1956
  })(ConfirmationAction || (exports2.ConfirmationAction = ConfirmationAction = {}));
1957
+ var SystemAccessLevel;
1958
+ (function(SystemAccessLevel2) {
1959
+ SystemAccessLevel2["NONE"] = "none";
1960
+ SystemAccessLevel2["READ_ONLY"] = "read-only";
1961
+ SystemAccessLevel2["READ_WRITE"] = "read-write";
1962
+ })(SystemAccessLevel || (exports2.SystemAccessLevel = SystemAccessLevel = {}));
1925
1963
  }
1926
1964
  });
1927
1965
 
@@ -6349,12 +6387,12 @@ var init_size = __esm({
6349
6387
  increment,
6350
6388
  maxSize,
6351
6389
  truncatedProps,
6352
- path: path6,
6390
+ path: path7,
6353
6391
  value
6354
6392
  }) => {
6355
6393
  const newSize = size + increment;
6356
6394
  const stop = newSize > maxSize;
6357
- return stop ? { size, stop, truncatedProps: [...truncatedProps, { path: path6, value }] } : { size: newSize, stop, truncatedProps };
6395
+ return stop ? { size, stop, truncatedProps: [...truncatedProps, { path: path7, value }] } : { size: newSize, stop, truncatedProps };
6358
6396
  };
6359
6397
  getValueSize = (value) => getJsonLength(value);
6360
6398
  getArrayItemSize = (empty, indent, depth) => {
@@ -6392,7 +6430,7 @@ var init_prop = __esm({
6392
6430
  truncateProp = ({
6393
6431
  parent,
6394
6432
  truncatedProps,
6395
- path: path6,
6433
+ path: path7,
6396
6434
  increment,
6397
6435
  maxSize,
6398
6436
  key,
@@ -6403,7 +6441,7 @@ var init_prop = __esm({
6403
6441
  depth
6404
6442
  }) => {
6405
6443
  const value = parent[key];
6406
- const pathA = [...path6, key];
6444
+ const pathA = [...path7, key];
6407
6445
  const {
6408
6446
  size: newSize,
6409
6447
  stop,
@@ -6432,7 +6470,7 @@ var init_prop = __esm({
6432
6470
  truncatePropValue = ({
6433
6471
  value,
6434
6472
  truncatedProps,
6435
- path: path6,
6473
+ path: path7,
6436
6474
  maxSize,
6437
6475
  empty,
6438
6476
  size,
@@ -6448,7 +6486,7 @@ var init_prop = __esm({
6448
6486
  } = truncateValue2({
6449
6487
  value,
6450
6488
  truncatedProps,
6451
- path: path6,
6489
+ path: path7,
6452
6490
  size: newSize,
6453
6491
  maxSize,
6454
6492
  indent,
@@ -6474,7 +6512,7 @@ var init_array = __esm({
6474
6512
  truncateArray = ({
6475
6513
  array: array2,
6476
6514
  truncatedProps,
6477
- path: path6,
6515
+ path: path7,
6478
6516
  size,
6479
6517
  maxSize,
6480
6518
  truncateValue: truncateValue2,
@@ -6488,7 +6526,7 @@ var init_array = __esm({
6488
6526
  state = truncateProp({
6489
6527
  parent: array2,
6490
6528
  truncatedProps: state.truncatedProps,
6491
- path: path6,
6529
+ path: path7,
6492
6530
  increment,
6493
6531
  maxSize,
6494
6532
  key: index,
@@ -6521,7 +6559,7 @@ var init_object = __esm({
6521
6559
  truncateObject = ({
6522
6560
  object: object2,
6523
6561
  truncatedProps,
6524
- path: path6,
6562
+ path: path7,
6525
6563
  size,
6526
6564
  maxSize,
6527
6565
  truncateValue: truncateValue2,
@@ -6540,7 +6578,7 @@ var init_object = __esm({
6540
6578
  state = truncateProp({
6541
6579
  parent: object2,
6542
6580
  truncatedProps: state.truncatedProps,
6543
- path: path6,
6581
+ path: path7,
6544
6582
  increment,
6545
6583
  maxSize,
6546
6584
  key,
@@ -6574,7 +6612,7 @@ var init_value = __esm({
6574
6612
  truncateValue = ({
6575
6613
  value,
6576
6614
  truncatedProps,
6577
- path: path6,
6615
+ path: path7,
6578
6616
  size,
6579
6617
  maxSize,
6580
6618
  indent,
@@ -6590,13 +6628,13 @@ var init_value = __esm({
6590
6628
  increment,
6591
6629
  maxSize,
6592
6630
  truncatedProps,
6593
- path: path6,
6631
+ path: path7,
6594
6632
  value
6595
6633
  });
6596
6634
  return stop ? { value: void 0, size: sizeA, truncatedProps: truncatedPropsA } : recurseValue({
6597
6635
  value,
6598
6636
  truncatedProps: truncatedPropsA,
6599
- path: path6,
6637
+ path: path7,
6600
6638
  size: sizeA,
6601
6639
  maxSize,
6602
6640
  indent,
@@ -6606,7 +6644,7 @@ var init_value = __esm({
6606
6644
  recurseValue = ({
6607
6645
  value,
6608
6646
  truncatedProps,
6609
- path: path6,
6647
+ path: path7,
6610
6648
  size,
6611
6649
  maxSize,
6612
6650
  indent,
@@ -6618,7 +6656,7 @@ var init_value = __esm({
6618
6656
  return Array.isArray(value) ? truncateArray({
6619
6657
  array: value,
6620
6658
  truncatedProps,
6621
- path: path6,
6659
+ path: path7,
6622
6660
  size,
6623
6661
  maxSize,
6624
6662
  truncateValue,
@@ -6627,7 +6665,7 @@ var init_value = __esm({
6627
6665
  }) : truncateObject({
6628
6666
  object: value,
6629
6667
  truncatedProps,
6630
- path: path6,
6668
+ path: path7,
6631
6669
  size,
6632
6670
  maxSize,
6633
6671
  truncateValue,
@@ -15758,8 +15796,8 @@ var require_CronFileParser = __commonJS({
15758
15796
  * @throws If file cannot be read
15759
15797
  */
15760
15798
  static parseFileSync(filePath) {
15761
- const { readFileSync: readFileSync9 } = require("fs");
15762
- const data = readFileSync9(filePath, "utf8");
15799
+ const { readFileSync: readFileSync10 } = require("fs");
15800
+ const data = readFileSync10(filePath, "utf8");
15763
15801
  return _CronFileParser.#parseContent(data);
15764
15802
  }
15765
15803
  /**
@@ -16386,9 +16424,9 @@ var require_property_expr = __commonJS({
16386
16424
  Cache,
16387
16425
  split: split2,
16388
16426
  normalizePath: normalizePath2,
16389
- setter: function(path6) {
16390
- var parts = normalizePath2(path6);
16391
- return setCache.get(path6) || setCache.set(path6, function setter(obj, value) {
16427
+ setter: function(path7) {
16428
+ var parts = normalizePath2(path7);
16429
+ return setCache.get(path7) || setCache.set(path7, function setter(obj, value) {
16392
16430
  var index = 0;
16393
16431
  var len = parts.length;
16394
16432
  var data = obj;
@@ -16402,9 +16440,9 @@ var require_property_expr = __commonJS({
16402
16440
  data[parts[index]] = value;
16403
16441
  });
16404
16442
  },
16405
- getter: function(path6, safe) {
16406
- var parts = normalizePath2(path6);
16407
- return getCache.get(path6) || getCache.set(path6, function getter2(data) {
16443
+ getter: function(path7, safe) {
16444
+ var parts = normalizePath2(path7);
16445
+ return getCache.get(path7) || getCache.set(path7, function getter2(data) {
16408
16446
  var index = 0, len = parts.length;
16409
16447
  while (index < len) {
16410
16448
  if (data != null || !safe) data = data[parts[index++]];
@@ -16414,24 +16452,24 @@ var require_property_expr = __commonJS({
16414
16452
  });
16415
16453
  },
16416
16454
  join: function(segments) {
16417
- return segments.reduce(function(path6, part) {
16418
- return path6 + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path6 ? "." : "") + part);
16455
+ return segments.reduce(function(path7, part) {
16456
+ return path7 + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path7 ? "." : "") + part);
16419
16457
  }, "");
16420
16458
  },
16421
- forEach: function(path6, cb, thisArg) {
16422
- forEach2(Array.isArray(path6) ? path6 : split2(path6), cb, thisArg);
16459
+ forEach: function(path7, cb, thisArg) {
16460
+ forEach2(Array.isArray(path7) ? path7 : split2(path7), cb, thisArg);
16423
16461
  }
16424
16462
  };
16425
- function normalizePath2(path6) {
16426
- return pathCache.get(path6) || pathCache.set(
16427
- path6,
16428
- split2(path6).map(function(part) {
16463
+ function normalizePath2(path7) {
16464
+ return pathCache.get(path7) || pathCache.set(
16465
+ path7,
16466
+ split2(path7).map(function(part) {
16429
16467
  return part.replace(CLEAN_QUOTES_REGEX, "$2");
16430
16468
  })
16431
16469
  );
16432
16470
  }
16433
- function split2(path6) {
16434
- return path6.match(SPLIT_REGEX) || [""];
16471
+ function split2(path7) {
16472
+ return path7.match(SPLIT_REGEX) || [""];
16435
16473
  }
16436
16474
  function forEach2(parts, iter, thisArg) {
16437
16475
  var len = parts.length, part, idx, isArray, isBracket;
@@ -16469,15 +16507,15 @@ var require_tiny_case = __commonJS({
16469
16507
  var reWords = /[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g;
16470
16508
  var words = (str) => str.match(reWords) || [];
16471
16509
  var upperFirst = (str) => str[0].toUpperCase() + str.slice(1);
16472
- var join6 = (str, d) => words(str).join(d).toLowerCase();
16510
+ var join7 = (str, d) => words(str).join(d).toLowerCase();
16473
16511
  var camelCase2 = (str) => words(str).reduce(
16474
16512
  (acc, next) => `${acc}${!acc ? next.toLowerCase() : next[0].toUpperCase() + next.slice(1).toLowerCase()}`,
16475
16513
  ""
16476
16514
  );
16477
16515
  var pascalCase = (str) => upperFirst(camelCase2(str));
16478
- var snakeCase2 = (str) => join6(str, "_");
16479
- var kebabCase = (str) => join6(str, "-");
16480
- var sentenceCase = (str) => upperFirst(join6(str, " "));
16516
+ var snakeCase2 = (str) => join7(str, "_");
16517
+ var kebabCase = (str) => join7(str, "-");
16518
+ var sentenceCase = (str) => upperFirst(join7(str, " "));
16481
16519
  var titleCase = (str) => words(str).map(upperFirst).join(" ");
16482
16520
  module2.exports = {
16483
16521
  words,
@@ -16637,7 +16675,7 @@ function create$9(key, options) {
16637
16675
  function createValidation(config) {
16638
16676
  function validate({
16639
16677
  value,
16640
- path: path6 = "",
16678
+ path: path7 = "",
16641
16679
  options,
16642
16680
  originalValue,
16643
16681
  schema
@@ -16665,7 +16703,7 @@ function createValidation(config) {
16665
16703
  value,
16666
16704
  originalValue,
16667
16705
  label: schema.spec.label,
16668
- path: overrides.path || path6,
16706
+ path: overrides.path || path7,
16669
16707
  spec: schema.spec,
16670
16708
  disableStackTrace: overrides.disableStackTrace || disableStackTrace
16671
16709
  }, params, overrides.params), resolveOptions);
@@ -16675,7 +16713,7 @@ function createValidation(config) {
16675
16713
  }
16676
16714
  const invalid = abortEarly ? panic : next;
16677
16715
  let ctx = {
16678
- path: path6,
16716
+ path: path7,
16679
16717
  parent,
16680
16718
  type: name,
16681
16719
  from: options.from,
@@ -16729,14 +16767,14 @@ function resolveParams(params, options) {
16729
16767
  function resolveMaybeRef(item, options) {
16730
16768
  return Reference.isRef(item) ? item.getValue(options.value, options.parent, options.context) : item;
16731
16769
  }
16732
- function getIn(schema, path6, value, context = value) {
16770
+ function getIn(schema, path7, value, context = value) {
16733
16771
  let parent, lastPart, lastPartDebug;
16734
- if (!path6) return {
16772
+ if (!path7) return {
16735
16773
  parent,
16736
- parentPath: path6,
16774
+ parentPath: path7,
16737
16775
  schema
16738
16776
  };
16739
- (0, import_property_expr.forEach)(path6, (_part, isBracket, isArray) => {
16777
+ (0, import_property_expr.forEach)(path7, (_part, isBracket, isArray) => {
16740
16778
  let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
16741
16779
  schema = schema.resolve({
16742
16780
  context,
@@ -16748,14 +16786,14 @@ function getIn(schema, path6, value, context = value) {
16748
16786
  if (schema.innerType || isTuple) {
16749
16787
  if (isTuple && !isArray) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${lastPartDebug}" must contain an index to the tuple element, e.g. "${lastPartDebug}[0]"`);
16750
16788
  if (value && idx >= value.length) {
16751
- throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path6}. because there is no value at that index. `);
16789
+ throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path7}. because there is no value at that index. `);
16752
16790
  }
16753
16791
  parent = value;
16754
16792
  value = value && value[idx];
16755
16793
  schema = isTuple ? schema.spec.types[idx] : schema.innerType;
16756
16794
  }
16757
16795
  if (!isArray) {
16758
- if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path6}. (failed at: ${lastPartDebug} which is a type: "${schema.type}")`);
16796
+ if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path7}. (failed at: ${lastPartDebug} which is a type: "${schema.type}")`);
16759
16797
  parent = value;
16760
16798
  value = value && value[part];
16761
16799
  schema = schema.fields[part];
@@ -16769,8 +16807,8 @@ function getIn(schema, path6, value, context = value) {
16769
16807
  parentPath: lastPart
16770
16808
  };
16771
16809
  }
16772
- function reach(obj, path6, value, context) {
16773
- return getIn(obj, path6, value, context).schema;
16810
+ function reach(obj, path7, value, context) {
16811
+ return getIn(obj, path7, value, context).schema;
16774
16812
  }
16775
16813
  function clone(src, seen = /* @__PURE__ */ new Map()) {
16776
16814
  if (isSchema(src) || !src || typeof src !== "object") return src;
@@ -16803,16 +16841,16 @@ function clone(src, seen = /* @__PURE__ */ new Map()) {
16803
16841
  }
16804
16842
  return copy;
16805
16843
  }
16806
- function createStandardPath(path6) {
16807
- if (!(path6 != null && path6.length)) {
16844
+ function createStandardPath(path7) {
16845
+ if (!(path7 != null && path7.length)) {
16808
16846
  return void 0;
16809
16847
  }
16810
16848
  const segments = [];
16811
16849
  let currentSegment = "";
16812
16850
  let inBrackets = false;
16813
16851
  let inQuotes = false;
16814
- for (let i = 0; i < path6.length; i++) {
16815
- const char = path6[i];
16852
+ for (let i = 0; i < path7.length; i++) {
16853
+ const char = path7[i];
16816
16854
  if (char === "[" && !inQuotes) {
16817
16855
  if (currentSegment) {
16818
16856
  segments.push(...currentSegment.split(".").filter(Boolean));
@@ -16852,10 +16890,10 @@ function createStandardPath(path6) {
16852
16890
  return segments;
16853
16891
  }
16854
16892
  function createStandardIssues(error2, parentPath) {
16855
- const path6 = parentPath ? `${parentPath}.${error2.path}` : error2.path;
16893
+ const path7 = parentPath ? `${parentPath}.${error2.path}` : error2.path;
16856
16894
  return error2.errors.map((err) => ({
16857
16895
  message: err,
16858
- path: createStandardPath(path6)
16896
+ path: createStandardPath(path7)
16859
16897
  }));
16860
16898
  }
16861
16899
  function issuesFromValidationError(error2, parentPath) {
@@ -16863,8 +16901,8 @@ function issuesFromValidationError(error2, parentPath) {
16863
16901
  if (!((_error$inner = error2.inner) != null && _error$inner.length) && error2.errors.length) {
16864
16902
  return createStandardIssues(error2, parentPath);
16865
16903
  }
16866
- const path6 = parentPath ? `${parentPath}.${error2.path}` : error2.path;
16867
- return error2.inner.flatMap((err) => issuesFromValidationError(err, path6));
16904
+ const path7 = parentPath ? `${parentPath}.${error2.path}` : error2.path;
16905
+ return error2.inner.flatMap((err) => issuesFromValidationError(err, path7));
16868
16906
  }
16869
16907
  function create$8(spec) {
16870
16908
  return new MixedSchema(spec);
@@ -16932,7 +16970,7 @@ function sortFields(fields, excludedEdges = []) {
16932
16970
  let value = fields[key];
16933
16971
  nodes.add(key);
16934
16972
  if (Reference.isRef(value) && value.isSibling) addNode(value.path, key);
16935
- else if (isSchema(value) && "deps" in value) value.deps.forEach((path6) => addNode(path6, key));
16973
+ else if (isSchema(value) && "deps" in value) value.deps.forEach((path7) => addNode(path7, key));
16936
16974
  }
16937
16975
  return import_toposort.default.array(Array.from(nodes), edges).reverse();
16938
16976
  }
@@ -17059,9 +17097,9 @@ var init_index_esm = __esm({
17059
17097
  _Symbol$toStringTag2 = Symbol.toStringTag;
17060
17098
  ValidationError = class _ValidationError extends Error {
17061
17099
  static formatError(message, params) {
17062
- const path6 = params.label || params.path || "this";
17100
+ const path7 = params.label || params.path || "this";
17063
17101
  params = Object.assign({}, params, {
17064
- path: path6,
17102
+ path: path7,
17065
17103
  originalPath: params.path
17066
17104
  });
17067
17105
  if (typeof message === "string") return message.replace(strReg, (_, key) => printValue(params[key]));
@@ -17107,13 +17145,13 @@ var init_index_esm = __esm({
17107
17145
  oneOf: "${path} must be one of the following values: ${values}",
17108
17146
  notOneOf: "${path} must not be one of the following values: ${values}",
17109
17147
  notType: ({
17110
- path: path6,
17148
+ path: path7,
17111
17149
  type,
17112
17150
  value,
17113
17151
  originalValue
17114
17152
  }) => {
17115
17153
  const castMsg = originalValue != null && originalValue !== value ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : ".";
17116
- return type !== "mixed" ? `${path6} must be a \`${type}\` type, but the final value was: \`${printValue(value, true)}\`` + castMsg : `${path6} must match the configured type. The validated value was: \`${printValue(value, true)}\`` + castMsg;
17154
+ return type !== "mixed" ? `${path7} must be a \`${type}\` type, but the final value was: \`${printValue(value, true)}\`` + castMsg : `${path7} must match the configured type. The validated value was: \`${printValue(value, true)}\`` + castMsg;
17117
17155
  }
17118
17156
  };
17119
17157
  string = {
@@ -17159,14 +17197,14 @@ var init_index_esm = __esm({
17159
17197
  tuple = {
17160
17198
  notType: (params) => {
17161
17199
  const {
17162
- path: path6,
17200
+ path: path7,
17163
17201
  value,
17164
17202
  spec
17165
17203
  } = params;
17166
17204
  const typeLen = spec.types.length;
17167
17205
  if (Array.isArray(value)) {
17168
- if (value.length < typeLen) return `${path6} tuple value has too few items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
17169
- if (value.length > typeLen) return `${path6} tuple value has too many items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
17206
+ if (value.length < typeLen) return `${path7} tuple value has too few items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
17207
+ if (value.length > typeLen) return `${path7} tuple value has too many items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
17170
17208
  }
17171
17209
  return ValidationError.formatError(mixed.notType, params);
17172
17210
  }
@@ -17283,10 +17321,10 @@ var init_index_esm = __esm({
17283
17321
  }
17284
17322
  return description;
17285
17323
  }
17286
- resolveAll(resolve4) {
17324
+ resolveAll(resolve5) {
17287
17325
  let result = [];
17288
17326
  for (const item of this.values()) {
17289
- result.push(resolve4(item));
17327
+ result.push(resolve5(item));
17290
17328
  }
17291
17329
  return result;
17292
17330
  }
@@ -17458,7 +17496,7 @@ attempted value: ${formattedValue}
17458
17496
  }
17459
17497
  _validate(_value, options = {}, panic, next) {
17460
17498
  let {
17461
- path: path6,
17499
+ path: path7,
17462
17500
  originalValue = _value,
17463
17501
  strict = this.spec.strict
17464
17502
  } = options;
@@ -17473,7 +17511,7 @@ attempted value: ${formattedValue}
17473
17511
  if (test) initialTests.push(test);
17474
17512
  }
17475
17513
  this.runTests({
17476
- path: path6,
17514
+ path: path7,
17477
17515
  value,
17478
17516
  originalValue,
17479
17517
  options,
@@ -17483,7 +17521,7 @@ attempted value: ${formattedValue}
17483
17521
  return next(initialErrors, value);
17484
17522
  }
17485
17523
  this.runTests({
17486
- path: path6,
17524
+ path: path7,
17487
17525
  value,
17488
17526
  originalValue,
17489
17527
  options,
@@ -17501,7 +17539,7 @@ attempted value: ${formattedValue}
17501
17539
  tests,
17502
17540
  value,
17503
17541
  originalValue,
17504
- path: path6,
17542
+ path: path7,
17505
17543
  options
17506
17544
  } = runOptions;
17507
17545
  let panicOnce = (arg) => {
@@ -17520,7 +17558,7 @@ attempted value: ${formattedValue}
17520
17558
  let args = {
17521
17559
  value,
17522
17560
  originalValue,
17523
- path: path6,
17561
+ path: path7,
17524
17562
  options,
17525
17563
  schema: this
17526
17564
  };
@@ -17573,12 +17611,12 @@ attempted value: ${formattedValue}
17573
17611
  value
17574
17612
  }));
17575
17613
  let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema.spec.disableStackTrace;
17576
- return new Promise((resolve4, reject) => schema._validate(value, options, (error2, parsed) => {
17614
+ return new Promise((resolve5, reject) => schema._validate(value, options, (error2, parsed) => {
17577
17615
  if (ValidationError.isError(error2)) error2.value = parsed;
17578
17616
  reject(error2);
17579
17617
  }, (errors, validated) => {
17580
17618
  if (errors.length) reject(new ValidationError(errors, validated, void 0, void 0, disableStackTrace));
17581
- else resolve4(validated);
17619
+ else resolve5(validated);
17582
17620
  }));
17583
17621
  }
17584
17622
  validateSync(value, options) {
@@ -17882,15 +17920,15 @@ attempted value: ${formattedValue}
17882
17920
  }
17883
17921
  };
17884
17922
  Schema.prototype.__isYupSchema__ = true;
17885
- for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At`] = function(path6, value, options = {}) {
17923
+ for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At`] = function(path7, value, options = {}) {
17886
17924
  const {
17887
17925
  parent,
17888
17926
  parentPath,
17889
17927
  schema
17890
- } = getIn(this, path6, value, options.context);
17928
+ } = getIn(this, path7, value, options.context);
17891
17929
  return schema[method](parent && parent[parentPath], Object.assign({}, options, {
17892
17930
  parent,
17893
- path: path6
17931
+ path: path7
17894
17932
  }));
17895
17933
  };
17896
17934
  for (const alias of ["equals", "is"]) Schema.prototype[alias] = Schema.prototype.oneOf;
@@ -18372,10 +18410,10 @@ attempted value: ${formattedValue}
18372
18410
  return schema.isType(parsed) ? parsed : value;
18373
18411
  };
18374
18412
  deepHas = (obj, p) => {
18375
- const path6 = [...(0, import_property_expr.normalizePath)(p)];
18376
- if (path6.length === 1) return path6[0] in obj;
18377
- let last = path6.pop();
18378
- let parent = (0, import_property_expr.getter)((0, import_property_expr.join)(path6), true)(obj);
18413
+ const path7 = [...(0, import_property_expr.normalizePath)(p)];
18414
+ if (path7.length === 1) return path7[0] in obj;
18415
+ let last = path7.pop();
18416
+ let parent = (0, import_property_expr.getter)((0, import_property_expr.join)(path7), true)(obj);
18379
18417
  return !!(parent && last in parent);
18380
18418
  };
18381
18419
  isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
@@ -18978,11 +19016,11 @@ attempted value: ${formattedValue}
18978
19016
  validateSync(value, options) {
18979
19017
  return this._resolve(value, options).validateSync(value, options);
18980
19018
  }
18981
- validateAt(path6, value, options) {
18982
- return catchValidationError(() => this._resolve(value, options).validateAt(path6, value, options));
19019
+ validateAt(path7, value, options) {
19020
+ return catchValidationError(() => this._resolve(value, options).validateAt(path7, value, options));
18983
19021
  }
18984
- validateSyncAt(path6, value, options) {
18985
- return this._resolve(value, options).validateSyncAt(path6, value, options);
19022
+ validateSyncAt(path7, value, options) {
19023
+ return this._resolve(value, options).validateSyncAt(path7, value, options);
18986
19024
  }
18987
19025
  isValid(value, options) {
18988
19026
  try {
@@ -20098,7 +20136,6 @@ var require_utils = __commonJS({
20098
20136
  exports2.generateUniqueId = generateUniqueId;
20099
20137
  exports2.waitForSystemProcessing = waitForSystemProcessing;
20100
20138
  exports2.inferJsonSchema = inferJsonSchema;
20101
- exports2.mapUserRole = mapUserRole;
20102
20139
  exports2.resolveOAuthCertAndKey = resolveOAuthCertAndKey;
20103
20140
  exports2.isArrowFunction = isArrowFunction;
20104
20141
  exports2.assertValidArrowFunction = assertValidArrowFunction;
@@ -20115,6 +20152,8 @@ var require_utils = __commonJS({
20115
20152
  exports2.normalizeToolDiffs = normalizeToolDiffs;
20116
20153
  exports2.composeUrl = composeUrl;
20117
20154
  exports2.truncateRunResult = truncateRunResult;
20155
+ exports2.getToolSystemIds = getToolSystemIds;
20156
+ exports2.isProductionSystem = isProductionSystem;
20118
20157
  var json_schema_js_1 = require_json_schema();
20119
20158
  var types_js_1 = require_types();
20120
20159
  var truncate_json_1 = __importDefault((init_main5(), __toCommonJS(main_exports)));
@@ -20347,7 +20386,7 @@ var require_utils = __commonJS({
20347
20386
  const hasPendingDocs = systems2.some((i) => i.documentationPending === true);
20348
20387
  if (!hasPendingDocs)
20349
20388
  return systems2;
20350
- await new Promise((resolve4) => setTimeout(resolve4, 4e3));
20389
+ await new Promise((resolve5) => setTimeout(resolve5, 4e3));
20351
20390
  }
20352
20391
  throw new Error(`Waiting for documentation processing to complete timed out after ${timeoutMs / 1e3} seconds for: ${systemIds.join(", ")}. Please try again in a few minutes.`);
20353
20392
  }
@@ -20364,16 +20403,6 @@ var require_utils = __commonJS({
20364
20403
  }
20365
20404
  return buildArraySchemaFromData(data);
20366
20405
  }
20367
- function mapUserRole(role) {
20368
- switch (role) {
20369
- case "admin":
20370
- return types_js_1.UserRole.ADMIN;
20371
- case "member":
20372
- return types_js_1.UserRole.MEMBER;
20373
- default:
20374
- return types_js_1.UserRole.MEMBER;
20375
- }
20376
- }
20377
20406
  function resolveOAuthCertAndKey(oauthCert, oauthKey) {
20378
20407
  let parsedCert = null;
20379
20408
  let parsedKey = null;
@@ -20606,16 +20635,16 @@ var require_utils = __commonJS({
20606
20635
  function normalizeToolDiffs(diffs) {
20607
20636
  return diffs.map((diff) => normalizeToolDiff(diff));
20608
20637
  }
20609
- function composeUrl(host, path6) {
20638
+ function composeUrl(host, path7) {
20610
20639
  if (!host)
20611
20640
  host = "";
20612
- if (!path6)
20613
- path6 = "";
20641
+ if (!path7)
20642
+ path7 = "";
20614
20643
  if (!/^(https?|postgres(ql)?|ftp(s)?|sftp|smb|file):\/\//i.test(host)) {
20615
20644
  host = `https://${host}`;
20616
20645
  }
20617
20646
  const cleanHost = host.endsWith("/") ? host.slice(0, -1) : host;
20618
- const cleanPath = path6.startsWith("/") ? path6.slice(1) : path6;
20647
+ const cleanPath = path7.startsWith("/") ? path7.slice(1) : path7;
20619
20648
  return `${cleanHost}/${cleanPath}`;
20620
20649
  }
20621
20650
  var detectSystemAuthType = (credentials) => {
@@ -20767,6 +20796,20 @@ var require_utils = __commonJS({
20767
20796
  };
20768
20797
  }
20769
20798
  }
20799
+ function getToolSystemIds(tool) {
20800
+ if (!tool.steps)
20801
+ return [];
20802
+ const ids = /* @__PURE__ */ new Set();
20803
+ for (const step of tool.steps) {
20804
+ if (step.config && (0, types_js_1.isRequestConfig)(step.config) && step.config.systemId) {
20805
+ ids.add(step.config.systemId);
20806
+ }
20807
+ }
20808
+ return Array.from(ids);
20809
+ }
20810
+ function isProductionSystem(system) {
20811
+ return system.environment !== "dev";
20812
+ }
20770
20813
  }
20771
20814
  });
20772
20815
 
@@ -21354,8 +21397,8 @@ var require_superglue_client = __commonJS({
21354
21397
  return true;
21355
21398
  return false;
21356
21399
  }
21357
- async restRequest(method, path6, body, extraHeaders) {
21358
- const url = `${this.apiEndpoint.replace(/\/$/, "")}${path6}`;
21400
+ async restRequest(method, path7, body, extraHeaders) {
21401
+ const url = `${this.apiEndpoint.replace(/\/$/, "")}${path7}`;
21359
21402
  const headers = {
21360
21403
  Authorization: `Bearer ${this.apiKey}`,
21361
21404
  ...extraHeaders
@@ -21433,8 +21476,8 @@ var require_superglue_client = __commonJS({
21433
21476
  * Optionally creates a run record when `createRun` is true.
21434
21477
  */
21435
21478
  async runToolConfig(params) {
21436
- const path6 = params.createRun ? "/v1/tools/run?createRun=true" : "/v1/tools/run";
21437
- const response = await this.restRequest("POST", path6, {
21479
+ const path7 = params.createRun ? "/v1/tools/run?createRun=true" : "/v1/tools/run";
21480
+ const response = await this.restRequest("POST", path7, {
21438
21481
  tool: params.tool,
21439
21482
  payload: params.payload,
21440
21483
  credentials: params.credentials,
@@ -21611,15 +21654,19 @@ var require_superglue_client = __commonJS({
21611
21654
  if (err.message?.includes("404") || err.message?.includes("not found")) {
21612
21655
  return null;
21613
21656
  }
21657
+ if (err.message?.includes("403") || err.message?.includes("not allowed")) {
21658
+ return null;
21659
+ }
21614
21660
  throw err;
21615
21661
  }
21616
21662
  }
21617
21663
  async archiveWorkflow(id, archived = true) {
21618
21664
  return this.upsertWorkflow(id, { archived });
21619
21665
  }
21620
- async listWorkflows(limit = 10, offset = 0) {
21666
+ async listWorkflows(limit = 10, offset = 0, includeArchived = false) {
21621
21667
  const page = Math.floor(offset / limit) + 1;
21622
- const response = await this.restRequest("GET", `/v1/tools?limit=${limit}&page=${page}`);
21668
+ const archiveParam = includeArchived ? "&includeArchived=true" : "";
21669
+ const response = await this.restRequest("GET", `/v1/tools?limit=${limit}&page=${page}${archiveParam}`);
21623
21670
  return { items: response.data, total: response.total };
21624
21671
  }
21625
21672
  async upsertWorkflow(id, input) {
@@ -21657,11 +21704,6 @@ var require_superglue_client = __commonJS({
21657
21704
  const response = await this.restRequest("GET", `/v1/systems?${params.toString()}`);
21658
21705
  return { items: response.data, total: response.total };
21659
21706
  }
21660
- async findRelevantTools(searchTerms) {
21661
- const params = searchTerms ? `?q=${encodeURIComponent(searchTerms)}` : "";
21662
- const response = await this.restRequest("GET", `/v1/tools/search${params}`);
21663
- return response.data;
21664
- }
21665
21707
  async getSystem(id, options) {
21666
21708
  const queryParams = options?.environment ? `?env=${options.environment}` : "";
21667
21709
  const response = await this.restRequest("GET", `/v1/systems/${encodeURIComponent(id)}${queryParams}`);
@@ -21817,6 +21859,7 @@ var require_dist2 = __commonJS({
21817
21859
  Object.defineProperty(exports2, "__esModule", { value: true });
21818
21860
  exports2.SSELogSubscriptionManager = exports2.SuperglueClient = void 0;
21819
21861
  __exportStar(require_json_schema(), exports2);
21862
+ __exportStar(require_rbac_utils(), exports2);
21820
21863
  __exportStar(require_seed_config(), exports2);
21821
21864
  __exportStar(require_templates(), exports2);
21822
21865
  __exportStar(require_type_utils(), exports2);
@@ -21836,7 +21879,7 @@ var require_dist2 = __commonJS({
21836
21879
  });
21837
21880
 
21838
21881
  // src/cli.ts
21839
- var import_commander5 = require("commander");
21882
+ var import_commander6 = require("commander");
21840
21883
 
21841
21884
  // src/config.ts
21842
21885
  var fs = __toESM(require("fs"));
@@ -21922,6 +21965,7 @@ function createClient(config) {
21922
21965
  var fs2 = __toESM(require("fs"));
21923
21966
  var path2 = __toESM(require("path"));
21924
21967
  var os2 = __toESM(require("os"));
21968
+ var import_commander = require("commander");
21925
21969
  var import_shared2 = __toESM(require_dist2());
21926
21970
 
21927
21971
  // src/output.ts
@@ -21934,7 +21978,7 @@ var import_node_util = require("util");
21934
21978
  // package.json
21935
21979
  var package_default = {
21936
21980
  name: "@superglue/cli",
21937
- version: "1.1.10",
21981
+ version: "1.1.12",
21938
21982
  bin: {
21939
21983
  sg: "./dist/cli.js"
21940
21984
  },
@@ -22030,8 +22074,8 @@ function startBackgroundUpdateCheck() {
22030
22074
  async function printUpdateNotification() {
22031
22075
  if (!updateCheckPromise) return;
22032
22076
  try {
22033
- const timeout = new Promise((resolve4) => {
22034
- const timer = setTimeout(() => resolve4(null), 2e3);
22077
+ const timeout = new Promise((resolve5) => {
22078
+ const timer = setTimeout(() => resolve5(null), 2e3);
22035
22079
  timer.unref();
22036
22080
  });
22037
22081
  const latest = await Promise.race([updateCheckPromise, timeout]);
@@ -22355,21 +22399,21 @@ function renderDiffs(diffs) {
22355
22399
  async function prompt(message, defaultValue) {
22356
22400
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
22357
22401
  const suffix = defaultValue ? ` ${c.dim}[${defaultValue}]${c.reset}` : "";
22358
- return new Promise((resolve4) => {
22402
+ return new Promise((resolve5) => {
22359
22403
  rl.question(` ${message}${suffix}: `, (answer) => {
22360
22404
  rl.close();
22361
- resolve4(answer.trim() || defaultValue || "");
22405
+ resolve5(answer.trim() || defaultValue || "");
22362
22406
  });
22363
22407
  });
22364
22408
  }
22365
22409
  async function promptHidden(message) {
22366
- return new Promise((resolve4) => {
22410
+ return new Promise((resolve5) => {
22367
22411
  process.stdout.write(`${message}: `);
22368
22412
  if (!process.stdin.isTTY) {
22369
22413
  const rl = readline.createInterface({ input: process.stdin });
22370
22414
  rl.once("line", (line) => {
22371
22415
  rl.close();
22372
- resolve4(line.trim());
22416
+ resolve5(line.trim());
22373
22417
  });
22374
22418
  return;
22375
22419
  }
@@ -22384,7 +22428,7 @@ async function promptHidden(message) {
22384
22428
  process.stdin.removeListener("data", onData);
22385
22429
  process.stdin.pause();
22386
22430
  process.stdout.write("\n");
22387
- resolve4(input);
22431
+ resolve5(input);
22388
22432
  return;
22389
22433
  } else if (char === "") {
22390
22434
  process.stdin.setRawMode(false);
@@ -22427,7 +22471,7 @@ async function choose(message, options, defaultIndex = 0) {
22427
22471
  ${c.bold}${message}${c.reset} ${c.dim}(\u2191/\u2193 to select, enter to confirm)${c.reset}`
22428
22472
  );
22429
22473
  render();
22430
- return new Promise((resolve4) => {
22474
+ return new Promise((resolve5) => {
22431
22475
  process.stdin.setRawMode(true);
22432
22476
  process.stdin.resume();
22433
22477
  const onData = (ch) => {
@@ -22436,7 +22480,7 @@ async function choose(message, options, defaultIndex = 0) {
22436
22480
  process.stdin.setRawMode(false);
22437
22481
  process.stdin.removeListener("data", onData);
22438
22482
  process.stdin.pause();
22439
- resolve4(selected);
22483
+ resolve5(selected);
22440
22484
  return;
22441
22485
  }
22442
22486
  if (s === "") {
@@ -22459,8 +22503,13 @@ async function choose(message, options, defaultIndex = 0) {
22459
22503
 
22460
22504
  // src/commands/init.ts
22461
22505
  function registerInitCommand(program2) {
22462
- program2.command("init").description("Set up superglue CLI configuration").option("--api-key <key>", "API key (skips interactive prompt)").option("--endpoint <url>", "API endpoint", "https://api.superglue.cloud").option("--web-endpoint <url>", "Web endpoint for OAuth callbacks").option("--output-mode <mode>", "Output mode: stdout or stdout+file", "stdout").option("--output-dir <dir>", "Output directory for stdout+file mode", ".superglue/output").option("--global", "Save config globally (~/.superglue/) instead of locally").action(async (opts) => {
22463
- const isNonInteractive = opts.apiKey || !process.stdin.isTTY;
22506
+ program2.command("init").description("Set up superglue CLI configuration").option("--web-endpoint <url>", "Web endpoint for OAuth callbacks").addOption(
22507
+ new import_commander.Option("--output-mode <mode>", "Output mode: stdout or stdout+file").choices(["stdout", "stdout+file"]).default("stdout")
22508
+ ).option("--output-dir <dir>", "Output directory for stdout+file mode", ".superglue/output").option("--global", "Save config globally (~/.superglue/) instead of locally").action(async function(opts) {
22509
+ const parentOpts = this.parent?.opts() ?? {};
22510
+ const resolvedApiKey = parentOpts.apiKey || process.env.SUPERGLUE_API_KEY;
22511
+ const resolvedEndpoint = parentOpts.endpoint || process.env.SUPERGLUE_API_ENDPOINT;
22512
+ const isNonInteractive = resolvedApiKey || !process.stdin.isTTY;
22464
22513
  let apiKey;
22465
22514
  let endpoint;
22466
22515
  let webEndpoint;
@@ -22468,12 +22517,12 @@ function registerInitCommand(program2) {
22468
22517
  let outputDir;
22469
22518
  let preferLocal;
22470
22519
  if (isNonInteractive) {
22471
- apiKey = opts.apiKey || process.env.SUPERGLUE_API_KEY;
22520
+ apiKey = resolvedApiKey;
22472
22521
  if (!apiKey) {
22473
22522
  error("API key is required (--api-key or SUPERGLUE_API_KEY)");
22474
22523
  process.exit(1);
22475
22524
  }
22476
- endpoint = opts.endpoint;
22525
+ endpoint = resolvedEndpoint || "https://api.superglue.cloud";
22477
22526
  const defaultWeb = endpoint.replace(/:3002\b/, ":3001").replace(/api\.superglue/, "app.superglue");
22478
22527
  webEndpoint = opts.webEndpoint || defaultWeb;
22479
22528
  outputMode = opts.outputMode === "stdout+file" ? "stdout+file" : "stdout";
@@ -22504,7 +22553,10 @@ function registerInitCommand(program2) {
22504
22553
  error("API key is required");
22505
22554
  process.exit(1);
22506
22555
  }
22507
- endpoint = await prompt(" API Endpoint", opts.endpoint);
22556
+ endpoint = await prompt(
22557
+ " API Endpoint",
22558
+ resolvedEndpoint || "https://api.superglue.cloud"
22559
+ );
22508
22560
  const defaultWeb = endpoint.replace(/:3002\b/, ":3001").replace(/api\.superglue/, "app.superglue");
22509
22561
  webEndpoint = await prompt(" Web Endpoint (for OAuth callbacks)", defaultWeb);
22510
22562
  const spin = spinner("Verifying connection...");
@@ -23030,10 +23082,9 @@ function registerFindCommand(parent, getContext2) {
23030
23082
  parent.command("list").description("List all tools").action(async () => {
23031
23083
  const { client } = getContext2();
23032
23084
  try {
23033
- const { items } = await client.listWorkflows(100);
23034
- const tools = items.filter((t) => !t.archived);
23085
+ const { items } = await client.listWorkflows(1e3);
23035
23086
  table(
23036
- tools.map((t) => ({
23087
+ items.map((t) => ({
23037
23088
  id: t.id,
23038
23089
  instruction: (t.instruction || "").slice(0, 60),
23039
23090
  steps: t.steps?.length || 0
@@ -23058,25 +23109,29 @@ function registerFindCommand(parent, getContext2) {
23058
23109
  return;
23059
23110
  }
23060
23111
  const searchQuery = (query || "").trim() || "*";
23061
- if (searchQuery === "*") {
23062
- const { items } = await client.listWorkflows(100);
23063
- const tools = items.filter((t) => !t.archived).map((t) => ({
23112
+ const { items } = await client.listWorkflows(1e3);
23113
+ const filtered = searchQuery === "*" ? items : (() => {
23114
+ const keywords = searchQuery.toLowerCase().split(/\s+/).filter((k) => k.length > 0);
23115
+ const scored = items.map((t) => {
23116
+ const text = [t.id, t.name, t.instruction].filter(Boolean).join(" ").toLowerCase();
23117
+ return {
23118
+ tool: t,
23119
+ score: keywords.filter((kw) => text.includes(kw)).length
23120
+ };
23121
+ });
23122
+ const matches = scored.filter((s) => s.score > 0);
23123
+ if (matches.length === 0) return items;
23124
+ matches.sort((a, b) => b.score - a.score);
23125
+ return matches.map((m) => m.tool);
23126
+ })();
23127
+ output({
23128
+ success: true,
23129
+ tools: filtered.map((t) => ({
23064
23130
  id: t.id,
23065
23131
  instruction: (t.instruction || "").slice(0, 80),
23066
23132
  steps: t.steps?.length || 0
23067
- }));
23068
- output({ success: true, tools });
23069
- } else {
23070
- const tools = await client.findRelevantTools(searchQuery);
23071
- output({
23072
- success: true,
23073
- tools: tools.map((t) => ({
23074
- id: t.id,
23075
- instruction: (t.instruction || "").slice(0, 80),
23076
- steps: t.steps?.length || 0
23077
- }))
23078
- });
23079
- }
23133
+ }))
23134
+ });
23080
23135
  } catch (err) {
23081
23136
  error(err.message);
23082
23137
  process.exit(1);
@@ -23096,7 +23151,7 @@ function registerToolCommands(program2, getContext2) {
23096
23151
 
23097
23152
  // src/commands/system/create.ts
23098
23153
  var fs8 = __toESM(require("fs"));
23099
- var import_commander = require("commander");
23154
+ var import_commander2 = require("commander");
23100
23155
  var import_shared6 = __toESM(require_dist2());
23101
23156
  async function collectSensitiveCredentials(fields) {
23102
23157
  const creds = {};
@@ -23119,7 +23174,7 @@ function registerCreateCommand(parent, getContext2) {
23119
23174
  "--template <id>",
23120
23175
  "Template ID \u2014 auto-fills URL, OAuth config, and credentials. Auto-detected from URL if omitted."
23121
23176
  ).option("--instructions <text>", "Specific instructions").option("--credentials <json>", "Non-sensitive credentials JSON").option("--sensitive-credentials <fields>", "Comma-separated sensitive credential field names").option("--docs-url <url>", "Documentation URL to scrape").option("--openapi-url <url>", "OpenAPI spec URL").addOption(
23122
- new import_commander.Option("--env <environment>", "Environment: dev or prod (default: prod)").choices([
23177
+ new import_commander2.Option("--env <environment>", "Environment: dev or prod (default: prod)").choices([
23123
23178
  "dev",
23124
23179
  "prod"
23125
23180
  ])
@@ -23258,10 +23313,10 @@ ${oauthTemplates}
23258
23313
  }
23259
23314
 
23260
23315
  // src/commands/system/edit.ts
23261
- var import_commander2 = require("commander");
23316
+ var import_commander3 = require("commander");
23262
23317
  function registerEditCommand2(parent, getContext2) {
23263
23318
  parent.command("edit").description("Edit an existing system").requiredOption("--id <id>", "System ID").option("--name <name>", "New name").option("--url <url>", "New URL").option("--instructions <text>", "New specific instructions").option("--credentials <json>", "Non-sensitive credentials JSON to merge").option("--sensitive-credentials <fields>", "Comma-separated sensitive credential field names").option("--scrape-url <url>", "Documentation URL to scrape").option("--scrape-keywords <keywords>", "Space-separated scrape keywords").addOption(
23264
- new import_commander2.Option("--env <environment>", "Environment: dev or prod").choices(["dev", "prod"])
23319
+ new import_commander3.Option("--env <environment>", "Environment: dev or prod").choices(["dev", "prod"])
23265
23320
  ).action(async (opts) => {
23266
23321
  const { client } = getContext2();
23267
23322
  const patchPayload = { id: opts.id };
@@ -23332,7 +23387,7 @@ function registerEditCommand2(parent, getContext2) {
23332
23387
  }
23333
23388
 
23334
23389
  // src/commands/system/find.ts
23335
- var import_commander3 = require("commander");
23390
+ var import_commander4 = require("commander");
23336
23391
  var import_shared7 = __toESM(require_dist2());
23337
23392
  function filterSystemFields(system) {
23338
23393
  const credentialKeys = Object.keys(system.credentials || {});
@@ -23366,7 +23421,7 @@ function registerFindCommand2(parent, getContext2) {
23366
23421
  }
23367
23422
  });
23368
23423
  parent.command("find [query]").description("Find systems by query or exact ID").option("--id <exactId>", "Exact system ID lookup").addOption(
23369
- new import_commander3.Option("--env <environment>", "Environment: dev or prod").choices(["dev", "prod"])
23424
+ new import_commander4.Option("--env <environment>", "Environment: dev or prod").choices(["dev", "prod"])
23370
23425
  ).action(async (query, opts) => {
23371
23426
  const { client } = getContext2();
23372
23427
  try {
@@ -23412,7 +23467,7 @@ function registerFindCommand2(parent, getContext2) {
23412
23467
  }
23413
23468
 
23414
23469
  // src/commands/system/call.ts
23415
- var import_commander4 = require("commander");
23470
+ var import_commander5 = require("commander");
23416
23471
  var import_shared8 = __toESM(require_dist2());
23417
23472
  function registerCallCommand(parent, getContext2) {
23418
23473
  parent.command("call").description("Call a system (API, database, file server)").requiredOption("--url <url>", "Full URL including protocol").option("--system-id <id>", "System ID for credential injection").option("--method <method>", "HTTP method", "GET").option("--headers <json>", "HTTP headers JSON").option("--body <string>", "Request body").option(
@@ -23424,7 +23479,7 @@ function registerCallCommand(parent, getContext2) {
23424
23479
  },
23425
23480
  []
23426
23481
  ).addOption(
23427
- new import_commander4.Option("--env <environment>", "Environment: dev or prod").choices(["dev", "prod"])
23482
+ new import_commander5.Option("--env <environment>", "Environment: dev or prod").choices(["dev", "prod"])
23428
23483
  ).action(async (opts) => {
23429
23484
  const { client } = getContext2();
23430
23485
  const method = opts.method || "GET";
@@ -23850,11 +23905,47 @@ function registerUpdateCommand(program2) {
23850
23905
  });
23851
23906
  }
23852
23907
 
23908
+ // src/commands/skill.ts
23909
+ var fs9 = __toESM(require("fs"));
23910
+ var path6 = __toESM(require("path"));
23911
+ var SKILLS_DIR = fs9.existsSync(path6.resolve(__dirname, "skills/superglue")) ? path6.resolve(__dirname, "skills/superglue") : path6.resolve(__dirname, "../../skills/superglue");
23912
+ function registerSkillCommand(program2) {
23913
+ program2.command("skill").description("Print the superglue skill reference (SKILL.md) for AI agents").argument("[topic]", "Optional topic: references/<topic>.md (e.g. databases, integration)").action((topic) => {
23914
+ const file = topic ? path6.join(SKILLS_DIR, "references", `${topic}.md`) : path6.join(SKILLS_DIR, "SKILL.md");
23915
+ if (!fs9.existsSync(file)) {
23916
+ if (topic) {
23917
+ const refsDir = path6.join(SKILLS_DIR, "references");
23918
+ const available = fs9.existsSync(refsDir) ? fs9.readdirSync(refsDir).filter((f) => f.endsWith(".md")).map((f) => f.replace(".md", "")) : [];
23919
+ error(`Topic not found: ${topic}. Available: ${available.join(", ") || "none"}`);
23920
+ } else {
23921
+ error(`Skill file not found: ${file}`);
23922
+ }
23923
+ process.exit(1);
23924
+ }
23925
+ process.stdout.write(fs9.readFileSync(file, "utf-8"));
23926
+ });
23927
+ }
23928
+
23853
23929
  // src/cli.ts
23854
- var program = new import_commander5.Command();
23930
+ var program = new import_commander6.Command();
23855
23931
  program.name("sg").description("superglue CLI \u2014 build, run, and manage integration tools").version(CLI_VERSION).option("--api-key <key>", "superglue API key").option("--endpoint <url>", "superglue API endpoint").option("--json", "force JSON output").addHelpText(
23856
23932
  "after",
23857
23933
  `
23934
+ IMPORTANT FOR AI AGENTS:
23935
+ Before using the sg CLI, you MUST read the skill reference for complete usage
23936
+ instructions, patterns, and examples:
23937
+
23938
+ sg skill Print the main SKILL.md reference
23939
+ sg skill databases Print the databases reference
23940
+ sg skill integration Print the SDK/REST/webhook reference
23941
+ sg skill file-servers Print the file servers reference
23942
+ sg skill transforms-and-output Print the transforms reference
23943
+ sg skill redis Print the Redis reference
23944
+
23945
+ The main skill reference covers: tool building, system setup, OAuth flows,
23946
+ credential handling, variable syntax, data selectors, and common pitfalls.
23947
+ DO NOT attempt to use sg commands without reading the skill reference first.
23948
+
23858
23949
  All Commands:
23859
23950
  sg init Set up CLI configuration
23860
23951
 
@@ -23883,6 +23974,7 @@ All Commands:
23883
23974
  sg run list [toolId] List runs, optionally filtered by tool
23884
23975
  sg run get <runId> Get details of a specific run
23885
23976
 
23977
+ sg skill [topic] Print skill reference for AI agents
23886
23978
  sg update Update CLI to latest version
23887
23979
  sg update --check Check for available updates
23888
23980
 
@@ -23900,6 +23992,7 @@ var getContext = () => {
23900
23992
  };
23901
23993
  registerInitCommand(program);
23902
23994
  registerUpdateCommand(program);
23995
+ registerSkillCommand(program);
23903
23996
  registerToolCommands(program, getContext);
23904
23997
  registerSystemCommands(program, getContext);
23905
23998
  registerRunCommands(program, getContext);