Skip to content

ikenai-lab/news-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

News CLI: AI-Powered Terminal News Assistant

An AI-powered terminal news assistant that lets you search for news, read articles, fact-check claims, and have intelligent conversationsβ€”all from your command line.

Python License Status

News CLI Demo

Features

Core Features

  • πŸ” Smart News Search β€” Natural language search with automatic date parsing ("last year AI news" β†’ searches 2024)
  • πŸ“– Robust Article Reading β€” Multi-method scraping with 6 fallback strategies including browser-based extraction
  • πŸ€– AI Summaries β€” Context-aware summaries powered by local LLM (Ollama)
  • πŸ’¬ Conversational β€” Chat naturally with context-aware responses
  • βœ… Fact-Checking β€” Verify claims against trusted sources (Snopes, PolitiFact, FactCheck.org)

User Experience

  • πŸ“Š Morning Briefing β€” Geo-located dashboard with top news on startup
  • πŸ”’ Sequential IDs β€” Simple numeric IDs (1, 2, 3) for easy command typing
  • ⌨️ Autocomplete β€” Tab completion for commands with smart defaults
  • πŸ”§ Configurable β€” Adjust article limits, choose your LLM model
  • 🌍 Location-Aware β€” Automatic country detection for localized news
  • πŸ“ Typo Correction β€” LLM-powered input sanitization

Prerequisites

  • Python 3.13+
  • Ollama β€” Local LLM runtime
  • uv β€” Fast Python package manager (recommended)

Installation

Quick Install (Recommended)

Linux / macOS:

curl -sSL https://raw.githubusercontent.com/ikenai-lab/news-cli/main/install.sh | bash

Windows (PowerShell as Admin):

irm https://raw.githubusercontent.com/ikenai-lab/news-cli/main/install.ps1 | iex

Global Install via uv (if you have uv installed):

uv tool install git+https://github.com/ikenai-lab/news-cli.git

The install scripts will:

  • βœ… Check for and install uv (Python package manager)
  • βœ… Check for and install Ollama (Local LLM runtime)
  • βœ… Clone the repository
  • βœ… Install Python dependencies
  • βœ… Pull the LLM model (~2GB)

Manual Installation

# 1. Install prerequisites
# Linux/macOS:
curl -LsSf https://astral.sh/uv/install.sh | sh
curl -fsSL https://ollama.com/install.sh | sh

# Windows (using winget):
winget install astral-sh.uv
winget install Ollama.Ollama

# 2. Clone and setup
git clone https://github.com/ikenai-lab/news-cli.git
cd news-cli
uv sync

# 3. Optional: Install browser for JS-heavy sites
uv run playwright install chromium

# 4. Pull the LLM model
ollama pull llama3.2:3b

Usage

# Run with defaults
uv run news-cli

# Specify model and article limit
uv run news-cli --model llama3.2:3b --limit 10

CLI Options

Option Default Description
--model llama3.2:3b Ollama model to use
--limit 5 Articles per search (1-20)

Configuration

You can set persistent defaults (saved to ~/.config/news-cli/config.json) so you don't need to specify options every time.

# View current config
news-cli config

# Set default model
news-cli config --model llama3.2:3b

# Set default article limit
news-cli config --limit 10

Commands

Type / to see all available commands with autocomplete.

Slash Commands

Command Description
/read <id> Read and summarize article (e.g. /read 1)
/open <id> Open article in browser (e.g. /open 1)
/save-article <id> Save article content to markdown file
/save-session <file> Save conversation history to JSON file
/analyze <id> AI analysis for bias, tone, facts
/fact-check <id> Verify claims against fact-check sites
/similar <id> Find related news from different sources
/limit <n> Set articles per search (1-20)
/briefing Refresh the morning briefing
/quit or /exit Exit the application

Natural Language

Just type naturally! The AI understands:

  • "latest AI news" β†’ Search
  • "what happened with OpenAI last week" β†’ Search with date filter
  • "read the techcrunch article" β†’ Reads matching article
  • "give me article 3" β†’ Reads article #3
  • "read 1" β†’ Reads first article in list

Morning Briefing

On startup, you'll see a personalized dashboard:

πŸ“° Morning Briefing (Location: India)

┏━━━━━━━━━━━━ India Headlines ━━━━━━━━━━━━┓
┃ # β”‚ Date       β”‚ Source     β”‚ Title     ┃
┑━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
β”‚ 1 β”‚ 2025-12-28 β”‚ ndtv.com   β”‚ ...       β”‚
...

πŸ“° 12 articles loaded. Use /read <#> to read any article.

Fact-Checking

Verify claims in any article:

/fact-check 3

┏━━━━━━━━━━━━━━ Fact-Check Results ━━━━━━━━━━━━━━┓
┃ # β”‚ Claim                β”‚ Sources β”‚ Top Source ┃
┑━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━┩
β”‚ 1 β”‚ "AI will replace..." β”‚ 3       β”‚ Snopes...  β”‚
...

Project Structure

news-cli/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.py           # CLI entry point
β”‚   β”œβ”€β”€ agent.py          # NewsAgent with LLM integration
β”‚   β”œβ”€β”€ startup.py        # Ollama checks + geolocation
β”‚   β”œβ”€β”€ tools/
β”‚   β”‚   β”œβ”€β”€ search.py     # DuckDuckGo search with time filters
β”‚   β”‚   β”œβ”€β”€ scraper.py    # Multi-method article scraper
β”‚   β”‚   └── fact_check.py # Claim verification tool
β”‚   └── ui/
β”‚       β”œβ”€β”€ render.py     # Rich UI components
β”‚       └── completer.py  # Slash command autocomplete
β”œβ”€β”€ pyproject.toml
└── README.md

Dependencies

Package Purpose
ollama Local LLM client
ddgs DuckDuckGo search
nodriver Stealth browser automation (replacing Selenium/Playwright)
cloudscraper Cloudflare bypass
trafilatura Article content extraction
readability-lxml Fallback content extraction
rich Terminal UI components
typer CLI framework
httpx HTTP client
prompt-toolkit Command autocomplete

Scraping Architecture

The scraper uses a multi-layered approach with 6 fallback methods:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. Cloudscraper                                         β”‚
β”‚    ↳ Fast, lightweight Cloudflare bypass                β”‚
β”‚    ↓ (if fails)                                         β”‚
β”‚ 2. Nodriver (Stealth Browser)                           β”‚
β”‚    ↳ Chrome DevTools Protocol based (masked as User)    β”‚
β”‚    ↳ Handles heavy JS and complex anti-bots             β”‚
β”‚    ↓ (if fails)                                         β”‚
β”‚ 3. Direct Fetch (httpx + trafilatura)                   β”‚
β”‚    ↳ Standard HTTP with article extraction              β”‚
β”‚    ↓ (if fails)                                         β”‚
β”‚ 4. Archive.org (Wayback Machine)                        β”‚
β”‚    ↳ Check for cached snapshots if live site fails      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

For sites that block all scraping (like MSN), use /open <id> to view in browser.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE for details.

About

AI News CLI: Search, scrape, and fact-check global news from your terminal. Features local LLM support (Ollama), browserless reading mode, and source verification.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages