@coana-tech/cli 14.12.86 → 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`;
@@ -221331,7 +221331,10 @@ var NpmSocketUpgradeManager = class {
221331
221331
  logger.debug("update lockfile error signal", result.error?.signal);
221332
221332
  logger.debug("update lockfile error killed", result.error?.killed);
221333
221333
  logger.debug("update lockfile working directory", lockfileDir);
221334
- logger.debug("update lockfile command", mode === "LOCKFILE_ONLY" ? "npm install --package-lock-only" : "npm install -f --ignore-scripts --no-fund --no-audit --no-progress");
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
+ );
221335
221338
  const errorDetails = [
221336
221339
  `message: ${result.error?.message ?? "Unknown error"}`,
221337
221340
  result.error?.code ? `code: ${result.error.code}` : null,
@@ -221345,7 +221348,6 @@ var NpmSocketUpgradeManager = class {
221345
221348
  artifacts: i3(artifacts),
221346
221349
  message: `Failed to update lockfile: ${errorDetails}`
221347
221350
  });
221348
- throw new Error(`Failed to update lockfile: ${errorDetails}`);
221349
221351
  }
221350
221352
  });
221351
221353
  }
@@ -229596,7 +229598,7 @@ function assertDefined(value2) {
229596
229598
 
229597
229599
  // dist/cli-upgrade-purl.js
229598
229600
  var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN", "NUGET", "GO", "RUST", "PIP", "RUBYGEMS"];
229599
- async function upgradePurl(rootDir, upgrades, artifacts, options, logFile, cliFixRunId) {
229601
+ async function upgradePurl(rootDir, upgrades, artifacts, options, cliFixRunId) {
229600
229602
  if (options.rangeStyle && options.rangeStyle !== "pin") {
229601
229603
  throw new Error('Range style must be "pin"');
229602
229604
  }
@@ -229625,79 +229627,71 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
229625
229627
  if (supportedUpgrades.size === 0) {
229626
229628
  return "fixed-none";
229627
229629
  }
229628
- try {
229629
- const manifestFiles = await fetchManifestFilesFromManifestsTarHash(options.manifestsTarHash);
229630
- const ecosystemToSocketArtifactUpgrades = /* @__PURE__ */ new Map();
229631
- for (const [idx, upgradeVersion] of supportedUpgrades) {
229632
- const artifact = artifacts[idx];
229633
- if (!artifact.name)
229634
- continue;
229635
- if (!artifact.version)
229636
- continue;
229637
- const ecosystem = getAdvisoryEcosystemFromPurlType(artifact.type);
229638
- if (!ecosystem) {
229639
- throw new Error(`CLI Assertion error: Attempting to upgrade a purl from an unsupported ecosystem: ${purlToString(artifact)}.`);
229640
- }
229641
- if (!ecosystemToSocketArtifactUpgrades.has(ecosystem)) {
229642
- ecosystemToSocketArtifactUpgrades.set(ecosystem, /* @__PURE__ */ new Map());
229643
- }
229644
- ecosystemToSocketArtifactUpgrades.get(ecosystem).set(idx, upgradeVersion);
229645
- }
229646
- let anyErrors = false;
229647
- for (const [ecosystem, upgrades2] of ecosystemToSocketArtifactUpgrades) {
229648
- if (options.rangeStyle && !["NPM", "MAVEN", "NUGET", "GO", "RUST", "PIP", "RUBYGEMS"].includes(ecosystem)) {
229649
- logger.warn(`Range style is not supported for ${ecosystem}, skipping upgrades`);
229650
- continue;
229651
- }
229652
- const statusUpdater = (update2) => {
229653
- const statusIcons = {
229654
- success: "\u2705",
229655
- skipped: "\u26AA",
229656
- warn: "\u26A0\uFE0F",
229657
- error: "\u274C"
229658
- };
229659
- logger.info(`${statusIcons[update2.status]} ${update2.message} \u2500 ${relative18(rootDir, resolve40(rootDir, update2.file))}`);
229660
- update2.artifacts.forEach((idx, i7) => {
229661
- logger.info(`${" ".repeat(3)}${i7 === update2.artifacts.length - 1 ? "\u2514\u2500" : "\u251C\u2500"} ${prettyPrintSocketFactArtifactUpgrade(artifacts[idx], upgrades2.get(idx))}`);
229662
- });
229663
- for (const detail of update2.details ?? []) {
229664
- logger.debug(detail);
229665
- }
229666
- if (update2.patch)
229667
- logger.debug(update2.patch);
229668
- if (update2.status === "error")
229669
- anyErrors = true;
229670
- };
229671
- const ctxt = {
229672
- manifestFiles,
229673
- upgrades: upgrades2,
229674
- artifacts,
229675
- rangeStyle: options.rangeStyle,
229676
- // Note! picomatch
229677
- wsFilter: (0, import_picomatch10.default)(options.include?.map((s6) => s6 || ".") ?? [".", "**"], {
229678
- ignore: options.exclude?.map((s6) => s6 || ".")
229679
- }),
229680
- statusUpdater
229681
- };
229682
- 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)}.`);
229683
229641
  }
229684
- if (upgradePurlRunId) {
229685
- await getSocketAPI().finalizeUpgradePurlRun(upgradePurlRunId, "succeeded");
229642
+ if (!ecosystemToSocketArtifactUpgrades.has(ecosystem)) {
229643
+ ecosystemToSocketArtifactUpgrades.set(ecosystem, /* @__PURE__ */ new Map());
229686
229644
  }
229687
- return unsupportedUpgrades.size === 0 && !anyErrors ? "fixed-all" : "fixed-some";
229688
- } catch (error) {
229689
- logger.debug(`Error stack: ${error.stack}`);
229690
- if (upgradePurlRunId) {
229691
- await getSocketAPI().finalizeUpgradePurlRun(
229692
- upgradePurlRunId,
229693
- "error",
229694
- !cliFixRunId ? error.stack : void 0,
229695
- // do not send stack trace and logContent for computeFixes runs, as that will be handled by that command.
229696
- !cliFixRunId && logFile ? await logger.getLogContent(logFile) : void 0
229697
- );
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;
229698
229653
  }
229699
- 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");
229700
229693
  }
229694
+ return unsupportedUpgrades.size === 0 && !anySkipped ? "fixed-all" : "fixed-some";
229701
229695
  }
229702
229696
  const otherModulesCommunicator = new OtherModulesCommunicator(rootDir, options, {
229703
229697
  type: "missing"
@@ -230176,7 +230170,7 @@ async function computeFixesAndUpgradePurls(path2, options, logFile) {
230176
230170
  include: options.include,
230177
230171
  exclude: options.exclude,
230178
230172
  rangeStyle: options.rangeStyle
230179
- }, logFile, autofixRunId) ?? "fixed-all";
230173
+ }, autofixRunId) ?? "fixed-all";
230180
230174
  if (autofixRunId) {
230181
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");
230182
230176
  }
@@ -245922,7 +245916,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
245922
245916
  }
245923
245917
 
245924
245918
  // dist/version.js
245925
- var version2 = "14.12.86";
245919
+ var version2 = "14.12.87";
245926
245920
 
245927
245921
  // dist/cli-core.js
245928
245922
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -246754,6 +246748,7 @@ computeFixesAndUpgradePurlsCmd.name("compute-fixes-and-upgrade-purls").argument(
246754
246748
  await rm2(tmpDir, { recursive: true, force: true });
246755
246749
  } catch (error) {
246756
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`);
246757
246752
  console.error(`More details available in log file: ${logFile}`);
246758
246753
  process.exit(1);
246759
246754
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.86",
3
+ "version": "14.12.87",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {