feat: Add image download and processing support#8
Merged
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #7
This commit implements comprehensive image handling for pull requests:
## Features Added:
- Download embedded images from PR body, comments, and reviews
- Extract images from both Markdown () and HTML (<img src="url">)
- Validate downloaded files by checking magic bytes (not just extension)
- Handle GitHub S3 signed URLs and redirects
- Update markdown to reference local image paths
- Add JSON output format for programmatic use
- Add new CLI options:
- --download-images (default: true)
- --include-reviews (default: true)
- --format (markdown/json)
- --verbose (-v)
## Technical Implementation:
- Image validation using magic bytes for PNG, JPG, GIF, WebP, BMP, ICO, SVG
- Detection of HTML error pages (404 pages mistakenly downloaded as images)
- Redirect handling for up to 5 hops
- Graceful error handling for failed image downloads
- Proper authentication for GitHub-hosted images
## Output Structure:
When saving to directory:
- pr-{number}.md (or .json) - PR content with local image references
- pr-{number}-images/ - Downloaded images
Fixes #7
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
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
This PR implements comprehensive image handling for pull requests, solving the "Could not process image" errors when used with Claude Code CLI. It adds support for downloading and validating embedded images from PR descriptions, comments, and reviews.
Key Features
) and HTML (<img src="url">) image references--format jsonoption for programmatic use--download-images(default: true) - Download embedded images--include-reviews(default: true) - Include PR reviews--format markdown|json- Output format--verbose/-v- Enable verbose loggingOutput Structure
When saving to a directory:
CLI Options
Usage Examples
Technical Implementation
Testing
Issue Reference
Fixes #7
🤖 Generated with Claude Code