feat(workspace): add M1 Home & Posts list — nav rail, posts mirror, Home repoint (fixes #17)

The post-gate main surface is the workspace shell from the design
contract: nav rail (Posts/Sessions/Learnings/Settings), Posts pane
mirroring <home>/posts/ on disk (Pass State groups, origin meta,
empty state; lazy folders skipped), Settings pane with repoint-only
Home picking (NSOpenPanel + UserDefaults, default ~/Documents/Museion
per b3daac9), placeholder panes until #28/#26. Column collapse
mirrors the export's media queries so narrow windows never clip.
Mentor pane becomes the fourth column (#14 surface preserved).

[Generated by AI]
This commit is contained in:
AlexKucera committed 2026-10-01 13:14:55 +02:00
1 parent b3daac9486
commit 804b5889f6
15 files changed
+762 -5

No files matched your search

@@ -0,0 +1,73 @@
# M1: Home & Posts list (#17)
> **Date:** 2026-10-01
> **Type:** issue
> **Reference:** https://git.babylondreams.de/AlexKucera/museion/issues/17
## Goal
Ship #17 (S1.1): the workspace shell from the design contract — nav rail (Posts, Sessions, Learnings, Settings), Posts pane mirroring the Home's `posts/` on disk with empty state, Home editable in Settings with repoint-only semantics, placeholder panes for Sessions/Learnings.
## What Was Done
- `DesignTokens.swift` — palette + geometry extracted from `museion-workspace.html` (`:root` vars, grid columns 56/232/min-420/356, radii 10/14, serif/mono designs).
- `WorkspaceView.swift` — post-gate root surface: nav rail + pane switch; `RailButton` with the export's selected-card + edge-bar treatment; honest placeholders for Sessions (#28) / Learnings (#26, #27).
- `PostsPaneView.swift` — Posts destination with Pass State group labels, post rows (title + mono meta), empty state, editor placeholder (#19–#21), mentor column (`MentorPaneView` at 356).
- `PostLibrary.swift` — `PostLibrary.scan(home:)`: mirrors `posts/` (dirs with `post.md` only — lazy folders and noise skipped), lenient frontmatter (`pass_state`/`origin`, First Draft/writer defaults), Title = first non-empty line after frontmatter with `#` stripped, `untitled` fallback.
- `SettingsPaneView.swift` — Home row + NSOpenPanel repoint; repoint-only copy in-UI.
- `AppGateState.museionHome` — UserDefaults-backed, default `~/Documents/Museion` (main's b3daac9 default, not the old `~/Museion` from the issue text).
- `MentorPaneView` root min-frame dropped (it's a column now).
- Tests (+7): PostLibraryTests — bare post defaults, lenient frontmatter, empty/missing home, lazy-folder + noise exclusion, title sort, untitled edges, default Home.
## Decisions & Rationale
| Decision | Rationale |
|----------|-----------|
| Column collapse instead of a fat minWidth | First build forced rail+library+editor+mentor minWidth (1064); the restored 900pt window clipped the rail and mentor off-screen (user hit it live). The export collapses at media-query thresholds (≤1100 library, ≤920 mentor); PRD says map that to macOS pane collapse. `GeometryReader` budget drives `showsLibrary`/`showsMentor`. |
| Lenient frontmatter read (`pass_state`/`origin` keys, defaults) | Corpus posts ship bare; the write-side key format is #18's to pin. CONTEXT.md: Pass State explicit, never inferred — First Draft default is the honest read of a bare post. |
| UserDefaults for the Home | A Home is a plain folder the user points at — nothing app-owned worth a database. Same floor as state.json reasoning. |
| NSOpenPanel over fileImporter | fileImporter's folder mode still shows files on macOS; one proven AppKit call beats bridging workarounds. |
| Explicit `AppGateState.init()` | `Self` in a stored-property initializer trips `@ObservationTracked` (covariant-Self compile error). |
| Scan on `.task(id: home)` only | #17 is read-only; no FS events yet — #18 adds lifecycle (create/rename/delete round-trips) and re-scan triggers. |
## Gotchas & Fixes
| Problem | Root Cause | Fix |
|---------|------------|-----|
| Empty posts list despite defaults write | `defaults write` from the agent's shell lives in a different cfprefsd context than the `open`-launched app; plist on disk never got the key | Verified scan logic standalone (swift REPL finds both posts); user-path verification (Settings → Choose…) is the honest route — CLI defaults injection is unreliable for GUI apps |
| Rail icons "invisible" in early screenshots | 900pt restored window < 1064 minWidth → HStack laid out at min size, clipping both edges | Column collapse (above) |
| `localizedStandardCompare` order surprise | It's Finder-like (case-insensitive, numeric-aware): "Beta 2" < "beta 10" | Test expectation corrected — the code is right |
| SwiftFormat reformatting drive-by (944-line prototype diff) | Ran `swiftformat .` repo-wide | Reverted untouched files; formatted only changed files after |
| AppleScript `by` reserved word | `set {bx, by} to position` — `by` is an AppleScript term | Renamed to `btnPos`/`btnSize` |
## Verification
- Build: `xcodebuild … build` → **BUILD SUCCEEDED**
- Tests: full suite → **TEST SUCCEEDED**, 52/52 passed (45 pre-existing + 7 new)
- Lint: `swiftlint Museion/ MuseionTests/` → 0 violations; SwiftFormat clean on changed files
- Live: app launched, gate sheet passed and dismissed via AX, workspace rendered (rail/Posts/editor/mentor verified by screenshot); window-resize collapse fix built but final visual pass blocked by a fullscreen break timer — needs one manual look
## Files Changed
| File | Change Summary |
|------|---------------|
| `Museion/DesignTokens.swift` | New — design-contract tokens |
| `Museion/WorkspaceView.swift` | New — nav rail + pane shell, collapse logic |
| `Museion/PostsPaneView.swift` | New — library column, groups, empty state, editor placeholder |
| `Museion/PostLibrary.swift` | New — disk scan + lenient frontmatter |
| `Museion/SettingsPaneView.swift` | New — Home repoint via NSOpenPanel |
| `Museion/MuseionApp.swift` | `AppGateState.museionHome` + default |
| `Museion/ContentView.swift` | Post-gate root → `WorkspaceView` |
| `Museion/MentorPaneView.swift` | Root min-frame dropped |
| `MuseionTests/PostLibraryTests.swift` | New — 7 tests |
| `Museion/AGENTS.md`, `MuseionTests/AGENTS.md` | Contracts updated |
## Open Items & Next Steps
- [ ] Manual look at the collapse behavior at narrow widths (break timer blocked the final screenshot pass)
- [ ] #18 Post lifecycle — New Post button, lazy folder creation, slug naming, rename/delete round-trips; pins the frontmatter key format written on save
- [ ] Mentor engine crash on workspace entry — pre-existing #14 behavior (drift note also visible); not #17 scope but worth a #28 look when Sessions land
---
*Log written by write-log skill*
+1
View File
@@ -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-10-01 | issue | [20261001-issue17-home-posts-list_log.md](20261001-issue17-home-posts-list_log.md) | #17 shipped: workspace shell, Posts mirror, Home repoint — 52 tests green |
| 2026-09-25 | issue | [20260925-issue50-profile-backup-s2-6_log.md](20260925-issue50-profile-backup-s2-6_log.md) | #50 S2.6 daily profile backup: liveness gate, curated copy, retention 7, RESTORE.md — 8 tests green |
| 2026-09-16 | issue | [20260916-issue14-acp-bridge-s2-2_log.md](20260916-issue14-acp-bridge-s2-2_log.md) | #14 M0 ACP bridge: NDJSON JSON-RPC client, mentor pane, fix-card round-trip, crash restart — 37 tests green |
| 2026-09-05 | issue | [20260905-issue48-provisioning-failure-alert-retry-ux_log.md](20260905-issue48-provisioning-failure-alert-retry-ux_log.md) | #48 shipped: failure card with retry/Not-Now, traversal guard, temp sweep — 30 tests green |