Templates, Import, Export, and Migration: Shipping AutoShelf as a Real Product
AutoShelf lets you import and export rule configurations. This is useful for sharing templates between machines.
// journey
Guides, tips, and ideas for keeping your Mac organized.
AutoShelf lets you import and export rule configurations. This is useful for sharing templates between machines.
AutoShelf ships as a single binary that runs in two modes: the GUI app and a CLI tool. Both access the same SwiftData store.
When a file matches a rule's conditions, AutoShelf runs each action in sequence through a pipeline. Each action is an asynchronous operation with error handling.
The confirmation delay system lets users set a delay before actions execute and optionally require manual confirmation.
After trying both FSEvents and DispatchSource, I settled on DispatchSource for file system monitoring in AutoShelf. Here is why.
The file operator is the biggest file in the AutoShelf codebase at 873 lines. It is an actor that handles moving, copying, trashing, renaming, tagging, archiving, optimizing, converting, and importing files to Photos.
The heart of AutoShelf is the rule engine. It is the thing that looks at a file and decides what to do with it. The condition evaluation logic lives in about 140 lines of Swift inside `RuleEngine.swift`.
AutoShelf has exactly one external dependency: ZIPFoundation, for creating zip archives. Everything else is Apple frameworks and my own code. I wanted to keep it that way for the MCP server.
AutoShelf uses Unix domain sockets for IPC between the app and its helper tool. The sockets live in a sandbox-compatible directory and use JSON for message serialization.