Port the quak CLI to the new library API #52

Closed
opened 2026-09-22 09:11:13 +02:00 by clawbot · 1 comment
Collaborator

Cache/API implementation (#36), phase 5.
Depends on the backup-rewrite unit (and the read surface).

Goal

Port the quak CLI (bin/quak.ts) to the new library API. Commands, flags,
output, and exit codes stay as they are, plus the new directory options.

Scope

  • collectionslib.albums.list(). files --collectionlib.albums.byID()
    then album.photos.list().
  • get / get-thumblib.photos.byID() then photo.original() /
    photo.thumbnail(), copied to --out (default as today). Removes today's
    scan of every album per call; --collection accepted and ignored.
  • backup <dir>Library.open({ client, downloadDirectory: dir }),
    lib.backup({ onProgress }); typed events formatted into today's log lines;
    --json and exit 1 on failures unchanged.
  • backup-metadata <dir> and the *-missing-thumbnails helpers → enumerate via
    lib.albums/album.photos; the ML fetch, EXIF extraction, and thumbnail
    upload stay where they are; --exif reads photo.original(). Address
    #17 (helper assumes JPEG) while here.
  • login, whoami, logout unchanged.
  • New global option --cache-dir (and honour cacheDirectory/downloadDirectory
    defaults from the design).

Definition of done

  • Every command runs on the new API with unchanged external behaviour and exit
    codes; --cache-dir works; CLI tests updated/added.
  • make check green. Overlaps #17.

Grounding

bin/quak.ts, CLI tests under test/cli/.

Dispatch notes: TDD; no scripted edits; no interactive questions; plain language.
Squash subject ends (closes #<this issue>). End every message with
Model: opus-4-8.

Model: opus-4-8

Cache/API implementation (https://git.eeqj.de/sneak/quak/issues/36), phase 5. Depends on the backup-rewrite unit (and the read surface). ## Goal Port the `quak` CLI (`bin/quak.ts`) to the new library API. Commands, flags, output, and exit codes stay as they are, plus the new directory options. ## Scope - `collections` → `lib.albums.list()`. `files --collection` → `lib.albums.byID()` then `album.photos.list()`. - `get` / `get-thumb` → `lib.photos.byID()` then `photo.original()` / `photo.thumbnail()`, copied to `--out` (default as today). Removes today's scan of every album per call; `--collection` accepted and ignored. - `backup <dir>` → `Library.open({ client, downloadDirectory: dir })`, `lib.backup({ onProgress })`; typed events formatted into today's log lines; `--json` and exit 1 on failures unchanged. - `backup-metadata <dir>` and the `*-missing-thumbnails` helpers → enumerate via `lib.albums`/`album.photos`; the ML fetch, EXIF extraction, and thumbnail upload stay where they are; `--exif` reads `photo.original()`. Address https://git.eeqj.de/sneak/quak/issues/17 (helper assumes JPEG) while here. - `login`, `whoami`, `logout` unchanged. - New global option `--cache-dir` (and honour `cacheDirectory`/`downloadDirectory` defaults from the design). ## Definition of done - Every command runs on the new API with unchanged external behaviour and exit codes; `--cache-dir` works; CLI tests updated/added. - `make check` green. Overlaps https://git.eeqj.de/sneak/quak/issues/17. ## Grounding `bin/quak.ts`, CLI tests under `test/cli/`. Dispatch notes: TDD; no scripted edits; no interactive questions; plain language. Squash subject ends ` (closes #<this issue>)`. End every message with `Model: opus-4-8`. Model: opus-4-8
Author
Collaborator

Opened #74 (branch issue-52-cli-port-redo, base next).

Every command now runs through Library.open: collections/files read lib.albums, get/get-thumb resolve lib.photos.byID() and copy the cached original/thumbnail to --out (so --collection is accepted but ignored). backup-metadata and the thumbnail helpers enumerate through the library and read originals via photo.original(); ML fetch, EXIF, and thumbnail upload are unchanged. Added the global --cache-dir; point commands open with the background precache off so a one-shot command never starts downloading the whole account.

Also addresses #17: fix-missing-thumbnails now reports a non-JPEG image or a video as skipped (unsupported), distinct from failed, and only a genuine failure exits non-zero.

Two judgement calls for the reviewer: reads are cache-first (design #36), so a just-added file can lag one refresh; and the files/collections JSON keeps its old keys while sourcing from the projected records, so creationTime is now milliseconds and collectionID is the requested album id.

make check and make build are green.

Model: opus-4-8

Opened https://git.eeqj.de/sneak/quak/pulls/74 (branch `issue-52-cli-port-redo`, base `next`). Every command now runs through `Library.open`: `collections`/`files` read `lib.albums`, `get`/`get-thumb` resolve `lib.photos.byID()` and copy the cached original/thumbnail to `--out` (so `--collection` is accepted but ignored). `backup-metadata` and the thumbnail helpers enumerate through the library and read originals via `photo.original()`; ML fetch, EXIF, and thumbnail upload are unchanged. Added the global `--cache-dir`; point commands open with the background precache off so a one-shot command never starts downloading the whole account. Also addresses https://git.eeqj.de/sneak/quak/issues/17: `fix-missing-thumbnails` now reports a non-JPEG image or a video as skipped (unsupported), distinct from failed, and only a genuine failure exits non-zero. Two judgement calls for the reviewer: reads are cache-first (design #36), so a just-added file can lag one refresh; and the `files`/`collections` JSON keeps its old keys while sourcing from the projected records, so `creationTime` is now milliseconds and `collectionID` is the requested album id. `make check` and `make build` are green. Model: opus-4-8
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/quak#52