← All tools

SocketDev/socket-cli

Popularity 70 Updated Testing & Security

Command-line interface for socket.dev security analysis

githubauto-collected

Installation

A directly usable install command is not verified yet. Check the project documentation or releases.

Socket CLI

CLI for Socket.dev — bring Socket's supply-chain security analysis to your terminal and CI.

Why this repo exists

Socket CLI is the command-line interface to Socket.dev, letting you scan dependencies, audit packages, and gate installs from your terminal or CI. This repository is the source for the published socket package on npm; end-user documentation lives on socket.dev and the socket npm page.

Install

npm install -g socket

Then run:

socket --help

Usage

# Scan a package
socket package npm/express@4.18.0

# Scan your project's dependencies
socket scan create

# Audit an install before it runs (npm, pnpm, or yarn)
socket npm install
socket pnpm install
socket yarn add <package>

socket npm, socket pnpm, and socket yarn each run the underlying package manager through Socket Firewall, which blocks known-malicious packages before they are installed. Install-time protection is no longer npm-only.

See the Socket docs for the full command reference.

Development

<details <summaryContributor commands</summary

git clone https://github.com/SocketDev/socket-cli.git
cd socket-cli
pnpm install
pnpm run build
pnpm test

Requires Node.js (see .node-version) and pnpm (see the packageManager field in package.json).

| Command | Description | | ------------------------ | ----------------------------- | | pnpm run build | Smart build (skips unchanged) | | pnpm run build --force | Force rebuild everything | | pnpm run build:cli | Build CLI package only | | pnpm run build:sea | Build SEA binaries | | pnpm dev | Watch mode (auto-rebuild) | | pnpm test | Run all tests | | pnpm testu | Update test snapshots | | pnpm run check | Lint + typecheck | | pnpm run fix | Auto-fix lint + formatting |

Run the built CLI from source: