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

hotlong merged 2 commits into
mainfrom
copilot/add-plugin-setup-for-platform-app

Conversation

Copilot AI 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:
async init(ctx: PluginContext) {
  const setupNav = 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

vercel Bot commented Mar 31, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Mar 31, 2026 2:38am
spec Ready Ready Preview, Comment Mar 31, 2026 2:38am

Request Review

Copilot AI changed the title [WIP] Add plugin-setup to own and register the platform Setup App Add plugin-setup to own the platform Setup App Mar 31, 2026
Copilot AI requested a review from hotlong March 31, 2026 02:42
@hotlong
hotlong marked this pull request as ready for review March 31, 2026 02:52
Copilot AI review requested due to automatic review settings March 31, 2026 02:52
@hotlong
hotlong merged commit cc52e5c into main Mar 31, 2026
5 checks passed

Copilot AI 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
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

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',

Copilot AI Mar 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.

Copilot AI Mar 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: [],
};

Copilot AI Mar 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.

This branch was successfully deployed

2 active deployments
Preview – objectstack-play — 6fffcda8 Deployed Mar 31, 2026 by vercel[bot]
Preview – spec — 6fffcda8 Deployed Mar 31, 2026 by vercel[bot]
Sign up for free to 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