Repository navigation
feat(upload): --json output + fix(push): tags sent as array - #13
Open
HarishTeens wants to merge 2 commits into
Open
HarishTeens wants to merge 2 commits into
HarishTeens wants to merge 2 commits into
Conversation
article_to_api_payload joined the parsed tag list back into a comma string. Dev.to accepts that field but silently produces an empty tag_list, so every push published the article with no tags. Send the list directly (reusing _parse_tags), and omit the field when empty. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Prints a machine-readable result object ({uploaded, failed}) to stdout for
scripting; human progress goes to stderr so stdout stays pure JSON, and the
command exits non-zero if any file failed. Mutually exclusive with --markdown.
Bumps to 0.4.0.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Follow-up to #12. Two changes.
1.
devpub upload --json(the flag you suggested)Machine-readable output for scripting:
Design points:
Uploaded: …, the summary) goes to stderr in--jsonmode, sodevpub upload *.png --json | jqjust works.--json. A CLI that half-fails silently returning 0 is a footgun for scripts;failedis also surfaced in the JSON.--markdown(raises aUsageError).2.
fix(push): tags were being droppedSeparate bug I hit while using the tool:
article_to_api_payloadparsed frontmatter tags into a list and then re-joined them into a comma string before sending. Dev.to accepts a stringtagsfield but silently yields an emptytag_list, so everydevpub pushpublished the article with no tags. Now it sends the array (reusing_parse_tags) and omits the field when empty. Updated the one existing test that asserted the buggy string form, plus added cases (list, comma-string, empties).You'd asked to bundle these; happy to split into two PRs if you'd prefer to review/merge them independently.
Verification
New tests:
tests/test_cli_upload.py(JSON purity on stdout, failure→exit 1, mutual exclusion) and tag cases intests/test_articles.py.Bumps to 0.4.0 (new flag = minor; the tags change is a bugfix in the same release).
🤖 Generated with Claude Code