mcpField
G
github-images

github-images

github.com/connorads开发1843 次安装2 天前更新
代码仓库

关于 github-images

用于下载 GitHub issue 和 pull request 图片附件的技能,也支持需要身份验证的私有仓库。它提供 `ghimg` 命令,并可用 `gh api` 作为备用方式获取图片链接。

主要功能

  1. 01下载 issue 和 pull request 图片
  2. 02支持需身份验证的私有仓库
  3. 03接受 GitHub 链接或仓库名与编号
  4. 04提供 `gh api` 手动备用方法

适用场景

  1. 01查看 issue 中附带的截图
  2. 02获取 pull request 中的图片
  3. 03收集私有仓库中的附件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/connorads/dotfiles --skill github-images

安装后在 Claude Code 中输入/github-images确认已加载。

详细介绍

github-images

从 GitHub issue 和拉取请求中下载图片附件,包括需要身份验证的私有仓库。

使用场景

  • 用户分享了 GitHub issue/PR URL,你需要查看其中的截图或图片
  • 你需要从私有仓库下载图片附件
  • 用户要求“抓取该 issue 中的截图”或类似内容

用法

# From a full GitHub URL
ghimg https://github.com/owner/repo/issues/39

# From a PR URL
ghimg https://github.com/owner/repo/pull/42

# Using owner/repo and number separately
ghimg owner/repo 39

# Custom output directory
ghimg owner/repo 39 -o ./screenshots

# Print signed URLs only (pipe-friendly)
ghimg owner/repo 39 --urls-only

默认输出路径:/tmp/ghimg/<owner>/<repo>/<number>/

下载后,使用 Read 查看图片(Claude Code 支持图片文件)。

手动备用方案

如果 ghimg 不可用,请直接使用 gh api:

# Fetch body_html with signed image URLs (valid ~5 min)
gh api repos/owner/repo/issues/39 \
  -H "Accept: application/vnd.github.full+json" \
  --jq '.body_html'

# Fetch comment images too
gh api repos/owner/repo/issues/39/comments \
  -H "Accept: application/vnd.github.full+json" \
  --paginate --jq '.[].body_html'

# Download a signed URL
curl -sL -o image.png "https://private-user-images.githubusercontent.com/..."

关键点:application/vnd.github.full+json 会返回包含 JWT 签名 URL 的 body_html,用于访问私有图片附件。这些 URL 会在约 5 分钟后过期。

评论

支持 Markdown