contracts 1.20.0: devotionals, Bible passages, messaging.get, WhatsApp opt-out, App export

The contracts for Church App 1.0.0 (docs/APP-1.0-PLAN.md §12). Additive.

- crosscode.devotional/1, the Hub's devotionals reply, and the devotionals CSV
  import (parseCsv, checkDevotionalCsv, template), shared by the Hub and the App
- Bible books (USFM, English and Afrikaans), seven translations with YouVersion
  ids and copyright lines, parseBibleReference, youVersionUrl
- messaging.get and the messaging.changed hint; whatsapp.optout and
  whatsapp_opted_out on the profile
- APP_MODULES, hub.DEVOTIONALS_PATH, agent.APP_DEMO_PROFILES, app in DEMO_PRODUCTS
- the app section of the church export, people[].roles
- Accounts refuses the two new requests until 1.9.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 09:54:25 +02:00
co-authored by Claude Opus 5.5
parent 8372ef8c6b
commit 514a6d8bc0
39 changed files with 2993 additions and 15 deletions
+19 -7
View File
@@ -72,13 +72,18 @@ export const WEBSITE_DEMO_PROFILES = [
export const websiteDemoProfileSchema = z.enum(WEBSITE_DEMO_PROFILES);
export type WebsiteDemoProfile = z.infer<typeof websiteDemoProfileSchema>;
/** The products with demo data (`seed-demo` jobs). */
export const DEMO_PRODUCTS = ["events", "website"] as const;
/** The Church App's demo data sets (1.20.0): Acacia Hill, the demo church (APP-1.0-PLAN §12). */
export const APP_DEMO_PROFILES = ["acacia-hill"] as const;
export const appDemoProfileSchema = z.enum(APP_DEMO_PROFILES);
export type AppDemoProfile = z.infer<typeof appDemoProfileSchema>;
/** The products with demo data (`seed-demo` jobs). 1.20.0 adds `app`. */
export const DEMO_PRODUCTS = ["events", "website", "app"] as const;
export const demoProductSchema = z.enum(DEMO_PRODUCTS);
export type DemoProduct = z.infer<typeof demoProductSchema>;
/** Each demo product's profiles. */
export const DEMO_PROFILES_BY_PRODUCT: Record<DemoProduct, readonly string[]> = { events: DEMO_PROFILES, website: WEBSITE_DEMO_PROFILES };
export const DEMO_PROFILES_BY_PRODUCT: Record<DemoProduct, readonly string[]> = { events: DEMO_PROFILES, website: WEBSITE_DEMO_PROFILES, app: APP_DEMO_PROFILES };
/** The first agent that runs `seed-demo` jobs (an older one refuses the unknown type). */
export const SEED_DEMO_MIN_AGENT = "1.2.0";
@@ -86,6 +91,12 @@ export const SEED_DEMO_MIN_AGENT = "1.2.0";
/** The first agent that runs `seed-demo` jobs for the Website (`product: "website"`; an older one refuses the unknown key). */
export const SEED_WEBSITE_DEMO_MIN_AGENT = "1.6.0";
/**
* The first agent that runs `seed-demo` jobs for the App (`product: "app"`; an older one passes no
* product to the script, so the Hub mustn't send it one). Agent 1.7.0 ships with App 1.0.0.
*/
export const SEED_APP_DEMO_MIN_AGENT = "1.7.0";
/** The first agent that runs `env-read` and `env-set` jobs (an older one refuses the unknown types). */
export const ENV_JOBS_MIN_AGENT = "1.3.0";
@@ -159,21 +170,22 @@ export const jobArgsSchemas = {
/** `crosscode restart <church> [product] --json` (PM2 reload) */
restart: z.strictObject({ church: shortNameSchema, product: productSchema.optional() }),
/**
* `crosscode demo <church> [website] --profile <profile> [--admin-email <email>] --json`: replaces
* `crosscode demo <church> [website|app] --profile <profile> [--admin-email <email>] --json`: replaces
* Cross Events' data (or, 1.19.0 with `product: "website"`, the Website's content) with a demo
* set (a backup is taken first). The Hub only makes it for installs marked as demo sites.
* set (a backup is taken first); 1.20.0 adds `product: "app"` (the App's prayer wall, campaign,
* testimonies, devotionals, announcements and events). The Hub only makes it for installs marked as demo sites.
* `adminEmail` (Events only): the account kept (default: the release's own choice). No `product`
* is Events, so older Hubs' jobs mean what they did.
*/
"seed-demo": z.strictObject({
church: shortNameSchema,
product: demoProductSchema.optional(),
profile: z.union([demoProfileSchema, websiteDemoProfileSchema]),
profile: z.union([demoProfileSchema, websiteDemoProfileSchema, appDemoProfileSchema]),
adminEmail: z.email().max(254).optional(),
}).superRefine((a, ctx) => {
const product = a.product ?? "events";
if (!DEMO_PROFILES_BY_PRODUCT[product].includes(a.profile)) ctx.addIssue({ code: "custom", path: ["profile"], message: `${a.profile} isn't a ${product} demo` });
if (product === "website" && a.adminEmail) ctx.addIssue({ code: "custom", path: ["adminEmail"], message: "the Website's demo keeps every admin" });
if (product !== "events" && a.adminEmail) ctx.addIssue({ code: "custom", path: ["adminEmail"], message: `the ${product === "app" ? "App" : "Website"}'s demo keeps every admin` });
}),
/**
* `crosscode env <church> <product> --json`: the product's .env values, secrets hidden (only