@coana-tech/cli 14.12.128 → 14.12.130

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
@@ -14560,8 +14560,8 @@ var require_follow_redirects = __commonJS({
14560
14560
  }
14561
14561
  return parsed;
14562
14562
  }
14563
- function resolveUrl(relative20, base) {
14564
- return useNativeURL ? new URL3(relative20, base) : parseUrl(url2.resolve(base, relative20));
14563
+ function resolveUrl(relative23, base) {
14564
+ return useNativeURL ? new URL3(relative23, base) : parseUrl(url2.resolve(base, relative23));
14565
14565
  }
14566
14566
  function validateUrl(input) {
14567
14567
  if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
@@ -70309,16 +70309,16 @@ var require_lockfile = __commonJS({
70309
70309
  if (process.platform === "win32") {
70310
70310
  yield fsSymlink(src, dest, "junction");
70311
70311
  } else {
70312
- let relative20;
70312
+ let relative23;
70313
70313
  try {
70314
- relative20 = (_path2 || _load_path()).default.relative((_fs || _load_fs()).default.realpathSync((_path2 || _load_path()).default.dirname(dest)), (_fs || _load_fs()).default.realpathSync(src));
70314
+ relative23 = (_path2 || _load_path()).default.relative((_fs || _load_fs()).default.realpathSync((_path2 || _load_path()).default.dirname(dest)), (_fs || _load_fs()).default.realpathSync(src));
70315
70315
  } catch (err) {
70316
70316
  if (err.code !== "ENOENT") {
70317
70317
  throw err;
70318
70318
  }
70319
- relative20 = (_path2 || _load_path()).default.relative((_path2 || _load_path()).default.dirname(dest), src);
70319
+ relative23 = (_path2 || _load_path()).default.relative((_path2 || _load_path()).default.dirname(dest), src);
70320
70320
  }
70321
- yield fsSymlink(relative20 || ".", dest);
70321
+ yield fsSymlink(relative23 || ".", dest);
70322
70322
  }
70323
70323
  });
70324
70324
  return function symlink2(_x24, _x25) {
@@ -70345,17 +70345,17 @@ var require_lockfile = __commonJS({
70345
70345
  _ref28 = _i14.value;
70346
70346
  }
70347
70347
  const name2 = _ref28;
70348
- const relative20 = relativeDir ? (_path2 || _load_path()).default.join(relativeDir, name2) : name2;
70348
+ const relative23 = relativeDir ? (_path2 || _load_path()).default.join(relativeDir, name2) : name2;
70349
70349
  const loc = (_path2 || _load_path()).default.join(dir, name2);
70350
70350
  const stat6 = yield lstat3(loc);
70351
70351
  files.push({
70352
- relative: relative20,
70352
+ relative: relative23,
70353
70353
  basename: name2,
70354
70354
  absolute: loc,
70355
70355
  mtime: +stat6.mtime
70356
70356
  });
70357
70357
  if (stat6.isDirectory()) {
70358
- files = files.concat(yield walk(loc, relative20, ignoreBasenames));
70358
+ files = files.concat(yield walk(loc, relative23, ignoreBasenames));
70359
70359
  }
70360
70360
  }
70361
70361
  return files;
@@ -73599,9 +73599,9 @@ var require_lockfile = __commonJS({
73599
73599
  /* 85 */
73600
73600
  /***/
73601
73601
  function(module3, exports3) {
73602
- module3.exports = function(exec4) {
73602
+ module3.exports = function(exec5) {
73603
73603
  try {
73604
- return !!exec4();
73604
+ return !!exec5();
73605
73605
  } catch (e) {
73606
73606
  return true;
73607
73607
  }
@@ -73733,9 +73733,9 @@ var require_lockfile = __commonJS({
73733
73733
  /* 104 */
73734
73734
  /***/
73735
73735
  function(module3, exports3) {
73736
- module3.exports = function(exec4) {
73736
+ module3.exports = function(exec5) {
73737
73737
  try {
73738
- return { e: false, v: exec4() };
73738
+ return { e: false, v: exec5() };
73739
73739
  } catch (e) {
73740
73740
  return { e: true, v: e };
73741
73741
  }
@@ -75208,7 +75208,7 @@ ${indent3}`);
75208
75208
  });
75209
75209
  } catch (e) {
75210
75210
  }
75211
- module3.exports = function(exec4, skipClosing) {
75211
+ module3.exports = function(exec5, skipClosing) {
75212
75212
  if (!skipClosing && !SAFE_CLOSING) return false;
75213
75213
  var safe = false;
75214
75214
  try {
@@ -75220,7 +75220,7 @@ ${indent3}`);
75220
75220
  arr[ITERATOR] = function() {
75221
75221
  return iter;
75222
75222
  };
75223
- exec4(arr);
75223
+ exec5(arr);
75224
75224
  } catch (e) {
75225
75225
  }
75226
75226
  return safe;
@@ -75543,8 +75543,8 @@ ${indent3}`);
75543
75543
  var USE_NATIVE = !!function() {
75544
75544
  try {
75545
75545
  var promise = $Promise.resolve(1);
75546
- var FakePromise = (promise.constructor = {})[__webpack_require__(13)("species")] = function(exec4) {
75547
- exec4(empty2, empty2);
75546
+ var FakePromise = (promise.constructor = {})[__webpack_require__(13)("species")] = function(exec5) {
75547
+ exec5(empty2, empty2);
75548
75548
  };
75549
75549
  return (isNode2 || typeof PromiseRejectionEvent == "function") && promise.then(empty2) instanceof FakePromise && v8.indexOf("6.6") !== 0 && userAgent.indexOf("Chrome/66") === -1;
75550
75550
  } catch (e) {
@@ -206687,6 +206687,13 @@ async function execNeverFail(cmd, dir, options) {
206687
206687
  childProcess.stdin?.end();
206688
206688
  });
206689
206689
  }
206690
+ async function exec(cmd, dir, options) {
206691
+ const { error, stdout, stderr } = await execNeverFail(cmd, dir, options);
206692
+ if (!error) return { stdout, stderr };
206693
+ error.stdout = stdout;
206694
+ error.stderr = stderr;
206695
+ throw error;
206696
+ }
206690
206697
  async function runCommandResolveStdOut(cmd, dir, options) {
206691
206698
  const { stdout, error } = await execNeverFail(cmd, dir, options);
206692
206699
  if (error) throw error;
@@ -213305,6 +213312,17 @@ async function execNeverFail2(cmd, dir, options) {
213305
213312
  logger.debug(`Command ${formatCmd(cmd, dir)} finished ${result.error ? "with error" : "successfully"}`);
213306
213313
  return result;
213307
213314
  }
213315
+ async function exec2(cmd, dir, options) {
213316
+ logger.debug(`Running command: ${formatCmd(cmd, dir)}`);
213317
+ try {
213318
+ const result = await exec(cmd, dir, options);
213319
+ logger.debug(`Command ${formatCmd(cmd, dir)} finished successfully`);
213320
+ return result;
213321
+ } catch (error) {
213322
+ logger.debug(`Command ${formatCmd(cmd, dir)} finished with error`);
213323
+ throw error;
213324
+ }
213325
+ }
213308
213326
  async function runCommandResolveStdOut2(cmd, dir, options) {
213309
213327
  logger.debug(`Running command: ${formatCmd(cmd, dir)}`);
213310
213328
  try {
@@ -213451,13 +213469,13 @@ var Diff = class {
213451
213469
  editLength++;
213452
213470
  };
213453
213471
  if (callback) {
213454
- (function exec4() {
213472
+ (function exec5() {
213455
213473
  setTimeout(function() {
213456
213474
  if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
213457
213475
  return callback(void 0);
213458
213476
  }
213459
213477
  if (!execEditLength()) {
213460
- exec4();
213478
+ exec5();
213461
213479
  }
213462
213480
  }, 0);
213463
213481
  })();
@@ -219898,7 +219916,7 @@ ${indent(1, indentationSize)}`)}
219898
219916
  import { existsSync as existsSync13 } from "fs";
219899
219917
  import { readFile as readFile18 } from "fs/promises";
219900
219918
  import assert10 from "node:assert";
219901
- import { dirname as dirname14, join as join12, relative as relative7, resolve as resolve25 } from "path";
219919
+ import { dirname as dirname14, join as join12, relative as relative10, resolve as resolve25 } from "path";
219902
219920
 
219903
219921
  // ../utils/src/npm-utils.ts
219904
219922
  import { access as access2, constants as constants2 } from "fs/promises";
@@ -224561,10 +224579,10 @@ var Ignore = class {
224561
224579
  ignored(p3) {
224562
224580
  const fullpath = p3.fullpath();
224563
224581
  const fullpaths = `${fullpath}/`;
224564
- const relative20 = p3.relative() || ".";
224565
- const relatives = `${relative20}/`;
224582
+ const relative23 = p3.relative() || ".";
224583
+ const relatives = `${relative23}/`;
224566
224584
  for (const m4 of this.relative) {
224567
- if (m4.match(relative20) || m4.match(relatives))
224585
+ if (m4.match(relative23) || m4.match(relatives))
224568
224586
  return true;
224569
224587
  }
224570
224588
  for (const m4 of this.absolute) {
@@ -224575,9 +224593,9 @@ var Ignore = class {
224575
224593
  }
224576
224594
  childrenIgnored(p3) {
224577
224595
  const fullpath = p3.fullpath() + "/";
224578
- const relative20 = (p3.relative() || ".") + "/";
224596
+ const relative23 = (p3.relative() || ".") + "/";
224579
224597
  for (const m4 of this.relativeChildren) {
224580
- if (m4.match(relative20))
224598
+ if (m4.match(relative23))
224581
224599
  return true;
224582
224600
  }
224583
224601
  for (const m4 of this.absoluteChildren) {
@@ -225788,7 +225806,7 @@ async function getYarnType(projectDir) {
225788
225806
 
225789
225807
  // ../fixing-management/src/fixing-management/npm/npm-fixing-manager.ts
225790
225808
  import { readFile as readFile15, writeFile as writeFile4 } from "fs/promises";
225791
- import { resolve as resolve21 } from "path";
225809
+ import { relative as relative6, resolve as resolve21 } from "path";
225792
225810
 
225793
225811
  // ../fixing-management/src/fixing-management/npm/npm-ecosystem-fixing-manager.ts
225794
225812
  var NpmEcosystemFixingManager = class {
@@ -225813,7 +225831,12 @@ var NpmEcosystemFixingManager = class {
225813
225831
  signalFixApplied2?.(fixId, this.subprojectPath, workspacePath, vulnerabilityFixes);
225814
225832
  });
225815
225833
  });
225816
- await this.finalizeFixes();
225834
+ try {
225835
+ await this.finalizeFixes();
225836
+ } catch (e) {
225837
+ logCommandOutput({ error: e, stdout: e.stdout ?? "", stderr: e.stderr ?? "" }, "finalizeFixes", this.rootDir);
225838
+ throw e;
225839
+ }
225817
225840
  }
225818
225841
  async applySecurityFixesForWorkspace(workspacePath, fixes, dependencyTree, directDependencyToPackageType) {
225819
225842
  const that = this;
@@ -225867,14 +225890,18 @@ var NpmFixingManager = class extends NpmEcosystemFixingManager {
225867
225890
  }
225868
225891
  }
225869
225892
  async finalizeFixes() {
225870
- logger.info(`Adjusting lock file using \`npm install\``);
225871
- await actuallyRunInstall(void 0, resolve21(this.rootDir, this.subprojectPath));
225893
+ const cmd = cmdt`${await getNpmBin()} install --package-lock-only --ignore-scripts --no-fund --no-audit --no-progress`;
225894
+ logger.info(`Adjusting lock file by running '${cmd}'`);
225895
+ await exec2(cmd, resolve21(this.rootDir, this.subprojectPath));
225896
+ logger.info(
225897
+ `Run 'npm install' in '${relative6(this.rootDir, this.subprojectPath) || "."}' to install the updated dependencies`
225898
+ );
225872
225899
  }
225873
225900
  };
225874
225901
 
225875
225902
  // ../fixing-management/src/fixing-management/npm/pnpm-fixing-manager.ts
225876
225903
  import { readFile as readFile16, writeFile as writeFile5 } from "fs/promises";
225877
- import { resolve as resolve22 } from "path";
225904
+ import { relative as relative7, resolve as resolve22 } from "path";
225878
225905
  var import_yaml = __toESM(require_dist10(), 1);
225879
225906
  var import_lockfile_file2 = __toESM(require_lib25(), 1);
225880
225907
  import { existsSync as existsSync11 } from "fs";
@@ -226006,12 +226033,12 @@ var PnpmFixingManager = class extends NpmEcosystemFixingManager {
226006
226033
  }
226007
226034
  }
226008
226035
  async finalizeFixes() {
226009
- const cmd = cmdt`pnpm install --ignore-scripts --fix-lockfile --config.confirmModulesPurge=false `;
226010
- logger.info(`Adjusting lock file changes by running '${cmd}'`);
226011
- const result = await execAndLogOnFailure2(cmd, resolve22(this.rootDir, this.subprojectPath));
226012
- if (!result) {
226013
- throw new Error(`Failed to install packages`);
226014
- }
226036
+ const cmd = cmdt`pnpm install --lockfile-only --fix-lockfile --config.confirmModulesPurge=false`;
226037
+ logger.info(`Adjusting lock file by running '${cmd}'`);
226038
+ await exec2(cmd, resolve22(this.rootDir, this.subprojectPath));
226039
+ logger.info(
226040
+ `Run 'pnpm install' in '${relative7(this.rootDir, this.subprojectPath) || "."}' to install the updated dependencies`
226041
+ );
226015
226042
  }
226016
226043
  };
226017
226044
  function getVersionNumber(version4) {
@@ -226058,10 +226085,10 @@ function updateCatalog(update3, map2) {
226058
226085
 
226059
226086
  // ../fixing-management/src/fixing-management/npm/yarn-fixing-manager.ts
226060
226087
  import { readFile as readFile17, writeFile as writeFile6 } from "fs/promises";
226061
- import { resolve as resolve24 } from "path";
226088
+ import { relative as relative9, resolve as resolve24 } from "path";
226062
226089
 
226063
226090
  // ../utils/src/package-utils.ts
226064
- import { parse as parse7, join as join11, resolve as resolve23, normalize as normalize3, dirname as dirname13, basename as basename6, relative as relative6 } from "path";
226091
+ import { parse as parse7, join as join11, resolve as resolve23, normalize as normalize3, dirname as dirname13, basename as basename6, relative as relative8 } from "path";
226065
226092
  import { existsSync as existsSync12, readFileSync as readFileSync3, readdirSync as readdirSync3, statSync as statSync4, writeFileSync as writeFileSync2 } from "fs";
226066
226093
  function setFieldInPackageJson(workspaceRoot, field, value2) {
226067
226094
  const packageJSONContentObj = getPackageJsonObject2(workspaceRoot);
@@ -226259,8 +226286,29 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
226259
226286
  }
226260
226287
  }
226261
226288
  async finalizeFixes() {
226262
- logger.info(`Adjusting lock file changes by running a yarn dependency install command`);
226263
- await this.installPackages();
226289
+ const runYarnCommandOrThrow = async (cmd, dir, options) => {
226290
+ const result = await this.runYarnCommand(cmd, dir, options);
226291
+ if (result.error) {
226292
+ const error = result.error;
226293
+ error.stdout = result.stdout;
226294
+ error.stderr = result.stderr;
226295
+ throw error;
226296
+ }
226297
+ };
226298
+ const yarnType = await this.getYarnType();
226299
+ if (yarnType === "berry") {
226300
+ const env = { ...process.env, YARN_ENABLE_SCRIPTS: "false", YARN_NODE_LINKER: "node-modules" };
226301
+ const cmd = cmdt`yarn install --mode=update-lockfile`;
226302
+ logger.info(`Adjusting lock file by running '${cmd}'`);
226303
+ await runYarnCommandOrThrow(cmd, resolve24(this.rootDir, this.subprojectPath), { env });
226304
+ logger.info(
226305
+ `Run 'yarn install' in '${relative9(this.rootDir, this.subprojectPath) || "."}' to install the updated dependencies`
226306
+ );
226307
+ } else {
226308
+ const cmd = cmdt`yarn install --ignore-scripts --noninteractive`;
226309
+ logger.info(`Adjusting lock file by running '${cmd}'`);
226310
+ await runYarnCommandOrThrow(cmd, resolve24(this.rootDir, this.subprojectPath));
226311
+ }
226264
226312
  }
226265
226313
  };
226266
226314
 
@@ -226333,7 +226381,7 @@ var NpmSocketUpgradeManager = class {
226333
226381
  if (!subprojectToUpgrade.has(subprojectDir)) {
226334
226382
  subprojectToUpgrade.set(subprojectDir, /* @__PURE__ */ new Map());
226335
226383
  }
226336
- const workspacePath = relative7(subprojectDir, packageJsonDir) || ".";
226384
+ const workspacePath = relative10(subprojectDir, packageJsonDir) || ".";
226337
226385
  if (!subprojectToUpgrade.get(subprojectDir)?.has(workspacePath)) {
226338
226386
  subprojectToUpgrade.get(subprojectDir)?.set(workspacePath, []);
226339
226387
  }
@@ -226408,6 +226456,7 @@ var NpmSocketUpgradeManager = class {
226408
226456
  status: "error",
226409
226457
  file: lockfilePath,
226410
226458
  message: `Failed to finalize lockfile: ${e.message}`,
226459
+ details: e.stderr,
226411
226460
  artifacts: i3(allUpgrades.map((u8) => u8.idx))
226412
226461
  });
226413
226462
  throw e;
@@ -226824,7 +226873,7 @@ import { dirname as dirname16, resolve as resolve27 } from "node:path";
226824
226873
  // ../utils/src/nuget-project-utils.ts
226825
226874
  var import_parse_xml3 = __toESM(require_dist(), 1);
226826
226875
  import { readFile as readFile20 } from "node:fs/promises";
226827
- import { dirname as dirname15, join as join15, relative as relative8, resolve as resolve26, basename as basename8, extname } from "node:path";
226876
+ import { dirname as dirname15, join as join15, relative as relative11, resolve as resolve26, basename as basename8, extname } from "node:path";
226828
226877
  import { existsSync as existsSync14 } from "node:fs";
226829
226878
 
226830
226879
  // ../utils/dist/version-comparison/version-satisfies.js
@@ -228409,7 +228458,7 @@ async function loadNuGetProjectOrTarget(rootDir, projectFile, mainProject, visit
228409
228458
  });
228410
228459
  currentProject.sourceFiles.push(...files);
228411
228460
  } catch (err) {
228412
- logger.debug(`Failed to glob default pattern for ${relative8(rootDir, validatedProjectPath)}: ${err}`);
228461
+ logger.debug(`Failed to glob default pattern for ${relative11(rootDir, validatedProjectPath)}: ${err}`);
228413
228462
  }
228414
228463
  }
228415
228464
  mainProject ??= currentProject;
@@ -228672,11 +228721,11 @@ async function handleCompileItem(project, child) {
228672
228721
  } catch (err) {
228673
228722
  if (evaluatedExclude) {
228674
228723
  logger.debug(
228675
- `Failed to glob Compile Include ${includePatterns}, Exclude ${excludePatterns} in ${relative8(project.rootDir, project.validatedProjectPath)}: ${err}`
228724
+ `Failed to glob Compile Include ${includePatterns}, Exclude ${excludePatterns} in ${relative11(project.rootDir, project.validatedProjectPath)}: ${err}`
228676
228725
  );
228677
228726
  } else {
228678
228727
  logger.debug(
228679
- `Failed to glob Compile Include ${includePatterns} in ${relative8(project.rootDir, project.validatedProjectPath)}: ${err}`
228728
+ `Failed to glob Compile Include ${includePatterns} in ${relative11(project.rootDir, project.validatedProjectPath)}: ${err}`
228680
228729
  );
228681
228730
  }
228682
228731
  }
@@ -228696,7 +228745,7 @@ async function handleCompileItem(project, child) {
228696
228745
  project.sourceFiles = project.sourceFiles.filter((f6) => !removeSet.has(f6));
228697
228746
  } catch (err) {
228698
228747
  logger.debug(
228699
- `Failed to glob Compile Remove pattern ${evaluatedRemove} in ${relative8(project.rootDir, project.validatedProjectPath)}: ${err}`
228748
+ `Failed to glob Compile Remove pattern ${evaluatedRemove} in ${relative11(project.rootDir, project.validatedProjectPath)}: ${err}`
228700
228749
  );
228701
228750
  }
228702
228751
  }
@@ -228706,7 +228755,7 @@ function handlePropertyGroupElement(project, propertyGroup) {
228706
228755
  const condition = createAttributeMap(propertyGroup, project.sourceText).get("Condition");
228707
228756
  if (condition) {
228708
228757
  logger.debug(
228709
- `Skipping conditional property group ${propertyGroup.name} (${propertyGroup.start}, ${propertyGroup.end}) with condition ${condition.text} in file ${relative8(project.rootDir, project.validatedProjectPath)}`
228758
+ `Skipping conditional property group ${propertyGroup.name} (${propertyGroup.start}, ${propertyGroup.end}) with condition ${condition.text} in file ${relative11(project.rootDir, project.validatedProjectPath)}`
228710
228759
  );
228711
228760
  return;
228712
228761
  }
@@ -228716,7 +228765,7 @@ function handlePropertyGroupElement(project, propertyGroup) {
228716
228765
  const condition2 = createAttributeMap(propertyElement, project.sourceText).get("Condition");
228717
228766
  if (condition2) {
228718
228767
  logger.debug(
228719
- `Skipping conditional property ${propertyElement.name} (${propertyElement.start}, ${propertyElement.end}) with condition ${condition2.text} in file ${relative8(project.rootDir, project.validatedProjectPath)}`
228768
+ `Skipping conditional property ${propertyElement.name} (${propertyElement.start}, ${propertyElement.end}) with condition ${condition2.text} in file ${relative11(project.rootDir, project.validatedProjectPath)}`
228720
228769
  );
228721
228770
  continue;
228722
228771
  }
@@ -228786,7 +228835,7 @@ function evaluate3(expression, project) {
228786
228835
  function evaluateWithContext(value2, depth) {
228787
228836
  if (depth > 50) {
228788
228837
  logger.warn(
228789
- `Recursion limit hit while evaluating expression ${expression} in project ${relative8(project.rootDir, project.validatedProjectPath)}`
228838
+ `Recursion limit hit while evaluating expression ${expression} in project ${relative11(project.rootDir, project.validatedProjectPath)}`
228790
228839
  );
228791
228840
  isFullyEvaluated = false;
228792
228841
  return value2;
@@ -228797,7 +228846,7 @@ function evaluate3(expression, project) {
228797
228846
  return evaluateWithContext(property.text, depth + 1);
228798
228847
  } else {
228799
228848
  logger.debug(
228800
- `Unknown property ${propertyName} for project ${relative8(project.rootDir, project.validatedProjectPath)}`
228849
+ `Unknown property ${propertyName} for project ${relative11(project.rootDir, project.validatedProjectPath)}`
228801
228850
  );
228802
228851
  isFullyEvaluated = false;
228803
228852
  return "";
@@ -229271,7 +229320,7 @@ var NuGetSocketUpgradeManager = class {
229271
229320
  };
229272
229321
 
229273
229322
  // ../fixing-management/src/fixing-management/rust/cargo-socket-upgrade-manager.ts
229274
- import { dirname as dirname18, relative as relative9, resolve as resolve29 } from "node:path";
229323
+ import { dirname as dirname18, relative as relative12, resolve as resolve29 } from "node:path";
229275
229324
  var import_picomatch6 = __toESM(require_picomatch2(), 1);
229276
229325
  var import_semver4 = __toESM(require_semver2(), 1);
229277
229326
  import assert12 from "node:assert";
@@ -229423,14 +229472,14 @@ var CargoSocketUpgradeManager = class {
229423
229472
  await writeFile8(path9, content);
229424
229473
  ctxt.statusUpdater?.({
229425
229474
  status: "success",
229426
- file: relative9(this.rootDir, path9),
229475
+ file: relative12(this.rootDir, path9),
229427
229476
  message: "File restored",
229428
229477
  artifacts: i3(artifacts)
229429
229478
  });
229430
229479
  } catch (e) {
229431
229480
  ctxt.statusUpdater?.({
229432
229481
  status: "error",
229433
- file: relative9(this.rootDir, path9),
229482
+ file: relative12(this.rootDir, path9),
229434
229483
  message: "Could not restore file",
229435
229484
  artifacts: i3(artifacts)
229436
229485
  });
@@ -229629,7 +229678,7 @@ ${newDependencyLine}`
229629
229678
  };
229630
229679
 
229631
229680
  // ../fixing-management/src/fixing-management/pip/pip-socket-upgrade-manager.ts
229632
- import { dirname as dirname20, relative as relative10, resolve as resolve32 } from "node:path";
229681
+ import { dirname as dirname20, relative as relative13, resolve as resolve32 } from "node:path";
229633
229682
  var import_picomatch8 = __toESM(require_picomatch2(), 1);
229634
229683
  import assert13 from "node:assert";
229635
229684
  import { readFile as readFile25, writeFile as writeFile9 } from "node:fs/promises";
@@ -230146,14 +230195,14 @@ var PipSocketUpgradeManager = class {
230146
230195
  await writeFile9(path9, content);
230147
230196
  ctxt.statusUpdater?.({
230148
230197
  status: "success",
230149
- file: relative10(this.rootDir, path9),
230198
+ file: relative13(this.rootDir, path9),
230150
230199
  message: "File restored",
230151
230200
  artifacts: i3(artifacts)
230152
230201
  });
230153
230202
  } catch (e) {
230154
230203
  ctxt.statusUpdater?.({
230155
230204
  status: "error",
230156
- file: relative10(this.rootDir, path9),
230205
+ file: relative13(this.rootDir, path9),
230157
230206
  message: "Could not restore file",
230158
230207
  artifacts: i3(artifacts)
230159
230208
  });
@@ -230591,14 +230640,14 @@ function satisfiestVersionSpecs(version4, versionSpec) {
230591
230640
  }
230592
230641
 
230593
230642
  // ../fixing-management/src/fixing-management/rubygems/rubygems-socket-upgrade-manager.ts
230594
- import { dirname as dirname22, relative as relative12, resolve as resolve34 } from "node:path";
230643
+ import { dirname as dirname22, relative as relative15, resolve as resolve34 } from "node:path";
230595
230644
  var import_picomatch9 = __toESM(require_picomatch2(), 1);
230596
230645
  import assert14 from "node:assert";
230597
230646
 
230598
230647
  // ../fixing-management/src/fixing-management/rubygems/gemfile-utils.ts
230599
230648
  var import_good_enough_parser4 = __toESM(require_cjs(), 1);
230600
230649
  init_ruby_lang();
230601
- import { resolve as resolve33, dirname as dirname21, relative as relative11 } from "node:path";
230650
+ import { resolve as resolve33, dirname as dirname21, relative as relative14 } from "node:path";
230602
230651
  import { existsSync as existsSync16, readFileSync as readFileSync4, readdirSync as readdirSync4 } from "node:fs";
230603
230652
  init_gemspec_utils();
230604
230653
  var booleanQuery2 = import_good_enough_parser4.query.alt(
@@ -230707,13 +230756,13 @@ var evalGemfileQuery = import_good_enough_parser4.query.sym("eval_gemfile").join
230707
230756
  ctx.exprEndOffset = void 0;
230708
230757
  if (ctx.depth > 50) {
230709
230758
  logger.warn(
230710
- `Recursion limit hit while evaluating gemfile: ${relative11(ctx.gemfile.rootDir, resolve33(ctx.gemfile.rootDir, ctx.gemfile.file))}`
230759
+ `Recursion limit hit while evaluating gemfile: ${relative14(ctx.gemfile.rootDir, resolve33(ctx.gemfile.rootDir, ctx.gemfile.file))}`
230711
230760
  );
230712
230761
  return ctx;
230713
230762
  }
230714
230763
  if (pathEvaluated === void 0) return ctx;
230715
230764
  const rootDir = ctx.gemfile.rootDir;
230716
- const file = relative11(rootDir, resolve33(rootDir, dirname21(ctx.gemfile.file), pathEvaluated));
230765
+ const file = relative14(rootDir, resolve33(rootDir, dirname21(ctx.gemfile.file), pathEvaluated));
230717
230766
  if (!existsSync16(resolve33(rootDir, file))) return ctx;
230718
230767
  const sourceText = readFileSync4(resolve33(rootDir, file), "utf-8");
230719
230768
  const parser2 = import_good_enough_parser4.lang.createLang(lang3);
@@ -230766,7 +230815,7 @@ var gemspecQuery = import_good_enough_parser4.query.sym("gemspec").opt(
230766
230815
  ).handler((ctx) => {
230767
230816
  if (ctx.depth > 50) {
230768
230817
  logger.warn(
230769
- `Recursion limit hit while evaluating gemspec: ${relative11(ctx.gemfile.rootDir, resolve33(ctx.gemfile.rootDir, ctx.gemfile.file))}`
230818
+ `Recursion limit hit while evaluating gemspec: ${relative14(ctx.gemfile.rootDir, resolve33(ctx.gemfile.rootDir, ctx.gemfile.file))}`
230770
230819
  );
230771
230820
  ctx.currentGem = void 0;
230772
230821
  return ctx;
@@ -230805,7 +230854,7 @@ var gemspecQuery = import_good_enough_parser4.query.sym("gemspec").opt(
230805
230854
  if (gemspecFiles.length === 0) return ctx;
230806
230855
  const gemspecFile = gemspecFiles[0];
230807
230856
  const gemspecFullPath = resolve33(searchDir, gemspecFile);
230808
- const gemspecRelativePath = relative11(rootDir, gemspecFullPath);
230857
+ const gemspecRelativePath = relative14(rootDir, gemspecFullPath);
230809
230858
  try {
230810
230859
  const sourceText = readFileSync4(gemspecFullPath, "utf-8");
230811
230860
  const gemspec = parseGemspec(rootDir, gemspecRelativePath, sourceText);
@@ -231181,7 +231230,7 @@ var RubygemsSocketUpgradeManager = class {
231181
231230
  });
231182
231231
  continue;
231183
231232
  }
231184
- const gemfileName = relative12(this.rootDir, resolve34(this.rootDir, dirname22(mf.file), "Gemfile"));
231233
+ const gemfileName = relative15(this.rootDir, resolve34(this.rootDir, dirname22(mf.file), "Gemfile"));
231185
231234
  gemfileToLockfile.set(gemfileName, mf.file);
231186
231235
  if (pathGems.length > 0) {
231187
231236
  const { gemspecPatches, gemfilePatches } = await this.handleGemspecDependency(
@@ -231260,14 +231309,14 @@ var RubygemsSocketUpgradeManager = class {
231260
231309
  await writeFile10(path9, content);
231261
231310
  ctxt.statusUpdater?.({
231262
231311
  status: "success",
231263
- file: relative12(this.rootDir, path9),
231312
+ file: relative15(this.rootDir, path9),
231264
231313
  message: "File restored",
231265
231314
  artifacts: i3(artifacts)
231266
231315
  });
231267
231316
  } catch (e) {
231268
231317
  ctxt.statusUpdater?.({
231269
231318
  status: "error",
231270
- file: relative12(this.rootDir, path9),
231319
+ file: relative15(this.rootDir, path9),
231271
231320
  message: "Could not restore file",
231272
231321
  artifacts: i3(artifacts)
231273
231322
  });
@@ -231532,7 +231581,7 @@ var import_lodash7 = __toESM(require_lodash(), 1);
231532
231581
  var import_micromatch2 = __toESM(require_micromatch(), 1);
231533
231582
  import { existsSync as existsSync17 } from "fs";
231534
231583
  import { access as access4, cp as cp3, readdir as readdir4, stat as stat4 } from "fs/promises";
231535
- import { basename as basename9, join as join17, relative as relative13, resolve as resolve35 } from "path";
231584
+ import { basename as basename9, join as join17, relative as relative16, resolve as resolve35 } from "path";
231536
231585
  var { uniq: uniq2 } = import_lodash7.default;
231537
231586
  var { isMatch: isMatch2 } = import_micromatch2.default;
231538
231587
  function* parents2(dir) {
@@ -232105,12 +232154,12 @@ import { rmSync } from "fs";
232105
232154
  import { mkdir as mkdir5, readFile as readFile30, writeFile as writeFile11 } from "fs/promises";
232106
232155
  import assert15 from "node:assert";
232107
232156
  import { platform as platform6 } from "os";
232108
- import { join as join24, posix as posix2, relative as relative15, sep as sep3 } from "path";
232157
+ import { join as join24, posix as posix2, relative as relative18, sep as sep3 } from "path";
232109
232158
 
232110
232159
  // ../utils/src/tmp-file.ts
232111
232160
  import { rm, mkdtemp, cp as cp4, lstat as lstat2 } from "fs/promises";
232112
232161
  import { tmpdir as tmpdir2 } from "os";
232113
- import { join as join22, relative as relative14, sep as sep2, extname as extname2 } from "path";
232162
+ import { join as join22, relative as relative17, sep as sep2, extname as extname2 } from "path";
232114
232163
  async function createTmpDirectory(prefix) {
232115
232164
  try {
232116
232165
  const tmpDir = await mkdtemp(join22(tmpdir2(), prefix));
@@ -232147,7 +232196,7 @@ async function copyForNpmAnalysis(srcDir, prefix) {
232147
232196
  verbatimSymlinks: true,
232148
232197
  // Preserve symlinks as symlinks instead of dereferencing them
232149
232198
  filter: async (src) => {
232150
- const relativePath = relative14(srcDir, src);
232199
+ const relativePath = relative17(srcDir, src);
232151
232200
  if (relativePath === "") return true;
232152
232201
  const pathSegments = relativePath.split(sep2);
232153
232202
  if (pathSegments.some((segment) => EXCLUDED_DIRECTORIES.has(segment))) {
@@ -232528,7 +232577,7 @@ var OtherModulesCommunicator = class {
232528
232577
  }
232529
232578
  if (cmd === "getWorkspacePathsMultipleSubprojects")
232530
232579
  return `${_cmdStr()}: (${packageManagerName}) ${abbreviateList(subprojects, 10)}`;
232531
- return `${_cmdStr()}: (${packageManagerName}) ${relative15(this.rootWorkingDir, subprojectPath) || "."}`;
232580
+ return `${_cmdStr()}: (${packageManagerName}) ${relative18(this.rootWorkingDir, subprojectPath) || "."}`;
232532
232581
  }
232533
232582
  getSpinnerTextForReachabilityAnalyzerCommand(cmd, ecosystem, subprojectPath, workspacePath) {
232534
232583
  function _cmdStr() {
@@ -232541,10 +232590,10 @@ var OtherModulesCommunicator = class {
232541
232590
  return "Running reachability analysis on package registry package";
232542
232591
  }
232543
232592
  }
232544
- return `${_cmdStr()}: (${ecosystem}) ${relative15(this.rootWorkingDir, join24(subprojectPath, workspacePath)) || "."}`;
232593
+ return `${_cmdStr()}: (${ecosystem}) ${relative18(this.rootWorkingDir, join24(subprojectPath, workspacePath)) || "."}`;
232545
232594
  }
232546
232595
  getProjectPath(subprojectPath) {
232547
- return this.options.runWithoutDocker ? subprojectPath : posix2.resolve("/project", relative15(this.rootWorkingDir, subprojectPath).replaceAll(sep3, posix2.sep));
232596
+ return this.options.runWithoutDocker ? subprojectPath : posix2.resolve("/project", relative18(this.rootWorkingDir, subprojectPath).replaceAll(sep3, posix2.sep));
232548
232597
  }
232549
232598
  // options shared between package-management and reachability-analyzers
232550
232599
  commonOptions = once7(
@@ -232697,7 +232746,7 @@ var OtherModulesCommunicator = class {
232697
232746
  "getWorkspacePathsMultipleSubprojects",
232698
232747
  packageManagerName,
232699
232748
  this.rootWorkingDir,
232700
- subprojectPaths.map((subprojectPath) => relative15(this.rootWorkingDir, subprojectPath) || ".")
232749
+ subprojectPaths.map((subprojectPath) => relative18(this.rootWorkingDir, subprojectPath) || ".")
232701
232750
  );
232702
232751
  }
232703
232752
  async getProvidedArgsForSubproject(subprojectPath, providedOptions) {
@@ -234038,16 +234087,16 @@ function getVulnerabilitiesFromReport(report) {
234038
234087
  var import_packageurl_js = __toESM(require_packageurl_js(), 1);
234039
234088
 
234040
234089
  // dist/cli-upgrade-purl.js
234041
- import { join as join27, relative as relative18, resolve as resolve41 } from "node:path";
234090
+ import { join as join27, relative as relative21, resolve as resolve41 } from "node:path";
234042
234091
  var import_picomatch10 = __toESM(require_picomatch2(), 1);
234043
234092
 
234044
234093
  // ../project-management/src/project-management/project-manager.ts
234045
- import { relative as relative17, resolve as resolve40 } from "path";
234094
+ import { relative as relative20, resolve as resolve40 } from "path";
234046
234095
 
234047
234096
  // ../project-management/src/project-management/ecosystem-management/ecosystem-manager.ts
234048
234097
  var import_micromatch3 = __toESM(require_micromatch2(), 1);
234049
234098
  import { readdir as readdir6 } from "fs/promises";
234050
- import { join as join26, relative as relative16, resolve as resolve39 } from "path";
234099
+ import { join as join26, relative as relative19, resolve as resolve39 } from "path";
234051
234100
 
234052
234101
  // ../project-management/src/project-management/ecosystem-management/ecosystem-specs.ts
234053
234102
  import { existsSync as existsSync21 } from "fs";
@@ -234185,7 +234234,7 @@ var EcosystemManager = class _EcosystemManager {
234185
234234
  const resolvedProjectDir = resolve39(mainProjectDir, relativeProjectDir);
234186
234235
  if (config3.includeDirs.length > 0)
234187
234236
  workspacePaths = workspacePaths.filter(
234188
- (workspacePath) => isMatch3(relative16(mainProjectDir, join26(resolvedProjectDir, workspacePath)), config3.includeDirs)
234237
+ (workspacePath) => isMatch3(relative19(mainProjectDir, join26(resolvedProjectDir, workspacePath)), config3.includeDirs)
234189
234238
  );
234190
234239
  workspacePaths.filter((workspacePath) => workspacePath !== ".").forEach((workspacePath) => projectDirsAlreadyCovered.push(resolve39(resolvedProjectDir, workspacePath)));
234191
234240
  if (workspacePaths.length > 0)
@@ -234226,7 +234275,7 @@ var EcosystemManager = class _EcosystemManager {
234226
234275
  return typeof packageManagerNameProvider === "function" ? await packageManagerNameProvider(projectDir) : packageManagerNameProvider;
234227
234276
  } catch (e) {
234228
234277
  if (e instanceof InvalidProjectFileError) {
234229
- const projectDirRelative = relative16(mainProjectDir, projectDir) || ".";
234278
+ const projectDirRelative = relative19(mainProjectDir, projectDir) || ".";
234230
234279
  logger.error(
234231
234280
  `Invalid ${e.fileName} file in ${projectDirRelative}. If the project is intentionally invalid, and you want Coana to skip it in the scan, then add "--exclude-dirs ${projectDirRelative}" to the Coana command.`
234232
234281
  );
@@ -234318,7 +234367,7 @@ function shouldIgnoreDir(dir) {
234318
234367
  return dirsToIgnore.includes(dir);
234319
234368
  }
234320
234369
  function shouldIgnoreDueToExcludeDirsOrChangedFiles({ mainProjectDir, excludeDirs, changedFiles }, fullPath) {
234321
- const relativeToProjectDir = relative16(mainProjectDir, fullPath) || ".";
234370
+ const relativeToProjectDir = relative19(mainProjectDir, fullPath) || ".";
234322
234371
  return !!(isMatch3(relativeToProjectDir, excludeDirs) || changedFiles && !changedFiles.some((changedFile) => changedFile.startsWith(relativeToProjectDir)));
234323
234372
  }
234324
234373
 
@@ -234366,7 +234415,7 @@ var ProjectManager = class _ProjectManager {
234366
234415
  if (subprojects.length === 0) return void 0;
234367
234416
  return ` ${ecosystem}:
234368
234417
  ${subprojects.map(
234369
- ({ subprojectPath, workspacePaths }) => ` ${relative17(this.projectDir, subprojectPath) || ". (Root)"}${workspacePaths.length > 1 || workspacePaths[0] !== "." ? ` (${workspacePaths.length} ${ecosystem === "MAVEN" ? "modules" : "workspaces"})` : ""}`
234418
+ ({ subprojectPath, workspacePaths }) => ` ${relative20(this.projectDir, subprojectPath) || ". (Root)"}${workspacePaths.length > 1 || workspacePaths[0] !== "." ? ` (${workspacePaths.length} ${ecosystem === "MAVEN" ? "modules" : "workspaces"})` : ""}`
234370
234419
  ).join("\n")}`;
234371
234420
  }).filter((line) => line).join("\n");
234372
234421
  const detailsString = Object.entries(this.ecosystemToEcosystemManager).map(([ecosystem, manager]) => {
@@ -234374,7 +234423,7 @@ ${subprojects.map(
234374
234423
  if (subprojects.length === 0) return void 0;
234375
234424
  const subprojectsString = subprojects.map(({ subprojectPath, workspacePaths, packageManagerName }) => {
234376
234425
  if (workspacePaths.length === 1 && workspacePaths[0] === ".") return void 0;
234377
- return ` ${relative17(this.projectDir, subprojectPath) || ". (Root)"}
234426
+ return ` ${relative20(this.projectDir, subprojectPath) || ". (Root)"}
234378
234427
  ${workspacePaths.map((ws) => ` ${ws === "." ? ". (Root)" : ws} - ${packageManagerName}`).join("\n")}`;
234379
234428
  }).filter((line) => line).join("\n");
234380
234429
  if (!subprojectsString) return void 0;
@@ -234530,7 +234579,7 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
234530
234579
  warn: "\u26A0\uFE0F",
234531
234580
  error: "\u274C"
234532
234581
  };
234533
- logger.info(`${statusIcons[update3.status]} ${update3.message} \u2500 ${relative18(rootDir, resolve41(rootDir, update3.file))}`);
234582
+ logger.info(`${statusIcons[update3.status]} ${update3.message} \u2500 ${relative21(rootDir, resolve41(rootDir, update3.file))}`);
234534
234583
  update3.artifacts.forEach((idx, i7) => {
234535
234584
  logger.info(`${" ".repeat(3)}${i7 === update3.artifacts.length - 1 ? "\u2514\u2500" : "\u251C\u2500"} ${prettyPrintSocketFactArtifactUpgrade(artifacts[idx], upgrades2.get(idx))}`);
234536
234585
  });
@@ -234584,7 +234633,7 @@ ${Array.from(upgrades).map(([idx, upgradeVersion]) => ` ${prettyPrintPurlUpgrade
234584
234633
  const subprojectPromiseQueue = new PromiseQueue(Number(options.concurrency));
234585
234634
  supportedSubprojects.forEach((subproject) => {
234586
234635
  subprojectPromiseQueue.enqueueTask(async () => {
234587
- const workspacePathsMatchingGlob = subproject.workspacePaths.filter((wsPath) => wsFilter(relative18(rootDir, resolve41(rootDir, subproject.subprojectPath, wsPath)) || "."));
234636
+ const workspacePathsMatchingGlob = subproject.workspacePaths.filter((wsPath) => wsFilter(relative21(rootDir, resolve41(rootDir, subproject.subprojectPath, wsPath)) || "."));
234588
234637
  if (workspacePathsMatchingGlob.length === 0)
234589
234638
  return;
234590
234639
  const filterDescription = options.include !== void 0 || options.exclude !== void 0 ? `matching filters ${options.include ? `include: [${options.include.join(", ")}]` : ""}${options.include && options.exclude ? " " : ""}${options.exclude ? `exclude: [${options.exclude.join(", ")}]` : ""}` : "";
@@ -234626,7 +234675,7 @@ ${workspacePathsMatchingGlob.map((wsPath) => ` ${wsPath}`).join("\n")}`);
234626
234675
  logger.info(`No dependencies matching upgrade specs found for subproject ${subproject.subprojectPath}`);
234627
234676
  return;
234628
234677
  }
234629
- await applySecurityFixes(subproject.packageManagerName, rootDir, relative18(rootDir, subproject.subprojectPath) || ".", otherModulesCommunicator, workspaceToFixes, fixingData, signalFixApplied);
234678
+ await applySecurityFixes(subproject.packageManagerName, rootDir, relative21(rootDir, subproject.subprojectPath) || ".", otherModulesCommunicator, workspaceToFixes, fixingData, signalFixApplied);
234630
234679
  });
234631
234680
  });
234632
234681
  await subprojectPromiseQueue.onIdle();
@@ -234946,7 +234995,7 @@ var kleur_default = $;
234946
234995
  // dist/cli-core.js
234947
234996
  var import_lodash15 = __toESM(require_lodash(), 1);
234948
234997
  import os from "os";
234949
- import { join as join30, relative as relative19, resolve as resolve43 } from "path";
234998
+ import { join as join30, relative as relative22, resolve as resolve43 } from "path";
234950
234999
 
234951
235000
  // ../utils/src/dashboard-api/shared-api.ts
234952
235001
  var DashboardAPI = class {
@@ -236227,7 +236276,7 @@ function getMongoClient() {
236227
236276
  }
236228
236277
 
236229
236278
  // ../security-auditor/security-auditor-api/src/vulnerability-patterns-helper/get-interesting-urls-for-vulnerability.ts
236230
- import { exec as exec3 } from "child_process";
236279
+ import { exec as exec4 } from "child_process";
236231
236280
  import { promisify } from "util";
236232
236281
 
236233
236282
  // ../../node_modules/.pnpm/cheerio@1.0.0-rc.12/node_modules/cheerio/lib/esm/options.js
@@ -237868,10 +237917,10 @@ function compareDocumentPosition(nodeA, nodeB) {
237868
237917
  function uniqueSort(nodes) {
237869
237918
  nodes = nodes.filter((node, i7, arr) => !arr.includes(node, i7 + 1));
237870
237919
  nodes.sort((a4, b) => {
237871
- const relative20 = compareDocumentPosition(a4, b);
237872
- if (relative20 & DocumentPosition.PRECEDING) {
237920
+ const relative23 = compareDocumentPosition(a4, b);
237921
+ if (relative23 & DocumentPosition.PRECEDING) {
237873
237922
  return -1;
237874
- } else if (relative20 & DocumentPosition.FOLLOWING) {
237923
+ } else if (relative23 & DocumentPosition.FOLLOWING) {
237875
237924
  return 1;
237876
237925
  }
237877
237926
  return 0;
@@ -249823,7 +249872,7 @@ async function getInterestingURLsForVulnerability(vulnerability, packageMetadata
249823
249872
  }
249824
249873
  async function computeComparisonURLs(scmUrl, vulnAndFixVersionsArr) {
249825
249874
  try {
249826
- const gitTags = (await promisify(exec3)(`git ls-remote ${scmUrl} | grep -F "refs/tags"`)).stdout.split("\n");
249875
+ const gitTags = (await promisify(exec4)(`git ls-remote ${scmUrl} | grep -F "refs/tags"`)).stdout.split("\n");
249827
249876
  logger3.debug("gitTags", gitTags);
249828
249877
  logger3.debug("vulnAndFixVersionsArr", vulnAndFixVersionsArr);
249829
249878
  const versionToSha = {};
@@ -249858,7 +249907,7 @@ async function computeInterestingCommitURLs(text3, scmUrl) {
249858
249907
  const repo = scmUrl.split("/").slice(-2).join("/");
249859
249908
  const cmd = `gh search commits ${text3} --repo ${repo}`;
249860
249909
  logger3.debug(`Finding issue or PR url for text ${text3}`, cmd);
249861
- const { stdout } = await promisify(exec3)(cmd, { shell: "/bin/zsh" });
249910
+ const { stdout } = await promisify(exec4)(cmd, { shell: "/bin/zsh" });
249862
249911
  return stdout.split("\n").filter((line) => line).map((line) => {
249863
249912
  const [repo2, sha] = line.split(" ");
249864
249913
  return `https://www.github.com/${repo2}/commit/${sha}`;
@@ -249872,7 +249921,7 @@ async function computeInterestingIssueAndPRUrlsWithText(text3, scmUrl) {
249872
249921
  const repo = scmUrl.split("/").slice(-2).join("/");
249873
249922
  const cmd = `gh search issues ${text3} in:title,body,comment --repo ${repo} --include-prs`;
249874
249923
  console.log(`Finding issue or PR url for text ${text3}`, cmd);
249875
- const { stdout } = await promisify(exec3)(cmd, { shell: "/bin/zsh" });
249924
+ const { stdout } = await promisify(exec4)(cmd, { shell: "/bin/zsh" });
249876
249925
  return stdout.split("\n").filter((line) => line).map((line) => {
249877
249926
  const [issueOrPr, repo2, id] = line.split(" ");
249878
249927
  const issueOrPrUrlPart = issueOrPr === "issue" ? "issues" : "pull";
@@ -251101,7 +251150,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
251101
251150
  }
251102
251151
 
251103
251152
  // dist/version.js
251104
- var version3 = "14.12.128";
251153
+ var version3 = "14.12.130";
251105
251154
 
251106
251155
  // dist/cli-core.js
251107
251156
  var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
@@ -251282,21 +251331,26 @@ var CliCore = class {
251282
251331
  this.spinner.stop();
251283
251332
  return report;
251284
251333
  }
251285
- await logger.finish();
251286
- if (this.socketLogServer) {
251287
- await this.socketLogServer.close();
251288
- }
251334
+ await this.cleanupLogging();
251289
251335
  } catch (e) {
251290
251336
  await this.spinner.fail();
251291
251337
  logger.error("CLI failed with error:", e);
251292
251338
  await this.shareErrorLogWithBackend(e, true, "cli-error");
251293
- await logger.finish();
251294
- if (this.socketLogServer) {
251295
- await this.socketLogServer.close();
251296
- }
251339
+ await this.cleanupLogging();
251297
251340
  process.exit(1);
251298
251341
  }
251299
251342
  }
251343
+ /**
251344
+ * Clean up logging infrastructure in the correct order:
251345
+ * 1. Close socket server first to ensure all logs are forwarded to the batched HTTP streamer
251346
+ * 2. Then finish logger which flushes the batched HTTP streamer to the backend
251347
+ */
251348
+ async cleanupLogging() {
251349
+ if (this.socketLogServer) {
251350
+ await this.socketLogServer.close();
251351
+ }
251352
+ await logger.finish();
251353
+ }
251300
251354
  async computeAndOutputReportSocketMode(otherModulesCommunicator) {
251301
251355
  logger.info("Fetching artifacts from Socket backend");
251302
251356
  this.sendProgress("SCAN_FOR_VULNERABILITIES", true, ".", ".");
@@ -251489,7 +251543,7 @@ var CliCore = class {
251489
251543
  const { reachabilitySupport, traditionalScaSupport, noSupport } = manager.getSubprojectsWithWorkspacePaths();
251490
251544
  await this.dashboardAPI.registerSubprojects([...reachabilitySupport, ...traditionalScaSupport, ...noSupport].map((sp) => ({
251491
251545
  ...sp,
251492
- subprojectPath: relative19(this.rootWorkingDirectory, sp.subprojectPath) || "."
251546
+ subprojectPath: relative22(this.rootWorkingDirectory, sp.subprojectPath) || "."
251493
251547
  })), this.reportId, this.apiKey);
251494
251548
  for (const unsupported of noSupport)
251495
251549
  logger.warn(unsupported.unsupportedMsg);
@@ -251518,7 +251572,7 @@ var CliCore = class {
251518
251572
  await this.spinner.succeed();
251519
251573
  } catch (error) {
251520
251574
  if (this.options.ignoreFailingWorkspaces) {
251521
- const relativeSubprojectPath = relative19(this.rootWorkingDirectory, subprojectAndWsPath.subprojectPath) || ".";
251575
+ const relativeSubprojectPath = relative22(this.rootWorkingDirectory, subprojectAndWsPath.subprojectPath) || ".";
251522
251576
  this.failedSubprojects.push({
251523
251577
  subproject: relativeSubprojectPath,
251524
251578
  error: error.message || "Unknown error"
@@ -251577,7 +251631,7 @@ Subproject: ${subproject}`);
251577
251631
  }
251578
251632
  async updateSpinnerTextOnNewSubproject(subprojectAndWsPath, numberSubprojects, index2) {
251579
251633
  this.spinner.start();
251580
- const relativeSubprojectPath = relative19(this.rootWorkingDirectory, subprojectAndWsPath.subprojectPath) || ".";
251634
+ const relativeSubprojectPath = relative22(this.rootWorkingDirectory, subprojectAndWsPath.subprojectPath) || ".";
251581
251635
  await this.spinner.setText(numberSubprojects > 1 ? `Processing subproject ${relativeSubprojectPath} (${index2 + 1}/${numberSubprojects})${+this.options.concurrency > 1 ? `. May process up to ${+this.options.concurrency - 1} other workspaces in parallel` : ""}` : `Processing ${relativeSubprojectPath}`);
251582
251636
  }
251583
251637
  async initialize() {
@@ -251659,7 +251713,7 @@ Subproject: ${subproject}`);
251659
251713
  return workspaceToAugmentedVulnerabilities[workspacePath] !== void 0;
251660
251714
  }).map((workspacePath) => {
251661
251715
  return {
251662
- subprojectPath: relative19(this.rootWorkingDirectory, subprojectPath) || ".",
251716
+ subprojectPath: relative22(this.rootWorkingDirectory, subprojectPath) || ".",
251663
251717
  workspacePath,
251664
251718
  directDependencies: projectInfo[workspacePath].dataForAnalysis.directDependenciesMap ?? {},
251665
251719
  vulnerabilities: workspaceToAugmentedVulnerabilities[workspacePath],
@@ -251887,7 +251941,7 @@ Subproject: ${subproject}`);
251887
251941
  async sendProgress(type, isStartEvent, subprojectPath, workspacePath) {
251888
251942
  await this.dashboardAPI.registerCLIProgress({
251889
251943
  type,
251890
- ...subprojectPath ? { subprojectPath: relative19(this.rootWorkingDirectory, subprojectPath) || "." } : {},
251944
+ ...subprojectPath ? { subprojectPath: relative22(this.rootWorkingDirectory, subprojectPath) || "." } : {},
251891
251945
  ...workspacePath ? { workspacePath } : {}
251892
251946
  }, isStartEvent, this.reportId, this.apiKey);
251893
251947
  }
@@ -251943,7 +251997,7 @@ Subproject: ${subproject}`);
251943
251997
  dependencyTree: workspaceToPlainDependencyTree[workspacePath],
251944
251998
  ecosystem: workspaceToPlainDependencyTree[workspacePath].ecosystem ?? "NPM",
251945
251999
  workspacePath,
251946
- subprojectPath: relative19(rootWorkingDirectory, subprojectPath) || "."
252000
+ subprojectPath: relative22(rootWorkingDirectory, subprojectPath) || "."
251947
252001
  }));
251948
252002
  if (this.options.socketMode) {
251949
252003
  this.reportDependencyTrees = workspacePaths.map((workspacePath) => ({
@@ -251951,7 +252005,7 @@ Subproject: ${subproject}`);
251951
252005
  dependencyTree: projectInfo[workspacePath].dataForAnalysis.data.dependencyTree,
251952
252006
  ecosystem: projectInfo[workspacePath].dataForAnalysis.data.dependencyTree.ecosystem ?? "NPM",
251953
252007
  workspacePath,
251954
- subprojectPath: relative19(rootWorkingDirectory, subprojectPath) || "."
252008
+ subprojectPath: relative22(rootWorkingDirectory, subprojectPath) || "."
251955
252009
  }));
251956
252010
  }
251957
252011
  if (this.shareWithDashboard)
@@ -251967,7 +252021,7 @@ Subproject: ${subproject}`);
251967
252021
  } catch (e) {
251968
252022
  logger.error(`Scanning for vulnerabilities failed for subproject ${subprojectPath} in workspace ${workspacePath}`);
251969
252023
  if (this.options.ignoreFailingWorkspaces) {
251970
- const relativeSubprojectPath = relative19(this.rootWorkingDirectory, subprojectPath) || ".";
252024
+ const relativeSubprojectPath = relative22(this.rootWorkingDirectory, subprojectPath) || ".";
251971
252025
  this.failedWorkspaces.push({
251972
252026
  subproject: relativeSubprojectPath,
251973
252027
  workspace: workspacePath,
@@ -251986,7 +252040,7 @@ Subproject: ${subproject}`);
251986
252040
  }
251987
252041
  };
251988
252042
  function getRelativeSubprojectPath(subprojectPath, projectDir) {
251989
- return relative19(projectDir, subprojectPath) || ".";
252043
+ return relative22(projectDir, subprojectPath) || ".";
251990
252044
  }
251991
252045
  function getDependencyType(vulnChainDetails, codeAwareScanResults, directDependencies, reachability) {
251992
252046
  if (reachability === "UNREACHABLE" || reachability === "UNKNOWN") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.128",
3
+ "version": "14.12.130",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -76299,7 +76299,7 @@ var Spinner = class _Spinner {
76299
76299
  // ../utils/src/logging/socket-transport.ts
76300
76300
  var import_winston_transport = __toESM(require_winston_transport2(), 1);
76301
76301
  import { Socket } from "net";
76302
- var SocketTransport = class extends import_winston_transport.default {
76302
+ var SocketTransport = class _SocketTransport extends import_winston_transport.default {
76303
76303
  socket = null;
76304
76304
  socketPath;
76305
76305
  context;
@@ -76307,6 +76307,11 @@ var SocketTransport = class extends import_winston_transport.default {
76307
76307
  connected = false;
76308
76308
  messageQueue = [];
76309
76309
  reconnectTimer = null;
76310
+ lastActivityTime = 0;
76311
+ // Maximum number of messages to queue during reconnection
76312
+ static MAX_QUEUE_SIZE = 1e3;
76313
+ // After this much idle time, proactively reconnect before sending to avoid stale connections
76314
+ static STALE_CONNECTION_THRESHOLD_MS = 3e4;
76310
76315
  constructor(options) {
76311
76316
  super(options);
76312
76317
  this.socketPath = options.socketPath;
@@ -76315,7 +76320,11 @@ var SocketTransport = class extends import_winston_transport.default {
76315
76320
  this.connect();
76316
76321
  }
76317
76322
  connect() {
76323
+ if (this.socket) {
76324
+ this.socket.destroy();
76325
+ }
76318
76326
  this.socket = new Socket();
76327
+ this.socket.unref();
76319
76328
  this.socket.on("connect", () => {
76320
76329
  this.connected = true;
76321
76330
  const handshake = {
@@ -76324,7 +76333,7 @@ var SocketTransport = class extends import_winston_transport.default {
76324
76333
  processVariant: this.processVariant,
76325
76334
  startTime: Date.now()
76326
76335
  };
76327
- this.sendMessage(handshake);
76336
+ this.sendMessageDirect(handshake);
76328
76337
  this.flushQueue();
76329
76338
  });
76330
76339
  this.socket.on("error", () => {
@@ -76341,28 +76350,76 @@ var SocketTransport = class extends import_winston_transport.default {
76341
76350
  if (this.reconnectTimer) return;
76342
76351
  this.reconnectTimer = setTimeout(() => {
76343
76352
  this.reconnectTimer = null;
76344
- if (!this.connected && this.socket) {
76353
+ if (!this.connected) {
76345
76354
  this.connect();
76346
76355
  }
76347
76356
  }, 1e3);
76357
+ this.reconnectTimer.unref();
76358
+ }
76359
+ /**
76360
+ * Check if the connection might be stale due to inactivity.
76361
+ * After a long idle period, the connection may have died without us knowing.
76362
+ */
76363
+ isConnectionPotentiallyStale() {
76364
+ if (!this.connected || this.lastActivityTime === 0) {
76365
+ return false;
76366
+ }
76367
+ const idleTime = Date.now() - this.lastActivityTime;
76368
+ return idleTime > _SocketTransport.STALE_CONNECTION_THRESHOLD_MS;
76348
76369
  }
76370
+ /**
76371
+ * Queue a message for sending. If connected, sends immediately.
76372
+ * If not connected, queues for later (with size limit).
76373
+ */
76349
76374
  sendMessage(message) {
76375
+ const serialized = JSON.stringify(message) + "\n";
76376
+ if (this.isConnectionPotentiallyStale()) {
76377
+ this.connected = false;
76378
+ if (this.messageQueue.length < _SocketTransport.MAX_QUEUE_SIZE) {
76379
+ this.messageQueue.push(serialized);
76380
+ }
76381
+ if (this.socket) {
76382
+ this.socket.destroy();
76383
+ }
76384
+ return;
76385
+ }
76386
+ if (!this.socket || !this.connected) {
76387
+ if (this.messageQueue.length < _SocketTransport.MAX_QUEUE_SIZE) {
76388
+ this.messageQueue.push(serialized);
76389
+ }
76390
+ this.scheduleReconnect();
76391
+ return;
76392
+ }
76393
+ this.writeToSocket(serialized);
76394
+ }
76395
+ /**
76396
+ * Send a message directly without queueing (used for handshake).
76397
+ */
76398
+ sendMessageDirect(message) {
76350
76399
  if (!this.socket || !this.connected) {
76351
76400
  return;
76352
76401
  }
76353
76402
  const serialized = JSON.stringify(message) + "\n";
76354
- this.socket.write(serialized, (error) => {
76403
+ this.writeToSocket(serialized);
76404
+ }
76405
+ /**
76406
+ * Write data to socket with error handling.
76407
+ * Note: On write error, the socket will emit 'error' event which triggers reconnect.
76408
+ */
76409
+ writeToSocket(data2) {
76410
+ if (!this.socket) return;
76411
+ this.socket.write(data2, (error) => {
76355
76412
  if (error) {
76356
76413
  this.connected = false;
76414
+ } else {
76415
+ this.lastActivityTime = Date.now();
76357
76416
  }
76358
76417
  });
76359
76418
  }
76360
76419
  flushQueue() {
76361
76420
  while (this.messageQueue.length > 0 && this.connected) {
76362
76421
  const message = this.messageQueue.shift();
76363
- if (this.socket) {
76364
- this.socket.write(message);
76365
- }
76422
+ this.writeToSocket(message);
76366
76423
  }
76367
76424
  }
76368
76425
  log(info, callback) {