@coana-tech/cli 14.12.85 → 14.12.87

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
@@ -221274,7 +221274,7 @@ var NpmSocketUpgradeManager = class {
221274
221274
  const oldFileContent = await readFile16(resolve19(this.rootDir, lockfile2), "utf-8");
221275
221275
  let result;
221276
221276
  if (this.packageLockMatcher(lockfile2)) {
221277
- const command = mode === "LOCKFILE_ONLY" ? cmdt`npm install --package-lock-only` : cmdt`npm install -f --ignore-scripts --no-fund --no-audit --no-progress`;
221277
+ const command = mode === "LOCKFILE_ONLY" ? cmdt`npm install --package-lock-only --loglevel=verbose` : cmdt`npm install -f --ignore-scripts --no-fund --no-audit --no-progress --loglevel=verbose`;
221278
221278
  result = await execNeverFail(command, lockfileDir);
221279
221279
  } else if (this.pnpmLockMatcher(lockfile2)) {
221280
221280
  const command = mode === "LOCKFILE_ONLY" ? cmdt`pnpm install --lockfile-only` : cmdt`pnpm install --ignore-scripts --fix-lockfile --config.confirmModulesPurge=false`;
@@ -221327,13 +221327,27 @@ var NpmSocketUpgradeManager = class {
221327
221327
  } else {
221328
221328
  logger.debug("update lockfile stdout", result.stdout);
221329
221329
  logger.debug("update lockfile stderr", result.stderr);
221330
+ logger.debug("update lockfile error code", result.error?.code);
221331
+ logger.debug("update lockfile error signal", result.error?.signal);
221332
+ logger.debug("update lockfile error killed", result.error?.killed);
221333
+ logger.debug("update lockfile working directory", lockfileDir);
221334
+ logger.debug(
221335
+ "update lockfile command",
221336
+ mode === "LOCKFILE_ONLY" ? "npm install --package-lock-only" : "npm install -f --ignore-scripts --no-fund --no-audit --no-progress"
221337
+ );
221338
+ const errorDetails = [
221339
+ `message: ${result.error?.message ?? "Unknown error"}`,
221340
+ result.error?.code ? `code: ${result.error.code}` : null,
221341
+ result.error?.signal ? `signal: ${result.error.signal}` : null,
221342
+ result.error?.killed ? "killed: true" : null,
221343
+ result.stdout === "" && result.stderr === "" ? "no output produced" : null
221344
+ ].filter(Boolean).join(", ");
221330
221345
  ctxt.statusUpdater?.({
221331
221346
  status: "error",
221332
221347
  file: lockfile2,
221333
221348
  artifacts: i3(artifacts),
221334
- message: `Failed to update lockfile: ${result.error?.message ?? "Unknown error"}`
221349
+ message: `Failed to update lockfile: ${errorDetails}`
221335
221350
  });
221336
- throw new Error(`Failed to update lockfile: ${result.error?.message ?? "Unknown error"}`);
221337
221351
  }
221338
221352
  });
221339
221353
  }
@@ -229584,7 +229598,7 @@ function assertDefined(value2) {
229584
229598
 
229585
229599
  // dist/cli-upgrade-purl.js
229586
229600
  var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN", "NUGET", "GO", "RUST", "PIP", "RUBYGEMS"];
229587
- async function upgradePurl(rootDir, upgrades, artifacts, options, logFile, cliFixRunId) {
229601
+ async function upgradePurl(rootDir, upgrades, artifacts, options, cliFixRunId) {
229588
229602
  if (options.rangeStyle && options.rangeStyle !== "pin") {
229589
229603
  throw new Error('Range style must be "pin"');
229590
229604
  }
@@ -229613,79 +229627,71 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
229613
229627
  if (supportedUpgrades.size === 0) {
229614
229628
  return "fixed-none";
229615
229629
  }
229616
- try {
229617
- const manifestFiles = await fetchManifestFilesFromManifestsTarHash(options.manifestsTarHash);
229618
- const ecosystemToSocketArtifactUpgrades = /* @__PURE__ */ new Map();
229619
- for (const [idx, upgradeVersion] of supportedUpgrades) {
229620
- const artifact = artifacts[idx];
229621
- if (!artifact.name)
229622
- continue;
229623
- if (!artifact.version)
229624
- continue;
229625
- const ecosystem = getAdvisoryEcosystemFromPurlType(artifact.type);
229626
- if (!ecosystem) {
229627
- throw new Error(`CLI Assertion error: Attempting to upgrade a purl from an unsupported ecosystem: ${purlToString(artifact)}.`);
229628
- }
229629
- if (!ecosystemToSocketArtifactUpgrades.has(ecosystem)) {
229630
- ecosystemToSocketArtifactUpgrades.set(ecosystem, /* @__PURE__ */ new Map());
229631
- }
229632
- ecosystemToSocketArtifactUpgrades.get(ecosystem).set(idx, upgradeVersion);
229633
- }
229634
- let anyErrors = false;
229635
- for (const [ecosystem, upgrades2] of ecosystemToSocketArtifactUpgrades) {
229636
- if (options.rangeStyle && !["NPM", "MAVEN", "NUGET", "GO", "RUST", "PIP", "RUBYGEMS"].includes(ecosystem)) {
229637
- logger.warn(`Range style is not supported for ${ecosystem}, skipping upgrades`);
229638
- continue;
229639
- }
229640
- const statusUpdater = (update2) => {
229641
- const statusIcons = {
229642
- success: "\u2705",
229643
- skipped: "\u26AA",
229644
- warn: "\u26A0\uFE0F",
229645
- error: "\u274C"
229646
- };
229647
- logger.info(`${statusIcons[update2.status]} ${update2.message} \u2500 ${relative18(rootDir, resolve40(rootDir, update2.file))}`);
229648
- update2.artifacts.forEach((idx, i7) => {
229649
- logger.info(`${" ".repeat(3)}${i7 === update2.artifacts.length - 1 ? "\u2514\u2500" : "\u251C\u2500"} ${prettyPrintSocketFactArtifactUpgrade(artifacts[idx], upgrades2.get(idx))}`);
229650
- });
229651
- for (const detail of update2.details ?? []) {
229652
- logger.debug(detail);
229653
- }
229654
- if (update2.patch)
229655
- logger.debug(update2.patch);
229656
- if (update2.status === "error")
229657
- anyErrors = true;
229658
- };
229659
- const ctxt = {
229660
- manifestFiles,
229661
- upgrades: upgrades2,
229662
- artifacts,
229663
- rangeStyle: options.rangeStyle,
229664
- // Note! picomatch
229665
- wsFilter: (0, import_picomatch10.default)(options.include?.map((s6) => s6 || ".") ?? [".", "**"], {
229666
- ignore: options.exclude?.map((s6) => s6 || ".")
229667
- }),
229668
- statusUpdater
229669
- };
229670
- await applySocketUpgrades(ecosystem, rootDir, ctxt);
229630
+ const manifestFiles = await fetchManifestFilesFromManifestsTarHash(options.manifestsTarHash);
229631
+ const ecosystemToSocketArtifactUpgrades = /* @__PURE__ */ new Map();
229632
+ for (const [idx, upgradeVersion] of supportedUpgrades) {
229633
+ const artifact = artifacts[idx];
229634
+ if (!artifact.name)
229635
+ continue;
229636
+ if (!artifact.version)
229637
+ continue;
229638
+ const ecosystem = getAdvisoryEcosystemFromPurlType(artifact.type);
229639
+ if (!ecosystem) {
229640
+ throw new Error(`CLI Assertion error: Attempting to upgrade a purl from an unsupported ecosystem: ${purlToString(artifact)}.`);
229671
229641
  }
229672
- if (upgradePurlRunId) {
229673
- await getSocketAPI().finalizeUpgradePurlRun(upgradePurlRunId, "succeeded");
229642
+ if (!ecosystemToSocketArtifactUpgrades.has(ecosystem)) {
229643
+ ecosystemToSocketArtifactUpgrades.set(ecosystem, /* @__PURE__ */ new Map());
229674
229644
  }
229675
- return unsupportedUpgrades.size === 0 && !anyErrors ? "fixed-all" : "fixed-some";
229676
- } catch (error) {
229677
- logger.debug(`Error stack: ${error.stack}`);
229678
- if (upgradePurlRunId) {
229679
- await getSocketAPI().finalizeUpgradePurlRun(
229680
- upgradePurlRunId,
229681
- "error",
229682
- !cliFixRunId ? error.stack : void 0,
229683
- // do not send stack trace and logContent for computeFixes runs, as that will be handled by that command.
229684
- !cliFixRunId && logFile ? await logger.getLogContent(logFile) : void 0
229685
- );
229645
+ ecosystemToSocketArtifactUpgrades.get(ecosystem).set(idx, upgradeVersion);
229646
+ }
229647
+ let anyErrors = false;
229648
+ let anySkipped = false;
229649
+ for (const [ecosystem, upgrades2] of ecosystemToSocketArtifactUpgrades) {
229650
+ if (options.rangeStyle && !["NPM", "MAVEN", "NUGET", "GO", "RUST", "PIP", "RUBYGEMS"].includes(ecosystem)) {
229651
+ logger.warn(`Range style is not supported for ${ecosystem}, skipping upgrades`);
229652
+ continue;
229686
229653
  }
229687
- throw error;
229654
+ const statusUpdater = (update2) => {
229655
+ const statusIcons = {
229656
+ success: "\u2705",
229657
+ skipped: "\u26AA",
229658
+ warn: "\u26A0\uFE0F",
229659
+ error: "\u274C"
229660
+ };
229661
+ logger.info(`${statusIcons[update2.status]} ${update2.message} \u2500 ${relative18(rootDir, resolve40(rootDir, update2.file))}`);
229662
+ update2.artifacts.forEach((idx, i7) => {
229663
+ logger.info(`${" ".repeat(3)}${i7 === update2.artifacts.length - 1 ? "\u2514\u2500" : "\u251C\u2500"} ${prettyPrintSocketFactArtifactUpgrade(artifacts[idx], upgrades2.get(idx))}`);
229664
+ });
229665
+ for (const detail of update2.details ?? []) {
229666
+ logger.debug(detail);
229667
+ }
229668
+ if (update2.patch)
229669
+ logger.debug(update2.patch);
229670
+ if (update2.status === "error")
229671
+ anyErrors = true;
229672
+ if (update2.status === "skipped")
229673
+ anySkipped = true;
229674
+ };
229675
+ const ctxt = {
229676
+ manifestFiles,
229677
+ upgrades: upgrades2,
229678
+ artifacts,
229679
+ rangeStyle: options.rangeStyle,
229680
+ // Note! picomatch
229681
+ wsFilter: (0, import_picomatch10.default)(options.include?.map((s6) => s6 || ".") ?? [".", "**"], {
229682
+ ignore: options.exclude?.map((s6) => s6 || ".")
229683
+ }),
229684
+ statusUpdater
229685
+ };
229686
+ await applySocketUpgrades(ecosystem, rootDir, ctxt);
229687
+ }
229688
+ if (upgradePurlRunId) {
229689
+ await getSocketAPI().finalizeUpgradePurlRun(upgradePurlRunId, "succeeded");
229690
+ }
229691
+ if (anyErrors) {
229692
+ throw new Error("Failed to upgrade purls - consult logs for more details");
229688
229693
  }
229694
+ return unsupportedUpgrades.size === 0 && !anySkipped ? "fixed-all" : "fixed-some";
229689
229695
  }
229690
229696
  const otherModulesCommunicator = new OtherModulesCommunicator(rootDir, options, {
229691
229697
  type: "missing"
@@ -230164,7 +230170,7 @@ async function computeFixesAndUpgradePurls(path2, options, logFile) {
230164
230170
  include: options.include,
230165
230171
  exclude: options.exclude,
230166
230172
  rangeStyle: options.rangeStyle
230167
- }, logFile, autofixRunId) ?? "fixed-all";
230173
+ }, autofixRunId) ?? "fixed-all";
230168
230174
  if (autofixRunId) {
230169
230175
  await getSocketAPI().finalizeAutofixRun(autofixRunId, ghsasFailedToFix.length === 0 && applyFixesStatus === "fixed-all" ? "fixed-all" : ghsasFailedToFix.length === Object.keys(ghsaToVulnerableArtifactIdsToApply).length || applyFixesStatus === "fixed-none" ? "fixed-none" : "fixed-some");
230170
230176
  }
@@ -245910,7 +245916,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
245910
245916
  }
245911
245917
 
245912
245918
  // dist/version.js
245913
- var version2 = "14.12.85";
245919
+ var version2 = "14.12.87";
245914
245920
 
245915
245921
  // dist/cli-core.js
245916
245922
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -246742,6 +246748,7 @@ computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument(
246742
246748
  await rm2(tmpDir, { recursive: true, force: true });
246743
246749
  } catch (error) {
246744
246750
  console.error(`Failed with error: ${error instanceof Error ? error.message : String(error)}`);
246751
+ console.error(`Notice, the updates may have partially succeeded so check your manifest files for changes`);
246745
246752
  console.error(`More details available in log file: ${logFile}`);
246746
246753
  process.exit(1);
246747
246754
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.85",
3
+ "version": "14.12.87",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {