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.
- package/CHANGELOG.md +293 -1
- package/INSTALL_FOR_AGENTS.md +13 -11
- package/README.md +45 -24
- package/dist/audit.d.ts +3 -1
- package/dist/audit.js +29 -2
- package/dist/backfill.d.ts +86 -0
- package/dist/backfill.js +251 -0
- package/dist/bin.js +4 -1
- package/dist/cli/audit.d.ts +15 -0
- package/dist/cli/audit.js +392 -0
- package/dist/cli/auth.d.ts +82 -0
- package/dist/cli/auth.js +607 -0
- package/dist/cli/backfill.d.ts +1 -0
- package/dist/cli/backfill.js +125 -0
- package/dist/cli/backfillRuns.d.ts +1 -0
- package/dist/cli/backfillRuns.js +187 -0
- package/dist/cli/call.d.ts +1 -0
- package/dist/cli/call.js +387 -0
- package/dist/cli/capabilities.d.ts +30 -0
- package/dist/cli/capabilities.js +197 -0
- package/dist/cli/draft.d.ts +7 -0
- package/dist/cli/draft.js +87 -0
- package/dist/cli/enrich.d.ts +8 -0
- package/dist/cli/enrich.js +806 -0
- package/dist/cli/fix.d.ts +33 -0
- package/dist/cli/fix.js +346 -0
- package/dist/cli/help.d.ts +25 -0
- package/dist/cli/help.js +646 -0
- package/dist/cli/icp.d.ts +7 -0
- package/dist/cli/icp.js +229 -0
- package/dist/cli/init.d.ts +7 -0
- package/dist/cli/init.js +58 -0
- package/dist/cli/market.d.ts +1 -0
- package/dist/cli/market.js +391 -0
- package/dist/cli/plans.d.ts +5 -0
- package/dist/cli/plans.js +456 -0
- package/dist/cli/schedule.d.ts +8 -0
- package/dist/cli/schedule.js +479 -0
- package/dist/cli/shared.d.ts +71 -0
- package/dist/cli/shared.js +342 -0
- package/dist/cli/signals.d.ts +7 -0
- package/dist/cli/signals.js +412 -0
- package/dist/cli/suggest.d.ts +49 -0
- package/dist/cli/suggest.js +135 -0
- package/dist/cli/tam.d.ts +9 -0
- package/dist/cli/tam.js +387 -0
- package/dist/cli/ui.d.ts +142 -0
- package/dist/cli/ui.js +427 -0
- package/dist/cli.d.ts +1 -57
- package/dist/cli.js +123 -5157
- package/dist/connector.d.ts +23 -0
- package/dist/connector.js +47 -0
- package/dist/connectors/hubspot.d.ts +10 -1
- package/dist/connectors/hubspot.js +244 -10
- package/dist/connectors/hubspotAuth.js +5 -1
- package/dist/connectors/linkedin.js +14 -14
- package/dist/connectors/salesforce.d.ts +10 -1
- package/dist/connectors/salesforce.js +39 -6
- package/dist/connectors/signalSources.js +7 -59
- package/dist/connectors/stripe.d.ts +37 -0
- package/dist/connectors/stripe.js +103 -31
- package/dist/enrich.d.ts +7 -0
- package/dist/enrich.js +7 -0
- package/dist/health.d.ts +11 -69
- package/dist/health.js +4 -134
- package/dist/healthScore.d.ts +71 -0
- package/dist/healthScore.js +143 -0
- package/dist/icp.d.ts +15 -11
- package/dist/icp.js +19 -36
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/judge.d.ts +2 -0
- package/dist/judge.js +6 -0
- package/dist/llm.d.ts +29 -0
- package/dist/llm.js +206 -0
- package/dist/market.d.ts +39 -1
- package/dist/market.js +116 -44
- package/dist/marketClassify.d.ts +11 -1
- package/dist/marketClassify.js +17 -2
- package/dist/marketTaxonomy.d.ts +6 -1
- package/dist/marketTaxonomy.js +4 -2
- package/dist/mcp-bin.js +31 -2
- package/dist/mcp.js +372 -166
- package/dist/progress.d.ts +96 -0
- package/dist/progress.js +142 -0
- package/dist/runReport.d.ts +24 -0
- package/dist/runReport.js +139 -4
- package/dist/schedule.d.ts +80 -2
- package/dist/schedule.js +254 -1
- package/dist/spoolFiles.d.ts +44 -0
- package/dist/spoolFiles.js +114 -0
- package/dist/types.d.ts +29 -1
- package/docs/api.md +75 -8
- package/docs/architecture.md +2 -0
- package/docs/linkedin-connector-spec.md +1 -1
- package/docs/signal-spool-format.md +13 -0
- package/llms.txt +18 -9
- package/package.json +10 -3
- package/skills/fullstackgtm/SKILL.md +2 -1
- package/src/audit.ts +27 -1
- package/src/backfill.ts +340 -0
- package/src/bin.ts +5 -1
- package/src/cli/audit.ts +447 -0
- package/src/cli/auth.ts +669 -0
- package/src/cli/backfill.ts +156 -0
- package/src/cli/backfillRuns.ts +198 -0
- package/src/cli/call.ts +414 -0
- package/src/cli/capabilities.ts +215 -0
- package/src/cli/draft.ts +101 -0
- package/src/cli/enrich.ts +908 -0
- package/src/cli/fix.ts +373 -0
- package/src/cli/help.ts +702 -0
- package/src/cli/icp.ts +265 -0
- package/src/cli/init.ts +65 -0
- package/src/cli/market.ts +423 -0
- package/src/cli/plans.ts +524 -0
- package/src/cli/schedule.ts +526 -0
- package/src/cli/shared.ts +392 -0
- package/src/cli/signals.ts +434 -0
- package/src/cli/suggest.ts +151 -0
- package/src/cli/tam.ts +435 -0
- package/src/cli/ui.ts +497 -0
- package/src/cli.ts +122 -5855
- package/src/connector.ts +66 -0
- package/src/connectors/hubspot.ts +273 -9
- package/src/connectors/hubspotAuth.ts +5 -1
- package/src/connectors/linkedin.ts +14 -14
- package/src/connectors/salesforce.ts +51 -3
- package/src/connectors/signalSources.ts +7 -56
- package/src/connectors/stripe.ts +154 -34
- package/src/enrich.ts +13 -0
- package/src/health.ts +14 -213
- package/src/healthScore.ts +223 -0
- package/src/icp.ts +19 -35
- package/src/index.ts +28 -1
- package/src/judge.ts +7 -0
- package/src/llm.ts +239 -0
- package/src/market.ts +157 -44
- package/src/marketClassify.ts +26 -2
- package/src/marketTaxonomy.ts +10 -2
- package/src/mcp-bin.ts +34 -2
- package/src/mcp.ts +270 -63
- package/src/progress.ts +197 -0
- package/src/runReport.ts +159 -4
- package/src/schedule.ts +310 -3
- package/src/spoolFiles.ts +116 -0
- package/src/types.ts +32 -2
- package/docs/dx-punch-list.md +0 -87
- 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
|
|
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
|
-
|
|
469
|
-
const
|
|
470
|
-
|
|
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
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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
|
-
|
|
512
|
-
|
|
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
|
package/src/marketClassify.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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: {
|
package/src/marketTaxonomy.ts
CHANGED
|
@@ -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 =
|
|
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 -
|
|
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;
|