Skip to content
sejoungPublic

About

Panely is a minimal, fast comic and image viewer built for macOS.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Repository files navigation

Panely

Panely

A minimal, fast comic & image viewer for macOS.
macOS를 위한 미니멀한 만화/이미지 뷰어

English · 한국어

📖 User Manual · 사용 설명서

platform swift license CI Release Latest release Release date Total downloads Sponsor


Downloads and repositories

Choose macOS or Windows on the download page. Each platform has its own repository and releases.

Platform Source code Download
macOS sejoung/Panely Latest macOS release
Windows sejoung/PanelyWindows Latest Windows release

This repository and the instructions below cover macOS. For Windows requirements, installation, and known limitations, see the Windows manual.

Overview

Panely is a distraction-free comic reader that gets out of your way. The UI hides when you don't need it, the sidebar toggles in and out, and the viewer always takes the maximum space available. Dark mode is enforced because reading in bright chrome is fatiguing.

The viewer core is AppKit-backed (NSScrollView + layer-backed image views) so pinch-zoom, scroll, and re-centering stay native and smooth even on large pages.

Features

Reading

  • Single page, double-page spread, and vertical scroll (webtoon) layouts — segmented toolbar control picks the mode directly (no cycle round-trip through vertical); ⌘⇧1 / ⌘⇧2 / ⌘⇧3 for keyboard

  • Standalone-cover spread offset — a double-page-only toolbar toggle that shows page 1 alone, then pairs (2,3) (4,5)… so a lone cover doesn't push every facing spread one page out of alignment. Persisted; off by default. All spread grouping (navigation, the visible span, position restore) routes through one SpreadCalculator, so the pairing stays consistent everywhere

  • Left-to-right or right-to-left reading (manga-friendly). RTL is ignored in vertical mode (webtoons are top-to-bottom) and the direction toggle disables itself there

  • Three fit modes with distinct arrow icons in a segmented toolbar picker (one tap = direct selection) plus ⌘1/⌘2/⌘3 shortcuts:

    • Fit to screen — entire page visible
    • Fit to width — fills viewport width
    • Fit to height — fills viewport height

    The picker is deselectable: once you zoom or pan away from the fit magnification it stops highlighting any mode, and re-tapping the active mode snaps you straight back to fit (acts as "reset to fit")

  • Vertical mode lazy windowing — page dimensions are pre-fetched (header-only on folders) so the strip lays out immediately with gray placeholders, then real images stream in concurrently for the visible range and update in batched SwiftUI passes (no per-image relayout storm)

  • Zoom controls — ⌘+ / ⌘- / ⌘0 (reset to fit) plus toolbar buttons; ⌘ + scroll wheel zooms centered at the cursor (continuous, ~1% per scroll unit). Trackpad pinch and double-click 1× ↔ 2× still work

  • View-size lock (⌘L) — opt-in toggle that pins the current magnification across window/sidebar resizes and layout flips. Force resets (new book, explicit ⌘1/⌘2/⌘3) still apply

  • Auto-refit on viewport resize (when unlocked) — when the window or sidebar size changes, the image snaps to the new fit. Manual zoom is preserved by default

  • Zoom carries within a series — manual zoom is kept as you move between sibling volumes, and each series remembers its zoom for the session (cleared on quit). Jumping to a different series snaps the new book to its own fit; returning later restores that series' zoom

  • Auto-centering — image stays centered when the viewport is larger

  • Preload ±2 pages (±2 spreads in double-page) in paged modes so the next flip is instant

  • Series continuous reading — when the last page of a volume is reached and a next sibling exists, an "Up next" card surfaces over the bottom of the viewer with the next volume's filename and a one-click start. A symmetric "Previous" card appears at the top after an explicit backward press at page 0 — opening Vol N at page 0 stays quiet until the user signals intent to go further back. Forward / backward keys also advance volumes when the matching card is showing

  • Progress overlay — stage-aware messages (Opening / Extracting / Loading / Building vertical strip) while big sources are processed, all on background threads

  • Reload and source-change notice — ⌘R reloads the current book. If the source changes on disk, Panely shows a small banner with Reload / Dismiss actions instead of moving the reader unexpectedly. The watcher covers archives (the file itself) and open folders — the directory plus every page image in it — so adding, removing, or editing pages in a folder you're reading surfaces the same prompt

  • Image error placeholders — an unreadable page stays visible as a labeled error tile, so one bad image doesn't collapse the spread/strip

  • Scroll-wheel page turning — in single / double layouts a plain scroll-wheel or trackpad scroll turns the page once the page can't pan any further (down = next, up = previous; one page per trackpad swipe). It follows reading direction and the volume cards exactly like the arrow keys. On by default and persisted; toggle via View → Disable / Enable Scroll Page Turning

File support

  • Open folder, CBZ/ZIP, or CBR/RAR (RAR 4 and RAR 5, including solid archives). The container is detected from the file's contents, so a ZIP renamed to .cbr (or a RAR renamed to .cbz) still opens
  • Series-root auto-detection — pick a folder of volumes and the first one opens
  • Nested archive extraction (up to 3 levels deep, recursive, with a 5 GB cumulative-size safety cap — guards against zip-bombs)
  • Persistent zip-in-zip cache — extracted nested archives are content- addressed (SHA256 of path + size + mtime) and stored under ~/Library/Caches/panely-extraction-cache/ with a 10 GB LRU budget, so reopening the same archive is instant on subsequent launches. Source edits bump mtime → new key → automatic re-extraction. Cache size and manual cleanup live in File → Settings… (or Panely → Settings…) and File → Clear Extraction Cache.
  • Diagnostic report export — File → Export Diagnostic Report… writes a zip with app/build and macOS versions, recent Panely logs, redacted open/load events, cache size, current settings, and the last reader error for bug reports. The same action is also available in Settings → Diagnostics. Diagnostics also exposes the current file-log size, log level, a logs-folder shortcut (also File → Open Diagnostic Logs Folder), and File → Clear Diagnostic Logs for clearing the bounded recent-log.txt file.
  • Natural filename sort (1, 2, 10 — not 1, 10, 2) — applied consistently across loaders / scanners via the NaturalSort helper
  • Filters non-image files and hidden entries

Navigation

  • Keyboard-first — ← → Space for pages, [ ] (or ⌘[ ⌘]) for volumes, ⌘1 ⌘2 ⌘3 for fit modes, ⌘+ ⌘- ⌘0 for zoom, ⌃⌘S to pin the sidebar, ⌃⌘T to pin the toolbar, ⌘L to lock view size, ⌘O to open, and ⌘R to reload
  • Pinned library sidebar by default — the folder tree stays visible on a fresh install. Unpin with ⌃⌘S (or the pin button) to switch to auto-hide: hover the left edge (200 ms) and the sidebar slides in as an overlay (with drop shadow, no page shift). Mouse-out auto-dismisses after 300 ms; ESC dismisses immediately
  • Auto-hide toolbar + slider — float in only when the cursor is near the top or bottom of the viewer. ⌃⌘T (or the pin button) keeps both visible
  • Sidebar / toolbar pin — both follow the same pin ↔ pin.fill toggle pattern. Pin state persists across launches
  • Sidebar tree — folders and archives are visually disambiguated: folder vs doc.zipper icons, plus a faint .cbz / .zip / .cbr / .rar suffix on archives for quick reading
  • Reveal-active in the tree — opening a book auto-expands its ancestor folders so the current volume is always visible in the sidebar, and the expansion follows along as you move between volumes
  • File tree refresh — the sidebar re-scans on its own when files under the library folder are added, removed, or renamed (FSEvents, debounced 1.5 s so a busy or cloud-synced root settles before one re-scan), and a refresh button in the sidebar header re-scans on demand. Either way the refresh is diffed in place, so the tree never blanks or collapses and expanded folders stay open
  • Reading progress — each tracked book shows a sidebar badge: a progress ring while in progress, a check once finished, computed from a persisted {page, total, finished} record (separate from the exact-restore position store). A Continue Reading row at the top jumps straight back into the most recently read in-progress book. Progress accrues from the moment a book is opened, so it fills in as you read — books last opened before this shipped show a generic "reading" mark until reopened
  • Vertical-mode page navigation — ← → Space scroll to the previous / next image in the strip (working from the page currently centered in the viewport, not the last one keyboard-navigated)
  • Volume navigation between sibling books in the same folder
  • Recent items — File → Open Recent lists the last 10 opened sources (with Clear Menu), persistent across launches via security-scoped bookmarks, shown with the same icon scheme
  • Reopens last library on launch — the folder you were browsing is restored automatically (security-scoped bookmark), so a cold start lands in your library instead of an empty sidebar. Launching with a file (Open With) takes precedence and skips the restore. Settings → Library has a Reopen last folder on launch toggle (on by default), the remembered path, and a one-shot Forget Now to drop the saved folder
  • Folder access grant — when a single file is opened and siblings aren't visible, the sidebar offers a one-click prompt to pick the enclosing folder. Asking for the next/previous book in that state ([ / ], the toolbar, the Go menu) raises the same prompt instead of doing nothing, and the grant is remembered: later, a book opened on its own from inside a folder you've already granted opens under that folder, so its neighbours are reachable without asking again
  • Page bookmarks across books — the sidebar lists the open book's bookmarks (with page thumbnails, a per-row remove button, and a clear-all) plus the bookmarks left in every other book; picking one of those opens that book on the bookmarked page. The same list is one click away in the toolbar's bookmark menu and under Go → Bookmarks
  • Favorites — star a book with ⌘⇧D (or the toolbar star, or Go → Add to Favorites) and it's listed in the sidebar's Favorites section for one-click reopening; remove it from the row's context menu
  • Thumbnail sidebar — ⌃⌘P (or the toolbar button) opens a right-side strip of lazily loaded page thumbnails; click one to jump to that page. Hidden by default; visibility persists
  • Go to page — ⌘G opens a page-number prompt, or click the page counter above the bottom slider and type a number (Enter jumps, Esc cancels)
  • Instant toolbar hints — hovering a toolbar icon shows its name and shortcut immediately, rather than after the system tooltip delay
  • Toolbar that fits the window — when the row is wider than the window (small window, or the library pinned), the fit/zoom and then the layout controls fold into menus instead of clipping the buttons at either end
  • Korean UI — menus, toolbar hints, sidebar, settings, and messages follow the Mac's primary language, falling back to English when it's neither English nor Korean. Settings → General → Language overrides it (System Default / English / 한국어) and switches the UI on the spot, including the standard macOS menus (Edit, Window, Quit…). No restart is needed
  • Window controls — with the title bar hidden, the top 28 px strip still supports native drag-to-move and double-click-to-zoom (respecting the system's AppleActionOnDoubleClick preference); an open-hand cursor makes the draggable region obvious

Translation assist (experimental, macOS 26+)

A comprehension aid for comics in a language you don't read: Panely reads the text in speech balloons on-device and shows a machine translation over the page. Off by default — turn it on in Settings → Experimental. It helps you follow the story; it doesn't replace a real translation, and the original is always one click (or ⇧⌘T) away. Nothing leaves the Mac and nothing is written into your files.

  • On-device — manga-ocr int8 for Japanese (including vertical text), PP-OCRv5 mobile for Chinese, English and Korean, and Google's Gemma 4 E2B run in the app with llama.cpp on the GPU. The models (~3.51 GB together, including ~160 MB of OCR) are downloaded once, with a progress bar, from the translation panel, the status banner or Settings → Experimental, and checked against a pinned SHA-256 before it's used
  • One model, in context — every language pair, no modes. A page's balloons go to the model together (up to 16 at a time) with the last few lines already translated, so names, who's speaking and each speaker's speech level carry over: casual lines stay casual, polite ones polite. About 0.25 s a balloon on an M1 Pro, each balloon shown as soon as its line is written; opening the translation panel prepares the installed model ahead of use, and it is released after ten idle minutes
  • One place per job — the toolbar's translate button switches original ↔ translation (⇧⌘T); the language name beside it ("Korean ▾") is a menu to switch or add languages and open the panel or edit mode. The translation panel is only about translating this book: one big button (download the model / translate / pause / resume) with a single status line, the View list (the original or the book's languages; other languages start and stop from their ⋯ menu), and a collapsed This Book & Series (the book's language, auto-translate, translate the whole series). Progress is the pill over the page, everything in the background Window → Jobs (⌥⌘J), app-wide choices ⚙︎ → Settings. The language shown and the book's own language (detected on first use) are remembered per series
  • No page left behind — a page that fails is tried once more after the rest; if it still fails, Panely says how many are missing, and translating again does just those. While a series' language is unknown, Book's Language sits at the top of the panel so you can choose it instead of waiting for detection
  • Several languages per book — each language is a separate job and cache; clicking a balloon shows its translation, the other languages and the original side by side (selectable, so Look Up works)
  • Improve with an AI chat — save the book (or chosen pages) as a text file (each balloon's id, original and translation), attach it in ChatGPT, Claude or any chat with the prompt shown to copy, and open the reply file: changed translations become your edits, undoable in one go, and balloons the chat left out are named. No API key, and nothing leaves the Mac unless you give it to a chat
  • Translate again — a page (right-click, language menu or edit bar) or the whole book (panel) is read and translated again the current way, so pages done before an improvement get it without clearing the cache
  • Missed text — text boxes the detector found but OCR left empty get a second, enlarged read automatically; anything still missed can be added in edit mode by dragging a box over it (read enlarged and translated, or typed with Fix Original when it can't be read); see the step-by-step drag-to-translate guide
  • Fix it where you see it — a balloon's popover (click) or the page's right-click menu corrects a balloon, hides it, translates the page again or starts adding a balloon, no mode needed
  • Reading / edit mode — reading shows nothing but the translation. In edit mode (⇧⌘E, the panel, the language menu, the right-click menu) the popover rewrites a translation, fixes the recognised original and translates it again, hides a balloon OCR made up out of artwork (with an undo right after), or Reverts one balloon. While editing, edited balloons carry a pencil, hidden ones show as dashed outlines (click to bring back), and a bar over the page counts edits, lists hidden balloons by page and reverts the whole book. Edits are kept apart from the cache under Application Support, so clearing the cache or translating again keeps them; Settings → Experimental deletes them
  • Background jobs — translating continues when you open another book; a pill over the page shows other books' progress and opens Window → Jobs (⌥⌘J: pause / resume / stop / open the book, exports, exported books). One translation runs at a time, the one on screen first
  • Export a translated copy — saves a book with its translation painted into the pages (your edits in, hidden balloons out) as a CBZ, a ZIP or a folder of images, without touching the original. From the language menu, File → Export Translated Book…, the panel (whole series) or the library's context menu (a book, or a folder of volumes — no need to open it). Runs in the background: untranslated pages are translated first (or exported as they are), then the pages are written; the jobs window follows it, keeps the finished books across launches and offers Show in Finder / Open
  • Translate entire series — queues the other volumes whose titles match once volume numbering is stripped (unrelated books in the same folder are left out); the panel names what it will queue before it starts
  • Webtoon-aware — in vertical scroll the pages are read as one strip, so a balloon cut across image slices comes back whole; tall strips are read in overlapping bands
  • Visible progress — balloons appear as soon as OCR finds them and fill in one by one (pending ones pulse); a progress pill with a time estimate, a first-run notice while models load, and page badges in the thumbnail sidebar
  • Balloons found by a detector — a model trained on comics (bundled, run on the GPU, ~0.1 s a page alongside OCR) tells which OCR lines share a balloon: columns of one balloon are joined in reading order and neighbouring balloons stay apart. Text it misses is still translated, grouped the old way. A translation also gets the room inside its balloon instead of only the original's lines — when that room is empty, so a line OCR missed is never painted over. Without the detector (or where it finds nothing) the layout rules group the text as before
  • Sound effects (スッ, パチパチ…) are left untranslated — OCR reads few of the drawn ones, and only as fragments (11 on 48 pages measured)
  • Limits are shown where they apply — a book inside an archive pauses instead of continuing in the background; quitting stops translating (finished pages are kept); a background failure stays listed until dismissed
  • Results are cached per page and language under ~/Library/Caches/panely-translation-cache/; size and clearing live in Settings → Experimental

State persistence

  • Resume where you left off — per-book page memory with a stable key that survives temp-directory extractions. A secondary key derived from the volume + file resource identifier recovers the saved position even when an external drive's mount path changes
  • Per-series reading settings — layout, reading direction, and fit mode are remembered per series (a volume's folder, or the archive itself for zip-in-zip), so a manga series stays RTL while a webtoon series stays vertical. Changing one writes through to both that series and the global default used for series you open for the first time. Sidebar pin, toolbar pin, and the auto-fit lock stay global (the legacy panely.sidebarVisible key auto-migrates to the new pin flag)
  • Bookmark / favorite safety — page-bookmark cap (500 per book) + total-entry cap (200 books) keeps the store comfortably under the UserDefaults ~4 MB practical limit, preventing wholesale loss on decode failure. Stale security-scoped bookmarks are regenerated on the fly so moving a favorited file doesn't break it
  • Entirely sandbox-compliant (user-selected files + app-scoped bookmarks)

Requirements

  • macOS 14 (Sonoma) or later
  • macOS 26 or later for the experimental translation assist
  • Xcode 26.4 or later (for building from source)
  • For the translation assist, an Apple Silicon Mac is recommended: the model runs on the GPU and uses about 3.5 GB of memory while translating

Installing a release

Grab the latest Panely-x.y.z.zip from the Releases page and unzip it.

Panely is open source but not notarized by Apple (no paid Developer ID), so Gatekeeper warns on first launch — "Panely can't be opened because Apple cannot check it for malicious software." It's safe to open; you just have to tell macOS to allow it once:

  1. Drag Panely.app into your /Applications folder.
  2. Right-click (or Control-click) Panely.app and choose Open. Unlike a double-click, this dialog has an Open button that launches it.
  3. If macOS still blocks it, open System Settings → Privacy & Security, scroll to the Security section, and click Open Anyway next to the Panely notice.

Prefer the terminal? Remove the quarantine flag after moving Panely to /Applications:

xattr -dr com.apple.quarantine /Applications/Panely.app

Building from source

git clone https://github.com/sejoung/Panely.git
cd Panely
open Panely.xcodeproj

Select the Panely scheme and press ⌘R.

To build the Release configuration and install it for hands-on testing:

scripts/install-local.sh            # Release → /Applications/Panely.app, then launch
scripts/install-local.sh --debug    # Debug build with its own settings → "Panely Debug.app"
scripts/install-local.sh --help     # also --test, --dest DIR, --no-open, --reveal

A local Release build shares settings and caches with an official install and replaces /Applications/Panely.app; use --debug to keep them apart.

Dependency

Panely uses Swift Package Manager:

  • ONNX Runtime (MIT), pinned to 1.24.2 — runs manga-ocr and PP-OCRv5 in process.

  • ZIPFoundation — CBZ/ZIP archive reading & extraction

  • swift-log — logging facade behind AppLog (OSLog + the bounded diagnostic log file)

  • UnrarKit — CBR/RAR archive reading & extraction. Vendored as a local package in Packages/UnrarKit (upstream ships no SwiftPM manifest) and built against RARLAB's current UnRAR source; see Packages/UnrarKit/README.md for versions and local patches

  • llama.cpp (MIT) — runs the translation model in the app, on the GPU (Metal). Its own prebuilt XCFramework, pinned to one release by URL and checksum in Packages/LlamaCpp/Package.swift

Bundled model (translation assist):

  • comic-text-and-bubble-detector by ogkalu (Apache-2.0) — an RT-DETR-v2 detector for speech balloons and text, trained on manga, webtoons and western comics. Converted to Core ML as Panely/Resources/ComicTextDetector.mlpackage (8-bit, ~42 MB) by scripts/convert-text-detector.py; the script's header explains the workarounds and how its boxes were checked against the original

Downloaded models (translation assist, once, from the translation panel or Settings — not part of the app):

  • manga-ocr int8 (~117 MB) and PP-OCRv5 mobile (~43 MB), Apache-2.0 — pinned revisions, sizes and SHA-256 in ComicOCRModels. See OCR implementation and verification.
  • Gemma 4 E2B by Google (Apache-2.0) — instruction-tuned, QAT 4-bit GGUF, 3.35 GB. Pinned to one revision, size and SHA-256 in TranslationModel (the same file the Windows version uses) and checked before it's installed

Xcode resolves them automatically on first build.

Finder integration

Panely registers itself as a handler for folders, .cbz, .zip, .cbr, and .rar so you can open them straight from Finder.

  • Files (.cbz, .zip, .cbr, .rar) — right-click → Open With → Panely
  • Folders — macOS does not surface "Open With" for folders, so drag the folder onto the Panely.app icon (or its Dock icon), or use File → Open With → Panely from the menu bar

Troubleshooting

If Panely doesn't appear in the right-click menu, or you see several versions listed:

# 1) Find every Panely.app the system knows about
mdfind "kMDItemCFBundleIdentifier == 'io.github.sejoung.Panely'"

# 2) Move stale copies to the trash and empty it
#    (DerivedData/Debug builds can stay — they re-register on next build)

# 3) Rebuild the LaunchServices database and restart Finder
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
killall -KILL Finder

Keeping a Release build in /Applications is the most stable setup — LaunchServices typically deprioritizes Debug builds in DerivedData. Double-clicking a downloaded zip can leave a stray copy in Archive Utility's temp folder that lingers in the LaunchServices cache, so prefer right-click → "Open With → Archive Utility" (or unzip in Terminal) and move the result straight to /Applications.

Shortcuts & Gestures

Input Action
⌘O Open folder / CBZ / ZIP / CBR / RAR
⌘R Reload current book
← / → Previous / next page (direction-aware; advances to the next/previous volume when the matching end-of-volume card is showing)
Space Next page (advances to the next volume when the end-of-volume card is showing)
[ / ] (or ⌘[ / ⌘]) Previous / next volume — the next book or archive in the same folder
⌘G Go to page… (modal prompt)
⌘D Add / remove page bookmark
⌘⇧D Add / remove current book from favorites
⌘⇧[ / ⌘⇧] Previous / next page bookmark within the current book
⌘⇧1 / ⌘⇧2 / ⌘⇧3 Single page / double page / vertical scroll layout
⌘1 / ⌘2 / ⌘3 Fit to screen / fit to width / fit to height
⌘+ / ⌘- Zoom in / out (one step, viewport-centered)
⌘0 Reset zoom to current fit mode
⌘ + scroll wheel Continuous zoom centered at cursor
⌘L Lock / unlock view size (preserves zoom across resizes & layout flips)
⌃⌘S Pin / unpin library sidebar
⌃⌘T Pin / unpin toolbar (and bottom slider)
⌃⌘P Show / hide thumbnail sidebar
⇧⌘T Translation assist: switch between the original and the translation
⌥⌘T Translation assist: translate this book / pause
⇧⌘E Translation assist: balloon edit mode on / off
⌥⌘J Jobs window: background translations and exports, exported books
Click a speech balloon Translation assist: the translation, other languages and the original (in edit mode: edit, fix the original, hide, revert)
Hover left edge Reveal sidebar as overlay (auto-hide mode)
ESC Dismiss sidebar overlay (when unpinned); leaves balloon edit mode first if it's on
Double-click on image Toggle 1× ↔ 2× zoom
Scroll wheel / trackpad scroll Paged layouts: turn the page once it can't pan further (down = next, up = previous; one page per trackpad swipe). Toggle via View → Disable Scroll Page Turning
Trackpad pinch Zoom in / out
Drag top 28 px strip Move window
Double-click top 28 px strip Zoom / minimize window (per system preference)

Testing

scripts/test.sh          # fast tier (= plain `xcodebuild test`, what CI runs)
scripts/test.sh --only TranslationControllerTests --repeat 5
scripts/test.sh --skip-build --only DebouncerTests
scripts/check-release.sh # optimized universal Release build + architecture/signature checks
scripts/test-slow.sh     # + slow tier: real FSEvents, real Vision OCR, every random seed
scripts/test-visual.sh   # screenshot comparisons against PanelyTests/Snapshots/Reference/
scripts/test-model.sh [--model PATH]             # the real translation model (Gemma via llama.cpp)
scripts/test-ocr.sh SWIFT_OPTIMIZATION_LEVEL=-O   # real OCR; downloads the pinned OCR test pack once
scripts/benchmark-translation.sh [--book PATH]   # time each translation stage and whole jobs

Local runs, CI and the tier wrappers all use scripts/test.sh. Debug is the default. --repeat builds on the first run, starts a separate test process for each repetition, and stops on failure. Full logs, exact commands and .xcresult bundles are saved per run under build/test-results/<timestamp-PID>/; override the paths with --results-dir and --derived-data. Repeat --only to select several suites; legacy -only-testing:... arguments still work. See scripts/test.sh --help. CI archives the same runner's results.

CI also runs scripts/check-release.sh to build the optimized app for both arm64 and x86_64, the same check used by the release workflow. Build logs, the toolchain version, command and .xcresult are saved under build/release-checks/ and retained by CI, including failed release builds.

The tiers are set in PanelyTests/TestTiers.swift; the slow and visual tiers are opt-in through PANELY_SLOW_TESTS=1 / PANELY_VISUAL_TESTS=1 (the benchmark, PanelyTests/Benchmarks/TranslationBenchmarkTests.swift, through its own PANELY_BENCHMARK=1; the real model's tests, GemmaTranslatorIntegrationTests, through PANELY_MODEL_TESTS=1 and only with the model downloaded — --model hard-links a GGUF you already have into the Debug app's sandbox), which the scripts pass as TEST_RUNNER_… so xcodebuild hands them to the test process. The fast tier takes about 6–8 s of test time; the visual tier about 10 s; the slow tier adds about 3 s on top of the fast one (its FSEvents tests mostly wait).

Every test's temp files live under one tmp/paneltest-run-* directory per run (Fixture.runDirectory), each in its own parent so a folder a test opens has no siblings to list as volumes; a run deletes what runs over an hour old left behind. (Leftovers used to accumulate straight in tmp — 55k entries — and made every folder-opening test slower than the last.)

SnapshotGalleryTests is discovered in normal runs but gated off unless scripts/generate-snapshots.sh enables snapshot generation, so the default xcodebuild test path does not render or copy manual PNGs.

Manual screenshot utility

Regenerate manual images with scripts/generate-snapshots.sh. Requires macOS, Xcode and Python 3; the driver uses only Python's standard library.

scripts/generate-snapshots.sh --list                         # capture ids and PNGs
scripts/generate-snapshots.sh --only balloon-add             # drag selection + translated result
scripts/generate-snapshots.sh --only 25,27                    # select by image number
scripts/generate-snapshots.sh --only translation-panel --output build/manual-preview
scripts/generate-snapshots.sh --only balloon-add --dry-run   # print the command only
scripts/generate-snapshots.sh                                # regenerate all 27 images

The default destination is docs/screenshots/. --only accepts capture ids, test names, PNG filenames or two-digit numbers, separated by commas or passed in repeated options. A scenario producing multiple images always generates them together (selecting either 25 or 26 produces both). Unselected images stay untouched. Use --output to preview elsewhere; --derived-data or PANELY_DERIVED_DATA_PATH sets the build cache location.

The utility renders actual UI in off-screen windows with sample data; it needs no screen recording permission, real books or downloaded translation packs. Sample translations are seeded: these captures illustrate the interface rather than measure OCR or translation quality. Each run has its own staging directory. All selected PNGs must exist and pass PNG structure/checksum validation before copying starts. Successful staging images are removed; failures report the full Xcode log and staging location so old images cannot pass as a fresh capture.

To add a capture:

  1. Add an @Test func scenario in PanelyTests/Snapshots/SnapshotGalleryTests.swift, using the shared SnapshotRenderer.render(_:size:named:) to save the screen.
  2. For interactions or model changes, use SnapshotRenderer.host(_:size:) and defer { hosted.close() }. Interact with hosted.drag(in:from:to:release:) or hosted.sendMouse(_:in:at:), then save with hosted.capture(named:). Coordinates belong to the target view; release: false leaves a drag selection visible. Wait for asynchronous state with the existing hosted.settle helper before capturing.
  3. Register a unique id, the method name as test (without parentheses), and every output filename in files in scripts/manual-snapshots.json. There is no separate output list to update in the launcher.
  4. Preview with --only new-id --output build/manual-preview, inspect the images, then generate into the default directory and link them in both manuals.

Check selection, failure handling and catalog consistency with:

PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/tests -p 'test_*.py'

Rendering checks

Several suites guard what actually reaches the screen, not just the models:

  • LibrarySidebarRenderingTests renders the real sidebar off-screen over a fixture library and checks the NSOutlineView AppKit built — rows, levels, which folders expand. A tree that scans fine but draws flat fails.
  • Update rendering tests (LibrarySidebarUpdateRenderingTests, ReaderToolbarRenderingTests, TranslationEditBarRenderingTests, ThumbnailSidebarRenderingTests, GoMenuRenderingTests) host real views, change the view model (turn pages, open another book, record progress, a translation arriving) and check the hosted views follow. Helpers in PanelyTests/Snapshots/HostedViewInspection.swift.
  • ReaderViewerRenderingTests checks where the real viewer places each page (single, double, right-to-left, cover alone, vertical strip), and TranslationOverlayDrawingTests reads back what the translation overlay draws, including that partial hover redraws match a full redraw.
  • VisualRegressionTests (opt-in: scripts/test-visual.sh) renders a set of screens and compares each with a reference PNG in PanelyTests/Snapshots/Reference/ (SnapshotComparator: more than 0.1% of pixels off by over 6 levels fails — the dark chrome needs that sensitivity; font-smoothing noise is ~0.01%). On a failure the rendered image and a red-on-gray diff land in the Debug sandbox's Caches/panely-visual-diffs/. References are tied to the macOS major version they were recorded on and the suite skips on any other. After an intended UI change, re-record with scripts/update-reference-snapshots.sh and review the PNGs before committing.

The suites cover:

  • Pure data types (ComicPage, ComicSource, RecentItem, enum raw values)
  • Natural-sort contract (Foundation behaviour Panely relies on)
  • Position-key stability across temp-dir extractions (zip-in-zip scenarios)
  • FolderLoader integration with real temp directories
  • FileNode.loadTree scanning, sorting, empty/unreadable cases, and the fileExtension exposure used for sidebar badges
  • ArchiveLoader integration with programmatically-built zip fixtures and checked-in RAR fixtures (PanelyTests/Fixtures/Archives), including recursive nested-archive extraction
  • ImageLoader.dimensions — header-only size reads for both file URLs and archive entries
  • FitCalculator pure math across aspect ratios and zero-inputs (including fit-height parity with fit-screen on portrait sources)
  • NSScrollView magnification stability on repeated fit-mode toggles
  • Viewer resize auto-fit — magnification follows the viewport when unzoomed, preserves manual zoom on resize, lock (⌘L) preserves on doc-size change, force still resets, releases observer on deinit
  • CenteringClipView — document centering when smaller than the viewport
  • SidebarMode / sidebar preference — pure value-type covering pinned / overlay state transitions (default value unpinned, pin idempotency, overlay no-op while pinned, unpin clears any lingering overlay) plus ReaderPreferences default-pinned behavior and persistence
  • PageLayout cycle — single → double → vertical → single ordering, per-mode navigationStep, isContinuous flag for vertical
  • ReaderViewModel paged-mode behavior — visiblePages slicing, setCurrentPageFromScroll no-op outside vertical, toggleDirection works in paged
  • ReaderViewModel vertical-mode behavior — visiblePages returns full strip, setCurrentPageFromScroll updates index, effectiveDirection is always LTR, paged → vertical transition shows loading indicator immediately, applyFit uses first-image reference for fit calculations
  • ImageStackView vertical layout — pageIndex(forViewportY:), pageIndexRange(visibleIn:), incremental setImages swap (count + axis match → no view rebuild) vs full rebuild on axis change
  • ViewerController — zoom in / out / reset against NSScrollView with min/max clamping
  • ScrollZoomCalculator — multiplicative zoom factor math from scroll-wheel delta with min/max clamp
  • Toolbar pin state — default unpinned, toggle flips persisted flag
  • Thumbnail sidebar toggle — default hidden, toggleThumbnailSidebar flips persisted flag
  • Quick-jump math — currentPageNumber / currentPageRangeEndNumber in single + double layouts, jump(toPageNumber:) clamps out-of-range inputs and snaps to navigation step in double mode
  • PageBookmarksStore — toggle add/remove, keys isolated, sort by page index, next/previous navigation, remove-by-id, persistence round-trip through injected KeyValueStoring
  • FavoritesStore — toggle add/remove against a real temp file, security-scoped bookmark resolves back to the original URL
  • ReaderPreferences — KeyValueStoring round-trip for every persisted setting (layout / direction / fit / sidebar pin / etc.), invalid raw values fall back to defaults, legacy panely.sidebarVisible migrates to the new pin flag
  • ReaderPositionStore — empty-store zero return, lazy cache hydration, 300 ms debounce coalesces rapid savePosition calls, primary key beats file-identity fallback, mirrored writes under both keys
  • ReaderLibraryScope — contains() accepts at-or-below paths and rejects sibling-prefix collisions, acquire/release lifecycle (including prev-URL released even when new acquire fails on a non-Powerbox URL)
  • ReaderTempDirectory / ExtractionCacheStore — session adopt/cleanup against real temp dirs, contains() boundary correctness, session-candidate uniqueness, cleanupStaleEntries() mtime gating (stale removed, fresh kept, non-panely entries ignored), and the extraction cache: stable cacheKey per file (mtime-sensitive), cachedEntry hit/miss + mtime touch on hit, enforceBudget() LRU eviction when over 10 GB, cacheSizeBytes(in:excluding:) / clearCache(in:excluding:) manual cleanup, and cleanup() preserves cache dirs while removing session dirs
  • ReaderImageLoader — reset / prepareForLayoutRebuild / cancelPreload state transitions, estimatedBitmapCost uses pixel dimensions for Retina backing and falls back to size for placeholders, the RAM-scaled cost limit clamps to [150 MB, 1 GB], lazyConcurrencyLimit clamps to [2, 8]
  • AppKitScrollerCoordinator — bounds observer fires page-index + range callbacks in continuous layout but no-ops in paged, programmatic scroll suppresses the page callback (lazy-load still proceeds), same-page notifications dedupe, re-attaching either observer doesn't double-fire
  • FavoriteBook / PageBookmark Codable — round-trip fidelity plus forward-compat decode for legacy FavoriteBook JSON without isDirectory
  • ReaderViewModel bookmark guards — toggle*, canGo*Bookmark, currentPositionKey behave as no-ops / false / nil when no source is loaded
  • ThumbnailLoader — nil for unreachable URLs, non-nil for a real PNG, same ComicPage.id returns the cached NSImage via ===, distinct pages get distinct cache entries
  • ImageLoader.load — eager-decode pipeline (CGImageSource + kCGImageSourceShouldCacheImmediately), throws on non-image / missing files, returned NSImage's cgImage(...) resolves without an extra decode pass
  • End-of-volume / previous-volume cards — visibility predicates, filename labels, advanceForward() / goBackward() dispatch, and the asymmetric prev-card trigger (cue stays armed only after explicit user intent). Includes the symmetry test that the prev card is hidden on a fresh open at page 0
  • Position memory in-memory mirror — first restore hydrates the cache from the injected key-value store, subsequent saves and reads hit the in-memory dict; mirror correctly carries multiple books and reflects the latest write without a re-read
  • TitleBarPassthrough — system double-click preference mapping (zoom / minimize / none) through the injected settings reader
  • PanelyAppDelegate — applicationShouldTerminateAfterLastWindowClosed returns true so the red close button quits the app
  • SpreadCalculator — spread grouping with and without the standalone-cover offset (spread start/end, stepping, last reachable spread)
  • WheelPageTurnEngine — scroll-wheel page-turn state machine: pan vs. turn at the edges, one turn per trackpad swipe, momentum and mouse-wheel cooldown handling
  • Zoom carry-over / per-series settings — ReaderSeriesIdentity resolution (folder vs. zip-in-zip), ReaderSeriesPreferencesStore persistence and cap, and series-scoped zoom / layout / direction / fit restore in ReaderViewModel
  • Reading progress & library — ReadingProgressStore (debounce, recency cap, badges, Continue Reading), LastLibraryRootStore, LibrarySidebarModel (reveal-active expansion), and SecurityScopedBookmark stale-refresh
  • Source change & diagnostics — SourceChangeMonitor file/folder watching, AppLog / DiagnosticLogStore file logging, and DiagnosticReportExporter zip contents
  • Translation assist — OCR tiling and seam handling, balloon grouping, sound-effect and language classification, page / strip work planning, the job manager (one job per book × language, background jobs, reattach, queueing, books that must stay open), cache keys and storage, overlay geometry and hit testing, series volume matching, balloon detection and missed-text rereads, the Gemma prompt and reading its answer, batched jobs with context, the model's download and checks, balloon edits, AI chat round trips, translated-book export, and the reader wiring (per-series languages, original ↔ translation, overlays following the images on screen)
  • Localization — AppLocalization (System Default → the Mac's primary language, English fallback), AppMenuLocalizer's standard-menu titles, and KoreanLocalizationTests resolving catalog keys through the built ko.lproj
  • Library watching & stored data — LibraryDirectoryWatcher / LibraryChangeFilter (which FSEvents flags rescan the tree; a real stream in the slow tier), Debouncer, which call sites may mount a volume when resolving a bookmark, and legacy UserDefaults formats still decoding
  • EntitlementsTests / FileAssociationTests — sandbox entitlement for save-panel destinations, and the Info.plist document types / imported UTIs (folders, CBZ/ZIP, CBR/RAR)

Tests mirror the source tree: PanelyTests/Core/{Comic, Diagnostics, Extensions}/, PanelyTests/Commands/, PanelyTests/Features/Library/, PanelyTests/Features/Settings/, PanelyTests/Features/Translation/, and PanelyTests/Features/Reader/{Model, Scene, Viewer, Thumbnails, ViewModel, ViewModel/Collaborators}, plus PanelyTests/Localization/, PanelyTests/Snapshots/ and PanelyTests/Benchmarks/. Shared fixtures (including a real PNG generator) live in PanelyTests/TestFixtures.swift, checked-in RAR archives in PanelyTests/Fixtures/Archives/; persistence tests use PanelyTests/TestKeyValueStore.swift.

RecentItem.Codable includes a decodeIfPresent path for isDirectory so old stored entries survive a schema bump.

Project Structure

Each folder's top level holds only types referenced by code outside that folder. Internals (extensions, sub-views, AppKit bridge, collaborators) sit in subfolders so the top of any directory shows its public surface at a glance.

Panely/
├── PanelyApp.swift                     # @main, window style, .commands { fileCommands + viewCommands + goCommands }
├── ContentView.swift
├── AppDependencies.swift               # injected app services (cache, bookmarks, persistence, system settings, file watching,
│                                       # file picking, UI language, translation stores) + collaborator factories
├── AppIcon.icns                        # generated from docs/icon/*.svg
├── Assets.xcassets                     # accent color
├── Credits.rtf                         # About panel credits (release.sh stamps the build's commit SHA)
├── Localizable.xcstrings               # string catalog: English source + Korean
├── Resources/
│   └── ComicTextDetector.mlpackage     # Core ML balloon / text detector (built by scripts/convert-text-detector.py)
├── Commands/                           # @CommandsBuilder extensions on PanelyApp
│   ├── PanelyApp+FileCommands.swift    # Open / Open Recent
│   ├── PanelyApp+ViewCommands.swift    # chrome / layout / fit / zoom / autofit
│   └── PanelyApp+GoCommands.swift      # page jump / bookmarks / favorites / volumes
├── Core/
│   ├── Comic/                          # loaders, ComicSource/Page, natural sort, image metadata
│   │   ├── ComicPage.swift / ComicSource.swift / ComicPageSource.swift
│   │   ├── FolderLoader.swift
│   │   ├── ArchiveLoader.swift         # flat + recursive-nested extraction + 5 GB safety cap
│   │   ├── ArchiveReader.swift         # ArchiveReader protocol + ArchiveFormat (magic-byte sniffing)
│   │   ├── ZIPArchiveReader.swift      # actor around ZIPFoundation.Archive
│   │   │                               # (loadDataPrefix for header-only reads)
│   │   ├── RARArchiveReader.swift      # actor around UnrarKit's URKArchive
│   │   │                               # (solid archives extracted once into the extraction cache;
│   │   │                               # entry heads of other archives read in one pass)
│   │   ├── NaturalSort.swift           # locale-aware natural ordering helper
│   │   └── ImageLoader.swift           # async NSImage + dimensions(for:) header read
│   ├── Diagnostics/
│   │   ├── AppLog.swift                # swift-log facade + OSLog/file diagnostic backend
│   │   └── DiagnosticLogStore.swift    # rolling recent-log.txt cache file
│   ├── SourceChangeMonitor.swift       # DispatchSource-backed multi-URL file/folder watcher (session-guarded)
│   ├── LibraryDirectoryWatcher.swift   # FSEvents recursive watch on the library root → sidebar auto-refresh
│   ├── Debouncer.swift                 # shared trailing-debounce helper (position / progress saves)
│   ├── AppLanguage.swift               # System Default / English / Korean choice
│   ├── AppLocalization.swift           # language in effect; `Bundle.localized` for live switching
│   ├── AppMenuLocalizer.swift          # live translations for standard macOS menus
│   ├── FilePicking.swift               # NSOpenPanel seam (injected) → open / folder-access flows stay testable
│   └── Extensions/                     # shared Foundation utility extensions (DRY)
│       ├── URL+IsAncestor.swift        # path-component-aware prefix containment
│       ├── UserDefaults+Codable.swift  # KeyValueStoring + JSON encode/decode helpers
│       └── Dictionary+CapByRecency.swift # recency-based cap shared by persistence stores
├── DesignSystem/
│   ├── Tokens/                         # Color / Spacing / Typography / Motion
│   └── Primitives/                     # Icon button, icon menu, slider
├── Features/
│   ├── Reader/
│   │   ├── ReaderScene.swift           # ZStack: SidebarHost + ViewerArea + ThumbnailSidebarHost (entry view)
│   │   ├── Scene/                      # ReaderScene sub-views (one struct per file)
│   │   │   ├── HotEdgeReveal.swift
│   │   │   ├── SidebarHost.swift               # LibrarySidebar wired to viewmodel actions
│   │   │   ├── ThumbnailSidebarHost.swift      # ThumbnailSidebar wired to viewmodel actions
│   │   │   ├── ViewerArea.swift                # viewer + key handlers + overlays
│   │   │   ├── ReaderToolbarOverlay.swift
│   │   │   ├── ReaderSliderOverlay.swift
│   │   │   └── VolumeCardOverlays.swift        # end-of- + previous-volume cards
│   │   ├── Model/                      # value types & pure helpers
│   │   │   ├── PageLayout.swift        # single/double/vertical + cycle + isContinuous
│   │   │   ├── ReadingDirection.swift  # LTR / RTL
│   │   │   ├── FitMode.swift           # 3 cases + cycle
│   │   │   ├── FitCalculator.swift     # pure magnification math
│   │   │   ├── PositionKey.swift       # stable per-book position keys
│   │   │   ├── SidebarMode.swift       # pinned / overlay state value-type
│   │   │   └── SpreadCalculator.swift  # spread grouping (+ standalone-cover offset)
│   │   ├── ViewModel/                  # @Observable @MainActor reader state
│   │   │   ├── ReaderViewModel.swift           # session state + composition
│   │   │   ├── Extensions/                     # logic split by concern
│   │   │   │   ├── ReaderViewModel+Navigation.swift   # page nav, Quick jump, chrome toggles
│   │   │   │   ├── ReaderViewModel+Source.swift       # load entry points + ReaderLoadIntent
│   │   │   │   ├── ReaderViewModel+LoadPipeline.swift # multi-stage load() state machine + source-change watcher
│   │   │   │   ├── ReaderViewModel+Cache.swift        # extraction-cache clear (File menu + Settings)
│   │   │   │   ├── ReaderViewModel+Toolbar.swift      # PanelyToolbar state/actions bundle
│   │   │   │   ├── ReaderViewModel+Volumes.swift      # sibling counters + volume cards
│   │   │   │   ├── ReaderViewModel+ImageLoading.swift # facade over ReaderImageLoader
│   │   │   │   ├── ReaderViewModel+Bookmarks.swift    # favorites + page bookmarks integration
│   │   │   │   ├── ReaderViewModel+ReadingProgress.swift # progress records → sidebar badges + Continue Reading
│   │   │   │   ├── ReaderViewModel+Translation.swift  # translation assist: languages, jobs, overlays
│   │   │   │   ├── ReaderViewModel+TranslationExport.swift # export translated books / series (background jobs)
│   │   │   │   └── ReaderViewModel+AIChat.swift       # AI chat round trip: save balloons, apply the reply, undo
│   │   │   └── Collaborators/                  # composed by ReaderViewModel; each single-responsibility
│   │   │       ├── ReaderPreferences.swift     # KeyValueStoring-backed layout / fit / pins
│   │   │       ├── ReaderPositionStore.swift   # debounced per-book page memory
│   │   │       ├── ReaderSeriesIdentity.swift  # series key (volume folder / opened archive)
│   │   │       ├── ReaderSeriesPreferencesStore.swift # per-series layout / direction / fit
│   │   │       ├── FolderResolver.swift        # off-main folder/volume scanners (pure file-system walks)
│   │   │       ├── ReaderImageLoader.swift     # cache + paged refresh + vertical lazy window + preload
│   │   │       ├── ReaderImageLoadingSupport.swift # image memory cache + loading helpers
│   │   │       ├── ReaderTempDirectory.swift   # zip-in-zip session extraction lifecycle
│   │   │       ├── ExtractionCacheStore.swift  # content-addressed extraction cache (10 GB LRU)
│   │   │       └── ReaderLibraryScope.swift    # security-scope grant ownership
│   │   ├── Viewer/                     # AppKit-backed scrollable image stage
│   │   │   ├── ViewerContainer.swift           # SwiftUI shell (entry into the scroller)
│   │   │   ├── ViewerController.swift          # zoom remote (⌘+/-/0, scroll-wheel)
│   │   │   └── AppKit/                         # internal AppKit bridge
│   │   │       ├── AppKitImageScroller.swift       # NSViewRepresentable + applyFit
│   │   │       ├── AppKitScrollerCoordinator.swift # observers + state diffing
│   │   │       ├── PanelyScrollView.swift          # NSScrollView with ⌘+scroll zoom + wheel page turn
│   │   │       ├── TitleBarPassthrough.swift       # top 28 px drag + cursor handling
│   │   │       ├── CenteringClipView.swift         # small-document centering NSClipView
│   │   │       ├── ImageStackView.swift            # page frames + pooled NSImageViews
│   │   │       └── WheelPageTurnEngine.swift       # scroll-wheel page-turn state machine
│   │   ├── Toolbar/
│   │   │   ├── PanelyToolbar.swift     # 5 button groups: chrome / layout / fit&zoom / bookmarks / nav; folds groups into menus when narrow
│   │   │   ├── ToolbarHint.swift       # instant hover hint under a toolbar control
│   │   │   └── QuickJumpField.swift    # inline-editable page counter
│   │   ├── Overlays/
│   │   │   ├── LoadingOverlay.swift
│   │   │   ├── VolumeCardChrome.swift  # shared material/shadow/border ViewModifier
│   │   │   ├── EndOfVolumeCard.swift   # bottom card: "Up next" + start/restart
│   │   │   └── PreviousVolumeCard.swift # top card: "Previous" (intent-gated)
│   │   └── Thumbnails/
│   │       ├── ThumbnailSidebar.swift  # right-side thumbnail panel (LazyVStack)
│   │       └── ThumbnailLoader.swift   # Image I/O thumbnails + NSCache
│   ├── Translation/                    # experimental translation assist (macOS 26+)
│   │   ├── TranslationManager.swift    # app-wide jobs: one per book × language, background + queue
│   │   ├── TranslationController.swift # one book into one language: plan, OCR → translate, progress
│   │   ├── TranslationStore.swift      # per-page JSON cache under Caches (page id + languages + scope + model)
│   │   ├── TranslationEdits.swift      # the reader's balloon edits for the open book
│   │   ├── TranslationEditStore.swift  # edits on disk under Application Support (survive cache clears)
│   │   ├── TranslationModelStore.swift # the model's download: progress, hash check, install, delete
│   │   ├── SeriesVolumeMatcher.swift   # which neighbours are volumes of the same series
│   │   ├── Model/                      # TranslationLanguage, TranslationModel (pinned Gemma GGUF + files),
│   │   │                               # TranslatedPage / TranslatedBubble, PageEdits
│   │   ├── AIChat/                     # AIChatExchange: balloons out to the reader's AI chat, its reply back in
│   │   ├── Export/                     # translated copies: TranslationExportManager (jobs, history, folder),
│   │   │                               # TranslationExportJob (options, records), TranslationExportWriter
│   │   │                               # (CBZ / ZIP / folder), TranslatedPageRenderer
│   │   ├── Pipeline/                   # OCRTiling, TranslationPlan (page / strip), PageAnalyzer,
│   │   │                               # PageTextRecognizer (comic OCR / Vision fallback), GemmaTranslator (llama.cpp + prompt),
│   │   │                               # BubbleGrouper, BalloonDetector (Core ML), MissedText,
│   │   │                               # BubbleBackgroundSampler, TextClassifiers,
│   │   │                               # TranslationWarmup (prepares OCR once per build)
│   │   ├── Viewer/                     # TranslationOverlayView (+ layout, TranslationPatchPainter), balloon popover
│   │   └── UI/                         # TranslationPanel, language rows, progress pill, job list, edit-mode bar,
│   │                                   # export sheet, AI chat sheet, Jobs window
│   ├── Settings/
│   │   ├── SettingsView.swift          # General + Library + Storage + Diagnostics + Experimental tabs
│   │   ├── ExperimentalSettingsView.swift # translation assist: on/off, target language, the model
│   │   │                                  # (download / delete), your edits, cache
│   │   ├── GeneralSettingsView.swift   # interface language picker (live)
│   │   ├── LibrarySettingsView.swift   # reopen-last-folder toggle + Forget Now
│   │   ├── StorageSettingsView.swift   # Storage settings UI + cache size / clear controls
│   │   ├── DiagnosticsSettingsView.swift # diagnostic report export UI
│   │   ├── DiagnosticReportExporter.swift # zip report writer
│   │   └── CacheMaintenance.swift      # clear-cache result and formatting helpers
│   └── Library/
│       ├── LibrarySidebar.swift        # pin button + extension badge + two-phase load
│       ├── BookmarkAlerts.swift        # confirmation for bulk bookmark removal
│       ├── LibrarySidebarModel.swift   # sidebar presentation model + expand-ancestors-of-active
│       ├── LibraryTreeLoader.swift     # injectable FileNode.loadTree wrapper
│       ├── Model/
│       │   ├── FileNode.swift          # iconName + fileExtension + parallel top-level scan
│       │   ├── RecentItem.swift        # security-scoped recent entry
│       │   ├── FavoriteBook.swift      # persistent favorite (security-scoped bookmark)
│       │   ├── PageBookmark.swift      # persistent per-page bookmark
│       │   └── ReadingProgress.swift   # persisted {page,total,finished} + ReadingBadge
│       ├── Store/
│       │   ├── FavoritesStore.swift            # starred books (security-scoped, stale auto-refresh)
│       │   ├── PageBookmarksStore.swift        # per-book pages with per-book + total caps
│       │   ├── RecentItemsStore.swift          # bookmark dedup on repeat opens
│       │   ├── ReadingProgressStore.swift      # per-book progress (debounced, recency-capped) → badges + Continue Reading
│       │   ├── LastLibraryRootStore.swift      # security-scoped bookmark of the last library root → reopen on launch
│       │   ├── LatestWinsDefaultsWriter.swift  # debounced latest-wins commit off the main actor
│       │   └── SecurityScopedBookmark.swift    # shared bookmark create/resolve + stale refresh
│       └── Rows/                       # sidebar row views (one struct per file)
│           ├── FileNodeRow.swift
│           ├── FavoriteRow.swift
│           ├── VolumeRow.swift
│           ├── PageBookmarkRow.swift
│           └── ReadingBadgeView.swift  # progress ring / finished check

PanelyTests/                            # mirrors the source tree
├── TestFixtures.swift                  # shared temp-dir / zip / PNG helpers
├── PanelyAppDelegateTests.swift
├── FileAssociationTests.swift
├── EntitlementsTests.swift
├── TestKeyValueStore.swift             # in-memory KeyValueStoring for persistence tests
├── TestTiers.swift                     # fast / slow / visual tiers (env-gated)
├── Fixtures/Archives/                  # checked-in RAR4 / RAR5 fixtures (solid, nested, password)
├── Benchmarks/                         # TranslationBenchmarkTests (opt-in: scripts/benchmark-translation.sh)
├── Commands/                           # GoMenuRenderingTests
├── Localization/                       # KoreanLocalizationTests
├── Snapshots/                          # docs/screenshots/ generator (skipped in CI) + visual regression
│   ├── SnapshotRenderer.swift          # NSHostingView + offscreen window → PNG
│   ├── SnapshotSampleContent.swift     # placeholder pages + LibraryFixture
│   ├── TranslationSnapshotContent.swift # drawn sample manga pages + translations for the translation shots
│   ├── SnapshotGalleryTests.swift      # manual scenarios
│   ├── SnapshotComparator.swift        # tolerant pixel diff + diff image
│   ├── VisualRegressionTests.swift     # screens vs Reference/*.png
│   ├── HostedViewInspection.swift      # helpers for the hosted-view rendering tests
│   └── Reference/                      # reference PNGs + recording macOS version
├── Core/Comic/                         # ArchiveLoader (+ handoff), ZIP/RAR readers (cancellation, corruption,
│                                       # index equivalence), FolderLoader, ImageLoader{Load,Dimensions},
│                                       # ComicModel, LoaderExtension, NaturalSort, GatedArchiveReader
├── Core/Diagnostics/                   # AppLog (+ levels), DiagnosticLogStore (+ resilience)
├── Core/Extensions/                    # URL relative-subpath helpers
├── Core/                               # SourceChangeMonitor, LibraryDirectoryWatcher, LibraryChangeFilter,
│                                       # Debouncer, AppLocalization, AppMenuLocalization
├── Features/Library/                   # FavoritesStore, PageBookmarksStore (+ memo), RecentItem,
│                                       # FileNode, FavoriteBook, PageBookmark,
│                                       # ReadingProgressStore, LastLibraryRootStore,
│                                       # LibrarySidebarModel, SecurityScopedBookmark,
│                                       # LibraryTreeScan, bookmark mount policy, legacy formats,
│                                       # LibrarySidebar(Update)Rendering
├── Features/Settings/                  # CacheMaintenance, diagnostic report export
├── Features/Translation/               # OCR tiling, grouping, balloon detection, missed text, Gemma prompt,
│                                       # model download, batched jobs (stand-in translator),
│                                       # classifiers, plan, controller, manager, store, edits, export,
│                                       # AI chat, overlay drawing / hit testing, series matching, reader wiring
└── Features/Reader/
    ├── Model/                          # FitCalculator, PositionKey, ReaderEnum, SidebarMode,
    │                                   # SpreadCalculator
    ├── Scene/                          # ReaderToolbarRenderingTests
    ├── Viewer/                         # CenteringClipView, FitMagnificationStability,
    │                                   # ImageStackVertical, ScrollZoomCalculator,
    │                                   # ViewerController, ViewerResizeFit,
    │                                   # AppKitScrollerCoordinator, TitleBarPassthrough,
    │                                   # WheelPageTurnEngine, ZoomCarryOver, ReaderViewerRendering
    ├── Thumbnails/                     # ThumbnailLoader, ThumbnailSidebarRendering
    └── ViewModel/                      # 18 ReaderViewModel integration files (AppLanguage,
        │                               # Bookmarks, BookmarkList, BookSwitchStripReset,
        │                               # EndOfVolume, Library, OpenSource, PagedCancellation,
        │                               # PagedMode, PositionMemory, QuickJump, ReadingProgress,
        │                               # SeriesPreferences, SetLayout, ThumbnailSidebar,
        │                               # ToolbarPin, VerticalMode, VolumeStepping)
        │                               # + ReaderSeriesIdentity / SeriesPreferencesStore,
        │                               # ContinueReading{Index,Randomized},
        │                               # PositionKeyConsistency, PositionPersistenceSafety
        └── Collaborators/              # focused unit tests for the collaborators

docs/
├── index.html                          # project landing page
├── manual.md                           # English user manual (screenshot walkthrough)
├── manual.html                         # HTML build of the manual
├── manual.ko.md                        # Korean user manual
├── screenshots/                        # 27 PNGs generated by SnapshotGalleryTests
├── releases/                           # release notes, one per tag (vX.Y.Z.md)
├── panely_design_system_mac_os.md
└── icon/panely-icon-stacked.svg

scripts/
├── generate-app-icon.sh                # SVG → .icns pipeline
├── test.sh                             # fast test tier (what CI runs)
├── test-slow.sh                        # fast + slow tiers (real FSEvents / OCR, all seeds)
├── test-visual.sh                      # screenshot comparisons only
├── test-model.sh                       # the real translation model's tests (opt-in, needs the model)
├── benchmark-translation.sh            # translation timings per stage / per job (opt-in benchmark)
├── generate-snapshots.sh               # manual capture launcher (--list / --only / --output)
├── manual-snapshots.py                 # selection, PNG validation and copying (Python stdlib)
├── manual-snapshots.json               # capture id → scenario and output files
├── tests/test_manual_snapshots.py      # selection, failure handling and catalog checks
├── update-reference-snapshots.sh       # re-record PanelyTests/Snapshots/Reference/*.png
├── convert-text-detector.py            # rebuild Resources/ComicTextDetector.mlpackage (Core ML)
├── install-local.sh                    # build + install locally for hands-on testing (--debug, --test…)
└── release.sh                          # bump + tag + push automation

Packages/UnrarKit/                      # vendored UnrarKit + RARLAB unrar source as a local Swift package
Packages/LlamaCpp/                      # llama.cpp's prebuilt XCFramework, pinned by URL + checksum

.github/
├── FUNDING.yml                         # GitHub Sponsors (sejoung)
└── workflows/
    ├── ci.yml                          # build + fast-tier tests on push/PR to main
    └── release.yml                     # zip + GitHub Release on v* tag

Info.plist                              # bundle icon, document types (folders, CBZ/ZIP, CBR/RAR), imported UTIs
Panely.entitlements                     # sandbox + user-selected read-write + app-scoped bookmarks

Architecture Notes

  • @Observable + @MainActor — ReaderViewModel is main-actor isolated and orchestrates async loads via explicit stage messages to drive the loading overlay. The class file holds session state + composition of focused collaborators (ReaderPreferences, ReaderSeriesPreferencesStore, ReaderPositionStore, ReaderImageLoader, ReaderTempDirectory, ReaderLibraryScope), the library stores and the translation owners (TranslationManager, TranslationEdits, TranslationExportManager), plus AppDependencies for shared services (extraction cache, security-scoped bookmarks, library tree loading, key-value persistence, system settings, file watching, UI language and the translation stores). It forwards collaborator properties so view callsites (viewModel.layout, viewModel.currentImages) stay unchanged while the underlying types own their state independently. Per-concern logic is split across extensions (+Navigation, +Source, +LoadPipeline, +Cache, +Toolbar, +Volumes, +ImageLoading, +Bookmarks, +ReadingProgress, +Translation, +TranslationExport, +AIChat).
  • Translation assist — TranslationManager (app-wide, main-actor) owns one TranslationController per book × target language, so jobs survive book switches and several languages coexist; it runs one job at a time, the one on screen first. A controller cuts the book into units (TranslationPlan: one page each, or overlapping bands of the vertical strip so balloons split across image slices are read whole), OCRs the next units while translating the current one, and always picks the next unit at or after the page being read. A unit's new lines go to the model together, up to 16 at a time, with the job's last six translations as context; lines seen earlier in the book are reused. Work runs in a detached task and reports back to the main actor under a generation counter. Per unit, PageAnalyzer (an actor) finds balloons with BalloonDetector (the bundled Core ML RT-DETR), then reads Japanese text crops with manga-ocr int8 and other languages with PP-OCRv5 mobile (ComicOCREngine, ONNX Runtime). Complete balloon batches stream to translation while the rest of the page is being read. Tall pages use OCRTiling bands. PageTextRecognizer keeps Vision as a fallback; its missed boxes are reread by MissedText. BubbleGrouper joins lines, leaves sound effects as drawn (SoundEffectClassifier) and samples each balloon's background tone (BubbleBackgroundSampler). GemmaTranslator (an actor on its own thread) then runs Gemma 4 E2B with llama.cpp on the GPU: one model for the app, prepared when the translation panel opens and let go after ten idle minutes, one context reused, without reading again the start of the prompt it shares with the last request (about 7% off each request), greedy decoding. The prompt (GemmaPrompt, the same as the Windows version's) asks for numbered [n] translation lines and for each speaker's speech level to be kept; lines are read off the output as they're written, so each balloon shows the moment it's done, and a line the model skips is asked for again on its own. TranslationModelStore (on the manager) downloads the pinned GGUF with progress, checks its size and SHA-256 and moves it into Application Support; jobs waiting for it restart once it's in. The viewer only reads TranslatedPages: ImageStackView hosts a TranslationOverlayView per live page, above every image so strip balloons can cross slice boundaries. Finished pages are cached under Caches per page id + languages + scope + model revision and prompt version (TranslationStore); the reader's balloon edits (PageEdits, via TranslationEdits) are kept apart in TranslationEditStore under Application Support and laid over them for display, so clearing the cache or translating again never loses them. AIChatExchange round-trips a book's balloons through the reader's own AI chat as a text file; the reply's translations become edits, undoable in one go. Exports (TranslationExportManager) wait on a book's controller through the same queue, then render one book at a time off the main actor (TranslationExportWriter → TranslatedPageRenderer, sharing TranslationPatchPainter with the on-screen overlay) into a CBZ, ZIP or folder.
  • Dependency-injected app services — production uses AppDependencies.live, while tests can inject protocol-backed services (ExtractionCacheManaging, SecurityScopedBookmarking, LibraryTreeLoading, KeyValueStoring, SystemSettingsReading, SourceChangeMonitoring, LibraryDirectoryWatching, FilePicking, BalloonTranslating, PageAnalyzing), their own AppLocalization, and temp-dir TranslationStore / TranslationEditStore roots without touching real app preferences, cache roots, sandbox bookmarks, or the on-device model.
  • nonisolated core types — ComicPage, FolderLoader, ArchiveLoader, ImageLoader, FitCalculator, PositionKey run off-main via Task.detached.
  • ArchiveReader actors — ZIPArchiveReader wraps ZIPFoundation's Archive and RARArchiveReader wraps UnrarKit's URKArchive for serialised, thread-safe entry reads. unrar keeps its error state in a process-wide global, so every UnrarKit call additionally goes through one shared lock. Solid RARs (one continuous compressed stream, where reading entry N means decompressing 0..<N) are extracted once on first access into the extraction cache, so reopening skips it, instead of being read per entry. Other RARs read the heads of many entries in one pass (the vertical layout's dimension pre-pass), since finding one entry walks the headers from the start.
  • AppKit viewer core — ViewerContainer is SwiftUI, but the scrollable zoomable stage is AppKitImageScroller (NSViewRepresentable) wrapping NSScrollView + CenteringClipView + a custom ImageStackView. acceptsFirstResponder is disabled so keyboard events still flow to SwiftUI's .onKeyPress. AppKitScrollerCoordinator owns the bridge's AppKit-side state: last-seen SwiftUI props (for change detection), the two NotificationCenter observer tokens, and the applyFit invocation — so the representable itself stays focused on the SwiftUI ↔ AppKit handshake.
  • CenteringClipView overrides constrainBoundsRect(_:) to center the document when the viewport is larger — keeps the image in the middle when the sidebar is toggled.
  • TitleBarPassthrough — a thin NSView overlaying the top 28 px of the viewer. mouseDownCanMoveWindow = true gives native window drag; two NSTrackingAreas split the strip at the ~78 pt traffic-light inset so the open-hand cursor never leaks onto the close / minimize / zoom buttons, and a mouseDown override handles double-click zoom/minimize/none through injected SystemSettingsReading (AppleActionOnDoubleClick in production). The overlay uses .ignoresSafeArea(edges: .top) so it lines up with the actual window edge under .hiddenTitleBar.
  • SpreadCalculator — single source of truth for double-page grouping. With the standalone-cover offset on, page 0 is its own spread and the rest pair as (1,2)(3,4)…; navigation stepping, visiblePages, and position restore all ask it, so they can't drift apart.
  • WheelPageTurnEngine — a pure state machine over scroll-event snapshots (no NSEvent dependency). A plain scroll only turns the page when panning can't absorb it (the page fits, or it's pinned at the edge being pushed past), trackpad gestures turn at most once per swipe (the rest of that gesture, momentum included, is swallowed), and discrete mouse wheels turn one page per notch behind a cooldown. PanelyScrollView feeds it and routes the result through advanceForward() / goBackward().
  • FitCalculator — physical viewport (scrollView.contentSize) is magnification-invariant, so toggling fit modes produces stable magnifications (no feedback loop).
  • Viewer auto-refit on resize — AppKitImageScroller subscribes to its NSScrollView's frameDidChangeNotification. The handler hops onto MainActor, recomputes the fit, and only writes magnification when the user has not manually zoomed and the view-size lock is off. applyFit itself decomposes its force flag: identity (new book) or fit-mode change forces reset; layout-only change defers to lock + zoom state.
  • Vertical (webtoon) lazy windowing — entering vertical mode pre-fetches every page's pixel dimensions concurrently (header-only CGImageSource read; for archive entries ArchiveReader.loadDataPrefix(maxBytes: 64 KB) bails out of the ZIP/RAR extract early so we don't decompress the whole entry just to read width/height; ZIPArchiveReader resolves entries through a path index built once, not ZIPFoundation's linear archive[path] scan). Dimension fetches and decodes both run through chunked withTaskGroup capped at min(8, cores) to avoid blowing through the cooperative pool on big folders. currentImages is filled with same-sized gray placeholder NSImages (lazy drawingHandler — no eager bitmap), then a bounds observer drives setVisibleRange(...) which loads real images for the visible range + buffer. Results commit to currentImages in a single batched assignment per task — one SwiftUI render per chunk instead of N. In-flight tasks cancel when the visible range changes again, and ImageLoader.load checks cancellation between fetch and decode so abandoned work stops promptly.
  • Window eviction — when the visible range moves, pages outside [range ± 10] are swapped back to placeholders so a 1000-page strip doesn't pin every decoded image in memory. The window is also byte-budgeted (same RAM-scaled limit as the NSCache): past it the pages farthest from the viewport go first, but visible pages and their ± 2 load buffer always stay. Recently-evicted pages typically restore from NSCache instantly when scrolled back.
  • Dimension cache — header-read dimensions are kept per book by page id, so toggling paged ↔ vertical rebuilds the strip without re-reading every header. They're still fetched all up front on first entry: the strip has no scroll anchoring, so filling real heights in after the restored page is shown would shift it out of view.
  • Paged cancellation — page changes run through one tracked refresh task; each new page change cancels the previous one, and ImageLoader.load forwards that cancellation into its detached decode task (and the archive read), so scrubbing the page slider decodes only the spread it lands on.
  • ImageStackView view recycling — the stack stores pageFrames for every page (drives all geometry queries) but only materializes NSImageView instances for pages whose frames intersect the visible viewport ± 1 viewport buffer. A small viewPool (cap 24) caches recycled views to avoid alloc/dealloc churn on scroll. A 1000-page strip lives in a tree of ~10–15 NSImageViews instead of 1000. setImages fast path (count + axis match) just mutates imageView.image for live views, so per-page lazy loads cost a pointer write each.
  • ViewerController — @Observable @MainActor remote control owned by PanelyApp and shared via environment. Holds a weak NSScrollView ref
    • baseMagnification synced by applyFit, exposes zoomIn/zoomOut (1.25× clamped to min/max, viewport-centered) and resetZoom so toolbar buttons + menu shortcuts (⌘+/⌘-/⌘0) and ⌘ + scroll wheel all hit the same code path.
  • SidebarMode — a tiny pure value-type owning pinned and overlayVisible. ReaderPreferences holds the instance and persists only pinned; ReaderViewModel forwards sidebarPinned / sidebarOverlayVisible / sidebarVisible (computed) so view callsites are unchanged. Hot-edge hover reveal lives in ReaderScene as a small HotEdgeReveal SwiftUI view that fires revealSidebarOverlay() after a 200 ms delay; mouse-out from the overlay schedules a 300 ms dismiss. The toolbar follows the same pin pattern (toolbarPinned) and shares the auto-hide / pin overlay logic.
  • PositionKey.make(for:opened:tempRoot:) — for sources extracted to /tmp, the key is derived from the opened URL plus the relative path inside the temp root so reading progress survives re-extraction. Page bookmarks (PageBookmarksStore) reuse the same key so they also survive temp-dir re-extraction. A PositionKey.fileIdentity(for:) helper additionally produces a (volumeIdentifier, fileResourceIdentifier) key so external drives whose mount path drifts (e.g. /Volumes/X → /Volumes/X 1) still recover the saved position. Writes record under both keys; reads try the path key first and fall back to file-identity.
  • Deterministic ComicPage.id — the page identifier is a deterministic string derived from its source plus the file's content signature (size + modification date): file:<path>#<signature> or archive:<archiveURL>#<signature>#<entryPath>. Re-opening the same book yields the same id, so image and thumbnail NSCache entries stay warm, while replacing a file in place changes it so caches (translations included) don't serve stale pages — the previous random-UUID() scheme caused a full thumbnail re-decode on every reopen.
  • NSCache-backed image cache — per-page decoded NSImages with automatic memory-pressure eviction. countLimit = 100 is intentionally loose so vertical lazy windows (lazyWindowRadius + lazyKeepBuffer ≈ 25 pinned pages) aren't truncated by LRU eviction while still under the real budget — totalCostLimit scales to host RAM (~1/16, clamped to [150 MB, 1 GB]) so high-res scan series don't thrash a fixed cap on big machines while small machines stay conservative. Per-entry cost uses the bitmap rep's pixelsWide × pixelsHigh × (bitsPerSample × samplesPerPixel / 8) so Retina backing and 16-bit/HDR scans aren't under-priced. Preload runs a cancellable Task around the current page ±2 in paged modes; cancellation propagates into ImageLoader.load and preloadIfNeeded so abandoned work doesn't pollute the cache during fast keyboard navigation.
  • Persistent store safety — PageBookmarksStore caps per-book page bookmarks at 500 (oldest dropped on overflow) and total book entries at 200 (least-recently-touched dropped) so the JSON-encoded blob stays comfortably under UserDefaults's ~4 MB practical limit; a decode failure there would otherwise lose every bookmark at once. pruneOrphaned(keeping:) lets the viewer GC entries for books no longer in Recents/Favorites. Both RecentItemsStore.resolve and FavoritesStore.resolve regenerate stale security-scoped bookmarks in place, so moving a favorited file doesn't break it — RecentItemsStore.record's fast reopen path also runs the same staleness check. All three stores share JSON encode/decode through KeyValueStoring.loadCodable(_:forKey:) / saveCodable(_:forKey:) in Core/Extensions/ (LiveKeyValueStore is backed by UserDefaults).
  • Archive extraction size cap — ArchiveLoader.maxExtractedBytes = 5 GB. The top-level extraction seeds a running byte total (one walk of the destination); each nested extraction then adds only the bytes of the folder it just expanded and subtracts the archive it replaced, so the tree is summed once overall (O(n), not re-walked per nested archive). If the running total crosses the limit, LoadError.extractedSizeExceeded is thrown and partial extraction is cleaned up. Protects against zip-bombs and pathological nested archives that slip past maxNestingDepth.
  • Startup temp-dir cleanup — ReaderTempDirectory.cleanupStaleEntries only removes session panely-<uuid> directories whose contentModificationDate is more than 10 minutes old, so a concurrent first-launch extraction can't be deleted by the cleanup task racing it in the background. Cache dirs under ~/Library/Caches/panely-extraction-cache/ are managed separately by the injected extraction cache manager, whose enforceBudget() is invoked by the same startup hook.
  • Content-addressed extraction cache — ExtractionCacheStore hashes the source archive's path + size + mtime in cacheKey(for:) (SHA256, truncated to 64 bits). cachedEntry(forKey:) returns an existing cache dir if it's present and non-empty (the non-empty check guards against partial extractions being served), touching the dir's mtime so the LRU policy treats it as most-recently-used. New extractions go to makeCachedCandidate(forKey:); the load pipeline only falls back to a UUID-keyed session dir when the source can't be stat'd. enforceBudget() runs asynchronously after a new cache entry is adopted and on app launch.
  • Last-spread-reachable position restore — clampedRestoredIndex clamps to the last step-aligned index (((pageCount - 1) / step) * step) instead of pageCount - 1, so quitting on the final spread in double-page mode and reopening lands exactly there rather than one spread short.
  • AppKit observer hardening — AppKitScrollerCoordinator.attachFrameObserver(to:) and attachBoundsObserver(to:) defensively remove any prior token before registering, so even if SwiftUI recreates the representable the coordinator can't accumulate duplicate auto-fit / scroll handlers. Both tokens are released in the coordinator's deinit. Covered by AppKitScrollerCoordinatorTests (no-double-fire on re-attach, deinit no-leak).
  • Eager-decode image pipeline — ImageLoader.load runs CGImageSourceCreateWithURL (zero-copy mmap for file URLs) / CGImageSourceCreateWithData (archive entries) inside a Task.detached, with kCGImageSourceShouldCacheImmediately: true so the returned NSImage backs onto a fully-realized CGImage. Avoids the lazy decode that NSImage(data:) defers to first draw on the main thread.
  • Paged refresh parallelism — refreshPaged decodes the visible spread (2 pages in double-page mode) concurrently via withTaskGroup and commits a single currentImages write in original order. Single layout is unaffected; double layout finishes ~2× faster.
  • Series continuous reading — ReaderViewModel.showsEndOfVolumeCard is the pure predicate isAtLastPage && canGoNextVolume; the prev counterpart (showsPreviousVolumeCard) is gated behind a transient wantsPreviousVolumePrompt cue that arms only on explicit user intent (a backward press at page 0, or arriving at page 0 via goBackward() from a higher page). Any subsequent currentPageIndex change clears the cue, and load(url:) resets it on every new book so opening a fresh volume doesn't surface the prompt prematurely. Forward / backward keyboard handlers route through advanceForward() / goBackward() so a single press of the matching key advances the volume when the card is showing.
  • Thumbnail cache — ThumbnailLoader generates downscaled NSImages via CGImageSourceCreateThumbnailAtIndex (skips full-resolution decode) and stores them in an NSCache (countLimit = 400, totalCostLimit ≈ 60 MB). The thumbnail sidebar's LazyVStack only materializes visible cells; .task auto-cancels on scroll-out, so in-flight decodes naturally cap at the viewport depth.
  • Sidebar two-phase load — on a new library root, LibrarySidebarModel.reload (driven by LibrarySidebar) ships a depth-1 scan to the UI immediately, then runs the deeper depth-3 scan in the background and replaces the tree once ready. A same-root refresh (manual or FSEvents-driven) skips the shallow pass and swaps in the deep tree only if it differs, so nothing flickers. FileNode.loadTree parallelizes top-level subtree scans via chunked TaskGroup so big libraries open in ~100–200 ms instead of 1–2 s.
  • Settings batch-read — ReaderPreferences.init snapshots the injected KeyValueStoring.dictionaryRepresentation() once and reads every key from the in-memory dict, avoiding a dozen separate cross-process UserDefaults calls on cold start in the live store.
  • Debounced position save with in-memory mirror — currentPageIndex's didSet routes to ReaderPositionStore.savePosition(...), which schedules a 300 ms-debounced write so vertical-scroll-driven page changes at ~60 Hz don't fan out to per-frame UserDefaults writes. Saves and reads go through a lazy in-memory mirror so each save is a small dict mutation
    • one set(_:forKey:) instead of a full read-modify-write of every saved book's slot. NSApplication.willTerminateNotification flushes the pending write before quit.
  • Security-scoped bookmarks — Recent items and favorites persist across launches because we create .withSecurityScope bookmarks and resolve them on click. The active library-root grant lives on ReaderLibraryScope (one URL at a time, acquire/release paired), so sibling navigation within a selected tree doesn't require re-prompting and the prior grant is always released before a new one is acquired.
  • Window close quits the app — PanelyAppDelegate returns true from applicationShouldTerminateAfterLastWindowClosed so the red close button matches single-window-viewer expectations (vs. keeping a headless process alive).
  • Distraction-free chrome — .windowStyle(.hiddenTitleBar) and .preferredColorScheme(.dark) make the whole window behave like the viewer itself; traffic-light buttons remain but the title text is gone.

Releasing

Releases are built and published automatically by .github/workflows/release.yml when a tag matching v* is pushed.

Write the release notes first, as docs/releases/vX.Y.Z.md for the tag (see v1.7.0.md), and commit them. release.yml uses that file as the GitHub release's description, followed by the generated list of changes. Without it, the release gets only the install steps and the run logs a warning.

The easiest way is the helper script:

scripts/release.sh patch   # 1.0.0 → 1.0.1
scripts/release.sh minor   # 1.0.1 → 1.1.0
scripts/release.sh major   # 1.1.0 → 2.0.0
scripts/release.sh 1.2.3   # explicit version
scripts/release.sh         # interactive prompt

The script:

  1. Checks the working tree is clean, on main, in sync with origin, and the tag is free on both local and remote. Asks before going on if the tag has no release notes.
  2. Runs local tests (set SKIP_TESTS=1 to skip).
  3. Bumps MARKETING_VERSION in project.pbxproj, sets CURRENT_PROJECT_VERSION to the git commit count, and stamps the current commit's short SHA into Panely/Credits.rtf (shown in the About panel).
  4. Shows the diff, asks for confirmation, then commits (chore: release vX.Y.Z) and creates an annotated tag.
  5. Asks again, then pushes main and the tag (set NO_PUSH=1 to stop before pushing).

The release commit and the tag push trigger ci.yml (Debug build + tests) and release.yml (Release build + zip + GitHub Release) respectively. Both are intentional: CI on the bump commit verifies the release source tree builds cleanly under Debug, and release.yml produces the shipped artifact.

If you prefer doing it by hand (commit docs/releases/v1.0.0.md first):

git tag v1.0.0
git push origin v1.0.0

CI / storage

  • CI runs on pushes and PRs to main (skips **/*.md, docs/** and LICENSE; a newer push cancels the run in progress), builds Debug with ad-hoc signing, runs the non-snapshot test suite, and uploads no artifacts — storage footprint is essentially zero. SnapshotGalleryTests is gated off by default because it is a PNG generator; regenerate the manual's PNGs with scripts/generate-snapshots.sh when needed. CI runs the fast tier only: VisualRegressionTests and the slow tier are opt-in (scripts/test-visual.sh, scripts/test-slow.sh).
  • Releases attach a single zip (~52 MB, most of it the bundled Core ML text detector and llama.cpp; the translation model is downloaded by the app) to GitHub Releases using ditto so resource forks are preserved. The description is the tag's docs/releases/vX.Y.Z.md plus generated release notes.
  • SPM cache speeds up subsequent runs; invalidates on Package.resolved or project.pbxproj changes.

Regenerating the App Icon

If you edit docs/icon/panely-icon-stacked.svg, regenerate the icns:

scripts/generate-app-icon.sh

This rasterises the SVG at all required sizes (16–1024), embeds sRGB profiles via ImageMagick, and produces Panely/AppIcon.icns via iconutil. Requires librsvg and imagemagick from Homebrew.

Contributing

Contributions are welcome. Please keep in mind:

  • Respect the design principle — distraction-free, minimal UI first. Any change that adds permanent chrome should have a very good reason.
  • macOS conventions — SF Symbols for icons, native menus, keyboard-first.
  • Sandbox-compliant — no paths the user hasn't granted.
  • Tested logic — any non-trivial pure function should land with a test in PanelyTests/.

Open an issue or PR at github.com/sejoung/Panely.

License

Apache License 2.0 — see LICENSE.

About

Panely is a minimal, fast comic and image viewer built for macOS.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages