@contractspec/example.product-intent 3.7.17 → 3.7.18
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 +15 -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
|
@@ -1,313 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
async function
|
|
5
|
-
|
|
6
|
-
const range = resolveRange(options.dateRange);
|
|
7
|
-
const eventSummary = await loadEventSummary(options, range);
|
|
8
|
-
if (eventSummary) {
|
|
9
|
-
chunks.push(eventSummary);
|
|
10
|
-
}
|
|
11
|
-
const funnelEvidence = await loadFunnelEvidence(options, range);
|
|
12
|
-
if (funnelEvidence) {
|
|
13
|
-
chunks.push(funnelEvidence);
|
|
14
|
-
}
|
|
15
|
-
const featureFlags = await loadFeatureFlagEvidence(options);
|
|
16
|
-
if (featureFlags) {
|
|
17
|
-
chunks.push(featureFlags);
|
|
18
|
-
}
|
|
19
|
-
return chunks;
|
|
20
|
-
}
|
|
21
|
-
async function loadEventSummary(options, range) {
|
|
22
|
-
if (!options.reader.queryHogQL)
|
|
23
|
-
return null;
|
|
24
|
-
const eventFilter = buildEventFilter(options.eventNames);
|
|
25
|
-
const limit = options.limit ?? 10;
|
|
26
|
-
const result = await options.reader.queryHogQL({
|
|
27
|
-
query: [
|
|
28
|
-
"select",
|
|
29
|
-
" event as eventName,",
|
|
30
|
-
" count() as total",
|
|
31
|
-
"from events",
|
|
32
|
-
"where timestamp >= {dateFrom} and timestamp < {dateTo}",
|
|
33
|
-
eventFilter.clause ? `and ${eventFilter.clause}` : "",
|
|
34
|
-
"group by eventName",
|
|
35
|
-
"order by total desc",
|
|
36
|
-
`limit ${limit}`
|
|
37
|
-
].filter(Boolean).join(`
|
|
38
|
-
`),
|
|
39
|
-
values: {
|
|
40
|
-
dateFrom: range.from.toISOString(),
|
|
41
|
-
dateTo: range.to.toISOString(),
|
|
42
|
-
...eventFilter.values
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const rows = mapRows(result);
|
|
46
|
-
if (rows.length === 0)
|
|
47
|
-
return null;
|
|
48
|
-
const lines = rows.map((row) => {
|
|
49
|
-
const name = asString(row.eventName) ?? "unknown";
|
|
50
|
-
const total = asNumber(row.total);
|
|
51
|
-
return `- ${name}: ${total}`;
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
chunkId: `posthog:event_summary:${range.from.toISOString()}`,
|
|
55
|
-
text: [
|
|
56
|
-
`PostHog event summary (${range.from.toISOString()} → ${range.to.toISOString()}):`,
|
|
57
|
-
...lines
|
|
58
|
-
].join(`
|
|
59
|
-
`),
|
|
60
|
-
meta: {
|
|
61
|
-
source: "posthog",
|
|
62
|
-
kind: "event_summary",
|
|
63
|
-
dateFrom: range.from.toISOString(),
|
|
64
|
-
dateTo: range.to.toISOString()
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
async function loadFunnelEvidence(options, range) {
|
|
69
|
-
if (!options.funnel)
|
|
70
|
-
return null;
|
|
71
|
-
if (!options.reader.getEvents)
|
|
72
|
-
return null;
|
|
73
|
-
const events = [];
|
|
74
|
-
const eventNames = options.funnel.steps.map((step) => step.eventName);
|
|
75
|
-
for (const eventName of eventNames) {
|
|
76
|
-
const response = await options.reader.getEvents({
|
|
77
|
-
event: eventName,
|
|
78
|
-
dateRange: {
|
|
79
|
-
from: range.from,
|
|
80
|
-
to: range.to
|
|
81
|
-
},
|
|
82
|
-
limit: options.limit ?? 500
|
|
83
|
-
});
|
|
84
|
-
response.results.forEach((event) => {
|
|
85
|
-
events.push({
|
|
86
|
-
name: event.event,
|
|
87
|
-
userId: event.distinctId,
|
|
88
|
-
tenantId: typeof event.properties?.tenantId === "string" ? event.properties.tenantId : undefined,
|
|
89
|
-
timestamp: event.timestamp,
|
|
90
|
-
properties: event.properties
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
if (events.length === 0)
|
|
95
|
-
return null;
|
|
96
|
-
const analyzer = new FunnelAnalyzer;
|
|
97
|
-
const analysis = analyzer.analyze(events, options.funnel);
|
|
98
|
-
const lines = analysis.steps.map((step) => {
|
|
99
|
-
return `- ${step.step.eventName}: ${step.count} (conversion ${step.conversionRate}, drop-off ${step.dropOffRate})`;
|
|
100
|
-
});
|
|
101
|
-
return {
|
|
102
|
-
chunkId: `posthog:funnel:${options.funnel.name}`,
|
|
103
|
-
text: [`PostHog funnel analysis — ${options.funnel.name}:`, ...lines].join(`
|
|
104
|
-
`),
|
|
105
|
-
meta: {
|
|
106
|
-
source: "posthog",
|
|
107
|
-
kind: "funnel",
|
|
108
|
-
funnelName: options.funnel.name,
|
|
109
|
-
dateFrom: range.from.toISOString(),
|
|
110
|
-
dateTo: range.to.toISOString()
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
async function loadFeatureFlagEvidence(options) {
|
|
115
|
-
if (!options.includeFeatureFlags)
|
|
116
|
-
return null;
|
|
117
|
-
if (!options.reader.getFeatureFlags)
|
|
118
|
-
return null;
|
|
119
|
-
const response = await options.reader.getFeatureFlags({ limit: 10 });
|
|
120
|
-
if (!response.results.length)
|
|
121
|
-
return null;
|
|
122
|
-
const lines = response.results.map((flag) => {
|
|
123
|
-
const key = flag.key ?? "unknown";
|
|
124
|
-
const active = flag.active ? "active" : "inactive";
|
|
125
|
-
return `- ${key}: ${active}`;
|
|
126
|
-
});
|
|
127
|
-
return {
|
|
128
|
-
chunkId: "posthog:feature_flags",
|
|
129
|
-
text: ["PostHog feature flags:", ...lines].join(`
|
|
130
|
-
`),
|
|
131
|
-
meta: {
|
|
132
|
-
source: "posthog",
|
|
133
|
-
kind: "feature_flags"
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function resolveRange(dateRange) {
|
|
138
|
-
const now = new Date;
|
|
139
|
-
const from = dateRange?.from instanceof Date ? dateRange.from : dateRange?.from ? new Date(dateRange.from) : new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
|
|
140
|
-
const to = dateRange?.to instanceof Date ? dateRange.to : dateRange?.to ? new Date(dateRange.to) : now;
|
|
141
|
-
return { from, to };
|
|
142
|
-
}
|
|
143
|
-
function buildEventFilter(eventNames) {
|
|
144
|
-
if (!eventNames || eventNames.length === 0)
|
|
145
|
-
return {};
|
|
146
|
-
if (eventNames.length === 1) {
|
|
147
|
-
return {
|
|
148
|
-
clause: "event = {event0}",
|
|
149
|
-
values: { event0: eventNames[0] }
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
const values = {};
|
|
153
|
-
const clauses = eventNames.map((eventName, index) => {
|
|
154
|
-
values[`event${index}`] = eventName;
|
|
155
|
-
return `event = {event${index}}`;
|
|
156
|
-
});
|
|
157
|
-
return {
|
|
158
|
-
clause: `(${clauses.join(" or ")})`,
|
|
159
|
-
values
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function mapRows(result) {
|
|
163
|
-
if (!Array.isArray(result.results) || !Array.isArray(result.columns)) {
|
|
164
|
-
return [];
|
|
165
|
-
}
|
|
166
|
-
const columns = result.columns;
|
|
167
|
-
return result.results.flatMap((row) => {
|
|
168
|
-
if (!Array.isArray(row))
|
|
169
|
-
return [];
|
|
170
|
-
const record = {};
|
|
171
|
-
columns.forEach((column, index) => {
|
|
172
|
-
record[column] = row[index];
|
|
173
|
-
});
|
|
174
|
-
return [record];
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
function asString(value) {
|
|
178
|
-
if (typeof value === "string" && value.trim())
|
|
179
|
-
return value;
|
|
180
|
-
if (typeof value === "number")
|
|
181
|
-
return String(value);
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
function asNumber(value) {
|
|
185
|
-
if (typeof value === "number" && Number.isFinite(value))
|
|
186
|
-
return value;
|
|
187
|
-
if (typeof value === "string" && value.trim()) {
|
|
188
|
-
const parsed = Number(value);
|
|
189
|
-
if (Number.isFinite(parsed))
|
|
190
|
-
return parsed;
|
|
191
|
-
}
|
|
192
|
-
return 0;
|
|
193
|
-
}
|
|
194
|
-
function resolvePosthogEvidenceOptionsFromEnv(options = {}) {
|
|
195
|
-
const projectId = process.env.POSTHOG_PROJECT_ID;
|
|
196
|
-
const personalApiKey = process.env.POSTHOG_PERSONAL_API_KEY;
|
|
197
|
-
if (!projectId || !personalApiKey)
|
|
198
|
-
return null;
|
|
199
|
-
const lookbackDays = resolveNumberEnv("POSTHOG_EVIDENCE_LOOKBACK_DAYS", options.defaultLookbackDays ?? 30);
|
|
200
|
-
const limit = resolveNumberEnv("POSTHOG_EVIDENCE_LIMIT", options.defaultLimit ?? 10);
|
|
201
|
-
const now = new Date;
|
|
202
|
-
const from = new Date(now.getTime() - lookbackDays * 24 * 60 * 60 * 1000);
|
|
203
|
-
const eventNames = resolveCsvEnv("POSTHOG_EVIDENCE_EVENTS");
|
|
204
|
-
const funnelSteps = resolveCsvEnv("POSTHOG_EVIDENCE_FUNNEL_STEPS");
|
|
205
|
-
const funnel = funnelSteps && funnelSteps.length ? {
|
|
206
|
-
name: "posthog-evidence-funnel",
|
|
207
|
-
steps: funnelSteps.map((eventName, index) => ({
|
|
208
|
-
id: `step_${index + 1}`,
|
|
209
|
-
eventName
|
|
210
|
-
}))
|
|
211
|
-
} : undefined;
|
|
212
|
-
const reader = new PosthogAnalyticsProvider({
|
|
213
|
-
host: process.env.POSTHOG_HOST,
|
|
214
|
-
projectId,
|
|
215
|
-
personalApiKey
|
|
216
|
-
});
|
|
217
|
-
return {
|
|
218
|
-
reader,
|
|
219
|
-
dateRange: { from, to: now },
|
|
220
|
-
eventNames,
|
|
221
|
-
limit,
|
|
222
|
-
funnel,
|
|
223
|
-
includeFeatureFlags: resolveBooleanEnv("POSTHOG_EVIDENCE_FEATURE_FLAGS", true)
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
function resolveCsvEnv(key) {
|
|
227
|
-
const value = process.env[key];
|
|
228
|
-
if (!value)
|
|
229
|
-
return;
|
|
230
|
-
return value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
231
|
-
}
|
|
232
|
-
function resolveNumberEnv(key, fallback) {
|
|
233
|
-
const value = process.env[key];
|
|
234
|
-
if (!value)
|
|
235
|
-
return fallback;
|
|
236
|
-
const parsed = Number(value);
|
|
237
|
-
return Number.isFinite(parsed) ? parsed : fallback;
|
|
238
|
-
}
|
|
239
|
-
function resolveBooleanEnv(key, fallback) {
|
|
240
|
-
const value = process.env[key];
|
|
241
|
-
if (value === undefined)
|
|
242
|
-
return fallback;
|
|
243
|
-
return value.toLowerCase() === "true";
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// src/load-evidence.ts
|
|
247
|
-
import fs from "node:fs";
|
|
248
|
-
import path from "node:path";
|
|
249
|
-
import { fileURLToPath } from "node:url";
|
|
250
|
-
var MODULE_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
251
|
-
var DEFAULT_EVIDENCE_ROOT = path.join(MODULE_DIR, "../evidence");
|
|
252
|
-
var DEFAULT_TRANSCRIPT_DIRS = ["interviews", "tickets", "public"];
|
|
253
|
-
var DEFAULT_CHUNK_SIZE = 800;
|
|
254
|
-
function stripYamlFrontMatter(contents) {
|
|
255
|
-
const start = contents.indexOf("---");
|
|
256
|
-
if (start === -1)
|
|
257
|
-
return contents;
|
|
258
|
-
const end = contents.indexOf("---", start + 3);
|
|
259
|
-
if (end === -1)
|
|
260
|
-
return contents;
|
|
261
|
-
return contents.slice(end + 3).trimStart();
|
|
262
|
-
}
|
|
263
|
-
function chunkTranscript(fileId, text, chunkSize) {
|
|
264
|
-
const chunks = [];
|
|
265
|
-
const clean = text.trim();
|
|
266
|
-
for (let offset = 0, idx = 0;offset < clean.length; idx += 1) {
|
|
267
|
-
const slice = clean.slice(offset, offset + chunkSize);
|
|
268
|
-
chunks.push({
|
|
269
|
-
chunkId: `${fileId}#c_${String(idx).padStart(2, "0")}`,
|
|
270
|
-
text: slice,
|
|
271
|
-
meta: { source: fileId }
|
|
272
|
-
});
|
|
273
|
-
offset += chunkSize;
|
|
274
|
-
}
|
|
275
|
-
return chunks;
|
|
276
|
-
}
|
|
277
|
-
function loadEvidenceChunks(options = {}) {
|
|
278
|
-
const evidenceRoot = options.evidenceRoot ?? DEFAULT_EVIDENCE_ROOT;
|
|
279
|
-
const transcriptDirs = options.transcriptDirs ?? DEFAULT_TRANSCRIPT_DIRS;
|
|
280
|
-
const chunkSize = options.chunkSize ?? DEFAULT_CHUNK_SIZE;
|
|
281
|
-
const chunks = [];
|
|
282
|
-
for (const dir of transcriptDirs) {
|
|
283
|
-
const fullDir = path.join(evidenceRoot, dir);
|
|
284
|
-
if (!fs.existsSync(fullDir))
|
|
285
|
-
continue;
|
|
286
|
-
for (const fileName of fs.readdirSync(fullDir)) {
|
|
287
|
-
const ext = path.extname(fileName).toLowerCase();
|
|
288
|
-
if (ext !== ".md")
|
|
289
|
-
continue;
|
|
290
|
-
const filePath = path.join(fullDir, fileName);
|
|
291
|
-
const raw = fs.readFileSync(filePath, "utf8");
|
|
292
|
-
const withoutFrontMatter = stripYamlFrontMatter(raw);
|
|
293
|
-
const baseId = path.parse(fileName).name;
|
|
294
|
-
const fileChunks = chunkTranscript(baseId, withoutFrontMatter, chunkSize);
|
|
295
|
-
chunks.push(...fileChunks);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
return chunks;
|
|
299
|
-
}
|
|
300
|
-
async function loadEvidenceChunksWithSignals(options = {}) {
|
|
301
|
-
const baseChunks = loadEvidenceChunks(options);
|
|
302
|
-
if (!options.posthog)
|
|
303
|
-
return baseChunks;
|
|
304
|
-
const posthogChunks = await loadPosthogEvidenceChunks(options.posthog);
|
|
305
|
-
return [...baseChunks, ...posthogChunks];
|
|
306
|
-
}
|
|
307
|
-
export {
|
|
308
|
-
loadEvidenceChunksWithSignals,
|
|
309
|
-
loadEvidenceChunks,
|
|
310
|
-
DEFAULT_TRANSCRIPT_DIRS,
|
|
311
|
-
DEFAULT_EVIDENCE_ROOT,
|
|
312
|
-
DEFAULT_CHUNK_SIZE
|
|
313
|
-
};
|
|
1
|
+
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(`
|
|
2
|
+
`),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()} → ${G.to.toISOString()}):`,...B].join(`
|
|
3
|
+
`),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 — ${q.funnel.name}:`,...B].join(`
|
|
4
|
+
`),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(`
|
|
5
|
+
`),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"node:fs";import Y from"node:path";import{fileURLToPath as w}from"node: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};
|
|
@@ -1,248 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
async function
|
|
5
|
-
|
|
6
|
-
const range = resolveRange(options.dateRange);
|
|
7
|
-
const eventSummary = await loadEventSummary(options, range);
|
|
8
|
-
if (eventSummary) {
|
|
9
|
-
chunks.push(eventSummary);
|
|
10
|
-
}
|
|
11
|
-
const funnelEvidence = await loadFunnelEvidence(options, range);
|
|
12
|
-
if (funnelEvidence) {
|
|
13
|
-
chunks.push(funnelEvidence);
|
|
14
|
-
}
|
|
15
|
-
const featureFlags = await loadFeatureFlagEvidence(options);
|
|
16
|
-
if (featureFlags) {
|
|
17
|
-
chunks.push(featureFlags);
|
|
18
|
-
}
|
|
19
|
-
return chunks;
|
|
20
|
-
}
|
|
21
|
-
async function loadEventSummary(options, range) {
|
|
22
|
-
if (!options.reader.queryHogQL)
|
|
23
|
-
return null;
|
|
24
|
-
const eventFilter = buildEventFilter(options.eventNames);
|
|
25
|
-
const limit = options.limit ?? 10;
|
|
26
|
-
const result = await options.reader.queryHogQL({
|
|
27
|
-
query: [
|
|
28
|
-
"select",
|
|
29
|
-
" event as eventName,",
|
|
30
|
-
" count() as total",
|
|
31
|
-
"from events",
|
|
32
|
-
"where timestamp >= {dateFrom} and timestamp < {dateTo}",
|
|
33
|
-
eventFilter.clause ? `and ${eventFilter.clause}` : "",
|
|
34
|
-
"group by eventName",
|
|
35
|
-
"order by total desc",
|
|
36
|
-
`limit ${limit}`
|
|
37
|
-
].filter(Boolean).join(`
|
|
38
|
-
`),
|
|
39
|
-
values: {
|
|
40
|
-
dateFrom: range.from.toISOString(),
|
|
41
|
-
dateTo: range.to.toISOString(),
|
|
42
|
-
...eventFilter.values
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const rows = mapRows(result);
|
|
46
|
-
if (rows.length === 0)
|
|
47
|
-
return null;
|
|
48
|
-
const lines = rows.map((row) => {
|
|
49
|
-
const name = asString(row.eventName) ?? "unknown";
|
|
50
|
-
const total = asNumber(row.total);
|
|
51
|
-
return `- ${name}: ${total}`;
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
chunkId: `posthog:event_summary:${range.from.toISOString()}`,
|
|
55
|
-
text: [
|
|
56
|
-
`PostHog event summary (${range.from.toISOString()} → ${range.to.toISOString()}):`,
|
|
57
|
-
...lines
|
|
58
|
-
].join(`
|
|
59
|
-
`),
|
|
60
|
-
meta: {
|
|
61
|
-
source: "posthog",
|
|
62
|
-
kind: "event_summary",
|
|
63
|
-
dateFrom: range.from.toISOString(),
|
|
64
|
-
dateTo: range.to.toISOString()
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
async function loadFunnelEvidence(options, range) {
|
|
69
|
-
if (!options.funnel)
|
|
70
|
-
return null;
|
|
71
|
-
if (!options.reader.getEvents)
|
|
72
|
-
return null;
|
|
73
|
-
const events = [];
|
|
74
|
-
const eventNames = options.funnel.steps.map((step) => step.eventName);
|
|
75
|
-
for (const eventName of eventNames) {
|
|
76
|
-
const response = await options.reader.getEvents({
|
|
77
|
-
event: eventName,
|
|
78
|
-
dateRange: {
|
|
79
|
-
from: range.from,
|
|
80
|
-
to: range.to
|
|
81
|
-
},
|
|
82
|
-
limit: options.limit ?? 500
|
|
83
|
-
});
|
|
84
|
-
response.results.forEach((event) => {
|
|
85
|
-
events.push({
|
|
86
|
-
name: event.event,
|
|
87
|
-
userId: event.distinctId,
|
|
88
|
-
tenantId: typeof event.properties?.tenantId === "string" ? event.properties.tenantId : undefined,
|
|
89
|
-
timestamp: event.timestamp,
|
|
90
|
-
properties: event.properties
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
if (events.length === 0)
|
|
95
|
-
return null;
|
|
96
|
-
const analyzer = new FunnelAnalyzer;
|
|
97
|
-
const analysis = analyzer.analyze(events, options.funnel);
|
|
98
|
-
const lines = analysis.steps.map((step) => {
|
|
99
|
-
return `- ${step.step.eventName}: ${step.count} (conversion ${step.conversionRate}, drop-off ${step.dropOffRate})`;
|
|
100
|
-
});
|
|
101
|
-
return {
|
|
102
|
-
chunkId: `posthog:funnel:${options.funnel.name}`,
|
|
103
|
-
text: [`PostHog funnel analysis — ${options.funnel.name}:`, ...lines].join(`
|
|
104
|
-
`),
|
|
105
|
-
meta: {
|
|
106
|
-
source: "posthog",
|
|
107
|
-
kind: "funnel",
|
|
108
|
-
funnelName: options.funnel.name,
|
|
109
|
-
dateFrom: range.from.toISOString(),
|
|
110
|
-
dateTo: range.to.toISOString()
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
async function loadFeatureFlagEvidence(options) {
|
|
115
|
-
if (!options.includeFeatureFlags)
|
|
116
|
-
return null;
|
|
117
|
-
if (!options.reader.getFeatureFlags)
|
|
118
|
-
return null;
|
|
119
|
-
const response = await options.reader.getFeatureFlags({ limit: 10 });
|
|
120
|
-
if (!response.results.length)
|
|
121
|
-
return null;
|
|
122
|
-
const lines = response.results.map((flag) => {
|
|
123
|
-
const key = flag.key ?? "unknown";
|
|
124
|
-
const active = flag.active ? "active" : "inactive";
|
|
125
|
-
return `- ${key}: ${active}`;
|
|
126
|
-
});
|
|
127
|
-
return {
|
|
128
|
-
chunkId: "posthog:feature_flags",
|
|
129
|
-
text: ["PostHog feature flags:", ...lines].join(`
|
|
130
|
-
`),
|
|
131
|
-
meta: {
|
|
132
|
-
source: "posthog",
|
|
133
|
-
kind: "feature_flags"
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function resolveRange(dateRange) {
|
|
138
|
-
const now = new Date;
|
|
139
|
-
const from = dateRange?.from instanceof Date ? dateRange.from : dateRange?.from ? new Date(dateRange.from) : new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
|
|
140
|
-
const to = dateRange?.to instanceof Date ? dateRange.to : dateRange?.to ? new Date(dateRange.to) : now;
|
|
141
|
-
return { from, to };
|
|
142
|
-
}
|
|
143
|
-
function buildEventFilter(eventNames) {
|
|
144
|
-
if (!eventNames || eventNames.length === 0)
|
|
145
|
-
return {};
|
|
146
|
-
if (eventNames.length === 1) {
|
|
147
|
-
return {
|
|
148
|
-
clause: "event = {event0}",
|
|
149
|
-
values: { event0: eventNames[0] }
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
const values = {};
|
|
153
|
-
const clauses = eventNames.map((eventName, index) => {
|
|
154
|
-
values[`event${index}`] = eventName;
|
|
155
|
-
return `event = {event${index}}`;
|
|
156
|
-
});
|
|
157
|
-
return {
|
|
158
|
-
clause: `(${clauses.join(" or ")})`,
|
|
159
|
-
values
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function mapRows(result) {
|
|
163
|
-
if (!Array.isArray(result.results) || !Array.isArray(result.columns)) {
|
|
164
|
-
return [];
|
|
165
|
-
}
|
|
166
|
-
const columns = result.columns;
|
|
167
|
-
return result.results.flatMap((row) => {
|
|
168
|
-
if (!Array.isArray(row))
|
|
169
|
-
return [];
|
|
170
|
-
const record = {};
|
|
171
|
-
columns.forEach((column, index) => {
|
|
172
|
-
record[column] = row[index];
|
|
173
|
-
});
|
|
174
|
-
return [record];
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
function asString(value) {
|
|
178
|
-
if (typeof value === "string" && value.trim())
|
|
179
|
-
return value;
|
|
180
|
-
if (typeof value === "number")
|
|
181
|
-
return String(value);
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
function asNumber(value) {
|
|
185
|
-
if (typeof value === "number" && Number.isFinite(value))
|
|
186
|
-
return value;
|
|
187
|
-
if (typeof value === "string" && value.trim()) {
|
|
188
|
-
const parsed = Number(value);
|
|
189
|
-
if (Number.isFinite(parsed))
|
|
190
|
-
return parsed;
|
|
191
|
-
}
|
|
192
|
-
return 0;
|
|
193
|
-
}
|
|
194
|
-
function resolvePosthogEvidenceOptionsFromEnv(options = {}) {
|
|
195
|
-
const projectId = process.env.POSTHOG_PROJECT_ID;
|
|
196
|
-
const personalApiKey = process.env.POSTHOG_PERSONAL_API_KEY;
|
|
197
|
-
if (!projectId || !personalApiKey)
|
|
198
|
-
return null;
|
|
199
|
-
const lookbackDays = resolveNumberEnv("POSTHOG_EVIDENCE_LOOKBACK_DAYS", options.defaultLookbackDays ?? 30);
|
|
200
|
-
const limit = resolveNumberEnv("POSTHOG_EVIDENCE_LIMIT", options.defaultLimit ?? 10);
|
|
201
|
-
const now = new Date;
|
|
202
|
-
const from = new Date(now.getTime() - lookbackDays * 24 * 60 * 60 * 1000);
|
|
203
|
-
const eventNames = resolveCsvEnv("POSTHOG_EVIDENCE_EVENTS");
|
|
204
|
-
const funnelSteps = resolveCsvEnv("POSTHOG_EVIDENCE_FUNNEL_STEPS");
|
|
205
|
-
const funnel = funnelSteps && funnelSteps.length ? {
|
|
206
|
-
name: "posthog-evidence-funnel",
|
|
207
|
-
steps: funnelSteps.map((eventName, index) => ({
|
|
208
|
-
id: `step_${index + 1}`,
|
|
209
|
-
eventName
|
|
210
|
-
}))
|
|
211
|
-
} : undefined;
|
|
212
|
-
const reader = new PosthogAnalyticsProvider({
|
|
213
|
-
host: process.env.POSTHOG_HOST,
|
|
214
|
-
projectId,
|
|
215
|
-
personalApiKey
|
|
216
|
-
});
|
|
217
|
-
return {
|
|
218
|
-
reader,
|
|
219
|
-
dateRange: { from, to: now },
|
|
220
|
-
eventNames,
|
|
221
|
-
limit,
|
|
222
|
-
funnel,
|
|
223
|
-
includeFeatureFlags: resolveBooleanEnv("POSTHOG_EVIDENCE_FEATURE_FLAGS", true)
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
function resolveCsvEnv(key) {
|
|
227
|
-
const value = process.env[key];
|
|
228
|
-
if (!value)
|
|
229
|
-
return;
|
|
230
|
-
return value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
231
|
-
}
|
|
232
|
-
function resolveNumberEnv(key, fallback) {
|
|
233
|
-
const value = process.env[key];
|
|
234
|
-
if (!value)
|
|
235
|
-
return fallback;
|
|
236
|
-
const parsed = Number(value);
|
|
237
|
-
return Number.isFinite(parsed) ? parsed : fallback;
|
|
238
|
-
}
|
|
239
|
-
function resolveBooleanEnv(key, fallback) {
|
|
240
|
-
const value = process.env[key];
|
|
241
|
-
if (value === undefined)
|
|
242
|
-
return fallback;
|
|
243
|
-
return value.toLowerCase() === "true";
|
|
244
|
-
}
|
|
245
|
-
export {
|
|
246
|
-
resolvePosthogEvidenceOptionsFromEnv,
|
|
247
|
-
loadPosthogEvidenceChunks
|
|
248
|
-
};
|
|
1
|
+
import{PosthogAnalyticsProvider as Z}from"@contractspec/integration.providers-impls/impls/posthog";import{FunnelAnalyzer as _}from"@contractspec/lib.analytics/funnel";async function x(q){let G=[],H=D(q.dateRange),J=await $(q,H);if(J)G.push(J);let L=await z(q,H);if(L)G.push(L);let M=await B(q);if(M)G.push(M);return G}async function $(q,G){if(!q.reader.queryHogQL)return null;let H=j(q.eventNames),J=q.limit??10,L=await q.reader.queryHogQL({query:["select"," event as eventName,"," count() as total","from events","where timestamp >= {dateFrom} and timestamp < {dateTo}",H.clause?`and ${H.clause}`:"","group by eventName","order by total desc",`limit ${J}`].filter(Boolean).join(`
|
|
2
|
+
`),values:{dateFrom:G.from.toISOString(),dateTo:G.to.toISOString(),...H.values}}),M=C(L);if(M.length===0)return null;let U=M.map((O)=>{let T=I(O.eventName)??"unknown",Q=K(O.total);return`- ${T}: ${Q}`});return{chunkId:`posthog:event_summary:${G.from.toISOString()}`,text:[`PostHog event summary (${G.from.toISOString()} → ${G.to.toISOString()}):`,...U].join(`
|
|
3
|
+
`),meta:{source:"posthog",kind:"event_summary",dateFrom:G.from.toISOString(),dateTo:G.to.toISOString()}}}async function z(q,G){if(!q.funnel)return null;if(!q.reader.getEvents)return null;let H=[],J=q.funnel.steps.map((O)=>O.eventName);for(let O of J)(await q.reader.getEvents({event:O,dateRange:{from:G.from,to:G.to},limit:q.limit??500})).results.forEach((Q)=>{H.push({name:Q.event,userId:Q.distinctId,tenantId:typeof Q.properties?.tenantId==="string"?Q.properties.tenantId:void 0,timestamp:Q.timestamp,properties:Q.properties})});if(H.length===0)return null;let U=new _().analyze(H,q.funnel).steps.map((O)=>{return`- ${O.step.eventName}: ${O.count} (conversion ${O.conversionRate}, drop-off ${O.dropOffRate})`});return{chunkId:`posthog:funnel:${q.funnel.name}`,text:[`PostHog funnel analysis — ${q.funnel.name}:`,...U].join(`
|
|
4
|
+
`),meta:{source:"posthog",kind:"funnel",funnelName:q.funnel.name,dateFrom:G.from.toISOString(),dateTo:G.to.toISOString()}}}async function B(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((J)=>{let L=J.key??"unknown",M=J.active?"active":"inactive";return`- ${L}: ${M}`})].join(`
|
|
5
|
+
`),meta:{source:"posthog",kind:"feature_flags"}}}function D(q){let G=new Date,H=q?.from instanceof Date?q.from:q?.from?new Date(q.from):new Date(G.getTime()-2592000000),J=q?.to instanceof Date?q.to:q?.to?new Date(q.to):G;return{from:H,to:J}}function j(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((J,L)=>{return G[`event${L}`]=J,`event = {event${L}}`}).join(" or ")})`,values:G}}function C(q){if(!Array.isArray(q.results)||!Array.isArray(q.columns))return[];let G=q.columns;return q.results.flatMap((H)=>{if(!Array.isArray(H))return[];let J={};return G.forEach((L,M)=>{J[L]=H[M]}),[J]})}function I(q){if(typeof q==="string"&&q.trim())return q;if(typeof q==="number")return String(q);return null}function K(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 F(q={}){let G=process.env.POSTHOG_PROJECT_ID,H=process.env.POSTHOG_PERSONAL_API_KEY;if(!G||!H)return null;let J=W("POSTHOG_EVIDENCE_LOOKBACK_DAYS",q.defaultLookbackDays??30),L=W("POSTHOG_EVIDENCE_LIMIT",q.defaultLimit??10),M=new Date,U=new Date(M.getTime()-J*24*60*60*1000),O=V("POSTHOG_EVIDENCE_EVENTS"),T=V("POSTHOG_EVIDENCE_FUNNEL_STEPS"),Q=T&&T.length?{name:"posthog-evidence-funnel",steps:T.map((X,Y)=>({id:`step_${Y+1}`,eventName:X}))}:void 0;return{reader:new Z({host:process.env.POSTHOG_HOST,projectId:G,personalApiKey:H}),dateRange:{from:U,to:M},eventNames:O,limit:L,funnel:Q,includeFeatureFlags:P("POSTHOG_EVIDENCE_FEATURE_FLAGS",!0)}}function V(q){let G=process.env[q];if(!G)return;return G.split(",").map((H)=>H.trim()).filter(Boolean)}function W(q,G){let H=process.env[q];if(!H)return G;let J=Number(H);return Number.isFinite(J)?J:G}function P(q,G){let H=process.env[q];if(H===void 0)return G;return H.toLowerCase()==="true"}export{F as resolvePosthogEvidenceOptionsFromEnv,x as loadPosthogEvidenceChunks};
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
OwnersEnum,
|
|
4
|
-
StabilityEnum
|
|
5
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
6
|
-
import { defineProductIntentSpec } from "@contractspec/lib.contracts-spec/product-intent/spec";
|
|
7
|
-
var ProductIntentDiscoverySpec = defineProductIntentSpec({
|
|
8
|
-
id: "product-intent.discovery.activation",
|
|
9
|
-
meta: {
|
|
10
|
-
key: "product-intent.discovery.activation",
|
|
11
|
-
version: "1.0.0",
|
|
12
|
-
title: "Product Intent Discovery",
|
|
13
|
-
description: "Discovery contract for activation friction using transcripts, analytics signals, and generated tasks.",
|
|
14
|
-
domain: "product",
|
|
15
|
-
owners: [OwnersEnum.PlatformCore],
|
|
16
|
-
tags: ["product-intent", "discovery", "activation", "analytics"],
|
|
17
|
-
stability: StabilityEnum.Experimental,
|
|
18
|
-
goal: "Prioritize the next activation improvement with grounded evidence.",
|
|
19
|
-
context: "Evidence is collected from interview transcripts, support tickets, and PostHog funnels before turning into task-ready outputs."
|
|
20
|
-
},
|
|
21
|
-
question: "Which activation and onboarding friction should we prioritize next?",
|
|
22
|
-
runtimeContext: {
|
|
23
|
-
evidenceRoot: "packages/examples/product-intent/evidence",
|
|
24
|
-
analyticsProvider: "posthog"
|
|
25
|
-
},
|
|
26
|
-
tickets: {
|
|
27
|
-
tickets: [
|
|
28
|
-
{
|
|
29
|
-
ticketId: "PI-101",
|
|
30
|
-
title: "Add a guided onboarding checklist",
|
|
31
|
-
summary: "Give new users an explicit checklist after signup so they can see the next activation milestone.",
|
|
32
|
-
evidenceIds: ["INT-002", "INT-014", "PH-dropoff-checkout"],
|
|
33
|
-
acceptanceCriteria: [
|
|
34
|
-
"Users see a checklist within the first session.",
|
|
35
|
-
"Checklist completion is tracked in analytics."
|
|
36
|
-
],
|
|
37
|
-
priority: "high",
|
|
38
|
-
tags: ["activation", "onboarding"]
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
tasks: {
|
|
43
|
-
packId: "product-intent.discovery.activation.tasks",
|
|
44
|
-
patchId: "product-intent.discovery.activation.patch",
|
|
45
|
-
overview: "Introduce a checklist-driven onboarding path and instrument it for activation measurement.",
|
|
46
|
-
tasks: [
|
|
47
|
-
{
|
|
48
|
-
id: "task-ui-checklist",
|
|
49
|
-
title: "Model the onboarding checklist surface",
|
|
50
|
-
surface: ["ui", "docs"],
|
|
51
|
-
why: "The product intent needs a visible activation guide and matching contract docs.",
|
|
52
|
-
acceptance: [
|
|
53
|
-
"A checklist surface is defined in contracts.",
|
|
54
|
-
"Documentation explains the activation milestone mapping."
|
|
55
|
-
],
|
|
56
|
-
agentPrompt: "Add the onboarding checklist contract surface and document the milestone states."
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
id: "task-analytics-checklist",
|
|
60
|
-
title: "Track checklist completion events",
|
|
61
|
-
surface: ["api", "tests"],
|
|
62
|
-
why: "Success must be measurable after rollout.",
|
|
63
|
-
acceptance: [
|
|
64
|
-
"Checklist completion emits analytics events.",
|
|
65
|
-
"Tests cover the event contract and payload shape."
|
|
66
|
-
],
|
|
67
|
-
agentPrompt: "Emit activation checklist events and add test coverage for the telemetry payloads.",
|
|
68
|
-
dependsOn: ["task-ui-checklist"]
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
export {
|
|
74
|
-
ProductIntentDiscoverySpec
|
|
75
|
-
};
|
|
1
|
+
import{OwnersEnum as g,StabilityEnum as h}from"@contractspec/lib.contracts-spec/ownership";import{defineProductIntentSpec as j}from"@contractspec/lib.contracts-spec/product-intent/spec";var v=j({id:"product-intent.discovery.activation",meta:{key:"product-intent.discovery.activation",version:"1.0.0",title:"Product Intent Discovery",description:"Discovery contract for activation friction using transcripts, analytics signals, and generated tasks.",domain:"product",owners:[g.PlatformCore],tags:["product-intent","discovery","activation","analytics"],stability:h.Experimental,goal:"Prioritize the next activation improvement with grounded evidence.",context:"Evidence is collected from interview transcripts, support tickets, and PostHog funnels before turning into task-ready outputs."},question:"Which activation and onboarding friction should we prioritize next?",runtimeContext:{evidenceRoot:"packages/examples/product-intent/evidence",analyticsProvider:"posthog"},tickets:{tickets:[{ticketId:"PI-101",title:"Add a guided onboarding checklist",summary:"Give new users an explicit checklist after signup so they can see the next activation milestone.",evidenceIds:["INT-002","INT-014","PH-dropoff-checkout"],acceptanceCriteria:["Users see a checklist within the first session.","Checklist completion is tracked in analytics."],priority:"high",tags:["activation","onboarding"]}]},tasks:{packId:"product-intent.discovery.activation.tasks",patchId:"product-intent.discovery.activation.patch",overview:"Introduce a checklist-driven onboarding path and instrument it for activation measurement.",tasks:[{id:"task-ui-checklist",title:"Model the onboarding checklist surface",surface:["ui","docs"],why:"The product intent needs a visible activation guide and matching contract docs.",acceptance:["A checklist surface is defined in contracts.","Documentation explains the activation milestone mapping."],agentPrompt:"Add the onboarding checklist contract surface and document the milestone states."},{id:"task-analytics-checklist",title:"Track checklist completion events",surface:["api","tests"],why:"Success must be measurable after rollout.",acceptance:["Checklist completion emits analytics events.","Tests cover the event contract and payload shape."],agentPrompt:"Emit activation checklist events and add test coverage for the telemetry payloads.",dependsOn:["task-ui-checklist"]}]}});export{v as ProductIntentDiscoverySpec};
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
3
|
-
var ProductIntentFeature = defineFeature({
|
|
4
|
-
meta: {
|
|
5
|
-
key: "product-intent",
|
|
6
|
-
version: "1.0.0",
|
|
7
|
-
title: "Product Intent",
|
|
8
|
-
description: "Evidence ingestion, PostHog signals, and transcript-to-tickets discovery workflow",
|
|
9
|
-
domain: "product",
|
|
10
|
-
owners: ["@examples"],
|
|
11
|
-
tags: ["product", "intent", "evidence", "posthog"],
|
|
12
|
-
stability: "experimental"
|
|
13
|
-
},
|
|
14
|
-
telemetry: [{ key: "product-intent.telemetry", version: "1.0.0" }],
|
|
15
|
-
docs: []
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
ProductIntentFeature
|
|
19
|
-
};
|
|
1
|
+
import{defineFeature as g}from"@contractspec/lib.contracts-spec";var j=g({meta:{key:"product-intent",version:"1.0.0",title:"Product Intent",description:"Evidence ingestion, PostHog signals, and transcript-to-tickets discovery workflow",domain:"product",owners:["@examples"],tags:["product","intent","evidence","posthog"],stability:"experimental"},telemetry:[{key:"product-intent.telemetry",version:"1.0.0"}],docs:[]});export{j as ProductIntentFeature};
|