news-curator
v0.2.1
Published
AI-assisted news selection CLI with Supabase + OpenRouter
Maintainers
Readme
News Curator
AI‑assisted news selection CLI, designed for open source use. It fetches recent news items from a Supabase table, asks an LLM (via OpenRouter) to rank and deduplicate, then updates each item with a queued status. Includes a safe dry‑run mode that prints chosen items without writing to the database. By DailyUncle.com. ภาษาไทยอยู่ด้านล่าง
Features
- Structured prompt (TH) optimized for technology/science/innovation news
- Dedupes and limits final picks to a fixed
K - Dry‑run mode for previewing selections
- JSON log output for pipelines
- Supabase integration using service role key
Requirements
- Node.js 18+
- Supabase project with a
feed_itemstable - OpenRouter API key
Install
Clone the repo and install dependencies:
npm installCopy .env.example to .env and fill values:
cp .env.example .envUse via npx (no clone)
You can run the CLI directly without cloning by using npx (uses the published package):
npx news-curator --dry-runOr install globally:
npm i -g news-curator
news-curator --dry-runLive Demo
https://dailyuncle.com
Configure
Required environment variables:
SUPABASE_URL: Your Supabase project URLSUPABASE_SERVICE_ROLE_KEY: Service role keyOPENROUTER_API_KEY: OpenRouter API key
Optional defaults:
OPENROUTER_MODEL(default:tngtech/deepseek-r1t2-chimera:free)NEWS_SELECT_HOURS(default:48)NEWS_SELECT_LIMIT(default:100)NEWS_SELECT_FINAL_K(default:12)
Build
npm run buildThis creates the CLI at bin/news-curator.js which loads dist/index.js.
Usage
Run with Node (requires build):
news-curator --dry-runOr during development without building:
npx tsx src/index.ts --dry-runOptions:
--hours <n> Look back N hours (default: 48)
--limit <n> Fetch at most N items (default: 100)
--final <k> Target number to queue (default: 12)
--model <name> OpenRouter model (env OPENROUTER_MODEL)
--dry-run Do not write to DB; print selections
--json Emit JSON logs only
--help Show helpExample (dry‑run):
news-curator --hours 36 --limit 80 --final 12 --dry-runPublishing
For maintainers: the package is configured for npm publish. The build runs automatically on npm publish/npm pack via prepack.
# Update version as needed
npm version patch
# Publish to npm (unscoped, public)
npm publishSupabase schema
Minimum required columns on feed_items (types shown for reference):
id(uuid or text, primary key)title(text)url(text)summary(text, nullable)published_at(timestamp with time zone, nullable)status(text) — expected values includereadyandcompletedqueued_status(text) — one ofqueued|skipped|duplicate|low_quality|clickbait|out_of_scopeselection_reason(text, nullable)
Example SQL (adjust types/constraints as needed):
-- ids may be text or uuid depending on your pipeline
create table if not exists public.feed_items (
id text primary key,
title text not null,
url text not null,
summary text,
published_at timestamptz,
status text not null default 'ready',
queued_status text,
selection_reason text
);Prompt
The selection prompt (Thai) is tailored to pick high‑quality, non‑duplicative, tech/science/innovation news. It instructs the model to return only a strict JSON array and to label each item with a queued_status and short reason.
Notes
- The tool adjusts to ensure exactly
Kitems are markedqueuedper run. - If the model returns fewer than
K, it fills from the input order to reachK. - Set
--dry-runwhile tuning prompts and defaults.
(TH) คำอธิบายภาษาไทย
News Curator เป็น CLI ช่วยคัดเลือกข่าวด้วย AI ออกแบบให้เปิดเผยซอร์ส ใช้งานง่าย และตั้งค่าได้ โดยจะดึงข่าวล่าสุดจาก Supabase (feed_items) ส่งให้โมเดลผ่าน OpenRouter เพื่อคัดและตัดซ้ำ แล้วอัปเดตสถานะที่ฐานข้อมูล มีโหมด Dry‑run สำหรับทดสอบโดยไม่เขียนข้อมูลจริง
จุดเด่น:
- Prompt ภาษาไทย เน้นข่าว เทคโนโลยี/วิทยาศาสตร์/นวัตกรรม
- เลือกข่าวที่ดีที่สุด และไม่ซ้ำกัน ในจำนวน K รายการ
- Dry‑run โชว์ผลที่เลือกโดยไม่แตะฐานข้อมูล
- Log แบบ JSON เหมาะกับ workflow อัตโนมัติ
ติดตั้งและใช้งาน:
- เติมค่าใน
.env(ดูตัวอย่าง.env.example) - รัน
npm run build - รัน
news-curator --dry-runเพื่อทดสอบ
ตัวเลือกสำคัญ:
--hoursชั่วโมงย้อนหลัง (ค่าเริ่มต้น 48)--limitจำนวนสูงสุดที่ดึง (ค่าเริ่มต้น 100)--finalจำนวน K ที่ต้องการเลือก (ค่าเริ่มต้น 12)--modelเลือกโมเดล OpenRouter--dry-runแสดงผลโดยไม่เขียนฐานข้อมูล
สคีมาที่ใช้บน Supabase ดูหัวข้อ “Supabase schema” ด้านบน
License
MIT
