Install
openclaw skills install tencent-weather天气信息查询工具,覆盖中国市级和区县级行政区。当用户查询实况天气、天气预报信息时使用。
openclaw skills install tencent-weather通过 tencent-news-cli 的天气能力完成天气查询。
核心原则:基础设施交给脚本处理;智能体只负责依据当前 CLI 能力选择命令和参数。除
cli-state外,所有 CLI 调用都通过run-cli执行;始终先读help weather,不要硬编码任何业务命令。
| 平台 | 脚本运行方式 | 示例 |
|---|---|---|
| macOS / Linux | sh scripts/<name>.sh | sh scripts/cli-state.sh |
| Windows | powershell scripts/<name>.ps1 | powershell scripts/cli-state.ps1 |
以下所有脚本调用均以 macOS / Linux 为例,Windows 将 .sh 替换为 .ps1,sh 替换为 powershell。
除 cli-state 外,所有 CLI 命令都通过 run-cli 脚本执行:
| 平台 | CLI 调用模板 |
|---|---|
| macOS / Linux | sh scripts/run-cli.sh <command> [args] |
| Windows | powershell scripts/run-cli.ps1 <command> [args] |
环境已就绪时直接跳到 Phase 2。
sh scripts/cli-state.sh
解析返回的 JSON,关注以下字段:
| 字段 | 含义 |
|---|---|
platform.cliPath | 底层实际使用的 CLI 完整路径,供诊断错误或权限问题时参考 |
platform.cliSource | global(优先命中 PATH 中可用的全局命令,否则命中默认全局安装目录)/ local(旧版 skill 目录内安装,兼容兜底)/ none(以上路径都未找到) |
cliExists | CLI 是否存在 |
update.needUpdate | 当前版本是否需要更新 |
update.error | version 检查失败时的错误信息 |
apiKey.present | API Key 是否已配置 |
apiKey.status | configured / missing / error |
apiKey.error | apikey-get 执行异常或输出异常时的错误信息 |
cliExists 为 false 时)仅当
cliSource为none时才需要安装;local表示命中了旧版本地安装,可继续使用但建议后续迁移到全局安装。
按照 references/installation-guide.md 中的安装命令执行安装。
安装成功后重新执行 sh scripts/cli-state.sh(Windows 用 powershell scripts/cli-state.ps1)刷新状态。
若安装失败,参考 references/installation-guide.md 中的故障排查部分,引导用户手动处理。
update.needUpdate 为 true,或 CLI 提示版本过旧时)sh scripts/run-cli.sh update
Windows 使用 powershell scripts/run-cli.ps1 update。
若 update.error 不为空,先展示错误并让用户处理。
若 update 命令失败,或错误信息表明当前 CLI 不支持 update(如 unknown command、not found、not recognized),按上述步骤 2 重新安装。仍然失败时,引导用户参考 references/update-guide.md 手动处理。
apiKey.status 不为 configured 时)missing → 引导用户打开 API Key 获取页面 自行获取,不要执行 open / xdg-open / start 等命令自动打开浏览器error → 展示 apiKey.error,让用户先处理(权限、网络、CLI 异常),处理后重试设置 Key(通过 run-cli 执行,KEY 是裸值不加引号):
sh scripts/run-cli.sh apikey-set KEY
Windows 分别使用 powershell scripts/run-cli.ps1 apikey-set KEY、powershell scripts/run-cli.ps1 apikey-get、powershell scripts/run-cli.ps1 apikey-clear。
验证:sh scripts/run-cli.sh apikey-get
清除(仅用户明确要求时):sh scripts/run-cli.sh apikey-clear
详见 references/env-setup-guide.md。
天气相关命令可能随 CLI 版本变化。始终以当前
help weather输出为准,不要假设或记忆任何业务命令。
先执行 help weather
通过 run-cli 执行:macOS / Linux 为 sh scripts/run-cli.sh help weather,Windows 为 powershell scripts/run-cli.ps1 help weather。
根据 help weather 选择命令
110000help weather 中无匹配命令,如实告知用户当前 CLI 不支持该天气场景执行命令时遵守四条约束
run-cli 脚本,不要直接执行 platform.cliPathhelp weather 展示为准,必要时照抄帮助中的示例110000weather 子命令下的参数缩写或默认值;按帮助输出里的完整用法组装输出结果
优先遵循 CLI 的原始输出形式:
**地点**:深圳
**时间**:今天
**天气**:多云
**温度**:26°C
- 降水:10%
- 风力:东北风 3 级
- 空气质量:优
**来源:腾讯天气**
通用规则:
**来源:腾讯天气**CLI 命令失败后,立即停止,绝不通过 WebSearch 或其他方式自行补做天气查询。
cannot be opened、not verified)→ 系统设置 → 隐私与安全性 → 「仍要打开」connection refused、防火墙拦截)→ 安全提示中点击「信任」/「允许」permission denied)→ chmod +x <cliPath>references/installation-guide.mdreferences/update-guide.mdreferences/env-setup-guide.md