@socketsecurity/cli-with-sentry 1.1.132 → 1.1.133

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,12 @@ 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.133](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.133) - 2026-07-01
8
+
9
+ ### Changed
10
+ - Quieter `socket manifest gradle`, `sbt`, and `maven`: the build tool's output is now hidden behind a progress spinner and shown only if the build fails. Pass `--verbose` to stream it live.
11
+ - `--auto-manifest` now fails fast: if a Gradle, sbt, or Maven build fails, the run stops instead of continuing with an incomplete SBOM.
12
+
7
13
  ## [1.1.132](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.132) - 2026-06-30
8
14
 
9
15
  ### Changed
package/dist/cli.js CHANGED
@@ -5173,11 +5173,19 @@ async function runNeverThrow(bin, args, opts) {
5173
5173
  stderr: typeof result.stderr === 'string' ? result.stderr : ''
5174
5174
  };
5175
5175
  } catch (e) {
5176
- if (spawn.isSpawnError(e)) {
5176
+ // A build tool that exits non-zero rejects with the spawn-result shape: a
5177
+ // numeric exit `code` plus captured stdout/stderr. Return it so the caller
5178
+ // can assemble failure records / surface the output. Anything else — e.g. a
5179
+ // missing executable, whose `code` is a string like 'ENOENT' — propagates.
5180
+ // This mirrors how utils/dlx.mts classifies spawn failures (a numeric `code`
5181
+ // is a real process exit); the registry's isSpawnError is avoided here
5182
+ // because it is currently broken and never matches.
5183
+ if (e !== null && typeof e === 'object' && typeof e.code === 'number') {
5184
+ const err = e;
5177
5185
  return {
5178
- code: e.code,
5179
- stdout: typeof e.stdout === 'string' ? e.stdout : '',
5180
- stderr: typeof e.stderr === 'string' ? e.stderr : ''
5186
+ code: err.code,
5187
+ stdout: typeof err.stdout === 'string' ? err.stdout : '',
5188
+ stderr: typeof err.stderr === 'string' ? err.stderr : ''
5181
5189
  };
5182
5190
  }
5183
5191
  throw e;
@@ -5202,7 +5210,7 @@ async function writeSbtPlugin(globalBase) {
5202
5210
  });
5203
5211
  await fs$1.promises.writeFile(path.join(pluginsDir, SBT_PLUGIN_FILENAME), src);
5204
5212
  }
5205
- async function assembleFromRecords(code, recordsFile) {
5213
+ async function assembleFromRecords(out, recordsFile) {
5206
5214
  const text = fs$1.existsSync(recordsFile) ? await fs$1.promises.readFile(recordsFile, 'utf8') : '';
5207
5215
  const {
5208
5216
  artifactPaths,
@@ -5210,10 +5218,12 @@ async function assembleFromRecords(code, recordsFile) {
5210
5218
  report
5211
5219
  } = assembleFacts(parseRecords(text));
5212
5220
  return {
5213
- code,
5221
+ code: out.code,
5214
5222
  facts,
5215
5223
  report,
5216
- artifactPaths
5224
+ artifactPaths,
5225
+ stderr: out.stderr,
5226
+ stdout: out.stdout
5217
5227
  };
5218
5228
  }
5219
5229
 
@@ -5263,7 +5273,7 @@ async function runGradle(opts) {
5263
5273
  // resolvedConfiguration API and shared accumulator aren't cache-safe.
5264
5274
  const args = ['--init-script', initScript, '-Dorg.gradle.configuration-cache=false', `-Psocket.recordsFile=${recordsFile}`, ...commonProps(opts, '-P'), ...(opts.toolOpts ?? []), FACTS_TASK, '--no-daemon', '--console=plain'];
5265
5275
  const out = await runNeverThrow(bin, args, opts);
5266
- return await assembleFromRecords(out.code, recordsFile);
5276
+ return await assembleFromRecords(out, recordsFile);
5267
5277
  });
5268
5278
  }
5269
5279
  async function runSbt(opts) {
@@ -5280,7 +5290,7 @@ async function runSbt(opts) {
5280
5290
  const javaHomeOpt = javaHome && !(opts.toolOpts ?? []).includes('--java-home') ? ['--java-home', javaHome] : [];
5281
5291
  const args = [...javaHomeOpt, ...props, ...(opts.toolOpts ?? []), '--batch', FACTS_TASK];
5282
5292
  const out = await runNeverThrow(bin, args, opts);
5283
- return await assembleFromRecords(out.code, recordsFile);
5293
+ return await assembleFromRecords(out, recordsFile);
5284
5294
  });
5285
5295
  }
5286
5296
  async function runMaven(opts) {
@@ -5294,7 +5304,7 @@ async function runMaven(opts) {
5294
5304
  const props = [`-Dmaven.ext.class.path=${jarPath}`, '-Dcoana.task=socket-facts', `-Dsocket.recordsFile=${recordsFile}`, ...commonProps(opts, '-D')];
5295
5305
  const args = [...props, ...(opts.toolOpts ?? []), '--batch-mode', 'validate'];
5296
5306
  const out = await runNeverThrow(bin, args, opts);
5297
- return await assembleFromRecords(out.code, recordsFile);
5307
+ return await assembleFromRecords(out, recordsFile);
5298
5308
  });
5299
5309
  }
5300
5310
 
@@ -5363,11 +5373,19 @@ function serializeSidecar(acc) {
5363
5373
  return resolved;
5364
5374
  }
5365
5375
 
5376
+ // Last N non-empty lines of the captured build output, for diagnosing a crash
5377
+ // without forcing a --verbose rebuild.
5378
+ function tailBuildOutput(stdout, stderr) {
5379
+ const combined = [stdout, stderr].map(s => s.trimEnd()).filter(Boolean).join('\n');
5380
+ return combined.split('\n').slice(-40).join('\n');
5381
+ }
5382
+
5366
5383
  // Runs the bundled build-tool resolution script for a JVM project and writes
5367
5384
  // `.socket.facts.json`. `withFiles` (reachability only) additionally folds
5368
- // resolved artifact paths into `sidecarAcc`. A blocking resolution failure — or
5369
- // a build that crashes without emitting any facts throws unless
5370
- // `ignoreUnresolved`.
5385
+ // resolved artifact paths into `sidecarAcc`. A blocking resolution failure sets
5386
+ // a non-zero exit code and returns (matching the `--pom` generator) unless
5387
+ // `ignoreUnresolved`; a crashed build — a process failure, not an unresolved
5388
+ // dependency — always fails.
5371
5389
  async function runManifestFacts({
5372
5390
  bin,
5373
5391
  buildOpts,
@@ -5382,19 +5400,53 @@ async function runManifestFacts({
5382
5400
  }) {
5383
5401
  const factsPath = path.join(cwd, constants.default.DOT_SOCKET_DOT_FACTS_JSON);
5384
5402
  logger.logger.log(`Generating Socket facts for the ${ecosystem} project at \`${cwd}\` ...`);
5385
- const {
5386
- artifactPaths,
5387
- code,
5388
- facts,
5389
- report
5390
- } = await runManifestScript(ecosystem, {
5403
+ const scriptOpts = {
5391
5404
  bin: bin || undefined,
5392
5405
  excludeConfigs: excludeConfigs || undefined,
5393
5406
  includeConfigs: includeConfigs || undefined,
5394
5407
  projectDir: cwd,
5408
+ // Stream the build tool's output only when asked; otherwise capture it and
5409
+ // show a spinner, surfacing the output only if the build crashes.
5410
+ stdio: verbose ? 'inherit' : 'pipe',
5395
5411
  toolOpts: buildOpts,
5396
5412
  withFiles
5397
- });
5413
+ };
5414
+ const {
5415
+ spinner
5416
+ } = constants.default;
5417
+ let result;
5418
+ try {
5419
+ if (verbose) {
5420
+ logger.logger.info(`(Running ${ecosystem} with output streaming; this can take a while.)`);
5421
+ result = await runManifestScript(ecosystem, scriptOpts);
5422
+ } else {
5423
+ logger.logger.info(`(No live output; pass --verbose to stream the ${ecosystem} build output.)`);
5424
+ spinner.start(`Resolving ${ecosystem} dependencies ...`);
5425
+ result = await runManifestScript(ecosystem, scriptOpts);
5426
+ if (result.code === 0) {
5427
+ spinner.successAndStop(`Resolved ${ecosystem} dependencies.`);
5428
+ } else {
5429
+ spinner.failAndStop(`${ecosystem} build exited with code ${result.code}.`);
5430
+ }
5431
+ }
5432
+ } catch (e) {
5433
+ // Only a spawn-level failure (e.g. the build tool missing from PATH) reaches
5434
+ // here; runNeverThrow returns non-zero build exits rather than throwing.
5435
+ if (!verbose) {
5436
+ spinner.failAndStop(`Failed to run ${ecosystem}.`);
5437
+ }
5438
+ process.exitCode = 1;
5439
+ logger.logger.fail(`Could not run the ${ecosystem} build tool` + (verbose ? `: ${e}` : ' (run with --verbose for details).'));
5440
+ return;
5441
+ }
5442
+ const {
5443
+ artifactPaths,
5444
+ code,
5445
+ facts,
5446
+ report,
5447
+ stderr,
5448
+ stdout
5449
+ } = result;
5398
5450
  const rendered = renderResolutionErrorReport(report.failures, report.scannedConfigs, ecosystem, {
5399
5451
  ignoreUnresolved
5400
5452
  });
@@ -5402,10 +5454,12 @@ async function runManifestFacts({
5402
5454
  if (ignoreUnresolved) {
5403
5455
  logger.logger.warn(rendered.summary);
5404
5456
  } else {
5457
+ process.exitCode = 1;
5458
+ logger.logger.fail(rendered.summary);
5405
5459
  if (verbose && rendered.details) {
5406
5460
  logger.logger.log(rendered.details);
5407
5461
  }
5408
- throw new utils.InputError(rendered.summary);
5462
+ return;
5409
5463
  }
5410
5464
  }
5411
5465
  if (rendered.nonBlockingNotice) {
@@ -5422,11 +5476,20 @@ async function runManifestFacts({
5422
5476
  // fail closed rather than silently dropping the ecosystem with an empty SBOM
5423
5477
  // (the empty-facts branch below would otherwise just log "nothing to upload").
5424
5478
  if (code !== 0 && !facts.components.length && !facts.projects?.length && !report.failures.length) {
5425
- const message = `The ${ecosystem} build failed (exit code ${code}) before producing any Socket facts. Re-run with --verbose for the build tool's output.`;
5426
- if (!ignoreUnresolved) {
5427
- throw new utils.InputError(message);
5479
+ if (!verbose) {
5480
+ const tail = tailBuildOutput(stdout, stderr);
5481
+ if (tail) {
5482
+ logger.logger.group('Build output:');
5483
+ logger.logger.error(tail);
5484
+ logger.logger.groupEnd();
5485
+ }
5428
5486
  }
5429
- logger.logger.warn(message);
5487
+ // A crashed build is a process failure (missing JDK/build tool, unparseable
5488
+ // project, OOM, plugin error), not an unresolved dependency, so it fails
5489
+ // regardless of `ignoreUnresolved` — that flag only tolerates dependencies a
5490
+ // successful run couldn't resolve.
5491
+ process.exitCode = 1;
5492
+ logger.logger.fail(`The ${ecosystem} build failed (exit code ${code}) before producing any Socket facts.`);
5430
5493
  return;
5431
5494
  }
5432
5495
 
@@ -6022,12 +6085,22 @@ function parseBuildToolOpts(opts) {
6022
6085
  return tokens;
6023
6086
  }
6024
6087
 
6088
+ // Under --auto-manifest, a manifest generator that failed — raising the exit
6089
+ // code above the value captured before it ran — aborts the whole run: a partial
6090
+ // or empty SBOM silently under-reports dependencies. The generator has already
6091
+ // logged the specifics. A tolerated resolution failure (ignoreUnresolved) warns
6092
+ // without touching the exit code, so it passes through here and the run
6093
+ // continues.
6094
+ function abortManifestRunIfFailed(ecosystem, beforeExitCode) {
6095
+ if (process.exitCode && process.exitCode !== beforeExitCode) {
6096
+ throw new utils.InputError(`Auto-manifest generation failed for the ${ecosystem} project; aborting (see the errors above).`);
6097
+ }
6098
+ }
6025
6099
  async function generateAutoManifest({
6026
6100
  computeArtifactsSidecar,
6027
6101
  cwd,
6028
6102
  detected,
6029
6103
  outputKind,
6030
- reachContinueOnInstallErrors,
6031
6104
  verbose
6032
6105
  }) {
6033
6106
  const sockJson = utils.readOrDefaultSocketJson(cwd);
@@ -6035,8 +6108,6 @@ async function generateAutoManifest({
6035
6108
 
6036
6109
  // Resolved paths across all JVM roots, serialized to one sidecar at the end.
6037
6110
  const sidecarAcc = computeArtifactsSidecar ? new Map() : undefined;
6038
- // Reachability: the install-error gate decides abort; manifest path: socket.json.
6039
- const resolveIgnoreUnresolved = configured => computeArtifactsSidecar ? configured || Boolean(reachContinueOnInstallErrors) : configured;
6040
6111
  if (verbose) {
6041
6112
  logger.logger.info(`Using this ${constants.SOCKET_JSON} for defaults:`, sockJson);
6042
6113
  }
@@ -6055,20 +6126,24 @@ async function generateAutoManifest({
6055
6126
  // `defaults.manifest.sbt.facts: false` in socket.json.
6056
6127
  if (sockJson.defaults?.manifest?.sbt?.facts !== false) {
6057
6128
  logger.logger.log('Detected a Scala sbt build, generating Socket facts...');
6129
+ const beforeExitCode = process.exitCode;
6058
6130
  await convertSbtToFacts({
6059
6131
  ...sbtArgs,
6060
6132
  excludeConfigs: sockJson.defaults?.manifest?.sbt?.excludeConfigs ?? '',
6061
- ignoreUnresolved: resolveIgnoreUnresolved(Boolean(sockJson.defaults?.manifest?.sbt?.ignoreUnresolved)),
6133
+ ignoreUnresolved: Boolean(sockJson.defaults?.manifest?.sbt?.ignoreUnresolved),
6062
6134
  includeConfigs: sockJson.defaults?.manifest?.sbt?.includeConfigs ?? '',
6063
6135
  sidecarAcc,
6064
6136
  withFiles: computeArtifactsSidecar
6065
6137
  });
6138
+ abortManifestRunIfFailed('sbt', beforeExitCode);
6066
6139
  } else {
6067
6140
  logger.logger.log('Detected a Scala sbt build, generating pom files with sbt...');
6141
+ const beforeExitCode = process.exitCode;
6068
6142
  await convertSbtToMaven({
6069
6143
  ...sbtArgs,
6070
6144
  out: sockJson.defaults?.manifest?.sbt?.outfile ?? './pom.xml'
6071
6145
  });
6146
+ abortManifestRunIfFailed('sbt', beforeExitCode);
6072
6147
  }
6073
6148
  }
6074
6149
  if (!sockJson?.defaults?.manifest?.gradle?.disabled && detected.gradle) {
@@ -6083,33 +6158,39 @@ async function generateAutoManifest({
6083
6158
  // `defaults.manifest.gradle.facts: false` in socket.json.
6084
6159
  if (sockJson.defaults?.manifest?.gradle?.facts !== false) {
6085
6160
  logger.logger.log('Detected a gradle build (Gradle, Kotlin, Scala), generating Socket facts...');
6161
+ const beforeExitCode = process.exitCode;
6086
6162
  await convertGradleToFacts({
6087
6163
  ...gradleArgs,
6088
6164
  excludeConfigs: sockJson.defaults?.manifest?.gradle?.excludeConfigs ?? '',
6089
- ignoreUnresolved: resolveIgnoreUnresolved(Boolean(sockJson.defaults?.manifest?.gradle?.ignoreUnresolved)),
6165
+ ignoreUnresolved: Boolean(sockJson.defaults?.manifest?.gradle?.ignoreUnresolved),
6090
6166
  includeConfigs: sockJson.defaults?.manifest?.gradle?.includeConfigs ?? '',
6091
6167
  sidecarAcc,
6092
6168
  withFiles: computeArtifactsSidecar
6093
6169
  });
6170
+ abortManifestRunIfFailed('gradle', beforeExitCode);
6094
6171
  } else {
6095
6172
  logger.logger.log('Detected a gradle build (Gradle, Kotlin, Scala), running default gradle generator...');
6173
+ const beforeExitCode = process.exitCode;
6096
6174
  await convertGradleToMaven(gradleArgs);
6175
+ abortManifestRunIfFailed('gradle', beforeExitCode);
6097
6176
  }
6098
6177
  }
6099
6178
  if (!sockJson?.defaults?.manifest?.maven?.disabled && detected.maven) {
6100
6179
  logger.logger.log('Detected a Maven pom.xml build, generating Socket facts...');
6180
+ const beforeExitCode = process.exitCode;
6101
6181
  await convertMavenToFacts({
6102
6182
  // Configured bin wins; else prefer ./mvnw, else mvn on PATH.
6103
6183
  bin: sockJson.defaults?.manifest?.maven?.bin ?? resolveBuildToolBin('maven', cwd),
6104
6184
  cwd,
6105
6185
  excludeConfigs: sockJson.defaults?.manifest?.maven?.excludeConfigs ?? '',
6106
- ignoreUnresolved: resolveIgnoreUnresolved(Boolean(sockJson.defaults?.manifest?.maven?.ignoreUnresolved)),
6186
+ ignoreUnresolved: Boolean(sockJson.defaults?.manifest?.maven?.ignoreUnresolved),
6107
6187
  includeConfigs: sockJson.defaults?.manifest?.maven?.includeConfigs ?? '',
6108
6188
  mavenOpts: parseBuildToolOpts(sockJson.defaults?.manifest?.maven?.mavenOpts),
6109
6189
  sidecarAcc,
6110
6190
  verbose: Boolean(sockJson.defaults?.manifest?.maven?.verbose),
6111
6191
  withFiles: computeArtifactsSidecar
6112
6192
  });
6193
+ abortManifestRunIfFailed('maven', beforeExitCode);
6113
6194
  }
6114
6195
  if (!sockJson?.defaults?.manifest?.conda?.disabled && detected.conda) {
6115
6196
  logger.logger.log('Detected an environment.yml file, running default Conda generator...');
@@ -6238,7 +6319,6 @@ async function handleCreateNewScan({
6238
6319
  cwd,
6239
6320
  detected,
6240
6321
  outputKind,
6241
- reachContinueOnInstallErrors: reach.reachContinueOnInstallErrors,
6242
6322
  verbose: false
6243
6323
  });
6244
6324
  resolvedPathsSidecar = autoManifestResult.resolvedPathsSidecar;
@@ -21750,5 +21830,5 @@ process.on('unhandledRejection', async (reason, promise) => {
21750
21830
  // eslint-disable-next-line n/no-process-exit
21751
21831
  process.exit(1);
21752
21832
  });
21753
- //# debugId=bf57bd7a-dcc7-46d5-8b2d-9709236ff012
21833
+ //# debugId=124ab184-9379-4139-921b-7d32dd1456f3
21754
21834
  //# sourceMappingURL=cli.js.map