@@ -7,26 +7,35 @@ import { messageWithCauses, stackWithCauses } from 'pony-cause'
77import updateNotifier from 'tiny-updater'
88import colors from 'yoctocolors-cjs'
99
10- import * as cliCommands from './commands'
10+ import { actionCommand } from './commands/action'
11+ import { analyticsCommand } from './commands/analytics'
12+ import { auditLogCommand } from './commands/audit-log'
13+ import { cdxgenCommand } from './commands/cdxgen'
14+ import { dependenciesCommand } from './commands/dependencies'
15+ import { diffScanCommand } from './commands/diff-scan'
16+ import { fixCommand } from './commands/fix'
17+ import { infoCommand } from './commands/info'
18+ import { loginCommand } from './commands/login'
19+ import { logoutCommand } from './commands/logout'
20+ import { manifestCommand } from './commands/manifest'
21+ import { npmCommand } from './commands/npm'
22+ import { npxCommand } from './commands/npx'
23+ import { optimizeCommand } from './commands/optimize'
24+ import { organizationCommand } from './commands/organization'
25+ import { rawNpmCommand } from './commands/raw-npm'
26+ import { rawNpxCommand } from './commands/raw-npx'
27+ import { reportCommand } from './commands/report'
28+ import { reposCommand } from './commands/repos'
29+ import { scanCommand } from './commands/scan'
30+ import { threatFeedCommand } from './commands/threat-feed'
31+ import { wrapperCommand } from './commands/wrapper'
1132import constants from './constants'
1233import { AuthError , InputError } from './utils/errors'
1334import { logSymbols } from './utils/logging'
1435import { meowWithSubcommands } from './utils/meow-with-subcommands'
1536
1637const { rootPkgJsonPath } = constants
1738
18- const formattedCliCommands = Object . fromEntries (
19- Object . entries ( cliCommands ) . map ( entry => {
20- const key = entry [ 0 ]
21- entry [ 0 ] = camelToHyphen ( key )
22- return entry
23- } )
24- )
25-
26- function camelToHyphen ( str : string ) : string {
27- return str . replace ( / [ A - Z ] + / g, '-$&' ) . toLowerCase ( )
28- }
29-
3039// TODO: Add autocompletion using https://socket.dev/npm/package/omelette
3140void ( async ( ) => {
3241 await updateNotifier ( {
@@ -36,17 +45,43 @@ void (async () => {
3645 } )
3746
3847 try {
39- await meowWithSubcommands ( formattedCliCommands , {
40- aliases : {
41- ci : {
42- description : 'Alias for "report create --view --strict"' ,
43- argv : [ 'report' , 'create' , '--view' , '--strict' ]
44- }
48+ await meowWithSubcommands (
49+ {
50+ action : actionCommand ,
51+ cdxgen : cdxgenCommand ,
52+ fix : fixCommand ,
53+ info : infoCommand ,
54+ login : loginCommand ,
55+ logout : logoutCommand ,
56+ npm : npmCommand ,
57+ npx : npxCommand ,
58+ optimize : optimizeCommand ,
59+ organization : organizationCommand ,
60+ 'raw-npm' : rawNpmCommand ,
61+ 'raw-npx' : rawNpxCommand ,
62+ report : reportCommand ,
63+ wrapper : wrapperCommand ,
64+ scan : scanCommand ,
65+ 'audit-log' : auditLogCommand ,
66+ repos : reposCommand ,
67+ dependencies : dependenciesCommand ,
68+ analytics : analyticsCommand ,
69+ 'diff-scan' : diffScanCommand ,
70+ 'threat-feed' : threatFeedCommand ,
71+ manifest : manifestCommand
4572 } ,
46- argv : process . argv . slice ( 2 ) ,
47- name : 'socket' ,
48- importMeta : { url : `${ pathToFileURL ( __filename ) } ` } as ImportMeta
49- } )
73+ {
74+ aliases : {
75+ ci : {
76+ description : 'Alias for "report create --view --strict"' ,
77+ argv : [ 'report' , 'create' , '--view' , '--strict' ]
78+ }
79+ } ,
80+ argv : process . argv . slice ( 2 ) ,
81+ name : 'socket' ,
82+ importMeta : { url : `${ pathToFileURL ( __filename ) } ` } as ImportMeta
83+ }
84+ )
5085 } catch ( err ) {
5186 let errorBody : string | undefined
5287 let errorTitle : string
0 commit comments