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 🙏

© 2025 – Pkg Stats / Ryan Hefner

git-collector

v0.4.1

Published

Interactively browse a GitHub repository, select files or directories, and collect their contents into a Markdown data file

Downloads

26

Readme

Git Collector

Git Collector is a command-line tool that lets you interactively browse a GitHub repository, select files or directories, and collect their contents into a Markdown data file. It's useful for gathering code snippets, configuration files, or other resources from a repository for offline use or documentation, especially for sharing with an AI assistant.

Git Collector Screenshot

Features

  • Navigate a repository tree fetched from GitHub
  • Preview file contents in the terminal
  • Select or deselect individual files or entire directories
  • Save selected contents to a structured Markdown file
  • Update an existing data file with the latest repository contents

Prerequisites

  • Node.js (>= 14)
  • One of the following package managers:
    • pnpm (Recommended)
    • npm
    • Yarn

Installation

From npm registry

Install the published package globally with pnpm:

pnpm add -g git-collector
# or with npm:
npm install --global git-collector
# or with Yarn:
yarn global add git-collector

After installation, you can invoke:

git-collector <dest.md>

From source

First, clone this repository and install dependencies:

git clone <repo-url>
cd git-collector
# Install dependencies (choose one)
pnpm install
# or
npm install
# or
yarn install

Install Globally (optional)

To make the git-collector command available system-wide:

pnpm

pnpm link --global

npm

npm link

Yarn

yarn link

Once linked, you can run the command globally:

git-collector <dest.md>

Usage

git-collector [--update] [--force] <destination>
  • <destination>: Path to the Markdown data file to create or update. In update mode, this may instead be a directory containing Git Collector data files.
  • --update: Update files and then exit (no interactive UX), if the destination exists:
    • When it's a data file, refresh that single file with the latest selections.
    • When it's a directory, scan that directory (no subdirectories) for files marked as Git Collector data files (identified by a first line of # Git Collector Data) and update each in turn.
  • --force, -f: When used with --update, always rewrite the data file(s), updating timestamps even if there are no content changes.

Create a New Data File

git-collector data.md
  • You'll be prompted to enter a GitHub repository URL (e.g., https://github.com/user/repo).
  • Use the following keys to interact:
    • <↑>/<↓>: Navigate the file tree
    • <←>/<→>: Expand or collapse directories
    • <PgUp>/<PgDn>: Page-scroll
    • <space>: Select or deselect a file or directory
    • <enter>: Preview the selected file
    • <tab>: Switch focus between tree and preview
    • <s>: Save selections to the data file
    • <x>: Save and exit
    • <q>: Quit without saving
    • <w>: Toggle word-wrap in preview (when focused on preview)

Update an Existing Data File

git-collector --update data.md
  • Reloads the URL and file list from data.md and fetches current contents, reporting how many files were updated or removed, without invoking the interactive UI.
  • This is useful for integrating with other tools or scripts, or just as a quick way to refresh the data file.
  • The --force option can be used to rewrite the data file even if there are no content changes.

Update a Directory of Data Files

git-collector --update data/
  • Scans the specified directory for files marked as Git Collector data files (identified by a first line of # Git Collector Data) and updates each in turn.
  • This is useful for batch processing multiple data files at once.
  • The --force option can be used to rewrite the data files even if there are no content changes.

Run Without Global Install

You can run the CLI directly or via your package manager without linking globally:

# Directly with Node.js
node bin/cli.js data.md

# pnpm
pnpm exec git-collector data.md

# npm
npm start -- data.md

# Yarn
yarn start -- data.md

Development & Testing

  • Run tests:
    pnpm test
    # or
    npm test
    # or
    yarn test