977105b0f6
* feat(hackernews): add `read <id>` and surface item id on every listing Two related agent-flow gaps in the HN adapters: 1. `top`/`best`/`ask`/`new`/`show`/`jobs`/`search` all carry the HN item id internally (firebase items are fetched by id; algolia hits include `objectID`) but drop it before output. Without an id column the agent can see the title but has no handle to follow up with. 2. There was no way to read a story's discussion. The whole reason an agent looks at HN is the comments — and that capability was missing. This PR adds: - `id` column on every listing adapter (firebase items: numeric id; algolia search hits: `objectID` string). Existing column order is preserved otherwise. - `hackernews read <id>` — public/non-browser adapter that fetches the story plus a tree of top-level comments + inline replies via `https://hacker-news.firebaseio.com/v0/item/<id>.json`. Mirrors the `reddit read` shape (`type/author/score/text`) so agents can use both with one mental model. HTML-only fields (comment text) are converted to plain text with anchor URLs preserved. - Column-contract tests covering all listings + the new read adapter. - Doc entry under `docs/adapters/browser/hackernews.md`. Tested locally via `~/.opencli/clis/hackernews/` overrides: opencli hackernews top --limit 3 # id present opencli hackernews search rust --limit 2 # id (objectID) present opencli hackernews read 47999636 --limit 5 # threaded output * fix(hackernews): typed fail-fast for read
1.2 KiB
1.2 KiB
HackerNews
Mode: 🌐 Public · Domain: news.ycombinator.com
Commands
| Command | Description |
|---|---|
opencli hackernews top |
Hacker News top stories |
opencli hackernews new |
Hacker News newest stories |
opencli hackernews best |
Hacker News best stories |
opencli hackernews ask |
Hacker News Ask HN posts |
opencli hackernews show |
Hacker News Show HN posts |
opencli hackernews jobs |
Hacker News job postings |
opencli hackernews search <query> |
Search Hacker News stories |
opencli hackernews user <username> |
Hacker News user profile |
opencli hackernews read <id> |
Read a story and its comment tree |
Usage Examples
# Top stories
opencli hackernews top --limit 5
# Newest stories
opencli hackernews new --limit 10
# Search stories
opencli hackernews search "machine learning" --limit 5
# User profile
opencli hackernews user pg
# JSON output
opencli hackernews top -f json
# Sort search by date
opencli hackernews search "rust" --sort date
# Read a story and its top comments (id from any listing's `id` column)
opencli hackernews read 47999636 --limit 5 --depth 2
Prerequisites
- No browser required — uses public API