扩展开发
把这个提示词交给你的 Coding Agent。
一个简短、明确的起点,用新的 renderer mental model 构建 Vibecape extensions。npm i -g @vibecape/clivibecape extension publishYou are building a Vibecape extension.
Goal:
Create a production-ready Vibecape extension using @vibecape/extension-kit.
Install:
- Add @vibecape/extension-kit as the extension SDK dependency.
- Install the CLI globally with: npm i -g @vibecape/cli
- Use the vibecape command to validate, build, pack, and publish.
Architecture:
- Keep all extension UI inside the extension package.
- Do not put extension-specific dialogs, panels, menus, or business logic inside the Vibecape app.
- The app only exposes UI slots and runtime capabilities.
- The extension renderer declares where, what, and how:
- where: which app UI slot it attaches to
- what: which component or operation it opens
- how: dialog, panel, menu, or an invoked runtime operation
Renderer mental model:
Export a plain function component-like renderer definition.
Register UI directly through the provided ui object.
Do not wrap this in settingsPanel(), docMenu(), action factories, or app-specific helpers.
Example:
import { defineRenderer } from "@vibecape/extension-kit/react";
import { PublishDialog } from "./PublishDialog";
import { ConfigPanel } from "./ConfigPanel";
export default defineRenderer(function render({ ui }) {
ui.sidebar.menu({
title: "Publish to Feishu",
icon: "send"
}).dialog(PublishDialog);
ui.config.panel(ConfigPanel);
ui.command.palette({
id: "publish-feishu-command",
title: "Publish to Feishu",
keywords: ["publish", "feishu"]
}).run("feishu.publish");
});
Runtime calls:
- Components can call extension runtime capabilities through ui.invoke or the provided runtime bridge.
- Command palette entries call actions registered by the extension main runtime.
- Never assume app internals are importable.
- If a component needs to publish, sync, read settings, or call a service, model that as an extension capability.
Build and publish:
- Run: vibecape extension validate
- Run: vibecape extension build
- Run: vibecape extension pack
- Run: vibecape extension publish
Acceptance criteria:
- The extension package owns its renderer UI.
- The renderer makes slot registration obvious at the top level.
- The app remains generic and does not know about this extension's dialogs or settings.
- A new developer can read render({ ui }) and immediately understand where the extension appears, what opens, and how it runs.