maintain-imgsqueeze-base

How to maintain imgsqueeze, the library that compresses blog images once and records them in sidecars: its scope, compression engines, pngquant and oxipng through mise, presets, the already-done invar

SKILL.md

GitHub

imgsqueeze compresses PNG, JPEG and WebP images in place, once. PNG goes through pngquant and oxipng, which mise installs at pinned versions; JPEG and WebP are re-encoded with Pillow. A result is kept only if it saves at least min_gain. Every processed image gets an <image>.json sidecar holding the hash of its final content, and an image whose sidecar matches is never processed again. runner.optimize expands the inputs, skips done images, and runs core.process for each remaining image in a process pool; core.process compresses a copy, checks the file did not change meanwhile, replaces it atomically, then writes the sidecar.

For template conventions (layout, code style, tests, docs, CI, release), load pywf-oss-base. How to use the library is in the pypi-imgsqueeze skill.

References

Numbered so that each builds only on earlier ones: what the project is for, how an image is compressed, what counts as done, how that is tracked, how files stay safe, and how it all fits.

<!-- BEGIN references index: generated by scripts/update_skill_index.py, do not edit by hand -->
  • Scope (references/01-scope.md): Read before adding a feature or an option, to check that it belongs in imgsqueeze at all.
  • Compression Engines (references/02-compression-engines.md): Read when changing anything in imgsqueeze/engines/, or when a format is compressed badly.
  • External Tools (references/03-external-tools.md): Read when changing imgsqueeze/tools.py, when a PNG fails with exit code 3, or before changing how the binaries are found.
  • Presets and Calibration (references/04-presets-and-calibration.md): Read when changing a preset value, or when a user says images look too compressed or not compressed enough.
  • Already Done (references/05-already-done.md): Read before changing when an image is processed, skipped, or kept as is.
  • Sidecar (references/06-sidecar.md): Read when changing the sidecar format or how an image is matched to its record.
  • File Safety and Concurrency (references/07-file-safety.md): Read when changing how files are found, read, replaced, or processed in parallel.
  • Architecture (references/08-architecture.md): Read when adding a module, a command, a status, or a public name.
  • Tests and CI (references/09-tests-and-ci.md): Read when writing tests for imgsqueeze, or when CI or a test fails.
<!-- END references index -->

Jobs

Job Skill
Upgrade the pinned pngquant or oxipng version maintain-imgsqueeze-bump-tool
Recalibrate or change the preset values maintain-imgsqueeze-calibrate
Anything else Read the references above, then follow the matching pywf-oss-* skill