fullstackgtm 0.12.0 → 0.13.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.
- package/CHANGELOG.md +27 -0
- package/README.md +19 -0
- package/dist/calls.d.ts +72 -0
- package/dist/calls.js +345 -0
- package/dist/cli.js +179 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp.js +20 -0
- package/llms.txt +7 -0
- package/package.json +1 -1
- package/src/calls.ts +434 -0
- package/src/cli.ts +193 -0
- package/src/index.ts +13 -0
- package/src/mcp.ts +26 -0
package/src/cli.ts
CHANGED
|
@@ -38,6 +38,7 @@ import { createFilePlanStore } from "./planStore.ts";
|
|
|
38
38
|
import { auditReportToHtml, auditReportToMarkdown, type ReportOptions } from "./report.ts";
|
|
39
39
|
import { builtinAuditRules } from "./rules.ts";
|
|
40
40
|
import { sampleSnapshot } from "./sampleData.ts";
|
|
41
|
+
import { parseCall, suggestCallDeal, type ExtractedCallInsight, type ParsedCall } from "./calls.ts";
|
|
41
42
|
import { suggestValues, type ValueSuggestion } from "./suggest.ts";
|
|
42
43
|
import type { FieldMappings } from "./mappings.ts";
|
|
43
44
|
import type {
|
|
@@ -69,6 +70,11 @@ Usage:
|
|
|
69
70
|
fullstackgtm report [source options] [audit options] [report options]
|
|
70
71
|
fullstackgtm diff --before <a.json> --after <b.json> [--json] [--fail-on-new-findings]
|
|
71
72
|
fullstackgtm merge --input <a.json> --input <b.json> [...] --out <merged.json> [--json]
|
|
73
|
+
fullstackgtm call parse --transcript <file> [--title t] [--source fathom|granola|...] [--json|--ndjson] [--out <path>]
|
|
74
|
+
fullstackgtm call link --attendees <a@x.com,...> | --domain <x.com> [source options] [--json]
|
|
75
|
+
fullstackgtm call plan --transcript <file>|--call <parsed.json> --deal <id> [source options] [--save|--json]
|
|
76
|
+
calls become evidence: parse dialects (Speaker:/[Me]/Granola JSON),
|
|
77
|
+
link to the right deal, and propose governed next-step writes
|
|
72
78
|
fullstackgtm suggest --plan-id <id> | --plan <path> [source options] [--json] [--out <path>]
|
|
73
79
|
derive values for requires_human_* placeholders
|
|
74
80
|
from snapshot evidence, with confidence + reasons
|
|
@@ -465,6 +471,189 @@ function parseValueOverrides(args: string[]) {
|
|
|
465
471
|
return valueOverrides;
|
|
466
472
|
}
|
|
467
473
|
|
|
474
|
+
async function callCommand(args: string[]) {
|
|
475
|
+
const [subcommand, ...rest] = args;
|
|
476
|
+
|
|
477
|
+
const loadParsedCall = (): ParsedCall => {
|
|
478
|
+
const callPath = option(rest, "--call");
|
|
479
|
+
if (callPath) {
|
|
480
|
+
return JSON.parse(readFileSync(resolve(process.cwd(), callPath), "utf8")) as ParsedCall;
|
|
481
|
+
}
|
|
482
|
+
const transcriptPath = option(rest, "--transcript");
|
|
483
|
+
if (!transcriptPath) throw new Error(`call ${subcommand} requires --transcript <file> or --call <parsed.json>`);
|
|
484
|
+
const raw = readFileSync(resolve(process.cwd(), transcriptPath), "utf8");
|
|
485
|
+
const source = option(rest, "--source") as ParsedCall["sourceSystem"] | undefined;
|
|
486
|
+
return parseCall(raw, {
|
|
487
|
+
title: option(rest, "--title") ?? undefined,
|
|
488
|
+
sourceSystem: source,
|
|
489
|
+
capturedAt: new Date().toISOString(),
|
|
490
|
+
});
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
if (subcommand === "parse") {
|
|
494
|
+
const parsed = loadParsedCall();
|
|
495
|
+
const outPath = option(rest, "--out");
|
|
496
|
+
if (outPath) writeFileSync(resolve(process.cwd(), outPath), `${JSON.stringify(parsed, null, 2)}\n`);
|
|
497
|
+
if (rest.includes("--ndjson")) {
|
|
498
|
+
// One flat row per insight — warehouse-friendly (e.g. Snowflake COPY).
|
|
499
|
+
for (const insight of parsed.insights) {
|
|
500
|
+
console.log(
|
|
501
|
+
JSON.stringify({
|
|
502
|
+
call_id: parsed.id,
|
|
503
|
+
call_title: parsed.title ?? null,
|
|
504
|
+
source_system: parsed.sourceSystem,
|
|
505
|
+
type: insight.type,
|
|
506
|
+
title: insight.title,
|
|
507
|
+
text: insight.text,
|
|
508
|
+
evidence: insight.evidence,
|
|
509
|
+
speaker: insight.speaker ?? null,
|
|
510
|
+
confidence: insight.confidence,
|
|
511
|
+
importance: insight.importance,
|
|
512
|
+
}),
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
if (rest.includes("--json") || outPath) {
|
|
518
|
+
if (!outPath) console.log(JSON.stringify(parsed, null, 2));
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
console.log(`Call ${parsed.id}${parsed.title ? ` — ${parsed.title}` : ""} (${parsed.sourceSystem})`);
|
|
522
|
+
console.log(`${parsed.segments.length} segments · ${parsed.insights.length} insights (${parsed.summary.highImportance} high-importance)\n`);
|
|
523
|
+
for (const insight of parsed.insights) {
|
|
524
|
+
console.log(`[${insight.type}] (importance ${insight.importance}) ${insight.text}`);
|
|
525
|
+
}
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (subcommand === "link") {
|
|
530
|
+
const attendees = option(rest, "--attendees");
|
|
531
|
+
const domain = option(rest, "--domain");
|
|
532
|
+
if (!attendees && !domain) throw new Error("call link requires --attendees <emails,comma-separated> and/or --domain <example.com>");
|
|
533
|
+
const snapshot = await readSnapshot(rest);
|
|
534
|
+
const suggestion = suggestCallDeal(snapshot, {
|
|
535
|
+
attendeeEmails: attendees?.split(",").map((e) => e.trim()).filter(Boolean),
|
|
536
|
+
domain: domain ?? undefined,
|
|
537
|
+
});
|
|
538
|
+
if (rest.includes("--json")) {
|
|
539
|
+
console.log(JSON.stringify(suggestion, null, 2));
|
|
540
|
+
} else {
|
|
541
|
+
const marker = suggestion.confidence === "high" ? "✓" : suggestion.confidence === "low" ? "~" : "✗";
|
|
542
|
+
console.log(`${marker} [${suggestion.confidence}] ${suggestion.dealId ?? "no match"}${suggestion.dealName ? ` — ${suggestion.dealName}` : ""}`);
|
|
543
|
+
console.log(` ${suggestion.reason}`);
|
|
544
|
+
}
|
|
545
|
+
if (suggestion.confidence === "none") process.exitCode = 1;
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (subcommand === "plan") {
|
|
550
|
+
const dealId = option(rest, "--deal");
|
|
551
|
+
if (!dealId) throw new Error("call plan requires --deal <dealId> (use `call link` to find it)");
|
|
552
|
+
const parsed = loadParsedCall();
|
|
553
|
+
const snapshot = await readSnapshot(rest);
|
|
554
|
+
const deal = snapshot.deals.find((row) => row.id === dealId);
|
|
555
|
+
if (!deal) throw new Error(`Deal ${dealId} is not in the snapshot — check the id or the snapshot source.`);
|
|
556
|
+
|
|
557
|
+
const nextSteps = parsed.insights.filter((insight) => insight.type === "next_step");
|
|
558
|
+
if (nextSteps.length === 0) {
|
|
559
|
+
console.log("No next-step insights in this call — nothing to plan. (Other insight types are evidence, not writes.)");
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
const [top, ...others] = nextSteps;
|
|
563
|
+
const proposed = top.text.trim().slice(0, 255);
|
|
564
|
+
const current = deal.nextStep?.trim() ?? "";
|
|
565
|
+
const plan = buildCallPlan(parsed, deal, proposed, current, others.slice(0, 3));
|
|
566
|
+
|
|
567
|
+
if (rest.includes("--save")) {
|
|
568
|
+
await createFilePlanStore().save(plan);
|
|
569
|
+
console.log(
|
|
570
|
+
`Saved plan ${plan.id}. Review with \`fullstackgtm plans show ${plan.id}\`, approve with \`fullstackgtm plans approve ${plan.id} --operations <ids|all>\`, then \`fullstackgtm apply --plan-id ${plan.id} --provider <name>\`.`,
|
|
571
|
+
);
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
console.log(rest.includes("--json") ? JSON.stringify(plan, null, 2) : patchPlanToMarkdown(plan));
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
throw new Error(`call supports: parse, link, plan (got ${subcommand ?? "nothing"})`);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function buildCallPlan(
|
|
582
|
+
parsed: ParsedCall,
|
|
583
|
+
deal: { id: string; name: string; nextStep?: string },
|
|
584
|
+
proposed: string,
|
|
585
|
+
current: string,
|
|
586
|
+
extraNextSteps: ExtractedCallInsight[],
|
|
587
|
+
): PatchPlan {
|
|
588
|
+
const findings: PatchPlan["findings"] = [];
|
|
589
|
+
const operations: PatchPlan["operations"] = [];
|
|
590
|
+
const nextStepEvidence = parsed.evidence.filter(
|
|
591
|
+
(item) => (item.metadata as { insightType?: string } | undefined)?.insightType === "next_step",
|
|
592
|
+
);
|
|
593
|
+
const evidenceIds = nextStepEvidence.map((item) => item.id);
|
|
594
|
+
|
|
595
|
+
if (current.toLowerCase() !== proposed.toLowerCase()) {
|
|
596
|
+
findings.push({
|
|
597
|
+
id: `finding_${parsed.id.replace(/^call_/, "")}_${deal.id}`,
|
|
598
|
+
objectType: "deal",
|
|
599
|
+
objectId: deal.id,
|
|
600
|
+
ruleId: "call-next-step-not-reflected-in-crm",
|
|
601
|
+
type: "call_next_step_not_reflected_in_crm",
|
|
602
|
+
title: "Call agreed a next step the CRM does not reflect",
|
|
603
|
+
severity: "warning",
|
|
604
|
+
summary: current
|
|
605
|
+
? `The call produced "${proposed}" but ${deal.name}'s next step still reads "${current}".`
|
|
606
|
+
: `The call produced "${proposed}" but ${deal.name} has no next step set.`,
|
|
607
|
+
recommendation: "Review the evidence and approve the next-step update.",
|
|
608
|
+
evidenceIds,
|
|
609
|
+
currentCrmValue: current || null,
|
|
610
|
+
proposedValue: proposed,
|
|
611
|
+
});
|
|
612
|
+
operations.push({
|
|
613
|
+
id: `op_${parsed.id.replace(/^call_/, "")}_next`,
|
|
614
|
+
objectType: "deal",
|
|
615
|
+
objectId: deal.id,
|
|
616
|
+
operation: "set_field",
|
|
617
|
+
field: "nextStep",
|
|
618
|
+
beforeValue: current || null,
|
|
619
|
+
afterValue: proposed,
|
|
620
|
+
reason: `Call evidence: ${nextStepEvidence[0]?.text.slice(0, 200) ?? proposed}`,
|
|
621
|
+
sourceRuleOrPolicy: "call_intelligence.next_step",
|
|
622
|
+
riskLevel: "high",
|
|
623
|
+
approvalRequired: true,
|
|
624
|
+
rollback: "Restore the previous deal next step (the before value) if the update is wrong.",
|
|
625
|
+
evidenceIds,
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
for (const [index, extra] of extraNextSteps.entries()) {
|
|
629
|
+
operations.push({
|
|
630
|
+
id: `op_${parsed.id.replace(/^call_/, "")}_task${index}`,
|
|
631
|
+
objectType: "deal",
|
|
632
|
+
objectId: deal.id,
|
|
633
|
+
operation: "create_task",
|
|
634
|
+
field: "follow_up_task",
|
|
635
|
+
beforeValue: null,
|
|
636
|
+
afterValue: extra.text.trim().slice(0, 255),
|
|
637
|
+
reason: `Additional commitment from the call: ${extra.evidence.slice(0, 160)}`,
|
|
638
|
+
sourceRuleOrPolicy: "call_intelligence.follow_up",
|
|
639
|
+
riskLevel: "low",
|
|
640
|
+
approvalRequired: true,
|
|
641
|
+
rollback: "Close or delete the created task.",
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
return {
|
|
645
|
+
id: `patch_plan_${parsed.id.replace(/^call_/, "")}${deal.id.slice(-4)}`,
|
|
646
|
+
title: `Call evidence plan${parsed.title ? ` — ${parsed.title}` : ""} → ${deal.name}`,
|
|
647
|
+
createdAt: new Date().toISOString(),
|
|
648
|
+
status: "needs_approval",
|
|
649
|
+
dryRun: true,
|
|
650
|
+
summary: `${findings.length} finding(s) and ${operations.length} proposed operation(s) from call ${parsed.id}.`,
|
|
651
|
+
findings,
|
|
652
|
+
evidence: parsed.evidence,
|
|
653
|
+
operations,
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
|
|
468
657
|
async function suggest(args: string[]) {
|
|
469
658
|
const planId = option(args, "--plan-id");
|
|
470
659
|
const planPath = option(args, "--plan");
|
|
@@ -1271,6 +1460,10 @@ export async function runCli(argv: string[]) {
|
|
|
1271
1460
|
await suggest(args);
|
|
1272
1461
|
return;
|
|
1273
1462
|
}
|
|
1463
|
+
if (command === "call") {
|
|
1464
|
+
await callCommand(args);
|
|
1465
|
+
return;
|
|
1466
|
+
}
|
|
1274
1467
|
if (command === "profiles") {
|
|
1275
1468
|
profilesCommand(args);
|
|
1276
1469
|
return;
|
package/src/index.ts
CHANGED
|
@@ -98,6 +98,19 @@ export {
|
|
|
98
98
|
requiresHumanInput,
|
|
99
99
|
staleDealRule,
|
|
100
100
|
} from "./rules.ts";
|
|
101
|
+
export {
|
|
102
|
+
extractCallInsights,
|
|
103
|
+
normalizeTranscript,
|
|
104
|
+
parseCall,
|
|
105
|
+
parseTranscript,
|
|
106
|
+
suggestCallDeal,
|
|
107
|
+
summarizeInsights,
|
|
108
|
+
type CallDealSuggestion,
|
|
109
|
+
type CallInsightType,
|
|
110
|
+
type ExtractedCallInsight,
|
|
111
|
+
type ParsedCall,
|
|
112
|
+
type ParsedTranscriptSegment,
|
|
113
|
+
} from "./calls.ts";
|
|
101
114
|
export { sampleSnapshot } from "./sampleData.ts";
|
|
102
115
|
export { suggestValues, type SuggestionConfidence, type ValueSuggestion } from "./suggest.ts";
|
|
103
116
|
export type {
|
package/src/mcp.ts
CHANGED
|
@@ -46,6 +46,7 @@ import type { FieldMappings } from "./mappings.ts";
|
|
|
46
46
|
import { formatPatchPlanRun, patchPlanToMarkdown } from "./format.ts";
|
|
47
47
|
import { builtinAuditRules } from "./rules.ts";
|
|
48
48
|
import { sampleSnapshot } from "./sampleData.ts";
|
|
49
|
+
import { parseCall } from "./calls.ts";
|
|
49
50
|
import { suggestValues } from "./suggest.ts";
|
|
50
51
|
import type { CanonicalGtmSnapshot, GtmConnector, PatchPlan } from "./types.ts";
|
|
51
52
|
|
|
@@ -188,6 +189,31 @@ export async function startMcpServer() {
|
|
|
188
189
|
},
|
|
189
190
|
);
|
|
190
191
|
|
|
192
|
+
server.registerTool(
|
|
193
|
+
"fullstackgtm_call_parse",
|
|
194
|
+
{
|
|
195
|
+
title: "Parse Call Transcript",
|
|
196
|
+
description:
|
|
197
|
+
"Deterministically parse a call transcript (Speaker:/[Speaker]: lines or Granola " +
|
|
198
|
+
"utterance JSON) into canonical segments, keyword-derived insights (next steps, " +
|
|
199
|
+
"objections, pricing, risks, competitor mentions...), and GtmEvidence records. " +
|
|
200
|
+
"Read-only and LLM-free; pair with fullstackgtm_audit/apply for governed writes.",
|
|
201
|
+
inputSchema: {
|
|
202
|
+
transcript: z.string().optional(),
|
|
203
|
+
transcriptPath: z.string().optional(),
|
|
204
|
+
title: z.string().optional(),
|
|
205
|
+
source: z.enum(["gong", "chorus", "fathom", "manual", "csv", "unknown"]).optional(),
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
async ({ transcript, transcriptPath, title, source }) => {
|
|
209
|
+
const raw =
|
|
210
|
+
transcript ??
|
|
211
|
+
(transcriptPath ? readFileSync(resolve(process.cwd(), transcriptPath), "utf8") : null);
|
|
212
|
+
if (!raw) throw new Error("Provide transcript (text) or transcriptPath (file).");
|
|
213
|
+
return content(parseCall(raw, { title, sourceSystem: source }));
|
|
214
|
+
},
|
|
215
|
+
);
|
|
216
|
+
|
|
191
217
|
server.registerTool(
|
|
192
218
|
"fullstackgtm_rules",
|
|
193
219
|
{
|