跳到主要内容

模板拉取

tcb pull 把内置模板或 Git 仓库下载到本地目录,无需登录即可使用。

基本用法​

tcb pull -s <source> [-o <output>] [-f]

参数说明:

参数说明必填
-s, --source <source>模板来源:内置模板名、Git 仓库地址或 zip 地址是
-o, --output <output>输出目录,默认为当前项目目录否
-f, --force覆盖目标目录中的同名文件否

不传 --force 时,目标目录中已存在的文件会被跳过,只复制新文件。

内置模板​

模板说明
miniprogram微信小程序 + CloudBase
reactWeb 应用,React + CloudBase
vueWeb 应用,Vue + CloudBase
uniapp跨端应用,UniApp + CloudBase
rulesAI 规则与配置

使用示例:

# 拉取微信小程序模板
tcb pull -s miniprogram

# 拉取 React 模板到指定目录
tcb pull -s react -o ./my-app

# 覆盖目标目录中的同名文件
tcb pull -s vue -o ./my-app --force

# 查看可用的内置模板
tcb pull list

tcb pull list 列出内置模板和支持的仓库格式:

📋 可用的内置模板:
miniprogram - 微信小程序 + CloudBase
react - Web 应用 - React + CloudBase
vue - Web 应用 - Vue + CloudBase
uniapp - 跨端应用 - UniApp + CloudBase
rules - AI 规则和配置

🌐 支持的 Git 仓库格式:
GitHub: https://github.com/user/repo
Gitee: https://gitee.com/user/repo
CNB: https://cnb.cool/user/repo
SSH: git@github.com:user/repo.git

📁 支持 Git 子目录:
https://github.com/user/repo/tree/main/src/templates

Git 仓库​

--source 接受 GitHub、Gitee、CNB 的 HTTPS 地址和 SSH 地址。地址末尾带 /tree/<分支>/<子目录> 时,只拉取该子目录。

形式示例
GitHubhttps://github.com/user/repo
Giteehttps://gitee.com/user/repo
CNBhttps://cnb.cool/user/repo
SSHgit@github.com:user/repo.git
子目录https://github.com/user/repo/tree/main/src/templates

使用示例:

# 拉取整个仓库
tcb pull -s https://github.com/TencentCloudBase/awesome-cloudbase-examples

# 只拉取仓库中的子目录
tcb pull -s https://github.com/TencentCloudBase/awesome-cloudbase-examples/tree/master/web/overcooked-game

# 拉取 CNB 仓库的子目录到指定目录
tcb pull -s https://cnb.cool/user/repo/tree/main/examples -o ./my-project

--source 也可以直接传 zip 地址,例如 tcb pull -s https://static.cloudbase.net/xxx.zip。

云开发模板中心​

云开发模板中心 的“开源项目”分类收录了可以直接拉取的项目模板。在模板详情页复制 Git 地址后执行 tcb pull:

tcb pull -s https://github.com/example/ai-ecommerce-miniprogram -o ./shop

拉取完成后用 AI IDE 打开项目。接入 CloudBase 的配置步骤见 CloudBase AI Toolkit 快速开始。

命令速查​

命令说明
tcb pull -s <source>拉取内置模板或 Git 仓库
tcb pull -s <source> -o <dir>拉取到指定目录
tcb pull -s <source> --force覆盖目标目录中的同名文件
tcb pull list列出内置模板和支持的仓库格式

注意事项​

  • 模板中已有的 AI IDE MCP 配置文件会被自动改写,指向 CloudBase MCP 服务
  • --force 只覆盖同名文件,不删除目标目录中的其他文件
  • Git 子目录路径一律使用 / 分隔符
  • 仓库必须公开,私有仓库会拉取失败
  • 建议在空目录中拉取模板,避免与已有文件冲突