@coana-tech/cli 14.12.125 → 14.12.127

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
@@ -73599,9 +73599,9 @@ var require_lockfile = __commonJS({
73599
73599
  /* 85 */
73600
73600
  /***/
73601
73601
  function(module3, exports3) {
73602
- module3.exports = function(exec5) {
73602
+ module3.exports = function(exec4) {
73603
73603
  try {
73604
- return !!exec5();
73604
+ return !!exec4();
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(exec5) {
73736
+ module3.exports = function(exec4) {
73737
73737
  try {
73738
- return { e: false, v: exec5() };
73738
+ return { e: false, v: exec4() };
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(exec5, skipClosing) {
75211
+ module3.exports = function(exec4, 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
- exec5(arr);
75223
+ exec4(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(exec5) {
75547
- exec5(empty2, empty2);
75546
+ var FakePromise = (promise.constructor = {})[__webpack_require__(13)("species")] = function(exec4) {
75547
+ exec4(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) {
@@ -205058,6 +205058,9 @@ var CLILogger = class {
205058
205058
  // Spinner registers itself as wrapper in order to suspend spinning when logging -- default to the empty wrapper
205059
205059
  wrapper = (cb) => cb();
205060
205060
  finished = false;
205061
+ // Buffer for storing logs before MainProcessTransport is added (used in socket mode)
205062
+ streamBuffer = [];
205063
+ bufferingForStream = false;
205061
205064
  initWinstonLogger(debug, logFilePath) {
205062
205065
  if (this.logger instanceof import_winston.Logger) {
205063
205066
  return;
@@ -205124,20 +205127,43 @@ var CLILogger = class {
205124
205127
  setWrapper(wrapper) {
205125
205128
  this.wrapper = wrapper;
205126
205129
  }
205130
+ /**
205131
+ * Enable buffering of logs for later streaming via MainProcessTransport.
205132
+ * Call this early (before initialize()) when in socket mode.
205133
+ * Buffered logs will be flushed when addTransport() is called.
205134
+ */
205135
+ enableStreamBuffering() {
205136
+ this.bufferingForStream = true;
205137
+ }
205138
+ bufferLog(level, message2, meta) {
205139
+ if (this.bufferingForStream) {
205140
+ this.streamBuffer.push({
205141
+ level,
205142
+ message: message2,
205143
+ meta,
205144
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
205145
+ });
205146
+ }
205147
+ }
205127
205148
  info(message2, ...meta) {
205149
+ this.bufferLog("info", message2, meta);
205128
205150
  this.wrapper(() => this.logger.info(message2, ...meta));
205129
205151
  }
205130
205152
  file(message2, ...meta) {
205131
205153
  if (this.logger instanceof Console) return;
205154
+ this.bufferLog("file", message2, meta);
205132
205155
  this.wrapper(() => this.logger.log("file", message2, ...meta));
205133
205156
  }
205134
205157
  debug(message2, ...meta) {
205158
+ this.bufferLog("debug", message2, meta);
205135
205159
  this.wrapper(() => this.logger.debug(message2, ...meta));
205136
205160
  }
205137
205161
  warn(message2, ...meta) {
205162
+ this.bufferLog("warn", message2, meta);
205138
205163
  this.wrapper(() => this.logger.warn(message2, ...meta));
205139
205164
  }
205140
205165
  error(message2, ...meta) {
205166
+ this.bufferLog("error", message2, meta);
205141
205167
  this.wrapper(() => this.logger.error(message2, ...meta));
205142
205168
  }
205143
205169
  isDebugEnabled() {
@@ -205155,14 +205181,38 @@ var CLILogger = class {
205155
205181
  /**
205156
205182
  * Add a transport to the main process logger.
205157
205183
  * Used to add the MainProcessTransport so main process logs are sent to backend.
205184
+ * If buffering was enabled, buffered logs will be flushed to the new transport.
205158
205185
  *
205159
205186
  * @param transport - The transport to add
205160
205187
  */
205161
205188
  addTransport(transport) {
205162
205189
  if (this.logger instanceof import_winston.Logger) {
205163
205190
  this.logger.add(transport);
205191
+ if (this.bufferingForStream) {
205192
+ this.flushBufferToTransport(transport);
205193
+ }
205164
205194
  }
205165
205195
  }
205196
+ flushBufferToTransport(transport) {
205197
+ for (const entry of this.streamBuffer) {
205198
+ try {
205199
+ const fullMessage = entry.meta.length > 0 ? `${entry.message} ${entry.meta.map((m4) => typeof m4 === "object" ? JSON.stringify(m4) : String(m4)).join(" ")}` : entry.message;
205200
+ transport.log?.(
205201
+ {
205202
+ level: entry.level,
205203
+ message: fullMessage,
205204
+ timestamp: entry.timestamp
205205
+ },
205206
+ () => {
205207
+ }
205208
+ );
205209
+ } catch (error) {
205210
+ console.error("Error flushing buffered log entry:", error);
205211
+ }
205212
+ }
205213
+ this.streamBuffer = [];
205214
+ this.bufferingForStream = false;
205215
+ }
205166
205216
  /**
205167
205217
  * End the logger instance and return a promise
205168
205218
  * that resolves when the logger is finished.
@@ -206637,13 +206687,6 @@ async function execNeverFail(cmd, dir, options) {
206637
206687
  childProcess.stdin?.end();
206638
206688
  });
206639
206689
  }
206640
- async function exec(cmd, dir, options) {
206641
- const { error, stdout, stderr } = await execNeverFail(cmd, dir, options);
206642
- if (!error) return { stdout, stderr };
206643
- error.stdout = stdout;
206644
- error.stderr = stderr;
206645
- throw error;
206646
- }
206647
206690
  async function runCommandResolveStdOut(cmd, dir, options) {
206648
206691
  const { stdout, error } = await execNeverFail(cmd, dir, options);
206649
206692
  if (error) throw error;
@@ -213262,17 +213305,6 @@ async function execNeverFail2(cmd, dir, options) {
213262
213305
  logger.debug(`Command ${formatCmd(cmd, dir)} finished ${result.error ? "with error" : "successfully"}`);
213263
213306
  return result;
213264
213307
  }
213265
- async function exec2(cmd, dir, options) {
213266
- logger.debug(`Running command: ${formatCmd(cmd, dir)}`);
213267
- try {
213268
- const result = await exec(cmd, dir, options);
213269
- logger.debug(`Command ${formatCmd(cmd, dir)} finished successfully`);
213270
- return result;
213271
- } catch (error) {
213272
- logger.debug(`Command ${formatCmd(cmd, dir)} finished with error`);
213273
- throw error;
213274
- }
213275
- }
213276
213308
  async function runCommandResolveStdOut2(cmd, dir, options) {
213277
213309
  logger.debug(`Running command: ${formatCmd(cmd, dir)}`);
213278
213310
  try {
@@ -213419,13 +213451,13 @@ var Diff = class {
213419
213451
  editLength++;
213420
213452
  };
213421
213453
  if (callback) {
213422
- (function exec5() {
213454
+ (function exec4() {
213423
213455
  setTimeout(function() {
213424
213456
  if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
213425
213457
  return callback(void 0);
213426
213458
  }
213427
213459
  if (!execEditLength()) {
213428
- exec5();
213460
+ exec4();
213429
213461
  }
213430
213462
  }, 0);
213431
213463
  })();
@@ -225681,8 +225713,8 @@ var getNpmBin = once(async () => {
225681
225713
  async function actuallyRunInstall(specificPackagesArgs = [], dir) {
225682
225714
  const installationCommand = cmdt2`${await getNpmBin()} install -f --ignore-scripts --no-fund --no-audit --no-progress ${specificPackagesArgs}`;
225683
225715
  logger.debug(`Running installation command: "${installationCommand}" in ${dir}`);
225684
- const result = execAndLogOnFailure4(installationCommand, dir);
225685
- logger.info(`Installation completed.`);
225716
+ const result = await execAndLogOnFailure4(installationCommand, dir);
225717
+ logger.info(`Installation ${result ? "completed" : "failed"}.`);
225686
225718
  return result;
225687
225719
  }
225688
225720
  async function getWorkspacePathsFromPackageJSON(projectFolder, useDotWhenNoWorkspaces = false) {
@@ -225876,7 +225908,7 @@ var PnpmFixingManager = class extends NpmEcosystemFixingManager {
225876
225908
  const installationCommand = cmdt`pnpm install --ignore-scripts${await this.getPnpmMajorVersion() >= 9 && specificPackagesCmd.length === 0 ? "--no-frozen-lockfile" : ""} --config.confirmModulesPurge=false ${specificPackagesCmd}`;
225877
225909
  const installDir = resolve22(this.rootDir, this.subprojectPath, workspacePath);
225878
225910
  logger.info(`Running installation command: "${installationCommand}" in ${installDir}`);
225879
- await exec2(installationCommand, installDir);
225911
+ await execAndLogOnFailure2(installationCommand, installDir);
225880
225912
  logger.info(`Installation completed.`);
225881
225913
  }
225882
225914
  async getLockFileYaml() {
@@ -225976,7 +226008,10 @@ var PnpmFixingManager = class extends NpmEcosystemFixingManager {
225976
226008
  async finalizeFixes() {
225977
226009
  const cmd = cmdt`pnpm install --ignore-scripts --fix-lockfile --config.confirmModulesPurge=false `;
225978
226010
  logger.info(`Adjusting lock file changes by running '${cmd}'`);
225979
- await exec2(cmd, resolve22(this.rootDir, this.subprojectPath));
226011
+ const result = await execAndLogOnFailure2(cmd, resolve22(this.rootDir, this.subprojectPath));
226012
+ if (!result) {
226013
+ throw new Error(`Failed to install packages`);
226014
+ }
225980
226015
  }
225981
226016
  };
225982
226017
  function getVersionNumber(version4) {
@@ -231701,6 +231736,9 @@ var CLILogger2 = class {
231701
231736
  // Spinner registers itself as wrapper in order to suspend spinning when logging -- default to the empty wrapper
231702
231737
  wrapper = (cb) => cb();
231703
231738
  finished = false;
231739
+ // Buffer for storing logs before MainProcessTransport is added (used in socket mode)
231740
+ streamBuffer = [];
231741
+ bufferingForStream = false;
231704
231742
  initWinstonLogger(debug, logFilePath) {
231705
231743
  if (this.logger instanceof import_winston2.Logger) {
231706
231744
  return;
@@ -231757,21 +231795,44 @@ var CLILogger2 = class {
231757
231795
  setWrapper(wrapper) {
231758
231796
  this.wrapper = wrapper;
231759
231797
  }
231798
+ /**
231799
+ * Enable buffering of logs for later streaming via MainProcessTransport.
231800
+ * Call this early (before initialize()) when in socket mode.
231801
+ * Buffered logs will be flushed when addTransport() is called.
231802
+ */
231803
+ enableStreamBuffering() {
231804
+ this.bufferingForStream = true;
231805
+ }
231806
+ bufferLog(level, message2, meta) {
231807
+ if (this.bufferingForStream) {
231808
+ this.streamBuffer.push({
231809
+ level,
231810
+ message: message2,
231811
+ meta,
231812
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
231813
+ });
231814
+ }
231815
+ }
231760
231816
  info(message2, ...meta) {
231817
+ this.bufferLog("info", message2, meta);
231761
231818
  this.wrapper(() => this.logger.info(message2, ...meta));
231762
231819
  }
231763
231820
  file(message2, ...meta) {
231764
231821
  if (this.logger instanceof Console2)
231765
231822
  return;
231823
+ this.bufferLog("file", message2, meta);
231766
231824
  this.wrapper(() => this.logger.log("file", message2, ...meta));
231767
231825
  }
231768
231826
  debug(message2, ...meta) {
231827
+ this.bufferLog("debug", message2, meta);
231769
231828
  this.wrapper(() => this.logger.debug(message2, ...meta));
231770
231829
  }
231771
231830
  warn(message2, ...meta) {
231831
+ this.bufferLog("warn", message2, meta);
231772
231832
  this.wrapper(() => this.logger.warn(message2, ...meta));
231773
231833
  }
231774
231834
  error(message2, ...meta) {
231835
+ this.bufferLog("error", message2, meta);
231775
231836
  this.wrapper(() => this.logger.error(message2, ...meta));
231776
231837
  }
231777
231838
  isDebugEnabled() {
@@ -231789,14 +231850,35 @@ var CLILogger2 = class {
231789
231850
  /**
231790
231851
  * Add a transport to the main process logger.
231791
231852
  * Used to add the MainProcessTransport so main process logs are sent to backend.
231853
+ * If buffering was enabled, buffered logs will be flushed to the new transport.
231792
231854
  *
231793
231855
  * @param transport - The transport to add
231794
231856
  */
231795
231857
  addTransport(transport) {
231796
231858
  if (this.logger instanceof import_winston2.Logger) {
231797
231859
  this.logger.add(transport);
231860
+ if (this.bufferingForStream) {
231861
+ this.flushBufferToTransport(transport);
231862
+ }
231798
231863
  }
231799
231864
  }
231865
+ flushBufferToTransport(transport) {
231866
+ for (const entry of this.streamBuffer) {
231867
+ try {
231868
+ const fullMessage = entry.meta.length > 0 ? `${entry.message} ${entry.meta.map((m4) => typeof m4 === "object" ? JSON.stringify(m4) : String(m4)).join(" ")}` : entry.message;
231869
+ transport.log?.({
231870
+ level: entry.level,
231871
+ message: fullMessage,
231872
+ timestamp: entry.timestamp
231873
+ }, () => {
231874
+ });
231875
+ } catch (error) {
231876
+ console.error("Error flushing buffered log entry:", error);
231877
+ }
231878
+ }
231879
+ this.streamBuffer = [];
231880
+ this.bufferingForStream = false;
231881
+ }
231800
231882
  /**
231801
231883
  * End the logger instance and return a promise
231802
231884
  * that resolves when the logger is finished.
@@ -236145,7 +236227,7 @@ function getMongoClient() {
236145
236227
  }
236146
236228
 
236147
236229
  // ../security-auditor/security-auditor-api/src/vulnerability-patterns-helper/get-interesting-urls-for-vulnerability.ts
236148
- import { exec as exec4 } from "child_process";
236230
+ import { exec as exec3 } from "child_process";
236149
236231
  import { promisify } from "util";
236150
236232
 
236151
236233
  // ../../node_modules/.pnpm/cheerio@1.0.0-rc.12/node_modules/cheerio/lib/esm/options.js
@@ -249741,7 +249823,7 @@ async function getInterestingURLsForVulnerability(vulnerability, packageMetadata
249741
249823
  }
249742
249824
  async function computeComparisonURLs(scmUrl, vulnAndFixVersionsArr) {
249743
249825
  try {
249744
- const gitTags = (await promisify(exec4)(`git ls-remote ${scmUrl} | grep -F "refs/tags"`)).stdout.split("\n");
249826
+ const gitTags = (await promisify(exec3)(`git ls-remote ${scmUrl} | grep -F "refs/tags"`)).stdout.split("\n");
249745
249827
  logger3.debug("gitTags", gitTags);
249746
249828
  logger3.debug("vulnAndFixVersionsArr", vulnAndFixVersionsArr);
249747
249829
  const versionToSha = {};
@@ -249776,7 +249858,7 @@ async function computeInterestingCommitURLs(text3, scmUrl) {
249776
249858
  const repo = scmUrl.split("/").slice(-2).join("/");
249777
249859
  const cmd = `gh search commits ${text3} --repo ${repo}`;
249778
249860
  logger3.debug(`Finding issue or PR url for text ${text3}`, cmd);
249779
- const { stdout } = await promisify(exec4)(cmd, { shell: "/bin/zsh" });
249861
+ const { stdout } = await promisify(exec3)(cmd, { shell: "/bin/zsh" });
249780
249862
  return stdout.split("\n").filter((line) => line).map((line) => {
249781
249863
  const [repo2, sha] = line.split(" ");
249782
249864
  return `https://www.github.com/${repo2}/commit/${sha}`;
@@ -249790,7 +249872,7 @@ async function computeInterestingIssueAndPRUrlsWithText(text3, scmUrl) {
249790
249872
  const repo = scmUrl.split("/").slice(-2).join("/");
249791
249873
  const cmd = `gh search issues ${text3} in:title,body,comment --repo ${repo} --include-prs`;
249792
249874
  console.log(`Finding issue or PR url for text ${text3}`, cmd);
249793
- const { stdout } = await promisify(exec4)(cmd, { shell: "/bin/zsh" });
249875
+ const { stdout } = await promisify(exec3)(cmd, { shell: "/bin/zsh" });
249794
249876
  return stdout.split("\n").filter((line) => line).map((line) => {
249795
249877
  const [issueOrPr, repo2, id] = line.split(" ");
249796
249878
  const issueOrPrUrlPart = issueOrPr === "issue" ? "issues" : "pull";
@@ -251019,7 +251101,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
251019
251101
  }
251020
251102
 
251021
251103
  // dist/version.js
251022
- var version3 = "14.12.125";
251104
+ var version3 = "14.12.127";
251023
251105
 
251024
251106
  // dist/cli-core.js
251025
251107
  var { mapValues, omit, partition, pickBy: pickBy2 } = import_lodash15.default;
@@ -251142,6 +251224,9 @@ var CliCore = class {
251142
251224
  const tmpDir = await createTmpDirectory("coana-cli-");
251143
251225
  this.coanaLogPath = join30(tmpDir, "coana-log.txt");
251144
251226
  this.coanaSocketPath = join30(tmpDir, "coana.sock");
251227
+ if (this.options.socketMode) {
251228
+ logger.enableStreamBuffering();
251229
+ }
251145
251230
  logger.initWinstonLogger(this.options.debug, this.coanaLogPath);
251146
251231
  logger.silent = this.options.silent;
251147
251232
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.125",
3
+ "version": "14.12.127",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -75753,6 +75753,9 @@ var CLILogger = class {
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
75755
  finished = false;
75756
+ // Buffer for storing logs before MainProcessTransport is added (used in socket mode)
75757
+ streamBuffer = [];
75758
+ bufferingForStream = false;
75756
75759
  initWinstonLogger(debug, logFilePath) {
75757
75760
  if (this.logger instanceof import_winston.Logger) {
75758
75761
  return;
@@ -75819,20 +75822,43 @@ var CLILogger = class {
75819
75822
  setWrapper(wrapper) {
75820
75823
  this.wrapper = wrapper;
75821
75824
  }
75825
+ /**
75826
+ * Enable buffering of logs for later streaming via MainProcessTransport.
75827
+ * Call this early (before initialize()) when in socket mode.
75828
+ * Buffered logs will be flushed when addTransport() is called.
75829
+ */
75830
+ enableStreamBuffering() {
75831
+ this.bufferingForStream = true;
75832
+ }
75833
+ bufferLog(level, message, meta) {
75834
+ if (this.bufferingForStream) {
75835
+ this.streamBuffer.push({
75836
+ level,
75837
+ message,
75838
+ meta,
75839
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
75840
+ });
75841
+ }
75842
+ }
75822
75843
  info(message, ...meta) {
75844
+ this.bufferLog("info", message, meta);
75823
75845
  this.wrapper(() => this.logger.info(message, ...meta));
75824
75846
  }
75825
75847
  file(message, ...meta) {
75826
75848
  if (this.logger instanceof Console) return;
75849
+ this.bufferLog("file", message, meta);
75827
75850
  this.wrapper(() => this.logger.log("file", message, ...meta));
75828
75851
  }
75829
75852
  debug(message, ...meta) {
75853
+ this.bufferLog("debug", message, meta);
75830
75854
  this.wrapper(() => this.logger.debug(message, ...meta));
75831
75855
  }
75832
75856
  warn(message, ...meta) {
75857
+ this.bufferLog("warn", message, meta);
75833
75858
  this.wrapper(() => this.logger.warn(message, ...meta));
75834
75859
  }
75835
75860
  error(message, ...meta) {
75861
+ this.bufferLog("error", message, meta);
75836
75862
  this.wrapper(() => this.logger.error(message, ...meta));
75837
75863
  }
75838
75864
  isDebugEnabled() {
@@ -75850,14 +75876,38 @@ var CLILogger = class {
75850
75876
  /**
75851
75877
  * Add a transport to the main process logger.
75852
75878
  * Used to add the MainProcessTransport so main process logs are sent to backend.
75879
+ * If buffering was enabled, buffered logs will be flushed to the new transport.
75853
75880
  *
75854
75881
  * @param transport - The transport to add
75855
75882
  */
75856
75883
  addTransport(transport) {
75857
75884
  if (this.logger instanceof import_winston.Logger) {
75858
75885
  this.logger.add(transport);
75886
+ if (this.bufferingForStream) {
75887
+ this.flushBufferToTransport(transport);
75888
+ }
75859
75889
  }
75860
75890
  }
75891
+ flushBufferToTransport(transport) {
75892
+ for (const entry of this.streamBuffer) {
75893
+ try {
75894
+ const fullMessage = entry.meta.length > 0 ? `${entry.message} ${entry.meta.map((m) => typeof m === "object" ? JSON.stringify(m) : String(m)).join(" ")}` : entry.message;
75895
+ transport.log?.(
75896
+ {
75897
+ level: entry.level,
75898
+ message: fullMessage,
75899
+ timestamp: entry.timestamp
75900
+ },
75901
+ () => {
75902
+ }
75903
+ );
75904
+ } catch (error) {
75905
+ console.error("Error flushing buffered log entry:", error);
75906
+ }
75907
+ }
75908
+ this.streamBuffer = [];
75909
+ this.bufferingForStream = false;
75910
+ }
75861
75911
  /**
75862
75912
  * End the logger instance and return a promise
75863
75913
  * that resolves when the logger is finished.
@@ -88276,6 +88326,7 @@ var ToolPathResolver = class {
88276
88326
 
88277
88327
  // dist/whole-program-code-aware-vulnerability-scanner/code-aware-vulnerability-scanner.js
88278
88328
  var import_lodash13 = __toESM(require_lodash(), 1);
88329
+ import { readFileSync as readFileSync3 } from "fs";
88279
88330
  import { resolve as resolve17 } from "path";
88280
88331
 
88281
88332
  // dist/whole-program-code-aware-vulnerability-scanner/dotnet/dotnet-code-aware-vulnerability-scanner.js
@@ -111524,7 +111575,7 @@ async function analyzePackages(ecosystem, packages, vulnerability, options) {
111524
111575
  default:
111525
111576
  throw new Error(`Analyze dependency chain not implemented for ${ecosystem}.`);
111526
111577
  }
111527
- return { analysis: { name: analysisName, version: await getVersion(analysisName) }, result };
111578
+ return { analysis: { name: analysisName, version: getVersion(analysisName) }, result };
111528
111579
  }
111529
111580
  async function analyzeAlreadyInstalledPackages(ecosystem, packages, vulnerability, options) {
111530
111581
  let analysisName;
@@ -111557,7 +111608,7 @@ async function analyzeAlreadyInstalledPackages(ecosystem, packages, vulnerabilit
111557
111608
  default:
111558
111609
  throw new Error(`analyzePackageRegistryPackage is not implemented for ${ecosystem}.`);
111559
111610
  }
111560
- return { analysis: { name: analysisName, version: await getCurrentCommitHash(analysisName.toLowerCase()) }, result };
111611
+ return { analysis: { name: analysisName, version: getCurrentCommitHash(analysisName.toLowerCase()) }, result };
111561
111612
  }
111562
111613
  async function runWithJSHeuristics(cb) {
111563
111614
  const orderedHeuristics = [heuristics.ALL_PACKAGES];
@@ -111569,8 +111620,15 @@ async function runWithJSHeuristics(cb) {
111569
111620
  }
111570
111621
  return result;
111571
111622
  }
111572
- async function getCurrentCommitHash(project) {
111573
- return (await runCommandResolveStdOut2("git rev-parse HEAD", resolve17(COANA_REPOS_PATH(), project))).trim();
111623
+ function getCurrentCommitHash(project) {
111624
+ const headShaPath = resolve17(COANA_REPOS_PATH(), project, "HEAD_SHA");
111625
+ try {
111626
+ const content = readFileSync3(headShaPath, "utf-8").trim();
111627
+ const colonIndex = content.indexOf(":");
111628
+ return colonIndex !== -1 ? content.slice(colonIndex + 1) : content;
111629
+ } catch {
111630
+ return "unknown";
111631
+ }
111574
111632
  }
111575
111633
  function detectedOccurrencesFromAPMatches(matches, pathPrefixToRemove) {
111576
111634
  for (const match2 of Object.values(matches))
@@ -111606,9 +111664,9 @@ function getStacksFromAccPaths(matches, { vulnerabilityAccessPaths }) {
111606
111664
  stacks: relevantStacks
111607
111665
  };
111608
111666
  }
111609
- async function getVersion(analysisName) {
111667
+ function getVersion(analysisName) {
111610
111668
  if (analysisName === "Jelly")
111611
- return await getCurrentCommitHash(analysisName.toLowerCase());
111669
+ return getCurrentCommitHash(analysisName.toLowerCase());
111612
111670
  return "N/A";
111613
111671
  }
111614
111672