ShellJS

Portable Unix shell commands for Node.js. Provides cp, mv, rm, mkdir, find, grep, sed, echo, exec, and more as JavaScript functions that work cross-platform (Unix, macOS, Windows). Enables shell scripting in pure JavaScript without spawning bash/cmd.exe subprocesses. Used for build scripts, deployment automation, and file manipulation that needs to run consistently across operating systems.

Evaluated Mar 06, 2026 (0d ago) v0.8.x
Homepage ↗ Repo ↗ Developer Tools shell node scripting unix cross-platform bash utilities cli
⚙ Agent Friendliness
67
/ 100
Can an agent use this?
🔒 Security
95
/ 100
Is it safe for agents?
⚡ Reliability
86
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
85
Error Messages
78
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
85
Secret Handling
85

Shell execution library — shell injection risk if user input is passed to exec() without sanitization. Local execution only. File operations subject to OS permissions.

⚡ Reliability

Uptime/SLA
88
Version Stability
88
Breaking Changes
90
Error Recovery
80
AF Security Reliability

Best When

You're writing Node.js build scripts or automation tools that need Unix shell commands to work cross-platform (including Windows) without bash dependencies.

Avoid When

You need async command execution with streams, or are building server-side code — use execa or Node's built-in child_process instead.

Use Cases

  • Write cross-platform build scripts in Node.js using shell-like commands without bash/cmd.exe dependencies
  • Recursively copy, move, and delete files in Node.js automation scripts that run on both Unix and Windows
  • Execute shell commands synchronously in Node.js build tools with shell.exec() for simple command orchestration
  • Find and grep files in build scripts using shell.find() and shell.grep() for cross-platform file operations
  • Create deployment automation scripts that manipulate files, set environment variables, and run commands portably

Not For

  • Async/streaming command execution — use execa for async shell commands with better stream handling
  • Complex shell pipelines — shelljs synchronous model doesn't handle complex async pipelines well
  • Production servers — shelljs is for scripting/tooling, not runtime server code

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — local shell scripting library.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Fully free, BSD licensed.

Agent Metadata

Pagination
none
Idempotent
Partial
Retry Guidance
Not documented

Known Gotchas

  • ShellJS is in maintenance mode — actively maintained but no new features; consider Google's zx for modern shell scripting or execa for async commands
  • Commands don't throw by default on failure — must check return code or set shell.config.fatal = true; silent error handling is the most common ShellJS bug
  • shell.exec() is synchronous by default — blocks the Node.js event loop during command execution; use shell.exec('cmd', {async: true}, callback) for async
  • glob patterns in rm/cp/mv use shell glob expansion — behavior may differ subtly from Node.js glob; test cross-platform edge cases
  • shell.which() returns null if command not found (not false) — null check required; commonly used for prerequisite checks
  • Working directory changes with shell.cd() affect all subsequent commands in the script — reset with shell.cd(originalDir) or track working directory explicitly

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for ShellJS.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered