Repository navigation
feat: add devpub comments to read article comment threads + release v0.4.0 - #14
Merged
Merged
Conversation
Read the threaded comments on a Dev.to article directly in the terminal. Uses the API-key/public GET /comments endpoint, so it is fully read-only. Replies are rendered nested under their parent with author, date, and id_code; comment HTML bodies are reduced to plain text. Posting replies is intentionally out of scope: the Forem V1 API has no comment write endpoint, so that would require the session-cookie bridge used by `devpub upload` and is tracked separately pending a verification spike. - api/devto.py: get_comments(a_id) and get_comment(id_code) - cli/comments.py: HTML-to-text reducer + recursive thread renderer - cli command wired in, README + CHANGELOG updated - tests: 5 API-client tests + 10 helper tests (143 total pass)
Release devpub comments feature. - devpub comments <article_id>: read threaded Dev.to comments in the terminal with nested replies, author, date, id_code, and --page/--limit pagination. Validated against the live Dev.to API: auth, comment threading, nesting, pagination, empty-article and invalid-id edge cases. 143 tests pass, ruff clean.
devpub comments to read article comment threadsdevpub comments to read article comment threads + release v0.4.0
Owner
Author
🚀 Prepared for v0.4.0 releaseAdded a version-bump commit (
Live validation (account @sarvar_04, fresh API key)
Once all three CI matrix jobs are green, this is ready to merge. The GitHub Release/tag (which triggers the PyPI publish) will be created as a separate, explicit step after merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
devpub comments <article_id>: read the threaded comments on a Dev.to article directly in the terminal. Replies are rendered nested under their parent, with the author, date, and commentid_code. Comment HTML bodies are reduced to readable plain text.This was prompted by a reader comment on the image-uploads article about bridging session state for comments. During scoping I split the work: reading comments is a documented, API-key/public, read-only endpoint and ships here; posting replies has no Forem V1 write endpoint and is deferred (see below).
What's included
api/devto.py:get_comments(article_id)(threaded tree viaGET /comments?a_id=) andget_comment(id_code)(GET /comments/{id}).cli/comments.py: a small HTML-to-text reducer (strip tags, unescape entities, collapse blank lines, no new dependency) and a recursive thread renderer with depth-capped indentation.ruffclean.Why reply-posting is not here
The Forem V1 API exposes no comment write endpoint. Posting would require the session-cookie plus CSRF bridge already used by
devpub upload, plus handling mid-session CSRF rotation. That deserves its own verification spike and PR rather than shipping an unverified write path that could 403 for every user. This PR keeps devpub's guarantee that these commands are safe and read-only.Verification
pytestgives 143 passed;ruff check src/ tests/is clean.--helpconfirmed via the installed console script.4488685): correctly rendered 18 real comments across 4 threads, including nesting, indentation, multi-paragraph bodies,@username, dates, andid_code.Follow-up
Tracked in #15: the
devpub replyspike (request shape and CSRF rotation behavior).