diff --git a/cortex-js/src/command.ts b/cortex-js/src/command.ts index 72de34dcb..37aa2a77a 100644 --- a/cortex-js/src/command.ts +++ b/cortex-js/src/command.ts @@ -13,6 +13,7 @@ dependenciesSpinner.succeed( ); process.removeAllListeners('warning'); +process.title = 'Cortex CLI Command Process'; async function bootstrap() { let telemetryUseCase: TelemetryUsecases | null = null; diff --git a/cortex-js/src/index.ts b/cortex-js/src/index.ts index 4d31b2eeb..c383a5417 100644 --- a/cortex-js/src/index.ts +++ b/cortex-js/src/index.ts @@ -5,7 +5,6 @@ import { defaultCortexJsPort, } from '@/infrastructure/constants/cortex'; import { getApp } from './app'; -import chalk from 'chalk'; import { CortexUsecases } from './usecases/cortex/cortex.usecases'; /** @@ -20,10 +19,8 @@ export async function start(host?: string, port?: number) { await app.listen(sPort, sHost); const cortexUsecases = await app.resolve(CortexUsecases); await cortexUsecases.startCortex(); - console.log(chalk.blue(`Started server at http://${sHost}:${sPort}`)); - console.log( - chalk.blue(`API Playground available at http://${sHost}:${sPort}/api`), - ); + console.log(`Started server at http://${sHost}:${sPort}`); + console.log(`API Playground available at http://${sHost}:${sPort}/api`); } catch { console.error(`Failed to start server. Is port ${port} in use?`); } diff --git a/cortex-js/src/infrastructure/commanders/cortex-command.commander.ts b/cortex-js/src/infrastructure/commanders/cortex-command.commander.ts index ddc24d2d2..98746894c 100644 --- a/cortex-js/src/infrastructure/commanders/cortex-command.commander.ts +++ b/cortex-js/src/infrastructure/commanders/cortex-command.commander.ts @@ -91,7 +91,7 @@ export class CortexCommand extends CommandRunner { this.host = options?.address || configApiServerHost || defaultCortexJsHost; this.port = options?.port || configApiServerPort || defaultCortexJsPort; - if(this.host === 'localhost') { + if (this.host === 'localhost') { this.host = '127.0.0.1'; } this.enginePort = @@ -122,9 +122,7 @@ export class CortexCommand extends CommandRunner { const isServerOnline = await this.cortexUseCases.isAPIServerOnline(); if (isServerOnline) { console.log( - chalk.blue( - `Server is already running at http://${this.configHost}:${this.configPort}. Please use 'cortex stop' to stop the server.`, - ), + `Server is already running at http://${this.configHost}:${this.configPort}. Please use 'cortex stop' to stop the server.`, ); process.exit(0); } diff --git a/cortex-js/src/infrastructure/commanders/serve-stop.command.ts b/cortex-js/src/infrastructure/commanders/serve-stop.command.ts index 3fa96be9e..ea9039a4d 100644 --- a/cortex-js/src/infrastructure/commanders/serve-stop.command.ts +++ b/cortex-js/src/infrastructure/commanders/serve-stop.command.ts @@ -1,7 +1,6 @@ import { SubCommand } from 'nest-commander'; import { BaseCommand } from './base.command'; import { CortexUsecases } from '@/usecases/cortex/cortex.usecases'; -import { FileManagerService } from '../services/file-manager/file-manager.service'; @SubCommand({ name: 'stop', diff --git a/cortex-js/src/main.ts b/cortex-js/src/main.ts index 988e55426..19c3e4d74 100644 --- a/cortex-js/src/main.ts +++ b/cortex-js/src/main.ts @@ -3,7 +3,8 @@ import { defaultCortexJsPort, } from '@/infrastructure/constants/cortex'; import { getApp } from './app'; -import chalk from 'chalk'; + +process.title = 'Cortex API Server'; async function bootstrap() { // getting port from env @@ -12,12 +13,10 @@ async function bootstrap() { const app = await getApp(host, Number(port)); try { await app.listen(port, host); - console.log(chalk.blue(`Started server at http://${host}:${port}`)); - console.log( - chalk.blue(`API Playground available at http://${host}:${port}/api`), - ); - } catch { - console.error(`Failed to start server. Is port ${port} in use?`); + console.log(`Started server at http://${host}:${port}`); + console.log(`API Playground available at http://${host}:${port}/api`); + } catch (error) { + console.error(`Failed to start server. Is port ${port} in use? ${error}`); } } diff --git a/cortex-js/src/usecases/cortex/cortex.usecases.ts b/cortex-js/src/usecases/cortex/cortex.usecases.ts index 400c76163..01bf1ed09 100644 --- a/cortex-js/src/usecases/cortex/cortex.usecases.ts +++ b/cortex-js/src/usecases/cortex/cortex.usecases.ts @@ -206,7 +206,6 @@ export class CortexUsecases implements BeforeApplicationShutdown { // for backward compatibility, we didn't have the apiServerHost and apiServerPort in the config file in the past const apiServerHost = configApiServerHost || defaultCortexJsHost; const apiServerPort = configApiServerPort || defaultCortexJsPort; - await this.stopCortex(); return fetch(CORTEX_JS_SYSTEM_URL(apiServerHost, apiServerPort), { method: 'DELETE', }).catch(() => {}); diff --git a/cortex-js/src/utils/cortex-cpp.ts b/cortex-js/src/utils/cortex-cpp.ts index 3efd755dd..efa28adbd 100644 --- a/cortex-js/src/utils/cortex-cpp.ts +++ b/cortex-js/src/utils/cortex-cpp.ts @@ -1,5 +1,6 @@ import * as cortexCPP from 'cortex-cpp'; +process.title = 'Cortex Engine Process (cortex.cpp)'; const port = process.env.CORTEX_CPP_PORT ? parseInt(process.env.CORTEX_CPP_PORT) : 3929;