1.8 KiB
1.8 KiB
CLAUDE.md — mana-swift-event-sync
Guidance für Claude Code in diesem Repo.
Übergeordneter Plan:
../mana/docs/playbooks/MANA_SWIFT_EVENT_SYNC.md(Phasen E-4.0–E-4.6). Plattform-SOT:../mana/docs/MANA_SWIFT.md.
Was dieses Repo ist
ManaEventSync — geteilte Event-Sourcing-Sync-Library für alle nativen
mana-Apps. Nativer Counterpart zu @mana/event-sync (TS). Spiegelt
dessen Wire-Format + Anonymous-Mode/Claim. Konsumiert ManaCore
(AuthClient) aus ../mana-swift-core.
Architektonische Invarianten
Nicht ohne explizite Diskussion antasten:
- Nur Plattform-Plumbing, keine App-Domäne. Payload-Typen, State-Projektionen, Reducer und Repository-API leben in der App, nicht hier. Diese Lib weiß nichts über Articles, Meals, Decks.
- Wire-Parität zu
@mana/event-sync+mana-sync. Envelope-Felder,enc:1:-Crypto,X-Schema-Hash, Endpoints, Idempotency,attributedToUserId == JWT.sub-Grenze. Bei Drift gewinnt der Server. - Identität in der Engine.
attributedToUserId/actorwerden inmakeEnvelopegestempelt — anonym (anon:<id>) oder echt (JWT-sub). Apps rufen keincurrentUserId()mehr. - Anonyme Events bleiben lokal. Push/Pull/WS sind aus, bis
signIn(realUserId)re-taggt + drained. Server akzeptiert nur JWT-validierte Pushes. - Keine 3rd-Party-Dependencies (Compliance). Nur Foundation,
SwiftData, CryptoKit, OSLog +
ManaCore. - Public API ist
Sendable/Swift-6-Concurrency-sauber.
Konventionen
- 4-Space-Indent, 120-col (
.swiftformat/.swiftlint.ymlaus mana-swift-core) - DE als Primary-Locale, Doc-Comments (
///) auf jedempublic-Symbol - CHANGELOG.md pflicht, Semver strikt, Git-Tag pro Sinn-Abschnitt
Lokal
swift build
swift test