fullstackgtm 0.44.0 → 0.46.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 (149) hide show
  1. package/CHANGELOG.md +293 -1
  2. package/INSTALL_FOR_AGENTS.md +13 -11
  3. package/README.md +45 -24
  4. package/dist/audit.d.ts +3 -1
  5. package/dist/audit.js +29 -2
  6. package/dist/backfill.d.ts +86 -0
  7. package/dist/backfill.js +251 -0
  8. package/dist/bin.js +4 -1
  9. package/dist/cli/audit.d.ts +15 -0
  10. package/dist/cli/audit.js +392 -0
  11. package/dist/cli/auth.d.ts +82 -0
  12. package/dist/cli/auth.js +607 -0
  13. package/dist/cli/backfill.d.ts +1 -0
  14. package/dist/cli/backfill.js +125 -0
  15. package/dist/cli/backfillRuns.d.ts +1 -0
  16. package/dist/cli/backfillRuns.js +187 -0
  17. package/dist/cli/call.d.ts +1 -0
  18. package/dist/cli/call.js +387 -0
  19. package/dist/cli/capabilities.d.ts +30 -0
  20. package/dist/cli/capabilities.js +197 -0
  21. package/dist/cli/draft.d.ts +7 -0
  22. package/dist/cli/draft.js +87 -0
  23. package/dist/cli/enrich.d.ts +8 -0
  24. package/dist/cli/enrich.js +806 -0
  25. package/dist/cli/fix.d.ts +33 -0
  26. package/dist/cli/fix.js +346 -0
  27. package/dist/cli/help.d.ts +25 -0
  28. package/dist/cli/help.js +646 -0
  29. package/dist/cli/icp.d.ts +7 -0
  30. package/dist/cli/icp.js +229 -0
  31. package/dist/cli/init.d.ts +7 -0
  32. package/dist/cli/init.js +58 -0
  33. package/dist/cli/market.d.ts +1 -0
  34. package/dist/cli/market.js +391 -0
  35. package/dist/cli/plans.d.ts +5 -0
  36. package/dist/cli/plans.js +456 -0
  37. package/dist/cli/schedule.d.ts +8 -0
  38. package/dist/cli/schedule.js +479 -0
  39. package/dist/cli/shared.d.ts +71 -0
  40. package/dist/cli/shared.js +342 -0
  41. package/dist/cli/signals.d.ts +7 -0
  42. package/dist/cli/signals.js +412 -0
  43. package/dist/cli/suggest.d.ts +49 -0
  44. package/dist/cli/suggest.js +135 -0
  45. package/dist/cli/tam.d.ts +9 -0
  46. package/dist/cli/tam.js +387 -0
  47. package/dist/cli/ui.d.ts +142 -0
  48. package/dist/cli/ui.js +427 -0
  49. package/dist/cli.d.ts +1 -57
  50. package/dist/cli.js +123 -5157
  51. package/dist/connector.d.ts +23 -0
  52. package/dist/connector.js +47 -0
  53. package/dist/connectors/hubspot.d.ts +10 -1
  54. package/dist/connectors/hubspot.js +244 -10
  55. package/dist/connectors/hubspotAuth.js +5 -1
  56. package/dist/connectors/linkedin.js +14 -14
  57. package/dist/connectors/salesforce.d.ts +10 -1
  58. package/dist/connectors/salesforce.js +39 -6
  59. package/dist/connectors/signalSources.js +7 -59
  60. package/dist/connectors/stripe.d.ts +37 -0
  61. package/dist/connectors/stripe.js +103 -31
  62. package/dist/enrich.d.ts +7 -0
  63. package/dist/enrich.js +7 -0
  64. package/dist/health.d.ts +11 -69
  65. package/dist/health.js +4 -134
  66. package/dist/healthScore.d.ts +71 -0
  67. package/dist/healthScore.js +143 -0
  68. package/dist/icp.d.ts +15 -11
  69. package/dist/icp.js +19 -36
  70. package/dist/index.d.ts +3 -1
  71. package/dist/index.js +3 -1
  72. package/dist/judge.d.ts +2 -0
  73. package/dist/judge.js +6 -0
  74. package/dist/llm.d.ts +29 -0
  75. package/dist/llm.js +206 -0
  76. package/dist/market.d.ts +39 -1
  77. package/dist/market.js +116 -44
  78. package/dist/marketClassify.d.ts +11 -1
  79. package/dist/marketClassify.js +17 -2
  80. package/dist/marketTaxonomy.d.ts +6 -1
  81. package/dist/marketTaxonomy.js +4 -2
  82. package/dist/mcp-bin.js +31 -2
  83. package/dist/mcp.js +372 -166
  84. package/dist/progress.d.ts +96 -0
  85. package/dist/progress.js +142 -0
  86. package/dist/runReport.d.ts +24 -0
  87. package/dist/runReport.js +139 -4
  88. package/dist/schedule.d.ts +80 -2
  89. package/dist/schedule.js +254 -1
  90. package/dist/spoolFiles.d.ts +44 -0
  91. package/dist/spoolFiles.js +114 -0
  92. package/dist/types.d.ts +29 -1
  93. package/docs/api.md +75 -8
  94. package/docs/architecture.md +2 -0
  95. package/docs/linkedin-connector-spec.md +1 -1
  96. package/docs/signal-spool-format.md +13 -0
  97. package/llms.txt +18 -9
  98. package/package.json +10 -3
  99. package/skills/fullstackgtm/SKILL.md +2 -1
  100. package/src/audit.ts +27 -1
  101. package/src/backfill.ts +340 -0
  102. package/src/bin.ts +5 -1
  103. package/src/cli/audit.ts +447 -0
  104. package/src/cli/auth.ts +669 -0
  105. package/src/cli/backfill.ts +156 -0
  106. package/src/cli/backfillRuns.ts +198 -0
  107. package/src/cli/call.ts +414 -0
  108. package/src/cli/capabilities.ts +215 -0
  109. package/src/cli/draft.ts +101 -0
  110. package/src/cli/enrich.ts +908 -0
  111. package/src/cli/fix.ts +373 -0
  112. package/src/cli/help.ts +702 -0
  113. package/src/cli/icp.ts +265 -0
  114. package/src/cli/init.ts +65 -0
  115. package/src/cli/market.ts +423 -0
  116. package/src/cli/plans.ts +524 -0
  117. package/src/cli/schedule.ts +526 -0
  118. package/src/cli/shared.ts +392 -0
  119. package/src/cli/signals.ts +434 -0
  120. package/src/cli/suggest.ts +151 -0
  121. package/src/cli/tam.ts +435 -0
  122. package/src/cli/ui.ts +497 -0
  123. package/src/cli.ts +122 -5855
  124. package/src/connector.ts +66 -0
  125. package/src/connectors/hubspot.ts +273 -9
  126. package/src/connectors/hubspotAuth.ts +5 -1
  127. package/src/connectors/linkedin.ts +14 -14
  128. package/src/connectors/salesforce.ts +51 -3
  129. package/src/connectors/signalSources.ts +7 -56
  130. package/src/connectors/stripe.ts +154 -34
  131. package/src/enrich.ts +13 -0
  132. package/src/health.ts +14 -213
  133. package/src/healthScore.ts +223 -0
  134. package/src/icp.ts +19 -35
  135. package/src/index.ts +28 -1
  136. package/src/judge.ts +7 -0
  137. package/src/llm.ts +239 -0
  138. package/src/market.ts +157 -44
  139. package/src/marketClassify.ts +26 -2
  140. package/src/marketTaxonomy.ts +10 -2
  141. package/src/mcp-bin.ts +34 -2
  142. package/src/mcp.ts +270 -63
  143. package/src/progress.ts +197 -0
  144. package/src/runReport.ts +159 -4
  145. package/src/schedule.ts +310 -3
  146. package/src/spoolFiles.ts +116 -0
  147. package/src/types.ts +32 -2
  148. package/docs/dx-punch-list.md +0 -87
  149. package/docs/roadmap-to-1.0.md +0 -211
@@ -0,0 +1,87 @@
1
+ // Extracted verbatim from src/cli.ts (mechanical split, no behavior change).
2
+ import { readFileSync } from "node:fs";
3
+ import { resolve } from "node:path";
4
+ import { createFilePlanStore } from "../planStore.js";
5
+ import { resolveLlmCredential } from "../llm.js";
6
+ import { createFileSignalStore } from "../signals.js";
7
+ import { createFileJudgeStore } from "../judge.js";
8
+ import { authorOpeners, DEFAULT_DRAFT_PROMPT, DRAFT_CHANNELS, draft } from "../draft.js";
9
+ import { numericOption, option, resolveLlmBaseUrls, saveRequested } from "./shared.js";
10
+ /**
11
+ * `draft` — author ONE trigger-grounded opener per hot judge decision as a
12
+ * governed create_task plan. Structurally a proposal: never sends, never writes
13
+ * a CRM record. With --save the plan is staged needs_approval for plans approve
14
+ * -> apply.
15
+ */
16
+ export async function draftCommand(args) {
17
+ // Help-before-network: catch --help/-h BEFORE any config/credential/LLM call.
18
+ if (args.includes("--help") || args.includes("-h")) {
19
+ console.log(`Usage:
20
+ fullstackgtm draft [--from-judge latest|<runLabel>] [--min-score 80] [--prompt <path>] [--channel email|linkedin|task] [--save]
21
+
22
+ Author one trigger-grounded opener per hot judge decision (decision=send,
23
+ score>=min) as a governed create_task plan. The opener's first line must contain
24
+ a verbatim span of the why-now trigger or the draft is rejected. Never sends —
25
+ --save stages a needs_approval plan for \`plans approve\` -> \`apply\`. Without an
26
+ LLM key it emits a clearly-labeled stub rather than fake authored copy.`);
27
+ return;
28
+ }
29
+ const fromJudge = option(args, "--from-judge") ?? "latest";
30
+ const minScore = numericOption(args, "--min-score") ?? 80;
31
+ const promptPath = option(args, "--prompt");
32
+ const channelArg = option(args, "--channel") ?? "task";
33
+ if (!DRAFT_CHANNELS.includes(channelArg)) {
34
+ throw new Error(`--channel must be one of ${DRAFT_CHANNELS.join(", ")} (got "${channelArg}").`);
35
+ }
36
+ const channel = channelArg;
37
+ const save = saveRequested(args);
38
+ // Load the JudgeRun.
39
+ const judgeStore = createFileJudgeStore();
40
+ const judgeRun = fromJudge === "latest" ? await judgeStore.latestRun() : await judgeStore.getRun(fromJudge);
41
+ if (!judgeRun) {
42
+ throw new Error(`No judge run "${fromJudge}" — run \`fullstackgtm icp judge --save\` first.`);
43
+ }
44
+ // Rebuild the signalsById map the openers ground in: from the referenced signal
45
+ // run, falling back to every stored signal.
46
+ const signalStore = createFileSignalStore();
47
+ const signalRun = await signalStore.getRun(judgeRun.signalRunLabel);
48
+ const signals = signalRun ? signalRun.signals : await signalStore.allSignals();
49
+ const signalsById = new Map(signals.map((s) => [s.id, s]));
50
+ // LLM resolution (optional — no-key path is the honestly-degraded stub).
51
+ const cred = resolveLlmCredential();
52
+ const model = option(args, "--model") ?? undefined;
53
+ const llm = cred
54
+ ? { ...cred, ...resolveLlmBaseUrls(), ...(model ? { model } : {}) }
55
+ : undefined;
56
+ const promptTemplate = promptPath ? readFileSync(resolve(process.cwd(), promptPath), "utf8") : DEFAULT_DRAFT_PROMPT;
57
+ const openers = await authorOpeners({
58
+ decisions: judgeRun.decisions,
59
+ signalsById,
60
+ minScore,
61
+ promptTemplate,
62
+ llm,
63
+ });
64
+ const { plan, drafts, rejected } = draft({
65
+ decisions: judgeRun.decisions,
66
+ signalsById,
67
+ minScore,
68
+ channel,
69
+ openers,
70
+ });
71
+ console.log(JSON.stringify({ drafts, rejected }, null, 2));
72
+ const stale = drafts.filter((d) => d.staleTrigger);
73
+ console.error(`${drafts.length} opener(s) staged as create_task proposals (channel ${channel}, min score ${minScore})` +
74
+ `${rejected.length ? `; ${rejected.length} rejected (ungrounded first line)` : ""}` +
75
+ `${stale.length ? `; ${stale.length} flagged staleTrigger` : ""}` +
76
+ `${llm ? "" : " — DETERMINISTIC stub (no LLM key)"}. A draft is a proposal; nothing is sent.`);
77
+ if (save) {
78
+ await createFilePlanStore().save(plan);
79
+ console.error(`Saved plan ${plan.id} (status ${plan.status}). Review: \`fullstackgtm plans show ${plan.id}\`, ` +
80
+ `then \`fullstackgtm plans approve ${plan.id} --operations all\` and either ` +
81
+ `\`fullstackgtm apply --plan-id ${plan.id} --provider <name>\` (log the touch as a CRM task) or ` +
82
+ `\`fullstackgtm apply --plan-id ${plan.id} --channel outbox\` (render to the outbox for a sender — transmits nothing).`);
83
+ }
84
+ else {
85
+ console.error("(not saved — re-run with --save to stage the plan for plans approve -> apply)");
86
+ }
87
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The enrich layer: governed append/refresh of third-party data (Apollo pull,
3
+ * Clay ingest) into the CRM through the normal dry-run → approval → apply
4
+ * contract. State lives in the profile-scoped run store (checkpoint,
5
+ * staleness ledger, observability in one); scheduling belongs to the
6
+ * horizontal scheduler — enrich owns no cron logic.
7
+ */
8
+ export declare function enrichCommand(args: string[]): Promise<void>;