@jonchurch/claude-code-gh 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # claude-code-gh
2
2
 
3
- Claude Code web sessions run on ephemeral VMs that don't have the GitHub CLI (`gh`) installed. This means that if you're used to having claude work with the `gh` cli locally for interacting with Github, you are not able to in Claude Code web sessions.
3
+ Claude Code web sessions run on ephemeral VMs without the GitHub CLI (`gh`). If you're used to having Claude work with `gh` locally, you won't be able to in web sessions.
4
4
 
5
- This package provides a [SessionStart hook](https://code.claude.com/docs/en/hooks#sessionstart) that installs the latest `gh` automatically when your session starts. Hooks are scripts that Claude Code runs at specific points - SessionStart hooks run once when a new session begins, making them perfect for environment setup.
5
+ This package fixes that by installing `gh` automatically [when your session starts](https://code.claude.com/docs/en/hooks#sessionstart).
6
6
 
7
7
  ## Setup
8
8
 
9
- Add to your repo's `.claude/settings.json` (not user level `~/.claude/settings.json` because remote sessions only see repo-level settings):
9
+ Remote sessions only see repo-level settings. Add to `.claude/settings.json` in your repo:
10
10
 
11
11
  ```json
12
12
  {
@@ -26,13 +26,15 @@ Add to your repo's `.claude/settings.json` (not user level `~/.claude/settings.j
26
26
  }
27
27
  ```
28
28
 
29
- Commit that file and `gh` will be available in your next web session.
29
+ Commit and `gh` will be available in your next web session.
30
30
 
31
- ## Environment
31
+ ## Environment / Network Settings
32
32
 
33
- Your Claude Code environment needs "Limited" (default) or "Full" network access. "No internet" mode will fail since we need to reach GitHub.
33
+ Requires **"Full"** [network access](https://code.claude.com/docs/en/claude-code-on-the-web), or **"Custom"** with `release-assets.githubusercontent.com` allowed. ("Limited" won't work - GitHub downloads redirect to that domain.)
34
34
 
35
- To authenticate `gh` for private repos or higher rate limits, add `GH_TOKEN` to your environment variables in the Claude web app settings.
35
+ ## Authentication
36
+
37
+ For private repos or higher rate limits, add `GH_TOKEN` to your environment variables.
36
38
 
37
39
  ## License
38
40
 
package/bin/setup.sh CHANGED
@@ -2,7 +2,6 @@
2
2
  set -eo pipefail
3
3
 
4
4
  log() { echo "[claude-code-gh] $1" >&2; }
5
- context() { echo "{\"hookSpecificOutput\":{\"hookEventName\":\"SessionStart\",\"additionalContext\":\"$1\"}}"; }
6
5
 
7
6
  ### -------- check if we need to install the cli
8
7
 
@@ -14,14 +13,15 @@ export PATH="$LOCAL_BIN:$PATH"
14
13
 
15
14
  if command -v gh &>/dev/null; then
16
15
  log "gh already available"
17
- context "GitHub CLI available: $(gh --version | head -1)"
16
+ echo "GitHub CLI available: $(gh --version | head -1)"
18
17
  exit 0
19
18
  fi
20
19
 
21
20
  ### -------- check network access
22
21
 
23
- if ! curl -sL --connect-timeout 5 -o /dev/null https://api.github.com 2>/dev/null; then
24
- log "Failed to install gh CLI: cannot reach GitHub API. Network may be restricted - configure 'Limited' or 'Full' network access in your Claude Code environment settings."
22
+ if ! curl -sL --connect-timeout 5 -o /dev/null https://release-assets.githubusercontent.com 2>/dev/null; then
23
+ log "Cannot download gh CLI: release-assets.githubusercontent.com is not reachable."
24
+ log "Fix: Use 'Full' network access, or add release-assets.githubusercontent.com to your Custom allowlist."
25
25
  exit 2
26
26
  fi
27
27
 
@@ -36,10 +36,8 @@ case "$ARCH" in
36
36
  *) log "Failed to install gh CLI: unsupported architecture '$ARCH'. Only x86_64 and arm64 are supported."; exit 2 ;;
37
37
  esac
38
38
 
39
- log "Detected arch $ARCH"
40
-
41
39
  # Fetch latest version from GitHub API
42
- RELEASE_JSON=$(curl -sL "https://api.github.com/repos/cli/cli/releases/latest") || { log "Failed to install gh CLI: could not fetch release info from GitHub API."; exit 2; }
40
+ RELEASE_JSON=$(curl -sL --retry 2 "https://api.github.com/repos/cli/cli/releases/latest") || { log "Failed to fetch release info from GitHub API"; exit 2; }
43
41
  if command -v jq &>/dev/null; then
44
42
  VERSION=$(echo "$RELEASE_JSON" | jq -r '.tag_name | ltrimstr("v")')
45
43
  else
@@ -54,9 +52,9 @@ trap 'rm -rf "$TEMP_DIR"' EXIT
54
52
  ### -------- fetch and unpack the tarball
55
53
 
56
54
  TAR_NAME="gh_${VERSION}_linux_${GH_ARCH}"
57
- curl -sL "https://github.com/cli/cli/releases/download/v${VERSION}/${TAR_NAME}.tar.gz" \
58
- | tar -xz -C "$TEMP_DIR" || { log "Failed to install gh CLI: could not download or extract release tarball."; exit 2; }
55
+ TAR_URL="https://github.com/cli/cli/releases/download/v${VERSION}/${TAR_NAME}.tar.gz"
59
56
 
57
+ curl -sL --retry 2 "$TAR_URL" | tar -xz -C "$TEMP_DIR" || { log "Failed to download/extract gh CLI"; exit 2; }
60
58
 
61
59
  ### -------- mv the binary to local bin
62
60
 
@@ -64,4 +62,4 @@ mv "$TEMP_DIR/${TAR_NAME}/bin/gh" "$LOCAL_BIN/" && chmod +x "$LOCAL_BIN/gh"
64
62
  [[ -n "$CLAUDE_ENV_FILE" ]] && echo "export PATH=\"$LOCAL_BIN:\$PATH\"" >> "$CLAUDE_ENV_FILE"
65
63
 
66
64
  log "Installed $(gh --version | head -1)"
67
- context "GitHub CLI installed: $(gh --version | head -1) use gh for github operations"
65
+ echo "GitHub CLI installed: $(gh --version | head -1) - use gh for GitHub operations"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonchurch/claude-code-gh",
3
- "version": "0.1.1",
3
+ "version": "1.0.0",
4
4
  "description": "Auto-install GitHub CLI (gh) for Claude Code web/remote sessions",
5
5
  "author": "Jon Church",
6
6
  "license": "MIT",