@socketsecurity/cli-with-sentry 1.1.18 → 1.1.19
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/CHANGELOG.md +6 -0
- package/bin/npm-cli.js +2 -2
- package/bin/npx-cli.js +2 -2
- package/bin/pnpm-cli.js +2 -2
- package/bin/yarn-cli.js +2 -2
- package/dist/cli.js +238 -94
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +5 -3
- package/dist/constants.js.map +1 -1
- package/dist/flags.js +3 -2
- package/dist/flags.js.map +1 -1
- package/dist/npm-cli.js +3 -4
- package/dist/npm-cli.js.map +1 -1
- package/dist/npx-cli.js +3 -3
- package/dist/npx-cli.js.map +1 -1
- package/dist/pnpm-cli.js +3 -3
- package/dist/pnpm-cli.js.map +1 -1
- package/dist/shadow-npm-bin.js +3 -106
- package/dist/shadow-npm-bin.js.map +1 -1
- package/dist/shadow-npm-bin2.js +125 -0
- package/dist/shadow-npm-bin2.js.map +1 -0
- package/dist/shadow-npx-bin.js +12 -0
- package/dist/shadow-npx-bin.js.map +1 -0
- package/dist/shadow-pnpm-bin.js +3 -228
- package/dist/shadow-pnpm-bin.js.map +1 -1
- package/dist/shadow-pnpm-bin2.js +319 -0
- package/dist/shadow-pnpm-bin2.js.map +1 -0
- package/dist/shadow-yarn-bin.js +58 -150
- package/dist/shadow-yarn-bin.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/analytics/cmd-analytics.d.mts.map +1 -1
- package/dist/types/commands/analytics/output-analytics.d.mts.map +1 -1
- package/dist/types/commands/audit-log/cmd-audit-log.d.mts.map +1 -1
- package/dist/types/commands/audit-log/output-audit-log.d.mts.map +1 -1
- package/dist/types/commands/ci/handle-ci.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-auto.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-get.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-list.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-set.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-unset.d.mts.map +1 -1
- package/dist/types/commands/config/handle-config-set.d.mts.map +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/pull-request.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-conda.d.mts.map +1 -1
- package/dist/types/commands/npm/cmd-npm.d.mts.map +1 -1
- package/dist/types/commands/optimize/handle-optimize.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-dependencies.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-list.d.mts.map +1 -1
- package/dist/types/commands/organization/handle-dependencies.d.mts.map +1 -1
- package/dist/types/commands/organization/handle-organization-list.d.mts.map +1 -1
- package/dist/types/commands/package/handle-purl-deep-score.d.mts.map +1 -1
- package/dist/types/commands/package/handle-purls-shallow-score.d.mts.map +1 -1
- package/dist/types/commands/pnpm/cmd-pnpm.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-list.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-view.d.mts.map +1 -1
- package/dist/types/commands/repository/handle-create-repo.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-diff.d.mts.map +1 -1
- package/dist/types/commands/scan/create-scan-from-github.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-report-data.d.mts.map +1 -1
- package/dist/types/commands/scan/handle-create-new-scan.d.mts.map +1 -1
- package/dist/types/commands/wrapper/postinstall-wrapper.d.mts.map +1 -1
- package/dist/types/commands/yarn/cmd-yarn.d.mts.map +1 -1
- package/dist/types/constants.d.mts +1 -0
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/flags.d.mts.map +1 -1
- package/dist/types/shadow/common.d.mts +31 -0
- package/dist/types/shadow/common.d.mts.map +1 -0
- package/dist/types/shadow/npm/bin.d.mts +4 -10
- package/dist/types/shadow/npm/bin.d.mts.map +1 -1
- package/dist/types/shadow/npm-base.d.mts +11 -0
- package/dist/types/shadow/npm-base.d.mts.map +1 -0
- package/dist/types/shadow/npx/bin.d.mts +5 -0
- package/dist/types/shadow/npx/bin.d.mts.map +1 -0
- package/dist/types/shadow/pnpm/bin.d.mts +1 -1
- package/dist/types/shadow/pnpm/bin.d.mts.map +1 -1
- package/dist/types/shadow/stdio-ipc.d.mts +7 -0
- package/dist/types/shadow/stdio-ipc.d.mts.map +1 -0
- package/dist/types/shadow/yarn/bin.d.mts +1 -1
- package/dist/types/shadow/yarn/bin.d.mts.map +1 -1
- package/dist/types/utils/agent.d.mts.map +1 -1
- package/dist/types/utils/alerts-map.d.mts.map +1 -1
- package/dist/types/utils/api.d.mts.map +1 -1
- package/dist/types/utils/cmd.d.mts.map +1 -1
- package/dist/types/utils/coana.d.mts.map +1 -1
- package/dist/types/utils/color-or-markdown.d.mts.map +1 -1
- package/dist/types/utils/config.d.mts.map +1 -1
- package/dist/types/utils/cve-to-ghsa.d.mts.map +1 -1
- package/dist/types/utils/debug.d.mts +45 -0
- package/dist/types/utils/debug.d.mts.map +1 -0
- package/dist/types/utils/dlx.d.mts +1 -1
- package/dist/types/utils/dlx.d.mts.map +1 -1
- package/dist/types/utils/ecosystem.d.mts.map +1 -1
- package/dist/types/utils/errors.d.mts +48 -0
- package/dist/types/utils/errors.d.mts.map +1 -1
- package/dist/types/utils/filter-config.d.mts.map +1 -1
- package/dist/types/utils/fs.d.mts.map +1 -1
- package/dist/types/utils/get-output-kind.d.mts.map +1 -1
- package/dist/types/utils/git.d.mts.map +1 -1
- package/dist/types/utils/github.d.mts.map +1 -1
- package/dist/types/utils/markdown.d.mts +17 -0
- package/dist/types/utils/markdown.d.mts.map +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
- package/dist/types/utils/npm-package-arg.d.mts +5 -1
- package/dist/types/utils/npm-package-arg.d.mts.map +1 -1
- package/dist/types/utils/npm-paths.d.mts.map +1 -1
- package/dist/types/utils/npm-spec.d.mts +57 -0
- package/dist/types/utils/npm-spec.d.mts.map +1 -0
- package/dist/types/utils/output-formatting.d.mts.map +1 -1
- package/dist/types/utils/package-environment.d.mts.map +1 -1
- package/dist/types/utils/pnpm-paths.d.mts.map +1 -1
- package/dist/types/utils/purl-to-ghsa.d.mts.map +1 -1
- package/dist/types/utils/purl.d.mts +24 -0
- package/dist/types/utils/purl.d.mts.map +1 -1
- package/dist/types/utils/requirements.d.mts.map +1 -1
- package/dist/types/utils/sdk.d.mts.map +1 -1
- package/dist/types/utils/serialize-result-json.d.mts.map +1 -1
- package/dist/types/utils/socket-json.d.mts.map +1 -1
- package/dist/types/utils/socket-package-alert.d.mts.map +1 -1
- package/dist/types/utils/socket-url.d.mts.map +1 -1
- package/dist/types/utils/strings.d.mts +12 -0
- package/dist/types/utils/strings.d.mts.map +1 -1
- package/dist/types/utils/tildify.d.mts +0 -2
- package/dist/types/utils/tildify.d.mts.map +1 -1
- package/dist/types/utils/yarn-paths.d.mts.map +1 -1
- package/dist/utils.js +1303 -457
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +311 -311
- package/package.json +3 -3
- package/shadow-bin/npm +2 -2
- package/shadow-bin/npx +2 -2
- package/shadow-bin/pnpm +2 -2
- package/shadow-bin/yarn +2 -2
package/dist/cli.js
CHANGED
|
@@ -94,8 +94,10 @@ async function outputAnalytics(result, {
|
|
|
94
94
|
if (filepath) {
|
|
95
95
|
try {
|
|
96
96
|
await fs.writeFile(filepath, serialized, 'utf8');
|
|
97
|
+
utils.debugFileOp('write', filepath);
|
|
97
98
|
logger.logger.success(`Data successfully written to ${filepath}`);
|
|
98
99
|
} catch (e) {
|
|
100
|
+
utils.debugFileOp('write', filepath, e);
|
|
99
101
|
process.exitCode = 1;
|
|
100
102
|
logger.logger.log(utils.serializeResultJson({
|
|
101
103
|
ok: false,
|
|
@@ -116,8 +118,10 @@ async function outputAnalytics(result, {
|
|
|
116
118
|
if (filepath) {
|
|
117
119
|
try {
|
|
118
120
|
await fs.writeFile(filepath, serialized, 'utf8');
|
|
121
|
+
utils.debugFileOp('write', filepath);
|
|
119
122
|
logger.logger.success(`Data successfully written to ${filepath}`);
|
|
120
123
|
} catch (e) {
|
|
124
|
+
utils.debugFileOp('write', filepath, e);
|
|
121
125
|
logger.logger.error(e);
|
|
122
126
|
}
|
|
123
127
|
} else {
|
|
@@ -433,12 +437,12 @@ async function run$S(argv, importMeta, {
|
|
|
433
437
|
}, {
|
|
434
438
|
nook: true,
|
|
435
439
|
test: !filepath || !!json || !!markdown,
|
|
436
|
-
message:
|
|
440
|
+
message: `The \`--file\` flag is only valid when using \`${constants.FLAG_JSON}\` or \`${constants.FLAG_MARKDOWN}\``,
|
|
437
441
|
fail: 'bad'
|
|
438
442
|
}, {
|
|
439
443
|
nook: true,
|
|
440
444
|
test: !json || !markdown,
|
|
441
|
-
message:
|
|
445
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
442
446
|
fail: 'bad'
|
|
443
447
|
}, {
|
|
444
448
|
nook: true,
|
|
@@ -612,11 +616,9 @@ ${table}
|
|
|
612
616
|
`;
|
|
613
617
|
} catch (e) {
|
|
614
618
|
process.exitCode = 1;
|
|
615
|
-
logger.logger.fail(
|
|
616
|
-
require$$9.debugFn('error', '
|
|
617
|
-
require$$9.debugDir('
|
|
618
|
-
error: e
|
|
619
|
-
});
|
|
619
|
+
logger.logger.fail(`There was a problem converting the logs to Markdown, please try the \`${constants.FLAG_JSON}\` flag`);
|
|
620
|
+
require$$9.debugFn('error', 'Markdown conversion failed');
|
|
621
|
+
require$$9.debugDir('error', e);
|
|
620
622
|
return 'Failed to generate the markdown report';
|
|
621
623
|
}
|
|
622
624
|
}
|
|
@@ -854,7 +856,7 @@ async function run$R(argv, importMeta, {
|
|
|
854
856
|
}, {
|
|
855
857
|
nook: true,
|
|
856
858
|
test: !json || !markdown,
|
|
857
|
-
message:
|
|
859
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
858
860
|
fail: 'bad'
|
|
859
861
|
}, {
|
|
860
862
|
nook: true,
|
|
@@ -1021,8 +1023,8 @@ async function fetchScanData(orgSlug, scanId, options) {
|
|
|
1021
1023
|
return JSON.parse(line);
|
|
1022
1024
|
} catch (e) {
|
|
1023
1025
|
ok = false;
|
|
1024
|
-
require$$9.debugFn('error', '
|
|
1025
|
-
require$$9.debugDir('
|
|
1026
|
+
require$$9.debugFn('error', 'Failed to parse report data line as JSON');
|
|
1027
|
+
require$$9.debugDir('error', {
|
|
1026
1028
|
error: e,
|
|
1027
1029
|
line
|
|
1028
1030
|
});
|
|
@@ -1054,14 +1056,14 @@ async function fetchScanData(orgSlug, scanId, options) {
|
|
|
1054
1056
|
return {
|
|
1055
1057
|
ok: false,
|
|
1056
1058
|
message: 'Socket API error',
|
|
1057
|
-
cause:
|
|
1059
|
+
cause: utils.formatErrorWithDetail('Error requesting scan', e) || 'Error requesting scan: (no error message found)'
|
|
1058
1060
|
};
|
|
1059
1061
|
}), fetchSecurityPolicy().catch(e => {
|
|
1060
1062
|
updatePolicy('failure; unknown blocking error occurred');
|
|
1061
1063
|
return {
|
|
1062
1064
|
ok: false,
|
|
1063
1065
|
message: 'Socket API error',
|
|
1064
|
-
cause:
|
|
1066
|
+
cause: utils.formatErrorWithDetail('Error requesting policy', e) || 'Error requesting policy: (no error message found)'
|
|
1065
1067
|
};
|
|
1066
1068
|
})]).finally(() => {
|
|
1067
1069
|
finishedFetching = true;
|
|
@@ -2154,10 +2156,29 @@ async function handleCreateNewScan({
|
|
|
2154
2156
|
targets,
|
|
2155
2157
|
tmp
|
|
2156
2158
|
}) {
|
|
2159
|
+
require$$9.debugFn('notice', `Creating new scan for ${orgSlug}/${repoName}`);
|
|
2160
|
+
require$$9.debugDir('inspect', {
|
|
2161
|
+
autoManifest,
|
|
2162
|
+
branchName,
|
|
2163
|
+
commitHash,
|
|
2164
|
+
defaultBranch,
|
|
2165
|
+
interactive,
|
|
2166
|
+
pendingHead,
|
|
2167
|
+
pullRequest,
|
|
2168
|
+
readOnly,
|
|
2169
|
+
report,
|
|
2170
|
+
reportLevel,
|
|
2171
|
+
targets,
|
|
2172
|
+
tmp
|
|
2173
|
+
});
|
|
2157
2174
|
if (autoManifest) {
|
|
2158
2175
|
logger.logger.info('Auto-generating manifest files ...');
|
|
2176
|
+
require$$9.debugFn('notice', 'Auto-manifest mode enabled');
|
|
2159
2177
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
2160
2178
|
const detected = await detectManifestActions(sockJson, cwd);
|
|
2179
|
+
require$$9.debugDir('inspect', {
|
|
2180
|
+
detected
|
|
2181
|
+
});
|
|
2161
2182
|
await generateAutoManifest({
|
|
2162
2183
|
detected,
|
|
2163
2184
|
cwd,
|
|
@@ -2173,12 +2194,17 @@ async function handleCreateNewScan({
|
|
|
2173
2194
|
spinner
|
|
2174
2195
|
});
|
|
2175
2196
|
if (!supportedFilesCResult.ok) {
|
|
2197
|
+
require$$9.debugFn('warn', 'Failed to fetch supported scan file names');
|
|
2198
|
+
require$$9.debugDir('inspect', {
|
|
2199
|
+
supportedFilesCResult
|
|
2200
|
+
});
|
|
2176
2201
|
await outputCreateNewScan(supportedFilesCResult, {
|
|
2177
2202
|
interactive,
|
|
2178
2203
|
outputKind
|
|
2179
2204
|
});
|
|
2180
2205
|
return;
|
|
2181
2206
|
}
|
|
2207
|
+
require$$9.debugFn('notice', `Fetched ${supportedFilesCResult.data['size']} supported file types`);
|
|
2182
2208
|
spinner.start('Searching for local files to include in scan...');
|
|
2183
2209
|
const supportedFiles = supportedFilesCResult.data;
|
|
2184
2210
|
const packagePaths = await utils.getPackageFilesForScan(targets, supportedFiles, {
|
|
@@ -2192,6 +2218,7 @@ async function handleCreateNewScan({
|
|
|
2192
2218
|
message: 'TARGET (file/dir) must contain matching / supported file types for a scan'
|
|
2193
2219
|
});
|
|
2194
2220
|
if (!wasValidInput) {
|
|
2221
|
+
require$$9.debugFn('warn', 'No eligible files found to scan');
|
|
2195
2222
|
return;
|
|
2196
2223
|
}
|
|
2197
2224
|
logger.logger.success(`Found ${packagePaths.length} local ${words.pluralize('file', packagePaths.length)}`);
|
|
@@ -2200,6 +2227,7 @@ async function handleCreateNewScan({
|
|
|
2200
2227
|
});
|
|
2201
2228
|
if (readOnly) {
|
|
2202
2229
|
logger.logger.log('[ReadOnly] Bailing now');
|
|
2230
|
+
require$$9.debugFn('notice', 'Read-only mode, exiting early');
|
|
2203
2231
|
return;
|
|
2204
2232
|
}
|
|
2205
2233
|
let scanPaths = packagePaths;
|
|
@@ -2209,6 +2237,10 @@ async function handleCreateNewScan({
|
|
|
2209
2237
|
if (reach.runReachabilityAnalysis) {
|
|
2210
2238
|
logger.logger.error('');
|
|
2211
2239
|
logger.logger.info('Starting reachability analysis...');
|
|
2240
|
+
require$$9.debugFn('notice', 'Reachability analysis enabled');
|
|
2241
|
+
require$$9.debugDir('inspect', {
|
|
2242
|
+
reachabilityOptions: reach
|
|
2243
|
+
});
|
|
2212
2244
|
spinner.start();
|
|
2213
2245
|
const reachResult = await performReachabilityAnalysis({
|
|
2214
2246
|
branchName,
|
|
@@ -2285,8 +2317,16 @@ async function handleCreateNewScan({
|
|
|
2285
2317
|
}
|
|
2286
2318
|
|
|
2287
2319
|
async function handleCi(autoManifest) {
|
|
2320
|
+
require$$9.debugFn('notice', 'Starting CI scan');
|
|
2321
|
+
require$$9.debugDir('inspect', {
|
|
2322
|
+
autoManifest
|
|
2323
|
+
});
|
|
2288
2324
|
const orgSlugCResult = await utils.getDefaultOrgSlug();
|
|
2289
2325
|
if (!orgSlugCResult.ok) {
|
|
2326
|
+
require$$9.debugFn('warn', 'Failed to get default org slug');
|
|
2327
|
+
require$$9.debugDir('inspect', {
|
|
2328
|
+
orgSlugCResult
|
|
2329
|
+
});
|
|
2290
2330
|
process.exitCode = orgSlugCResult.code ?? 1;
|
|
2291
2331
|
// Always assume json mode.
|
|
2292
2332
|
logger.logger.log(utils.serializeResultJson(orgSlugCResult));
|
|
@@ -2296,6 +2336,13 @@ async function handleCi(autoManifest) {
|
|
|
2296
2336
|
const cwd = process.cwd();
|
|
2297
2337
|
const branchName = (await utils.gitBranch(cwd)) || (await utils.detectDefaultBranch(cwd));
|
|
2298
2338
|
const repoName = await utils.getRepoName(cwd);
|
|
2339
|
+
require$$9.debugFn('notice', `CI scan for ${orgSlug}/${repoName} on branch ${branchName}`);
|
|
2340
|
+
require$$9.debugDir('inspect', {
|
|
2341
|
+
orgSlug,
|
|
2342
|
+
cwd,
|
|
2343
|
+
branchName,
|
|
2344
|
+
repoName
|
|
2345
|
+
});
|
|
2299
2346
|
await handleCreateNewScan({
|
|
2300
2347
|
autoManifest,
|
|
2301
2348
|
branchName,
|
|
@@ -2669,7 +2716,7 @@ ${utils.getSupportedConfigEntries().map(({
|
|
|
2669
2716
|
}, {
|
|
2670
2717
|
nook: true,
|
|
2671
2718
|
test: !json || !markdown,
|
|
2672
|
-
message:
|
|
2719
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
2673
2720
|
fail: 'bad'
|
|
2674
2721
|
});
|
|
2675
2722
|
if (!wasValidInput) {
|
|
@@ -2780,7 +2827,7 @@ async function run$O(argv, importMeta, {
|
|
|
2780
2827
|
}, {
|
|
2781
2828
|
nook: true,
|
|
2782
2829
|
test: !json || !markdown,
|
|
2783
|
-
message:
|
|
2830
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
2784
2831
|
fail: 'bad'
|
|
2785
2832
|
});
|
|
2786
2833
|
if (!wasValidInput) {
|
|
@@ -2912,7 +2959,7 @@ async function run$N(argv, importMeta, {
|
|
|
2912
2959
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
2913
2960
|
nook: true,
|
|
2914
2961
|
test: !json || !markdown,
|
|
2915
|
-
message:
|
|
2962
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
2916
2963
|
fail: 'bad'
|
|
2917
2964
|
});
|
|
2918
2965
|
if (!wasValidInput) {
|
|
@@ -2963,7 +3010,17 @@ async function handleConfigSet({
|
|
|
2963
3010
|
outputKind,
|
|
2964
3011
|
value
|
|
2965
3012
|
}) {
|
|
3013
|
+
require$$9.debugFn('notice', `Setting config ${key} = ${value}`);
|
|
3014
|
+
require$$9.debugDir('inspect', {
|
|
3015
|
+
key,
|
|
3016
|
+
value,
|
|
3017
|
+
outputKind
|
|
3018
|
+
});
|
|
2966
3019
|
const result = utils.updateConfigValue(key, value);
|
|
3020
|
+
require$$9.debugFn('notice', `Config update ${result.ok ? 'succeeded' : 'failed'}`);
|
|
3021
|
+
require$$9.debugDir('inspect', {
|
|
3022
|
+
result
|
|
3023
|
+
});
|
|
2967
3024
|
await outputConfigSet(result, outputKind);
|
|
2968
3025
|
}
|
|
2969
3026
|
|
|
@@ -3039,7 +3096,7 @@ ${utils.getSupportedConfigEntries().map(({
|
|
|
3039
3096
|
}, {
|
|
3040
3097
|
nook: true,
|
|
3041
3098
|
test: !json || !markdown,
|
|
3042
|
-
message:
|
|
3099
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
3043
3100
|
fail: 'bad'
|
|
3044
3101
|
});
|
|
3045
3102
|
if (!wasValidInput) {
|
|
@@ -3154,7 +3211,7 @@ ${utils.getSupportedConfigEntries().map(({
|
|
|
3154
3211
|
}, {
|
|
3155
3212
|
nook: true,
|
|
3156
3213
|
test: !json || !markdown,
|
|
3157
|
-
message:
|
|
3214
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
3158
3215
|
fail: 'bad'
|
|
3159
3216
|
});
|
|
3160
3217
|
if (!wasValidInput) {
|
|
@@ -3369,9 +3426,7 @@ async function getSocketFixPrsWithContext(owner, repo, options) {
|
|
|
3369
3426
|
}
|
|
3370
3427
|
} catch (e) {
|
|
3371
3428
|
require$$9.debugFn('error', `GraphQL pagination failed for ${owner}/${repo}`);
|
|
3372
|
-
require$$9.debugDir('
|
|
3373
|
-
error: e
|
|
3374
|
-
});
|
|
3429
|
+
require$$9.debugDir('error', e);
|
|
3375
3430
|
}
|
|
3376
3431
|
return contextualMatches;
|
|
3377
3432
|
}
|
|
@@ -3588,9 +3643,7 @@ async function coanaFix(fixConfig) {
|
|
|
3588
3643
|
}
|
|
3589
3644
|
} catch (e) {
|
|
3590
3645
|
require$$9.debugFn('warn', 'Failed to count open PRs, using original limit');
|
|
3591
|
-
require$$9.debugDir('
|
|
3592
|
-
error: e
|
|
3593
|
-
});
|
|
3646
|
+
require$$9.debugDir('error', e);
|
|
3594
3647
|
}
|
|
3595
3648
|
}
|
|
3596
3649
|
const shouldSpawnCoana = adjustedLimit > 0;
|
|
@@ -3644,7 +3697,7 @@ async function coanaFix(fixConfig) {
|
|
|
3644
3697
|
stdio: 'inherit'
|
|
3645
3698
|
});
|
|
3646
3699
|
if (!fixCResult.ok) {
|
|
3647
|
-
logger.logger.error(`Update failed for ${ghsaId}: ${fixCResult
|
|
3700
|
+
logger.logger.error(`Update failed for ${ghsaId}: ${utils.getErrorCause(fixCResult)}`);
|
|
3648
3701
|
continue ghsaLoop;
|
|
3649
3702
|
}
|
|
3650
3703
|
|
|
@@ -3746,9 +3799,7 @@ async function coanaFix(fixConfig) {
|
|
|
3746
3799
|
await utils.gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
3747
3800
|
} catch (e) {
|
|
3748
3801
|
logger.logger.warn(`Unexpected condition: Push failed for ${ghsaId}, skipping PR creation.`);
|
|
3749
|
-
require$$9.debugDir('
|
|
3750
|
-
error: e
|
|
3751
|
-
});
|
|
3802
|
+
require$$9.debugDir('error', e);
|
|
3752
3803
|
// eslint-disable-next-line no-await-in-loop
|
|
3753
3804
|
await utils.gitResetAndClean(fixEnv.baseBranch, cwd);
|
|
3754
3805
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -3792,6 +3843,10 @@ const CVE_FORMAT_REGEXP = /^CVE-\d{4}-\d{4,}$/;
|
|
|
3792
3843
|
* Filters out invalid IDs and logs conversion results.
|
|
3793
3844
|
*/
|
|
3794
3845
|
async function convertIdsToGhsas(ids) {
|
|
3846
|
+
require$$9.debugFn('notice', `Converting ${ids.length} IDs to GHSA format`);
|
|
3847
|
+
require$$9.debugDir('inspect', {
|
|
3848
|
+
ids
|
|
3849
|
+
});
|
|
3795
3850
|
const validGhsas = [];
|
|
3796
3851
|
const errors = [];
|
|
3797
3852
|
for (const id of ids) {
|
|
@@ -3835,7 +3890,14 @@ async function convertIdsToGhsas(ids) {
|
|
|
3835
3890
|
}
|
|
3836
3891
|
if (errors.length) {
|
|
3837
3892
|
logger.logger.warn(`Skipped ${errors.length} invalid IDs:\n${errors.map(e => ` - ${e}`).join('\n')}`);
|
|
3893
|
+
require$$9.debugDir('inspect', {
|
|
3894
|
+
errors
|
|
3895
|
+
});
|
|
3838
3896
|
}
|
|
3897
|
+
require$$9.debugFn('notice', `Converted to ${validGhsas.length} valid GHSA IDs`);
|
|
3898
|
+
require$$9.debugDir('inspect', {
|
|
3899
|
+
validGhsas
|
|
3900
|
+
});
|
|
3839
3901
|
return validGhsas;
|
|
3840
3902
|
}
|
|
3841
3903
|
async function handleFix({
|
|
@@ -3854,6 +3916,21 @@ async function handleFix({
|
|
|
3854
3916
|
spinner,
|
|
3855
3917
|
unknownFlags
|
|
3856
3918
|
}) {
|
|
3919
|
+
require$$9.debugFn('notice', `Starting fix command for ${orgSlug}`);
|
|
3920
|
+
require$$9.debugDir('inspect', {
|
|
3921
|
+
autopilot,
|
|
3922
|
+
cwd,
|
|
3923
|
+
ghsas,
|
|
3924
|
+
glob,
|
|
3925
|
+
limit,
|
|
3926
|
+
minSatisfying,
|
|
3927
|
+
onlyCompute,
|
|
3928
|
+
outputFile,
|
|
3929
|
+
outputKind,
|
|
3930
|
+
prCheck,
|
|
3931
|
+
rangeStyle,
|
|
3932
|
+
unknownFlags
|
|
3933
|
+
});
|
|
3857
3934
|
await outputFixResult(await coanaFix({
|
|
3858
3935
|
autopilot,
|
|
3859
3936
|
cwd,
|
|
@@ -3933,7 +4010,7 @@ const hiddenFlags = {
|
|
|
3933
4010
|
glob: {
|
|
3934
4011
|
type: 'string',
|
|
3935
4012
|
default: '',
|
|
3936
|
-
description: 'Glob pattern to
|
|
4013
|
+
description: 'Glob pattern to filter workspaces by',
|
|
3937
4014
|
hidden: true
|
|
3938
4015
|
},
|
|
3939
4016
|
maxSatisfying: {
|
|
@@ -4006,7 +4083,7 @@ async function run$K(argv, importMeta, {
|
|
|
4006
4083
|
|
|
4007
4084
|
Examples
|
|
4008
4085
|
$ ${command}
|
|
4009
|
-
$ ${command}
|
|
4086
|
+
$ ${command} ${constants.FLAG_ID} CVE-2021-23337
|
|
4010
4087
|
$ ${command} ./path/to/project --range-style pin
|
|
4011
4088
|
`
|
|
4012
4089
|
};
|
|
@@ -5230,7 +5307,7 @@ async function run$D(argv, importMeta, {
|
|
|
5230
5307
|
}, {
|
|
5231
5308
|
nook: true,
|
|
5232
5309
|
test: !json || !markdown,
|
|
5233
|
-
message:
|
|
5310
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
5234
5311
|
fail: 'bad'
|
|
5235
5312
|
});
|
|
5236
5313
|
if (!wasValidInput) {
|
|
@@ -6279,10 +6356,10 @@ async function run$x(argv, importMeta, context) {
|
|
|
6279
6356
|
API Token Requirements
|
|
6280
6357
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$r}`)}
|
|
6281
6358
|
|
|
6282
|
-
Note: Everything after "
|
|
6283
|
-
Only the
|
|
6359
|
+
Note: Everything after "${constants.NPM}" is passed to the ${constants.NPM} command.
|
|
6360
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
6284
6361
|
|
|
6285
|
-
Use \`socket wrapper on\` to alias this command as
|
|
6362
|
+
Use \`socket wrapper on\` to alias this command as \`${constants.NPM}\`.
|
|
6286
6363
|
|
|
6287
6364
|
Examples
|
|
6288
6365
|
$ ${command}
|
|
@@ -6301,7 +6378,7 @@ async function run$x(argv, importMeta, context) {
|
|
|
6301
6378
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
6302
6379
|
return;
|
|
6303
6380
|
}
|
|
6304
|
-
const
|
|
6381
|
+
const shadowNpmBin = /*@__PURE__*/require$5(constants.default.shadowNpmBinPath);
|
|
6305
6382
|
process.exitCode = 1;
|
|
6306
6383
|
|
|
6307
6384
|
// Filter Socket flags from argv but keep --json for npm.
|
|
@@ -6311,7 +6388,7 @@ async function run$x(argv, importMeta, context) {
|
|
|
6311
6388
|
}, [constants.FLAG_JSON]);
|
|
6312
6389
|
const {
|
|
6313
6390
|
spawnPromise
|
|
6314
|
-
} = await
|
|
6391
|
+
} = await shadowNpmBin(argsToForward, {
|
|
6315
6392
|
stdio: 'inherit'
|
|
6316
6393
|
});
|
|
6317
6394
|
|
|
@@ -6353,10 +6430,10 @@ async function run$w(argv, importMeta, {
|
|
|
6353
6430
|
API Token Requirements
|
|
6354
6431
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$q}`)}
|
|
6355
6432
|
|
|
6356
|
-
Note: Everything after "
|
|
6357
|
-
Only the
|
|
6433
|
+
Note: Everything after "${constants.NPX}" is passed to the ${constants.NPX} command.
|
|
6434
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
6358
6435
|
|
|
6359
|
-
Use \`socket wrapper on\` to alias this command as
|
|
6436
|
+
Use \`socket wrapper on\` to alias this command as \`${constants.NPX}\`.
|
|
6360
6437
|
|
|
6361
6438
|
Examples
|
|
6362
6439
|
$ ${command} cowsay
|
|
@@ -6374,11 +6451,11 @@ async function run$w(argv, importMeta, {
|
|
|
6374
6451
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
6375
6452
|
return;
|
|
6376
6453
|
}
|
|
6377
|
-
const
|
|
6454
|
+
const shadowNpxBin = /*@__PURE__*/require$4(constants.default.shadowNpxBinPath);
|
|
6378
6455
|
process.exitCode = 1;
|
|
6379
6456
|
const {
|
|
6380
6457
|
spawnPromise
|
|
6381
|
-
} = await
|
|
6458
|
+
} = await shadowNpxBin(argv, {
|
|
6382
6459
|
stdio: 'inherit'
|
|
6383
6460
|
});
|
|
6384
6461
|
|
|
@@ -7056,9 +7133,9 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
7056
7133
|
if (
|
|
7057
7134
|
// ...if the spec doesn't start with a valid Socket override.
|
|
7058
7135
|
!(thisSpec.startsWith(sockOverridePrefix) &&
|
|
7059
|
-
// Check the validity of the spec by
|
|
7060
|
-
// seeing if it will coerce to a version.
|
|
7061
|
-
vendor.semverExports.coerce(utils.
|
|
7136
|
+
// Check the validity of the spec by parsing it with npm-package-arg
|
|
7137
|
+
// and seeing if it will coerce to a version.
|
|
7138
|
+
vendor.semverExports.coerce(utils.safeNpa(thisSpec).subSpec.rawSpec)?.version)) {
|
|
7062
7139
|
thisSpec = sockOverrideSpec;
|
|
7063
7140
|
depObj[origPkgName] = thisSpec;
|
|
7064
7141
|
state.added.add(sockRegPkgName);
|
|
@@ -7107,12 +7184,12 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
7107
7184
|
const thisSpec = oldSpec.startsWith('$') ? depAlias || newSpec : oldSpec || newSpec;
|
|
7108
7185
|
if (thisSpec.startsWith(sockOverridePrefix)) {
|
|
7109
7186
|
if (pin && utils.getMajor(
|
|
7110
|
-
// Check the validity of the spec by
|
|
7187
|
+
// Check the validity of the spec by parsing it with npm-package-arg
|
|
7111
7188
|
// and seeing if it will coerce to a version. semver.coerce
|
|
7112
7189
|
// will strip leading v's, carets (^), comparators (<,<=,>,>=,=),
|
|
7113
7190
|
// and tildes (~). If not coerced to a valid version then
|
|
7114
7191
|
// default to the manifest entry version.
|
|
7115
|
-
vendor.semverExports.coerce(utils.
|
|
7192
|
+
vendor.semverExports.coerce(utils.safeNpa(thisSpec).subSpec.rawSpec)?.version ?? version) !== major) {
|
|
7116
7193
|
const otherVersion = (await packages.fetchPackageManifest(thisSpec))?.version;
|
|
7117
7194
|
if (otherVersion && otherVersion !== version) {
|
|
7118
7195
|
newSpec = `${sockOverridePrefix}${pin ? otherVersion : `^${utils.getMajor(otherVersion)}`}`;
|
|
@@ -7196,10 +7273,8 @@ async function updateLockfile(pkgEnvDetails, options) {
|
|
|
7196
7273
|
}
|
|
7197
7274
|
} catch (e) {
|
|
7198
7275
|
spinner?.stop();
|
|
7199
|
-
require$$9.debugFn('error', '
|
|
7200
|
-
require$$9.debugDir('
|
|
7201
|
-
error: e
|
|
7202
|
-
});
|
|
7276
|
+
require$$9.debugFn('error', 'Lockfile update failed');
|
|
7277
|
+
require$$9.debugDir('error', e);
|
|
7203
7278
|
if (wasSpinning) {
|
|
7204
7279
|
spinner.start();
|
|
7205
7280
|
}
|
|
@@ -7299,17 +7374,29 @@ async function handleOptimize({
|
|
|
7299
7374
|
pin,
|
|
7300
7375
|
prod
|
|
7301
7376
|
}) {
|
|
7377
|
+
require$$9.debugFn('notice', `Starting optimization for ${cwd}`);
|
|
7378
|
+
require$$9.debugDir('inspect', {
|
|
7379
|
+
cwd,
|
|
7380
|
+
outputKind,
|
|
7381
|
+
pin,
|
|
7382
|
+
prod
|
|
7383
|
+
});
|
|
7302
7384
|
const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
|
|
7303
7385
|
cmdName: CMD_NAME$p,
|
|
7304
7386
|
logger: logger.logger,
|
|
7305
7387
|
prod
|
|
7306
7388
|
});
|
|
7307
7389
|
if (!pkgEnvCResult.ok) {
|
|
7390
|
+
require$$9.debugFn('warn', 'Package environment validation failed');
|
|
7391
|
+
require$$9.debugDir('inspect', {
|
|
7392
|
+
pkgEnvCResult
|
|
7393
|
+
});
|
|
7308
7394
|
await outputOptimizeResult(pkgEnvCResult, outputKind);
|
|
7309
7395
|
return;
|
|
7310
7396
|
}
|
|
7311
7397
|
const pkgEnvDetails = pkgEnvCResult.data;
|
|
7312
7398
|
if (!pkgEnvDetails) {
|
|
7399
|
+
require$$9.debugFn('warn', 'No package environment details found');
|
|
7313
7400
|
await outputOptimizeResult({
|
|
7314
7401
|
ok: false,
|
|
7315
7402
|
message: 'No package found.',
|
|
@@ -7317,11 +7404,16 @@ async function handleOptimize({
|
|
|
7317
7404
|
}, outputKind);
|
|
7318
7405
|
return;
|
|
7319
7406
|
}
|
|
7407
|
+
require$$9.debugFn('notice', `Detected package manager: ${pkgEnvDetails.agent} v${pkgEnvDetails.agentVersion}`);
|
|
7408
|
+
require$$9.debugDir('inspect', {
|
|
7409
|
+
pkgEnvDetails
|
|
7410
|
+
});
|
|
7320
7411
|
const {
|
|
7321
7412
|
agent,
|
|
7322
7413
|
agentVersion
|
|
7323
7414
|
} = pkgEnvDetails;
|
|
7324
7415
|
if (agent === VLT) {
|
|
7416
|
+
require$$9.debugFn('warn', `${agent} does not support overrides`);
|
|
7325
7417
|
await outputOptimizeResult({
|
|
7326
7418
|
ok: false,
|
|
7327
7419
|
message: 'Unsupported',
|
|
@@ -7330,10 +7422,16 @@ async function handleOptimize({
|
|
|
7330
7422
|
return;
|
|
7331
7423
|
}
|
|
7332
7424
|
logger.logger.info(`Optimizing packages for ${agent} v${agentVersion}.\n`);
|
|
7333
|
-
|
|
7425
|
+
require$$9.debugFn('notice', 'Applying optimization');
|
|
7426
|
+
const optimizationResult = await applyOptimization(pkgEnvDetails, {
|
|
7334
7427
|
pin,
|
|
7335
7428
|
prod
|
|
7336
|
-
})
|
|
7429
|
+
});
|
|
7430
|
+
require$$9.debugFn('notice', `Optimization ${optimizationResult.ok ? 'succeeded' : 'failed'}`);
|
|
7431
|
+
require$$9.debugDir('inspect', {
|
|
7432
|
+
optimizationResult
|
|
7433
|
+
});
|
|
7434
|
+
await outputOptimizeResult(optimizationResult, outputKind);
|
|
7337
7435
|
}
|
|
7338
7436
|
|
|
7339
7437
|
const CMD_NAME$o = 'optimize';
|
|
@@ -7501,10 +7599,20 @@ async function handleDependencies({
|
|
|
7501
7599
|
offset,
|
|
7502
7600
|
outputKind
|
|
7503
7601
|
}) {
|
|
7602
|
+
require$$9.debugFn('notice', `Fetching dependencies with limit=${limit}, offset=${offset}`);
|
|
7603
|
+
require$$9.debugDir('inspect', {
|
|
7604
|
+
limit,
|
|
7605
|
+
offset,
|
|
7606
|
+
outputKind
|
|
7607
|
+
});
|
|
7504
7608
|
const result = await fetchDependencies({
|
|
7505
7609
|
limit,
|
|
7506
7610
|
offset
|
|
7507
7611
|
});
|
|
7612
|
+
require$$9.debugFn('notice', `Dependencies ${result.ok ? 'fetched successfully' : 'fetch failed'}`);
|
|
7613
|
+
require$$9.debugDir('inspect', {
|
|
7614
|
+
result
|
|
7615
|
+
});
|
|
7508
7616
|
await outputDependencies(result, {
|
|
7509
7617
|
limit,
|
|
7510
7618
|
offset,
|
|
@@ -7574,7 +7682,7 @@ async function run$t(argv, importMeta, {
|
|
|
7574
7682
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
7575
7683
|
nook: true,
|
|
7576
7684
|
test: !json || !markdown,
|
|
7577
|
-
message:
|
|
7685
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
7578
7686
|
fail: 'bad'
|
|
7579
7687
|
}, {
|
|
7580
7688
|
nook: true,
|
|
@@ -7915,7 +8023,15 @@ async function outputOrganizationList(orgsCResult, outputKind = 'text') {
|
|
|
7915
8023
|
}
|
|
7916
8024
|
|
|
7917
8025
|
async function handleOrganizationList(outputKind = 'text') {
|
|
8026
|
+
require$$9.debugFn('notice', 'Fetching organization list');
|
|
8027
|
+
require$$9.debugDir('inspect', {
|
|
8028
|
+
outputKind
|
|
8029
|
+
});
|
|
7918
8030
|
const data = await utils.fetchOrganization();
|
|
8031
|
+
require$$9.debugFn('notice', `Organization list ${data.ok ? 'fetched successfully' : 'fetch failed'}`);
|
|
8032
|
+
require$$9.debugDir('inspect', {
|
|
8033
|
+
data
|
|
8034
|
+
});
|
|
7919
8035
|
await outputOrganizationList(data, outputKind);
|
|
7920
8036
|
}
|
|
7921
8037
|
|
|
@@ -7969,7 +8085,7 @@ async function run$q(argv, importMeta, {
|
|
|
7969
8085
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
7970
8086
|
nook: true,
|
|
7971
8087
|
test: !json || !markdown,
|
|
7972
|
-
message:
|
|
8088
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
7973
8089
|
fail: 'bad'
|
|
7974
8090
|
}, {
|
|
7975
8091
|
nook: true,
|
|
@@ -8319,7 +8435,16 @@ function createMarkdownReport(data) {
|
|
|
8319
8435
|
}
|
|
8320
8436
|
|
|
8321
8437
|
async function handlePurlDeepScore(purl, outputKind) {
|
|
8438
|
+
require$$9.debugFn('notice', `Fetching deep score for ${purl}`);
|
|
8439
|
+
require$$9.debugDir('inspect', {
|
|
8440
|
+
purl,
|
|
8441
|
+
outputKind
|
|
8442
|
+
});
|
|
8322
8443
|
const result = await fetchPurlDeepScore(purl);
|
|
8444
|
+
require$$9.debugFn('notice', `Deep score ${result.ok ? 'fetched successfully' : 'fetch failed'}`);
|
|
8445
|
+
require$$9.debugDir('inspect', {
|
|
8446
|
+
result
|
|
8447
|
+
});
|
|
8323
8448
|
await outputPurlsDeepScore(purl, result, outputKind);
|
|
8324
8449
|
}
|
|
8325
8450
|
|
|
@@ -8751,7 +8876,16 @@ async function handlePurlsShallowScore({
|
|
|
8751
8876
|
outputKind,
|
|
8752
8877
|
purls
|
|
8753
8878
|
}) {
|
|
8879
|
+
require$$9.debugFn('notice', `Fetching shallow scores for ${purls.length} packages`);
|
|
8880
|
+
require$$9.debugDir('inspect', {
|
|
8881
|
+
purls,
|
|
8882
|
+
outputKind
|
|
8883
|
+
});
|
|
8754
8884
|
const packageData = await fetchPurlsShallowScore(purls);
|
|
8885
|
+
require$$9.debugFn('notice', `Shallow scores ${packageData.ok ? 'fetched successfully' : 'fetch failed'}`);
|
|
8886
|
+
require$$9.debugDir('inspect', {
|
|
8887
|
+
packageData
|
|
8888
|
+
});
|
|
8755
8889
|
outputPurlsShallowScore(purls, packageData, outputKind);
|
|
8756
8890
|
}
|
|
8757
8891
|
|
|
@@ -9051,7 +9185,7 @@ async function computeSHA256(filepath) {
|
|
|
9051
9185
|
return {
|
|
9052
9186
|
ok: false,
|
|
9053
9187
|
message: 'Failed to compute file hash',
|
|
9054
|
-
cause: `Unable to read file ${filepath}: ${e
|
|
9188
|
+
cause: `Unable to read file ${filepath}: ${utils.getErrorCause(e)}`
|
|
9055
9189
|
};
|
|
9056
9190
|
}
|
|
9057
9191
|
}
|
|
@@ -9150,9 +9284,7 @@ async function processFilePatch(pkgPath, fileName, fileInfo, socketDir, options)
|
|
|
9150
9284
|
logger.logger.success(`Patch applied successfully`);
|
|
9151
9285
|
} catch (e) {
|
|
9152
9286
|
logger.logger.error('Error applying patch');
|
|
9153
|
-
require$$9.debugDir('
|
|
9154
|
-
error: e
|
|
9155
|
-
});
|
|
9287
|
+
require$$9.debugDir('error', e);
|
|
9156
9288
|
result = false;
|
|
9157
9289
|
}
|
|
9158
9290
|
logger.logger.groupEnd();
|
|
@@ -9232,7 +9364,7 @@ async function handlePatch({
|
|
|
9232
9364
|
} catch (e) {
|
|
9233
9365
|
spinner.stop();
|
|
9234
9366
|
let message = 'Failed to apply patches';
|
|
9235
|
-
let cause = e
|
|
9367
|
+
let cause = utils.getErrorCause(e);
|
|
9236
9368
|
if (e instanceof SyntaxError) {
|
|
9237
9369
|
message = `Invalid JSON in ${constants.MANIFEST_JSON}`;
|
|
9238
9370
|
cause = e.message;
|
|
@@ -9370,10 +9502,10 @@ async function run$l(argv, importMeta, context) {
|
|
|
9370
9502
|
API Token Requirements
|
|
9371
9503
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$g}`)}
|
|
9372
9504
|
|
|
9373
|
-
Note: Everything after "
|
|
9374
|
-
Only the
|
|
9505
|
+
Note: Everything after "${constants.PNPM}" is passed to the ${constants.PNPM} command.
|
|
9506
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
9375
9507
|
|
|
9376
|
-
Use \`socket wrapper on\` to alias this command as
|
|
9508
|
+
Use \`socket wrapper on\` to alias this command as \`${constants.PNPM}\`.
|
|
9377
9509
|
|
|
9378
9510
|
Examples
|
|
9379
9511
|
$ ${command}
|
|
@@ -9393,14 +9525,16 @@ async function run$l(argv, importMeta, context) {
|
|
|
9393
9525
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
9394
9526
|
return;
|
|
9395
9527
|
}
|
|
9396
|
-
const
|
|
9528
|
+
const shadowPnpmBin = /*@__PURE__*/require$3(constants.default.shadowPnpmBinPath);
|
|
9397
9529
|
process.exitCode = 1;
|
|
9398
9530
|
|
|
9399
9531
|
// Filter Socket flags from argv.
|
|
9400
9532
|
const filteredArgv = utils.filterFlags(argv, config.flags);
|
|
9401
9533
|
const {
|
|
9402
9534
|
spawnPromise
|
|
9403
|
-
} = await
|
|
9535
|
+
} = await shadowPnpmBin(filteredArgv, {
|
|
9536
|
+
stdio: 'inherit'
|
|
9537
|
+
});
|
|
9404
9538
|
await spawnPromise;
|
|
9405
9539
|
process.exitCode = 0;
|
|
9406
9540
|
}
|
|
@@ -9440,7 +9574,7 @@ const config$4 = {
|
|
|
9440
9574
|
the Socket wrapper. Use at your own risk.
|
|
9441
9575
|
|
|
9442
9576
|
Note: Everything after "raw-npm" is passed to the npm command.
|
|
9443
|
-
Only the
|
|
9577
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
9444
9578
|
|
|
9445
9579
|
Examples
|
|
9446
9580
|
$ ${command} install -g cowsay
|
|
@@ -9503,7 +9637,7 @@ const config$3 = {
|
|
|
9503
9637
|
the Socket wrapper. Use at your own risk.
|
|
9504
9638
|
|
|
9505
9639
|
Note: Everything after "raw-npx" is passed to the npx command.
|
|
9506
|
-
Only the
|
|
9640
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
9507
9641
|
|
|
9508
9642
|
Examples
|
|
9509
9643
|
$ ${command} cowsay
|
|
@@ -9588,6 +9722,16 @@ async function handleCreateRepo({
|
|
|
9588
9722
|
repoName,
|
|
9589
9723
|
visibility
|
|
9590
9724
|
}, outputKind) {
|
|
9725
|
+
require$$9.debugFn('notice', `Creating repository ${orgSlug}/${repoName}`);
|
|
9726
|
+
require$$9.debugDir('inspect', {
|
|
9727
|
+
defaultBranch,
|
|
9728
|
+
description,
|
|
9729
|
+
homepage,
|
|
9730
|
+
orgSlug,
|
|
9731
|
+
repoName,
|
|
9732
|
+
visibility,
|
|
9733
|
+
outputKind
|
|
9734
|
+
});
|
|
9591
9735
|
const data = await fetchCreateRepo({
|
|
9592
9736
|
defaultBranch,
|
|
9593
9737
|
description,
|
|
@@ -9596,6 +9740,10 @@ async function handleCreateRepo({
|
|
|
9596
9740
|
repoName,
|
|
9597
9741
|
visibility
|
|
9598
9742
|
});
|
|
9743
|
+
require$$9.debugFn('notice', `Repository creation ${data.ok ? 'succeeded' : 'failed'}`);
|
|
9744
|
+
require$$9.debugDir('inspect', {
|
|
9745
|
+
data
|
|
9746
|
+
});
|
|
9599
9747
|
outputCreateRepo(data, repoName, outputKind);
|
|
9600
9748
|
}
|
|
9601
9749
|
|
|
@@ -10124,7 +10272,7 @@ async function run$g(argv, importMeta, {
|
|
|
10124
10272
|
}, {
|
|
10125
10273
|
nook: true,
|
|
10126
10274
|
test: !json || !markdown,
|
|
10127
|
-
message:
|
|
10275
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
10128
10276
|
fail: 'bad'
|
|
10129
10277
|
}, {
|
|
10130
10278
|
nook: true,
|
|
@@ -10490,7 +10638,7 @@ async function run$e(argv, importMeta, {
|
|
|
10490
10638
|
}, {
|
|
10491
10639
|
nook: true,
|
|
10492
10640
|
test: !json || !markdown,
|
|
10493
|
-
message:
|
|
10641
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
10494
10642
|
fail: 'bad'
|
|
10495
10643
|
}, {
|
|
10496
10644
|
nook: true,
|
|
@@ -11383,7 +11531,7 @@ async function run$b(argv, importMeta, {
|
|
|
11383
11531
|
}, {
|
|
11384
11532
|
nook: true,
|
|
11385
11533
|
test: !json || !markdown,
|
|
11386
|
-
message:
|
|
11534
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
11387
11535
|
fail: 'bad'
|
|
11388
11536
|
}, {
|
|
11389
11537
|
nook: true,
|
|
@@ -11792,19 +11940,17 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
|
|
|
11792
11940
|
};
|
|
11793
11941
|
} catch (e) {
|
|
11794
11942
|
logger.logger.fail('An error was thrown while trying to download a manifest file... url:', downloadUrl);
|
|
11795
|
-
require$$9.debugDir('
|
|
11796
|
-
error: e
|
|
11797
|
-
});
|
|
11943
|
+
require$$9.debugDir('error', e);
|
|
11798
11944
|
|
|
11799
11945
|
// If an error occurs and fileStream was created, attempt to clean up.
|
|
11800
11946
|
if (fs$1.existsSync(localPath)) {
|
|
11801
11947
|
// Check if fileStream was even opened before trying to delete
|
|
11802
11948
|
// This check might be too simplistic depending on when error occurs
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
}
|
|
11807
|
-
}
|
|
11949
|
+
try {
|
|
11950
|
+
await fs$1.promises.unlink(localPath);
|
|
11951
|
+
} catch (e) {
|
|
11952
|
+
logger.logger.fail(utils.formatErrorWithDetail(`Error deleting partial file ${localPath}`, e));
|
|
11953
|
+
}
|
|
11808
11954
|
}
|
|
11809
11955
|
// Construct a more informative error message
|
|
11810
11956
|
let detailedError = `Error during download of ${downloadUrl}: ${e.message}`;
|
|
@@ -13428,8 +13574,8 @@ async function fetchScan(orgSlug, scanId) {
|
|
|
13428
13574
|
return JSON.parse(line);
|
|
13429
13575
|
} catch (e) {
|
|
13430
13576
|
ok = false;
|
|
13431
|
-
require$$9.debugFn('error', '
|
|
13432
|
-
require$$9.debugDir('
|
|
13577
|
+
require$$9.debugFn('error', 'Failed to parse scan result line as JSON');
|
|
13578
|
+
require$$9.debugDir('error', {
|
|
13433
13579
|
error: e,
|
|
13434
13580
|
line
|
|
13435
13581
|
});
|
|
@@ -13627,7 +13773,7 @@ async function run$4(argv, importMeta, {
|
|
|
13627
13773
|
}, {
|
|
13628
13774
|
nook: true,
|
|
13629
13775
|
test: !json || !markdown,
|
|
13630
|
-
message:
|
|
13776
|
+
message: `The \`${constants.FLAG_JSON}\` and \`${constants.FLAG_MARKDOWN}\` flags can not be used at the same time`,
|
|
13631
13777
|
fail: 'bad'
|
|
13632
13778
|
}, {
|
|
13633
13779
|
nook: true,
|
|
@@ -14309,10 +14455,8 @@ Do you want to install the Socket npm wrapper (this will create an alias to the
|
|
|
14309
14455
|
}
|
|
14310
14456
|
}
|
|
14311
14457
|
} catch (e) {
|
|
14312
|
-
require$$9.debugFn('
|
|
14313
|
-
require$$9.debugDir('
|
|
14314
|
-
error: e
|
|
14315
|
-
});
|
|
14458
|
+
require$$9.debugFn('warn', 'Tab completion setup failed (non-fatal)');
|
|
14459
|
+
require$$9.debugDir('warn', e);
|
|
14316
14460
|
// Ignore. Skip tab completion setup.
|
|
14317
14461
|
}
|
|
14318
14462
|
if (!updatedTabCompletion) {
|
|
@@ -14345,7 +14489,7 @@ async function setupShadowNpm(query) {
|
|
|
14345
14489
|
addSocketWrapper(zshRcPath);
|
|
14346
14490
|
}
|
|
14347
14491
|
} catch (e) {
|
|
14348
|
-
throw new Error(`There was an issue setting up the alias: ${e
|
|
14492
|
+
throw new Error(`There was an issue setting up the alias: ${utils.getErrorCause(e)}`);
|
|
14349
14493
|
}
|
|
14350
14494
|
}
|
|
14351
14495
|
}
|
|
@@ -14507,10 +14651,10 @@ async function run(argv, importMeta, context) {
|
|
|
14507
14651
|
API Token Requirements
|
|
14508
14652
|
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME}`)}
|
|
14509
14653
|
|
|
14510
|
-
Note: Everything after "
|
|
14511
|
-
Only the
|
|
14654
|
+
Note: Everything after "${constants.YARN}" is passed to the ${constants.YARN} command.
|
|
14655
|
+
Only the \`${constants.FLAG_DRY_RUN}\` and \`${constants.FLAG_HELP}\` flags are caught here.
|
|
14512
14656
|
|
|
14513
|
-
Use \`socket wrapper on\` to alias this command as
|
|
14657
|
+
Use \`socket wrapper on\` to alias this command as \`${constants.YARN}\`.
|
|
14514
14658
|
|
|
14515
14659
|
Examples
|
|
14516
14660
|
$ ${command}
|
|
@@ -14530,14 +14674,16 @@ async function run(argv, importMeta, context) {
|
|
|
14530
14674
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
14531
14675
|
return;
|
|
14532
14676
|
}
|
|
14533
|
-
const
|
|
14677
|
+
const shadowYarnBin = /*@__PURE__*/require$1(constants.default.shadowYarnBinPath);
|
|
14534
14678
|
process.exitCode = 1;
|
|
14535
14679
|
|
|
14536
14680
|
// Filter Socket flags from argv.
|
|
14537
14681
|
const filteredArgv = utils.filterFlags(argv, config.flags);
|
|
14538
14682
|
const {
|
|
14539
14683
|
spawnPromise
|
|
14540
|
-
} = await
|
|
14684
|
+
} = await shadowYarnBin(filteredArgv, {
|
|
14685
|
+
stdio: 'inherit'
|
|
14686
|
+
});
|
|
14541
14687
|
await spawnPromise;
|
|
14542
14688
|
process.exitCode = 0;
|
|
14543
14689
|
}
|
|
@@ -14679,10 +14825,8 @@ void (async () => {
|
|
|
14679
14825
|
});
|
|
14680
14826
|
} catch (e) {
|
|
14681
14827
|
process.exitCode = 1;
|
|
14682
|
-
require$$9.debugFn('error', '
|
|
14683
|
-
require$$9.debugDir('
|
|
14684
|
-
error: e
|
|
14685
|
-
});
|
|
14828
|
+
require$$9.debugFn('error', 'CLI uncaught error');
|
|
14829
|
+
require$$9.debugDir('error', e);
|
|
14686
14830
|
let errorBody;
|
|
14687
14831
|
let errorTitle;
|
|
14688
14832
|
let errorMessage = '';
|
|
@@ -14734,5 +14878,5 @@ void (async () => {
|
|
|
14734
14878
|
await utils.captureException(e);
|
|
14735
14879
|
}
|
|
14736
14880
|
})();
|
|
14737
|
-
//# debugId=
|
|
14881
|
+
//# debugId=6d9d1b81-f05f-4bdf-ae16-71ba7e848b55
|
|
14738
14882
|
//# sourceMappingURL=cli.js.map
|