Skip to main content
Browse documentation

Getting started

Get started with ImageForge CLI

Install, preview, generate, and verify your first image pipeline.

1. Preview safely

ImageForge CLI requires Node.js 20 or newer. Start from a project with at least one supported source such as public/images/hero.jpg, then preview the planned work. Published version 0.1.10 keeps --dry-run filesystem-pure: it does not write derivatives, the manifest, cache state, output directories, or cache locks.

npx @imageforge/cli@0.1.10 ./public/images --dry-run

2. Generate derivatives

Run the same command without --dry-run. This example writes responsive WebP and AVIF derivatives, blur placeholders, a cache, and imageforge.json.

npx @imageforge/cli@0.1.10 ./public/images --formats webp,avif --widths 320,640,960,1280

3. Verify generated state

Published version 0.1.10 exits with code 1 when source, cache, output, or manifest state is stale. Check mode does not write project state. Add the exact same options used to generate your files.

npx @imageforge/cli@0.1.10 ./public/images --formats webp,avif --widths 320,640,960,1280 --check

4. Inspect the expected change

A responsive run produces source-bounded candidates next to the source by default, plus cache state inside the input directory and a manifest at the project root. This tree is illustrative: a source narrower than a requested width produces fewer candidates.

.
├── imageforge.json
└── public/images
    ├── .imageforge-cache.json
    ├── hero.jpg
    ├── hero.w320.avif
    ├── hero.w320.webp
    ├── hero.w640.avif
    └── hero.w640.webp

5. Confirm first success

Open imageforge.json and confirm the hero.jpg entry contains intrinsic dimensions, blurDataURL, outputs, and responsive variants. Then rerun the check command: a zero exit status confirms the published --check / --no-check: source, cache, output, and manifest freshness assertion for CI in version 0.1.10. Check mode does not write project state.

If the check still reports work, confirm the generation and check commands use identical formats, quality, widths, filters, output path, and output directory. Do not edit generated metadata by hand.

echo $? # 0 after a successful --check on macOS/Linux shells

What to commit

For a reviewable generated-assets workflow, commit the source changes and generated state together.

  • Generated WebP/AVIF derivatives
  • imageforge.json
  • .imageforge-cache.json
  • The package-manager lockfile when ImageForge is a project dependency