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

@xec-sh/core

v0.9.0

Published

Universal shell execution engine

Readme

@xec-sh/core

Universal shell execution engine with adapters for local, SSH, Docker, and Kubernetes environments.

Install

pnpm add @xec-sh/core

Quick Start

import { $ } from '@xec-sh/core';

// Local execution with template literals
await $`echo "Hello, World!"`;

// Variables are automatically escaped
const file = 'my file.txt';
await $`cat ${file}`;

// SSH execution with connection pooling
const ssh = $.ssh({ host: 'server.com', username: 'deploy' });
await ssh`uptime`;

// Docker container execution
await $.docker('my-container')`ps aux`;

// Kubernetes pod execution
const k8s = $.k8s({ namespace: 'production' });
await k8s.pod('app-pod')`hostname`;
// ProcessPromise methods
const result = await $`grep pattern file.txt`
  .nothrow()   // don't throw on non-zero exit
  .quiet()     // suppress output
  .timeout(5000);

// Consume output
const text = await $`cat file.txt`.text();
const data = await $`cat data.json`.json();
const lines = await $`ls`.lines();
const buf = await $`cat image.png`.buffer();

// Pipe commands
await $`cat access.log`.pipe($`grep 404`).pipe($`wc -l`);
import { parallel, within, withTempFile } from '@xec-sh/core';

// Parallel execution with concurrency limit
const results = await parallel([
  $`test-1.sh`, $`test-2.sh`, $`test-3.sh`
], { maxConcurrent: 2 });

// Scoped execution context
await within(async () => {
  $.defaults({ cwd: '/tmp', env: { NODE_ENV: 'test' } });
  await $`npm test`;
});

// Helpers
import { echo, sleep, glob, kill, parseDuration, expBackoff } from '@xec-sh/core';

await sleep(1000);
echo('output');
const files = await glob('**/*.ts');
const ms = parseDuration('5m');

API

| Export | Description | |--------|-------------| | $ | Default callable execution engine (template literal tag) | | configure | Configure the global engine | | dispose | Clean up the global engine | | ExecutionEngine | Core engine class | | createCallableEngine | Wrap an engine as a callable | | LocalAdapter | Local process adapter | | SSHAdapter | SSH adapter with connection pooling | | DockerAdapter | Docker container adapter | | KubernetesAdapter | Kubernetes pod adapter | | DockerFluentAPI | Fluent API for Docker lifecycle | | DockerContainer | Docker container management | | parallel / ParallelEngine | Parallel execution utilities | | within / withinSync | Scoped execution context | | withTempDir / withTempFile | Temporary file helpers | | echo / sleep / glob / kill | Shell-like helpers | | parseDuration / expBackoff | Duration and backoff utilities | | retry / RetryError | Retry with backoff | | RuntimeDetector | Detect Node.js, Bun, or Deno | | SSHKeyValidator | Validate SSH keys | | SecurePasswordHandler | Secure password handling | | EnhancedEventEmitter | Typed event emitter | | pipeUtils | Pipe composition utilities |

Features

  • Template literal syntax $\cmd`` with automatic shell escaping
  • Adapters: local, SSH, Docker, Kubernetes, mock, remote Docker
  • SSH connection pooling and keep-alive
  • ProcessPromise with .text(), .json(), .lines(), .buffer(), .nothrow(), .quiet(), .timeout(), .signal(), .kill(), .pipe()
  • Pipe chaining between commands and adapters
  • Parallel execution with concurrency control
  • Automatic retry with exponential backoff
  • Streaming output and async iteration
  • within/withinSync for scoped configuration
  • Temp file and directory helpers
  • Shell helpers: echo, sleep, glob, kill, parseDuration, expBackoff
  • $.prefix / $.postfix / $.preferLocal configuration
  • $.defaults() for global configuration
  • Chainable methods: .cd(), .env(), .timeout(), .shell(), .retry()
  • Zero external runtime dependencies
  • Works on Node.js, Bun, and Deno

License

MIT