@socketsecurity/cli-with-sentry 1.1.47 → 1.1.49

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/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [1.1.49](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.49) - 2025-12-17
8
+
9
+ ### Added
10
+ - Added initial telemetry functionality to track CLI usage and help improve the Socket experience.
11
+
12
+ ### Fixed
13
+ - Fixed error propagation when npm package finalization failed in `socket fix`.
14
+
15
+ ### Changed
16
+ - Updated the Coana CLI to v `14.12.134`.
17
+
18
+ ## [1.1.48](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.48) - 2025-12-16
19
+
20
+ ### Changed
21
+ - Updated the Coana CLI to v `14.12.130`.
22
+
7
23
  ## [1.1.47](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.47) - 2025-12-15
8
24
 
9
25
  ### Added
package/dist/cli.js CHANGED
@@ -6825,20 +6825,28 @@ async function run$x(argv, importMeta, context) {
6825
6825
  ...flags.commonFlags,
6826
6826
  ...flags.outputFlags
6827
6827
  }, [constants.FLAG_JSON]);
6828
+
6829
+ // Track subprocess start.
6830
+ const subprocessStartTime = await utils.trackSubprocessStart(constants.NPM);
6828
6831
  const {
6829
6832
  spawnPromise
6830
6833
  } = await shadowNpmBin(argsToForward, {
6831
6834
  stdio: 'inherit'
6832
6835
  });
6833
6836
 
6837
+ // Handle exit codes and signals using event-based pattern.
6834
6838
  // See https://nodejs.org/api/child_process.html#event-exit.
6835
6839
  spawnPromise.process.on('exit', (code, signalName) => {
6836
- if (signalName) {
6837
- process.kill(process.pid, signalName);
6838
- } else if (typeof code === 'number') {
6839
- // eslint-disable-next-line n/no-process-exit
6840
- process.exit(code);
6841
- }
6840
+ // Track subprocess exit and flush telemetry before exiting.
6841
+ // Use .then() to ensure telemetry completes before process.exit().
6842
+ void utils.trackSubprocessExit(constants.NPM, subprocessStartTime, code).then(() => {
6843
+ if (signalName) {
6844
+ process.kill(process.pid, signalName);
6845
+ } else if (typeof code === 'number') {
6846
+ // eslint-disable-next-line n/no-process-exit
6847
+ process.exit(code);
6848
+ }
6849
+ });
6842
6850
  });
6843
6851
  await spawnPromise;
6844
6852
  }
@@ -6892,20 +6900,28 @@ async function run$w(argv, importMeta, {
6892
6900
  }
6893
6901
  const shadowNpxBin = /*@__PURE__*/require$4(constants.default.shadowNpxBinPath);
6894
6902
  process.exitCode = 1;
6903
+
6904
+ // Track subprocess start.
6905
+ const subprocessStartTime = await utils.trackSubprocessStart(constants.NPX);
6895
6906
  const {
6896
6907
  spawnPromise
6897
6908
  } = await shadowNpxBin(argv, {
6898
6909
  stdio: 'inherit'
6899
6910
  });
6900
6911
 
6912
+ // Handle exit codes and signals using event-based pattern.
6901
6913
  // See https://nodejs.org/api/child_process.html#event-exit.
6902
6914
  spawnPromise.process.on('exit', (code, signalName) => {
6903
- if (signalName) {
6904
- process.kill(process.pid, signalName);
6905
- } else if (typeof code === 'number') {
6906
- // eslint-disable-next-line n/no-process-exit
6907
- process.exit(code);
6908
- }
6915
+ // Track subprocess exit and flush telemetry before exiting.
6916
+ // Use .then() to ensure telemetry completes before process.exit().
6917
+ void utils.trackSubprocessExit(constants.NPX, subprocessStartTime, code).then(() => {
6918
+ if (signalName) {
6919
+ process.kill(process.pid, signalName);
6920
+ } else if (typeof code === 'number') {
6921
+ // eslint-disable-next-line n/no-process-exit
6922
+ process.exit(code);
6923
+ }
6924
+ });
6909
6925
  });
6910
6926
  await spawnPromise;
6911
6927
  }
@@ -10014,13 +10030,30 @@ async function run$l(argv, importMeta, context) {
10014
10030
 
10015
10031
  // Filter Socket flags from argv.
10016
10032
  const filteredArgv = utils.filterFlags(argv, config.flags);
10033
+
10034
+ // Track subprocess start.
10035
+ const subprocessStartTime = await utils.trackSubprocessStart(constants.PNPM);
10017
10036
  const {
10018
10037
  spawnPromise
10019
10038
  } = await shadowPnpmBin(filteredArgv, {
10020
10039
  stdio: 'inherit'
10021
10040
  });
10041
+
10042
+ // Handle exit codes and signals using event-based pattern.
10043
+ // See https://nodejs.org/api/child_process.html#event-exit.
10044
+ spawnPromise.process.on('exit', (code, signalName) => {
10045
+ // Track subprocess exit and flush telemetry before exiting.
10046
+ // Use .then() to ensure telemetry completes before process.exit().
10047
+ void utils.trackSubprocessExit(constants.PNPM, subprocessStartTime, code).then(() => {
10048
+ if (signalName) {
10049
+ process.kill(process.pid, signalName);
10050
+ } else if (typeof code === 'number') {
10051
+ // eslint-disable-next-line n/no-process-exit
10052
+ process.exit(code);
10053
+ }
10054
+ });
10055
+ });
10022
10056
  await spawnPromise;
10023
- process.exitCode = 0;
10024
10057
  }
10025
10058
 
10026
10059
  async function runRawNpm(argv) {
@@ -15369,11 +15402,29 @@ async function run(argv, importMeta, context) {
15369
15402
 
15370
15403
  // Filter Socket flags from argv.
15371
15404
  const filteredArgv = utils.filterFlags(argv, config.flags);
15405
+
15406
+ // Track subprocess start.
15407
+ const subprocessStartTime = await utils.trackSubprocessStart(constants.YARN);
15372
15408
  const {
15373
15409
  spawnPromise
15374
15410
  } = await shadowYarnBin(filteredArgv, {
15375
15411
  stdio: 'inherit'
15376
15412
  });
15413
+
15414
+ // Handle exit codes and signals using event-based pattern.
15415
+ // See https://nodejs.org/api/child_process.html#event-exit.
15416
+ spawnPromise.process.on('exit', (code, signalName) => {
15417
+ // Track subprocess exit and flush telemetry before exiting.
15418
+ // Use .then() to ensure telemetry completes before process.exit().
15419
+ void utils.trackSubprocessExit(constants.YARN, subprocessStartTime, code).then(() => {
15420
+ if (signalName) {
15421
+ process.kill(process.pid, signalName);
15422
+ } else if (typeof code === 'number') {
15423
+ // eslint-disable-next-line n/no-process-exit
15424
+ process.exit(code);
15425
+ }
15426
+ });
15427
+ });
15377
15428
  await spawnPromise;
15378
15429
  process.exitCode = 0;
15379
15430
  }
@@ -15489,7 +15540,15 @@ const rootAliases = {
15489
15540
  };
15490
15541
 
15491
15542
  const __filename$1 = require$$0.fileURLToPath((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
15543
+
15544
+ // Capture CLI start time at module level for global error handlers.
15545
+ const cliStartTime = Date.now();
15546
+
15547
+ // Set up telemetry exit handlers early to catch all exit scenarios.
15548
+ utils.setupTelemetryExitHandlers();
15492
15549
  void (async () => {
15550
+ // Track CLI start for telemetry.
15551
+ await utils.trackCliStart(process.argv);
15493
15552
  const registryUrl = vendor.registryUrl();
15494
15553
  await vendor.updater({
15495
15554
  authInfo: vendor.registryAuthTokenExports(registryUrl, {
@@ -15515,8 +15574,14 @@ void (async () => {
15515
15574
  }, {
15516
15575
  aliases: rootAliases
15517
15576
  });
15577
+
15578
+ // Track successful CLI completion.
15579
+ await utils.trackCliComplete(process.argv, cliStartTime, process.exitCode);
15518
15580
  } catch (e) {
15519
15581
  process.exitCode = 1;
15582
+
15583
+ // Track CLI error for telemetry.
15584
+ await utils.trackCliError(process.argv, cliStartTime, e, process.exitCode);
15520
15585
  require$$9.debugFn('error', 'CLI uncaught error');
15521
15586
  require$$9.debugDir('error', e);
15522
15587
  let errorBody;
@@ -15569,6 +15634,47 @@ void (async () => {
15569
15634
  }
15570
15635
  await utils.captureException(e);
15571
15636
  }
15572
- })();
15573
- //# debugId=b69f666d-f56b-4628-89f1-ad39341fe24f
15637
+ })().catch(async err => {
15638
+ // Fatal error in main async function.
15639
+ console.error('Fatal error:', err);
15640
+
15641
+ // Track CLI error for fatal exceptions.
15642
+ await utils.trackCliError(process.argv, cliStartTime, err, 1);
15643
+
15644
+ // Finalize telemetry before fatal exit.
15645
+ await utils.finalizeTelemetry();
15646
+
15647
+ // eslint-disable-next-line n/no-process-exit
15648
+ process.exit(1);
15649
+ });
15650
+
15651
+ // Handle uncaught exceptions.
15652
+ process.on('uncaughtException', async err => {
15653
+ console.error('Uncaught exception:', err);
15654
+
15655
+ // Track CLI error for uncaught exception.
15656
+ await utils.trackCliError(process.argv, cliStartTime, err, 1);
15657
+
15658
+ // Finalize telemetry before exit.
15659
+ await utils.finalizeTelemetry();
15660
+
15661
+ // eslint-disable-next-line n/no-process-exit
15662
+ process.exit(1);
15663
+ });
15664
+
15665
+ // Handle unhandled promise rejections.
15666
+ process.on('unhandledRejection', async (reason, promise) => {
15667
+ console.error('Unhandled rejection at:', promise, 'reason:', reason);
15668
+
15669
+ // Track CLI error for unhandled rejection.
15670
+ const error = reason instanceof Error ? reason : new Error(String(reason));
15671
+ await utils.trackCliError(process.argv, cliStartTime, error, 1);
15672
+
15673
+ // Finalize telemetry before exit.
15674
+ await utils.finalizeTelemetry();
15675
+
15676
+ // eslint-disable-next-line n/no-process-exit
15677
+ process.exit(1);
15678
+ });
15679
+ //# debugId=7bd1ad51-3d27-483b-96d7-504fe33c820f
15574
15680
  //# sourceMappingURL=cli.js.map