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

cli-snip-tool

v1.0.1

Published

A fast CLI snippet manager to save, search, and copy code snippets directly from the terminal.

Readme

snip — A personal code snippet manager for your terminal

Save, search, and copy your most-used code snippets without leaving the terminal.

npm version license built with TypeScript


The problem

Every developer re-searches the same commands over and over.

  • "What was that docker exec command again?"
  • "How do I force-push safely in git?"
  • "What's the curl flag for sending JSON headers?"

You either Google it for the 10th time, dig through your shell history, or scroll through old Notion notes.

snip fixes that. It gives you a personal, searchable library of code snippets that lives in your terminal — no browser, no internet, no account needed.

snip find "docker exec" --copy
# ✔ Copied "Docker exec into container" to clipboard

Features

  • Full-text search — searches title, code, and description all at once
  • Tag system — organize snippets by topic like docker, git, sql
  • Language filter — filter by bash, javascript, python, and more
  • Opens your editor — paste code in vim, nano, or vscode — whatever you use
  • Clipboard copy — one command to copy any snippet
  • Usage tracking — see which snippets you actually use most
  • Export and import — back up and restore your library as JSON or Markdown
  • Works offline — everything stored locally in a single SQLite file
  • Zero config — just install and start saving

Installation

Requirements

  • Node.js 18 or higher
  • npm

Install globally

npm install -g cli-snip-tool

After that, the snip command is available everywhere in your terminal.

Verify it works

snip --help

You should see a list of all available commands.


Quick start — your first snippet

Step 1 — Save a snippet

snip add

The terminal will ask you a few questions:

? Snippet title: Docker exec into container
? Language: bash
? Description (optional): Exec into a running Docker container interactively
? Select existing tags: (none yet)
? Add new tags: docker, devops

Opening your editor — save and close when done…

Your editor opens. Paste your code:

docker exec -it $1 /bin/bash

Save and close the editor. Done — your snippet is saved.

Step 2 — Find and copy it

snip find "docker exec" --copy
# ✔ Copied "Docker exec into container" to clipboard

Now paste it anywhere with Ctrl+V.


All commands

snip add — Save a new snippet

Opens an interactive prompt that asks for the title, language, tags, and code.

snip add

You can also skip the prompts with flags:

snip add --title "Docker exec" --language bash --tags docker,devops

Or pipe code directly from a file (no editor opens):

cat deploy.sh | snip add --stdin --title "Deploy script" --language bash

Available flags:

| Flag | What it does | |---|---| | --title <text> | Set the title directly | | --language <lang> | Set the language directly | | --tags <list> | Comma-separated tags | | --stdin | Read code from piped input instead of editor |


snip find — Search your snippets

The most useful command. Searches everything — title, code, and description.

snip find "docker exec"

This shows a list of matching snippets, then a picker where you can choose to copy, preview, or edit one.

Copy the top result immediately (no picker):

snip find "docker exec" --copy

Filter by tag:

snip find --tag docker

Filter by language:

snip find --language bash

Combine search and filter:

snip find "exec" --tag docker --language bash

Pipe directly to run:

snip find "deploy script" --copy | bash

Available flags:

| Flag | What it does | |---|---| | --copy | Copies top result to clipboard, no picker | | --tag <name> | Filter results by tag | | --language <lang> | Filter results by language | | --limit <n> | How many results to show (default: 10) |


snip list — See all your snippets

Shows every snippet in a table format.

snip list

Example output:

#1  Docker exec into container    bash    [docker, devops]    copied 12×
#2  JWT decode in Node.js          js      [auth, jwt]         copied 8×
#3  Nginx restart command          bash    [nginx, devops]     copied 5×

Filter by tag:

snip list --tag devops

snip copy — Copy a snippet by its id

If you already know the id number, this is the fastest way to copy.

snip copy 3
# ✔ Copied "Nginx restart command" to clipboard

You can find id numbers by running snip list.

Run the snippet directly:

snip copy 3 | bash

snip edit — Edit an existing snippet

Opens a menu to choose which field to edit — code, title, tags, or description.

snip edit 3

The terminal asks:

? What do you want to edit?
  ◉ Code (opens editor)
  ○ Title
  ○ Tags
  ○ Description

For code — your editor opens with the current code pre-filled. Edit it, save, and close.

Edit only the title (skips the menu):

snip edit 3 --title

Edit only the tags:

snip edit 3 --tags

Available flags:

| Flag | What it does | |---|---| | --title | Edit title only | | --tags | Edit tags only | | --description | Edit description only |


snip delete — Delete a snippet

Permanently removes a snippet. Asks for confirmation first.

snip delete 3
Delete "Nginx restart command"? (Y/n): Y
# ✔ Snippet #3 deleted.

There is no undo. Run snip export first if you are unsure.


snip top — See your most-used snippets

Shows the top 10 snippets ranked by how many times you have copied them.

snip top

Example output:

#1  Docker exec into container    bash    copied 24×
#7  Git force push safely         bash    copied 18×
#2  JWT decode in Node.js          js      copied 11×

Useful for knowing what to put in your shell aliases.


snip export — Back up your snippets

Exports all snippets to a file. Use this to back up your library or move to a new machine.

Export as JSON (for importing back later):

snip export --format json
# ✔ Exported 42 snippets → snippets-2026-06-24.json

Export as Markdown (human-readable, good for sharing):

snip export --format md
# ✔ Exported 42 snippets → snippets-2026-06-24.md

snip import — Restore snippets from a file

Reads a JSON export file and adds snippets to your database. Skips duplicates automatically, so it is safe to run more than once.

snip import snippets-2026-06-24.json
# ✔ Imported 42 snippets.

Moving to a new machine:

# On your old machine
snip export --format json

# Copy the file to the new machine, then
snip import snippets-2026-06-24.json

Real-world examples

Save a git shortcut you always forget

snip add --title "Git undo last commit (keep changes)" --language bash --tags git
# Editor opens → type: git reset --soft HEAD~1
# Save and close

Save a curl command with JSON headers

snip add --title "curl POST with JSON" --language bash --tags curl,api
# Editor opens → type:
# curl -X POST https://api.example.com/endpoint \
#   -H "Content-Type: application/json" \
#   -H "Authorization: Bearer YOUR_TOKEN" \
#   -d '{"key": "value"}'

Save a multi-line bash script

cat cleanup.sh | snip add --stdin --title "Cleanup node_modules" --language bash --tags node

Find and use it later

snip find "cleanup" --copy
# Paste and run wherever you need it

Save a SQL query you run often

snip add --title "Find duplicate emails in users table" --language sql --tags sql,postgres
# Editor opens → paste your query

How it stores your data

snip stores everything locally on your machine — no cloud, no server, no account.

| What | Where | |---|---| | Database file | ~/.config/snip/snip.db | | Config | ~/.config/snip/config.json |

The database is a standard SQLite file. You can open it with any SQLite browser if you ever want to inspect it directly.

To delete everything and start fresh:

rm -rf ~/.config/snip

Set your preferred editor

snip uses the $EDITOR environment variable to know which editor to open.

Check what is currently set:

echo $EDITOR

Set it in your shell config (~/.bashrc or ~/.zshrc):

# For VS Code
export EDITOR="code --wait"

# For vim
export EDITOR="vim"

# For nano
export EDITOR="nano"

Then reload your shell:

source ~/.zshrc

The --wait flag for VS Code is important. Without it, the editor opens and snip thinks you closed it immediately — your code will not be saved.


Tech stack

Built with:

  • TypeScript — fully typed codebase
  • Node.js — runtime
  • SQLite (better-sqlite3) — local database with full-text search (FTS5)
  • Commander.js — CLI command parsing
  • Inquirer.js — interactive terminal prompts
  • Chalk — terminal colors
  • Clipboardy — cross-platform clipboard access

Contributing

Contributions are welcome. To run the project locally:

# Clone the repo
git clone https://github.com/satyamsinghs408/cli-snippet-manager.git
cd cli-snippet-manager

# Install dependencies
npm install

# Build
npm run build

# Link globally so you can test the snip command
npm link

# Run in dev mode (no build needed, uses tsx)
npm run dev

To run the test suite:

npm test

Please open an issue before submitting a large pull request so we can discuss the approach first.


Licence

MIT — free to use, modify, and distribute.


Author

Built by Satyam Singh

If this saved you time, consider giving the repo a star on GitHub.