@hypersocial/decks-cli 0.9.20 → 0.9.21

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.20",
3
+ "version": "0.9.21",
4
4
  "description": "Command-line client for Hypersocial Decks live analytics and share management.",
5
5
  "type": "module",
6
6
  "main": "./src/commands.mjs",
@@ -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.20"
5
+ version: "0.9.21"
6
6
  ---
7
7
 
8
8
  # Hyperdecks
@@ -1011,6 +1011,10 @@ rebuild's list on 2026-11-05 produced four.
1011
1011
  `deck list --tag <tag>` / `list_decks { tag }` lists one tag's decks, and
1012
1012
  `deck new … --tag <tag,...>` tags at creation. Tags are the owner's own
1013
1013
  labels: recipients never see them.
1014
+ - To find a deck by who it went to ("the one I sent a16z"): `hyperdecks deck list
1015
+ --search a16z` / `list_decks { search: "a16z" }`. Search matches the title,
1016
+ slug, tags and `sentTo` (each share link's recipient name, email and note; QA
1017
+ links never), the same as the dashboard search; it combines with `tag`.
1014
1018
  - To retire a deck ("archive it", "put it away", a superseded draft), archive it:
1015
1019
  `hyperdecks deck archive <slug>` / `archive_deck`. It is reversible
1016
1020
  (`deck unarchive` / `unarchive_deck` puts back the status it had) and deletes
package/src/commands.mjs CHANGED
@@ -18,6 +18,7 @@ import { fetchVersionInfo, updatePreflight } from "./update.mjs";
18
18
  import { refreshSkillCopies } from "./skillFreshness.mjs";
19
19
  import * as ops from "./ops.mjs";
20
20
  import { MAX_TAGS, normalizeTags } from "./tags.mjs";
21
+ import { sentToLabel, sentToMatch } from "./deckSearch.mjs";
21
22
  import { exportVideo } from "./export-video.mjs";
22
23
  import { presenterLine } from "./presenter.mjs";
23
24
 
@@ -75,15 +76,31 @@ function tagFlag(opts, usage) {
75
76
  return v;
76
77
  }
77
78
 
79
+ // --search: same refusal as tagFlag for a missing value; the text is free.
80
+ function searchFlag(opts) {
81
+ if (!("search" in opts)) return undefined;
82
+ const v = opts.search;
83
+ if (typeof v !== "string" || !v.trim() || v === "undefined" || v.startsWith("--")) throw new Error("--search needs some text: deck list --search <text>");
84
+ return v;
85
+ }
86
+
78
87
  async function deckList(opts) {
79
88
  const tag = tagFlag(opts, "deck list --tag <tag>");
80
- const rows = await ops.listDecks(opts, { tag });
89
+ const search = searchFlag(opts);
90
+ const rows = await ops.listDecks(opts, { tag, search });
81
91
  if (opts.json) {
82
92
  console.log(JSON.stringify(rows, null, 2));
83
93
  return;
84
94
  }
85
- for (const d of rows) console.log(`${d.slug}\t${d.status}\t${d.title}${d.tags.length ? `\t#${d.tags.join(" #")}` : ""}`);
86
- if (!rows.length) console.log(tag ? `(no decks tagged ${tag})` : "(no decks)");
95
+ for (const d of rows) {
96
+ // Found only through who it was sent to: say who, as the dashboard does.
97
+ const sentTo = search ? sentToMatch(d, search) : null;
98
+ console.log(`${d.slug}\t${d.status}\t${d.title}${d.tags.length ? `\t#${d.tags.join(" #")}` : ""}${sentTo ? `\t→ ${sentToLabel(sentTo)}` : ""}`);
99
+ }
100
+ if (!rows.length) {
101
+ if (search) console.log(`(no decks${tag ? ` tagged ${tag}` : ""} match "${search.trim()}")`);
102
+ else console.log(tag ? `(no decks tagged ${tag})` : "(no decks)");
103
+ }
87
104
  }
88
105
 
89
106
  const TAG_USAGE = "usage: deck tag <slug> add|remove <tag...> [--json]";
@@ -522,8 +539,10 @@ commands:
522
539
  logout [--dev]
523
540
  whoami [--json] [--dev]
524
541
  deck list|tag|stats|open|link|archive|unarchive|rm|forward|view|transfer|transfers
525
- deck list [--tag <tag>] [--json]
526
- your decks; --tag shows only the ones carrying that tag.
542
+ deck list [--tag <tag>] [--search <text>] [--json]
543
+ your decks; --tag shows only the ones carrying that tag; --search only those whose
544
+ title, slug, tags or recipients (share link name, email, note) contain the text,
545
+ like the dashboard search (→ shows who it was sent to when only a recipient matched).
527
546
  deck tag <slug> [add|remove <tag...>] [--json]
528
547
  label a deck for yourself (investors, fizz-fm…): lowercase a-z 0-9 -, 1–32 characters,
529
548
  spaces become -, at most 10 a deck. Only you see them; never recipients. No action: print them.
@@ -0,0 +1,53 @@
1
+ // Deck text search, shared by the dashboard (lib/deckSort.ts filterDecks), the
2
+ // CLI (`deck list --search`) and both MCPs (list_decks search), so one search
3
+ // finds the same decks everywhere. Pure: no Convex, no React.
4
+ //
5
+ // One case-insensitive substring test over the deck's title, slug and tags,
6
+ // and over each person it was sent to (decks.listForViewer sentTo: the link's
7
+ // recipient name, email and note; QA links never appear there).
8
+
9
+ /** @typedef {{ name: string, email?: string, note?: string }} SentTo */
10
+ /** @typedef {{ title: string, slug: string, tags?: string[], sentTo?: SentTo[] }} SearchableDeck */
11
+
12
+ /** @param {string | null | undefined} q */
13
+ export const searchNeedle = (q) => (q ?? "").trim().toLowerCase();
14
+
15
+ /** @param {string | null | undefined} s @param {string} needle */
16
+ const has = (s, needle) => !!s && s.toLowerCase().includes(needle);
17
+
18
+ /**
19
+ * Whether the deck matches the search, and how. null: no match (or an empty
20
+ * search, which every deck passes: callers skip searching then). `sentTo`
21
+ * lists the recipients that matched, and is empty when the deck's own title,
22
+ * slug or a tag matched: only a recipient-only match needs explaining.
23
+ * @param {SearchableDeck} deck
24
+ * @param {string | null | undefined} q
25
+ * @returns {{ sentTo: SentTo[] } | null}
26
+ */
27
+ export function deckSearchMatch(deck, q) {
28
+ const needle = searchNeedle(q);
29
+ if (!needle) return null;
30
+ if (has(deck.title, needle) || has(deck.slug, needle) || (deck.tags ?? []).some((t) => has(t, needle))) return { sentTo: [] };
31
+ const sentTo = (deck.sentTo ?? []).filter((r) => has(r.name, needle) || has(r.email, needle) || has(r.note, needle));
32
+ return sentTo.length ? { sentTo } : null;
33
+ }
34
+
35
+ /** @param {SearchableDeck} deck @param {string | null | undefined} q */
36
+ export const deckMatchesSearch = (deck, q) => !searchNeedle(q) || deckSearchMatch(deck, q) !== null;
37
+
38
+ /**
39
+ * Who a recipient-only match was sent to, for the "Sent to …" line: the first
40
+ * matching name and how many more ("a16z +2"). null when the deck matched on
41
+ * its own title, slug or tags, or not at all.
42
+ * @param {SearchableDeck} deck
43
+ * @param {string | null | undefined} q
44
+ * @returns {{ name: string, more: number } | null}
45
+ */
46
+ export function sentToMatch(deck, q) {
47
+ const hit = deckSearchMatch(deck, q);
48
+ if (!hit?.sentTo.length) return null;
49
+ return { name: hit.sentTo[0].name, more: hit.sentTo.length - 1 };
50
+ }
51
+
52
+ /** @param {{ name: string, more: number }} m */
53
+ export const sentToLabel = (m) => (m.more ? `${m.name} +${m.more}` : m.name);
package/src/ops.mjs CHANGED
@@ -5,6 +5,7 @@ import { COLOR_KEYS, FONT_PAIRINGS, FONT_ROLES, findPairing, googleFontsUrl } fr
5
5
  import { MAX_IMPORT_FILE_BYTES, draftArgs, extractFile } from "./brandImport.mjs";
6
6
  import { api, backupLinkUrl, client, linkBase, target, uploadBytes as runtimeUploadBytes } from "./runtime.mjs";
7
7
  import { normalizeTags, TAG_RULE } from "./tags.mjs";
8
+ import { deckMatchesSearch } from "./deckSearch.mjs";
8
9
  import {
9
10
  bytesFromText,
10
11
  isTextAsset,
@@ -34,18 +35,24 @@ export function ownerLink(opts, slug) {
34
35
  }
35
36
 
36
37
  // `tag`: only the decks carrying it (normalized the way tags are stored).
37
- /** @param {any} [opts] @param {{ all?: boolean, tag?: string }} [filter] */
38
- export async function listDecks(opts = {}, { all = false, tag } = {}) {
38
+ // `search`: only the decks whose title, slug, tags or recipients (sentTo: the
39
+ // share links' names, emails and notes, never QA links) contain the text, the
40
+ // dashboard's search (deckSearch.mjs). An admin's `all` carries no recipients.
41
+ /** @param {any} [opts] @param {{ all?: boolean, tag?: string, search?: string }} [filter] */
42
+ export async function listDecks(opts = {}, { all = false, tag, search } = {}) {
39
43
  const wanted = tag == null ? [] : normalizeTags(tag);
40
44
  if (tag != null && wanted.length !== 1) throw new Error(wanted.length ? "filter by one tag at a time" : `name a tag to filter by: ${TAG_RULE}`);
41
45
  const want = wanted[0] ?? null;
42
46
  const rows = await (await client(opts)).query(all ? api.decks.listAll : api.decks.listForViewer, {});
43
- return rows.filter((d) => !want || (d.tags ?? []).includes(want)).map((d) => ({
47
+ return rows.filter((d) => (!want || (d.tags ?? []).includes(want)) && deckMatchesSearch({ ...d, sentTo: all ? [] : d.sentTo }, search)).map((d) => ({
44
48
  slug: d.slug,
45
49
  title: d.title,
46
50
  status: d.status,
47
51
  // The owner's own labels (deck tag / tag_deck), sorted.
48
52
  tags: d.tags ?? [],
53
+ // Who it was sent to ({ name, email?, note? } per non-QA link, newest
54
+ // first); empty for an admin's all.
55
+ sentTo: all ? [] : d.sentTo ?? [],
49
56
  ownerEmail: d.ownerEmail ?? null,
50
57
  hasHtml: !!(d.html || d.htmlStorageId || d.hasHtml),
51
58
  // How it opens (null: as its HTML says) and whether viewers may switch.
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.20";
12
+ export const VERSION = "0.9.21";
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).