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
package/src/market.ts CHANGED
@@ -4,6 +4,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from
4
4
  import { isIP } from "node:net";
5
5
  import { join } from "node:path";
6
6
  import { credentialsDir } from "./credentials.ts";
7
+ import { MARKET_CAPTURE_STAGES, nullProgressEmitter, type ProgressEmitter } from "./progress.ts";
7
8
  import type { GtmEvidence } from "./types.ts";
8
9
 
9
10
  /**
@@ -445,12 +446,24 @@ const defaultFetchPage: FetchPage = async (url) => {
445
446
  };
446
447
 
447
448
  export type CaptureOptions = {
448
- /** Directory for captures; defaults to <marketHome>/captures. */
449
+ /** Directory for captures; defaults to <marketHome>/captures. Ignored when `store` is given. */
449
450
  dir?: string;
450
451
  runLabel?: string;
451
452
  /** Injectable for tests; defaults to global fetch. */
452
453
  fetchPage?: FetchPage;
453
454
  now?: () => Date;
455
+ /**
456
+ * Storage seam (see MarketStore below). Defaults to the profile-home file
457
+ * store; the hosted app passes a Convex-backed store. Same engine, same
458
+ * evidence chain, different persistence.
459
+ */
460
+ store?: MarketStore;
461
+ /**
462
+ * Progress emission over MARKET_CAPTURE_STAGES ("sources" → "capture" →
463
+ * "persist" here; "classify" belongs to classifyMarket). Presentation-only:
464
+ * a throwing listener never fails the capture.
465
+ */
466
+ progress?: ProgressEmitter;
454
467
  };
455
468
 
456
469
  export type CaptureResult = {
@@ -459,57 +472,55 @@ export type CaptureResult = {
459
472
  };
460
473
 
461
474
  export async function captureMarket(config: MarketConfig, options: CaptureOptions = {}): Promise<CaptureResult> {
462
- const dir = options.dir ?? join(marketHome(config.category), "captures");
475
+ const store = options.store ?? createFileMarketStore(config.category, { capturesDir: options.dir });
476
+ const progress = options.progress ?? nullProgressEmitter();
463
477
  const runLabel = options.runLabel ?? "run-1";
464
478
  const fetchPage = options.fetchPage ?? defaultFetchPage;
465
479
  const fetchedAt = (options.now ?? (() => new Date()))().toISOString();
466
- mkdirSync(dir, { recursive: true });
467
480
 
468
- const manifestPath = join(dir, "manifest.json");
469
- const manifest: CaptureEntry[] = existsSync(manifestPath)
470
- ? (JSON.parse(readFileSync(manifestPath, "utf8")) as CaptureEntry[])
471
- : [];
481
+ progress.stage(MARKET_CAPTURE_STAGES[0], 0, MARKET_CAPTURE_STAGES.length);
482
+ const targets: Array<{ vendorId: string; kind: CaptureEntry["kind"]; url: string }> = [];
483
+ for (const vendor of config.vendors) {
484
+ targets.push({ vendorId: vendor.id, kind: "home", url: vendor.urls.home });
485
+ if (vendor.urls.pricing) targets.push({ vendorId: vendor.id, kind: "pricing", url: vendor.urls.pricing });
486
+ for (const url of vendor.urls.product) targets.push({ vendorId: vendor.id, kind: "product", url });
487
+ }
488
+ progress.note(`${config.vendors.length} vendor(s), ${targets.length} page(s)`);
472
489
 
490
+ progress.stage(MARKET_CAPTURE_STAGES[1], 1, MARKET_CAPTURE_STAGES.length);
473
491
  const entries: CaptureEntry[] = [];
474
- for (const vendor of config.vendors) {
475
- const targets: Array<{ kind: CaptureEntry["kind"]; url: string }> = [
476
- { kind: "home", url: vendor.urls.home },
477
- ];
478
- if (vendor.urls.pricing) targets.push({ kind: "pricing", url: vendor.urls.pricing });
479
- for (const url of vendor.urls.product) targets.push({ kind: "product", url });
480
-
481
- for (const target of targets) {
482
- let status: number | null = null;
483
- let text = "";
484
- try {
485
- const page = await fetchPage(target.url);
486
- status = page.status;
487
- if (page.status === 200) text = extractReadableText(page.body);
488
- } catch {
489
- status = null;
490
- }
491
- let captureHash: string | null = null;
492
- if (text) {
493
- captureHash = createHash("sha256").update(text).digest("hex");
494
- // Content-addressed: an unchanged page dedupes to the same file.
495
- writeFileSync(join(dir, `${captureHash}.txt`), text);
496
- }
497
- const entry: CaptureEntry = {
498
- runLabel,
499
- vendorId: vendor.id,
500
- kind: target.kind,
501
- url: target.url,
502
- fetchedAt,
503
- httpStatus: status,
504
- captureHash,
505
- textChars: text.length,
506
- };
507
- manifest.push(entry);
508
- entries.push(entry);
492
+ for (const target of targets) {
493
+ let status: number | null = null;
494
+ let text = "";
495
+ try {
496
+ const page = await fetchPage(target.url);
497
+ status = page.status;
498
+ if (page.status === 200) text = extractReadableText(page.body);
499
+ } catch {
500
+ status = null;
509
501
  }
502
+ let captureHash: string | null = null;
503
+ if (text) {
504
+ captureHash = createHash("sha256").update(text).digest("hex");
505
+ // Content-addressed: an unchanged page dedupes to the same key.
506
+ await store.saveCaptureText(captureHash, text);
507
+ }
508
+ entries.push({
509
+ runLabel,
510
+ vendorId: target.vendorId,
511
+ kind: target.kind,
512
+ url: target.url,
513
+ fetchedAt,
514
+ httpStatus: status,
515
+ captureHash,
516
+ textChars: text.length,
517
+ });
518
+ progress.items(entries.length, targets.length);
510
519
  }
511
- writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
512
- return { entries, manifestPath };
520
+ progress.stage(MARKET_CAPTURE_STAGES[3], 3, MARKET_CAPTURE_STAGES.length);
521
+ await store.appendCaptureEntries(entries);
522
+ progress.flush();
523
+ return { entries, manifestPath: store.captureLocation() };
513
524
  }
514
525
 
515
526
  // ---------------------------------------------------------------------------
@@ -651,6 +662,108 @@ export function loadCaptureTexts(
651
662
  return { entries, textByHash };
652
663
  }
653
664
 
665
+ // ---------------------------------------------------------------------------
666
+ // MarketStore — the storage seam for the whole market workspace (captures +
667
+ // observation runs), mirroring the PlanStore precedent: the profile-home file
668
+ // layout and the hosted app's Convex tables are two implementations of the
669
+ // same contract. Engines never touch storage directly — captureMarket and
670
+ // classifyMarket take a store — and the default file store preserves the
671
+ // on-disk layout exactly, so the CLI's behavior is unchanged.
672
+ //
673
+ // loadConfig is deliberately NOT part of the store: the config is a reviewed
674
+ // input (a versioned file, or a hosted map document) that callers load and
675
+ // hand to the engines. The store owns only what the engines write.
676
+
677
+ export interface MarketStore {
678
+ /** Operator-facing location of the capture manifest (file path or logical label). */
679
+ captureLocation(): string;
680
+ /** Persist one page's extracted text under its content hash (idempotent). */
681
+ saveCaptureText(captureHash: string, text: string): Promise<void>;
682
+ /** Append one capture pass's manifest entries (append-only; never rewrites history). */
683
+ appendCaptureEntries(entries: CaptureEntry[]): Promise<void>;
684
+ /** Full manifest + resolvable texts — the evidence-verification input. */
685
+ loadCaptureTexts(): Promise<{ entries: CaptureEntry[]; textByHash: Map<string, string> }>;
686
+ /** Append-only observation runs (the same ObservationStore contract as before). */
687
+ observations: ObservationStore;
688
+ }
689
+
690
+ /** The CLI's store: captures + observations under the profile market home. */
691
+ export function createFileMarketStore(
692
+ category: string,
693
+ options: { capturesDir?: string; observationsDir?: string } = {},
694
+ ): MarketStore {
695
+ const dir = options.capturesDir ?? join(marketHome(category), "captures");
696
+ const manifestPath = join(dir, "manifest.json");
697
+ return {
698
+ captureLocation: () => manifestPath,
699
+ async saveCaptureText(captureHash, text) {
700
+ mkdirSync(dir, { recursive: true });
701
+ writeFileSync(join(dir, `${captureHash}.txt`), text);
702
+ },
703
+ async appendCaptureEntries(entries) {
704
+ mkdirSync(dir, { recursive: true });
705
+ const manifest: CaptureEntry[] = existsSync(manifestPath)
706
+ ? (JSON.parse(readFileSync(manifestPath, "utf8")) as CaptureEntry[])
707
+ : [];
708
+ manifest.push(...entries);
709
+ writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
710
+ },
711
+ async loadCaptureTexts() {
712
+ return loadCaptureTexts(category, dir);
713
+ },
714
+ observations: createFileObservationStore(category, options.observationsDir),
715
+ };
716
+ }
717
+
718
+ /**
719
+ * In-memory store: seam tests, and throwaway grounding captures (e.g. the
720
+ * taxonomy proposer's bootstrap pass) that should never persist anywhere.
721
+ */
722
+ export function createMemoryMarketStore(category: string): MarketStore {
723
+ const entries: CaptureEntry[] = [];
724
+ const textByHash = new Map<string, string>();
725
+ const sets = new Map<string, ObservationSet>();
726
+ const sorted = () => [...sets.values()].sort((a, b) => a.runAt.localeCompare(b.runAt));
727
+ return {
728
+ captureLocation: () => `memory://${category}/captures`,
729
+ async saveCaptureText(captureHash, text) {
730
+ textByHash.set(captureHash, text);
731
+ },
732
+ async appendCaptureEntries(newEntries) {
733
+ entries.push(...newEntries);
734
+ },
735
+ async loadCaptureTexts() {
736
+ return { entries: [...entries], textByHash: new Map(textByHash) };
737
+ },
738
+ observations: {
739
+ async append(set) {
740
+ if (set.category !== category) {
741
+ throw new Error(`Observation set category "${set.category}" does not match store "${category}"`);
742
+ }
743
+ if (sets.has(set.runLabel)) {
744
+ throw new Error(`Run "${set.runLabel}" already exists — observations are append-only; use a new run label`);
745
+ }
746
+ sets.set(set.runLabel, set);
747
+ return set;
748
+ },
749
+ async get(runLabel) {
750
+ return sets.get(runLabel) ?? null;
751
+ },
752
+ async list() {
753
+ return sorted().map((set) => ({
754
+ runLabel: set.runLabel,
755
+ runAt: set.runAt,
756
+ observations: set.observations.length,
757
+ }));
758
+ },
759
+ async latest() {
760
+ const all = sorted();
761
+ return all.length ? all[all.length - 1] : null;
762
+ },
763
+ },
764
+ };
765
+ }
766
+
654
767
  /**
655
768
  * Whitespace-only normalization for span matching, plus one extraction
656
769
  * artifact: the HTML-to-text step can emit a line break before punctuation
@@ -7,9 +7,11 @@ import {
7
7
  type MarketClaim,
8
8
  type MarketConfig,
9
9
  type MarketObservation,
10
+ type MarketStore,
10
11
  type ObservationSet,
11
12
  type SpanVerificationFailure,
12
13
  } from "./market.ts";
14
+ import { MARKET_CAPTURE_STAGES, nullProgressEmitter, type ProgressEmitter } from "./progress.ts";
13
15
 
14
16
  /**
15
17
  * LLM intensity classification for the market map — the same
@@ -112,7 +114,16 @@ export type ClassifyMarketOptions = {
112
114
  vendors?: string[];
113
115
  /** Captures directory override (tests); defaults to the profile market home. */
114
116
  capturesDir?: string;
117
+ /** Storage seam: when given, captures are read through it instead of the file layout. */
118
+ store?: MarketStore;
115
119
  now?: () => Date;
120
+ /** Per-vendor progress (presentation only — a throwing callback never fails the run). */
121
+ onVendor?: (done: number, total: number, vendorId: string) => void;
122
+ /**
123
+ * Progress emission over MARKET_CAPTURE_STAGES (the "classify" stage, items
124
+ * per vendor). Presentation-only: a throwing listener never fails the run.
125
+ */
126
+ progress?: ProgressEmitter;
116
127
  };
117
128
 
118
129
  export type ClassifyMarketResult = {
@@ -127,7 +138,10 @@ export async function classifyMarket(
127
138
  options: ClassifyMarketOptions,
128
139
  ): Promise<ClassifyMarketResult> {
129
140
  const model = options.llm.model ?? DEFAULT_MODELS[options.llm.provider];
130
- const { entries, textByHash } = loadCaptureTexts(config.category, options.capturesDir);
141
+ const progress = options.progress ?? nullProgressEmitter();
142
+ const { entries, textByHash } = options.store
143
+ ? await options.store.loadCaptureTexts()
144
+ : loadCaptureTexts(config.category, options.capturesDir);
131
145
  if (entries.length === 0) {
132
146
  throw new Error(`No captures for ${config.category} — run \`market capture\` first`);
133
147
  }
@@ -143,7 +157,14 @@ export async function classifyMarket(
143
157
  const observations: MarketObservation[] = [];
144
158
  const retriedVendorIds: string[] = [];
145
159
 
146
- for (const vendorId of vendorIds) {
160
+ progress.stage(MARKET_CAPTURE_STAGES[2], 2, MARKET_CAPTURE_STAGES.length);
161
+ for (const [vendorIndex, vendorId] of vendorIds.entries()) {
162
+ try {
163
+ options.onVendor?.(vendorIndex, vendorIds.length, vendorId);
164
+ } catch {
165
+ // progress is presentation-only
166
+ }
167
+ progress.note(vendorId);
147
168
  const vendor = config.vendors.find((candidate) => candidate.id === vendorId);
148
169
  if (!vendor) throw new Error(`Unknown vendor "${vendorId}"`);
149
170
  const vendorEntries = runEntries.filter((entry) => entry.vendorId === vendorId);
@@ -167,6 +188,7 @@ export async function classifyMarket(
167
188
  evidence: [],
168
189
  });
169
190
  }
191
+ progress.items(vendorIndex + 1, vendorIds.length);
170
192
  continue;
171
193
  }
172
194
 
@@ -222,7 +244,9 @@ export async function classifyMarket(
222
244
  );
223
245
  }
224
246
  for (const reading of outcome.readings) observations.push(toObservation(reading, vendorId));
247
+ progress.items(vendorIndex + 1, vendorIds.length);
225
248
  }
249
+ progress.flush();
226
250
 
227
251
  return {
228
252
  set: {
@@ -9,6 +9,7 @@ import {
9
9
  loadCaptureTexts,
10
10
  type MarketClaim,
11
11
  type MarketConfig,
12
+ type MarketStore,
12
13
  type MarketVendor,
13
14
  } from "./market.ts";
14
15
 
@@ -44,6 +45,11 @@ export type SuggestTaxonomyOptions = {
44
45
  /** Test injectables. */
45
46
  fetchPage?: FetchPage;
46
47
  capturesDir?: string;
48
+ /**
49
+ * Storage seam for the bootstrap captures; defaults to the file layout.
50
+ * Pass createMemoryMarketStore for throwaway grounding (hosted flow).
51
+ */
52
+ store?: MarketStore;
47
53
  now?: () => Date;
48
54
  };
49
55
 
@@ -227,9 +233,11 @@ export async function suggestMarketConfig(options: SuggestTaxonomyOptions): Prom
227
233
  // fetched (the SSRF guard in captureMarket applies to these user-supplied URLs).
228
234
  await captureMarket(
229
235
  { category, vendors, claims: [] },
230
- { dir: options.capturesDir, runLabel: "bootstrap", fetchPage: options.fetchPage, now: options.now },
236
+ { dir: options.capturesDir, store: options.store, runLabel: "bootstrap", fetchPage: options.fetchPage, now: options.now },
231
237
  );
232
- const capture = loadCaptureTexts(category, options.capturesDir);
238
+ const capture = options.store
239
+ ? await options.store.loadCaptureTexts()
240
+ : loadCaptureTexts(category, options.capturesDir);
233
241
  const { dossier, unreadable } = buildDossier(vendors, capture, perVendorChars);
234
242
  if (!dossier.trim()) {
235
243
  throw new Error(
package/src/mcp-bin.ts CHANGED
@@ -1,6 +1,38 @@
1
1
  #!/usr/bin/env node
2
+ const args = process.argv.slice(2);
3
+
4
+ if (args.includes("--help") || args.includes("-h")) {
5
+ console.log(`Usage: fullstackgtm-mcp [--help] [--version]
6
+
7
+ Starts the fullstackgtm MCP stdio server.
8
+
9
+ The MCP server requires optional peer dependencies:
10
+ @modelcontextprotocol/sdk
11
+ zod
12
+
13
+ Zero-install with peers:
14
+ npx -y -p fullstackgtm -p @modelcontextprotocol/sdk -p zod fullstackgtm-mcp`);
15
+ process.exit(0);
16
+ }
17
+
18
+ if (args.includes("--version") || args.includes("-v")) {
19
+ console.log(await readPackageVersion());
20
+ process.exit(0);
21
+ }
22
+
2
23
  export {};
3
24
 
25
+ async function readPackageVersion(): Promise<string> {
26
+ try {
27
+ const { readFileSync } = await import("node:fs");
28
+ const raw = readFileSync(new URL("../package.json", import.meta.url), "utf8");
29
+ const parsed = JSON.parse(raw) as { version?: string };
30
+ return parsed.version ?? "unknown";
31
+ } catch {
32
+ return "unknown";
33
+ }
34
+ }
35
+
4
36
  // The MCP server needs the optional peer dependencies. Import dynamically so
5
37
  // a missing peer produces install guidance instead of a module-load stack
6
38
  // trace — `npx fullstackgtm-mcp` alone never installs optional peers.
@@ -9,8 +41,8 @@ const MISSING_PEER_HELP = `The MCP server needs the optional peer dependencies @
9
41
  In a project:
10
42
  npm install fullstackgtm @modelcontextprotocol/sdk zod
11
43
 
12
- Zero-install:
13
- npx -p fullstackgtm -p @modelcontextprotocol/sdk -p zod fullstackgtm-mcp`;
44
+ Zero-install (the fullstackgtm-mcp wrapper package bundles the peers):
45
+ npx -y fullstackgtm-mcp`;
14
46
 
15
47
  function isMissingPeerError(error: unknown): boolean {
16
48
  if (!(error instanceof Error)) return false;