mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
68485cc54e
* feat(devto): surface article id + published_at on listings, add `read <id>` Agent-native gap: devto listings (`top`/`tag`/`user`) didn't include the article `id`, so an agent couldn't round-trip from a listing into a body read. They also dropped `reading_time` and `published_at`, which are cheap signals the API gives you for free. Changes: - `top` / `tag` / `user`: add `id`, `reading_time`, `published_at` columns alongside existing rank/title/etc. `user` keeps its no-author shape since it's already user-scoped. - New `devto read <id>`: hits `dev.to/api/articles/<id>` and returns one row with the article body (truncated by `--max-length`, default 20000, min 100). DEV.to's public API does not expose comments yet, so this is intentionally a single-row reader rather than a HN/lobsters-style threaded tree — if/when comments become public we can extend to POST + L0/L1. - Typed fail-fast: `ArgumentError` for non-numeric id and for `--max-length` below 100; `EmptyResultError` on 404; `CommandExecutionError` for other non-2xx HTTP statuses. No silent clamps. - Defensive tag normalization: the `/api/articles/<id>` endpoint returns `tag_list` as a comma-string and `tags` as an array (the opposite shape from listing endpoints). Caught this on live verification — both shapes now collapse to a comma-joined string. Tests: 12 vitest assertions covering listing column shape (all 3) + register/args/strategy + typed-error fail-fast paths + happy-path body extraction + truncation marker + alternate tag_list shape. Live verification: `devto top --limit 3` and `devto read 3602287` both return the expected agent-native shape. * fix(devto): harden article read contract
2.3 KiB
2.3 KiB
Dev.to
Mode: 🌐 Public · Domain: dev.to
Fetch the latest and greatest developer articles from the DEV community without needing an API key.
Commands
| Command | Description |
|---|---|
opencli devto top |
Top DEV.to articles of the day |
opencli devto tag <tag> |
Latest articles for a specific tag |
opencli devto user <username> |
Recent articles from a specific user |
opencli devto read <id> |
Read the body of a single article |
Listing columns
top, tag, and user all surface the same agent-native columns so the
article id is round-trippable into devto read:
| Column | Source | Notes |
|---|---|---|
rank |
local | 1-indexed position in the result |
id |
item.id |
Numeric article id, feed into devto read |
title |
item.title |
|
author |
item.user.username |
(omitted for user since it's user-scoped) |
reactions |
item.public_reactions_count |
|
comments |
item.comments_count |
|
reading_time |
item.reading_time_minutes |
Minutes |
published_at |
item.published_at |
ISO 8601 timestamp |
tags |
item.tag_list |
Comma-separated |
url |
item.url |
Canonical article URL |
read columns
devto read returns a single row with the article body. DEV.to's public API
does not expose article comments, so this reader does not emit a comment tree.
| Column | Source |
|---|---|
id |
article.id |
title |
article.title |
author |
article.user.username |
reactions |
article.public_reactions_count |
reading_time |
article.reading_time_minutes |
tags |
article.tag_list (joined) |
published_at |
article.published_at |
body |
article.body_markdown (truncated by --max-length) |
url |
article.url |
Usage Examples
# Top articles today
opencli devto top --limit 5
# Articles by tag (positional argument)
opencli devto tag javascript
opencli devto tag python --limit 20
# Articles by a specific author
opencli devto user ben
opencli devto user thepracticaldev --limit 5
# Read a single article body by id
opencli devto read 3605688
opencli devto read 3605688 --max-length 5000
# JSON output
opencli devto top -f json
opencli devto read 3605688 -f json
Prerequisites
- No browser required — uses the public DEV.to API