@contractspec/example.product-intent 3.7.17 → 3.7.19
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/.turbo/turbo-build.log +22 -22
- package/CHANGELOG.md +27 -0
- package/dist/docs/index.js +3 -27
- package/dist/docs/product-intent.docblock.js +3 -27
- package/dist/example.js +1 -33
- package/dist/index.js +5 -439
- package/dist/load-evidence.js +5 -313
- package/dist/node/docs/index.js +3 -27
- package/dist/node/docs/product-intent.docblock.js +3 -27
- package/dist/node/example.js +1 -33
- package/dist/node/index.js +5 -439
- package/dist/node/load-evidence.js +5 -313
- package/dist/node/posthog-signals.js +5 -248
- package/dist/node/product-intent.discovery.js +1 -75
- package/dist/node/product-intent.feature.js +1 -19
- package/dist/node/script.js +12 -507
- package/dist/node/sync-actions.js +5 -491
- package/dist/posthog-signals.js +5 -248
- package/dist/product-intent.discovery.js +1 -75
- package/dist/product-intent.feature.js +1 -19
- package/dist/script.js +12 -507
- package/dist/sync-actions.js +5 -491
- package/package.json +10 -10
package/dist/load-evidence.js
CHANGED
|
@@ -1,314 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
async function
|
|
6
|
-
|
|
7
|
-
const range = resolveRange(options.dateRange);
|
|
8
|
-
const eventSummary = await loadEventSummary(options, range);
|
|
9
|
-
if (eventSummary) {
|
|
10
|
-
chunks.push(eventSummary);
|
|
11
|
-
}
|
|
12
|
-
const funnelEvidence = await loadFunnelEvidence(options, range);
|
|
13
|
-
if (funnelEvidence) {
|
|
14
|
-
chunks.push(funnelEvidence);
|
|
15
|
-
}
|
|
16
|
-
const featureFlags = await loadFeatureFlagEvidence(options);
|
|
17
|
-
if (featureFlags) {
|
|
18
|
-
chunks.push(featureFlags);
|
|
19
|
-
}
|
|
20
|
-
return chunks;
|
|
21
|
-
}
|
|
22
|
-
async function loadEventSummary(options, range) {
|
|
23
|
-
if (!options.reader.queryHogQL)
|
|
24
|
-
return null;
|
|
25
|
-
const eventFilter = buildEventFilter(options.eventNames);
|
|
26
|
-
const limit = options.limit ?? 10;
|
|
27
|
-
const result = await options.reader.queryHogQL({
|
|
28
|
-
query: [
|
|
29
|
-
"select",
|
|
30
|
-
" event as eventName,",
|
|
31
|
-
" count() as total",
|
|
32
|
-
"from events",
|
|
33
|
-
"where timestamp >= {dateFrom} and timestamp < {dateTo}",
|
|
34
|
-
eventFilter.clause ? `and ${eventFilter.clause}` : "",
|
|
35
|
-
"group by eventName",
|
|
36
|
-
"order by total desc",
|
|
37
|
-
`limit ${limit}`
|
|
38
|
-
].filter(Boolean).join(`
|
|
39
|
-
`),
|
|
40
|
-
values: {
|
|
41
|
-
dateFrom: range.from.toISOString(),
|
|
42
|
-
dateTo: range.to.toISOString(),
|
|
43
|
-
...eventFilter.values
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
const rows = mapRows(result);
|
|
47
|
-
if (rows.length === 0)
|
|
48
|
-
return null;
|
|
49
|
-
const lines = rows.map((row) => {
|
|
50
|
-
const name = asString(row.eventName) ?? "unknown";
|
|
51
|
-
const total = asNumber(row.total);
|
|
52
|
-
return `- ${name}: ${total}`;
|
|
53
|
-
});
|
|
54
|
-
return {
|
|
55
|
-
chunkId: `posthog:event_summary:${range.from.toISOString()}`,
|
|
56
|
-
text: [
|
|
57
|
-
`PostHog event summary (${range.from.toISOString()} \u2192 ${range.to.toISOString()}):`,
|
|
58
|
-
...lines
|
|
59
|
-
].join(`
|
|
60
|
-
`),
|
|
61
|
-
meta: {
|
|
62
|
-
source: "posthog",
|
|
63
|
-
kind: "event_summary",
|
|
64
|
-
dateFrom: range.from.toISOString(),
|
|
65
|
-
dateTo: range.to.toISOString()
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
async function loadFunnelEvidence(options, range) {
|
|
70
|
-
if (!options.funnel)
|
|
71
|
-
return null;
|
|
72
|
-
if (!options.reader.getEvents)
|
|
73
|
-
return null;
|
|
74
|
-
const events = [];
|
|
75
|
-
const eventNames = options.funnel.steps.map((step) => step.eventName);
|
|
76
|
-
for (const eventName of eventNames) {
|
|
77
|
-
const response = await options.reader.getEvents({
|
|
78
|
-
event: eventName,
|
|
79
|
-
dateRange: {
|
|
80
|
-
from: range.from,
|
|
81
|
-
to: range.to
|
|
82
|
-
},
|
|
83
|
-
limit: options.limit ?? 500
|
|
84
|
-
});
|
|
85
|
-
response.results.forEach((event) => {
|
|
86
|
-
events.push({
|
|
87
|
-
name: event.event,
|
|
88
|
-
userId: event.distinctId,
|
|
89
|
-
tenantId: typeof event.properties?.tenantId === "string" ? event.properties.tenantId : undefined,
|
|
90
|
-
timestamp: event.timestamp,
|
|
91
|
-
properties: event.properties
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
if (events.length === 0)
|
|
96
|
-
return null;
|
|
97
|
-
const analyzer = new FunnelAnalyzer;
|
|
98
|
-
const analysis = analyzer.analyze(events, options.funnel);
|
|
99
|
-
const lines = analysis.steps.map((step) => {
|
|
100
|
-
return `- ${step.step.eventName}: ${step.count} (conversion ${step.conversionRate}, drop-off ${step.dropOffRate})`;
|
|
101
|
-
});
|
|
102
|
-
return {
|
|
103
|
-
chunkId: `posthog:funnel:${options.funnel.name}`,
|
|
104
|
-
text: [`PostHog funnel analysis \u2014 ${options.funnel.name}:`, ...lines].join(`
|
|
105
|
-
`),
|
|
106
|
-
meta: {
|
|
107
|
-
source: "posthog",
|
|
108
|
-
kind: "funnel",
|
|
109
|
-
funnelName: options.funnel.name,
|
|
110
|
-
dateFrom: range.from.toISOString(),
|
|
111
|
-
dateTo: range.to.toISOString()
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
async function loadFeatureFlagEvidence(options) {
|
|
116
|
-
if (!options.includeFeatureFlags)
|
|
117
|
-
return null;
|
|
118
|
-
if (!options.reader.getFeatureFlags)
|
|
119
|
-
return null;
|
|
120
|
-
const response = await options.reader.getFeatureFlags({ limit: 10 });
|
|
121
|
-
if (!response.results.length)
|
|
122
|
-
return null;
|
|
123
|
-
const lines = response.results.map((flag) => {
|
|
124
|
-
const key = flag.key ?? "unknown";
|
|
125
|
-
const active = flag.active ? "active" : "inactive";
|
|
126
|
-
return `- ${key}: ${active}`;
|
|
127
|
-
});
|
|
128
|
-
return {
|
|
129
|
-
chunkId: "posthog:feature_flags",
|
|
130
|
-
text: ["PostHog feature flags:", ...lines].join(`
|
|
131
|
-
`),
|
|
132
|
-
meta: {
|
|
133
|
-
source: "posthog",
|
|
134
|
-
kind: "feature_flags"
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function resolveRange(dateRange) {
|
|
139
|
-
const now = new Date;
|
|
140
|
-
const from = dateRange?.from instanceof Date ? dateRange.from : dateRange?.from ? new Date(dateRange.from) : new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
|
|
141
|
-
const to = dateRange?.to instanceof Date ? dateRange.to : dateRange?.to ? new Date(dateRange.to) : now;
|
|
142
|
-
return { from, to };
|
|
143
|
-
}
|
|
144
|
-
function buildEventFilter(eventNames) {
|
|
145
|
-
if (!eventNames || eventNames.length === 0)
|
|
146
|
-
return {};
|
|
147
|
-
if (eventNames.length === 1) {
|
|
148
|
-
return {
|
|
149
|
-
clause: "event = {event0}",
|
|
150
|
-
values: { event0: eventNames[0] }
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
const values = {};
|
|
154
|
-
const clauses = eventNames.map((eventName, index) => {
|
|
155
|
-
values[`event${index}`] = eventName;
|
|
156
|
-
return `event = {event${index}}`;
|
|
157
|
-
});
|
|
158
|
-
return {
|
|
159
|
-
clause: `(${clauses.join(" or ")})`,
|
|
160
|
-
values
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function mapRows(result) {
|
|
164
|
-
if (!Array.isArray(result.results) || !Array.isArray(result.columns)) {
|
|
165
|
-
return [];
|
|
166
|
-
}
|
|
167
|
-
const columns = result.columns;
|
|
168
|
-
return result.results.flatMap((row) => {
|
|
169
|
-
if (!Array.isArray(row))
|
|
170
|
-
return [];
|
|
171
|
-
const record = {};
|
|
172
|
-
columns.forEach((column, index) => {
|
|
173
|
-
record[column] = row[index];
|
|
174
|
-
});
|
|
175
|
-
return [record];
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
function asString(value) {
|
|
179
|
-
if (typeof value === "string" && value.trim())
|
|
180
|
-
return value;
|
|
181
|
-
if (typeof value === "number")
|
|
182
|
-
return String(value);
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
function asNumber(value) {
|
|
186
|
-
if (typeof value === "number" && Number.isFinite(value))
|
|
187
|
-
return value;
|
|
188
|
-
if (typeof value === "string" && value.trim()) {
|
|
189
|
-
const parsed = Number(value);
|
|
190
|
-
if (Number.isFinite(parsed))
|
|
191
|
-
return parsed;
|
|
192
|
-
}
|
|
193
|
-
return 0;
|
|
194
|
-
}
|
|
195
|
-
function resolvePosthogEvidenceOptionsFromEnv(options = {}) {
|
|
196
|
-
const projectId = process.env.POSTHOG_PROJECT_ID;
|
|
197
|
-
const personalApiKey = process.env.POSTHOG_PERSONAL_API_KEY;
|
|
198
|
-
if (!projectId || !personalApiKey)
|
|
199
|
-
return null;
|
|
200
|
-
const lookbackDays = resolveNumberEnv("POSTHOG_EVIDENCE_LOOKBACK_DAYS", options.defaultLookbackDays ?? 30);
|
|
201
|
-
const limit = resolveNumberEnv("POSTHOG_EVIDENCE_LIMIT", options.defaultLimit ?? 10);
|
|
202
|
-
const now = new Date;
|
|
203
|
-
const from = new Date(now.getTime() - lookbackDays * 24 * 60 * 60 * 1000);
|
|
204
|
-
const eventNames = resolveCsvEnv("POSTHOG_EVIDENCE_EVENTS");
|
|
205
|
-
const funnelSteps = resolveCsvEnv("POSTHOG_EVIDENCE_FUNNEL_STEPS");
|
|
206
|
-
const funnel = funnelSteps && funnelSteps.length ? {
|
|
207
|
-
name: "posthog-evidence-funnel",
|
|
208
|
-
steps: funnelSteps.map((eventName, index) => ({
|
|
209
|
-
id: `step_${index + 1}`,
|
|
210
|
-
eventName
|
|
211
|
-
}))
|
|
212
|
-
} : undefined;
|
|
213
|
-
const reader = new PosthogAnalyticsProvider({
|
|
214
|
-
host: process.env.POSTHOG_HOST,
|
|
215
|
-
projectId,
|
|
216
|
-
personalApiKey
|
|
217
|
-
});
|
|
218
|
-
return {
|
|
219
|
-
reader,
|
|
220
|
-
dateRange: { from, to: now },
|
|
221
|
-
eventNames,
|
|
222
|
-
limit,
|
|
223
|
-
funnel,
|
|
224
|
-
includeFeatureFlags: resolveBooleanEnv("POSTHOG_EVIDENCE_FEATURE_FLAGS", true)
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function resolveCsvEnv(key) {
|
|
228
|
-
const value = process.env[key];
|
|
229
|
-
if (!value)
|
|
230
|
-
return;
|
|
231
|
-
return value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
232
|
-
}
|
|
233
|
-
function resolveNumberEnv(key, fallback) {
|
|
234
|
-
const value = process.env[key];
|
|
235
|
-
if (!value)
|
|
236
|
-
return fallback;
|
|
237
|
-
const parsed = Number(value);
|
|
238
|
-
return Number.isFinite(parsed) ? parsed : fallback;
|
|
239
|
-
}
|
|
240
|
-
function resolveBooleanEnv(key, fallback) {
|
|
241
|
-
const value = process.env[key];
|
|
242
|
-
if (value === undefined)
|
|
243
|
-
return fallback;
|
|
244
|
-
return value.toLowerCase() === "true";
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// src/load-evidence.ts
|
|
248
|
-
import fs from "fs";
|
|
249
|
-
import path from "path";
|
|
250
|
-
import { fileURLToPath } from "url";
|
|
251
|
-
var MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
252
|
-
var DEFAULT_EVIDENCE_ROOT = path.join(MODULE_DIR, "../evidence");
|
|
253
|
-
var DEFAULT_TRANSCRIPT_DIRS = ["interviews", "tickets", "public"];
|
|
254
|
-
var DEFAULT_CHUNK_SIZE = 800;
|
|
255
|
-
function stripYamlFrontMatter(contents) {
|
|
256
|
-
const start = contents.indexOf("---");
|
|
257
|
-
if (start === -1)
|
|
258
|
-
return contents;
|
|
259
|
-
const end = contents.indexOf("---", start + 3);
|
|
260
|
-
if (end === -1)
|
|
261
|
-
return contents;
|
|
262
|
-
return contents.slice(end + 3).trimStart();
|
|
263
|
-
}
|
|
264
|
-
function chunkTranscript(fileId, text, chunkSize) {
|
|
265
|
-
const chunks = [];
|
|
266
|
-
const clean = text.trim();
|
|
267
|
-
for (let offset = 0, idx = 0;offset < clean.length; idx += 1) {
|
|
268
|
-
const slice = clean.slice(offset, offset + chunkSize);
|
|
269
|
-
chunks.push({
|
|
270
|
-
chunkId: `${fileId}#c_${String(idx).padStart(2, "0")}`,
|
|
271
|
-
text: slice,
|
|
272
|
-
meta: { source: fileId }
|
|
273
|
-
});
|
|
274
|
-
offset += chunkSize;
|
|
275
|
-
}
|
|
276
|
-
return chunks;
|
|
277
|
-
}
|
|
278
|
-
function loadEvidenceChunks(options = {}) {
|
|
279
|
-
const evidenceRoot = options.evidenceRoot ?? DEFAULT_EVIDENCE_ROOT;
|
|
280
|
-
const transcriptDirs = options.transcriptDirs ?? DEFAULT_TRANSCRIPT_DIRS;
|
|
281
|
-
const chunkSize = options.chunkSize ?? DEFAULT_CHUNK_SIZE;
|
|
282
|
-
const chunks = [];
|
|
283
|
-
for (const dir of transcriptDirs) {
|
|
284
|
-
const fullDir = path.join(evidenceRoot, dir);
|
|
285
|
-
if (!fs.existsSync(fullDir))
|
|
286
|
-
continue;
|
|
287
|
-
for (const fileName of fs.readdirSync(fullDir)) {
|
|
288
|
-
const ext = path.extname(fileName).toLowerCase();
|
|
289
|
-
if (ext !== ".md")
|
|
290
|
-
continue;
|
|
291
|
-
const filePath = path.join(fullDir, fileName);
|
|
292
|
-
const raw = fs.readFileSync(filePath, "utf8");
|
|
293
|
-
const withoutFrontMatter = stripYamlFrontMatter(raw);
|
|
294
|
-
const baseId = path.parse(fileName).name;
|
|
295
|
-
const fileChunks = chunkTranscript(baseId, withoutFrontMatter, chunkSize);
|
|
296
|
-
chunks.push(...fileChunks);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return chunks;
|
|
300
|
-
}
|
|
301
|
-
async function loadEvidenceChunksWithSignals(options = {}) {
|
|
302
|
-
const baseChunks = loadEvidenceChunks(options);
|
|
303
|
-
if (!options.posthog)
|
|
304
|
-
return baseChunks;
|
|
305
|
-
const posthogChunks = await loadPosthogEvidenceChunks(options.posthog);
|
|
306
|
-
return [...baseChunks, ...posthogChunks];
|
|
307
|
-
}
|
|
308
|
-
export {
|
|
309
|
-
loadEvidenceChunksWithSignals,
|
|
310
|
-
loadEvidenceChunks,
|
|
311
|
-
DEFAULT_TRANSCRIPT_DIRS,
|
|
312
|
-
DEFAULT_EVIDENCE_ROOT,
|
|
313
|
-
DEFAULT_CHUNK_SIZE
|
|
314
|
-
};
|
|
2
|
+
import{PosthogAnalyticsProvider as U}from"@contractspec/integration.providers-impls/impls/posthog";import{FunnelAnalyzer as _}from"@contractspec/lib.analytics/funnel";async function L(q){let G=[],J=C(q.dateRange),Q=await A(q,J);if(Q)G.push(Q);let W=await T(q,J);if(W)G.push(W);let X=await x(q);if(X)G.push(X);return G}async function A(q,G){if(!q.reader.queryHogQL)return null;let J=D(q.eventNames),Q=q.limit??10,W=await q.reader.queryHogQL({query:["select"," event as eventName,"," count() as total","from events","where timestamp >= {dateFrom} and timestamp < {dateTo}",J.clause?`and ${J.clause}`:"","group by eventName","order by total desc",`limit ${Q}`].filter(Boolean).join(`
|
|
3
|
+
`),values:{dateFrom:G.from.toISOString(),dateTo:G.to.toISOString(),...J.values}}),X=I(W);if(X.length===0)return null;let B=X.map(($)=>{let V=F($.eventName)??"unknown",H=S($.total);return`- ${V}: ${H}`});return{chunkId:`posthog:event_summary:${G.from.toISOString()}`,text:[`PostHog event summary (${G.from.toISOString()} \u2192 ${G.to.toISOString()}):`,...B].join(`
|
|
4
|
+
`),meta:{source:"posthog",kind:"event_summary",dateFrom:G.from.toISOString(),dateTo:G.to.toISOString()}}}async function T(q,G){if(!q.funnel)return null;if(!q.reader.getEvents)return null;let J=[],Q=q.funnel.steps.map(($)=>$.eventName);for(let $ of Q)(await q.reader.getEvents({event:$,dateRange:{from:G.from,to:G.to},limit:q.limit??500})).results.forEach((H)=>{J.push({name:H.event,userId:H.distinctId,tenantId:typeof H.properties?.tenantId==="string"?H.properties.tenantId:void 0,timestamp:H.timestamp,properties:H.properties})});if(J.length===0)return null;let B=new _().analyze(J,q.funnel).steps.map(($)=>{return`- ${$.step.eventName}: ${$.count} (conversion ${$.conversionRate}, drop-off ${$.dropOffRate})`});return{chunkId:`posthog:funnel:${q.funnel.name}`,text:[`PostHog funnel analysis \u2014 ${q.funnel.name}:`,...B].join(`
|
|
5
|
+
`),meta:{source:"posthog",kind:"funnel",funnelName:q.funnel.name,dateFrom:G.from.toISOString(),dateTo:G.to.toISOString()}}}async function x(q){if(!q.includeFeatureFlags)return null;if(!q.reader.getFeatureFlags)return null;let G=await q.reader.getFeatureFlags({limit:10});if(!G.results.length)return null;return{chunkId:"posthog:feature_flags",text:["PostHog feature flags:",...G.results.map((Q)=>{let W=Q.key??"unknown",X=Q.active?"active":"inactive";return`- ${W}: ${X}`})].join(`
|
|
6
|
+
`),meta:{source:"posthog",kind:"feature_flags"}}}function C(q){let G=new Date,J=q?.from instanceof Date?q.from:q?.from?new Date(q.from):new Date(G.getTime()-2592000000),Q=q?.to instanceof Date?q.to:q?.to?new Date(q.to):G;return{from:J,to:Q}}function D(q){if(!q||q.length===0)return{};if(q.length===1)return{clause:"event = {event0}",values:{event0:q[0]}};let G={};return{clause:`(${q.map((Q,W)=>{return G[`event${W}`]=Q,`event = {event${W}}`}).join(" or ")})`,values:G}}function I(q){if(!Array.isArray(q.results)||!Array.isArray(q.columns))return[];let G=q.columns;return q.results.flatMap((J)=>{if(!Array.isArray(J))return[];let Q={};return G.forEach((W,X)=>{Q[W]=J[X]}),[Q]})}function F(q){if(typeof q==="string"&&q.trim())return q;if(typeof q==="number")return String(q);return null}function S(q){if(typeof q==="number"&&Number.isFinite(q))return q;if(typeof q==="string"&&q.trim()){let G=Number(q);if(Number.isFinite(G))return G}return 0}function c(q={}){let G=process.env.POSTHOG_PROJECT_ID,J=process.env.POSTHOG_PERSONAL_API_KEY;if(!G||!J)return null;let Q=z("POSTHOG_EVIDENCE_LOOKBACK_DAYS",q.defaultLookbackDays??30),W=z("POSTHOG_EVIDENCE_LIMIT",q.defaultLimit??10),X=new Date,B=new Date(X.getTime()-Q*24*60*60*1000),$=O("POSTHOG_EVIDENCE_EVENTS"),V=O("POSTHOG_EVIDENCE_FUNNEL_STEPS"),H=V&&V.length?{name:"posthog-evidence-funnel",steps:V.map((Z,j)=>({id:`step_${j+1}`,eventName:Z}))}:void 0;return{reader:new U({host:process.env.POSTHOG_HOST,projectId:G,personalApiKey:J}),dateRange:{from:B,to:X},eventNames:$,limit:W,funnel:H,includeFeatureFlags:b("POSTHOG_EVIDENCE_FEATURE_FLAGS",!0)}}function O(q){let G=process.env[q];if(!G)return;return G.split(",").map((J)=>J.trim()).filter(Boolean)}function z(q,G){let J=process.env[q];if(!J)return G;let Q=Number(J);return Number.isFinite(Q)?Q:G}function b(q,G){let J=process.env[q];if(J===void 0)return G;return J.toLowerCase()==="true"}import K from"fs";import Y from"path";import{fileURLToPath as w}from"url";var y=Y.dirname(w(import.meta.url)),E=Y.join(y,"../evidence"),R=["interviews","tickets","public"],N=800;function h(q){let G=q.indexOf("---");if(G===-1)return q;let J=q.indexOf("---",G+3);if(J===-1)return q;return q.slice(J+3).trimStart()}function k(q,G,J){let Q=[],W=G.trim();for(let X=0,B=0;X<W.length;B+=1){let $=W.slice(X,X+J);Q.push({chunkId:`${q}#c_${String(B).padStart(2,"0")}`,text:$,meta:{source:q}}),X+=J}return Q}function m(q={}){let G=q.evidenceRoot??E,J=q.transcriptDirs??R,Q=q.chunkSize??N,W=[];for(let X of J){let B=Y.join(G,X);if(!K.existsSync(B))continue;for(let $ of K.readdirSync(B)){if(Y.extname($).toLowerCase()!==".md")continue;let H=Y.join(B,$),M=K.readFileSync(H,"utf8"),Z=h(M),j=Y.parse($).name,P=k(j,Z,Q);W.push(...P)}}return W}async function l(q={}){let G=m(q);if(!q.posthog)return G;let J=await L(q.posthog);return[...G,...J]}export{l as loadEvidenceChunksWithSignals,m as loadEvidenceChunks,R as DEFAULT_TRANSCRIPT_DIRS,E as DEFAULT_EVIDENCE_ROOT,N as DEFAULT_CHUNK_SIZE};
|
package/dist/node/docs/index.js
CHANGED
|
@@ -1,34 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var blocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.product-intent",
|
|
6
|
-
title: "Product Intent Discovery",
|
|
7
|
-
summary: "Evidence-ingestion example for turning product signals into prompt-ready discovery outputs.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/product-intent",
|
|
11
|
-
tags: ["product-intent", "discovery", "evidence", "example"],
|
|
12
|
-
body: `## Included assets
|
|
1
|
+
import{registerDocBlocks as m}from"@contractspec/lib.contracts-spec/docs";var f=[{id:"docs.examples.product-intent",title:"Product Intent Discovery",summary:"Evidence-ingestion example for turning product signals into prompt-ready discovery outputs.",kind:"reference",visibility:"public",route:"/docs/examples/product-intent",tags:["product-intent","discovery","evidence","example"],body:`## Included assets
|
|
13
2
|
- Product-intent feature and example manifest.
|
|
14
3
|
- Evidence loading helpers and PostHog signal ingestion.
|
|
15
4
|
- Sync actions and script entrypoints for discovery workflows.
|
|
16
5
|
|
|
17
6
|
## Use case
|
|
18
|
-
Use this example when you need a lightweight pattern for evidence-backed product discovery before it becomes a larger workflow or template.`
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "docs.examples.product-intent.usage",
|
|
22
|
-
title: "Product Intent Usage",
|
|
23
|
-
summary: "How to use the product-intent example for evidence ingestion.",
|
|
24
|
-
kind: "usage",
|
|
25
|
-
visibility: "public",
|
|
26
|
-
route: "/docs/examples/product-intent/usage",
|
|
27
|
-
tags: ["product-intent", "usage"],
|
|
28
|
-
body: `## Usage
|
|
7
|
+
Use this example when you need a lightweight pattern for evidence-backed product discovery before it becomes a larger workflow or template.`},{id:"docs.examples.product-intent.usage",title:"Product Intent Usage",summary:"How to use the product-intent example for evidence ingestion.",kind:"usage",visibility:"public",route:"/docs/examples/product-intent/usage",tags:["product-intent","usage"],body:`## Usage
|
|
29
8
|
1. Load evidence sources with the helpers in this package.
|
|
30
9
|
2. Transform product signals into the product-intent workflow inputs.
|
|
31
|
-
3. Export the resulting discovery outputs into the next planning step or agent prompt.`
|
|
32
|
-
}
|
|
33
|
-
];
|
|
34
|
-
registerDocBlocks(blocks);
|
|
10
|
+
3. Export the resulting discovery outputs into the next planning step or agent prompt.`}];m(f);
|
|
@@ -1,34 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var blocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.product-intent",
|
|
6
|
-
title: "Product Intent Discovery",
|
|
7
|
-
summary: "Evidence-ingestion example for turning product signals into prompt-ready discovery outputs.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/product-intent",
|
|
11
|
-
tags: ["product-intent", "discovery", "evidence", "example"],
|
|
12
|
-
body: `## Included assets
|
|
1
|
+
import{registerDocBlocks as f}from"@contractspec/lib.contracts-spec/docs";var h=[{id:"docs.examples.product-intent",title:"Product Intent Discovery",summary:"Evidence-ingestion example for turning product signals into prompt-ready discovery outputs.",kind:"reference",visibility:"public",route:"/docs/examples/product-intent",tags:["product-intent","discovery","evidence","example"],body:`## Included assets
|
|
13
2
|
- Product-intent feature and example manifest.
|
|
14
3
|
- Evidence loading helpers and PostHog signal ingestion.
|
|
15
4
|
- Sync actions and script entrypoints for discovery workflows.
|
|
16
5
|
|
|
17
6
|
## Use case
|
|
18
|
-
Use this example when you need a lightweight pattern for evidence-backed product discovery before it becomes a larger workflow or template.`
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: "docs.examples.product-intent.usage",
|
|
22
|
-
title: "Product Intent Usage",
|
|
23
|
-
summary: "How to use the product-intent example for evidence ingestion.",
|
|
24
|
-
kind: "usage",
|
|
25
|
-
visibility: "public",
|
|
26
|
-
route: "/docs/examples/product-intent/usage",
|
|
27
|
-
tags: ["product-intent", "usage"],
|
|
28
|
-
body: `## Usage
|
|
7
|
+
Use this example when you need a lightweight pattern for evidence-backed product discovery before it becomes a larger workflow or template.`},{id:"docs.examples.product-intent.usage",title:"Product Intent Usage",summary:"How to use the product-intent example for evidence ingestion.",kind:"usage",visibility:"public",route:"/docs/examples/product-intent/usage",tags:["product-intent","usage"],body:`## Usage
|
|
29
8
|
1. Load evidence sources with the helpers in this package.
|
|
30
9
|
2. Transform product signals into the product-intent workflow inputs.
|
|
31
|
-
3. Export the resulting discovery outputs into the next planning step or agent prompt.`
|
|
32
|
-
}
|
|
33
|
-
];
|
|
34
|
-
registerDocBlocks(blocks);
|
|
10
|
+
3. Export the resulting discovery outputs into the next planning step or agent prompt.`}];f(h);
|
package/dist/node/example.js
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineExample } from "@contractspec/lib.contracts-spec/examples";
|
|
3
|
-
var example = defineExample({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "product-intent",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "Product Intent Discovery",
|
|
8
|
-
description: "Evidence ingestion and product-intent workflow for PM discovery.",
|
|
9
|
-
kind: "script",
|
|
10
|
-
visibility: "public",
|
|
11
|
-
stability: "experimental",
|
|
12
|
-
owners: ["@platform.core"],
|
|
13
|
-
tags: ["product-intent", "discovery", "pm", "evidence", "llm"]
|
|
14
|
-
},
|
|
15
|
-
docs: {
|
|
16
|
-
rootDocId: "docs.examples.product-intent",
|
|
17
|
-
usageDocId: "docs.examples.product-intent.usage"
|
|
18
|
-
},
|
|
19
|
-
entrypoints: {
|
|
20
|
-
packageName: "@contractspec/example.product-intent",
|
|
21
|
-
docs: "./docs"
|
|
22
|
-
},
|
|
23
|
-
surfaces: {
|
|
24
|
-
templates: false,
|
|
25
|
-
sandbox: { enabled: false, modes: [] },
|
|
26
|
-
studio: { enabled: false, installable: false },
|
|
27
|
-
mcp: { enabled: false }
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
var example_default = example;
|
|
31
|
-
export {
|
|
32
|
-
example_default as default
|
|
33
|
-
};
|
|
1
|
+
import{defineExample as g}from"@contractspec/lib.contracts-spec/examples";var h=g({meta:{key:"product-intent",version:"1.0.0",title:"Product Intent Discovery",description:"Evidence ingestion and product-intent workflow for PM discovery.",kind:"script",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["product-intent","discovery","pm","evidence","llm"]},docs:{rootDocId:"docs.examples.product-intent",usageDocId:"docs.examples.product-intent.usage"},entrypoints:{packageName:"@contractspec/example.product-intent",docs:"./docs"},surfaces:{templates:!1,sandbox:{enabled:!1,modes:[]},studio:{enabled:!1,installable:!1},mcp:{enabled:!1}}}),q=h;export{q as default};
|