socket 1.1.38 → 1.1.39

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,14 @@ 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.39](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.39) - 2025-12-01
8
+
9
+ ### Added
10
+ - Added the `--output <scan-report.json>` flag to `socket scan reach`.
11
+
12
+ ### Changed
13
+ - Updated the Coana CLI to v `14.12.107`.
14
+
7
15
  ## [1.1.38](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.38) - 2025-11-26
8
16
 
9
17
  ### Changed
package/dist/cli.js CHANGED
@@ -1559,6 +1559,7 @@ async function performReachabilityAnalysis(options) {
1559
1559
  branchName,
1560
1560
  cwd = process.cwd(),
1561
1561
  orgSlug,
1562
+ outputPath,
1562
1563
  packagePaths,
1563
1564
  reachabilityOptions,
1564
1565
  repoName,
@@ -1638,9 +1639,9 @@ async function performReachabilityAnalysis(options) {
1638
1639
  }
1639
1640
  spinner?.start();
1640
1641
  spinner?.infoAndStop('Running reachability analysis with Coana...');
1641
-
1642
+ const outputFilePath = outputPath || constants.default.DOT_SOCKET_DOT_FACTS_JSON;
1642
1643
  // Build Coana arguments.
1643
- const coanaArgs = ['run', analysisTarget, '--output-dir', cwd, '--socket-mode', constants.default.DOT_SOCKET_DOT_FACTS_JSON, '--disable-report-submission', ...(reachabilityOptions.reachAnalysisTimeout ? ['--analysis-timeout', `${reachabilityOptions.reachAnalysisTimeout}`] : []), ...(reachabilityOptions.reachAnalysisMemoryLimit ? ['--memory-limit', `${reachabilityOptions.reachAnalysisMemoryLimit}`] : []), ...(reachabilityOptions.reachConcurrency ? ['--concurrency', `${reachabilityOptions.reachConcurrency}`] : []), ...(reachabilityOptions.reachDebug ? ['--debug'] : []), ...(reachabilityOptions.reachDisableAnalytics ? ['--disable-analytics-sharing'] : []), ...(reachabilityOptions.reachDisableAnalysisSplitting ? ['--disable-analysis-splitting'] : []), ...(tarHash ? ['--run-without-docker', '--manifests-tar-hash', tarHash] : []),
1644
+ const coanaArgs = ['run', analysisTarget, '--output-dir', path.dirname(outputFilePath), '--socket-mode', outputFilePath, '--disable-report-submission', ...(reachabilityOptions.reachAnalysisTimeout ? ['--analysis-timeout', `${reachabilityOptions.reachAnalysisTimeout}`] : []), ...(reachabilityOptions.reachAnalysisMemoryLimit ? ['--memory-limit', `${reachabilityOptions.reachAnalysisMemoryLimit}`] : []), ...(reachabilityOptions.reachConcurrency ? ['--concurrency', `${reachabilityOptions.reachConcurrency}`] : []), ...(reachabilityOptions.reachDebug ? ['--debug'] : []), ...(reachabilityOptions.reachDisableAnalytics ? ['--disable-analytics-sharing'] : []), ...(reachabilityOptions.reachDisableAnalysisSplitting ? ['--disable-analysis-splitting'] : []), ...(tarHash ? ['--run-without-docker', '--manifests-tar-hash', tarHash] : []),
1644
1645
  // Empty reachEcosystems implies scanning all ecosystems.
1645
1646
  ...(reachabilityOptions.reachEcosystems.length ? ['--purl-types', ...reachabilityOptions.reachEcosystems] : []), ...(reachabilityOptions.reachExcludePaths.length ? ['--exclude-dirs', ...reachabilityOptions.reachExcludePaths] : []), ...(reachabilityOptions.reachSkipCache ? ['--skip-cache-usage'] : [])];
1646
1647
 
@@ -1668,9 +1669,9 @@ async function performReachabilityAnalysis(options) {
1668
1669
  return coanaResult.ok ? {
1669
1670
  ok: true,
1670
1671
  data: {
1671
- // Use the DOT_SOCKET_DOT_FACTS_JSON file for the scan.
1672
- reachabilityReport: constants.default.DOT_SOCKET_DOT_FACTS_JSON,
1673
- tier1ReachabilityScanId: utils.extractTier1ReachabilityScanId(constants.default.DOT_SOCKET_DOT_FACTS_JSON)
1672
+ // Use the actual output filename for the scan.
1673
+ reachabilityReport: outputFilePath,
1674
+ tier1ReachabilityScanId: utils.extractTier1ReachabilityScanId(outputFilePath)
1674
1675
  }
1675
1676
  } : coanaResult;
1676
1677
  }
@@ -13336,8 +13337,8 @@ async function run$8(argv, importMeta, {
13336
13337
  }
13337
13338
 
13338
13339
  async function outputScanReach(result, {
13339
- cwd,
13340
- outputKind
13340
+ outputKind,
13341
+ outputPath
13341
13342
  }) {
13342
13343
  if (!result.ok) {
13343
13344
  process.exitCode = result.code ?? 1;
@@ -13350,9 +13351,10 @@ async function outputScanReach(result, {
13350
13351
  logger.logger.fail(utils.failMsgWithBadge(result.message, result.cause));
13351
13352
  return;
13352
13353
  }
13354
+ const actualOutputPath = outputPath || constants.default.DOT_SOCKET_DOT_FACTS_JSON;
13353
13355
  logger.logger.log('');
13354
13356
  logger.logger.success('Reachability analysis completed successfully!');
13355
- logger.logger.info(`Reachability report has been written to: ${path.join(cwd, constants.default.DOT_SOCKET_DOT_FACTS_JSON)}`);
13357
+ logger.logger.info(`Reachability report has been written to: ${actualOutputPath}`);
13356
13358
  }
13357
13359
 
13358
13360
  async function handleScanReach({
@@ -13360,6 +13362,7 @@ async function handleScanReach({
13360
13362
  interactive: _interactive,
13361
13363
  orgSlug,
13362
13364
  outputKind,
13365
+ outputPath,
13363
13366
  reachabilityOptions,
13364
13367
  targets
13365
13368
  }) {
@@ -13373,8 +13376,8 @@ async function handleScanReach({
13373
13376
  });
13374
13377
  if (!supportedFilesCResult.ok) {
13375
13378
  await outputScanReach(supportedFilesCResult, {
13376
- cwd,
13377
- outputKind
13379
+ outputKind,
13380
+ outputPath
13378
13381
  });
13379
13382
  return;
13380
13383
  }
@@ -13398,6 +13401,7 @@ async function handleScanReach({
13398
13401
  const result = await performReachabilityAnalysis({
13399
13402
  cwd,
13400
13403
  orgSlug,
13404
+ outputPath,
13401
13405
  packagePaths,
13402
13406
  reachabilityOptions,
13403
13407
  spinner,
@@ -13406,8 +13410,8 @@ async function handleScanReach({
13406
13410
  });
13407
13411
  spinner.stop();
13408
13412
  await outputScanReach(result, {
13409
- cwd,
13410
- outputKind
13413
+ outputKind,
13414
+ outputPath
13411
13415
  });
13412
13416
  }
13413
13417
 
@@ -13426,6 +13430,12 @@ const generalFlags = {
13426
13430
  type: 'string',
13427
13431
  default: '',
13428
13432
  description: 'Force override the organization slug, overrides the default org from config'
13433
+ },
13434
+ output: {
13435
+ type: 'string',
13436
+ default: '',
13437
+ description: 'Path to write the reachability report to (must end with .json). Defaults to .socket.facts.json in the current working directory.',
13438
+ shortFlag: 'o'
13429
13439
  }
13430
13440
  };
13431
13441
  const cmdScanReach = {
@@ -13458,7 +13468,8 @@ async function run$7(argv, importMeta, {
13458
13468
  ${utils.getFlagListOutput(reachabilityFlags)}
13459
13469
 
13460
13470
  Runs the Socket reachability analysis without creating a scan in Socket.
13461
- The output is written to .socket.facts.json in the current working directory.
13471
+ The output is written to .socket.facts.json in the current working directory
13472
+ unless the --output flag is specified.
13462
13473
 
13463
13474
  Note: Manifest files are uploaded to Socket's backend services because the
13464
13475
  reachability analysis requires creating a Software Bill of Materials (SBOM)
@@ -13468,6 +13479,8 @@ async function run$7(argv, importMeta, {
13468
13479
  $ ${command}
13469
13480
  $ ${command} ./proj
13470
13481
  $ ${command} ./proj --reach-ecosystems npm,pypi
13482
+ $ ${command} --output custom-report.json
13483
+ $ ${command} ./proj --output ./reports/analysis.json
13471
13484
  `
13472
13485
  };
13473
13486
  const cli = utils.meowOrExit({
@@ -13482,6 +13495,7 @@ async function run$7(argv, importMeta, {
13482
13495
  json,
13483
13496
  markdown,
13484
13497
  org: orgFlag,
13498
+ output: outputPath,
13485
13499
  reachAnalysisMemoryLimit,
13486
13500
  reachAnalysisTimeout,
13487
13501
  reachConcurrency,
@@ -13538,6 +13552,11 @@ async function run$7(argv, importMeta, {
13538
13552
  test: !json || !markdown,
13539
13553
  message: 'The json and markdown flags cannot be both set, pick one',
13540
13554
  fail: 'omit one'
13555
+ }, {
13556
+ nook: true,
13557
+ test: !outputPath || outputPath.endsWith('.json'),
13558
+ message: 'The --output path must end with .json',
13559
+ fail: 'use a path ending with .json'
13541
13560
  }, {
13542
13561
  nook: true,
13543
13562
  test: targetValidation.isValid,
@@ -13568,10 +13587,10 @@ async function run$7(argv, importMeta, {
13568
13587
  }
13569
13588
  await handleScanReach({
13570
13589
  cwd,
13590
+ interactive,
13571
13591
  orgSlug,
13572
13592
  outputKind,
13573
- targets,
13574
- interactive,
13593
+ outputPath: outputPath || '',
13575
13594
  reachabilityOptions: {
13576
13595
  reachAnalysisTimeout: Number(reachAnalysisTimeout),
13577
13596
  reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
@@ -13582,7 +13601,8 @@ async function run$7(argv, importMeta, {
13582
13601
  reachEcosystems,
13583
13602
  reachExcludePaths,
13584
13603
  reachSkipCache: Boolean(reachSkipCache)
13585
- }
13604
+ },
13605
+ targets
13586
13606
  });
13587
13607
  }
13588
13608
 
@@ -15419,5 +15439,5 @@ void (async () => {
15419
15439
  await utils.captureException(e);
15420
15440
  }
15421
15441
  })();
15422
- //# debugId=39010d7c-ef10-4b4e-b008-38ac722e7d5d
15442
+ //# debugId=8693f005-3cc6-4712-ba1e-c0aa7f093c42
15423
15443
  //# sourceMappingURL=cli.js.map