socket 0.14.40-alpha.9 → 0.14.40

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.
@@ -10,6 +10,7 @@ function _socketInterop(e) {
10
10
  return c ? e.default : e
11
11
  }
12
12
 
13
+ var process$1 = require('node:process');
13
14
  var require$$0 = require('node:url');
14
15
  var ponyCause = _socketInterop(require('pony-cause'));
15
16
  var vendor = require('./vendor.js');
@@ -22,7 +23,12 @@ var words = require('@socketsecurity/registry/lib/words');
22
23
  var constants = require('./constants.js');
23
24
  var spinner = require('@socketsecurity/registry/lib/spinner');
24
25
  var spawn = _socketInterop(require('@npmcli/promise-spawn'));
25
- var sdk = require('./sdk.js');
26
+ var objects = require('@socketsecurity/registry/lib/objects');
27
+ var pathResolve = require('./path-resolve.js');
28
+ var registryConstants = require('@socketsecurity/registry/lib/constants');
29
+ var socketUrl = require('./socket-url.js');
30
+ var terminalLink = _socketInterop(require('terminal-link'));
31
+ var isInteractive = require('@socketregistry/is-interactive/index.cjs');
26
32
  var prompts = require('@socketsecurity/registry/lib/prompts');
27
33
  var fs$1 = require('node:fs/promises');
28
34
  var npa = _socketInterop(require('npm-package-arg'));
@@ -30,20 +36,17 @@ var semver = _socketInterop(require('semver'));
30
36
  var tinyglobby = _socketInterop(require('tinyglobby'));
31
37
  var yaml = _socketInterop(require('yaml'));
32
38
  var registry = require('@socketsecurity/registry');
33
- var objects = require('@socketsecurity/registry/lib/objects');
34
39
  var packages = require('@socketsecurity/registry/lib/packages');
35
40
  var promises = require('@socketsecurity/registry/lib/promises');
36
41
  var regexps = require('@socketsecurity/registry/lib/regexps');
37
42
  var strings = require('@socketsecurity/registry/lib/strings');
38
43
  var browserslist = _socketInterop(require('browserslist'));
39
44
  var which = _socketInterop(require('which'));
40
- var hyrious__bun_lockb = require('@socketregistry/hyrious__bun.lockb');
41
- var pathResolve = require('./path-resolve.js');
45
+ var index_cjs = require('@socketregistry/hyrious__bun.lockb/index.cjs');
42
46
  var betterAjvErrors = _socketInterop(require('@apideck/better-ajv-errors'));
43
47
  var config = require('@socketsecurity/config');
44
48
  var os = require('node:os');
45
49
  var readline = require('node:readline');
46
- var process$1 = require('node:process');
47
50
  var readline$1 = require('node:readline/promises');
48
51
  var chalkTable = _socketInterop(require('chalk-table'));
49
52
  var ScreenWidget = _socketInterop(require('blessed/lib/widgets/screen'));
@@ -54,7 +57,7 @@ var require$$0$1 = require('node:util');
54
57
  var TableWidget = _socketInterop(require('blessed-contrib/lib/widget/table'));
55
58
 
56
59
  const {
57
- NPM: NPM$4,
60
+ NPM: NPM$5,
58
61
  PNPM: PNPM$2,
59
62
  cdxgenBinPath,
60
63
  synpBinPath
@@ -65,10 +68,10 @@ const {
65
68
  SBOM_SIGN_PRIVATE_KEY,
66
69
  // Location to the RSA private key
67
70
  SBOM_SIGN_PUBLIC_KEY // Optional. Location to the RSA public key
68
- } = process.env;
71
+ } = process$1.env;
69
72
  const toLower = arg => arg.toLowerCase();
70
73
  const arrayToLower = arg => arg.map(toLower);
71
- const nodejsPlatformTypes = new Set(['javascript', 'js', 'nodejs', NPM$4, PNPM$2, 'ts', 'tsx', 'typescript']);
74
+ const nodejsPlatformTypes = new Set(['javascript', 'js', 'nodejs', NPM$5, PNPM$2, 'ts', 'tsx', 'typescript']);
72
75
  const yargsConfig = {
73
76
  configuration: {
74
77
  'camel-case-expansion': false,
@@ -172,20 +175,20 @@ const cdxgen = {
172
175
  length: unknownLength
173
176
  } = unknown;
174
177
  if (unknownLength) {
175
- process.exitCode = 1;
178
+ process$1.exitCode = 1;
176
179
  console.error(`Unknown ${words.pluralize('argument', unknownLength)}: ${yargv._.join(', ')}`);
177
180
  return;
178
181
  }
179
182
  let cleanupPackageLock = false;
180
183
  if (yargv.type !== 'yarn' && nodejsPlatformTypes.has(yargv.type) && fs.existsSync('./yarn.lock')) {
181
184
  if (fs.existsSync('./package-lock.json')) {
182
- yargv.type = NPM$4;
185
+ yargv.type = NPM$5;
183
186
  } else {
184
187
  // Use synp to create a package-lock.json from the yarn.lock,
185
188
  // based on the node_modules folder, for a more accurate SBOM.
186
189
  try {
187
190
  await npm$1.runBin(await fs.promises.realpath(synpBinPath), ['--source-file', './yarn.lock']);
188
- yargv.type = NPM$4;
191
+ yargv.type = NPM$5;
189
192
  cleanupPackageLock = true;
190
193
  } catch {}
191
194
  }
@@ -207,7 +210,7 @@ const cdxgen = {
207
210
  await fs.promises.rm('./package-lock.json');
208
211
  } catch {}
209
212
  }
210
- const fullOutputPath = path.join(process.cwd(), yargv.output);
213
+ const fullOutputPath = path.join(process$1.cwd(), yargv.output);
211
214
  if (fs.existsSync(fullOutputPath)) {
212
215
  console.log(colors.cyanBright(`${yargv.output} created!`));
213
216
  }
@@ -217,45 +220,62 @@ const cdxgen = {
217
220
  const {
218
221
  abortSignal: abortSignal$3
219
222
  } = constants;
220
- async function shadowNpmInstall(opts) {
223
+ function shadowNpmInstall(opts) {
221
224
  const {
222
225
  flags = [],
226
+ ipc,
223
227
  ...spawnOptions
224
228
  } = {
225
229
  __proto__: null,
226
230
  ...opts
227
231
  };
228
- // Lazily access constants.ENV.
229
- const {
230
- SOCKET_CLI_DEBUG
231
- } = constants.ENV;
232
- return await spawn(
232
+ const useIpc = objects.isObject(ipc);
233
+ const useDebug = pathResolve.isDebug();
234
+ const promise = spawn(
233
235
  // Lazily access constants.execPath.
234
236
  constants.execPath, [
235
237
  // Lazily access constants.rootBinPath.
236
- path.join(constants.rootBinPath, 'npm-cli.js'), 'install', ...(SOCKET_CLI_DEBUG ? ['silent'] : []), ...flags], {
238
+ path.join(constants.rootBinPath, 'npm-cli.js'), 'install',
239
+ // Even though the 'silent' flag is passed npm will still run through code
240
+ // paths for 'audit' and 'fund' unless '--no-audit' and '--no-fund' flags
241
+ // are passed.
242
+ ...(useDebug ? ['--no-audit', '--no-fund'] : ['silent', '--no-audit', '--no-fund']), ...flags], {
237
243
  signal: abortSignal$3,
238
- // Lazily access constants.ENV.
239
- stdio: SOCKET_CLI_DEBUG ? 'inherit' : 'ignore',
244
+ // Set stdio to include 'ipc'.
245
+ // See https://github.com/nodejs/node/blob/v23.6.0/lib/child_process.js#L161-L166
246
+ // and https://github.com/nodejs/node/blob/v23.6.0/lib/internal/child_process.js#L238.
247
+ stdio: useDebug ?
248
+ // 'inherit'
249
+ useIpc ? [0, 1, 2, 'ipc'] : 'inherit' :
250
+ // 'ignore'
251
+ useIpc ? ['ignore', 'ignore', 'ignore', 'ipc'] : 'ignore',
240
252
  ...spawnOptions,
241
253
  env: {
242
- ...process.env,
254
+ ...process$1.env,
243
255
  ...spawnOptions.env
244
256
  }
245
257
  });
258
+ if (useIpc) {
259
+ promise.process.send(ipc);
260
+ }
261
+ return promise;
246
262
  }
247
263
 
248
264
  const {
249
- SOCKET_CLI_FIX_PACKAGE_LOCK_FILE
265
+ SOCKET_CLI_FIX_PACKAGE_LOCK_FILE,
266
+ SOCKET_IPC_HANDSHAKE: SOCKET_IPC_HANDSHAKE$1
250
267
  } = constants;
251
268
  const fix = {
252
269
  description: 'Fix "fixable" Socket alerts',
270
+ hidden: true,
253
271
  async run() {
254
272
  const spinner$1 = new spinner.Spinner().start();
255
273
  try {
256
274
  await shadowNpmInstall({
257
- env: {
258
- [SOCKET_CLI_FIX_PACKAGE_LOCK_FILE]: '1'
275
+ ipc: {
276
+ [SOCKET_IPC_HANDSHAKE$1]: {
277
+ [SOCKET_CLI_FIX_PACKAGE_LOCK_FILE]: true
278
+ }
259
279
  }
260
280
  });
261
281
  } catch (e) {
@@ -322,10 +342,10 @@ function handleUnsuccessfulApiResponse(_name, result, spinner) {
322
342
  const message = typeof resultErrorMessage === 'string' ? resultErrorMessage : 'No error message returned';
323
343
  if (result.status === 401 || result.status === 403) {
324
344
  spinner.stop();
325
- throw new sdk.AuthError(message);
345
+ throw new socketUrl.AuthError(message);
326
346
  }
327
347
  spinner.error(`${colors.bgRed(colors.white('API returned an error:'))} ${message}`);
328
- process.exit(1);
348
+ process$1.exit(1);
329
349
  }
330
350
  async function handleApiCall(value, description) {
331
351
  let result;
@@ -370,6 +390,46 @@ function pick(input, keys) {
370
390
  return result;
371
391
  }
372
392
 
393
+ function getFlagListOutput(list, indent, {
394
+ keyPrefix = '--',
395
+ padName
396
+ } = {}) {
397
+ return getHelpListOutput({
398
+ ...list
399
+ }, indent, {
400
+ keyPrefix,
401
+ padName
402
+ });
403
+ }
404
+ function getHelpListOutput(list, indent, {
405
+ keyPrefix = '',
406
+ padName = 18
407
+ } = {}) {
408
+ let result = '';
409
+ const names = Object.keys(list).sort();
410
+ for (const name of names) {
411
+ const rawDescription = list[name];
412
+ const description = (typeof rawDescription === 'object' ? rawDescription.description : rawDescription) || '';
413
+ result += ''.padEnd(indent) + (keyPrefix + name).padEnd(padName) + description + '\n';
414
+ }
415
+ return result.trim();
416
+ }
417
+
418
+ function stringJoinWithSeparateFinalSeparator(list, separator = ' and ') {
419
+ const values = list.filter(Boolean);
420
+ const {
421
+ length
422
+ } = values;
423
+ if (!length) {
424
+ return '';
425
+ }
426
+ if (length === 1) {
427
+ return values[0];
428
+ }
429
+ const finalValue = values.pop();
430
+ return `${values.join(', ')}${separator}${finalValue}`;
431
+ }
432
+
373
433
  const SEVERITIES_BY_ORDER = ['critical', 'high', 'middle', 'low'];
374
434
  function getDesiredSeverities(lowestToInclude) {
375
435
  const result = [];
@@ -388,7 +448,7 @@ function formatSeverityCount(severityCount) {
388
448
  summary.push(`${severityCount[severity]} ${severity}`);
389
449
  }
390
450
  }
391
- return sdk.stringJoinWithSeparateFinalSeparator(summary);
451
+ return stringJoinWithSeparateFinalSeparator(summary);
392
452
  }
393
453
  function getSeverityCount(issues, lowestToInclude) {
394
454
  const severityCount = pick({
@@ -398,7 +458,9 @@ function getSeverityCount(issues, lowestToInclude) {
398
458
  critical: 0
399
459
  }, getDesiredSeverities(lowestToInclude));
400
460
  for (const issue of issues) {
401
- const value = issue.value;
461
+ const {
462
+ value
463
+ } = issue;
402
464
  if (!value) {
403
465
  continue;
404
466
  }
@@ -409,34 +471,9 @@ function getSeverityCount(issues, lowestToInclude) {
409
471
  return severityCount;
410
472
  }
411
473
 
412
- function printFlagList(list, indent, {
413
- keyPrefix = '--',
414
- padName
415
- } = {}) {
416
- return printHelpList({
417
- ...list
418
- }, indent, {
419
- keyPrefix,
420
- padName
421
- });
422
- }
423
- function printHelpList(list, indent, {
424
- keyPrefix = '',
425
- padName = 18
426
- } = {}) {
427
- let result = '';
428
- const names = Object.keys(list).sort();
429
- for (const name of names) {
430
- const rawDescription = list[name];
431
- const description = (typeof rawDescription === 'object' ? rawDescription.description : rawDescription) || '';
432
- result += ''.padEnd(indent) + (keyPrefix + name).padEnd(padName) + description + '\n';
433
- }
434
- return result.trim();
435
- }
436
-
437
474
  const {
438
- SOCKET_PUBLIC_API_KEY: SOCKET_PUBLIC_API_KEY$1
439
- } = constants;
475
+ NPM: NPM$4
476
+ } = registryConstants;
440
477
  const info = {
441
478
  description: 'Look up info regarding a package',
442
479
  async run(argv, importMeta, {
@@ -473,7 +510,7 @@ function setupCommand$m(name, description, argv, importMeta) {
473
510
  $ ${name} <name>
474
511
 
475
512
  Options
476
- ${printFlagList(flags, 6)}
513
+ ${getFlagListOutput(flags, 6)}
477
514
 
478
515
  Examples
479
516
  $ ${name} webtorrent
@@ -485,7 +522,7 @@ function setupCommand$m(name, description, argv, importMeta) {
485
522
  flags
486
523
  });
487
524
  if (cli.input.length > 1) {
488
- throw new sdk.InputError('Only one package lookup supported at once');
525
+ throw new socketUrl.InputError('Only one package lookup supported at once');
489
526
  }
490
527
  const {
491
528
  0: rawPkgName = ''
@@ -513,7 +550,7 @@ function setupCommand$m(name, description, argv, importMeta) {
513
550
  async function fetchPackageData(pkgName, pkgVersion, {
514
551
  includeAllIssues
515
552
  }, spinner) {
516
- const socketSdk = await sdk.setupSdk(sdk.getDefaultKey() ?? SOCKET_PUBLIC_API_KEY$1);
553
+ const socketSdk = await socketUrl.setupSdk(socketUrl.getPublicToken());
517
554
  const result = await handleApiCall(socketSdk.getIssuesByNPMPackage(pkgName, pkgVersion), 'looking up package');
518
555
  const scoreResult = await handleApiCall(socketSdk.getScoreByNPMPackage(pkgName, pkgVersion), 'looking up package score');
519
556
  if (result.success === false) {
@@ -560,8 +597,8 @@ function formatPackageDataOutput({
560
597
  } else {
561
598
  spinner.success('Package has no issues');
562
599
  }
563
- const format = new sdk.ColorOrMarkdown(!!outputMarkdown);
564
- const url = `https://socket.dev/npm/package/${pkgName}/overview/${pkgVersion}`;
600
+ const format = new socketUrl.ColorOrMarkdown(!!outputMarkdown);
601
+ const url = socketUrl.getSocketDevPackageOverviewUrl(NPM$4, pkgName, pkgVersion);
565
602
  console.log('\n');
566
603
  if (pkgVersion === 'latest') {
567
604
  console.log(`Detailed info on socket.dev: ${format.hyperlink(`${pkgName}`, url, {
@@ -577,7 +614,7 @@ function formatPackageDataOutput({
577
614
  }
578
615
  }
579
616
  if (strict && objectSome(severityCount)) {
580
- process.exit(1);
617
+ process$1.exit(1);
581
618
  }
582
619
  }
583
620
  function formatPackageIssuesDetails(packageData, outputMarkdown) {
@@ -598,9 +635,9 @@ function formatPackageIssuesDetails(packageData, outputMarkdown) {
598
635
  }
599
636
  return acc;
600
637
  }, {});
601
- const format = new sdk.ColorOrMarkdown(!!outputMarkdown);
638
+ const format = new socketUrl.ColorOrMarkdown(!!outputMarkdown);
602
639
  for (const issue of Object.keys(uniqueIssues)) {
603
- const issueWithLink = format.hyperlink(`${uniqueIssues[issue]?.label}`, `https://socket.dev/npm/issue/${issue}`, {
640
+ const issueWithLink = format.hyperlink(`${uniqueIssues[issue]?.label}`, socketUrl.getSocketDevAlertUrl(issue), {
604
641
  fallbackToUrl: true
605
642
  });
606
643
  if (uniqueIssues[issue]?.count === 1) {
@@ -620,7 +657,7 @@ function formatScore(score) {
620
657
  }
621
658
 
622
659
  const {
623
- SOCKET_PUBLIC_API_KEY
660
+ SOCKET_PUBLIC_API_TOKEN
624
661
  } = constants;
625
662
  const description$5 = 'Socket API login';
626
663
  const flags = {
@@ -649,7 +686,7 @@ const login = {
649
686
  Logs into the Socket API by prompting for an API key
650
687
 
651
688
  Options
652
- ${printFlagList({
689
+ ${getFlagListOutput({
653
690
  'api-base-url': flags['apiBaseUrl'].description,
654
691
  'api-proxy': flags['apiProxy'].description
655
692
  }, 8)}
@@ -670,25 +707,25 @@ const login = {
670
707
  cli.showHelp();
671
708
  return;
672
709
  }
673
- if (!vendor.isInteractive()) {
674
- throw new sdk.InputError('Cannot prompt for credentials in a non-interactive shell');
710
+ if (!isInteractive()) {
711
+ throw new socketUrl.InputError('Cannot prompt for credentials in a non-interactive shell');
675
712
  }
676
- const apiKey = (await prompts.password({
677
- message: `Enter your ${vendor.terminalLink('Socket.dev API key', 'https://docs.socket.dev/docs/api-keys')} (leave blank for a public key)`
678
- })) || SOCKET_PUBLIC_API_KEY;
713
+ const apiToken = (await prompts.password({
714
+ message: `Enter your ${terminalLink('Socket.dev API key', 'https://docs.socket.dev/docs/api-keys')} (leave blank for a public key)`
715
+ })) || SOCKET_PUBLIC_API_TOKEN;
679
716
  let apiBaseUrl = cli.flags['apiBaseUrl'];
680
- apiBaseUrl ??= sdk.getSetting('apiBaseUrl') ?? undefined;
717
+ apiBaseUrl ??= socketUrl.getSetting('apiBaseUrl') ?? undefined;
681
718
  let apiProxy = cli.flags['apiProxy'];
682
- apiProxy ??= sdk.getSetting('apiProxy') ?? undefined;
719
+ apiProxy ??= socketUrl.getSetting('apiProxy') ?? undefined;
683
720
  const spinner$1 = new spinner.Spinner({
684
721
  text: 'Verifying API key...'
685
722
  }).start();
686
723
  let orgs;
687
724
  try {
688
- const sdk$1 = await sdk.setupSdk(apiKey, apiBaseUrl, apiProxy);
689
- const result = await sdk$1.getOrganizations();
725
+ const sdk = await socketUrl.setupSdk(apiToken, apiBaseUrl, apiProxy);
726
+ const result = await sdk.getOrganizations();
690
727
  if (!result.success) {
691
- throw new sdk.AuthError();
728
+ throw new socketUrl.AuthError();
692
729
  }
693
730
  orgs = result.data;
694
731
  spinner$1.success('API key verified');
@@ -725,12 +762,13 @@ const login = {
725
762
  }
726
763
  }
727
764
  }
728
- sdk.updateSetting('enforcedOrgs', enforcedOrgs);
729
- const oldKey = sdk.getSetting('apiKey');
730
- sdk.updateSetting('apiKey', apiKey);
731
- sdk.updateSetting('apiBaseUrl', apiBaseUrl);
732
- sdk.updateSetting('apiProxy', apiProxy);
733
- spinner$1.success(`API credentials ${oldKey ? 'updated' : 'set'}`);
765
+ socketUrl.updateSetting('enforcedOrgs', enforcedOrgs);
766
+ // TODO: Rename the 'apiKey' setting to 'apiToken'.
767
+ const oldToken = socketUrl.getSetting('apiKey');
768
+ socketUrl.updateSetting('apiKey', apiToken);
769
+ socketUrl.updateSetting('apiBaseUrl', apiBaseUrl);
770
+ socketUrl.updateSetting('apiProxy', apiProxy);
771
+ spinner$1.success(`API credentials ${oldToken ? 'updated' : 'set'}`);
734
772
  }
735
773
  };
736
774
 
@@ -762,10 +800,10 @@ const logout = {
762
800
  cli.showHelp();
763
801
  return;
764
802
  }
765
- sdk.updateSetting('apiKey', null);
766
- sdk.updateSetting('apiBaseUrl', null);
767
- sdk.updateSetting('apiProxy', null);
768
- sdk.updateSetting('enforcedOrgs', null);
803
+ socketUrl.updateSetting('apiKey', null);
804
+ socketUrl.updateSetting('apiBaseUrl', null);
805
+ socketUrl.updateSetting('apiProxy', null);
806
+ socketUrl.updateSetting('enforcedOrgs', null);
769
807
  new spinner.Spinner().success('Successfully logged out');
770
808
  }
771
809
  };
@@ -801,7 +839,7 @@ function existsSync(filepath) {
801
839
  return false;
802
840
  }
803
841
  async function findUp(name, {
804
- cwd = process.cwd()
842
+ cwd = process$1.cwd()
805
843
  }) {
806
844
  let dir = path.resolve(cwd);
807
845
  const {
@@ -843,6 +881,7 @@ const {
843
881
  NPM: NPM$2,
844
882
  PNPM: PNPM$1,
845
883
  VLT: VLT$1,
884
+ YARN,
846
885
  YARN_BERRY: YARN_BERRY$1,
847
886
  YARN_CLASSIC: YARN_CLASSIC$1
848
887
  } = constants;
@@ -853,10 +892,20 @@ const {
853
892
  numeric: true,
854
893
  sensitivity: 'base'
855
894
  });
895
+ const binByAgent = {
896
+ __proto__: null,
897
+ [BUN$1]: BUN$1,
898
+ [NPM$2]: NPM$2,
899
+ [PNPM$1]: PNPM$1,
900
+ [YARN_BERRY$1]: YARN,
901
+ [YARN_CLASSIC$1]: YARN,
902
+ [VLT$1]: VLT$1
903
+ };
856
904
  async function getAgentExecPath(agent) {
857
- return (await which(agent, {
905
+ const binName = binByAgent[agent];
906
+ return (await which(binName, {
858
907
  nothrow: true
859
- })) ?? agent;
908
+ })) ?? binName;
860
909
  }
861
910
  async function getAgentVersion(agentExecPath, cwd) {
862
911
  let result;
@@ -912,7 +961,7 @@ const readLockFileByAgent = (() => {
912
961
  const lockBuffer = await binaryReader(lockPath);
913
962
  if (lockBuffer) {
914
963
  try {
915
- return hyrious__bun_lockb.parse(lockBuffer);
964
+ return index_cjs.parse(lockBuffer);
916
965
  } catch {}
917
966
  }
918
967
  // To print a Yarn lockfile to your console without writing it to disk
@@ -930,7 +979,7 @@ const readLockFileByAgent = (() => {
930
979
  };
931
980
  })();
932
981
  async function detect({
933
- cwd = process.cwd(),
982
+ cwd = process$1.cwd(),
934
983
  onUnknown
935
984
  } = {}) {
936
985
  let lockPath = await findUp(Object.keys(LOCKS), {
@@ -1041,6 +1090,7 @@ const {
1041
1090
  PNPM,
1042
1091
  RESOLUTIONS,
1043
1092
  SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE,
1093
+ SOCKET_IPC_HANDSHAKE,
1044
1094
  VLT,
1045
1095
  YARN_BERRY,
1046
1096
  YARN_CLASSIC,
@@ -1052,6 +1102,7 @@ const PNPM_FIELD_NAME = PNPM;
1052
1102
  const PNPM_WORKSPACE = `${PNPM}-workspace`;
1053
1103
  const manifestNpmOverrides = registry.getManifestData(NPM$1);
1054
1104
  const getOverridesDataByAgent = {
1105
+ __proto__: null,
1055
1106
  [BUN](pkgJson) {
1056
1107
  const overrides = pkgJson?.[RESOLUTIONS] ?? {};
1057
1108
  return {
@@ -1120,6 +1171,7 @@ const lockIncludesByAgent = (() => {
1120
1171
  `(?<=(?:^\\s*|,\\s*)"?)${escapedName}(?=@)`, 'm').test(lockSrc);
1121
1172
  }
1122
1173
  return {
1174
+ __proto__: null,
1123
1175
  [BUN](lockSrc, name, lockBasename) {
1124
1176
  // This is a bit counterintuitive. When lockBasename ends with a .lockb
1125
1177
  // we treat it as a yarn.lock. When lockBasename ends with a .lock we
@@ -1242,6 +1294,7 @@ const updateManifestByAgent = (() => {
1242
1294
  updatePkgJson(editablePkgJson, RESOLUTIONS, overrides);
1243
1295
  }
1244
1296
  return {
1297
+ __proto__: null,
1245
1298
  [BUN]: updateResolutions,
1246
1299
  [NPM$1]: updateOverrides,
1247
1300
  [PNPM](editablePkgJson, overrides) {
@@ -1303,6 +1356,7 @@ const lsByAgent = (() => {
1303
1356
  return cleanupQueryStdout(stdout);
1304
1357
  }
1305
1358
  return {
1359
+ __proto__: null,
1306
1360
  async [BUN](agentExecPath, cwd) {
1307
1361
  try {
1308
1362
  // Bun does not support filtering by production packages yet.
@@ -1380,6 +1434,7 @@ const depsIncludesByAgent = (() => {
1380
1434
  return stdout.includes(`"${name}"`);
1381
1435
  }
1382
1436
  return {
1437
+ __proto__: null,
1383
1438
  [BUN]: matchHumanStdout,
1384
1439
  [NPM$1]: matchQueryStdout,
1385
1440
  [PNPM]: matchQueryStdout,
@@ -1562,7 +1617,7 @@ async function addOverrides({
1562
1617
  const oldSpec = overrideExists ? overrides[origPkgName] : undefined;
1563
1618
  const depAlias = depAliasMap.get(origPkgName);
1564
1619
  const regSpecStartsLike = `${NPM$1}:${regPkgName}@`;
1565
- let newSpec = `${regSpecStartsLike}^${pin ? version : major}`;
1620
+ let newSpec = `${regSpecStartsLike}${pin ? version : `^${major}`}`;
1566
1621
  let thisVersion = version;
1567
1622
  if (depAlias && type === NPM$1) {
1568
1623
  // With npm one may not set an override for a package that one directly
@@ -1579,7 +1634,7 @@ async function addOverrides({
1579
1634
  if (pin) {
1580
1635
  thisVersion = semver.major(semver.coerce(npa(thisSpec).rawSpec)?.version ?? version) === major ? version : (await packages.fetchPackageManifest(thisSpec))?.version ?? version;
1581
1636
  }
1582
- newSpec = `${regSpecStartsLike}^${pin ? thisVersion : semver.major(thisVersion)}`;
1637
+ newSpec = `${regSpecStartsLike}${pin ? thisVersion : `^${semver.major(thisVersion)}`}`;
1583
1638
  } else {
1584
1639
  newSpec = oldSpec;
1585
1640
  }
@@ -1647,7 +1702,7 @@ const optimize = {
1647
1702
  pin,
1648
1703
  prod
1649
1704
  } = commandContext;
1650
- const cwd = process.cwd();
1705
+ const cwd = process$1.cwd();
1651
1706
  const {
1652
1707
  agent,
1653
1708
  agentExecPath,
@@ -1739,19 +1794,20 @@ const optimize = {
1739
1794
  spinner$1.start(`Updating ${lockName}...`);
1740
1795
  try {
1741
1796
  if (isNpm) {
1742
- await shadowNpmInstall({
1743
- env: {
1744
- [SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE]: '1'
1797
+ const ipc = {
1798
+ [SOCKET_IPC_HANDSHAKE]: {
1799
+ [SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE]: true
1745
1800
  }
1801
+ };
1802
+ await shadowNpmInstall({
1803
+ ipc
1746
1804
  });
1747
1805
  // TODO: This is a temporary workaround for a `npm ci` bug where it
1748
1806
  // will error out after Socket Optimize generates a lock file. More
1749
1807
  // investigation is needed.
1750
1808
  await shadowNpmInstall({
1751
1809
  flags: ['--ignore-scripts', '--package-lock-only'],
1752
- env: {
1753
- [SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE]: '1'
1754
- }
1810
+ ipc
1755
1811
  });
1756
1812
  } else {
1757
1813
  // All package managers support the "install" command.
@@ -1793,7 +1849,7 @@ function setupCommand$l(name, description, argv, importMeta) {
1793
1849
  $ ${name}
1794
1850
 
1795
1851
  Options
1796
- ${printFlagList(flags, 6)}
1852
+ ${getFlagListOutput(flags, 6)}
1797
1853
 
1798
1854
  Examples
1799
1855
  $ ${name}
@@ -1841,14 +1897,14 @@ function setupCommand$k(name, description, argv, importMeta) {
1841
1897
  });
1842
1898
  }
1843
1899
  async function fetchOrganizations() {
1844
- const apiKey = sdk.getDefaultKey();
1900
+ const apiKey = socketUrl.getDefaultToken();
1845
1901
  if (!apiKey) {
1846
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
1902
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
1847
1903
  }
1848
1904
  const spinner$1 = new spinner.Spinner({
1849
1905
  text: 'Fetching organizations...'
1850
1906
  }).start();
1851
- const socketSdk = await sdk.setupSdk(apiKey);
1907
+ const socketSdk = await socketUrl.setupSdk(apiKey);
1852
1908
  const result = await handleApiCall(socketSdk.getOrganizations(), 'looking up organizations');
1853
1909
  if (result.success === false) {
1854
1910
  handleUnsuccessfulApiResponse('getOrganizations', result, spinner$1);
@@ -1888,7 +1944,7 @@ async function setupCommand$j(name, description, argv, importMeta) {
1888
1944
  $ ${name} <${binName$1} command>
1889
1945
 
1890
1946
  Options
1891
- ${printFlagList(flags, 6)}
1947
+ ${getFlagListOutput(flags, 6)}
1892
1948
 
1893
1949
  Examples
1894
1950
  $ ${name} install
@@ -1913,7 +1969,7 @@ async function setupCommand$j(name, description, argv, importMeta) {
1913
1969
  // The exit code 127 indicates that the command or binary being executed
1914
1970
  // could not be found.
1915
1971
  console.error(`Socket unable to locate ${binName$1}; ensure it is available in the PATH environment variable.`);
1916
- process.exit(127);
1972
+ process$1.exit(127);
1917
1973
  }
1918
1974
  const spawnPromise = spawn(binPath, argv, {
1919
1975
  signal: abortSignal$1,
@@ -1925,9 +1981,9 @@ async function setupCommand$j(name, description, argv, importMeta) {
1925
1981
  return;
1926
1982
  }
1927
1983
  if (signalName) {
1928
- process.kill(process.pid, signalName);
1984
+ process$1.kill(process$1.pid, signalName);
1929
1985
  } else if (code !== null) {
1930
- process.exit(code);
1986
+ process$1.exit(code);
1931
1987
  }
1932
1988
  });
1933
1989
  await spawnPromise;
@@ -1956,7 +2012,7 @@ async function setupCommand$i(name, description, argv, importMeta) {
1956
2012
  $ ${name} <${binName} command>
1957
2013
 
1958
2014
  Options
1959
- ${printFlagList(flags, 6)}
2015
+ ${getFlagListOutput(flags, 6)}
1960
2016
 
1961
2017
  Examples
1962
2018
  $ ${name} install
@@ -1981,7 +2037,7 @@ async function setupCommand$i(name, description, argv, importMeta) {
1981
2037
  // The exit code 127 indicates that the command or binary being executed
1982
2038
  // could not be found.
1983
2039
  console.error(`Socket unable to locate ${binName}; ensure it is available in the PATH environment variable.`);
1984
- process.exit(127);
2040
+ process$1.exit(127);
1985
2041
  }
1986
2042
  const spawnPromise = spawn(binPath, argv, {
1987
2043
  signal: abortSignal,
@@ -1993,9 +2049,9 @@ async function setupCommand$i(name, description, argv, importMeta) {
1993
2049
  return;
1994
2050
  }
1995
2051
  if (signalName) {
1996
- process.kill(process.pid, signalName);
2052
+ process$1.kill(process$1.pid, signalName);
1997
2053
  } else if (code !== null) {
1998
- process.exit(code);
2054
+ process$1.exit(code);
1999
2055
  }
2000
2056
  });
2001
2057
  await spawnPromise;
@@ -2031,7 +2087,7 @@ function setupCommand$h(name, description, argv, importMeta) {
2031
2087
  $ ${name} <report-identifier>
2032
2088
 
2033
2089
  Options
2034
- ${printFlagList(flags, 6)}
2090
+ ${getFlagListOutput(flags, 6)}
2035
2091
 
2036
2092
  Examples
2037
2093
  $ ${name} QXU8PmK7LfH608RAwfIKdbcHgwEd_ZeWJ9QEGv05FJUQ
@@ -2053,7 +2109,7 @@ function setupCommand$h(name, description, argv, importMeta) {
2053
2109
  }
2054
2110
  // Validate the input.
2055
2111
  if (extraInput.length) {
2056
- throw new sdk.InputError(`Can only handle a single report ID at a time, but got ${cli.input.length} report ID:s: ${cli.input.join(', ')}`);
2112
+ throw new socketUrl.InputError(`Can only handle a single report ID at a time, but got ${cli.input.length} report ID:s: ${cli.input.join(', ')}`);
2057
2113
  }
2058
2114
  return {
2059
2115
  includeAllIssues: cli.flags['all'],
@@ -2069,7 +2125,7 @@ async function fetchReportData(reportId, {
2069
2125
  strict
2070
2126
  }) {
2071
2127
  // Do the API call
2072
- const socketSdk = await sdk.setupSdk();
2128
+ const socketSdk = await socketUrl.setupSdk();
2073
2129
  const spinner$1 = new spinner.Spinner({
2074
2130
  text: `Fetching report with ID ${reportId} (this could take a while)`
2075
2131
  }).start();
@@ -2115,7 +2171,7 @@ function formatReportDataOutput(data, {
2115
2171
  if (outputJson) {
2116
2172
  console.log(JSON.stringify(data, undefined, 2));
2117
2173
  } else {
2118
- const format = new sdk.ColorOrMarkdown(!!outputMarkdown);
2174
+ const format = new socketUrl.ColorOrMarkdown(!!outputMarkdown);
2119
2175
  console.log('\nDetailed info on socket.dev: ' + format.hyperlink(reportId, data.url, {
2120
2176
  fallbackToUrl: true
2121
2177
  }));
@@ -2124,7 +2180,7 @@ function formatReportDataOutput(data, {
2124
2180
  }
2125
2181
  }
2126
2182
  if (strict && data.healthy === false) {
2127
- process.exit(1);
2183
+ process$1.exit(1);
2128
2184
  }
2129
2185
  }
2130
2186
 
@@ -2139,7 +2195,6 @@ const create$2 = {
2139
2195
  const {
2140
2196
  config,
2141
2197
  cwd,
2142
- debugLog,
2143
2198
  dryRun,
2144
2199
  includeAllIssues,
2145
2200
  outputJson,
@@ -2151,7 +2206,6 @@ const create$2 = {
2151
2206
  const result = input && (await createReport(packagePaths, {
2152
2207
  config,
2153
2208
  cwd,
2154
- debugLog,
2155
2209
  dryRun
2156
2210
  }));
2157
2211
  if (result && view) {
@@ -2187,12 +2241,6 @@ async function setupCommand$g(name, description, argv, importMeta) {
2187
2241
  ...commonFlags,
2188
2242
  ...outputFlags,
2189
2243
  ...validationFlags,
2190
- debug: {
2191
- type: 'boolean',
2192
- shortFlag: 'd',
2193
- default: false,
2194
- description: 'Output debug information'
2195
- },
2196
2244
  dryRun: {
2197
2245
  type: 'boolean',
2198
2246
  default: false,
@@ -2219,9 +2267,8 @@ async function setupCommand$g(name, description, argv, importMeta) {
2219
2267
  default ignores from the "ignore-by-default" module.
2220
2268
 
2221
2269
  Options
2222
- ${printFlagList({
2270
+ ${getFlagListOutput({
2223
2271
  all: 'Include all issues',
2224
- debug: 'Output debug information',
2225
2272
  'dry-run': 'Only output what will be done without actually doing it',
2226
2273
  json: 'Output result as json',
2227
2274
  markdown: 'Output result as markdown',
@@ -2251,10 +2298,9 @@ async function setupCommand$g(name, description, argv, importMeta) {
2251
2298
  const {
2252
2299
  dryRun
2253
2300
  } = cli.flags;
2254
- const debugLog = sdk.createDebugLogger(!dryRun || cli.flags['debug']);
2255
2301
 
2256
2302
  // TODO: Allow setting a custom cwd and/or configFile path?
2257
- const cwd = process.cwd();
2303
+ const cwd = process$1.cwd();
2258
2304
  const absoluteConfigPath = path.join(cwd, 'socket.yml');
2259
2305
  const config$1 = await config.readSocketConfig(absoluteConfigPath).catch(cause => {
2260
2306
  if (cause && typeof cause === 'object' && cause instanceof config.SocketValidationError) {
@@ -2266,14 +2312,14 @@ async function setupCommand$g(name, description, argv, importMeta) {
2266
2312
  errors: cause.validationErrors,
2267
2313
  schema: cause.schema
2268
2314
  });
2269
- throw new sdk.InputError('The socket.yml config is not valid', betterErrors.map(err => `[${err.path}] ${err.message}.${err.suggestion ? err.suggestion : ''}`).join('\n'));
2315
+ throw new socketUrl.InputError('The socket.yml config is not valid', betterErrors.map(err => `[${err.path}] ${err.message}.${err.suggestion ? err.suggestion : ''}`).join('\n'));
2270
2316
  } else {
2271
2317
  throw new ponyCause.ErrorWithCause('Failed to read socket.yml config', {
2272
2318
  cause
2273
2319
  });
2274
2320
  }
2275
2321
  });
2276
- const socketSdk = await sdk.setupSdk();
2322
+ const socketSdk = await socketUrl.setupSdk();
2277
2323
  const supportedFiles = await socketSdk.getReportSupportedFiles().then(res => {
2278
2324
  if (!res.success) handleUnsuccessfulApiResponse('getReportSupportedFiles', res, new spinner.Spinner());
2279
2325
  return res.data;
@@ -2282,11 +2328,10 @@ async function setupCommand$g(name, description, argv, importMeta) {
2282
2328
  cause
2283
2329
  });
2284
2330
  });
2285
- const packagePaths = await pathResolve.getPackageFiles(cwd, cli.input, config$1, supportedFiles, debugLog);
2331
+ const packagePaths = await pathResolve.getPackageFiles(cwd, cli.input, config$1, supportedFiles);
2286
2332
  return {
2287
2333
  config: config$1,
2288
2334
  cwd,
2289
- debugLog,
2290
2335
  dryRun,
2291
2336
  includeAllIssues: cli.flags['all'],
2292
2337
  outputJson: cli.flags['json'],
@@ -2299,14 +2344,13 @@ async function setupCommand$g(name, description, argv, importMeta) {
2299
2344
  async function createReport(packagePaths, {
2300
2345
  config,
2301
2346
  cwd,
2302
- debugLog,
2303
2347
  dryRun
2304
2348
  }) {
2305
- debugLog('Uploading:', packagePaths.join(`\n${sdk.logSymbols.info} Uploading: `));
2349
+ pathResolve.debugLog('Uploading:', packagePaths.join(`\n${pathResolve.logSymbols.info} Uploading: `));
2306
2350
  if (dryRun) {
2307
2351
  return;
2308
2352
  }
2309
- const socketSdk = await sdk.setupSdk();
2353
+ const socketSdk = await socketUrl.setupSdk();
2310
2354
  const spinner$1 = new spinner.Spinner({
2311
2355
  text: `Creating report with ${packagePaths.length} package files`
2312
2356
  }).start();
@@ -2327,7 +2371,7 @@ function formatReportCreationOutput(data, {
2327
2371
  console.log(JSON.stringify(data, undefined, 2));
2328
2372
  return;
2329
2373
  }
2330
- const format = new sdk.ColorOrMarkdown(!!outputMarkdown);
2374
+ const format = new socketUrl.ColorOrMarkdown(!!outputMarkdown);
2331
2375
  console.log(`New report: ${format.hyperlink(data.id, data.url, {
2332
2376
  fallbackToUrl: true
2333
2377
  })}`);
@@ -2369,13 +2413,13 @@ async function meowWithSubcommands(subcommands, options) {
2369
2413
  $ ${name} <command>
2370
2414
 
2371
2415
  Commands
2372
- ${printHelpList({
2373
- ...objects.toSortedObject(subcommands),
2374
- ...objects.toSortedObject(aliases)
2416
+ ${getHelpListOutput({
2417
+ ...objects.toSortedObject(Object.fromEntries(Object.entries(subcommands).filter(entry => !entry[1].hidden))),
2418
+ ...objects.toSortedObject(Object.fromEntries(Object.entries(aliases).filter(entry => !subcommands[entry[1]?.argv[0]]?.hidden)))
2375
2419
  }, 6)}
2376
2420
 
2377
2421
  Options
2378
- ${printFlagList(flags, 6)}
2422
+ ${getFlagListOutput(flags, 6)}
2379
2423
 
2380
2424
  Examples
2381
2425
  $ ${name} --help
@@ -2406,8 +2450,9 @@ const report = {
2406
2450
  }
2407
2451
  };
2408
2452
 
2409
- const BASH_FILE = `${os.homedir()}/.bashrc`;
2410
- const ZSH_BASH_FILE = `${os.homedir()}/.zshrc`;
2453
+ const HOME_DIR = os.homedir();
2454
+ const BASH_FILE = `${HOME_DIR}/.bashrc`;
2455
+ const ZSH_BASH_FILE = `${HOME_DIR}/.zshrc`;
2411
2456
  const wrapper = {
2412
2457
  description: 'Enable or disable the Socket npm/npx wrapper',
2413
2458
  async run(argv, importMeta, {
@@ -2423,7 +2468,7 @@ function setupCommand$f(name, description, argv, importMeta) {
2423
2468
  $ ${name} <flag>
2424
2469
 
2425
2470
  Options
2426
- ${printFlagList(flags, 6)}
2471
+ ${getFlagListOutput(flags, 6)}
2427
2472
 
2428
2473
  Examples
2429
2474
  $ ${name} --enable
@@ -2478,21 +2523,18 @@ function setupCommand$f(name, description, argv, importMeta) {
2478
2523
  console.error('There was an issue setting up the alias in your bash profile');
2479
2524
  }
2480
2525
  }
2481
- const installSafeNpm = query => {
2482
- console.log(`
2483
- _____ _ _
2484
- | __|___ ___| |_ ___| |_
2485
- |__ | . | _| '_| -_| _|
2486
- |_____|___|___|_,_|___|_|
2487
-
2526
+ function addAlias(file) {
2527
+ return fs.appendFile(file, 'alias npm="socket npm"\nalias npx="socket npx"\n', err => {
2528
+ if (err) {
2529
+ return new Error(`There was an error setting up the alias: ${err}`);
2530
+ }
2531
+ console.log(`
2532
+ The alias was added to ${file}. Running 'npm install' will now be wrapped in Socket's "safe npm" 🎉
2533
+ If you want to disable it at any time, run \`socket wrapper --disable\`
2488
2534
  `);
2489
- const rl = readline.createInterface({
2490
- input: process.stdin,
2491
- output: process.stdout
2492
2535
  });
2493
- return askQuestion(rl, query);
2494
- };
2495
- const askQuestion = (rl, query) => {
2536
+ }
2537
+ function askQuestion(rl, query) {
2496
2538
  rl.question(query, ans => {
2497
2539
  if (ans.toLowerCase() === 'y') {
2498
2540
  try {
@@ -2512,19 +2554,31 @@ const askQuestion = (rl, query) => {
2512
2554
  rl.close();
2513
2555
  }
2514
2556
  });
2515
- };
2516
- const addAlias = file => {
2517
- return fs.appendFile(file, 'alias npm="socket npm"\nalias npx="socket npx"\n', err => {
2518
- if (err) {
2519
- return new Error(`There was an error setting up the alias: ${err}`);
2520
- }
2521
- console.log(`
2522
- The alias was added to ${file}. Running 'npm install' will now be wrapped in Socket's "safe npm" 🎉
2523
- If you want to disable it at any time, run \`socket wrapper --disable\`
2557
+ }
2558
+ function checkSocketWrapperAlreadySetup(file) {
2559
+ const fileContent = fs.readFileSync(file, 'utf8');
2560
+ const linesWithSocketAlias = fileContent.split('\n').filter(l => l === 'alias npm="socket npm"' || l === 'alias npx="socket npx"');
2561
+ if (linesWithSocketAlias.length) {
2562
+ console.log(`The Socket npm/npx wrapper is set up in your bash profile (${file}).`);
2563
+ return true;
2564
+ }
2565
+ return false;
2566
+ }
2567
+ function installSafeNpm(query) {
2568
+ console.log(`
2569
+ _____ _ _
2570
+ | __|___ ___| |_ ___| |_
2571
+ |__ | . | _| '_| -_| _|
2572
+ |_____|___|___|_,_|___|_|
2573
+
2524
2574
  `);
2575
+ const rl = readline.createInterface({
2576
+ input: process$1.stdin,
2577
+ output: process$1.stdout
2525
2578
  });
2526
- };
2527
- const removeAlias = file => {
2579
+ return askQuestion(rl, query);
2580
+ }
2581
+ function removeAlias(file) {
2528
2582
  return fs.readFile(file, 'utf8', function (err, data) {
2529
2583
  if (err) {
2530
2584
  console.error(`There was an error removing the alias: ${err}`);
@@ -2541,16 +2595,7 @@ const removeAlias = file => {
2541
2595
  }
2542
2596
  });
2543
2597
  });
2544
- };
2545
- const checkSocketWrapperAlreadySetup = file => {
2546
- const fileContent = fs.readFileSync(file, 'utf8');
2547
- const linesWithSocketAlias = fileContent.split('\n').filter(l => l === 'alias npm="socket npm"' || l === 'alias npx="socket npx"');
2548
- if (linesWithSocketAlias.length) {
2549
- console.log(`The Socket npm/npx wrapper is set up in your bash profile (${file}).`);
2550
- return true;
2551
- }
2552
- return false;
2553
- };
2598
+ }
2554
2599
 
2555
2600
  const create$1 = {
2556
2601
  description: 'Create a scan',
@@ -2560,9 +2605,9 @@ const create$1 = {
2560
2605
  const name = `${parentName} create`;
2561
2606
  const input = await setupCommand$e(name, create$1.description, argv, importMeta);
2562
2607
  if (input) {
2563
- const apiKey = sdk.getDefaultKey();
2608
+ const apiKey = socketUrl.getDefaultToken();
2564
2609
  if (!apiKey) {
2565
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
2610
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
2566
2611
  }
2567
2612
  const spinnerText = 'Creating a scan... \n';
2568
2613
  const spinner$1 = new spinner.Spinner({
@@ -2639,7 +2684,7 @@ async function setupCommand$e(name, description, argv, importMeta) {
2639
2684
  $ ${name} [...options]
2640
2685
 
2641
2686
  Options
2642
- ${printFlagList(flags, 6)}
2687
+ ${getFlagListOutput(flags, 6)}
2643
2688
 
2644
2689
  Examples
2645
2690
  $ ${name} --org=FakeOrg --repo=test-repo --branch=main ./package.json
@@ -2660,8 +2705,8 @@ async function setupCommand$e(name, description, argv, importMeta) {
2660
2705
  const {
2661
2706
  0: orgSlug = ''
2662
2707
  } = cli.input;
2663
- const cwd = process.cwd();
2664
- const socketSdk = await sdk.setupSdk();
2708
+ const cwd = process$1.cwd();
2709
+ const socketSdk = await socketUrl.setupSdk();
2665
2710
  const supportedFiles = await socketSdk.getReportSupportedFiles().then(res => {
2666
2711
  if (!res.success) handleUnsuccessfulApiResponse('getReportSupportedFiles', res, new spinner.Spinner());
2667
2712
  return res.data;
@@ -2671,8 +2716,7 @@ async function setupCommand$e(name, description, argv, importMeta) {
2671
2716
  cause
2672
2717
  });
2673
2718
  });
2674
- const debugLog = sdk.createDebugLogger(false);
2675
- const packagePaths = await pathResolve.getPackageFilesFullScans(cwd, cli.input, supportedFiles, debugLog);
2719
+ const packagePaths = await pathResolve.getPackageFilesFullScans(cwd, cli.input, supportedFiles);
2676
2720
  const {
2677
2721
  branch: branchName,
2678
2722
  repo: repoName
@@ -2703,7 +2747,7 @@ async function setupCommand$e(name, description, argv, importMeta) {
2703
2747
  };
2704
2748
  }
2705
2749
  async function createFullScan(input, spinner, apiKey) {
2706
- const socketSdk = await sdk.setupSdk(apiKey);
2750
+ const socketSdk = await socketUrl.setupSdk(apiKey);
2707
2751
  const {
2708
2752
  branchName,
2709
2753
  commitMessage,
@@ -2748,9 +2792,9 @@ const del$1 = {
2748
2792
  const name = `${parentName} del`;
2749
2793
  const input = setupCommand$d(name, del$1.description, argv, importMeta);
2750
2794
  if (input) {
2751
- const apiKey = sdk.getDefaultKey();
2795
+ const apiKey = socketUrl.getDefaultToken();
2752
2796
  if (!apiKey) {
2753
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
2797
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
2754
2798
  }
2755
2799
  const spinnerText = 'Deleting scan...';
2756
2800
  const spinner$1 = new spinner.Spinner({
@@ -2773,7 +2817,7 @@ function setupCommand$d(name, description, argv, importMeta) {
2773
2817
  $ ${name} <org slug> <scan ID>
2774
2818
 
2775
2819
  Options
2776
- ${printFlagList(flags, 6)}
2820
+ ${getFlagListOutput(flags, 6)}
2777
2821
 
2778
2822
  Examples
2779
2823
  $ ${name} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0
@@ -2804,7 +2848,7 @@ function setupCommand$d(name, description, argv, importMeta) {
2804
2848
  };
2805
2849
  }
2806
2850
  async function deleteOrgFullScan(orgSlug, fullScanId, spinner, apiKey) {
2807
- const socketSdk = await sdk.setupSdk(apiKey);
2851
+ const socketSdk = await socketUrl.setupSdk(apiKey);
2808
2852
  const result = await handleApiCall(socketSdk.deleteOrgFullScan(orgSlug, fullScanId), 'Deleting scan');
2809
2853
  if (result.success) {
2810
2854
  spinner.success('Scan deleted successfully');
@@ -2822,9 +2866,9 @@ const list$1 = {
2822
2866
  const name = `${parentName} list`;
2823
2867
  const input = setupCommand$c(name, list$1.description, argv, importMeta);
2824
2868
  if (input) {
2825
- const apiKey = sdk.getDefaultKey();
2869
+ const apiKey = socketUrl.getDefaultToken();
2826
2870
  if (!apiKey) {
2827
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
2871
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
2828
2872
  }
2829
2873
  const spinnerText = 'Listing scans... \n';
2830
2874
  const spinner$1 = new spinner.Spinner({
@@ -2886,7 +2930,7 @@ function setupCommand$c(name, description, argv, importMeta) {
2886
2930
  $ ${name} <org slug>
2887
2931
 
2888
2932
  Options
2889
- ${printFlagList(flags, 6)}
2933
+ ${getFlagListOutput(flags, 6)}
2890
2934
 
2891
2935
  Examples
2892
2936
  $ ${name} FakeOrg
@@ -2921,7 +2965,7 @@ function setupCommand$c(name, description, argv, importMeta) {
2921
2965
  };
2922
2966
  }
2923
2967
  async function listOrgFullScan(orgSlug, input, spinner, apiKey) {
2924
- const socketSdk = await sdk.setupSdk(apiKey);
2968
+ const socketSdk = await socketUrl.setupSdk(apiKey);
2925
2969
  const result = await handleApiCall(socketSdk.getOrgFullScanList(orgSlug, input), 'Listing scans');
2926
2970
  if (!result.success) {
2927
2971
  handleUnsuccessfulApiResponse('getOrgFullScanList', result, spinner);
@@ -2966,9 +3010,9 @@ const metadata = {
2966
3010
  const name = `${parentName} metadata`;
2967
3011
  const input = setupCommand$b(name, metadata.description, argv, importMeta);
2968
3012
  if (input) {
2969
- const apiKey = sdk.getDefaultKey();
3013
+ const apiKey = socketUrl.getDefaultToken();
2970
3014
  if (!apiKey) {
2971
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3015
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
2972
3016
  }
2973
3017
  const spinnerText = "Getting scan's metadata... \n";
2974
3018
  const spinner$1 = new spinner.Spinner({
@@ -2991,7 +3035,7 @@ function setupCommand$b(name, description, argv, importMeta) {
2991
3035
  $ ${name} <org slug> <scan id>
2992
3036
 
2993
3037
  Options
2994
- ${printFlagList(flags, 6)}
3038
+ ${getFlagListOutput(flags, 6)}
2995
3039
 
2996
3040
  Examples
2997
3041
  $ ${name} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0
@@ -3022,7 +3066,7 @@ function setupCommand$b(name, description, argv, importMeta) {
3022
3066
  };
3023
3067
  }
3024
3068
  async function getOrgScanMetadata(orgSlug, scanId, spinner, apiKey) {
3025
- const socketSdk = await sdk.setupSdk(apiKey);
3069
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3026
3070
  const result = await handleApiCall(socketSdk.getOrgFullScanMetadata(orgSlug, scanId), 'Listing scans');
3027
3071
  if (!result.success) {
3028
3072
  handleUnsuccessfulApiResponse('getOrgFullScanMetadata', result, spinner);
@@ -3040,9 +3084,9 @@ const stream = {
3040
3084
  const name = `${parentName} stream`;
3041
3085
  const input = setupCommand$a(name, stream.description, argv, importMeta);
3042
3086
  if (input) {
3043
- const apiKey = sdk.getDefaultKey();
3087
+ const apiKey = socketUrl.getDefaultToken();
3044
3088
  if (!apiKey) {
3045
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3089
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3046
3090
  }
3047
3091
  const spinner$1 = new spinner.Spinner({
3048
3092
  text: 'Streaming scan...'
@@ -3069,7 +3113,7 @@ function setupCommand$a(name, description, argv, importMeta) {
3069
3113
  $ ${name} <org slug> <scan ID> <path to output file>
3070
3114
 
3071
3115
  Options
3072
- ${printFlagList(flags, 6)}
3116
+ ${getFlagListOutput(flags, 6)}
3073
3117
 
3074
3118
  Examples
3075
3119
  $ ${name} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0 ./stream.txt
@@ -3102,7 +3146,7 @@ function setupCommand$a(name, description, argv, importMeta) {
3102
3146
  };
3103
3147
  }
3104
3148
  async function getOrgFullScan(orgSlug, fullScanId, file, apiKey) {
3105
- const socketSdk = await sdk.setupSdk(apiKey);
3149
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3106
3150
  return await handleApiCall(socketSdk.getOrgFullScan(orgSlug, fullScanId, file), 'Streaming a scan');
3107
3151
  }
3108
3152
 
@@ -3135,9 +3179,9 @@ const auditLog = {
3135
3179
  const name = parentName + ' audit-log';
3136
3180
  const input = setupCommand$9(name, auditLog.description, argv, importMeta);
3137
3181
  if (input) {
3138
- const apiKey = sdk.getDefaultKey();
3182
+ const apiKey = socketUrl.getDefaultToken();
3139
3183
  if (!apiKey) {
3140
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3184
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3141
3185
  }
3142
3186
  const spinner$1 = new spinner.Spinner({
3143
3187
  text: `Looking up audit log for ${input.orgSlug}\n`
@@ -3180,7 +3224,7 @@ function setupCommand$9(name, description, argv, importMeta) {
3180
3224
  $ ${name} <org slug>
3181
3225
 
3182
3226
  Options
3183
- ${printFlagList(flags, 6)}
3227
+ ${getFlagListOutput(flags, 6)}
3184
3228
 
3185
3229
  Examples
3186
3230
  $ ${name} FakeOrg
@@ -3219,7 +3263,7 @@ function setupCommand$9(name, description, argv, importMeta) {
3219
3263
  };
3220
3264
  }
3221
3265
  async function fetchOrgAuditLog(orgSlug, input, spinner, apiKey) {
3222
- const socketSdk = await sdk.setupSdk(apiKey);
3266
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3223
3267
  const result = await handleApiCall(socketSdk.getAuditLogEvents(orgSlug, input), `Looking up audit log for ${orgSlug}\n`);
3224
3268
  if (!result.success) {
3225
3269
  handleUnsuccessfulApiResponse('getAuditLogEvents', result, spinner);
@@ -3259,9 +3303,9 @@ const create = {
3259
3303
  const name = `${parentName} create`;
3260
3304
  const input = setupCommand$8(name, create.description, argv, importMeta);
3261
3305
  if (input) {
3262
- const apiKey = sdk.getDefaultKey();
3306
+ const apiKey = socketUrl.getDefaultToken();
3263
3307
  if (!apiKey) {
3264
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3308
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3265
3309
  }
3266
3310
  const spinnerText = 'Creating repository... \n';
3267
3311
  const spinner$1 = new spinner.Spinner({
@@ -3317,7 +3361,7 @@ function setupCommand$8(name, description, argv, importMeta) {
3317
3361
  $ ${name} <org slug>
3318
3362
 
3319
3363
  Options
3320
- ${printFlagList(flags, 6)}
3364
+ ${getFlagListOutput(flags, 6)}
3321
3365
 
3322
3366
  Examples
3323
3367
  $ ${name} FakeOrg --repoName=test-repo
@@ -3355,7 +3399,7 @@ function setupCommand$8(name, description, argv, importMeta) {
3355
3399
  };
3356
3400
  }
3357
3401
  async function createRepo(orgSlug, input, spinner, apiKey) {
3358
- const socketSdk = await sdk.setupSdk(apiKey);
3402
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3359
3403
  const result = await handleApiCall(socketSdk.createOrgRepo(orgSlug, input), 'creating repository');
3360
3404
  if (result.success) {
3361
3405
  spinner.success('Repository created successfully');
@@ -3372,9 +3416,9 @@ const del = {
3372
3416
  const name = `${parentName} del`;
3373
3417
  const input = setupCommand$7(name, del.description, argv, importMeta);
3374
3418
  if (input) {
3375
- const apiKey = sdk.getDefaultKey();
3419
+ const apiKey = socketUrl.getDefaultToken();
3376
3420
  if (!apiKey) {
3377
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3421
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3378
3422
  }
3379
3423
  const spinnerText = 'Deleting repository... \n';
3380
3424
  const spinner$1 = new spinner.Spinner({
@@ -3418,7 +3462,7 @@ function setupCommand$7(name, description, argv, importMeta) {
3418
3462
  };
3419
3463
  }
3420
3464
  async function deleteRepository(orgSlug, repoName, spinner, apiKey) {
3421
- const socketSdk = await sdk.setupSdk(apiKey);
3465
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3422
3466
  const result = await handleApiCall(socketSdk.deleteOrgRepo(orgSlug, repoName), 'deleting repository');
3423
3467
  if (result.success) {
3424
3468
  spinner.success('Repository deleted successfully');
@@ -3436,9 +3480,9 @@ const list = {
3436
3480
  const name = `${parentName} list`;
3437
3481
  const input = setupCommand$6(name, list.description, argv, importMeta);
3438
3482
  if (input) {
3439
- const apiKey = sdk.getDefaultKey();
3483
+ const apiKey = socketUrl.getDefaultToken();
3440
3484
  if (!apiKey) {
3441
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3485
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3442
3486
  }
3443
3487
  const spinnerText = 'Listing repositories... \n';
3444
3488
  const spinner$1 = new spinner.Spinner({
@@ -3487,7 +3531,7 @@ function setupCommand$6(name, description, argv, importMeta) {
3487
3531
  $ ${name} <org slug>
3488
3532
 
3489
3533
  Options
3490
- ${printFlagList(flags, 6)}
3534
+ ${getFlagListOutput(flags, 6)}
3491
3535
 
3492
3536
  Examples
3493
3537
  $ ${name} FakeOrg
@@ -3520,7 +3564,7 @@ function setupCommand$6(name, description, argv, importMeta) {
3520
3564
  };
3521
3565
  }
3522
3566
  async function listOrgRepos(orgSlug, input, spinner, apiKey) {
3523
- const socketSdk = await sdk.setupSdk(apiKey);
3567
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3524
3568
  const result = await handleApiCall(socketSdk.getOrgRepoList(orgSlug, input), 'listing repositories');
3525
3569
  if (!result.success) {
3526
3570
  handleUnsuccessfulApiResponse('getOrgRepoList', result, spinner);
@@ -3555,9 +3599,9 @@ const update = {
3555
3599
  const name = `${parentName} update`;
3556
3600
  const input = setupCommand$5(name, update.description, argv, importMeta);
3557
3601
  if (input) {
3558
- const apiKey = sdk.getDefaultKey();
3602
+ const apiKey = socketUrl.getDefaultToken();
3559
3603
  if (!apiKey) {
3560
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3604
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3561
3605
  }
3562
3606
  const spinnerText = 'Updating repository... \n';
3563
3607
  const spinner$1 = new spinner.Spinner({
@@ -3613,7 +3657,7 @@ function setupCommand$5(name, description, argv, importMeta) {
3613
3657
  $ ${name} <org slug>
3614
3658
 
3615
3659
  Options
3616
- ${printFlagList(flags, 6)}
3660
+ ${getFlagListOutput(flags, 6)}
3617
3661
 
3618
3662
  Examples
3619
3663
  $ ${name} FakeOrg
@@ -3651,7 +3695,7 @@ function setupCommand$5(name, description, argv, importMeta) {
3651
3695
  };
3652
3696
  }
3653
3697
  async function updateRepository(orgSlug, input, spinner, apiKey) {
3654
- const socketSdk = await sdk.setupSdk(apiKey);
3698
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3655
3699
  const result = await handleApiCall(socketSdk.updateOrgRepo(orgSlug, input.name, input), 'updating repository');
3656
3700
  if (result.success) {
3657
3701
  spinner.success('Repository updated successfully');
@@ -3669,9 +3713,9 @@ const view = {
3669
3713
  const name = `${parentName} view`;
3670
3714
  const input = setupCommand$4(name, view.description, argv, importMeta);
3671
3715
  if (input) {
3672
- const apiKey = sdk.getDefaultKey();
3716
+ const apiKey = socketUrl.getDefaultToken();
3673
3717
  if (!apiKey) {
3674
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3718
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3675
3719
  }
3676
3720
  const spinnerText = 'Fetching repository... \n';
3677
3721
  const spinner$1 = new spinner.Spinner({
@@ -3694,7 +3738,7 @@ function setupCommand$4(name, description, argv, importMeta) {
3694
3738
  $ ${name} <org slug>
3695
3739
 
3696
3740
  Options
3697
- ${printFlagList(flags, 6)}
3741
+ ${getFlagListOutput(flags, 6)}
3698
3742
 
3699
3743
  Examples
3700
3744
  $ ${name} FakeOrg
@@ -3725,7 +3769,7 @@ function setupCommand$4(name, description, argv, importMeta) {
3725
3769
  };
3726
3770
  }
3727
3771
  async function viewRepository(orgSlug, repoName, spinner, apiKey) {
3728
- const socketSdk = await sdk.setupSdk(apiKey);
3772
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3729
3773
  const result = await handleApiCall(socketSdk.getOrgRepo(orgSlug, repoName), 'fetching repository');
3730
3774
  if (!result.success) {
3731
3775
  handleUnsuccessfulApiResponse('getOrgRepo', result, spinner);
@@ -3820,7 +3864,7 @@ function setupCommand$3(name, description, argv, importMeta) {
3820
3864
  $ ${name}
3821
3865
 
3822
3866
  Options
3823
- ${printFlagList(flags, 6)}
3867
+ ${getFlagListOutput(flags, 6)}
3824
3868
 
3825
3869
  Examples
3826
3870
  $ ${name}
@@ -3848,14 +3892,14 @@ async function searchDeps({
3848
3892
  offset,
3849
3893
  outputJson
3850
3894
  }) {
3851
- const apiKey = sdk.getDefaultKey();
3895
+ const apiKey = socketUrl.getDefaultToken();
3852
3896
  if (!apiKey) {
3853
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3897
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3854
3898
  }
3855
3899
  const spinner$1 = new spinner.Spinner({
3856
3900
  text: 'Searching dependencies...'
3857
3901
  }).start();
3858
- const socketSdk = await sdk.setupSdk(apiKey);
3902
+ const socketSdk = await socketUrl.setupSdk(apiKey);
3859
3903
  const result = await handleApiCall(socketSdk.searchDependencies({
3860
3904
  limit,
3861
3905
  offset
@@ -3905,9 +3949,9 @@ const analytics = {
3905
3949
  const name = parentName + ' analytics';
3906
3950
  const input = setupCommand$2(name, analytics.description, argv, importMeta);
3907
3951
  if (input) {
3908
- const apiKey = sdk.getDefaultKey();
3952
+ const apiKey = socketUrl.getDefaultToken();
3909
3953
  if (!apiKey) {
3910
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3954
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
3911
3955
  }
3912
3956
  const spinner$1 = new spinner.Spinner({
3913
3957
  text: 'Fetching analytics data'
@@ -3962,7 +4006,7 @@ function setupCommand$2(name, description, argv, importMeta) {
3962
4006
  $ ${name} --scope=<scope> --time=<time filter>
3963
4007
 
3964
4008
  Options
3965
- ${printFlagList(flags, 6)}
4009
+ ${getFlagListOutput(flags, 6)}
3966
4010
 
3967
4011
  Examples
3968
4012
  $ ${name} --scope=org --time=7
@@ -3980,10 +4024,10 @@ function setupCommand$2(name, description, argv, importMeta) {
3980
4024
  time
3981
4025
  } = cli.flags;
3982
4026
  if (scope !== 'org' && scope !== 'repo') {
3983
- throw new sdk.InputError("The scope must either be 'org' or 'repo'");
4027
+ throw new socketUrl.InputError("The scope must either be 'org' or 'repo'");
3984
4028
  }
3985
4029
  if (time !== 7 && time !== 30 && time !== 90) {
3986
- throw new sdk.InputError('The time filter must either be 7, 30 or 90');
4030
+ throw new socketUrl.InputError('The time filter must either be 7, 30 or 90');
3987
4031
  }
3988
4032
  let showHelp = cli.flags['help'];
3989
4033
  if (scope === 'repo' && !repo) {
@@ -4004,7 +4048,7 @@ function setupCommand$2(name, description, argv, importMeta) {
4004
4048
  }
4005
4049
  const METRICS = ['total_critical_alerts', 'total_high_alerts', 'total_medium_alerts', 'total_low_alerts', 'total_critical_added', 'total_medium_added', 'total_low_added', 'total_high_added', 'total_critical_prevented', 'total_high_prevented', 'total_medium_prevented', 'total_low_prevented'];
4006
4050
  async function fetchOrgAnalyticsData(time, spinner, apiKey, outputJson, filePath) {
4007
- const socketSdk = await sdk.setupSdk(apiKey);
4051
+ const socketSdk = await socketUrl.setupSdk(apiKey);
4008
4052
  const result = await handleApiCall(socketSdk.getOrgAnalytics(time.toString()), 'fetching analytics data');
4009
4053
  if (result.success === false) {
4010
4054
  return handleUnsuccessfulApiResponse('getOrgAnalytics', result, spinner);
@@ -4117,7 +4161,7 @@ const formatData = (data, scope) => {
4117
4161
  };
4118
4162
  };
4119
4163
  async function fetchRepoAnalyticsData(repo, time, spinner, apiKey, outputJson, filePath) {
4120
- const socketSdk = await sdk.setupSdk(apiKey);
4164
+ const socketSdk = await socketUrl.setupSdk(apiKey);
4121
4165
  const result = await handleApiCall(socketSdk.getRepoAnalytics(repo, time.toString()), 'fetching analytics data');
4122
4166
  if (result.success === false) {
4123
4167
  return handleUnsuccessfulApiResponse('getRepoAnalytics', result, spinner);
@@ -4205,9 +4249,9 @@ const get = {
4205
4249
  const name = `${parentName} get`;
4206
4250
  const input = setupCommand$1(name, get.description, argv, importMeta);
4207
4251
  if (input) {
4208
- const apiKey = sdk.getDefaultKey();
4252
+ const apiKey = socketUrl.getDefaultToken();
4209
4253
  if (!apiKey) {
4210
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
4254
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
4211
4255
  }
4212
4256
  const spinnerText = 'Getting diff scan... \n';
4213
4257
  const spinner$1 = new spinner.Spinner({
@@ -4257,7 +4301,7 @@ function setupCommand$1(name, description, argv, importMeta) {
4257
4301
  $ ${name} <org slug> --before=<before> --after=<after>
4258
4302
 
4259
4303
  Options
4260
- ${printFlagList(flags, 6)}
4304
+ ${getFlagListOutput(flags, 6)}
4261
4305
 
4262
4306
  Examples
4263
4307
  $ ${name} FakeCorp --before=aaa0aa0a-aaaa-0000-0a0a-0000000a00a0 --after=aaa1aa1a-aaaa-1111-1a1a-1111111a11a1
@@ -4348,7 +4392,6 @@ const diffScan = {
4348
4392
  }
4349
4393
  };
4350
4394
 
4351
- // @ts-ignore
4352
4395
  const threatFeed = {
4353
4396
  description: 'Look up the threat feed',
4354
4397
  async run(argv, importMeta, {
@@ -4357,9 +4400,9 @@ const threatFeed = {
4357
4400
  const name = `${parentName} threat-feed`;
4358
4401
  const input = setupCommand(name, threatFeed.description, argv, importMeta);
4359
4402
  {
4360
- const apiKey = sdk.getDefaultKey();
4403
+ const apiKey = socketUrl.getDefaultToken();
4361
4404
  if (!apiKey) {
4362
- throw new sdk.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
4405
+ throw new socketUrl.AuthError('User must be authenticated to run this command. To log in, run the command `socket login` and enter your API key.');
4363
4406
  }
4364
4407
  const spinner$1 = new spinner.Spinner({
4365
4408
  text: 'Looking up the threat feed'
@@ -4408,7 +4451,7 @@ function setupCommand(name, description, argv, importMeta) {
4408
4451
  $ ${name}
4409
4452
 
4410
4453
  Options
4411
- ${printFlagList(flags, 6)}
4454
+ ${getFlagListOutput(flags, 6)}
4412
4455
 
4413
4456
  Examples
4414
4457
  $ ${name}
@@ -4484,7 +4527,7 @@ async function fetchThreatFeed({
4484
4527
  data: formattedOutput
4485
4528
  });
4486
4529
  screen.render();
4487
- screen.key(['escape', 'q', 'C-c'], () => process.exit(0));
4530
+ screen.key(['escape', 'q', 'C-c'], () => process$1.exit(0));
4488
4531
  }
4489
4532
  const formatResults = data => {
4490
4533
  return data.map(d => {
@@ -4553,7 +4596,7 @@ void (async () => {
4553
4596
  argv: ['report', 'create', '--view', '--strict']
4554
4597
  }
4555
4598
  },
4556
- argv: process.argv.slice(2),
4599
+ argv: process$1.argv.slice(2),
4557
4600
  name: 'socket',
4558
4601
  importMeta: {
4559
4602
  url: `${require$$0.pathToFileURL(__filename)}`
@@ -4563,10 +4606,10 @@ void (async () => {
4563
4606
  let errorBody;
4564
4607
  let errorTitle;
4565
4608
  let errorMessage = '';
4566
- if (err instanceof sdk.AuthError) {
4609
+ if (err instanceof socketUrl.AuthError) {
4567
4610
  errorTitle = 'Authentication error';
4568
4611
  errorMessage = err.message;
4569
- } else if (err instanceof sdk.InputError) {
4612
+ } else if (err instanceof socketUrl.InputError) {
4570
4613
  errorTitle = 'Invalid input';
4571
4614
  errorMessage = err.message;
4572
4615
  errorBody = err.body;
@@ -4577,10 +4620,10 @@ void (async () => {
4577
4620
  } else {
4578
4621
  errorTitle = 'Unexpected error with no details';
4579
4622
  }
4580
- console.error(`${sdk.logSymbols.error} ${colors.bgRed(colors.white(errorTitle + ':'))} ${errorMessage}`);
4623
+ console.error(`${pathResolve.logSymbols.error} ${colors.bgRed(colors.white(errorTitle + ':'))} ${errorMessage}`);
4581
4624
  if (errorBody) {
4582
4625
  console.error(`\n${errorBody}`);
4583
4626
  }
4584
- process.exit(1);
4627
+ process$1.exit(1);
4585
4628
  }
4586
4629
  })();