Getting Started
BashGres is a PostgreSQL-backed virtual filesystem for AI agents. It implements the just-bash IFileSystem interface, so you can pass it directly to new Bash({ fs }) and get a complete bash environment backed by PostgreSQL.
Install
Install BashGres with your preferred PostgreSQL driver and just-bash:
npm install bash-gres postgres just-bashQuick Start
import postgres from "postgres"
import { Bash } from "just-bash"
import { setup, PgFileSystem } from "bash-gres/postgres"
const sql = postgres("postgres://localhost:5432/myapp")
await setup(sql)
const fs = new PgFileSystem({ db: sql, workspaceId: "workspace-1" })
const bash = new Bash({ fs })
await bash.exec("mkdir -p /project/src")
await bash.exec('echo "hello world" > /project/src/index.ts')
await bash.exec("cat /project/src/index.ts")
// { exitCode: 0, stdout: "hello world\n", stderr: "" }Requirements
- PostgreSQL 15+ with the
ltreeextension - Node.js 18+
- Optional:
pg_textsearchfor BM25 full-text search - Optional:
pgvectorfor semantic/hybrid search