fullstackgtm 0.44.0 → 0.45.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 +185 -1
- package/README.md +19 -7
- package/dist/audit.d.ts +3 -1
- package/dist/audit.js +29 -2
- package/dist/cli/audit.d.ts +15 -0
- package/dist/cli/audit.js +392 -0
- package/dist/cli/auth.d.ts +80 -0
- package/dist/cli/auth.js +500 -0
- package/dist/cli/call.d.ts +1 -0
- package/dist/cli/call.js +373 -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 +788 -0
- package/dist/cli/fix.d.ts +33 -0
- package/dist/cli/fix.js +344 -0
- package/dist/cli/help.d.ts +25 -0
- package/dist/cli/help.js +609 -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 +454 -0
- package/dist/cli/schedule.d.ts +8 -0
- package/dist/cli/schedule.js +479 -0
- package/dist/cli/shared.d.ts +70 -0
- package/dist/cli/shared.js +331 -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 +121 -0
- package/dist/cli/ui.js +375 -0
- package/dist/cli.d.ts +1 -57
- package/dist/cli.js +100 -5130
- package/dist/connector.d.ts +15 -0
- package/dist/connector.js +35 -0
- package/dist/connectors/hubspot.d.ts +3 -1
- package/dist/connectors/hubspot.js +10 -3
- package/dist/connectors/salesforce.d.ts +3 -1
- package/dist/connectors/salesforce.js +12 -5
- package/dist/connectors/signalSources.js +7 -59
- package/dist/icp.d.ts +15 -11
- package/dist/icp.js +19 -36
- package/dist/judge.d.ts +2 -0
- package/dist/judge.js +6 -0
- package/dist/marketClassify.d.ts +2 -0
- package/dist/marketClassify.js +7 -1
- package/dist/mcp-bin.js +2 -2
- package/dist/mcp.js +259 -166
- 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 +11 -0
- package/docs/api.md +73 -7
- package/docs/signal-spool-format.md +13 -0
- package/llms.txt +15 -6
- package/package.json +1 -1
- package/skills/fullstackgtm/SKILL.md +1 -1
- package/src/audit.ts +27 -1
- package/src/cli/audit.ts +447 -0
- package/src/cli/auth.ts +549 -0
- package/src/cli/call.ts +398 -0
- package/src/cli/capabilities.ts +215 -0
- package/src/cli/draft.ts +101 -0
- package/src/cli/enrich.ts +885 -0
- package/src/cli/fix.ts +372 -0
- package/src/cli/help.ts +664 -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 +523 -0
- package/src/cli/schedule.ts +526 -0
- package/src/cli/shared.ts +375 -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 +426 -0
- package/src/cli.ts +99 -5829
- package/src/connector.ts +46 -0
- package/src/connectors/hubspot.ts +14 -2
- package/src/connectors/salesforce.ts +18 -2
- package/src/connectors/signalSources.ts +7 -56
- package/src/icp.ts +19 -35
- package/src/judge.ts +7 -0
- package/src/marketClassify.ts +8 -1
- package/src/mcp-bin.ts +2 -2
- package/src/mcp.ts +130 -57
- package/src/schedule.ts +310 -3
- package/src/spoolFiles.ts +116 -0
- package/src/types.ts +12 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared reader for the spool container convention (docs/signal-spool-format.md):
|
|
3
|
+
* newline-delimited JSON — one object per line, append-only — with a JSON array
|
|
4
|
+
* accepted in a `.json` file for hand-staged convenience, and a DIRECTORY
|
|
5
|
+
* meaning "every `*.jsonl` / `*.json` file in it, name-sorted" so multiple
|
|
6
|
+
* receivers can each append their own file.
|
|
7
|
+
*
|
|
8
|
+
* The container is the convention; the row SCHEMA stays with each caller:
|
|
9
|
+
* `signals fetch --from` validates staged signal rows, `enrich ingest` stages
|
|
10
|
+
* enrichment rows, `market observe --from` validates observation-set envelopes.
|
|
11
|
+
* This module only parses objects out of files — it never interprets them.
|
|
12
|
+
*
|
|
13
|
+
* Extracted from the `file` signal-source connector (the Phase-2 webhook
|
|
14
|
+
* landing-zone reader), which now delegates here; error-message text is
|
|
15
|
+
* parameterized by `label` so existing connector errors are unchanged.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
|
|
21
|
+
/** Spool files in a landing-zone directory: `*.jsonl` / `*.json`, name-sorted. */
|
|
22
|
+
export function spoolFilesIn(dir: string): string[] {
|
|
23
|
+
let names: string[];
|
|
24
|
+
try {
|
|
25
|
+
names = readdirSync(dir);
|
|
26
|
+
} catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
return names
|
|
30
|
+
.filter((name) => name.endsWith(".jsonl") || name.endsWith(".json"))
|
|
31
|
+
.sort()
|
|
32
|
+
.map((name) => join(dir, name));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Parse a JSON-array spool file into rows. `label` prefixes error messages. */
|
|
36
|
+
export function parseSpoolArray(raw: string, path: string, label: string): Record<string, unknown>[] {
|
|
37
|
+
let parsed: unknown;
|
|
38
|
+
try {
|
|
39
|
+
parsed = JSON.parse(raw);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
throw new Error(`${label} ${path}: not valid JSON (${error instanceof Error ? error.message : String(error)}).`);
|
|
42
|
+
}
|
|
43
|
+
if (!Array.isArray(parsed)) throw new Error(`${label} ${path}: expected a JSON array of staged signal rows.`);
|
|
44
|
+
return parsed.map((entry, index) => {
|
|
45
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
46
|
+
throw new Error(`${label} ${path}: row ${index} is not an object.`);
|
|
47
|
+
}
|
|
48
|
+
return entry as Record<string, unknown>;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Parse a JSONL spool file into rows. `label` prefixes error messages. */
|
|
53
|
+
export function parseSpoolJsonl(raw: string, path: string, label: string): Record<string, unknown>[] {
|
|
54
|
+
const out: Record<string, unknown>[] = [];
|
|
55
|
+
const lines = raw.split("\n");
|
|
56
|
+
lines.forEach((line, index) => {
|
|
57
|
+
const t = line.trim();
|
|
58
|
+
if (!t) return;
|
|
59
|
+
let parsed: unknown;
|
|
60
|
+
try {
|
|
61
|
+
parsed = JSON.parse(t);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
throw new Error(`${label} ${path}: line ${index} is not valid JSON (${error instanceof Error ? error.message : String(error)}).`);
|
|
64
|
+
}
|
|
65
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
66
|
+
throw new Error(`${label} ${path}: line ${index} is not a JSON object.`);
|
|
67
|
+
}
|
|
68
|
+
out.push(parsed as Record<string, unknown>);
|
|
69
|
+
});
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Parse one spool file's text — JSON array if it opens with `[`, else JSONL. */
|
|
74
|
+
export function parseSpoolText(raw: string, path: string, label: string): Record<string, unknown>[] {
|
|
75
|
+
const trimmed = raw.trim();
|
|
76
|
+
if (!trimmed) return [];
|
|
77
|
+
return trimmed.startsWith("[") ? parseSpoolArray(trimmed, path, label) : parseSpoolJsonl(trimmed, path, label);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Should an explicitly named intake path be read with spool semantics?
|
|
82
|
+
* True for a directory (a landing zone) or a `*.jsonl` file. Plain `.json` /
|
|
83
|
+
* `.csv` files keep each verb's original single-file handling, so existing
|
|
84
|
+
* invocations parse exactly as before.
|
|
85
|
+
*/
|
|
86
|
+
export function isSpoolPath(absPath: string): boolean {
|
|
87
|
+
try {
|
|
88
|
+
if (statSync(absPath).isDirectory()) return true;
|
|
89
|
+
} catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
return absPath.endsWith(".jsonl");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A parsed spool row plus where it came from (for error labels). */
|
|
96
|
+
export type SpoolRow = { file: string; index: number; row: Record<string, unknown> };
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Read an explicitly named spool path — a `.jsonl` file or a directory of
|
|
100
|
+
* `*.jsonl` / `*.json` files. Unlike the webhook `file` connector (where a
|
|
101
|
+
* missing spool is an empty source), the user named this path: a missing or
|
|
102
|
+
* unreadable file is an error, and a malformed row throws with file + line.
|
|
103
|
+
*/
|
|
104
|
+
export function readSpoolPath(absPath: string, label: string): SpoolRow[] {
|
|
105
|
+
const isDir = statSync(absPath).isDirectory();
|
|
106
|
+
const files = isDir ? spoolFilesIn(absPath) : [absPath];
|
|
107
|
+
if (isDir && files.length === 0) {
|
|
108
|
+
throw new Error(`${label} ${absPath}: directory contains no *.jsonl / *.json spool files.`);
|
|
109
|
+
}
|
|
110
|
+
const rows: SpoolRow[] = [];
|
|
111
|
+
for (const file of files) {
|
|
112
|
+
const raw = readFileSync(file, "utf8");
|
|
113
|
+
parseSpoolText(raw, file, label).forEach((row, index) => rows.push({ file, index, row }));
|
|
114
|
+
}
|
|
115
|
+
return rows;
|
|
116
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -473,6 +473,18 @@ export type PatchPlanRun = {
|
|
|
473
473
|
results: PatchOperationResult[];
|
|
474
474
|
};
|
|
475
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Per-page progress during a snapshot pull, emitted by connectors that accept
|
|
478
|
+
* an `onProgress` option. `fetched` is the running total for the object type
|
|
479
|
+
* currently streaming (it resets when the pull moves on to the next type).
|
|
480
|
+
* Presentation-only: a throwing callback must never fail a pull, so emitters
|
|
481
|
+
* call it best-effort.
|
|
482
|
+
*/
|
|
483
|
+
export type SnapshotProgress = {
|
|
484
|
+
objectType: "user" | "account" | "contact" | "deal";
|
|
485
|
+
fetched: number;
|
|
486
|
+
};
|
|
487
|
+
|
|
476
488
|
/**
|
|
477
489
|
* The provider contract. Reads produce a canonical snapshot; writes accept a
|
|
478
490
|
* single patch operation and report the outcome. Connectors without
|