🚀 DAY 2 OF LAUNCH WEEK: Unify Your Security Stack with Socket Basics.Learn more →
Socket
Book a DemoInstallSign in
Socket

@johnlindquist/ghi

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@johnlindquist/ghi

Ingest GitHub repositories and local directories for analysis

Source
npmnpm
Version
1.12.4
Version published
Maintainers
0
Created
Source

ghi (GitHub Ingest)

A powerful CLI tool for deep repository analysis. Quickly scan, analyze, and generate detailed reports of GitHub repositories or local directories. Perfect for understanding new codebases, generating documentation, or analyzing code patterns.

Installation

pnpm add -g ghi

Usage

ghi [options] <repo-or-path>

Examples

# Analyze a GitHub repo using default settings
ghi https://github.com/owner/repo

# Analyze a local directory with custom patterns
ghi /local/path --include "*.ts" --exclude "*.spec.*"

# Clone specific branch, limit file size, pipe output
ghi https://github.com/owner/repo --branch develop --max-size 500000 --pipe

# Multiple include/exclude patterns
ghi /path --include "*.ts,*.js" --exclude "*.test.*,node_modules"

# Open results in editor
ghi /path --open

Options

  • --include, -i - Glob or path patterns to include (comma-separated or multiple flags)
  • --exclude, -e - Glob or path patterns to exclude (comma-separated or multiple flags)
  • --branch, -b - Git branch to clone if using a repo URL
  • --commit, -c - Specific commit SHA to checkout if using a repo URL
  • --max-size, -s - Maximum file size to process in bytes (default: 10MB)
  • --pipe, -p - Pipe output to stdout (still saves results file)
  • --open, -o - Open results in editor
  • --debug - Enable debug logging

Default Excludes

The tool automatically excludes common patterns like:

  • node_modules
  • dist, build
  • .git
  • Various cache and build directories

Output

Results are saved as markdown files in your system's config directory:

  • macOS: ~/Library/Preferences/ghi/config/
  • Linux: ~/.config/ghi/config/
  • Windows: %APPDATA%/ghi/config/

The output includes:

  • Repository metadata and analysis timestamp
  • Directory statistics and metrics
  • Visual directory tree structure
  • Smart file content analysis
  • Code pattern insights
  • Dependency information

Editor Integration

By default, results are saved to a file but not opened. Use the --open flag to open results in your configured editor.

When opening results for the first time, you'll be prompted to specify your preferred editor command (e.g., 'code', 'vim', 'nano').

Settings can be modified in your system's config directory.

Features

  • Deep repository analysis for GitHub or local directories
  • Smart content filtering with glob patterns
  • Branch/commit specific analysis
  • File size limits and safety checks
  • Intelligent tree structure visualization
  • Automatic text/binary detection
  • Optional editor integration
  • Pipe support for automation and CI/CD

Development

# Clone the repo
git clone https://github.com/owner/ghi.git

# Install dependencies
pnpm install

# Run directly
pnpm node index.ts [options] <repo-or-path>

# Build and link
pnpm build
pnpm link

License

MIT

Keywords

github

FAQs

Package last updated on 03 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts