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

@context-fs/just-bash

v0.1.4

Published

just-bash IFileSystem adapter for @context-fs/core

Readme

@context-fs/just-bash

Adapter that wraps a @context-fs/core VirtualFileSystem to implement the IFileSystem interface from just-bash. Run bash scripts against virtual filesystems.

Installation

npm install @context-fs/just-bash

Peer Dependencies

npm install @context-fs/core just-bash

Quick Start

import { createFileSystem, read } from "@context-fs/core";
import { ContextFS } from "@context-fs/just-bash";
import { createBash } from "just-bash";

// Create a virtual filesystem
const vfs = createFileSystem({
  "hello.txt": {
    [read]: () => "Hello from the virtual filesystem!",
  },
  data: {
    "config.json": {
      [read]: (c) => c.json({ debug: true, version: "1.0" }),
    },
  },
});

// Wrap it for just-bash
const fs = new ContextFS(vfs);
const bash = createBash({ fs });

// Run bash commands against the virtual filesystem
const result = await bash`cat /hello.txt`;
console.log(result.stdout); // "Hello from the virtual filesystem!"

const config = await bash`cat /data/config.json | jq .version`;
console.log(config.stdout); // "1.0"

API

ContextFS

Adapter class implementing IFileSystem from just-bash.

import { ContextFS } from "@context-fs/just-bash";

const fs = new ContextFS(vfs);

Supported Operations (Read-Only)

| Method | Description | | -------------------------- | ---------------------------------- | | readFile(path, options?) | Read file as string | | readFileBuffer(path) | Read file as Uint8Array | | exists(path) | Check if path exists | | stat(path) | Get file stats (follows symlinks) | | lstat(path) | Get file stats (no symlink follow) | | readdir(path) | List directory contents | | readlink(path) | Read symlink target | | resolvePath(base, path) | Resolve relative paths |

Unsupported Operations

Write operations throw an error since VirtualFileSystem is primarily read-only:

  • writeFile()
  • appendFile()
  • mkdir()
  • rm()
  • cp()
  • mv()
  • chmod()
  • symlink()
  • link()

Use Cases

Testing Shell Scripts

Test bash scripts against mock filesystems:

const mockFs = createFileSystem({
  etc: {
    hosts: {
      [read]: () => "127.0.0.1 localhost\n192.168.1.1 myserver",
    },
  },
});

const fs = new ContextFS(mockFs);
const bash = createBash({ fs });

const result = await bash`grep myserver /etc/hosts | cut -d' ' -f1`;
expect(result.stdout.trim()).toBe("192.168.1.1");

AI/LLM Sandboxing

Let AI execute bash commands against a controlled virtual filesystem:

const sandboxFs = createFileSystem({
  workspace: {
    ":file": {
      [list]: () => [{ file: "readme.md" }, { file: "config.yaml" }],
      [read]: (c) => getFileContent(c.params.file),
    },
  },
});

const fs = new ContextFS(sandboxFs);
const bash = createBash({ fs });

// AI can explore but can't modify or escape
const aiCommand = userInput; // e.g., "ls /workspace && cat /workspace/readme.md"
const result = await bash([aiCommand]);

Dynamic Content

Serve computed content that bash scripts can consume:

const apiFs = createFileSystem({
  api: {
    "users.json": {
      [read]: async () => {
        const users = await fetchUsersFromAPI();
        return JSON.stringify(users);
      },
    },
    "stats.txt": {
      [read]: () =>
        `Uptime: ${process.uptime()}s\nMemory: ${process.memoryUsage().heapUsed}`,
    },
  },
});

const fs = new ContextFS(apiFs);
const bash = createBash({ fs });

await bash`cat /api/users.json | jq '.[0].name'`;
await bash`cat /api/stats.txt | grep Uptime`;

Limitations

  1. Read-only: Write operations are not supported
  2. No process spawning: Can't use features that spawn real processes
  3. Path resolution: Relative paths are resolved within the virtual filesystem

Related Packages

License

MIT