@coana-tech/cli 14.12.186 → 14.12.188

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/cli.mjs CHANGED
@@ -212096,6 +212096,106 @@ function handleNexeBinaryMode() {
212096
212096
  }
212097
212097
  }
212098
212098
 
212099
+ // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/index.mjs
212100
+ var FORCE_COLOR;
212101
+ var NODE_DISABLE_COLORS;
212102
+ var NO_COLOR;
212103
+ var TERM;
212104
+ var isTTY = true;
212105
+ if (typeof process !== "undefined") {
212106
+ ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
212107
+ isTTY = process.stdout && process.stdout.isTTY;
212108
+ }
212109
+ var $ = {
212110
+ enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY),
212111
+ // modifiers
212112
+ reset: init(0, 0),
212113
+ bold: init(1, 22),
212114
+ dim: init(2, 22),
212115
+ italic: init(3, 23),
212116
+ underline: init(4, 24),
212117
+ inverse: init(7, 27),
212118
+ hidden: init(8, 28),
212119
+ strikethrough: init(9, 29),
212120
+ // colors
212121
+ black: init(30, 39),
212122
+ red: init(31, 39),
212123
+ green: init(32, 39),
212124
+ yellow: init(33, 39),
212125
+ blue: init(34, 39),
212126
+ magenta: init(35, 39),
212127
+ cyan: init(36, 39),
212128
+ white: init(37, 39),
212129
+ gray: init(90, 39),
212130
+ grey: init(90, 39),
212131
+ // background colors
212132
+ bgBlack: init(40, 49),
212133
+ bgRed: init(41, 49),
212134
+ bgGreen: init(42, 49),
212135
+ bgYellow: init(43, 49),
212136
+ bgBlue: init(44, 49),
212137
+ bgMagenta: init(45, 49),
212138
+ bgCyan: init(46, 49),
212139
+ bgWhite: init(47, 49)
212140
+ };
212141
+ function run(arr, str) {
212142
+ let i7 = 0, tmp, beg = "", end2 = "";
212143
+ for (; i7 < arr.length; i7++) {
212144
+ tmp = arr[i7];
212145
+ beg += tmp.open;
212146
+ end2 += tmp.close;
212147
+ if (!!~str.indexOf(tmp.close)) {
212148
+ str = str.replace(tmp.rgx, tmp.close + tmp.open);
212149
+ }
212150
+ }
212151
+ return beg + str + end2;
212152
+ }
212153
+ function chain(has2, keys) {
212154
+ let ctx = { has: has2, keys };
212155
+ ctx.reset = $.reset.bind(ctx);
212156
+ ctx.bold = $.bold.bind(ctx);
212157
+ ctx.dim = $.dim.bind(ctx);
212158
+ ctx.italic = $.italic.bind(ctx);
212159
+ ctx.underline = $.underline.bind(ctx);
212160
+ ctx.inverse = $.inverse.bind(ctx);
212161
+ ctx.hidden = $.hidden.bind(ctx);
212162
+ ctx.strikethrough = $.strikethrough.bind(ctx);
212163
+ ctx.black = $.black.bind(ctx);
212164
+ ctx.red = $.red.bind(ctx);
212165
+ ctx.green = $.green.bind(ctx);
212166
+ ctx.yellow = $.yellow.bind(ctx);
212167
+ ctx.blue = $.blue.bind(ctx);
212168
+ ctx.magenta = $.magenta.bind(ctx);
212169
+ ctx.cyan = $.cyan.bind(ctx);
212170
+ ctx.white = $.white.bind(ctx);
212171
+ ctx.gray = $.gray.bind(ctx);
212172
+ ctx.grey = $.grey.bind(ctx);
212173
+ ctx.bgBlack = $.bgBlack.bind(ctx);
212174
+ ctx.bgRed = $.bgRed.bind(ctx);
212175
+ ctx.bgGreen = $.bgGreen.bind(ctx);
212176
+ ctx.bgYellow = $.bgYellow.bind(ctx);
212177
+ ctx.bgBlue = $.bgBlue.bind(ctx);
212178
+ ctx.bgMagenta = $.bgMagenta.bind(ctx);
212179
+ ctx.bgCyan = $.bgCyan.bind(ctx);
212180
+ ctx.bgWhite = $.bgWhite.bind(ctx);
212181
+ return ctx;
212182
+ }
212183
+ function init(open, close) {
212184
+ let blk = {
212185
+ open: `\x1B[${open}m`,
212186
+ close: `\x1B[${close}m`,
212187
+ rgx: new RegExp(`\\x1b\\[${close}m`, "g")
212188
+ };
212189
+ return function(txt) {
212190
+ if (this !== void 0 && this.has !== void 0) {
212191
+ !!~this.has.indexOf(open) || (this.has.push(open), this.keys.push(blk));
212192
+ return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
212193
+ }
212194
+ return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
212195
+ };
212196
+ }
212197
+ var kleur_default = $;
212198
+
212099
212199
  // ../web-compat-utils/src/ecosystem-support.ts
212100
212200
  var ecosystemToSupport = {
212101
212201
  NPM: {
@@ -234177,6 +234277,14 @@ function assertDefined(value2) {
234177
234277
  }
234178
234278
 
234179
234279
  // dist/cli-upgrade-purl.js
234280
+ var UpgradePurlPartialError = class extends Error {
234281
+ subprojectResults;
234282
+ constructor(message2, subprojectResults) {
234283
+ super(message2);
234284
+ this.subprojectResults = subprojectResults;
234285
+ this.name = "UpgradePurlPartialError";
234286
+ }
234287
+ };
234180
234288
  var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN", "NUGET", "GO", "RUST", "PIP", "RUBYGEMS"];
234181
234289
  async function upgradePurl(rootDir, upgrades, artifacts, options, cliFixRunId) {
234182
234290
  if (options.rangeStyle && options.rangeStyle !== "pin") {
@@ -234226,6 +234334,7 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
234226
234334
  }
234227
234335
  let anyErrors = false;
234228
234336
  let anySkipped = false;
234337
+ const subprojectResults = /* @__PURE__ */ new Map();
234229
234338
  for (const [ecosystem, upgrades2] of ecosystemToSocketArtifactUpgrades) {
234230
234339
  if (options.rangeStyle && !["NPM", "MAVEN", "NUGET", "GO", "RUST", "PIP", "RUBYGEMS"].includes(ecosystem)) {
234231
234340
  logger.warn(`Range style is not supported for ${ecosystem}, skipping upgrades`);
@@ -234251,6 +234360,11 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
234251
234360
  anyErrors = true;
234252
234361
  if (update3.status === "skipped")
234253
234362
  anySkipped = true;
234363
+ if (update3.status === "error") {
234364
+ subprojectResults.set(update3.file, "error");
234365
+ } else if (update3.status === "success" && subprojectResults.get(update3.file) !== "error") {
234366
+ subprojectResults.set(update3.file, "success");
234367
+ }
234254
234368
  };
234255
234369
  const ctxt = {
234256
234370
  manifestFiles,
@@ -234263,13 +234377,22 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
234263
234377
  }),
234264
234378
  statusUpdater
234265
234379
  };
234266
- await applySocketUpgrades(ecosystem, rootDir, ctxt);
234380
+ try {
234381
+ await applySocketUpgrades(ecosystem, rootDir, ctxt);
234382
+ } catch (e) {
234383
+ anyErrors = true;
234384
+ logger.debug(`Error during ${ecosystem} upgrade: ${e.message}`);
234385
+ }
234267
234386
  }
234268
234387
  if (upgradePurlRunId) {
234269
234388
  await getSocketAPI().finalizeUpgradePurlRun(upgradePurlRunId, "succeeded");
234270
234389
  }
234271
234390
  if (anyErrors) {
234272
- throw new Error("Failed to upgrade purls - consult logs for more details");
234391
+ throw new UpgradePurlPartialError("Some workspaces failed to upgrade", subprojectResults);
234392
+ } else if (subprojectResults.size > 0) {
234393
+ const total = subprojectResults.size;
234394
+ console.error(kleur_default.green(`
234395
+ ${total}/${total} workspaces were upgraded successfully.`));
234273
234396
  }
234274
234397
  return unsupportedUpgrades.size === 0 && !anySkipped ? "fixed-all" : "fixed-some";
234275
234398
  }
@@ -234558,108 +234681,6 @@ function prettyApplyFixesTo(applyFixesToOption) {
234558
234681
  import assert16 from "node:assert";
234559
234682
  import { existsSync as existsSync28, writeFileSync as writeFileSync3 } from "fs";
234560
234683
  import { mkdir as mkdir6, writeFile as writeFile15 } from "fs/promises";
234561
-
234562
- // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/index.mjs
234563
- var FORCE_COLOR;
234564
- var NODE_DISABLE_COLORS;
234565
- var NO_COLOR;
234566
- var TERM;
234567
- var isTTY = true;
234568
- if (typeof process !== "undefined") {
234569
- ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
234570
- isTTY = process.stdout && process.stdout.isTTY;
234571
- }
234572
- var $ = {
234573
- enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY),
234574
- // modifiers
234575
- reset: init(0, 0),
234576
- bold: init(1, 22),
234577
- dim: init(2, 22),
234578
- italic: init(3, 23),
234579
- underline: init(4, 24),
234580
- inverse: init(7, 27),
234581
- hidden: init(8, 28),
234582
- strikethrough: init(9, 29),
234583
- // colors
234584
- black: init(30, 39),
234585
- red: init(31, 39),
234586
- green: init(32, 39),
234587
- yellow: init(33, 39),
234588
- blue: init(34, 39),
234589
- magenta: init(35, 39),
234590
- cyan: init(36, 39),
234591
- white: init(37, 39),
234592
- gray: init(90, 39),
234593
- grey: init(90, 39),
234594
- // background colors
234595
- bgBlack: init(40, 49),
234596
- bgRed: init(41, 49),
234597
- bgGreen: init(42, 49),
234598
- bgYellow: init(43, 49),
234599
- bgBlue: init(44, 49),
234600
- bgMagenta: init(45, 49),
234601
- bgCyan: init(46, 49),
234602
- bgWhite: init(47, 49)
234603
- };
234604
- function run(arr, str) {
234605
- let i7 = 0, tmp, beg = "", end2 = "";
234606
- for (; i7 < arr.length; i7++) {
234607
- tmp = arr[i7];
234608
- beg += tmp.open;
234609
- end2 += tmp.close;
234610
- if (!!~str.indexOf(tmp.close)) {
234611
- str = str.replace(tmp.rgx, tmp.close + tmp.open);
234612
- }
234613
- }
234614
- return beg + str + end2;
234615
- }
234616
- function chain(has2, keys) {
234617
- let ctx = { has: has2, keys };
234618
- ctx.reset = $.reset.bind(ctx);
234619
- ctx.bold = $.bold.bind(ctx);
234620
- ctx.dim = $.dim.bind(ctx);
234621
- ctx.italic = $.italic.bind(ctx);
234622
- ctx.underline = $.underline.bind(ctx);
234623
- ctx.inverse = $.inverse.bind(ctx);
234624
- ctx.hidden = $.hidden.bind(ctx);
234625
- ctx.strikethrough = $.strikethrough.bind(ctx);
234626
- ctx.black = $.black.bind(ctx);
234627
- ctx.red = $.red.bind(ctx);
234628
- ctx.green = $.green.bind(ctx);
234629
- ctx.yellow = $.yellow.bind(ctx);
234630
- ctx.blue = $.blue.bind(ctx);
234631
- ctx.magenta = $.magenta.bind(ctx);
234632
- ctx.cyan = $.cyan.bind(ctx);
234633
- ctx.white = $.white.bind(ctx);
234634
- ctx.gray = $.gray.bind(ctx);
234635
- ctx.grey = $.grey.bind(ctx);
234636
- ctx.bgBlack = $.bgBlack.bind(ctx);
234637
- ctx.bgRed = $.bgRed.bind(ctx);
234638
- ctx.bgGreen = $.bgGreen.bind(ctx);
234639
- ctx.bgYellow = $.bgYellow.bind(ctx);
234640
- ctx.bgBlue = $.bgBlue.bind(ctx);
234641
- ctx.bgMagenta = $.bgMagenta.bind(ctx);
234642
- ctx.bgCyan = $.bgCyan.bind(ctx);
234643
- ctx.bgWhite = $.bgWhite.bind(ctx);
234644
- return ctx;
234645
- }
234646
- function init(open, close) {
234647
- let blk = {
234648
- open: `\x1B[${open}m`,
234649
- close: `\x1B[${close}m`,
234650
- rgx: new RegExp(`\\x1b\\[${close}m`, "g")
234651
- };
234652
- return function(txt) {
234653
- if (this !== void 0 && this.has !== void 0) {
234654
- !!~this.has.indexOf(open) || (this.has.push(open), this.keys.push(blk));
234655
- return txt === void 0 ? this : $.enabled ? run(this.keys, txt + "") : txt + "";
234656
- }
234657
- return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt + "") : txt + "";
234658
- };
234659
- }
234660
- var kleur_default = $;
234661
-
234662
- // dist/cli-core.js
234663
234684
  var import_lodash15 = __toESM(require_lodash(), 1);
234664
234685
  import os2 from "os";
234665
234686
  import { join as join34, relative as relative21, resolve as resolve42 } from "path";
@@ -236325,7 +236346,8 @@ function displayWorkspaceDiagnosticsSummaryInternal(diagnosticsEntries, vulns) {
236325
236346
  for (const vuln of vulns) {
236326
236347
  if (vuln.codeAwareScanResult.type === "analysisError") {
236327
236348
  const socketPurlType = getPurlType(vuln.ecosystem);
236328
- const workspaceLabel = `${vuln.subprojectPath} (${socketPurlType})`;
236349
+ const workspace = vuln.subprojectPath === "." && vuln.workspacePath !== "." ? vuln.workspacePath : vuln.subprojectPath;
236350
+ const workspaceLabel = `${workspace} (${socketPurlType})`;
236329
236351
  const errorMessage = vuln.codeAwareScanResult.message ?? "";
236330
236352
  const errorMessageLower = errorMessage.toLowerCase();
236331
236353
  const packageInstallMatch = errorMessage.match(/\[UNABLE_TO_INSTALL_PACKAGE_ERROR\]: ([^\n]{1,500})/);
@@ -251461,7 +251483,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
251461
251483
  }
251462
251484
 
251463
251485
  // dist/version.js
251464
- var version3 = "14.12.186";
251486
+ var version3 = "14.12.188";
251465
251487
 
251466
251488
  // dist/cli-core.js
251467
251489
  var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
@@ -252514,10 +252536,7 @@ computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument(
252514
252536
  }
252515
252537
  await rm3(tmpDir, { recursive: true, force: true });
252516
252538
  } catch (error) {
252517
- console.error(`Failed with error: ${error instanceof Error ? error.message : String(error)}`);
252518
- console.error(`Notice, the updates may have partially succeeded so check your manifest files for changes`);
252519
- console.error(`More details available in log file: ${logFile}`);
252520
- process.exit(1);
252539
+ handleUpgradeError(error, logFile);
252521
252540
  }
252522
252541
  }).configureHelp({ sortOptions: true });
252523
252542
  async function initializeComputeFixesAndUpgradePurls(path9, options) {
@@ -252586,6 +252605,30 @@ var defaultCliOptions = {
252586
252605
  disableAnalyticsSharing: false,
252587
252606
  skipCacheUsage: false
252588
252607
  };
252608
+ function handleUpgradeError(error, logFile) {
252609
+ if (error instanceof UpgradePurlPartialError && error.subprojectResults.size > 0) {
252610
+ const succeeded = [...error.subprojectResults.values()].filter((s6) => s6 === "success").length;
252611
+ const failed = [...error.subprojectResults.entries()].filter(([, s6]) => s6 === "error");
252612
+ const total = error.subprojectResults.size;
252613
+ if (succeeded === 0) {
252614
+ console.error(kleur_default.red(`
252615
+ ${succeeded}/${total} workspaces were upgraded successfully.`));
252616
+ } else {
252617
+ console.error(kleur_default.yellow(`
252618
+ ${succeeded}/${total} workspaces were upgraded successfully.`));
252619
+ }
252620
+ console.error("Failed workspaces:");
252621
+ for (const [path9] of failed) {
252622
+ console.error(` - ${path9 === "." ? ". (root)" : path9}`);
252623
+ }
252624
+ } else {
252625
+ console.error(`Failed with error: ${error instanceof Error ? error.message : String(error)}`);
252626
+ console.error(`Notice, the updates may have partially succeeded so check your manifest files for changes`);
252627
+ }
252628
+ console.error(`
252629
+ More details available in log file: ${logFile}`);
252630
+ process.exit(1);
252631
+ }
252589
252632
  function parseMinimumReleaseAgeToMinutes(minimumReleaseAge) {
252590
252633
  const match2 = minimumReleaseAge.match(/^(\d+)([mhdw])$/);
252591
252634
  if (!match2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.186",
3
+ "version": "14.12.188",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {