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

cchistory

v0.2.1

Published

Get shell commands from Claude Code conversation history. Because Claude's commands don't appear in your shell history.

Downloads

142

Readme

cchistory

npm version

Like the shell history command but for your Claude Code sessions.

Why cchistory?

When Claude Code runs shell commands, they don't appear in your shell history. This makes it hard to:

  • Re-run useful commands from past sessions
  • Build on previous work
  • Learn from command patterns Claude uses
  • Copy command sequences for documentation
$ cchistory | tail -5
  46  git status
  47  git pull origin main
  48  git log --oneline -5
  49  docker-compose up -d
  50  curl -I localhost:8080/health

📦 Installation

npm (recommended)

npm install -g cchistory

npx (try without installing)

npx cchistory --help

From source

git clone https://github.com/eckardt/cchistory
cd cchistory
npm install
npm run build
npm link

Usage

cchistory                    # Current project history
cchistory --global           # All projects
cchistory --list-projects    # See all available projects
cchistory | grep docker      # Find Docker commands  
cchistory | tail -5          # Last 5 commands
cchistory my-app | tail -10  # Last 10 from specific project
cchistory ~/code/my-app      # Project by full path

✨ Features

  • 🔍 Extract all Bash commands Claude executed across projects
  • 🗂️ Filter by specific project or search globally
  • 📊 Standard Unix tool compatibility (grep, awk, sort)
  • ⚡ Fast streaming parser for large conversation logs
  • 🚀 Zero-config - works with existing Claude Code setup

How It Works

Claude Code stores conversation history in ~/.claude/projects/. This tool:

  1. Finds your Claude projects
  2. Streams through conversation logs
  3. Extracts shell commands Claude executed
  4. Formats them like traditional shell history

📋 Example Output

$ cchistory --global | head -10
   1  [web-scraper    ] npm install puppeteer
   2  [web-scraper    ] mkdir src tests
   3  [api-project    ] docker-compose up -d
   4  [api-project    ] curl -X POST localhost:3000/api/test
   5  [frontend       ] npm run dev
   6  [frontend       ] git add .
   7  [backend        ] npm test
   8  [backend        ] git commit -m "fix: validation"
   9  [deployment     ] kubectl apply -f deployment.yaml
  10  [deployment     ] kubectl get pods

Advanced Usage

# Find all npm commands across projects
cchistory --global | grep npm

# Get last 20 Docker commands
cchistory --global | grep docker | tail -20

# Count commands by type
cchistory --global | sed 's/.*] //' | awk '{print $1}' | sort | uniq -c | sort -nr | head -10

Command Sources

Extracts commands from:

  • Bash tool usage: Commands Claude executes via the Bash tool
  • User "!" commands: Commands you run with ! command in Claude

Requirements

  • Node.js 20+
  • Claude Code with conversation history in ~/.claude/projects/

Note: Claude Code automatically cleans up conversation transcripts based on the cleanupPeriodDays setting (default: 30 days). Commands older than this period won't appear in cchistory output. You can adjust this retention period in Claude Code's settings if needed.

Options

cchistory [project-name]    # Show history for specific project (by name or path)
cchistory --global          # Show history from all projects  
cchistory --list-projects   # List all available Claude projects
cchistory --help            # Show usage info

Output Format

Each line shows:

[sequence] [project-name] command
  • sequence: Command number (oldest first)
  • project-name: Which Claude project ran the command
  • command: The actual shell command

Multi-line commands use zsh history format with \\n for newlines.

Unix Philosophy

cchistory does one thing well: extract shell commands. Use it with standard Unix tools:

  • grep for filtering
  • head/tail for limiting output
  • awk for field processing
  • sort/uniq for analysis
  • Pipe to files for documentation