@socketsecurity/cli-with-sentry 1.1.8 ā 1.1.12
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 +24 -1
- package/README.md +3 -3
- package/bin/cli.js +2 -1
- package/bin/npm-cli.js +2 -1
- package/bin/npx-cli.js +2 -1
- package/bin/pnpm-cli.js +29 -0
- package/bin/yarn-cli.js +29 -0
- package/dist/cli.js +857 -612
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +35 -10
- package/dist/constants.js.map +1 -1
- package/dist/flags.js +16 -17
- package/dist/flags.js.map +1 -1
- package/dist/instrument-with-sentry.js +3 -3
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/npm-cli.js +26 -0
- package/dist/npm-cli.js.map +1 -0
- package/dist/npx-cli.js +26 -0
- package/dist/npx-cli.js.map +1 -0
- package/dist/pnpm-cli.js +26 -0
- package/dist/pnpm-cli.js.map +1 -0
- package/dist/shadow-npm-inject.js +9 -11
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/shadow-pnpm-bin.js +235 -0
- package/dist/shadow-pnpm-bin.js.map +1 -0
- package/dist/shadow-yarn-bin.js +200 -0
- package/dist/shadow-yarn-bin.js.map +1 -0
- package/dist/socket-completion.bash +0 -0
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/analytics/cmd-analytics.d.mts +2 -3
- package/dist/types/commands/analytics/cmd-analytics.d.mts.map +1 -1
- package/dist/types/commands/audit-log/cmd-audit-log.d.mts +2 -3
- package/dist/types/commands/audit-log/cmd-audit-log.d.mts.map +1 -1
- package/dist/types/commands/ci/cmd-ci.d.mts +2 -3
- package/dist/types/commands/ci/cmd-ci.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-auto.d.mts +2 -3
- package/dist/types/commands/config/cmd-config-auto.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-get.d.mts +2 -3
- package/dist/types/commands/config/cmd-config-get.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-list.d.mts +2 -3
- package/dist/types/commands/config/cmd-config-list.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-set.d.mts +2 -3
- package/dist/types/commands/config/cmd-config-set.d.mts.map +1 -1
- package/dist/types/commands/config/cmd-config-unset.d.mts +2 -3
- package/dist/types/commands/config/cmd-config-unset.d.mts.map +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts +2 -3
- package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/env-helpers.d.mts +1 -1
- package/dist/types/commands/fix/env-helpers.d.mts.map +1 -1
- package/dist/types/commands/fix/git.d.mts +1 -1
- package/dist/types/commands/fix/git.d.mts.map +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts +5 -0
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/pull-request.d.mts +1 -1
- package/dist/types/commands/fix/pull-request.d.mts.map +1 -1
- package/dist/types/commands/install/cmd-install-completion.d.mts +2 -3
- package/dist/types/commands/install/cmd-install-completion.d.mts.map +1 -1
- package/dist/types/commands/json/cmd-json.d.mts +2 -3
- package/dist/types/commands/json/cmd-json.d.mts.map +1 -1
- package/dist/types/commands/login/cmd-login.d.mts +2 -3
- package/dist/types/commands/login/cmd-login.d.mts.map +1 -1
- package/dist/types/commands/logout/cmd-logout.d.mts +2 -3
- package/dist/types/commands/logout/cmd-logout.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-auto.d.mts +2 -3
- package/dist/types/commands/manifest/cmd-manifest-auto.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts +2 -3
- package/dist/types/commands/manifest/cmd-manifest-cdxgen.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-conda.d.mts +2 -3
- package/dist/types/commands/manifest/cmd-manifest-conda.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts +2 -3
- package/dist/types/commands/manifest/cmd-manifest-gradle.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts +2 -3
- package/dist/types/commands/manifest/cmd-manifest-kotlin.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-scala.d.mts +2 -3
- package/dist/types/commands/manifest/cmd-manifest-scala.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest-setup.d.mts +2 -3
- package/dist/types/commands/manifest/cmd-manifest-setup.d.mts.map +1 -1
- package/dist/types/commands/manifest/cmd-manifest.d.mts +2 -3
- package/dist/types/commands/manifest/cmd-manifest.d.mts.map +1 -1
- package/dist/types/commands/manifest/detect-manifest-actions.d.mts.map +1 -1
- package/dist/types/commands/manifest/generate_auto_manifest.d.mts.map +1 -1
- package/dist/types/commands/manifest/output-requirements.d.mts.map +1 -1
- package/dist/types/commands/manifest/run-cdxgen.d.mts.map +1 -1
- package/dist/types/commands/manifest/setup-manifest-config.d.mts.map +1 -1
- package/dist/types/commands/npm/cmd-npm.d.mts +2 -3
- package/dist/types/commands/npm/cmd-npm.d.mts.map +1 -1
- package/dist/types/commands/npx/cmd-npx.d.mts +2 -3
- package/dist/types/commands/npx/cmd-npx.d.mts.map +1 -1
- package/dist/types/commands/oops/cmd-oops.d.mts +2 -3
- package/dist/types/commands/oops/cmd-oops.d.mts.map +1 -1
- package/dist/types/commands/optimize/cmd-optimize.d.mts +2 -3
- package/dist/types/commands/optimize/cmd-optimize.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-dependencies.d.mts +2 -3
- package/dist/types/commands/organization/cmd-organization-dependencies.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-list.d.mts +2 -3
- package/dist/types/commands/organization/cmd-organization-list.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-policy-license.d.mts +2 -3
- package/dist/types/commands/organization/cmd-organization-policy-license.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-policy-security.d.mts +2 -3
- package/dist/types/commands/organization/cmd-organization-policy-security.d.mts.map +1 -1
- package/dist/types/commands/organization/cmd-organization-quota.d.mts +2 -3
- package/dist/types/commands/organization/cmd-organization-quota.d.mts.map +1 -1
- package/dist/types/commands/package/cmd-package-score.d.mts +2 -3
- package/dist/types/commands/package/cmd-package-score.d.mts.map +1 -1
- package/dist/types/commands/package/cmd-package-shallow.d.mts +2 -3
- package/dist/types/commands/package/cmd-package-shallow.d.mts.map +1 -1
- package/dist/types/commands/package/output-purls-shallow-score.d.mts.map +1 -1
- package/dist/types/commands/patch/cmd-patch.d.mts +2 -3
- package/dist/types/commands/patch/cmd-patch.d.mts.map +1 -1
- package/dist/types/commands/patch/handle-patch.d.mts.map +1 -1
- package/dist/types/commands/pnpm/cmd-pnpm.d.mts +10 -0
- package/dist/types/commands/pnpm/cmd-pnpm.d.mts.map +1 -0
- package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts +2 -3
- package/dist/types/commands/raw-npm/cmd-raw-npm.d.mts.map +1 -1
- package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts +2 -3
- package/dist/types/commands/raw-npx/cmd-raw-npx.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-create.d.mts +2 -3
- package/dist/types/commands/repository/cmd-repository-create.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-del.d.mts +2 -3
- package/dist/types/commands/repository/cmd-repository-del.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-list.d.mts +2 -3
- package/dist/types/commands/repository/cmd-repository-list.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-update.d.mts +2 -3
- package/dist/types/commands/repository/cmd-repository-update.d.mts.map +1 -1
- package/dist/types/commands/repository/cmd-repository-view.d.mts +2 -3
- package/dist/types/commands/repository/cmd-repository-view.d.mts.map +1 -1
- package/dist/types/commands/repository/handle-list-repos.d.mts +2 -1
- package/dist/types/commands/repository/handle-list-repos.d.mts.map +1 -1
- package/dist/types/commands/repository/output-list-repos.d.mts +2 -1
- package/dist/types/commands/repository/output-list-repos.d.mts.map +1 -1
- package/dist/types/commands/repository/types.d.mts +2 -0
- package/dist/types/commands/repository/types.d.mts.map +1 -0
- package/dist/types/commands/scan/cmd-scan-create.d.mts +2 -3
- package/dist/types/commands/scan/cmd-scan-create.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-del.d.mts +2 -3
- package/dist/types/commands/scan/cmd-scan-del.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-diff.d.mts +2 -3
- package/dist/types/commands/scan/cmd-scan-diff.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-github.d.mts +2 -3
- package/dist/types/commands/scan/cmd-scan-github.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-list.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-metadata.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-reach.d.mts +2 -3
- package/dist/types/commands/scan/cmd-scan-reach.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-report.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-setup.d.mts +2 -3
- package/dist/types/commands/scan/cmd-scan-setup.d.mts.map +1 -1
- package/dist/types/commands/scan/cmd-scan-view.d.mts.map +1 -1
- package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts +2 -3
- package/dist/types/commands/threat-feed/cmd-threat-feed.d.mts.map +1 -1
- package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts +2 -3
- package/dist/types/commands/uninstall/cmd-uninstall-completion.d.mts.map +1 -1
- package/dist/types/commands/wrapper/cmd-wrapper.d.mts +2 -3
- package/dist/types/commands/wrapper/cmd-wrapper.d.mts.map +1 -1
- package/dist/types/commands/yarn/cmd-yarn.d.mts +10 -0
- package/dist/types/commands/yarn/cmd-yarn.d.mts.map +1 -0
- package/dist/types/commands.d.mts +31 -63
- package/dist/types/commands.d.mts.map +1 -1
- package/dist/types/constants.d.mts +17 -1
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/flags.d.mts.map +1 -1
- package/dist/types/npm-cli.d.mts +3 -0
- package/dist/types/npm-cli.d.mts.map +1 -0
- package/dist/types/npx-cli.d.mts +3 -0
- package/dist/types/npx-cli.d.mts.map +1 -0
- package/dist/types/pnpm-cli.d.mts +3 -0
- package/dist/types/pnpm-cli.d.mts.map +1 -0
- package/dist/types/shadow/npm/arborist-helpers.d.mts.map +1 -1
- package/dist/types/shadow/pnpm/bin.d.mts +10 -0
- package/dist/types/shadow/pnpm/bin.d.mts.map +1 -0
- package/dist/types/shadow/pnpm/link.d.mts +2 -0
- package/dist/types/shadow/pnpm/link.d.mts.map +1 -0
- package/dist/types/shadow/yarn/bin.d.mts +10 -0
- package/dist/types/shadow/yarn/bin.d.mts.map +1 -0
- package/dist/types/shadow/yarn/link.d.mts +2 -0
- package/dist/types/shadow/yarn/link.d.mts.map +1 -0
- package/dist/types/utils/alerts-map.d.mts.map +1 -1
- package/dist/types/utils/api.d.mts +22 -1
- package/dist/types/utils/api.d.mts.map +1 -1
- package/dist/types/utils/cmd.d.mts +25 -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/config.d.mts +1 -1
- package/dist/types/utils/config.d.mts.map +1 -1
- package/dist/types/utils/cve-to-ghsa.d.mts +6 -0
- package/dist/types/utils/cve-to-ghsa.d.mts.map +1 -0
- package/dist/types/utils/git.d.mts +4 -4
- package/dist/types/utils/git.d.mts.map +1 -1
- package/dist/types/utils/github.d.mts.map +1 -1
- package/dist/types/utils/lockfile.d.mts +1 -1
- package/dist/types/utils/lockfile.d.mts.map +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts +16 -1
- package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
- package/dist/types/utils/npm-config.d.mts +1 -1
- package/dist/types/utils/npm-config.d.mts.map +1 -1
- package/dist/types/utils/npm-package-arg.d.mts +1 -1
- package/dist/types/utils/npm-package-arg.d.mts.map +1 -1
- 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 +5 -0
- package/dist/types/utils/pnpm-paths.d.mts.map +1 -0
- package/dist/types/utils/pnpm.d.mts +2 -2
- package/dist/types/utils/pnpm.d.mts.map +1 -1
- package/dist/types/utils/purl-to-ghsa.d.mts +6 -0
- package/dist/types/utils/purl-to-ghsa.d.mts.map +1 -0
- package/dist/types/utils/purl.d.mts +6 -6
- package/dist/types/utils/purl.d.mts.map +1 -1
- package/dist/types/utils/requirements.d.mts +4 -0
- package/dist/types/utils/requirements.d.mts.map +1 -1
- package/dist/types/utils/sdk.d.mts.map +1 -1
- package/dist/types/utils/semver.d.mts +3 -4
- package/dist/types/utils/semver.d.mts.map +1 -1
- package/dist/types/utils/socket-json.d.mts +3 -0
- package/dist/types/utils/socket-json.d.mts.map +1 -1
- package/dist/types/utils/strings.d.mts +2 -0
- package/dist/types/utils/strings.d.mts.map +1 -0
- package/dist/types/utils/yarn-paths.d.mts +5 -0
- package/dist/types/utils/yarn-paths.d.mts.map +1 -0
- package/dist/types/utils/yarn-version.d.mts +2 -0
- package/dist/types/utils/yarn-version.d.mts.map +1 -0
- package/dist/types/yarn-cli.d.mts +3 -0
- package/dist/types/yarn-cli.d.mts.map +1 -0
- package/dist/utils.js +614 -141
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +58640 -64697
- package/dist/yarn-cli.js +26 -0
- package/dist/yarn-cli.js.map +1 -0
- package/external/@socketsecurity/registry/lib/url.js +13 -12
- package/external/blessed/lib/tput.js +13 -13
- package/external/blessed/lib/widgets/ansiimage.js +1 -1
- package/external/blessed/lib/widgets/bigtext.js +1 -1
- package/external/blessed/lib/widgets/box.js +1 -1
- package/external/blessed/lib/widgets/button.js +1 -1
- package/external/blessed/lib/widgets/checkbox.js +1 -1
- package/external/blessed/lib/widgets/element.js +1 -1
- package/external/blessed/lib/widgets/filemanager.js +1 -1
- package/external/blessed/lib/widgets/form.js +1 -1
- package/external/blessed/lib/widgets/image.js +1 -1
- package/external/blessed/lib/widgets/input.js +1 -1
- package/external/blessed/lib/widgets/layout.js +1 -1
- package/external/blessed/lib/widgets/line.js +1 -1
- package/external/blessed/lib/widgets/list.js +1 -1
- package/external/blessed/lib/widgets/listbar.js +1 -1
- package/external/blessed/lib/widgets/listtable.js +1 -1
- package/external/blessed/lib/widgets/loading.js +1 -1
- package/external/blessed/lib/widgets/log.js +1 -1
- package/external/blessed/lib/widgets/message.js +1 -1
- package/external/blessed/lib/widgets/node.js +3 -2
- package/external/blessed/lib/widgets/overlayimage.js +1 -1
- package/external/blessed/lib/widgets/progressbar.js +1 -1
- package/external/blessed/lib/widgets/prompt.js +1 -1
- package/external/blessed/lib/widgets/question.js +1 -1
- package/external/blessed/lib/widgets/radiobutton.js +1 -1
- package/external/blessed/lib/widgets/radioset.js +1 -1
- package/external/blessed/lib/widgets/screen.js +8 -6
- package/external/blessed/lib/widgets/scrollablebox.js +1 -1
- package/external/blessed/lib/widgets/scrollabletext.js +1 -1
- package/external/blessed/lib/widgets/table.js +1 -1
- package/external/blessed/lib/widgets/terminal.js +1 -1
- package/external/blessed/lib/widgets/text.js +1 -1
- package/external/blessed/lib/widgets/textarea.js +1 -1
- package/external/blessed/lib/widgets/textbox.js +1 -1
- package/external/blessed/lib/widgets/video.js +1 -1
- package/external/blessed/vendor/tng.js +11 -4
- package/external/blessed-contrib/lib/widget/charts/bar.js +4 -4
- package/external/blessed-contrib/lib/widget/charts/line.js +4 -4
- package/logo-dark.png +0 -0
- package/logo-light.png +0 -0
- package/package.json +70 -97
- package/requirements.json +2 -2
- package/shadow-bin/npm +1 -1
- package/shadow-bin/npx +1 -1
- package/shadow-bin/pnpm +27 -0
- package/shadow-bin/yarn +27 -0
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ var require$$9 = require('../external/@socketsecurity/registry/lib/debug');
|
|
|
7
7
|
var logger = require('../external/@socketsecurity/registry/lib/logger');
|
|
8
8
|
var utils = require('./utils.js');
|
|
9
9
|
var fs = require('node:fs/promises');
|
|
10
|
-
var
|
|
10
|
+
var require$$5 = require('node:module');
|
|
11
11
|
var constants = require('./constants.js');
|
|
12
12
|
var flags = require('./flags.js');
|
|
13
13
|
var path = require('node:path');
|
|
@@ -68,7 +68,7 @@ async function fetchRepoAnalyticsData(repo, time, options) {
|
|
|
68
68
|
|
|
69
69
|
// Note: Widgets does not seem to actually work as code :'(
|
|
70
70
|
|
|
71
|
-
const require$
|
|
71
|
+
const require$8 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
72
72
|
const METRICS = ['total_critical_alerts', 'total_high_alerts', 'total_medium_alerts', 'total_low_alerts', 'total_critical_added', 'total_medium_added', 'total_low_added', 'total_high_added', 'total_critical_prevented', 'total_high_prevented', 'total_medium_prevented', 'total_low_prevented'];
|
|
73
73
|
|
|
74
74
|
// Note: This maps `new Date(date).getMonth()` to English three letters
|
|
@@ -147,11 +147,11 @@ ${utils.mdTableStringNumber('Name', 'Counts', data['top_five_alert_types'])}
|
|
|
147
147
|
`.trim() + '\n';
|
|
148
148
|
}
|
|
149
149
|
function displayAnalyticsScreen(data) {
|
|
150
|
-
const ScreenWidget = /*@__PURE__*/require$
|
|
150
|
+
const ScreenWidget = /*@__PURE__*/require$8('../external/blessed/lib/widgets/screen.js');
|
|
151
151
|
const screen = new ScreenWidget({
|
|
152
152
|
...constants.default.blessedOptions
|
|
153
153
|
});
|
|
154
|
-
const GridLayout = /*@__PURE__*/require$
|
|
154
|
+
const GridLayout = /*@__PURE__*/require$8('../external/blessed-contrib/lib/layout/grid.js');
|
|
155
155
|
const grid = new GridLayout({
|
|
156
156
|
rows: 5,
|
|
157
157
|
cols: 4,
|
|
@@ -165,7 +165,7 @@ function displayAnalyticsScreen(data) {
|
|
|
165
165
|
renderLineCharts(grid, screen, 'Total high alerts prevented from the main branch', [2, 2, 1, 2], data['total_high_prevented']);
|
|
166
166
|
renderLineCharts(grid, screen, 'Total medium alerts prevented from the main branch', [3, 0, 1, 2], data['total_medium_prevented']);
|
|
167
167
|
renderLineCharts(grid, screen, 'Total low alerts prevented from the main branch', [3, 2, 1, 2], data['total_low_prevented']);
|
|
168
|
-
const BarChart = /*@__PURE__*/require$
|
|
168
|
+
const BarChart = /*@__PURE__*/require$8('../external/blessed-contrib/lib/widget/charts/bar.js');
|
|
169
169
|
const bar = grid.set(4, 0, 1, 2, BarChart, {
|
|
170
170
|
label: 'Top 5 alert types',
|
|
171
171
|
barWidth: 10,
|
|
@@ -265,7 +265,7 @@ function formatDate(date) {
|
|
|
265
265
|
return `${Months[new Date(date).getMonth()]} ${new Date(date).getDate()}`;
|
|
266
266
|
}
|
|
267
267
|
function renderLineCharts(grid, screen, title, coords, data) {
|
|
268
|
-
const LineChart = /*@__PURE__*/require$
|
|
268
|
+
const LineChart = /*@__PURE__*/require$8('../external/blessed-contrib/lib/widget/charts/line.js');
|
|
269
269
|
const line = grid.set(...coords, LineChart, {
|
|
270
270
|
style: {
|
|
271
271
|
line: 'cyan',
|
|
@@ -323,21 +323,21 @@ async function handleAnalytics({
|
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
const CMD_NAME$
|
|
327
|
-
const description$
|
|
328
|
-
const hidden$
|
|
326
|
+
const CMD_NAME$y = 'analytics';
|
|
327
|
+
const description$F = 'Look up analytics data';
|
|
328
|
+
const hidden$x = false;
|
|
329
329
|
const cmdAnalytics = {
|
|
330
|
-
description: description$
|
|
331
|
-
hidden: hidden$
|
|
332
|
-
run: run$
|
|
330
|
+
description: description$F,
|
|
331
|
+
hidden: hidden$x,
|
|
332
|
+
run: run$S
|
|
333
333
|
};
|
|
334
|
-
async function run$
|
|
334
|
+
async function run$S(argv, importMeta, {
|
|
335
335
|
parentName
|
|
336
336
|
}) {
|
|
337
337
|
const config = {
|
|
338
|
-
commandName: CMD_NAME$
|
|
339
|
-
description: description$
|
|
340
|
-
hidden: hidden$
|
|
338
|
+
commandName: CMD_NAME$y,
|
|
339
|
+
description: description$F,
|
|
340
|
+
hidden: hidden$x,
|
|
341
341
|
flags: {
|
|
342
342
|
...flags.commonFlags,
|
|
343
343
|
...flags.outputFlags,
|
|
@@ -354,7 +354,7 @@ async function run$Q(argv, importMeta, {
|
|
|
354
354
|
$ ${command} [options] [ "org" | "repo" <reponame>] [TIME]
|
|
355
355
|
|
|
356
356
|
API Token Requirements
|
|
357
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
357
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$y}`)}
|
|
358
358
|
|
|
359
359
|
The scope is either org or repo level, defaults to org.
|
|
360
360
|
|
|
@@ -500,7 +500,7 @@ async function fetchAuditLog(config, options) {
|
|
|
500
500
|
});
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
-
const require$
|
|
503
|
+
const require$7 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
504
504
|
async function outputAuditLog(result, {
|
|
505
505
|
logType,
|
|
506
506
|
orgSlug,
|
|
@@ -628,7 +628,7 @@ async function outputWithBlessed(data, orgSlug) {
|
|
|
628
628
|
const headers = [' Event id', ' Created at', ' Event type', ' User email', ' IP address', ' User agent'];
|
|
629
629
|
|
|
630
630
|
// Note: this temporarily takes over the terminal (just like `man` does).
|
|
631
|
-
const ScreenWidget = /*@__PURE__*/require$
|
|
631
|
+
const ScreenWidget = /*@__PURE__*/require$7('../external/blessed/lib/widgets/screen.js');
|
|
632
632
|
const screen = new ScreenWidget({
|
|
633
633
|
...constants.default.blessedOptions
|
|
634
634
|
});
|
|
@@ -637,7 +637,7 @@ async function outputWithBlessed(data, orgSlug) {
|
|
|
637
637
|
// node process just to exit it. That's very bad UX.
|
|
638
638
|
// eslint-disable-next-line n/no-process-exit
|
|
639
639
|
screen.key(['escape', 'q', 'C-c'], () => process.exit(0));
|
|
640
|
-
const TableWidget = /*@__PURE__*/require$
|
|
640
|
+
const TableWidget = /*@__PURE__*/require$7('../external/blessed-contrib/lib/widget/table.js');
|
|
641
641
|
const tipsBoxHeight = 1; // 1 row for tips box
|
|
642
642
|
const detailsBoxHeight = 20; // bottom N rows for details box. 20 gives 4 lines for condensed payload before it scrolls out of view
|
|
643
643
|
|
|
@@ -667,7 +667,7 @@ async function outputWithBlessed(data, orgSlug) {
|
|
|
667
667
|
columnSpacing: 4,
|
|
668
668
|
truncate: '_'
|
|
669
669
|
});
|
|
670
|
-
const BoxWidget = /*@__PURE__*/require$
|
|
670
|
+
const BoxWidget = /*@__PURE__*/require$7('../external/blessed/lib/widgets/box.js');
|
|
671
671
|
const tipsBox = new BoxWidget({
|
|
672
672
|
bottom: detailsBoxHeight,
|
|
673
673
|
// sits just above the details box
|
|
@@ -748,21 +748,21 @@ async function handleAuditLog({
|
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
|
|
751
|
-
const CMD_NAME$
|
|
752
|
-
const description$
|
|
753
|
-
const hidden$
|
|
751
|
+
const CMD_NAME$x = 'audit-log';
|
|
752
|
+
const description$E = 'Look up the audit log for an organization';
|
|
753
|
+
const hidden$w = false;
|
|
754
754
|
const cmdAuditLog = {
|
|
755
|
-
description: description$
|
|
756
|
-
hidden: hidden$
|
|
757
|
-
run: run$
|
|
755
|
+
description: description$E,
|
|
756
|
+
hidden: hidden$w,
|
|
757
|
+
run: run$R
|
|
758
758
|
};
|
|
759
|
-
async function run$
|
|
759
|
+
async function run$R(argv, importMeta, {
|
|
760
760
|
parentName
|
|
761
761
|
}) {
|
|
762
762
|
const config = {
|
|
763
|
-
commandName: CMD_NAME$
|
|
764
|
-
description: description$
|
|
765
|
-
hidden: hidden$
|
|
763
|
+
commandName: CMD_NAME$x,
|
|
764
|
+
description: description$E,
|
|
765
|
+
hidden: hidden$w,
|
|
766
766
|
flags: {
|
|
767
767
|
...flags.commonFlags,
|
|
768
768
|
...flags.outputFlags,
|
|
@@ -790,7 +790,7 @@ async function run$P(argv, importMeta, {
|
|
|
790
790
|
$ ${command} [options] [FILTER]
|
|
791
791
|
|
|
792
792
|
API Token Requirements
|
|
793
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
793
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$x}`)}
|
|
794
794
|
|
|
795
795
|
This feature requires an Enterprise Plan. To learn more about getting access
|
|
796
796
|
to this feature and many more, please visit ${constants.default.SOCKET_WEBSITE_URL}/pricing
|
|
@@ -1574,7 +1574,7 @@ async function performReachabilityAnalysis(options) {
|
|
|
1574
1574
|
return {
|
|
1575
1575
|
ok: false,
|
|
1576
1576
|
message: 'Tier 1 Reachability analysis requires an enterprise plan',
|
|
1577
|
-
cause: `Please ${vendor.terminalLinkExports('upgrade your plan',
|
|
1577
|
+
cause: `Please ${vendor.terminalLinkExports('upgrade your plan', `${constants.SOCKET_WEBSITE_URL}/pricing`)}. This feature is only available for organizations with an enterprise plan.`
|
|
1578
1578
|
};
|
|
1579
1579
|
}
|
|
1580
1580
|
const wasSpinning = !!spinner?.isSpinning;
|
|
@@ -1671,25 +1671,25 @@ sockJson, cwd = process.cwd()) {
|
|
|
1671
1671
|
sbt: false
|
|
1672
1672
|
};
|
|
1673
1673
|
if (sockJson?.defaults?.manifest?.sbt?.disabled) {
|
|
1674
|
-
require$$9.debugLog('notice',
|
|
1674
|
+
require$$9.debugLog('notice', `[DEBUG] - sbt auto-detection is disabled in ${constants.SOCKET_JSON}`);
|
|
1675
1675
|
} else if (fs$1.existsSync(path.join(cwd, 'build.sbt'))) {
|
|
1676
1676
|
require$$9.debugLog('notice', '[DEBUG] - Detected a Scala sbt build file');
|
|
1677
1677
|
output.sbt = true;
|
|
1678
1678
|
output.count += 1;
|
|
1679
1679
|
}
|
|
1680
1680
|
if (sockJson?.defaults?.manifest?.gradle?.disabled) {
|
|
1681
|
-
require$$9.debugLog('notice',
|
|
1681
|
+
require$$9.debugLog('notice', `[DEBUG] - gradle auto-detection is disabled in ${constants.SOCKET_JSON}`);
|
|
1682
1682
|
} else if (fs$1.existsSync(path.join(cwd, 'gradlew'))) {
|
|
1683
1683
|
require$$9.debugLog('notice', '[DEBUG] - Detected a gradle build file');
|
|
1684
1684
|
output.gradle = true;
|
|
1685
1685
|
output.count += 1;
|
|
1686
1686
|
}
|
|
1687
1687
|
if (sockJson?.defaults?.manifest?.conda?.disabled) {
|
|
1688
|
-
require$$9.debugLog('notice',
|
|
1688
|
+
require$$9.debugLog('notice', `[DEBUG] - conda auto-detection is disabled in ${constants.SOCKET_JSON}`);
|
|
1689
1689
|
} else {
|
|
1690
|
-
const envyml = path.join(cwd,
|
|
1690
|
+
const envyml = path.join(cwd, constants.ENVIRONMENT_YML);
|
|
1691
1691
|
const hasEnvyml = fs$1.existsSync(envyml);
|
|
1692
|
-
const envyaml = path.join(cwd,
|
|
1692
|
+
const envyaml = path.join(cwd, constants.ENVIRONMENT_YAML);
|
|
1693
1693
|
const hasEnvyaml = !hasEnvyml && fs$1.existsSync(envyaml);
|
|
1694
1694
|
if (hasEnvyml || hasEnvyaml) {
|
|
1695
1695
|
require$$9.debugLog('notice', '[DEBUG] - Detected an environment.yml Conda file');
|
|
@@ -2057,9 +2057,9 @@ async function outputRequirements(result, outputKind, out) {
|
|
|
2057
2057
|
const arr = [];
|
|
2058
2058
|
arr.push('# Converted Conda file');
|
|
2059
2059
|
arr.push('');
|
|
2060
|
-
arr.push(
|
|
2060
|
+
arr.push(`This is the Conda \`environment.yml\` file converted to python \`${constants.REQUIREMENTS_TXT}\`:`);
|
|
2061
2061
|
arr.push('');
|
|
2062
|
-
arr.push(
|
|
2062
|
+
arr.push(`\`\`\`file=${constants.REQUIREMENTS_TXT}`);
|
|
2063
2063
|
arr.push(result.data.pip);
|
|
2064
2064
|
arr.push('```');
|
|
2065
2065
|
arr.push('');
|
|
@@ -2098,7 +2098,7 @@ async function generateAutoManifest({
|
|
|
2098
2098
|
}) {
|
|
2099
2099
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
2100
2100
|
if (verbose) {
|
|
2101
|
-
logger.logger.info(
|
|
2101
|
+
logger.logger.info(`Using this ${constants.SOCKET_JSON} for defaults:`, sockJson);
|
|
2102
2102
|
}
|
|
2103
2103
|
if (!sockJson?.defaults?.manifest?.sbt?.disabled && detected.sbt) {
|
|
2104
2104
|
logger.logger.log('Detected a Scala sbt build, generating pom files with sbt...');
|
|
@@ -2129,7 +2129,7 @@ async function generateAutoManifest({
|
|
|
2129
2129
|
cwd,
|
|
2130
2130
|
filename: sockJson.defaults?.manifest?.conda?.infile ?? 'environment.yml',
|
|
2131
2131
|
outputKind,
|
|
2132
|
-
out: sockJson.defaults?.manifest?.conda?.outfile ??
|
|
2132
|
+
out: sockJson.defaults?.manifest?.conda?.outfile ?? constants.REQUIREMENTS_TXT,
|
|
2133
2133
|
verbose: Boolean(sockJson.defaults?.manifest?.conda?.verbose)
|
|
2134
2134
|
});
|
|
2135
2135
|
}
|
|
@@ -2369,9 +2369,9 @@ const config$k = {
|
|
|
2369
2369
|
const cmdCI = {
|
|
2370
2370
|
description: config$k.description,
|
|
2371
2371
|
hidden: config$k.hidden,
|
|
2372
|
-
run: run$
|
|
2372
|
+
run: run$Q
|
|
2373
2373
|
};
|
|
2374
|
-
async function run$
|
|
2374
|
+
async function run$Q(argv, importMeta, {
|
|
2375
2375
|
parentName
|
|
2376
2376
|
}) {
|
|
2377
2377
|
const cli = utils.meowOrExit({
|
|
@@ -2613,21 +2613,21 @@ async function handleConfigAuto({
|
|
|
2613
2613
|
await outputConfigAuto(key, result, outputKind);
|
|
2614
2614
|
}
|
|
2615
2615
|
|
|
2616
|
-
const CMD_NAME$
|
|
2617
|
-
const description$
|
|
2618
|
-
const hidden$
|
|
2616
|
+
const CMD_NAME$w = 'auto';
|
|
2617
|
+
const description$D = 'Automatically discover and set the correct value config item';
|
|
2618
|
+
const hidden$v = false;
|
|
2619
2619
|
const cmdConfigAuto = {
|
|
2620
|
-
description: description$
|
|
2621
|
-
hidden: hidden$
|
|
2622
|
-
run: run$
|
|
2620
|
+
description: description$D,
|
|
2621
|
+
hidden: hidden$v,
|
|
2622
|
+
run: run$P
|
|
2623
2623
|
};
|
|
2624
|
-
async function run$
|
|
2624
|
+
async function run$P(argv, importMeta, {
|
|
2625
2625
|
parentName
|
|
2626
2626
|
}) {
|
|
2627
2627
|
const config = {
|
|
2628
|
-
commandName: CMD_NAME$
|
|
2629
|
-
description: description$
|
|
2630
|
-
hidden: hidden$
|
|
2628
|
+
commandName: CMD_NAME$w,
|
|
2629
|
+
description: description$D,
|
|
2630
|
+
hidden: hidden$v,
|
|
2631
2631
|
flags: {
|
|
2632
2632
|
...flags.commonFlags,
|
|
2633
2633
|
...flags.outputFlags
|
|
@@ -2757,9 +2757,9 @@ ${utils.getSupportedConfigEntries().map(({
|
|
|
2757
2757
|
const cmdConfigGet = {
|
|
2758
2758
|
description: config$j.description,
|
|
2759
2759
|
hidden: config$j.hidden,
|
|
2760
|
-
run: run$
|
|
2760
|
+
run: run$O
|
|
2761
2761
|
};
|
|
2762
|
-
async function run$
|
|
2762
|
+
async function run$O(argv, importMeta, {
|
|
2763
2763
|
parentName
|
|
2764
2764
|
}) {
|
|
2765
2765
|
const cli = utils.meowOrExit({
|
|
@@ -2893,9 +2893,9 @@ const config$i = {
|
|
|
2893
2893
|
const cmdConfigList = {
|
|
2894
2894
|
description: config$i.description,
|
|
2895
2895
|
hidden: config$i.hidden,
|
|
2896
|
-
run: run$
|
|
2896
|
+
run: run$N
|
|
2897
2897
|
};
|
|
2898
|
-
async function run$
|
|
2898
|
+
async function run$N(argv, importMeta, {
|
|
2899
2899
|
parentName
|
|
2900
2900
|
}) {
|
|
2901
2901
|
const cli = utils.meowOrExit({
|
|
@@ -2969,21 +2969,21 @@ async function handleConfigSet({
|
|
|
2969
2969
|
await outputConfigSet(result, outputKind);
|
|
2970
2970
|
}
|
|
2971
2971
|
|
|
2972
|
-
const CMD_NAME$
|
|
2973
|
-
const description$
|
|
2974
|
-
const hidden$
|
|
2972
|
+
const CMD_NAME$v = 'set';
|
|
2973
|
+
const description$C = 'Update the value of a local CLI config item';
|
|
2974
|
+
const hidden$u = false;
|
|
2975
2975
|
const cmdConfigSet = {
|
|
2976
|
-
description: description$
|
|
2977
|
-
hidden: hidden$
|
|
2978
|
-
run: run$
|
|
2976
|
+
description: description$C,
|
|
2977
|
+
hidden: hidden$u,
|
|
2978
|
+
run: run$M
|
|
2979
2979
|
};
|
|
2980
|
-
async function run$
|
|
2980
|
+
async function run$M(argv, importMeta, {
|
|
2981
2981
|
parentName
|
|
2982
2982
|
}) {
|
|
2983
2983
|
const config = {
|
|
2984
|
-
commandName: CMD_NAME$
|
|
2985
|
-
description: description$
|
|
2986
|
-
hidden: hidden$
|
|
2984
|
+
commandName: CMD_NAME$v,
|
|
2985
|
+
description: description$C,
|
|
2986
|
+
hidden: hidden$u,
|
|
2987
2987
|
flags: {
|
|
2988
2988
|
...flags.commonFlags,
|
|
2989
2989
|
...flags.outputFlags
|
|
@@ -3096,21 +3096,21 @@ async function handleConfigUnset({
|
|
|
3096
3096
|
await outputConfigUnset(updateResult, outputKind);
|
|
3097
3097
|
}
|
|
3098
3098
|
|
|
3099
|
-
const CMD_NAME$
|
|
3100
|
-
const description$
|
|
3101
|
-
const hidden$
|
|
3099
|
+
const CMD_NAME$u = 'unset';
|
|
3100
|
+
const description$B = 'Clear the value of a local CLI config item';
|
|
3101
|
+
const hidden$t = false;
|
|
3102
3102
|
const cmdConfigUnset = {
|
|
3103
|
-
description: description$
|
|
3104
|
-
hidden: hidden$
|
|
3105
|
-
run: run$
|
|
3103
|
+
description: description$B,
|
|
3104
|
+
hidden: hidden$t,
|
|
3105
|
+
run: run$L
|
|
3106
3106
|
};
|
|
3107
|
-
async function run$
|
|
3107
|
+
async function run$L(argv, importMeta, {
|
|
3108
3108
|
parentName
|
|
3109
3109
|
}) {
|
|
3110
3110
|
const config = {
|
|
3111
|
-
commandName: CMD_NAME$
|
|
3112
|
-
description: description$
|
|
3113
|
-
hidden: hidden$
|
|
3111
|
+
commandName: CMD_NAME$u,
|
|
3112
|
+
description: description$B,
|
|
3113
|
+
hidden: hidden$t,
|
|
3114
3114
|
flags: {
|
|
3115
3115
|
...flags.commonFlags,
|
|
3116
3116
|
...flags.outputFlags
|
|
@@ -3172,9 +3172,9 @@ ${utils.getSupportedConfigEntries().map(({
|
|
|
3172
3172
|
});
|
|
3173
3173
|
}
|
|
3174
3174
|
|
|
3175
|
-
const description$
|
|
3175
|
+
const description$A = 'Manage Socket CLI configuration';
|
|
3176
3176
|
const cmdConfig = {
|
|
3177
|
-
description: description$
|
|
3177
|
+
description: description$A,
|
|
3178
3178
|
hidden: false,
|
|
3179
3179
|
async run(argv, importMeta, {
|
|
3180
3180
|
parentName
|
|
@@ -3187,7 +3187,7 @@ const cmdConfig = {
|
|
|
3187
3187
|
unset: cmdConfigUnset
|
|
3188
3188
|
}, {
|
|
3189
3189
|
argv,
|
|
3190
|
-
description: description$
|
|
3190
|
+
description: description$A,
|
|
3191
3191
|
importMeta,
|
|
3192
3192
|
name: `${parentName} config`
|
|
3193
3193
|
});
|
|
@@ -3263,7 +3263,7 @@ async function openSocketFixPr(owner, repo, branch, ghsaIds, options) {
|
|
|
3263
3263
|
}
|
|
3264
3264
|
require$$9.debugFn('error', message);
|
|
3265
3265
|
}
|
|
3266
|
-
return
|
|
3266
|
+
return undefined;
|
|
3267
3267
|
}
|
|
3268
3268
|
async function getSocketFixPrs(owner, repo, options) {
|
|
3269
3269
|
return (await getSocketFixPrsWithContext(owner, repo, options)).map(d => d.match);
|
|
@@ -3388,7 +3388,7 @@ function ciRepoInfo() {
|
|
|
3388
3388
|
const ownerSlashRepo = GITHUB_REPOSITORY;
|
|
3389
3389
|
const slashIndex = ownerSlashRepo.indexOf('/');
|
|
3390
3390
|
if (slashIndex === -1) {
|
|
3391
|
-
return
|
|
3391
|
+
return undefined;
|
|
3392
3392
|
}
|
|
3393
3393
|
return {
|
|
3394
3394
|
owner: ownerSlashRepo.slice(0, slashIndex),
|
|
@@ -3411,7 +3411,7 @@ async function getFixEnv() {
|
|
|
3411
3411
|
const envVars = [...(constants.default.ENV.CI ? [] : ['process.env.CI']), ...(gitEmail ? [] : ['process.env.SOCKET_CLI_GIT_USER_EMAIL']), ...(gitUser ? [] : ['process.env.SOCKET_CLI_GIT_USER_NAME']), ...(githubToken ? [] : ['process.env.GITHUB_TOKEN'])];
|
|
3412
3412
|
require$$9.debugFn('notice', `miss: fixEnv.isCi is false, expected ${arrays.joinAnd(envVars)} to be set`);
|
|
3413
3413
|
}
|
|
3414
|
-
let repoInfo
|
|
3414
|
+
let repoInfo;
|
|
3415
3415
|
if (isCi) {
|
|
3416
3416
|
repoInfo = ciRepoInfo();
|
|
3417
3417
|
}
|
|
@@ -3710,6 +3710,59 @@ async function outputFixResult(result, outputKind) {
|
|
|
3710
3710
|
logger.logger.success('Finished!');
|
|
3711
3711
|
}
|
|
3712
3712
|
|
|
3713
|
+
const GHSA_FORMAT_REGEXP = /^GHSA-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}$/;
|
|
3714
|
+
const CVE_FORMAT_REGEXP = /^CVE-\d{4}-\d{4,}$/;
|
|
3715
|
+
/**
|
|
3716
|
+
* Converts mixed CVE/GHSA/PURL IDs to GHSA IDs only.
|
|
3717
|
+
* Filters out invalid IDs and logs conversion results.
|
|
3718
|
+
*/
|
|
3719
|
+
async function convertIdsToGhsas(ids) {
|
|
3720
|
+
const validGhsas = [];
|
|
3721
|
+
const errors = [];
|
|
3722
|
+
for (const id of ids) {
|
|
3723
|
+
const trimmedId = id.trim();
|
|
3724
|
+
if (trimmedId.startsWith('GHSA-')) {
|
|
3725
|
+
// Already a GHSA ID, validate format
|
|
3726
|
+
if (GHSA_FORMAT_REGEXP.test(trimmedId)) {
|
|
3727
|
+
validGhsas.push(trimmedId);
|
|
3728
|
+
} else {
|
|
3729
|
+
errors.push(`Invalid GHSA format: ${trimmedId}`);
|
|
3730
|
+
}
|
|
3731
|
+
} else if (trimmedId.startsWith('CVE-')) {
|
|
3732
|
+
// Convert CVE to GHSA
|
|
3733
|
+
if (!CVE_FORMAT_REGEXP.test(trimmedId)) {
|
|
3734
|
+
errors.push(`Invalid CVE format: ${trimmedId}`);
|
|
3735
|
+
continue;
|
|
3736
|
+
}
|
|
3737
|
+
|
|
3738
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3739
|
+
const conversionResult = await utils.convertCveToGhsa(trimmedId);
|
|
3740
|
+
if (conversionResult.ok) {
|
|
3741
|
+
validGhsas.push(conversionResult.data);
|
|
3742
|
+
logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data}`);
|
|
3743
|
+
} else {
|
|
3744
|
+
errors.push(`${trimmedId}: ${conversionResult.message}`);
|
|
3745
|
+
}
|
|
3746
|
+
} else if (trimmedId.startsWith('pkg:')) {
|
|
3747
|
+
// Convert PURL to GHSAs
|
|
3748
|
+
// eslint-disable-next-line no-await-in-loop
|
|
3749
|
+
const conversionResult = await utils.convertPurlToGhsas(trimmedId);
|
|
3750
|
+
if (conversionResult.ok && conversionResult.data.length) {
|
|
3751
|
+
validGhsas.push(...conversionResult.data);
|
|
3752
|
+
logger.logger.info(`Converted ${trimmedId} to ${conversionResult.data.length} GHSA(s): ${conversionResult.data.join(', ')}`);
|
|
3753
|
+
} else {
|
|
3754
|
+
errors.push(`${trimmedId}: ${conversionResult.message || 'No GHSAs found'}`);
|
|
3755
|
+
}
|
|
3756
|
+
} else {
|
|
3757
|
+
// Neither CVE, GHSA, nor PURL, skip
|
|
3758
|
+
errors.push(`Unsupported ID format (expected CVE, GHSA, or PURL): ${trimmedId}`);
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
if (errors.length) {
|
|
3762
|
+
logger.logger.warn(`Skipped ${errors.length} invalid IDs:\n${errors.map(e => ` - ${e}`).join('\n')}`);
|
|
3763
|
+
}
|
|
3764
|
+
return validGhsas;
|
|
3765
|
+
}
|
|
3713
3766
|
async function handleFix({
|
|
3714
3767
|
autopilot,
|
|
3715
3768
|
cwd,
|
|
@@ -3726,7 +3779,8 @@ async function handleFix({
|
|
|
3726
3779
|
await outputFixResult(await coanaFix({
|
|
3727
3780
|
autopilot,
|
|
3728
3781
|
cwd,
|
|
3729
|
-
|
|
3782
|
+
// Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only
|
|
3783
|
+
ghsas: await convertIdsToGhsas(ghsas),
|
|
3730
3784
|
limit,
|
|
3731
3785
|
orgSlug,
|
|
3732
3786
|
rangeStyle,
|
|
@@ -3735,14 +3789,14 @@ async function handleFix({
|
|
|
3735
3789
|
}), outputKind);
|
|
3736
3790
|
}
|
|
3737
3791
|
|
|
3738
|
-
const CMD_NAME$
|
|
3792
|
+
const CMD_NAME$t = 'fix';
|
|
3739
3793
|
const DEFAULT_LIMIT = 10;
|
|
3740
|
-
const description$
|
|
3741
|
-
const hidden$
|
|
3794
|
+
const description$z = 'Update dependencies with "fixable" Socket alerts';
|
|
3795
|
+
const hidden$s = false;
|
|
3742
3796
|
const cmdFix = {
|
|
3743
|
-
description: description$
|
|
3744
|
-
hidden: hidden$
|
|
3745
|
-
run: run$
|
|
3797
|
+
description: description$z,
|
|
3798
|
+
hidden: hidden$s,
|
|
3799
|
+
run: run$K
|
|
3746
3800
|
};
|
|
3747
3801
|
const generalFlags$2 = {
|
|
3748
3802
|
autopilot: {
|
|
@@ -3753,7 +3807,11 @@ const generalFlags$2 = {
|
|
|
3753
3807
|
id: {
|
|
3754
3808
|
type: 'string',
|
|
3755
3809
|
default: [],
|
|
3756
|
-
description: `Provide a list of
|
|
3810
|
+
description: `Provide a list of vulnerability identifiers to compute fixes for:
|
|
3811
|
+
- ${vendor.terminalLinkExports('GHSA IDs', 'https://docs.github.com/en/code-security/security-advisories/working-with-global-security-advisories-from-the-github-advisory-database/about-the-github-advisory-database#about-ghsa-ids')} (e.g., GHSA-xxxx-xxxx-xxxx)
|
|
3812
|
+
- ${vendor.terminalLinkExports('CVE IDs', 'https://cve.mitre.org/cve/identifiers/')} (e.g., CVE-${new Date().getFullYear()}-1234) - automatically converted to GHSA
|
|
3813
|
+
- ${vendor.terminalLinkExports('PURLs', 'https://github.com/package-url/purl-spec')} (e.g., pkg:npm/package@1.0.0) - automatically converted to GHSA
|
|
3814
|
+
Can be provided as comma separated values or as multiple flags`,
|
|
3757
3815
|
isMultiple: true
|
|
3758
3816
|
},
|
|
3759
3817
|
limit: {
|
|
@@ -3767,14 +3825,8 @@ const generalFlags$2 = {
|
|
|
3767
3825
|
description: `
|
|
3768
3826
|
Define how dependency version ranges are updated in package.json (default 'preserve').
|
|
3769
3827
|
Available styles:
|
|
3770
|
-
* caret - Use ^ range for compatible updates (e.g. ^1.2.3)
|
|
3771
|
-
* gt - Use > to allow any newer version (e.g. >1.2.3)
|
|
3772
|
-
* gte - Use >= to allow any newer version (e.g. >=1.2.3)
|
|
3773
|
-
* lt - Use < to allow only lower versions (e.g. <1.2.3)
|
|
3774
|
-
* lte - Use <= to allow only lower versions (e.g. <=1.2.3)
|
|
3775
3828
|
* pin - Use the exact version (e.g. 1.2.3)
|
|
3776
3829
|
* preserve - Retain the existing version range style as-is
|
|
3777
|
-
* tilde - Use ~ range for patch/minor updates (e.g. ~1.2.3)
|
|
3778
3830
|
`.trim()
|
|
3779
3831
|
}
|
|
3780
3832
|
};
|
|
@@ -3826,13 +3878,13 @@ const hiddenFlags = {
|
|
|
3826
3878
|
hidden: true
|
|
3827
3879
|
}
|
|
3828
3880
|
};
|
|
3829
|
-
async function run$
|
|
3881
|
+
async function run$K(argv, importMeta, {
|
|
3830
3882
|
parentName
|
|
3831
3883
|
}) {
|
|
3832
3884
|
const config = {
|
|
3833
|
-
commandName: CMD_NAME$
|
|
3834
|
-
description: description$
|
|
3835
|
-
hidden: hidden$
|
|
3885
|
+
commandName: CMD_NAME$t,
|
|
3886
|
+
description: description$z,
|
|
3887
|
+
hidden: hidden$s,
|
|
3836
3888
|
flags: {
|
|
3837
3889
|
...flags.commonFlags,
|
|
3838
3890
|
...flags.outputFlags,
|
|
@@ -3844,7 +3896,7 @@ async function run$I(argv, importMeta, {
|
|
|
3844
3896
|
$ ${command} [options] [CWD=.]
|
|
3845
3897
|
|
|
3846
3898
|
API Token Requirements
|
|
3847
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
3899
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$t}`)}
|
|
3848
3900
|
|
|
3849
3901
|
Options
|
|
3850
3902
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -3875,23 +3927,6 @@ async function run$I(argv, importMeta, {
|
|
|
3875
3927
|
} = cli.flags;
|
|
3876
3928
|
const dryRun = !!cli.flags['dryRun'];
|
|
3877
3929
|
const minSatisfying = cli.flags['minSatisfying'] || !maxSatisfying;
|
|
3878
|
-
const rawPurls = utils.cmdFlagValueToArray(cli.flags['purl']);
|
|
3879
|
-
const purls = [];
|
|
3880
|
-
for (const purl of rawPurls) {
|
|
3881
|
-
const version = utils.getPurlObject(purl, {
|
|
3882
|
-
throws: false
|
|
3883
|
-
})?.version;
|
|
3884
|
-
if (version) {
|
|
3885
|
-
purls.push(purl);
|
|
3886
|
-
} else {
|
|
3887
|
-
logger.logger.warn(`--purl ${purl} is missing a version and will be ignored.`);
|
|
3888
|
-
}
|
|
3889
|
-
}
|
|
3890
|
-
if (rawPurls.length !== purls.length && !purls.length) {
|
|
3891
|
-
process.exitCode = 1;
|
|
3892
|
-
logger.logger.fail('No valid --purl values provided.');
|
|
3893
|
-
return;
|
|
3894
|
-
}
|
|
3895
3930
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
3896
3931
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
3897
3932
|
test: utils.RangeStyles.includes(rangeStyle),
|
|
@@ -3924,7 +3959,7 @@ async function run$I(argv, importMeta, {
|
|
|
3924
3959
|
const {
|
|
3925
3960
|
spinner
|
|
3926
3961
|
} = constants.default;
|
|
3927
|
-
const ghsas = arrays.arrayUnique([...utils.cmdFlagValueToArray(cli.flags['id']), ...utils.cmdFlagValueToArray(cli.flags['ghsa'])]);
|
|
3962
|
+
const ghsas = arrays.arrayUnique([...utils.cmdFlagValueToArray(cli.flags['id']), ...utils.cmdFlagValueToArray(cli.flags['ghsa']), ...utils.cmdFlagValueToArray(cli.flags['purl'])]);
|
|
3928
3963
|
await handleFix({
|
|
3929
3964
|
autopilot,
|
|
3930
3965
|
cwd,
|
|
@@ -4020,7 +4055,7 @@ async function setupTabCompletion(targetName) {
|
|
|
4020
4055
|
};
|
|
4021
4056
|
}
|
|
4022
4057
|
function getTabCompletionScriptRaw() {
|
|
4023
|
-
const sourceDir = path.dirname(require$$0.fileURLToPath(
|
|
4058
|
+
const sourceDir = path.dirname(require$$0.fileURLToPath((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href))));
|
|
4024
4059
|
const sourcePath = path.join(sourceDir, 'socket-completion.bash');
|
|
4025
4060
|
if (!fs$1.existsSync(sourcePath)) {
|
|
4026
4061
|
return {
|
|
@@ -4093,9 +4128,9 @@ const config$h = {
|
|
|
4093
4128
|
const cmdInstallCompletion = {
|
|
4094
4129
|
description: config$h.description,
|
|
4095
4130
|
hidden: config$h.hidden,
|
|
4096
|
-
run: run$
|
|
4131
|
+
run: run$J
|
|
4097
4132
|
};
|
|
4098
|
-
async function run$
|
|
4133
|
+
async function run$J(argv, importMeta, {
|
|
4099
4134
|
parentName
|
|
4100
4135
|
}) {
|
|
4101
4136
|
const cli = utils.meowOrExit({
|
|
@@ -4113,9 +4148,9 @@ async function run$H(argv, importMeta, {
|
|
|
4113
4148
|
await handleInstallCompletion(String(targetName));
|
|
4114
4149
|
}
|
|
4115
4150
|
|
|
4116
|
-
const description$
|
|
4151
|
+
const description$y = 'Install Socket CLI tab completion';
|
|
4117
4152
|
const cmdInstall = {
|
|
4118
|
-
description: description$
|
|
4153
|
+
description: description$y,
|
|
4119
4154
|
hidden: false,
|
|
4120
4155
|
async run(argv, importMeta, {
|
|
4121
4156
|
parentName
|
|
@@ -4124,7 +4159,7 @@ const cmdInstall = {
|
|
|
4124
4159
|
completion: cmdInstallCompletion
|
|
4125
4160
|
}, {
|
|
4126
4161
|
argv,
|
|
4127
|
-
description: description$
|
|
4162
|
+
description: description$y,
|
|
4128
4163
|
importMeta,
|
|
4129
4164
|
name: `${parentName} install`
|
|
4130
4165
|
});
|
|
@@ -4133,7 +4168,7 @@ const cmdInstall = {
|
|
|
4133
4168
|
|
|
4134
4169
|
async function outputCmdJson(cwd) {
|
|
4135
4170
|
logger.logger.info('Target cwd:', constants.default.ENV.VITEST ? '<redacted>' : utils.tildify(cwd));
|
|
4136
|
-
const sockJsonPath = path.join(cwd,
|
|
4171
|
+
const sockJsonPath = path.join(cwd, constants.SOCKET_JSON);
|
|
4137
4172
|
const tildeSockJsonPath = constants.default.ENV.VITEST ? '<redacted>' : utils.tildify(sockJsonPath);
|
|
4138
4173
|
if (!fs$1.existsSync(sockJsonPath)) {
|
|
4139
4174
|
logger.logger.fail(`Not found: ${tildeSockJsonPath}`);
|
|
@@ -4157,7 +4192,7 @@ async function handleCmdJson(cwd) {
|
|
|
4157
4192
|
|
|
4158
4193
|
const config$g = {
|
|
4159
4194
|
commandName: 'json',
|
|
4160
|
-
description:
|
|
4195
|
+
description: `Display the \`${constants.SOCKET_JSON}\` that would be applied for target folder`,
|
|
4161
4196
|
hidden: true,
|
|
4162
4197
|
flags: {
|
|
4163
4198
|
...flags.commonFlags
|
|
@@ -4166,7 +4201,7 @@ const config$g = {
|
|
|
4166
4201
|
Usage
|
|
4167
4202
|
$ ${command} [options] [CWD=.]
|
|
4168
4203
|
|
|
4169
|
-
Display the
|
|
4204
|
+
Display the \`${constants.SOCKET_JSON}\` file that would apply when running relevant commands
|
|
4170
4205
|
in the target directory.
|
|
4171
4206
|
|
|
4172
4207
|
Examples
|
|
@@ -4176,9 +4211,9 @@ const config$g = {
|
|
|
4176
4211
|
const cmdJson = {
|
|
4177
4212
|
description: config$g.description,
|
|
4178
4213
|
hidden: config$g.hidden,
|
|
4179
|
-
run: run$
|
|
4214
|
+
run: run$I
|
|
4180
4215
|
};
|
|
4181
|
-
async function run$
|
|
4216
|
+
async function run$I(argv, importMeta, {
|
|
4182
4217
|
parentName
|
|
4183
4218
|
}) {
|
|
4184
4219
|
const cli = utils.meowOrExit({
|
|
@@ -4332,21 +4367,21 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
|
|
|
4332
4367
|
}
|
|
4333
4368
|
}
|
|
4334
4369
|
|
|
4335
|
-
const CMD_NAME$
|
|
4336
|
-
const description$
|
|
4337
|
-
const hidden$
|
|
4370
|
+
const CMD_NAME$s = 'login';
|
|
4371
|
+
const description$x = 'Setup Socket CLI with an API token and defaults';
|
|
4372
|
+
const hidden$r = false;
|
|
4338
4373
|
const cmdLogin = {
|
|
4339
|
-
description: description$
|
|
4340
|
-
hidden: hidden$
|
|
4341
|
-
run: run$
|
|
4374
|
+
description: description$x,
|
|
4375
|
+
hidden: hidden$r,
|
|
4376
|
+
run: run$H
|
|
4342
4377
|
};
|
|
4343
|
-
async function run$
|
|
4378
|
+
async function run$H(argv, importMeta, {
|
|
4344
4379
|
parentName
|
|
4345
4380
|
}) {
|
|
4346
4381
|
const config = {
|
|
4347
|
-
commandName: CMD_NAME$
|
|
4348
|
-
description: description$
|
|
4349
|
-
hidden: hidden$
|
|
4382
|
+
commandName: CMD_NAME$s,
|
|
4383
|
+
description: description$x,
|
|
4384
|
+
hidden: hidden$r,
|
|
4350
4385
|
flags: {
|
|
4351
4386
|
...flags.commonFlags,
|
|
4352
4387
|
apiBaseUrl: {
|
|
@@ -4365,7 +4400,7 @@ async function run$F(argv, importMeta, {
|
|
|
4365
4400
|
$ ${command} [options]
|
|
4366
4401
|
|
|
4367
4402
|
API Token Requirements
|
|
4368
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
4403
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$s}`)}
|
|
4369
4404
|
|
|
4370
4405
|
Logs into the Socket API by prompting for an API token
|
|
4371
4406
|
|
|
@@ -4438,9 +4473,9 @@ const config$f = {
|
|
|
4438
4473
|
const cmdLogout = {
|
|
4439
4474
|
description: config$f.description,
|
|
4440
4475
|
hidden: config$f.hidden,
|
|
4441
|
-
run: run$
|
|
4476
|
+
run: run$G
|
|
4442
4477
|
};
|
|
4443
|
-
async function run$
|
|
4478
|
+
async function run$G(argv, importMeta, {
|
|
4444
4479
|
parentName
|
|
4445
4480
|
}) {
|
|
4446
4481
|
const cli = utils.meowOrExit({
|
|
@@ -4457,8 +4492,10 @@ async function run$E(argv, importMeta, {
|
|
|
4457
4492
|
attemptLogout();
|
|
4458
4493
|
}
|
|
4459
4494
|
|
|
4495
|
+
const require$6 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
4460
4496
|
const {
|
|
4461
4497
|
PACKAGE_LOCK_JSON,
|
|
4498
|
+
PNPM_LOCK_YAML,
|
|
4462
4499
|
YARN,
|
|
4463
4500
|
YARN_LOCK
|
|
4464
4501
|
} = constants.default;
|
|
@@ -4498,7 +4535,6 @@ function argvToArray(argvObj) {
|
|
|
4498
4535
|
return result;
|
|
4499
4536
|
}
|
|
4500
4537
|
async function runCdxgen(argvObj) {
|
|
4501
|
-
let cleanupPackageLock = false;
|
|
4502
4538
|
const argvMutable = {
|
|
4503
4539
|
__proto__: null,
|
|
4504
4540
|
...argvObj
|
|
@@ -4511,23 +4547,58 @@ async function runCdxgen(argvObj) {
|
|
|
4511
4547
|
},
|
|
4512
4548
|
stdio: 'inherit'
|
|
4513
4549
|
};
|
|
4514
|
-
|
|
4515
|
-
|
|
4550
|
+
|
|
4551
|
+
// Detect package manager based on lockfiles
|
|
4552
|
+
const pnpmLockPath = await utils.findUp(PNPM_LOCK_YAML, {
|
|
4553
|
+
onlyFiles: true
|
|
4554
|
+
});
|
|
4555
|
+
const npmLockPath = pnpmLockPath ? undefined : await utils.findUp(PACKAGE_LOCK_JSON, {
|
|
4556
|
+
onlyFiles: true
|
|
4557
|
+
});
|
|
4558
|
+
const yarnLockPath = pnpmLockPath || npmLockPath ? undefined : await utils.findUp(YARN_LOCK, {
|
|
4559
|
+
onlyFiles: true
|
|
4560
|
+
});
|
|
4561
|
+
let cleanupPackageLock = false;
|
|
4562
|
+
if (argvMutable['type'] !== YARN && nodejsPlatformTypes.has(argvMutable['type']) && yarnLockPath) {
|
|
4563
|
+
if (npmLockPath) {
|
|
4516
4564
|
argvMutable['type'] = constants.NPM;
|
|
4517
4565
|
} else {
|
|
4518
4566
|
// Use synp to create a package-lock.json from the yarn.lock,
|
|
4519
4567
|
// based on the node_modules folder, for a more accurate SBOM.
|
|
4520
4568
|
try {
|
|
4521
|
-
const
|
|
4522
|
-
|
|
4523
|
-
|
|
4569
|
+
const useYarnBerry = utils.isYarnBerry();
|
|
4570
|
+
let args;
|
|
4571
|
+
let synpPromise;
|
|
4572
|
+
if (pnpmLockPath) {
|
|
4573
|
+
args = ['dlx', `synp@${constants.default.ENV.INLINED_SOCKET_CLI_SYNP_VERSION}`, '--source-file', `./${YARN_LOCK}`];
|
|
4574
|
+
const shadowPnpmBin = /*@__PURE__*/require$6(constants.default.shadowPnpmBinPath);
|
|
4575
|
+
synpPromise = (await shadowPnpmBin(args, shadowOpts)).spawnPromise;
|
|
4576
|
+
} else if (useYarnBerry) {
|
|
4577
|
+
args = ['dlx', `synp@${constants.default.ENV.INLINED_SOCKET_CLI_SYNP_VERSION}`, '--source-file', `./${YARN_LOCK}`];
|
|
4578
|
+
const shadowYarnBin = /*@__PURE__*/require$6(constants.default.shadowYarnBinPath);
|
|
4579
|
+
synpPromise = (await shadowYarnBin(args, shadowOpts)).spawnPromise;
|
|
4580
|
+
} else {
|
|
4581
|
+
args = ['exec', '--yes', `synp@${constants.default.ENV.INLINED_SOCKET_CLI_SYNP_VERSION}`, '--source-file', `./${YARN_LOCK}`];
|
|
4582
|
+
synpPromise = (await shadowNpmBin('npm', args, shadowOpts)).spawnPromise;
|
|
4583
|
+
}
|
|
4524
4584
|
await synpPromise;
|
|
4525
4585
|
argvMutable['type'] = constants.NPM;
|
|
4526
4586
|
cleanupPackageLock = true;
|
|
4527
4587
|
} catch {}
|
|
4528
4588
|
}
|
|
4529
4589
|
}
|
|
4530
|
-
|
|
4590
|
+
|
|
4591
|
+
// Use appropriate package manager for cdxgen
|
|
4592
|
+
let shadowResult;
|
|
4593
|
+
if (pnpmLockPath) {
|
|
4594
|
+
const shadowPnpmBin = /*@__PURE__*/require$6(constants.default.shadowPnpmBinPath);
|
|
4595
|
+
shadowResult = await shadowPnpmBin(['dlx', '--silent', `@cyclonedx/cdxgen@${constants.default.ENV.INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION}`, ...argvToArray(argvMutable)], shadowOpts);
|
|
4596
|
+
} else if (yarnLockPath && utils.isYarnBerry()) {
|
|
4597
|
+
const shadowYarnBin = /*@__PURE__*/require$6(constants.default.shadowYarnBinPath);
|
|
4598
|
+
shadowResult = await shadowYarnBin(['dlx', '--quiet', `@cyclonedx/cdxgen@${constants.default.ENV.INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION}`, ...argvToArray(argvMutable)], shadowOpts);
|
|
4599
|
+
} else {
|
|
4600
|
+
shadowResult = await shadowNpmBin('npm', ['exec', '--silent', '--yes', `@cyclonedx/cdxgen@${constants.default.ENV.INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION}`, '--', ...argvToArray(argvMutable)], shadowOpts);
|
|
4601
|
+
}
|
|
4531
4602
|
shadowResult.spawnPromise.process.on('exit', () => {
|
|
4532
4603
|
if (cleanupPackageLock) {
|
|
4533
4604
|
try {
|
|
@@ -4750,11 +4821,15 @@ const config$e = {
|
|
|
4750
4821
|
const cmdManifestCdxgen = {
|
|
4751
4822
|
description: config$e.description,
|
|
4752
4823
|
hidden: config$e.hidden,
|
|
4753
|
-
run: run$
|
|
4824
|
+
run: run$F
|
|
4754
4825
|
};
|
|
4755
|
-
async function run$
|
|
4756
|
-
|
|
4757
|
-
|
|
4826
|
+
async function run$F(argv, importMeta, context) {
|
|
4827
|
+
const {
|
|
4828
|
+
parentName
|
|
4829
|
+
} = {
|
|
4830
|
+
__proto__: null,
|
|
4831
|
+
...context
|
|
4832
|
+
};
|
|
4758
4833
|
const cli = utils.meowOrExit({
|
|
4759
4834
|
// Don't let meow take over --help.
|
|
4760
4835
|
argv: argv.filter(a => !utils.isHelpFlag(a)),
|
|
@@ -4762,11 +4837,17 @@ async function run$D(argv, importMeta, {
|
|
|
4762
4837
|
importMeta,
|
|
4763
4838
|
parentName
|
|
4764
4839
|
});
|
|
4765
|
-
const
|
|
4840
|
+
const {
|
|
4841
|
+
dryRun
|
|
4842
|
+
} = cli.flags;
|
|
4766
4843
|
|
|
4767
|
-
//
|
|
4844
|
+
// Filter Socket flags from argv but keep --no-banner and --help for cdxgen.
|
|
4845
|
+
const argsToProcess = utils.filterFlags(argv, {
|
|
4846
|
+
...flags.commonFlags,
|
|
4847
|
+
...flags.outputFlags
|
|
4848
|
+
}, ['--no-banner', '--help', '-h']);
|
|
4768
4849
|
const yargv = {
|
|
4769
|
-
...vendor.yargsParser(
|
|
4850
|
+
...vendor.yargsParser(argsToProcess, yargsConfig)
|
|
4770
4851
|
};
|
|
4771
4852
|
const pathArgs = [];
|
|
4772
4853
|
const unknowns = [];
|
|
@@ -4860,9 +4941,9 @@ const config$d = {
|
|
|
4860
4941
|
const cmdManifestAuto = {
|
|
4861
4942
|
description: config$d.description,
|
|
4862
4943
|
hidden: config$d.hidden,
|
|
4863
|
-
run: run$
|
|
4944
|
+
run: run$E
|
|
4864
4945
|
};
|
|
4865
|
-
async function run$
|
|
4946
|
+
async function run$E(argv, importMeta, {
|
|
4866
4947
|
parentName
|
|
4867
4948
|
}) {
|
|
4868
4949
|
const cli = utils.meowOrExit({
|
|
@@ -4921,14 +5002,15 @@ async function run$C(argv, importMeta, {
|
|
|
4921
5002
|
|
|
4922
5003
|
const config$c = {
|
|
4923
5004
|
commandName: 'conda',
|
|
4924
|
-
description:
|
|
5005
|
+
description: `[beta] Convert a Conda ${constants.ENVIRONMENT_YML} file to a python ${constants.REQUIREMENTS_TXT}`,
|
|
4925
5006
|
hidden: false,
|
|
4926
5007
|
flags: {
|
|
4927
5008
|
...flags.commonFlags,
|
|
4928
5009
|
...flags.outputFlags,
|
|
4929
5010
|
file: {
|
|
4930
5011
|
type: 'string',
|
|
4931
|
-
|
|
5012
|
+
default: '',
|
|
5013
|
+
description: `Input file name (by default for Conda this is "${constants.ENVIRONMENT_YML}"), relative to cwd`
|
|
4932
5014
|
},
|
|
4933
5015
|
stdin: {
|
|
4934
5016
|
type: 'boolean',
|
|
@@ -4936,11 +5018,12 @@ const config$c = {
|
|
|
4936
5018
|
},
|
|
4937
5019
|
out: {
|
|
4938
5020
|
type: 'string',
|
|
5021
|
+
default: '',
|
|
4939
5022
|
description: 'Output path (relative to cwd)'
|
|
4940
5023
|
},
|
|
4941
5024
|
stdout: {
|
|
4942
5025
|
type: 'boolean',
|
|
4943
|
-
description:
|
|
5026
|
+
description: `Print resulting ${constants.REQUIREMENTS_TXT} to stdout (supersedes --out)`
|
|
4944
5027
|
},
|
|
4945
5028
|
verbose: {
|
|
4946
5029
|
type: 'boolean',
|
|
@@ -4952,8 +5035,8 @@ const config$c = {
|
|
|
4952
5035
|
$ ${command} [options] [CWD=.]
|
|
4953
5036
|
|
|
4954
5037
|
Warning: While we don't support Conda necessarily, this tool extracts the pip
|
|
4955
|
-
block from an
|
|
4956
|
-
which you can scan as if it were a
|
|
5038
|
+
block from an ${constants.ENVIRONMENT_YML} and outputs it as a ${constants.REQUIREMENTS_TXT}
|
|
5039
|
+
which you can scan as if it were a PyPI package.
|
|
4957
5040
|
|
|
4958
5041
|
USE AT YOUR OWN RISK
|
|
4959
5042
|
|
|
@@ -4966,15 +5049,15 @@ const config$c = {
|
|
|
4966
5049
|
Examples
|
|
4967
5050
|
|
|
4968
5051
|
$ ${command}
|
|
4969
|
-
$ ${command} ./project/foo --file
|
|
5052
|
+
$ ${command} ./project/foo --file ${constants.ENVIRONMENT_YAML}
|
|
4970
5053
|
`
|
|
4971
5054
|
};
|
|
4972
5055
|
const cmdManifestConda = {
|
|
4973
5056
|
description: config$c.description,
|
|
4974
5057
|
hidden: config$c.hidden,
|
|
4975
|
-
run: run$
|
|
5058
|
+
run: run$D
|
|
4976
5059
|
};
|
|
4977
|
-
async function run$
|
|
5060
|
+
async function run$D(argv, importMeta, {
|
|
4978
5061
|
parentName
|
|
4979
5062
|
}) {
|
|
4980
5063
|
const cli = utils.meowOrExit({
|
|
@@ -4984,10 +5067,10 @@ async function run$B(argv, importMeta, {
|
|
|
4984
5067
|
parentName
|
|
4985
5068
|
});
|
|
4986
5069
|
const {
|
|
4987
|
-
|
|
4988
|
-
|
|
5070
|
+
dryRun,
|
|
5071
|
+
json,
|
|
5072
|
+
markdown
|
|
4989
5073
|
} = cli.flags;
|
|
4990
|
-
const dryRun = !!cli.flags['dryRun'];
|
|
4991
5074
|
let [cwd = '.'] = cli.input;
|
|
4992
5075
|
// Note: path.resolve vs .join:
|
|
4993
5076
|
// If given path is absolute then cwd should not affect it.
|
|
@@ -5004,35 +5087,35 @@ async function run$B(argv, importMeta, {
|
|
|
5004
5087
|
// Set defaults for any flag/arg that is not given. Check socket.json first.
|
|
5005
5088
|
if (stdin === undefined && sockJson.defaults?.manifest?.conda?.stdin !== undefined) {
|
|
5006
5089
|
stdin = sockJson.defaults?.manifest?.conda?.stdin;
|
|
5007
|
-
logger.logger.info(
|
|
5090
|
+
logger.logger.info(`Using default --stdin from ${constants.SOCKET_JSON}:`, stdin);
|
|
5008
5091
|
}
|
|
5009
5092
|
if (stdin) {
|
|
5010
5093
|
filename = '-';
|
|
5011
5094
|
} else if (!filename) {
|
|
5012
5095
|
if (sockJson.defaults?.manifest?.conda?.infile) {
|
|
5013
5096
|
filename = sockJson.defaults?.manifest?.conda?.infile;
|
|
5014
|
-
logger.logger.info(
|
|
5097
|
+
logger.logger.info(`Using default --file from ${constants.SOCKET_JSON}:`, filename);
|
|
5015
5098
|
} else {
|
|
5016
|
-
filename =
|
|
5099
|
+
filename = constants.ENVIRONMENT_YML;
|
|
5017
5100
|
}
|
|
5018
5101
|
}
|
|
5019
5102
|
if (stdout === undefined && sockJson.defaults?.manifest?.conda?.stdout !== undefined) {
|
|
5020
5103
|
stdout = sockJson.defaults?.manifest?.conda?.stdout;
|
|
5021
|
-
logger.logger.info(
|
|
5104
|
+
logger.logger.info(`Using default --stdout from ${constants.SOCKET_JSON}:`, stdout);
|
|
5022
5105
|
}
|
|
5023
5106
|
if (stdout) {
|
|
5024
5107
|
out = '-';
|
|
5025
5108
|
} else if (!out) {
|
|
5026
5109
|
if (sockJson.defaults?.manifest?.conda?.outfile) {
|
|
5027
5110
|
out = sockJson.defaults?.manifest?.conda?.outfile;
|
|
5028
|
-
logger.logger.info(
|
|
5111
|
+
logger.logger.info(`Using default --out from ${constants.SOCKET_JSON}:`, out);
|
|
5029
5112
|
} else {
|
|
5030
|
-
out =
|
|
5113
|
+
out = constants.REQUIREMENTS_TXT;
|
|
5031
5114
|
}
|
|
5032
5115
|
}
|
|
5033
5116
|
if (verbose === undefined && sockJson.defaults?.manifest?.conda?.verbose !== undefined) {
|
|
5034
5117
|
verbose = sockJson.defaults?.manifest?.conda?.verbose;
|
|
5035
|
-
logger.logger.info(
|
|
5118
|
+
logger.logger.info(`Using default --verbose from ${constants.SOCKET_JSON}:`, verbose);
|
|
5036
5119
|
} else if (verbose === undefined) {
|
|
5037
5120
|
verbose = false;
|
|
5038
5121
|
}
|
|
@@ -5066,10 +5149,10 @@ async function run$B(argv, importMeta, {
|
|
|
5066
5149
|
}
|
|
5067
5150
|
await handleManifestConda({
|
|
5068
5151
|
cwd,
|
|
5069
|
-
filename
|
|
5070
|
-
out
|
|
5152
|
+
filename,
|
|
5153
|
+
out,
|
|
5071
5154
|
outputKind,
|
|
5072
|
-
verbose
|
|
5155
|
+
verbose
|
|
5073
5156
|
});
|
|
5074
5157
|
}
|
|
5075
5158
|
|
|
@@ -5104,7 +5187,7 @@ const config$b = {
|
|
|
5104
5187
|
global \`gradle\` binary but that may not work (hard to predict).
|
|
5105
5188
|
|
|
5106
5189
|
The \`pom.xml\` is a manifest file similar to \`package.json\` for npm or
|
|
5107
|
-
or
|
|
5190
|
+
or ${constants.REQUIREMENTS_TXT} for PyPi), but specifically for Maven, which is Java's
|
|
5108
5191
|
dependency repository. Languages like Kotlin and Scala piggy back on it too.
|
|
5109
5192
|
|
|
5110
5193
|
There are some caveats with the gradle to \`pom.xml\` conversion:
|
|
@@ -5128,9 +5211,9 @@ const config$b = {
|
|
|
5128
5211
|
const cmdManifestGradle = {
|
|
5129
5212
|
description: config$b.description,
|
|
5130
5213
|
hidden: config$b.hidden,
|
|
5131
|
-
run: run$
|
|
5214
|
+
run: run$C
|
|
5132
5215
|
};
|
|
5133
|
-
async function run$
|
|
5216
|
+
async function run$C(argv, importMeta, {
|
|
5134
5217
|
parentName
|
|
5135
5218
|
}) {
|
|
5136
5219
|
const cli = utils.meowOrExit({
|
|
@@ -5152,7 +5235,7 @@ async function run$A(argv, importMeta, {
|
|
|
5152
5235
|
// If given path is absolute then cwd should not affect it.
|
|
5153
5236
|
cwd = path.resolve(process.cwd(), cwd);
|
|
5154
5237
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
5155
|
-
require$$9.debugFn('inspect',
|
|
5238
|
+
require$$9.debugFn('inspect', `override: ${constants.SOCKET_JSON} gradle`, sockJson?.defaults?.manifest?.gradle);
|
|
5156
5239
|
let {
|
|
5157
5240
|
bin,
|
|
5158
5241
|
gradleOpts,
|
|
@@ -5163,7 +5246,7 @@ async function run$A(argv, importMeta, {
|
|
|
5163
5246
|
if (!bin) {
|
|
5164
5247
|
if (sockJson.defaults?.manifest?.gradle?.bin) {
|
|
5165
5248
|
bin = sockJson.defaults?.manifest?.gradle?.bin;
|
|
5166
|
-
logger.logger.info(
|
|
5249
|
+
logger.logger.info(`Using default --bin from ${constants.SOCKET_JSON}:`, bin);
|
|
5167
5250
|
} else {
|
|
5168
5251
|
bin = path.join(cwd, 'gradlew');
|
|
5169
5252
|
}
|
|
@@ -5171,7 +5254,7 @@ async function run$A(argv, importMeta, {
|
|
|
5171
5254
|
if (!gradleOpts) {
|
|
5172
5255
|
if (sockJson.defaults?.manifest?.gradle?.gradleOpts) {
|
|
5173
5256
|
gradleOpts = sockJson.defaults?.manifest?.gradle?.gradleOpts;
|
|
5174
|
-
logger.logger.info(
|
|
5257
|
+
logger.logger.info(`Using default --gradle-opts from ${constants.SOCKET_JSON}:`, gradleOpts);
|
|
5175
5258
|
} else {
|
|
5176
5259
|
gradleOpts = '';
|
|
5177
5260
|
}
|
|
@@ -5179,7 +5262,7 @@ async function run$A(argv, importMeta, {
|
|
|
5179
5262
|
if (verbose === undefined) {
|
|
5180
5263
|
if (sockJson.defaults?.manifest?.gradle?.verbose !== undefined) {
|
|
5181
5264
|
verbose = sockJson.defaults?.manifest?.gradle?.verbose;
|
|
5182
|
-
logger.logger.info(
|
|
5265
|
+
logger.logger.info(`Using default --verbose from ${constants.SOCKET_JSON}:`, verbose);
|
|
5183
5266
|
} else {
|
|
5184
5267
|
verbose = false;
|
|
5185
5268
|
}
|
|
@@ -5259,7 +5342,7 @@ const config$a = {
|
|
|
5259
5342
|
global \`gradle\` binary but that may not work (hard to predict).
|
|
5260
5343
|
|
|
5261
5344
|
The \`pom.xml\` is a manifest file similar to \`package.json\` for npm or
|
|
5262
|
-
or
|
|
5345
|
+
or ${constants.REQUIREMENTS_TXT} for PyPi), but specifically for Maven, which is Java's
|
|
5263
5346
|
dependency repository. Languages like Kotlin and Scala piggy back on it too.
|
|
5264
5347
|
|
|
5265
5348
|
There are some caveats with the gradle to \`pom.xml\` conversion:
|
|
@@ -5283,9 +5366,9 @@ const config$a = {
|
|
|
5283
5366
|
const cmdManifestKotlin = {
|
|
5284
5367
|
description: config$a.description,
|
|
5285
5368
|
hidden: config$a.hidden,
|
|
5286
|
-
run: run$
|
|
5369
|
+
run: run$B
|
|
5287
5370
|
};
|
|
5288
|
-
async function run$
|
|
5371
|
+
async function run$B(argv, importMeta, {
|
|
5289
5372
|
parentName
|
|
5290
5373
|
}) {
|
|
5291
5374
|
const cli = utils.meowOrExit({
|
|
@@ -5307,7 +5390,7 @@ async function run$z(argv, importMeta, {
|
|
|
5307
5390
|
// If given path is absolute then cwd should not affect it.
|
|
5308
5391
|
cwd = path.resolve(process.cwd(), cwd);
|
|
5309
5392
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
5310
|
-
require$$9.debugFn('inspect',
|
|
5393
|
+
require$$9.debugFn('inspect', `override: ${constants.SOCKET_JSON} gradle`, sockJson?.defaults?.manifest?.gradle);
|
|
5311
5394
|
let {
|
|
5312
5395
|
bin,
|
|
5313
5396
|
gradleOpts,
|
|
@@ -5318,7 +5401,7 @@ async function run$z(argv, importMeta, {
|
|
|
5318
5401
|
if (!bin) {
|
|
5319
5402
|
if (sockJson.defaults?.manifest?.gradle?.bin) {
|
|
5320
5403
|
bin = sockJson.defaults?.manifest?.gradle?.bin;
|
|
5321
|
-
logger.logger.info(
|
|
5404
|
+
logger.logger.info(`Using default --bin from ${constants.SOCKET_JSON}:`, bin);
|
|
5322
5405
|
} else {
|
|
5323
5406
|
bin = path.join(cwd, 'gradlew');
|
|
5324
5407
|
}
|
|
@@ -5326,7 +5409,7 @@ async function run$z(argv, importMeta, {
|
|
|
5326
5409
|
if (!gradleOpts) {
|
|
5327
5410
|
if (sockJson.defaults?.manifest?.gradle?.gradleOpts) {
|
|
5328
5411
|
gradleOpts = sockJson.defaults?.manifest?.gradle?.gradleOpts;
|
|
5329
|
-
logger.logger.info(
|
|
5412
|
+
logger.logger.info(`Using default --gradle-opts from ${constants.SOCKET_JSON}:`, gradleOpts);
|
|
5330
5413
|
} else {
|
|
5331
5414
|
gradleOpts = '';
|
|
5332
5415
|
}
|
|
@@ -5334,7 +5417,7 @@ async function run$z(argv, importMeta, {
|
|
|
5334
5417
|
if (verbose === undefined) {
|
|
5335
5418
|
if (sockJson.defaults?.manifest?.gradle?.verbose !== undefined) {
|
|
5336
5419
|
verbose = sockJson.defaults?.manifest?.gradle?.verbose;
|
|
5337
|
-
logger.logger.info(
|
|
5420
|
+
logger.logger.info(`Using default --verbose from ${constants.SOCKET_JSON}:`, verbose);
|
|
5338
5421
|
} else {
|
|
5339
5422
|
verbose = false;
|
|
5340
5423
|
}
|
|
@@ -5414,7 +5497,7 @@ const config$9 = {
|
|
|
5414
5497
|
|
|
5415
5498
|
Uses \`sbt makePom\` to generate a \`pom.xml\` from your \`build.sbt\` file.
|
|
5416
5499
|
This xml file is the dependency manifest (like a package.json
|
|
5417
|
-
for Node.js or
|
|
5500
|
+
for Node.js or ${constants.REQUIREMENTS_TXT} for PyPi), but specifically for Scala.
|
|
5418
5501
|
|
|
5419
5502
|
There are some caveats with \`build.sbt\` to \`pom.xml\` conversion:
|
|
5420
5503
|
|
|
@@ -5446,9 +5529,9 @@ const config$9 = {
|
|
|
5446
5529
|
const cmdManifestScala = {
|
|
5447
5530
|
description: config$9.description,
|
|
5448
5531
|
hidden: config$9.hidden,
|
|
5449
|
-
run: run$
|
|
5532
|
+
run: run$A
|
|
5450
5533
|
};
|
|
5451
|
-
async function run$
|
|
5534
|
+
async function run$A(argv, importMeta, {
|
|
5452
5535
|
parentName
|
|
5453
5536
|
}) {
|
|
5454
5537
|
const cli = utils.meowOrExit({
|
|
@@ -5470,7 +5553,7 @@ async function run$y(argv, importMeta, {
|
|
|
5470
5553
|
// TODO: Implement json/md further.
|
|
5471
5554
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
5472
5555
|
const sockJson = utils.readOrDefaultSocketJson(cwd);
|
|
5473
|
-
require$$9.debugFn('inspect',
|
|
5556
|
+
require$$9.debugFn('inspect', `override: ${constants.SOCKET_JSON} sbt`, sockJson?.defaults?.manifest?.sbt);
|
|
5474
5557
|
let {
|
|
5475
5558
|
bin,
|
|
5476
5559
|
out,
|
|
@@ -5483,21 +5566,21 @@ async function run$y(argv, importMeta, {
|
|
|
5483
5566
|
if (!bin) {
|
|
5484
5567
|
if (sockJson.defaults?.manifest?.sbt?.bin) {
|
|
5485
5568
|
bin = sockJson.defaults?.manifest?.sbt?.bin;
|
|
5486
|
-
logger.logger.info(
|
|
5569
|
+
logger.logger.info(`Using default --bin from ${constants.SOCKET_JSON}:`, bin);
|
|
5487
5570
|
} else {
|
|
5488
5571
|
bin = 'sbt';
|
|
5489
5572
|
}
|
|
5490
5573
|
}
|
|
5491
5574
|
if (stdout === undefined && sockJson.defaults?.manifest?.sbt?.stdout !== undefined) {
|
|
5492
5575
|
stdout = sockJson.defaults?.manifest?.sbt?.stdout;
|
|
5493
|
-
logger.logger.info(
|
|
5576
|
+
logger.logger.info(`Using default --stdout from ${constants.SOCKET_JSON}:`, stdout);
|
|
5494
5577
|
}
|
|
5495
5578
|
if (stdout) {
|
|
5496
5579
|
out = '-';
|
|
5497
5580
|
} else if (!out) {
|
|
5498
5581
|
if (sockJson.defaults?.manifest?.sbt?.outfile) {
|
|
5499
5582
|
out = sockJson.defaults?.manifest?.sbt?.outfile;
|
|
5500
|
-
logger.logger.info(
|
|
5583
|
+
logger.logger.info(`Using default --out from ${constants.SOCKET_JSON}:`, out);
|
|
5501
5584
|
} else {
|
|
5502
5585
|
out = './socket.pom.xml';
|
|
5503
5586
|
}
|
|
@@ -5505,14 +5588,14 @@ async function run$y(argv, importMeta, {
|
|
|
5505
5588
|
if (!sbtOpts) {
|
|
5506
5589
|
if (sockJson.defaults?.manifest?.sbt?.sbtOpts) {
|
|
5507
5590
|
sbtOpts = sockJson.defaults?.manifest?.sbt?.sbtOpts;
|
|
5508
|
-
logger.logger.info(
|
|
5591
|
+
logger.logger.info(`Using default --sbt-opts from ${constants.SOCKET_JSON}:`, sbtOpts);
|
|
5509
5592
|
} else {
|
|
5510
5593
|
sbtOpts = '';
|
|
5511
5594
|
}
|
|
5512
5595
|
}
|
|
5513
5596
|
if (verbose === undefined && sockJson.defaults?.manifest?.sbt?.verbose !== undefined) {
|
|
5514
5597
|
verbose = sockJson.defaults?.manifest?.sbt?.verbose;
|
|
5515
|
-
logger.logger.info(
|
|
5598
|
+
logger.logger.info(`Using default --verbose from ${constants.SOCKET_JSON}:`, verbose);
|
|
5516
5599
|
} else if (verbose === undefined) {
|
|
5517
5600
|
verbose = false;
|
|
5518
5601
|
}
|
|
@@ -5580,18 +5663,18 @@ async function setupManifestConfig(cwd, defaultOnReadError = false) {
|
|
|
5580
5663
|
// - each target will have its own specific options
|
|
5581
5664
|
// - record them to the socket.yml (or socket-cli.yml ? or just socket.json ?)
|
|
5582
5665
|
|
|
5583
|
-
const jsonPath = path.join(cwd,
|
|
5666
|
+
const jsonPath = path.join(cwd, constants.SOCKET_JSON);
|
|
5584
5667
|
if (fs$1.existsSync(jsonPath)) {
|
|
5585
|
-
logger.logger.info(`Found
|
|
5668
|
+
logger.logger.info(`Found ${constants.SOCKET_JSON} at ${jsonPath}`);
|
|
5586
5669
|
} else {
|
|
5587
|
-
logger.logger.info(`No
|
|
5670
|
+
logger.logger.info(`No ${constants.SOCKET_JSON} found at ${cwd}, will generate a new one`);
|
|
5588
5671
|
}
|
|
5589
5672
|
logger.logger.log('');
|
|
5590
5673
|
logger.logger.log('Note: This tool will set up flag and argument defaults for certain');
|
|
5591
5674
|
logger.logger.log(' CLI commands. You can still override them by explicitly');
|
|
5592
5675
|
logger.logger.log(' setting the flag. It is meant to be a convenience tool.');
|
|
5593
5676
|
logger.logger.log('');
|
|
5594
|
-
logger.logger.log(
|
|
5677
|
+
logger.logger.log(`This command will generate a ${constants.SOCKET_JSON} file in the target cwd.`);
|
|
5595
5678
|
logger.logger.log('You can choose to add this file to your repo (handy for collaboration)');
|
|
5596
5679
|
logger.logger.log('or to add it to the ignored files, or neither. This file is only');
|
|
5597
5680
|
logger.logger.log('used in CLI workflows.');
|
|
@@ -5599,7 +5682,7 @@ async function setupManifestConfig(cwd, defaultOnReadError = false) {
|
|
|
5599
5682
|
const choices = [{
|
|
5600
5683
|
name: 'Conda'.padEnd(30, ' '),
|
|
5601
5684
|
value: 'conda',
|
|
5602
|
-
description:
|
|
5685
|
+
description: `Generate ${constants.REQUIREMENTS_TXT} from a Conda environment.yml`
|
|
5603
5686
|
}, {
|
|
5604
5687
|
name: 'Gradle'.padEnd(30, ' '),
|
|
5605
5688
|
value: 'gradle',
|
|
@@ -5692,7 +5775,7 @@ async function setupManifestConfig(cwd, defaultOnReadError = false) {
|
|
|
5692
5775
|
return result;
|
|
5693
5776
|
}
|
|
5694
5777
|
logger.logger.log('');
|
|
5695
|
-
logger.logger.log(
|
|
5778
|
+
logger.logger.log(`Setup complete. Writing ${constants.SOCKET_JSON}`);
|
|
5696
5779
|
logger.logger.log('');
|
|
5697
5780
|
if (await prompts.select({
|
|
5698
5781
|
message: `Do you want to write the new config to ${jsonPath} ?`,
|
|
@@ -5743,7 +5826,7 @@ async function setupConda(config) {
|
|
|
5743
5826
|
delete config.stdout;
|
|
5744
5827
|
}
|
|
5745
5828
|
if (!config.stdout) {
|
|
5746
|
-
const out = await askForOutputFile(config.outfile ||
|
|
5829
|
+
const out = await askForOutputFile(config.outfile || constants.REQUIREMENTS_TXT);
|
|
5747
5830
|
if (out === undefined) {
|
|
5748
5831
|
return canceledByUser$1();
|
|
5749
5832
|
} else if (out === '-') {
|
|
@@ -5970,7 +6053,7 @@ const config$8 = {
|
|
|
5970
6053
|
...flags.commonFlags,
|
|
5971
6054
|
defaultOnReadError: {
|
|
5972
6055
|
type: 'boolean',
|
|
5973
|
-
description:
|
|
6056
|
+
description: `If reading the ${constants.SOCKET_JSON} fails, just use a default config? Warning: This might override the existing json file!`
|
|
5974
6057
|
}
|
|
5975
6058
|
},
|
|
5976
6059
|
help: (command, config) => `
|
|
@@ -5983,7 +6066,7 @@ const config$8 = {
|
|
|
5983
6066
|
This command will try to detect all supported ecosystems in given CWD. Then
|
|
5984
6067
|
it starts a configurator where you can setup default values for certain flags
|
|
5985
6068
|
when creating manifest files in that dir. These configuration details are
|
|
5986
|
-
then stored in a local
|
|
6069
|
+
then stored in a local \`${constants.SOCKET_JSON}\` file (which you may or may not commit
|
|
5987
6070
|
to the repo). Next time you run \`socket manifest ...\` it will load this
|
|
5988
6071
|
json file and any flags which are not explicitly set in the command but which
|
|
5989
6072
|
have been registered in the json file will get the default value set to that
|
|
@@ -6007,9 +6090,9 @@ const config$8 = {
|
|
|
6007
6090
|
const cmdManifestSetup = {
|
|
6008
6091
|
description: config$8.description,
|
|
6009
6092
|
hidden: config$8.hidden,
|
|
6010
|
-
run: run$
|
|
6093
|
+
run: run$z
|
|
6011
6094
|
};
|
|
6012
|
-
async function run$
|
|
6095
|
+
async function run$z(argv, importMeta, {
|
|
6013
6096
|
parentName
|
|
6014
6097
|
}) {
|
|
6015
6098
|
const cli = utils.meowOrExit({
|
|
@@ -6043,9 +6126,9 @@ const config$7 = {
|
|
|
6043
6126
|
const cmdManifest = {
|
|
6044
6127
|
description: config$7.description,
|
|
6045
6128
|
hidden: config$7.hidden,
|
|
6046
|
-
run: run$
|
|
6129
|
+
run: run$y
|
|
6047
6130
|
};
|
|
6048
|
-
async function run$
|
|
6131
|
+
async function run$y(argv, importMeta, {
|
|
6049
6132
|
parentName
|
|
6050
6133
|
}) {
|
|
6051
6134
|
await utils.meowWithSubcommands({
|
|
@@ -6072,22 +6155,26 @@ async function run$w(argv, importMeta, {
|
|
|
6072
6155
|
});
|
|
6073
6156
|
}
|
|
6074
6157
|
|
|
6075
|
-
const require$
|
|
6076
|
-
const CMD_NAME$
|
|
6077
|
-
const description$
|
|
6078
|
-
const hidden$
|
|
6158
|
+
const require$5 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
6159
|
+
const CMD_NAME$r = constants.NPM;
|
|
6160
|
+
const description$w = 'Run npm with the Socket wrapper';
|
|
6161
|
+
const hidden$q = false;
|
|
6079
6162
|
const cmdNpm = {
|
|
6080
|
-
description: description$
|
|
6081
|
-
hidden: hidden$
|
|
6082
|
-
run: run$
|
|
6163
|
+
description: description$w,
|
|
6164
|
+
hidden: hidden$q,
|
|
6165
|
+
run: run$x
|
|
6083
6166
|
};
|
|
6084
|
-
async function run$
|
|
6085
|
-
|
|
6086
|
-
|
|
6167
|
+
async function run$x(argv, importMeta, context) {
|
|
6168
|
+
const {
|
|
6169
|
+
parentName
|
|
6170
|
+
} = {
|
|
6171
|
+
__proto__: null,
|
|
6172
|
+
...context
|
|
6173
|
+
};
|
|
6087
6174
|
const config = {
|
|
6088
|
-
commandName: CMD_NAME$
|
|
6089
|
-
description: description$
|
|
6090
|
-
hidden: hidden$
|
|
6175
|
+
commandName: CMD_NAME$r,
|
|
6176
|
+
description: description$w,
|
|
6177
|
+
hidden: hidden$q,
|
|
6091
6178
|
flags: {
|
|
6092
6179
|
...flags.commonFlags
|
|
6093
6180
|
},
|
|
@@ -6096,7 +6183,7 @@ async function run$v(argv, importMeta, {
|
|
|
6096
6183
|
$ ${command} ...
|
|
6097
6184
|
|
|
6098
6185
|
API Token Requirements
|
|
6099
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
6186
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$r}`)}
|
|
6100
6187
|
|
|
6101
6188
|
Note: Everything after "npm" is passed to the npm command.
|
|
6102
6189
|
Only the \`--dry-run\` and \`--help\` flags are caught here.
|
|
@@ -6106,6 +6193,7 @@ async function run$v(argv, importMeta, {
|
|
|
6106
6193
|
Examples
|
|
6107
6194
|
$ ${command}
|
|
6108
6195
|
$ ${command} install -g cowsay
|
|
6196
|
+
$ ${command} exec cowsay
|
|
6109
6197
|
`
|
|
6110
6198
|
};
|
|
6111
6199
|
const cli = utils.meowOrExit({
|
|
@@ -6119,11 +6207,17 @@ async function run$v(argv, importMeta, {
|
|
|
6119
6207
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
6120
6208
|
return;
|
|
6121
6209
|
}
|
|
6122
|
-
const shadowBin = /*@__PURE__*/require$
|
|
6210
|
+
const shadowBin = /*@__PURE__*/require$5(constants.default.shadowNpmBinPath);
|
|
6123
6211
|
process.exitCode = 1;
|
|
6212
|
+
|
|
6213
|
+
// Filter Socket flags from argv but keep --json for npm.
|
|
6214
|
+
const argsToForward = utils.filterFlags(argv, {
|
|
6215
|
+
...flags.commonFlags,
|
|
6216
|
+
...flags.outputFlags
|
|
6217
|
+
}, ['--json']);
|
|
6124
6218
|
const {
|
|
6125
6219
|
spawnPromise
|
|
6126
|
-
} = await shadowBin(constants.NPM,
|
|
6220
|
+
} = await shadowBin(constants.NPM, argsToForward, {
|
|
6127
6221
|
stdio: 'inherit'
|
|
6128
6222
|
});
|
|
6129
6223
|
|
|
@@ -6139,31 +6233,31 @@ async function run$v(argv, importMeta, {
|
|
|
6139
6233
|
await spawnPromise;
|
|
6140
6234
|
}
|
|
6141
6235
|
|
|
6142
|
-
const require$
|
|
6143
|
-
const CMD_NAME$
|
|
6144
|
-
const description$
|
|
6145
|
-
const hidden$
|
|
6236
|
+
const require$4 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
6237
|
+
const CMD_NAME$q = constants.NPX;
|
|
6238
|
+
const description$v = 'Run npx with the Socket wrapper';
|
|
6239
|
+
const hidden$p = false;
|
|
6146
6240
|
const cmdNpx = {
|
|
6147
|
-
description: description$
|
|
6148
|
-
hidden: hidden$
|
|
6149
|
-
run: run$
|
|
6241
|
+
description: description$v,
|
|
6242
|
+
hidden: hidden$p,
|
|
6243
|
+
run: run$w
|
|
6150
6244
|
};
|
|
6151
|
-
async function run$
|
|
6245
|
+
async function run$w(argv, importMeta, {
|
|
6152
6246
|
parentName
|
|
6153
6247
|
}) {
|
|
6154
6248
|
const config = {
|
|
6155
|
-
commandName: CMD_NAME$
|
|
6156
|
-
description: description$
|
|
6157
|
-
hidden: hidden$
|
|
6158
|
-
flags: {
|
|
6159
|
-
...flags.commonFlags
|
|
6249
|
+
commandName: CMD_NAME$q,
|
|
6250
|
+
description: description$v,
|
|
6251
|
+
hidden: hidden$p,
|
|
6252
|
+
flags: {
|
|
6253
|
+
...flags.commonFlags
|
|
6160
6254
|
},
|
|
6161
6255
|
help: (command, _config) => `
|
|
6162
6256
|
Usage
|
|
6163
6257
|
$ ${command} ...
|
|
6164
6258
|
|
|
6165
6259
|
API Token Requirements
|
|
6166
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
6260
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$q}`)}
|
|
6167
6261
|
|
|
6168
6262
|
Note: Everything after "npx" is passed to the npx command.
|
|
6169
6263
|
Only the \`--dry-run\` and \`--help\` flags are caught here.
|
|
@@ -6172,6 +6266,7 @@ async function run$u(argv, importMeta, {
|
|
|
6172
6266
|
|
|
6173
6267
|
Examples
|
|
6174
6268
|
$ ${command} cowsay
|
|
6269
|
+
$ ${command} cowsay@1.6.0 hello
|
|
6175
6270
|
`
|
|
6176
6271
|
};
|
|
6177
6272
|
const cli = utils.meowOrExit({
|
|
@@ -6185,7 +6280,7 @@ async function run$u(argv, importMeta, {
|
|
|
6185
6280
|
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
6186
6281
|
return;
|
|
6187
6282
|
}
|
|
6188
|
-
const shadowBin = /*@__PURE__*/require$
|
|
6283
|
+
const shadowBin = /*@__PURE__*/require$4(constants.default.shadowNpmBinPath);
|
|
6189
6284
|
process.exitCode = 1;
|
|
6190
6285
|
const {
|
|
6191
6286
|
spawnPromise
|
|
@@ -6228,9 +6323,9 @@ const config$6 = {
|
|
|
6228
6323
|
const cmdOops = {
|
|
6229
6324
|
description: config$6.description,
|
|
6230
6325
|
hidden: config$6.hidden,
|
|
6231
|
-
run: run$
|
|
6326
|
+
run: run$v
|
|
6232
6327
|
};
|
|
6233
|
-
async function run$
|
|
6328
|
+
async function run$v(argv, importMeta, {
|
|
6234
6329
|
parentName
|
|
6235
6330
|
}) {
|
|
6236
6331
|
const cli = utils.meowOrExit({
|
|
@@ -6262,7 +6357,7 @@ async function run$t(argv, importMeta, {
|
|
|
6262
6357
|
logger.logger.fail(utils.failMsgWithBadge('Oops', 'This error was intentionally left blank'));
|
|
6263
6358
|
return;
|
|
6264
6359
|
}
|
|
6265
|
-
throw new Error('This error was intentionally left blank');
|
|
6360
|
+
throw new Error('This error was intentionally left blank.');
|
|
6266
6361
|
}
|
|
6267
6362
|
|
|
6268
6363
|
const {
|
|
@@ -6647,7 +6742,7 @@ async function listPackages(pkgEnvDetails, options) {
|
|
|
6647
6742
|
}
|
|
6648
6743
|
}
|
|
6649
6744
|
|
|
6650
|
-
const CMD_NAME$
|
|
6745
|
+
const CMD_NAME$p = 'socket optimize';
|
|
6651
6746
|
|
|
6652
6747
|
const {
|
|
6653
6748
|
BUN,
|
|
@@ -6819,7 +6914,7 @@ async function addOverrides(pkgEnvDetails, pkgPath, options) {
|
|
|
6819
6914
|
npmExecPath === constants.NPM && !state.warnedPnpmWorkspaceRequiresNpm) {
|
|
6820
6915
|
state.warnedPnpmWorkspaceRequiresNpm = true;
|
|
6821
6916
|
spinner?.stop();
|
|
6822
|
-
logger?.warn(utils.cmdPrefixMessage(CMD_NAME$
|
|
6917
|
+
logger?.warn(utils.cmdPrefixMessage(CMD_NAME$p, `${agent} workspace support requires \`npm ls\`, falling back to \`${agent} list\``));
|
|
6823
6918
|
spinner?.start();
|
|
6824
6919
|
}
|
|
6825
6920
|
const overridesDataObjects = [];
|
|
@@ -7049,7 +7144,7 @@ async function applyOptimization(pkgEnvDetails, {
|
|
|
7049
7144
|
const pkgJsonChanged = addedCount > 0 || updatedCount > 0;
|
|
7050
7145
|
if (pkgJsonChanged || pkgEnvDetails.features.npmBuggyOverrides) {
|
|
7051
7146
|
const result = await updateLockfile(pkgEnvDetails, {
|
|
7052
|
-
cmdName: CMD_NAME$
|
|
7147
|
+
cmdName: CMD_NAME$p,
|
|
7053
7148
|
logger: logger.logger,
|
|
7054
7149
|
spinner
|
|
7055
7150
|
});
|
|
@@ -7111,7 +7206,7 @@ async function handleOptimize({
|
|
|
7111
7206
|
prod
|
|
7112
7207
|
}) {
|
|
7113
7208
|
const pkgEnvCResult = await utils.detectAndValidatePackageEnvironment(cwd, {
|
|
7114
|
-
cmdName: CMD_NAME$
|
|
7209
|
+
cmdName: CMD_NAME$p,
|
|
7115
7210
|
logger: logger.logger,
|
|
7116
7211
|
prod
|
|
7117
7212
|
});
|
|
@@ -7136,7 +7231,7 @@ async function handleOptimize({
|
|
|
7136
7231
|
await outputOptimizeResult({
|
|
7137
7232
|
ok: false,
|
|
7138
7233
|
message: 'Unsupported',
|
|
7139
|
-
cause: utils.cmdPrefixMessage(CMD_NAME$
|
|
7234
|
+
cause: utils.cmdPrefixMessage(CMD_NAME$p, `${agent} v${agentVersion} does not support overrides.`)
|
|
7140
7235
|
}, outputKind);
|
|
7141
7236
|
return;
|
|
7142
7237
|
}
|
|
@@ -7147,21 +7242,21 @@ async function handleOptimize({
|
|
|
7147
7242
|
}), outputKind);
|
|
7148
7243
|
}
|
|
7149
7244
|
|
|
7150
|
-
const CMD_NAME$
|
|
7151
|
-
const description$
|
|
7152
|
-
const hidden$
|
|
7245
|
+
const CMD_NAME$o = 'optimize';
|
|
7246
|
+
const description$u = 'Optimize dependencies with @socketregistry overrides';
|
|
7247
|
+
const hidden$o = false;
|
|
7153
7248
|
const cmdOptimize = {
|
|
7154
|
-
description: description$
|
|
7155
|
-
hidden: hidden$
|
|
7156
|
-
run: run$
|
|
7249
|
+
description: description$u,
|
|
7250
|
+
hidden: hidden$o,
|
|
7251
|
+
run: run$u
|
|
7157
7252
|
};
|
|
7158
|
-
async function run$
|
|
7253
|
+
async function run$u(argv, importMeta, {
|
|
7159
7254
|
parentName
|
|
7160
7255
|
}) {
|
|
7161
7256
|
const config = {
|
|
7162
|
-
commandName: CMD_NAME$
|
|
7163
|
-
description: description$
|
|
7164
|
-
hidden: hidden$
|
|
7257
|
+
commandName: CMD_NAME$o,
|
|
7258
|
+
description: description$u,
|
|
7259
|
+
hidden: hidden$o,
|
|
7165
7260
|
flags: {
|
|
7166
7261
|
...flags.commonFlags,
|
|
7167
7262
|
pin: {
|
|
@@ -7180,7 +7275,7 @@ async function run$s(argv, importMeta, {
|
|
|
7180
7275
|
$ ${command} [options] [CWD=.]
|
|
7181
7276
|
|
|
7182
7277
|
API Token Requirements
|
|
7183
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
7278
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$o}`)}
|
|
7184
7279
|
|
|
7185
7280
|
Options
|
|
7186
7281
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -7323,21 +7418,21 @@ async function handleDependencies({
|
|
|
7323
7418
|
});
|
|
7324
7419
|
}
|
|
7325
7420
|
|
|
7326
|
-
const CMD_NAME$
|
|
7327
|
-
const description$
|
|
7328
|
-
const hidden$
|
|
7421
|
+
const CMD_NAME$n = 'dependencies';
|
|
7422
|
+
const description$t = 'Search for any dependency that is being used in your organization';
|
|
7423
|
+
const hidden$n = false;
|
|
7329
7424
|
const cmdOrganizationDependencies = {
|
|
7330
|
-
description: description$
|
|
7331
|
-
hidden: hidden$
|
|
7332
|
-
run: run$
|
|
7425
|
+
description: description$t,
|
|
7426
|
+
hidden: hidden$n,
|
|
7427
|
+
run: run$t
|
|
7333
7428
|
};
|
|
7334
|
-
async function run$
|
|
7429
|
+
async function run$t(argv, importMeta, {
|
|
7335
7430
|
parentName
|
|
7336
7431
|
}) {
|
|
7337
7432
|
const config = {
|
|
7338
|
-
commandName: CMD_NAME$
|
|
7339
|
-
description: description$
|
|
7340
|
-
hidden: hidden$
|
|
7433
|
+
commandName: CMD_NAME$n,
|
|
7434
|
+
description: description$t,
|
|
7435
|
+
hidden: hidden$n,
|
|
7341
7436
|
flags: {
|
|
7342
7437
|
...flags.commonFlags,
|
|
7343
7438
|
limit: {
|
|
@@ -7357,7 +7452,7 @@ async function run$r(argv, importMeta, {
|
|
|
7357
7452
|
${command} [options]
|
|
7358
7453
|
|
|
7359
7454
|
API Token Requirements
|
|
7360
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
7455
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$n}`)}
|
|
7361
7456
|
|
|
7362
7457
|
Options
|
|
7363
7458
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -7457,21 +7552,21 @@ async function handleLicensePolicy(orgSlug, outputKind) {
|
|
|
7457
7552
|
await outputLicensePolicy(data, outputKind);
|
|
7458
7553
|
}
|
|
7459
7554
|
|
|
7460
|
-
const CMD_NAME$
|
|
7461
|
-
const description$
|
|
7462
|
-
const hidden$
|
|
7555
|
+
const CMD_NAME$m = 'license';
|
|
7556
|
+
const description$s = 'Retrieve the license policy of an organization';
|
|
7557
|
+
const hidden$m = false;
|
|
7463
7558
|
const cmdOrganizationPolicyLicense = {
|
|
7464
|
-
description: description$
|
|
7465
|
-
hidden: hidden$
|
|
7466
|
-
run: run$
|
|
7559
|
+
description: description$s,
|
|
7560
|
+
hidden: hidden$m,
|
|
7561
|
+
run: run$s
|
|
7467
7562
|
};
|
|
7468
|
-
async function run$
|
|
7563
|
+
async function run$s(argv, importMeta, {
|
|
7469
7564
|
parentName
|
|
7470
7565
|
}) {
|
|
7471
7566
|
const config = {
|
|
7472
|
-
commandName: CMD_NAME$
|
|
7473
|
-
description: description$
|
|
7474
|
-
hidden: hidden$
|
|
7567
|
+
commandName: CMD_NAME$m,
|
|
7568
|
+
description: description$s,
|
|
7569
|
+
hidden: hidden$m,
|
|
7475
7570
|
flags: {
|
|
7476
7571
|
...flags.commonFlags,
|
|
7477
7572
|
...flags.outputFlags,
|
|
@@ -7490,7 +7585,7 @@ async function run$q(argv, importMeta, {
|
|
|
7490
7585
|
$ ${command} [options]
|
|
7491
7586
|
|
|
7492
7587
|
API Token Requirements
|
|
7493
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
7588
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$m}`)}
|
|
7494
7589
|
|
|
7495
7590
|
Options
|
|
7496
7591
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -7593,21 +7688,21 @@ async function handleSecurityPolicy(orgSlug, outputKind) {
|
|
|
7593
7688
|
await outputSecurityPolicy(data, outputKind);
|
|
7594
7689
|
}
|
|
7595
7690
|
|
|
7596
|
-
const CMD_NAME$
|
|
7597
|
-
const description$
|
|
7598
|
-
const hidden$
|
|
7691
|
+
const CMD_NAME$l = 'security';
|
|
7692
|
+
const description$r = 'Retrieve the security policy of an organization';
|
|
7693
|
+
const hidden$l = true;
|
|
7599
7694
|
const cmdOrganizationPolicySecurity = {
|
|
7600
|
-
description: description$
|
|
7601
|
-
hidden: hidden$
|
|
7602
|
-
run: run$
|
|
7695
|
+
description: description$r,
|
|
7696
|
+
hidden: hidden$l,
|
|
7697
|
+
run: run$r
|
|
7603
7698
|
};
|
|
7604
|
-
async function run$
|
|
7699
|
+
async function run$r(argv, importMeta, {
|
|
7605
7700
|
parentName
|
|
7606
7701
|
}) {
|
|
7607
7702
|
const config = {
|
|
7608
|
-
commandName: CMD_NAME$
|
|
7609
|
-
description: description$
|
|
7610
|
-
hidden: hidden$
|
|
7703
|
+
commandName: CMD_NAME$l,
|
|
7704
|
+
description: description$r,
|
|
7705
|
+
hidden: hidden$l,
|
|
7611
7706
|
flags: {
|
|
7612
7707
|
...flags.commonFlags,
|
|
7613
7708
|
...flags.outputFlags,
|
|
@@ -7626,7 +7721,7 @@ async function run$p(argv, importMeta, {
|
|
|
7626
7721
|
$ ${command} [options]
|
|
7627
7722
|
|
|
7628
7723
|
API Token Requirements
|
|
7629
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
7724
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$l}`)}
|
|
7630
7725
|
|
|
7631
7726
|
Options
|
|
7632
7727
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -7730,21 +7825,21 @@ async function handleOrganizationList(outputKind = 'text') {
|
|
|
7730
7825
|
await outputOrganizationList(data, outputKind);
|
|
7731
7826
|
}
|
|
7732
7827
|
|
|
7733
|
-
const CMD_NAME$
|
|
7734
|
-
const description$
|
|
7735
|
-
const hidden$
|
|
7828
|
+
const CMD_NAME$k = 'list';
|
|
7829
|
+
const description$q = 'List organizations associated with the Socket API token';
|
|
7830
|
+
const hidden$k = false;
|
|
7736
7831
|
const cmdOrganizationList = {
|
|
7737
|
-
description: description$
|
|
7738
|
-
hidden: hidden$
|
|
7739
|
-
run: run$
|
|
7832
|
+
description: description$q,
|
|
7833
|
+
hidden: hidden$k,
|
|
7834
|
+
run: run$q
|
|
7740
7835
|
};
|
|
7741
|
-
async function run$
|
|
7836
|
+
async function run$q(argv, importMeta, {
|
|
7742
7837
|
parentName
|
|
7743
7838
|
}) {
|
|
7744
7839
|
const config = {
|
|
7745
|
-
commandName: CMD_NAME$
|
|
7746
|
-
description: description$
|
|
7747
|
-
hidden: hidden$
|
|
7840
|
+
commandName: CMD_NAME$k,
|
|
7841
|
+
description: description$q,
|
|
7842
|
+
hidden: hidden$k,
|
|
7748
7843
|
flags: {
|
|
7749
7844
|
...flags.commonFlags,
|
|
7750
7845
|
...flags.outputFlags
|
|
@@ -7754,7 +7849,7 @@ async function run$o(argv, importMeta, {
|
|
|
7754
7849
|
$ ${command} [options]
|
|
7755
7850
|
|
|
7756
7851
|
API Token Requirements
|
|
7757
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
7852
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$k}`)}
|
|
7758
7853
|
|
|
7759
7854
|
Options
|
|
7760
7855
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -7798,9 +7893,9 @@ async function run$o(argv, importMeta, {
|
|
|
7798
7893
|
await handleOrganizationList(outputKind);
|
|
7799
7894
|
}
|
|
7800
7895
|
|
|
7801
|
-
const description$
|
|
7896
|
+
const description$p = 'Organization policy details';
|
|
7802
7897
|
const cmdOrganizationPolicy = {
|
|
7803
|
-
description: description$
|
|
7898
|
+
description: description$p,
|
|
7804
7899
|
// Hidden because it was broken all this time (nobody could be using it)
|
|
7805
7900
|
// and we're not sure if it's useful to anyone in its current state.
|
|
7806
7901
|
// Until we do, we'll hide this to keep the help tidier.
|
|
@@ -7814,7 +7909,7 @@ const cmdOrganizationPolicy = {
|
|
|
7814
7909
|
license: cmdOrganizationPolicyLicense
|
|
7815
7910
|
}, {
|
|
7816
7911
|
argv,
|
|
7817
|
-
description: description$
|
|
7912
|
+
description: description$p,
|
|
7818
7913
|
defaultSub: 'list',
|
|
7819
7914
|
// Backwards compat
|
|
7820
7915
|
importMeta,
|
|
@@ -7891,9 +7986,9 @@ const config$5 = {
|
|
|
7891
7986
|
const cmdOrganizationQuota = {
|
|
7892
7987
|
description: config$5.description,
|
|
7893
7988
|
hidden: config$5.hidden,
|
|
7894
|
-
run: run$
|
|
7989
|
+
run: run$p
|
|
7895
7990
|
};
|
|
7896
|
-
async function run$
|
|
7991
|
+
async function run$p(argv, importMeta, {
|
|
7897
7992
|
parentName
|
|
7898
7993
|
}) {
|
|
7899
7994
|
const cli = utils.meowOrExit({
|
|
@@ -7928,9 +8023,9 @@ async function run$n(argv, importMeta, {
|
|
|
7928
8023
|
await handleQuota(outputKind);
|
|
7929
8024
|
}
|
|
7930
8025
|
|
|
7931
|
-
const description$
|
|
8026
|
+
const description$o = 'Manage Socket organization account details';
|
|
7932
8027
|
const cmdOrganization = {
|
|
7933
|
-
description: description$
|
|
8028
|
+
description: description$o,
|
|
7934
8029
|
hidden: false,
|
|
7935
8030
|
async run(argv, importMeta, {
|
|
7936
8031
|
parentName
|
|
@@ -7959,7 +8054,7 @@ const cmdOrganization = {
|
|
|
7959
8054
|
}
|
|
7960
8055
|
},
|
|
7961
8056
|
argv,
|
|
7962
|
-
description: description$
|
|
8057
|
+
description: description$o,
|
|
7963
8058
|
importMeta,
|
|
7964
8059
|
name: `${parentName} organization`
|
|
7965
8060
|
});
|
|
@@ -8184,21 +8279,21 @@ function parsePackageSpecifiers(ecosystem, pkgs) {
|
|
|
8184
8279
|
};
|
|
8185
8280
|
}
|
|
8186
8281
|
|
|
8187
|
-
const CMD_NAME$
|
|
8188
|
-
const description$
|
|
8189
|
-
const hidden$
|
|
8282
|
+
const CMD_NAME$j = 'score';
|
|
8283
|
+
const description$n = 'Look up score for one package which reflects all of its transitive dependencies as well';
|
|
8284
|
+
const hidden$j = false;
|
|
8190
8285
|
const cmdPackageScore = {
|
|
8191
|
-
description: description$
|
|
8192
|
-
hidden: hidden$
|
|
8193
|
-
run: run$
|
|
8286
|
+
description: description$n,
|
|
8287
|
+
hidden: hidden$j,
|
|
8288
|
+
run: run$o
|
|
8194
8289
|
};
|
|
8195
|
-
async function run$
|
|
8290
|
+
async function run$o(argv, importMeta, {
|
|
8196
8291
|
parentName
|
|
8197
8292
|
}) {
|
|
8198
8293
|
const config = {
|
|
8199
|
-
commandName: CMD_NAME$
|
|
8200
|
-
description: description$
|
|
8201
|
-
hidden: hidden$
|
|
8294
|
+
commandName: CMD_NAME$j,
|
|
8295
|
+
description: description$n,
|
|
8296
|
+
hidden: hidden$j,
|
|
8202
8297
|
flags: {
|
|
8203
8298
|
...flags.commonFlags,
|
|
8204
8299
|
...flags.outputFlags
|
|
@@ -8208,7 +8303,7 @@ async function run$m(argv, importMeta, {
|
|
|
8208
8303
|
$ ${command} [options] <<ECOSYSTEM> <NAME> | <PURL>>
|
|
8209
8304
|
|
|
8210
8305
|
API Token Requirements
|
|
8211
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
8306
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$j}`)}
|
|
8212
8307
|
|
|
8213
8308
|
Options
|
|
8214
8309
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -8407,15 +8502,15 @@ function getAlertString(alerts, options) {
|
|
|
8407
8502
|
|
|
8408
8503
|
// We need to create the no-color string regardless because the actual string
|
|
8409
8504
|
// contains a bunch of invisible ANSI chars which would screw up length checks.
|
|
8410
|
-
const colorless = `- Alerts (${bad.length}/${mid.length
|
|
8505
|
+
const colorless = `- Alerts (${bad.length}/${mid.length}/${low.length}):`;
|
|
8411
8506
|
const padding = ` ${' '.repeat(Math.max(0, 20 - colorless.length))}`;
|
|
8412
8507
|
if (colorize) {
|
|
8413
|
-
return `- Alerts (${vendor.yoctocolorsCjsExports.red(bad.length
|
|
8508
|
+
return `- Alerts (${vendor.yoctocolorsCjsExports.red(bad.length)}/${vendor.yoctocolorsCjsExports.yellow(mid.length)}/${low.length}):${padding}${arrays.joinAnd([...bad.map(a => vendor.yoctocolorsCjsExports.red(`${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`)), ...mid.map(a => vendor.yoctocolorsCjsExports.yellow(`${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`)), ...low.map(a => `${vendor.yoctocolorsCjsExports.dim(`[${a.severity}] `)}${a.type}`)])}`;
|
|
8414
8509
|
}
|
|
8415
|
-
return colorless
|
|
8510
|
+
return `${colorless}${padding}${arrays.joinAnd([...bad.map(a => `[${a.severity}] ${a.type}`), ...mid.map(a => `[${a.severity}] ${a.type}`), ...low.map(a => `[${a.severity}] ${a.type}`)])}`;
|
|
8416
8511
|
}
|
|
8417
8512
|
function preProcess(artifacts, requestedPurls) {
|
|
8418
|
-
// Dedupe results (for example,
|
|
8513
|
+
// Dedupe results (for example, PyPI will emit one package for each system release (win/mac/cpu) even if it's
|
|
8419
8514
|
// the same package version with same results. The duplication is irrelevant and annoying to the user.
|
|
8420
8515
|
|
|
8421
8516
|
// Make some effort to match the requested data with the response
|
|
@@ -8566,28 +8661,28 @@ async function handlePurlsShallowScore({
|
|
|
8566
8661
|
outputPurlsShallowScore(purls, packageData, outputKind);
|
|
8567
8662
|
}
|
|
8568
8663
|
|
|
8569
|
-
const CMD_NAME$
|
|
8570
|
-
const description$
|
|
8571
|
-
const hidden$
|
|
8664
|
+
const CMD_NAME$i = 'shallow';
|
|
8665
|
+
const description$m = 'Look up info regarding one or more packages but not their transitives';
|
|
8666
|
+
const hidden$i = false;
|
|
8572
8667
|
const cmdPackageShallow = {
|
|
8573
|
-
description: description$
|
|
8574
|
-
hidden: hidden$
|
|
8668
|
+
description: description$m,
|
|
8669
|
+
hidden: hidden$i,
|
|
8575
8670
|
alias: {
|
|
8576
8671
|
shallowScore: {
|
|
8577
|
-
description: description$
|
|
8672
|
+
description: description$m,
|
|
8578
8673
|
hidden: true,
|
|
8579
8674
|
argv: []
|
|
8580
8675
|
}
|
|
8581
8676
|
},
|
|
8582
|
-
run: run$
|
|
8677
|
+
run: run$n
|
|
8583
8678
|
};
|
|
8584
|
-
async function run$
|
|
8679
|
+
async function run$n(argv, importMeta, {
|
|
8585
8680
|
parentName
|
|
8586
8681
|
}) {
|
|
8587
8682
|
const config = {
|
|
8588
|
-
commandName: CMD_NAME$
|
|
8589
|
-
description: description$
|
|
8590
|
-
hidden: hidden$
|
|
8683
|
+
commandName: CMD_NAME$i,
|
|
8684
|
+
description: description$m,
|
|
8685
|
+
hidden: hidden$i,
|
|
8591
8686
|
flags: {
|
|
8592
8687
|
...flags.commonFlags,
|
|
8593
8688
|
...flags.outputFlags
|
|
@@ -8597,7 +8692,7 @@ async function run$l(argv, importMeta, {
|
|
|
8597
8692
|
$ ${command} [options] <<ECOSYSTEM> <PKGNAME> [<PKGNAME> ...] | <PURL> [<PURL> ...]>
|
|
8598
8693
|
|
|
8599
8694
|
API Token Requirements
|
|
8600
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
8695
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$i}`)}
|
|
8601
8696
|
|
|
8602
8697
|
Options
|
|
8603
8698
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -8671,9 +8766,9 @@ async function run$l(argv, importMeta, {
|
|
|
8671
8766
|
});
|
|
8672
8767
|
}
|
|
8673
8768
|
|
|
8674
|
-
const description$
|
|
8769
|
+
const description$l = 'Look up published package details';
|
|
8675
8770
|
const cmdPackage = {
|
|
8676
|
-
description: description$
|
|
8771
|
+
description: description$l,
|
|
8677
8772
|
hidden: false,
|
|
8678
8773
|
async run(argv, importMeta, {
|
|
8679
8774
|
parentName
|
|
@@ -8684,13 +8779,13 @@ const cmdPackage = {
|
|
|
8684
8779
|
}, {
|
|
8685
8780
|
aliases: {
|
|
8686
8781
|
deep: {
|
|
8687
|
-
description: description$
|
|
8782
|
+
description: description$l,
|
|
8688
8783
|
hidden: true,
|
|
8689
8784
|
argv: ['score']
|
|
8690
8785
|
}
|
|
8691
8786
|
},
|
|
8692
8787
|
argv,
|
|
8693
|
-
description: description$
|
|
8788
|
+
description: description$l,
|
|
8694
8789
|
importMeta,
|
|
8695
8790
|
name: `${parentName} package`
|
|
8696
8791
|
});
|
|
@@ -8744,7 +8839,7 @@ async function outputPatchResult(result, outputKind) {
|
|
|
8744
8839
|
}
|
|
8745
8840
|
logger.logger.groupEnd();
|
|
8746
8841
|
} else {
|
|
8747
|
-
logger.logger.warn('No packages found requiring patches');
|
|
8842
|
+
logger.logger.warn('No packages found requiring patches.');
|
|
8748
8843
|
}
|
|
8749
8844
|
logger.logger.log('');
|
|
8750
8845
|
logger.logger.success('Patch command completed!');
|
|
@@ -8845,14 +8940,26 @@ async function applyNpmPatches(socketDir, patches, options) {
|
|
|
8845
8940
|
}
|
|
8846
8941
|
return result;
|
|
8847
8942
|
}
|
|
8943
|
+
|
|
8944
|
+
/**
|
|
8945
|
+
* Compute SHA256 hash of file contents.
|
|
8946
|
+
*/
|
|
8848
8947
|
async function computeSHA256(filepath) {
|
|
8849
8948
|
try {
|
|
8850
8949
|
const content = await fs$1.promises.readFile(filepath);
|
|
8851
8950
|
const hash = require$$0$1.createHash('sha256');
|
|
8852
8951
|
hash.update(content);
|
|
8853
|
-
return
|
|
8854
|
-
|
|
8855
|
-
|
|
8952
|
+
return {
|
|
8953
|
+
ok: true,
|
|
8954
|
+
data: hash.digest('hex')
|
|
8955
|
+
};
|
|
8956
|
+
} catch (e) {
|
|
8957
|
+
return {
|
|
8958
|
+
ok: false,
|
|
8959
|
+
message: 'Failed to compute file hash',
|
|
8960
|
+
cause: `Unable to read file ${filepath}: ${e instanceof Error ? e.message : 'Unknown error'}`
|
|
8961
|
+
};
|
|
8962
|
+
}
|
|
8856
8963
|
}
|
|
8857
8964
|
async function findNodeModulesPaths(cwd) {
|
|
8858
8965
|
const rootNmPath = await utils.findUp(constants.NODE_MODULES, {
|
|
@@ -8888,29 +8995,29 @@ async function processFilePatch(pkgPath, fileName, fileInfo, socketDir, options)
|
|
|
8888
8995
|
}
|
|
8889
8996
|
return false;
|
|
8890
8997
|
}
|
|
8891
|
-
const
|
|
8892
|
-
if (!
|
|
8893
|
-
logger.logger.log(`Failed to compute hash for: ${fileName}`);
|
|
8998
|
+
const currentHashResult = await computeSHA256(filepath);
|
|
8999
|
+
if (!currentHashResult.ok) {
|
|
9000
|
+
logger.logger.log(`Failed to compute hash for: ${fileName}: ${currentHashResult.cause || currentHashResult.message}`);
|
|
8894
9001
|
if (wasSpinning) {
|
|
8895
9002
|
spinner?.start();
|
|
8896
9003
|
}
|
|
8897
9004
|
return false;
|
|
8898
9005
|
}
|
|
8899
|
-
if (
|
|
9006
|
+
if (currentHashResult.data === fileInfo.afterHash) {
|
|
8900
9007
|
logger.logger.success(`File already patched: ${fileName}`);
|
|
8901
9008
|
logger.logger.group();
|
|
8902
|
-
logger.logger.log(`Current hash: ${
|
|
9009
|
+
logger.logger.log(`Current hash: ${currentHashResult.data}`);
|
|
8903
9010
|
logger.logger.groupEnd();
|
|
8904
9011
|
if (wasSpinning) {
|
|
8905
9012
|
spinner?.start();
|
|
8906
9013
|
}
|
|
8907
9014
|
return true;
|
|
8908
9015
|
}
|
|
8909
|
-
if (
|
|
9016
|
+
if (currentHashResult.data !== fileInfo.beforeHash) {
|
|
8910
9017
|
logger.logger.fail(`File hash mismatch: ${fileName}`);
|
|
8911
9018
|
logger.logger.group();
|
|
8912
9019
|
logger.logger.log(`Expected: ${fileInfo.beforeHash}`);
|
|
8913
|
-
logger.logger.log(`Current: ${
|
|
9020
|
+
logger.logger.log(`Current: ${currentHashResult.data}`);
|
|
8914
9021
|
logger.logger.log(`Target: ${fileInfo.afterHash}`);
|
|
8915
9022
|
logger.logger.groupEnd();
|
|
8916
9023
|
if (wasSpinning) {
|
|
@@ -8920,7 +9027,7 @@ async function processFilePatch(pkgPath, fileName, fileInfo, socketDir, options)
|
|
|
8920
9027
|
}
|
|
8921
9028
|
logger.logger.success(`File matches expected hash: ${fileName}`);
|
|
8922
9029
|
logger.logger.group();
|
|
8923
|
-
logger.logger.log(`Current hash: ${
|
|
9030
|
+
logger.logger.log(`Current hash: ${currentHashResult.data}`);
|
|
8924
9031
|
logger.logger.log(`Ready to patch to: ${fileInfo.afterHash}`);
|
|
8925
9032
|
logger.logger.group();
|
|
8926
9033
|
if (dryRun) {
|
|
@@ -9048,21 +9155,21 @@ async function handlePatch({
|
|
|
9048
9155
|
}
|
|
9049
9156
|
}
|
|
9050
9157
|
|
|
9051
|
-
const CMD_NAME$
|
|
9052
|
-
const description$
|
|
9053
|
-
const hidden$
|
|
9158
|
+
const CMD_NAME$h = 'patch';
|
|
9159
|
+
const description$k = 'Apply CVE patches to dependencies';
|
|
9160
|
+
const hidden$h = true;
|
|
9054
9161
|
const cmdPatch = {
|
|
9055
|
-
description: description$
|
|
9056
|
-
hidden: hidden$
|
|
9057
|
-
run: run$
|
|
9162
|
+
description: description$k,
|
|
9163
|
+
hidden: hidden$h,
|
|
9164
|
+
run: run$m
|
|
9058
9165
|
};
|
|
9059
|
-
async function run$
|
|
9166
|
+
async function run$m(argv, importMeta, {
|
|
9060
9167
|
parentName
|
|
9061
9168
|
}) {
|
|
9062
9169
|
const config = {
|
|
9063
|
-
commandName: CMD_NAME$
|
|
9064
|
-
description: description$
|
|
9065
|
-
hidden: hidden$
|
|
9170
|
+
commandName: CMD_NAME$h,
|
|
9171
|
+
description: description$k,
|
|
9172
|
+
hidden: hidden$h,
|
|
9066
9173
|
flags: {
|
|
9067
9174
|
...flags.commonFlags,
|
|
9068
9175
|
...flags.outputFlags,
|
|
@@ -9079,7 +9186,7 @@ async function run$k(argv, importMeta, {
|
|
|
9079
9186
|
$ ${command} [options] [CWD=.]
|
|
9080
9187
|
|
|
9081
9188
|
API Token Requirements
|
|
9082
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
9189
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$h}`)}
|
|
9083
9190
|
|
|
9084
9191
|
Options
|
|
9085
9192
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -9118,13 +9225,11 @@ async function run$k(argv, importMeta, {
|
|
|
9118
9225
|
cwd = path.resolve(process.cwd(), cwd);
|
|
9119
9226
|
const dotSocketDirPath = path.join(cwd, constants.DOT_SOCKET);
|
|
9120
9227
|
if (!fs$1.existsSync(dotSocketDirPath)) {
|
|
9121
|
-
|
|
9122
|
-
return;
|
|
9228
|
+
throw new utils.InputError(`No ${constants.DOT_SOCKET} directory found in current directory`);
|
|
9123
9229
|
}
|
|
9124
9230
|
const manifestPath = path.join(dotSocketDirPath, constants.MANIFEST_JSON);
|
|
9125
9231
|
if (!fs$1.existsSync(manifestPath)) {
|
|
9126
|
-
|
|
9127
|
-
return;
|
|
9232
|
+
throw new utils.InputError(`No ${constants.MANIFEST_JSON} found in ${constants.DOT_SOCKET} directory`);
|
|
9128
9233
|
}
|
|
9129
9234
|
const {
|
|
9130
9235
|
spinner
|
|
@@ -9141,6 +9246,71 @@ async function run$k(argv, importMeta, {
|
|
|
9141
9246
|
});
|
|
9142
9247
|
}
|
|
9143
9248
|
|
|
9249
|
+
const require$3 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
9250
|
+
const CMD_NAME$g = constants.PNPM;
|
|
9251
|
+
const description$j = 'Run pnpm with the Socket wrapper';
|
|
9252
|
+
const hidden$g = true;
|
|
9253
|
+
const cmdPnpm = {
|
|
9254
|
+
description: description$j,
|
|
9255
|
+
hidden: hidden$g,
|
|
9256
|
+
run: run$l
|
|
9257
|
+
};
|
|
9258
|
+
async function run$l(argv, importMeta, context) {
|
|
9259
|
+
const {
|
|
9260
|
+
parentName
|
|
9261
|
+
} = {
|
|
9262
|
+
__proto__: null,
|
|
9263
|
+
...context
|
|
9264
|
+
};
|
|
9265
|
+
const config = {
|
|
9266
|
+
commandName: CMD_NAME$g,
|
|
9267
|
+
description: description$j,
|
|
9268
|
+
hidden: hidden$g,
|
|
9269
|
+
flags: {
|
|
9270
|
+
...flags.commonFlags
|
|
9271
|
+
},
|
|
9272
|
+
help: command => `
|
|
9273
|
+
Usage
|
|
9274
|
+
$ ${command} ...
|
|
9275
|
+
|
|
9276
|
+
API Token Requirements
|
|
9277
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$g}`)}
|
|
9278
|
+
|
|
9279
|
+
Note: Everything after "pnpm" is passed to the pnpm command.
|
|
9280
|
+
Only the \`--dry-run\` and \`--help\` flags are caught here.
|
|
9281
|
+
|
|
9282
|
+
Use \`socket wrapper on\` to alias this command as \`pnpm\`.
|
|
9283
|
+
|
|
9284
|
+
Examples
|
|
9285
|
+
$ ${command}
|
|
9286
|
+
$ ${command} install
|
|
9287
|
+
$ ${command} add package-name
|
|
9288
|
+
$ ${command} dlx package-name
|
|
9289
|
+
`
|
|
9290
|
+
};
|
|
9291
|
+
const cli = utils.meowOrExit({
|
|
9292
|
+
argv,
|
|
9293
|
+
config,
|
|
9294
|
+
importMeta,
|
|
9295
|
+
parentName
|
|
9296
|
+
});
|
|
9297
|
+
const dryRun = !!cli.flags['dryRun'];
|
|
9298
|
+
if (dryRun) {
|
|
9299
|
+
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
9300
|
+
return;
|
|
9301
|
+
}
|
|
9302
|
+
const shadowBin = /*@__PURE__*/require$3(constants.default.shadowPnpmBinPath);
|
|
9303
|
+
process.exitCode = 1;
|
|
9304
|
+
|
|
9305
|
+
// Filter Socket flags from argv.
|
|
9306
|
+
const filteredArgv = utils.filterFlags(argv, config.flags);
|
|
9307
|
+
const {
|
|
9308
|
+
spawnPromise
|
|
9309
|
+
} = await shadowBin(filteredArgv);
|
|
9310
|
+
await spawnPromise;
|
|
9311
|
+
process.exitCode = 0;
|
|
9312
|
+
}
|
|
9313
|
+
|
|
9144
9314
|
async function runRawNpm(argv) {
|
|
9145
9315
|
process.exitCode = 1;
|
|
9146
9316
|
const spawnPromise = spawn.spawn(utils.getNpmBinPath(), argv, {
|
|
@@ -9185,9 +9355,9 @@ const config$4 = {
|
|
|
9185
9355
|
const cmdRawNpm = {
|
|
9186
9356
|
description: config$4.description,
|
|
9187
9357
|
hidden: config$4.hidden,
|
|
9188
|
-
run: run$
|
|
9358
|
+
run: run$k
|
|
9189
9359
|
};
|
|
9190
|
-
async function run$
|
|
9360
|
+
async function run$k(argv, importMeta, {
|
|
9191
9361
|
parentName
|
|
9192
9362
|
}) {
|
|
9193
9363
|
const cli = utils.meowOrExit({
|
|
@@ -9248,9 +9418,9 @@ const config$3 = {
|
|
|
9248
9418
|
const cmdRawNpx = {
|
|
9249
9419
|
description: config$3.description,
|
|
9250
9420
|
hidden: config$3.hidden,
|
|
9251
|
-
run: run$
|
|
9421
|
+
run: run$j
|
|
9252
9422
|
};
|
|
9253
|
-
async function run$
|
|
9423
|
+
async function run$j(argv, importMeta, {
|
|
9254
9424
|
parentName
|
|
9255
9425
|
}) {
|
|
9256
9426
|
const cli = utils.meowOrExit({
|
|
@@ -9335,21 +9505,21 @@ async function handleCreateRepo({
|
|
|
9335
9505
|
outputCreateRepo(data, repoName, outputKind);
|
|
9336
9506
|
}
|
|
9337
9507
|
|
|
9338
|
-
const CMD_NAME$
|
|
9339
|
-
const description$
|
|
9340
|
-
const hidden$
|
|
9508
|
+
const CMD_NAME$f = 'create';
|
|
9509
|
+
const description$i = 'Create a repository in an organization';
|
|
9510
|
+
const hidden$f = false;
|
|
9341
9511
|
const cmdRepositoryCreate = {
|
|
9342
|
-
description: description$
|
|
9343
|
-
hidden: hidden$
|
|
9344
|
-
run: run$
|
|
9512
|
+
description: description$i,
|
|
9513
|
+
hidden: hidden$f,
|
|
9514
|
+
run: run$i
|
|
9345
9515
|
};
|
|
9346
|
-
async function run$
|
|
9516
|
+
async function run$i(argv, importMeta, {
|
|
9347
9517
|
parentName
|
|
9348
9518
|
}) {
|
|
9349
9519
|
const config = {
|
|
9350
|
-
commandName: CMD_NAME$
|
|
9351
|
-
description: description$
|
|
9352
|
-
hidden: hidden$
|
|
9520
|
+
commandName: CMD_NAME$f,
|
|
9521
|
+
description: description$i,
|
|
9522
|
+
hidden: hidden$f,
|
|
9353
9523
|
flags: {
|
|
9354
9524
|
...flags.commonFlags,
|
|
9355
9525
|
...flags.outputFlags,
|
|
@@ -9388,7 +9558,7 @@ async function run$h(argv, importMeta, {
|
|
|
9388
9558
|
$ ${command} [options] <REPO>
|
|
9389
9559
|
|
|
9390
9560
|
API Token Requirements
|
|
9391
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
9561
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$f}`)}
|
|
9392
9562
|
|
|
9393
9563
|
The REPO name should be a "slug". Follows the same naming convention as GitHub.
|
|
9394
9564
|
|
|
@@ -9494,21 +9664,21 @@ async function handleDeleteRepo(orgSlug, repoName, outputKind) {
|
|
|
9494
9664
|
await outputDeleteRepo(data, repoName, outputKind);
|
|
9495
9665
|
}
|
|
9496
9666
|
|
|
9497
|
-
const CMD_NAME$
|
|
9498
|
-
const description$
|
|
9499
|
-
const hidden$
|
|
9667
|
+
const CMD_NAME$e = 'del';
|
|
9668
|
+
const description$h = 'Delete a repository in an organization';
|
|
9669
|
+
const hidden$e = false;
|
|
9500
9670
|
const cmdRepositoryDel = {
|
|
9501
|
-
description: description$
|
|
9502
|
-
hidden: hidden$
|
|
9503
|
-
run: run$
|
|
9671
|
+
description: description$h,
|
|
9672
|
+
hidden: hidden$e,
|
|
9673
|
+
run: run$h
|
|
9504
9674
|
};
|
|
9505
|
-
async function run$
|
|
9675
|
+
async function run$h(argv, importMeta, {
|
|
9506
9676
|
parentName
|
|
9507
9677
|
}) {
|
|
9508
9678
|
const config = {
|
|
9509
|
-
commandName: CMD_NAME$
|
|
9510
|
-
description: description$
|
|
9511
|
-
hidden: hidden$
|
|
9679
|
+
commandName: CMD_NAME$e,
|
|
9680
|
+
description: description$h,
|
|
9681
|
+
hidden: hidden$e,
|
|
9512
9682
|
flags: {
|
|
9513
9683
|
...flags.commonFlags,
|
|
9514
9684
|
...flags.outputFlags,
|
|
@@ -9527,7 +9697,7 @@ async function run$g(argv, importMeta, {
|
|
|
9527
9697
|
$ ${command} [options] <REPO>
|
|
9528
9698
|
|
|
9529
9699
|
API Token Requirements
|
|
9530
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
9700
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$e}`)}
|
|
9531
9701
|
|
|
9532
9702
|
Options
|
|
9533
9703
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -9757,21 +9927,21 @@ async function handleListRepos({
|
|
|
9757
9927
|
}
|
|
9758
9928
|
}
|
|
9759
9929
|
|
|
9760
|
-
const CMD_NAME$
|
|
9761
|
-
const description$
|
|
9762
|
-
const hidden$
|
|
9930
|
+
const CMD_NAME$d = 'list';
|
|
9931
|
+
const description$g = 'List repositories in an organization';
|
|
9932
|
+
const hidden$d = false;
|
|
9763
9933
|
const cmdRepositoryList = {
|
|
9764
|
-
description: description$
|
|
9765
|
-
hidden: hidden$
|
|
9766
|
-
run: run$
|
|
9934
|
+
description: description$g,
|
|
9935
|
+
hidden: hidden$d,
|
|
9936
|
+
run: run$g
|
|
9767
9937
|
};
|
|
9768
|
-
async function run$
|
|
9938
|
+
async function run$g(argv, importMeta, {
|
|
9769
9939
|
parentName
|
|
9770
9940
|
}) {
|
|
9771
9941
|
const config = {
|
|
9772
|
-
commandName: CMD_NAME$
|
|
9773
|
-
description: description$
|
|
9774
|
-
hidden: hidden$
|
|
9942
|
+
commandName: CMD_NAME$d,
|
|
9943
|
+
description: description$g,
|
|
9944
|
+
hidden: hidden$d,
|
|
9775
9945
|
flags: {
|
|
9776
9946
|
...flags.commonFlags,
|
|
9777
9947
|
...flags.outputFlags,
|
|
@@ -9792,25 +9962,26 @@ async function run$f(argv, importMeta, {
|
|
|
9792
9962
|
},
|
|
9793
9963
|
org: {
|
|
9794
9964
|
type: 'string',
|
|
9965
|
+
default: '',
|
|
9795
9966
|
description: 'Force override the organization slug, overrides the default org from config'
|
|
9796
9967
|
},
|
|
9797
9968
|
perPage: {
|
|
9798
9969
|
type: 'number',
|
|
9799
|
-
shortFlag: 'pp',
|
|
9800
9970
|
default: 30,
|
|
9801
|
-
description: 'Number of results per page'
|
|
9971
|
+
description: 'Number of results per page',
|
|
9972
|
+
shortFlag: 'pp'
|
|
9802
9973
|
},
|
|
9803
9974
|
page: {
|
|
9804
9975
|
type: 'number',
|
|
9805
|
-
shortFlag: 'p',
|
|
9806
9976
|
default: 1,
|
|
9807
|
-
description: 'Page number'
|
|
9977
|
+
description: 'Page number',
|
|
9978
|
+
shortFlag: 'p'
|
|
9808
9979
|
},
|
|
9809
9980
|
sort: {
|
|
9810
9981
|
type: 'string',
|
|
9811
|
-
shortFlag: 's',
|
|
9812
9982
|
default: 'created_at',
|
|
9813
|
-
description: 'Sorting option'
|
|
9983
|
+
description: 'Sorting option',
|
|
9984
|
+
shortFlag: 's'
|
|
9814
9985
|
}
|
|
9815
9986
|
},
|
|
9816
9987
|
help: (command, config) => `
|
|
@@ -9818,7 +9989,7 @@ async function run$f(argv, importMeta, {
|
|
|
9818
9989
|
$ ${command} [options]
|
|
9819
9990
|
|
|
9820
9991
|
API Token Requirements
|
|
9821
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
9992
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$d}`)}
|
|
9822
9993
|
|
|
9823
9994
|
Options
|
|
9824
9995
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -9837,16 +10008,19 @@ async function run$f(argv, importMeta, {
|
|
|
9837
10008
|
const {
|
|
9838
10009
|
all,
|
|
9839
10010
|
direction = 'desc',
|
|
10011
|
+
dryRun,
|
|
10012
|
+
interactive,
|
|
9840
10013
|
json,
|
|
9841
10014
|
markdown,
|
|
9842
|
-
org: orgFlag
|
|
10015
|
+
org: orgFlag,
|
|
10016
|
+
page,
|
|
10017
|
+
perPage,
|
|
10018
|
+
sort
|
|
9843
10019
|
} = cli.flags;
|
|
9844
|
-
const dryRun = !!cli.flags['dryRun'];
|
|
9845
|
-
const interactive = !!cli.flags['interactive'];
|
|
9846
10020
|
const hasApiToken = utils.hasDefaultApiToken();
|
|
9847
10021
|
const {
|
|
9848
10022
|
0: orgSlug
|
|
9849
|
-
} = await utils.determineOrgSlug(
|
|
10023
|
+
} = await utils.determineOrgSlug(orgFlag, interactive, dryRun);
|
|
9850
10024
|
const outputKind = utils.getOutputKind(json, markdown);
|
|
9851
10025
|
const wasValidInput = utils.checkCommandInput(outputKind, {
|
|
9852
10026
|
nook: true,
|
|
@@ -9877,13 +10051,13 @@ async function run$f(argv, importMeta, {
|
|
|
9877
10051
|
return;
|
|
9878
10052
|
}
|
|
9879
10053
|
await handleListRepos({
|
|
9880
|
-
all
|
|
9881
|
-
direction
|
|
10054
|
+
all,
|
|
10055
|
+
direction,
|
|
9882
10056
|
orgSlug,
|
|
9883
10057
|
outputKind,
|
|
9884
|
-
page
|
|
9885
|
-
perPage
|
|
9886
|
-
sort
|
|
10058
|
+
page,
|
|
10059
|
+
perPage,
|
|
10060
|
+
sort
|
|
9887
10061
|
});
|
|
9888
10062
|
}
|
|
9889
10063
|
|
|
@@ -9956,21 +10130,21 @@ async function handleUpdateRepo({
|
|
|
9956
10130
|
await outputUpdateRepo(data, repoName, outputKind);
|
|
9957
10131
|
}
|
|
9958
10132
|
|
|
9959
|
-
const CMD_NAME$
|
|
9960
|
-
const description$
|
|
9961
|
-
const hidden$
|
|
10133
|
+
const CMD_NAME$c = 'update';
|
|
10134
|
+
const description$f = 'Update a repository in an organization';
|
|
10135
|
+
const hidden$c = false;
|
|
9962
10136
|
const cmdRepositoryUpdate = {
|
|
9963
|
-
description: description$
|
|
9964
|
-
hidden: hidden$
|
|
9965
|
-
run: run$
|
|
10137
|
+
description: description$f,
|
|
10138
|
+
hidden: hidden$c,
|
|
10139
|
+
run: run$f
|
|
9966
10140
|
};
|
|
9967
|
-
async function run$
|
|
10141
|
+
async function run$f(argv, importMeta, {
|
|
9968
10142
|
parentName
|
|
9969
10143
|
}) {
|
|
9970
10144
|
const config = {
|
|
9971
|
-
commandName: CMD_NAME$
|
|
9972
|
-
description: description$
|
|
9973
|
-
hidden: hidden$
|
|
10145
|
+
commandName: CMD_NAME$c,
|
|
10146
|
+
description: description$f,
|
|
10147
|
+
hidden: hidden$c,
|
|
9974
10148
|
flags: {
|
|
9975
10149
|
...flags.commonFlags,
|
|
9976
10150
|
...flags.outputFlags,
|
|
@@ -10013,7 +10187,7 @@ async function run$e(argv, importMeta, {
|
|
|
10013
10187
|
$ ${command} [options] <REPO>
|
|
10014
10188
|
|
|
10015
10189
|
API Token Requirements
|
|
10016
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
10190
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$c}`)}
|
|
10017
10191
|
|
|
10018
10192
|
Options
|
|
10019
10193
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -10142,21 +10316,21 @@ async function handleViewRepo(orgSlug, repoName, outputKind) {
|
|
|
10142
10316
|
await outputViewRepo(data, outputKind);
|
|
10143
10317
|
}
|
|
10144
10318
|
|
|
10145
|
-
const CMD_NAME$
|
|
10146
|
-
const description$
|
|
10147
|
-
const hidden$
|
|
10319
|
+
const CMD_NAME$b = 'view';
|
|
10320
|
+
const description$e = 'View repositories in an organization';
|
|
10321
|
+
const hidden$b = false;
|
|
10148
10322
|
const cmdRepositoryView = {
|
|
10149
|
-
description: description$
|
|
10150
|
-
hidden: hidden$
|
|
10151
|
-
run: run$
|
|
10323
|
+
description: description$e,
|
|
10324
|
+
hidden: hidden$b,
|
|
10325
|
+
run: run$e
|
|
10152
10326
|
};
|
|
10153
|
-
async function run$
|
|
10327
|
+
async function run$e(argv, importMeta, {
|
|
10154
10328
|
parentName
|
|
10155
10329
|
}) {
|
|
10156
10330
|
const config = {
|
|
10157
|
-
commandName: CMD_NAME$
|
|
10158
|
-
description: description$
|
|
10159
|
-
hidden: hidden$
|
|
10331
|
+
commandName: CMD_NAME$b,
|
|
10332
|
+
description: description$e,
|
|
10333
|
+
hidden: hidden$b,
|
|
10160
10334
|
flags: {
|
|
10161
10335
|
...flags.commonFlags,
|
|
10162
10336
|
...flags.outputFlags,
|
|
@@ -10175,7 +10349,7 @@ async function run$d(argv, importMeta, {
|
|
|
10175
10349
|
$ ${command} [options] <REPO>
|
|
10176
10350
|
|
|
10177
10351
|
API Token Requirements
|
|
10178
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
10352
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$b}`)}
|
|
10179
10353
|
|
|
10180
10354
|
Options
|
|
10181
10355
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -10240,9 +10414,9 @@ async function run$d(argv, importMeta, {
|
|
|
10240
10414
|
await handleViewRepo(orgSlug, String(repoName), outputKind);
|
|
10241
10415
|
}
|
|
10242
10416
|
|
|
10243
|
-
const description$
|
|
10417
|
+
const description$d = 'Manage registered repositories';
|
|
10244
10418
|
const cmdRepository = {
|
|
10245
|
-
description: description$
|
|
10419
|
+
description: description$d,
|
|
10246
10420
|
async run(argv, importMeta, {
|
|
10247
10421
|
parentName
|
|
10248
10422
|
}) {
|
|
@@ -10254,7 +10428,7 @@ const cmdRepository = {
|
|
|
10254
10428
|
update: cmdRepositoryUpdate
|
|
10255
10429
|
}, {
|
|
10256
10430
|
argv,
|
|
10257
|
-
description: description$
|
|
10431
|
+
description: description$d,
|
|
10258
10432
|
importMeta,
|
|
10259
10433
|
name: `${parentName} repository`
|
|
10260
10434
|
});
|
|
@@ -10312,9 +10486,9 @@ async function suggestTarget() {
|
|
|
10312
10486
|
return proceed ? ['.'] : [];
|
|
10313
10487
|
}
|
|
10314
10488
|
|
|
10315
|
-
const CMD_NAME$
|
|
10316
|
-
const description$
|
|
10317
|
-
const hidden$
|
|
10489
|
+
const CMD_NAME$a = 'create';
|
|
10490
|
+
const description$c = 'Create a new Socket scan and report';
|
|
10491
|
+
const hidden$a = false;
|
|
10318
10492
|
const generalFlags$1 = {
|
|
10319
10493
|
...flags.commonFlags,
|
|
10320
10494
|
...flags.outputFlags,
|
|
@@ -10410,17 +10584,17 @@ const generalFlags$1 = {
|
|
|
10410
10584
|
}
|
|
10411
10585
|
};
|
|
10412
10586
|
const cmdScanCreate = {
|
|
10413
|
-
description: description$
|
|
10414
|
-
hidden: hidden$
|
|
10415
|
-
run: run$
|
|
10587
|
+
description: description$c,
|
|
10588
|
+
hidden: hidden$a,
|
|
10589
|
+
run: run$d
|
|
10416
10590
|
};
|
|
10417
|
-
async function run$
|
|
10591
|
+
async function run$d(argv, importMeta, {
|
|
10418
10592
|
parentName
|
|
10419
10593
|
}) {
|
|
10420
10594
|
const config = {
|
|
10421
|
-
commandName: CMD_NAME$
|
|
10422
|
-
description: description$
|
|
10423
|
-
hidden: hidden$
|
|
10595
|
+
commandName: CMD_NAME$a,
|
|
10596
|
+
description: description$c,
|
|
10597
|
+
hidden: hidden$a,
|
|
10424
10598
|
flags: {
|
|
10425
10599
|
...generalFlags$1,
|
|
10426
10600
|
...reachabilityFlags
|
|
@@ -10431,7 +10605,7 @@ async function run$c(argv, importMeta, {
|
|
|
10431
10605
|
$ ${command} [options] [TARGET...]
|
|
10432
10606
|
|
|
10433
10607
|
API Token Requirements
|
|
10434
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
10608
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$a}`)}
|
|
10435
10609
|
|
|
10436
10610
|
Options
|
|
10437
10611
|
${utils.getFlagListOutput(generalFlags$1)}
|
|
@@ -10440,7 +10614,7 @@ async function run$c(argv, importMeta, {
|
|
|
10440
10614
|
${utils.getFlagListOutput(reachabilityFlags)}
|
|
10441
10615
|
|
|
10442
10616
|
Uploads the specified dependency manifest files for Go, Gradle, JavaScript,
|
|
10443
|
-
Kotlin, Python, and Scala. Files like "package.json" and "
|
|
10617
|
+
Kotlin, Python, and Scala. Files like "package.json" and "${constants.REQUIREMENTS_TXT}".
|
|
10444
10618
|
If any folder is specified, the ones found in there recursively are uploaded.
|
|
10445
10619
|
|
|
10446
10620
|
Details on TARGET:
|
|
@@ -10450,7 +10624,7 @@ async function run$c(argv, importMeta, {
|
|
|
10450
10624
|
- If a target is a file, only that file is checked
|
|
10451
10625
|
- If it is a dir, the dir is scanned for any supported manifest files
|
|
10452
10626
|
- Dirs MUST be within the current dir (cwd), you can use --cwd to change it
|
|
10453
|
-
- Supports globbing such as "**/package.json", "
|
|
10627
|
+
- Supports globbing such as "**/package.json", "**/${constants.REQUIREMENTS_TXT}", etc.
|
|
10454
10628
|
- Ignores any file specified in your project's ".gitignore"
|
|
10455
10629
|
- Also a sensible set of default ignores from the "ignore-by-default" module
|
|
10456
10630
|
|
|
@@ -10525,13 +10699,13 @@ async function run$c(argv, importMeta, {
|
|
|
10525
10699
|
} = await utils.determineOrgSlug(String(orgFlag || ''), interactive, dryRun);
|
|
10526
10700
|
const processCwd = process.cwd();
|
|
10527
10701
|
const cwd = cwdOverride && cwdOverride !== '.' && cwdOverride !== processCwd ? path.resolve(processCwd, cwdOverride) : processCwd;
|
|
10528
|
-
const sockJson = utils.
|
|
10702
|
+
const sockJson = await utils.readOrDefaultSocketJsonUp(cwd);
|
|
10529
10703
|
|
|
10530
10704
|
// Note: This needs meow booleanDefault=undefined.
|
|
10531
10705
|
if (typeof autoManifest !== 'boolean') {
|
|
10532
10706
|
if (sockJson.defaults?.scan?.create?.autoManifest !== undefined) {
|
|
10533
10707
|
autoManifest = sockJson.defaults.scan.create.autoManifest;
|
|
10534
|
-
logger.logger.info(
|
|
10708
|
+
logger.logger.info(`Using default --auto-manifest from ${constants.SOCKET_JSON}:`, autoManifest);
|
|
10535
10709
|
} else {
|
|
10536
10710
|
autoManifest = false;
|
|
10537
10711
|
}
|
|
@@ -10539,7 +10713,7 @@ async function run$c(argv, importMeta, {
|
|
|
10539
10713
|
if (!branchName) {
|
|
10540
10714
|
if (sockJson.defaults?.scan?.create?.branch) {
|
|
10541
10715
|
branchName = sockJson.defaults.scan.create.branch;
|
|
10542
|
-
logger.logger.info(
|
|
10716
|
+
logger.logger.info(`Using default --branch from ${constants.SOCKET_JSON}:`, branchName);
|
|
10543
10717
|
} else {
|
|
10544
10718
|
branchName = (await utils.gitBranch(cwd)) || (await utils.detectDefaultBranch(cwd));
|
|
10545
10719
|
}
|
|
@@ -10547,7 +10721,7 @@ async function run$c(argv, importMeta, {
|
|
|
10547
10721
|
if (!repoName) {
|
|
10548
10722
|
if (sockJson.defaults?.scan?.create?.repo) {
|
|
10549
10723
|
repoName = sockJson.defaults.scan.create.repo;
|
|
10550
|
-
logger.logger.info(
|
|
10724
|
+
logger.logger.info(`Using default --repo from ${constants.SOCKET_JSON}:`, repoName);
|
|
10551
10725
|
} else {
|
|
10552
10726
|
repoName = await utils.getRepoName(cwd);
|
|
10553
10727
|
}
|
|
@@ -10555,7 +10729,7 @@ async function run$c(argv, importMeta, {
|
|
|
10555
10729
|
if (typeof report !== 'boolean') {
|
|
10556
10730
|
if (sockJson.defaults?.scan?.create?.report !== undefined) {
|
|
10557
10731
|
report = sockJson.defaults.scan.create.report;
|
|
10558
|
-
logger.logger.info(
|
|
10732
|
+
logger.logger.info(`Using default --report from ${constants.SOCKET_JSON}:`, report);
|
|
10559
10733
|
} else {
|
|
10560
10734
|
report = false;
|
|
10561
10735
|
}
|
|
@@ -10612,7 +10786,7 @@ async function run$c(argv, importMeta, {
|
|
|
10612
10786
|
logger.logger.error(` socket scan create [other flags...] ${orgSlug} ${targets.join(' ')}`);
|
|
10613
10787
|
logger.logger.error('```');
|
|
10614
10788
|
logger.logger.error('');
|
|
10615
|
-
logger.logger.info(
|
|
10789
|
+
logger.logger.info(`You can also run \`socket scan setup\` to persist these flag defaults to a ${constants.SOCKET_JSON} file.`);
|
|
10616
10790
|
logger.logger.error('');
|
|
10617
10791
|
}
|
|
10618
10792
|
const reachExcludePaths = utils.cmdFlagValueToArray(cli.flags['reachExcludePaths']);
|
|
@@ -10734,21 +10908,21 @@ async function handleDeleteScan(orgSlug, scanId, outputKind) {
|
|
|
10734
10908
|
await outputDeleteScan(data, outputKind);
|
|
10735
10909
|
}
|
|
10736
10910
|
|
|
10737
|
-
const CMD_NAME$
|
|
10738
|
-
const description$
|
|
10739
|
-
const hidden$
|
|
10911
|
+
const CMD_NAME$9 = 'del';
|
|
10912
|
+
const description$b = 'Delete a scan';
|
|
10913
|
+
const hidden$9 = false;
|
|
10740
10914
|
const cmdScanDel = {
|
|
10741
|
-
description: description$
|
|
10742
|
-
hidden: hidden$
|
|
10743
|
-
run: run$
|
|
10915
|
+
description: description$b,
|
|
10916
|
+
hidden: hidden$9,
|
|
10917
|
+
run: run$c
|
|
10744
10918
|
};
|
|
10745
|
-
async function run$
|
|
10919
|
+
async function run$c(argv, importMeta, {
|
|
10746
10920
|
parentName
|
|
10747
10921
|
}) {
|
|
10748
10922
|
const config = {
|
|
10749
|
-
commandName: CMD_NAME$
|
|
10750
|
-
description: description$
|
|
10751
|
-
hidden: hidden$
|
|
10923
|
+
commandName: CMD_NAME$9,
|
|
10924
|
+
description: description$b,
|
|
10925
|
+
hidden: hidden$9,
|
|
10752
10926
|
flags: {
|
|
10753
10927
|
...flags.commonFlags,
|
|
10754
10928
|
...flags.outputFlags,
|
|
@@ -10767,7 +10941,7 @@ async function run$b(argv, importMeta, {
|
|
|
10767
10941
|
$ ${command} [options] <SCAN_ID>
|
|
10768
10942
|
|
|
10769
10943
|
API Token Requirements
|
|
10770
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
10944
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$9}`)}
|
|
10771
10945
|
|
|
10772
10946
|
Options
|
|
10773
10947
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -11011,21 +11185,21 @@ async function handleDiffScan({
|
|
|
11011
11185
|
});
|
|
11012
11186
|
}
|
|
11013
11187
|
|
|
11014
|
-
const CMD_NAME$
|
|
11015
|
-
const description$
|
|
11016
|
-
const hidden$
|
|
11188
|
+
const CMD_NAME$8 = 'diff';
|
|
11189
|
+
const description$a = 'See what changed between two Scans';
|
|
11190
|
+
const hidden$8 = false;
|
|
11017
11191
|
const cmdScanDiff = {
|
|
11018
|
-
description: description$
|
|
11019
|
-
hidden: hidden$
|
|
11020
|
-
run: run$
|
|
11192
|
+
description: description$a,
|
|
11193
|
+
hidden: hidden$8,
|
|
11194
|
+
run: run$b
|
|
11021
11195
|
};
|
|
11022
|
-
async function run$
|
|
11196
|
+
async function run$b(argv, importMeta, {
|
|
11023
11197
|
parentName
|
|
11024
11198
|
}) {
|
|
11025
11199
|
const config = {
|
|
11026
|
-
commandName: CMD_NAME$
|
|
11027
|
-
description: description$
|
|
11028
|
-
hidden: hidden$
|
|
11200
|
+
commandName: CMD_NAME$8,
|
|
11201
|
+
description: description$a,
|
|
11202
|
+
hidden: hidden$8,
|
|
11029
11203
|
flags: {
|
|
11030
11204
|
...flags.commonFlags,
|
|
11031
11205
|
...flags.outputFlags,
|
|
@@ -11055,7 +11229,7 @@ async function run$a(argv, importMeta, {
|
|
|
11055
11229
|
$ ${command} [options] <SCAN_ID1> <SCAN_ID2>
|
|
11056
11230
|
|
|
11057
11231
|
API Token Requirements
|
|
11058
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
11232
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$8}`)}
|
|
11059
11233
|
|
|
11060
11234
|
This command displays the package changes between two scans. The full output
|
|
11061
11235
|
can be pretty large depending on the size of your repo and time range. It is
|
|
@@ -11083,12 +11257,12 @@ async function run$a(argv, importMeta, {
|
|
|
11083
11257
|
const SOCKET_SBOM_URL_PREFIX_LENGTH = SOCKET_SBOM_URL_PREFIX.length;
|
|
11084
11258
|
const {
|
|
11085
11259
|
depth,
|
|
11260
|
+
dryRun,
|
|
11086
11261
|
file,
|
|
11087
11262
|
json,
|
|
11088
11263
|
markdown,
|
|
11089
11264
|
org: orgFlag
|
|
11090
11265
|
} = cli.flags;
|
|
11091
|
-
const dryRun = !!cli.flags['dryRun'];
|
|
11092
11266
|
const interactive = !!cli.flags['interactive'];
|
|
11093
11267
|
let [id1 = '', id2 = ''] = cli.input;
|
|
11094
11268
|
// Support dropping in full socket urls to an sbom.
|
|
@@ -11131,12 +11305,12 @@ async function run$a(argv, importMeta, {
|
|
|
11131
11305
|
return;
|
|
11132
11306
|
}
|
|
11133
11307
|
await handleDiffScan({
|
|
11134
|
-
id1
|
|
11135
|
-
id2
|
|
11136
|
-
depth
|
|
11308
|
+
id1,
|
|
11309
|
+
id2,
|
|
11310
|
+
depth,
|
|
11137
11311
|
orgSlug,
|
|
11138
11312
|
outputKind,
|
|
11139
|
-
file
|
|
11313
|
+
file
|
|
11140
11314
|
});
|
|
11141
11315
|
}
|
|
11142
11316
|
|
|
@@ -11151,7 +11325,7 @@ async function createScanFromGithub({
|
|
|
11151
11325
|
repos
|
|
11152
11326
|
}) {
|
|
11153
11327
|
let targetRepos = repos.trim().split(',').map(r => r.trim()).filter(Boolean);
|
|
11154
|
-
if (all || targetRepos.length
|
|
11328
|
+
if (all || !targetRepos.length) {
|
|
11155
11329
|
// Fetch from Socket API
|
|
11156
11330
|
const result = await fetchListAllRepos(orgSlug, {
|
|
11157
11331
|
direction: 'asc',
|
|
@@ -11522,10 +11696,10 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
|
|
|
11522
11696
|
ok: true,
|
|
11523
11697
|
data: localPath
|
|
11524
11698
|
};
|
|
11525
|
-
} catch (
|
|
11699
|
+
} catch (e) {
|
|
11526
11700
|
logger.logger.fail('An error was thrown while trying to download a manifest file... url:', downloadUrl);
|
|
11527
11701
|
require$$9.debugDir('inspect', {
|
|
11528
|
-
error
|
|
11702
|
+
error: e
|
|
11529
11703
|
});
|
|
11530
11704
|
|
|
11531
11705
|
// If an error occurs and fileStream was created, attempt to clean up.
|
|
@@ -11539,10 +11713,10 @@ async function streamDownloadWithFetch(localPath, downloadUrl) {
|
|
|
11539
11713
|
});
|
|
11540
11714
|
}
|
|
11541
11715
|
// Construct a more informative error message
|
|
11542
|
-
let detailedError = `Error during download of ${downloadUrl}: ${
|
|
11543
|
-
if (
|
|
11716
|
+
let detailedError = `Error during download of ${downloadUrl}: ${e.message}`;
|
|
11717
|
+
if (e.cause) {
|
|
11544
11718
|
// Include cause if available (e.g., from network errors)
|
|
11545
|
-
detailedError += `\nCause: ${
|
|
11719
|
+
detailedError += `\nCause: ${e.cause}`;
|
|
11546
11720
|
}
|
|
11547
11721
|
if (response && !response.ok) {
|
|
11548
11722
|
// If error was due to bad HTTP status
|
|
@@ -11799,22 +11973,22 @@ async function handleCreateGithubScan({
|
|
|
11799
11973
|
await outputScanGithub(ghScanCResult, outputKind);
|
|
11800
11974
|
}
|
|
11801
11975
|
|
|
11802
|
-
const CMD_NAME$
|
|
11976
|
+
const CMD_NAME$7 = 'github';
|
|
11803
11977
|
const DEFAULT_GITHUB_URL = 'https://api.github.com';
|
|
11804
|
-
const description$
|
|
11805
|
-
const hidden$
|
|
11978
|
+
const description$9 = 'Create a scan for given GitHub repo';
|
|
11979
|
+
const hidden$7 = true;
|
|
11806
11980
|
const cmdScanGithub = {
|
|
11807
|
-
description: description$
|
|
11808
|
-
hidden: hidden$
|
|
11809
|
-
run: run$
|
|
11981
|
+
description: description$9,
|
|
11982
|
+
hidden: hidden$7,
|
|
11983
|
+
run: run$a
|
|
11810
11984
|
};
|
|
11811
|
-
async function run$
|
|
11985
|
+
async function run$a(argv, importMeta, {
|
|
11812
11986
|
parentName
|
|
11813
11987
|
}) {
|
|
11814
11988
|
const config = {
|
|
11815
|
-
commandName: CMD_NAME$
|
|
11816
|
-
description: description$
|
|
11817
|
-
hidden: hidden$
|
|
11989
|
+
commandName: CMD_NAME$7,
|
|
11990
|
+
description: description$9,
|
|
11991
|
+
hidden: hidden$7,
|
|
11818
11992
|
flags: {
|
|
11819
11993
|
...flags.commonFlags,
|
|
11820
11994
|
...flags.outputFlags,
|
|
@@ -11858,7 +12032,7 @@ async function run$9(argv, importMeta, {
|
|
|
11858
12032
|
$ ${command} [options] [CWD=.]
|
|
11859
12033
|
|
|
11860
12034
|
API Token Requirements
|
|
11861
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
12035
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$7}`)}
|
|
11862
12036
|
|
|
11863
12037
|
This is similar to the \`socket scan create\` command except it pulls the files
|
|
11864
12038
|
from GitHub. See the help for that command for more details.
|
|
@@ -12115,21 +12289,21 @@ async function handleListScans({
|
|
|
12115
12289
|
await outputListScans(data, outputKind);
|
|
12116
12290
|
}
|
|
12117
12291
|
|
|
12118
|
-
const CMD_NAME$
|
|
12119
|
-
const description$
|
|
12120
|
-
const hidden$
|
|
12292
|
+
const CMD_NAME$6 = 'list';
|
|
12293
|
+
const description$8 = 'List the scans for an organization';
|
|
12294
|
+
const hidden$6 = false;
|
|
12121
12295
|
const cmdScanList = {
|
|
12122
|
-
description: description$
|
|
12123
|
-
hidden: hidden$
|
|
12124
|
-
run: run$
|
|
12296
|
+
description: description$8,
|
|
12297
|
+
hidden: hidden$6,
|
|
12298
|
+
run: run$9
|
|
12125
12299
|
};
|
|
12126
|
-
async function run$
|
|
12300
|
+
async function run$9(argv, importMeta, {
|
|
12127
12301
|
parentName
|
|
12128
12302
|
}) {
|
|
12129
12303
|
const config = {
|
|
12130
|
-
commandName: CMD_NAME$
|
|
12131
|
-
description: description$
|
|
12132
|
-
hidden: hidden$
|
|
12304
|
+
commandName: CMD_NAME$6,
|
|
12305
|
+
description: description$8,
|
|
12306
|
+
hidden: hidden$6,
|
|
12133
12307
|
flags: {
|
|
12134
12308
|
...flags.commonFlags,
|
|
12135
12309
|
...flags.outputFlags,
|
|
@@ -12188,7 +12362,7 @@ async function run$8(argv, importMeta, {
|
|
|
12188
12362
|
$ ${command} [options] [REPO [BRANCH]]
|
|
12189
12363
|
|
|
12190
12364
|
API Token Requirements
|
|
12191
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
12365
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$6}`)}
|
|
12192
12366
|
|
|
12193
12367
|
Optionally filter by REPO. If you specify a repo, you can also specify a
|
|
12194
12368
|
branch to filter by. (Note: If you don't specify a repo then you must use
|
|
@@ -12324,21 +12498,21 @@ async function handleOrgScanMetadata(orgSlug, scanId, outputKind) {
|
|
|
12324
12498
|
await outputScanMetadata(data, scanId, outputKind);
|
|
12325
12499
|
}
|
|
12326
12500
|
|
|
12327
|
-
const CMD_NAME$
|
|
12328
|
-
const description$
|
|
12329
|
-
const hidden$
|
|
12501
|
+
const CMD_NAME$5 = 'metadata';
|
|
12502
|
+
const description$7 = "Get a scan's metadata";
|
|
12503
|
+
const hidden$5 = false;
|
|
12330
12504
|
const cmdScanMetadata = {
|
|
12331
|
-
description: description$
|
|
12332
|
-
hidden: hidden$
|
|
12333
|
-
run: run$
|
|
12505
|
+
description: description$7,
|
|
12506
|
+
hidden: hidden$5,
|
|
12507
|
+
run: run$8
|
|
12334
12508
|
};
|
|
12335
|
-
async function run$
|
|
12509
|
+
async function run$8(argv, importMeta, {
|
|
12336
12510
|
parentName
|
|
12337
12511
|
}) {
|
|
12338
12512
|
const config = {
|
|
12339
|
-
commandName: CMD_NAME$
|
|
12340
|
-
description: description$
|
|
12341
|
-
hidden: hidden$
|
|
12513
|
+
commandName: CMD_NAME$5,
|
|
12514
|
+
description: description$7,
|
|
12515
|
+
hidden: hidden$5,
|
|
12342
12516
|
flags: {
|
|
12343
12517
|
...flags.commonFlags,
|
|
12344
12518
|
...flags.outputFlags,
|
|
@@ -12357,7 +12531,7 @@ async function run$7(argv, importMeta, {
|
|
|
12357
12531
|
$ ${command} [options] <SCAN_ID>
|
|
12358
12532
|
|
|
12359
12533
|
API Token Requirements
|
|
12360
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
12534
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$5}`)}
|
|
12361
12535
|
|
|
12362
12536
|
Options
|
|
12363
12537
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -12491,9 +12665,9 @@ async function handleScanReach({
|
|
|
12491
12665
|
});
|
|
12492
12666
|
}
|
|
12493
12667
|
|
|
12494
|
-
const CMD_NAME$
|
|
12495
|
-
const description$
|
|
12496
|
-
const hidden$
|
|
12668
|
+
const CMD_NAME$4 = 'reach';
|
|
12669
|
+
const description$6 = 'Compute tier 1 reachability';
|
|
12670
|
+
const hidden$4 = true;
|
|
12497
12671
|
const generalFlags = {
|
|
12498
12672
|
...flags.commonFlags,
|
|
12499
12673
|
...flags.outputFlags,
|
|
@@ -12509,17 +12683,17 @@ const generalFlags = {
|
|
|
12509
12683
|
}
|
|
12510
12684
|
};
|
|
12511
12685
|
const cmdScanReach = {
|
|
12512
|
-
description: description$
|
|
12513
|
-
hidden: hidden$
|
|
12514
|
-
run: run$
|
|
12686
|
+
description: description$6,
|
|
12687
|
+
hidden: hidden$4,
|
|
12688
|
+
run: run$7
|
|
12515
12689
|
};
|
|
12516
|
-
async function run$
|
|
12690
|
+
async function run$7(argv, importMeta, {
|
|
12517
12691
|
parentName
|
|
12518
12692
|
}) {
|
|
12519
12693
|
const config = {
|
|
12520
|
-
commandName: CMD_NAME$
|
|
12521
|
-
description: description$
|
|
12522
|
-
hidden: hidden$
|
|
12694
|
+
commandName: CMD_NAME$4,
|
|
12695
|
+
description: description$6,
|
|
12696
|
+
hidden: hidden$4,
|
|
12523
12697
|
flags: {
|
|
12524
12698
|
...generalFlags,
|
|
12525
12699
|
...reachabilityFlags
|
|
@@ -12529,7 +12703,7 @@ async function run$6(argv, importMeta, {
|
|
|
12529
12703
|
$ ${command} [options] [CWD=.]
|
|
12530
12704
|
|
|
12531
12705
|
API Token Requirements
|
|
12532
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
12706
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$4}`)}
|
|
12533
12707
|
|
|
12534
12708
|
Options
|
|
12535
12709
|
${utils.getFlagListOutput(generalFlags)}
|
|
@@ -12637,21 +12811,21 @@ async function run$6(argv, importMeta, {
|
|
|
12637
12811
|
});
|
|
12638
12812
|
}
|
|
12639
12813
|
|
|
12640
|
-
const CMD_NAME$
|
|
12641
|
-
const description$
|
|
12642
|
-
const hidden$
|
|
12814
|
+
const CMD_NAME$3 = 'report';
|
|
12815
|
+
const description$5 = 'Check whether a scan result passes the organizational policies (security, license)';
|
|
12816
|
+
const hidden$3 = false;
|
|
12643
12817
|
const cmdScanReport = {
|
|
12644
|
-
description: description$
|
|
12645
|
-
hidden: hidden$
|
|
12646
|
-
run: run$
|
|
12818
|
+
description: description$5,
|
|
12819
|
+
hidden: hidden$3,
|
|
12820
|
+
run: run$6
|
|
12647
12821
|
};
|
|
12648
|
-
async function run$
|
|
12822
|
+
async function run$6(argv, importMeta, {
|
|
12649
12823
|
parentName
|
|
12650
12824
|
}) {
|
|
12651
12825
|
const config = {
|
|
12652
|
-
commandName: CMD_NAME$
|
|
12653
|
-
description: description$
|
|
12654
|
-
hidden: hidden$
|
|
12826
|
+
commandName: CMD_NAME$3,
|
|
12827
|
+
description: description$5,
|
|
12828
|
+
hidden: hidden$3,
|
|
12655
12829
|
flags: {
|
|
12656
12830
|
...flags.commonFlags,
|
|
12657
12831
|
...flags.outputFlags,
|
|
@@ -12690,7 +12864,7 @@ async function run$5(argv, importMeta, {
|
|
|
12690
12864
|
$ ${command} [options] <SCAN_ID> [OUTPUT_PATH]
|
|
12691
12865
|
|
|
12692
12866
|
API Token Requirements
|
|
12693
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
12867
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$3}`)}
|
|
12694
12868
|
|
|
12695
12869
|
Options
|
|
12696
12870
|
${utils.getFlagListOutput(config.flags)}
|
|
@@ -12801,18 +12975,18 @@ async function outputScanConfigResult(result) {
|
|
|
12801
12975
|
}
|
|
12802
12976
|
|
|
12803
12977
|
async function setupScanConfig(cwd, defaultOnReadError = false) {
|
|
12804
|
-
const jsonPath = path.join(cwd,
|
|
12978
|
+
const jsonPath = path.join(cwd, constants.SOCKET_JSON);
|
|
12805
12979
|
if (fs$1.existsSync(jsonPath)) {
|
|
12806
|
-
logger.logger.info(`Found
|
|
12980
|
+
logger.logger.info(`Found ${constants.SOCKET_JSON} at ${jsonPath}`);
|
|
12807
12981
|
} else {
|
|
12808
|
-
logger.logger.info(`No
|
|
12982
|
+
logger.logger.info(`No ${constants.SOCKET_JSON} found at ${cwd}, will generate a new one`);
|
|
12809
12983
|
}
|
|
12810
12984
|
logger.logger.log('');
|
|
12811
12985
|
logger.logger.log('Note: This tool will set up flag and argument defaults for certain');
|
|
12812
12986
|
logger.logger.log(' CLI commands. You can still override them by explicitly');
|
|
12813
12987
|
logger.logger.log(' setting the flag. It is meant to be a convenience tool.');
|
|
12814
12988
|
logger.logger.log('');
|
|
12815
|
-
logger.logger.log(
|
|
12989
|
+
logger.logger.log(`This command will generate a \`${constants.SOCKET_JSON}\` file in the target cwd.`);
|
|
12816
12990
|
logger.logger.log('You can choose to add this file to your repo (handy for collab)');
|
|
12817
12991
|
logger.logger.log('or to add it to the ignored files, or neither. This file is only');
|
|
12818
12992
|
logger.logger.log('used in CLI workflows.');
|
|
@@ -12873,7 +13047,7 @@ async function setupScanConfig(cwd, defaultOnReadError = false) {
|
|
|
12873
13047
|
}
|
|
12874
13048
|
}
|
|
12875
13049
|
logger.logger.log('');
|
|
12876
|
-
logger.logger.log(
|
|
13050
|
+
logger.logger.log(`Setup complete. Writing ${constants.SOCKET_JSON}`);
|
|
12877
13051
|
logger.logger.log('');
|
|
12878
13052
|
if (await prompts.select({
|
|
12879
13053
|
message: `Do you want to write the new config to ${jsonPath} ?`,
|
|
@@ -13089,7 +13263,7 @@ const config$2 = {
|
|
|
13089
13263
|
...flags.commonFlags,
|
|
13090
13264
|
defaultOnReadError: {
|
|
13091
13265
|
type: 'boolean',
|
|
13092
|
-
description:
|
|
13266
|
+
description: `If reading the ${constants.SOCKET_JSON} fails, just use a default config? Warning: This might override the existing json file!`
|
|
13093
13267
|
}
|
|
13094
13268
|
},
|
|
13095
13269
|
help: (command, config) => `
|
|
@@ -13119,9 +13293,9 @@ const config$2 = {
|
|
|
13119
13293
|
const cmdScanSetup = {
|
|
13120
13294
|
description: config$2.description,
|
|
13121
13295
|
hidden: config$2.hidden,
|
|
13122
|
-
run: run$
|
|
13296
|
+
run: run$5
|
|
13123
13297
|
};
|
|
13124
|
-
async function run$
|
|
13298
|
+
async function run$5(argv, importMeta, {
|
|
13125
13299
|
parentName
|
|
13126
13300
|
}) {
|
|
13127
13301
|
const cli = utils.meowOrExit({
|
|
@@ -13165,7 +13339,7 @@ async function fetchScan(orgSlug, scanId) {
|
|
|
13165
13339
|
error: e,
|
|
13166
13340
|
line
|
|
13167
13341
|
});
|
|
13168
|
-
return
|
|
13342
|
+
return undefined;
|
|
13169
13343
|
}
|
|
13170
13344
|
});
|
|
13171
13345
|
if (ok) {
|
|
@@ -13277,21 +13451,21 @@ async function streamScan(orgSlug, scanId, options) {
|
|
|
13277
13451
|
});
|
|
13278
13452
|
}
|
|
13279
13453
|
|
|
13280
|
-
const CMD_NAME$
|
|
13281
|
-
const description$
|
|
13282
|
-
const hidden$
|
|
13454
|
+
const CMD_NAME$2 = 'view';
|
|
13455
|
+
const description$4 = 'View the raw results of a scan';
|
|
13456
|
+
const hidden$2 = false;
|
|
13283
13457
|
const cmdScanView = {
|
|
13284
|
-
description: description$
|
|
13285
|
-
hidden: hidden$
|
|
13286
|
-
run: run$
|
|
13458
|
+
description: description$4,
|
|
13459
|
+
hidden: hidden$2,
|
|
13460
|
+
run: run$4
|
|
13287
13461
|
};
|
|
13288
|
-
async function run$
|
|
13462
|
+
async function run$4(argv, importMeta, {
|
|
13289
13463
|
parentName
|
|
13290
13464
|
}) {
|
|
13291
13465
|
const config = {
|
|
13292
|
-
commandName: CMD_NAME$
|
|
13293
|
-
description: description$
|
|
13294
|
-
hidden: hidden$
|
|
13466
|
+
commandName: CMD_NAME$2,
|
|
13467
|
+
description: description$4,
|
|
13468
|
+
hidden: hidden$2,
|
|
13295
13469
|
flags: {
|
|
13296
13470
|
...flags.commonFlags,
|
|
13297
13471
|
...flags.outputFlags,
|
|
@@ -13315,7 +13489,7 @@ async function run$3(argv, importMeta, {
|
|
|
13315
13489
|
$ ${command} [options] <SCAN_ID> [OUTPUT_FILE]
|
|
13316
13490
|
|
|
13317
13491
|
API Token Requirements
|
|
13318
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$
|
|
13492
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$2}`)}
|
|
13319
13493
|
|
|
13320
13494
|
When no output path is given the contents is sent to stdout.
|
|
13321
13495
|
|
|
@@ -13388,9 +13562,9 @@ async function run$3(argv, importMeta, {
|
|
|
13388
13562
|
}
|
|
13389
13563
|
}
|
|
13390
13564
|
|
|
13391
|
-
const description$
|
|
13565
|
+
const description$3 = 'Manage Socket scans';
|
|
13392
13566
|
const cmdScan = {
|
|
13393
|
-
description: description$
|
|
13567
|
+
description: description$3,
|
|
13394
13568
|
async run(argv, importMeta, {
|
|
13395
13569
|
parentName
|
|
13396
13570
|
}) {
|
|
@@ -13419,7 +13593,7 @@ const cmdScan = {
|
|
|
13419
13593
|
}
|
|
13420
13594
|
},
|
|
13421
13595
|
argv,
|
|
13422
|
-
description: description$
|
|
13596
|
+
description: description$3,
|
|
13423
13597
|
importMeta,
|
|
13424
13598
|
name: `${parentName} scan`
|
|
13425
13599
|
});
|
|
@@ -13440,7 +13614,7 @@ async function fetchThreatFeed({
|
|
|
13440
13614
|
return await utils.queryApiSafeJson(`orgs/${orgSlug}/threat-feed?${queryParams}`, 'the Threat Feed data');
|
|
13441
13615
|
}
|
|
13442
13616
|
|
|
13443
|
-
const require$
|
|
13617
|
+
const require$2 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
13444
13618
|
async function outputThreatFeed(result, outputKind) {
|
|
13445
13619
|
if (!result.ok) {
|
|
13446
13620
|
process.exitCode = result.code ?? 1;
|
|
@@ -13454,14 +13628,14 @@ async function outputThreatFeed(result, outputKind) {
|
|
|
13454
13628
|
return;
|
|
13455
13629
|
}
|
|
13456
13630
|
if (!result.data?.results?.length) {
|
|
13457
|
-
logger.logger.warn('Did not receive any data to display
|
|
13631
|
+
logger.logger.warn('Did not receive any data to display.');
|
|
13458
13632
|
return;
|
|
13459
13633
|
}
|
|
13460
13634
|
const formattedOutput = formatResults(result.data.results);
|
|
13461
13635
|
const descriptions = result.data.results.map(d => d.description);
|
|
13462
13636
|
|
|
13463
13637
|
// Note: this temporarily takes over the terminal (just like `man` does).
|
|
13464
|
-
const ScreenWidget = /*@__PURE__*/require$
|
|
13638
|
+
const ScreenWidget = /*@__PURE__*/require$2('../external/blessed/lib/widgets/screen.js');
|
|
13465
13639
|
const screen = new ScreenWidget({
|
|
13466
13640
|
...constants.default.blessedOptions
|
|
13467
13641
|
});
|
|
@@ -13470,7 +13644,7 @@ async function outputThreatFeed(result, outputKind) {
|
|
|
13470
13644
|
// node process just to exit it. That's very bad UX.
|
|
13471
13645
|
// eslint-disable-next-line n/no-process-exit
|
|
13472
13646
|
screen.key(['escape', 'q', 'C-c'], () => process.exit(0));
|
|
13473
|
-
const TableWidget = /*@__PURE__*/require$
|
|
13647
|
+
const TableWidget = /*@__PURE__*/require$2('../external/blessed-contrib/lib/widget/table.js');
|
|
13474
13648
|
const detailsBoxHeight = 20; // bottom N rows for details box
|
|
13475
13649
|
const tipsBoxHeight = 1; // 1 row for tips box
|
|
13476
13650
|
|
|
@@ -13494,7 +13668,7 @@ async function outputThreatFeed(result, outputKind) {
|
|
|
13494
13668
|
columnSpacing: 1,
|
|
13495
13669
|
truncate: '_'
|
|
13496
13670
|
});
|
|
13497
|
-
const BoxWidget = /*@__PURE__*/require$
|
|
13671
|
+
const BoxWidget = /*@__PURE__*/require$2('../external/blessed/lib/widgets/box.js');
|
|
13498
13672
|
const tipsBox = new BoxWidget({
|
|
13499
13673
|
bottom: detailsBoxHeight,
|
|
13500
13674
|
// sits just above the details box
|
|
@@ -13601,23 +13775,23 @@ async function handleThreatFeed({
|
|
|
13601
13775
|
await outputThreatFeed(data, outputKind);
|
|
13602
13776
|
}
|
|
13603
13777
|
|
|
13604
|
-
const CMD_NAME = 'threat-feed';
|
|
13778
|
+
const CMD_NAME$1 = 'threat-feed';
|
|
13605
13779
|
const ECOSYSTEMS = new Set(['gem', 'golang', 'maven', constants.NPM, 'nuget', 'pypi']);
|
|
13606
13780
|
const TYPE_FILTERS = new Set(['anom', 'c', 'fp', 'joke', 'mal', 'secret', 'spy', 'tp', 'typo', 'u', 'vuln']);
|
|
13607
|
-
const description$
|
|
13608
|
-
const hidden = false;
|
|
13781
|
+
const description$2 = '[Beta] View the threat-feed';
|
|
13782
|
+
const hidden$1 = false;
|
|
13609
13783
|
const cmdThreatFeed = {
|
|
13610
|
-
description: description$
|
|
13611
|
-
hidden,
|
|
13612
|
-
run: run$
|
|
13784
|
+
description: description$2,
|
|
13785
|
+
hidden: hidden$1,
|
|
13786
|
+
run: run$3
|
|
13613
13787
|
};
|
|
13614
|
-
async function run$
|
|
13788
|
+
async function run$3(argv, importMeta, {
|
|
13615
13789
|
parentName
|
|
13616
13790
|
}) {
|
|
13617
13791
|
const config = {
|
|
13618
|
-
commandName: CMD_NAME,
|
|
13619
|
-
description: description$
|
|
13620
|
-
hidden,
|
|
13792
|
+
commandName: CMD_NAME$1,
|
|
13793
|
+
description: description$2,
|
|
13794
|
+
hidden: hidden$1,
|
|
13621
13795
|
flags: {
|
|
13622
13796
|
...flags.commonFlags,
|
|
13623
13797
|
...flags.outputFlags,
|
|
@@ -13672,7 +13846,7 @@ async function run$2(argv, importMeta, {
|
|
|
13672
13846
|
$ ${command} [options] [ECOSYSTEM] [TYPE_FILTER]
|
|
13673
13847
|
|
|
13674
13848
|
API Token Requirements
|
|
13675
|
-
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME}`)}
|
|
13849
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME$1}`)}
|
|
13676
13850
|
- Special access
|
|
13677
13851
|
|
|
13678
13852
|
This feature requires a Threat Feed license. Please contact
|
|
@@ -13938,9 +14112,9 @@ const config$1 = {
|
|
|
13938
14112
|
const cmdUninstallCompletion = {
|
|
13939
14113
|
description: config$1.description,
|
|
13940
14114
|
hidden: config$1.hidden,
|
|
13941
|
-
run: run$
|
|
14115
|
+
run: run$2
|
|
13942
14116
|
};
|
|
13943
|
-
async function run$
|
|
14117
|
+
async function run$2(argv, importMeta, {
|
|
13944
14118
|
parentName
|
|
13945
14119
|
}) {
|
|
13946
14120
|
const cli = utils.meowOrExit({
|
|
@@ -13958,9 +14132,9 @@ async function run$1(argv, importMeta, {
|
|
|
13958
14132
|
await handleUninstallCompletion(String(targetName));
|
|
13959
14133
|
}
|
|
13960
14134
|
|
|
13961
|
-
const description = 'Uninstall Socket CLI tab completion';
|
|
14135
|
+
const description$1 = 'Uninstall Socket CLI tab completion';
|
|
13962
14136
|
const cmdUninstall = {
|
|
13963
|
-
description,
|
|
14137
|
+
description: description$1,
|
|
13964
14138
|
hidden: false,
|
|
13965
14139
|
async run(argv, importMeta, {
|
|
13966
14140
|
parentName
|
|
@@ -13969,7 +14143,7 @@ const cmdUninstall = {
|
|
|
13969
14143
|
completion: cmdUninstallCompletion
|
|
13970
14144
|
}, {
|
|
13971
14145
|
argv,
|
|
13972
|
-
description,
|
|
14146
|
+
description: description$1,
|
|
13973
14147
|
importMeta,
|
|
13974
14148
|
name: `${parentName} uninstall`
|
|
13975
14149
|
});
|
|
@@ -14134,9 +14308,9 @@ const config = {
|
|
|
14134
14308
|
const cmdWrapper = {
|
|
14135
14309
|
description: config.description,
|
|
14136
14310
|
hidden: config.hidden,
|
|
14137
|
-
run
|
|
14311
|
+
run: run$1
|
|
14138
14312
|
};
|
|
14139
|
-
async function run(argv, importMeta, {
|
|
14313
|
+
async function run$1(argv, importMeta, {
|
|
14140
14314
|
parentName
|
|
14141
14315
|
}) {
|
|
14142
14316
|
// I don't think meow would mess with this but ...
|
|
@@ -14209,6 +14383,71 @@ async function run(argv, importMeta, {
|
|
|
14209
14383
|
}
|
|
14210
14384
|
}
|
|
14211
14385
|
|
|
14386
|
+
const require$1 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
14387
|
+
const CMD_NAME = constants.YARN;
|
|
14388
|
+
const description = 'Run yarn with the Socket wrapper';
|
|
14389
|
+
const hidden = true;
|
|
14390
|
+
const cmdYarn = {
|
|
14391
|
+
description,
|
|
14392
|
+
hidden,
|
|
14393
|
+
run
|
|
14394
|
+
};
|
|
14395
|
+
async function run(argv, importMeta, context) {
|
|
14396
|
+
const {
|
|
14397
|
+
parentName
|
|
14398
|
+
} = {
|
|
14399
|
+
__proto__: null,
|
|
14400
|
+
...context
|
|
14401
|
+
};
|
|
14402
|
+
const config = {
|
|
14403
|
+
commandName: CMD_NAME,
|
|
14404
|
+
description,
|
|
14405
|
+
hidden,
|
|
14406
|
+
flags: {
|
|
14407
|
+
...flags.commonFlags
|
|
14408
|
+
},
|
|
14409
|
+
help: command => `
|
|
14410
|
+
Usage
|
|
14411
|
+
$ ${command} ...
|
|
14412
|
+
|
|
14413
|
+
API Token Requirements
|
|
14414
|
+
${utils.getFlagApiRequirementsOutput(`${parentName}:${CMD_NAME}`)}
|
|
14415
|
+
|
|
14416
|
+
Note: Everything after "yarn" is passed to the yarn command.
|
|
14417
|
+
Only the \`--dry-run\` and \`--help\` flags are caught here.
|
|
14418
|
+
|
|
14419
|
+
Use \`socket wrapper on\` to alias this command as \`yarn\`.
|
|
14420
|
+
|
|
14421
|
+
Examples
|
|
14422
|
+
$ ${command}
|
|
14423
|
+
$ ${command} install
|
|
14424
|
+
$ ${command} add package-name
|
|
14425
|
+
$ ${command} dlx package-name
|
|
14426
|
+
`
|
|
14427
|
+
};
|
|
14428
|
+
const cli = utils.meowOrExit({
|
|
14429
|
+
argv,
|
|
14430
|
+
config,
|
|
14431
|
+
importMeta,
|
|
14432
|
+
parentName
|
|
14433
|
+
});
|
|
14434
|
+
const dryRun = !!cli.flags['dryRun'];
|
|
14435
|
+
if (dryRun) {
|
|
14436
|
+
logger.logger.log(constants.default.DRY_RUN_BAILING_NOW);
|
|
14437
|
+
return;
|
|
14438
|
+
}
|
|
14439
|
+
const shadowBin = /*@__PURE__*/require$1(constants.default.shadowYarnBinPath);
|
|
14440
|
+
process.exitCode = 1;
|
|
14441
|
+
|
|
14442
|
+
// Filter Socket flags from argv.
|
|
14443
|
+
const filteredArgv = utils.filterFlags(argv, config.flags);
|
|
14444
|
+
const {
|
|
14445
|
+
spawnPromise
|
|
14446
|
+
} = await shadowBin(filteredArgv);
|
|
14447
|
+
await spawnPromise;
|
|
14448
|
+
process.exitCode = 0;
|
|
14449
|
+
}
|
|
14450
|
+
|
|
14212
14451
|
const rootCommands = {
|
|
14213
14452
|
analytics: cmdAnalytics,
|
|
14214
14453
|
'audit-log': cmdAuditLog,
|
|
@@ -14225,6 +14464,7 @@ const rootCommands = {
|
|
|
14225
14464
|
manifest: cmdManifest,
|
|
14226
14465
|
npm: cmdNpm,
|
|
14227
14466
|
npx: cmdNpx,
|
|
14467
|
+
pnpm: cmdPnpm,
|
|
14228
14468
|
oops: cmdOops,
|
|
14229
14469
|
optimize: cmdOptimize,
|
|
14230
14470
|
organization: cmdOrganization,
|
|
@@ -14237,7 +14477,8 @@ const rootCommands = {
|
|
|
14237
14477
|
security: cmdOrganizationPolicySecurity,
|
|
14238
14478
|
'threat-feed': cmdThreatFeed,
|
|
14239
14479
|
uninstall: cmdUninstall,
|
|
14240
|
-
wrapper: cmdWrapper
|
|
14480
|
+
wrapper: cmdWrapper,
|
|
14481
|
+
yarn: cmdYarn
|
|
14241
14482
|
};
|
|
14242
14483
|
const rootAliases = {
|
|
14243
14484
|
audit: {
|
|
@@ -14317,7 +14558,7 @@ const rootAliases = {
|
|
|
14317
14558
|
}
|
|
14318
14559
|
};
|
|
14319
14560
|
|
|
14320
|
-
const __filename$1 = require$$0.fileURLToPath(
|
|
14561
|
+
const __filename$1 = require$$0.fileURLToPath((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
14321
14562
|
void (async () => {
|
|
14322
14563
|
const registryUrl = vendor.registryUrl();
|
|
14323
14564
|
await vendor.updater({
|
|
@@ -14327,7 +14568,11 @@ void (async () => {
|
|
|
14327
14568
|
name: constants.default.SOCKET_CLI_BIN_NAME,
|
|
14328
14569
|
registryUrl,
|
|
14329
14570
|
ttl: 86_400_000 /* 24 hours in milliseconds */,
|
|
14330
|
-
version: constants.default.ENV.INLINED_SOCKET_CLI_VERSION
|
|
14571
|
+
version: constants.default.ENV.INLINED_SOCKET_CLI_VERSION,
|
|
14572
|
+
logCallback: (name, version, latest) => {
|
|
14573
|
+
logger.logger.log(`\n\nš¦ Update available for ${vendor.yoctocolorsCjsExports.cyan(name)}: ${vendor.yoctocolorsCjsExports.gray(version)} ā ${vendor.yoctocolorsCjsExports.green(latest)}`);
|
|
14574
|
+
logger.logger.log(`š ${vendor.terminalLinkExports('View changelog', `https://socket.dev/npm/package/${name}/files/${latest}/CHANGELOG.md`)}`);
|
|
14575
|
+
}
|
|
14331
14576
|
});
|
|
14332
14577
|
try {
|
|
14333
14578
|
await utils.meowWithSubcommands(rootCommands, {
|
|
@@ -14395,5 +14640,5 @@ void (async () => {
|
|
|
14395
14640
|
await utils.captureException(e);
|
|
14396
14641
|
}
|
|
14397
14642
|
})();
|
|
14398
|
-
//# debugId=
|
|
14643
|
+
//# debugId=daab38d0-ec51-45c9-a27a-928a16433b42
|
|
14399
14644
|
//# sourceMappingURL=cli.js.map
|