openclaw-github-trending 1.0.0
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/LICENSE +21 -0
- package/README.md +480 -0
- package/dist/channels/email.d.ts +61 -0
- package/dist/channels/email.d.ts.map +1 -0
- package/dist/channels/email.js +599 -0
- package/dist/channels/email.js.map +1 -0
- package/dist/channels/feishu.d.ts +50 -0
- package/dist/channels/feishu.d.ts.map +1 -0
- package/dist/channels/feishu.js +322 -0
- package/dist/channels/feishu.js.map +1 -0
- package/dist/channels/types.d.ts +66 -0
- package/dist/channels/types.d.ts.map +1 -0
- package/dist/channels/types.js +12 -0
- package/dist/channels/types.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/config.d.ts +83 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +145 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/fetcher.d.ts +43 -0
- package/dist/core/fetcher.d.ts.map +1 -0
- package/dist/core/fetcher.js +306 -0
- package/dist/core/fetcher.js.map +1 -0
- package/dist/core/file-storage.d.ts +62 -0
- package/dist/core/file-storage.d.ts.map +1 -0
- package/dist/core/file-storage.js +253 -0
- package/dist/core/file-storage.js.map +1 -0
- package/dist/core/history.d.ts +71 -0
- package/dist/core/history.d.ts.map +1 -0
- package/dist/core/history.js +133 -0
- package/dist/core/history.js.map +1 -0
- package/dist/core/summarizer.d.ts +64 -0
- package/dist/core/summarizer.d.ts.map +1 -0
- package/dist/core/summarizer.js +324 -0
- package/dist/core/summarizer.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +668 -0
- package/dist/index.js.map +1 -0
- package/dist/models/config.d.ts +93 -0
- package/dist/models/config.d.ts.map +1 -0
- package/dist/models/config.js +3 -0
- package/dist/models/config.js.map +1 -0
- package/dist/models/history.d.ts +6 -0
- package/dist/models/history.d.ts.map +1 -0
- package/dist/models/history.js +7 -0
- package/dist/models/history.js.map +1 -0
- package/dist/models/repository.d.ts +28 -0
- package/dist/models/repository.d.ts.map +1 -0
- package/dist/models/repository.js +3 -0
- package/dist/models/repository.js.map +1 -0
- package/dist/models/service.types.d.ts +87 -0
- package/dist/models/service.types.d.ts.map +1 -0
- package/dist/models/service.types.js +3 -0
- package/dist/models/service.types.js.map +1 -0
- package/dist/services/trending.service.d.ts +29 -0
- package/dist/services/trending.service.d.ts.map +1 -0
- package/dist/services/trending.service.js +306 -0
- package/dist/services/trending.service.js.map +1 -0
- package/dist/tool.d.ts +47 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +314 -0
- package/dist/tool.js.map +1 -0
- package/dist/utils/logger.d.ts +77 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +214 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/markdown.d.ts +9 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/markdown.js +40 -0
- package/dist/utils/markdown.js.map +1 -0
- package/openclaw.plugin.json +152 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
# OpenClaw GitHub Trending Plugin
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/openclaw-github-trending)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
English | [简体中文](./README_CN.md)
|
|
7
|
+
|
|
8
|
+
OpenClaw plugin for fetching GitHub trending repositories and pushing to Feishu or Email with AI-powered summaries.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- 🔥 **GitHub Trending** — Fetch trending repositories for today, this week, or this month
|
|
13
|
+
- 🤖 **AI Summaries** — Generate intelligent summaries using OpenAI or Anthropic
|
|
14
|
+
- 📢 **Multi-Channel Push** — Support Feishu and Email notifications
|
|
15
|
+
- 🔄 **Smart Deduplication** — Track repository history and re-push on significant star growth
|
|
16
|
+
- ⏰ **Scheduled Tasks** — Integrate with OpenClaw's task scheduler for automated updates
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
openclaw plugins install openclaw-github-trending
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### ⚠️ Security Notice - Allow Non-Bundled Plugin
|
|
25
|
+
|
|
26
|
+
Since this is a non-official bundled plugin, you need to explicitly allow it in OpenClaw's configuration file after installation, otherwise a security warning will appear at the gateway.
|
|
27
|
+
|
|
28
|
+
1. Open OpenClaw configuration file (usually located at `~/.openclaw/openclaw.json`).
|
|
29
|
+
|
|
30
|
+
2. Add this plugin's ID to the `plugins.allow` list:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"plugins": {
|
|
35
|
+
"allow": [
|
|
36
|
+
"openclaw-github-trending"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This configuration tells OpenClaw to trust and allow loading this plugin. After completing the configuration, the security warning will disappear.
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
### ⚡ Minimal Configuration
|
|
47
|
+
|
|
48
|
+
**Minimum requirement: Only configure a Feishu Webhook URL to run**, the plugin will automatically inherit AI settings from OpenClaw's global configuration:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"plugins": {
|
|
53
|
+
"openclaw-github-trending": {
|
|
54
|
+
"channels": {
|
|
55
|
+
"feishu": {
|
|
56
|
+
"webhook_url": "https://open.feishu.cn/open-apis/bot/v2/hook/xxx"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Complete Configuration Example:**
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"plugins": {
|
|
69
|
+
"enabled": true,
|
|
70
|
+
"allow": [
|
|
71
|
+
// Configure to allow loading this plugin, otherwise the gateway will show warnings when viewing status or restarting.
|
|
72
|
+
"openclaw-github-trending"
|
|
73
|
+
],
|
|
74
|
+
"entries": {
|
|
75
|
+
"openclaw-github-trending": {
|
|
76
|
+
"enabled": true,
|
|
77
|
+
"config": {
|
|
78
|
+
// Optional: AI provider, if not configured, will automatically use OpenClaw's global AI configuration.
|
|
79
|
+
"ai": {
|
|
80
|
+
"provider": "openai",
|
|
81
|
+
"api_key": "sk-sp-xxx",
|
|
82
|
+
"base_url": "https://coding.dashscope.aliyuncs.com/v1",
|
|
83
|
+
"model": "kimi-k2.5"
|
|
84
|
+
},
|
|
85
|
+
// Optional: Maximum concurrency, default 5. Adjust according to your AI model to accelerate summary generation.
|
|
86
|
+
"max_workers": 5,
|
|
87
|
+
// Optional: GitHub personal access token. Frequent calls may trigger rate limits, configuring this can avoid GitHub rate limits. Not recommended as this plugin is not called frequently.
|
|
88
|
+
"github_token": "xxx",
|
|
89
|
+
// Required: Configure at least one channel (Feishu or Email), otherwise you won't receive notifications.
|
|
90
|
+
"channels": {
|
|
91
|
+
"feishu": {
|
|
92
|
+
"webhook_url": "https://open.feishu.cn/open-apis/bot/v2/hook/xxx"
|
|
93
|
+
},
|
|
94
|
+
"email": {
|
|
95
|
+
"smtp_host": "smtp.qq.com",
|
|
96
|
+
"smtp_port": 587,
|
|
97
|
+
"sender": "xxx@qq.com",
|
|
98
|
+
"password": "xxx",
|
|
99
|
+
"recipient": "yyy@qq.com"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
// Optional: Enable history tracking for smart deduplication
|
|
103
|
+
"history": {
|
|
104
|
+
"enabled": true,
|
|
105
|
+
"star_threshold": 100
|
|
106
|
+
},
|
|
107
|
+
// Optional: If your network can directly access GitHub, you don't need to configure a proxy.
|
|
108
|
+
"proxy": {
|
|
109
|
+
"enabled": true,
|
|
110
|
+
"url": "http://127.0.0.1:7897"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**How to Get Feishu Webhook URL:**
|
|
120
|
+
|
|
121
|
+
1. **Create a Feishu Bot:**
|
|
122
|
+
- Create a group chat
|
|
123
|
+
- Click Group Settings → Bot Management
|
|
124
|
+
- Click Group Bot → "Add Bot"
|
|
125
|
+
- Select Custom Bot
|
|
126
|
+
|
|
127
|
+
2. **Configure the Bot:**
|
|
128
|
+
- Name your bot (e.g., "GitHub Trending")
|
|
129
|
+
- Upload an avatar (optional)
|
|
130
|
+
- Add description
|
|
131
|
+
- Click "Add"
|
|
132
|
+
|
|
133
|
+
3. **Get the Webhook URL:**
|
|
134
|
+
- After creation, you'll see a webhook URL in this format:
|
|
135
|
+
```
|
|
136
|
+
https://open.feishu.cn/open-apis/bot/v2/hook/YOUR_WEBHOOK_ID
|
|
137
|
+
```
|
|
138
|
+
- Copy this URL and paste it into your `webhook_url` config
|
|
139
|
+
- **⚠️ Security Note:** Keep this URL private! Anyone with the URL can send messages to your bot.
|
|
140
|
+
|
|
141
|
+
4. **Test the Bot:**
|
|
142
|
+
- Send a test message using curl:
|
|
143
|
+
```bash
|
|
144
|
+
curl -X POST https://open.feishu.cn/open-apis/bot/v2/hook/YOUR_WEBHOOK_ID \
|
|
145
|
+
-H "Content-Type: application/json" \
|
|
146
|
+
-d '{"msg_type":"text","content":{"text":"Test message"}}'
|
|
147
|
+
```
|
|
148
|
+
- You should see the message in your Feishu chat.
|
|
149
|
+
|
|
150
|
+
### 3. Setup Scheduled Tasks or Run Immediately
|
|
151
|
+
|
|
152
|
+
Use the registered `gen-cron` CLI command to quickly set up scheduled tasks or run immediately. Execute the following commands in the **command line**:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
# Run immediately: Fetch today's trending and push to Feishu and Email
|
|
156
|
+
openclaw gen-cron now daily email,feishu
|
|
157
|
+
|
|
158
|
+
# Create scheduled task: Fetch weekly trending every Wednesday at 10:00 AM and push to Feishu
|
|
159
|
+
openclaw gen-cron "0 10 * * 3" weekly feishu
|
|
160
|
+
|
|
161
|
+
# Create scheduled task: Fetch monthly trending on the 1st day of each month at 9:00 AM and push to Email and Feishu
|
|
162
|
+
openclaw gen-cron "0 9 1 * *" monthly email,feishu
|
|
163
|
+
|
|
164
|
+
# Create scheduled task: Fetch daily trending every day at 8:00 AM and push to Email
|
|
165
|
+
openclaw gen-cron "0 8 * * *" daily email
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Command Parameter Explanation:**
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
openclaw gen-cron <mode> <since> <channels>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
| Parameter | Description | Example |
|
|
175
|
+
|-----------|-------------|---------|
|
|
176
|
+
| `mode` | Execution mode: `now` for immediate execution, or Cron expression (format: minute hour day month weekday) | `now`<br>`"0 10 * * 3"` |
|
|
177
|
+
| `since` | Trending period: `daily` (today), `weekly` (this week), `monthly` (this month) | `daily` |
|
|
178
|
+
| `channels` | Push channels: `email`, `feishu`, or `email,feishu` (multiple channels separated by comma) | `feishu`<br>`email,feishu` |
|
|
179
|
+
|
|
180
|
+
**Cron Expression Format:**
|
|
181
|
+
- Format: `minute(0-59) hour(0-23) day(1-31) month(1-12) weekday(0-7, 0 and 7 are Sunday)`
|
|
182
|
+
- Timezone: **Uses server local time** (usually system time)
|
|
183
|
+
|
|
184
|
+
**Common Cron Examples:**
|
|
185
|
+
- `"0 8 * * *"` - Every day at 8:00 AM
|
|
186
|
+
- `"0 10 * * 3"` - Every Wednesday at 10:00 AM
|
|
187
|
+
- `"0 9 1 * *"` - 1st day of each month at 9:00 AM
|
|
188
|
+
|
|
189
|
+
> ⚠️ **Note**: The `gen-cron` command **must be executed in the command line**, not in OpenClaw chat interface.
|
|
190
|
+
>
|
|
191
|
+
> - **Command line**: Run directly in terminal `openclaw gen-cron ...`
|
|
192
|
+
> - **OpenClaw chat**: To use in chat, you need the full `openclaw cron add` command (see below)
|
|
193
|
+
|
|
194
|
+
#### Setting Up Tasks in OpenClaw Chat
|
|
195
|
+
|
|
196
|
+
If you want to set up tasks in OpenClaw chat interface, use the full `cron add` command:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Paste the following command in OpenClaw chat (need to escape quotes first)
|
|
200
|
+
|
|
201
|
+
# Every Wednesday at 10:00 AM, fetch weekly trending and push to Feishu and Email
|
|
202
|
+
openclaw cron add --name "GitHub Trending Weekly Feishu+Email" \
|
|
203
|
+
--cron "0 10 * * 3" \
|
|
204
|
+
--system-event '{"tool":"openclaw-github-trending","params":{"since":"weekly","channels":["feishu","email"]}}'
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### 🗣️ Natural Language Task Creation
|
|
208
|
+
|
|
209
|
+
**Create scheduled tasks through natural conversation with OpenClaw**, without memorizing complex command formats. The plugin supports intelligent parsing of natural language instructions to automatically generate and execute scheduled tasks.
|
|
210
|
+
|
|
211
|
+
**Usage:**
|
|
212
|
+
|
|
213
|
+
Simply describe your needs in natural language in the OpenClaw chat interface:
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
Help me create a scheduled task that pushes GitHub monthly trending to my email every day at 18:45
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Supported Natural Language Examples:**
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
// Daily Push
|
|
223
|
+
- "Help me create a task to push GitHub daily trending to my email every morning at 8:00"
|
|
224
|
+
- "I want to receive GitHub daily trending in my email every day at 18:45"
|
|
225
|
+
- "Create a scheduled task: fetch daily trending every day at 9:00 AM and push to Feishu"
|
|
226
|
+
|
|
227
|
+
// Weekly Push
|
|
228
|
+
- "Help me create a task to push GitHub weekly trending to Feishu every Monday at 10:00"
|
|
229
|
+
- "I want to receive weekly trending in Feishu and email every Friday at 18:00"
|
|
230
|
+
- "Fetch weekly trending every Wednesday morning at 9:00 AM and push to Feishu"
|
|
231
|
+
|
|
232
|
+
// Monthly Push
|
|
233
|
+
- "Help me create a task to push GitHub monthly trending to my email on the 1st of every month at 9:00"
|
|
234
|
+
- "I want to receive GitHub monthly trending in my email on the 15th of every month at 18:45"
|
|
235
|
+
- "Help me use the openclaw-github-trending tool to create a scheduled task that runs every day at 18:45, pushes monthly GitHub trending, and sends the content to my email"
|
|
236
|
+
|
|
237
|
+
// Multi-Channel Push
|
|
238
|
+
- "Help me create a task to push daily trending to both Feishu and email every day at 8:00"
|
|
239
|
+
- "I want to receive trending every day at 10:00, sent to both Feishu and my email"
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Intelligent Parsing Capabilities:**
|
|
243
|
+
|
|
244
|
+
✅ **Time Recognition**: Automatically parses time expressions like "every day at 8:00", "every Monday at 10:00", "1st of every month at 9:00"
|
|
245
|
+
✅ **Period Recognition**: Automatically identifies "today/daily"→`daily`, "this week/weekly"→`weekly`, "monthly"→`monthly`
|
|
246
|
+
✅ **Channel Recognition**: Automatically identifies "email"→`email`, "feishu"→`feishu`, "feishu and email"→`["feishu","email"]`
|
|
247
|
+
✅ **Task Creation**: Automatically generates appropriate Cron expressions and creates scheduled tasks
|
|
248
|
+
|
|
249
|
+
**Execution Flow:**
|
|
250
|
+
|
|
251
|
+
1. User inputs natural language instruction in OpenClaw chat
|
|
252
|
+
2. OpenClaw parses the instruction and identifies the tool (`openclaw-github-trending`)
|
|
253
|
+
3. Automatically extracts time, period, push channels, and other parameters
|
|
254
|
+
4. Generates the corresponding `cron add` command and creates the task
|
|
255
|
+
5. Returns task creation success information, including task ID and execution time
|
|
256
|
+
|
|
257
|
+
**Advantages:**
|
|
258
|
+
|
|
259
|
+
✨ **Easy to Use**: No need to memorize command formats, create tasks like chatting
|
|
260
|
+
✨ **Flexible Expression**: Supports multiple natural language expression styles
|
|
261
|
+
✨ **Intelligent Recognition**: Automatically parses time, period, and push channels
|
|
262
|
+
✨ **Quick Configuration**: Complete complex scheduled task configuration with one sentence
|
|
263
|
+
|
|
264
|
+
### View Command Help
|
|
265
|
+
|
|
266
|
+
When you run the command without parameters or with wrong parameters, detailed help information will be displayed automatically:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
openclaw gen-cron -h
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The output will include:
|
|
273
|
+
- Command usage
|
|
274
|
+
- Parameter explanation
|
|
275
|
+
- Usage examples
|
|
276
|
+
- Cron expression format explanation
|
|
277
|
+
|
|
278
|
+
### Manage Scheduled Tasks
|
|
279
|
+
|
|
280
|
+
After setting up scheduled tasks, you can manage them with OpenClaw's cron commands:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# List all scheduled tasks
|
|
284
|
+
openclaw cron list
|
|
285
|
+
|
|
286
|
+
# View run history
|
|
287
|
+
openclaw cron runs
|
|
288
|
+
|
|
289
|
+
# Manually trigger a task
|
|
290
|
+
openclaw cron run <job-id>
|
|
291
|
+
|
|
292
|
+
# Delete a task
|
|
293
|
+
openclaw cron rm <job-id>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## AI Configuration Details
|
|
297
|
+
|
|
298
|
+
The plugin supports OpenAI-compatible API providers. If not configured in the plugin, it will fall back to OpenClaw's AI configuration.
|
|
299
|
+
|
|
300
|
+
| Field | Type | Required | Default | Description |
|
|
301
|
+
|-------|------|----------|---------|-------------|
|
|
302
|
+
| `provider` | string | No | `"openai"` | AI provider, supports custom providers |
|
|
303
|
+
| `api_key` | string | No* | - | AI provider API key |
|
|
304
|
+
| `base_url` | string | No | `"https://api.openai.com/v1"` | API base URL for OpenAI-compatible providers |
|
|
305
|
+
| `model` | string | No | `"gpt-4o-mini"` | Model name for summarization |
|
|
306
|
+
|
|
307
|
+
**If not provided, will use OpenClaw's default AI configuration**
|
|
308
|
+
|
|
309
|
+
#### Supported AI Providers
|
|
310
|
+
|
|
311
|
+
- **OpenAI**: `provider: "openai"`, use default base URL
|
|
312
|
+
- **Anthropic**: `provider: "anthropic"`
|
|
313
|
+
- **Custom Providers**: Any service compatible with OpenAI API (e.g., DashScope, Moonshot, DeepSeek, etc.)
|
|
314
|
+
|
|
315
|
+
**Custom Provider Example:**
|
|
316
|
+
|
|
317
|
+
```json
|
|
318
|
+
{
|
|
319
|
+
"ai": {
|
|
320
|
+
"provider": "openai",
|
|
321
|
+
"api_key": "sk-xxx",
|
|
322
|
+
"base_url": "https://coding.dashscope.aliyuncs.com/v1",
|
|
323
|
+
"model": "kimi-k2.5"
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### GitHub Configuration
|
|
329
|
+
|
|
330
|
+
| Field | Type | Required | Default | Description |
|
|
331
|
+
|-------|------|----------|---------|-------------|
|
|
332
|
+
| `github_token` | string | No | - | GitHub personal access token (increases rate limit) |
|
|
333
|
+
|
|
334
|
+
**Why configure GitHub Token?**
|
|
335
|
+
- Without Token: 60 requests/hour limit
|
|
336
|
+
- With Token: 5000 requests/hour limit
|
|
337
|
+
- Get Token: https://github.com/settings/tokens
|
|
338
|
+
|
|
339
|
+
### Concurrency Configuration
|
|
340
|
+
|
|
341
|
+
| Field | Type | Required | Default | Description |
|
|
342
|
+
|-------|------|----------|---------|-------------|
|
|
343
|
+
| `max_workers` | number | No | `5` | Concurrent workers for AI summarization (recommended: 3-10) |
|
|
344
|
+
|
|
345
|
+
### Channel Configuration
|
|
346
|
+
|
|
347
|
+
#### Feishu
|
|
348
|
+
|
|
349
|
+
| Field | Type | Required | Description |
|
|
350
|
+
|-------|------|----------|-------------|
|
|
351
|
+
| `webhook_url` | string | Yes* | Feishu bot webhook URL |
|
|
352
|
+
|
|
353
|
+
#### Email
|
|
354
|
+
|
|
355
|
+
| Field | Type | Required | Default | Description |
|
|
356
|
+
|-------|------|----------|---------|-------------|
|
|
357
|
+
| `smtp_host` | string | No | `"smtp.gmail.com"` | SMTP server host |
|
|
358
|
+
| `smtp_port` | number | No | `587` | SMTP server port |
|
|
359
|
+
| `use_tls` | boolean | No | `true` | Use TLS/STARTTLS |
|
|
360
|
+
| `sender` | string | Yes* | - | Sender email address |
|
|
361
|
+
| `password` | string | Yes* | - | Email password or app-specific password |
|
|
362
|
+
| `recipient` | string | No | Same as `sender` | Recipient email address (if not configured, defaults to sender address) |
|
|
363
|
+
| `from_name` | string | No | `"GitHub Trending"` | Display name for sender |
|
|
364
|
+
| `timeout` | number | No | `30` | SMTP connection timeout in seconds |
|
|
365
|
+
|
|
366
|
+
*Required when using this channel
|
|
367
|
+
|
|
368
|
+
### History Configuration
|
|
369
|
+
|
|
370
|
+
| Field | Type | Required | Default | Description |
|
|
371
|
+
|-------|------|----------|---------|-------------|
|
|
372
|
+
| `enabled` | boolean | No | `true` | Enable history tracking and deduplication |
|
|
373
|
+
| `star_threshold` | number | No | `100` | Re-push if stars increased by this amount |
|
|
374
|
+
|
|
375
|
+
### Proxy Configuration
|
|
376
|
+
|
|
377
|
+
| Field | Type | Required | Default | Description |
|
|
378
|
+
|-------|------|----------|---------|-------------|
|
|
379
|
+
| `enabled` | boolean | No | `false` | Enable proxy for GitHub requests |
|
|
380
|
+
| `url` | string | No | - | Proxy URL (supports `http://user:pass@host:port` or `https://host:port` format) |
|
|
381
|
+
|
|
382
|
+
**Example:**
|
|
383
|
+
```json
|
|
384
|
+
{
|
|
385
|
+
"plugins": {
|
|
386
|
+
"openclaw-github-trending": {
|
|
387
|
+
"proxy": {
|
|
388
|
+
"enabled": true,
|
|
389
|
+
"url": "http://127.0.0.1:7890"
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
**Proxy with authentication:**
|
|
397
|
+
```json
|
|
398
|
+
{
|
|
399
|
+
"plugins": {
|
|
400
|
+
"openclaw-github-trending": {
|
|
401
|
+
"proxy": {
|
|
402
|
+
"enabled": true,
|
|
403
|
+
"url": "http://username:password@192.168.1.1:8080"
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## Smart Deduplication
|
|
411
|
+
|
|
412
|
+
The plugin tracks repository history and intelligently decides when to re-push:
|
|
413
|
+
|
|
414
|
+
- **First Discovery**: Always push new repositories
|
|
415
|
+
- **Star Growth**: Re-push if stars increased by `star_threshold` (default: 100)
|
|
416
|
+
- **History Tracking**: Records repository details, AI summaries, and push history
|
|
417
|
+
|
|
418
|
+
## Security Best Practices
|
|
419
|
+
|
|
420
|
+
### API Keys
|
|
421
|
+
|
|
422
|
+
- Store API keys in `.openclaw/openclaw.json` (not in environment variables)
|
|
423
|
+
- Use app-specific passwords for email (e.g., Gmail App Passwords)
|
|
424
|
+
- Restrict API key permissions to minimum required
|
|
425
|
+
|
|
426
|
+
### Email Configuration
|
|
427
|
+
|
|
428
|
+
For Gmail:
|
|
429
|
+
1. Enable 2-Factor Authentication
|
|
430
|
+
2. Generate an App Password: https://myaccount.google.com/apppasswords
|
|
431
|
+
3. Use the app password in the `password` field
|
|
432
|
+
|
|
433
|
+
### Feishu Webhook
|
|
434
|
+
|
|
435
|
+
- Keep webhook URLs private
|
|
436
|
+
- Rotate webhook URLs periodically
|
|
437
|
+
- Use IP whitelisting if available
|
|
438
|
+
|
|
439
|
+
## Development
|
|
440
|
+
|
|
441
|
+
### Build
|
|
442
|
+
|
|
443
|
+
```bash
|
|
444
|
+
npm run build
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Test
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
npm test
|
|
451
|
+
npm run test:coverage
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Local Development
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
# Link to local OpenClaw
|
|
458
|
+
npm link
|
|
459
|
+
|
|
460
|
+
# In OpenClaw project
|
|
461
|
+
openclaw plugins install openclaw-github-trending
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## Contributing
|
|
465
|
+
|
|
466
|
+
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
467
|
+
|
|
468
|
+
## License
|
|
469
|
+
|
|
470
|
+
MIT © [王允](https://github.com/wy-ruby)
|
|
471
|
+
|
|
472
|
+
## Support
|
|
473
|
+
|
|
474
|
+
- 📧 Email: 906971957@qq.com
|
|
475
|
+
- 🐛 Issues: [GitHub Issues](https://github.com/wy-ruby/openclaw-github-trending/issues)
|
|
476
|
+
- 💬 Discussions: [GitHub Discussions](https://github.com/wy-ruby/openclaw-github-trending/discussions)
|
|
477
|
+
|
|
478
|
+
## Changelog
|
|
479
|
+
|
|
480
|
+
See [CHANGELOG.md](CHANGELOG.md) for release history.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { RepositoryInfo } from '../models/repository';
|
|
2
|
+
import { PushResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Email configuration interface
|
|
5
|
+
*/
|
|
6
|
+
export interface EmailConfig {
|
|
7
|
+
from: string;
|
|
8
|
+
to: string;
|
|
9
|
+
subject: string;
|
|
10
|
+
smtp: {
|
|
11
|
+
host: string;
|
|
12
|
+
port: number;
|
|
13
|
+
secure: boolean;
|
|
14
|
+
auth: {
|
|
15
|
+
user: string;
|
|
16
|
+
pass: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Email Channel for pushing GitHub trending repositories via email
|
|
22
|
+
*/
|
|
23
|
+
export declare class EmailChannel {
|
|
24
|
+
private config;
|
|
25
|
+
/**
|
|
26
|
+
* Create an email channel instance
|
|
27
|
+
* @param config Email configuration
|
|
28
|
+
*/
|
|
29
|
+
constructor(config: EmailConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Generate HTML email content from repositories
|
|
32
|
+
* @param newRepositories Array of new repositories to display
|
|
33
|
+
* @param seenRepositories Array of seen repositories to display
|
|
34
|
+
* @param since Time period for trending (daily, weekly, monthly)
|
|
35
|
+
* @returns HTML string for the email
|
|
36
|
+
*/
|
|
37
|
+
static generateHTML(newRepositories: RepositoryInfo[], seenRepositories: RepositoryInfo[], since?: 'daily' | 'weekly' | 'monthly'): string;
|
|
38
|
+
/**
|
|
39
|
+
* Format number with 'k' suffix for thousands
|
|
40
|
+
* @param num Number to format
|
|
41
|
+
* @returns Formatted string
|
|
42
|
+
*/
|
|
43
|
+
static formatNumberWithK(num: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* Get background color based on programming language
|
|
46
|
+
* @param language Programming language
|
|
47
|
+
* @returns Color code
|
|
48
|
+
*/
|
|
49
|
+
static getLanguageColor(language: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Send email with repositories
|
|
52
|
+
* @param config Email configuration
|
|
53
|
+
* @param newRepositories Array of new repositories
|
|
54
|
+
* @param seenRepositories Array of seen repositories
|
|
55
|
+
* @param since Time period for trending (daily, weekly, monthly)
|
|
56
|
+
* @returns Push result
|
|
57
|
+
*/
|
|
58
|
+
static send(config: EmailConfig, newRepositories: RepositoryInfo[], seenRepositories: RepositoryInfo[], since?: 'daily' | 'weekly' | 'monthly'): Promise<PushResult>;
|
|
59
|
+
}
|
|
60
|
+
export default EmailChannel;
|
|
61
|
+
//# sourceMappingURL=email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/channels/email.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAMrC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,OAAO,CAAC;QAChB,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAc;IAE5B;;;OAGG;gBACS,MAAM,EAAE,WAAW;IAI/B;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CACjB,eAAe,EAAE,cAAc,EAAE,EACjC,gBAAgB,EAAE,cAAc,EAAE,EAClC,KAAK,GAAE,OAAO,GAAG,QAAQ,GAAG,SAAqB,GAChD,MAAM;IAibT;;;;OAIG;IACH,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAO7C;;;;OAIG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAyBjD;;;;;;;OAOG;WACU,IAAI,CACf,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,cAAc,EAAE,EACjC,gBAAgB,EAAE,cAAc,EAAE,EAClC,KAAK,GAAE,OAAO,GAAG,QAAQ,GAAG,SAAqB,GAChD,OAAO,CAAC,UAAU,CAAC;CAsFvB;AAED,eAAe,YAAY,CAAC"}
|