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

snipshare-cli

v0.0.4

Published

代码片段管理工具 - 个人自用 + 团队共享

Readme

snippet - Code Snippet Management Tool

A CLI tool for saving, managing, and sharing code snippets.

🚀 Features

  • ✅ Local code snippet saving (auto-scanning directories, extracting dependencies)

  • ✅ Interactive command-line interface

  • ✅ Snippet search (by title, description, tags, framework, database)

  • ✅ Snippet metadata management (title, description, tags)

  • ✅ Project isolation (each project's snippets are saved independently)

  • ✅ Automatic Token generation (automatically generated on first use, no manual configuration needed)

  • ✅ Upload/Share snippets to server

  • ✅ List snippets on server

  • ✅ Delete snippets from server

  • ✅ Download snippets from server

  • ✅ Install snippets to current project

  • Contact me: [email protected]

  • Github: https://github.com/Wonkmy/snipshare-cli.git

📦 Installation

npm install -g snipshare-cli

🛠️ Usage

First Use

After installation, run any command to automatically generate a Token:

snippet hello

Help

snippet --help

Version

snippet -v

Configuration

View Current Configuration

snippet config get

Set Configuration

snippet config set <key> <value>

Supported configuration items:

  • server - Server address (default: none - you need to deploy your own server)
  • token - Authentication Token (automatically generated on first use, no manual configuration needed)

Note: Token is automatically generated in ~/.snippet/config.json with format user_ + random string. A new Token is generated each time the tool is reinstalled.

Server Deployment Required: Remote features (publish, download, etc.) require a server. To use these features:

  1. Deploy your own server (see Server Deployment)
  2. Configure the client:
snippet config set server http://your-server:3000

Reset Configuration: To reset all configuration to default values:

snippet config reset

Save Code Snippet

snippet save <directory>

Examples:

# Save snippets from current directory
snippet save .

# Save snippets from specific directory
snippet save ./my-project

After running, you will be prompted to enter:

  1. Snippet name (default is directory name)
  2. Description
  3. Framework (Express/NestJS/Koa/Fastify/Other)
  4. Database (MongoDB/MySQL/PostgreSQL/SQLite/No Database)
  5. Tags (comma-separated)

Saved content:

  • All source code files (auto-scanned, node_modules folder is automatically ignored)
  • Dependencies from package.json
  • Snippet metadata (title, description, framework, database, tags)

Save location: current directory/snippets/

List All Snippets

snippet list

Displays basic information for all snippets:

  • ID
  • Name
  • Description
  • Framework and Database
  • Tags
  • Creation Time
  • File Count

View Snippet Details

snippet view <id>

Example:

snippet view mn76p6qcdckni

Displays detailed information including all files.

Update Snippet Metadata

snippet update <id>

Example:

snippet update mn76p6qcdckni

After running, you will be prompted to enter:

  1. New title (default is current title)
  2. New description (default is current description)
  3. New tags (default is current tags)

Delete Snippet

snippet delete <id>

Example:

snippet delete mn76p6qcdckni

Search Snippets

snippet search <keyword>

Examples:

# Search for snippets containing "express"
snippet search express

# Search for snippets containing "mongodb"
snippet search mongodb

# Search for snippets containing "authentication"
snippet search authentication

Search scope:

  • Title
  • Description
  • Tags
  • Framework
  • Database

Case-insensitive matching.

Upload Snippet to Server

snippet publish

After running, it will:

  1. List all local snippets
  2. Select snippet to upload
  3. Display snippet details (name, description, framework, database, tags, file count, dependency count)
  4. Confirm upload

Upload requirements:

  • Official address: https://snipshare.dxstudio.site
  • Server address must be configured first: snippet config set server <server address>
  • Token is automatically included in request headers (format: Authorization: Bearer <token>)

List Server Snippets

snippet list-remote

Displays basic information for all server snippets:

  • ID
  • Name
  • Description
  • Framework and Database
  • Tags
  • Creation Time
  • File Count

Delete Server Snippet

snippet delete-remote <id>

Example:

snippet delete-remote mn76p6qcdckni

Download Snippet from Server

snippet download

After running, it will:

  1. List all server snippets
  2. Select snippet to download
  3. Prompt for save directory

List Downloaded Snippets

snippet list-downloaded

Install Snippet to Current Project

snippet install <id>

After running, it will:

  1. Prompt for installation directory (default is current project)

Uninstall Snippet

snippet uninstall <id>

Example:

snippet uninstall mn76p6qcdckni

📝 Notes

  • Snippets are saved in the snippets/ folder in the current working directory
  • node_modules folder is automatically ignored
  • Snippet ID is an automatically generated unique identifier
  • updatedAt timestamp is automatically updated when snippet metadata is modified
  • Token is stored in ~/.snippet/config.json with format user_ + random string
  • Reinstalling the tool generates a new Token (because ~/.snippet directory is deleted)

🖥️ Server Deployment

Deploy Official Server

The official server is hosted at https://snipshare.dxstudio.site. Remote features (publish, download, etc.) require a server.

To deploy your own server:

  1. Clone or copy the snippet-server folder to your server
  2. Install dependencies:
cd snippet-server
npm install
  1. Create .env file:
cp .env.example .env
  1. Edit .env:
PORT=3000
DATA_DIR=./data
  1. Start the server:
npm start

Your server will be available at http://your-server:3000.

Configure Client

After deploying your server, configure the client:

snippet config set server http://your-server:3000

✅ Completed Features

Phase 1: Local Management

  • ✅ save command (save code snippet)
  • ✅ list command (list all snippets)
  • ✅ view command (view snippet details)
  • ✅ update command (update snippet metadata)
  • ✅ delete command (delete snippet)
  • ✅ search command (search snippets)

Phase 2: Remote Management

  • ✅ publish command (upload snippet to server)
  • ✅ list-remote command (list server snippets)
  • ✅ delete-remote command (delete server snippet)
  • ✅ Automatic token generation

Phase 3: Download/Install

  • ✅ download command (download snippet from server)
  • ✅ install command (install snippet to current project)
  • ✅ list-downloaded command (list downloaded snippets)
  • ✅ uninstall command (uninstall snippet)

📄 License

MIT