// GENERATED by `cotton-gen` from `cotton-core — language/retired_terms.rs` — do not edit by hand. // Run `pnpm gen:design`; `gen:design:check` guards drift in CI. // // The retired vocabulary — 15 terms, and 1 more for sources that never // talk about disk space or about marking a message read. // // Read from `crates/cotton-core/src/language/retired_terms.rs`, which is where a // term is retired; a term is NEVER retired here. `LanguageSweepTests` runs these // patterns over every source in the package — the phone's screens and the Mac // half's alike — and over the phone's string catalogue, which together are the // Swift half of `plainLanguage.test.ts`. The Mac half has no catalogue of its // own and is not getting one: English is the only supported language, so a // catalogue with one locale would carry nothing, and its sentences are swept as // SOURCES instead. // // The patterns are the JavaScript SOURCE with no flags. Every declared one is // `/…/i`, so the Swift options are set ONCE where the regex is built // (`caseInsensitive`) rather than repeated 16 times — a flag repeated is a // flag that goes missing once. `\b` means the same thing in NSRegularExpression // as in a non-unicode JavaScript regex for the ASCII words these patterns name. import Foundation /// One retired term: the pattern that finds it, and the plain words instead. public struct RetiredTerm: Sendable, Equatable { /// Stable id, so a test can assert coverage without matching prose. public let slug: String /// The pattern SOURCE, exactly as the TypeScript declares it. public let pattern: String /// What to say instead — this is the message a failing guard prints. public let instead: String public init(slug: String, pattern: String, instead: String) { self.slug = slug self.pattern = pattern self.instead = instead } /// The compiled form. Case-insensitive, matching the `/i` every declared /// pattern carries. public func regex() throws -> NSRegularExpression { try NSRegularExpression(pattern: pattern, options: [.caseInsensitive]) } } public enum RetiredVocabulary { /// The 15, in the TypeScript's declared order. public static let plain: [RetiredTerm] = [ RetiredTerm( slug: "door", pattern: #"\bdoors?\b"#, instead: "say \"the server\"" ), RetiredTerm( slug: "shelf", pattern: #"\bshel(f|ves)\b"#, instead: "say \"project\"" ), RetiredTerm( slug: "the-memory-room", pattern: #"\bmemory room\b"#, instead: "say \"memory\"" ), RetiredTerm( slug: "room", pattern: #"\bthe rooms?\b|\b(People|Notes|Todos) room\b"#, instead: "say \"tool\", or name it" ), RetiredTerm( slug: "your-file", pattern: #"\byour file\b|\blife file\b|\bCotton file\b"#, instead: "say \"your database\"" ), RetiredTerm( slug: "pack", pattern: #"\bthe packs?\b"#, instead: "say \"the briefing\"" ), RetiredTerm( slug: "box", pattern: #"\bthe box(es)?\b"#, instead: "say \"the host\"" ), RetiredTerm( slug: "mark", pattern: #"\bthe marks?\b"#, instead: "say \"the logo\"" ), RetiredTerm( slug: "seat", pattern: #"\bseats?\b"#, instead: "say \"participant\"" ), RetiredTerm( slug: "nudge", pattern: #"\bnudges?\b"#, instead: "say \"trigger\"" ), RetiredTerm( slug: "law", pattern: #"\blaws?\b"#, instead: "say \"decision\" or \"rule\"" ), RetiredTerm( slug: "canon", pattern: #"\bcanons?\b"#, instead: "say what it is plainly" ), RetiredTerm( slug: "life-record", pattern: #"\blife records?\b"#, instead: "say \"records\", or \"your data\"" ), RetiredTerm( slug: "model-on-device", pattern: #"\bAI runs on your\b"#, instead: "never say where the model runs — say what the database does, and that any assistant can use it" ), RetiredTerm( slug: "row-level-security", pattern: #"\brow[- ]level security\b|\ban account can only\b|\beveryone else shares one\b|\bper-account security\b"#, instead: "say what is true — one database file per person, on the Mac that holds it, opened only for the devices it has admitted" ), ] /// Stricter, for sources that never talk about disk space or about marking /// a message read: a bare `room` here is always the retired metaphor. /// /// The first 15 entries are `plain` by index, not by copy. public static let strict: [RetiredTerm] = [ plain[0], plain[1], plain[2], plain[3], plain[4], plain[5], plain[6], plain[7], plain[8], plain[9], plain[10], plain[11], plain[12], plain[13], plain[14], RetiredTerm( slug: "room-bare", pattern: #"\brooms?\b"#, instead: "say \"memory\", \"project\", or name the tool" ), ] }