CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
SessionStart hook for GitHub CLI in Claude Code
This package makes GitHub CLI available in Claude Code on the Web by running a SessionStart hook. When a session begins, it installs `gh` only in the remote Claude environment, updates PATH, and detects `GH_REPO` from the git remote.
Builders who use Claude Code on the Web and need GitHub CLI commands in their sessions.
You can run `gh` commands in Claude Code on the Web without setting up GitHub CLI by hand.
What it does
SessionStart hook install
Runs `bun x gh-setup-hooks` or `npx -y gh-setup-hooks` when a Claude Code session starts.
Remote-only GitHub CLI setup
Installs `gh` only when `CLAUDE_CODE_REMOTE=true`, and skips local environments.
PATH persistence
Installs to `~/.local/bin` and keeps it on PATH for later commands in the session.
GitHub repo detection
Auto-detects `GH_REPO` from the git remote so `gh` works with the current repository.
Custom version control
Uses `GH_SETUP_VERSION` to choose which GitHub CLI version to install.
README
gh-setup-hooks
Auto-install GitHub CLI on Claude Code on the Web. Just add one line to settings.json.
Setup
1. Add hook to settings.json
Add to .claude/settings.json:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "bun x gh-setup-hooks",
"timeout": 120
}
]
}
]
}
}
npx -y gh-setup-hooks is also ok.
2. Set up Claude Code on the Web
To use gh commands (e.g., gh pr create), you need to set GH_TOKEN or GITHUB_TOKEN:
- Go to Claude Code on the Web
- Open Settings → Custom Environment
- Add environment variable:
- Name:
GH_TOKENorGITHUB_TOKEN - Value: Your GitHub Personal Access Token
- Name:
Note: The token needs
reposcope for most operations.
Claude Code on the Web network should be Full or Custom. If using Custom, you need to allow release-assets.githubusercontent.com.
How It Works
- Start a session on Claude Code on the Web
- SessionStart hook runs
npx gh-setup-hooks - Installs gh only in remote environment (
CLAUDE_CODE_REMOTE=true) - Installs to
~/.local/binand persists PATH - Auto-detects
GH_REPOfrom git remote forghCLI compatibility - Does nothing in local environment
Configuration
| Environment Variable | Description | Default |
|---|---|---|
GH_SETUP_VERSION | gh version to install | 2.88.1 |
License
MIT
References
Files in the repo
- bin
- images
- src
- test
- .gitignore
- LICENSE
- package.json
- README.md
Discussion (0)
Ask about usage, or say what you built with itSign in to join the discussion.
No comments yet. Be the first to say what this is good for.
More hooks
Warcraft III Peon voice notifications (+ more!) for Claude Code, Codex, IDEs, and any AI agent. Stop babysitting your terminal. Employ a Peon today.
Read the Qur'an while Claude Code works. Start a session with 'claude --cwq' and a reader beside it walks forward through the Qur'an one ayah per prompt, resuming where you left off — in a terminal pane or a browser tab. Zero dependencies, fully offline.
Clean up Claude's token vomit with a separate LLM. Save your tokens, Opus is hopeless
A pre-execution guard for AI coding agents. It blocks destructive Git and file system commands, plus common attempts to access sensitive files, before a tool call runs. Supports Amp Code, Antigravity CLI, Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, Grok Build, Hermes Agent, Kimi Code, OpenClaw, OpenCode, and Pi.
Automated TDD enforcement for Claude Code