@mobile-surfaces/traps
v9.0.0
Published
Single home for the trap catalog, MobileSurfacesError base, URL builder, and generated TS/Swift bindings. Imported by every package that throws or reports diagnostics; not user-facing.
Maintainers
Readme
@mobile-surfaces/traps
Catalog, error base, URL builder, and Swift binding codegen for Mobile Surfaces. Imported by every other Mobile Surfaces package that throws or reports diagnostics; not user-facing.
What lives here
MobileSurfacesError: abstract base class. Every error thrown by@mobile-surfaces/push,@mobile-surfaces/surface-contracts,@mobile-surfaces/live-activity, and@mobile-surfaces/validatorsultimately derives from this. LazytrapIdanddocsUrlgetters resolve through the generated bindings, so subclasses only setthis.name.TRAP_BINDINGSandTrapIds: generated fromdata/traps.jsonat the repo root. Includes the runtime-reachable subset of every trap entry (id, title, severity, detection, summary, symptom, fix,docsUrl, plus optionaldeprecatedandsiblingscross-refs).docsUrlFor(id, title): single URL builder. Every renderer (the generator,scripts/build-agents-md.mjs, the CLI error formatter) imports from here, so the slug algorithm cannot drift.swift/MobileSurfacesTraps.swift: generated SwiftMSTrapBoundprotocol +MSTrapslookup table. Byte-identity replicated intopackages/live-activity/ios/(for the native module pod) andapps/mobile/targets/_shared/(for widget + notification-content extensions via the_shared/auto-membership convention). MS040 enforces the three copies stay in sync.
Release group
@mobile-surfaces/traps ships in the linked release group with
@mobile-surfaces/surface-contracts and @mobile-surfaces/validators.
The three packages always bump majors together; the rest of the
monorepo versions independently. See notes/refactor-v7.md.
Regenerating
Edit data/traps.json. Then run:
node --experimental-strip-types scripts/generate-traps-package.mjspnpm surface:check runs the generator with --check to fail CI on
drift.
