Compare commits
21
Commits
822b1b562e
...
v0.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c959b67f14 | ||
|
|
653ca69d1f | ||
|
|
1b0c23ae5b | ||
|
|
46e87e678c | ||
|
|
64a7eaa37e | ||
|
|
d5a515091a | ||
|
|
4a056f9c53 | ||
|
|
570abb32c0 | ||
|
|
bba4688dcb | ||
|
|
2d5073e421 | ||
|
|
07da076f41 | ||
|
|
3197b9276e | ||
|
|
23afcdf3b6 | ||
|
|
fd806e9e76 | ||
|
|
5f92241308 | ||
|
|
217a87324e | ||
|
|
d470615ac7 | ||
|
|
58355aa292 | ||
|
|
c10477da35 | ||
|
|
3bb178220f | ||
|
|
1df46a816f |
No files matched your search
@@ -0,0 +1,166 @@
|
||||
---
|
||||
name: release
|
||||
description: "Cut a Museion release: bump, notes, rail, DMG, tag, publish."
|
||||
platforms: [macos]
|
||||
version: 0.3.0
|
||||
author: Hermes
|
||||
metadata:
|
||||
hermes:
|
||||
tags: [Release, Museion, Xcode, Notarization, Gitea, apex, Micro.blog, BuyMeACoffee]
|
||||
---
|
||||
|
||||
# Cutting a Museion release
|
||||
|
||||
Runs a release end to end: refresh the bundled apex renderer, version bump, changelog heading, release notes, the verify rail, sliced commits, an annotated tag, the notarized DMG from `scripts/release.sh`, then push and the Gitea release, then the announcements — Micro.blog and Buy Me a Coffee — each left as a **draft** for Alexander to publish. The skill decides nothing about signing — `release.sh` and the Account Holder's keychain do that — and it bumps no version on its own. Push and the forge release wait for Alexander's explicit go (root `AGENTS.md`, User Preferences); neither announcement is ever published by the agent.
|
||||
|
||||
## When to Use
|
||||
|
||||
- "cut / ship / tag / bump a release", "make a DMG", "X.Y.Z is ready"
|
||||
- notarization came back `Invalid`, or a bundled binary changed (`Museion/Resources/apex`) — rerun steps 6–9 and move the still-local tag
|
||||
- release notes or the README have to match what shipped
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Clean tree on `main`. `MARKETING_VERSION` is the only version source; read it from build settings, never from the pbxproj text.
|
||||
- A valid **Developer ID Application** identity: `security find-identity -v -p codesigning`. When it is missing, the fix is Alexander's (developer.apple.com + a Keychain Access CSR — the `scripts/release.sh` header has the route); the agent imports nothing.
|
||||
- Notary profile `museion-notary`, registered once by the Account Holder. The agent never runs `notarytool store-credentials`.
|
||||
- `tea` logged in to `git.babylondreams.de` (the default login).
|
||||
- Micro.blog announcement token in the login keychain: `security find-generic-password -a micro.blog -s com.babylondreams.Museion.release-announce -w` prints it (step 11 has the one-time `add-generic-password`). When missing, Alexander generates an App Token (Micro.blog → Account → App Tokens) and the agent stores it — never the other way around.
|
||||
- Ego Browser running and logged in to Buy Me a Coffee — `buymeacoffee-post` has the one-time check.
|
||||
- Budget: ~2 min for `release.sh`, ~7 min for the rail.
|
||||
|
||||
## Procedure
|
||||
|
||||
Run through the `terminal` tool. Each step ends on a check; the next starts when it passes.
|
||||
|
||||
1. **Refresh apex FIRST — every release, no "is it current?" gate.** The bundled renderer is stale by definition between releases; the upgrade is the first step, never a comparison that can be skipped. Both sources are the same official binary; pick one:
|
||||
|
||||
**GitHub release (canonical):**
|
||||
```bash
|
||||
W=$(mktemp -d) && cd "$W"
|
||||
curl -fsSL https://api.github.com/repos/ApexMarkdown/apex/releases/latest -o rel.json
|
||||
TAG=$(python3 -c 'import json;print(json.load(open("rel.json"))["tag_name"])') # v1.1.NN
|
||||
V=${TAG#v}
|
||||
curl -fsSLO "https://github.com/ApexMarkdown/apex/releases/download/$TAG/apex-$V-macos-universal.tar.gz"{,.sha256}
|
||||
awk '{print $1}' apex-$V-macos-universal.tar.gz.sha256 | shasum -a 256 -c - # must print OK — stop otherwise
|
||||
tar xzf apex-$V-macos-universal.tar.gz
|
||||
SRC=apex-$V-macos-universal/apex
|
||||
```
|
||||
**Homebrew (fallback only — the formula lags GitHub by days; on 0.1.1's cut day it still carried 1.1.58):**
|
||||
```bash
|
||||
brew update && brew upgrade apex
|
||||
SRC=$(brew --prefix)/bin/apex # a symlink; lipo reads through it
|
||||
```
|
||||
Either way `lipo -info "$SRC"` must list `arm64` (GitHub ships x86_64+arm64; Homebrew on Apple Silicon is arm64-only — `lipo -thin` still works on a thin file).
|
||||
|
||||
**Then the one recipe (ADR-0011 — 1.1.59 still links libyaml dynamically; the vendored `libyaml.bundle` stays):**
|
||||
```bash
|
||||
cd <repo root>
|
||||
SIGNER="Developer ID Application: Alexander Kucera (3M7APDAAC5)"
|
||||
lipo "$SRC" -thin arm64 -output "$W/apex-arm64"
|
||||
# strip EVERY rpath the binary carries — list them first and delete each one; a Homebrew build carries $(brew --prefix)/lib instead of the CI paths
|
||||
otool -l "$W/apex-arm64" | grep -A2 LC_RPATH | grep path
|
||||
for r in /Users/runner/work/apex/apex/deps/libyaml-universal/lib /usr/local/lib /opt/homebrew/lib "$(brew --prefix)/lib"; do
|
||||
install_name_tool -delete_rpath "$r" "$W/apex-arm64" 2>/dev/null || true # absent paths are fine to skip; the Done-check catches a survivor
|
||||
done
|
||||
install_name_tool -add_rpath '@executable_path/../Resources/libyaml.bundle' "$W/apex-arm64"
|
||||
codesign -f -s "$SIGNER" --options runtime --timestamp "$W/apex-arm64"
|
||||
# PROVE it in the shipped layout before it touches the tree
|
||||
mkdir -p "$W/proof/Resources/libyaml.bundle" && cp "$W/apex-arm64" "$W/proof/Resources/apex" \
|
||||
&& cp Museion/Resources/libyaml.bundle/libyaml-0.2.dylib "$W/proof/Resources/libyaml.bundle/"
|
||||
"$W/proof/Resources/apex" --version
|
||||
printf -- '- a\n\n1. one\n' | "$W/proof/Resources/apex" --no-mixed-lists # two lists, <ul> then <ol> — never one merged <ul>
|
||||
cp "$W/apex-arm64" Museion/Resources/apex
|
||||
```
|
||||
Bump `## apex X.Y.Z` + the `vX.Y.Z` prose in `Museion/Resources/THIRD-PARTY-NOTICES.md`; add a `### Changed` → `- **reading:**` line under the release heading in `CHANGELOG.md`. Done when `otool -l Museion/Resources/apex | grep -A2 LC_RPATH | grep path` prints exactly `@executable_path/../Resources/libyaml.bundle`, `codesign -dvv` shows `flags=0x10000(runtime)` + the Developer ID authority, `Museion/Resources/apex --version` prints the new version, and `--no-mixed-lists` appears in `--help` (ADR-0011's load-bearing flag). If a future apex links libyaml statically (asked upstream), drop the rpath/codesign dylib steps and the `.bundle`, and update this skill. An upgrade found after tagging costs a second rail run and a second notarization.
|
||||
2. **Bump.** Patch for a bug-fix cut (`X.Y.0` → `X.Y.1`), minor for a feature cut (`X.Y.1` → `X.Y+1.0`) — `MARKETING_VERSION` on every target and configuration in `Museion.xcodeproj/project.pbxproj`; `CURRENT_PROJECT_VERSION` stays. Read back: `xcodebuild -project Museion.xcodeproj -scheme Museion -configuration Release -destination 'platform=macOS,arch=arm64' -showBuildSettings | awk -F'= ' '/MARKETING_VERSION = /'`. Done when it prints the new version.
|
||||
3. **Changelog heading.** `## [X.Y.Z] - YYYY-MM-DD` over the former `[Unreleased]` entries, a fresh empty `[Unreleased]` above, one pointer line to the notes (`CHANGELOG.md` follows Common Changelog). Done when every entry since the last tag sits under the heading.
|
||||
4. **Release notes** — `docs/releases/X.Y.Z.md`, the CHANGELOG section distilled for humans: what is in it (grouped highlights), the milestones it closes, install, known limits, numbers. Shape precedent: `docs/releases/0.1.0.md`. Written from the shipped surface — every claim traces to a CHANGELOG entry or to source.
|
||||
5. **README matches what shipped:** install copy, requirements, license pointer; the minimum macOS from `MACOSX_DEPLOYMENT_TARGET`, never from prose.
|
||||
6. **Verify rail on the tree you will tag.** `./scripts/full-test.sh start`, poll `./scripts/full-test.sh status` (exit 3 = live), counts from `./scripts/full-test.sh summary`. Done when executed == passed == the baseline and the run directory is newer than the last edit. Then `swiftformat . && swiftlint .` clean, and `shellcheck scripts/release.sh` when the script changed.
|
||||
7. **Commit in slices, then tag.** `docs(readme)` · `build(release)` (tooling + notes + DOX) · `chore(release)` (bump + changelog heading) · later fixes as `fix(scope)`. Plain prose bodies, no trailers. Tag: `git tag -a vX.Y.Z -m "Museion X.Y.Z — <one line>"` on the commit whose tree the DMG is built from. A fix found after tagging: commit it, then `git tag -f vX.Y.Z <fix commit>` while the tag is still local. Done when `git describe --tags --exact-match HEAD` prints the tag and the tree is clean.
|
||||
8. **Build and prove the DMG.** `./scripts/release.sh` — refuses without the identity, reads the version from build settings, writes `dist/Museion-X.Y.Z.dmg`, and ends with `spctl` → `accepted, source=Notarized Developer ID`. Then mount the image and run `Contents/Resources/apex --version` from it, `xcrun stapler validate dist/Museion-X.Y.Z.dmg`, and record `shasum -a 256 dist/Museion-X.Y.Z.dmg`. Done when all four pass and the sha256 is in the report.
|
||||
9. **Handoff gate.** Report the tag commit, the sha256, and what changed. Push and the forge release happen on Alexander's go.
|
||||
10. **On go — push, release, verify.**
|
||||
|
||||
```bash
|
||||
git push origin main vX.Y.Z
|
||||
{ cat docs/releases/X.Y.Z.md; printf '\n\n[Generated by AI]\n'; } > "$TMPDIR/notes.md" # house rule: the AI marker closes every tea body
|
||||
tea releases create --tag vX.Y.Z --target <tag-commit-sha> -t "Museion X.Y.Z" -f "$TMPDIR/notes.md" -a ./dist/Museion-X.Y.Z.dmg
|
||||
tea api '/repos/{owner}/{repo}/releases/tags/vX.Y.Z'
|
||||
```
|
||||
|
||||
Done when the API shows `draft: false`, one asset at the local byte size, and a token-authenticated download of the asset sha256-matches the local file.
|
||||
11. **Micro.blog announcement — a DRAFT, never a publish.** The post goes to Micro.blog as `post-status: draft` so Alexander reviews and publishes it himself (the `preview` link lands in the report). Token: a Micro.blog **App Token** (Account → App Tokens) stored ONCE in the login keychain under its own service — never the app's production slot (`com.babylondreams.Museion.micropub`, account `micro.blog` — that is the app's live credential, see MuseionTests/AGENTS.md), never a file in the repo:
|
||||
```bash
|
||||
security add-generic-password -U -a micro.blog -s com.babylondreams.Museion.release-announce -w '<app token>' </dev/null
|
||||
```
|
||||
(The `</dev/null` is load-bearing: without it `security` prompts for a retype.) Then:
|
||||
|
||||
```bash
|
||||
TOK=$(security find-generic-password -a micro.blog -s com.babylondreams.Museion.release-announce -w)
|
||||
curl -sS -H "Authorization: Bearer $TOK" 'https://micro.blog/micropub?q=config' # read destinations + channels
|
||||
```
|
||||
**`mp-destination` is mandatory on this account**: `q=config` lists three microblogs and `microblog-default` is `false` on every one, so a post without it is ambiguous. The main blog is `https://AlexKucera.micro.blog/` (name `alexanderkucera.com`); the other two are a tweets cross-post and a test blog. Article posts take `mp-channel: default` (the `channels` list: `default` = Posts, `pages` = Pages). Post:
|
||||
```bash
|
||||
python3 - "$TOK" <<'PY'
|
||||
import json, sys, urllib.request
|
||||
tok = sys.argv[1]
|
||||
payload = {"type": ["h-entry"], "properties": {
|
||||
"name": ["Museion X.Y.Z"],
|
||||
"content": ["<the announcement, markdown>"],
|
||||
"post-status": ["draft"],
|
||||
"mp-destination": ["https://AlexKucera.micro.blog/"],
|
||||
"mp-channel": ["default"]}}
|
||||
req = urllib.request.Request("https://micro.blog/micropub", data=json.dumps(payload).encode(),
|
||||
headers={"Authorization": f"Bearer {tok}", "Content-Type": "application/json"}, method="POST")
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
print(r.status, r.headers.get("Location"), r.read().decode())
|
||||
PY
|
||||
```
|
||||
Body: `docs/releases/X.Y.Z.md` is too long for a microblog post — distill it to a short announcement (what was fixed in plain words, the download link, the release-page link, "Developer ID signed and notarized"). A draft does NOT syndicate, so the `syndicate-to` targets in `q=config` (Mastodon/Bluesky/Threads) are not touched until Alexander publishes. Read back before reporting: `GET '/micropub?q=source&url=<Location>'` must show `post-status: draft` and the content intact — a 2xx alone is not a result. Done when the read-back says draft and the report carries the `url` (the post's final address) and the `preview` link. `preview` is display-only — never the publish/update target. A token pasted into chat is in the transcript: recommend rotation after the run.
|
||||
12. **Buy Me a Coffee announcement — a DRAFT, never a publish.** The step-11 announcement as a BMC post, left for Alexander to publish. The mechanics (Ego Browser, the `scripts/bmc.js` driver, selectors, pitfalls) live in the `buymeacoffee-post` skill; the release only fixes the `INPUT`:
|
||||
```js
|
||||
action: "create", mode: "draft", audience: "public",
|
||||
title: "Museion X.Y.Z",
|
||||
html: <the step-11 announcement as HTML>,
|
||||
```
|
||||
Done when `RESULT.mode` is `"draft"` and `RESULT.editUrl` is a `https://buymeacoffee.com/posts/<id>/edit` URL — the script prints `null` when the drafts list does not show the row, and that is not done. The edit URL goes in the report beside the Micro.blog `preview` link.
|
||||
13. **Session log + DOX.** `write-log` for the release; the devlog commit follows the tag (the log is the record about the release, not part of it). DOX pass: root `AGENTS.md` (commands block, scripts index, session-log window) and `docs/AGENTS.md`. The log commit rides the next go.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
- apex: GitHub `releases/latest` → `.sha256` → `lipo -thin arm64 -output` → strip ALL rpaths → add `@executable_path/../Resources/libyaml.bundle` → `codesign --options runtime` → prove in a scratch `Resources/` layout → copy into `Museion/Resources/apex` + bump `THIRD-PARTY-NOTICES.md`. Every release, first. (Homebrew lags GitHub — fallback only.)
|
||||
- Version: `xcodebuild -showBuildSettings … | awk '/MARKETING_VERSION = /'`
|
||||
- Rail: `./scripts/full-test.sh start` · `status` · `summary`
|
||||
- Lint: `swiftformat . && swiftlint .`
|
||||
- Tag: `git tag -a vX.Y.Z -m "Museion X.Y.Z — <one line>"` · move while local: `git tag -f vX.Y.Z <sha>`
|
||||
- DMG: `./scripts/release.sh` → `dist/Museion-X.Y.Z.dmg` (`NOTARIZE=0` skips notarize + staple)
|
||||
- Gatekeeper: `spctl -a -t open --context context:primary-signature -v dist/Museion-X.Y.Z.dmg`
|
||||
- Push: `git push origin main vX.Y.Z`
|
||||
- Release: `tea releases create --tag vX.Y.Z --target <sha> -t "Museion X.Y.Z" -f <notes> -a ./dist/Museion-X.Y.Z.dmg`
|
||||
- Read back: `tea api '/repos/{owner}/{repo}/releases/tags/vX.Y.Z'` (Gitea spells it `tag_name`, not `tag`)
|
||||
- Micro.blog: `POST https://micro.blog/micropub` JSON `h-entry` + `post-status: draft` + `mp-destination` (mandatory — no default blog) + `mp-channel: default` → `202` + `Location`; read back `q=source&url=…` → `post-status: draft`. Token: Keychain service `com.babylondreams.Museion.release-announce`. Never publish.
|
||||
- Buy Me a Coffee: `buymeacoffee-post` → `create` + `mode: "draft"` + `audience: "public"` → `RESULT.editUrl` into the report. Never publish.
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- `release.sh` packages whatever `MARKETING_VERSION` says, from the current tree — it bumps and tags nothing.
|
||||
- The old "compare `--version`, upgrade if stale" step read as optional and got skipped by habit — the refresh is unconditional. A `brew upgrade apex` that prints "already up-to-date" proves nothing: the formula can trail the GitHub release by days (it did on the 0.1.1 cut). GitHub `releases/latest` is the version of record.
|
||||
- `install_name_tool -delete_rpath` fails loudly on a path the binary does not carry — list the rpaths with `otool -l` first and delete exactly those; the Homebrew build carries `$(brew --prefix)/lib`, the GitHub build the three CI/Homebrew paths. The Done-check (exactly ONE rpath left) catches a survivor before the rail, where `release.sh` would only catch a missing dylib.
|
||||
- A `cp` over the signed `Resources/apex` must happen AFTER the scratch-layout proof — a binary that fails `--no-mixed-lists` in scratch has already touched nothing.
|
||||
- A green `full-test.sh status` read right after a resource-only edit can be the PREVIOUS run's summary. Compare run-directory timestamps; zero `SwiftCompile` lines is normal then, and freshness is the `CpResource` line for the changed file plus running it from the test host's built bundle.
|
||||
- A DMG built before the last binary or script change is stale: rebuild, re-notarize, and the sha256 in the report is the one that ships.
|
||||
- The tag moves only while local; after the push a fix is a new version.
|
||||
- `tea releases create` takes the tag via `--tag` OR the positional — both is "ambiguous arguments". `@file` bodies work only on `tea api`; releases take `-f <file>`.
|
||||
- The release asset download 404s without a token (private repo). Read the token from `~/Library/Application Support/tea/config.yml` into a shell variable for the `curl` — never print it. `grep -E '^\s*token:'` + `sed` is enough; PyYAML is not installed on the system python.
|
||||
- `tea releases create` prints NOTHING on success (exit 0, empty output). The `tea api` read-back is the only proof — and Gitea's release JSON has `tag_name`, not GitHub's `tag`.
|
||||
- `security add-generic-password -w <value>` without `</dev/null` prompts for a retype and fails with "passwords don't match" when stdin is not a tty; the item is NOT stored and the next read returns 0 chars. Always `</dev/null`, always read the length back.
|
||||
- A Micro.blog post without `mp-destination` is a gamble on this account — `q=config` shows three microblogs and none is `microblog-default`. Read `q=config` before every announcement; the destination set can change.
|
||||
- `q=source&url=…` read-back does not echo `mp-destination` or `mp-channel`; the post's `Location` host (`alexanderkucera.com`) is the evidence the destination took.
|
||||
- `core.hooksPath=scripts/hooks`: the pre-push hook is the lint gate; the rail is yours to run before tagging.
|
||||
- A dylib dropped into a synced Resources folder gets linked into the app by Xcode's classifier; vendored libraries ride a `.bundle` folder (ADR-0011).
|
||||
|
||||
## Verification
|
||||
|
||||
`tea api '/repos/{owner}/{repo}/releases/tags/vX.Y.Z'` → `draft: false`, one asset whose downloaded sha256 equals `shasum -a 256 dist/Museion-X.Y.Z.dmg`; `spctl -a -t open --context context:primary-signature -v dist/Museion-X.Y.Z.dmg` → `accepted, source=Notarized Developer ID`. Micro.blog: `GET https://micro.blog/micropub?q=source&url=<Location>` → `post-status: draft`, content intact. Buy Me a Coffee: `RESULT.mode: "draft"` + `RESULT.editUrl` in the report. Both drafts sit in Alexander's queues awaiting his publish.
|
||||
@@ -2,6 +2,7 @@
|
||||
.swiftpm/
|
||||
DerivedData/
|
||||
_build/
|
||||
dist/
|
||||
**/xcuserdata/
|
||||
.DS_Store
|
||||
CLAUDE.md
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Museion — the Agentic Writing Environment (AWE): a native SwiftUI macOS app where scholars, texts, and AI minds work under a single roof. Named for the Mouseion of Alexandria.
|
||||
|
||||
- **Stack**: native Xcode project (`Museion.xcodeproj` at repo root, filesystem-synchronized groups — disk is truth). SwiftUI on macOS 26.5+, latest Xcode/Swift only (ADR-0001). Swift language mode 6 with default MainActor isolation, tabs.
|
||||
- **Stack**: native Xcode project (`Museion.xcodeproj` at repo root, filesystem-synchronized groups — disk is truth). SwiftUI on macOS 27+ (`MACOSX_DEPLOYMENT_TARGET = 27.0`, Apple Silicon only), latest Xcode/Swift only (ADR-0001). Swift language mode 6 with default MainActor isolation, tabs.
|
||||
- **Forge**: Gitea @ git.babylondreams.de (`tea` CLI), CI via Gitea Actions (ADR-0003) — needs a self-hosted macOS runner.
|
||||
- **License**: GPL-3.0-or-later (ADR-0002).
|
||||
|
||||
@@ -20,6 +20,7 @@ swiftformat . && swiftlint . # lint (r
|
||||
./scripts/full-test.sh summary # finished run's executed/passed/failed
|
||||
./scripts/install-hooks.sh # once per clone: pre-push lint gate + no-push-while-testing
|
||||
./scripts/test-full-test.sh # pre-push hook acceptance rig (disposable git repo, all ref shapes)
|
||||
./scripts/release.sh # release packaging: Developer ID export → notarized DMG in dist/ (refuses without the cert)
|
||||
```
|
||||
|
||||
# DOX framework
|
||||
@@ -113,7 +114,8 @@ When the user requests a durable behavior change, record it here or in the relev
|
||||
| `Museion/AGENTS.md` | App target — SwiftUI app shell, assets, entitlements |
|
||||
| `MuseionTests/AGENTS.md` | Swift Testing unit suite (hosted in the app) |
|
||||
| `MuseionUITests/` | XCUITest smoke test — single file, no child doc yet |
|
||||
| `scripts/` | Verify rail + hooks + build/deploy scripts — contracts live in each script's header; full-test.sh is the sanctioned verify rail (#190), no child doc |
|
||||
| `scripts/` | Verify rail + hooks + build/deploy/release-packaging scripts — contracts live in each script's header; full-test.sh is the sanctioned verify rail (#190), release.sh cuts the DMG from an already-bumped commit, no child doc |
|
||||
| `.agents/skills/` | Project-local agent skills (cross-tool convention, committed) — `release/`: the end-to-end release runbook (apex refresh → bump → notes → rail → tag → DMG → go-gated push + Gitea release → Micro.blog + Buy Me a Coffee announcements as drafts); no child doc |
|
||||
| `docs/AGENTS.md` | Durable documentation — ADRs and their conventions |
|
||||
| `ref/writing skills/AGENTS.md` | Bundled writing-skill set — the G3a payload seeded into the museion profile |
|
||||
| `GLOSSARY.md` | Binding project glossary — shared vocabulary for app, mentor, and docs |
|
||||
@@ -132,50 +134,6 @@ Default five canonical roles, label string = role name. See `docs/agents/triage-
|
||||
|
||||
Single-context: `GLOSSARY.md` + `docs/adr/` at the repo root. See `docs/agents/domain.md`.
|
||||
|
||||
<!-- gitnexus:start -->
|
||||
# GitNexus — Code Intelligence
|
||||
|
||||
This project is indexed by GitNexus as **museion** (7133 symbols, 36787 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
|
||||
|
||||
> Index stale? Run `node .gitnexus/run.cjs analyze` from the project root — it auto-selects an available runner. No `.gitnexus/run.cjs` yet? `npx gitnexus analyze` (npm 11 crash → `npm i -g gitnexus`; #1939).
|
||||
|
||||
## Always Do
|
||||
|
||||
- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user.
|
||||
- **MUST run `detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. For regression review, compare against the default branch: `detect_changes({scope: "compare", base_ref: "main"})`.
|
||||
- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
|
||||
- When exploring unfamiliar code, use `query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
|
||||
- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `context({name: "symbolName"})`.
|
||||
|
||||
## Never Do
|
||||
|
||||
- NEVER edit a function, class, or method without first running `impact` on it.
|
||||
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
|
||||
- NEVER rename symbols with find-and-replace — use `rename` which understands the call graph.
|
||||
- NEVER commit changes without running `detect_changes()` to check affected scope.
|
||||
|
||||
## Resources
|
||||
|
||||
| Resource | Use for |
|
||||
|----------|---------|
|
||||
| `gitnexus://repo/museion/context` | Codebase overview, check index freshness |
|
||||
| `gitnexus://repo/museion/clusters` | All functional areas |
|
||||
| `gitnexus://repo/museion/processes` | All execution flows |
|
||||
| `gitnexus://repo/museion/process/{name}` | Step-by-step execution trace |
|
||||
|
||||
## CLI
|
||||
|
||||
| Task | Read this skill file |
|
||||
|------|---------------------|
|
||||
| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` |
|
||||
| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` |
|
||||
| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` |
|
||||
| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` |
|
||||
| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
|
||||
| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
|
||||
|
||||
<!-- gitnexus:end -->
|
||||
|
||||
## Project Learnings
|
||||
|
||||
<!-- distill-learnings: project-learnings -->
|
||||
@@ -191,6 +149,8 @@ This project is indexed by GitNexus as **museion** (7133 symbols, 36787 relation
|
||||
|
||||
### Testing
|
||||
- Gate-running rules are encoded in `scripts/full-test.sh` (#190) — run `./scripts/full-test.sh start` + `status` polling (`summary` for the finished counts), never hand-rolled xcodebuild/xcresult incantations. The rest of this section is authoring rules the script cannot encode.
|
||||
- macOS 27.2 (verified on 27.2.1) routes a drag to the DEEPEST destination — a LIVE NSTextView registers itself for drag types (a bare `NSTextView(frame:)` reads `registeredDraggedTypes == []`, so a standalone probe lies; lldb on the running app shows the list), matches Finder drags via `NSFilenamesPboardType`, and its stock `performDragOperation` pastes the file path; the window-level SwiftUI `.dropDestination` never fires over it — the inverse of the 27.0.1 ruling #141 was verified on. Drag routing is an OS-version claim: own the drop at the view (override the `NSDraggingDestination` methods without super) and re-dogfood after every OS point release; instrumented real handlers + one human drag settle which destination fires (#141 follow-up, 2026-12-03)
|
||||
- A pin that drives a seam introduced WITH the fix has no broken-build past to fail on — drive the framework entry point itself (`DragInfoStub` for `NSDraggingDestination`, the scripted transport for the ACP wire), or the pin passes with the fix reverted (#141 follow-up, `image-drop-27-2-drag-routing-pastes-path`)
|
||||
- A model-owned real-clock ticker races a test's injected decisive ticks — a >1 s main-actor stall lets the live ticker complete a met goal first, flipping pins on elapsed-time text; give `start(...)` a `spawnsTicker: Bool = true` seam and opt machine tests out (#162)
|
||||
- Two FSEvent-burst rescans can double-count one shared `PostScanCache` miss (both snapshot the count before either stamps it) → `contentRevision` double-bumps, benign over-invalidation — tests pinning settled-state revision must quiesce the burst (stability loop ≥ the 0.5 s FSEvents latency) before snapshotting (#197)
|
||||
- A scripted transport double fires onCrash/onMessage BEFORE resuming the continuation it answers — resume-first lets the awaiting task close its assertion window (confirmation count 0) before the callback lands (#178)
|
||||
@@ -217,14 +177,15 @@ Session logs live in `docs/devlog/` (one per completed task/issue/milestone). Fu
|
||||
<!-- write-log: window-start -->
|
||||
| Date | Log |
|
||||
| --- | --- |
|
||||
| 2026-11-19 | [20261119-issue200-gate-quit-time-flushes-through-departure-gate_log.md](docs/devlog/20261119-issue200-gate-quit-time-flushes-through-departure-gate_log.md) |
|
||||
| 2026-11-17 | [20261117-issue193-split-fat-files-along-postsmodel-pattern_log.md](docs/devlog/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](docs/devlog/20261117-issue192-collapse-gate-running-learnings-into-verify-rail-pointer_log.md) |
|
||||
| 2026-11-17 | [20261117-issue197-repo-wide-swiftlint-green-documented-lint-contract_log.md](docs/devlog/20261117-issue197-repo-wide-swiftlint-green-documented-lint-contract_log.md) |
|
||||
| 2026-11-17 | [20261117-issue190-full-test-verify-rail-pre-push-hook_log.md](docs/devlog/20261117-issue190-full-test-verify-rail-pre-push-hook_log.md) |
|
||||
| 2026-11-13 | [20261113-fold-typing-budget-pin_log.md](docs/devlog/20261113-fold-typing-budget-pin_log.md) |
|
||||
| 2026-11-13 | [20261113-cold-turkey-full-tokenization_log.md](docs/devlog/20261113-cold-turkey-full-tokenization_log.md) |
|
||||
| 2026-11-11 | [20261111-fix-library-search-stale-after-mutation_log.md](docs/devlog/20261111-fix-library-search-stale-after-mutation_log.md) |
|
||||
| 2026-11-10 | [20261110-pr184-deferred-empty-piece-scope-lost-audit_log.md](docs/devlog/20261110-pr184-deferred-empty-piece-scope-lost-audit_log.md) |
|
||||
| 2026-11-10 | [20261110-issue182-profilelayout-config-set-rail_log.md](docs/devlog/20261110-issue182-profilelayout-config-set-rail_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) |
|
||||
| 2026-12-01 | [20261201-release-010-readme-notes-packaging_log.md](20261201-release-010-readme-notes-packaging_log.md) |
|
||||
| 2026-11-30 | [20261130-external-watch-compares-unnormalized-text_log.md](20261130-external-watch-compares-unnormalized-text_log.md) |
|
||||
| 2026-11-23 | [20261123-home-repoint-retains-old-editor-target_log.md](20261123-home-repoint-retains-old-editor-target_log.md) |
|
||||
| 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) |
|
||||
| 2026-11-17 | [20261117-issue197-repo-wide-swiftlint-green-documented-lint-contract_log.md](20261117-issue197-repo-wide-swiftlint-green-documented-lint-contract_log.md) |
|
||||
|
||||
<!-- write-log: window-end -->
|
||||
@@ -4,10 +4,33 @@ All notable changes to this project will be documented in this file. The format
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.1.2] - 2026-12-03
|
||||
|
||||
Human-readable notes: [docs/releases/0.1.2.md](docs/releases/0.1.2.md).
|
||||
|
||||
### Fixed
|
||||
|
||||
- **editor:** Dropping an image file on the prose editor pastes the file path instead of ingesting it (#141 follow-up; macOS 27.2.1 dogfood 2026-12-03; unticketed fix) — #141 was field-verified on 27.0.1, where the window-level SwiftUI `.dropDestination` starved every deeper destination; 27.2 routes a drag to the DEEPEST destination, and a live NSTextView registers itself for drag types (it matches Finder drags through `NSFilenamesPboardType`), so its stock `performDragOperation` → `readSelection` pasted the path and the window destination never fired — the same for a markdown file dropped on the editor (path instead of guest). The editor text views now share a `FileDropTextView` base that owns the drops landing on them: URL-bearing drags route (never `super`) — the prose editor through the one new `AppGateState.routeFileDrop` (Cold Turkey guard → markdown → guest, anything else → `ingestDrop`), which the window destination also uses for drops landing outside the editor (one router, one surface per drag; a landed drop hops to Posts as markdown always did); the outline rows have no route and bounce instead of pasting the path; text-only drags keep the stock drop; URL-less drags bounce. The pasteboard probe is memoized per `changeCount` (a 20k-URL drag measured 137 ms per mouse-move uncached). `ingestDrop` refuses web URLs loudly with the type strip (a browser image drag has no file to copy), and a file that vanished between drag and drop refuses as missing, not as a folder. +9 tests — the drag overrides driven through a real `NSDraggingInfo` mock (a Finder-shaped drag routes and never pastes the path, an unrouted view claims nothing, a text drag keeps the stock drop, raw image data bounces, the probe follows the pasteboard, the outline rows bounce, web URLs and vanished files refuse with the right notice) and the router's own pins (guest, Cold Turkey refusal, ingest hand-off, mixed refusal); all 9 flip-verified. Verified with one real Finder drag on 27.2.1. Suite 729
|
||||
|
||||
## [0.1.1] - 2026-12-03
|
||||
|
||||
Human-readable notes: [docs/releases/0.1.1.md](docs/releases/0.1.1.md).
|
||||
|
||||
### Fixed
|
||||
|
||||
- **editor:** The external guest's file watch compares normalized text (finding `museion/external-watch-compares-unnormalized-text`, argus cycle-6; unticketed fix, brief-32) — `startExternalWatch`'s onEvent read the disk RAW while the session's `text`/`lastFlushedText` came through `readDocument`'s normalizing external branch (BOM strip + CRLF→LF), so `diskDidChange` raised the #67 conflict whenever the raw bytes differed from BOTH normalized snapshots — which they ALWAYS did for a BOM- or CRLF-carrying file, even with content unchanged. The false alarm blocked departures (select/newPost/newOutline/openExternal) and quit (the #200 gate), and re-armed after every sibling directory event (the watch observes the containing folder) and after either alert answer, until the writer's own flush rewrote the file normalized. The external branch is now the ONE shared read — `EditorSession.readExternalDocument(at:)` (raw UTF-8 → BOM strip → CRLF→LF) — called by both the open read (`readDocument`) and the watch's onEvent, so the #67 compare is normalized-to-normalized; what `readDocument` loads is unchanged (no second normalizer at the compare site, and `diskDidChange` itself is untouched). A real foreign write still raises the alert — the departure gate is not blinded. +3 tests over the real watch closure (`externalWatcher.onEvent`): no conflict on an unchanged BOM/CRLF guest (initially and across sibling events), a real write still conflicts, and no re-arm after either alert answer (yes-reload and keep-local); RED-first 3/3 at the pin (11 executed / 8 passed / 3 failed — the three new pins). Suite 720
|
||||
|
||||
### Changed
|
||||
|
||||
- **reading:** The bundled apex renderer is 1.1.59 (was 1.1.58) — the arm64 slice of the official universal release tarball, `.sha256` verified, the same single `@executable_path/../Resources/libyaml.bundle` rpath and Developer ID + hardened-runtime signature as the 0.1.0 bundling (ADR-0011 recipe unchanged; 1.1.59 still links libyaml dynamically). `--no-mixed-lists` still present.
|
||||
|
||||
## [0.1.0] - 2026-12-01
|
||||
|
||||
First release. Human-readable notes: [docs/releases/0.1.0.md](docs/releases/0.1.0.md).
|
||||
|
||||
### Fixed
|
||||
|
||||
- **reading:** The bundled apex renderer is self-contained and notarizable. apex's release build links libyaml through CI/Homebrew rpaths, so on any Mac without Homebrew it failed to launch and reading mode silently fell back to the raw source — the bundle promised "no install gate" (ADR-0011) and didn't deliver; Apple's notary service also rejects an unsigned Mach-O in Resources, which is how the 0.1.0 release run found it. Now `Resources/apex` is the arm64 slice of apex 1.1.58 (the bundle had shipped 1.1.17), Developer ID–signed with the hardened runtime, with one rpath (`@executable_path/../Resources/libyaml.bundle`) that resolves in the bundle and in the checkout alike; `Resources/libyaml.bundle/libyaml-0.2.dylib` (0.2.5, MIT) rides beside it, same team signature — inside a `.bundle` folder because Xcode's synced-folder classifier silently links a bare dylib into the app. `release.sh` now proves the shipped layout: apex must run from the export and the app must not link libyaml, before anything is notarized. `THIRD-PARTY-NOTICES.md` ships in the bundle.
|
||||
- **editor:** A Home repoint is a guarded document departure (finding `museion/home-repoint-retains-old-editor-target`, argus cycle-5; unticketed fix, brief-28) — Settings → Choose… committed the new Home and flipped `watchedHome` without departing the open session: the session's immutable target kept the OLD Home, so a same-slug piece in the new library made the ID-only reselect return it (autosave/Save/quit wrote the old library while structural operations resolved against the new one), the new library's rescan raised a spurious reload conflict on it, a no-collision piece was torn down by the vanish path with its dirty buffer dropped, and a card scan from the old library could land on the new library's same-slug piece. #198's departure gate never saw this seam. Now `PostsModel.repoint(to:)` runs the SAME gate (`sessionMayDepart`'s three legs — unanswered conflict, failed flush, never-loaded retype; no parallel gate) BEFORE anything commits: a refusal changes nothing (preference, binding, the session's target and buffer stay; the #198 reason spoken once, the #200 quit-refusal posture, since no Posts strip is in sight from Settings), an acceptance lands the edits on the old library first and clears the departed piece's state — nothing auto-reopens. Document identity is (Home, ID) everywhere (`EditorSession.targets`, `PostsModel.openSessionTargets`): every bare `session.postID ==` comparison is retired across select, the structural rail, conversion, the pass guard, Micropub and the card refresh, and async continuations re-validate identity at COMPLETION (the card-scan hop-back; `rescan`'s stale-Home verdict is hoisted to cover the list, the revision and the #67 text, not just the vanish check). The in-memory draft survives a repoint (no Home until first save). +9 tests over a two-Home same-slug rig (the three refusal legs with ordering pinned, same-slug open + save on flush AND quit, no-collision cleanup, stale card scan via the per-model `scanPieceCards` seam — mutation-checked, pass after repoint; review r1: the hoisted `rescan` stale-Home verdict via the `scanLibrary` seam — mutation-checked — and the draft-survives repoint), RED-first 6/6 at the pin. Suite 717 (unticketed fix, brief-28)
|
||||
|
||||
- **editor:** Quit no longer bypasses the document departure gate (#200, follow-up to the #198 audit) — `PostsModel.shutdown()` flushed both sessions best-effort and ignored the results, so quitting with an unanswered reload-conflict alert wrote the local text over the foreign disk body (`flush()` holds for conflicts only in the debounce, never itself), and a failed quit-time flush silently dropped the only copy of the edits. Quit now routes through the same departure gate as navigation (`documentsMayDepart` → `sessionMayDepart`): an unanswered conflict never writes over the foreign body, and the failed-flush-at-quit posture is BLOCK QUIT — `WritingLockAppDelegate.applicationShouldTerminate` refuses termination with one spoken reason (running before the Cold Turkey ask, so a refusal never strands a walked-away block), pinned at the pure `quitReply(posts:)` seam. Finish-audit additions: a never-loaded session's retyped words refuse too (their flush is a vacuous success — the same gap closed for navigation), and the external guest's quit-time flush is pinned. +5 tests, all flip-verified. Suite 708
|
||||
|
||||
@@ -405,6 +405,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
@@ -423,7 +424,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 27.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 0.1.2;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.babylondreams.Museion;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
REGISTER_APP_GROUPS = YES;
|
||||
@@ -441,6 +442,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
@@ -459,7 +461,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 27.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 0.1.2;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.babylondreams.Museion;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
REGISTER_APP_GROUPS = YES;
|
||||
@@ -482,7 +484,7 @@
|
||||
DEVELOPMENT_TEAM = 3M7APDAAC5;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 27.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 0.1.2;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.babylondreams.MuseionTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
@@ -504,7 +506,7 @@
|
||||
DEVELOPMENT_TEAM = 3M7APDAAC5;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 27.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 0.1.2;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.babylondreams.MuseionTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
@@ -524,7 +526,7 @@
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_TEAM = 3M7APDAAC5;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 0.1.2;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.babylondreams.MuseionUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
@@ -544,7 +546,7 @@
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEVELOPMENT_TEAM = 3M7APDAAC5;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
MARKETING_VERSION = 0.1.2;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.babylondreams.MuseionUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
|
||||
+6
-5
@@ -23,7 +23,7 @@ Owned by the root AGENTS.md contract. The `.xcodeproj` uses **filesystem-synchro
|
||||
The map and the contracts, one bullet per file. Pin-level detail lives in the test files' scenario headers (see MuseionTests/AGENTS.md); devlog narratives in `docs/devlog/`.
|
||||
|
||||
- `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` (markdown only → external guest): ONE window-level destination is the whole routing surface under this hosting — nested editor-level SwiftUI destinations and NSTextView drag registrations starve (field-verified); a mixed md+image set refuses loudly. 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).
|
||||
- `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`.
|
||||
- `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.
|
||||
@@ -32,7 +32,7 @@ The map and the contracts, one bullet per file. Pin-level detail lives in the te
|
||||
- `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.
|
||||
- `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); `illustrationRef` is the one `` builder.
|
||||
- `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.
|
||||
- `DraftStats.swift` — the four unaided-first-draft metrics (burstiness, typeTokenRatio, sentenceVariation, trigramRepetition), pure and never NaN; `words(in:)` is the ONE word-count rail (Cold Turkey counts with it — text metrics can never drift).
|
||||
- `WritingGoal.swift` — the pure goal engine (no UI, no clock): `now` injected, `isMet` live and unlatched (deleting below target un-mets).
|
||||
- `WritingLockState.swift` — the lock machine + kiosk: 1 s ticker + per-keystroke `feed(text:)` drive the goal run, `tick(at:)` completes on the first met tick; kiosk = the 6-option combo recipe, enter/exit replay only what entry toggled, exit clears options FIRST; ⌘W/⌃⌘F/⌘N refusals = a local keyDown monitor matched by KEY CODE + exact modifier set + lowercased character net (charactersIgnoringModifiers is layout- and Caps-Lock-dependent); hosted-test guard = full no-op (never kiosk the test machine); nothing persists — the block dies with the session. `WritingLockAppDelegate` (same file) owns BOTH quit refusals: #162 asks once while a block holds; #200 gates quit-time document departure FIRST (never walk away from a block the quit then refuses to complete) — `quitReply(posts:)` is the pure decision (nil posts passes; the pins inject here), the one spoken refusal alert is hosted-guarded like the kiosk.
|
||||
@@ -48,12 +48,13 @@ The map and the contracts, one bullet per file. Pin-level detail lives in the te
|
||||
- `OutlineTree.swift` — the one-file plain nested-bullet tree model (ADR-0013): lenient parse, canonical serialize, normalize on save (preamble verbatim, stray prose after the first item drops); `parsesWithLoss` shares `parseItem` so detector and parser never disagree; structural ops are path-addressed, id-preserving, boundary-nil; single-node moves CROSS parents at sibling boundaries (LogSeq-style); `enter` = split/outdent/new-sibling; `extract`/`insertRun` are the drag primitives; `headingsLadderBody` = the Convert transform. Folds live in the view, keyed by node UUID.
|
||||
- `OutlineEditorView.swift` — `OutlinePresenter` (pure projection: visible rows, fold skipping, zoom re-basing at a node's children, block selection, `applyBatch` sibling-only moves) + the SwiftUI surface: chrome bullets by depth, per-depth rails, ONE promoted `OutlineRowTextView` on the focused row, drag grip + drop chrome, zoom breadcrumbs, Esc stack (drag-cancel → selection-collapse → zoom-out). **Esc needs a local NSEvent keyDown monitor** — SwiftUI's hosting layer swallows Esc before keyDown AND before `.onExitCommand` (probe-pinned in EscEventProbeTests). Every keystroke serializes the whole tree through the existing session machinery; zoom/drag state is view-only, reset on load.
|
||||
- `OutlineDrag.swift` — drag plumbing: NSEvent monitors (global outside the app, so an Esc-cancel never resolves as a drop); the gesture holds STRONG arm-time captures (a mid-drag scroll can drop the origin row's catcher — mouse-up must still clear state); live geometry from `CatcherView.rowFrames` reading CURRENT window-space frames (SwiftUI 27 removed the `.window` coordinate space; cached frames go stale on scroll); the pure drop math (`DropTarget`, `draggedIDs`, `isValidDrop`, `applyDrop`, `hitTestDrop`) rides a nonisolated presenter extension — resolved by id AFTER extraction.
|
||||
- `OutlineRowTextView.swift` — the promoted row editor: borderless NSTextView, native undo/IME, keyDown intercepts (every intercepted branch returns WITHOUT super), echo-guard update, `sizeThatFits` floors at 21 (no focus jump).
|
||||
- Editor core — `ProsePresenter.swift` (line-kind → attributes map mirroring the reading surface; plain store stays the source of truth — presentation-only attributes, ADR-0010). `EditorSession.swift` — per-document session: `SessionTarget` (post | external file), ~1 s debounce → `flush` (⌘S / selection change / quit also flush); externals write in place with NO sidecar; `loadFailed` never opens a writable empty session over a failed read (the first keystroke would destroy the file); the #67 conflict raises when disk ≠ last-flushed ≠ local, and the debounce never fires while the alert is unanswered; `adoptText` = programmatic writer-consented adoption (the #67 guard is the CALLER's job). Cursor sidecar `.museion-state.json` in the piece folder, written separately (a failed sidecar is not a failed save). `PostEditorView`/`ProseTextView` — plain NSTextView representable, loads keyed by `loadGeneration` (never per keystroke); spellcheck off by default (markdown on disk carries the spelling).
|
||||
- `OutlineRowTextView.swift` — the promoted row editor: borderless NSTextView, native undo/IME, keyDown intercepts (every intercepted branch returns WITHOUT super), echo-guard update, `sizeThatFits` floors at 21 (no focus jump). Rides `FileDropTextView` with no route mounted: a file drag landing on a row bounces (no path paste).
|
||||
- `FileDropTextView.swift` — the editor text views' drag base (macOS 27.2.1 routing): a live NSTextView registers itself for drag types and receives the drag a window-level SwiftUI destination never sees; URL-bearing drops route through `onFileDrop` (nil = bounce), text-only drops keep the stock drop, everything else bounces — never `super` for URLs (stock NSTextView pastes the dropped file's PATH via `readSelection` on NSFilenamesPboardType). The pasteboard probe is memoized per `changeCount` (`draggingUpdated` fires per mouse-move).
|
||||
- Editor core — `ProsePresenter.swift` (line-kind → attributes map mirroring the reading surface; plain store stays the source of truth — presentation-only attributes, ADR-0010). `EditorSession.swift` — per-document session: `SessionTarget` (post | external file), ~1 s debounce → `flush` (⌘S / selection change / quit also flush); externals write in place with NO sidecar; `loadFailed` never opens a writable empty session over a failed read (the first keystroke would destroy the file); the #67 conflict raises when disk ≠ last-flushed ≠ local, and the debounce never fires while the alert is unanswered; `adoptText` = programmatic writer-consented adoption (the #67 guard is the CALLER's job). Cursor sidecar `.museion-state.json` in the piece folder, written separately (a failed sidecar is not a failed save). `PostEditorView`/`ProseTextView` — plain NSTextView representable, loads keyed by `loadGeneration` (never per keystroke); spellcheck off by default (markdown on disk carries the spelling). `ProseListTextView` rides `FileDropTextView` with `onFileDrop` → the gate's `routeFileDrop`, so file drags landing on it ingest (never paste the path); `lastIngestNotice` is the refusal text the pins read.
|
||||
- Prose list machinery — `ProseList.swift` (pure item scan/mutation over the plain buffer; every structural edit is ONE range replacement = single undo step); `ProseListTextView.swift` — folds are VIEW state (buffer never changes; hidden scopes styled via `foldedAttributes`), re-keyed to the nearest same-marker parent, dying when the marker text vanishes; single-line edits re-key in place (`rekey`), the newline gate is `\.isNewline` NEVER literal `\n`/`\r` compares (a CRLF pair is one grapheme); wholesale restyles self-heal into the full pass via a font probe. Fold chrome renders as tiny per-glyph CALayers in a click-through overlay — NEVER a document-sized bitmap. Image drops bridge through `ProseDropBridge` into `ingestDrop` (saved posts only, publishable files only, PLAIN files only — a dropped symlink refuses); the drop point is solved by the pure `dropIndex` (sampling + bracket + binary search; the SwiftUI closure's `location` is unusable under this hosting, off-screen rects return garbage).
|
||||
- Settings — `SettingsPaneView.swift` (sidebar + detail: Content · Pass 1 · Pass 2 · Chat · Provider Keys; the pane takes the gate's `binaryPath` and hydrates at open; detail forms left-anchored). `SettingsModel.swift` — #181: `ModelProvider` is the provider-descriptor TABLE — label, effort ladder, flagship, default endpoint, env var, wire `dialect` (chat/models paths + the SSE decoder selector), `authMode` (Bearer vs Anthropic's header pair), `keyless` (nous rides the shared Portal login); the keyless UI branch, the probe's selectors, and both credential consumers key off it. `ProviderCredential` = the ONE credential resolution (provider key, else the Portal session key for keyless providers — official endpoint ONLY, never a user-set URL) serving Test Connection and pass readiness. Writes COALESCE: the newer write queues past an in-flight one, superseded writes never spawn (partial key prefixes of a secret never reach `.env`); `hydrate` reads only and never stomps a pending edit. `HermesSettingsWriter.swift` — the real write path: surface writes and the base_url write-through ride the HermesConfigRail (#182 — the writer only builds its key list: provider, default, effort set-or-unset, base_url LAST); provider keys upsert into ALL THREE profiles' `.env` (foreign lines byte-preserved, 0600, line-broken values REFUSED — env injection; paths via ProfileLayout). `ProviderProbe.swift` — Test Connection: every request carries `Content-Type: application/json` (without it z.ai answers 200 with an error envelope); per-provider dialects (OpenAI speaks the Responses API, Anthropic `x-api-key` + pinned version + required max_tokens, zai thinking+reasoning_effort, nous plain chat-completions) — #181: URL paths, auth shape, and the SSE decoder SELECT by the descriptor's dialect, the per-dialect code stays separate functions; 512 token cap; errors riding a 2xx decode as the provider error. `onChatSurfaceWrite` → `requestRestart` (chat surface only — pass engines are one-shot). `PassReadiness.swift` — #181: the per-surface readiness module (ready / missingKey / unknown): reads each surface's provider + `.env` key through the settings seam and resolves credentials through `ProviderCredential` (the keyless fallback included); MentorSessionModel stores the verdicts and reads no keys or auth files itself.
|
||||
- Focus mode — transient per-launch (no persistence); `FocusChrome` hover zones + overlay panels float over the measure, never push it; `CaretCentering` is EDITOR-WIDE, not focus-gated; focus × reading are orthogonal axes. Cold Turkey chrome (`ColdTurkeySeat`/`ColdTurkeyDot`) mounts as overlays on the focused branch only.
|
||||
- Reading mode (ADR-0011) — `ReadingPresenter.swift`: the bundled apex binary with `-t html --no-mixed-lists --embed-images` (no-mixed-lists REQUIRED — the default merges ordered-after-bullets, killing `1. 1. 1.` renumbering; embed-images inlines base64 so `loadHTMLString` needs no file access); `<!--S:N-->` sentinels rewritten to `data-source-line` stamps; `blocks(for:)` = the click→edit line map; stylesheet = `Resources/reading.css` read fresh per build (dev builds prefer the repo copy); fallback on apex failure = escaped source, never a second renderer. `ReadingSurface.swift` — ONE WKWebView reloaded in place (remount was the dominant switch cost); only our own about:blank main-frame load is allowed.
|
||||
- Reading mode (ADR-0011) — `ReadingPresenter.swift`: the bundled apex binary (arm64, Developer ID–signed with the hardened runtime at commit time, beside `libyaml.bundle/libyaml-0.2.dylib` — self-contained through the single rpath `@executable_path/../Resources/libyaml.bundle`; the `.bundle` wrapper is load-bearing: a bare dylib in the synced folder (with or without extension — Xcode sniffs Mach-O content) becomes the APP's link target; re-sign both when the Developer ID certificate rotates) with `-t html --no-mixed-lists --embed-images` (no-mixed-lists REQUIRED — the default merges ordered-after-bullets, killing `1. 1. 1.` renumbering; embed-images inlines base64 so `loadHTMLString` needs no file access); `<!--S:N-->` sentinels rewritten to `data-source-line` stamps; `blocks(for:)` = the click→edit line map; stylesheet = `Resources/reading.css` read fresh per build (dev builds prefer the repo copy); fallback on apex failure = escaped source, never a second renderer. `ReadingSurface.swift` — ONE WKWebView reloaded in place (remount was the dominant switch cost); only our own about:blank main-frame load is allowed.
|
||||
- `AppGateState.museionHome` — fresh installs resolve once and PIN the winner: legacy `~/Documents/Museion` (dir-ness gated) → `<CloudDocs>/Museion` (resolved at the unprefixed path, never a hard-coded `iCloud~` form) → silent Documents fallback. Hosted tests take an early return — the machine's real iCloud state and defaults are never touched.
|
||||
|
||||
## Engine check (gateless launch)
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// FileDropTextView.swift
|
||||
// Museion
|
||||
//
|
||||
// #141 (macOS 27.2.1): a drag goes to the DEEPEST destination, and a live
|
||||
// NSTextView registers itself for drag types — so a file drag landing on
|
||||
// an editor text view is delivered to the view, not to the window-level
|
||||
// SwiftUI .dropDestination (the inverse of the 27.0.1 ruling #141 was
|
||||
// verified on). Stock NSTextView handling pastes the dropped file's PATH
|
||||
// (`readSelection` on NSFilenamesPboardType). This base replaces that for
|
||||
// URL-bearing drags and leaves text-only drags to the stock behavior. The
|
||||
// prose editor routes through the gate's one router (`AppGateState.
|
||||
// routeFileDrop`); the outline rows have no route and bounce.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
|
||||
class FileDropTextView: NSTextView {
|
||||
/// Where a URL-bearing drop routes. Nil = the view claims nothing
|
||||
/// (outline rows: images don't ingest there, so the drag bounces
|
||||
/// instead of pasting a path).
|
||||
var onFileDrop: (([URL]) -> Bool)?
|
||||
|
||||
/// One classification per pasteboard state — `draggingUpdated` fires on
|
||||
/// every mouse-move and the read is a pasteboard round-trip (a hostile
|
||||
/// 20k-URL drag measured 137 ms per move uncached).
|
||||
private var dropProbe: (changeCount: Int, kind: DropKind)?
|
||||
|
||||
enum DropKind: Equatable {
|
||||
/// File URLs (Finder) or web URLs (browser) — routed, never pasted.
|
||||
case urls([URL])
|
||||
/// Text only (a selection drag, text from another app) — the stock
|
||||
/// NSTextView drop, which inserts text and nothing else.
|
||||
case text
|
||||
/// Raw image data, file promises — anything URL-less and text-less.
|
||||
case none
|
||||
}
|
||||
|
||||
/// The drag's URLs — or nil when it carries none.
|
||||
static func droppedURLs(from pasteboard: NSPasteboard) -> [URL]? {
|
||||
let urls = pasteboard.readObjects(forClasses: [NSURL.self], options: nil) as? [URL] ?? []
|
||||
return urls.isEmpty ? nil : urls
|
||||
}
|
||||
|
||||
static func classify(_ pasteboard: NSPasteboard) -> DropKind {
|
||||
if let urls = droppedURLs(from: pasteboard) {
|
||||
return .urls(urls)
|
||||
}
|
||||
return pasteboard.types?.contains(.string) == true ? .text : .none
|
||||
}
|
||||
|
||||
/// `classify`, memoized on the pasteboard's changeCount.
|
||||
func dropKind(of pasteboard: NSPasteboard) -> DropKind {
|
||||
if let dropProbe, dropProbe.changeCount == pasteboard.changeCount {
|
||||
return dropProbe.kind
|
||||
}
|
||||
let kind = Self.classify(pasteboard)
|
||||
dropProbe = (pasteboard.changeCount, kind)
|
||||
return kind
|
||||
}
|
||||
|
||||
override func draggingEntered(_ sender: any NSDraggingInfo) -> NSDragOperation {
|
||||
switch dropKind(of: sender.draggingPasteboard) {
|
||||
case .urls: onFileDrop != nil ? .copy : [] // accept so a refusal stays LOUD
|
||||
case .text: super.draggingEntered(sender)
|
||||
case .none: []
|
||||
}
|
||||
}
|
||||
|
||||
override func draggingUpdated(_ sender: any NSDraggingInfo) -> NSDragOperation {
|
||||
switch dropKind(of: sender.draggingPasteboard) {
|
||||
case .urls: onFileDrop != nil ? .copy : []
|
||||
case .text: super.draggingUpdated(sender)
|
||||
case .none: []
|
||||
}
|
||||
}
|
||||
|
||||
override func performDragOperation(_ sender: any NSDraggingInfo) -> Bool {
|
||||
switch dropKind(of: sender.draggingPasteboard) {
|
||||
case let .urls(urls): onFileDrop?(urls) ?? false
|
||||
case .text: super.performDragOperation(sender)
|
||||
case .none: false
|
||||
}
|
||||
}
|
||||
|
||||
/// Nothing to conclude — the ingest leaves the scroll stack as a
|
||||
/// keystroke would.
|
||||
override func concludeDragOperation(_: (any NSDraggingInfo)?) {}
|
||||
}
|
||||
@@ -16,11 +16,9 @@ import SwiftUI
|
||||
@MainActor
|
||||
@Observable
|
||||
final class AppGateState {
|
||||
/// #141: the live prose text view — the window-level drop destination
|
||||
/// (the ONLY destination that ever fires; nested editor-level SwiftUI
|
||||
/// targets are never consulted, and AppKit views registered for file
|
||||
/// drags are starved by it — field-verified 2026-11-02) routes image
|
||||
/// drops to the editor through this handle.
|
||||
/// #141: the live prose text view — the window-level SwiftUI destination
|
||||
/// (drops landing OUTSIDE the editor) reaches it through this handle;
|
||||
/// routing lives in `routeFileDrop`.
|
||||
let proseDrop = ProseDropBridge()
|
||||
let gateModel = EngineGateModel()
|
||||
let provisioning = ProvisioningModel()
|
||||
@@ -118,6 +116,23 @@ final class AppGateState {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// #91 + #141 — the ONE file-drop router. Two surfaces reach it, never
|
||||
/// both for one drag (27.2 routing: the editor's text view when the
|
||||
/// pointer is over it, the window-level SwiftUI destination elsewhere):
|
||||
/// a PURE-markdown set opens as the guest; anything else goes to the
|
||||
/// open piece's prose ingest, which refuses loudly (drafts, mixed
|
||||
/// md+image sets, non-publishable or non-file URLs).
|
||||
/// #162: no new buffers while a Cold Turkey block holds.
|
||||
func routeFileDrop(_ urls: [URL]) -> Bool {
|
||||
guard !writingLock.isLocked else { return false }
|
||||
if urls.allSatisfy(PostStore.isMarkdown), let url = urls.first {
|
||||
posts.openExternal(url)
|
||||
return true
|
||||
}
|
||||
guard let textView = proseDrop.textView else { return false }
|
||||
return textView.ingestDrop(urls)
|
||||
}
|
||||
}
|
||||
|
||||
/// #23: no `@main` here — MuseionLauncher (MCPServer.swift) branches
|
||||
|
||||
@@ -127,8 +127,11 @@ struct OutlineRowTextView: NSViewRepresentable {
|
||||
}
|
||||
}
|
||||
|
||||
/// The row NSTextView: structural key interception.
|
||||
final class RowTextView: NSTextView {
|
||||
/// The row NSTextView: structural key interception. `FileDropTextView`
|
||||
/// base (27.2 routing): a file drag landing on a row bounces instead of
|
||||
/// pasting the path — images don't ingest into outlines (#141); text
|
||||
/// drags keep the stock drop.
|
||||
final class RowTextView: FileDropTextView {
|
||||
weak var bridge: OutlineRowTextView.Coordinator?
|
||||
|
||||
override func keyDown(with event: NSEvent) {
|
||||
|
||||
@@ -182,6 +182,7 @@ struct PostEditorView: View {
|
||||
focused: gate.isFocused,
|
||||
caretHint: flipBackCaret,
|
||||
dropBridge: gate.proseDrop,
|
||||
routeDrop: { gate.routeFileDrop($0) },
|
||||
// #162: the Cold Turkey word feed.
|
||||
onTextChange: { gate.writingLock.feed(text: $0) },
|
||||
)
|
||||
@@ -196,6 +197,7 @@ struct PostEditorView: View {
|
||||
},
|
||||
caretHint: flipBackCaret,
|
||||
dropBridge: gate.proseDrop,
|
||||
routeDrop: { gate.routeFileDrop($0) },
|
||||
// #162: the Cold Turkey word feed.
|
||||
onTextChange: { gate.writingLock.feed(text: $0) },
|
||||
)
|
||||
@@ -338,8 +340,8 @@ private struct SaveStateDot: View {
|
||||
|
||||
// MARK: - TextKit2 surface (the lifted spike pane)
|
||||
|
||||
/// #141: the SwiftUI drop target's handle down to the live prose text
|
||||
/// view (weak — dies with the editor surface).
|
||||
/// #141: the window-level SwiftUI destination's handle down to the live
|
||||
/// prose text view (weak — dies with the editor surface).
|
||||
@MainActor
|
||||
final class ProseDropBridge {
|
||||
weak var textView: ProseListTextView?
|
||||
@@ -366,10 +368,11 @@ struct ProseTextView: NSViewRepresentable {
|
||||
/// only (drafts have no folder until first save; the external guest
|
||||
/// isn't a piece). Nil = image drags refuse loudly.
|
||||
var ingestFolder: URL?
|
||||
/// #141: the drop bridge — the WINDOW-level SwiftUI drop target
|
||||
/// reaches this text view through it (app-scoped, passed down from
|
||||
/// the gate at both call sites — never optional).
|
||||
/// #141: the window-level SwiftUI destination's handle to the live
|
||||
/// view (drops landing OUTSIDE the editor); the gate's router for drops
|
||||
/// landing ON it — both handed down from the gate at both call sites.
|
||||
var dropBridge: ProseDropBridge
|
||||
var routeDrop: ([URL]) -> Bool
|
||||
|
||||
init(
|
||||
session: EditorSession,
|
||||
@@ -377,6 +380,7 @@ struct ProseTextView: NSViewRepresentable {
|
||||
focused: Bool = false,
|
||||
caretHint: (location: Int, token: Int)? = nil,
|
||||
dropBridge: ProseDropBridge,
|
||||
routeDrop: @escaping ([URL]) -> Bool,
|
||||
onTextChange: ((String) -> Void)? = nil,
|
||||
) {
|
||||
self.session = session
|
||||
@@ -386,6 +390,7 @@ struct ProseTextView: NSViewRepresentable {
|
||||
self.onTextChange = onTextChange
|
||||
ingestFolder = session.postID != nil ? session.folderURL : nil
|
||||
self.dropBridge = dropBridge
|
||||
self.routeDrop = routeDrop
|
||||
}
|
||||
|
||||
init(
|
||||
@@ -395,6 +400,7 @@ struct ProseTextView: NSViewRepresentable {
|
||||
onEdit: @escaping (String) -> Void,
|
||||
caretHint: (location: Int, token: Int)? = nil,
|
||||
dropBridge: ProseDropBridge,
|
||||
routeDrop: @escaping ([URL]) -> Bool,
|
||||
onTextChange: ((String) -> Void)? = nil,
|
||||
) {
|
||||
self.draft = draft
|
||||
@@ -404,6 +410,7 @@ struct ProseTextView: NSViewRepresentable {
|
||||
self.caretHint = caretHint
|
||||
self.onTextChange = onTextChange
|
||||
self.dropBridge = dropBridge
|
||||
self.routeDrop = routeDrop
|
||||
}
|
||||
|
||||
/// Cursor state snapshot from the live view (#66).
|
||||
@@ -430,7 +437,8 @@ struct ProseTextView: NSViewRepresentable {
|
||||
func makeNSView(context: Context) -> NSScrollView {
|
||||
let tv = ProseListTextView() // #115: list shortcuts + folds on the plain surface
|
||||
tv.ingestFolder = ingestFolder // #141: image-drop ingest (nil on drafts/guests)
|
||||
dropBridge.textView = tv // #141: the SwiftUI drop target's handle
|
||||
dropBridge.textView = tv // #141: the window destination's handle
|
||||
tv.onFileDrop = routeDrop // #141: the view's own drag handlers route here
|
||||
tv.isRichText = false // plain source of truth; attributes are presentation
|
||||
tv.allowsUndo = true
|
||||
tv.isAutomaticQuoteSubstitutionEnabled = false
|
||||
@@ -485,6 +493,7 @@ struct ProseTextView: NSViewRepresentable {
|
||||
tv.isContinuousSpellCheckingEnabled = spellChecking
|
||||
tv.ingestFolder = ingestFolder // #141: cheap idempotent set
|
||||
dropBridge.textView = tv // #141: idempotent re-point
|
||||
tv.onFileDrop = routeDrop // #141: idempotent re-point
|
||||
// #21: the ground follows focus in/out without a remount.
|
||||
let ground = focused ? NSColor(DesignTokens.background) : NSColor(DesignTokens.surface)
|
||||
tv.backgroundColor = ground
|
||||
|
||||
+12
-4
@@ -756,6 +756,12 @@ struct IngestError: LocalizedError {
|
||||
IngestError(message: "“\(name.prefix(40))” is a folder, not an image.")
|
||||
}
|
||||
|
||||
/// A file the drag named but the disk can no longer stat — moved or
|
||||
/// deleted between drag and drop (or a URL that never was a file).
|
||||
static func missing(_ name: String) -> IngestError {
|
||||
IngestError(message: "“\(name.prefix(40))” couldn’t be read — it may have moved since the drag began.")
|
||||
}
|
||||
|
||||
/// assets/ exists as a symlink or a file — never write through it
|
||||
/// (research/promote posture: the #34 rail would refuse the send).
|
||||
static func hostileAssets() -> IngestError {
|
||||
@@ -790,10 +796,12 @@ nonisolated extension PostStore {
|
||||
// AS a link (finish-audit 2026-11-02), and the #34 rail then
|
||||
// refuses the whole send — nothing enters assets/ that can't ship.
|
||||
let values = try? source.resourceValues(forKeys: [.isDirectoryKey, .isSymbolicLinkKey])
|
||||
guard source.isFileURL, let values,
|
||||
values.isDirectory != true, values.isSymbolicLink != true
|
||||
else {
|
||||
throw values?.isSymbolicLink == true ? IngestError.isLink(name) : IngestError.isFolder(name)
|
||||
guard source.isFileURL, let values else { throw IngestError.missing(name) }
|
||||
if values.isSymbolicLink == true {
|
||||
throw IngestError.isLink(name)
|
||||
}
|
||||
if values.isDirectory == true {
|
||||
throw IngestError.isFolder(name)
|
||||
}
|
||||
let assets = pieceFolder.appendingPathComponent("assets", isDirectory: true)
|
||||
if FileManager.default.fileExists(atPath: assets.path) {
|
||||
|
||||
@@ -71,7 +71,7 @@ final class ProseChromeView: NSView {
|
||||
}
|
||||
}
|
||||
|
||||
final class ProseListTextView: NSTextView {
|
||||
final class ProseListTextView: FileDropTextView {
|
||||
/// A fold: the marker line's buffer position + its text (the re-key
|
||||
/// identity when an edit above shifts offsets) + the hidden scope
|
||||
/// (shift-maintained by the #142 cheap path; the full pass re-derives
|
||||
@@ -338,8 +338,10 @@ final class ProseListTextView: NSTextView {
|
||||
return firstRect(forCharacterRange: NSRange(location: charIndex, length: 1), actualRange: nil).midY
|
||||
}
|
||||
|
||||
/// #141's SwiftUI entry — the window `.dropDestination`'s perform
|
||||
/// routes here after markdown forwarding is ruled out upstream.
|
||||
/// #141's ingest entry — `AppGateState.routeFileDrop` routes here
|
||||
/// from whichever surface took the drag (the text view's own drag
|
||||
/// handlers over the editor, the window `.dropDestination` elsewhere)
|
||||
/// after markdown forwarding is ruled out upstream.
|
||||
/// The drop point is read from the live pointer (NSEvent.mouseLocation
|
||||
/// — the SwiftUI closure's location proved unusable, dogfood 2026-11-02).
|
||||
/// Gates: saved piece, every file publishable (#34's mimeType set) —
|
||||
@@ -354,8 +356,10 @@ final class ProseListTextView: NSTextView {
|
||||
}
|
||||
// The publish-able set IS #34's mimeType gate — nothing the rail
|
||||
// can't ship ever enters assets/. A mixed md+image set refuses
|
||||
// here too (only pure-markdown sets are forwarded upstream).
|
||||
guard urls.allSatisfy({ Micropub.mimeType(forDestination: $0.lastPathComponent) != nil }) else {
|
||||
// here too (only pure-markdown sets are forwarded upstream), and
|
||||
// so does a web URL (a browser image drag): the extension may
|
||||
// look publishable, but nothing is on disk to copy.
|
||||
guard urls.allSatisfy({ $0.isFileURL && Micropub.mimeType(forDestination: $0.lastPathComponent) != nil }) else {
|
||||
showIngestNotice("Drop images (PNG, JPEG, GIF, WebP, SVG) or markdown — one kind at a time.")
|
||||
return false
|
||||
}
|
||||
@@ -416,7 +420,12 @@ final class ProseListTextView: NSTextView {
|
||||
private var ingestNotice: NSTextField?
|
||||
private var ingestNoticeHide: DispatchWorkItem?
|
||||
|
||||
/// The last refusal text — the observable the pins read (the strip
|
||||
/// itself is private chrome).
|
||||
private(set) var lastIngestNotice: String?
|
||||
|
||||
private func showIngestNotice(_ text: String) {
|
||||
lastIngestNotice = text
|
||||
let strip: NSTextField
|
||||
if let ingestNotice {
|
||||
strip = ingestNotice
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Third-Party Notices
|
||||
|
||||
Museion is GPL-3.0-or-later. It bundles the two components below, both under
|
||||
the MIT License; the full license text follows.
|
||||
|
||||
## apex 1.1.59 (`apex`)
|
||||
|
||||
Markdown → HTML converter, used for reading mode.
|
||||
Copyright (c) 2026 Brett Terpstra — https://github.com/ApexMarkdown/apex
|
||||
Redistributed as the arm64 slice of the v1.1.59 release binary (checksum
|
||||
verified against the published `.sha256`), re-signed for Developer ID
|
||||
distribution; rpath rewritten to load the libyaml beside it.
|
||||
|
||||
## libyaml 0.2.5 (`libyaml.bundle/libyaml-0.2.dylib`)
|
||||
|
||||
YAML parser linked by apex.
|
||||
Copyright (c) 2017-2020 Ingy döt Net
|
||||
Copyright (c) 2006-2016 Kirill Simonov — https://github.com/yaml/libyaml
|
||||
Re-signed for Developer ID distribution (the hardened runtime's library
|
||||
validation requires the team's own signature); shipped inside a `.bundle`
|
||||
folder so Xcode copies it as a resource instead of linking it into the app.
|
||||
|
||||
## MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
@@ -56,27 +56,14 @@ struct WorkspaceView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
// #91: drag a markdown file onto the window — same guest slot as
|
||||
// File ▸ Open… Non-markdown drops are refused.
|
||||
// #91/#141: drops landing OUTSIDE the editor (over the editor the
|
||||
// text view takes the drag itself — FileDropTextView); one router.
|
||||
.dropDestination(for: URL.self) { urls, _ in
|
||||
// #162: no new buffers while a Cold Turkey block holds —
|
||||
// the open Piece is the one being counted.
|
||||
guard !gate.writingLock.isLocked else { return false }
|
||||
// #141: the window destination is the only one that ever
|
||||
// fires (field-verified 2026-11-02 — nested editor-level
|
||||
// SwiftUI targets are never consulted, and AppKit views
|
||||
// registered for file drags are starved by it).
|
||||
// PURE-markdown sets keep #91's open-as-guest; a mixed
|
||||
// md+image set falls through and ingestDrop refuses it
|
||||
// loudly (images must not vanish silently behind the md).
|
||||
// Nil text view: bounce.
|
||||
if urls.allSatisfy(PostStore.isMarkdown), let url = urls.first {
|
||||
gate.posts.openExternal(url)
|
||||
let landed = gate.routeFileDrop(urls)
|
||||
if landed {
|
||||
selection = .posts
|
||||
return true
|
||||
}
|
||||
guard let textView = gate.proseDrop.textView else { return false }
|
||||
return textView.ingestDrop(urls)
|
||||
return landed
|
||||
}
|
||||
// #21: left-edge hover slides rail+library back in as an overlay.
|
||||
// Library only while the window width allows it (#17 verdict stands:
|
||||
|
||||
@@ -44,7 +44,7 @@ Conventions every suite follows. Per-suite pin inventories are NOT kept here —
|
||||
- `FixCardApplyTests` — fix-card apply/skip/done lifecycle.
|
||||
- `PostsModelTests`, `PassRunTests`, `BlindReadTests`, `EngineLifecycleTests`, `SessionLifecycleTests`, `SessionScopeTests`, `TranscriptRailTests` — model orchestration over the scripted in-process engine (#178): passes, blind read, per-surface engines, session lifecycle, scoped hosting, the typed transcript rail (#177 — speaker/notice type facts through the scripted engine, prefix-free invariant, append-seam classifiers), and the #179 write-rail pins in PostsModelTests (write → one library refresh + strip cleared; failed write owns the strip; nil-Home refuses cleanly; import batch keeps per-file strip messages; mid-pass Home repoint refuses the advance — `endHeldPrompt` is the rig hook that ends a held turn normally, polled to via `hasHeldPrompt` first: `runningPass` flips before the one-shot engine parks its prompt, so firing into that window false-fails under load).
|
||||
- `DeslopLintTests` (with the `DeslopLintWiringTests` member) — native lint findings, config story, emit loop.
|
||||
- `EditorSessionTests`, `ReadingPresenterTests`, `ProsePresenterTests`, `FocusModeTests`, `ImportExternalTests`, `ImageIngestTests` — editor session, reading pipeline, editing-surface parity, focus math, import + image ingest.
|
||||
- `EditorSessionTests`, `ReadingPresenterTests`, `ProsePresenterTests`, `FocusModeTests`, `ImportExternalTests`, `ImageIngestTests` — editor session, reading pipeline, editing-surface parity, focus math, import, image ingest + the 27.2 drag-routing seam (`DragInfoStub`, the suite's NSDraggingInfo mock: a Finder-shaped drag routes through the text view and never pastes the path; text-only drags keep the stock drop; outline rows bounce; the probe follows `changeCount`; web URLs and vanished files refuse with the right notice) + the one router's pins (guest, Cold Turkey refusal, ingest hand-off, mixed refusal).
|
||||
- `OutlineTreeTests`, `OutlinePresenterTests`, `OutlineDragTests`, `EscEventProbeTests` — outliner model, projection, drag plumbing, Esc delivery probe.
|
||||
- `ProseListTests`, `ProseRekeyTests` — prose list model + fold rendering, fold rekey pipeline.
|
||||
- `SettingsModelTests`, `SettingsModelWritePathTests`, `HermesSettingsWriterTests`, `ProviderProbeTests`, `ProviderProbeTransportTests`, `ProviderCredentialTests` — settings model, real CLI write path, probe decode + request builders, the #181 ONE credential resolution (pasted key wins, keyless fallback on the official endpoint, custom-endpoint and no-login refusals).
|
||||
|
||||
@@ -25,6 +25,66 @@ import Foundation
|
||||
@testable import Museion
|
||||
import Testing
|
||||
|
||||
/// The smallest NSDraggingInfo the drag overrides read: only the
|
||||
/// pasteboard matters (the stock text drop also wants a destination view,
|
||||
/// which the hosted text view supplies itself).
|
||||
@MainActor
|
||||
final class DragInfoStub: NSObject, NSDraggingInfo {
|
||||
let draggingPasteboard: NSPasteboard
|
||||
init(_ pb: NSPasteboard) {
|
||||
draggingPasteboard = pb
|
||||
}
|
||||
|
||||
var draggingDestinationWindow: NSWindow? {
|
||||
nil
|
||||
}
|
||||
|
||||
var draggingSourceOperationMask: NSDragOperation {
|
||||
[.copy]
|
||||
}
|
||||
|
||||
var draggingLocation: NSPoint {
|
||||
.zero
|
||||
}
|
||||
|
||||
var draggedImageLocation: NSPoint {
|
||||
.zero
|
||||
}
|
||||
|
||||
var draggedImage: NSImage? {
|
||||
nil
|
||||
}
|
||||
|
||||
var draggingSource: Any? {
|
||||
nil
|
||||
}
|
||||
|
||||
var draggingSequenceNumber: Int {
|
||||
0
|
||||
}
|
||||
|
||||
func slideDraggedImage(to _: NSPoint) {}
|
||||
override func namesOfPromisedFilesDropped(atDestination _: URL) -> [String]? {
|
||||
nil
|
||||
}
|
||||
|
||||
var draggingFormation: NSDraggingFormation = .none
|
||||
var animatesToDestination = false
|
||||
var numberOfValidItemsForDrop = 0
|
||||
func enumerateDraggingItems(
|
||||
options _: NSDraggingItemEnumerationOptions,
|
||||
for _: NSView?,
|
||||
classes _: [AnyClass],
|
||||
searchOptions _: [NSPasteboard.ReadingOptionKey: Any],
|
||||
using _: @escaping (NSDraggingItem, Int, UnsafeMutablePointer<ObjCBool>) -> Void,
|
||||
) {}
|
||||
var springLoadingHighlight: NSSpringLoadingHighlight {
|
||||
.none
|
||||
}
|
||||
|
||||
func resetSpringLoading() {}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
struct ImageIngestTests {
|
||||
/// Throwaway Home + a saved post standing in for the open editor
|
||||
@@ -96,9 +156,10 @@ struct ImageIngestTests {
|
||||
#expect(!FileManager.default.fileExists(atPath: folder.appendingPathComponent("assets").path))
|
||||
}
|
||||
|
||||
// MARK: - #141 drag-layer entry (ingestDrop — the SwiftUI drop
|
||||
// MARK: - #141 drag-layer entry (ingestDrop — whichever surface took
|
||||
|
||||
// target's perform lands on the text view)
|
||||
// the drag routes here: the text view's own handlers over the editor,
|
||||
// the window SwiftUI destination elsewhere)
|
||||
|
||||
@Test func `ingestDrop copies lands the ref and selects alt`() throws {
|
||||
let (_, folder) = try ingestHome()
|
||||
@@ -129,6 +190,189 @@ struct ImageIngestTests {
|
||||
#expect(try !draft.ingestDrop([imageSource("x.png")]))
|
||||
}
|
||||
|
||||
// MARK: - 27.2 drag routing (a drag goes to the deepest destination:
|
||||
|
||||
// FileDropTextView owns drops that land on the editor — stock NSTextView
|
||||
// handling would paste the file PATH)
|
||||
|
||||
/// A Finder-shaped drag pasteboard: `public.file-url` plus the legacy
|
||||
/// filenames type NSTextView registers for.
|
||||
private func finderDragPasteboard(_ urls: [URL]) -> NSPasteboard {
|
||||
let filenames = NSPasteboard.PasteboardType(rawValue: "NSFilenamesPboardType")
|
||||
let pb = NSPasteboard(name: .drag)
|
||||
pb.declareTypes([.fileURL, filenames], owner: nil)
|
||||
pb.setString(urls[0].absoluteString, forType: .fileURL)
|
||||
pb.setPropertyList(urls.map(\.path), forType: filenames)
|
||||
return pb
|
||||
}
|
||||
|
||||
/// A live text view in a window (the stock text drop inserts only into
|
||||
/// a hosted view). Caller orders the window out.
|
||||
private func hostedView() -> (tv: ProseListTextView, win: NSWindow) {
|
||||
let win = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 200, height: 200), styleMask: [.titled], backing: .buffered, defer: false)
|
||||
let tv = ProseListTextView()
|
||||
tv.string = "Body.\n"
|
||||
win.contentView?.addSubview(tv)
|
||||
win.makeFirstResponder(tv)
|
||||
return (tv, win)
|
||||
}
|
||||
|
||||
/// A temp markdown file standing in for a dragged guest.
|
||||
private func markdownSource() throws -> URL {
|
||||
let md = FileManager.default.temporaryDirectory.appendingPathComponent("imageingest-\(UUID().uuidString).md")
|
||||
try "# Guest\n".write(to: md, atomically: true, encoding: .utf8)
|
||||
return md
|
||||
}
|
||||
|
||||
@Test func `a file drag landing on the text view routes, never pastes the path`() throws {
|
||||
let (_, folder) = try ingestHome()
|
||||
let (tv, win) = hostedView()
|
||||
defer { win.orderOut(nil) }
|
||||
tv.ingestFolder = folder
|
||||
tv.onFileDrop = { [weak tv] in tv?.ingestDrop($0) ?? false } // the gate's router in miniature
|
||||
let source = try imageSource("sketch.png")
|
||||
let drag = DragInfoStub(finderDragPasteboard([source]))
|
||||
|
||||
#expect(tv.draggingEntered(drag) == .copy)
|
||||
#expect(tv.draggingUpdated(drag) == .copy)
|
||||
#expect(tv.performDragOperation(drag))
|
||||
#expect(tv.string.contains(""))
|
||||
#expect(!tv.string.contains(source.path), "the stock path paste survived")
|
||||
|
||||
// Unrouted (no handler mounted): a Finder drag claims nothing and
|
||||
// pastes nothing.
|
||||
let (bare, bareWin) = hostedView()
|
||||
defer { bareWin.orderOut(nil) }
|
||||
let bareDrag = DragInfoStub(finderDragPasteboard([source]))
|
||||
#expect(bare.draggingEntered(bareDrag) == [])
|
||||
#expect(!bare.performDragOperation(bareDrag))
|
||||
#expect(bare.string == "Body.\n")
|
||||
}
|
||||
|
||||
@Test func `a text-only drag keeps the stock drop and never reaches the router`() {
|
||||
let (tv, win) = hostedView()
|
||||
defer { win.orderOut(nil) }
|
||||
var routed: [URL]?
|
||||
tv.onFileDrop = { routed = $0; return true }
|
||||
let pb = NSPasteboard(name: .drag)
|
||||
pb.declareTypes([.string], owner: nil)
|
||||
pb.setString("dropped text", forType: .string)
|
||||
|
||||
#expect(FileDropTextView.classify(pb) == .text)
|
||||
#expect(tv.draggingEntered(DragInfoStub(pb)) == .copy)
|
||||
#expect(tv.performDragOperation(DragInfoStub(pb)))
|
||||
#expect(tv.string.contains("dropped text"))
|
||||
#expect(routed == nil)
|
||||
|
||||
// URL-less AND text-less (raw image data from Photos/Preview): bounces.
|
||||
let png = NSPasteboard(name: .drag)
|
||||
png.declareTypes([.png], owner: nil)
|
||||
#expect(tv.draggingEntered(DragInfoStub(png)) == [])
|
||||
#expect(!tv.performDragOperation(DragInfoStub(png)))
|
||||
#expect(tv.string.contains("dropped text"))
|
||||
}
|
||||
|
||||
@Test func `the drag probe follows the pasteboard contents, not its memory`() throws {
|
||||
let (tv, win) = hostedView()
|
||||
defer { win.orderOut(nil) }
|
||||
let source = try imageSource("sketch.png")
|
||||
let pb = finderDragPasteboard([source])
|
||||
#expect(tv.dropKind(of: pb) == .urls([source]))
|
||||
// Same pasteboard object, new contents (changeCount moved): follows.
|
||||
pb.declareTypes([.string], owner: nil)
|
||||
pb.setString("now text", forType: .string)
|
||||
#expect(tv.dropKind(of: pb) == .text)
|
||||
pb.clearContents()
|
||||
#expect(tv.dropKind(of: pb) == .none)
|
||||
}
|
||||
|
||||
@Test func `the outline rows bounce a file drag instead of pasting the path`() throws {
|
||||
let win = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 200, height: 200), styleMask: [.titled], backing: .buffered, defer: false)
|
||||
defer { win.orderOut(nil) }
|
||||
let row = RowTextView()
|
||||
row.string = "- item"
|
||||
win.contentView?.addSubview(row)
|
||||
let drag = try DragInfoStub(finderDragPasteboard([imageSource("sketch.png")]))
|
||||
|
||||
#expect(row.draggingEntered(drag) == [])
|
||||
#expect(!row.performDragOperation(drag))
|
||||
#expect(row.string == "- item")
|
||||
}
|
||||
|
||||
@Test func `a web URL refuses loudly with the type notice and plants nothing`() throws {
|
||||
// A browser image drag reaches the router as an https URL — the
|
||||
// extension looks publishable, but nothing is on disk to copy. The
|
||||
// sink would refuse it too; only the isFileURL gate names the type.
|
||||
let (_, folder) = try ingestHome()
|
||||
let tv = ProseListTextView()
|
||||
tv.string = "Body.\n"
|
||||
tv.ingestFolder = folder
|
||||
let web = try #require(URL(string: "https://example.com/cat.jpg"))
|
||||
#expect(!tv.ingestDrop([web]))
|
||||
#expect(tv.lastIngestNotice?.hasPrefix("Drop images") == true, "notice: \(tv.lastIngestNotice ?? "nil")")
|
||||
#expect(!FileManager.default.fileExists(atPath: folder.appendingPathComponent("assets").path))
|
||||
}
|
||||
|
||||
@Test func `a file that vanished after the drag refuses as missing, not as a folder`() throws {
|
||||
let (_, folder) = try ingestHome()
|
||||
let tv = ProseListTextView()
|
||||
tv.string = "Body.\n"
|
||||
tv.ingestFolder = folder
|
||||
let gone = try imageSource("ghost.png")
|
||||
try FileManager.default.removeItem(at: gone)
|
||||
#expect(!tv.ingestDrop([gone]))
|
||||
let notice = try #require(tv.lastIngestNotice)
|
||||
#expect(notice.contains("couldn’t be read"), "notice: \(notice)")
|
||||
#expect(!notice.contains("folder"), "notice: \(notice)")
|
||||
#expect(!FileManager.default.fileExists(atPath: folder.appendingPathComponent("assets").path))
|
||||
}
|
||||
|
||||
// MARK: - The one router (AppGateState.routeFileDrop)
|
||||
|
||||
@Test func `the router opens a pure-markdown set as the guest`() throws {
|
||||
let gate = AppGateState()
|
||||
let md = try markdownSource()
|
||||
defer { try? FileManager.default.removeItem(at: md) }
|
||||
#expect(gate.routeFileDrop([md]))
|
||||
#expect(gate.posts.externalSession != nil)
|
||||
}
|
||||
|
||||
@Test func `the router refuses everything while a Cold Turkey block holds`() throws {
|
||||
let gate = AppGateState()
|
||||
gate.posts.newPost()
|
||||
gate.posts.draft?.text = "seed words here"
|
||||
gate.startWritingLock(goal: .words(2))
|
||||
defer {
|
||||
gate.writingLock.feed(text: "seed words here plus two more")
|
||||
gate.writingLock.tick()
|
||||
}
|
||||
let md = try markdownSource()
|
||||
defer { try? FileManager.default.removeItem(at: md) }
|
||||
#expect(gate.writingLock.isLocked)
|
||||
#expect(!gate.routeFileDrop([md]))
|
||||
#expect(gate.posts.externalSession == nil)
|
||||
}
|
||||
|
||||
@Test func `the router hands non-markdown to the open piece's ingest`() throws {
|
||||
let gate = AppGateState()
|
||||
let (_, folder) = try ingestHome()
|
||||
let source = try imageSource("sketch.png")
|
||||
// No editor mounted: bounce.
|
||||
#expect(!gate.routeFileDrop([source]))
|
||||
let tv = ProseListTextView()
|
||||
tv.string = "Body.\n"
|
||||
tv.ingestFolder = folder
|
||||
gate.proseDrop.textView = tv
|
||||
#expect(gate.routeFileDrop([source]))
|
||||
#expect(tv.string.contains(""))
|
||||
// A mixed md+image set reaches the ingest's loud refusal, never the guest.
|
||||
let md = try markdownSource()
|
||||
defer { try? FileManager.default.removeItem(at: md) }
|
||||
#expect(try !gate.routeFileDrop([imageSource("second.png"), md]))
|
||||
#expect(tv.lastIngestNotice?.hasPrefix("Drop images") == true)
|
||||
#expect(gate.posts.externalSession == nil)
|
||||
}
|
||||
|
||||
// MARK: - #141 finish-audit pins
|
||||
|
||||
@Test func `a dropped symlink refuses with nothing planted`() throws {
|
||||
@@ -149,8 +393,8 @@ struct ImageIngestTests {
|
||||
}
|
||||
|
||||
@Test func `a mixed image and markdown set refuses loudly`() throws {
|
||||
// The window destination forwards only PURE-markdown sets (#91);
|
||||
// a mixed set must reach this refusal, not vanish behind the md.
|
||||
// The router forwards only PURE-markdown sets (#91); a mixed set
|
||||
// must reach this refusal, not vanish behind the md.
|
||||
let (_, folder) = try ingestHome()
|
||||
let tv = ProseListTextView()
|
||||
tv.string = "Body.\n"
|
||||
|
||||
@@ -322,7 +322,7 @@ extension ProseFoldRekeyTests {
|
||||
debounce: .seconds(3600),
|
||||
)
|
||||
let coordinator = ProseTextView.Coordinator(
|
||||
representable: ProseTextView(session: session, dropBridge: ProseDropBridge()),
|
||||
representable: ProseTextView(session: session, dropBridge: ProseDropBridge(), routeDrop: { _ in false }),
|
||||
)
|
||||
textView.delegate = coordinator // production wiring (PostEditorView)
|
||||
textView.setSelectedRange(NSRange(location: 0, length: 0))
|
||||
|
||||
@@ -1,40 +1,158 @@
|
||||
# Museion
|
||||
|
||||
The Agentic Writing Environment (AWE): where scholars, texts, and AI minds work under a single roof — named for the Mouseion of Alexandria, the one place in history where they already did.
|
||||
**The Agentic Writing Environment** — a native macOS app where your text, your library, and a resident AI mentor work under one roof. Named for the Mouseion of Alexandria, the one place in history where they already did.
|
||||
|
||||
[](LICENSE)
|
||||
|
||||
An Obsidian-and-Copilot-class tool for long-form AI-assisted writing, with Ulysses/Scrivener depth and Paper elegance. Native macOS, built in SwiftUI.
|
||||
Museion is built for long-form writers who want to get *better*, not ghostwritten. The mentor critiques, demonstrates, and remembers your recurring weaknesses — and nothing ships without your hand on it. Everything you write is plain markdown in a folder you own.
|
||||
|
||||
## Features
|
||||
|
||||
### Writing
|
||||
|
||||
- **Native prose editor** (TextKit 2) with styled markdown source — headings scale, syntax dims, the plain file stays the truth. Autosaves about a second after you stop typing; `⌘S` saves now. The dot in the toolbar tells the truth: changed, saved, or failed.
|
||||
- **Reading mode** (`⌘R`) renders the piece for reading. Click anywhere to drop back into editing at that spot.
|
||||
- **Focus mode** (`⌥⌘F`) recesses the library, the mentor, and the toolbar; they return on edge hover.
|
||||
- **Cold Turkey** — a writing lock inside focus mode. Set a goal (net new words, or minutes) and Museion goes into a fullscreen kiosk until you meet it. Quitting asks once. Nothing persists.
|
||||
- **Drop an image** into prose: it is copied into the piece's `assets/` and a markdown reference lands at the drop point with the alt text selected.
|
||||
- **Lists** — `Tab` / `⇧Tab` indents and outdents, `⌥↑` / `⌥↓` moves the item with its subtree. Nested lists fold behind a gutter chevron.
|
||||
- **External files** — `⌘O` opens any `.md` file in place as a guest (never converted, never moved). `⇧⌘O` imports `.md` files as posts (copies; the originals stay put).
|
||||
- An edit from outside (Finder, iCloud, another editor) raises a **Reload / Keep Local** alert — never a silent overwrite. Cursor and scroll position come back on reopen.
|
||||
|
||||
### Outlines
|
||||
|
||||
Outline pieces are plain nested bullets with LogSeq-style keys: `⌘↑` / `⌘↓` fold, `Enter` splits at the caret, double-click a bullet to zoom into its branch with breadcrumbs back out. Drag blocks to reorder or nest. **Convert to Post…** turns an outline into prose — verbatim bullets, or a headings ladder. One-way in v1.
|
||||
|
||||
### Library
|
||||
|
||||
- Pieces live under **projects** and fold into an **archive**. The library column groups by project and Pass State, with collapse toggles and counts.
|
||||
- **Search** across titles and bodies (frontmatter excluded), title matches first.
|
||||
- Rename (retitles and moves the folder), move to project, archive, restore, trash — all from the row's menu. A folder move flushes pending edits first; a failed write aborts the move with nothing relocated.
|
||||
- The library mirrors the folder live: a recursive file watcher picks up Finder edits, new pieces, and deletes.
|
||||
|
||||
### The Mentor
|
||||
|
||||
- The mentor is a resident **[Hermes](https://hermes-agent.nousresearch.com/docs)** engine you install yourself, spawned as a child process over ACP under three isolated profiles — `museion` for Chat and Sessions, `museion-pass1` and `museion-pass2` for the passes. Model, provider, and reasoning effort are set per surface in Settings and written through Hermes' own config rail. z.ai, Anthropic, OpenAI, and Nous Portal are wired up; **Test Connection** says in plain words what is wrong.
|
||||
- **Passes** — Pass 1 critiques structure, argument, and flow (paragraph level and up); Pass 2 works at sentence level and below. Each pass streams live and ends in a verdict plus **Fix Cards**.
|
||||
- **Fix Cards** are a first-class surface, never toasts. A mechanical card offers **Apply** behind a sheet showing the exact edit (anchored quote → replacement) — one card at a time, there is no apply-all. A demonstration card shows one annotated example on your own text and closes Done or Skip. A stale anchor (the text moved) flags the card instead of editing.
|
||||
- **Deslop lint** runs natively in Swift at every pass invocation — banned-vocabulary tiers and em-dash density land as cards before the engine even sees the piece. Override the tables with `<Home>/deslop-lint.json`.
|
||||
- **Learnings** — promote a card into a per-writer, per-content-type memory of your recurring weaknesses. Plain markdown files in the Home; every later pass consults them. Dismiss a Learning and it fades, resurfacing after 10 completed passes (doubling on each re-dismiss).
|
||||
- **Sessions** — freeform conversations: new, resume, fork, compact, Stop. **New Post** turns a reply into a piece (stamped `origin: ai`, never stats-eligible). A Brainstorm is a session with an opener.
|
||||
- **Blind Read** — an advisory A/B judgment of the current text against the pass-start snapshot, by a fresh session that never saw the history. Records nothing; you stay the judge.
|
||||
- **Research notes** — mid-pass findings arrive as candidate cards with provenance. Keep lands a note in the piece's `research/`; Reject vanishes.
|
||||
- **Drill offers** — two-minute craft drills riding the finding that motivates them. Declined drills vanish; drill output never touches the draft.
|
||||
- The methodology ships as markdown skills seeded into the profiles (the Serif stack, deslop, pass and session personas, demonstrator doctrine, craft canon, the VOICE payload). Your own skills are never overwritten.
|
||||
|
||||
### Measuring progress
|
||||
|
||||
Running a pass on an unaided first draft captures four style metrics — burstiness, type-token ratio, sentence variation, trigram repetition — before the mentor sees the text. The **Trends** pane charts them across captures with an honest *improving / steady / slipping* verdict per metric.
|
||||
|
||||
### Publishing
|
||||
|
||||
**[Micro.blog](https://micro.blog) via Micropub:** Publish ▸ **Send as Draft** ▸ review on Micro.blog ▸ **Publish**. The app token lives in your login keychain. Illustrations upload first and ride inline where you placed them; a picture without alt text never ships. The piece on disk never changes.
|
||||
|
||||
### Rails
|
||||
|
||||
- Hardened runtime on; sandbox off (the app spawns your `hermes` binary).
|
||||
- Daily backup of the three Hermes profiles, last seven kept — Help ▸ Open Backup Folder.
|
||||
- Quit, navigation, and Home changes all pass one departure gate: an unanswered conflict or a failed save blocks the move. Edits are never dropped.
|
||||
|
||||
## Requirements
|
||||
|
||||
- macOS 26.5+ — developed against the latest Xcode (26.x) and Swift (6.3.x); no backward compatibility
|
||||
- [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) and [SwiftLint](https://github.com/realm/SwiftLint) for linting (`brew install swiftformat swiftlint`)
|
||||
- **macOS 27 or later** (Apple Silicon).
|
||||
- **Hermes engine** — needed for Passes and Sessions. The editor, library, outlines, and publishing work without it. Install with `curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash` ([installation guide](https://hermes-agent.nousresearch.com/docs)).
|
||||
- A provider API key for the model the mentor should run on (Settings ▸ Provider Keys).
|
||||
- A [Micro.blog](https://micro.blog) account — only if you publish.
|
||||
|
||||
## Getting started
|
||||
### Fonts
|
||||
|
||||
```bash
|
||||
git clone https://git.babylondreams.de/AlexKucera/museion.git
|
||||
cd museion
|
||||
Museion's typography is set in Matthew Butterick's typefaces. They are commercial, so the app does not ship them — install them yourself (open each `.otf` in Font Book):
|
||||
|
||||
open Museion.xcodeproj # develop in Xcode
|
||||
xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' build # build
|
||||
xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' test # test (unit + UI)
|
||||
swiftformat . && swiftlint . # lint
|
||||
```
|
||||
- **[Valkyrie OT](https://practicaltypography.com/valkyrie.html)**, the B cut — body text, document titles, the mentor's prose.
|
||||
- **[Concourse OT](https://practicaltypography.com/concourse.html)** — headings and your side of the conversation.
|
||||
- **[Ubuntu Mono Nerd Font](https://www.nerdfonts.com/font-downloads)** — code and syntax dimming (free).
|
||||
|
||||
Full Xcode project at the repo root — `open Museion.xcodeproj` and run.
|
||||
Without them Museion still works: the editor falls back to the system font (SF Pro), Reading mode to Georgia. The spacing is calibrated on the real faces, so install them for the intended look.
|
||||
|
||||
## Install
|
||||
|
||||
Download `Museion-<version>.dmg` from [Releases](https://git.babylondreams.de/AlexKucera/museion/releases), open it, drag Museion to **Applications**.
|
||||
|
||||
The app is signed with a Developer ID and notarized with Apple, so it opens like any other app.
|
||||
|
||||
## Quick start
|
||||
|
||||
1. **First launch** picks your **Museion Home** — the folder everything lives in. Fresh installs get `iCloud Drive/Museion` when iCloud Drive is on, otherwise `~/Documents/Museion`. Settings ▸ Content shows the path; repoint any time (Museion never moves files).
|
||||
2. **Install Hermes** (one-liner above). Museion finds it on the next launch, creates the three profiles, and seeds the writing skills — nothing else to set up. The rail pill and the Mentor header show engine state; the status card carries **Re-check**.
|
||||
3. **Add a provider key** under Settings ▸ Provider Keys and hit **Test Connection**.
|
||||
4. **Write.** `⌘N` for a new post, `⇧⌘N` for an outline. The first line is the title.
|
||||
5. **Run a Pass** from the Mentor pane. Read the verdict, work the Fix Cards one at a time, promote the patterns worth remembering into Learnings.
|
||||
6. **Publish** when the piece is yours.
|
||||
|
||||
## Support Museion
|
||||
|
||||
Museion is free and open source. It is one of a suite of apps I build and publish, and together they are my only income.
|
||||
|
||||
Every feature above took hours to build. Those hours have to come from somewhere. If Museion has become part of how you write, a coffee at **[buymeacoffee.com/babylondreams](https://buymeacoffee.com/babylondreams)** keeps them coming, for this app and the rest of the suite.
|
||||
|
||||
Thank you for writing with it.
|
||||
|
||||
## Keyboard shortcuts
|
||||
|
||||
| Action | Keys |
|
||||
| --- | --- |
|
||||
| New Post · New Outline · New Project… | `⌘N` · `⇧⌘N` · `⌥⌘N` |
|
||||
| Open a file as a guest · Import files | `⌘O` · `⇧⌘O` |
|
||||
| Save | `⌘S` |
|
||||
| Toggle Reading Mode | `⌘R` |
|
||||
| Toggle Focus Mode | `⌥⌘F` |
|
||||
| Start Cold Turkey… | View menu (inside focus mode) |
|
||||
| Check Spelling While Typing | Edit menu (off by default) |
|
||||
| Prose list: indent · outdent · move item | `Tab` · `⇧Tab` · `⌥↑` `⌥↓` |
|
||||
| Outline: fold · move subtree · select blocks · split | `⌘↑` `⌘↓` · `⌥↑` `⌥↓` · `⇧↑` `⇧↓` · `Enter` |
|
||||
| Composer: send · newline | `Return` · `⇧Return` |
|
||||
|
||||
## Your Museion Home
|
||||
|
||||
Everything you write lives in one folder — the **Museion Home** — as plain markdown you can reach from anywhere.
|
||||
|
||||
```
|
||||
<Home>/
|
||||
projects/<project>/<piece-id>/post.md one piece, one folder
|
||||
assets/ illustrations (drop an image)
|
||||
research/ kept research notes
|
||||
cards/ the piece's fix cards
|
||||
passes/ pass-start snapshots
|
||||
archive/<project>/<piece-id>/post.md finished work, Finder-visible
|
||||
learnings/<content-type>/… promoted patterns, one markdown file each
|
||||
deslop-lint.json optional lint-table override
|
||||
```
|
||||
|
||||
- **Default for new Homes: `iCloud Drive/Museion`** — `~/Library/Mobile Documents/com~apple~CloudDocs/Museion`, resolved dynamically. When iCloud Drive is unavailable at first run, Museion silently falls back to `~/Documents/Museion` — no dialog; the Settings Home field shows the resolved path. An existing `~/Documents/Museion` Home is never silently moved — it stays your Home until you migrate it yourself (#169).
|
||||
- **Migrating an existing Home:** Museion is repoint-only — it never moves content. Move the `Museion` folder in Finder (e.g. `~/Documents/Museion` → `iCloud Drive/Museion`), then repoint via **Settings ▸ Content ▸ Museion Home ▸ Choose…** (Museion/SettingsPaneView.swift:199).
|
||||
- **Migrating an existing Home:** Museion is repoint-only — it never moves content. Move the `Museion` folder in Finder (e.g. `~/Documents/Museion` → `iCloud Drive/Museion`), then repoint via **Settings ▸ Content ▸ Museion Home ▸ Choose…**.
|
||||
- **Avoid eviction stalls:** right-click the `Museion` folder in Finder and choose **Keep Downloaded**. Pinning keeps files local, so opening a piece never waits on a download (#168).
|
||||
- **iCloud quirks are substrate, not bugs:** editing the same file on two devices yields numbered duplicate siblings — iCloud keeps both, it never merges. An evicted file keeps its real name and size, but its first read blocks while the data downloads (#168).
|
||||
- **Companions:** Textastic-class editors open and edit pieces in place on iPhone/iPad via the Files app / document picker; iCloud.com and iCloud for Windows reach the Home too (#168, #169).
|
||||
|
||||
## Development
|
||||
|
||||
SwiftUI, Swift 6 (language mode 6, default MainActor isolation), macOS 27+, latest Xcode only — no backward compatibility, no pinned toolchains.
|
||||
|
||||
```bash
|
||||
git clone https://git.babylondreams.de/AlexKucera/museion.git
|
||||
cd museion
|
||||
|
||||
open Museion.xcodeproj # develop in Xcode
|
||||
./scripts/build-and-run.sh # build + launch (⌘R equivalent)
|
||||
xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' build
|
||||
./scripts/full-test.sh start && ./scripts/full-test.sh status # full unit suite (verify rail)
|
||||
swiftformat . && swiftlint . # lint (brew install swiftformat swiftlint)
|
||||
./scripts/deploy.sh # Release build → /Applications
|
||||
./scripts/release.sh # Developer ID-signed, notarized DMG → dist/
|
||||
```
|
||||
|
||||
`AGENTS.md` is the binding work contract for agents and humans alike; `GLOSSARY.md` pins the vocabulary; decisions live in `docs/adr/`; one session log per task in `docs/devlog/`.
|
||||
|
||||
## License
|
||||
|
||||
GPL-3.0-or-later — see [LICENSE](LICENSE).
|
||||
GPL-3.0-or-later — see [LICENSE](LICENSE). The bundled reading renderer (apex) and its libyaml are MIT; see [Museion/Resources/THIRD-PARTY-NOTICES.md](Museion/Resources/THIRD-PARTY-NOTICES.md).
|
||||
@@ -14,6 +14,7 @@ Owned by the root AGENTS.md contract.
|
||||
- ADR format follows the domain-modeling skill's `ADR-FORMAT.md`: short title + 1–3 sentences; optional Considered Options / Consequences only when they earn their place.
|
||||
- `docs/agents/` holds the engineering-skills config (issue tracker, triage labels, domain-docs consumer rules) written by `setup-matt-pocock-skills` — edit directly, no child doc needed.
|
||||
- `docs/sample-pass.md` is the worked sample Pass demonstrating the craft-canon skills firing as Fix Cards (issues #7, #11, #123, and #58 verification artifacts); card shape follows GLOSSARY.md (lane and emitter fields included), anchors follow ADR-0006.
|
||||
- `docs/releases/<version>.md` holds the release notes, one file per released version, written for humans: highlights, the milestones it closes, install, known limits. It distills that version's `CHANGELOG.md` section (which stays the entry-by-entry record with issue numbers); the Gitea release body is pasted from it.
|
||||
|
||||
## Work Guidance
|
||||
|
||||
@@ -31,3 +32,4 @@ Owned by the root AGENTS.md contract.
|
||||
| `agents/` | Agent-skills config — issue-tracker, triage-label, domain conventions (written by `/setup-matt-pocock-skills`) |
|
||||
| `brainstorming-output/` | Transient brainstorming session records — working artifacts, not durable decisions; durable outcomes flow into PRD/ADRs |
|
||||
| `research/` | Verified research artifacts (provider/API factsheets) feeding ADRs — source-cited and probe-dated, not decisions |
|
||||
| `releases/` | Release notes per version — human-readable distillation of the CHANGELOG section; the Gitea release body |
|
||||
@@ -9,7 +9,7 @@ Reading mode renders markdown through apex (MIT, unified dialect) as an HTML fra
|
||||
|
||||
## Consequences
|
||||
|
||||
- **Bundling:** the prebuilt apex binary ships in app resources, signed + notarized. No source build in CI, no user install gate — a renderer must not grow a gate.
|
||||
- **Bundling:** the prebuilt apex binary (arm64 slice) and a vendored libyaml ship in app resources, Developer ID–signed at commit time (apex with the hardened runtime), apex's rpaths replaced by the single `@executable_path/../Resources`, which resolves in the bundle and in the checkout alike; Xcode copies and seals both as resources untouched. The vendored copy lives in `Resources/libyaml.bundle/` ON PURPOSE: Xcode's synced-folder classifier sniffs Mach-O content and silently adds any bare dylib (extension or not) to the app's link phase; a `.bundle` folder is an opaque resource. apex's release build links libyaml through CI/Homebrew rpaths, so alone it only ever ran on developer machines — reading mode silently fell back to source for everyone else (surfaced by the 0.1.0 notarization, which also rejects an unsigned Mach-O in Resources). Re-sign both when the Developer ID certificate rotates (`codesign -f -s "<identity>" --options runtime --timestamp Resources/apex`; `codesign -f -s "<identity>" --timestamp Resources/libyaml.bundle/libyaml-0.2.dylib`). No source build in CI, no user install gate — a renderer must not grow a gate. Licenses: `Resources/THIRD-PARTY-NOTICES.md`.
|
||||
- **One WKWebView, reloaded in place.** Remounting per document (`.id(sel)`) was the dominant switch cost — hundreds of ms of web-process respawn; `loadHTMLString` on a retained view feels instant.
|
||||
- **`--no-mixed-lists` is required**, not tuning: apex's default merges an ordered list following a bullet list into one `<ul>`, killing `1. 1. 1.` auto-renumbering.
|
||||
- **Early handoff:** stdout EOF is conversion done; apex's ~65 ms teardown is reaped async via `terminationHandler` (the error path still waits for exit status).
|
||||
@@ -0,0 +1,130 @@
|
||||
# Release 0.1.0 — version bump, README rewrite, release notes, DMG packaging
|
||||
|
||||
> **Date:** 2026-12-01
|
||||
> **Type:** milestone
|
||||
> **Reference:** tag `v0.1.0` at `d470615` (local; push + Gitea release pending Alexander's go)
|
||||
|
||||
## Goal
|
||||
|
||||
Cut the first release: bump to 0.1.0 with a git tag, a DMG shareable on Gitea, a human-readable
|
||||
release-notes document (CHANGELOG.md is too dense for a release page), and a README with a real
|
||||
feature list and usage instructions now that the codebase is stable.
|
||||
|
||||
## What Was Done
|
||||
|
||||
- `Museion.xcodeproj/project.pbxproj`: `MARKETING_VERSION` 1.0 → 0.1.0 on all three targets (six
|
||||
configs). `CURRENT_PROJECT_VERSION` stays 1. Verified in a real Release archive: Info.plist reads
|
||||
`0.1.0` / `1`, `LSMinimumSystemVersion` 27.0, binary arm64 only.
|
||||
- `CHANGELOG.md`: `## [0.1.0] - 2026-12-01` heading over the former Unreleased entries, empty
|
||||
`[Unreleased]` above, pointer to the release notes.
|
||||
- `README.md`: rewritten. Intro → features (Writing, Outlines, Library, The Mentor, Measuring
|
||||
progress, Publishing, Rails) → requirements → install → quick start → shortcut table → the
|
||||
Museion Home (kept, plus a folder-layout block) → development commands → license. Every feature
|
||||
line grounded in `MuseionApp.swift` (menus/shortcuts), `Museion/AGENTS.md`, and CHANGELOG entries;
|
||||
nothing from the PRD's ambitions.
|
||||
- `docs/releases/0.1.0.md`: the distilled notes — what's in it, the milestones closed (M0–M6 plus
|
||||
the post-v1 extensions), install, known limits, numbers. This is the Gitea release body.
|
||||
- `scripts/release.sh`: archive → `-exportArchive` with `method: developer-id` → UDZO DMG
|
||||
(`diskutil image create from`) → `notarytool --wait` → `stapler staple` → `spctl` assessment.
|
||||
Preflight refuses before any build when no `Developer ID Application` identity is in the
|
||||
keychain. `NOTARIZE=0` skips notarize+staple. Output `dist/Museion-<MARKETING_VERSION>.dmg`
|
||||
(version read from build settings, not from the pbxproj text). `.gitignore` gains `dist/`.
|
||||
- DOX: root `AGENTS.md` commands block + scripts index row + Stack line (macOS 27+, see gotchas);
|
||||
`docs/AGENTS.md` Local Contract for `docs/releases/<version>.md` + Child DOX Index row.
|
||||
- Three commits (`docs(readme)`, `build(release)`, `chore(release)`) and annotated tag `v0.1.0` on
|
||||
the last.
|
||||
- **Signing prerequisites (Alexander, this Mac):** Developer ID Application identity created through
|
||||
developer.apple.com + a Keychain Access CSR (Xcode's Manage Certificates refuses even for the
|
||||
Account Holder); `notarytool store-credentials museion-notary` registered by Alexander.
|
||||
- **`scripts/release.sh` hardened by the real runs:** capture `codesign -dvv` before grepping
|
||||
(pipefail + `grep -q` SIGPIPEs codesign → false "not Developer ID signed"); read notarytool's
|
||||
status FIELD (`--wait` exits 0 on Invalid; JSON goes to stdout only — no output-path option);
|
||||
sign the DMG before submitting (Gatekeeper's `spctl -t open` on the image needs it); retry the
|
||||
staple 6× (ticket can lag "Accepted"); two shipped-layout proofs before notarizing — apex must
|
||||
run from the export and the app must not link libyaml.
|
||||
- **Reading renderer made self-contained (`Museion/Resources/`):** `apex` → 1.1.58 (the
|
||||
bundle had 1.1.17; the official universal release tarball, `.sha256` verified), arm64 slice,
|
||||
rpaths replaced by the single `@executable_path/../Resources/libyaml.bundle`, Developer ID–signed
|
||||
with `--options runtime`; `libyaml.bundle/libyaml-0.2.dylib` (0.2.5 from Homebrew's Cellar, install
|
||||
name `@rpath/libyaml-0.2.dylib`) beside it, same identity; `THIRD-PARTY-NOTICES.md` (both MIT
|
||||
texts fetched from the source repos). `--no-mixed-lists` still exists in 1.1.58 (ADR-0011's
|
||||
requirement). ADR-0011's Bundling consequence rewritten; `Museion/AGENTS.md`
|
||||
reading-mode line; README license pointer; CHANGELOG `**reading:**` entry.
|
||||
- Final DMG: `dist/Museion-0.1.0.dmg` 3.0 MB — notarization **Accepted**, staple valid, `spctl`:
|
||||
DMG and the app inside both `accepted, source=Notarized Developer ID`; apex runs from the mounted
|
||||
DMG with the bundled libyaml.
|
||||
- Verification: `scripts/full-test.sh` at the tagged commit — 717 executed / 717 passed / 0 failed;
|
||||
`shellcheck scripts/release.sh` clean; `bash -n` clean; preflight refusal exercised; archive step
|
||||
ran (38 s); DMG step proven on the dev-signed archive app (3.3 MB UDZO, mounts, signature
|
||||
verifies inside).
|
||||
|
||||
## Decisions & Rationale
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| No wayfinder map — direct session | The skill's own test: no fog, one session. The only real decision (signing) was a question for Alexander, not a ticket. |
|
||||
| `v0.1.0` tag with the `v` | The convention Gitea release pages expect; annotated so it carries a message. |
|
||||
| Tag AFTER the docs commits | The tagged tree must contain the README and release notes it describes. |
|
||||
| DMG, no zip | Same effort with `diskutil image create`; DMG is what Mac users expect. |
|
||||
| `docs/releases/<version>.md` over a root `RELEASE_NOTES.md` | Scales per release, lives under the docs contract, reviewable in the commit; the Gitea release body is pasted from it. |
|
||||
| `archive` + `-exportArchive` (method `developer-id`) over a plain Release build with `CODE_SIGN_IDENTITY` overrides | The Xcode-sanctioned distribution path — identical to Organizer's export, so a GUI fallback matches. Preflight guarantees no portal-side surprise from `-allowProvisioningUpdates`. |
|
||||
| arm64 only | `MACOSX_DEPLOYMENT_TARGET = 27.0`; macOS 27 does not run on Intel, so a universal binary is dead weight. |
|
||||
| Developer ID + notarization | Alexander has a Developer ID (not yet on this Mac). Without notarization Gatekeeper still blocks on Sequoia+ regardless of the signing cert, so Developer ID alone buys nothing for the downloader. |
|
||||
| `diskutil image create from` over `hdiutil create` | hdiutil create is deprecated on macOS 27 (warning on every run); the replacement produced an identical UDZO image. |
|
||||
| Stale README "macOS 26.5+" → 27+ | pbxproj `MACOSX_DEPLOYMENT_TARGET = 27.0` on all six configs and `Museion/AGENTS.md` already said 27.0; the root Stack line was corrected to match. |
|
||||
|
||||
## Gotchas & Fixes
|
||||
|
||||
| Problem | Root Cause | Fix |
|
||||
|---------|------------|-----|
|
||||
| `codesign -dv` prints no `Authority=` lines — the script's Developer-ID check would have false-failed on the real run | Authority chain needs `-dvv` | `codesign -dvv` in both the check and the diagnostic echo |
|
||||
| `hdiutil create` warns "deprecated. Please use 'diskutil image create…'" on macOS 27 | Apple moved image creation under diskutil | `diskutil image create from --format UDZO --volumeName … <stage> <dmg>`; kept `hdiutil detach` for the busy-volume guard (not deprecated) |
|
||||
| `security find-identity -v -p codesigning` showed only `Apple Development` despite Alexander having a Developer ID | A Developer ID private key exists only on the Mac that generated the CSR; the portal copy is useless without it | Preflight names the Xcode path (Settings ▸ Accounts ▸ Manage Certificates ▸ + ▸ Developer ID Application) or a `.p12` import from the other Mac |
|
||||
| `git log --oneline` hid the merge commit `3bb1782` and read as if HEAD were `cac66f6` | This machine's log config suppresses merges in short logs | Trust `git status --branch` and `git show -s` for ancestry; the snapshot's "ahead 2" was the merge + one chore commit |
|
||||
| AGENTS.md session-log window was one log stale (11-23 missing) | The 11-23 write-log did not refresh the window | Window rebuilt from INDEX's 10 newest rows |
|
||||
| Xcode ▸ Manage Certificates ▸ + ▸ Developer ID Application: "This operation can only be performed by the Account Holder" — for the Account Holder | Xcode caches the team role as Admin on Xcode 27.2 / macOS 27.2 (documented by others on the same combo) | Website route: Keychain Access ▸ Certificate Assistant CSR → developer.apple.com ▸ Certificates ▸ + → download `.cer` → `security import` (not `open`, which strands an "Add Certificates" dialog). Script header + refusal message point there now |
|
||||
| First notarization: `notarytool --wait` passed, `stapler` failed "Record not found" | Submission was **Invalid**, not slow: `--wait` exits 0 on Invalid, so `set -e` walked on | Script reads the status field from `--output-format json` (stdout only) and prints Apple's log on anything but Accepted |
|
||||
| Apple's log: `Contents/Resources/apex` "does not have the hardened runtime enabled" | Xcode never signs Mach-Os in Resources — the bundled apex was ad-hoc linker-signed | Sign apex at commit time with Developer ID + `--options runtime`; Xcode copies and seals it as a resource |
|
||||
| Deeper: the bundled apex could never run on a clean Mac | apex's release build links `@rpath/libyaml-0.2.dylib` with rpaths for its CI runner, `/usr/local/lib`, `/opt/homebrew/lib`; macOS ships no libyaml → reading mode silently fell back to source for every non-Homebrew user since #76 | Vendor `libyaml.bundle/libyaml-0.2.dylib` beside apex, same team signature (library validation), one rpath that resolves in bundle AND checkout; proved by removing the dylib ("Library not loaded") and restoring it |
|
||||
| `Museion/Resources/libyaml-0.2.dylib` → `ld: library 'yaml-0' not found`; and `otool -L Museion` showed `@rpath/libyaml-0.2.dylib` with nothing in Frameworks | Xcode's synced-folder classifier treats a dylib in the folder as the APP's link target — would have shipped an app that can't launch | Extension-less still linked (Xcode sniffs Mach-O content); a `.bundle` folder is an opaque resource → `libyaml.bundle/`. `release.sh` now refuses if the app links libyaml and runs apex from the export |
|
||||
| `spctl -a -t open … Museion-0.1.0.dmg` → "rejected, source=no usable signature" after a successful notarize+staple | The DMG itself was unsigned; the image-level assessment needs a signature for the ticket to ride | `codesign --timestamp --sign "$SIGNER" "$DMG"` before submitting |
|
||||
| `lipo … -out` → usage dump | The flag is `-output` | `lipo in -thin arm64 -output out` |
|
||||
|
||||
## Files Changed
|
||||
|
||||
| File | Change Summary |
|
||||
|------|---------------|
|
||||
| `Museion.xcodeproj/project.pbxproj` | `MARKETING_VERSION = 0.1.0` ×6 |
|
||||
| `CHANGELOG.md` | `[0.1.0] - 2026-12-01` heading + notes pointer |
|
||||
| `README.md` | Full rewrite: features, requirements, install, quick start, shortcuts, Home layout, development |
|
||||
| `docs/releases/0.1.0.md` | New — distilled release notes (Gitea release body) |
|
||||
| `scripts/release.sh` | New — Developer ID export → notarized DMG |
|
||||
| `.gitignore` | `dist/` |
|
||||
| `AGENTS.md` | Stack line → macOS 27+; commands block `release.sh`; scripts index row; session-log window |
|
||||
| `docs/AGENTS.md` | `docs/releases/<version>.md` contract + index row |
|
||||
| `Museion/Resources/apex` | 1.1.58 (was 1.1.17): arm64 slice, single rpath → `libyaml.bundle`, Developer ID + hardened runtime (committed signed) |
|
||||
| `Museion/Resources/libyaml.bundle/libyaml-0.2.dylib` | New — vendored libyaml 0.2.5, install name `@rpath/libyaml-0.2.dylib`, Developer ID–signed |
|
||||
| `Museion/Resources/THIRD-PARTY-NOTICES.md` | New — apex + libyaml MIT notices (ships in the bundle) |
|
||||
| `docs/adr/0011-apex-html-reading-pipeline.md` | Bundling consequence rewritten (vendoring, signing, `.bundle` rationale, re-sign on cert rotation) |
|
||||
| `Museion/AGENTS.md` | Reading-mode line: bundled apex facts + `.bundle` rule |
|
||||
| `README.md` | License section points at the third-party notices |
|
||||
| `CHANGELOG.md` | `**reading:**` entry under 0.1.0 Fixed |
|
||||
|
||||
## Open Items & Next Steps
|
||||
|
||||
- [ ] Authorization to commit the reading-renderer fix (`fix(reading): …`), the `release.sh`
|
||||
hardening (`fix(release): …`), and this log — then move the still-local tag:
|
||||
`git tag -f v0.1.0 <release commit>` so the tagged tree is the one the DMG was built from.
|
||||
- [ ] Only on explicit go: `git push origin main v0.1.0`, then the Gitea release with
|
||||
`dist/Museion-0.1.0.dmg` attached and `docs/releases/0.1.0.md` as the body.
|
||||
- [ ] When the Developer ID certificate rotates: re-sign both bundled binaries (ADR-0011 has the
|
||||
one-liners), otherwise notarization fails on the stale team signature.
|
||||
- [ ] apex upgrades: same recipe (download the universal release tarball, verify `.sha256`, lipo,
|
||||
rpaths, sign) — ADR-0011. Ask upstream for a statically linked build so the dylib dance
|
||||
disappears.
|
||||
- [ ] Pre-existing, not touched: Release build emits `Text +` deprecation warnings in
|
||||
`TrendsPaneView.swift:389–391`.
|
||||
|
||||
---
|
||||
|
||||
*Log written by write-log skill*
|
||||
@@ -0,0 +1,96 @@
|
||||
# Image drop pastes the file path on macOS 27.2 — the editor's text views now own drops that land on them (#141 follow-up)
|
||||
|
||||
> **Date:** 2026-12-03
|
||||
> **Type:** generic
|
||||
> **Reference:** follow-up to #141 (unticketed fix; dogfood on macOS 27.2.1)
|
||||
|
||||
## Goal
|
||||
|
||||
Alexander dropped a Finder screenshot onto a saved post and got the file PATH pasted as plain text — no `assets/` copy, no `` ref. #141 shipped exactly this feature (field-verified 2026-11-02 on macOS 27.0.1). Find out why it broke and restore it with ONE path that targets the current OS (his ruling: "adjust for the latest OS. no two paths"). Closed with a finish-audit (three fresh-context reviewers; findings and dispositions below).
|
||||
|
||||
## What Was Done
|
||||
|
||||
- **Diagnosis from evidence, not theory.** The unified log of the release build showed the drag pasteboard read as `public.file-url` only; the user's post on disk held three `` refs and no `assets/` (so `ingestImage` had never run). `softwareupdate --history` dated the OS jump: 27.0.1 → 27.2.1 on 2026-11-16, two weeks after #141's verification. Then ONE instrumented Debug build (temporary `Logger(subsystem: "com.babylondreams.Museion", category: "dropprobe")` lines in the SwiftUI closure + `NSDraggingDestination`/`readSelection`/`paste` overrides on the text view, read through `log stream`/`log show --level notice`) and one human drag settled it:
|
||||
- `textview draggingEntered → copy` … `performDragOperation BEGIN` → `readSelection type=NSFilenamesPboardType → true` → `performDragOperation → true`
|
||||
- NO `swiftui destination fired`, NO `ingestDrop entry`.
|
||||
- lldb on the live app (`expr -l Swift -- let $ws = NSApp.windows …`) showed the `ProseListTextView` registered for ~19 drag types (NSFilenames, Apple URL, TIFF, PNG, RTF, RTFD, file-promise …) — NSTextView registers itself once live; a bare `NSTextView(frame:)` probe reads `[]`, even inside a window.
|
||||
- `FileDropTextView.swift` (NEW) — the editor text views' drag base: `onFileDrop: (([URL]) -> Bool)?`; `DropKind` (`urls` / `text` / `none`) classified from the pasteboard (`readObjects(forClasses: [NSURL.self])`, else the string type), memoized per `changeCount`; the `NSDraggingDestination` overrides route URL-bearing drags (never `super` — the stock path paste lives there), hand text-only drags to the stock drop, bounce the rest. `ProseListTextView` and the outliner's `RowTextView` ride it (rows mount no route → bounce).
|
||||
- `MuseionApp.swift` — `AppGateState.routeFileDrop(_:)`: the ONE file-drop router (Cold Turkey guard → pure-markdown set → `posts.openExternal` → else `proseDrop.textView?.ingestDrop`). `proseDrop` is documented as the window destination's handle.
|
||||
- `ProseListTextView.swift` — `lastIngestNotice` test seam (the refusal text the pins read); `ingestDrop`'s publishable gate requires `isFileURL` (a browser image drag refuses with the type strip instead of reaching the sink).
|
||||
- `PostStore.swift` — `IngestError.missing(_:)`: a file the disk can't stat refuses as missing ("couldn't be read"), never as a folder; the sink's guards are three flat checks (missing / link / folder).
|
||||
- `PostEditorView.swift` — `ProseTextView` gains a non-optional `routeDrop: @escaping ([URL]) -> Bool` beside `dropBridge`; `makeNSView`/`updateNSView` set `tv.onFileDrop = routeDrop`. Both `PostEditorView` call sites pass `{ gate.routeFileDrop($0) }`; `ProseRekeyTests`' direct construction passes `{ _ in false }`.
|
||||
- `WorkspaceView.swift` — the window `.dropDestination` is four lines: `let landed = gate.routeFileDrop(urls); if landed { selection = .posts }; return landed`. The hop now fires on every landed drop, not only markdown — unreachable for images today (the editor mounts only on Posts).
|
||||
- `MuseionTests/ImageIngestTests.swift` — `DragInfoStub`, the suite's `NSDraggingInfo` mock (pasteboard-only; the stock text drop inserts only into a hosted view). +9 pins: a Finder-shaped drag routes through the view and never pastes the path (and an unrouted view claims nothing); a text-only drag keeps the stock drop and never reaches the router (raw PNG data bounces); the probe follows the pasteboard contents; the outline rows bounce a file drag; a web URL refuses with the type notice; a vanished file refuses as missing; and the router's own pins (pure-markdown → guest, Cold Turkey refusal, ingest hand-off + mixed refusal).
|
||||
- DOX: `Museion/AGENTS.md` (WorkspaceView, editor-core, OutlineRowTextView + the new FileDropTextView bullet, PostStore), `MuseionTests/AGENTS.md` (suite map), root `AGENTS.md` (learning: 27.2 drag routing is an OS-version claim), `CHANGELOG.md` `[Unreleased]` Fixed entry.
|
||||
|
||||
## Decisions & Rationale
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| Target 27.2.1 only — no dual-surface compat for 27.0.1 | Alexander's ruling mid-session ("adjust for the latest OS. no two paths"); the repo already targets what the maintainer runs. The 27.0.1 "window destination starves everything" contract is deleted from the docs, not carried. |
|
||||
| The view under the pointer owns the drop; ONE router behind both surfaces | AppKit delivers a drag to exactly one destination. Over the editor that is the text view (deepest, self-registered); elsewhere it is the window SwiftUI destination. Both call `routeFileDrop`, so the md→guest / image→ingest decision exists once and can never drift between surfaces. |
|
||||
| Override the `NSDraggingDestination` methods without `super` for URL-bearing drags | The paste is the stock implementation (`performDragOperation` → `readSelection(NSFilenamesPboardType)`); accepting the drag and then refraining from pasting is not an option — the paste happens inside super. |
|
||||
| Text-only drags keep the stock drop (`case .text: super…`) | Finish-audit (security + general): a blanket `[]` for URL-less drags had killed in-editor selection moves and text drops from other apps — a regression the fix itself introduced. The path paste needs file URLs, which never reach super. |
|
||||
| One `FileDropTextView` base for the prose editor AND the outline rows | Finish-audit (general): `RowTextView` had the identical 27.2 exposure and the CHANGELOG claimed outlines refuse. One implementation, two subclasses, zero duplication; rows mount no route → bounce. |
|
||||
| Accept every URL-bearing drag in `draggingEntered` (`copy`), refuse in `performDragOperation` | `.none` at entry bounces silently; #141's contract is a LOUD refusal (the rust strip). Web URLs ride the same gate. URL-less, text-less drags (raw image data) bounce — nothing to route. |
|
||||
| Memoize the probe per `pasteboard.changeCount` | Finish-audit (security, measured): `draggingUpdated` fires per mouse-move and `readObjects` is a pasteboard round-trip — 5k URLs → 38 ms, 20k → 137 ms per move. Two lines make hover O(1). |
|
||||
| Pasteboard-shaped seams replaced by a real `NSDraggingInfo` mock | Finish-audit (general): the first pins called seams that did not exist before the fix, so no code path in them could ever have pasted the path — green with or without the fix. `DragInfoStub` drives the real overrides; the mock is ~17 lines (the one trap: `namesOfPromisedFilesDropped(atDestination:)` sits on an NSObject informal protocol and needs `override`; the class must be `@MainActor`). |
|
||||
| `lastIngestNotice` as the refusal observable | The web-URL pin was green with the `isFileURL` clause deleted (the sink refuses too; only the strip TEXT differs). One `private(set) var` set in `showIngestNotice` makes the message assertable. |
|
||||
| No explicit `registerForDraggedTypes` call | The live view is already registered by AppKit (lldb-verified) and receives the drag; registering again changes nothing on 27.2.1. |
|
||||
|
||||
## Gotchas & Fixes
|
||||
|
||||
| Problem | Root Cause | Fix |
|
||||
|---------|------------|-----|
|
||||
| Dropped image → file path pasted, no ingest | macOS 27.2 routes a drag to the deepest destination; a live NSTextView self-registers for drag types and matches Finder via `NSFilenamesPboardType`; the window-level SwiftUI `.dropDestination` never fired — the inverse of the 27.0.1 ruling #141 was built on | Text views own the drop (overrides, no super for URLs) → one router |
|
||||
| A bare `NSTextView(frame:)` probe reported `registeredDraggedTypes == []` and suggested NSTextView could never receive the drag | Registration happens lazily once the view is live in a real window/hosting; the standalone probe is the wrong instrument | Read the LIVE view over lldb (`$`-prefixed bindings persist across `-o` commands) |
|
||||
| `log stream` caught nothing while `log show --last 5m` did | The stream attaches asynchronously; the app launched into the gap | Use `log show` for anything within the last minutes; keep the stream for live watching |
|
||||
| Interpolated values read back as `<private>` | os_log redacts non-public interpolations by default | `privacy: .public` on every value you need to read |
|
||||
| First fixed build failed: `Consecutive statements on a line must be separated by ';'` | `a != nil, b != nil ? x : y` — a condition list inside a ternary does not parse | `guard … else { return [] }; return .copy` (swiftformat later folded the switches into expressions) |
|
||||
| `xcodebuild test` failed to compile `ProseRekeyTests.swift:325` | A third `ProseTextView(…)` call site in the tests dir (my grep covered `Museion/` only) | Pass `routeDrop:` there; grep `dropBridge:` repo-wide next time |
|
||||
| swiftformat turned `ingestDrop`'s `///` block into `//` | A blank line had slipped between the doc block and the function (docComments rule) | Re-attach the `///` block directly above the function |
|
||||
| `open -n` launched the instrumented build once more after a failed compile | The launch command ran unconditionally after `build exit=65` | Gate every launch on the build exit code |
|
||||
| Audit flip: the Cold Turkey pin stayed green with its guard flipped | I batched two guards on ONE path — the md-branch flip (`if false`) sent the lock pin's markdown input down the ingest branch before the missing lock guard mattered | Flip same-path guards one at a time: restored, flipped the lock guard alone → the pin reddened by name (1 failed / 19 passed) |
|
||||
| Audit pin failed on the apostrophe | The message landed as `couldn't` (straight) while the test asserted `couldn’t` — the house voice is the curly one | Fix the message, not the pin |
|
||||
| swiftlint `line_length` (180) on the mock's `enumerateDraggingItems` signature | swiftformat does not wrap that parameter list | Wrap the signature by hand |
|
||||
|
||||
## Finish audit (three reviewers, one fanout)
|
||||
|
||||
Accepted and fixed: the text-drag regression (security S6 + general G4/G5 converged); the web-URL pin's non-discrimination + the vanished-file "is a folder" message (S2 + G6); zero router pins (G3 + S4); the outline rows' identical exposure (G9); the per-mouse-move pasteboard read (S1, measured); stale `ProseDropBridge` doc and a test comment (G1, G2); the retold 27.2 story trimmed to pointers (ponytail P1); devlog/INDEX suite count (G10); "27.2" vs "27.2.1" precision (G11); the widened `selection = .posts` hop documented (G7 — unreachable for images today).
|
||||
Deferred (visible, not dropped): magic-byte sniffing and a size cap in `ingestImage` (S3 — the pre-existing #34 extension-only posture; the drop is an explicit user action on a file the user chose; add if the posture is ever tightened); the non-atomic multi-image loop (pre-existing #141 `ponytail:` ceiling — a `[good, symlink]` drop orphans the good copy).
|
||||
Recorded as checked, no change: lock gate order (S4), pasteboard spoofing — `..` segments never reach `assets/` through the slug (S5), `draggingExited` left to stock (G8).
|
||||
Coherence: the general reviewer verified zero old-contract phrases outside the retained #141 history devlog, all three `ProseTextView(` call sites, the 723→729 count, `readObjects(forClasses: [NSURL.self])` behavior on Finder/browser/text pasteboards (empirical probe), override signatures against the SDK, and no retain cycle (`proseDrop.textView` weak; `onFileDrop` captures the app-lifetime gate). No overlap between the two surfaces was flagged as duplication after the base-class hoist — each drag still reaches exactly one.
|
||||
|
||||
## Files Changed
|
||||
|
||||
| File | Change Summary |
|
||||
|------|---------------|
|
||||
| `Museion/FileDropTextView.swift` | NEW — the drag base: `onFileDrop`, `DropKind`, `droppedURLs(from:)`, `classify`, per-`changeCount` memo, the four overrides |
|
||||
| `Museion/MuseionApp.swift` | `AppGateState.routeFileDrop` (the one router); `proseDrop` doc rewritten |
|
||||
| `Museion/ProseListTextView.swift` | rides `FileDropTextView`; `lastIngestNotice` seam; `isFileURL` in the ingest gate |
|
||||
| `Museion/OutlineRowTextView.swift` | `RowTextView` rides `FileDropTextView` (no route → bounce) |
|
||||
| `Museion/PostStore.swift` | `IngestError.missing`; flat sink guards |
|
||||
| `Museion/PostEditorView.swift` | `ProseTextView.routeDrop` param + `tv.onFileDrop` wiring in make/update; both call sites; bridge doc |
|
||||
| `Museion/WorkspaceView.swift` | Window destination reduced to the router + `selection = .posts` |
|
||||
| `MuseionTests/ImageIngestTests.swift` | `DragInfoStub` + 9 pins (drag overrides, probe, rows, refusals, router) |
|
||||
| `MuseionTests/ProseRekeyTests.swift` | `routeDrop:` at the direct `ProseTextView` construction |
|
||||
| `Museion/AGENTS.md`, `MuseionTests/AGENTS.md`, `AGENTS.md`, `CHANGELOG.md`, `docs/devlog/INDEX.md` | DOX pass + learning + `[Unreleased]` Fixed entry |
|
||||
|
||||
## Verification
|
||||
|
||||
- Full rail **729/729** (720 + 9 pins), xcresult-authoritative counts; swiftformat 0/153; swiftlint 0 violations. Re-run at finish-up on the exact committed bytes (run `20261203T153446Z`, pid 5687): 729/729 again.
|
||||
- Flip cycle: 8 guards flipped in one batched edit (all independent paths) → exactly those 8 pins failed by name, 13 pre-existing green; the Cold Turkey pin flipped alone → 1 failed / 19 green. Restores byte-compared against `cp` backups (the tree is uncommitted — `git checkout` would have eaten the session).
|
||||
- One real Finder drag on 27.2.1 (Debug build): `assets/…png` landed, `` at the drop point.
|
||||
|
||||
## Open Items & Next Steps
|
||||
|
||||
- [ ] Ticket + commit left to Alexander (forge writes are his call); the CHANGELOG entry is marked "unticketed fix" until then.
|
||||
- [ ] The three pasted-path lines from the probe drag (15:49) may still sit in `ep-1-why-i-built…`/post.md — the real drag on the fixed build landed cleanly at line 43; the earlier paste is the author's to delete.
|
||||
- [ ] Deferred audit items: magic-byte sniff + size cap in `ingestImage` (pre-existing #34 posture); pre-flight all sources before the first copy (non-atomic multi-drop, pre-existing #141 ceiling).
|
||||
- [ ] Browser image drags (https URL) refuse loudly but don't ingest — downloading into assets/ would be new scope.
|
||||
- [ ] Raw image-data drags (Photos/Preview) bounce silently — nothing to route.
|
||||
- [ ] Re-dogfood the drop after the next macOS point release: drag routing is an OS-version claim.
|
||||
|
||||
---
|
||||
|
||||
*Log written by write-log skill*
|
||||
@@ -0,0 +1,76 @@
|
||||
# Release 0.1.1 — the apex refresh becomes step one
|
||||
|
||||
> **Date:** 2026-12-03
|
||||
> **Type:** milestone
|
||||
> **Reference:** tag `v0.1.1` → `4a056f9`; [docs/releases/0.1.1.md](../releases/0.1.1.md)
|
||||
|
||||
## Goal
|
||||
|
||||
Cut 0.1.1, a bug-fix release carrying the one fix that sat under `[Unreleased]` since 0.1.0 (the external-watch normalizer, PR #203), and land the release skill that ran it.
|
||||
|
||||
## What Was Done
|
||||
|
||||
- **Pre-flight.** Local `main` == forge at `2d5073e` (the #203 merge; Alexander pulled it mid-session). Developer ID identity present, `tea` default login present. `[Unreleased]` held exactly one entry — the fix that defines this release.
|
||||
- **apex 1.1.58 → 1.1.59 (step 1).** GitHub `releases/latest` = v1.1.59 (published 2026-12-01, the day after the 0.1.0 cut). Universal tarball `.sha256` verified (`e75cd828…`), `lipo -thin arm64`, the three CI/Homebrew rpaths deleted, `@executable_path/../Resources/libyaml.bundle` added, Developer ID–signed `--options runtime --timestamp`. Proven in a scratch `Resources/libyaml.bundle/` layout before the copy: `--version` = 1.1.59, `--no-mixed-lists` renders `- a` + `1. one` as `<ul>` then `<ol>`. 1.1.59 still links libyaml dynamically — the vendored dylib and the ADR-0011 recipe stay as they were. `THIRD-PARTY-NOTICES.md` bumped.
|
||||
- **Bump.** `MARKETING_VERSION` 0.1.0 → 0.1.1 on all six target×configuration pairs; `CURRENT_PROJECT_VERSION` stays 1. Read back from `-showBuildSettings`: one unique value, `0.1.1`.
|
||||
- **Changelog.** `## [0.1.1] - 2026-12-03` over the external-watch entry, fresh empty `[Unreleased]` above, pointer to the notes, a `### Changed` → `- **reading:**` line for the apex refresh.
|
||||
- **Release notes.** `docs/releases/0.1.1.md` — bug-fix-sized: the false #67 conflict in plain language, the apex refresh, known limits pointing at 0.1.0's, install (replaces 0.1.1 in place), numbers (720 at the tag).
|
||||
- **README.** Unchanged — `<version>` placeholder, "macOS 27 or later" matches the 6× `MACOSX_DEPLOYMENT_TARGET = 27.0`, license pointer already covers apex + libyaml.
|
||||
- **Rail.** 720 executed / 720 passed / 0 failed. Freshness proven, not assumed: run dir `_build/full-test/20261203T064608Z-Museion/` at 07:46:32 > last tree edit 07:45:51; `CpResource …/Resources/apex` at 07:46:10; the built test host's apex reports 1.1.59; 59 `SwiftCompile` lines. `swiftformat` 0/152, `swiftlint` 0/0/141, `shellcheck scripts/release.sh` clean.
|
||||
- **Slices + tag.** `bba4688 build(release)` (skill + its DOX row + notes) · `570abb3 fix(reading)` (apex binary + notices) · `4a056f9 chore(release)` (bump + changelog heading). Working tree byte-identical to HEAD's tree at tag time (`git diff HEAD` empty). `git tag -a v0.1.1` on `4a056f9`.
|
||||
- **DMG.** `release.sh`: archive → Developer ID export → UDZO DMG → signed → notarized → stapled. Four proofs: from the mounted image `Contents/Resources/apex --version` = 1.1.59 and `CFBundleShortVersionString` = 0.1.1, shipped apex carries exactly the one rpath, the app does not link libyaml, `stapler validate` OK, `spctl` → `accepted, source=Notarized Developer ID`. **sha256 `e7add45a9a577b36fa39864f1acfdfa9db72448311ffa459031a33344dd9d76b`**, 3,164,194 bytes.
|
||||
- **Skill updated (mid-session, on Alexander's steer).** Step 1 went from "compare `--version`, upgrade if stale" to an **unconditional refresh with the full recipe inline** — the exact commands that until now lived only in the 0.1.0 devlog. Homebrew is a labeled fallback. Quick Reference line and three Pitfalls added; skill `version: 0.1.1`.
|
||||
|
||||
## Decisions & Rationale
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| GitHub `releases/latest` is the apex source of record; Homebrew is fallback only | Live-checked during the cut: the Homebrew formula and the installed binary were both **1.1.58** while GitHub had 1.1.59. A `brew upgrade apex` printing "already up-to-date" would have shipped the stale renderer with a clean conscience |
|
||||
| Step 1 is unconditional, not a comparison | The old wording read as optional and was skipped by habit — Alexander's steer. A bundled binary is stale by definition between releases |
|
||||
| Scratch-layout proof BEFORE the copy into `Resources/` | A binary that fails `--no-mixed-lists` in `$TMPDIR` has touched nothing; the same failure in-tree costs a rail run |
|
||||
| The apex bump is its own `fix(reading)` slice | Same shape as 0.1.0's `fd806e9`; the binary and its notices travel together, separate from the version bump |
|
||||
| CHANGELOG `### Changed` entry for apex even though it's a patch bump | Common Changelog: anything a user can observe (renderer version) is recorded. 0.1.0 did the same for 1.1.17→1.1.58 |
|
||||
| Homebrew variant's rpath loop tolerates absent paths (`2>/dev/null \|\| true`) | The Homebrew build carries `$(brew --prefix)/lib` instead of the CI paths; `install_name_tool -delete_rpath` fails on a path the binary lacks. The Done-check (exactly ONE rpath left) is the real gate |
|
||||
|
||||
## Gotchas & Fixes
|
||||
|
||||
| Problem | Root Cause | Fix |
|
||||
|---------|------------|-----|
|
||||
| `git log --oneline` showed `3197b92` as tip while `rev-parse HEAD` said `2d5073e` — looked like a corrupted state | `rtk` (terminal-output wrapper on PATH) mangles `git log` porcelain output; it dropped the merge commit and flattened the first-parent line | Trusted plumbing (`cat-file -p`, `rev-parse`, `describe`) and the forge (`ls-remote`), all of which agreed: `2d5073e` is a real merge, parents `3197b92` + `07da076`, tree `93dcb24`. Prefer plumbing when a wrapper is in the path |
|
||||
| My first `origin/main` check printed `3197b92`, then minutes later everything said `2d5073e` | Alexander pulled the PR mid-session (reflog: `pull: Fast-forward`); my earlier read was correct at the time | Confirmed via `git ls-remote origin refs/heads/main` = forge truth before any write |
|
||||
| The release skill itself was uncommitted (untracked `SKILL.md` + unstaged `AGENTS.md` row) at the start of a release that requires a clean tree | The skill was authored in the 0.1.0 session but never committed | Folded into `build(release)` — it is release tooling; Alexander approved |
|
||||
| `find -newer rel.json` missed the extracted tarball files | Both were written in the same second | `tar tzf` for the layout, `find -name apex` for the binary |
|
||||
| `full-test.sh status` prints no run directory | The script keeps it in `${FT_BASE_DIR:-$ROOT/_build/full-test}/<utc-id>-<scheme>/` | Read `BASE` from the script; the run dir's mtime + the log's `CpResource` line are the freshness proof |
|
||||
| `tea releases create` printed nothing on success | Normal — silent exit 0 | The `tea api` read-back is the proof; it showed release id 28, `draft: false`, one asset at the local byte size |
|
||||
| First read-back script died on `KeyError: 'tag'` | Gitea's release JSON spells it `tag_name` (GitHub-shaped assumptions) | Read `tag_name`; recorded in the skill's Quick Reference |
|
||||
| `python3 -c 'import yaml'` → `ModuleNotFoundError` reading the tea token | PyYAML isn't on the system python | `grep -E '^\s*token:'` + `sed` — no new dependency for a one-line read |
|
||||
| `security add-generic-password … -w <value>` → "passwords don't match", nothing stored (read-back 0 chars) | Without a tty, `security` prompts for a retype | `</dev/null` on the add; always read the length back before relying on it |
|
||||
| Micro.blog `q=config` shows three microblogs, none `microblog-default` | A post without `mp-destination` would be ambiguous | Sent `mp-destination: https://AlexKucera.micro.blog/` explicitly; `Location` host confirms it took |
|
||||
|
||||
## Files Changed
|
||||
|
||||
| File | Change Summary |
|
||||
|------|---------------|
|
||||
| `.agents/skills/release/SKILL.md` | New (committed this release): step 1 = unconditional apex refresh with the full recipe inline (GitHub canonical, Homebrew fallback); step 11 = Micro.blog announcement as a draft (Keychain token service, `mp-destination` mandatory, read-back); Quick Reference lines; eight Pitfalls; `version: 0.2.0` |
|
||||
| `AGENTS.md` | `.agents/skills/` Child DOX Index row (now mentions the Micro.blog draft); session-log window refreshed to the 10 newest INDEX rows (picks up the 11-30 log the #203 merge indexed but didn't window) |
|
||||
| `docs/releases/0.1.1.md` | New — human-readable notes, the Gitea release body |
|
||||
| `CHANGELOG.md` | `[0.1.1] - 2026-12-03` heading, fresh `[Unreleased]`, notes pointer, `### Changed` apex entry |
|
||||
| `Museion.xcodeproj/project.pbxproj` | `MARKETING_VERSION = 0.1.1` ×6 |
|
||||
| `Museion/Resources/apex` | 1.1.58 → 1.1.59, arm64 slice, one rpath, Developer ID + hardened runtime (1,019,232 → 1,019,312 bytes) |
|
||||
| `Museion/Resources/THIRD-PARTY-NOTICES.md` | `## apex 1.1.59`, `v1.1.59` prose |
|
||||
| `docs/devlog/20261203-release-011-apex-refresh-is-step-one_log.md` | This log |
|
||||
| `docs/devlog/INDEX.md` | Row inserted at top |
|
||||
|
||||
## Open Items & Next Steps
|
||||
|
||||
- [x] Go given 2026-12-03. `git push origin main v0.1.1` → forge `main` = `4a056f9`, annotated tag derefs to it.
|
||||
- [x] Gitea release id 28 created (`draft: false`, one asset 3,164,194 bytes, body ends `[Generated by AI]`). Token-authenticated download hashes to `e7add45a…` — byte-identical to local — and `stapler validate` passes on the downloaded file.
|
||||
- [x] Micro.blog announcement posted as a **draft** (on Alexander's request, mid-run): `POST /micropub` → `202`, `Location` `https://alexanderkucera.com/2026/12/03/museion.html`, preview `https://micro.blog/account/posts/239/preview/6088556`. Read back `q=source` → `post-status: draft`, 1118 chars, both links present. Awaiting Alexander's publish.
|
||||
- [ ] Alexander: review + publish the Micro.blog draft from the preview link.
|
||||
- [ ] **Rotate the Micro.blog App Token** — it was pasted into chat, so it lives in this transcript. After rotating, re-store: `security add-generic-password -U -a micro.blog -s com.babylondreams.Museion.release-announce -w '<new>' </dev/null`.
|
||||
- [ ] Ask upstream (ApexMarkdown/apex) for a statically linked macOS build — would retire the rpath/codesign dylib dance and the `.bundle`; carried from the 0.1.0 log, still open
|
||||
- [ ] `rtk` mangling `git log` is a recurring hazard on this machine — already has a skill (`rtk-terminal-output`); consider making the release skill's step 7 use `git log --format` via plumbing or `--no-color` if it bites again
|
||||
|
||||
---
|
||||
|
||||
*Log written by write-log skill*
|
||||
@@ -5,6 +5,9 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
<!-- write-log: full-index -->
|
||||
| Date | Type | File | Summary |
|
||||
|------|------|------|---------|
|
||||
| 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 |
|
||||
| 2026-12-01 | milestone | [20261201-release-010-readme-notes-packaging_log.md](20261201-release-010-readme-notes-packaging_log.md) | Release 0.1.0: version bump + tag, README feature/usage rewrite, distilled release notes, release.sh (Developer ID DMG, notarize); rail 717/717; Developer ID cert pending |
|
||||
| 2026-11-30 | fix | [20261130-external-watch-compares-unnormalized-text_log.md](20261130-external-watch-compares-unnormalized-text_log.md) | Unticketed fix (brief-32, argus cycle-6): the external guest's watch reads through the ONE shared external normalizer — the false #67 conflict on unchanged BOM/CRLF files (re-arming after sibling events and alert answers, blocking departures/quit) is gone; real foreign writes still raise; RED-first 3 pins over the real watch closure; rail 720/720 |
|
||||
| 2026-11-23 | fix | [20261123-home-repoint-retains-old-editor-target_log.md](20261123-home-repoint-retains-old-editor-target_log.md) | Unticketed fix (brief-28, argus cycle-5): a Home repoint is a guarded document departure — the gate runs before the preference/binding commit, the refusal keeps Home A and the buffers; document identity is (Home, ID) across the model and re-checked at async completion (card scan, rescan — both mutation-checked); RED-first 6/6 at ca265d3b, review r1 +2 pins (rescan hoist, draft survives); rail 717/717 |
|
||||
| 2026-11-19 | fix | [20261119-issue200-gate-quit-time-flushes-through-departure-gate_log.md](20261119-issue200-gate-quit-time-flushes-through-departure-gate_log.md) | Quit routes through the departure gate (#200): conflict-held shutdown, BLOCK-QUIT at applicationShouldTerminate, never-loaded-retype guard; finish-audit fixes; rail 708/708 |
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# Museion 0.1.0
|
||||
|
||||
*Released 2026-12-01 · the first release. Entry-by-entry detail with issue numbers: [CHANGELOG.md](../../CHANGELOG.md).*
|
||||
|
||||
Museion is the Agentic Writing Environment: a native macOS app where your text, your library, and a resident AI mentor work under one roof. It is built for long-form writers who want to get better, not ghostwritten — the mentor critiques, demonstrates, and remembers your recurring weaknesses, and nothing ships without your hand on it.
|
||||
|
||||
0.1.0 is the complete v1 loop, three months in the making and dogfooded along the way: write, get critiqued, remember what keeps going wrong, measure whether it stops, publish.
|
||||
|
||||
## What is in it
|
||||
|
||||
**The Mentor Loop.** A user-installed [Hermes](https://hermes-agent.nousresearch.com/docs) engine runs as a child process under three isolated profiles. **Pass 1** critiques structure, argument, and flow; **Pass 2** works at sentence level. Each pass ends in a verdict and a set of **Fix Cards** — mechanical ones apply behind a sheet that shows the exact edit, one card at a time, never all at once; demonstration ones show a single annotated example on your own text. A native deslop lint lands its findings as cards before the engine even sees the piece. Promote a card into **Learnings** and every later pass consults it; dismiss one and it fades, resurfacing on an output clock. **Sessions** are freeform conversations with resume, fork, and compact; a reply can become a new post. **Blind Read** judges the current text against the pass-start snapshot without knowing which is which.
|
||||
|
||||
**A real editor.** A TextKit 2 prose surface with styled markdown source, sub-second autosave, an honest save-state dot, cursor and scroll restored across restarts, and an explicit *Reload / Keep Local* alert when the file changes underneath you — never a silent overwrite. Reading mode, focus mode, image drops that copy into the piece and reference in place, list indentation and folding, and spellcheck on request.
|
||||
|
||||
**Cold Turkey.** A writing lock nested inside focus mode: pick net words or minutes, and Museion holds a fullscreen kiosk until you meet the goal. Quitting asks once. Nothing persists.
|
||||
|
||||
**Outlines.** Nested-bullet outline pieces with LogSeq-style keys, drag-to-reorder and nest, zoom into a branch, and a one-way Convert to Post.
|
||||
|
||||
**A library that is a folder.** Pieces live under projects and fold into an archive, all plain markdown under your **Museion Home** (iCloud Drive by default on fresh installs, `~/Documents/Museion` otherwise; repoint-only, never moved). Grouping by project and Pass State, search across titles and bodies, rename/move/archive/trash from the row menu, and a live file watcher so Finder edits show up without a refresh. Open any `.md` in place as a guest; import `.md` files as posts.
|
||||
|
||||
**Measurable improvement.** Running a pass on an unaided first draft captures four style metrics before the mentor sees anything. The Trends pane charts them across captures with an honest *improving / steady / slipping* verdict per metric.
|
||||
|
||||
**Publishing.** Micro.blog via Micropub: Send as Draft, review, Publish. Illustrations upload and ride inline; a picture without alt text never ships.
|
||||
|
||||
## Milestones
|
||||
|
||||
- **M0 — ACP bridge.** The app spawns Hermes, opens a session, streams replies, cancels, and tears down cleanly on quit.
|
||||
- **M1 — Editor surface.** Posts list over the Home folder, post lifecycle (new, save, rename, trash), the TextKit 2 prose editor with autosave and external-change guard.
|
||||
- **M2 — Passes and Fix Cards.** Pass 1 / Pass 2, the in-app MCP server that receives cards, the Fix Cards palette with ask-before Apply, the native deslop lint.
|
||||
- **M3 — Critique memory.** Learnings: promote with one confirm, consult on every pass, dismiss with decay.
|
||||
- **M4 — Measurable improvement.** First-draft stats capture and the Trends pane.
|
||||
- **M5 — Research and library-light.** Mid-pass research notes kept into the piece with provenance; drill offers; the bundled skill set (Serif stack, deslop, craft canon, VOICE).
|
||||
- **M6 — Micropub publish.** Draft → publish to Micro.blog, illustrations included.
|
||||
- **After v1 scope.** Projects and archive, the outliner, library search, image drops, Cold Turkey, per-surface engines with in-app model settings and Test Connection, Nous Portal, gateless launch, iCloud-default Home, the editorial two-color chrome.
|
||||
|
||||
## Install
|
||||
|
||||
Download `Museion-0.1.0.dmg` below, open it, drag Museion to Applications.
|
||||
|
||||
- **macOS 27 or later**, Apple Silicon.
|
||||
- **Hermes** is needed for Passes and Sessions — `curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash`. Museion provisions the profiles and seeds its skills on the next launch. The editor, library, outlines, and publishing work without it.
|
||||
- A provider API key (z.ai, Anthropic, OpenAI, or Nous Portal) under Settings ▸ Provider Keys.
|
||||
|
||||
The app is Developer ID-signed and notarized.
|
||||
|
||||
## Known limits
|
||||
|
||||
- Long-form structure tools (binder, compile), backlinks and graph views, multi-mind setups, and publish targets beyond Micro.blog are out of v1 scope — see `PRODUCT.md` for the full non-goal list.
|
||||
- Convert to Post is one-way. Opening a mixed-content outline asks how to proceed; opening as an outline normalizes on save.
|
||||
- The Mentor methodology is a bundled skill set, not a trained model — fierce or gentle is a persona blend, not a setting.
|
||||
- One user so far. No testimonials, customers, or benchmarks exist yet, and none are claimed.
|
||||
|
||||
## Numbers
|
||||
|
||||
74 Swift files, about 23,000 lines in the app target; a unit suite of over 700 tests, run through `scripts/full-test.sh`; SwiftFormat and SwiftLint clean repo-wide.
|
||||
@@ -0,0 +1,28 @@
|
||||
# Museion 0.1.1
|
||||
|
||||
*Released 2026-12-03 · a bug-fix release. Entry-by-entry detail: [CHANGELOG.md](../../CHANGELOG.md).*
|
||||
|
||||
0.1.1 fixes one bug that shipped in [0.1.0](0.1.0.md) and refreshes the reading-mode renderer.
|
||||
|
||||
## What is in it
|
||||
|
||||
**No more false "file changed on disk" alerts on guest files.** Opening a `.md` file from outside your library as a guest (⌘O, or a drop) worked — until the file carried a byte-order mark or Windows line endings. Then Museion raised the *Reload / Keep Local* conflict alert on every sibling file event in that folder, even though nothing had changed, and kept re-raising it after either answer. Worse, the false alert blocked every departure: selecting another piece, New Post, quitting. The file watch now reads the disk through the same normalizer the editor uses on open (BOM strip + CRLF→LF), so the compare is like-for-like. A real external write still raises the alert — the guard is not blinded.
|
||||
|
||||
**apex 1.1.59.** The bundled reading-mode renderer moves from 1.1.58 to the current upstream release, packaged exactly as in 0.1.0: arm64 slice of the official universal tarball, checksum verified, Developer ID–signed with the hardened runtime, libyaml vendored beside it. No behavior change in reading mode.
|
||||
|
||||
## Known limits
|
||||
|
||||
- Unchanged from 0.1.0 — see [0.1.0's known limits](0.1.0.md#known-limits).
|
||||
|
||||
## Install
|
||||
|
||||
Download `Museion-0.1.1.dmg` below, open it, drag Museion to Applications (replaces 0.1.0 in place).
|
||||
|
||||
- **macOS 27 or later**, Apple Silicon.
|
||||
- Hermes and a provider key are needed only for Passes and Sessions; the editor, library, outlines, and publishing work without them — same as 0.1.0.
|
||||
|
||||
The app is Developer ID-signed and notarized.
|
||||
|
||||
## Numbers
|
||||
|
||||
Suite 720 at the tag, run through `scripts/full-test.sh`; SwiftFormat and SwiftLint clean repo-wide.
|
||||
@@ -0,0 +1,31 @@
|
||||
# Museion 0.1.2
|
||||
|
||||
*Released 2026-12-03 · a bug-fix release. Entry-by-entry detail: [CHANGELOG.md](../../CHANGELOG.md).*
|
||||
|
||||
0.1.2 fixes one bug that has been in every build so far and only showed up on macOS 27.2: dropping an image onto a post.
|
||||
|
||||
## What is in it
|
||||
|
||||
**Drop an image onto a post, and it lands in the piece again.** Since macOS 27.2, dragging an image file from Finder onto the prose editor pasted the file's *path* as plain text instead of copying the image into the piece and inserting its reference. The cause was a change in the operating system, not in Museion's code: 27.2 delivers a drag to whichever view sits directly under the pointer, so the editor's text view received the drop and ran its stock behavior — insert the path — while the app's own drop handling never saw it. A markdown file dropped onto the editor had the same symptom.
|
||||
|
||||
Now the editor owns the drops that land on it. An image is copied into the piece's `assets/` folder and `` appears at the drop point with the alt text selected, ready to type over. A markdown file dropped on the editor opens as a guest again. In an outline, a dropped file bounces instead of pasting a path. Dropping *text* — a selection from the editor, text from another app — still inserts text, as it always did.
|
||||
|
||||
Two refusals are deliberate: an image dragged from a web browser gets a notice (there is no file on disk to copy), and so does a file that went missing between the drag and the drop.
|
||||
|
||||
## Known limits
|
||||
|
||||
- Unchanged from 0.1.0 — see [0.1.0's known limits](0.1.0.md#known-limits).
|
||||
- An image dragged straight from a browser is not downloaded into the piece; save it to disk first, then drop it.
|
||||
|
||||
## Install
|
||||
|
||||
Download `Museion-0.1.2.dmg` below, open it, drag Museion to Applications (replaces 0.1.1 in place).
|
||||
|
||||
- **macOS 27 or later**, Apple Silicon.
|
||||
- Hermes and a provider key are needed only for Passes and Sessions; the editor, library, outlines, and publishing work without them — same as 0.1.0.
|
||||
|
||||
The app is Developer ID-signed and notarized.
|
||||
|
||||
## Numbers
|
||||
|
||||
Suite 729 at the tag, run through `scripts/full-test.sh`; SwiftFormat and SwiftLint clean repo-wide.
|
||||
Executable
+135
@@ -0,0 +1,135 @@
|
||||
#!/usr/bin/env bash
|
||||
# Release packaging: archive → Developer ID export → DMG → notarize → staple.
|
||||
#
|
||||
# Contract:
|
||||
# - Bumps nothing and tags nothing. Run from the commit that already carries
|
||||
# the version in MARKETING_VERSION; the git tag is the caller's job.
|
||||
# - Refuses BEFORE building when no valid "Developer ID Application" identity
|
||||
# is in the keychain. Create it at developer.apple.com ▸ Certificates ▸ + ▸
|
||||
# Developer ID Application from a Keychain Access ▸ Certificate Assistant CSR —
|
||||
# Xcode's Manage Certificates refuses this even for the Account Holder (stale
|
||||
# role cache). The private key lives only on the Mac that made the CSR — a
|
||||
# portal-side certificate without it is not an identity.
|
||||
# - Notarizes through the `museion-notary` notarytool keychain profile, created
|
||||
# once by the Account Holder:
|
||||
# xcrun notarytool store-credentials museion-notary \
|
||||
# --apple-id <apple-id> --team-id <team-id> --password <app-specific-password>
|
||||
# NOTARIZE=0 skips notarize+staple (a Developer-ID-signed DMG Gatekeeper still warns on).
|
||||
# - Output: dist/Museion-<MARKETING_VERSION>.dmg (gitignored). The version is
|
||||
# read from build settings, never from the pbxproj text. Apple Silicon only —
|
||||
# the deployment target is macOS 27, which does not run on Intel.
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT="Museion.xcodeproj"
|
||||
SCHEME="Museion"
|
||||
APP_NAME="Museion.app"
|
||||
CONFIGURATION="Release"
|
||||
IDENTITY="Developer ID Application"
|
||||
NOTARY_PROFILE="museion-notary"
|
||||
DIST="dist"
|
||||
DESTINATION='platform=macOS,arch=arm64'
|
||||
|
||||
cd "$(dirname "$0")/.." # repo root — PROJECT is relative (same guard as deploy.sh)
|
||||
|
||||
if ! security find-identity -v -p codesigning | grep -q "\"$IDENTITY:"; then
|
||||
echo "No valid \"$IDENTITY\" identity in the keychain." >&2
|
||||
echo "Create it once: developer.apple.com ▸ Certificates ▸ + ▸ $IDENTITY (CSR from Keychain Access ▸ Certificate Assistant)" >&2
|
||||
exit 1
|
||||
fi
|
||||
SIGNER=$(security find-identity -v -p codesigning | sed -n 's/.*"\('"$IDENTITY"':[^"]*\)".*/\1/p' | head -1)
|
||||
|
||||
VERSION=$(xcodebuild -project "$PROJECT" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
|
||||
-destination "$DESTINATION" -showBuildSettings 2>/dev/null \
|
||||
| awk -F'= ' '/MARKETING_VERSION = / {print $2; exit}')
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
echo "MARKETING_VERSION not found in build settings" >&2
|
||||
exit 1
|
||||
fi
|
||||
TEAM=$(xcodebuild -project "$PROJECT" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
|
||||
-destination "$DESTINATION" -showBuildSettings 2>/dev/null \
|
||||
| awk -F'= ' '/DEVELOPMENT_TEAM = / {print $2; exit}')
|
||||
DMG="$DIST/Museion-$VERSION.dmg"
|
||||
echo "Packaging $SCHEME $VERSION"
|
||||
|
||||
# xcodebuild -quiet prints nothing on success; keep the log to show on failure.
|
||||
log=$(mktemp -t museion-release)
|
||||
trap 'rm -f "$log"' EXIT
|
||||
run() { echo "→ $*"; if ! "$@" >"$log" 2>&1; then echo "Failed: $*" >&2; cat "$log" >&2; exit 1; fi; }
|
||||
|
||||
rm -rf "$DIST"
|
||||
mkdir -p "$DIST"
|
||||
|
||||
run xcodebuild -project "$PROJECT" -scheme "$SCHEME" -configuration "$CONFIGURATION" \
|
||||
-destination "$DESTINATION" -archivePath "$DIST/Museion.xcarchive" -quiet archive
|
||||
|
||||
cat >"$DIST/export-options.plist" <<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0"><dict>
|
||||
<key>method</key><string>developer-id</string>
|
||||
<key>signingStyle</key><string>automatic</string>
|
||||
<key>teamID</key><string>$TEAM</string>
|
||||
<key>destination</key><string>export</string>
|
||||
</dict></plist>
|
||||
EOF
|
||||
|
||||
run xcodebuild -exportArchive -archivePath "$DIST/Museion.xcarchive" \
|
||||
-exportOptionsPlist "$DIST/export-options.plist" -exportPath "$DIST/export" \
|
||||
-allowProvisioningUpdates -quiet
|
||||
|
||||
APP="$DIST/export/$APP_NAME"
|
||||
if [[ ! -d "$APP" ]]; then
|
||||
echo "Export did not produce $APP" >&2
|
||||
exit 1
|
||||
fi
|
||||
run codesign --verify --deep --strict "$APP"
|
||||
# Capture first: `codesign -dvv | grep -q` SIGPIPEs codesign under pipefail (grep
|
||||
# quits at the first Authority line while codesign still writes its Info.plist dump).
|
||||
SIGNATURE=$(codesign -dvv "$APP" 2>&1)
|
||||
grep -q '^Authority=Developer ID Application' <<<"$SIGNATURE" \
|
||||
|| { echo "Export is not Developer ID signed:" >&2; grep '^Authority=' <<<"$SIGNATURE" >&2; exit 1; }
|
||||
# The bundled renderer must run from the SHIPPED layout (rpath → Resources/libyaml.bundle), and
|
||||
# the app must not link libyaml — a bare dylib in the synced Resources folder becomes a link target
|
||||
# silently (Xcode sniffs Mach-O content), which is why the vendored copy sits in a .bundle.
|
||||
if otool -L "$APP/Contents/MacOS/$SCHEME" | grep -q libyaml; then
|
||||
echo "The app links libyaml — it must only be apex's dependency, never the app's" >&2; exit 1
|
||||
fi
|
||||
run "$APP/Contents/Resources/apex" --version
|
||||
|
||||
# A mounted leftover from an earlier run makes the create fail with a busy volume.
|
||||
hdiutil detach "/Volumes/$SCHEME $VERSION" -quiet 2>/dev/null || true
|
||||
STAGE="$DIST/stage"
|
||||
mkdir -p "$STAGE"
|
||||
ditto "$APP" "$STAGE/$APP_NAME" # ditto preserves the bundle's signature and xattrs
|
||||
ln -s /Applications "$STAGE/Applications"
|
||||
# diskutil image create replaces the deprecated `hdiutil create` (macOS 27).
|
||||
run diskutil image create from --format UDZO --volumeName "$SCHEME $VERSION" "$STAGE" "$DMG"
|
||||
rm -rf "$STAGE" "$DIST/export"
|
||||
# Gatekeeper's open-assessment needs the IMAGE signed too; the notary ticket is stapled onto this signature.
|
||||
run codesign --timestamp --sign "$SIGNER" "$DMG"
|
||||
|
||||
if [[ "${NOTARIZE:-1}" == "1" ]]; then
|
||||
# `--wait` exits 0 on Invalid too — the status FIELD is the verdict. (JSON goes to
|
||||
# stdout only; notarytool has no output-path option.)
|
||||
echo "→ xcrun notarytool submit $DMG --keychain-profile $NOTARY_PROFILE --wait"
|
||||
if ! xcrun notarytool submit "$DMG" --keychain-profile "$NOTARY_PROFILE" --wait --output-format json >"$DIST/notary.json" 2>"$log"; then
|
||||
echo "Failed: notarytool submit" >&2; cat "$log" >&2; exit 1
|
||||
fi
|
||||
if ! grep -Eq '"status" *: *"Accepted"' "$DIST/notary.json"; then
|
||||
echo "Notarization not accepted — Apple's log:" >&2
|
||||
xcrun notarytool log --keychain-profile "$NOTARY_PROFILE" \
|
||||
"$(awk -F'"' '/"id" *:/ {print $4; exit}' "$DIST/notary.json")" >&2
|
||||
exit 1
|
||||
fi
|
||||
# The ticket can reach the CDN a few seconds after "Accepted"; stapler 404s in that window.
|
||||
for attempt in 1 2 3 4 5 6; do
|
||||
xcrun stapler staple "$DMG" && break
|
||||
[[ "$attempt" == 6 ]] && { echo "Stapling failed after 6 attempts; retry: xcrun stapler staple $DMG" >&2; exit 1; }
|
||||
echo " ticket not on the CDN yet, retrying in 10 s ($attempt/6)…"
|
||||
sleep 10
|
||||
done
|
||||
# The Gatekeeper verdict a downloader's Mac will reach.
|
||||
spctl -a -t open --context context:primary-signature -v "$DMG"
|
||||
fi
|
||||
|
||||
echo "Built: $DMG"
|
||||
Reference in new issue
Block a user