@socketsecurity/cli-with-sentry 1.1.6 → 1.1.8
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 +9 -4
- 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/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/api.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 +109 -70
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +21 -19
- 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":"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,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAA;AAEhF,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE1E,mEAAmE;AACnE,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AAoChD,wBAAgB,sBAAsB,IAAI,MAAM,CAoB/C;AASD,wBAAgB,uBAAuB,IAAI,MAAM,CAmDhD;AAQD,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"flags.d.mts","sourceRoot":"","sources":["../../src/flags.mts"],"names":[],"mappings":"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":"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,CAAC,CAAA;AAEjD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,KAC5B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAEzB,MAAM,WAAW,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AS,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, {
|
|
@@ -414,7 +409,9 @@ async function handleApiCall(value, options) {
|
|
|
414
409
|
require$$9.debugFn('error', `caught: Socket API request error`);
|
|
415
410
|
}
|
|
416
411
|
require$$9.debugDir('inspect', {
|
|
417
|
-
error: e
|
|
412
|
+
error: e
|
|
413
|
+
});
|
|
414
|
+
require$$9.debugDir('inspect', {
|
|
418
415
|
socketSdkErrorResult
|
|
419
416
|
});
|
|
420
417
|
return socketSdkErrorResult;
|
|
@@ -457,11 +454,15 @@ async function handleApiCallNoSpinner(value, description) {
|
|
|
457
454
|
error: e
|
|
458
455
|
});
|
|
459
456
|
const errStr = e ? String(e).trim() : '';
|
|
460
|
-
const
|
|
457
|
+
const message = 'Socket API returned an error';
|
|
458
|
+
const rawCause = errStr || NO_ERROR_MESSAGE;
|
|
459
|
+
const cause = message !== rawCause ? rawCause : '';
|
|
461
460
|
return {
|
|
462
461
|
ok: false,
|
|
463
|
-
message
|
|
464
|
-
cause
|
|
462
|
+
message,
|
|
463
|
+
...(cause ? {
|
|
464
|
+
cause
|
|
465
|
+
} : {})
|
|
465
466
|
};
|
|
466
467
|
}
|
|
467
468
|
|
|
@@ -529,25 +530,34 @@ async function queryApiSafeText(path, description) {
|
|
|
529
530
|
if (description) {
|
|
530
531
|
spinner.failAndStop(`An error was thrown while requesting ${description}.`);
|
|
531
532
|
}
|
|
532
|
-
const cause = e?.message;
|
|
533
533
|
require$$9.debugFn('error', 'caught: await queryApi() error');
|
|
534
534
|
require$$9.debugDir('inspect', {
|
|
535
535
|
error: e
|
|
536
536
|
});
|
|
537
|
+
const errStr = e ? String(e).trim() : '';
|
|
538
|
+
const message = 'API request failed';
|
|
539
|
+
const rawCause = errStr || NO_ERROR_MESSAGE;
|
|
540
|
+
const cause = message !== rawCause ? rawCause : '';
|
|
537
541
|
return {
|
|
538
542
|
ok: false,
|
|
539
|
-
message
|
|
543
|
+
message,
|
|
540
544
|
...(cause ? {
|
|
541
545
|
cause
|
|
542
546
|
} : {})
|
|
543
547
|
};
|
|
544
548
|
}
|
|
545
549
|
if (!result.ok) {
|
|
546
|
-
const
|
|
550
|
+
const {
|
|
551
|
+
status
|
|
552
|
+
} = result;
|
|
553
|
+
const reason = await getErrorMessageForHttpStatusCode(status);
|
|
547
554
|
return {
|
|
548
555
|
ok: false,
|
|
549
556
|
message: 'Socket API returned an error',
|
|
550
|
-
cause: `${result.statusText}
|
|
557
|
+
cause: `${result.statusText} (reason: ${reason})`,
|
|
558
|
+
data: {
|
|
559
|
+
code: status
|
|
560
|
+
}
|
|
551
561
|
};
|
|
552
562
|
}
|
|
553
563
|
try {
|
|
@@ -563,8 +573,8 @@ async function queryApiSafeText(path, description) {
|
|
|
563
573
|
});
|
|
564
574
|
return {
|
|
565
575
|
ok: false,
|
|
566
|
-
message: 'API
|
|
567
|
-
cause: '
|
|
576
|
+
message: 'API request failed',
|
|
577
|
+
cause: 'Unexpected error reading response text'
|
|
568
578
|
};
|
|
569
579
|
}
|
|
570
580
|
}
|
|
@@ -633,27 +643,33 @@ async function sendApiRequest(path, options) {
|
|
|
633
643
|
if (description) {
|
|
634
644
|
spinner.failAndStop(`An error was thrown while requesting ${description}.`);
|
|
635
645
|
}
|
|
636
|
-
const cause = e?.message;
|
|
637
646
|
require$$9.debugFn('error', `caught: await fetch() ${method} error`);
|
|
638
647
|
require$$9.debugDir('inspect', {
|
|
639
648
|
error: e
|
|
640
649
|
});
|
|
650
|
+
const errStr = e ? String(e).trim() : '';
|
|
651
|
+
const message = 'API request failed';
|
|
652
|
+
const rawCause = errStr || NO_ERROR_MESSAGE;
|
|
653
|
+
const cause = message !== rawCause ? rawCause : '';
|
|
641
654
|
return {
|
|
642
655
|
ok: false,
|
|
643
|
-
message
|
|
656
|
+
message,
|
|
644
657
|
...(cause ? {
|
|
645
658
|
cause
|
|
646
659
|
} : {})
|
|
647
660
|
};
|
|
648
661
|
}
|
|
649
662
|
if (!result.ok) {
|
|
650
|
-
const
|
|
663
|
+
const {
|
|
664
|
+
status
|
|
665
|
+
} = result;
|
|
666
|
+
const reason = await getErrorMessageForHttpStatusCode(status);
|
|
651
667
|
return {
|
|
652
668
|
ok: false,
|
|
653
669
|
message: 'Socket API returned an error',
|
|
654
|
-
cause: `${result.statusText}
|
|
670
|
+
cause: `${result.statusText} (reason: ${reason})`,
|
|
655
671
|
data: {
|
|
656
|
-
code:
|
|
672
|
+
code: status
|
|
657
673
|
}
|
|
658
674
|
};
|
|
659
675
|
}
|
|
@@ -670,8 +686,8 @@ async function sendApiRequest(path, options) {
|
|
|
670
686
|
});
|
|
671
687
|
return {
|
|
672
688
|
ok: false,
|
|
673
|
-
message: 'API
|
|
674
|
-
cause: '
|
|
689
|
+
message: 'API request failed',
|
|
690
|
+
cause: 'Unexpected error parsing response JSON'
|
|
675
691
|
};
|
|
676
692
|
}
|
|
677
693
|
}
|
|
@@ -988,6 +1004,32 @@ function findBestCommandMatch(input, subcommands, aliases) {
|
|
|
988
1004
|
}
|
|
989
1005
|
return bestMatch;
|
|
990
1006
|
}
|
|
1007
|
+
function getAsciiHeader(command, orgFlag) {
|
|
1008
|
+
// Note: In tests we return <redacted> because otherwise snapshots will fail.
|
|
1009
|
+
const {
|
|
1010
|
+
REDACTED
|
|
1011
|
+
} = constants.default;
|
|
1012
|
+
const redacting = constants.default.ENV.VITEST;
|
|
1013
|
+
const cliVersion = redacting ? REDACTED : constants.default.ENV.INLINED_SOCKET_CLI_VERSION_HASH;
|
|
1014
|
+
const nodeVersion = redacting ? REDACTED : process.version;
|
|
1015
|
+
const defaultOrg = getConfigValueOrUndef('defaultOrg');
|
|
1016
|
+
const readOnlyConfig = isReadOnlyConfig() ? '*' : '.';
|
|
1017
|
+
const shownToken = redacting ? REDACTED : getVisibleTokenPrefix() || '(not set)';
|
|
1018
|
+
const relCwd = redacting ? REDACTED : path$1.normalizePath(tildify(process.cwd()));
|
|
1019
|
+
// Note: we must redact org when creating snapshots because dev machine probably
|
|
1020
|
+
// has a default org set but CI won't. Showing --org is fine either way.
|
|
1021
|
+
const orgPart = orgFlag ? `--org: ${orgFlag}` : redacting ? 'org: <redacted>' : defaultOrg ? `default org: ${defaultOrg}` : '(org not set)';
|
|
1022
|
+
// Note: We could draw these with ascii box art instead but I worry about
|
|
1023
|
+
// portability and paste-ability. "simple" ascii chars just work.
|
|
1024
|
+
const body = `
|
|
1025
|
+
_____ _ _ /---------------
|
|
1026
|
+
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver ${cliVersion}
|
|
1027
|
+
|__ | ${readOnlyConfig} | _| '_| -_| _| | Node: ${nodeVersion}, API token: ${shownToken}, ${orgPart}
|
|
1028
|
+
|_____|___|___|_,_|___|_|.dev | Command: \`${command}\`, cwd: ${relCwd}
|
|
1029
|
+
`.trim();
|
|
1030
|
+
// Note: logger will auto-append a newline.
|
|
1031
|
+
return ` ${body}`;
|
|
1032
|
+
}
|
|
991
1033
|
|
|
992
1034
|
/**
|
|
993
1035
|
* Calculate Levenshtein distance between two strings for fuzzy matching.
|
|
@@ -1018,6 +1060,17 @@ function levenshteinDistance(a, b) {
|
|
|
1018
1060
|
function shouldSuppressBanner(flags) {
|
|
1019
1061
|
return Boolean(flags['json'] || flags['markdown'] || flags['nobanner']);
|
|
1020
1062
|
}
|
|
1063
|
+
function emitBanner(name, orgFlag) {
|
|
1064
|
+
// Print a banner at the top of each command.
|
|
1065
|
+
// This helps with brand recognition and marketing.
|
|
1066
|
+
// It also helps with debugging since it contains version and command details.
|
|
1067
|
+
// Note: print over stderr to preserve stdout for flags like --json and
|
|
1068
|
+
// --markdown. If we don't do this, you can't use --json in particular
|
|
1069
|
+
// and pipe the result to other tools. By emitting the banner over stderr
|
|
1070
|
+
// you can do something like `socket scan view xyz | jq | process`.
|
|
1071
|
+
// The spinner also emits over stderr for example.
|
|
1072
|
+
logger.logger.error(getAsciiHeader(name, orgFlag));
|
|
1073
|
+
}
|
|
1021
1074
|
async function meowWithSubcommands(subcommands, options) {
|
|
1022
1075
|
const {
|
|
1023
1076
|
aliases = {},
|
|
@@ -1114,8 +1167,14 @@ async function meowWithSubcommands(subcommands, options) {
|
|
|
1114
1167
|
// We want to detect whether a bool flag is given at all.
|
|
1115
1168
|
booleanDefault: undefined
|
|
1116
1169
|
});
|
|
1170
|
+
const noSpinner = cli1.flags['spinner'] === false;
|
|
1117
1171
|
const orgFlag = String(cli1.flags['org'] || '') || undefined;
|
|
1118
1172
|
|
|
1173
|
+
// Use CI spinner style when --no-spinner is passed.
|
|
1174
|
+
if (noSpinner) {
|
|
1175
|
+
constants.default.spinner.spinner = spinner.getCliSpinners('ci');
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1119
1178
|
// Hard override the config if instructed to do so.
|
|
1120
1179
|
// The env var overrides the --flag, which overrides the persisted config
|
|
1121
1180
|
// Also, when either of these are used, config updates won't persist.
|
|
@@ -1227,7 +1286,14 @@ async function meowWithSubcommands(subcommands, options) {
|
|
|
1227
1286
|
} else {
|
|
1228
1287
|
lines.push('');
|
|
1229
1288
|
}
|
|
1230
|
-
lines.push(` ${getFlagListOutput(
|
|
1289
|
+
lines.push(` ${getFlagListOutput({
|
|
1290
|
+
...flags$1,
|
|
1291
|
+
// Explicitly document the negated --no-spinner variant.
|
|
1292
|
+
noSpinner: {
|
|
1293
|
+
...flags$1['spinner'],
|
|
1294
|
+
hidden: false
|
|
1295
|
+
}
|
|
1296
|
+
}, {
|
|
1231
1297
|
indent: HELP_INDENT,
|
|
1232
1298
|
padName: HELP_PAD_NAME
|
|
1233
1299
|
})}`);
|
|
@@ -1295,6 +1361,12 @@ function meowOrExit({
|
|
|
1295
1361
|
help: strings.trimNewlines(config.help(command, config)),
|
|
1296
1362
|
importMeta
|
|
1297
1363
|
});
|
|
1364
|
+
const noSpinner = cli.flags['spinner'] === false;
|
|
1365
|
+
|
|
1366
|
+
// Use CI spinner style when --no-spinner is passed.
|
|
1367
|
+
if (noSpinner) {
|
|
1368
|
+
constants.default.spinner.spinner = spinner.getCliSpinners('ci');
|
|
1369
|
+
}
|
|
1298
1370
|
if (!shouldSuppressBanner(cli.flags)) {
|
|
1299
1371
|
const orgFlag = String(cli.flags['org'] || '').trim() || undefined;
|
|
1300
1372
|
emitBanner(command, orgFlag);
|
|
@@ -1355,43 +1427,6 @@ function meowOrExit({
|
|
|
1355
1427
|
process.exitCode = 0;
|
|
1356
1428
|
return cli;
|
|
1357
1429
|
}
|
|
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
1430
|
|
|
1396
1431
|
function msAtHome(isoTimeStamp) {
|
|
1397
1432
|
const timeStart = Date.parse(isoTimeStamp);
|
|
@@ -2606,6 +2641,10 @@ async function spawnCoana(args, orgSlug, options, extra) {
|
|
|
2606
2641
|
mixinsEnv['SOCKET_ORG_SLUG'] = orgSlugCResult.data;
|
|
2607
2642
|
}
|
|
2608
2643
|
}
|
|
2644
|
+
const proxyUrl = getDefaultProxyUrl();
|
|
2645
|
+
if (proxyUrl) {
|
|
2646
|
+
mixinsEnv['SOCKET_CLI_API_PROXY'] = proxyUrl;
|
|
2647
|
+
}
|
|
2609
2648
|
try {
|
|
2610
2649
|
const {
|
|
2611
2650
|
spawnPromise
|
|
@@ -4099,5 +4138,5 @@ exports.toFilterConfig = toFilterConfig;
|
|
|
4099
4138
|
exports.updateConfigValue = updateConfigValue;
|
|
4100
4139
|
exports.walkNestedMap = walkNestedMap;
|
|
4101
4140
|
exports.writeSocketJson = writeSocketJson;
|
|
4102
|
-
//# debugId=
|
|
4141
|
+
//# debugId=737faea9-c80e-4b25-92fc-cf5802905b27
|
|
4103
4142
|
//# sourceMappingURL=utils.js.map
|