@hypersocial/decks-cli 0.5.0 → 0.6.0
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/package.json +1 -1
- package/skills/hyperdecks/SKILL.md +32 -4
- package/skills/hyperdecks/chat.md +34 -11
- package/src/brand.mjs +171 -0
- package/src/brandCli.mjs +127 -0
- package/src/checkRules.mjs +35 -3
- package/src/commands.mjs +33 -6
- package/src/files.mjs +1 -0
- package/src/firstDeck.mjs +2 -0
- package/src/guide.mjs +3 -1
- package/src/hosted.mjs +15 -6
- package/src/icons.mjs +66 -0
- package/src/narrate.mjs +8 -1
- package/src/ops.mjs +53 -0
- package/src/presenter.mjs +9 -0
- package/src/release.mjs +3 -1
- package/src/runtime.mjs +11 -2
- package/src/scaffold.mjs +15 -7
- package/templates/icons/LICENSE +43 -0
- package/templates/icons/lucide.json +1 -0
- package/templates/layouts/_deck.html +1 -1
- package/templates/layouts/chart.html +1 -1
- package/templates/layouts/features.html +8 -8
- package/templates/layouts/hero.html +6 -8
- package/templates/layouts/product.html +1 -1
- package/templates/narrated-deck.html +1 -1
package/src/firstDeck.mjs
CHANGED
|
@@ -52,6 +52,8 @@ export function fillFirstDeck({ html, title, answers, presenter, voice }) {
|
|
|
52
52
|
const note = (s) => swap(s, /\sdata-note="[^"]*"/, ' data-note="From your init answers."', "data-note");
|
|
53
53
|
let out = section(html, "hero", (s) => {
|
|
54
54
|
s = note(s);
|
|
55
|
+
// No art: the presenter is the opening's visual, and check fails on the stand-in.
|
|
56
|
+
s = swap(s, /\s*<div class="art"[^>]*><\/div>/, "", "hero art");
|
|
55
57
|
s = swap(s, /<div class="kicker">[^<]*<\/div>/, `<div class="kicker">${h(copy.hero.kicker)}</div>`, "hero kicker");
|
|
56
58
|
s = swap(s, /<h1 class="tt"[^>]*>[\s\S]*?<\/h1>/, `<h1 class="tt" data-title-mobile="${h(copy.hero.title)}">${h(copy.hero.title)}</h1>`, "hero title");
|
|
57
59
|
return swap(s, /<p class="lead">[\s\S]*?<\/p>/, `<p class="lead">${h(copy.hero.lead)}</p>`, "hero lead");
|
package/src/guide.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// each layout file's leading comment.
|
|
7
7
|
import { packageText } from "./files.mjs";
|
|
8
8
|
import { LAYOUTS, readLayout } from "./layouts.mjs";
|
|
9
|
+
import { fontPairingsMarkdown } from "./brand.mjs";
|
|
9
10
|
|
|
10
11
|
export const GUIDE_TOPICS = ["workflow", "format", "script", "design", "layouts", "presenter", "transitions", "check"];
|
|
11
12
|
const CLI_NOTE = "_Written for the CLI. On the hosted MCP there is no folder: use the tool names in `deck_guide` (workflow), hosted URLs for every file, and write_deck_source for edits._\n\n";
|
|
@@ -43,7 +44,8 @@ export function deckGuide(topic = "workflow") {
|
|
|
43
44
|
else {
|
|
44
45
|
const section = skillSection(packageText("skills/hyperdecks/SKILL.md"), t);
|
|
45
46
|
if (!section) throw new Error(`SKILL.md has no <!-- topic: ${t} --> section`);
|
|
46
|
-
|
|
47
|
+
// The design topic carries the curated font pairings (brand.mjs) in place of its marker.
|
|
48
|
+
text = CLI_NOTE + section.replace("<!-- font pairings -->", () => fontPairingsMarkdown());
|
|
47
49
|
}
|
|
48
50
|
return { topic: t, topics: GUIDE_TOPICS, text };
|
|
49
51
|
}
|
package/src/hosted.mjs
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// (source.mjs) share these; no local file I/O, so the route can bundle them.
|
|
4
4
|
import { api, client, target } from "./runtime.mjs";
|
|
5
5
|
import { PRESENTER_STYLES } from "./checkRules.mjs";
|
|
6
|
-
import { NARRATED_FILES, assembleLayoutDeck, fillTemplate } from "./layouts.mjs";
|
|
6
|
+
import { NARRATED_FILES, assembleLayoutDeck, fillTemplate, parseLayouts } from "./layouts.mjs";
|
|
7
|
+
import { applyBrand, brandForNewDeck, brandSummary } from "./brand.mjs";
|
|
8
|
+
import { getBrand } from "./ops.mjs";
|
|
7
9
|
|
|
8
10
|
export const SOURCE_FILES = Object.keys(NARRATED_FILES);
|
|
9
11
|
const SLUG = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
@@ -13,16 +15,22 @@ const urls = (opts, slug, previewToken) => {
|
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
// Scaffold the files (the same templates as deck new) and register the draft.
|
|
16
|
-
|
|
18
|
+
// The account's brand (colours, fonts, logo, presenter style) goes on the
|
|
19
|
+
// template unless brand is false; an explicit presenterStyle wins over it.
|
|
20
|
+
export async function hostedNewDeck(opts, { slug, title, layouts, presenterStyle, brand: useBrand } = {}) {
|
|
17
21
|
if (!slug || !title) throw new Error("slug and title are required");
|
|
18
22
|
if (!SLUG.test(slug)) throw new Error("slug must be lowercase letters, digits and dashes (max 64)");
|
|
19
23
|
if (presenterStyle !== undefined && !PRESENTER_STYLES.includes(presenterStyle)) throw new Error(`presenterStyle must be one of ${PRESENTER_STYLES.join(", ")}`);
|
|
20
24
|
const list = Array.isArray(layouts) ? layouts.join(",") : layouts;
|
|
25
|
+
if (list) parseLayouts(list);
|
|
26
|
+
const { brand, readError } = await brandForNewDeck(() => getBrand(opts), useBrand);
|
|
27
|
+
const style = presenterStyle ?? (PRESENTER_STYLES.includes(brand?.presenterStyle) ? brand.presenterStyle : undefined);
|
|
21
28
|
const files = list
|
|
22
|
-
? assembleLayoutDeck({ slug, title, presenterStyle, layouts: list })
|
|
23
|
-
: Object.fromEntries(Object.entries(NARRATED_FILES).map(([out, file]) => [out, fillTemplate(file, { slug, title, presenterStyle })]));
|
|
29
|
+
? assembleLayoutDeck({ slug, title, presenterStyle: style, layouts: list })
|
|
30
|
+
: Object.fromEntries(Object.entries(NARRATED_FILES).map(([out, file]) => [out, fillTemplate(file, { slug, title, presenterStyle: style })]));
|
|
31
|
+
files["index.html"] = applyBrand(files["index.html"], brand);
|
|
24
32
|
const made = await (await client(opts)).mutation(api.deckSources.create, { slug, title, files });
|
|
25
|
-
return { slug, rev: made.rev, files, ...urls(opts, slug, made.previewToken) };
|
|
33
|
+
return { slug, rev: made.rev, files, brand: brandSummary(brand, readError), ...urls(opts, slug, made.previewToken) };
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
export async function getDeckSource(opts, { slug, file } = {}) {
|
|
@@ -59,7 +67,7 @@ export async function hostedCheck(opts, { slug, forbid, maxDuration } = {}) {
|
|
|
59
67
|
return (await client(opts)).action(api.deckSources.check, { slug, ...(list?.length ? { forbid: list } : {}), ...(maxDuration ? { maxDuration: Number(maxDuration) } : {}) });
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
export async function hostedRelease(opts, { slug, recipients, qa, title, forbid, rev, voice } = {}) {
|
|
70
|
+
export async function hostedRelease(opts, { slug, recipients, qa, title, forbid, rev, voice, captionsOnly } = {}) {
|
|
63
71
|
if (!slug) throw new Error("slug is required");
|
|
64
72
|
const list = typeof forbid === "string" ? forbid.split(",").map((s) => s.trim()).filter(Boolean) : forbid;
|
|
65
73
|
const args = { slug };
|
|
@@ -69,6 +77,7 @@ export async function hostedRelease(opts, { slug, recipients, qa, title, forbid,
|
|
|
69
77
|
if (list?.length) args.forbid = list;
|
|
70
78
|
if (rev !== undefined && rev !== null) args.rev = Number(rev);
|
|
71
79
|
if (voice) args.voice = String(voice);
|
|
80
|
+
if (captionsOnly) args.captionsOnly = true;
|
|
72
81
|
return (await client(opts)).action(api.deckSources.release, args);
|
|
73
82
|
}
|
|
74
83
|
|
package/src/icons.mjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// hyperdecks icons search <word> [--limit N] [--stroke-width N]
|
|
2
|
+
//
|
|
3
|
+
// The icon library: Lucide's open-source line icons (ISC licence, vendored in
|
|
4
|
+
// templates/icons/lucide.json by scripts/sync-icons.mjs). A search returns
|
|
5
|
+
// inline SVG stroked in currentColor, so a pasted icon takes the colour of the
|
|
6
|
+
// text around it, i.e. the deck's palette. No network and no credits; for
|
|
7
|
+
// illustrated icons in a style of your own, `hyperdecks icons <subject...>
|
|
8
|
+
// --style` (generate_icon_set) still draws them.
|
|
9
|
+
import { packageText } from "./files.mjs";
|
|
10
|
+
|
|
11
|
+
export const MAX_ICON_RESULTS = 24;
|
|
12
|
+
const DEFAULT_RESULTS = 8;
|
|
13
|
+
let library;
|
|
14
|
+
const lib = () => (library ??= JSON.parse(packageText("templates/icons/lucide.json")));
|
|
15
|
+
|
|
16
|
+
export function iconSvg(name, { strokeWidth = 2 } = {}) {
|
|
17
|
+
const icon = lib().icons[name];
|
|
18
|
+
if (!icon) return null;
|
|
19
|
+
const sw = Number(strokeWidth);
|
|
20
|
+
const width = Number.isFinite(sw) && sw > 0 && sw <= 4 ? sw : 2;
|
|
21
|
+
return `<svg class="icon lucide-${name}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${width}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icon[0]}</svg>`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Best matches first: the exact name, a name starting with or containing a
|
|
25
|
+
// word, then an exact tag, then a tag containing a word. Several words rank by
|
|
26
|
+
// how many of them match.
|
|
27
|
+
export function searchIcons({ query, limit, strokeWidth } = {}) {
|
|
28
|
+
const words = String(query ?? "").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
|
|
29
|
+
if (!words.length) throw new Error("search needs a word, e.g. rocket");
|
|
30
|
+
const n = Math.min(Math.max(Number(limit) || DEFAULT_RESULTS, 1), MAX_ICON_RESULTS);
|
|
31
|
+
const phrase = words.join("-");
|
|
32
|
+
const scored = [];
|
|
33
|
+
for (const [name, [, tagText]] of Object.entries(lib().icons)) {
|
|
34
|
+
const parts = name.split("-");
|
|
35
|
+
const tags = tagText ? tagText.split(",") : [];
|
|
36
|
+
let score = name === phrase ? 100 : 0;
|
|
37
|
+
for (const w of words) {
|
|
38
|
+
if (parts[0] === w) score += 12;
|
|
39
|
+
else if (parts.includes(w)) score += 10;
|
|
40
|
+
else if (name.includes(w)) score += 6;
|
|
41
|
+
else if (tags.includes(w)) score += 5;
|
|
42
|
+
else if (tags.some((t) => t.split(" ").includes(w))) score += 3;
|
|
43
|
+
else if (tags.some((t) => t.includes(w))) score += 1;
|
|
44
|
+
}
|
|
45
|
+
// Plainer icons first among equals: rocket before rocket-launch.
|
|
46
|
+
if (score) scored.push({ name, tags, score: score - parts.length * 0.1 });
|
|
47
|
+
}
|
|
48
|
+
scored.sort((a, b) => b.score - a.score || a.name.localeCompare(b.name));
|
|
49
|
+
return {
|
|
50
|
+
query: words.join(" "),
|
|
51
|
+
library: lib().source,
|
|
52
|
+
license: lib().license,
|
|
53
|
+
total: scored.length,
|
|
54
|
+
icons: scored.slice(0, n).map(({ name, tags }) => ({ name, tags, svg: iconSvg(name, { strokeWidth }) })),
|
|
55
|
+
usage: "Paste svg inline (e.g. in .l-features .card). It is stroked in currentColor: set `color` on it or its parent to put it in the deck's palette.",
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function icons(pos, opts = {}, { log = (line) => console.log(line) } = {}) {
|
|
60
|
+
const out = searchIcons({ query: pos.join(" "), limit: opts.limit, strokeWidth: opts["stroke-width"] });
|
|
61
|
+
if (opts.json) return out;
|
|
62
|
+
if (!out.icons.length) log(`no icons match "${out.query}"; try a plainer word (e.g. chart, user, lock)`);
|
|
63
|
+
for (const icon of out.icons) log(`${icon.name}${icon.tags.length ? ` (${icon.tags.slice(0, 5).join(", ")})` : ""}\n${icon.svg}\n`);
|
|
64
|
+
if (out.icons.length) log(`${out.icons.length} of ${out.total} from ${out.library}. ${out.usage}`);
|
|
65
|
+
return out;
|
|
66
|
+
}
|
package/src/narrate.mjs
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { basename, join, resolve } from "node:path";
|
|
10
10
|
import * as ops from "./ops.mjs";
|
|
11
|
+
import { presenterLine } from "./presenter.mjs";
|
|
11
12
|
export { sectionIds, setManifestUrl } from "./checkRules.mjs";
|
|
12
13
|
import { sectionIds, setManifestUrl } from "./checkRules.mjs";
|
|
13
14
|
|
|
@@ -46,10 +47,14 @@ export async function narrate(pos, opts = {}, { log = (line) => console.log(line
|
|
|
46
47
|
for (const s of preview.slides) log(`${s.render ? "render" : s.cached ? "cached" : "skip "} ${s.id} ${s.hash.slice(0, 12)} ${s.chars} chars${s.presenterStyle ? ` presenter-style: ${s.presenterStyle}` : ""}`);
|
|
47
48
|
const render = preview.slides.filter((s) => s.render);
|
|
48
49
|
log(`${render.length} of ${preview.slides.length} slide(s) would render in voice "${preview.voice}", ~${render.reduce((n, s) => n + s.chars, 0)} characters of TTS`);
|
|
50
|
+
const who = presenterLine(preview.presenter);
|
|
51
|
+
if (who) log(who);
|
|
49
52
|
return preview;
|
|
50
53
|
}
|
|
51
|
-
const { jobId, slides } = await ops.narrateDeck(opts, fields);
|
|
54
|
+
const { jobId, slides, presenter } = await ops.narrateDeck(opts, fields);
|
|
52
55
|
log(`narration job ${jobId}: ${slides.filter((s) => s.status === "render").length} to render, ${slides.filter((s) => s.status === "cached").length} cached`);
|
|
56
|
+
const who = presenterLine(presenter);
|
|
57
|
+
if (who) log(who);
|
|
53
58
|
const seen = new Map();
|
|
54
59
|
const job = await ops.pollNarrationJob(opts, jobId, {
|
|
55
60
|
onProgress: (j) => {
|
|
@@ -63,6 +68,8 @@ export async function narrate(pos, opts = {}, { log = (line) => console.log(line
|
|
|
63
68
|
},
|
|
64
69
|
});
|
|
65
70
|
if (job.status === "error") throw new Error(job.error || "narration failed");
|
|
71
|
+
// release reads who presents from here (older backends send no presenter).
|
|
72
|
+
if (presenter) job.presenter = presenter;
|
|
66
73
|
if (!job.manifest) {
|
|
67
74
|
log(`⚠ ${job.notice || "done, but no manifest was written"}`);
|
|
68
75
|
return job;
|
package/src/ops.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { zipSync } from "fflate";
|
|
2
|
+
import { COLOR_KEYS, FONT_PAIRINGS, FONT_ROLES, findPairing, googleFontsUrl } from "./brand.mjs";
|
|
2
3
|
import { api, client, target, uploadBytes as runtimeUploadBytes } from "./runtime.mjs";
|
|
3
4
|
import {
|
|
4
5
|
bytesFromText,
|
|
@@ -1088,6 +1089,58 @@ export async function setDeckNarrator(opts, slug, ref) {
|
|
|
1088
1089
|
return (await client(opts)).mutation(api.narrators.setDeckNarrator, { slug, narrator: value });
|
|
1089
1090
|
}
|
|
1090
1091
|
|
|
1092
|
+
// The account's brand (convex/brand.ts): what new_deck / deck new start from.
|
|
1093
|
+
export async function getBrand(opts = {}) {
|
|
1094
|
+
return (await client(opts)).query(api.brand.get, {});
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// Merge into the saved brand: a field left out keeps its value, "" clears it.
|
|
1098
|
+
// fontPairing names one of FONT_PAIRINGS and fills the three fonts (an explicit
|
|
1099
|
+
// font still wins). logoUrl is fetched into our storage; logoBytes (with
|
|
1100
|
+
// logoType) is a file the CLI read. clearLogo removes the logo.
|
|
1101
|
+
export async function setBrand(opts, { name, designMd, colors, fonts, fontPairing, presenterStyle, logoUrl, logoBytes, logoType, clearLogo } = {}) {
|
|
1102
|
+
const c = await client(opts);
|
|
1103
|
+
let fontSet = fonts;
|
|
1104
|
+
if (fontPairing) {
|
|
1105
|
+
const p = findPairing(fontPairing);
|
|
1106
|
+
if (!p) throw new Error(`no font pairing "${fontPairing}": pick one of ${FONT_PAIRINGS.map((x) => x.id).join(", ")}`);
|
|
1107
|
+
fontSet = { display: p.display, body: p.body, mono: p.mono, ...(fonts ?? {}) };
|
|
1108
|
+
}
|
|
1109
|
+
if (logoUrl && logoBytes) throw new Error("pass logoUrl or a logo file, not both");
|
|
1110
|
+
if (clearLogo && (logoUrl || logoBytes)) throw new Error("clearLogo removes the logo; do not also pass one");
|
|
1111
|
+
const known = (map, keys, what) => {
|
|
1112
|
+
const extra = Object.keys(map ?? {}).filter((k) => !keys.includes(k));
|
|
1113
|
+
if (extra.length) throw new Error(`unknown ${what} ${extra.join(", ")}: use ${keys.join(", ")}`);
|
|
1114
|
+
return map;
|
|
1115
|
+
};
|
|
1116
|
+
known(colors, COLOR_KEYS, "colour");
|
|
1117
|
+
known(fontSet, FONT_ROLES, "font role");
|
|
1118
|
+
const fields = { name, designMd, colors, fonts: fontSet, presenterStyle };
|
|
1119
|
+
const defined = Object.fromEntries(Object.entries(fields).filter(([, v]) => v !== undefined && v !== null));
|
|
1120
|
+
if (!Object.keys(defined).length && !logoUrl && !logoBytes && !clearLogo) throw new Error("nothing to set: pass colors, fonts, fontPairing, logoUrl, designMd, name or presenterStyle");
|
|
1121
|
+
let out = Object.keys(defined).length ? await c.mutation(api.brand.set, defined) : null;
|
|
1122
|
+
try {
|
|
1123
|
+
if (clearLogo) out = await c.mutation(api.brand.clear, { logoOnly: true });
|
|
1124
|
+
if (logoUrl) out = await c.action(api.brandNode.importLogo, { url: String(logoUrl) });
|
|
1125
|
+
if (logoBytes) {
|
|
1126
|
+
const bytes = logoBytes instanceof ArrayBuffer ? logoBytes : new Uint8Array(logoBytes).slice().buffer;
|
|
1127
|
+
out = await c.action(api.brandNode.uploadLogo, { bytes, contentType: String(logoType ?? "") });
|
|
1128
|
+
}
|
|
1129
|
+
} catch (e) {
|
|
1130
|
+
// The fields above are already saved: say so, so nobody redoes or reports them as lost.
|
|
1131
|
+
const kept = Object.keys(defined);
|
|
1132
|
+
throw new Error(`${kept.length ? `brand saved (${kept.join(", ")}) but the logo was not` : "the logo was not saved"}: ${errorText(e)}`);
|
|
1133
|
+
}
|
|
1134
|
+
return out ?? getBrand(opts);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
export async function clearBrand(opts = {}) {
|
|
1138
|
+
await (await client(opts)).mutation(api.brand.clear, {});
|
|
1139
|
+
return { cleared: true };
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
export const listFontPairings = () => ({ pairings: FONT_PAIRINGS.map((p) => ({ ...p, urls: [googleFontsUrl(p.display, "display"), googleFontsUrl(p.body, "body"), googleFontsUrl(p.mono, "mono")] })) });
|
|
1143
|
+
|
|
1091
1144
|
// Polls `read` until `done`; a few failed reads in a row (a network blip) are
|
|
1092
1145
|
// retried, since the person may still be finishing in the browser.
|
|
1093
1146
|
async function pollUntil(read, done, { intervalMs = 2000, timeoutMs }) {
|
package/src/presenter.mjs
CHANGED
|
@@ -26,3 +26,12 @@ export function withAvatar(html, { avatarUrl, imageUrl }) {
|
|
|
26
26
|
const next = none ? tag.replace(/\sdata-presenter="none"/, face) : tag.replace(/>$/, `${face}>`);
|
|
27
27
|
return html.replace(tag, () => next);
|
|
28
28
|
}
|
|
29
|
+
|
|
30
|
+
// One line for who presents a deck, from narrate's or release's `presenter`
|
|
31
|
+
// ({ narrator, voice, face, reason }); a warning when it plays captions only.
|
|
32
|
+
// Empty for an older backend that sends none.
|
|
33
|
+
export function presenterLine(p) {
|
|
34
|
+
if (!p) return "";
|
|
35
|
+
if (!p.face) return `⚠ captions only: ${p.reason ?? `no face for voice "${p.voice}"`}`;
|
|
36
|
+
return `presented by ${p.face}${p.narrator && p.narrator !== p.face ? ` (narrator ${p.narrator})` : ""}, voice "${p.voice}"`;
|
|
37
|
+
}
|
package/src/release.mjs
CHANGED
|
@@ -108,6 +108,8 @@ export async function release(pos, opts = {}, io = {}) {
|
|
|
108
108
|
}
|
|
109
109
|
const released = presenter ? releaseBundle(deckDir, presenter) : bundle;
|
|
110
110
|
if (presenter) log("✓ presented by your avatar");
|
|
111
|
+
// A terminal user sees this before it ships, so the CLI warns rather than refuses.
|
|
112
|
+
else if (job.presenter && !job.presenter.face) log(`⚠ releasing captions only: ${job.presenter.reason ?? "no face"}`);
|
|
111
113
|
const imported = await ops.importDeckFromBytes(opts, {
|
|
112
114
|
slug,
|
|
113
115
|
title: opts.title,
|
|
@@ -142,5 +144,5 @@ export async function release(pos, opts = {}, io = {}) {
|
|
|
142
144
|
log(`✓ share for "${r.recipient}"${share.qa ? " (QA, untracked)" : ""} → ${share.url}`);
|
|
143
145
|
}
|
|
144
146
|
if (!shares.length) log(` no --to given: \`hyperdecks share new ${imported.slug} "Me" --qa\` makes a link for your own viewing`);
|
|
145
|
-
return { slug: imported.slug, deckDir, commit: sha, deckUrl: imported.deckUrl, totalDuration: checked.totalDuration, files: bundle.files, shares };
|
|
147
|
+
return { slug: imported.slug, deckDir, commit: sha, deckUrl: imported.deckUrl, totalDuration: checked.totalDuration, presenter: job.presenter ?? null, files: bundle.files, shares };
|
|
146
148
|
}
|
package/src/runtime.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
import { ConvexHttpClient } from "convex/browser";
|
|
9
9
|
import { makeFunctionReference } from "convex/server";
|
|
10
10
|
|
|
11
|
-
export const VERSION = "0.
|
|
11
|
+
export const VERSION = "0.6.0";
|
|
12
12
|
const UPLOAD_TIMEOUT_MS = 125_000;
|
|
13
13
|
|
|
14
14
|
export const PROD = {
|
|
@@ -43,6 +43,15 @@ export const api = {
|
|
|
43
43
|
rename: makeFunctionReference("narrators:rename"),
|
|
44
44
|
setFace: makeFunctionReference("narrators:setFace"),
|
|
45
45
|
},
|
|
46
|
+
brand: {
|
|
47
|
+
get: makeFunctionReference("brand:get"),
|
|
48
|
+
set: makeFunctionReference("brand:set"),
|
|
49
|
+
clear: makeFunctionReference("brand:clear"),
|
|
50
|
+
},
|
|
51
|
+
brandNode: {
|
|
52
|
+
importLogo: makeFunctionReference("brandNode:importLogo"),
|
|
53
|
+
uploadLogo: makeFunctionReference("brandNode:uploadLogo"),
|
|
54
|
+
},
|
|
46
55
|
narratorsNode: {
|
|
47
56
|
hear: makeFunctionReference("narratorsNode:hear"),
|
|
48
57
|
},
|
|
@@ -136,7 +145,7 @@ export const api = {
|
|
|
136
145
|
},
|
|
137
146
|
};
|
|
138
147
|
|
|
139
|
-
const BOOL = new Set(["prod", "dev", "admin", "json", "require-email", "qa", "no-notify", "allow-forward", "no-forward", "help", "version", "all-agents", "global", "project", "transparent", "upload", "dry-run", "narrated", "layout", "full-page", "force", "hosted", "yes", "no-voice", "no-skill", "no-release", "no-open", "save-to-minimoji"]);
|
|
148
|
+
const BOOL = new Set(["prod", "dev", "admin", "json", "require-email", "qa", "no-notify", "allow-forward", "no-forward", "help", "version", "all-agents", "global", "project", "transparent", "upload", "dry-run", "narrated", "layout", "full-page", "force", "hosted", "yes", "no-voice", "no-skill", "no-release", "no-open", "save-to-minimoji", "captions-only", "no-brand", "no-logo"]);
|
|
140
149
|
// release's recipients, in order: each --to starts one, and an --email right
|
|
141
150
|
// after it belongs to it (`--to A --email a --to B`). Collected as opts.recipients;
|
|
142
151
|
// opts.email stays the last --email for the other commands (share new).
|
package/src/scaffold.mjs
CHANGED
|
@@ -9,12 +9,13 @@ import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
|
9
9
|
import { join, resolve } from "node:path";
|
|
10
10
|
import * as ops from "./ops.mjs";
|
|
11
11
|
import { PRESENTER_STYLES } from "./checkRules.mjs";
|
|
12
|
-
import { LAYOUTS, NARRATED_FILES, assembleLayoutDeck, fillTemplate } from "./layouts.mjs";
|
|
12
|
+
import { LAYOUTS, NARRATED_FILES, assembleLayoutDeck, fillTemplate, parseLayouts } from "./layouts.mjs";
|
|
13
|
+
import { applyBrand, brandForNewDeck, brandSummary } from "./brand.mjs";
|
|
13
14
|
|
|
14
15
|
export { LAYOUTS, NARRATED_FILES, assembleLayoutDeck, fillTemplate, parseLayouts, readLayout } from "./layouts.mjs";
|
|
15
16
|
|
|
16
17
|
const SLUG = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
17
|
-
const USAGE = 'usage: deck new <slug> "<title>" --narrated [--layouts hero,product,number,closer] [--presenter-style <stage|bubble|glass|corner>] [--dir <path>]';
|
|
18
|
+
const USAGE = 'usage: deck new <slug> "<title>" --narrated [--layouts hero,product,number,closer] [--presenter-style <stage|bubble|glass|corner>] [--no-brand] [--dir <path>]';
|
|
18
19
|
|
|
19
20
|
export async function deckNew(pos, opts = {}, { log = (line) => console.log(line), cwd = process.cwd() } = {}) {
|
|
20
21
|
const [slug, title] = pos;
|
|
@@ -28,9 +29,15 @@ export async function deckNew(pos, opts = {}, { log = (line) => console.log(line
|
|
|
28
29
|
const dir = resolve(/*turbopackIgnore: true*/ cwd, typeof opts.dir === "string" ? opts.dir : join("decks", slug));
|
|
29
30
|
if (existsSync(dir)) throw new Error(`${dir} already exists; pick another slug or --dir`);
|
|
30
31
|
if (opts.layouts === true) throw new Error(`--layouts needs a list, e.g. --layouts ${LAYOUTS.slice(0, 3).join(",")},closer`);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
if (opts.layouts !== undefined) parseLayouts(opts.layouts);
|
|
33
|
+
// The account's brand goes on the template (--no-brand: the template's look);
|
|
34
|
+
// an explicit --presenter-style wins over the brand's.
|
|
35
|
+
const { brand, readError } = await brandForNewDeck(() => ops.getBrand(opts), !(opts["no-brand"] || opts.brand === false));
|
|
36
|
+
const style = presenterStyle ?? (PRESENTER_STYLES.includes(brand?.presenterStyle) ? brand.presenterStyle : undefined);
|
|
37
|
+
const files = (opts.layouts !== undefined
|
|
38
|
+
? Object.entries(assembleLayoutDeck({ slug, title, presenterStyle: style, layouts: opts.layouts }))
|
|
39
|
+
: Object.entries(NARRATED_FILES).map(([out, file]) => [out, fillTemplate(file, { slug, title, presenterStyle: style })]))
|
|
40
|
+
.map(([out, text]) => [out, out === "index.html" ? applyBrand(text, brand) : text]);
|
|
34
41
|
await ops.createDeck(opts, { slug, title });
|
|
35
42
|
try {
|
|
36
43
|
mkdirSync(dir, { recursive: true });
|
|
@@ -39,6 +46,7 @@ export async function deckNew(pos, opts = {}, { log = (line) => console.log(line
|
|
|
39
46
|
rmSync(dir, { recursive: true, force: true });
|
|
40
47
|
throw new Error(`deck ${slug} is registered but its files could not be written (${e.message}); remove the draft with \`hyperdecks deck rm ${slug}\` and run deck new again`);
|
|
41
48
|
}
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const summary = brandSummary(brand, readError);
|
|
50
|
+
log(`✓ created deck "${slug}" → ${dir}\n files: ${Object.keys(NARRATED_FILES).join(", ")}\n brand: ${summary.error ? `could not read it (${summary.error}); template look` : summary.applied.length ? summary.applied.join(", ") : "none applied (hyperdecks brand set)"}\n next: hyperdecks narrate ${dir} --dry-run`);
|
|
51
|
+
return { slug, title, dir, files: Object.keys(NARRATED_FILES), brand: summary };
|
|
44
52
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
The following Lucide icons are derived from the Feather project:
|
|
20
|
+
|
|
21
|
+
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT) (for the icons listed above)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2013-present Cole Bemis
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|