gh-cli
Intercepts GitHub URL fetches (WebFetch and MCP fetch tools) and curl/wget commands, redirecting to the authenticated gh CLI.
Imported description, not reviewed yet
This item came from its original repository and was only scanned automatically; no editor has written an Arabic description for it yet. Read its content yourself before you rely on it. This page is not indexed by search engines until it is reviewed.
Download
Read this before you download
Talqeen never runs anything from this item. But what you download runs on your machine if you run it or let Claude Code run it, so read the files first.
- The item has script files.
- The item has hooks that run automatically on events in Claude Code.
Install
Plugins are installed from a plugin marketplace in Claude Code, not by copying files. Download the package to read its content and its license.
Instructions
gh-cli
A Claude Code plugin that intercepts GitHub URL fetches and redirects Claude to use the authenticated gh CLI instead.
Problem
Claude Code's WebFetch tool, MCP fetch tools (Exa's web_fetch_exa and similar), and Bash curl/wget commands don't use the user's GitHub authentication. This means:
- Private repos: Fetches fail with 404 errors
- Rate limits: Unauthenticated requests are limited to 60/hour (vs 5,000/hour authenticated)
- Missing data: Some API responses are incomplete without authentication
Solution
This plugin provides:
- PreToolUse hooks that intercept GitHub URL access via
WebFetch, MCP fetch/scrape/crawl/extract tools, orcurl/wget, and suggest the correctghCLI command - A
ghPATH shim that blocks anti-patterns: API/contents/fetching and non-session-scoped temp directory clones - A SessionEnd hook that automatically cleans up cloned repositories when the session ends
What Gets Intercepted
The fetch hook matches WebFetch plus any MCP tool whose name contains fetch,
scrape, crawl, or extract — mcp__exa__web_fetch_exa,
mcp__firecrawl__firecrawl_scrape, mcp__tavily__tavily_extract, and
equivalents from other MCP servers. Web tools named something else entirely
(browser navigation, for instance) are not covered; hooks/matcher.bats records
exactly which names match.
It reads both fetch payload shapes — WebFetch's single url, and the urls
field MCP fetch tools use to batch several pages into one call, whether that
field arrives as an array or a bare string. Because a tool call is atomic, one
GitHub URL anywhere in a batch denies the whole call; the denial names each
offending URL alongside its suggestion. WebFetch's prompt field is
deliberately not scanned, so a prompt that merely mentions a GitHub URL is not
denied.
| Tool | Pattern | Suggestion |
|---|---|---|
WebFetch, MCP fetch | github.com/{owner}/{repo} | gh repo view owner/repo |
WebFetch, MCP fetch | github.com/.../blob/... | gh repo clone + Read |
WebFetch, MCP fetch | github.com/.../tree/... | gh repo clone + Read/Glob/Grep |
WebFetch, MCP fetch | github.com/.../pull/{n} | gh pr view |
WebFetch, MCP fetch | github.com/.../issues/{n} | gh issue view |
WebFetch, MCP fetch | github.com/.../releases/download/... | gh release download |
WebFetch, MCP fetch | api.github.com/repos/.../pulls | gh pr list / gh pr view |
WebFetch, MCP fetch | api.github.com/repos/.../issues | gh issue list / gh issue view |
WebFetch, MCP fetch | api.github.com/repos/.../contents/... | gh repo clone + Read |
WebFetch, MCP fetch | api.github.com/repos/.../releases | gh release list |
WebFetch, MCP fetch | api.github.com/repos/.../actions | gh run list |
WebFetch, MCP fetch | api.github.com/... (anything else) | gh api <endpoint> |
WebFetch, MCP fetch | raw.githubusercontent.com/... | gh repo clone + Read |
WebFetch, MCP fetch | gist.github.com/... | gh gist view |
Bash | curl https://api.github.com/... | gh api <endpoint> |
Bash | curl https://raw.githubusercontent.com/... | gh repo clone + Read |
Bash | wget https://github.com/... | gh release download |
Bash (shim) | gh api repos/.../contents/... | gh repo clone + Read |
Bash (shim) | gh repo clone ... /tmp/... (non-session-scoped) | Session-scoped clone path |
What Passes Through
- Non-GitHub URLs (any domain that isn't
github.com,api.github.com,raw.githubusercontent.com, orgist.github.com) - GitHub Pages sites (
*.github.io) - Commands already using
gh(except anti-patterns blocked by the shim; see table above) - Git commands (
git clone,git push, etc.) - Search commands that mention GitHub URLs (
grep,rg, etc.)
Note: When hooks deny blob/tree/raw URLs, the denial message explicitly warns against using gh api to fetch and base64-decode file contents as a fallback — clone the repo instead.
Automatic Cleanup
Cloned repositories are stored in session-scoped temp directories ($TMPDIR/gh-clones-<session-id>/). A SessionEnd hook automatically removes them when the session ends, so there's no manual cleanup needed and concurrent sessions don't interfere with each other.
Prerequisites
- GitHub CLI (
gh) must be installed and authenticated (gh auth login) - If
ghis not installed, the hooks pass through without disruption
Installation
/plugin marketplace add trailofbits/skills
/plugin install gh-cli
Files
- folder.claude-plugin324 B
- plugin.json324 B
- folderhooks61 KBscript
- foldershims13 KBscript
- gh3 KBscript
- gh-shim.bats10 KBscript
- cleanup-clones.sh737 Bscript
- hooks.json1.4 KB
- intercept-github-curl.bats8.2 KBscript
- intercept-github-curl.sh2.9 KBscript
- intercept-github-fetch.bats9.8 KBscript
- intercept-github-fetch.sh5.5 KBscript
- matcher.bats4.4 KBscript
- persist-session-id.sh1.2 KBscript
- session-hooks.bats4.7 KBscript
- setup-shims.bats3.9 KBscript
- setup-shims.sh1.3 KBscript
- test_helper.bash4.1 KBscript
- folderskills4.4 KB
- foldergh-cli4.4 KB
- folderagents219 B
- openai.yaml219 B
- folderassets3 KB
- trail-of-bits-mark.svg3 KB
- SKILL.md1.2 KB
- LICENSE20 KB
- README.md4.5 KB
What the automatic scan found
We scanned the files automatically when they were imported. This is what the scan pointed at. It does not mean the item is harmful, and it does not mean it is safe: read it yourself.
- Needs a lookA command that runs inside a hook
In file plugins/gh-cli/hooks/hooks.json
- Needs a lookA command that runs inside a hook
In file plugins/gh-cli/hooks/hooks.json
- Needs a lookA command that runs inside a hook
In file plugins/gh-cli/hooks/hooks.json
- Needs a lookA command that runs inside a hook
In file plugins/gh-cli/hooks/hooks.json
- Needs a lookA command that runs inside a hook
In file plugins/gh-cli/hooks/hooks.json
- Needs a lookA script file
In file plugins/gh-cli/hooks/cleanup-clones.sh
- Needs a lookDeletes files forcibly and recursively
In file plugins/gh-cli/hooks/cleanup-clones.sh, line 17
- Needs a lookDeletes files forcibly and recursively
In file plugins/gh-cli/hooks/session-hooks.bats, line 44
- Needs a lookDeletes files forcibly and recursively
In file plugins/gh-cli/hooks/setup-shims.bats, line 19
- Needs a lookDeletes files forcibly and recursively
In file plugins/gh-cli/hooks/shims/gh-shim.bats, line 25
- Needs a lookDeletes files forcibly and recursively
In file plugins/gh-cli/hooks/test_helper.bash, line 49
Comments (0)
No comments yet. Be the first.
Sign in to comment. Commenting comes at level 1 (Member).