Skip to content

Commit 1ef38cb

Browse files
committed
refactor: remove SetupPlugin and related files, integrate static Setup App definition
- Deleted the SetupPlugin and its associated files, including README, CHANGELOG, and configuration. - Integrated the static Setup App definition directly into the platform-objects package. - Updated AIServicePlugin to utilize the new static Setup App for navigation entries. - Removed navigation contribution logic from AIServicePlugin and SecurityPlugin. - Adjusted documentation and tests to reflect the removal of dynamic Setup navigation contributions.
1 parent c6641a4 commit 1ef38cb

32 files changed

Lines changed: 137 additions & 1011 deletions

File tree

apps/cloud/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"@objectstack/plugin-auth": "workspace:*",
2727
"@objectstack/plugin-hono-server": "workspace:*",
2828
"@objectstack/plugin-security": "workspace:*",
29-
"@objectstack/plugin-setup": "workspace:*",
3029
"@objectstack/runtime": "workspace:*",
3130
"@objectstack/service-ai": "workspace:*",
3231
"@objectstack/service-analytics": "workspace:*",

apps/cloud/server/index.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,15 @@ async function bootKernel(): Promise<BootResult> {
5555
kernel.registerService('http.server', httpServer);
5656
kernel.registerService('http-server', httpServer); // alias for backward compatibility
5757

58-
// 1. SetupPlugin — must be registered BEFORE the control-plane preset
59-
// so that AuthPlugin / SecurityPlugin / AuditPlugin can resolve the
60-
// `setupNav` service during their own `init()` and contribute their
61-
// Setup-App navigation items. Without this ordering the deployed
62-
// `/api/v1/meta/app` would return a Setup app with empty `areas`
63-
// (no menu rendered in Studio).
64-
try {
65-
const setupPkg = '@objectstack/plugin-setup';
66-
const { SetupPlugin } = await import(/* webpackIgnore: true */ setupPkg);
67-
await kernel.use(new SetupPlugin());
68-
} catch {
69-
// optional
70-
}
71-
72-
// 2. Config plugins (control-plane preset + MultiProjectPlugin + Auth/Security/Audit)
58+
// 1. Config plugins (control-plane preset + MultiProjectPlugin + Auth/Security/Audit).
59+
// AuthPlugin registers the platform Setup App via its manifest
60+
// (definition lives in @objectstack/platform-objects/apps), so no
61+
// separate setup plugin is needed.
7362
for (const plugin of stackConfig.plugins ?? []) {
7463
await kernel.use(plugin as any);
7564
}
7665

77-
// 3. REST API + Dispatcher — consume the scoping config from stackConfig.api
66+
// 2. REST API + Dispatcher — consume the scoping config from stackConfig.api
7867
const api = (stackConfig as any).api ?? {};
7968
try {
8069
await kernel.use(

apps/server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"@objectstack/plugin-auth": "workspace:*",
3131
"@objectstack/plugin-hono-server": "workspace:*",
3232
"@objectstack/plugin-security": "workspace:*",
33-
"@objectstack/plugin-setup": "workspace:*",
3433
"@objectstack/runtime": "workspace:*",
3534
"@objectstack/service-ai": "workspace:*",
3635
"@objectstack/service-analytics": "workspace:*",

apps/server/server/index.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,14 @@ async function bootKernel(): Promise<BootResult> {
5555
kernel.registerService('http.server', httpServer);
5656
kernel.registerService('http-server', httpServer); // alias for backward compatibility
5757

58-
// 1. Config plugins (control-plane preset + MultiProjectPlugin)
58+
// 1. Config plugins (control-plane preset + MultiProjectPlugin + Auth/Security/Audit).
59+
// AuthPlugin registers the platform Setup App via its manifest
60+
// (definition lives in @objectstack/platform-objects/apps).
5961
for (const plugin of stackConfig.plugins ?? []) {
6062
await kernel.use(plugin as any);
6163
}
6264

63-
// 2. Optional SetupPlugin — provides the Studio's setup app. Same as
64-
// the CLI's auto-register path; kept here so the serverless bundle
65-
// is independently bootable.
66-
try {
67-
const setupPkg = '@objectstack/plugin-setup';
68-
const { SetupPlugin } = await import(/* webpackIgnore: true */ setupPkg);
69-
await kernel.use(new SetupPlugin());
70-
} catch {
71-
// optional
72-
}
73-
74-
// 3. REST API + Dispatcher — consume the scoping config from stackConfig.api
65+
// 2. REST API + Dispatcher — consume the scoping config from stackConfig.api
7566
const api = (stackConfig as any).api ?? {};
7667
try {
7768
await kernel.use(

apps/studio/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"@objectstack/plugin-auth": "workspace:*",
4141
"@objectstack/plugin-msw": "workspace:*",
4242
"@objectstack/plugin-security": "workspace:*",
43-
"@objectstack/plugin-setup": "workspace:*",
4443
"@objectstack/runtime": "workspace:*",
4544
"@objectstack/service-ai": "workspace:*",
4645
"@objectstack/service-analytics": "workspace:*",

apps/studio/src/mocks/createKernel.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { ObjectKernel, DriverPlugin, AppPlugin } from '@objectstack/runtime';
44
import { ObjectQLPlugin } from '@objectstack/objectql';
55
import { InMemoryDriver } from '@objectstack/driver-memory';
66
import { MSWPlugin } from '@objectstack/plugin-msw';
7-
import { SetupPlugin } from '@objectstack/plugin-setup';
87
import { AutomationServicePlugin } from '@objectstack/service-automation';
98
import { AnalyticsServicePlugin } from '@objectstack/service-analytics';
109
import { MetadataPlugin } from '@objectstack/metadata';
@@ -19,6 +18,7 @@ import {
1918
} from '@objectstack/platform-objects/identity';
2019
import { SysRole, SysPermissionSet } from '@objectstack/platform-objects/security';
2120
import { SysAuditLog } from '@objectstack/platform-objects/audit';
21+
import { SETUP_APP } from '@objectstack/platform-objects/apps';
2222

2323
/** All system objects from auth, security, and audit plugins */
2424
const SYSTEM_OBJECTS = [
@@ -58,7 +58,9 @@ export async function createKernel(options: KernelOptions) {
5858
// Register the driver
5959
await kernel.use(new DriverPlugin(driver, 'memory'));
6060

61-
// Register system objects (auth, security, audit) as a built-in system package
61+
// Register system objects (auth, security, audit) as a built-in system package.
62+
// The Setup App (admin nav metadata) ships in the same package since the
63+
// referenced sys_* objects all live here.
6264
const systemConfig = {
6365
name: 'system',
6466
manifest: {
@@ -69,6 +71,7 @@ export async function createKernel(options: KernelOptions) {
6971
namespace: 'sys',
7072
},
7173
objects: SYSTEM_OBJECTS,
74+
apps: [SETUP_APP],
7275
};
7376
console.log('[KernelFactory] Loading system objects:', SYSTEM_OBJECTS.length);
7477
await kernel.use(new AppPlugin(systemConfig));
@@ -80,9 +83,6 @@ export async function createKernel(options: KernelOptions) {
8083
}
8184

8285
// Register services and plugins
83-
// SetupPlugin must load BEFORE other plugins that contribute navigation items
84-
// so that the setupNav service is available during their init() phase
85-
await kernel.use(new SetupPlugin());
8686
await kernel.use(new FeedServicePlugin());
8787
await kernel.use(new MetadataPlugin({ watch: false }));
8888
await kernel.use(new AIServicePlugin());

packages/cli/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"@objectstack/plugin-auth": "workspace:*",
4949
"@objectstack/plugin-hono-server": "workspace:*",
5050
"@objectstack/plugin-security": "workspace:*",
51-
"@objectstack/plugin-setup": "workspace:*",
5251
"@objectstack/rest": "workspace:*",
5352
"@objectstack/runtime": "workspace:^",
5453
"@objectstack/service-ai": "workspace:*",

packages/cli/src/commands/serve.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -336,23 +336,7 @@ export default class Serve extends Command {
336336
}
337337
}
338338

339-
// 5. Auto-register SetupPlugin BEFORE config plugins so that other
340-
// plugins (e.g. AuthPlugin) can call setupNav.contribute() during init.
341-
const hasSetupPlugin = plugins.some(
342-
(p: any) => p.name === 'com.objectstack.setup' || p.constructor?.name === 'SetupPlugin'
343-
);
344-
if (!hasSetupPlugin) {
345-
try {
346-
const setupPkg = '@objectstack/plugin-setup';
347-
const { SetupPlugin } = await import(/* webpackIgnore: true */ setupPkg);
348-
await kernel.use(new SetupPlugin());
349-
trackPlugin('Setup');
350-
} catch {
351-
// @objectstack/plugin-setup not installed — setup app unavailable
352-
}
353-
}
354-
355-
// 5a. Auto-register Studio single-project signal in dev mode.
339+
// 5. Auto-register Studio single-project signal in dev mode.
356340
//
357341
// `objectstack dev` runs a vanilla user stack (e.g. examples/app-crm)
358342
// as a single project — there is no apps/cloud control plane and no

packages/platform-objects/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
"types": "./dist/metadata/index.d.ts",
3636
"import": "./dist/metadata/index.mjs",
3737
"require": "./dist/metadata/index.js"
38+
},
39+
"./apps": {
40+
"types": "./dist/apps/index.d.ts",
41+
"import": "./dist/apps/index.mjs",
42+
"require": "./dist/apps/index.js"
3843
}
3944
},
4045
"scripts": {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
export { SETUP_APP } from './setup.app.js';

0 commit comments

Comments
 (0)