@posthog/wizard 2.62.0 → 2.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +48 -6
  2. package/dist/{add-mcp-server-to-clients-Bzl7_wB3.js → add-mcp-server-to-clients-D9l1dyw9.js} +4 -4
  3. package/dist/{add-mcp-server-to-clients-Bzl7_wB3.js.map → add-mcp-server-to-clients-D9l1dyw9.js.map} +1 -1
  4. package/dist/{agent-interface-C90hyvs1.js → agent-interface-BQfwaSe-.js} +24 -16
  5. package/dist/agent-interface-BQfwaSe-.js.map +1 -0
  6. package/dist/{agent-prompt-loader-CBj2DWAJ.js → agent-prompt-loader-BRKe3VE6.js} +15 -7
  7. package/dist/agent-prompt-loader-BRKe3VE6.js.map +1 -0
  8. package/dist/{agent-runner-DA5YfjOD.js → agent-runner-B4ZdNkj4.js} +215 -42
  9. package/dist/agent-runner-B4ZdNkj4.js.map +1 -0
  10. package/dist/analytics-BlE8Yjoh.js +2 -0
  11. package/dist/{analytics-BdKBzz4M.js → analytics-Duy9Vfk-.js} +2 -2
  12. package/dist/{analytics-BdKBzz4M.js.map → analytics-Duy9Vfk-.js.map} +1 -1
  13. package/dist/{api-aTkzJ9vG.js → api-DEb25KDf.js} +3 -3
  14. package/dist/{api-aTkzJ9vG.js.map → api-DEb25KDf.js.map} +1 -1
  15. package/dist/bin.js +256 -43
  16. package/dist/bin.js.map +1 -1
  17. package/dist/{bounded-fs-BU2L5mjO.js → bounded-fs-CvYIzQbg.js} +3 -3
  18. package/dist/{bounded-fs-BU2L5mjO.js.map → bounded-fs-CvYIzQbg.js.map} +1 -1
  19. package/dist/check-screens.tsx +15 -0
  20. package/dist/{ci-install-BnTAUOz8.js → ci-install-k2HWuLQ3.js} +4 -4
  21. package/dist/{ci-install-BnTAUOz8.js.map → ci-install-k2HWuLQ3.js.map} +1 -1
  22. package/dist/{debug-BTPYy9p7.js → debug-3FJsmlmC.js} +15 -8
  23. package/dist/debug-3FJsmlmC.js.map +1 -0
  24. package/dist/{debug-D2L-fM_I.js → debug-D7eikh3K.js} +1 -1
  25. package/dist/{env-api-key-cjD4yfGT.js → env-api-key-uk6HInaB.js} +4 -7
  26. package/dist/env-api-key-uk6HInaB.js.map +1 -0
  27. package/dist/{environment-lV2X1gS-.js → environment-Cyq61jKV.js} +4 -4
  28. package/dist/{environment-lV2X1gS-.js.map → environment-Cyq61jKV.js.map} +1 -1
  29. package/dist/{file-watcher-qqQBl5Em.js → file-watcher-DZDDYHrv.js} +2 -2
  30. package/dist/{file-watcher-qqQBl5Em.js.map → file-watcher-DZDDYHrv.js.map} +1 -1
  31. package/dist/{headless-ui-TSoOsa3j.js → headless-ui-MpPKNNH9.js} +2 -2
  32. package/dist/{headless-ui-TSoOsa3j.js.map → headless-ui-MpPKNNH9.js.map} +1 -1
  33. package/dist/{interactive-DMoXEiKo.js → interactive-BDCUPSmr.js} +2 -2
  34. package/dist/{interactive-DMoXEiKo.js.map → interactive-BDCUPSmr.js.map} +1 -1
  35. package/dist/{mcp-Dqu0_QzN.js → mcp-DOH54TGI.js} +2 -2
  36. package/dist/{mcp-Dqu0_QzN.js.map → mcp-DOH54TGI.js.map} +1 -1
  37. package/dist/{mcp-prompt-streaming-B4cYVDVP.js → mcp-prompt-streaming-BKY-srkT.js} +3 -3
  38. package/dist/{mcp-prompt-streaming-B4cYVDVP.js.map → mcp-prompt-streaming-BKY-srkT.js.map} +1 -1
  39. package/dist/{non-interactive-EG_lII4R.js → non-interactive-DOG-p4ku.js} +2 -2
  40. package/dist/{non-interactive-EG_lII4R.js.map → non-interactive-DOG-p4ku.js.map} +1 -1
  41. package/dist/{orchestrator-tools-DrhpNOKK.js → orchestrator-tools-CfaYl_W4.js} +13 -10
  42. package/dist/orchestrator-tools-CfaYl_W4.js.map +1 -0
  43. package/dist/{package-manager-z33XHEWO.js → package-manager-62MxCa1Y.js} +2 -2
  44. package/dist/{package-manager-z33XHEWO.js.map → package-manager-62MxCa1Y.js.map} +1 -1
  45. package/dist/{pi-CVJB0Ban.js → pi-DohBskuT.js} +11 -11
  46. package/dist/{pi-CVJB0Ban.js.map → pi-DohBskuT.js.map} +1 -1
  47. package/dist/{playground-BjWqoWhf.js → playground-DaTeK9-L.js} +6 -6
  48. package/dist/{playground-BjWqoWhf.js.map → playground-DaTeK9-L.js.map} +1 -1
  49. package/dist/{posthog-3ijs_66W.js → posthog-DvM4V-to.js} +2 -2
  50. package/dist/{posthog-3ijs_66W.js.map → posthog-DvM4V-to.js.map} +1 -1
  51. package/dist/{posthog-integration-C3wuB5B1.js → posthog-integration-BHqFQd4U.js} +54 -24
  52. package/dist/{posthog-integration-C3wuB5B1.js.map → posthog-integration-BHqFQd4U.js.map} +1 -1
  53. package/dist/{provisioning-IKacrvWB.js → provisioning-B41dKvno.js} +3 -3
  54. package/dist/{provisioning-IKacrvWB.js.map → provisioning-B41dKvno.js.map} +1 -1
  55. package/dist/{queue-tools-zM8_mxx6.js → queue-tools-DED9kPuc.js} +117 -19
  56. package/dist/queue-tools-DED9kPuc.js.map +1 -0
  57. package/dist/{registry-DF_aKyS0.js → registry-Dh9aqVC6.js} +5 -5
  58. package/dist/{registry-DF_aKyS0.js.map → registry-Dh9aqVC6.js.map} +1 -1
  59. package/dist/{security-CVFKNYBn.js → security-HZDvt7uh.js} +5 -5
  60. package/dist/{security-CVFKNYBn.js.map → security-HZDvt7uh.js.map} +1 -1
  61. package/dist/{setup-utils-iINkc0xu.js → setup-utils-DJF-LjYE.js} +101 -19
  62. package/dist/setup-utils-DJF-LjYE.js.map +1 -0
  63. package/dist/{start-tui-CjtL-ls7.js → start-tui-0p-Ybwxe.js} +40 -18
  64. package/dist/start-tui-0p-Ybwxe.js.map +1 -0
  65. package/dist/{steps-DzUGHdfY.js → steps-BSp0kHUG.js} +7 -7
  66. package/dist/{steps-DzUGHdfY.js.map → steps-BSp0kHUG.js.map} +1 -1
  67. package/dist/{store-DtckpbSC.js → store-BgOhG49V.js} +5 -4
  68. package/dist/store-BgOhG49V.js.map +1 -0
  69. package/dist/{subagent-cD_bF490.js → subagent-DDsAb9we.js} +2 -2
  70. package/dist/{subagent-cD_bF490.js.map → subagent-DDsAb9we.js.map} +1 -1
  71. package/dist/{task-eIt2iATF.js → task-CCZAWF2U.js} +12 -12
  72. package/dist/{task-eIt2iATF.js.map → task-CCZAWF2U.js.map} +1 -1
  73. package/dist/{task-stream-DGBUveUD.js → task-stream-B0Eo4KX1.js} +4 -4
  74. package/dist/{task-stream-DGBUveUD.js.map → task-stream-B0Eo4KX1.js.map} +1 -1
  75. package/dist/{tasks-wQ3V6Ft6.js → tasks-DRqU9G95.js} +2 -2
  76. package/dist/{tasks-wQ3V6Ft6.js.map → tasks-DRqU9G95.js.map} +1 -1
  77. package/dist/{telemetry-BWYDFAwf.js → telemetry-4VTeK1h9.js} +3 -3
  78. package/dist/{telemetry-BWYDFAwf.js.map → telemetry-4VTeK1h9.js.map} +1 -1
  79. package/dist/{terminal-yKJZx1UC.js → terminal-CDqEDXWF.js} +16 -13
  80. package/dist/terminal-CDqEDXWF.js.map +1 -0
  81. package/dist/{tools-CDlaJb_e.js → tools-CjNt0TUI.js} +6 -6
  82. package/dist/{tools-CDlaJb_e.js.map → tools-CjNt0TUI.js.map} +1 -1
  83. package/dist/{wizard-abort-CztG5WTv.js → wizard-abort-BeuIRy5a.js} +3 -3
  84. package/dist/{wizard-abort-CztG5WTv.js.map → wizard-abort-BeuIRy5a.js.map} +1 -1
  85. package/dist/{wizard-abort-Cjk5z73h.js → wizard-abort-DNHeIZ8N.js} +1 -1
  86. package/dist/wizard-session-BUhlJ1b8.js.map +1 -1
  87. package/dist/yara-hooks-BE3OXk2V.js +2 -0
  88. package/dist/{yara-hooks-DeLjTIiJ.js → yara-hooks-CCGjiVA2.js} +4 -4
  89. package/dist/{yara-hooks-DeLjTIiJ.js.map → yara-hooks-CCGjiVA2.js.map} +1 -1
  90. package/package.json +1 -1
  91. package/dist/agent-interface-C90hyvs1.js.map +0 -1
  92. package/dist/agent-prompt-loader-CBj2DWAJ.js.map +0 -1
  93. package/dist/agent-runner-DA5YfjOD.js.map +0 -1
  94. package/dist/analytics-CijpxQFN.js +0 -2
  95. package/dist/debug-BTPYy9p7.js.map +0 -1
  96. package/dist/env-api-key-cjD4yfGT.js.map +0 -1
  97. package/dist/orchestrator-tools-DrhpNOKK.js.map +0 -1
  98. package/dist/queue-tools-zM8_mxx6.js.map +0 -1
  99. package/dist/setup-utils-iINkc0xu.js.map +0 -1
  100. package/dist/start-tui-CjtL-ls7.js.map +0 -1
  101. package/dist/store-DtckpbSC.js.map +0 -1
  102. package/dist/terminal-yKJZx1UC.js.map +0 -1
  103. package/dist/yara-hooks-DVGKhwaz.js +0 -2
package/dist/bin.js CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import { Ct as isHeadless, L as Integration, St as headlessOption, U as POSTHOG_DOCS_URL, a as getLogFilePath, f as getUI, gt as VERSION, m as LoggingUI, mt as getSkillsBaseUrl, p as setUI, pt as WIZARD_USER_AGENT, r as debug, s as logToFile, wt as regionOption } from "./debug-BTPYy9p7.js";
3
- import { n as analytics } from "./analytics-BdKBzz4M.js";
4
- import { r as setEntryCommand } from "./telemetry-BWYDFAwf.js";
5
- import { a as safeReadFile, o as walkProjectFiles } from "./bounded-fs-BU2L5mjO.js";
6
- import { n as isUsingTypeScript } from "./setup-utils-iINkc0xu.js";
7
- import { o as handleApiError } from "./api-aTkzJ9vG.js";
2
+ import { Ct as isHeadless, L as Integration, St as headlessOption, U as POSTHOG_DOCS_URL, a as getLogFilePath, f as getUI, gt as VERSION, m as LoggingUI, mt as getSkillsBaseUrl, p as setUI, pt as WIZARD_USER_AGENT, r as debug, s as logToFile, wt as regionOption } from "./debug-3FJsmlmC.js";
3
+ import { n as analytics } from "./analytics-Duy9Vfk-.js";
4
+ import { r as setEntryCommand } from "./telemetry-4VTeK1h9.js";
5
+ import { a as safeReadFile, o as walkProjectFiles } from "./bounded-fs-CvYIzQbg.js";
6
+ import { n as isUsingTypeScript } from "./setup-utils-DJF-LjYE.js";
7
+ import { o as handleApiError } from "./api-DEb25KDf.js";
8
8
  import "./wizard-session-BUhlJ1b8.js";
9
- import { r as runCleanups } from "./wizard-abort-CztG5WTv.js";
10
- import { n as isNonInteractiveEnvironment } from "./environment-lV2X1gS-.js";
11
- import { n as runAgent, s as authenticate } from "./agent-runner-DA5YfjOD.js";
12
- import { d as writeJsonAtomic } from "./queue-tools-zM8_mxx6.js";
13
- import { S as WIZARD_TOOL_NAMES, T as fetchSkillMenu, l as recoverOrphanedSettingsBackups, p as AgentSignals } from "./agent-interface-C90hyvs1.js";
14
- import { S as SETUP_REPORT_FILE, _ as AUDIT_CHECKS_KEY, g as AUDIT_CHECKS_FILE, v as AUDIT_REPORT_FILE } from "./yara-hooks-DeLjTIiJ.js";
15
- import { i as SPINNER_MESSAGE } from "./registry-DF_aKyS0.js";
16
- import { C as resolveProjectDir, _ as WAREHOUSE_ABORT_CASES, a as LINE_CHART_BLOCK, b as detectWarehouseSources, d as isClearBlock, g as HEALTH_CHECK_STEP, h as Icons, i as FUNNEL_BLOCK, m as Colors, n as integrationRunStep, o as PRODUCT_SUITE_BLOCK, r as posthogIntegrationConfig, s as StatusPeekTrigger, u as wordWrap, v as detectWarehousePrerequisites, w as gatherFrameworkContext, x as detectIntegrationProjects, y as getDetectedWarehouseSources } from "./posthog-integration-C3wuB5B1.js";
17
- import { n as readApiKeyFromEnv } from "./env-api-key-cjD4yfGT.js";
9
+ import { i as wizardAbort, r as runCleanups } from "./wizard-abort-BeuIRy5a.js";
10
+ import { n as isNonInteractiveEnvironment } from "./environment-Cyq61jKV.js";
11
+ import { n as runAgent, s as authenticate } from "./agent-runner-B4ZdNkj4.js";
12
+ import { p as writeJsonAtomic } from "./queue-tools-DED9kPuc.js";
13
+ import { S as WIZARD_TOOL_NAMES, T as fetchSkillMenu, l as recoverOrphanedSettingsBackups, p as AgentSignals } from "./agent-interface-BQfwaSe-.js";
14
+ import { S as SETUP_REPORT_FILE, _ as AUDIT_CHECKS_KEY, g as AUDIT_CHECKS_FILE, v as AUDIT_REPORT_FILE } from "./yara-hooks-CCGjiVA2.js";
15
+ import { i as SPINNER_MESSAGE, t as FRAMEWORK_REGISTRY } from "./registry-Dh9aqVC6.js";
16
+ import { C as scopeInstallDirToProject, D as detectFramework, E as gatherFrameworkContext, S as detectIntegrationProjects, T as resolveProjectDir, _ as HEALTH_CHECK_STEP, a as LINE_CHART_BLOCK, b as getDetectedWarehouseSources, d as isClearBlock, g as detectPostHogIntegration, h as Icons, i as FUNNEL_BLOCK, m as Colors, n as integrationRunStep, o as PRODUCT_SUITE_BLOCK, r as posthogIntegrationConfig, s as StatusPeekTrigger, u as wordWrap, v as WAREHOUSE_ABORT_CASES, x as detectWarehouseSources, y as detectWarehousePrerequisites } from "./posthog-integration-BHqFQd4U.js";
17
+ import { n as readApiKeyFromEnv } from "./env-api-key-uk6HInaB.js";
18
18
  import { satisfies } from "semver";
19
19
  import yargs from "yargs";
20
20
  import { hideBin } from "yargs/helpers";
@@ -202,7 +202,7 @@ function runProvision(argv) {
202
202
  }
203
203
  async function provision({ email, region, name, baseUrl, jsonMode }) {
204
204
  try {
205
- const { provisionNewAccount } = await import("./provisioning-IKacrvWB.js").then((n) => n.r);
205
+ const { provisionNewAccount } = await import("./provisioning-B41dKvno.js").then((n) => n.r);
206
206
  if (!jsonMode) getUI().log.info(`Provisioning account for ${email} in ${region}...`);
207
207
  emitResult(await provisionNewAccount(email, name, region, { baseUrl }), jsonMode);
208
208
  process.exit(0);
@@ -269,22 +269,22 @@ const basicIntegrationCommand = {
269
269
  setEntryCommand("integrate");
270
270
  (async () => {
271
271
  if (isHeadless(argv)) {
272
- const { runHeadlessInstall } = await import("./ci-install-BnTAUOz8.js");
272
+ const { runHeadlessInstall } = await import("./ci-install-k2HWuLQ3.js");
273
273
  return runHeadlessInstall(argv);
274
274
  }
275
275
  if (argv.ci) {
276
- const { runCIInstall } = await import("./ci-install-BnTAUOz8.js");
276
+ const { runCIInstall } = await import("./ci-install-k2HWuLQ3.js");
277
277
  return runCIInstall(argv);
278
278
  }
279
279
  if (isNonInteractiveEnvironment()) {
280
- const { failNonInteractive } = await import("./non-interactive-EG_lII4R.js");
280
+ const { failNonInteractive } = await import("./non-interactive-DOG-p4ku.js");
281
281
  return failNonInteractive();
282
282
  }
283
283
  if (argv.playground) {
284
- const { runPlayground } = await import("./playground-BjWqoWhf.js");
284
+ const { runPlayground } = await import("./playground-DaTeK9-L.js");
285
285
  return runPlayground();
286
286
  }
287
- const { runInteractive } = await import("./interactive-DMoXEiKo.js");
287
+ const { runInteractive } = await import("./interactive-BDCUPSmr.js");
288
288
  runInteractive(argv);
289
289
  })();
290
290
  }
@@ -3238,6 +3238,64 @@ STEP 7 — Write the report and hand off. (skill: "Report")
3238
3238
  deferred. Tell the user findings will start appearing in their inbox
3239
3239
  at ${inboxUrl} within about 30 minutes.`;
3240
3240
  }
3241
+ //#endregion
3242
+ //#region src/lib/programs/self-driving/step-keys.ts
3243
+ /**
3244
+ * First match wins, so order is the rule. Entity words come before verbs: "Checking GitHub
3245
+ * connection" is the GitHub step, not the access-check step, and "Connecting issue trackers" must
3246
+ * not fall through to GitHub just because a later run words it "Connecting GitHub issues".
3247
+ */
3248
+ const RULES = [
3249
+ {
3250
+ key: "connect_issue_trackers",
3251
+ match: /issue[\s-]?track/i
3252
+ },
3253
+ {
3254
+ key: "setup_replay_vision",
3255
+ match: /replay vision|vision scanner/i
3256
+ },
3257
+ {
3258
+ key: "design_custom_scouts",
3259
+ match: /custom scout|designing scout/i
3260
+ },
3261
+ {
3262
+ key: "configure_scouts",
3263
+ match: /scout troop|tun(e|ing) .*scout|configur\w* .*scout/i
3264
+ },
3265
+ {
3266
+ key: "enable_signal_sources",
3267
+ match: /signal source/i
3268
+ },
3269
+ {
3270
+ key: "connect_github",
3271
+ match: /github/i
3272
+ },
3273
+ {
3274
+ key: "enable_products",
3275
+ match: /product/i
3276
+ },
3277
+ {
3278
+ key: "write_report",
3279
+ match: /report/i
3280
+ },
3281
+ {
3282
+ key: "check_access",
3283
+ match: /access/i
3284
+ },
3285
+ {
3286
+ key: "read_context",
3287
+ match: /read|context|project state/i
3288
+ }
3289
+ ];
3290
+ /**
3291
+ * The canonical key for an agent-authored step label, or `undefined` when nothing matches — an
3292
+ * unmatched step is left unkeyed rather than bucketed, so a new step shows up as a gap to name
3293
+ * instead of quietly inflating whichever key it landed nearest.
3294
+ */
3295
+ function resolveSelfDrivingStepKey(stepName) {
3296
+ if (!stepName) return void 0;
3297
+ return RULES.find((rule) => rule.match.test(stepName))?.key;
3298
+ }
3241
3299
  /** One line, for a screen that only has room to say what it costs. */
3242
3300
  const PRICING_SHORT = `Agents charge a flat $15 per pull request they ship.`;
3243
3301
  /** The same fact at length, plus the bit people are surprised by later. */
@@ -3643,6 +3701,7 @@ const buildRun = (session) => Promise.resolve({
3643
3701
  richLinks: true,
3644
3702
  askTimeoutMs: 1800 * 1e3,
3645
3703
  trackStepProgress: true,
3704
+ resolveStepKey: resolveSelfDrivingStepKey,
3646
3705
  postRun: async (session) => {
3647
3706
  await removeInstalledSkill(session.installDir);
3648
3707
  },
@@ -3817,6 +3876,147 @@ const mcpAnalyticsConfig = createSkillProgram({
3817
3876
  ]
3818
3877
  });
3819
3878
  //#endregion
3879
+ //#region src/lib/programs/replay-vision/index.ts
3880
+ const REPLAY_VISION_REPORT_FILE = "posthog-replay-vision-report.md";
3881
+ /**
3882
+ * The platforms session replay can actually record on. Replay vision watches
3883
+ * recordings, so a platform with no recordings has nothing to set up — the
3884
+ * run must stop before any work, not after a pointless agent run.
3885
+ *
3886
+ * Web frameworks record through posthog-js (server-rendered frameworks
3887
+ * included — they serve pages), and the mobile SDKs with replay support are
3888
+ * React Native, Android, iOS, and Flutter. Excluded: pure backend targets
3889
+ * (`javascript_node`, `python`, `ruby`) and KMP, which has no replay support
3890
+ * yet.
3891
+ */
3892
+ const REPLAY_VISION_SUPPORTED = new Set([
3893
+ "nextjs",
3894
+ "nuxt",
3895
+ "vue",
3896
+ "react-router",
3897
+ "tanstack-start",
3898
+ "tanstack-router",
3899
+ "angular",
3900
+ "astro",
3901
+ "sveltekit",
3902
+ "javascript_web",
3903
+ "django",
3904
+ "flask",
3905
+ "fastapi",
3906
+ "laravel",
3907
+ "rails",
3908
+ "react-native",
3909
+ "android",
3910
+ "swift",
3911
+ "flutter"
3912
+ ]);
3913
+ async function abortUnsupportedPlatform(integration) {
3914
+ await wizardAbort({
3915
+ message: `Session replay isn't available for ${FRAMEWORK_REGISTRY[integration]?.metadata.name ?? integration} projects, and Replay vision needs session recordings to watch — so there is nothing to set up here.
3916
+
3917
+ If this repo also contains a web or mobile app, run the command from that project directory instead. See what replay supports at:
3918
+ https://posthog.com/docs/session-replay`,
3919
+ error: /* @__PURE__ */ new Error(`Replay vision unsupported platform: ${integration}`)
3920
+ });
3921
+ }
3922
+ /**
3923
+ * `[ABORT]` reasons the replay-vision skill emits when the run can't proceed.
3924
+ * Kept in sync with the stop conditions in the skill's `description.md`
3925
+ * (context-mill `context/skills/replay-vision`).
3926
+ */
3927
+ const REPLAY_VISION_ABORT_CASES = [{
3928
+ match: /^replay vision not available for this project$/i,
3929
+ message: "Replay vision is not available for this project",
3930
+ body: "Every Replay vision scanner endpoint reported that the feature is not available here yet. Session replay setup done so far is kept. See https://posthog.com/docs/replay-vision for availability."
3931
+ }];
3932
+ /**
3933
+ * Framework detection ahead of the run, exactly like the default integration
3934
+ * program. The orchestrator requires it: `session.skillId` must hold the
3935
+ * detected framework id before the run arm starts, because the runner
3936
+ * resolves the reference integration skill and every task's mini-skill
3937
+ * variants (`integration-v2-install`, `integration-v2-init`, …) against it in
3938
+ * preflight. Without this step the session would still carry the program's
3939
+ * own skill id and preflight would abort.
3940
+ */
3941
+ const DETECT_STEP = {
3942
+ id: "detect",
3943
+ label: "Detecting framework",
3944
+ onReady: async (ctx) => {
3945
+ const integration = await detectFramework(ctx.session.installDir);
3946
+ if (integration && !REPLAY_VISION_SUPPORTED.has(integration)) {
3947
+ await abortUnsupportedPlatform(integration);
3948
+ return;
3949
+ }
3950
+ await detectPostHogIntegration(ctx);
3951
+ }
3952
+ };
3953
+ /**
3954
+ * `wizard replay-vision` — flat skill command on the orchestrator sequence.
3955
+ *
3956
+ * Makes session replay record (server toggle + client init check), then
3957
+ * creates vision scanners scoped to the product's key flows, read out of the
3958
+ * repo. The orchestrator runs the `replay-vision` agent flow (context-mill
3959
+ * `context/agents/replay-vision`): the seed enqueues the install/init tasks
3960
+ * (copied from integration-v2, sharing its step-skills) when the project has
3961
+ * no PostHog yet, so the command works on uninstrumented repos instead of
3962
+ * aborting.
3963
+ *
3964
+ * Departures from a plain `createSkillProgram`:
3965
+ * - `DETECT_STEP` in front, so `session.skillId` carries the framework id the
3966
+ * orchestrator's preflight resolves reference + mini-skill variants with.
3967
+ * - `agentFlow` pinned (the id would default to the same value — explicit so
3968
+ * renaming the program can't silently detach the flow).
3969
+ * - `ciPreRun` mirrors the default integration program: scope the install dir
3970
+ * to the right project (monorepos), then detect the framework — the
3971
+ * headless equivalent of the detect step's onReady hook.
3972
+ */
3973
+ const replayVisionConfig = {
3974
+ ...createSkillProgram({
3975
+ skillId: "replay-vision-setup",
3976
+ command: "replay-vision",
3977
+ id: "replay-vision",
3978
+ description: "Set up PostHog Replay vision scanners for your product",
3979
+ integrationLabel: "replay-vision",
3980
+ customPrompt: `Set up PostHog Replay vision. Run the \`replay-vision\` skill end-to-end: make sure session replay is recording (server-side enable plus a posthog-js init check), then create the vision scanners the skill defines, scoped to this product's key flows read out of the repo. If PostHog is not integrated yet, install and initialize the SDK first as the skill instructs — do not abort. The final report is written to ./${REPLAY_VISION_REPORT_FILE}.`,
3981
+ successMessage: `Replay vision configured! View the report at ./${REPLAY_VISION_REPORT_FILE}`,
3982
+ reportFile: REPLAY_VISION_REPORT_FILE,
3983
+ docsUrl: "https://posthog.com/docs/replay-vision",
3984
+ spinnerMessage: "Setting up Replay vision...",
3985
+ estimatedDurationMinutes: 6,
3986
+ abortCases: REPLAY_VISION_ABORT_CASES
3987
+ }),
3988
+ agentFlow: "replay-vision",
3989
+ steps: [DETECT_STEP, ...AGENT_SKILL_STEPS],
3990
+ ciPreRun: async (session) => {
3991
+ await scopeInstallDirToProject(session);
3992
+ const integration = await detectFramework(session.installDir);
3993
+ if (!integration) {
3994
+ await wizardAbort({ message: "Could not auto-detect your framework for this project." });
3995
+ return;
3996
+ }
3997
+ if (!REPLAY_VISION_SUPPORTED.has(integration)) {
3998
+ await abortUnsupportedPlatform(integration);
3999
+ return;
4000
+ }
4001
+ session.integration = integration;
4002
+ analytics.setTag("integration", integration);
4003
+ const frameworkConfig = FRAMEWORK_REGISTRY[integration];
4004
+ session.frameworkConfig = frameworkConfig;
4005
+ session.skillId = integration;
4006
+ const context = await gatherFrameworkContext(frameworkConfig, {
4007
+ installDir: session.installDir,
4008
+ debug: session.debug,
4009
+ default: false,
4010
+ signup: session.signup,
4011
+ localMcp: session.localMcp,
4012
+ ci: true,
4013
+ benchmark: session.benchmark,
4014
+ yaraReport: session.yaraReport
4015
+ });
4016
+ for (const [key, value] of Object.entries(context)) if (!(key in session.frameworkContext)) session.frameworkContext[key] = value;
4017
+ }
4018
+ };
4019
+ //#endregion
3820
4020
  //#region src/lib/programs/ai-observability/index.ts
3821
4021
  const AI_OBSERVABILITY_STEPS = AGENT_SKILL_STEPS.map((step) => step.id === "intro" ? {
3822
4022
  ...step,
@@ -3920,6 +4120,7 @@ const PROGRAM_REGISTRY = [
3920
4120
  mcpRemoveConfig,
3921
4121
  mcpTutorialConfig,
3922
4122
  mcpAnalyticsConfig,
4123
+ replayVisionConfig,
3923
4124
  aiObservabilityConfig,
3924
4125
  slackConnectConfig
3925
4126
  ];
@@ -3944,6 +4145,7 @@ const Program = {
3944
4145
  McpRemove: mcpRemoveConfig.id,
3945
4146
  McpTutorial: mcpTutorialConfig.id,
3946
4147
  McpAnalytics: mcpAnalyticsConfig.id,
4148
+ ReplayVision: replayVisionConfig.id,
3947
4149
  AiObservability: aiObservabilityConfig.id,
3948
4150
  SlackConnect: slackConnectConfig.id
3949
4151
  };
@@ -3991,12 +4193,12 @@ const mcpAddCommand = {
3991
4193
  function runMcpAdd(argv) {
3992
4194
  const features = parseFeatures(argv.features);
3993
4195
  (async () => {
3994
- const { readApiKeyFromEnv } = await import("./env-api-key-cjD4yfGT.js").then((n) => n.t);
4196
+ const { readApiKeyFromEnv } = await import("./env-api-key-uk6HInaB.js").then((n) => n.t);
3995
4197
  const apiKey = argv.apiKey || readApiKeyFromEnv();
3996
4198
  const debug = argv.debug;
3997
4199
  const localMcp = argv.local;
3998
4200
  try {
3999
- const { startTUI } = await import("./start-tui-CjtL-ls7.js");
4201
+ const { startTUI } = await import("./start-tui-0p-Ybwxe.js");
4000
4202
  const { buildSession } = await import("./wizard-session-DZUDtS5d.js");
4001
4203
  const tui = startTUI(VERSION, Program.McpAdd);
4002
4204
  tui.store.session = buildSession({
@@ -4009,7 +4211,7 @@ function runMcpAdd(argv) {
4009
4211
  } catch (error) {
4010
4212
  if (!isTUIUnavailable(error)) throw error;
4011
4213
  setUI(new LoggingUI());
4012
- const { addMCPServerToClientsStep } = await import("./add-mcp-server-to-clients-Bzl7_wB3.js").then((n) => n.r);
4214
+ const { addMCPServerToClientsStep } = await import("./add-mcp-server-to-clients-D9l1dyw9.js").then((n) => n.r);
4013
4215
  await addMCPServerToClientsStep({
4014
4216
  local: localMcp,
4015
4217
  features,
@@ -4039,7 +4241,7 @@ function runMcpRemove(argv) {
4039
4241
  const debug = argv.debug;
4040
4242
  const localMcp = argv.local;
4041
4243
  try {
4042
- const { startTUI } = await import("./start-tui-CjtL-ls7.js");
4244
+ const { startTUI } = await import("./start-tui-0p-Ybwxe.js");
4043
4245
  const { buildSession } = await import("./wizard-session-DZUDtS5d.js");
4044
4246
  const tui = startTUI(VERSION, Program.McpRemove);
4045
4247
  tui.store.session = buildSession({
@@ -4050,7 +4252,7 @@ function runMcpRemove(argv) {
4050
4252
  } catch (error) {
4051
4253
  if (!isTUIUnavailable(error)) throw error;
4052
4254
  setUI(new LoggingUI());
4053
- const { removeMCPServerFromClientsStep } = await import("./add-mcp-server-to-clients-Bzl7_wB3.js").then((n) => n.r);
4255
+ const { removeMCPServerFromClientsStep } = await import("./add-mcp-server-to-clients-D9l1dyw9.js").then((n) => n.r);
4054
4256
  await removeMCPServerFromClientsStep({ local: localMcp });
4055
4257
  }
4056
4258
  })();
@@ -4072,7 +4274,7 @@ function runMcpTutorial(argv) {
4072
4274
  const debug = argv.debug;
4073
4275
  const localMcp = argv.local;
4074
4276
  try {
4075
- const { startTUI } = await import("./start-tui-CjtL-ls7.js");
4277
+ const { startTUI } = await import("./start-tui-0p-Ybwxe.js");
4076
4278
  const { buildSession } = await import("./wizard-session-DZUDtS5d.js");
4077
4279
  const tui = startTUI(VERSION, Program.McpTutorial);
4078
4280
  tui.store.session = buildSession({
@@ -4154,10 +4356,10 @@ function runWizard(config, options) {
4154
4356
  (async () => {
4155
4357
  try {
4156
4358
  const installDir = options.installDir || process.cwd();
4157
- const { startTUI } = await import("./start-tui-CjtL-ls7.js");
4359
+ const { startTUI } = await import("./start-tui-0p-Ybwxe.js");
4158
4360
  const { buildSession, RunPhase } = await import("./wizard-session-DZUDtS5d.js");
4159
- const { TaskStreamPush } = await import("./task-stream-DGBUveUD.js");
4160
- const { PostHogDestination } = await import("./posthog-3ijs_66W.js");
4361
+ const { TaskStreamPush } = await import("./task-stream-B0Eo4KX1.js");
4362
+ const { PostHogDestination } = await import("./posthog-DvM4V-to.js");
4161
4363
  tui = startTUI(WIZARD_VERSION, config.id);
4162
4364
  const activeTui = tui;
4163
4365
  const session = buildSession({
@@ -4223,7 +4425,7 @@ function runWizard(config, options) {
4223
4425
  if (shown(step)) await advanceStep(step, activeTui.store, config);
4224
4426
  }
4225
4427
  else if (skipAgent) {
4226
- const { getOrAskForProjectData } = await import("./setup-utils-iINkc0xu.js").then((n) => n.r);
4428
+ const { getOrAskForProjectData } = await import("./setup-utils-DJF-LjYE.js").then((n) => n.r);
4227
4429
  const { projectApiKey, host, accessToken, projectId } = await getOrAskForProjectData({
4228
4430
  signup: session.signup,
4229
4431
  ci: session.ci,
@@ -4325,10 +4527,10 @@ function runNonInteractive(config, options, mode) {
4325
4527
  (async () => {
4326
4528
  const path = await import("path");
4327
4529
  const { buildSession, RunPhase, OutroKind } = await import("./wizard-session-DZUDtS5d.js");
4328
- const { readEnvironment } = await import("./environment-lV2X1gS-.js").then((n) => n.t);
4329
- const { readApiKeyFromEnv } = await import("./env-api-key-cjD4yfGT.js").then((n) => n.t);
4330
- const { configureLogFileFromEnvironment, logToFile } = await import("./debug-D2L-fM_I.js");
4331
- const { wizardAbort, WizardError } = await import("./wizard-abort-Cjk5z73h.js");
4530
+ const { readEnvironment } = await import("./environment-Cyq61jKV.js").then((n) => n.t);
4531
+ const { readApiKeyFromEnv } = await import("./env-api-key-uk6HInaB.js").then((n) => n.t);
4532
+ const { configureLogFileFromEnvironment, logToFile } = await import("./debug-D7eikh3K.js");
4533
+ const { wizardAbort, WizardError } = await import("./wizard-abort-DNHeIZ8N.js");
4332
4534
  configureLogFileFromEnvironment();
4333
4535
  const env = readEnvironment();
4334
4536
  const apiKey = options.apiKey ?? readApiKeyFromEnv() ?? void 0;
@@ -4361,9 +4563,9 @@ function runNonInteractive(config, options, mode) {
4361
4563
  let store = null;
4362
4564
  let taskStream = null;
4363
4565
  if (mode === "headless") {
4364
- const { WizardStore } = await import("./store-DtckpbSC.js").then((n) => n.n);
4365
- const { HeadlessUI } = await import("./headless-ui-TSoOsa3j.js");
4366
- const { TaskStreamPush, PostHogDestination } = await import("./task-stream-DGBUveUD.js");
4566
+ const { WizardStore } = await import("./store-BgOhG49V.js").then((n) => n.n);
4567
+ const { HeadlessUI } = await import("./headless-ui-MpPKNNH9.js");
4568
+ const { TaskStreamPush, PostHogDestination } = await import("./task-stream-B0Eo4KX1.js");
4367
4569
  store = new WizardStore(config.id);
4368
4570
  store.session = session;
4369
4571
  setUI(new HeadlessUI(store));
@@ -4419,7 +4621,7 @@ function runNonInteractive(config, options, mode) {
4419
4621
  });
4420
4622
  }
4421
4623
  }
4422
- const { runAgent } = await import("./agent-runner-DA5YfjOD.js").then((n) => n.t);
4624
+ const { runAgent } = await import("./agent-runner-B4ZdNkj4.js").then((n) => n.t);
4423
4625
  await runAgent(config, session);
4424
4626
  await settleStream(RunPhase.Completed);
4425
4627
  } catch (error) {
@@ -4563,6 +4765,17 @@ function nativeCommandFactory(config, opts = {}) {
4563
4765
  */
4564
4766
  const mcpAnalyticsCommand = nativeCommandFactory(mcpAnalyticsConfig);
4565
4767
  //#endregion
4768
+ //#region src/commands/replay-vision.ts
4769
+ /**
4770
+ * `wizard replay-vision` — flat skill command, set up Replay vision today.
4771
+ *
4772
+ * Enables session replay recording and creates vision scanners tailored to
4773
+ * the product's key flows. Runs the `replay-vision` orchestrator flow, which
4774
+ * reuses the integration-v2 install/init mini-agents when the repo has no
4775
+ * PostHog integration yet.
4776
+ */
4777
+ const replayVisionCommand = nativeCommandFactory(replayVisionConfig);
4778
+ //#endregion
4566
4779
  //#region src/commands/ai-observability.ts
4567
4780
  /**
4568
4781
  * `wizard ai-observability` — flat skill command, wire AI Observability into a
@@ -5625,7 +5838,7 @@ async function runDoctorCI(options) {
5625
5838
  getUI().intro("Welcome to the PostHog setup wizard");
5626
5839
  getUI().log.info("Running posthog-doctor in CI mode");
5627
5840
  try {
5628
- const { getOrAskForProjectData } = await import("./setup-utils-iINkc0xu.js").then((n) => n.r);
5841
+ const { getOrAskForProjectData } = await import("./setup-utils-DJF-LjYE.js").then((n) => n.r);
5629
5842
  const { host, accessToken, projectId } = await getOrAskForProjectData({
5630
5843
  signup: false,
5631
5844
  ci: true,
@@ -5643,7 +5856,7 @@ async function runDoctorCI(options) {
5643
5856
  for (const issue of sorted) getUI().log.info(` • [${issue.severity}] ${getKindMeta(issue.kind).title}`);
5644
5857
  process.exit(1);
5645
5858
  } catch (error) {
5646
- const { ApiError } = await import("./api-aTkzJ9vG.js").then((n) => n.n);
5859
+ const { ApiError } = await import("./api-DEb25KDf.js").then((n) => n.n);
5647
5860
  const message = error instanceof ApiError && error.statusCode === 401 ? "Your PostHog API key is invalid or expired." : error instanceof Error ? error.message : String(error);
5648
5861
  getUI().log.error(`Doctor failed: ${message}`);
5649
5862
  process.exit(1);
@@ -5725,7 +5938,7 @@ function runSlackConnect(argv) {
5725
5938
  (async () => {
5726
5939
  const debug = argv.debug;
5727
5940
  try {
5728
- const { startTUI } = await import("./start-tui-CjtL-ls7.js");
5941
+ const { startTUI } = await import("./start-tui-0p-Ybwxe.js");
5729
5942
  const { buildSession } = await import("./wizard-session-DZUDtS5d.js");
5730
5943
  const tui = startTUI(VERSION, Program.SlackConnect);
5731
5944
  tui.store.session = buildSession({
@@ -6056,7 +6269,7 @@ function resolveInstallDir() {
6056
6269
  if (inline) return inline.slice(14);
6057
6270
  return process.env.POSTHOG_WIZARD_INSTALL_DIR ?? process.cwd();
6058
6271
  }
6059
- Wizard.use(basicIntegrationCommand).use(mcpCommand).use(mcpAnalyticsCommand).use(aiObservabilityCommand).use(cliCommand).use(auditCommand).use(doctorCommand).use(migrateCommand).use(revenueCommand).use(warehouseCommand).use(selfDrivingCommand).use(slackCommand).use(uploadSourcemapsCommand).use(skillCommand).init();
6272
+ Wizard.use(basicIntegrationCommand).use(mcpCommand).use(mcpAnalyticsCommand).use(replayVisionCommand).use(aiObservabilityCommand).use(cliCommand).use(auditCommand).use(doctorCommand).use(migrateCommand).use(revenueCommand).use(warehouseCommand).use(selfDrivingCommand).use(slackCommand).use(uploadSourcemapsCommand).use(skillCommand).init();
6060
6273
  //#endregion
6061
6274
  export { STRIPE_SDKS as A, MANUAL_SDK_VARIANTS as C, fetchHealthIssues as D, getKindMeta as E, getContentBlocks$3 as O, MANUAL_SDK_INSTALL as S, SOURCE_MAPS_CONTEXT_KEYS as T, detectSelfDrivingIntegrationProjects as _, useStdoutDimensions as a, DISPLAY_NAME as b, runWizardHeadless as c, PROGRAM_REGISTRY as d, Program as f, PRICING_SHORT as g, PRICING_LONG as h, useKeyboardHintsContext as i, POSTHOG_SDKS as k, runWizardCI as l, NO_DEFAULT_LIMIT as m, useKeyBindings as n, ConfirmButton as o, getProgramConfig as p, KeyboardHintsProvider as r, PromptLabel as s, PickerMenu as t, runWizard as u, SELF_DRIVING_INTEGRATE_PATH_KEY as v, RUST_SDK_CRATE as w, GO_SDK_MODULE as x, AUTOMATABLE_VARIANTS as y };
6062
6275