Skip to content

Commit e3f53b3

Browse files
committed
feat(serve): refactor to use Runtime instead of ObjectKernel for improved initialization
1 parent b5d7669 commit e3f53b3

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

packages/cli/src/commands/serve.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,21 @@ export const serveCommand = new Command('serve')
8181
console.log(chalk.green(`✓ Configuration loaded`));
8282

8383
// Import ObjectStack runtime
84-
const { ObjectKernel } = await import('@objectstack/core');
84+
const { Runtime } = await import('@objectstack/runtime');
8585

86-
// Create kernel instance
87-
console.log(chalk.yellow(`🔧 Initializing ObjectStack kernel...`));
86+
// Create runtime instance
87+
console.log(chalk.yellow(`🔧 Initializing ObjectStack runtime...`));
8888

8989
// Auto-configure pretty logging in development mode
9090
const isDev = options.dev || process.env.NODE_ENV === 'development';
9191
const loggerConfig = isDev ? { format: 'pretty' } : undefined;
9292

93-
const kernel = new ObjectKernel({
94-
metadata: config.metadata || {},
95-
objects: config.objects || {},
96-
logger: loggerConfig
93+
const runtime = new Runtime({
94+
kernel: {
95+
logger: loggerConfig
96+
}
9797
});
98+
const kernel = runtime.getKernel();
9899

99100
// Load plugins from configuration
100101
let plugins = config.plugins || [];
@@ -186,17 +187,17 @@ export const serveCommand = new Command('serve')
186187
}
187188
}
188189

189-
// Boot the kernel
190+
// Boot the runtime
190191
console.log(chalk.yellow(`\n🚀 Starting ObjectStack...`));
191-
await kernel.bootstrap();
192+
await runtime.start();
192193

193194
console.log(chalk.green(`\n✅ ObjectStack server is running!`));
194195
console.log(chalk.dim(` Press Ctrl+C to stop\n`));
195196

196197
// Keep process alive
197198
process.on('SIGINT', async () => {
198199
console.log(chalk.yellow(`\n\n⏹ Stopping server...`));
199-
await kernel.shutdown();
200+
await runtime.getKernel().shutdown();
200201
console.log(chalk.green(`✅ Server stopped`));
201202
process.exit(0);
202203
});

0 commit comments

Comments
 (0)