Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5e3a6bb6c | ||
|
|
2e8e4c04ca |
@@ -2,6 +2,23 @@
|
||||
|
||||
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
|
||||
|
||||
## agent@1.7.0 + contracts@1.23.0 + crosscode script - 2026-11-30
|
||||
|
||||
Church App 1.0.0 groundwork in the server agent (docs/APP-1.0-PLAN.md §12, "Demo scenarios").
|
||||
|
||||
- **Contracts 1.23.0:** the `seed-scenario` job (`church`, `scenario`, optional `adminEmail`; 45
|
||||
minutes): a whole demo scenario in one job, on whatever the church has installed.
|
||||
`SEED_SCENARIO_JOB_MIN_AGENT` (1.7.0). Additive.
|
||||
- **Agent 1.7.0:** `seed-scenario` → `crosscode demo <church> --scenario <s>`; `seed-demo` for `accounts` and `app` (`crosscode demo <church> <product> …`),
|
||||
and `scenario` passed on as `--scenario` for every product (contracts `SEED_SCENARIO_MIN_AGENT`,
|
||||
`SEED_APP_DEMO_MIN_AGENT`). Events' jobs keep their old form (no product).
|
||||
- **crosscode script:** `crosscode demo <church> --scenario <s>` (no product, no profile) loads the
|
||||
scenario on every product the church has here, in deploy order, skipping the others; checks
|
||||
every installed release against the scenario minimums first; each product takes its own
|
||||
backup; the first failure stops the rest and names what's out of step (`loaded`, `skipped` in
|
||||
the report). Events' demo is now `cmd_demo_events`. `crosscode demo <church> app …` says the
|
||||
App's demo comes with App 1.0.0, instead of misreading `app` as a second church.
|
||||
|
||||
## website@1.8.0 + crosscode script - 2026-11-30
|
||||
|
||||
Church App 1.0.0 groundwork in the Church Website (docs/APP-1.0-PLAN.md §12, "Demo scenarios"). No
|
||||
|
||||
@@ -13,6 +13,16 @@ Write for the person updating servers: what the agent can now do from the Hub, a
|
||||
contracts version needs it. The developer log is the commit history of apps/agent.
|
||||
-->
|
||||
|
||||
## 1.7.0
|
||||
|
||||
- **Demo scenarios.** The Hub (2.26.0 and later) can load a whole demo church on a demo client:
|
||||
Accounts first, then Cross Events, the Website and the App, the same church and people in each.
|
||||
It's one job: the server loads **whatever the client has installed** and skips the rest, so a
|
||||
client with only Accounts and the Website gets both. Every product's release is checked first
|
||||
(Accounts 1.9.0, Events 3.8.0, Website 1.8.0); if one fails part-way, the report says which
|
||||
products are out of step. The agent also runs single demo jobs for Accounts and (from App
|
||||
1.0.0) the Church App. Single-product demo data works as before.
|
||||
|
||||
## 1.6.0
|
||||
|
||||
- **Demo data for the Church Website.** The Hub (2.25.0 and later) can load one of the Website's
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/agent",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"private": true,
|
||||
"description": "The server agent: runs the crosscode script for signed jobs from Cross Code Hub, reports stats (docs/AGENT-1.0-PLAN.md)",
|
||||
"license": "UNLICENSED",
|
||||
|
||||
@@ -58,10 +58,20 @@ export function crosscodeArgs(job: agent.AgentJob, opts: { exportFile?: string }
|
||||
if (job.args.restart) out.push("--restart");
|
||||
return out;
|
||||
}
|
||||
case "seed-demo":
|
||||
case "seed-demo": {
|
||||
// 1.6.0: the Website's demo names the product; Events' (no product) keeps its old form.
|
||||
return ["demo", job.args.church, ...(job.args.product === "website" ? ["website"] : []), "--profile", job.args.profile,
|
||||
...(job.args.adminEmail ? ["--admin-email", job.args.adminEmail] : [])];
|
||||
// 1.7.0: the App's and Accounts' too, and a demo scenario passed on (`--scenario`), so each
|
||||
// product can tell a scenario load from a single one.
|
||||
const a = job.args;
|
||||
const product = a.product && a.product !== "events" ? [a.product] : [];
|
||||
return ["demo", a.church, ...product, "--profile", a.profile,
|
||||
...(a.scenario ? ["--scenario", a.scenario] : []),
|
||||
...(a.adminEmail ? ["--admin-email", a.adminEmail] : [])];
|
||||
}
|
||||
case "seed-scenario":
|
||||
// 1.7.0: a whole demo scenario. No product named: the script loads every product the church
|
||||
// has on this server, Accounts first, and skips the others.
|
||||
return ["demo", job.args.church, "--scenario", job.args.scenario, ...(job.args.adminEmail ? ["--admin-email", job.args.adminEmail] : [])];
|
||||
case "export":
|
||||
if (!opts.exportFile) throw new Error("export needs a file to write");
|
||||
return ["export", job.args.church, ...(job.args.products ?? []), "--out", opts.exportFile];
|
||||
|
||||
@@ -12,7 +12,7 @@ import { paths } from "./paths";
|
||||
* the tools that are there; anything missing is null rather than an error.
|
||||
*/
|
||||
|
||||
export const AGENT_VERSION = "1.6.0";
|
||||
export const AGENT_VERSION = "1.7.0";
|
||||
|
||||
function run(cmd: string, args: string[], timeoutMs = 10_000): Promise<string | null> {
|
||||
return new Promise((resolve) => {
|
||||
|
||||
@@ -52,6 +52,26 @@ describe("crosscode arguments for each job", () => {
|
||||
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", product: "events", profile: "small" } }))).toEqual(["demo", "hope", "--profile", "small"]);
|
||||
});
|
||||
|
||||
it("seed-scenario 1.7.0: one job, no product named, so the server seeds whatever the church has", () => {
|
||||
expect(crosscodeArgs(parsed({ type: "seed-scenario", args: { church: "demo2", scenario: "community-family" } }))).toEqual(["demo", "demo2", "--scenario", "community-family"]);
|
||||
expect(crosscodeArgs(parsed({ type: "seed-scenario", args: { church: "demo2", scenario: "bold-youth", adminEmail: "jane@hope.test" } })))
|
||||
.toEqual(["demo", "demo2", "--scenario", "bold-youth", "--admin-email", "jane@hope.test"]);
|
||||
expect(() => parsed({ type: "seed-scenario", args: { church: "demo2", scenario: "bold-youth", products: ["website"] } })).toThrow();
|
||||
});
|
||||
|
||||
it("seed-demo 1.7.0: the App's and Accounts' demos, and a scenario passed on to every product", () => {
|
||||
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", product: "app", profile: "community-family" } }))).toEqual(["demo", "hope", "app", "--profile", "community-family"]);
|
||||
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", product: "accounts", profile: "bold-youth", scenario: "bold-youth" } })))
|
||||
.toEqual(["demo", "hope", "accounts", "--profile", "bold-youth", "--scenario", "bold-youth"]);
|
||||
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", product: "website", profile: "clean-campus", scenario: "clean-campus" } })))
|
||||
.toEqual(["demo", "hope", "website", "--profile", "clean-campus", "--scenario", "clean-campus"]);
|
||||
// Events keeps its old form (no product), with the scenario and the admin kept.
|
||||
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", product: "events", profile: "bold-youth", scenario: "bold-youth", adminEmail: "jane@hope.test" } })))
|
||||
.toEqual(["demo", "hope", "--profile", "bold-youth", "--scenario", "bold-youth", "--admin-email", "jane@hope.test"]);
|
||||
// A scenario's profile must be the scenario's for that product (the contracts refuse the job).
|
||||
expect(() => parsed({ type: "seed-demo", args: { church: "hope", product: "website", profile: "bold-plant", scenario: "bold-youth" } })).toThrow();
|
||||
});
|
||||
|
||||
it("env-read and env-set (1.3.0): crosscode env, each value its own argument", () => {
|
||||
expect(crosscodeArgs(parsed({ type: "env-read", args: { church: "hope", product: "accounts" } }))).toEqual(["env", "hope", "accounts"]);
|
||||
expect(crosscodeArgs(parsed({
|
||||
|
||||
+24
-14
@@ -29,11 +29,11 @@ links with the Website and Cross Events, so the three feel like one church.
|
||||
|
||||
**Where things stand:** every earlier phase is released and rolled out, including the Church Website
|
||||
at Hope Family Church and a second church (confirmed by Joshua 2026-11-30). **Phase 6 progress
|
||||
(2026-11-30):** `contracts@1.20.0`, `1.21.0` and `1.22.0`, `accounts@1.9.0`, `events@3.8.0` and `website@1.8.0`
|
||||
released (not deployed yet), with the new shared package `@crosscode/demo` 1.1.0 (§12, "Demo scenarios").
|
||||
(2026-11-30):** `contracts@1.20.0` to `1.23.0`, `accounts@1.9.0`, `events@3.8.0`, `website@1.8.0` and
|
||||
`agent@1.7.0` released (not deployed yet), with the new shared package `@crosscode/demo` 1.1.0 (§12, "Demo scenarios").
|
||||
The Bible publishers' terms were checked ([BIBLE-PERMISSIONS.md](./BIBLE-PERMISSIONS.md)): 1.0
|
||||
uses only the free translations, the KJV and the Berean Standard Bible (decision 14, contracts 1.22.0).
|
||||
Next: `agent@1.7.0`, Hub `v2.26.0`, then `app@1.0.0` (§15).
|
||||
Next: Hub `v2.26.0`, then `app@1.0.0` (§15).
|
||||
|
||||
**Who uses 1.0:** the demo church (cross-demo2, Acacia Hill) first, then Hope Family Church. Then
|
||||
it goes on sale (crosscode-site, ROADMAP §9).
|
||||
@@ -41,7 +41,7 @@ it goes on sale (crosscode-site, ROADMAP §9).
|
||||
**Done when:**
|
||||
|
||||
- `app@1.0.0`, `contracts@1.20.0` (released 2026-11-30), `contracts@1.21.0` (released 2026-11-30), `contracts@1.22.0` (released 2026-11-30), `accounts@1.9.0`
|
||||
(released 2026-11-30), `events@3.8.0` (released 2026-11-30), `website@1.8.0` (released 2026-11-30), `agent@1.7.0` and Hub `v2.26.0` are tagged; the Hub installs
|
||||
(released 2026-11-30), `events@3.8.0` (released 2026-11-30), `website@1.8.0` (released 2026-11-30), `agent@1.7.0` (released 2026-11-30) 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").
|
||||
@@ -517,15 +517,24 @@ data that describes **the same church**, so a demo shows the three products work
|
||||
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.
|
||||
- **Agent 1.7.0** (released 2026-11-30): runs `crosscode demo <church> <product> --profile <p>
|
||||
[--scenario <s>]` for every product, so a product can tell a scenario load from a single one,
|
||||
and the whole scenario in **one `seed-scenario` job** (contracts 1.23.0, Joshua 2026-11-30):
|
||||
`crosscode demo <church> --scenario <s>` **seeds whatever the church has installed** on that
|
||||
server, Accounts first, then Events, the Website and the App, and skips the products it doesn't
|
||||
have (a client with only Accounts and the Website gets both). Every installed release is
|
||||
checked against `DEMO_SCENARIO_MIN_VERSIONS` before anything changes; the first failure stops
|
||||
the rest and names the products now out of step (the report's `loaded` and `skipped`).
|
||||
Each product also works without the others: the Website without Accounts uses the scenario's
|
||||
own church profile, without Events its own events; the App without Events its own events.
|
||||
- **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
|
||||
sends **one `seed-scenario` job** to the client's server (agent 1.7.0+). The server loads every
|
||||
product the client has there, **Accounts first** (profile and people), then **Events**, the
|
||||
**Website** and the **App**, skipping what isn't installed; a failure stops the rest and the
|
||||
report says which products are now out of step. The Website and the App fetch Events' feed as
|
||||
they load, and one email reports the job. 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).
|
||||
@@ -543,15 +552,16 @@ data that describes **the same church**, so a demo shows the three products work
|
||||
| `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` `packages/contracts` | The free translations only in 1.0 (`licence`, `FREE_BIBLE_TRANSLATION_IDS`, the CSV `translations` option), the Berean Standard Bible (`BSB`) added; the publishers' exact notices (`copyright`, `acknowledgement`, the Bible Society's `disclaimer`), `publisher` and `permissionsUrl`, `FREE_QUOTE_VERSES`, `quotedVerses`; `AFR83` named "Afrikaans 1983/1992-vertaling" | `contracts@1.22.0` (**released 2026-11-30**) |
|
||||
| `crosscode-platform` `packages/contracts` | `seed-scenario`: a whole demo scenario in one job, on whatever the church has installed (`SEED_SCENARIO_JOB_MIN_AGENT`) | `contracts@1.23.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` (**released 2026-11-30**) |
|
||||
| `crosscode-platform` `apps/events` | STOP stops all WhatsApp, passed to Accounts; the opt-out read from Accounts; a demo profile per scenario (its four kept) | `events@3.8.0` (**released 2026-11-30**) |
|
||||
| `crosscode-platform` `apps/website` | Demo profiles take the scenario's people and events (`--scenario`) | `website@1.8.0` (**released 2026-11-30**) |
|
||||
| `crosscode-platform` `apps/agent` | `seed-demo` for `app` and `accounts`, `--scenario` passed on | `agent@1.7.0` |
|
||||
| `crosscode-platform` `apps/agent` | `seed-demo` for `app` and `accounts`, `--scenario` passed on; `seed-scenario` (the whole scenario on what's installed) | `agent@1.7.0` (**released 2026-11-30**) |
|
||||
| `crosscode-platform` `packages/demo` | New: the scenarios' churches, people (`gender` from 1.1.0) and SVG logos | `@crosscode/demo` 1.1.0 (workspace, **released with Accounts 1.9.0 / Events 3.8.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 in the free translations, the endpoint for Apps), **Load a demo scenario** on a demo client (vendored contracts 1.22.0) | 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 in the free translations, the endpoint for Apps), **Load a demo scenario** on a demo client (one `seed-scenario` job; vendored contracts 1.23.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
|
||||
@@ -591,8 +601,8 @@ data that describes **the same church**, so a demo shows the three products work
|
||||
WhatsApp opt-out) and `events@3.8.0` (STOP passed to Accounts), **both released 2026-11-30**,
|
||||
rolled out to every church (not yet).
|
||||
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` (**released 2026-11-30**), and `agent@1.7.0`.
|
||||
3. Hub `v2.26.0` (vendored contracts 1.22.0) deployed, and the first 3 months of Cross Code
|
||||
3.8.0, `website@1.8.0` and `agent@1.7.0` (**both released 2026-11-30**).
|
||||
3. Hub `v2.26.0` (vendored contracts 1.23.0) deployed, and the first 3 months of Cross Code
|
||||
devotionals written or imported, in the KJV or BSB (decision 14).
|
||||
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
|
||||
|
||||
+14
-8
@@ -35,12 +35,12 @@ every release).
|
||||
| 4 | Cross Events 3.0.0: sign-in through Accounts | **Released, rolled out and tested** (`events@3.7.2` rolled out; `3.8.0` released 2026-11-30 for phase 6, not deployed; [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md)). Churches sign in through their Accounts; crosscode-site `v1.6.0` deployed |
|
||||
| 4+ | Running it: jobs from the dashboard, styled emails, .env from the Hub, sign-in health, the nightly people check; then frp config and one-product uninstalls, and the Hub's popups, pickers and port list | **Released, deployed and tested** 2026-11-20 and 2026-11-23 (below) |
|
||||
| 5 | Church Website 1.0.0 | **Released 2026-11-26** (planned 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md), all decisions confirmed). Font pairings confirmed 2026-11-24, section variants per template 2026-11-25 (§3). `contracts@1.17.0`, `accounts@1.7.0` and `events@3.7.0` released 2026-11-24, Hub `v2.21.0` 2026-11-25 (the Hub deployed 2026-11-25; the others not rolled out yet). `contracts@1.18.0` and Hub `v2.22.0` (Get more storage) released 2026-11-25, the Hub deployed 2026-11-26. **`website@1.0.0` and `1.0.1` released 2026-11-26**, crosscode-site `v1.7.0` (the Website on sale) released 2026-11-26. **Done** (confirmed by Joshua 2026-11-30): crosscode-site deployed, Hope Family Church and a second church live, the remaining release checks finished. Now `website@1.8.0` (VERSIONS.md) |
|
||||
| 6 | Church App 1.0.0 | **Under way** (planned and started 2026-11-30): [APP-1.0-PLAN.md](./APP-1.0-PLAN.md), decisions confirmed 2026-11-30 (decision 13, the demo scenarios, added the same day); mockup on the Design canvas "Church App 1.0 mockup". Released 2026-11-30, not deployed: `contracts@1.20.0`, `1.21.0` and `1.22.0`, `accounts@1.9.0`, `events@3.8.0`, `website@1.8.0` (below). Next: agent 1.7.0, Hub 2.26.0, `app@1.0.0` |
|
||||
| 6 | Church App 1.0.0 | **Under way** (planned and started 2026-11-30): [APP-1.0-PLAN.md](./APP-1.0-PLAN.md), decisions confirmed 2026-11-30 (decision 13, the demo scenarios, added the same day); mockup on the Design canvas "Church App 1.0 mockup". Released 2026-11-30, not deployed: `contracts@1.20.0` to `1.23.0`, `accounts@1.9.0`, `events@3.8.0`, `website@1.8.0`, `agent@1.7.0` (below). Next: Hub 2.26.0, `app@1.0.0` |
|
||||
| 7 | App 1.x | Not started |
|
||||
|
||||
## Released 2026-11-30 (phase 6, first steps)
|
||||
|
||||
Tagged and pushed on 2026-11-30, **not deployed yet** (Accounts and Events have one migration each; the Website none). Details in
|
||||
Tagged and pushed on 2026-11-30, **not deployed yet** (Accounts and Events have one migration each; the Website and the agent none). Details in
|
||||
[VERSIONS.md](./VERSIONS.md), [CHANGELOG.md](../CHANGELOG.md) and the apps' CHANGELOGs.
|
||||
|
||||
| Release | What |
|
||||
@@ -50,6 +50,7 @@ Tagged and pushed on 2026-11-30, **not deployed yet** (Accounts and Events have
|
||||
| `accounts@1.9.0`, `@crosscode/demo` 1.0.0 | `messaging.get` for the App; the WhatsApp opt-out for every product (STOP kept per number and account, Accounts' own WAWP webhook, "Turn WhatsApp back on"); a scenario's church profile, SVG logo and icon, and people (`crosscode demo <church> accounts --profile <scenario>`) |
|
||||
| `contracts@1.22.0` | Only free Bible translations in 1.0 (KJV and the new BSB: `licence`, `FREE_BIBLE_TRANSLATION_IDS`, the CSV `translations` option); the publishers' exact notices (NLT, ESV and the Afrikaans ones were out of date), the Bible Society's disclaimer, an `acknowledgement` per translation, who to ask, `FREE_QUOTE_VERSES` and `quotedVerses` ([BIBLE-PERMISSIONS.md](./BIBLE-PERMISSIONS.md)) |
|
||||
| `events@3.8.0`, `@crosscode/demo` 1.1.0 | STOP stops all WhatsApp (not only news), checked before every message and passed on to Accounts; the eight scenarios as Events demo profiles, around each church's own people and campuses |
|
||||
| `contracts@1.23.0`, `agent@1.7.0` | `seed-scenario`: a whole demo scenario in one job, on whatever the church has installed (Accounts first, the rest skipped, every release checked first); `seed-demo` for Accounts and the App, and `--scenario` passed on to every product |
|
||||
| `website@1.8.0` | A profile loaded with `--scenario` takes the scenario's people as its leaders and, with a linked Cross Events, shows Events' events through the feed instead of its own; `crosscode demo <church> website --scenario`; `packages/demo` built with the Website. No migration |
|
||||
|
||||
All four were checked on PostgreSQL 18 (local, details in `temp/`, never committed): migrations,
|
||||
@@ -118,8 +119,8 @@ Family Church and a second church are live on the Website, crosscode-site sells
|
||||
Joshua 2026-11-30; VERSIONS.md, "Deployed / rolled out").
|
||||
|
||||
1. **Phase 6, Church App 1.0.0** (ROADMAP §7, §9), [APP-1.0-PLAN.md](./APP-1.0-PLAN.md) §15.
|
||||
**Done 2026-11-30 (released, not deployed):** contracts 1.20.0, 1.21.0 and 1.22.0, Accounts
|
||||
1.9.0, Events 3.8.0, Website 1.8.0. The Bible publishers' terms checked: none covers a sold app, so **1.0 uses only the
|
||||
**Done 2026-11-30 (released, not deployed):** contracts 1.20.0 to 1.23.0, Accounts
|
||||
1.9.0, Events 3.8.0, Website 1.8.0, agent 1.7.0. The Bible publishers' terms checked: none covers a sold app, so **1.0 uses only the
|
||||
free translations, the KJV and the Berean Standard Bible** (APP-1.0-PLAN decision 14); the
|
||||
permission requests for the others are drafted in [BIBLE-PERMISSIONS.md](./BIBLE-PERMISSIONS.md)
|
||||
for later, and nothing waits for them. **Next:**
|
||||
@@ -127,10 +128,15 @@ Joshua 2026-11-30; VERSIONS.md, "Deployed / rolled out").
|
||||
`--scenario` takes the scenario's people as leaders (`scenarioTeam` in `src/demo/seeds.ts`)
|
||||
and, with a linked Cross Events, shows Events' events through the feed; `crosscode demo
|
||||
<church> website --scenario`; the Website builds `packages/demo`.
|
||||
2. **Agent 1.7.0:** `seed-demo` for `app` and `accounts`, `--scenario` passed on
|
||||
(`SEED_SCENARIO_MIN_AGENT`; bump `AGENT_VERSION` too).
|
||||
3. **Hub 2.26.0** (vendored contracts 1.22.0): the App in New install and releases, billing on
|
||||
the active-member band, **Load a demo scenario** on a demo client, the **Devotionals** page
|
||||
2. ~~**Agent 1.7.0**~~ and **contracts 1.23.0**: **released 2026-11-30** (not rolled out).
|
||||
`seed-demo` for `app` and `accounts`, `--scenario` passed on; the new `seed-scenario` job
|
||||
(`crosscode demo <church> --scenario <s>`) loads the scenario on every product the church
|
||||
has installed, skipping the rest, every release checked first; `crosscode demo <church> app` refused clearly until
|
||||
App 1.0.0 brings `scripts/products/app.sh` and the App's demo.
|
||||
3. **Hub 2.26.0** (vendored contracts 1.23.0): the App in New install and releases, billing on
|
||||
the active-member band, **Load a demo scenario** on a demo client (one `seed-scenario` job,
|
||||
agent 1.7.0+: the server seeds whatever the client has installed, Accounts first; show the
|
||||
report's `loaded` / `skipped`), the **Devotionals** page
|
||||
(3 months ahead, Import CSV, the free translations only: KJV and BSB) and
|
||||
`GET /api/v2/devotionals`. Then write or import the first 3
|
||||
months of Cross Code devotionals.
|
||||
|
||||
+11
-3
@@ -13,11 +13,11 @@ separately below; the two often differ.
|
||||
| Cross Events | `crosscode-platform` (`apps/events`) | **3.8.0** | `events@3.8.0` | 2026-11-30 |
|
||||
| Church Website | `crosscode-platform` (`apps/website`) | **1.8.0** | `website@1.8.0` | 2026-11-30 |
|
||||
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.9.0** | `accounts@1.9.0` | 2026-11-30 |
|
||||
| Server agent | `crosscode-platform` (`apps/agent`) | **1.6.0** | `agent@1.6.0` | 2026-11-27 |
|
||||
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.22.0** | `contracts@1.22.0` | 2026-11-30 |
|
||||
| Server agent | `crosscode-platform` (`apps/agent`) | **1.7.0** | `agent@1.7.0` | 2026-11-30 |
|
||||
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.23.0** | `contracts@1.23.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-30 (last change: `--scenario` passed on to the Website's demo, the Website builds `packages/demo`; before that Events takes the demo scenarios as profiles, `crosscode demo <church> accounts`, Accounts and Events build `packages/demo`) |
|
||||
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-30 (last change: `crosscode demo <church> --scenario <s>` loads a whole scenario on whatever is installed; `crosscode demo <church> app` refused clearly until App 1.0.0; `--scenario` passed on to the Website's demo, the Website builds `packages/demo`; before that Events takes the demo scenarios as profiles, `crosscode demo <church> accounts`, Accounts and Events build `packages/demo`) |
|
||||
|
||||
The `crosscode` script has no version: every server's copy (`/opt/crosscode/tools`) pulls `main`
|
||||
on each run, so merging to `main` and pushing releases it. Its changes are listed in
|
||||
@@ -39,6 +39,14 @@ need their own tags until something outside this repo depends on them.
|
||||
|
||||
## What each latest release was for
|
||||
|
||||
- **Server agent 1.7.0 + contracts 1.23.0 + crosscode script (2026-11-30):** demo scenarios
|
||||
(APP-1.0-PLAN §12): the `seed-scenario` job, one per scenario load, which the server runs on
|
||||
**whatever the client has installed** (Accounts first, the rest skipped, every release checked
|
||||
first, the first failure naming what's out of step); `seed-demo` for Accounts and the App, and
|
||||
`--scenario` passed on to every product. For the Hub 2.26.0's **Load a demo scenario** (it
|
||||
vendors contracts 1.23.0). Checked: contracts (340), the agent's tests (60, the two version
|
||||
numbers match), the script's demo bats (21), `npm run check`. Not rolled out yet (Update
|
||||
agent from the Hub).
|
||||
- **Church Website 1.8.0 + crosscode script (2026-11-30):** demo scenarios (APP-1.0-PLAN §12): a
|
||||
profile loaded with `--scenario` takes the scenario's people as its leaders (the pastor first,
|
||||
each with a portrait chosen for them) and, with a linked Cross Events, shows Events' events
|
||||
|
||||
Generated
+2
-2
@@ -115,7 +115,7 @@
|
||||
},
|
||||
"apps/agent": {
|
||||
"name": "@crosscode/agent",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
@@ -23192,7 +23192,7 @@
|
||||
},
|
||||
"packages/contracts": {
|
||||
"name": "@crosscode/contracts",
|
||||
"version": "1.22.0",
|
||||
"version": "1.23.0",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"zod": "^4.6.7"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/contracts",
|
||||
"version": "1.22.0",
|
||||
"version": "1.23.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",
|
||||
|
||||
@@ -914,6 +914,121 @@
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"const": "crosscode.agent-job/1"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^job_[A-Za-z0-9_-]{8,64}$"
|
||||
},
|
||||
"serverId": {
|
||||
"type": "string",
|
||||
"pattern": "^srv_[A-Za-z0-9_-]{8,64}$"
|
||||
},
|
||||
"config": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"alg": {
|
||||
"type": "string",
|
||||
"const": "x25519-hkdf-sha256-aes-256-gcm"
|
||||
},
|
||||
"epk": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-Za-z0-9_-]{43}$"
|
||||
},
|
||||
"iv": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-Za-z0-9_-]{16}$"
|
||||
},
|
||||
"ciphertext": {
|
||||
"type": "string",
|
||||
"maxLength": 200000,
|
||||
"pattern": "^[A-Za-z0-9_-]+$"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"alg",
|
||||
"epk",
|
||||
"iv",
|
||||
"ciphertext"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"notBefore": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
|
||||
},
|
||||
"expiresAt": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
|
||||
},
|
||||
"signature": {
|
||||
"type": "string",
|
||||
"pattern": "^[A-Za-z0-9_-]{86}$"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "seed-scenario"
|
||||
},
|
||||
"args": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"church": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9-]{1,30}$"
|
||||
},
|
||||
"scenario": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"heritage-parish",
|
||||
"heritage-city",
|
||||
"bold-youth",
|
||||
"bold-plant",
|
||||
"community-family",
|
||||
"community-town",
|
||||
"clean-modern",
|
||||
"clean-campus"
|
||||
]
|
||||
},
|
||||
"adminEmail": {
|
||||
"type": "string",
|
||||
"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,}$"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"church",
|
||||
"scenario"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"schema",
|
||||
"id",
|
||||
"serverId",
|
||||
"notBefore",
|
||||
"expiresAt",
|
||||
"signature",
|
||||
"type",
|
||||
"args"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"adopt-undo",
|
||||
"restart",
|
||||
"seed-demo",
|
||||
"seed-scenario",
|
||||
"env-read",
|
||||
"env-set",
|
||||
"export",
|
||||
|
||||
@@ -203,6 +203,9 @@ 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";
|
||||
|
||||
/** 1.23.0: the first agent that runs `seed-scenario` jobs (a whole scenario on whatever the church has installed). */
|
||||
export const SEED_SCENARIO_JOB_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,
|
||||
@@ -305,6 +308,17 @@ export const jobArgsSchemas = {
|
||||
ctx.addIssue({ code: "custom", path: ["profile"], message: `the ${a.scenario} scenario loads ${demoScenario(a.scenario).profiles[product]} in ${DEMO_PRODUCT_NAMES[product]}` });
|
||||
}
|
||||
}),
|
||||
/**
|
||||
* 1.23.0: `crosscode demo <church> --scenario <s> [--admin-email <email>] --json`: a whole demo
|
||||
* scenario in one job, on **every product the church has on that server**, in
|
||||
* `DEMO_SCENARIO_ORDER` (Accounts first); products it doesn't have are skipped, so a demo client
|
||||
* with only Accounts and the Website gets both. The script checks every installed product's
|
||||
* release (`DEMO_SCENARIO_MIN_VERSIONS`) before changing anything, and stops at the first
|
||||
* failure, naming the products now out of step. The report's `result`: `loaded` and `skipped`
|
||||
* (products, space-separated). `adminEmail`: Events' account kept, as in `seed-demo`.
|
||||
* Agent 1.7.0+ (`SEED_SCENARIO_JOB_MIN_AGENT`).
|
||||
*/
|
||||
"seed-scenario": z.strictObject({ church: shortNameSchema, scenario: demoScenarioSchema, adminEmail: z.email().max(254).optional() }),
|
||||
/**
|
||||
* `crosscode env <church> <product> --json`: the product's .env values, secrets hidden (only
|
||||
* whether they're set). The report's `result` is an {@link envReadResultSchema}.
|
||||
@@ -380,7 +394,7 @@ export const CENTRAL_JOB_TYPES: readonly JobType[] = ["check-ports", "status", "
|
||||
|
||||
/** Time limits per job type, in minutes (§3). A job past it is stopped and reported as failed. */
|
||||
export const JOB_TIME_LIMIT_MINUTES: Record<JobType, number> = {
|
||||
install: 30, "add-product": 30, deploy: 20, adopt: 30, "adopt-undo": 15, restart: 5, "seed-demo": 15, "env-read": 2, "env-set": 20, export: 20,
|
||||
install: 30, "add-product": 30, deploy: 20, adopt: 30, "adopt-undo": 15, restart: 5, "seed-demo": 15, "seed-scenario": 45, "env-read": 2, "env-set": 20, export: 20,
|
||||
uninstall: 20, purge: 10, "update-agent": 15, "check-ports": 2, status: 3,
|
||||
"frp-read": 2, "frp-write": 5, "probe-ports": 2,
|
||||
};
|
||||
@@ -425,7 +439,7 @@ function jobOf<T extends JobType>(type: T) {
|
||||
}
|
||||
|
||||
export const agentJobSchema = z.discriminatedUnion("type", [
|
||||
jobOf("install"), jobOf("add-product"), jobOf("deploy"), jobOf("adopt"), jobOf("adopt-undo"), jobOf("restart"), jobOf("seed-demo"),
|
||||
jobOf("install"), jobOf("add-product"), jobOf("deploy"), jobOf("adopt"), jobOf("adopt-undo"), jobOf("restart"), jobOf("seed-demo"), jobOf("seed-scenario"),
|
||||
jobOf("env-read"), jobOf("env-set"), jobOf("export"), jobOf("uninstall"), jobOf("purge"), jobOf("update-agent"), jobOf("check-ports"), jobOf("status"),
|
||||
jobOf("frp-read"), jobOf("frp-write"), jobOf("probe-ports"),
|
||||
]);
|
||||
|
||||
@@ -230,6 +230,23 @@ describe("demo scenarios (1.21.0)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("seed-scenario jobs (1.23.0)", () => {
|
||||
const args = (a: Record<string, unknown>) => agent.jobArgsSchemas["seed-scenario"].safeParse(a).success;
|
||||
|
||||
it("takes a church and a scenario (the products are whatever the church has installed)", () => {
|
||||
expect(args({ church: "demo2", scenario: "community-family" })).toBe(true);
|
||||
expect(args({ church: "demo2", scenario: "community-family", adminEmail: "jane@hope.test" })).toBe(true);
|
||||
expect(args({ church: "demo2", scenario: "nowhere" })).toBe(false);
|
||||
expect(args({ church: "demo2" })).toBe(false);
|
||||
expect(args({ church: "demo2", scenario: "bold-youth", products: ["website"] })).toBe(false);
|
||||
expect(args({ church: "demo2", scenario: "bold-youth", adminEmail: "x; rm -rf /" })).toBe(false);
|
||||
expect(agent.JOB_TYPES).toContain("seed-scenario");
|
||||
expect(agent.CENTRAL_JOB_TYPES).not.toContain("seed-scenario");
|
||||
expect(agent.JOB_TIME_LIMIT_MINUTES["seed-scenario"]).toBeGreaterThanOrEqual(agent.JOB_TIME_LIMIT_MINUTES["seed-demo"] * 3);
|
||||
expect(agent.SEED_SCENARIO_JOB_MIN_AGENT).toBe("1.7.0");
|
||||
});
|
||||
});
|
||||
|
||||
describe("env-read and env-set jobs (1.12.0)", () => {
|
||||
const set = (a: Record<string, unknown>) => agent.jobArgsSchemas["env-set"].safeParse({ church: "hope", product: "events", file: "backend/.env", set: {}, unset: [], restart: true, ...a });
|
||||
it("read one product", () => {
|
||||
|
||||
+86
-2
@@ -24,6 +24,12 @@ crosscode demo <church> accounts --profile <scenario> [--scenario <scenario>]
|
||||
people in Accounts (the eight scenarios, as the
|
||||
Website's profiles); a backup is taken first;
|
||||
real people and admins stay
|
||||
crosscode demo <church> --scenario <scenario> [--admin-email <email>]
|
||||
a whole demo scenario on every product the church
|
||||
has here, Accounts first (then Events, the Website,
|
||||
the App); products it doesn't have are skipped.
|
||||
Every release is checked first; it stops at the
|
||||
first failure and says what's out of step
|
||||
crosscode env <church> <product> the product's .env values (secrets hidden)
|
||||
crosscode env <church> <product> [--file backend/.env] --set NAME=value … [--unset NAME …] [--restart]
|
||||
change values (a copy is kept; never secrets or
|
||||
@@ -110,8 +116,10 @@ DEMO_SCENARIOS="$WEBSITE_DEMO_PROFILES"
|
||||
# `crosscode demo <church> website --profile <p>`: the Website's content instead (cmd_demo_website).
|
||||
# `crosscode demo <church> accounts --profile <scenario>`: a scenario's church and people (cmd_demo_accounts).
|
||||
# `--scenario <s>` (agent 1.7.0): part of loading that scenario; the profile must be the scenario's.
|
||||
# `--scenario <s>` with no product and no profile (the Hub's seed-scenario job): the whole scenario
|
||||
# on every product the church has (cmd_demo_scenario).
|
||||
cmd_demo() {
|
||||
local church="" product="events" profile="" email="" scenario="" dir user app
|
||||
local church="" product="" profile="" email="" scenario=""
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--profile) [ $# -ge 2 ] || die "--profile needs a value."; profile="$2"; shift 2 ;;
|
||||
@@ -119,16 +127,25 @@ cmd_demo() {
|
||||
--scenario) [ $# -ge 2 ] || die "--scenario needs a value."; scenario="$2"; shift 2 ;;
|
||||
-h|--help) manage_usage; return 0 ;;
|
||||
-*) die "Unknown option $1 (crosscode help demo)." ;;
|
||||
events|website|accounts) [ -n "$church" ] || die "Name the church first (crosscode demo hope website …)."; product="$1"; shift ;;
|
||||
events|website|accounts|app) [ -n "$church" ] || die "Name the church first (crosscode demo hope website …)."; product="$1"; shift ;;
|
||||
*) [ -z "$church" ] || die "One church at a time."; church="$1"; shift ;;
|
||||
esac
|
||||
done
|
||||
[ -n "$church" ] || die "Name the church."
|
||||
if [ -n "$scenario" ] && [ -z "$product" ] && [ -z "$profile" ]; then
|
||||
[[ " $DEMO_SCENARIOS " == *" $scenario "* ]] || die "--scenario: one of $DEMO_SCENARIOS."
|
||||
[ -z "$email" ] || [[ "$email" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$ ]] || die "--admin-email: not an email address."
|
||||
cmd_demo_scenario "$church" "$scenario" "$email"
|
||||
return
|
||||
fi
|
||||
product="${product:-events}"
|
||||
if [ -n "$scenario" ]; then
|
||||
[[ " $DEMO_SCENARIOS " == *" $scenario "* ]] || die "--scenario: one of $DEMO_SCENARIOS."
|
||||
# Every product loads the profile named after the scenario (contracts DEMO_SCENARIOS).
|
||||
[ "$profile" = "$scenario" ] || die "--scenario $scenario loads the $scenario profile in $product, not $profile."
|
||||
fi
|
||||
# Agent 1.7.0 sends the App's demo jobs; the App and its demo come with App 1.0.0.
|
||||
[ "$product" != app ] || die "The Church App's demo data comes with App 1.0.0 (this crosscode has none yet)."
|
||||
if [ "$product" = accounts ]; then
|
||||
[[ " $DEMO_SCENARIOS " == *" $profile "* ]] || die "--profile: one of $DEMO_SCENARIOS."
|
||||
[ -z "$email" ] || die "--admin-email: Accounts' demo keeps every admin."
|
||||
@@ -143,6 +160,12 @@ cmd_demo() {
|
||||
fi
|
||||
[[ " $DEMO_PROFILES " == *" $profile "* ]] || die "--profile: one of $DEMO_PROFILES."
|
||||
[ -z "$email" ] || [[ "$email" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$ ]] || die "--admin-email: not an email address."
|
||||
cmd_demo_events "$church" "$profile" "$email"
|
||||
}
|
||||
|
||||
# Events' demo data (set-demo.js): backup, the profile as the site's user, reload.
|
||||
cmd_demo_events() {
|
||||
local church="$1" profile="$2" email="${3:-}" dir user app
|
||||
require_root
|
||||
load_church "$church"
|
||||
church_has_product events || die "$church has no Cross Events."
|
||||
@@ -170,6 +193,67 @@ cmd_demo() {
|
||||
die "Events didn't answer after the reload (sudo -u $user pm2 logs)."
|
||||
}
|
||||
|
||||
# The first release of each product that loads a demo scenario (contracts DEMO_SCENARIO_MIN_VERSIONS).
|
||||
scenario_min_version() {
|
||||
case "$1" in accounts) echo 1.9.0 ;; events) echo 3.8.0 ;; website) echo 1.8.0 ;; app) echo 1.0.0 ;; esac
|
||||
}
|
||||
|
||||
product_title() {
|
||||
case "$1" in accounts) echo Accounts ;; events) echo "Cross Events" ;; website) echo "The Website" ;; app) echo "The App" ;; *) echo "$1" ;; esac
|
||||
}
|
||||
|
||||
# A whole demo scenario (contracts seed-scenario, agent 1.7.0): every product the church has on this
|
||||
# server, in deploy order (Accounts first: the others read its profile and people; Events before the
|
||||
# Website and the App, which show its events through the feed). Products it doesn't have are
|
||||
# skipped, so a client with only Accounts and the Website gets both. Every product's release is
|
||||
# checked before anything changes; each product takes its own backup; the first failure stops the
|
||||
# rest and says which products are now out of step.
|
||||
cmd_demo_scenario() {
|
||||
local church="$1" scenario="$2" email="${3:-}" p q v min seen
|
||||
local -a todo=() skipped=() loaded=() behind=()
|
||||
require_root
|
||||
load_church "$church"
|
||||
for p in "${PRODUCT_ORDER[@]}"; do
|
||||
if church_has_product "$p"; then todo+=("$p"); else skipped+=("$p"); fi
|
||||
done
|
||||
[ "${#todo[@]}" -gt 0 ] || die "$church has no products on this server."
|
||||
|
||||
step "Demo scenario $scenario: checking ${todo[*]}"
|
||||
[ "${#skipped[@]}" -eq 0 ] || info "Not installed, so skipped: ${skipped[*]}"
|
||||
for p in "${todo[@]}"; do
|
||||
# The App and its demo come with App 1.0.0 (scripts/products/app.sh).
|
||||
[ "$p" != app ] || die "The Church App's demo data comes with App 1.0.0 (this crosscode has none yet). Nothing was changed."
|
||||
# shellcheck source=/dev/null
|
||||
source "$CROSSCODE_HOME/products/$p.sh"
|
||||
v="$("${p}_expected_version" "$(pvar "$p" DIR)" 2>/dev/null || true)"
|
||||
min="$(scenario_min_version "$p")"
|
||||
version_ge "${v:-0.0.0}" "$min" ||
|
||||
die "$(product_title "$p") is ${v:-unknown} here: a demo scenario needs $min or later. Deploy it first; nothing was changed."
|
||||
done
|
||||
|
||||
for p in "${todo[@]}"; do
|
||||
# Each in a subshell: its die stops only that product, so the summary below can say what's
|
||||
# out of step.
|
||||
if ! (
|
||||
case "$p" in
|
||||
accounts) cmd_demo_accounts "$church" "$scenario" ;;
|
||||
events) cmd_demo_events "$church" "$scenario" "$email" ;;
|
||||
website) cmd_demo_website "$church" "$scenario" "$scenario" ;;
|
||||
esac
|
||||
); then
|
||||
seen=0
|
||||
for q in "${todo[@]}"; do [ "$q" = "$p" ] && seen=1; [ "$seen" = 1 ] && behind+=("$q"); done
|
||||
report_result loaded "${loaded[*]}"
|
||||
report_result skipped "${skipped[*]}"
|
||||
die "$(product_title "$p")'s demo failed (see above), so the scenario stopped. Loaded: ${loaded[*]:-none}. Out of step with $scenario: ${behind[*]}. Load the scenario again once it's fixed."
|
||||
fi
|
||||
loaded+=("$p")
|
||||
done
|
||||
report_result loaded "${loaded[*]}"
|
||||
report_result skipped "${skipped[*]}"
|
||||
step "Demo scenario $scenario loaded: ${loaded[*]}${skipped[*]:+ (not installed: ${skipped[*]})}"
|
||||
}
|
||||
|
||||
# Accounts' part of a demo scenario (Accounts 1.9.0+, backend/scripts/demo.ts): the scenario's
|
||||
# church profile (with its logo and icon) and its people; real people and admins stay. Backup first;
|
||||
# Accounts tells the linked products the church changed. Loaded before the other products'.
|
||||
|
||||
+59
-5
@@ -26,29 +26,30 @@ accounts_app() { printf '%s/apps/accounts' "\$1"; }
|
||||
accounts_backup() { echo "backup \$2" >> "$CALLS"; [ -z "\${FAIL_BACKUP:-}" ]; }
|
||||
accounts_reload() { echo "reload \$2" >> "$CALLS"; }
|
||||
accounts_health_url() { echo http://127.0.0.1:5200/api/health; }
|
||||
accounts_expected_version() { echo 1.9.0; }
|
||||
accounts_expected_version() { echo \${ACCOUNTS_VERSION:-1.9.0}; }
|
||||
EOF3
|
||||
cat > "$CROSSCODE_HOME/products/website.sh" <<EOF2
|
||||
website_app() { printf '%s/apps/website' "\$1"; }
|
||||
website_backup() { echo "backup \$2" >> "$CALLS"; [ -z "\${FAIL_BACKUP:-}" ]; }
|
||||
website_reload() { echo "reload \$2" >> "$CALLS"; }
|
||||
website_health_url() { echo http://127.0.0.1:5300/api/health; }
|
||||
website_expected_version() { echo 1.3.0; }
|
||||
website_expected_version() { echo \${WEBSITE_VERSION:-1.3.0}; }
|
||||
EOF2
|
||||
cat > "$CROSSCODE_HOME/products/events.sh" <<EOF
|
||||
events_app() { printf '%s/apps/events' "\$1"; }
|
||||
events_backup() { echo "backup \$2" >> "$CALLS"; [ -z "\${FAIL_BACKUP:-}" ]; }
|
||||
events_reload() { echo "reload \$2" >> "$CALLS"; }
|
||||
events_health_url() { echo http://127.0.0.1:20001/health; }
|
||||
events_expected_version() { echo 2.4.1; }
|
||||
events_expected_version() { echo \${EVENTS_VERSION:-2.4.1}; }
|
||||
EOF
|
||||
require_root() { :; }
|
||||
load_church() { [ "$1" = hope ] || die "There's no church $1 here."; }
|
||||
church_has_product() { [ "$1" = events ] || [ "$1" = website ] || [ "$1" = accounts ]; }
|
||||
HAS="${HAS:-events website accounts}"
|
||||
church_has_product() { [[ " $HAS " == *" $1 "* ]]; }
|
||||
pvar() { case "$2" in DIR) echo "$TMP/sites/hope/$1" ;; USER) echo "cc-hope-$1" ;; esac; }
|
||||
checkout_ref() { echo "$2@1.0.0"; }
|
||||
wait_for_version() { echo "wait $2" >> "$CALLS"; }
|
||||
run_as() { local user="$1" dir="$2"; shift 2; echo "run $user ${dir#"$TMP"/} $*" >> "$CALLS"; [ -z "${FAIL_SEED:-}" ]; }
|
||||
run_as() { local user="$1" dir="$2"; shift 2; echo "run $user ${dir#"$TMP"/} $*" >> "$CALLS"; [ -z "${FAIL_SEED:-}" ] && [ "$user" != "${FAIL_USER:-}" ]; }
|
||||
}
|
||||
|
||||
@test "the profile and admin email are checked before anything else" {
|
||||
@@ -171,6 +172,13 @@ wait 1.9.0" ]
|
||||
[[ "$(cat "$CALLS")" == *"demo -- --profile bold-youth --force"* ]]
|
||||
}
|
||||
|
||||
@test "the App's demo (agent 1.7.0 sends it) is refused clearly until App 1.0.0" {
|
||||
run cmd_demo hope app --profile community-family --scenario community-family
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"comes with App 1.0.0"* ]]
|
||||
[ ! -s "$CALLS" ]
|
||||
}
|
||||
|
||||
@test "a failed Accounts demo isn't followed by a reload" {
|
||||
FAIL_SEED=1 run cmd_demo hope accounts --profile clean-modern
|
||||
[ "$status" -eq 1 ]
|
||||
@@ -182,3 +190,49 @@ wait 1.9.0" ]
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$(cat "$CALLS")" == *"node scripts/set-demo.js --profile=clean-campus --yes"* ]]
|
||||
}
|
||||
|
||||
@test "seed-scenario: only Accounts and the Website installed, both loaded in order, the rest skipped" {
|
||||
HAS="accounts website" WEBSITE_VERSION=1.8.0 run cmd_demo hope --scenario bold-youth
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(grep '^run' "$CALLS")" = "run cc-hope-accounts sites/hope/accounts/apps/accounts/backend npm run --silent demo -- --profile bold-youth --force
|
||||
run cc-hope-website sites/hope/website/apps/website/backend npm run --silent demo -- --profile bold-youth --scenario bold-youth --force" ]
|
||||
[[ "$output" == *"Not installed, so skipped: events app"* ]]
|
||||
[[ "$(cat "$CALLS")" != *"cc-hope-events"* ]]
|
||||
}
|
||||
|
||||
@test "seed-scenario: every product the church has, Accounts, Events, then the Website" {
|
||||
EVENTS_VERSION=3.8.0 WEBSITE_VERSION=1.8.0 run cmd_demo hope --scenario clean-campus --admin-email jane@hope.test
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(grep '^run' "$CALLS" | cut -d' ' -f2)" = "cc-hope-accounts
|
||||
cc-hope-events
|
||||
cc-hope-website" ]
|
||||
[[ "$(cat "$CALLS")" == *"DEMO_ADMIN_EMAIL=jane@hope.test node scripts/set-demo.js --profile=clean-campus --yes"* ]]
|
||||
}
|
||||
|
||||
@test "seed-scenario: a release too old for scenarios stops it before anything changes" {
|
||||
EVENTS_VERSION=3.7.2 WEBSITE_VERSION=1.8.0 run cmd_demo hope --scenario bold-plant
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"Cross Events is 3.7.2 here: a demo scenario needs 3.8.0 or later"* ]]
|
||||
[ ! -s "$CALLS" ]
|
||||
}
|
||||
|
||||
@test "seed-scenario: the first failure stops the rest and says what's out of step" {
|
||||
EVENTS_VERSION=3.8.0 WEBSITE_VERSION=1.8.0 FAIL_USER=cc-hope-events run cmd_demo hope --scenario bold-plant
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"Cross Events's demo failed"* ]]
|
||||
[[ "$output" == *"Loaded: accounts. Out of step with bold-plant: events website"* ]]
|
||||
[[ "$(cat "$CALLS")" != *"cc-hope-website"* ]]
|
||||
}
|
||||
|
||||
@test "seed-scenario: an App installed is refused (its demo comes with App 1.0.0), nothing changed" {
|
||||
HAS="accounts app" run cmd_demo hope --scenario bold-plant
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"comes with App 1.0.0"* ]]
|
||||
[ ! -s "$CALLS" ]
|
||||
}
|
||||
|
||||
@test "seed-scenario: a known scenario only" {
|
||||
run cmd_demo hope --scenario nowhere
|
||||
[ "$status" -eq 1 ]
|
||||
[ ! -s "$CALLS" ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user