cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Tambo 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 template
bash
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
undefined
CLI会检测非交互环境,返回操作指引而非停滞等待:
bash
undefined

In 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 # 使用现有项目

undefined
undefined

Detection Logic

检测逻辑

Non-interactive when ANY of these are true:
  • process.stdin.isTTY
    is false (piped input)
  • process.stdout.isTTY
    is false (piped output)
  • CI
    environment variable is set
  • GITHUB_ACTIONS=true
Override with
FORCE_INTERACTIVE=1
(requires real TTY).
满足以下任一条件时,将进入非交互模式:
  • process.stdin.isTTY
    为 false(管道输入)
  • process.stdout.isTTY
    为 false(管道输出)
  • 设置了
    CI
    环境变量
  • GITHUB_ACTIONS=true
可通过
FORCE_INTERACTIVE=1
强制开启交互模式(需要真实TTY环境)。

Exit Codes

退出码

CodeMeaning
0Success
1Error (network, invalid args, etc.)
2User action required - check stderr for exact command
代码含义
0成功
1错误(网络问题、参数无效等)
2需要用户操作 - 查看stderr获取具体命令

Commands for Agents

面向Agent的命令

Initialize Project

初始化项目

bash
undefined
bash
undefined

Option 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
undefined
npx tambo init --yes --project-name=myapp
undefined

Add 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 conflicts
bash
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

可用组件

ComponentDescription
message-thread-full
Complete message thread with all content and interactions
message-thread-panel
Message thread in a side panel or modal context
message-thread-collapsible
Message threads that can be expanded or collapsed
message
Individual messages with markdown support
message-input
Composes and sends messages in a conversation
message-suggestions
AI-generated suggestions to help users compose responses
control-bar
Controls and actions in the interface
input-fields
Reusable input fields with styles and validation
graph
Visualizes graph-based data structures
form
Collects user input with validation support
map
Interactive map with clustering and heatmap support
canvas-space
Displays rendered components from chat messages
thread-history
Chronological history of a conversation thread
thread-dropdown
Dropdown menu for collapsible chat threads
thread-content
Displays messages within a thread
scrollable-message-container
Container that auto-scrolls to new messages
edit-with-tambo-button
Inline AI editor button for interactable components
elicitation-ui
MCP elicitation UI for user input requests
mcp-components
MCP prompt and resource picker buttons
组件名称描述
message-thread-full
包含全部内容与交互功能的完整消息线程
message-thread-panel
适用于侧边栏或模态框场景的消息线程
message-thread-collapsible
可展开/收起的消息线程
message
支持Markdown的单条消息组件
message-input
用于对话场景的消息输入与发送组件
message-suggestions
生成AI建议以辅助用户撰写回复的组件
control-bar
界面控制与操作栏组件
input-fields
带有样式与验证功能的可复用输入字段
graph
用于可视化图结构数据的组件
form
支持验证的用户输入收集表单组件
map
支持聚类与热力图的交互式地图组件
canvas-space
用于渲染聊天消息中组件的画布区域
thread-history
对话线程的时间历史记录组件
thread-dropdown
可折叠聊天线程的下拉菜单组件
thread-content
显示线程内消息的组件
scrollable-message-container
可自动滚动到最新消息的容器组件
edit-with-tambo-button
用于可交互组件的内嵌AI编辑器按钮
elicitation-ui
用于用户输入请求的MCP引导式UI组件
mcp-components
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 --yes
This 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 --yes
bash
npx tambo list --yes

Create New App

创建新应用

bash
npx tambo create-app my-app --template=standard
bash
npx tambo create-app my-app --template=standard

Authentication

认证

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 components
bash
npx tambo full-send    # 完成包含组件的全套设置

Agent Docs

Agent文档

The CLI auto-creates/updates
AGENTS.md
with Tambo documentation:
bash
npx tambo add form --yes   # Also updates AGENTS.md
The generated section includes CLI commands formatted for non-interactive use.
CLI会自动创建/更新项目中的
AGENTS.md
文件,添加Tambo相关文档:
bash
npx tambo add form --yes   # 同时更新AGENTS.md
生成的文档部分包含适用于非交互模式的格式化CLI命令。

Key Flags Summary

关键参数汇总

FlagCommandsPurpose
--yes
,
-y
init, add, listSkip all prompts
--api-key
initDirect API key input
--project-name
initCreate new project
--project-id
initUse existing project
--no-browser
auth loginOutput URL instead of opening
--dry-run
addPreview without installing
--prefix
add, listCustom component directory
参数适用命令用途
--yes
,
-y
init, add, list跳过所有提示
--api-key
init直接输入API密钥
--project-name
init创建新项目
--project-id
init使用现有项目
--no-browser
auth login输出URL而非自动打开浏览器
--dry-run
add预览更改(不实际安装)
--prefix
add, list指定组件的自定义目录