Skip to content

Commit a77599c

Browse files
display a startup banner in terminal
1 parent 69754aa commit a77599c

5 files changed

Lines changed: 176 additions & 6 deletions

File tree

package-lock.json

Lines changed: 63 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"devDependencies": {
3535
"@eslint/js": "^9.25.0",
36+
"@types/figlet": "^1.7.0",
3637
"@types/opener": "^1.4.3",
3738
"concurrently": "^8.2.2",
3839
"eslint": "^9.25.0",
@@ -44,6 +45,7 @@
4445
"@trpc/server": "^11.0.1",
4546
"cors": "^2.8.5",
4647
"express": "^5.1.0",
48+
"figlet": "^1.7.0",
4749
"find-process": "^1.4.10",
4850
"google-protobuf": "^3.21.4",
4951
"moment": "^2.30.1",

packages/server/src/index.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import * as trpcExpress from '@trpc/server/adapters/express';
44
import { initializeDatabase } from './database';
55
import { appRouter } from './trpc/router';
66
import { SocketManager } from './trpc/socket';
7-
import { ConfigManager } from '../../shared/src/config';
7+
import { ConfigManager, APP_INFO } from '../../shared/src/config';
88
import path from 'path';
99
import opener from 'opener';
1010
import { promptUser } from '../../shared/src/utils/terminal';
1111
import portfinder from 'portfinder';
1212
import otelRouter from './otel/router';
13+
import { displayBanner } from '../../shared/src/utils/banner';
1314

1415
async function initializeServer() {
1516
try {
@@ -43,6 +44,7 @@ async function initializeServer() {
4344

4445
// Initialize the database
4546
await initializeDatabase(config.database);
47+
console.log('✔ Database initialized successfully');
4648

4749
// Set TRPC router
4850
app.use(
@@ -82,9 +84,19 @@ async function initializeServer() {
8284

8385
httpServer.listen(configManager.getConfig().port, () => {
8486
const actualPort = configManager.getConfig().port;
85-
console.log(
86-
`Server running on port ${actualPort} in ${process.env.NODE_ENV} mode ...`,
87-
);
87+
const config = configManager.getConfig();
88+
const mode = (process.env.NODE_ENV || 'production') as
89+
| 'development'
90+
| 'production';
91+
92+
// Display startup banner
93+
displayBanner({
94+
appName: APP_INFO.name,
95+
version: APP_INFO.version,
96+
port: actualPort,
97+
databasePath: config.database.database,
98+
mode: mode,
99+
});
88100

89101
if (process.env.NODE_ENV === 'production') {
90102
opener(`http://localhost:${actualPort}/home`);

packages/shared/src/config/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const APP_INFO = {
22
name: 'AgentScope-Studio',
3-
version: '1.0.0',
3+
version: '1.0.5',
44
description: 'Your app description',
55
} as const;
66

0 commit comments

Comments
 (0)