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

shell2node

v0.10.2

Published

Record a shell pipeline and generate a reusable Node.js script that reproduces the pipeline with streaming child processes. Turn throwaway terminal magic into shareable, maintainable scripts.

Downloads

4

Readme

Installation

npm install -g shell2node

Features

  • 🎥 Interactive Capture Mode - Records commands from your existing bash/zsh shell sessions
  • 🔄 Streaming Reproduction - Generated scripts maintain original command streaming behavior
  • Shell Semantic Preservation - Uses sh -c to preserve shell features like pipes, redirections, and expansions
  • 📁 Automatic Organization - Saves generated scripts with timestamps and metadata
  • 🛡️ Safe Execution - Includes proper error handling and exit code propagation

Quick Start

  1. Start capture mode:
shell2node capture
  1. Run your commands as normal:
# These will be recorded
find . -name "*.ts" -type f
cat file.txt | grep "pattern" | wc -l
curl -s https://api.example.com/data | jq '.items[]'
  1. Save and generate script:
shell2node save
  1. Run generated script:
node generated/2024-01-15T10-30-00Z-replay.js

Example

Captured commands:

$ find src -name "*.ts" | xargs wc -l
$ cat data.json | jq '.metrics[]' | sort -n

Generated Node.js script:

// Generated by shell2node (MLP)
// Captured commands: 2
// Generated at: 2024-01-15T10:30:00.000Z

import { spawnSync } from 'child_process';

function run(cmd) {
  console.log('> ' + cmd);
  const r = spawnSync('sh', ['-c', cmd], { stdio: 'inherit' });
  if (r.error) {
    console.error('Failed to run command:', r.error);
    process.exit(r.status || 1);
  }
  if (r.status && r.status !== 0) {
    console.error('Command exited with code', r.status);
    process.exit(r.status);
  }
}

(async () => {
  run(`find src -name "*.ts" | xargs wc -l`);
  run(`cat data.json | jq '.metrics[]' | sort -n`);
})();

Who Is This For?

  • DevOps Engineers - Convert deployment scripts into maintainable Node.js code
  • Data Scientists - Reproduce complex data processing pipelines
  • System Administrators - Document and version control administrative tasks
  • Developers - Share complex build processes with team members
  • Technical Writers - Create reproducible examples for documentation

Supported Shells

  • ✅ Bash (primary support)
  • ✅ Zsh (full support)
  • ⚠️ Other shells (basic support, may not capture all commands)

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT — see LICENSE for details.


Support

For support and questions, please open an issue on GitHub or contact [email protected]