Skip to content

feat(crm): add console plugin integration, CLI dev mode, and plugin export#506

Merged
hotlong merged 2 commits intomainfrom
copilot/add-console-integration-example-crm
Feb 14, 2026
Merged

feat(crm): add console plugin integration, CLI dev mode, and plugin export#506
hotlong merged 2 commits intomainfrom
copilot/add-console-integration-example-crm

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

Enable examples/crm to work as both a standalone debuggable app (via CLI) and a reusable plugin for other projects.

CLI Development Modes

  • pnpm devobjectstack serve --dev with auto MemoryDriver, Studio UI, and ConsolePlugin
  • pnpm serve — production mode via CLI, ConsolePlugin loaded from config
  • pnpm start — custom tsx server.ts with explicit auth, logging, full control

Console Integration

ConsolePlugin added to objectstack.config.ts plugins array so the CLI serve command loads the Console UI automatically — no custom server.ts needed for basic usage.

Plugin Export

New plugin.ts with CRMPlugin class and crmConfig raw export, exposed via ./plugin package export:

// As a kernel plugin
import { CRMPlugin } from '@object-ui/example-crm/plugin';
kernel.use(new CRMPlugin());

// For config merging
import { crmConfig } from '@object-ui/example-crm/plugin';

Changes

  • objectstack.config.ts — embed ConsolePlugin in plugins array (uses as any since defineStack schema doesn't include runtime plugins, consistent with objectstack.shared.ts)
  • package.json — add dev script, type: module, ./plugin export path
  • plugin.ts — new CRMPlugin class wrapping CRM metadata as kernel-compatible plugin
  • server.ts — import ConsolePlugin directly from @object-ui/console
  • tsconfig.json — include plugin.ts
Original prompt

我希望example/crm 可以引用@object-ui/console ,使用cli运行,单独调试,也可以编译成插件供别的项目引用,请帮我设计这个开发模式,并且测试确认


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Feb 14, 2026

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

Project Deployment Actions Updated (UTC)
objectui Error Error Feb 14, 2026 6:47am
objectui-demo Error Error Feb 14, 2026 6:47am
objectui-storybook Error Error Feb 14, 2026 6:47am

Request Review

… debugging

- Add ConsolePlugin to objectstack.config.ts plugins array for CLI-based serving
- Add `dev` script for development mode with hot-reload and Studio UI
- Add `plugin.ts` with CRMPlugin class for importing as a plugin in other projects
- Add `./plugin` export path in package.json for plugin consumption
- Update server.ts to import ConsolePlugin directly from @object-ui/console
- Add `type: module` to package.json for ESM compatibility

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add integration of @object-ui/console in example/crm feat(crm): add console plugin integration, CLI dev mode, and plugin export Feb 14, 2026
Copilot AI requested a review from hotlong February 14, 2026 06:47
@hotlong hotlong marked this pull request as ready for review February 14, 2026 06:50
Copilot AI review requested due to automatic review settings February 14, 2026 06:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables examples/crm to run via the ObjectStack CLI with the Console UI auto-loaded, and adds a reusable ./plugin export for consuming CRM metadata (and a plugin wrapper) from other projects.

Changes:

  • Add ConsolePlugin to the CRM stack config so objectstack serve loads the Console UI automatically.
  • Add a new plugin.ts entrypoint exporting CRMPlugin and crmConfig.
  • Update package.json scripts/exports and align server.ts to import ConsolePlugin from @object-ui/console.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
examples/crm/objectstack.config.ts Imports and registers ConsolePlugin in the exported stack config.
examples/crm/package.json Adds type: module, dev script, and ./plugin export.
examples/crm/plugin.ts Adds CRMPlugin wrapper and crmConfig export.
examples/crm/server.ts Switches ConsolePlugin import to @object-ui/console.
examples/crm/tsconfig.json Includes the new plugin.ts in compilation.

Comment on lines +21 to +24
import config from './objectstack.config';

/** Raw CRM stack configuration for direct merging */
export const crmConfig = config;
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

plugin.ts imports and re-exports objectstack.config.ts as crmConfig. Since objectstack.config.ts now includes new ConsolePlugin() (Node-only), any consumer that imports crmConfig/CRMPlugin will also pull in the console’s Node built-ins. If the goal is to share CRM metadata, consider exporting a metadata-only config (no runtime plugins) from ./plugin and keeping runtime UI plugins in a separate Node-only entrypoint.

Copilot uses AI. Check for mistakes.
Comment on lines +690 to +693
},
plugins: [
new ConsolePlugin(),
],
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

objectstack.config.ts now imports ConsolePlugin from @object-ui/console and instantiates it in the exported config. @object-ui/console's plugin implementation imports Node-only built-ins (fs, path, url), and this CRM config is imported in browser contexts (e.g. Storybook’s .storybook/msw-browser.ts imports @object-ui/example-crmobjectstack.config.ts). This will make browser bundling/runtime fail. Consider keeping objectstack.config.ts as pure metadata (objects/apps/manifest) and moving ConsolePlugin to a Node-only runtime config entrypoint (e.g. a separate objectstack.runtime.config.ts used by pnpm dev/serve) or loading the console plugin conditionally so the metadata package remains browser-safe.

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +53
async start(ctx: any) {
const logger = ctx.logger || console;

try {
// Dynamically import AppPlugin to keep plugin.ts dependency-light
const { AppPlugin } = await import('@objectstack/runtime');
const appPlugin = new AppPlugin(config);
await ctx.kernel?.use?.(appPlugin);
logger.info('[CRM] Metadata loaded: objects, apps, dashboards, seed data');
} catch (e: any) {
logger.warn(`[CRM] Could not auto-register via AppPlugin: ${e.message}`);
logger.info('[CRM] Config is available via crmConfig export for manual merging');
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

In start(), await ctx.kernel?.use?.(appPlugin) will silently do nothing when ctx.kernel (or use) is missing, but the code still logs "Metadata loaded" as if registration succeeded. This can lead to false-positive startup logs and a non-functional plugin. Consider validating that ctx.kernel exists and supports use() before logging success; otherwise log a warning/error and return (or throw) so failures are visible.

Copilot uses AI. Check for mistakes.
Copilot AI added a commit to objectstack-ai/hotcrm that referenced this pull request Feb 14, 2026
Reference: objectstack-ai/objectui#506

- Add ConsolePlugin to objectstack.config.ts plugins array
- Add ConsolePlugin to Vercel serverless handler
- Add @object-ui/console ^3.0.1 as devDependency
- Update dev script to use `objectstack serve --dev`
- Add `serve` script for production CLI mode

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@hotlong hotlong merged commit 831f326 into main Feb 14, 2026
7 of 10 checks passed
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.

2 participants