@curviate/cli 0.54.0 → 0.56.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +35 -17
  3. package/dist/{account-DW5N5MJ6.js → account-ZF5NEMID.js} +132 -125
  4. package/dist/{analytics-T2K3OWVQ.js → analytics-M7JWS67A.js} +5 -5
  5. package/dist/{beta-consent-O736ONE7.js → beta-consent-4Q2LZZQC.js} +4 -4
  6. package/dist/{billing-NTBL32EX.js → billing-LYPSX5SR.js} +78 -6
  7. package/dist/{chunk-N76WNJ5T.js → chunk-7PLTQHNO.js} +1 -1
  8. package/dist/{chunk-N4IYTFIY.js → chunk-AMTKGO37.js} +1 -1
  9. package/dist/{chunk-ACKKHLUH.js → chunk-CRO7PJ4I.js} +2 -2
  10. package/dist/chunk-DENWYJK2.js +94 -0
  11. package/dist/{chunk-FBLCSVIU.js → chunk-EI64VFBE.js} +47 -47
  12. package/dist/{chunk-ENBIMEKS.js → chunk-IB6ARI3R.js} +1 -1
  13. package/dist/{chunk-Q57PZJLX.js → chunk-J4SFOFMT.js} +90 -88
  14. package/dist/{chunk-FUX3BRYP.js → chunk-JXDEV33Z.js} +1 -1
  15. package/dist/{chunk-5B4T6BMN.js → chunk-L3RJU7C3.js} +44 -44
  16. package/dist/{chunk-KXJJFHSD.js → chunk-MIOEYSBQ.js} +1 -1
  17. package/dist/{chunk-R4HS2MWM.js → chunk-MWVTFTWV.js} +15 -13
  18. package/dist/{chunk-QW5K5DTC.js → chunk-RDKTHFQ6.js} +25 -6
  19. package/dist/{chunk-62YAYAUI.js → chunk-RKNW4UX4.js} +51 -9
  20. package/dist/{chunk-V3HHYTBY.js → chunk-UOWOKEB2.js} +1 -1
  21. package/dist/{chunk-HOMRAZ6S.js → chunk-UWRWZG4N.js} +2 -2
  22. package/dist/{chunk-A3UNS44U.js → chunk-VEMK4MJM.js} +10 -10
  23. package/dist/{chunk-UFHT2KZG.js → chunk-XP6S6E55.js} +2 -2
  24. package/dist/cli.js +33 -25
  25. package/dist/{comment-ATVJOTWV.js → comment-D6RSZTVK.js} +8 -8
  26. package/dist/{company-BRKFROPE.js → company-3Z6PXGTW.js} +11 -11
  27. package/dist/{config-E223SS5K.js → config-VY5MCJMN.js} +2 -2
  28. package/dist/{connect-XVDQ5FTT.js → connect-G2RTLV7G.js} +15 -15
  29. package/dist/{contact-4HOUOVD7.js → contact-QSLJCBDE.js} +8 -8
  30. package/dist/{contact-groups-ENA3VGGL.js → contact-groups-OITAD73K.js} +85 -85
  31. package/dist/{contact-import-4EKVDFPV.js → contact-import-LT7BKESC.js} +10 -10
  32. package/dist/core-RFTNNB6P.js +46 -0
  33. package/dist/{do-not-contact-S2WGHSQL.js → do-not-contact-ZA7KS5WD.js} +59 -33
  34. package/dist/{doctor-OFIUGRUG.js → doctor-JQT3DO6G.js} +4 -4
  35. package/dist/{document-MDE2WJYX.js → document-H65EXU4L.js} +1 -1
  36. package/dist/domain-7EX4E34B.js +70 -0
  37. package/dist/{draft-DD3DTXBM.js → draft-7U6H4BPF.js} +4 -4
  38. package/dist/{enrollment-ESCHKQ5X.js → enrollment-AZ6XGVVL.js} +40 -38
  39. package/dist/{examples-KAMXHRLE.js → examples-IGQJCSNL.js} +2 -2
  40. package/dist/{exit-codes-CYQHN4NE.js → exit-codes-ZSOLAXQO.js} +1 -1
  41. package/dist/{export-GUAGB7TF.js → export-OYMQXL62.js} +5 -5
  42. package/dist/{feed-ZC4FY4BA.js → feed-M5D4SJW7.js} +6 -6
  43. package/dist/{group-42ZE7K3K.js → group-UTC3YBKE.js} +6 -6
  44. package/dist/{inbox-2YS7CTXH.js → inbox-VSGNHSLG.js} +9 -9
  45. package/dist/{inboxes-5RB3BGCQ.js → inboxes-23C2MJK4.js} +6 -6
  46. package/dist/{incoming-ATZN6JJA.js → incoming-QVPP32K7.js} +13 -13
  47. package/dist/{job-WD3Z3P3Q.js → job-ZHVFFRWE.js} +10 -10
  48. package/dist/{login-JQ57YHEJ.js → login-6OTNXEJZ.js} +4 -4
  49. package/dist/mailbox-HD2UXZCA.js +405 -0
  50. package/dist/{message-WGS2IIDC.js → message-PIV77W47.js} +7 -7
  51. package/dist/{motion-BRVBJJJP.js → motion-AHYF34DP.js} +224 -149
  52. package/dist/{network-CODIWCJQ.js → network-RJHJFZEY.js} +5 -5
  53. package/dist/{notification-RLVF4NLJ.js → notification-XGR4NT3S.js} +6 -6
  54. package/dist/{notifications-HGEHM5KW.js → notifications-BHRWSHPR.js} +6 -6
  55. package/dist/{post-3GH2IPO6.js → post-Z7AVDDKA.js} +8 -8
  56. package/dist/{profile-6RFJQMIB.js → profile-YZNBX2RP.js} +15 -15
  57. package/dist/{recruiter-GK3UNS62.js → recruiter-EXM4P7X7.js} +17 -17
  58. package/dist/{sales-nav-SLS3ABF4.js → sales-nav-CKDSEXV2.js} +15 -15
  59. package/dist/{search-45WRT5T3.js → search-B7FB6674.js} +17 -17
  60. package/dist/{setup-5QZOM2Q2.js → setup-VZVPLJ4V.js} +5 -5
  61. package/dist/{team-WM3RKOQ2.js → team-PYABBUHO.js} +6 -6
  62. package/dist/{tier-5AMLO5KE.js → tier-PRK4WQKR.js} +4 -4
  63. package/dist/{unibox-TTCF7YVO.js → unibox-ZNKX2EKL.js} +34 -34
  64. package/dist/{webhook-UCCCSKDO.js → webhook-V74EV4E2.js} +18 -18
  65. package/package.json +2 -2
  66. package/dist/core-6VDDV2NM.js +0 -46
@@ -5,14 +5,14 @@ import {
5
5
  } from "./chunk-VHNF6OZD.js";
6
6
  import {
7
7
  sendInChunks
8
- } from "./chunk-UFHT2KZG.js";
8
+ } from "./chunk-XP6S6E55.js";
9
9
  import {
10
10
  fail,
11
11
  listFlag,
12
12
  outputOpts,
13
13
  rootClient,
14
14
  usage
15
- } from "./chunk-HOMRAZ6S.js";
15
+ } from "./chunk-UWRWZG4N.js";
16
16
  import {
17
17
  buildPreviewOutput
18
18
  } from "./chunk-TCUYH5GO.js";
@@ -20,6 +20,7 @@ import {
20
20
  intFlag
21
21
  } from "./chunk-NNV2OYEF.js";
22
22
  import {
23
+ DEFAULT_PAGE_DELAY_MS,
23
24
  pageDelayFromFlags,
24
25
  readCursorFlag,
25
26
  readMaxPagesFlag,
@@ -27,12 +28,12 @@ import {
27
28
  readablePage,
28
29
  rejectPaginationModifiersWithoutAll,
29
30
  streamAll
30
- } from "./chunk-KXJJFHSD.js";
31
+ } from "./chunk-MIOEYSBQ.js";
31
32
  import {
32
33
  renderSuccess,
33
34
  writeNdjsonItem
34
35
  } from "./chunk-QM57YDJE.js";
35
- import "./chunk-N76WNJ5T.js";
36
+ import "./chunk-7PLTQHNO.js";
36
37
  import {
37
38
  GLOBAL_FLAGS,
38
39
  READ_SINGLE_FLAGS,
@@ -41,14 +42,14 @@ import {
41
42
  } from "./chunk-QLKGOIWS.js";
42
43
  import {
43
44
  DESCRIPTIONS
44
- } from "./chunk-R4HS2MWM.js";
45
+ } from "./chunk-MWVTFTWV.js";
45
46
  import {
46
47
  documentSchema,
47
48
  parseDocument,
48
49
  readFileFlag,
49
50
  reportIssues,
50
51
  validate
51
- } from "./chunk-62YAYAUI.js";
52
+ } from "./chunk-RKNW4UX4.js";
52
53
  import "./chunk-FDJMAF7D.js";
53
54
  import {
54
55
  isStdinToken
@@ -134,7 +135,7 @@ var connect_and_converse_default = {
134
135
  {
135
136
  id: "has_post",
136
137
  if: {
137
- "contact.posted_within": "14d"
138
+ "lead.posted_within": "14d"
138
139
  },
139
140
  then: "w_like",
140
141
  else: "w_invite"
@@ -254,7 +255,7 @@ var engage_then_connect_default = {
254
255
  text: "{{comment}}",
255
256
  fallback: "skip"
256
257
  },
257
- note: "Your AI writes one comment per Contact; no product mention."
258
+ note: "Your AI writes one comment per Lead; no product mention."
258
259
  },
259
260
  {
260
261
  id: "w_invite",
@@ -330,7 +331,7 @@ var nurture_connections_default = {
330
331
  {
331
332
  id: "is_connected",
332
333
  if: {
333
- "contact.connected": true
334
+ "lead.connected": true
334
335
  },
335
336
  then: "dm",
336
337
  else: "not_connected"
@@ -406,7 +407,7 @@ function assignWarning(sequence, assign) {
406
407
  const at = steps.findIndex((s) => s?.["do"] === "invite.send" && typeof s["id"] === "string");
407
408
  if (at < 0) return [];
408
409
  const rule = "settings.assign is already_connected, so anyone not already connected to a sending Account is skipped and this invitation never runs for them; use assign: auto";
409
- const hint = "Set settings.assign to auto, the default: it prefers an Account already connected and invites everyone else. Keep already_connected only for a Motion that writes to existing Connections.";
410
+ const hint = "Set settings.assign to auto, the default: it prefers an Account already connected and invites everyone else. Keep already_connected only for a Campaign that writes to existing Connections.";
410
411
  return [{ code: "W17", path: `${steps[at]["id"]}.do`, rule, message: rule, pointer: `/steps/${at}/do`, hint, docs_url: "https://docs.curviate.com/reference/sequence-rules#w17", severity: "warning" }];
411
412
  }
412
413
  async function checkSequence(f, text, sequence, prefix, settings) {
@@ -426,14 +427,14 @@ async function checkSequence(f, text, sequence, prefix, settings) {
426
427
  `).join(""));
427
428
  return verdict;
428
429
  }
429
- function checkMotionFields(f, command, doc) {
430
+ function checkCampaignFields(f, command, doc) {
430
431
  const schema = documentSchema(command);
431
432
  let body = doc;
432
433
  if (doc && typeof doc === "object" && !Array.isArray(doc)) {
433
434
  const readOnlyKeys = schema["x-curviate-response-only"];
434
435
  const dropped = Object.keys(doc).filter((k) => readOnlyKeys.includes(k));
435
436
  if (dropped.length) {
436
- process.stderr.write(`warning: dropped ${dropped.join(", ")}: set by Curviate, not part of a Motion file (\`curviate motion get\` output carries them).
437
+ process.stderr.write(`warning: dropped ${dropped.join(", ")}: set by Curviate, not part of a Campaign file (\`curviate campaign get\` output carries them).
437
438
  `);
438
439
  body = Object.fromEntries(Object.entries(doc).filter(([k]) => !dropped.includes(k)));
439
440
  }
@@ -442,9 +443,9 @@ function checkMotionFields(f, command, doc) {
442
443
  if (issues.length) reportIssues(issues, outputOpts(f).json);
443
444
  return body;
444
445
  }
445
- async function readMotionFile(f, command) {
446
+ async function readCampaignFile(f, command) {
446
447
  const text = await readFileFlag("file", f.file ?? "", { others: f });
447
- const body = checkMotionFields(f, command, parseDocument("file", text));
448
+ const body = checkCampaignFields(f, command, parseDocument("file", text));
448
449
  if (body["sequence"] != null) await checkSequence(f, text, body["sequence"], "/sequence", body["settings"]);
449
450
  return { body, text };
450
451
  }
@@ -457,7 +458,7 @@ function explain(err, f, text) {
457
458
  if (e.code === "SEQUENCE_CONFLICT" && e.current) {
458
459
  const c = e.current;
459
460
  process.stderr.write(
460
- `The Sequence was saved since revision ${f["if-revision"]}: revision ${c.sequence_revision} by ${c.sequence_updated_by_user_id ?? "an unknown user"} at ${c.updated_at ?? "an unknown time"}. Read it with \`curviate motion get ${f.id}\` and merge, or send yours again with --if-revision ${c.sequence_revision} to replace it.
461
+ `The Sequence was saved since revision ${f["if-revision"]}: revision ${c.sequence_revision} by ${c.sequence_updated_by_user_id ?? "an unknown user"} at ${c.updated_at ?? "an unknown time"}. Read it with \`curviate campaign get ${f.id}\` and merge, or send yours again with --if-revision ${c.sequence_revision} to replace it.
461
462
  `
462
463
  );
463
464
  }
@@ -482,10 +483,10 @@ async function runList(c, f) {
482
483
  if (cursor) params["cursor"] = cursor;
483
484
  try {
484
485
  if (f.all) {
485
- const page = (p) => c.motions.list(p);
486
+ const page = (p) => c.campaigns.list(p);
486
487
  for await (const item of streamAll(page, params, { maxPages: readMaxPagesFlag(f, process), out: process, pageDelayMs: pageDelayFromFlags(f) })) writeNdjsonItem(process, item, f.fields);
487
488
  } else {
488
- renderSuccess(readablePage(await c.motions.list(params)), outputOpts(f), process);
489
+ renderSuccess(readablePage(await c.campaigns.list(params)), outputOpts(f), process);
489
490
  }
490
491
  } catch (err) {
491
492
  await fail(err, f);
@@ -493,64 +494,99 @@ async function runList(c, f) {
493
494
  }
494
495
  async function runGet(c, f) {
495
496
  try {
496
- const result = f.version === void 0 ? await c.motions.get(f.id ?? "") : await c.motions.getSequenceVersion(f.id ?? "", { version: intFlag("version", f.version) });
497
+ const result = f.version === void 0 ? await c.campaigns.get(f.id ?? "") : await c.campaigns.getSequenceVersion(f.id ?? "", { version: intFlag("version", f.version) });
497
498
  renderSuccess(readableObject(result), outputOpts(f), process);
498
499
  } catch (err) {
499
500
  await fail(err, f);
500
501
  }
501
502
  }
502
503
  async function runCreate(c, f) {
503
- const { body, text } = await readMotionFile(f, "motion create");
504
- if (f.preview) return preview("motions.create", {}, body);
504
+ const { body, text } = await readCampaignFile(f, "campaign create");
505
+ if (f.preview) return preview("campaigns.create", {}, body);
505
506
  try {
506
- renderSuccess(await c.motions.create(body), outputOpts(f), process);
507
+ renderSuccess(await c.campaigns.create(body), outputOpts(f), process);
507
508
  } catch (err) {
508
509
  explain(err, f, text);
509
510
  await fail(err, f);
510
511
  }
511
512
  }
512
513
  async function runUpdate(c, f) {
513
- const { body, text } = await readMotionFile(f, "motion update");
514
+ const { body, text } = await readCampaignFile(f, "campaign update");
514
515
  if ("if_sequence_revision" in body) {
515
516
  process.stderr.write("warning: dropped if_sequence_revision from the file: pass --if-revision <n> to send it.\n");
516
517
  delete body["if_sequence_revision"];
517
518
  }
518
519
  if (f["if-revision"] !== void 0) body["if_sequence_revision"] = intFlag("if-revision", f["if-revision"], 0);
519
- if (f.preview) return preview("motions.update", { id: f.id }, body);
520
+ if (f.preview) return preview("campaigns.update", { id: f.id }, body);
520
521
  try {
521
- renderSuccess(await c.motions.update(f.id ?? "", body), outputOpts(f), process);
522
+ renderSuccess(await c.campaigns.update(f.id ?? "", body), outputOpts(f), process);
522
523
  } catch (err) {
523
524
  explain(err, f, text);
524
525
  await fail(err, f);
525
526
  }
526
527
  }
527
528
  var lifecycle = (method) => async (c, f) => {
528
- if (f.preview) return preview(`motions.${method}`, { id: f.id });
529
+ const body = f["skip-missing-email"] ? { skip_missing_email: true } : void 0;
530
+ if (f.preview) return preview(`campaigns.${method}`, { id: f.id }, body);
529
531
  try {
530
- renderSuccess(await c.motions[method](f.id ?? ""), outputOpts(f), process);
532
+ const id = f.id ?? "";
533
+ renderSuccess(await (method === "start" || method === "resume" ? c.campaigns[method](id, body) : c.campaigns[method](id)), outputOpts(f), process);
531
534
  } catch (err) {
532
535
  await fail(err, f);
533
536
  }
534
537
  };
538
+ async function previewAll(c, f, params) {
539
+ const maxPages = readMaxPagesFlag(f, process);
540
+ const delay = pageDelayFromFlags(f) ?? DEFAULT_PAGE_DELAY_MS;
541
+ let merged;
542
+ for (let pages = 1; ; pages++) {
543
+ const page = await c.campaigns.preview(f.id ?? "", params);
544
+ merged = merged ? { ...merged, samples: [...merged["samples"], ...page["samples"] ?? []], next_cursor: page["next_cursor"] } : page;
545
+ const next = page["next_cursor"];
546
+ if (typeof next !== "string" || !next) return merged;
547
+ if (pages >= maxPages) {
548
+ process.stderr.write(`warning: stopped after ${maxPages} pages (--max-pages); next_cursor resumes it.
549
+ `);
550
+ return merged;
551
+ }
552
+ params = { ...params, cursor: next };
553
+ if (delay > 0) await new Promise((r) => setTimeout(r, delay));
554
+ }
555
+ }
535
556
  async function runPreview(c, f) {
536
557
  const params = {};
537
558
  if (f.sample !== void 0) params["sample"] = intFlag("sample", f.sample, 1, 20);
538
- if (f.contact !== void 0) params["contact_ids"] = listFlag("contact", f.contact);
539
- if (params["sample"] !== void 0 && params["contact_ids"] !== void 0) usage("--sample and --contact cannot be combined: name the Contacts, or let Curviate sample.");
559
+ if (f.limit !== void 0) params["limit"] = intFlag("limit", f.limit, 1, 20);
560
+ if (f.lead !== void 0) params["lead_ids"] = listFlag("lead", f.lead);
561
+ if (params["sample"] !== void 0 && params["limit"] !== void 0) usage("--sample is an alias of --limit: pass one.");
562
+ if ((params["sample"] ?? params["limit"]) !== void 0 && params["lead_ids"] !== void 0) usage("--limit and --lead cannot be combined: name the Leads, or let Curviate page.");
563
+ if (f.all && params["lead_ids"] !== void 0) usage("--all pages over every Lead; with --lead there is one page.");
564
+ rejectPaginationModifiersWithoutAll(f, process);
565
+ const cursor = readCursorFlag(f, process);
566
+ if (cursor) params["cursor"] = cursor;
567
+ try {
568
+ const result = f.all ? await previewAll(c, f, params) : await c.campaigns.preview(f.id ?? "", params);
569
+ renderSuccess(readableObject(result), outputOpts(f), process);
570
+ } catch (err) {
571
+ await fail(err, f);
572
+ }
573
+ }
574
+ async function runCheck(c, f) {
575
+ if (f.preview) return preview("campaigns.check", { id: f.id });
540
576
  try {
541
- renderSuccess(readableObject(await c.motions.preview(f.id ?? "", params)), outputOpts(f), process);
577
+ renderSuccess(await c.campaigns.check(f.id ?? ""), outputOpts(f), process);
542
578
  } catch (err) {
543
579
  await fail(err, f);
544
580
  }
545
581
  }
546
582
  var membership = (kind) => async (c, f) => {
547
- const ids = listFlag("contact", f.contact);
548
- if (!ids.length) usage("--contact is required: one or more Contact ids (con_...).");
549
- if (f.account !== void 0 && f.account.trim() === "") usage("--account was given an empty value. Pass an acc_... id of the Motion, or omit it to let Curviate assign one.");
550
- const body = (chunk) => ({ contact_ids: chunk, ...f.account !== void 0 ? { account_id: f.account } : {} });
551
- const method = kind === "add" ? "addContacts" : "removeContacts";
552
- if (f.preview) return preview(`motions.${method}`, { id: f.id }, body(ids.slice(0, BULK_MAX_IDS)));
553
- const results = await sendInChunks(ids, BULK_MAX_IDS, (chunk) => c.motions[method](f.id ?? "", body(chunk)), f);
583
+ const ids = listFlag("lead", f.lead);
584
+ if (!ids.length) usage("--lead is required: one or more Lead ids (con_...).");
585
+ if (f.account !== void 0 && f.account.trim() === "") usage("--account was given an empty value. Pass an acc_... id of the Campaign, or omit it to let Curviate assign one.");
586
+ const body = (chunk) => ({ lead_ids: chunk, ...f.account !== void 0 ? { account_id: f.account } : {} });
587
+ const method = kind === "add" ? "addLeads" : "removeLeads";
588
+ if (f.preview) return preview(`campaigns.${method}`, { id: f.id }, body(ids.slice(0, BULK_MAX_IDS)));
589
+ const results = await sendInChunks(ids, BULK_MAX_IDS, (chunk) => c.campaigns[method](f.id ?? "", body(chunk)), f);
554
590
  if (results.length === 1) return renderSuccess(results[0], outputOpts(f), process);
555
591
  const last = results[results.length - 1] ?? {};
556
592
  const merged = kind === "add" ? { ...last, results: results.flatMap((r) => r?.results ?? []) } : {
@@ -562,7 +598,7 @@ var membership = (kind) => async (c, f) => {
562
598
  };
563
599
  async function runVoiceClipUpload(c, f) {
564
600
  const path = f.file ?? "";
565
- if (path.trim() === "") usage("the audio file is missing. Pass its path: `curviate motion voice-clip upload intro.mp3`.");
601
+ if (path.trim() === "") usage("the audio file is missing. Pass its path: `curviate campaign voice-clip upload intro.mp3`.");
566
602
  const filename = basename(path);
567
603
  let bytes;
568
604
  try {
@@ -572,17 +608,17 @@ async function runVoiceClipUpload(c, f) {
572
608
  throw err;
573
609
  }
574
610
  if (f.preview) {
575
- return void process.stdout.write(JSON.stringify(buildPreviewOutput({ method: "motions.voiceClips.upload", args: { filename }, body: {}, attachments: [{ name: filename, buffer: bytes }] })) + "\n");
611
+ return void process.stdout.write(JSON.stringify(buildPreviewOutput({ method: "campaigns.voiceClips.upload", args: { filename }, body: {}, attachments: [{ name: filename, buffer: bytes }] })) + "\n");
576
612
  }
577
613
  try {
578
- renderSuccess(await c.motions.voiceClips.upload(bytes, { filename }), outputOpts(f), process);
614
+ renderSuccess(await c.campaigns.voiceClips.upload(bytes, { filename }), outputOpts(f), process);
579
615
  } catch (err) {
580
616
  await fail(err, f);
581
617
  }
582
618
  }
583
619
  async function runVoiceClipGet(c, f) {
584
620
  try {
585
- renderSuccess(await c.motions.voiceClips.get(f.id ?? ""), outputOpts(f), process);
621
+ renderSuccess(await c.campaigns.voiceClips.get(f.id ?? ""), outputOpts(f), process);
586
622
  } catch (err) {
587
623
  await fail(err, f);
588
624
  }
@@ -590,10 +626,10 @@ async function runVoiceClipGet(c, f) {
590
626
  async function runLint(f) {
591
627
  const text = await readFileFlag("file", f.file ?? "", { others: f });
592
628
  const doc = parseDocument("file", text);
593
- const motionFile = !!doc && typeof doc === "object" && !Array.isArray(doc) && !("steps" in doc) && ("sequence" in doc || "name" in doc);
594
- if (motionFile) checkMotionFields(f, "motion create", doc);
595
- if (motionFile && doc["sequence"] == null) usage("--file: the Motion file has no sequence; there is nothing to lint.");
596
- const verdict = await checkSequence(f, text, motionFile ? doc["sequence"] : doc, motionFile ? "/sequence" : "", motionFile ? doc["settings"] : void 0);
629
+ const campaignFile = !!doc && typeof doc === "object" && !Array.isArray(doc) && !("steps" in doc) && ("sequence" in doc || "name" in doc);
630
+ if (campaignFile) checkCampaignFields(f, "campaign create", doc);
631
+ if (campaignFile && doc["sequence"] == null) usage("--file: the Campaign file has no sequence; there is nothing to lint.");
632
+ const verdict = await checkSequence(f, text, campaignFile ? doc["sequence"] : doc, campaignFile ? "/sequence" : "", campaignFile ? doc["settings"] : void 0);
597
633
  if (outputOpts(f).json) process.stdout.write(JSON.stringify({ errors: [], warnings: verdict.warnings }) + "\n");
598
634
  }
599
635
  async function runInit(f) {
@@ -608,31 +644,31 @@ async function runInit(f) {
608
644
  } catch (err) {
609
645
  usage(`--output: cannot write ${f.output}: ${err.code ?? "write error"}.`);
610
646
  }
611
- process.stderr.write(`Wrote ${f.output}. Next: fill contact_list_ids and account_ids, then \`curviate motion create --file ${f.output}\`.
647
+ process.stderr.write(`Wrote ${f.output}. Next: fill lead_list_ids and account_ids, then \`curviate campaign create --file ${f.output}\`.
612
648
  `);
613
649
  }
614
650
  var online = (fn) => async ({ args }) => {
615
651
  const f = args;
616
652
  await fn(await rootClient(f), f);
617
653
  };
618
- var ID = { type: "positional", description: "Motion id (mot_...)." };
619
- var FILE_DESC = "The Motion file: a path, or - to read it from stdin. `curviate motion get` output is accepted as is.";
620
- var SEQUENCE_ERRORS = { SEQUENCE_INVALID: "the Sequence breaks a rule; every error is listed, one line each, as `curviate motion lint` prints them." };
654
+ var ID = { type: "positional", description: "Campaign id (mot_...)." };
655
+ var FILE_DESC = "The Campaign file: a path, or - to read it from stdin. `curviate campaign get` output is accepted as is.";
656
+ var SEQUENCE_ERRORS = { SEQUENCE_INVALID: "the Sequence breaks a rule; every error is listed, one line each, as `curviate campaign lint` prints them." };
621
657
  var ROLE_ERRORS = {
622
- INSUFFICIENT_ROLE: "your role cannot send from a sending Account of this Motion.",
658
+ INSUFFICIENT_ROLE: "your role cannot send from a sending Account of this Campaign.",
623
659
  ACCOUNT_NOT_SHARED: "a sending Account is not shared with you."
624
660
  };
625
- var SEE_LIFECYCLE = ["curviate motion get", "curviate enrollment list"];
661
+ var SEE_LIFECYCLE = ["curviate campaign get", "curviate enrollment list"];
626
662
  var listCmd = defineCommand({
627
663
  meta: {
628
664
  name: "list",
629
- description: "List your Team's Motions, most recently updated first (--sort activity: latest activity first, `last_activity_at`). Items carry no Sequence: read one with `curviate motion get <motion_id>`. A cursor belongs to its sort.",
665
+ description: "List your Team's Campaigns, most recently updated first (--sort activity: latest activity first, `last_activity_at`). Items carry no Sequence: read one with `curviate campaign get <campaign_id>`. A cursor belongs to its sort.",
630
666
  risk: "read",
631
- examples: ["curviate motion list", "curviate motion list --status active,paused", "curviate motion list --accounts acc_A,acc_B --sort activity"]
667
+ examples: ["curviate campaign list", "curviate campaign list --status active,paused", "curviate campaign list --accounts acc_A,acc_B --sort activity"]
632
668
  },
633
669
  args: {
634
670
  ...readOnly(GLOBAL_FLAGS),
635
- accounts: { type: "string", description: "Only Motions sending from one of these Accounts: a comma list of ids (acc_...). --account a,b is accepted as the same filter." },
671
+ accounts: { type: "string", description: "Only Campaigns sending from one of these Accounts: a comma list of ids (acc_...). --account a,b is accepted as the same filter." },
636
672
  sort: { type: "string", description: "updated (default) or activity." },
637
673
  status: { type: "string", description: `Comma list of ${STATUSES.join(", ")}. Default: all but archived.` }
638
674
  },
@@ -641,10 +677,10 @@ var listCmd = defineCommand({
641
677
  var getCmd = defineCommand({
642
678
  meta: {
643
679
  name: "get",
644
- description: "One Motion with its current Sequence and lint warnings. With --version, that Sequence version instead, and how many Enrollments still run on it.",
680
+ description: "One Campaign with its current Sequence and lint warnings. With --version, that Sequence version instead, and how many Enrollments still run on it.",
645
681
  risk: "read",
646
- output: ["The full Motion, pasteable: `curviate motion create --file -` and `curviate motion update <motion_id> --file -` accept it as is, dropping the keys Curviate sets."],
647
- examples: ["curviate motion get mot_YOUR_MOTION_ID", "curviate motion get mot_YOUR_MOTION_ID --version 1"]
682
+ output: ["The full Campaign, pasteable: `curviate campaign create --file -` and `curviate campaign update <campaign_id> --file -` accept it as is, dropping the keys Curviate sets."],
683
+ examples: ["curviate campaign get mot_YOUR_CAMPAIGN_ID", "curviate campaign get mot_YOUR_CAMPAIGN_ID --version 1"]
648
684
  },
649
685
  args: {
650
686
  ...readOnly(READ_SINGLE_FLAGS),
@@ -653,9 +689,9 @@ var getCmd = defineCommand({
653
689
  },
654
690
  run: online(runGet)
655
691
  });
656
- var MOTION_DOC = `{
692
+ var CAMPAIGN_DOC = `{
657
693
  "name": "Q4 webinar follow-up",
658
- "contact_list_ids": ["cl_YOUR_LIST_ID"],
694
+ "lead_list_ids": ["cl_YOUR_LIST_ID"],
659
695
  "account_ids": ["acc_YOUR_ACCOUNT_ID"],
660
696
  "sequence": {
661
697
  "on_reply": "end",
@@ -667,22 +703,22 @@ var MOTION_DOC = `{
667
703
  var createCmd = defineCommand({
668
704
  meta: {
669
705
  name: "create",
670
- description: "Create a Motion from a Motion file, always as a draft: nothing runs until `curviate motion start`. The file is checked before anything is sent, its Sequence as `curviate motion lint` checks it. settings.priority (normal or prioritized) sets the Motion's weight in each Account's budgets: 1 or 1.5, on every budget; every Motion with work due still progresses and no limit is passed. Needs Automate.",
706
+ description: "Create a Campaign from a Campaign file, always as a draft: nothing runs until `curviate campaign start`. The file is checked before anything is sent, its Sequence as `curviate campaign lint` checks it. settings.priority (normal or prioritized) sets the Campaign's weight in each Account's budgets: 1 or 1.5, on every budget; every Campaign with work due still progresses and no limit is passed. Needs Automate.",
671
707
  risk: "write",
672
708
  rules: {
673
- changes: "Creates a draft Motion. No Contact is enrolled and nothing reaches LinkedIn until it is started.",
709
+ changes: "Creates a draft Campaign. No Lead is enrolled and nothing reaches LinkedIn until it is started.",
674
710
  visible_to: "Your Team.",
675
711
  budget_rows: [],
676
- retry: "A retry creates a second draft: list with `curviate motion list --status draft` first.",
677
- undo: "`curviate motion delete <motion_id>` deletes a draft."
712
+ retry: "A retry creates a second draft: list with `curviate campaign list --status draft` first.",
713
+ undo: "`curviate campaign delete <campaign_id>` deletes a draft."
678
714
  },
679
- errors: { ...SEQUENCE_ERRORS, ...ROLE_ERRORS, TIER_REQUIRED: "Motions need the Automate plan." },
680
- seeAlso: ["curviate motion lint", "curviate motion init", "curviate motion preview"],
681
- document: "motion create",
715
+ errors: { ...SEQUENCE_ERRORS, ...ROLE_ERRORS, TIER_REQUIRED: "Campaigns need the Automate plan." },
716
+ seeAlso: ["curviate campaign lint", "curviate campaign init", "curviate campaign preview"],
717
+ document: "campaign create",
682
718
  examples: [
683
- "curviate motion create --file motion.json",
684
- `curviate motion create --file - <<'EOF'
685
- ${MOTION_DOC}
719
+ "curviate campaign create --file campaign.json",
720
+ `curviate campaign create --file - <<'EOF'
721
+ ${CAMPAIGN_DOC}
686
722
  EOF`
687
723
  ]
688
724
  },
@@ -695,27 +731,27 @@ EOF`
695
731
  var updateCmd = defineCommand({
696
732
  meta: {
697
733
  name: "update",
698
- description: "Change a Motion from a Motion file: objects (schedule, settings) merge by key, arrays and the Sequence replace whole, null clears. settings.priority (normal or prioritized) weighs the Motion 1 or 1.5 in each Account's budgets, on every budget (every Motion with work due still progresses, and no limit is passed); settings.new_enrollments_per_account_per_day and settings.assign even are retired (accepted and ignored until 2027-01-28, with a notice). After start, a structural Sequence change makes a new version; running Enrollments keep theirs. With --if-revision the save is refused when someone saved the Sequence since. Needs Automate.",
734
+ description: "Change a Campaign from a Campaign file: objects (schedule, settings) merge by key, arrays and the Sequence replace whole, null clears. settings.priority (normal or prioritized) weighs the Campaign 1 or 1.5 in each Account's budgets, on every budget (every Campaign with work due still progresses, and no limit is passed); settings.new_enrollments_per_account_per_day and settings.assign even are retired (accepted and ignored until 2027-01-28, with a notice). After start, a structural Sequence change makes a new version; running Enrollments keep theirs. With --if-revision the save is refused when someone saved the Sequence since. Needs Automate.",
699
735
  risk: "write",
700
736
  rules: {
701
- changes: "Changes the Motion. A running Motion picks the change up at each Enrollment's next Step.",
702
- visible_to: "Your Team, and the Contacts its next Steps reach.",
737
+ changes: "Changes the Campaign. A running Campaign picks the change up at each Enrollment's next Step.",
738
+ visible_to: "Your Team, and the Leads its next Steps reach.",
703
739
  budget_rows: [],
704
740
  retry: "Safe: the same file sends the same change. Without --if-revision the last save wins.",
705
- undo: "Send the previous file again (`curviate motion get <motion_id> --version <n>` reads an earlier Sequence)."
741
+ undo: "Send the previous file again (`curviate campaign get <campaign_id> --version <n>` reads an earlier Sequence)."
706
742
  },
707
743
  errors: {
708
744
  ...SEQUENCE_ERRORS,
709
745
  SEQUENCE_CONFLICT: "with --if-revision: someone saved the Sequence since that revision; the message names the newer revision and who saved it.",
710
- MOTION_STATUS_CONFLICT: "an archived Motion, or one past its end, cannot change.",
746
+ CAMPAIGN_STATUS_CONFLICT: "an archived Campaign, or one past its end, cannot change.",
711
747
  ...ROLE_ERRORS
712
748
  },
713
- seeAlso: ["curviate motion get", "curviate motion lint"],
714
- document: "motion update",
749
+ seeAlso: ["curviate campaign get", "curviate campaign lint"],
750
+ document: "campaign update",
715
751
  examples: [
716
- "curviate motion update mot_YOUR_MOTION_ID --file motion.json --if-revision 3",
717
- `curviate motion update mot_YOUR_MOTION_ID --file - <<'EOF'
718
- ${MOTION_DOC}
752
+ "curviate campaign update mot_YOUR_CAMPAIGN_ID --file campaign.json --if-revision 3",
753
+ `curviate campaign update mot_YOUR_CAMPAIGN_ID --file - <<'EOF'
754
+ ${CAMPAIGN_DOC}
719
755
  EOF`
720
756
  ]
721
757
  },
@@ -723,128 +759,166 @@ EOF`
723
759
  ...WRITE_SINGLE_FLAGS,
724
760
  id: ID,
725
761
  file: { type: "string", stdinArg: true, required: true, description: FILE_DESC },
726
- "if-revision": { type: "string", description: "The sequence_revision you read (`curviate motion get`). The save is refused with SEQUENCE_CONFLICT when the stored Sequence moved past it. Omitted: the last save wins." }
762
+ "if-revision": { type: "string", description: "The sequence_revision you read (`curviate campaign get`). The save is refused with SEQUENCE_CONFLICT when the stored Sequence moved past it. Omitted: the last save wins." }
727
763
  },
728
764
  run: online(runUpdate)
729
765
  });
766
+ var SKIP_MISSING_EMAIL = {
767
+ "skip-missing-email": {
768
+ type: "boolean",
769
+ description: "With an email step: start even though some Leads have no email address (`curviate campaign check` counts them). They are never enrolled either way."
770
+ }
771
+ };
730
772
  var lifecycleCmd = (name, meta) => defineCommand({
731
- meta: { name, ...meta, examples: [`curviate motion ${name} mot_YOUR_MOTION_ID`] },
732
- args: { ...WRITE_SINGLE_FLAGS, id: ID },
773
+ meta: {
774
+ name,
775
+ ...meta,
776
+ examples: [`curviate campaign ${name} mot_YOUR_CAMPAIGN_ID`, ...name === "start" ? ["curviate campaign start mot_YOUR_CAMPAIGN_ID --skip-missing-email"] : []]
777
+ },
778
+ args: { ...WRITE_SINGLE_FLAGS, id: ID, ...name === "start" || name === "resume" ? SKIP_MISSING_EMAIL : {} },
733
779
  run: online(lifecycle(name))
734
780
  });
735
781
  var startCmd = lifecycleCmd("start", {
736
- description: "Start a draft: scheduled when its start time is ahead, else active. Freezes Sequence version 1. A Motion missing what it needs is refused with every gap listed. Needs Automate.",
782
+ description: "Start a draft: scheduled when its start time is ahead, else active. Freezes Sequence version 1. A Campaign missing what it needs is refused with every gap listed. With an email step it needs `curviate campaign check` at the current Sequence revision, and is refused while Leads have no email address unless --skip-missing-email. Needs Automate.",
737
783
  risk: "high",
738
784
  rules: {
739
- changes: "The Motion starts enrolling its Contacts and running its Steps from its sending Accounts, paced on its schedule.",
740
- visible_to: "The Contacts each Step reaches on LinkedIn.",
785
+ changes: "The Campaign starts enrolling its Leads and running its Steps from its sending Accounts, paced on its schedule.",
786
+ visible_to: "The Leads each Step reaches on LinkedIn.",
741
787
  budget_rows: [],
742
- retry: "A retry on a started Motion answers MOTION_STATUS_CONFLICT; nothing runs twice.",
743
- undo: "`curviate motion pause <motion_id>` stops new Steps; what was sent stays sent.",
744
- blast_radius: "Every Contact of its Contact lists, from every sending Account, each Step spending that Account's budgets (`curviate account get <account_id>`)."
788
+ retry: "A retry on a started Campaign answers CAMPAIGN_STATUS_CONFLICT; nothing runs twice.",
789
+ undo: "`curviate campaign pause <campaign_id>` stops new Steps; what was sent stays sent.",
790
+ blast_radius: "Every Lead of its Lead lists, from every sending Account, each Step spending that Account's budgets (`curviate account get <account_id>`)."
745
791
  },
746
- errors: { MOTION_NOT_STARTABLE: "a gap stops it (Contact list, sending Account, Sequence); each is listed.", MOTION_STATUS_CONFLICT: "only a draft starts.", ...ROLE_ERRORS, TIER_REQUIRED: "Motions need the Automate plan." },
747
- seeAlso: ["curviate motion preview", "curviate motion pause"]
792
+ errors: {
793
+ CAMPAIGN_NOT_STARTABLE: "a gap stops it (Lead list, sending Account, Sequence, with an email step the Lead check and Leads without an address); each is listed.",
794
+ CAMPAIGN_STATUS_CONFLICT: "only a draft starts.",
795
+ ...ROLE_ERRORS,
796
+ TIER_REQUIRED: "Campaigns need the Automate plan."
797
+ },
798
+ seeAlso: ["curviate campaign check", "curviate campaign preview", "curviate campaign pause"]
748
799
  });
749
800
  var pauseCmd = lifecycleCmd("pause", {
750
- description: "Pause an active or scheduled Motion: no Step runs until it is resumed. Waits keep their time.",
801
+ description: "Pause an active or scheduled Campaign: no Step runs until it is resumed. Waits keep their time.",
751
802
  risk: "write",
752
803
  rules: {
753
- changes: "No Step of the Motion runs while it is paused.",
804
+ changes: "No Step of the Campaign runs while it is paused.",
754
805
  visible_to: "Your Team.",
755
806
  budget_rows: [],
756
- retry: "Safe: a paused Motion answers MOTION_STATUS_CONFLICT.",
757
- undo: "`curviate motion resume <motion_id>`."
807
+ retry: "Safe: a paused Campaign answers CAMPAIGN_STATUS_CONFLICT.",
808
+ undo: "`curviate campaign resume <campaign_id>`."
758
809
  },
759
- errors: { MOTION_STATUS_CONFLICT: "only an active or scheduled Motion pauses.", ...ROLE_ERRORS },
810
+ errors: { CAMPAIGN_STATUS_CONFLICT: "only an active or scheduled Campaign pauses.", ...ROLE_ERRORS },
760
811
  seeAlso: SEE_LIFECYCLE
761
812
  });
762
813
  var resumeCmd = lifecycleCmd("resume", {
763
- description: "Resume a paused Motion. Runs the start checks again. Needs Automate.",
814
+ description: "Resume a paused Campaign. Runs the start checks again, the Lead check and --skip-missing-email included. Needs Automate.",
764
815
  risk: "high",
765
816
  rules: {
766
- changes: "The Motion's Steps run again from its sending Accounts.",
767
- visible_to: "The Contacts each Step reaches on LinkedIn.",
817
+ changes: "The Campaign's Steps run again from its sending Accounts.",
818
+ visible_to: "The Leads each Step reaches on LinkedIn.",
768
819
  budget_rows: [],
769
- retry: "A retry on a running Motion answers MOTION_STATUS_CONFLICT.",
770
- undo: "`curviate motion pause <motion_id>`; what was sent stays sent.",
771
- blast_radius: "Every open Enrollment of the Motion."
820
+ retry: "A retry on a running Campaign answers CAMPAIGN_STATUS_CONFLICT.",
821
+ undo: "`curviate campaign pause <campaign_id>`; what was sent stays sent.",
822
+ blast_radius: "Every open Enrollment of the Campaign."
772
823
  },
773
- errors: { MOTION_NOT_STARTABLE: "a gap stops it; each is listed.", MOTION_STATUS_CONFLICT: "only a paused Motion resumes.", ...ROLE_ERRORS, TIER_REQUIRED: "Motions need the Automate plan." },
824
+ errors: { CAMPAIGN_NOT_STARTABLE: "a gap stops it; each is listed.", CAMPAIGN_STATUS_CONFLICT: "only a paused Campaign resumes.", ...ROLE_ERRORS, TIER_REQUIRED: "Campaigns need the Automate plan." },
774
825
  seeAlso: SEE_LIFECYCLE
775
826
  });
776
827
  var archiveCmd = lifecycleCmd("archive", {
777
- description: "Archive a Motion: its open Enrollments end (motion_archived) and it never runs again.",
828
+ description: "Archive a Campaign: its open Enrollments end (campaign_archived) and it never runs again.",
778
829
  risk: "high",
779
830
  rules: {
780
- changes: "Ends every open Enrollment and freezes the Motion.",
831
+ changes: "Ends every open Enrollment and freezes the Campaign.",
781
832
  visible_to: "Your Team.",
782
833
  budget_rows: [],
783
- retry: "A retry answers MOTION_STATUS_CONFLICT.",
784
- undo: "Cannot be undone. Create a new Motion from `curviate motion get <motion_id>` output.",
785
- blast_radius: "Every open Enrollment of the Motion."
834
+ retry: "A retry answers CAMPAIGN_STATUS_CONFLICT.",
835
+ undo: "Cannot be undone. Create a new Campaign from `curviate campaign get <campaign_id>` output.",
836
+ blast_radius: "Every open Enrollment of the Campaign."
786
837
  },
787
- errors: { MOTION_STATUS_CONFLICT: "already archived.", ...ROLE_ERRORS },
838
+ errors: { CAMPAIGN_STATUS_CONFLICT: "already archived.", ...ROLE_ERRORS },
788
839
  seeAlso: SEE_LIFECYCLE
789
840
  });
790
841
  var deleteCmd = lifecycleCmd("delete", {
791
- description: "Delete a draft Motion with its Sequence versions. Any other status: archive it instead.",
842
+ description: "Delete a draft Campaign with its Sequence versions. Any other status: archive it instead.",
792
843
  risk: "high",
793
844
  rules: {
794
845
  changes: "Deletes the draft and its Sequence versions.",
795
846
  visible_to: "Your Team.",
796
847
  budget_rows: [],
797
848
  retry: "A retry answers RESOURCE_NOT_FOUND.",
798
- undo: "Cannot be undone. Keep `curviate motion get <motion_id>` output to create it again.",
799
- blast_radius: "One draft Motion; it has no Enrollments."
849
+ undo: "Cannot be undone. Keep `curviate campaign get <campaign_id>` output to create it again.",
850
+ blast_radius: "One draft Campaign; it has no Enrollments."
800
851
  },
801
- errors: { RESOURCE_NOT_FOUND: "no Motion with this id.", MOTION_STATUS_CONFLICT: "only a draft is deleted; archive the others.", ...ROLE_ERRORS },
802
- seeAlso: ["curviate motion archive", "curviate motion list"]
852
+ errors: { RESOURCE_NOT_FOUND: "no Campaign with this id.", CAMPAIGN_STATUS_CONFLICT: "only a draft is deleted; archive the others.", ...ROLE_ERRORS },
853
+ seeAlso: ["curviate campaign archive", "curviate campaign list"]
803
854
  });
804
855
  var previewCmd = defineCommand({
805
856
  meta: {
806
857
  name: "preview",
807
- description: "What the Motion would do, in any status: every path through its Sequence, rendered messages for sampled or named Contacts, and the budget projection: per Account the pool that binds its pace, the expected actions a day (a draft: the mean daily invitations, messages and InMails of the first 7 days of its forecast, as if turned on now), and warnings (hours_below_share, no_sending_account). A read: never reaches LinkedIn, spends nothing.",
858
+ description: "What the Campaign would do, in any status: every path through its Sequence, rendered messages for its Leads a page at a time (--limit, 1 to 20, default 5; --cursor the previous page's next_cursor; --all every page, merged) or for named Leads, and the budget projection on the first page: per Account the pool that binds its pace, the expected actions a day (a draft: the mean daily invitations, messages and InMails of the first 7 days of its forecast, as if turned on now), and warnings (hours_below_share, no_sending_account). A read: never reaches LinkedIn, spends nothing.",
808
859
  risk: "read",
809
- examples: ["curviate motion preview mot_YOUR_MOTION_ID", "curviate motion preview mot_YOUR_MOTION_ID --sample 3"]
860
+ examples: [
861
+ "curviate campaign preview mot_YOUR_CAMPAIGN_ID",
862
+ "curviate campaign preview mot_YOUR_CAMPAIGN_ID --limit 3",
863
+ "curviate campaign preview mot_YOUR_CAMPAIGN_ID --all"
864
+ ]
810
865
  },
811
866
  args: {
812
- ...readOnly(READ_SINGLE_FLAGS),
867
+ ...readOnly(GLOBAL_FLAGS),
813
868
  id: ID,
814
- sample: { type: "string", description: "How many Contacts to render (default 5)." },
815
- contact: { type: "string", description: "A Contact id (con_...) to render; repeatable, or a comma list. Not with --sample." }
869
+ sample: { type: "string", description: "Alias of --limit." },
870
+ lead: { type: "string", description: "A Lead id (con_...) to render; repeatable, or a comma list. Not with --limit or --all." }
816
871
  },
817
872
  run: online(runPreview)
818
873
  });
874
+ var checkCmd = defineCommand({
875
+ meta: {
876
+ name: "check",
877
+ description: "Run the Lead check: one count over every Lead the Campaign would enroll (no usable email address, a bounced one, on the Do-not-contact list for email only) and the Lead variables without a fallback they lack. Stored as lead_check on the Campaign; starting a Campaign with an email step needs one at the current Sequence revision. Any status; sends nothing.",
878
+ risk: "write",
879
+ rules: {
880
+ changes: "Stores the check as the Campaign's lead_check, replacing the previous one. Nothing is sent.",
881
+ visible_to: "Your Team.",
882
+ budget_rows: [],
883
+ retry: "Safe: a retry runs the check again.",
884
+ undo: "Not needed: it changes no Lead and no Step."
885
+ },
886
+ output: ["The check: leads, without_email, email_bounced, no_email, fields[] (variable, steps, on_missing, missing), checked_at, sequence_revision."],
887
+ seeAlso: ["curviate campaign start", "curviate campaign preview"],
888
+ examples: ["curviate campaign check mot_YOUR_CAMPAIGN_ID"]
889
+ },
890
+ args: { ...WRITE_SINGLE_FLAGS, id: ID },
891
+ run: online(runCheck)
892
+ });
819
893
  var membershipCmd = (kind) => defineCommand({
820
894
  meta: {
821
895
  name: kind,
822
- description: kind === "add" ? "Enroll Contacts directly, on an Account of the Motion (--account) or one Curviate assigns. Every exclusion and filter applies; each Contact's outcome says what happened. Sent in requests of up to 1000 ids, in order. Needs Automate." : "Take Contacts out of the Motion: their open Enrollments end (removed). Sent in requests of up to 1000 ids, in order.",
896
+ description: kind === "add" ? "Enroll Leads directly, on an Account of the Campaign (--account) or one Curviate assigns. Every exclusion and filter applies; each Lead's outcome says what happened. Sent in requests of up to 1000 ids, in order. Needs Automate." : "Take Leads out of the Campaign: their open Enrollments end (removed). Sent in requests of up to 1000 ids, in order.",
823
897
  risk: "high",
824
898
  rules: kind === "add" ? {
825
- changes: "Each queued Contact becomes a pending Enrollment; a running Motion reaches it on its schedule.",
826
- visible_to: "Your Team now; the Contacts once their Steps run.",
899
+ changes: "Each queued Lead becomes a pending Enrollment; a running Campaign reaches it on its schedule.",
900
+ visible_to: "Your Team now; the Leads once their Steps run.",
827
901
  budget_rows: [],
828
- retry: "Safe: a Contact already in the Motion answers already_enrolled. After a failed request, send the ids from the failed one on.",
829
- undo: "`curviate motion remove <motion_id> --contact <contact_id>`; what was sent stays sent.",
830
- blast_radius: "Every Contact given."
902
+ retry: "Safe: a Lead already in the Campaign answers already_enrolled. After a failed request, send the ids from the failed one on.",
903
+ undo: "`curviate campaign remove <campaign_id> --lead <lead_id>`; what was sent stays sent.",
904
+ blast_radius: "Every Lead given."
831
905
  } : {
832
- changes: "Ends each named Contact's open Enrollments in the Motion (removed).",
906
+ changes: "Ends each named Lead's open Enrollments in the Campaign (removed).",
833
907
  visible_to: "Your Team.",
834
908
  budget_rows: [],
835
- retry: "Safe: a Contact no longer in the Motion is listed in not_found.",
836
- undo: "`curviate motion add <motion_id> --contact <contact_id>` enrolls it again.",
837
- blast_radius: "Every Contact given."
909
+ retry: "Safe: a Lead no longer in the Campaign is listed in not_found.",
910
+ undo: "`curviate campaign add <campaign_id> --lead <lead_id>` enrolls it again.",
911
+ blast_radius: "Every Lead given."
838
912
  },
839
- errors: { MOTION_STATUS_CONFLICT: "an archived Motion, or one past its end, takes no Contacts.", ...ROLE_ERRORS },
913
+ errors: { CAMPAIGN_STATUS_CONFLICT: "an archived Campaign, or one past its end, takes no Leads.", ...ROLE_ERRORS },
840
914
  seeAlso: ["curviate enrollment list"],
841
- examples: kind === "add" ? ["curviate motion add mot_YOUR_MOTION_ID --contact con_YOUR_CONTACT_ID", "curviate motion add mot_YOUR_MOTION_ID --contact con_A,con_B --account acc_YOUR_ACCOUNT_ID"] : ["curviate motion remove mot_YOUR_MOTION_ID --contact con_YOUR_CONTACT_ID"]
915
+ examples: kind === "add" ? ["curviate campaign add mot_YOUR_CAMPAIGN_ID --lead con_YOUR_LEAD_ID", "curviate campaign add mot_YOUR_CAMPAIGN_ID --lead con_A,con_B --account acc_YOUR_ACCOUNT_ID"] : ["curviate campaign remove mot_YOUR_CAMPAIGN_ID --lead con_YOUR_LEAD_ID"]
842
916
  },
843
917
  args: {
844
918
  ...WRITE_SINGLE_FLAGS,
845
919
  id: ID,
846
- contact: { type: "string", required: true, description: "A Contact id (con_...); repeatable, or a comma list." },
847
- ...kind === "add" ? { account: { type: "string", description: "Enroll them on this sending Account of the Motion (acc_...). Never defaulted: omit it and Curviate assigns one." } } : {}
920
+ lead: { type: "string", required: true, description: "A Lead id (con_...); repeatable, or a comma list." },
921
+ ...kind === "add" ? { account: { type: "string", description: "Enroll them on this sending Account of the Campaign (acc_...). Never defaulted: omit it and Curviate assigns one." } } : {}
848
922
  },
849
923
  run: online(membership(kind))
850
924
  });
@@ -852,15 +926,15 @@ var OFFLINE = { notes: ["Offline: no API call."] };
852
926
  var lintCmd = defineCommand({
853
927
  meta: {
854
928
  name: "lint",
855
- description: "Check a Sequence offline with the rules the API applies: a Motion file (its sequence) or a bare Sequence document. One line per finding, `<file>:<line>:<col> error|warning <code> <path>: <message>. <hint> -> <docs_url>`; exit 2 on any error, 0 otherwise.",
929
+ description: "Check a Sequence offline with the rules the API applies: a Campaign file (its sequence) or a bare Sequence document. One line per finding, `<file>:<line>:<col> error|warning <code> <path>: <message>. <hint> -> <docs_url>`; exit 2 on any error, 0 otherwise.",
856
930
  risk: "read",
857
931
  rules: OFFLINE,
858
932
  output: ["Findings on stderr. With --json (or piped), stdout carries `{errors, warnings}`, or on errors the SEQUENCE_INVALID refusal the API would send."],
859
- examples: ["curviate motion lint --file motion.json"]
933
+ examples: ["curviate campaign lint --file campaign.json"]
860
934
  },
861
935
  args: {
862
936
  json: GLOBAL_FLAGS.json,
863
- file: { type: "string", stdinArg: true, required: true, description: "A Motion file or a Sequence document: a path, or - to read it from stdin." }
937
+ file: { type: "string", stdinArg: true, required: true, description: "A Campaign file or a Sequence document: a path, or - to read it from stdin." }
864
938
  },
865
939
  async run({ args }) {
866
940
  await runLint(args);
@@ -869,11 +943,11 @@ var lintCmd = defineCommand({
869
943
  var initCmd = defineCommand({
870
944
  meta: {
871
945
  name: "init",
872
- description: `Write a Motion file from a template (${Object.keys(TEMPLATES).join(", ")}). Fill contact_list_ids and account_ids, then create it.`,
946
+ description: `Write a Campaign file from a template (${Object.keys(TEMPLATES).join(", ")}). Fill lead_list_ids and account_ids, then create it.`,
873
947
  risk: "read",
874
948
  rules: OFFLINE,
875
- output: ["The Motion file on stdout, or in the --output file."],
876
- examples: ["curviate motion init --template connect-and-converse --output motion.json"]
949
+ output: ["The Campaign file on stdout, or in the --output file."],
950
+ examples: ["curviate campaign init --template connect-and-converse --output campaign.json"]
877
951
  },
878
952
  args: {
879
953
  template: { type: "string", required: true, description: `One of ${Object.keys(TEMPLATES).join(", ")}.` },
@@ -889,7 +963,7 @@ var voiceClipUploadCmd = defineCommand({
889
963
  description: "Upload one audio file (MP3, WAV, M4A, WebM or Ogg) and print the clip: its `id` (vc_...) is the `clip_id` of a `voice.send` step. 1 to 120 seconds, up to 20 MiB, 100 uploads per Team per 24 hours. The file is converted once and the original is discarded. Nothing reaches LinkedIn. Needs Automate.",
890
964
  risk: "write",
891
965
  rules: {
892
- changes: "Stores one converted clip for your Team. No Motion changes and nothing is sent to anyone.",
966
+ changes: "Stores one converted clip for your Team. No Campaign changes and nothing is sent to anyone.",
893
967
  visible_to: "Your Team.",
894
968
  budget_rows: [],
895
969
  retry: "A retry stores a second clip (it counts toward the 24-hour cap); an unused clip is deleted 30 days after its upload.",
@@ -903,8 +977,8 @@ var voiceClipUploadCmd = defineCommand({
903
977
  TIER_REQUIRED: "Voice clips need the Automate plan.",
904
978
  ...ROLE_ERRORS
905
979
  },
906
- seeAlso: ["curviate motion voice-clip get", "curviate motion lint", "curviate motion create"],
907
- examples: ["curviate motion voice-clip upload intro.mp3", "curviate motion voice-clip upload intro.m4a --preview"]
980
+ seeAlso: ["curviate campaign voice-clip get", "curviate campaign lint", "curviate campaign create"],
981
+ examples: ["curviate campaign voice-clip upload intro.mp3", "curviate campaign voice-clip upload intro.m4a --preview"]
908
982
  },
909
983
  args: {
910
984
  ...WRITE_SINGLE_FLAGS,
@@ -917,7 +991,7 @@ var voiceClipGetCmd = defineCommand({
917
991
  name: "get",
918
992
  description: "One Voice clip: duration, size, file name and upload time. No download link. Another Team's clip is RESOURCE_NOT_FOUND, like an unknown id.",
919
993
  risk: "read",
920
- examples: ["curviate motion voice-clip get vc_YOUR_CLIP_ID"]
994
+ examples: ["curviate campaign voice-clip get vc_YOUR_CLIP_ID"]
921
995
  },
922
996
  args: {
923
997
  ...readOnly(READ_SINGLE_FLAGS),
@@ -926,15 +1000,15 @@ var voiceClipGetCmd = defineCommand({
926
1000
  run: online(runVoiceClipGet)
927
1001
  });
928
1002
  var voiceClipCommand = defineCommand({
929
- meta: { name: "voice-clip", description: DESCRIPTIONS.motionVoiceClip },
1003
+ meta: { name: "voice-clip", description: DESCRIPTIONS.campaignVoiceClip },
930
1004
  subCommands: { upload: voiceClipUploadCmd, get: voiceClipGetCmd },
931
1005
  async run() {
932
- const { showHelp } = await import("./examples-KAMXHRLE.js");
933
- await showHelp(voiceClipCommand, ["curviate", "motion", "voice-clip"]);
1006
+ const { showHelp } = await import("./examples-IGQJCSNL.js");
1007
+ await showHelp(voiceClipCommand, ["curviate", "campaign", "voice-clip"]);
934
1008
  }
935
1009
  });
936
- var motionCommand = defineCommand({
937
- meta: { name: "motion", description: DESCRIPTIONS.motion },
1010
+ var campaignCommand = defineCommand({
1011
+ meta: { name: "campaign", description: DESCRIPTIONS.campaign },
938
1012
  subCommands: {
939
1013
  list: listCmd,
940
1014
  get: getCmd,
@@ -946,6 +1020,7 @@ var motionCommand = defineCommand({
946
1020
  archive: archiveCmd,
947
1021
  delete: deleteCmd,
948
1022
  preview: previewCmd,
1023
+ check: checkCmd,
949
1024
  add: membershipCmd("add"),
950
1025
  remove: membershipCmd("remove"),
951
1026
  lint: lintCmd,
@@ -953,14 +1028,14 @@ var motionCommand = defineCommand({
953
1028
  "voice-clip": voiceClipCommand
954
1029
  },
955
1030
  async run() {
956
- const { showHelp } = await import("./examples-KAMXHRLE.js");
957
- await showHelp(motionCommand, ["curviate", "motion"]);
1031
+ const { showHelp } = await import("./examples-IGQJCSNL.js");
1032
+ await showHelp(campaignCommand, ["curviate", "campaign"]);
958
1033
  }
959
1034
  });
960
1035
  export {
961
1036
  BULK_MAX_IDS,
962
1037
  TEMPLATES,
963
- motionCommand,
1038
+ campaignCommand,
964
1039
  runInit,
965
1040
  runLint
966
1041
  };