@audienti/cli 0.1.35 → 0.1.36

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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to the Audienti CLI are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.1.36] - 2026-08-22
8
+
9
+ ### Added
10
+
11
+ - Add `audienti lists routing-rules` commands to inspect, create, update, remove, reorder, and apply the same account-scoped list routing rules available in the UI.
12
+
7
13
  ## [0.1.35] - 2026-08-18
8
14
 
9
15
  ### Added
package/README.md CHANGED
@@ -4,7 +4,7 @@ Audienti CLI is the agent-first command-line client for the Audienti production
4
4
  API and the local bridge for Audienti's app-hosted MCP endpoint. It lets local
5
5
  coding agents and operators inspect accounts,
6
6
  create and manage plays, import prospects, build lists, manage task reminders,
7
- and work supported operator flows.
7
+ configure list routing rules, and work supported operator flows.
8
8
 
9
9
  ## Install
10
10
 
@@ -163,6 +163,8 @@ audienti tasks add --title "Review Cristina" --due 2026-07-24T11:00 --prospect <
163
163
  audienti tasks complete <ptsk_id>
164
164
  audienti dnc list
165
165
  audienti company-rules list
166
+ audienti lists routing-rules <list_id> list
167
+ audienti lists routing-rules <list_id> apply
166
168
  audienti users activity --window 7d
167
169
  audienti analytics prospects --window 24h
168
170
  audienti analytics dashboard --play-tag wine_campaign
@@ -201,6 +203,38 @@ audienti tasks add --title "Review target account" --due 2026-07-24T11:00 --list
201
203
  audienti tasks complete <ptsk_id>
202
204
  ```
203
205
 
206
+ To manage the same ordered rules shown in a list's Routing Rules UI, use a JSON
207
+ payload for create and update operations:
208
+
209
+ ```bash
210
+ audienti lists routing-rules <list_id> list
211
+ audienti lists routing-rules <list_id> create --payload routing-rule.json
212
+ audienti lists routing-rules <list_id> update <rule_id> --payload routing-rule.json
213
+ audienti lists routing-rules <list_id> move <rule_id> up
214
+ audienti lists routing-rules <list_id> remove <rule_id>
215
+ audienti lists routing-rules <list_id> apply
216
+ ```
217
+
218
+ ```json
219
+ {
220
+ "name": "VP prospects to Alice",
221
+ "enabled": true,
222
+ "action_kind": "assign_user",
223
+ "target_account_user_id": "alice@example.com",
224
+ "conditions": {
225
+ "seniorities": [
226
+ {"id": "5", "name": "Vice President", "negative": false}
227
+ ],
228
+ "seniority_match_mode": "at_least"
229
+ }
230
+ }
231
+ ```
232
+
233
+ Use `action_kind: "route_to_list"` with `target_list_id` to route to another
234
+ working list. `apply` queues the existing list-routing background job, just like
235
+ the UI; it reports that work was enqueued, not that every prospect has finished
236
+ routing. Run `audienti lists routing-rules help` for the full condition contract.
237
+
204
238
  To inspect activity for prospects that entered the account during a specific
205
239
  cohort while keeping a separate activity window:
206
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audienti/cli",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Agent-first command-line client for Audienti.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: audienti
3
- description: Use when the user wants to operate Audienti through the production CLI or app-hosted MCP endpoint, including account selection, plays, prospect imports, lists, message previews, analytics, or supported operator outcomes.
3
+ description: Use when the user wants to operate Audienti through the production CLI or app-hosted MCP endpoint, including account selection, plays, prospect imports, lists and routing rules, message previews, analytics, or supported operator outcomes.
4
4
  ---
5
5
 
6
6
  # Audienti CLI and MCP
@@ -102,6 +102,10 @@ audienti prospects unlock <prsp_id> --json
102
102
  audienti users activity me --window 7d --json
103
103
  audienti prospects import-batch --file prospects.csv --motion <motn_id> --assigned-user me --json
104
104
  audienti lists create --name "Target list" --json
105
+ audienti lists routing-rules <list_id> list --json
106
+ audienti lists routing-rules <list_id> create --payload routing-rule.json --json
107
+ audienti lists routing-rules <list_id> move <rule_id> up --json
108
+ audienti lists routing-rules <list_id> apply --json
105
109
  audienti motions quick-start --url https://example.com --wait --confirm --json
106
110
  audienti motions abm-companies <motn_id> add --file abm-domains.txt --json
107
111
  audienti motions abm-companies <motn_id> list --json
@@ -125,6 +129,12 @@ audienti writer test-run <prsp_id> --mode step --branch no-accept --step 3 --rep
125
129
  audienti writer test-run show <prsp_id> <rprt_id>
126
130
  ```
127
131
 
132
+ List routing-rule create and update commands accept the same normalized
133
+ condition and action data as the list UI. Inspect the ordered rules first, use
134
+ `audienti lists routing-rules help` for the payload contract, and treat `apply`
135
+ as an asynchronous relaunch: it queues the existing routing job and does not
136
+ mean every list member has finished routing.
137
+
128
138
  `audienti writer test-run <prsp_id>` starts a report-backed writing session and
129
139
  builds the campaign timeline without drafting every message. The printed
130
140
  `Report: rprt_...` id is the session handle. Pass `--report <rprt_id>` when
package/src/api-client.js CHANGED
@@ -268,6 +268,44 @@ export class AudientiClient {
268
268
  });
269
269
  }
270
270
 
271
+ listRoutingRules(accountId, listId) {
272
+ return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules"]));
273
+ }
274
+
275
+ createListRoutingRule(accountId, listId, body) {
276
+ return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules"]), {
277
+ method: "POST",
278
+ body
279
+ });
280
+ }
281
+
282
+ updateListRoutingRule(accountId, listId, ruleId, body) {
283
+ return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", ruleId]), {
284
+ method: "PATCH",
285
+ body
286
+ });
287
+ }
288
+
289
+ removeListRoutingRule(accountId, listId, ruleId) {
290
+ return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", ruleId]), {
291
+ method: "DELETE"
292
+ });
293
+ }
294
+
295
+ moveListRoutingRule(accountId, listId, ruleId, body) {
296
+ return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", ruleId, "move"]), {
297
+ method: "PATCH",
298
+ body
299
+ });
300
+ }
301
+
302
+ applyListRoutingRules(accountId, listId) {
303
+ return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", "apply"]), {
304
+ method: "POST",
305
+ body: {}
306
+ });
307
+ }
308
+
271
309
  motions(accountId) {
272
310
  return this.requestJson(accountPath(accountId, ["motions"]));
273
311
  }
package/src/cli.js CHANGED
@@ -99,6 +99,12 @@ const ICPS_ADD_TAG_USAGE = "Usage: audienti icps add-tag <icp_id> <tag> [--json]
99
99
  const ICPS_REMOVE_TAG_USAGE = "Usage: audienti icps remove-tag <icp_id> <tag> [--json] [--account <acct_id>]";
100
100
  const LISTS_ADD_TAG_USAGE = "Usage: audienti lists add-tag <list_id> <tag> [--json] [--account <acct_id>]";
101
101
  const LISTS_REMOVE_TAG_USAGE = "Usage: audienti lists remove-tag <list_id> <tag> [--json] [--account <acct_id>]";
102
+ const LIST_ROUTING_RULES_LIST_USAGE = "Usage: audienti lists routing-rules <list_id> list [--json] [--account <acct_id>]";
103
+ const LIST_ROUTING_RULES_CREATE_USAGE = "Usage: audienti lists routing-rules <list_id> create --payload <file.json> [--json] [--account <acct_id>]";
104
+ const LIST_ROUTING_RULES_UPDATE_USAGE = "Usage: audienti lists routing-rules <list_id> update <rule_id> --payload <file.json> [--json] [--account <acct_id>]";
105
+ const LIST_ROUTING_RULES_REMOVE_USAGE = "Usage: audienti lists routing-rules <list_id> remove <rule_id> [--json] [--account <acct_id>]";
106
+ const LIST_ROUTING_RULES_MOVE_USAGE = "Usage: audienti lists routing-rules <list_id> move <rule_id> <up|down> [--json] [--account <acct_id>]";
107
+ const LIST_ROUTING_RULES_APPLY_USAGE = "Usage: audienti lists routing-rules <list_id> apply [--json] [--account <acct_id>]";
102
108
  const ANALYTICS_PROSPECTS_USAGE = "Usage: audienti analytics prospects [--window 24h] [--cohort-start YYYY-MM-DD --cohort-end YYYY-MM-DD] [--motion <motn_id>] [--list <list_id>] [--provenance <source>] [--user <account_user_id|email|name|me>] [--json] [--account <acct_id>]";
103
109
  const ANALYTICS_PROSPECTS_COHORT_ANALYSIS_USAGE = "Usage: audienti analytics prospects cohort-analysis [--weeks <n>] [--window 24h] [--motion <motn_id>] [--list <list_id>] [--provenance <source>] [--user <account_user_id|email|name|me>] [--json] [--account <acct_id>]";
104
110
  const ANALYTICS_USERS_USAGE = "Usage: audienti analytics users [--user <account_user_id|email|name|me>] [--window 30d | --start YYYY-MM-DD --end YYYY-MM-DD] [--cohort-start YYYY-MM-DD --cohort-end YYYY-MM-DD] [--motion <motn_id>] [--list <list_id>] [--provenance <source>] [--platform <linkedin|email|gmail>] [--json] [--account <acct_id>]";
@@ -237,6 +243,7 @@ async function dispatch(argv, context) {
237
243
  if (normalizedResource === "lists" && action === "prospects") return listProspects(rest, context, { accountOverride });
238
244
  if (normalizedResource === "lists" && action === "add-prospects") return listsAddProspects(rest, context, { accountOverride });
239
245
  if (normalizedResource === "lists" && action === "remove-prospects") return listsRemoveProspects(rest, context, { accountOverride });
246
+ if (normalizedResource === "lists" && ["routing-rules", "rules"].includes(action)) return listsRoutingRules(rest, context, { accountOverride });
240
247
  if (normalizedResource === "motions" && action === "list") return motionsList(rest, context, { accountOverride });
241
248
  if (normalizedResource === "motions" && action === "show") return motionsShow(rest, context, { accountOverride });
242
249
  if (normalizedResource === "motions" && action === "status") return motionsStatus(rest, context, { accountOverride });
@@ -1491,6 +1498,104 @@ async function listsRemoveProspects(args, context, { accountOverride } = {}) {
1491
1498
  return rejected ? 1 : 0;
1492
1499
  }
1493
1500
 
1501
+ async function listsRoutingRules(args, context, { accountOverride } = {}) {
1502
+ const [listId, subaction, ...rest] = args;
1503
+ if (!listId || !subaction) {
1504
+ throw new CommandError("Usage: audienti lists routing-rules <list_id> <list|create|update|remove|move|apply> [args] [--json] [--account <acct_id>]");
1505
+ }
1506
+
1507
+ if (subaction === "list") return listRoutingRulesList(listId, rest, context, { accountOverride });
1508
+ if (subaction === "create") return listRoutingRulesCreate(listId, rest, context, { accountOverride });
1509
+ if (subaction === "update") return listRoutingRulesUpdate(listId, rest, context, { accountOverride });
1510
+ if (["remove", "delete"].includes(subaction)) return listRoutingRulesRemove(listId, rest, context, { accountOverride });
1511
+ if (subaction === "move") return listRoutingRulesMove(listId, rest, context, { accountOverride });
1512
+ if (subaction === "apply") return listRoutingRulesApply(listId, rest, context, { accountOverride });
1513
+
1514
+ throw new CommandError("Usage: audienti lists routing-rules <list_id> <list|create|update|remove|move|apply> [args] [--json] [--account <acct_id>]");
1515
+ }
1516
+
1517
+ async function listRoutingRulesList(listId, args, context, { accountOverride } = {}) {
1518
+ const { values, positionals } = parseCommandArgs(args, jsonOptions());
1519
+ if (positionals.length > 0) throw new CommandError(LIST_ROUTING_RULES_LIST_USAGE);
1520
+
1521
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
1522
+ const payload = await client.listRoutingRules(accountId, listId);
1523
+ if (values.json) return writeJson(context.stdout, payload);
1524
+
1525
+ renderListRoutingRules(payload, context);
1526
+ }
1527
+
1528
+ async function listRoutingRulesCreate(listId, args, context, { accountOverride } = {}) {
1529
+ const { values, positionals } = parseCommandArgs(args, {
1530
+ ...jsonOptions(),
1531
+ payload: {type: "string"}
1532
+ });
1533
+ if (positionals.length > 0 || !values.payload) throw new CommandError(LIST_ROUTING_RULES_CREATE_USAGE);
1534
+
1535
+ const ruleInput = await readJsonPayload(values.payload);
1536
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
1537
+ const payload = await client.createListRoutingRule(accountId, listId, {routing_rule: ruleInput});
1538
+ if (values.json) return writeJson(context.stdout, payload);
1539
+
1540
+ const rule = payload?.routing_rule;
1541
+ writeLine(context.stdout, `Created routing rule ${display(rule?.name)} (${display(rule?.id)}) on list ${display(payload?.list_id || listId)}.`);
1542
+ }
1543
+
1544
+ async function listRoutingRulesUpdate(listId, args, context, { accountOverride } = {}) {
1545
+ const { values, positionals } = parseCommandArgs(args, {
1546
+ ...jsonOptions(),
1547
+ payload: {type: "string"}
1548
+ });
1549
+ if (positionals.length !== 1 || !values.payload) throw new CommandError(LIST_ROUTING_RULES_UPDATE_USAGE);
1550
+
1551
+ const ruleInput = await readJsonPayload(values.payload);
1552
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
1553
+ const payload = await client.updateListRoutingRule(accountId, listId, positionals[0], {routing_rule: ruleInput});
1554
+ if (values.json) return writeJson(context.stdout, payload);
1555
+
1556
+ const rule = payload?.routing_rule;
1557
+ writeLine(context.stdout, `Updated routing rule ${display(rule?.name)} (${display(rule?.id)}) on list ${display(payload?.list_id || listId)}.`);
1558
+ }
1559
+
1560
+ async function listRoutingRulesRemove(listId, args, context, { accountOverride } = {}) {
1561
+ const { values, positionals } = parseCommandArgs(args, jsonOptions());
1562
+ if (positionals.length !== 1) throw new CommandError(LIST_ROUTING_RULES_REMOVE_USAGE);
1563
+
1564
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
1565
+ const payload = await client.removeListRoutingRule(accountId, listId, positionals[0]);
1566
+ if (values.json) return writeJson(context.stdout, payload);
1567
+
1568
+ const rule = payload?.routing_rule;
1569
+ writeLine(context.stdout, `Removed routing rule ${display(rule?.name)} (${display(rule?.id || positionals[0])}) from list ${display(listId)}.`);
1570
+ }
1571
+
1572
+ async function listRoutingRulesMove(listId, args, context, { accountOverride } = {}) {
1573
+ const { values, positionals } = parseCommandArgs(args, jsonOptions());
1574
+ const [ruleId, direction] = positionals;
1575
+ if (positionals.length !== 2 || !["up", "down"].includes(direction)) {
1576
+ throw new CommandError(LIST_ROUTING_RULES_MOVE_USAGE);
1577
+ }
1578
+
1579
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
1580
+ const payload = await client.moveListRoutingRule(accountId, listId, ruleId, {direction});
1581
+ if (values.json) return writeJson(context.stdout, payload);
1582
+
1583
+ const verb = payload?.moved ? "Moved" : "Could not move";
1584
+ writeLine(context.stdout, `${verb} routing rule ${display(ruleId)} ${direction} on list ${display(payload?.list_id || listId)}.`);
1585
+ renderListRoutingRules(payload, context);
1586
+ }
1587
+
1588
+ async function listRoutingRulesApply(listId, args, context, { accountOverride } = {}) {
1589
+ const { values, positionals } = parseCommandArgs(args, jsonOptions());
1590
+ if (positionals.length > 0) throw new CommandError(LIST_ROUTING_RULES_APPLY_USAGE);
1591
+
1592
+ const { client, accountId } = await requireAccountContext(context, { accountOverride });
1593
+ const payload = await client.applyListRoutingRules(accountId, listId);
1594
+ if (values.json) return writeJson(context.stdout, payload);
1595
+
1596
+ writeLine(context.stdout, `Routing rules will be applied in the background to list ${display(payload?.list_id || listId)}.`);
1597
+ }
1598
+
1494
1599
  async function motionsList(args, context, { accountOverride } = {}) {
1495
1600
  const { values, positionals } = parseCommandArgs(args, {
1496
1601
  ...jsonOptions(),
@@ -4132,6 +4237,30 @@ function renderList(list, context) {
4132
4237
  if (list?.description) writeLine(context.stdout, `Description: ${list.description}`);
4133
4238
  }
4134
4239
 
4240
+ function renderListRoutingRules(payload, context) {
4241
+ const rules = Array.isArray(payload?.routing_rules) ? payload.routing_rules : [];
4242
+ if (rules.length === 0) return writeLine(context.stdout, "No routing rules found.");
4243
+
4244
+ writeLine(context.stdout, "RULE ID\tPOSITION\tENABLED\tACTION\tTARGET\tNAME");
4245
+ for (const rule of rules) {
4246
+ writeLine(context.stdout, [
4247
+ display(rule.id),
4248
+ display(rule.position),
4249
+ rule.enabled ? "yes" : "no",
4250
+ display(rule.action_kind),
4251
+ routingRuleTargetLabel(rule),
4252
+ display(rule.name)
4253
+ ].join("\t"));
4254
+ }
4255
+ }
4256
+
4257
+ function routingRuleTargetLabel(rule) {
4258
+ return rule?.target_account_user?.name ||
4259
+ rule?.target_account_user?.email ||
4260
+ rule?.target_list?.name ||
4261
+ "-";
4262
+ }
4263
+
4135
4264
  function renderTags(tags, context) {
4136
4265
  if (!Array.isArray(tags) || tags.length === 0) return writeLine(context.stdout, "No tags found.");
4137
4266
 
@@ -6492,6 +6621,9 @@ const HELP_TOPICS = new Map([
6492
6621
  " audienti lists prospects <list_id>",
6493
6622
  " audienti lists add-tag <list_id> <tag>",
6494
6623
  " audienti lists remove-tag <list_id> <tag>",
6624
+ " audienti lists routing-rules <list_id> list",
6625
+ " audienti lists routing-rules <list_id> create --payload <file.json>",
6626
+ " audienti lists routing-rules <list_id> apply",
6495
6627
  " audienti tags list",
6496
6628
  " audienti tags show <tag>",
6497
6629
  " audienti tasks list [--status open]",
@@ -7472,13 +7604,63 @@ const HELP_TOPICS = new Map([
7472
7604
  " audienti lists prospects <list_id> [--json]",
7473
7605
  " audienti lists add-prospects <list_id> <prsp_id> [prsp_id...] [--json]",
7474
7606
  " audienti lists remove-prospects <list_id> <prsp_id> [prsp_id...] [--json]",
7607
+ " audienti lists routing-rules <list_id> <list|create|update|remove|move|apply> [args] [--json]",
7475
7608
  "",
7476
- "Status: read, create, update, delete, and membership commands implemented",
7609
+ "Status: read, create, update, delete, membership, and routing-rule commands implemented",
7477
7610
  "",
7478
7611
  "ID shape:",
7479
7612
  " list_id: list_ prefix id"
7480
7613
  ].join("\n")],
7481
7614
 
7615
+ ["lists routing-rules", [
7616
+ "Usage:",
7617
+ " audienti lists routing-rules <list_id> list [--json] [--account <acct_id>]",
7618
+ " audienti lists routing-rules <list_id> create --payload <file.json> [--json] [--account <acct_id>]",
7619
+ " audienti lists routing-rules <list_id> update <rule_id> --payload <file.json> [--json] [--account <acct_id>]",
7620
+ " audienti lists routing-rules <list_id> remove <rule_id> [--json] [--account <acct_id>]",
7621
+ " audienti lists routing-rules <list_id> move <rule_id> <up|down> [--json] [--account <acct_id>]",
7622
+ " audienti lists routing-rules <list_id> apply [--json] [--account <acct_id>]",
7623
+ "",
7624
+ "Status: implemented",
7625
+ "",
7626
+ "Purpose:",
7627
+ " Configure, inspect, reorder, and relaunch the same routing rules available in the list UI.",
7628
+ " Apply only queues the existing background job; it does not wait for routing to finish.",
7629
+ "",
7630
+ "Payload shape:",
7631
+ " name: string",
7632
+ " enabled: boolean | optional",
7633
+ " position: non-negative integer | optional",
7634
+ " action_kind: assign_user | route_to_list",
7635
+ " target_account_user_id: account-user id, email, or me | required for assign_user",
7636
+ " target_list_id: list_ prefix id or numeric id | required for route_to_list",
7637
+ " conditions: object | optional",
7638
+ "",
7639
+ "Condition keys:",
7640
+ " locations, company_locations, seniorities, job_titles, bio_texts,",
7641
+ " company_sizes, company_types, company_keywords, seniority_match_mode, industry_groups",
7642
+ "",
7643
+ "Example payload file:",
7644
+ " {",
7645
+ " \"name\": \"VP prospects to Alice\",",
7646
+ " \"enabled\": true,",
7647
+ " \"action_kind\": \"assign_user\",",
7648
+ " \"target_account_user_id\": \"alice@example.com\",",
7649
+ " \"conditions\": {",
7650
+ " \"seniorities\": [{\"id\": \"5\", \"name\": \"Vice President\", \"negative\": false}],",
7651
+ " \"seniority_match_mode\": \"at_least\"",
7652
+ " }",
7653
+ " }",
7654
+ "",
7655
+ "API:",
7656
+ " GET /api/v1/accounts/:account_id/lists/:list_id/routing_rules.json",
7657
+ " POST /api/v1/accounts/:account_id/lists/:list_id/routing_rules.json",
7658
+ " PATCH /api/v1/accounts/:account_id/lists/:list_id/routing_rules/:id.json",
7659
+ " DELETE /api/v1/accounts/:account_id/lists/:list_id/routing_rules/:id.json",
7660
+ " PATCH /api/v1/accounts/:account_id/lists/:list_id/routing_rules/:id/move.json",
7661
+ " POST /api/v1/accounts/:account_id/lists/:list_id/routing_rules/apply.json"
7662
+ ].join("\n")],
7663
+
7482
7664
  ["lists list", [
7483
7665
  "Usage:",
7484
7666
  " audienti lists list [--tag <tag>] [--json] [--account <acct_id>]",