Install
openclaw skills install @tencentnewsteam/tencent-weather天气信息查询工具,覆盖中国市级和区县级行政区。当用户查询实况天气、天气预报或天气预警信息时使用。
openclaw skills install @tencentnewsteam/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] |
用户直接提出业务问题时,也必须先检查环境。CLI 或 API Key 未就绪时,当前轮停止业务查询,不得只回复“数据加载失败”、原始错误或泛化的“请检查配置”,必须给出可直接操作的指引:
cliExists: false、cliSource: none、cli not found、command not found、not recognized):说明本查询依赖腾讯新闻 CLI,当前设备尚未安装或未被识别;按平台提供安装命令:macOS/Linux 使用 curl -fsSL https://mat1.gtimg.com/qqcdn/qqnews/cli/hub/tencent-news/setup.sh | sh;Windows PowerShell 使用 irm https://mat1.gtimg.com/qqcdn/qqnews/cli/hub/tencent-news/setup.ps1 | iex。提醒安装后重新打开终端并重新提问。apiKey.status: missing、未设置 API Key、API Key not set):说明 CLI 已安装但尚未配置 Key;引导访问 https://news.qq.com/exchange?scene=appkey 获取,然后执行 tencent-news-cli apikey-set YOUR_KEY,再执行 tencent-news-cli apikey-get 验证。API Key 无效、invalid api key、unauthorized、401、403、鉴权/认证失败):不得归因为无数据、额度或普通网络错误;说明当前 Key 无效或无权访问,引导从上述页面重新获取正确 Key,再执行设置和验证命令。apiKey.status: error 或无法解析):先按错误文本匹配以上类型;仍无法判断时,同时给出安装命令及 Key 获取、设置、验证步骤。YOUR_KEY 只能由用户在本地替换;不得索要、代填、回显或记录真实 Key。环境未就绪时不得改用其他数据源。上述基础设施指引优先于业务输出格式限制,但不得展示内部日志、参数、traceid。环境已就绪时直接跳到 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 选择命令
weather 命令(参数 --adcode,不传时按IP 定位默认地区),综合返回按需包含「实况、日升日落、未来天气、生活指数、七日限号(部分限行城市才有)、天气预警(仅当地有生效预警时才出现)」等分段——分段是否出现取决于当次查询结果,不是固定结构;该结论仅供参考,仍需以每次实际的 help weather 输出和实际返回为准,CLI 版本更新后可能变化weather 能力,若综合返回中出现「⚠️ 天气预警」等分段,原样一并展示;未出现该分段则不提及预警tencent-weather-alert skill 处理,一次查询即返回结果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