socket 0.14.148 → 0.14.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -5,7 +5,6 @@ const require$$0 = require('node:url')
5
5
  const vendor = require('./vendor.js')
6
6
  const debug = require('../external/@socketsecurity/registry/lib/debug')
7
7
  const logger = require('../external/@socketsecurity/registry/lib/logger')
8
- const assert = require('node:assert')
9
8
  const fs = require('node:fs/promises')
10
9
  const strings = require('../external/@socketsecurity/registry/lib/strings')
11
10
  const shadowNpmInject = require('./shadow-npm-inject.js')
@@ -14,10 +13,10 @@ const path$1 = require('node:path')
14
13
  const objects = require('../external/@socketsecurity/registry/lib/objects')
15
14
  const path = require('../external/@socketsecurity/registry/lib/path')
16
15
  const regexps = require('../external/@socketsecurity/registry/lib/regexps')
16
+ const prompts = require('../external/@socketsecurity/registry/lib/prompts')
17
17
  const words = require('../external/@socketsecurity/registry/lib/words')
18
18
  const fs$1 = require('node:fs')
19
19
  const shadowBin = require('./shadow-bin.js')
20
- const prompts = require('../external/@socketsecurity/registry/lib/prompts')
21
20
  const shadowNpmPaths = require('./shadow-npm-paths.js')
22
21
  const util = require('node:util')
23
22
  const arrays = require('../external/@socketsecurity/registry/lib/arrays')
@@ -33,9 +32,8 @@ function failMsgWithBadge(badge, msg) {
33
32
  return `${vendor.yoctocolorsCjsExports.bgRed(vendor.yoctocolorsCjsExports.bold(vendor.yoctocolorsCjsExports.white(` ${badge}: `)))} ${vendor.yoctocolorsCjsExports.bold(msg)}`
34
33
  }
35
34
 
36
- function handleUnsuccessfulApiResponse(_name, sockSdkError) {
37
- const message = sockSdkError.error || 'No error message returned'
38
- const { status } = sockSdkError
35
+ function handleUnsuccessfulApiResponse(_name, { cause, error, status }) {
36
+ const message = `${error || 'No error message returned'}${cause ? ` (reason: ${cause})` : ''}`
39
37
  if (status === 401 || status === 403) {
40
38
  // Lazily access constants.spinner.
41
39
  const { spinner } = constants
@@ -904,11 +902,17 @@ function emitBanner(name) {
904
902
  logger.logger.error(getAsciiHeader(name))
905
903
  }
906
904
  function getAsciiHeader(command) {
907
- const cliVersion = '0.14.148:b04f898:6146c5b2:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
905
+ const cliVersion = '0.14.150:cc2913a:aa0fe20d:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
908
906
  const nodeVersion = process$1.version
909
907
  const apiToken = shadowNpmInject.getDefaultToken()
910
908
  const defaultOrg = shadowNpmInject.getConfigValue('defaultOrg')
911
909
  const readOnlyConfig = shadowNpmInject.isReadOnlyConfig() ? '*' : '.'
910
+ const v1test = shadowNpmInject.isTestingV1() ? ' (is testing v1)' : ''
911
+ const feedback = shadowNpmInject.isTestingV1()
912
+ ? vendor.yoctocolorsCjsExports.green(
913
+ ' (Thank you for testing the v1 bump! Please send us any feedback you might have!)\n'
914
+ )
915
+ : ''
912
916
  const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
913
917
  const relCwd = path.normalizePath(
914
918
  process$1
@@ -921,12 +925,22 @@ function getAsciiHeader(command) {
921
925
  '~/'
922
926
  )
923
927
  )
928
+ let nodeVerWarn = ''
929
+ if ((vendor.semverExports.parse(constants.NODE_VERSION)?.major ?? 0) < 20) {
930
+ nodeVerWarn += vendor.yoctocolorsCjsExports.bold(
931
+ ` ${vendor.yoctocolorsCjsExports.red('Warning:')} NodeJS version 19 and lower will be ${vendor.yoctocolorsCjsExports.red('unsupported')} after April 30th, 2025.`
932
+ )
933
+ nodeVerWarn += '\n'
934
+ nodeVerWarn +=
935
+ ' Soon after the Socket CLI will require NodeJS version 20 or higher.'
936
+ nodeVerWarn += '\n'
937
+ }
924
938
  const body = `
925
939
  _____ _ _ /---------------
926
- | __|___ ___| |_ ___| |_ | Socket.dev CLI ver ${cliVersion}
940
+ | __|___ ___| |_ ___| |_ | Socket.dev CLI ver ${cliVersion}${v1test}
927
941
  |__ | ${readOnlyConfig} | _| '_| -_| _| | Node: ${nodeVersion}, API token set: ${shownToken}${defaultOrg ? `, default org: ${defaultOrg}` : ''}
928
942
  |_____|___|___|_,_|___|_|.dev | Command: \`${command}\`, cwd: ${relCwd}`.trimStart()
929
- return ` ${body}\n`
943
+ return ` ${body}\n${nodeVerWarn}${feedback}`
930
944
  }
931
945
 
932
946
  const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$J } = constants
@@ -964,25 +978,34 @@ const config$M = {
964
978
  description: 'Time filter - either 7, 30 or 90, default: 7'
965
979
  }
966
980
  },
967
- help: (command, { flags }) => `
981
+ help: (command, { flags }) =>
982
+ `
968
983
  Usage
969
- $ ${command} --scope=<scope> --time=<time filter>
984
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '[ org | repo <reponame>] [time]' : '--scope=<scope> --time=<time filter>'}
970
985
 
971
986
  API Token Requirements
972
987
  - Quota: 1 unit
973
988
  - Permissions: report:write
974
989
 
975
- Default parameters are set to show the organization-level analytics over the
976
- last 7 days.
990
+ ${shadowNpmInject.isTestingV1() ? '' : 'Default parameters are set to show the organization-level analytics over the'}
991
+ ${shadowNpmInject.isTestingV1() ? '' : 'last 7 days.'}
992
+
993
+ ${shadowNpmInject.isTestingV1() ? 'The scope is either org or repo level, defaults to org.' : ''}
994
+
995
+ ${shadowNpmInject.isTestingV1() ? 'When scope is repo, a repo slug must be given as well.' : ''}
996
+
997
+ ${shadowNpmInject.isTestingV1() ? 'The time argument must be number 7, 30, or 90 and defaults to 7.' : ''}
977
998
 
978
999
  Options
979
1000
  ${getFlagListOutput(flags, 6)}
980
1001
 
981
1002
  Examples
982
- $ ${command} --scope=org --time=7
983
- $ ${command} --scope=org --time=30
984
- $ ${command} --scope=repo --repo=test-repo --time=30
1003
+ $ ${command} ${shadowNpmInject.isTestingV1() ? 'org 7' : '--scope=org --time=7'}
1004
+ $ ${command} ${shadowNpmInject.isTestingV1() ? 'repo test-repo 30' : '--scope=org --time=30'}
1005
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '90' : '--scope=repo --repo=test-repo --time=30'}
985
1006
  `
1007
+ // Drop consecutive empty lines. Temporarily necessary to deal with v1 prep.
1008
+ .replace(/\n(?: *\n)+/g, '\n\n')
986
1009
  }
987
1010
  const cmdAnalytics = {
988
1011
  description: config$M.description,
@@ -996,28 +1019,87 @@ async function run$M(argv, importMeta, { parentName }) {
996
1019
  importMeta,
997
1020
  parentName
998
1021
  })
999
- const { file, json, markdown, repo, scope, time } = cli.flags
1022
+ const { file, json, markdown } = cli.flags
1023
+
1024
+ // In v1 mode support:
1025
+ // - [] (no args)
1026
+ // - ['org']
1027
+ // - ['org', '30']
1028
+ // - ['repo', 'name']
1029
+ // - ['repo', 'name', '30']
1030
+ // - ['30']
1031
+ // Validate final values in the next step
1032
+ let scope = 'org'
1033
+ let time = shadowNpmInject.isTestingV1() ? '7' : 7
1034
+ let repoName = ''
1035
+ if (shadowNpmInject.isTestingV1()) {
1036
+ if (cli.input[0] === 'org') {
1037
+ if (cli.input[1]) {
1038
+ time = cli.input[1]
1039
+ }
1040
+ } else if (cli.input[0] === 'repo') {
1041
+ scope = 'repo'
1042
+ if (cli.input[1]) {
1043
+ repoName = cli.input[1]
1044
+ }
1045
+ if (cli.input[2]) {
1046
+ time = cli.input[2]
1047
+ }
1048
+ } else if (cli.input[0]) {
1049
+ time = cli.input[0]
1050
+ }
1051
+ } else {
1052
+ if (cli.flags['scope']) {
1053
+ scope = String(cli.flags['scope'] || '')
1054
+ }
1055
+ if (scope === 'repo') {
1056
+ repoName = String(cli.flags['repoName'] || '')
1057
+ }
1058
+ if (cli.flags['time']) {
1059
+ time = Number(cli.flags['time'] || 7)
1060
+ }
1061
+ }
1000
1062
  const apiToken = shadowNpmInject.getDefaultToken()
1001
1063
  const wasBadInput = handleBadInput(
1002
1064
  {
1065
+ // In v1 this can't go wrong anymore since the unknown value goes to time
1066
+ nook: !shadowNpmInject.isTestingV1(),
1003
1067
  test: scope === 'org' || scope === 'repo',
1004
1068
  message: 'Scope must be "repo" or "org"',
1005
1069
  pass: 'ok',
1006
1070
  fail: 'bad'
1007
1071
  },
1008
1072
  {
1009
- test: time === 7 || time === 30 || time === 90,
1010
- message: 'The time filter must either be 7, 30 or 90',
1073
+ nook: true,
1074
+ test: scope === 'org' || !!repoName,
1075
+ message: shadowNpmInject.isTestingV1()
1076
+ ? 'When scope=repo, repo name should be the second argument'
1077
+ : 'When scope=repo, repo name should be set through --repo',
1011
1078
  pass: 'ok',
1012
- fail: 'bad'
1079
+ fail: 'missing'
1013
1080
  },
1014
1081
  {
1015
1082
  nook: true,
1016
- test: scope === 'org' || !!repo,
1017
- message: 'When scope=repo, repo name should be set through --repo',
1083
+ test:
1084
+ scope === 'org' ||
1085
+ (shadowNpmInject.isTestingV1() &&
1086
+ repoName !== '7' &&
1087
+ repoName !== '30' &&
1088
+ repoName !== '90'),
1089
+ message: 'Missing the repo name as second argument',
1018
1090
  pass: 'ok',
1019
1091
  fail: 'missing'
1020
1092
  },
1093
+ {
1094
+ test: shadowNpmInject.isTestingV1()
1095
+ ? time === '7' || time === '30' || time === '90'
1096
+ : time === 7 || time === 30 || time === 90,
1097
+ message: 'The time filter must either be 7, 30 or 90',
1098
+ pass: 'ok',
1099
+ fail: shadowNpmInject.isTestingV1()
1100
+ ? 'invalid range set, see --help for command arg details.'
1101
+ : 'bad'
1102
+ },
1021
1103
  {
1022
1104
  nook: true,
1023
1105
  test: file === '-' || !!json || !!markdown,
@@ -1050,22 +1132,14 @@ async function run$M(argv, importMeta, { parentName }) {
1050
1132
  logger.logger.log(DRY_RUN_BAIL_TEXT$J)
1051
1133
  return
1052
1134
  }
1053
- assert(assertScope(scope))
1054
- assert(assertTime(time))
1055
1135
  return await displayAnalytics({
1056
1136
  scope,
1057
- time,
1058
- repo: String(repo || ''),
1137
+ time: time === '90' ? 90 : time === '30' ? 30 : 7,
1138
+ repo: repoName,
1059
1139
  outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
1060
1140
  filePath: String(file || '')
1061
1141
  })
1062
1142
  }
1063
- function assertScope(scope) {
1064
- return scope === 'org' || scope === 'repo'
1065
- }
1066
- function assertTime(time) {
1067
- return time === 7 || time === 30 || time === 90
1068
- }
1069
1143
 
1070
1144
  async function fetchAuditLog({ logType, orgSlug, outputKind, page, perPage }) {
1071
1145
  const sockSdk = await shadowNpmInject.setupSdk()
@@ -1222,12 +1296,92 @@ async function handleAuditLog({ logType, orgSlug, outputKind, page, perPage }) {
1222
1296
  })
1223
1297
  }
1224
1298
 
1299
+ async function suggestOrgSlug() {
1300
+ const sockSdk = await shadowNpmInject.setupSdk()
1301
+ const result = await handleApiCall(
1302
+ sockSdk.getOrganizations(),
1303
+ 'looking up organizations'
1304
+ )
1305
+ // Ignore a failed request here. It was not the primary goal of
1306
+ // running this command and reporting it only leads to end-user confusion.
1307
+ if (result.success) {
1308
+ const proceed = await prompts.select({
1309
+ message:
1310
+ 'Missing org name; do you want to use any of these orgs for this scan?',
1311
+ choices: [
1312
+ ...Object.values(result.data.organizations).map(org => {
1313
+ const slug = org.name ?? 'undefined'
1314
+ return {
1315
+ name: `Yes [${slug}]`,
1316
+ value: slug,
1317
+ description: `Use "${slug}" as the organization`
1318
+ }
1319
+ }),
1320
+ {
1321
+ name: 'No',
1322
+ value: '',
1323
+ description:
1324
+ 'Do not use any of these organizations (will end in a no-op)'
1325
+ }
1326
+ ]
1327
+ })
1328
+ if (proceed) {
1329
+ return proceed
1330
+ }
1331
+ } else {
1332
+ logger.logger.fail(
1333
+ 'Failed to lookup organization list from API, unable to suggest'
1334
+ )
1335
+ }
1336
+ }
1337
+
1338
+ async function determineOrgSlug(orgFlag, firstArg, interactive, dryRun) {
1339
+ const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg') || ''
1340
+ let orgSlug = String(orgFlag || defaultOrgSlug || '')
1341
+ if (!orgSlug) {
1342
+ if (shadowNpmInject.isTestingV1()) {
1343
+ // ask from server
1344
+ logger.logger.error(
1345
+ 'Missing the org slug and no --org flag set. Trying to auto-discover the org now...'
1346
+ )
1347
+ logger.logger.error(
1348
+ 'Note: you can set the default org slug to prevent this issue. You can also override all that with the --org flag.'
1349
+ )
1350
+ if (dryRun) {
1351
+ logger.logger.fail('Skipping auto-discovery of org in dry-run mode')
1352
+ } else if (!interactive) {
1353
+ logger.logger.fail(
1354
+ 'Skipping auto-discovery of org when interactive = false'
1355
+ )
1356
+ } else {
1357
+ orgSlug = (await suggestOrgSlug()) || ''
1358
+ }
1359
+ } else {
1360
+ orgSlug = firstArg || ''
1361
+ }
1362
+ }
1363
+ return [orgSlug, defaultOrgSlug]
1364
+ }
1365
+
1225
1366
  const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$I } = constants
1226
1367
  const config$L = {
1227
1368
  commandName: 'audit-log',
1228
1369
  description: 'Look up the audit log for an organization',
1229
1370
  hidden: false,
1230
1371
  flags: {
1372
+ ...commonFlags,
1373
+ ...outputFlags,
1374
+ interactive: {
1375
+ type: 'boolean',
1376
+ default: true,
1377
+ description:
1378
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
1379
+ },
1380
+ org: {
1381
+ type: 'string',
1382
+ description:
1383
+ 'Force override the organization slug, overrides the default org from config'
1384
+ },
1231
1385
  type: {
1232
1386
  type: 'string',
1233
1387
  shortFlag: 't',
@@ -1245,13 +1399,11 @@ const config$L = {
1245
1399
  shortFlag: 'p',
1246
1400
  default: 1,
1247
1401
  description: 'Page number - default is 1'
1248
- },
1249
- ...commonFlags,
1250
- ...outputFlags
1402
+ }
1251
1403
  },
1252
1404
  help: (command, config) => `
1253
1405
  Usage
1254
- $ ${command} <org slug>
1406
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug>'}
1255
1407
 
1256
1408
  API Token Requirements
1257
1409
  - Quota: 1 unit
@@ -1264,7 +1416,7 @@ const config$L = {
1264
1416
  ${getFlagListOutput(config.flags, 6)}
1265
1417
 
1266
1418
  Examples
1267
- $ ${command} FakeOrg
1419
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '' : 'FakeOrg'}
1268
1420
  `
1269
1421
  }
1270
1422
  const cmdAuditLog = {
@@ -1279,15 +1431,31 @@ async function run$L(argv, importMeta, { parentName }) {
1279
1431
  importMeta,
1280
1432
  parentName
1281
1433
  })
1282
- const { json, markdown, page, perPage, type } = cli.flags
1434
+ const {
1435
+ dryRun,
1436
+ interactive,
1437
+ json,
1438
+ markdown,
1439
+ org: orgFlag,
1440
+ page,
1441
+ perPage,
1442
+ type
1443
+ } = cli.flags
1283
1444
  const logType = String(type || '')
1284
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
1285
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
1445
+ const [orgSlug] = await determineOrgSlug(
1446
+ String(orgFlag || ''),
1447
+ cli.input[0] || '',
1448
+ !!interactive,
1449
+ !!dryRun
1450
+ )
1286
1451
  const apiToken = shadowNpmInject.getDefaultToken()
1287
1452
  const wasBadInput = handleBadInput(
1288
1453
  {
1454
+ nook: true,
1289
1455
  test: !!orgSlug,
1290
- message: 'Org name should be the first arg',
1456
+ message: shadowNpmInject.isTestingV1()
1457
+ ? 'Org name by default setting, --org, or auto-discovered'
1458
+ : 'Org name must be the first argument',
1291
1459
  pass: 'ok',
1292
1460
  fail: 'missing'
1293
1461
  },
@@ -1375,7 +1543,7 @@ async function runCycloneDX(yargvWithYes) {
1375
1543
  await shadowBin(NPX$3, [
1376
1544
  ...yesArgs,
1377
1545
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_CYCLONEDX_CDXGEN_VERSION']".
1378
- `@cyclonedx/cdxgen@${'11.2.5'}`,
1546
+ `@cyclonedx/cdxgen@${'11.2.6'}`,
1379
1547
  ...argvToArray(yargv)
1380
1548
  ])
1381
1549
  if (cleanupPackageLock) {
@@ -3598,7 +3766,13 @@ const config$C = {
3598
3766
  'Path to a local file where the output should be saved. Use `-` to force stdout.'
3599
3767
  }
3600
3768
  },
3601
- help: (command, config) => `
3769
+ help: (command, config) =>
3770
+ shadowNpmInject.isTestingV1()
3771
+ ? 'This command will be removed in v1'
3772
+ : `
3773
+ Note: This command is deprecated, to be dropped in the next major bump.
3774
+ Please see \`socket scan diff\`
3775
+
3602
3776
  Usage
3603
3777
  $ ${command} <org slug> --before=<before> --after=<after>
3604
3778
 
@@ -5452,7 +5626,10 @@ const config$A = {
5452
5626
  ...outputFlags,
5453
5627
  ...validationFlags
5454
5628
  },
5455
- help: (command, config) => `
5629
+ help: (command, config) =>
5630
+ shadowNpmInject.isTestingV1()
5631
+ ? 'This command will be removed in v1'
5632
+ : `
5456
5633
  Usage
5457
5634
  $ ${command} <name>
5458
5635
 
@@ -8055,11 +8232,22 @@ const config$m = {
8055
8232
  hidden: true,
8056
8233
  flags: {
8057
8234
  ...commonFlags,
8058
- ...outputFlags
8235
+ ...outputFlags,
8236
+ interactive: {
8237
+ type: 'boolean',
8238
+ default: true,
8239
+ description:
8240
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
8241
+ },
8242
+ org: {
8243
+ type: 'string',
8244
+ description:
8245
+ 'Force override the organization slug, overrides the default org from config'
8246
+ }
8059
8247
  },
8060
8248
  help: (command, _config) => `
8061
8249
  Usage
8062
- $ ${command} <org slug>
8250
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'}
8063
8251
 
8064
8252
  API Token Requirements
8065
8253
  - Quota: 1 unit
@@ -8072,8 +8260,8 @@ const config$m = {
8072
8260
  the request will fail with an authentication error.
8073
8261
 
8074
8262
  Examples
8075
- $ ${command} mycorp
8076
- $ ${command} mycorp --json
8263
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' mycorp'}
8264
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' mycorp'} --json
8077
8265
  `
8078
8266
  }
8079
8267
  const cmdOrganizationPolicyLicense = {
@@ -8088,16 +8276,21 @@ async function run$m(argv, importMeta, { parentName }) {
8088
8276
  importMeta,
8089
8277
  parentName
8090
8278
  })
8091
- const json = Boolean(cli.flags['json'])
8092
- const markdown = Boolean(cli.flags['markdown'])
8093
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
8094
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
8279
+ const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
8280
+ const [orgSlug] = await determineOrgSlug(
8281
+ String(orgFlag || ''),
8282
+ cli.input[0] || '',
8283
+ !!interactive,
8284
+ !!dryRun
8285
+ )
8095
8286
  const apiToken = shadowNpmInject.getDefaultToken()
8096
8287
  const wasBadInput = handleBadInput(
8097
8288
  {
8098
8289
  nook: true,
8099
8290
  test: !!orgSlug,
8100
- message: 'Org name as the first argument',
8291
+ message: shadowNpmInject.isTestingV1()
8292
+ ? 'Org name by default setting, --org, or auto-discovered'
8293
+ : 'Org name must be the first argument',
8101
8294
  pass: 'ok',
8102
8295
  fail: 'missing'
8103
8296
  },
@@ -8197,11 +8390,22 @@ const config$l = {
8197
8390
  hidden: true,
8198
8391
  flags: {
8199
8392
  ...commonFlags,
8200
- ...outputFlags
8393
+ ...outputFlags,
8394
+ interactive: {
8395
+ type: 'boolean',
8396
+ default: true,
8397
+ description:
8398
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
8399
+ },
8400
+ org: {
8401
+ type: 'string',
8402
+ description:
8403
+ 'Force override the organization slug, overrides the default org from config'
8404
+ }
8201
8405
  },
8202
8406
  help: (command, _config) => `
8203
8407
  Usage
8204
- $ ${command} <org slug>
8408
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'}
8205
8409
 
8206
8410
  API Token Requirements
8207
8411
  - Quota: 1 unit
@@ -8214,8 +8418,8 @@ const config$l = {
8214
8418
  the request will fail with an authentication error.
8215
8419
 
8216
8420
  Examples
8217
- $ ${command} mycorp
8218
- $ ${command} mycorp --json
8421
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' mycorp'}
8422
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' mycorp'} --json
8219
8423
  `
8220
8424
  }
8221
8425
  const cmdOrganizationPolicyPolicy = {
@@ -8230,10 +8434,13 @@ async function run$l(argv, importMeta, { parentName }) {
8230
8434
  importMeta,
8231
8435
  parentName
8232
8436
  })
8233
- const json = Boolean(cli.flags['json'])
8234
- const markdown = Boolean(cli.flags['markdown'])
8235
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
8236
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
8437
+ const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
8438
+ const [orgSlug] = await determineOrgSlug(
8439
+ String(orgFlag || ''),
8440
+ cli.input[0] || '',
8441
+ !!interactive,
8442
+ !!dryRun
8443
+ )
8237
8444
  const apiToken = shadowNpmInject.getDefaultToken()
8238
8445
  const wasBadInput = handleBadInput(
8239
8446
  {
@@ -9414,11 +9621,28 @@ const config$d = {
9414
9621
  hidden: false,
9415
9622
  flags: {
9416
9623
  ...commonFlags,
9417
- repoName: {
9624
+ defaultBranch: {
9418
9625
  type: 'string',
9419
- shortFlag: 'n',
9626
+ shortFlag: 'b',
9627
+ default: 'main',
9628
+ description: 'Repository default branch'
9629
+ },
9630
+ homepage: {
9631
+ type: 'string',
9632
+ shortFlag: 'h',
9420
9633
  default: '',
9421
- description: 'Repository name'
9634
+ description: 'Repository url'
9635
+ },
9636
+ interactive: {
9637
+ type: 'boolean',
9638
+ default: true,
9639
+ description:
9640
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
9641
+ },
9642
+ org: {
9643
+ type: 'string',
9644
+ description:
9645
+ 'Force override the organization slug, overrides the default org from config'
9422
9646
  },
9423
9647
  repoDescription: {
9424
9648
  type: 'string',
@@ -9426,17 +9650,11 @@ const config$d = {
9426
9650
  default: '',
9427
9651
  description: 'Repository description'
9428
9652
  },
9429
- homepage: {
9653
+ repoName: {
9430
9654
  type: 'string',
9431
- shortFlag: 'h',
9655
+ shortFlag: 'n',
9432
9656
  default: '',
9433
- description: 'Repository url'
9434
- },
9435
- defaultBranch: {
9436
- type: 'string',
9437
- shortFlag: 'b',
9438
- default: 'main',
9439
- description: 'Repository default branch'
9657
+ description: 'Repository name'
9440
9658
  },
9441
9659
  visibility: {
9442
9660
  type: 'string',
@@ -9447,7 +9665,7 @@ const config$d = {
9447
9665
  },
9448
9666
  help: (command, config) => `
9449
9667
  Usage
9450
- $ ${command} <org slug> --repo-name=<name>
9668
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug> --repo-name=<name>'}
9451
9669
 
9452
9670
  API Token Requirements
9453
9671
  - Quota: 1 unit
@@ -9457,7 +9675,7 @@ const config$d = {
9457
9675
  ${getFlagListOutput(config.flags, 6)}
9458
9676
 
9459
9677
  Examples
9460
- $ ${command} FakeOrg --repoName=test-repo
9678
+ $ ${command} ${shadowNpmInject.isTestingV1() ? 'test-repo' : 'FakeOrg --repoName=test-repo'}
9461
9679
  `
9462
9680
  }
9463
9681
  const cmdReposCreate = {
@@ -9472,21 +9690,36 @@ async function run$d(argv, importMeta, { parentName }) {
9472
9690
  importMeta,
9473
9691
  parentName
9474
9692
  })
9475
- const repoName = cli.flags['repoName']
9476
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
9477
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
9693
+ const {
9694
+ dryRun,
9695
+ interactive,
9696
+ org: orgFlag,
9697
+ repoName: repoNameFlag
9698
+ } = cli.flags
9699
+ const [orgSlug] = await determineOrgSlug(
9700
+ String(orgFlag || ''),
9701
+ cli.input[0] || '',
9702
+ !!interactive,
9703
+ !!dryRun
9704
+ )
9705
+ const repoName =
9706
+ (shadowNpmInject.isTestingV1() ? cli.input[0] : repoNameFlag) || ''
9478
9707
  const apiToken = shadowNpmInject.getDefaultToken()
9479
9708
  const wasBadInput = handleBadInput(
9480
9709
  {
9481
9710
  nook: true,
9482
9711
  test: !!orgSlug,
9483
- message: 'Org name as the first argument',
9712
+ message: shadowNpmInject.isTestingV1()
9713
+ ? 'Org name by default setting, --org, or auto-discovered'
9714
+ : 'Org name must be the first argument',
9484
9715
  pass: 'ok',
9485
9716
  fail: 'missing'
9486
9717
  },
9487
9718
  {
9488
9719
  test: !!repoName,
9489
- message: 'Repository name using --repoNam',
9720
+ message: shadowNpmInject.isTestingV1()
9721
+ ? 'Repository name as first argument'
9722
+ : 'Repository name using --repoName',
9490
9723
  pass: 'ok',
9491
9724
  fail: 'missing'
9492
9725
  },
@@ -9497,12 +9730,19 @@ async function run$d(argv, importMeta, { parentName }) {
9497
9730
  'You need to be logged in to use this command. See `socket login`.',
9498
9731
  pass: 'ok',
9499
9732
  fail: 'missing API token'
9733
+ },
9734
+ {
9735
+ nook: true,
9736
+ test: !shadowNpmInject.isTestingV1() || !repoNameFlag,
9737
+ message: 'In v1 the first arg should be the repo, not the flag',
9738
+ pass: 'ok',
9739
+ fail: 'received --repo-name flag'
9500
9740
  }
9501
9741
  )
9502
9742
  if (wasBadInput) {
9503
9743
  return
9504
9744
  }
9505
- if (cli.flags['dryRun']) {
9745
+ if (dryRun) {
9506
9746
  logger.logger.log(DRY_RUN_BAIL_TEXT$d)
9507
9747
  return
9508
9748
  }
@@ -9538,11 +9778,22 @@ const config$c = {
9538
9778
  description: 'Delete a repository in an organization',
9539
9779
  hidden: false,
9540
9780
  flags: {
9541
- ...commonFlags
9781
+ ...commonFlags,
9782
+ interactive: {
9783
+ type: 'boolean',
9784
+ default: true,
9785
+ description:
9786
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
9787
+ },
9788
+ org: {
9789
+ type: 'string',
9790
+ description:
9791
+ 'Force override the organization slug, overrides the default org from config'
9792
+ }
9542
9793
  },
9543
9794
  help: (command, config) => `
9544
9795
  Usage
9545
- $ ${command} <org slug> <repo slug>
9796
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug> --repo-name=<name>'}
9546
9797
 
9547
9798
  API Token Requirements
9548
9799
  - Quota: 1 unit
@@ -9552,7 +9803,7 @@ const config$c = {
9552
9803
  ${getFlagListOutput(config.flags, 6)}
9553
9804
 
9554
9805
  Examples
9555
- $ ${command} FakeOrg test-repo
9806
+ $ ${command} ${shadowNpmInject.isTestingV1() ? 'test-repo' : 'FakeOrg test-repo'}
9556
9807
  `
9557
9808
  }
9558
9809
  const cmdReposDel = {
@@ -9567,21 +9818,33 @@ async function run$c(argv, importMeta, { parentName }) {
9567
9818
  importMeta,
9568
9819
  parentName
9569
9820
  })
9570
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
9571
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
9572
- const repoName = (defaultOrgSlug ? cli.input[0] : cli.input[1]) || ''
9821
+ const { dryRun, interactive, org: orgFlag } = cli.flags
9822
+ const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
9823
+ String(orgFlag || ''),
9824
+ cli.input[0] || '',
9825
+ !!interactive,
9826
+ !!dryRun
9827
+ )
9828
+ const repoName =
9829
+ (defaultOrgSlug || shadowNpmInject.isTestingV1()
9830
+ ? cli.input[0]
9831
+ : cli.input[1]) || ''
9573
9832
  const apiToken = shadowNpmInject.getDefaultToken()
9574
9833
  const wasBadInput = handleBadInput(
9575
9834
  {
9576
9835
  nook: true,
9577
9836
  test: !!orgSlug,
9578
- message: 'Org name as the first argument',
9837
+ message: shadowNpmInject.isTestingV1()
9838
+ ? 'Org name by default setting, --org, or auto-discovered'
9839
+ : 'Org name must be the first argument',
9579
9840
  pass: 'ok',
9580
9841
  fail: 'missing'
9581
9842
  },
9582
9843
  {
9583
9844
  test: !!repoName,
9584
- message: 'Repository name argument',
9845
+ message: shadowNpmInject.isTestingV1()
9846
+ ? 'Repository name as first argument'
9847
+ : 'Repository name using --repoName',
9585
9848
  pass: 'ok',
9586
9849
  fail: 'missing'
9587
9850
  },
@@ -9597,7 +9860,7 @@ async function run$c(argv, importMeta, { parentName }) {
9597
9860
  if (wasBadInput) {
9598
9861
  return
9599
9862
  }
9600
- if (cli.flags['dryRun']) {
9863
+ if (dryRun) {
9601
9864
  logger.logger.log(DRY_RUN_BAIL_TEXT$c)
9602
9865
  return
9603
9866
  }
@@ -9705,6 +9968,17 @@ const config$b = {
9705
9968
  default: 'desc',
9706
9969
  description: 'Direction option'
9707
9970
  },
9971
+ interactive: {
9972
+ type: 'boolean',
9973
+ default: true,
9974
+ description:
9975
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
9976
+ },
9977
+ org: {
9978
+ type: 'string',
9979
+ description:
9980
+ 'Force override the organization slug, overrides the default org from config'
9981
+ },
9708
9982
  perPage: {
9709
9983
  type: 'number',
9710
9984
  shortFlag: 'pp',
@@ -9721,7 +9995,7 @@ const config$b = {
9721
9995
  },
9722
9996
  help: (command, config) => `
9723
9997
  Usage
9724
- $ ${command} <org slug>
9998
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '' : '<org slug>'}
9725
9999
 
9726
10000
  API Token Requirements
9727
10001
  - Quota: 1 unit
@@ -9731,7 +10005,7 @@ const config$b = {
9731
10005
  ${getFlagListOutput(config.flags, 6)}
9732
10006
 
9733
10007
  Examples
9734
- $ ${command} FakeOrg
10008
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '' : '<org slug>'}
9735
10009
  `
9736
10010
  }
9737
10011
  const cmdReposList = {
@@ -9747,14 +10021,21 @@ async function run$b(argv, importMeta, { parentName }) {
9747
10021
  parentName
9748
10022
  })
9749
10023
  const { json, markdown } = cli.flags
9750
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
9751
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
10024
+ const { dryRun, interactive, org: orgFlag } = cli.flags
10025
+ const [orgSlug] = await determineOrgSlug(
10026
+ String(orgFlag || ''),
10027
+ cli.input[0] || '',
10028
+ !!interactive,
10029
+ !!dryRun
10030
+ )
9752
10031
  const apiToken = shadowNpmInject.getDefaultToken()
9753
10032
  const wasBadInput = handleBadInput(
9754
10033
  {
9755
10034
  nook: true,
9756
10035
  test: !!orgSlug,
9757
- message: 'Org name as the first argument',
10036
+ message: shadowNpmInject.isTestingV1()
10037
+ ? 'Org name by default setting, --org, or auto-discovered'
10038
+ : 'Org name must be the first argument',
9758
10039
  pass: 'ok',
9759
10040
  fail: 'missing'
9760
10041
  },
@@ -9856,6 +10137,29 @@ const config$a = {
9856
10137
  hidden: false,
9857
10138
  flags: {
9858
10139
  ...commonFlags,
10140
+ defaultBranch: {
10141
+ type: 'string',
10142
+ shortFlag: 'b',
10143
+ default: 'main',
10144
+ description: 'Repository default branch'
10145
+ },
10146
+ homepage: {
10147
+ type: 'string',
10148
+ shortFlag: 'h',
10149
+ default: '',
10150
+ description: 'Repository url'
10151
+ },
10152
+ interactive: {
10153
+ type: 'boolean',
10154
+ default: true,
10155
+ description:
10156
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
10157
+ },
10158
+ org: {
10159
+ type: 'string',
10160
+ description:
10161
+ 'Force override the organization slug, overrides the default org from config'
10162
+ },
9859
10163
  repoName: {
9860
10164
  type: 'string',
9861
10165
  shortFlag: 'n',
@@ -9868,18 +10172,6 @@ const config$a = {
9868
10172
  default: '',
9869
10173
  description: 'Repository description'
9870
10174
  },
9871
- homepage: {
9872
- type: 'string',
9873
- shortFlag: 'h',
9874
- default: '',
9875
- description: 'Repository url'
9876
- },
9877
- defaultBranch: {
9878
- type: 'string',
9879
- shortFlag: 'b',
9880
- default: 'main',
9881
- description: 'Repository default branch'
9882
- },
9883
10175
  visibility: {
9884
10176
  type: 'string',
9885
10177
  shortFlag: 'v',
@@ -9889,7 +10181,7 @@ const config$a = {
9889
10181
  },
9890
10182
  help: (command, config) => `
9891
10183
  Usage
9892
- $ ${command} <org slug> --repo-name=<name>
10184
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug> --repo-name=<name>'}
9893
10185
 
9894
10186
  API Token Requirements
9895
10187
  - Quota: 1 unit
@@ -9899,7 +10191,7 @@ const config$a = {
9899
10191
  ${getFlagListOutput(config.flags, 6)}
9900
10192
 
9901
10193
  Examples
9902
- $ ${command} FakeOrg
10194
+ $ ${command} ${shadowNpmInject.isTestingV1() ? 'test-repo' : 'FakeOrg test-repo'}
9903
10195
  `
9904
10196
  }
9905
10197
  const cmdReposUpdate = {
@@ -9914,21 +10206,32 @@ async function run$a(argv, importMeta, { parentName }) {
9914
10206
  importMeta,
9915
10207
  parentName
9916
10208
  })
9917
- const repoName = cli.flags['repoName']
9918
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
9919
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
10209
+ const { dryRun, interactive, org: orgFlag } = cli.flags
10210
+ const [orgSlug] = await determineOrgSlug(
10211
+ String(orgFlag || ''),
10212
+ cli.input[0] || '',
10213
+ !!interactive,
10214
+ !!dryRun
10215
+ )
10216
+ const repoNameFlag = cli.flags['repoName']
10217
+ const repoName =
10218
+ (shadowNpmInject.isTestingV1() ? cli.input[0] : repoNameFlag) || ''
9920
10219
  const apiToken = shadowNpmInject.getDefaultToken()
9921
10220
  const wasBadInput = handleBadInput(
9922
10221
  {
9923
10222
  nook: true,
9924
10223
  test: !!orgSlug,
9925
- message: 'Org name as the first argument',
10224
+ message: shadowNpmInject.isTestingV1()
10225
+ ? 'Org name by default setting, --org, or auto-discovered'
10226
+ : 'Org name must be the first argument',
9926
10227
  pass: 'ok',
9927
10228
  fail: 'missing'
9928
10229
  },
9929
10230
  {
9930
10231
  test: !!repoName,
9931
- message: 'Repository name using --repoName',
10232
+ message: shadowNpmInject.isTestingV1()
10233
+ ? 'Repository name as first argument'
10234
+ : 'Repository name using --repoName',
9932
10235
  pass: 'ok',
9933
10236
  fail: 'missing'
9934
10237
  },
@@ -9939,6 +10242,13 @@ async function run$a(argv, importMeta, { parentName }) {
9939
10242
  'You need to be logged in to use this command. See `socket login`.',
9940
10243
  pass: 'ok',
9941
10244
  fail: 'missing API token'
10245
+ },
10246
+ {
10247
+ nook: true,
10248
+ test: !shadowNpmInject.isTestingV1() || !repoNameFlag,
10249
+ message: 'In v1 the first arg should be the repo, not the flag',
10250
+ pass: 'ok',
10251
+ fail: 'received --repo-name flag'
9942
10252
  }
9943
10253
  )
9944
10254
  if (wasBadInput) {
@@ -10055,6 +10365,17 @@ const config$9 = {
10055
10365
  flags: {
10056
10366
  ...commonFlags,
10057
10367
  ...outputFlags,
10368
+ interactive: {
10369
+ type: 'boolean',
10370
+ default: true,
10371
+ description:
10372
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
10373
+ },
10374
+ org: {
10375
+ type: 'string',
10376
+ description:
10377
+ 'Force override the organization slug, overrides the default org from config'
10378
+ },
10058
10379
  repoName: {
10059
10380
  description: 'The repository to check',
10060
10381
  default: '',
@@ -10063,7 +10384,7 @@ const config$9 = {
10063
10384
  },
10064
10385
  help: (command, config) => `
10065
10386
  Usage
10066
- $ ${command} <org slug> --repo-name=<name>
10387
+ $ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug> --repo-name=<name>'}
10067
10388
 
10068
10389
  API Token Requirements
10069
10390
  - Quota: 1 unit
@@ -10073,7 +10394,7 @@ const config$9 = {
10073
10394
  ${getFlagListOutput(config.flags, 6)}
10074
10395
 
10075
10396
  Examples
10076
- $ ${command} FakeOrg
10397
+ $ ${command} ${shadowNpmInject.isTestingV1() ? 'test-repo' : 'FakeOrg test-repo'}
10077
10398
  `
10078
10399
  }
10079
10400
  const cmdReposView = {
@@ -10088,21 +10409,38 @@ async function run$9(argv, importMeta, { parentName }) {
10088
10409
  importMeta,
10089
10410
  parentName
10090
10411
  })
10091
- const { json, markdown, repoName } = cli.flags
10092
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
10093
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
10412
+ const {
10413
+ dryRun,
10414
+ interactive,
10415
+ json,
10416
+ markdown,
10417
+ org: orgFlag,
10418
+ repoName: repoNameFlag
10419
+ } = cli.flags
10420
+ const [orgSlug] = await determineOrgSlug(
10421
+ String(orgFlag || ''),
10422
+ cli.input[0] || '',
10423
+ !!interactive,
10424
+ !!dryRun
10425
+ )
10426
+ const repoName =
10427
+ (shadowNpmInject.isTestingV1() ? cli.input[0] : repoNameFlag) || ''
10094
10428
  const apiToken = shadowNpmInject.getDefaultToken()
10095
10429
  const wasBadInput = handleBadInput(
10096
10430
  {
10097
10431
  nook: true,
10098
10432
  test: !!orgSlug,
10099
- message: 'Org name as the first argument',
10433
+ message: shadowNpmInject.isTestingV1()
10434
+ ? 'Org name by default setting, --org, or auto-discovered'
10435
+ : 'Org name must be the first argument',
10100
10436
  pass: 'ok',
10101
10437
  fail: 'missing'
10102
10438
  },
10103
10439
  {
10104
10440
  test: !!repoName,
10105
- message: 'Repository name using --repoName',
10441
+ message: shadowNpmInject.isTestingV1()
10442
+ ? 'Repository name as first argument'
10443
+ : 'Repository name using --repoName',
10106
10444
  pass: 'ok',
10107
10445
  fail: 'missing'
10108
10446
  },
@@ -10121,6 +10459,13 @@ async function run$9(argv, importMeta, { parentName }) {
10121
10459
  'You need to be logged in to use this command. See `socket login`.',
10122
10460
  pass: 'ok',
10123
10461
  fail: 'missing API token'
10462
+ },
10463
+ {
10464
+ nook: true,
10465
+ test: !shadowNpmInject.isTestingV1() || !repoNameFlag,
10466
+ message: 'In v1 the first arg should be the repo, not the flag',
10467
+ pass: 'ok',
10468
+ fail: 'received --repo-name flag'
10124
10469
  }
10125
10470
  )
10126
10471
  if (wasBadInput) {
@@ -10159,45 +10504,6 @@ const cmdRepos = {
10159
10504
  }
10160
10505
  }
10161
10506
 
10162
- async function suggestOrgSlug() {
10163
- const sockSdk = await shadowNpmInject.setupSdk()
10164
- const result = await handleApiCall(
10165
- sockSdk.getOrganizations(),
10166
- 'looking up organizations'
10167
- )
10168
- // Ignore a failed request here. It was not the primary goal of
10169
- // running this command and reporting it only leads to end-user confusion.
10170
- if (result.success) {
10171
- const proceed = await prompts.select({
10172
- message:
10173
- 'Missing org name; do you want to use any of these orgs for this scan?',
10174
- choices: [
10175
- ...Object.values(result.data.organizations).map(org => {
10176
- const slug = org.name ?? 'undefined'
10177
- return {
10178
- name: `Yes [${slug}]`,
10179
- value: slug,
10180
- description: `Use "${slug}" as the organization`
10181
- }
10182
- }),
10183
- {
10184
- name: 'No',
10185
- value: '',
10186
- description:
10187
- 'Do not use any of these organizations (will end in a no-op)'
10188
- }
10189
- ]
10190
- })
10191
- if (proceed) {
10192
- return proceed
10193
- }
10194
- } else {
10195
- logger.logger.fail(
10196
- 'Failed to lookup organization list from API, unable to suggest'
10197
- )
10198
- }
10199
- }
10200
-
10201
10507
  async function suggestTarget() {
10202
10508
  // We could prefill this with sub-dirs of the current
10203
10509
  // dir ... but is that going to be useful?
@@ -10281,6 +10587,11 @@ const config$8 = {
10281
10587
  shortFlag: 'pr',
10282
10588
  description: 'Commit hash'
10283
10589
  },
10590
+ org: {
10591
+ type: 'string',
10592
+ description:
10593
+ 'Force override the organization slug, overrides the default org from config'
10594
+ },
10284
10595
  readOnly: {
10285
10596
  type: 'boolean',
10286
10597
  default: false,
@@ -10310,7 +10621,7 @@ const config$8 = {
10310
10621
  // TODO: your project's "socket.yml" file's "projectIgnorePaths"
10311
10622
  help: (command, config) => `
10312
10623
  Usage
10313
- $ ${command} [...options] <org> <TARGET> [TARGET...]
10624
+ $ ${command} [...options]${shadowNpmInject.isTestingV1() ? '' : ' <org>'} <TARGET> [TARGET...]
10314
10625
 
10315
10626
  API Token Requirements
10316
10627
  - Quota: 1 unit
@@ -10343,7 +10654,8 @@ const config$8 = {
10343
10654
  ${getFlagListOutput(config.flags, 6)}
10344
10655
 
10345
10656
  Examples
10346
- $ ${command} --repo=test-repo --branch=main FakeOrg ./package.json
10657
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} .
10658
+ $ ${command} --repo=test-repo --branch=main${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} ./package.json
10347
10659
  `
10348
10660
  }
10349
10661
  const cmdScanCreate = {
@@ -10365,10 +10677,11 @@ async function run$8(argv, importMeta, { parentName }) {
10365
10677
  committers,
10366
10678
  cwd: cwdOverride,
10367
10679
  defaultBranch,
10368
- dryRun,
10680
+ dryRun = false,
10369
10681
  interactive = true,
10370
10682
  json,
10371
10683
  markdown,
10684
+ org: orgFlag,
10372
10685
  pendingHead,
10373
10686
  pullRequest,
10374
10687
  readOnly,
@@ -10376,9 +10689,19 @@ async function run$8(argv, importMeta, { parentName }) {
10376
10689
  report,
10377
10690
  tmp
10378
10691
  } = cli.flags
10379
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
10380
- let orgSlug = defaultOrgSlug || cli.input[0] || ''
10381
- let targets = cli.input.slice(defaultOrgSlug ? 0 : 1)
10692
+ let [orgSlug, defaultOrgSlug] = await determineOrgSlug(
10693
+ String(orgFlag || ''),
10694
+ cli.input[0] || '',
10695
+ interactive,
10696
+ dryRun
10697
+ )
10698
+ if (!defaultOrgSlug) {
10699
+ // Tmp. just for TS. will drop this later.
10700
+ defaultOrgSlug = ''
10701
+ }
10702
+ let targets = cli.input.slice(
10703
+ shadowNpmInject.isTestingV1() || defaultOrgSlug ? 0 : 1
10704
+ )
10382
10705
  const cwd =
10383
10706
  cwdOverride && cwdOverride !== 'process.cwd()'
10384
10707
  ? String(cwdOverride)
@@ -10422,9 +10745,11 @@ async function run$8(argv, importMeta, { parentName }) {
10422
10745
  }
10423
10746
  const wasBadInput = handleBadInput(
10424
10747
  {
10425
- nook: !!defaultOrgSlug,
10748
+ nook: !shadowNpmInject.isTestingV1() && !!defaultOrgSlug,
10426
10749
  test: !!orgSlug && orgSlug !== '.',
10427
- message: 'Org name as the first argument',
10750
+ message: shadowNpmInject.isTestingV1()
10751
+ ? 'Org name by default setting, --org, or auto-discovered'
10752
+ : 'Org name must be the first argument',
10428
10753
  pass: 'ok',
10429
10754
  fail:
10430
10755
  orgSlug === '.'
@@ -10538,11 +10863,22 @@ const config$7 = {
10538
10863
  hidden: false,
10539
10864
  flags: {
10540
10865
  ...commonFlags,
10541
- ...outputFlags
10866
+ ...outputFlags,
10867
+ interactive: {
10868
+ type: 'boolean',
10869
+ default: true,
10870
+ description:
10871
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
10872
+ },
10873
+ org: {
10874
+ type: 'string',
10875
+ description:
10876
+ 'Force override the organization slug, overrides the default org from config'
10877
+ }
10542
10878
  },
10543
10879
  help: (command, config) => `
10544
10880
  Usage
10545
- $ ${command} <org slug> <scan ID>
10881
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <scan ID>
10546
10882
 
10547
10883
  API Token Requirements
10548
10884
  - Quota: 1 unit
@@ -10552,7 +10888,7 @@ const config$7 = {
10552
10888
  ${getFlagListOutput(config.flags, 6)}
10553
10889
 
10554
10890
  Examples
10555
- $ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0
10891
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0
10556
10892
  `
10557
10893
  }
10558
10894
  const cmdScanDel = {
@@ -10567,15 +10903,25 @@ async function run$7(argv, importMeta, { parentName }) {
10567
10903
  importMeta,
10568
10904
  parentName
10569
10905
  })
10570
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
10571
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
10572
- const scanId = (defaultOrgSlug ? cli.input[0] : cli.input[1]) || ''
10906
+ const { dryRun, interactive, org: orgFlag } = cli.flags
10907
+ const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
10908
+ String(orgFlag || ''),
10909
+ cli.input[0] || '',
10910
+ !!interactive,
10911
+ !!dryRun
10912
+ )
10913
+ const scanId =
10914
+ (shadowNpmInject.isTestingV1() || defaultOrgSlug
10915
+ ? cli.input[0]
10916
+ : cli.input[1]) || ''
10573
10917
  const apiToken = shadowNpmInject.getDefaultToken()
10574
10918
  const wasBadInput = handleBadInput(
10575
10919
  {
10576
10920
  nook: !!defaultOrgSlug,
10577
10921
  test: !!orgSlug && orgSlug !== '.',
10578
- message: 'Org name as the first argument',
10922
+ message: shadowNpmInject.isTestingV1()
10923
+ ? 'Org name by default setting, --org, or auto-discovered'
10924
+ : 'Org name must be the first argument',
10579
10925
  pass: 'ok',
10580
10926
  fail:
10581
10927
  orgSlug === '.'
@@ -10860,11 +11206,22 @@ const config$6 = {
10860
11206
  default: '',
10861
11207
  description:
10862
11208
  'Path to a local file where the output should be saved. Use `-` to force stdout.'
11209
+ },
11210
+ interactive: {
11211
+ type: 'boolean',
11212
+ default: true,
11213
+ description:
11214
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
11215
+ },
11216
+ org: {
11217
+ type: 'string',
11218
+ description:
11219
+ 'Force override the organization slug, overrides the default org from config'
10863
11220
  }
10864
11221
  },
10865
11222
  help: (command, config) => `
10866
11223
  Usage
10867
- $ ${command} <org slug> <ID1> <ID2>
11224
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <ID1> <ID2>
10868
11225
 
10869
11226
  API Token Requirements
10870
11227
  - Quota: 1 unit
@@ -10881,8 +11238,8 @@ const config$6 = {
10881
11238
  ${getFlagListOutput(config.flags, 6)}
10882
11239
 
10883
11240
  Examples
10884
- $ ${command} FakeCorp aaa0aa0a-aaaa-0000-0a0a-0000000a00a0 aaa1aa1a-aaaa-1111-1a1a-1111111a11a1
10885
- $ ${command} FakeCorp aaa0aa0a-aaaa-0000-0a0a-0000000a00a0 aaa1aa1a-aaaa-1111-1a1a-1111111a11a1 --json
11241
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} aaa0aa0a-aaaa-0000-0a0a-0000000a00a0 aaa1aa1a-aaaa-1111-1a1a-1111111a11a1
11242
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} aaa0aa0a-aaaa-0000-0a0a-0000000a00a0 aaa1aa1a-aaaa-1111-1a1a-1111111a11a1 --json
10886
11243
  `
10887
11244
  }
10888
11245
  const cmdScanDiff = {
@@ -10897,9 +11254,21 @@ async function run$6(argv, importMeta, { parentName }) {
10897
11254
  importMeta,
10898
11255
  parentName
10899
11256
  })
10900
- const { depth, file, json, markdown } = cli.flags
10901
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
10902
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
11257
+ const {
11258
+ depth,
11259
+ dryRun,
11260
+ file,
11261
+ interactive,
11262
+ json,
11263
+ markdown,
11264
+ org: orgFlag
11265
+ } = cli.flags
11266
+ const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
11267
+ String(orgFlag || ''),
11268
+ cli.input[0] || '',
11269
+ !!interactive,
11270
+ !!dryRun
11271
+ )
10903
11272
  let id1 = cli.input[defaultOrgSlug ? 0 : 1] || ''
10904
11273
  let id2 = cli.input[defaultOrgSlug ? 1 : 2] || ''
10905
11274
  if (id1.startsWith(SOCKET_SBOM_URL_PREFIX)) {
@@ -10925,7 +11294,9 @@ async function run$6(argv, importMeta, { parentName }) {
10925
11294
  {
10926
11295
  test: !!orgSlug,
10927
11296
  nook: true,
10928
- message: 'Org name as the first argument',
11297
+ message: shadowNpmInject.isTestingV1()
11298
+ ? 'Org name by default setting, --org, or auto-discovered'
11299
+ : 'Org name must be the first argument',
10929
11300
  pass: 'ok',
10930
11301
  fail: 'missing'
10931
11302
  },
@@ -11106,6 +11477,12 @@ const config$5 = {
11106
11477
  default: '',
11107
11478
  description: 'From time - as a unix timestamp'
11108
11479
  },
11480
+ interactive: {
11481
+ type: 'boolean',
11482
+ default: true,
11483
+ description:
11484
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
11485
+ },
11109
11486
  page: {
11110
11487
  type: 'number',
11111
11488
  shortFlag: 'p',
@@ -11118,6 +11495,11 @@ const config$5 = {
11118
11495
  default: 30,
11119
11496
  description: 'Results per page - Default is 30'
11120
11497
  },
11498
+ org: {
11499
+ type: 'string',
11500
+ description:
11501
+ 'Force override the organization slug, overrides the default org from config'
11502
+ },
11121
11503
  repo: {
11122
11504
  type: 'string',
11123
11505
  description: 'Filter to show only scans with this repository name'
@@ -11138,7 +11520,7 @@ const config$5 = {
11138
11520
  },
11139
11521
  help: (command, config) => `
11140
11522
  Usage
11141
- $ ${command} <org slug>
11523
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'}
11142
11524
 
11143
11525
  API Token Requirements
11144
11526
  - Quota: 1 unit
@@ -11148,7 +11530,7 @@ const config$5 = {
11148
11530
  ${getFlagListOutput(config.flags, 6)}
11149
11531
 
11150
11532
  Examples
11151
- $ ${command} FakeOrg
11533
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'}
11152
11534
  `
11153
11535
  }
11154
11536
  const cmdScanList = {
@@ -11163,15 +11545,29 @@ async function run$5(argv, importMeta, { parentName }) {
11163
11545
  importMeta,
11164
11546
  parentName
11165
11547
  })
11166
- const { branch, json, markdown, repo } = cli.flags
11167
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
11168
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
11548
+ const {
11549
+ branch,
11550
+ dryRun,
11551
+ interactive,
11552
+ json,
11553
+ markdown,
11554
+ org: orgFlag,
11555
+ repo
11556
+ } = cli.flags
11557
+ const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
11558
+ String(orgFlag || ''),
11559
+ cli.input[0] || '',
11560
+ !!interactive,
11561
+ !!dryRun
11562
+ )
11169
11563
  const apiToken = shadowNpmInject.getDefaultToken()
11170
11564
  const wasBadInput = handleBadInput(
11171
11565
  {
11172
11566
  nook: !!defaultOrgSlug,
11173
11567
  test: !!orgSlug && orgSlug !== '.',
11174
- message: 'Org name as the first argument',
11568
+ message: shadowNpmInject.isTestingV1()
11569
+ ? 'Org name by default setting, --org, or auto-discovered'
11570
+ : 'Org name must be the first argument',
11175
11571
  pass: 'ok',
11176
11572
  fail:
11177
11573
  orgSlug === '.'
@@ -11282,11 +11678,22 @@ const config$4 = {
11282
11678
  hidden: false,
11283
11679
  flags: {
11284
11680
  ...commonFlags,
11285
- ...outputFlags
11681
+ ...outputFlags,
11682
+ interactive: {
11683
+ type: 'boolean',
11684
+ default: true,
11685
+ description:
11686
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
11687
+ },
11688
+ org: {
11689
+ type: 'string',
11690
+ description:
11691
+ 'Force override the organization slug, overrides the default org from config'
11692
+ }
11286
11693
  },
11287
11694
  help: (command, config) => `
11288
11695
  Usage
11289
- $ ${command} <org slug> <scan ID>
11696
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <scan ID>
11290
11697
 
11291
11698
  API Token Requirements
11292
11699
  - Quota: 1 unit
@@ -11296,7 +11703,7 @@ const config$4 = {
11296
11703
  ${getFlagListOutput(config.flags, 6)}
11297
11704
 
11298
11705
  Examples
11299
- $ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0
11706
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0
11300
11707
  `
11301
11708
  }
11302
11709
  const cmdScanMetadata = {
@@ -11311,16 +11718,25 @@ async function run$4(argv, importMeta, { parentName }) {
11311
11718
  importMeta,
11312
11719
  parentName
11313
11720
  })
11314
- const { json, markdown } = cli.flags
11315
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
11316
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
11317
- const scanId = (defaultOrgSlug ? cli.input[0] : cli.input[1]) || ''
11721
+ const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
11722
+ const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
11723
+ String(orgFlag || ''),
11724
+ cli.input[0] || '',
11725
+ !!interactive,
11726
+ !!dryRun
11727
+ )
11728
+ const scanId =
11729
+ (shadowNpmInject.isTestingV1() || defaultOrgSlug
11730
+ ? cli.input[0]
11731
+ : cli.input[1]) || ''
11318
11732
  const apiToken = shadowNpmInject.getDefaultToken()
11319
11733
  const wasBadInput = handleBadInput(
11320
11734
  {
11321
11735
  nook: !!defaultOrgSlug,
11322
11736
  test: !!orgSlug && orgSlug !== '.',
11323
- message: 'Org name as the first argument',
11737
+ message: shadowNpmInject.isTestingV1()
11738
+ ? 'Org name by default setting, --org, or auto-discovered'
11739
+ : 'Org name must be the first argument',
11324
11740
  pass: 'ok',
11325
11741
  fail:
11326
11742
  orgSlug === '.'
@@ -11377,6 +11793,17 @@ const config$3 = {
11377
11793
  default: 'none',
11378
11794
  description: 'Fold reported alerts to some degree'
11379
11795
  },
11796
+ interactive: {
11797
+ type: 'boolean',
11798
+ default: true,
11799
+ description:
11800
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
11801
+ },
11802
+ org: {
11803
+ type: 'string',
11804
+ description:
11805
+ 'Force override the organization slug, overrides the default org from config'
11806
+ },
11380
11807
  reportLevel: {
11381
11808
  type: 'string',
11382
11809
  default: 'warn',
@@ -11395,7 +11822,7 @@ const config$3 = {
11395
11822
  },
11396
11823
  help: (command, config) => `
11397
11824
  Usage
11398
- $ ${command} <org slug> <scan ID> [path to output file]
11825
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <scan ID> [path to output file]
11399
11826
 
11400
11827
  API Token Requirements
11401
11828
  - Quota: 2 units
@@ -11414,8 +11841,8 @@ const config$3 = {
11414
11841
  Short responses: JSON: \`{healthy:bool}\`, markdown: \`healthy = bool\`, text: \`OK/ERR\`
11415
11842
 
11416
11843
  Examples
11417
- $ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0 --json --fold=version
11418
- $ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0 --license --markdown --short
11844
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0 --json --fold=version
11845
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0 --license --markdown --short
11419
11846
  `
11420
11847
  }
11421
11848
  const cmdScanReport = {
@@ -11437,16 +11864,29 @@ async function run$3(argv, importMeta, { parentName }) {
11437
11864
  markdown,
11438
11865
  reportLevel = 'warn'
11439
11866
  } = cli.flags
11440
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
11441
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
11442
- const scanId = (defaultOrgSlug ? cli.input[0] : cli.input[1]) || ''
11443
- const file = (defaultOrgSlug ? cli.input[1] : cli.input[2]) || '-'
11867
+ const { dryRun, interactive, org: orgFlag } = cli.flags
11868
+ const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
11869
+ String(orgFlag || ''),
11870
+ cli.input[0] || '',
11871
+ !!interactive,
11872
+ !!dryRun
11873
+ )
11874
+ const scanId =
11875
+ (shadowNpmInject.isTestingV1() || defaultOrgSlug
11876
+ ? cli.input[0]
11877
+ : cli.input[1]) || ''
11878
+ const file =
11879
+ (shadowNpmInject.isTestingV1() || defaultOrgSlug
11880
+ ? cli.input[1]
11881
+ : cli.input[2]) || '-'
11444
11882
  const apiToken = shadowNpmInject.getDefaultToken()
11445
11883
  const wasBadInput = handleBadInput(
11446
11884
  {
11447
11885
  nook: !!defaultOrgSlug,
11448
11886
  test: !!orgSlug && orgSlug !== '.',
11449
- message: 'Org name as the first argument',
11887
+ message: shadowNpmInject.isTestingV1()
11888
+ ? 'Org name by default setting, --org, or auto-discovered'
11889
+ : 'Org name must be the first argument',
11450
11890
  pass: 'ok',
11451
11891
  fail:
11452
11892
  orgSlug === '.'
@@ -11605,11 +12045,22 @@ const config$2 = {
11605
12045
  hidden: false,
11606
12046
  flags: {
11607
12047
  ...commonFlags,
11608
- ...outputFlags
12048
+ ...outputFlags,
12049
+ interactive: {
12050
+ type: 'boolean',
12051
+ default: true,
12052
+ description:
12053
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
12054
+ },
12055
+ org: {
12056
+ type: 'string',
12057
+ description:
12058
+ 'Force override the organization slug, overrides the default org from config'
12059
+ }
11609
12060
  },
11610
12061
  help: (command, config) => `
11611
12062
  Usage
11612
- $ ${command} <org slug> <scan ID> [path to output file]
12063
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <scan ID> [path to output file]
11613
12064
 
11614
12065
  API Token Requirements
11615
12066
  - Quota: 1 unit
@@ -11621,7 +12072,7 @@ const config$2 = {
11621
12072
  ${getFlagListOutput(config.flags, 6)}
11622
12073
 
11623
12074
  Examples
11624
- $ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0 ./stream.txt
12075
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0 ./stream.txt
11625
12076
  `
11626
12077
  }
11627
12078
  const cmdScanView = {
@@ -11636,17 +12087,29 @@ async function run$2(argv, importMeta, { parentName }) {
11636
12087
  importMeta,
11637
12088
  parentName
11638
12089
  })
11639
- const { json, markdown } = cli.flags
11640
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
11641
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
11642
- const scanId = (defaultOrgSlug ? cli.input[0] : cli.input[1]) || ''
11643
- const file = (defaultOrgSlug ? cli.input[1] : cli.input[2]) || '-'
12090
+ const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
12091
+ const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
12092
+ String(orgFlag || ''),
12093
+ cli.input[0] || '',
12094
+ !!interactive,
12095
+ !!dryRun
12096
+ )
12097
+ const scanId =
12098
+ (shadowNpmInject.isTestingV1() || defaultOrgSlug
12099
+ ? cli.input[0]
12100
+ : cli.input[1]) || ''
12101
+ const file =
12102
+ (shadowNpmInject.isTestingV1() || defaultOrgSlug
12103
+ ? cli.input[1]
12104
+ : cli.input[2]) || '-'
11644
12105
  const apiToken = shadowNpmInject.getDefaultToken()
11645
12106
  const wasBadInput = handleBadInput(
11646
12107
  {
11647
12108
  nook: !!defaultOrgSlug,
11648
12109
  test: !!orgSlug && orgSlug !== '.',
11649
- message: 'Org name as the first argument',
12110
+ message: shadowNpmInject.isTestingV1()
12111
+ ? 'Org name by default setting, --org, or auto-discovered'
12112
+ : 'Org name must be the first argument',
11650
12113
  pass: 'ok',
11651
12114
  fail:
11652
12115
  orgSlug === '.'
@@ -11934,6 +12397,17 @@ const config$1 = {
11934
12397
  flags: {
11935
12398
  ...commonFlags,
11936
12399
  ...outputFlags,
12400
+ interactive: {
12401
+ type: 'boolean',
12402
+ default: true,
12403
+ description:
12404
+ 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
12405
+ },
12406
+ org: {
12407
+ type: 'string',
12408
+ description:
12409
+ 'Force override the organization slug, overrides the default org from config'
12410
+ },
11937
12411
  perPage: {
11938
12412
  type: 'number',
11939
12413
  shortFlag: 'pp',
@@ -11967,7 +12441,7 @@ const config$1 = {
11967
12441
  },
11968
12442
  help: (command, config) => `
11969
12443
  Usage
11970
- $ ${command}
12444
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'}
11971
12445
 
11972
12446
  API Token Requirements
11973
12447
  - Quota: 1 unit
@@ -12004,8 +12478,8 @@ const config$1 = {
12004
12478
  - pypi
12005
12479
 
12006
12480
  Examples
12007
- $ ${command}
12008
- $ ${command} --perPage=5 --page=2 --direction=asc --filter=joke
12481
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'}
12482
+ $ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} --perPage=5 --page=2 --direction=asc --filter=joke
12009
12483
  `
12010
12484
  }
12011
12485
  const cmdThreatFeed = {
@@ -12020,9 +12494,13 @@ async function run$1(argv, importMeta, { parentName }) {
12020
12494
  importMeta,
12021
12495
  parentName
12022
12496
  })
12023
- const { json, markdown } = cli.flags
12024
- const defaultOrgSlug = shadowNpmInject.getConfigValue('defaultOrg')
12025
- const orgSlug = defaultOrgSlug || cli.input[0] || ''
12497
+ const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
12498
+ const [orgSlug] = await determineOrgSlug(
12499
+ String(orgFlag || ''),
12500
+ cli.input[0] || '',
12501
+ !!interactive,
12502
+ !!dryRun
12503
+ )
12026
12504
  const apiToken = shadowNpmInject.getDefaultToken()
12027
12505
  const wasBadInput = handleBadInput(
12028
12506
  {
@@ -12274,7 +12752,7 @@ void (async () => {
12274
12752
  await vendor.updater({
12275
12753
  name: SOCKET_CLI_BIN_NAME,
12276
12754
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
12277
- version: '0.14.148',
12755
+ version: '0.14.150',
12278
12756
  ttl: 86_400_000 /* 24 hours in milliseconds */
12279
12757
  })
12280
12758
  try {
@@ -12342,5 +12820,5 @@ void (async () => {
12342
12820
  await shadowNpmInject.captureException(e)
12343
12821
  }
12344
12822
  })()
12345
- //# debugId=574124cd-9782-42bb-ba9e-f71cc52dd4c3
12823
+ //# debugId=f9eb8bc8-da58-4963-a26b-58b7c8dc44b6
12346
12824
  //# sourceMappingURL=cli.js.map