Skip to content

feat: add --image-url CLI option#173

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-cli-option-image-url
Draft

feat: add --image-url CLI option#173
Copilot wants to merge 2 commits into
mainfrom
copilot/add-cli-option-image-url

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

Summary

Adds a new --image-url CLI option that accepts a URL for an image to include with a post. When provided, the URL is downloaded using fetch, validated to return image content, and stored in an ImageEmbed with both the binary data and the source url. The Dev.to strategy is updated to prefer the url property over base64-encoded binary data when embedding images.

Changes

  • src/types.js: Added optional url property to ImageEmbed type
  • src/bin.js:
    • Added --image-url option (mutually exclusive with --image)
    • Fetches the URL, validates content-type starts with image/, throws on empty body
    • Fills ImageEmbed with both data (binary) and url (source URL)
    • Default alt text falls back to the filename extracted from the URL path
    • Updated help text
  • src/strategies/devto.js: When an image has a url property, use it directly in markdown (![alt](url)) instead of base64-encoding the binary data
  • README.md: Updated CLI docs to document --image-url option and added example
  • tests/strategies/devto.test.js: Added two new tests covering URL-based image embedding (with and without alt text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants