diff --git a/CHANGELOG.md b/CHANGELOG.md index 89f3002..b2b71b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ versions follow [Semantic Versioning](https://semver.org/). ## [Unreleased] +## [2.18.0] - 2026-11-23 + +Frontend only: no migration, no API changes. + +### Changed + +- **Releases are picked from a list, not typed.** New install and Move onto the monorepo now list the + product's releases, like the install's Update popup and the Updates page: first Latest (with its + version), then the newest 10, with **Show older versions** for the rest. Each is marked latest, + running now (when updating an install) or with what it needs ("needs Accounts 1.2.0"). +- Move onto the monorepo lists Cross Events releases from 2.2.0, the first in the monorepo. + ## [2.17.0] - 2026-11-23 Frontend only: no migration, no API changes. With 2.16.0, every add and edit that was an action on a diff --git a/backend/package-lock.json b/backend/package-lock.json index d35fca7..beed8b6 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -1,12 +1,12 @@ { "name": "events-hub-backend", - "version": "2.17.0", + "version": "2.18.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "events-hub-backend", - "version": "2.17.0", + "version": "2.18.0", "hasInstallScript": true, "dependencies": { "@anthropic-ai/sdk": "^1.3.0", diff --git a/backend/package.json b/backend/package.json index 1b443b1..a3827b4 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "events-hub-backend", - "version": "2.17.0", + "version": "2.18.0", "private": true, "description": "Cross Events Hub — API for managing Cross Events installs, licences and heartbeats", "main": "src/index.js", diff --git a/docs/VERSION-PICKERS-PLAN.md b/docs/VERSION-PICKERS-PLAN.md new file mode 100644 index 0000000..634b365 --- /dev/null +++ b/docs/VERSION-PICKERS-PLAN.md @@ -0,0 +1,65 @@ +# Version pickers plan + +Status: 2.18.0 done; 2.19.0 in progress · 2026-11-23 + +Three forms still ask for a version as free text, though the Hub knows (or could know) every release. +This plan turns them into a list to pick from, and gives the Hub the agent's releases so Update agent +can do the same. + +## Where versions are typed today + +| Form | Today | What the Hub knows | +|---|---|---| +| **New install** (`app/(hub)/servers/installs/page.tsx`) | Free text "Release", placeholder "latest" | Every product release; the backend already refuses an unknown version (`releaseFor` in `utils/jobs.js`) | +| **Move onto the monorepo** (`components/install/AdoptModal.tsx`) | Free text "Release", placeholder "latest" | The same | +| **Update agent** (`app/(hub)/servers/[id]/page.tsx`) | Free text, placeholder "agent@1.0.1" | Nothing: the Hub has no agent releases; the contract only checks the form `agent@x.y.z` | + +The install's **Update** popup and the **Updates** page already have a list of releases. + +For the agent, the monorepo has `agent@1.0.0`…`agent@1.5.0` tags and the agent's self-update checks +the tag out. Missing: notes (`apps/agent/WHATS-NEW.md`; without it a sync reports "not found"), and a +place in the Hub for them. Releases hang off the `Product` enum, which licences, billing, customer +products and notices also use, so the agent doesn't become a product. + +## Decisions (2026-11-23) + +- Older versions are offered too (to go back to one): the newest 10, with **Show older versions** to + see the rest. Latest stays the default. +- Agent releases and their notes show on the Releases page. +- The agent's notes are written from its history, for every tag (1.0.0–1.5.0), in crosscode-platform. + +## Hub 2.18.0: pickers for products (frontend only) + +1. **`components/ReleaseSelect.tsx`**: first "Latest (3.6.1)" (sends no version, as today), then the + product's releases newest first, the newest 10 until **Show older versions (n)** is clicked; each + marked "(latest)", "running now" and "needs Accounts 1.2.0" where it applies. `UpdateModal` and the + Updates page use it too, so all four look the same. +2. **New install**: the popup loads the releases; the list is the chosen product's, and changing the + product goes back to Latest. +3. **Move onto the monorepo**: the same list, Cross Events releases from 2.2.0 (the first one in the + monorepo; the 2.1.x releases are the old repository's tags, which `adopt` can't check out). + +No backend changes: the backend already checks the version. + +## Hub 2.19.0: agent releases (migration) + +0. **crosscode-platform**: `apps/agent/WHATS-NEW.md`, a `## 1.x.y` section per tag (1.0.0–1.5.0; written, not committed yet). + Read from the default branch, so no new tag is needed. +1. **`AgentRelease`** (version unique, notes, urgent, releasedAt), its own model and migration, so + `Product` and everything on it is untouched. +2. **Sync**: a release source can be for the **Server agent** as well as a product; the default + sources gain it (monorepo, `agent@`, `apps/agent/WHATS-NEW.md`). Same rule as products: nothing is + removed unless every source was read and tags were found. +3. **API**: `GET /api/admin/agent-releases`; server summaries carry the latest agent version; an + update-agent job for a version that isn't a known agent release is refused (like `releaseFor`). +4. **Hub**: Update agent is a `ReleaseSelect` (Latest by default, the running version marked and not + pickable, the chosen version's notes under it); the Servers list and a server's page show + "agent 1.4.0 · 1.5.0 available"; the Releases page has a **Server agent** filter (from git only, no + Add). + +Later, not in this plan: **Update every agent** on the Servers page (one job per server behind). + +## Checks + +`npx tsc --noEmit`, `npx next build` (and `npx jest` in `backend` for 2.19.0). Each release gets its +CHANGELOG entry and a `vX.Y.Z` tag, then the docs commits in crosscode-platform. diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 719b0fe..7edd902 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "events-hub-frontend", - "version": "2.17.0", + "version": "2.18.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "events-hub-frontend", - "version": "2.17.0", + "version": "2.18.0", "dependencies": { "lucide-react": "^0.536.0", "next": "^15.5.24", diff --git a/frontend/package.json b/frontend/package.json index e95ee1c..a285045 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "events-hub-frontend", - "version": "2.17.0", + "version": "2.18.0", "private": true, "scripts": { "dev": "next dev -p 3200", diff --git a/frontend/src/app/(hub)/servers/installs/[id]/page.tsx b/frontend/src/app/(hub)/servers/installs/[id]/page.tsx index a4c4619..deb929c 100644 --- a/frontend/src/app/(hub)/servers/installs/[id]/page.tsx +++ b/frontend/src/app/(hub)/servers/installs/[id]/page.tsx @@ -145,7 +145,7 @@ export default function DeploymentPage() { {popup === "update" && } - {popup === "adopt" && } + {popup === "adopt" && } {popup === "demo" && } {popup === "uninstall" && } {(popup === "record" || popup === "forget") && router.push("/servers/installs")} />} diff --git a/frontend/src/app/(hub)/servers/installs/page.tsx b/frontend/src/app/(hub)/servers/installs/page.tsx index 252b144..7eaac3a 100644 --- a/frontend/src/app/(hub)/servers/installs/page.tsx +++ b/frontend/src/app/(hub)/servers/installs/page.tsx @@ -8,6 +8,8 @@ import { api, errorText } from "@/lib/api"; import { ago } from "@/lib/format"; import { matches, usePaged } from "@/lib/paging"; import { PRODUCT_NAMES } from "@/lib/products"; +import type { Release } from "@/lib/types"; +import { ReleaseSelect } from "@/components/ReleaseSelect"; import { FormError, Loading, Modal, ModalButtons, PageMessage, PageTitle, Pager, SearchInput, useSubmit } from "@/components/ui"; import { ServersNav, StatusPill, pct, shownStatus, type Deployment, type ServerSummary } from "@/components/servers"; @@ -23,9 +25,13 @@ const changedFrom = >(form: T, empty: T) => (Ob function NewInstallModal({ servers, onClose }: { servers: ServerSummary[]; onClose: () => void }) { const router = useRouter(); const [customers, setCustomers] = useState([]); + const [releases, setReleases] = useState([]); const [form, setForm] = useState(emptyNew); const { busy, error, run } = useSubmit(); - useEffect(() => { api("/api/admin/customers").then(setCustomers).catch(() => {}); }, []); + useEffect(() => { + api("/api/admin/customers").then(setCustomers).catch(() => {}); + api("/api/admin/releases").then(setReleases).catch(() => {}); + }, []); const submit = (e: React.FormEvent) => { e.preventDefault(); @@ -48,7 +54,7 @@ function NewInstallModal({ servers, onClose }: { servers: ServerSummary[]; onClo
- setForm({ ...form, product: e.target.value, version: "" })}> @@ -86,7 +92,10 @@ function NewInstallModal({ servers, onClose }: { servers: ServerSummary[]; onClo })}
-
+
+ + r.product === form.product)} value={form.version} onChange={version => setForm({ ...form, version })} /> +

The Hub makes the licence, picks two ports, and the agent installs within a minute. You get the report and the FastPanel steps by email.

diff --git a/frontend/src/app/(hub)/servers/updates/page.tsx b/frontend/src/app/(hub)/servers/updates/page.tsx index 38a2db9..85361f1 100644 --- a/frontend/src/app/(hub)/servers/updates/page.tsx +++ b/frontend/src/app/(hub)/servers/updates/page.tsx @@ -6,6 +6,7 @@ import { api, ApiError, errorText } from "@/lib/api"; import { fmtDate } from "@/lib/format"; import { usePaged } from "@/lib/paging"; import { PRODUCT_NAMES } from "@/lib/products"; +import { ReleaseSelect } from "@/components/ReleaseSelect"; import type { Release } from "@/lib/types"; import { Loading, Message, PageTitle, Pager, Tabs } from "@/components/ui"; import { ServersNav, StatusPill, toInput, fromInput, type Deployment, type Job } from "@/components/servers"; @@ -44,7 +45,6 @@ export default function UpdatesPage() { const deployments = useMemo(() => (all || []).filter(d => d.product === product), [all, product]); const ownReleases = useMemo(() => releases.filter(r => r.product === product), [releases, product]); - const latest = ownReleases.find(r => r.latest)?.version; const byVersion = useMemo(() => [...new Set(deployments.map(versionOf))].sort(), [deployments]); const upcomingPaged = usePaged(upcoming, upcoming.length, 20); @@ -114,10 +114,7 @@ export default function UpdatesPage() {
- + setForm({ ...form, version })} /> {product === "events" &&

Each church's Accounts stays on its version, unless this release needs a newer one: then it's updated first in the same deploy, or installed first if the church has none. The confirmation lists what happens.

}
{form.emergency && form.asap diff --git a/frontend/src/components/ReleaseSelect.tsx b/frontend/src/components/ReleaseSelect.tsx new file mode 100644 index 0000000..523ad81 --- /dev/null +++ b/frontend/src/components/ReleaseSelect.tsx @@ -0,0 +1,64 @@ +"use client"; + +import React, { useMemo, useState } from "react"; +import { PRODUCT_NAMES, type Product } from "@/lib/products"; + +/** Compares dotted versions (1.10.0 after 1.9.2); negative when a is older. */ +export function compareVersions(a: string, b: string) { + const x = a.split(".").map(n => parseInt(n, 10) || 0); + const y = b.split(".").map(n => parseInt(n, 10) || 0); + for (let i = 0; i < Math.max(x.length, y.length); i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) - (y[i] || 0); + return 0; +} + +/** What a release in the list needs: its version, and optionally whether it's the latest and what it requires. */ +export type PickableRelease = { version: string; latest?: boolean; requires?: { product: Product; version: string }[] }; + +const SHOWN = 10; + +/** + * Hub 2.18.0: pick a release from a list instead of typing it. First "Latest (x.y.z)" (value "", + * so the Hub picks the newest when the job is made), then the releases newest first: the newest 10 + * until "Show older versions" is clicked. `current` is marked "running now"; with `currentPickable` + * false it can't be chosen. `from` leaves out anything older. + */ +export function ReleaseSelect({ id, releases, value, onChange, current, currentPickable = true, from, latestLabel = "Latest" }: { + id: string; releases: PickableRelease[]; value: string; onChange: (version: string) => void; + current?: string | null; currentPickable?: boolean; from?: string; latestLabel?: string; +}) { + const [all, setAll] = useState(false); + const sorted = useMemo( + () => releases.filter(r => !from || compareVersions(r.version, from) >= 0).sort((a, b) => compareVersions(b.version, a.version)), + [releases, from], + ); + const newest = sorted.find(r => r.latest) || sorted[0]; + // The chosen one stays in the list even when it's older than the first 10. + const shown = all ? sorted : sorted.filter((r, i) => i < SHOWN || r.version === value); + const hidden = sorted.length - shown.length; + + return ( +
+ + {hidden > 0 && ( + + )} + {!sorted.length &&

No releases yet (see the Releases page).

} +
+ ); +} diff --git a/frontend/src/components/install/AdoptModal.tsx b/frontend/src/components/install/AdoptModal.tsx index ab2ccb7..b45f404 100644 --- a/frontend/src/components/install/AdoptModal.tsx +++ b/frontend/src/components/install/AdoptModal.tsx @@ -3,10 +3,15 @@ import React, { useState } from "react"; import { FormError, Modal, ModalButtons, useSubmit } from "@/components/ui"; import { fromInput, toInput } from "@/components/servers"; +import { ReleaseSelect } from "@/components/ReleaseSelect"; +import type { Release } from "@/lib/types"; import { H, changed, post, withWarnings, type Done, type Install } from "./shared"; +/** The first Cross Events release tagged in the monorepo; older ones are the old repository's tags, which adopt can't check out. */ +const MONOREPO_EVENTS_FROM = "2.2.0"; + /** Move an old (2.1.x) Events install onto the monorepo: `crosscode adopt` at a planned time. */ -export function AdoptModal({ x, onClose, onDone }: { x: Install; onClose: () => void; onDone: Done }) { +export function AdoptModal({ x, releases, onClose, onDone }: { x: Install; releases: Release[]; onClose: () => void; onDone: Done }) { const [form0] = useState(() => ({ eventsDir: "", version: "", address: "", at: toInput(new Date(Date.now() + 5 * H)) })); const [adopt, setAdopt] = useState(form0); const { busy, error, run } = useSubmit(); @@ -27,7 +32,10 @@ export function AdoptModal({ x, onClose, onDone }: { x: Install; onClose: () =>
setAdopt({ ...adopt, eventsDir: e.target.value })} />
setAdopt({ ...adopt, address: e.target.value })} />
-
setAdopt({ ...adopt, version: e.target.value })} />
+
+ + r.product === "events")} from={MONOREPO_EVENTS_FROM} value={adopt.version} onChange={version => setAdopt({ ...adopt, version })} /> +
setAdopt({ ...adopt, at: e.target.value })} />
diff --git a/frontend/src/components/install/UpdateModal.tsx b/frontend/src/components/install/UpdateModal.tsx index 4ee0a4c..9a7c825 100644 --- a/frontend/src/components/install/UpdateModal.tsx +++ b/frontend/src/components/install/UpdateModal.tsx @@ -2,9 +2,9 @@ import React, { useState } from "react"; import type { Release } from "@/lib/types"; -import { PRODUCT_NAMES } from "@/lib/products"; import { FormError, Modal, ModalButtons, useSubmit } from "@/components/ui"; import { fromInput, toInput } from "@/components/servers"; +import { ReleaseSelect } from "@/components/ReleaseSelect"; import { H, changed, post, productName, withWarnings, type Done, type Install } from "./shared"; /** @@ -33,10 +33,7 @@ export function UpdateModal({ x, releases, onClose, onDone }: { x: Install; rele
- + setUpd({ ...upd, version })} current={x.install?.version || x.version} />

Now on {x.install?.version || x.version || "an unknown version"}.

{asap