@coana-tech/cli 14.12.100 → 14.12.101

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
@@ -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
  }
@@ -231452,6 +231457,7 @@ var CLILogger2 = class {
231452
231457
  socketTransport;
231453
231458
  // Spinner registers itself as wrapper in order to suspend spinning when logging -- default to the empty wrapper
231454
231459
  wrapper = (cb) => cb();
231460
+ finished = false;
231455
231461
  initWinstonLogger(debug, logFilePath) {
231456
231462
  if (this.logger instanceof import_winston2.Logger) {
231457
231463
  return;
@@ -231556,10 +231562,14 @@ var CLILogger2 = class {
231556
231562
  * in errors that are swallowed by the 'error' event listener in this function.
231557
231563
  */
231558
231564
  async finish() {
231565
+ if (this.finished) {
231566
+ return;
231567
+ }
231568
+ this.finished = true;
231559
231569
  await this.batchedHttpLogStreamer?.close();
231560
231570
  this.socketTransport?.close?.();
231561
231571
  return new Promise((resolve45) => {
231562
- if (this.logger instanceof Console2 || this.logger.writableEnded) {
231572
+ if (this.logger instanceof Console2) {
231563
231573
  resolve45();
231564
231574
  return;
231565
231575
  }
@@ -250610,7 +250620,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
250610
250620
  }
250611
250621
 
250612
250622
  // dist/version.js
250613
- var version3 = "14.12.100";
250623
+ var version3 = "14.12.101";
250614
250624
 
250615
250625
  // dist/cli-core.js
250616
250626
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -250792,6 +250802,7 @@ var CliCore = class {
250792
250802
  await this.spinner.fail();
250793
250803
  logger.error("CLI failed with error:", e);
250794
250804
  await this.shareErrorLogWithBackend(e, true, "cli-error");
250805
+ await logger.finish();
250795
250806
  if (this.socketLogServer) {
250796
250807
  await this.socketLogServer.close();
250797
250808
  }
@@ -250863,12 +250874,13 @@ var CliCore = class {
250863
250874
  }
250864
250875
  const team = this.options.socketMode ? "Socket" : "Coana";
250865
250876
  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`);
250877
+ logger.warn(`Analysis error detected in the report - sharing analytics with ${team} to help debug the issue`);
250867
250878
  await this.shareErrorLogWithBackend(new Error(CLI_ANALYSIS_ERROR_MESSAGE), false, "analysis-error");
250868
250879
  }
250869
250880
  }
250870
250881
  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));
250882
+ const logContent = this.options.socketMode ? "Logs are streamed to the backend - Consult the streamed log for more details" : await logger.getLogContent(this.coanaLogPath);
250883
+ 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
250884
  }
250873
250885
  async shareLogWithDashboard() {
250874
250886
  if (this.reportId)
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.101",
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
  }