@coana-tech/cli 14.12.86 → 14.12.88

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