mcpField
T
tapcart-blocks

tapcart-blocks

github.com/tapcartinc开发246 次安装34 周前更新
代码仓库

关于 tapcart-blocks

tapcart-blocks 是面向 Tapcart 项目中编码 Agent 的操作指南,用于管理 blocks 和全局组件,涵盖创建、同步、版本发布及本地开发服务器。

主要功能

  1. 01创建 block 和组件
  2. 02从 dashboard 拉取资源
  3. 03推送并管理版本
  4. 04运行本地开发服务器

适用场景

  1. 01创建 Tapcart block 或组件
  2. 02同步 dashboard 与本地文件
  3. 03测试修改并管理发布版本

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/tapcartinc/tapcart-agent-skills --skill tapcart-blocks

安装后在 Claude Code 中输入/tapcart-blocks确认已加载。

详细介绍

Tapcart 区块和组件

管理 Tapcart 区块和全局组件。区块和组件的操作完全相同——本技能涵盖两者。所有命令均从 Tapcart 项目目录的根目录运行。

除非另有说明,否则由你(Agent)直接运行所有命令。


创建

运行创建命令,然后向用户确认创建了什么:

# Block
tapcart block create <BlockFolderName>

# Component
tapcart component create <ComponentFolderName>

创建完成后,告知用户如何启动开发服务器(见下文“开发服务器”)。


拉取

运行拉取命令,将 Tapcart 仪表板中的内容同步到本地 ./blocks 或 ./components 文件夹:

# Pull all blocks
tapcart block pull -a

# Pull specific block(s)
tapcart block pull -b MyBlock
tapcart block pull -b BlockOne -b BlockTwo

# Pull a specific version of a block
tapcart block pull -b MyBlock -v 2

# Pull all components
tapcart component pull -a

# Pull specific component(s)
tapcart component pull -c ProductCard
tapcart component pull -c ProductCard -c Button

# Pull a specific version of a component
tapcart component pull -c ProductCard -v 3

限制:

  • -a 不能与 -b/-c 组合使用
  • -v 只能与单个区块/组件名称一起使用

推送

推送前,先阅读本地的 code.jsx 和 config.json,确认更改看起来正确,然后在运行命令前征得用户确认。

# Push a specific block (creates new version, not live)
tapcart block push -b MyBlock

# Push and set the new version live immediately
tapcart block push -b MyBlock --live

# Push multiple blocks
tapcart block push -b BlockOne -b BlockTwo

# Push all blocks
tapcart block push -a

# Push a specific component
tapcart component push -c ProductCard

# Push and set live
tapcart component push -c ProductCard --live

# Push all components
tapcart component push -a

警告:--live 会让新版本立即对所有应用用户可见。默认不使用 --live 进行推送,待用户确认结果后再使用 versions set。


开发服务器

在后台运行开发服务器,并告知用户服务器正在运行。持续运行,直到用户要求停止。

# Block dev server
tapcart block dev -b MyBlock
tapcart block dev -b MyBlock -p 4995   # custom port, default is 4995

# Component dev server
tapcart component dev -c ProductCard
tapcart component dev -c ProductCard -p 4996   # default is 4996

开发服务器会在 http://localhost:<port> 上启动(区块默认端口:4995,组件默认端口:4996)。

用户要求停止开发服务器时,终止该进程。


版本

列出版本

运行以下命令并向用户展示输出:

tapcart block versions list -b MyBlock
tapcart component versions list -c ProductCard

输出会显示每个版本号、哪个版本位于本地,以及哪个版本在仪表板上处于线上状态。

将某个版本设为线上版本

确认用户要将哪个版本设为线上版本,然后运行:

tapcart block versions set -b MyBlock -v 2
tapcart component versions set -c ProductCard -v 3

版本号从 1 开始(版本 1 是首次推送)。

评论

支持 Markdown