diff --git a/.claude/skills/demo/SKILL.md b/.claude/skills/demo/SKILL.md index 81a9bd66..88aa1a23 100644 --- a/.claude/skills/demo/SKILL.md +++ b/.claude/skills/demo/SKILL.md @@ -98,7 +98,7 @@ In the sidebar in this order, with these projects. | Workspace | Slug | Avatar | People | Settings | |---|---|---|---|---| | Romanesco | `romanesco` | Uploaded: the Romanesco logo | Noor (primary admin), Kofi (admin); Jonas, Asha, Tomás, Aiko, Lucía, Sanna; Inês invited | Base role editor; two-factor required; GitHub `romanescohq`; Linear connected | -| milkfloat | `milkfloat` | Uploaded: the milkfloat logo | Noor (primary admin), Asha (admin), Lena | Base role maintainer; two-factor required; GitHub `milkfloat` | +| milkfloat | `milkfloat` | `route`, yellow | Uploaded: the milkfloat logo | Noor (primary admin), Asha (admin), Lena | Base role maintainer; two-factor required; GitHub `milkfloat` | | punschrulle | `punschrulle` | Uploaded: Noor's avatar | Noor | Invites skipped; GitHub `punschrulle` | | Crimp Collective | `crimp-collective` | None: CC on pink | Elsa (primary admin), Noor | Base role editor; GitHub `crimpcollective` | @@ -115,20 +115,24 @@ In the sidebar in this order, with these projects. ## Projects A project's count leaves out its review sessions, which take numbers -too: Shop's newest session is #231 of its 164. - -| Project | Slug | Repositories (primary first) | Sessions | Description | -|---|---|---|---|---| -| Shop | `shop` | `romanescohq/shop`; `romanescohq/design-system` (write), `romanescohq/platform` (read) | 164, 2 active | 🥕 The web shop: build a box, pick a delivery day, pay and manage the subscription. Next.js, TypeScript and Stripe. | -| Platform | `platform` | `romanescohq/platform`; `romanescohq/infra` (read) | 287, 1 active | Orders, subscriptions, farms and delivery routes behind every app. Rust (axum, sqlx) on Postgres, with milkfloat planning the vans' routes. | -| Driver app | `driver-app` | `romanescohq/driver-app` | 77, 1 active | 📱 The app drivers deliver with: the day's route, door codes, a photo at the door when nobody answers. Expo and React Native. | -| Infra | `infra` | `romanescohq/infra` | 38, 1 active | Terraform for AWS and Cloudflare, and the workflows that deploy everything. Agents plan; people apply. | -| milkfloat | `milkfloat` | `milkfloat/milkfloat`; `milkfloat/milkfloat.dev` (write) | 61, 1 active | 🚐 A vehicle-routing solver in Rust with Python bindings: time windows, capacities, driver breaks, and re-planning while the vans are out. MIT licensed. | -| Benchmarks | `milkfloat-bench` | `milkfloat/bench`; `milkfloat/milkfloat` (read) | 41 | Nightly runs of the Solomon and Gehring–Homberger instances against main, published at milkfloat.dev/bench. | -| sourdough | `sourdough` | `punschrulle/sourdough` | 12 | 🍞 Feeding reminders for my starter, and a bake-day plan that works back from when the bread should be ready. SvelteKit, installed on my phone. | -| plantwatch | `plantwatch` | `punschrulle/plantwatch` | 23 | 🌱 Soil sensors on ESP32s in every pot, Rust firmware on embassy, and a dashboard that says which plant is thirsty. | -| Website | `website` | `punschrulle/noorhaddad.se` | 9 | noorhaddad.se: notes on building Romanesco, recipes and the odd talk. Astro on Cloudflare Pages. | -| Bookings | `bookings` | `crimpcollective/bookings` | 17 | Session bookings, memberships and the route board for the club's wall. Django, kept alive by volunteers. | +too: Shop's newest session is #231 of its 164. Each has an icon its +people chose in the sidebar's picker (`icon` in `cast.toml`), all +duotone: the workspace's colors, or one of their own where the thing it +shows has a color (a carrot, a crust, a leaf), so that no two side by +side look alike and none is the gray of a project without one. + +| Project | Slug | Icon | Repositories (primary first) | Sessions | Description | +|---|---|---|---|---|---| +| Shop | `shop` | `carrot`, carrot orange `#ff7a1a` | `romanescohq/shop`; `romanescohq/design-system` (write), `romanescohq/platform` (read) | 164, 2 active | The web shop: build a box, pick a delivery day, pay and manage the subscription. Next.js, TypeScript and Stripe. | +| Platform | `platform` | `server-stack`, blue | `romanescohq/platform`; `romanescohq/infra` (read) | 287, 1 active | Orders, subscriptions, farms and delivery routes behind every app. Rust (axum, sqlx) on Postgres, with milkfloat planning the vans' routes. | +| Driver app | `driver-app` | `delivery-van`, yellow | `romanescohq/driver-app` | 77, 1 active | The app drivers deliver with: the day's route, door codes, a photo at the door when nobody answers. Expo and React Native. | +| Infra | `infra` | `cloud`, violet `#9b7bff` | `romanescohq/infra` | 38, 1 active | Terraform for AWS and Cloudflare, and the workflows that deploy everything. Agents plan; people apply. | +| milkfloat | `milkfloat` | `route`, yellow | `milkfloat/milkfloat`; `milkfloat/milkfloat.dev` (write) | 61, 1 active | A vehicle-routing solver in Rust with Python bindings: time windows, capacities, driver breaks, and re-planning while the vans are out. MIT licensed. | +| Benchmarks | `milkfloat-bench` | `gauge`, blue | `milkfloat/bench`; `milkfloat/milkfloat` (read) | 41 | Nightly runs of the Solomon and Gehring–Homberger instances against main, published at milkfloat.dev/bench. | +| sourdough | `sourdough` | `bread`, crust `#e0a458` | `punschrulle/sourdough` | 12 | Feeding reminders for my starter, and a bake-day plan that works back from when the bread should be ready. SvelteKit, installed on my phone. | +| plantwatch | `plantwatch` | `sprout`, leaf green `#4cc76a` | `punschrulle/plantwatch` | 23 | Soil sensors on ESP32s in every pot, Rust firmware on embassy, and a dashboard that says which plant is thirsty. | +| Website | `website` | `feather`, pink | `punschrulle/noorhaddad.se` | 9 | noorhaddad.se: notes on building Romanesco, recipes and the odd talk. Astro on Cloudflare Pages. | +| Bookings | `bookings` | `climbing`, pink | `crimpcollective/bookings` | 17 | Session bookings, memberships and the route board for the club's wall. Django, kept alive by volunteers. | Every default branch is `main`. A project's repositories all belong to one GitHub account, so Platform uses milkfloat as a crate, not as a repository. @@ -252,8 +256,11 @@ The feature pages of hyperstructure/fctl-site (`features//`) show the cast in screenshots that `shoot.mjs --features` takes, into the site's `src/features/shots//-.webp` (desktop shots 2200 px wide, phone ones 780 × 1576: the site's phone frame draws iOS's status bar -above them) and a `thumb-.webp` of each page's first shot for the -features overview: +above them). The features overview's tile for each page shows a part of +one of them at the app's own size, `card-.webp`: the shot's `card`, +`[x, y, width, height]` in CSS pixels, at twice that size (the sidebar's +comes from a window of its own, 1440 × 1400, and Memory's is a whole phone +shot): ```sh cargo xtask demo # wait for "the demo is running" @@ -268,7 +275,12 @@ or opens a dialog (the sandbox's setup log, a new access token, the schedule editor). Shots of a session pick it by the cast's name (`shop#231`), so they hold across runs. A page's HTML names its shots by those names: add a shot to both, and keep the alt texts saying what the -shot shows. A run of all of them takes about ten minutes. +shot shows. A page shows each shot once: where it needs the same screen +twice, as when a hero's phone (`only-phone`) and a section's would both be +the Agent Floor, take another of something near it (the Sessions page's +`phone-needs` is the sidebar a phone opens, the Runners page's +`phone-milkfloat` another workspace's runners). A run of all of them takes +about ten minutes. The Sessions page shows a video where its `diff` shot was: platform#437's diffs changing as its agent works, as the session page shows them (a new diff --git a/xtask/demo/cast.toml b/xtask/demo/cast.toml index 8acdf83b..93ec7d83 100644 --- a/xtask/demo/cast.toml +++ b/xtask/demo/cast.toml @@ -335,7 +335,8 @@ by = "elsa" slug = "shop" workspace = "romanesco" name = "Shop" -description = "🥕 The web shop: build a box, pick a delivery day, pay and manage the subscription. Next.js, TypeScript and Stripe." +description = "The web shop: build a box, pick a delivery day, pay and manage the subscription. Next.js, TypeScript and Stripe." +icon = { name = "carrot", hex = "#ff7a1a", style = "duotone" } by = "noor" created = "-5mo" repo = "romanescohq/shop" @@ -422,6 +423,7 @@ slug = "platform" workspace = "romanesco" name = "Platform" description = "Orders, subscriptions, farms and delivery routes behind every app. Rust (axum, sqlx) on Postgres, with milkfloat planning the vans' routes." +icon = { name = "server-stack", color = "blue", style = "duotone" } by = "noor" created = "-5mo" repo = "romanescohq/platform" @@ -496,7 +498,8 @@ history = [ slug = "driver-app" workspace = "romanesco" name = "Driver app" -description = "📱 The app drivers deliver with: the day's route, door codes, a photo at the door when nobody answers. Expo and React Native." +description = "The app drivers deliver with: the day's route, door codes, a photo at the door when nobody answers. Expo and React Native." +icon = { name = "delivery-van", color = "yellow", style = "duotone" } by = "noor" created = "-4mo" repo = "romanescohq/driver-app" @@ -546,6 +549,7 @@ slug = "infra" workspace = "romanesco" name = "Infra" description = "Terraform for AWS and Cloudflare, and the workflows that deploy everything. Agents plan; people apply." +icon = { name = "cloud", hex = "#9b7bff", style = "duotone" } by = "kofi" created = "-3mo" repo = "romanescohq/infra" @@ -585,7 +589,8 @@ history = [ slug = "milkfloat" workspace = "milkfloat" name = "milkfloat" -description = "🚐 A vehicle-routing solver in Rust with Python bindings: time windows, capacities, driver breaks, and re-planning while the vans are out. MIT licensed." +description = "A vehicle-routing solver in Rust with Python bindings: time windows, capacities, driver breaks, and re-planning while the vans are out. MIT licensed." +icon = { name = "route", color = "yellow", style = "duotone" } by = "noor" created = "-3mo" repo = "milkfloat/milkfloat" @@ -639,6 +644,7 @@ slug = "milkfloat-bench" workspace = "milkfloat" name = "Benchmarks" description = "Nightly runs of the Solomon and Gehring–Homberger instances against main, published at milkfloat.dev/bench." +icon = { name = "gauge", color = "blue", style = "duotone" } by = "noor" created = "-6w" repo = "milkfloat/bench" @@ -664,7 +670,8 @@ history = [ slug = "sourdough" workspace = "punschrulle" name = "sourdough" -description = "🍞 Feeding reminders for my starter, and a bake-day plan that works back from when the bread should be ready. SvelteKit, installed on my phone." +description = "Feeding reminders for my starter, and a bake-day plan that works back from when the bread should be ready. SvelteKit, installed on my phone." +icon = { name = "bread", hex = "#e0a458", style = "duotone" } by = "noor" created = "-4mo" repo = "punschrulle/sourdough" @@ -689,7 +696,8 @@ history = [ slug = "plantwatch" workspace = "punschrulle" name = "plantwatch" -description = "🌱 Soil sensors on ESP32s in every pot, Rust firmware on embassy, and a dashboard that says which plant is thirsty." +description = "Soil sensors on ESP32s in every pot, Rust firmware on embassy, and a dashboard that says which plant is thirsty." +icon = { name = "sprout", hex = "#4cc76a", style = "duotone" } by = "noor" created = "-4mo" repo = "punschrulle/plantwatch" @@ -727,6 +735,7 @@ slug = "website" workspace = "punschrulle" name = "Website" description = "noorhaddad.se: notes on building Romanesco, recipes and the odd talk. Astro on Cloudflare Pages." +icon = { name = "feather", color = "pink", style = "duotone" } by = "noor" created = "-4mo" repo = "punschrulle/noorhaddad.se" @@ -749,6 +758,7 @@ slug = "bookings" workspace = "crimp-collective" name = "Bookings" description = "Session bookings, memberships and the route board for the club's wall. Django, kept alive by volunteers." +icon = { name = "climbing", color = "pink", style = "duotone" } by = "elsa" created = "-3mo" repo = "crimpcollective/bookings" diff --git a/xtask/demo/shoot.mjs b/xtask/demo/shoot.mjs index 2176b1a0..0c6bab7f 100644 --- a/xtask/demo/shoot.mjs +++ b/xtask/demo/shoot.mjs @@ -125,6 +125,12 @@ async function openDiff(page, file, { phone = false } = {}) { await page.waitForTimeout(400); } +/** Opens the sidebar on a phone, as its menu button does. */ +async function openMenu(page) { + await page.getByRole("button", { name: "Open menu" }).first().click(); + await page.waitForTimeout(600); +} + /** Opens the transcript's setup row. */ async function openSetup(page) { await page.locator('button:has-text("Sandbox ready in")').first().click(); @@ -147,10 +153,14 @@ async function newToken(page) { } // The shots of fctl.sh's feature pages (`--features`), by page: what to -// show and how to get there. `act` runs once the page has settled. +// show and how to get there. `act` runs once the page has settled, and +// `size` gives a shot a window of its own size. `card` is the part of a +// shot that the features overview shows in its page's tile, [x, y, width, +// height] in CSS pixels, which it writes as `/card-.webp` at +// twice that size; a `cardOnly` shot is taken for its card alone. const pages = { sessions: [ - { name: "floor", path: "/", settle: 3000, thumb: true }, + { name: "floor", path: "/", settle: 3000 }, { name: "session", path: session("shop#231"), settle: 2500 }, { name: "follow-up", @@ -158,6 +168,8 @@ const pages = { act: (page) => scrollTo(page, "A check failed", 140), }, { name: "phone-floor", path: "/", phone: true, settle: 3000 }, + // What needs Noor, and her workspaces' projects, in the sidebar a phone opens. + { name: "phone-needs", path: "/", phone: true, settle: 3000, act: openMenu }, { name: "phone-session", path: session("shop#231"), phone: true, settle: 2500 }, // Asha's agent's fix for the double charge, a file of it over the page. { name: "diff", path: session("platform#437"), act: (page) => openDiff(page, "src/billing/charge.rs") }, @@ -171,7 +183,7 @@ const pages = { }, ], workspaces: [ - { name: "workspace", path: "/w/romanesco", thumb: true }, + { name: "workspace", path: "/w/romanesco" }, { name: "project", path: "/p/shop" }, { name: "settings", path: "/p/shop?tab=settings" }, { name: "people", path: "/w/romanesco?tab=people" }, @@ -179,9 +191,11 @@ const pages = { { name: "workspace-settings", path: "/w/romanesco?tab=settings" }, { name: "phone-workspace", path: "/w/romanesco", phone: true }, { name: "phone-project", path: "/p/shop", phone: true }, + // The sidebar's workspaces and their projects' icons, in a window tall enough for all four. + { name: "sidebar", path: "/", size: "1440x1400", settle: 3000, card: [0, 370, 287, 920], cardOnly: true }, ], sandboxes: [ - { name: "setup", path: session("shop#231"), act: openSetup, thumb: true }, + { name: "setup", path: session("shop#231"), act: openSetup, card: [328, 386, 760, 390] }, { name: "build", path: session("milkfloat#89"), act: openSetup }, { name: "settings", @@ -192,7 +206,12 @@ const pages = { { name: "phone-setup", path: session("shop#231"), phone: true, act: openSetup }, ], linear: [ - { name: "delegated", path: session("shop#231"), act: (page) => page.evaluate(() => window.scrollTo(0, 0)), thumb: true }, + { + name: "delegated", + path: session("shop#231"), + act: (page) => page.evaluate(() => window.scrollTo(0, 0)), + card: [318, 146, 620, 270], + }, { name: "exploration", path: session("shop#212"), @@ -200,6 +219,8 @@ const pages = { }, { name: "tickets", path: "/p/shop?tab=tickets" }, { name: "workspace", path: "/w/romanesco?tab=linear" }, + // Romanesco's Linear on a phone, where its admin connected it. + { name: "phone-linear", path: "/w/romanesco?tab=linear", phone: true }, { name: "phone-delegated", path: session("driver-app#75"), @@ -208,7 +229,7 @@ const pages = { }, ], "review-agents": [ - { name: "reviews", path: "/p/platform?tab=reviews", thumb: true }, + { name: "reviews", path: "/p/platform?tab=reviews", card: [418, 506, 640, 390] }, { name: "off", path: "/p/driver-app?tab=reviews" }, { name: "review", path: session("platform#438"), settle: 2000 }, { @@ -217,6 +238,8 @@ const pages = { act: (page) => scrollTo(page, "Two workers can still both charge the card", 260), }, { name: "outside", path: session("milkfloat#94"), settle: 2000 }, + // The shop's reviews, on Tomás's subscription: shop#1291's under way. + { name: "shop-reviews", path: "/p/shop?tab=reviews" }, { name: "phone-reviews", path: "/p/platform?tab=reviews", phone: true }, // What the review read: a file of the pull request it reviewed. { @@ -233,18 +256,34 @@ const pages = { act: (page) => scrollTo(page, "Remembered for later agents", 200), }, { name: "retro", path: session("shop#224"), act: (page) => scrollTo(page, "Retrospective", 140) }, - { name: "memory", path: "/p/platform?tab=memory", thumb: true }, + { name: "memory", path: "/p/platform?tab=memory" }, { name: "retrospectives", path: "/p/shop?tab=retrospectives" }, { name: "phone-memory", path: "/p/platform?tab=memory", phone: true }, { name: "phone-retrospectives", path: "/p/shop?tab=retrospectives", phone: true }, + // Platform's notes on a phone, as the features overview shows them in a phone of its own. + { + name: "card", + path: "/p/platform?tab=memory", + phone: true, + act: (page) => scrollTo(page, "Answer Stripe", 104), + card: [0, 0, 390, 788], + cardOnly: true, + }, ], runners: [ - { name: "runners", path: "/w/romanesco?tab=runners", thumb: true }, + { name: "runners", path: "/w/romanesco?tab=runners", card: [418, 462, 720, 400] }, { name: "milkfloat", path: "/w/milkfloat?tab=runners" }, { name: "phone-runners", path: "/w/romanesco?tab=runners", phone: true }, + // Noor's MacBook and fika, the runners of hers that milkfloat's sessions run on. + { + name: "phone-milkfloat", + path: "/w/milkfloat?tab=runners", + phone: true, + act: (page) => scrollTo(page, "Register a machine", 70), + }, ], schedules: [ - { name: "schedules", path: "/p/shop?tab=schedules", thumb: true }, + { name: "schedules", path: "/p/shop?tab=schedules" }, { name: "empty", path: "/p/driver-app?tab=schedules" }, { name: "editor", @@ -253,14 +292,15 @@ const pages = { await page.getByRole("button", { name: /Update dependencies/ }).click(); await page.waitForTimeout(600); }, + card: [438, 446, 620, 280], }, { name: "scheduled", path: session("shop#227"), act: (page) => page.evaluate(() => window.scrollTo(0, 0)) }, { name: "phone-schedules", path: "/p/shop?tab=schedules", phone: true }, { name: "phone-empty", path: "/p/driver-app?tab=schedules", phone: true }, ], "access-tokens": [ - { name: "tokens", path: "/settings", act: (page) => scrollTo(page, "Devices", 120), thumb: true }, - { name: "new", path: "/settings", act: newToken }, + { name: "tokens", path: "/settings", act: (page) => scrollTo(page, "Devices", 120) }, + { name: "new", path: "/settings", act: newToken, card: [394, 210, 500, 320] }, { name: "confirm", path: "/settings", @@ -274,7 +314,7 @@ const pages = { { name: "phone-tokens", path: "/settings", phone: true, act: (page) => scrollTo(page, "Devices", 80) }, ], team: [ - { name: "people", path: "/w/romanesco?tab=people", thumb: true }, + { name: "people", path: "/w/romanesco?tab=people", card: [418, 350, 560, 470] }, { name: "members", path: "/p/shop?tab=members" }, { name: "project", path: "/p/shop" }, { name: "watching", path: session("shop#231"), settle: 2500, act: (page) => railTo(page, "Watching (") }, @@ -283,7 +323,7 @@ const pages = { { name: "phone-members", path: "/p/shop?tab=members", phone: true, act: showTab }, ], "sign-in": [ - { name: "login", path: "/login", signedOut: true, thumb: true }, + { name: "login", path: "/login", signedOut: true, card: [500, 150, 560, 440] }, { name: "two-factor", path: "/login", @@ -490,9 +530,13 @@ if (open) { if (mine.length === 0) continue; const { context, page } = await noor(browser, { theme, phone, flowing: false, signedOut }); for (const shot of mine) { - // A page of its own for each shot that changes what it shows. - const tab = shot.act ? await context.newPage() : page; + // A page of its own for each shot that changes what it shows, or the window's size. + const tab = shot.act || shot.size ? await context.newPage() : page; if (tab !== page) await ready(context, tab); + if (shot.size) { + const [w, h] = shot.size.split("x").map(Number); + await tab.setViewportSize({ width: w, height: h }); + } // A page whose requests never go quiet still gets its shot, after a while. const url = new URL(shot.path, manifest.app).href; await tab.goto(url, { waitUntil: "networkidle", timeout: 20_000 }).catch(async () => { @@ -509,17 +553,23 @@ if (open) { await dress(tab); const png = await tab.screenshot(); if (features) { - const file = path.join(out, `${shot.name}-${theme}.webp`); - mkdirSync(path.dirname(file), { recursive: true }); - const w = await webp(converter, png, phone ? 780 : 2200); - writeFileSync(file, w.bytes); - console.log(`${file} ${w.width}×${w.height}`); - // The features page's card for it: the app's content, without - // the sidebar where it has one, small. - if (shot.thumb) { - const crop = shot.signedOut ? [0.1, 0.06, 0.8, 0.8] : [0.17, 0, 0.8, 0.8]; - const t = await webp(converter, png, 720, crop); - writeFileSync(path.join(out, shot.page, `thumb-${theme}.webp`), t.bytes); + mkdirSync(path.join(out, shot.page), { recursive: true }); + if (!shot.cardOnly) { + const file = path.join(out, `${shot.name}-${theme}.webp`); + const w = await webp(converter, png, phone ? 780 : 2200); + writeFileSync(file, w.bytes); + console.log(`${file} ${w.width}×${w.height}`); + } + // Its page's tile on the features page: the part of it that `card` + // says, [x, y, width, height] in CSS pixels, at twice that size. + if (shot.card) { + const view = tab.viewportSize(); + const [x, y, w, h] = shot.card; + const crop = [x / view.width, y / view.height, w / view.width, h / view.height]; + const c = await webp(converter, png, w * 2, crop); + const file = path.join(out, shot.page, `card-${theme}.webp`); + writeFileSync(file, c.bytes); + console.log(`${file} ${c.width}×${c.height}`); } } else { const file = path.join(out, `${shot.name}-${theme}.png`); diff --git a/xtask/src/demo/cast.rs b/xtask/src/demo/cast.rs index 7093d2ad..1715cf64 100644 --- a/xtask/src/demo/cast.rs +++ b/xtask/src/demo/cast.rs @@ -282,6 +282,25 @@ pub struct Project { pub retros: Vec, /// Its sandboxes, as its settings have them. pub sandbox: Option, + /// The icon its people chose for it in the sidebar's picker. Absent: + /// the one the web app finds for its name and description, in gray + /// lines. + pub icon: Option, +} + +/// A project's icon: a glyph of the web app's set +/// (`web/src/lib/project-icon-data.ts`), in a workspace color or a color +/// of its own, drawn in a style. +#[derive(Debug, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct Icon { + pub name: String, + /// `ink`, `yellow`, `pink` or `blue`; absent with `hex`. + pub color: Option, + /// A color of its own, `#rrggbb`, which the app shades for each theme. + pub hex: Option, + /// `outline`, `duotone` or `solid`. + pub style: String, } /// A project's sandboxes. The rewrite sets them, and shows them in its diff --git a/xtask/src/demo/mod.rs b/xtask/src/demo/mod.rs index bec94f6a..70475a6e 100644 --- a/xtask/src/demo/mod.rs +++ b/xtask/src/demo/mod.rs @@ -740,6 +740,38 @@ steps = [{ edit = "b.txt", old = "x", new = "y", replace_all = true }] assert!(data.join("avatars").join(file).exists(), "no avatar {file}"); } } + // Projects' icons are glyphs the web app draws, in its colors and + // styles: one it lacks would show the icon that fits instead. + let glyphs = std::fs::read_to_string( + Path::new(env!("CARGO_MANIFEST_DIR")).join("../web/src/lib/project-icon-data.ts"), + )?; + for p in &cast.projects { + let Some(icon) = &p.icon else { continue }; + let slug = &p.slug; + assert!( + glyphs.contains(&format!("{{\"name\":\"{}\",", icon.name)), + "{slug}'s icon {} isn't in the web app's set", + icon.name + ); + assert!( + ["outline", "duotone", "solid"].contains(&icon.style.as_str()), + "{slug}'s icon has no style the app draws: {}", + icon.style + ); + match (&icon.color, &icon.hex) { + (Some(color), None) => assert!( + ["ink", "yellow", "pink", "blue"].contains(&color.as_str()), + "{slug}'s icon has no workspace color: {color}" + ), + (None, Some(hex)) => assert!( + hex.len() == 7 + && hex.starts_with('#') + && hex[1..].bytes().all(|b| b.is_ascii_hexdigit()), + "{slug}'s icon's color isn't #rrggbb: {hex}" + ), + _ => panic!("{slug}'s icon needs a color or a hex, and not both"), + } + } Ok(()) } diff --git a/xtask/src/demo/world.rs b/xtask/src/demo/world.rs index 75bd781e..9d4dda86 100644 --- a/xtask/src/demo/world.rs +++ b/xtask/src/demo/world.rs @@ -546,12 +546,17 @@ impl<'a> World<'a> { if let Some(i) = &p.instructions { settings["instructions"] = json!(i); } - let made = self.api( - &p.by, - "POST", - "/projects", - Some(json!({ "workspace": p.workspace, "name": p.name, "slug": p.slug, "description": p.description, "settings": settings })), - )?; + let mut body = json!({ "workspace": p.workspace, "name": p.name, "slug": p.slug, "description": p.description, "settings": settings }); + if let Some(icon) = &p.icon { + body["icon"] = json!({ "name": icon.name, "style": icon.style }); + if let Some(color) = &icon.color { + body["icon"]["color"] = json!(color); + } + if let Some(hex) = &icon.hex { + body["icon"]["hex"] = json!(hex); + } + } + let made = self.api(&p.by, "POST", "/projects", Some(body))?; let id = made["id"] .as_str() .context("no id for a project")?