@coana-tech/cli 14.12.1 → 14.12.2

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
@@ -210278,7 +210278,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
210278
210278
  return workspaceDir;
210279
210279
  }
210280
210280
  if (base.endsWith(".txt")) {
210281
- const isWithinProperProject = properPythonProjects.some((properProjectDir) => workspaceDir.startsWith(properProjectDir) && workspaceDir.replace(properProjectDir, "").split(sep5).length <= REQUIREMENTS_FILES_SEARCH_DEPTH2);
210281
+ const isWithinProperProject = properPythonProjects.some((properProjectDir) => (workspaceDir === "." || workspaceDir.startsWith(properProjectDir)) && workspaceDir.replace(properProjectDir, "").split(sep5).length <= REQUIREMENTS_FILES_SEARCH_DEPTH2);
210282
210282
  if (isWithinProperProject) {
210283
210283
  return void 0;
210284
210284
  }
@@ -225583,7 +225583,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
225583
225583
  }
225584
225584
 
225585
225585
  // dist/version.js
225586
- var version2 = "14.12.1";
225586
+ var version2 = "14.12.2";
225587
225587
 
225588
225588
  // dist/cli-core.js
225589
225589
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -226268,6 +226268,7 @@ async function getGitDataToMetadataIfAvailable(rootWorkingDirectory) {
226268
226268
  // dist/cli-upgrade-purl.js
226269
226269
  import { join as join25, relative as relative12 } from "node:path";
226270
226270
  var import_packageurl_js2 = __toESM(require_packageurl_js(), 1);
226271
+ var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN"];
226271
226272
  async function upgradePurl(path2, upgrades, options, logFile, cliFixRunId) {
226272
226273
  logger.initWinstonLogger(options.debug);
226273
226274
  logger.silent = options.silent;
@@ -226281,8 +226282,20 @@ async function upgradePurl(path2, upgrades, options, logFile, cliFixRunId) {
226281
226282
  logger.info(`Upgrading purls for ${path2}:
226282
226283
  ${upgrades.map((upgrade) => ` ${upgrade.purl} -> ${upgrade.upgradeVersion}`).join("\n")}`);
226283
226284
  if (options.manifestsTarHash) {
226285
+ const { supportedUpgrades, unsupportedUpgrades } = upgrades.reduce((acc, upgrade) => {
226286
+ const ecosystem = getAdvisoryEcosystemFromPurl(upgrade.purl);
226287
+ const target = ECOSYSTEMS_WITH_SOCKET_UPGRADES.includes(ecosystem) ? "supportedUpgrades" : "unsupportedUpgrades";
226288
+ acc[target].push(upgrade);
226289
+ return acc;
226290
+ }, { supportedUpgrades: [], unsupportedUpgrades: [] });
226291
+ if (unsupportedUpgrades.length > 0) {
226292
+ logger.warn(`The following upgrades are not supported due to missing support for upgrading their ecosystem: ${unsupportedUpgrades.map((upgrade) => ` ${upgrade.purl} -> ${upgrade.upgradeVersion}`).join("\n")}`);
226293
+ }
226294
+ if (supportedUpgrades.length === 0) {
226295
+ return "fixed-none";
226296
+ }
226284
226297
  try {
226285
- const purlToUpgradeVersion = new Map(upgrades.map((upgrade) => [upgrade.purl, upgrade.upgradeVersion]));
226298
+ const purlToUpgradeVersion = new Map(supportedUpgrades.map((upgrade) => [upgrade.purl, upgrade.upgradeVersion]));
226286
226299
  const { artifacts } = await fetchArtifactsFromSocket(path2, options.manifestsTarHash);
226287
226300
  const ecosystemToSocketArtifactUpgrades = {};
226288
226301
  artifacts.forEach((artifact, idx) => {
@@ -226302,16 +226315,12 @@ ${upgrades.map((upgrade) => ` ${upgrade.purl} -> ${upgrade.upgradeVersion}`).joi
226302
226315
  });
226303
226316
  });
226304
226317
  for (const [ecosystem, upgrades2] of Object.entries(ecosystemToSocketArtifactUpgrades)) {
226305
- if (["NPM", "MAVEN"].includes(ecosystem)) {
226306
- await applySocketUpgrades(ecosystem, path2, upgrades2, artifacts);
226307
- } else {
226308
- logger.warn(`Unsupported ecosystem ${ecosystem} for socket upgrades`);
226309
- }
226318
+ await applySocketUpgrades(ecosystem, path2, upgrades2, artifacts);
226310
226319
  }
226311
226320
  if (upgradePurlRunId) {
226312
226321
  await getSocketAPI().finalizeUpgradePurlRun(upgradePurlRunId, "success");
226313
226322
  }
226314
- return;
226323
+ return unsupportedUpgrades.length === 0 ? "fixed-all" : "fixed-some";
226315
226324
  } catch (error) {
226316
226325
  if (upgradePurlRunId) {
226317
226326
  await getSocketAPI().finalizeUpgradePurlRun(
@@ -226433,16 +226442,16 @@ async function computeFixesAndUpgradePurls(path2, options, logFile) {
226433
226442
  return;
226434
226443
  }
226435
226444
  try {
226436
- await upgradePurl(path2, combinedFixes.map((fix) => ({ purl: fix.purl, upgradeVersion: fix.fixedVersion })), {
226445
+ const applyFixesStatus = await upgradePurl(path2, combinedFixes.map((fix) => ({ purl: fix.purl, upgradeVersion: fix.fixedVersion })), {
226437
226446
  debug: options.debug,
226438
226447
  silent: options.silent,
226439
226448
  runWithoutDocker: options.runWithoutDocker,
226440
226449
  manifestsTarHash: options.manifestsTarHash,
226441
226450
  concurrency: "1",
226442
226451
  globPattern: options.globPattern
226443
- }, autofixRunId);
226452
+ }, autofixRunId) ?? "fixed-all";
226444
226453
  if (autofixRunId) {
226445
- await getSocketAPI().finalizeAutofixRun(autofixRunId, ghsasFailedToFix.length === 0 ? "fixed-all" : ghsasFailedToFix.length === Object.keys(ghsaToVulnerableArtifactIdsToApply).length ? "fixed-none" : "fixed-some");
226454
+ 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");
226446
226455
  }
226447
226456
  } catch (error) {
226448
226457
  if (autofixRunId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.1",
3
+ "version": "14.12.2",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {