cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTambo CLI
Tambo CLI
Agent-friendly CLI for project setup and component management.
适用于项目设置与组件管理的Agent友好型CLI。
Quick Start
快速开始
bash
npx tambo init --api-key=sk_... # Initialize with API key
npx tambo add message-thread-full --yes # Add a component
npx tambo create-app my-app --template=standard # New app from templatebash
npx tambo init --api-key=sk_... # 使用API密钥初始化
npx tambo add message-thread-full --yes # 添加组件
npx tambo create-app my-app --template=standard # 从模板创建新应用Non-Interactive Mode
非交互模式
The CLI detects non-interactive environments and returns guidance instead of hanging:
bash
undefinedCLI会检测非交互环境,返回操作指引而非停滞等待:
bash
undefinedIn CI or piped environments, this returns guidance (exit 2) instead of prompting
在CI或管道环境中,此命令会返回指引(退出码2)而非提示输入
npx tambo init
npx tambo init
Error: Project name required.
错误:需要项目名称。
Run one of:
请运行以下命令之一:
tambo init --project-name=myapp # Create new project
tambo init --project-name=myapp # 创建新项目
tambo init --project-id=abc123 # Use existing project
tambo init --project-id=abc123 # 使用现有项目
undefinedundefinedDetection Logic
检测逻辑
Non-interactive when ANY of these are true:
- is false (piped input)
process.stdin.isTTY - is false (piped output)
process.stdout.isTTY - environment variable is set
CI GITHUB_ACTIONS=true
Override with (requires real TTY).
FORCE_INTERACTIVE=1满足以下任一条件时,将进入非交互模式:
- 为 false(管道输入)
process.stdin.isTTY - 为 false(管道输出)
process.stdout.isTTY - 设置了环境变量
CI GITHUB_ACTIONS=true
可通过强制开启交互模式(需要真实TTY环境)。
FORCE_INTERACTIVE=1Exit Codes
退出码
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (network, invalid args, etc.) |
| 2 | User action required - check stderr for exact command |
| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 1 | 错误(网络问题、参数无效等) |
| 2 | 需要用户操作 - 查看stderr获取具体命令 |
Commands for Agents
面向Agent的命令
Initialize Project
初始化项目
bash
undefinedbash
undefinedOption 1: Direct API key (simplest for agents)
方式1:直接使用API密钥(对Agent最简便)
npx tambo init --api-key=sk_...
npx tambo init --api-key=sk_...
Option 2: Create new project (requires prior auth)
方式2:创建新项目(需先完成认证)
npx tambo init --project-name=myapp
npx tambo init --project-name=myapp
Option 3: Use existing project
方式3:使用现有项目
npx tambo init --project-id=abc123
npx tambo init --project-id=abc123
Skip all prompts with defaults
使用默认配置跳过所有提示
npx tambo init --yes --project-name=myapp
undefinednpx tambo init --yes --project-name=myapp
undefinedAdd Components
添加组件
bash
npx tambo add form --yes # Skip confirmation
npx tambo add form graph --yes # Multiple components
npx tambo add form --prefix=src/components # Custom directory
npx tambo add form --dry-run # Preview changes
npx tambo add form --legacy-peer-deps # For dependency conflictsbash
npx tambo add form --yes # 跳过确认
npx tambo add form graph --yes # 添加多个组件
npx tambo add form --prefix=src/components # 指定自定义目录
npx tambo add form --dry-run # 预览更改(不实际安装)
npx tambo add form --legacy-peer-deps # 处理依赖冲突Component Library
组件库
Browse and preview all components at ui.tambo.co.
可访问 ui.tambo.co 浏览并预览所有组件。
Available Components
可用组件
| Component | Description |
|---|---|
| Complete message thread with all content and interactions |
| Message thread in a side panel or modal context |
| Message threads that can be expanded or collapsed |
| Individual messages with markdown support |
| Composes and sends messages in a conversation |
| AI-generated suggestions to help users compose responses |
| Controls and actions in the interface |
| Reusable input fields with styles and validation |
| Visualizes graph-based data structures |
| Collects user input with validation support |
| Interactive map with clustering and heatmap support |
| Displays rendered components from chat messages |
| Chronological history of a conversation thread |
| Dropdown menu for collapsible chat threads |
| Displays messages within a thread |
| Container that auto-scrolls to new messages |
| Inline AI editor button for interactable components |
| MCP elicitation UI for user input requests |
| MCP prompt and resource picker buttons |
| 组件名称 | 描述 |
|---|---|
| 包含全部内容与交互功能的完整消息线程 |
| 适用于侧边栏或模态框场景的消息线程 |
| 可展开/收起的消息线程 |
| 支持Markdown的单条消息组件 |
| 用于对话场景的消息输入与发送组件 |
| 生成AI建议以辅助用户撰写回复的组件 |
| 界面控制与操作栏组件 |
| 带有样式与验证功能的可复用输入字段 |
| 用于可视化图结构数据的组件 |
| 支持验证的用户输入收集表单组件 |
| 支持聚类与热力图的交互式地图组件 |
| 用于渲染聊天消息中组件的画布区域 |
| 对话线程的时间历史记录组件 |
| 可折叠聊天线程的下拉菜单组件 |
| 显示线程内消息的组件 |
| 可自动滚动到最新消息的容器组件 |
| 用于可交互组件的内嵌AI编辑器按钮 |
| 用于用户输入请求的MCP引导式UI组件 |
| MCP提示与资源选择器按钮组件 |
What You Get
组件包含内容
Each component includes:
- Source code copied to your project (not a dependency)
- Tambo integration pre-configured with hooks
- Styling via Tailwind CSS (customizable)
- TypeScript with full type definitions
每个组件均包含:
- 源代码:直接复制到你的项目中(而非作为依赖)
- Tambo集成:预配置好的钩子函数
- 样式:基于Tailwind CSS(可自定义)
- TypeScript:完整的类型定义
Example: Full Chat Interface
示例:完整聊天界面
bash
npx tambo add message-thread-full control-bar --yesThis adds a complete chat UI with:
- Message history display
- AI-generated component rendering
- Input bar with send button
- Streaming status indicators
bash
npx tambo add message-thread-full control-bar --yes此命令会添加一套完整的聊天UI,包含:
- 消息历史展示
- AI生成组件的渲染
- 带发送按钮的输入栏
- 流式状态指示器
List Components (No Prompts)
列出组件(无提示)
bash
npx tambo list --yesbash
npx tambo list --yesCreate New App
创建新应用
bash
npx tambo create-app my-app --template=standardbash
npx tambo create-app my-app --template=standardAuthentication
认证
bash
npx tambo auth login --no-browser # Prints URL instead of opening browser
npx tambo auth status # Check current auth (no prompts)bash
npx tambo auth login --no-browser # 输出URL而非自动打开浏览器
npx tambo auth status # 检查当前认证状态(无提示)Full Setup (One Command)
完整设置(一键命令)
bash
npx tambo full-send # Complete setup with componentsbash
npx tambo full-send # 完成包含组件的全套设置Agent Docs
Agent文档
The CLI auto-creates/updates with Tambo documentation:
AGENTS.mdbash
npx tambo add form --yes # Also updates AGENTS.mdThe generated section includes CLI commands formatted for non-interactive use.
CLI会自动创建/更新项目中的文件,添加Tambo相关文档:
AGENTS.mdbash
npx tambo add form --yes # 同时更新AGENTS.md生成的文档部分包含适用于非交互模式的格式化CLI命令。
Key Flags Summary
关键参数汇总
| Flag | Commands | Purpose |
|---|---|---|
| init, add, list | Skip all prompts |
| init | Direct API key input |
| init | Create new project |
| init | Use existing project |
| auth login | Output URL instead of opening |
| add | Preview without installing |
| add, list | Custom component directory |
| 参数 | 适用命令 | 用途 |
|---|---|---|
| init, add, list | 跳过所有提示 |
| init | 直接输入API密钥 |
| init | 创建新项目 |
| init | 使用现有项目 |
| auth login | 输出URL而非自动打开浏览器 |
| add | 预览更改(不实际安装) |
| add, list | 指定组件的自定义目录 |