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

octocode-cli

v16.3.0

Published

Code research CLI for Octocode tools, local workspaces, GitHub repositories, LSP, and MCP setup

Readme

Octocode CLI

npm version npm downloads License

Code research from the terminal: run Octocode tools for local workspaces, GitHub repositories, LSP navigation, packages, and PRs. It also configures Octocode MCP for supported IDEs.

Website · CLI Reference · GitHub


Install

# Homebrew (macOS / Linux): installs the `octocode` command globally
brew install bgauryy/octocode/octocode

# or tap once, then use the short name
brew tap bgauryy/octocode
brew install octocode

# or npm (global)
npm install -g octocode-cli

# or run once without installing
npx octocode-cli install

Verify, then sign in:

octocode --version        # → octocode v1.6.0
octocode login            # GitHub OAuth (device flow)

The installed command is octocode (not octocode-cli). Homebrew pulls in Node automatically.

Quick Start

octocode context                                       # agent protocol + tool fields
octocode tree .                                        # inspect local structure
octocode files auth . --search both --ext ts           # discover files + content hits
octocode search "TODO" . --type ts                     # search code
octocode repo mcp agents --language TypeScript         # discover GitHub repos
octocode pkg zod                                       # package metadata + source repo
octocode symbols src/index.ts                          # semantic outline
octocode lsp src/index.ts --type documentSymbols       # semantic outline
octocode tools localSearchCode --scheme                # inspect exact schema
octocode tools localSearchCode --queries '{"path":".","keywords":"TODO"}'

Agents: run octocode context first. It prints the protocol, every tool, and input field specs in one shot.


The 12 Tools

Call any tool directly from the terminal. Great for scripts, pipelines, and one-off queries. No MCP server required.

| Group | Tool | What it does | |-------|------|--------------| | GitHub | ghSearchCode | Search code across GitHub [EXTERNAL] | | | ghSearchRepos | Search repositories by keywords/topics [EXTERNAL] | | | ghSearchPRs | Search pull requests [EXTERNAL] | | | ghGetFileContent | Read file content (matchString, line ranges) [EXTERNAL] | | | ghViewRepoStructure | List a repo's directory tree [EXTERNAL] | | | ghCloneRepo | Clone a repo/subtree to disk for local + LSP analysis | | Local | localSearchCode | Search code patterns with ripgrep (PCRE2) | | | localFindFiles | Find files by name/metadata | | | localGetFileContent | Read local file content | | | localViewStructure | View a local directory tree | | LSP | lspGetSemantics | Definitions, references, call flow, hover, symbols, type definitions, implementations | | Package | npmSearch | Resolve an npm package to its source repo + metadata |

# Discover
octocode context                                  # agent bootstrap: protocol + tools + input fields
octocode context --full                           # …plus every tool's full JSON schema inline
octocode tools                                    # list all tools
octocode tools localSearchCode --scheme           # show one tool's schema
octocode tools localSearchCode ghSearchCode   # batch schemas

# Run
octocode tools localSearchCode --queries '{"path":".","keywords":"TODO"}'
octocode tools ghSearchCode --queries '{"keywordsToSearch":["useReducer"],"owner":"facebook","repo":"react"}'
octocode tools localSearchCode --queries '{"path":".","keywords":"TODO"}' --json     # full MCP envelope
octocode tools localSearchCode --queries '{"path":".","keywords":"TODO"}' --compact  # leanest (structuredContent only)

The shared metadata fields (id, researchGoal, reasoning, mainResearchGoal) are auto-filled. Provide only tool-specific fields.

For agents: run octocode context once for the full bootstrap (protocol + every tool + input fields + the mandatory "read the schema before calling" rule + the exit-code table). Then octocode tools <name> --scheme to confirm a tool's exact schema before calling it. This checklist is also printed at the top of octocode --help.


GitHub Token

Octocode resolves a GitHub token in this order: environment variable → Octocode-managed token (octocode login) → gh CLI.

For env-based setup, any of these are accepted (checked in this priority): OCTOCODE_TOKEN, GH_TOKEN, GITHUB_TOKEN.

export GITHUB_TOKEN=ghp_xxx        # or OCTOCODE_TOKEN / GH_TOKEN
octocode token --source           # show which token & source is being used
octocode token --validate         # ping the GitHub API to verify it
octocode token                    # masked on screen; raw when piped, e.g. export GH_TOKEN=$(octocode token)
octocode token --reveal           # print the full token on screen

Commands

| Command | What it does | |---------|--------------| | get <path\|github-ref> | Fetch and minify file content | | tree <path\|github-ref> | View local or GitHub directory structure | | files <query> [path\|github-ref] | Find file paths and content matches | | search <pattern> <path\|github-ref> | Search local or GitHub code | | pr <owner/repo[#N] \| PR-URL> | Search or deep-dive pull requests | | repo <keywords...> | Discover GitHub repositories by keyword, topic, owner, and quality filters | | pkg <package> | Research npm package metadata and source repository | | symbols <file\|path> | Show semantic symbol outlines for local files or directories | | lsp <file> --type <type> | Run LSP semantic navigation for a local source file | | tools [name...] | List tools, show schema(s), or run with --queries '<json>' | | context | Print agent context and every tool schema | | install --ide <ide> | Configure octocode-mcp for an IDE | | auth [login\|logout\|status\|token\|refresh] | GitHub authentication | | login / logout | Top-level shortcuts for auth login/logout | | token | Print the resolved GitHub token | | status | Health check: auth, MCP clients, and cache | | status --sync | Include per-MCP sync analysis | | skills | Install, remove, list, search, read, or sync skills |

Most subcommands accept --hostname <host> for GitHub Enterprise.


Global Flags

| Flag | Description | |------|-------------| | --json | Raw JSON output (full MCP envelope) for tool runs | | --compact | Leanest tool output: minified structuredContent only (~60% smaller than --json) | | --no-color | Disable ANSI colors (also honored via NO_COLOR=1) | | --version | Print the CLI version | | --help | Show help for the CLI or a command |

Environment

| Variable | Purpose | |----------|---------| | OCTOCODE_TOKEN | GitHub token (checked first) | | GH_TOKEN | GitHub token (checked second) | | GITHUB_TOKEN | GitHub token (checked third) | | OCTOCODE_HOME | Override the data directory (default ~/.octocode) |

Exit Codes

| Code | Meaning | |------|---------| | 0 | Success | | 1 | General error | | 2 | Invalid input / unsupported flags | | 3 | Unknown tool or command | | 4 | Authentication failure | | 5 | Tool / API execution error | | 7 | Rate limited |

Typed codes 27 apply to the tool surface and command dispatch, so agents can branch on the failure mode without parsing output. Management commands (install, auth, skills, …) use 0/1.


Supported Clients

cursor, claude-desktop, claude-code, windsurf, zed, vscode-cline, vscode-roo, vscode-continue, opencode, trae, antigravity, codex, gemini-cli, goose, kiro


Troubleshooting

octocode status --sync                   # Full health check including sync analysis
octocode token --validate                # Verify your GitHub token against the API
octocode token --source                  # Debug token resolution chain
octocode install --ide cursor --check    # Pre-flight before installing

Docs


Privacy & Telemetry

De-identified telemetry (command usage, error rates) helps improve the CLI. Source code, env values, and repo contents are not collected.

Privacy Policy · Terms of Usage

MIT. Copyright 2026 Octocode AI.