跳到正文
↑↓ 导航↵ 打开esc 关闭

菜单

Agent 指南

面向 AI Agent

beui-vue 提供一套静态、对 agent 友好的接口。安装 beui-vue skill、连接下面的 MCP 服务,或者直接请求注册表端点。编程 agent(Claude、Codex、Cursor、Amp)可以列出组件、获取带全部依赖的源码,并把文件放进用户的 Vue 项目。

Agent skill

这个 skill 让编程 agent 先读取实时注册表,选出最接近的 items[].name 安装名,查看条目内容,再用 shadcn-vue 安装,并基于生成的源码组合界面。希望 agent 选用现成的 beui-vue 组件、而不是自己发明动效控件时,就用它。

Shellterminal
npx skills add stickerwu/beui-vue --skill beui-vue

MCP 服务

最快的方式:连接 beui-vue 的 MCP 服务,agent 就能直接列出、搜索和安装组件。服务地址是 https://beui.stickerwu.net/mcp。

Shellterminal
# Claude Code
claude mcp add --transport http beui-vue https://beui.stickerwu.net/mcp

# Codex
codex mcp add beui-vue --url https://beui.stickerwu.net/mcp

# Amp
amp mcp add beui-vue https://beui.stickerwu.net/mcp

其他客户端:手动加入 MCP 配置。

JSONmcp.json
{
  "mcpServers": {
    "beui-vue": {
      "type": "http",
      "url": "https://beui.stickerwu.net/mcp"
    }
  }
}

工具:list_components、search_components、get_component、get_install_command。服务读取实时注册表,新增组件不需要重新部署就能查到。

端点

  • /llms.txtllms.txt

    llmstxt.org 格式的 Markdown 索引。

    打开
  • /r/index.json注册表索引

    所有可安装组件的 JSON 目录。

    打开
  • /r/{slug}.jsonshadcn-vue 条目

    安装条目,包含每个文件的内容、npm 依赖和用法说明。

Agent 流程

两次请求,然后安装。每个条目都带着它需要的全部文件。

TSagent.ts
// 1. Discover what exists
const index = await fetch('https://beui.stickerwu.net/r/index.json').then((r) => r.json());

// 2. Fetch a component, every file included
const item = await fetch(`https://beui.stickerwu.net/r/${slug}.json`).then((r) => r.json());

// 3. Write files into the user's project
for (const file of item.files) {
  await writeFile(`src/${file.target}`, file.content);
}

// 4. Install external deps
await runShell(['npm', 'install', ...item.dependencies]);

shadcn-vue 流程

shadcn-vue 条目会安装源码文件和依赖包。@beui-vue 已收录进 shadcn-vue 的注册表目录,项目里有 components.json 就能直接用短名称。

Shellterminal
# Registry namespace (shadcn-vue directory)
npx shadcn-vue@latest add @beui-vue/animated-toast-stack

# Direct URL, no namespace needed
npx shadcn-vue@latest add https://beui.stickerwu.net/r/animated-toast-stack.json

条目结构

共享的辅助文件(例如 core/motion.ts 和共享的 styles.css)作为额外文件随条目一起提供,docs 字段说明该导入哪个文件。

JSONr/button-base.json
{
  "name": "button-base",
  "type": "registry:item",
  "title": "Button",
  "description": "Spring-pressed Button plus StatefulButton, MagneticButton, and MetallicButton variants.",
  "categories": ["motion"],
  "dependencies": ["@vueuse/core@^14.0.0", "[email protected]"],
  "files": [
    { "path": "components/beui/ButtonBase.vue", "type": "registry:file", "content": "..." },
    { "path": "components/beui/core/motion.ts", "type": "registry:file", "content": "..." },
    { "path": "components/beui/styles.css", "type": "registry:file", "content": "..." }
  ],
  "meta": { "page": "https://beui.stickerwu.net/components/motion/button/button-base" },
  "docs": "Use it with: import ButtonBase from '@/components/beui/ButtonBase.vue'"
}