Uh oh!
There was an error while loading. Please reload this page.
Add plugin-setup to own the platform Setup App - #998
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…vigation composition Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/2d62f7a2-3d90-476d-aaa9-178b76bf9517 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
plugin-setup to own the platform Setup AppUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Introduces @objectstack/plugin-setup as the owning implementation for the platform “Setup App”, providing a first-class plugin extension point (setupNav) for other plugins to contribute Setup navigation areas/items.
Changes:
- Added new internal plugin package
packages/plugins/plugin-setup(Setup app defaults, built-in areas, contribution service, merge/finalization logic, tests, docs). - Added
@objectstack/plugin-setupto the Changesets fixed group. - Updated repository documentation/trackers (root
CHANGELOG.md,ROADMAP.md) to reflect the new plugin.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ROADMAP.md | Marks Setup App ownership as delivered by @objectstack/plugin-setup. |
| pnpm-lock.yaml | Adds lockfile entries for the new workspace package. |
| .changeset/config.json | Adds @objectstack/plugin-setup to the fixed version group. |
| CHANGELOG.md | Notes the new plugin in the repo-level Unreleased changelog. |
| packages/plugins/plugin-setup/package.json | New plugin package definition, build/test scripts, exports. |
| packages/plugins/plugin-setup/tsconfig.json | TS config for building plugin sources. |
| packages/plugins/plugin-setup/src/setup-areas.ts | Defines built-in Setup area skeletons + well-known area IDs. |
| packages/plugins/plugin-setup/src/setup-app.ts | Defines Setup App defaults + contribution type. |
| packages/plugins/plugin-setup/src/setup-plugin.ts | Implements setupNav service and area merge/finalization logic. |
| packages/plugins/plugin-setup/src/setup-plugin.test.ts | Unit tests for constants and plugin lifecycle/merging behavior. |
| packages/plugins/plugin-setup/src/index.ts | Public exports for plugin + constants/types. |
| packages/plugins/plugin-setup/README.md | Documents usage and extension model for contributions. |
| packages/plugins/plugin-setup/objectstack.config.ts | Adds plugin manifest/config for the package. |
| packages/plugins/plugin-setup/CHANGELOG.md | Adds a package-level changelog entry for the new plugin. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| async start(ctx: PluginContext): Promise<void> { | ||
| ctx.logger.info('Starting Setup Plugin — finalizing Setup App...'); | ||
| // Merge contributions into area skeletons. | ||
| const areas = this.mergeAreas(this.contributions); | ||
| // Build the final Setup App. | ||
| const setupApp: App = { | ||
| ...SETUP_APP_DEFAULTS, | ||
| areas: areas.length > 0 ? areas : undefined, | ||
| }; | ||
| // Register the finalized Setup App as an internal platform app | ||
| // following the `app.<id>` service convention used by ObjectQLPlugin. | ||
| ctx.registerService('app.com.objectstack.setup', { | ||
| id: 'com.objectstack.setup', | ||
| name: 'Setup', | ||
| version: '1.0.0', | ||
| type: 'plugin', |
There was a problem hiding this comment.
app.com.objectstack.setup is registered in start(), but ObjectQLPlugin only discovers app.* services once during its own start() (it scans ctx.getServices() there). If ObjectQLPlugin starts before SetupPlugin, the Setup App service won't be discovered/registered, and the app may never appear. To make registration order-independent, register the app manifest earlier (during init) or explicitly register the manifest with the ObjectQL engine service after finalizing (e.g. via ctx.getService('objectql').registerApp(...)) instead of relying solely on app.* discovery timing.
| # @objectstack/plugin-setup | ||
| ## 3.3.1 | ||
| ### Added | ||
| - Initial release of the Setup Plugin. | ||
| - Defines the platform Setup App identity (name, label, icon, permissions, branding). | ||
| - Ships 4 built-in Setup Areas: Administration, Platform, System, AI. | ||
| - Provides `setupNav` service for contribution-based navigation composition. | ||
| - Auto-filters empty areas and supports custom area extensions. |
There was a problem hiding this comment.
This package changelog format diverges from the repo’s Changesets-generated package CHANGELOGs (e.g. other plugins use the standard "Patch/Minor Changes" sections and dependency bump lines). Since release automation uses Changesets (pnpm run version / changeset version), this file is likely to be overwritten or become inconsistent. Consider generating/maintaining it via Changesets (and/or aligning the format with other packages/plugins/*/CHANGELOG.md files).
| export const SETUP_APP_DEFAULTS: Omit<App, 'areas'> & { areas: NavigationArea[] } = { | ||
| name: 'setup', | ||
| label: { | ||
| key: 'setup.app.label', | ||
| defaultValue: 'Setup', | ||
| }, | ||
| description: { | ||
| key: 'setup.app.description', | ||
| defaultValue: 'Platform settings and administration', | ||
| }, | ||
| icon: 'settings', | ||
| active: true, | ||
| isDefault: false, | ||
| branding: { | ||
| primaryColor: '#475569', // Slate-600 — neutral admin palette | ||
| }, | ||
| requiredPermissions: ['setup.access'], | ||
| areas: [], | ||
| }; |
There was a problem hiding this comment.
SETUP_APP_DEFAULTS is typed as always having areas, but SetupPlugin conditionally sets areas to undefined at runtime when there are no contributions. Using the stricter { areas: NavigationArea[] } type here can mislead consumers into assuming areas is always present. Consider typing SETUP_APP_DEFAULTS as App (or Omit<App, 'areas'> & { areas?: NavigationArea[] }) to match the actual runtime shape.
Setup App definition (identity, areas, navigation merge) had no clear owner — scattered between spec and objectql. This adds
@objectstack/plugin-setupas a first-class internal plugin (sibling toplugin-auth,plugin-security,plugin-audit) that owns the Setup App lifecycle.New package:
packages/plugins/plugin-setupsetup-areas.ts): Four built-in area skeletons — Administration, Platform, System, AI — with i18n labels, icons, and sort order. Empty by default.setup-app.ts): App identity (name, label, icon, branding,setup.accesspermission).SetupNavContributiontype for the contribution API.setup-plugin.ts):init→ registerssetupNavservicestart→ merges contributions into area skeletons, filters empties, registers finalized app viaapp.com.objectstack.setupservice conventionExtension model
Housekeeping
@objectstack/plugin-setupto.changeset/config.jsonfixed group