@hypersocial/decks-cli 0.9.1 → 0.9.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypersocial/decks-cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Command-line client for Hypersocial Decks live analytics and share management.",
5
5
  "type": "module",
6
6
  "main": "./src/commands.mjs",
@@ -143,6 +143,7 @@ Hyperdecks server; use the CLI where you have a shell and the tool otherwise.
143
143
  | Watch a draft with its real face | `hyperdecks play decks/<slug>` | the `previewUrl` from `get_deck_source` |
144
144
  | Ship | `hyperdecks release decks/<slug> --to "<name>" --email <e>` | `release_deck` |
145
145
  | Share-link poster | `hyperdecks poster <slug>` | `generate_deck_poster` |
146
+ | PDF for a data room or attachment | `hyperdecks export <slug> --pdf [--notes] --out deck.pdf`, `hyperdecks export list` | `export_deck`, `list_exports` |
146
147
  | Import only | `hyperdecks import <file> --slug <slug>` | `import_deck_from_url` |
147
148
  | One more link | `hyperdecks share new <slug> "<name>" [--no-forward]` | `create_share` (`allowForward`) |
148
149
  | Forwarding, one link | `hyperdecks share forward on\|off\|default <token>` | `set_share_forwarding` |
@@ -611,8 +612,13 @@ still.
611
612
  `voice clone` (it asks them for consent; never clone anyone else's voice).
612
613
  - Names speech-to-text spells another way fail narrate's transcript check
613
614
  (step 4). Map what it heard to what you wrote with a `normalize:` entry in
614
- the front matter, `heard=written`, comma-separated: a clip that says
615
- "Minimoji" but is transcribed as "Moji" needs `normalize: moji=minimoji`.
615
+ the front matter, `heard=written`, several on one line, comma-separated: a
616
+ clip that says "Minimoji" but is transcribed as "Moji" needs
617
+ `normalize: moji=minimoji`, and with a second entry
618
+ `normalize: moji=minimoji, dash=D.A.S.H.` (one line, not a YAML list).
619
+ - Write a narrator's name as it is spoken when the two differ, or leave it to
620
+ the narrator's spoken name: `narrator list` shows it, and narrate reads
621
+ "D.A.S.H." as "Dash" (captions keep what you wrote).
616
622
 
617
623
  ### 4. Narrate and read the guard
618
624
 
@@ -96,6 +96,13 @@ makes the hello deck; continue from step 5 below.
96
96
  `set_recipient_archived` to tidy the activity feed; `credits` for the
97
97
  balance. `remove_deck` deletes a deck and breaks every link to it: confirm
98
98
  with the user first.
99
+ 11. When someone asks for "the PDF" (a data room, an attachment):
100
+ `export_deck { slug, kind: "pdf", notes? }` renders the released deck, one
101
+ 1600×900 page per slide with a footer carrying its tracked link (pass
102
+ `shareToken` to choose which), and returns a download `url` that lasts 30
103
+ days; `notes: true` adds the slide's script after each slide.
104
+ `list_exports` shows what was exported. Release first: it prints the live
105
+ deck, not the draft.
99
106
 
100
107
  ## Rules that matter
101
108
 
package/src/commands.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { readFileSync, writeFileSync } from "node:fs";
1
+ import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { basename, join, resolve } from "node:path";
2
3
  import {
3
4
  installHyperdecksSkill,
4
5
  login,
@@ -409,6 +410,11 @@ commands:
409
410
  review <slug> [--script <script.md>] [--json]
410
411
  GPT-6 Luna reviews every slide (desktop + phone screenshots) and lists what to fix
411
412
  review-job <jobId> [--json]
413
+ export <slug|deck-dir> --pdf [--notes] [--out <file.pdf>] [--share <token>] [--json]
414
+ a PDF of the released deck: one 1600x900 page per slide (a script page after each
415
+ with --notes), a footer with the deck's tracked link; kept 30 days
416
+ export list [<slug>] [--json] your exports and their download links
417
+ export rm <exportId> delete an export now
412
418
  poster <slug> [--force] [--json]
413
419
  regenerate the share-link poster (release makes one) and print its URL
414
420
  credits [--limit <n>] [--json] show your credit balance and recent history
@@ -440,7 +446,7 @@ commands:
440
446
  narrator default <name|id|dash> make it the default
441
447
  narrator remove <name|id> remove it; decks already shared keep working
442
448
  narrator voice <name|id> <voice> change its voice (one of yours, or dash)
443
- narrator rename <name|id> <new name> rename it
449
+ narrator rename <name|id> [<new name>] [--say <spoken name>] rename it, or say how it is spoken ("" clears)
444
450
  narrator face <name|id> <avatar> change its face (one of your avatars)
445
451
  deck narrator <slug> <name|id|none|default> the deck's own narrator (none: captions only)
446
452
 
@@ -663,6 +669,47 @@ async function reviewJob(pos, opts) {
663
669
  printReview(job);
664
670
  }
665
671
 
672
+ // hyperdecks export <slug|deck-dir> --pdf: a local deck folder exports its
673
+ // released copy (the slug is --slug or the folder's name) with its own script.md
674
+ // (for its [reveal] cues and --notes); nothing renders locally.
675
+ export function exportTarget(arg, opts = {}, cwd = process.cwd()) {
676
+ const dir = [resolve(cwd, arg), join(cwd, "decks", arg)].find((d) => existsSync(join(d, "index.html")));
677
+ if (!dir) return { slug: arg, script: undefined };
678
+ const scriptPath = join(dir, "script.md");
679
+ return { slug: opts.slug || basename(dir), script: existsSync(scriptPath) ? readFileSync(scriptPath, "utf8") : undefined };
680
+ }
681
+
682
+ async function exportCmd(pos, opts) {
683
+ const [arg] = pos;
684
+ const usage = "usage: export <slug|deck-dir> --pdf [--notes] [--out <file.pdf>] [--share <token>]";
685
+ if (!arg) throw new Error(usage);
686
+ if (opts.mp4 || opts.gif) throw new Error("only --pdf exports are available so far (video comes later; the email GIF is `hyperdecks preview create`)");
687
+ if (!opts.pdf) throw new Error(`${usage}\n(--pdf is the only format so far)`);
688
+ const { slug, script } = exportTarget(arg, opts);
689
+ if (slug !== arg) process.stderr.write(`deck folder ${arg} → slug ${slug} (pass --slug to change it)\n`);
690
+ process.stderr.write(`rendering ${slug} as a PDF${opts.notes ? " with notes" : ""}…\n`);
691
+ const out = await ops.exportDeck(opts, { slug, kind: "pdf", notes: !!opts.notes, script, shareToken: opts.share });
692
+ const file = opts.out === true ? out.filename : opts.out || out.filename;
693
+ await saveTo(file, out.url);
694
+ if (opts.json) return void console.log(JSON.stringify({ ...out, file }, null, 2));
695
+ console.log(`✓ ${out.pages} page(s), ${(out.bytes / 1e6).toFixed(1)} MB → ${file}`);
696
+ console.log(` footer link: ${out.link}`);
697
+ for (const w of out.warnings ?? []) console.log(` ⚠ ${w}`);
698
+ console.log(` download (30 days): ${out.url}`);
699
+ }
700
+
701
+ async function exportList(pos, opts) {
702
+ const rows = await ops.listExports(opts, { slug: pos[0] });
703
+ if (opts.json) return void console.log(JSON.stringify(rows, null, 2));
704
+ if (!rows.length) return void console.log("no exports in the last 30 days");
705
+ for (const r of rows) {
706
+ const when = new Date(r.createdAt).toISOString().slice(0, 16).replace("T", " ");
707
+ const what = r.status === "ready" ? `${r.pages} pages, ${((r.bytes ?? 0) / 1e6).toFixed(1)} MB` : r.status === "failed" ? `failed: ${r.error}` : r.status;
708
+ console.log(`${r.exportId} ${when} ${r.slug} ${r.kind}${r.notes ? "+notes" : ""} ${what}`);
709
+ if (r.url) console.log(` ${r.url}`);
710
+ }
711
+ }
712
+
666
713
  async function poster(pos, opts) {
667
714
  const [slug] = pos;
668
715
  if (!slug) throw new Error("usage: poster <slug> [--force] [--json]");
@@ -851,9 +898,11 @@ function commandTable(pos, rest, opts) {
851
898
  console.log(opts.json ? JSON.stringify(out, null, 2) : `OK ${out.name} speaks in ${out.voice} now`);
852
899
  },
853
900
  "narrator rename": async () => {
854
- if (rest.length < 2) throw new Error("usage: narrator rename <name|id> <new name>");
855
- const out = await ops.renameNarrator(opts, rest[0], rest.slice(1).join(" "));
856
- console.log(opts.json ? JSON.stringify(out, null, 2) : `OK ${out.was} is ${out.name} now`);
901
+ if (Object.hasOwn(opts, "say") && (opts.say === undefined || String(opts.say).startsWith("--"))) throw new Error('--say needs a value (--say "" clears it)');
902
+ const say = Object.hasOwn(opts, "say") ? String(opts.say) : undefined;
903
+ if (rest.length < 1 || (rest.length < 2 && say === undefined)) throw new Error("usage: narrator rename <name|id> [<new name>] [--say <spoken name>]");
904
+ const out = await ops.renameNarrator(opts, rest[0], rest.slice(1).join(" "), say);
905
+ console.log(opts.json ? JSON.stringify(out, null, 2) : `OK ${out.was} is ${out.name} now${out.spokenName ? `, said "${out.spokenName}"` : ""}`);
857
906
  },
858
907
  "narrator face": async () => {
859
908
  if (rest.length < 2) throw new Error("usage: narrator face <name|id> <avatar>");
@@ -928,6 +977,13 @@ function commandTable(pos, rest, opts) {
928
977
  review: () => review(pos.slice(1), opts),
929
978
  "review-job": () => reviewJob(pos.slice(1), opts),
930
979
  poster: () => poster(pos.slice(1), opts),
980
+ export: () => exportCmd(pos.slice(1), opts),
981
+ "export list": () => exportList(pos.slice(2), opts),
982
+ "export rm": async () => {
983
+ if (!pos[2]) throw new Error("usage: export rm <exportId>");
984
+ const out = await ops.removeExport(opts, { exportId: pos[2] });
985
+ console.log(opts.json ? JSON.stringify(out) : `✓ removed ${pos[2]}`);
986
+ },
931
987
  credits: () => credits(pos.slice(1), opts),
932
988
  };
933
989
  }
package/src/firstDeck.mjs CHANGED
@@ -6,7 +6,8 @@ import { packageText } from "./files.mjs";
6
6
  import { slugify } from "./importer.mjs";
7
7
 
8
8
  export const FIRST_DECK_LAYOUTS = "hero,features,closer";
9
- export const DASH_AVATAR = "https://decks.hypersocial.ai/player/v1/dash-avatar.json";
9
+ export { DASH_AVATAR } from "./presenter.mjs";
10
+ import { DASH_AVATAR } from "./presenter.mjs";
10
11
  export const ANSWER_MAX = { name: 40, about: 80, ask: 80 };
11
12
 
12
13
  // One answer as it goes on a slide and into the script: one line, no stage-tag
package/src/narrator.mjs CHANGED
@@ -11,7 +11,7 @@ const interactiveOf = (opts) => !opts.json && !!process.stdin.isTTY && !!process
11
11
  export async function narratorList(opts, { log = console.log } = {}) {
12
12
  const out = await ops.listNarrators(opts);
13
13
  if (opts.json) return out;
14
- for (const n of out.narrators) log(`${n.isDefault ? "*" : " "} ${n.name}\t${n.face ?? "(no face)"} · ${n.voice ? `${n.voice}${n.voiceReady ? "" : " (not ready)"}` : "(voice removed)"}\t${n.id}`);
14
+ for (const n of out.narrators) log(`${n.isDefault ? "*" : " "} ${n.name}${n.spokenName && n.spokenName !== n.name ? ` (said "${n.spokenName}")` : ""}\t${n.face ?? "(no face)"} · ${n.voice ? `${n.voice}${n.voiceReady ? "" : " (not ready)"}` : "(voice removed)"}\t${n.id}`);
15
15
  if (out.note) log(`\n${out.note}`);
16
16
  log("\n* the default; decks use it unless they set their own (deck narrator <slug> <id>)");
17
17
  return out;
package/src/ops.mjs CHANGED
@@ -200,6 +200,33 @@ export async function generatePoster(opts, fields = {}) {
200
200
  return (await client(opts)).action(api.posters.generatePoster, args);
201
201
  }
202
202
 
203
+ // ---- deck exports (convex/exports.ts) -------------------------------------
204
+
205
+ // Render a PDF of a released deck you own (one 1600x900 page per slide, a notes
206
+ // page after each with notes=true, a footer with the deck's tracked link) and
207
+ // keep it 30 days. Returns { exportId, url, filename, bytes, pages, slides,
208
+ // notes, link, expiresAt }. Waits for the file (about a second per slide).
209
+ export async function exportDeck(opts, fields = {}) {
210
+ if (!fields.slug) throw new Error("slug is required");
211
+ const kind = fields.kind ?? "pdf";
212
+ if (kind !== "pdf") throw new Error(`kind "${kind}" is not supported yet: only "pdf" (video export comes from \`hyperdecks export --mp4\` later)`);
213
+ const args = { slug: String(fields.slug), kind: "pdf" };
214
+ if (fields.notes) args.notes = true;
215
+ if (fields.script) args.script = String(fields.script);
216
+ if (fields.shareToken) args.shareToken = String(fields.shareToken);
217
+ return (await client(opts)).action(api.exports.create, args);
218
+ }
219
+
220
+ // Your exports (newest first, 30 days), optionally for one deck.
221
+ export async function listExports(opts, fields = {}) {
222
+ return (await client(opts)).query(api.exports.list, fields.slug ? { slug: String(fields.slug) } : {});
223
+ }
224
+
225
+ export async function removeExport(opts, fields = {}) {
226
+ if (!fields.exportId) throw new Error("exportId is required");
227
+ return (await client(opts)).mutation(api.exports.remove, { exportId: String(fields.exportId) });
228
+ }
229
+
203
230
  // ---- deck review (convex/review.ts) --------------------------------------
204
231
 
205
232
  // Queue a GPT-6 Luna review of every slide (desktop + phone screenshots of the
@@ -1017,7 +1044,7 @@ export async function listNarrators(opts = {}) {
1017
1044
  return {
1018
1045
  default: out.defaultId,
1019
1046
  ...(out.unpickedVoice ? { note: `no default narrator yet: decks narrate in your voice "${out.unpickedVoice}"` } : {}),
1020
- narrators: out.narrators.map((n) => ({ id: n.id, name: n.name, isDefault: n.isDefault, builtin: n.builtin, face: n.face?.name ?? null, voice: n.voice?.name ?? null, voiceReady: !!n.voice?.ready })),
1047
+ narrators: out.narrators.map((n) => ({ id: n.id, name: n.name, spokenName: n.spokenName ?? null, isDefault: n.isDefault, builtin: n.builtin, face: n.face?.name ?? null, voice: n.voice?.name ?? null, voiceReady: !!n.voice?.ready })),
1021
1048
  voices: out.voices.map((x) => ({ id: x.ref, name: x.name, status: x.status, character: x.character, narrators: x.narrators })),
1022
1049
  };
1023
1050
  }
@@ -1068,12 +1095,20 @@ export async function setNarratorVoice(opts, ref, voice) {
1068
1095
  return { narrator: n.id, name: n.name, voice: String(voice) };
1069
1096
  }
1070
1097
 
1071
- export async function renameNarrator(opts, ref, name) {
1072
- if (!String(name ?? "").trim()) throw new Error("usage: narrator rename <name|id> <new name>");
1098
+ // A new name, and/or how it is said (`spokenName`, "" clears it): narrate gives
1099
+ // the voice the spoken form, so "J.P." is not read letter by letter.
1100
+ export async function renameNarrator(opts, ref, name, spokenName) {
1101
+ const next = String(name ?? "").trim();
1102
+ if (!next && spokenName === undefined) throw new Error("usage: narrator rename <name|id> [<new name>] [--say <spoken name>]");
1073
1103
  const n = await findNarrator(opts, ref);
1074
1104
  if (n.builtin) throw new Error("D.A.S.H. is built in; its name stays");
1075
- await (await client(opts)).mutation(api.narrators.rename, { narrator: n.id, name: String(name).trim() });
1076
- return { narrator: n.id, was: n.name, name: String(name).trim() };
1105
+ await (await client(opts)).mutation(api.narrators.rename, {
1106
+ narrator: n.id, ...(next ? { name: next } : {}), ...(spokenName !== undefined ? { spokenName: String(spokenName) } : {}),
1107
+ });
1108
+ return {
1109
+ narrator: n.id, was: n.name, name: next || n.name,
1110
+ spokenName: spokenName === undefined ? n.spokenName : String(spokenName).trim() || null,
1111
+ };
1077
1112
  }
1078
1113
 
1079
1114
  // face: one of your avatars (name or id from `avatar`); D.A.S.H. keeps its own.
package/src/play.mjs CHANGED
@@ -55,7 +55,8 @@ async function lookUpPresenter(opts, { slug, path, html, log }) {
55
55
 
56
56
  // Says what the served page does, not what the lookup answered.
57
57
  function sayWhoPresents({ html, page, presenter, who, log }) {
58
- if (presenter && page === html) log("⚠ the player tag already names a presenter, so it plays as written");
58
+ // A tag that already has this face (an init deck's D.A.S.H.) is not a conflict.
59
+ if (presenter && page === html && !html.includes(`data-avatar="${presenter.avatarUrl}"`)) log("⚠ the player tag already names a presenter, so it plays as written");
59
60
  else if (who?.face && !presenter && playsCaptionsOnly(html)) log(`⚠ captions only: the page names no presenter, and a face for voice "${who.voice}" is not added here`);
60
61
  else if (who) log(presenterLine(who));
61
62
  }
package/src/presenter.mjs CHANGED
@@ -6,6 +6,12 @@
6
6
  // preview, so all rewrite the tag the same way; only a release stores it. A tag that already names a presenter (D.A.S.H.
7
7
  // on a character-voice deck, or one set by hand) is left alone.
8
8
 
9
+ // D.A.S.H.'s face: the head doc and still that ship with the player. A deck
10
+ // narrated in its character voice gets this face at release, even when the
11
+ // tag was scaffolded captions-only (data-presenter="none").
12
+ export const DASH_AVATAR = "https://decks.hypersocial.ai/player/v1/dash-avatar.json";
13
+ export const DASH_PRESENTER = Object.freeze({ avatarUrl: DASH_AVATAR, imageUrl: "https://decks.hypersocial.ai/avatars/dash.png" });
14
+
9
15
  const PLAYER_TAG = /<script\b[^>]*\bsrc="[^"]*\/player\/v1\/player\.js"[^>]*>/i;
10
16
 
11
17
  const attr = (s) => String(s).replace(/&/g, "&amp;").replace(/"/g, "&quot;");
package/src/release.mjs CHANGED
@@ -110,7 +110,7 @@ export async function release(pos, opts = {}, io = {}) {
110
110
  throw new Error(`narration changed the deck (${after.split("\n").length} file(s)):\n${after}\n` +
111
111
  `run \`hyperdecks check ${pos[0]}\`, look at it, commit (index.html and narration/), then run release again`);
112
112
  }
113
- // Narrated in your own voice: the released page gets your avatar's face.
113
+ // The released page gets the narrator's face: your avatar, or D.A.S.H.'s for its voice.
114
114
  let presenter = null;
115
115
  try {
116
116
  presenter = await ops.presenterFor(opts, slug, opts.voice);
@@ -118,7 +118,7 @@ export async function release(pos, opts = {}, io = {}) {
118
118
  log(`⚠ could not look up your avatar (${ops.errorText(e)}); releasing captions only`);
119
119
  }
120
120
  const released = presenter ? releaseBundle(deckDir, presenter) : bundle;
121
- if (presenter) log("✓ presented by your avatar");
121
+ if (presenter) log(`✓ presented by ${job.presenter?.face ?? "your avatar"}`);
122
122
  // A terminal user sees this before it ships, so the CLI warns rather than refuses.
123
123
  else if (job.presenter && !job.presenter.face) log(`⚠ releasing captions only: ${job.presenter.reason ?? "no face"}`);
124
124
  return publish({ opts, io: { log, commit }, deckDir, slug, to, checked, bundle, released, summary: job.presenter ?? null });
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.9.1";
11
+ export const VERSION = "0.9.2";
12
12
  const UPLOAD_TIMEOUT_MS = 125_000;
13
13
 
14
14
  export const PROD = {
@@ -128,6 +128,11 @@ export const api = {
128
128
  posters: {
129
129
  generatePoster: makeFunctionReference("posters:generatePoster"),
130
130
  },
131
+ exports: {
132
+ create: makeFunctionReference("exports:create"),
133
+ list: makeFunctionReference("exports:list"),
134
+ remove: makeFunctionReference("exports:remove"),
135
+ },
131
136
  review: {
132
137
  reviewDeck: makeFunctionReference("review:reviewDeck"),
133
138
  checkReviewJob: makeFunctionReference("review:checkReviewJob"),
@@ -156,7 +161,7 @@ export const api = {
156
161
  },
157
162
  };
158
163
 
159
- const BOOL = new Set(["prod", "dev", "admin", "json", "require-email", "qa", "no-notify", "allow-forward", "no-forward", "help", "version", "all-agents", "global", "project", "transparent", "loop", "upload", "dry-run", "narrated", "layout", "strict", "fix", "full-page", "force", "hosted", "yes", "no-voice", "no-skill", "no-release", "no-open", "save-to-minimoji", "captions-only", "no-brand", "no-logo"]);
164
+ const BOOL = new Set(["prod", "dev", "admin", "json", "require-email", "qa", "no-notify", "allow-forward", "no-forward", "help", "version", "all-agents", "global", "project", "transparent", "loop", "upload", "dry-run", "narrated", "layout", "strict", "fix", "full-page", "force", "hosted", "yes", "no-voice", "no-skill", "no-release", "no-open", "save-to-minimoji", "captions-only", "no-brand", "no-logo", "pdf", "notes", "mp4", "gif"]);
160
165
  // release's recipients, in order: each --to starts one, and an --email right
161
166
  // after it belongs to it (`--to A --email a --to B`). Collected as opts.recipients;
162
167
  // opts.email stays the last --email for the other commands (share new).