@posthog/wizard 2.26.0 → 2.27.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 (59) hide show
  1. package/README.md +14 -1
  2. package/dist/{add-mcp-server-to-clients-C58l_KpV.js → add-mcp-server-to-clients-D2XNlVgw.js} +4 -4
  3. package/dist/{add-mcp-server-to-clients-C58l_KpV.js.map → add-mcp-server-to-clients-D2XNlVgw.js.map} +1 -1
  4. package/dist/{agent-interface-Dq_4h2eN.js → agent-interface-DpkR1mbC.js} +5 -5
  5. package/dist/{agent-interface-Dq_4h2eN.js.map → agent-interface-DpkR1mbC.js.map} +1 -1
  6. package/dist/{agent-runner-BNGW3osc.js → agent-runner-D7hIITUf.js} +9 -9
  7. package/dist/{agent-runner-BNGW3osc.js.map → agent-runner-D7hIITUf.js.map} +1 -1
  8. package/dist/{analytics-BX3LKPch.js → analytics-B7-uRKIJ.js} +2 -2
  9. package/dist/{analytics-BX3LKPch.js.map → analytics-B7-uRKIJ.js.map} +1 -1
  10. package/dist/{api-DCHci5SD.js → api-2zPZQONC.js} +3 -3
  11. package/dist/{api-DCHci5SD.js.map → api-2zPZQONC.js.map} +1 -1
  12. package/dist/bin.js +610 -34
  13. package/dist/bin.js.map +1 -1
  14. package/dist/{ci-install-CHIbwXio.js → ci-install-CpGSFNDi.js} +4 -4
  15. package/dist/{ci-install-CHIbwXio.js.map → ci-install-CpGSFNDi.js.map} +1 -1
  16. package/dist/{debug-BizeRFR0.js → debug-Br_xCc9s.js} +2 -2
  17. package/dist/{debug-BizeRFR0.js.map → debug-Br_xCc9s.js.map} +1 -1
  18. package/dist/{debug-fg4BAKKA.js → debug-CDLYQOQh.js} +1 -1
  19. package/dist/{environment-DS5Pq9Wm.js → environment-CFXsie0G.js} +3 -3
  20. package/dist/{environment-DS5Pq9Wm.js.map → environment-CFXsie0G.js.map} +1 -1
  21. package/dist/file-utils-CHAj73KM.js +116 -0
  22. package/dist/file-utils-CHAj73KM.js.map +1 -0
  23. package/dist/{interactive-DE3WDjk7.js → interactive-lfAs6vF7.js} +2 -2
  24. package/dist/{interactive-DE3WDjk7.js.map → interactive-lfAs6vF7.js.map} +1 -1
  25. package/dist/{mcp-prompt-streaming-zsYd1zJx.js → mcp-prompt-streaming-BHdAwwob.js} +4 -4
  26. package/dist/{mcp-prompt-streaming-zsYd1zJx.js.map → mcp-prompt-streaming-BHdAwwob.js.map} +1 -1
  27. package/dist/{non-interactive-DNah9u3t.js → non-interactive--4CK1bkn.js} +2 -2
  28. package/dist/{non-interactive-DNah9u3t.js.map → non-interactive--4CK1bkn.js.map} +1 -1
  29. package/dist/{package-manager-Dma9-zGs.js → package-manager-BlogZvIK.js} +2 -2
  30. package/dist/{package-manager-Dma9-zGs.js.map → package-manager-BlogZvIK.js.map} +1 -1
  31. package/dist/{playground-Cwe0Q9HW.js → playground-De_BxaCh.js} +5 -5
  32. package/dist/{playground-Cwe0Q9HW.js.map → playground-De_BxaCh.js.map} +1 -1
  33. package/dist/{posthog-integration-CAYZdk0r.js → posthog-integration-DWs8JM8J.js} +12 -12
  34. package/dist/{posthog-integration-CAYZdk0r.js.map → posthog-integration-DWs8JM8J.js.map} +1 -1
  35. package/dist/{provisioning-BmL4ro-o.js → provisioning-CUwxxByi.js} +3 -3
  36. package/dist/{provisioning-BmL4ro-o.js.map → provisioning-CUwxxByi.js.map} +1 -1
  37. package/dist/{registry-C3wcDM3X.js → registry-CIjJsxDE.js} +4 -4
  38. package/dist/{registry-C3wcDM3X.js.map → registry-CIjJsxDE.js.map} +1 -1
  39. package/dist/{setup-utils-CNWIMZ-d.js → setup-utils-CjKjaKcG.js} +18 -8
  40. package/dist/setup-utils-CjKjaKcG.js.map +1 -0
  41. package/dist/{start-tui-CS802Ww9.js → start-tui-Cbw0kVr3.js} +176 -16
  42. package/dist/start-tui-Cbw0kVr3.js.map +1 -0
  43. package/dist/{steps-BX44xr30.js → steps-DUz5lHWu.js} +7 -6
  44. package/dist/{steps-BX44xr30.js.map → steps-DUz5lHWu.js.map} +1 -1
  45. package/dist/{telemetry-BH-MgWPT.js → telemetry-D3CnLknq.js} +3 -3
  46. package/dist/{telemetry-BH-MgWPT.js.map → telemetry-D3CnLknq.js.map} +1 -1
  47. package/dist/{terminal-BSiupnOQ.js → terminal-DwAdsRPX.js} +9 -9
  48. package/dist/terminal-DwAdsRPX.js.map +1 -0
  49. package/dist/{urls-BuEABcmF.js → urls-JN8mo6lU.js} +2 -2
  50. package/dist/{urls-BuEABcmF.js.map → urls-JN8mo6lU.js.map} +1 -1
  51. package/dist/{wizard-abort-CR3w2Efg.js → wizard-abort-BPr0xo7i.js} +1 -1
  52. package/dist/{wizard-abort-Dl2MJOP9.js → wizard-abort-gHZ7kHYo.js} +3 -3
  53. package/dist/{wizard-abort-Dl2MJOP9.js.map → wizard-abort-gHZ7kHYo.js.map} +1 -1
  54. package/package.json +1 -1
  55. package/dist/file-utils-VAXoyXVA.js +0 -38
  56. package/dist/file-utils-VAXoyXVA.js.map +0 -1
  57. package/dist/setup-utils-CNWIMZ-d.js.map +0 -1
  58. package/dist/start-tui-CS802Ww9.js.map +0 -1
  59. package/dist/terminal-BSiupnOQ.js.map +0 -1
package/dist/bin.js CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { $ as getSkillsBaseUrl, P as POSTHOG_DOCS_URL, X as WIZARD_USER_AGENT, _ as SIGNUP_WIZARD_READINESS_CONFIG, a as getLogFilePath, et as VERSION, h as LoggingUI, m as setUI, p as getUI, r as debug, s as logToFile, v as evaluateWizardReadiness, y as getBlockingServiceKeys } from "./debug-BizeRFR0.js";
3
- import { t as analytics } from "./analytics-BX3LKPch.js";
4
- import { r as setEntryCommand } from "./telemetry-BH-MgWPT.js";
5
- import { n as isUsingTypeScript } from "./setup-utils-CNWIMZ-d.js";
6
- import { a as getUiHostFromHost, n as getCloudUrlFromRegion } from "./urls-BuEABcmF.js";
7
- import { o as handleApiError } from "./api-DCHci5SD.js";
2
+ import { $ as getSkillsBaseUrl, P as POSTHOG_DOCS_URL, X as WIZARD_USER_AGENT, _ as SIGNUP_WIZARD_READINESS_CONFIG, a as getLogFilePath, et as VERSION, h as LoggingUI, m as setUI, p as getUI, r as debug, s as logToFile, v as evaluateWizardReadiness, y as getBlockingServiceKeys } from "./debug-Br_xCc9s.js";
3
+ import { t as analytics } from "./analytics-B7-uRKIJ.js";
4
+ import { r as setEntryCommand } from "./telemetry-D3CnLknq.js";
5
+ import { n as isUsingTypeScript } from "./setup-utils-CjKjaKcG.js";
6
+ import { a as getUiHostFromHost, n as getCloudUrlFromRegion } from "./urls-JN8mo6lU.js";
7
+ import { o as handleApiError } from "./api-2zPZQONC.js";
8
8
  import "./wizard-session-G3VWD6hv.js";
9
- import { r as runCleanups } from "./wizard-abort-Dl2MJOP9.js";
10
- import { n as isNonInteractiveEnvironment } from "./environment-DS5Pq9Wm.js";
11
- import { S as AUDIT_REPORT_FILE, b as AUDIT_CHECKS_FILE, c as recoverOrphanedSettingsBackups, h as fetchSkillMenu, p as WIZARD_TOOL_NAMES, u as AgentSignals, x as AUDIT_CHECKS_KEY } from "./agent-interface-Dq_4h2eN.js";
12
- import { i as SPINNER_MESSAGE } from "./registry-C3wcDM3X.js";
13
- import { a as PRODUCT_SUITE_BLOCK, f as Colors, i as LINE_CHART_BLOCK, l as isClearBlock, m as HEALTH_CHECK_STEP, n as posthogIntegrationConfig, o as StatusPeekTrigger, p as Icons, r as FUNNEL_BLOCK } from "./posthog-integration-CAYZdk0r.js";
14
- import { t as IGNORED_DIRS } from "./file-utils-VAXoyXVA.js";
9
+ import { r as runCleanups } from "./wizard-abort-gHZ7kHYo.js";
10
+ import { n as isNonInteractiveEnvironment } from "./environment-CFXsie0G.js";
11
+ import { S as AUDIT_REPORT_FILE, b as AUDIT_CHECKS_FILE, c as recoverOrphanedSettingsBackups, h as fetchSkillMenu, p as WIZARD_TOOL_NAMES, u as AgentSignals, x as AUDIT_CHECKS_KEY } from "./agent-interface-DpkR1mbC.js";
12
+ import { i as SPINNER_MESSAGE } from "./registry-CIjJsxDE.js";
13
+ import { _ as parseRequirementsTxt, a as PRODUCT_SUITE_BLOCK, f as Colors, g as parsePyprojectToml, h as parsePipfile, i as LINE_CHART_BLOCK, l as isClearBlock, m as HEALTH_CHECK_STEP, n as posthogIntegrationConfig, o as StatusPeekTrigger, p as Icons, r as FUNNEL_BLOCK } from "./posthog-integration-DWs8JM8J.js";
14
+ import { n as safeReadFile, r as walkProjectFiles, t as IGNORED_DIRS } from "./file-utils-CHAj73KM.js";
15
15
  import { n as readApiKeyFromEnv } from "./env-api-key-MlzJYAvt.js";
16
16
  import { satisfies } from "semver";
17
17
  import yargs from "yargs";
@@ -190,7 +190,7 @@ function runProvision(argv) {
190
190
  }
191
191
  async function provision({ email, region, name, jsonMode }) {
192
192
  try {
193
- const { provisionNewAccount } = await import("./provisioning-BmL4ro-o.js").then((n) => n.n);
193
+ const { provisionNewAccount } = await import("./provisioning-CUwxxByi.js").then((n) => n.n);
194
194
  if (!jsonMode) getUI().log.info(`Provisioning account for ${email} in ${region}...`);
195
195
  emitResult(await provisionNewAccount(email, name, region), jsonMode);
196
196
  process.exit(0);
@@ -255,18 +255,18 @@ const basicIntegrationCommand = {
255
255
  setEntryCommand("integrate");
256
256
  (async () => {
257
257
  if (argv.ci) {
258
- const { runCIInstall } = await import("./ci-install-CHIbwXio.js");
258
+ const { runCIInstall } = await import("./ci-install-CpGSFNDi.js");
259
259
  return runCIInstall(argv);
260
260
  }
261
261
  if (isNonInteractiveEnvironment()) {
262
- const { failNonInteractive } = await import("./non-interactive-DNah9u3t.js");
262
+ const { failNonInteractive } = await import("./non-interactive--4CK1bkn.js");
263
263
  return failNonInteractive();
264
264
  }
265
265
  if (argv.playground) {
266
- const { runPlayground } = await import("./playground-Cwe0Q9HW.js");
266
+ const { runPlayground } = await import("./playground-De_BxaCh.js");
267
267
  return runPlayground();
268
268
  }
269
- const { runInteractive } = await import("./interactive-DE3WDjk7.js");
269
+ const { runInteractive } = await import("./interactive-lfAs6vF7.js");
270
270
  runInteractive(argv);
271
271
  })();
272
272
  }
@@ -509,6 +509,571 @@ const revenueAnalyticsConfig = {
509
509
  requires: ["posthog-integration"]
510
510
  };
511
511
  //#endregion
512
+ //#region src/lib/warehouse-sources/registry.ts
513
+ const SOURCE_DETECTORS = [
514
+ {
515
+ kind: "Postgres",
516
+ label: "PostgreSQL",
517
+ mode: "in-cli",
518
+ signals: {
519
+ npm: [
520
+ "pg",
521
+ "postgres",
522
+ "postgres.js",
523
+ "knex",
524
+ "sequelize"
525
+ ],
526
+ python: [
527
+ "psycopg",
528
+ "psycopg2",
529
+ "psycopg2-binary",
530
+ "asyncpg"
531
+ ],
532
+ ruby: ["pg"],
533
+ envKeys: [
534
+ /^DATABASE_URL$/,
535
+ /^POSTGRES_/,
536
+ /^PG(HOST|DATABASE|USER|PORT)$/
537
+ ]
538
+ }
539
+ },
540
+ {
541
+ kind: "MySQL",
542
+ label: "MySQL",
543
+ mode: "in-cli",
544
+ signals: {
545
+ npm: ["mysql", "mysql2"],
546
+ python: [
547
+ "pymysql",
548
+ "mysqlclient",
549
+ "mysql-connector-python"
550
+ ],
551
+ ruby: ["mysql2"],
552
+ envKeys: [/^MYSQL_/]
553
+ }
554
+ },
555
+ {
556
+ kind: "MongoDB",
557
+ label: "MongoDB",
558
+ mode: "in-cli",
559
+ signals: {
560
+ npm: ["mongodb", "mongoose"],
561
+ python: ["pymongo", "motor"],
562
+ ruby: ["mongo", "mongoid"],
563
+ envKeys: [/^MONGO(DB)?_/]
564
+ }
565
+ },
566
+ {
567
+ kind: "Snowflake",
568
+ label: "Snowflake",
569
+ mode: "in-cli",
570
+ signals: {
571
+ npm: ["snowflake-sdk"],
572
+ python: ["snowflake-connector-python", "snowflake-sqlalchemy"],
573
+ envKeys: [/^SNOWFLAKE_/]
574
+ }
575
+ },
576
+ {
577
+ kind: "BigQuery",
578
+ label: "BigQuery",
579
+ mode: "in-cli",
580
+ signals: {
581
+ npm: ["@google-cloud/bigquery"],
582
+ python: ["google-cloud-bigquery"],
583
+ envKeys: [/^BIGQUERY_/]
584
+ }
585
+ },
586
+ {
587
+ kind: "Redshift",
588
+ label: "Redshift",
589
+ mode: "in-cli",
590
+ signals: {
591
+ npm: ["node-redshift"],
592
+ python: ["redshift-connector"],
593
+ envKeys: [/^REDSHIFT_/]
594
+ }
595
+ },
596
+ {
597
+ kind: "MSSQL",
598
+ label: "SQL Server",
599
+ mode: "in-cli",
600
+ signals: {
601
+ npm: ["mssql", "tedious"],
602
+ python: ["pyodbc", "pymssql"],
603
+ envKeys: [/^MSSQL_/]
604
+ }
605
+ },
606
+ {
607
+ kind: "Supabase",
608
+ label: "Supabase",
609
+ mode: "in-cli",
610
+ signals: {
611
+ npm: ["@supabase/supabase-js"],
612
+ python: ["supabase"],
613
+ envKeys: [/^SUPABASE_/]
614
+ }
615
+ },
616
+ {
617
+ kind: "ClickHouse",
618
+ label: "ClickHouse",
619
+ mode: "in-cli",
620
+ signals: {
621
+ npm: ["@clickhouse/client"],
622
+ python: ["clickhouse-connect", "clickhouse-driver"],
623
+ envKeys: [/^CLICKHOUSE_/]
624
+ }
625
+ },
626
+ {
627
+ kind: "Convex",
628
+ label: "Convex",
629
+ mode: "in-cli",
630
+ signals: {
631
+ npm: ["convex"],
632
+ python: ["convex"],
633
+ envKeys: [/^CONVEX_/, /^NEXT_PUBLIC_CONVEX_URL$/]
634
+ }
635
+ },
636
+ {
637
+ kind: "Stripe",
638
+ label: "Stripe",
639
+ mode: "in-cli",
640
+ signals: {
641
+ npm: [
642
+ "stripe",
643
+ "@stripe/stripe-js",
644
+ "@stripe/react-stripe-js"
645
+ ],
646
+ python: ["stripe"],
647
+ ruby: ["stripe"],
648
+ envKeys: [/^STRIPE_(SECRET|API)_KEY$/]
649
+ }
650
+ },
651
+ {
652
+ kind: "Clerk",
653
+ label: "Clerk",
654
+ mode: "in-cli",
655
+ signals: {
656
+ npm: [
657
+ "@clerk/nextjs",
658
+ "@clerk/clerk-react",
659
+ "@clerk/backend",
660
+ "@clerk/express",
661
+ "@clerk/fastify",
662
+ "@clerk/remix"
663
+ ],
664
+ envKeys: [/^CLERK_SECRET_KEY$/, /^NEXT_PUBLIC_CLERK_/]
665
+ }
666
+ },
667
+ {
668
+ kind: "Resend",
669
+ label: "Resend",
670
+ mode: "in-cli",
671
+ signals: {
672
+ npm: ["resend"],
673
+ python: ["resend"],
674
+ envKeys: [/^RESEND_API_KEY$/]
675
+ }
676
+ },
677
+ {
678
+ kind: "Shopify",
679
+ label: "Shopify",
680
+ mode: "in-cli",
681
+ signals: {
682
+ npm: ["@shopify/shopify-api", "shopify-api-node"],
683
+ python: ["shopifyapi"],
684
+ envKeys: [/^SHOPIFY_/]
685
+ }
686
+ },
687
+ {
688
+ kind: "Klaviyo",
689
+ label: "Klaviyo",
690
+ mode: "in-cli",
691
+ signals: {
692
+ npm: ["klaviyo-api"],
693
+ python: ["klaviyo-api"],
694
+ envKeys: [/^KLAVIYO_/]
695
+ }
696
+ },
697
+ {
698
+ kind: "Chargebee",
699
+ label: "Chargebee",
700
+ mode: "in-cli",
701
+ signals: {
702
+ npm: ["chargebee"],
703
+ python: ["chargebee"],
704
+ envKeys: [/^CHARGEBEE_/]
705
+ }
706
+ },
707
+ {
708
+ kind: "Paddle",
709
+ label: "Paddle",
710
+ mode: "in-cli",
711
+ signals: {
712
+ npm: ["@paddle/paddle-node-sdk", "@paddle/paddle-js"],
713
+ envKeys: [/^PADDLE_/]
714
+ }
715
+ },
716
+ {
717
+ kind: "Polar",
718
+ label: "Polar",
719
+ mode: "in-cli",
720
+ signals: {
721
+ npm: ["@polar-sh/sdk", "@polar-sh/nextjs"],
722
+ envKeys: [/^POLAR_/]
723
+ }
724
+ },
725
+ {
726
+ kind: "Mailchimp",
727
+ label: "Mailchimp",
728
+ mode: "in-cli",
729
+ signals: {
730
+ npm: ["@mailchimp/mailchimp_marketing"],
731
+ python: ["mailchimp-marketing"],
732
+ envKeys: [/^MAILCHIMP_/]
733
+ }
734
+ },
735
+ {
736
+ kind: "CustomerIO",
737
+ label: "Customer.io",
738
+ mode: "in-cli",
739
+ signals: {
740
+ npm: ["customerio-node"],
741
+ python: ["customerio"],
742
+ envKeys: [/^CUSTOMER_?IO_/]
743
+ }
744
+ },
745
+ {
746
+ kind: "Typeform",
747
+ label: "Typeform",
748
+ mode: "in-cli",
749
+ signals: {
750
+ npm: ["@typeform/api-client"],
751
+ envKeys: [/^TYPEFORM_/]
752
+ }
753
+ },
754
+ {
755
+ kind: "Sentry",
756
+ label: "Sentry",
757
+ mode: "in-cli",
758
+ signals: {
759
+ npm: [
760
+ "@sentry/node",
761
+ "@sentry/browser",
762
+ "@sentry/react",
763
+ "@sentry/nextjs"
764
+ ],
765
+ python: ["sentry-sdk"],
766
+ ruby: ["sentry-ruby"]
767
+ }
768
+ },
769
+ {
770
+ kind: "Salesforce",
771
+ label: "Salesforce",
772
+ mode: "deep-link",
773
+ signals: {
774
+ npm: ["jsforce"],
775
+ python: ["simple-salesforce"],
776
+ envKeys: [/^SALESFORCE_/]
777
+ }
778
+ },
779
+ {
780
+ kind: "Hubspot",
781
+ label: "HubSpot",
782
+ mode: "deep-link",
783
+ signals: {
784
+ npm: ["@hubspot/api-client"],
785
+ python: ["hubspot-api-client"],
786
+ envKeys: [/^HUBSPOT_/]
787
+ }
788
+ },
789
+ {
790
+ kind: "Zendesk",
791
+ label: "Zendesk",
792
+ mode: "deep-link",
793
+ signals: {
794
+ npm: ["node-zendesk"],
795
+ python: ["zenpy"],
796
+ envKeys: [/^ZENDESK_/]
797
+ }
798
+ },
799
+ {
800
+ kind: "Intercom",
801
+ label: "Intercom",
802
+ mode: "deep-link",
803
+ signals: {
804
+ npm: ["intercom-client", "@intercom/messenger-js-sdk"],
805
+ python: ["python-intercom"],
806
+ envKeys: [/^INTERCOM_/]
807
+ }
808
+ },
809
+ {
810
+ kind: "Linear",
811
+ label: "Linear",
812
+ mode: "deep-link",
813
+ signals: {
814
+ npm: ["@linear/sdk"],
815
+ envKeys: [/^LINEAR_API_KEY$/]
816
+ }
817
+ }
818
+ ];
819
+ //#endregion
820
+ //#region src/lib/warehouse-sources/detect.ts
821
+ /**
822
+ * Data warehouse source detection.
823
+ *
824
+ * Scans a project for codebase signals (npm/python/ruby deps, `.env` key
825
+ * names) and matches them against the `SOURCE_DETECTORS` registry. Pure
826
+ * function: no store mutations, no UI calls. Reads files locally — only the
827
+ * wizard process does this; the agent never sees secret values.
828
+ *
829
+ * Note we only read `.env` KEY NAMES, never values.
830
+ */
831
+ const MAX_DEPTH = 3;
832
+ /**
833
+ * Detect which warehouse sources the project at `installDir` appears to use.
834
+ * Returns one `DetectedSource` per matched registry entry (kinds are unique,
835
+ * so the result is naturally deduped).
836
+ */
837
+ function detectWarehouseSources(installDir) {
838
+ const signals = collectSignals$1(installDir);
839
+ const detected = [];
840
+ for (const detector of SOURCE_DETECTORS) {
841
+ const match = matchDetector(detector, signals);
842
+ if (match) detected.push({
843
+ kind: detector.kind,
844
+ label: detector.label,
845
+ mode: detector.mode,
846
+ matchedSignal: match
847
+ });
848
+ }
849
+ return detected;
850
+ }
851
+ /** Returns a human-readable description of the first matching signal, or null. */
852
+ function matchDetector(detector, signals) {
853
+ const { npm, python, ruby, envKeys } = detector.signals;
854
+ const npmHit = npm?.find((dep) => signals.npm.has(dep));
855
+ if (npmHit) return `found \`${npmHit}\` in package.json`;
856
+ const pyHit = python?.find((dep) => signals.python.has(dep));
857
+ if (pyHit) return `found \`${pyHit}\` in Python dependencies`;
858
+ const rubyHit = ruby?.find((gem) => signals.ruby.has(gem));
859
+ if (rubyHit) return `found \`${rubyHit}\` in Gemfile`;
860
+ if (envKeys) {
861
+ for (const key of signals.envKeys) if (envKeys.some((re) => re.test(key))) return `found \`${key}\` in .env`;
862
+ }
863
+ return null;
864
+ }
865
+ function collectSignals$1(installDir) {
866
+ const signals = {
867
+ npm: /* @__PURE__ */ new Set(),
868
+ python: /* @__PURE__ */ new Set(),
869
+ ruby: /* @__PURE__ */ new Set(),
870
+ envKeys: /* @__PURE__ */ new Set()
871
+ };
872
+ walkProjectFiles(installDir, (name, fullPath) => ingestFile(name, fullPath, signals), MAX_DEPTH);
873
+ return signals;
874
+ }
875
+ /**
876
+ * Route a file to the right parser BY NAME, reading its contents only when the
877
+ * name matches one of the ~6 manifests we care about. Checking the name first
878
+ * avoids slurping every file in the tree (lockfiles, binaries, assets) into
879
+ * memory just to discard it.
880
+ */
881
+ function ingestFile(name, fullPath, signals) {
882
+ const ingest = ingestorFor(name);
883
+ if (!ingest) return;
884
+ const content = safeReadFile(fullPath);
885
+ if (content === null) return;
886
+ ingest(content, signals);
887
+ }
888
+ /** Pick the parser for a manifest filename, or null if it's not one we read. */
889
+ function ingestorFor(name) {
890
+ if (name === "package.json") return addNpmDeps;
891
+ if (name === "requirements.txt") return (c, s) => parseRequirementsTxt(c).forEach((d) => s.python.add(d));
892
+ if (name === "pyproject.toml") return (c, s) => parsePyprojectToml(c).forEach((d) => s.python.add(d));
893
+ if (name === "Pipfile") return (c, s) => parsePipfile(c).forEach((d) => s.python.add(d));
894
+ if (name === "Gemfile") return (c, s) => parseGemfile(c).forEach((g) => s.ruby.add(g));
895
+ if (name.startsWith(".env")) return (c, s) => parseEnvKeys(c).forEach((k) => s.envKeys.add(k));
896
+ return null;
897
+ }
898
+ function addNpmDeps(content, signals) {
899
+ try {
900
+ const pkg = JSON.parse(content);
901
+ for (const dep of Object.keys({
902
+ ...pkg.dependencies,
903
+ ...pkg.devDependencies
904
+ })) signals.npm.add(dep);
905
+ } catch (error) {
906
+ analytics.captureException(error instanceof Error ? error : new Error(String(error)), { step: "detectWarehouseSources.parsePackageJson" });
907
+ }
908
+ }
909
+ /** Extract gem names from `gem 'name'` declarations. */
910
+ function parseGemfile(content) {
911
+ const gems = [];
912
+ for (const match of content.matchAll(/^\s*gem\s+['"]([^'"]+)['"]/gm)) gems.push(match[1]);
913
+ return gems;
914
+ }
915
+ /** Extract KEY NAMES from a dotenv file. Values are intentionally discarded. */
916
+ function parseEnvKeys(content) {
917
+ const keys = [];
918
+ for (const line of content.split("\n")) {
919
+ const trimmed = line.trim();
920
+ if (!trimmed || trimmed.startsWith("#")) continue;
921
+ const match = trimmed.match(/^(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/);
922
+ if (match) keys.push(match[1]);
923
+ }
924
+ return keys;
925
+ }
926
+ //#endregion
927
+ //#region src/lib/programs/warehouse-source/detect.ts
928
+ /**
929
+ * Warehouse-source program detection step.
930
+ *
931
+ * Thin adapter over `detectWarehouseSources` that writes results into
932
+ * frameworkContext for the intro screen, plus the `[ABORT]` cases the
933
+ * data-warehouse-source-setup skill can emit.
934
+ */
935
+ /** frameworkContext key holding the detected sources (set on success). */
936
+ const DETECTED_WAREHOUSE_SOURCES_KEY = "detectedWarehouseSources";
937
+ /**
938
+ * Read the detected sources out of frameworkContext. Single accessor shared by
939
+ * the intro screen and the prompt builder so the key + cast live in one place.
940
+ */
941
+ function getDetectedWarehouseSources(session) {
942
+ return session.frameworkContext["detectedWarehouseSources"] ?? [];
943
+ }
944
+ /** `[ABORT] <reason>` cases the skill can emit. */
945
+ const WAREHOUSE_ABORT_CASES = [{
946
+ match: /^no data sources? detected\.?$/i,
947
+ message: "No data source detected",
948
+ body: "The agent could not confirm a data warehouse source to connect. Run this command from a project that uses a supported source (a database, Stripe, etc.).",
949
+ docsUrl: "https://posthog.com/docs/data-warehouse"
950
+ }, {
951
+ match: /^source creation failed\.?$/i,
952
+ message: "Source creation failed",
953
+ body: "PostHog could not create the data warehouse source with the credentials provided. Double-check the connection details and try again, or set the source up directly in the PostHog app.",
954
+ docsUrl: "https://posthog.com/docs/data-warehouse"
955
+ }];
956
+ /**
957
+ * Scan `session.installDir` for warehouse-source signals. Writes the detected
958
+ * sources (or a `detectError`) into frameworkContext for the intro screen.
959
+ */
960
+ function detectWarehousePrerequisites(session, setFrameworkContext) {
961
+ const fail = (error) => setFrameworkContext("detectError", error);
962
+ const installDir = session.installDir;
963
+ if (!existsSync(installDir)) {
964
+ fail({
965
+ kind: "bad-directory",
966
+ path: installDir,
967
+ reason: "missing"
968
+ });
969
+ return;
970
+ }
971
+ try {
972
+ if (!statSync(installDir).isDirectory()) {
973
+ fail({
974
+ kind: "bad-directory",
975
+ path: installDir,
976
+ reason: "not-dir"
977
+ });
978
+ return;
979
+ }
980
+ } catch (error) {
981
+ analytics.captureException(error instanceof Error ? error : new Error(String(error)), {
982
+ step: "detectWarehousePrerequisites.stat",
983
+ path: installDir
984
+ });
985
+ fail({
986
+ kind: "bad-directory",
987
+ path: installDir,
988
+ reason: "unreadable"
989
+ });
990
+ return;
991
+ }
992
+ const sources = detectWarehouseSources(installDir);
993
+ if (sources.length === 0) {
994
+ fail({ kind: "no-sources" });
995
+ return;
996
+ }
997
+ setFrameworkContext(DETECTED_WAREHOUSE_SOURCES_KEY, sources);
998
+ }
999
+ //#endregion
1000
+ //#region src/lib/programs/warehouse-source/steps.ts
1001
+ const WAREHOUSE_SOURCE_PROGRAM = [
1002
+ {
1003
+ id: "detect",
1004
+ label: "Detecting data sources",
1005
+ onReady: (ctx) => detectWarehousePrerequisites(ctx.session, ctx.setFrameworkContext)
1006
+ },
1007
+ {
1008
+ id: "intro",
1009
+ label: "Welcome",
1010
+ screenId: "warehouse-intro",
1011
+ gate: (session) => session.setupConfirmed
1012
+ },
1013
+ {
1014
+ id: "auth",
1015
+ label: "Authentication",
1016
+ screenId: "auth",
1017
+ isComplete: (session) => session.credentials !== null
1018
+ },
1019
+ {
1020
+ id: "run",
1021
+ label: "Data warehouse",
1022
+ screenId: "run",
1023
+ isComplete: (session) => session.runPhase === "completed" || session.runPhase === "error"
1024
+ },
1025
+ {
1026
+ id: "outro",
1027
+ label: "Done",
1028
+ screenId: "outro",
1029
+ isComplete: (session) => session.outroDismissed
1030
+ },
1031
+ {
1032
+ id: "skills",
1033
+ label: "Skills",
1034
+ screenId: "keep-skills"
1035
+ }
1036
+ ];
1037
+ //#endregion
1038
+ //#region src/lib/programs/warehouse-source/index.ts
1039
+ /**
1040
+ * Inject the detected sources (and their creation mode) into the prompt so the
1041
+ * skill knows what to set up. The *how* — in-CLI creation vs deep-link, field
1042
+ * collection, validation — lives in the skill, not here.
1043
+ */
1044
+ function buildPrompt(session) {
1045
+ const sources = getDetectedWarehouseSources(session);
1046
+ if (sources.length === 0) return "Set up a data warehouse source for this project.";
1047
+ return [
1048
+ "The wizard detected the following data warehouse sources in this project:",
1049
+ ...sources.map((s) => `- ${s.label} (kind: ${s.kind}, mode: ${s.mode}) — ${s.matchedSignal}`),
1050
+ "",
1051
+ "Set these up in PostHog following the skill instructions: create `in-cli` sources directly via the PostHog MCP after collecting credentials; for `deep-link` sources, provide the user the pre-filled new-source URL."
1052
+ ].join("\n");
1053
+ }
1054
+ const warehouseSourceConfig = {
1055
+ command: "warehouse",
1056
+ description: "Detect and connect a data warehouse source (Postgres, Stripe, …)",
1057
+ id: "warehouse-source",
1058
+ skillId: "data-warehouse-source-setup",
1059
+ steps: WAREHOUSE_SOURCE_PROGRAM,
1060
+ getContentBlocks: getContentBlocks$2,
1061
+ reportFile: "posthog-warehouse-report.md",
1062
+ allowedTools: ["Agent"],
1063
+ run: (session) => Promise.resolve({
1064
+ skillId: "data-warehouse-source-setup",
1065
+ integrationLabel: "data-warehouse-source-setup",
1066
+ customPrompt: () => buildPrompt(session),
1067
+ successMessage: "Data warehouse source connected!",
1068
+ reportFile: "posthog-warehouse-report.md",
1069
+ docsUrl: "https://posthog.com/docs/data-warehouse",
1070
+ spinnerMessage: "Connecting your data source...",
1071
+ estimatedDurationMinutes: 5,
1072
+ abortCases: WAREHOUSE_ABORT_CASES
1073
+ }),
1074
+ requires: ["posthog-integration"]
1075
+ };
1076
+ //#endregion
512
1077
  //#region src/lib/programs/agent-skill/steps.ts
513
1078
  const AGENT_SKILL_STEPS = [
514
1079
  {
@@ -2933,6 +3498,7 @@ const agentSkillConfig = {
2933
3498
  const PROGRAM_REGISTRY = [
2934
3499
  posthogIntegrationConfig,
2935
3500
  revenueAnalyticsConfig,
3501
+ warehouseSourceConfig,
2936
3502
  errorTrackingUploadSourceMapsConfig,
2937
3503
  auditConfig,
2938
3504
  eventsAuditConfig,
@@ -2954,6 +3520,7 @@ const PROGRAM_REGISTRY = [
2954
3520
  const Program = {
2955
3521
  PostHogIntegration: posthogIntegrationConfig.id,
2956
3522
  RevenueAnalyticsSetup: revenueAnalyticsConfig.id,
3523
+ WarehouseSource: warehouseSourceConfig.id,
2957
3524
  ErrorTrackingUploadSourceMaps: errorTrackingUploadSourceMapsConfig.id,
2958
3525
  Migration: migrationConfig.id,
2959
3526
  Audit: auditConfig.id,
@@ -3005,7 +3572,7 @@ function runMcpAdd(argv) {
3005
3572
  const debug = argv.debug;
3006
3573
  const localMcp = argv.local;
3007
3574
  try {
3008
- const { startTUI } = await import("./start-tui-CS802Ww9.js");
3575
+ const { startTUI } = await import("./start-tui-Cbw0kVr3.js");
3009
3576
  const { buildSession } = await import("./wizard-session-wPJtNl4c.js");
3010
3577
  const tui = startTUI(VERSION, Program.McpAdd);
3011
3578
  tui.store.session = buildSession({
@@ -3017,7 +3584,7 @@ function runMcpAdd(argv) {
3017
3584
  } catch (error) {
3018
3585
  if (!isTUIUnavailable(error)) throw error;
3019
3586
  setUI(new LoggingUI());
3020
- const { addMCPServerToClientsStep } = await import("./add-mcp-server-to-clients-C58l_KpV.js").then((n) => n.r);
3587
+ const { addMCPServerToClientsStep } = await import("./add-mcp-server-to-clients-D2XNlVgw.js").then((n) => n.r);
3021
3588
  await addMCPServerToClientsStep({
3022
3589
  local: localMcp,
3023
3590
  features,
@@ -3056,7 +3623,7 @@ function runMcpRemove(argv) {
3056
3623
  const debug = argv.debug;
3057
3624
  const localMcp = argv.local;
3058
3625
  try {
3059
- const { startTUI } = await import("./start-tui-CS802Ww9.js");
3626
+ const { startTUI } = await import("./start-tui-Cbw0kVr3.js");
3060
3627
  const { buildSession } = await import("./wizard-session-wPJtNl4c.js");
3061
3628
  const tui = startTUI(VERSION, Program.McpRemove);
3062
3629
  tui.store.session = buildSession({
@@ -3065,7 +3632,7 @@ function runMcpRemove(argv) {
3065
3632
  });
3066
3633
  } catch {
3067
3634
  setUI(new LoggingUI());
3068
- const { removeMCPServerFromClientsStep } = await import("./add-mcp-server-to-clients-C58l_KpV.js").then((n) => n.r);
3635
+ const { removeMCPServerFromClientsStep } = await import("./add-mcp-server-to-clients-D2XNlVgw.js").then((n) => n.r);
3069
3636
  await removeMCPServerFromClientsStep({ local: localMcp });
3070
3637
  }
3071
3638
  })();
@@ -3087,7 +3654,7 @@ function runMcpTutorial(argv) {
3087
3654
  const debug = argv.debug;
3088
3655
  const localMcp = argv.local;
3089
3656
  try {
3090
- const { startTUI } = await import("./start-tui-CS802Ww9.js");
3657
+ const { startTUI } = await import("./start-tui-Cbw0kVr3.js");
3091
3658
  const { buildSession } = await import("./wizard-session-wPJtNl4c.js");
3092
3659
  const tui = startTUI(VERSION, Program.McpTutorial);
3093
3660
  tui.store.session = buildSession({
@@ -3142,7 +3709,7 @@ function runWizard(config, options) {
3142
3709
  (async () => {
3143
3710
  try {
3144
3711
  const installDir = options.installDir || process.cwd();
3145
- const { startTUI } = await import("./start-tui-CS802Ww9.js");
3712
+ const { startTUI } = await import("./start-tui-Cbw0kVr3.js");
3146
3713
  const { buildSession, RunPhase } = await import("./wizard-session-wPJtNl4c.js");
3147
3714
  const { TaskStreamPush } = await import("./task-stream-BQNSp0qR.js");
3148
3715
  const { PostHogDestination } = await import("./posthog-Cr37rnla.js");
@@ -3198,7 +3765,7 @@ function runWizard(config, options) {
3198
3765
  await activeTui.store.getGate("health-check");
3199
3766
  const skipAgent = config.run == null;
3200
3767
  if (skipAgent) {
3201
- const { getOrAskForProjectData } = await import("./setup-utils-CNWIMZ-d.js").then((n) => n.r);
3768
+ const { getOrAskForProjectData } = await import("./setup-utils-CjKjaKcG.js").then((n) => n.r);
3202
3769
  const { projectApiKey, host, accessToken, projectId } = await getOrAskForProjectData({
3203
3770
  signup: session.signup,
3204
3771
  ci: session.ci,
@@ -3213,7 +3780,7 @@ function runWizard(config, options) {
3213
3780
  projectId
3214
3781
  });
3215
3782
  } else {
3216
- const { runAgent } = await import("./agent-runner-BNGW3osc.js");
3783
+ const { runAgent } = await import("./agent-runner-D7hIITUf.js");
3217
3784
  await runAgent(config, activeTui.store.session);
3218
3785
  }
3219
3786
  const isDone = () => skipAgent ? activeTui.store.session.outroDismissed : activeTui.store.session.skillsComplete;
@@ -3290,10 +3857,10 @@ function runWizardCI(config, options) {
3290
3857
  (async () => {
3291
3858
  const path = await import("path");
3292
3859
  const { buildSession } = await import("./wizard-session-wPJtNl4c.js");
3293
- const { readEnvironment } = await import("./environment-DS5Pq9Wm.js").then((n) => n.t);
3860
+ const { readEnvironment } = await import("./environment-CFXsie0G.js").then((n) => n.t);
3294
3861
  const { readApiKeyFromEnv } = await import("./env-api-key-MlzJYAvt.js").then((n) => n.t);
3295
- const { configureLogFileFromEnvironment, logToFile } = await import("./debug-fg4BAKKA.js");
3296
- const { wizardAbort, WizardError } = await import("./wizard-abort-CR3w2Efg.js");
3862
+ const { configureLogFileFromEnvironment, logToFile } = await import("./debug-CDLYQOQh.js");
3863
+ const { wizardAbort, WizardError } = await import("./wizard-abort-BPr0xo7i.js");
3297
3864
  configureLogFileFromEnvironment();
3298
3865
  const env = readEnvironment();
3299
3866
  const apiKey = options.apiKey ?? readApiKeyFromEnv() ?? void 0;
@@ -3344,7 +3911,7 @@ function runWizardCI(config, options) {
3344
3911
  })
3345
3912
  });
3346
3913
  }
3347
- const { runAgent } = await import("./agent-runner-BNGW3osc.js");
3914
+ const { runAgent } = await import("./agent-runner-D7hIITUf.js");
3348
3915
  await runAgent(config, session);
3349
3916
  } catch (error) {
3350
3917
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -4211,7 +4778,7 @@ async function runDoctorCI(options) {
4211
4778
  getUI().intro("Welcome to the PostHog setup wizard");
4212
4779
  getUI().log.info("Running posthog-doctor in CI mode");
4213
4780
  try {
4214
- const { getOrAskForProjectData } = await import("./setup-utils-CNWIMZ-d.js").then((n) => n.r);
4781
+ const { getOrAskForProjectData } = await import("./setup-utils-CjKjaKcG.js").then((n) => n.r);
4215
4782
  const { host, accessToken, projectId } = await getOrAskForProjectData({
4216
4783
  signup: false,
4217
4784
  ci: true,
@@ -4228,7 +4795,7 @@ async function runDoctorCI(options) {
4228
4795
  for (const issue of sorted) getUI().log.info(` • [${issue.severity}] ${getKindMeta(issue.kind).title}`);
4229
4796
  process.exit(1);
4230
4797
  } catch (error) {
4231
- const { ApiError } = await import("./api-DCHci5SD.js").then((n) => n.n);
4798
+ const { ApiError } = await import("./api-2zPZQONC.js").then((n) => n.n);
4232
4799
  const message = error instanceof ApiError && error.statusCode === 401 ? "Your PostHog API key is invalid or expired." : error instanceof Error ? error.message : String(error);
4233
4800
  getUI().log.error(`Doctor failed: ${message}`);
4234
4801
  process.exit(1);
@@ -4276,6 +4843,15 @@ const migrateCommand = nativeCommandFactory(migrationConfig);
4276
4843
  */
4277
4844
  const revenueCommand = nativeCommandFactory(revenueAnalyticsConfig);
4278
4845
  //#endregion
4846
+ //#region src/commands/warehouse.ts
4847
+ /**
4848
+ * `wizard warehouse` — detect and connect a data warehouse source.
4849
+ *
4850
+ * Mirrors `revenue-analytics`: flat skill command driven by the
4851
+ * warehouse-source program.
4852
+ */
4853
+ const warehouseCommand = nativeCommandFactory(warehouseSourceConfig);
4854
+ //#endregion
4279
4855
  //#region src/commands/self-driving.ts
4280
4856
  const selfDrivingCommand = {
4281
4857
  name: "self-driving",
@@ -4315,7 +4891,7 @@ function runSlackConnect(argv) {
4315
4891
  (async () => {
4316
4892
  const debug = argv.debug;
4317
4893
  try {
4318
- const { startTUI } = await import("./start-tui-CS802Ww9.js");
4894
+ const { startTUI } = await import("./start-tui-Cbw0kVr3.js");
4319
4895
  const { buildSession } = await import("./wizard-session-wPJtNl4c.js");
4320
4896
  const tui = startTUI(VERSION, Program.SlackConnect);
4321
4897
  tui.store.session = buildSession({ debug });
@@ -4692,8 +5268,8 @@ function resolveInstallDir() {
4692
5268
  if (inline) return inline.slice(14);
4693
5269
  return process.env.POSTHOG_WIZARD_INSTALL_DIR ?? process.cwd();
4694
5270
  }
4695
- Wizard.use(basicIntegrationCommand).use(mcpCommand).use(cliCommand).use(auditCommand).use(doctorCommand).use(migrateCommand).use(revenueCommand).use(selfDrivingCommand).use(slackCommand).use(uploadSourcemapsCommand).use(skillCommand).init();
5271
+ Wizard.use(basicIntegrationCommand).use(mcpCommand).use(cliCommand).use(auditCommand).use(doctorCommand).use(migrateCommand).use(revenueCommand).use(warehouseCommand).use(selfDrivingCommand).use(slackCommand).use(uploadSourcemapsCommand).use(skillCommand).init();
4696
5272
  //#endregion
4697
- export { POSTHOG_SDKS$1 as _, ConfirmButton as a, runWizard as c, getProgramConfig as d, DISPLAY_NAME as f, getContentBlocks$2 as g, fetchHealthIssues as h, useKeyboardHintsContext as i, PROGRAM_REGISTRY as l, getKindMeta as m, useKeyBindings as n, PromptLabel as o, SOURCE_MAPS_CONTEXT_KEYS as p, KeyboardHintsProvider as r, runWizardCI as s, PickerMenu as t, Program as u, STRIPE_SDKS as v };
5273
+ export { getContentBlocks$2 as _, ConfirmButton as a, runWizard as c, getProgramConfig as d, DISPLAY_NAME as f, getDetectedWarehouseSources as g, fetchHealthIssues as h, useKeyboardHintsContext as i, PROGRAM_REGISTRY as l, getKindMeta as m, useKeyBindings as n, PromptLabel as o, SOURCE_MAPS_CONTEXT_KEYS as p, KeyboardHintsProvider as r, runWizardCI as s, PickerMenu as t, Program as u, POSTHOG_SDKS$1 as v, STRIPE_SDKS as y };
4698
5274
 
4699
5275
  //# sourceMappingURL=bin.js.map