{"_id":"@anupjon/crnch","_rev":"2-012999aa92cb3bcd907c6d87efac13e0","name":"@anupjon/crnch","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@anupjon/crnch","version":"0.1.0","keywords":["cli","image","video","optimization","sharp","ffmpeg","webp","avif"],"license":"MIT","_id":"@anupjon/crnch@0.1.0","maintainers":[{"name":"anupjon","email":"aj9666@gmail.com"}],"bin":{"crnch":"dist/cli/index.js"},"dist":{"shasum":"f405c2bace6e3626664daa6e0e643348fdb39c22","tarball":"https://registry.npmjs.org/@anupjon/crnch/-/crnch-0.1.0.tgz","fileCount":206,"integrity":"sha512-NET5Tk8g3k4Gk3tbHCndo1Z8T2AliH6n55F0ghGB/yL0yHJiAp9rbocCIzZaOcC1mlOjQjfCamhYrMpqrBHaWw==","signatures":[{"sig":"MEUCIGJ5KiwymUMaWfKO4NIUVHrKIMcjOOoW7WwD8d47tWymAiEA/lvqjIV88TgVkRTYD9VMJcrqQtrlwRkBY8j7uEB2Q00=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":452946},"type":"module","engines":{"node":">=20.0.0"},"gitHead":"454b86defa28140a508b8bd7ea17c3b00d412534","scripts":{"dev":"tsx src/cli/index.ts","test":"vitest run","build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit","test:watch":"vitest"},"_npmUser":{"name":"anupjon","email":"aj9666@gmail.com"},"_npmVersion":"11.13.0","description":"crnch — crunch your media. A developer CLI for optimizing images and videos.","directories":{},"_nodeVersion":"24.16.0","dependencies":{"zod":"^4.4.3","sharp":"^0.35.3","picocolors":"^1.0.1","@clack/prompts":"^1.7.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.16.0","vitest":"^2.0.0","typescript":"^5.5.0","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/crnch_0.1.0_1787575838245_0.5276402391931796","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@anupjon/crnch","version":"0.2.0","description":"crnch — crunch your media. A developer CLI for optimizing images and videos.","keywords":["cli","image","video","optimization","sharp","ffmpeg","webp","avif"],"license":"MIT","type":"module","engines":{"node":">=20.0.0"},"bin":{"crnch":"dist/cli/index.js"},"scripts":{"build":"tsc -p tsconfig.json","dev":"tsx src/cli/index.ts","test":"vitest run","test:watch":"vitest","typecheck":"tsc -p tsconfig.json --noEmit"},"dependencies":{"@clack/prompts":"^1.7.0","picocolors":"^1.0.1","sharp":"^0.35.3","zod":"^4.4.3"},"devDependencies":{"@types/node":"^20.14.0","tsx":"^4.16.0","typescript":"^5.5.0","vitest":"^2.0.0"},"gitHead":"330378111fc9ea67e950d42fcf2d85245e2a6c36","_id":"@anupjon/crnch@0.2.0","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-T5xfDKNkDWO+jYpiyx1KEzQScIQrjim5KKt6cJOhElR6RR/8YkfWWFlCSnovOwk1IpsjqH5/WnAAsUzOXDHfGA==","shasum":"8f03c7fc45f7af9f777b5bd219762715831d8642","tarball":"https://registry.npmjs.org/@anupjon/crnch/-/crnch-0.2.0.tgz","fileCount":209,"unpackedSize":503332,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIChaywhbGxvmkecvrp6UbzLjOdEBbQlfUPq6luwSbX7aAiEAsXlrcLPcr7rcQvlLmBEvKDj3LWv7fX13kZKQ1JoZXxk="}]},"_npmUser":{"name":"anupjon","email":"aj9666@gmail.com"},"directories":{},"maintainers":[{"name":"anupjon","email":"aj9666@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/crnch_0.2.0_1787589828745_0.6725594964642241"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-24T12:50:38.064Z","modified":"2026-08-24T16:43:49.018Z","0.1.0":"2026-08-24T12:50:38.433Z","0.2.0":"2026-08-24T16:43:48.877Z"},"license":"MIT","keywords":["cli","image","video","optimization","sharp","ffmpeg","webp","avif"],"description":"crnch — crunch your media. A developer CLI for optimizing images and videos.","maintainers":[{"name":"anupjon","email":"aj9666@gmail.com"}],"readme":"# crnch\n\n**crnch — crunch your media.**\n\nA developer-first CLI for optimizing images and videos, built on [Sharp](https://sharp.pixelplumbing.com/) and [FFmpeg](https://ffmpeg.org/). Three ways to use it:\n\n- **Interactive terminal shell** — a persistent, slash-command-driven shell for exploring and running operations.\n- **Guided walkthrough** — a step-by-step wizard for single files or whole folders.\n- **Non-interactive mode** — flags, presets, and config files for scripts and CI/CD.\n\ncrnch is deterministic and local. It does not use an LLM, cloud service, or network access to make decisions — every optimization is driven by explicit configuration, presets, or your answers in the wizard.\n\n```\nInspect → Recommend → Confirm → Optimize → Report\n```\n\n---\n\n## Requirements\n\n- **Node.js** 20 or later.\n- **Sharp** — installed automatically as an npm dependency.\n- **FFmpeg / FFprobe** — required for video features only. Not bundled; install separately and make sure both are on your `PATH`. Image-only usage works fine without them.\n\nRun `crnch doctor` any time to check your environment — Node version, Sharp health, FFmpeg/FFprobe presence, supported codecs (H.264/H.265/AV1), image formats (WebP/AVIF), and available hardware-accelerated encoders.\n\n---\n\n## Install\n\nNot yet published to npm. To use it from a local checkout:\n\n```bash\nnpm install\nnpm run build\nnpm link      # exposes the `crnch` command globally\n```\n\nOr run it directly without installing:\n\n```bash\nnode dist/cli/index.js --help\n```\n\n---\n\n## Quick start\n\n```bash\n# Launch the interactive shell\ncrnch\n\n# Optimize a single image or video (guided wizard on a TTY, direct engine otherwise)\ncrnch optimize hero.jpg\ncrnch optimize hero.mp4\n\n# Optimize a whole folder, non-interactively, with a preset\ncrnch optimize ./assets --preset web --yes\n\n# See what would happen without changing anything\ncrnch optimize hero.jpg --dry-run\n\n# Check environment / dependencies\ncrnch doctor\n```\n\nOptimized output is written to an `optimized/` subdirectory next to the source by default — originals are never modified unless you explicitly ask for that (`--replace-originals`).\n\n---\n\n## Commands\n\n| Command | Description |\n|---|---|\n| `crnch` | Launch the interactive shell (on a TTY) |\n| `crnch optimize <path>` | Optimize an image, video, or folder |\n| `crnch image <path>` | Optimize an image directly |\n| `crnch video <path>` | Optimize a video directly |\n| `crnch inspect <path>` | Show technical metadata without modifying files |\n| `crnch analyze <path>` | Find optimization opportunities and recommend actions |\n| `crnch check <path>` | Validate media against configured size budgets (CI gate) |\n| `crnch watch <directory>` | Watch a directory and apply a policy to new/changed media |\n| `crnch presets` | List available presets |\n| `crnch doctor` | Check environment and dependency health |\n\nInside the interactive shell, the same commands are available as slash-commands (`/optimize`, `/inspect`, `/analyze`, `/check`, `/presets`, `/doctor`, `/history`, `/status`, `/help`, `/clear`, `/exit`). `/watch` is CLI-only — run `crnch watch <dir>` directly in a terminal instead.\n\n---\n\n## Presets\n\n| Preset | Use case |\n|---|---|\n| `web` | Balanced size/quality for general web delivery (default) |\n| `web-mobile` | Smaller dimensions/bitrates for mobile-first delivery |\n| `high-quality` | Minimal visible quality loss |\n| `smallest` | Maximum size reduction |\n| `archive` | Long-term storage — preserves dimensions, metadata, HDR |\n| `keep-format` | Optimizes without converting format |\n\n```bash\ncrnch optimize hero.jpg --preset smallest\ncrnch presets            # list with descriptions\ncrnch presets --json\n```\n\n---\n\n## Common flags\n\n| Flag | Applies to | Description |\n|---|---|---|\n| `--preset <name>` | image/video/folder | Select a named preset |\n| `--config <path>` | any | Use a specific `crnch.config.json` instead of discovering one |\n| `--dry-run` | image/video/folder | Show what would happen; write nothing |\n| `--explain` | image/video | Explain why the current configuration was selected |\n| `--json` | most commands | Machine-readable output on stdout (all logs go to stderr) |\n| `--quiet` / `--verbose` | most commands | Suppress or expand normal output |\n| `--yes` | folder/CI | Bypass confirmation (non-interactive commands never prompt anyway) |\n| `--replace-originals` | image/video | Delete sources after a successful conversion (requires this flag, `--yes` alone is not enough) |\n| `--output <path>` | image/video/folder | Output directory |\n| `--format <list>` | image | Comma-separated output formats: `webp,avif,jpeg,png` |\n| `--quality <1-100>` | image | Encode quality (mapped per format internally) |\n| `--long-side` / `--width` / `--height` | image | Resize strategy (mutually exclusive) |\n| `--responsive` / `--responsive-widths` | image | Generate a set of width variants instead of one output |\n| `--codec <name>` | video | `h264`, `h265`, `av1`, `auto` |\n| `--resolution` / `--max-height` / `--max-width` | video | Resize strategy |\n| `--target-size <size>` | video | Target an approximate output size, e.g. `25MB` |\n| `--hwaccel <name>` | video | `none`, `nvenc`, `qsv`, `vaapi`, `videotoolbox` |\n| `--budget-image <size>` / `--budget-video <size>` | check | Per-file size budgets, e.g. `500KB` / `20MB` |\n\nRun `crnch --help` for the full list.\n\n---\n\n## Configuration file\n\nDrop a `crnch.config.json` anywhere in your project — crnch discovers it by walking up from the current directory, same resolution model as `tsconfig.json`.\n\n```json\n{\n  \"preset\": \"web\",\n  \"images\": {\n    \"longSide\": 1920,\n    \"formats\": [\"webp\", \"avif\"],\n    \"quality\": 80,\n    \"stripMetadata\": true\n  },\n  \"videos\": {\n    \"maxHeight\": 1080,\n    \"codec\": \"h265\",\n    \"audioBitrate\": \"128k\"\n  },\n  \"output\": {\n    \"directory\": \"optimized\",\n    \"skipExisting\": true\n  },\n  \"budgets\": {\n    \"image\": \"500KB\",\n    \"video\": \"20MB\"\n  }\n}\n```\n\nPrecedence (highest wins): **CLI flags > config file > preset > built-in defaults.**\n\n---\n\n## CI usage\n\n```bash\ncrnch optimize ./public --preset web --yes --json > result.json\ncrnch check ./public --budget-image 500KB --budget-video 20MB   # exit code 4 on violation\n```\n\nExit codes: `0` success · `1` processing failure · `2` invalid arguments · `3` missing dependency · `4` budget violation · `130` interrupted.\n\n---\n\n## Development\n\n```bash\nnpm run dev          # run from source via tsx\nnpm run build        # compile to dist/\nnpm run typecheck    # type-check without emitting\nnpm test             # run the test suite (vitest)\n```\n\nTest fixtures are generated programmatically (via Sharp and `ffmpeg -f lavfi`) rather than committed as binary files, so the test suite stays hermetic. FFmpeg-dependent tests skip automatically if FFmpeg isn't installed.\n\n---\n\n## License\n\nMIT\n","readmeFilename":"README.md"}