Bash

PgFileSystem implements the just-bash IFileSystem interface. Pass it directly to get a complete bash environment: 60+ commands, pipes, redirects, variables, loops, all persisted in PostgreSQL.

Setup

npm install just-bash
import { Bash } from "just-bash"
import { PgFileSystem } from "bash-gres/postgres"

const fs = new PgFileSystem({ db: sql, workspaceId: "workspace-1" })
const bash = new Bash({ fs })

Basic Commands

await bash.exec("mkdir -p /project/src")
await bash.exec('echo "hello world" > /project/src/index.ts')

const result = await bash.exec("cat /project/src/index.ts")
// { exitCode: 0, stdout: "hello world\n", stderr: "" }

For the full list of commands, pipes, redirects, variables, and more, see the just-bash documentation.