
Security News
pnpm 11.5 Adds Support for Recognizing npm Staged Publishes
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.
@computesdk/just-bash
Advanced tools
just-bash provider for ComputeSDK - local sandboxed bash execution with virtual filesystem
just-bash provider for ComputeSDK - Local sandboxed bash execution with a virtual filesystem. No external services, containers, or authentication required.
npm install @computesdk/just-bash
import { justBash } from '@computesdk/just-bash';
const compute = justBash({});
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCommand('echo "Hello" | tr a-z A-Z');
console.log(result.stdout); // "HELLO"
await sandbox.destroy();
No environment variables are required. just-bash runs entirely locally.
interface JustBashConfig {
/** Enable Python support via pyodide (disabled by default) */
python?: boolean;
/** Initial files to populate in the virtual filesystem */
files?: Record<string, string>;
/** Initial environment variables */
env?: Record<string, string>;
/** Working directory (defaults to /home/user) */
cwd?: string;
/** Custom filesystem implementation (see Filesystem Backends below) */
fs?: IFileSystem;
/** Custom commands created with defineCommand() (see Custom Commands below) */
customCommands?: CustomCommand[];
/** Network configuration for curl (disabled by default) */
network?: NetworkConfig;
}
By default, just-bash uses an InMemoryFs — a pure in-memory filesystem. You can swap in alternative backends depending on your use case:
All files live in memory. Fast, deterministic, fully isolated.
const compute = justBash({}); // InMemoryFs is the default
Reads from a real directory on disk; writes stay in memory. The underlying directory is never modified.
import { OverlayFs } from 'just-bash';
const compute = justBash({
fs: new OverlayFs({ root: '/path/to/project' }),
cwd: '/path/to/project',
});
Reads and writes go directly to a real directory. Use with caution — changes are real.
import { ReadWriteFs } from 'just-bash';
const compute = justBash({
fs: new ReadWriteFs({ root: '/tmp/sandbox' }),
});
Mount different filesystem backends at different paths.
import { MountableFs, InMemoryFs } from 'just-bash';
import { OverlayFs } from 'just-bash';
const compute = justBash({
fs: new MountableFs({
base: new InMemoryFs(),
mounts: [
{ mountPoint: '/project', filesystem: new OverlayFs({ root: '/real/project' }) },
],
}),
cwd: '/project',
});
You can extend just-bash with custom commands using defineCommand():
import { justBash } from '@computesdk/just-bash';
import { defineCommand } from 'just-bash';
const hello = defineCommand('hello', async (args, ctx) => {
const name = args[0] || 'world';
return {
stdout: `Hello, ${name}!\n`,
stderr: '',
exitCode: 0,
};
});
const compute = justBash({ customCommands: [hello] });
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCommand('hello Alice');
console.log(result.stdout); // "Hello, Alice!\n"
Custom commands receive a context object (ctx) with access to:
ctx.fs — the virtual filesystemctx.cwd — current working directoryctx.env — environment variablesctx.stdin — standard inputctx.exec(command) — run subcommands// Execute bash scripts
const result = await sandbox.runCommand(`
for i in 1 2 3; do
echo "Number: $i"
done
`);
console.log(result.stdout);
// Number: 1
// Number: 2
// Number: 3
// Execute Python code (requires python: true in config)
const compute = justBash({ python: true });
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCommand(`python - <<'PY'
import json
data = {"message": "Hello from Python"}
print(json.dumps(data))
PY`);
// Pipes and text processing
const result = await sandbox.runCommand('echo -e "banana\\napple\\ncherry" | sort');
console.log(result.stdout); // "apple\nbanana\ncherry\n"
// JSON processing with jq
await sandbox.filesystem.writeFile('/data.json', '[{"name":"Alice"},{"name":"Bob"}]');
const result = await sandbox.runCommand('cat /data.json | jq ".[].name"');
// Environment variables per command
const result = await sandbox.runCommand('echo $MY_VAR', { env: { MY_VAR: 'hello' } });
// Working directory per command
const result = await sandbox.runCommand('cat config.json', { cwd: '/app' });
// Write file
await sandbox.filesystem.writeFile('/tmp/hello.txt', 'Hello World');
// Read file
const content = await sandbox.filesystem.readFile('/tmp/hello.txt');
// Create directory
await sandbox.filesystem.mkdir('/tmp/data');
// List directory contents
const files = await sandbox.filesystem.readdir('/tmp');
// Check if file exists
const exists = await sandbox.filesystem.exists('/tmp/hello.txt');
// Remove file or directory
await sandbox.filesystem.remove('/tmp/hello.txt');
// Get sandbox info
const info = await sandbox.getInfo();
console.log(info.id, info.provider, info.status);
// List all active sandboxes
const sandboxes = await compute.sandbox.list();
// Get sandbox by ID
const existing = await compute.sandbox.getById('sandbox-id');
// Destroy sandbox
await sandbox.destroy();
const compute = justBash({
files: {
'/app/config.json': '{"port": 3000}',
'/app/data.csv': 'name,age\nAlice,25\nBob,30',
},
env: {
APP_ENV: 'production',
},
cwd: '/app',
});
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCommand('cat config.json');
console.log(result.stdout); // {"port": 3000}
just-bash includes 60+ built-in commands:
| Category | Commands |
|---|---|
| File ops | cat, cp, ls, mkdir, mv, rm, touch, tree, ln, find |
| Text processing | awk, grep, sed, cut, sort, uniq, wc, head, tail, tr |
| Data processing | jq (JSON), yq (YAML/XML), sqlite3 (SQLite), CSV tools |
| Compression | gzip, tar |
| Utilities | echo, printf, date, seq, timeout, basename, dirname |
| Shell | export, source, alias, test, read, set, unset |
import { justBash } from '@computesdk/just-bash';
const compute = justBash({});
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCommand('cat /nonexistent');
if (result.exitCode !== 0) {
console.error('Command failed:', result.stderr);
}
// getUrl throws since just-bash has no network
try {
await sandbox.getUrl({ port: 3000 });
} catch (error) {
console.error(error.message); // "just-bash is a local sandbox without network capabilities..."
}
import { justBash } from '@computesdk/just-bash';
const compute = justBash({});
const sandbox = await compute.sandbox.create();
// Create CSV data
await sandbox.filesystem.writeFile('/data/sales.csv',
'product,quantity,price\nWidget,100,9.99\nGadget,50,24.99\nDoohickey,200,4.99'
);
// Process with awk
const result = await sandbox.runCommand(
'cat /data/sales.csv | tail -n +2 | awk -F, \'{ total += $2 * $3 } END { printf "Total revenue: $%.2f\\n", total }\''
);
console.log(result.stdout); // Total revenue: $3247.50
await sandbox.destroy();
import { justBash } from '@computesdk/just-bash';
const compute = justBash({
files: {
'/data/users.json': JSON.stringify([
{ name: 'Alice', age: 30, role: 'admin' },
{ name: 'Bob', age: 25, role: 'user' },
{ name: 'Charlie', age: 35, role: 'admin' },
]),
},
});
const sandbox = await compute.sandbox.create();
// Filter admins and extract names
const result = await sandbox.runCommand(
'cat /data/users.json | jq \'[.[] | select(.role == "admin") | .name]\''
);
console.log(result.stdout); // ["Alice", "Charlie"]
await sandbox.destroy();
import { justBash } from '@computesdk/just-bash';
const compute = justBash({});
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCommand(`
#!/bin/bash
count=0
for f in /proc/self/status /etc/hostname; do
if test -f "$f"; then
count=$((count + 1))
fi
done
echo "Found $count system files"
`);
console.log(result.stdout);
await sandbox.destroy();
getUrl() is not supported; curl requires explicit network configOverlayFs, ReadWriteFs, or MountableFspython: true and uses pyodide (WebAssembly-based)MIT
FAQs
just-bash provider for ComputeSDK - local sandboxed bash execution with virtual filesystem
We found that @computesdk/just-bash demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
pnpm 11.5 now recognizes npm staged publish approvals in release metadata, preventing those releases from being mistaken for lower-trust package publishes.

Security News
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.