@dench.com/cli 2.8.8-staging.192 → 2.9.0-staging.193

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/crm.ts CHANGED
@@ -520,6 +520,32 @@ type CrmBatchOp =
520
520
 
521
521
  type CrmOnConflictPolicy = "skip" | "update" | "error";
522
522
 
523
+ export const CRM_OBJECT_VISIBILITY_FLAG_VALUES = [
524
+ "workspace",
525
+ "owner_only",
526
+ "owner_plus_members",
527
+ ] as const;
528
+ type CrmObjectVisibilityFlag =
529
+ (typeof CRM_OBJECT_VISIBILITY_FLAG_VALUES)[number];
530
+
531
+ /** `--visibility` on `crm objects update`. Undefined when the flag is absent. */
532
+ export function parseObjectVisibilityFlag(
533
+ value: string | undefined,
534
+ ): CrmObjectVisibilityFlag | undefined {
535
+ if (value === undefined) return undefined;
536
+ const normalized = value.trim().toLowerCase().replace(/-/g, "_");
537
+ if (
538
+ (CRM_OBJECT_VISIBILITY_FLAG_VALUES as readonly string[]).includes(
539
+ normalized,
540
+ )
541
+ ) {
542
+ return normalized as CrmObjectVisibilityFlag;
543
+ }
544
+ throw new Error(
545
+ `--visibility must be one of ${CRM_OBJECT_VISIBILITY_FLAG_VALUES.join(", ")} (got "${value}")`,
546
+ );
547
+ }
548
+
523
549
  function parseOnConflictFlag(raw: string | undefined): CrmOnConflictPolicy {
524
550
  const value = raw ?? "skip";
525
551
  if (value === "skip" || value === "update" || value === "error") {
@@ -1345,18 +1371,28 @@ async function runObjectsCommand(ctx: CrmCliContext): Promise<void> {
1345
1371
  // Pass an empty string to clear back to the default label.
1346
1372
  const displayName = getFlag(ctx.args, "--display-name");
1347
1373
  const displayNameSingular = getFlag(ctx.args, "--display-name-singular");
1348
- assertNoUnknownFlags(ctx.args, "crm objects update");
1349
- out(
1350
- ctx,
1351
- await callMutation(ctx, api.objects.update, {
1352
- name,
1353
- description,
1354
- defaultView,
1355
- icon,
1356
- displayName,
1357
- displayNameSingular,
1358
- }),
1374
+ // Who may read the object's records. Admin-only on the server.
1375
+ const visibility = parseObjectVisibilityFlag(
1376
+ getFlag(ctx.args, "--visibility"),
1359
1377
  );
1378
+ assertNoUnknownFlags(ctx.args, "crm objects update");
1379
+ const updated = await callMutation(ctx, api.objects.update, {
1380
+ name,
1381
+ description,
1382
+ defaultView,
1383
+ icon,
1384
+ displayName,
1385
+ displayNameSingular,
1386
+ visibility,
1387
+ });
1388
+ if (visibility !== undefined && visibility !== "workspace") {
1389
+ process.stderr.write(
1390
+ `note: ${name} records created before this change have no owner and ` +
1391
+ "are hidden from everyone until one is set; switch back to " +
1392
+ "workspace to see them again.\n",
1393
+ );
1394
+ }
1395
+ out(ctx, updated);
1360
1396
  return;
1361
1397
  }
1362
1398
  case "rename": {
@@ -4150,9 +4186,15 @@ Objects (CRM tables):
4150
4186
  dench crm objects list [--json]
4151
4187
  dench crm objects get <name>
4152
4188
  dench crm objects create <name> [--description ...] [--default-view kanban] [--icon ...]
4153
- dench crm objects update <name> [--default-view ...] [--icon ...] [--display-name "Clients"] [--display-name-singular "Client"]
4189
+ dench crm objects update <name> [--default-view ...] [--icon ...] [--display-name "Clients"] [--display-name-singular "Client"] [--visibility workspace|owner_only|owner_plus_members]
4154
4190
  --display-name relabels the UI only; the canonical <name> stays the
4155
4191
  command/API identifier (works on protected objects too).
4192
+ --visibility sets who can see the object's records: everyone in the
4193
+ workspace, only the record's owner, or the owner plus the members
4194
+ listed on the record. ADMIN-ONLY (a signed-in admin, not an org key);
4195
+ works on protected objects too. Records created before the switch
4196
+ have no owner and are hidden from everyone until one is set; switch
4197
+ back to workspace to see them again.
4156
4198
  dench crm objects rename <from> <to>
4157
4199
  dench crm objects delete <name>
4158
4200
  dench crm objects archive <name> | unarchive <name>
package/dench.ts CHANGED
@@ -244,6 +244,14 @@ function hasFlag(name: string) {
244
244
 
245
245
  const BOOLEAN_FLAGS = new Set([
246
246
  "--all",
247
+ "--allow-duplicates",
248
+ "--ack-linkedin-risk",
249
+ "--stop-on-reply",
250
+ "--no-stop-on-reply",
251
+ "--clear-start",
252
+ "--clear-end",
253
+ "--reverse",
254
+ "--with-meta",
247
255
  "--compact",
248
256
  "--dev",
249
257
  "--follow",
@@ -362,6 +370,18 @@ function normalizeCliError(error: unknown): CliError {
362
370
  ],
363
371
  });
364
372
  }
373
+ if (message.includes("Sign in as a workspace member to run outreach")) {
374
+ return new CliError(
375
+ "Outreach needs a workspace member's credentials — sending accounts belong to a person, not the workspace",
376
+ {
377
+ code: "outreach_member_required",
378
+ nextActions: [
379
+ "Ask the person you are working for to run this from a chat in the Dench app, or to link their account in Slack, so the run carries their own identity. Connecting a sending account does not change whose credentials this run has.",
380
+ "In a terminal, run dench signin as a workspace member. An organization-only DENCH_API_KEY cannot run outreach.",
381
+ ],
382
+ },
383
+ );
384
+ }
365
385
  if (message.includes("Invalid Dench API key")) {
366
386
  return new CliError("Invalid Dench API key", {
367
387
  code: "invalid_api_key",
@@ -580,6 +600,16 @@ Managed email campaigns:
580
600
  dench email campaign status --campaign <id> [--json]
581
601
  Help: dench email help
582
602
 
603
+ Outreach campaigns (email + LinkedIn steps on one schedule; leads move New → Contacted → Replied):
604
+ dench campaign list [--all] [--json]
605
+ dench campaign create --name "Founder outreach" [--timezone America/Los_Angeles] [--window "Mon-Fri 9-18"] [--daily-cap 30] [--json]
606
+ dench campaign steps set <campaign> --file steps.json [--json]
607
+ dench campaign add <campaign> --object lead --view "Q3 targets" [--json]
608
+ dench campaign launch <campaign> [--ack-linkedin-risk] [--json]
609
+ dench campaign get <campaign> [--json] (status, funnel, Now/Next, holds, people)
610
+ dench campaign pause|resume|archive <campaign> [--json]
611
+ Help: dench campaign help
612
+
583
613
  Image generation / editing (via the Dench Gateway):
584
614
  dench image generate "<prompt>" [--size 1024x1024] [--quality auto|low|medium|high] [--format png|jpeg|webp] [--save-path /workspace/path/file.png] [--output <local file>] [--no-write] [--json]
585
615
  dench image edit "<prompt>" --input <path> [--input <path> ...] [--mask <path>] [--size ...] [--quality ...] [--format ...] [--save-path ...] [--output ...] [--json]
@@ -4957,6 +4987,33 @@ async function main() {
4957
4987
  return;
4958
4988
  }
4959
4989
 
4990
+ // `dench campaign` — outreach campaigns (email + LinkedIn steps). Convex
4991
+ // RPC only, member-attributed auth (an organization-only key is refused
4992
+ // server-side; normalizeCliError explains what to do).
4993
+ if (command === "campaign" || command === "campaigns") {
4994
+ const subArgs = stripRuntimeFlags(args.slice(args.indexOf(command) + 1));
4995
+ const sub = subArgs[0];
4996
+ if (!sub || sub === "help" || sub === "--help" || sub === "-h") {
4997
+ const { runCampaignCommand } = await import("./campaign");
4998
+ // biome-ignore lint/suspicious/noExplicitAny: help-only stub, never queries
4999
+ await runCampaignCommand({ convex: {} as any, args: subArgs });
5000
+ return;
5001
+ }
5002
+ const { runCampaignCommand } = await import("./campaign");
5003
+ const runtime = await getRuntime();
5004
+ const authedRuntime = requireAuthenticatedRuntime(
5005
+ runtime,
5006
+ `dench ${command}`,
5007
+ );
5008
+ await runCampaignCommand({
5009
+ convex: authedRuntime.client,
5010
+ args: subArgs,
5011
+ jsonOutput: json,
5012
+ sessionToken: authedRuntime.sessionToken,
5013
+ });
5014
+ return;
5015
+ }
5016
+
4960
5017
  // `dench routine` / `dench routines` are UI-friendly aliases for
4961
5018
  // `dench cron`. Same dispatch, same auth, same handler — only the
4962
5019
  // top-level command name differs to match the workspace UI rename.
package/email.ts CHANGED
@@ -416,15 +416,19 @@ Sequences (automatic multi-step follow-ups):
416
416
  dench email sequence enrollment pause|resume|stop --enrollment <id> [--json]
417
417
  dench email sequence archive --sequence <id> [--json]
418
418
 
419
- Email + LinkedIn multichannel sequences:
419
+ Email + LinkedIn multichannel sequences (see \`dench campaign\` — the fuller surface: schedule, steps round-trip, fill from a CRM view, Now/Next, per-person controls, activity):
420
420
  dench email multichannel create --name "Founder outreach" [--timezone America/Los_Angeles] [--json]
421
421
  dench email multichannel list [--all] [--json]
422
422
  dench email multichannel status --sequence <id> [--json]
423
+ (--json adds per-person currentRuns[].hold / linkedinAction — why a LinkedIn step is waiting — lastTouches[] with the last delivered step,
424
+ and connectedEntries[].lead { entryId, status }: the Lead each person moves — Status advances New → Contacted → Replied on its own.
425
+ Every touch is also filed as an event on the lead's History tab; read them in the dashboard under the campaign's Activity feed.)
423
426
  dench email multichannel flow --sequence <id> --file steps.json [--json]
424
427
  dench email multichannel enroll --sequence <id> [--name Ada] [--email ada@x.com] [--linkedin-url https://linkedin.com/in/ada] [--json]
425
428
  dench email multichannel enroll-from-object --sequence <id> --object lead --entries id1,id2 [--email-field Email] [--linkedin-field "POC LinkedIn URL"] [--relation-field Contact] [--reverse] [--allow-duplicates] [--json]
426
429
  dench email multichannel launch --sequence <id> [--ack-linkedin-risk] [--json]
427
- dench email multichannel pause|resume|archive --sequence <id> [--json]`);
430
+ dench email multichannel pause|resume|archive --sequence <id> [--json]
431
+ (see \`dench campaign help\` for the same campaigns with schedule, view-based add, launch checks and the Now/Next feed)`);
428
432
  }
429
433
 
430
434
  export async function runEmailCommand(ctx: EmailCliContext): Promise<void> {