SuperAPI AI 工具集

tos-cli

部署与运维

查看项目

更新于 10-16 06:58

技能介绍

用途

tos-cli 用于字节跳动 ByteCloud TOS 对象存储相关的工作。当用户要求 AI 智能体检查、配置、列举、上传、下载、同步、删除对象存储内容等时,可以触发该技能(skill)。它通过一个名为 tos-cli 的命令行二进制文件来执行对象存储操作。

主要能力

资料列出的命令示例涵盖以下操作:列举(ls)、查看对象元数据(stat)、复制/上传(cp)、同步目录(sync)、生成预签名 URL(presign)、查看能力清单(capabilities)、环境诊断(doctor)、查看配置(config show)以及配置初始化与设置(config init、config set)。

使用方式

  1. 可用性检查:在规划命令前先执行 tos-cli --version 检查是否可用;除非用户提供了显式路径,否则使用 PATH 中第一个匹配的可执行文件。若二进制缺失,不要执行存储操作。
  2. 安装:如果 tos-cli --version 失败且用户需要安装帮助,资料建议以下方式之一:
  • cargo install tos-cli
  • npm install -g tos-cli
  • pip install tos-cli
  • brew tap volcengine/ve-storage-uni-cli https://github.com/volcengine/ve-storage-uni-cli
  • brew install tos-cli
  • winget install tos-cli
  • curl -fsSL https://github.com/volcengine/ve-storage-uni-cli/releases/latest/download/install.sh | sh -s -- tos-cli
  1. 安全提示:在执行写入、删除、移动、覆盖、同步、更改配置或暴露签名 URL 的命令前,先阅读 references/safety.md。
  2. 发现能力:
  • tos-cli capabilities --view compact --output json
  • tos-cli doctor --output json
  • tos-cli config show --output json
  1. 连接配置:tos-cli config init 不会选择 region、endpoint 或 PSM。需显式配置 endpoint;可识别的 endpoint 可能提供签名 region,而自定义 endpoint 还需要显式 region。对于 ByteTOS PSM 模式,需同时配置 region 和 PSM,并且不要配置 endpoint。配置示例:
  • tos-cli config set access_key_id <byte-tos-access-key>
  • tos-cli config set secret_access_key <byte-tos-secret-key>
  • tos-cli config set endpoint https://your-bytetos-endpoint.example.com
  • tos-cli config set region cn-beijing
  • 在另一个 profile 中使用 PSM 模式(该 profile 中不含 endpoint):
    • tos-cli config set psm-profile.region cn-beijing
    • tos-cli config set psm-profile.psm toutiao.tos.tosapi 资料说明裸 AK/SK 密钥存储在当前 profile 的 [profile.tos] 凭据段中,与 ve-tos-cli 凭据相互独立。
  1. 常用命令:
  • tos-cli ls tos://bucket/prefix/ --output json
  • tos-cli stat tos://bucket/key --output json
  • tos-cli cp ./file.txt tos://bucket/file.txt --dry-run
  • tos-cli sync ./dir tos://bucket/prefix/ --dry-run
  • tos-cli presign tos://bucket/key --expires 3600 --output json 当不确定标志(flags)时,使用 tos-cli <command> --help。

适用场景

适用于需要 AI 智能体代为检查与操作 ByteCloud TOS 对象存储的场景,例如查看对象、配置连接、上传下载、目录同步、生成预签名 URL 等。

限制

资料未提供可用操作系统平台、权限要求、错误码、配额限制或其他功能细节;除资料列出的命令与配置方式外,不应假定存在其他功能。