@hypersocial/decks-cli 0.9.26 → 0.9.27
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 +24 -2
- package/src/answersCsv.mjs +7 -4
- package/src/checkRules.mjs +38 -2
- package/src/commands.mjs +8 -3
- package/src/ops.mjs +4 -1
- package/src/runtime.mjs +1 -1
- package/templates/layouts/question-choice.html +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
4
|
metadata:
|
|
5
|
-
version: "0.9.
|
|
5
|
+
version: "0.9.27"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Hyperdecks
|
|
@@ -795,6 +795,26 @@ hard-coded gutter (`padding-right: 400px`); override one in
|
|
|
795
795
|
answer (no Skip; nothing passes it until answered; Previous still works;
|
|
796
796
|
a link that can't take answers lets the viewer through). One or two a deck
|
|
797
797
|
at most: `check` warns past two.
|
|
798
|
+
- Pick several: `data-multiple` on a `question-choice` slide makes its cards
|
|
799
|
+
toggles; a tap no longer moves on, and a Continue button
|
|
800
|
+
(`<button class="send" type="button" data-answer-send>Continue</button>`,
|
|
801
|
+
first in the foot) saves what was picked and moves on (with nothing picked it
|
|
802
|
+
says what to do; Skip skips).
|
|
803
|
+
`data-max="2"` caps how many (2 to the number of cards; it needs
|
|
804
|
+
`data-multiple`; one pick is a plain choice). At the cap the other cards
|
|
805
|
+
can't be picked until one is taken off. Say it under the title (`<div class="how">Pick up to 2</div>`).
|
|
806
|
+
- Other: `data-other` on one answer's button lets the viewer type their own
|
|
807
|
+
answer inside that card: a tap turns the card into a field. Its box goes
|
|
808
|
+
after the cards, and the player moves it into the card while it is open:
|
|
809
|
+
`<div class="other" data-answer-ui hidden><input type="text" data-answer-other aria-label="Other" placeholder="Type your answer" maxlength="500"><span class="count">0 / 500</span><button class="send" type="button" data-answer-send>OK</button></div>`
|
|
810
|
+
(leave out OK on a pick-several: its Continue saves it). Enter or OK saves
|
|
811
|
+
what they typed (500 characters, like a short answer). The player styles
|
|
812
|
+
both. Only on a choice, one a question; it
|
|
813
|
+
works with one pick and with pick-several. `check` rejects either on a
|
|
814
|
+
short answer, a `data-max` out of range, and an Other without its box.
|
|
815
|
+
In `answers`, each answer has `optionIds`, `picked` (labels) and `other`
|
|
816
|
+
(the typed text); a pick-several counts a person under every option they
|
|
817
|
+
picked, so its counts can add up past `answered`.
|
|
798
818
|
- Anything the viewer clicks on a slide (interactive or not) gets
|
|
799
819
|
`data-hd-tap` (or `cursor: pointer`), so the click doesn't also pause the
|
|
800
820
|
presenter. Buttons, links, canvases and focusable elements are exempt already.
|
|
@@ -929,7 +949,9 @@ loading state (`<style data-hd-loading>`).
|
|
|
929
949
|
`--layout` lays each slide out in Chromium (needs `hyperdecks preview setup`).
|
|
930
950
|
At the stage size it warns, without failing, when a slide's presenter would
|
|
931
951
|
overlap its title. On a 390×844 phone (the share player's 374×736 slide card)
|
|
932
|
-
it fails any slide whose content overflows: the player never scrolls a slide
|
|
952
|
+
it fails any slide whose content overflows: the player never scrolls a slide
|
|
953
|
+
(one exception: a pick several or Other question that can't fit even at its
|
|
954
|
+
smallest type scrolls its cards, under a pinned title and Continue).
|
|
933
955
|
`release` (local or `--hosted`) always runs this layout check and refuses an
|
|
934
956
|
overflowing slide; `check <slug> --hosted --layout` measures a hosted draft.
|
|
935
957
|
|
package/src/answersCsv.mjs
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
// A deck's answers as CSV (the dashboard's Download CSV and `answers --csv`),
|
|
2
|
-
// from answers.forDeck's people. One line per answer
|
|
2
|
+
// from answers.forDeck's people. One line per answer: a choice's picked
|
|
3
|
+
// options' labels in one cell ("; " between them, as in previous: a label may hold a comma), what they typed under
|
|
4
|
+
// Other in its own, the last (so the columns before it are where they always were). A cell a spreadsheet
|
|
3
5
|
// would read as a formula (a viewer typed it) starts with a quote, so opening
|
|
4
6
|
// the file runs nothing.
|
|
5
|
-
const HEAD = ["person", "recipient", "link", "question_id", "question", "answer", "changed", "previous", "answered_at"];
|
|
7
|
+
const HEAD = ["person", "recipient", "link", "question_id", "question", "answer", "changed", "previous", "answered_at", "other"];
|
|
6
8
|
function cell(v) {
|
|
7
9
|
let s = v === null || v === undefined ? "" : String(v);
|
|
8
10
|
if (/^[=+\-@\t\r]/.test(s)) s = `'${s}`;
|
|
9
11
|
return /[",\r\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
|
|
10
12
|
}
|
|
11
|
-
/** @param {{ people: { person: string; recipient: string; token: string; answers: { questionId: string; question: string; value: string; changed: boolean; previous: string | null; answeredAt: number }[] }[] }} report */
|
|
13
|
+
/** @param {{ people: { person: string; recipient: string; token: string; answers: { questionId: string; question: string; value: string; picked?: string[]; other?: string | null; changed: boolean; previous: string | null; answeredAt: number }[] }[] }} report */
|
|
12
14
|
export function answersCsv(report) {
|
|
13
15
|
const lines = [HEAD.join(",")];
|
|
14
16
|
for (const p of report.people) {
|
|
15
17
|
for (const a of p.answers) {
|
|
16
|
-
|
|
18
|
+
const answer = a.picked?.length ? a.picked.join("; ") : a.value;
|
|
19
|
+
lines.push([p.person, p.recipient, p.token, a.questionId, a.question, answer, a.changed, a.previous, new Date(a.answeredAt).toISOString(), a.other].map(cell).join(","));
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
// A byte-order mark, so a spreadsheet opens accents and emoji as UTF-8.
|
package/src/checkRules.mjs
CHANGED
|
@@ -36,8 +36,9 @@ export const QUESTION_LIMITS = { choice: 72, text: 100, phone: 40, answer: 24, l
|
|
|
36
36
|
// What the question layouts' styles read from the deck's own (a deck scaffolded from layouts defines them all; a test
|
|
37
37
|
// keeps this the same as the layouts).
|
|
38
38
|
export const QUESTION_TOKENS = ["--accent", "--accent-2", "--accent-ink", "--card", "--drop-blur", "--drop-mix", "--drop-x", "--drop-y", "--font", "--ink", "--line", "--mono", "--round", "--t-body", "--t-label", "--t-lead", "--t-title"];
|
|
39
|
-
// The longest line the player writes in a question's status (packages/player/question.js ANSWER_COPY
|
|
40
|
-
|
|
39
|
+
// The longest line the player writes in a question's status (packages/player/question.js ANSWER_COPY and a pick several's
|
|
40
|
+
// cap, capCopy, at its largest; a test checks it).
|
|
41
|
+
export const LONGEST_ANSWER_MESSAGE = "That’s 4, the most you can pick. Tap one to take it off.";
|
|
41
42
|
|
|
42
43
|
export const MESSAGES = {
|
|
43
44
|
unknownTheme: (name) => `<html data-hd-theme="${name}"> is not a theme: pick one of ${THEME_IDS.join(", ")} (hyperdecks theme set <deck-dir> <name>)`,
|
|
@@ -74,6 +75,16 @@ export const MESSAGES = {
|
|
|
74
75
|
questionMax: (id, n) => `slide ${id}: its textarea says maxlength="${n}", but an answer holds 500 characters at most: set maxlength="500" (or less)`,
|
|
75
76
|
questionField: (id) => `slide ${id}: a short answer needs its <textarea data-answer-text>`,
|
|
76
77
|
questionSkip: (id) => `slide ${id}: keep its <button type="button" data-answer-skip>Skip</button> (on a data-required question the player hides it, and shows it again where the link can't take answers, so nobody is stuck)`,
|
|
78
|
+
questionChoiceOnly: (id, what) => `slide ${id}: ${what} is only for a choice (data-question="choice"); a short answer is already written: take it off`,
|
|
79
|
+
questionMaxAlone: (id) => `slide ${id}: data-max says how many of a pick-several a viewer may pick: add data-multiple to the slide too, or take data-max off`,
|
|
80
|
+
questionMaxRange: (id, max, n) => `slide ${id}: data-max="${max}" must be a whole number from 2 to its ${n} answers (or leave data-max out for no cap)`,
|
|
81
|
+
questionMaxOne: (id) => `slide ${id}: data-max="1" with data-multiple is one pick: make it a plain choice (take data-multiple and data-max off), where a tap saves and moves on`,
|
|
82
|
+
questionContinue: (id) => `slide ${id}: a pick-several (data-multiple) needs its Continue, which saves what was picked and moves on: keep <button class="send" type="button" data-answer-send>Continue</button>`,
|
|
83
|
+
questionOtherMany: (id) => `slide ${id}: more than one answer has data-other; a question has one Other`,
|
|
84
|
+
questionOtherNotOption: (id) => `slide ${id}: data-other goes on one answer's <button data-option>, the card the viewer taps to type their own answer in`,
|
|
85
|
+
questionOtherField: (id) => `slide ${id}: its Other answer needs the box the player turns the Other card into: after the cards, keep <div class="other" data-answer-ui hidden><input type="text" data-answer-other aria-label="Other" placeholder="Type your answer" maxlength="500"></div>`,
|
|
86
|
+
questionOtherLonely: (id) => `slide ${id}: it has an Other box (data-answer-other) but no answer with data-other: put data-other on the Other answer's button, or take the box out`,
|
|
87
|
+
questionOtherMax: (id, n) => `slide ${id}: its Other box says maxlength="${n}", but an answer holds 500 characters at most: set maxlength="500" (or less)`,
|
|
77
88
|
questionRequiredOff: (id) => `slide ${id}: data-required is only for a question slide (data-question="choice" or "text"): take it off, or make the slide a question`,
|
|
78
89
|
questionManyRequired: (n) => `${n} questions are data-required: a viewer can't get past one without answering, so keep it to the one or two the deck can't do without (a question is optional by default)`,
|
|
79
90
|
questionLast: (id) => `slide ${id}: a question can't be the last slide (nothing waits there, and the end card covers it): put a slide after it, such as a closer`,
|
|
@@ -799,8 +810,33 @@ export function questionErrors(html) {
|
|
|
799
810
|
}
|
|
800
811
|
if (!s.title.trim()) errs.push(MESSAGES.questionTitle(id));
|
|
801
812
|
for (const b of buttons) if (!["data-option", "data-answer-send", "data-answer-skip", "data-hd-tap", "onclick"].some((n) => hasAttr(b.tag, n))) errs.push(MESSAGES.questionDead(id, answerName(b.inner) || b.words));
|
|
813
|
+
const others = tagsWith(s.body, "data-other"), otherFields = tagsWith(s.body, "data-answer-other");
|
|
814
|
+
if (kind !== "choice") {
|
|
815
|
+
if (hasAttr(s.tag, "data-multiple")) errs.push(MESSAGES.questionChoiceOnly(id, "data-multiple (pick several)"));
|
|
816
|
+
if (hasAttr(s.tag, "data-max")) errs.push(MESSAGES.questionChoiceOnly(id, "data-max"));
|
|
817
|
+
if (others.length || otherFields.length) errs.push(MESSAGES.questionChoiceOnly(id, "an Other answer (data-other)"));
|
|
818
|
+
}
|
|
802
819
|
if (kind === "choice") {
|
|
803
820
|
if (options.length < 2 || options.length > 4) errs.push(MESSAGES.questionOptions(id, options.length));
|
|
821
|
+
// Pick several: up to data-max of them, saved with Continue.
|
|
822
|
+
const max = attr(s.tag, "data-max") ?? "";
|
|
823
|
+
if (hasAttr(s.tag, "data-max")) {
|
|
824
|
+
if (!hasAttr(s.tag, "data-multiple")) errs.push(MESSAGES.questionMaxAlone(id));
|
|
825
|
+
else if (!/^\s*\d{1,2}\s*$/.test(max) || Number(max) < 1 || Number(max) > options.length) errs.push(MESSAGES.questionMaxRange(id, max, options.length));
|
|
826
|
+
else if (Number(max) === 1) errs.push(MESSAGES.questionMaxOne(id));
|
|
827
|
+
}
|
|
828
|
+
// Continue, not Other's OK (in the box that only shows once Other is picked).
|
|
829
|
+
const at = s.body.search(/<input\b[^>]*\sdata-answer-other/i);
|
|
830
|
+
const boxFrom = at === -1 ? -1 : s.body.lastIndexOf("<div", at), boxTo = boxFrom === -1 ? -1 : s.body.indexOf("</div>", at);
|
|
831
|
+
const outside = boxFrom === -1 || boxTo === -1 ? s.body : s.body.slice(0, boxFrom) + s.body.slice(boxTo);
|
|
832
|
+
if (hasAttr(s.tag, "data-multiple") && !buttonsIn(outside).some((b) => hasAttr(b.tag, "data-answer-send"))) errs.push(MESSAGES.questionContinue(id));
|
|
833
|
+
// Other: one answer, with the box it opens.
|
|
834
|
+
if (others.some((tag) => !/^<button\b/i.test(tag) || !hasAttr(tag, "data-option"))) errs.push(MESSAGES.questionOtherNotOption(id));
|
|
835
|
+
if (others.length > 1) errs.push(MESSAGES.questionOtherMany(id));
|
|
836
|
+
if (others.length && !otherFields.length) errs.push(MESSAGES.questionOtherField(id));
|
|
837
|
+
if (!others.length && otherFields.length) errs.push(MESSAGES.questionOtherLonely(id));
|
|
838
|
+
const otherMax = otherFields.length ? attr(otherFields[0], "maxlength") : null;
|
|
839
|
+
if (otherMax !== null && otherMax !== undefined && !(Number(otherMax) > 0 && Number(otherMax) <= 500)) errs.push(MESSAGES.questionOtherMax(id, otherMax));
|
|
804
840
|
if (tagsWith(s.body, "data-option").some((tag) => !/^<button\b/i.test(tag))) errs.push(MESSAGES.questionNotButton(id));
|
|
805
841
|
const seen = new Set();
|
|
806
842
|
for (const { tag, inner } of options) {
|
package/src/commands.mjs
CHANGED
|
@@ -455,8 +455,12 @@ export function answersLines(r) {
|
|
|
455
455
|
const lines = [`answers on "${r.deck.title}" (${r.deck.slug}): ${r.answered} ${r.answered === 1 ? "person" : "people"} answered`];
|
|
456
456
|
if (!r.asks && !r.questions.length) return [...lines, " this deck has no question slides"];
|
|
457
457
|
for (const q of r.questions) {
|
|
458
|
-
lines.push("", `${q.title} [${q.id}${q.retired ? ", no longer asked" : ""}] · ${q.answered} answered · ${q.skipped} skipped${q.changed ? ` · ${q.changed} changed` : ""}`);
|
|
459
|
-
for (const o of q.options)
|
|
458
|
+
lines.push("", `${q.title} [${q.id}${q.retired ? ", no longer asked" : ""}${q.multiple ? ", pick several" : ""}] · ${q.answered} answered · ${q.skipped} skipped${q.changed ? ` · ${q.changed} changed` : ""}`);
|
|
459
|
+
for (const o of q.options) {
|
|
460
|
+
lines.push(` ${o.label}: ${o.count}${o.people.length ? ` (${o.people.join(", ")})` : ""}`);
|
|
461
|
+
for (const t of o.typed ?? []) lines.push(` ${t.person}: ${t.value.replace(/\s*\n\s*/g, " / ")}`);
|
|
462
|
+
}
|
|
463
|
+
if (q.multiple && q.answered) lines.push(` (each person counts once under every option they picked, so the counts can add up to more than ${q.answered})`);
|
|
460
464
|
for (const w of q.written) lines.push(` ${w.person}${w.changed ? " (changed)" : ""}: ${w.value.replace(/\s*\n\s*/g, " / ")}`);
|
|
461
465
|
}
|
|
462
466
|
if (r.people.length) lines.push("", "people:");
|
|
@@ -722,7 +726,8 @@ ${layoutList()}
|
|
|
722
726
|
answers <slug> [--share <token>] [--question <id>] [--person <name>] [--json|--csv]
|
|
723
727
|
what viewers answered on the deck's question slides (owner-only; QA links never):
|
|
724
728
|
counts per option, written answers in full, a row per person with changed, skipped
|
|
725
|
-
and still-open questions. --csv prints one line per answer
|
|
729
|
+
and still-open questions. --csv prints one line per answer: a pick several's options
|
|
730
|
+
in one cell, joined with "; ", and what they typed under Other in the last column.
|
|
726
731
|
answers <slug> --share <token> --wait [--timeout <s>]
|
|
727
732
|
wait (default 300s) until that link's questions are all answered or skipped past the
|
|
728
733
|
last one, with at least one answer; on a timeout it says what is still open and exits 3.
|
package/src/ops.mjs
CHANGED
|
@@ -85,8 +85,11 @@ export async function deckStats(opts, slug) {
|
|
|
85
85
|
export const DECK_ANSWERS_DESCRIPTION =
|
|
86
86
|
"What viewers answered on a deck's question slides (owner-only; QA links and previews never count). " +
|
|
87
87
|
"questions: each question with counts per option (and who picked each), written answers in full, how many skipped and changed. " +
|
|
88
|
+
"A pick-several question (multiple: true) counts each person once under every option they picked, so its counts can add up past answered; a percentage is of the people who answered that question. " +
|
|
89
|
+
"An Other option (other: true) lists what each person typed under it (typed). " +
|
|
90
|
+
"Each answer has optionIds (every option picked, in the deck's order), picked (their labels), other (what they typed under Other, or null) and value (the whole answer as one line, picks joined with \"; \", Other's text included; never split it). " +
|
|
88
91
|
"people: a row per person (link and browser) with at least one answer: their answers, changed (and previous), skipped (passed with no answer), " +
|
|
89
|
-
"open (not reached yet), complete, and id (delete_answers takes it). Browsers that went past every question without answering are only counted (skippedAll). " +
|
|
92
|
+
"open (not reached yet), complete, furthestSlide, lastSeenAt and currentSlide (their newest session: when it was last seen, 0 if never, and on which slide), and id (delete_answers takes it). Browsers that went past every question without answering are only counted (skippedAll). " +
|
|
90
93
|
"links: per share link, complete (someone on it answered and has nothing open) and the questions still open. " +
|
|
91
94
|
"Pass share (a link token, from list_shares; a forwarded link has its own) for one link, question (an id) or person (a name) to narrow it. " +
|
|
92
95
|
"wait (seconds, with share only) holds the reply until that link is complete or the time is up: then complete is false, timedOut true and open lists what is unanswered; call again to keep waiting. " +
|
package/src/runtime.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { ConvexHttpClient } from "convex/browser";
|
|
|
9
9
|
import { makeFunctionReference } from "convex/server";
|
|
10
10
|
import { recordSkillInstall } from "./skillFreshness.mjs";
|
|
11
11
|
|
|
12
|
-
export const VERSION = "0.9.
|
|
12
|
+
export const VERSION = "0.9.27";
|
|
13
13
|
|
|
14
14
|
// Sent on the CLI's calls to our routes and to Convex, so the server can see
|
|
15
15
|
// which CLI versions are still out there (not used to refuse anything).
|
|
@@ -4,7 +4,7 @@ summary: One question with two to four answer cards the viewer taps (or A to D).
|
|
|
4
4
|
brief: One question, two to four answer cards; the deck waits for a pick or Skip.
|
|
5
5
|
says: a question for the viewer
|
|
6
6
|
needs: 2 to 4 short answers
|
|
7
|
-
use: its styles are required (see Style). qualify a lead or tailor the follow-up (which plan, how big, when). Keep the title to 72 characters (data-title-mobile, what a phone shows, to 40), each answer (its <b>) to 24 and its line (the <span>) to 50: the type steps down to fit, and check warns past them. One question a slide, 20 a deck, never the first or last slide. Each answer is a <button data-option="id">: an id of its own (letters, digits, - or _), kept the same between releases with the slide's id (answers are stored under them). Letters run A, B, C, D: keys pick by the cards' order; Esc skips. Keep data-question="choice", Skip (data-answer-skip) and the status line (data-answer-status): it and the failed card are all a viewer sees when a save fails. A question is optional: the viewer answers or skips, and the first Next with no answer nudges them once. Add data-required to the slide only where the deck can't go on without the answer (a plan that picks the next slides, an email the sender must have): no Skip, and nothing passes it until it's answered; one or two a deck at most. data-answer-ui marks what a still (a thumbnail, an export, the PDF) leaves out. Recipient links store answers; QA links, previews and your own opens don't. Read them with `hyperdecks answers <slug>` (`deck_answers`): counts per option, written answers in full, a row per person with what they changed or skipped; `--share <token> --wait` (`wait`) waits until that link has answered. You get one email per person when they finish. The presenter asks it large (data-presenter-size="xl", answers two a row beside it; l does the same, m gives one row).
|
|
7
|
+
use: its styles are required (see Style). qualify a lead or tailor the follow-up (which plan, how big, when). Keep the title to 72 characters (data-title-mobile, what a phone shows, to 40), each answer (its <b>) to 24 and its line (the <span>) to 50: the type steps down to fit, and check warns past them. One question a slide, 20 a deck, never the first or last slide. Each answer is a <button data-option="id">: an id of its own (letters, digits, - or _), kept the same between releases with the slide's id (answers are stored under them). Letters run A, B, C, D: keys pick by the cards' order; Esc skips. Keep data-question="choice", Skip (data-answer-skip) and the status line (data-answer-status): it and the failed card are all a viewer sees when a save fails. A question is optional: the viewer answers or skips, and the first Next with no answer nudges them once. Add data-required to the slide only where the deck can't go on without the answer (a plan that picks the next slides, an email the sender must have): no Skip, and nothing passes it until it's answered; one or two a deck at most. data-answer-ui marks what a still (a thumbnail, an export, the PDF) leaves out. Recipient links store answers; QA links, previews and your own opens don't. Read them with `hyperdecks answers <slug>` (`deck_answers`): counts per option, written answers in full, a row per person with what they changed or skipped; `--share <token> --wait` (`wait`) waits until that link has answered. You get one email per person when they finish. Pick several (data-multiple, data-max) and an Other the viewer types (data-other): markup in the guide's script topic. The presenter asks it large (data-presenter-size="xl", answers two a row beside it; l does the same, m gives one row).
|
|
8
8
|
slot: bottom-left
|
|
9
9
|
presenter: stage
|
|
10
10
|
nopresenter: The question and its cards take the full width of the slide.
|