@coana-tech/cli 14.12.187 → 14.12.189

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";
@@ -236529,9 +236550,45 @@ function displayWorkspaceDiagnosticsSummaryInternal(diagnosticsEntries, vulns) {
236529
236550
  }
236530
236551
 
236531
236552
  // dist/internal/socket-report-socket-dependency-tree.js
236553
+ function filterOrphanedArtifacts(artifacts) {
236554
+ const reachable = /* @__PURE__ */ new Set();
236555
+ const queue = [];
236556
+ for (const artifact of artifacts) {
236557
+ if (artifact.direct) {
236558
+ reachable.add(artifact.id);
236559
+ queue.push(artifact.id);
236560
+ }
236561
+ }
236562
+ const depsById = new Map(artifacts.map((a4) => [a4.id, a4.dependencies ?? []]));
236563
+ while (queue.length > 0) {
236564
+ const id = queue.pop();
236565
+ for (const dep of depsById.get(id) ?? []) {
236566
+ if (!reachable.has(dep)) {
236567
+ reachable.add(dep);
236568
+ queue.push(dep);
236569
+ }
236570
+ }
236571
+ }
236572
+ const removedIds = /* @__PURE__ */ new Set();
236573
+ const filtered = artifacts.filter((a4) => {
236574
+ if (a4.direct || reachable.has(a4.id))
236575
+ return true;
236576
+ removedIds.add(a4.id);
236577
+ return false;
236578
+ });
236579
+ if (removedIds.size > 0) {
236580
+ logger.debug(`Filtered out ${removedIds.size} orphaned component(s) not reachable from any direct dependency`);
236581
+ }
236582
+ return { filtered, removedIds };
236583
+ }
236532
236584
  function toSocketFactsSocketDependencyTree(artifacts, vulnerabilities, tier1ReachabilityScanId, workspaceDiagnostics) {
236585
+ const { filtered: filteredArtifacts, removedIds: orphanedArtifactIds } = filterOrphanedArtifacts(artifacts);
236586
+ artifacts = filteredArtifacts;
236533
236587
  const artifactIdToArtifact = Object.fromEntries(artifacts.map((artifact) => [artifact.id, artifact]));
236534
236588
  for (const vulnerability of vulnerabilities) {
236589
+ if (vulnerability.artifactId && orphanedArtifactIds.has(vulnerability.artifactId)) {
236590
+ continue;
236591
+ }
236535
236592
  const component = artifactIdToArtifact[vulnerability.artifactId];
236536
236593
  if (!component) {
236537
236594
  throw new Error(`Component not found for vulnerability ${vulnerability.purl}`);
@@ -251462,7 +251519,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
251462
251519
  }
251463
251520
 
251464
251521
  // dist/version.js
251465
- var version3 = "14.12.187";
251522
+ var version3 = "14.12.189";
251466
251523
 
251467
251524
  // dist/cli-core.js
251468
251525
  var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
@@ -252515,10 +252572,7 @@ computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument(
252515
252572
  }
252516
252573
  await rm3(tmpDir, { recursive: true, force: true });
252517
252574
  } catch (error) {
252518
- console.error(`Failed with error: ${error instanceof Error ? error.message : String(error)}`);
252519
- console.error(`Notice, the updates may have partially succeeded so check your manifest files for changes`);
252520
- console.error(`More details available in log file: ${logFile}`);
252521
- process.exit(1);
252575
+ handleUpgradeError(error, logFile);
252522
252576
  }
252523
252577
  }).configureHelp({ sortOptions: true });
252524
252578
  async function initializeComputeFixesAndUpgradePurls(path9, options) {
@@ -252587,6 +252641,30 @@ var defaultCliOptions = {
252587
252641
  disableAnalyticsSharing: false,
252588
252642
  skipCacheUsage: false
252589
252643
  };
252644
+ function handleUpgradeError(error, logFile) {
252645
+ if (error instanceof UpgradePurlPartialError && error.subprojectResults.size > 0) {
252646
+ const succeeded = [...error.subprojectResults.values()].filter((s6) => s6 === "success").length;
252647
+ const failed = [...error.subprojectResults.entries()].filter(([, s6]) => s6 === "error");
252648
+ const total = error.subprojectResults.size;
252649
+ if (succeeded === 0) {
252650
+ console.error(kleur_default.red(`
252651
+ ${succeeded}/${total} workspaces were upgraded successfully.`));
252652
+ } else {
252653
+ console.error(kleur_default.yellow(`
252654
+ ${succeeded}/${total} workspaces were upgraded successfully.`));
252655
+ }
252656
+ console.error("Failed workspaces:");
252657
+ for (const [path9] of failed) {
252658
+ console.error(` - ${path9 === "." ? ". (root)" : path9}`);
252659
+ }
252660
+ } else {
252661
+ console.error(`Failed with error: ${error instanceof Error ? error.message : String(error)}`);
252662
+ console.error(`Notice, the updates may have partially succeeded so check your manifest files for changes`);
252663
+ }
252664
+ console.error(`
252665
+ More details available in log file: ${logFile}`);
252666
+ process.exit(1);
252667
+ }
252590
252668
  function parseMinimumReleaseAgeToMinutes(minimumReleaseAge) {
252591
252669
  const match2 = minimumReleaseAge.match(/^(\d+)([mhdw])$/);
252592
252670
  if (!match2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.187",
3
+ "version": "14.12.189",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {