@@ -21,7 +21,6 @@ import {
21
21
notifyAnalyticsIfFirstRun ,
22
22
record ,
23
23
} from '@genkit-ai/tools-common/utils' ;
24
- import * as clc from 'colorette' ;
25
24
import { Command , program } from 'commander' ;
26
25
import { config } from './commands/config' ;
27
26
import { evalExtractData } from './commands/eval-extract-data' ;
@@ -57,7 +56,7 @@ const commands: Command[] = [
57
56
export async function startCLI ( ) : Promise < void > {
58
57
program
59
58
. name ( 'genkit' )
60
- . description ( 'Google Genkit CLI' )
59
+ . description ( 'Firebase Genkit CLI' )
61
60
. version ( version )
62
61
. hook ( 'preAction' , async ( _ , actionCommand ) => {
63
62
await notifyAnalyticsIfFirstRun ( ) ;
@@ -84,12 +83,20 @@ export async function startCLI(): Promise<void> {
84
83
for ( const command of await getPluginCommands ( ) ) program . addCommand ( command ) ;
85
84
86
85
for ( const cmd of ToolPluginSubCommandsSchema . keyof ( ) . options ) {
87
- program . addCommand ( await getPluginSubCommand ( cmd ) ) ;
86
+ const command = await getPluginSubCommand ( cmd ) ;
87
+ if ( command ) {
88
+ program . addCommand ( command ) ;
89
+ }
88
90
}
89
-
91
+ program . addCommand (
92
+ new Command ( 'help' ) . action ( ( ) => {
93
+ logger . info ( program . help ( ) ) ;
94
+ } )
95
+ ) ;
90
96
// Default action to catch unknown commands.
91
- program . action ( ( _ , { args } : { args : string [ ] } ) => {
92
- logger . error ( `"${ clc . bold ( args [ 0 ] ) } " is not a known Genkit command.` ) ;
97
+ program . action ( ( ) => {
98
+ // print help
99
+ logger . info ( program . help ( ) ) ;
93
100
} ) ;
94
101
95
102
await program . parseAsync ( ) ;
0 commit comments