@posthog/wizard 2.11.0 → 2.12.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 (85) hide show
  1. package/README.md +48 -7
  2. package/dist/{McpScreen-DvUncZBi.js → AuditChecksViewer-DsfXIO9e.js} +330 -21
  3. package/dist/AuditChecksViewer-DsfXIO9e.js.map +1 -0
  4. package/dist/{add-mcp-server-to-clients-Br1hDRiB.js → add-mcp-server-to-clients-BKoew3aT.js} +5 -5
  5. package/dist/{add-mcp-server-to-clients-Br1hDRiB.js.map → add-mcp-server-to-clients-BKoew3aT.js.map} +1 -1
  6. package/dist/{readiness-gQvQNCeL.js → agent-interface-D5W9BAB2.js} +326 -461
  7. package/dist/agent-interface-D5W9BAB2.js.map +1 -0
  8. package/dist/{agent-runner-fWYFO4H0.js → agent-runner-B8Cx6X6x.js} +19 -30
  9. package/dist/{agent-runner-fWYFO4H0.js.map → agent-runner-B8Cx6X6x.js.map} +1 -1
  10. package/dist/analytics-DmD31Ssc.js +123 -0
  11. package/dist/analytics-DmD31Ssc.js.map +1 -0
  12. package/dist/analytics-JDitS2JI.js +2 -0
  13. package/dist/bin.js +324 -42
  14. package/dist/bin.js.map +1 -1
  15. package/dist/debug-Bkaqv1ab.js +686 -0
  16. package/dist/debug-Bkaqv1ab.js.map +1 -0
  17. package/dist/{debug-D-0xueVl.js → debug-I5sRZubJ.js} +1 -1
  18. package/dist/{defaults-CPH6eWhN.js → defaults-GbLPuHxj.js} +1 -1
  19. package/dist/{defaults-CPH6eWhN.js.map → defaults-GbLPuHxj.js.map} +1 -1
  20. package/dist/{detection-B7GNzve-.js → detection-C_RfYYDe.js} +3 -3
  21. package/dist/{detection-B7GNzve-.js.map → detection-C_RfYYDe.js.map} +1 -1
  22. package/dist/{env-api-key-DU8uIEvo.js → env-api-key-D5G2PrXW.js} +1 -1
  23. package/dist/{env-api-key-DU8uIEvo.js.map → env-api-key-D5G2PrXW.js.map} +1 -1
  24. package/dist/{file-DhSBlq-x.js → file-8iNrXHkG.js} +2 -2
  25. package/dist/{file-DhSBlq-x.js.map → file-8iNrXHkG.js.map} +1 -1
  26. package/dist/{file-utils-Dy9JncCo.js → file-utils-DnTSiTJw.js} +1 -1
  27. package/dist/{file-utils-Dy9JncCo.js.map → file-utils-DnTSiTJw.js.map} +1 -1
  28. package/dist/{package-manager-D3Lo6nXf.js → package-manager-qxP2PpM_.js} +2 -2
  29. package/dist/{package-manager-D3Lo6nXf.js.map → package-manager-qxP2PpM_.js.map} +1 -1
  30. package/dist/paths-DJS47p5x.js +26 -0
  31. package/dist/paths-DJS47p5x.js.map +1 -0
  32. package/dist/{posthog-integration-D4SRhJIQ.js → posthog-integration-DX77Msto.js} +41 -13
  33. package/dist/posthog-integration-DX77Msto.js.map +1 -0
  34. package/dist/{posthog-ByrpqEjN.js → posthog-vm0k9PKS.js} +1 -1
  35. package/dist/{posthog-ByrpqEjN.js.map → posthog-vm0k9PKS.js.map} +1 -1
  36. package/dist/provisioning-CHfTOEvg.js +2 -0
  37. package/dist/provisioning-DUj285NO.js +166 -0
  38. package/dist/provisioning-DUj285NO.js.map +1 -0
  39. package/dist/{registry-DaPKstG3.js → registry-CCtIsqb8.js} +4 -5
  40. package/dist/{registry-DaPKstG3.js.map → registry-CCtIsqb8.js.map} +1 -1
  41. package/dist/{router-SgzmfLGi.js → router-BTfmEDDJ.js} +3 -3
  42. package/dist/router-BTfmEDDJ.js.map +1 -0
  43. package/dist/{setup-utils-y4s-3uKT.js → setup-utils-Bv8z6HMb.js} +11 -150
  44. package/dist/setup-utils-Bv8z6HMb.js.map +1 -0
  45. package/dist/setup-utils-CoX-vLgw.js +2 -0
  46. package/dist/{start-playground-g1TxpCZ5.js → start-playground-DYNQ8rOz.js} +102 -7
  47. package/dist/start-playground-DYNQ8rOz.js.map +1 -0
  48. package/dist/{start-tui-CQef69NR.js → start-tui-DleQG3La.js} +969 -124
  49. package/dist/start-tui-DleQG3La.js.map +1 -0
  50. package/dist/{steps-D1zKDqAo.js → steps-C-syS8if.js} +8 -8
  51. package/dist/steps-C-syS8if.js.map +1 -0
  52. package/dist/{task-stream-DX_jKDQu.js → task-stream-CX7Uf6EM.js} +4 -4
  53. package/dist/{task-stream-DX_jKDQu.js.map → task-stream-CX7Uf6EM.js.map} +1 -1
  54. package/dist/{telemetry-CyUUSAYy.js → telemetry-DHZfjgqx.js} +2 -2
  55. package/dist/{telemetry-CyUUSAYy.js.map → telemetry-DHZfjgqx.js.map} +1 -1
  56. package/dist/{wizard-abort-DZmO_sIZ.js → wizard-abort-DIhFXJ5N.js} +1 -1
  57. package/dist/{wizard-abort-Buodno3f.js → wizard-abort-DfhWuzaw.js} +6 -4
  58. package/dist/{wizard-abort-Buodno3f.js.map → wizard-abort-DfhWuzaw.js.map} +1 -1
  59. package/dist/wizard-session-BQC9vy9Z.js +2 -0
  60. package/dist/{wizard-session-D5bggSsu.js → wizard-session-BcNJTl2I.js} +1 -1
  61. package/dist/{wizard-session-D5bggSsu.js.map → wizard-session-BcNJTl2I.js.map} +1 -1
  62. package/dist/{wizard-ui-BExOjdjA.js → wizard-ui-YdGFRyu_.js} +1 -1
  63. package/dist/wizard-ui-YdGFRyu_.js.map +1 -0
  64. package/npm-shrinkwrap.json +2 -2
  65. package/package.json +1 -1
  66. package/dist/McpScreen-DvUncZBi.js.map +0 -1
  67. package/dist/agent-skill-DJOzDaQV.js +0 -59
  68. package/dist/agent-skill-DJOzDaQV.js.map +0 -1
  69. package/dist/analytics-CfAUlt6-.js +0 -2
  70. package/dist/analytics-D3rY3TaN.js +0 -210
  71. package/dist/analytics-D3rY3TaN.js.map +0 -1
  72. package/dist/debug-gWEjmYVV.js +0 -203
  73. package/dist/debug-gWEjmYVV.js.map +0 -1
  74. package/dist/paths-BL-x2rFy.js +0 -16
  75. package/dist/paths-BL-x2rFy.js.map +0 -1
  76. package/dist/posthog-integration-D4SRhJIQ.js.map +0 -1
  77. package/dist/readiness-gQvQNCeL.js.map +0 -1
  78. package/dist/router-SgzmfLGi.js.map +0 -1
  79. package/dist/setup-utils-_ONxN-TT.js +0 -2
  80. package/dist/setup-utils-y4s-3uKT.js.map +0 -1
  81. package/dist/start-playground-g1TxpCZ5.js.map +0 -1
  82. package/dist/start-tui-CQef69NR.js.map +0 -1
  83. package/dist/steps-D1zKDqAo.js.map +0 -1
  84. package/dist/wizard-session-COhklXAF.js +0 -2
  85. package/dist/wizard-ui-BExOjdjA.js.map +0 -1
@@ -1,210 +0,0 @@
1
- import { r as debug } from "./debug-gWEjmYVV.js";
2
- import { PostHog } from "posthog-node";
3
- import { v4 } from "uuid";
4
- //#region src/lib/version.ts
5
- const VERSION = "2.11.0";
6
- //#endregion
7
- //#region src/lib/constants.ts
8
- /**
9
- * Shared constants for the PostHog wizard.
10
- */
11
- /**
12
- * Detection order matters: put framework-specific integrations BEFORE basic language fallbacks.
13
- */
14
- let Integration = /* @__PURE__ */ function(Integration) {
15
- Integration["nextjs"] = "nextjs";
16
- Integration["nuxt"] = "nuxt";
17
- Integration["vue"] = "vue";
18
- Integration["reactRouter"] = "react-router";
19
- Integration["tanstackStart"] = "tanstack-start";
20
- Integration["tanstackRouter"] = "tanstack-router";
21
- Integration["reactNative"] = "react-native";
22
- Integration["angular"] = "angular";
23
- Integration["astro"] = "astro";
24
- Integration["django"] = "django";
25
- Integration["flask"] = "flask";
26
- Integration["fastapi"] = "fastapi";
27
- Integration["laravel"] = "laravel";
28
- Integration["sveltekit"] = "sveltekit";
29
- Integration["swift"] = "swift";
30
- Integration["android"] = "android";
31
- Integration["rails"] = "rails";
32
- Integration["python"] = "python";
33
- Integration["ruby"] = "ruby";
34
- Integration["javascriptNode"] = "javascript_node";
35
- Integration["javascript_web"] = "javascript_web";
36
- return Integration;
37
- }({});
38
- const DEFAULT_HOST_URL = "https://us.i.posthog.com";
39
- const ISSUES_URL = "https://github.com/posthog/wizard/issues";
40
- const CONTEXT_MILL_URL = "https://github.com/PostHog/context-mill";
41
- const POSTHOG_DOCS_URL = "https://posthog.com/docs";
42
- /** Remote base URL for fetching the skill menu + downloading skills. */
43
- const REMOTE_SKILLS_BASE_URL = "https://github.com/PostHog/context-mill/releases/latest/download";
44
- /** Local base URL when `--local-mcp` is set (served by context-mill dev server). */
45
- const LOCAL_SKILLS_BASE_URL = "http://localhost:8765";
46
- /**
47
- * Pick the skills base URL based on the session's localMcp flag.
48
- * Single source of truth — do not inline this ternary anywhere.
49
- */
50
- function getSkillsBaseUrl(localMcp) {
51
- return localMcp ? LOCAL_SKILLS_BASE_URL : REMOTE_SKILLS_BASE_URL;
52
- }
53
- const ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = "sTMFPsFhdP1Ssg";
54
- const ANALYTICS_HOST_URL = "https://internal-j.posthog.com";
55
- const ANALYTICS_TEAM_TAG = "docs-and-wizard";
56
- const POSTHOG_OAUTH_URL = "https://oauth.posthog.com";
57
- const OAUTH_PORTS = [
58
- 8239,
59
- 8238,
60
- 8240,
61
- 8237,
62
- 8236,
63
- 8235
64
- ];
65
- const POSTHOG_US_CLIENT_ID = "c4Rdw8DIxgtQfA80IiSnGKlNX8QN00cFWF00QQhM";
66
- const POSTHOG_DEV_CLIENT_ID = "DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ";
67
- const POSTHOG_PROXY_CLIENT_ID = POSTHOG_US_CLIENT_ID;
68
- const DUMMY_PROJECT_API_KEY = "_YOUR_POSTHOG_PROJECT_TOKEN_";
69
- const WIZARD_INTERACTION_EVENT_NAME = "wizard interaction";
70
- const WIZARD_REMARK_EVENT_NAME = "wizard remark";
71
- /** Feature flag key whose value selects a variant from WIZARD_VARIANTS. */
72
- const WIZARD_VARIANT_FLAG_KEY = "wizard-variant";
73
- /** Feature flag key that gates the intro-screen "Tools" menu. */
74
- const WIZARD_TOOLS_MENU_FLAG_KEY = "wizard-tools-menu";
75
- /** Variant key -> metadata for wizard run (VARIANT flag selects which entry to use). */
76
- const WIZARD_VARIANTS = {
77
- base: { VARIANT: "base" },
78
- subagents: { VARIANT: "subagents" }
79
- };
80
- /** User-Agent for wizard HTTP requests and MCP server identification. */
81
- const WIZARD_USER_AGENT = `posthog/wizard; version: ${VERSION}`;
82
- /** Header prefix for PostHog properties (e.g. X-POSTHOG-PROPERTY-VARIANT). */
83
- const POSTHOG_PROPERTY_HEADER_PREFIX = "X-POSTHOG-PROPERTY-";
84
- /** Header prefix for PostHog feature flags. */
85
- const POSTHOG_FLAG_HEADER_PREFIX = "X-POSTHOG-FLAG-";
86
- /** Timeout for framework / project detection probes (ms). */
87
- const DETECTION_TIMEOUT_MS = 1e4;
88
- /** Timeout for the OAuth authorization flow (ms). */
89
- const OAUTH_TIMEOUT_MS = 36e4;
90
- //#endregion
91
- //#region src/utils/analytics.ts
92
- /**
93
- * Extract a standard property bag from the current session.
94
- * Used by store-level analytics and available for ad-hoc captures.
95
- */
96
- function sessionProperties(session) {
97
- return {
98
- integration: session.integration,
99
- detected_framework: session.detectedFrameworkLabel,
100
- typescript: session.typescript,
101
- project_id: session.credentials?.projectId,
102
- discovered_features: session.discoveredFeatures,
103
- additional_features: session.additionalFeatureQueue,
104
- run_phase: session.runPhase
105
- };
106
- }
107
- var Analytics = class {
108
- client;
109
- tags = {};
110
- distinctId;
111
- anonymousId;
112
- appName = "wizard";
113
- activeFlags = null;
114
- constructor() {
115
- this.client = new PostHog(ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY, {
116
- host: ANALYTICS_HOST_URL,
117
- flushAt: 1,
118
- flushInterval: 0,
119
- enableExceptionAutocapture: true
120
- });
121
- this.tags = { $app_name: this.appName };
122
- this.anonymousId = v4();
123
- this.distinctId = void 0;
124
- }
125
- setDistinctId(distinctId) {
126
- this.distinctId = distinctId;
127
- this.client.alias({
128
- distinctId,
129
- alias: this.anonymousId
130
- });
131
- }
132
- setTag(key, value) {
133
- this.tags[key] = value;
134
- }
135
- captureException(error, properties = {}) {
136
- this.client.captureException(error, this.distinctId ?? this.anonymousId, {
137
- team: ANALYTICS_TEAM_TAG,
138
- ...this.tags,
139
- ...properties
140
- });
141
- }
142
- capture(eventName, properties) {
143
- this.client.capture({
144
- distinctId: this.distinctId ?? this.anonymousId,
145
- event: eventName,
146
- properties: {
147
- ...this.tags,
148
- ...properties
149
- }
150
- });
151
- }
152
- /**
153
- * Capture a wizard-specific event. Automatically prepends "wizard: " to the event name.
154
- * All new wizard analytics should use this method instead of capture() directly.
155
- */
156
- wizardCapture(eventName, properties) {
157
- this.capture(`wizard: ${eventName}`, properties);
158
- }
159
- async getFeatureFlag(flagKey) {
160
- try {
161
- const distinctId = this.distinctId ?? this.anonymousId;
162
- return await this.client.getFeatureFlag(flagKey, distinctId, {
163
- sendFeatureFlagEvents: true,
164
- personProperties: { $app_name: this.appName }
165
- });
166
- } catch (error) {
167
- debug("Failed to get feature flag:", flagKey, error);
168
- return;
169
- }
170
- }
171
- /**
172
- * Evaluate all feature flags for the current user at the start of a run.
173
- * Result is cached; subsequent calls in the same run return the same map.
174
- * Returns flag key -> string value (booleans become 'true'/'false').
175
- */
176
- async getAllFlagsForWizard() {
177
- if (this.activeFlags !== null) return this.activeFlags;
178
- try {
179
- const distinctId = this.distinctId ?? this.anonymousId;
180
- const flags = (await this.client.getAllFlagsAndPayloads(distinctId, { personProperties: { $app_name: this.appName } })).featureFlags ?? {};
181
- const out = {};
182
- for (const [key, value] of Object.entries(flags)) {
183
- if (value === void 0) continue;
184
- out[key] = typeof value === "boolean" ? String(value) : String(value);
185
- }
186
- this.activeFlags = out;
187
- return out;
188
- } catch (error) {
189
- debug("Failed to get all feature flags:", error);
190
- return {};
191
- }
192
- }
193
- async shutdown(status) {
194
- if (Object.keys(this.tags).length === 0) return;
195
- this.client.capture({
196
- distinctId: this.distinctId ?? this.anonymousId,
197
- event: "setup wizard finished",
198
- properties: {
199
- status,
200
- tags: this.tags
201
- }
202
- });
203
- await this.client.shutdown();
204
- }
205
- };
206
- const analytics = new Analytics();
207
- //#endregion
208
- export { WIZARD_USER_AGENT as C, VERSION as D, getSkillsBaseUrl as E, WIZARD_TOOLS_MENU_FLAG_KEY as S, WIZARD_VARIANT_FLAG_KEY as T, POSTHOG_PROXY_CLIENT_ID as _, DEFAULT_HOST_URL as a, WIZARD_INTERACTION_EVENT_NAME as b, ISSUES_URL as c, OAUTH_TIMEOUT_MS as d, POSTHOG_DEV_CLIENT_ID as f, POSTHOG_PROPERTY_HEADER_PREFIX as g, POSTHOG_OAUTH_URL as h, CONTEXT_MILL_URL as i, Integration as l, POSTHOG_FLAG_HEADER_PREFIX as m, analytics as n, DETECTION_TIMEOUT_MS as o, POSTHOG_DOCS_URL as p, sessionProperties as r, DUMMY_PROJECT_API_KEY as s, Analytics as t, OAUTH_PORTS as u, POSTHOG_US_CLIENT_ID as v, WIZARD_VARIANTS as w, WIZARD_REMARK_EVENT_NAME as x, REMOTE_SKILLS_BASE_URL as y };
209
-
210
- //# sourceMappingURL=analytics-D3rY3TaN.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analytics-D3rY3TaN.js","names":["uuidv4"],"sources":["../src/lib/version.ts","../src/lib/constants.ts","../src/utils/analytics.ts"],"sourcesContent":["// Auto-generated by scripts/generate-version.js — do not edit\nexport const VERSION = '2.11.0';\n","/**\n * Shared constants for the PostHog wizard.\n */\n\nimport { VERSION } from './version';\n\n// ── Integration / CLI ───────────────────────────────────────────────\n\n/**\n * Detection order matters: put framework-specific integrations BEFORE basic language fallbacks.\n */\nexport enum Integration {\n // Frameworks\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n vue = 'vue',\n reactRouter = 'react-router',\n tanstackStart = 'tanstack-start',\n tanstackRouter = 'tanstack-router',\n reactNative = 'react-native',\n angular = 'angular',\n astro = 'astro',\n django = 'django',\n flask = 'flask',\n fastapi = 'fastapi',\n laravel = 'laravel',\n sveltekit = 'sveltekit',\n swift = 'swift',\n android = 'android',\n rails = 'rails',\n\n // Language fallbacks\n python = 'python',\n ruby = 'ruby',\n javascriptNode = 'javascript_node',\n javascript_web = 'javascript_web',\n}\n\nexport interface Args {\n debug: boolean;\n integration: Integration;\n}\n\n// ── Environment ──────────────────────────────────────────────────────\n\nimport { IS_DEV } from '@env';\nexport { IS_DEV };\nexport const DEBUG = false;\n\n// ── URLs ─────────────────────────────────────────────────────────────\n\nexport const DEFAULT_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.posthog.com';\nexport const DEFAULT_HOST_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.i.posthog.com';\nexport const ISSUES_URL = 'https://github.com/posthog/wizard/issues';\nexport const CONTEXT_MILL_URL = 'https://github.com/PostHog/context-mill';\nexport const POSTHOG_DOCS_URL = 'https://posthog.com/docs';\n\n/** Remote base URL for fetching the skill menu + downloading skills. */\nexport const REMOTE_SKILLS_BASE_URL =\n 'https://github.com/PostHog/context-mill/releases/latest/download';\n/** Local base URL when `--local-mcp` is set (served by context-mill dev server). */\nexport const LOCAL_SKILLS_BASE_URL = 'http://localhost:8765';\n\n/**\n * Pick the skills base URL based on the session's localMcp flag.\n * Single source of truth — do not inline this ternary anywhere.\n */\nexport function getSkillsBaseUrl(localMcp: boolean): string {\n return localMcp ? LOCAL_SKILLS_BASE_URL : REMOTE_SKILLS_BASE_URL;\n}\n\n// ── Analytics (internal) ──────────────────────────────────────────────\n\nexport const ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = 'sTMFPsFhdP1Ssg';\nexport const ANALYTICS_HOST_URL = 'https://internal-j.posthog.com';\nexport const ANALYTICS_TEAM_TAG = 'docs-and-wizard';\n\n// ── OAuth / Auth ────────────────────────────────────────────────────\n\nexport const POSTHOG_OAUTH_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://oauth.posthog.com';\nexport const OAUTH_PORTS = [8239, 8238, 8240, 8237, 8236, 8235] as const;\nexport const POSTHOG_US_CLIENT_ID = 'c4Rdw8DIxgtQfA80IiSnGKlNX8QN00cFWF00QQhM';\nexport const POSTHOG_EU_CLIENT_ID = 'bx2C5sZRN03TkdjraCcetvQFPGH6N2Y9vRLkcKEy';\nexport const POSTHOG_DEV_CLIENT_ID = 'DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ';\nexport const POSTHOG_PROXY_CLIENT_ID = POSTHOG_US_CLIENT_ID;\nexport const DUMMY_PROJECT_API_KEY = '_YOUR_POSTHOG_PROJECT_TOKEN_';\n\n// ── Wizard run / variants ───────────────────────────────────────────\n\nexport const WIZARD_INTERACTION_EVENT_NAME = 'wizard interaction';\nexport const WIZARD_REMARK_EVENT_NAME = 'wizard remark';\n/** Feature flag key whose value selects a variant from WIZARD_VARIANTS. */\nexport const WIZARD_VARIANT_FLAG_KEY = 'wizard-variant';\n/** Feature flag key that gates the intro-screen \"Tools\" menu. */\nexport const WIZARD_TOOLS_MENU_FLAG_KEY = 'wizard-tools-menu';\n/** Variant key -> metadata for wizard run (VARIANT flag selects which entry to use). */\nexport const WIZARD_VARIANTS: Record<string, Record<string, string>> = {\n base: { VARIANT: 'base' },\n subagents: { VARIANT: 'subagents' },\n};\n/** User-Agent for wizard HTTP requests and MCP server identification. */\nexport const WIZARD_USER_AGENT = `posthog/wizard; version: ${VERSION}`;\n\n// ── HTTP headers ─────────────────────────────────────────────────────\n\n/** Header prefix for PostHog properties (e.g. X-POSTHOG-PROPERTY-VARIANT). */\nexport const POSTHOG_PROPERTY_HEADER_PREFIX = 'X-POSTHOG-PROPERTY-';\n/** Header prefix for PostHog feature flags. */\nexport const POSTHOG_FLAG_HEADER_PREFIX = 'X-POSTHOG-FLAG-';\n\n// ── Timeouts ─────────────────────────────────────────────────────────\n\n/** Timeout for framework / project detection probes (ms). */\nexport const DETECTION_TIMEOUT_MS = 10_000;\n\n/** Timeout for the OAuth authorization flow (ms). */\nexport const OAUTH_TIMEOUT_MS = 360_000;\n","import { PostHog } from 'posthog-node';\nimport {\n ANALYTICS_HOST_URL,\n ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY,\n ANALYTICS_TEAM_TAG,\n} from '../lib/constants';\nimport type { WizardSession } from '../lib/wizard-session';\nimport { v4 as uuidv4 } from 'uuid';\nimport { debug } from './debug';\n\n/**\n * Extract a standard property bag from the current session.\n * Used by store-level analytics and available for ad-hoc captures.\n */\nexport function sessionProperties(\n session: WizardSession,\n): Record<string, unknown> {\n return {\n integration: session.integration,\n detected_framework: session.detectedFrameworkLabel,\n typescript: session.typescript,\n project_id: session.credentials?.projectId,\n discovered_features: session.discoveredFeatures,\n additional_features: session.additionalFeatureQueue,\n run_phase: session.runPhase,\n };\n}\nexport class Analytics {\n private client: PostHog;\n private tags: Record<string, string | boolean | number | null | undefined> =\n {};\n private distinctId?: string;\n private anonymousId: string;\n private appName = 'wizard';\n private activeFlags: Record<string, string> | null = null;\n\n constructor() {\n this.client = new PostHog(ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY, {\n host: ANALYTICS_HOST_URL,\n flushAt: 1,\n flushInterval: 0,\n enableExceptionAutocapture: true,\n });\n\n this.tags = { $app_name: this.appName };\n\n this.anonymousId = uuidv4();\n\n this.distinctId = undefined;\n }\n\n setDistinctId(distinctId: string) {\n this.distinctId = distinctId;\n this.client.alias({\n distinctId,\n alias: this.anonymousId,\n });\n }\n\n setTag(key: string, value: string | boolean | number | null | undefined) {\n this.tags[key] = value;\n }\n\n captureException(error: Error, properties: Record<string, unknown> = {}) {\n this.client.captureException(error, this.distinctId ?? this.anonymousId, {\n team: ANALYTICS_TEAM_TAG,\n ...this.tags,\n ...properties,\n });\n }\n\n capture(eventName: string, properties?: Record<string, unknown>) {\n this.client.capture({\n distinctId: this.distinctId ?? this.anonymousId,\n event: eventName,\n properties: {\n ...this.tags,\n ...properties,\n },\n });\n }\n\n /**\n * Capture a wizard-specific event. Automatically prepends \"wizard: \" to the event name.\n * All new wizard analytics should use this method instead of capture() directly.\n */\n wizardCapture(eventName: string, properties?: Record<string, unknown>): void {\n this.capture(`wizard: ${eventName}`, properties);\n }\n\n async getFeatureFlag(flagKey: string): Promise<string | boolean | undefined> {\n try {\n const distinctId = this.distinctId ?? this.anonymousId;\n return await this.client.getFeatureFlag(flagKey, distinctId, {\n sendFeatureFlagEvents: true,\n personProperties: {\n $app_name: this.appName,\n },\n });\n } catch (error) {\n debug('Failed to get feature flag:', flagKey, error);\n return undefined;\n }\n }\n\n /**\n * Evaluate all feature flags for the current user at the start of a run.\n * Result is cached; subsequent calls in the same run return the same map.\n * Returns flag key -> string value (booleans become 'true'/'false').\n */\n async getAllFlagsForWizard(): Promise<Record<string, string>> {\n if (this.activeFlags !== null) {\n return this.activeFlags;\n }\n try {\n const distinctId = this.distinctId ?? this.anonymousId;\n const result = await this.client.getAllFlagsAndPayloads(distinctId, {\n personProperties: { $app_name: this.appName },\n });\n const flags = result.featureFlags ?? {};\n const out: Record<string, string> = {};\n for (const [key, value] of Object.entries(flags)) {\n if (value === undefined) continue;\n out[key] = typeof value === 'boolean' ? String(value) : String(value);\n }\n this.activeFlags = out;\n return out;\n } catch (error) {\n debug('Failed to get all feature flags:', error);\n return {};\n }\n }\n\n async shutdown(status: 'success' | 'error' | 'cancelled') {\n if (Object.keys(this.tags).length === 0) {\n return;\n }\n\n this.client.capture({\n distinctId: this.distinctId ?? this.anonymousId,\n event: 'setup wizard finished',\n properties: {\n status,\n tags: this.tags,\n },\n });\n\n await this.client.shutdown();\n }\n}\n\nexport const analytics = new Analytics();\n"],"mappings":";;;;AACA,MAAa,UAAU;;;;;;;;;ACUvB,IAAY,cAAL,yBAAA,aAAA;AAEL,aAAA,YAAA;AACA,aAAA,UAAA;AACA,aAAA,SAAA;AACA,aAAA,iBAAA;AACA,aAAA,mBAAA;AACA,aAAA,oBAAA;AACA,aAAA,iBAAA;AACA,aAAA,aAAA;AACA,aAAA,WAAA;AACA,aAAA,YAAA;AACA,aAAA,WAAA;AACA,aAAA,aAAA;AACA,aAAA,aAAA;AACA,aAAA,eAAA;AACA,aAAA,WAAA;AACA,aAAA,aAAA;AACA,aAAA,WAAA;AAGA,aAAA,YAAA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E,QAAK,cAAc;AACnB,UAAO;WACA,OAAO;AACd,SAAM,oCAAoC,MAAM;AAChD,UAAO,EAAE;;;CAIb,MAAM,SAAS,QAA2C;AACxD,MAAI,OAAO,KAAK,KAAK,KAAK,CAAC,WAAW,EACpC;AAGF,OAAK,OAAO,QAAQ;GAClB,YAAY,KAAK,cAAc,KAAK;GACpC,OAAO;GACP,YAAY;IACV;IACA,MAAM,KAAK;IACZ;GACF,CAAC;AAEF,QAAM,KAAK,OAAO,UAAU;;;AAIhC,MAAa,YAAY,IAAI,WAAW"}
@@ -1,203 +0,0 @@
1
- import "./wizard-ui-BExOjdjA.js";
2
- import { n as WIZARD_LOG_FILE } from "./paths-BL-x2rFy.js";
3
- import { appendFileSync } from "fs";
4
- import path from "path";
5
- //#region src/utils/logging.ts
6
- function prepareMessage(msg) {
7
- if (typeof msg === "string") return msg;
8
- if (msg instanceof Error) return `${msg.stack || ""}`;
9
- return JSON.stringify(msg, null, " ");
10
- }
11
- function l(msg) {
12
- console.log(msg);
13
- }
14
- function red(msg) {
15
- return l(prepareMessage(msg));
16
- }
17
- //#endregion
18
- //#region src/env.ts
19
- /**
20
- * Central environment variable access for the PostHog wizard.
21
- *
22
- * ── Build-time constants ────────────────────────────────────────────
23
- * Inlined by tsdown's `env` option at compile time. After build, the
24
- * runtime value of these env vars has zero effect on the wizard.
25
- *
26
- * ── Runtime variables ───────────────────────────────────────────────
27
- * Read through `runtimeEnv()` with a typed allowlist. This makes every
28
- * runtime dependency on the environment explicit and grep-able.
29
- *
30
- * ── Direct process.env access ───────────────────────────────────────
31
- * Reserved for subprocess environment configuration (writes) and
32
- * vendored code. Production source outside those cases should use
33
- * this module instead.
34
- */
35
- const NODE_ENV = "production";
36
- /** Read a runtime environment variable. Only allowlisted keys compile. */
37
- function runtimeEnv(key) {
38
- return process.env[key];
39
- }
40
- //#endregion
41
- //#region src/ui/logging-ui.ts
42
- var LoggingUI = class {
43
- intro(message) {
44
- console.log(`┌ ${message}`);
45
- }
46
- outro(message) {
47
- console.log(`└ ${message}`);
48
- }
49
- outroError(data) {
50
- console.log(`✖ ${data.message ?? "Wizard aborted"}`);
51
- if (data.body) console.log(`│ ${data.body}`);
52
- if (data.docsUrl) console.log(`│ Docs: ${data.docsUrl}`);
53
- }
54
- cancel(message) {
55
- console.log(`■ ${message}`);
56
- }
57
- log = {
58
- info(message) {
59
- console.log(`│ ${message}`);
60
- },
61
- warn(message) {
62
- console.log(`▲ ${message}`);
63
- },
64
- error(message) {
65
- console.log(`✖ ${message}`);
66
- },
67
- success(message) {
68
- console.log(`✔ ${message}`);
69
- },
70
- step(message) {
71
- console.log(`◇ ${message}`);
72
- }
73
- };
74
- note(message) {
75
- console.log(`│ ${message}`);
76
- }
77
- spinner() {
78
- return {
79
- start(message) {
80
- if (message) console.log(`◌ ${message}`);
81
- },
82
- stop(message) {
83
- if (message) console.log(`● ${message}`);
84
- },
85
- message(msg) {
86
- if (msg) console.log(`◌ ${msg}`);
87
- }
88
- };
89
- }
90
- pushStatus(message) {
91
- console.log(`◇ ${message}`);
92
- }
93
- setDetectedFramework(label) {
94
- console.log(`✔ Framework: ${label}`);
95
- }
96
- onEnterScreen(_screen, _fn) {}
97
- setLoginUrl(url) {
98
- if (url) {
99
- console.log(`│ If the browser didn't open automatically, use this link:`);
100
- console.log(`│ ${url}`);
101
- }
102
- }
103
- showBlockingOutage(result) {
104
- console.log(`▲ Service health issues detected — blocking outage.`);
105
- for (const reason of result.reasons) console.log(`│ ${reason}`);
106
- console.log(`│ The wizard may not work reliably while services are affected.`);
107
- return Promise.resolve();
108
- }
109
- setReadinessWarnings(result) {
110
- console.log(`▲ Service health warnings detected.`);
111
- for (const reason of result.reasons) console.log(`│ ${reason}`);
112
- }
113
- showPortConflict(_processInfo) {
114
- return Promise.resolve();
115
- }
116
- showSettingsOverride(_conflicts, _backupAndFix) {
117
- return Promise.resolve();
118
- }
119
- showAuthError() {
120
- console.log(`✖ Authentication failed (401)`);
121
- console.log(`│ Claude Code auth is conflicting with the wizard. Please try again after logging out:`);
122
- console.log(`│ claude auth logout`);
123
- }
124
- startRun() {}
125
- setCredentials(_credentials) {}
126
- syncTodos(todos) {
127
- const completed = todos.filter((t) => t.status === "completed").length;
128
- const inProgress = todos.find((t) => t.status === "in_progress");
129
- if (inProgress) console.log(`◌ [${completed}/${todos.length}] ${inProgress.activeForm || inProgress.content}`);
130
- }
131
- setEventPlan(_events) {}
132
- };
133
- //#endregion
134
- //#region src/ui/index.ts
135
- let currentUI = new LoggingUI();
136
- function getUI() {
137
- return currentUI;
138
- }
139
- function setUI(ui) {
140
- currentUI = ui;
141
- }
142
- //#endregion
143
- //#region src/utils/debug.ts
144
- let debugEnabled = false;
145
- let logFilePath = WIZARD_LOG_FILE;
146
- let logEnabled = true;
147
- function getLogFilePath() {
148
- return logFilePath;
149
- }
150
- /**
151
- * Configure the log file path and enable/disable state.
152
- * Call before initLogFile() to override defaults.
153
- */
154
- function configureLogFile(opts) {
155
- if (opts.path !== void 0) logFilePath = opts.path;
156
- if (opts.enabled !== void 0) logEnabled = opts.enabled;
157
- }
158
- /**
159
- * Configure log path from environment variables.
160
- *
161
- * Uses POSTHOG_WIZARD_LOG_DIR when set, joined with posthog-wizard.log.
162
- */
163
- function configureLogFileFromEnvironment() {
164
- const envLogDir = runtimeEnv("POSTHOG_WIZARD_LOG_DIR");
165
- if (envLogDir) configureLogFile({ path: path.join(envLogDir, "posthog-wizard.log") });
166
- }
167
- /**
168
- * Initialize the log file with a run header.
169
- * Call this at the start of each wizard run.
170
- * Fails silently to avoid crashing the wizard.
171
- */
172
- function initLogFile() {
173
- if (!logEnabled) return;
174
- try {
175
- const header = `\n${"=".repeat(60)}\nPostHog Wizard Run: ${(/* @__PURE__ */ new Date()).toISOString()}\n${"=".repeat(60)}\n`;
176
- appendFileSync(logFilePath, header);
177
- } catch {}
178
- }
179
- /**
180
- * Log a message to the log file.
181
- * Always writes regardless of debug flag (when logging is enabled).
182
- * Fails silently to avoid masking errors in catch blocks.
183
- */
184
- function logToFile(...args) {
185
- if (!logEnabled) return;
186
- try {
187
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
188
- const msg = args.map((a) => prepareMessage(a)).join(" ");
189
- appendFileSync(logFilePath, `[${timestamp}] ${msg}\n`);
190
- } catch {}
191
- }
192
- function debug(...args) {
193
- if (!debugEnabled) return;
194
- const msg = args.map((a) => prepareMessage(a)).join(" ");
195
- getUI().log.info(msg);
196
- }
197
- function enableDebugLogs() {
198
- debugEnabled = true;
199
- }
200
- //#endregion
201
- export { getLogFilePath as a, getUI as c, NODE_ENV as d, runtimeEnv as f, enableDebugLogs as i, setUI as l, configureLogFileFromEnvironment as n, initLogFile as o, red as p, debug as r, logToFile as s, configureLogFile as t, LoggingUI as u };
202
-
203
- //# sourceMappingURL=debug-gWEjmYVV.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug-gWEjmYVV.js","names":[],"sources":["../src/utils/logging.ts","../src/env.ts","../src/ui/logging-ui.ts","../src/ui/index.ts","../src/utils/debug.ts"],"sourcesContent":["export function prepareMessage(msg: unknown): string {\n if (typeof msg === 'string') {\n return msg;\n }\n if (msg instanceof Error) {\n return `${msg.stack || ''}`;\n }\n return JSON.stringify(msg, null, '\\t');\n}\n\nexport function l(msg: string): void {\n // eslint-disable-next-line no-console\n console.log(msg);\n}\n\nexport function nl(): void {\n return l('');\n}\n\nexport function green(msg: string): void {\n return l(prepareMessage(msg));\n}\n\nexport function red(msg: string): void {\n return l(prepareMessage(msg));\n}\n\nexport function dim(msg: string): void {\n return l(prepareMessage(msg));\n}\n\nexport function yellow(msg: string): void {\n return l(prepareMessage(msg));\n}\n\nexport function cyan(msg: string): void {\n return l(prepareMessage(msg));\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function debug(msg: any): void {\n return l(prepareMessage(msg));\n}\n","/**\n * Central environment variable access for the PostHog wizard.\n *\n * ── Build-time constants ────────────────────────────────────────────\n * Inlined by tsdown's `env` option at compile time. After build, the\n * runtime value of these env vars has zero effect on the wizard.\n *\n * ── Runtime variables ───────────────────────────────────────────────\n * Read through `runtimeEnv()` with a typed allowlist. This makes every\n * runtime dependency on the environment explicit and grep-able.\n *\n * ── Direct process.env access ───────────────────────────────────────\n * Reserved for subprocess environment configuration (writes) and\n * vendored code. Production source outside those cases should use\n * this module instead.\n */\n\n// ── Build-time constants ─────────────────────────────────────────────\n// tsdown replaces `process.env.NODE_ENV` with a string literal.\n// After build these are just `\"production\"`, `false`, etc.\n\nexport const NODE_ENV = process.env.NODE_ENV as string;\nexport const IS_DEV =\n process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';\n\n// ── Runtime environment ──────────────────────────────────────────────\n\n/**\n * Exhaustive allowlist of env vars the wizard reads at runtime.\n * Add new keys here when a new runtime dependency is needed.\n */\ntype RuntimeEnvKey =\n // Wizard CLI configuration (yargs POSTHOG_WIZARD_ prefix)\n | 'POSTHOG_WIZARD_BENCHMARK_CONFIG'\n | 'POSTHOG_WIZARD_BENCHMARK_FILE'\n | 'POSTHOG_WIZARD_LOG_DIR'\n | 'POSTHOG_WIZARD_DEBUG'\n | 'DEBUG'\n // Agent / MCP\n | 'MCP_URL'\n | 'POSTHOG_API_KEY'\n // Platform: terminal detection\n | 'TERM'\n | 'TERM_PROGRAM'\n | 'TERMINAL_EMULATOR'\n | 'CI'\n | 'WT_SESSION'\n | 'TERMINUS_SUBLIME'\n | 'ConEmuTask'\n // Platform: paths\n | 'APPDATA'\n | 'XDG_CONFIG_HOME';\n\n/** Read a runtime environment variable. Only allowlisted keys compile. */\nexport function runtimeEnv(key: RuntimeEnvKey): string | undefined {\n return process.env[key];\n}\n","/* eslint-disable no-console */\n/**\n * LoggingUI — Logging-only implementation for CI mode.\n * No prompts, no TUI, no interactivity. Just console output.\n */\n\nimport { TaskStatus, type WizardUI, type SpinnerHandle } from './wizard-ui';\nimport type { SettingsConflict } from '../lib/agent/agent-interface';\nimport type { WizardReadinessResult } from '../lib/health-checks/readiness.js';\nimport type { OutroData } from '../lib/wizard-session';\n\nexport class LoggingUI implements WizardUI {\n intro(message: string): void {\n console.log(`┌ ${message}`);\n }\n\n outro(message: string): void {\n console.log(`└ ${message}`);\n }\n\n outroError(data: OutroData): void {\n console.log(`✖ ${data.message ?? 'Wizard aborted'}`);\n if (data.body) console.log(`│ ${data.body}`);\n if (data.docsUrl) console.log(`│ Docs: ${data.docsUrl}`);\n }\n\n cancel(message: string): void {\n console.log(`■ ${message}`);\n }\n\n log = {\n info(message: string): void {\n console.log(`│ ${message}`);\n },\n warn(message: string): void {\n console.log(`▲ ${message}`);\n },\n error(message: string): void {\n console.log(`✖ ${message}`);\n },\n success(message: string): void {\n console.log(`✔ ${message}`);\n },\n step(message: string): void {\n console.log(`◇ ${message}`);\n },\n };\n\n note(message: string): void {\n console.log(`│ ${message}`);\n }\n\n spinner(): SpinnerHandle {\n return {\n start(message?: string) {\n if (message) console.log(`◌ ${message}`);\n },\n stop(message?: string) {\n if (message) console.log(`● ${message}`);\n },\n message(msg?: string) {\n if (msg) console.log(`◌ ${msg}`);\n },\n };\n }\n\n pushStatus(message: string): void {\n console.log(`◇ ${message}`);\n }\n\n setDetectedFramework(label: string): void {\n console.log(`✔ Framework: ${label}`);\n }\n\n onEnterScreen(_screen: string, _fn: () => void): void {\n // No screen transitions in CI\n }\n\n setLoginUrl(url: string | null): void {\n if (url) {\n console.log(\n `│ If the browser didn't open automatically, use this link:`,\n );\n console.log(`│ ${url}`);\n }\n }\n\n showBlockingOutage(result: WizardReadinessResult): Promise<void> {\n console.log(`▲ Service health issues detected — blocking outage.`);\n for (const reason of result.reasons) {\n console.log(`│ ${reason}`);\n }\n console.log(\n `│ The wizard may not work reliably while services are affected.`,\n );\n return Promise.resolve();\n }\n\n setReadinessWarnings(result: WizardReadinessResult): void {\n console.log(`▲ Service health warnings detected.`);\n for (const reason of result.reasons) {\n console.log(`│ ${reason}`);\n }\n }\n\n showPortConflict(_processInfo: {\n command: string;\n pid: string;\n port: number;\n user: string;\n }): Promise<void> {\n return Promise.resolve();\n }\n\n showSettingsOverride(\n _conflicts: SettingsConflict[],\n _backupAndFix: () => boolean,\n ): Promise<void> {\n return Promise.resolve();\n }\n\n showAuthError(): void {\n console.log(`✖ Authentication failed (401)`);\n console.log(\n `│ Claude Code auth is conflicting with the wizard. Please try again after logging out:`,\n );\n console.log(`│ claude auth logout`);\n }\n\n startRun(): void {\n // No-op in CI mode\n }\n\n setCredentials(_credentials: {\n accessToken: string;\n projectApiKey: string;\n host: string;\n projectId: number;\n }): void {\n // No-op in CI mode — credentials are handled directly\n }\n\n syncTodos(\n todos: Array<{ content: string; status: string; activeForm?: string }>,\n ): void {\n const completed = todos.filter(\n (t) => t.status === TaskStatus.Completed,\n ).length;\n const inProgress = todos.find((t) => t.status === TaskStatus.InProgress);\n if (inProgress) {\n console.log(\n `◌ [${completed}/${todos.length}] ${\n inProgress.activeForm || inProgress.content\n }`,\n );\n }\n }\n\n setEventPlan(_events: Array<{ name: string; description: string }>): void {\n // No-op in CI mode\n }\n}\n","/**\n * UI singleton — provides getUI() and setUI() for the wizard.\n * Default: LoggingUI. Swap to InkUI at startup for TUI mode.\n */\n\nimport type { WizardUI } from './wizard-ui';\nimport { LoggingUI } from './logging-ui';\n\nlet currentUI: WizardUI = new LoggingUI();\n\nexport function getUI(): WizardUI {\n return currentUI;\n}\n\nexport function setUI(ui: WizardUI): void {\n currentUI = ui;\n}\n\nexport type { WizardUI, SpinnerHandle } from './wizard-ui';\n","import { appendFileSync } from 'fs';\nimport path from 'path';\nimport { prepareMessage } from './logging';\nimport { getUI } from '../ui';\nimport { runtimeEnv } from '@env';\nimport { WIZARD_LOG_FILE } from './paths';\n\nlet debugEnabled = false;\nlet logFilePath = WIZARD_LOG_FILE;\nlet logEnabled = true;\n\nexport function getLogFilePath(): string {\n return logFilePath;\n}\n\n/**\n * Configure the log file path and enable/disable state.\n * Call before initLogFile() to override defaults.\n */\nexport function configureLogFile(opts: {\n path?: string;\n enabled?: boolean;\n}): void {\n if (opts.path !== undefined) logFilePath = opts.path;\n if (opts.enabled !== undefined) logEnabled = opts.enabled;\n}\n\n/**\n * Configure log path from environment variables.\n *\n * Uses POSTHOG_WIZARD_LOG_DIR when set, joined with posthog-wizard.log.\n */\nexport function configureLogFileFromEnvironment(): void {\n const envLogDir = runtimeEnv('POSTHOG_WIZARD_LOG_DIR');\n if (envLogDir) {\n configureLogFile({ path: path.join(envLogDir, 'posthog-wizard.log') });\n }\n}\n\n/**\n * Initialize the log file with a run header.\n * Call this at the start of each wizard run.\n * Fails silently to avoid crashing the wizard.\n */\nexport function initLogFile() {\n if (!logEnabled) return;\n try {\n const header = `\\n${'='.repeat(\n 60,\n )}\\nPostHog Wizard Run: ${new Date().toISOString()}\\n${'='.repeat(60)}\\n`;\n appendFileSync(logFilePath, header);\n } catch {\n // Silently ignore - logging is non-critical\n }\n}\n\n/**\n * Log a message to the log file.\n * Always writes regardless of debug flag (when logging is enabled).\n * Fails silently to avoid masking errors in catch blocks.\n */\nexport function logToFile(...args: unknown[]) {\n if (!logEnabled) return;\n try {\n const timestamp = new Date().toISOString();\n const msg = args.map((a) => prepareMessage(a)).join(' ');\n appendFileSync(logFilePath, `[${timestamp}] ${msg}\\n`);\n } catch {\n // Silently ignore logging failures to avoid masking original errors\n }\n}\n\nexport function debug(...args: unknown[]) {\n if (!debugEnabled) {\n return;\n }\n\n const msg = args.map((a) => prepareMessage(a)).join(' ');\n\n getUI().log.info(msg);\n}\n\nexport function enableDebugLogs() {\n debugEnabled = true;\n}\n"],"mappings":";;;;;AAAA,SAAgB,eAAe,KAAsB;AACnD,KAAI,OAAO,QAAQ,SACjB,QAAO;AAET,KAAI,eAAe,MACjB,QAAO,GAAG,IAAI,SAAS;AAEzB,QAAO,KAAK,UAAU,KAAK,MAAM,IAAK;;AAGxC,SAAgB,EAAE,KAAmB;AAEnC,SAAQ,IAAI,IAAI;;AAWlB,SAAgB,IAAI,KAAmB;AACrC,QAAO,EAAE,eAAe,IAAI,CAAC;;;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qBAAqB,EAAE,CAAC;;;;;;;AAS1E,SAAgB,cAAc;AAC5B,KAAI,CAAC,WAAY;AACjB,KAAI;EACF,MAAM,SAAS,KAAK,IAAI,OACtB,GACD,CAAC,yCAAwB,IAAI,MAAM,EAAC,aAAa,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC;AACtE,iBAAe,aAAa,OAAO;SAC7B;;;;;;;AAUV,SAAgB,UAAU,GAAG,MAAiB;AAC5C,KAAI,CAAC,WAAY;AACjB,KAAI;EACF,MAAM,6BAAY,IAAI,MAAM,EAAC,aAAa;EAC1C,MAAM,MAAM,KAAK,KAAK,MAAM,eAAe,EAAE,CAAC,CAAC,KAAK,IAAI;AACxD,iBAAe,aAAa,IAAI,UAAU,IAAI,IAAI,IAAI;SAChD;;AAKV,SAAgB,MAAM,GAAG,MAAiB;AACxC,KAAI,CAAC,aACH;CAGF,MAAM,MAAM,KAAK,KAAK,MAAM,eAAe,EAAE,CAAC,CAAC,KAAK,IAAI;AAExD,QAAO,CAAC,IAAI,KAAK,IAAI;;AAGvB,SAAgB,kBAAkB;AAChC,gBAAe"}
@@ -1,16 +0,0 @@
1
- import { tmpdir } from "node:os";
2
- import { join } from "node:path";
3
- //#region src/utils/paths.ts
4
- const TMP = process.platform === "win32" ? tmpdir() : "/tmp";
5
- const WIZARD_LOG_FILE = join(TMP, "posthog-wizard.log");
6
- const WIZARD_BENCHMARK_FILE = join(TMP, "posthog-wizard-benchmark.json");
7
- const WIZARD_YARA_REPORT_FILE = join(TMP, "posthog-wizard-yara-report.json");
8
- const WIZARD_TASK_STREAM_LOG = join(TMP, "posthog-task-stream.log");
9
- /** Temp path for a skill download zip. */
10
- function skillTmpPath(skillId) {
11
- return join(TMP, `posthog-skill-${skillId}.zip`);
12
- }
13
- //#endregion
14
- export { skillTmpPath as a, WIZARD_YARA_REPORT_FILE as i, WIZARD_LOG_FILE as n, WIZARD_TASK_STREAM_LOG as r, WIZARD_BENCHMARK_FILE as t };
15
-
16
- //# sourceMappingURL=paths-BL-x2rFy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paths-BL-x2rFy.js","names":[],"sources":["../src/utils/paths.ts"],"sourcesContent":["import { tmpdir } from 'node:os';\nimport { join } from 'node:path';\n\n// /tmp is stable and discoverable on macOS/Linux; Windows needs os.tmpdir()\nconst TMP = process.platform === 'win32' ? tmpdir() : '/tmp';\n\nexport const WIZARD_LOG_FILE = join(TMP, 'posthog-wizard.log');\nexport const WIZARD_BENCHMARK_FILE = join(TMP, 'posthog-wizard-benchmark.json');\nexport const WIZARD_YARA_REPORT_FILE = join(\n TMP,\n 'posthog-wizard-yara-report.json',\n);\nexport const WIZARD_TASK_STREAM_LOG = join(TMP, 'posthog-task-stream.log');\n\n/** Temp path for a skill download zip. */\nexport function skillTmpPath(skillId: string): string {\n return join(TMP, `posthog-skill-${skillId}.zip`);\n}\n"],"mappings":";;;AAIA,MAAM,MAAM,QAAQ,aAAa,UAAU,QAAQ,GAAG;AAEtD,MAAa,kBAAkB,KAAK,KAAK,qBAAqB;AAC9D,MAAa,wBAAwB,KAAK,KAAK,gCAAgC;AAC/E,MAAa,0BAA0B,KACrC,KACA,kCACD;AACD,MAAa,yBAAyB,KAAK,KAAK,0BAA0B;;AAG1E,SAAgB,aAAa,SAAyB;AACpD,QAAO,KAAK,KAAK,iBAAiB,QAAQ,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"posthog-integration-D4SRhJIQ.js","names":[],"sources":["../src/lib/workflows/posthog-integration/detect.ts","../src/lib/workflows/posthog-integration/steps.ts","../src/lib/workflows/posthog-integration/index.ts"],"sourcesContent":["/**\n * Core integration detection step.\n *\n * Runs framework detection, context gathering, version checking,\n * and feature discovery. Writes results to the store via the\n * WorkflowReadyContext so the IntroScreen can display them.\n *\n * This is the same work that bin.ts $0 handler does inline —\n * extracted here so the `integrate` subcommand can reuse it.\n */\n\nimport type { WorkflowReadyContext } from '../workflow-step.js';\nimport { FRAMEWORK_REGISTRY } from '../../registry.js';\nimport {\n detectFramework,\n discoverFeatures,\n gatherFrameworkContext,\n checkFrameworkVersion,\n} from '../../detection/index.js';\n\nexport async function detectPostHogIntegration(\n ctx: WorkflowReadyContext,\n): Promise<void> {\n const session = ctx.session;\n const installDir = session.installDir;\n\n const detectedIntegration = await detectFramework(installDir);\n\n if (detectedIntegration) {\n const config = FRAMEWORK_REGISTRY[detectedIntegration];\n\n const sessionOptions = {\n installDir,\n debug: session.debug,\n forceInstall: session.forceInstall,\n default: false,\n signup: session.signup,\n localMcp: session.localMcp,\n ci: session.ci,\n menu: session.menu,\n benchmark: session.benchmark,\n yaraReport: session.yaraReport,\n };\n\n // Gather framework-specific context (e.g., router type)\n const context = await gatherFrameworkContext(config, sessionOptions);\n for (const [key, value] of Object.entries(context)) {\n if (!(key in session.frameworkContext)) {\n ctx.setFrameworkContext(key, value);\n }\n }\n\n ctx.setFrameworkConfig(detectedIntegration, config);\n session.skillId = detectedIntegration;\n\n if (!session.detectedFrameworkLabel) {\n ctx.setDetectedFramework(config.metadata.name);\n }\n\n // Version check\n const versionResult = await checkFrameworkVersion(config, sessionOptions);\n if (versionResult.supported !== true) {\n ctx.setUnsupportedVersion(versionResult.supported);\n }\n }\n\n // Feature discovery\n for (const feature of discoverFeatures(installDir)) {\n ctx.addDiscoveredFeature(feature);\n }\n\n ctx.setDetectionComplete();\n}\n","/**\n * PostHog integration workflow — the default wizard flow.\n *\n * Steps define their own gate predicates and onInit callbacks.\n * The store derives gate promises and fires init work from these\n * definitions — no hardcoded per-flow logic in the store.\n */\n\nimport type { Workflow } from '../workflow-step.js';\nimport type { WizardSession } from '../../wizard-session.js';\nimport { RunPhase } from '../../wizard-session.js';\nimport {\n evaluateWizardReadiness,\n WizardReadiness,\n} from '../../health-checks/readiness.js';\nimport { detectPostHogIntegration } from './detect.js';\n\nfunction needsSetup(session: WizardSession): boolean {\n const config = session.frameworkConfig;\n if (!config?.metadata.setup?.questions) return false;\n\n return config.metadata.setup.questions.some(\n (q: { key: string }) => !(q.key in session.frameworkContext),\n );\n}\n\nfunction healthCheckReady(session: WizardSession): boolean {\n if (!session.readinessResult) return false;\n if (session.readinessResult.decision === WizardReadiness.No)\n return session.outageDismissed;\n return true;\n}\n\nexport const POSTHOG_INTEGRATION_WORKFLOW: Workflow = [\n {\n id: 'detect',\n label: 'Detecting framework',\n // Headless step: no screen. onReady fires after bin.ts assigns the\n // session — runs framework detection, context gathering, version\n // check, and feature discovery. Results are written to the store\n // for the IntroScreen to render.\n onReady: (ctx) => detectPostHogIntegration(ctx),\n },\n {\n id: 'intro',\n label: 'Welcome',\n screen: 'intro',\n gate: (session) => session.setupConfirmed,\n },\n {\n id: 'health-check',\n label: 'Health check',\n screen: 'health-check',\n gate: healthCheckReady,\n onInit: (ctx) => {\n evaluateWizardReadiness()\n .then((readiness) => {\n ctx.setReadinessResult(readiness);\n })\n .catch(() => {\n ctx.setReadinessResult({\n decision: WizardReadiness.Yes,\n health: {} as never,\n reasons: [],\n });\n });\n },\n },\n {\n id: 'setup',\n label: 'Setup',\n screen: 'setup',\n show: needsSetup,\n isComplete: (session) => !needsSetup(session),\n },\n {\n id: 'auth',\n label: 'Authentication',\n screen: 'auth',\n isComplete: (session) => session.credentials !== null,\n },\n {\n id: 'run',\n label: 'Integration',\n screen: 'run',\n isComplete: (session) =>\n session.runPhase === RunPhase.Completed ||\n session.runPhase === RunPhase.Error,\n },\n {\n id: 'mcp',\n label: 'MCP servers',\n screen: 'mcp',\n isComplete: (session) => session.mcpComplete,\n },\n {\n id: 'outro',\n label: 'Done',\n screen: 'outro',\n isComplete: (session) => session.outroDismissed,\n },\n {\n id: 'keep-skills',\n label: 'Keep Skills',\n screen: 'keep-skills',\n },\n];\n","import type { WorkflowConfig } from '../workflow-step.js';\nimport type { WorkflowRun } from '../../agent/agent-runner.js';\nimport type { WizardSession } from '../../wizard-session.js';\nimport { OutroKind } from '../../wizard-session.js';\nimport { AgentSignals } from '../../agent/agent-interface.js';\nimport {\n DEFAULT_PACKAGE_INSTALLATION,\n SPINNER_MESSAGE,\n} from '../../framework-config.js';\nimport {\n tryGetPackageJson,\n isUsingTypeScript,\n} from '../../../utils/setup-utils.js';\nimport { analytics } from '../../../utils/analytics.js';\nimport { WIZARD_INTERACTION_EVENT_NAME } from '../../constants.js';\nimport { getUI } from '../../../ui/index.js';\nimport { getCloudUrlFromRegion } from '../../../utils/urls.js';\nimport { POSTHOG_INTEGRATION_WORKFLOW } from './steps.js';\n\nexport const posthogIntegrationConfig: WorkflowConfig = {\n command: 'integrate',\n description: 'Set up PostHog SDK integration',\n flowKey: 'posthog-integration',\n steps: POSTHOG_INTEGRATION_WORKFLOW,\n\n run: async (session: WizardSession): Promise<WorkflowRun> => {\n const config = session.frameworkConfig!;\n\n const typeScriptDetected = isUsingTypeScript({\n installDir: session.installDir,\n });\n session.typescript = typeScriptDetected;\n\n // Read package.json and resolve framework version\n const usesPackageJson = config.detection.usesPackageJson !== false;\n let frameworkVersion: string | undefined;\n\n if (usesPackageJson) {\n const packageJson = await tryGetPackageJson({\n installDir: session.installDir,\n });\n if (packageJson) {\n const { hasPackageInstalled } = await import(\n '../../../utils/package-json.js'\n );\n if (!hasPackageInstalled(config.detection.packageName, packageJson)) {\n getUI().log.warn(\n `${config.detection.packageDisplayName} does not seem to be installed. Continuing anyway — the agent will handle it.`,\n );\n }\n frameworkVersion = config.detection.getVersion(packageJson);\n } else {\n getUI().log.warn(\n 'Could not find package.json. Continuing anyway — the agent will handle it.',\n );\n }\n } else {\n frameworkVersion = config.detection.getVersion(null);\n }\n\n // Analytics tags\n if (frameworkVersion && config.detection.getVersionBucket) {\n const versionBucket = config.detection.getVersionBucket(frameworkVersion);\n analytics.setTag(`${config.metadata.integration}-version`, versionBucket);\n }\n const frameworkContext = session.frameworkContext;\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n return {\n integrationLabel: config.metadata.integration,\n additionalMcpServers: config.metadata.additionalMcpServers,\n detectPackageManager: config.detection.detectPackageManager,\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n estimatedDurationMinutes: config.ui.estimatedDurationMinutes,\n reportFile: 'posthog-setup-report.md',\n docsUrl: config.metadata.docsUrl,\n errorMessage: 'Integration failed',\n additionalFeatureQueue: session.additionalFeatureQueue,\n\n customPrompt: (ctx) => {\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\n const additionalContext =\n additionalLines.length > 0\n ? '\\n' + additionalLines.map((line) => `- ${line}`).join('\\n')\n : '';\n\n return `You have access to the PostHog MCP server which provides skills to integrate PostHog into this ${\n config.metadata.name\n } project.\n\nProject context:\n- PostHog Project ID: ${ctx.projectId}\n- Framework: ${config.metadata.name} ${frameworkVersion || 'latest'}\n- TypeScript: ${typeScriptDetected ? 'Yes' : 'No'}\n- PostHog public token: ${ctx.projectApiKey}\n- PostHog Host: ${ctx.host}\n- Project type: ${config.prompts.projectTypeDetection}\n- Package installation: ${\n config.prompts.packageInstallation ?? DEFAULT_PACKAGE_INSTALLATION\n }${additionalContext}\n\nInstructions (follow these steps IN ORDER - do not skip or reorder):\n\nSTEP 1: Call load_skill_menu (from the wizard-tools MCP server) to see available skills.\n If the tool fails, emit: ${\n AgentSignals.ERROR_MCP_MISSING\n } Could not load skill menu and halt.\n\n Choose a skill from the \\`integration\\` category that matches this project's framework. Do NOT pick skills from other categories (llm-analytics, error-tracking, feature-flags, omnibus, etc.) — those are handled separately.\n If no suitable integration skill is found, emit: ${\n AgentSignals.ERROR_RESOURCE_MISSING\n } Could not find a suitable skill for this project.\n\nSTEP 2: Call install_skill (from the wizard-tools MCP server) with the chosen skill ID (e.g., \"integration-nextjs-app-router\").\n Do NOT run any shell commands to install skills.\n\nSTEP 3: Load the installed skill's SKILL.md file to understand what references are available.\n\nSTEP 4: Follow the skill's workflow files in sequence. Look for numbered workflow files in the references (e.g., files with patterns like \"1.0-\", \"1.1-\", \"1.2-\"). Start with the first one and proceed through each step until completion. Each workflow file will tell you what to do and which file comes next. Never directly write PostHog tokens directly to code files; always use environment variables.\n\nSTEP 5: Set up environment variables for PostHog using the wizard-tools MCP server (this runs locally — secret values never leave the machine):\n - Use check_env_keys to see which keys already exist in the project's .env file (e.g. .env.local or .env).\n - Use set_env_values to create or update the PostHog public token and host, using the appropriate environment variable naming convention for ${\n config.metadata.name\n }, which you'll find in example code. The tool will also ensure .gitignore coverage. Don't assume the presence of keys means the value is up to date. Write the correct value each time.\n - Reference these environment variables in the code files you create instead of hardcoding the public token and host.\n\nImportant: Use the detect_package_manager tool (from the wizard-tools MCP server) to determine which package manager the project uses. Do not manually search for lockfiles or config files. Always install packages as a background task. Don't await completion; proceed with other work immediately after starting the installation. You must read a file immediately before attempting to write it, even if you have previously read it; failure to do so will cause a tool failure.\n\n\n`;\n },\n\n postRun: async (sess, credentials) => {\n const envVars = config.environment.getEnvVars(\n credentials.projectApiKey,\n credentials.host,\n );\n if (config.environment.uploadToHosting) {\n const { uploadEnvironmentVariablesStep } = await import(\n '../../../steps/index.js'\n );\n const uploadedEnvVars = await uploadEnvironmentVariablesStep(\n envVars,\n {\n integration: config.metadata.integration,\n session: sess,\n },\n );\n if (uploadedEnvVars.length > 0) {\n analytics.capture(WIZARD_INTERACTION_EVENT_NAME, {\n action: 'wizard_env_vars_uploaded',\n integration: config.metadata.integration,\n variable_count: uploadedEnvVars.length,\n variable_keys: uploadedEnvVars,\n });\n }\n }\n },\n\n buildOutroData: (sess, credentials, cloudRegion) => {\n const envVars = config.environment.getEnvVars(\n credentials.projectApiKey,\n credentials.host,\n );\n const continueUrl =\n sess.signup && cloudRegion\n ? `${getCloudUrlFromRegion(cloudRegion)}/products?source=wizard`\n : undefined;\n\n const changes = [\n ...config.ui.getOutroChanges(frameworkContext),\n Object.keys(envVars).length > 0\n ? 'Added environment variables to .env file'\n : '',\n ].filter(Boolean);\n\n return {\n kind: OutroKind.Success as const,\n message: 'Successfully installed PostHog!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