driftnet 0.0.0-stage → 0.1.1

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,27 @@
1
+ // Hacker News: read the story behind a news.ycombinator.com/item?id=… link
2
+ // through the official API instead of the page. Copy this file to
3
+ // ~/.driftnet/plugins/ and restart driftnet.
4
+
5
+ /** @param {{ fetch: typeof fetch }} api */
6
+ export default ({ fetch }) => ({
7
+ name: "hackernews",
8
+ matches: (url) => /^https:\/\/news\.ycombinator\.com\/item\?id=\d+/.test(url),
9
+ async extract(url) {
10
+ const id = new URL(url).searchParams.get("id");
11
+ const res = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
12
+ if (!res.ok) return null; // let the next extractor try
13
+ const item = await res.json();
14
+ if (!item?.title) return null;
15
+ // HN comments are HTML; a plain-text cut is enough for the outline.
16
+ const text = String(item.text ?? "").replace(/<[^>]+>/g, " ").replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
17
+ return {
18
+ url,
19
+ kind: "post",
20
+ title: item.title,
21
+ text: [item.title, text].join("\n\n").slice(0, 4000),
22
+ // The story's own link: driftnet follows it to the tool, as it does for social posts.
23
+ outlinks: item.url ? [item.url] : [],
24
+ meta: { points: item.score ?? 0, comments: item.descendants ?? 0 },
25
+ };
26
+ },
27
+ });
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "driftnet",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "mcpName": "io.github.KevinChu1110/driftnet",
5
+ "description": "Drop links into any chat. Get them sorted, explained and searchable — for a fraction of a cent each.",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "bin": {
9
+ "driftnet": "dist/driftnet.mjs"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "public",
14
+ "examples",
15
+ ".env.example",
16
+ "README.zh-TW.md"
17
+ ],
18
+ "engines": {
19
+ "node": ">=22.13"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/KevinChu1110/driftnet.git"
24
+ },
25
+ "homepage": "https://github.com/KevinChu1110/driftnet#readme",
26
+ "keywords": [
27
+ "ai",
28
+ "links",
29
+ "bookmarks",
30
+ "chatbot",
31
+ "discord",
32
+ "telegram",
33
+ "slack",
34
+ "line",
35
+ "mcp",
36
+ "agents"
37
+ ],
38
+ "dependencies": {
39
+ "@anthropic-ai/sdk": "^1.3.0",
40
+ "undici": "^8.12.3",
41
+ "zod": "^4.6.7",
42
+ "@modelcontextprotocol/sdk": "^1.32.2",
43
+ "discord.js": "^14.27.0"
44
+ }
45
+ }
Binary file
@@ -0,0 +1,17 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2
+ <!-- Hand-tuned for 16-32 px (favicon, toolbar): no mesh, heavier strokes, pixel-aligned rim. -->
3
+ <defs>
4
+ <linearGradient id="sea" x1="0" y1="0" x2="1" y2="1">
5
+ <stop offset="0" stop-color="#2459e0"/>
6
+ <stop offset="1" stop-color="#0f9f8f"/>
7
+ </linearGradient>
8
+ </defs>
9
+ <rect width="32" height="32" rx="7" fill="url(#sea)"/>
10
+ <path d="M5 9 q2.75 -2.5 5.5 0 t5.5 0 t5.5 0 t5.5 0" fill="none" stroke="#fff" stroke-opacity=".75" stroke-width="2.2" stroke-linecap="round"/>
11
+ <path d="M6 16 C6 23 10.5 27 16 27 C21.5 27 26 23 26 16" fill="#fff" fill-opacity=".22" stroke="#fff" stroke-width="2.6" stroke-linecap="round"/>
12
+ <path d="M4.5 16 H27.5" stroke="#fff" stroke-width="2.6" stroke-linecap="round"/>
13
+ <g transform="translate(16 21) rotate(-30)" fill="none" stroke="#fff" stroke-width="2.4">
14
+ <rect x="-6" y="-2.6" width="7.4" height="5.2" rx="2.6"/>
15
+ <rect x="-1.4" y="-2.6" width="7.4" height="5.2" rx="2.6"/>
16
+ </g>
17
+ </svg>
Binary file