socket 1.1.121 → 1.1.123

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,19 @@ 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.123](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.123) - 2026-06-18
8
+
9
+ ### Added
10
+ - `socket scan create --reach` and `socket scan reach` now accept unit suffixes on `--reach-analysis-timeout` (`s`, `m`, `h` — e.g. `90s`, `10m`, `1h`) and `--reach-analysis-memory-limit` (`MB`, `GB` — e.g. `512MB`, `8GB`). Plain numbers keep working as before.
11
+
12
+ ### Changed
13
+ - Updated the Coana CLI to v `15.5.0`.
14
+
15
+ ## [1.1.122](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.122) - 2026-06-17
16
+
17
+ ### Changed
18
+ - Updated the Coana CLI to v `15.4.6`.
19
+
7
20
  ## [1.1.121](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.121) - 2026-06-17
8
21
 
9
22
  ### Fixed
package/dist/cli.js CHANGED
@@ -1707,11 +1707,45 @@ async function outputCreateNewScan(result, options) {
1707
1707
  }
1708
1708
  }
1709
1709
 
1710
+ // Helpers for the reachability unit values. Coana (@coana-tech/cli) is the sole
1711
+ // validator/parser of these values; the Socket CLI forwards the raw string
1712
+ // through verbatim. These helpers do NOT validate grammar (that would duplicate
1713
+ // Coana's and drift): they only handle the meow-default sentinel and detect
1714
+ // whether a value differs from the default, neither of which Coana models.
1715
+
1716
+ // A zero-magnitude or empty value (e.g. "", "0", "0s", "0gb") means "use the
1717
+ // default": the flag is omitted when forwarding and Coana applies its own
1718
+ // default. This preserves the historical sentinel where a numeric 0 dropped the
1719
+ // flag, and avoids Coana's undefined zero (0ms / 0MB) path.
1720
+ function isOmittedReachValue(value) {
1721
+ const match = /^\d+/.exec(value);
1722
+ return !match || Number(match[0]) === 0;
1723
+ }
1724
+
1725
+ // Resolve a memory-limit value to its magnitude in MB (the unit Coana uses), or
1726
+ // null when the value is omitted/zero (Coana then applies its own default).
1727
+ // Used only to compare a value against the default regardless of how the unit
1728
+ // is written: 8192, 8192MB and 8GB all resolve to 8192. This is default
1729
+ // detection, not validation, so an unrecognized value resolves to null and is
1730
+ // simply treated as "not a non-default value".
1731
+ function reachMemoryLimitToMb(value) {
1732
+ if (isOmittedReachValue(value)) {
1733
+ return null;
1734
+ }
1735
+ const match = /^(\d+)(mb|gb)?$/i.exec(value);
1736
+ if (!match) {
1737
+ return null;
1738
+ }
1739
+ const amount = Number(match[1]);
1740
+ return match[2]?.toLowerCase() === 'gb' ? amount * 1024 : amount;
1741
+ }
1742
+
1710
1743
  async function performReachabilityAnalysis(options) {
1711
1744
  const {
1712
1745
  branchName,
1713
1746
  cwd = process.cwd(),
1714
1747
  orgSlug,
1748
+ outputKind = 'text',
1715
1749
  outputPath,
1716
1750
  packagePaths,
1717
1751
  reachabilityOptions,
@@ -1817,7 +1851,7 @@ async function performReachabilityAnalysis(options) {
1817
1851
  }
1818
1852
 
1819
1853
  // Build Coana arguments.
1820
- 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.reachContinueOnAnalysisErrors ? ['--reach-continue-on-analysis-errors'] : []), ...(reachabilityOptions.reachContinueOnInstallErrors ? ['--reach-continue-on-install-errors'] : []), ...(reachabilityOptions.reachContinueOnMissingLockFiles ? ['--reach-continue-on-missing-lock-files'] : []), ...(reachabilityOptions.reachContinueOnNoSourceFiles ? ['--reach-continue-on-no-source-files'] : []), ...(reachabilityOptions.reachDebug ? ['--debug'] : []), ...(reachabilityOptions.reachDetailedAnalysisLogFile ? ['--print-analysis-log-file'] : []), ...(reachabilityOptions.reachDisableAnalytics ? ['--disable-analytics-sharing'] : []), ...(reachabilityOptions.reachDisableExternalToolChecks ? ['--disable-external-tool-checks'] : []), ...(reachabilityOptions.reachEnableAnalysisSplitting ? [] : ['--disable-analysis-splitting']), ...(tarHash ? ['--run-without-docker', '--manifests-tar-hash', tarHash] : []),
1854
+ const coanaArgs = ['run', analysisTarget, '--output-dir', path.dirname(outputFilePath), '--socket-mode', outputFilePath, '--disable-report-submission', ...(isOmittedReachValue(reachabilityOptions.reachAnalysisTimeout) ? [] : ['--analysis-timeout', reachabilityOptions.reachAnalysisTimeout]), ...(isOmittedReachValue(reachabilityOptions.reachAnalysisMemoryLimit) ? [] : ['--memory-limit', reachabilityOptions.reachAnalysisMemoryLimit]), ...(reachabilityOptions.reachConcurrency ? ['--concurrency', `${reachabilityOptions.reachConcurrency}`] : []), ...(reachabilityOptions.reachContinueOnAnalysisErrors ? ['--reach-continue-on-analysis-errors'] : []), ...(reachabilityOptions.reachContinueOnInstallErrors ? ['--reach-continue-on-install-errors'] : []), ...(reachabilityOptions.reachContinueOnMissingLockFiles ? ['--reach-continue-on-missing-lock-files'] : []), ...(reachabilityOptions.reachContinueOnNoSourceFiles ? ['--reach-continue-on-no-source-files'] : []), ...(reachabilityOptions.reachDebug ? ['--debug'] : []), ...(reachabilityOptions.reachDetailedAnalysisLogFile ? ['--print-analysis-log-file'] : []), ...(reachabilityOptions.reachDisableAnalytics ? ['--disable-analytics-sharing'] : []), ...(reachabilityOptions.reachDisableExternalToolChecks ? ['--disable-external-tool-checks'] : []), ...(reachabilityOptions.reachEnableAnalysisSplitting ? [] : ['--disable-analysis-splitting']), ...(tarHash ? ['--run-without-docker', '--manifests-tar-hash', tarHash] : []),
1821
1855
  // Empty reachEcosystems implies scanning all ecosystems.
1822
1856
  ...(reachabilityOptions.reachEcosystems.length ? ['--purl-types', ...reachabilityOptions.reachEcosystems] : []), ...(reachabilityOptions.reachExcludePaths.length ? ['--exclude-dirs', ...reachabilityOptions.reachExcludePaths] : []), ...(reachabilityOptions.reachLazyMode ? ['--lazy-mode'] : []), ...(reachabilityOptions.reachSkipCache ? ['--skip-cache-usage'] : []), ...(reachabilityOptions.reachUseOnlyPregeneratedSboms ? ['--use-only-pregenerated-sboms'] : []),
1823
1857
  // Hand the per-ecosystem build-tool config (mapped from socket.json) to
@@ -1834,6 +1868,13 @@ async function performReachabilityAnalysis(options) {
1834
1868
  if (branchName && branchName !== constants.default.SOCKET_DEFAULT_BRANCH) {
1835
1869
  coanaEnv['SOCKET_BRANCH_NAME'] = branchName;
1836
1870
  }
1871
+
1872
+ // In machine-readable modes (--json/--markdown) the final payload is written
1873
+ // to stdout by the output layer. Coana streams progress/logs over stdout
1874
+ // under `inherit`, which would corrupt that payload, so redirect the child's
1875
+ // stdout to our stderr (fd 2). Progress stays visible for humans and
1876
+ // `2>/dev/null` isolates the JSON/markdown. stdin and stderr stay inherited.
1877
+ const coanaStdio = outputKind === 'text' ? 'inherit' : ['inherit', 2, 'inherit'];
1837
1878
  try {
1838
1879
  // Run Coana with the manifests tar hash.
1839
1880
  const coanaResult = await utils.spawnCoanaDlx(coanaArgs, orgSlug, {
@@ -1841,7 +1882,7 @@ async function performReachabilityAnalysis(options) {
1841
1882
  cwd,
1842
1883
  env: coanaEnv,
1843
1884
  spinner,
1844
- stdio: 'inherit'
1885
+ stdio: coanaStdio
1845
1886
  });
1846
1887
  if (wasSpinning) {
1847
1888
  spinner.start();
@@ -5091,6 +5132,7 @@ async function handleCreateNewScan({
5091
5132
  branchName,
5092
5133
  cwd,
5093
5134
  orgSlug,
5135
+ outputKind,
5094
5136
  packagePaths,
5095
5137
  reachabilityOptions: mergedReachabilityOptions,
5096
5138
  repoName,
@@ -5247,8 +5289,8 @@ async function handleCi(autoManifest) {
5247
5289
  pullRequest: 0,
5248
5290
  reach: {
5249
5291
  excludePaths: [],
5250
- reachAnalysisMemoryLimit: 0,
5251
- reachAnalysisTimeout: 0,
5292
+ reachAnalysisMemoryLimit: '',
5293
+ reachAnalysisTimeout: '',
5252
5294
  reachConcurrency: 1,
5253
5295
  reachContinueOnAnalysisErrors: false,
5254
5296
  reachContinueOnInstallErrors: false,
@@ -15605,14 +15647,14 @@ const reachabilityFlags = {
15605
15647
  description: `Override the version of @coana-tech/cli used for reachability analysis. Default: ${constants.default.ENV.INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION}.`
15606
15648
  },
15607
15649
  reachAnalysisMemoryLimit: {
15608
- type: 'number',
15609
- default: 8192,
15610
- description: 'The maximum memory in MB to use for the reachability analysis. The default is 8192MB.'
15650
+ type: 'string',
15651
+ default: '8192',
15652
+ description: 'The maximum memory for the reachability analysis as a whole number optionally followed by MB or GB (e.g. 512MB, 8GB). The default is 8GB.'
15611
15653
  },
15612
15654
  reachAnalysisTimeout: {
15613
- type: 'number',
15614
- default: 0,
15615
- description: 'Set timeout for the reachability analysis. Split analysis runs may cause the total scan time to exceed this timeout significantly.'
15655
+ type: 'string',
15656
+ default: '',
15657
+ description: 'Set the timeout for the reachability analysis as a whole number optionally followed by s, m or h (e.g. 90s, 10m, 1h). Defaults to 10m. Split analysis runs may cause the total scan time to exceed this timeout significantly.'
15616
15658
  },
15617
15659
  reachConcurrency: {
15618
15660
  type: 'number',
@@ -16110,8 +16152,14 @@ async function run$d(argv, importMeta, {
16110
16152
  // Validation helpers for better readability.
16111
16153
  const hasReachEcosystems = reachEcosystems.length > 0;
16112
16154
  const hasReachExcludePaths = reachExcludePaths.length > 0;
16113
- const isUsingNonDefaultMemoryLimit = reachAnalysisMemoryLimit !== reachabilityFlags['reachAnalysisMemoryLimit']?.default;
16114
- const isUsingNonDefaultTimeout = reachAnalysisTimeout !== reachabilityFlags['reachAnalysisTimeout']?.default;
16155
+
16156
+ // Compare by resolved magnitude, not string identity: 8192, 8192MB and 8GB
16157
+ // all mean the default, and an omitted/zero timeout means "use the default".
16158
+ // A naive string compare would flag those equivalents as non-default and
16159
+ // wrongly require --reach.
16160
+ const memoryLimitMb = reachMemoryLimitToMb(reachAnalysisMemoryLimit);
16161
+ const isUsingNonDefaultMemoryLimit = memoryLimitMb !== null && memoryLimitMb !== reachMemoryLimitToMb(String(reachabilityFlags['reachAnalysisMemoryLimit']?.default ?? ''));
16162
+ const isUsingNonDefaultTimeout = !isOmittedReachValue(reachAnalysisTimeout);
16115
16163
  const isUsingNonDefaultConcurrency = reachConcurrency !== reachabilityFlags['reachConcurrency']?.default;
16116
16164
  const isUsingNonDefaultAnalytics = reachDisableAnalytics !== reachabilityFlags['reachDisableAnalytics']?.default;
16117
16165
  const isUsingNonDefaultVersion = reachVersion !== reachabilityFlags['reachVersion']?.default;
@@ -16208,8 +16256,8 @@ async function run$d(argv, importMeta, {
16208
16256
  autoManifest: Boolean(autoManifest)
16209
16257
  }) : undefined,
16210
16258
  excludePaths,
16211
- reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
16212
- reachAnalysisTimeout: Number(reachAnalysisTimeout),
16259
+ reachAnalysisMemoryLimit,
16260
+ reachAnalysisTimeout,
16213
16261
  reachConcurrency: Number(reachConcurrency),
16214
16262
  reachContinueOnAnalysisErrors: Boolean(reachContinueOnAnalysisErrors),
16215
16263
  reachContinueOnInstallErrors: Boolean(reachContinueOnInstallErrors),
@@ -16867,8 +16915,8 @@ async function scanOneRepo(repoSlug, {
16867
16915
  pullRequest: 0,
16868
16916
  reach: {
16869
16917
  excludePaths: [],
16870
- reachAnalysisMemoryLimit: 0,
16871
- reachAnalysisTimeout: 0,
16918
+ reachAnalysisMemoryLimit: '',
16919
+ reachAnalysisTimeout: '',
16872
16920
  reachConcurrency: 1,
16873
16921
  reachContinueOnAnalysisErrors: false,
16874
16922
  reachContinueOnInstallErrors: false,
@@ -18100,6 +18148,7 @@ async function handleScanReach({
18100
18148
  const result = await performReachabilityAnalysis({
18101
18149
  cwd,
18102
18150
  orgSlug,
18151
+ outputKind,
18103
18152
  outputPath,
18104
18153
  packagePaths,
18105
18154
  reachabilityOptions: mergedReachabilityOptions,
@@ -18323,8 +18372,8 @@ async function run$7(argv, importMeta, {
18323
18372
  outputPath: outputPath || '',
18324
18373
  reachabilityOptions: {
18325
18374
  excludePaths,
18326
- reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
18327
- reachAnalysisTimeout: Number(reachAnalysisTimeout),
18375
+ reachAnalysisMemoryLimit,
18376
+ reachAnalysisTimeout,
18328
18377
  reachConcurrency: Number(reachConcurrency),
18329
18378
  reachContinueOnAnalysisErrors: Boolean(reachContinueOnAnalysisErrors),
18330
18379
  reachContinueOnInstallErrors: Boolean(reachContinueOnInstallErrors),
@@ -20266,5 +20315,5 @@ process.on('unhandledRejection', async (reason, promise) => {
20266
20315
  // eslint-disable-next-line n/no-process-exit
20267
20316
  process.exit(1);
20268
20317
  });
20269
- //# debugId=85257911-3f47-4452-8e33-51ee5c9c6b59
20318
+ //# debugId=cab2a634-ac20-4b27-aff5-55f1c4df59bc
20270
20319
  //# sourceMappingURL=cli.js.map