9e09eb284a
Introduce a single shareable document type for rigs and boards: - ShoeGazeDocument: versioned JSON envelope wrapping either a RigArchive (one or many rigs) or a BoardVersion, with a tolerant decoder that also reads the legacy bare-RigArchive and bare-ShoeGazeState shapes. - Register the .shoegaze UTType (net.realizedsound.shoegaze, conforms to public.json) in all four demo app Info.plists. - Migrate library export/import onto the envelope: exportDocumentData() and a decoder-tolerant importArchive(); RigFileDocument and the Builder exporter/importer now use .shoegaze. Internal per-rig and board-version files stay app-private JSON. - Add OS share-sheet entries via SwiftUI ShareLink: Share per rig in the library sidebar, Share per version in the board editor, backed by the Transferable wrappers RigShareItem / BoardShareItem. Tests: ShoeGazeDocument round-trip and legacy decode, library .shoegaze export/import round-trip, and a board-document-imports-no-rigs case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
1.3 — Rig sharing & the .shoegaze document type
Goal: a single registered file type for sharing rigs and boards, migrate export/import onto it, and add an OS share sheet to the rig library and board-version menu. Local only — no backend, no accounts.
File type
- Extension:
.shoegaze. UTType:net.realizedsound.shoegaze, conforms topublic.json(stays text-readable).UTType.shoeGazelives inLyrebirdShoeGazeUI. - Declared by all four demo apps and both CLI scaffolder templates
(
CFBundleDocumentTypesEditor/Owner +UTExportedTypeDeclarations) so the system associates the type with the app for Open and Share.
Document model — LyrebirdShoeGaze
ShoeGazeDocument — versioned envelope (shoeGazeDocumentFormatVersion = 1) around one payload:
.rigs(RigArchive)— one or many rigs (a single shared rig is a one-rig archive)..board(BoardVersion)— a single board snapshot.
data() encodes pretty-printed JSON (secondsSince1970 dates). decoded(from:legacyRigName:) is
tolerant: tries the envelope, then a bare RigArchive, then a bare ShoeGazeState (normalised to a
one-rig document). On-disk JSON carries an explicit kind discriminator.
Migration
RigLibraryStore.exportDocumentData()writes the library as a.shoegazedocument; the priorexportArchiveData()(bareRigArchive) is retained for callers/tests.importArchive(from:)now decodes viaShoeGazeDocument.decoded— accepts.shoegaze, bare archive, and legacy single-rig files. A board document contributes no rigs.RigFileDocumentwrites.shoeGaze, reads[.shoeGaze, .json]. The Builder'sfileExporteruses.shoeGaze; thefileImporteraccepts[.shoeGaze, .json].- Internal per-rig library files and board-version files stay plain
.json(app-private; no churn)..shoegazeis the share/export surface only.
Share UI — LyrebirdShoeGazeUI
RigShareItem/BoardShareItem—Transferablewrappers holding pre-encoded.shoegazebytes (value-type payload keeps themSendable). Suggested filename<name>.shoegaze.- Rig library sidebar:
Share…per rig (context menu). Board editor Versions menu:Share…per version. Both via SwiftUIShareLink→ AirDrop / Mail / Messages / Files.
Tests
ShoeGazeDocumentTests— rig/board round-trip, legacy archive + bare-state decode, garbage rejection,kinddiscriminator on disk.RigLibraryStoreTests—.shoegazeexport→import round-trip; board document imports zero rigs.- Lyrebird
ProjectScaffolderTests— generated macOS/iOSInfo.plistregisters the document type.