Skip to content

Commit 79adb79

Browse files
committed
fix: update serve command to check for compatible @objectstack/core version and use kernel.bootstrap
1 parent ef1f5cc commit 79adb79

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

packages/cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"tsx": "^4.7.1",
3232
"zod": "^4.3.6"
3333
},
34+
"peerDependencies": {
35+
"@objectstack/core": "^0.8.0"
36+
},
3437
"devDependencies": {
3538
"@types/node": "^25.1.0",
3639
"tsup": "^8.0.2",

packages/cli/src/commands/serve.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ export const serveCommand = new Command('serve')
4848
objects: config.objects || {},
4949
});
5050

51+
const supportsUse = typeof (kernel as any).use === 'function';
52+
const supportsBootstrap = typeof (kernel as any).bootstrap === 'function';
53+
54+
if (!supportsUse || !supportsBootstrap) {
55+
throw new Error(
56+
'Incompatible @objectstack/core version. Please use @objectstack/core@^0.8.0 or newer.'
57+
);
58+
}
59+
5160
// Load plugins from configuration
5261
const plugins = config.plugins || [];
5362

@@ -56,7 +65,7 @@ export const serveCommand = new Command('serve')
5665

5766
for (const plugin of plugins) {
5867
try {
59-
kernel.registerPlugin(plugin);
68+
kernel.use(plugin);
6069
const pluginName = plugin.name || plugin.constructor?.name || 'unnamed';
6170
console.log(chalk.green(` ✓ Registered plugin: ${pluginName}`));
6271
} catch (e: any) {
@@ -70,7 +79,7 @@ export const serveCommand = new Command('serve')
7079
try {
7180
const { HonoServerPlugin } = await import('@objectstack/plugin-hono-server');
7281
const serverPlugin = new HonoServerPlugin({ port: parseInt(options.port) });
73-
kernel.registerPlugin(serverPlugin);
82+
kernel.use(serverPlugin);
7483
console.log(chalk.green(` ✓ Registered HTTP server plugin (port: ${options.port})`));
7584
} catch (e: any) {
7685
console.warn(chalk.yellow(` ⚠ HTTP server plugin not available: ${e.message}`));
@@ -79,7 +88,7 @@ export const serveCommand = new Command('serve')
7988

8089
// Boot the kernel
8190
console.log(chalk.yellow(`\n🚀 Starting ObjectStack...`));
82-
await kernel.boot();
91+
await kernel.bootstrap();
8392

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

0 commit comments

Comments
 (0)