@socketsecurity/cli-with-sentry 1.1.20 → 1.1.22

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 (73) hide show
  1. package/CHANGELOG.md +34 -10
  2. package/dist/cli.js +194 -151
  3. package/dist/cli.js.map +1 -1
  4. package/dist/constants.js +28 -4
  5. package/dist/constants.js.map +1 -1
  6. package/dist/flags.js +21 -3
  7. package/dist/flags.js.map +1 -1
  8. package/dist/npm-cli.js +6 -2
  9. package/dist/npm-cli.js.map +1 -1
  10. package/dist/pnpm-cli.js +6 -2
  11. package/dist/pnpm-cli.js.map +1 -1
  12. package/dist/shadow-npm-bin2.js +8 -31
  13. package/dist/shadow-npm-bin2.js.map +1 -1
  14. package/dist/shadow-pnpm-bin2.js +41 -64
  15. package/dist/shadow-pnpm-bin2.js.map +1 -1
  16. package/dist/shadow-yarn-bin.js +17 -33
  17. package/dist/shadow-yarn-bin.js.map +1 -1
  18. package/dist/tsconfig.dts.tsbuildinfo +1 -1
  19. package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
  20. package/dist/types/commands/fix/handle-fix.d.mts +2 -2
  21. package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
  22. package/dist/types/commands/fix/types.d.mts +1 -1
  23. package/dist/types/commands/fix/types.d.mts.map +1 -1
  24. package/dist/types/commands/manifest/cmd-manifest.d.mts.map +1 -1
  25. package/dist/types/commands/optimize/handle-optimize.d.mts.map +1 -1
  26. package/dist/types/commands/organization/cmd-organization-policy.d.mts.map +1 -1
  27. package/dist/types/commands/organization/cmd-organization.d.mts.map +1 -1
  28. package/dist/types/commands/package/cmd-package.d.mts.map +1 -1
  29. package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
  30. package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
  31. package/dist/types/commands/scan/cmd-scan.d.mts.map +1 -1
  32. package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +1 -1
  33. package/dist/types/commands/scan/suggest_branch_slug.d.mts.map +1 -1
  34. package/dist/types/constants.d.mts +8 -1
  35. package/dist/types/constants.d.mts.map +1 -1
  36. package/dist/types/flags.d.mts.map +1 -1
  37. package/dist/types/shadow/common.d.mts +0 -8
  38. package/dist/types/shadow/common.d.mts.map +1 -1
  39. package/dist/types/shadow/npm-base.d.mts.map +1 -1
  40. package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
  41. package/dist/types/shadow/yarn/bin.d.mts.map +1 -1
  42. package/dist/types/test/json-output-validation.d.mts +37 -0
  43. package/dist/types/test/json-output-validation.d.mts.map +1 -0
  44. package/dist/types/test/mocks/socket-auth.d.mts +88 -0
  45. package/dist/types/test/mocks/socket-auth.d.mts.map +1 -0
  46. package/dist/types/utils/agent.d.mts.map +1 -1
  47. package/dist/types/utils/cmd.d.mts +25 -4
  48. package/dist/types/utils/cmd.d.mts.map +1 -1
  49. package/dist/types/utils/config.d.mts +1 -1
  50. package/dist/types/utils/dlx-binary.d.mts +58 -0
  51. package/dist/types/utils/dlx-binary.d.mts.map +1 -0
  52. package/dist/types/utils/dlx-detection.d.mts +29 -0
  53. package/dist/types/utils/dlx-detection.d.mts.map +1 -0
  54. package/dist/types/utils/extract-names.d.mts +15 -0
  55. package/dist/types/utils/extract-names.d.mts.map +1 -0
  56. package/dist/types/utils/git.d.mts.map +1 -1
  57. package/dist/types/utils/meow-with-subcommands.d.mts +33 -12
  58. package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
  59. package/dist/types/utils/shadow-links.d.mts +5 -0
  60. package/dist/types/utils/shadow-links.d.mts.map +1 -0
  61. package/dist/types/utils/terminal-link.d.mts +19 -12
  62. package/dist/types/utils/terminal-link.d.mts.map +1 -1
  63. package/dist/utils.js +533 -146
  64. package/dist/utils.js.map +1 -1
  65. package/dist/yarn-cli.js +6 -2
  66. package/dist/yarn-cli.js.map +1 -1
  67. package/package.json +1 -1
  68. package/dist/types/shadow/npm/link.d.mts +0 -2
  69. package/dist/types/shadow/npm/link.d.mts.map +0 -1
  70. package/dist/types/shadow/pnpm/link.d.mts +0 -2
  71. package/dist/types/shadow/pnpm/link.d.mts.map +0 -1
  72. package/dist/types/shadow/yarn/link.d.mts +0 -2
  73. package/dist/types/shadow/yarn/link.d.mts.map +0 -1
package/dist/cli.js CHANGED
@@ -376,8 +376,8 @@ async function run$S(argv, importMeta, {
376
376
  const cli = utils.meowOrExit({
377
377
  argv,
378
378
  config,
379
- importMeta,
380
- parentName
379
+ parentName,
380
+ importMeta
381
381
  });
382
382
 
383
383
  // Supported inputs:
@@ -818,8 +818,8 @@ async function run$R(argv, importMeta, {
818
818
  const cli = utils.meowOrExit({
819
819
  argv,
820
820
  config,
821
- importMeta,
822
- parentName
821
+ parentName,
822
+ importMeta
823
823
  });
824
824
  const {
825
825
  interactive,
@@ -1574,7 +1574,7 @@ async function performReachabilityAnalysis(options) {
1574
1574
  return {
1575
1575
  ok: false,
1576
1576
  message: 'Tier 1 Reachability analysis requires an enterprise plan',
1577
- cause: `Please ${vendor.terminalLinkExports('upgrade your plan', `${constants.SOCKET_WEBSITE_URL}/pricing`)}. This feature is only available for organizations with an enterprise plan.`
1577
+ cause: `Please ${utils.socketDevLink('upgrade your plan', '/pricing')}. This feature is only available for organizations with an enterprise plan.`
1578
1578
  };
1579
1579
  }
1580
1580
  const wasSpinning = !!spinner?.isSpinning;
@@ -2422,8 +2422,8 @@ async function run$Q(argv, importMeta, {
2422
2422
  const cli = utils.meowOrExit({
2423
2423
  argv,
2424
2424
  config: config$k,
2425
- importMeta,
2426
- parentName
2425
+ parentName,
2426
+ importMeta
2427
2427
  });
2428
2428
  const dryRun = !!cli.flags['dryRun'];
2429
2429
  if (dryRun) {
@@ -2596,7 +2596,7 @@ async function outputConfigAuto(key, result, outputKind) {
2596
2596
  }
2597
2597
  logger.logger.log(`- ${key}: ${result.data}`);
2598
2598
  logger.logger.log('');
2599
- if (utils.isReadOnlyConfig()) {
2599
+ if (utils.isConfigFromFlag()) {
2600
2600
  logger.logger.log('(Unable to persist this value because the config is in read-only mode, meaning it was overridden through env or flag.)');
2601
2601
  } else if (key === 'defaultOrg') {
2602
2602
  const proceed = await prompts.select({
@@ -2744,7 +2744,7 @@ async function outputConfigGet(key, result, outputKind) {
2744
2744
  logger.logger.fail(utils.failMsgWithBadge(result.message, result.cause));
2745
2745
  return;
2746
2746
  }
2747
- const readOnly = utils.isReadOnlyConfig();
2747
+ const readOnly = utils.isConfigFromFlag();
2748
2748
  if (outputKind === 'markdown') {
2749
2749
  logger.logger.log(`# Config Value`);
2750
2750
  logger.logger.log('');
@@ -2847,7 +2847,7 @@ async function outputConfigList({
2847
2847
  full,
2848
2848
  outputKind
2849
2849
  }) {
2850
- const readOnly = utils.isReadOnlyConfig();
2850
+ const readOnly = utils.isConfigFromFlag();
2851
2851
  const supportedConfigKeys = utils.getSupportedConfigKeys();
2852
2852
  if (outputKind === 'json') {
2853
2853
  let failed = false;
@@ -3235,16 +3235,18 @@ const cmdConfig = {
3235
3235
  parentName
3236
3236
  }) {
3237
3237
  await utils.meowWithSubcommands({
3238
- auto: cmdConfigAuto,
3239
- get: cmdConfigGet,
3240
- list: cmdConfigList,
3241
- set: cmdConfigSet,
3242
- unset: cmdConfigUnset
3243
- }, {
3244
3238
  argv,
3245
- description: description$A,
3239
+ name: `${parentName} config`,
3246
3240
  importMeta,
3247
- name: `${parentName} config`
3241
+ subcommands: {
3242
+ auto: cmdConfigAuto,
3243
+ get: cmdConfigGet,
3244
+ list: cmdConfigList,
3245
+ set: cmdConfigSet,
3246
+ unset: cmdConfigUnset
3247
+ }
3248
+ }, {
3249
+ description: description$A
3248
3250
  });
3249
3251
  }
3250
3252
  };
@@ -3544,10 +3546,10 @@ async function coanaFix(fixConfig) {
3544
3546
  const {
3545
3547
  autopilot,
3546
3548
  cwd,
3549
+ dontApplyFixes,
3547
3550
  ghsas,
3548
3551
  glob,
3549
3552
  limit,
3550
- onlyCompute,
3551
3553
  orgSlug,
3552
3554
  outputFile,
3553
3555
  spinner
@@ -3592,7 +3594,7 @@ async function coanaFix(fixConfig) {
3592
3594
  const shouldOpenPrs = fixEnv.isCi && fixEnv.repoInfo;
3593
3595
  if (!shouldOpenPrs) {
3594
3596
  // Inform user about local mode when fixes will be applied.
3595
- if (!onlyCompute && ghsas.length) {
3597
+ if (!dontApplyFixes && ghsas.length) {
3596
3598
  const envCheck = checkCiEnvVars();
3597
3599
  if (envCheck.present.length) {
3598
3600
  // Some CI vars are set but not all - show what's missing.
@@ -3614,7 +3616,7 @@ async function coanaFix(fixConfig) {
3614
3616
  }
3615
3617
  };
3616
3618
  }
3617
- const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...(isAll ? ['all'] : ghsas), ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(glob ? ['--glob', glob] : []), ...(onlyCompute ? [constants.FLAG_DRY_RUN] : []), ...(outputFile ? ['--output-file', outputFile] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
3619
+ const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...(isAll ? ['all'] : ghsas), ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(glob ? ['--glob', glob] : []), ...(dontApplyFixes ? [constants.FLAG_DRY_RUN] : []), ...(outputFile ? ['--output-file', outputFile] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
3618
3620
  cwd,
3619
3621
  spinner,
3620
3622
  stdio: 'inherit'
@@ -3903,11 +3905,11 @@ async function convertIdsToGhsas(ids) {
3903
3905
  async function handleFix({
3904
3906
  autopilot,
3905
3907
  cwd,
3908
+ dontApplyFixes,
3906
3909
  ghsas,
3907
3910
  glob,
3908
3911
  limit,
3909
3912
  minSatisfying,
3910
- onlyCompute,
3911
3913
  orgSlug,
3912
3914
  outputFile,
3913
3915
  outputKind,
@@ -3924,7 +3926,7 @@ async function handleFix({
3924
3926
  glob,
3925
3927
  limit,
3926
3928
  minSatisfying,
3927
- onlyCompute,
3929
+ dontApplyFixes,
3928
3930
  outputFile,
3929
3931
  outputKind,
3930
3932
  prCheck,
@@ -3933,6 +3935,7 @@ async function handleFix({
3933
3935
  });
3934
3936
  await outputFixResult(await coanaFix({
3935
3937
  autopilot,
3938
+ dontApplyFixes,
3936
3939
  cwd,
3937
3940
  // Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only
3938
3941
  ghsas: await convertIdsToGhsas(ghsas),
@@ -3942,7 +3945,6 @@ async function handleFix({
3942
3945
  rangeStyle,
3943
3946
  spinner,
3944
3947
  unknownFlags,
3945
- onlyCompute,
3946
3948
  outputFile
3947
3949
  }), outputKind);
3948
3950
  }
@@ -3962,6 +3964,12 @@ const generalFlags$2 = {
3962
3964
  default: false,
3963
3965
  description: `Enable auto-merge for pull requests that Socket opens.\nSee ${vendor.terminalLinkExports('GitHub documentation', 'https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository')} for managing auto-merge for pull requests in your repository.`
3964
3966
  },
3967
+ dontApplyFixes: {
3968
+ aliases: ['onlyCompute'],
3969
+ type: 'boolean',
3970
+ default: false,
3971
+ description: 'Compute fixes only, do not apply them. Logs what upgrades would be applied. If combined with --output-file, the output file will contain the upgrades that would be applied.'
3972
+ },
3965
3973
  id: {
3966
3974
  type: 'string',
3967
3975
  default: [],
@@ -3987,11 +3995,6 @@ Available styles:
3987
3995
  * preserve - Retain the existing version range style as-is
3988
3996
  `.trim()
3989
3997
  },
3990
- onlyCompute: {
3991
- type: 'boolean',
3992
- default: false,
3993
- description: 'Compute fixes only, do not apply them. Logs what upgrades would be applied. If combined with --output-file, the output file will contain the upgrades that would be applied.'
3994
- },
3995
3998
  outputFile: {
3996
3999
  type: 'string',
3997
4000
  default: '',
@@ -4088,20 +4091,21 @@ async function run$K(argv, importMeta, {
4088
4091
  `
4089
4092
  };
4090
4093
  const cli = utils.meowOrExit({
4091
- allowUnknownFlags: false,
4092
4094
  argv,
4093
4095
  config,
4094
- importMeta,
4095
- parentName
4096
+ parentName,
4097
+ importMeta
4098
+ }, {
4099
+ allowUnknownFlags: false
4096
4100
  });
4097
4101
  const {
4098
4102
  autopilot,
4103
+ dontApplyFixes,
4099
4104
  glob,
4100
4105
  json,
4101
4106
  limit,
4102
4107
  markdown,
4103
4108
  maxSatisfying,
4104
- onlyCompute,
4105
4109
  outputFile,
4106
4110
  prCheck,
4107
4111
  rangeStyle,
@@ -4146,6 +4150,7 @@ async function run$K(argv, importMeta, {
4146
4150
  const ghsas = arrays.arrayUnique([...utils.cmdFlagValueToArray(cli.flags['id']), ...utils.cmdFlagValueToArray(cli.flags['ghsa']), ...utils.cmdFlagValueToArray(cli.flags['purl'])]);
4147
4151
  await handleFix({
4148
4152
  autopilot,
4153
+ dontApplyFixes,
4149
4154
  cwd,
4150
4155
  ghsas,
4151
4156
  glob,
@@ -4157,7 +4162,6 @@ async function run$K(argv, importMeta, {
4157
4162
  rangeStyle,
4158
4163
  spinner,
4159
4164
  unknownFlags,
4160
- onlyCompute,
4161
4165
  outputFile
4162
4166
  });
4163
4167
  }
@@ -4323,8 +4327,8 @@ async function run$J(argv, importMeta, {
4323
4327
  const cli = utils.meowOrExit({
4324
4328
  argv,
4325
4329
  config: config$h,
4326
- importMeta,
4327
- parentName
4330
+ parentName,
4331
+ importMeta
4328
4332
  });
4329
4333
  const dryRun = !!cli.flags['dryRun'];
4330
4334
  if (dryRun) {
@@ -4343,20 +4347,22 @@ const cmdInstall = {
4343
4347
  parentName
4344
4348
  }) {
4345
4349
  await utils.meowWithSubcommands({
4346
- completion: cmdInstallCompletion
4347
- }, {
4348
4350
  argv,
4349
- description: description$y,
4351
+ name: `${parentName} install`,
4350
4352
  importMeta,
4351
- name: `${parentName} install`
4353
+ subcommands: {
4354
+ completion: cmdInstallCompletion
4355
+ }
4356
+ }, {
4357
+ description: description$y
4352
4358
  });
4353
4359
  }
4354
4360
  };
4355
4361
 
4356
4362
  async function outputCmdJson(cwd) {
4357
- logger.logger.info('Target cwd:', constants.default.ENV.VITEST ? '<redacted>' : utils.tildify(cwd));
4363
+ logger.logger.info('Target cwd:', constants.default.ENV.VITEST ? constants.REDACTED : utils.tildify(cwd));
4358
4364
  const sockJsonPath = path.join(cwd, constants.SOCKET_JSON);
4359
- const tildeSockJsonPath = constants.default.ENV.VITEST ? '<redacted>' : utils.tildify(sockJsonPath);
4365
+ const tildeSockJsonPath = constants.default.ENV.VITEST ? constants.REDACTED : utils.tildify(sockJsonPath);
4360
4366
  if (!fs$1.existsSync(sockJsonPath)) {
4361
4367
  logger.logger.fail(`Not found: ${tildeSockJsonPath}`);
4362
4368
  process.exitCode = 1;
@@ -4406,8 +4412,8 @@ async function run$I(argv, importMeta, {
4406
4412
  const cli = utils.meowOrExit({
4407
4413
  argv,
4408
4414
  config: config$g,
4409
- importMeta,
4410
- parentName
4415
+ parentName,
4416
+ importMeta
4411
4417
  });
4412
4418
  let [cwd = '.'] = cli.input;
4413
4419
  // Note: path.resolve vs .join:
@@ -4544,7 +4550,7 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
4544
4550
  try {
4545
4551
  applyLogin(apiToken, enforcedOrgs, apiBaseUrl, apiProxy);
4546
4552
  logger.logger.success(`API credentials ${previousPersistedToken === apiToken ? 'refreshed' : previousPersistedToken ? 'updated' : 'set'}`);
4547
- if (utils.isReadOnlyConfig()) {
4553
+ if (utils.isConfigFromFlag()) {
4548
4554
  logger.logger.log('');
4549
4555
  logger.logger.warn('Note: config is in read-only mode, at least one key was overridden through flag/env, so the login was not persisted!');
4550
4556
  }
@@ -4602,8 +4608,8 @@ async function run$H(argv, importMeta, {
4602
4608
  const cli = utils.meowOrExit({
4603
4609
  argv,
4604
4610
  config,
4605
- importMeta,
4606
- parentName
4611
+ parentName,
4612
+ importMeta
4607
4613
  });
4608
4614
  const dryRun = !!cli.flags['dryRun'];
4609
4615
  if (dryRun) {
@@ -4631,7 +4637,7 @@ function attemptLogout() {
4631
4637
  try {
4632
4638
  applyLogout();
4633
4639
  logger.logger.success('Successfully logged out');
4634
- if (utils.isReadOnlyConfig()) {
4640
+ if (utils.isConfigFromFlag()) {
4635
4641
  logger.logger.log('');
4636
4642
  logger.logger.warn('Note: config is in read-only mode, at least one key was overridden through flag/env, so the logout was not persisted!');
4637
4643
  }
@@ -6303,15 +6309,19 @@ async function run$y(argv, importMeta, {
6303
6309
  parentName
6304
6310
  }) {
6305
6311
  await utils.meowWithSubcommands({
6306
- auto: cmdManifestAuto,
6307
- cdxgen: cmdManifestCdxgen,
6308
- conda: cmdManifestConda,
6309
- gradle: cmdManifestGradle,
6310
- kotlin: cmdManifestKotlin,
6311
- scala: cmdManifestScala,
6312
- setup: cmdManifestSetup
6313
- }, {
6314
6312
  argv,
6313
+ name: `${parentName} ${config$7.commandName}`,
6314
+ importMeta,
6315
+ subcommands: {
6316
+ auto: cmdManifestAuto,
6317
+ cdxgen: cmdManifestCdxgen,
6318
+ conda: cmdManifestConda,
6319
+ gradle: cmdManifestGradle,
6320
+ kotlin: cmdManifestKotlin,
6321
+ scala: cmdManifestScala,
6322
+ setup: cmdManifestSetup
6323
+ }
6324
+ }, {
6315
6325
  aliases: {
6316
6326
  yolo: {
6317
6327
  description: config$7.description,
@@ -6320,9 +6330,7 @@ async function run$y(argv, importMeta, {
6320
6330
  }
6321
6331
  },
6322
6332
  description: config$7.description,
6323
- importMeta,
6324
- flags: config$7.flags,
6325
- name: `${parentName} ${config$7.commandName}`
6333
+ flags: config$7.flags
6326
6334
  });
6327
6335
  }
6328
6336
 
@@ -6443,8 +6451,8 @@ async function run$w(argv, importMeta, {
6443
6451
  const cli = utils.meowOrExit({
6444
6452
  argv,
6445
6453
  config,
6446
- importMeta,
6447
- parentName
6454
+ parentName,
6455
+ importMeta
6448
6456
  });
6449
6457
  const dryRun = !!cli.flags['dryRun'];
6450
6458
  if (dryRun) {
@@ -6502,8 +6510,8 @@ async function run$v(argv, importMeta, {
6502
6510
  const cli = utils.meowOrExit({
6503
6511
  argv,
6504
6512
  config: config$6,
6505
- importMeta,
6506
- parentName
6513
+ parentName,
6514
+ importMeta
6507
6515
  });
6508
6516
  const {
6509
6517
  json,
@@ -7405,6 +7413,7 @@ async function handleOptimize({
7405
7413
  prod
7406
7414
  });
7407
7415
  if (!pkgEnvCResult.ok) {
7416
+ process.exitCode = pkgEnvCResult.code ?? 1;
7408
7417
  require$$9.debugFn('warn', 'Package environment validation failed');
7409
7418
  require$$9.debugDir('inspect', {
7410
7419
  pkgEnvCResult
@@ -7414,6 +7423,7 @@ async function handleOptimize({
7414
7423
  }
7415
7424
  const pkgEnvDetails = pkgEnvCResult.data;
7416
7425
  if (!pkgEnvDetails) {
7426
+ process.exitCode = 1;
7417
7427
  require$$9.debugFn('warn', 'No package environment details found');
7418
7428
  await outputOptimizeResult({
7419
7429
  ok: false,
@@ -7431,6 +7441,7 @@ async function handleOptimize({
7431
7441
  agentVersion
7432
7442
  } = pkgEnvDetails;
7433
7443
  if (agent === VLT) {
7444
+ process.exitCode = 1;
7434
7445
  require$$9.debugFn('warn', `${agent} does not support overrides`);
7435
7446
  await outputOptimizeResult({
7436
7447
  ok: false,
@@ -7445,6 +7456,9 @@ async function handleOptimize({
7445
7456
  pin,
7446
7457
  prod
7447
7458
  });
7459
+ if (!optimizationResult.ok) {
7460
+ process.exitCode = optimizationResult.code ?? 1;
7461
+ }
7448
7462
  require$$9.debugFn('notice', `Optimization ${optimizationResult.ok ? 'succeeded' : 'failed'}`);
7449
7463
  require$$9.debugDir('inspect', {
7450
7464
  optimizationResult
@@ -7685,8 +7699,8 @@ async function run$t(argv, importMeta, {
7685
7699
  const cli = utils.meowOrExit({
7686
7700
  argv,
7687
7701
  config,
7688
- importMeta,
7689
- parentName
7702
+ parentName,
7703
+ importMeta
7690
7704
  });
7691
7705
  const {
7692
7706
  json,
@@ -7821,8 +7835,8 @@ async function run$s(argv, importMeta, {
7821
7835
  const cli = utils.meowOrExit({
7822
7836
  argv,
7823
7837
  config,
7824
- importMeta,
7825
- parentName
7838
+ parentName,
7839
+ importMeta
7826
7840
  });
7827
7841
  const {
7828
7842
  json,
@@ -7957,8 +7971,8 @@ async function run$r(argv, importMeta, {
7957
7971
  const cli = utils.meowOrExit({
7958
7972
  argv,
7959
7973
  config,
7960
- importMeta,
7961
- parentName
7974
+ parentName,
7975
+ importMeta
7962
7976
  });
7963
7977
  const {
7964
7978
  json,
@@ -8090,8 +8104,8 @@ async function run$q(argv, importMeta, {
8090
8104
  const cli = utils.meowOrExit({
8091
8105
  argv,
8092
8106
  config,
8093
- importMeta,
8094
- parentName
8107
+ parentName,
8108
+ importMeta
8095
8109
  });
8096
8110
  const {
8097
8111
  json,
@@ -8133,15 +8147,16 @@ const cmdOrganizationPolicy = {
8133
8147
  parentName
8134
8148
  }) {
8135
8149
  await utils.meowWithSubcommands({
8136
- security: cmdOrganizationPolicySecurity,
8137
- license: cmdOrganizationPolicyLicense
8138
- }, {
8139
8150
  argv,
8140
- description: description$p,
8141
- defaultSub: 'list',
8142
- // Backwards compat
8151
+ name: `${parentName} policy`,
8143
8152
  importMeta,
8144
- name: `${parentName} policy`
8153
+ subcommands: {
8154
+ security: cmdOrganizationPolicySecurity,
8155
+ license: cmdOrganizationPolicyLicense
8156
+ }
8157
+ }, {
8158
+ description: description$p,
8159
+ defaultSub: 'list' // Backwards compat
8145
8160
  });
8146
8161
  }
8147
8162
  };
@@ -8222,8 +8237,8 @@ async function run$p(argv, importMeta, {
8222
8237
  const cli = utils.meowOrExit({
8223
8238
  argv,
8224
8239
  config: config$5,
8225
- importMeta,
8226
- parentName
8240
+ parentName,
8241
+ importMeta
8227
8242
  });
8228
8243
  const dryRun = !!cli.flags['dryRun'];
8229
8244
  const json = Boolean(cli.flags['json']);
@@ -8259,10 +8274,15 @@ const cmdOrganization = {
8259
8274
  parentName
8260
8275
  }) {
8261
8276
  await utils.meowWithSubcommands({
8262
- dependencies: cmdOrganizationDependencies,
8263
- list: cmdOrganizationList,
8264
- quota: cmdOrganizationQuota,
8265
- policy: cmdOrganizationPolicy
8277
+ argv,
8278
+ name: `${parentName} organization`,
8279
+ importMeta,
8280
+ subcommands: {
8281
+ dependencies: cmdOrganizationDependencies,
8282
+ list: cmdOrganizationList,
8283
+ quota: cmdOrganizationQuota,
8284
+ policy: cmdOrganizationPolicy
8285
+ }
8266
8286
  }, {
8267
8287
  aliases: {
8268
8288
  deps: {
@@ -8281,10 +8301,7 @@ const cmdOrganization = {
8281
8301
  argv: ['policy', 'security']
8282
8302
  }
8283
8303
  },
8284
- argv,
8285
- description: description$o,
8286
- importMeta,
8287
- name: `${parentName} organization`
8304
+ description: description$o
8288
8305
  });
8289
8306
  }
8290
8307
  };
@@ -9020,8 +9037,13 @@ const cmdPackage = {
9020
9037
  parentName
9021
9038
  }) {
9022
9039
  await utils.meowWithSubcommands({
9023
- score: cmdPackageScore,
9024
- shallow: cmdPackageShallow
9040
+ argv,
9041
+ name: `${parentName} package`,
9042
+ importMeta,
9043
+ subcommands: {
9044
+ score: cmdPackageScore,
9045
+ shallow: cmdPackageShallow
9046
+ }
9025
9047
  }, {
9026
9048
  aliases: {
9027
9049
  deep: {
@@ -9030,10 +9052,7 @@ const cmdPackage = {
9030
9052
  argv: ['score']
9031
9053
  }
9032
9054
  },
9033
- argv,
9034
- description: description$l,
9035
- importMeta,
9036
- name: `${parentName} package`
9055
+ description: description$l
9037
9056
  });
9038
9057
  }
9039
9058
  };
@@ -9299,7 +9318,22 @@ async function processFilePatch(pkgPath, fileName, fileInfo, socketDir, options)
9299
9318
  let result = true;
9300
9319
  try {
9301
9320
  await fs$1.promises.copyFile(blobPath, filepath);
9302
- logger.logger.success(`Patch applied successfully`);
9321
+
9322
+ // Verify the hash after copying to ensure file integrity.
9323
+ const verifyHashResult = await computeSHA256(filepath);
9324
+ if (!verifyHashResult.ok) {
9325
+ logger.logger.error(`Failed to verify hash after patch: ${verifyHashResult.cause || verifyHashResult.message}`);
9326
+ result = false;
9327
+ } else if (verifyHashResult.data !== fileInfo.afterHash) {
9328
+ logger.logger.error(`Hash verification failed after patch`);
9329
+ logger.logger.group();
9330
+ logger.logger.log(`Expected: ${fileInfo.afterHash}`);
9331
+ logger.logger.log(`Got: ${verifyHashResult.data}`);
9332
+ logger.logger.groupEnd();
9333
+ result = false;
9334
+ } else {
9335
+ logger.logger.success(`Patch applied successfully`);
9336
+ }
9303
9337
  } catch (e) {
9304
9338
  logger.logger.error('Error applying patch');
9305
9339
  require$$9.debugDir('error', e);
@@ -9442,11 +9476,12 @@ async function run$m(argv, importMeta, {
9442
9476
  `
9443
9477
  };
9444
9478
  const cli = utils.meowOrExit({
9445
- allowUnknownFlags: false,
9446
9479
  argv,
9447
9480
  config,
9448
- importMeta,
9449
- parentName
9481
+ parentName,
9482
+ importMeta
9483
+ }, {
9484
+ allowUnknownFlags: false
9450
9485
  });
9451
9486
  const {
9452
9487
  dryRun,
@@ -9535,8 +9570,8 @@ async function run$l(argv, importMeta, context) {
9535
9570
  const cli = utils.meowOrExit({
9536
9571
  argv,
9537
9572
  config,
9538
- importMeta,
9539
- parentName
9573
+ parentName,
9574
+ importMeta
9540
9575
  });
9541
9576
  const dryRun = !!cli.flags['dryRun'];
9542
9577
  if (dryRun) {
@@ -9612,8 +9647,8 @@ async function run$k(argv, importMeta, {
9612
9647
  const cli = utils.meowOrExit({
9613
9648
  argv,
9614
9649
  config: config$4,
9615
- importMeta,
9616
- parentName
9650
+ parentName,
9651
+ importMeta
9617
9652
  });
9618
9653
  const dryRun = !!cli.flags['dryRun'];
9619
9654
  if (dryRun) {
@@ -9678,8 +9713,8 @@ async function run$j(argv, importMeta, {
9678
9713
  const cli = utils.meowOrExit({
9679
9714
  argv,
9680
9715
  config: config$3,
9681
- importMeta,
9682
- parentName
9716
+ parentName,
9717
+ importMeta
9683
9718
  });
9684
9719
  const dryRun = !!cli.flags['dryRun'];
9685
9720
  if (dryRun) {
@@ -9839,8 +9874,8 @@ async function run$i(argv, importMeta, {
9839
9874
  const cli = utils.meowOrExit({
9840
9875
  argv,
9841
9876
  config,
9842
- importMeta,
9843
- parentName
9877
+ parentName,
9878
+ importMeta
9844
9879
  });
9845
9880
  const {
9846
9881
  json,
@@ -9975,8 +10010,8 @@ async function run$h(argv, importMeta, {
9975
10010
  const cli = utils.meowOrExit({
9976
10011
  argv,
9977
10012
  config,
9978
- importMeta,
9979
- parentName
10013
+ parentName,
10014
+ importMeta
9980
10015
  });
9981
10016
  const {
9982
10017
  json,
@@ -10268,8 +10303,8 @@ async function run$g(argv, importMeta, {
10268
10303
  const cli = utils.meowOrExit({
10269
10304
  argv,
10270
10305
  config,
10271
- importMeta,
10272
- parentName
10306
+ parentName,
10307
+ importMeta
10273
10308
  });
10274
10309
  const {
10275
10310
  all,
@@ -10466,8 +10501,8 @@ async function run$f(argv, importMeta, {
10466
10501
  const cli = utils.meowOrExit({
10467
10502
  argv,
10468
10503
  config,
10469
- importMeta,
10470
- parentName
10504
+ parentName,
10505
+ importMeta
10471
10506
  });
10472
10507
  const {
10473
10508
  json,
@@ -10628,8 +10663,8 @@ async function run$e(argv, importMeta, {
10628
10663
  const cli = utils.meowOrExit({
10629
10664
  argv,
10630
10665
  config,
10631
- importMeta,
10632
- parentName
10666
+ parentName,
10667
+ importMeta
10633
10668
  });
10634
10669
  const {
10635
10670
  json,
@@ -10687,16 +10722,18 @@ const cmdRepository = {
10687
10722
  parentName
10688
10723
  }) {
10689
10724
  await utils.meowWithSubcommands({
10690
- create: cmdRepositoryCreate,
10691
- view: cmdRepositoryView,
10692
- list: cmdRepositoryList,
10693
- del: cmdRepositoryDel,
10694
- update: cmdRepositoryUpdate
10695
- }, {
10696
10725
  argv,
10697
- description: description$d,
10726
+ name: `${parentName} repository`,
10698
10727
  importMeta,
10699
- name: `${parentName} repository`
10728
+ subcommands: {
10729
+ create: cmdRepositoryCreate,
10730
+ view: cmdRepositoryView,
10731
+ list: cmdRepositoryList,
10732
+ del: cmdRepositoryDel,
10733
+ update: cmdRepositoryUpdate
10734
+ }
10735
+ }, {
10736
+ description: description$d
10700
10737
  });
10701
10738
  }
10702
10739
  };
@@ -10918,8 +10955,8 @@ async function run$d(argv, importMeta, {
10918
10955
  const cli = utils.meowOrExit({
10919
10956
  argv,
10920
10957
  config,
10921
- importMeta,
10922
- parentName
10958
+ parentName,
10959
+ importMeta
10923
10960
  });
10924
10961
  const {
10925
10962
  commitHash,
@@ -13565,8 +13602,8 @@ async function run$5(argv, importMeta, {
13565
13602
  const cli = utils.meowOrExit({
13566
13603
  argv,
13567
13604
  config: config$2,
13568
- importMeta,
13569
- parentName
13605
+ parentName,
13606
+ importMeta
13570
13607
  });
13571
13608
  const dryRun = !!cli.flags['dryRun'];
13572
13609
  if (dryRun) {
@@ -13833,16 +13870,21 @@ const cmdScan = {
13833
13870
  parentName
13834
13871
  }) {
13835
13872
  await utils.meowWithSubcommands({
13836
- create: cmdScanCreate,
13837
- del: cmdScanDel,
13838
- diff: cmdScanDiff,
13839
- github: cmdScanGithub,
13840
- list: cmdScanList,
13841
- metadata: cmdScanMetadata,
13842
- reach: cmdScanReach,
13843
- report: cmdScanReport,
13844
- setup: cmdScanSetup,
13845
- view: cmdScanView
13873
+ argv,
13874
+ name: `${parentName} scan`,
13875
+ importMeta,
13876
+ subcommands: {
13877
+ create: cmdScanCreate,
13878
+ del: cmdScanDel,
13879
+ diff: cmdScanDiff,
13880
+ github: cmdScanGithub,
13881
+ list: cmdScanList,
13882
+ metadata: cmdScanMetadata,
13883
+ reach: cmdScanReach,
13884
+ report: cmdScanReport,
13885
+ setup: cmdScanSetup,
13886
+ view: cmdScanView
13887
+ }
13846
13888
  }, {
13847
13889
  aliases: {
13848
13890
  meta: {
@@ -13856,10 +13898,7 @@ const cmdScan = {
13856
13898
  argv: ['reach']
13857
13899
  }
13858
13900
  },
13859
- argv,
13860
- description: description$3,
13861
- importMeta,
13862
- name: `${parentName} scan`
13901
+ description: description$3
13863
13902
  });
13864
13903
  }
13865
13904
  };
@@ -14384,8 +14423,8 @@ async function run$2(argv, importMeta, {
14384
14423
  const cli = utils.meowOrExit({
14385
14424
  argv,
14386
14425
  config: config$1,
14387
- importMeta,
14388
- parentName
14426
+ parentName,
14427
+ importMeta
14389
14428
  });
14390
14429
  const dryRun = !!cli.flags['dryRun'];
14391
14430
  if (dryRun) {
@@ -14404,12 +14443,14 @@ const cmdUninstall = {
14404
14443
  parentName
14405
14444
  }) {
14406
14445
  await utils.meowWithSubcommands({
14407
- completion: cmdUninstallCompletion
14408
- }, {
14409
14446
  argv,
14410
- description: description$1,
14447
+ name: `${parentName} uninstall`,
14411
14448
  importMeta,
14412
- name: `${parentName} uninstall`
14449
+ subcommands: {
14450
+ completion: cmdUninstallCompletion
14451
+ }
14452
+ }, {
14453
+ description: description$1
14413
14454
  });
14414
14455
  }
14415
14456
  };
@@ -14839,13 +14880,15 @@ void (async () => {
14839
14880
  }
14840
14881
  });
14841
14882
  try {
14842
- await utils.meowWithSubcommands(rootCommands, {
14843
- aliases: rootAliases,
14844
- argv: process.argv.slice(2),
14883
+ await utils.meowWithSubcommands({
14845
14884
  name: constants.default.SOCKET_CLI_BIN_NAME,
14885
+ argv: process.argv.slice(2),
14846
14886
  importMeta: {
14847
14887
  url: `${require$$0.pathToFileURL(__filename$1)}`
14848
- }
14888
+ },
14889
+ subcommands: rootCommands
14890
+ }, {
14891
+ aliases: rootAliases
14849
14892
  });
14850
14893
  } catch (e) {
14851
14894
  process.exitCode = 1;
@@ -14902,5 +14945,5 @@ void (async () => {
14902
14945
  await utils.captureException(e);
14903
14946
  }
14904
14947
  })();
14905
- //# debugId=c2710cf0-3d3a-46a7-8ead-88053b9e55be
14948
+ //# debugId=4aa44248-7031-4a9e-8cad-1c9fbaa730ef
14906
14949
  //# sourceMappingURL=cli.js.map