@posthog/wizard 2.34.0 → 2.36.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 (83) hide show
  1. package/dist/{add-mcp-server-to-clients-BjH4z7gH.js → add-mcp-server-to-clients-D5e3JbUC.js} +6 -6
  2. package/dist/{add-mcp-server-to-clients-BjH4z7gH.js.map → add-mcp-server-to-clients-D5e3JbUC.js.map} +1 -1
  3. package/dist/{agent-interface-BcUv1qeh.js → agent-interface-CPn9pZ8j.js} +204 -175
  4. package/dist/agent-interface-CPn9pZ8j.js.map +1 -0
  5. package/dist/{agent-runner-8g_pDAVs.js → agent-runner-Cic1uZZ8.js} +58 -41
  6. package/dist/agent-runner-Cic1uZZ8.js.map +1 -0
  7. package/dist/{analytics-DQ8IS1Hu.js → analytics-Be_wRgxD.js} +2 -2
  8. package/dist/{analytics-DQ8IS1Hu.js.map → analytics-Be_wRgxD.js.map} +1 -1
  9. package/dist/{api-EghEV_u9.js → api-C_R_ybiA.js} +3 -3
  10. package/dist/{api-EghEV_u9.js.map → api-C_R_ybiA.js.map} +1 -1
  11. package/dist/bin.js +297 -68
  12. package/dist/bin.js.map +1 -1
  13. package/dist/{ci-install-ouGSf4zp.js → ci-install-B0BHTkGI.js} +5 -5
  14. package/dist/ci-install-B0BHTkGI.js.map +1 -0
  15. package/dist/{debug-Cn4L5Ype.js → debug-BpWrz3hX.js} +3 -4
  16. package/dist/debug-BpWrz3hX.js.map +1 -0
  17. package/dist/{debug-BM7yop-T.js → debug-DJS2KPGb.js} +1 -1
  18. package/dist/{defaults-DII5CAog.js → defaults-UswXMiTx.js} +1 -1
  19. package/dist/{defaults-DII5CAog.js.map → defaults-UswXMiTx.js.map} +1 -1
  20. package/dist/{env-api-key-MlzJYAvt.js → env-api-key-Db-mNPK2.js} +1 -1
  21. package/dist/{env-api-key-MlzJYAvt.js.map → env-api-key-Db-mNPK2.js.map} +1 -1
  22. package/dist/{environment-D2WUIm8o.js → environment-Dc6VTWyK.js} +3 -3
  23. package/dist/{environment-D2WUIm8o.js.map → environment-Dc6VTWyK.js.map} +1 -1
  24. package/dist/{file-utils-CdQn6073.js → file-utils-Buj9-umf.js} +2 -2
  25. package/dist/{file-utils-CdQn6073.js.map → file-utils-Buj9-umf.js.map} +1 -1
  26. package/dist/{headless-ui-CSqtmW-d.js → headless-ui-BplqZRcO.js} +2 -2
  27. package/dist/{headless-ui-CSqtmW-d.js.map → headless-ui-BplqZRcO.js.map} +1 -1
  28. package/dist/host-resolution-BD6TcZG0.js +115 -0
  29. package/dist/host-resolution-BD6TcZG0.js.map +1 -0
  30. package/dist/{interactive-CFGcWw43.js → interactive-BspTioP_.js} +2 -2
  31. package/dist/{interactive-CFGcWw43.js.map → interactive-BspTioP_.js.map} +1 -1
  32. package/dist/{mcp-prompt-streaming-XZSpcXkG.js → mcp-prompt-streaming-BCNzyL12.js} +5 -5
  33. package/dist/mcp-prompt-streaming-BCNzyL12.js.map +1 -0
  34. package/dist/{non-interactive-D6eksWIw.js → non-interactive-CFikUAzO.js} +2 -2
  35. package/dist/{non-interactive-D6eksWIw.js.map → non-interactive-CFikUAzO.js.map} +1 -1
  36. package/dist/{package-manager-Dozr4x6K.js → package-manager-L7gsAbE0.js} +2 -2
  37. package/dist/{package-manager-Dozr4x6K.js.map → package-manager-L7gsAbE0.js.map} +1 -1
  38. package/dist/{playground-BB2O8GyY.js → playground-Bl2iPxdt.js} +7 -7
  39. package/dist/{playground-BB2O8GyY.js.map → playground-Bl2iPxdt.js.map} +1 -1
  40. package/dist/{posthog-DU6JXG00.js → posthog-BrLFkaji.js} +1 -1
  41. package/dist/{posthog-DU6JXG00.js.map → posthog-BrLFkaji.js.map} +1 -1
  42. package/dist/{posthog-integration-C3m_uR5A.js → posthog-integration-B6pTHVcn.js} +32 -17
  43. package/dist/posthog-integration-B6pTHVcn.js.map +1 -0
  44. package/dist/{provisioning-wMzPfaaP.js → provisioning-C9ts56R5.js} +28 -9
  45. package/dist/provisioning-C9ts56R5.js.map +1 -0
  46. package/dist/{registry-BfTeAX2z.js → registry-DFazVUSE.js} +4 -4
  47. package/dist/{registry-BfTeAX2z.js.map → registry-DFazVUSE.js.map} +1 -1
  48. package/dist/{setup-utils-B0oz3raQ.js → setup-utils-BxdW2R0r.js} +56 -29
  49. package/dist/setup-utils-BxdW2R0r.js.map +1 -0
  50. package/dist/{start-tui-B9qDcoGA.js → start-tui-oGWfxdTd.js} +404 -35
  51. package/dist/start-tui-oGWfxdTd.js.map +1 -0
  52. package/dist/{steps-BhERMRRI.js → steps-O0v5UU1G.js} +7 -7
  53. package/dist/{steps-BhERMRRI.js.map → steps-O0v5UU1G.js.map} +1 -1
  54. package/dist/{store-J2Rv955W.js → store-Di9OvMql.js} +55 -4
  55. package/dist/store-Di9OvMql.js.map +1 -0
  56. package/dist/{task-stream-CPjpHFhI.js → task-stream-DkbGqxZv.js} +3 -3
  57. package/dist/{task-stream-CPjpHFhI.js.map → task-stream-DkbGqxZv.js.map} +1 -1
  58. package/dist/{telemetry-BTLJ-YnG.js → telemetry-D5WQ4-Ic.js} +3 -3
  59. package/dist/{telemetry-BTLJ-YnG.js.map → telemetry-D5WQ4-Ic.js.map} +1 -1
  60. package/dist/{terminal-UwqFnPrL.js → terminal-Bd-k7pCi.js} +14 -14
  61. package/dist/{terminal-UwqFnPrL.js.map → terminal-Bd-k7pCi.js.map} +1 -1
  62. package/dist/urls-DpTCPWLD.js +67 -0
  63. package/dist/urls-DpTCPWLD.js.map +1 -0
  64. package/dist/{wizard-abort-BAB8yvGF.js → wizard-abort-C1t9M-JN.js} +1 -1
  65. package/dist/{wizard-abort-DqeMgCVr.js → wizard-abort-t41wO4Bh.js} +4 -4
  66. package/dist/{wizard-abort-DqeMgCVr.js.map → wizard-abort-t41wO4Bh.js.map} +1 -1
  67. package/dist/{wizard-session-CN55LYyZ.js → wizard-session-CqihOtk3.js} +7 -1
  68. package/dist/wizard-session-CqihOtk3.js.map +1 -0
  69. package/dist/{wizard-session-BKEdX9mO.js → wizard-session-xzqycI7i.js} +1 -1
  70. package/package.json +1 -1
  71. package/dist/agent-interface-BcUv1qeh.js.map +0 -1
  72. package/dist/agent-runner-8g_pDAVs.js.map +0 -1
  73. package/dist/ci-install-ouGSf4zp.js.map +0 -1
  74. package/dist/debug-Cn4L5Ype.js.map +0 -1
  75. package/dist/mcp-prompt-streaming-XZSpcXkG.js.map +0 -1
  76. package/dist/posthog-integration-C3m_uR5A.js.map +0 -1
  77. package/dist/provisioning-wMzPfaaP.js.map +0 -1
  78. package/dist/setup-utils-B0oz3raQ.js.map +0 -1
  79. package/dist/start-tui-B9qDcoGA.js.map +0 -1
  80. package/dist/store-J2Rv955W.js.map +0 -1
  81. package/dist/urls-DAVzgHGZ.js +0 -35
  82. package/dist/urls-DAVzgHGZ.js.map +0 -1
  83. package/dist/wizard-session-CN55LYyZ.js.map +0 -1
@@ -1,17 +1,18 @@
1
- import { B as POSTHOG_PRIVACY_URL, G as REMOTE_SKILLS_BASE_URL, I as POSTHOG_DOCS_URL, M as OAUTH_PORTS, N as OAUTH_TIMEOUT_MS, U as POSTHOG_TERMS_URL, Z as WIZARD_TOOLS_MENU_FLAG_KEY, _ as SIGNUP_WIZARD_READINESS_CONFIG, d as relativeToInstallDir, j as Integration, l as WIZARD_LOG_FILE, m as setUI, s as logToFile, y as getBlockingServiceKeys, z as POSTHOG_ORG_AI_SETTINGS_URL } from "./debug-Cn4L5Ype.js";
2
- import { t as analytics } from "./analytics-DQ8IS1Hu.js";
3
- import { o as extractOAuthCode, t as getOrAskForProjectData } from "./setup-utils-B0oz3raQ.js";
4
- import { a as getUiHostFromHost } from "./urls-DAVzgHGZ.js";
5
- import { t as ApiError } from "./api-EghEV_u9.js";
6
- import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-CN55LYyZ.js";
7
- import { i as wizardAbort } from "./wizard-abort-DqeMgCVr.js";
8
- import { A as getAuditChecks, E as AUDIT_CHECKS_KEY, O as AUDIT_SEVERITY_STYLE, T as AUDIT_CHECKS_FILE, b as fetchSkillMenu, g as EVENT_PLAN_FILE, k as coerceAuditChecks, y as downloadSkill } from "./agent-interface-BcUv1qeh.js";
9
- import { d as Colors, f as Icons, m as detectProjectsWithAgent } from "./posthog-integration-C3m_uR5A.js";
10
- import { _ as fetchHealthIssues, b as POSTHOG_SDKS, d as Program, f as getProgramConfig, h as SOURCE_MAPS_CONTEXT_KEYS, m as DISPLAY_NAME, n as useKeyBindings, p as AUTOMATABLE_VARIANTS, t as PickerMenu, v as getDetectedWarehouseSources, x as STRIPE_SDKS, y as getContentBlocks } from "./bin.js";
11
- import { t as WizardStore } from "./store-J2Rv955W.js";
12
- import { A as ConfirmationInput, C as TabContainer, D as LinkText, E as LogViewer, F as SplitView, M as useStdoutDimensions, N as ProgressList, O as extractUrls, P as LoadingBox, S as HNViewer, T as EventPlanViewer, _ as ServiceHealthList, a as useSkillEntry, b as LearnCard, c as AUDIT_AREA_SLIDES, d as McpSuggestedPromptsScreen, g as SEVERITY_ORDER, h as SEVERITY_LABEL, i as SkillSourceInfo, k as ModalOverlay, l as VisualBox, m as IssueTable, n as releaseTerminal, o as OutroScreen, p as McpScreen, r as AiOptInRequiredScreen, s as SlackConnectScreen, t as enterDarkTerminal, u as AuditChecksViewer, v as VisualizerTab, w as ScreenContainer, y as TipsCard } from "./terminal-UwqFnPrL.js";
13
- import { t as ALL_FEATURE_VALUES } from "./defaults-DII5CAog.js";
14
- import { a as getSupportedClients, c as removeMCPServer, i as getInstalledClients, o as getSupportedPluginClients, s as installPlugins, u as isPluginCapable } from "./add-mcp-server-to-clients-BjH4z7gH.js";
1
+ import { H as POSTHOG_TERMS_URL, I as POSTHOG_DOCS_URL, M as OAUTH_PORTS, N as OAUTH_TIMEOUT_MS, R as POSTHOG_ORG_AI_SETTINGS_URL, W as REMOTE_SKILLS_BASE_URL, X as WIZARD_TOOLS_MENU_FLAG_KEY, _ as SIGNUP_WIZARD_READINESS_CONFIG, d as relativeToInstallDir, j as Integration, l as WIZARD_LOG_FILE, m as setUI, s as logToFile, y as getBlockingServiceKeys, z as POSTHOG_PRIVACY_URL } from "./debug-BpWrz3hX.js";
2
+ import { t as analytics } from "./analytics-Be_wRgxD.js";
3
+ import { o as extractOAuthCode, t as getOrAskForProjectData } from "./setup-utils-BxdW2R0r.js";
4
+ import { o as getUiHostFromHost } from "./urls-DpTCPWLD.js";
5
+ import { t as ApiError } from "./api-C_R_ybiA.js";
6
+ import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-CqihOtk3.js";
7
+ import { i as wizardAbort } from "./wizard-abort-t41wO4Bh.js";
8
+ import { A as coerceAuditChecks, D as AUDIT_CHECKS_KEY, E as AUDIT_CHECKS_FILE, _ as EVENT_PLAN_FILE, b as downloadSkill, j as getAuditChecks, k as AUDIT_SEVERITY_STYLE, x as fetchSkillMenu } from "./agent-interface-CPn9pZ8j.js";
9
+ import { t as FRAMEWORK_REGISTRY } from "./registry-DFazVUSE.js";
10
+ import { g as detectProjectsWithAgent, m as Icons, p as Colors, t as SETUP_REPORT_FILE } from "./posthog-integration-B6pTHVcn.js";
11
+ import { C as STRIPE_SDKS, S as POSTHOG_SDKS, _ as SOURCE_MAPS_CONTEXT_KEYS, b as getDetectedWarehouseSources, d as Program, f as getProgramConfig, g as DISPLAY_NAME, h as AUTOMATABLE_VARIANTS, m as SELF_DRIVING_INTEGRATE_PATH_KEY, n as useKeyBindings, p as detectSelfDrivingIntegrationProjects, t as PickerMenu, x as getContentBlocks, y as fetchHealthIssues } from "./bin.js";
12
+ import { t as WizardStore } from "./store-Di9OvMql.js";
13
+ import { A as ConfirmationInput, C as TabContainer, D as LinkText, E as LogViewer, F as SplitView, M as useStdoutDimensions, N as ProgressList, O as extractUrls, P as LoadingBox, S as HNViewer, T as EventPlanViewer, _ as ServiceHealthList, a as useSkillEntry, b as LearnCard, c as AUDIT_AREA_SLIDES, d as McpSuggestedPromptsScreen, g as SEVERITY_ORDER, h as SEVERITY_LABEL, i as SkillSourceInfo, k as ModalOverlay, l as VisualBox, m as IssueTable, n as releaseTerminal, o as OutroScreen, p as McpScreen, r as AiOptInRequiredScreen, s as SlackConnectScreen, t as enterDarkTerminal, u as AuditChecksViewer, v as VisualizerTab, w as ScreenContainer, y as TipsCard } from "./terminal-Bd-k7pCi.js";
14
+ import { t as ALL_FEATURE_VALUES } from "./defaults-UswXMiTx.js";
15
+ import { a as getSupportedClients, c as removeMCPServer, i as getInstalledClients, o as getSupportedPluginClients, s as installPlugins, u as isPluginCapable } from "./add-mcp-server-to-clients-D5e3JbUC.js";
15
16
  import * as fs$1 from "fs";
16
17
  import path from "path";
17
18
  import { join as join$1 } from "node:path";
@@ -1072,7 +1073,7 @@ const FrameworkPicker = ({ store, onComplete }) => {
1072
1073
  })),
1073
1074
  onSelect: (value) => {
1074
1075
  const integration = Array.isArray(value) ? value[0] : value;
1075
- import("./registry-BfTeAX2z.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
1076
+ import("./registry-DFazVUSE.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
1076
1077
  const config = FRAMEWORK_REGISTRY[integration];
1077
1078
  store.setFrameworkConfig(integration, config);
1078
1079
  store.setDetectedFramework(config.metadata.name);
@@ -1969,8 +1970,8 @@ async function detectSourceMapsProjects(session, onEvent) {
1969
1970
  * Runs after auth — the detection agent needs credentials.
1970
1971
  */
1971
1972
  const EXIT = "__exit";
1972
- const MAX_ACTIVITY_LINES = 8;
1973
- function projectLabel(p) {
1973
+ const MAX_ACTIVITY_LINES$1 = 8;
1974
+ function projectLabel$1(p) {
1974
1975
  const name = p.variant ? DISPLAY_NAME[p.variant] : p.framework;
1975
1976
  const where = p.path === "." ? "repo root" : p.path;
1976
1977
  return `${name} ${Icons.bullet} ${where}`;
@@ -1989,7 +1990,7 @@ const SourceMapsDetectScreen = ({ store }) => {
1989
1990
  (async () => {
1990
1991
  try {
1991
1992
  const report = await detectSourceMapsProjects(store.session, (line) => {
1992
- if (!cancelled) setActivity((prev) => [...prev, line].slice(-MAX_ACTIVITY_LINES));
1993
+ if (!cancelled) setActivity((prev) => [...prev, line].slice(-MAX_ACTIVITY_LINES$1));
1993
1994
  });
1994
1995
  if (!cancelled) setState({
1995
1996
  kind: "ready",
@@ -2080,7 +2081,7 @@ const SourceMapsDetectScreen = ({ store }) => {
2080
2081
  ]
2081
2082
  })]
2082
2083
  }),
2083
- /* @__PURE__ */ jsx(BlockedSummary, { blocked }),
2084
+ /* @__PURE__ */ jsx(BlockedSummary$1, { blocked }),
2084
2085
  /* @__PURE__ */ jsx(Box, {
2085
2086
  marginTop: 1,
2086
2087
  children: /* @__PURE__ */ jsx(PickerMenu, {
@@ -2094,7 +2095,7 @@ const SourceMapsDetectScreen = ({ store }) => {
2094
2095
  ]
2095
2096
  });
2096
2097
  const options = [...instrumentable.map((p) => ({
2097
- label: projectLabel(p),
2098
+ label: projectLabel$1(p),
2098
2099
  value: p.path
2099
2100
  })), {
2100
2101
  label: "Cancel",
@@ -2135,7 +2136,7 @@ const SourceMapsDetectScreen = ({ store }) => {
2135
2136
  }),
2136
2137
  /* @__PURE__ */ jsx(Box, {
2137
2138
  marginTop: 1,
2138
- children: /* @__PURE__ */ jsx(BlockedSummary, { blocked })
2139
+ children: /* @__PURE__ */ jsx(BlockedSummary$1, { blocked })
2139
2140
  })
2140
2141
  ]
2141
2142
  });
@@ -2144,7 +2145,7 @@ const SourceMapsDetectScreen = ({ store }) => {
2144
2145
  * Collapses the non-instrumentable projects into a short count line (or two)
2145
2146
  * instead of listing every one — a monorepo can have dozens.
2146
2147
  */
2147
- const BlockedSummary = ({ blocked }) => {
2148
+ const BlockedSummary$1 = ({ blocked }) => {
2148
2149
  const unsupported = blocked.filter((p) => p.variant == null).length;
2149
2150
  const missingSdk = blocked.length - unsupported;
2150
2151
  if (blocked.length === 0) return null;
@@ -2580,6 +2581,352 @@ const DetectErrorBody = ({ error }) => {
2580
2581
  }
2581
2582
  };
2582
2583
  //#endregion
2584
+ //#region src/ui/tui/screens/SelfDrivingIntegrationCheckScreen.tsx
2585
+ /**
2586
+ * SelfDrivingIntegrationCheckScreen — shown only when detection found no
2587
+ * PostHog in the project. It's a notice, not a question: Self-driving requires
2588
+ * a PostHog SDK, so the single action sets `integrate = true` and the run
2589
+ * integrates first. Skipped entirely when PostHog is already present (or under
2590
+ * `--integrate`).
2591
+ */
2592
+ const SelfDrivingIntegrationCheckScreen = ({ store }) => {
2593
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
2594
+ return /* @__PURE__ */ jsxs(Box, {
2595
+ flexDirection: "column",
2596
+ flexGrow: 1,
2597
+ children: [
2598
+ /* @__PURE__ */ jsx(Text, {
2599
+ bold: true,
2600
+ color: Colors.accent,
2601
+ children: "No PostHog integration found"
2602
+ }),
2603
+ /* @__PURE__ */ jsx(Box, {
2604
+ marginTop: 1,
2605
+ flexDirection: "column",
2606
+ children: /* @__PURE__ */ jsx(Text, {
2607
+ dimColor: true,
2608
+ children: "We didn't find an existing PostHog integration in your project. Before you can self-drive, you'll need to integrate PostHog into your project to capture events and generate signals."
2609
+ })
2610
+ }),
2611
+ /* @__PURE__ */ jsx(Box, {
2612
+ marginTop: 1,
2613
+ children: /* @__PURE__ */ jsx(PickerMenu, {
2614
+ options: [{
2615
+ label: "Set up PostHog [Enter]",
2616
+ value: "yes"
2617
+ }],
2618
+ onSelect: () => store.setIntegrate(true)
2619
+ })
2620
+ })
2621
+ ]
2622
+ });
2623
+ };
2624
+ //#endregion
2625
+ //#region src/ui/tui/screens/SelfDrivingIntegrationDetectScreen.tsx
2626
+ /**
2627
+ * SelfDrivingIntegrationDetectScreen — runs the Haiku detector over the repo,
2628
+ * streams progress, then renders a picker of the projects PostHog can be set up
2629
+ * in (a supported framework, no SDK yet). The user picks one — a single project
2630
+ * or the repo root is still shown as a one-item menu to confirm — and the choice
2631
+ * (framework + path) is written to the session; the integrate-run phase sets
2632
+ * PostHog up there. On a detection error, falls back to a manual framework
2633
+ * picker so the run can still proceed.
2634
+ *
2635
+ * Runs after auth — the detector needs credentials.
2636
+ */
2637
+ const CANCEL = "__cancel";
2638
+ const MAX_ACTIVITY_LINES = 8;
2639
+ function projectLabel(p) {
2640
+ const where = p.path === "." ? "repo root" : p.path;
2641
+ return `${p.framework} ${Icons.bullet} ${where}`;
2642
+ }
2643
+ const SelfDrivingIntegrationDetectScreen = ({ store }) => {
2644
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
2645
+ const { credentials } = store.session;
2646
+ const accessToken = credentials?.accessToken;
2647
+ const [state, setState] = useState({ kind: "loading" });
2648
+ const [activity, setActivity] = useState([]);
2649
+ const started = useRef(false);
2650
+ const choose = (p) => {
2651
+ if (!p.integration) return;
2652
+ store.setFrameworkContext(SELF_DRIVING_INTEGRATE_PATH_KEY, p.path);
2653
+ store.setFrameworkConfig(p.integration, FRAMEWORK_REGISTRY[p.integration]);
2654
+ };
2655
+ useEffect(() => {
2656
+ if (!accessToken || started.current) return;
2657
+ started.current = true;
2658
+ let cancelled = false;
2659
+ (async () => {
2660
+ try {
2661
+ const report = await detectSelfDrivingIntegrationProjects(store.session, (line) => {
2662
+ if (!cancelled) setActivity((prev) => [...prev, line].slice(-MAX_ACTIVITY_LINES));
2663
+ });
2664
+ if (!cancelled) setState({
2665
+ kind: "ready",
2666
+ report
2667
+ });
2668
+ } catch (err) {
2669
+ if (!cancelled) setState({
2670
+ kind: "error",
2671
+ message: err instanceof Error ? err.message : String(err)
2672
+ });
2673
+ }
2674
+ })();
2675
+ return () => {
2676
+ cancelled = true;
2677
+ };
2678
+ }, [accessToken, store]);
2679
+ if (!credentials) return /* @__PURE__ */ jsx(LoadingBox, { message: "Waiting for authentication..." });
2680
+ if (state.kind === "error") return /* @__PURE__ */ jsxs(Box, {
2681
+ flexDirection: "column",
2682
+ children: [/* @__PURE__ */ jsxs(Box, {
2683
+ flexDirection: "column",
2684
+ marginBottom: 1,
2685
+ children: [
2686
+ /* @__PURE__ */ jsxs(Text, {
2687
+ color: Colors.error,
2688
+ bold: true,
2689
+ children: [Icons.squareFilled, " Detection failed"]
2690
+ }),
2691
+ /* @__PURE__ */ jsx(Text, {
2692
+ dimColor: true,
2693
+ children: state.message
2694
+ }),
2695
+ /* @__PURE__ */ jsx(Text, {
2696
+ dimColor: true,
2697
+ children: "Pick your framework and we'll set PostHog up here."
2698
+ })
2699
+ ]
2700
+ }), /* @__PURE__ */ jsx(PickerMenu, {
2701
+ centered: true,
2702
+ columns: 2,
2703
+ message: "Select your framework",
2704
+ options: Object.values(Integration).map((v) => ({
2705
+ label: v,
2706
+ value: v
2707
+ })),
2708
+ onSelect: (value) => {
2709
+ const integration = Array.isArray(value) ? value[0] : value;
2710
+ store.setFrameworkContext(SELF_DRIVING_INTEGRATE_PATH_KEY, ".");
2711
+ store.setFrameworkConfig(integration, FRAMEWORK_REGISTRY[integration]);
2712
+ }
2713
+ })]
2714
+ });
2715
+ if (state.kind === "loading") return /* @__PURE__ */ jsxs(Box, {
2716
+ flexDirection: "column",
2717
+ children: [
2718
+ /* @__PURE__ */ jsx(Text, {
2719
+ bold: true,
2720
+ color: Colors.accent,
2721
+ children: "Detecting your project..."
2722
+ }),
2723
+ /* @__PURE__ */ jsx(Box, {
2724
+ marginY: 1,
2725
+ children: /* @__PURE__ */ jsx(LoadingBox, { message: "Scanning the repo for frameworks and PostHog SDKs..." })
2726
+ }),
2727
+ /* @__PURE__ */ jsx(Box, {
2728
+ flexDirection: "column",
2729
+ children: activity.length === 0 ? /* @__PURE__ */ jsxs(Text, {
2730
+ dimColor: true,
2731
+ children: [" ", "Starting up the detection agent…"]
2732
+ }) : activity.map((line, i) => /* @__PURE__ */ jsxs(Text, {
2733
+ dimColor: i < activity.length - 1,
2734
+ color: i === activity.length - 1 ? Colors.primary : void 0,
2735
+ children: [
2736
+ " ",
2737
+ Icons.triangleSmallRight,
2738
+ " ",
2739
+ line
2740
+ ]
2741
+ }, `${i}-${line}`))
2742
+ })
2743
+ ]
2744
+ });
2745
+ const { report } = state;
2746
+ const instrumentable = report.projects.filter((p) => p.instrumentable);
2747
+ const blocked = report.projects.filter((p) => !p.instrumentable);
2748
+ if (instrumentable.length === 0) return /* @__PURE__ */ jsxs(Box, {
2749
+ flexDirection: "column",
2750
+ children: [
2751
+ /* @__PURE__ */ jsxs(Box, {
2752
+ flexDirection: "column",
2753
+ marginBottom: 1,
2754
+ children: [/* @__PURE__ */ jsxs(Text, {
2755
+ color: Colors.error,
2756
+ bold: true,
2757
+ children: [Icons.squareFilled, " Nothing to set up here"]
2758
+ }), /* @__PURE__ */ jsxs(Text, {
2759
+ dimColor: true,
2760
+ children: [
2761
+ "None of the ",
2762
+ report.projects.length,
2763
+ " projects found can have PostHog set up."
2764
+ ]
2765
+ })]
2766
+ }),
2767
+ /* @__PURE__ */ jsx(BlockedSummary, { blocked }),
2768
+ /* @__PURE__ */ jsx(Box, {
2769
+ marginTop: 1,
2770
+ children: /* @__PURE__ */ jsx(PickerMenu, {
2771
+ options: [{
2772
+ label: "Exit",
2773
+ value: CANCEL
2774
+ }],
2775
+ onSelect: () => process.exit(0)
2776
+ })
2777
+ })
2778
+ ]
2779
+ });
2780
+ const single = instrumentable.length === 1;
2781
+ const options = [...instrumentable.map((p) => ({
2782
+ label: projectLabel(p),
2783
+ value: p.path
2784
+ })), {
2785
+ label: "Cancel",
2786
+ value: CANCEL
2787
+ }];
2788
+ return /* @__PURE__ */ jsxs(Box, {
2789
+ flexDirection: "column",
2790
+ children: [
2791
+ /* @__PURE__ */ jsx(Box, {
2792
+ flexDirection: "column",
2793
+ marginBottom: 1,
2794
+ children: /* @__PURE__ */ jsxs(Text, {
2795
+ bold: true,
2796
+ color: Colors.accent,
2797
+ children: [
2798
+ Icons.check,
2799
+ " Found",
2800
+ " ",
2801
+ report.repoType === "monorepo" ? "a monorepo" : "your project"
2802
+ ]
2803
+ })
2804
+ }),
2805
+ /* @__PURE__ */ jsx(PickerMenu, {
2806
+ message: single ? "Set up PostHog here? Confirm to continue." : "Which project should we set up PostHog in?",
2807
+ options,
2808
+ onSelect: (value) => {
2809
+ const path = Array.isArray(value) ? value[0] : value;
2810
+ if (path === CANCEL) {
2811
+ process.exit(0);
2812
+ return;
2813
+ }
2814
+ const chosen = instrumentable.find((p) => p.path === path);
2815
+ if (chosen) choose(chosen);
2816
+ }
2817
+ }),
2818
+ /* @__PURE__ */ jsx(Box, {
2819
+ marginTop: 1,
2820
+ children: /* @__PURE__ */ jsx(BlockedSummary, { blocked })
2821
+ })
2822
+ ]
2823
+ });
2824
+ };
2825
+ /**
2826
+ * Collapses the projects we didn't offer into short count lines — already has
2827
+ * PostHog, or an unsupported stack. A monorepo can have many, so we summarise.
2828
+ */
2829
+ const BlockedSummary = ({ blocked }) => {
2830
+ const alreadyIntegrated = blocked.filter((p) => p.hasPostHog).length;
2831
+ const unsupported = blocked.length - alreadyIntegrated;
2832
+ if (blocked.length === 0) return null;
2833
+ return /* @__PURE__ */ jsxs(Box, {
2834
+ flexDirection: "column",
2835
+ children: [alreadyIntegrated > 0 && /* @__PURE__ */ jsxs(Text, {
2836
+ dimColor: true,
2837
+ children: [
2838
+ "(… ",
2839
+ alreadyIntegrated,
2840
+ " project",
2841
+ alreadyIntegrated === 1 ? "" : "s",
2842
+ " ",
2843
+ "already ",
2844
+ alreadyIntegrated === 1 ? "has" : "have",
2845
+ " PostHog)"
2846
+ ]
2847
+ }), unsupported > 0 && /* @__PURE__ */ jsxs(Text, {
2848
+ dimColor: true,
2849
+ children: [
2850
+ "(… ",
2851
+ unsupported,
2852
+ " project",
2853
+ unsupported === 1 ? "" : "s",
2854
+ " not supported yet)"
2855
+ ]
2856
+ })]
2857
+ });
2858
+ };
2859
+ //#endregion
2860
+ //#region src/ui/tui/screens/SelfDrivingHandoffScreen.tsx
2861
+ /**
2862
+ * SelfDrivingHandoffScreen — the bridge between the integration run and the
2863
+ * Self-driving run. Shown only in the integrate path (PostHog wasn't present, so
2864
+ * the wizard set it up first); the already-has-PostHog path skips straight to
2865
+ * Self-driving with no note. Confirms the SDK is in, then hands off to the
2866
+ * Self-driving run.
2867
+ */
2868
+ const SelfDrivingHandoffScreen = ({ store }) => {
2869
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
2870
+ const rel = store.session.frameworkContext[SELF_DRIVING_INTEGRATE_PATH_KEY];
2871
+ const reportPath = `./${typeof rel === "string" && rel !== "." ? `${rel}/` : ""}${SETUP_REPORT_FILE}`;
2872
+ return /* @__PURE__ */ jsxs(Box, {
2873
+ flexDirection: "column",
2874
+ flexGrow: 1,
2875
+ children: [
2876
+ /* @__PURE__ */ jsx(Text, {
2877
+ bold: true,
2878
+ color: Colors.accent,
2879
+ children: "✔ PostHog is installed"
2880
+ }),
2881
+ /* @__PURE__ */ jsxs(Box, {
2882
+ marginTop: 1,
2883
+ flexDirection: "column",
2884
+ children: [
2885
+ /* @__PURE__ */ jsx(Text, { children: "Now let's make your product self-driving." }),
2886
+ /* @__PURE__ */ jsx(Box, {
2887
+ marginTop: 1,
2888
+ children: /* @__PURE__ */ jsx(Text, {
2889
+ dimColor: true,
2890
+ children: "PostHog is now integrated in your project. Now, let's connect to GitHub, turns on signal sources, and runs scouts that watch your product data and surface what needs attention."
2891
+ })
2892
+ }),
2893
+ /* @__PURE__ */ jsx(Box, {
2894
+ marginTop: 1,
2895
+ children: /* @__PURE__ */ jsx(Text, {
2896
+ dimColor: true,
2897
+ children: "This should take about 20 minutes and will occasionally need your input."
2898
+ })
2899
+ })
2900
+ ]
2901
+ }),
2902
+ /* @__PURE__ */ jsx(Box, {
2903
+ marginTop: 1,
2904
+ children: /* @__PURE__ */ jsx(PickerMenu, {
2905
+ options: [{
2906
+ label: "Set up Self-driving [Enter]",
2907
+ value: "go"
2908
+ }],
2909
+ onSelect: () => store.confirmSelfDrivingHandoff()
2910
+ })
2911
+ }),
2912
+ /* @__PURE__ */ jsx(Box, {
2913
+ marginTop: 1,
2914
+ children: /* @__PURE__ */ jsxs(Text, {
2915
+ dimColor: true,
2916
+ children: [
2917
+ "You can find your PostHog integration report at",
2918
+ " ",
2919
+ /* @__PURE__ */ jsx(Text, {
2920
+ bold: true,
2921
+ children: reportPath
2922
+ })
2923
+ ]
2924
+ })
2925
+ })
2926
+ ]
2927
+ });
2928
+ };
2929
+ //#endregion
2583
2930
  //#region src/ui/tui/screens/audit/AuditIntroScreen.tsx
2584
2931
  const AuditIntroScreen = ({ store }) => {
2585
2932
  useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
@@ -4356,16 +4703,15 @@ const WizardAskScreen = ({ store }) => {
4356
4703
  const soleUrl = promptUrls.length === 1 ? promptUrls[0] : null;
4357
4704
  const isTextQuestion = pending?.questions[index]?.kind === "text";
4358
4705
  const canActOnLink = !!soleUrl && !isTextQuestion;
4706
+ const linkSplitIndex = canActOnLink && soleUrl ? currentPrompt.indexOf(soleUrl) : -1;
4707
+ const splitLink = soleUrl !== null && linkSplitIndex !== -1;
4708
+ const linkEnd = splitLink && soleUrl ? linkSplitIndex + soleUrl.length : 0;
4709
+ const promptHead = splitLink ? currentPrompt.slice(0, linkEnd) : currentPrompt;
4710
+ const linkTrailingText = splitLink ? currentPrompt.slice(linkEnd).replace(/^\s+/, "") : "";
4359
4711
  useEffect(() => {
4360
4712
  setLinkStatus("idle");
4361
4713
  if (!soleUrl) return;
4362
- let active = true;
4363
- copyToClipboard(soleUrl).then((ok) => {
4364
- if (active && ok) setLinkStatus((s) => s === "idle" ? "copied" : s);
4365
- });
4366
- return () => {
4367
- active = false;
4368
- };
4714
+ copyToClipboard(soleUrl);
4369
4715
  }, [soleUrl]);
4370
4716
  useKeyBindings("wizard-ask-link", canActOnLink && soleUrl ? [{
4371
4717
  match: "o",
@@ -4424,11 +4770,26 @@ const WizardAskScreen = ({ store }) => {
4424
4770
  }),
4425
4771
  /* @__PURE__ */ jsx(Box, {
4426
4772
  flexDirection: "column",
4427
- children: pending.richLinks ? /* @__PURE__ */ jsx(LinkText, { text: question.prompt }) : /* @__PURE__ */ jsx(Text, { children: question.prompt })
4773
+ children: pending.richLinks ? /* @__PURE__ */ jsx(LinkText, { text: promptHead }) : /* @__PURE__ */ jsx(Text, { children: question.prompt })
4428
4774
  }),
4429
- canActOnLink && linkStatus !== "idle" && /* @__PURE__ */ jsx(Box, {
4775
+ canActOnLink && /* @__PURE__ */ jsx(Box, {
4430
4776
  marginTop: 1,
4431
- children: linkStatus === "opened" ? /* @__PURE__ */ jsxs(Text, {
4777
+ children: linkStatus === "idle" ? /* @__PURE__ */ jsxs(Text, {
4778
+ dimColor: true,
4779
+ children: [
4780
+ "Press ",
4781
+ /* @__PURE__ */ jsx(Text, {
4782
+ color: Colors.accent,
4783
+ children: "o"
4784
+ }),
4785
+ " to open it in your browser, or ",
4786
+ /* @__PURE__ */ jsx(Text, {
4787
+ color: Colors.accent,
4788
+ children: "c"
4789
+ }),
4790
+ " to copy the link."
4791
+ ]
4792
+ }) : linkStatus === "opened" ? /* @__PURE__ */ jsxs(Text, {
4432
4793
  color: Colors.success,
4433
4794
  children: [Icons.check, " Opening the link in your browser…"]
4434
4795
  }) : /* @__PURE__ */ jsxs(Text, {
@@ -4436,6 +4797,10 @@ const WizardAskScreen = ({ store }) => {
4436
4797
  children: [Icons.check, " Link copied to clipboard. Paste it in your browser."]
4437
4798
  })
4438
4799
  }),
4800
+ linkTrailingText && /* @__PURE__ */ jsx(Box, {
4801
+ marginTop: 1,
4802
+ children: /* @__PURE__ */ jsx(Text, { children: linkTrailingText })
4803
+ }),
4439
4804
  /* @__PURE__ */ jsx(Box, {
4440
4805
  marginTop: 1,
4441
4806
  children: /* @__PURE__ */ jsx(QuestionInput, {
@@ -4567,7 +4932,7 @@ function createMcpInstaller() {
4567
4932
  * in a separate module so the heavy SDK import is only paid when
4568
4933
  * actually invoked.
4569
4934
  */
4570
- function createMcpSuggestedPromptsServices(_store) {
4935
+ function createMcpSuggestedPromptsServices(store) {
4571
4936
  return {
4572
4937
  performLogin: async () => {
4573
4938
  const result = await getOrAskForProjectData({
@@ -4577,6 +4942,7 @@ function createMcpSuggestedPromptsServices(_store) {
4577
4942
  projectId: void 0,
4578
4943
  email: void 0,
4579
4944
  region: void 0,
4945
+ baseUrl: store.session.baseUrl,
4580
4946
  programId: Program.McpTutorial
4581
4947
  });
4582
4948
  return {
@@ -4594,7 +4960,7 @@ function createMcpSuggestedPromptsServices(_store) {
4594
4960
  };
4595
4961
  }
4596
4962
  async function* runProductionPromptStreaming(args) {
4597
- const { runMcpPromptViaSdk } = await import("./mcp-prompt-streaming-XZSpcXkG.js");
4963
+ const { runMcpPromptViaSdk } = await import("./mcp-prompt-streaming-BCNzyL12.js");
4598
4964
  yield* runMcpPromptViaSdk(args);
4599
4965
  }
4600
4966
  //#endregion
@@ -4623,6 +4989,9 @@ function createScreens(store, services) {
4623
4989
  ["migration-intro"]: /* @__PURE__ */ jsx(MigrationIntroScreen, { store }),
4624
4990
  ["agent-skill-intro"]: /* @__PURE__ */ jsx(AgentSkillIntroScreen, { store }),
4625
4991
  ["self-driving-intro"]: /* @__PURE__ */ jsx(SelfDrivingIntroScreen, { store }),
4992
+ ["self-driving-integration-check"]: /* @__PURE__ */ jsx(SelfDrivingIntegrationCheckScreen, { store }),
4993
+ ["self-driving-integration-detect"]: /* @__PURE__ */ jsx(SelfDrivingIntegrationDetectScreen, { store }),
4994
+ ["self-driving-handoff"]: /* @__PURE__ */ jsx(SelfDrivingHandoffScreen, { store }),
4626
4995
  ["audit-intro"]: /* @__PURE__ */ jsx(AuditIntroScreen, { store }),
4627
4996
  ["audit-run"]: /* @__PURE__ */ jsx(AuditRunScreen, { store }),
4628
4997
  ["audit-outro"]: /* @__PURE__ */ jsx(AuditOutroScreen, { store }),
@@ -4731,4 +5100,4 @@ function startTUI(version, program = Program.PostHogIntegration) {
4731
5100
  //#endregion
4732
5101
  export { startTUI };
4733
5102
 
4734
- //# sourceMappingURL=start-tui-B9qDcoGA.js.map
5103
+ //# sourceMappingURL=start-tui-oGWfxdTd.js.map