socket 1.1.123 → 1.1.126

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +8 -0
  3. package/bin/cli.js +33 -1
  4. package/dist/cli.js +476 -124
  5. package/dist/cli.js.map +1 -1
  6. package/dist/constants.js +4 -4
  7. package/dist/constants.js.map +1 -1
  8. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  9. package/dist/types/commands/ci/handle-ci.d.mts.map +1 -1
  10. package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +1 -1
  11. package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +1 -1
  12. package/dist/types/commands/manifest/cmd-manifest-maven.d.mts +9 -0
  13. package/dist/types/commands/manifest/cmd-manifest-maven.d.mts.map +1 -0
  14. package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +1 -1
  15. package/dist/types/commands/manifest/cmd-manifest.d.mts.map +1 -1
  16. package/dist/types/commands/manifest/coana-manifest-facts.d.mts +6 -6
  17. package/dist/types/commands/manifest/coana-manifest-facts.d.mts.map +1 -1
  18. package/dist/types/commands/manifest/convert-maven-to-facts.d.mts +15 -0
  19. package/dist/types/commands/manifest/convert-maven-to-facts.d.mts.map +1 -0
  20. package/dist/types/commands/manifest/detect-manifest-actions.d.mts +1 -0
  21. package/dist/types/commands/manifest/detect-manifest-actions.d.mts.map +1 -1
  22. package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +1 -1
  23. package/dist/types/commands/manifest/parse-build-tool-opts.d.mts +9 -0
  24. package/dist/types/commands/manifest/parse-build-tool-opts.d.mts.map +1 -0
  25. package/dist/types/commands/manifest/setup-manifest-config.d.mts.map +1 -1
  26. package/dist/types/commands/scan/cmd-scan-create.d.mts.map +1 -1
  27. package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +1 -1
  28. package/dist/types/commands/scan/finalize-tier1-scan.d.mts +5 -3
  29. package/dist/types/commands/scan/finalize-tier1-scan.d.mts.map +1 -1
  30. package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
  31. package/dist/types/commands/scan/perform-reachability-analysis.d.mts +1 -0
  32. package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +1 -1
  33. package/dist/types/commands/scan/reachability-flags.d.mts.map +1 -1
  34. package/dist/types/utils/socket-json.d.mts +9 -0
  35. package/dist/types/utils/socket-json.d.mts.map +1 -1
  36. package/dist/utils.js +2 -2
  37. package/dist/utils.js.map +1 -1
  38. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -333,9 +333,9 @@ const hidden$x = false;
333
333
  const cmdAnalytics = {
334
334
  description: description$F,
335
335
  hidden: hidden$x,
336
- run: run$T
336
+ run: run$U
337
337
  };
338
- async function run$T(argv, importMeta, {
338
+ async function run$U(argv, importMeta, {
339
339
  parentName
340
340
  }) {
341
341
  const config = {
@@ -756,9 +756,9 @@ const hidden$w = false;
756
756
  const cmdAuditLog = {
757
757
  description: description$E,
758
758
  hidden: hidden$w,
759
- run: run$S
759
+ run: run$T
760
760
  };
761
- async function run$S(argv, importMeta, {
761
+ async function run$T(argv, importMeta, {
762
762
  parentName
763
763
  }) {
764
764
  const config = {
@@ -1110,11 +1110,13 @@ async function fetchSupportedScanFileNames(options) {
1110
1110
  }
1111
1111
 
1112
1112
  /**
1113
- * Finalize a tier1 reachability scan.
1114
- * - Associates the tier1 reachability scan metadata with the full scan
1113
+ * Finalize a full application reachability scan (formerly known as "tier 1";
1114
+ * the wire endpoint and request fields below retain the legacy tier1 name as
1115
+ * a backend contract).
1116
+ * - Associates the reachability scan metadata with the full scan
1115
1117
  * (or with `null` when called from a standalone reachability flow that
1116
1118
  * has no full scan to bind to).
1117
- * - Transitions the tier1 reachability scan to its DONE terminal state.
1119
+ * - Transitions the reachability scan to its DONE terminal state.
1118
1120
  */
1119
1121
  async function finalizeTier1Scan(tier1ReachabilityScanId, scanId) {
1120
1122
  // we do not use the SDK here because the tier1-reachability-scan/finalize is a hidden
@@ -1787,7 +1789,7 @@ async function performReachabilityAnalysis(options) {
1787
1789
  if (!utils.hasEnterpriseOrgPlan(organizations)) {
1788
1790
  return {
1789
1791
  ok: false,
1790
- message: 'Tier 1 Reachability analysis requires an enterprise plan',
1792
+ message: 'Full application reachability analysis requires an enterprise plan',
1791
1793
  cause: `Please ${utils.socketDevLink('upgrade your plan', '/pricing')}. This feature is only available for organizations with an enterprise plan.`
1792
1794
  };
1793
1795
  }
@@ -1900,7 +1902,7 @@ async function performReachabilityAnalysis(options) {
1900
1902
  // with `cwd` above), so resolve the read path against `cwd` too. Reading
1901
1903
  // the bare relative path would resolve against `process.cwd()` and miss
1902
1904
  // the file whenever `cwd !== process.cwd()` (e.g. `--cwd <dir>`), silently
1903
- // dropping the tier 1 scan id and skipping finalize downstream.
1905
+ // dropping the full application reachability scan id and skipping finalize downstream.
1904
1906
  const resolvedReportPath = path.resolve(cwd, outputFilePath);
1905
1907
  return {
1906
1908
  ok: true,
@@ -1938,6 +1940,7 @@ sockJson, cwd = process.cwd()) {
1938
1940
  count: 0,
1939
1941
  conda: false,
1940
1942
  gradle: false,
1943
+ maven: false,
1941
1944
  sbt: false
1942
1945
  };
1943
1946
  if (sockJson?.defaults?.manifest?.bazel?.disabled) {
@@ -1961,6 +1964,13 @@ sockJson, cwd = process.cwd()) {
1961
1964
  output.gradle = true;
1962
1965
  output.count += 1;
1963
1966
  }
1967
+ if (sockJson?.defaults?.manifest?.maven?.disabled) {
1968
+ require$$9.debugLog('notice', `[DEBUG] - maven auto-detection is disabled in ${constants.SOCKET_JSON}`);
1969
+ } else if (fs$1.existsSync(path.join(cwd, 'pom.xml'))) {
1970
+ require$$9.debugLog('notice', '[DEBUG] - Detected a Maven pom.xml build file');
1971
+ output.maven = true;
1972
+ output.count += 1;
1973
+ }
1964
1974
  if (sockJson?.defaults?.manifest?.conda?.disabled) {
1965
1975
  require$$9.debugLog('notice', `[DEBUG] - conda auto-detection is disabled in ${constants.SOCKET_JSON}`);
1966
1976
  } else {
@@ -4283,10 +4293,10 @@ async function extractBazelToMaven(opts) {
4283
4293
  // facts file.
4284
4294
  //
4285
4295
  // `spawnCoanaDlx` resolves the Coana CLI via dlx (or a local build when
4286
- // `SOCKET_CLI_COANA_LOCAL_PATH` is set). `bin` (the gradle/sbt executable) is
4287
- // always resolved by the caller to a concrete default (`<cwd>/gradlew`, or
4288
- // `sbt` on PATH) before we get here, so it is forwarded verbatim; the empty
4289
- // guard below is just a cheap safeguard against passing `--bin ''`.
4296
+ // `SOCKET_CLI_COANA_LOCAL_PATH` is set). `bin` (the gradle/maven/sbt executable)
4297
+ // is always resolved by the caller to a concrete default (`<cwd>/gradlew`, or
4298
+ // `mvn`/`sbt` on PATH) before we get here, so it is forwarded verbatim; the
4299
+ // empty guard below is just a cheap safeguard against passing `--bin ''`.
4290
4300
  async function runCoanaManifestFacts({
4291
4301
  bin,
4292
4302
  buildOpts,
@@ -4390,6 +4400,33 @@ async function convertGradleToFacts({
4390
4400
  });
4391
4401
  }
4392
4402
 
4403
+ // Generates a `.socket.facts.json` for a Maven project by delegating to the
4404
+ // Coana CLI's `manifest maven` command (which owns the Maven plugin that
4405
+ // resolves the dependency graph). socket-cli no longer runs maven itself; an
4406
+ // explicit `bin` is forwarded as `--bin`, otherwise Coana defaults to `mvn` on
4407
+ // PATH.
4408
+ async function convertMavenToFacts({
4409
+ bin,
4410
+ cwd,
4411
+ excludeConfigs,
4412
+ ignoreUnresolved,
4413
+ includeConfigs,
4414
+ mavenOpts,
4415
+ verbose
4416
+ }) {
4417
+ await runCoanaManifestFacts({
4418
+ bin,
4419
+ buildOpts: mavenOpts,
4420
+ buildOptsFlag: '--maven-opts',
4421
+ cwd,
4422
+ ecosystem: 'maven',
4423
+ excludeConfigs,
4424
+ ignoreUnresolved,
4425
+ includeConfigs,
4426
+ verbose
4427
+ });
4428
+ }
4429
+
4393
4430
  // Generates a `.socket.facts.json` for an sbt project by delegating to the
4394
4431
  // Coana CLI's `manifest sbt` command (which owns the sbt plugin that resolves
4395
4432
  // the dependency graph). socket-cli no longer runs sbt itself; an explicit
@@ -4864,6 +4901,59 @@ async function handleManifestConda({
4864
4901
  await outputRequirements(data, outputKind, out);
4865
4902
  }
4866
4903
 
4904
+ // Tokenizes a build-tool options string (e.g. the value of `--gradle-opts`,
4905
+ // `--sbt-opts`, `--maven-opts`) into individual argv tokens. Splits on
4906
+ // whitespace but honors single and double quotes so a value containing spaces,
4907
+ // such as a settings path (`-s "my settings.xml"`), survives as one token
4908
+ // instead of being shredded into three. Quotes are consumed (not emitted), and
4909
+ // quoting is intra-token aware (`-Dkey="a b"` -> `-Dkey=a b`). For unquoted
4910
+ // input this is equivalent to the previous whitespace split.
4911
+ function parseBuildToolOpts(opts) {
4912
+ if (!opts) {
4913
+ return [];
4914
+ }
4915
+ const tokens = [];
4916
+ let current = '';
4917
+ let hasToken = false;
4918
+ let inSingle = false;
4919
+ let inDouble = false;
4920
+ for (let i = 0; i < opts.length; i += 1) {
4921
+ const ch = opts[i];
4922
+ if (inSingle) {
4923
+ if (ch === "'") {
4924
+ inSingle = false;
4925
+ } else {
4926
+ current += ch;
4927
+ }
4928
+ } else if (inDouble) {
4929
+ if (ch === '"') {
4930
+ inDouble = false;
4931
+ } else {
4932
+ current += ch;
4933
+ }
4934
+ } else if (ch === "'") {
4935
+ inSingle = true;
4936
+ hasToken = true;
4937
+ } else if (ch === '"') {
4938
+ inDouble = true;
4939
+ hasToken = true;
4940
+ } else if (ch === ' ' || ch === '\t') {
4941
+ if (hasToken) {
4942
+ tokens.push(current);
4943
+ current = '';
4944
+ hasToken = false;
4945
+ }
4946
+ } else {
4947
+ current += ch;
4948
+ hasToken = true;
4949
+ }
4950
+ }
4951
+ if (hasToken) {
4952
+ tokens.push(current);
4953
+ }
4954
+ return tokens;
4955
+ }
4956
+
4867
4957
  async function generateAutoManifest({
4868
4958
  cwd,
4869
4959
  detected,
@@ -4883,7 +4973,7 @@ async function generateAutoManifest({
4883
4973
  // Note: `sbt` is more likely to be resolved against PATH env.
4884
4974
  bin: sockJson.defaults?.manifest?.sbt?.bin ?? 'sbt',
4885
4975
  cwd,
4886
- sbtOpts: sockJson.defaults?.manifest?.sbt?.sbtOpts?.split(' ').map(s => s.trim()).filter(Boolean) ?? [],
4976
+ sbtOpts: parseBuildToolOpts(sockJson.defaults?.manifest?.sbt?.sbtOpts),
4887
4977
  verbose: Boolean(sockJson.defaults?.manifest?.sbt?.verbose)
4888
4978
  };
4889
4979
  // Socket facts is the default; opt into pom generation with
@@ -4912,7 +5002,7 @@ async function generateAutoManifest({
4912
5002
  bin: sockJson.defaults?.manifest?.gradle?.bin ? path.resolve(cwd, sockJson.defaults.manifest.gradle.bin) : path.join(cwd, 'gradlew'),
4913
5003
  cwd,
4914
5004
  verbose: Boolean(sockJson.defaults?.manifest?.gradle?.verbose),
4915
- gradleOpts: sockJson.defaults?.manifest?.gradle?.gradleOpts?.split(' ').map(s => s.trim()).filter(Boolean) ?? []
5005
+ gradleOpts: parseBuildToolOpts(sockJson.defaults?.manifest?.gradle?.gradleOpts)
4916
5006
  };
4917
5007
  // Socket facts is the default; opt into pom generation with
4918
5008
  // `defaults.manifest.gradle.facts: false` in socket.json.
@@ -4929,6 +5019,19 @@ async function generateAutoManifest({
4929
5019
  await convertGradleToMaven(gradleArgs);
4930
5020
  }
4931
5021
  }
5022
+ if (!sockJson?.defaults?.manifest?.maven?.disabled && detected.maven) {
5023
+ logger.logger.log('Detected a Maven pom.xml build, generating Socket facts...');
5024
+ await convertMavenToFacts({
5025
+ // Note: `mvn` is more likely to be resolved against PATH env.
5026
+ bin: sockJson.defaults?.manifest?.maven?.bin ?? 'mvn',
5027
+ cwd,
5028
+ excludeConfigs: sockJson.defaults?.manifest?.maven?.excludeConfigs ?? '',
5029
+ ignoreUnresolved: Boolean(sockJson.defaults?.manifest?.maven?.ignoreUnresolved),
5030
+ includeConfigs: sockJson.defaults?.manifest?.maven?.includeConfigs ?? '',
5031
+ mavenOpts: parseBuildToolOpts(sockJson.defaults?.manifest?.maven?.mavenOpts),
5032
+ verbose: Boolean(sockJson.defaults?.manifest?.maven?.verbose)
5033
+ });
5034
+ }
4932
5035
  if (!sockJson?.defaults?.manifest?.conda?.disabled && detected.conda) {
4933
5036
  logger.logger.log('Detected an environment.yml file, running default Conda generator...');
4934
5037
  await handleManifestConda({
@@ -5191,12 +5294,12 @@ async function handleCreateNewScan({
5191
5294
  if (reach && scanId && tier1ReachabilityScanId) {
5192
5295
  await finalizeTier1Scan(tier1ReachabilityScanId, scanId);
5193
5296
  } else if (reach.runReachabilityAnalysis && scanId && !tier1ReachabilityScanId) {
5194
- // Reachability analysis ran and a scan was created, but no tier 1
5195
- // reachability scan id was extracted from the facts file. Surface this
5196
- // instead of silently skipping finalize — otherwise the tier 1 row stays
5197
- // stuck (e.g. at COANA_DONE) and the full scan is never linked to its
5198
- // reachability report.
5199
- logger.logger.warn('Reachability analysis ran but no tier 1 reachability scan ID was found; skipping tier 1 finalize. The scan was created but its reachability report was not linked.');
5297
+ // Reachability analysis ran and a scan was created, but no full
5298
+ // application reachability scan id was extracted from the facts file.
5299
+ // Surface this instead of silently skipping finalize — otherwise the
5300
+ // reachability row stays stuck (e.g. at COANA_DONE) and the full scan is
5301
+ // never linked to its reachability report.
5302
+ logger.logger.warn('Reachability analysis ran but no full application reachability scan ID was found; skipping reachability finalize. The scan was created but its reachability report was not linked.');
5200
5303
  }
5201
5304
 
5202
5305
  // On a successful scan, clean up the `.socket.facts.json` coana wrote at
@@ -5205,8 +5308,12 @@ async function handleCreateNewScan({
5205
5308
  // (e.g. from `socket manifest gradle --facts`) are NOT touched here —
5206
5309
  // those are user-owned input that the user can clean up themselves; in
5207
5310
  // the --reach path coana overwrites that file with its enriched output
5208
- // anyway, so it's the same path that gets removed.
5209
- if (fullScanCResult.ok && scanId && reachabilityReport) {
5311
+ // anyway, so it's the same path that gets removed. `--reach-retain-facts-file`
5312
+ // opts out of this cleanup so the report can be inspected; the user is then
5313
+ // responsible for deleting it before the next full application reachability
5314
+ // scan (a stale file is picked up as pre-generated input and would make those
5315
+ // results unreliable).
5316
+ if (fullScanCResult.ok && scanId && reachabilityReport && !reach.reachRetainFactsFile) {
5210
5317
  try {
5211
5318
  await fs.unlink(path.resolve(cwd, reachabilityReport));
5212
5319
  require$$9.debugFn('notice', `[socket-facts] removed coana output after successful scan: ${reachabilityReport}`);
@@ -5304,6 +5411,7 @@ async function handleCi(autoManifest) {
5304
5411
  reachEnableAnalysisSplitting: false,
5305
5412
  reachExcludePaths: [],
5306
5413
  reachLazyMode: false,
5414
+ reachRetainFactsFile: false,
5307
5415
  reachSkipCache: false,
5308
5416
  reachUseOnlyPregeneratedSboms: false,
5309
5417
  reachVersion: undefined,
@@ -5319,7 +5427,7 @@ async function handleCi(autoManifest) {
5319
5427
  });
5320
5428
  }
5321
5429
 
5322
- const config$l = {
5430
+ const config$m = {
5323
5431
  commandName: 'ci',
5324
5432
  description: 'Alias for `socket scan create --report` (creates report and exits with error if unhealthy)',
5325
5433
  hidden: false,
@@ -5337,7 +5445,7 @@ const config$l = {
5337
5445
  $ ${command} [options]
5338
5446
 
5339
5447
  Options
5340
- ${utils.getFlagListOutput(config$l.flags)}
5448
+ ${utils.getFlagListOutput(config$m.flags)}
5341
5449
 
5342
5450
  This command is intended to use in CI runs to allow automated systems to
5343
5451
  accept or reject a current build. It will use the default org of the
@@ -5355,16 +5463,16 @@ const config$l = {
5355
5463
  `
5356
5464
  };
5357
5465
  const cmdCI = {
5358
- description: config$l.description,
5359
- hidden: config$l.hidden,
5360
- run: run$R
5466
+ description: config$m.description,
5467
+ hidden: config$m.hidden,
5468
+ run: run$S
5361
5469
  };
5362
- async function run$R(argv, importMeta, {
5470
+ async function run$S(argv, importMeta, {
5363
5471
  parentName
5364
5472
  }) {
5365
5473
  const cli = utils.meowOrExit({
5366
5474
  argv,
5367
- config: config$l,
5475
+ config: config$m,
5368
5476
  parentName,
5369
5477
  importMeta
5370
5478
  });
@@ -5607,9 +5715,9 @@ const hidden$v = false;
5607
5715
  const cmdConfigAuto = {
5608
5716
  description: description$D,
5609
5717
  hidden: hidden$v,
5610
- run: run$Q
5718
+ run: run$R
5611
5719
  };
5612
- async function run$Q(argv, importMeta, {
5720
+ async function run$R(argv, importMeta, {
5613
5721
  parentName
5614
5722
  }) {
5615
5723
  const config = {
@@ -5725,7 +5833,7 @@ async function handleConfigGet({
5725
5833
  await outputConfigGet(key, result, outputKind);
5726
5834
  }
5727
5835
 
5728
- const config$k = {
5836
+ const config$l = {
5729
5837
  commandName: 'get',
5730
5838
  description: 'Get the value of a local CLI config item',
5731
5839
  hidden: false,
@@ -5755,16 +5863,16 @@ ${utils.getSupportedConfigEntries().map(({
5755
5863
  `
5756
5864
  };
5757
5865
  const cmdConfigGet = {
5758
- description: config$k.description,
5759
- hidden: config$k.hidden,
5760
- run: run$P
5866
+ description: config$l.description,
5867
+ hidden: config$l.hidden,
5868
+ run: run$Q
5761
5869
  };
5762
- async function run$P(argv, importMeta, {
5870
+ async function run$Q(argv, importMeta, {
5763
5871
  parentName
5764
5872
  }) {
5765
5873
  const cli = utils.meowOrExit({
5766
5874
  argv,
5767
- config: config$k,
5875
+ config: config$l,
5768
5876
  importMeta,
5769
5877
  parentName
5770
5878
  });
@@ -5866,7 +5974,7 @@ async function outputConfigList({
5866
5974
  }
5867
5975
  }
5868
5976
 
5869
- const config$j = {
5977
+ const config$k = {
5870
5978
  commandName: 'list',
5871
5979
  description: 'Show all local CLI config items and their values',
5872
5980
  hidden: false,
@@ -5891,16 +5999,16 @@ const config$j = {
5891
5999
  `
5892
6000
  };
5893
6001
  const cmdConfigList = {
5894
- description: config$j.description,
5895
- hidden: config$j.hidden,
5896
- run: run$O
6002
+ description: config$k.description,
6003
+ hidden: config$k.hidden,
6004
+ run: run$P
5897
6005
  };
5898
- async function run$O(argv, importMeta, {
6006
+ async function run$P(argv, importMeta, {
5899
6007
  parentName
5900
6008
  }) {
5901
6009
  const cli = utils.meowOrExit({
5902
6010
  argv,
5903
- config: config$j,
6011
+ config: config$k,
5904
6012
  importMeta,
5905
6013
  parentName
5906
6014
  });
@@ -5990,9 +6098,9 @@ const hidden$u = false;
5990
6098
  const cmdConfigSet = {
5991
6099
  description: description$C,
5992
6100
  hidden: hidden$u,
5993
- run: run$N
6101
+ run: run$O
5994
6102
  };
5995
- async function run$N(argv, importMeta, {
6103
+ async function run$O(argv, importMeta, {
5996
6104
  parentName
5997
6105
  }) {
5998
6106
  const config = {
@@ -6117,9 +6225,9 @@ const hidden$t = false;
6117
6225
  const cmdConfigUnset = {
6118
6226
  description: description$B,
6119
6227
  hidden: hidden$t,
6120
- run: run$M
6228
+ run: run$N
6121
6229
  };
6122
- async function run$M(argv, importMeta, {
6230
+ async function run$N(argv, importMeta, {
6123
6231
  parentName
6124
6232
  }) {
6125
6233
  const config = {
@@ -7334,7 +7442,7 @@ const hidden$s = false;
7334
7442
  const cmdFix = {
7335
7443
  description: description$z,
7336
7444
  hidden: hidden$s,
7337
- run: run$L
7445
+ run: run$M
7338
7446
  };
7339
7447
  const generalFlags$2 = {
7340
7448
  autopilot: {
@@ -7509,7 +7617,7 @@ const hiddenFlags = {
7509
7617
  hidden: true
7510
7618
  }
7511
7619
  };
7512
- async function run$L(argv, importMeta, {
7620
+ async function run$M(argv, importMeta, {
7513
7621
  parentName
7514
7622
  }) {
7515
7623
  const config = {
@@ -7838,7 +7946,7 @@ async function handleInstallCompletion(targetName) {
7838
7946
  await outputInstallCompletion(result);
7839
7947
  }
7840
7948
 
7841
- const config$i = {
7949
+ const config$j = {
7842
7950
  commandName: 'completion',
7843
7951
  description: 'Install bash completion for Socket CLI',
7844
7952
  hidden: false,
@@ -7875,16 +7983,16 @@ const config$i = {
7875
7983
  `
7876
7984
  };
7877
7985
  const cmdInstallCompletion = {
7878
- description: config$i.description,
7879
- hidden: config$i.hidden,
7880
- run: run$K
7986
+ description: config$j.description,
7987
+ hidden: config$j.hidden,
7988
+ run: run$L
7881
7989
  };
7882
- async function run$K(argv, importMeta, {
7990
+ async function run$L(argv, importMeta, {
7883
7991
  parentName
7884
7992
  }) {
7885
7993
  const cli = utils.meowOrExit({
7886
7994
  argv,
7887
- config: config$i,
7995
+ config: config$j,
7888
7996
  parentName,
7889
7997
  importMeta
7890
7998
  });
@@ -7941,7 +8049,7 @@ async function handleCmdJson(cwd) {
7941
8049
  await outputCmdJson(cwd);
7942
8050
  }
7943
8051
 
7944
- const config$h = {
8052
+ const config$i = {
7945
8053
  commandName: 'json',
7946
8054
  description: `Display the \`${constants.SOCKET_JSON}\` that would be applied for target folder`,
7947
8055
  hidden: true,
@@ -7960,16 +8068,16 @@ const config$h = {
7960
8068
  `
7961
8069
  };
7962
8070
  const cmdJson = {
7963
- description: config$h.description,
7964
- hidden: config$h.hidden,
7965
- run: run$J
8071
+ description: config$i.description,
8072
+ hidden: config$i.hidden,
8073
+ run: run$K
7966
8074
  };
7967
- async function run$J(argv, importMeta, {
8075
+ async function run$K(argv, importMeta, {
7968
8076
  parentName
7969
8077
  }) {
7970
8078
  const cli = utils.meowOrExit({
7971
8079
  argv,
7972
- config: config$h,
8080
+ config: config$i,
7973
8081
  parentName,
7974
8082
  importMeta
7975
8083
  });
@@ -8124,9 +8232,9 @@ const hidden$r = false;
8124
8232
  const cmdLogin = {
8125
8233
  description: description$x,
8126
8234
  hidden: hidden$r,
8127
- run: run$I
8235
+ run: run$J
8128
8236
  };
8129
- async function run$I(argv, importMeta, {
8237
+ async function run$J(argv, importMeta, {
8130
8238
  parentName
8131
8239
  }) {
8132
8240
  const config = {
@@ -8204,7 +8312,7 @@ function attemptLogout() {
8204
8312
  }
8205
8313
  }
8206
8314
 
8207
- const config$g = {
8315
+ const config$h = {
8208
8316
  commandName: 'logout',
8209
8317
  description: 'Socket API logout',
8210
8318
  hidden: false,
@@ -8222,16 +8330,16 @@ const config$g = {
8222
8330
  `
8223
8331
  };
8224
8332
  const cmdLogout = {
8225
- description: config$g.description,
8226
- hidden: config$g.hidden,
8227
- run: run$H
8333
+ description: config$h.description,
8334
+ hidden: config$h.hidden,
8335
+ run: run$I
8228
8336
  };
8229
- async function run$H(argv, importMeta, {
8337
+ async function run$I(argv, importMeta, {
8230
8338
  parentName
8231
8339
  }) {
8232
8340
  const cli = utils.meowOrExit({
8233
8341
  argv,
8234
- config: config$g,
8342
+ config: config$h,
8235
8343
  importMeta,
8236
8344
  parentName
8237
8345
  });
@@ -8544,7 +8652,7 @@ const yargsConfig = {
8544
8652
  'usages-slices-file' // hidden
8545
8653
  ]
8546
8654
  };
8547
- const config$f = {
8655
+ const config$g = {
8548
8656
  commandName: 'cdxgen',
8549
8657
  description: 'Run cdxgen for SBOM generation',
8550
8658
  hidden: false,
@@ -8554,11 +8662,11 @@ const config$f = {
8554
8662
  help: () => ''
8555
8663
  };
8556
8664
  const cmdManifestCdxgen = {
8557
- description: config$f.description,
8558
- hidden: config$f.hidden,
8559
- run: run$G
8665
+ description: config$g.description,
8666
+ hidden: config$g.hidden,
8667
+ run: run$H
8560
8668
  };
8561
- async function run$G(argv, importMeta, context) {
8669
+ async function run$H(argv, importMeta, context) {
8562
8670
  const {
8563
8671
  parentName
8564
8672
  } = {
@@ -8568,7 +8676,7 @@ async function run$G(argv, importMeta, context) {
8568
8676
  const cli = utils.meowOrExit({
8569
8677
  // Don't let meow take over --help.
8570
8678
  argv: argv.filter(a => !utils.isHelpFlag(a)),
8571
- config: config$f,
8679
+ config: config$g,
8572
8680
  importMeta,
8573
8681
  parentName
8574
8682
  });
@@ -9607,7 +9715,7 @@ async function buildSpokeTagLookup(reached, queryOpts, verbose) {
9607
9715
  return lookup;
9608
9716
  }
9609
9717
 
9610
- const config$e = {
9718
+ const config$f = {
9611
9719
  commandName: 'bazel',
9612
9720
  description: '[beta] Bazel SBOM support — generate manifest files for a Bazel project (Maven, PyPI)',
9613
9721
  hidden: false,
@@ -9691,9 +9799,9 @@ const config$e = {
9691
9799
  // shorter default lives in extract_bazel_to_maven.mts.
9692
9800
  const EXPLICIT_PER_REPO_TIMEOUT_MS = 120_000;
9693
9801
  const cmdManifestBazel = {
9694
- description: config$e.description,
9695
- hidden: config$e.hidden,
9696
- run: run$F
9802
+ description: config$f.description,
9803
+ hidden: config$f.hidden,
9804
+ run: run$G
9697
9805
  };
9698
9806
  // Pure outcome-matrix evaluator. Exported so dispatcher behavior can be
9699
9807
  // unit-tested without spawning the CLI binary. Throws InputError on
@@ -9777,12 +9885,12 @@ function pypiOutcome(result) {
9777
9885
  status: 'hardFailure'
9778
9886
  };
9779
9887
  }
9780
- async function run$F(argv, importMeta, {
9888
+ async function run$G(argv, importMeta, {
9781
9889
  parentName
9782
9890
  }) {
9783
9891
  const cli = utils.meowOrExit({
9784
9892
  argv,
9785
- config: config$e,
9893
+ config: config$f,
9786
9894
  importMeta,
9787
9895
  parentName
9788
9896
  });
@@ -9870,7 +9978,7 @@ async function run$F(argv, importMeta, {
9870
9978
  }
9871
9979
  }
9872
9980
  if (verbose) {
9873
- logger.logger.group('- ', parentName, config$e.commandName, ':');
9981
+ logger.logger.group('- ', parentName, config$f.commandName, ':');
9874
9982
  logger.logger.group('- flags:', cli.flags);
9875
9983
  logger.logger.groupEnd();
9876
9984
  logger.logger.log('- input:', cli.input);
@@ -9947,7 +10055,7 @@ async function run$F(argv, importMeta, {
9947
10055
  evaluateEcosystemOutcomes(outcomes, wasExplicitEcosystemSelection);
9948
10056
  }
9949
10057
 
9950
- const config$d = {
10058
+ const config$e = {
9951
10059
  commandName: 'auto',
9952
10060
  description: 'Auto-detect build and attempt to generate manifest file',
9953
10061
  hidden: false,
@@ -9980,16 +10088,16 @@ const config$d = {
9980
10088
  `
9981
10089
  };
9982
10090
  const cmdManifestAuto = {
9983
- description: config$d.description,
9984
- hidden: config$d.hidden,
9985
- run: run$E
10091
+ description: config$e.description,
10092
+ hidden: config$e.hidden,
10093
+ run: run$F
9986
10094
  };
9987
- async function run$E(argv, importMeta, {
10095
+ async function run$F(argv, importMeta, {
9988
10096
  parentName
9989
10097
  }) {
9990
10098
  const cli = utils.meowOrExit({
9991
10099
  argv,
9992
- config: config$d,
10100
+ config: config$e,
9993
10101
  importMeta,
9994
10102
  parentName
9995
10103
  });
@@ -10007,7 +10115,7 @@ async function run$E(argv, importMeta, {
10007
10115
  cwd = path.resolve(process.cwd(), cwd);
10008
10116
  const outputKind = utils.getOutputKind(json, markdown);
10009
10117
  if (verbose) {
10010
- logger.logger.group('- ', parentName, config$d.commandName, ':');
10118
+ logger.logger.group('- ', parentName, config$e.commandName, ':');
10011
10119
  logger.logger.group('- flags:', cli.flags);
10012
10120
  logger.logger.groupEnd();
10013
10121
  logger.logger.log('- input:', cli.input);
@@ -10041,7 +10149,7 @@ async function run$E(argv, importMeta, {
10041
10149
  logger.logger.success(`Finished. Should have attempted to generate manifest files for ${detected.count} targets.`);
10042
10150
  }
10043
10151
 
10044
- const config$c = {
10152
+ const config$d = {
10045
10153
  commandName: 'conda',
10046
10154
  description: `[beta] Convert a Conda ${constants.ENVIRONMENT_YML} file to a python ${constants.REQUIREMENTS_TXT}`,
10047
10155
  hidden: false,
@@ -10094,16 +10202,16 @@ const config$c = {
10094
10202
  `
10095
10203
  };
10096
10204
  const cmdManifestConda = {
10097
- description: config$c.description,
10098
- hidden: config$c.hidden,
10099
- run: run$D
10205
+ description: config$d.description,
10206
+ hidden: config$d.hidden,
10207
+ run: run$E
10100
10208
  };
10101
- async function run$D(argv, importMeta, {
10209
+ async function run$E(argv, importMeta, {
10102
10210
  parentName
10103
10211
  }) {
10104
10212
  const cli = utils.meowOrExit({
10105
10213
  argv,
10106
- config: config$c,
10214
+ config: config$d,
10107
10215
  importMeta,
10108
10216
  parentName
10109
10217
  });
@@ -10161,7 +10269,7 @@ async function run$D(argv, importMeta, {
10161
10269
  verbose = false;
10162
10270
  }
10163
10271
  if (verbose) {
10164
- logger.logger.group('- ', parentName, config$c.commandName, ':');
10272
+ logger.logger.group('- ', parentName, config$d.commandName, ':');
10165
10273
  logger.logger.group('- flags:', cli.flags);
10166
10274
  logger.logger.groupEnd();
10167
10275
  logger.logger.log('- target:', cwd);
@@ -10197,7 +10305,7 @@ async function run$D(argv, importMeta, {
10197
10305
  });
10198
10306
  }
10199
10307
 
10200
- const config$b = {
10308
+ const config$c = {
10201
10309
  commandName: 'gradle',
10202
10310
  description: '[beta] Generate a Socket facts file (or `pom.xml` with --pom) for a Gradle/Java/Kotlin/etc project',
10203
10311
  hidden: false,
@@ -10273,16 +10381,16 @@ const config$b = {
10273
10381
  `
10274
10382
  };
10275
10383
  const cmdManifestGradle = {
10276
- description: config$b.description,
10277
- hidden: config$b.hidden,
10278
- run: run$C
10384
+ description: config$c.description,
10385
+ hidden: config$c.hidden,
10386
+ run: run$D
10279
10387
  };
10280
- async function run$C(argv, importMeta, {
10388
+ async function run$D(argv, importMeta, {
10281
10389
  parentName
10282
10390
  }) {
10283
10391
  const cli = utils.meowOrExit({
10284
10392
  argv,
10285
- config: config$b,
10393
+ config: config$c,
10286
10394
  importMeta,
10287
10395
  parentName
10288
10396
  });
@@ -10386,7 +10494,7 @@ async function run$C(argv, importMeta, {
10386
10494
  logger.logger.warn('The `--include-configs`, `--exclude-configs`, and `--ignore-unresolved` options only apply when generating Socket facts (not with `--pom`); ignoring them.');
10387
10495
  }
10388
10496
  if (verbose) {
10389
- logger.logger.group('- ', parentName, config$b.commandName, ':');
10497
+ logger.logger.group('- ', parentName, config$c.commandName, ':');
10390
10498
  logger.logger.group('- flags:', cli.flags);
10391
10499
  logger.logger.groupEnd();
10392
10500
  logger.logger.log('- input:', cli.input);
@@ -10416,7 +10524,7 @@ async function run$C(argv, importMeta, {
10416
10524
  logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
10417
10525
  return;
10418
10526
  }
10419
- const parsedGradleOpts = String(gradleOpts || '').split(' ').map(s => s.trim()).filter(Boolean);
10527
+ const parsedGradleOpts = parseBuildToolOpts(String(gradleOpts || ''));
10420
10528
  if (facts) {
10421
10529
  await convertGradleToFacts({
10422
10530
  bin: String(bin),
@@ -10442,7 +10550,7 @@ async function run$C(argv, importMeta, {
10442
10550
  // sense for the help panels to note the requested language, rather than
10443
10551
  // `socket manifest kotlin` to print help screens with `gradle` as the
10444
10552
  // command. Room for improvement.
10445
- const config$a = {
10553
+ const config$b = {
10446
10554
  commandName: 'kotlin',
10447
10555
  description: '[beta] Generate a Socket facts file (or `pom.xml` with --pom) for a Kotlin project',
10448
10556
  hidden: false,
@@ -10518,16 +10626,16 @@ const config$a = {
10518
10626
  `
10519
10627
  };
10520
10628
  const cmdManifestKotlin = {
10521
- description: config$a.description,
10522
- hidden: config$a.hidden,
10523
- run: run$B
10629
+ description: config$b.description,
10630
+ hidden: config$b.hidden,
10631
+ run: run$C
10524
10632
  };
10525
- async function run$B(argv, importMeta, {
10633
+ async function run$C(argv, importMeta, {
10526
10634
  parentName
10527
10635
  }) {
10528
10636
  const cli = utils.meowOrExit({
10529
10637
  argv,
10530
- config: config$a,
10638
+ config: config$b,
10531
10639
  importMeta,
10532
10640
  parentName
10533
10641
  });
@@ -10629,7 +10737,7 @@ async function run$B(argv, importMeta, {
10629
10737
  logger.logger.warn('The `--include-configs`, `--exclude-configs`, and `--ignore-unresolved` options only apply when generating Socket facts (not with `--pom`); ignoring them.');
10630
10738
  }
10631
10739
  if (verbose) {
10632
- logger.logger.group('- ', parentName, config$a.commandName, ':');
10740
+ logger.logger.group('- ', parentName, config$b.commandName, ':');
10633
10741
  logger.logger.group('- flags:', cli.flags);
10634
10742
  logger.logger.groupEnd();
10635
10743
  logger.logger.log('- input:', cli.input);
@@ -10659,7 +10767,7 @@ async function run$B(argv, importMeta, {
10659
10767
  logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
10660
10768
  return;
10661
10769
  }
10662
- const parsedGradleOpts = String(gradleOpts || '').split(' ').map(s => s.trim()).filter(Boolean);
10770
+ const parsedGradleOpts = parseBuildToolOpts(String(gradleOpts || ''));
10663
10771
  if (facts) {
10664
10772
  await convertGradleToFacts({
10665
10773
  bin: String(bin),
@@ -10680,6 +10788,189 @@ async function run$B(argv, importMeta, {
10680
10788
  });
10681
10789
  }
10682
10790
 
10791
+ const config$a = {
10792
+ commandName: 'maven',
10793
+ description: '[beta] Generate a Socket facts file from a Maven `pom.xml` project',
10794
+ hidden: false,
10795
+ flags: {
10796
+ ...flags.commonFlags,
10797
+ bin: {
10798
+ type: 'string',
10799
+ description: 'Location of the maven binary to use, default: mvn on PATH'
10800
+ },
10801
+ includeConfigs: {
10802
+ type: 'string',
10803
+ description: 'Comma-separated glob patterns matched against Maven dependency scopes (case-sensitive, `*` and `?` wildcards). Only scopes matching at least one pattern are resolved. e.g. `compile,runtime`. Default: every scope'
10804
+ },
10805
+ excludeConfigs: {
10806
+ type: 'string',
10807
+ description: 'Comma-separated glob patterns; Maven scopes matching any pattern are skipped (applied after --include-configs)'
10808
+ },
10809
+ ignoreUnresolved: {
10810
+ type: 'boolean',
10811
+ description: 'Warn on unresolved dependencies instead of failing the run (unresolved deps are not emitted to the facts file)'
10812
+ },
10813
+ mavenOpts: {
10814
+ type: 'string',
10815
+ description: 'Additional options to pass on to maven, e.g. `-P <profile> -s <settings.xml>`'
10816
+ },
10817
+ verbose: {
10818
+ type: 'boolean',
10819
+ description: 'Print debug messages'
10820
+ }
10821
+ },
10822
+ help: (command, config) => `
10823
+ Usage
10824
+ $ ${command} [options] [CWD=.]
10825
+
10826
+ Options
10827
+ ${utils.getFlagListOutput(config.flags)}
10828
+
10829
+ Emits a single \`.socket.facts.json\` describing the resolved dependency
10830
+ graph of your Maven project, using maven (\`mvn\` on PATH by default). It
10831
+ reads dependency metadata only and never downloads artifacts; an unresolved
10832
+ dependency is a fatal error. You can pass --include-configs /
10833
+ --exclude-configs (comma-separated glob patterns) to control which Maven
10834
+ scopes are resolved (e.g. --include-configs=\`compile,runtime\`), and
10835
+ --ignore-unresolved to warn on unresolved dependencies instead of failing.
10836
+
10837
+ You can specify --bin to override the path to the \`mvn\` binary to invoke
10838
+ (e.g. a project \`./mvnw\` wrapper), and --maven-opts to pass extra options
10839
+ through to maven (e.g. \`-P <profile> -s <settings.xml>\`).
10840
+
10841
+ Support is beta. Please report issues or give us feedback on what's missing.
10842
+
10843
+ Examples
10844
+
10845
+ $ ${command} .
10846
+ $ ${command} --bin=./mvnw .
10847
+ $ ${command} --maven-opts="-P release" .
10848
+ `
10849
+ };
10850
+ const cmdManifestMaven = {
10851
+ description: config$a.description,
10852
+ hidden: config$a.hidden,
10853
+ run: run$B
10854
+ };
10855
+ async function run$B(argv, importMeta, {
10856
+ parentName
10857
+ }) {
10858
+ const cli = utils.meowOrExit({
10859
+ argv,
10860
+ config: config$a,
10861
+ importMeta,
10862
+ parentName
10863
+ });
10864
+ const {
10865
+ json = false,
10866
+ markdown = false
10867
+ } = cli.flags;
10868
+ const dryRun = !!cli.flags['dryRun'];
10869
+
10870
+ // TODO: Implement json/md further.
10871
+ const outputKind = utils.getOutputKind(json, markdown);
10872
+ let [cwd = '.'] = cli.input;
10873
+ // Note: path.resolve vs .join:
10874
+ // If given path is absolute then cwd should not affect it.
10875
+ cwd = path.resolve(process.cwd(), cwd);
10876
+ const sockJson = utils.readOrDefaultSocketJson(cwd);
10877
+ require$$9.debugFn('inspect', `override: ${constants.SOCKET_JSON} maven`, sockJson?.defaults?.manifest?.maven);
10878
+ let {
10879
+ bin,
10880
+ excludeConfigs,
10881
+ ignoreUnresolved,
10882
+ includeConfigs,
10883
+ mavenOpts,
10884
+ verbose
10885
+ } = cli.flags;
10886
+
10887
+ // Set defaults for any flag/arg that is not given. Check socket.json first.
10888
+ if (!bin) {
10889
+ if (sockJson.defaults?.manifest?.maven?.bin) {
10890
+ bin = sockJson.defaults?.manifest?.maven?.bin;
10891
+ logger.logger.info(`Using default --bin from ${constants.SOCKET_JSON}:`, bin);
10892
+ } else {
10893
+ bin = 'mvn';
10894
+ }
10895
+ }
10896
+ if (!mavenOpts) {
10897
+ if (sockJson.defaults?.manifest?.maven?.mavenOpts) {
10898
+ mavenOpts = sockJson.defaults?.manifest?.maven?.mavenOpts;
10899
+ logger.logger.info(`Using default --maven-opts from ${constants.SOCKET_JSON}:`, mavenOpts);
10900
+ } else {
10901
+ mavenOpts = '';
10902
+ }
10903
+ }
10904
+ if (includeConfigs === undefined) {
10905
+ if (sockJson.defaults?.manifest?.maven?.includeConfigs !== undefined) {
10906
+ includeConfigs = sockJson.defaults?.manifest?.maven?.includeConfigs;
10907
+ logger.logger.info(`Using default --include-configs from ${constants.SOCKET_JSON}:`, includeConfigs);
10908
+ } else {
10909
+ includeConfigs = '';
10910
+ }
10911
+ }
10912
+ if (excludeConfigs === undefined) {
10913
+ if (sockJson.defaults?.manifest?.maven?.excludeConfigs !== undefined) {
10914
+ excludeConfigs = sockJson.defaults?.manifest?.maven?.excludeConfigs;
10915
+ logger.logger.info(`Using default --exclude-configs from ${constants.SOCKET_JSON}:`, excludeConfigs);
10916
+ } else {
10917
+ excludeConfigs = '';
10918
+ }
10919
+ }
10920
+ if (ignoreUnresolved === undefined) {
10921
+ if (sockJson.defaults?.manifest?.maven?.ignoreUnresolved !== undefined) {
10922
+ ignoreUnresolved = sockJson.defaults?.manifest?.maven?.ignoreUnresolved;
10923
+ logger.logger.info(`Using default --ignore-unresolved from ${constants.SOCKET_JSON}:`, ignoreUnresolved);
10924
+ } else {
10925
+ ignoreUnresolved = false;
10926
+ }
10927
+ }
10928
+ if (verbose === undefined) {
10929
+ if (sockJson.defaults?.manifest?.maven?.verbose !== undefined) {
10930
+ verbose = sockJson.defaults?.manifest?.maven?.verbose;
10931
+ logger.logger.info(`Using default --verbose from ${constants.SOCKET_JSON}:`, verbose);
10932
+ } else {
10933
+ verbose = false;
10934
+ }
10935
+ }
10936
+ if (verbose) {
10937
+ logger.logger.group('- ', parentName, config$a.commandName, ':');
10938
+ logger.logger.group('- flags:', cli.flags);
10939
+ logger.logger.groupEnd();
10940
+ logger.logger.log('- input:', cli.input);
10941
+ logger.logger.groupEnd();
10942
+ }
10943
+ const wasValidInput = utils.checkCommandInput(outputKind, {
10944
+ nook: true,
10945
+ test: cli.input.length <= 1,
10946
+ message: 'Can only accept one DIR (make sure to escape spaces!)',
10947
+ fail: 'received ' + cli.input.length
10948
+ });
10949
+ if (!wasValidInput) {
10950
+ return;
10951
+ }
10952
+ if (verbose) {
10953
+ logger.logger.group();
10954
+ logger.logger.info('- cwd:', cwd);
10955
+ logger.logger.info('- maven bin:', bin);
10956
+ logger.logger.groupEnd();
10957
+ }
10958
+ if (dryRun) {
10959
+ logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
10960
+ return;
10961
+ }
10962
+ const parsedMavenOpts = parseBuildToolOpts(String(mavenOpts || ''));
10963
+ await convertMavenToFacts({
10964
+ bin: String(bin),
10965
+ cwd,
10966
+ excludeConfigs: String(excludeConfigs || ''),
10967
+ ignoreUnresolved: Boolean(ignoreUnresolved),
10968
+ includeConfigs: String(includeConfigs || ''),
10969
+ mavenOpts: parsedMavenOpts,
10970
+ verbose: Boolean(verbose)
10971
+ });
10972
+ }
10973
+
10683
10974
  const config$9 = {
10684
10975
  commandName: 'scala',
10685
10976
  description: '[beta] Generate a Socket facts file (or `pom.xml` with --pom) from a Scala `build.sbt` project',
@@ -10944,7 +11235,7 @@ async function run$A(argv, importMeta, {
10944
11235
  logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
10945
11236
  return;
10946
11237
  }
10947
- const parsedSbtOpts = String(sbtOpts || '').split(' ').map(s => s.trim()).filter(Boolean);
11238
+ const parsedSbtOpts = parseBuildToolOpts(String(sbtOpts || ''));
10948
11239
  if (facts) {
10949
11240
  await convertSbtToFacts({
10950
11241
  bin: String(bin),
@@ -11017,6 +11308,10 @@ async function setupManifestConfig(cwd, defaultOnReadError = false) {
11017
11308
  name: 'Kotlin (gradle)'.padEnd(30, ' '),
11018
11309
  value: 'gradle',
11019
11310
  description: 'Generate a Socket facts file or pom.xml (for Kotlin) through gradle'
11311
+ }, {
11312
+ name: 'Maven'.padEnd(30, ' '),
11313
+ value: 'maven',
11314
+ description: 'Generate a Socket facts file through maven'
11020
11315
  }, {
11021
11316
  name: 'Scala (gradle)'.padEnd(30, ' '),
11022
11317
  value: 'gradle',
@@ -11084,6 +11379,14 @@ async function setupManifestConfig(cwd, defaultOnReadError = false) {
11084
11379
  result = await setupGradle(sockJson.defaults.manifest.gradle);
11085
11380
  break;
11086
11381
  }
11382
+ case 'maven':
11383
+ {
11384
+ if (!sockJson.defaults.manifest.maven) {
11385
+ sockJson.defaults.manifest.maven = {};
11386
+ }
11387
+ result = await setupMaven(sockJson.defaults.manifest.maven);
11388
+ break;
11389
+ }
11087
11390
  case 'sbt':
11088
11391
  {
11089
11392
  if (!sockJson.defaults.manifest.sbt) {
@@ -11225,6 +11528,44 @@ async function setupGradle(config) {
11225
11528
  }
11226
11529
  return notCanceled$1();
11227
11530
  }
11531
+ async function setupMaven(config) {
11532
+ const bin = await askForBin(config.bin || 'mvn');
11533
+ if (bin === undefined) {
11534
+ return canceledByUser$1();
11535
+ } else if (bin) {
11536
+ config.bin = bin;
11537
+ } else {
11538
+ delete config.bin;
11539
+ }
11540
+ const opts = await prompts.input({
11541
+ message: '(--maven-opts) Enter maven options to pass through',
11542
+ default: config.mavenOpts || '',
11543
+ required: false
11544
+ });
11545
+ if (opts === undefined) {
11546
+ return canceledByUser$1();
11547
+ } else if (opts) {
11548
+ config.mavenOpts = opts;
11549
+ } else {
11550
+ delete config.mavenOpts;
11551
+ }
11552
+
11553
+ // Maven only generates Socket facts (no pom path), so always ask the
11554
+ // facts-only options.
11555
+ const factsOptions = await setupFactsOptions(config);
11556
+ if (!factsOptions.ok || factsOptions.data.canceled) {
11557
+ return factsOptions;
11558
+ }
11559
+ const verbose = await askForVerboseFlag(config.verbose);
11560
+ if (verbose === undefined) {
11561
+ return canceledByUser$1();
11562
+ } else if (verbose === 'yes' || verbose === 'no') {
11563
+ config.verbose = verbose === 'yes';
11564
+ } else {
11565
+ delete config.verbose;
11566
+ }
11567
+ return notCanceled$1();
11568
+ }
11228
11569
  async function setupSbt(config) {
11229
11570
  const bin = await askForBin(config.bin || 'sbt');
11230
11571
  if (bin === undefined) {
@@ -11580,6 +11921,7 @@ async function run$y(argv, importMeta, {
11580
11921
  conda: cmdManifestConda,
11581
11922
  gradle: cmdManifestGradle,
11582
11923
  kotlin: cmdManifestKotlin,
11924
+ maven: cmdManifestMaven,
11583
11925
  scala: cmdManifestScala,
11584
11926
  setup: cmdManifestSetup
11585
11927
  }
@@ -15664,12 +16006,12 @@ const reachabilityFlags = {
15664
16006
  reachContinueOnAnalysisErrors: {
15665
16007
  type: 'boolean',
15666
16008
  default: false,
15667
- description: 'Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed (Tier 2) results. By default, the CLI halts on analysis errors.'
16009
+ description: 'Continue reachability analysis when errors occur (timeouts, OOM, parse errors, etc.), falling back to precomputed reachability results. By default, the CLI halts on analysis errors.'
15668
16010
  },
15669
16011
  reachContinueOnInstallErrors: {
15670
16012
  type: 'boolean',
15671
16013
  default: false,
15672
- description: 'Continue reachability analysis when package installation fails, falling back to precomputed (Tier 2) results. By default, the CLI halts on installation errors.'
16014
+ description: 'Continue reachability analysis when package installation fails, falling back to precomputed reachability results. By default, the CLI halts on installation errors.'
15673
16015
  },
15674
16016
  reachContinueOnMissingLockFiles: {
15675
16017
  type: 'boolean',
@@ -15729,6 +16071,11 @@ const reachabilityFlags = {
15729
16071
  description: 'Enable lazy mode for reachability analysis.',
15730
16072
  hidden: true
15731
16073
  },
16074
+ reachRetainFactsFile: {
16075
+ type: 'boolean',
16076
+ default: false,
16077
+ description: 'Keep the `.socket.facts.json` reachability report that the analysis writes to the scan directory instead of deleting it after a successful scan. IMPORTANT: you must delete this file before running a fresh full application reachability scan. A stale `.socket.facts.json` left in place is picked up as a pre-generated input and silently overrides fresh analysis, so the new scan results will not be reliable.'
16078
+ },
15732
16079
  reachSkipCache: {
15733
16080
  type: 'boolean',
15734
16081
  default: false,
@@ -15744,7 +16091,7 @@ const excludePathsFlag = {
15744
16091
  excludePaths: {
15745
16092
  type: 'string',
15746
16093
  isMultiple: true,
15747
- description: 'List of glob patterns to exclude from the scan, including SCA/SBOM manifest discovery and (when --reach is enabled) Tier 1 reachability analysis. Patterns are anchored micromatch globs matched relative to the Socket scan root, which is the command working directory (`--cwd` if set), not the reachability target: `tests` matches only `<cwd>/tests`; use `**/tests` to match at any depth. Negation patterns (`!path`) are not supported. Accepts a comma-separated value or multiple flags.'
16094
+ description: 'List of glob patterns to exclude from the scan, including SCA/SBOM manifest discovery and (when --reach is enabled) full application reachability analysis. Patterns are anchored micromatch globs matched relative to the Socket scan root, which is the command working directory (`--cwd` if set), not the reachability target: `tests` matches only `<cwd>/tests`; use `**/tests` to match at any depth. Negation patterns (`!path`) are not supported. Accepts a comma-separated value or multiple flags.'
15748
16095
  }
15749
16096
  };
15750
16097
 
@@ -15864,7 +16211,7 @@ const generalFlags$1 = {
15864
16211
  reach: {
15865
16212
  type: 'boolean',
15866
16213
  default: false,
15867
- description: 'Run tier 1 full application reachability analysis'
16214
+ description: 'Run full application reachability analysis'
15868
16215
  },
15869
16216
  readOnly: {
15870
16217
  type: 'boolean',
@@ -16004,6 +16351,7 @@ async function run$d(argv, importMeta, {
16004
16351
  reachDisableExternalToolChecks,
16005
16352
  reachEnableAnalysisSplitting,
16006
16353
  reachLazyMode,
16354
+ reachRetainFactsFile,
16007
16355
  reachSkipCache,
16008
16356
  reachUseOnlyPregeneratedSboms,
16009
16357
  reachVersion,
@@ -16271,6 +16619,7 @@ async function run$d(argv, importMeta, {
16271
16619
  reachEnableAnalysisSplitting: Boolean(reachEnableAnalysisSplitting),
16272
16620
  reachExcludePaths,
16273
16621
  reachLazyMode: Boolean(reachLazyMode),
16622
+ reachRetainFactsFile: Boolean(reachRetainFactsFile),
16274
16623
  reachSkipCache: Boolean(reachSkipCache),
16275
16624
  reachUseOnlyPregeneratedSboms: Boolean(reachUseOnlyPregeneratedSboms),
16276
16625
  reachVersion,
@@ -16930,6 +17279,7 @@ async function scanOneRepo(repoSlug, {
16930
17279
  reachEnableAnalysisSplitting: false,
16931
17280
  reachExcludePaths: [],
16932
17281
  reachLazyMode: false,
17282
+ reachRetainFactsFile: false,
16933
17283
  reachSkipCache: false,
16934
17284
  reachUseOnlyPregeneratedSboms: false,
16935
17285
  reachVersion: undefined,
@@ -18158,9 +18508,9 @@ async function handleScanReach({
18158
18508
  });
18159
18509
  spinner.stop();
18160
18510
 
18161
- // Standalone reachability has no full scan to bind to, but the tier1
18162
- // reachability scan row still needs to transition to its DONE terminal
18163
- // state — otherwise it sits at the post-Coana intermediate state forever
18511
+ // Standalone reachability has no full scan to bind to, but the full
18512
+ // application reachability scan row still needs to transition to its DONE
18513
+ // terminal state — otherwise it sits at the post-Coana intermediate state forever
18164
18514
  // and looks indistinguishable from a stuck run. Pass `null` as the full
18165
18515
  // scan id; the endpoint accepts it for this flow. Best-effort: never
18166
18516
  // block the user-visible output on this.
@@ -18168,7 +18518,7 @@ async function handleScanReach({
18168
18518
  if (tier1Id) {
18169
18519
  const finalizeResult = await finalizeTier1Scan(tier1Id, null);
18170
18520
  if (!finalizeResult.ok) {
18171
- logger.logger.warn(`Failed to finalize tier1 reachability scan: ${finalizeResult.message}${finalizeResult.cause ? ` — ${finalizeResult.cause}` : ''}`);
18521
+ logger.logger.warn(`Failed to finalize full application reachability scan: ${finalizeResult.message}${finalizeResult.cause ? ` — ${finalizeResult.cause}` : ''}`);
18172
18522
  }
18173
18523
  }
18174
18524
  await outputScanReach(result, {
@@ -18179,7 +18529,7 @@ async function handleScanReach({
18179
18529
  }
18180
18530
 
18181
18531
  const CMD_NAME$4 = 'reach';
18182
- const description$6 = 'Compute tier 1 reachability';
18532
+ const description$6 = 'Compute full application reachability';
18183
18533
  const hidden$4 = true;
18184
18534
  const generalFlags = {
18185
18535
  ...flags.commonFlags,
@@ -18277,6 +18627,7 @@ async function run$7(argv, importMeta, {
18277
18627
  reachDisableExternalToolChecks,
18278
18628
  reachEnableAnalysisSplitting,
18279
18629
  reachLazyMode,
18630
+ reachRetainFactsFile,
18280
18631
  reachSkipCache,
18281
18632
  reachUseOnlyPregeneratedSboms,
18282
18633
  reachVersion
@@ -18387,6 +18738,7 @@ async function run$7(argv, importMeta, {
18387
18738
  reachEnableAnalysisSplitting: Boolean(reachEnableAnalysisSplitting),
18388
18739
  reachExcludePaths,
18389
18740
  reachLazyMode: Boolean(reachLazyMode),
18741
+ reachRetainFactsFile: Boolean(reachRetainFactsFile),
18390
18742
  reachSkipCache: Boolean(reachSkipCache),
18391
18743
  reachUseOnlyPregeneratedSboms: Boolean(reachUseOnlyPregeneratedSboms),
18392
18744
  reachVersion
@@ -20315,5 +20667,5 @@ process.on('unhandledRejection', async (reason, promise) => {
20315
20667
  // eslint-disable-next-line n/no-process-exit
20316
20668
  process.exit(1);
20317
20669
  });
20318
- //# debugId=cab2a634-ac20-4b27-aff5-55f1c4df59bc
20670
+ //# debugId=6c799c7a-7beb-4a6d-a648-0638ba473165
20319
20671
  //# sourceMappingURL=cli.js.map