npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gkoreli/ghx

v2.0.2

Published

Agent-first GitHub code exploration. GraphQL batching, code maps, codemode TypeScript sandbox, MCP server.

Readme

ghx — GitHub Code Exploration for AI Agents

One command does what takes 3-5 API calls. Batch file reads, code maps, search — all via gh CLI. Write JS programs that compose operations in one round-trip.

Why

AI agents exploring GitHub face a reliability gap: "Did I find nothing because nothing exists, or because I used the tool wrong?" Raw gh commands have silent failure modes — gh search code wraps in quotes without telling you, gh api contents/ returns base64, README requires a separate call. The agent can't distinguish "no results" from "wrong flags."

ghx eliminates this by encoding the right defaults into every command. One call returns enough context to decide the next action.

| Tool | Files per call | Matching context | Programmable | Dependencies | |------|---------------|-----------------|-------------|-------------| | GitHub MCP | 1 | No | No (~10K token schemas) | Go binary | | gh CLI | 1 | No | No (exact phrase, base64, no README) | gh | | ghx | 1-10 (batch) | Yes | Yes (codemode) | gh |

Install

# Build from source
cd v2 && go build -o ghx .

# Homebrew
brew install gkoreli/tap/ghx

# One-liner
curl -sfL https://raw.githubusercontent.com/gkoreli/ghx/mainline/install.sh | bash

Requires: gh CLI authenticated (gh auth login).

Commands

ghx explore <owner/repo>                    # Branch + tree + README in 1 API call
ghx explore <owner/repo> <path>             # Subdirectory listing
ghx read <owner/repo> <f1> [f2] [f3]       # Read 1-10 files (GraphQL batching)
ghx search "<query>"                        # Code search with matching lines
ghx repos "<query>"                         # Repo search with README preview
ghx tree <owner/repo> [path]                # Full recursive tree

Codemode

Write JS programs that compose multiple operations in one round-trip. All codemode.* calls are synchronous — no await. Full TypeScript type stubs with return types are injected into the sandbox.

# What branch is this repo on?
ghx code 'var r = codemode.explore({repo: "vercel/next.js"}); return r.branch;'

# Search + read composition
ghx code 'var hits = codemode.search({query: "useState repo:vercel/next.js", limit: 3});
var first = codemode.read({repo: "vercel/next.js", files: [hits.matches[0].path]});
return {file: hits.matches[0].path, lines: first[0].content.split("\n").length};'

# See what tools and types are available
ghx code --list

Type stubs tell the LLM exactly what fields exist — no guessing:

declare const codemode: {
  explore: (input: ExploreInput) => { description: string; branch: string; files: { name: string; type: string }[]; readme: string };
  search: (input: SearchInput) => { total: number; incomplete: boolean; matches: { repo: string; path: string; fragment: string }[] };
  tree: (input: TreeInput) => string[];
  // ...
}

MCP Server

ghx serve                                   # stdio (for Claude, Cursor, etc.)
ghx serve --http :8080                       # HTTP transport

7 tools: explore, read, search, repos, tree, code (meta-tool), search_tools.

Agent Integration

ghx skill                                   # CLI skill (for SKILL.md injection)
ghx skill --mcp                             # MCP skill

Designed for eager context injection via spawn hooks — the agent always has the latest ghx knowledge without loading it mid-conversation.

How It Works

Wraps gh CLI with GraphQL batching. repos and explore batch search + metadata + README into 1 call. read uses GraphQL aliases to fetch up to 10 files in 1 call. search hits REST /search/code with text_matches for matching context and 200-char token protection.

Codemode runs JS in a goja sandbox with esbuild TypeScript transpilation. Tools are injected as synchronous functions on a codemode global object. Max 20 tool calls per execution, 64KB code size limit.

Architecture

v2/
├── pkg/ghx/       — core library (Explore, Read, Search, Repos, Tree)
├── pkg/codemode/  — JS executor (goja sandbox, TS transpilation, type generation)
└── cmd/           — CLI frontend (cobra) + MCP server (mcp-go)

See docs/adr/ for architectural decisions.

v1 (bash)

The original bash implementation is in v1/. Zero dependencies beyond gh and jq — useful if you just want a shell script you can drop anywhere without compiling Go.

npm install -g @gkoreli/ghx    # npm
cp v1/ghx /usr/local/bin/ghx   # manual

License

MIT