feat: change external storage CLI output to JSON format#3
Closed
feat: change external storage CLI output to JSON format#3
Conversation
Add -u (--image-upload-command) and -d (--image-delete-command) flags to allow using external CLI tools for image upload and deletion instead of Google Drive. The external CLI receives image data via stdin and environment variables: - DECK_UPLOAD_MIME: MIME type of the image - DECK_UPLOAD_FILENAME: suggested filename - DECK_DELETE_ID: resource ID to delete The upload command should output: - Line 1: public URL of the uploaded image - Line 2: resource ID for later deletion This enables integration with custom storage backends like GCS, S3, or any other service via CLI wrappers, similar to how laminate works for code block to image conversion. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for CEL template expressions in image upload/delete commands,
similar to how -c (code-block-to-image-command) works.
Upload command (-u) supports:
- {{mime}} - MIME type of the image
- {{filename}} - suggested filename
- {{env.XXX}} - environment variables
Delete command (-d) supports:
- {{id}} - resource ID to delete
- {{env.XXX}} - environment variables
Implementation:
- Extract template expansion logic into new `template` package
- Move tests from md/template_test.go to template/template_test.go
- Update md and deck packages to use the shared template package
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The filename is not used by external uploaders like reprint-gcs, which generate their own object IDs using UUIDs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename uploader.go to storage.go - Rename Uploader interface to Storage - Rename googleDriveUploader to googleDriveStorage - Rename externalUploader to externalStorage - Inline constants (DECK_UPLOAD_MIME, DECK_DELETE_ID) into functions - Inline generateTempFilename() into googleDriveStorage.Upload() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change the output format from two lines (URL and ID) to JSON:
- Upload: {"url":"...","id":"..."}
- Delete: {}
This follows the common CLI pattern and is easier to extend.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <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.
Summary
{"url":"...","id":"..."}{}Background
Based on feedback from k1LoW#481 (comment)
JSON format was chosen for:
aws,gh)Test plan
🤖 Generated with Claude Code