@posthog/wizard 2.13.1 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +0 -26
  2. package/README.md +1 -1
  3. package/dist/TextBlock-B3cm43YY.js +244 -0
  4. package/dist/TextBlock-B3cm43YY.js.map +1 -0
  5. package/dist/{add-mcp-server-to-clients-D1IyBa9u.js → add-mcp-server-to-clients-DVdyI6SQ.js} +7 -7
  6. package/dist/{add-mcp-server-to-clients-D1IyBa9u.js.map → add-mcp-server-to-clients-DVdyI6SQ.js.map} +1 -1
  7. package/dist/{agent-interface-D9DeIikl.js → agent-interface-BJoqBI04.js} +533 -255
  8. package/dist/agent-interface-BJoqBI04.js.map +1 -0
  9. package/dist/{agent-runner-B41-Iig3.js → agent-runner-oJ7Wyhl7.js} +102 -20
  10. package/dist/agent-runner-oJ7Wyhl7.js.map +1 -0
  11. package/dist/analytics-Cz_p0Xus.js +2 -0
  12. package/dist/{analytics-Cek5hIwm.js → analytics-kUCNQQJm.js} +2 -2
  13. package/dist/{analytics-Cek5hIwm.js.map → analytics-kUCNQQJm.js.map} +1 -1
  14. package/dist/bin.js +951 -141
  15. package/dist/bin.js.map +1 -1
  16. package/dist/{debug-B2BH87dh.js → debug-BH8HMBNX.js} +26 -21
  17. package/dist/debug-BH8HMBNX.js.map +1 -0
  18. package/dist/{debug-BNWsxaDm.js → debug-CgsJTJOO.js} +1 -1
  19. package/dist/{defaults-GbLPuHxj.js → defaults-DgKAzsD1.js} +1 -1
  20. package/dist/{defaults-GbLPuHxj.js.map → defaults-DgKAzsD1.js.map} +1 -1
  21. package/dist/{detection-BFl2AYV6.js → detection-DWNUEyek.js} +4 -4
  22. package/dist/detection-DWNUEyek.js.map +1 -0
  23. package/dist/{file-8iNrXHkG.js → file-BKbKreWF.js} +1 -1
  24. package/dist/{file-8iNrXHkG.js.map → file-BKbKreWF.js.map} +1 -1
  25. package/dist/{file-utils-DnTSiTJw.js → file-utils-DPmgn9Vm.js} +1 -1
  26. package/dist/{file-utils-DnTSiTJw.js.map → file-utils-DPmgn9Vm.js.map} +1 -1
  27. package/dist/{package-json-F_7oktsp.js → package-json-DZpnf6vU.js} +8 -10
  28. package/dist/package-json-DZpnf6vU.js.map +1 -0
  29. package/dist/package-json-_4PEss19.js +2 -0
  30. package/dist/{package-manager-BBTvHn9i.js → package-manager-DmDoOiaW.js} +2 -2
  31. package/dist/{package-manager-BBTvHn9i.js.map → package-manager-DmDoOiaW.js.map} +1 -1
  32. package/dist/{posthog-vm0k9PKS.js → posthog-BbQf_Hzq.js} +1 -1
  33. package/dist/{posthog-vm0k9PKS.js.map → posthog-BbQf_Hzq.js.map} +1 -1
  34. package/dist/posthog-integration-DZgP-ysj.js +1012 -0
  35. package/dist/posthog-integration-DZgP-ysj.js.map +1 -0
  36. package/dist/{provisioning-DRwH4skH.js → provisioning-Buqple4U.js} +3 -3
  37. package/dist/{provisioning-DRwH4skH.js.map → provisioning-Buqple4U.js.map} +1 -1
  38. package/dist/provisioning-CAf6fMWM.js +2 -0
  39. package/dist/{registry-CZjMhhsK.js → registry-PGYX7928.js} +5 -5
  40. package/dist/{registry-CZjMhhsK.js.map → registry-PGYX7928.js.map} +1 -1
  41. package/dist/setup-utils-LGtFkuI1.js +2 -0
  42. package/dist/{setup-utils-DGUR4Djo.js → setup-utils-xt6Z8gik.js} +77 -107
  43. package/dist/setup-utils-xt6Z8gik.js.map +1 -0
  44. package/dist/{AuditChecksViewer-CjBCZjxG.js → slides-0xga1duy.js} +626 -1058
  45. package/dist/slides-0xga1duy.js.map +1 -0
  46. package/dist/smoke-test-ci.sh +4 -4
  47. package/dist/{start-playground-DPYl5WR-.js → start-playground-DYElnFW1.js} +259 -10
  48. package/dist/start-playground-DYElnFW1.js.map +1 -0
  49. package/dist/{start-tui-Cj_4BhK8.js → start-tui-BBhG-LSW.js} +288 -446
  50. package/dist/start-tui-BBhG-LSW.js.map +1 -0
  51. package/dist/{steps-BFD76-MP.js → steps-B9mb9qRe.js} +7 -7
  52. package/dist/{steps-BFD76-MP.js.map → steps-B9mb9qRe.js.map} +1 -1
  53. package/dist/{task-stream-CX7Uf6EM.js → task-stream-DUpUZmFQ.js} +8 -8
  54. package/dist/task-stream-DUpUZmFQ.js.map +1 -0
  55. package/dist/telemetry-BFwKBgCJ.js +13 -0
  56. package/dist/telemetry-BFwKBgCJ.js.map +1 -0
  57. package/dist/{wizard-abort-54DpTnUi.js → wizard-abort-DWwOHzHR.js} +3 -3
  58. package/dist/{wizard-abort-54DpTnUi.js.map → wizard-abort-DWwOHzHR.js.map} +1 -1
  59. package/dist/{wizard-abort-CZH03nD0.js → wizard-abort-Djz2J6p9.js} +1 -1
  60. package/dist/wizard-session-CPhhll4P.js +2 -0
  61. package/dist/{wizard-session-BcNJTl2I.js → wizard-session-CsI33S4_.js} +6 -3
  62. package/dist/wizard-session-CsI33S4_.js.map +1 -0
  63. package/dist/wizard-ui-YdGFRyu_.js.map +1 -1
  64. package/package.json +3 -2
  65. package/dist/AuditChecksViewer-CjBCZjxG.js.map +0 -1
  66. package/dist/agent-interface-D9DeIikl.js.map +0 -1
  67. package/dist/agent-runner-B41-Iig3.js.map +0 -1
  68. package/dist/analytics-CpbY05Lf.js +0 -2
  69. package/dist/debug-B2BH87dh.js.map +0 -1
  70. package/dist/detection-BFl2AYV6.js.map +0 -1
  71. package/dist/package-json-BzVey4Bd.js +0 -2
  72. package/dist/package-json-F_7oktsp.js.map +0 -1
  73. package/dist/posthog-integration-vFBuSN5U.js +0 -259
  74. package/dist/posthog-integration-vFBuSN5U.js.map +0 -1
  75. package/dist/provisioning--RCv39tI.js +0 -2
  76. package/dist/router-COhhuIW3.js +0 -135
  77. package/dist/router-COhhuIW3.js.map +0 -1
  78. package/dist/setup-utils-DGUR4Djo.js.map +0 -1
  79. package/dist/setup-utils-eh1450iu.js +0 -2
  80. package/dist/start-playground-DPYl5WR-.js.map +0 -1
  81. package/dist/start-tui-Cj_4BhK8.js.map +0 -1
  82. package/dist/task-stream-CX7Uf6EM.js.map +0 -1
  83. package/dist/telemetry-DCyjsXhw.js +0 -13
  84. package/dist/telemetry-DCyjsXhw.js.map +0 -1
  85. package/dist/wizard-session-BQC9vy9Z.js +0 -2
  86. package/dist/wizard-session-BcNJTl2I.js.map +0 -1
  87. package/npm-shrinkwrap.json +0 -2931
@@ -0,0 +1,1012 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-B_-DWIq7.js";
2
+ import { P as WIZARD_INTERACTION_EVENT_NAME, c as getUI, f as SIGNUP_WIZARD_READINESS_CONFIG, m as getBlockingServiceKeys, p as evaluateWizardReadiness } from "./debug-BH8HMBNX.js";
3
+ import { n as analytics } from "./analytics-kUCNQQJm.js";
4
+ import { a as isUsingTypeScript, d as getCloudUrlFromRegion, o as tryGetPackageJson } from "./setup-utils-xt6Z8gik.js";
5
+ import { n as requestDeepLink } from "./provisioning-Buqple4U.js";
6
+ import { t as AgentSignals, u as WIZARD_TOOL_NAMES } from "./agent-interface-BJoqBI04.js";
7
+ import { i as SPINNER_MESSAGE, t as FRAMEWORK_REGISTRY } from "./registry-PGYX7928.js";
8
+ import { a as detectFramework, i as discoverFeatures, n as checkFrameworkVersion, r as gatherFrameworkContext } from "./detection-DWNUEyek.js";
9
+ import { o as Colors } from "./TextBlock-B3cm43YY.js";
10
+ import opn from "opn";
11
+ import { Text } from "ink";
12
+ import { useEffect } from "react";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ //#region src/lib/programs/posthog-integration/detect.ts
15
+ async function detectPostHogIntegration(ctx) {
16
+ const session = ctx.session;
17
+ const installDir = session.installDir;
18
+ const detectedIntegration = await detectFramework(installDir);
19
+ if (detectedIntegration) {
20
+ const config = FRAMEWORK_REGISTRY[detectedIntegration];
21
+ const sessionOptions = {
22
+ installDir,
23
+ debug: session.debug,
24
+ forceInstall: session.forceInstall,
25
+ default: false,
26
+ signup: session.signup,
27
+ localMcp: session.localMcp,
28
+ ci: session.ci,
29
+ menu: session.menu,
30
+ benchmark: session.benchmark,
31
+ yaraReport: session.yaraReport
32
+ };
33
+ const context = await gatherFrameworkContext(config, sessionOptions);
34
+ for (const [key, value] of Object.entries(context)) if (!(key in session.frameworkContext)) ctx.setFrameworkContext(key, value);
35
+ ctx.setFrameworkConfig(detectedIntegration, config);
36
+ session.skillId = detectedIntegration;
37
+ if (!session.detectedFrameworkLabel) ctx.setDetectedFramework(config.metadata.name);
38
+ const versionResult = await checkFrameworkVersion(config, sessionOptions);
39
+ if (versionResult.supported !== true) ctx.setUnsupportedVersion(versionResult.supported);
40
+ }
41
+ for (const feature of discoverFeatures(installDir)) ctx.addDiscoveredFeature(feature);
42
+ ctx.setDetectionComplete();
43
+ }
44
+ //#endregion
45
+ //#region src/lib/programs/posthog-integration/steps.ts
46
+ function needsSetup(session) {
47
+ const config = session.frameworkConfig;
48
+ if (!config?.metadata.setup?.questions) return false;
49
+ return config.metadata.setup.questions.some((q) => !(q.key in session.frameworkContext));
50
+ }
51
+ function healthCheckReady(session) {
52
+ if (!session.readinessResult) return false;
53
+ if (session.signup) {
54
+ const hardBlocking = getBlockingServiceKeys(session.readinessResult.health, SIGNUP_WIZARD_READINESS_CONFIG);
55
+ const defaultBlocking = getBlockingServiceKeys(session.readinessResult.health);
56
+ if (hardBlocking.length === 0 && defaultBlocking.length === 0) return true;
57
+ return session.outageDismissed;
58
+ }
59
+ if (session.readinessResult.decision === "no") return session.outageDismissed;
60
+ return true;
61
+ }
62
+ const POSTHOG_INTEGRATION_PROGRAM = [
63
+ {
64
+ id: "detect",
65
+ label: "Detecting framework",
66
+ onReady: (ctx) => detectPostHogIntegration(ctx)
67
+ },
68
+ {
69
+ id: "intro",
70
+ label: "Welcome",
71
+ screenId: "intro",
72
+ gate: (session) => session.setupConfirmed
73
+ },
74
+ {
75
+ id: "health-check",
76
+ label: "Health check",
77
+ screenId: "health-check",
78
+ gate: healthCheckReady,
79
+ onInit: (ctx) => {
80
+ evaluateWizardReadiness().then((readiness) => {
81
+ ctx.setReadinessResult(readiness);
82
+ }).catch(() => {
83
+ ctx.setReadinessResult({
84
+ decision: "yes",
85
+ health: {},
86
+ reasons: []
87
+ });
88
+ });
89
+ }
90
+ },
91
+ {
92
+ id: "setup",
93
+ label: "Setup",
94
+ screenId: "setup",
95
+ show: needsSetup,
96
+ isComplete: (session) => !needsSetup(session)
97
+ },
98
+ {
99
+ id: "auth",
100
+ label: "Authentication",
101
+ screenId: "auth",
102
+ isComplete: (session) => session.credentials !== null
103
+ },
104
+ {
105
+ id: "run",
106
+ label: "Integration",
107
+ screenId: "run",
108
+ isComplete: (session) => session.runPhase === "completed" || session.runPhase === "error"
109
+ },
110
+ {
111
+ id: "mcp",
112
+ label: "MCP servers",
113
+ screenId: "mcp",
114
+ isComplete: (session) => session.mcpComplete
115
+ },
116
+ {
117
+ id: "outro",
118
+ label: "Done",
119
+ screenId: "outro",
120
+ isComplete: (session) => session.outroDismissed
121
+ },
122
+ {
123
+ id: "keep-skills",
124
+ label: "Keep Skills",
125
+ screenId: "keep-skills"
126
+ }
127
+ ];
128
+ //#endregion
129
+ //#region src/ui/tui/components/StatusPeekTrigger.tsx
130
+ /**
131
+ * StatusPeekTrigger — Fires the status-bar expansion once, renders a hint.
132
+ *
133
+ * Module-level `peekedOnce` guards against re-mounts (resize, tab switch)
134
+ * so the peek only happens a single time per process.
135
+ */
136
+ let peekedOnce = false;
137
+ const StatusPeekTrigger = ({ store, duration = 1e4 }) => {
138
+ useEffect(() => {
139
+ if (peekedOnce) return;
140
+ peekedOnce = true;
141
+ store?.setStatusExpanded(true);
142
+ setTimeout(() => {
143
+ store?.setStatusExpanded(false);
144
+ }, duration);
145
+ }, [store, duration]);
146
+ return /* @__PURE__ */ jsx(Text, { children: "You can view the Wizard's status below." });
147
+ };
148
+ //#endregion
149
+ //#region src/lib/programs/posthog-integration/content/data-flow.tsx
150
+ /**
151
+ * POSTHOG_DATA_FLOW — ASCII diagram of the PostHog event ingestion flow.
152
+ */
153
+ const POSTHOG_DATA_FLOW = {
154
+ type: "lines",
155
+ interval: 500,
156
+ pause: 8e3,
157
+ lines: [
158
+ /* @__PURE__ */ jsx(Text, {
159
+ color: "gray",
160
+ children: " ┌──────────────────────────────┐"
161
+ }),
162
+ /* @__PURE__ */ jsxs(Text, { children: [
163
+ /* @__PURE__ */ jsx(Text, {
164
+ color: "gray",
165
+ children: " │ "
166
+ }),
167
+ /* @__PURE__ */ jsx(Text, {
168
+ bold: true,
169
+ color: "cyan",
170
+ children: "Your App"
171
+ }),
172
+ /* @__PURE__ */ jsx(Text, {
173
+ color: "gray",
174
+ children: " │"
175
+ })
176
+ ] }),
177
+ /* @__PURE__ */ jsxs(Text, { children: [
178
+ /* @__PURE__ */ jsx(Text, {
179
+ color: "gray",
180
+ children: " │ │ "
181
+ }),
182
+ /* @__PURE__ */ jsx(Text, { children: "posthog.capture()" }),
183
+ /* @__PURE__ */ jsx(Text, {
184
+ color: "gray",
185
+ children: " │"
186
+ })
187
+ ] }),
188
+ /* @__PURE__ */ jsxs(Text, { children: [
189
+ /* @__PURE__ */ jsx(Text, {
190
+ color: "gray",
191
+ children: " │ │ "
192
+ }),
193
+ /* @__PURE__ */ jsx(Text, {
194
+ dimColor: true,
195
+ children: "custom events"
196
+ }),
197
+ /* @__PURE__ */ jsx(Text, {
198
+ color: "gray",
199
+ children: " │"
200
+ })
201
+ ] }),
202
+ /* @__PURE__ */ jsxs(Text, { children: [
203
+ /* @__PURE__ */ jsx(Text, {
204
+ color: "gray",
205
+ children: " │ │ "
206
+ }),
207
+ /* @__PURE__ */ jsx(Text, {
208
+ dimColor: true,
209
+ children: "custom properties"
210
+ }),
211
+ /* @__PURE__ */ jsx(Text, {
212
+ color: "gray",
213
+ children: " │"
214
+ })
215
+ ] }),
216
+ /* @__PURE__ */ jsxs(Text, { children: [
217
+ /* @__PURE__ */ jsx(Text, {
218
+ color: "gray",
219
+ children: " │ │ "
220
+ }),
221
+ /* @__PURE__ */ jsx(Text, {
222
+ dimColor: true,
223
+ children: "person profiles"
224
+ }),
225
+ /* @__PURE__ */ jsx(Text, {
226
+ color: "gray",
227
+ children: " │"
228
+ })
229
+ ] }),
230
+ /* @__PURE__ */ jsxs(Text, { children: [
231
+ /* @__PURE__ */ jsx(Text, {
232
+ color: "gray",
233
+ children: " │ ↓ "
234
+ }),
235
+ /* @__PURE__ */ jsx(Text, {
236
+ dimColor: true,
237
+ children: "groups"
238
+ }),
239
+ /* @__PURE__ */ jsx(Text, {
240
+ color: "gray",
241
+ children: " │"
242
+ })
243
+ ] }),
244
+ /* @__PURE__ */ jsxs(Text, { children: [
245
+ /* @__PURE__ */ jsx(Text, {
246
+ color: "gray",
247
+ children: " │ "
248
+ }),
249
+ /* @__PURE__ */ jsx(Text, {
250
+ bold: true,
251
+ color: Colors.accent,
252
+ children: "PostHog SDK"
253
+ }),
254
+ /* @__PURE__ */ jsx(Text, {
255
+ color: "gray",
256
+ children: " │"
257
+ })
258
+ ] }),
259
+ /* @__PURE__ */ jsxs(Text, { children: [
260
+ /* @__PURE__ */ jsx(Text, {
261
+ color: "gray",
262
+ children: " │ ↓ "
263
+ }),
264
+ /* @__PURE__ */ jsx(Text, { children: "HTTP" }),
265
+ /* @__PURE__ */ jsx(Text, {
266
+ color: "gray",
267
+ children: " │"
268
+ })
269
+ ] }),
270
+ /* @__PURE__ */ jsxs(Text, { children: [
271
+ /* @__PURE__ */ jsx(Text, {
272
+ color: "gray",
273
+ children: " │ "
274
+ }),
275
+ /* @__PURE__ */ jsx(Text, {
276
+ bold: true,
277
+ color: Colors.accent,
278
+ children: "PostHog Cloud"
279
+ }),
280
+ /* @__PURE__ */ jsx(Text, {
281
+ color: "gray",
282
+ children: " │"
283
+ })
284
+ ] }),
285
+ /* @__PURE__ */ jsxs(Text, { children: [
286
+ /* @__PURE__ */ jsx(Text, {
287
+ color: "gray",
288
+ children: " │ ↓ "
289
+ }),
290
+ /* @__PURE__ */ jsx(Text, { children: "query + visualize" }),
291
+ /* @__PURE__ */ jsx(Text, {
292
+ color: "gray",
293
+ children: " │"
294
+ })
295
+ ] }),
296
+ /* @__PURE__ */ jsxs(Text, { children: [
297
+ /* @__PURE__ */ jsx(Text, {
298
+ color: "gray",
299
+ children: " │ "
300
+ }),
301
+ /* @__PURE__ */ jsx(Text, {
302
+ bold: true,
303
+ color: "green",
304
+ children: "Dashboards & Insights"
305
+ }),
306
+ /* @__PURE__ */ jsx(Text, {
307
+ color: "gray",
308
+ children: " │"
309
+ })
310
+ ] }),
311
+ /* @__PURE__ */ jsx(Text, {
312
+ color: "gray",
313
+ children: " └──────────────────────────────┘"
314
+ })
315
+ ]
316
+ };
317
+ //#endregion
318
+ //#region src/lib/programs/posthog-integration/content/product-suite.tsx
319
+ /**
320
+ * PRODUCT_SUITE_BLOCK — Two-column listing of PostHog products.
321
+ */
322
+ const PRODUCT_SUITE_BLOCK = {
323
+ type: "lines",
324
+ interval: 1e3,
325
+ pause: 15e3,
326
+ lines: [
327
+ /* @__PURE__ */ jsxs(Text, { children: [
328
+ /* @__PURE__ */ jsx(Text, {
329
+ color: "cyan",
330
+ children: " ◆ "
331
+ }),
332
+ "Product Analytics ",
333
+ /* @__PURE__ */ jsx(Text, {
334
+ color: "cyan",
335
+ children: "◆ "
336
+ }),
337
+ "Error Tracking"
338
+ ] }),
339
+ /* @__PURE__ */ jsxs(Text, { children: [
340
+ /* @__PURE__ */ jsx(Text, {
341
+ color: "cyan",
342
+ children: " ◆ "
343
+ }),
344
+ "Web Analytics ",
345
+ /* @__PURE__ */ jsx(Text, {
346
+ color: "cyan",
347
+ children: "◆ "
348
+ }),
349
+ "Session Replay"
350
+ ] }),
351
+ /* @__PURE__ */ jsxs(Text, { children: [
352
+ /* @__PURE__ */ jsx(Text, {
353
+ color: "cyan",
354
+ children: " ◆ "
355
+ }),
356
+ "Feature Flags ",
357
+ /* @__PURE__ */ jsx(Text, {
358
+ color: "cyan",
359
+ children: "◆ "
360
+ }),
361
+ "Data Pipelines"
362
+ ] }),
363
+ /* @__PURE__ */ jsxs(Text, { children: [
364
+ /* @__PURE__ */ jsx(Text, {
365
+ color: "cyan",
366
+ children: " ◆ "
367
+ }),
368
+ "Experiments ",
369
+ /* @__PURE__ */ jsx(Text, {
370
+ color: "cyan",
371
+ children: "◆ "
372
+ }),
373
+ "Data Warehouse"
374
+ ] }),
375
+ /* @__PURE__ */ jsxs(Text, { children: [
376
+ /* @__PURE__ */ jsx(Text, {
377
+ color: "cyan",
378
+ children: " ◆ "
379
+ }),
380
+ "LLM Analytics ",
381
+ /* @__PURE__ */ jsx(Text, {
382
+ color: "cyan",
383
+ children: "◆ "
384
+ }),
385
+ "Surveys"
386
+ ] }),
387
+ /* @__PURE__ */ jsxs(Text, { children: [
388
+ /* @__PURE__ */ jsx(Text, {
389
+ color: "cyan",
390
+ children: " ◆ "
391
+ }),
392
+ "Workflows ",
393
+ /* @__PURE__ */ jsx(Text, {
394
+ color: "cyan",
395
+ children: "◆ "
396
+ }),
397
+ "Logs"
398
+ ] }),
399
+ /* @__PURE__ */ jsxs(Text, { children: [
400
+ /* @__PURE__ */ jsx(Text, {
401
+ color: "cyan",
402
+ children: " ◆ "
403
+ }),
404
+ "Product Tours ",
405
+ /* @__PURE__ */ jsx(Text, {
406
+ color: "cyan",
407
+ children: "◆ "
408
+ }),
409
+ "Support"
410
+ ] }),
411
+ /* @__PURE__ */ jsxs(Text, { children: [
412
+ /* @__PURE__ */ jsx(Text, {
413
+ color: "cyan",
414
+ children: " ◆ "
415
+ }),
416
+ "Revenue Analytics ",
417
+ /* @__PURE__ */ jsx(Text, {
418
+ color: "cyan",
419
+ children: "◆ "
420
+ }),
421
+ "Endpoints"
422
+ ] }),
423
+ /* @__PURE__ */ jsxs(Text, { children: [
424
+ /* @__PURE__ */ jsx(Text, {
425
+ color: "cyan",
426
+ children: " ◆ "
427
+ }),
428
+ "Customer Analytics ",
429
+ /* @__PURE__ */ jsx(Text, {
430
+ color: "cyan",
431
+ children: "◆ "
432
+ }),
433
+ "PostHog Code"
434
+ ] })
435
+ ]
436
+ };
437
+ //#endregion
438
+ //#region src/lib/programs/posthog-integration/content/line-chart.tsx
439
+ /**
440
+ * LINE_CHART_BLOCK — ASCII trends chart illustrating an insight.
441
+ */
442
+ const LINE_CHART_BLOCK = {
443
+ type: "lines",
444
+ interval: 300,
445
+ pause: 6e3,
446
+ lines: [
447
+ /* @__PURE__ */ jsx(Text, {
448
+ bold: true,
449
+ children: " Trends · user signups (monthly)"
450
+ }),
451
+ /* @__PURE__ */ jsx(Text, { children: " " }),
452
+ /* @__PURE__ */ jsxs(Text, { children: [
453
+ /* @__PURE__ */ jsx(Text, {
454
+ color: "gray",
455
+ children: " 10k ┤"
456
+ }),
457
+ " ",
458
+ /* @__PURE__ */ jsx(Text, {
459
+ color: "cyan",
460
+ children: "╭──"
461
+ }),
462
+ /* @__PURE__ */ jsx(Text, {
463
+ dimColor: true,
464
+ children: " 9,575"
465
+ })
466
+ ] }),
467
+ /* @__PURE__ */ jsxs(Text, { children: [
468
+ /* @__PURE__ */ jsx(Text, {
469
+ color: "gray",
470
+ children: " │"
471
+ }),
472
+ " ",
473
+ /* @__PURE__ */ jsx(Text, {
474
+ color: "cyan",
475
+ children: "╭╯"
476
+ })
477
+ ] }),
478
+ /* @__PURE__ */ jsxs(Text, { children: [
479
+ /* @__PURE__ */ jsx(Text, {
480
+ color: "gray",
481
+ children: " 7.5k ┤"
482
+ }),
483
+ " ",
484
+ /* @__PURE__ */ jsx(Text, {
485
+ color: "cyan",
486
+ children: "╭╯"
487
+ })
488
+ ] }),
489
+ /* @__PURE__ */ jsxs(Text, { children: [
490
+ /* @__PURE__ */ jsx(Text, {
491
+ color: "gray",
492
+ children: " │"
493
+ }),
494
+ " ",
495
+ /* @__PURE__ */ jsx(Text, {
496
+ color: "cyan",
497
+ children: "╭─╯"
498
+ })
499
+ ] }),
500
+ /* @__PURE__ */ jsxs(Text, { children: [
501
+ /* @__PURE__ */ jsx(Text, {
502
+ color: "gray",
503
+ children: " 5k ┤"
504
+ }),
505
+ " ",
506
+ /* @__PURE__ */ jsx(Text, {
507
+ color: "cyan",
508
+ children: "╭─╯"
509
+ })
510
+ ] }),
511
+ /* @__PURE__ */ jsxs(Text, { children: [
512
+ /* @__PURE__ */ jsx(Text, {
513
+ color: "gray",
514
+ children: " │"
515
+ }),
516
+ " ",
517
+ /* @__PURE__ */ jsx(Text, {
518
+ color: "cyan",
519
+ children: "╭──╯"
520
+ })
521
+ ] }),
522
+ /* @__PURE__ */ jsxs(Text, { children: [
523
+ /* @__PURE__ */ jsx(Text, {
524
+ color: "gray",
525
+ children: " 2.5k ┤"
526
+ }),
527
+ " ",
528
+ /* @__PURE__ */ jsx(Text, {
529
+ color: "cyan",
530
+ children: "╭───╯"
531
+ })
532
+ ] }),
533
+ /* @__PURE__ */ jsxs(Text, { children: [
534
+ /* @__PURE__ */ jsx(Text, {
535
+ color: "gray",
536
+ children: " │"
537
+ }),
538
+ " ",
539
+ /* @__PURE__ */ jsx(Text, {
540
+ color: "cyan",
541
+ children: "╭──────╯"
542
+ })
543
+ ] }),
544
+ /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
545
+ color: "gray",
546
+ children: " 0 ┤"
547
+ }), /* @__PURE__ */ jsx(Text, {
548
+ color: "cyan",
549
+ children: "──────╯"
550
+ })] }),
551
+ /* @__PURE__ */ jsx(Text, {
552
+ color: "gray",
553
+ children: " └┬─────┬─────┬─────┬─────┬──"
554
+ }),
555
+ /* @__PURE__ */ jsx(Text, {
556
+ dimColor: true,
557
+ children: " May Aug Nov Feb May"
558
+ })
559
+ ]
560
+ };
561
+ //#endregion
562
+ //#region src/lib/programs/posthog-integration/content/funnel.tsx
563
+ /**
564
+ * FUNNEL_BLOCK — ASCII funnel illustrating step conversion.
565
+ */
566
+ const FUNNEL_BLOCK = {
567
+ type: "lines",
568
+ interval: 200,
569
+ pause: 8e3,
570
+ lines: [
571
+ /* @__PURE__ */ jsx(Text, {
572
+ bold: true,
573
+ children: " Funnel · ride conversion"
574
+ }),
575
+ /* @__PURE__ */ jsx(Text, { children: " " }),
576
+ /* @__PURE__ */ jsxs(Text, { children: [
577
+ " ",
578
+ /* @__PURE__ */ jsx(Text, {
579
+ bold: true,
580
+ children: "1"
581
+ }),
582
+ " app_launched",
583
+ " ",
584
+ /* @__PURE__ */ jsx(Text, {
585
+ bold: true,
586
+ color: "green",
587
+ children: "100.00%"
588
+ })
589
+ ] }),
590
+ /* @__PURE__ */ jsx(Text, {
591
+ color: "cyan",
592
+ children: " ██████████████████████████████"
593
+ }),
594
+ /* @__PURE__ */ jsx(Text, {
595
+ dimColor: true,
596
+ children: " → 1,200 users"
597
+ }),
598
+ /* @__PURE__ */ jsx(Text, { children: " " }),
599
+ /* @__PURE__ */ jsxs(Text, { children: [
600
+ " ",
601
+ /* @__PURE__ */ jsx(Text, {
602
+ bold: true,
603
+ children: "2"
604
+ }),
605
+ " ride_requested",
606
+ " ",
607
+ /* @__PURE__ */ jsx(Text, {
608
+ dimColor: true,
609
+ children: "avg 2m 30s"
610
+ }),
611
+ " ",
612
+ /* @__PURE__ */ jsx(Text, {
613
+ bold: true,
614
+ color: "green",
615
+ children: "72.00%"
616
+ })
617
+ ] }),
618
+ /* @__PURE__ */ jsxs(Text, { children: [
619
+ " ",
620
+ /* @__PURE__ */ jsx(Text, {
621
+ color: "cyan",
622
+ children: "██████████████████████"
623
+ }),
624
+ /* @__PURE__ */ jsx(Text, {
625
+ dimColor: true,
626
+ children: "░░░░░░░░░"
627
+ })
628
+ ] }),
629
+ /* @__PURE__ */ jsxs(Text, { children: [
630
+ " ",
631
+ /* @__PURE__ */ jsx(Text, {
632
+ dimColor: true,
633
+ children: "→ 864 users"
634
+ }),
635
+ " ",
636
+ /* @__PURE__ */ jsx(Text, {
637
+ color: "red",
638
+ children: "↘"
639
+ }),
640
+ /* @__PURE__ */ jsx(Text, {
641
+ dimColor: true,
642
+ children: " 336 (28%)"
643
+ })
644
+ ] }),
645
+ /* @__PURE__ */ jsx(Text, { children: " " }),
646
+ /* @__PURE__ */ jsxs(Text, { children: [
647
+ " ",
648
+ /* @__PURE__ */ jsx(Text, {
649
+ bold: true,
650
+ children: "3"
651
+ }),
652
+ " ride_accepted",
653
+ " ",
654
+ /* @__PURE__ */ jsx(Text, {
655
+ dimColor: true,
656
+ children: "avg 5m 12s"
657
+ }),
658
+ " ",
659
+ /* @__PURE__ */ jsx(Text, {
660
+ bold: true,
661
+ color: "green",
662
+ children: "51.00%"
663
+ })
664
+ ] }),
665
+ /* @__PURE__ */ jsxs(Text, { children: [
666
+ " ",
667
+ /* @__PURE__ */ jsx(Text, {
668
+ color: "cyan",
669
+ children: "██████████████████"
670
+ }),
671
+ /* @__PURE__ */ jsx(Text, {
672
+ dimColor: true,
673
+ children: "░░░░░░░░░░░░░"
674
+ })
675
+ ] }),
676
+ /* @__PURE__ */ jsxs(Text, { children: [
677
+ " ",
678
+ /* @__PURE__ */ jsx(Text, {
679
+ dimColor: true,
680
+ children: "→ 612 users"
681
+ }),
682
+ " ",
683
+ /* @__PURE__ */ jsx(Text, {
684
+ color: "red",
685
+ children: "↘"
686
+ }),
687
+ /* @__PURE__ */ jsx(Text, {
688
+ dimColor: true,
689
+ children: " 252 (29%)"
690
+ })
691
+ ] }),
692
+ /* @__PURE__ */ jsx(Text, { children: " " }),
693
+ /* @__PURE__ */ jsxs(Text, { children: [
694
+ " ",
695
+ /* @__PURE__ */ jsx(Text, {
696
+ bold: true,
697
+ children: "4"
698
+ }),
699
+ " ride_started",
700
+ " ",
701
+ /* @__PURE__ */ jsx(Text, {
702
+ dimColor: true,
703
+ children: "avg 1m 45s"
704
+ }),
705
+ " ",
706
+ /* @__PURE__ */ jsx(Text, {
707
+ bold: true,
708
+ color: "green",
709
+ children: "38.00%"
710
+ })
711
+ ] }),
712
+ /* @__PURE__ */ jsxs(Text, { children: [
713
+ " ",
714
+ /* @__PURE__ */ jsx(Text, {
715
+ color: "cyan",
716
+ children: "█████████████"
717
+ }),
718
+ /* @__PURE__ */ jsx(Text, {
719
+ dimColor: true,
720
+ children: "░░░░░░░░░░░░░░░░░░"
721
+ })
722
+ ] }),
723
+ /* @__PURE__ */ jsxs(Text, { children: [
724
+ " ",
725
+ /* @__PURE__ */ jsx(Text, {
726
+ dimColor: true,
727
+ children: "→ 456 users"
728
+ }),
729
+ " ",
730
+ /* @__PURE__ */ jsx(Text, {
731
+ color: "red",
732
+ children: "↘"
733
+ }),
734
+ /* @__PURE__ */ jsx(Text, {
735
+ dimColor: true,
736
+ children: " 156 (25%)"
737
+ })
738
+ ] })
739
+ ]
740
+ };
741
+ //#endregion
742
+ //#region src/lib/programs/posthog-integration/content/index.tsx
743
+ /**
744
+ * Integration learn-deck — the narrative script played while the agent
745
+ * runs the PostHog integration flow. Weaves typewriter lines, pauses,
746
+ * `clear` markers, and the diagram blocks into one sequence.
747
+ */
748
+ const getContentBlocks = (store) => [
749
+ {
750
+ content: "Welcome.",
751
+ pause: 3e3,
752
+ mode: 0,
753
+ animationInterval: 160
754
+ },
755
+ {
756
+ content: "The Wizard is an agent.",
757
+ pause: 4e3
758
+ },
759
+ {
760
+ content: "It handles the entire PostHog setup process on your behalf.",
761
+ pause: 5e3
762
+ },
763
+ {
764
+ content: "As we speak, it's building a plan to set up PostHog in your project.",
765
+ pause: 6e3
766
+ },
767
+ {
768
+ type: "clear",
769
+ pause: 2e3
770
+ },
771
+ {
772
+ pause: 5e3,
773
+ persist: true,
774
+ content: /* @__PURE__ */ jsx(StatusPeekTrigger, { store })
775
+ },
776
+ {
777
+ pause: 6e3,
778
+ content: /* @__PURE__ */ jsxs(Text, { children: [
779
+ "Press",
780
+ " ",
781
+ /* @__PURE__ */ jsx(Text, {
782
+ color: Colors.accent,
783
+ bold: true,
784
+ children: "S"
785
+ }),
786
+ " ",
787
+ "to expand or collapse the status."
788
+ ] })
789
+ },
790
+ {
791
+ type: "clear",
792
+ pause: 2e3
793
+ },
794
+ {
795
+ content: "It takes about eight minutes.",
796
+ pause: 2e3
797
+ },
798
+ {
799
+ content: "So grab some coffee ☕️.",
800
+ pause: 2e3
801
+ },
802
+ {
803
+ content: "Or stick around and learn about PostHog.",
804
+ pause: 5e3
805
+ },
806
+ {
807
+ type: "clear",
808
+ pause: 3e3
809
+ },
810
+ {
811
+ content: "Events are the foundation of the PostHog platform.",
812
+ pause: 4e3
813
+ },
814
+ {
815
+ content: "Every time an action is performed in your codebase — like button clicks, function calls, or thrown errors — we can capture an event.",
816
+ pause: 6e3
817
+ },
818
+ {
819
+ content: "Events are sent to PostHog and joined with other product data.",
820
+ pause: 6e3
821
+ },
822
+ {
823
+ type: "clear",
824
+ pause: 1e3
825
+ },
826
+ {
827
+ content: "Here's the flow.",
828
+ pause: 1e3
829
+ },
830
+ POSTHOG_DATA_FLOW,
831
+ {
832
+ type: "clear",
833
+ pause: 2e3
834
+ },
835
+ {
836
+ content: "With enough event data, you can answer powerful questions about your product.",
837
+ pause: 4e3
838
+ },
839
+ {
840
+ content: "And create insights.",
841
+ pause: 4e3
842
+ },
843
+ {
844
+ type: "clear",
845
+ pause: 500
846
+ },
847
+ {
848
+ content: "Like trends to measure growth.",
849
+ pause: 2500
850
+ },
851
+ LINE_CHART_BLOCK,
852
+ {
853
+ type: "clear",
854
+ pause: 500
855
+ },
856
+ {
857
+ content: "Or funnels to reveal bottlenecks.",
858
+ pause: 2500
859
+ },
860
+ FUNNEL_BLOCK,
861
+ {
862
+ type: "clear",
863
+ pause: 1e3
864
+ },
865
+ {
866
+ content: "Use those signals to decide what to build next.",
867
+ pause: 4e3
868
+ },
869
+ {
870
+ content: "PostHog has all the dev tools you need.",
871
+ pause: 3e3
872
+ },
873
+ PRODUCT_SUITE_BLOCK
874
+ ];
875
+ //#endregion
876
+ //#region src/lib/programs/posthog-integration/index.ts
877
+ var posthog_integration_exports = /* @__PURE__ */ __exportAll({
878
+ EVENT_PLAN_FILE: () => EVENT_PLAN_FILE,
879
+ SETUP_REPORT_FILE: () => SETUP_REPORT_FILE,
880
+ posthogIntegrationConfig: () => posthogIntegrationConfig
881
+ });
882
+ const DASHBOARD_DEEP_LINK_KEY = "dashboardDeepLink";
883
+ function resolveContinueUrl(sess, cloudRegion, deepLink) {
884
+ if (!sess.signup) return void 0;
885
+ if (typeof deepLink === "string" && deepLink) return deepLink;
886
+ if (cloudRegion) return `${getCloudUrlFromRegion(cloudRegion)}/products?source=wizard`;
887
+ }
888
+ const SETUP_REPORT_FILE = "posthog-setup-report.md";
889
+ const EVENT_PLAN_FILE = ".posthog-events.json";
890
+ const posthogIntegrationConfig = {
891
+ command: "integrate",
892
+ description: "Set up PostHog SDK integration",
893
+ id: "posthog-integration",
894
+ steps: POSTHOG_INTEGRATION_PROGRAM,
895
+ getContentBlocks,
896
+ disallowedTools: [WIZARD_TOOL_NAMES.wizardAsk],
897
+ run: async (session) => {
898
+ const config = session.frameworkConfig;
899
+ const typeScriptDetected = isUsingTypeScript({ installDir: session.installDir });
900
+ session.typescript = typeScriptDetected;
901
+ const usesPackageJson = config.detection.usesPackageJson !== false;
902
+ let frameworkVersion;
903
+ if (usesPackageJson) {
904
+ const packageJson = await tryGetPackageJson({ installDir: session.installDir });
905
+ if (packageJson) {
906
+ const { hasPackageInstalled } = await import("./package-json-_4PEss19.js");
907
+ if (!hasPackageInstalled(config.detection.packageName, packageJson)) getUI().log.warn(`${config.detection.packageDisplayName} does not seem to be installed. Continuing anyway — the agent will handle it.`);
908
+ frameworkVersion = config.detection.getVersion(packageJson);
909
+ } else getUI().log.warn("Could not find package.json. Continuing anyway — the agent will handle it.");
910
+ } else frameworkVersion = config.detection.getVersion(null);
911
+ if (frameworkVersion && config.detection.getVersionBucket) {
912
+ const versionBucket = config.detection.getVersionBucket(frameworkVersion);
913
+ analytics.setTag(`${config.metadata.integration}-version`, versionBucket);
914
+ }
915
+ const frameworkContext = session.frameworkContext;
916
+ const contextTags = config.analytics.getTags(frameworkContext);
917
+ Object.entries(contextTags).forEach(([key, value]) => {
918
+ analytics.setTag(key, value);
919
+ });
920
+ return {
921
+ integrationLabel: config.metadata.integration,
922
+ additionalMcpServers: config.metadata.additionalMcpServers,
923
+ detectPackageManager: config.detection.detectPackageManager,
924
+ spinnerMessage: SPINNER_MESSAGE,
925
+ successMessage: config.ui.successMessage,
926
+ estimatedDurationMinutes: config.ui.estimatedDurationMinutes,
927
+ reportFile: SETUP_REPORT_FILE,
928
+ docsUrl: config.metadata.docsUrl,
929
+ errorMessage: "Integration failed",
930
+ additionalFeatureQueue: session.additionalFeatureQueue,
931
+ customPrompt: (ctx) => {
932
+ const additionalLines = config.prompts.getAdditionalContextLines ? config.prompts.getAdditionalContextLines(frameworkContext) : [];
933
+ const additionalContext = additionalLines.length > 0 ? "\n" + additionalLines.map((line) => `- ${line}`).join("\n") : "";
934
+ return `You have access to the PostHog MCP server which provides skills to integrate PostHog into this ${config.metadata.name} project.
935
+
936
+ Project context:
937
+ - PostHog Project ID: ${ctx.projectId}
938
+ - Framework: ${config.metadata.name} ${frameworkVersion || "latest"}
939
+ - TypeScript: ${typeScriptDetected ? "Yes" : "No"}
940
+ - PostHog public token: ${ctx.projectApiKey}
941
+ - PostHog Host: ${ctx.host}
942
+ - Project type: ${config.prompts.projectTypeDetection}
943
+ - Package installation: ${config.prompts.packageInstallation ?? "Use the detect_package_manager tool to determine the package manager. Do not manually edit package.json; the package manager handles it automatically."}${additionalContext}
944
+
945
+ Instructions (follow these steps IN ORDER - do not skip or reorder):
946
+
947
+ STEP 1: Call load_skill_menu (from the wizard-tools MCP server) to see available skills.
948
+ If the tool fails, emit: ${AgentSignals.ERROR_MCP_MISSING} Could not load skill menu and halt.
949
+
950
+ Choose a skill from the \`integration\` category that matches this project's framework. Do NOT pick skills from other categories (llm-analytics, error-tracking, feature-flags, omnibus, etc.) — those are handled separately.
951
+ If no suitable integration skill is found, emit: ${AgentSignals.ERROR_RESOURCE_MISSING} Could not find a suitable skill for this project.
952
+
953
+ STEP 2: Call install_skill (from the wizard-tools MCP server) with the chosen skill ID (e.g., "integration-nextjs-app-router").
954
+ Do NOT run any shell commands to install skills.
955
+
956
+ STEP 3: Load the installed skill's SKILL.md file to understand what references are available.
957
+
958
+ STEP 4: Follow the skill's program files in sequence. Look for numbered program files in the references (e.g., files with patterns like "1.0-", "1.1-", "1.2-"). Start with the first one and proceed through each step until completion. Each program file will tell you what to do and which file comes next. Never directly write PostHog tokens directly to code files; always use environment variables.
959
+
960
+ STEP 5: Set up environment variables for PostHog using the wizard-tools MCP server (this runs locally — secret values never leave the machine):
961
+ - Use check_env_keys to see which keys already exist in the project's .env file (e.g. .env.local or .env).
962
+ - Use set_env_values to create or update the PostHog public token and host, using the appropriate environment variable naming convention for ${config.metadata.name}, which you'll find in example code. The tool will also ensure .gitignore coverage. Don't assume the presence of keys means the value is up to date. Write the correct value each time.
963
+ - Reference these environment variables in the code files you create instead of hardcoding the public token and host.
964
+
965
+ Important: Use the detect_package_manager tool (from the wizard-tools MCP server) to determine which package manager the project uses. Do not manually search for lockfiles or config files. Always install packages as a background task. Don't await completion; proceed with other work immediately after starting the installation. You must read a file immediately before attempting to write it, even if you have previously read it; failure to do so will cause a tool failure.
966
+
967
+
968
+ `;
969
+ },
970
+ postRun: async (sess, credentials) => {
971
+ const envVars = config.environment.getEnvVars(credentials.projectApiKey, credentials.host);
972
+ if (config.environment.uploadToHosting) {
973
+ const { uploadEnvironmentVariablesStep } = await import("./steps-B9mb9qRe.js");
974
+ const uploadedEnvVars = await uploadEnvironmentVariablesStep(envVars, {
975
+ integration: config.metadata.integration,
976
+ session: sess
977
+ });
978
+ if (uploadedEnvVars.length > 0) analytics.capture(WIZARD_INTERACTION_EVENT_NAME, {
979
+ action: "wizard_env_vars_uploaded",
980
+ integration: config.metadata.integration,
981
+ variable_count: uploadedEnvVars.length,
982
+ variable_keys: uploadedEnvVars
983
+ });
984
+ }
985
+ if (sess.signup) {
986
+ const deepLink = await requestDeepLink(credentials.accessToken, credentials.host);
987
+ if (deepLink) {
988
+ sess.frameworkContext[DASHBOARD_DEEP_LINK_KEY] = deepLink;
989
+ opn(deepLink, { wait: false }).catch(() => {});
990
+ }
991
+ }
992
+ },
993
+ buildOutroData: (sess, credentials, cloudRegion) => {
994
+ const envVars = config.environment.getEnvVars(credentials.projectApiKey, credentials.host);
995
+ const deepLink = sess.frameworkContext[DASHBOARD_DEEP_LINK_KEY];
996
+ const continueUrl = resolveContinueUrl(sess, cloudRegion, deepLink);
997
+ return {
998
+ kind: "success",
999
+ message: "Successfully installed PostHog!",
1000
+ reportFile: SETUP_REPORT_FILE,
1001
+ changes: [...config.ui.getOutroChanges(frameworkContext), Object.keys(envVars).length > 0 ? "Added environment variables to .env file" : ""].filter(Boolean),
1002
+ docsUrl: config.metadata.docsUrl,
1003
+ continueUrl
1004
+ };
1005
+ }
1006
+ };
1007
+ }
1008
+ };
1009
+ //#endregion
1010
+ export { LINE_CHART_BLOCK as a, FUNNEL_BLOCK as i, posthogIntegrationConfig as n, PRODUCT_SUITE_BLOCK as o, posthog_integration_exports as r, StatusPeekTrigger as s, EVENT_PLAN_FILE as t };
1011
+
1012
+ //# sourceMappingURL=posthog-integration-DZgP-ysj.js.map