hotspot-research-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,261 @@
1
+ Metadata-Version: 2.4
2
+ Name: hotspot-research-cli
3
+ Version: 0.1.0
4
+ Summary: Interactive CLI for last30days-safe guided hotspot research reports
5
+ Author: AdvancingTitans
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/AdvancingTitans/hotspot-research-suite
8
+ Project-URL: Repository, https://github.com/AdvancingTitans/hotspot-research-suite
9
+ Project-URL: Issues, https://github.com/AdvancingTitans/hotspot-research-suite/issues
10
+ Keywords: research,cli,hotspot,lark,feishu,agent
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Office/Business
21
+ Classifier: Topic :: Text Processing
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: typer>=0.12
25
+ Requires-Dist: rich>=13.7
26
+ Requires-Dist: PyYAML>=6.0
27
+
28
+ # Hotspot Research CLI
29
+
30
+ 一款跨平台 Python CLI,用交互式问答引导用户通过 `last30days-safe` 选择近 30 天客观热点,并按 `hotspot-research` 结构生成本地研究报告;支持通过 `lark-cli` 将选题简介和报告文件推送到飞书群。分发层已预留微信、钉钉等渠道扩展接口。
31
+
32
+ ## 功能
33
+
34
+ - 交互式分支流程:
35
+ - 有指定领域:直接拉取该领域 TOP10 客观热点。
36
+ - 无指定领域:先拉取 TOP10 主流研究领域,选定领域后再拉取热点。
37
+ - 支持 `refresh` 无限换批,直到用户确认领域/选题。
38
+ - 热点过滤规则:
39
+ - 保留政策、监管、市场数据、融资、学术成果、技术迭代、产品发布、供应链、产业事件等客观赛道热点。
40
+ - 剔除纯网络炒作、短期娱乐八卦、金融投机类热点。
41
+ - 每个候选展示评分、来源类型和数据依据。
42
+ - 报告本地保存:
43
+ - Markdown
44
+ - HTML
45
+ - PDF(若本机 WeasyPrint/native 依赖可用)
46
+ - 飞书推送:
47
+ - 文本简介:`lark-cli im +messages-send`
48
+ - 报告文件:`lark-cli im +messages-send --file`
49
+ - 可选 Drive 备份上传:配置 `upload_folder_token` 后调用 `lark-cli drive +upload`
50
+
51
+ ## 项目结构
52
+
53
+ ```text
54
+ hotspot-cli/
55
+ ├── src/hotspot_cli/
56
+ │ ├── cli.py # Typer/Rich 交互入口
57
+ │ ├── config.py # JSON/YAML 配置管理
58
+ │ ├── hotspots.py # last30days-safe 调用、热点筛选与刷新
59
+ │ ├── report.py # hotspot-research 报告结构与本地文件生成
60
+ │ └── distribution.py # 多渠道分发抽象,内置 LarkChannel
61
+ ├── templates/
62
+ │ └── report-template.md
63
+ ├── tests/
64
+ │ └── test_core.py
65
+ ├── config.example.json
66
+ ├── config.example.yaml
67
+ └── pyproject.toml
68
+ ```
69
+
70
+ ## 安装
71
+
72
+ 建议使用 Python 3.10+。
73
+
74
+ PyPI 发布后可直接安装:
75
+
76
+ ```bash
77
+ pip install hotspot-research-cli
78
+ ```
79
+
80
+ 本地开发安装:
81
+
82
+ ```bash
83
+ cd /Users/yjw/agent/hotspot-research-suite/packages/hotspot-cli
84
+ python3 -m venv .venv
85
+ . .venv/bin/activate
86
+ python -m pip install -e .
87
+ ```
88
+
89
+ 如果使用 macOS 系统 Python 遇到依赖或动态库问题,建议改用 Homebrew Python:
90
+
91
+ ```bash
92
+ /opt/homebrew/bin/python3.12 -m venv .venv
93
+ . .venv/bin/activate
94
+ python -m pip install -e .
95
+ ```
96
+
97
+ ## 启动交互式流程
98
+
99
+ ```bash
100
+ hotspot-research run --output-dir ./reports
101
+ ```
102
+
103
+ 流程:
104
+
105
+ 1. 终端询问:`你是否有想要研究的指定领域?`
106
+ 2. 如果直接输入领域,例如 `人工智能`,CLI 会拉取该领域 TOP10 客观热点。
107
+ 3. 如果直接回车,CLI 会先展示 TOP10 主流研究领域。
108
+ 4. 在领域和热点列表里:
109
+ - 输入序号确认;
110
+ - 输入 `refresh` 换一批;
111
+ - 非法输入会提示并重新询问。
112
+ 5. 确认选题后生成报告,并输出本地绝对路径。
113
+
114
+ ## 飞书配置
115
+
116
+ 首次使用飞书前,先按 `lark-cli` 官方流程配置:
117
+
118
+ ```bash
119
+ lark-cli config init --new
120
+ ```
121
+
122
+ 如需用户身份发送,需要授权:
123
+
124
+ ```bash
125
+ lark-cli auth login --scope "im:message"
126
+ ```
127
+
128
+ Bot 身份通常需要在飞书开发者后台开通 IM 和 Drive 相关权限,并确保机器人在目标群内。
129
+
130
+ ### 交互式配置
131
+
132
+ ```bash
133
+ hotspot-research config lark setup
134
+ ```
135
+
136
+ ### 命令行参数配置
137
+
138
+ ```bash
139
+ hotspot-research config lark setup \
140
+ --chat-id oc_xxxxxxxxxxxxxxxxx \
141
+ --identity bot \
142
+ --message-template '选题:{topic}
143
+ 简介:{summary}
144
+ 本地报告:{report_path}'
145
+ ```
146
+
147
+ 可选:把报告额外上传到云空间指定文件夹:
148
+
149
+ ```bash
150
+ hotspot-research config lark setup \
151
+ --chat-id oc_xxxxxxxxxxxxxxxxx \
152
+ --upload-folder-token fldxxxxxxxxx
153
+ ```
154
+
155
+ ### 查看与重置配置
156
+
157
+ ```bash
158
+ hotspot-research config show
159
+ hotspot-research config reset
160
+ ```
161
+
162
+ 默认配置文件:
163
+
164
+ ```text
165
+ ~/.hotspot-research-cli/config.json
166
+ ```
167
+
168
+ 也可指定配置文件,支持 JSON/YAML:
169
+
170
+ ```bash
171
+ hotspot-research config show --config ./config.example.yaml
172
+ ```
173
+
174
+ ## 生成后推送飞书
175
+
176
+ 生成报告并推送:
177
+
178
+ ```bash
179
+ hotspot-research run --push-lark --output-dir ./reports
180
+ ```
181
+
182
+ 推送已有报告:
183
+
184
+ ```bash
185
+ hotspot-research send ./reports/example.pdf \
186
+ --topic "个人手机智能体" \
187
+ --summary "近30天 AI 手机和移动智能体交汇热点"
188
+ ```
189
+
190
+ ## 异常排查
191
+
192
+ - `last30days-safe 执行失败`:检查网络、GitHub/Reddit/HN/Polymarket 是否可访问。
193
+ - `未获取到符合规则的客观热点`:输入 `refresh`,或换一个更具体的领域。
194
+ - `缺少飞书群 chat_id`:运行 `hotspot-research config lark setup`。
195
+ - `lark-cli 权限不足`:按错误里的 scope 到飞书后台开权限;user 身份需执行 `lark-cli auth login --scope ...`。
196
+ - `报告目录无法写入`:换 `--output-dir` 到有权限的目录。
197
+ - `PDF 未生成`:检查 `/Users/yjw/agent/hotspot-research/scripts/render_pdf_weasy.py`;macOS 通常需要 Homebrew 的 `pango/cairo/glib`。
198
+
199
+ ## 新增微信、钉钉等渠道
200
+
201
+ 新增渠道只需实现 `DistributionChannel`:
202
+
203
+ ```python
204
+ from pathlib import Path
205
+ from hotspot_cli.distribution import DistributionChannel
206
+
207
+
208
+ class DingTalkChannel(DistributionChannel):
209
+ def send(
210
+ self,
211
+ *,
212
+ chat_id: str,
213
+ topic: str,
214
+ summary: str,
215
+ report_path: Path,
216
+ identity: str,
217
+ message_template: str,
218
+ upload_folder_token: str = "",
219
+ ) -> None:
220
+ ...
221
+ ```
222
+
223
+ 注册:
224
+
225
+ ```python
226
+ registry = ChannelRegistry()
227
+ registry.register("dingtalk", DingTalkChannel())
228
+ ```
229
+
230
+ 约束:
231
+
232
+ - 不修改 `HotspotService` 和 `ReportGenerator`。
233
+ - 渠道只负责消息/文件分发。
234
+ - 渠道配置应放入独立 config section,避免污染飞书配置。
235
+ - 所有外部命令都用参数数组调用,避免 shell 拼接。
236
+
237
+ ## 测试
238
+
239
+ ```bash
240
+ cd /Users/yjw/agent/hotspot-research-suite/packages/hotspot-cli
241
+ PYTHONPATH=src python3 -m unittest discover -s tests -v
242
+ ```
243
+
244
+ ## PyPI 发布
245
+
246
+ 包名:`hotspot-research-cli`。
247
+
248
+ 仓库已内置 GitHub Actions Trusted Publishing 工作流:`.github/workflows/publish.yml`。首次发布前,在 PyPI 创建 pending publisher:
249
+
250
+ - Project name: `hotspot-research-cli`
251
+ - Owner: `AdvancingTitans`
252
+ - Repository: `hotspot-research-suite`
253
+ - Workflow: `publish.yml`
254
+ - Environment: `pypi`
255
+
256
+ 确认 PyPI 侧配置完成后,推送 tag 即可触发发布:
257
+
258
+ ```bash
259
+ git tag hotspot-research-cli/v0.1.0
260
+ scripts/push-github.zsh origin hotspot-research-cli/v0.1.0
261
+ ```
@@ -0,0 +1,234 @@
1
+ # Hotspot Research CLI
2
+
3
+ 一款跨平台 Python CLI,用交互式问答引导用户通过 `last30days-safe` 选择近 30 天客观热点,并按 `hotspot-research` 结构生成本地研究报告;支持通过 `lark-cli` 将选题简介和报告文件推送到飞书群。分发层已预留微信、钉钉等渠道扩展接口。
4
+
5
+ ## 功能
6
+
7
+ - 交互式分支流程:
8
+ - 有指定领域:直接拉取该领域 TOP10 客观热点。
9
+ - 无指定领域:先拉取 TOP10 主流研究领域,选定领域后再拉取热点。
10
+ - 支持 `refresh` 无限换批,直到用户确认领域/选题。
11
+ - 热点过滤规则:
12
+ - 保留政策、监管、市场数据、融资、学术成果、技术迭代、产品发布、供应链、产业事件等客观赛道热点。
13
+ - 剔除纯网络炒作、短期娱乐八卦、金融投机类热点。
14
+ - 每个候选展示评分、来源类型和数据依据。
15
+ - 报告本地保存:
16
+ - Markdown
17
+ - HTML
18
+ - PDF(若本机 WeasyPrint/native 依赖可用)
19
+ - 飞书推送:
20
+ - 文本简介:`lark-cli im +messages-send`
21
+ - 报告文件:`lark-cli im +messages-send --file`
22
+ - 可选 Drive 备份上传:配置 `upload_folder_token` 后调用 `lark-cli drive +upload`
23
+
24
+ ## 项目结构
25
+
26
+ ```text
27
+ hotspot-cli/
28
+ ├── src/hotspot_cli/
29
+ │ ├── cli.py # Typer/Rich 交互入口
30
+ │ ├── config.py # JSON/YAML 配置管理
31
+ │ ├── hotspots.py # last30days-safe 调用、热点筛选与刷新
32
+ │ ├── report.py # hotspot-research 报告结构与本地文件生成
33
+ │ └── distribution.py # 多渠道分发抽象,内置 LarkChannel
34
+ ├── templates/
35
+ │ └── report-template.md
36
+ ├── tests/
37
+ │ └── test_core.py
38
+ ├── config.example.json
39
+ ├── config.example.yaml
40
+ └── pyproject.toml
41
+ ```
42
+
43
+ ## 安装
44
+
45
+ 建议使用 Python 3.10+。
46
+
47
+ PyPI 发布后可直接安装:
48
+
49
+ ```bash
50
+ pip install hotspot-research-cli
51
+ ```
52
+
53
+ 本地开发安装:
54
+
55
+ ```bash
56
+ cd /Users/yjw/agent/hotspot-research-suite/packages/hotspot-cli
57
+ python3 -m venv .venv
58
+ . .venv/bin/activate
59
+ python -m pip install -e .
60
+ ```
61
+
62
+ 如果使用 macOS 系统 Python 遇到依赖或动态库问题,建议改用 Homebrew Python:
63
+
64
+ ```bash
65
+ /opt/homebrew/bin/python3.12 -m venv .venv
66
+ . .venv/bin/activate
67
+ python -m pip install -e .
68
+ ```
69
+
70
+ ## 启动交互式流程
71
+
72
+ ```bash
73
+ hotspot-research run --output-dir ./reports
74
+ ```
75
+
76
+ 流程:
77
+
78
+ 1. 终端询问:`你是否有想要研究的指定领域?`
79
+ 2. 如果直接输入领域,例如 `人工智能`,CLI 会拉取该领域 TOP10 客观热点。
80
+ 3. 如果直接回车,CLI 会先展示 TOP10 主流研究领域。
81
+ 4. 在领域和热点列表里:
82
+ - 输入序号确认;
83
+ - 输入 `refresh` 换一批;
84
+ - 非法输入会提示并重新询问。
85
+ 5. 确认选题后生成报告,并输出本地绝对路径。
86
+
87
+ ## 飞书配置
88
+
89
+ 首次使用飞书前,先按 `lark-cli` 官方流程配置:
90
+
91
+ ```bash
92
+ lark-cli config init --new
93
+ ```
94
+
95
+ 如需用户身份发送,需要授权:
96
+
97
+ ```bash
98
+ lark-cli auth login --scope "im:message"
99
+ ```
100
+
101
+ Bot 身份通常需要在飞书开发者后台开通 IM 和 Drive 相关权限,并确保机器人在目标群内。
102
+
103
+ ### 交互式配置
104
+
105
+ ```bash
106
+ hotspot-research config lark setup
107
+ ```
108
+
109
+ ### 命令行参数配置
110
+
111
+ ```bash
112
+ hotspot-research config lark setup \
113
+ --chat-id oc_xxxxxxxxxxxxxxxxx \
114
+ --identity bot \
115
+ --message-template '选题:{topic}
116
+ 简介:{summary}
117
+ 本地报告:{report_path}'
118
+ ```
119
+
120
+ 可选:把报告额外上传到云空间指定文件夹:
121
+
122
+ ```bash
123
+ hotspot-research config lark setup \
124
+ --chat-id oc_xxxxxxxxxxxxxxxxx \
125
+ --upload-folder-token fldxxxxxxxxx
126
+ ```
127
+
128
+ ### 查看与重置配置
129
+
130
+ ```bash
131
+ hotspot-research config show
132
+ hotspot-research config reset
133
+ ```
134
+
135
+ 默认配置文件:
136
+
137
+ ```text
138
+ ~/.hotspot-research-cli/config.json
139
+ ```
140
+
141
+ 也可指定配置文件,支持 JSON/YAML:
142
+
143
+ ```bash
144
+ hotspot-research config show --config ./config.example.yaml
145
+ ```
146
+
147
+ ## 生成后推送飞书
148
+
149
+ 生成报告并推送:
150
+
151
+ ```bash
152
+ hotspot-research run --push-lark --output-dir ./reports
153
+ ```
154
+
155
+ 推送已有报告:
156
+
157
+ ```bash
158
+ hotspot-research send ./reports/example.pdf \
159
+ --topic "个人手机智能体" \
160
+ --summary "近30天 AI 手机和移动智能体交汇热点"
161
+ ```
162
+
163
+ ## 异常排查
164
+
165
+ - `last30days-safe 执行失败`:检查网络、GitHub/Reddit/HN/Polymarket 是否可访问。
166
+ - `未获取到符合规则的客观热点`:输入 `refresh`,或换一个更具体的领域。
167
+ - `缺少飞书群 chat_id`:运行 `hotspot-research config lark setup`。
168
+ - `lark-cli 权限不足`:按错误里的 scope 到飞书后台开权限;user 身份需执行 `lark-cli auth login --scope ...`。
169
+ - `报告目录无法写入`:换 `--output-dir` 到有权限的目录。
170
+ - `PDF 未生成`:检查 `/Users/yjw/agent/hotspot-research/scripts/render_pdf_weasy.py`;macOS 通常需要 Homebrew 的 `pango/cairo/glib`。
171
+
172
+ ## 新增微信、钉钉等渠道
173
+
174
+ 新增渠道只需实现 `DistributionChannel`:
175
+
176
+ ```python
177
+ from pathlib import Path
178
+ from hotspot_cli.distribution import DistributionChannel
179
+
180
+
181
+ class DingTalkChannel(DistributionChannel):
182
+ def send(
183
+ self,
184
+ *,
185
+ chat_id: str,
186
+ topic: str,
187
+ summary: str,
188
+ report_path: Path,
189
+ identity: str,
190
+ message_template: str,
191
+ upload_folder_token: str = "",
192
+ ) -> None:
193
+ ...
194
+ ```
195
+
196
+ 注册:
197
+
198
+ ```python
199
+ registry = ChannelRegistry()
200
+ registry.register("dingtalk", DingTalkChannel())
201
+ ```
202
+
203
+ 约束:
204
+
205
+ - 不修改 `HotspotService` 和 `ReportGenerator`。
206
+ - 渠道只负责消息/文件分发。
207
+ - 渠道配置应放入独立 config section,避免污染飞书配置。
208
+ - 所有外部命令都用参数数组调用,避免 shell 拼接。
209
+
210
+ ## 测试
211
+
212
+ ```bash
213
+ cd /Users/yjw/agent/hotspot-research-suite/packages/hotspot-cli
214
+ PYTHONPATH=src python3 -m unittest discover -s tests -v
215
+ ```
216
+
217
+ ## PyPI 发布
218
+
219
+ 包名:`hotspot-research-cli`。
220
+
221
+ 仓库已内置 GitHub Actions Trusted Publishing 工作流:`.github/workflows/publish.yml`。首次发布前,在 PyPI 创建 pending publisher:
222
+
223
+ - Project name: `hotspot-research-cli`
224
+ - Owner: `AdvancingTitans`
225
+ - Repository: `hotspot-research-suite`
226
+ - Workflow: `publish.yml`
227
+ - Environment: `pypi`
228
+
229
+ 确认 PyPI 侧配置完成后,推送 tag 即可触发发布:
230
+
231
+ ```bash
232
+ git tag hotspot-research-cli/v0.1.0
233
+ scripts/push-github.zsh origin hotspot-research-cli/v0.1.0
234
+ ```
@@ -0,0 +1,44 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "hotspot-research-cli"
7
+ version = "0.1.0"
8
+ description = "Interactive CLI for last30days-safe guided hotspot research reports"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "AdvancingTitans" },
14
+ ]
15
+ keywords = ["research", "cli", "hotspot", "lark", "feishu", "agent"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Intended Audience :: Science/Research",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Office/Business",
27
+ "Topic :: Text Processing",
28
+ ]
29
+ dependencies = [
30
+ "typer>=0.12",
31
+ "rich>=13.7",
32
+ "PyYAML>=6.0",
33
+ ]
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/AdvancingTitans/hotspot-research-suite"
37
+ Repository = "https://github.com/AdvancingTitans/hotspot-research-suite"
38
+ Issues = "https://github.com/AdvancingTitans/hotspot-research-suite/issues"
39
+
40
+ [project.scripts]
41
+ hotspot-research = "hotspot_cli.cli:main"
42
+
43
+ [tool.setuptools.packages.find]
44
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """Interactive hotspot research CLI."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ from .cli import main
2
+
3
+
4
+ if __name__ == "__main__":
5
+ main()