@@ -11,33 +11,7 @@ import updateNotifier from 'tiny-updater'
11
11
import { debugDir , debugFn } from '@socketsecurity/registry/lib/debug'
12
12
import { logger } from '@socketsecurity/registry/lib/logger'
13
13
14
- import { cmdAnalytics } from './commands/analytics/cmd-analytics.mts'
15
- import { cmdAuditLog } from './commands/audit-log/cmd-audit-log.mts'
16
- import { cmdCI } from './commands/ci/cmd-ci.mts'
17
- import { cmdConfig } from './commands/config/cmd-config.mts'
18
- import { cmdFix } from './commands/fix/cmd-fix.mts'
19
- import { cmdInstall } from './commands/install/cmd-install.mts'
20
- import { cmdJson } from './commands/json/cmd-json.mts'
21
- import { cmdLogin } from './commands/login/cmd-login.mts'
22
- import { cmdLogout } from './commands/logout/cmd-logout.mts'
23
- import { cmdManifestCdxgen } from './commands/manifest/cmd-manifest-cdxgen.mts'
24
- import { cmdManifest } from './commands/manifest/cmd-manifest.mts'
25
- import { cmdNpm } from './commands/npm/cmd-npm.mts'
26
- import { cmdNpx } from './commands/npx/cmd-npx.mts'
27
- import { cmdOops } from './commands/oops/cmd-oops.mts'
28
- import { cmdOptimize } from './commands/optimize/cmd-optimize.mts'
29
- import { cmdOrganizationDependencies } from './commands/organization/cmd-organization-dependencies.mts'
30
- import { cmdOrganizationPolicyLicense } from './commands/organization/cmd-organization-policy-license.mts'
31
- import { cmdOrganizationPolicySecurity } from './commands/organization/cmd-organization-policy-security.mts'
32
- import { cmdOrganization } from './commands/organization/cmd-organization.mts'
33
- import { cmdPackage } from './commands/package/cmd-package.mts'
34
- import { cmdRawNpm } from './commands/raw-npm/cmd-raw-npm.mts'
35
- import { cmdRawNpx } from './commands/raw-npx/cmd-raw-npx.mts'
36
- import { cmdRepository } from './commands/repository/cmd-repository.mts'
37
- import { cmdScan } from './commands/scan/cmd-scan.mts'
38
- import { cmdThreatFeed } from './commands/threat-feed/cmd-threat-feed.mts'
39
- import { cmdUninstall } from './commands/uninstall/cmd-uninstall.mts'
40
- import { cmdWrapper } from './commands/wrapper/cmd-wrapper.mts'
14
+ import { rootAliases , rootCommands } from './commands.mts'
41
15
import constants from './constants.mts'
42
16
import { AuthError , InputError , captureException } from './utils/errors.mts'
43
17
import { failMsgWithBadge } from './utils/fail-msg-with-badge.mts'
@@ -59,131 +33,13 @@ void (async () => {
59
33
} )
60
34
61
35
try {
62
- await meowWithSubcommands (
63
- {
64
- analytics : cmdAnalytics ,
65
- 'audit-log' : cmdAuditLog ,
66
- ci : cmdCI ,
67
- config : cmdConfig ,
68
- fix : cmdFix ,
69
- install : cmdInstall ,
70
- json : cmdJson ,
71
- login : cmdLogin ,
72
- logout : cmdLogout ,
73
- npm : cmdNpm ,
74
- npx : cmdNpx ,
75
- oops : cmdOops ,
76
- optimize : cmdOptimize ,
77
- organization : cmdOrganization ,
78
- package : cmdPackage ,
79
- manifest : cmdManifest ,
80
- scan : cmdScan ,
81
- 'raw-npm' : cmdRawNpm ,
82
- 'raw-npx' : cmdRawNpx ,
83
- repos : cmdRepository ,
84
- 'threat-feed' : cmdThreatFeed ,
85
- uninstall : cmdUninstall ,
86
- wrapper : cmdWrapper ,
87
- } ,
88
- {
89
- aliases : {
90
- audit : {
91
- description : cmdAuditLog . description ,
92
- hidden : true ,
93
- argv : [ 'audit-log' ] ,
94
- } ,
95
- auditLog : {
96
- description : cmdAuditLog . description ,
97
- hidden : true ,
98
- argv : [ 'audit-log' ] ,
99
- } ,
100
- auditLogs : {
101
- description : cmdAuditLog . description ,
102
- hidden : true ,
103
- argv : [ 'audit-log' ] ,
104
- } ,
105
- [ 'audit-logs' ] : {
106
- description : cmdAuditLog . description ,
107
- hidden : true ,
108
- argv : [ 'audit-log' ] ,
109
- } ,
110
- cdxgen : {
111
- description : cmdManifestCdxgen . description ,
112
- hidden : true ,
113
- argv : [ 'manifest' , 'cdxgen' ] ,
114
- } ,
115
- deps : {
116
- description : cmdOrganizationDependencies . description ,
117
- hidden : true ,
118
- argv : [ 'dependencies' ] ,
119
- } ,
120
- feed : {
121
- description : cmdThreatFeed . description ,
122
- hidden : true ,
123
- argv : [ 'threat-feed' ] ,
124
- } ,
125
- license : {
126
- description : cmdOrganizationPolicyLicense . description ,
127
- hidden : true ,
128
- argv : [ 'organization' , 'policy' , 'license' ] ,
129
- } ,
130
- org : {
131
- description : cmdOrganization . description ,
132
- hidden : true ,
133
- argv : [ 'organization' ] ,
134
- } ,
135
- orgs : {
136
- description : cmdOrganization . description ,
137
- hidden : true ,
138
- argv : [ 'organization' ] ,
139
- } ,
140
- organizations : {
141
- description : cmdOrganization . description ,
142
- hidden : true ,
143
- argv : [ 'organization' ] ,
144
- } ,
145
- organisation : {
146
- description : cmdOrganization . description ,
147
- hidden : true ,
148
- argv : [ 'organization' ] ,
149
- } ,
150
- organisations : {
151
- description : cmdOrganization . description ,
152
- hidden : true ,
153
- argv : [ 'organization' ] ,
154
- } ,
155
- pkg : {
156
- description : cmdPackage . description ,
157
- hidden : true ,
158
- argv : [ 'package' ] ,
159
- } ,
160
- repo : {
161
- description : cmdRepository . description ,
162
- hidden : true ,
163
- argv : [ 'repos' ] ,
164
- } ,
165
- repository : {
166
- description : cmdRepository . description ,
167
- hidden : true ,
168
- argv : [ 'repos' ] ,
169
- } ,
170
- repositories : {
171
- description : cmdRepository . description ,
172
- hidden : true ,
173
- argv : [ 'repos' ] ,
174
- } ,
175
- security : {
176
- description : cmdOrganizationPolicySecurity . description ,
177
- hidden : true ,
178
- argv : [ 'organization' , 'policy' , 'security' ] ,
179
- } ,
180
- } ,
181
- argv : process . argv . slice ( 2 ) ,
182
- // Lazily access constants.SOCKET_CLI_BIN_NAME.
183
- name : constants . SOCKET_CLI_BIN_NAME ,
184
- importMeta : { url : `${ pathToFileURL ( __filename ) } ` } as ImportMeta ,
185
- } ,
186
- )
36
+ await meowWithSubcommands ( rootCommands , {
37
+ aliases : rootAliases ,
38
+ argv : process . argv . slice ( 2 ) ,
39
+ // Lazily access constants.SOCKET_CLI_BIN_NAME.
40
+ name : constants . SOCKET_CLI_BIN_NAME ,
41
+ importMeta : { url : `${ pathToFileURL ( __filename ) } ` } as ImportMeta ,
42
+ } )
187
43
} catch ( e ) {
188
44
process . exitCode = 1
189
45
debugFn ( 'error' , 'Uncaught error (BAD!):' )
@@ -228,7 +84,8 @@ void (async () => {
228
84
} ) ,
229
85
)
230
86
} else {
231
- logger . error ( '\n' ) // Any-spinner-newline
87
+ // Bump below any spinner.
88
+ logger . error ( '\n' )
232
89
logger . fail ( failMsgWithBadge ( errorTitle , errorMessage ) )
233
90
if ( errorBody ) {
234
91
debugDir ( 'inspect' , { errorBody } )
0 commit comments