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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@computesdk/cmd

v0.3.1

Published

Type-safe shell command builders for ComputeSDK sandboxes

Readme

@computesdk/cmd

Type-safe shell command builders for use with ComputeSDK sandboxes.

Installation

npm install @computesdk/cmd

Usage

Basic Commands

import { cmd, npm, node, git } from '@computesdk/cmd';

// Build command tuples
npm.install('express')        // ['npm', 'install', 'express']
node('server.js')             // ['node', 'server.js']
git.clone('https://...')      // ['git', 'clone', 'https://...']

// Use with sandbox.runCommand()
await sandbox.runCommand(npm.install('express'));
await sandbox.runCommand(node('server.js'));

Shell Wrapping with cmd()

Use cmd() to wrap commands with cwd or background options:

import { cmd, npm, node } from '@computesdk/cmd';

// Run in a specific directory
cmd(npm.install(), { cwd: '/app' })
// => ['sh', '-c', 'cd "/app" && npm install']

// Run in background
cmd(node('server.js'), { background: true })
// => ['sh', '-c', 'nohup node server.js > /dev/null 2>&1 &']

// Both options
cmd(npm.run('dev'), { cwd: '/app', background: true })
// => ['sh', '-c', 'nohup cd "/app" && npm run dev > /dev/null 2>&1 &']

Shell-Specific Wrappers

Use sh, bash, or zsh for explicit shell selection:

import { bash, zsh, npm } from '@computesdk/cmd';

bash(npm.install(), { cwd: '/app' })
// => ['bash', '-c', 'cd "/app" && npm install']

zsh(npm.run('dev'), { background: true })
// => ['zsh', '-c', 'nohup npm run dev > /dev/null 2>&1 &']

Available Commands

File System

  • mkdir(path, options?) - Create directory (recursive by default)
  • rm(path, options?) - Remove file/directory
  • cp(src, dest, options?) - Copy
  • mv(src, dest) - Move/rename
  • ls(path?, options?) - List directory
  • pwd() - Print working directory
  • chmod(mode, path, options?) - Change permissions
  • chown(owner, path, options?) - Change owner
  • touch(path) - Create file/update timestamp
  • cat(path) - Read file
  • ln(target, link, options?) - Create link
  • readlink(path, options?) - Resolve symlink
  • rsync(src, dest, options?) - Sync files/directories

Filesystem Tests

  • test.exists(path) - File/dir exists
  • test.isFile(path) - Is a file
  • test.isDir(path) - Is a directory
  • test.isReadable(path) - Is readable
  • test.isWritable(path) - Is writable
  • test.isExecutable(path) - Is executable
  • test.notEmpty(path) - File is not empty
  • test.isSymlink(path) - Is a symlink

Process/Execution

  • node(script, args?) - Run Node.js script
  • python(script, args?) - Run Python script
  • kill(pid, signal?) - Kill process by PID
  • pkill(name, options?) - Kill by name
  • ps(options?) - List processes
  • timeout(seconds, command, args?) - Run with timeout

Package Managers (JavaScript)

  • npm.install(pkg?, options?), npm.run(script), npm.init(), npm.uninstall(pkg)
  • pnpm.install(pkg?, options?), pnpm.run(script)
  • yarn.install(), yarn.add(pkg, options?), yarn.run(script)
  • bun.install(pkg?, options?), bun.run(script), bun.exec(file)
  • deno.run(file, options?), deno.install(url, options?)

Package Managers (Python)

  • pip.install(pkg), pip.uninstall(pkg)
  • uv.install(pkg), uv.run(script), uv.sync(), uv.venv(path?)
  • poetry.install(options?), poetry.add(pkg, options?), poetry.run(cmd), poetry.build()
  • pipx.install(pkg), pipx.run(pkg, args?), pipx.uninstall(pkg), pipx.upgrade(pkg)

Package Runners

  • npx(pkg, args?) - Run with npx
  • npx.concurrently(commands, options?) - Run commands in parallel
  • bunx(pkg, args?) - Run with bunx
  • bunx.concurrently(commands, options?)

Git

  • git.init() - Initialize repository
  • git.clone(url, options?) - Clone repository
  • git.add(path, options?) - Stage files
  • git.commit(message, options?) - Commit changes
  • git.push(options?) - Push to remote
  • git.pull() - Pull changes
  • git.fetch(options?) - Fetch from remote
  • git.checkout(branch, options?) - Checkout branch
  • git.branch(name?, options?) - List/create branches
  • git.status() - Show status
  • git.diff(options?) - Show changes
  • git.log(options?) - Show commit history
  • git.stash(options?) - Stash changes
  • git.reset(options?) - Reset changes

Network

  • curl(url, options?) - Download with curl
  • wget(url, options?) - Download with wget
  • net.ping(host, count?) - Ping host
  • net.check(host, port) - Check connectivity
  • net.publicIp() - Get public IP
  • net.interfaces() - Show network interfaces

Ports

  • port.find(port) - Find process using port
  • port.kill(port) - Kill process on port
  • port.isUsed(port) - Check if port is in use
  • port.list() - List listening ports
  • port.waitFor(port, timeout?) - Wait for port

Archives

  • tar.extract(file, options?) - Extract tar archive
  • tar.create(output, source) - Create tar archive
  • unzip(file, options?) - Extract zip archive

Text Processing

  • grep(pattern, file?, options?) - Search for pattern
  • sed(expression, file, options?) - Stream editor
  • awk(program, file?, options?) - Pattern scanning
  • head(file, lines?) - First lines of file
  • tail(file, lines?, options?) - Last lines of file
  • wc(file, options?) - Word/line count
  • sort(file, options?) - Sort lines
  • uniq(file, options?) - Filter duplicates
  • jq(filter, file?, options?) - Process JSON
  • cut(file, options) - Extract columns
  • tr(set1, set2?, options?) - Translate characters
  • xargs(command, args?, options?) - Build commands from stdin

System

  • df(path?, options?) - Disk space
  • du(path, options?) - Directory size
  • whoami() - Current user
  • uname(options?) - System info
  • hostname() - Hostname
  • env() - Environment variables
  • printenv(name?) - Print env variable
  • which(command) - Find command location

Encoding/Checksums

  • base64.encode(file?) - Encode to base64
  • base64.decode(file?) - Decode from base64
  • md5sum(file, options?) - MD5 checksum
  • sha256sum(file, options?) - SHA256 checksum
  • sha1sum(file, options?) - SHA1 checksum

Utilities

  • sleep(seconds) - Delay execution
  • date(format?) - Print date/time
  • find(path, options?) - Find files
  • tee(file, options?) - Write to file and stdout
  • diff(file1, file2, options?) - Compare files
  • echo(text) - Print text
  • parallel(commands, options?) - Run commands in parallel
  • raw(command, args?) - Custom command

Utilities

esc(string)

Escape double quotes in strings for shell safety:

import { esc } from '@computesdk/cmd';

esc('path with "quotes"')  // 'path with \\"quotes\\"'

License

MIT