@posthog/wizard 2.35.0 → 2.37.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 (76) hide show
  1. package/README.md +6 -3
  2. package/dist/{add-mcp-server-to-clients-to65gLPl.js → add-mcp-server-to-clients-CNn9br9l.js} +6 -6
  3. package/dist/{add-mcp-server-to-clients-to65gLPl.js.map → add-mcp-server-to-clients-CNn9br9l.js.map} +1 -1
  4. package/dist/{agent-interface-CXL9i_vX.js → agent-interface-D8jnkEnB.js} +237 -174
  5. package/dist/agent-interface-D8jnkEnB.js.map +1 -0
  6. package/dist/{agent-runner-CCTTG_Rn.js → agent-runner-BxIYcxmA.js} +56 -102
  7. package/dist/agent-runner-BxIYcxmA.js.map +1 -0
  8. package/dist/{analytics-DP_j88IC.js → analytics-Du8Z_3oX.js} +2 -2
  9. package/dist/{analytics-DP_j88IC.js.map → analytics-Du8Z_3oX.js.map} +1 -1
  10. package/dist/{api-Bdxv7mWH.js → api-BqKMQVhj.js} +3 -3
  11. package/dist/{api-Bdxv7mWH.js.map → api-BqKMQVhj.js.map} +1 -1
  12. package/dist/bin.js +285 -59
  13. package/dist/bin.js.map +1 -1
  14. package/dist/{ci-install-BO-KLPLD.js → ci-install-UlWb3u5t.js} +4 -4
  15. package/dist/{ci-install-BO-KLPLD.js.map → ci-install-UlWb3u5t.js.map} +1 -1
  16. package/dist/{debug-Clw8ctxh.js → debug-B4AH8Ahp.js} +1 -1
  17. package/dist/{debug-DXWxKT5f.js → debug-CZwmzyDx.js} +2 -2
  18. package/dist/{debug-DXWxKT5f.js.map → debug-CZwmzyDx.js.map} +1 -1
  19. package/dist/{defaults-4rSse24X.js → defaults-UswXMiTx.js} +1 -1
  20. package/dist/{defaults-4rSse24X.js.map → defaults-UswXMiTx.js.map} +1 -1
  21. package/dist/{env-api-key-B3gE9Un0.js → env-api-key-Db-mNPK2.js} +1 -1
  22. package/dist/{env-api-key-B3gE9Un0.js.map → env-api-key-Db-mNPK2.js.map} +1 -1
  23. package/dist/{environment-C4HyCWTC.js → environment-BRXwshJO.js} +3 -3
  24. package/dist/{environment-C4HyCWTC.js.map → environment-BRXwshJO.js.map} +1 -1
  25. package/dist/{file-utils-CW8XbbZP.js → file-utils-D6CWLaOm.js} +2 -2
  26. package/dist/{file-utils-CW8XbbZP.js.map → file-utils-D6CWLaOm.js.map} +1 -1
  27. package/dist/{headless-ui-BoZYhNpE.js → headless-ui-DvkogF0b.js} +2 -2
  28. package/dist/{headless-ui-BoZYhNpE.js.map → headless-ui-DvkogF0b.js.map} +1 -1
  29. package/dist/{host-resolution-Dw0fS8h5.js → host-resolution-DrOzdKdY.js} +3 -3
  30. package/dist/{host-resolution-Dw0fS8h5.js.map → host-resolution-DrOzdKdY.js.map} +1 -1
  31. package/dist/{interactive-pwrc7QM-.js → interactive-CXL8oJwb.js} +2 -2
  32. package/dist/{interactive-pwrc7QM-.js.map → interactive-CXL8oJwb.js.map} +1 -1
  33. package/dist/{mcp-prompt-streaming-DZjjoeu3.js → mcp-prompt-streaming-Dumivcgi.js} +4 -4
  34. package/dist/{mcp-prompt-streaming-DZjjoeu3.js.map → mcp-prompt-streaming-Dumivcgi.js.map} +1 -1
  35. package/dist/{non-interactive-BW-MZYrP.js → non-interactive-BI5b25U7.js} +2 -2
  36. package/dist/{non-interactive-BW-MZYrP.js.map → non-interactive-BI5b25U7.js.map} +1 -1
  37. package/dist/{package-manager-BgXgJ1Mu.js → package-manager-9nhQBKAy.js} +2 -2
  38. package/dist/{package-manager-BgXgJ1Mu.js.map → package-manager-9nhQBKAy.js.map} +1 -1
  39. package/dist/{playground-xuLBqzJM.js → playground-DDYYs2ub.js} +7 -7
  40. package/dist/{playground-xuLBqzJM.js.map → playground-DDYYs2ub.js.map} +1 -1
  41. package/dist/{posthog-integration-Bj9WmwDq.js → posthog-integration-Cx4RvC7E.js} +29 -14
  42. package/dist/posthog-integration-Cx4RvC7E.js.map +1 -0
  43. package/dist/{provisioning-BF2reo5_.js → provisioning-PosLaOt4.js} +4 -4
  44. package/dist/{provisioning-BF2reo5_.js.map → provisioning-PosLaOt4.js.map} +1 -1
  45. package/dist/{registry-Dj17F0a-.js → registry-B43CNAAx.js} +4 -4
  46. package/dist/{registry-Dj17F0a-.js.map → registry-B43CNAAx.js.map} +1 -1
  47. package/dist/{setup-utils-DyTlaGOV.js → setup-utils-CR8X8Fmf.js} +19 -11
  48. package/dist/setup-utils-CR8X8Fmf.js.map +1 -0
  49. package/dist/{start-tui-S4fBBfmO.js → start-tui-DeewAqJg.js} +374 -24
  50. package/dist/start-tui-DeewAqJg.js.map +1 -0
  51. package/dist/{steps-CHgikk6q.js → steps-CPvI-2Ms.js} +7 -7
  52. package/dist/{steps-CHgikk6q.js.map → steps-CPvI-2Ms.js.map} +1 -1
  53. package/dist/{store-vr5j37CU.js → store-0uzey9Am.js} +55 -4
  54. package/dist/store-0uzey9Am.js.map +1 -0
  55. package/dist/{task-stream-BVF6gi8x.js → task-stream-DkbGqxZv.js} +2 -2
  56. package/dist/{task-stream-BVF6gi8x.js.map → task-stream-DkbGqxZv.js.map} +1 -1
  57. package/dist/{telemetry-CR-ilpWe.js → telemetry-DJNpvkYP.js} +3 -3
  58. package/dist/{telemetry-CR-ilpWe.js.map → telemetry-DJNpvkYP.js.map} +1 -1
  59. package/dist/{terminal-uzjco-wz.js → terminal-Bd6q58zn.js} +13 -13
  60. package/dist/{terminal-uzjco-wz.js.map → terminal-Bd6q58zn.js.map} +1 -1
  61. package/dist/{urls-ChWit8SE.js → urls-B1a2v93j.js} +2 -2
  62. package/dist/{urls-ChWit8SE.js.map → urls-B1a2v93j.js.map} +1 -1
  63. package/dist/{wizard-abort-BE_j8xUt.js → wizard-abort-BG8VNOI9.js} +4 -4
  64. package/dist/{wizard-abort-BE_j8xUt.js.map → wizard-abort-BG8VNOI9.js.map} +1 -1
  65. package/dist/{wizard-abort-CNYxdjJl.js → wizard-abort-DyAGpw-u.js} +1 -1
  66. package/dist/{wizard-session-BHoLQueN.js → wizard-session-CqihOtk3.js} +6 -1
  67. package/dist/wizard-session-CqihOtk3.js.map +1 -0
  68. package/dist/{wizard-session-D0PJ9lsl.js → wizard-session-xzqycI7i.js} +1 -1
  69. package/package.json +1 -1
  70. package/dist/agent-interface-CXL9i_vX.js.map +0 -1
  71. package/dist/agent-runner-CCTTG_Rn.js.map +0 -1
  72. package/dist/posthog-integration-Bj9WmwDq.js.map +0 -1
  73. package/dist/setup-utils-DyTlaGOV.js.map +0 -1
  74. package/dist/start-tui-S4fBBfmO.js.map +0 -1
  75. package/dist/store-vr5j37CU.js.map +0 -1
  76. package/dist/wizard-session-BHoLQueN.js.map +0 -1
@@ -1,17 +1,18 @@
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-DXWxKT5f.js";
2
- import { t as analytics } from "./analytics-DP_j88IC.js";
3
- import { o as extractOAuthCode, t as getOrAskForProjectData } from "./setup-utils-DyTlaGOV.js";
4
- import { o as getUiHostFromHost } from "./urls-ChWit8SE.js";
5
- import { t as ApiError } from "./api-Bdxv7mWH.js";
6
- import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-BHoLQueN.js";
7
- import { i as wizardAbort } from "./wizard-abort-BE_j8xUt.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-CXL9i_vX.js";
9
- import { d as Colors, f as Icons, m as detectProjectsWithAgent } from "./posthog-integration-Bj9WmwDq.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-vr5j37CU.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-uzjco-wz.js";
13
- import { t as ALL_FEATURE_VALUES } from "./defaults-4rSse24X.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-to65gLPl.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-CZwmzyDx.js";
2
+ import { t as analytics } from "./analytics-Du8Z_3oX.js";
3
+ import { o as extractOAuthCode, t as getOrAskForProjectData } from "./setup-utils-CR8X8Fmf.js";
4
+ import { o as getUiHostFromHost } from "./urls-B1a2v93j.js";
5
+ import { t as ApiError } from "./api-BqKMQVhj.js";
6
+ import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-CqihOtk3.js";
7
+ import { i as wizardAbort } from "./wizard-abort-BG8VNOI9.js";
8
+ import { A as AUDIT_SEVERITY_STYLE, D as AUDIT_CHECKS_FILE, M as getAuditChecks, O as AUDIT_CHECKS_KEY, _ as EVENT_PLAN_FILE, b as downloadSkill, j as coerceAuditChecks, x as fetchSkillMenu } from "./agent-interface-D8jnkEnB.js";
9
+ import { t as FRAMEWORK_REGISTRY } from "./registry-B43CNAAx.js";
10
+ import { g as detectProjectsWithAgent, m as Icons, p as Colors, t as SETUP_REPORT_FILE } from "./posthog-integration-Cx4RvC7E.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-0uzey9Am.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-Bd6q58zn.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-CNn9br9l.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-Dj17F0a-.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
1076
+ import("./registry-B43CNAAx.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());
@@ -4613,7 +4960,7 @@ function createMcpSuggestedPromptsServices(store) {
4613
4960
  };
4614
4961
  }
4615
4962
  async function* runProductionPromptStreaming(args) {
4616
- const { runMcpPromptViaSdk } = await import("./mcp-prompt-streaming-DZjjoeu3.js");
4963
+ const { runMcpPromptViaSdk } = await import("./mcp-prompt-streaming-Dumivcgi.js");
4617
4964
  yield* runMcpPromptViaSdk(args);
4618
4965
  }
4619
4966
  //#endregion
@@ -4642,6 +4989,9 @@ function createScreens(store, services) {
4642
4989
  ["migration-intro"]: /* @__PURE__ */ jsx(MigrationIntroScreen, { store }),
4643
4990
  ["agent-skill-intro"]: /* @__PURE__ */ jsx(AgentSkillIntroScreen, { store }),
4644
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 }),
4645
4995
  ["audit-intro"]: /* @__PURE__ */ jsx(AuditIntroScreen, { store }),
4646
4996
  ["audit-run"]: /* @__PURE__ */ jsx(AuditRunScreen, { store }),
4647
4997
  ["audit-outro"]: /* @__PURE__ */ jsx(AuditOutroScreen, { store }),
@@ -4750,4 +5100,4 @@ function startTUI(version, program = Program.PostHogIntegration) {
4750
5100
  //#endregion
4751
5101
  export { startTUI };
4752
5102
 
4753
- //# sourceMappingURL=start-tui-S4fBBfmO.js.map
5103
+ //# sourceMappingURL=start-tui-DeewAqJg.js.map