Build S1: storage substrate — projects/ + archive/, type frontmatter #107

Closed
opened 2026-10-12 19:32:45 +02:00 by AlexKucera · 0 comments
Owner

Part of #97.

Question

Build slice S1 of the v1.1 layout change (ADR-0012): the storage substrate under projects/ + archive/, Content Type as frontmatter. No UI change beyond what the paths force — the library keeps working over the new shape.

Work

  • Post.scan: enumerate projects/<name>/<id>/ (two levels; skip non-piece dirs as today). Scan archive/ too — archived pieces stay openable/editable (#99). PostsModel FSEvents roots → projects/ + archive/; bind(home:) creates projects/ where it today creates posts/.
  • PostStore write paths (writeNew, overwrite, rename, trash, importFile, sidecar, cursor): take/derive (project, id); piece file stays post.md for every type. New-piece target = selected project when a post is selected, else the default project posts (zero-friction flow unchanged).
  • availableSlug: global namespace — enumerate projects/*/ AND archive/ (an archived slug must not be reused; restore would collide).
  • Frontmatter: type: post stamped by writeNew + importFile (our-keys-win merge in mergedFrontmatter, alongside pass_state/origin); absent type reads leniently as post. Post model gains the attribute.
  • Tests: PostStoreTests, EditorSessionTests paths posts/<id> → projects/posts/<id>; new cases for two-level scan, archive scan, global-slug-across-projects, type stamping/lenient read.
  • Manual step (Alexander, when this lands): move the 4 dev posts by hand to projects/posts/<id>/. No migration machinery — the app never reads the old posts/ root (#103).

Verification

xcodebuild test green; scan/watcher/slug/type behaviors covered per above.

[Generated by AI]

Part of #97. ## Question Build slice S1 of the v1.1 layout change (ADR-0012): the storage substrate under `projects/` + `archive/`, Content Type as frontmatter. No UI change beyond what the paths force — the library keeps working over the new shape. ## Work - `Post.scan`: enumerate `projects/<name>/<id>/` (two levels; skip non-piece dirs as today). Scan `archive/` too — archived pieces stay openable/editable (#99). `PostsModel` FSEvents roots → `projects/` + `archive/`; `bind(home:)` creates `projects/` where it today creates `posts/`. - `PostStore` write paths (`writeNew`, `overwrite`, `rename`, `trash`, `importFile`, sidecar, cursor): take/derive `(project, id)`; piece file stays `post.md` for every type. New-piece target = selected project when a post is selected, else the default project `posts` (zero-friction flow unchanged). - `availableSlug`: global namespace — enumerate `projects/*/` AND `archive/` (an archived slug must not be reused; restore would collide). - Frontmatter: `type: post` stamped by `writeNew` + `importFile` (our-keys-win merge in `mergedFrontmatter`, alongside `pass_state`/`origin`); absent `type` reads leniently as `post`. Post model gains the attribute. - Tests: `PostStoreTests`, `EditorSessionTests` paths `posts/<id>` → `projects/posts/<id>`; new cases for two-level scan, archive scan, global-slug-across-projects, type stamping/lenient read. - Manual step (Alexander, when this lands): move the 4 dev posts by hand to `projects/posts/<id>/`. No migration machinery — the app never reads the old `posts/` root (#103). ## Verification `xcodebuild test` green; scan/watcher/slug/type behaviors covered per above. [Generated by AI]
AlexKucera added the wayfinder:task label 2026-10-12 19:32:45 +02:00
AlexKucera self-assigned this 2026-10-12 19:32:45 +02:00
Sign in to join this conversation.