@telepat/snoopy 0.1.13 → 0.1.14

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.
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
- <p align="center"><img src="./snoopy-logo.webp" width="128" alt="Snoopy"></p>
1
+ <p align="center"><img src="./assets/avatar/snoopy-logo.webp" width="128" alt="Snoopy"></p>
2
2
  <h1 align="center">Snoopy</h1>
3
- <hr>
4
3
  <p align="center"><em>Sniff out the conversations that matter.</em></p>
5
4
 
6
5
  <p align="center">
7
6
  <a href="https://docs.telepat.io/snoopy">📖 Docs</a>
7
+ · <a href="./README.md">🇺🇸 English</a>
8
+ · <a href="./README.zh-CN.md">🇨🇳 简体中文</a>
8
9
  </p>
9
10
 
10
11
  <p align="center">
@@ -16,267 +17,96 @@
16
17
 
17
18
  Snoopy helps you monitor Reddit for high-intent conversations that match your business goals.
18
19
 
19
- Define what you care about in plain language, let Snoopy create a monitoring job, and continuously scan and qualify posts/comments so you can focus on response and outreach.
20
+ Define what you care about in plain language, let Snoopy create a monitoring job, and continuously scan and qualify posts and comments so you can focus on response and outreach.
20
21
 
21
- ## Why Use Snoopy
22
+ ## What It Solves
22
23
 
23
24
  - Turn broad Reddit traffic into a focused stream of opportunities.
24
25
  - Define qualification logic once, then run continuously.
25
26
  - Trigger manual runs when you want quick validation.
26
- - Track run analytics (discovered/new/qualified items, token usage, cost estimate).
27
+ - Track run analytics (discovered, new, qualified items, token usage, cost estimate).
27
28
  - Run cross-platform with startup-on-reboot support.
28
29
 
29
- ## What It Does
30
-
31
- - Interactive job creation flow from natural-language criteria.
32
- - AI-assisted clarification and job spec generation.
33
- - Qualification against your prompt for posts (and comments when enabled).
34
- - Local SQLite persistence for jobs, runs, and scan items.
35
- - Built-in daemon for scheduled scanning (cron expressions).
36
- - On-demand CSV export of qualified results per job.
37
- - Explicit opt-in startup registration for macOS, Linux, and Windows.
38
- - Health checks via the doctor command.
39
-
40
- ## Install
41
-
42
- Requirements:
43
- - Node.js 20+
44
- - npm 10+
30
+ ## Quick Start
45
31
 
46
- From npm:
32
+ Requirements: Node.js 20+, npm 10+.
47
33
 
48
34
  ```bash
49
35
  npm install -g @telepat/snoopy
50
- snoopy --help
51
- ```
52
-
53
- From source:
54
-
55
- ```bash
56
- npm install
57
- npm run build
58
- npm link
59
- ```
60
-
61
- For first-time onboarding (OpenRouter key setup, first `job add`, and verification), see [Installation & Setup](docs/getting-started/installation.md).
62
-
63
- ## Development
64
-
65
- Run without a global install (contributors):
66
-
67
- ```bash
68
- npm run dev -- --help
69
- ```
70
-
71
- Core validation commands:
72
-
73
- ```bash
74
- npm run lint
75
- npm run build
76
- npm test
77
36
  ```
78
37
 
79
- To refresh coverage locally:
80
-
81
- ```bash
82
- npm test -- --coverage
83
- ```
84
-
85
- ## Releases
86
-
87
- Versioning and changelogs are managed automatically by [release-please](https://github.com/googleapis/release-please).
88
-
89
- **How it works:**
90
- 1. Merge commits to `main` following [Conventional Commits](https://www.conventionalcommits.org/) (`fix:`, `feat:`, `feat!:`, etc.).
91
- 2. release-please maintains an open "Release PR" that accumulates version bumps and CHANGELOG entries.
92
- 3. Merge the Release PR to cut a release: `package.json` version is bumped, `CHANGELOG.md` is updated, a git tag is created, and the package is published to npm automatically.
93
-
94
- **Commit types and semver mapping (while version < 1.0.0):**
95
- - `fix:` → patch bump
96
- - `feat:` → patch bump (minor bump is suppressed pre-1.0)
97
- - `feat!:` or `fix!:` (breaking change) → minor bump (major bump is suppressed pre-1.0)
98
-
99
- No manual `git tag` or `npm version` steps are needed.
100
-
101
- ## Quick Start
102
-
103
- Note:
104
- - Snoopy uses Reddit public JSON endpoints by default.
105
- - Optional Reddit OAuth fallback credentials can be configured in `snoopy settings` for environments where unauthenticated access is blocked.
106
- - `snoopy settings` shows a full settings menu so you can jump directly to any setting and save once.
107
- - If keychain storage is unavailable, configure secrets with environment variables (`SNOOPY_OPENROUTER_API_KEY`, `SNOOPY_REDDIT_CLIENT_SECRET`).
108
-
109
- 1. Start interactive setup and create your first job:
38
+ 1. Create your first monitoring job:
110
39
 
111
40
  ```bash
112
41
  snoopy job add
113
42
  ```
114
43
 
115
- `job add` now runs an immediate first scan after saving the job so you can validate results right away.
116
- Snoopy pauses scheduled scans for that new job during this first run attempt, then enables scheduling when it ends (including interruption/failure cases).
117
-
118
- 2. List jobs:
119
-
120
- ```bash
121
- snoopy jobs list
122
- ```
123
-
124
- 3. Run one job immediately (limit to 5 new items while testing):
44
+ 2. Run a quick test scan:
125
45
 
126
46
  ```bash
127
47
  snoopy job run --limit 5
128
- snoopy job run <jobRef> --limit 5
129
48
  ```
130
49
 
131
- If another run is already active for the same job, Snoopy marks the new attempt as `skipped` with an `already active` message.
132
- Duplicate candidates matching an existing scan item are treated as already scanned and do not fail the run.
133
-
134
- If `<jobRef>` is omitted for `job run`, `job enable`, `job disable`, `job delete`, `start`, `stop`, `errors`, or `results`, Snoopy shows your job list and lets you pick with up/down arrows and Enter.
135
-
136
- 4. View run history:
50
+ 3. Start the background daemon:
137
51
 
138
52
  ```bash
139
- snoopy job runs <jobRef>
140
- ```
141
-
142
- 5. View analytics globally or for one job:
143
-
144
- ```bash
145
- snoopy analytics
146
- snoopy analytics <jobRef>
147
- snoopy analytics --days 7
53
+ snoopy daemon start
148
54
  ```
149
55
 
150
- 6. Browse results in the interactive viewer:
56
+ 4. View results:
151
57
 
152
58
  ```bash
153
59
  snoopy results
154
- snoopy results <jobRef>
155
- ```
156
-
157
- 7. Regenerate qualified results files (all jobs or one job):
158
-
159
- ```bash
160
- snoopy export
161
- snoopy export <jobRef> --json --last-run
162
- ```
163
-
164
- 8. Consume unconsumed qualified results (read-once, most recent first):
165
-
166
- ```bash
167
- snoopy consume
168
- snoopy consume <jobRef> --limit 10
169
- snoopy consume <jobRef> --json --dry-run
170
- ```
171
-
172
- 9. Inspect one run's detailed log output:
173
-
174
- ```bash
175
- snoopy logs
176
- snoopy logs <runId>
177
- snoopy logs <runId> --raw
60
+ snoopy export --json --last-run
178
61
  ```
179
62
 
180
- When `runId` is omitted for `logs`, Snoopy first prompts for a job, then prompts for a run from that job (up/down arrows + Enter).
181
-
182
- 10. Show recent errors for one job:
63
+ For full onboarding, see [Installation & Setup](https://docs.telepat.io/snoopy/getting-started/installation) and [Quick Start](https://docs.telepat.io/snoopy/getting-started/quickstart).
183
64
 
184
- ```bash
185
- snoopy errors <jobRef>
186
- ```
65
+ ## Requirements
187
66
 
188
- 11. Enable daemon mode:
67
+ - Node.js 20+
68
+ - npm 10+
69
+ - macOS, Linux, or Windows
189
70
 
190
- ```bash
191
- snoopy daemon start
192
- snoopy daemon reload
193
- ```
71
+ ## How It Works
194
72
 
195
- ## Most Used Commands
196
-
197
- - `job add`
198
- - `job list`
199
- - `job run [jobRef] --limit <N>`
200
- - `job runs [jobRef]`
201
- - `analytics [jobRef] --days <N>`
202
- - `results [jobRef]`
203
- - `export [jobRef] --csv|--json [--last-run]`
204
- - `consume [jobRef] [--limit <N>] [--json] [--dry-run]`
205
- - `logs [runId]`
206
- - `errors [jobRef] --hours <N>`
207
- - `start [jobRef]` / `stop [jobRef]`
208
- - `delete [jobRef]`
209
- - `daemon start|stop|status`
210
- - `daemon reload`
211
- - `startup status`
212
- - `doctor`
213
-
214
- ## Run Logs
215
-
216
- - Each job run writes a dedicated log file under `~/.snoopy/logs/`.
217
- - Files are named `run-<runId>.log`.
218
- - `snoopy logs` now supports guided selection (job first, then run) and shows a pretty timeline by default with post/comment text snippets, qualification result + justification, and clickable post/comment links.
219
- - Use `snoopy logs [runId] --raw` to print the full raw log file content, including full JSON request/response payloads for Reddit and OpenRouter calls.
220
- - Rich TTY manual runs (`snoopy job run <jobRef>`) show compact multi-line scan blocks with indented fields, clickable links, and qualification justifications.
221
- - In rich terminals, scan field labels are colorized and qualification status is highlighted (`qualified` in green, `not qualified` in red, `pending` in yellow).
222
- - Run logs older than 5 days are deleted automatically on daemon startup and after each job run.
223
- - Deleting a job also deletes all associated per-run log files for that job.
224
-
225
- ## Results Exports
226
-
227
- - Export files are generated on demand with `export`.
228
- - Files are written under `~/.snoopy/results/`.
229
- - Each export writes a timestamped file like `<YYYYMMDD-HHmmss>_<job-slug>.<ext>`.
230
- - Use `--csv` (default) or `--json` to choose output format.
231
- - Use `--last-run` to export only qualified rows from each job's most recent run.
232
- - Export files are regenerated from database truth on each export command.
233
-
234
- ## Live E2E Smoke Test
235
-
236
- Use the built-in smoke harness to verify create -> run(5) -> delete:
73
+ Snoopy uses Reddit public JSON endpoints (with optional OAuth fallback) to scan posts and comments against an AI-assisted qualification prompt. Matches are stored in a local SQLite database. The built-in daemon runs jobs on cron schedules, and results can be exported as CSV or JSON on demand.
237
74
 
238
- ```bash
239
- npm run e2e:smoke
240
- ```
75
+ ## Using With AI Agents
241
76
 
242
- Optional env vars:
243
- - `SNOOPY_E2E_LIMIT` (default `5`)
244
- - `SNOOPY_E2E_SUBREDDITS` (default `startups,entrepreneur`)
245
- - `SNOOPY_E2E_KEEP_JOB=true` to skip cleanup for debugging
77
+ Snoopy is built for headless automation and agent-driven monitoring:
246
78
 
247
- ## Full Documentation
79
+ - **Non-interactive CLI** — Most commands support omitting `<jobRef>` to get an interactive picker, but automation can pass refs directly for zero-prompt execution.
80
+ - **Machine-readable output** — `snoopy export --json --last-run` and `snoopy consume --json` produce structured data for downstream agents.
81
+ - **Direct database access** — SQLite at `~/.snoopy/snoopy.db` (or `$SNOOPY_ROOT_DIR/snoopy.db`) with a documented schema. Agents can insert jobs, query results, and update lifecycle flags directly.
82
+ - **Environment variables** — `SNOOPY_OPENROUTER_API_KEY`, `SNOOPY_REDDIT_CLIENT_SECRET`, and `SNOOPY_ROOT_DIR` remove all interactive credential prompts.
83
+ - **Agent docs** — [Agent Operations](https://docs.telepat.io/snoopy/guides/agent-operations) provides a complete runbook for automation, including SQL schema, lifecycle flags, and recommended workflows.
248
84
 
249
- - [Documentation Index](docs/index.md)
250
- - [Getting Started Overview](docs/getting-started/overview.md)
251
- - [Installation & Setup](docs/getting-started/installation.md)
252
- - [Quick Start](docs/getting-started/quickstart.md)
253
- - [CLI Reference](docs/reference/cli-reference.md)
254
- - [Database Schema](docs/reference/database-schema.md)
255
- - [Agent Operations](docs/guides/agent-operations.md)
256
- - [Scheduling, Cron, Daemon, and Startup](docs/guides/scheduling-and-startup.md)
257
- - [Security and Secret Storage](docs/technical/security.md)
258
- - [E2E Smoke Testing Guide](docs/technical/e2e-testing.md)
259
- - [Contributing](docs/contributing/development.md)
85
+ ## Security And Trust
260
86
 
261
- ## Docs Site
87
+ - Secrets are stored in the OS keychain by default (via `keytar`). Falls back to an encrypted file if keychain is unavailable.
88
+ - Environment variables override stored secrets and are recommended for CI and containerized environments.
89
+ - Reddit OAuth credentials are optional; public JSON endpoints are used by default.
90
+ - Run logs older than 5 days are deleted automatically.
262
91
 
263
- Serve the Docusaurus docs site locally:
92
+ To report a security issue, open a private report through the repository security flow.
264
93
 
265
- ```bash
266
- npm run docs:start
267
- ```
94
+ ## Documentation And Support
268
95
 
269
- Build and preview the static docs site:
96
+ - [Documentation site](https://docs.telepat.io/snoopy)
97
+ - [Installation & Setup](https://docs.telepat.io/snoopy/getting-started/installation)
98
+ - [Quick Start](https://docs.telepat.io/snoopy/getting-started/quickstart)
99
+ - [CLI Reference](https://docs.telepat.io/snoopy/reference/cli-reference)
100
+ - [Agent Operations](https://docs.telepat.io/snoopy/guides/agent-operations)
101
+ - [Scheduling & Daemon](https://docs.telepat.io/snoopy/guides/scheduling-and-startup)
102
+ - [Security](https://docs.telepat.io/snoopy/technical/security)
103
+ - [Repository](https://github.com/telepat-io/snoopy)
104
+ - [npm package](https://www.npmjs.com/package/@telepat/snoopy)
270
105
 
271
- ```bash
272
- npm run docs:build
273
- npm run docs:serve
274
- ```
106
+ ## Contributing
275
107
 
276
- Deploy to GitHub Pages:
108
+ Contributions are welcome. See [Development](https://docs.telepat.io/snoopy/contributing/development) for setup, workflow, and quality gates.
277
109
 
278
- ```bash
279
- GITHUB_OWNER=telepat-io GITHUB_REPO=snoopy npm run docs:deploy
280
- ```
110
+ ## License
281
111
 
282
- Docs changes pushed to `main` under `docs/` or `website/` are also rebuilt and published to GitHub Pages automatically via GitHub Actions.
112
+ MIT. See [LICENSE](./LICENSE).
@@ -0,0 +1,112 @@
1
+ <p align="center"><img src="./assets/avatar/snoopy-logo.webp" width="128" alt="Snoopy"></p>
2
+ <h1 align="center">Snoopy</h1>
3
+ <p align="center"><em>嗅出重要的对话。</em></p>
4
+
5
+ <p align="center">
6
+ <a href="https://docs.telepat.io/snoopy">📖 文档</a>
7
+ · <a href="./README.md">🇺🇸 English</a>
8
+ · <a href="./README.zh-CN.md">🇨🇳 简体中文</a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://github.com/telepat-io/snoopy/actions/workflows/ci.yml"><img src="https://github.com/telepat-io/snoopy/actions/workflows/ci.yml/badge.svg?branch=main" alt="Build"></a>
13
+ <a href="https://codecov.io/gh/telepat-io/snoopy"><img src="https://codecov.io/gh/telepat-io/snoopy/graph/badge.svg" alt="Codecov"></a>
14
+ <a href="https://www.npmjs.com/package/@telepat/snoopy"><img src="https://img.shields.io/npm/v/@telepat/snoopy" alt="npm"></a>
15
+ <a href="https://github.com/telepat-io/snoopy/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="License"></a>
16
+ </p>
17
+
18
+ Snoopy 帮助你监控 Reddit,找到与业务目标高度相关的对话。
19
+
20
+ 用自然语言定义你关心的内容,让 Snoopy 创建监控任务,然后持续扫描和评估帖子和评论,让你专注于回复和外联。
21
+
22
+ ## 它能解决什么问题
23
+
24
+ - 将广泛的 Reddit 流量转化为聚焦的机会流。
25
+ - 一次性定义评估逻辑,然后持续运行。
26
+ - 需要快速验证时触发手动运行。
27
+ - 跟踪运行分析数据(发现、新增、符合条件的项目、token 用量、成本估算)。
28
+ - 跨平台运行,支持开机自启。
29
+
30
+ ## 快速开始
31
+
32
+ 环境要求:Node.js 20+、npm 10+。
33
+
34
+ ```bash
35
+ npm install -g @telepat/snoopy
36
+ ```
37
+
38
+ 1. 创建第一个监控任务:
39
+
40
+ ```bash
41
+ snoopy job add
42
+ ```
43
+
44
+ 2. 运行快速测试扫描:
45
+
46
+ ```bash
47
+ snoopy job run --limit 5
48
+ ```
49
+
50
+ 3. 启动后台守护进程:
51
+
52
+ ```bash
53
+ snoopy daemon start
54
+ ```
55
+
56
+ 4. 查看结果:
57
+
58
+ ```bash
59
+ snoopy results
60
+ snoopy export --json --last-run
61
+ ```
62
+
63
+ 完整入门流程请参阅[安装与设置](https://docs.telepat.io/snoopy/getting-started/installation)和[快速开始](https://docs.telepat.io/snoopy/getting-started/quickstart)。
64
+
65
+ ## 环境要求
66
+
67
+ - Node.js 20+
68
+ - npm 10+
69
+ - macOS、Linux 或 Windows
70
+
71
+ ## 工作原理
72
+
73
+ Snoopy 使用 Reddit 公开 JSON 端点(可选 OAuth 回退)扫描帖子和评论,并通过 AI 辅助的评估提示进行匹配。结果存储在本地 SQLite 数据库中。内置守护进程按 cron 表达式运行任务,结果可按需导出为 CSV 或 JSON。
74
+
75
+ ## 与 AI Agent 一起使用
76
+
77
+ Snoopy 专为无界面自动化和智能体驱动的监控设计:
78
+
79
+ - **非交互式 CLI** — 大多数命令支持省略 `<jobRef>` 以交互式选择,但自动化可以直接传入 ref 实现零提示执行。
80
+ - **机器可读输出** — `snoopy export --json --last-run` 和 `snoopy consume --json` 生成结构化数据,供下游智能体消费。
81
+ - **直接数据库访问** — SQLite 位于 `~/.snoopy/snoopy.db`(或 `$SNOOPY_ROOT_DIR/snoopy.db`),拥有完整文档化的 schema。智能体可以直接插入任务、查询结果并更新生命周期标志。
82
+ - **环境变量** — `SNOOPY_OPENROUTER_API_KEY`、`SNOOPY_REDDIT_CLIENT_SECRET` 和 `SNOOPY_ROOT_DIR` 可移除所有交互式凭证提示。
83
+ - **Agent 文档** — [Agent Operations](https://docs.telepat.io/snoopy/guides/agent-operations) 提供完整的自动化手册,包括 SQL schema、生命周期标志和推荐工作流。
84
+
85
+ ## 安全与信任
86
+
87
+ - 密钥默认保存在 OS 钥匙串中(通过 `keytar`)。如果钥匙串不可用,则回退到加密文件。
88
+ - 环境变量会覆盖已存储的密钥,推荐用于 CI 和容器化环境。
89
+ - Reddit OAuth 凭证为可选;默认使用公开 JSON 端点。
90
+ - 运行日志超过 5 天会自动删除。
91
+
92
+ 如需报告安全问题,请通过仓库安全报告通道私下提交。
93
+
94
+ ## 文档与支持
95
+
96
+ - [文档站点](https://docs.telepat.io/snoopy)
97
+ - [安装与设置](https://docs.telepat.io/snoopy/getting-started/installation)
98
+ - [快速开始](https://docs.telepat.io/snoopy/getting-started/quickstart)
99
+ - [CLI 参考](https://docs.telepat.io/snoopy/reference/cli-reference)
100
+ - [Agent Operations](https://docs.telepat.io/snoopy/guides/agent-operations)
101
+ - [调度与守护进程](https://docs.telepat.io/snoopy/guides/scheduling-and-startup)
102
+ - [安全](https://docs.telepat.io/snoopy/technical/security)
103
+ - [仓库](https://github.com/telepat-io/snoopy)
104
+ - [npm 包](https://www.npmjs.com/package/@telepat/snoopy)
105
+
106
+ ## 贡献
107
+
108
+ 欢迎贡献。请参阅[开发指南](https://docs.telepat.io/snoopy/contributing/development)了解环境搭建、工作流和质量门禁。
109
+
110
+ ## 许可证
111
+
112
+ MIT。详见 [LICENSE](./LICENSE)。
@@ -0,0 +1,18 @@
1
+ export type AgentRuntime = 'claude' | 'claude-desktop' | 'chatgpt' | 'gemini' | 'codex' | 'cursor' | 'vscode' | 'opencode' | 'generic-mcp';
2
+ type AgentInstallResult = {
3
+ runtime: AgentRuntime;
4
+ installed: boolean;
5
+ configPath: string;
6
+ message: string;
7
+ };
8
+ type AgentStatusEntry = {
9
+ runtime: AgentRuntime;
10
+ installed: boolean;
11
+ configPath: string;
12
+ };
13
+ export declare function agentInstall(runtime: string): Promise<AgentInstallResult>;
14
+ export declare function agentUninstall(runtime: string): Promise<AgentInstallResult>;
15
+ export declare function agentStatus(): Promise<{
16
+ runtimes: AgentStatusEntry[];
17
+ }>;
18
+ export {};