Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

h13/socket-cli

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5,069 Commits
5,069 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Socket CLI

Socket Badge CI Coverage

Follow @SocketSecurity

CLI for Socket.dev security analysis. For user documentation, see the socket package on npm.

Getting Started

Prerequisites

  • Node.js 25.5.0+ (see .node-version)
  • pnpm 10.22+ (see packageManager in package.json)

Setup

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

Running the CLI

# Run the built CLI
node packages/cli/dist/index.js --help

# Or use watch mode during development
pnpm dev

Running Tests

# Run all tests
pnpm test

# Run unit tests for a specific file
pnpm --filter @socketsecurity/cli run test:unit src/commands/scan/cmd-scan.test.mts

# Run with pattern matching
pnpm --filter @socketsecurity/cli run test:unit src/commands/scan/cmd-scan.test.mts -t "pattern"

Code Quality

pnpm run check        # Run lint + typecheck
pnpm run fix          # Auto-fix linting and formatting

Project Structure

socket-cli/
├── packages/
│   ├── cli/                    # Main CLI package (@socketsecurity/cli)
│   │   ├── src/
│   │   │   ├── commands/       # Command implementations
│   │   │   ├── utils/          # Shared utilities
│   │   │   └── cli.mts         # Entry point
│   │   └── dist/               # Built output
│   ├── build-infra/            # Build system and tooling
│   └── package-builder/        # Package generation templates
├── scripts/                    # Monorepo scripts
└── test/                       # Shared test utilities

Development Commands

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 issues

Debug Logging

SOCKET_CLI_DEBUG=1 node packages/cli/dist/index.js <command>

Environment Variables

Key variables for development:

Variable Description
SOCKET_CLI_DEBUG Enable debug logging (1)
SOCKET_CLI_API_TOKEN Socket API token
SOCKET_CLI_ORG_SLUG Socket organization slug
SOCKET_CLI_API_BASE_URL Override API endpoint
SOCKET_CLI_NO_API_TOKEN Disable default API token

See Also


Socket Logo

About

The Socket CLI

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 88.9%
  • JavaScript 10.1%
  • Shell 1.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.