Compare commits

...
Author SHA1 Message Date
joshua 50ac7fab33 Merge branch 'feat/contracts-1.21' 2026-11-30 10:11:48 +02:00
joshuaandClaude Opus 5.5 7032e16894 contracts 1.21.0: demo scenarios, eight churches across every product
agent.DEMO_SCENARIOS (one per Website demo profile, each its own fictional
church), DEMO_SCENARIO_ORDER (Accounts first), DEMO_SCENARIO_MIN_VERSIONS,
scenario in seed-demo, accounts in DEMO_PRODUCTS, a profile per scenario for
Events and the App, SEED_SCENARIO_MIN_AGENT (1.7.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 10:11:46 +02:00
joshua b720706143 Merge branch 'docs/app-demo-scenarios' 2026-11-30 10:03:36 +02:00
joshuaandClaude Opus 5.5 5380a87be1 docs: App 1.0 plan, eight demo scenarios, each its own church with logo and details
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 10:03:36 +02:00
joshuaandClaude Opus 5.5 bd472ddc05 docs: App 1.0 plan, demo scenarios across every product; contracts 1.20.0 recorded as released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 09:56:16 +02:00
9 changed files with 346 additions and 34 deletions
+20
View File
@@ -2,6 +2,26 @@
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
## contracts@1.21.0 - 2026-11-30
Demo scenarios (docs/APP-1.0-PLAN.md §12, "Demo scenarios"): one choice on a demo client in the
Hub loads every product with the same church. Additive for `seed-demo` jobs older Hubs send.
- **`agent.DEMO_SCENARIOS`**: eight, one per Website demo profile and keyed by it, each its own
fictional church (St Columba's, Grace Cathedral, Ignite Church, Harbour City, Acacia Hill, Karoo
Gemeenskapskerk, Northpoint, Riverside) with a label, description, campuses, language, the App's
active-member band, and the profile each product loads. `demoScenario(key)`,
`DEMO_SCENARIO_ORDER` (Accounts, Events, Website, App), `DEMO_SCENARIO_MIN_VERSIONS` (Accounts
1.9.0, Events 3.8.0, Website 1.8.0, App 1.0.0).
- **`seed-demo`** takes an optional `scenario`; its `profile` must then be the scenario's for the
product. `accounts` joins `DEMO_PRODUCTS` (the scenario's church profile, logo, icon and people;
no `adminEmail`). Events gets a profile per scenario next to its four (`EVENTS_DEMO_PROFILES`),
so a scenario name with no `product` is an Events demo.
- **`APP_DEMO_PROFILES`** is the eight scenarios. 1.20.0's `acacia-hill` is gone: it's the
`community-family` scenario, and no App or Hub had used it.
- `SEED_SCENARIO_MIN_AGENT` (1.7.0) and `SEED_DEMO_MIN_AGENT_BY_PRODUCT`. JSON Schema `agent-job`
regenerated.
## contracts@1.20.0 - 2026-11-30
The contracts for Church App 1.0.0 (docs/APP-1.0-PLAN.md §12), the first step of phase 6. Additive:
+105 -14
View File
@@ -35,8 +35,11 @@ it goes on sale (crosscode-site, ROADMAP §9).
**Done when:**
- `app@1.0.0`, `contracts@1.20.0`, `accounts@1.9.0`, `events@3.8.0` and Hub `v2.26.0` are tagged; the Hub installs
- `app@1.0.0`, `contracts@1.20.0` (released 2026-11-30), `contracts@1.21.0` (released 2026-11-30), `accounts@1.9.0`,
`events@3.8.0`, `website@1.8.0`, `agent@1.7.0` and Hub `v2.26.0` are tagged; the Hub installs
the App from New install (after Accounts) and lists its releases.
- On a demo client, **Load a demo scenario** in the Hub loads Accounts, Events, the Website and
the App with the same church, people and events, in one step (§12, "Demo scenarios").
- The Hub holds 3 months of Cross Code devotionals (written or imported from CSV), and an App set to
"From Cross Code" shows and sends them.
- A member can add the App to their home screen (Android and iPhone), sign in once, book a one-off
@@ -430,7 +433,8 @@ the band in Settings → Licence. Visitors browsing signed out never count.
- **`crosscode`:** `scripts/products/app.sh` with the same hooks as the Website (`app` is already
in `PRODUCT_ORDER`), `app.env.template.json` (the env template in three places, HANDOVER "A new
.env variable"), `crosscode add <church> app`.
- **Agent:** none expected (the job schemas already take `app`). Check `demo` passes `app` on.
- **Agent 1.7.0:** `seed-demo` for `app` and `accounts` (1.6.0 only passes `website` on to
`crosscode demo`), and demo scenarios (below).
- **Accounts, otherwise:** Connect already accepts the App as a client (`CLIENT_PRODUCTS`) and the
profile already has `links.app`. The Website's and Events' headers and `ChurchFooter` show "App"
as soon as the link is there.
@@ -438,18 +442,91 @@ the band in Settings → Licence. Visitors browsing signed out never count.
three months of commitments and a few gaps, a campaign, testimonies, devotionals, announcements
and events, for screenshots and the Hub's demo sites.
### Demo scenarios (requirement added by Joshua 2026-11-30)
Today each product loads its own demo on its own (Events: 4 profiles, the Website: 8 by template,
the App: Acacia Hill), and nothing makes them the same church. A **demo scenario** is a preset
combination: one choice on a demo client in the Hub loads **every product the client has** with
data that describes **the same church**, so a demo shows the three products working together.
- **Each scenario is its own church** (Joshua, 2026-11-30): a scenario load **replaces the
church profile in Accounts** with the scenario's own, which a single-product demo never does (the
Website's demo keeps the profile and only uses the church's name). It's a demo client, so nothing
real is lost; the profile before the load goes in the backup taken first. Each scenario has:
- a name, short name and a **logo and icon** of its own (made for the demo, a simple mark and
wordmark per church, never a real church's), in `apps/accounts/backend/demo-assets/<scenario>/`
with a credits file. Accounts serves them itself (`/demo-assets/…`), since its profile holds
addresses, not uploads;
- colours, font pairing, corners and the Website template's style that suit it;
- a street address, campuses, service times, phone, email (`@example.com`) and social links
(to `example.com` addresses), a timezone, and the product links to the client's installs;
- photos from the Website's demo set for that profile (as now), used in Events and the App too.
- **What "aligned" means:** in one scenario, every product has
- the same church profile in Accounts, as above, which Events, the Website and the App all read;
- the same people, one account each in Accounts (all at `@example.com`, password `Demo@1234`):
the pastor who leads on the Website, runs an Events registration and is Owner in the App; a
prayer coordinator who also serves on an Events roster; members who register for events and
book prayer slots;
- the same events: made in Events (and the App's or Website's simple events where the scenario
has them), shown in the others through the event feed, never copied;
- the same campuses throughout (one, or three for the multi-campus scenario);
- content that fits the church: a prayer campaign before its conference, announcements about its
events, messages from its pastor.
- **The eight scenarios** (Joshua, 2026-11-30: one per Website demo profile; more in 1.x). The
key is the Website profile's. Events' 4 profiles become 8, one per church (the column says which
kind each is built from). All names are fictional:
| Scenario | Church | Website | Events (built from) | App |
|---|---|---|---|---|
| `heritage-parish` | **St Columba's**: a 120-year-old parish church, small and older, Sunday 09:00 | `heritage-parish` | `small`: carol service, harvest festival, a funeral-tea roster | a quiet wall (about 10 of 24 hours), Cross Code's devotionals in NKJV, a Lent campaign |
| `heritage-city` | **Grace Cathedral**: city centre, three Sunday services, lunchtime prayer | `heritage-city` | `events`: a concert series, ticketed Easter services | full in office hours with gaps at night, a weekday lunchtime focus, announcements per service |
| `bold-youth` | **Ignite Church**: young and music-led | `bold-youth` | `events`: a youth conference with paid registration, a worship night | a 21-day campaign before the conference, testimonies, WhatsApp reminders, NLT devotionals |
| `bold-plant` | **Harbour City**: a 2-year-old plant in a school hall | `bold-plant` | `small`: launch Sunday, a newcomers' lunch | a wall still filling up (the admin's setup checklist half done), the pastor's own devotionals |
| `community-family` | **Acacia Hill**: a family church (cross-demo2, the mockup's church) | `community-family` | `ministry`: kids' club, Alpha, family camp, volunteer rosters | full with a few gaps (as in the mockup), a 21-day campaign, members' requests waiting for approval |
| `community-town` | **Karoo Gemeenskapskerk**: a country-town church, mostly Afrikaans | `community-town` | `small`: a bazaar, a prayer breakfast | AFR83 devotionals of its own, 30-minute slots, the area's emergency numbers |
| `clean-modern` | **Northpoint**: a contemporary church of about 600 | `clean-modern` | `ministry`: courses, groups launch, serve teams | every hour covered, target 2 per slot, Cross Code's devotionals, announcements by WhatsApp |
| `clean-campus` | **Riverside**: three campuses near the university | `clean-campus` | `multicampus`: student welcome week at one campus, a combined worship night | one wall for three campuses, announcements per campus, students on the 02:00 slots |
Between them, the App's active members cover every band from 0–100 to 2 001–5 000 and Events'
income bands vary, so the scenarios also show the Hub's tiers and billing. Each scenario's people
are sized to its band (the App's active-member count comes from them).
- **Contracts 1.21.0 (released 2026-11-30):** `agent.DEMO_SCENARIOS`: each scenario's key, label, description, and the
profile it uses for each product (`accounts`, `events`, `website`, `app`), so the Hub and the
agent agree; a test checks every profile it names exists. `seed-demo` takes an optional
`scenario`, and `accounts` joins `DEMO_PRODUCTS` (its demo is the church profile and the people).
- **Agent 1.7.0:** runs `crosscode demo <church> <product> --profile <p> [--scenario <s>]` for
every product, so a product can tell a scenario load from a single one.
- **Hub 2.26.0:** on a demo client (every install marked as a demo site), **Load a demo
scenario**: pick one from the list, see which installs it will replace (and any product the
client has that the scenario doesn't cover), type the client's short name once, and the Hub
queues one batch in order: **Accounts first** (profile and people), then **Events**, the
**Website** and the **App**, each job starting only after the one before it succeeded; a failure
stops the rest and says which product is now out of step. At the end the products sync the
event feed, and one email reports the whole batch. The client page shows the scenario last
loaded and when. Loading one product's demo on its own stays (as now), marked "out of step with
the scenario" until a scenario is loaded again. The Hub refuses a scenario when an install
needs a newer release (each scenario lists the minimum versions it needs).
- **Products:** each product's demo loader takes `--scenario` and builds that scenario's data:
Accounts (new: the profile and the people, replacing old demo people with `people.removeDemo`),
Events 3.8.0 (its 4 profiles become 8, one per scenario's church and people), the Website 1.8.0
(its profiles take the people and events of the scenario they're in) and the App 1.0.0. A
product without the scenario's profile refuses the job, so a half-loaded demo is never silent.
## 13. What changes in each repo
| Repo | Change | Version |
|------|--------|---------|
| `crosscode-platform` `apps/app` | New (§1–§12), with `CHANGELOG.md`, `WHATS-NEW.md`, `env.template.json`, e2e, demo data | `app@1.0.0` |
| `crosscode-platform` `packages/contracts` | `app` in `DEMO_PRODUCTS`, `APP_MODULES`, the `app` part of the church export, `crosscode.devotional/1` and its CSV rules, the translations, `messaging.get` | `contracts@1.20.0` |
| `crosscode-platform` `apps/accounts` | `messaging.get` for linked products, a hint when the messaging settings change, the WhatsApp opt-out for every product | `accounts@1.9.0` |
| `crosscode-platform` `apps/events` | STOP replies passed to Accounts; the opt-out read from Accounts | `events@3.8.0` |
| `crosscode-platform` `packages/contracts` | `app` in `DEMO_PRODUCTS`, `APP_MODULES`, the `app` part of the church export, `crosscode.devotional/1` and its CSV rules, the translations, `messaging.get`, `whatsapp.optout` | `contracts@1.20.0` (**released 2026-11-30**) |
| `crosscode-platform` `packages/contracts` | `agent.DEMO_SCENARIOS`, `scenario` in `seed-demo`, `accounts` in `DEMO_PRODUCTS` | `contracts@1.21.0` (**released 2026-11-30**) |
| `crosscode-platform` `apps/accounts` | `messaging.get` for linked products, a hint when the messaging settings change, the WhatsApp opt-out for every product; demo data (the scenario's church profile with its logo and icon, and its people) | `accounts@1.9.0` |
| `crosscode-platform` `apps/events` | STOP replies passed to Accounts; the opt-out read from Accounts; demo profiles reworked to the scenarios | `events@3.8.0` |
| `crosscode-platform` `apps/website` | Demo profiles take the scenario's people and events (`--scenario`) | `website@1.8.0` |
| `crosscode-platform` `apps/agent` | `seed-demo` for `app` and `accounts`, `--scenario` passed on | `agent@1.7.0` |
| `crosscode-platform` `packages/ui` | The tab bar and bottom sheet, if worth sharing; otherwise nothing | workspace |
| `crosscode-platform` `packages/seo` | `Article` builder for devotionals and announcements; the icon generator for the manifest | workspace |
| `crosscode-platform` `scripts/` | `products/app.sh`, `app.env.template.json`, bats tests | — |
| `events-hub` | App in New install, its releases, env template, billing on the band, renewal check, FastPanel email, Devotionals (write, schedule 3 months ahead, Import CSV, the endpoint for Apps) | Hub `v2.26.0` |
| `events-hub` | App in New install, its releases, env template, billing on the band, renewal check, FastPanel email, Devotionals (write, schedule 3 months ahead, Import CSV, the endpoint for Apps), **Load a demo scenario** on a demo client (vendored contracts 1.21.0) | Hub `v2.26.0` |
| `crosscode-site` | Church App on sale (ROADMAP §9): its page, the active-member tiers, House of Prayer screenshots, the bundle examples (§10), FAQ, `SoftwareApplication` JSON-LD | `v1.10.0` |
## 14. Testing
@@ -471,6 +548,11 @@ the band in Settings → Licence. Visitors browsing signed out never count.
blocked, by polling); a shared request waits for approval; escalation; announcement and
devotional publishing; offline Home; the manifest and service worker (installable); axe on every
screen; the §11 checks on public pages and `noindex` on prayer pages.
- **Demo scenarios:** contracts: every profile a scenario names exists. Hub: the batch runs in
order, stops at the first failure and says what's out of step, refuses an install on too old a
release. On cross-demo2, each scenario loaded end to end: the same church name, logo and people
in all four products, Events' events on the Website and in the App, no leftover people from the
scenario before.
- **Lighthouse (mobile):** Home, an event and a devotional: SEO 100, accessibility 95+,
performance 90+.
- **The release checks** (ROADMAP §9) for the App, and a throwaway install from the Hub (New
@@ -479,15 +561,18 @@ the band in Settings → Licence. Visitors browsing signed out never count.
## 15. Releasing and rolling it out
1. `contracts@1.20.0`, then `accounts@1.9.0` (`messaging.get`, the WhatsApp opt-out) and
`events@3.8.0` (STOP passed to Accounts), rolled out to every church.
2. Hub `v2.26.0` (vendored contracts 1.20.0) deployed, and the first 3 months of Cross Code
1. `contracts@1.20.0` (**released 2026-11-30**), then `accounts@1.9.0` (`messaging.get`, the
WhatsApp opt-out) and `events@3.8.0` (STOP passed to Accounts), rolled out to every church.
2. `contracts@1.21.0` (demo scenarios, **released 2026-11-30**), with the scenario demo loaders in Accounts 1.9.0, Events
3.8.0, `website@1.8.0`, and `agent@1.7.0`.
3. Hub `v2.26.0` (vendored contracts 1.21.0) deployed, and the first 3 months of Cross Code
devotionals written or imported.
3. `app@1.0.0` tagged after the e2e and Lighthouse runs.
4. **cross-demo2** (Acacia Hill): New install → App, demo data loaded, the throwaway test above.
5. **Hope Family Church:** New install → App; the prayer coordinators set the wall up before it's
4. `app@1.0.0` tagged after the e2e and Lighthouse runs.
5. **cross-demo2** (Acacia Hill): New install → App, every demo scenario loaded once, the
throwaway test above.
6. **Hope Family Church:** New install → App; the prayer coordinators set the wall up before it's
announced to the church.
6. crosscode-site `v1.10.0`: the App on sale (prices already in the Hub).
7. crosscode-site `v1.10.0`: the App on sale (prices already in the Hub).
## Decisions
@@ -516,6 +601,11 @@ Made by Joshua on 2026-11-30, after the first draft and the mockup:
11. **Accounts keeps the WhatsApp opt-out for every product,** so a STOP to the shared number
reaches the App, Events and Accounts alike (§8). Adds Events 3.8.0.
12. **Home shows today's prayer clock** in small, as the House of Prayer does (mockup redrawn).
13. **Demo scenarios** (added later on 2026-11-30): on a demo client, one choice in the Hub loads
every product with the same church, people and events, from preset combinations (§12). Adds
contracts 1.21.0, agent 1.7.0 and Website 1.8.0, and demo data in Accounts 1.9.0. Eight
scenarios, one per Website demo profile, each its own church: a scenario load replaces the
church profile with its own name, logo, icon, colours and details.
The other proposals as first written, confirmed:
@@ -550,6 +640,7 @@ for a group; an app-store release; moving to the church's own domain (as the Web
## Still open
- **Which two Afrikaans translations** (§6): 1933/1953 and 1983 proposed.
- ~~Which two Afrikaans translations~~: 1933/1953 and 1983, confirmed by Joshua 2026-11-30 (YouVersion ids checked, contracts 1.20.0).
- **The publishers' terms** for quoting each translation in an app (§6), checked before Cross
Code's devotionals go out; ask for permission where the terms don't cover it.
- ~~The demo scenarios~~: eight, one per Website demo profile, each its own church with its own logo and details; Acacia Hill is `community-family` (Joshua, 2026-11-30).
+7 -1
View File
@@ -14,7 +14,7 @@ separately below; the two often differ.
| Church Website | `crosscode-platform` (`apps/website`) | **1.7.1** | `website@1.7.1` | 2026-11-28 |
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.8.0** | `accounts@1.8.0` | 2026-11-26 |
| Server agent | `crosscode-platform` (`apps/agent`) | **1.6.0** | `agent@1.6.0` | 2026-11-27 |
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.20.0** | `contracts@1.20.0` | 2026-11-30 |
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.21.0** | `contracts@1.21.0` | 2026-11-30 |
| Cross Code Hub | `events-hub` | **2.25.1** | `v2.25.1` | 2026-11-27 |
| crosscode.co.za | `crosscode-site` | **1.9.1** | `v1.9.1` | 2026-11-27 |
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-27 (last change: an uninstall keeps the Website's backup snapshots shared, `rsync -aH`) |
@@ -38,6 +38,12 @@ need their own tags until something outside this repo depends on them.
## What each latest release was for
- **Contracts 1.21.0 (2026-11-30):** demo scenarios (APP-1.0-PLAN §12): `agent.DEMO_SCENARIOS`,
eight fictional churches, one per Website demo profile, that load Accounts, Events, the Website
and the App alike; `scenario` in `seed-demo`, `accounts` in `DEMO_PRODUCTS`, a profile per
scenario for Events and the App (1.20.0's unused `acacia-hill` replaced by `community-family`),
the minimum releases and agent. Checked: contracts tests (335), JSON Schemas, lint, the agent's
tests. Nothing to deploy: the Hub vendors it with 2.26.0.
- **Contracts 1.20.0 (2026-11-30):** the contracts for Church App 1.0.0 (APP-1.0-PLAN §12), the
first step of phase 6: `crosscode.devotional/1` and the devotionals CSV checks shared by the Hub
and the App, the Bible books and seven translations (YouVersion ids checked by Joshua),
+1 -1
View File
@@ -23185,7 +23185,7 @@
},
"packages/contracts": {
"name": "@crosscode/contracts",
"version": "1.20.0",
"version": "1.21.0",
"license": "UNLICENSED",
"dependencies": {
"zod": "^4.6.7"
+1
View File
@@ -17,6 +17,7 @@ Events and the Hub, uses it, so the key fields are the same in every product's J
| Env template | `crosscode.env-template/1` | Each product's `.env` variables by layer; `missingRequired` and, from 1.6.0, `checkEnvValue` / `invalidValues` (values an app can't start with, e.g. `TRUST_PROXY=TRUE`), which the Hub checks before a job | `src/agent.ts` (exported as `agent`) |
| Devotional | `crosscode.devotional/1` | From 1.20.0: one day's devotional for the Church App (Cross Code's from the Hub at `GET /api/v2/devotionals`, or the church's own), the CSV import's columns and row checks (`checkDevotionalCsv`, `DEVOTIONAL_CSV_TEMPLATE`), shared by the Hub and the App | `src/devotional.ts` |
| Bible passages | — | From 1.20.0: the 66 books (USFM codes, English and Afrikaans names), the seven translations with their YouVersion ids and copyright lines, `parseBibleReference`, `formatBibleReference`, `youVersionUrl` | `src/bible.ts` |
| Demo scenarios | — | From 1.21.0: `agent.DEMO_SCENARIOS`, eight preset churches that load every product of a demo client alike (Accounts first, `DEMO_SCENARIO_ORDER`), each product's profiles, the minimum releases and agent; `seed-demo` takes `scenario` | `src/agent.ts` (exported as `agent`) |
| Signing | — | HMAC request signing for the Hub and for product links (Node only) | `src/signing.ts` (`@crosscode/contracts/signing`) |
## Using it
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/contracts",
"version": "1.20.0",
"version": "1.21.0",
"description": "The shared JSON formats used by every Cross Code product: zod schemas, JSON Schema, TypeScript types and sample payloads",
"license": "UNLICENSED",
"type": "commonjs",
+32 -3
View File
@@ -824,7 +824,8 @@
"enum": [
"events",
"website",
"app"
"app",
"accounts"
]
},
"profile": {
@@ -835,7 +836,15 @@
"small",
"events",
"ministry",
"multicampus"
"multicampus",
"heritage-parish",
"heritage-city",
"bold-youth",
"bold-plant",
"community-family",
"community-town",
"clean-modern",
"clean-campus"
]
},
{
@@ -854,7 +863,14 @@
{
"type": "string",
"enum": [
"acacia-hill"
"heritage-parish",
"heritage-city",
"bold-youth",
"bold-plant",
"community-family",
"community-town",
"clean-modern",
"clean-campus"
]
}
]
@@ -864,6 +880,19 @@
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
"scenario": {
"type": "string",
"enum": [
"heritage-parish",
"heritage-city",
"bold-youth",
"bold-plant",
"community-family",
"community-town",
"clean-modern",
"clean-campus"
]
}
},
"required": [
+127 -9
View File
@@ -1,5 +1,6 @@
import { z } from "zod";
import { dateTimeSchema, productSchema } from "./common";
import type { ACTIVE_MEMBER_BANDS } from "./hub";
/**
* The server agent (docs/AGENT-1.0-PLAN.md, ROADMAP-v3 phase 1d): what the Hub and the agent on
@@ -72,18 +73,120 @@ export const WEBSITE_DEMO_PROFILES = [
export const websiteDemoProfileSchema = z.enum(WEBSITE_DEMO_PROFILES);
export type WebsiteDemoProfile = z.infer<typeof websiteDemoProfileSchema>;
/** 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;
// ─── Demo scenarios (1.21.0, APP-1.0-PLAN §12 "Demo scenarios") ──────────────
/**
* A demo scenario loads every product of a demo client with the same church: Accounts' church
* profile (its own name, logo, icon, colours and details) and people, then Events, the Website and
* the App, each with that church's data. One per Website demo profile, keyed by it.
*/
export const DEMO_SCENARIO_KEYS = WEBSITE_DEMO_PROFILES;
export const demoScenarioSchema = z.enum(DEMO_SCENARIO_KEYS);
export type DemoScenarioKey = z.infer<typeof demoScenarioSchema>;
/**
* Cross Events' demo data sets: the four single-product ones (`set-demo.js`) and, from Events
* 3.8.0, one per scenario, named after it.
*/
export const EVENTS_DEMO_PROFILES = [...DEMO_PROFILES, ...DEMO_SCENARIO_KEYS] as const;
export const eventsDemoProfileSchema = z.enum(EVENTS_DEMO_PROFILES);
/**
* The Church App's demo data sets: one per scenario (1.21.0; 1.20.0's `acacia-hill` is the
* `community-family` scenario, and no App had shipped with it).
*/
export const APP_DEMO_PROFILES = DEMO_SCENARIO_KEYS;
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;
/** Accounts' demo data sets (1.21.0): a scenario's church profile and people. One per scenario. */
export const ACCOUNTS_DEMO_PROFILES = DEMO_SCENARIO_KEYS;
/** The products with demo data (`seed-demo` jobs). 1.20.0 adds `app`, 1.21.0 `accounts`. */
export const DEMO_PRODUCTS = ["events", "website", "app", "accounts"] 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, app: APP_DEMO_PROFILES };
export const DEMO_PROFILES_BY_PRODUCT: Record<DemoProduct, readonly string[]> = {
events: EVENTS_DEMO_PROFILES, website: WEBSITE_DEMO_PROFILES, app: APP_DEMO_PROFILES, accounts: ACCOUNTS_DEMO_PROFILES,
};
const DEMO_PRODUCT_NAMES: Record<DemoProduct, string> = { events: "Cross Events", website: "Website", app: "App", accounts: "Accounts" };
/** The order a scenario loads in: Accounts first (the profile and people the others read). */
export const DEMO_SCENARIO_ORDER = ["accounts", "events", "website", "app"] as const satisfies readonly DemoProduct[];
/** The first release of each product that loads a scenario (`--scenario`). The Hub refuses a scenario for an older install. */
export const DEMO_SCENARIO_MIN_VERSIONS: Record<DemoProduct, string> = { accounts: "1.9.0", events: "3.8.0", website: "1.8.0", app: "1.0.0" };
export interface DemoScenario {
key: DemoScenarioKey;
/** The church's name in the demo. */
church: string;
/** For the Hub's list. */
label: string;
description: string;
/** The profile each product loads. */
profiles: { accounts: string; events: string; website: string; app: string };
/** Campuses in the church profile. */
campuses: number;
/** The demo's main language (Afrikaans content and devotionals for `af`). */
language: "en" | "af";
/** The App's active-member band its people give it, so the scenarios show the Hub's tiers. */
appActiveMembers: (typeof ACTIVE_MEMBER_BANDS)[number];
}
const scenario = (key: DemoScenarioKey, s: Omit<DemoScenario, "key" | "profiles">): DemoScenario =>
({ key, ...s, profiles: { accounts: key, events: key, website: key, app: key } });
/** The eight scenarios (Joshua, 2026-11-30). Every church and person in them is fictional. */
export const DEMO_SCENARIOS: readonly DemoScenario[] = [
scenario("heritage-parish", {
church: "St Columba's", label: "Heritage: St Columba's, a parish church",
description: "A 120-year-old parish church, small and older, one Sunday service. Carols, a harvest festival, a quiet prayer wall and a Lent campaign.",
campuses: 1, language: "en", appActiveMembers: "0–100",
}),
scenario("heritage-city", {
church: "Grace Cathedral", label: "Heritage: Grace Cathedral, a city-centre church",
description: "Three Sunday services and lunchtime prayer. A concert series, ticketed Easter services, a prayer wall full in office hours with gaps at night.",
campuses: 1, language: "en", appActiveMembers: "301–750",
}),
scenario("bold-youth", {
church: "Ignite Church", label: "Bold: Ignite Church, young and music-led",
description: "A youth conference with paid registration and a worship night, a 21-day prayer campaign before it, testimonies and WhatsApp reminders.",
campuses: 1, language: "en", appActiveMembers: "751–2 000",
}),
scenario("bold-plant", {
church: "Harbour City", label: "Bold: Harbour City, a new church plant",
description: "Two years old, meeting in a school hall. Launch Sunday, a newcomers' lunch, a prayer wall still filling up and the admin's setup half done.",
campuses: 1, language: "en", appActiveMembers: "0–100",
}),
scenario("community-family", {
church: "Acacia Hill", label: "Community: Acacia Hill, a family church",
description: "The mockup's church (cross-demo2). Kids' club, Alpha, family camp and volunteer rosters, a 21-day campaign, prayer requests waiting for approval.",
campuses: 1, language: "en", appActiveMembers: "101–300",
}),
scenario("community-town", {
church: "Karoo Gemeenskapskerk", label: "Community: Karoo Gemeenskapskerk, a country-town church",
description: "Mostly Afrikaans. A bazaar and a prayer breakfast, its own AFR83 devotionals, 30-minute prayer slots.",
campuses: 1, language: "af", appActiveMembers: "101–300",
}),
scenario("clean-modern", {
church: "Northpoint", label: "Clean: Northpoint, a contemporary church",
description: "About 600 people. Courses, a groups launch and serve teams, every prayer hour covered twice, announcements by WhatsApp.",
campuses: 1, language: "en", appActiveMembers: "301–750",
}),
scenario("clean-campus", {
church: "Riverside", label: "Clean: Riverside, three campuses near the university",
description: "Student welcome week at one campus and a combined worship night, one prayer wall for all three, announcements per campus.",
campuses: 3, language: "en", appActiveMembers: "2 001–5 000",
}),
];
export function demoScenario(key: DemoScenarioKey): DemoScenario {
return DEMO_SCENARIOS.find((s) => s.key === key)!;
}
/** The first agent that runs `seed-demo` jobs (an older one refuses the unknown type). */
export const SEED_DEMO_MIN_AGENT = "1.2.0";
@@ -97,6 +200,14 @@ export const SEED_WEBSITE_DEMO_MIN_AGENT = "1.6.0";
*/
export const SEED_APP_DEMO_MIN_AGENT = "1.7.0";
/** 1.21.0: the first agent that runs `seed-demo` for Accounts and with a `scenario` (passed on as `--scenario`). */
export const SEED_SCENARIO_MIN_AGENT = "1.7.0";
/** The first agent that runs a product's `seed-demo` jobs. */
export const SEED_DEMO_MIN_AGENT_BY_PRODUCT: Record<DemoProduct, string> = {
events: SEED_DEMO_MIN_AGENT, website: SEED_WEBSITE_DEMO_MIN_AGENT, app: SEED_APP_DEMO_MIN_AGENT, accounts: SEED_SCENARIO_MIN_AGENT,
};
/** 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";
@@ -170,22 +281,29 @@ export const jobArgsSchemas = {
/** `crosscode restart <church> [product] --json` (PM2 reload) */
restart: z.strictObject({ church: shortNameSchema, product: productSchema.optional() }),
/**
* `crosscode demo <church> [website|app] --profile <profile> [--admin-email <email>] --json`: replaces
* `crosscode demo <church> [website|app|accounts] --profile <profile> [--scenario <s>] [--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); 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.
* is Events, so older Hubs' jobs mean what they did. 1.21.0: `product: "accounts"` (the
* scenario's church profile, with its logo and icon, and its people) and `scenario`: one job per
* product in `DEMO_SCENARIO_ORDER`, each with the scenario's profile for that product.
*/
"seed-demo": z.strictObject({
church: shortNameSchema,
product: demoProductSchema.optional(),
profile: z.union([demoProfileSchema, websiteDemoProfileSchema, appDemoProfileSchema]),
profile: z.union([eventsDemoProfileSchema, websiteDemoProfileSchema, appDemoProfileSchema]),
adminEmail: z.email().max(254).optional(),
/** 1.21.0: part of loading this scenario (the profile must be the scenario's for the product). */
scenario: demoScenarioSchema.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 !== "events" && a.adminEmail) ctx.addIssue({ code: "custom", path: ["adminEmail"], message: `the ${product === "app" ? "App" : "Website"}'s demo keeps every admin` });
if (product !== "events" && a.adminEmail) ctx.addIssue({ code: "custom", path: ["adminEmail"], message: `the ${DEMO_PRODUCT_NAMES[product]}'s demo keeps every admin` });
if (a.scenario && demoScenario(a.scenario).profiles[product] !== a.profile) {
ctx.addIssue({ code: "custom", path: ["profile"], message: `the ${a.scenario} scenario loads ${demoScenario(a.scenario).profiles[product]} in ${DEMO_PRODUCT_NAMES[product]}` });
}
}),
/**
* `crosscode env <church> <product> --json`: the product's .env values, secrets hidden (only
+52 -5
View File
@@ -169,17 +169,64 @@ describe("seed-demo jobs", () => {
expect(args({ church: "hope", product: "website", profile: "bold-plant" })).toBe(true);
expect(args({ church: "hope", product: "events", profile: "small" })).toBe(true);
expect(args({ church: "hope", product: "website", profile: "small" })).toBe(false);
expect(args({ church: "hope", profile: "bold-plant" })).toBe(false);
// 1.21.0: Events has a profile per scenario too, so a scenario name with no product is an Events demo.
expect(args({ church: "hope", profile: "bold-plant" })).toBe(true);
expect(args({ church: "hope", product: "website", profile: "clean-campus", adminEmail: "jane@hope.test" })).toBe(false);
expect(args({ church: "hope", product: "accounts", profile: "small" })).toBe(false);
expect(agent.WEBSITE_DEMO_PROFILES).toHaveLength(8);
});
it("1.20.0: an App demo names the product and takes only an App profile, without an admin email", () => {
expect(agent.DEMO_PRODUCTS).toContain("app");
expect(args({ church: "demo2", product: "app", profile: "acacia-hill" })).toBe(true);
expect(args({ church: "demo2", product: "app", profile: "bold-plant" })).toBe(false);
expect(args({ church: "demo2", profile: "acacia-hill" })).toBe(false);
expect(args({ church: "demo2", product: "app", profile: "acacia-hill", adminEmail: "jane@hope.test" })).toBe(false);
expect(args({ church: "demo2", product: "app", profile: "community-family" })).toBe(true);
expect(args({ church: "demo2", product: "app", profile: "small" })).toBe(false);
expect(args({ church: "demo2", product: "app", profile: "acacia-hill" })).toBe(false);
expect(args({ church: "demo2", product: "app", profile: "community-family", adminEmail: "jane@hope.test" })).toBe(false);
});
});
describe("demo scenarios (1.21.0)", () => {
const args = (a: Record<string, unknown>) => agent.jobArgsSchemas["seed-demo"].safeParse(a).success;
it("has eight, one per Website demo profile, with unique churches", () => {
expect(agent.DEMO_SCENARIOS.map((s) => s.key)).toEqual([...agent.WEBSITE_DEMO_PROFILES]);
expect(new Set(agent.DEMO_SCENARIOS.map((s) => s.church)).size).toBe(8);
});
it("names only profiles each product has", () => {
for (const s of agent.DEMO_SCENARIOS) {
for (const product of agent.DEMO_SCENARIO_ORDER) {
expect(agent.DEMO_PROFILES_BY_PRODUCT[product]).toContain(s.profiles[product]);
}
}
});
it("loads Accounts first, every demo product once, each with a minimum release and agent", () => {
expect(agent.DEMO_SCENARIO_ORDER[0]).toBe("accounts");
expect([...agent.DEMO_SCENARIO_ORDER].sort()).toEqual([...agent.DEMO_PRODUCTS].sort());
for (const p of agent.DEMO_PRODUCTS) {
expect(agent.DEMO_SCENARIO_MIN_VERSIONS[p]).toMatch(/^\d+\.\d+\.\d+$/);
expect(agent.SEED_DEMO_MIN_AGENT_BY_PRODUCT[p]).toMatch(/^\d+\.\d+\.\d+$/);
}
});
it("covers the App's bands from 0–100 to 2 001–5 000", () => {
const bands = new Set(agent.DEMO_SCENARIOS.map((s) => s.appActiveMembers));
for (const b of ["0–100", "101–300", "301–750", "751–2 000", "2 001–5 000"] as const) expect(bands).toContain(b);
});
it("takes a scenario only with that scenario's profile for the product", () => {
expect(args({ church: "demo2", product: "accounts", profile: "clean-campus", scenario: "clean-campus" })).toBe(true);
expect(args({ church: "demo2", profile: "bold-youth", scenario: "bold-youth" })).toBe(true);
expect(args({ church: "demo2", product: "website", profile: "bold-plant", scenario: "bold-youth" })).toBe(false);
expect(args({ church: "demo2", profile: "events", scenario: "bold-youth" })).toBe(false);
expect(args({ church: "demo2", product: "app", profile: "bold-youth", scenario: "nowhere" })).toBe(false);
});
it("keeps Events' four single-product demos, and Accounts takes no admin email or Events profile", () => {
expect(args({ church: "hope", profile: "multicampus" })).toBe(true);
expect(args({ church: "hope", profile: "clean-modern" })).toBe(true);
expect(args({ church: "demo2", product: "accounts", profile: "small" })).toBe(false);
expect(args({ church: "demo2", product: "accounts", profile: "clean-modern", adminEmail: "jane@hope.test" })).toBe(false);
});
});