Skip to content

Commit 756189a

Browse files
os-zhuangclaude
andcommitted
feat(apps): wire Setup/Studio/Account app packages into dev+serve; drop from plugin-auth (ADR-0048)
⚠️ BOOT-CRITICAL — verify with a live `os dev` (and `os serve`) boot before merge. Completes the ADR-0048 app split: - plugin-auth's manifest no longer registers `apps: [SETUP_APP, STUDIO_APP, ACCOUNT_APP]` nor `navigationContributions: SETUP_NAV_CONTRIBUTIONS`; it keeps only the auth objects + their detail pages. - dev-plugin.ts and cli `serve.ts` now register the three new app packages (best-effort dynamic import, skipped if not installed) right after AuthPlugin, so each app publishes under its own package id (com.objectstack.{setup,studio, account}) and `/apps/<packageId>` resolves unambiguously. - plugin-dev + cli declare the three app packages as workspace deps. The AppSchemas still physically live in @objectstack/platform-objects/apps (the new packages import them); moving the definitions in is a later non-behavioral cleanup. Verified statically: all packages build, plugin-dev/cli typecheck clean, plugin-auth (114) + platform-objects (55) tests pass. NOT runtime-boot-verified. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2707e30 commit 756189a

6 files changed

Lines changed: 115 additions & 14 deletions

File tree

packages/cli/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
"@objectstack/plugin-audit": "workspace:*",
6060
"@objectstack/plugin-auth": "workspace:*",
6161
"@objectstack/plugin-email": "workspace:*",
62+
"@objectstack/setup": "workspace:*",
63+
"@objectstack/studio": "workspace:*",
6264
"@objectstack/plugin-hono-server": "workspace:*",
6365
"@objectstack/mcp": "workspace:*",
6466
"@objectstack/plugin-org-scoping": "workspace:*",

packages/cli/src/commands/serve.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,23 @@ export default class Serve extends Command {
11761176
}));
11771177
trackPlugin('Auth');
11781178

1179+
// ADR-0048 — the platform apps (Setup/Studio/Account) moved out of
1180+
// plugin-auth's manifest into their own one-app packages. Register
1181+
// each after AuthPlugin (best-effort; skipped if not installed).
1182+
for (const [appPkg, factory] of [
1183+
['@objectstack/setup', 'createSetupAppPlugin'],
1184+
['@objectstack/studio', 'createStudioAppPlugin'],
1185+
['@objectstack/account', 'createAccountAppPlugin'],
1186+
] as const) {
1187+
try {
1188+
const appMod: any = await import(/* webpackIgnore: true */ appPkg);
1189+
await kernel.use(appMod[factory]());
1190+
trackPlugin(appPkg);
1191+
} catch {
1192+
// best-effort — the app package is optional
1193+
}
1194+
}
1195+
11791196
// Pair: OrgScopingPlugin (multi-tenant) — optional, must register BEFORE SecurityPlugin
11801197
// OrgScopingPlugin provides `organization_id` auto-stamp, per-org
11811198
// seed-replay, and default-org bootstrap. SecurityPlugin probes

packages/plugins/plugin-auth/src/auth-plugin.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ import { Plugin, PluginContext, IHttpServer } from '@objectstack/core';
44
import type { BetterAuthOptions } from 'better-auth';
55
import { AuthConfig, type SocialProviderConfig, SystemObjectName, SystemUserId } from '@objectstack/spec/system';
66
import {
7-
SETUP_APP,
8-
SETUP_NAV_CONTRIBUTIONS,
9-
STUDIO_APP,
10-
ACCOUNT_APP,
7+
// ADR-0048 — the Setup/Studio/Account apps moved to their own packages
8+
// (@objectstack/{setup,studio,account}); plugin-auth no longer registers them.
119
SystemOverviewDashboard,
1210
SystemOverviewDatasets,
1311
} from '@objectstack/platform-objects/apps';
@@ -180,15 +178,10 @@ export class AuthPlugin implements Plugin {
180178
? { defaultDatasource: this.options.manifestDatasource }
181179
: {}),
182180
objects: authIdentityObjects,
183-
// The platform Setup App is a static metadata artifact (lives in
184-
// @objectstack/platform-objects/apps). plugin-auth is the natural
185-
// owner of its registration since it loads first among the trio
186-
// (auth + security + audit) that supplies the underlying objects.
187-
apps: [SETUP_APP, STUDIO_APP, ACCOUNT_APP],
188-
// ADR-0029 D7 — the Setup App is a shell of group anchors; its entries
189-
// for platform-objects-owned objects are contributed here. Capability
190-
// plugins (e.g. plugin-webhooks) contribute their own slots' entries.
191-
navigationContributions: SETUP_NAV_CONTRIBUTIONS,
181+
// ADR-0048 — Setup/Studio/Account apps (and the Setup nav contributions)
182+
// moved to their own one-app packages (@objectstack/{setup,studio,account}),
183+
// each registering under its own package id so /apps/<packageId> resolves
184+
// unambiguously. plugin-auth keeps only the auth objects + their pages.
192185
// Slotted record-detail pages for system objects — currently
193186
// sys_organization gets a Members / Invitations / Teams tab strip
194187
// (see SysOrganizationDetailPage for the rationale and the

packages/plugins/plugin-dev/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
"@objectstack/core": "workspace:*",
2121
"@objectstack/spec": "workspace:*",
2222
"@objectstack/types": "workspace:*",
23+
"@objectstack/account": "workspace:^",
2324
"@objectstack/driver-memory": "workspace:^",
2425
"@objectstack/objectql": "workspace:^",
2526
"@objectstack/plugin-auth": "workspace:^",
27+
"@objectstack/setup": "workspace:^",
28+
"@objectstack/studio": "workspace:^",
2629
"@objectstack/plugin-hono-server": "workspace:^",
2730
"@objectstack/plugin-org-scoping": "workspace:^",
2831
"@objectstack/plugin-security": "workspace:^",

packages/plugins/plugin-dev/src/dev-plugin.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,23 @@ export class DevPlugin implements Plugin {
548548
} catch {
549549
ctx.logger.warn(' ✘ @objectstack/plugin-auth not installed — skipping auth');
550550
}
551+
552+
// ADR-0048 — the platform apps (Setup/Studio/Account) moved out of
553+
// plugin-auth's manifest into their own one-app packages. Register each
554+
// after AuthPlugin so they load alongside the auth objects they navigate.
555+
for (const spec of [
556+
['@objectstack/setup', 'createSetupAppPlugin'],
557+
['@objectstack/studio', 'createStudioAppPlugin'],
558+
['@objectstack/account', 'createAccountAppPlugin'],
559+
] as const) {
560+
try {
561+
const mod: any = await import(/* @vite-ignore */ spec[0]);
562+
this.childPlugins.push(mod[spec[1]]());
563+
ctx.logger.info(` ✔ App package enabled (${spec[0]})`);
564+
} catch {
565+
ctx.logger.warn(` ✘ ${spec[0]} not installed — skipping its app`);
566+
}
567+
}
551568
}
552569

553570
// 5. Security Plugin (RBAC, RLS, field-level masking)

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)