@hypersocial/decks-cli 0.9.13 → 0.9.14

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
@@ -59,6 +59,10 @@ deck list [--json]
59
59
  deck stats <slug> [--json]
60
60
  deck open <slug>
61
61
  deck link <slug> [--json] # the owner link: present or check your own deck, untracked
62
+ deck archive <slug> [--json] # reversible, deletes nothing; share/preview links pause and exports are refused until unarchived
63
+ deck unarchive <slug> [--json] # back to the status it had (live stays live; draft if unknown)
64
+ deck rm <slug> --yes # PERMANENT: deletes the deck, every share link and its history.
65
+ # Without --yes (or --confirm <slug>) it only shows what would go.
62
66
 
63
67
  share new <slug> <recipient> [--email e] [--note n] [--require-email] [--expires iso] [--limit n] [--qa] [--no-notify]
64
68
  share list <slug> [--json]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypersocial/decks-cli",
3
- "version": "0.9.13",
3
+ "version": "0.9.14",
4
4
  "description": "Command-line client for Hypersocial Decks live analytics and share management.",
5
5
  "type": "module",
6
6
  "main": "./src/commands.mjs",
@@ -998,6 +998,15 @@ rebuild's list on 2026-11-05 produced four.
998
998
  live changes, state the action and target clearly before executing when user
999
999
  intent is ambiguous.
1000
1000
  - Avoid printing full share tokens unless the user needs the exact URL/token.
1001
+ - To retire a deck ("archive it", "put it away", a superseded draft), archive it:
1002
+ `hyperdecks deck archive <slug>` / `archive_deck`. It is reversible
1003
+ (`deck unarchive` / `unarchive_deck` puts back the status it had) and deletes
1004
+ nothing. While archived, its share and preview links show "no longer active"
1005
+ and exports are refused.
1006
+ `deck rm` / `remove_deck` is a permanent delete of the deck, every share link
1007
+ and all its visit history. Use it only when the user asks to delete, and
1008
+ confirm the slug first; `deck rm` refuses without `--yes` (or
1009
+ `--confirm <slug>`) and shows what would go.
1001
1010
 
1002
1011
  ## Animated email previews (0.1.10+)
1003
1012
 
@@ -110,8 +110,11 @@ makes the hello deck; continue from step 5 below.
110
110
  gates; owners can turn it off with `set_deck_view { slug, aiReadable: false }`.
111
111
  `set_share_notify` to mute a link's "opened" alerts;
112
112
  `set_recipient_archived` to tidy the activity feed; `credits` for the
113
- balance. `remove_deck` deletes a deck and breaks every link to it: confirm
114
- with the user first.
113
+ balance. `archive_deck` sets a deck aside reversibly (its links pause and
114
+ exports are refused while archived; nothing is deleted; `unarchive_deck` brings it back as it was): use it when
115
+ someone wants a deck archived or out of the way. `remove_deck` permanently
116
+ deletes a deck and breaks every link to it: only when they ask to delete,
117
+ and confirm the slug with them first.
115
118
  11. When someone asks for "the PDF" (a data room, an attachment):
116
119
  `export_deck { slug, kind: "pdf", notes? }` renders the released deck, one
117
120
  1600×900 page per slide with a footer carrying its tracked link (pass
package/src/commands.mjs CHANGED
@@ -91,11 +91,55 @@ function deckOpen(pos, opts) {
91
91
  openBrowser(ownerUrl);
92
92
  }
93
93
 
94
+ const RM_USAGE = "usage: deck rm <slug> --yes | --confirm <slug>";
95
+
96
+ // Whether `deck rm` was told to go ahead: --yes, or --confirm naming the slug.
97
+ export function rmConfirmed(slug, opts) {
98
+ if (opts.yes) return true;
99
+ return typeof opts.confirm === "string" && opts.confirm === slug;
100
+ }
101
+
102
+ // What `deck rm` would delete, in words.
103
+ export function removalLines(p) {
104
+ const n = (count, more) => `${count}${more ? "+" : ""}`;
105
+ return [
106
+ `deck rm permanently deletes "${p.title}" (${p.slug}, ${p.status}). It cannot be undone.`,
107
+ ` share links: ${n(p.shareLinks, p.sharesMore)} (${n(p.enabledShareLinks, p.sharesMore)} enabled) — every one stops working`,
108
+ ` visits: ${n(p.sessions, p.sessionsMore)} recorded visits and their engagement history`,
109
+ ` assets: ${n(p.assets, p.assetsMore)} uploaded to this deck`,
110
+ `To set it aside instead (reversible, deletes nothing; links pause until unarchived): deck archive ${p.slug}`,
111
+ `To delete it: deck rm ${p.slug} --yes (or --confirm ${p.slug})`,
112
+ ];
113
+ }
114
+
94
115
  async function deckRemove(pos, opts) {
95
116
  const [slug] = pos;
96
- if (!slug) throw new Error("usage: deck rm <slug>");
117
+ if (!slug) throw new Error(RM_USAGE);
118
+ if ("confirm" in opts && typeof opts.confirm !== "string") throw new Error(`--confirm needs the slug: --confirm ${slug}`);
119
+ if (typeof opts.confirm === "string" && opts.confirm !== slug) {
120
+ throw new Error(`--confirm ${opts.confirm} does not match ${slug}; nothing was deleted`);
121
+ }
122
+ if (!rmConfirmed(slug, opts)) {
123
+ const preview = await ops.deckRemovalPreview(opts, slug);
124
+ if (opts.json) console.log(JSON.stringify({ removed: false, needs: "--yes", ...preview }, null, 2));
125
+ else for (const line of removalLines(preview)) console.error(line);
126
+ // Non-zero: nothing happened, and a script must not read this as success.
127
+ throw new Error("nothing was deleted; pass --yes (or --confirm <slug>) to delete permanently");
128
+ }
97
129
  await ops.removeDeck(opts, slug);
98
- console.log(`OK removed deck ${slug}`);
130
+ if (opts.json) console.log(JSON.stringify({ slug, removed: true }, null, 2));
131
+ else console.log(`OK removed deck ${slug} permanently`);
132
+ }
133
+
134
+ async function deckArchive(pos, opts, archived) {
135
+ const [slug] = pos;
136
+ const verb = archived ? "archive" : "unarchive";
137
+ if (!slug) throw new Error(`usage: deck ${verb} <slug> [--json]`);
138
+ const out = archived ? await ops.archiveDeck(opts, slug) : await ops.unarchiveDeck(opts, slug);
139
+ if (opts.json) return console.log(JSON.stringify(out, null, 2));
140
+ if (archived) console.log(`OK ${slug} is archived; its share links show "no longer active" until you run deck unarchive ${slug}`);
141
+ else if (out.changed === false) console.log(`OK ${slug} was not archived; status ${out.status}`);
142
+ else console.log(`OK ${slug} is ${out.status} again; its share links work again (any you turned off stay off)`);
99
143
  }
100
144
 
101
145
  async function shareNew(pos, opts) {
@@ -422,7 +466,14 @@ commands:
422
466
  login [--token <pat>] [--broker <url>] [--dev]
423
467
  logout [--dev]
424
468
  whoami [--json] [--dev]
425
- deck list|stats|open|link|rm|forward|view|transfer|transfers
469
+ deck list|stats|open|link|archive|unarchive|rm|forward|view|transfer|transfers
470
+ deck archive <slug> | deck unarchive <slug> [--json]
471
+ set a deck aside, reversibly; nothing is deleted. While archived its share and preview links show
472
+ "no longer active" and exports are refused. unarchive puts back the status it had (live stays
473
+ live; draft if unknown).
474
+ deck rm <slug> --yes | --confirm <slug>
475
+ PERMANENT delete: the deck, every share link, all visit history and its assets. Without the
476
+ flag it only shows what would go and exits non-zero. Prefer deck archive.
426
477
  deck link <slug> [--json]
427
478
  the owner link: present or check your own deck (only you, signed in; untracked;
428
479
  Present or H hides your owner tools). Use it instead of a QA link. deck open opens it.
@@ -1093,6 +1144,8 @@ function commandTable(pos, rest, opts) {
1093
1144
  "deck open": () => deckOpen(rest, opts),
1094
1145
  "deck link": () => deckLink(rest, opts),
1095
1146
  "deck rm": () => deckRemove(rest, opts),
1147
+ "deck archive": () => deckArchive(rest, opts, true),
1148
+ "deck unarchive": () => deckArchive(rest, opts, false),
1096
1149
  "deck forward": () => deckForward(rest, opts),
1097
1150
  "deck view": () => deckView(rest, opts),
1098
1151
  "deck transfer": () => deckTransfer(rest, opts),
package/src/ops.mjs CHANGED
@@ -704,6 +704,27 @@ export async function removeDeck(opts, slug) {
704
704
  return { slug, removed: true };
705
705
  }
706
706
 
707
+ // Archive: reversible, deletes nothing (only status changes). While archived its
708
+ // share and draft-preview links show "no longer active" and exports are refused.
709
+ export async function archiveDeck(opts, slug) {
710
+ if (!slug) throw new Error("slug is required");
711
+ await (await client(opts)).mutation(api.decks.setStatus, { slug, status: "archived" });
712
+ return { slug, status: "archived" };
713
+ }
714
+
715
+ // Unarchive: back to the status it had before archiving (draft if unknown).
716
+ export async function unarchiveDeck(opts, slug) {
717
+ if (!slug) throw new Error("slug is required");
718
+ const out = await (await client(opts)).mutation(api.decks.unarchive, { slug });
719
+ return { slug, status: out.status, changed: out.changed };
720
+ }
721
+
722
+ // What removeDeck would delete (share links, visits, assets), without deleting.
723
+ export async function deckRemovalPreview(opts, slug) {
724
+ if (!slug) throw new Error("slug is required");
725
+ return (await client(opts)).query(api.decks.removalPreview, { slug });
726
+ }
727
+
707
728
  export async function setRecipientArchived(opts, recipient, archived) {
708
729
  if (!recipient) throw new Error("recipient is required");
709
730
  await (await client(opts)).mutation(api.activity.setArchived, { recipient, archived });
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.13";
11
+ export const VERSION = "0.9.14";
12
12
  const UPLOAD_TIMEOUT_MS = 125_000;
13
13
 
14
14
  // The app's home. HYPERDECKS_HOST points the prod target's broker and share
@@ -121,6 +121,9 @@ export const api = {
121
121
  listForViewer: makeFunctionReference("decks:listForViewer"),
122
122
  listAll: makeFunctionReference("decks:listAll"),
123
123
  remove: makeFunctionReference("decks:remove"),
124
+ removalPreview: makeFunctionReference("decks:removalPreview"),
125
+ setStatus: makeFunctionReference("decks:setStatus"),
126
+ unarchive: makeFunctionReference("decks:unarchive"),
124
127
  setAllowForward: makeFunctionReference("decks:setAllowForward"),
125
128
  setView: makeFunctionReference("decks:setView"),
126
129
  setViewToggle: makeFunctionReference("decks:setViewToggle"),
package/src/scaffold.mjs CHANGED
@@ -48,7 +48,7 @@ export async function deckNew(pos, opts = {}, { log = (line) => console.log(line
48
48
  for (const [out, text] of files) writeFileSync(join(/*turbopackIgnore: true*/ dir, out), text);
49
49
  } catch (e) {
50
50
  rmSync(dir, { recursive: true, force: true });
51
- 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`);
51
+ throw new Error(`deck ${slug} is registered but its files could not be written (${e.message}); remove the empty draft with \`hyperdecks deck rm ${slug} --yes\` and run deck new again`);
52
52
  }
53
53
  // The face goes into the file now the deck is registered (the server answers whose).
54
54
  const htmlPath = join(/*turbopackIgnore: true*/ dir, "index.html");