CLI 命令参考
全局参数这些参数可以用于任何
tier0 命令。--json输出原始 JSON--debug打印 HTTP 请求/响应详情基础操作
tier0 doctor诊断本地 Tier0 CLI 连接和认证
用法
tier0 doctor说明
- 检查本地配置、OpenAPI 连通性、API key 是否存在以及 API key 身份。
示例
tier0 doctortier0 config查看或更新配置
用法
tier0 config参数
--base-url- 设置平台 base URL
--api-key- 设置 API key(可替代 tier0 login)
--lang- 已弃用的兼容参数;CLI 输出仅支持英文
示例
tier0 configtier0 config --base-url https://tier0.devtier0 config --api-key sk-per-xxxxxxtier0 login通过 Device Flow 认证
用法
tier0 login参数
--no-wait- 打印授权 URL 后退出,不进行轮询
--setup-code- 使用已有 setup code 轮询,而不是创建新的 setup code
--base-url- 覆盖平台 base URL
说明
- 未使用
--no-wait时,CLI 每 5 秒轮询一次,最长 10 分钟。 - 使用
--no-wait--json时,CLI 会返回verification_url、setup_code和expires_in。
示例
tier0 logintier0 login --no-wait --jsontier0 login --setup-code <setup_code>tier0 api直接调用 API endpoint
用法
tier0 api <endpoint>参数
--body- 请求体 JSON 字符串
--body-file- 从文件读取请求体
--method- HTTP 方法(GET|POST|PUT|DELETE)
--dry-run- 预览请求但不执行
说明
--body和--body-file互斥。
示例
tier0 api /openapi/v1/uns/browse --body '{"path":"/"}'tier0 api /openapi/v1/uns/read --body '{"topics":["demo"]}'tier0 api /openapi/v1/uns/write --body-file body.jsontier0 upgrade将 CLI 升级到最新版本
用法
tier0 upgrade参数
--dry-run- 检查更新但不安装
-v, --version- 升级到指定版本(默认 latest)
示例
tier0 upgradetier0 upgrade --dry-runtier0 uninstall卸载 tier0 CLI
用法
tier0 uninstall参数
--purge- 同时删除配置文件(凭据)
--remove-skills- 同时从检测到的 AI agents 中移除 Tier0 Skill
--keep-skills- 保留 agent skills(已弃用;现在默认如此)
说明
- 默认保留 Agent Skills 和配置。
- CLI 卸载时会删除本地内置 skills 目录。
示例
tier0 uninstalltier0 uninstall --purgetier0 uninstall --remove-skillstier0 uninstall --purge --remove-skillstier0 version显示版本
用法
tier0 version示例
tier0 version技能
tier0 skills install安装或修复 CLI 内置的 Skill
用法
tier0 skills install参数
--force- 用内置基线替换当前启用的 Skill
--no-sync- 仅本地安装,不同步到检测到的 AI agents
示例
tier0 skills installtier0 skills install --forcetier0 skills list列出已安装的 skills别名: ls
用法
tier0 skills list示例
tier0 skills listtier0 skills update将 skills 升级到最新版本别名: upgrade
用法
tier0 skills update参数
--dry-run- 检查更新但不安装
示例
tier0 skills updatetier0 skills update --dry-runtier0 skills version显示 skills 版本信息别名: ver
用法
tier0 skills version示例
tier0 skills versiontier0 skills status显示当前启用和内置 Skill 状态
用法
tier0 skills status示例
tier0 skills statustier0 skills sync将当前启用的 Skill 同步到检测到的 AI agents
用法
tier0 skills sync示例
tier0 skills sync认证
tier0 auth whoami显示当前 API key 身份
用法
tier0 auth whoami说明
- 显示用户、workspace、key 名称、key 类型、角色和权限。
示例
tier0 auth whoamitier0 auth whoami --jsonUNS
tier0 uns browse浏览 UNS namespace 树
用法
tier0 uns browse参数
-p, --path- 要浏览的 UNS 树路径
-d, --max-depth- 最大递归深度(0 = 不限制)
--include-metadata- 包含节点元数据
--include-leaf-value- 包含叶子节点值
示例
tier0 uns browsetier0 uns browse --path /devicestier0 uns browse --path / --max-depth 2tier0 uns search搜索 UNS topics
用法
tier0 uns search参数
-k, --keyword- 按名称关键字搜索
--path-prefix- 按路径前缀过滤
--topic-type- 按 topic type 过滤
--page- 页码
-l, --size- 每页数量(最大结果数)
--include-metadata- 包含节点元数据
--include-leaf-value- 包含叶子节点值
示例
tier0 uns search --keyword temptier0 uns search --path-prefix /devices --size 50tier0 uns search --keyword temp --include-metadatatier0 uns read读取 UNS topics 的当前值
用法
tier0 uns read [topic...]tier0 uns read --topic <topic>参数
-t, --topic- 要读取的 topic 名称(可重复;也接受位置参数)
--include-metadata- 包含 topic 元数据(topicType、fields、description)
--include-leaf-value- 包含叶子节点值
说明
- 必须通过位置参数或
--topic提供至少一个 topic。
示例
tier0 uns read demotier0 uns read --topic demotier0 uns read temp humiditytier0 uns read --topic sensor1 --include-metadatatier0 uns write向 UNS topic 写入值
用法
tier0 uns write参数
-t, --topic- 要写入的 topic 名称(必填)
-v, --value- JSON 值字符串(与 --file 互斥)
-f, --file- 从文件读取值(与 --value 互斥)
--qos- MQTT QoS 等级(0/1/2)
--retain- 设置 MQTT retain flag
--dry-run- 预览请求但不执行
说明
--value和--file互斥。- 值必须是符合 topic fields 的有效 JSON object。
示例
tier0 uns write --topic demo --value '{"temp":25}'tier0 uns write --topic demo --file payload.jsontier0 uns write --topic sensor1 --value '{"on":true}' --qos 1 --retaintier0 uns history查询 topics 历史数据
用法
tier0 uns history参数
-t, --topic- topic 名称(可重复,必填)
--start- 开始时间:相对时间(-1h/-30m/-7d)、ISO 8601 或 'now'(必填)
--end- 结束时间:相对时间、ISO 8601 或 'now'(默认 now)
--page- 页码
-l, --size- 每页数量(最大数据点数)
--interval- 聚合间隔(例如 1m、1h、1d)
--fn- 聚合函数(avg/max/min/sum/count)
--field- 聚合字段名
示例
tier0 uns history -t demo --start -1htier0 uns history -t demo --start -24h --end now --fn avg --interval 1htier0 uns history -t demo --start 2026-01-01T00:00:00Z --end 2026-01-02T00:00:00Ztier0 uns create创建 UNS namespace 节点
用法
tier0 uns create参数
-t, --topic- topic 路径或叶子名称(不使用 --file 时必填)
--parent- 父级路径前缀(可选,会与 --topic 组合)
--type- 节点类型:'path'(文件夹)或 'topic'(数据点)
-d, --display-name- 显示名称
--description- 描述
--alias- 别名
-f, --file- 从 JSON 文件读取 namespace 定义({"namespace":[]} 或裸数组)
--topic-type- 已弃用:topic type 现在由路径推导(叶子节点前的 Metric/Action/State 文件夹)
--fields- schema fields JSON 数组
--fields-file- 从文件读取 schema fields JSON 数组
--dry-run- 预览请求但不执行
说明
- 不使用
--file时,必须提供--topic和--type。 --fields和--fields-file互斥。- 对于 topic 节点,叶子节点前一级路径必须是 Metric、Action 或 State。
示例
tier0 uns create --topic Plant/Line1/Metric/Temperature --type topictier0 uns create --parent Factory1/Line1/Station1 --topic Metric/ProductionCount --type topictier0 uns create --topic Plant/Line1 --type path --display-name 'Line 1'tier0 uns create --file namespace.jsontier0 uns update更新 UNS topic 元数据
用法
tier0 uns update参数
-p, --path- 要更新的 topic 路径(必填)
-n, --name- 新名称
--alias- 新别名
--description- 新描述
--clear-description- 清空描述,不依赖空 shell 参数
-d, --display-name- 新的显示名称
--extend-properties- 扩展属性 JSON 对象
--fields- schema fields JSON 数组
--fields-file- 从文件读取 schema fields JSON 数组
--update-mask- 要更新的字段(可重复,例如 name、description、fields)
--dry-run- 预览请求但不执行
说明
--description和--clear-description互斥。--fields和--fields-file互斥。- 至少需要提供一个要更新的字段。
示例
tier0 uns update --path Plant/Line1/Metric/Temperature --display-name 'Line 1 Temp'tier0 uns update --path Plant/Line1 --description 'Production line 1' --update-mask descriptiontier0 uns update --path Plant/Line1/Metric/Temperature --fields '[{"name":"temp","type":"float","unit":"C"}]' --update-mask fieldstier0 uns delete删除 UNS 节点
用法
tier0 uns delete参数
-p, --path- 要删除的节点路径(可重复,必填)
--hard- 硬删除(不可恢复)
-y, --yes- 确认高风险操作(必填)
--dry-run- 预览请求但不执行
说明
- 默认执行软删除,可以恢复。
--hard不可恢复。- 高风险操作需要
--yes,除非使用--dry-run。
示例
tier0 uns delete --path factory/line1/sensor/temp --yestier0 uns delete --path factory/line1/sensor/temp --path factory/line1/sensor/humi --yestier0 uns delete --path factory/line1/sensor/temp --hard --yestier0 uns restore从历史记录恢复 topic
用法
tier0 uns restore参数
-p, --path- 要恢复的 topic 路径(必填)
-y, --yes- 确认高风险操作(必填)
--dry-run- 预览请求但不执行
说明
- 高风险操作需要
--yes,除非使用--dry-run。
示例
tier0 uns restore --path Plant/Line1/Metric/Temperature --yesNode-RED 流程
tier0 flow list列出 flows别名: ls
用法
tier0 flow list参数
-k, --keyword- 按名称关键字过滤
-t, --type- 按类型过滤(SourceFlow/EventFlow)
--source- 只显示 SourceFlow
--event- 只显示 EventFlow
说明
--source和--event互斥。--type不能与--source或--event同时使用。
示例
tier0 flow listtier0 flow list --source --jsontier0 flow get获取 flow 详情
用法
tier0 flow get --id <id>tier0 flow get <id>参数
--id- Flow ID
说明
- 必须通过
--id或位置参数提供正数 Flow ID。
示例
tier0 flow get --id 1 --jsontier0 flow get 1 --jsontier0 flow create创建新 flow
用法
tier0 flow create参数
-n, --name- Flow 名称(必填)
-t, --type- Flow 类型:SourceFlow | EventFlow(必填)
--source- 设置类型为 SourceFlow
--event- 设置类型为 EventFlow
--desc- 描述
--template- 初始模板 JSON 字符串
--template-file- 从文件读取初始模板
--dry-run- 预览请求但不执行
说明
- 必须且只能使用
--type、--source或--event之一选择 Flow 类型。 --template和--template-file互斥。
示例
tier0 flow create --name "modbus-collector" --source --desc "Modbus TCP collector"tier0 flow create --name "alert-handler" --event --desc "Temperature alarm processor"tier0 flow update更新 flow 元数据
用法
tier0 flow update --id <id>tier0 flow update <id>参数
--id- Flow ID(必填)
-n, --name- 新名称
--desc- 新描述
--template- 新模板 JSON 字符串
--template-file- 从文件读取新模板
--favorite- 标记为收藏
--unfavorite- 取消收藏
--dry-run- 预览请求但不执行
说明
- 必须通过
--id或位置参数提供正数 Flow ID。 --template和--template-file互斥。--favorite和--unfavorite互斥。- 至少需要提供一个要更新的字段。
示例
tier0 flow update --id 1 --name "line1-collector"tier0 flow update --id 1 --favoritetier0 flow data获取 Node-RED canvas JSON
用法
tier0 flow data --id <id>tier0 flow data <id>参数
--id- Flow ID
-o, --out- 保存输出到文件
说明
- 必须通过
--id或位置参数提供正数 Flow ID。
示例
tier0 flow data --id 1 --out flows.jsontier0 flow deploy部署 Node-RED canvas JSON
用法
tier0 flow deploy --id <id>tier0 flow deploy <id>参数
--id- Flow ID(必填)
--flows-json- Node-RED 画布 JSON 字符串
-f, --flows-file- 从文件读取 Node-RED 画布 JSON(推荐)
-y, --yes- 确认高风险操作(必填)
--dry-run- 预览请求但不执行
说明
- 必须通过
--id或位置参数提供正数 Flow ID。 --flows-json和--flows-file互斥。- 部署会替换该 Flow 中所有现有 Node-RED 节点。
- 高风险操作需要
--yes,除非使用--dry-run。
示例
tier0 flow deploy --id 1 -f flows.json --dry-run --jsontier0 flow deploy --id 1 -f flows.json --yestier0 flow delete删除 flow别名: del, rm
用法
tier0 flow delete --id <id>tier0 flow delete <id>[,<id>...]参数
--id- 要删除的 Flow ID(可重复)
-y, --yes- 确认高风险操作(必填)
--dry-run- 预览请求但不执行
说明
- 位置参数可以包含逗号分隔的 Flow ID。
- 删除会停止 Node-RED 容器,且无法撤销。
- 高风险操作需要
--yes,除非使用--dry-run。
示例
tier0 flow delete --id 1 --yestier0 flow nodes列出可用的 Node-RED 节点类型
用法
tier0 flow nodes [source|event]tier0 flow nodes --type <SourceFlow|EventFlow>tier0 flow nodes --sourcetier0 flow nodes --event参数
-t, --type- Flow 类型(SourceFlow/EventFlow)
--source- 显示 SourceFlow 节点
--event- 显示 EventFlow 节点
说明
- 最多接受一个位置参数形式的 Flow 类型。
--source和--event互斥。- 不要将位置参数/类型输入与
--source或--event同时使用。
示例
tier0 flow nodes source --jsontier0 flow nodes --source --jsontier0 flow nodes --event --json文件资源
tier0 assets upload上传文件到 Tier0 object storage
用法
tier0 assets upload <local-file>参数
--business- 业务场景
--use-by- 使用范围:user|workspace|platform
--visibility- 可见性:public|private
--app-instance-id- AI 应用实例 ID
--session-id- AI 会话 ID
--multipart-size- 分片大小(例如 10MB,最小 5MB)
--concurrency- 分片上传并发数(并行分片数量)
--resume- 恢复中断的分片上传
--abort- 中止中断的分片上传并清理其状态
说明
- 必须提供且只能提供一个本地文件参数。
- 超过 100MB 的文件会自动使用分片上传。
- CLI 不强制限制最大文件大小;服务器会按套餐和配额限制处理。
示例
tier0 assets upload ./report.csvtier0 assets upload ./report.csv --visibility public --business attachmenttier0 assets upload ./report.csv --use-by workspace --visibility privatetier0 assets upload ./large-backup.tar.gztier0 assets upload ./large-backup.tar.gz --resumetier0 assets upload ./large-backup.tar.gz --aborttier0 assets upload ./large-backup.tar.gz --multipart-size 20MB --concurrency 8tier0 assets download从 Tier0 object storage 下载文件
用法
tier0 assets download参数
--file-path- 上传返回的文件路径
-o, --output- 输出文件路径(默认 stdout)
--content-disposition- 自定义 Content-Disposition
示例
tier0 assets download --file-path workspace/.../report.csv -o ./report.csvtier0 assets download --file-path workspace/.../report.csvtier0 assets url获取 Tier0 object storage 文件访问 URL
用法
tier0 assets url参数
--file-path- 上传返回的文件路径
--expired-sec- 预签名 URL 过期秒数
--content-disposition- 自定义 Content-Disposition
示例
tier0 assets url --file-path workspace/.../report.csvtier0 assets url --file-path workspace/.../report.csv --expired-sec 300tier0 assets delete删除 Tier0 object storage 文件
用法
tier0 assets delete参数
--file-path- 上传返回的文件路径
-y, --yes- 确认高风险操作(必填)
--dry-run- 预览请求但不执行
说明
- 删除无法撤销。
- 高风险操作需要
--yes,除非使用--dry-run。
示例
tier0 assets delete --file-path workspace/.../report.csv --dry-run --jsontier0 assets delete --file-path workspace/.../report.csv --yes没有匹配的 CLI 命令。