1+ import pkg from '@/../package.json' ;
12import { RootCommand , CommandRunner , Option } from 'nest-commander' ;
23import { ChatCommand } from './chat.command' ;
34import { ModelsCommand } from './models.command' ;
@@ -18,13 +19,15 @@ import { FileManagerService } from '../services/file-manager/file-manager.servic
1819import { CortexUsecases } from '@/usecases/cortex/cortex.usecases' ;
1920import { ServeStopCommand } from './sub-commands/serve-stop.command' ;
2021import ora from 'ora' ;
22+ import { printSlogan } from '@/utils/logo' ;
2123import { EnginesSetCommand } from './engines/engines-set.command' ;
2224
2325type ServeOptions = {
2426 address ?: string ;
2527 port ?: number ;
2628 logs ?: boolean ;
2729 dataFolder ?: string ;
30+ version ?: boolean ;
2831} ;
2932
3033@RootCommand ( {
@@ -58,7 +61,15 @@ export class CortexCommand extends CommandRunner {
5861 const host = options ?. address || defaultCortexJsHost ;
5962 const port = options ?. port || defaultCortexJsPort ;
6063 const showLogs = options ?. logs || false ;
64+ const showVersion = options ?. version || false ;
6165 const dataFolderPath = options ?. dataFolder ;
66+ if ( showVersion ) {
67+ printSlogan ( ) ;
68+ console . log ( '\n' ) ;
69+ console . log ( `Cortex CLI - v${ pkg . version } ` ) ;
70+ console . log ( chalk . blue ( `Github: ${ pkg . homepage } ` ) ) ;
71+ return ;
72+ }
6273 return this . startServer ( host , port , showLogs , dataFolderPath ) ;
6374 }
6475
@@ -156,4 +167,12 @@ export class CortexCommand extends CommandRunner {
156167 parseDataFolder ( value : string ) {
157168 return value ;
158169 }
170+
171+ @Option ( {
172+ flags : '-v, --version' ,
173+ description : 'Show version' ,
174+ } )
175+ parseVersion ( ) {
176+ return true ;
177+ }
159178}
0 commit comments