feat(library): projects & archive UI — S2 (#108)
CI / ci (push) Canceled after 0s

Variant B per the #104 prototype verdict: the library column groups
pieces by project (serif lowercase heads, collapse toggle, Pass-State
groups inside, 2px edge-bar selection shared with the new Archive
pane via LibraryPostRow). Move to Project / Archive / Move Back /
whole-project Unarchive are folder moves — post.md bytes untouched,
never clobbering, ids globally unique. File ▸ New Post ⌘N and New
Project… ⌥⌘N (CommandGroup, never CommandMenu per #84).

Every folder move flushes pending edits first and aborts when the
write failed — nothing moves without its text. Project membership and
the archived-refusal derive from freshly resolved disk paths, never
the scan snapshot. Slug and project-name comparisons fold through one
canonical key (NFC + lowercase). Two reviewer fanouts this session;
their findings are all fixed or visibly parked.

144/144 tests green (run twice), swiftformat/swiftlint clean.

Closes #108
This commit is contained in:
AlexKucera committed 2026-10-13 22:18:24 +02:00
1 parent 9da3a07f4a
commit e55747e7fe
15 files changed
+1205 -68

No files matched your search

+10 -5
View File
@@ -176,20 +176,25 @@ final class EditorSession {
// MARK: Flush (#64/#65/#66)
/// Write body (+ post sidecar) now. ⌘S, debounce fire, selection change,
/// window close, and app quit all land here. No-op when clean or when
/// the document never loaded (a failed read must not become a write
/// that destroys the file).
func flush() {
/// window close, and app quit all land here. No-op when clean or when the
/// document never loaded (a failed read must not become a write
/// that destroys the file). #108 audit: reports success — the flush-first
/// ops (move/archive/rename/restore) abort on false instead of moving a
/// piece whose edits failed to land.
@discardableResult
func flush() -> Bool {
debounceTask?.cancel()
guard !loadFailed, text != lastFlushedText else { return }
guard !loadFailed, text != lastFlushedText else { return true }
do {
try writeDocument()
lastFlushedText = text
saveState = .saved
onError?(nil)
return true
} catch {
saveState = .failed
onError?(error.localizedDescription)
return false
}
}