diff --git a/cortex-js/src/infrastructure/commanders/cortex-command.commander.ts b/cortex-js/src/infrastructure/commanders/cortex-command.commander.ts index c0139370e..6422273c3 100644 --- a/cortex-js/src/infrastructure/commanders/cortex-command.commander.ts +++ b/cortex-js/src/infrastructure/commanders/cortex-command.commander.ts @@ -1,3 +1,4 @@ +import pkg from '@/../package.json'; import { RootCommand, CommandRunner, Option } from 'nest-commander'; import { ChatCommand } from './chat.command'; import { ModelsCommand } from './models.command'; @@ -18,6 +19,7 @@ import { FileManagerService } from '../services/file-manager/file-manager.servic import { CortexUsecases } from '@/usecases/cortex/cortex.usecases'; import { ServeStopCommand } from './sub-commands/serve-stop.command'; import ora from 'ora'; +import { printSlogan } from '@/utils/logo'; import { EnginesSetCommand } from './engines/engines-set.command'; type ServeOptions = { @@ -25,6 +27,7 @@ type ServeOptions = { port?: number; logs?: boolean; dataFolder?: string; + version?: boolean; }; @RootCommand({ @@ -58,7 +61,15 @@ export class CortexCommand extends CommandRunner { const host = options?.address || defaultCortexJsHost; const port = options?.port || defaultCortexJsPort; const showLogs = options?.logs || false; + const showVersion = options?.version || false; const dataFolderPath = options?.dataFolder; + if (showVersion) { + printSlogan(); + console.log('\n'); + console.log(`Cortex CLI - v${pkg.version}`); + console.log(chalk.blue(`Github: ${pkg.homepage}`)); + return; + } return this.startServer(host, port, showLogs, dataFolderPath); } @@ -156,4 +167,12 @@ export class CortexCommand extends CommandRunner { parseDataFolder(value: string) { return value; } + + @Option({ + flags: '-v, --version', + description: 'Show version', + }) + parseVersion() { + return true; + } }