@dench.com/cli 0.4.7 → 0.4.8

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 (3) hide show
  1. package/crm.ts +32 -0
  2. package/dench.ts +47 -0
  3. package/package.json +1 -1
package/crm.ts CHANGED
@@ -412,6 +412,9 @@ const api = {
412
412
  "functions/crm/actions:startActionRun",
413
413
  ),
414
414
  },
415
+ members: {
416
+ list: makeFunctionReference<"query">("functions/crm/members:list"),
417
+ },
415
418
  };
416
419
 
417
420
  export async function runCrmCommand(opts: {
@@ -472,11 +475,31 @@ export async function runCrmCommand(opts: {
472
475
  return await runDocsCommand(ctx);
473
476
  case "actions":
474
477
  return await runActionsCommand(ctx);
478
+ case "members":
479
+ // Alias for `dench members` so the AI agent finds the roster
480
+ // surface from inside the `dench crm` namespace it's primed
481
+ // on. Delegates to the shared implementation in cli/members.ts
482
+ // so payload formatting + flag handling stay in lockstep.
483
+ return await runCrmMembersCommand(ctx);
475
484
  default:
476
485
  throw new CrmCliError(`Unknown crm subcommand: ${subcommand}`);
477
486
  }
478
487
  }
479
488
 
489
+ async function runCrmMembersCommand(ctx: CrmCliContext): Promise<void> {
490
+ const { runMembersCommand } = await import("./members");
491
+ // Re-prepend `--json` so the members dispatcher's own `hasFlag`
492
+ // pass sees it again — we already drained it once when computing
493
+ // `ctx.jsonOutput`, but the members CLI re-parses argv from scratch
494
+ // (same shape as a top-level invocation).
495
+ const args = ctx.jsonOutput ? ["--json", ...ctx.args] : [...ctx.args];
496
+ await runMembersCommand({
497
+ convex: ctx.convex,
498
+ args,
499
+ sessionToken: ctx.sessionToken,
500
+ });
501
+ }
502
+
480
503
  async function runObjectsCommand(ctx: CrmCliContext): Promise<void> {
481
504
  const verb = ctx.args.shift();
482
505
  switch (verb) {
@@ -2057,6 +2080,15 @@ Statuses (kanban columns):
2057
2080
  dench crm statuses list <object>
2058
2081
  dench crm statuses set <object> --statuses '[{"name":"New","color":"#94a3b8"},...]'
2059
2082
 
2083
+ Workspace members (for user-type fields):
2084
+ dench crm members list [--json] (alias: dench members list)
2085
+ List \`{ userId, role, name, email }\` for every member of the
2086
+ current org. Use the userIds when setting \`Owner\`, \`Assignee\`,
2087
+ or any other \`user\`-type field so the UI shows a real linked
2088
+ avatar instead of an unlinked literal-string badge:
2089
+ dench crm cells set task --entry <id> --field Owner --value <userId>
2090
+ dench crm entries create task --data '{"Name":"X","Owner":"<userId>"}'
2091
+
2060
2092
  Batch:
2061
2093
  dench crm batch --file ops.jsonl [--idempotency-key <key>]
2062
2094
  For repeated writes, prefer entries create-many/update-many or cells set-many;
package/dench.ts CHANGED
@@ -478,6 +478,13 @@ CRM (Daytona-native rewrite):
478
478
  Batch write helpers: entries create-many/update-many, cells set-many
479
479
  Help: dench crm help
480
480
 
481
+ Workspace members (for CRM \`user\`-type fields):
482
+ dench members list [--json] (top-level alias)
483
+ dench crm members list [--json] (canonical CRM-scoped name)
484
+ Look up real userIds for the active org so \`Owner\` / \`Assignee\`
485
+ cells assign to real members instead of being stored as unlinked
486
+ display-name strings. See \`dench members help\`.
487
+
481
488
  Live web search (Exa via the Dench Cloud Gateway, auths with DENCH_API_KEY):
482
489
  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]
483
490
  dench search contents <url> [<url>...] [--max-chars 4000] [--summary "..."] [--json]
@@ -3272,6 +3279,46 @@ async function main() {
3272
3279
  return;
3273
3280
  }
3274
3281
 
3282
+ if (command === "members") {
3283
+ // Top-level convenience surface for the same Convex query that
3284
+ // `dench crm members list` calls. Lives here (rather than only
3285
+ // under `dench crm`) so it shows up in top-level help and tab
3286
+ // completion — members aren't strictly a CRM concept, even though
3287
+ // the canonical caller today is the AI agent looking up userIds
3288
+ // for `user`-typed CRM cells.
3289
+ const subArgs = stripRuntimeFlags(args.slice(args.indexOf("members") + 1));
3290
+ const sub = subArgs[0];
3291
+ if (!sub || sub === "help" || sub === "--help") {
3292
+ const { runMembersCommand } = await import("./members");
3293
+ // biome-ignore lint/suspicious/noExplicitAny: harmless help-only stub
3294
+ await runMembersCommand({ convex: {} as any, args: subArgs });
3295
+ return;
3296
+ }
3297
+ const { runMembersCommand } = await import("./members");
3298
+ const runtime = await getRuntime();
3299
+ // Member listing is org-scoped via `requireCrmAccess`, identical
3300
+ // auth shape to `dench crm`. Dev workspaces forward the encoded
3301
+ // dev token so local --dev runs work the same way.
3302
+ if (runtime.mode === "dev") {
3303
+ await runMembersCommand({
3304
+ convex: runtime.client,
3305
+ args: subArgs,
3306
+ sessionToken: encodeDevCrmSessionToken(runtime.workspaceArgs),
3307
+ });
3308
+ return;
3309
+ }
3310
+ const authedRuntime = requireAuthenticatedRuntime(
3311
+ runtime,
3312
+ "dench members",
3313
+ );
3314
+ await runMembersCommand({
3315
+ convex: authedRuntime.client,
3316
+ args: subArgs,
3317
+ sessionToken: authedRuntime.sessionToken,
3318
+ });
3319
+ return;
3320
+ }
3321
+
3275
3322
  if (command === "fs") {
3276
3323
  await runFsCommand();
3277
3324
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dench.com/cli",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Dench agent workspace CLI.",
5
5
  "type": "module",
6
6
  "bin": {