@dench.com/cli 3.12.31-staging.1469 → 3.12.33-staging.1478
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/app-sdk.d.ts +412 -3
- package/crm-columns.ts +982 -0
- package/crm.ts +40 -5
- package/dench.ts +15 -9
- package/leads.ts +204 -40
- package/lib/api-schemas.ts +12 -1
- package/lib/app-sdk-catalog.generated.ts +18 -1
- package/lib/app-sdk-surface.ts +3 -0
- package/lib/command-registry.ts +655 -2
- package/lib/references.generated.json +8 -8
- package/package.json +2 -1
package/crm.ts
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
import type { ConvexHttpClient } from "convex/browser";
|
|
34
34
|
import { makeFunctionReference } from "convex/server";
|
|
35
35
|
import { runAnalyticsCommand } from "./crm-analytics";
|
|
36
|
+
import { runColumnsCommand } from "./crm-columns";
|
|
36
37
|
import {
|
|
37
38
|
runActivityCommand,
|
|
38
39
|
runBriefCommand,
|
|
@@ -1152,23 +1153,34 @@ const api = {
|
|
|
1152
1153
|
|
|
1153
1154
|
/** These read commands have local, command-specific help (no runtime needed). */
|
|
1154
1155
|
export function isCrmReadHelpRequest(args: readonly string[]): boolean {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1156
|
+
const filtered = args.filter((arg) => arg !== "--json");
|
|
1157
|
+
const command = filtered[0];
|
|
1158
|
+
if (
|
|
1157
1159
|
(command === "query" || command === "aggregate") &&
|
|
1158
|
-
(
|
|
1160
|
+
(filtered.includes("--help") || filtered.includes("-h"))
|
|
1161
|
+
) {
|
|
1162
|
+
return true;
|
|
1163
|
+
}
|
|
1164
|
+
return (
|
|
1165
|
+
command === "columns" &&
|
|
1166
|
+
(filtered.length === 1 ||
|
|
1167
|
+
filtered[1] === "help" ||
|
|
1168
|
+
filtered.includes("--help") ||
|
|
1169
|
+
filtered.includes("-h"))
|
|
1159
1170
|
);
|
|
1160
1171
|
}
|
|
1161
1172
|
|
|
1162
1173
|
export async function runCrmCommand(opts: {
|
|
1163
1174
|
convex: ConvexHttpClient;
|
|
1164
1175
|
args: string[];
|
|
1176
|
+
jsonOutput?: boolean;
|
|
1165
1177
|
sessionToken?: string;
|
|
1166
1178
|
enrichmentGateway?: Pick<EnrichmentGatewayOptions, "apiKey" | "baseUrl">;
|
|
1167
1179
|
host?: string;
|
|
1168
1180
|
workspaceSlug?: string;
|
|
1169
1181
|
}): Promise<void> {
|
|
1170
1182
|
const args = [...opts.args];
|
|
1171
|
-
const jsonOutput = hasFlag(args, "--json");
|
|
1183
|
+
const jsonOutput = hasFlag(args, "--json") || Boolean(opts.jsonOutput);
|
|
1172
1184
|
const ctx: CrmCliContext = {
|
|
1173
1185
|
convex: opts.convex,
|
|
1174
1186
|
args,
|
|
@@ -1193,10 +1205,12 @@ export async function runCrmCommand(opts: {
|
|
|
1193
1205
|
Default limit: 100. Maximum: 1000 for a one-shot array, 100 for a cursor page.
|
|
1194
1206
|
Continue cursor pages until isDone, including empty filtered pages.
|
|
1195
1207
|
Example: dench crm query company --where '{"Status":"New"}' --select Name --limit 25 --json`);
|
|
1196
|
-
} else {
|
|
1208
|
+
} else if (subcommand === "aggregate") {
|
|
1197
1209
|
console.log(`Usage: dench crm aggregate <object> --field <Field> [--sum <NumberField>] [--json]
|
|
1198
1210
|
Count rows per value of --field. --sum also totals a number field within each bucket.
|
|
1199
1211
|
Example: dench crm aggregate deal --field Stage --sum Amount --json`);
|
|
1212
|
+
} else if (subcommand === "columns") {
|
|
1213
|
+
return await runColumnsCommand(ctx);
|
|
1200
1214
|
}
|
|
1201
1215
|
return;
|
|
1202
1216
|
}
|
|
@@ -1259,6 +1273,8 @@ Example: dench crm aggregate deal --field Stage --sum Amount --json`);
|
|
|
1259
1273
|
return await runReportsCommand(ctx);
|
|
1260
1274
|
case "analytics":
|
|
1261
1275
|
return await runAnalyticsCommand(ctx);
|
|
1276
|
+
case "columns":
|
|
1277
|
+
return await runColumnsCommand(ctx);
|
|
1262
1278
|
case "detections":
|
|
1263
1279
|
return await runDetectionsCommand(ctx);
|
|
1264
1280
|
case "privacy":
|
|
@@ -1323,6 +1339,7 @@ const CRM_SUBCOMMANDS = [
|
|
|
1323
1339
|
"enrich",
|
|
1324
1340
|
"reports",
|
|
1325
1341
|
"analytics",
|
|
1342
|
+
"columns",
|
|
1326
1343
|
"detections",
|
|
1327
1344
|
"privacy",
|
|
1328
1345
|
"docs",
|
|
@@ -5812,6 +5829,24 @@ Analytics (the dashboard strip above every object table — same math the UI dra
|
|
|
5812
5829
|
default either way.
|
|
5813
5830
|
Deep link: /?path=<object>&analytics=1[&view=<view>][&analyticsPeriod=<period>]
|
|
5814
5831
|
|
|
5832
|
+
Columns (staging lists + cited AI Research columns — 2 AI credits/row, zero autorun):
|
|
5833
|
+
dench crm columns lists [--json]
|
|
5834
|
+
dench crm columns create-list <displayName> [--entity-kind company|person] [--json]
|
|
5835
|
+
dench crm columns delete-list <objectName> [--json]
|
|
5836
|
+
dench crm columns summary <object> [--json]
|
|
5837
|
+
dench crm columns create-ai <object> <name> --prompt <text> --output-kind fit_check|text|enum|number|url [--enum-values '<JSON>'] [--description <text>] [--required-input-fields <ids>] [--json]
|
|
5838
|
+
dench crm columns update-ai <object> <field> [--prompt <text>] [--enum-values '<JSON>'] [--description <text>] [--required-input-fields <ids>] [--json]
|
|
5839
|
+
dench crm columns delete-ai <object> <field> [--json]
|
|
5840
|
+
dench crm columns estimate-run <object> <field> --scope selected|empty|all [--entry-ids <id1,id2>] [--include-unknown-and-failed|--no-include-unknown-and-failed] [--limit <1..2000>] [--json]
|
|
5841
|
+
dench crm columns start-run <object> <field> --scope selected|empty|all [--entry-ids <id1,id2>] [--include-unknown-and-failed|--no-include-unknown-and-failed] [--limit <1..2000>] [--credit-stop-ceiling <N|null>|--clear-credit-stop-ceiling] [--json]
|
|
5842
|
+
dench crm columns pause-run <runId> [--json]
|
|
5843
|
+
dench crm columns resume-run <runId> [--credit-stop-ceiling <N|null>|--clear-credit-stop-ceiling] [--json]
|
|
5844
|
+
dench crm columns stop-run <runId> [--json]
|
|
5845
|
+
dench crm columns run-status <object> [--field <field>] [--run-id <runId>] [--json]
|
|
5846
|
+
dench crm columns override-cell <object> <entryId> <field> (--value <JSON|text> | --clear) [--json]
|
|
5847
|
+
dench crm columns rerun-cell <object> <entryId> <field> [--unlock-override] [--json]
|
|
5848
|
+
dench crm columns provenance <object> --entry-ids <id1,id2> [--json]
|
|
5849
|
+
|
|
5815
5850
|
Docs:
|
|
5816
5851
|
dench crm docs list
|
|
5817
5852
|
dench crm docs create <path> [--title ...] [--icon ...] [--link-entry <id>]
|
package/dench.ts
CHANGED
|
@@ -484,17 +484,17 @@ Usage:
|
|
|
484
484
|
dench artifacts [--limit 25] [--json]
|
|
485
485
|
dench artifacts list [--limit 25] [--json]
|
|
486
486
|
dench artifacts show <id> [--json]
|
|
487
|
-
dench artifacts import <id> --to lead|company|job_posting [--view "Q3 outbound"] [--pin] [--json]
|
|
487
|
+
dench artifacts import <id> --to lead|company|job_posting|<list_slug> [--view "Q3 outbound"] [--pin] [--json]
|
|
488
488
|
dench lists [--limit 25] [--json]
|
|
489
489
|
dench lists show <id> [--json]
|
|
490
490
|
dench lists save --title "Shortlist" --people-file <people.json> [--json]
|
|
491
491
|
dench lists rename <id> "New name" [--json]
|
|
492
492
|
dench lists update <id> [--title "New name"] [--filters-json '{...}'] [--json]
|
|
493
493
|
dench lists delete <id> [--json]
|
|
494
|
-
dench leads find --titles "VP Sales" [--locations "San Francisco"] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json] (rich filters: dench leads help)
|
|
494
|
+
dench leads find --titles "VP Sales" [--company-list <ref> [--fit-only]] [--into-list "Q3 targets"] [--locations "San Francisco"] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json] (rich filters: dench leads help)
|
|
495
495
|
dench leads filters [--filter titles|locations|company-hq|...] [--search "query"] [--json]
|
|
496
|
-
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
497
|
-
dench jobs find --titles "Account Executive" [--locations "San Francisco"] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
496
|
+
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--into-list "Target accounts"] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
497
|
+
dench jobs find --titles "Account Executive" [--company-list <ref> [--fit-only]] [--locations "San Francisco"] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
498
498
|
dench suggested-work [--json]
|
|
499
499
|
dench billing status [--json]
|
|
500
500
|
dench billing topup --amount 5 [--no-open] [--json]
|
|
@@ -747,7 +747,7 @@ function leadsHelp() {
|
|
|
747
747
|
console.log(`Dench leads
|
|
748
748
|
|
|
749
749
|
Usage:
|
|
750
|
-
dench leads find --titles "VP Sales" --locations "San Francisco" [--company-domain acme.com] [--keywords fintech] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json]
|
|
750
|
+
dench leads find --titles "VP Sales" --locations "San Francisco" [--company-list <ref> [--fit-only]] [--into-list "Q3 targets"] [--company-domain acme.com] [--keywords fintech] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json]
|
|
751
751
|
dench leads filters [--filter titles|locations|company-hq|universities|skills|keywords|...] [--search "query"] [--json]
|
|
752
752
|
|
|
753
753
|
Rich filter flags: --past-titles --person-names --seniorities --functions
|
|
@@ -763,7 +763,7 @@ function companiesHelp() {
|
|
|
763
763
|
console.log(`Dench companies
|
|
764
764
|
|
|
765
765
|
Usage:
|
|
766
|
-
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--industries SaaS] [--locations "San Francisco"] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
766
|
+
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--industries SaaS] [--locations "San Francisco"] [--into-list "Target accounts"] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
767
767
|
`);
|
|
768
768
|
}
|
|
769
769
|
|
|
@@ -771,7 +771,7 @@ function jobsHelp() {
|
|
|
771
771
|
console.log(`Dench jobs
|
|
772
772
|
|
|
773
773
|
Usage:
|
|
774
|
-
dench jobs find --titles "Account Executive" --locations "San Francisco" [--company-domain acme.com] [--keywords remote] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
774
|
+
dench jobs find --titles "Account Executive" --locations "San Francisco" [--company-list <ref> [--fit-only]] [--company-domain acme.com] [--keywords remote] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
775
775
|
`);
|
|
776
776
|
}
|
|
777
777
|
|
|
@@ -4711,8 +4711,12 @@ async function main() {
|
|
|
4711
4711
|
) {
|
|
4712
4712
|
// runCrmCommand only needs `convex` for actual queries; help
|
|
4713
4713
|
// doesn't touch it. Pass a minimal stub.
|
|
4714
|
-
|
|
4715
|
-
|
|
4714
|
+
await runCrmCommand({
|
|
4715
|
+
// biome-ignore lint/suspicious/noExplicitAny: harmless help-only stub
|
|
4716
|
+
convex: {} as any,
|
|
4717
|
+
args: subArgs,
|
|
4718
|
+
jsonOutput: json,
|
|
4719
|
+
});
|
|
4716
4720
|
return;
|
|
4717
4721
|
}
|
|
4718
4722
|
const runtime = await getRuntime();
|
|
@@ -4729,6 +4733,7 @@ async function main() {
|
|
|
4729
4733
|
await runCrmCommand({
|
|
4730
4734
|
convex: runtime.client,
|
|
4731
4735
|
args: subArgs,
|
|
4736
|
+
jsonOutput: json,
|
|
4732
4737
|
sessionToken: encodeDevCrmSessionToken(runtime.workspaceArgs),
|
|
4733
4738
|
host: resolveApiHost(LOCAL_HOST),
|
|
4734
4739
|
workspaceSlug: runtime.workspaceArgs.workspaceSlug,
|
|
@@ -4749,6 +4754,7 @@ async function main() {
|
|
|
4749
4754
|
await runCrmCommand({
|
|
4750
4755
|
convex: authedRuntime.client,
|
|
4751
4756
|
args: subArgs,
|
|
4757
|
+
jsonOutput: json,
|
|
4752
4758
|
sessionToken: authedRuntime.sessionToken,
|
|
4753
4759
|
host: authedRuntime.host,
|
|
4754
4760
|
workspaceSlug:
|
package/leads.ts
CHANGED
|
@@ -74,6 +74,12 @@ const api = {
|
|
|
74
74
|
resolveCompanyList: makeFunctionReference<"action">(
|
|
75
75
|
"functions/companyLists:resolveCompanyList",
|
|
76
76
|
),
|
|
77
|
+
listStagingLists: makeFunctionReference<"query">(
|
|
78
|
+
"functions/crm/columns:listStagingLists",
|
|
79
|
+
),
|
|
80
|
+
createStagingList: makeFunctionReference<"mutation">(
|
|
81
|
+
"functions/crm/columns:createStagingList",
|
|
82
|
+
),
|
|
77
83
|
};
|
|
78
84
|
|
|
79
85
|
const ENRICHMENT_FILTERS = [
|
|
@@ -209,6 +215,8 @@ type LeadsFindFlags = {
|
|
|
209
215
|
foundedYears?: LeadsFindRange;
|
|
210
216
|
keywords?: string;
|
|
211
217
|
companyList?: string;
|
|
218
|
+
fitOnly?: boolean;
|
|
219
|
+
intoList?: string;
|
|
212
220
|
exactMatch?: boolean;
|
|
213
221
|
limit?: number;
|
|
214
222
|
pageToken?: string;
|
|
@@ -268,6 +276,8 @@ function parseLeadsFindFlags(args: string[]): LeadsFindFlags {
|
|
|
268
276
|
foundedYears: rangeFlag(args, "--founded-years"),
|
|
269
277
|
keywords: getFlag(args, "--keywords"),
|
|
270
278
|
companyList: getFlag(args, "--company-list"),
|
|
279
|
+
fitOnly: hasFlag(args, "--fit-only") ? true : undefined,
|
|
280
|
+
intoList: getFlag(args, "--into-list"),
|
|
271
281
|
// Free-text filters default to substring matching. `--exact` restores
|
|
272
282
|
// whole-string matching for a caller who wants the narrow list.
|
|
273
283
|
exactMatch: hasFlag(args, "--exact") ? true : undefined,
|
|
@@ -278,9 +288,18 @@ function parseLeadsFindFlags(args: string[]): LeadsFindFlags {
|
|
|
278
288
|
assertNoUnknownFlags(args, "leads find");
|
|
279
289
|
const hasFilter = Object.entries(flags).some(
|
|
280
290
|
([key, value]) =>
|
|
281
|
-
![
|
|
282
|
-
|
|
291
|
+
![
|
|
292
|
+
"limit",
|
|
293
|
+
"pageToken",
|
|
294
|
+
"name",
|
|
295
|
+
"exactMatch",
|
|
296
|
+
"fitOnly",
|
|
297
|
+
"intoList",
|
|
298
|
+
].includes(key) && value !== undefined,
|
|
283
299
|
);
|
|
300
|
+
if (flags.fitOnly && !flags.companyList) {
|
|
301
|
+
throw new FindCliError("--fit-only requires --company-list <list>");
|
|
302
|
+
}
|
|
284
303
|
if (!hasFilter) {
|
|
285
304
|
throw new FindCliError(
|
|
286
305
|
"dench leads find requires at least one of --titles, --locations, --company-domain, --keywords, --industries, --seniorities (or any other filter flag — run `dench leads help`)",
|
|
@@ -435,52 +454,145 @@ function asArray(value: unknown): unknown[] {
|
|
|
435
454
|
return Array.isArray(value) ? value : [];
|
|
436
455
|
}
|
|
437
456
|
|
|
438
|
-
/* ─── Company-list filter (--company-list) ─── */
|
|
457
|
+
/* ─── Company-list filter (--company-list) & list seeding (--into-list) ─── */
|
|
439
458
|
|
|
440
459
|
type ResolvedCompanyList = {
|
|
441
|
-
source: "artifact" | "view";
|
|
460
|
+
source: "artifact" | "view" | "entries" | "fit_checks";
|
|
442
461
|
title: string;
|
|
443
462
|
domains: string[];
|
|
444
463
|
names: string[];
|
|
445
464
|
totalCompanies: number;
|
|
446
465
|
truncated: boolean;
|
|
466
|
+
skippedNoDomain?: number;
|
|
467
|
+
objectName?: string;
|
|
468
|
+
fitOnly?: boolean;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
type StagingListRow = {
|
|
472
|
+
name: string;
|
|
473
|
+
displayName?: string;
|
|
474
|
+
stagingEntityKind?: "company" | "person";
|
|
447
475
|
};
|
|
448
476
|
|
|
449
477
|
/** Convex document ids are long lowercase alphanumeric strings. */
|
|
450
478
|
const COMPANY_LIST_ID_RE = /^[a-z0-9]{25,40}$/;
|
|
451
479
|
|
|
480
|
+
async function findStagingListByRef(
|
|
481
|
+
ctx: FindCliContext,
|
|
482
|
+
ref: string,
|
|
483
|
+
): Promise<StagingListRow | null> {
|
|
484
|
+
try {
|
|
485
|
+
const lists = (await callQuery(
|
|
486
|
+
ctx,
|
|
487
|
+
api.listStagingLists,
|
|
488
|
+
{},
|
|
489
|
+
)) as StagingListRow[];
|
|
490
|
+
const lower = ref.toLowerCase();
|
|
491
|
+
return (
|
|
492
|
+
lists.find(
|
|
493
|
+
(item) =>
|
|
494
|
+
item.name.toLowerCase() === lower ||
|
|
495
|
+
(item.displayName && item.displayName.toLowerCase() === lower),
|
|
496
|
+
) ?? null
|
|
497
|
+
);
|
|
498
|
+
} catch {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
async function resolveOrCreateStagingList(
|
|
504
|
+
ctx: FindCliContext,
|
|
505
|
+
nameOrSlug: string,
|
|
506
|
+
entityKind: "company" | "person",
|
|
507
|
+
): Promise<{ objectName: string; displayName: string; created: boolean }> {
|
|
508
|
+
const trimmed = nameOrSlug.trim();
|
|
509
|
+
if (!trimmed) {
|
|
510
|
+
throw new FindCliError("--into-list requires a list name or slug");
|
|
511
|
+
}
|
|
512
|
+
const existing = await findStagingListByRef(ctx, trimmed);
|
|
513
|
+
if (existing) {
|
|
514
|
+
return {
|
|
515
|
+
objectName: existing.name,
|
|
516
|
+
displayName: existing.displayName ?? existing.name,
|
|
517
|
+
created: false,
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
const created = (await ctx.convex.mutation(api.createStagingList, {
|
|
521
|
+
displayName: trimmed,
|
|
522
|
+
entityKind,
|
|
523
|
+
...(ctx.sessionToken ? { sessionToken: ctx.sessionToken } : {}),
|
|
524
|
+
} as never)) as { objectName: string; displayName: string };
|
|
525
|
+
return {
|
|
526
|
+
objectName: created.objectName,
|
|
527
|
+
displayName: created.displayName,
|
|
528
|
+
created: true,
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
|
|
452
532
|
/**
|
|
453
|
-
* `--company-list` accepts
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
533
|
+
* `--company-list` accepts:
|
|
534
|
+
* - a list slug or display name (with optional `--fit-only` to target Fit Check matches)
|
|
535
|
+
* - a saved-search artifact id (from `dench companies find` / `dench lists`)
|
|
536
|
+
* - a Company saved-view name
|
|
457
537
|
*/
|
|
458
538
|
async function resolveCompanyListFlag(
|
|
459
539
|
ctx: FindCliContext,
|
|
460
540
|
value: string,
|
|
541
|
+
opts?: { fitOnly?: boolean },
|
|
461
542
|
): Promise<ResolvedCompanyList> {
|
|
462
543
|
const trimmed = value.trim();
|
|
463
544
|
if (!trimmed) {
|
|
464
545
|
throw new FindCliError(
|
|
465
|
-
"--company-list requires a list artifact id or
|
|
546
|
+
"--company-list requires a list slug/name, artifact id, or Company view name",
|
|
466
547
|
);
|
|
467
548
|
}
|
|
549
|
+
if (opts?.fitOnly) {
|
|
550
|
+
const matched = await findStagingListByRef(ctx, trimmed);
|
|
551
|
+
const objectName = matched?.name ?? trimmed;
|
|
552
|
+
try {
|
|
553
|
+
const resolved = (await callAction(ctx, api.resolveCompanyList, {
|
|
554
|
+
objectName,
|
|
555
|
+
fitOnly: true,
|
|
556
|
+
domainsOnly: true,
|
|
557
|
+
})) as ResolvedCompanyList;
|
|
558
|
+
return { ...resolved, objectName, fitOnly: true };
|
|
559
|
+
} catch (error) {
|
|
560
|
+
throw new FindCliError(
|
|
561
|
+
error instanceof Error ? error.message : String(error),
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
468
565
|
if (COMPANY_LIST_ID_RE.test(trimmed)) {
|
|
469
566
|
try {
|
|
470
567
|
return (await callAction(ctx, api.resolveCompanyList, {
|
|
471
568
|
artifactId: trimmed,
|
|
472
569
|
})) as ResolvedCompanyList;
|
|
473
570
|
} catch {
|
|
474
|
-
// Not an artifact (or not ours) — fall through to view
|
|
571
|
+
// Not an artifact (or not ours) — fall through to view/list lookup.
|
|
475
572
|
}
|
|
476
573
|
}
|
|
477
574
|
try {
|
|
478
575
|
return (await callAction(ctx, api.resolveCompanyList, {
|
|
479
576
|
viewName: trimmed,
|
|
480
577
|
})) as ResolvedCompanyList;
|
|
481
|
-
} catch (
|
|
578
|
+
} catch (viewError) {
|
|
579
|
+
const matched = await findStagingListByRef(ctx, trimmed);
|
|
580
|
+
if (matched) {
|
|
581
|
+
try {
|
|
582
|
+
const resolved = (await callAction(ctx, api.resolveCompanyList, {
|
|
583
|
+
objectName: matched.name,
|
|
584
|
+
fitOnly: true,
|
|
585
|
+
domainsOnly: true,
|
|
586
|
+
})) as ResolvedCompanyList;
|
|
587
|
+
return { ...resolved, objectName: matched.name, fitOnly: true };
|
|
588
|
+
} catch (listError) {
|
|
589
|
+
throw new FindCliError(
|
|
590
|
+
listError instanceof Error ? listError.message : String(listError),
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
482
594
|
throw new FindCliError(
|
|
483
|
-
|
|
595
|
+
viewError instanceof Error ? viewError.message : String(viewError),
|
|
484
596
|
);
|
|
485
597
|
}
|
|
486
598
|
}
|
|
@@ -490,6 +602,14 @@ function companyListFilterEntry(
|
|
|
490
602
|
ref: string,
|
|
491
603
|
resolved: ResolvedCompanyList,
|
|
492
604
|
): Record<string, unknown> {
|
|
605
|
+
if (resolved.source === "fit_checks" || resolved.source === "entries") {
|
|
606
|
+
return {
|
|
607
|
+
objectName: resolved.objectName ?? ref.trim(),
|
|
608
|
+
...(resolved.fitOnly ? { fitOnly: true } : {}),
|
|
609
|
+
domainsOnly: true,
|
|
610
|
+
title: resolved.title,
|
|
611
|
+
};
|
|
612
|
+
}
|
|
493
613
|
return resolved.source === "artifact"
|
|
494
614
|
? { artifactId: ref.trim(), title: resolved.title }
|
|
495
615
|
: { viewName: ref.trim(), title: resolved.title };
|
|
@@ -503,6 +623,9 @@ function companyListInfo(resolved: ResolvedCompanyList) {
|
|
|
503
623
|
companiesUsed: resolved.domains.length + resolved.names.length,
|
|
504
624
|
totalCompanies: resolved.totalCompanies,
|
|
505
625
|
truncated: resolved.truncated,
|
|
626
|
+
...(typeof resolved.skippedNoDomain === "number"
|
|
627
|
+
? { skippedNoDomain: resolved.skippedNoDomain }
|
|
628
|
+
: {}),
|
|
506
629
|
};
|
|
507
630
|
}
|
|
508
631
|
|
|
@@ -546,7 +669,7 @@ export function leadsHelp(): void {
|
|
|
546
669
|
Usage:
|
|
547
670
|
dench leads find --titles "VP Sales" --locations "San Francisco" [--company-domain acme.com] [--save-as "Q3 targets"] [--limit 500] [--page-token <token>] [--json]
|
|
548
671
|
dench leads find --keywords "fintech" [--industries SaaS] [--seniorities director,vp] [--json]
|
|
549
|
-
dench leads find --company-list <artifactId|"Company view name"> --titles "VP Sales" [--json]
|
|
672
|
+
dench leads find --company-list <list|artifactId|"Company view name"> [--fit-only] --titles "VP Sales" [--into-list "Q3 buyers"] [--json]
|
|
550
673
|
dench leads filters [--filter titles|locations|company-hq|universities|skills|keywords|seniorities|functions|sub-functions|industries|headcount|company-types|languages] [--search "query"] [--json]
|
|
551
674
|
|
|
552
675
|
Filter flags (all comma-separated lists unless noted):
|
|
@@ -557,10 +680,12 @@ Filter flags (all comma-separated lists unless noted):
|
|
|
557
680
|
--company-domains --company-hq --company-types --industries
|
|
558
681
|
--company-keywords (business focus: SaaS, B2B, Cloud)
|
|
559
682
|
--headcount (buckets like 11-50,51-200)
|
|
560
|
-
List: --company-list <artifactId|view name> — filter
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
683
|
+
List: --company-list <list|artifactId|view name> [--fit-only] — filter
|
|
684
|
+
by a qualified list slug/name (pass --fit-only to target companies
|
|
685
|
+
marked Fits across all Fit Check columns), a \`dench companies find\`
|
|
686
|
+
artifact, or a Company saved view.
|
|
687
|
+
--into-list <name|slug> — also save returned rows directly into a
|
|
688
|
+
workspace list (creates it if new).
|
|
564
689
|
Ranges: --years-in-role --years-at-company --days-since-job-change
|
|
565
690
|
--founded-years (min:max, e.g. 2:10, 2: or :10)
|
|
566
691
|
Query: --keywords "Engineer" (current-title text only)
|
|
@@ -672,15 +797,15 @@ export function companiesHelp(): void {
|
|
|
672
797
|
|
|
673
798
|
Usage:
|
|
674
799
|
dench companies related --domain acme.com --kind employees|founders|funding|investors|acquisitions|investments [--limit 25] [--page-token <token>] [--json]
|
|
675
|
-
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--industries SaaS] [--locations "San Francisco"] [--linkedin https://linkedin.com/company/acme] [--exact] [--save-as "Target accounts"] [--limit 500] [--page-token <token>] [--json]
|
|
800
|
+
dench companies find --name "Acme" [--domain acme.com] [--keywords fintech] [--industries SaaS] [--locations "San Francisco"] [--linkedin https://linkedin.com/company/acme] [--exact] [--save-as "Target accounts"] [--into-list "Q4 Fintech"] [--limit 500] [--page-token <token>] [--json]
|
|
676
801
|
Rows include a headquarters line (street where the provider has one).
|
|
677
802
|
|
|
678
803
|
Finds companies through Dench search and writes a workspace list artifact.
|
|
679
|
-
Pass --
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
804
|
+
Pass --into-list "<Name>" to also seed (or append to) a workspace list ready
|
|
805
|
+
for AI research columns (\`dench crm columns create-ai\`).
|
|
806
|
+
Manage lists with \`dench lists\`; import with \`dench artifacts import <id> --to <company|list_slug>\`.
|
|
807
|
+
The artifact id (or list slug) doubles as a company list: pass it to
|
|
808
|
+
\`dench leads find --company-list <list> [--fit-only]\` or \`dench jobs find --company-list <list> [--fit-only]\`.
|
|
684
809
|
`);
|
|
685
810
|
}
|
|
686
811
|
|
|
@@ -689,12 +814,12 @@ export function jobsHelp(): void {
|
|
|
689
814
|
|
|
690
815
|
Usage:
|
|
691
816
|
dench jobs find --titles "Account Executive" --locations "San Francisco" [--company-domain acme.com] [--keywords remote] [--save-as "AE openings"] [--limit 500] [--page-token <token>] [--json]
|
|
692
|
-
dench jobs find --company-list <artifactId|"Company view name"> [--titles "Account Executive"] [--posted-after 2026-09-01] [--posted-before 2026-09-30] [--json]
|
|
817
|
+
dench jobs find --company-list <list|artifactId|"Company view name"> [--fit-only] [--titles "Account Executive"] [--posted-after 2026-09-01] [--posted-before 2026-09-30] [--json]
|
|
693
818
|
|
|
694
819
|
Company filters: --company (name), --company-domain (single),
|
|
695
|
-
--company-domains (comma-separated), or --company-list (a
|
|
696
|
-
|
|
697
|
-
resolved to its current companies on each run).
|
|
820
|
+
--company-domains (comma-separated), or --company-list (a qualified list slug/name
|
|
821
|
+
with optional --fit-only, a \`dench companies find\` artifact id, or a Company
|
|
822
|
+
saved-view name — resolved to its current companies on each run).
|
|
698
823
|
|
|
699
824
|
Finds job postings through Dench search and writes a workspace list artifact.
|
|
700
825
|
Pass --save-as to name the list (otherwise a title is generated).
|
|
@@ -709,7 +834,7 @@ Usage:
|
|
|
709
834
|
dench artifacts [--limit 25] [--json]
|
|
710
835
|
dench artifacts list [--limit 25] [--json]
|
|
711
836
|
dench artifacts show <id> [--json]
|
|
712
|
-
dench artifacts import <id> --to lead|company|job_posting [--rows 0,4,9] [--enrichment enriched] [--status "Contacted"] [--view "Q3 outbound"] [--pin] [--json]
|
|
837
|
+
dench artifacts import <id> --to lead|company|job_posting|<list_slug> [--rows 0,4,9] [--enrichment enriched] [--status "Contacted"] [--view "Q3 outbound"] [--pin] [--json]
|
|
713
838
|
|
|
714
839
|
\`list\` / \`show\` / \`import\` operate on find results (lead lists and job
|
|
715
840
|
searches). Bare \`dench artifacts\` still lists agent suggested-work artifacts.
|
|
@@ -1231,12 +1356,17 @@ export async function runLeadsCommand(opts: {
|
|
|
1231
1356
|
if (verb !== "find") {
|
|
1232
1357
|
throw new FindCliError(`Unknown leads verb: ${verb}`);
|
|
1233
1358
|
}
|
|
1234
|
-
const {
|
|
1359
|
+
const {
|
|
1360
|
+
name: listName,
|
|
1361
|
+
intoList,
|
|
1362
|
+
fitOnly,
|
|
1363
|
+
...flags
|
|
1364
|
+
} = parseLeadsFindFlags(args);
|
|
1235
1365
|
// Resolve --company-list fresh per search so the filter tracks the
|
|
1236
1366
|
// list's CURRENT companies (domains exact, name fallback for rows
|
|
1237
1367
|
// without a domain).
|
|
1238
1368
|
const companyList = flags.companyList
|
|
1239
|
-
? await resolveCompanyListFlag(ctx, flags.companyList)
|
|
1369
|
+
? await resolveCompanyListFlag(ctx, flags.companyList, { fitOnly })
|
|
1240
1370
|
: undefined;
|
|
1241
1371
|
try {
|
|
1242
1372
|
const result = await searchPeople(
|
|
@@ -1291,7 +1421,7 @@ export async function runLeadsCommand(opts: {
|
|
|
1291
1421
|
companyList,
|
|
1292
1422
|
);
|
|
1293
1423
|
}
|
|
1294
|
-
const artifact = await persist(ctx, {
|
|
1424
|
+
const artifact = (await persist(ctx, {
|
|
1295
1425
|
createdFrom: "find_people",
|
|
1296
1426
|
title:
|
|
1297
1427
|
listName ??
|
|
@@ -1303,14 +1433,28 @@ export async function runLeadsCommand(opts: {
|
|
|
1303
1433
|
]),
|
|
1304
1434
|
filters: savedFilters,
|
|
1305
1435
|
people,
|
|
1306
|
-
})
|
|
1436
|
+
})) as Record<string, unknown>;
|
|
1437
|
+
let seededList: Record<string, unknown> | undefined;
|
|
1438
|
+
if (intoList && typeof artifact.artifactId === "string") {
|
|
1439
|
+
const target = await resolveOrCreateStagingList(ctx, intoList, "person");
|
|
1440
|
+
const imported = (await callAction(ctx, api.importArtifact, {
|
|
1441
|
+
artifactId: artifact.artifactId,
|
|
1442
|
+
to: target.objectName,
|
|
1443
|
+
})) as Record<string, unknown>;
|
|
1444
|
+
seededList = {
|
|
1445
|
+
...target,
|
|
1446
|
+
added: imported.added ?? imported.imported ?? 0,
|
|
1447
|
+
skippedDuplicate: imported.skippedDuplicate ?? imported.reused ?? 0,
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1307
1450
|
// metadata carries total / nextPageToken — pass the token back via
|
|
1308
1451
|
// --page-token to continue where this page stopped.
|
|
1309
1452
|
out(ctx, {
|
|
1310
|
-
...
|
|
1453
|
+
...artifact,
|
|
1311
1454
|
metadata: result.metadata,
|
|
1312
1455
|
billing: result.billing ?? null,
|
|
1313
1456
|
...(companyList ? { companyList: companyListInfo(companyList) } : {}),
|
|
1457
|
+
...(seededList ? { list: seededList } : {}),
|
|
1314
1458
|
});
|
|
1315
1459
|
} catch (error) {
|
|
1316
1460
|
throw new FindCliError(
|
|
@@ -1354,10 +1498,14 @@ export async function runJobsCommand(opts: {
|
|
|
1354
1498
|
const postedAfter = getFlag(args, "--posted-after");
|
|
1355
1499
|
const postedBefore = getFlag(args, "--posted-before");
|
|
1356
1500
|
const companyListRef = getFlag(args, "--company-list");
|
|
1501
|
+
const fitOnly = hasFlag(args, "--fit-only") ? true : undefined;
|
|
1357
1502
|
const limit = parseLimit(args);
|
|
1358
1503
|
const pageToken = getFlag(args, "--page-token");
|
|
1359
1504
|
const listName = getFlag(args, "--save-as");
|
|
1360
1505
|
assertNoUnknownFlags(args, "jobs find");
|
|
1506
|
+
if (fitOnly && !companyListRef) {
|
|
1507
|
+
throw new FindCliError("--fit-only requires --company-list <list>");
|
|
1508
|
+
}
|
|
1361
1509
|
if (
|
|
1362
1510
|
!titles &&
|
|
1363
1511
|
!locations &&
|
|
@@ -1374,7 +1522,7 @@ export async function runJobsCommand(opts: {
|
|
|
1374
1522
|
);
|
|
1375
1523
|
}
|
|
1376
1524
|
const companyList = companyListRef
|
|
1377
|
-
? await resolveCompanyListFlag(ctx, companyListRef)
|
|
1525
|
+
? await resolveCompanyListFlag(ctx, companyListRef, { fitOnly })
|
|
1378
1526
|
: undefined;
|
|
1379
1527
|
try {
|
|
1380
1528
|
const result = await searchJobs(
|
|
@@ -1509,6 +1657,7 @@ export async function runCompaniesCommand(opts: {
|
|
|
1509
1657
|
const limit = parseLimit(args);
|
|
1510
1658
|
const pageToken = getFlag(args, "--page-token");
|
|
1511
1659
|
const listName = getFlag(args, "--save-as");
|
|
1660
|
+
const intoList = getFlag(args, "--into-list");
|
|
1512
1661
|
assertNoUnknownFlags(args, "companies find");
|
|
1513
1662
|
if (
|
|
1514
1663
|
!domain &&
|
|
@@ -1539,10 +1688,11 @@ export async function runCompaniesCommand(opts: {
|
|
|
1539
1688
|
},
|
|
1540
1689
|
ctx.enrichmentGateway,
|
|
1541
1690
|
);
|
|
1542
|
-
const artifact = await persist(ctx, {
|
|
1691
|
+
const artifact = (await persist(ctx, {
|
|
1543
1692
|
createdFrom: "find_companies",
|
|
1544
1693
|
title:
|
|
1545
1694
|
listName ??
|
|
1695
|
+
intoList ??
|
|
1546
1696
|
findTitle("companies", [name ?? "", domain ?? "", keywords ?? ""]),
|
|
1547
1697
|
filters: {
|
|
1548
1698
|
domain,
|
|
@@ -1555,11 +1705,25 @@ export async function runCompaniesCommand(opts: {
|
|
|
1555
1705
|
limit,
|
|
1556
1706
|
},
|
|
1557
1707
|
companies: asArray(result.companies),
|
|
1558
|
-
})
|
|
1708
|
+
})) as Record<string, unknown>;
|
|
1709
|
+
let seededList: Record<string, unknown> | undefined;
|
|
1710
|
+
if (intoList && typeof artifact.artifactId === "string") {
|
|
1711
|
+
const target = await resolveOrCreateStagingList(ctx, intoList, "company");
|
|
1712
|
+
const imported = (await callAction(ctx, api.importArtifact, {
|
|
1713
|
+
artifactId: artifact.artifactId,
|
|
1714
|
+
to: target.objectName,
|
|
1715
|
+
})) as Record<string, unknown>;
|
|
1716
|
+
seededList = {
|
|
1717
|
+
...target,
|
|
1718
|
+
added: imported.added ?? imported.imported ?? 0,
|
|
1719
|
+
skippedDuplicate: imported.skippedDuplicate ?? imported.reused ?? 0,
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1559
1722
|
out(ctx, {
|
|
1560
|
-
...
|
|
1723
|
+
...artifact,
|
|
1561
1724
|
metadata: result.metadata,
|
|
1562
1725
|
billing: result.billing ?? null,
|
|
1726
|
+
...(seededList ? { list: seededList } : {}),
|
|
1563
1727
|
});
|
|
1564
1728
|
} catch (error) {
|
|
1565
1729
|
throw new FindCliError(
|
|
@@ -1602,10 +1766,10 @@ export async function runWorkspaceArtifactsCommand(opts: {
|
|
|
1602
1766
|
return true;
|
|
1603
1767
|
}
|
|
1604
1768
|
const artifactId = shift(args, "artifact id");
|
|
1605
|
-
const to = getFlag(args, "--to");
|
|
1606
|
-
if (to
|
|
1769
|
+
const to = getFlag(args, "--to")?.trim();
|
|
1770
|
+
if (!to) {
|
|
1607
1771
|
throw new FindCliError(
|
|
1608
|
-
"dench artifacts import <id> --to lead|company|job_posting [--view ...] [--pin]",
|
|
1772
|
+
"dench artifacts import <id> --to lead|company|job_posting|<list_slug> [--view ...] [--pin]",
|
|
1609
1773
|
);
|
|
1610
1774
|
}
|
|
1611
1775
|
const viewName = getFlag(args, "--view");
|
package/lib/api-schemas.ts
CHANGED
|
@@ -2650,7 +2650,16 @@ const peopleSearch = z.object({
|
|
|
2650
2650
|
),
|
|
2651
2651
|
companyNames: z.array(searchFilterItem).max(50).optional(),
|
|
2652
2652
|
pastCompanyNames: z.array(searchFilterItem).max(50).optional(),
|
|
2653
|
-
companyDomains: z.array(searchFilterItem).max(
|
|
2653
|
+
companyDomains: z.array(searchFilterItem).max(1000).optional(),
|
|
2654
|
+
companyScope: z
|
|
2655
|
+
.object({
|
|
2656
|
+
domains: z.array(z.string()).max(1000).optional(),
|
|
2657
|
+
names: z.array(z.string()).max(50).optional(),
|
|
2658
|
+
})
|
|
2659
|
+
.optional()
|
|
2660
|
+
.describe(
|
|
2661
|
+
"Resolved company-list membership (OR across domains and fallback company names).",
|
|
2662
|
+
),
|
|
2654
2663
|
companyHeadquarters: z
|
|
2655
2664
|
.array(searchFilterItem)
|
|
2656
2665
|
.max(50)
|
|
@@ -3049,7 +3058,9 @@ const jobsSearch = z.object({
|
|
|
3049
3058
|
`Cities, states, countries, or metros (free text). ${FILTER_OPTIONS_NOTE}`,
|
|
3050
3059
|
),
|
|
3051
3060
|
companyDomain: z.string().optional(),
|
|
3061
|
+
companyDomains: z.array(z.string()).max(1000).optional(),
|
|
3052
3062
|
companyName: z.string().optional(),
|
|
3063
|
+
companyNames: z.array(z.string()).max(50).optional(),
|
|
3053
3064
|
companyLinkedinUrl: z.string().optional(),
|
|
3054
3065
|
keywords: z.string().optional(),
|
|
3055
3066
|
postedAfter: z.string().optional(),
|