@hypersocial/decks-cli 0.9.14 → 0.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -32,6 +32,31 @@ decks login
32
32
  decks activity
33
33
  ```
34
34
 
35
+ ## Updating
36
+
37
+ ```bash
38
+ npm i -g hyperdecks@latest # or run every command as: npx hyperdecks@latest <command>
39
+ hyperdecks whoami # cli: <yours> (latest X, minimum Y)
40
+ ```
41
+
42
+ - **Daily notice.** Once a day the CLI asks the server which version is current
43
+ (`/api/cli/version`, cached in `~/.hyperdecks/update-check.json`). When a newer
44
+ one is out it prints one line on stderr with the upgrade command. Offline or
45
+ slow, it says nothing and never holds a command up.
46
+ `HYPERDECKS_NO_UPDATE_CHECK=1`, or `CI=true`, turns the line off.
47
+ - **Minimum.** Below the server's minimum version, `narrate`, `check`,
48
+ `release`, `deck new`, `preview create` and `init` refuse with the upgrade
49
+ command and exit 1, because an old CLI ships retired templates or since-fixed
50
+ bugs. Everything else (`whoami`, `deck list`, share links, stats) still runs.
51
+ `HYPERDECKS_ALLOW_OLD=1` runs them anyway in an emergency, with a warning.
52
+ - **Skill copies.** After an update, the next command refreshes the hyperdecks
53
+ skill copies `skills install` / `init` put in your agents' folders (Claude
54
+ Code, Codex, Cursor, ...) from the copy bundled with the CLI, and says so in
55
+ one line. A copy you edited by hand is left alone with a warning
56
+ (`hyperdecks skills install` replaces it). A copy installed before 0.9.16 is
57
+ saved to `~/.hyperdecks/skill-backups/` before it is refreshed.
58
+ - The CLI never installs itself: it only prints the command.
59
+
35
60
  ## Auth
36
61
 
37
62
  `decks login` opens the production broker at `https://hyperdecks.ai` and
package/bin/decks.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from "../src/commands.mjs";
2
+ import { main } from "../src/commands.mjs";
3
3
 
4
- process.exitCode = await runCli(process.argv.slice(2));
4
+ process.exitCode = await main(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypersocial/decks-cli",
3
- "version": "0.9.14",
3
+ "version": "0.9.16",
4
4
  "description": "Command-line client for Hypersocial Decks live analytics and share management.",
5
5
  "type": "module",
6
6
  "main": "./src/commands.mjs",
@@ -1,10 +1,14 @@
1
1
  ---
2
2
  name: hyperdecks
3
3
  description: Use when asked to make, narrate, check or ship a deck ("make me a narrated deck", "turn this into a deck and send it"), or when working with Hypersocial Decks, Hyperdecks CLI, production deck analytics, recipient share links, deck activity, MCP deck tools, or real-world/customer-facing deck checks. Prefer production for real activity and analytics; use development only for local implementation/testing when explicitly requested.
4
+ metadata:
5
+ version: "0.9.16"
4
6
  ---
5
7
 
6
8
  # Hyperdecks
7
9
 
10
+ Run `hyperdecks --version`; if it's behind `npx hyperdecks@latest --version`, update before making a deck (`npm i -g hyperdecks@latest`, or run every command as `npx hyperdecks@latest`).
11
+
8
12
  ## Overview
9
13
 
10
14
  Hyperdecks is the CLI and MCP surface for Hypersocial Decks live analytics,
@@ -502,19 +506,21 @@ saves one.
502
506
  **Textures, icons, pictures:** the `look` topic (one texture, one icon set
503
507
  from `search_icons` or `generate_icon_set`, a picture on every other slide).
504
508
 
505
- **Pick the layout from what the slide says** (each file in
506
- `templates/layouts/` opens with its slot, presenter and cues).
509
+ **Pick the layout from what the slide says** (each layout file opens
510
+ with its slot, presenter and cues).
507
511
 
508
- **The cover never puts text on the picture.** The title and lead sit on a
509
- solid ground, never on a picture or one faded
510
- with a gradient `mask-image` (`check` warns).
512
+ **Open on a cover, the title on a solid ground**; with a strong picture,
513
+ `cover-frame` or `cover-split`. A picture faded under the title is hard to
514
+ read (`check` warns).
511
515
 
512
516
  | Layout | Use it for | Presenter, moves |
513
517
  |---|---|---|
514
- | `hero` | the default cover, a section opener: title on the ground, the real subject framed beside it (no `.art`: the presenter is the visual) | stage; `[wave]`, `[look: h1]` |
515
- | `cover-band` | the picture is the story: full bleed, title on a panel | as `hero` |
516
- | `cover-poster` | a wide scene: picture on top, title below | as `hero` |
517
- | `cover-type` | no real picture yet: type only, presenter large | as `hero` |
518
+ | `hero` | the default cover: the subject framed beside the title | stage; `[wave]`, `[look: h1]` |
519
+ | `cover-frame` | a strong picture, framed under the title | as `hero` |
520
+ | `cover-split` | a big picture: a hard 50/50 | as `hero` |
521
+ | `cover-band` | the picture fills the slide, title on a panel | as `hero` |
522
+ | `cover-poster` | a wide scene on top, title below | as `hero` |
523
+ | `cover-type` | no picture: type only | as `hero` |
518
524
  | `number` | one number with its source: proof, traction, a delta | stage; `[look: #<id>-figure]` as it is said |
519
525
  | `product` | a screenshot in a browser frame (`.frame.card` for a phone) with the point beside it | stage; `[look: #<id>-frame]`, `[reveal: #<id>-callout]` |
520
526
  | `split` | the workhorse: a real picture (phone, laptop, 16:9) beside sticker, title, three ticks | stage, bottom-left; `[look: #<id>-frame]`, `[go: #<id>-t1]` … `t3` |
@@ -846,8 +852,8 @@ with the player's `hyperdecks.ai` script tag. Messages and what to do:
846
852
  | `forbidden phrase` | remove it from the page, script or narration |
847
853
  | `slide <id>: needs a data-note` / ⚠ `no data-note` | add the source (required on a `data-kind="pitch"` deck and with `--strict`) |
848
854
  | `slide <id>: title … needs a data-title-mobile` | add a shorter title |
849
- | `slide <id>: the hero's art` / `the cover's picture` / `the product screenshot` / `the chart … is still the layout's placeholder` | make the real file (`gen-image`, `screenshot <url>`, `chart <spec.json>`) and swap the element for the `<img>` the message names; or delete the hero's `<div class="art">` for no art (on `cover-band` / `cover-poster`, switch to `cover-type` instead) |
850
- | ⚠ `slide <id>: the … cover fades its picture into the ground with a mask-image` | the old hero's look: the title sits on picture and colour mixed. Move the deck's opening to a current cover (`hero`, `cover-band`, `cover-poster`, `cover-type`), or drop the mask and keep the title off the picture |
855
+ | `slide <id>: the hero's art` / `the cover's picture` / `the product screenshot` / `the chart … is still the layout's placeholder` | make the real file (`gen-image`, `screenshot <url>`, `chart <spec.json>`) and swap the element for the `<img>` the message names; or delete the hero's `<div class="art">` for no art (on `cover-frame` / `cover-split` / `cover-band` / `cover-poster`, switch to `cover-type` instead) |
856
+ | ⚠ `slide <id>: the cover fades its picture into the ground …` / `lays a gradient over its picture` / `the cover's title sits on its picture` | hard to read: open on `cover-frame` or `cover-split` (or `hero`, `cover-band`, `cover-poster`, `cover-type`), or drop the fade and keep the title off the picture |
851
857
  | `… presenter style "…" is not one of` | use stage, bubble, glass or corner |
852
858
  | `script.md line N: [go: …] matches nothing in slide <id>` | fix the selector, or add the element to that slide |
853
859
  | `… transition "…" is not one of` | use drift, cut, push, wipe, zoom `<selector>`, morph or fly |
@@ -49,8 +49,10 @@ makes the hello deck; continue from step 5 below.
49
49
  layouts' stand-ins (the covers' `<div class="art">`, product's
50
50
  `<div class="shot">`, chart's placeholder `<svg>`) fail `check_deck` until
51
51
  you swap each for an `<img>` of its real file, or delete the hero's art.
52
- Open on a cover (`hero`, `cover-band`, `cover-poster` or `cover-type`,
53
- deck_guide topic layouts) and never put the title or lead on the picture.
52
+ Open on a cover (`hero`, `cover-frame`, `cover-split`, `cover-band`,
53
+ `cover-poster` or `cover-type`, deck_guide topic layouts); with a strong
54
+ picture, `cover-frame` or `cover-split`. Keep the title and lead on a solid
55
+ ground: a picture faded into the ground under the title is hard to read.
54
56
  Icons: one set per deck (`look` topic): `search_icons { query }` for real
55
57
  line icons as inline `<svg>` in `currentColor`, or one `generate_icon_set`.
56
58
  For motion, `generate_video` (poll `check_video_job`): `loop: true` for a
package/src/check.mjs CHANGED
@@ -10,7 +10,7 @@
10
10
  // hosted check); this file adds the folder I/O and the Chromium measurements.
11
11
  import { existsSync, lstatSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
12
12
  import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
13
- import { PHONE, PRESENTER_FOOTPRINT, checkSources, overlapWarnings, phoneOverflowErrors, slideStyles, stageSize, MESSAGES } from "./checkRules.mjs";
13
+ import { COVER_LAYOUTS, PHONE, PRESENTER_FOOTPRINT, checkSources, coverTextWarnings, overlapWarnings, phoneOverflowErrors, slideStyles, stageSize, MESSAGES } from "./checkRules.mjs";
14
14
 
15
15
  import { withLoadingBlock } from "./loadingBlock.mjs";
16
16
 
@@ -19,9 +19,11 @@ export * from "./loadingBlock.mjs";
19
19
 
20
20
  // Lay each slide out in Chromium at the deck's stage size with JavaScript off
21
21
  // (no player, no deck scripts), put the style's footprint in its slot, and
22
- // measure it against the title's text. Needs `hyperdecks preview setup`.
22
+ // measure it against the title's text; on the first slide and any cover, also
23
+ // whether a line of the title lands on a picture (onPicture, for
24
+ // coverTextWarnings). Needs `hyperdecks preview setup`.
23
25
  export async function measureLayout(deckDir, styles, { width = 1600, height = 900 } = {}) {
24
- return withDeckPage(deckDir, { width, height }, (page) => page.evaluate(({ styles, footprint, width, height }) => {
26
+ return withDeckPage(deckDir, { width, height }, (page) => page.evaluate(({ styles, footprint, width, height, covers }) => {
25
27
  const box = (r) => ({ x: r.left, y: r.top, width: r.width, height: r.height });
26
28
  const sections = [...document.querySelectorAll("section.slide")];
27
29
  const host = sections[0]?.parentElement ?? document.body;
@@ -54,9 +56,30 @@ export async function measureLayout(deckDir, styles, { width = 1600, height = 90
54
56
  title = { x: x0, y: y0, width: Math.max(...rects.map((r) => r.right)) - x0, height: Math.max(...rects.map((r) => r.bottom)) - y0 };
55
57
  }
56
58
  }
57
- return { id, style, presenter, title };
59
+ // The cover's title on its picture (coverTextWarnings): a line of the title over a picture
60
+ // (an <img>, <video> or <canvas> that is not a .brand-logo or .icon, or a one-picture url()
61
+ // background, the slide's own included; nothing inside the title itself), unless
62
+ // an opaque panel between them holds the line, as cover-band's does.
63
+ let onPicture = false;
64
+ if (heading && (i === 0 || covers.some((c) => slide.classList.contains(c)))) {
65
+ const range = document.createRange();
66
+ range.selectNodeContents(heading);
67
+ const lines = [...range.getClientRects()].filter((r) => r.width && r.height);
68
+ // A url() background counts when it is one picture (no-repeat or cover/contain), not a repeating texture.
69
+ const photoBackground = (cs) => /url\(/.test(cs.backgroundImage) && (/no-repeat/.test(cs.backgroundRepeat) || /cover|contain/.test(cs.backgroundSize));
70
+ const pictures = [slide, ...slide.querySelectorAll("*")].filter((n) => !heading.contains(n) &&
71
+ ((/^(IMG|VIDEO|CANVAS)$/.test(n.tagName) && !n.closest(".brand-logo, .icon")) || photoBackground(getComputedStyle(n))));
72
+ // Opaque: any colour but transparent or one with an alpha below 1 (Chromium writes color-mix as color(srgb …) and keeps oklch).
73
+ const opaque = (bg) => bg !== "transparent" && !/^rgba\(.*,\s*(?:0|0?\.\d+)\s*\)$/.test(bg) && !/\/\s*(?:0|0?\.\d+|\d{1,2}(?:\.\d+)?%)\s*\)$/.test(bg);
74
+ const panels = [];
75
+ for (let n = heading; n && n !== slide; n = n.parentElement) if (opaque(getComputedStyle(n).backgroundColor)) panels.push(n);
76
+ const hit = (a, b) => Math.min(a.right, b.right) - Math.max(a.left, b.left) > 4 && Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top) > 4;
77
+ onPicture = lines.some((line) => pictures.some((p) => hit(line, p.getBoundingClientRect()) &&
78
+ !panels.some((panel) => !panel.contains(p) && hit(line, panel.getBoundingClientRect()))));
79
+ }
80
+ return { id, style, presenter, title, onPicture };
58
81
  });
59
- }, { styles, footprint: PRESENTER_FOOTPRINT, width, height }));
82
+ }, { styles, footprint: PRESENTER_FOOTPRINT, width, height, covers: COVER_LAYOUTS }));
60
83
  }
61
84
 
62
85
  // Lay each slide out as the framed player shows it on a phone: the deck's own
@@ -163,12 +186,14 @@ export function deckFolder(deckDir) {
163
186
  // (the hosted release measures a draft the same way, from a temp folder). A
164
187
  // presenter over the title is a warning, not a failure: only a person can judge
165
188
  // it. A slide that overflows the phone card is an error: the player never
166
- // scrolls a slide. No Chromium is a warning, as each measurement is optional.
189
+ // scrolls a slide. A cover whose title lands on its picture is a warning. No Chromium is a warning, as each measurement is optional.
167
190
  export async function layoutCheck(deckDir, html, manifest = null, { measure = measureLayout, measureFit = measurePhoneFit } = {}) {
168
191
  const errors = [], warnings = [];
169
192
  const { width: w, height: h } = stageSize(html);
170
193
  try {
171
- warnings.push(...overlapWarnings(await measure(deckDir, slideStyles(html, manifest), { width: w, height: h }), `${w}×${h}`));
194
+ const measured = await measure(deckDir, slideStyles(html, manifest), { width: w, height: h });
195
+ warnings.push(...overlapWarnings(measured, `${w}×${h}`));
196
+ warnings.push(...coverTextWarnings(measured));
172
197
  } catch (e) {
173
198
  warnings.push(MESSAGES.layoutUnchecked(e.message));
174
199
  }
@@ -72,7 +72,7 @@ export const MESSAGES = {
72
72
  transitionStale: (where, script, manifest) => `${where}: script.md says transition "${script}" but the manifest has "${manifest}": run \`hyperdecks narrate\` so the player gets it`,
73
73
  flyTwice: (ids) => `fly is for the deck's one big moment, but slides ${ids.join(", ")} all use it`,
74
74
  // Warnings from the look topic (deck_guide look): the deck passes, but a person should look.
75
- coverFade: (where, layout) => `${where}: the ${layout} cover fades its picture into the ground with a mask-image, so the title sits on a mix of picture and colour that is hard to read: keep the text off the picture (layouts hero, cover-band, cover-poster or cover-type; deck_guide topic layouts)`,
75
+ coverFade: (where, what) => `${where}: the cover ${what}, so the title sits on a mix of picture and colour that is hard to read: prefer cover-frame or cover-split (or hero, cover-band, cover-poster, cover-type), which keep the title on a solid ground (deck_guide topic layouts)`,
76
76
  fewPictures: (shown, total) => `only ${shown} of ${total} slides show a picture (a screenshot, a recording, a photo, a chart); aim for a real one on every other slide (deck_guide topic look)`,
77
77
  presenterGutter: (where, decl) => `${where}: ${decl} keeps a right gutter for the presenter; leave that corner to the slide's .narration-slot so a deck without a presenter can use it (deck_guide topic look)`,
78
78
  mixedIcons: (sets) => `the deck mixes icon sets (${sets.join(" and ")}); keep one set per deck (deck_guide topic look)`,
@@ -85,6 +85,7 @@ export const MESSAGES = {
85
85
  layoutUnchecked: (why) => `layout not checked: ${why}`,
86
86
  hotlink: (url) => `${url} is hotlinked from another site and can vanish after release; upload it with upload_deck_asset`,
87
87
  transitionKinds: (kinds, deck) => `${kinds.length} kinds of transition besides the default (${deck}): ${kinds.join(", ")}; keep to ${MAX_TRANSITION_KINDS} so the deck reads as designed`,
88
+ coverText: (where) => `${where}: the cover's title sits on its picture, which is hard to read: prefer a cover that keeps the title on a solid ground beside, above or below the picture (cover-frame, cover-split, hero, cover-band, cover-poster or cover-type; deck_guide topic layouts)`,
88
89
  overlap: (id, style, stage) => `slide ${id}: the ${style} presenter would overlap the title at ${stage}; move the .narration-slot or pick another style`,
89
90
  // An error, though only check --layout can see it.
90
91
  phoneOverflow: (id, px) => `slide ${id}: its content runs ${px}px past the slide on a ${PHONE.width}×${PHONE.height} phone; a slide must fit one screen without scrolling, so trim it or tighten its @media (max-width: 650px) rules`,
@@ -549,6 +550,14 @@ const PLACEHOLDERS = [
549
550
  layout: "l-hero", tag: "div", cls: "art", what: "the hero's art", img: '<img class="art" src="…" alt="">, or delete the div for no art (the presenter is the visual)',
550
551
  how: { hosted: "make a picture of the real subject with generate_image", cli: "make a picture of the real subject with `hyperdecks gen-image \"<prompt>\"`" },
551
552
  },
553
+ {
554
+ layout: "l-cover-frame", tag: "div", cls: "art", what: "the cover's picture", img: '<img class="art" src="…" alt="">, or use the cover-type layout for no picture',
555
+ how: { hosted: "make a wide picture of the real subject with generate_image", cli: "make a wide picture of the real subject with `hyperdecks gen-image \"<prompt>\"`" },
556
+ },
557
+ {
558
+ layout: "l-cover-split", tag: "div", cls: "art", what: "the cover's picture", img: '<img class="art" src="…" alt="">, or use the cover-type layout for no picture',
559
+ how: { hosted: "make a portrait or square picture of the real subject with generate_image", cli: "make a portrait or square picture of the real subject with `hyperdecks gen-image \"<prompt>\"`" },
560
+ },
552
561
  {
553
562
  layout: "l-cover-band", tag: "div", cls: "art", what: "the cover's picture", img: '<img class="art" src="…" alt="">, or use the cover-type layout for no picture',
554
563
  how: { hosted: "make a wide picture of the real subject with generate_image", cli: "make a wide picture of the real subject with `hyperdecks gen-image \"<prompt>\"`" },
@@ -732,6 +741,12 @@ export function overlapWarnings(measured, stage = "1600×900") {
732
741
  return measured.filter((m) => hit(m.presenter, m.title)).map((m) => MESSAGES.overlap(m.id, m.style, stage));
733
742
  }
734
743
 
744
+ // Covers whose rendered title lands on their picture, as warnings. Each entry: { id, onPicture }
745
+ // (measureLayout sets onPicture on the first slide and on any slide with a cover layout).
746
+ export function coverTextWarnings(measured) {
747
+ return measured.filter((m) => m.onPicture).map((m) => MESSAGES.coverText(`slide ${m.id}`));
748
+ }
749
+
735
750
  // Slides whose content overflows the phone card, as errors. Each entry: { id, overflow } in px.
736
751
  export function phoneOverflowErrors(measured) {
737
752
  return measured.filter((m) => m.overflow > 1).map((m) => MESSAGES.phoneOverflow(m.id, Math.ceil(m.overflow)));
@@ -836,25 +851,125 @@ export function lookWarnings(html) {
836
851
  if (iconImg(tag)) sets.add("image icons");
837
852
  }
838
853
  if (sets.size > 1) out.push(MESSAGES.mixedIcons([...sets].sort()));
839
- out.push(...textureWarnings(all, html), ...coverFadeWarnings(all, html));
854
+ out.push(...textureWarnings(all, html), ...coverFadeWarnings(html));
840
855
  return out;
841
856
  }
842
857
 
843
- // Covers never put text on the picture. Where the text overlaps a picture can only be
844
- // measured by rendering, so this reads the one source pattern that always does: a cover
845
- // layout whose CSS fades its picture with a gradient mask-image (the old hero's look,
846
- // still inlined in decks made from it). A deck's own picture and text placement beyond
847
- // that is left to the layouts and the review.
848
- export const COVER_LAYOUTS = ["l-hero", "l-cover-band", "l-cover-poster", "l-cover-type"];
849
- function coverFadeWarnings(all, html) {
850
- const css = [...uncommented(html).matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((m) => m[1].replace(/\/\*[\s\S]*?\*\//g, "")).join("\n");
851
- const faded = new Set();
852
- for (const [, sel, body] of css.matchAll(/([^{}]*)\{([^{}]*)\}/g)) {
853
- if (!/(?:^|;|\s)(?:-webkit-)?mask(?:-image)?\s*:[^;]*gradient\(/i.test(body)) continue;
854
- for (const l of COVER_LAYOUTS) if (new RegExp(`\\.${l}(?![\\w-])`).test(sel)) faded.add(l);
858
+ // Covers that fade a picture into the ground (docs/roadmap/covers-never-fade-a-picture-into-the-ground.md):
859
+ // discouraged, as hard to read, so a warning (never a failure) on the first slide, whatever its
860
+ // class, and on any slide that uses a cover layout. Two checks: this one reads the source (fast,
861
+ // and the only one the hosted check_deck runs), and check --layout (run by every release, hosted
862
+ // or not) measures the rendered title
863
+ // against the picture (coverTextWarnings), the authoritative one: only rendering proves text sits on a picture. In the source a
864
+ // fade is a gradient mask on a picture (or what holds one; or on a cover layout's own rule, picture
865
+ // in or not), a linear-gradient to or from transparent laid over a picture (a ::before/::after on it
866
+ // or what holds it, an absolutely positioned element on the cover, or a layer on the same background
867
+ // as its url()). Repeating gradients (the layouts' hatched stand-ins) and the kit's textures (radial
868
+ // masks on ::before) are not fades.
869
+ export const COVER_LAYOUTS = ["l-hero", "l-cover-band", "l-cover-poster", "l-cover-type", "l-cover-frame", "l-cover-split"];
870
+ const VOID_TAGS = new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "source", "track", "wbr"]);
871
+ // The elements of a slide: the section first, then each element of its body with where it ends.
872
+ function slideElements(s) {
873
+ const els = [{ tag: s.tag, name: "section", start: -1, end: Infinity }];
874
+ const stack = [];
875
+ for (const m of s.body.matchAll(/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/g)) {
876
+ const name = m[2].toLowerCase();
877
+ if (m[1]) {
878
+ const at = stack.map((e) => e.name).lastIndexOf(name);
879
+ if (at >= 0) for (const e of stack.splice(at)) e.end = m.index;
880
+ continue;
881
+ }
882
+ const el = { tag: m[0], name, start: m.index, end: m.index + m[0].length };
883
+ els.push(el);
884
+ if (!VOID_TAGS.has(name) && !m[3]) { el.end = Infinity; stack.push(el); }
885
+ }
886
+ for (const e of stack) e.end = s.body.length;
887
+ return els;
888
+ }
889
+ // Whether one compound selector (tag#id.class[attr], pseudo-classes dropped) names this element.
890
+ function compoundMatches(el, compound) {
891
+ const c = compound.replace(/\[[^\]]*\]/g, "");
892
+ const m = /^(\*|[a-zA-Z][\w-]*)?((?:[#.][\w-]+)*)$/.exec(c);
893
+ if (!m) return false;
894
+ if (m[1] && m[1] !== "*" && m[1].toLowerCase() !== el.name) return false;
895
+ const have = classes(el.tag);
896
+ return [...m[2].matchAll(/([#.])([\w-]+)/g)].every(([, k, v]) => (k === "#" ? attr(el.tag, "id") === v : have.includes(v)));
897
+ }
898
+ // A selector's subject on this slide: the elements its last compound names, when every compound
899
+ // before it names something on the slide too (a loose descendant test), and whether it is a ::before/::after.
900
+ function selectorSubjects(els, selector) {
901
+ const pseudo = /::?(before|after)\b/i.test(selector);
902
+ const plain = selector.replace(/\[[^\]]*\]/g, "").replace(/::?[\w-]+(\((?:[^()]|\([^()]*\))*\))?/g, "").trim();
903
+ if (!plain) return null;
904
+ const compounds = plain.split(/\s*[>+~]\s*|\s+/).filter(Boolean);
905
+ // Leading compounds that name nothing here are ancestors outside the slide (html, body, a wrapper,
906
+ // a root state class), so they always match, unless they name a slide or a layout this one is not.
907
+ const first = compounds.slice(0, -1).findIndex((c) => els.some((el) => compoundMatches(el, c)));
908
+ const outside = first === -1 ? compounds.slice(0, -1) : compounds.slice(0, first);
909
+ if (outside.some((c) => /\.l-[\w-]|\.slide(?![\w-])|^section\b/.test(c))) return null;
910
+ if (first !== -1 && !compounds.slice(first, -1).every((c) => els.some((el) => compoundMatches(el, c)))) return null;
911
+ const hits = els.filter((el) => compoundMatches(el, compounds.at(-1)));
912
+ return hits.length ? { els: hits, pseudo } : null;
913
+ }
914
+ // A selector list split on its own commas, not those inside :is(…) or :not(…).
915
+ function topLevel(list) {
916
+ const out = [""];
917
+ let depth = 0;
918
+ for (const ch of list) {
919
+ if (ch === "(") depth++;
920
+ else if (ch === ")") depth--;
921
+ if (ch === "," && depth === 0) out.push("");
922
+ else out[out.length - 1] += ch;
855
923
  }
856
- if (!faded.size) return [];
857
- return all.flatMap((s, i) => classes(s.tag).filter((c) => faded.has(c)).map((c) => MESSAGES.coverFade(`slide ${s.id || i + 1}`, c.slice(2))));
924
+ return out;
925
+ }
926
+ const FADE_MASK = /(?:^|[;\s])(?:-webkit-)?mask(?:-image)?\s*:[^;]*(?<!repeating-)(?:linear|radial|conic)-gradient\(/i;
927
+ // A linear-gradient (not repeating) with a transparent stop: a fade to or from the ground.
928
+ // (A color-mix(…, transparent) is a flat tint, not a stop.)
929
+ const fadeGradient = (value) => [...value.matchAll(/(?<!repeating-)linear-gradient\(((?:[^()]|\((?:[^()]|\([^()]*\))*\))*)\)/gi)]
930
+ .map(([, args]) => args.replace(/color-mix\((?:[^()]|\([^()]*\))*\)/gi, "c"))
931
+ .some((args) => /\btransparent\b|rgba?\([^)]*[,/]\s*0(?:\.0*)?\s*\)|hsla?\([^)]*[,/]\s*0(?:\.0*)?\s*\)|#[0-9a-f]{6}00\b|#[0-9a-f]{3}0\b/i.test(args));
932
+ const backgroundsOf = (body) => [...body.matchAll(/(?:^|[;\s])background(?:-image)?\s*:([^;]*)/gi)].map((m) => m[1]);
933
+ export function coverFadeWarnings(html) {
934
+ const css = [...uncommented(html).matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((m) => m[1].replace(/\/\*[\s\S]*?\*\//g, "")).join("\n");
935
+ const rules = [...css.matchAll(/([^{}]*)\{([^{}]*)\}/g)].flatMap(([, sel, body]) => topLevel(sel).map((s) => ({ selector: s.trim(), body })));
936
+ return slides(html).flatMap((s, i) => {
937
+ if (i > 0 && !classes(s.tag).some((c) => COVER_LAYOUTS.includes(c))) return [];
938
+ const els = slideElements(s);
939
+ // The slide's rules: each stylesheet rule that names something here, and each inline style.
940
+ const own = [
941
+ ...rules.map((r) => ({ ...selectorSubjects(els, r.selector), body: r.body })).filter((r) => r.els),
942
+ ...els.filter((el) => attr(el.tag, "style")).map((el) => ({ els: [el], pseudo: false, body: attr(el.tag, "style") })),
943
+ ];
944
+ const urlBacked = new Set(own.filter((r) => !r.pseudo && backgroundsOf(r.body).some((v) => /url\(/i.test(v))).flatMap((r) => r.els));
945
+ const isPicture = (el) => urlBacked.has(el) || classes(el.tag).includes("art") ||
946
+ (/^(img|video|canvas|picture)$/.test(el.name) && !/\bbrand-logo\b/.test(attr(el.tag, "class") ?? "") && !(el.name === "img" && iconImg(el.tag)));
947
+ const where = `slide ${s.id || i + 1}`;
948
+ const out = new Set();
949
+ // A cover layout whose CSS masks its picture with a gradient (the old hero's look, still inlined in
950
+ // decks made from it) warns even before a picture is in: a deck copied from one gets the fade.
951
+ const layouts = classes(s.tag).filter((c) => COVER_LAYOUTS.includes(c));
952
+ if (rules.some((r) => FADE_MASK.test(r.body) && !/::?(before|after)\b/i.test(r.selector) && layouts.some((l) => new RegExp(`\\.${l}(?![\\w-])`).test(r.selector)))) {
953
+ out.add(MESSAGES.coverFade(where, "fades its picture into the ground with a gradient mask"));
954
+ }
955
+ const pictures = els.filter(isPicture);
956
+ if (!pictures.length) return [...out];
957
+ const holdsPicture = (el) => pictures.some((p) => p === el || (p.start > el.start && p.start < el.end));
958
+ for (const r of own) {
959
+ if (!r.els.some(holdsPicture)) continue;
960
+ const bgs = backgroundsOf(r.body);
961
+ if (!r.pseudo && FADE_MASK.test(r.body)) out.add(MESSAGES.coverFade(where, "fades its picture into the ground with a gradient mask"));
962
+ else if (r.pseudo && bgs.some(fadeGradient)) out.add(MESSAGES.coverFade(where, "lays a gradient over its picture"));
963
+ else if (bgs.some((v) => /url\(/i.test(v) && fadeGradient(v))) out.add(MESSAGES.coverFade(where, "lays a gradient over its picture"));
964
+ }
965
+ // An element of its own on the cover: positioned, with a fading gradient, and no picture itself
966
+ // (whether it overlaps the picture is not read here; check --layout measures the title).
967
+ for (const r of own) {
968
+ if (r.pseudo || !/(?:^|[;\s])position\s*:\s*(absolute|fixed)/i.test(r.body) || !backgroundsOf(r.body).some(fadeGradient)) continue;
969
+ if (r.els.some((el) => el.name !== "section" && !holdsPicture(el))) out.add(MESSAGES.coverFade(where, "lays a gradient over its picture"));
970
+ }
971
+ return [...out];
972
+ });
858
973
  }
859
974
 
860
975
  // Backgrounds (the look topic): the kit's textures are confined to the object they
@@ -871,10 +986,10 @@ const RETIRED_TEXTURES = {
871
986
  const SIGNATURES = ["bg-corner", "bg-mark"];
872
987
  export const MAX_SIGNATURE_SLIDES = 3;
873
988
  const BUSY_LAYOUTS = ["l-number", "l-features", "l-team", "l-timeline", "l-compare"]; // full-width content: nothing to back
874
- const PICTURE_COVERS = ["l-cover-band", "l-cover-poster"]; // the picture is the ground: a texture would only sit under it
989
+ const PICTURE_COVERS = ["l-cover-band", "l-cover-poster", "l-cover-split"]; // the picture is the ground (or half of it): a texture would only sit under it
875
990
  export const TEXTURE_OFF = {
876
991
  "bg-corner": ["l-split", "l-product", "l-chart", "l-quote", ...BUSY_LAYOUTS, ...PICTURE_COVERS],
877
- "bg-stage": ["l-split", "l-chart", "l-quote", "l-closer", ...BUSY_LAYOUTS, ...PICTURE_COVERS, "l-cover-type"],
992
+ "bg-stage": ["l-split", "l-chart", "l-quote", "l-closer", ...BUSY_LAYOUTS, ...PICTURE_COVERS, "l-cover-type", "l-cover-frame"],
878
993
  "bg-mark": ["l-split", "l-product", "l-chart", "l-phones", ...BUSY_LAYOUTS, ...PICTURE_COVERS],
879
994
  };
880
995
  function textureWarnings(all, html) {
package/src/commands.mjs CHANGED
@@ -1,16 +1,21 @@
1
1
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { basename, join, resolve } from "node:path";
3
3
  import {
4
+ agentTable,
4
5
  backupLinkUrl,
6
+ CLIENT_HEADERS,
5
7
  installHyperdecksSkill,
6
8
  login,
7
9
  logout,
8
10
  openBrowser,
9
11
  linkBase,
10
12
  parse,
13
+ PACKAGED_SKILLS_DIR,
11
14
  target,
12
15
  VERSION,
13
16
  } from "./runtime.mjs";
17
+ import { fetchVersionInfo, updatePreflight } from "./update.mjs";
18
+ import { refreshSkillCopies } from "./skillFreshness.mjs";
14
19
  import * as ops from "./ops.mjs";
15
20
  import { exportVideo } from "./export-video.mjs";
16
21
  import { presenterLine } from "./presenter.mjs";
@@ -21,21 +26,40 @@ export const playbackLabel = (p) => p.narrationFinished ? "narration finished"
21
26
 
22
27
  const fmtMs = (ms) => (ms >= 60000 ? `${(ms / 60000).toFixed(1)}m` : `${Math.round(ms / 1000)}s`);
23
28
 
29
+ // This CLI's version against the server's latest and minimum (null: unreachable).
30
+ async function cliVersions(opts) {
31
+ const info = await fetchVersionInfo(target(opts).brokerBase, { timeoutMs: 5000, headers: CLIENT_HEADERS });
32
+ return { version: VERSION, latest: info?.latest ?? null, minimum: info?.minimum ?? null };
33
+ }
34
+
24
35
  async function whoamiCmd(opts) {
25
36
  const t = target(opts);
26
- const who = await ops.whoami(opts);
37
+ // Signed out, it still prints the versions (agents run whoami first), then
38
+ // fails as before: exit 1 with the login hint.
39
+ let signedOut = null;
40
+ const signedIn = ops.whoami(opts).catch((e) => {
41
+ if (!/^not authenticated/.test(String(e?.message))) throw e;
42
+ signedOut = e;
43
+ return null;
44
+ });
45
+ const [who, cli] = await Promise.all([signedIn, cliVersions(opts)]);
27
46
  if (opts.json) {
28
- console.log(JSON.stringify({ ...(who || {}), deployment: t.name, convexUrl: t.convexUrl }, null, 2));
47
+ console.log(JSON.stringify({ ...(who || {}), deployment: t.name, convexUrl: t.convexUrl, cli }, null, 2));
48
+ if (signedOut) throw signedOut;
29
49
  return;
30
50
  }
51
+ const cliLine = `cli: ${cli.version}${cli.latest ? ` (latest ${cli.latest}, minimum ${cli.minimum})` : " (could not reach the server for the latest)"}`;
31
52
  if (!who) {
32
53
  console.log(`not authenticated (${t.name})`);
54
+ console.log(cliLine);
55
+ if (signedOut) throw signedOut;
33
56
  return;
34
57
  }
35
58
  console.log(`email: ${who.email}`);
36
59
  console.log(`subject: ${who.subject}`);
37
60
  console.log(`isAdmin: ${who.isAdmin}`);
38
61
  console.log(`deployment: ${t.name} (${t.convexUrl})`);
62
+ console.log(cliLine);
39
63
  }
40
64
 
41
65
  async function deckList(opts) {
@@ -494,7 +518,8 @@ commands:
494
518
  deck new <slug> "<title>" --narrated [--layouts hero,product,number,closer] [--presenter-style stage|bubble|glass|corner] [--no-brand] [--dir <path>]
495
519
  scaffold decks/<slug>/: index.html (8 slides, or one per layout, player/v1), script.md, evidence.md,
496
520
  in your saved brand's colours, fonts and logo (--no-brand: the template's look)
497
- layouts: hero, number, product, phones, quote, compare, timeline, features, chart, team, closer
521
+ layouts: hero, cover-frame, cover-split, cover-band, cover-poster, cover-type, number, product, phones, quote,
522
+ compare, timeline, features, chart, team, closer
498
523
  check <slug|deck-dir> [--forbid "<phrase>,<phrase>"] [--max-duration <s>] [--layout] [--strict] [--fix] [--json]
499
524
  the narrated-deck gate: slides vs manifest, timing, captions, clip URLs,
500
525
  local refs, pinned player, mobile titles. data-silent on the player script: no narration
@@ -1253,3 +1278,46 @@ export async function runCli(argv = process.argv.slice(2)) {
1253
1278
  return 1;
1254
1279
  }
1255
1280
  }
1281
+
1282
+ // The installed CLI's entry point (bin/): runCli plus the version checks. Kept
1283
+ // out of runCli so tests and the repo's own cli/decks.mjs dispatch without
1284
+ // touching the network or ~/.hyperdecks.
1285
+ // 1. refresh this machine's stale hyperdecks skill copies (local, no network);
1286
+ // 2. below the server's minimum, refuse the commands that make or ship a deck;
1287
+ // 3. after the command, print the once-a-day "newer version is out" line.
1288
+ // Only an installed copy (global or an npx cache, both under node_modules) does
1289
+ // this: run from a source checkout it would push a work-in-progress skill into
1290
+ // the developer's agents, and the repo's tests spawn the bin.
1291
+ export const isInstalledCopy = (dir = PACKAGED_SKILLS_DIR) => /[\\/]node_modules[\\/]/.test(dir);
1292
+
1293
+ export async function main(argv = process.argv.slice(2), { env = process.env, home, fetchImpl = fetch, stateFile, now, log, installed = isInstalledCopy() } = {}) {
1294
+ if (!installed) return runCli(argv);
1295
+ let parsed;
1296
+ try {
1297
+ parsed = parse(argv);
1298
+ } catch {
1299
+ return runCli(argv);
1300
+ }
1301
+ const { pos, opts } = parsed;
1302
+ if (opts.version || opts.help || pos.length === 0) return runCli(argv);
1303
+
1304
+ try {
1305
+ refreshSkillCopies({ version: VERSION, bundledDir: join(PACKAGED_SKILLS_DIR, "hyperdecks"), skillsDirs: agentTable({ home, env }).map((a) => a.skills), ...(home ? { home } : {}), ...(now ? { now } : {}), ...(log ? { log } : {}) });
1306
+ } catch (e) {
1307
+ // Never let housekeeping stop a command, but say what went wrong.
1308
+ (log ?? ((line) => console.error(line)))(`⚠ hyperdecks skill freshness check failed: ${e?.message ?? e}`);
1309
+ }
1310
+
1311
+ let base = null;
1312
+ try {
1313
+ const t = target(opts);
1314
+ if (t.name === "prod") base = t.brokerBase;
1315
+ } catch {
1316
+ // A bad --dev setup is reported by the command itself.
1317
+ }
1318
+ const pre = await updatePreflight(pos, { version: VERSION, base, env, fetchImpl, headers: CLIENT_HEADERS, ...(stateFile ? { stateFile } : {}), ...(now ? { now } : {}), ...(log ? { warn: log } : {}) });
1319
+ if (pre.refuse) return 1;
1320
+ const code = await runCli(argv);
1321
+ await pre.after();
1322
+ return code;
1323
+ }
package/src/files.mjs CHANGED
@@ -13,6 +13,8 @@ const FILES = {
13
13
  "templates/layouts/closer.html": () => new URL("../templates/layouts/closer.html", import.meta.url),
14
14
  "templates/layouts/compare.html": () => new URL("../templates/layouts/compare.html", import.meta.url),
15
15
  "templates/layouts/features.html": () => new URL("../templates/layouts/features.html", import.meta.url),
16
+ "templates/layouts/cover-frame.html": () => new URL("../templates/layouts/cover-frame.html", import.meta.url),
17
+ "templates/layouts/cover-split.html": () => new URL("../templates/layouts/cover-split.html", import.meta.url),
16
18
  "templates/layouts/cover-band.html": () => new URL("../templates/layouts/cover-band.html", import.meta.url),
17
19
  "templates/layouts/cover-poster.html": () => new URL("../templates/layouts/cover-poster.html", import.meta.url),
18
20
  "templates/layouts/cover-type.html": () => new URL("../templates/layouts/cover-type.html", import.meta.url),
package/src/init.mjs CHANGED
@@ -9,15 +9,16 @@
9
9
  // In chat (no folder, no git) the hosted MCP's get_started tool walks the same
10
10
  // steps on a hosted draft (lib/getStarted.ts); the deck fill is shared (firstDeck.mjs).
11
11
  import { execFileSync } from "node:child_process";
12
- import { createHash, randomBytes } from "node:crypto";
13
- import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
12
+ import { randomBytes } from "node:crypto";
13
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
14
14
  import { homedir } from "node:os";
15
- import { dirname, join, relative, resolve } from "node:path";
15
+ import { dirname, join, resolve } from "node:path";
16
16
  import { createInterface } from "node:readline/promises";
17
17
  import { fileURLToPath } from "node:url";
18
18
  import * as ops from "./ops.mjs";
19
19
  import { ANSWER_MAX, DASH_AVATAR, FIRST_DECK_LAYOUTS, cleanAnswer, fillFirstDeck, firstDeckCopy, firstDeckSlug } from "./firstDeck.mjs";
20
20
  import { agentTable, api, chooseAgents, client, CRED_DIR, installHyperdecksSkill, linkBase, login as runLogin, openBrowser, target } from "./runtime.mjs";
21
+ import { skillHash } from "./skillFreshness.mjs";
21
22
  import { READING_PASSAGE, voiceClone as runVoiceClone } from "./voice.mjs";
22
23
  import { assembleLayoutDeck, deckNew as runDeckNew } from "./scaffold.mjs";
23
24
  import { narrate as runNarrate } from "./narrate.mjs";
@@ -100,20 +101,8 @@ function gitConfig(dir, key) {
100
101
 
101
102
  // ---- skill ----------------------------------------------------------------
102
103
 
103
- function filesUnder(dir, base = dir) {
104
- return readdirSync(dir).flatMap((name) => {
105
- const p = join(dir, name);
106
- return statSync(p).isDirectory() ? filesUnder(p, base) : [relative(base, p)];
107
- }).sort();
108
- }
109
-
110
- // A hash of every file in a skill folder; null when it is not there.
111
- export function skillHash(dir) {
112
- if (!existsSync(join(dir, "SKILL.md"))) return null;
113
- const h = createHash("sha256");
114
- for (const f of filesUnder(dir)) h.update(f).update("\0").update(readFileSync(join(dir, f))).update("\0");
115
- return h.digest("hex");
116
- }
104
+ // skillHash: a hash of every file in a skill folder (skillFreshness.mjs).
105
+ export { skillHash };
117
106
 
118
107
  // ---- prompts --------------------------------------------------------------
119
108
 
package/src/layouts.mjs CHANGED
@@ -4,9 +4,9 @@
4
4
  import { packageText } from "./files.mjs";
5
5
 
6
6
  export const NARRATED_FILES = { "index.html": "narrated-deck.html", "script.md": "script.md", "evidence.md": "evidence.md" };
7
- // The library: the four covers first (hero is the default; a deck opens on one), then
8
- // the rest in a sensible deck order. `--layouts` takes any order and repeats.
9
- export const LAYOUTS = ["hero", "cover-band", "cover-poster", "cover-type", "number", "product", "split", "phones", "quote", "compare", "timeline", "features", "chart", "team", "closer"];
7
+ // The library: the six covers first (hero is the default; a deck opens on one; the
8
+ // clean picture covers cover-frame and cover-split next), then the rest in a sensible deck order. `--layouts` takes any order and repeats.
9
+ export const LAYOUTS = ["hero", "cover-frame", "cover-split", "cover-band", "cover-poster", "cover-type", "number", "product", "split", "phones", "quote", "compare", "timeline", "features", "chart", "team", "closer"];
10
10
  const LAYOUT_ALIASES = { "big-number": "number", "product-shot": "product", "phone-row": "phones", comparison: "compare", "three-up": "features", "image-copy": "split", "image-text": "split" };
11
11
 
12
12
  const escapeHtml = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
package/src/runtime.mjs CHANGED
@@ -7,8 +7,13 @@ import { dirname, join } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { ConvexHttpClient } from "convex/browser";
9
9
  import { makeFunctionReference } from "convex/server";
10
+ import { recordSkillInstall } from "./skillFreshness.mjs";
10
11
 
11
- export const VERSION = "0.9.14";
12
+ export const VERSION = "0.9.16";
13
+
14
+ // Sent on the CLI's calls to our routes and to Convex, so the server can see
15
+ // which CLI versions are still out there (not used to refuse anything).
16
+ export const CLIENT_HEADERS = { "x-hyperdecks-client": `cli/${VERSION}` };
12
17
  const UPLOAD_TIMEOUT_MS = 125_000;
13
18
 
14
19
  // The app's home. HYPERDECKS_HOST points the prod target's broker and share
@@ -220,7 +225,7 @@ function addRecipient(opts, k, v) {
220
225
  export const CRED_DIR = join(homedir(), ".config", "hypersocial-decks");
221
226
  export const CRED_FILE = join(CRED_DIR, "credentials.json");
222
227
  const SRC_DIR = dirname(fileURLToPath(import.meta.url));
223
- const PACKAGED_SKILLS_DIR = join(SRC_DIR, "..", "skills");
228
+ export const PACKAGED_SKILLS_DIR = join(SRC_DIR, "..", "skills");
224
229
 
225
230
  export function parse(args) {
226
231
  const opts = {};
@@ -367,7 +372,7 @@ async function mintJwt(brokerBase, refreshToken) {
367
372
  try {
368
373
  res = await fetch(`${brokerBase}/api/cli/token`, {
369
374
  method: "POST",
370
- headers: { authorization: `Bearer ${refreshToken}` },
375
+ headers: { ...CLIENT_HEADERS, authorization: `Bearer ${refreshToken}` },
371
376
  signal: AbortSignal.timeout(15000),
372
377
  });
373
378
  } catch (e) {
@@ -395,12 +400,18 @@ async function jwtFor(brokerBase, refreshToken) {
395
400
  return token;
396
401
  }
397
402
 
403
+ function withClientHeaders(input, init = {}) {
404
+ const headers = new Headers(init.headers);
405
+ for (const [k, v] of Object.entries(CLIENT_HEADERS)) headers.set(k, v);
406
+ return fetch(input, { ...init, headers });
407
+ }
408
+
398
409
  export async function client(opts = {}) {
399
410
  // Allow a pre-authenticated client to be injected (e.g. the remote MCP OAuth
400
411
  // route, which already holds a Convex client authed as the requesting user).
401
412
  if (opts.client) return opts.client;
402
413
  const t = target(opts);
403
- const c = new ConvexHttpClient(t.convexUrl);
414
+ const c = new ConvexHttpClient(t.convexUrl, { fetch: withClientHeaders });
404
415
  const admin = opts.admin || process.env.HSDECKS_ADMIN === "1";
405
416
  if (admin) {
406
417
  if (t.name === "prod") throw new Error("legacy --admin is dev-only; run `decks login` for prod");
@@ -513,6 +524,16 @@ export function installHyperdecksSkill(opts = {}, extraArgs = [], { spawn = spaw
513
524
  const tail = quiet ? `${result.stdout || ""}\n${result.stderr || ""}`.trim().split("\n").filter((l) => l.trim() && !/^npm warn/i.test(l)).slice(-3).join(" ") : "";
514
525
  throw new Error(`skills add failed with exit code ${result.status}${tail ? `: ${tail}` : ""}`);
515
526
  }
527
+ // Remember what was written (and its hash) so later runs can refresh these
528
+ // copies when the CLI updates, and leave hand-edited ones alone.
529
+ const table = agentTable({ home, env });
530
+ const written = agents[0] === "*" ? table : table.filter((a) => agents.includes(a.id));
531
+ try {
532
+ recordSkillInstall(written.map((a) => a.skills), home ? { home } : {});
533
+ } catch (e) {
534
+ // The install worked; only automatic refreshes of it are lost.
535
+ if (!quiet) log(`⚠ installed, but could not record it for automatic updates (${e.message})`);
536
+ }
516
537
  return { installed: true, agents, source };
517
538
  }
518
539
 
@@ -0,0 +1,265 @@
1
+ // Keeps the hyperdecks skill copies an agent reads in step with this CLI.
2
+ //
3
+ // `skills install` / `init` copy the packaged skill into each agent's folder
4
+ // (agentTable). An agent then reads that copy for good, even after the CLI is
5
+ // updated, and an old copy steers it to retired layouts. So on every run (local
6
+ // only, no network) the CLI looks at those copies and refreshes any whose
7
+ // stamped version (SKILL.md frontmatter `metadata.version`) is older than its
8
+ // own, from the copy bundled in this package.
9
+ //
10
+ // It never overwrites a hand-edited copy: ~/.hyperdecks/skills.json records the
11
+ // hash of each copy the CLI wrote. A copy that no longer matches its hash gets a
12
+ // warning (once a day) instead. A copy from before this record existed (no
13
+ // entry) is replaced too, after saving it to ~/.hyperdecks/skill-backups/, and
14
+ // the line says so. A copy that is a symlink (often into a repo checkout) is
15
+ // never touched: a one-line notice, once a day.
16
+ import { createHash } from "node:crypto";
17
+ import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
18
+ import { homedir } from "node:os";
19
+ import { basename, dirname, join, relative } from "node:path";
20
+ import { compareVersions, DAY_MS } from "./update.mjs";
21
+
22
+ export const SKILL_NAME = "hyperdecks";
23
+
24
+ const recordFile = (home) => join(home, ".hyperdecks", "skills.json");
25
+ const backupRoot = (home) => join(home, ".hyperdecks", "skill-backups");
26
+
27
+ function filesUnder(dir, base = dir) {
28
+ return readdirSync(dir).flatMap((name) => {
29
+ const p = join(dir, name);
30
+ return statSync(p).isDirectory() ? filesUnder(p, base) : [relative(base, p)];
31
+ }).sort();
32
+ }
33
+
34
+ // A hash of every file in a skill folder; null when it is not there.
35
+ export function skillHash(dir) {
36
+ if (!existsSync(join(dir, "SKILL.md"))) return null;
37
+ const h = createHash("sha256");
38
+ for (const f of filesUnder(dir)) h.update(f).update("\0").update(readFileSync(join(dir, f))).update("\0");
39
+ return h.digest("hex");
40
+ }
41
+
42
+ // The frontmatter of a SKILL.md: `name`, and `version` from `metadata.version`
43
+ // (or a top-level `version`). Missing fields are null.
44
+ export function skillStamp(dir) {
45
+ let text;
46
+ try {
47
+ text = readFileSync(join(dir, "SKILL.md"), "utf8");
48
+ } catch {
49
+ return null;
50
+ }
51
+ const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text)?.[1] ?? "";
52
+ const field = (re) => re.exec(fm)?.[1]?.trim().replace(/^["']|["']$/g, "") ?? null;
53
+ return {
54
+ name: field(/^name:\s*(.+)$/m),
55
+ version: field(/^metadata:\s*\n(?:[ \t]+.*\n)*?[ \t]+version:\s*(.+)$/m) ?? field(/^version:\s*(.+)$/m),
56
+ };
57
+ }
58
+
59
+ function readRecord(home) {
60
+ try {
61
+ const r = JSON.parse(readFileSync(recordFile(home), "utf8"));
62
+ return r && typeof r.copies === "object" && r.copies ? r : { copies: {} };
63
+ } catch {
64
+ return { copies: {} };
65
+ }
66
+ }
67
+
68
+ function writeRecord(home, record) {
69
+ try {
70
+ mkdirSync(dirname(recordFile(home)), { recursive: true });
71
+ writeFileSync(recordFile(home), JSON.stringify(record, null, 2));
72
+ } catch {
73
+ // Without a record the next run treats the copy as unrecorded; harmless.
74
+ }
75
+ }
76
+
77
+ const real = (p) => {
78
+ try {
79
+ return realpathSync(p);
80
+ } catch {
81
+ return p;
82
+ }
83
+ };
84
+
85
+ // Record the copies an install just wrote (dirs: the agents' skill folders,
86
+ // each holding hyperdecks/). Called by installHyperdecksSkill.
87
+ export function recordSkillInstall(skillsDirs, { home = homedir(), now = Date.now() } = {}) {
88
+ const record = readRecord(home);
89
+ for (const skillsDir of skillsDirs) {
90
+ if (isLinked(join(skillsDir, SKILL_NAME))) continue; // never refreshed, so not recorded
91
+ const dir = real(join(skillsDir, SKILL_NAME));
92
+ const hash = skillHash(dir);
93
+ if (!hash) continue;
94
+ record.copies[dir] = { version: skillStamp(dir)?.version ?? null, hash, at: now };
95
+ }
96
+ writeRecord(home, record);
97
+ }
98
+
99
+ // Leftovers of a swap that died midway (a killed process): `.hyperdecks.new-*` /
100
+ // `.hyperdecks.old-*` beside the copy. They are dot-named so agents should skip
101
+ // them, but one that didn't would load a second hyperdecks skill. Only ones
102
+ // older than a few minutes go, so another process's swap in flight is left be.
103
+ const STRAY = new RegExp(`^\\.${SKILL_NAME}\\.(new|old)-[\\w-]+$`);
104
+ const STRAY_AGE_MS = 10 * 60 * 1000;
105
+ function sweepStrays(parent, now) {
106
+ let names;
107
+ try {
108
+ names = readdirSync(parent);
109
+ } catch {
110
+ return;
111
+ }
112
+ for (const name of names) {
113
+ if (!STRAY.test(name)) continue;
114
+ const p = join(parent, name);
115
+ try {
116
+ if (now - statSync(p).mtimeMs > STRAY_AGE_MS) rmSync(p, { recursive: true, force: true });
117
+ } catch {
118
+ // Gone already, or not ours to remove.
119
+ }
120
+ }
121
+ }
122
+
123
+ // Swap `dir` for a copy of `bundledDir`: copy beside it, then two renames, so
124
+ // a failure never leaves the agent with no skill and never leaves a second one.
125
+ // Several commands may race here right after an update (an agent runs them in
126
+ // parallel): suffixes are unique per process, and a loser cleans up after itself.
127
+ function swapIn(dir, bundledDir, now) {
128
+ const tag = `${now}-${process.pid}-${Math.random().toString(36).slice(2, 8)}`;
129
+ const stage = (kind) => join(dirname(dir), `.${basename(dir)}.${kind}-${tag}`);
130
+ const fresh = stage("new");
131
+ const old = stage("old");
132
+ let moved = false;
133
+ try {
134
+ cpSync(bundledDir, fresh, { recursive: true });
135
+ renameSync(dir, old);
136
+ moved = true;
137
+ renameSync(fresh, dir);
138
+ } catch (e) {
139
+ rmSync(fresh, { recursive: true, force: true });
140
+ if (moved && !existsSync(dir)) {
141
+ try { renameSync(old, dir); } catch { /* reported below */ }
142
+ }
143
+ throw e;
144
+ }
145
+ // The swap is done; a failed cleanup is swept on a later run.
146
+ try { rmSync(old, { recursive: true, force: true }); } catch { /* swept later */ }
147
+ }
148
+
149
+ // Refresh stale copies. `skillsDirs`: the agents' skill folders to look in
150
+ // (agentTable(...).map(a => a.skills)); recorded copies are looked at too.
151
+ // Returns what it did per copy, for tests: refreshed | edited | current | failed.
152
+ export function refreshSkillCopies({ version, bundledDir, skillsDirs = [], home = homedir(), now = Date.now(), log = (line) => console.error(line) }) {
153
+ const results = [];
154
+ if (!existsSync(join(bundledDir, "SKILL.md"))) return results;
155
+ const record = readRecord(home);
156
+ // A copy that is a link (or resolves outside its skills folder) points into
157
+ // something the user manages, often a repo checkout: never swap files there.
158
+ const state = { bundledHash: null, changed: false };
159
+ const paths = [...skillsDirs.map((d) => join(d, SKILL_NAME)), ...Object.keys(record.copies)];
160
+ const linked = paths.filter(isLinked);
161
+ for (const path of linked) noteLink(path, { record, now, log, state });
162
+ // What a link points to is off limits too, even if an older run recorded it.
163
+ const targets = new Set(linked.map(real));
164
+ const candidates = new Set(paths.filter((p) => !linked.includes(p)).map(real).filter((p) => !targets.has(p)));
165
+
166
+ for (const dir of candidates) {
167
+ sweepStrays(dirname(dir), now);
168
+ try {
169
+ const r = refreshOne(dir, { version, bundledDir, home, now, log, record, state });
170
+ if (r) results.push(r);
171
+ } catch (e) {
172
+ // Another command refreshing the same copy at this moment (it was
173
+ // mid-swap when this one read it): that one says so.
174
+ if (compareVersions(skillStamp(dir)?.version ?? "0.0.0", version) >= 0) {
175
+ results.push({ dir, action: "current" });
176
+ continue;
177
+ }
178
+ // One unreadable copy must not stop the others.
179
+ results.push({ dir, action: "failed" });
180
+ warnFailed(dir, e, { record, now, log, state });
181
+ }
182
+ }
183
+ if (state.changed) writeRecord(home, record);
184
+ return results;
185
+ }
186
+
187
+ // A symlink, or a folder that resolves somewhere other than <its skills folder>/hyperdecks.
188
+ function isLinked(path) {
189
+ try {
190
+ if (lstatSync(path).isSymbolicLink()) return true;
191
+ } catch {
192
+ return false; // not there
193
+ }
194
+ return real(path) !== join(real(dirname(path)), basename(path));
195
+ }
196
+
197
+ function noteLink(path, { record, now, log, state }) {
198
+ const rec = (record.copies[path] ??= {});
199
+ if (typeof rec.linkNotedAt === "number" && now - rec.linkNotedAt < DAY_MS) return;
200
+ if (!skillStamp(path) || skillStamp(path).name !== SKILL_NAME) return;
201
+ rec.linkNotedAt = now;
202
+ state.changed = true;
203
+ log(`not updating the hyperdecks skill at ${path}: it's a link (to ${real(path)}); update what it points to yourself`);
204
+ }
205
+
206
+ // At most once a day per copy, like the hand-edit warning: a root-owned skills
207
+ // folder would otherwise print this on every command.
208
+ function warnFailed(dir, e, { record, now, log, state }) {
209
+ const rec = (record.copies[dir] ??= {});
210
+ if (typeof rec.failedAt === "number" && now - rec.failedAt < DAY_MS) return;
211
+ rec.failedAt = now;
212
+ state.changed = true;
213
+ log(`⚠ could not refresh the hyperdecks skill at ${dir} (${e?.message ?? e}); run \`hyperdecks skills install\``);
214
+ }
215
+
216
+ function refreshOne(dir, { version, bundledDir, home, now, log, record, state }) {
217
+ const stamp = skillStamp(dir);
218
+ if (!stamp) {
219
+ // Uninstalled since: forget it.
220
+ if (record.copies[dir]) { delete record.copies[dir]; state.changed = true; }
221
+ return null;
222
+ }
223
+ if (stamp.name !== SKILL_NAME) return null;
224
+ const rec = record.copies[dir]?.hash ? record.copies[dir] : null;
225
+ if (compareVersions(stamp.version ?? "0.0.0", version) >= 0) {
226
+ // Current, or newer (from a newer CLI: never downgrade it). Adopt an
227
+ // unrecorded copy that is byte-for-byte the bundled one, so a later edit to
228
+ // it is noticed.
229
+ if (!rec && compareVersions(stamp.version, version) === 0) {
230
+ state.bundledHash ??= skillHash(bundledDir);
231
+ if (skillHash(dir) === state.bundledHash) { record.copies[dir] = { version, hash: state.bundledHash, at: now }; state.changed = true; }
232
+ }
233
+ return { dir, action: "current" };
234
+ }
235
+ if (rec && skillHash(dir) !== rec.hash) {
236
+ if (!(typeof rec.warnedAt === "number" && now - rec.warnedAt < DAY_MS)) {
237
+ log(`⚠ the hyperdecks skill at ${dir} is ${stamp.version ?? "unversioned"} (this CLI is ${version}) and was edited by hand, so it was left as is; \`hyperdecks skills install\` replaces it`);
238
+ rec.warnedAt = now;
239
+ state.changed = true;
240
+ }
241
+ return { dir, action: "edited" };
242
+ }
243
+ let backup = null;
244
+ if (!rec) {
245
+ backup = join(backupRoot(home), `${basename(dirname(dirname(dir))) || "skill"}-${basename(dirname(dir))}-${now}-${process.pid}`);
246
+ mkdirSync(dirname(backup), { recursive: true });
247
+ cpSync(dir, backup, { recursive: true });
248
+ }
249
+ try {
250
+ swapIn(dir, bundledDir, now);
251
+ } catch (e) {
252
+ // Lost a race to another command doing the same refresh: that one says so.
253
+ if (compareVersions(skillStamp(dir)?.version ?? "0.0.0", version) === 0) {
254
+ if (backup) rmSync(backup, { recursive: true, force: true });
255
+ return { dir, action: "current" };
256
+ }
257
+ throw e;
258
+ }
259
+ record.copies[dir] = { version, hash: skillHash(dir), at: now };
260
+ state.changed = true;
261
+ log(backup
262
+ ? `↻ replaced the hyperdecks skill at ${dir} (${stamp.version ?? "unversioned"} → ${version}). It predates update tracking, so any edits you made to it were replaced too; the old copy is saved in ${backup}`
263
+ : `↻ refreshed the hyperdecks skill at ${dir} (${stamp.version ?? "unversioned"} → ${version})`);
264
+ return { dir, action: "refreshed", backup };
265
+ }
package/src/update.mjs ADDED
@@ -0,0 +1,140 @@
1
+ // Is this CLI out of date? Asks /api/cli/version (app/api/cli/version) at most
2
+ // once a day and keeps the answer in ~/.hyperdecks/update-check.json.
3
+ //
4
+ // - A newer `latest` prints one stderr line, at most once a day. A slow or failed
5
+ // check is silent and never blocks a command. HYPERDECKS_NO_UPDATE_CHECK=1 and
6
+ // CI skip the line.
7
+ // - Below `minimum`, the commands that make or ship a deck (GATED) refuse and
8
+ // exit 1, whatever the opt-out says; HYPERDECKS_ALLOW_OLD=1 runs them anyway,
9
+ // with a warning. Unknown (never reached the server): they run.
10
+ // - It never installs anything: it prints the command.
11
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
12
+ import { homedir } from "node:os";
13
+ import { dirname, join } from "node:path";
14
+
15
+ export const DAY_MS = 24 * 60 * 60 * 1000;
16
+ export const CHECK_TIMEOUT_MS = 1500;
17
+ export const UPDATE_STATE_FILE = join(homedir(), ".hyperdecks", "update-check.json");
18
+
19
+ // Commands that scaffold, narrate, check or release a deck: an old CLI here
20
+ // ships retired templates or since-fixed bugs. Everything else (whoami, deck
21
+ // list, share links, stats) keeps working on any version.
22
+ export const GATED = new Set(["narrate", "check", "release", "deck new", "preview create", "init"]);
23
+
24
+ export const UPGRADE = "npm i -g hyperdecks@latest, or use npx hyperdecks@latest";
25
+
26
+ // "1.2.3" vs "1.10.0": numeric x.y.z; a prerelease (1.2.3-beta) sorts below its
27
+ // release. Anything unparsable compares as 0.0.0.
28
+ export function compareVersions(a, b) {
29
+ const parts = (v) => {
30
+ const m = /^v?(\d+)\.(\d+)\.(\d+)(-.+)?$/.exec(String(v ?? "").trim());
31
+ return m ? [Number(m[1]), Number(m[2]), Number(m[3]), m[4] ? 0 : 1] : [0, 0, 0, 1];
32
+ };
33
+ const x = parts(a);
34
+ const y = parts(b);
35
+ for (let i = 0; i < 4; i++) if (x[i] !== y[i]) return x[i] < y[i] ? -1 : 1;
36
+ return 0;
37
+ }
38
+
39
+ // "deck new" for `deck new foo`, "narrate" for `narrate foo` (the command table's keys).
40
+ export function commandKey(pos) {
41
+ const two = pos.slice(0, 2).join(" ");
42
+ return GATED.has(two) ? two : String(pos[0] ?? "");
43
+ }
44
+
45
+ export const noticeLine = (latest, version) => `hyperdecks ${latest} is out (you have ${version}): ${UPGRADE}`;
46
+ export const refusalLine = (command, minimum, version) =>
47
+ `hyperdecks ${version} is too old to \`${command}\` (the minimum is ${minimum}): ${UPGRADE}. In an emergency, HYPERDECKS_ALLOW_OLD=1 runs it anyway.`;
48
+
49
+ const quietEnv = (env) => env.HYPERDECKS_NO_UPDATE_CHECK === "1" || /^(1|true)$/i.test(env.CI ?? "");
50
+
51
+ function readState(file) {
52
+ try {
53
+ const s = JSON.parse(readFileSync(file, "utf8"));
54
+ return s && typeof s === "object" ? s : {};
55
+ } catch {
56
+ return {};
57
+ }
58
+ }
59
+
60
+ function writeState(file, state) {
61
+ try {
62
+ mkdirSync(dirname(file), { recursive: true });
63
+ writeFileSync(file, JSON.stringify(state, null, 2));
64
+ } catch {
65
+ // A read-only home only costs the cache.
66
+ }
67
+ }
68
+
69
+ const VERSION_RE = /^\d+\.\d+\.\d+(-[\w.]+)?$/;
70
+
71
+ // { latest, minimum, notes } from the server, or null (slow, offline, bad body).
72
+ export async function fetchVersionInfo(base, { fetchImpl = fetch, timeoutMs = CHECK_TIMEOUT_MS, headers = {} } = {}) {
73
+ try {
74
+ const res = await fetchImpl(`${base}/api/cli/version`, { headers, signal: AbortSignal.timeout(timeoutMs) });
75
+ if (!res.ok) return null;
76
+ const body = await res.json();
77
+ if (!VERSION_RE.test(body?.latest ?? "") || !VERSION_RE.test(body?.minimum ?? "")) return null;
78
+ return { latest: body.latest, minimum: body.minimum, notes: typeof body.notes === "string" ? body.notes : "" };
79
+ } catch {
80
+ return null;
81
+ }
82
+ }
83
+
84
+ // Runs before a command. Returns { refuse } (the command must not run) and
85
+ // `after()`, which prints the daily notice once the command is done (so the
86
+ // check overlaps the command instead of delaying it).
87
+ export async function updatePreflight(pos, {
88
+ version,
89
+ base,
90
+ env = process.env,
91
+ now = Date.now(),
92
+ stateFile = UPDATE_STATE_FILE,
93
+ fetchImpl = fetch,
94
+ timeoutMs = CHECK_TIMEOUT_MS,
95
+ headers = {},
96
+ warn = (line) => console.error(line),
97
+ } = {}) {
98
+ const command = commandKey(pos);
99
+ const gated = GATED.has(command);
100
+ const quiet = quietEnv(env);
101
+ const state = readState(stateFile);
102
+ const fresh = typeof state.checkedAt === "number" && now - state.checkedAt < DAY_MS && now >= state.checkedAt;
103
+
104
+ let info;
105
+ if (fresh || !base || (quiet && !gated)) {
106
+ info = Promise.resolve(state);
107
+ } else {
108
+ info = fetchVersionInfo(base, { fetchImpl, timeoutMs, headers }).then((got) => {
109
+ // A failed check is remembered too, so an offline machine pays the
110
+ // timeout once a day, not on every command; the last answer is kept.
111
+ const next = { ...readState(stateFile), ...(got ?? {}), checkedAt: now };
112
+ writeState(stateFile, next);
113
+ return next;
114
+ });
115
+ }
116
+
117
+ if (gated) {
118
+ const { minimum } = await info;
119
+ if (minimum && compareVersions(version, minimum) < 0) {
120
+ if (env.HYPERDECKS_ALLOW_OLD !== "1") {
121
+ warn(`✗ ${refusalLine(command, minimum, version)}`);
122
+ return { refuse: true, after: async () => {} };
123
+ }
124
+ warn(`⚠ HYPERDECKS_ALLOW_OLD=1: running \`${command}\` on hyperdecks ${version}, below the minimum ${minimum}. It may ship retired templates or known bugs. Update: ${UPGRADE}`);
125
+ }
126
+ }
127
+
128
+ return {
129
+ refuse: false,
130
+ after: async () => {
131
+ if (quiet) return;
132
+ const got = await info;
133
+ if (!got.latest || compareVersions(got.latest, version) <= 0) return;
134
+ const last = readState(stateFile).notifiedAt;
135
+ if (typeof last === "number" && now - last < DAY_MS && now >= last) return;
136
+ warn(noticeLine(got.latest, version));
137
+ writeState(stateFile, { ...readState(stateFile), notifiedAt: now });
138
+ },
139
+ };
140
+ }
@@ -210,20 +210,20 @@ d.addEventListener("readystatechange",go);go()})();</script>
210
210
  -webkit-mask-image: radial-gradient(circle at 100% 0, #000 45%, rgba(0,0,0,.4) 100%); mask-image: radial-gradient(circle at 100% 0, #000 45%, rgba(0,0,0,.4) 100%); }
211
211
  .l-closer.bg-corner::before { --corner-r: 460px; }
212
212
  .on-ink.bg-corner::before { --corner-a: 22%; }
213
- :is(.l-split, .l-product, .l-chart, .l-quote, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster).bg-corner::before { content: none; }
213
+ :is(.l-split, .l-product, .l-chart, .l-quote, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster, .l-cover-split).bg-corner::before { content: none; }
214
214
  /* bg-stage: a rounded dot plate exactly the picture's column plus 32px, so the frame or the phones stand on it; on the hero a tile behind the stickers. */
215
215
  .slide.bg-stage::before { inset: auto; background: radial-gradient(color-mix(in srgb, currentColor var(--stage-a, 24%), transparent) 2.4px, transparent 2.9px) 0 0 / 22px 22px; border-radius: 40px; }
216
216
  .l-product.bg-stage::before { position: relative; grid-area: frame; align-self: stretch; margin: var(--stage-m, -32px -24px -32px -40px); }
217
217
  .l-phones.bg-stage::before { position: relative; grid-area: row; align-self: stretch; margin: var(--stage-m, -32px); }
218
218
  .l-hero.bg-stage::before { right: 110px; top: 110px; width: 410px; height: 350px; }
219
- :is(.l-split, .l-chart, .l-quote, .l-closer, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster, .l-cover-type).bg-stage::before { content: none; }
219
+ :is(.l-split, .l-chart, .l-quote, .l-closer, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster, .l-cover-split, .l-cover-type, .l-cover-frame).bg-stage::before { content: none; }
220
220
  /* bg-mark: the slide number, set as style="--mark:'04'" on the section, huge in --display, faint,
221
221
  cropped by the top edge; right on the hero, in the indent on slot-left slides. A signature: cover, an opener, closer. */
222
222
  .slide.bg-mark::before { content: var(--mark, ""); inset: auto; right: 24px; top: -.26em; font: var(--display-weight, 700) var(--mark-size, 560px)/1 var(--display, var(--font)); font-synthesis: none; letter-spacing: var(--display-tracking, -.05em); white-space: nowrap;
223
223
  color: color-mix(in srgb, currentColor var(--mark-a, 8%), transparent); }
224
224
  .slide.on-ink.bg-mark::before { --mark-a: 6%; }
225
225
  .slide.slot-left.bg-mark::before { right: auto; left: -.08em; font-size: var(--mark-size, 440px); } /* ends inside the 500px indent, clear of the title */
226
- :is(.l-split, .l-product, .l-chart, .l-phones, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster).bg-mark::before { content: none; }
226
+ :is(.l-split, .l-product, .l-chart, .l-phones, .l-number, .l-features, .l-team, .l-timeline, .l-compare, .l-cover-band, .l-cover-poster, .l-cover-split).bg-mark::before { content: none; }
227
227
  /* Pieces. .sticker: a logo or icon tile, tilted (--tilt), ink edge, hard offset
228
228
  shadow (.sticker.photo for a face or an app icon that fills it). .ticks: a short
229
229
  list with accent-square bullets. .panel: a quiet card. .pill: a small tag. */
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  layout: cover-band
3
- summary: A cover with the picture full bleed and the title on a solid, inked panel of the theme's paper in the bottom-left, so the title's contrast never depends on the picture.
3
+ summary: A cover with the picture filling the slide and the title on a solid, inked panel of the theme's paper in the bottom-left, so the title's contrast never depends on the picture.
4
4
  use: the first slide when the picture is the story (a place, an object, a crowd) and wants the whole frame. Its .art is a placeholder check fails on: put in a wide picture of the real subject (gen-image / generate_image, 16:9) as <img class="art">; keep the subject top or top-right: the panel covers the bottom-left and the presenter the bottom-right. The panel grows with the title; never move the title off the panel onto the picture. Without art the panel sits on the slide's ground.
5
5
  slot: bottom-right
6
6
  presenter: stage
@@ -0,0 +1,45 @@
1
+ <!--
2
+ layout: cover-frame
3
+ summary: A framed cover: the title across the top on the slide's own ground, the picture below it in a clean card (ink edge, rounded, a slight tilt) with a hard edge, never faded. The card takes whatever height the title leaves, so a long title shortens the card instead of covering it.
4
+ use: the first slide when there is a strong picture (a product, a person, a place) that reads as an object you hold up. Its .art is a placeholder check fails on: put in a wide picture of the real subject (gen-image / generate_image, 16:9 or 3:2) as <img class="art">; keep the subject in the middle, the card crops top and bottom. Never move the title onto the card; a fade or a gradient over the picture makes the title hard to read (check warns). Other covers: cover-split, hero, cover-band, cover-poster, cover-type.
5
+ slot: bottom-right
6
+ presenter: stage
7
+ nopresenter: The card runs nearly the slide's full width instead of stopping short of the corner.
8
+ cues: [wave] at the hello, [look: h1] when the narration says the title, [look: .art] when it turns to the picture.
9
+ script: Hi, [wave] this is __TITLE__. [look: h1] One idea, in a few minutes.
10
+ -->
11
+ <style>
12
+ /* The title on top in the slide's flow (the card comes first in the markup, shown after it); the picture a framed card below it that takes the height left, clear of the presenter's corner. */
13
+ .l-cover-frame { gap: 40px; }
14
+ .l-cover-frame .content { flex: none; display: flex; flex-direction: column; gap: 18px; }
15
+ .l-cover-frame .tt { font-size: min(var(--t-display), 104px); line-height: .92; }
16
+ .l-cover-frame .art { order: 1; display: block; flex: 1 1 0; min-height: 220px; width: calc(100% - 520px); margin: 0 0 14px 6px; border: 4px solid var(--ink); border-radius: 28px; object-fit: cover; box-shadow: 14px 14px 0 var(--accent); transform: rotate(-1.5deg); }
17
+ .on-ink.l-cover-frame .art { border-color: var(--paper); }
18
+ .on-accent.l-cover-frame .art { box-shadow: 14px 14px 0 var(--ink); }
19
+ /* Until then a labelled, hatched stand-in, so it reads as a slot to fill; check fails while it is here. */
20
+ .l-cover-frame div.art { position: relative; background: var(--paper) repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 10%, transparent) 0 2px, transparent 2px 22px); }
21
+ .l-cover-frame div.art::after { content: "Art goes here"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 26px; border: 3px dashed var(--ink); border-radius: 16px; background: var(--paper); color: var(--ink); font: 700 24px var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
22
+ .l-cover-frame:not(:has(> .art)) .content { flex: 1; justify-content: center; }
23
+ @media (max-width: 650px) {
24
+ /* Phones: the title, then the card across the width below it. */
25
+ .l-cover-frame { gap: 14px; }
26
+ .l-cover-frame .content { gap: 12px; }
27
+ .l-cover-frame .tt { font-size: var(--t-display); }
28
+ .l-cover-frame .art { flex: none; height: 156px; min-height: 0; width: auto; margin: 0 6px 6px 2px; border-width: 2px; border-radius: 16px; box-shadow: 6px 6px 0 var(--accent); transform: rotate(-1deg); }
29
+ .on-accent.l-cover-frame .art { box-shadow: 6px 6px 0 var(--ink); }
30
+ .l-cover-frame div.art::after { padding: 8px 14px; border-width: 2px; font-size: 13px; }
31
+ }
32
+ /* No presenter (:root.hd-no-presenter: no face and no captions, deck_guide look): the corner is free. Phones keep this layout's rules. */
33
+ @media (min-width: 651px) {
34
+ :root.hd-no-presenter .l-cover-frame .art { width: calc(100% - 20px); }
35
+ }
36
+ </style>
37
+ <section class="slide l-cover-frame" id="__ID__" data-chapter="Hello" data-note="Title slide: no facts.">
38
+ <div class="art" role="presentation"></div>
39
+ <div class="content">
40
+ <div class="kicker">__SLUG__</div>
41
+ <h1 class="tt" data-title-mobile="__TITLE__">__TITLE__</h1>
42
+ <p class="lead">One sentence on what this deck is about.</p>
43
+ </div>
44
+ <div class="narration-slot"></div>
45
+ </section>
@@ -0,0 +1,50 @@
1
+ <!--
2
+ layout: cover-split
3
+ summary: A hard 50/50 cover: the title on the left half on a solid ground, the picture filling the right half edge to edge, the two meeting on a straight ink line. No fade, no overlap: the picture never reaches the title's half.
4
+ use: the first slide when there is a strong picture that should be big (a product shot, a portrait, a scene) and a title that wants room of its own. Its .art is a placeholder check fails on: put in a picture of the real subject (gen-image / generate_image, square or near it: the half is about 8:9) as <img class="art">; keep the subject in the top two thirds (the presenter stands on the half's bottom-right; on phones the picture is a wide strip). Never lay the title on the picture; a fade or a gradient over it makes the title hard to read (check warns). Other covers: cover-frame, hero, cover-band, cover-poster, cover-type.
5
+ slot: bottom-right
6
+ presenter: stage
7
+ nopresenter: The picture crops on its centre instead of keeping its subject high above the presenter.
8
+ cues: [wave] at the hello, [look: h1] when the narration says the title, [look: .art] when it turns to the picture.
9
+ script: Hi, [wave] this is __TITLE__. [look: h1] One idea, in a few minutes.
10
+ -->
11
+ <style>
12
+ /* Two equal halves: the title's on the slide's ground, the picture's out to the slide's edges, meeting on a straight line. */
13
+ .l-cover-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); column-gap: 72px; }
14
+ .l-cover-split .content { grid-column: 1; grid-row: 1; align-self: center; display: flex; flex-direction: column; gap: 22px; }
15
+ .l-cover-split .tt { font-size: min(var(--t-display), 96px); line-height: .92; }
16
+ /* The picture's half is the slide's own right half, out to its edges (a sized box: an absolute <img> never stretches to its insets). */
17
+ .l-cover-split .art { position: absolute; top: 0; right: 0; display: block; width: 50%; height: 100%; border-left: 4px solid var(--ink); object-fit: cover; object-position: 50% 30%; }
18
+ .on-ink.l-cover-split .art { border-left-color: var(--paper); }
19
+ /* A brand logo (applyBrand puts it first in the slide) heads the title's half. */
20
+ .l-cover-split:has(> .brand-logo) { grid-template-rows: auto minmax(0, 1fr); }
21
+ .l-cover-split > .brand-logo { grid-column: 1; grid-row: 1; }
22
+ .l-cover-split:has(> .brand-logo) .content { grid-row: 2; }
23
+ /* Until then a labelled, hatched stand-in, so it reads as a slot to fill; check fails while it is here. */
24
+ .l-cover-split div.art { background: color-mix(in srgb, var(--ink) 6%, var(--paper)) repeating-linear-gradient(135deg, color-mix(in srgb, var(--ink) 10%, transparent) 0 2px, transparent 2px 22px); }
25
+ .l-cover-split div.art::after { content: "Art goes here"; position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); padding: 14px 26px; border: 3px dashed var(--ink); border-radius: 16px; background: var(--paper); color: var(--ink); font: 700 24px var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
26
+ .l-cover-split:not(:has(> .art)) { grid-template-columns: minmax(0, 1fr); }
27
+ @media (max-width: 650px) {
28
+ /* Phones: the picture across the top, edge to edge, the title below it on the ground. */
29
+ .l-cover-split { display: flex; flex-direction: column; gap: 0; }
30
+ .l-cover-split .art { position: relative; inset: auto; flex: none; width: auto; height: 186px; margin: -28px -20px 0; border-left: 0; border-bottom: 2px solid var(--ink); }
31
+ .on-ink.l-cover-split .art { border-bottom-color: var(--paper); }
32
+ .l-cover-split .content { align-self: stretch; gap: 12px; padding-top: 18px; }
33
+ .l-cover-split .tt { font-size: var(--t-display); }
34
+ .l-cover-split:has(> .art) > .brand-logo { position: absolute; top: 12px; left: 20px; z-index: 1; }
35
+ .l-cover-split div.art::after { top: 50%; padding: 8px 14px; border-width: 2px; font-size: 13px; }
36
+ }
37
+ /* No presenter (:root.hd-no-presenter: no face and no captions, deck_guide look): the corner is free. Phones keep this layout's rules. */
38
+ @media (min-width: 651px) {
39
+ :root.hd-no-presenter .l-cover-split .art { object-position: 50% 50%; }
40
+ }
41
+ </style>
42
+ <section class="slide l-cover-split" id="__ID__" data-chapter="Hello" data-note="Title slide: no facts.">
43
+ <div class="art" role="presentation"></div>
44
+ <div class="content">
45
+ <div class="kicker">__SLUG__</div>
46
+ <h1 class="tt" data-title-mobile="__TITLE__">__TITLE__</h1>
47
+ <p class="lead">One sentence on what this deck is about.</p>
48
+ </div>
49
+ <div class="narration-slot"></div>
50
+ </section>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  layout: hero
3
3
  summary: The opening, as a split cover: the title on the slide's own ground on the left, the picture in a clean frame top-right, the presenter's hello. Text never sits on the picture.
4
- use: the first slide (the default cover); a section opener. Its .art is a placeholder check fails on: put in a picture of the real subject (gen-image / generate_image, landscape or near-square: the frame is about 7:6) as <img class="art">, or delete the div and the title takes the full frame with the presenter as the visual. Never lay the title over the picture or fade the picture behind it. Other covers: cover-band (the picture full bleed, the title on a solid panel), cover-poster (the picture on top, the title below) and cover-type (type only).
4
+ use: the first slide (the default cover); a section opener. Its .art is a placeholder check fails on: put in a picture of the real subject (gen-image / generate_image, landscape or near-square: the frame is about 7:6) as <img class="art">, or delete the div and the title takes the full frame with the presenter as the visual. Never lay the title over the picture; a picture faded behind it is hard to read (check warns). Other covers: cover-frame (the picture as a card under the title), cover-split (a hard 50/50, the picture edge to edge in its half), cover-band (the picture fills the slide, the title on a solid panel), cover-poster (the picture on top, the title below) and cover-type (type only).
5
5
  slot: bottom-right
6
6
  presenter: stage
7
7
  nopresenter: With art, the picture grows to the full height of its column. Delete the art and the line re-centres in the full frame.