Back to skills
extension
Category: Marketing & GrowthNo API key required

tencent-news

Get 7x24 news updates, focusing on domestic information in China and international hotspots. Supports hot news, morning and evening papers, real-time information, news rankings, and field-specific news queries. It is used when users need to search for news, check news, view hot topics, read morning and evening papers, subscribe to news push notifications, and obtain theme-related news and the latest information.

personAuthor: jakexiaohubclawhub

腾讯新闻内容订阅

通过 tencent-news-cli 获取腾讯新闻内容。

核心原则:基础设施(安装、更新、Key 配置)交给脚本处理;智能体只负责选择子命令和参数——始终先读 help,不要硬编码。

平台约定

| 平台 | 脚本运行方式 | 示例 | |------|------------|------| | macOS / Linux | sh scripts/<name>.sh | sh scripts/cli-state.sh | | Windows | bun scripts/<name>.ts | bun scripts/cli-state.ts |

Windows 需先确保 bun 可用。若不可用:powershell -c "irm bun.sh/install.ps1 | iex",安装后重启终端确认 bun --version

以下所有脚本调用均以 macOS / Linux 为例,Windows 将 .sh 替换为 .tssh 替换为 bun

CLI 命令本身不要依赖 cli-state 返回的模板字符串,直接根据 platform.cliPath 组装:

| 平台 | CLI 命令模板 | |------|-------------| | macOS / Linux | "<cliPath>" <subcommand> [args] | | Windows PowerShell | & "<cliPath>" <subcommand> [args] |

Phase 1:环境就绪

环境已就绪时直接跳到 Phase 2。

1. 状态检查

sh scripts/cli-state.sh

解析返回的 JSON,关注以下字段:

| 字段 | 含义 | |------|------| | platform.cliPath | CLI 完整路径,后续所有命令使用此路径 | | platform.cliSource | global(用户已全局安装)/ local(技能目录下载)/ none(未找到) | | cliExists | CLI 是否存在 | | update.needUpdate | 当前版本是否需要更新 | | update.error | version 检查失败时的错误信息 | | apiKey.present | API Key 是否已配置 | | apiKey.status | configured / missing / error | | apiKey.error | apikey-get 执行异常或输出异常时的错误信息 |

2. 安装 CLI(cliExistsfalse 时)

cliSourceglobal 时跳过此步。

sh scripts/install-cli.sh

若脚本安装失败,引导用户手动安装——参见 references/installation-guide.md

3. 更新 CLI(update.needUpdatetrue,或 CLI 提示版本过旧时)

"<cliPath>" update

Windows PowerShell 使用 & "<cliPath>" update

始终使用 platform.cliPath 组装命令。若 update.error 不为空,先展示错误并让用户处理。

update 命令失败,或错误信息表明当前 CLI 不支持 update(如 unknown commandnot foundnot recognized),立即改为执行安装脚本覆盖:

sh scripts/install-cli.sh --force

Windows:

bun scripts/install-cli.ts --force

解析安装脚本返回的 JSON,并把后续命令切换到新返回的 platform.cliPath。只有覆盖安装也失败时,才引导用户参考 references/update-guide.md 手动处理。

4. 配置 API Key(apiKey.status 不为 configured 时)

  • missing → 引导用户打开 API Key 获取页面 自行获取,不要执行 open / xdg-open / start 等命令自动打开浏览器
  • error → 展示 apiKey.error,让用户先处理(权限、网络、CLI 异常),处理后重试

设置 Key(命令前缀使用 platform.cliPath,KEY 是裸值不加引号):

"<cliPath>" apikey-set KEY

Windows PowerShell 分别使用 & "<cliPath>" apikey-set KEY& "<cliPath>" apikey-get& "<cliPath>" apikey-clear

验证:"<cliPath>" apikey-get 清除(仅用户明确要求时):"<cliPath>" apikey-clear

详见 references/env-setup-guide.md

Phase 2:获取新闻

CLI 更新频繁,子命令和参数可能随版本变化。始终以当前 help 输出为准,不要假设或记忆任何子命令。

  1. 执行 help 使用 platform.cliPath 自行拼命令:macOS / Linux 为 "<cliPath>" help,Windows PowerShell 为 & "<cliPath>" help

  2. 理解意图,映射子命令

    • 单一请求(如"看热点")→ 映射到一个子命令
    • 复合请求(如"看热点、财经和军事新闻")→ 拆解为多个意图,分别映射,依次调用
    • 反馈问题(如"反馈报错,新闻质量不行")→ 使用 feedback 子命令,内容需包含问题现象与上下文
    • help 中无匹配子命令,如实告知用户当前不支持
  3. 执行并输出——按下方格式呈现结果

输出格式

单类型请求

1. **标题文字**

   来源:媒体名称

   摘要内容……

   [查看原文](https://…)

2. **标题文字**

   来源:媒体名称

   摘要内容……

   [查看原文](https://…)

**来源:腾讯新闻**

多类型请求

按类型分组,每组用二级标题标明类别:

## 热点新闻

1. **标题文字**
   ...

2. **标题文字**
   ...

## 财经新闻

1. **标题文字**
   ...

2. **标题文字**
   ...

**来源:腾讯新闻**

通用规则

  • 标题序号. **标题**,序号从 1 开始,多类型时每组序号独立
  • 来源来源: 后跟 CLI 返回的作者或媒体名称;无该字段时省略
  • 摘要:来源下方紧跟;无摘要字段时省略
  • 原文链接:有链接则输出 [查看原文](URL),无则不输出
  • 其他有价值字段(发布时间、标签等)可在来源下方补充
  • 多条新闻间用空行分隔
  • **来源:腾讯新闻** 在所有内容末尾出现一次
  • 某个类型获取失败时,在该分组下说明原因,继续输出其余分组

CLI 执行失败处理

CLI 命令失败后,立即停止,绝不通过 WebSearch 或其他方式获取新闻替代。

  1. CLI 返回非零退出码、超时或输出含权限/安全错误时,不要重试,不要换方式。
  2. 根据错误信息引导用户:
    • macOS Gatekeepercannot be openednot verified)→ 系统设置 → 隐私与安全性 → 「仍要打开」
    • 企业安全软件connection refused、防火墙拦截)→ 安全提示中点击「信任」/「允许」
    • 权限不足permission denied)→ chmod +x <cliPath>
    • 其他 → 展示完整错误,请用户处理
  3. 用户确认操作完成后再重试。即使多次失败,也只能告知无法获取并说明原因,绝不回退到其他信息源。

References