buddy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Buddy Platform

Buddy平台

On-demand cloud infrastructure via
bdy
CLI. Run
bdy <command> --help
for flag details.
通过
bdy
CLI获取按需云基础设施。运行
bdy <command> --help
查看参数详情。

Authentication

身份验证

If any command returns
Token not provided
or
Not logged in
: ask the user to run
bdy login
in a separate terminal (AI cannot do interactive OAuth). To check if user is logged in run
bdy whoami
如果任何命令返回
Token not provided
Not logged in
:请用户在单独的终端中运行
bdy login
(AI无法执行交互式OAuth操作)。要检查用户是否已登录,运行
bdy whoami

Sandbox (
bdy sandbox|sb
)

沙箱(
bdy sandbox|sb

Cloud environments for dynamic apps (servers, databases, background processes).
用于动态应用(服务器、数据库、后台进程)的云环境。

Critical Rules

重要规则

  • Sandboxes must live in a project. Before
    sandbox create
    , check
    bdy whoami
    for a project context and the
    BUDDY_PROJECT
    env var. If neither is set, ask the user (AskUserQuestion) whether to create a new project, then run
    bdy proj link -p <project>
    to attach it.
  • Apps MUST bind to
    0.0.0.0
    (not
    127.0.0.1
    ) for endpoints to work
  • ALWAYS use
    --ignore "node_modules/**" ".git/**"
    when copying projects — install deps on sandbox instead.
  • Preinstalled on Ubuntu 24.04: Node.js 24, Python 3.12, Go 1.25, Git, curl, jq, ripgrep
  • 沙箱必须隶属于某个项目。执行
    sandbox create
    之前,通过
    bdy whoami
    查看项目上下文以及
    BUDDY_PROJECT
    环境变量。如果两者均未设置,请询问用户(AskUserQuestion)是否创建新项目,然后运行
    bdy proj link -p <project>
    进行关联。
  • 应用必须绑定到
    0.0.0.0
    (而非
    127.0.0.1
    )才能使端点正常工作
  • 复制项目时务必使用
    --ignore "node_modules/**" ".git/**"
    ——在沙箱上安装依赖而非本地复制
  • Ubuntu 24.04预安装环境:Node.js 24、Python 3.12、Go 1.25、Git、curl、jq、ripgrep

Workflow

工作流程

  1. Create:
    bdy sandbox create -i <name> --resources 2x4 --wait-for-running
  2. Copy files:
    bdy sandbox cp ./src <name>:/app --ignore "node_modules/**" ".git/**" > /dev/null
  3. Install deps:
    bdy sandbox exec command <name> "cd /app && npm install" --wait
  4. Start app via
    app add
    (NOT exec — gives you status/logs/restart):
    bdy sandbox app add <name> "cd /app && npm start -- -H 0.0.0.0"
  5. Check app:
    bdy sandbox app status <name> <app-id>
    and
    bdy sandbox app logs <name> <app-id>
  6. Add endpoint:
    bdy sandbox endpoint add <name> -n web -e <port>
  7. Show the user the public endpoint URL, then ask via AskUserQuestion if they want to attach a custom domain. Options: claim one of the free domains available in Buddy, buy a new domain, or reuse one already in their workspace. Keep the option labels short — don't put CLI commands in them. After the user picks, run the relevant
    bdy domain
    command and wire it up with
    bdy distro route create
    .
  1. 创建沙箱:
    bdy sandbox create -i <name> --resources 2x4 --wait-for-running
  2. 复制文件:
    bdy sandbox cp ./src <name>:/app --ignore "node_modules/**" ".git/**" > /dev/null
  3. 安装依赖:
    bdy sandbox exec command <name> "cd /app && npm install" --wait
  4. 通过
    app add
    启动应用(不要用exec——该方式可提供状态/日志/重启功能):
    bdy sandbox app add <name> "cd /app && npm start -- -H 0.0.0.0"
  5. 检查应用状态:
    bdy sandbox app status <name> <app-id>
    bdy sandbox app logs <name> <app-id>
  6. 添加端点:
    bdy sandbox endpoint add <name> -n web -e <port>
  7. 向用户展示公开端点URL,然后通过AskUserQuestion询问是否要绑定自定义域名。选项:使用Buddy提供的免费域名、购买新域名、复用工作区中已有的域名。选项标签要简洁——不要包含CLI命令。用户选择后,运行相应的
    bdy domain
    命令,并通过
    bdy distro route create
    完成绑定。

Tips

小贴士

  • Use
    app add
    to start services — NOT
    exec command
    . Apps are managed as systemd services with status, logs, stop, start, restart
  • bdy sandbox app list <name>
    shows running apps with IDs
  • Write config files locally, then
    sandbox cp
    — avoids heredoc escaping issues in exec
  • Use
    sandbox snapshot
    to save/restore sandbox state
  • Use
    bdy distro route create
    for custom domain routing + cdn
  • 使用
    app add
    启动服务——不要
    exec command
    。应用会被作为systemd服务管理,支持状态查看、日志查看、停止、启动、重启操作
  • bdy sandbox app list <name>
    可查看运行中的应用及其ID
  • 在本地编写配置文件,再通过
    sandbox cp
    复制——避免exec中的 heredoc 转义问题
  • 使用
    sandbox snapshot
    保存/恢复沙箱状态
  • 使用
    bdy distro route create
    实现自定义域名路由+CDN

Artifact (
bdy artifact|art
)

制品(
bdy artifact|art

Two types of artifacts:
  • BUCKET (default) — versioned file hosting with public URLs. Use for static sites, build outputs, downloadable files
  • CONTAINER — Docker registry. Use for Docker images. Ask the user to run
    bdy artifact docker login
    in a separate terminal (AI cannot handle interactive credentials), then push/pull with standard
    docker
    commands
两种制品类型:
  • BUCKET(默认)——带版本控制的文件托管服务,提供公开URL。适用于静态站点、构建产物、可下载文件
  • CONTAINER——Docker镜像仓库。适用于Docker镜像。请用户在单独的终端中运行
    bdy artifact docker login
    (AI无法处理交互式凭证),然后使用标准
    docker
    命令进行推送/拉取

BUCKET Workflow

BUCKET工作流程

  1. Build if needed:
    npm run build
  2. Create artifact:
    bdy artifact create <name>
    (default type is BUCKET)
    • Auth is set on creation, not per-version — ask about auth first (HTTP Basic
      -a
      / Buddy
      -b
      / None)
  3. Publish with version:
    bdy artifact publish <name>@1.0.0 ./dist
    • Without version:
      bdy artifact publish <name> ./dist
      → creates
      latest
      version
  4. Get URL:
    bdy artifact version get <name> <version>
  5. Show the user the published URL, then ask via AskUserQuestion if they want to attach a custom domain. Options: claim one of the free domains available in Buddy, buy a new domain, or reuse one already in their workspace. Keep the option labels short — don't put CLI commands in them. After the user picks, run the relevant
    bdy domain
    command and wire it up with
    bdy distro route create
    .
  1. 按需构建:
    npm run build
  2. 创建制品:
    bdy artifact create <name>
    (默认类型为BUCKET)
    • 身份验证在创建时设置,而非按版本设置——先询问验证方式(HTTP Basic
      -a
      / Buddy
      -b
      / 无验证)
  3. 带版本发布:
    bdy artifact publish <name>@1.0.0 ./dist
    • 不带版本:
      bdy artifact publish <name> ./dist
      → 会创建
      latest
      版本
  4. 获取URL:
    bdy artifact version get <name> <version>
  5. 向用户展示已发布的URL,然后通过AskUserQuestion询问是否要绑定自定义域名。选项:使用Buddy提供的免费域名、购买新域名、复用工作区中已有的域名。选项标签要简洁——不要包含CLI命令。用户选择后,运行相应的
    bdy domain
    命令,并通过
    bdy distro route create
    完成绑定。

Critical Rules

重要规则

  • Main HTML file MUST be named
    index.html
    (otherwise serves directory listing)
  • Use
    @
    or
    :
    as version separator:
    my-site@1.0.0
    or
    my-site:1.0.0
  • Use
    --force
    to overwrite an existing version
  • Use
    --create
    to create artifact and publish in one step:
    bdy artifact publish -c <name>@1.0.0 ./dist
  • 主HTML文件必须命名为
    index.html
    (否则会显示目录列表)
  • 使用
    @
    :
    作为版本分隔符:
    my-site@1.0.0
    my-site:1.0.0
  • 使用
    --force
    覆盖已有版本
  • 使用
    --create
    一步完成制品创建和发布:
    bdy artifact publish -c <name>@1.0.0 ./dist

TIPS

小贴士

  • Use
    bdy distro route create
    for custom domain routing + cdn
  • 使用
    bdy distro route create
    实现自定义域名路由+CDN

Tunnel (
bdy tunnel
)

隧道(
bdy tunnel

Expose local services to the internet via secure tunnels.
通过安全隧道将本地服务暴露到互联网。

Critical Rules (MANDATORY)

重要规则(必须遵守)

  • ALWAYS use
    run_in_background: true
    when running tunnel commands — they block execution
  • ALWAYS ask about authentication via AskUserQuestion before creating HTTP tunnels:
    • HTTP Basic Auth →
      -a
    • Buddy Auth →
      --buddy
    • No auth → no flag
  • For Docker: verify the app binds to
    0.0.0.0
  • 运行隧道命令时务必使用
    run_in_background: true
    ——否则会阻塞执行
  • 创建HTTP隧道前务必通过AskUserQuestion询问验证方式:
    • HTTP Basic验证 →
      -a
    • Buddy验证 →
      --buddy
    • 无验证 → 不添加参数
  • 对于Docker应用:确认应用绑定到
    0.0.0.0

Tips

小贴士

  • Save tunnel configs:
    bdy tunnel config add http <name> localhost:<port>
  • Start saved tunnel:
    bdy tunnel start <name>
  • 保存隧道配置:
    bdy tunnel config add http <name> localhost:<port>
  • 启动已保存的隧道:
    bdy tunnel start <name>

Domain (
bdy domain
)

域名(
bdy domain

Search, purchase, and manage custom domains.
bash
bdy domain search <query>     # Search available domains
bdy domain buy <name>         # Purchase a domain
bdy domain list               # List owned domains
Run
bdy domain --help
for full options (TLD filters, sorting, etc.).
搜索、购买和管理自定义域名。
bash
bdy domain search <query>     # 搜索可用域名
bdy domain buy <name>         # 购买域名
bdy domain list               # 列出已拥有的域名
运行
bdy domain --help
查看完整选项(TLD筛选、排序等)。

Distribution (
bdy distro
)

分发服务(
bdy distro

Route traffic across services with custom rules and domains.
通过自定义规则和域名在多个服务间路由流量。

Route Types

路由类型

  • PROXY / PROXY_NO_CACHE — reverse-proxy traffic to a backend. URL shows the distro domain, real paths (
    /foo/bar
    ) are visible and forwarded. Use this for CDN/edge in front of a real app.
  • REDIRECT — HTTP 3xx redirect to another URL. Browser navigates away; final URL shows the target domain.
  • CLOAKING — the distro domain serves a single page that embeds the target as a full-page iframe. URL bar stays on the distro domain regardless of navigation inside the iframe, so the real paths/subpages are never visible
bash
bdy distro create -i <name>                          # Create distribution
bdy distro route create <name> -t PROXY -d <domain>  # Add route
bdy distro route list <name>                          # List routes
Run
bdy distro --help
for full options.
  • PROXY / PROXY_NO_CACHE —— 将流量反向代理到后端。URL显示分发服务域名,真实路径(
    /foo/bar
    )可见并会被转发。适用于在真实应用前部署CDN/边缘节点。
  • REDIRECT —— HTTP 3xx重定向到另一个URL。浏览器会跳转到目标地址;最终URL显示目标域名。
  • CLOAKING —— 分发服务域名提供单个页面,以全屏iframe嵌入目标内容。无论iframe内如何导航,地址栏始终显示分发服务域名,真实路径/子页面永远不可见
bash
bdy distro create -i <name>                          # 创建分发服务
bdy distro route create <name> -t PROXY -d <domain>  # 添加路由
bdy distro route list <name>                          # 列出路由
运行
bdy distro --help
查看完整选项。

Pipeline (
bdy pipeline|pip
)

流水线(
bdy pipeline|pip

CI/CD pipelines for build, test, and deploy automation.
bash
bdy pipeline list                          # List pipelines
bdy pipeline run start <identifier>        # Run a pipeline
bdy pipeline run status <identifier> <id>  # Check run status
bdy pipeline run logs <identifier> <id> <action-id>  # View logs
Run
bdy pipeline --help
for full options (variables, scheduling, YAML config, etc.).
用于构建、测试和部署自动化的CI/CD流水线。
bash
bdy pipeline list                          # 列出流水线
bdy pipeline run start <identifier>        # 启动流水线
bdy pipeline run status <identifier> <id>  # 检查运行状态
bdy pipeline run logs <identifier> <id> <action-id>  # 查看日志
运行
bdy pipeline --help
查看完整选项(变量、调度、YAML配置等)。