Skip to content

Add plugin-setup to own the platform Setup App - #998

Merged
hotlong merged 2 commits into
mainfrom
copilot/add-plugin-setup-for-platform-app
Mar 31, 2026
Merged

Add plugin-setup to own the platform Setup App#998
hotlong merged 2 commits into
mainfrom
copilot/add-plugin-setup-for-platform-app

Conversation

CopilotAI commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Setup App definition (identity, areas, navigation merge) had no clear owner — scattered between spec and objectql. This adds @objectstack/plugin-setup as a first-class internal plugin (sibling to plugin-auth, plugin-security, plugin-audit) that owns the Setup App lifecycle.

New package: packages/plugins/plugin-setup

  • Setup Areas (setup-areas.ts): Four built-in area skeletons — Administration, Platform, System, AI — with i18n labels, icons, and sort order. Empty by default.
  • Setup App (setup-app.ts): App identity (name, label, icon, branding, setup.access permission). SetupNavContribution type for the contribution API.
  • SetupPlugin (setup-plugin.ts):
    • init → registers setupNav service
    • start → merges contributions into area skeletons, filters empties, registers finalized app via app.com.objectstack.setup service convention
  • 20 tests covering area constants, app defaults, plugin lifecycle, contribution merging, ordering, custom areas, immutability of constants.

Extension model

// Any plugin can contribute to Setup during init:asyncinit(ctx: PluginContext){constsetupNav=ctx.getService<SetupNavService>('setupNav');setupNav.contribute({areaId: SETUP_AREA_IDS.administration,items: [{id: 'nav_users',type: 'object',label: 'Users',objectName: 'sys_user'},],});}

Housekeeping

  • Added @objectstack/plugin-setup to .changeset/config.json fixed group
  • Updated CHANGELOG.md and ROADMAP.md

@vercel

vercelBot commented Mar 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
objectstack-playReadyReadyPreview, CommentMar 31, 2026 2:38am
specReadyReadyPreview, CommentMar 31, 2026 2:38am

Request Review

…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>
CopilotAI changed the title [WIP] Add plugin-setup to own and register the platform Setup AppAdd plugin-setup to own the platform Setup AppMar 31, 2026
CopilotAI requested a review from hotlongMarch 31, 2026 02:42
@hotlong
hotlong marked this pull request as ready for review March 31, 2026 02:52
CopilotAI review requested due to automatic review settings March 31, 2026 02:52
@hotlong
hotlong merged commit cc52e5c into mainMar 31, 2026
5 checks passed

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-setup to 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
FileDescription
ROADMAP.mdMarks Setup App ownership as delivered by @objectstack/plugin-setup.
pnpm-lock.yamlAdds lockfile entries for the new workspace package.
.changeset/config.jsonAdds @objectstack/plugin-setup to the fixed version group.
CHANGELOG.mdNotes the new plugin in the repo-level Unreleased changelog.
packages/plugins/plugin-setup/package.jsonNew plugin package definition, build/test scripts, exports.
packages/plugins/plugin-setup/tsconfig.jsonTS config for building plugin sources.
packages/plugins/plugin-setup/src/setup-areas.tsDefines built-in Setup area skeletons + well-known area IDs.
packages/plugins/plugin-setup/src/setup-app.tsDefines Setup App defaults + contribution type.
packages/plugins/plugin-setup/src/setup-plugin.tsImplements setupNav service and area merge/finalization logic.
packages/plugins/plugin-setup/src/setup-plugin.test.tsUnit tests for constants and plugin lifecycle/merging behavior.
packages/plugins/plugin-setup/src/index.tsPublic exports for plugin + constants/types.
packages/plugins/plugin-setup/README.mdDocuments usage and extension model for contributions.
packages/plugins/plugin-setup/objectstack.config.tsAdds plugin manifest/config for the package.
packages/plugins/plugin-setup/CHANGELOG.mdAdds a package-level changelog entry for the new plugin.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +66 to +84
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',

CopilotAIMar 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +11
# @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.

CopilotAIMar 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +31
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: [],
};

CopilotAIMar 31, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Create plugin-setup to own and finalize the platform Setup App

3 participants

@hotlong