feat(posts): reveal in Finder and copy path
Every piece row gains a Finder hand-off: Reveal in Finder opens the piece's post.md selected, Copy Path puts its absolute path on the clipboard (#205). One shared FinderHandOffButtons fragment in the workspace chrome serves both menus - the library column (between Move to Archive and the destructive Trash) and the Archive pane (appended after Convert). Both act on PostsModel.fileURL(for:), which resolves the piece through the one PostStore.folder(of:home:) resolver against the watched Home (never the scan snapshot) and answers nil when the piece is gone, so a vanished row no-ops instead of revealing a stale path. fileURL lives in PostsModelIdentity - the (Home, ID) file - not the write rail: a pure read, nothing written, no strip. A View-extension wrapper was tried and deleted as a Middle Man; the menus mount the struct directly. +3 tests (projects/ resolve, archive/ resolve, vanished -> nil), flip-verified: bypassing the resolver reddens exactly the vanished and archive pins (733/735). Rail 735/735; SwiftFormat and SwiftLint clean. Reviews: standards + spec (two rounds), then finish-audit (general, security, ponytail) - the audit added the archive-root pin and fixed three stale headers. DOX: five Museion/AGENTS bullets. The release 0.1.2 log's rows still belong to another session and stay in the working tree; INDEX and the AGENTS window here carry only the #205 row. Closes #205
This commit is contained in:
1 parent
dd8637e7c7
commit
9aa0314564
10 files changed
+161
-9
No files matched your search
@@ -176,7 +176,8 @@ Session logs live in `docs/devlog/` (one per completed task/issue/milestone). Fu
|
||||
|
||||
<!-- write-log: window-start -->
|
||||
| Date | Log |
|
||||
| --- | --- |
|
||||
|------|-----|
|
||||
| 2026-12-03 | [20261203-issue205-reveal-in-finder-copy-path_log.md](20261203-issue205-reveal-in-finder-copy-path_log.md) |
|
||||
| 2026-12-03 | [20261203-issue204-fix-cards-jump-to-the-anchor_log.md](20261203-issue204-fix-cards-jump-to-the-anchor_log.md) |
|
||||
| 2026-12-03 | [20261203-image-drop-27-2-drag-routing-pastes-path_log.md](20261203-image-drop-27-2-drag-routing-pastes-path_log.md) |
|
||||
| 2026-12-03 | [20261203-release-011-apex-refresh-is-step-one_log.md](20261203-release-011-apex-refresh-is-step-one_log.md) |
|
||||
@@ -186,6 +187,4 @@ Session logs live in `docs/devlog/` (one per completed task/issue/milestone). Fu
|
||||
| 2026-11-19 | [20261119-issue200-gate-quit-time-flushes-through-departure-gate_log.md](20261119-issue200-gate-quit-time-flushes-through-departure-gate_log.md) |
|
||||
| 2026-11-17 | [20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md](20261117-acp-backpressure-defeats-timeout-and-shutdown_log.md) |
|
||||
| 2026-11-17 | [20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md](20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md) |
|
||||
| 2026-11-17 | [20261117-issue192-collapse-gate-running-learnings-into-verify-rail-pointer_log.md](20261117-issue192-collapse-gate-running-learnings-into-verify-rail-pointer_log.md) |
|
||||
|
||||
<!-- write-log: window-end -->
|
||||
@@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file. The format
|
||||
|
||||
### Added
|
||||
|
||||
- **library:** **Reveal in Finder** and **Copy Path** on every piece row — the library column's menu and the Archive pane's (#205) — one shared `FinderHandOffButtons` fragment in the workspace chrome over a model-resolved path: `PostsModel.fileURL(for:)` answers the piece's `post.md` through the one `PostStore.folder(of:home:)` resolver against the watched Home (never the scan snapshot), and a vanished piece answers nil so both entries no-op instead of revealing a stale path. Reveal selects the file in Finder; Copy Path puts the POSIX path on the pasteboard (Finder's own form; the pasteboard is cleared first). Library placement sits between Move to Archive and the destructive Trash behind a divider; the Archive menu appends after Convert. +3 tests (projects/ resolve, archive/ resolve, vanished → nil), flip-verified — bypassing the resolver reddens exactly the vanished and archive pins. Suite 735
|
||||
|
||||
- **fix cards:** **Jump** on a Fix Card selects the anchor's span in the piece's editor and makes the main window key (#204) — the borderless button sits in every non-stale card's action row (closed cards keep it; a stale anchor has nothing to land on); the span is the card's quote at its 1-based occurrence, resolved against the LIVE session text so a dirty buffer still lands, and it rides the reading flip-back's caret rail (one token counter; a zero-length hint stays a bare caret, a non-zero range selects). A jump leaves reading mode first, writes nothing, and re-fires on every click. Two review rounds closed the view-layer gaps the pure pins could not see: a jump dropped in reading mode, a main window that never became key (`NSApp.activate` is a no-op once the palette's click activated the app), a leading-blank caret hop that moved a span onto the title, and a cursor record taken before the scroll. +3 tests (`anchorRange` occurrence math with a UTF-16 fixture, the model's reveal stamp, the editor's `landingSpan`), all flip-verified. Suite 732
|
||||
|
||||
## [0.1.2] - 2026-12-03
|
||||
|
||||
+5
-5
@@ -24,12 +24,12 @@ The map and the contracts, one bullet per file. Pin-level detail lives in the te
|
||||
|
||||
- `DesignTokens.swift` — palette/geometry. Two-color world, live-calibrated (deliberate departure from the export palette): `background` #FAF9F3 (chrome + focus ground), `surface` #FFFEFB (one page color for edit AND read); light-only, the single semantic exception `readyGreen` (the mentor ready dot — a meaning, never a style color). Radius 10; column widths rail 56 / library 232 / mentor 356; chat face constructors `valkyrie`/`concourse`/`ubuntuMono` (Font.custom falls back to system).
|
||||
- `WorkspaceView.swift` — first-frame main surface, rendered unconditionally (gateless: the engine check runs async beside it). Nav rail Posts / Sessions / Learnings / Trends / Archive + engine-status pill + Settings. Column collapse mirrors the export's media queries as pane collapse — library hides < 1100 px, mentor < 920 px; never a fixed four-column minWidth. Window-level `.dropDestination`: the drop surface for drags that land OUTSIDE the editor — macOS 27.2.1 routes a drag to the DEEPEST destination, so over the editor the text view takes the drag itself (`FileDropTextView`'s drag handlers) and this destination never fires (the inverse of the 27.0.1 ruling #141 was verified on); both route through `AppGateState.routeFileDrop` — the ONE file-drop router (pure-markdown → external guest, anything else → `ingestDrop`, Cold Turkey–guarded; a mixed md+image set and web URLs refuse loudly). A landed drop hops to Posts (unreachable for images today — the editor mounts only there). The house ask sheets present here (pending-state + binding pattern; the sheet structs live in `WorkspaceViewSheets.swift`, #193). #193 splits: `ArchivePaneView` → `ArchivePaneView.swift`, shared chrome (`SelectedRowStrip`/`BorderedSecondaryButtonStyle`/`PaneHeader`) → `WorkspaceChrome.swift`; `RailButton` stays here (the rail is its only caller).
|
||||
- `ArchivePaneView.swift` — #193: the #108 Archive pane (moved from WorkspaceView.swift) — archive/ as a rail destination, List-only: clicking a piece selects it and hops to Posts (where the editor column lives); reuses `LibraryPostRow`.
|
||||
- `ArchivePaneView.swift` — #193: the #108 Archive pane (moved from WorkspaceView.swift) — archive/ as a rail destination, List-only: clicking a piece selects it and hops to Posts (where the editor column lives); reuses `LibraryPostRow`. Row menu: Move Back / Rename / Convert, plus #205 Reveal in Finder / Copy Path.
|
||||
- `WorkspaceViewSheets.swift` — #193: the house ask sheets (moved from WorkspaceView.swift) — `OriginAskSheet` (the ONE origin ask per import batch, #94), `OutlineGuardSheet` (#111 mixed-content), `ConvertSheet` (#114), `NewProjectSheet` (#108).
|
||||
- `WorkspaceChrome.swift` — #193: the shared chrome (moved from WorkspaceView.swift) — `SelectedRowStrip` (the selected-row capsule), `BorderedSecondaryButtonStyle` (the bordered secondary button), `PaneHeader` (the 52pt pane-head row); every pane reuses them.
|
||||
- `WorkspaceChrome.swift` — #193: the shared chrome (moved from WorkspaceView.swift) — `SelectedRowStrip` (the selected-row capsule), `BorderedSecondaryButtonStyle` (the bordered secondary button), `PaneHeader` (the 52pt pane-head row); every pane reuses them. #205 `FinderHandOffButtons` — the ONE Reveal in Finder / Copy Path fragment every piece-listing row menu mounts directly (library column, Archive pane); both act on `model.fileURL(for:)`, a nil URL no-ops.
|
||||
- `PostsPaneView.swift` — Posts destination (#193: the library column and the row live in their own files): editor column, mentor column (fixed 356). Editor column renders the external guest ahead of the post session (one guest at a time). Focused branch mounts the Cold Turkey chrome as overlays; lock transitions never restructure the editor column.
|
||||
- `PostsLibraryColumn.swift` — #193: the library column (moved from PostsPaneView.swift), shared by the unfocused layout and the focus-mode left reveal — one implementation, both surfaces. Project section heads + Pass-State groups, collapse toggle per-view; owns the rename + move sheets (`RenamePostSheet`, `MoveToProjectSheet`) and the row context menu. Library search: debounced, title+body over non-archived pieces through the file-scope `librarySearch` mount, body scan off-main through `readBody` (frontmatter never searched). `LaunchFocusReset` (r8) rides the column: the window's first become-key resigns focus back to the window, once per process.
|
||||
- `LibraryPostRow.swift` — #193: the post row (moved from PostsPaneView.swift) — 2px leading strip, ✳ on outline pieces, row menu Rename/Convert/Move to Project/Move to Archive/Trash; the Archive pane reuses it.
|
||||
- `PostsLibraryColumn.swift` — #193: the library column (moved from PostsPaneView.swift), shared by the unfocused layout and the focus-mode left reveal — one implementation, both surfaces. Project section heads + Pass-State groups, collapse toggle per-view; owns the rename + move sheets (`RenamePostSheet`, `MoveToProjectSheet`) and the row context menu (#205: the shared `FinderHandOffButtons` fragment, between Move to Archive and Trash). Library search: debounced, title+body over non-archived pieces through the file-scope `librarySearch` mount, body scan off-main through `readBody` (frontmatter never searched). `LaunchFocusReset` (r8) rides the column: the window's first become-key resigns focus back to the window, once per process.
|
||||
- `LibraryPostRow.swift` — #193: the post row (moved from PostsPaneView.swift) — 2px leading strip, ✳ on outline pieces, row menu Rename/Convert/Move to Project/Move to Archive/Reveal in Finder/Copy Path/Trash (the menu is attached by the callers — `PostsLibraryColumn.swift`, `ArchivePaneView.swift`); the Archive pane reuses it.
|
||||
- `PostLibrary.swift` — `Post` + `Post.scan`: two-level scan over `projects/<name>/<id>/post.md` AND `archive/<name>/<id>/post.md` (ADR-0012), skip guards at both levels (lazy folders, loose files, hidden dirs, symlinked dirs); frontmatter keys read leniently (First Draft/writer/post defaults); title = first non-empty body line, `untitled` fallbacks; runs off-main. `stats_*` keys load only if EVERY value parses finite (a non-finite peak would trap the chart y-domain); read-back re-gates on the named immutable pair (`PostFrontmatter.isUnaidedFirstDraftPair` — origin writer, type post; never pass_state, which legitimately advances). `scan(home:cache:)` takes a `PostScanCache` (path+mtime+size memo; the stamp is taken BEFORE the read, so a mid-scan rewrite can never pin as fresh). `micropubURL` gated on `Micropub.trustworthyURL` — imported YAML rides verbatim, so hostile values scan nil.
|
||||
- `PostFrontmatter.swift` — #180: the Post frontmatter codec — the ONE lenient read (`parse`/`split`/`decoded`) and the three write postures behind one known-key table (`ownedKeys`: type, pass_state, origin — one insertion-order rule): fresh stamp (`stamped`), merge-import (`mergingImport` — external keys verbatim, ours win), update-keys (`updating` — the in-place line-walk, every other line byte-identical). Absorbed and deleted `PostStore.stamped/splitFrontmatter/mergedFrontmatter` and `LearningDecay.stampingFrontmatter` byte-identically (merge-import's documented prefix-preservation divergence excepted). Owns the two named eligibility predicates both gates consume: `isUnaidedFirstDraftPair` (writer ∧ post — the scan's read-back gate) and `isCaptureEligible` (pair ∧ First Draft — the capture gate). Learning/Fix Card documents stay out of scope; the learnings dismiss stamp rides the generic update posture.
|
||||
- `PostStore.swift` — write side (nonisolated). Shared slug (lowercase, diacritic-fold, strip punctuation, whitespace→hyphens, keep CJK, 80-char cap); collision suffixes over the GLOBAL slug space (projects + archive — an archived slug is never reused), all comparisons through `folded` = NFC + lowercase (APFS is case- and normalization-insensitive); `folder(of:home:)` is the ONE id→folder resolver — write paths derive their target from the id alone. `writeNew` defaults `type: .post` / `origin: .writer` (session-born pieces pass `.ai`, immutable). `overwrite` preserves type/pass_state/origin and updates owned keys IN PLACE via the codec's update posture — block rewrites erase captured stats and foreign frontmatter. `rename` = retitle + move within the same parent. `importFile` copies (never moves), strips BOM + normalizes CRLF→LF at the boundary, external YAML keys verbatim with our `type`/`pass_state`/`origin` winning. Project ops (`move`/`archive`/`restore`/`unarchiveProject`/`createProject`) derive current state from the resolved DISK path, never the scan snapshot; post.md bytes are never rewritten by them; `createProject` validates names (empty/slash/dot/`:`/control + case-insensitive duplicates throw). Pass substrate: `snapshotPass` (pre-pass body verbatim to `passes/pass-<n>.md`, fixed name per type), `advancePassState` (monotonic, in-place stamp; also ticks the decay clock — a failed tick never fails a pass). `writeResearchNote` is the ONLY path to `research/` (a symlinked dir refuses). `captureFirstDraftStats` — eligibility is the codec's named `isCaptureEligible` predicate over the file's own frontmatter; failure never fails the pass. `ingestImage` copies into `assets/`, publishable types only (what can't ship can't enter; a file the disk can't stat refuses as `missing`, never as a folder); `illustrationRef` is the one `` builder.
|
||||
@@ -41,7 +41,7 @@ The map and the contracts, one bullet per file. Pin-level detail lives in the te
|
||||
- `Pass.swift` — `PassKind` (pass1/pass2 — the app's own names) + `PassContext.stub` (the pinned minimal engine prompt: verdict in the reply, findings as fix-card tool calls, research as candidate tool calls — the engine never writes to the piece folder) + `estimateTokens` (chars/4).
|
||||
- `BlindRead.swift` — neutral "Version A/B" prompt (both bodies inline, origin-free words never appear — the judge must not know which is the rewrite; caller randomizes order), ask = pick + one line why; `reveal` mapping appended by the model ONLY after the turn ends.
|
||||
- Micropub (`Micropub.swift`, `MicropubMedia.swift`, `MicropubPublishSheet.swift`) — the Micro.blog publish path. Client over the injectable Transport: draft = h=entry (name, markdown content verbatim, post-status draft, sorted keys; `category:` frontmatter NEVER travels; NO `photo` property — uploaded illustrations ride INLINE in content, refs rewritten to uploaded URLs on the WIRE only, the piece on disk never changes). Every URL through `trustworthyURL` (https + host + no line/control characters — the URL is trust-boundary data landing in frontmatter); 401/403 → authFailed with `error_description`; `preview` is display-only, never the publish target. `MicropubTokenStore` = the app's own login-keychain credential (ADR-0014's no-Keychain rule covers only provider keys). Media: `illustrations(in:)` parses only `` refs (remote refs ride as prose; multi-line alts don't parse at all — by design); parse + rewrite share ONE regex; markdown-active URLs ride the angle form. The model rail (`uploadIllustrations`) is the publish FLOOR: whitespace-empty alt refuses BEFORE any wire traffic, payload reads are contained (`../` or a symlinked asset refuses), uploads are all-or-nothing, style judgment stays with the author. The sheet owns Send as Draft → Publish, each an explicit click; refusals inline with buttons kept.
|
||||
- `PostsModel.swift` — @MainActor @Observable, app-scoped. Domain extensions live in their own files (guard+Convert `PostsModelOutline.swift`, passes+Blind Read `PostsModelPasses.swift`, fix cards `PostsModelCards.swift`, write rail+structural ops `PostsModelWrites.swift`, external guest+imports `PostsModelImports.swift`, watcher+rescan `PostsModelWatcher.swift` (home of `PostsWatcher`) — the #146/#193 splits). **#179 write rail**: every library store write (draft save, session-born post, rename, move to project, archive/restore, trash, convert, project creation, import batch, pass advance) rides `performWrite` — ONE seam pairing the write with exactly one rescan and owning the error strip (cleared BEFORE the write, so importFiles' mid-closure per-file failures survive; a nil-Home refusal writes nothing); the MODEL owns the Home (`watchedHome` — written only by the watcher extension's `startWatching` behind `bind`, driven by WorkspaceView's root `.task(id: museionHome)` (first frame + every repoint, whichever pane is showing); no public method takes a Home parameter); the editor's debounced flush and the micropub publish stay OUTSIDE the rail (own error semantics). `PostDraft` in-memory until first save; `mountID` keys the editor `.id` so every staging REMOUNTS (the outliner re-seeds its tree). Mixed-outline guard: a lossy outline select HOLDS the ask over an empty editor (nothing can normalize on ⌘S before the choice); reselect of the held piece is a no-op. Convert: consent rechecked at answer time (Headings aborts when the body went lossy behind the ask); converting the open piece tears down and reopens routed prose. `runPass` chain: guards through `guardOpenPieceRun` (#181: the ONE guard rail shared with blindRead — nothing running, mentor not mid-turn, engine ready, open saved piece) → readiness (missingKey names the provider) → flush → snapshot (unconditional, even for a later cancel) → capture stats → lint emit → `runningPass` live → own-engine run → advance ONLY on `.ended` with stopReason ≠ "refusal"; #179 audit: a Home repoint across the engine's turn REFUSES the advance with a strip message (the rail resolves `watchedHome` at call time — stamping into the repointed library would be silent on a slug collision). `blindRead` rides the same guard rail; nothing advances or records. `refreshCards` rides the rescan + open tails; `applyCard` = flush-first, stale anchor flags the card with no text change, the edit lands through `EditorSession.adoptText`; `promoteCard` writes a Learning and touches no text; #204 `revealCard` stamps ONE `revealRequest` (the anchor's span in the LIVE session text + a per-jump token) — a view act, nothing written; the editor column feeds it into the #71 caret rail (`caretHint`, now a `FixCardRevealRequest` — a non-zero range selects the span). `micropubSendDraft` = flush-first, ONE disk read serves both wire fields, success stamps `micropub_url`. `canArmWritingLock`/`editorBodyText` mirror the editor's outline routing (prose only). #200: quit is a document departure — `shutdown()` routes both sessions through `documentsMayDepart` (void — the verdict channel is quitReply's); `PostsModel.active` (weak static, registered by `AppGateState.init` — the `WritingLockState.active` precedent) is the quit gate's reachability, bare test rigs never register.
|
||||
- `PostsModel.swift` — @MainActor @Observable, app-scoped. Domain extensions live in their own files (guard+Convert `PostsModelOutline.swift`, passes+Blind Read `PostsModelPasses.swift`, fix cards `PostsModelCards.swift`, write rail+structural ops `PostsModelWrites.swift`, external guest+imports `PostsModelImports.swift`, watcher+rescan `PostsModelWatcher.swift` (home of `PostsWatcher`), (Home, ID) identity `PostsModelIdentity.swift` — `openSessionTargets` + #205 `fileURL(for:)`, the row menus' post.md path, a pure read) — the #146/#193 splits. **#179 write rail**: every library store write (draft save, session-born post, rename, move to project, archive/restore, trash, convert, project creation, import batch, pass advance) rides `performWrite` — ONE seam pairing the write with exactly one rescan and owning the error strip (cleared BEFORE the write, so importFiles' mid-closure per-file failures survive; a nil-Home refusal writes nothing); the MODEL owns the Home (`watchedHome` — written only by the watcher extension's `startWatching` behind `bind`, driven by WorkspaceView's root `.task(id: museionHome)` (first frame + every repoint, whichever pane is showing); no public method takes a Home parameter); the editor's debounced flush and the micropub publish stay OUTSIDE the rail (own error semantics). `PostDraft` in-memory until first save; `mountID` keys the editor `.id` so every staging REMOUNTS (the outliner re-seeds its tree). Mixed-outline guard: a lossy outline select HOLDS the ask over an empty editor (nothing can normalize on ⌘S before the choice); reselect of the held piece is a no-op. Convert: consent rechecked at answer time (Headings aborts when the body went lossy behind the ask); converting the open piece tears down and reopens routed prose. `runPass` chain: guards through `guardOpenPieceRun` (#181: the ONE guard rail shared with blindRead — nothing running, mentor not mid-turn, engine ready, open saved piece) → readiness (missingKey names the provider) → flush → snapshot (unconditional, even for a later cancel) → capture stats → lint emit → `runningPass` live → own-engine run → advance ONLY on `.ended` with stopReason ≠ "refusal"; #179 audit: a Home repoint across the engine's turn REFUSES the advance with a strip message (the rail resolves `watchedHome` at call time — stamping into the repointed library would be silent on a slug collision). `blindRead` rides the same guard rail; nothing advances or records. `refreshCards` rides the rescan + open tails; `applyCard` = flush-first, stale anchor flags the card with no text change, the edit lands through `EditorSession.adoptText`; `promoteCard` writes a Learning and touches no text; #204 `revealCard` stamps ONE `revealRequest` (the anchor's span in the LIVE session text + a per-jump token) — a view act, nothing written; the editor column feeds it into the #71 caret rail (`caretHint`, now a `FixCardRevealRequest` — a non-zero range selects the span). `micropubSendDraft` = flush-first, ONE disk read serves both wire fields, success stamps `micropub_url`. `canArmWritingLock`/`editorBodyText` mirror the editor's outline routing (prose only). #200: quit is a document departure — `shutdown()` routes both sessions through `documentsMayDepart` (void — the verdict channel is quitReply's); `PostsModel.active` (weak static, registered by `AppGateState.init` — the `WritingLockState.active` precedent) is the quit gate's reachability, bare test rigs never register.
|
||||
- `PostsModelWatcher.swift` — #193: the watching domain of PostsModel (moved from PostsModel.swift) — `PostsWatcher` (recursive FSEvents stream, file-level, 0.5 s latency) on BOTH `projects/` and `archive/`; `bind(home:)` (WorkspaceView's root `.task(id: museionHome)` drives it); `startWatching` (the one `watchedHome` writer); `rescan` off-main through the app-scoped scan cache, skipping the `posts` assignment on equality (@Observable invalidates on assignment — panes would regroup on autosave echoes), bumping `contentRevision` on list change OR cache miss (#144), handing the session the open post's disk text (the #67 check, watcher echo suppressed by equality), riding the cards refresh at the tail.
|
||||
- `PostsModelWrites.swift` — #193: the #179 write rail + structural ops (moved from PostsModel.swift) — `performWrite` (ONE seam: write + exactly one rescan + the error strip, cleared before the write), `flushOrAbort` (flush-first; a failed write, an unanswered #67 conflict, or a never-loaded session's retyped words abort with nothing changed — the alert stays up), `documentsMayDepart` (#200: the departure gate's quit run — shutdown's flush half shared with `applicationShouldTerminate`; BLOCK-QUIT posture, never silently drop), rename, trash, the #108 project ops (create/stage, `moveTargets`, move to project, archive/restore/unarchive); document departure (new post/outline, select, open external, guest dismissal) rides the same gates through `sessionMayDepart`/`departOpenDocuments` — a navigation whose outgoing flush fails aborts with the dirty session retained (brief-25).
|
||||
- `PostsModelImports.swift` — #193: the external guest (#91–#93) + import batch (#94/#95) (moved from PostsModel.swift) — `openExternal`/`dismissExternal` (`-> Bool` — false holds the departure)/the guest watch (one guest at a time, symlink-resolved — an atomic write renames over a symlink — dismissed flush-first by any post/draft open — held by the departure gate when its flush fails (brief-25: the guest, its buffer, and its watcher stay live until the edits land)); `stageImport`/`cancelImport`/`importFiles` (ONE origin ask per batch, per-file failures continue into `lastError`).
|
||||
|
||||
@@ -134,6 +134,8 @@ struct ArchivePaneView: View {
|
||||
model.stageConversion(post)
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
FinderHandOffButtons(model: model, post: post)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,8 @@ struct PostsLibraryColumn: View {
|
||||
Button("Move to Archive") {
|
||||
model.archivePost(post)
|
||||
}
|
||||
Divider()
|
||||
FinderHandOffButtons(model: model, post: post)
|
||||
Button("Move to Trash", role: .destructive) {
|
||||
model.trash(post)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
// card refresh, Micropub. The bare `session.postID == id` comparison is
|
||||
// retired: two libraries can hold the same slug, and the id alone matched
|
||||
// a session retained from another library (the repoint finding's seam).
|
||||
// #205: also the piece's on-disk path (`fileURL(for:)`) — the same
|
||||
// (Home, ID) identity resolved to post.md for the row menus' Finder
|
||||
// hand-off; nil when the piece is gone.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@@ -22,4 +25,17 @@ extension PostsModel {
|
||||
guard let session, let home = watchedHome else { return false }
|
||||
return session.targets(postID: id, home: home)
|
||||
}
|
||||
|
||||
/// #205: the piece's `post.md` on disk — the row menus' Reveal in
|
||||
/// Finder / Copy Path target. The same (Home, ID) identity resolved to
|
||||
/// a path: `watchedHome` is the Home half, `PostStore.folder(of:)` the
|
||||
/// ONE id→folder resolver (never the scan snapshot — the folder is
|
||||
/// what Finder opens). A pure read — nothing written, no strip. Nil
|
||||
/// when the piece is gone, so the menu entries no-op instead of
|
||||
/// revealing a stale path.
|
||||
func fileURL(for post: Post) -> URL? {
|
||||
guard let home = watchedHome,
|
||||
let dir = PostStore.folder(of: post.id, home: home) else { return nil }
|
||||
return dir.appendingPathComponent("post.md")
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,11 @@
|
||||
//
|
||||
// #193: the shared workspace chrome, moved from WorkspaceView.swift
|
||||
// (file-length ceiling) — SelectedRowStrip, BorderedSecondaryButtonStyle,
|
||||
// PaneHeader; every pane reuses them, code unchanged.
|
||||
// PaneHeader; every pane reuses them, code unchanged. #205 adds
|
||||
// FinderHandOffButtons (born here).
|
||||
//
|
||||
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
|
||||
/// r6 (mercury#49/52, argon#13): the shared selected-row strip — a 2pt
|
||||
@@ -94,3 +96,26 @@ struct PaneHeader<Trailing: View>: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// #205: the row menus' Finder hand-off — Reveal in Finder + Copy Path,
|
||||
/// one fragment for every surface that lists pieces (the library column,
|
||||
/// the Archive pane). Both act on `model.fileURL(for:)` — the resolved
|
||||
/// `post.md`; a nil URL (the piece is gone) no-ops.
|
||||
struct FinderHandOffButtons: View {
|
||||
let model: PostsModel
|
||||
let post: Post
|
||||
|
||||
var body: some View {
|
||||
Button("Reveal in Finder") {
|
||||
if let url = model.fileURL(for: post) {
|
||||
NSWorkspace.shared.activateFileViewerSelecting([url])
|
||||
}
|
||||
}
|
||||
Button("Copy Path") {
|
||||
if let url = model.fileURL(for: post) {
|
||||
NSPasteboard.general.clearContents()
|
||||
NSPasteboard.general.setString(url.path, forType: .string)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@
|
||||
// #179: the write-rail pins — one seam pairs every library store write
|
||||
// with exactly one rescan and owns the error strip; the model owns the
|
||||
// Home (no method takes one).
|
||||
// #205: the row menus' Reveal in Finder / Copy Path target — the piece's
|
||||
// post.md resolved on disk; a vanished piece answers nil.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@@ -68,6 +70,37 @@ func makeModelHome() throws -> (PostsModel, URL) {
|
||||
#expect(model.lastError == nil)
|
||||
}
|
||||
|
||||
@Test @MainActor func `reveal and copy path resolve the post file on disk`() throws {
|
||||
let (model, home) = try makeModelHome()
|
||||
let post = try PostStore.writeNew(body: "# Find Me\n", project: "essays", home: home)
|
||||
|
||||
let url = model.fileURL(for: post)
|
||||
|
||||
let expected = home.appendingPathComponent("projects/essays/\(post.id)/post.md")
|
||||
#expect(url == expected)
|
||||
#expect(FileManager.default.fileExists(atPath: url?.path ?? ""))
|
||||
}
|
||||
|
||||
@Test @MainActor func `reveal and copy path answer nil for a vanished piece`() throws {
|
||||
let (model, home) = try makeModelHome()
|
||||
let post = try PostStore.writeNew(body: "# Ghost\n", home: home)
|
||||
try PostStore.trash(post, home: home)
|
||||
|
||||
#expect(model.fileURL(for: post) == nil)
|
||||
}
|
||||
|
||||
@Test @MainActor func `reveal and copy path resolve an archived piece off the archive root`() throws {
|
||||
let (model, home) = try makeModelHome()
|
||||
let post = try PostStore.writeNew(body: "# Shelved\n", project: "essays", home: home)
|
||||
try PostStore.archive(post, home: home)
|
||||
|
||||
let url = model.fileURL(for: post)
|
||||
|
||||
let expected = home.appendingPathComponent("archive/essays/\(post.id)/post.md")
|
||||
#expect(url == expected)
|
||||
#expect(FileManager.default.fileExists(atPath: url?.path ?? ""))
|
||||
}
|
||||
|
||||
@Test @MainActor func `new project draft lands in the named project`() throws {
|
||||
let (model, home) = try makeModelHome()
|
||||
try PostStore.createProject(named: "essays", home: home)
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
# #205 — Reveal in Finder + Copy Path on piece rows
|
||||
|
||||
> **Date:** 2026-12-03
|
||||
> **Type:** issue
|
||||
> **Reference:** https://git.babylondreams.de/AlexKucera/Museion/issues/205 — "Add Reveal in Finder and Copy Path to sidebar"
|
||||
|
||||
## Goal
|
||||
|
||||
Give every piece row a Finder hand-off: **Reveal in Finder** opens the piece's `post.md` selected, **Copy Path** puts its absolute path on the clipboard. The ticket was a title only — no body, no comments. The owner resolved the fog in one clarifying round: both the library column's row menu AND the Archive pane's row menu; the `post.md` FILE path (not the folder); Archive entries appended after its existing Move Back / Rename / Convert.
|
||||
|
||||
Scenario (the slice's north star): given a piece whose folder exists under the watched Home, right-click → Reveal / Copy Path → Finder opens with `post.md` selected / the absolute `post.md` path lands on the pasteboard — and a vanished piece (folder gone) does nothing, silently.
|
||||
|
||||
## What Was Done
|
||||
|
||||
- `Museion/PostsModelIdentity.swift` — `PostsModel.fileURL(for:) -> URL?`: the piece's `post.md` resolved through the ONE id→folder resolver `PostStore.folder(of:home:)` against the model-owned `watchedHome`. Pure read; nil when the folder is gone. Header names the second resident.
|
||||
- `Museion/WorkspaceChrome.swift` — `FinderHandOffButtons: View` (Reveal → `NSWorkspace.shared.activateFileViewerSelecting`, Copy Path → `NSPasteboard.general` `clearContents` + `setString(url.path)`), each behind `if let url = model.fileURL(for:)`. `import AppKit` added; header updated.
|
||||
- `Museion/PostsLibraryColumn.swift` + `Museion/ArchivePaneView.swift` — two lines each inside the existing `.contextMenu`: `Divider()` + `FinderHandOffButtons(model:post:)`. Library: between Move to Archive and the destructive Trash. Archive: appended after Convert.
|
||||
- `MuseionTests/PostsModelTests.swift` — three pins: projects/ resolve → exact URL + file exists; archive/ resolve → exact URL + file exists; vanished-after-trash → nil. Header lines added.
|
||||
- `Museion/AGENTS.md` — five bullets: WorkspaceChrome (the new struct), PostsLibraryColumn (the fragment's placement), PostsModel extensions list (names `PostsModelIdentity.swift`), LibraryPostRow (menu count + callers-attach attribution), PostsModelWrites (reverted to its original text after the read moved out).
|
||||
- Reviews: implement close (standards + spec, two rounds) and finish-audit (general + security + ponytail). Findings below.
|
||||
|
||||
## Decisions & Rationale
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| The seam is a model read, not a view helper | The SwiftUI menu body is untested by repo convention; `fileURL(for:)` is the observable the pins can reach. Resolves against `watchedHome` (the model owns the Home — no public method takes one, #179). |
|
||||
| `fileURL` lives in `PostsModelIdentity.swift`, not `PostsModelWrites.swift` | First landed in the writes file; the standards review flagged a read parked under `// MARK: Projects` in the write-rail file. The identity file's charter is "(Home, ID) questions route through here" — a path IS that identity resolved. Not the write rail: nothing written, no strip. |
|
||||
| One `FinderHandOffButtons` struct shared by both menus | First version pasted the two Buttons + AppKit closures into both menus verbatim (Duplicated Code). Extracted to the shared-chrome file. A `finderButtons(model:post:)` View-extension wrapper was tried and DELETED — a Middle Man: same-length call, module-wide extension for two callers. |
|
||||
| `post.md` path, POSIX `url.path` | Owner decision. Finder's own Copy Path yields the POSIX path; `url.absoluteString` would be a one-line swap if a `file://` form is ever wanted. |
|
||||
| nil when the piece is gone → both entries no-op | The scenario's third line. Never reveal a stale path; the next rescan drops the row. |
|
||||
| Three pins, not one | Each guards a distinct discriminator: projects/ resolve, archive/ resolve (D1 makes Archive half the feature — the general reviewer caught the gap), vanished → nil. The flip cycle proved the vanished and archive pins redden independently of the resolve pin. |
|
||||
| `clearContents()` before `setString` | Drops every declaration from the previous pasteboard owner — no stale file-URL or RTF flavor survives beside the new string (security review confirmed). |
|
||||
| Declined: rename `fileURL` → `postMDURL`/`documentURL` | Sibling of the resolver `folder(of:)`; the doc comment states the target. Reviewer judgement call, declined. |
|
||||
| Declined: folder-present-but-`post.md`-deleted edge | `folder(of:)` answers the directory; the file check is Finder's. Outside the scenario's "folder gone"; self-heals on rescan. |
|
||||
|
||||
## Gotchas & Fixes
|
||||
|
||||
| Problem | Root Cause | Fix |
|
||||
|---------|------------|-----|
|
||||
| `-only-testing` on the new pins printed `** TEST SUCCEEDED **` but the bundle said `executed: 0` | Backticked free-function names match zero Swift Testing tests under a name filter — the vacuous-green trap (#31/#134). Suite-name filters don't run free functions either (MuseionTests/AGENTS.md). | Stopped hand-rolling; the sanctioned rail `./scripts/full-test.sh start` + `status` is the only scoped-or-full verdict, counts from `xcresulttool` only. |
|
||||
| Two mis-patches in a row on `WorkspaceChrome.swift`'s tail (a collapsed newline in `PaneHeader.body`, then the new struct nested four levels deep inside `PaneHeader`) | The patch tool kept the leading tabs of my `old_string`; the end-of-file anchor had no trailing context to pin the column | After the second failure, rewrote the tail via a scripted read/replace/write instead of a third patch; verified 4 top-level structs, 0 extensions, balanced braces. Rule: two failed patches in one region → rewrite the enclosing region, don't patch a third time. |
|
||||
| Formatter flagged `ArchivePaneView.swift` closing brace (indent) — twice, same line | My inserted `.contextMenu` entries were right; the closing brace one tab off | `swiftformat` on the file; it touched only that brace (+14/−0 → pure additions). |
|
||||
| Standards review: 4 LOW findings on the first shape | Duplicated menu pair; read in the write-rail file; tautological `#expect(lastError == nil)`; test header missing #205 | All fixed; second-round review confirmed all four hold. |
|
||||
| Finish-audit fanout: 2 of 3 reviewer children died on HTTP 429 | Provider rate limit — three children plus the parent stream over the budget; both died before any tool call (transcripts held only the brief echo) | Solo, staggered re-dispatch after ~3 min cool-down; both completed. Nothing reported on a dead child. |
|
||||
| Post-fix lint flagged two files for trailing newline | The kernel's `write_file` after `read_file()["text"]` dropped the EOF newline in my own fix batch | `swiftformat` on the two files. Exactly why the audit skill says re-lint after fixes. The verify rail was re-run on the final bytes afterwards. |
|
||||
| RED proof: stashing the impl produced a compile error, not a test failure | The method didn't exist pre-fix — the pins can't build without the seam | That IS the honest red. The discriminating flip came later: bypassing the resolver (build `projects/<project>/<id>/post.md` without consulting disk) reddened exactly the vanished + archive pins (`733/735`), resolve pin green. |
|
||||
|
||||
## Files Changed
|
||||
|
||||
| File | Change Summary |
|
||||
|------|---------------|
|
||||
| `Museion/PostsModelIdentity.swift` | `fileURL(for:)` — the row menus' post.md resolver; header names #205 |
|
||||
| `Museion/WorkspaceChrome.swift` | `FinderHandOffButtons` struct + `import AppKit`; header updated |
|
||||
| `Museion/PostsLibraryColumn.swift` | `Divider()` + the fragment between Move to Archive and Trash |
|
||||
| `Museion/ArchivePaneView.swift` | `Divider()` + the fragment appended after Convert |
|
||||
| `MuseionTests/PostsModelTests.swift` | three pins (projects/ resolve, archive/ resolve, vanished → nil) + header |
|
||||
| `Museion/AGENTS.md` | five bullets (Chrome, LibraryColumn, PostsModel extensions, LibraryPostRow, Writes reverted) |
|
||||
| `docs/devlog/20261203-issue205-reveal-in-finder-copy-path_log.md` | this log |
|
||||
| `docs/devlog/INDEX.md`, `AGENTS.md` | log registration (row + 10-row window) |
|
||||
|
||||
## Verification
|
||||
|
||||
Final tree (run `20261203T171228Z`, postdates the last edit): `./scripts/full-test.sh` **735 executed / 735 passed / 0 failed** (734 baseline + 1 new pin… the three pins replaced the original two, net +1); `swiftformat --lint` exit 0, 0/5 files; `swiftlint lint` exit 0, 0 findings; `xcodebuild build` green. Flip: resolver bypass → `733/735`, exactly the vanished + archive pins red with their designed assertions.
|
||||
|
||||
## Open Items & Next Steps
|
||||
|
||||
- [ ] `DESIGN.md:188` row-menu enumeration ("Rename / Convert / Move / Trash") has been stale since #108 — pre-existing, outside the DOX chain, not this diff. Lands with the next DESIGN.md sweep.
|
||||
- [ ] Unpinned by convention: the SwiftUI menu bodies (labels, placement, `activateFileViewerSelecting`, pasteboard contents). Two review rounds were their only gate. Hand-test: right-click a piece in the library or Archive pane.
|
||||
|
||||
---
|
||||
|
||||
*Log written by write-log skill*
|
||||
@@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
<!-- write-log: full-index -->
|
||||
| Date | Type | File | Summary |
|
||||
|------|------|------|---------|
|
||||
| 2026-12-03 | issue | [20261203-issue205-reveal-in-finder-copy-path_log.md](20261203-issue205-reveal-in-finder-copy-path_log.md) | Reveal in Finder / Copy Path on library and Archive rows: one shared menu fragment over the model-resolved post.md path, three pins, rail 735/735 |
|
||||
| 2026-12-03 | issue | [20261203-issue204-fix-cards-jump-to-the-anchor_log.md](20261203-issue204-fix-cards-jump-to-the-anchor_log.md) | Fix Cards gain Jump: the anchor span selected in the editor, the main window keyed, over the #71 caret rail |
|
||||
| 2026-12-03 | generic | [20261203-image-drop-27-2-drag-routing-pastes-path_log.md](20261203-image-drop-27-2-drag-routing-pastes-path_log.md) | macOS 27.2 routes drags to the deepest view: NSTextView pasted the file path; the editor now owns drops through one router (rail 729/729) |
|
||||
| 2026-12-03 | milestone | [20261203-release-011-apex-refresh-is-step-one_log.md](20261203-release-011-apex-refresh-is-step-one_log.md) | Release 0.1.1: apex 1.1.59 refreshed FIRST (full recipe now in the release skill), bump + tag 4a056f9, rail 720/720, DMG notarized; push on go |
|
||||
|
||||
Reference in new issue
Block a user