@posthog/wizard 2.14.3 → 2.16.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 (94) hide show
  1. package/README.md +43 -1
  2. package/dist/{TextBlock-DEHERFec.js → TextBlock-DJVhBkr3.js} +4 -4
  3. package/dist/TextBlock-DJVhBkr3.js.map +1 -0
  4. package/dist/{add-mcp-server-to-clients-B48J7VVO.js → add-mcp-server-to-clients-9jQjc-CO.js} +5 -5
  5. package/dist/{add-mcp-server-to-clients-B48J7VVO.js.map → add-mcp-server-to-clients-9jQjc-CO.js.map} +1 -1
  6. package/dist/{agent-interface-cEdS_bNo.js → agent-interface-pBnqJL8P.js} +106 -21
  7. package/dist/agent-interface-pBnqJL8P.js.map +1 -0
  8. package/dist/{agent-runner-CK5r-zQF.js → agent-runner-H1FP6XTc.js} +12 -9
  9. package/dist/agent-runner-H1FP6XTc.js.map +1 -0
  10. package/dist/{analytics-DaDpDus8.js → analytics-DZaUgJte.js} +2 -2
  11. package/dist/{analytics-DaDpDus8.js.map → analytics-DZaUgJte.js.map} +1 -1
  12. package/dist/analytics-DqeW7XYt.js +2 -0
  13. package/dist/bin.js +965 -83
  14. package/dist/bin.js.map +1 -1
  15. package/dist/{debug-B_PK52GI.js → debug-B6rX6xye.js} +1 -1
  16. package/dist/{debug-BOogNcWX.js → debug-C4jRuzny.js} +57 -46
  17. package/dist/debug-C4jRuzny.js.map +1 -0
  18. package/dist/{defaults-DgKAzsD1.js → defaults-GbLPuHxj.js} +1 -1
  19. package/dist/{defaults-DgKAzsD1.js.map → defaults-GbLPuHxj.js.map} +1 -1
  20. package/dist/{detection-OCF8fpfp.js → detection-4eukp9HD.js} +3 -3
  21. package/dist/{detection-OCF8fpfp.js.map → detection-4eukp9HD.js.map} +1 -1
  22. package/dist/{env-api-key-D5G2PrXW.js → env-api-key-DU8uIEvo.js} +1 -1
  23. package/dist/{env-api-key-D5G2PrXW.js.map → env-api-key-DU8uIEvo.js.map} +1 -1
  24. package/dist/{file-utils-DPmgn9Vm.js → file-utils-DnTSiTJw.js} +1 -1
  25. package/dist/file-utils-DnTSiTJw.js.map +1 -0
  26. package/dist/mcp-prompt-streaming-DKiaymMt.js +200 -0
  27. package/dist/mcp-prompt-streaming-DKiaymMt.js.map +1 -0
  28. package/dist/package-json-Cttzi3C8.js +2 -0
  29. package/dist/package-json-v_g2YlN1.js +35 -0
  30. package/dist/package-json-v_g2YlN1.js.map +1 -0
  31. package/dist/{package-manager-CmMJAD-V.js → package-manager-DLt75bit.js} +2 -2
  32. package/dist/package-manager-DLt75bit.js.map +1 -0
  33. package/dist/posthog-7B92c2Ed.js +120 -0
  34. package/dist/posthog-7B92c2Ed.js.map +1 -0
  35. package/dist/{posthog-integration-By5930Gz.js → posthog-integration-CukaeYil.js} +13 -12
  36. package/dist/{posthog-integration-By5930Gz.js.map → posthog-integration-CukaeYil.js.map} +1 -1
  37. package/dist/{provisioning-BHa8VWaa.js → provisioning-C_ETLiZE.js} +3 -3
  38. package/dist/{provisioning-BHa8VWaa.js.map → provisioning-C_ETLiZE.js.map} +1 -1
  39. package/dist/provisioning-Ch6i8dRV.js +2 -0
  40. package/dist/{registry-DpROZPnl.js → registry-DqbwO5EL.js} +31 -31
  41. package/dist/registry-DqbwO5EL.js.map +1 -0
  42. package/dist/setup-utils-C5uZ9g60.js +2 -0
  43. package/dist/{setup-utils-Mzpk1vqG.js → setup-utils-DdAdxUTV.js} +170 -60
  44. package/dist/setup-utils-DdAdxUTV.js.map +1 -0
  45. package/dist/{slides-BtDXEXdn.js → slides-Dpj4j0w_.js} +580 -27
  46. package/dist/slides-Dpj4j0w_.js.map +1 -0
  47. package/dist/smoke-test-ci.sh +5 -2
  48. package/dist/smoke-test.sh +43 -0
  49. package/dist/{start-playground-zZL5y9id.js → start-playground-B40O4tye.js} +288 -6
  50. package/dist/start-playground-B40O4tye.js.map +1 -0
  51. package/dist/{start-tui-Cz7RZSn_.js → start-tui-CH_ZzQXx.js} +628 -26
  52. package/dist/start-tui-CH_ZzQXx.js.map +1 -0
  53. package/dist/{steps-C2XEzN79.js → steps-0d9XqvI6.js} +6 -6
  54. package/dist/{steps-C2XEzN79.js.map → steps-0d9XqvI6.js.map} +1 -1
  55. package/dist/task-stream-CoEsidgG.js +195 -0
  56. package/dist/task-stream-CoEsidgG.js.map +1 -0
  57. package/dist/{telemetry-BG2bOwCp.js → telemetry-jn2Daxl2.js} +2 -2
  58. package/dist/{telemetry-BG2bOwCp.js.map → telemetry-jn2Daxl2.js.map} +1 -1
  59. package/dist/{wizard-abort-BmT-F0Vr.js → wizard-abort-BjLIgu2s.js} +3 -3
  60. package/dist/{wizard-abort-BmT-F0Vr.js.map → wizard-abort-BjLIgu2s.js.map} +1 -1
  61. package/dist/{wizard-abort-CYW83OG5.js → wizard-abort-BlYGA1Jk.js} +1 -1
  62. package/dist/{wizard-session-CsI33S4_.js → wizard-session-Bi95IYca.js} +19 -2
  63. package/dist/wizard-session-Bi95IYca.js.map +1 -0
  64. package/dist/wizard-session-DPGTaJ4W.js +2 -0
  65. package/dist/wizard-ui-YdGFRyu_.js.map +1 -1
  66. package/package.json +3 -2
  67. package/dist/TextBlock-DEHERFec.js.map +0 -1
  68. package/dist/agent-interface-cEdS_bNo.js.map +0 -1
  69. package/dist/agent-runner-CK5r-zQF.js.map +0 -1
  70. package/dist/analytics-Bw8E-yhX.js +0 -2
  71. package/dist/craft-pre-release.sh +0 -10
  72. package/dist/debug-BOogNcWX.js.map +0 -1
  73. package/dist/file-BKbKreWF.js +0 -16
  74. package/dist/file-BKbKreWF.js.map +0 -1
  75. package/dist/file-utils-DPmgn9Vm.js.map +0 -1
  76. package/dist/package-json-DZpnf6vU.js +0 -23
  77. package/dist/package-json-DZpnf6vU.js.map +0 -1
  78. package/dist/package-json-_4PEss19.js +0 -2
  79. package/dist/package-manager-CmMJAD-V.js.map +0 -1
  80. package/dist/paths-DJS47p5x.js +0 -26
  81. package/dist/paths-DJS47p5x.js.map +0 -1
  82. package/dist/posthog-BbQf_Hzq.js +0 -11
  83. package/dist/posthog-BbQf_Hzq.js.map +0 -1
  84. package/dist/provisioning-gHqu_MXL.js +0 -2
  85. package/dist/registry-DpROZPnl.js.map +0 -1
  86. package/dist/setup-utils-Mzpk1vqG.js.map +0 -1
  87. package/dist/setup-utils-ptemIB6g.js +0 -2
  88. package/dist/slides-BtDXEXdn.js.map +0 -1
  89. package/dist/start-playground-zZL5y9id.js.map +0 -1
  90. package/dist/start-tui-Cz7RZSn_.js.map +0 -1
  91. package/dist/task-stream-DUpUZmFQ.js +0 -61
  92. package/dist/task-stream-DUpUZmFQ.js.map +0 -1
  93. package/dist/wizard-session-CPhhll4P.js +0 -2
  94. package/dist/wizard-session-CsI33S4_.js.map +0 -1
@@ -1,16 +1,15 @@
1
- import { C as Integration, D as POSTHOG_DOCS_URL, H as getSkillsBaseUrl, N as REMOTE_SKILLS_BASE_URL, R as WIZARD_TOOLS_MENU_FLAG_KEY, f as SIGNUP_WIZARD_READINESS_CONFIG, l as setUI, m as getBlockingServiceKeys, s as logToFile, w as OAUTH_PORTS } from "./debug-BOogNcWX.js";
2
- import { a as relativeToInstallDir, n as WIZARD_LOG_FILE } from "./paths-DJS47p5x.js";
3
- import { n as analytics } from "./analytics-DaDpDus8.js";
4
- import { l as ApiError, p as getUiHostFromHost } from "./setup-utils-Mzpk1vqG.js";
5
- import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-CsI33S4_.js";
6
- import { r as wizardAbort } from "./wizard-abort-BmT-F0Vr.js";
7
- import { _ as AUDIT_SEVERITY_STYLE, d as downloadSkill, f as fetchSkillMenu, h as AUDIT_CHECKS_KEY, m as AUDIT_CHECKS_FILE, v as coerceAuditChecks, y as getAuditChecks } from "./agent-interface-cEdS_bNo.js";
8
- import { o as Colors, s as Icons } from "./TextBlock-DEHERFec.js";
9
- import { t as EVENT_PLAN_FILE } from "./posthog-integration-By5930Gz.js";
10
- import { c as POSTHOG_SDKS, l as STRIPE_SDKS, n as Program, o as fetchHealthIssues, r as getProgramConfig, s as getContentBlocks } from "./bin.js";
11
- import { t as ALL_FEATURE_VALUES } from "./defaults-DgKAzsD1.js";
12
- 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-B48J7VVO.js";
13
- import { C as ProgressList, D as WizardStore, S as useKeyBindings, T as SplitView, _ as ModalOverlay, a as IssueTable, b as useStdoutDimensions, c as ServiceHealthList, f as HNViewer, g as LogViewer, h as EventPlanViewer, i as McpScreen, l as TipsCard, m as ScreenContainer, n as AUDIT_AREA_SLIDES, o as SEVERITY_LABEL, p as TabContainer, r as AuditChecksViewer, s as SEVERITY_ORDER, t as AUDIT_3000_AREA_SLIDES, u as LearnCard, v as ConfirmationInput, w as LoadingBox, x as PickerMenu } from "./slides-BtDXEXdn.js";
1
+ import { M as POSTHOG_DOCS_URL, O as Integration, R as REMOTE_SKILLS_BASE_URL, U as WIZARD_TOOLS_MENU_FLAG_KEY, _ as SIGNUP_WIZARD_READINESS_CONFIG, d as relativeToInstallDir, k as OAUTH_PORTS, l as WIZARD_LOG_FILE, m as setUI, q as getSkillsBaseUrl, s as logToFile, y as getBlockingServiceKeys } from "./debug-C4jRuzny.js";
2
+ import { n as analytics } from "./analytics-DZaUgJte.js";
3
+ import { d as extractOAuthCode, l as ApiError, m as getUiHostFromHost, r as getOrAskForProjectData } from "./setup-utils-DdAdxUTV.js";
4
+ import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-Bi95IYca.js";
5
+ import { r as wizardAbort } from "./wizard-abort-BjLIgu2s.js";
6
+ import { _ as AUDIT_SEVERITY_STYLE, d as downloadSkill, f as fetchSkillMenu, h as AUDIT_CHECKS_KEY, m as AUDIT_CHECKS_FILE, v as coerceAuditChecks, y as getAuditChecks } from "./agent-interface-pBnqJL8P.js";
7
+ import { o as Colors, s as Icons } from "./TextBlock-DJVhBkr3.js";
8
+ import { t as EVENT_PLAN_FILE } from "./posthog-integration-CukaeYil.js";
9
+ import { a as SOURCE_MAPS_CONTEXT_KEYS, c as fetchHealthIssues, d as STRIPE_SDKS, i as DISPLAY_NAME, l as getContentBlocks, n as Program, r as getProgramConfig, u as POSTHOG_SDKS } from "./bin.js";
10
+ import { t as ALL_FEATURE_VALUES } from "./defaults-GbLPuHxj.js";
11
+ 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-9jQjc-CO.js";
12
+ import { C as PickerMenu, D as SplitView, E as LoadingBox, S as useStdoutDimensions, T as ProgressList, _ as EventPlanViewer, b as ConfirmationInput, c as SEVERITY_LABEL, d as TipsCard, f as LearnCard, g as ScreenContainer, h as TabContainer, i as McpSuggestedPromptsScreen, k as WizardStore, l as SEVERITY_ORDER, m as HNViewer, n as AUDIT_AREA_SLIDES, o as McpScreen, r as AuditChecksViewer, s as IssueTable, t as AUDIT_3000_AREA_SLIDES, u as ServiceHealthList, v as LogViewer, w as useKeyBindings, y as ModalOverlay } from "./slides-Dpj4j0w_.js";
14
13
  import { spawn, spawnSync } from "node:child_process";
15
14
  import { join } from "node:path";
16
15
  import * as fs$1 from "fs";
@@ -62,6 +61,12 @@ var InkUI = class {
62
61
  setCredentials(credentials) {
63
62
  this.store.setCredentials(credentials);
64
63
  }
64
+ setRoleAtOrganization(role) {
65
+ this.store.setRoleAtOrganization(role);
66
+ }
67
+ setApiUser(user) {
68
+ this.store.setApiUser(user);
69
+ }
65
70
  setDetectedFramework(label) {
66
71
  this.store.setDetectedFramework(label);
67
72
  }
@@ -71,6 +76,9 @@ var InkUI = class {
71
76
  setLoginUrl(url) {
72
77
  this.store.setLoginUrl(url);
73
78
  }
79
+ setAuthorizeUrl(url) {
80
+ this.store.setAuthorizeUrl(url);
81
+ }
74
82
  showBlockingOutage(result) {
75
83
  this.store.setReadinessResult(result);
76
84
  return Promise.resolve();
@@ -81,6 +89,9 @@ var InkUI = class {
81
89
  showPortConflict(processInfo) {
82
90
  return this.store.showPortConflict(processInfo);
83
91
  }
92
+ waitForManualAuthCode() {
93
+ return this.store.waitForManualAuthCode();
94
+ }
84
95
  showSettingsOverride(conflicts, backupAndFix) {
85
96
  return this.store.showSettingsOverride(conflicts, backupAndFix);
86
97
  }
@@ -679,6 +690,107 @@ const PortConflictScreen = ({ store }) => {
679
690
  });
680
691
  };
681
692
  //#endregion
693
+ //#region src/ui/tui/screens/ManualAuthCodeScreen.tsx
694
+ /**
695
+ * ManualAuthCodeScreen — Paste an OAuth authorization code by hand.
696
+ *
697
+ * Fallback for headless/remote shells where the browser can't reach the
698
+ * wizard's local callback server. Shows the direct authorize URL (the localhost
699
+ * one is unreachable from another machine), then the user pastes either the
700
+ * full callback URL the browser was redirected to
701
+ * (`http://localhost:8239/callback?code=...`) or just the code. On submit we
702
+ * extract the code and resolve the in-flight OAuth flow; bad input shows inline
703
+ * feedback without leaving the screen.
704
+ *
705
+ * Opened from AuthScreen via a keypress; Esc dismisses it.
706
+ */
707
+ const ManualAuthCodeScreen = ({ store }) => {
708
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
709
+ const { session } = store;
710
+ const [error, setError] = useState(null);
711
+ useInput((_input, key) => {
712
+ if (key.escape) store.dismissManualAuthCode();
713
+ });
714
+ const handleSubmit = (value) => {
715
+ const code = extractOAuthCode(value);
716
+ if (!code) {
717
+ setError("Couldn't find a code in that input. Paste the full callback URL or just the code.");
718
+ return;
719
+ }
720
+ store.submitManualAuthCode(code);
721
+ };
722
+ return /* @__PURE__ */ jsxs(Box, {
723
+ flexDirection: "column",
724
+ flexGrow: 1,
725
+ children: [
726
+ /* @__PURE__ */ jsx(Box, {
727
+ marginBottom: 1,
728
+ children: /* @__PURE__ */ jsxs(Text, {
729
+ bold: true,
730
+ color: Colors.accent,
731
+ children: [Icons.diamond, " Paste authorization code"]
732
+ })
733
+ }),
734
+ session.authorizeUrl && /* @__PURE__ */ jsxs(Box, {
735
+ flexDirection: "column",
736
+ marginBottom: 1,
737
+ children: [/* @__PURE__ */ jsx(Text, {
738
+ dimColor: true,
739
+ children: "On a remote/headless machine the local login link won't open. Open this URL in a browser on any machine to authorize:"
740
+ }), /* @__PURE__ */ jsx(Box, {
741
+ flexShrink: 0,
742
+ marginTop: 1,
743
+ children: /* @__PURE__ */ jsx(Text, {
744
+ color: "cyan",
745
+ children: session.authorizeUrl
746
+ })
747
+ })]
748
+ }),
749
+ /* @__PURE__ */ jsx(Text, { children: "After authorizing, paste the callback URL it lands on — or just the code from it — here:" }),
750
+ /* @__PURE__ */ jsx(Box, {
751
+ marginTop: 1,
752
+ width: "100%",
753
+ children: /* @__PURE__ */ jsx(TextInput, {
754
+ placeholder: "http://localhost:8239/callback?code=… or the code",
755
+ onSubmit: handleSubmit
756
+ })
757
+ }),
758
+ error && /* @__PURE__ */ jsx(Box, {
759
+ marginTop: 1,
760
+ children: /* @__PURE__ */ jsx(Text, {
761
+ color: "yellow",
762
+ children: error
763
+ })
764
+ }),
765
+ /* @__PURE__ */ jsx(Box, {
766
+ marginTop: 1,
767
+ children: /* @__PURE__ */ jsxs(Text, { children: [
768
+ /* @__PURE__ */ jsx(Text, {
769
+ color: Colors.accent,
770
+ children: "ENTER"
771
+ }),
772
+ /* @__PURE__ */ jsx(Text, {
773
+ dimColor: true,
774
+ children: " submit"
775
+ }),
776
+ /* @__PURE__ */ jsx(Text, {
777
+ dimColor: true,
778
+ children: " · "
779
+ }),
780
+ /* @__PURE__ */ jsx(Text, {
781
+ color: Colors.accent,
782
+ children: "ESC"
783
+ }),
784
+ /* @__PURE__ */ jsx(Text, {
785
+ dimColor: true,
786
+ children: " cancel"
787
+ })
788
+ ] })
789
+ })
790
+ ]
791
+ });
792
+ };
793
+ //#endregion
682
794
  //#region src/ui/tui/screens/IntroScreenLayout.tsx
683
795
  /**
684
796
  * IntroScreenLayout ��� Shared visual shell for all program intro screens.
@@ -919,7 +1031,7 @@ const FrameworkPicker = ({ store, onComplete }) => {
919
1031
  })),
920
1032
  onSelect: (value) => {
921
1033
  const integration = Array.isArray(value) ? value[0] : value;
922
- import("./registry-DpROZPnl.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
1034
+ import("./registry-DqbwO5EL.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
923
1035
  const config = FRAMEWORK_REGISTRY[integration];
924
1036
  store.setFrameworkConfig(integration, config);
925
1037
  store.setDetectedFramework(config.metadata.name);
@@ -1249,7 +1361,7 @@ const RevenueIntroScreen = ({ store }) => {
1249
1361
  }), /* @__PURE__ */ jsx(Box, {
1250
1362
  marginTop: 1,
1251
1363
  flexDirection: "column",
1252
- children: /* @__PURE__ */ jsx(DetectErrorBody, { error: detectError })
1364
+ children: /* @__PURE__ */ jsx(DetectErrorBody$1, { error: detectError })
1253
1365
  })]
1254
1366
  }), /* @__PURE__ */ jsx(PickerMenu, {
1255
1367
  options: [{
@@ -1293,7 +1405,7 @@ const RevenueIntroScreen = ({ store }) => {
1293
1405
  }
1294
1406
  });
1295
1407
  };
1296
- const DetectErrorBody = ({ error }) => {
1408
+ const DetectErrorBody$1 = ({ error }) => {
1297
1409
  switch (error.kind) {
1298
1410
  case "bad-directory": {
1299
1411
  const reasonText = {
@@ -1445,6 +1557,425 @@ const MigrationIntroScreen = ({ store }) => {
1445
1557
  });
1446
1558
  };
1447
1559
  //#endregion
1560
+ //#region src/ui/tui/screens/SourceMapsIntroScreen.tsx
1561
+ /**
1562
+ * SourceMapsIntroScreen — Welcome screen for the source-maps upload flow.
1563
+ *
1564
+ * Reads detection results from frameworkContext (written by
1565
+ * detectSourceMapsPrerequisites). On success: shows the detected platform.
1566
+ * On failure: shows the structured error with an Exit prompt.
1567
+ */
1568
+ const SourceMapsIntroScreen = ({ store }) => {
1569
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
1570
+ const { session } = store;
1571
+ const detectError = session.frameworkContext[SOURCE_MAPS_CONTEXT_KEYS.detectError];
1572
+ const variant = session.frameworkContext[SOURCE_MAPS_CONTEXT_KEYS.skillVariant];
1573
+ const displayName = session.frameworkContext[SOURCE_MAPS_CONTEXT_KEYS.displayName];
1574
+ const packagePaths = session.frameworkContext[SOURCE_MAPS_CONTEXT_KEYS.packagePaths] ?? [];
1575
+ const detectionRows = [];
1576
+ if (displayName) detectionRows.push({
1577
+ label: "Platform",
1578
+ value: displayName
1579
+ });
1580
+ if (variant) detectionRows.push({
1581
+ label: "Skill",
1582
+ value: `error-tracking-upload-source-maps-${variant}`
1583
+ });
1584
+ const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box, {
1585
+ flexDirection: "column",
1586
+ alignItems: "center",
1587
+ children: [/* @__PURE__ */ jsx(Text, { children: "Upload source maps for accurate error stack traces." }), /* @__PURE__ */ jsx(Box, {
1588
+ flexDirection: "column",
1589
+ marginTop: 1,
1590
+ children: /* @__PURE__ */ jsx(Text, { children: "The agent will wire it into your build." })
1591
+ })]
1592
+ }), packagePaths.length > 1 && /* @__PURE__ */ jsxs(Box, {
1593
+ flexDirection: "column",
1594
+ marginTop: 1,
1595
+ children: [/* @__PURE__ */ jsxs(Text, {
1596
+ dimColor: true,
1597
+ children: [
1598
+ "Found ",
1599
+ packagePaths.length,
1600
+ " package.json files:"
1601
+ ]
1602
+ }), packagePaths.map((p) => /* @__PURE__ */ jsxs(Text, {
1603
+ dimColor: true,
1604
+ children: [
1605
+ " ",
1606
+ "•",
1607
+ " ",
1608
+ p
1609
+ ]
1610
+ }, p))]
1611
+ })] });
1612
+ const errorView = detectError ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Box, {
1613
+ flexDirection: "column",
1614
+ marginBottom: 1,
1615
+ children: [/* @__PURE__ */ jsxs(Text, {
1616
+ color: "red",
1617
+ bold: true,
1618
+ children: ["✘", " Cannot set up source map upload"]
1619
+ }), /* @__PURE__ */ jsx(Box, {
1620
+ marginTop: 1,
1621
+ flexDirection: "column",
1622
+ children: /* @__PURE__ */ jsx(DetectErrorBody, { error: detectError })
1623
+ })]
1624
+ }), /* @__PURE__ */ jsx(PickerMenu, {
1625
+ options: [{
1626
+ label: "Exit",
1627
+ value: "exit"
1628
+ }],
1629
+ onSelect: () => process.exit(1)
1630
+ })] }) : void 0;
1631
+ return /* @__PURE__ */ jsx(IntroScreenLayout, {
1632
+ installDir: session.installDir,
1633
+ body,
1634
+ showDetection: true,
1635
+ detectionRows,
1636
+ errorView,
1637
+ programLabel: session.programLabel,
1638
+ skillId: session.skillId,
1639
+ menuOptions: [{
1640
+ label: "Continue",
1641
+ value: "continue"
1642
+ }, {
1643
+ label: "Cancel",
1644
+ value: "cancel"
1645
+ }],
1646
+ onSelect: (value) => {
1647
+ if (value === "cancel") process.exit(0);
1648
+ else store.completeSetup();
1649
+ }
1650
+ });
1651
+ };
1652
+ const SOURCE_MAP_DOCS = "https://posthog.com/docs/error-tracking/upload-source-maps";
1653
+ const ERROR_TRACKING_INSTALL_DOCS = "https://posthog.com/docs/error-tracking/installation";
1654
+ const WIZARD_ISSUES_URL = "https://github.com/PostHog/wizard/issues";
1655
+ /**
1656
+ * Platforms PostHog Error Tracking supports with published source-map / symbol
1657
+ * upload docs, but that the wizard can't automate yet. The user (or their own
1658
+ * coding agent) can follow these docs to wire it up by hand. Anything not in
1659
+ * this map falls through to the generic "not supported yet" message — we don't
1660
+ * hardcode the full supported-platform list (it lives in the docs and changes
1661
+ * server-side), we just point there.
1662
+ */
1663
+ const NATIVE_PLATFORM_DOCS = {
1664
+ ios: {
1665
+ label: "iOS",
1666
+ url: "https://posthog.com/docs/error-tracking/upload-source-maps/ios"
1667
+ },
1668
+ android: {
1669
+ label: "Android",
1670
+ url: "https://posthog.com/docs/error-tracking/upload-mappings/android"
1671
+ },
1672
+ "react-native": {
1673
+ label: "React Native",
1674
+ url: "https://posthog.com/docs/error-tracking/upload-source-maps/react-native"
1675
+ },
1676
+ flutter: {
1677
+ label: "Flutter",
1678
+ url: "https://posthog.com/docs/error-tracking/upload-source-maps/flutter"
1679
+ }
1680
+ };
1681
+ const DetectErrorBody = ({ error }) => {
1682
+ switch (error.kind) {
1683
+ case "bad-directory": {
1684
+ const reasonText = {
1685
+ missing: "does not exist",
1686
+ "not-dir": "is not a directory",
1687
+ unreadable: "could not be accessed"
1688
+ }[error.reason];
1689
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Text, { children: [
1690
+ "This path ",
1691
+ reasonText,
1692
+ ":"
1693
+ ] }), /* @__PURE__ */ jsxs(Text, {
1694
+ dimColor: true,
1695
+ children: [" ", error.path]
1696
+ })] });
1697
+ }
1698
+ case "no-project-files": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1699
+ /* @__PURE__ */ jsx(Text, { children: "No recognizable project files were found." }),
1700
+ /* @__PURE__ */ jsx(Text, {
1701
+ dimColor: true,
1702
+ children: "Source map upload needs a package.json, Xcode project, Gradle build, or Flutter pubspec.yaml."
1703
+ }),
1704
+ /* @__PURE__ */ jsx(Text, {
1705
+ dimColor: true,
1706
+ children: "Run this command from your project root."
1707
+ }),
1708
+ /* @__PURE__ */ jsxs(Box, {
1709
+ marginTop: 1,
1710
+ flexDirection: "column",
1711
+ children: [/* @__PURE__ */ jsx(Text, {
1712
+ dimColor: true,
1713
+ children: "How source map upload works:"
1714
+ }), /* @__PURE__ */ jsxs(Text, {
1715
+ dimColor: true,
1716
+ children: [" ", SOURCE_MAP_DOCS]
1717
+ })]
1718
+ })
1719
+ ] });
1720
+ case "unsupported-platform": {
1721
+ const native = NATIVE_PLATFORM_DOCS[error.detected];
1722
+ if (native) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Text, { children: [
1723
+ "The wizard can't set up source map upload for ",
1724
+ native.label,
1725
+ " yet."
1726
+ ] }), /* @__PURE__ */ jsxs(Box, {
1727
+ marginTop: 1,
1728
+ flexDirection: "column",
1729
+ children: [/* @__PURE__ */ jsxs(Text, {
1730
+ dimColor: true,
1731
+ children: [
1732
+ "PostHog Error Tracking does support ",
1733
+ native.label,
1734
+ ". You can set it up yourself by following the docs below — or hand them to your own coding agent to do it for you:"
1735
+ ]
1736
+ }), /* @__PURE__ */ jsx(Box, {
1737
+ marginTop: 1,
1738
+ children: /* @__PURE__ */ jsx(Text, {
1739
+ dimColor: true,
1740
+ children: native.url
1741
+ })
1742
+ })]
1743
+ })] });
1744
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Text, { children: "Source map upload isn't supported for this stack yet." }), /* @__PURE__ */ jsxs(Box, {
1745
+ marginTop: 1,
1746
+ flexDirection: "column",
1747
+ children: [
1748
+ /* @__PURE__ */ jsx(Text, {
1749
+ dimColor: true,
1750
+ children: "Check which platforms PostHog Error Tracking supports:"
1751
+ }),
1752
+ /* @__PURE__ */ jsx(Box, {
1753
+ marginTop: 1,
1754
+ children: /* @__PURE__ */ jsx(Text, {
1755
+ dimColor: true,
1756
+ children: ERROR_TRACKING_INSTALL_DOCS
1757
+ })
1758
+ }),
1759
+ /* @__PURE__ */ jsx(Box, {
1760
+ marginTop: 1,
1761
+ children: /* @__PURE__ */ jsxs(Text, {
1762
+ dimColor: true,
1763
+ children: [
1764
+ "If yours isn't listed and you'd like it added, open an issue at",
1765
+ " ",
1766
+ WIZARD_ISSUES_URL,
1767
+ " with details about your build setup."
1768
+ ]
1769
+ })
1770
+ })
1771
+ ]
1772
+ })] });
1773
+ }
1774
+ case "no-posthog-sdk": {
1775
+ const platformLabel = DISPLAY_NAME[error.platform] ?? error.platform;
1776
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Text, { children: [
1777
+ "Detected ",
1778
+ platformLabel,
1779
+ " but no PostHog SDK is installed."
1780
+ ] }), /* @__PURE__ */ jsxs(Box, {
1781
+ marginTop: 1,
1782
+ flexDirection: "column",
1783
+ children: [/* @__PURE__ */ jsxs(Text, {
1784
+ dimColor: true,
1785
+ children: [
1786
+ "Source map upload only resolves stack traces from errors the SDK reports. Run ",
1787
+ /* @__PURE__ */ jsx(Text, {
1788
+ bold: true,
1789
+ children: "npx @posthog/wizard"
1790
+ }),
1791
+ " first to install the SDK, then run this command again."
1792
+ ]
1793
+ }), /* @__PURE__ */ jsxs(Box, {
1794
+ marginTop: 1,
1795
+ flexDirection: "column",
1796
+ children: [/* @__PURE__ */ jsxs(Text, {
1797
+ dimColor: true,
1798
+ children: [
1799
+ "Set up source map upload for ",
1800
+ platformLabel,
1801
+ ":"
1802
+ ]
1803
+ }), /* @__PURE__ */ jsxs(Text, {
1804
+ dimColor: true,
1805
+ children: [" ", SOURCE_MAP_DOCS]
1806
+ })]
1807
+ })]
1808
+ })] });
1809
+ }
1810
+ }
1811
+ };
1812
+ //#endregion
1813
+ //#region src/ui/tui/screens/SourceMapsOutroScreen.tsx
1814
+ /**
1815
+ * SourceMapsOutroScreen — post-run summary for the source-maps upload flow.
1816
+ *
1817
+ * Unlike the generic OutroScreen, this spells out the operational facts a user
1818
+ * needs to actually get de-minified stack traces: that packages were installed
1819
+ * and upload credentials written to .env, plus the three gotchas (builds
1820
+ * upload, run the build, mirror the env vars in CI). All static guidance —
1821
+ * driven only by the program's `buildOutroData` (kind / message / report /
1822
+ * docs), no per-run data.
1823
+ */
1824
+ const SourceMapsOutroScreen = ({ store }) => {
1825
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
1826
+ useInput(() => {
1827
+ store.setOutroDismissed();
1828
+ });
1829
+ const outroData = store.session.outroData;
1830
+ if (!outroData) return /* @__PURE__ */ jsx(Box, {
1831
+ flexDirection: "column",
1832
+ flexGrow: 1,
1833
+ children: /* @__PURE__ */ jsx(Text, {
1834
+ dimColor: true,
1835
+ children: "Finishing up..."
1836
+ })
1837
+ });
1838
+ return /* @__PURE__ */ jsxs(Box, {
1839
+ flexDirection: "column",
1840
+ flexGrow: 1,
1841
+ children: [
1842
+ outroData.kind === "success" && /* @__PURE__ */ jsxs(Box, {
1843
+ flexDirection: "column",
1844
+ children: [
1845
+ /* @__PURE__ */ jsxs(Text, {
1846
+ color: Colors.success,
1847
+ bold: true,
1848
+ children: ["✔ ", outroData.message || "Source maps wired up!"]
1849
+ }),
1850
+ /* @__PURE__ */ jsxs(Section, {
1851
+ title: "What the wizard did",
1852
+ children: [/* @__PURE__ */ jsx(Text, { children: "• Installed the packages needed for source map upload." }), /* @__PURE__ */ jsxs(Text, { children: [
1853
+ "• Wrote the PostHog upload credentials to your",
1854
+ " ",
1855
+ /* @__PURE__ */ jsx(Text, {
1856
+ bold: true,
1857
+ children: ".env"
1858
+ }),
1859
+ " file."
1860
+ ] })]
1861
+ }),
1862
+ /* @__PURE__ */ jsxs(Section, {
1863
+ title: "How uploads work now",
1864
+ children: [
1865
+ /* @__PURE__ */ jsxs(Text, { children: [
1866
+ "• Every ",
1867
+ /* @__PURE__ */ jsx(Text, {
1868
+ bold: true,
1869
+ children: "build"
1870
+ }),
1871
+ " now uploads source maps to PostHog automatically — no extra command to remember."
1872
+ ] }),
1873
+ /* @__PURE__ */ jsxs(Text, { children: [
1874
+ "• Run your app from the ",
1875
+ /* @__PURE__ */ jsx(Text, {
1876
+ bold: true,
1877
+ children: "built output"
1878
+ }),
1879
+ ". Source maps only resolve for errors thrown by the build that was uploaded."
1880
+ ] }),
1881
+ /* @__PURE__ */ jsxs(Text, { children: [
1882
+ "• In ",
1883
+ /* @__PURE__ */ jsx(Text, {
1884
+ bold: true,
1885
+ children: "CI"
1886
+ }),
1887
+ ", make sure the build job exposes the same env vars the wizard added to your ",
1888
+ /* @__PURE__ */ jsx(Text, {
1889
+ bold: true,
1890
+ children: ".env"
1891
+ }),
1892
+ "."
1893
+ ] })
1894
+ ]
1895
+ }),
1896
+ outroData.reportFile && /* @__PURE__ */ jsx(Box, {
1897
+ marginTop: 1,
1898
+ children: /* @__PURE__ */ jsxs(Text, { children: [
1899
+ "Details in",
1900
+ " ",
1901
+ /* @__PURE__ */ jsx(Text, {
1902
+ bold: true,
1903
+ children: join(store.session.installDir, outroData.reportFile)
1904
+ })
1905
+ ] })
1906
+ }),
1907
+ outroData.docsUrl && /* @__PURE__ */ jsx(Box, {
1908
+ marginTop: 1,
1909
+ children: /* @__PURE__ */ jsxs(Text, { children: [
1910
+ "Learn more:",
1911
+ " ",
1912
+ /* @__PURE__ */ jsx(Text, {
1913
+ color: Colors.primary,
1914
+ children: outroData.docsUrl
1915
+ })
1916
+ ] })
1917
+ }),
1918
+ /* @__PURE__ */ jsx(Box, {
1919
+ marginTop: 1,
1920
+ children: /* @__PURE__ */ jsx(Text, {
1921
+ dimColor: true,
1922
+ children: "Note: This wizard uses an LLM agent to analyze and modify your project. Please review the changes made."
1923
+ })
1924
+ }),
1925
+ /* @__PURE__ */ jsx(Text, {
1926
+ dimColor: true,
1927
+ children: "How did this work for you? Drop us a line: wizard@posthog.com"
1928
+ })
1929
+ ]
1930
+ }),
1931
+ outroData.kind === "error" && /* @__PURE__ */ jsxs(Box, {
1932
+ flexDirection: "column",
1933
+ children: [
1934
+ /* @__PURE__ */ jsxs(Text, {
1935
+ color: Colors.error,
1936
+ bold: true,
1937
+ children: ["✘ ", outroData.message || "An error occurred"]
1938
+ }),
1939
+ outroData.body && /* @__PURE__ */ jsx(Box, {
1940
+ marginTop: 1,
1941
+ children: /* @__PURE__ */ jsx(Text, {
1942
+ dimColor: true,
1943
+ children: outroData.body
1944
+ })
1945
+ }),
1946
+ outroData.docsUrl && /* @__PURE__ */ jsx(Box, {
1947
+ marginTop: 1,
1948
+ children: /* @__PURE__ */ jsxs(Text, { children: ["Docs: ", /* @__PURE__ */ jsx(Text, {
1949
+ color: Colors.primary,
1950
+ children: outroData.docsUrl
1951
+ })] })
1952
+ })
1953
+ ]
1954
+ }),
1955
+ outroData.kind === "cancel" && /* @__PURE__ */ jsxs(Text, {
1956
+ color: "yellow",
1957
+ children: ["■ ", outroData.message || "Cancelled"]
1958
+ }),
1959
+ /* @__PURE__ */ jsx(Box, {
1960
+ marginTop: 1,
1961
+ children: /* @__PURE__ */ jsx(Text, {
1962
+ color: Colors.muted,
1963
+ children: "Press any key to continue"
1964
+ })
1965
+ })
1966
+ ]
1967
+ });
1968
+ };
1969
+ const Section = ({ title, children }) => /* @__PURE__ */ jsxs(Box, {
1970
+ flexDirection: "column",
1971
+ marginTop: 1,
1972
+ children: [/* @__PURE__ */ jsxs(Text, {
1973
+ color: Colors.primary,
1974
+ bold: true,
1975
+ children: [title, ":"]
1976
+ }), children]
1977
+ });
1978
+ //#endregion
1448
1979
  //#region src/ui/tui/screens/AgentSkillIntroScreen.tsx
1449
1980
  /**
1450
1981
  * AgentSkillIntroScreen — Default intro for generic agent-skill programs.
@@ -3193,6 +3724,12 @@ const SetupScreen = ({ store }) => {
3193
3724
  const AuthScreen = ({ store }) => {
3194
3725
  useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
3195
3726
  const { session } = store;
3727
+ useKeyBindings("auth", Boolean(session.loginUrl) ? [{
3728
+ match: ["p", "P"],
3729
+ label: "P",
3730
+ action: "paste auth code",
3731
+ handler: () => store.showManualAuthCode()
3732
+ }] : []);
3196
3733
  const config = session.frameworkConfig;
3197
3734
  const frameworkLabel = session.detectedFrameworkLabel ?? config?.metadata.name;
3198
3735
  return /* @__PURE__ */ jsxs(Box, {
@@ -3229,13 +3766,32 @@ const AuthScreen = ({ store }) => {
3229
3766
  /* @__PURE__ */ jsx(LoadingBox, { message: "Waiting for authentication..." }),
3230
3767
  session.loginUrl && /* @__PURE__ */ jsxs(Box, {
3231
3768
  marginTop: 1,
3769
+ marginBottom: 1,
3232
3770
  flexDirection: "column",
3233
- children: [/* @__PURE__ */ jsx(Text, {
3234
- dimColor: true,
3235
- children: "If the browser didn't open, copy and paste this URL:"
3236
- }), /* @__PURE__ */ jsx(Text, {
3237
- color: "cyan",
3238
- children: session.loginUrl
3771
+ children: [/* @__PURE__ */ jsxs(Text, { children: [
3772
+ /* @__PURE__ */ jsx(Text, {
3773
+ dimColor: true,
3774
+ children: "If the browser didn't open, copy and paste this URL:"
3775
+ }),
3776
+ "\n\n",
3777
+ /* @__PURE__ */ jsx(Text, {
3778
+ color: "cyan",
3779
+ children: session.loginUrl
3780
+ })
3781
+ ] }), /* @__PURE__ */ jsx(Box, {
3782
+ marginTop: 1,
3783
+ children: /* @__PURE__ */ jsxs(Text, {
3784
+ dimColor: true,
3785
+ children: [
3786
+ "On a remote machine or devbox? Press",
3787
+ " ",
3788
+ /* @__PURE__ */ jsx(Text, {
3789
+ color: Colors.accent,
3790
+ children: "[P]"
3791
+ }),
3792
+ " to paste the callback URL."
3793
+ ]
3794
+ })
3239
3795
  })]
3240
3796
  })
3241
3797
  ]
@@ -3926,19 +4482,61 @@ function createMcpInstaller() {
3926
4482
  };
3927
4483
  }
3928
4484
  //#endregion
4485
+ //#region src/ui/tui/services/mcp-suggested-prompts-services.ts
4486
+ /**
4487
+ * Production services. The `runPromptStreaming` implementation lives
4488
+ * in a separate module so the heavy SDK import is only paid when
4489
+ * actually invoked.
4490
+ */
4491
+ function createMcpSuggestedPromptsServices(_store) {
4492
+ return {
4493
+ performLogin: async () => {
4494
+ const result = await getOrAskForProjectData({
4495
+ signup: false,
4496
+ ci: false,
4497
+ apiKey: void 0,
4498
+ projectId: void 0,
4499
+ email: void 0,
4500
+ region: void 0
4501
+ });
4502
+ return {
4503
+ credentials: {
4504
+ accessToken: result.accessToken,
4505
+ projectApiKey: result.projectApiKey,
4506
+ host: result.host,
4507
+ projectId: result.projectId
4508
+ },
4509
+ roleAtOrganization: result.roleAtOrganization,
4510
+ user: result.user
4511
+ };
4512
+ },
4513
+ runPromptStreaming: (args) => runProductionPromptStreaming(args)
4514
+ };
4515
+ }
4516
+ async function* runProductionPromptStreaming(args) {
4517
+ const { runMcpPromptViaSdk } = await import("./mcp-prompt-streaming-DKiaymMt.js");
4518
+ yield* runMcpPromptViaSdk(args);
4519
+ }
4520
+ //#endregion
3929
4521
  //#region src/ui/tui/screen-registry.tsx
3930
- function createServices() {
3931
- return { mcpInstaller: createMcpInstaller() };
4522
+ function createServices(store) {
4523
+ return {
4524
+ mcpInstaller: createMcpInstaller(),
4525
+ mcpSuggestedPromptsServices: createMcpSuggestedPromptsServices(store)
4526
+ };
3932
4527
  }
3933
4528
  function createScreens(store, services) {
3934
4529
  return {
3935
4530
  ["settings-override"]: /* @__PURE__ */ jsx(SettingsOverrideScreen, { store }),
3936
4531
  ["managed-settings"]: /* @__PURE__ */ jsx(ManagedSettingsScreen, { store }),
3937
4532
  ["port-conflict"]: /* @__PURE__ */ jsx(PortConflictScreen, { store }),
4533
+ ["manual-auth-code"]: /* @__PURE__ */ jsx(ManualAuthCodeScreen, { store }),
3938
4534
  ["auth-error"]: /* @__PURE__ */ jsx(AuthErrorScreen, { store }),
3939
4535
  ["wizard-ask"]: /* @__PURE__ */ jsx(WizardAskScreen, { store }),
3940
4536
  ["intro"]: /* @__PURE__ */ jsx(PostHogIntegrationIntroScreen, { store }),
3941
4537
  ["revenue-intro"]: /* @__PURE__ */ jsx(RevenueIntroScreen, { store }),
4538
+ ["source-maps-intro"]: /* @__PURE__ */ jsx(SourceMapsIntroScreen, { store }),
4539
+ ["source-maps-outro"]: /* @__PURE__ */ jsx(SourceMapsOutroScreen, { store }),
3942
4540
  ["migration-intro"]: /* @__PURE__ */ jsx(MigrationIntroScreen, { store }),
3943
4541
  ["agent-skill-intro"]: /* @__PURE__ */ jsx(AgentSkillIntroScreen, { store }),
3944
4542
  ["audit-intro"]: /* @__PURE__ */ jsx(AuditIntroScreen, { store }),
@@ -3957,6 +4555,10 @@ function createScreens(store, services) {
3957
4555
  store,
3958
4556
  installer: services.mcpInstaller
3959
4557
  }),
4558
+ ["mcp-suggested-prompts"]: /* @__PURE__ */ jsx(McpSuggestedPromptsScreen, {
4559
+ store,
4560
+ services: services.mcpSuggestedPromptsServices
4561
+ }),
3960
4562
  ["keep-skills"]: /* @__PURE__ */ jsx(KeepSkillsScreen, { store }),
3961
4563
  ["outro"]: /* @__PURE__ */ jsx(OutroScreen, { store }),
3962
4564
  ["exit"]: /* @__PURE__ */ jsx(ExitScreen, {}),
@@ -3974,7 +4576,7 @@ function createScreens(store, services) {
3974
4576
  //#endregion
3975
4577
  //#region src/ui/tui/App.tsx
3976
4578
  const App = ({ store }) => {
3977
- const services = useMemo(() => createServices(), []);
4579
+ const services = useMemo(() => createServices(store), [store]);
3978
4580
  return /* @__PURE__ */ jsx(ScreenContainer, {
3979
4581
  store,
3980
4582
  screens: useMemo(() => createScreens(store, services), [store, services])
@@ -4034,4 +4636,4 @@ function startTUI(version, program = Program.PostHogIntegration) {
4034
4636
  //#endregion
4035
4637
  export { startTUI };
4036
4638
 
4037
- //# sourceMappingURL=start-tui-Cz7RZSn_.js.map
4639
+ //# sourceMappingURL=start-tui-CH_ZzQXx.js.map