@dench.com/cli 2.8.8-staging.192 → 2.9.1-staging.200

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",
@@ -529,12 +549,17 @@ Notifications (the bell's inbox):
529
549
  dench notifications prefs [--set emailEnabled=false] [--set <kind>.email=false]
530
550
  Help: dench notifications help
531
551
 
532
- Workspace members (for CRM \`user\`-type fields):
552
+ Workspace members (for CRM \`user\`-type fields, and who's doing what):
533
553
  dench members list [--json] (top-level alias)
534
554
  dench crm members list [--json] (canonical CRM-scoped name)
535
555
  Look up real userIds for the active org so \`Owner\` / \`Assignee\`
536
556
  cells assign to real members instead of being stored as unlinked
537
557
  display-name strings. See \`dench members help\`.
558
+ dench members get <userId|email> profile: tagline, timezone, presence, open tasks
559
+ dench members activity <userId|email> their comments + record changes, newest first
560
+ dench members tasks <userId|email> open tasks assigned to them
561
+ dench members presence [<userId|email>...] online / away / offline
562
+ dench members me [--name --tagline --timezone --avatar <file>] your own profile
538
563
 
539
564
  Live web search (Exa via the Dench Gateway, auths with the active \`dench signin\` agent session or DENCH_API_KEY):
540
565
  dench search "<query>" [--num-results N] [--type auto|fast|deep|deep-reasoning|neural] [--category news|company|people|...] [--include-domains a.com,b.com] [--exclude-domains c.com] [--max-chars 800] [--json]
@@ -580,6 +605,16 @@ Managed email campaigns:
580
605
  dench email campaign status --campaign <id> [--json]
581
606
  Help: dench email help
582
607
 
608
+ Outreach campaigns (email + LinkedIn steps on one schedule; leads move New → Contacted → Replied):
609
+ dench campaign list [--all] [--json]
610
+ dench campaign create --name "Founder outreach" [--timezone America/Los_Angeles] [--window "Mon-Fri 9-18"] [--daily-cap 30] [--json]
611
+ dench campaign steps set <campaign> --file steps.json [--json]
612
+ dench campaign add <campaign> --object lead --view "Q3 targets" [--json]
613
+ dench campaign launch <campaign> [--ack-linkedin-risk] [--json]
614
+ dench campaign get <campaign> [--json] (status, funnel, Now/Next, holds, people)
615
+ dench campaign pause|resume|archive <campaign> [--json]
616
+ Help: dench campaign help
617
+
583
618
  Image generation / editing (via the Dench Gateway):
584
619
  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
620
  dench image edit "<prompt>" --input <path> [--input <path> ...] [--mask <path>] [--size ...] [--quality ...] [--format ...] [--save-path ...] [--output ...] [--json]
@@ -4957,6 +4992,33 @@ async function main() {
4957
4992
  return;
4958
4993
  }
4959
4994
 
4995
+ // `dench campaign` — outreach campaigns (email + LinkedIn steps). Convex
4996
+ // RPC only, member-attributed auth (an organization-only key is refused
4997
+ // server-side; normalizeCliError explains what to do).
4998
+ if (command === "campaign" || command === "campaigns") {
4999
+ const subArgs = stripRuntimeFlags(args.slice(args.indexOf(command) + 1));
5000
+ const sub = subArgs[0];
5001
+ if (!sub || sub === "help" || sub === "--help" || sub === "-h") {
5002
+ const { runCampaignCommand } = await import("./campaign");
5003
+ // biome-ignore lint/suspicious/noExplicitAny: help-only stub, never queries
5004
+ await runCampaignCommand({ convex: {} as any, args: subArgs });
5005
+ return;
5006
+ }
5007
+ const { runCampaignCommand } = await import("./campaign");
5008
+ const runtime = await getRuntime();
5009
+ const authedRuntime = requireAuthenticatedRuntime(
5010
+ runtime,
5011
+ `dench ${command}`,
5012
+ );
5013
+ await runCampaignCommand({
5014
+ convex: authedRuntime.client,
5015
+ args: subArgs,
5016
+ jsonOutput: json,
5017
+ sessionToken: authedRuntime.sessionToken,
5018
+ });
5019
+ return;
5020
+ }
5021
+
4960
5022
  // `dench routine` / `dench routines` are UI-friendly aliases for
4961
5023
  // `dench cron`. Same dispatch, same auth, same handler — only the
4962
5024
  // 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> {