Skip to content

feat: add upload-image skill - #43

Open
saoudrizwan wants to merge 1 commit into
mainfrom
saoudrizwan/add-upload-image-skill
Open

feat: add upload-image skill#43
saoudrizwan wants to merge 1 commit into
mainfrom
saoudrizwan/add-upload-image-skill

Conversation

@saoudrizwan

Copy link
Copy Markdown
Contributor

What

Adds a new upload-image skill: upload a local image (screenshot, diagram, gif) and get back a public URL to embed in a GitHub PR description, issue, or any markdown.

The skill commits the image into a public GitHub repo that acts as an image bucket and returns its raw.githubusercontent.com URL. The bucket defaults to cline/assets-internal but is a REPO variable so anyone can point it at a public repo they can push to.

Why this approach

We wanted a dead-simple "give me a URL for this screenshot" flow for writing PR descriptions, and evaluated the options:

  • imgur — no longer allows free API uploads, so it's out.
  • gh release upload — works on a normal machine, but the upload goes to uploads.github.com, which some restricted/sandboxed environments (e.g. agent sandboxes sitting behind an auth proxy) don't authenticate — you get 401 Bad credentials. The contents API goes through api.github.com, which works everywhere, so committing the file is the portable path.
  • Third-party hosts (catbox, etc.) — no auth needed, but they can purge old/anonymous uploads, and a dead image link in a long-lived PR description is exactly the failure mode we want to avoid. Committing into a repo we own means the image lives as long as the repo does.

The bucket repo must be public so the raw URLs render for anyone reading the PR (a private repo's URLs require auth and show as broken images).

Requirement / caveat

The skill commits the image, so it needs push access to the bucket repo. With the default cline/assets-internal bucket that means being a Cline org member; external users without write access will get a 403 unless they change REPO to a bucket they own. This is called out prominently at the top of the skill.

How it works

REPO="cline/assets-internal"
SRC="/path/to/screenshot.png"
# name is sanitized + timestamp-prefixed to avoid collisions, base64'd into a
# JSON payload file (dodges argv limits), then committed via the contents API:
gh api "repos/$REPO/contents/images/<ts>-<name>.png" -X PUT --input payload.json
# → https://raw.githubusercontent.com/$REPO/main/images/<ts>-<name>.png

How to test

  1. gh auth status (authed with push access to a public bucket repo)
  2. Point REPO at that bucket, SRC at a local image, run the upload block from the skill
  3. curl -sL -o /dev/null -w "HTTP %{http_code}" "$URL" returns HTTP 200
  4. The raw URL renders inline when pasted into a PR/issue as ![](url)

Uploads a local image to a public GitHub bucket repo via the contents API and returns its raw.githubusercontent.com URL for embedding in PR descriptions, issues, or markdown. Defaults the bucket to cline/assets-internal; requires push access to the bucket repo.
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.

1 participant