@socketsecurity/cli-with-sentry 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 +698 -220
- package/dist/cli.js.map +1 -1
- package/dist/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/shadow-npm-inject.js +18 -8
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/vendor.js +18154 -18160
- package/dist/vendor.js.map +1 -1
- package/package.json +22 -22
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,
|
|
37
|
-
const message =
|
|
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.
|
|
905
|
+
const cliVersion = '0.14.150:cc2913a:84ef72e1: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
|
|
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
|
-
|
|
1010
|
-
|
|
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: '
|
|
1079
|
+
fail: 'missing'
|
|
1013
1080
|
},
|
|
1014
1081
|
{
|
|
1015
1082
|
nook: true,
|
|
1016
|
-
test:
|
|
1017
|
-
|
|
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:
|
|
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 {
|
|
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
|
|
1285
|
-
|
|
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:
|
|
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.
|
|
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
|
|
|
@@ -5456,7 +5630,10 @@ const config$A = {
|
|
|
5456
5630
|
...outputFlags,
|
|
5457
5631
|
...validationFlags
|
|
5458
5632
|
},
|
|
5459
|
-
help: (command, config) =>
|
|
5633
|
+
help: (command, config) =>
|
|
5634
|
+
shadowNpmInject.isTestingV1()
|
|
5635
|
+
? 'This command will be removed in v1'
|
|
5636
|
+
: `
|
|
5460
5637
|
Usage
|
|
5461
5638
|
$ ${command} <name>
|
|
5462
5639
|
|
|
@@ -8059,11 +8236,22 @@ const config$m = {
|
|
|
8059
8236
|
hidden: true,
|
|
8060
8237
|
flags: {
|
|
8061
8238
|
...commonFlags,
|
|
8062
|
-
...outputFlags
|
|
8239
|
+
...outputFlags,
|
|
8240
|
+
interactive: {
|
|
8241
|
+
type: 'boolean',
|
|
8242
|
+
default: true,
|
|
8243
|
+
description:
|
|
8244
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
8245
|
+
},
|
|
8246
|
+
org: {
|
|
8247
|
+
type: 'string',
|
|
8248
|
+
description:
|
|
8249
|
+
'Force override the organization slug, overrides the default org from config'
|
|
8250
|
+
}
|
|
8063
8251
|
},
|
|
8064
8252
|
help: (command, _config) => `
|
|
8065
8253
|
Usage
|
|
8066
|
-
$ ${command} <org slug>
|
|
8254
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'}
|
|
8067
8255
|
|
|
8068
8256
|
API Token Requirements
|
|
8069
8257
|
- Quota: 1 unit
|
|
@@ -8076,8 +8264,8 @@ const config$m = {
|
|
|
8076
8264
|
the request will fail with an authentication error.
|
|
8077
8265
|
|
|
8078
8266
|
Examples
|
|
8079
|
-
$ ${command} mycorp
|
|
8080
|
-
$ ${command} mycorp --json
|
|
8267
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' mycorp'}
|
|
8268
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' mycorp'} --json
|
|
8081
8269
|
`
|
|
8082
8270
|
}
|
|
8083
8271
|
const cmdOrganizationPolicyLicense = {
|
|
@@ -8092,16 +8280,21 @@ async function run$m(argv, importMeta, { parentName }) {
|
|
|
8092
8280
|
importMeta,
|
|
8093
8281
|
parentName
|
|
8094
8282
|
})
|
|
8095
|
-
const json =
|
|
8096
|
-
const
|
|
8097
|
-
|
|
8098
|
-
|
|
8283
|
+
const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
|
|
8284
|
+
const [orgSlug] = await determineOrgSlug(
|
|
8285
|
+
String(orgFlag || ''),
|
|
8286
|
+
cli.input[0] || '',
|
|
8287
|
+
!!interactive,
|
|
8288
|
+
!!dryRun
|
|
8289
|
+
)
|
|
8099
8290
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
8100
8291
|
const wasBadInput = handleBadInput(
|
|
8101
8292
|
{
|
|
8102
8293
|
nook: true,
|
|
8103
8294
|
test: !!orgSlug,
|
|
8104
|
-
message:
|
|
8295
|
+
message: shadowNpmInject.isTestingV1()
|
|
8296
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
8297
|
+
: 'Org name must be the first argument',
|
|
8105
8298
|
pass: 'ok',
|
|
8106
8299
|
fail: 'missing'
|
|
8107
8300
|
},
|
|
@@ -8201,11 +8394,22 @@ const config$l = {
|
|
|
8201
8394
|
hidden: true,
|
|
8202
8395
|
flags: {
|
|
8203
8396
|
...commonFlags,
|
|
8204
|
-
...outputFlags
|
|
8397
|
+
...outputFlags,
|
|
8398
|
+
interactive: {
|
|
8399
|
+
type: 'boolean',
|
|
8400
|
+
default: true,
|
|
8401
|
+
description:
|
|
8402
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
8403
|
+
},
|
|
8404
|
+
org: {
|
|
8405
|
+
type: 'string',
|
|
8406
|
+
description:
|
|
8407
|
+
'Force override the organization slug, overrides the default org from config'
|
|
8408
|
+
}
|
|
8205
8409
|
},
|
|
8206
8410
|
help: (command, _config) => `
|
|
8207
8411
|
Usage
|
|
8208
|
-
$ ${command} <org slug>
|
|
8412
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'}
|
|
8209
8413
|
|
|
8210
8414
|
API Token Requirements
|
|
8211
8415
|
- Quota: 1 unit
|
|
@@ -8218,8 +8422,8 @@ const config$l = {
|
|
|
8218
8422
|
the request will fail with an authentication error.
|
|
8219
8423
|
|
|
8220
8424
|
Examples
|
|
8221
|
-
$ ${command} mycorp
|
|
8222
|
-
$ ${command} mycorp --json
|
|
8425
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' mycorp'}
|
|
8426
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' mycorp'} --json
|
|
8223
8427
|
`
|
|
8224
8428
|
}
|
|
8225
8429
|
const cmdOrganizationPolicyPolicy = {
|
|
@@ -8234,10 +8438,13 @@ async function run$l(argv, importMeta, { parentName }) {
|
|
|
8234
8438
|
importMeta,
|
|
8235
8439
|
parentName
|
|
8236
8440
|
})
|
|
8237
|
-
const json =
|
|
8238
|
-
const
|
|
8239
|
-
|
|
8240
|
-
|
|
8441
|
+
const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
|
|
8442
|
+
const [orgSlug] = await determineOrgSlug(
|
|
8443
|
+
String(orgFlag || ''),
|
|
8444
|
+
cli.input[0] || '',
|
|
8445
|
+
!!interactive,
|
|
8446
|
+
!!dryRun
|
|
8447
|
+
)
|
|
8241
8448
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
8242
8449
|
const wasBadInput = handleBadInput(
|
|
8243
8450
|
{
|
|
@@ -9418,11 +9625,28 @@ const config$d = {
|
|
|
9418
9625
|
hidden: false,
|
|
9419
9626
|
flags: {
|
|
9420
9627
|
...commonFlags,
|
|
9421
|
-
|
|
9628
|
+
defaultBranch: {
|
|
9422
9629
|
type: 'string',
|
|
9423
|
-
shortFlag: '
|
|
9630
|
+
shortFlag: 'b',
|
|
9631
|
+
default: 'main',
|
|
9632
|
+
description: 'Repository default branch'
|
|
9633
|
+
},
|
|
9634
|
+
homepage: {
|
|
9635
|
+
type: 'string',
|
|
9636
|
+
shortFlag: 'h',
|
|
9424
9637
|
default: '',
|
|
9425
|
-
description: 'Repository
|
|
9638
|
+
description: 'Repository url'
|
|
9639
|
+
},
|
|
9640
|
+
interactive: {
|
|
9641
|
+
type: 'boolean',
|
|
9642
|
+
default: true,
|
|
9643
|
+
description:
|
|
9644
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
9645
|
+
},
|
|
9646
|
+
org: {
|
|
9647
|
+
type: 'string',
|
|
9648
|
+
description:
|
|
9649
|
+
'Force override the organization slug, overrides the default org from config'
|
|
9426
9650
|
},
|
|
9427
9651
|
repoDescription: {
|
|
9428
9652
|
type: 'string',
|
|
@@ -9430,17 +9654,11 @@ const config$d = {
|
|
|
9430
9654
|
default: '',
|
|
9431
9655
|
description: 'Repository description'
|
|
9432
9656
|
},
|
|
9433
|
-
|
|
9657
|
+
repoName: {
|
|
9434
9658
|
type: 'string',
|
|
9435
|
-
shortFlag: '
|
|
9659
|
+
shortFlag: 'n',
|
|
9436
9660
|
default: '',
|
|
9437
|
-
description: 'Repository
|
|
9438
|
-
},
|
|
9439
|
-
defaultBranch: {
|
|
9440
|
-
type: 'string',
|
|
9441
|
-
shortFlag: 'b',
|
|
9442
|
-
default: 'main',
|
|
9443
|
-
description: 'Repository default branch'
|
|
9661
|
+
description: 'Repository name'
|
|
9444
9662
|
},
|
|
9445
9663
|
visibility: {
|
|
9446
9664
|
type: 'string',
|
|
@@ -9451,7 +9669,7 @@ const config$d = {
|
|
|
9451
9669
|
},
|
|
9452
9670
|
help: (command, config) => `
|
|
9453
9671
|
Usage
|
|
9454
|
-
$ ${command} <org slug> --repo-name=<name>
|
|
9672
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug> --repo-name=<name>'}
|
|
9455
9673
|
|
|
9456
9674
|
API Token Requirements
|
|
9457
9675
|
- Quota: 1 unit
|
|
@@ -9461,7 +9679,7 @@ const config$d = {
|
|
|
9461
9679
|
${getFlagListOutput(config.flags, 6)}
|
|
9462
9680
|
|
|
9463
9681
|
Examples
|
|
9464
|
-
$ ${command} FakeOrg --repoName=test-repo
|
|
9682
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? 'test-repo' : 'FakeOrg --repoName=test-repo'}
|
|
9465
9683
|
`
|
|
9466
9684
|
}
|
|
9467
9685
|
const cmdReposCreate = {
|
|
@@ -9476,21 +9694,36 @@ async function run$d(argv, importMeta, { parentName }) {
|
|
|
9476
9694
|
importMeta,
|
|
9477
9695
|
parentName
|
|
9478
9696
|
})
|
|
9479
|
-
const
|
|
9480
|
-
|
|
9481
|
-
|
|
9697
|
+
const {
|
|
9698
|
+
dryRun,
|
|
9699
|
+
interactive,
|
|
9700
|
+
org: orgFlag,
|
|
9701
|
+
repoName: repoNameFlag
|
|
9702
|
+
} = cli.flags
|
|
9703
|
+
const [orgSlug] = await determineOrgSlug(
|
|
9704
|
+
String(orgFlag || ''),
|
|
9705
|
+
cli.input[0] || '',
|
|
9706
|
+
!!interactive,
|
|
9707
|
+
!!dryRun
|
|
9708
|
+
)
|
|
9709
|
+
const repoName =
|
|
9710
|
+
(shadowNpmInject.isTestingV1() ? cli.input[0] : repoNameFlag) || ''
|
|
9482
9711
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
9483
9712
|
const wasBadInput = handleBadInput(
|
|
9484
9713
|
{
|
|
9485
9714
|
nook: true,
|
|
9486
9715
|
test: !!orgSlug,
|
|
9487
|
-
message:
|
|
9716
|
+
message: shadowNpmInject.isTestingV1()
|
|
9717
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
9718
|
+
: 'Org name must be the first argument',
|
|
9488
9719
|
pass: 'ok',
|
|
9489
9720
|
fail: 'missing'
|
|
9490
9721
|
},
|
|
9491
9722
|
{
|
|
9492
9723
|
test: !!repoName,
|
|
9493
|
-
message:
|
|
9724
|
+
message: shadowNpmInject.isTestingV1()
|
|
9725
|
+
? 'Repository name as first argument'
|
|
9726
|
+
: 'Repository name using --repoName',
|
|
9494
9727
|
pass: 'ok',
|
|
9495
9728
|
fail: 'missing'
|
|
9496
9729
|
},
|
|
@@ -9501,12 +9734,19 @@ async function run$d(argv, importMeta, { parentName }) {
|
|
|
9501
9734
|
'You need to be logged in to use this command. See `socket login`.',
|
|
9502
9735
|
pass: 'ok',
|
|
9503
9736
|
fail: 'missing API token'
|
|
9737
|
+
},
|
|
9738
|
+
{
|
|
9739
|
+
nook: true,
|
|
9740
|
+
test: !shadowNpmInject.isTestingV1() || !repoNameFlag,
|
|
9741
|
+
message: 'In v1 the first arg should be the repo, not the flag',
|
|
9742
|
+
pass: 'ok',
|
|
9743
|
+
fail: 'received --repo-name flag'
|
|
9504
9744
|
}
|
|
9505
9745
|
)
|
|
9506
9746
|
if (wasBadInput) {
|
|
9507
9747
|
return
|
|
9508
9748
|
}
|
|
9509
|
-
if (
|
|
9749
|
+
if (dryRun) {
|
|
9510
9750
|
logger.logger.log(DRY_RUN_BAIL_TEXT$d)
|
|
9511
9751
|
return
|
|
9512
9752
|
}
|
|
@@ -9542,11 +9782,22 @@ const config$c = {
|
|
|
9542
9782
|
description: 'Delete a repository in an organization',
|
|
9543
9783
|
hidden: false,
|
|
9544
9784
|
flags: {
|
|
9545
|
-
...commonFlags
|
|
9785
|
+
...commonFlags,
|
|
9786
|
+
interactive: {
|
|
9787
|
+
type: 'boolean',
|
|
9788
|
+
default: true,
|
|
9789
|
+
description:
|
|
9790
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
9791
|
+
},
|
|
9792
|
+
org: {
|
|
9793
|
+
type: 'string',
|
|
9794
|
+
description:
|
|
9795
|
+
'Force override the organization slug, overrides the default org from config'
|
|
9796
|
+
}
|
|
9546
9797
|
},
|
|
9547
9798
|
help: (command, config) => `
|
|
9548
9799
|
Usage
|
|
9549
|
-
$ ${command} <org slug>
|
|
9800
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug> --repo-name=<name>'}
|
|
9550
9801
|
|
|
9551
9802
|
API Token Requirements
|
|
9552
9803
|
- Quota: 1 unit
|
|
@@ -9556,7 +9807,7 @@ const config$c = {
|
|
|
9556
9807
|
${getFlagListOutput(config.flags, 6)}
|
|
9557
9808
|
|
|
9558
9809
|
Examples
|
|
9559
|
-
$ ${command} FakeOrg test-repo
|
|
9810
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? 'test-repo' : 'FakeOrg test-repo'}
|
|
9560
9811
|
`
|
|
9561
9812
|
}
|
|
9562
9813
|
const cmdReposDel = {
|
|
@@ -9571,21 +9822,33 @@ async function run$c(argv, importMeta, { parentName }) {
|
|
|
9571
9822
|
importMeta,
|
|
9572
9823
|
parentName
|
|
9573
9824
|
})
|
|
9574
|
-
const
|
|
9575
|
-
const orgSlug
|
|
9576
|
-
|
|
9825
|
+
const { dryRun, interactive, org: orgFlag } = cli.flags
|
|
9826
|
+
const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
9827
|
+
String(orgFlag || ''),
|
|
9828
|
+
cli.input[0] || '',
|
|
9829
|
+
!!interactive,
|
|
9830
|
+
!!dryRun
|
|
9831
|
+
)
|
|
9832
|
+
const repoName =
|
|
9833
|
+
(defaultOrgSlug || shadowNpmInject.isTestingV1()
|
|
9834
|
+
? cli.input[0]
|
|
9835
|
+
: cli.input[1]) || ''
|
|
9577
9836
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
9578
9837
|
const wasBadInput = handleBadInput(
|
|
9579
9838
|
{
|
|
9580
9839
|
nook: true,
|
|
9581
9840
|
test: !!orgSlug,
|
|
9582
|
-
message:
|
|
9841
|
+
message: shadowNpmInject.isTestingV1()
|
|
9842
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
9843
|
+
: 'Org name must be the first argument',
|
|
9583
9844
|
pass: 'ok',
|
|
9584
9845
|
fail: 'missing'
|
|
9585
9846
|
},
|
|
9586
9847
|
{
|
|
9587
9848
|
test: !!repoName,
|
|
9588
|
-
message:
|
|
9849
|
+
message: shadowNpmInject.isTestingV1()
|
|
9850
|
+
? 'Repository name as first argument'
|
|
9851
|
+
: 'Repository name using --repoName',
|
|
9589
9852
|
pass: 'ok',
|
|
9590
9853
|
fail: 'missing'
|
|
9591
9854
|
},
|
|
@@ -9601,7 +9864,7 @@ async function run$c(argv, importMeta, { parentName }) {
|
|
|
9601
9864
|
if (wasBadInput) {
|
|
9602
9865
|
return
|
|
9603
9866
|
}
|
|
9604
|
-
if (
|
|
9867
|
+
if (dryRun) {
|
|
9605
9868
|
logger.logger.log(DRY_RUN_BAIL_TEXT$c)
|
|
9606
9869
|
return
|
|
9607
9870
|
}
|
|
@@ -9709,6 +9972,17 @@ const config$b = {
|
|
|
9709
9972
|
default: 'desc',
|
|
9710
9973
|
description: 'Direction option'
|
|
9711
9974
|
},
|
|
9975
|
+
interactive: {
|
|
9976
|
+
type: 'boolean',
|
|
9977
|
+
default: true,
|
|
9978
|
+
description:
|
|
9979
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
9980
|
+
},
|
|
9981
|
+
org: {
|
|
9982
|
+
type: 'string',
|
|
9983
|
+
description:
|
|
9984
|
+
'Force override the organization slug, overrides the default org from config'
|
|
9985
|
+
},
|
|
9712
9986
|
perPage: {
|
|
9713
9987
|
type: 'number',
|
|
9714
9988
|
shortFlag: 'pp',
|
|
@@ -9725,7 +9999,7 @@ const config$b = {
|
|
|
9725
9999
|
},
|
|
9726
10000
|
help: (command, config) => `
|
|
9727
10001
|
Usage
|
|
9728
|
-
$ ${command} <org slug>
|
|
10002
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? '' : '<org slug>'}
|
|
9729
10003
|
|
|
9730
10004
|
API Token Requirements
|
|
9731
10005
|
- Quota: 1 unit
|
|
@@ -9735,7 +10009,7 @@ const config$b = {
|
|
|
9735
10009
|
${getFlagListOutput(config.flags, 6)}
|
|
9736
10010
|
|
|
9737
10011
|
Examples
|
|
9738
|
-
$ ${command}
|
|
10012
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? '' : '<org slug>'}
|
|
9739
10013
|
`
|
|
9740
10014
|
}
|
|
9741
10015
|
const cmdReposList = {
|
|
@@ -9751,14 +10025,21 @@ async function run$b(argv, importMeta, { parentName }) {
|
|
|
9751
10025
|
parentName
|
|
9752
10026
|
})
|
|
9753
10027
|
const { json, markdown } = cli.flags
|
|
9754
|
-
const
|
|
9755
|
-
const orgSlug =
|
|
10028
|
+
const { dryRun, interactive, org: orgFlag } = cli.flags
|
|
10029
|
+
const [orgSlug] = await determineOrgSlug(
|
|
10030
|
+
String(orgFlag || ''),
|
|
10031
|
+
cli.input[0] || '',
|
|
10032
|
+
!!interactive,
|
|
10033
|
+
!!dryRun
|
|
10034
|
+
)
|
|
9756
10035
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
9757
10036
|
const wasBadInput = handleBadInput(
|
|
9758
10037
|
{
|
|
9759
10038
|
nook: true,
|
|
9760
10039
|
test: !!orgSlug,
|
|
9761
|
-
message:
|
|
10040
|
+
message: shadowNpmInject.isTestingV1()
|
|
10041
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
10042
|
+
: 'Org name must be the first argument',
|
|
9762
10043
|
pass: 'ok',
|
|
9763
10044
|
fail: 'missing'
|
|
9764
10045
|
},
|
|
@@ -9860,6 +10141,29 @@ const config$a = {
|
|
|
9860
10141
|
hidden: false,
|
|
9861
10142
|
flags: {
|
|
9862
10143
|
...commonFlags,
|
|
10144
|
+
defaultBranch: {
|
|
10145
|
+
type: 'string',
|
|
10146
|
+
shortFlag: 'b',
|
|
10147
|
+
default: 'main',
|
|
10148
|
+
description: 'Repository default branch'
|
|
10149
|
+
},
|
|
10150
|
+
homepage: {
|
|
10151
|
+
type: 'string',
|
|
10152
|
+
shortFlag: 'h',
|
|
10153
|
+
default: '',
|
|
10154
|
+
description: 'Repository url'
|
|
10155
|
+
},
|
|
10156
|
+
interactive: {
|
|
10157
|
+
type: 'boolean',
|
|
10158
|
+
default: true,
|
|
10159
|
+
description:
|
|
10160
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
10161
|
+
},
|
|
10162
|
+
org: {
|
|
10163
|
+
type: 'string',
|
|
10164
|
+
description:
|
|
10165
|
+
'Force override the organization slug, overrides the default org from config'
|
|
10166
|
+
},
|
|
9863
10167
|
repoName: {
|
|
9864
10168
|
type: 'string',
|
|
9865
10169
|
shortFlag: 'n',
|
|
@@ -9872,18 +10176,6 @@ const config$a = {
|
|
|
9872
10176
|
default: '',
|
|
9873
10177
|
description: 'Repository description'
|
|
9874
10178
|
},
|
|
9875
|
-
homepage: {
|
|
9876
|
-
type: 'string',
|
|
9877
|
-
shortFlag: 'h',
|
|
9878
|
-
default: '',
|
|
9879
|
-
description: 'Repository url'
|
|
9880
|
-
},
|
|
9881
|
-
defaultBranch: {
|
|
9882
|
-
type: 'string',
|
|
9883
|
-
shortFlag: 'b',
|
|
9884
|
-
default: 'main',
|
|
9885
|
-
description: 'Repository default branch'
|
|
9886
|
-
},
|
|
9887
10179
|
visibility: {
|
|
9888
10180
|
type: 'string',
|
|
9889
10181
|
shortFlag: 'v',
|
|
@@ -9893,7 +10185,7 @@ const config$a = {
|
|
|
9893
10185
|
},
|
|
9894
10186
|
help: (command, config) => `
|
|
9895
10187
|
Usage
|
|
9896
|
-
$ ${command} <org slug> --repo-name=<name>
|
|
10188
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug> --repo-name=<name>'}
|
|
9897
10189
|
|
|
9898
10190
|
API Token Requirements
|
|
9899
10191
|
- Quota: 1 unit
|
|
@@ -9903,7 +10195,7 @@ const config$a = {
|
|
|
9903
10195
|
${getFlagListOutput(config.flags, 6)}
|
|
9904
10196
|
|
|
9905
10197
|
Examples
|
|
9906
|
-
$ ${command} FakeOrg
|
|
10198
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? 'test-repo' : 'FakeOrg test-repo'}
|
|
9907
10199
|
`
|
|
9908
10200
|
}
|
|
9909
10201
|
const cmdReposUpdate = {
|
|
@@ -9918,21 +10210,32 @@ async function run$a(argv, importMeta, { parentName }) {
|
|
|
9918
10210
|
importMeta,
|
|
9919
10211
|
parentName
|
|
9920
10212
|
})
|
|
9921
|
-
const
|
|
9922
|
-
const
|
|
9923
|
-
|
|
10213
|
+
const { dryRun, interactive, org: orgFlag } = cli.flags
|
|
10214
|
+
const [orgSlug] = await determineOrgSlug(
|
|
10215
|
+
String(orgFlag || ''),
|
|
10216
|
+
cli.input[0] || '',
|
|
10217
|
+
!!interactive,
|
|
10218
|
+
!!dryRun
|
|
10219
|
+
)
|
|
10220
|
+
const repoNameFlag = cli.flags['repoName']
|
|
10221
|
+
const repoName =
|
|
10222
|
+
(shadowNpmInject.isTestingV1() ? cli.input[0] : repoNameFlag) || ''
|
|
9924
10223
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
9925
10224
|
const wasBadInput = handleBadInput(
|
|
9926
10225
|
{
|
|
9927
10226
|
nook: true,
|
|
9928
10227
|
test: !!orgSlug,
|
|
9929
|
-
message:
|
|
10228
|
+
message: shadowNpmInject.isTestingV1()
|
|
10229
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
10230
|
+
: 'Org name must be the first argument',
|
|
9930
10231
|
pass: 'ok',
|
|
9931
10232
|
fail: 'missing'
|
|
9932
10233
|
},
|
|
9933
10234
|
{
|
|
9934
10235
|
test: !!repoName,
|
|
9935
|
-
message:
|
|
10236
|
+
message: shadowNpmInject.isTestingV1()
|
|
10237
|
+
? 'Repository name as first argument'
|
|
10238
|
+
: 'Repository name using --repoName',
|
|
9936
10239
|
pass: 'ok',
|
|
9937
10240
|
fail: 'missing'
|
|
9938
10241
|
},
|
|
@@ -9943,6 +10246,13 @@ async function run$a(argv, importMeta, { parentName }) {
|
|
|
9943
10246
|
'You need to be logged in to use this command. See `socket login`.',
|
|
9944
10247
|
pass: 'ok',
|
|
9945
10248
|
fail: 'missing API token'
|
|
10249
|
+
},
|
|
10250
|
+
{
|
|
10251
|
+
nook: true,
|
|
10252
|
+
test: !shadowNpmInject.isTestingV1() || !repoNameFlag,
|
|
10253
|
+
message: 'In v1 the first arg should be the repo, not the flag',
|
|
10254
|
+
pass: 'ok',
|
|
10255
|
+
fail: 'received --repo-name flag'
|
|
9946
10256
|
}
|
|
9947
10257
|
)
|
|
9948
10258
|
if (wasBadInput) {
|
|
@@ -10059,6 +10369,17 @@ const config$9 = {
|
|
|
10059
10369
|
flags: {
|
|
10060
10370
|
...commonFlags,
|
|
10061
10371
|
...outputFlags,
|
|
10372
|
+
interactive: {
|
|
10373
|
+
type: 'boolean',
|
|
10374
|
+
default: true,
|
|
10375
|
+
description:
|
|
10376
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
10377
|
+
},
|
|
10378
|
+
org: {
|
|
10379
|
+
type: 'string',
|
|
10380
|
+
description:
|
|
10381
|
+
'Force override the organization slug, overrides the default org from config'
|
|
10382
|
+
},
|
|
10062
10383
|
repoName: {
|
|
10063
10384
|
description: 'The repository to check',
|
|
10064
10385
|
default: '',
|
|
@@ -10067,7 +10388,7 @@ const config$9 = {
|
|
|
10067
10388
|
},
|
|
10068
10389
|
help: (command, config) => `
|
|
10069
10390
|
Usage
|
|
10070
|
-
$ ${command} <org slug> --repo-name=<name>
|
|
10391
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? '<repo>' : '<org slug> --repo-name=<name>'}
|
|
10071
10392
|
|
|
10072
10393
|
API Token Requirements
|
|
10073
10394
|
- Quota: 1 unit
|
|
@@ -10077,7 +10398,7 @@ const config$9 = {
|
|
|
10077
10398
|
${getFlagListOutput(config.flags, 6)}
|
|
10078
10399
|
|
|
10079
10400
|
Examples
|
|
10080
|
-
$ ${command} FakeOrg
|
|
10401
|
+
$ ${command} ${shadowNpmInject.isTestingV1() ? 'test-repo' : 'FakeOrg test-repo'}
|
|
10081
10402
|
`
|
|
10082
10403
|
}
|
|
10083
10404
|
const cmdReposView = {
|
|
@@ -10092,21 +10413,38 @@ async function run$9(argv, importMeta, { parentName }) {
|
|
|
10092
10413
|
importMeta,
|
|
10093
10414
|
parentName
|
|
10094
10415
|
})
|
|
10095
|
-
const {
|
|
10096
|
-
|
|
10097
|
-
|
|
10416
|
+
const {
|
|
10417
|
+
dryRun,
|
|
10418
|
+
interactive,
|
|
10419
|
+
json,
|
|
10420
|
+
markdown,
|
|
10421
|
+
org: orgFlag,
|
|
10422
|
+
repoName: repoNameFlag
|
|
10423
|
+
} = cli.flags
|
|
10424
|
+
const [orgSlug] = await determineOrgSlug(
|
|
10425
|
+
String(orgFlag || ''),
|
|
10426
|
+
cli.input[0] || '',
|
|
10427
|
+
!!interactive,
|
|
10428
|
+
!!dryRun
|
|
10429
|
+
)
|
|
10430
|
+
const repoName =
|
|
10431
|
+
(shadowNpmInject.isTestingV1() ? cli.input[0] : repoNameFlag) || ''
|
|
10098
10432
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
10099
10433
|
const wasBadInput = handleBadInput(
|
|
10100
10434
|
{
|
|
10101
10435
|
nook: true,
|
|
10102
10436
|
test: !!orgSlug,
|
|
10103
|
-
message:
|
|
10437
|
+
message: shadowNpmInject.isTestingV1()
|
|
10438
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
10439
|
+
: 'Org name must be the first argument',
|
|
10104
10440
|
pass: 'ok',
|
|
10105
10441
|
fail: 'missing'
|
|
10106
10442
|
},
|
|
10107
10443
|
{
|
|
10108
10444
|
test: !!repoName,
|
|
10109
|
-
message:
|
|
10445
|
+
message: shadowNpmInject.isTestingV1()
|
|
10446
|
+
? 'Repository name as first argument'
|
|
10447
|
+
: 'Repository name using --repoName',
|
|
10110
10448
|
pass: 'ok',
|
|
10111
10449
|
fail: 'missing'
|
|
10112
10450
|
},
|
|
@@ -10125,6 +10463,13 @@ async function run$9(argv, importMeta, { parentName }) {
|
|
|
10125
10463
|
'You need to be logged in to use this command. See `socket login`.',
|
|
10126
10464
|
pass: 'ok',
|
|
10127
10465
|
fail: 'missing API token'
|
|
10466
|
+
},
|
|
10467
|
+
{
|
|
10468
|
+
nook: true,
|
|
10469
|
+
test: !shadowNpmInject.isTestingV1() || !repoNameFlag,
|
|
10470
|
+
message: 'In v1 the first arg should be the repo, not the flag',
|
|
10471
|
+
pass: 'ok',
|
|
10472
|
+
fail: 'received --repo-name flag'
|
|
10128
10473
|
}
|
|
10129
10474
|
)
|
|
10130
10475
|
if (wasBadInput) {
|
|
@@ -10163,45 +10508,6 @@ const cmdRepos = {
|
|
|
10163
10508
|
}
|
|
10164
10509
|
}
|
|
10165
10510
|
|
|
10166
|
-
async function suggestOrgSlug() {
|
|
10167
|
-
const sockSdk = await shadowNpmInject.setupSdk()
|
|
10168
|
-
const result = await handleApiCall(
|
|
10169
|
-
sockSdk.getOrganizations(),
|
|
10170
|
-
'looking up organizations'
|
|
10171
|
-
)
|
|
10172
|
-
// Ignore a failed request here. It was not the primary goal of
|
|
10173
|
-
// running this command and reporting it only leads to end-user confusion.
|
|
10174
|
-
if (result.success) {
|
|
10175
|
-
const proceed = await prompts.select({
|
|
10176
|
-
message:
|
|
10177
|
-
'Missing org name; do you want to use any of these orgs for this scan?',
|
|
10178
|
-
choices: [
|
|
10179
|
-
...Object.values(result.data.organizations).map(org => {
|
|
10180
|
-
const slug = org.name ?? 'undefined'
|
|
10181
|
-
return {
|
|
10182
|
-
name: `Yes [${slug}]`,
|
|
10183
|
-
value: slug,
|
|
10184
|
-
description: `Use "${slug}" as the organization`
|
|
10185
|
-
}
|
|
10186
|
-
}),
|
|
10187
|
-
{
|
|
10188
|
-
name: 'No',
|
|
10189
|
-
value: '',
|
|
10190
|
-
description:
|
|
10191
|
-
'Do not use any of these organizations (will end in a no-op)'
|
|
10192
|
-
}
|
|
10193
|
-
]
|
|
10194
|
-
})
|
|
10195
|
-
if (proceed) {
|
|
10196
|
-
return proceed
|
|
10197
|
-
}
|
|
10198
|
-
} else {
|
|
10199
|
-
logger.logger.fail(
|
|
10200
|
-
'Failed to lookup organization list from API, unable to suggest'
|
|
10201
|
-
)
|
|
10202
|
-
}
|
|
10203
|
-
}
|
|
10204
|
-
|
|
10205
10511
|
async function suggestTarget() {
|
|
10206
10512
|
// We could prefill this with sub-dirs of the current
|
|
10207
10513
|
// dir ... but is that going to be useful?
|
|
@@ -10285,6 +10591,11 @@ const config$8 = {
|
|
|
10285
10591
|
shortFlag: 'pr',
|
|
10286
10592
|
description: 'Commit hash'
|
|
10287
10593
|
},
|
|
10594
|
+
org: {
|
|
10595
|
+
type: 'string',
|
|
10596
|
+
description:
|
|
10597
|
+
'Force override the organization slug, overrides the default org from config'
|
|
10598
|
+
},
|
|
10288
10599
|
readOnly: {
|
|
10289
10600
|
type: 'boolean',
|
|
10290
10601
|
default: false,
|
|
@@ -10314,7 +10625,7 @@ const config$8 = {
|
|
|
10314
10625
|
// TODO: your project's "socket.yml" file's "projectIgnorePaths"
|
|
10315
10626
|
help: (command, config) => `
|
|
10316
10627
|
Usage
|
|
10317
|
-
$ ${command} [...options] <org> <TARGET> [TARGET...]
|
|
10628
|
+
$ ${command} [...options]${shadowNpmInject.isTestingV1() ? '' : ' <org>'} <TARGET> [TARGET...]
|
|
10318
10629
|
|
|
10319
10630
|
API Token Requirements
|
|
10320
10631
|
- Quota: 1 unit
|
|
@@ -10347,7 +10658,8 @@ const config$8 = {
|
|
|
10347
10658
|
${getFlagListOutput(config.flags, 6)}
|
|
10348
10659
|
|
|
10349
10660
|
Examples
|
|
10350
|
-
$ ${command}
|
|
10661
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} .
|
|
10662
|
+
$ ${command} --repo=test-repo --branch=main${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} ./package.json
|
|
10351
10663
|
`
|
|
10352
10664
|
}
|
|
10353
10665
|
const cmdScanCreate = {
|
|
@@ -10369,10 +10681,11 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10369
10681
|
committers,
|
|
10370
10682
|
cwd: cwdOverride,
|
|
10371
10683
|
defaultBranch,
|
|
10372
|
-
dryRun,
|
|
10684
|
+
dryRun = false,
|
|
10373
10685
|
interactive = true,
|
|
10374
10686
|
json,
|
|
10375
10687
|
markdown,
|
|
10688
|
+
org: orgFlag,
|
|
10376
10689
|
pendingHead,
|
|
10377
10690
|
pullRequest,
|
|
10378
10691
|
readOnly,
|
|
@@ -10380,9 +10693,19 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10380
10693
|
report,
|
|
10381
10694
|
tmp
|
|
10382
10695
|
} = cli.flags
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10696
|
+
let [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
10697
|
+
String(orgFlag || ''),
|
|
10698
|
+
cli.input[0] || '',
|
|
10699
|
+
interactive,
|
|
10700
|
+
dryRun
|
|
10701
|
+
)
|
|
10702
|
+
if (!defaultOrgSlug) {
|
|
10703
|
+
// Tmp. just for TS. will drop this later.
|
|
10704
|
+
defaultOrgSlug = ''
|
|
10705
|
+
}
|
|
10706
|
+
let targets = cli.input.slice(
|
|
10707
|
+
shadowNpmInject.isTestingV1() || defaultOrgSlug ? 0 : 1
|
|
10708
|
+
)
|
|
10386
10709
|
const cwd =
|
|
10387
10710
|
cwdOverride && cwdOverride !== 'process.cwd()'
|
|
10388
10711
|
? String(cwdOverride)
|
|
@@ -10426,9 +10749,11 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10426
10749
|
}
|
|
10427
10750
|
const wasBadInput = handleBadInput(
|
|
10428
10751
|
{
|
|
10429
|
-
nook: !!defaultOrgSlug,
|
|
10752
|
+
nook: !shadowNpmInject.isTestingV1() && !!defaultOrgSlug,
|
|
10430
10753
|
test: !!orgSlug && orgSlug !== '.',
|
|
10431
|
-
message:
|
|
10754
|
+
message: shadowNpmInject.isTestingV1()
|
|
10755
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
10756
|
+
: 'Org name must be the first argument',
|
|
10432
10757
|
pass: 'ok',
|
|
10433
10758
|
fail:
|
|
10434
10759
|
orgSlug === '.'
|
|
@@ -10542,11 +10867,22 @@ const config$7 = {
|
|
|
10542
10867
|
hidden: false,
|
|
10543
10868
|
flags: {
|
|
10544
10869
|
...commonFlags,
|
|
10545
|
-
...outputFlags
|
|
10870
|
+
...outputFlags,
|
|
10871
|
+
interactive: {
|
|
10872
|
+
type: 'boolean',
|
|
10873
|
+
default: true,
|
|
10874
|
+
description:
|
|
10875
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
10876
|
+
},
|
|
10877
|
+
org: {
|
|
10878
|
+
type: 'string',
|
|
10879
|
+
description:
|
|
10880
|
+
'Force override the organization slug, overrides the default org from config'
|
|
10881
|
+
}
|
|
10546
10882
|
},
|
|
10547
10883
|
help: (command, config) => `
|
|
10548
10884
|
Usage
|
|
10549
|
-
$ ${command} <org slug> <scan ID>
|
|
10885
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <scan ID>
|
|
10550
10886
|
|
|
10551
10887
|
API Token Requirements
|
|
10552
10888
|
- Quota: 1 unit
|
|
@@ -10556,7 +10892,7 @@ const config$7 = {
|
|
|
10556
10892
|
${getFlagListOutput(config.flags, 6)}
|
|
10557
10893
|
|
|
10558
10894
|
Examples
|
|
10559
|
-
$ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0
|
|
10895
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0
|
|
10560
10896
|
`
|
|
10561
10897
|
}
|
|
10562
10898
|
const cmdScanDel = {
|
|
@@ -10571,15 +10907,25 @@ async function run$7(argv, importMeta, { parentName }) {
|
|
|
10571
10907
|
importMeta,
|
|
10572
10908
|
parentName
|
|
10573
10909
|
})
|
|
10574
|
-
const
|
|
10575
|
-
const orgSlug
|
|
10576
|
-
|
|
10910
|
+
const { dryRun, interactive, org: orgFlag } = cli.flags
|
|
10911
|
+
const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
10912
|
+
String(orgFlag || ''),
|
|
10913
|
+
cli.input[0] || '',
|
|
10914
|
+
!!interactive,
|
|
10915
|
+
!!dryRun
|
|
10916
|
+
)
|
|
10917
|
+
const scanId =
|
|
10918
|
+
(shadowNpmInject.isTestingV1() || defaultOrgSlug
|
|
10919
|
+
? cli.input[0]
|
|
10920
|
+
: cli.input[1]) || ''
|
|
10577
10921
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
10578
10922
|
const wasBadInput = handleBadInput(
|
|
10579
10923
|
{
|
|
10580
10924
|
nook: !!defaultOrgSlug,
|
|
10581
10925
|
test: !!orgSlug && orgSlug !== '.',
|
|
10582
|
-
message:
|
|
10926
|
+
message: shadowNpmInject.isTestingV1()
|
|
10927
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
10928
|
+
: 'Org name must be the first argument',
|
|
10583
10929
|
pass: 'ok',
|
|
10584
10930
|
fail:
|
|
10585
10931
|
orgSlug === '.'
|
|
@@ -10864,11 +11210,22 @@ const config$6 = {
|
|
|
10864
11210
|
default: '',
|
|
10865
11211
|
description:
|
|
10866
11212
|
'Path to a local file where the output should be saved. Use `-` to force stdout.'
|
|
11213
|
+
},
|
|
11214
|
+
interactive: {
|
|
11215
|
+
type: 'boolean',
|
|
11216
|
+
default: true,
|
|
11217
|
+
description:
|
|
11218
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
11219
|
+
},
|
|
11220
|
+
org: {
|
|
11221
|
+
type: 'string',
|
|
11222
|
+
description:
|
|
11223
|
+
'Force override the organization slug, overrides the default org from config'
|
|
10867
11224
|
}
|
|
10868
11225
|
},
|
|
10869
11226
|
help: (command, config) => `
|
|
10870
11227
|
Usage
|
|
10871
|
-
$ ${command} <org slug> <ID1> <ID2>
|
|
11228
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <ID1> <ID2>
|
|
10872
11229
|
|
|
10873
11230
|
API Token Requirements
|
|
10874
11231
|
- Quota: 1 unit
|
|
@@ -10885,8 +11242,8 @@ const config$6 = {
|
|
|
10885
11242
|
${getFlagListOutput(config.flags, 6)}
|
|
10886
11243
|
|
|
10887
11244
|
Examples
|
|
10888
|
-
$ ${command}
|
|
10889
|
-
$ ${command}
|
|
11245
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} aaa0aa0a-aaaa-0000-0a0a-0000000a00a0 aaa1aa1a-aaaa-1111-1a1a-1111111a11a1
|
|
11246
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} aaa0aa0a-aaaa-0000-0a0a-0000000a00a0 aaa1aa1a-aaaa-1111-1a1a-1111111a11a1 --json
|
|
10890
11247
|
`
|
|
10891
11248
|
}
|
|
10892
11249
|
const cmdScanDiff = {
|
|
@@ -10901,9 +11258,21 @@ async function run$6(argv, importMeta, { parentName }) {
|
|
|
10901
11258
|
importMeta,
|
|
10902
11259
|
parentName
|
|
10903
11260
|
})
|
|
10904
|
-
const {
|
|
10905
|
-
|
|
10906
|
-
|
|
11261
|
+
const {
|
|
11262
|
+
depth,
|
|
11263
|
+
dryRun,
|
|
11264
|
+
file,
|
|
11265
|
+
interactive,
|
|
11266
|
+
json,
|
|
11267
|
+
markdown,
|
|
11268
|
+
org: orgFlag
|
|
11269
|
+
} = cli.flags
|
|
11270
|
+
const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
11271
|
+
String(orgFlag || ''),
|
|
11272
|
+
cli.input[0] || '',
|
|
11273
|
+
!!interactive,
|
|
11274
|
+
!!dryRun
|
|
11275
|
+
)
|
|
10907
11276
|
let id1 = cli.input[defaultOrgSlug ? 0 : 1] || ''
|
|
10908
11277
|
let id2 = cli.input[defaultOrgSlug ? 1 : 2] || ''
|
|
10909
11278
|
if (id1.startsWith(SOCKET_SBOM_URL_PREFIX)) {
|
|
@@ -10929,7 +11298,9 @@ async function run$6(argv, importMeta, { parentName }) {
|
|
|
10929
11298
|
{
|
|
10930
11299
|
test: !!orgSlug,
|
|
10931
11300
|
nook: true,
|
|
10932
|
-
message:
|
|
11301
|
+
message: shadowNpmInject.isTestingV1()
|
|
11302
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
11303
|
+
: 'Org name must be the first argument',
|
|
10933
11304
|
pass: 'ok',
|
|
10934
11305
|
fail: 'missing'
|
|
10935
11306
|
},
|
|
@@ -11110,6 +11481,12 @@ const config$5 = {
|
|
|
11110
11481
|
default: '',
|
|
11111
11482
|
description: 'From time - as a unix timestamp'
|
|
11112
11483
|
},
|
|
11484
|
+
interactive: {
|
|
11485
|
+
type: 'boolean',
|
|
11486
|
+
default: true,
|
|
11487
|
+
description:
|
|
11488
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
11489
|
+
},
|
|
11113
11490
|
page: {
|
|
11114
11491
|
type: 'number',
|
|
11115
11492
|
shortFlag: 'p',
|
|
@@ -11122,6 +11499,11 @@ const config$5 = {
|
|
|
11122
11499
|
default: 30,
|
|
11123
11500
|
description: 'Results per page - Default is 30'
|
|
11124
11501
|
},
|
|
11502
|
+
org: {
|
|
11503
|
+
type: 'string',
|
|
11504
|
+
description:
|
|
11505
|
+
'Force override the organization slug, overrides the default org from config'
|
|
11506
|
+
},
|
|
11125
11507
|
repo: {
|
|
11126
11508
|
type: 'string',
|
|
11127
11509
|
description: 'Filter to show only scans with this repository name'
|
|
@@ -11142,7 +11524,7 @@ const config$5 = {
|
|
|
11142
11524
|
},
|
|
11143
11525
|
help: (command, config) => `
|
|
11144
11526
|
Usage
|
|
11145
|
-
$ ${command} <org slug>
|
|
11527
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'}
|
|
11146
11528
|
|
|
11147
11529
|
API Token Requirements
|
|
11148
11530
|
- Quota: 1 unit
|
|
@@ -11152,7 +11534,7 @@ const config$5 = {
|
|
|
11152
11534
|
${getFlagListOutput(config.flags, 6)}
|
|
11153
11535
|
|
|
11154
11536
|
Examples
|
|
11155
|
-
$ ${command} FakeOrg
|
|
11537
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'}
|
|
11156
11538
|
`
|
|
11157
11539
|
}
|
|
11158
11540
|
const cmdScanList = {
|
|
@@ -11167,15 +11549,29 @@ async function run$5(argv, importMeta, { parentName }) {
|
|
|
11167
11549
|
importMeta,
|
|
11168
11550
|
parentName
|
|
11169
11551
|
})
|
|
11170
|
-
const {
|
|
11171
|
-
|
|
11172
|
-
|
|
11552
|
+
const {
|
|
11553
|
+
branch,
|
|
11554
|
+
dryRun,
|
|
11555
|
+
interactive,
|
|
11556
|
+
json,
|
|
11557
|
+
markdown,
|
|
11558
|
+
org: orgFlag,
|
|
11559
|
+
repo
|
|
11560
|
+
} = cli.flags
|
|
11561
|
+
const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
11562
|
+
String(orgFlag || ''),
|
|
11563
|
+
cli.input[0] || '',
|
|
11564
|
+
!!interactive,
|
|
11565
|
+
!!dryRun
|
|
11566
|
+
)
|
|
11173
11567
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
11174
11568
|
const wasBadInput = handleBadInput(
|
|
11175
11569
|
{
|
|
11176
11570
|
nook: !!defaultOrgSlug,
|
|
11177
11571
|
test: !!orgSlug && orgSlug !== '.',
|
|
11178
|
-
message:
|
|
11572
|
+
message: shadowNpmInject.isTestingV1()
|
|
11573
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
11574
|
+
: 'Org name must be the first argument',
|
|
11179
11575
|
pass: 'ok',
|
|
11180
11576
|
fail:
|
|
11181
11577
|
orgSlug === '.'
|
|
@@ -11286,11 +11682,22 @@ const config$4 = {
|
|
|
11286
11682
|
hidden: false,
|
|
11287
11683
|
flags: {
|
|
11288
11684
|
...commonFlags,
|
|
11289
|
-
...outputFlags
|
|
11685
|
+
...outputFlags,
|
|
11686
|
+
interactive: {
|
|
11687
|
+
type: 'boolean',
|
|
11688
|
+
default: true,
|
|
11689
|
+
description:
|
|
11690
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
11691
|
+
},
|
|
11692
|
+
org: {
|
|
11693
|
+
type: 'string',
|
|
11694
|
+
description:
|
|
11695
|
+
'Force override the organization slug, overrides the default org from config'
|
|
11696
|
+
}
|
|
11290
11697
|
},
|
|
11291
11698
|
help: (command, config) => `
|
|
11292
11699
|
Usage
|
|
11293
|
-
$ ${command} <org slug> <scan ID>
|
|
11700
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <scan ID>
|
|
11294
11701
|
|
|
11295
11702
|
API Token Requirements
|
|
11296
11703
|
- Quota: 1 unit
|
|
@@ -11300,7 +11707,7 @@ const config$4 = {
|
|
|
11300
11707
|
${getFlagListOutput(config.flags, 6)}
|
|
11301
11708
|
|
|
11302
11709
|
Examples
|
|
11303
|
-
$ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0
|
|
11710
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0
|
|
11304
11711
|
`
|
|
11305
11712
|
}
|
|
11306
11713
|
const cmdScanMetadata = {
|
|
@@ -11315,16 +11722,25 @@ async function run$4(argv, importMeta, { parentName }) {
|
|
|
11315
11722
|
importMeta,
|
|
11316
11723
|
parentName
|
|
11317
11724
|
})
|
|
11318
|
-
const { json, markdown } = cli.flags
|
|
11319
|
-
const defaultOrgSlug =
|
|
11320
|
-
|
|
11321
|
-
|
|
11725
|
+
const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
|
|
11726
|
+
const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
11727
|
+
String(orgFlag || ''),
|
|
11728
|
+
cli.input[0] || '',
|
|
11729
|
+
!!interactive,
|
|
11730
|
+
!!dryRun
|
|
11731
|
+
)
|
|
11732
|
+
const scanId =
|
|
11733
|
+
(shadowNpmInject.isTestingV1() || defaultOrgSlug
|
|
11734
|
+
? cli.input[0]
|
|
11735
|
+
: cli.input[1]) || ''
|
|
11322
11736
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
11323
11737
|
const wasBadInput = handleBadInput(
|
|
11324
11738
|
{
|
|
11325
11739
|
nook: !!defaultOrgSlug,
|
|
11326
11740
|
test: !!orgSlug && orgSlug !== '.',
|
|
11327
|
-
message:
|
|
11741
|
+
message: shadowNpmInject.isTestingV1()
|
|
11742
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
11743
|
+
: 'Org name must be the first argument',
|
|
11328
11744
|
pass: 'ok',
|
|
11329
11745
|
fail:
|
|
11330
11746
|
orgSlug === '.'
|
|
@@ -11381,6 +11797,17 @@ const config$3 = {
|
|
|
11381
11797
|
default: 'none',
|
|
11382
11798
|
description: 'Fold reported alerts to some degree'
|
|
11383
11799
|
},
|
|
11800
|
+
interactive: {
|
|
11801
|
+
type: 'boolean',
|
|
11802
|
+
default: true,
|
|
11803
|
+
description:
|
|
11804
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
11805
|
+
},
|
|
11806
|
+
org: {
|
|
11807
|
+
type: 'string',
|
|
11808
|
+
description:
|
|
11809
|
+
'Force override the organization slug, overrides the default org from config'
|
|
11810
|
+
},
|
|
11384
11811
|
reportLevel: {
|
|
11385
11812
|
type: 'string',
|
|
11386
11813
|
default: 'warn',
|
|
@@ -11399,7 +11826,7 @@ const config$3 = {
|
|
|
11399
11826
|
},
|
|
11400
11827
|
help: (command, config) => `
|
|
11401
11828
|
Usage
|
|
11402
|
-
$ ${command} <org slug> <scan ID> [path to output file]
|
|
11829
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <scan ID> [path to output file]
|
|
11403
11830
|
|
|
11404
11831
|
API Token Requirements
|
|
11405
11832
|
- Quota: 2 units
|
|
@@ -11418,8 +11845,8 @@ const config$3 = {
|
|
|
11418
11845
|
Short responses: JSON: \`{healthy:bool}\`, markdown: \`healthy = bool\`, text: \`OK/ERR\`
|
|
11419
11846
|
|
|
11420
11847
|
Examples
|
|
11421
|
-
$ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0 --json --fold=version
|
|
11422
|
-
$ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0 --license --markdown --short
|
|
11848
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0 --json --fold=version
|
|
11849
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0 --license --markdown --short
|
|
11423
11850
|
`
|
|
11424
11851
|
}
|
|
11425
11852
|
const cmdScanReport = {
|
|
@@ -11441,16 +11868,29 @@ async function run$3(argv, importMeta, { parentName }) {
|
|
|
11441
11868
|
markdown,
|
|
11442
11869
|
reportLevel = 'warn'
|
|
11443
11870
|
} = cli.flags
|
|
11444
|
-
const
|
|
11445
|
-
const orgSlug
|
|
11446
|
-
|
|
11447
|
-
|
|
11871
|
+
const { dryRun, interactive, org: orgFlag } = cli.flags
|
|
11872
|
+
const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
11873
|
+
String(orgFlag || ''),
|
|
11874
|
+
cli.input[0] || '',
|
|
11875
|
+
!!interactive,
|
|
11876
|
+
!!dryRun
|
|
11877
|
+
)
|
|
11878
|
+
const scanId =
|
|
11879
|
+
(shadowNpmInject.isTestingV1() || defaultOrgSlug
|
|
11880
|
+
? cli.input[0]
|
|
11881
|
+
: cli.input[1]) || ''
|
|
11882
|
+
const file =
|
|
11883
|
+
(shadowNpmInject.isTestingV1() || defaultOrgSlug
|
|
11884
|
+
? cli.input[1]
|
|
11885
|
+
: cli.input[2]) || '-'
|
|
11448
11886
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
11449
11887
|
const wasBadInput = handleBadInput(
|
|
11450
11888
|
{
|
|
11451
11889
|
nook: !!defaultOrgSlug,
|
|
11452
11890
|
test: !!orgSlug && orgSlug !== '.',
|
|
11453
|
-
message:
|
|
11891
|
+
message: shadowNpmInject.isTestingV1()
|
|
11892
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
11893
|
+
: 'Org name must be the first argument',
|
|
11454
11894
|
pass: 'ok',
|
|
11455
11895
|
fail:
|
|
11456
11896
|
orgSlug === '.'
|
|
@@ -11609,11 +12049,22 @@ const config$2 = {
|
|
|
11609
12049
|
hidden: false,
|
|
11610
12050
|
flags: {
|
|
11611
12051
|
...commonFlags,
|
|
11612
|
-
...outputFlags
|
|
12052
|
+
...outputFlags,
|
|
12053
|
+
interactive: {
|
|
12054
|
+
type: 'boolean',
|
|
12055
|
+
default: true,
|
|
12056
|
+
description:
|
|
12057
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
12058
|
+
},
|
|
12059
|
+
org: {
|
|
12060
|
+
type: 'string',
|
|
12061
|
+
description:
|
|
12062
|
+
'Force override the organization slug, overrides the default org from config'
|
|
12063
|
+
}
|
|
11613
12064
|
},
|
|
11614
12065
|
help: (command, config) => `
|
|
11615
12066
|
Usage
|
|
11616
|
-
$ ${command} <org slug> <scan ID> [path to output file]
|
|
12067
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'} <scan ID> [path to output file]
|
|
11617
12068
|
|
|
11618
12069
|
API Token Requirements
|
|
11619
12070
|
- Quota: 1 unit
|
|
@@ -11625,7 +12076,7 @@ const config$2 = {
|
|
|
11625
12076
|
${getFlagListOutput(config.flags, 6)}
|
|
11626
12077
|
|
|
11627
12078
|
Examples
|
|
11628
|
-
$ ${command} FakeOrg 000aaaa1-0000-0a0a-00a0-00a0000000a0 ./stream.txt
|
|
12079
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} 000aaaa1-0000-0a0a-00a0-00a0000000a0 ./stream.txt
|
|
11629
12080
|
`
|
|
11630
12081
|
}
|
|
11631
12082
|
const cmdScanView = {
|
|
@@ -11640,17 +12091,29 @@ async function run$2(argv, importMeta, { parentName }) {
|
|
|
11640
12091
|
importMeta,
|
|
11641
12092
|
parentName
|
|
11642
12093
|
})
|
|
11643
|
-
const { json, markdown } = cli.flags
|
|
11644
|
-
const defaultOrgSlug =
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
12094
|
+
const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
|
|
12095
|
+
const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
|
|
12096
|
+
String(orgFlag || ''),
|
|
12097
|
+
cli.input[0] || '',
|
|
12098
|
+
!!interactive,
|
|
12099
|
+
!!dryRun
|
|
12100
|
+
)
|
|
12101
|
+
const scanId =
|
|
12102
|
+
(shadowNpmInject.isTestingV1() || defaultOrgSlug
|
|
12103
|
+
? cli.input[0]
|
|
12104
|
+
: cli.input[1]) || ''
|
|
12105
|
+
const file =
|
|
12106
|
+
(shadowNpmInject.isTestingV1() || defaultOrgSlug
|
|
12107
|
+
? cli.input[1]
|
|
12108
|
+
: cli.input[2]) || '-'
|
|
11648
12109
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
11649
12110
|
const wasBadInput = handleBadInput(
|
|
11650
12111
|
{
|
|
11651
12112
|
nook: !!defaultOrgSlug,
|
|
11652
12113
|
test: !!orgSlug && orgSlug !== '.',
|
|
11653
|
-
message:
|
|
12114
|
+
message: shadowNpmInject.isTestingV1()
|
|
12115
|
+
? 'Org name by default setting, --org, or auto-discovered'
|
|
12116
|
+
: 'Org name must be the first argument',
|
|
11654
12117
|
pass: 'ok',
|
|
11655
12118
|
fail:
|
|
11656
12119
|
orgSlug === '.'
|
|
@@ -11938,6 +12401,17 @@ const config$1 = {
|
|
|
11938
12401
|
flags: {
|
|
11939
12402
|
...commonFlags,
|
|
11940
12403
|
...outputFlags,
|
|
12404
|
+
interactive: {
|
|
12405
|
+
type: 'boolean',
|
|
12406
|
+
default: true,
|
|
12407
|
+
description:
|
|
12408
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
12409
|
+
},
|
|
12410
|
+
org: {
|
|
12411
|
+
type: 'string',
|
|
12412
|
+
description:
|
|
12413
|
+
'Force override the organization slug, overrides the default org from config'
|
|
12414
|
+
},
|
|
11941
12415
|
perPage: {
|
|
11942
12416
|
type: 'number',
|
|
11943
12417
|
shortFlag: 'pp',
|
|
@@ -11971,7 +12445,7 @@ const config$1 = {
|
|
|
11971
12445
|
},
|
|
11972
12446
|
help: (command, config) => `
|
|
11973
12447
|
Usage
|
|
11974
|
-
$ ${command}
|
|
12448
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' <org slug>'}
|
|
11975
12449
|
|
|
11976
12450
|
API Token Requirements
|
|
11977
12451
|
- Quota: 1 unit
|
|
@@ -12008,8 +12482,8 @@ const config$1 = {
|
|
|
12008
12482
|
- pypi
|
|
12009
12483
|
|
|
12010
12484
|
Examples
|
|
12011
|
-
$ ${command}
|
|
12012
|
-
$ ${command} --perPage=5 --page=2 --direction=asc --filter=joke
|
|
12485
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'}
|
|
12486
|
+
$ ${command}${shadowNpmInject.isTestingV1() ? '' : ' FakeOrg'} --perPage=5 --page=2 --direction=asc --filter=joke
|
|
12013
12487
|
`
|
|
12014
12488
|
}
|
|
12015
12489
|
const cmdThreatFeed = {
|
|
@@ -12024,9 +12498,13 @@ async function run$1(argv, importMeta, { parentName }) {
|
|
|
12024
12498
|
importMeta,
|
|
12025
12499
|
parentName
|
|
12026
12500
|
})
|
|
12027
|
-
const { json, markdown } = cli.flags
|
|
12028
|
-
const
|
|
12029
|
-
|
|
12501
|
+
const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
|
|
12502
|
+
const [orgSlug] = await determineOrgSlug(
|
|
12503
|
+
String(orgFlag || ''),
|
|
12504
|
+
cli.input[0] || '',
|
|
12505
|
+
!!interactive,
|
|
12506
|
+
!!dryRun
|
|
12507
|
+
)
|
|
12030
12508
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
12031
12509
|
const wasBadInput = handleBadInput(
|
|
12032
12510
|
{
|
|
@@ -12278,7 +12756,7 @@ void (async () => {
|
|
|
12278
12756
|
await vendor.updater({
|
|
12279
12757
|
name: SOCKET_CLI_BIN_NAME,
|
|
12280
12758
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
12281
|
-
version: '0.14.
|
|
12759
|
+
version: '0.14.150',
|
|
12282
12760
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
12283
12761
|
})
|
|
12284
12762
|
try {
|
|
@@ -12346,5 +12824,5 @@ void (async () => {
|
|
|
12346
12824
|
await shadowNpmInject.captureException(e)
|
|
12347
12825
|
}
|
|
12348
12826
|
})()
|
|
12349
|
-
//# debugId=
|
|
12827
|
+
//# debugId=835d04cb-7542-4f21-978b-70fe4fe52a4e
|
|
12350
12828
|
//# sourceMappingURL=cli.js.map
|