A minimal, fast comic & image viewer for macOS.
macOS를 위한 미니멀한 만화/이미지 뷰어
English · 한국어
📖 User Manual · 사용 설명서
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.
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.
-
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/⌘⇧3for 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/⌘3shortcuts:- 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 wheelzooms 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 —
⌘Rreloads 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
- 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.txtfile. - Natural filename sort (
1, 2, 10— not1, 10, 2) — applied consistently across loaders / scanners via theNaturalSorthelper - Filters non-image files and hidden entries
- Keyboard-first —
← → Spacefor pages,[ ](or⌘[ ⌘]) for volumes,⌘1 ⌘2 ⌘3for fit modes,⌘+ ⌘- ⌘0for zoom,⌃⌘Sto pin the sidebar,⌃⌘Tto pin the toolbar,⌘Lto lock view size,⌘Oto open, and⌘Rto 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;ESCdismisses 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.filltoggle pattern. Pin state persists across launches - Sidebar tree — folders and archives are visually disambiguated:
foldervsdoc.zippericons, plus a faint.cbz/.zip/.cbr/.rarsuffix 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 —
← → Spacescroll 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 —
⌘Gopens 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
AppleActionOnDoubleClickpreference); an open-hand cursor makes the draggable region obvious
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
- 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.sidebarVisiblekey 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)
- 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
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:
- Drag Panely.app into your /Applications folder.
- Right-click (or Control-click) Panely.app and choose Open. Unlike a double-click, this dialog has an Open button that launches it.
- 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.appgit clone https://github.com/sejoung/Panely.git
cd Panely
open Panely.xcodeprojSelect 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, --revealA local Release build shares settings and caches with an official install and
replaces /Applications/Panely.app; use --debug to keep them apart.
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; seePackages/UnrarKit/README.mdfor 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) byscripts/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.
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
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 FinderKeeping 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.
| 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) |
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 jobsLocal 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.
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 imagesThe 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:
- Add an
@Test funcscenario inPanelyTests/Snapshots/SnapshotGalleryTests.swift, using the sharedSnapshotRenderer.render(_:size:named:)to save the screen. - For interactions or model changes, use
SnapshotRenderer.host(_:size:)anddefer { hosted.close() }. Interact withhosted.drag(in:from:to:release:)orhosted.sendMouse(_:in:at:), then save withhosted.capture(named:). Coordinates belong to the target view;release: falseleaves a drag selection visible. Wait for asynchronous state with the existinghosted.settlehelper before capturing. - Register a unique
id, the method name astest(without parentheses), and every output filename infilesinscripts/manual-snapshots.json. There is no separate output list to update in the launcher. - 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'Several suites guard what actually reaches the screen, not just the models:
LibrarySidebarRenderingTestsrenders the real sidebar off-screen over a fixture library and checks theNSOutlineViewAppKit 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 inPanelyTests/Snapshots/HostedViewInspection.swift. ReaderViewerRenderingTestschecks where the real viewer places each page (single, double, right-to-left, cover alone, vertical strip), andTranslationOverlayDrawingTestsreads 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 inPanelyTests/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'sCaches/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 withscripts/update-reference-snapshots.shand 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
fileExtensionexposure 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
ReaderPreferencesdefault-pinned behavior and persistence - PageLayout cycle —
single → double → vertical → singleordering, per-modenavigationStep,isContinuousflag for vertical ReaderViewModelpaged-mode behavior —visiblePagesslicing,setCurrentPageFromScrollno-op outside vertical,toggleDirectionworks in pagedReaderViewModelvertical-mode behavior —visiblePagesreturns full strip,setCurrentPageFromScrollupdates index,effectiveDirectionis always LTR, paged → vertical transition shows loading indicator immediately, applyFit uses first-image reference for fit calculationsImageStackViewvertical layout —pageIndex(forViewportY:),pageIndexRange(visibleIn:), incrementalsetImagesswap (count + axis match → no view rebuild) vs full rebuild on axis changeViewerController— zoom in / out / reset againstNSScrollViewwith min/max clampingScrollZoomCalculator— 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,
toggleThumbnailSidebarflips persisted flag - Quick-jump math —
currentPageNumber/currentPageRangeEndNumberin 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 injectedKeyValueStoringFavoritesStore— toggle add/remove against a real temp file, security-scoped bookmark resolves back to the original URLReaderPreferences—KeyValueStoringround-trip for every persisted setting (layout / direction / fit / sidebar pin / etc.), invalid raw values fall back to defaults, legacypanely.sidebarVisiblemigrates to the new pin flagReaderPositionStore— empty-store zero return, lazy cache hydration, 300 ms debounce coalesces rapidsavePositioncalls, primary key beats file-identity fallback, mirrored writes under both keysReaderLibraryScope—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: stablecacheKeyper file (mtime-sensitive),cachedEntryhit/miss + mtime touch on hit,enforceBudget()LRU eviction when over 10 GB,cacheSizeBytes(in:excluding:)/clearCache(in:excluding:)manual cleanup, andcleanup()preserves cache dirs while removing session dirsReaderImageLoader— reset /prepareForLayoutRebuild/cancelPreloadstate transitions,estimatedBitmapCostuses pixel dimensions for Retina backing and falls back to size for placeholders, the RAM-scaled cost limit clamps to [150 MB, 1 GB],lazyConcurrencyLimitclamps 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-fireFavoriteBook/PageBookmarkCodable — round-trip fidelity plus forward-compat decode for legacyFavoriteBookJSON withoutisDirectoryReaderViewModelbookmark guards —toggle*,canGo*Bookmark,currentPositionKeybehave as no-ops / false / nil when no source is loadedThumbnailLoader— nil for unreachable URLs, non-nil for a real PNG, sameComicPage.idreturns the cachedNSImagevia===, distinct pages get distinct cache entriesImageLoader.load— eager-decode pipeline (CGImageSource+kCGImageSourceShouldCacheImmediately), throws on non-image / missing files, returned NSImage'scgImage(...)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 readerPanelyAppDelegate—applicationShouldTerminateAfterLastWindowClosedreturns true so the red close button quits the appSpreadCalculator— 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 —
ReaderSeriesIdentityresolution (folder vs. zip-in-zip),ReaderSeriesPreferencesStorepersistence and cap, and series-scoped zoom / layout / direction / fit restore inReaderViewModel - Reading progress & library —
ReadingProgressStore(debounce, recency cap, badges, Continue Reading),LastLibraryRootStore,LibrarySidebarModel(reveal-active expansion), andSecurityScopedBookmarkstale-refresh - Source change & diagnostics —
SourceChangeMonitorfile/folder watching,AppLog/DiagnosticLogStorefile logging, andDiagnosticReportExporterzip 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, andKoreanLocalizationTestsresolving catalog keys through the builtko.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 legacyUserDefaultsformats 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.
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
@Observable+@MainActor—ReaderViewModelis 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), plusAppDependenciesfor 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 oneTranslationControllerper 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 withBalloonDetector(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 useOCRTilingbands.PageTextRecognizerkeeps Vision as a fallback; its missed boxes are reread byMissedText.BubbleGrouperjoins 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] translationlines 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 readsTranslatedPages:ImageStackViewhosts aTranslationOverlayViewper 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, viaTranslationEdits) are kept apart inTranslationEditStoreunder Application Support and laid over them for display, so clearing the cache or translating again never loses them.AIChatExchangeround-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, sharingTranslationPatchPainterwith 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 ownAppLocalization, and temp-dirTranslationStore/TranslationEditStoreroots without touching real app preferences, cache roots, sandbox bookmarks, or the on-device model. nonisolatedcore types —ComicPage,FolderLoader,ArchiveLoader,ImageLoader,FitCalculator,PositionKeyrun off-main viaTask.detached.ArchiveReaderactors —ZIPArchiveReaderwraps ZIPFoundation'sArchiveandRARArchiveReaderwraps UnrarKit'sURKArchivefor 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 —
ViewerContaineris SwiftUI, but the scrollable zoomable stage isAppKitImageScroller(NSViewRepresentable) wrappingNSScrollView+CenteringClipView+ a customImageStackView.acceptsFirstResponderis disabled so keyboard events still flow to SwiftUI's.onKeyPress.AppKitScrollerCoordinatorowns the bridge's AppKit-side state: last-seen SwiftUI props (for change detection), the two NotificationCenter observer tokens, and theapplyFitinvocation — so the representable itself stays focused on the SwiftUI ↔ AppKit handshake. CenteringClipViewoverridesconstrainBoundsRect(_:)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 = truegives native window drag; twoNSTrackingAreas split the strip at the ~78 pt traffic-light inset so the open-hand cursor never leaks onto the close / minimize / zoom buttons, and amouseDownoverride handles double-click zoom/minimize/none through injectedSystemSettingsReading(AppleActionOnDoubleClickin 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 (noNSEventdependency). 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.PanelyScrollViewfeeds it and routes the result throughadvanceForward()/goBackward().FitCalculator— physical viewport (scrollView.contentSize) is magnification-invariant, so toggling fit modes produces stable magnifications (no feedback loop).- Viewer auto-refit on resize —
AppKitImageScrollersubscribes to itsNSScrollView'sframeDidChangeNotification. The handler hops ontoMainActor, recomputes the fit, and only writes magnification when the user has not manually zoomed and the view-size lock is off.applyFititself decomposes itsforceflag: 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
CGImageSourceread; for archive entriesArchiveReader.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;ZIPArchiveReaderresolves entries through a path index built once, not ZIPFoundation's lineararchive[path]scan). Dimension fetches and decodes both run through chunkedwithTaskGroupcapped atmin(8, cores)to avoid blowing through the cooperative pool on big folders.currentImagesis filled with same-sized gray placeholderNSImages (lazydrawingHandler— no eager bitmap), then a bounds observer drivessetVisibleRange(...)which loads real images for the visible range + buffer. Results commit tocurrentImagesin a single batched assignment per task — one SwiftUI render per chunk instead of N. In-flight tasks cancel when the visible range changes again, andImageLoader.loadchecks 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 theNSCache): past it the pages farthest from the viewport go first, but visible pages and their± 2load buffer always stay. Recently-evicted pages typically restore fromNSCacheinstantly 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.loadforwards that cancellation into its detached decode task (and the archive read), so scrubbing the page slider decodes only the spread it lands on. ImageStackViewview recycling — the stack storespageFramesfor every page (drives all geometry queries) but only materializesNSImageViewinstances for pages whose frames intersect the visible viewport ± 1 viewport buffer. A smallviewPool(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.setImagesfast path (count + axis match) just mutatesimageView.imagefor live views, so per-page lazy loads cost a pointer write each.ViewerController—@Observable @MainActorremote control owned byPanelyAppand shared via environment. Holds a weakNSScrollViewrefbaseMagnificationsynced byapplyFit, exposeszoomIn/zoomOut(1.25× clamped to min/max, viewport-centered) andresetZoomso toolbar buttons + menu shortcuts (⌘+/⌘-/⌘0) and⌘ + scroll wheelall hit the same code path.
SidebarMode— a tiny pure value-type owningpinnedandoverlayVisible.ReaderPreferencesholds the instance and persists onlypinned;ReaderViewModelforwardssidebarPinned/sidebarOverlayVisible/sidebarVisible(computed) so view callsites are unchanged. Hot-edge hover reveal lives inReaderSceneas a smallHotEdgeRevealSwiftUI view that firesrevealSidebarOverlay()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. APositionKey.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>orarchive:<archiveURL>#<signature>#<entryPath>. Re-opening the same book yields the sameid, so image and thumbnailNSCacheentries 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 decodedNSImages with automatic memory-pressure eviction.countLimit = 100is intentionally loose so vertical lazy windows (lazyWindowRadius + lazyKeepBuffer≈ 25 pinned pages) aren't truncated by LRU eviction while still under the real budget —totalCostLimitscales 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'spixelsWide × pixelsHigh × (bitsPerSample × samplesPerPixel / 8)so Retina backing and 16-bit/HDR scans aren't under-priced. Preload runs a cancellableTaskaround the current page ±2 in paged modes; cancellation propagates intoImageLoader.loadandpreloadIfNeededso abandoned work doesn't pollute the cache during fast keyboard navigation.- Persistent store safety —
PageBookmarksStorecaps 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 underUserDefaults'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. BothRecentItemsStore.resolveandFavoritesStore.resolveregenerate 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 throughKeyValueStoring.loadCodable(_:forKey:)/saveCodable(_:forKey:)inCore/Extensions/(LiveKeyValueStoreis backed byUserDefaults). - 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.extractedSizeExceededis thrown and partial extraction is cleaned up. Protects against zip-bombs and pathological nested archives that slip pastmaxNestingDepth. - Startup temp-dir cleanup —
ReaderTempDirectory.cleanupStaleEntriesonly removes sessionpanely-<uuid>directories whosecontentModificationDateis 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, whoseenforceBudget()is invoked by the same startup hook. - Content-addressed extraction cache —
ExtractionCacheStorehashes the source archive's path + size + mtime incacheKey(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 tomakeCachedCandidate(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 —
clampedRestoredIndexclamps to the last step-aligned index (((pageCount - 1) / step) * step) instead ofpageCount - 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:)andattachBoundsObserver(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'sdeinit. Covered byAppKitScrollerCoordinatorTests(no-double-fire on re-attach, deinit no-leak). - Eager-decode image pipeline —
ImageLoader.loadrunsCGImageSourceCreateWithURL(zero-copy mmap for file URLs) /CGImageSourceCreateWithData(archive entries) inside aTask.detached, withkCGImageSourceShouldCacheImmediately: trueso the returned NSImage backs onto a fully-realized CGImage. Avoids the lazy decode thatNSImage(data:)defers to first draw on the main thread. - Paged refresh parallelism —
refreshPageddecodes the visible spread (2 pages in double-page mode) concurrently viawithTaskGroupand commits a singlecurrentImageswrite in original order. Single layout is unaffected; double layout finishes ~2× faster. - Series continuous reading —
ReaderViewModel.showsEndOfVolumeCardis the pure predicateisAtLastPage && canGoNextVolume; the prev counterpart (showsPreviousVolumeCard) is gated behind a transientwantsPreviousVolumePromptcue that arms only on explicit user intent (a backward press at page 0, or arriving at page 0 viagoBackward()from a higher page). Any subsequentcurrentPageIndexchange clears the cue, andload(url:)resets it on every new book so opening a fresh volume doesn't surface the prompt prematurely. Forward / backward keyboard handlers route throughadvanceForward()/goBackward()so a single press of the matching key advances the volume when the card is showing. - Thumbnail cache —
ThumbnailLoadergenerates downscaled NSImages viaCGImageSourceCreateThumbnailAtIndex(skips full-resolution decode) and stores them in anNSCache(countLimit = 400,totalCostLimit ≈ 60 MB). The thumbnail sidebar'sLazyVStackonly materializes visible cells;.taskauto-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 byLibrarySidebar) 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.loadTreeparallelizes top-level subtree scans via chunkedTaskGroupso big libraries open in ~100–200 ms instead of 1–2 s. - Settings batch-read —
ReaderPreferences.initsnapshots the injectedKeyValueStoring.dictionaryRepresentation()once and reads every key from the in-memory dict, avoiding a dozen separate cross-processUserDefaultscalls on cold start in the live store. - Debounced position save with in-memory mirror —
currentPageIndex's didSet routes toReaderPositionStore.savePosition(...), which schedules a 300 ms-debounced write so vertical-scroll-driven page changes at ~60 Hz don't fan out to per-frameUserDefaultswrites. 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.willTerminateNotificationflushes the pending write before quit.
- one
- Security-scoped bookmarks — Recent items and favorites persist across
launches because we create
.withSecurityScopebookmarks and resolve them on click. The active library-root grant lives onReaderLibraryScope(one URL at a time,acquire/releasepaired), 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 —
PanelyAppDelegatereturns true fromapplicationShouldTerminateAfterLastWindowClosedso 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.
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 promptThe script:
- 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. - Runs local tests (set
SKIP_TESTS=1to skip). - Bumps
MARKETING_VERSIONinproject.pbxproj, setsCURRENT_PROJECT_VERSIONto the git commit count, and stamps the current commit's short SHA intoPanely/Credits.rtf(shown in the About panel). - Shows the diff, asks for confirmation, then commits
(
chore: release vX.Y.Z) and creates an annotated tag. - Asks again, then pushes
mainand the tag (setNO_PUSH=1to 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 runs on pushes and PRs to
main(skips**/*.md,docs/**andLICENSE; 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.SnapshotGalleryTestsis gated off by default because it is a PNG generator; regenerate the manual's PNGs withscripts/generate-snapshots.shwhen needed. CI runs the fast tier only:VisualRegressionTestsand 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
dittoso resource forks are preserved. The description is the tag'sdocs/releases/vX.Y.Z.mdplus generated release notes. - SPM cache speeds up subsequent runs; invalidates on
Package.resolvedorproject.pbxprojchanges.
If you edit docs/icon/panely-icon-stacked.svg, regenerate the icns:
scripts/generate-app-icon.shThis 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.
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.
Apache License 2.0 — see LICENSE.