Skip to content

Conversation

@minodisk
Copy link
Owner

@minodisk minodisk commented Dec 26, 2025

Summary

  • Add -u (--image-upload-command) and -d (--image-delete-command) flags to the apply command
  • Enable using external CLI tools for image upload and deletion instead of Google Drive
  • Allows integration with custom storage backends (GCS, S3, etc.) via CLI wrappers
  • Introduce Storage interface for consistent architecture

Architecture

  • Storage interface with Upload() and Delete() methods
  • googleDriveStorage: default implementation using Google Drive
  • externalStorage: implementation using external CLI commands

CLI Specification

Upload Command

The upload command receives:

  • stdin: image binary data
  • Environment variable: DECK_UPLOAD_MIME (MIME type of the image)
  • Template variable: {{mime}}, {{env.XXX}}

Expected output (stdout):

<public URL>
<uploaded ID for deletion>

Delete Command

The delete command receives:

  • Environment variable: DECK_DELETE_ID (uploaded ID to delete)
  • Template variable: {{id}}, {{env.XXX}}

Example Usage

deck apply -i PRESENTATION_ID \
  -u "reprint-gcs upload" \
  -d "reprint-gcs delete" \
  slides.md

Test plan

  • Verify build passes
  • Verify existing Google Drive upload still works when no external CLI is specified
  • Test with reprint-gcs

🤖 Generated with Claude Code

minodisk and others added 4 commits December 26, 2025 09:12
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>
@minodisk minodisk changed the title feat: add external CLI support for image upload/delete Add external storage CLI support Jan 2, 2026
minodisk and others added 5 commits January 3, 2026 04:25
🤖 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>
@minodisk minodisk merged commit 4b3439c into main Jan 2, 2026
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