Files
jakevin 5a839701ab feat(lobsters): surface short_id + created_at on listings, add read <short_id> (#1291)
* feat(lobsters): surface short_id + created_at on listings, add `read <short_id>`

Same agent-native gap as the just-merged hackernews PR (#1288):

1. The 4 listings (hot / newest / active / tag) didn't surface each story's
   `short_id`. Agents could see the title and a comments URL but couldn't
   pass the id back into a follow-up command. Add `id` (= `short_id`) and
   `created_at` columns; `created_at` is cheap signal for "how stale is this".

2. There was no way to read a story + comment tree from the CLI. Lobsters
   makes this nicer than HN: `https://lobste.rs/s/<short_id>.json` returns
   the story plus a flat `comments[]` array where each entry already carries
   `parent_comment` and `depth`, so we get the full thread in one HTTP call
   and just DFS using the parent map.

`read` mirrors the `hackernews read` shape (POST row + L0/L1/… indented
comments, `[+N more replies]` stubs at depth/limit cutoffs) so the two
adapters feel the same to agents that already learned one. Same typed
fail-fast envelope: `ArgumentError` on bad short_id / non-positive limit /
depth / replies, `EmptyResultError` on 404 or empty body, `CommandExecutionError`
on other HTTP failures.

Tests cover all 4 listings (column shape + map step), `read` registration,
positional arg shape, ArgumentError fail-fast (no fetch on bad input),
EmptyResultError on 404, threaded-tree assembly from a flat `comments[]`,
and the `+N more replies` depth-cutoff path.

* test(lobsters): lock read fail-fast coverage

* docs(lobsters): list read command
2026-05-04 18:55:51 +08:00

1.1 KiB

Lobsters

Mode: 🌐 Public · Domain: lobste.rs

Commands

Command Description
opencli lobsters hot Hottest stories
opencli lobsters newest Latest stories
opencli lobsters active Most active discussions
opencli lobsters tag <tag> Stories by tag
opencli lobsters read <short_id> Read a story and its comment tree

Usage Examples

# Quick start
opencli lobsters hot --limit 10

# Filter by tag
opencli lobsters tag rust --limit 5

# Read a specific story (use the short_id surfaced as `id` in any listing)
opencli lobsters read 6cmh6h --limit 25 --depth 2

# JSON output
opencli lobsters hot -f json

Output Columns

Command Columns
hot / newest / active / tag rank, id, title, score, author, comments, created_at, tags, url
read type, author, score, text (POST + L0/L1/… comments, with [+N more replies] stubs)

id is the lobste.rs short_id — pipe it into read to drill into the discussion.

Prerequisites

None — all commands use the public JSON API, no browser or login required.