{"_id":"@budhash/zap-sh","_rev":"4-b414eda2fec1d2943bcb9340ff1136f4","name":"@budhash/zap-sh","dist-tags":{"latest":"1.1.2"},"versions":{"1.0.0":{"name":"@budhash/zap-sh","version":"1.0.0","keywords":["zap-sh","bash","generator","scaffold","template"],"author":{"name":"budhash"},"license":"MIT","_id":"@budhash/zap-sh@1.0.0","maintainers":[{"name":"budhash","email":"budhash@gmail.com"}],"homepage":"https://github.com/budhash/zap-sh#readme","bugs":{"url":"https://github.com/budhash/zap-sh/issues"},"dist":{"shasum":"3e01edcdcc09e1deb4ffa82113647ecf8fe8483b","tarball":"https://registry.npmjs.org/@budhash/zap-sh/-/zap-sh-1.0.0.tgz","fileCount":6,"integrity":"sha512-sRugEJWoUvIIU6lNn092jGQmWuKysqjtgV+nXochbh5dZJeixflr5Ot+3r81xY+DVtZm/lH27VI1Ey/pqsaeNg==","signatures":[{"sig":"MEUCIGLLeaVW0i5q1lyqubsGoqUF/Fw25tWoocoBCX13fAe2AiEAuv/h224yse1tUHWVq6h4JUJuz5lG2PkqgiaFK/tBK8I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76018},"main":"./dist/index.cjs","type":"module","types":"./types/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./types/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"33be170477d7e5405b208687fb90c3a970f4dccc","scripts":{"test":"node --test test/*.test.mjs","build":"node scripts/build.mjs","bundle":"node scripts/bundle-templates.mjs","prepack":"npm run build","pretest":"npm run build","prebuild":"node scripts/bundle-templates.mjs","build:web":"node scripts/bundle-templates.mjs && node scripts/build-web.mjs","test:diff":"npm run build && node --test test/differential.mjs"},"_npmUser":{"name":"budhash","email":"budhash@gmail.com"},"repository":{"url":"git+https://github.com/budhash/zap-sh.git","type":"git","directory":"packages/generator"},"_npmVersion":"11.5.1","description":"JavaScript generator for zap-sh scripts — byte-for-byte parity with the bash `zap-sh init` oracle.","directories":{},"_nodeVersion":"22.17.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.28.0"},"_npmOperationalInternal":{"tmp":"tmp/zap-sh_1.0.0_1788890033561_0.19648829629389475","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@budhash/zap-sh","version":"1.1.0","keywords":["zap-sh","bash","generator","scaffold","template"],"author":{"name":"budhash"},"license":"MIT","_id":"@budhash/zap-sh@1.1.0","maintainers":[{"name":"budhash","email":"budhash@gmail.com"}],"homepage":"https://github.com/budhash/zap-sh#readme","bugs":{"url":"https://github.com/budhash/zap-sh/issues"},"dist":{"shasum":"d78f9ce2be9930f543ba0d6cf975350fe17bc9c0","tarball":"https://registry.npmjs.org/@budhash/zap-sh/-/zap-sh-1.1.0.tgz","fileCount":6,"integrity":"sha512-rdcTTFhg+35+NumRRVK2KLHwbgs++dF15dleAW5+KyDHBowH8SOwzdMQVkI8BnzP0RPzx0Gqfg/FvEaFOe0wuA==","signatures":[{"sig":"MEUCIDT5UKZQqO5GaW+onxcsBLbKYlfcbR+E9o66p/0PzknUAiEAy8SWS+ONwRqhhK/q4J7e8gZWQpOCjqUcIhxovOOCvCs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCl/By1Loo5IDO0uw/rUlzbctn0WN1yXA9Wvlk3x8DOmgIgdeWcbBvAs7zj9CKi8TqLrc8YDWippDG888/r2yNyH8E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@budhash%2fzap-sh@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":76676},"main":"./dist/index.cjs","type":"module","types":"./types/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./types/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"e0af972ae552248ed348844cc930b2ed2474ca3b","scripts":{"test":"node --test test/*.test.mjs","build":"node scripts/build.mjs","bundle":"node scripts/bundle-templates.mjs","prepack":"npm run build","pretest":"npm run build","prebuild":"node scripts/bundle-templates.mjs","build:web":"node scripts/bundle-templates.mjs && node scripts/build-web.mjs","test:diff":"npm run build && node --test test/differential.mjs"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e5e60d12-936c-421d-b10a-daa2230d49a7"}},"repository":{"url":"git+https://github.com/budhash/zap-sh.git","type":"git","directory":"packages/generator"},"_npmVersion":"12.0.2","description":"JavaScript generator for zap-sh scripts — byte-for-byte parity with the bash `zap-sh init` oracle.","directories":{},"_nodeVersion":"22.23.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.28.0"},"_npmOperationalInternal":{"tmp":"tmp/zap-sh_1.1.0_1788910882526_0.6016163583759939","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@budhash/zap-sh","version":"1.1.1","keywords":["zap-sh","bash","generator","scaffold","template"],"author":{"name":"budhash"},"license":"MIT","_id":"@budhash/zap-sh@1.1.1","maintainers":[{"name":"budhash","email":"budhash@gmail.com"}],"homepage":"https://github.com/budhash/zap-sh#readme","bugs":{"url":"https://github.com/budhash/zap-sh/issues"},"dist":{"shasum":"48ddb18231c6c8f8f2d08c965a3834ad3eaf18e6","tarball":"https://registry.npmjs.org/@budhash/zap-sh/-/zap-sh-1.1.1.tgz","fileCount":6,"integrity":"sha512-Hl4URVjEZLeG/+z5TVAyMhnwHT7O1BUhvLxu0Qp9M51By4Rkjs4DtnIY2cS1j+ggSHhhYtbW1OdwkBpEKBouww==","signatures":[{"sig":"MEYCIQC88c2SbT587DK8gRuuNoCdJeXPyFctSAB1+lbnrU4gagIhALf9cTJmtVduEa8ZKk5Ac5A3DC2611Hj5UrBBtySycKG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIB0e1JnV5zTP4N1jXHpJDiA/CXwEdghdR+LyUDxcl4sDAiA4+4iWkd7A0ZtCAtYKXew9OjXdArd7QLiG0+26RWDtRw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@budhash%2fzap-sh@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":84979},"main":"./dist/index.cjs","type":"module","types":"./types/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./types/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"4432211ebef735c05119d321cacd7c1ace8c369d","scripts":{"test":"node --test test/*.test.mjs","build":"node scripts/build.mjs","bundle":"node scripts/bundle-templates.mjs","prepack":"npm run build","pretest":"npm run build","prebuild":"node scripts/bundle-templates.mjs","test:diff":"npm run build && node --test test/differential.mjs"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e5e60d12-936c-421d-b10a-daa2230d49a7"}},"repository":{"url":"git+https://github.com/budhash/zap-sh.git","type":"git","directory":"packages/generator"},"_npmVersion":"12.0.2","description":"JavaScript generator for zap-sh scripts — byte-for-byte parity with the bash `zap-sh init` oracle.","directories":{},"_nodeVersion":"22.23.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/zap-sh_1.1.1_1788914297440_0.3669861370541707","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"_id":"@budhash/zap-sh@1.1.2","bugs":{"url":"https://github.com/budhash/zap-sh/issues"},"dist":{"shasum":"c59e7a14452a2ed279f05905fd902dfe1d0be3b7","tarball":"https://registry.npmjs.org/@budhash/zap-sh/-/zap-sh-1.1.2.tgz","fileCount":6,"integrity":"sha512-lOo9aXNTfGmf5Wm4xUQ9C61ZYHF/XrF5CF9wxAnOVqIB3VVt9y/84z1JvC0yoWkiOZ3nCwXWTHGfXCM+UREmQw==","signatures":[{"sig":"MEUCIEWMbr0RstfFdjOMkMJrSd69rtycTLeIFr+JU/y9btDJAiEA5CszhlyeaiGTrCEiwjgFha/3vrrbQ19XNpbQWeOTr/8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDdHgTV368HHPe4YXY6H+H9nBZl164WRBGkrWG5V6ajYQIgBfS3p/mzxtkE3vHS9jTGEncLIR8kB96xew+hvKUmEZI="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@budhash%2fzap-sh@1.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":84979},"main":"./dist/index.cjs","name":"@budhash/zap-sh","type":"module","types":"./types/index.d.ts","author":{"name":"budhash"},"module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"types":"./types/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"aa11da787b33bbf322691afc8e5b547c55b2a481","license":"MIT","scripts":{"test":"node --test test/*.test.mjs","build":"node scripts/build.mjs","bundle":"node scripts/bundle-templates.mjs","prepack":"npm run build","pretest":"npm run build","prebuild":"node scripts/bundle-templates.mjs","test:diff":"npm run build && node --test test/differential.mjs"},"version":"1.1.2","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:e5e60d12-936c-421d-b10a-daa2230d49a7"}},"homepage":"https://github.com/budhash/zap-sh#readme","keywords":["zap-sh","bash","generator","scaffold","template"],"repository":{"url":"git+https://github.com/budhash/zap-sh.git","type":"git","directory":"packages/generator"},"_npmVersion":"12.0.2","description":"JavaScript generator for zap-sh scripts — byte-for-byte parity with the bash `zap-sh init` oracle.","directories":{},"maintainers":[{"name":"budhash","email":"budhash@gmail.com"}],"_nodeVersion":"22.23.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/zap-sh_1.1.2_1789364653528_0.4466292566025789"}}},"time":{"created":"2026-09-08T17:53:53.354Z","modified":"2026-09-14T05:44:13.937Z","1.0.0":"2026-09-08T17:53:53.716Z","1.1.0":"2026-09-08T23:41:22.604Z","1.1.1":"2026-09-09T00:38:17.527Z","1.1.2":"2026-09-14T05:44:13.607Z"},"bugs":{"url":"https://github.com/budhash/zap-sh/issues"},"author":{"name":"budhash"},"license":"MIT","homepage":"https://github.com/budhash/zap-sh#readme","keywords":["zap-sh","bash","generator","scaffold","template"],"repository":{"url":"git+https://github.com/budhash/zap-sh.git","type":"git","directory":"packages/generator"},"description":"JavaScript generator for zap-sh scripts — byte-for-byte parity with the bash `zap-sh init` oracle.","maintainers":[{"name":"budhash","email":"budhash@gmail.com"}],"readme":"# @budhash/zap-sh\n\nA JavaScript generator for [zap-sh](https://github.com/budhash/zap-sh) scripts.\nIt produces the same output as the bash `zap-sh init` command, byte-for-byte: a\nshared conformance suite runs the same fixtures through both the bash and JS\ngenerators in CI, so their output stays in sync. See the\n[generation spec](https://github.com/budhash/zap-sh/blob/main/SPEC.md).\n\nIt covers `init` (generation) only — template choice, project metadata, license,\nand variable substitution. Use the bash tool for `update`, `snip`, and `upgrade`.\n\n## Install\n\n```bash\nnpm install @budhash/zap-sh\n```\n\n## Usage\n\n```js\nimport { generate } from '@budhash/zap-sh';\n\nconst { filename, content } = generate({\n  template: 'enhanced',          // 'basic' | 'enhanced'\n  project: 'my-tool',            // becomes {{app}}; /^[a-zA-Z0-9_-]+$/\n  license: 'mit',                // 'mit' | 'apache' | 'gpl' (optional)\n  year: '2025',                  // pins {{year}} (optional; defaults to current year)\n  variables: {                   // extra {{key}} values; order is significant\n    author: 'Jane Doe',\n    email: 'jane@example.com',\n    version: '1.2.0',\n    detail: 'Short description',\n    description: 'Longer description',\n  },\n});\n\n// content === what `zap-sh init my-tool -t enhanced --license=mit ...` writes\n// filename === 'my-tool.sh'\n```\n\nCommonJS works too:\n\n```js\nconst { generate } = require('@budhash/zap-sh');\n```\n\n### API\n\n- `generate(options) => { filename, content }` — generate a script. Throws on an\n  invalid template, project name, variable name, or license code.\n- `substitute(content, pairs)` — the `{{key}}` substitution engine (sequential,\n  whole-buffer; see SPEC §4).\n- `extractSection(templateText, name)` — extract a `##( name` … `##) name`\n  section (markers included), or `null`.\n- `listTemplates()` / `listLicenses()` — available names / license codes.\n\nFull types in [`types/index.d.ts`](./types/index.d.ts).\n\n### Determinism\n\n`year` is the only clock-derived input. Pass `year` to make output fully\nreproducible; omit it to use the current year. See SPEC §6 for the one edge\n(`{{year}}` embedded inside a field value) that remains clock-bound.\n\n## Development\n\nThe templates are bundled from the repo's `templates/` at build time (the single\nsource of truth), so `src/templates.generated.js` and `dist/` are generated.\n\n```bash\nnpm run build     # bundle templates + emit dist/index.mjs + dist/index.cjs (pure Node, no deps)\nnpm test          # build, then conformance vs the shared golden files\nnpm run test:diff # differential parity: run the live bash tool + JS and diff\n```\n\nThe package has **zero dependencies** — the build is plain Node (no bundler).\n\nParity is enforced in CI two ways: the JS and bash conformance runners both check\nthe same fixtures in `test/conformance/`, and the differential test runs the\nlive `zap-sh init` and the JS generator over a broad input matrix and compares\nbyte-for-byte.\n","readmeFilename":"README.md"}