Automation

Rust CLI for photo rename, dedupe, and resumable backup

Rust CLI that renames photos by EXIF date and location, moves duplicates to a trash folder, and backs up to S3-compatible storage with resumable uploads.

rustclaptokioreqwestblake3s3

Built 1 time, downloaded 0 times.

Install from your terminal

Run this in your project folder. It signs you in, shows what changes and asks before it overwrites a file.

npx claude-lab add rust-cli-for-photo-rename-dedupe-and-resumable-backup-b90f4a
CLAUDE.md
# the app

Rust CLI `the app` with subcommands `rename`, `dedupe`, `backup`. It renames photos by EXIF date and place, removes duplicates safely, and backs up to S3-compatible storage with resumable uploads.

## Commands

- `cargo build`
- `cargo test`
- `cargo clippy --all-targets -- -D warnings`
- `cargo fmt --check`
- `cargo run -- <subcommand> --dry-run`

## Layout

- `src/main.rs`: clap entry point
- `src/exif.rs`: metadata reading
- `src/rename.rs`
- `src/dedupe.rs`
- `src/backup/{mod,provider,state}.rs`
- `tests/fixtures/`: tiny synthetic JPEGs only
- `tests/common/`: fixture generator helper

## Crates

Allowed: clap, tokio, reqwest, kamadak-exif or nom-exif, blake3, walkdir, serde, thiserror, anyhow, indicatif.

Ask before adding any other crate.

## Safety rules

- Every destructive operation (rename, delete) supports `--dry-run` and defaults to dry-run unless `--apply` is passed.
- Dedupe moves duplicates to `.the app-trash/`. It never deletes outright.
- Never overwrite an existing file.

## Behavior notes

- Rename format: `YYYY-MM-DD_HHMMSS_<place>_<shortcounter>.ext`.
- Missing EXIF: fall back to file mtime and flag it in the output.
- Location: offline GPS-to-place lookup first. Network reverse geocoding is opt-in, rate-limited and cached.
- Dedupe: group by size, then hash with blake3. Perceptual dedupe is out of scope for v1.
- Backup: chunked, resumable upload. The state file `.the app-state.json` records uploaded chunks and the content hash.
- The backup must survive `kill -9` and resume cleanly.
- Verify the remote checksum at the end of each upload.

## Credentials

- Read from `PHOTOFLOW_ACCESS_KEY` and `PHOTOFLOW_SECRET_KEY`, or from a config file outside the repo.
- Never commit or log credentials, including in error messages.

## Conventions

- Use thiserror in libraries and anyhow in `main`.
- No `unwrap` outside tests.
- Provide a `--json` flag for scripting.
- Use `PathBuf` for paths and handle non-UTF8 filenames.

## Testing

- Fixtures are tiny generated JPEGs with synthetic EXIF. See the `exif-fixtures` skill.
- Backup tests run against a local mock server. Never use real cloud storage.
- Never run commands against real photos.

## Workflow

- Explore, plan, code, then run the `verify` skill before saying a task is done.
- Use `/clear` between unrelated tasks.

## Imports

@SPEC.md
@REVIEW.md
Use for my project