@coana-tech/cli 14.12.100 → 14.12.102

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
@@ -86512,7 +86512,7 @@ var require_lockfile = __commonJS({
86512
86512
  }
86513
86513
  const file = _ref22;
86514
86514
  if (yield exists2(file)) {
86515
- return readFile36(file);
86515
+ return readFile35(file);
86516
86516
  }
86517
86517
  }
86518
86518
  return null;
@@ -86531,7 +86531,7 @@ var require_lockfile = __commonJS({
86531
86531
  })();
86532
86532
  let readJsonAndFile = exports3.readJsonAndFile = (() => {
86533
86533
  var _ref24 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) {
86534
- const file = yield readFile36(loc);
86534
+ const file = yield readFile35(loc);
86535
86535
  try {
86536
86536
  return {
86537
86537
  object: (0, (_map || _load_map()).default)(JSON.parse(stripBOM2(file))),
@@ -86771,7 +86771,7 @@ var require_lockfile = __commonJS({
86771
86771
  };
86772
86772
  })();
86773
86773
  exports3.copy = copy;
86774
- exports3.readFile = readFile36;
86774
+ exports3.readFile = readFile35;
86775
86775
  exports3.readFileRaw = readFileRaw;
86776
86776
  exports3.normalizeOS = normalizeOS;
86777
86777
  var _fs;
@@ -86869,7 +86869,7 @@ var require_lockfile = __commonJS({
86869
86869
  });
86870
86870
  });
86871
86871
  }
86872
- function readFile36(loc) {
86872
+ function readFile35(loc) {
86873
86873
  return _readFile(loc, "utf8").then(normalizeOS);
86874
86874
  }
86875
86875
  function readFileRaw(loc) {
@@ -201554,7 +201554,7 @@ var {
201554
201554
  } = import_index.default;
201555
201555
 
201556
201556
  // dist/index.js
201557
- import { mkdir as mkdir7, mkdtemp as mkdtemp2, readFile as readFile35, rm as rm2, writeFile as writeFile15 } from "fs/promises";
201557
+ import { mkdir as mkdir7, mkdtemp as mkdtemp2, readFile as readFile34, rm as rm2, writeFile as writeFile15 } from "fs/promises";
201558
201558
  import { tmpdir as tmpdir3 } from "os";
201559
201559
  import { dirname as dirname27, join as join30, resolve as resolve44 } from "path";
201560
201560
 
@@ -205056,6 +205056,7 @@ var CLILogger = class {
205056
205056
  socketTransport;
205057
205057
  // Spinner registers itself as wrapper in order to suspend spinning when logging -- default to the empty wrapper
205058
205058
  wrapper = (cb) => cb();
205059
+ finished = false;
205059
205060
  initWinstonLogger(debug, logFilePath) {
205060
205061
  if (this.logger instanceof import_winston.Logger) {
205061
205062
  return;
@@ -205169,10 +205170,14 @@ var CLILogger = class {
205169
205170
  * in errors that are swallowed by the 'error' event listener in this function.
205170
205171
  */
205171
205172
  async finish() {
205173
+ if (this.finished) {
205174
+ return;
205175
+ }
205176
+ this.finished = true;
205172
205177
  await this.batchedHttpLogStreamer?.close();
205173
205178
  this.socketTransport?.close?.();
205174
205179
  return new Promise((resolve45) => {
205175
- if (this.logger instanceof Console || this.logger.writableEnded) {
205180
+ if (this.logger instanceof Console) {
205176
205181
  resolve45();
205177
205182
  return;
205178
205183
  }
@@ -213266,7 +213271,6 @@ var GoFixingManager = class {
213266
213271
 
213267
213272
  // ../fixing-management/src/fixing-management/go/go-socket-upgrade-manager.ts
213268
213273
  import { dirname as dirname7, resolve as resolve7 } from "node:path";
213269
- import { readFile as readFile5 } from "node:fs/promises";
213270
213274
  var import_picomatch = __toESM(require_picomatch4(), 1);
213271
213275
  import assert4 from "node:assert";
213272
213276
 
@@ -216346,7 +216350,6 @@ replace ${modulePath} ${currentVersion} => ${modulePath} ${newVersion}
216346
216350
  async refreshChecksumFiles(checksumFileToArtifacts, ctxt) {
216347
216351
  await asyncForEach(Object.entries(checksumFileToArtifacts), async ([checksumFile, artifacts]) => {
216348
216352
  const goModDir = dirname7(resolve7(this.rootDir, checksumFile));
216349
- const oldFileContent = await readFile5(resolve7(this.rootDir, checksumFile), "utf-8").catch(() => "");
216350
216353
  const result = await execNeverFail2(["go", "mod", "tidy"], goModDir);
216351
216354
  if (result.error) {
216352
216355
  ctxt.statusUpdater?.({
@@ -216356,12 +216359,10 @@ replace ${modulePath} ${currentVersion} => ${modulePath} ${newVersion}
216356
216359
  message: `Failed to update checksum file: ${result.error.message ?? "Unknown error"}`
216357
216360
  });
216358
216361
  } else {
216359
- const finalFileContent = await readFile5(resolve7(this.rootDir, checksumFile), "utf-8").catch(() => "");
216360
216362
  ctxt.statusUpdater?.({
216361
216363
  status: "success",
216362
216364
  file: checksumFile,
216363
216365
  message: "Checksum file updated",
216364
- patch: createPatch(checksumFile, oldFileContent, finalFileContent, void 0, void 0, { context: 3 }),
216365
216366
  artifacts: i3(artifacts)
216366
216367
  });
216367
216368
  }
@@ -216371,12 +216372,12 @@ replace ${modulePath} ${currentVersion} => ${modulePath} ${newVersion}
216371
216372
 
216372
216373
  // ../fixing-management/src/fixing-management/maven/gradle-fixing-manager.ts
216373
216374
  import { existsSync as existsSync5 } from "node:fs";
216374
- import { readFile as readFile9 } from "node:fs/promises";
216375
+ import { readFile as readFile8 } from "node:fs/promises";
216375
216376
  import { join as join6, resolve as resolve10 } from "node:path";
216376
216377
 
216377
216378
  // ../fixing-management/src/fixing-management/utils/coana-patch-application.ts
216378
216379
  import { existsSync as existsSync3 } from "node:fs";
216379
- import { readFile as readFile6, writeFile as writeFile3 } from "node:fs/promises";
216380
+ import { readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises";
216380
216381
  import { resolve as resolve8 } from "node:path";
216381
216382
  function detectPatchConflicts(rootDir, patchResults) {
216382
216383
  const patchesByFile = /* @__PURE__ */ new Map();
@@ -216509,7 +216510,7 @@ async function applyPatchResults(ecosystem, rootDir, patchResults) {
216509
216510
  if (!existsSync3(filePath)) {
216510
216511
  await writeFile3(filePath, "", "utf-8");
216511
216512
  }
216512
- let fileContent = await readFile6(filePath, "utf-8");
216513
+ let fileContent = await readFile5(filePath, "utf-8");
216513
216514
  for (const patch of sortedPatches) {
216514
216515
  const start = patch.offset;
216515
216516
  const end2 = patch.offset + (patch.oldText?.length ?? 0);
@@ -216521,7 +216522,7 @@ async function applyPatchResults(ecosystem, rootDir, patchResults) {
216521
216522
 
216522
216523
  // ../fixing-management/src/fixing-management/maven/gradle-build-file-helper.ts
216523
216524
  var import_good_enough_parser = __toESM(require_cjs(), 1);
216524
- import { readFile as readFile7 } from "node:fs/promises";
216525
+ import { readFile as readFile6 } from "node:fs/promises";
216525
216526
 
216526
216527
  // ../fixing-management/src/fixing-management/maven/utils.ts
216527
216528
  import { existsSync as existsSync4 } from "node:fs";
@@ -216743,7 +216744,7 @@ var treeQuery = import_good_enough_parser.query.tree({
216743
216744
  });
216744
216745
  async function findDependencyDeclsAndCatalogFiles(filePath) {
216745
216746
  const gradleLang = import_good_enough_parser.lang.createLang("groovy");
216746
- const cursor = gradleLang.parse(await readFile7(filePath, "utf-8"));
216747
+ const cursor = gradleLang.parse(await readFile6(filePath, "utf-8"));
216747
216748
  const ctx = gradleLang.query(cursor, treeQuery, {
216748
216749
  mem: {},
216749
216750
  depDecls: [],
@@ -216779,7 +216780,7 @@ ${getConstraintsBlockString(groupId, artifactId, classifier, version4, indentati
216779
216780
  }
216780
216781
 
216781
216782
  // ../fixing-management/src/fixing-management/maven/gradle-version-catalog-helper.ts
216782
- import { readFile as readFile8 } from "node:fs/promises";
216783
+ import { readFile as readFile7 } from "node:fs/promises";
216783
216784
 
216784
216785
  // ../utils/src/toml-utils.ts
216785
216786
  var tomlParser = __toESM(require_lib10(), 1);
@@ -217046,7 +217047,7 @@ function parseDependencyObject(valueNode) {
217046
217047
  };
217047
217048
  }
217048
217049
  async function findVersionCatalogDeclarations(filePath) {
217049
- const catalogData = parseVersionCatalog(await readFile8(filePath, "utf-8"));
217050
+ const catalogData = parseVersionCatalog(await readFile7(filePath, "utf-8"));
217050
217051
  return {
217051
217052
  depDecls: catalogData.dependencies,
217052
217053
  versionDecls: catalogData.versions
@@ -217251,7 +217252,7 @@ var GradleFixingManager = class {
217251
217252
  newText: constraintStr + "\n"
217252
217253
  };
217253
217254
  } else {
217254
- const fileContent = await readFile9(targetBuildFile, "utf-8");
217255
+ const fileContent = await readFile8(targetBuildFile, "utf-8");
217255
217256
  const indentationSize = getIndentationSize(fileContent);
217256
217257
  const prependNewline = fileContent.split("\n").some((line) => !line.trim());
217257
217258
  const finalConstraintStr = getDependencyConstraintString(
@@ -217438,7 +217439,7 @@ var GradleFixingManager = class {
217438
217439
  async createConstraintsForFile(buildFile, fixes) {
217439
217440
  const { dependenciesBlocks, constraintsBlocks } = await findDependencyDeclsAndCatalogFiles(buildFile);
217440
217441
  const fileType = buildFile.endsWith(".kts") ? "kotlin" : "groovy";
217441
- const fileContent = existsSync5(buildFile) ? await readFile9(buildFile, "utf-8") : "";
217442
+ const fileContent = existsSync5(buildFile) ? await readFile8(buildFile, "utf-8") : "";
217442
217443
  const indentationSize = getIndentationSize(fileContent);
217443
217444
  const constraintDeclarations = fixes.map(({ dependencyDetails, fixedVersion }) => {
217444
217445
  const [groupId, artifactId] = dependencyDetails.packageName.split(":");
@@ -217545,7 +217546,7 @@ import { resolve as resolve12 } from "node:path";
217545
217546
 
217546
217547
  // ../utils/src/pom-utils.ts
217547
217548
  var import_parse_xml2 = __toESM(require_dist(), 1);
217548
- import { readFile as readFile10 } from "node:fs/promises";
217549
+ import { readFile as readFile9 } from "node:fs/promises";
217549
217550
  import { existsSync as existsSync6 } from "node:fs";
217550
217551
  import { resolve as resolve11, join as join7, relative as relative4, dirname as dirname8 } from "node:path";
217551
217552
 
@@ -217681,7 +217682,7 @@ async function loadPom(rootDir, pomFile, validateFile, visited = /* @__PURE__ */
217681
217682
  if (!validatedPomFile || !existsSync6(validatedPomFile)) return void 0;
217682
217683
  if (visited.has(validatedPomFile)) return void 0;
217683
217684
  visited.add(validatedPomFile);
217684
- const sourceText = await readFile10(validatedPomFile, "utf-8");
217685
+ const sourceText = await readFile9(validatedPomFile, "utf-8");
217685
217686
  const xml2 = (0, import_parse_xml2.parseXml)(sourceText, { includeOffsets: true });
217686
217687
  const indentation = inferIndentationFromParsedXml(xml2, sourceText);
217687
217688
  const pom = {
@@ -218852,11 +218853,11 @@ import { dirname as dirname10, resolve as resolve15 } from "node:path";
218852
218853
  import assert7 from "node:assert";
218853
218854
 
218854
218855
  // ../fixing-management/src/fixing-management/maven/gradle-lockfile-utils.ts
218855
- import { readFile as readFile11 } from "node:fs/promises";
218856
+ import { readFile as readFile10 } from "node:fs/promises";
218856
218857
  import { resolve as resolve14 } from "node:path";
218857
218858
  async function loadLockFile(rootDir, lockfilePath) {
218858
218859
  const file = resolve14(rootDir, lockfilePath);
218859
- return { rootDir, file, sourceText: await readFile11(file, "utf-8") };
218860
+ return { rootDir, file, sourceText: await readFile10(file, "utf-8") };
218860
218861
  }
218861
218862
 
218862
218863
  // ../fixing-management/src/fixing-management/maven/handlers/gradle-lockfile-upgrade-handler.ts
@@ -218916,13 +218917,13 @@ var GradleLockfileUpgradeHandler = class {
218916
218917
 
218917
218918
  // ../fixing-management/src/fixing-management/maven/handlers/sbt-upgrade-handler.ts
218918
218919
  import { existsSync as existsSync7 } from "node:fs";
218919
- import { readFile as readFile13 } from "node:fs/promises";
218920
+ import { readFile as readFile12 } from "node:fs/promises";
218920
218921
  import { basename as basename4, dirname as dirname11, resolve as resolve16 } from "node:path";
218921
218922
  import assert8 from "node:assert";
218922
218923
 
218923
218924
  // ../fixing-management/src/fixing-management/maven/sbt-project-utils.ts
218924
218925
  var import_good_enough_parser2 = __toESM(require_cjs(), 1);
218925
- import { readFile as readFile12 } from "node:fs/promises";
218926
+ import { readFile as readFile11 } from "node:fs/promises";
218926
218927
  var pathQuery2 = import_good_enough_parser2.query.sym((ctx, { offset, value: value2 }) => {
218927
218928
  return { ...ctx, pathOffset: offset, pathValue: value2 };
218928
218929
  }).many(
@@ -219099,7 +219100,7 @@ var treeQuery2 = import_good_enough_parser2.query.tree({
219099
219100
  });
219100
219101
  async function loadSbtProject(filePath, acc = { mem: {}, moduleIds: [] }) {
219101
219102
  const scalaLang = import_good_enough_parser2.lang.createLang("scala");
219102
- const cursor = scalaLang.parse(await readFile12(filePath, "utf-8"));
219103
+ const cursor = scalaLang.parse(await readFile11(filePath, "utf-8"));
219103
219104
  return scalaLang.query(cursor, treeQuery2, acc) ?? acc;
219104
219105
  }
219105
219106
  function evaluate2(v) {
@@ -219240,7 +219241,7 @@ ${indent(1, indentationSize)}`)}
219240
219241
  `
219241
219242
  };
219242
219243
  } else {
219243
- const fileContent = await readFile13(dependencyOverridesFile, "utf-8");
219244
+ const fileContent = await readFile12(dependencyOverridesFile, "utf-8");
219244
219245
  const indentationSize = getIndentationSize(fileContent);
219245
219246
  const prependNewline = fileContent.length > 0 && !fileContent.endsWith("\n\n");
219246
219247
  return {
@@ -219360,7 +219361,7 @@ var MavenSocketUpgradeManager = class {
219360
219361
 
219361
219362
  // ../fixing-management/src/fixing-management/maven/sbt-fixing-manager.ts
219362
219363
  import { existsSync as existsSync8 } from "node:fs";
219363
- import { readFile as readFile14 } from "node:fs/promises";
219364
+ import { readFile as readFile13 } from "node:fs/promises";
219364
219365
  import { join as join8 } from "node:path";
219365
219366
  var SbtFixingManager = class {
219366
219367
  constructor(rootDir, subprojectPath, otherModulesCommunicator) {
@@ -219562,7 +219563,7 @@ var SbtFixingManager = class {
219562
219563
  `
219563
219564
  };
219564
219565
  } else {
219565
- const fileContent = await readFile14(workspaceBuildSbtPath, "utf-8");
219566
+ const fileContent = await readFile13(workspaceBuildSbtPath, "utf-8");
219566
219567
  const prependNewline = fileContent.split("\n").some((line) => !line.trim());
219567
219568
  return {
219568
219569
  file: workspaceBuildSbtPath,
@@ -219641,7 +219642,7 @@ ${indent(1, indentationSize)}`)}
219641
219642
  newText: overrideText
219642
219643
  };
219643
219644
  } else {
219644
- const fileContent = await readFile14(workspaceBuildSbtPath, "utf-8");
219645
+ const fileContent = await readFile13(workspaceBuildSbtPath, "utf-8");
219645
219646
  const indentationSize = getIndentationSize(fileContent);
219646
219647
  const prependNewline = fileContent.length > 0 && !fileContent.endsWith("\n\n");
219647
219648
  const overrideText = `dependencyOverrides ++= Seq(
@@ -219660,7 +219661,7 @@ ${indent(1, indentationSize)}`)}
219660
219661
 
219661
219662
  // ../fixing-management/src/fixing-management/npm/npm-socket-upgrade-manager.ts
219662
219663
  import { existsSync as existsSync12 } from "fs";
219663
- import { readFile as readFile19 } from "fs/promises";
219664
+ import { readFile as readFile18 } from "fs/promises";
219664
219665
  import assert10 from "node:assert";
219665
219666
  import { dirname as dirname15, join as join11, relative as relative8, resolve as resolve25 } from "path";
219666
219667
 
@@ -225506,7 +225507,7 @@ async function getWorkspacePathsFromPnpmLockFile(lockFileDir, useDotWhenNoWorksp
225506
225507
  }
225507
225508
 
225508
225509
  // ../fixing-management/src/fixing-management/npm/npm-fixing-manager.ts
225509
- import { readFile as readFile15, writeFile as writeFile4 } from "fs/promises";
225510
+ import { readFile as readFile14, writeFile as writeFile4 } from "fs/promises";
225510
225511
  import { resolve as resolve20 } from "path";
225511
225512
 
225512
225513
  // ../fixing-management/src/fixing-management/npm/npm-ecosystem-fixing-manager.ts
@@ -225563,7 +225564,7 @@ var NpmFixingManager = class extends NpmEcosystemFixingManager {
225563
225564
  }
225564
225565
  async applySecurityFixesSpecificPackageManager(fixes) {
225565
225566
  const pkgLockLocation = resolve20(this.rootDir, this.subprojectPath, "package-lock.json");
225566
- const packageLockContent = await readFile15(pkgLockLocation, "utf-8");
225567
+ const packageLockContent = await readFile14(pkgLockLocation, "utf-8");
225567
225568
  const getPackageName = (pkgPath) => {
225568
225569
  const strings = pkgPath.split("node_modules/");
225569
225570
  return strings[strings.length - 1];
@@ -225592,7 +225593,7 @@ var NpmFixingManager = class extends NpmEcosystemFixingManager {
225592
225593
  };
225593
225594
 
225594
225595
  // ../fixing-management/src/fixing-management/npm/pnpm-fixing-manager.ts
225595
- import { readFile as readFile16, writeFile as writeFile5 } from "fs/promises";
225596
+ import { readFile as readFile15, writeFile as writeFile5 } from "fs/promises";
225596
225597
  import { resolve as resolve21 } from "path";
225597
225598
  var import_yaml = __toESM(require_dist10(), 1);
225598
225599
  var import_lockfile_file2 = __toESM(require_lib25(), 1);
@@ -225736,7 +225737,7 @@ function getVersionNumber(version4) {
225736
225737
  return match2 ? `${match2[1]}` : version4;
225737
225738
  }
225738
225739
  async function readYamlFile(workspaceYamlFile) {
225739
- const workspaceYamlString = await readFile16(workspaceYamlFile, "utf8");
225740
+ const workspaceYamlString = await readFile15(workspaceYamlFile, "utf8");
225740
225741
  const parser2 = new import_yaml.Parser();
225741
225742
  const [ast] = parser2.parse(workspaceYamlString);
225742
225743
  return ast;
@@ -225773,7 +225774,7 @@ function updateCatalog(update3, map2) {
225773
225774
  }
225774
225775
 
225775
225776
  // ../fixing-management/src/fixing-management/npm/yarn-fixing-manager.ts
225776
- import { readFile as readFile18, writeFile as writeFile6 } from "fs/promises";
225777
+ import { readFile as readFile17, writeFile as writeFile6 } from "fs/promises";
225777
225778
  import { resolve as resolve24 } from "path";
225778
225779
 
225779
225780
  // ../utils/src/package-utils.ts
@@ -225808,12 +225809,12 @@ var import_yarnlock_parse_raw = __toESM(require_yarnlock_parse_raw(), 1);
225808
225809
  // ../fixing-management/src/fixing-management/npm/yarn-utils.ts
225809
225810
  var lockfile = __toESM(require_lockfile(), 1);
225810
225811
  var import_parsers = __toESM(require_lib27(), 1);
225811
- import { readFile as readFile17 } from "fs/promises";
225812
+ import { readFile as readFile16 } from "fs/promises";
225812
225813
  import { resolve as resolve23 } from "path";
225813
225814
  async function getYarnType(projectDir) {
225814
225815
  const yarnLockLocation = resolve23(projectDir, "yarn.lock");
225815
225816
  try {
225816
- const content = await readFile17(yarnLockLocation, "utf8");
225817
+ const content = await readFile16(yarnLockLocation, "utf8");
225817
225818
  if (!content || content.length === 0) {
225818
225819
  return void 0;
225819
225820
  }
@@ -225911,7 +225912,7 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
225911
225912
  logger.debug("Installation completed.");
225912
225913
  }
225913
225914
  async getYarnLockObj(filePath) {
225914
- const fileString = await readFile18(filePath, "utf8");
225915
+ const fileString = await readFile17(filePath, "utf8");
225915
225916
  const yarnType = await this.getYarnType();
225916
225917
  return yarnType === "classic" ? (0, import_yarnlock_parse_raw.parseYarnLockRawV1)(fileString) : (0, import_yarnlock_parse_raw.parseYarnLockRawV2)(fileString);
225917
225918
  }
@@ -226105,15 +226106,12 @@ var NpmSocketUpgradeManager = class {
226105
226106
  }));
226106
226107
  const lockfileName = this.getLockfileName(subprojectDir);
226107
226108
  const lockfilePath = join11(subprojectDir, lockfileName);
226108
- const oldLockfileContent = await readFile19(resolve25(this.rootDir, lockfilePath), "utf-8");
226109
226109
  try {
226110
226110
  await fixingManager.applySecurityFixesSpecificPackageManager(upgradesTransformed);
226111
- const newLockfileContent = await readFile19(resolve25(this.rootDir, lockfilePath), "utf-8");
226112
226111
  ctxt.statusUpdater?.({
226113
226112
  status: "success",
226114
226113
  file: lockfilePath,
226115
226114
  message: "Lockfile updated with dependency upgrades",
226116
- patch: createPatch(lockfilePath, oldLockfileContent, newLockfileContent, void 0, void 0, { context: 3 }),
226117
226115
  artifacts: i3(allUpgrades.map((u8) => u8.idx))
226118
226116
  });
226119
226117
  } catch (e) {
@@ -226147,22 +226145,12 @@ var NpmSocketUpgradeManager = class {
226147
226145
  await applyPatches("NPM", this.rootDir, directPatches, ctxt);
226148
226146
  }
226149
226147
  }
226150
- const lockfileContentBeforeFinalize = await readFile19(resolve25(this.rootDir, lockfilePath), "utf-8");
226151
226148
  try {
226152
226149
  await fixingManager.finalizeFixes();
226153
- const lockfileContentAfterFinalize = await readFile19(resolve25(this.rootDir, lockfilePath), "utf-8");
226154
226150
  ctxt.statusUpdater?.({
226155
226151
  status: "success",
226156
226152
  file: lockfilePath,
226157
226153
  message: "Lockfile finalized",
226158
- patch: createPatch(
226159
- lockfilePath,
226160
- lockfileContentBeforeFinalize,
226161
- lockfileContentAfterFinalize,
226162
- void 0,
226163
- void 0,
226164
- { context: 3 }
226165
- ),
226166
226154
  artifacts: i3(allUpgrades.map((u8) => u8.idx))
226167
226155
  });
226168
226156
  } catch (e) {
@@ -226210,7 +226198,7 @@ var NpmSocketUpgradeManager = class {
226210
226198
  assert10(artifact.name);
226211
226199
  assert10(artifact.version);
226212
226200
  const patches = [];
226213
- const packageJsonContent = await readFile19(resolve25(this.rootDir, mf.file), "utf-8");
226201
+ const packageJsonContent = await readFile18(resolve25(this.rootDir, mf.file), "utf-8");
226214
226202
  if (mf?.start !== void 0 && mf?.end !== void 0) {
226215
226203
  const originalVersionString = packageJsonContent.substring(mf.start, mf.end);
226216
226204
  let newVersionString;
@@ -226264,7 +226252,7 @@ var RushFixingManager = class {
226264
226252
  };
226265
226253
 
226266
226254
  // ../fixing-management/src/fixing-management/nuget/nuget-fixing-manager.ts
226267
- import { readFile as readFile20, writeFile as writeFile7 } from "fs/promises";
226255
+ import { readFile as readFile19, writeFile as writeFile7 } from "fs/promises";
226268
226256
  import { join as join12 } from "path";
226269
226257
 
226270
226258
  // ../utils/src/nuget-utils.ts
@@ -226367,14 +226355,14 @@ var NugetFixingManager = class {
226367
226355
  if (projectFiles.length !== 1)
226368
226356
  throw new Error("Applying fixes to workspaces with more than 1 project file currently not supported");
226369
226357
  const projectFilePath = join12(this.getAbsWsPath(wsPath), projectFiles[0]);
226370
- const initialProjectFile = await readFile20(projectFilePath, "utf-8");
226358
+ const initialProjectFile = await readFile19(projectFilePath, "utf-8");
226371
226359
  const initialLockFile = await this.restoreWorkspaceAndParseLockFile(wsPath);
226372
226360
  await applySeries(fixesWithId, async ({ fixId, vulnerabilityFixes }) => {
226373
226361
  await this.applySecurityFixesForWorkspace(wsPath, projectFilePath, vulnerabilityFixes, dependencyTree);
226374
226362
  signalFixApplied2?.(fixId, this.subprojectPath, wsPath, vulnerabilityFixes);
226375
226363
  });
226376
- const finalProjectFile = await readFile20(projectFilePath, "utf-8");
226377
- const finalLockFile = JSON.parse(await readFile20(this.getLockFilePath(wsPath), "utf-8"));
226364
+ const finalProjectFile = await readFile19(projectFilePath, "utf-8");
226365
+ const finalLockFile = JSON.parse(await readFile19(this.getLockFilePath(wsPath), "utf-8"));
226378
226366
  await writeFile7(projectFilePath, initialProjectFile);
226379
226367
  await writeFile7(this.getLockFilePath(wsPath), JSON.stringify(initialLockFile, null, 2));
226380
226368
  return { projectFile: finalProjectFile, lockFile: finalLockFile };
@@ -226406,7 +226394,7 @@ var NugetFixingManager = class {
226406
226394
  }
226407
226395
  }
226408
226396
  async applySecurityFixesForWorkspace(wsPath, projectFilePath, vulnFixes, dependencyTree) {
226409
- const initialProjectFile = await readFile20(projectFilePath, "utf-8");
226397
+ const initialProjectFile = await readFile19(projectFilePath, "utf-8");
226410
226398
  const initialLockFile = await this.restoreWorkspaceAndParseLockFile(wsPath);
226411
226399
  const typeCache = new Cache();
226412
226400
  const requestedCache = new Cache();
@@ -226496,7 +226484,7 @@ var NugetFixingManager = class {
226496
226484
  async restoreWorkspaceAndParseLockFile(wsPath) {
226497
226485
  const succeeded = await execAndLogOnFailure2("dotnet restore --use-lock-file", this.getAbsWsPath(wsPath));
226498
226486
  if (!succeeded) throw new Error(`Error applying fix - could not restore project ${this.subprojectPath}/${wsPath}`);
226499
- return JSON.parse(await readFile20(this.getLockFilePath(wsPath), "utf-8"));
226487
+ return JSON.parse(await readFile19(this.getLockFilePath(wsPath), "utf-8"));
226500
226488
  }
226501
226489
  getLockFilePath(wsPath, lockFileName = "packages.lock.json") {
226502
226490
  return join12(this.getAbsWsPath(wsPath), lockFileName);
@@ -226574,7 +226562,7 @@ import { dirname as dirname17, resolve as resolve27 } from "node:path";
226574
226562
 
226575
226563
  // ../utils/src/nuget-project-utils.ts
226576
226564
  var import_parse_xml3 = __toESM(require_dist(), 1);
226577
- import { readFile as readFile21 } from "node:fs/promises";
226565
+ import { readFile as readFile20 } from "node:fs/promises";
226578
226566
  import { dirname as dirname16, join as join14, relative as relative9, resolve as resolve26, basename as basename7, extname } from "node:path";
226579
226567
  import { existsSync as existsSync13 } from "node:fs";
226580
226568
 
@@ -228132,7 +228120,7 @@ async function loadNuGetProjectOrTarget(rootDir, projectFile, mainProject, visit
228132
228120
  if (!validatedProjectPath || !existsSync13(validatedProjectPath)) return void 0;
228133
228121
  if (visited.has(validatedProjectPath)) return void 0;
228134
228122
  visited.set(validatedProjectPath);
228135
- const sourceText = await readFile21(validatedProjectPath, "utf-8");
228123
+ const sourceText = await readFile20(validatedProjectPath, "utf-8");
228136
228124
  const xml2 = (0, import_parse_xml3.parseXml)(sourceText, { includeOffsets: true });
228137
228125
  const indentation = inferIndentationFromParsedXml2(xml2, sourceText);
228138
228126
  const currentProject = {
@@ -228205,7 +228193,7 @@ async function loadNuGetProjectOrTarget(rootDir, projectFile, mainProject, visit
228205
228193
  async function loadPackagesConfig(rootDir, file, validateFile) {
228206
228194
  const validatedConfigPath = validateFile(resolve26(rootDir, file));
228207
228195
  if (!validatedConfigPath || !existsSync13(validatedConfigPath)) return void 0;
228208
- const sourceText = await readFile21(validatedConfigPath, "utf-8");
228196
+ const sourceText = await readFile20(validatedConfigPath, "utf-8");
228209
228197
  const configXml = (0, import_parse_xml3.parseXml)(sourceText, { includeOffsets: true });
228210
228198
  const packages = extractPackagesFromXml(configXml, sourceText);
228211
228199
  return {
@@ -229026,17 +229014,17 @@ import { dirname as dirname19, relative as relative10, resolve as resolve29 } fr
229026
229014
  var import_picomatch5 = __toESM(require_picomatch4(), 1);
229027
229015
  var import_semver4 = __toESM(require_semver2(), 1);
229028
229016
  import assert12 from "node:assert";
229029
- import { readFile as readFile23, writeFile as writeFile8 } from "node:fs/promises";
229017
+ import { readFile as readFile22, writeFile as writeFile8 } from "node:fs/promises";
229030
229018
 
229031
229019
  // ../utils/src/cargo-utils.ts
229032
- import { readFile as readFile22 } from "node:fs/promises";
229020
+ import { readFile as readFile21 } from "node:fs/promises";
229033
229021
  import { dirname as dirname18, resolve as resolve28 } from "node:path";
229034
229022
  var import_picomatch4 = __toESM(require_picomatch4(), 1);
229035
229023
  async function getCargoTomlFilesForCargoLockFile(rootDir, cargoLockFile, cargoTomlFiles) {
229036
229024
  const lockDir = dirname18(cargoLockFile);
229037
229025
  const rootTomlFile = cargoTomlFiles.find((file) => dirname18(file) === lockDir);
229038
229026
  if (!rootTomlFile) return void 0;
229039
- const rootTomlContent = await readFile22(resolve28(rootDir, rootTomlFile), "utf-8");
229027
+ const rootTomlContent = await readFile21(resolve28(rootDir, rootTomlFile), "utf-8");
229040
229028
  const toml = parseTOML2(rootTomlContent);
229041
229029
  if (!toml) return void 0;
229042
229030
  const memberPatterns = [];
@@ -229133,7 +229121,7 @@ var CargoSocketUpgradeManager = class {
229133
229121
  const path9 = resolve29(this.rootDir, file);
229134
229122
  if (!restoreMap.has(path9)) {
229135
229123
  restoreMap.set(path9, {
229136
- content: await readFile23(path9, "utf-8"),
229124
+ content: await readFile22(path9, "utf-8"),
229137
229125
  artifacts: []
229138
229126
  });
229139
229127
  }
@@ -229195,7 +229183,7 @@ var CargoSocketUpgradeManager = class {
229195
229183
  */
229196
229184
  async createDirectDependencyPatches(mf, idx, upgradeVersion, ctxt) {
229197
229185
  const fullPath = resolve29(this.rootDir, mf.file);
229198
- const content = await readFile23(fullPath, "utf-8");
229186
+ const content = await readFile22(fullPath, "utf-8");
229199
229187
  const toml = parseTOML2(content);
229200
229188
  if (!toml) {
229201
229189
  ctxt.statusUpdater?.({
@@ -229284,7 +229272,7 @@ var CargoSocketUpgradeManager = class {
229284
229272
  */
229285
229273
  async createTransitiveDependencyPatches(tomlFile, idx, upgradeVersion, ctxt) {
229286
229274
  const fullPath = resolve29(this.rootDir, tomlFile);
229287
- const content = await readFile23(fullPath, "utf-8");
229275
+ const content = await readFile22(fullPath, "utf-8");
229288
229276
  const toml = parseTOML2(content);
229289
229277
  if (!toml) {
229290
229278
  ctxt.statusUpdater?.({
@@ -229324,7 +229312,6 @@ ${newDependencyLine}`
229324
229312
  async refreshLockfiles(lockfileToArtifacts, ctxt, _mode2) {
229325
229313
  await asyncForEach(Object.entries(lockfileToArtifacts), async ([lockfile2, artifacts]) => {
229326
229314
  const lockfileDir = dirname19(resolve29(this.rootDir, lockfile2));
229327
- const oldFileContent = await readFile23(resolve29(this.rootDir, lockfile2), "utf-8");
229328
229315
  let result;
229329
229316
  if (this.cargoLockMatcher(lockfile2)) {
229330
229317
  result = await execNeverFail2(["cargo", "fetch"], lockfileDir);
@@ -229338,12 +229325,10 @@ ${newDependencyLine}`
229338
229325
  return;
229339
229326
  }
229340
229327
  if (!result.error) {
229341
- const finalFileContent = await readFile23(resolve29(this.rootDir, lockfile2), "utf-8");
229342
229328
  ctxt.statusUpdater?.({
229343
229329
  status: "success",
229344
229330
  file: lockfile2,
229345
229331
  message: "Lockfile updated",
229346
- patch: createPatch(lockfile2, oldFileContent, finalFileContent, void 0, void 0, { context: 3 }),
229347
229332
  artifacts: i3(artifacts)
229348
229333
  });
229349
229334
  } else {
@@ -229364,12 +229349,12 @@ ${newDependencyLine}`
229364
229349
  import { dirname as dirname21, relative as relative11, resolve as resolve32 } from "node:path";
229365
229350
  var import_picomatch7 = __toESM(require_picomatch4(), 1);
229366
229351
  import assert13 from "node:assert";
229367
- import { readFile as readFile26, writeFile as writeFile9 } from "node:fs/promises";
229352
+ import { readFile as readFile25, writeFile as writeFile9 } from "node:fs/promises";
229368
229353
  var import_pip_requirements_js = __toESM(require_dist11(), 1);
229369
229354
 
229370
229355
  // ../utils/src/pip-utils.ts
229371
229356
  import { existsSync as existsSync14 } from "node:fs";
229372
- import { readFile as readFile25 } from "node:fs/promises";
229357
+ import { readFile as readFile24 } from "node:fs/promises";
229373
229358
  import { dirname as dirname20, resolve as resolve31 } from "node:path";
229374
229359
  import util4 from "node:util";
229375
229360
 
@@ -229378,7 +229363,7 @@ var import_lodash6 = __toESM(require_lodash(), 1);
229378
229363
  var import_semver5 = __toESM(require_semver2(), 1);
229379
229364
  import { execFileSync } from "child_process";
229380
229365
  import { constants as constants3 } from "fs";
229381
- import { access as access3, readFile as readFile24 } from "fs/promises";
229366
+ import { access as access3, readFile as readFile23 } from "fs/promises";
229382
229367
  import { join as join15, resolve as resolve30 } from "path";
229383
229368
  import util3 from "util";
229384
229369
  var { once: once2 } = import_lodash6.default;
@@ -229398,14 +229383,14 @@ var hasPyenv = once2(async () => !(await execNeverFail2("which pyenv")).error);
229398
229383
  // ../utils/src/pip-utils.ts
229399
229384
  var import_picomatch6 = __toESM(require_picomatch4(), 1);
229400
229385
  async function isSetupPySetuptools(file) {
229401
- const content = await readFile25(file, "utf-8");
229386
+ const content = await readFile24(file, "utf-8");
229402
229387
  return content.includes("setup(") && (/^\s*from\s+(?:setuptools|distutils\.core)\s+import\s+.*setup/m.test(content) || /^\s*import\s+(?:setuptools|distutils\.core)/m.test(content));
229403
229388
  }
229404
229389
  async function getPyprojectTomlFilesForLockFile(rootDir, uvLockfile, pyprojectFiles) {
229405
229390
  const lockDir = dirname20(uvLockfile);
229406
229391
  const rootTomlFile = pyprojectFiles.find((file) => dirname20(file) === lockDir);
229407
229392
  if (!rootTomlFile) return void 0;
229408
- const rootTomlContent = await readFile25(resolve31(rootDir, rootTomlFile), "utf-8");
229393
+ const rootTomlContent = await readFile24(resolve31(rootDir, rootTomlFile), "utf-8");
229409
229394
  const toml = parseTOML2(rootTomlContent);
229410
229395
  if (!toml) return void 0;
229411
229396
  const memberPatterns = [];
@@ -229838,7 +229823,7 @@ var PipSocketUpgradeManager = class {
229838
229823
  const path9 = resolve32(this.rootDir, file);
229839
229824
  if (!restoreMap.has(path9)) {
229840
229825
  restoreMap.set(path9, {
229841
- content: await readFile26(path9, "utf-8"),
229826
+ content: await readFile25(path9, "utf-8"),
229842
229827
  artifacts: []
229843
229828
  });
229844
229829
  }
@@ -229915,7 +229900,7 @@ var PipSocketUpgradeManager = class {
229915
229900
  const refStart = ref.start;
229916
229901
  const refEnd = ref.end;
229917
229902
  try {
229918
- const content = await readFile26(fullPath, "utf-8");
229903
+ const content = await readFile25(fullPath, "utf-8");
229919
229904
  const requirements = (0, import_pip_requirements_js.parsePipRequirementsFileLoosely)(content, { includeLocations: true });
229920
229905
  const foundRequirement = requirements.filter((req) => req.data.type === "ProjectName").find((req) => refStart <= req.location.startIdx && req.location.endIdx <= refEnd);
229921
229906
  if (foundRequirement) {
@@ -229948,7 +229933,7 @@ var PipSocketUpgradeManager = class {
229948
229933
  assert13(artifact.version);
229949
229934
  const patches = [];
229950
229935
  try {
229951
- const content = await readFile26(fullPath, "utf-8");
229936
+ const content = await readFile25(fullPath, "utf-8");
229952
229937
  const newText = `${artifact.name}==${upgradeVersion}`;
229953
229938
  patches.push({
229954
229939
  file: requirementsFile,
@@ -229974,7 +229959,7 @@ ${newText}
229974
229959
  */
229975
229960
  async createPyprojectTomlDirectDependencyPatches(tomlFile, idx, upgradeVersion, ctxt) {
229976
229961
  const fullPath = resolve32(this.rootDir, tomlFile);
229977
- const content = await readFile26(fullPath, "utf-8");
229962
+ const content = await readFile25(fullPath, "utf-8");
229978
229963
  const toml = parseTOML2(content);
229979
229964
  if (!toml) {
229980
229965
  ctxt.statusUpdater?.({
@@ -230093,7 +230078,7 @@ ${newText}
230093
230078
  assert13(artifact.version);
230094
230079
  const patches = [];
230095
230080
  try {
230096
- const content = await readFile26(resolve32(this.rootDir, pyprojectToml), "utf-8");
230081
+ const content = await readFile25(resolve32(this.rootDir, pyprojectToml), "utf-8");
230097
230082
  const toml = parseTOML2(content);
230098
230083
  if (!toml) {
230099
230084
  ctxt.statusUpdater?.({
@@ -230149,7 +230134,7 @@ ${newText}
230149
230134
  assert13(artifact.version);
230150
230135
  const patches = [];
230151
230136
  try {
230152
- const content = await readFile26(resolve32(this.rootDir, pyprojectToml), "utf-8");
230137
+ const content = await readFile25(resolve32(this.rootDir, pyprojectToml), "utf-8");
230153
230138
  const toml = parseTOML2(content);
230154
230139
  if (!toml) {
230155
230140
  ctxt.statusUpdater?.({
@@ -230220,7 +230205,6 @@ ${" ".repeat(4)}"${artifact.name}==${upgradeVersion}",
230220
230205
  async refreshLockfiles(lockfileToArtifacts, ctxt, _mode2) {
230221
230206
  await asyncForEach(Object.entries(lockfileToArtifacts), async ([lockfile2, artifacts]) => {
230222
230207
  const lockfileDir = dirname21(resolve32(this.rootDir, lockfile2));
230223
- const oldFileContent = await readFile26(resolve32(this.rootDir, lockfile2), "utf-8");
230224
230208
  let result;
230225
230209
  if (this.uvLockMatcher(lockfile2)) {
230226
230210
  result = await execNeverFail2(["uv", "lock"], lockfileDir);
@@ -230234,12 +230218,10 @@ ${" ".repeat(4)}"${artifact.name}==${upgradeVersion}",
230234
230218
  return;
230235
230219
  }
230236
230220
  if (!result.error) {
230237
- const finalFileContent = await readFile26(resolve32(this.rootDir, lockfile2), "utf-8");
230238
230221
  ctxt.statusUpdater?.({
230239
230222
  status: "success",
230240
230223
  file: lockfile2,
230241
230224
  message: "Lockfile updated",
230242
- patch: createPatch(lockfile2, oldFileContent, finalFileContent, void 0, void 0, { context: 3 }),
230243
230225
  artifacts: i3(artifacts)
230244
230226
  });
230245
230227
  } else {
@@ -230260,7 +230242,7 @@ function canonicalizePyPIName(name2) {
230260
230242
  }
230261
230243
  async function getDependenciesMapFromUvLock(rootDir, lockFile, pyprojectTomlFilesForLockFile) {
230262
230244
  const result = /* @__PURE__ */ new Map();
230263
- const lockToml = parseTOML2(await readFile26(resolve32(rootDir, lockFile), "utf-8"));
230245
+ const lockToml = parseTOML2(await readFile25(resolve32(rootDir, lockFile), "utf-8"));
230264
230246
  if (!lockToml) return result;
230265
230247
  const children2 = /* @__PURE__ */ new Map();
230266
230248
  const packages = lockToml.package;
@@ -230284,7 +230266,7 @@ async function getDependenciesMapFromUvLock(rootDir, lockFile, pyprojectTomlFile
230284
230266
  }
230285
230267
  const tomlFileToName = new Map(
230286
230268
  await asyncFilterMap(pyprojectTomlFilesForLockFile, async (tomlFile) => {
230287
- const toml = parseTOML2(await readFile26(resolve32(rootDir, tomlFile), "utf-8"));
230269
+ const toml = parseTOML2(await readFile25(resolve32(rootDir, tomlFile), "utf-8"));
230288
230270
  return toml && toml.project instanceof TOMLTable && toml.project.name instanceof TOMLScalar && typeof toml.project.name[value] === "string" ? [tomlFile, toml.project.name[value]] : void 0;
230289
230271
  })
230290
230272
  );
@@ -230674,7 +230656,7 @@ function parseGemfileLock(content) {
230674
230656
  }
230675
230657
 
230676
230658
  // ../fixing-management/src/fixing-management/rubygems/rubygems-socket-upgrade-manager.ts
230677
- import { readFile as readFile27, writeFile as writeFile10 } from "node:fs/promises";
230659
+ import { readFile as readFile26, writeFile as writeFile10 } from "node:fs/promises";
230678
230660
 
230679
230661
  // ../fixing-management/src/fixing-management/rubygems/rubygems-patch-utils.ts
230680
230662
  function createRubygemVersionPatches(gem, idx, upgradeVersion, rangeStyle, statusUpdater) {
@@ -230887,7 +230869,7 @@ var RubygemsSocketUpgradeManager = class {
230887
230869
  for (const mf of artifact.manifestFiles ?? []) {
230888
230870
  if (this.gemfileLockMatcher(mf.file)) {
230889
230871
  if (ctxt.wsFilter && !ctxt.wsFilter(dirname23(mf.file) || ".")) continue;
230890
- const lockfileContent = await readFile27(resolve34(this.rootDir, mf.file), "utf-8");
230872
+ const lockfileContent = await readFile26(resolve34(this.rootDir, mf.file), "utf-8");
230891
230873
  const gemfileLock = parseGemfileLock(lockfileContent);
230892
230874
  const pathGems = [];
230893
230875
  for (const [pathGemName, deps] of gemfileLock.pathDependencies) {
@@ -230938,7 +230920,7 @@ var RubygemsSocketUpgradeManager = class {
230938
230920
  const path9 = resolve34(this.rootDir, file);
230939
230921
  if (!restoreMap.has(path9)) {
230940
230922
  restoreMap.set(path9, {
230941
- content: await readFile27(path9, "utf-8"),
230923
+ content: await readFile26(path9, "utf-8"),
230942
230924
  artifacts: []
230943
230925
  });
230944
230926
  }
@@ -230960,15 +230942,12 @@ var RubygemsSocketUpgradeManager = class {
230960
230942
  if (lockfile2 !== void 0) (lockfileToArtifacts[lockfile2] ??= []).push(...artifacts);
230961
230943
  }
230962
230944
  await asyncForEach(Object.entries(lockfileToArtifacts), async ([file, artifacts]) => {
230963
- const oldFileContent = await readFile27(resolve34(this.rootDir, file), "utf-8");
230964
230945
  const result = await execNeverFail2("bundle lock", dirname23(resolve34(this.rootDir, file)));
230965
- const updatedFileContent = await readFile27(resolve34(this.rootDir, file), "utf-8");
230966
230946
  if (!result.error) {
230967
230947
  ctxt.statusUpdater?.({
230968
230948
  status: "success",
230969
230949
  file,
230970
230950
  message: "Lockfile updated",
230971
- patch: createPatch(file, oldFileContent, updatedFileContent, void 0, void 0, { context: 3 }),
230972
230951
  artifacts: i3(artifacts)
230973
230952
  });
230974
230953
  } else {
@@ -231002,15 +230981,12 @@ var RubygemsSocketUpgradeManager = class {
231002
230981
  });
231003
230982
  await applyPatches("RUBYGEMS", this.rootDir, directPatches, ctxt);
231004
230983
  await asyncForEach(Object.entries(lockfileToArtifacts), async ([file, artifacts]) => {
231005
- const oldFileContent = await readFile27(resolve34(this.rootDir, file), "utf-8");
231006
230984
  const result = await execNeverFail2(cmdt`bundler lock`, dirname23(resolve34(this.rootDir, file)));
231007
- const updatedFileContent = await readFile27(resolve34(this.rootDir, file), "utf-8");
231008
230985
  if (!result.error) {
231009
230986
  ctxt.statusUpdater?.({
231010
230987
  status: "success",
231011
230988
  file,
231012
230989
  message: "Lockfile updated",
231013
- patch: createPatch(file, oldFileContent, updatedFileContent, void 0, void 0, { context: 3 }),
231014
230990
  artifacts
231015
230991
  });
231016
230992
  } else {
@@ -231036,7 +231012,7 @@ var RubygemsSocketUpgradeManager = class {
231036
231012
  const gemfilePatches = [];
231037
231013
  const artifact = ctxt.artifacts[idx];
231038
231014
  try {
231039
- const gemfileContent = await readFile27(resolve34(this.rootDir, gemfilePath), "utf-8");
231015
+ const gemfileContent = await readFile26(resolve34(this.rootDir, gemfilePath), "utf-8");
231040
231016
  const gemfile = parseGemfile(this.rootDir, gemfilePath, gemfileContent);
231041
231017
  const gemspecFiles = /* @__PURE__ */ new Set();
231042
231018
  for (const gem of gemfile.gems) {
@@ -231057,7 +231033,7 @@ var RubygemsSocketUpgradeManager = class {
231057
231033
  let foundInGemspec = false;
231058
231034
  for (const gemspecFile of gemspecFiles) {
231059
231035
  try {
231060
- const gemspecContent = await readFile27(resolve34(this.rootDir, gemspecFile), "utf-8");
231036
+ const gemspecContent = await readFile26(resolve34(this.rootDir, gemspecFile), "utf-8");
231061
231037
  const { parseGemspec: parseGemspec2 } = await Promise.resolve().then(() => (init_gemspec_utils(), gemspec_utils_exports));
231062
231038
  const gemspec = parseGemspec2(this.rootDir, gemspecFile, gemspecContent);
231063
231039
  for (const gem of gemspec.dependencies) {
@@ -231122,7 +231098,7 @@ var RubygemsSocketUpgradeManager = class {
231122
231098
  const [version4] = artifact.version.split("-");
231123
231099
  const patches = [];
231124
231100
  try {
231125
- const sourceText = await readFile27(resolve34(this.rootDir, file), "utf-8");
231101
+ const sourceText = await readFile26(resolve34(this.rootDir, file), "utf-8");
231126
231102
  const gemfile = parseGemfile(this.rootDir, file, sourceText);
231127
231103
  for (const gem of gemfile.gems) {
231128
231104
  if (evaluate4(gem.name) !== packageName) continue;
@@ -231165,7 +231141,7 @@ var RubygemsSocketUpgradeManager = class {
231165
231141
  */
231166
231142
  async createAddGemPatch(file, idx, updateVersion, ctxt) {
231167
231143
  const artifact = ctxt.artifacts[idx];
231168
- const content = await readFile27(resolve34(this.rootDir, file), "utf-8");
231144
+ const content = await readFile26(resolve34(this.rootDir, file), "utf-8");
231169
231145
  const trimmedLength = content.trimEnd().length;
231170
231146
  const needsNewline = trimmedLength > 0 && !content[trimmedLength - 1].match(/\n/);
231171
231147
  return {
@@ -231429,7 +231405,7 @@ function flattenDockerSpec({
231429
231405
  var import_winston2 = __toESM(require_winston(), 1);
231430
231406
  import { Console as Console2 } from "console";
231431
231407
  import { createWriteStream as createWriteStream3 } from "fs";
231432
- import { readFile as readFile28 } from "fs/promises";
231408
+ import { readFile as readFile27 } from "fs/promises";
231433
231409
 
231434
231410
  // ../web-compat-utils/dist/util-formatter.js
231435
231411
  import { format as format3 } from "util";
@@ -231452,6 +231428,7 @@ var CLILogger2 = class {
231452
231428
  socketTransport;
231453
231429
  // Spinner registers itself as wrapper in order to suspend spinning when logging -- default to the empty wrapper
231454
231430
  wrapper = (cb) => cb();
231431
+ finished = false;
231455
231432
  initWinstonLogger(debug, logFilePath) {
231456
231433
  if (this.logger instanceof import_winston2.Logger) {
231457
231434
  return;
@@ -231556,10 +231533,14 @@ var CLILogger2 = class {
231556
231533
  * in errors that are swallowed by the 'error' event listener in this function.
231557
231534
  */
231558
231535
  async finish() {
231536
+ if (this.finished) {
231537
+ return;
231538
+ }
231539
+ this.finished = true;
231559
231540
  await this.batchedHttpLogStreamer?.close();
231560
231541
  this.socketTransport?.close?.();
231561
231542
  return new Promise((resolve45) => {
231562
- if (this.logger instanceof Console2 || this.logger.writableEnded) {
231543
+ if (this.logger instanceof Console2) {
231563
231544
  resolve45();
231564
231545
  return;
231565
231546
  }
@@ -231580,7 +231561,7 @@ var CLILogger2 = class {
231580
231561
  await this.finish();
231581
231562
  let logContent;
231582
231563
  try {
231583
- logContent = await readFile28(logFilePath, "utf-8");
231564
+ logContent = await readFile27(logFilePath, "utf-8");
231584
231565
  } catch (e) {
231585
231566
  console.error("Error reading log file", e);
231586
231567
  }
@@ -231625,13 +231606,13 @@ async function detectVariantMaven(projectDir) {
231625
231606
  // ../docker-management/src/maven/gradle-version-detector.ts
231626
231607
  import { existsSync as existsSync17 } from "fs";
231627
231608
  import { join as join19 } from "path";
231628
- import { readFile as readFile29 } from "fs/promises";
231609
+ import { readFile as readFile28 } from "fs/promises";
231629
231610
  async function detectVariantGradle(projectDir) {
231630
231611
  return sanitizeJvmVariant("GRADLE", projectDir, await detect(projectDir));
231631
231612
  }
231632
231613
  async function detect(projectDir) {
231633
231614
  const gradleWrapperPropertiesPath = join19(projectDir, "gradle", "wrapper", "gradle-wrapper.properties");
231634
- const gradleWrapperProperties = existsSync17(gradleWrapperPropertiesPath) ? (await readFile29(gradleWrapperPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
231615
+ const gradleWrapperProperties = existsSync17(gradleWrapperPropertiesPath) ? (await readFile28(gradleWrapperPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
231635
231616
  if (!gradleWrapperProperties) return void 0;
231636
231617
  const distributionUrlRegex = /.*gradle-(\d+(\.\d+(\.\d+)?)?)/;
231637
231618
  for (const prop2 of gradleWrapperProperties) {
@@ -231647,13 +231628,13 @@ async function detect(projectDir) {
231647
231628
  // ../docker-management/src/maven/sbt-version-detector.ts
231648
231629
  import { existsSync as existsSync18 } from "fs";
231649
231630
  import { join as join20 } from "path";
231650
- import { readFile as readFile30 } from "fs/promises";
231631
+ import { readFile as readFile29 } from "fs/promises";
231651
231632
  async function detectVariantSbt(projectDir) {
231652
231633
  return sanitizeJvmVariant("SBT", projectDir, await detect2(projectDir));
231653
231634
  }
231654
231635
  async function detect2(projectDir) {
231655
231636
  const sbtBuildPropertiesPath = join20(projectDir, "project", "build.properties");
231656
- const sbtBuildProperties = existsSync18(sbtBuildPropertiesPath) ? (await readFile30(sbtBuildPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
231637
+ const sbtBuildProperties = existsSync18(sbtBuildPropertiesPath) ? (await readFile29(sbtBuildPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
231657
231638
  if (!sbtBuildProperties) return void 0;
231658
231639
  for (const prop2 of sbtBuildProperties) {
231659
231640
  const [key, value2] = prop2.split("=");
@@ -231767,7 +231748,7 @@ async function findReachabilityAnalyzersDockerImage(ecosystem) {
231767
231748
  // ../other-modules-communicator/src/other-modules-communicator.ts
231768
231749
  var import_lodash12 = __toESM(require_lodash(), 1);
231769
231750
  import { rmSync } from "fs";
231770
- import { mkdir as mkdir5, readFile as readFile31, writeFile as writeFile11 } from "fs/promises";
231751
+ import { mkdir as mkdir5, readFile as readFile30, writeFile as writeFile11 } from "fs/promises";
231771
231752
  import assert15 from "node:assert";
231772
231753
  import { platform as platform6 } from "os";
231773
231754
  import { join as join23, posix as posix2, relative as relative15, sep as sep3 } from "path";
@@ -232211,7 +232192,7 @@ var OtherModulesCommunicator = class {
232211
232192
  COANA_API_KEY: this.apiKey.type === "present" ? this.apiKey.value : ""
232212
232193
  }
232213
232194
  );
232214
- return JSON.parse(await readFile31(outputFilePathThisProcess, "utf-8")).result;
232195
+ return JSON.parse(await readFile30(outputFilePathThisProcess, "utf-8")).result;
232215
232196
  }
232216
232197
  async runReachabilityAnalyzerCommand(commandName, ecosystem, subprojectPath, workspacePath, args2, env) {
232217
232198
  const tmpDir = await this.getTmpDirForSubproject(subprojectPath);
@@ -232280,7 +232261,7 @@ var OtherModulesCommunicator = class {
232280
232261
  [...args2, "-o", outputFilePathOtherProcess],
232281
232262
  env
232282
232263
  );
232283
- return JSON.parse(await readFile31(outputFilePathThisProcess, "utf-8")).result;
232264
+ return JSON.parse(await readFile30(outputFilePathThisProcess, "utf-8")).result;
232284
232265
  }
232285
232266
  async runInDocker(ecosystem, image, entryPoint, commandName, args2, subprojectPath, tmpDir, env = process.env) {
232286
232267
  if (!await pullDockerImage(image)) return false;
@@ -233651,7 +233632,7 @@ import { join as join25, relative as relative16, resolve as resolve39 } from "pa
233651
233632
 
233652
233633
  // ../project-management/src/project-management/ecosystem-management/ecosystem-specs.ts
233653
233634
  import { existsSync as existsSync20 } from "fs";
233654
- import { readdir as readdir5, readFile as readFile32 } from "fs/promises";
233635
+ import { readdir as readdir5, readFile as readFile31 } from "fs/promises";
233655
233636
  import { join as join24, sep as sep4 } from "path";
233656
233637
  var specs = {
233657
233638
  NPM: [
@@ -233730,7 +233711,7 @@ function packageManagerIfPackageJSONExistsAndValid(packageManager) {
233730
233711
  if (!existsSync20(join24(projectDir, "package.json"))) return void 0;
233731
233712
  const packageJSONPath = join24(projectDir, "package.json");
233732
233713
  try {
233733
- JSON.parse(await readFile32(packageJSONPath, "utf-8"));
233714
+ JSON.parse(await readFile31(packageJSONPath, "utf-8"));
233734
233715
  return packageManager;
233735
233716
  } catch (e) {
233736
233717
  throw new InvalidProjectFileError(projectDir, "package.json");
@@ -235409,7 +235390,7 @@ var DEFAULT_REPORT_FILENAME_BASE = "coana-report";
235409
235390
 
235410
235391
  // dist/internal/exclude-dirs-from-configuration-files.js
235411
235392
  import { existsSync as existsSync22 } from "fs";
235412
- import { readFile as readFile33 } from "fs/promises";
235393
+ import { readFile as readFile32 } from "fs/promises";
235413
235394
  import { basename as basename10, resolve as resolve42 } from "path";
235414
235395
  var import_yaml2 = __toESM(require_dist12(), 1);
235415
235396
  async function inferExcludeDirsFromConfigurationFiles(rootWorkingDir) {
@@ -235423,7 +235404,7 @@ async function inferExcludeDirsFromConfigurationFiles(rootWorkingDir) {
235423
235404
  }
235424
235405
  async function inferExcludeDirsFromSocketConfig(socketConfigFile) {
235425
235406
  try {
235426
- const config3 = (0, import_yaml2.parse)(await readFile33(socketConfigFile, "utf8"));
235407
+ const config3 = (0, import_yaml2.parse)(await readFile32(socketConfigFile, "utf8"));
235427
235408
  const version4 = config3.version;
235428
235409
  const ignorePaths = config3[version4 === 1 ? "ignore" : "projectIgnorePaths"];
235429
235410
  if (!ignorePaths)
@@ -235723,7 +235704,7 @@ function toSocketFactsSocketDependencyTree(artifacts, vulnerabilities, tier1Reac
235723
235704
  }
235724
235705
 
235725
235706
  // dist/internal/vulnerability-scanning.js
235726
- import { readFile as readFile34 } from "fs/promises";
235707
+ import { readFile as readFile33 } from "fs/promises";
235727
235708
 
235728
235709
  // ../security-auditor/security-auditor-builder/src/mongo-connection.ts
235729
235710
  var import_mongodb = __toESM(require_lib31(), 1);
@@ -250592,7 +250573,7 @@ async function scanForVulnerabilities(dependencyTree, offlineVulnerabilityScanne
250592
250573
  }
250593
250574
  async function offlineScan(dependencyTree, offlineVulnerabilityScannerDBPath) {
250594
250575
  logger.info("using offline vulnerability scanner db");
250595
- const offlineVulnerabilityScannerDB = JSON.parse(await readFile34(offlineVulnerabilityScannerDBPath, "utf-8"));
250576
+ const offlineVulnerabilityScannerDB = JSON.parse(await readFile33(offlineVulnerabilityScannerDBPath, "utf-8"));
250596
250577
  const { ecosystemToUrlToVulnerabilityDetails, vulnerabilityDatabase } = offlineVulnerabilityScannerDB;
250597
250578
  const coanaSupportedVulnerabilitiesLoader = CoanaSupportedVulnerabilitiesLoader.create(ecosystemToUrlToVulnerabilityDetails);
250598
250579
  const vulnerabilityAccessPathLoader = CoanaSupportedVulnerabilitiesLoader.create(ecosystemToUrlToVulnerabilityDetails);
@@ -250610,7 +250591,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
250610
250591
  }
250611
250592
 
250612
250593
  // dist/version.js
250613
- var version3 = "14.12.100";
250594
+ var version3 = "14.12.102";
250614
250595
 
250615
250596
  // dist/cli-core.js
250616
250597
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -250792,6 +250773,7 @@ var CliCore = class {
250792
250773
  await this.spinner.fail();
250793
250774
  logger.error("CLI failed with error:", e);
250794
250775
  await this.shareErrorLogWithBackend(e, true, "cli-error");
250776
+ await logger.finish();
250795
250777
  if (this.socketLogServer) {
250796
250778
  await this.socketLogServer.close();
250797
250779
  }
@@ -250863,12 +250845,13 @@ var CliCore = class {
250863
250845
  }
250864
250846
  const team = this.options.socketMode ? "Socket" : "Coana";
250865
250847
  if (vulns.some((v) => v.codeAwareScanResult.type === "analysisError")) {
250866
- logger.warn(`Analysis error detected in the report - sharing log with ${team} to help debug the issue`);
250848
+ logger.warn(`Analysis error detected in the report - sharing analytics with ${team} to help debug the issue`);
250867
250849
  await this.shareErrorLogWithBackend(new Error(CLI_ANALYSIS_ERROR_MESSAGE), false, "analysis-error");
250868
250850
  }
250869
250851
  }
250870
250852
  async shareErrorLogWithBackend(e, shouldLogSharing, errorType) {
250871
- await this.dashboardAPI.sendErrorReport(this.apiKey, e.stack ?? e.message ?? "Unknown stack trace", shouldLogSharing, errorType, this.reportId, this.options.repoUrl, this.options.projectName, await logger.getLogContent(this.coanaLogPath));
250853
+ const logContent = this.options.socketMode ? "Logs are streamed to the backend - Consult the streamed log for more details" : await logger.getLogContent(this.coanaLogPath);
250854
+ await this.dashboardAPI.sendErrorReport(this.apiKey, e.stack ?? e.message ?? "Unknown stack trace", shouldLogSharing, errorType, this.reportId, this.options.repoUrl, this.options.projectName, logContent);
250872
250855
  }
250873
250856
  async shareLogWithDashboard() {
250874
250857
  if (this.reportId)
@@ -251498,7 +251481,7 @@ async function initializeComputeFixesAndUpgradePurls(path9, options) {
251498
251481
  var compareReportsCommand = new Command();
251499
251482
  compareReportsCommand.name("compare-reports").argument("<baselineReportPath>", "Path to the baseline report").argument("<newReportPath>", "Path to the new report").option("--api-key <key>", "Set the Coana dashboard API key.").option("-d, --debug", "Enable debug logging", false).option("--no-pr-comment", "Disable pull request comments (only relevant when run from a PR)", true).option("--no-block", "Do not fail with a non-zero exit code when new reachable vulnerabilities are detected", true).option("--ignore-undeterminable-reachability", "Ignore vulnerabilities with undeterminable reachability", false).action(async (baselineReportPath, newReportPath, options) => {
251500
251483
  async function readReport(reportPath) {
251501
- return JSON.parse(await readFile35(reportPath, "utf-8"));
251484
+ return JSON.parse(await readFile34(reportPath, "utf-8"));
251502
251485
  }
251503
251486
  const baselineReport = await readReport(baselineReportPath);
251504
251487
  const newReport = await readReport(newReportPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.100",
3
+ "version": "14.12.102",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -75752,6 +75752,7 @@ var CLILogger = class {
75752
75752
  socketTransport;
75753
75753
  // Spinner registers itself as wrapper in order to suspend spinning when logging -- default to the empty wrapper
75754
75754
  wrapper = (cb) => cb();
75755
+ finished = false;
75755
75756
  initWinstonLogger(debug, logFilePath) {
75756
75757
  if (this.logger instanceof import_winston.Logger) {
75757
75758
  return;
@@ -75865,10 +75866,14 @@ var CLILogger = class {
75865
75866
  * in errors that are swallowed by the 'error' event listener in this function.
75866
75867
  */
75867
75868
  async finish() {
75869
+ if (this.finished) {
75870
+ return;
75871
+ }
75872
+ this.finished = true;
75868
75873
  await this.batchedHttpLogStreamer?.close();
75869
75874
  this.socketTransport?.close?.();
75870
75875
  return new Promise((resolve23) => {
75871
- if (this.logger instanceof Console || this.logger.writableEnded) {
75876
+ if (this.logger instanceof Console) {
75872
75877
  resolve23();
75873
75878
  return;
75874
75879
  }