Open-Source Wikis

/

GitHub CLI

/

GitHub CLI

cli/cli

GitHub CLI

gh is GitHub on the command line. The repository at cli/cli ships a single Go binary that brings pull requests, issues, releases, GitHub Actions, Codespaces, repository management, and many other GitHub features to the terminal next to where you already work with git.

What this codebase is

  • A Go (1.26+) project with module path github.com/cli/cli/v2.
  • A Cobra-based CLI rooted at cmd/gh/main.go and assembled in pkg/cmd/root/root.go.
  • Hundreds of subcommands, each living in its own pkg/cmd/<command>/<subcommand>/ package.
  • A GitHub API client (api/), a git client wrapper (git/), a feature-detection layer (internal/featuredetection/), terminal I/O abstractions (pkg/iostreams/), and an HTTP mocking framework (pkg/httpmock/).
  • An extension system (pkg/cmd/extension/) that lets users install third-party gh-<name> extensions.
  • An attestation subsystem (pkg/cmd/attestation/) that verifies SLSA provenance via Sigstore.
  • A skills subsystem (pkg/cmd/skills/, internal/skills/) for installing and running natural-language workflows.

Who uses it

  • Developers running gh from a terminal on macOS, Linux, or Windows against github.com, GitHub Enterprise Cloud, or GitHub Enterprise Server 2.20+.
  • AI coding agents (Codex, Claude Code, Copilot CLI, Gemini CLI, Amp, OpenCode) that detect themselves via environment variables and identify in API headers. See internal/agents/detect.go.
  • CI pipelines via the pre-installed gh on GitHub-hosted runners.
  • Architecture: how the binary is structured and how a single gh invocation flows.
  • Getting started: how to build, test, and lint locally.
  • Glossary: vocabulary specific to this codebase.
  • How to contribute: branching, PRs, and the definition of done.
  • Commands: every gh top-level command, grouped by domain.
  • Systems: internal subsystems shared across commands.
  • Reference: configuration, dependencies, and other reference material.

Where to look first

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

GitHub CLI – GitHub CLI wiki | Factory