{"_id":"@amirdor/piggybank","_rev":"2-605f5dfdf3a787fa1f67d8ca010f463a","name":"@amirdor/piggybank","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@amirdor/piggybank","version":"0.1.0","keywords":["piggy","installer","macos"],"license":"MIT","_id":"@amirdor/piggybank@0.1.0","maintainers":[{"name":"amirdor","email":"amirdor+npm@gmail.com"}],"bin":{"piggybank":"cli.js"},"dist":{"shasum":"18be556e3ea4ae8b501b39a5d5a13acaf829b919","tarball":"https://registry.npmjs.org/@amirdor/piggybank/-/piggybank-0.1.0.tgz","fileCount":4,"integrity":"sha512-6VBwdHc7XmZMok0lxq3ESQffW+HyEFH59I+4p9Sb0S9ql+hbxMEywtqV0ylZ9f8/WCVfIxkd/8dARetqgJ+yGg==","signatures":[{"sig":"MEUCIGQzHidFnOnwOtF7/u5wLPG2yK/c4NsYIWpJIQuZmDFPAiEAiMOQaump328y20INR5qJgmvcp1Ou8G6PR7+GczohfGo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25469},"main":"lib.js","piggy":{"repo":"doramirdor/piggy","version":"latest"},"engines":{"node":">=18"},"gitHead":"854cd2200b012594c6ae82dfb0e6e165ad9fab0c","scripts":{"test":"node --test test/*.test.js"},"_npmUser":{"name":"amirdor","email":"amirdor+npm@gmail.com"},"_npmVersion":"11.13.0","description":"npx installer for Piggy, a macOS menu bar app that tracks Claude Code savings.","directories":{},"_nodeVersion":"24.16.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/piggybank_0.1.0_1784571765113_0.15118242717345565","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@amirdor/piggybank","version":"0.1.1","description":"npx installer for Piggy, a macOS menu bar app that tracks Claude Code savings.","license":"MIT","bin":{"piggybank":"cli.js"},"main":"lib.js","engines":{"node":">=18"},"scripts":{"test":"node --test test/*.test.js"},"piggy":{"repo":"doramirdor/piggy","version":"latest"},"keywords":["piggy","installer","macos"],"gitHead":"1b7258066312644dbda20e8f8d5e540ee5e7997b","_id":"@amirdor/piggybank@0.1.1","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-NrOG49Y/mk0Cj+D0R6RsoSbPiDKxJ4pdVN+EaJo2RQ4K+oCS5yrtH+WOCs3wtdkWjvHXnarcVfBtADO1/d7WWw==","shasum":"b0d8705df088d0b1e2a608acc22d6c21270ddf96","tarball":"https://registry.npmjs.org/@amirdor/piggybank/-/piggybank-0.1.1.tgz","fileCount":4,"unpackedSize":25586,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDtciV1jrVx1cWczCrCZDTzTWdBCPfrfg4EXVQkYJj/UgIhANsROOmNGTlhSZ3tVydhlrZv/BS3bcqW3xxm0NX7K1dw"}]},"_npmUser":{"name":"amirdor","email":"amirdor+npm@gmail.com"},"directories":{},"maintainers":[{"name":"amirdor","email":"amirdor+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/piggybank_0.1.1_1784572928479_0.2993748368717246"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-20T18:22:44.949Z","modified":"2026-07-20T18:42:08.785Z","0.1.0":"2026-07-20T18:22:45.325Z","0.1.1":"2026-07-20T18:42:08.653Z"},"license":"MIT","keywords":["piggy","installer","macos"],"description":"npx installer for Piggy, a macOS menu bar app that tracks Claude Code savings.","maintainers":[{"name":"amirdor","email":"amirdor+npm@gmail.com"}],"readme":"# @amirdor/piggybank\n\nThe `npx` installer for **Piggy**, a macOS menu bar app. Zero dependencies -\nNode stdlib only (`https`, `crypto`, `fs`, `os`, `child_process`, `readline`).\n\n## Usage\n\nInstall the latest release:\n\n```sh\nnpx @amirdor/piggybank\n```\n\nThis will:\n\n1. Confirm you're on macOS (friendly message + exit otherwise).\n2. Detect your Mac's architecture (`arm64` or `x64`).\n3. Ask the GitHub API for the configured release (see [Configuration](#configuration)).\n4. Find the `.dmg` asset that matches your architecture.\n5. Download it to a temp directory with a progress indicator.\n6. Verify its `sha256` against a `checksums.txt` asset published alongside it.\n   If either the checksums file or a matching hash is missing, the installer\n   **hard-fails** rather than installing an unverified binary.\n7. Mount the `.dmg` with `hdiutil attach`.\n8. Ask **[y/N]** whether to copy `Piggy.app` straight into `/Applications`.\n   - **Yes** → copies it in, then detaches the disk image. Done.\n   - **No** → opens the mounted volume in Finder so you can drag it in\n     yourself, waits for you to press Enter, then detaches.\n\nSkip the copy prompt (assume yes) - handy for CI or scripted setups:\n\n```sh\nnpx @amirdor/piggybank --yes\n```\n\nUninstall:\n\n```sh\nnpx @amirdor/piggybank --uninstall\n```\n\nPrompts **[y/N]** before removing `/Applications/Piggy.app` (or pass `--yes`\nto skip the prompt). It deliberately leaves `~/.piggy` (your saved data)\nalone and prints the command to remove it yourself:\n\n```sh\nrm -rf ~/.piggy\n```\n\nSee all flags:\n\n```sh\nnpx @amirdor/piggybank --help\n```\n\n## Configuration\n\nThe installer reads its target repo and version from **this package's own\n`package.json`**, under the `piggy` field:\n\n```json\n{\n  \"piggy\": {\n    \"repo\": \"doramirdor/piggy\",\n    \"version\": \"latest\"\n  }\n}\n```\n\n- `piggy.repo` - the GitHub `<owner>/<name>` to fetch releases from.\n  `doramirdor/piggy` is the real repo. Its first release, `v0.1.0`, is an\n  **unsigned developer preview**: the installer downloads and verifies it fine,\n  but macOS Gatekeeper needs one right-click → **Open** on first launch (or\n  `xattr -dr com.apple.quarantine /Applications/Piggy.app`) until notarized\n  builds ship.\n- `piggy.version` - a release tag (e.g. `\"v1.2.0\"`) or `\"latest\"`.\n\n### Updating this at release time\n\nWhen the real Piggy GitHub repo is created (and again any time the intended\ninstall target changes), update `installer/package.json`:\n\n1. Set `piggy.repo` to the real `<owner>/<name>`.\n2. Leave `piggy.version` as `\"latest\"` for normal releases - the installer\n   always resolves whatever GitHub currently marks as the latest release via\n   `GET /repos/<repo>/releases/latest`. Only pin `piggy.version` to a\n   specific tag if you deliberately want `npx @amirdor/piggybank` to install an\n   older/specific version.\n3. Bump the installer's own `version` field (semver for the `@amirdor/piggybank` npm\n   package itself - independent of the Piggy app version) and `npm publish`\n   from `installer/`.\n\nThe release side of the contract (owned by whatever builds and publishes\nPiggy):\n\n- Each GitHub release must attach `.dmg` assets whose filenames contain an\n  arch tag the installer recognizes: `arm64`/`aarch64` for Apple Silicon,\n  `x64`/`x86_64`/`amd64` for Intel (e.g. `Piggy-1.2.0-arm64.dmg`). A release\n  with a single untagged `.dmg` also works (treated as universal/either-arch).\n- Each release must also attach a `checksums.txt` asset listing the\n  `sha256` of every `.dmg`, one per line, in standard `sha256sum` format:\n\n  ```\n  <sha256-hex>  Piggy-1.2.0-arm64.dmg\n  <sha256-hex>  Piggy-1.2.0-x64.dmg\n  ```\n\n  Typically generated with `shasum -a 256 *.dmg > checksums.txt`.\n\nUntil the repo has a first release, `npx @amirdor/piggybank` prints:\n\n> Piggy hasn't shipped its first release yet - watch\n> https://github.com/\\<repo\\>/releases\n\nand exits cleanly (this is GitHub's normal `404` response from\n`/releases/latest` on a repo with no published releases yet - not an error\nin the installer).\n\n## Development\n\n```sh\ncd installer\nnpm test          # runs test/*.test.js via node --test - no network required\nnode cli.js --help\n```\n\n### Design notes\n\n- `lib.js` holds every pure function: release-URL building, config\n  resolution, arch mapping, asset picking (`.dmg` + `checksums.txt`),\n  checksum-file parsing, checksum verification, the \"no releases yet\"\n  message, and `hdiutil attach` output parsing. None of it touches the\n  network, the filesystem, or a child process - that's what makes it\n  testable offline with fixture JSON in `test/fixtures/`.\n- `cli.js` is the thin, imperative shell around `lib.js`: HTTP calls,\n  streaming download + progress bar, `hdiutil`/`open` invocations, the\n  readline `[y/N]` prompts, and ANSI-colored output. It has no exported\n  surface to unit test directly - it's exercised by hand (`node cli.js`)\n  and via the acceptance path in the M4 spec (`npx @amirdor/piggybank` → app opens).\n\n### Tests\n\n```sh\nnpm test\n```\n\nRuns `test/lib.test.js` against fixtures in `test/fixtures/` (sample GitHub\nrelease JSON, a `checksums.txt`, and sample `hdiutil attach` output) -\n30 cases covering arch mapping, config resolution, release URL building,\n`.dmg`/checksum asset picking (including single-dmg and no-dmg releases),\nchecksum-file parsing (including the `sha256sum -b` `*filename` form),\nchecksum verification, the no-release message, byte formatting, and\n`hdiutil` mount-point parsing. No network access required.\n","readmeFilename":"README.md"}