// RULE (voice plan, 17 Nov 2026): every word Cotton Meetings shows is a kit// line. App Intents' titles and Siri phrases must be literals in Swift, so// they are KEYS there (`CottonMeetingsLive`) and their words live in two// strings files the Meetings app and its widget extension carry, written// from the kit's `meetings` lines `intent.*`. This holds the files equal to// the kit and every key the Swift names present in them.import { readFileSync } from"node:fs";import { join } from"node:path";import { describe, expect, it } from"vitest";const ROOT = join(__dirname, "..", "..");const STRINGS = join(ROOT, "apps/cotton/App/MeetingsWidgets/Strings/en.lproj");const SWIFT = join(ROOT, "apps/cotton/Sources/CottonMeetingsLive");function strings(file: string): Map<string, string> {const found = newMap<string, string>();for (const match of readFileSync(join(STRINGS, file), "utf8").matchAll(/^"((?:[^"\\]|\\.)*)" = "((?:[^"\\]|\\.)*)";$/gm)) { found.set(match[1], match[2].replace(/\\"/g, '"').replace(/\\\\/g, "\\")); }return found;}describe("Cotton Meetings' intent words", () => {const intent = JSON.parse(readFileSync(join(ROOT, "crates/cotton-core/kits/shell/lines/meetings.json"), "utf8")).intent asRecord<string, string>; it("says each title as the kit does", () => {const titles = strings("Meetings.strings");const wanted = Object.entries(intent).filter(([key]) => !key.startsWith("phrase_")); expect([...titles.entries()]).toEqual(wanted.map(([key, words]) => [`intent.${key}`, words])); }); it("says each phrase as the kit does, with the app's name", () => {const phrases = strings("AppShortcuts.strings");const wanted = Object.entries(intent).filter(([key]) => key.startsWith("phrase_")); expect([...phrases.entries()]).toEqual(wanted.map(([key, words]) => [`intent.${key} \${applicationName}`, words]));for (const words of phrases.values()) expect(words).toContain("${applicationName}"); }); it("has words for every key the intents name", () => {const titles = strings("Meetings.strings");const phrases = strings("AppShortcuts.strings");const swift = ["MeetingsIntents.swift", "MeetingsLive.swift"].map((file) => readFileSync(join(SWIFT, file), "utf8")).join("\n");const keys = [...swift.matchAll(/LocalizedStringResource\("([^"]+)", table: "Meetings"\)/g)].map((one) => one[1]); expect(keys.length).toBeGreaterThan(5);for (const key of keys) expect(titles.has(key), key).toBe(true);for (const phrase of swift.matchAll(/"(intent\.phrase_[a-z_]+) \\\(\.applicationName\)"/g)) { expect(phrases.has(`${phrase[1]} \${applicationName}`), phrase[1]).toBe(true); } });});