Interactive CLI for last30days-safe guided hotspot research reports
Project description
Hotspot Research CLI
一款跨平台 Python CLI,用交互式问答引导用户通过 last30days-safe 选择近 30 天客观热点,并按 hotspot-research 结构生成本地研究报告;支持通过 lark-cli 将选题简介和报告文件推送到飞书群。分发层已预留微信、钉钉等渠道扩展接口。
功能
- 交互式分支流程:
- 有指定领域:直接拉取该领域 TOP10 客观热点。
- 无指定领域:先拉取 TOP10 主流研究领域,选定领域后再拉取热点。
- 支持
refresh无限换批,直到用户确认领域/选题。 - 热点过滤规则:
- 保留政策、监管、市场数据、融资、学术成果、技术迭代、产品发布、供应链、产业事件等客观赛道热点。
- 剔除纯网络炒作、短期娱乐八卦、金融投机类热点。
- 每个候选展示评分、来源类型和数据依据。
- 报告本地保存:
- Markdown
- HTML
- PDF(若本机 WeasyPrint/native 依赖可用)
- 飞书推送:
- 文本简介:
lark-cli im +messages-send - 报告文件:
lark-cli im +messages-send --file - 可选 Drive 备份上传:配置
upload_folder_token后调用lark-cli drive +upload
- 文本简介:
项目结构
hotspot-cli/
├── src/hotspot_cli/
│ ├── cli.py # Typer/Rich 交互入口
│ ├── config.py # JSON/YAML 配置管理
│ ├── hotspots.py # last30days-safe 调用、热点筛选与刷新
│ ├── report.py # hotspot-research 报告结构与本地文件生成
│ └── distribution.py # 多渠道分发抽象,内置 LarkChannel
├── templates/
│ └── report-template.md
├── tests/
│ └── test_core.py
├── config.example.json
├── config.example.yaml
└── pyproject.toml
安装
支持 Python 3.9+。macOS 系统自带 pip3 若绑定 Python 3.9,也可以直接安装 0.1.1 或更新版本。
PyPI 发布后可直接安装:
pip install hotspot-research-cli
如果曾经因为 0.1.0 的 Python 版本限制安装失败,重新执行:
pip3 install --upgrade hotspot-research-cli
本地开发安装:
cd /Users/yjw/agent/hotspot-research-suite/packages/hotspot-cli
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -e .
如果使用 macOS 系统 Python 遇到依赖或动态库问题,建议改用 Homebrew Python:
/opt/homebrew/bin/python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install -e .
启动交互式流程
hotspot-research run --output-dir ./reports
流程:
- 终端询问:
你是否有想要研究的指定领域? - 如果直接输入领域,例如
人工智能,CLI 会拉取该领域 TOP10 客观热点。 - 如果直接回车,CLI 会先展示 TOP10 主流研究领域。
- 在领域和热点列表里:
- 输入序号确认;
- 输入
refresh换一批; - 非法输入会提示并重新询问。
- 确认选题后生成报告,并输出本地绝对路径。
飞书配置
首次使用飞书前,先按 lark-cli 官方流程配置:
lark-cli config init --new
如需用户身份发送,需要授权:
lark-cli auth login --scope "im:message"
Bot 身份通常需要在飞书开发者后台开通 IM 和 Drive 相关权限,并确保机器人在目标群内。
交互式配置
hotspot-research config lark setup
命令行参数配置
hotspot-research config lark setup \
--chat-id oc_xxxxxxxxxxxxxxxxx \
--identity bot \
--message-template '选题:{topic}
简介:{summary}
本地报告:{report_path}'
可选:把报告额外上传到云空间指定文件夹:
hotspot-research config lark setup \
--chat-id oc_xxxxxxxxxxxxxxxxx \
--upload-folder-token fldxxxxxxxxx
查看与重置配置
hotspot-research config show
hotspot-research config reset
默认配置文件:
~/.hotspot-research-cli/config.json
也可指定配置文件,支持 JSON/YAML:
hotspot-research config show --config ./config.example.yaml
生成后推送飞书
生成报告并推送:
hotspot-research run --push-lark --output-dir ./reports
推送已有报告:
hotspot-research send ./reports/example.pdf \
--topic "个人手机智能体" \
--summary "近30天 AI 手机和移动智能体交汇热点"
异常排查
last30days-safe 执行失败:检查网络、GitHub/Reddit/HN/Polymarket 是否可访问。未获取到符合规则的客观热点:输入refresh,或换一个更具体的领域。缺少飞书群 chat_id:运行hotspot-research config lark setup。lark-cli 权限不足:按错误里的 scope 到飞书后台开权限;user 身份需执行lark-cli auth login --scope ...。报告目录无法写入:换--output-dir到有权限的目录。PDF 未生成:检查/Users/yjw/agent/hotspot-research/scripts/render_pdf_weasy.py;macOS 通常需要 Homebrew 的pango/cairo/glib。
新增微信、钉钉等渠道
新增渠道只需实现 DistributionChannel:
from pathlib import Path
from hotspot_cli.distribution import DistributionChannel
class DingTalkChannel(DistributionChannel):
def send(
self,
*,
chat_id: str,
topic: str,
summary: str,
report_path: Path,
identity: str,
message_template: str,
upload_folder_token: str = "",
) -> None:
...
注册:
registry = ChannelRegistry()
registry.register("dingtalk", DingTalkChannel())
约束:
- 不修改
HotspotService和ReportGenerator。 - 渠道只负责消息/文件分发。
- 渠道配置应放入独立 config section,避免污染飞书配置。
- 所有外部命令都用参数数组调用,避免 shell 拼接。
测试
cd /Users/yjw/agent/hotspot-research-suite/packages/hotspot-cli
PYTHONPATH=src python3 -m unittest discover -s tests -v
PyPI 发布
包名:hotspot-research-cli。
仓库已内置 GitHub Actions Trusted Publishing 工作流:.github/workflows/publish.yml。首次发布前,在 PyPI 创建 pending publisher:
- Project name:
hotspot-research-cli - Owner:
AdvancingTitans - Repository:
hotspot-research-suite - Workflow:
publish.yml - Environment:
pypi
确认 PyPI 侧配置完成后,推送 tag 即可触发发布:
git tag hotspot-research-cli/v0.1.0
scripts/push-github.zsh origin hotspot-research-cli/v0.1.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hotspot_research_cli-0.1.1.tar.gz.
File metadata
- Download URL: hotspot_research_cli-0.1.1.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5f9a43bff25410173384fdef10711734cfaaa2fea3595f4b9d5e3149e79da06
|
|
| MD5 |
4bfb9b79ba4db83881a7aa0097f038af
|
|
| BLAKE2b-256 |
bef487b036a896fc8db7b34788d0a49a3a35077315d48db298950e8a8d639416
|
Provenance
The following attestation bundles were made for hotspot_research_cli-0.1.1.tar.gz:
Publisher:
publish.yml on AdvancingTitans/hotspot-research-suite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hotspot_research_cli-0.1.1.tar.gz -
Subject digest:
b5f9a43bff25410173384fdef10711734cfaaa2fea3595f4b9d5e3149e79da06 - Sigstore transparency entry: 1794945328
- Sigstore integration time:
-
Permalink:
AdvancingTitans/hotspot-research-suite@cfea66bc127df84f6c04782bd812dda03964de41 -
Branch / Tag:
refs/tags/hotspot-research-cli/v0.1.1 - Owner: https://github.com/AdvancingTitans
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cfea66bc127df84f6c04782bd812dda03964de41 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hotspot_research_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: hotspot_research_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1476bd8fead21537f20d2ff2c156f72fb1abf836fa16b99c1cde0ae0a3e27fc
|
|
| MD5 |
4f31d31a842168933c89f71ad97f926b
|
|
| BLAKE2b-256 |
3659e436556db0c93562f2fbcd9baa64ddcd94093ff56b0c57efb1a84d8c8553
|
Provenance
The following attestation bundles were made for hotspot_research_cli-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on AdvancingTitans/hotspot-research-suite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hotspot_research_cli-0.1.1-py3-none-any.whl -
Subject digest:
b1476bd8fead21537f20d2ff2c156f72fb1abf836fa16b99c1cde0ae0a3e27fc - Sigstore transparency entry: 1794945488
- Sigstore integration time:
-
Permalink:
AdvancingTitans/hotspot-research-suite@cfea66bc127df84f6c04782bd812dda03964de41 -
Branch / Tag:
refs/tags/hotspot-research-cli/v0.1.1 - Owner: https://github.com/AdvancingTitans
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cfea66bc127df84f6c04782bd812dda03964de41 -
Trigger Event:
push
-
Statement type: