@socketsecurity/cli-with-sentry 1.1.5 → 1.1.7
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 +13 -0
- package/README.md +9 -0
- package/dist/cli.js +11 -6
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +4 -4
- package/dist/constants.js.map +1 -1
- package/dist/flags.js +22 -15
- package/dist/flags.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- 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/flags.d.mts.map +1 -1
- package/dist/types/utils/coana.d.mts.map +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
- package/dist/types/utils/sdk.d.mts +4 -0
- package/dist/types/utils/sdk.d.mts.map +1 -1
- package/dist/utils.js +71 -53
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +15 -10
- package/external/@socketsecurity/registry/external/@socketregistry/yocto-spinner.js +46 -11
- package/external/@socketsecurity/registry/external/cacache.js +1 -1
- package/external/@socketsecurity/registry/external/libnpmpack.js +8 -8
- package/external/@socketsecurity/registry/external/make-fetch-happen.js +7 -7
- package/external/@socketsecurity/registry/external/pacote.js +7 -7
- package/external/@socketsecurity/registry/lib/spinner.js +17 -0
- package/external/@socketsecurity/registry/lib/url.js +19 -0
- package/external/@socketsecurity/registry/manifest.json +2 -2
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coana-fix.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/coana-fix.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coana-fix.d.mts","sourceRoot":"","sources":["../../../../src/commands/fix/coana-fix.mts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAE9C,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC,CA2UtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmd-patch.d.mts","sourceRoot":"","sources":["../../../../src/commands/patch/cmd-patch.mts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,QAAQ,UAAU,CAAA;AAM/B,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA;AAED,iBAAe,GAAG,CAChB,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,UAAU,EAAE,UAAU,EACtB,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"cmd-patch.d.mts","sourceRoot":"","sources":["../../../../src/commands/patch/cmd-patch.mts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,QAAQ,UAAU,CAAA;AAM/B,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA;AAED,iBAAe,GAAG,CAChB,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,UAAU,EAAE,UAAU,EACtB,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,IAAI,CAAC,CA0Ff"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-patch.d.mts","sourceRoot":"","sources":["../../../../src/commands/patch/handle-patch.mts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;
|
|
1
|
+
{"version":3,"file":"handle-patch.d.mts","sourceRoot":"","sources":["../../../../src/commands/patch/handle-patch.mts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAA;AA2SnE,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,UAAU,EAAE,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,wBAAsB,WAAW,CAAC,EAChC,GAAG,EACH,MAAM,EACN,UAAU,EACV,QAAQ,EACR,OAAO,EACR,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2FnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.mts","sourceRoot":"","sources":["../../src/flags.mts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAEhC,4BAA4B;AAC5B,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAA;AAE3D,MAAM,MAAM,WAAW,GACnB,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GACxB,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,CAAA;AAEpC,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAA;AAEhF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,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AgB,sBAAsB,IAAI,MAAM,CAoB/C;AASD,wBAAgB,uBAAuB,IAAI,MAAM,CAmDhD;AAQD,eAAO,MAAM,WAAW,EAAE,SAsDzB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,SAazB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,SAW7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coana.d.mts","sourceRoot":"","sources":["../../../src/utils/coana.mts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAEpE,wBAAgB,8BAA8B,CAC5C,eAAe,EAAE,MAAM,GACtB,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,EACtC,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,GAC7B,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"coana.d.mts","sourceRoot":"","sources":["../../../src/utils/coana.mts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAEpE,wBAAgB,8BAA8B,CAC5C,eAAe,EAAE,MAAM,GACtB,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,EACtC,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,GAC7B,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAgE1B"}
|
|
@@ -31,6 +31,7 @@ export interface MeowOptions extends Options<any> {
|
|
|
31
31
|
// When no sub-command is given, default to this sub-command.
|
|
32
32
|
defaultSub?: string;
|
|
33
33
|
}
|
|
34
|
+
export declare function emitBanner(name: string, orgFlag: string | undefined): void;
|
|
34
35
|
export declare function getLastSeenCommand(): string;
|
|
35
36
|
export declare function meowWithSubcommands(subcommands: Record<string, CliSubcommand>, options: MeowOptions): Promise<void>;
|
|
36
37
|
/**
|
|
@@ -43,5 +44,4 @@ export declare function meowOrExit({ allowUnknownFlags, argv, config, importMeta
|
|
|
43
44
|
parentName: string;
|
|
44
45
|
importMeta: ImportMeta;
|
|
45
46
|
}): Result<MeowFlags>;
|
|
46
|
-
export declare function emitBanner(name: string, orgFlag: string | undefined): void;
|
|
47
47
|
//# sourceMappingURL=meow-with-subcommands.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meow-with-subcommands.d.mts","sourceRoot":"","sources":["../../../src/utils/meow-with-subcommands.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"meow-with-subcommands.d.mts","sourceRoot":"","sources":["../../../src/utils/meow-with-subcommands.mts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,cAAc,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAE3C,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC7B;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ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MAAM,EACN,UAAU,EACV,UAAU,EACX,EAAE;IACD,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACvC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,MAAM,EAAE,gBAAgB,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;CACvB,GAAG,MAAM,CAAC,SAAS,CAAC,CAsFpB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { SocketSdk } from '@socketsecurity/sdk';
|
|
2
2
|
import type { CResult } from '../types.mts';
|
|
3
|
+
// The Socket API server that should be used for operations.
|
|
4
|
+
export declare function getDefaultApiBaseUrl(): string | undefined;
|
|
5
|
+
// The Socket API server that should be used for operations.
|
|
6
|
+
export declare function getDefaultProxyUrl(): string | undefined;
|
|
3
7
|
export declare function getDefaultApiToken(): string | undefined;
|
|
4
8
|
export declare function getPublicApiToken(): string;
|
|
5
9
|
export declare function getVisibleTokenPrefix(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.mts","sourceRoot":"","sources":["../../../src/utils/sdk.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.mts","sourceRoot":"","sources":["../../../src/utils/sdk.mts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAA8B,MAAM,qBAAqB,CAAA;AAK3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAQ3C,4DAA4D;AAC5D,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAIzD;AAED,4DAA4D;AAC5D,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAIvD;AAID,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAavD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAM1C;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAQ9C;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9B,CAAA;AAED,wBAAsB,QAAQ,CAC5B,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,GACpC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CA8C7B"}
|
package/dist/utils.js
CHANGED
|
@@ -9,6 +9,7 @@ var constants = require('./constants.js');
|
|
|
9
9
|
var arrays = require('../external/@socketsecurity/registry/lib/arrays');
|
|
10
10
|
var path$1 = require('../external/@socketsecurity/registry/lib/path');
|
|
11
11
|
var sorts = require('../external/@socketsecurity/registry/lib/sorts');
|
|
12
|
+
var spinner = require('../external/@socketsecurity/registry/lib/spinner');
|
|
12
13
|
var words = require('../external/@socketsecurity/registry/lib/words');
|
|
13
14
|
var Module = require('node:module');
|
|
14
15
|
var path = require('node:path');
|
|
@@ -24,6 +25,7 @@ var npm = require('../external/@socketsecurity/registry/lib/npm');
|
|
|
24
25
|
var globs = require('../external/@socketsecurity/registry/lib/globs');
|
|
25
26
|
var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
26
27
|
var streams = require('../external/@socketsecurity/registry/lib/streams');
|
|
28
|
+
var require$$13 = require('../external/@socketsecurity/registry/lib/url');
|
|
27
29
|
|
|
28
30
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
29
31
|
const sensitiveConfigKeyLookup = new Set(['apiToken']);
|
|
@@ -261,23 +263,13 @@ const TOKEN_VISIBLE_LENGTH = 5;
|
|
|
261
263
|
// The Socket API server that should be used for operations.
|
|
262
264
|
function getDefaultApiBaseUrl$1() {
|
|
263
265
|
const baseUrl = constants.default.ENV.SOCKET_CLI_API_BASE_URL || getConfigValueOrUndef('apiBaseUrl');
|
|
264
|
-
return isUrl(baseUrl) ? baseUrl : undefined;
|
|
266
|
+
return require$$13.isUrl(baseUrl) ? baseUrl : undefined;
|
|
265
267
|
}
|
|
266
268
|
|
|
267
269
|
// The Socket API server that should be used for operations.
|
|
268
270
|
function getDefaultProxyUrl() {
|
|
269
271
|
const apiProxy = constants.default.ENV.SOCKET_CLI_API_PROXY || getConfigValueOrUndef('apiProxy');
|
|
270
|
-
return isUrl(apiProxy) ? apiProxy : undefined;
|
|
271
|
-
}
|
|
272
|
-
function isUrl(value) {
|
|
273
|
-
if (strings.isNonEmptyString(value)) {
|
|
274
|
-
try {
|
|
275
|
-
// eslint-disable-next-line no-new
|
|
276
|
-
new URL(value);
|
|
277
|
-
return true;
|
|
278
|
-
} catch {}
|
|
279
|
-
}
|
|
280
|
-
return false;
|
|
272
|
+
return require$$13.isUrl(apiProxy) ? apiProxy : undefined;
|
|
281
273
|
}
|
|
282
274
|
|
|
283
275
|
// This Socket API token should be stored globally for the duration of the CLI execution.
|
|
@@ -325,13 +317,16 @@ async function setupSdk(options) {
|
|
|
325
317
|
let {
|
|
326
318
|
apiProxy
|
|
327
319
|
} = opts;
|
|
328
|
-
if (!isUrl(apiProxy)) {
|
|
320
|
+
if (!require$$13.isUrl(apiProxy)) {
|
|
329
321
|
apiProxy = getDefaultProxyUrl();
|
|
330
322
|
}
|
|
331
323
|
const {
|
|
332
324
|
apiBaseUrl = getDefaultApiBaseUrl$1()
|
|
333
325
|
} = opts;
|
|
334
|
-
|
|
326
|
+
|
|
327
|
+
// Usage of HttpProxyAgent vs. HttpsProxyAgent based on the chart at:
|
|
328
|
+
// https://github.com/delvedor/hpagent?tab=readme-ov-file#usage
|
|
329
|
+
const ProxyAgent = apiBaseUrl?.startsWith('http:') ? vendor.HttpProxyAgent : vendor.HttpsProxyAgent;
|
|
335
330
|
return {
|
|
336
331
|
ok: true,
|
|
337
332
|
data: new vendor.distExports.SocketSdk(apiToken, {
|
|
@@ -988,6 +983,32 @@ function findBestCommandMatch(input, subcommands, aliases) {
|
|
|
988
983
|
}
|
|
989
984
|
return bestMatch;
|
|
990
985
|
}
|
|
986
|
+
function getAsciiHeader(command, orgFlag) {
|
|
987
|
+
// Note: In tests we return <redacted> because otherwise snapshots will fail.
|
|
988
|
+
const {
|
|
989
|
+
REDACTED
|
|
990
|
+
} = constants.default;
|
|
991
|
+
const redacting = constants.default.ENV.VITEST;
|
|
992
|
+
const cliVersion = redacting ? REDACTED : constants.default.ENV.INLINED_SOCKET_CLI_VERSION_HASH;
|
|
993
|
+
const nodeVersion = redacting ? REDACTED : process.version;
|
|
994
|
+
const defaultOrg = getConfigValueOrUndef('defaultOrg');
|
|
995
|
+
const readOnlyConfig = isReadOnlyConfig() ? '*' : '.';
|
|
996
|
+
const shownToken = redacting ? REDACTED : getVisibleTokenPrefix() || '(not set)';
|
|
997
|
+
const relCwd = redacting ? REDACTED : path$1.normalizePath(tildify(process.cwd()));
|
|
998
|
+
// Note: we must redact org when creating snapshots because dev machine probably
|
|
999
|
+
// has a default org set but CI won't. Showing --org is fine either way.
|
|
1000
|
+
const orgPart = orgFlag ? `--org: ${orgFlag}` : redacting ? 'org: <redacted>' : defaultOrg ? `default org: ${defaultOrg}` : '(org not set)';
|
|
1001
|
+
// Note: We could draw these with ascii box art instead but I worry about
|
|
1002
|
+
// portability and paste-ability. "simple" ascii chars just work.
|
|
1003
|
+
const body = `
|
|
1004
|
+
_____ _ _ /---------------
|
|
1005
|
+
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver ${cliVersion}
|
|
1006
|
+
|__ | ${readOnlyConfig} | _| '_| -_| _| | Node: ${nodeVersion}, API token: ${shownToken}, ${orgPart}
|
|
1007
|
+
|_____|___|___|_,_|___|_|.dev | Command: \`${command}\`, cwd: ${relCwd}
|
|
1008
|
+
`.trim();
|
|
1009
|
+
// Note: logger will auto-append a newline.
|
|
1010
|
+
return ` ${body}`;
|
|
1011
|
+
}
|
|
991
1012
|
|
|
992
1013
|
/**
|
|
993
1014
|
* Calculate Levenshtein distance between two strings for fuzzy matching.
|
|
@@ -1018,6 +1039,17 @@ function levenshteinDistance(a, b) {
|
|
|
1018
1039
|
function shouldSuppressBanner(flags) {
|
|
1019
1040
|
return Boolean(flags['json'] || flags['markdown'] || flags['nobanner']);
|
|
1020
1041
|
}
|
|
1042
|
+
function emitBanner(name, orgFlag) {
|
|
1043
|
+
// Print a banner at the top of each command.
|
|
1044
|
+
// This helps with brand recognition and marketing.
|
|
1045
|
+
// It also helps with debugging since it contains version and command details.
|
|
1046
|
+
// Note: print over stderr to preserve stdout for flags like --json and
|
|
1047
|
+
// --markdown. If we don't do this, you can't use --json in particular
|
|
1048
|
+
// and pipe the result to other tools. By emitting the banner over stderr
|
|
1049
|
+
// you can do something like `socket scan view xyz | jq | process`.
|
|
1050
|
+
// The spinner also emits over stderr for example.
|
|
1051
|
+
logger.logger.error(getAsciiHeader(name, orgFlag));
|
|
1052
|
+
}
|
|
1021
1053
|
async function meowWithSubcommands(subcommands, options) {
|
|
1022
1054
|
const {
|
|
1023
1055
|
aliases = {},
|
|
@@ -1114,8 +1146,14 @@ async function meowWithSubcommands(subcommands, options) {
|
|
|
1114
1146
|
// We want to detect whether a bool flag is given at all.
|
|
1115
1147
|
booleanDefault: undefined
|
|
1116
1148
|
});
|
|
1149
|
+
const noSpinner = cli1.flags['spinner'] === false;
|
|
1117
1150
|
const orgFlag = String(cli1.flags['org'] || '') || undefined;
|
|
1118
1151
|
|
|
1152
|
+
// Use CI spinner style when --no-spinner is passed.
|
|
1153
|
+
if (noSpinner) {
|
|
1154
|
+
constants.default.spinner.spinner = spinner.getCliSpinners('ci');
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1119
1157
|
// Hard override the config if instructed to do so.
|
|
1120
1158
|
// The env var overrides the --flag, which overrides the persisted config
|
|
1121
1159
|
// Also, when either of these are used, config updates won't persist.
|
|
@@ -1227,7 +1265,14 @@ async function meowWithSubcommands(subcommands, options) {
|
|
|
1227
1265
|
} else {
|
|
1228
1266
|
lines.push('');
|
|
1229
1267
|
}
|
|
1230
|
-
lines.push(` ${getFlagListOutput(
|
|
1268
|
+
lines.push(` ${getFlagListOutput({
|
|
1269
|
+
...flags$1,
|
|
1270
|
+
// Explicitly document the negated --no-spinner variant.
|
|
1271
|
+
noSpinner: {
|
|
1272
|
+
...flags$1['spinner'],
|
|
1273
|
+
hidden: false
|
|
1274
|
+
}
|
|
1275
|
+
}, {
|
|
1231
1276
|
indent: HELP_INDENT,
|
|
1232
1277
|
padName: HELP_PAD_NAME
|
|
1233
1278
|
})}`);
|
|
@@ -1295,6 +1340,12 @@ function meowOrExit({
|
|
|
1295
1340
|
help: strings.trimNewlines(config.help(command, config)),
|
|
1296
1341
|
importMeta
|
|
1297
1342
|
});
|
|
1343
|
+
const noSpinner = cli.flags['spinner'] === false;
|
|
1344
|
+
|
|
1345
|
+
// Use CI spinner style when --no-spinner is passed.
|
|
1346
|
+
if (noSpinner) {
|
|
1347
|
+
constants.default.spinner.spinner = spinner.getCliSpinners('ci');
|
|
1348
|
+
}
|
|
1298
1349
|
if (!shouldSuppressBanner(cli.flags)) {
|
|
1299
1350
|
const orgFlag = String(cli.flags['org'] || '').trim() || undefined;
|
|
1300
1351
|
emitBanner(command, orgFlag);
|
|
@@ -1355,43 +1406,6 @@ function meowOrExit({
|
|
|
1355
1406
|
process.exitCode = 0;
|
|
1356
1407
|
return cli;
|
|
1357
1408
|
}
|
|
1358
|
-
function emitBanner(name, orgFlag) {
|
|
1359
|
-
// Print a banner at the top of each command.
|
|
1360
|
-
// This helps with brand recognition and marketing.
|
|
1361
|
-
// It also helps with debugging since it contains version and command details.
|
|
1362
|
-
// Note: print over stderr to preserve stdout for flags like --json and
|
|
1363
|
-
// --markdown. If we don't do this, you can't use --json in particular
|
|
1364
|
-
// and pipe the result to other tools. By emitting the banner over stderr
|
|
1365
|
-
// you can do something like `socket scan view xyz | jq | process`.
|
|
1366
|
-
// The spinner also emits over stderr for example.
|
|
1367
|
-
logger.logger.error(getAsciiHeader(name, orgFlag));
|
|
1368
|
-
}
|
|
1369
|
-
function getAsciiHeader(command, orgFlag) {
|
|
1370
|
-
// Note: In tests we return <redacted> because otherwise snapshots will fail.
|
|
1371
|
-
const {
|
|
1372
|
-
REDACTED
|
|
1373
|
-
} = constants.default;
|
|
1374
|
-
const redacting = constants.default.ENV.VITEST;
|
|
1375
|
-
const cliVersion = redacting ? REDACTED : constants.default.ENV.INLINED_SOCKET_CLI_VERSION_HASH;
|
|
1376
|
-
const nodeVersion = redacting ? REDACTED : process.version;
|
|
1377
|
-
const defaultOrg = getConfigValueOrUndef('defaultOrg');
|
|
1378
|
-
const readOnlyConfig = isReadOnlyConfig() ? '*' : '.';
|
|
1379
|
-
const shownToken = redacting ? REDACTED : getVisibleTokenPrefix() || '(not set)';
|
|
1380
|
-
const relCwd = redacting ? REDACTED : path$1.normalizePath(tildify(process.cwd()));
|
|
1381
|
-
// Note: we must redact org when creating snapshots because dev machine probably
|
|
1382
|
-
// has a default org set but CI won't. Showing --org is fine either way.
|
|
1383
|
-
const orgPart = orgFlag ? `--org: ${orgFlag}` : redacting ? 'org: <redacted>' : defaultOrg ? `default org: ${defaultOrg}` : '(org not set)';
|
|
1384
|
-
// Note: We could draw these with ascii box art instead but I worry about
|
|
1385
|
-
// portability and paste-ability. "simple" ascii chars just work.
|
|
1386
|
-
const body = `
|
|
1387
|
-
_____ _ _ /---------------
|
|
1388
|
-
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver ${cliVersion}
|
|
1389
|
-
|__ | ${readOnlyConfig} | _| '_| -_| _| | Node: ${nodeVersion}, API token: ${shownToken}, ${orgPart}
|
|
1390
|
-
|_____|___|___|_,_|___|_|.dev | Command: \`${command}\`, cwd: ${relCwd}
|
|
1391
|
-
`.trim();
|
|
1392
|
-
// Note: logger will auto-append a newline.
|
|
1393
|
-
return ` ${body}`;
|
|
1394
|
-
}
|
|
1395
1409
|
|
|
1396
1410
|
function msAtHome(isoTimeStamp) {
|
|
1397
1411
|
const timeStart = Date.parse(isoTimeStamp);
|
|
@@ -2606,6 +2620,10 @@ async function spawnCoana(args, orgSlug, options, extra) {
|
|
|
2606
2620
|
mixinsEnv['SOCKET_ORG_SLUG'] = orgSlugCResult.data;
|
|
2607
2621
|
}
|
|
2608
2622
|
}
|
|
2623
|
+
const proxyUrl = getDefaultProxyUrl();
|
|
2624
|
+
if (proxyUrl) {
|
|
2625
|
+
mixinsEnv['SOCKET_CLI_API_PROXY'] = proxyUrl;
|
|
2626
|
+
}
|
|
2609
2627
|
try {
|
|
2610
2628
|
const {
|
|
2611
2629
|
spawnPromise
|
|
@@ -4099,5 +4117,5 @@ exports.toFilterConfig = toFilterConfig;
|
|
|
4099
4117
|
exports.updateConfigValue = updateConfigValue;
|
|
4100
4118
|
exports.walkNestedMap = walkNestedMap;
|
|
4101
4119
|
exports.writeSocketJson = writeSocketJson;
|
|
4102
|
-
//# debugId=
|
|
4120
|
+
//# debugId=91b76231-d3de-41db-ade8-3bf562c0e477
|
|
4103
4121
|
//# sourceMappingURL=utils.js.map
|