@posthog/wizard 2.13.1 → 2.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/LICENSE +0 -26
  2. package/README.md +1 -1
  3. package/dist/TextBlock-B3cm43YY.js +244 -0
  4. package/dist/TextBlock-B3cm43YY.js.map +1 -0
  5. package/dist/{add-mcp-server-to-clients-D1IyBa9u.js → add-mcp-server-to-clients-DVdyI6SQ.js} +7 -7
  6. package/dist/{add-mcp-server-to-clients-D1IyBa9u.js.map → add-mcp-server-to-clients-DVdyI6SQ.js.map} +1 -1
  7. package/dist/{agent-interface-D9DeIikl.js → agent-interface-BJoqBI04.js} +533 -255
  8. package/dist/agent-interface-BJoqBI04.js.map +1 -0
  9. package/dist/{agent-runner-B41-Iig3.js → agent-runner-oJ7Wyhl7.js} +102 -20
  10. package/dist/agent-runner-oJ7Wyhl7.js.map +1 -0
  11. package/dist/analytics-Cz_p0Xus.js +2 -0
  12. package/dist/{analytics-Cek5hIwm.js → analytics-kUCNQQJm.js} +2 -2
  13. package/dist/{analytics-Cek5hIwm.js.map → analytics-kUCNQQJm.js.map} +1 -1
  14. package/dist/bin.js +951 -141
  15. package/dist/bin.js.map +1 -1
  16. package/dist/{debug-B2BH87dh.js → debug-BH8HMBNX.js} +26 -21
  17. package/dist/debug-BH8HMBNX.js.map +1 -0
  18. package/dist/{debug-BNWsxaDm.js → debug-CgsJTJOO.js} +1 -1
  19. package/dist/{defaults-GbLPuHxj.js → defaults-DgKAzsD1.js} +1 -1
  20. package/dist/{defaults-GbLPuHxj.js.map → defaults-DgKAzsD1.js.map} +1 -1
  21. package/dist/{detection-BFl2AYV6.js → detection-DWNUEyek.js} +4 -4
  22. package/dist/detection-DWNUEyek.js.map +1 -0
  23. package/dist/{file-8iNrXHkG.js → file-BKbKreWF.js} +1 -1
  24. package/dist/{file-8iNrXHkG.js.map → file-BKbKreWF.js.map} +1 -1
  25. package/dist/{file-utils-DnTSiTJw.js → file-utils-DPmgn9Vm.js} +1 -1
  26. package/dist/{file-utils-DnTSiTJw.js.map → file-utils-DPmgn9Vm.js.map} +1 -1
  27. package/dist/{package-json-F_7oktsp.js → package-json-DZpnf6vU.js} +8 -10
  28. package/dist/package-json-DZpnf6vU.js.map +1 -0
  29. package/dist/package-json-_4PEss19.js +2 -0
  30. package/dist/{package-manager-BBTvHn9i.js → package-manager-DmDoOiaW.js} +2 -2
  31. package/dist/{package-manager-BBTvHn9i.js.map → package-manager-DmDoOiaW.js.map} +1 -1
  32. package/dist/{posthog-vm0k9PKS.js → posthog-BbQf_Hzq.js} +1 -1
  33. package/dist/{posthog-vm0k9PKS.js.map → posthog-BbQf_Hzq.js.map} +1 -1
  34. package/dist/posthog-integration-DZgP-ysj.js +1012 -0
  35. package/dist/posthog-integration-DZgP-ysj.js.map +1 -0
  36. package/dist/{provisioning-DRwH4skH.js → provisioning-Buqple4U.js} +3 -3
  37. package/dist/{provisioning-DRwH4skH.js.map → provisioning-Buqple4U.js.map} +1 -1
  38. package/dist/provisioning-CAf6fMWM.js +2 -0
  39. package/dist/{registry-CZjMhhsK.js → registry-PGYX7928.js} +5 -5
  40. package/dist/{registry-CZjMhhsK.js.map → registry-PGYX7928.js.map} +1 -1
  41. package/dist/setup-utils-LGtFkuI1.js +2 -0
  42. package/dist/{setup-utils-DGUR4Djo.js → setup-utils-xt6Z8gik.js} +77 -107
  43. package/dist/setup-utils-xt6Z8gik.js.map +1 -0
  44. package/dist/{AuditChecksViewer-CjBCZjxG.js → slides-0xga1duy.js} +626 -1058
  45. package/dist/slides-0xga1duy.js.map +1 -0
  46. package/dist/smoke-test-ci.sh +4 -4
  47. package/dist/{start-playground-DPYl5WR-.js → start-playground-DYElnFW1.js} +259 -10
  48. package/dist/start-playground-DYElnFW1.js.map +1 -0
  49. package/dist/{start-tui-Cj_4BhK8.js → start-tui-BBhG-LSW.js} +288 -446
  50. package/dist/start-tui-BBhG-LSW.js.map +1 -0
  51. package/dist/{steps-BFD76-MP.js → steps-B9mb9qRe.js} +7 -7
  52. package/dist/{steps-BFD76-MP.js.map → steps-B9mb9qRe.js.map} +1 -1
  53. package/dist/{task-stream-CX7Uf6EM.js → task-stream-DUpUZmFQ.js} +8 -8
  54. package/dist/task-stream-DUpUZmFQ.js.map +1 -0
  55. package/dist/telemetry-BFwKBgCJ.js +13 -0
  56. package/dist/telemetry-BFwKBgCJ.js.map +1 -0
  57. package/dist/{wizard-abort-54DpTnUi.js → wizard-abort-DWwOHzHR.js} +3 -3
  58. package/dist/{wizard-abort-54DpTnUi.js.map → wizard-abort-DWwOHzHR.js.map} +1 -1
  59. package/dist/{wizard-abort-CZH03nD0.js → wizard-abort-Djz2J6p9.js} +1 -1
  60. package/dist/wizard-session-CPhhll4P.js +2 -0
  61. package/dist/{wizard-session-BcNJTl2I.js → wizard-session-CsI33S4_.js} +6 -3
  62. package/dist/wizard-session-CsI33S4_.js.map +1 -0
  63. package/dist/wizard-ui-YdGFRyu_.js.map +1 -1
  64. package/package.json +3 -2
  65. package/dist/AuditChecksViewer-CjBCZjxG.js.map +0 -1
  66. package/dist/agent-interface-D9DeIikl.js.map +0 -1
  67. package/dist/agent-runner-B41-Iig3.js.map +0 -1
  68. package/dist/analytics-CpbY05Lf.js +0 -2
  69. package/dist/debug-B2BH87dh.js.map +0 -1
  70. package/dist/detection-BFl2AYV6.js.map +0 -1
  71. package/dist/package-json-BzVey4Bd.js +0 -2
  72. package/dist/package-json-F_7oktsp.js.map +0 -1
  73. package/dist/posthog-integration-vFBuSN5U.js +0 -259
  74. package/dist/posthog-integration-vFBuSN5U.js.map +0 -1
  75. package/dist/provisioning--RCv39tI.js +0 -2
  76. package/dist/router-COhhuIW3.js +0 -135
  77. package/dist/router-COhhuIW3.js.map +0 -1
  78. package/dist/setup-utils-DGUR4Djo.js.map +0 -1
  79. package/dist/setup-utils-eh1450iu.js +0 -2
  80. package/dist/start-playground-DPYl5WR-.js.map +0 -1
  81. package/dist/start-tui-Cj_4BhK8.js.map +0 -1
  82. package/dist/task-stream-CX7Uf6EM.js.map +0 -1
  83. package/dist/telemetry-DCyjsXhw.js +0 -13
  84. package/dist/telemetry-DCyjsXhw.js.map +0 -1
  85. package/dist/wizard-session-BQC9vy9Z.js +0 -2
  86. package/dist/wizard-session-BcNJTl2I.js.map +0 -1
  87. package/npm-shrinkwrap.json +0 -2931
@@ -1,16 +1,16 @@
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-B2BH87dh.js";
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-BH8HMBNX.js";
2
2
  import { a as relativeToInstallDir, n as WIZARD_LOG_FILE } from "./paths-DJS47p5x.js";
3
- import { n as analytics } from "./analytics-Cek5hIwm.js";
4
- import { l as ApiError, p as getUiHostFromHost } from "./setup-utils-DGUR4Djo.js";
5
- import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-BcNJTl2I.js";
6
- import { r as wizardAbort } from "./wizard-abort-54DpTnUi.js";
7
- import { _ as coerceAuditChecks, d as fetchSkillMenu, g as AUDIT_SEVERITY_STYLE, m as AUDIT_CHECKS_KEY, p as AUDIT_CHECKS_FILE, u as downloadSkill, v as getAuditChecks } from "./agent-interface-D9DeIikl.js";
8
- import { t as EVENT_PLAN_FILE } from "./posthog-integration-vFBuSN5U.js";
9
- import { i as fetchHealthIssues, n as getWorkflowConfig, o as POSTHOG_SDKS, s as STRIPE_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-D1IyBa9u.js";
12
- import "./router-COhhuIW3.js";
13
- import { E as WizardStore, S as SplitView, T as Icons, _ as useStdoutDimensions, a as SEVERITY_ORDER, b as ProgressList, c as LearnCard, d as ScreenContainer, f as EventPlanViewer, h as ConfirmationInput, i as SEVERITY_LABEL, l as HNViewer, m as ModalOverlay, n as McpScreen, o as ServiceHealthList, p as LogViewer, r as IssueTable, s as TipsCard, t as AuditChecksViewer, u as TabContainer, v as PickerMenu, w as Colors, x as LoadingBox, y as useKeyBindings } from "./AuditChecksViewer-CjBCZjxG.js";
3
+ import { n as analytics } from "./analytics-kUCNQQJm.js";
4
+ import { l as ApiError, p as getUiHostFromHost } from "./setup-utils-xt6Z8gik.js";
5
+ import { t as ADDITIONAL_FEATURE_LABELS } from "./wizard-session-CsI33S4_.js";
6
+ import { r as wizardAbort } from "./wizard-abort-DWwOHzHR.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-BJoqBI04.js";
8
+ import { t as EVENT_PLAN_FILE } from "./posthog-integration-DZgP-ysj.js";
9
+ import { o as Colors, s as Icons } from "./TextBlock-B3cm43YY.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-DVdyI6SQ.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-0xga1duy.js";
14
14
  import { spawn, spawnSync } from "node:child_process";
15
15
  import { join } from "node:path";
16
16
  import * as fs$1 from "fs";
@@ -18,7 +18,7 @@ import path from "path";
18
18
  import { Box, Text, render, useInput } from "ink";
19
19
  import { Fragment, createElement, useEffect, useMemo, useState, useSyncExternalStore } from "react";
20
20
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
21
- import { Spinner } from "@inkjs/ui";
21
+ import { Spinner, TextInput } from "@inkjs/ui";
22
22
  import { access, readdir, rm } from "node:fs/promises";
23
23
  //#region src/ui/tui/ink-ui.ts
24
24
  const ANSI_RE = /\x1b\[[0-9;]*m/g;
@@ -84,8 +84,11 @@ var InkUI = class {
84
84
  showSettingsOverride(conflicts, backupAndFix) {
85
85
  return this.store.showSettingsOverride(conflicts, backupAndFix);
86
86
  }
87
- showAuthError() {
88
- this.store.showAuthError();
87
+ showAuthError(detail) {
88
+ this.store.showAuthError(detail);
89
+ }
90
+ requestQuestion(question) {
91
+ return this.store.requestQuestion(question);
89
92
  }
90
93
  startRun() {
91
94
  this.store.setRunPhase("running");
@@ -135,6 +138,9 @@ var InkUI = class {
135
138
  setEventPlan(events) {
136
139
  this.store.setEventPlan(events);
137
140
  }
141
+ setDashboardUrl(url) {
142
+ this.store.setDashboardUrl(url);
143
+ }
138
144
  setFrameworkContext(key, value) {
139
145
  this.store.setFrameworkContext(key, value);
140
146
  }
@@ -142,14 +148,14 @@ var InkUI = class {
142
148
  //#endregion
143
149
  //#region src/ui/tui/screens/health/HealthCheckScreen.tsx
144
150
  /**
145
- * HealthCheckScreen — Flow screen between Intro and Auth.
151
+ * HealthCheckScreen — Program screen between Intro and Auth.
146
152
  *
147
153
  * Three states:
148
154
  * 1. Checking: spinner while health check runs
149
155
  * 2. Healthy: isComplete returns true, router auto-advances to Auth
150
156
  * 3. Blocking outage: shows affected services with Continue/Exit
151
157
  */
152
- const EXAMPLE_PROMPT = "Integrate PostHog into this project using the skill files in .posthog/skills/. Read SKILL.md first, then follow the numbered workflow files in order.";
158
+ const EXAMPLE_PROMPT = "Integrate PostHog into this project using the skill files in .posthog/skills/. Read SKILL.md first, then follow the numbered program files in order.";
153
159
  const SkillsDownloadedScreen = () => {
154
160
  useInput(() => {
155
161
  process.exit(0);
@@ -675,7 +681,7 @@ const PortConflictScreen = ({ store }) => {
675
681
  //#endregion
676
682
  //#region src/ui/tui/screens/IntroScreenLayout.tsx
677
683
  /**
678
- * IntroScreenLayout ��� Shared visual shell for all workflow intro screens.
684
+ * IntroScreenLayout ��� Shared visual shell for all program intro screens.
679
685
  *
680
686
  * Purely presentational — no store subscription. Parent components own
681
687
  * the store subscription and pass derived data as props.
@@ -704,7 +710,7 @@ const WizardTitle = ({ title }) => /* @__PURE__ */ jsxs(Text, {
704
710
  title
705
711
  ]
706
712
  });
707
- const IntroScreenLayout = ({ installDir, title = "PostHog Wizard 🦔", showSubtitle = true, body, showDetection = true, detectionRows, children, menuOptions, onSelect, workflowLabel, skillId, errorView }) => {
713
+ const IntroScreenLayout = ({ installDir, title = "PostHog Wizard 🦔", showSubtitle = true, body, showDetection = true, detectionRows, children, menuOptions, onSelect, programLabel, skillId, errorView }) => {
708
714
  const resolvedMenuOptions = menuOptions === void 0 ? [{
709
715
  label: "Continue",
710
716
  value: "continue"
@@ -777,17 +783,17 @@ const IntroScreenLayout = ({ installDir, title = "PostHog Wizard 🦔", showSubt
777
783
  }),
778
784
  " "
779
785
  ] }), /* @__PURE__ */ jsxs(Text, { children: [row.value, row.suffix ? ` ${row.suffix}` : ""] })] }, row.label)),
780
- workflowLabel && /* @__PURE__ */ jsxs(Text, { children: [
781
- "Workflow",
786
+ programLabel && /* @__PURE__ */ jsxs(Text, { children: [
787
+ "Program",
782
788
  " ",
783
789
  /* @__PURE__ */ jsx(Text, {
784
790
  color: "green",
785
791
  children: "✔"
786
792
  }),
787
793
  " ",
788
- workflowLabel
794
+ programLabel
789
795
  ] }),
790
- workflowLabel === "agent-skill" && skillId && /* @__PURE__ */ jsxs(Text, { children: [
796
+ programLabel === "agent-skill" && skillId && /* @__PURE__ */ jsxs(Text, { children: [
791
797
  "Skill",
792
798
  " ",
793
799
  /* @__PURE__ */ jsx(Text, {
@@ -913,7 +919,7 @@ const FrameworkPicker = ({ store, onComplete }) => {
913
919
  })),
914
920
  onSelect: (value) => {
915
921
  const integration = Array.isArray(value) ? value[0] : value;
916
- import("./registry-CZjMhhsK.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
922
+ import("./registry-PGYX7928.js").then((n) => n.n).then(({ FRAMEWORK_REGISTRY }) => {
917
923
  const config = FRAMEWORK_REGISTRY[integration];
918
924
  store.setFrameworkConfig(integration, config);
919
925
  store.setDetectedFramework(config.metadata.name);
@@ -984,10 +990,10 @@ const PostHogIntegrationIntroScreen = ({ store }) => {
984
990
  /* @__PURE__ */ jsx(Text, {
985
991
  italic: true,
986
992
  color: "cyan",
987
- children: session.workflowLabel
993
+ children: session.programLabel
988
994
  }),
989
995
  " ",
990
- "workflow installs the PostHog SDKs, instruments event tracking, and integrates the following dev tools for your application:"
996
+ "program installs the PostHog SDKs, instruments event tracking, and integrates the following dev tools for your application:"
991
997
  ] })
992
998
  }),
993
999
  /* @__PURE__ */ jsxs(Box, {
@@ -1132,7 +1138,7 @@ const PostHogIntegrationIntroScreen = ({ store }) => {
1132
1138
  detectionRows,
1133
1139
  menuOptions: unsupported ? null : menuOptions,
1134
1140
  onSelect: handleSelect,
1135
- workflowLabel: session.workflowLabel,
1141
+ programLabel: session.programLabel,
1136
1142
  skillId: session.skillId,
1137
1143
  children: bodyChildren
1138
1144
  });
@@ -1188,10 +1194,10 @@ const RevenueIntroScreen = ({ store }) => {
1188
1194
  /* @__PURE__ */ jsx(Text, {
1189
1195
  italic: true,
1190
1196
  color: "cyan",
1191
- children: session.workflowLabel
1197
+ children: session.programLabel
1192
1198
  }),
1193
1199
  " ",
1194
- "workflow links Stripe customers and purchases to PostHog product data and persons. It unlocks insights like:"
1200
+ "program links Stripe customers and purchases to PostHog product data and persons. It unlocks insights like:"
1195
1201
  ] })
1196
1202
  }),
1197
1203
  /* @__PURE__ */ jsxs(Box, {
@@ -1276,7 +1282,7 @@ const RevenueIntroScreen = ({ store }) => {
1276
1282
  showDetection: !showingMoreInfo,
1277
1283
  detectionRows,
1278
1284
  errorView,
1279
- workflowLabel: session.workflowLabel,
1285
+ programLabel: session.programLabel,
1280
1286
  skillId: session.skillId,
1281
1287
  menuOptions,
1282
1288
  onSelect: (value) => {
@@ -1411,11 +1417,39 @@ const DetectErrorBody = ({ error }) => {
1411
1417
  }
1412
1418
  };
1413
1419
  //#endregion
1420
+ //#region src/ui/tui/screens/MigrationIntroScreen.tsx
1421
+ const MigrationIntroScreen = ({ store }) => {
1422
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
1423
+ const { session } = store;
1424
+ const body = /* @__PURE__ */ jsx(Box, {
1425
+ flexDirection: "column",
1426
+ alignItems: "center",
1427
+ children: /* @__PURE__ */ jsx(Text, { children: "Let's migrate this project to PostHog." })
1428
+ });
1429
+ return /* @__PURE__ */ jsx(IntroScreenLayout, {
1430
+ installDir: session.installDir,
1431
+ body,
1432
+ programLabel: session.programLabel,
1433
+ skillId: session.skillId,
1434
+ menuOptions: [{
1435
+ label: "Continue",
1436
+ value: "continue"
1437
+ }, {
1438
+ label: "Cancel",
1439
+ value: "cancel"
1440
+ }],
1441
+ onSelect: (value) => {
1442
+ if (value === "cancel") process.exit(0);
1443
+ else store.completeSetup();
1444
+ }
1445
+ });
1446
+ };
1447
+ //#endregion
1414
1448
  //#region src/ui/tui/screens/AgentSkillIntroScreen.tsx
1415
1449
  /**
1416
- * AgentSkillIntroScreen — Default intro for generic agent-skill workflows.
1450
+ * AgentSkillIntroScreen — Default intro for generic agent-skill programs.
1417
1451
  *
1418
- * Workflows that need a different intro ship their own screen component
1452
+ * Programs that need a different intro ship their own screen component
1419
1453
  * (see audit/AuditIntroScreen.tsx).
1420
1454
  */
1421
1455
  const AgentSkillIntroScreen = ({ store }) => {
@@ -1491,7 +1525,7 @@ const AgentSkillIntroScreen = ({ store }) => {
1491
1525
  showSubtitle: !showingMoreInfo,
1492
1526
  body,
1493
1527
  showDetection: !showingMoreInfo,
1494
- workflowLabel: session.workflowLabel,
1528
+ programLabel: session.programLabel,
1495
1529
  skillId: session.skillId,
1496
1530
  menuOptions,
1497
1531
  onSelect: handleSelect
@@ -1499,12 +1533,12 @@ const AgentSkillIntroScreen = ({ store }) => {
1499
1533
  };
1500
1534
  //#endregion
1501
1535
  //#region src/ui/tui/screens/audit/AuditIntroScreen.tsx
1502
- const AUDIT_SKILL_ID = "audit";
1503
1536
  const AuditIntroScreen = ({ store }) => {
1504
1537
  useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
1505
1538
  const [showingMoreInfo, setShowingMoreInfo] = useState(false);
1506
1539
  const { session } = store;
1507
- const { skillEntry, fetchFailed } = useSkillEntry(AUDIT_SKILL_ID, session.localMcp);
1540
+ const skillId = session.skillId ?? "audit";
1541
+ const { skillEntry, fetchFailed } = useSkillEntry(skillId, session.localMcp);
1508
1542
  const body = showingMoreInfo ? /* @__PURE__ */ jsxs(Box, {
1509
1543
  flexDirection: "column",
1510
1544
  width: 56,
@@ -1522,15 +1556,15 @@ const AuditIntroScreen = ({ store }) => {
1522
1556
  /* @__PURE__ */ jsx(Text, {
1523
1557
  color: "cyan",
1524
1558
  italic: true,
1525
- children: AUDIT_SKILL_ID
1559
+ children: skillId
1526
1560
  }),
1527
1561
  " ",
1528
- "workflow reviews your project's PostHog integration against best practices to help you capture high-quality events and writes a report for suggested actions. Nothing in your project will be modified."
1562
+ "program reviews your project's PostHog integration against best practices to help you capture high-quality events and writes a report for suggested actions. Nothing in your project will be modified."
1529
1563
  ] }),
1530
1564
  /* @__PURE__ */ jsx(Box, {
1531
1565
  marginTop: 1,
1532
1566
  children: /* @__PURE__ */ jsx(SkillSourceInfo, {
1533
- skillId: AUDIT_SKILL_ID,
1567
+ skillId,
1534
1568
  skillEntry,
1535
1569
  fetchFailed
1536
1570
  })
@@ -1568,7 +1602,7 @@ const AuditIntroScreen = ({ store }) => {
1568
1602
  installDir: session.installDir,
1569
1603
  body,
1570
1604
  showDetection: !showingMoreInfo,
1571
- workflowLabel: session.workflowLabel,
1605
+ programLabel: session.programLabel,
1572
1606
  skillId: session.skillId,
1573
1607
  menuOptions,
1574
1608
  onSelect: handleSelect
@@ -1639,212 +1673,6 @@ function useFileWatcher(path, onUpdate, options = {}) {
1639
1673
  }, [path]);
1640
1674
  }
1641
1675
  //#endregion
1642
- //#region src/ui/tui/screens/audit/slides/shared.tsx
1643
- /** Narrow bordered box for the small ASCII illustrations in baseline slides. */
1644
- const VisualBox = ({ children }) => /* @__PURE__ */ jsx(Box, {
1645
- borderStyle: "single",
1646
- borderColor: Colors.muted,
1647
- paddingX: 1,
1648
- flexDirection: "column",
1649
- marginBottom: 1,
1650
- children
1651
- });
1652
- //#endregion
1653
- //#region src/ui/tui/screens/audit/slides/installation.tsx
1654
- const InstallationVisual = () => /* @__PURE__ */ jsxs(VisualBox, { children: [
1655
- /* @__PURE__ */ jsx(Text, {
1656
- dimColor: true,
1657
- children: "app boot"
1658
- }),
1659
- /* @__PURE__ */ jsxs(Text, { children: [
1660
- /* @__PURE__ */ jsx(Text, {
1661
- dimColor: true,
1662
- children: " ▼ "
1663
- }),
1664
- /* @__PURE__ */ jsx(Text, {
1665
- color: "green",
1666
- children: "posthog.init(...)"
1667
- }),
1668
- /* @__PURE__ */ jsx(Text, {
1669
- dimColor: true,
1670
- children: " once"
1671
- })
1672
- ] }),
1673
- /* @__PURE__ */ jsx(Text, {
1674
- dimColor: true,
1675
- children: " │"
1676
- }),
1677
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
1678
- dimColor: true,
1679
- children: " ▼ "
1680
- }), /* @__PURE__ */ jsx(Text, {
1681
- color: "cyan",
1682
- children: "posthog.capture('pageview')"
1683
- })] }),
1684
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
1685
- dimColor: true,
1686
- children: " "
1687
- }), /* @__PURE__ */ jsx(Text, {
1688
- color: "cyan",
1689
- children: "posthog.capture('signup')"
1690
- })] }),
1691
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
1692
- dimColor: true,
1693
- children: " "
1694
- }), /* @__PURE__ */ jsx(Text, {
1695
- color: "cyan",
1696
- children: "posthog.capture('purchase')"
1697
- })] })
1698
- ] });
1699
- const InstallationSlide = {
1700
- area: "Installation",
1701
- intro: [
1702
- "PostHog releases frequent SDK updates to fix bugs and add new features. We're checking your project's SDK version and making sure it's up to date.",
1703
- "We're also checking that your SDK is initialized correctly and in the right part of your app's lifecycle.",
1704
- "This ensures you won't miss any autocaptured events."
1705
- ],
1706
- visual: /* @__PURE__ */ jsx(InstallationVisual, {}),
1707
- docsUrl: "https://posthog.com/docs/getting-started/install"
1708
- };
1709
- //#endregion
1710
- //#region src/ui/tui/screens/audit/slides/identification.tsx
1711
- const IdentificationVisual = () => /* @__PURE__ */ jsxs(VisualBox, { children: [
1712
- /* @__PURE__ */ jsxs(Text, { children: [
1713
- /* @__PURE__ */ jsx(Text, {
1714
- bold: true,
1715
- children: "browser "
1716
- }),
1717
- /* @__PURE__ */ jsx(Text, {
1718
- dimColor: true,
1719
- children: "capture"
1720
- }),
1721
- /* @__PURE__ */ jsx(Text, { children: " (" }),
1722
- /* @__PURE__ */ jsx(Text, {
1723
- color: "cyan",
1724
- children: "u_42"
1725
- }),
1726
- /* @__PURE__ */ jsx(Text, { children: ", \"click\")" })
1727
- ] }),
1728
- /* @__PURE__ */ jsx(Text, {
1729
- dimColor: true,
1730
- children: " │"
1731
- }),
1732
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
1733
- dimColor: true,
1734
- children: " ▼ "
1735
- }), /* @__PURE__ */ jsx(Text, {
1736
- color: "green",
1737
- children: "same distinct_id"
1738
- })] }),
1739
- /* @__PURE__ */ jsx(Text, {
1740
- dimColor: true,
1741
- children: " │"
1742
- }),
1743
- /* @__PURE__ */ jsxs(Text, { children: [
1744
- /* @__PURE__ */ jsx(Text, {
1745
- bold: true,
1746
- children: "server "
1747
- }),
1748
- /* @__PURE__ */ jsx(Text, {
1749
- dimColor: true,
1750
- children: "capture"
1751
- }),
1752
- /* @__PURE__ */ jsx(Text, { children: " (" }),
1753
- /* @__PURE__ */ jsx(Text, {
1754
- color: "cyan",
1755
- children: "u_42"
1756
- }),
1757
- /* @__PURE__ */ jsx(Text, { children: ", \"charged\")" })
1758
- ] })
1759
- ] });
1760
- const IdentificationSlide = {
1761
- area: "Identification",
1762
- intro: [
1763
- "For events to be useful, they need to be reliably attributed to a user.",
1764
- "We're checking your project's `identify()` calls to make sure they're correctly and consistently implemented.",
1765
- "We're also checking that your `distinct_id`s are correctly passed between your client and server runtimes if applicable."
1766
- ],
1767
- visual: /* @__PURE__ */ jsx(IdentificationVisual, {}),
1768
- docsUrl: "https://posthog.com/docs/product-analytics/identify"
1769
- };
1770
- //#endregion
1771
- //#region src/ui/tui/screens/audit/slides/eventCapture.tsx
1772
- const CaptureVisual = () => /* @__PURE__ */ jsxs(VisualBox, { children: [
1773
- /* @__PURE__ */ jsxs(Text, { children: [
1774
- /* @__PURE__ */ jsx(Text, {
1775
- color: "cyan",
1776
- children: "pageview "
1777
- }),
1778
- /* @__PURE__ */ jsx(Text, {
1779
- color: "green",
1780
- children: "████████████"
1781
- }),
1782
- /* @__PURE__ */ jsx(Text, {
1783
- dimColor: true,
1784
- children: " 1000"
1785
- })
1786
- ] }),
1787
- /* @__PURE__ */ jsxs(Text, { children: [
1788
- /* @__PURE__ */ jsx(Text, {
1789
- color: "cyan",
1790
- children: "signup "
1791
- }),
1792
- /* @__PURE__ */ jsx(Text, {
1793
- color: "green",
1794
- children: "████████"
1795
- }),
1796
- /* @__PURE__ */ jsx(Text, {
1797
- dimColor: true,
1798
- children: " 640"
1799
- })
1800
- ] }),
1801
- /* @__PURE__ */ jsxs(Text, { children: [
1802
- /* @__PURE__ */ jsx(Text, {
1803
- color: "cyan",
1804
- children: "activated "
1805
- }),
1806
- /* @__PURE__ */ jsx(Text, {
1807
- color: "green",
1808
- children: "█████"
1809
- }),
1810
- /* @__PURE__ */ jsx(Text, {
1811
- dimColor: true,
1812
- children: " 410"
1813
- })
1814
- ] }),
1815
- /* @__PURE__ */ jsxs(Text, { children: [
1816
- /* @__PURE__ */ jsx(Text, {
1817
- color: "cyan",
1818
- children: "purchased "
1819
- }),
1820
- /* @__PURE__ */ jsx(Text, {
1821
- color: "green",
1822
- children: "██"
1823
- }),
1824
- /* @__PURE__ */ jsx(Text, {
1825
- dimColor: true,
1826
- children: " 120"
1827
- })
1828
- ] })
1829
- ] });
1830
- const EventCaptureSlide = {
1831
- area: "Event Capture",
1832
- intro: [
1833
- "Everything you do in PostHog starts with event captures. Every dashboard, insight, funnel, cohort, and replay is built on top of events.",
1834
- "We're checking that your project's event capture calls cover key user actions and use sensible event names, so you can build high-quality insights and reports.",
1835
- "We're also checking that you use a reverse proxy so your events are not blocked by ad blockers or tracking blockers."
1836
- ],
1837
- visual: /* @__PURE__ */ jsx(CaptureVisual, {}),
1838
- docsUrl: "https://posthog.com/docs/product-analytics/capture-events"
1839
- };
1840
- //#endregion
1841
- //#region src/ui/tui/screens/audit/slides/index.ts
1842
- const AUDIT_AREA_SLIDES = [
1843
- InstallationSlide,
1844
- IdentificationSlide,
1845
- EventCaptureSlide
1846
- ];
1847
- //#endregion
1848
1676
  //#region src/ui/tui/screens/audit/AuditAreaPane.tsx
1849
1677
  /**
1850
1678
  * AuditAreaPane — left-pane slide that follows whatever area the agent is
@@ -2077,7 +1905,7 @@ const AuditRunScreen = ({ store }) => {
2077
1905
  const statuses = store.statusMessages.length > 0 ? store.statusMessages : void 0;
2078
1906
  const [columns] = useStdoutDimensions();
2079
1907
  const checks = getAuditChecks(store.session);
2080
- const reportPath = `./${getWorkflowConfig(store.router.activeFlow)?.reportFile ?? "posthog-audit-report.md"}`;
1908
+ const reportPath = `./${getProgramConfig(store.router.activeProgram).reportFile ?? "posthog-audit-report.md"}`;
2081
1909
  const pendingChecksList = /* @__PURE__ */ jsx(PendingChecksList, { checks });
2082
1910
  return /* @__PURE__ */ jsx(TabContainer, {
2083
1911
  tabs: [
@@ -2204,7 +2032,7 @@ const AuditChecksOutroSection = ({ checks, installDir }) => {
2204
2032
  * AuditOutroScreen — Audit-specific post-run summary. Renders the standard
2205
2033
  * success / error / cancel views with the audit checks summary inlined into
2206
2034
  * the success body. The report path shown in the success headline comes from
2207
- * the workflow's `successMessage`, so this screen is workflow-agnostic.
2035
+ * the program's `successMessage`, so this screen is program-agnostic.
2208
2036
  */
2209
2037
  const AuditOutroScreen = ({ store }) => {
2210
2038
  useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
@@ -2391,7 +2219,7 @@ const Audit3000IntroScreen = ({ store }) => {
2391
2219
  children: AUDIT3000_SKILL_ID
2392
2220
  }),
2393
2221
  " ",
2394
- "workflow reviews your PostHog integration across 34 checks — SDK install, identification, event capture, event quality, stale feature flag hygiene, session replay (fix + optimize), and use-case expansion across 8 PostHog products. When enrichment is available it also produces a company profile and use-case match. Nothing in your project is modified."
2222
+ "program reviews your PostHog integration across 34 checks — SDK install, identification, event capture, event quality, stale feature flag hygiene, session replay (fix + optimize), and use-case expansion across 8 PostHog products. When enrichment is available it also produces a company profile and use-case match. Nothing in your project is modified."
2395
2223
  ] }),
2396
2224
  /* @__PURE__ */ jsx(Box, {
2397
2225
  marginTop: 1,
@@ -2482,183 +2310,13 @@ const Audit3000IntroScreen = ({ store }) => {
2482
2310
  installDir: session.installDir,
2483
2311
  body,
2484
2312
  showDetection: !showingMoreInfo,
2485
- workflowLabel: session.workflowLabel,
2313
+ programLabel: session.programLabel,
2486
2314
  skillId: session.skillId,
2487
2315
  menuOptions,
2488
2316
  onSelect: handleSelect
2489
2317
  });
2490
2318
  };
2491
2319
  //#endregion
2492
- //#region src/ui/tui/screens/audit-3000/slides/eventQuality.tsx
2493
- const EventQualityVisual = () => /* @__PURE__ */ jsxs(VisualBox, { children: [
2494
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
2495
- color: "green",
2496
- children: "event_clicked "
2497
- }), /* @__PURE__ */ jsx(Text, {
2498
- color: "green",
2499
- children: "✓"
2500
- })] }),
2501
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
2502
- color: "yellow",
2503
- children: "eventClicked "
2504
- }), /* @__PURE__ */ jsx(Text, {
2505
- color: "yellow",
2506
- children: "~ duplicate?"
2507
- })] }),
2508
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
2509
- color: "yellow",
2510
- children: "click_event "
2511
- }), /* @__PURE__ */ jsx(Text, {
2512
- color: "yellow",
2513
- children: "~ duplicate?"
2514
- })] }),
2515
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
2516
- color: "red",
2517
- children: "big_kitchen_sink "
2518
- }), /* @__PURE__ */ jsx(Text, {
2519
- color: "red",
2520
- children: "✗ 22 props"
2521
- })] })
2522
- ] });
2523
- const EventQualitySlide = {
2524
- area: "Event Quality",
2525
- intro: [
2526
- "LEVEL 5: EVENT QUALITY. The capture call-sites are clean. The events themselves are the real boss fight.",
2527
- "Scanning for: naming inconsistencies, semantic duplicates, kitchen-sink event payloads, and (if your PostHog project is linked) which captured events actually drive insights and dashboards.",
2528
- "4 subagents fan out in parallel. The ticker shows them clearing checks live."
2529
- ],
2530
- visual: /* @__PURE__ */ jsx(EventQualityVisual, {}),
2531
- docsUrl: "https://posthog.com/docs/product-analytics/best-practices"
2532
- };
2533
- //#endregion
2534
- //#region src/ui/tui/screens/audit-3000/slides/featureFlags.tsx
2535
- const FeatureFlagsVisual = () => /* @__PURE__ */ jsxs(VisualBox, { children: [
2536
- /* @__PURE__ */ jsxs(Text, { children: [
2537
- /* @__PURE__ */ jsx(Text, {
2538
- color: "red",
2539
- children: "new-checkout-v2 "
2540
- }),
2541
- /* @__PURE__ */ jsx(Text, {
2542
- dimColor: true,
2543
- children: "no code refs "
2544
- }),
2545
- /* @__PURE__ */ jsx(Text, {
2546
- color: "red",
2547
- children: "DROP"
2548
- })
2549
- ] }),
2550
- /* @__PURE__ */ jsxs(Text, { children: [
2551
- /* @__PURE__ */ jsx(Text, {
2552
- color: "yellow",
2553
- children: "beta-dashboard "
2554
- }),
2555
- /* @__PURE__ */ jsx(Text, {
2556
- dimColor: true,
2557
- children: "1 ref, 100% on "
2558
- }),
2559
- /* @__PURE__ */ jsx(Text, {
2560
- color: "yellow",
2561
- children: "REVIEW"
2562
- })
2563
- ] }),
2564
- /* @__PURE__ */ jsxs(Text, { children: [
2565
- /* @__PURE__ */ jsx(Text, {
2566
- color: "green",
2567
- children: "killswitch-payments"
2568
- }),
2569
- /* @__PURE__ */ jsx(Text, {
2570
- dimColor: true,
2571
- children: "live experiment"
2572
- }),
2573
- /* @__PURE__ */ jsx(Text, {
2574
- color: "green",
2575
- children: "KEEP"
2576
- })
2577
- ] })
2578
- ] });
2579
- const FeatureFlagsSlide = {
2580
- area: "Feature Flags",
2581
- intro: [
2582
- "LEVEL 6: STALE FLAGS. Old flags add evaluation overhead and confuse the next engineer who wonders if a flag is still live.",
2583
- "Cross-referencing PostHog's stale-flag classification against your source tree. Each flag scored: safe-to-disable, needs-review, or unknown.",
2584
- "The final report ships with a copy-paste cleanup prompt. We never touch a flag."
2585
- ],
2586
- visual: /* @__PURE__ */ jsx(FeatureFlagsVisual, {}),
2587
- docsUrl: "https://posthog.com/docs/feature-flags"
2588
- };
2589
- //#endregion
2590
- //#region src/ui/tui/screens/audit-3000/slides/expansion.tsx
2591
- const ExpansionVisual = () => /* @__PURE__ */ jsxs(VisualBox, { children: [
2592
- /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
2593
- color: "cyan",
2594
- children: "product analytics "
2595
- }), /* @__PURE__ */ jsx(Text, {
2596
- color: "green",
2597
- children: "■■■■■"
2598
- })] }),
2599
- /* @__PURE__ */ jsxs(Text, { children: [
2600
- /* @__PURE__ */ jsx(Text, {
2601
- color: "cyan",
2602
- children: "error tracking "
2603
- }),
2604
- /* @__PURE__ */ jsx(Text, {
2605
- color: "red",
2606
- children: "□□□□□"
2607
- }),
2608
- /* @__PURE__ */ jsx(Text, {
2609
- dimColor: true,
2610
- children: " sentry detected"
2611
- })
2612
- ] }),
2613
- /* @__PURE__ */ jsxs(Text, { children: [
2614
- /* @__PURE__ */ jsx(Text, {
2615
- color: "cyan",
2616
- children: "session replay "
2617
- }),
2618
- /* @__PURE__ */ jsx(Text, {
2619
- color: "yellow",
2620
- children: "■■□□□"
2621
- }),
2622
- /* @__PURE__ */ jsx(Text, {
2623
- dimColor: true,
2624
- children: " partial"
2625
- })
2626
- ] }),
2627
- /* @__PURE__ */ jsxs(Text, { children: [
2628
- /* @__PURE__ */ jsx(Text, {
2629
- color: "cyan",
2630
- children: "llm observability "
2631
- }),
2632
- /* @__PURE__ */ jsx(Text, {
2633
- color: "red",
2634
- children: "□□□□□"
2635
- }),
2636
- /* @__PURE__ */ jsx(Text, {
2637
- dimColor: true,
2638
- children: " greenfield"
2639
- })
2640
- ] })
2641
- ] });
2642
- //#endregion
2643
- //#region src/ui/tui/screens/audit-3000/slides/index.ts
2644
- const AUDIT_3000_AREA_SLIDES = [
2645
- InstallationSlide,
2646
- IdentificationSlide,
2647
- EventCaptureSlide,
2648
- EventQualitySlide,
2649
- FeatureFlagsSlide,
2650
- {
2651
- area: "Use Case: Expansion",
2652
- intro: [
2653
- "BONUS ROUND: EXPANSION. You might be paying for tools PostHog covers natively.",
2654
- "Scanning for competitive SDKs (Sentry, LaunchDarkly, Mixpanel, Datadog, OpenTelemetry, GA4) and PostHog coverage gaps across 8 product surfaces.",
2655
- "8 subagents in two waves of 4. Each one returns one of: cross-sell, greenfield, gap, or pass."
2656
- ],
2657
- visual: /* @__PURE__ */ jsx(ExpansionVisual, {}),
2658
- docsUrl: "https://posthog.com/docs"
2659
- }
2660
- ];
2661
- //#endregion
2662
2320
  //#region src/ui/tui/screens/audit-3000/Audit3000AreaPane.tsx
2663
2321
  /**
2664
2322
  * Audit-3000 right pane — arcade-flavoured fork of `AuditAreaPane`.
@@ -2773,7 +2431,7 @@ const WritingReport = ({ reportPath }) => /* @__PURE__ */ jsxs(Box, {
2773
2431
  //#region src/ui/tui/screens/audit-3000/Audit3000ChecksPanel.tsx
2774
2432
  /**
2775
2433
  * Audit-3000 left pane on the Run screen. Arcade-flavoured fork of the
2776
- * audit workflow's `PendingChecksList`: a running score banner sits on
2434
+ * audit program's `PendingChecksList`: a running score banner sits on
2777
2435
  * top, then the area-level "level" headers underneath.
2778
2436
  *
2779
2437
  * Per-check rows are deliberately omitted here — the Hi-score Table tab
@@ -3180,7 +2838,7 @@ const Audit3000RunScreen = ({ store }) => {
3180
2838
  const [columns] = useStdoutDimensions();
3181
2839
  const [gameState, setGameState] = useState(() => initialState());
3182
2840
  const checks = getAuditChecks(store.session);
3183
- const reportPath = `./${getWorkflowConfig(store.router.activeFlow)?.reportFile ?? AUDIT_3000_REPORT_FILE_FALLBACK}`;
2841
+ const reportPath = `./${getProgramConfig(store.router.activeProgram).reportFile ?? AUDIT_3000_REPORT_FILE_FALLBACK}`;
3184
2842
  const checksPanel = /* @__PURE__ */ jsx(Audit3000ChecksPanel, { checks });
3185
2843
  return /* @__PURE__ */ jsx(TabContainer, {
3186
2844
  tabs: [
@@ -3589,7 +3247,7 @@ const AuthScreen = ({ store }) => {
3589
3247
  * RunScreen — Default observational view of the agent run.
3590
3248
  *
3591
3249
  * Tabs: Status (LearnCard + ProgressList), Event plan (when present),
3592
- * Tail logs, HN. Workflows that need a different tab list ship their own
3250
+ * Tail logs, HN. Programs that need a different tab list ship their own
3593
3251
  * screen component (see audit/AuditRunScreen.tsx).
3594
3252
  */
3595
3253
  const RunScreen = ({ store }) => {
@@ -3617,8 +3275,13 @@ const RunScreen = ({ store }) => {
3617
3275
  });
3618
3276
  }
3619
3277
  const statuses = store.statusMessages.length > 0 ? store.statusMessages : void 0;
3278
+ const activeProgram = store.router.activeProgram;
3279
+ const learnBlocks = useMemo(() => {
3280
+ return (getProgramConfig(activeProgram).getContentBlocks ?? getContentBlocks)(store);
3281
+ }, [store, activeProgram]);
3620
3282
  const leftPane = store.learnCardComplete ? /* @__PURE__ */ jsx(TipsCard, { store }) : /* @__PURE__ */ jsx(LearnCard, {
3621
3283
  store,
3284
+ blocks: learnBlocks,
3622
3285
  onComplete: () => store.setLearnCardComplete()
3623
3286
  });
3624
3287
  const progressList = /* @__PURE__ */ jsx(ProgressList, {
@@ -3816,7 +3479,7 @@ const KeepSkillsScreen = ({ store }) => {
3816
3479
  /**
3817
3480
  * OutroScreen — Default post-run summary.
3818
3481
  *
3819
- * Renders the success / error / cancel views from `outroData`. Workflows
3482
+ * Renders the success / error / cancel views from `outroData`. Programs
3820
3483
  * that need a different success view (e.g. with extra summary content)
3821
3484
  * ship their own screen component (see audit/AuditOutroScreen.tsx).
3822
3485
  */
@@ -3892,6 +3555,17 @@ const OutroScreen = ({ store }) => {
3892
3555
  })
3893
3556
  ] }, event.name))]
3894
3557
  }),
3558
+ outroData.dashboardUrl && /* @__PURE__ */ jsx(Box, {
3559
+ marginTop: 1,
3560
+ children: /* @__PURE__ */ jsxs(Text, { children: [
3561
+ "We've also made you a dashboard:",
3562
+ " ",
3563
+ /* @__PURE__ */ jsx(Text, {
3564
+ color: "cyan",
3565
+ children: outroData.dashboardUrl
3566
+ })
3567
+ ] })
3568
+ }),
3895
3569
  outroData.docsUrl && /* @__PURE__ */ jsx(Box, {
3896
3570
  marginTop: 1,
3897
3571
  children: /* @__PURE__ */ jsxs(Text, { children: ["Learn more: ", /* @__PURE__ */ jsx(Text, {
@@ -3964,7 +3638,7 @@ const OutroScreen = ({ store }) => {
3964
3638
  //#endregion
3965
3639
  //#region src/ui/tui/screens/ExitScreen.tsx
3966
3640
  /**
3967
- * ExitScreen — Final step in every workflow.
3641
+ * ExitScreen — Final step in every program.
3968
3642
  *
3969
3643
  * Renders nothing. Immediately exits the process.
3970
3644
  * The cleanup handler in start-tui.ts handles the exit summary line.
@@ -3978,15 +3652,22 @@ const ExitScreen = () => {
3978
3652
  //#endregion
3979
3653
  //#region src/ui/tui/screens/AuthErrorScreen.tsx
3980
3654
  /**
3981
- * AuthErrorScreen — Shown when the Anthropic API returns a 401.
3655
+ * AuthErrorScreen — Shown when the PostHog LLM Gateway returns a 401.
3982
3656
  *
3983
- * Claude Code's own auth can conflict with the wizard's OAuth token.
3984
- * This overlay tells the user to log out of Claude Code and retry.
3657
+ * Two distinct causes:
3658
+ * 1. Claude Code settings.json / managed-settings overrides ANTHROPIC_*
3659
+ * env vars — auth conflict. Tell the user to log out of Claude Code.
3660
+ * 2. The PostHog API key itself was rejected — bad prefix, missing scope,
3661
+ * expired, or wrong region. Don't blame Claude Code in this case.
3985
3662
  */
3986
- const AuthErrorScreen = () => {
3663
+ const AuthErrorScreen = ({ store }) => {
3664
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
3987
3665
  useInput(() => {
3988
3666
  process.exit(1);
3989
3667
  });
3668
+ const detail = store.session.authErrorDetail;
3669
+ const hasSettingsConflict = detail?.hasSettingsConflict ?? true;
3670
+ const logFilePath = detail?.logFilePath;
3990
3671
  return /* @__PURE__ */ jsxs(Box, {
3991
3672
  flexDirection: "column",
3992
3673
  flexGrow: 1,
@@ -3996,37 +3677,196 @@ const AuthErrorScreen = () => {
3996
3677
  bold: true,
3997
3678
  children: ["✘", " Authentication error"]
3998
3679
  }),
3999
- /* @__PURE__ */ jsx(Box, {
3680
+ hasSettingsConflict ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
3681
+ /* @__PURE__ */ jsx(Box, {
3682
+ flexDirection: "column",
3683
+ marginTop: 1,
3684
+ children: /* @__PURE__ */ jsx(Text, { children: "The Wizard couldn't connect to the PostHog LLM Gateway. Claude Code settings on this machine are overriding the Wizard's credentials." })
3685
+ }),
3686
+ /* @__PURE__ */ jsx(Box, {
3687
+ marginTop: 1,
3688
+ children: /* @__PURE__ */ jsx(Text, {
3689
+ dimColor: true,
3690
+ children: "Try logging out of Claude Code temporarily and re-running the Wizard:"
3691
+ })
3692
+ }),
3693
+ /* @__PURE__ */ jsx(Box, {
3694
+ flexDirection: "column",
3695
+ marginTop: 1,
3696
+ paddingLeft: 2,
3697
+ children: /* @__PURE__ */ jsx(Text, {
3698
+ color: "cyan",
3699
+ children: "claude auth logout"
3700
+ })
3701
+ })
3702
+ ] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Box, {
4000
3703
  flexDirection: "column",
4001
3704
  marginTop: 1,
4002
- children: /* @__PURE__ */ jsx(Text, { children: "The Wizard couldn't connect to the PostHog LLM Gateway. If you use Claude Code, its credentials might conflict with the Wizard." })
3705
+ children: /* @__PURE__ */ jsx(Text, { children: "The PostHog LLM Gateway rejected the API key. Common causes:" })
3706
+ }), /* @__PURE__ */ jsxs(Box, {
3707
+ flexDirection: "column",
3708
+ marginTop: 1,
3709
+ paddingLeft: 2,
3710
+ children: [
3711
+ /* @__PURE__ */ jsxs(Text, { children: [
3712
+ "•",
3713
+ " Wrong key type — pass a personal API key (",
3714
+ /* @__PURE__ */ jsx(Text, {
3715
+ color: "cyan",
3716
+ children: "phx_xxx"
3717
+ }),
3718
+ ")."
3719
+ ] }),
3720
+ /* @__PURE__ */ jsxs(Text, {
3721
+ dimColor: true,
3722
+ children: [" ", "pha_ is an OAuth access token, phc_ is a project key."]
3723
+ }),
3724
+ /* @__PURE__ */ jsxs(Text, { children: [
3725
+ "•",
3726
+ " Missing scope — the key needs",
3727
+ " ",
3728
+ /* @__PURE__ */ jsx(Text, {
3729
+ color: "cyan",
3730
+ children: "llm_gateway:read"
3731
+ }),
3732
+ "."
3733
+ ] }),
3734
+ /* @__PURE__ */ jsxs(Text, { children: ["•", " Expired or revoked key."] }),
3735
+ /* @__PURE__ */ jsxs(Text, { children: [
3736
+ "•",
3737
+ " Region mismatch — ",
3738
+ /* @__PURE__ */ jsx(Text, {
3739
+ color: "cyan",
3740
+ children: "--region"
3741
+ }),
3742
+ " must match where the key was issued (us vs eu)."
3743
+ ] })
3744
+ ]
3745
+ })] }),
3746
+ logFilePath && /* @__PURE__ */ jsx(Box, {
3747
+ marginTop: 1,
3748
+ children: /* @__PURE__ */ jsxs(Text, {
3749
+ dimColor: true,
3750
+ children: ["Verbose log: ", logFilePath]
3751
+ })
4003
3752
  }),
4004
3753
  /* @__PURE__ */ jsx(Box, {
4005
3754
  marginTop: 1,
3755
+ children: /* @__PURE__ */ jsx(Text, {
3756
+ color: Colors.muted,
3757
+ children: "Press any key to exit"
3758
+ })
3759
+ })
3760
+ ]
3761
+ });
3762
+ };
3763
+ //#endregion
3764
+ //#region src/ui/tui/screens/WizardAskScreen.tsx
3765
+ /**
3766
+ * WizardAskScreen — Overlay for the `wizard_ask` MCP tool.
3767
+ *
3768
+ * Walks the agent's question list one at a time and accumulates answers.
3769
+ * When the user submits the last question, the store resolves the
3770
+ * pending request and the overlay pops, returning the agent to its run.
3771
+ */
3772
+ const WizardAskScreen = ({ store }) => {
3773
+ useSyncExternalStore((cb) => store.subscribe(cb), () => store.getSnapshot());
3774
+ const pending = store.session.pendingQuestion;
3775
+ const [index, setIndex] = useState(0);
3776
+ const [answers, setAnswers] = useState({});
3777
+ const [lastPendingId, setLastPendingId] = useState(null);
3778
+ if (!pending) return null;
3779
+ if (pending.id !== lastPendingId) {
3780
+ setLastPendingId(pending.id);
3781
+ setIndex(0);
3782
+ setAnswers({});
3783
+ return null;
3784
+ }
3785
+ const question = pending.questions[index];
3786
+ if (!question) return null;
3787
+ const total = pending.questions.length;
3788
+ const progress = total > 1 ? `Question ${index + 1} of ${total}` : null;
3789
+ const submit = (value) => {
3790
+ const next = {
3791
+ ...answers,
3792
+ [question.id]: value
3793
+ };
3794
+ if (index + 1 < total) {
3795
+ setAnswers(next);
3796
+ setIndex(index + 1);
3797
+ return;
3798
+ }
3799
+ store.resolvePendingQuestion(next);
3800
+ };
3801
+ return /* @__PURE__ */ jsxs(ModalOverlay, {
3802
+ borderColor: Colors.accent,
3803
+ title: `${Icons.diamond} ${pending.source}`,
3804
+ titleColor: Colors.accent,
3805
+ width: 72,
3806
+ children: [
3807
+ progress && /* @__PURE__ */ jsx(Box, {
3808
+ marginBottom: 1,
4006
3809
  children: /* @__PURE__ */ jsx(Text, {
4007
3810
  dimColor: true,
4008
- children: "Try logging out of Claude Code temporarily and re-running the Wizard by running:"
3811
+ children: progress
4009
3812
  })
4010
3813
  }),
4011
3814
  /* @__PURE__ */ jsx(Box, {
4012
3815
  flexDirection: "column",
4013
- marginTop: 1,
4014
- paddingLeft: 2,
4015
- children: /* @__PURE__ */ jsx(Text, {
4016
- color: "cyan",
4017
- children: "claude auth logout"
4018
- })
3816
+ children: /* @__PURE__ */ jsx(Text, { children: question.prompt })
4019
3817
  }),
4020
3818
  /* @__PURE__ */ jsx(Box, {
4021
3819
  marginTop: 1,
4022
- children: /* @__PURE__ */ jsx(Text, {
4023
- color: Colors.muted,
4024
- children: "Press any key to exit"
4025
- })
3820
+ children: /* @__PURE__ */ jsx(QuestionInput, {
3821
+ question,
3822
+ onSubmit: submit
3823
+ }, `${pending.id}:${question.id}`)
4026
3824
  })
4027
3825
  ]
4028
3826
  });
4029
3827
  };
3828
+ const QuestionInput = ({ question, onSubmit }) => {
3829
+ switch (question.kind) {
3830
+ case "single": return /* @__PURE__ */ jsx(PickerMenu, {
3831
+ options: (question.options ?? []).map((o) => ({
3832
+ label: o.label,
3833
+ value: o.value
3834
+ })),
3835
+ onSelect: (value) => {
3836
+ onSubmit(Array.isArray(value) ? value[0] : value);
3837
+ }
3838
+ });
3839
+ case "multi": return /* @__PURE__ */ jsx(PickerMenu, {
3840
+ mode: "multi",
3841
+ options: (question.options ?? []).map((o) => ({
3842
+ label: o.label,
3843
+ value: o.value
3844
+ })),
3845
+ onSelect: (value) => {
3846
+ onSubmit(Array.isArray(value) ? value : [value]);
3847
+ }
3848
+ });
3849
+ case "text": return /* @__PURE__ */ jsxs(Box, {
3850
+ flexDirection: "column",
3851
+ width: "100%",
3852
+ children: [/* @__PURE__ */ jsx(TextInput, {
3853
+ placeholder: "Type your answer",
3854
+ onSubmit: (value) => onSubmit(value)
3855
+ }), /* @__PURE__ */ jsx(Box, {
3856
+ marginTop: 1,
3857
+ width: "100%",
3858
+ justifyContent: "flex-end",
3859
+ children: /* @__PURE__ */ jsxs(Text, { children: [/* @__PURE__ */ jsx(Text, {
3860
+ color: Colors.accent,
3861
+ children: "ENTER"
3862
+ }), /* @__PURE__ */ jsx(Text, {
3863
+ dimColor: true,
3864
+ children: " submit"
3865
+ })] })
3866
+ })]
3867
+ });
3868
+ }
3869
+ };
4030
3870
  //#endregion
4031
3871
  //#region src/ui/tui/services/mcp-installer.ts
4032
3872
  /**
@@ -4095,9 +3935,11 @@ function createScreens(store, services) {
4095
3935
  ["settings-override"]: /* @__PURE__ */ jsx(SettingsOverrideScreen, { store }),
4096
3936
  ["managed-settings"]: /* @__PURE__ */ jsx(ManagedSettingsScreen, { store }),
4097
3937
  ["port-conflict"]: /* @__PURE__ */ jsx(PortConflictScreen, { store }),
4098
- ["auth-error"]: /* @__PURE__ */ jsx(AuthErrorScreen, {}),
3938
+ ["auth-error"]: /* @__PURE__ */ jsx(AuthErrorScreen, { store }),
3939
+ ["wizard-ask"]: /* @__PURE__ */ jsx(WizardAskScreen, { store }),
4099
3940
  ["intro"]: /* @__PURE__ */ jsx(PostHogIntegrationIntroScreen, { store }),
4100
3941
  ["revenue-intro"]: /* @__PURE__ */ jsx(RevenueIntroScreen, { store }),
3942
+ ["migration-intro"]: /* @__PURE__ */ jsx(MigrationIntroScreen, { store }),
4101
3943
  ["agent-skill-intro"]: /* @__PURE__ */ jsx(AgentSkillIntroScreen, { store }),
4102
3944
  ["audit-intro"]: /* @__PURE__ */ jsx(AuditIntroScreen, { store }),
4103
3945
  ["audit-run"]: /* @__PURE__ */ jsx(AuditRunScreen, { store }),
@@ -4161,16 +4003,16 @@ function releaseTerminal() {
4161
4003
  }
4162
4004
  function getExitLine(store) {
4163
4005
  const outro = store.session.outroData;
4164
- const label = store.session.workflowLabel ?? "Wizard";
4006
+ const label = store.session.programLabel ?? "Wizard";
4165
4007
  if (outro?.kind === "success") {
4166
4008
  const message = outro.message ?? `${label} completed successfully.`;
4167
4009
  return `${GREEN}${BOLD}\u2714${RESET_ATTRS} ${message}${outro.reportFile && !message.includes(outro.reportFile) ? ` Check ./${outro.reportFile} for details.` : ""}`;
4168
4010
  }
4169
4011
  return `${DIM}${label} exited.${RESET_ATTRS}`;
4170
4012
  }
4171
- function startTUI(version, flow = "posthog-integration") {
4013
+ function startTUI(version, program = Program.PostHogIntegration) {
4172
4014
  process.stdout.write(ENTER_ALT_SCREEN + BG_BLACK + CLEAR_SCREEN + CURSOR_HOME);
4173
- const store = new WizardStore(flow);
4015
+ const store = new WizardStore(program);
4174
4016
  store.version = version;
4175
4017
  setUI(new InkUI(store));
4176
4018
  const { unmount: inkUnmount } = render(createElement(App, { store }));
@@ -4192,4 +4034,4 @@ function startTUI(version, flow = "posthog-integration") {
4192
4034
  //#endregion
4193
4035
  export { startTUI };
4194
4036
 
4195
- //# sourceMappingURL=start-tui-Cj_4BhK8.js.map
4037
+ //# sourceMappingURL=start-tui-BBhG-LSW.js.map