bash script generator · bash + javascript · runs anywhere

zap-sh

Scaffold self-contained, maintainable bash scripts from templates — strict mode, structured logging, cross-platform helpers, and a protected section for your own code that survives framework updates. Ships as a bash script and a zero-dependency JavaScript package (@budhash/zap-sh), kept identical by a shared spec.

live

Runs the zap-sh generator client-side — a JavaScript port of the bash tool, verified byte-for-byte against its output. Fill in the fields; the script updates live. Nothing is sent anywhere.

options fill in; the script updates live
my-tool.shgenerated script

      
tool
what it is

A single bash script that generates other bash scripts. Pick a template, give it a name and some metadata, and zap-sh emits a ready-to-run script. Your code lives in a protected ##( app section that is preserved when you later refresh the framework with zap-sh update.

install

Grab the latest released script (branch-independent), make it executable:

curl -kL https://github.com/budhash/zap-sh/releases/latest/download/zap-sh > zap-sh
chmod +x zap-sh
templates

basic — essential utilities, logging, error handling. enhanced — everything in basic plus a 40+ function library (JSON, HTTP, arrays, strings).

generate (cli)
# quick: a basic script
zap-sh init my-tool

# enhanced, with metadata and a license
zap-sh init deploy -t enhanced \
  --author="Jane Doe" --email="jane@example.com" \
  --version="1.2.0" --license=mit
variables
projectscript name (positional) → {{app}}
--detailbrief one-line description
--descriptionlonger description
--author / --emailauthor identity
--versionscript version (default 0.1.0)
--licensemit · apache · gpl
javascript — @budhash/zap-sh

The same generator as a zero-dependency npm package (Node and the browser) — it produces the exact script zap-sh init writes, byte-for-byte, tracked by a shared spec and conformance suite. It powers the wizard above.

npm i @budhash/zap-sh
// generation only: template -> { filename, content }
import { generate } from "@budhash/zap-sh";
const { filename, content } = generate({
  template: "enhanced", project: "my-tool", license: "mit",
  variables: { author: "Jane Doe", version: "1.2.0" },
});

CommonJS and TypeScript types are included. Full docs in the README.