Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 4c53713

Browse files
authored
chore: name cortex processes (#983)
1 parent 1b4f902 commit 4c53713

File tree

7 files changed

+12
-18
lines changed

7 files changed

+12
-18
lines changed

cortex-js/src/command.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dependenciesSpinner.succeed(
1313
);
1414

1515
process.removeAllListeners('warning');
16+
process.title = 'Cortex CLI Command Process';
1617

1718
async function bootstrap() {
1819
let telemetryUseCase: TelemetryUsecases | null = null;

cortex-js/src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
defaultCortexJsPort,
66
} from '@/infrastructure/constants/cortex';
77
import { getApp } from './app';
8-
import chalk from 'chalk';
98
import { CortexUsecases } from './usecases/cortex/cortex.usecases';
109

1110
/**
@@ -20,10 +19,8 @@ export async function start(host?: string, port?: number) {
2019
await app.listen(sPort, sHost);
2120
const cortexUsecases = await app.resolve(CortexUsecases);
2221
await cortexUsecases.startCortex();
23-
console.log(chalk.blue(`Started server at http://${sHost}:${sPort}`));
24-
console.log(
25-
chalk.blue(`API Playground available at http://${sHost}:${sPort}/api`),
26-
);
22+
console.log(`Started server at http://${sHost}:${sPort}`);
23+
console.log(`API Playground available at http://${sHost}:${sPort}/api`);
2724
} catch {
2825
console.error(`Failed to start server. Is port ${port} in use?`);
2926
}

cortex-js/src/infrastructure/commanders/cortex-command.commander.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class CortexCommand extends CommandRunner {
9191

9292
this.host = options?.address || configApiServerHost || defaultCortexJsHost;
9393
this.port = options?.port || configApiServerPort || defaultCortexJsPort;
94-
if(this.host === 'localhost') {
94+
if (this.host === 'localhost') {
9595
this.host = '127.0.0.1';
9696
}
9797
this.enginePort =
@@ -122,9 +122,7 @@ export class CortexCommand extends CommandRunner {
122122
const isServerOnline = await this.cortexUseCases.isAPIServerOnline();
123123
if (isServerOnline) {
124124
console.log(
125-
chalk.blue(
126-
`Server is already running at http://${this.configHost}:${this.configPort}. Please use 'cortex stop' to stop the server.`,
127-
),
125+
`Server is already running at http://${this.configHost}:${this.configPort}. Please use 'cortex stop' to stop the server.`,
128126
);
129127
process.exit(0);
130128
}

cortex-js/src/infrastructure/commanders/serve-stop.command.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { SubCommand } from 'nest-commander';
22
import { BaseCommand } from './base.command';
33
import { CortexUsecases } from '@/usecases/cortex/cortex.usecases';
4-
import { FileManagerService } from '../services/file-manager/file-manager.service';
54

65
@SubCommand({
76
name: 'stop',

cortex-js/src/main.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import {
33
defaultCortexJsPort,
44
} from '@/infrastructure/constants/cortex';
55
import { getApp } from './app';
6-
import chalk from 'chalk';
6+
7+
process.title = 'Cortex API Server';
78

89
async function bootstrap() {
910
// getting port from env
@@ -12,12 +13,10 @@ async function bootstrap() {
1213
const app = await getApp(host, Number(port));
1314
try {
1415
await app.listen(port, host);
15-
console.log(chalk.blue(`Started server at http://${host}:${port}`));
16-
console.log(
17-
chalk.blue(`API Playground available at http://${host}:${port}/api`),
18-
);
19-
} catch {
20-
console.error(`Failed to start server. Is port ${port} in use?`);
16+
console.log(`Started server at http://${host}:${port}`);
17+
console.log(`API Playground available at http://${host}:${port}/api`);
18+
} catch (error) {
19+
console.error(`Failed to start server. Is port ${port} in use? ${error}`);
2120
}
2221
}
2322

cortex-js/src/usecases/cortex/cortex.usecases.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ export class CortexUsecases implements BeforeApplicationShutdown {
206206
// for backward compatibility, we didn't have the apiServerHost and apiServerPort in the config file in the past
207207
const apiServerHost = configApiServerHost || defaultCortexJsHost;
208208
const apiServerPort = configApiServerPort || defaultCortexJsPort;
209-
await this.stopCortex();
210209
return fetch(CORTEX_JS_SYSTEM_URL(apiServerHost, apiServerPort), {
211210
method: 'DELETE',
212211
}).catch(() => {});

cortex-js/src/utils/cortex-cpp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as cortexCPP from 'cortex-cpp';
22

3+
process.title = 'Cortex Engine Process (cortex.cpp)';
34
const port = process.env.CORTEX_CPP_PORT
45
? parseInt(process.env.CORTEX_CPP_PORT)
56
: 3929;

0 commit comments

Comments
 (0)