Repository navigation
Compress whole folders with -r - #6
Conversation
slimdeer -r assets takes a folder as the PNGs and JPEGs in it and every folder below it: beside each one as NAME.min.EXT, or with -d into a copy of the folder's layout (slimdeer -r assets -d dist). Hidden files and folders and earlier NAME.min.EXT outputs are left out, so running it on the same folder again doesn't compress them twice; files come in path order, so -v and --json list them the same way every run. A folder without -r says so, and -d can't be the folder -r reads. main.rs had grown to the whole command line; it is split into cli/: the options, the files and their destinations, running a command, the encoders, what it says, and the bench helpers. The site's terminal shows a folder run instead of the JSON report the command line no longer prints by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🔎 Review completed. 5 findings need attention.
ℹ️ About this review
- Risk level: medium. The PR adds recursive folder handling to a local image compressor and splits main.rs into src/cli/ modules, so a missed mistake in the path mapping or the -d refusal logic could write compressed files to the wrong place, but it would only affect the user's own output files and is contained by a revert or a follow-up fix.
- Review depth: Standard
- Trigger source: Automatic (PR opened)
- View in HeyDeer · Config
HeyDeer reviews public repositories for free. Set it up for your open-source project →
- -d is compared with the folders -r reads by their real paths, so ./assets, an absolute path or a link to it is refused like assets; and each output from a tree is checked against its input again before it is written, as every other made-up name is. - A folder that can't be read is reported by its own path, and the images found elsewhere in the tree are still compressed (exit 1). - Linked folders aren't followed: they could lead out of the tree, or back up it and round again. - A -d folder inside the tree isn't read as input, so a second run doesn't compress its outputs into another level. - Two inputs that come to the same output name (x.png in two folders into one -d, or logo.png and logo.jpg as WebP) are reported instead of the second replacing the first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔎 Review completed. 1 finding needs attention.
1 issue in the inline comments.
Earlier concerns to address
-
🟡 Medium (Correctness): Output aliases bypass collision detection View discussion
The new map prevents identical destination paths from being written twice, but its literal keys miss filesystem aliases. Differently capitalized filenames from separate roots still overwrite one output on a case-insensitive volume.
💡 Not planning to address an earlier concern?
Someone with write access can explain why in the original discussion, or resolve it. HeyDeer will reconsider the decision in the next review.
ℹ️ About this review
- Risk level: medium. The follow-up adds folder-link skipping, a collision check for outputs that share a name, and a canonical-path check for -d inside the tree, all in the local image CLI's path mapping and write logic, so a missed mistake could write compressed files to the wrong place, but it would only touch the user's own output files and a revert or follow-up fix would contain it.
- Review depth: Standard
- Trigger source: Automatic (New commits pushed)
- View in HeyDeer · Config
A made-up output name was checked only against its own input, and outputs against each other by path text. So -d above a tree could put one image's output on another input (-r assets/icons -d assets, with icons/b.png and icons/icons/b.png), and on a volume that ignores case dist/X.png and dist/x.png were one file written twice. Inputs and outputs are now known by the file itself (device and inode on Unix, the canonical path elsewhere): an output that would land on any input, or on another input's output, is reported instead. -d and the folders -r reads are compared the same way. This also covers files listed by hand (x.png sub/x.png -d sub). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔎 Review completed. 1 finding needs attention.
ℹ️ About this review
- Risk level: medium. The follow-up swaps the overwrite guards for inode-based file identity and adds an input-versus-output collision check in the local CLI's output path logic, so a missed mistake could overwrite the user's own input images, but it would only affect files the user chose to compress and a follow-up fix or revert would contain it.
- Review depth: Standard
- Trigger source: Automatic (New commits pushed)
- View in HeyDeer · Config
Given one file twice under two spellings (a.png ./a.png -d .), the first was told its output would replace another input, as its name differed from the one recorded for the file. Whether an output lands on its own input is now judged by the file itself. The write was refused either way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔎 Review completed. 1 finding needs attention.
ℹ️ About this review
- Risk level: medium. The follow-up changes the input-collision check in the local CLI's output path logic to compare file identity instead of names, so a missed mistake could still overwrite the user's own input images, but only for files the user explicitly points the tool at and the damage is limited to local files that a follow-up fix or revert would restore.
- Review depth: Standard
- Trigger source: Automatic (New commits pushed)
- View in HeyDeer · Config
Since an input's own file is told apart by its identity, nothing reads the names stored with the inputs; only outputs need theirs, to say whose an output is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ Review completed. No issues found.
ℹ️ About this review
- Review summary: The input-set refactor preserves collision checks and file-alias diagnostics. Input names are no longer stored unnecessarily; output owner names remain available for diagnostics.
- Risk level: medium. The follow-up is a behaviour-preserving refactor of the input-collision guard in the local CLI's output path, where inputs are now a set of file identities instead of a map to names, so a missed mistake could still overwrite the user's own input images, but only for files they explicitly point the tool at and the damage is local and fixable by a follow-up change.
- Review depth: Standard
- Trigger source: Automatic (New commits pushed)
- View in HeyDeer · Config


slimdeer -r assetscompresses every PNG and JPEG in a folder and the folders below it, the way most projects keep their images.What it picks up: PNG and JPEG files by extension (any case). Hidden files and folders (
.git,.cache) and earlierNAME.min.EXToutputs are left out, so running it on the same folder again doesn't compress the outputs a second time.Order: files are taken in path order, so
-vand--jsonlist them the same way on every run.Mistakes it refuses: a folder given without
-ris reported and skipped (exit 1).-dnaming the folder-rreads is refused, since-dkeeps the inputs' names and would write over them.-owith-ris refused, as it names a single output.Code layout:
main.rshad grown to the whole command line (about 470 lines), and folders add more path handling, so it is split intosrc/cli/:args.rs: options and help;files.rs: which files, and where their outputs go;run.rs: running a command;encode.rs: formats and encoders;report.rs:-vand--json;tools.rs: the--scoreand--upscalehelpers.Apart from
-r, nothing changes in behaviour.Site: the terminal on the page showed the JSON report the command line no longer prints by default; it now shows a folder run with
-v.Tests: two new CLI tests cover recursion (nested folders, mixed-case extensions, hidden folders, other files, a rerun) and the mirrored
-dtree with its refusals.cargo fmt --check,cargo clippy --all-targets -D warnings(with and without optional features) andcargo test --releasepass.🤖 Generated with Claude Code