salesprompter-cli 0.1.0 → 0.1.1

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.
@@ -1,147 +0,0 @@
1
- import { z } from "zod";
2
- import { SAMPLE_COMPANIES, SAMPLE_CONTACTS, SAMPLE_SIGNALS, SAMPLE_TECH } from "./sample-data.js";
3
- function pickByIndex(items, index) {
4
- const item = items[index % items.length];
5
- if (item === undefined) {
6
- throw new Error("sample data invariant violated");
7
- }
8
- return item;
9
- }
10
- function normalizeCompanySize(employeeCount) {
11
- if (employeeCount < 50) {
12
- return "1-49";
13
- }
14
- if (employeeCount < 200) {
15
- return "50-199";
16
- }
17
- if (employeeCount < 500) {
18
- return "200-499";
19
- }
20
- return "500+";
21
- }
22
- function deriveCompanyNameFromDomain(domain) {
23
- const normalizedDomain = domain
24
- .toLowerCase()
25
- .replace(/^https?:\/\//, "")
26
- .replace(/^www\./, "")
27
- .split("/")[0];
28
- const hostname = normalizedDomain.split(".")[0] ?? normalizedDomain;
29
- return hostname
30
- .split(/[-_]/)
31
- .filter((part) => part.length > 0)
32
- .map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`)
33
- .join(" ");
34
- }
35
- function buildTargetCompany(target, fallback, icp) {
36
- const domain = target.companyDomain?.trim().toLowerCase();
37
- if (domain === undefined) {
38
- return fallback;
39
- }
40
- return {
41
- companyName: target.companyName?.trim() || deriveCompanyNameFromDomain(domain),
42
- domain,
43
- industry: icp.industries[0] ?? fallback.industry,
44
- region: icp.regions[0] ?? fallback.region,
45
- employeeCount: fallback.employeeCount
46
- };
47
- }
48
- export class HeuristicLeadProvider {
49
- async generateLeads(icp, count, target = {}) {
50
- return Array.from({ length: count }, (_, index) => {
51
- const fallbackCompany = pickByIndex(SAMPLE_COMPANIES, index);
52
- const company = buildTargetCompany(target, fallbackCompany, icp);
53
- const contact = pickByIndex(SAMPLE_CONTACTS, index + 1);
54
- const signals = [pickByIndex(SAMPLE_SIGNALS, index), pickByIndex(SAMPLE_SIGNALS, index + 2)];
55
- const industry = icp.industries[index % Math.max(icp.industries.length, 1)] ?? company.industry;
56
- const region = icp.regions[index % Math.max(icp.regions.length, 1)] ?? company.region;
57
- const title = icp.titles[index % Math.max(icp.titles.length, 1)] ?? contact.title;
58
- return {
59
- companyName: company.companyName,
60
- domain: company.domain,
61
- industry,
62
- region,
63
- employeeCount: company.employeeCount,
64
- contactName: contact.contactName,
65
- title,
66
- email: `${contact.contactName.toLowerCase().replaceAll(" ", ".")}@${company.domain}`,
67
- source: target.companyDomain ? "heuristic-target-account" : "heuristic-seed",
68
- signals
69
- };
70
- });
71
- }
72
- }
73
- export class HeuristicEnrichmentProvider {
74
- async enrichLeads(leads) {
75
- return leads.map((lead, index) => ({
76
- ...lead,
77
- techStack: [pickByIndex(SAMPLE_TECH, index), pickByIndex(SAMPLE_TECH, index + 3)],
78
- crmFit: lead.employeeCount > 200 ? "high" : lead.employeeCount > 100 ? "medium" : "low",
79
- outreachFit: lead.signals.some((signal) => signal.includes("outbound")) ? "high" : "medium",
80
- buyingStage: lead.signals.some((signal) => signal.includes("funding")) ? "active-evaluation" : "solution-aware",
81
- notes: [
82
- `${lead.companyName} matches the ${lead.industry} segment.`,
83
- `${lead.contactName} is likely close to revenue tooling decisions.`
84
- ]
85
- }));
86
- }
87
- }
88
- export class HeuristicScoringProvider {
89
- async scoreLeads(icp, leads) {
90
- return leads.map((lead) => {
91
- const rationale = [];
92
- let score = 40;
93
- if (icp.industries.includes(lead.industry)) {
94
- score += 20;
95
- rationale.push("Industry matches ICP.");
96
- }
97
- if (icp.regions.includes(lead.region)) {
98
- score += 10;
99
- rationale.push("Region matches ICP.");
100
- }
101
- const normalizedSize = normalizeCompanySize(lead.employeeCount);
102
- if (icp.companySizes.includes(normalizedSize)) {
103
- score += 10;
104
- rationale.push("Company size matches ICP.");
105
- }
106
- if (icp.titles.includes(lead.title)) {
107
- score += 10;
108
- rationale.push("Contact title matches ICP.");
109
- }
110
- const requiredMatches = icp.requiredSignals.filter((signal) => lead.signals.includes(signal));
111
- score += Math.min(requiredMatches.length * 5, 10);
112
- if (requiredMatches.length > 0) {
113
- rationale.push(`Matched ${requiredMatches.length} required buying signals.`);
114
- }
115
- const excludedMatches = icp.excludedSignals.filter((signal) => lead.signals.includes(signal));
116
- score -= excludedMatches.length * 15;
117
- if (excludedMatches.length > 0) {
118
- rationale.push(`Matched ${excludedMatches.length} excluded signals.`);
119
- }
120
- if (lead.crmFit === "high") {
121
- score += 5;
122
- rationale.push("Strong CRM fit.");
123
- }
124
- if (lead.outreachFit === "high") {
125
- score += 5;
126
- rationale.push("Strong outreach fit.");
127
- }
128
- const clampedScore = z.number().int().min(0).max(100).parse(score);
129
- const grade = clampedScore >= 85 ? "A" : clampedScore >= 70 ? "B" : clampedScore >= 55 ? "C" : "D";
130
- return {
131
- ...lead,
132
- score: clampedScore,
133
- grade,
134
- rationale
135
- };
136
- });
137
- }
138
- }
139
- export class DryRunSyncProvider {
140
- async sync(target, leads) {
141
- return {
142
- target,
143
- synced: leads.length,
144
- dryRun: true
145
- };
146
- }
147
- }
@@ -1,17 +0,0 @@
1
- import { mkdir, readFile, writeFile } from "node:fs/promises";
2
- import path from "node:path";
3
- export async function readJsonFile(filePath, schema) {
4
- const content = await readFile(filePath, "utf8");
5
- const parsed = JSON.parse(content);
6
- return schema.parse(parsed);
7
- }
8
- export async function writeJsonFile(filePath, value) {
9
- await mkdir(path.dirname(filePath), { recursive: true });
10
- await writeFile(filePath, `${JSON.stringify(value, null, 2)}\n`, "utf8");
11
- }
12
- export function splitCsv(value) {
13
- return value
14
- .split(",")
15
- .map((entry) => entry.trim())
16
- .filter((entry) => entry.length > 0);
17
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,34 +0,0 @@
1
- export const SAMPLE_COMPANIES = [
2
- { companyName: "Northstar Freight", domain: "northstarfreight.com", industry: "Logistics", region: "North America", employeeCount: 180 },
3
- { companyName: "Brightpath Health", domain: "brightpathhealth.io", industry: "Healthcare", region: "Europe", employeeCount: 320 },
4
- { companyName: "ForgeOps Cloud", domain: "forgeopscloud.dev", industry: "Software", region: "North America", employeeCount: 85 },
5
- { companyName: "Summit Retail Group", domain: "summitretailgroup.com", industry: "Retail", region: "Europe", employeeCount: 540 },
6
- { companyName: "Atlas Industrial", domain: "atlasindustrial.co", industry: "Manufacturing", region: "North America", employeeCount: 260 },
7
- { companyName: "Meridian Finance", domain: "meridianfinance.ai", industry: "Financial Services", region: "Europe", employeeCount: 140 }
8
- ];
9
- export const SAMPLE_CONTACTS = [
10
- { contactName: "Avery Chen", title: "VP Sales" },
11
- { contactName: "Jordan Patel", title: "Head of Revenue Operations" },
12
- { contactName: "Taylor Morgan", title: "Director of Growth" },
13
- { contactName: "Morgan Diaz", title: "Chief Revenue Officer" },
14
- { contactName: "Cameron Lee", title: "Sales Operations Manager" },
15
- { contactName: "Riley Brooks", title: "Demand Generation Lead" }
16
- ];
17
- export const SAMPLE_SIGNALS = [
18
- "hiring sales reps",
19
- "recent funding",
20
- "expanding into new regions",
21
- "using fragmented sales tooling",
22
- "growing outbound team",
23
- "launching new product line"
24
- ];
25
- export const SAMPLE_TECH = [
26
- "HubSpot",
27
- "Salesforce",
28
- "Apollo",
29
- "Instantly",
30
- "Outreach",
31
- "Clay",
32
- "Segment",
33
- "PostHog"
34
- ];
@@ -1,149 +0,0 @@
1
- import test from "node:test";
2
- import assert from "node:assert/strict";
3
- import { mkdtemp, readFile, rm } from "node:fs/promises";
4
- import os from "node:os";
5
- import path from "node:path";
6
- import { execFile } from "node:child_process";
7
- import { promisify } from "node:util";
8
- const execFileAsync = promisify(execFile);
9
- const projectRoot = path.resolve(import.meta.dirname, "..", "..");
10
- const cliPath = path.join(projectRoot, "dist", "cli.js");
11
- async function runCli(args) {
12
- const { stdout } = await execFileAsync("node", [cliPath, ...args], {
13
- cwd: projectRoot
14
- });
15
- return JSON.parse(stdout);
16
- }
17
- test("CLI help renders the expected command surface", async () => {
18
- const { stdout } = await execFileAsync("node", [cliPath, "--help"], {
19
- cwd: projectRoot
20
- });
21
- assert.match(stdout, /icp:define/);
22
- assert.match(stdout, /leads:generate/);
23
- assert.match(stdout, /sync:outreach/);
24
- });
25
- test("CLI workflow generates, enriches, scores, and syncs leads", async () => {
26
- const tempDir = await mkdtemp(path.join(os.tmpdir(), "salesprompter-cli-"));
27
- try {
28
- const icpPath = path.join(tempDir, "icp.json");
29
- const leadsPath = path.join(tempDir, "leads.json");
30
- const enrichedPath = path.join(tempDir, "enriched.json");
31
- const scoredPath = path.join(tempDir, "scored.json");
32
- const icpResult = await runCli([
33
- "icp:define",
34
- "--name",
35
- "EU SaaS RevOps",
36
- "--industries",
37
- "Software,Financial Services",
38
- "--company-sizes",
39
- "50-199,200-499",
40
- "--regions",
41
- "Europe",
42
- "--titles",
43
- "Head of Revenue Operations,VP Sales",
44
- "--required-signals",
45
- "recent funding,growing outbound team",
46
- "--out",
47
- icpPath
48
- ]);
49
- assert.equal(icpResult.status, "ok");
50
- const generateResult = await runCli([
51
- "leads:generate",
52
- "--icp",
53
- icpPath,
54
- "--count",
55
- "4",
56
- "--out",
57
- leadsPath
58
- ]);
59
- assert.equal(generateResult.generated, 4);
60
- const enrichResult = await runCli([
61
- "leads:enrich",
62
- "--in",
63
- leadsPath,
64
- "--out",
65
- enrichedPath
66
- ]);
67
- assert.equal(enrichResult.enriched, 4);
68
- const scoreResult = await runCli([
69
- "leads:score",
70
- "--icp",
71
- icpPath,
72
- "--in",
73
- enrichedPath,
74
- "--out",
75
- scoredPath
76
- ]);
77
- assert.equal(scoreResult.scored, 4);
78
- const crmSyncResult = await runCli([
79
- "sync:crm",
80
- "--target",
81
- "hubspot",
82
- "--in",
83
- scoredPath
84
- ]);
85
- assert.deepEqual(crmSyncResult, {
86
- status: "ok",
87
- target: "hubspot",
88
- synced: 4,
89
- dryRun: true
90
- });
91
- const scoredLeads = JSON.parse(await readFile(scoredPath, "utf8"));
92
- assert.equal(scoredLeads.length, 4);
93
- assert.ok(scoredLeads.every((lead) => lead.score >= 0 && lead.score <= 100));
94
- assert.ok(scoredLeads.every((lead) => ["A", "B", "C", "D"].includes(lead.grade)));
95
- assert.ok(scoredLeads.some((lead) => lead.rationale.length > 0));
96
- assert.ok(scoredLeads.some((lead) => lead.crmFit === "high" || lead.outreachFit === "high"));
97
- }
98
- finally {
99
- await rm(tempDir, { recursive: true, force: true });
100
- }
101
- });
102
- test("CLI can target a specific company domain like deel.com", async () => {
103
- const tempDir = await mkdtemp(path.join(os.tmpdir(), "salesprompter-cli-target-"));
104
- try {
105
- const icpPath = path.join(tempDir, "icp.json");
106
- const leadsPath = path.join(tempDir, "deel-leads.json");
107
- await runCli([
108
- "icp:define",
109
- "--name",
110
- "Global HR Tech",
111
- "--industries",
112
- "Software",
113
- "--regions",
114
- "Global",
115
- "--titles",
116
- "VP Sales,Head of Revenue Operations",
117
- "--out",
118
- icpPath
119
- ]);
120
- const generateResult = await runCli([
121
- "leads:generate",
122
- "--icp",
123
- icpPath,
124
- "--count",
125
- "3",
126
- "--company-domain",
127
- "deel.com",
128
- "--company-name",
129
- "Deel",
130
- "--out",
131
- leadsPath
132
- ]);
133
- assert.deepEqual(generateResult, {
134
- status: "ok",
135
- generated: 3,
136
- out: leadsPath,
137
- target: "deel.com"
138
- });
139
- const leads = JSON.parse(await readFile(leadsPath, "utf8"));
140
- assert.equal(leads.length, 3);
141
- assert.ok(leads.every((lead) => lead.companyName === "Deel"));
142
- assert.ok(leads.every((lead) => lead.domain === "deel.com"));
143
- assert.ok(leads.every((lead) => lead.email.endsWith("@deel.com")));
144
- assert.ok(leads.every((lead) => lead.source === "heuristic-target-account"));
145
- }
146
- finally {
147
- await rm(tempDir, { recursive: true, force: true });
148
- }
149
- });
package/src/cli.ts DELETED
@@ -1,136 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { Command } from "commander";
4
- import { z } from "zod";
5
- import {
6
- EnrichedLeadSchema,
7
- IcpSchema,
8
- LeadSchema,
9
- ScoredLeadSchema,
10
- SyncTargetSchema
11
- } from "./domain.js";
12
- import { DryRunSyncProvider, HeuristicEnrichmentProvider, HeuristicLeadProvider, HeuristicScoringProvider } from "./engine.js";
13
- import { readJsonFile, splitCsv, writeJsonFile } from "./io.js";
14
- import type { LeadGenerationTarget } from "./providers.js";
15
-
16
- const program = new Command();
17
- const leadProvider = new HeuristicLeadProvider();
18
- const enrichmentProvider = new HeuristicEnrichmentProvider();
19
- const scoringProvider = new HeuristicScoringProvider();
20
- const syncProvider = new DryRunSyncProvider();
21
-
22
- function printOutput(value: unknown): void {
23
- process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
24
- }
25
-
26
- program
27
- .name("salesprompter")
28
- .description("Sales workflow CLI for ICP definition, lead generation, enrichment, scoring, and sync.")
29
- .version("0.1.0");
30
-
31
- program
32
- .command("icp:define")
33
- .description("Define an ideal customer profile and write it to a JSON file.")
34
- .requiredOption("--name <name>", "Human-readable ICP name")
35
- .option("--industries <items>", "Comma-separated industries", "")
36
- .option("--company-sizes <items>", "Comma-separated buckets like 1-49,50-199,200-499,500+", "")
37
- .option("--regions <items>", "Comma-separated regions", "")
38
- .option("--titles <items>", "Comma-separated titles", "")
39
- .option("--pains <items>", "Comma-separated pain points", "")
40
- .option("--required-signals <items>", "Comma-separated required signals", "")
41
- .option("--excluded-signals <items>", "Comma-separated excluded signals", "")
42
- .requiredOption("--out <path>", "Output file path")
43
- .action(async (options) => {
44
- const icp = IcpSchema.parse({
45
- name: options.name,
46
- industries: splitCsv(options.industries),
47
- companySizes: splitCsv(options.companySizes),
48
- regions: splitCsv(options.regions),
49
- titles: splitCsv(options.titles),
50
- pains: splitCsv(options.pains),
51
- requiredSignals: splitCsv(options.requiredSignals),
52
- excludedSignals: splitCsv(options.excludedSignals)
53
- });
54
-
55
- await writeJsonFile(options.out, icp);
56
- printOutput({ status: "ok", icp });
57
- });
58
-
59
- program
60
- .command("leads:generate")
61
- .description("Generate seed leads against an ICP.")
62
- .requiredOption("--icp <path>", "Path to ICP JSON")
63
- .option("--count <number>", "Number of leads to generate", "10")
64
- .option("--company-domain <domain>", "Target a specific company domain like deel.com")
65
- .option("--company-name <name>", "Optional company name override for a targeted domain")
66
- .requiredOption("--out <path>", "Output file path")
67
- .action(async (options) => {
68
- const icp = await readJsonFile(options.icp, IcpSchema);
69
- const count = z.coerce.number().int().min(1).max(1000).parse(options.count);
70
- const target: LeadGenerationTarget = {
71
- companyDomain: options.companyDomain,
72
- companyName: options.companyName
73
- };
74
- const leads = await leadProvider.generateLeads(icp, count, target);
75
-
76
- await writeJsonFile(options.out, leads);
77
- printOutput({ status: "ok", generated: leads.length, out: options.out, target: target.companyDomain ?? null });
78
- });
79
-
80
- program
81
- .command("leads:enrich")
82
- .description("Enrich leads with fit, buying stage, and tech stack data.")
83
- .requiredOption("--in <path>", "Path to lead JSON array")
84
- .requiredOption("--out <path>", "Output file path")
85
- .action(async (options) => {
86
- const leads = await readJsonFile(options.in, z.array(LeadSchema));
87
- const enriched = await enrichmentProvider.enrichLeads(leads);
88
-
89
- await writeJsonFile(options.out, enriched);
90
- printOutput({ status: "ok", enriched: enriched.length, out: options.out });
91
- });
92
-
93
- program
94
- .command("leads:score")
95
- .description("Score enriched leads against an ICP.")
96
- .requiredOption("--icp <path>", "Path to ICP JSON")
97
- .requiredOption("--in <path>", "Path to enriched lead JSON array")
98
- .requiredOption("--out <path>", "Output file path")
99
- .action(async (options) => {
100
- const icp = await readJsonFile(options.icp, IcpSchema);
101
- const leads = await readJsonFile(options.in, z.array(EnrichedLeadSchema));
102
- const scored = await scoringProvider.scoreLeads(icp, leads);
103
-
104
- await writeJsonFile(options.out, scored);
105
- printOutput({ status: "ok", scored: scored.length, out: options.out });
106
- });
107
-
108
- program
109
- .command("sync:crm")
110
- .description("Dry-run sync scored leads into a CRM target.")
111
- .requiredOption("--target <target>", "hubspot|salesforce|pipedrive")
112
- .requiredOption("--in <path>", "Path to scored lead JSON array")
113
- .action(async (options) => {
114
- const target = SyncTargetSchema.parse(options.target);
115
- const leads = await readJsonFile(options.in, z.array(ScoredLeadSchema));
116
- const result = await syncProvider.sync(target, leads);
117
- printOutput({ status: "ok", ...result });
118
- });
119
-
120
- program
121
- .command("sync:outreach")
122
- .description("Dry-run sync scored leads into an outreach platform.")
123
- .requiredOption("--target <target>", "apollo|instantly|outreach")
124
- .requiredOption("--in <path>", "Path to scored lead JSON array")
125
- .action(async (options) => {
126
- const target = SyncTargetSchema.parse(options.target);
127
- const leads = await readJsonFile(options.in, z.array(ScoredLeadSchema));
128
- const result = await syncProvider.sync(target, leads);
129
- printOutput({ status: "ok", ...result });
130
- });
131
-
132
- program.parseAsync(process.argv).catch((error: unknown) => {
133
- const message = error instanceof Error ? error.message : "Unknown error";
134
- process.stderr.write(`${message}\n`);
135
- process.exitCode = 1;
136
- });
package/src/domain.ts DELETED
@@ -1,50 +0,0 @@
1
- import { z } from "zod";
2
-
3
- export const IcpSchema = z.object({
4
- name: z.string().min(1),
5
- industries: z.array(z.string().min(1)).default([]),
6
- companySizes: z.array(z.string().min(1)).default([]),
7
- regions: z.array(z.string().min(1)).default([]),
8
- titles: z.array(z.string().min(1)).default([]),
9
- pains: z.array(z.string().min(1)).default([]),
10
- requiredSignals: z.array(z.string().min(1)).default([]),
11
- excludedSignals: z.array(z.string().min(1)).default([]),
12
- });
13
-
14
- export type Icp = z.infer<typeof IcpSchema>;
15
-
16
- export const LeadSchema = z.object({
17
- companyName: z.string().min(1),
18
- domain: z.string().min(1),
19
- industry: z.string().min(1),
20
- region: z.string().min(1),
21
- employeeCount: z.number().int().nonnegative(),
22
- contactName: z.string().min(1),
23
- title: z.string().min(1),
24
- email: z.string().email(),
25
- source: z.string().min(1),
26
- signals: z.array(z.string().min(1)).default([]),
27
- });
28
-
29
- export type Lead = z.infer<typeof LeadSchema>;
30
-
31
- export const EnrichedLeadSchema = LeadSchema.extend({
32
- techStack: z.array(z.string().min(1)).default([]),
33
- crmFit: z.enum(["high", "medium", "low"]),
34
- outreachFit: z.enum(["high", "medium", "low"]),
35
- buyingStage: z.enum(["problem-aware", "solution-aware", "active-evaluation"]),
36
- notes: z.array(z.string().min(1)).default([]),
37
- });
38
-
39
- export type EnrichedLead = z.infer<typeof EnrichedLeadSchema>;
40
-
41
- export const ScoredLeadSchema = EnrichedLeadSchema.extend({
42
- score: z.number().int().min(0).max(100),
43
- grade: z.enum(["A", "B", "C", "D"]),
44
- rationale: z.array(z.string().min(1)).default([]),
45
- });
46
-
47
- export type ScoredLead = z.infer<typeof ScoredLeadSchema>;
48
-
49
- export const SyncTargetSchema = z.enum(["hubspot", "salesforce", "pipedrive", "apollo", "instantly", "outreach"]);
50
- export type SyncTarget = z.infer<typeof SyncTargetSchema>;