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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.markdownToHTML = markdownToHTML;
|
|
7
|
+
const marked_1 = require("marked");
|
|
8
|
+
const sanitize_html_1 = __importDefault(require("sanitize-html"));
|
|
9
|
+
/**
|
|
10
|
+
* Convert markdown text to HTML
|
|
11
|
+
* This function sanitizes the output to prevent XSS attacks
|
|
12
|
+
*
|
|
13
|
+
* @param markdown - Markdown text to convert
|
|
14
|
+
* @returns Sanitized HTML string
|
|
15
|
+
*/
|
|
16
|
+
function markdownToHTML(markdown) {
|
|
17
|
+
// Use marked library to convert markdown to HTML (synchronous)
|
|
18
|
+
// Explicitly set async: false to get synchronous behavior
|
|
19
|
+
const html = (0, marked_1.marked)(markdown, { async: false });
|
|
20
|
+
// Sanitize HTML to prevent XSS attacks
|
|
21
|
+
const sanitized = (0, sanitize_html_1.default)(html, {
|
|
22
|
+
allowedTags: [
|
|
23
|
+
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
|
24
|
+
'p', 'a', 'b', 'strong', 'i', 'em',
|
|
25
|
+
'ul', 'ol', 'li',
|
|
26
|
+
'blockquote',
|
|
27
|
+
'code', 'pre',
|
|
28
|
+
'br', 'hr',
|
|
29
|
+
'table', 'thead', 'tbody', 'tr', 'th', 'td'
|
|
30
|
+
],
|
|
31
|
+
allowedAttributes: {
|
|
32
|
+
'a': ['href', 'name', 'target'],
|
|
33
|
+
'code': ['class']
|
|
34
|
+
},
|
|
35
|
+
// Allow data:image for inline images (if needed)
|
|
36
|
+
allowedSchemes: ['http', 'https', 'mailto', 'data']
|
|
37
|
+
});
|
|
38
|
+
return sanitized;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/utils/markdown.ts"],"names":[],"mappings":";;;;;AAUA,wCAyBC;AAnCD,mCAAgC;AAChC,kEAAyC;AAEzC;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,QAAgB;IAC7C,+DAA+D;IAC/D,0DAA0D;IAC1D,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAEhD,uCAAuC;IACvC,MAAM,SAAS,GAAG,IAAA,uBAAY,EAAC,IAAI,EAAE;QACnC,WAAW,EAAE;YACX,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;YAClC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI;YAClC,IAAI,EAAE,IAAI,EAAE,IAAI;YAChB,YAAY;YACZ,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;SAC5C;QACD,iBAAiB,EAAE;YACjB,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;YAC/B,MAAM,EAAE,CAAC,OAAO,CAAC;SAClB;QACD,iDAAiD;QACjD,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC;KACpD,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "openclaw-github-trending",
|
|
3
|
+
"name": "GitHub Trending",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Fetch GitHub trending repositories and push to Feishu or Email with AI summaries",
|
|
6
|
+
"author": "王允",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/wy-ruby/openclaw-github-trending"
|
|
11
|
+
},
|
|
12
|
+
"entry": "dist/index.js",
|
|
13
|
+
"engines": {
|
|
14
|
+
"openclaw": ">=2026.1.15",
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
|
+
},
|
|
17
|
+
"configSchema": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"properties": {
|
|
21
|
+
"ai": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"description": "AI configuration for generating summaries. Falls back to OpenClaw's AI config or environment variables if not provided.",
|
|
24
|
+
"properties": {
|
|
25
|
+
"provider": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"enum": ["openai", "anthropic"],
|
|
28
|
+
"default": "openai",
|
|
29
|
+
"description": "AI provider (OpenAI-compatible or Anthropic)"
|
|
30
|
+
},
|
|
31
|
+
"api_key": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "AI provider API key. Falls back to OPENAI_API_KEY or ANTHROPIC_API_KEY environment variable."
|
|
34
|
+
},
|
|
35
|
+
"base_url": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "API base URL (for OpenAI-compatible providers). Falls back to OPENAI_BASE_URL or ANTHROPIC_BASE_URL environment variable."
|
|
38
|
+
},
|
|
39
|
+
"model": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "gpt-4o-mini",
|
|
42
|
+
"description": "Model name for summarization (e.g., 'gpt-4o-mini', 'claude-3-5-sonnet-20241022'). Falls back to OpenClaw's default model."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"github_token": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "GitHub personal access token (optional, increases rate limit)"
|
|
49
|
+
},
|
|
50
|
+
"max_workers": {
|
|
51
|
+
"type": "number",
|
|
52
|
+
"default": 5,
|
|
53
|
+
"minimum": 1,
|
|
54
|
+
"maximum": 20,
|
|
55
|
+
"description": "Concurrent workers for AI summarization (recommended: 3-10)"
|
|
56
|
+
},
|
|
57
|
+
"channels": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"description": "Push channel configurations",
|
|
60
|
+
"properties": {
|
|
61
|
+
"feishu": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"description": "Feishu webhook configuration",
|
|
64
|
+
"properties": {
|
|
65
|
+
"webhook_url": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "Feishu bot webhook URL"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"email": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"description": "Email SMTP configuration",
|
|
74
|
+
"properties": {
|
|
75
|
+
"smtp_host": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"default": "smtp.gmail.com",
|
|
78
|
+
"description": "SMTP server host"
|
|
79
|
+
},
|
|
80
|
+
"smtp_port": {
|
|
81
|
+
"type": "number",
|
|
82
|
+
"default": 587,
|
|
83
|
+
"description": "SMTP server port"
|
|
84
|
+
},
|
|
85
|
+
"use_tls": {
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"default": true,
|
|
88
|
+
"description": "Use TLS/STARTTLS"
|
|
89
|
+
},
|
|
90
|
+
"sender": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Sender email address"
|
|
93
|
+
},
|
|
94
|
+
"password": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Email password or app-specific password"
|
|
97
|
+
},
|
|
98
|
+
"recipient": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"description": "Recipient email address (defaults to sender if not provided)"
|
|
101
|
+
},
|
|
102
|
+
"from_name": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"default": "GitHub Trending",
|
|
105
|
+
"description": "Display name for sender"
|
|
106
|
+
},
|
|
107
|
+
"timeout": {
|
|
108
|
+
"type": "number",
|
|
109
|
+
"default": 30,
|
|
110
|
+
"description": "SMTP connection timeout in seconds"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"required": ["sender", "password"]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"history": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"description": "History and deduplication settings",
|
|
120
|
+
"properties": {
|
|
121
|
+
"enabled": {
|
|
122
|
+
"type": "boolean",
|
|
123
|
+
"default": true,
|
|
124
|
+
"description": "Enable history tracking and deduplication"
|
|
125
|
+
},
|
|
126
|
+
"star_threshold": {
|
|
127
|
+
"type": "number",
|
|
128
|
+
"default": 100,
|
|
129
|
+
"minimum": 0,
|
|
130
|
+
"description": "Re-push if stars increased by this amount"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"proxy": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"description": "HTTP/HTTPS proxy configuration for accessing GitHub (e.g., http://user:pass@127.0.0.1:7890)",
|
|
137
|
+
"properties": {
|
|
138
|
+
"enabled": {
|
|
139
|
+
"type": "boolean",
|
|
140
|
+
"default": false,
|
|
141
|
+
"description": "Enable proxy for GitHub requests"
|
|
142
|
+
},
|
|
143
|
+
"url": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"description": "Proxy URL (supports http://user:pass@host:port or https://host:port format)"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"additionalProperties": false
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "openclaw-github-trending",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "OpenClaw plugin for fetching GitHub trending repositories and pushing to Feishu or Email with AI summaries",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "jest",
|
|
10
|
+
"test:watch": "jest --watch",
|
|
11
|
+
"test:coverage": "jest --coverage",
|
|
12
|
+
"prepublishOnly": "npm run build"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"openclaw",
|
|
16
|
+
"openclaw-plugin",
|
|
17
|
+
"github",
|
|
18
|
+
"trending",
|
|
19
|
+
"feishu",
|
|
20
|
+
"email",
|
|
21
|
+
"ai",
|
|
22
|
+
"notifications",
|
|
23
|
+
"automation"
|
|
24
|
+
],
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "王允",
|
|
27
|
+
"email": "906971957@qq.com"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/wy-ruby/openclaw-github-trending.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/wy-ruby/openclaw-github-trending/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/wy-ruby/openclaw-github-trending#readme",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"type": "commonjs",
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"openclaw.plugin.json",
|
|
42
|
+
"docs",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE",
|
|
45
|
+
"CHANGELOG.md"
|
|
46
|
+
],
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"openclaw": ">=2026.1.15"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@anthropic-ai/sdk": "^0.78.0",
|
|
52
|
+
"axios": "^1.13.6",
|
|
53
|
+
"cheerio": "^1.2.0",
|
|
54
|
+
"marked": "^17.0.4",
|
|
55
|
+
"nodemailer": "^8.0.2",
|
|
56
|
+
"openai": "^6.27.0",
|
|
57
|
+
"sanitize-html": "^2.17.1",
|
|
58
|
+
"zod": "^3.22.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/jest": "^30.0.0",
|
|
62
|
+
"@types/node": "^25.4.0",
|
|
63
|
+
"@types/nodemailer": "^7.0.11",
|
|
64
|
+
"@types/sanitize-html": "^2.16.1",
|
|
65
|
+
"jest": "^30.2.0",
|
|
66
|
+
"ts-jest": "^29.4.6",
|
|
67
|
+
"ts-node": "^10.9.2",
|
|
68
|
+
"typescript": "^5.9.3"
|
|
69
|
+
},
|
|
70
|
+
"engines": {
|
|
71
|
+
"node": ">=18.0.0"
|
|
72
|
+
},
|
|
73
|
+
"openclaw": {
|
|
74
|
+
"extensions": [
|
|
75
|
+
"./dist/index.js"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|