@itznexus/itznexus-cli 1.143.0 → 1.144.0

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 (62) hide show
  1. package/dist/commands/api/outreach-catalog.d.ts +2 -0
  2. package/dist/commands/api/outreach-catalog.js +167 -0
  3. package/dist/commands/api/outreach-catalog.js.map +1 -0
  4. package/dist/commands/api/outreach-companies.d.ts +2 -0
  5. package/dist/commands/api/outreach-companies.js +93 -0
  6. package/dist/commands/api/outreach-companies.js.map +1 -0
  7. package/dist/commands/api/outreach-company-writes.d.ts +2 -0
  8. package/dist/commands/api/outreach-company-writes.js +101 -0
  9. package/dist/commands/api/outreach-company-writes.js.map +1 -0
  10. package/dist/commands/api/outreach-enrollment-writes.d.ts +2 -0
  11. package/dist/commands/api/outreach-enrollment-writes.js +144 -0
  12. package/dist/commands/api/outreach-enrollment-writes.js.map +1 -0
  13. package/dist/commands/api/outreach-enrollments.d.ts +2 -0
  14. package/dist/commands/api/outreach-enrollments.js +92 -0
  15. package/dist/commands/api/outreach-enrollments.js.map +1 -0
  16. package/dist/commands/api/outreach-prospect-writes.d.ts +2 -0
  17. package/dist/commands/api/outreach-prospect-writes.js +139 -0
  18. package/dist/commands/api/outreach-prospect-writes.js.map +1 -0
  19. package/dist/commands/api/outreach-prospects.d.ts +2 -0
  20. package/dist/commands/api/outreach-prospects.js +96 -0
  21. package/dist/commands/api/outreach-prospects.js.map +1 -0
  22. package/dist/commands/api/outreach-settings.d.ts +2 -0
  23. package/dist/commands/api/outreach-settings.js +193 -0
  24. package/dist/commands/api/outreach-settings.js.map +1 -0
  25. package/dist/commands/api/outreach-shared.d.ts +24 -0
  26. package/dist/commands/api/outreach-shared.js +34 -0
  27. package/dist/commands/api/outreach-shared.js.map +1 -0
  28. package/dist/commands/api/outreach-signals.d.ts +2 -0
  29. package/dist/commands/api/outreach-signals.js +80 -0
  30. package/dist/commands/api/outreach-signals.js.map +1 -0
  31. package/dist/commands/api/outreach.d.ts +2 -0
  32. package/dist/commands/api/outreach.js +21 -0
  33. package/dist/commands/api/outreach.js.map +1 -0
  34. package/dist/commands/api/seo-backlinks.js +1 -1
  35. package/dist/commands/api/seo-backlinks.js.map +1 -1
  36. package/dist/commands/api/seo-catalog.js +1 -1
  37. package/dist/commands/api/seo-catalog.js.map +1 -1
  38. package/dist/commands/api/seo-changes.js +1 -1
  39. package/dist/commands/api/seo-changes.js.map +1 -1
  40. package/dist/commands/api/seo-data.js +1 -1
  41. package/dist/commands/api/seo-data.js.map +1 -1
  42. package/dist/commands/api/seo-keyword-writes.js +1 -1
  43. package/dist/commands/api/seo-keyword-writes.js.map +1 -1
  44. package/dist/commands/api/seo-keywords.js +1 -1
  45. package/dist/commands/api/seo-keywords.js.map +1 -1
  46. package/dist/commands/api/seo-offers.js +1 -1
  47. package/dist/commands/api/seo-offers.js.map +1 -1
  48. package/dist/commands/api/seo-page-writes.js +1 -1
  49. package/dist/commands/api/seo-page-writes.js.map +1 -1
  50. package/dist/commands/api/seo-pages.js +1 -1
  51. package/dist/commands/api/seo-pages.js.map +1 -1
  52. package/dist/commands/api/seo-settings.js +1 -1
  53. package/dist/commands/api/seo-settings.js.map +1 -1
  54. package/dist/commands/api/seo-site.js +1 -1
  55. package/dist/commands/api/seo-site.js.map +1 -1
  56. package/dist/index.js +5 -0
  57. package/dist/index.js.map +1 -1
  58. package/dist/{commands/api/seo-shared.d.ts → lib/command-helpers.d.ts} +1 -1
  59. package/dist/{commands/api/seo-shared.js → lib/command-helpers.js} +8 -8
  60. package/dist/lib/command-helpers.js.map +1 -0
  61. package/package.json +1 -1
  62. package/dist/commands/api/seo-shared.js.map +0 -1
@@ -0,0 +1,92 @@
1
+ import { Command } from "commander";
2
+ import chalk from "chalk";
3
+ import { api } from "../../lib/api.js";
4
+ import { handleError, printDetail } from "../../lib/format.js";
5
+ import { printJson, qs } from "../../lib/command-helpers.js";
6
+ import { outreachEnrollmentWriteCommands } from "./outreach-enrollment-writes.js";
7
+ import { CHANNELS, fullName, printPage, withPageOptions, } from "./outreach-shared.js";
8
+ const STATUSES = "drafting | running | replied | bounced | parked | stopped";
9
+ const listCmd = withPageOptions(new Command("list")
10
+ .description("List enrollments with their prospect, company and sequence, last updated first")
11
+ .option("--status <list>", `One status or several, comma-separated (drafting,running): ${STATUSES}`)
12
+ .option("--channel <channel>", CHANNELS)
13
+ .option("--prospect-id <id>", "Enrollments of one prospect")
14
+ .option("--due", "Only running enrollments whose next step's day has come and has no draft yet")
15
+ .option("--watched", "Only the email threads to read for replies (open sequences, plus completed ones inside the late-reply window)")).action(async (opts) => {
16
+ try {
17
+ await printPage(`/outreach/enrollments${qs({
18
+ status: opts.status,
19
+ channel: opts.channel,
20
+ prospectId: opts.prospectId,
21
+ due: opts.due ? "true" : undefined,
22
+ watched: opts.watched ? "true" : undefined,
23
+ page: opts.page,
24
+ pageSize: opts.pageSize,
25
+ })}`, [
26
+ { key: "prospect", label: "Prospect", width: 22 },
27
+ { key: "companyName", label: "Company", width: 22 },
28
+ { key: "sequenceSlug", label: "Sequence", width: 14 },
29
+ { key: "channel", label: "Channel", width: 8 },
30
+ { key: "state", label: "Status", width: 20 },
31
+ { key: "currentStep", label: "Step", width: 4 },
32
+ { key: "nextDueAt", label: "Next due", width: 24 },
33
+ { key: "id", label: "Id", width: 36 },
34
+ ], opts, (e) => ({
35
+ ...e,
36
+ prospect: fullName(e.prospectFirstName, e.prospectLastName),
37
+ state: e.stopReason ? `${e.status} (${e.stopReason})` : e.status,
38
+ }));
39
+ }
40
+ catch (err) {
41
+ handleError(err);
42
+ }
43
+ });
44
+ const getCmd = new Command("get")
45
+ .description("Show an enrollment with its prospect, steps and message thread")
46
+ .argument("<id>", "Enrollment id")
47
+ .option("--json", "Output as JSON")
48
+ .action(async (id, opts) => {
49
+ try {
50
+ const data = await api.get(`/outreach/enrollments/${id}`);
51
+ if (opts.json) {
52
+ printJson(data);
53
+ return;
54
+ }
55
+ printDetail({
56
+ ...data,
57
+ prospectLine: `${fullName(data.prospect.firstName, data.prospect.lastName)} (${data.prospect.id})`,
58
+ sequenceSlug: data.sequence?.slug,
59
+ }, [
60
+ { key: "prospectLine", label: "Prospect" },
61
+ { key: "sequenceSlug", label: "Sequence" },
62
+ { key: "channel", label: "Channel" },
63
+ { key: "status", label: "Status" },
64
+ { key: "stopReason", label: "Stop reason" },
65
+ { key: "currentStep", label: "Current step" },
66
+ { key: "gmailThreadId", label: "Gmail thread" },
67
+ { key: "startedAt", label: "Started" },
68
+ { key: "lastSentAt", label: "Last sent" },
69
+ { key: "nextDueAt", label: "Next due" },
70
+ { key: "stoppedAt", label: "Stopped" },
71
+ { key: "id", label: "Id" },
72
+ ], opts);
73
+ for (const s of data.steps) {
74
+ const when = s.bouncedAt ?? s.sentAt ?? s.draftedAt ?? "-";
75
+ console.log(` step ${s.n} ${s.status.padEnd(8)} ${when} ${s.subject ?? ""}${s.gmailDraftId ? chalk.dim(` draft ${s.gmailDraftId}`) : ""}`);
76
+ }
77
+ for (const m of data.messages) {
78
+ console.log(` ${m.direction === "in" ? "<-" : "->"} ${m.sentAt} ${m.channel} ${m.kind.padEnd(10)} ${m.subject ?? m.fromAddress ?? ""}`);
79
+ }
80
+ }
81
+ catch (err) {
82
+ handleError(err);
83
+ }
84
+ });
85
+ export const outreachEnrollmentCommand = new Command("enrollment")
86
+ .description("Enrollments: a prospect running a sequence on one channel, with its drafted steps and thread")
87
+ .addCommand(listCmd)
88
+ .addCommand(getCmd);
89
+ for (const cmd of outreachEnrollmentWriteCommands) {
90
+ outreachEnrollmentCommand.addCommand(cmd);
91
+ }
92
+ //# sourceMappingURL=outreach-enrollments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outreach-enrollments.js","sourceRoot":"","sources":["../../../src/commands/api/outreach-enrollments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,G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AU,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const outreachProspectWriteCommands: Command[];
@@ -0,0 +1,139 @@
1
+ import { Command } from "commander";
2
+ import { api } from "../../lib/api.js";
3
+ import { handleError } from "../../lib/format.js";
4
+ import { compact, csv, done, nullable, nullableInt, parseBool, } from "../../lib/command-helpers.js";
5
+ import { fullName, LANGUAGES, printDroppedDrafts, SIGNALS, } from "./outreach-shared.js";
6
+ function withPersonOptions(cmd) {
7
+ return cmd
8
+ .option("--last-name <name>", 'Last name ("null" to clear)')
9
+ .option("--role <role>", 'Role at the company ("null" to clear)')
10
+ .option("--linkedin-url <url>", 'LinkedIn profile URL ("null" to clear)');
11
+ }
12
+ function personPayload(opts) {
13
+ return compact({
14
+ lastName: nullable(opts.lastName),
15
+ role: nullable(opts.role),
16
+ linkedinUrl: nullable(opts.linkedinUrl),
17
+ });
18
+ }
19
+ function statusDone(data, opts, message) {
20
+ done(data, opts, message);
21
+ if (!opts.json)
22
+ printDroppedDrafts(data.droppedDrafts);
23
+ }
24
+ const createCmd = withPersonOptions(new Command("create")
25
+ .description("Create a prospect at a qualified company, with the signal and the evidence that produced it")
26
+ .requiredOption("--company-id <id>", "Company id (must be qualified)")
27
+ .requiredOption("--first-name <name>", "First name")
28
+ .requiredOption("--language <lang>", LANGUAGES)
29
+ .requiredOption("--signal <signal>", SIGNALS)
30
+ .requiredOption("--evidence-url <url>", "URL the evidence was read on")
31
+ .requiredOption("--evidence-quote <text>", "Quote that shows the signal")
32
+ .option("--signal-id <id>", "Signal hit the evidence comes from"))
33
+ .option("--json", "Output as JSON")
34
+ .action(async (opts) => {
35
+ try {
36
+ const data = await api.post("/outreach/prospects", {
37
+ companyId: opts.companyId,
38
+ firstName: opts.firstName,
39
+ ...personPayload(opts),
40
+ language: opts.language,
41
+ signal: opts.signal,
42
+ evidence: {
43
+ signalId: opts.signalId ?? null,
44
+ url: opts.evidenceUrl,
45
+ quote: opts.evidenceQuote,
46
+ },
47
+ });
48
+ done(data, opts, `Prospect created: ${fullName(data.firstName, data.lastName)} (${data.id})`);
49
+ }
50
+ catch (err) {
51
+ handleError(err);
52
+ }
53
+ });
54
+ const updateCmd = withPersonOptions(new Command("update")
55
+ .description("Update a prospect's person fields (email and status have their own commands)")
56
+ .argument("<id>", "Prospect id")
57
+ .option("--first-name <name>", "First name")
58
+ .option("--language <lang>", LANGUAGES))
59
+ .option("--json", "Output as JSON")
60
+ .action(async (id, opts) => {
61
+ try {
62
+ const data = await api.post(`/outreach/prospects/${id}`, {
63
+ ...compact({ firstName: opts.firstName, language: opts.language }),
64
+ ...personPayload(opts),
65
+ });
66
+ done(data, opts, `Prospect updated: ${fullName(data.firstName, data.lastName)}`);
67
+ }
68
+ catch (err) {
69
+ handleError(err);
70
+ }
71
+ });
72
+ const emailCmd = new Command("email")
73
+ .description("Record the find-then-verify result for a prospect's email; the API sets the prospect ready or linkedin-only")
74
+ .argument("<id>", "Prospect id")
75
+ .requiredOption("--email <email>", "Email address")
76
+ .requiredOption("--status <status>", "valid | invalid | accept-all | unknown")
77
+ .requiredOption("--provider <name>", "Verification provider (hunter)")
78
+ .option("--score <n>", 'Finder confidence score 0 to 100 ("null" for none)')
79
+ .option("--seen-on <list>", "Comma-separated places the address was seen: site | signature | registry | linkedin | finder")
80
+ .option("--pattern-confirmed <bool>", "The company's address pattern is confirmed: true | false")
81
+ .option("--verified-at <iso>", "When it was verified (defaults to now)")
82
+ .option("--json", "Output as JSON")
83
+ .action(async (id, opts) => {
84
+ try {
85
+ const data = await api.post(`/outreach/prospects/${id}/email`, {
86
+ email: opts.email,
87
+ status: opts.status,
88
+ provider: opts.provider,
89
+ ...compact({
90
+ score: nullableInt(opts.score, "score"),
91
+ seenOn: opts.seenOn !== undefined ? csv(opts.seenOn) : undefined,
92
+ patternConfirmed: opts.patternConfirmed !== undefined
93
+ ? parseBool(opts.patternConfirmed, "pattern-confirmed")
94
+ : undefined,
95
+ verifiedAt: opts.verifiedAt,
96
+ }),
97
+ });
98
+ done(data, opts, `Email recorded, prospect ${data.status}`);
99
+ }
100
+ catch (err) {
101
+ handleError(err);
102
+ }
103
+ });
104
+ const statusCmd = new Command("status")
105
+ .description("Park or drop a prospect; a running sequence stops and its unsent Gmail drafts come back to delete")
106
+ .argument("<id>", "Prospect id")
107
+ .argument("<status>", "parked | dropped")
108
+ .option("--json", "Output as JSON")
109
+ .action(async (id, status, opts) => {
110
+ try {
111
+ const data = await api.post(`/outreach/prospects/${id}/status`, { status });
112
+ statusDone(data, opts, `Prospect ${fullName(data.prospect.firstName, data.prospect.lastName)}: ${data.prospect.status}`);
113
+ }
114
+ catch (err) {
115
+ handleError(err);
116
+ }
117
+ });
118
+ const replyOutcomeCmd = new Command("reply-outcome")
119
+ .description("Close a replied prospect: not-a-lead, or said-no (opts out the prospect and the company)")
120
+ .argument("<id>", "Prospect id")
121
+ .argument("<outcome>", "not-a-lead | said-no")
122
+ .option("--json", "Output as JSON")
123
+ .action(async (id, outcome, opts) => {
124
+ try {
125
+ const data = await api.post(`/outreach/prospects/${id}/reply-outcome`, { outcome });
126
+ statusDone(data, opts, `Reply outcome ${outcome} recorded, prospect ${data.prospect.status}`);
127
+ }
128
+ catch (err) {
129
+ handleError(err);
130
+ }
131
+ });
132
+ export const outreachProspectWriteCommands = [
133
+ createCmd,
134
+ updateCmd,
135
+ emailCmd,
136
+ statusCmd,
137
+ replyOutcomeCmd,
138
+ ];
139
+ //# sourceMappingURL=outreach-prospect-writes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outreach-prospect-writes.js","sourceRoot":"","sources":["../../../src/commands/api/outreach-prospect-writes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,OAAO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CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,WAAW,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;KACjD,WAAW,CACV,0FAA0F,CAC3F;KACA,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;KAC/B,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;KAC7C,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAClC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,OAAe,EAAE,IAAa,EAAE,EAAE;IAC3D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,CACzB,uBAAuB,EAAE,gBAAgB,EACzC,EAAE,OAAO,EAAE,CACZ,CAAC;QACF,UAAU,CACR,IAAI,EACJ,IAAI,EACJ,iBAAiB,OAAO,uBAAuB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CACtE,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,WAAW,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,eAAe;CAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const outreachProspectCommand: Command;
@@ -0,0 +1,96 @@
1
+ import { Command } from "commander";
2
+ import chalk from "chalk";
3
+ import { api } from "../../lib/api.js";
4
+ import { handleError, printDetail } from "../../lib/format.js";
5
+ import { printJson, qs } from "../../lib/command-helpers.js";
6
+ import { outreachProspectWriteCommands } from "./outreach-prospect-writes.js";
7
+ import { fullName, LANGUAGES, printPage, SIGNALS, withPageOptions, } from "./outreach-shared.js";
8
+ const STATUSES = "new | ready | linkedin-only | enrolled | replied | bounced | parked | dropped";
9
+ const listCmd = withPageOptions(new Command("list")
10
+ .description("List prospects with their company and open enrollment, last updated first")
11
+ .option("--status <list>", `One status or several, comma-separated (ready,linkedin-only): ${STATUSES}`)
12
+ .option("--company-id <id>", "Prospects of one company")
13
+ .option("--signal <signal>", SIGNALS)
14
+ .option("--language <lang>", LANGUAGES)
15
+ .option("--q <text>", "Name, email or company name contains")).action(async (opts) => {
16
+ try {
17
+ await printPage(`/outreach/prospects${qs({
18
+ status: opts.status,
19
+ companyId: opts.companyId,
20
+ signal: opts.signal,
21
+ language: opts.language,
22
+ q: opts.q,
23
+ page: opts.page,
24
+ pageSize: opts.pageSize,
25
+ })}`, [
26
+ { key: "name", label: "Name", width: 22 },
27
+ { key: "companyName", label: "Company", width: 22 },
28
+ { key: "status", label: "Status", width: 13 },
29
+ { key: "signal", label: "Signal", width: 12 },
30
+ { key: "language", label: "Lang", width: 4 },
31
+ { key: "email", label: "Email", width: 30 },
32
+ { key: "enrollment", label: "Enrollment", width: 22 },
33
+ { key: "id", label: "Id", width: 36 },
34
+ ], opts, (p) => ({
35
+ ...p,
36
+ name: fullName(p.firstName, p.lastName),
37
+ enrollment: p.openEnrollment
38
+ ? `${p.openEnrollment.channel} ${p.openEnrollment.status} step ${p.openEnrollment.currentStep}`
39
+ : null,
40
+ }));
41
+ }
42
+ catch (err) {
43
+ handleError(err);
44
+ }
45
+ });
46
+ const getCmd = new Command("get")
47
+ .description("Show a prospect with its company, evidence and enrollments")
48
+ .argument("<id>", "Prospect id")
49
+ .option("--json", "Output as JSON")
50
+ .action(async (id, opts) => {
51
+ try {
52
+ const data = await api.get(`/outreach/prospects/${id}`);
53
+ if (opts.json) {
54
+ printJson(data);
55
+ return;
56
+ }
57
+ printDetail({
58
+ ...data,
59
+ name: fullName(data.firstName, data.lastName),
60
+ companyLine: `${data.company.name} (${data.company.status})`,
61
+ emailLine: data.email
62
+ ? `${data.email} (${data.emailStatus ?? "unverified"})`
63
+ : null,
64
+ evidenceLine: `${data.evidence.quote} ${chalk.dim(data.evidence.url)}`,
65
+ }, [
66
+ { key: "name", label: "Name" },
67
+ { key: "role", label: "Role" },
68
+ { key: "companyLine", label: "Company" },
69
+ { key: "status", label: "Status" },
70
+ { key: "language", label: "Language" },
71
+ { key: "signal", label: "Signal" },
72
+ { key: "evidenceLine", label: "Evidence" },
73
+ { key: "emailLine", label: "Email" },
74
+ { key: "emailProvider", label: "Email provider" },
75
+ { key: "emailScore", label: "Email score" },
76
+ { key: "linkedinUrl", label: "LinkedIn" },
77
+ { key: "parkedAt", label: "Parked" },
78
+ { key: "optedOutAt", label: "Opted out" },
79
+ { key: "id", label: "Id" },
80
+ ], opts);
81
+ for (const e of data.enrollments) {
82
+ console.log(` enrollment ${e.channel.padEnd(8)} ${e.status.padEnd(9)} ${e.sequence?.slug ?? "-"} step ${e.currentStep}${e.stopReason ? ` (${e.stopReason})` : ""} ${chalk.dim(e.id)}`);
83
+ }
84
+ }
85
+ catch (err) {
86
+ handleError(err);
87
+ }
88
+ });
89
+ export const outreachProspectCommand = new Command("prospect")
90
+ .description("Prospects: one person at a qualified company, with the signal, evidence and verified email")
91
+ .addCommand(listCmd)
92
+ .addCommand(getCmd);
93
+ for (const cmd of outreachProspectWriteCommands) {
94
+ outreachProspectCommand.addCommand(cmd);
95
+ }
96
+ //# sourceMappingURL=outreach-prospects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outreach-prospects.js","sourceRoot":"","sources":["../../../src/commands/api/outreach-prospects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAgB,SAAS,EAAE,EAAE,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAA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,KAAK,EAAE,QAAQ,EAAE;YACpC,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE;YACzC,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;SAC3B,EACD,IAAI,CACL,CAAC;QACF,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,CACT,iBAAiB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,IAAI,GAAG,SAAS,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAC7K,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,WAAW,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;KAC3D,WAAW,CACV,4FAA4F,CAC7F;KACA,UAAU,CAAC,OAAO,CAAC;KACnB,UAAU,CAAC,MAAM,CAAC,CAAC;AAEtB,KAAK,MAAM,GAAG,IAAI,6BAA6B,EAAE,CAAC;IAChD,uBAAuB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const outreachSettingsCommands: Command[];
@@ -0,0 +1,193 @@
1
+ import { Command } from "commander";
2
+ import chalk from "chalk";
3
+ import { api } from "../../lib/api.js";
4
+ import { handleError, printList } from "../../lib/format.js";
5
+ import { compact, csv, done, nullable, printJson, readJsonObject, } from "../../lib/command-helpers.js";
6
+ const THRESHOLD_KEYS = "dailyMessage1Cap, dailySendCeiling, bounceRateCeiling (fraction), spamRateCeiling (fraction), draftStaleDays, finderScoreFloor, reEnrollmentMonths, lateReplyDays";
7
+ function printSettings(data) {
8
+ const lines = [
9
+ ["mailbox", data.mailbox],
10
+ ["signature", data.signature],
11
+ ["catchAllPolicy", data.catchAllPolicy],
12
+ ["forbiddenTerms", data.forbiddenTerms.join(", ") || null],
13
+ ];
14
+ for (const [key, value] of lines) {
15
+ console.log(` ${key.padEnd(30)} ${value ?? chalk.dim("-")}`);
16
+ }
17
+ for (const [key, value] of Object.entries(data.thresholds)) {
18
+ const changed = data.defaults[key] !== value;
19
+ const suffix = changed ? chalk.dim(` (default ${data.defaults[key]})`) : "";
20
+ console.log(` ${key.padEnd(30)} ${value}${suffix}`);
21
+ }
22
+ }
23
+ function parseThresholds(pairs) {
24
+ const thresholds = {};
25
+ for (const pair of pairs) {
26
+ const [key, value] = pair.split("=");
27
+ if (!key || value === undefined) {
28
+ throw new Error(`Expected key=value, got "${pair}"`);
29
+ }
30
+ const n = Number(value.trim());
31
+ if (value.trim() === "" || !Number.isFinite(n)) {
32
+ throw new Error(`${key} must be a number`);
33
+ }
34
+ thresholds[key.trim()] = n;
35
+ }
36
+ return thresholds;
37
+ }
38
+ const settingsGet = new Command("get")
39
+ .description("Show the Outreach settings: mailbox, signature, forbidden terms, catch-all policy, thresholds (with defaults)")
40
+ .option("--json", "Output as JSON")
41
+ .action(async (opts) => {
42
+ try {
43
+ const data = await api.get("/outreach/settings");
44
+ if (opts.json)
45
+ printJson(data);
46
+ else
47
+ printSettings(data);
48
+ }
49
+ catch (err) {
50
+ handleError(err);
51
+ }
52
+ });
53
+ const settingsSet = new Command("set")
54
+ .description("Change one or more Outreach settings; unset ones keep their value")
55
+ .option("--mailbox <email>", 'Sending mailbox ("null" to clear)')
56
+ .option("--signature <text>", 'Signature appended to drafts ("null" to clear)')
57
+ .option("--forbidden-terms <list>", 'Comma-separated terms no draft may contain, replaces the list ("none" to clear)')
58
+ .option("--catch-all-policy <policy>", "pattern-confirmed | never")
59
+ .option("--threshold <key=value...>", `Threshold to set, repeatable (e.g. --threshold dailyMessage1Cap=8); keys: ${THRESHOLD_KEYS}`)
60
+ .option("--file <path>", "JSON object with any of the fields above (camelCase, thresholds as an object); flags win")
61
+ .option("--json", "Output as JSON")
62
+ .action(async (opts) => {
63
+ try {
64
+ const fromFile = opts.file ? readJsonObject(opts.file) : {};
65
+ const body = {
66
+ ...fromFile,
67
+ ...compact({
68
+ mailbox: nullable(opts.mailbox),
69
+ signature: nullable(opts.signature),
70
+ forbiddenTerms: opts.forbiddenTerms === undefined
71
+ ? undefined
72
+ : opts.forbiddenTerms === "none"
73
+ ? []
74
+ : csv(opts.forbiddenTerms),
75
+ catchAllPolicy: opts.catchAllPolicy,
76
+ thresholds: opts.threshold
77
+ ? {
78
+ ...fromFile.thresholds,
79
+ ...parseThresholds(opts.threshold),
80
+ }
81
+ : undefined,
82
+ }),
83
+ };
84
+ if (!Object.keys(body).length) {
85
+ throw new Error("Nothing to set: pass at least one option");
86
+ }
87
+ const data = await api.post("/outreach/settings", body);
88
+ if (opts.json)
89
+ printJson(data);
90
+ else
91
+ printSettings(data);
92
+ }
93
+ catch (err) {
94
+ handleError(err);
95
+ }
96
+ });
97
+ const settingsCommand = new Command("settings")
98
+ .description("Outreach settings: mailbox, signature, forbidden terms, catch-all policy, thresholds")
99
+ .addCommand(settingsGet)
100
+ .addCommand(settingsSet);
101
+ const sourceList = new Command("list")
102
+ .description("List data sources with their last successful pull")
103
+ .option("--json", "Output as JSON")
104
+ .action(async (opts) => {
105
+ try {
106
+ const data = await api.get("/outreach/data-sources");
107
+ printList(data, [
108
+ { key: "source", label: "Source", width: 14 },
109
+ { key: "lastSuccessAt", label: "Last success", width: 26 },
110
+ { key: "lastAttemptAt", label: "Last attempt", width: 26 },
111
+ { key: "lastError", label: "Last error", width: 40 },
112
+ ], opts);
113
+ }
114
+ catch (err) {
115
+ handleError(err);
116
+ }
117
+ });
118
+ const sourceStamp = new Command("stamp")
119
+ .description("Record the outcome of a pull from a data source")
120
+ .argument("<source>", "Data source: gmail | hunter | sirene | bodacc | pappers | lbr | linkedin | wttj | funding-feeds | postmaster")
121
+ .requiredOption("--outcome <outcome>", "success | failure")
122
+ .option("--error <text>", "What failed (required with --outcome failure)")
123
+ .option("--at <iso>", "When the pull ran (ISO datetime, defaults to now)")
124
+ .option("--json", "Output as JSON")
125
+ .action(async (source, opts) => {
126
+ try {
127
+ const data = await api.post(`/outreach/data-sources/${source}/stamp`, compact({ outcome: opts.outcome, error: opts.error, at: opts.at }));
128
+ done(data, opts, `Stamped ${source}: ${opts.outcome}`);
129
+ }
130
+ catch (err) {
131
+ handleError(err);
132
+ }
133
+ });
134
+ const sourceCommand = new Command("source")
135
+ .description("Data-source status, stamped by the skill that ran each pull")
136
+ .addCommand(sourceList)
137
+ .addCommand(sourceStamp);
138
+ const accessList = new Command("list")
139
+ .description("List the users holding Outreach access")
140
+ .option("--json", "Output as JSON")
141
+ .action(async (opts) => {
142
+ try {
143
+ const data = await api.get("/outreach/access");
144
+ printList(data, [
145
+ { key: "email", label: "Email", width: 32 },
146
+ { key: "name", label: "Name", width: 20 },
147
+ { key: "type", label: "Type", width: 8 },
148
+ { key: "userId", label: "User id", width: 36 },
149
+ ], opts);
150
+ }
151
+ catch (err) {
152
+ handleError(err);
153
+ }
154
+ });
155
+ const accessGrant = new Command("grant")
156
+ .description("Grant Outreach access to an internal user (human callers only)")
157
+ .argument("<user>", "User id or email")
158
+ .option("--json", "Output as JSON")
159
+ .action(async (user, opts) => {
160
+ try {
161
+ const data = await api.post("/outreach/access", {
162
+ user,
163
+ });
164
+ done(data, opts, `Outreach access granted to ${data.email}`);
165
+ }
166
+ catch (err) {
167
+ handleError(err);
168
+ }
169
+ });
170
+ const accessRevoke = new Command("revoke")
171
+ .description("Revoke a user's Outreach access (human callers only; the last human grant stays)")
172
+ .argument("<userId>", "User id")
173
+ .option("--json", "Output as JSON")
174
+ .action(async (userId, opts) => {
175
+ try {
176
+ const data = await api.delete(`/outreach/access/${userId}`);
177
+ done(data, opts, `Outreach access revoked for ${userId}`);
178
+ }
179
+ catch (err) {
180
+ handleError(err);
181
+ }
182
+ });
183
+ const accessCommand = new Command("access")
184
+ .description("Who can read and write Outreach data (per-user grants)")
185
+ .addCommand(accessList)
186
+ .addCommand(accessGrant)
187
+ .addCommand(accessRevoke);
188
+ export const outreachSettingsCommands = [
189
+ settingsCommand,
190
+ sourceCommand,
191
+ accessCommand,
192
+ ];
193
+ //# sourceMappingURL=outreach-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outreach-settings.js","sourceRoot":"","sources":["../../../src/commands/api/outreach-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,GAAG,EACH,IAAI,EAEJ,QAAQ,EACR,SAAS,EACT,cAAc,GACf,MAAM,8BAA8B,CAAC;AA2BtC,MAAM,cAAc,GAClB,mKAAmK,CAAC;AAEtK,SAAS,aAAa,CAAC,IAAsB;IAC3C,MAAM,KAAK,GAA8B;QACvC,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC;QACzB,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC;QAC7B,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC;QACvC,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;KAC3D,CAAC;IACF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC;Q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AC,UAAU,CAAC;KACtB,UAAU,CAAC,WAAW,CAAC;KACvB,UAAU,CAAC,YAAY,CAAC,CAAC;AAE5B,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,eAAe;IACf,aAAa;IACb,aAAa;CACd,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Command } from "commander";
2
+ import { type JsonOpt } from "../../lib/command-helpers.js";
3
+ export declare const LANGUAGES = "en | fr";
4
+ export declare const SIGNALS = "hiring | fundraise | registration | cohort | agency | warm | event | partner";
5
+ export declare const CHANNELS = "email | linkedin";
6
+ type Column = {
7
+ key: string;
8
+ label: string;
9
+ width?: number;
10
+ };
11
+ export type PageOpts = JsonOpt & {
12
+ page?: string;
13
+ pageSize?: string;
14
+ };
15
+ export type DroppedDraft = {
16
+ enrollmentId: string;
17
+ n: number;
18
+ gmailDraftId: string | null;
19
+ };
20
+ export declare function withPageOptions(cmd: Command): Command;
21
+ export declare function printPage<T>(path: string, columns: Column[], opts: JsonOpt, shape: (row: T) => Record<string, unknown>): Promise<void>;
22
+ export declare function fullName(first: string, last: string | null): string;
23
+ export declare function printDroppedDrafts(drafts: DroppedDraft[]): void;
24
+ export {};
@@ -0,0 +1,34 @@
1
+ import chalk from "chalk";
2
+ import { api } from "../../lib/api.js";
3
+ import { printList } from "../../lib/format.js";
4
+ import { printJson } from "../../lib/command-helpers.js";
5
+ export const LANGUAGES = "en | fr";
6
+ export const SIGNALS = "hiring | fundraise | registration | cohort | agency | warm | event | partner";
7
+ export const CHANNELS = "email | linkedin";
8
+ export function withPageOptions(cmd) {
9
+ return cmd
10
+ .option("--page <n>", "Page number (default 1)")
11
+ .option("--page-size <n>", "Page size (default 100, max 1000)")
12
+ .option("--json", "Output as JSON ({ data, meta })");
13
+ }
14
+ export async function printPage(path, columns, opts, shape) {
15
+ const { data, meta } = await api.getWithMeta(path);
16
+ if (opts.json) {
17
+ printJson({ data, meta });
18
+ return;
19
+ }
20
+ printList(data.map(shape), columns, opts);
21
+ if (meta) {
22
+ console.log(chalk.dim(`page ${meta.page}/${meta.totalPages}, ${meta.total} total`));
23
+ }
24
+ }
25
+ export function fullName(first, last) {
26
+ return last ? `${first} ${last}` : first;
27
+ }
28
+ // The API never calls Gmail: the caller deletes these drafts there.
29
+ export function printDroppedDrafts(drafts) {
30
+ for (const d of drafts) {
31
+ console.log(chalk.yellow(` dropped draft: enrollment ${d.enrollmentId} step ${d.n}, Gmail draft ${d.gmailDraftId ?? "-"}`));
32
+ }
33
+ }
34
+ //# sourceMappingURL=outreach-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outreach-shared.js","sourceRoot":"","sources":["../../../src/commands/api/outreach-shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAgB,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AACnC,MAAM,CAAC,MAAM,OAAO,GAClB,8EAA8E,CAAC;AACjF,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAmB3C,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,OAAO,GAAG;SACP,MAAM,CAAC,YAAY,EAAE,yBAAyB,CAAC;SAC/C,MAAM,CAAC,iBAAiB,EAAE,mCAAmC,CAAC;SAC9D,MAAM,CAAC,QAAQ,EAAE,iCAAiC,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,IAAY,EACZ,OAAiB,EACjB,IAAa,EACb,KAA0C;IAE1C,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,GAAG,CAAC,WAAW,CAAgB,IAAI,CAAC,CAAC;IAClE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,SAAS,CAAC,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