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.
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.
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.
installGrab 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-shtemplates
basic — essential utilities, logging, error handling. enhanced — everything in basic plus a 40+ function library (JSON, HTTP, arrays, strings).
# 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=mitvariables
| project | script name (positional) → {{app}} |
| --detail | brief one-line description |
| --description | longer description |
| --author / --email | author identity |
| --version | script version (default 0.1.0) |
| --license | mit · apache · gpl |
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.