workos 0.15.1 → 0.16.0
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/README.md +37 -11
- package/dist/bin.js +1441 -1258
- package/dist/bin.js.map +1 -1
- package/dist/cli.config.d.ts +1 -0
- package/dist/cli.config.js +1 -0
- package/dist/cli.config.js.map +1 -1
- package/dist/commands/api/index.js +7 -2
- package/dist/commands/api/index.js.map +1 -1
- package/dist/commands/api/interactive.js +9 -3
- package/dist/commands/api/interactive.js.map +1 -1
- package/dist/commands/claim.js +1 -1
- package/dist/commands/claim.js.map +1 -1
- package/dist/commands/debug.d.ts +2 -1
- package/dist/commands/debug.js +43 -3
- package/dist/commands/debug.js.map +1 -1
- package/dist/commands/dev.js +10 -4
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.js +13 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/emulate.js +6 -2
- package/dist/commands/emulate.js.map +1 -1
- package/dist/commands/env.js +5 -4
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/install-skill.js +11 -8
- package/dist/commands/install-skill.js.map +1 -1
- package/dist/commands/install.js +2 -2
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/login.js +4 -4
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/migrations.d.ts +1 -1
- package/dist/commands/migrations.js +4 -1
- package/dist/commands/migrations.js.map +1 -1
- package/dist/commands/telemetry.d.ts +3 -0
- package/dist/commands/telemetry.js +88 -0
- package/dist/commands/telemetry.js.map +1 -0
- package/dist/commands/uninstall-skill.js +3 -2
- package/dist/commands/uninstall-skill.js.map +1 -1
- package/dist/commands/vault-run.d.ts +13 -0
- package/dist/commands/vault-run.js +194 -0
- package/dist/commands/vault-run.js.map +1 -0
- package/dist/commands/vault.d.ts +3 -2
- package/dist/commands/vault.js +41 -8
- package/dist/commands/vault.js.map +1 -1
- package/dist/doctor/checks/auth-patterns.js +2 -2
- package/dist/doctor/checks/auth-patterns.js.map +1 -1
- package/dist/doctor/checks/environment.js +1 -1
- package/dist/doctor/checks/environment.js.map +1 -1
- package/dist/lib/api-error-handler.d.ts +15 -3
- package/dist/lib/api-error-handler.js +52 -34
- package/dist/lib/api-error-handler.js.map +1 -1
- package/dist/lib/command-aliases.d.ts +8 -0
- package/dist/lib/command-aliases.js +12 -0
- package/dist/lib/command-aliases.js.map +1 -0
- package/dist/lib/constants.d.ts +0 -1
- package/dist/lib/constants.js +0 -1
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/credential-discovery.js +1 -1
- package/dist/lib/credential-discovery.js.map +1 -1
- package/dist/lib/dev-command.js +8 -1
- package/dist/lib/dev-command.js.map +1 -1
- package/dist/lib/device-id.d.ts +25 -0
- package/dist/lib/device-id.js +102 -0
- package/dist/lib/device-id.js.map +1 -0
- package/dist/lib/preferences.d.ts +101 -0
- package/dist/lib/preferences.js +198 -0
- package/dist/lib/preferences.js.map +1 -0
- package/dist/lib/registry.js +2 -2
- package/dist/lib/registry.js.map +1 -1
- package/dist/lib/run-with-core.js +17 -17
- package/dist/lib/run-with-core.js.map +1 -1
- package/dist/lib/settings.d.ts +6 -0
- package/dist/lib/settings.js +7 -0
- package/dist/lib/settings.js.map +1 -1
- package/dist/lib/telemetry-notice.d.ts +25 -0
- package/dist/lib/telemetry-notice.js +56 -0
- package/dist/lib/telemetry-notice.js.map +1 -0
- package/dist/lib/validation/build-validator.js +6 -1
- package/dist/lib/validation/build-validator.js.map +1 -1
- package/dist/lib/validation/quick-checks.js +2 -0
- package/dist/lib/validation/quick-checks.js.map +1 -1
- package/dist/lib/validation/validator.js +1 -1
- package/dist/lib/validation/validator.js.map +1 -1
- package/dist/steps/run-prettier.js +9 -13
- package/dist/steps/run-prettier.js.map +1 -1
- package/dist/steps/upload-environment-variables/providers/vercel.js +6 -3
- package/dist/steps/upload-environment-variables/providers/vercel.js.map +1 -1
- package/dist/test/force-insecure-storage.d.ts +1 -0
- package/dist/test/force-insecure-storage.js +9 -0
- package/dist/test/force-insecure-storage.js.map +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.js +38 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/utils/analytics.d.ts +41 -0
- package/dist/utils/analytics.js +199 -12
- package/dist/utils/analytics.js.map +1 -1
- package/dist/utils/box.d.ts +29 -1
- package/dist/utils/box.js +92 -4
- package/dist/utils/box.js.map +1 -1
- package/dist/utils/clack-utils.js +22 -4
- package/dist/utils/clack-utils.js.map +1 -1
- package/dist/utils/cli-exit.d.ts +15 -0
- package/dist/utils/cli-exit.js +11 -0
- package/dist/utils/cli-exit.js.map +1 -0
- package/dist/utils/cli-symbols.d.ts +1 -1
- package/dist/utils/command-telemetry.d.ts +17 -0
- package/dist/utils/command-telemetry.js +67 -0
- package/dist/utils/command-telemetry.js.map +1 -0
- package/dist/utils/crash-reporter.d.ts +13 -0
- package/dist/utils/crash-reporter.js +91 -0
- package/dist/utils/crash-reporter.js.map +1 -0
- package/dist/utils/debug.d.ts +1 -0
- package/dist/utils/debug.js +4 -1
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/env-parser.js +1 -1
- package/dist/utils/env-parser.js.map +1 -1
- package/dist/utils/exec-file.js +2 -1
- package/dist/utils/exec-file.js.map +1 -1
- package/dist/utils/exit-codes.d.ts +5 -0
- package/dist/utils/exit-codes.js +30 -1
- package/dist/utils/exit-codes.js.map +1 -1
- package/dist/utils/help-json.d.ts +6 -0
- package/dist/utils/help-json.js +87 -10
- package/dist/utils/help-json.js.map +1 -1
- package/dist/utils/output.d.ts +7 -2
- package/dist/utils/output.js +9 -2
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/platform.js +7 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/telemetry-client.d.ts +30 -2
- package/dist/utils/telemetry-client.js +122 -12
- package/dist/utils/telemetry-client.js.map +1 -1
- package/dist/utils/telemetry-store-forward.d.ts +11 -0
- package/dist/utils/telemetry-store-forward.js +94 -0
- package/dist/utils/telemetry-store-forward.js.map +1 -0
- package/dist/utils/telemetry-types.d.ts +58 -9
- package/dist/utils/telemetry-types.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../../src/utils/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAwB,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"exit-codes.js","sourceRoot":"","sources":["../../src/utils/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAwB,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;CACR,CAAC;AAIX,MAAM,cAAc,GAAuE;IACzF,aAAa,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,CAAC,aAAa,EAAE;IACxE,6EAA6E;IAC7E,sEAAsE;IACtE,UAAU,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,CAAC,aAAa,EAAE;IACrE,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,EAAE;CAC7D,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAI3C,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC;IAC/D,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAmB;IAC5C,IAAI,IAAI,KAAK,QAAQ,CAAC,aAAa;QAAE,OAAO,eAAe,CAAC;IAC5D,IAAI,IAAI,KAAK,QAAQ,CAAC,SAAS;QAAE,OAAO,WAAW,CAAC;IACpD,IAAI,IAAI,KAAK,QAAQ,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,YAAY,CAAC,IAAmB,EAAE,KAAuB;IACvE,IAAI,KAAK,EAAE,CAAC;QACV,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,MAAM,IAAI,OAAO,CAAC,IAAI,EAAE;QACtB,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC;QAC/B,SAAS,EAAE,KAAK,EAAE,IAAI;KACvB,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgB,EAAE,OAAoD;IACzG,MAAM,IAAI,GAAG,kBAAkB,EAAE,CAAC,IAAI,CAAC;IACvC,YAAY,CAAC,QAAQ,CAAC,aAAa,EAAE;QACnC,IAAI,EAAE,eAAe;QACrB,OAAO,EACL,OAAO;YACP,4BAA4B,mBAAmB,CAAC,YAAY,CAAC,uDAAuD;QACtH,QAAQ,EAAE,OAAO,EAAE,QAAQ,IAAI,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC;KAC3D,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Standardized exit codes following gh CLI convention.\n *\n * 0 = Success\n * 1 = General error\n * 2 = Cancelled (e.g., Ctrl+C, user cancelled prompt)\n * 4 = Authentication required\n */\n\nimport { CliExit } from './cli-exit.js';\nimport { outputError, type StructuredError } from './output.js';\nimport { formatWorkOSCommand } from './command-invocation.js';\nimport { authLoginRecovery } from './recovery-hints.js';\nimport { getInteractionMode } from './interaction-mode.js';\nimport type { TerminationReason } from './telemetry-types.js';\n\nexport const ExitCode = {\n SUCCESS: 0,\n GENERAL_ERROR: 1,\n CANCELLED: 2,\n AUTH_REQUIRED: 4,\n} as const;\n\nexport type ExitCodeValue = (typeof ExitCode)[keyof typeof ExitCode];\n\nconst ERROR_CODE_MAP: Record<string, { reason: TerminationReason; exit: ExitCodeValue }> = {\n auth_required: { reason: 'auth_required', exit: ExitCode.AUTH_REQUIRED },\n // resolveApiKey() emits `no_api_key` when no key is configured; semantically\n // an auth failure, so it must not fall through to `validation_error`.\n no_api_key: { reason: 'auth_required', exit: ExitCode.AUTH_REQUIRED },\n cancelled: { reason: 'cancelled', exit: ExitCode.CANCELLED },\n};\n\nexport function resolveErrorCode(code: string): {\n reason: TerminationReason;\n exit: ExitCodeValue;\n} {\n const mapped = ERROR_CODE_MAP[code];\n if (mapped) return mapped;\n if (code.startsWith('http_')) {\n return { reason: 'api_error', exit: ExitCode.GENERAL_ERROR };\n }\n return { reason: 'validation_error', exit: ExitCode.GENERAL_ERROR };\n}\n\nfunction reasonForExitCode(code: ExitCodeValue): TerminationReason {\n if (code === ExitCode.AUTH_REQUIRED) return 'auth_required';\n if (code === ExitCode.CANCELLED) return 'cancelled';\n if (code === ExitCode.SUCCESS) return 'success';\n return 'validation_error';\n}\n\n/** Exit with a specific code, optionally writing a structured error first. */\nexport function exitWithCode(code: ExitCodeValue, error?: StructuredError): never {\n if (error) {\n outputError(error);\n }\n throw new CliExit(code, {\n reason: reasonForExitCode(code),\n errorCode: error?.code,\n });\n}\n\n/**\n * Convenience: exit with code 4 and auth-required error.\n *\n * Recovery hints are inferred from interaction mode unless explicitly provided.\n */\nexport function exitWithAuthRequired(message?: string, options?: { recovery?: StructuredError['recovery'] }): never {\n const mode = getInteractionMode().mode;\n exitWithCode(ExitCode.AUTH_REQUIRED, {\n code: 'auth_required',\n message:\n message ??\n `Not authenticated. Run \\`${formatWorkOSCommand('auth login')}\\` in an interactive terminal, or set WORKOS_API_KEY.`,\n recovery: options?.recovery ?? authLoginRecovery({ mode }),\n });\n}\n"]}
|
|
@@ -49,4 +49,10 @@ export declare function extractHelpJsonCommand(argv: string[]): string | undefin
|
|
|
49
49
|
* @param subcommand - Optional command name to return a subtree for (e.g. "env").
|
|
50
50
|
* Returns full tree if omitted or if command not found.
|
|
51
51
|
*/
|
|
52
|
+
/**
|
|
53
|
+
* Top-level command names (first token of each registered command). Used by
|
|
54
|
+
* telemetry to recognise real commands without trusting arbitrary argv tokens
|
|
55
|
+
* (so option values / secrets are never recorded as a command name).
|
|
56
|
+
*/
|
|
57
|
+
export declare function getTopLevelCommandNames(): string[];
|
|
52
58
|
export declare function buildCommandTree(subcommand?: string): HelpOutput | CommandSchema;
|
package/dist/utils/help-json.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* so we maintain a parallel typed registry.
|
|
7
7
|
*/
|
|
8
8
|
import { getVersion } from '../lib/settings.js';
|
|
9
|
+
import { COMMAND_ALIASES } from '../lib/command-aliases.js';
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
10
11
|
// Shared option fragments (mirrors bin.ts shared option objects)
|
|
11
12
|
// ---------------------------------------------------------------------------
|
|
@@ -68,6 +69,15 @@ const commands = [
|
|
|
68
69
|
description: 'Show current authentication status',
|
|
69
70
|
options: [insecureStorageOpt],
|
|
70
71
|
},
|
|
72
|
+
{
|
|
73
|
+
name: 'telemetry',
|
|
74
|
+
description: 'Manage telemetry collection (opt-out, opt-in, status)',
|
|
75
|
+
commands: [
|
|
76
|
+
{ name: 'opt-out', description: 'Disable telemetry collection (persists across runs)' },
|
|
77
|
+
{ name: 'opt-in', description: 'Re-enable telemetry collection' },
|
|
78
|
+
{ name: 'status', description: 'Show whether telemetry is enabled and why' },
|
|
79
|
+
],
|
|
80
|
+
},
|
|
71
81
|
{
|
|
72
82
|
name: 'skills',
|
|
73
83
|
description: 'Manage WorkOS skills for coding agents (Claude Code, Codex, Cursor, Goose)',
|
|
@@ -969,29 +979,61 @@ const commands = [
|
|
|
969
979
|
{ name: 'list', description: 'List vault objects', options: [...paginationOpts] },
|
|
970
980
|
{
|
|
971
981
|
name: 'get',
|
|
972
|
-
description: 'Get a vault object',
|
|
982
|
+
description: 'Get a vault object (metadata only; use --decrypt to include value)',
|
|
973
983
|
positionals: [{ name: 'id', type: 'string', description: 'Object ID', required: true }],
|
|
984
|
+
options: [
|
|
985
|
+
{
|
|
986
|
+
name: 'decrypt',
|
|
987
|
+
type: 'boolean',
|
|
988
|
+
description: 'Include the decrypted secret value',
|
|
989
|
+
required: false,
|
|
990
|
+
default: false,
|
|
991
|
+
hidden: false,
|
|
992
|
+
},
|
|
993
|
+
],
|
|
974
994
|
},
|
|
975
995
|
{
|
|
976
996
|
name: 'get-by-name',
|
|
977
|
-
description: 'Get a vault object by name',
|
|
997
|
+
description: 'Get a vault object by name (metadata only; use --decrypt to include value)',
|
|
978
998
|
positionals: [{ name: 'name', type: 'string', description: 'Object name', required: true }],
|
|
999
|
+
options: [
|
|
1000
|
+
{
|
|
1001
|
+
name: 'decrypt',
|
|
1002
|
+
type: 'boolean',
|
|
1003
|
+
description: 'Include the decrypted secret value',
|
|
1004
|
+
required: false,
|
|
1005
|
+
default: false,
|
|
1006
|
+
hidden: false,
|
|
1007
|
+
},
|
|
1008
|
+
],
|
|
979
1009
|
},
|
|
980
1010
|
{
|
|
981
1011
|
name: 'create',
|
|
982
|
-
description: 'Create a vault object',
|
|
1012
|
+
description: 'Create a vault object (reads value from stdin when --value is omitted or -)',
|
|
983
1013
|
options: [
|
|
984
1014
|
{ name: 'name', type: 'string', description: 'Object name', required: true, hidden: false },
|
|
985
|
-
{
|
|
986
|
-
|
|
1015
|
+
{
|
|
1016
|
+
name: 'value',
|
|
1017
|
+
type: 'string',
|
|
1018
|
+
description: 'Secret value (omit or use - to read from stdin)',
|
|
1019
|
+
required: false,
|
|
1020
|
+
hidden: false,
|
|
1021
|
+
},
|
|
1022
|
+
{ name: 'org', type: 'string', description: 'Organization ID (required)', required: true, hidden: false },
|
|
987
1023
|
],
|
|
988
1024
|
},
|
|
989
1025
|
{
|
|
990
1026
|
name: 'update',
|
|
991
|
-
description: 'Update a vault object',
|
|
1027
|
+
description: 'Update a vault object (reads value from stdin when --value is omitted or -)',
|
|
992
1028
|
positionals: [{ name: 'id', type: 'string', description: 'Object ID', required: true }],
|
|
993
1029
|
options: [
|
|
994
|
-
{
|
|
1030
|
+
{
|
|
1031
|
+
name: 'value',
|
|
1032
|
+
type: 'string',
|
|
1033
|
+
description: 'New value (omit or use - to read from stdin)',
|
|
1034
|
+
required: false,
|
|
1035
|
+
hidden: false,
|
|
1036
|
+
},
|
|
995
1037
|
{ name: 'version-check', type: 'string', description: 'Version check ID', required: false, hidden: false },
|
|
996
1038
|
],
|
|
997
1039
|
},
|
|
@@ -1010,6 +1052,34 @@ const commands = [
|
|
|
1010
1052
|
description: 'List vault object versions',
|
|
1011
1053
|
positionals: [{ name: 'id', type: 'string', description: 'Object ID', required: true }],
|
|
1012
1054
|
},
|
|
1055
|
+
{
|
|
1056
|
+
name: 'run',
|
|
1057
|
+
description: 'Run a command with Vault secrets injected as environment variables',
|
|
1058
|
+
options: [
|
|
1059
|
+
{
|
|
1060
|
+
name: 'secret',
|
|
1061
|
+
type: 'array',
|
|
1062
|
+
description: 'Map a vault object to an env var: ENV_VAR=vault-name (repeatable)',
|
|
1063
|
+
required: true,
|
|
1064
|
+
hidden: false,
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
name: 'env',
|
|
1068
|
+
type: 'string',
|
|
1069
|
+
description: 'Environment name to read API key from (defaults to active)',
|
|
1070
|
+
required: false,
|
|
1071
|
+
hidden: false,
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
name: 'dry-run',
|
|
1075
|
+
type: 'boolean',
|
|
1076
|
+
description: 'Print which secrets would be injected, no fetch',
|
|
1077
|
+
required: false,
|
|
1078
|
+
default: false,
|
|
1079
|
+
hidden: false,
|
|
1080
|
+
},
|
|
1081
|
+
],
|
|
1082
|
+
},
|
|
1013
1083
|
],
|
|
1014
1084
|
},
|
|
1015
1085
|
{
|
|
@@ -1301,10 +1371,9 @@ const globalOptions = [
|
|
|
1301
1371
|
// ---------------------------------------------------------------------------
|
|
1302
1372
|
// Public API
|
|
1303
1373
|
// ---------------------------------------------------------------------------
|
|
1304
|
-
const commandAliases = { org: 'organization' };
|
|
1305
1374
|
const helpJsonCommandNames = new Set([
|
|
1306
1375
|
...commands.map((command) => command.name.split(' ')[0]),
|
|
1307
|
-
...Object.keys(
|
|
1376
|
+
...Object.keys(COMMAND_ALIASES),
|
|
1308
1377
|
]);
|
|
1309
1378
|
/**
|
|
1310
1379
|
* Extract the requested command from raw argv before yargs parses --help.
|
|
@@ -1323,7 +1392,7 @@ export function extractHelpJsonCommand(argv) {
|
|
|
1323
1392
|
continue;
|
|
1324
1393
|
}
|
|
1325
1394
|
if (!arg.startsWith('-') && helpJsonCommandNames.has(arg)) {
|
|
1326
|
-
return
|
|
1395
|
+
return COMMAND_ALIASES[arg] ?? arg;
|
|
1327
1396
|
}
|
|
1328
1397
|
}
|
|
1329
1398
|
return undefined;
|
|
@@ -1334,6 +1403,14 @@ export function extractHelpJsonCommand(argv) {
|
|
|
1334
1403
|
* @param subcommand - Optional command name to return a subtree for (e.g. "env").
|
|
1335
1404
|
* Returns full tree if omitted or if command not found.
|
|
1336
1405
|
*/
|
|
1406
|
+
/**
|
|
1407
|
+
* Top-level command names (first token of each registered command). Used by
|
|
1408
|
+
* telemetry to recognise real commands without trusting arbitrary argv tokens
|
|
1409
|
+
* (so option values / secrets are never recorded as a command name).
|
|
1410
|
+
*/
|
|
1411
|
+
export function getTopLevelCommandNames() {
|
|
1412
|
+
return commands.map((c) => c.name.split(' ')[0]);
|
|
1413
|
+
}
|
|
1337
1414
|
export function buildCommandTree(subcommand) {
|
|
1338
1415
|
if (subcommand) {
|
|
1339
1416
|
const match = commands.find((c) => c.name === subcommand);
|