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.13.2

Published

One TypeScript API for commands across local shells, SSH hosts, Docker containers, and Kubernetes pods

Readme

@xec-sh/core

A TypeScript execution engine for local processes, SSH hosts, Docker containers, and Kubernetes pods.

npm install @xec-sh/core

Execute

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

try {
  const ref = 'main';
  const revision = await $`git rev-parse ${ref}`.text();
  const result = await $.exec(process.execPath, {
    args: ['--version'],
    shell: false,
  });
  console.log(revision, result.stdout);
} finally {
  await $.dispose();
}

Interpolated values are quoted for the target shell. Use .exec(executable, { args, shell: false }) for explicit argument boundaries, and $.raw only for intentional shell syntax.

Select a target

const host = $.ssh({ host: 'staging.example.com', username: 'deploy' });
const container = $.docker('app');
const pod = $.k8s('staging/api');

await host`uptime`;
await container.cd('/app')`node --version`;
await pod.env({ LOG_LEVEL: 'debug' })`node healthcheck.js`;

Target contexts provide transfers, SFTP, tunnels, shell sessions, container operations, and pod operations where applicable. SSH host verification and connection management remain inside Xec.

Results and lifetime

  • await command returns an ExecutionResult; nonzero exits throw unless .nothrow() is selected.
  • Results expose stdout, stderr, stdall, exitCode, signal, ok, and cause. A confirmed local cancellation also carries aborted.
  • .text(), .json<T>(), and .lines() return parsed output. Use (await command).buffer() for exact captured bytes.
  • for await (const line of command) streams output with backpressure. Breaking the loop waits for owned process cleanup.
  • .timeout(...), .signal(...), and within({ signal }, callback) bound execution. parallel bounds concurrent work; withoutCancellation provides an explicit cleanup scope.
  • Output limits fail visibly. Diagnostic masking applies to command echoes, events, and errors; exact API payload capture is available through redactOutput: false.

Cancellation of a remote request does not by itself prove that a remote effect was reversed. Preserve and inspect an unknown outcome before retrying an operation with side effects.

Requirements

Node.js 20.19.0 or later; Core also has Bun and Deno runtime checks. Shell syntax depends on the target OS. Docker and Kubernetes use the installed docker and kubectl CLIs. The developing 0.13.0 Core uses @xec-sh/ssh; the private protocol loads only when an SSH connection is requested.

API reference · Examples · MIT license