@posthog/wizard 1.35.2 → 1.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +1 -3
  2. package/dist/bin.js +1 -12
  3. package/dist/bin.js.map +1 -1
  4. package/dist/src/__tests__/cli.test.js +5 -58
  5. package/dist/src/__tests__/cli.test.js.map +1 -1
  6. package/dist/src/lib/agent-interface.js +8 -0
  7. package/dist/src/lib/agent-interface.js.map +1 -1
  8. package/dist/src/lib/agent-runner.js +2 -13
  9. package/dist/src/lib/agent-runner.js.map +1 -1
  10. package/dist/src/lib/commandments.d.ts +1 -0
  11. package/dist/src/lib/commandments.js +23 -0
  12. package/dist/src/lib/commandments.js.map +1 -0
  13. package/dist/src/lib/constants.d.ts +3 -1
  14. package/dist/src/lib/constants.js +5 -1
  15. package/dist/src/lib/constants.js.map +1 -1
  16. package/dist/src/lib/version.d.ts +1 -1
  17. package/dist/src/lib/version.js +1 -1
  18. package/dist/src/lib/version.js.map +1 -1
  19. package/dist/src/mcp.d.ts +0 -2
  20. package/dist/src/mcp.js +0 -1
  21. package/dist/src/mcp.js.map +1 -1
  22. package/dist/src/run.d.ts +0 -2
  23. package/dist/src/run.js +0 -1
  24. package/dist/src/run.js.map +1 -1
  25. package/dist/src/steps/add-mcp-server-to-clients/MCPClient.d.ts +4 -5
  26. package/dist/src/steps/add-mcp-server-to-clients/MCPClient.js +6 -6
  27. package/dist/src/steps/add-mcp-server-to-clients/MCPClient.js.map +1 -1
  28. package/dist/src/steps/add-mcp-server-to-clients/__tests__/defaults.test.js +1 -21
  29. package/dist/src/steps/add-mcp-server-to-clients/__tests__/defaults.test.js.map +1 -1
  30. package/dist/src/steps/add-mcp-server-to-clients/clients/__tests__/claude.test.js +2 -7
  31. package/dist/src/steps/add-mcp-server-to-clients/clients/__tests__/claude.test.js.map +1 -1
  32. package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.d.ts +1 -2
  33. package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.js +2 -2
  34. package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.js.map +1 -1
  35. package/dist/src/steps/add-mcp-server-to-clients/clients/codex.d.ts +1 -2
  36. package/dist/src/steps/add-mcp-server-to-clients/clients/codex.js +2 -2
  37. package/dist/src/steps/add-mcp-server-to-clients/clients/codex.js.map +1 -1
  38. package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.d.ts +2 -3
  39. package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.js +4 -4
  40. package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.js.map +1 -1
  41. package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.d.ts +2 -3
  42. package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.js +4 -4
  43. package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.js.map +1 -1
  44. package/dist/src/steps/add-mcp-server-to-clients/clients/zed.d.ts +2 -3
  45. package/dist/src/steps/add-mcp-server-to-clients/clients/zed.js +4 -4
  46. package/dist/src/steps/add-mcp-server-to-clients/clients/zed.js.map +1 -1
  47. package/dist/src/steps/add-mcp-server-to-clients/defaults.d.ts +3 -4
  48. package/dist/src/steps/add-mcp-server-to-clients/defaults.js +6 -13
  49. package/dist/src/steps/add-mcp-server-to-clients/defaults.js.map +1 -1
  50. package/dist/src/steps/add-mcp-server-to-clients/index.d.ts +2 -4
  51. package/dist/src/steps/add-mcp-server-to-clients/index.js +4 -5
  52. package/dist/src/steps/add-mcp-server-to-clients/index.js.map +1 -1
  53. package/dist/src/utils/clack-utils.d.ts +2 -4
  54. package/dist/src/utils/clack-utils.js +18 -41
  55. package/dist/src/utils/clack-utils.js.map +1 -1
  56. package/dist/src/utils/oauth.d.ts +0 -2
  57. package/dist/src/utils/oauth.js +9 -11
  58. package/dist/src/utils/oauth.js.map +1 -1
  59. package/dist/src/utils/types.d.ts +0 -4
  60. package/dist/src/utils/types.js.map +1 -1
  61. package/dist/src/utils/urls.d.ts +1 -1
  62. package/dist/src/utils/urls.js +22 -9
  63. package/dist/src/utils/urls.js.map +1 -1
  64. package/package.json +3 -3
@@ -90,7 +90,6 @@ async function runAgentWizard(config, options) {
90
90
  if (!statusOk) {
91
91
  await (0, clack_utils_1.abort)(`Please try again later, or set up ${config.metadata.name} manually: ${config.metadata.docsUrl}`, 0);
92
92
  }
93
- const cloudRegion = options.cloudRegion ?? (await (0, clack_utils_1.askForCloudRegion)());
94
93
  const typeScriptDetected = (0, clack_utils_1.isUsingTypeScript)(options);
95
94
  await (0, clack_utils_1.confirmContinueIfNoOrDirtyGitRepo)(options);
96
95
  // Framework detection and version
@@ -117,10 +116,7 @@ async function runAgentWizard(config, options) {
117
116
  integration: config.metadata.integration,
118
117
  });
119
118
  // Get PostHog credentials
120
- const { projectApiKey, host, accessToken, projectId } = await (0, clack_utils_1.getOrAskForProjectData)({
121
- ...options,
122
- cloudRegion,
123
- });
119
+ const { projectApiKey, host, accessToken, projectId, cloudRegion } = await (0, clack_utils_1.getOrAskForProjectData)(options);
124
120
  // Gather framework-specific context (e.g., Next.js router, React Native platform)
125
121
  const frameworkContext = config.metadata.gatherContext
126
122
  ? await config.metadata.gatherContext(options)
@@ -139,15 +135,9 @@ async function runAgentWizard(config, options) {
139
135
  }, frameworkContext);
140
136
  // Initialize and run agent
141
137
  const spinner = clack_1.default.spinner();
142
- // Determine MCP URL: CLI flag > env var > production default
143
- // Use EU subdomain for EU users to work around Claude Code's OAuth bug
144
- // See: https://github.com/anthropics/claude-code/issues/2267
145
138
  const mcpUrl = options.localMcp
146
139
  ? 'http://localhost:8787/mcp'
147
- : process.env.MCP_URL ||
148
- (cloudRegion === 'eu'
149
- ? 'https://mcp-eu.posthog.com/mcp'
150
- : 'https://mcp.posthog.com/mcp');
140
+ : process.env.MCP_URL || 'https://mcp.posthog.com/mcp';
151
141
  const agent = await (0, agent_interface_1.initializeAgent)({
152
142
  workingDirectory: options.installDir,
153
143
  posthogMcpUrl: mcpUrl,
@@ -235,7 +225,6 @@ Please report this error to: ${chalk_1.default.cyan('wizard@posthog.com')}`;
235
225
  }
236
226
  // Add MCP server to clients
237
227
  await (0, steps_1.addMCPServerToClientsStep)({
238
- cloudRegion,
239
228
  integration: config.metadata.integration,
240
229
  ci: options.ci,
241
230
  });
@@ -1 +1 @@
1
- {"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../../src/lib/agent-runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,wCA2TC;AAtWD,yDAK4B;AAE5B,sDAU8B;AAE9B,kDAA+C;AAC/C,2CAA4D;AAC5D,2DAAmC;AACnC,uDAK2B;AAC3B,wCAAsD;AACtD,kDAA0B;AAC1B,+CAAiC;AACjC,oCAGkB;AAClB,gEAA2E;AAC3E,0CAAiD;AACjD,sDAAiE;AAEjE;;;GAGG;AACI,KAAK,UAAU,cAAc,CAClC,MAAuB,EACvB,OAAsB;IAEtB,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,IAAA,uBAAe,GAAE,CAAC;IACpB,CAAC;IAED,gBAAgB;IAChB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,IAAI,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC;QAC5E,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACpE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACvC,IAAI,OAAO,IAAI,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;gBACnE,MAAM,OAAO,GACX,MAAM,CAAC,QAAQ,CAAC,yBAAyB,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;gBACvE,eAAK,CAAC,GAAG,CAAC,IAA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import {\n DEFAULT_PACKAGE_INSTALLATION,\n getWelcomeMessage,\n SPINNER_MESSAGE,\n type FrameworkConfig,\n} from './framework-config';\nimport type { WizardOptions } from '../utils/types';\nimport {\n abort,\n askForAIConsent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n isUsingTypeScript,\n printWelcome,\n askForCloudRegion,\n} from '../utils/clack-utils';\nimport type { PackageDotJson } from '../utils/package-json';\nimport { analytics } from '../utils/analytics';\nimport { WIZARD_INTERACTION_EVENT_NAME } from './constants';\nimport clack from '../utils/clack';\nimport {\n initializeAgent,\n runAgent,\n AgentSignals,\n AgentErrorType,\n} from './agent-interface';\nimport { getCloudUrlFromRegion } from '../utils/urls';\nimport chalk from 'chalk';\nimport * as semver from 'semver';\nimport {\n addMCPServerToClientsStep,\n uploadEnvironmentVariablesStep,\n} from '../steps';\nimport { checkAnthropicStatusWithPrompt } from '../utils/anthropic-status';\nimport { enableDebugLogs } from '../utils/debug';\nimport { createBenchmarkPipeline } from './middleware/benchmark';\n\n/**\n * Universal agent-powered wizard runner.\n * Handles the complete flow for any framework using PostHog MCP integration.\n */\nexport async function runAgentWizard(\n config: FrameworkConfig,\n options: WizardOptions,\n): Promise<void> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n // Version check\n if (config.detection.minimumVersion && config.detection.getInstalledVersion) {\n const version = await config.detection.getInstalledVersion(options);\n if (version) {\n const coerced = semver.coerce(version);\n if (coerced && semver.lt(coerced, config.detection.minimumVersion)) {\n const docsUrl =\n config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;\n clack.log.warn(\n `Sorry: the wizard can't help you with ${config.metadata.name} ${version}. Upgrade to ${config.metadata.name} ${config.detection.minimumVersion} or later, or check out the manual setup guide.`,\n );\n clack.log.info(\n `Setup ${config.metadata.name} manually: ${chalk.cyan(docsUrl)}`,\n );\n clack.outro('PostHog wizard will see you next time!');\n return;\n }\n }\n }\n\n // Setup phase\n printWelcome({ wizardName: getWelcomeMessage(config.metadata.name) });\n\n if (config.metadata.beta) {\n clack.log.info(\n `${chalk.yellow('[BETA]')} The ${\n config.metadata.name\n } wizard is in beta. Questions or feedback? Email ${chalk.cyan(\n 'wizard@posthog.com',\n )}`,\n );\n }\n\n if (config.metadata.preRunNotice) {\n clack.log.warn(config.metadata.preRunNotice);\n }\n\n clack.log.info(\n `We're about to read your project using our LLM gateway.\\n\\n.env* file contents will not leave your machine.\\n\\nOther files will be read and edited to provide a fully-custom PostHog integration.`,\n );\n\n const aiConsent = await askForAIConsent(options);\n if (!aiConsent) {\n await abort(\n `This wizard uses an LLM agent to intelligently modify your project. Please view the docs to set up ${config.metadata.name} manually instead: ${config.metadata.docsUrl}`,\n 0,\n );\n }\n\n // Check Anthropic/Claude service status before proceeding\n const statusOk = await checkAnthropicStatusWithPrompt({ ci: options.ci });\n if (!statusOk) {\n await abort(\n `Please try again later, or set up ${config.metadata.name} manually: ${config.metadata.docsUrl}`,\n 0,\n );\n }\n\n const cloudRegion = options.cloudRegion ?? (await askForCloudRegion());\n const typeScriptDetected = isUsingTypeScript(options);\n\n await confirmContinueIfNoOrDirtyGitRepo(options);\n\n // Framework detection and version\n // Only check package.json for Node.js/JavaScript frameworks\n const usesPackageJson = config.detection.usesPackageJson !== false;\n let packageJson: PackageDotJson | null = null;\n let frameworkVersion: string | undefined;\n\n if (usesPackageJson) {\n packageJson = await getPackageDotJson(options);\n await ensurePackageIsInstalled(\n packageJson,\n config.detection.packageName,\n config.detection.packageDisplayName,\n );\n frameworkVersion = config.detection.getVersion(packageJson);\n } else {\n // For non-Node frameworks (e.g., Django), version is handled differently\n frameworkVersion = config.detection.getVersion(null);\n }\n\n // Set analytics tags for framework version\n if (frameworkVersion && config.detection.getVersionBucket) {\n const versionBucket = config.detection.getVersionBucket(frameworkVersion);\n analytics.setTag(`${config.metadata.integration}-version`, versionBucket);\n }\n\n analytics.capture(WIZARD_INTERACTION_EVENT_NAME, {\n action: 'started agent integration',\n integration: config.metadata.integration,\n });\n\n // Get PostHog credentials\n const { projectApiKey, host, accessToken, projectId } =\n await getOrAskForProjectData({\n ...options,\n cloudRegion,\n });\n\n // Gather framework-specific context (e.g., Next.js router, React Native platform)\n const frameworkContext = config.metadata.gatherContext\n ? await config.metadata.gatherContext(options)\n : {};\n\n // Set analytics tags from framework context\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n const integrationPrompt = buildIntegrationPrompt(\n config,\n {\n frameworkVersion: frameworkVersion || 'latest',\n typescript: typeScriptDetected,\n projectApiKey,\n host,\n projectId,\n },\n frameworkContext,\n );\n\n // Initialize and run agent\n const spinner = clack.spinner();\n\n // Determine MCP URL: CLI flag > env var > production default\n // Use EU subdomain for EU users to work around Claude Code's OAuth bug\n // See: https://github.com/anthropics/claude-code/issues/2267\n const mcpUrl = options.localMcp\n ? 'http://localhost:8787/mcp'\n : process.env.MCP_URL ||\n (cloudRegion === 'eu'\n ? 'https://mcp-eu.posthog.com/mcp'\n : 'https://mcp.posthog.com/mcp');\n\n const agent = await initializeAgent(\n {\n workingDirectory: options.installDir,\n posthogMcpUrl: mcpUrl,\n posthogApiKey: accessToken,\n posthogApiHost: host,\n additionalMcpServers: config.metadata.additionalMcpServers,\n detectPackageManager: config.detection.detectPackageManager,\n },\n options,\n );\n\n const middleware = options.benchmark\n ? createBenchmarkPipeline(spinner, options)\n : undefined;\n\n const agentResult = await runAgent(\n agent,\n integrationPrompt,\n options,\n spinner,\n {\n estimatedDurationMinutes: config.ui.estimatedDurationMinutes,\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n },\n middleware,\n );\n\n // Handle error cases detected in agent output\n if (agentResult.error === AgentErrorType.MCP_MISSING) {\n analytics.captureException(\n new Error('Agent could not access PostHog MCP server'),\n {\n integration: config.metadata.integration,\n error_type: AgentErrorType.MCP_MISSING,\n signal: AgentSignals.ERROR_MCP_MISSING,\n },\n );\n\n const errorMessage = `\n${chalk.red('❌ Could not access the PostHog MCP server')}\n\nThe wizard was unable to connect to the PostHog MCP server.\nThis could be due to a network issue or a configuration problem.\n\nPlease try again, or set up ${\n config.metadata.name\n } manually by following our documentation:\n${chalk.cyan(config.metadata.docsUrl)}`;\n\n clack.outro(errorMessage);\n await analytics.shutdown('error');\n process.exit(1);\n }\n\n if (agentResult.error === AgentErrorType.RESOURCE_MISSING) {\n analytics.captureException(\n new Error('Agent could not access setup resource'),\n {\n integration: config.metadata.integration,\n error_type: AgentErrorType.RESOURCE_MISSING,\n signal: AgentSignals.ERROR_RESOURCE_MISSING,\n },\n );\n\n const errorMessage = `\n${chalk.red('❌ Could not access the setup resource')}\n\nThe wizard could not access the setup resource. This may indicate a version mismatch or a temporary service issue.\n\nPlease try again, or set up ${\n config.metadata.name\n } manually by following our documentation:\n${chalk.cyan(config.metadata.docsUrl)}`;\n\n clack.outro(errorMessage);\n await analytics.shutdown('error');\n process.exit(1);\n }\n\n if (\n agentResult.error === AgentErrorType.RATE_LIMIT ||\n agentResult.error === AgentErrorType.API_ERROR\n ) {\n analytics.capture(WIZARD_INTERACTION_EVENT_NAME, {\n action: 'api error',\n integration: config.metadata.integration,\n error_type: agentResult.error,\n error_message: agentResult.message,\n });\n\n analytics.captureException(new Error(`API error: ${agentResult.message}`), {\n integration: config.metadata.integration,\n error_type: agentResult.error,\n });\n\n const errorMessage = `\n${chalk.red('❌ API Error')}\n\n${chalk.yellow(agentResult.message || 'Unknown error')}\n\nPlease report this error to: ${chalk.cyan('wizard@posthog.com')}`;\n\n clack.outro(errorMessage);\n await analytics.shutdown('error');\n process.exit(1);\n }\n\n // Build environment variables from OAuth credentials\n const envVars = config.environment.getEnvVars(projectApiKey, host);\n\n // Upload environment variables to hosting providers (if configured)\n let uploadedEnvVars: string[] = [];\n if (config.environment.uploadToHosting) {\n uploadedEnvVars = await uploadEnvironmentVariablesStep(envVars, {\n integration: config.metadata.integration,\n options,\n });\n }\n\n // Add MCP server to clients\n await addMCPServerToClientsStep({\n cloudRegion,\n integration: config.metadata.integration,\n ci: options.ci,\n });\n\n // Build outro message\n const continueUrl = options.signup\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 uploadedEnvVars.length > 0\n ? `Uploaded environment variables to your hosting provider`\n : '',\n ].filter(Boolean);\n\n const nextSteps = [\n ...config.ui.getOutroNextSteps(frameworkContext),\n uploadedEnvVars.length === 0 && config.environment.uploadToHosting\n ? `Upload your Project API key to your hosting provider`\n : '',\n ].filter(Boolean);\n\n const outroMessage = `\n${chalk.green('Successfully installed PostHog!')}\n\n${chalk.cyan('What the agent did:')}\n${changes.map((change) => `• ${change}`).join('\\n')}\n\n${chalk.yellow('Next steps:')}\n${nextSteps.map((step) => `• ${step}`).join('\\n')}\n\nLearn more: ${chalk.cyan(config.metadata.docsUrl)}\n${continueUrl ? `\\nContinue onboarding: ${chalk.cyan(continueUrl)}\\n` : ``}\n${chalk.dim(\n 'Note: This wizard uses an LLM agent to analyze and modify your project. Please review the changes made.',\n)}\n\n${chalk.dim(`How did this work for you? Drop us a line: wizard@posthog.com`)}`;\n\n clack.outro(outroMessage);\n\n await analytics.shutdown('success');\n}\n\n/**\n * Build the integration prompt for the agent.\n */\nfunction buildIntegrationPrompt(\n config: FrameworkConfig,\n context: {\n frameworkVersion: string;\n typescript: boolean;\n projectApiKey: string;\n host: string;\n projectId: number;\n },\n frameworkContext: Record<string, unknown>,\n): string {\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\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: ${context.projectId}\n- Framework: ${config.metadata.name} ${context.frameworkVersion}\n- TypeScript: ${context.typescript ? 'Yes' : 'No'}\n- PostHog API Key: ${context.projectApiKey}\n- PostHog Host: ${context.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: List available skills from the PostHog MCP server using ListMcpResourcesTool. If this tool is not available or you cannot access the MCP server, you must emit: ${\n AgentSignals.ERROR_MCP_MISSING\n } Could not access the PostHog MCP server and halt.\n\n Review the skill descriptions and choose the one that best matches this project's framework and configuration.\n If no suitable skill is found, or you cannot access the MCP server, you emit: ${\n AgentSignals.ERROR_RESOURCE_MISSING\n } Could not find a suitable skill for this project.\n\nSTEP 2: Fetch the chosen skill resource (e.g., posthog://skills/{skill-id}).\n The resource returns a shell command to install the skill.\n\nSTEP 3: Run the installation command using Bash:\n - Execute the EXACT command returned by the resource (do not modify it)\n - This will download and extract the skill to .claude/skills/{skill-id}/\n\nSTEP 4: Load the installed skill's SKILL.md file to understand what references are available.\n\nSTEP 5: 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 keys directly to code files; always use environment variables.\n\nSTEP 6: 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 API key and host, using the appropriate naming convention for ${\n config.metadata.name\n }. 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 API key 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"]}
1
+ {"version":3,"file":"agent-runner.js","sourceRoot":"","sources":["../../../src/lib/agent-runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,wCAgTC;AA1VD,yDAK4B;AAE5B,sDAS8B;AAE9B,kDAA+C;AAC/C,2CAA4D;AAC5D,2DAAmC;AACnC,uDAK2B;AAC3B,wCAAsD;AACtD,kDAA0B;AAC1B,+CAAiC;AACjC,oCAGkB;AAClB,gEAA2E;AAC3E,0CAAiD;AACjD,sDAAiE;AAEjE;;;GAGG;AACI,KAAK,UAAU,cAAc,CAClC,MAAuB,EACvB,OAAsB;IAEtB,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,IAAA,uBAAe,GAAE,CAAC;IACpB,CAAC;IAED,gBAAgB;IAChB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,IAAI,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC;QAC5E,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACpE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACvC,IAAI,OAAO,IAAI,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;gBACnE,MAAM,OAAO,GACX,MAAM,CAAC,QAAQ,CAAC,yBAAyB,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;gBACvE,eAAK,CAAC,GAAG,CAAC,IAAI,CACZ,yCAAyC,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO,gBAAgB,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI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C,OAAO,CAAC,yBAAyB;QAC9D,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;QAC5D,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,iBAAiB,GACrB,eAAe,CAAC,MAAM,GAAG,CAAC;QACxB,CAAC,CAAC,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9D,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,kGACL,MAAM,CAAC,QAAQ,CAAC,IAClB;;;wBAGsB,OAAO,CAAC,SAAS;eAC1B,MAAM,CAAC,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,gBAAgB;gBAC/C,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;qBAC5B,OAAO,CAAC,aAAa;kBACxB,OAAO,CAAC,IAAI;kBACZ,MAAM,CAAC,OAAO,CAAC,oBAAoB;0BAEjD,MAAM,CAAC,OAAO,CAAC,mBAAmB,IAAI,+CACxC,GAAG,iBAAiB;;;;0KAKlB,8BAAY,CAAC,iBACf;;;mFAIG,8BAAY,CAAC,sBACf;;;;;;;;;;;;;;;wHAgBE,MAAM,CAAC,QAAQ,CAAC,IAClB;;;;;CAKF,CAAC;AACF,CAAC","sourcesContent":["import {\n DEFAULT_PACKAGE_INSTALLATION,\n getWelcomeMessage,\n SPINNER_MESSAGE,\n type FrameworkConfig,\n} from './framework-config';\nimport type { WizardOptions } from '../utils/types';\nimport {\n abort,\n askForAIConsent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n isUsingTypeScript,\n printWelcome,\n} from '../utils/clack-utils';\nimport type { PackageDotJson } from '../utils/package-json';\nimport { analytics } from '../utils/analytics';\nimport { WIZARD_INTERACTION_EVENT_NAME } from './constants';\nimport clack from '../utils/clack';\nimport {\n initializeAgent,\n runAgent,\n AgentSignals,\n AgentErrorType,\n} from './agent-interface';\nimport { getCloudUrlFromRegion } from '../utils/urls';\nimport chalk from 'chalk';\nimport * as semver from 'semver';\nimport {\n addMCPServerToClientsStep,\n uploadEnvironmentVariablesStep,\n} from '../steps';\nimport { checkAnthropicStatusWithPrompt } from '../utils/anthropic-status';\nimport { enableDebugLogs } from '../utils/debug';\nimport { createBenchmarkPipeline } from './middleware/benchmark';\n\n/**\n * Universal agent-powered wizard runner.\n * Handles the complete flow for any framework using PostHog MCP integration.\n */\nexport async function runAgentWizard(\n config: FrameworkConfig,\n options: WizardOptions,\n): Promise<void> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n // Version check\n if (config.detection.minimumVersion && config.detection.getInstalledVersion) {\n const version = await config.detection.getInstalledVersion(options);\n if (version) {\n const coerced = semver.coerce(version);\n if (coerced && semver.lt(coerced, config.detection.minimumVersion)) {\n const docsUrl =\n config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;\n clack.log.warn(\n `Sorry: the wizard can't help you with ${config.metadata.name} ${version}. Upgrade to ${config.metadata.name} ${config.detection.minimumVersion} or later, or check out the manual setup guide.`,\n );\n clack.log.info(\n `Setup ${config.metadata.name} manually: ${chalk.cyan(docsUrl)}`,\n );\n clack.outro('PostHog wizard will see you next time!');\n return;\n }\n }\n }\n\n // Setup phase\n printWelcome({ wizardName: getWelcomeMessage(config.metadata.name) });\n\n if (config.metadata.beta) {\n clack.log.info(\n `${chalk.yellow('[BETA]')} The ${\n config.metadata.name\n } wizard is in beta. Questions or feedback? Email ${chalk.cyan(\n 'wizard@posthog.com',\n )}`,\n );\n }\n\n if (config.metadata.preRunNotice) {\n clack.log.warn(config.metadata.preRunNotice);\n }\n\n clack.log.info(\n `We're about to read your project using our LLM gateway.\\n\\n.env* file contents will not leave your machine.\\n\\nOther files will be read and edited to provide a fully-custom PostHog integration.`,\n );\n\n const aiConsent = await askForAIConsent(options);\n if (!aiConsent) {\n await abort(\n `This wizard uses an LLM agent to intelligently modify your project. Please view the docs to set up ${config.metadata.name} manually instead: ${config.metadata.docsUrl}`,\n 0,\n );\n }\n\n // Check Anthropic/Claude service status before proceeding\n const statusOk = await checkAnthropicStatusWithPrompt({ ci: options.ci });\n if (!statusOk) {\n await abort(\n `Please try again later, or set up ${config.metadata.name} manually: ${config.metadata.docsUrl}`,\n 0,\n );\n }\n\n const typeScriptDetected = isUsingTypeScript(options);\n\n await confirmContinueIfNoOrDirtyGitRepo(options);\n\n // Framework detection and version\n // Only check package.json for Node.js/JavaScript frameworks\n const usesPackageJson = config.detection.usesPackageJson !== false;\n let packageJson: PackageDotJson | null = null;\n let frameworkVersion: string | undefined;\n\n if (usesPackageJson) {\n packageJson = await getPackageDotJson(options);\n await ensurePackageIsInstalled(\n packageJson,\n config.detection.packageName,\n config.detection.packageDisplayName,\n );\n frameworkVersion = config.detection.getVersion(packageJson);\n } else {\n // For non-Node frameworks (e.g., Django), version is handled differently\n frameworkVersion = config.detection.getVersion(null);\n }\n\n // Set analytics tags for framework version\n if (frameworkVersion && config.detection.getVersionBucket) {\n const versionBucket = config.detection.getVersionBucket(frameworkVersion);\n analytics.setTag(`${config.metadata.integration}-version`, versionBucket);\n }\n\n analytics.capture(WIZARD_INTERACTION_EVENT_NAME, {\n action: 'started agent integration',\n integration: config.metadata.integration,\n });\n\n // Get PostHog credentials\n const { projectApiKey, host, accessToken, projectId, cloudRegion } =\n await getOrAskForProjectData(options);\n\n // Gather framework-specific context (e.g., Next.js router, React Native platform)\n const frameworkContext = config.metadata.gatherContext\n ? await config.metadata.gatherContext(options)\n : {};\n\n // Set analytics tags from framework context\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n const integrationPrompt = buildIntegrationPrompt(\n config,\n {\n frameworkVersion: frameworkVersion || 'latest',\n typescript: typeScriptDetected,\n projectApiKey,\n host,\n projectId,\n },\n frameworkContext,\n );\n\n // Initialize and run agent\n const spinner = clack.spinner();\n\n const mcpUrl = options.localMcp\n ? 'http://localhost:8787/mcp'\n : process.env.MCP_URL || 'https://mcp.posthog.com/mcp';\n\n const agent = await initializeAgent(\n {\n workingDirectory: options.installDir,\n posthogMcpUrl: mcpUrl,\n posthogApiKey: accessToken,\n posthogApiHost: host,\n additionalMcpServers: config.metadata.additionalMcpServers,\n detectPackageManager: config.detection.detectPackageManager,\n },\n options,\n );\n\n const middleware = options.benchmark\n ? createBenchmarkPipeline(spinner, options)\n : undefined;\n\n const agentResult = await runAgent(\n agent,\n integrationPrompt,\n options,\n spinner,\n {\n estimatedDurationMinutes: config.ui.estimatedDurationMinutes,\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n },\n middleware,\n );\n\n // Handle error cases detected in agent output\n if (agentResult.error === AgentErrorType.MCP_MISSING) {\n analytics.captureException(\n new Error('Agent could not access PostHog MCP server'),\n {\n integration: config.metadata.integration,\n error_type: AgentErrorType.MCP_MISSING,\n signal: AgentSignals.ERROR_MCP_MISSING,\n },\n );\n\n const errorMessage = `\n${chalk.red('❌ Could not access the PostHog MCP server')}\n\nThe wizard was unable to connect to the PostHog MCP server.\nThis could be due to a network issue or a configuration problem.\n\nPlease try again, or set up ${\n config.metadata.name\n } manually by following our documentation:\n${chalk.cyan(config.metadata.docsUrl)}`;\n\n clack.outro(errorMessage);\n await analytics.shutdown('error');\n process.exit(1);\n }\n\n if (agentResult.error === AgentErrorType.RESOURCE_MISSING) {\n analytics.captureException(\n new Error('Agent could not access setup resource'),\n {\n integration: config.metadata.integration,\n error_type: AgentErrorType.RESOURCE_MISSING,\n signal: AgentSignals.ERROR_RESOURCE_MISSING,\n },\n );\n\n const errorMessage = `\n${chalk.red('❌ Could not access the setup resource')}\n\nThe wizard could not access the setup resource. This may indicate a version mismatch or a temporary service issue.\n\nPlease try again, or set up ${\n config.metadata.name\n } manually by following our documentation:\n${chalk.cyan(config.metadata.docsUrl)}`;\n\n clack.outro(errorMessage);\n await analytics.shutdown('error');\n process.exit(1);\n }\n\n if (\n agentResult.error === AgentErrorType.RATE_LIMIT ||\n agentResult.error === AgentErrorType.API_ERROR\n ) {\n analytics.capture(WIZARD_INTERACTION_EVENT_NAME, {\n action: 'api error',\n integration: config.metadata.integration,\n error_type: agentResult.error,\n error_message: agentResult.message,\n });\n\n analytics.captureException(new Error(`API error: ${agentResult.message}`), {\n integration: config.metadata.integration,\n error_type: agentResult.error,\n });\n\n const errorMessage = `\n${chalk.red('❌ API Error')}\n\n${chalk.yellow(agentResult.message || 'Unknown error')}\n\nPlease report this error to: ${chalk.cyan('wizard@posthog.com')}`;\n\n clack.outro(errorMessage);\n await analytics.shutdown('error');\n process.exit(1);\n }\n\n // Build environment variables from OAuth credentials\n const envVars = config.environment.getEnvVars(projectApiKey, host);\n\n // Upload environment variables to hosting providers (if configured)\n let uploadedEnvVars: string[] = [];\n if (config.environment.uploadToHosting) {\n uploadedEnvVars = await uploadEnvironmentVariablesStep(envVars, {\n integration: config.metadata.integration,\n options,\n });\n }\n\n // Add MCP server to clients\n await addMCPServerToClientsStep({\n integration: config.metadata.integration,\n ci: options.ci,\n });\n\n // Build outro message\n const continueUrl = options.signup\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 uploadedEnvVars.length > 0\n ? `Uploaded environment variables to your hosting provider`\n : '',\n ].filter(Boolean);\n\n const nextSteps = [\n ...config.ui.getOutroNextSteps(frameworkContext),\n uploadedEnvVars.length === 0 && config.environment.uploadToHosting\n ? `Upload your Project API key to your hosting provider`\n : '',\n ].filter(Boolean);\n\n const outroMessage = `\n${chalk.green('Successfully installed PostHog!')}\n\n${chalk.cyan('What the agent did:')}\n${changes.map((change) => `• ${change}`).join('\\n')}\n\n${chalk.yellow('Next steps:')}\n${nextSteps.map((step) => `• ${step}`).join('\\n')}\n\nLearn more: ${chalk.cyan(config.metadata.docsUrl)}\n${continueUrl ? `\\nContinue onboarding: ${chalk.cyan(continueUrl)}\\n` : ``}\n${chalk.dim(\n 'Note: This wizard uses an LLM agent to analyze and modify your project. Please review the changes made.',\n)}\n\n${chalk.dim(`How did this work for you? Drop us a line: wizard@posthog.com`)}`;\n\n clack.outro(outroMessage);\n\n await analytics.shutdown('success');\n}\n\n/**\n * Build the integration prompt for the agent.\n */\nfunction buildIntegrationPrompt(\n config: FrameworkConfig,\n context: {\n frameworkVersion: string;\n typescript: boolean;\n projectApiKey: string;\n host: string;\n projectId: number;\n },\n frameworkContext: Record<string, unknown>,\n): string {\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\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: ${context.projectId}\n- Framework: ${config.metadata.name} ${context.frameworkVersion}\n- TypeScript: ${context.typescript ? 'Yes' : 'No'}\n- PostHog API Key: ${context.projectApiKey}\n- PostHog Host: ${context.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: List available skills from the PostHog MCP server using ListMcpResourcesTool. If this tool is not available or you cannot access the MCP server, you must emit: ${\n AgentSignals.ERROR_MCP_MISSING\n } Could not access the PostHog MCP server and halt.\n\n Review the skill descriptions and choose the one that best matches this project's framework and configuration.\n If no suitable skill is found, or you cannot access the MCP server, you emit: ${\n AgentSignals.ERROR_RESOURCE_MISSING\n } Could not find a suitable skill for this project.\n\nSTEP 2: Fetch the chosen skill resource (e.g., posthog://skills/{skill-id}).\n The resource returns a shell command to install the skill.\n\nSTEP 3: Run the installation command using Bash:\n - Execute the EXACT command returned by the resource (do not modify it)\n - This will download and extract the skill to .claude/skills/{skill-id}/\n\nSTEP 4: Load the installed skill's SKILL.md file to understand what references are available.\n\nSTEP 5: 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 keys directly to code files; always use environment variables.\n\nSTEP 6: 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 API key and host, using the appropriate naming convention for ${\n config.metadata.name\n }. 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 API key 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"]}
@@ -0,0 +1 @@
1
+ export declare function getWizardCommandments(): string;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWizardCommandments = getWizardCommandments;
4
+ /**
5
+ * Wizard-wide commandments that are always appended as a system prompt.
6
+ *
7
+ * Keep this as a simple string so it can be inlined into the compiled bundle
8
+ * without extra files, copying, or runtime I/O.
9
+ */
10
+ const WIZARD_COMMANDMENTS = [
11
+ 'Never hallucinate a PostHog API key, host, or any other secret. Always use the real values that have been configured for this project (for example via environment variables).',
12
+ 'Never write API keys, access tokens, or other secrets directly into source code. Always reference environment variables instead, and rely on the wizard-tools MCP server (check_env_keys / set_env_values) to create or update .env files.',
13
+ 'Always use the detect_package_manager tool from the wizard-tools MCP server to determine the package manager. Do not guess based on lockfiles or hard-code npm, yarn, pnpm, bun, pip, etc.',
14
+ 'When installing packages, start the installation as a background task and then continue with other work. Do not block waiting for installs to finish unless explicitly instructed.',
15
+ 'Before writing to any file, you MUST read that exact file immediately beforehand using the Read tool, even if you have already read it earlier in the run. This avoids tool failures and stale edits.',
16
+ 'Treat feature flags, custom properties, and event names as part of an analytics contract. Prefer reusing existing names and patterns in the project. When you must introduce new ones, make them clear, descriptive, and consistent with existing conventions, and avoid scattering the same flag or property across many unrelated callsites.',
17
+ 'Prefer minimal, targeted edits that achieve the requested behavior while preserving existing structure and style. Avoid large refactors, broad reformatting, or unrelated changes unless explicitly requested.',
18
+ 'Do not spawn subagents unless explicitly instructed to do so.',
19
+ ].join('\n');
20
+ function getWizardCommandments() {
21
+ return WIZARD_COMMANDMENTS;
22
+ }
23
+ //# sourceMappingURL=commandments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandments.js","sourceRoot":"","sources":["../../../src/lib/commandments.ts"],"names":[],"mappings":";;AAwBA,sDAEC;AA1BD;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG;IAC1B,gLAAgL;IAEhL,4OAA4O;IAE5O,4LAA4L;IAE5L,oLAAoL;IAEpL,uMAAuM;IAEvM,gVAAgV;IAEhV,gNAAgN;IAEhN,+DAA+D;CAChE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,SAAgB,qBAAqB;IACnC,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["/**\n * Wizard-wide commandments that are always appended as a system prompt.\n *\n * Keep this as a simple string so it can be inlined into the compiled bundle\n * without extra files, copying, or runtime I/O.\n */\nconst WIZARD_COMMANDMENTS = [\n 'Never hallucinate a PostHog API key, host, or any other secret. Always use the real values that have been configured for this project (for example via environment variables).',\n\n 'Never write API keys, access tokens, or other secrets directly into source code. Always reference environment variables instead, and rely on the wizard-tools MCP server (check_env_keys / set_env_values) to create or update .env files.',\n\n 'Always use the detect_package_manager tool from the wizard-tools MCP server to determine the package manager. Do not guess based on lockfiles or hard-code npm, yarn, pnpm, bun, pip, etc.',\n\n 'When installing packages, start the installation as a background task and then continue with other work. Do not block waiting for installs to finish unless explicitly instructed.',\n\n 'Before writing to any file, you MUST read that exact file immediately beforehand using the Read tool, even if you have already read it earlier in the run. This avoids tool failures and stale edits.',\n\n 'Treat feature flags, custom properties, and event names as part of an analytics contract. Prefer reusing existing names and patterns in the project. When you must introduce new ones, make them clear, descriptive, and consistent with existing conventions, and avoid scattering the same flag or property across many unrelated callsites.',\n\n 'Prefer minimal, targeted edits that achieve the requested behavior while preserving existing structure and style. Avoid large refactors, broad reformatting, or unrelated changes unless explicitly requested.',\n\n 'Do not spawn subagents unless explicitly instructed to do so.',\n].join('\\n');\n\nexport function getWizardCommandments(): string {\n return WIZARD_COMMANDMENTS;\n}\n"]}
@@ -40,7 +40,9 @@ export declare const DUMMY_PROJECT_API_KEY = "_YOUR_POSTHOG_PROJECT_API_KEY_";
40
40
  export declare const POSTHOG_US_CLIENT_ID = "c4Rdw8DIxgtQfA80IiSnGKlNX8QN00cFWF00QQhM";
41
41
  export declare const POSTHOG_EU_CLIENT_ID = "bx2C5sZRN03TkdjraCcetvQFPGH6N2Y9vRLkcKEy";
42
42
  export declare const POSTHOG_DEV_CLIENT_ID = "DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ";
43
+ export declare const POSTHOG_PROXY_CLIENT_ID = "c4Rdw8DIxgtQfA80IiSnGKlNX8QN00cFWF00QQhM";
44
+ export declare const POSTHOG_OAUTH_URL: string;
43
45
  export declare const OAUTH_PORT = 8239;
44
46
  export declare const WIZARD_INTERACTION_EVENT_NAME = "wizard interaction";
45
47
  export declare const WIZARD_REMARK_EVENT_NAME = "wizard remark";
46
- export declare const WIZARD_USER_AGENT = "posthog/wizard; version: 1.35.2";
48
+ export declare const WIZARD_USER_AGENT = "posthog/wizard; version: 1.36.1";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WIZARD_USER_AGENT = exports.WIZARD_REMARK_EVENT_NAME = exports.WIZARD_INTERACTION_EVENT_NAME = exports.OAUTH_PORT = exports.POSTHOG_DEV_CLIENT_ID = exports.POSTHOG_EU_CLIENT_ID = exports.POSTHOG_US_CLIENT_ID = exports.DUMMY_PROJECT_API_KEY = exports.ANALYTICS_TEAM_TAG = exports.ANALYTICS_HOST_URL = exports.ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = exports.DEFAULT_HOST_URL = exports.ISSUES_URL = exports.DEFAULT_URL = exports.DEBUG = exports.IS_DEV = exports.Integration = void 0;
3
+ exports.WIZARD_USER_AGENT = exports.WIZARD_REMARK_EVENT_NAME = exports.WIZARD_INTERACTION_EVENT_NAME = exports.OAUTH_PORT = exports.POSTHOG_OAUTH_URL = exports.POSTHOG_PROXY_CLIENT_ID = exports.POSTHOG_DEV_CLIENT_ID = exports.POSTHOG_EU_CLIENT_ID = exports.POSTHOG_US_CLIENT_ID = exports.DUMMY_PROJECT_API_KEY = exports.ANALYTICS_TEAM_TAG = exports.ANALYTICS_HOST_URL = exports.ANALYTICS_POSTHOG_PUBLIC_PROJECT_WRITE_KEY = exports.DEFAULT_HOST_URL = exports.ISSUES_URL = exports.DEFAULT_URL = exports.DEBUG = exports.IS_DEV = exports.Integration = void 0;
4
4
  /**
5
5
  * Detection order matters: put framework-specific integrations BEFORE basic language fallbacks
6
6
  */
@@ -46,6 +46,10 @@ exports.DUMMY_PROJECT_API_KEY = '_YOUR_POSTHOG_PROJECT_API_KEY_';
46
46
  exports.POSTHOG_US_CLIENT_ID = 'c4Rdw8DIxgtQfA80IiSnGKlNX8QN00cFWF00QQhM';
47
47
  exports.POSTHOG_EU_CLIENT_ID = 'bx2C5sZRN03TkdjraCcetvQFPGH6N2Y9vRLkcKEy';
48
48
  exports.POSTHOG_DEV_CLIENT_ID = 'DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ';
49
+ exports.POSTHOG_PROXY_CLIENT_ID = exports.POSTHOG_US_CLIENT_ID;
50
+ exports.POSTHOG_OAUTH_URL = exports.IS_DEV
51
+ ? 'http://localhost:8010'
52
+ : 'https://oauth.posthog.com';
49
53
  exports.OAUTH_PORT = 8239;
50
54
  exports.WIZARD_INTERACTION_EVENT_NAME = 'wizard interaction';
51
55
  exports.WIZARD_REMARK_EVENT_NAME = 'wizard remark';
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WAyBX;AAzBD,WAAY,WAAW;IACrB,aAAa;IACb,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,0BAAW,CAAA;IACX,2CAA4B,CAAA;IAC5B,+CAAgC,CAAA;IAChC,iDAAkC,CAAA;IAClC,2CAA4B,CAAA;IAC5B,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;IACvB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IAEf,qBAAqB;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,iDAAkC,CAAA;IAClC,gDAAiC,CAAA;AACnC,CAAC,EAzBW,WAAW,2BAAX,WAAW,QAyBtB;AAMY,QAAA,MAAM,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,QAAQ,CACpD,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAC3B,CAAC;AAEW,QAAA,KAAK,GAAG,KAAK,CAAC;AAEd,QAAA,WAAW,GAAG,cAAM;IAC/B,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,wBAAwB,CAAC;AAChB,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,gBAAgB,GAAG,cAAM;IACpC,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,0BAA0B,CAAC;AAClB,QAAA,0CAA0C,GAAG,gBAAgB,CAAC;AAC9D,QAAA,kBAAkB,GAAG,gCAAgC,CAAC;AACtD,QAAA,kBAAkB,GAAG,iBAAiB,CAAC;AACvC,QAAA,qBAAqB,GAAG,gCAAgC,CAAC;AAEzD,QAAA,oBAAoB,GAAG,0CAA0C,CAAC;AAClE,QAAA,oBAAoB,GAAG,0CAA0C,CAAC;AAClE,QAAA,qBAAqB,GAAG,0CAA0C,CAAC;AACnE,QAAA,UAAU,GAAG,IAAI,CAAC;AAElB,QAAA,6BAA6B,GAAG,oBAAoB,CAAC;AACrD,QAAA,wBAAwB,GAAG,eAAe,CAAC;AAExD,uCAAoC;AACvB,QAAA,iBAAiB,GAAG,4BAA4B,iBAAO,EAAE,CAAC","sourcesContent":["/**\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}\nexport interface Args {\n debug: boolean;\n integration: Integration;\n}\n\nexport const IS_DEV = ['test', 'development'].includes(\n process.env.NODE_ENV ?? '',\n);\n\nexport const DEBUG = false;\n\nexport const DEFAULT_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.posthog.com';\nexport const ISSUES_URL = 'https://github.com/posthog/wizard/issues';\nexport const DEFAULT_HOST_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.i.posthog.com';\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';\nexport const DUMMY_PROJECT_API_KEY = '_YOUR_POSTHOG_PROJECT_API_KEY_';\n\nexport const POSTHOG_US_CLIENT_ID = 'c4Rdw8DIxgtQfA80IiSnGKlNX8QN00cFWF00QQhM';\nexport const POSTHOG_EU_CLIENT_ID = 'bx2C5sZRN03TkdjraCcetvQFPGH6N2Y9vRLkcKEy';\nexport const POSTHOG_DEV_CLIENT_ID = 'DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ';\nexport const OAUTH_PORT = 8239;\n\nexport const WIZARD_INTERACTION_EVENT_NAME = 'wizard interaction';\nexport const WIZARD_REMARK_EVENT_NAME = 'wizard remark';\n\nimport { VERSION } from './version';\nexport const WIZARD_USER_AGENT = `posthog/wizard; version: ${VERSION}`;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WAyBX;AAzBD,WAAY,WAAW;IACrB,aAAa;IACb,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,0BAAW,CAAA;IACX,2CAA4B,CAAA;IAC5B,+CAAgC,CAAA;IAChC,iDAAkC,CAAA;IAClC,2CAA4B,CAAA;IAC5B,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,sCAAuB,CAAA;IACvB,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IAEf,qBAAqB;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,iDAAkC,CAAA;IAClC,gDAAiC,CAAA;AACnC,CAAC,EAzBW,WAAW,2BAAX,WAAW,QAyBtB;AAMY,QAAA,MAAM,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,QAAQ,CACpD,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAC3B,CAAC;AAEW,QAAA,KAAK,GAAG,KAAK,CAAC;AAEd,QAAA,WAAW,GAAG,cAAM;IAC/B,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,wBAAwB,CAAC;AAChB,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,gBAAgB,GAAG,cAAM;IACpC,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,0BAA0B,CAAC;AAClB,QAAA,0CAA0C,GAAG,gBAAgB,CAAC;AAC9D,QAAA,kBAAkB,GAAG,gCAAgC,CAAC;AACtD,QAAA,kBAAkB,GAAG,iBAAiB,CAAC;AACvC,QAAA,qBAAqB,GAAG,gCAAgC,CAAC;AAEzD,QAAA,oBAAoB,GAAG,0CAA0C,CAAC;AAClE,QAAA,oBAAoB,GAAG,0CAA0C,CAAC;AAClE,QAAA,qBAAqB,GAAG,0CAA0C,CAAC;AACnE,QAAA,uBAAuB,GAAG,4BAAoB,CAAC;AAC/C,QAAA,iBAAiB,GAAG,cAAM;IACrC,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,2BAA2B,CAAC;AACnB,QAAA,UAAU,GAAG,IAAI,CAAC;AAElB,QAAA,6BAA6B,GAAG,oBAAoB,CAAC;AACrD,QAAA,wBAAwB,GAAG,eAAe,CAAC;AAExD,uCAAoC;AACvB,QAAA,iBAAiB,GAAG,4BAA4B,iBAAO,EAAE,CAAC","sourcesContent":["/**\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}\nexport interface Args {\n debug: boolean;\n integration: Integration;\n}\n\nexport const IS_DEV = ['test', 'development'].includes(\n process.env.NODE_ENV ?? '',\n);\n\nexport const DEBUG = false;\n\nexport const DEFAULT_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.posthog.com';\nexport const ISSUES_URL = 'https://github.com/posthog/wizard/issues';\nexport const DEFAULT_HOST_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://us.i.posthog.com';\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';\nexport const DUMMY_PROJECT_API_KEY = '_YOUR_POSTHOG_PROJECT_API_KEY_';\n\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 POSTHOG_OAUTH_URL = IS_DEV\n ? 'http://localhost:8010'\n : 'https://oauth.posthog.com';\nexport const OAUTH_PORT = 8239;\n\nexport const WIZARD_INTERACTION_EVENT_NAME = 'wizard interaction';\nexport const WIZARD_REMARK_EVENT_NAME = 'wizard remark';\n\nimport { VERSION } from './version';\nexport const WIZARD_USER_AGENT = `posthog/wizard; version: ${VERSION}`;\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "1.35.2";
1
+ export declare const VERSION = "1.36.1";
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Auto-generated by scripts/generate-version.js — do not edit
5
- exports.VERSION = '1.35.2';
5
+ exports.VERSION = '1.36.1';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AACjD,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Auto-generated by scripts/generate-version.js — do not edit\nexport const VERSION = '1.35.2';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AACjD,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// Auto-generated by scripts/generate-version.js — do not edit\nexport const VERSION = '1.36.1';\n"]}
package/dist/src/mcp.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- import type { CloudRegion } from './utils/types';
2
1
  export declare const runMCPInstall: (options: {
3
2
  signup: boolean;
4
- region?: CloudRegion;
5
3
  local?: boolean;
6
4
  debug?: boolean;
7
5
  }) => Promise<void>;
package/dist/src/mcp.js CHANGED
@@ -14,7 +14,6 @@ const runMCPInstall = async (options) => {
14
14
  }
15
15
  clack_1.default.intro(chalk_1.default.bgGreenBright(`Installing the PostHog MCP server ${options.local && '(local)'}`));
16
16
  await (0, add_mcp_server_to_clients_1.addMCPServerToClientsStep)({
17
- cloudRegion: options.region,
18
17
  askPermission: false,
19
18
  local: options.local,
20
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/mcp.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,iFAG2C;AAC3C,0DAAkC;AAElC,yCAAgD;AAEzC,MAAM,aAAa,GAAG,KAAK,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AAE,CAAC,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,eAAK,CAAC,KAAK,CACT,GAAG,eAAK,CAAC,KAAK,CACZ,oEAAoE,CACrE,EAAE,CACJ,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB","sourcesContent":["import chalk from 'chalk';\nimport {\n addMCPServerToClientsStep,\n removeMCPServerFromClientsStep,\n} from './steps/add-mcp-server-to-clients';\nimport clack from './utils/clack';\nimport type { CloudRegion } from './utils/types';\nimport { enableDebugLogs } from './utils/debug';\n\nexport const runMCPInstall = async (options: {\n signup: boolean;\n region?: CloudRegion;\n local?: boolean;\n debug?: boolean;\n}) => {\n if (options.debug) {\n enableDebugLogs();\n }\n clack.intro(\n chalk.bgGreenBright(\n `Installing the PostHog MCP server ${options.local && '(local)'}`,\n ),\n );\n\n await addMCPServerToClientsStep({\n cloudRegion: options.region,\n askPermission: false,\n local: options.local,\n });\n\n clack.log.message(\n `${chalk.greenBright(\n 'You might need to restart your MCP clients to see the changes.',\n )}`,\n );\n\n clack.log.message(\n `You'll be prompted to log in to PostHog when you first use the MCP.`,\n );\n\n clack.log.message(`Get started with some prompts like:\n- What feature flags do I have active?\n- Add a new feature flag for our homepage redesign\n- What are my most common errors?`);\n\n clack.log.message(`Check out our MCP Server documentation:\n${chalk.blueBright(`https://posthog.com/docs/model-context-protocol`)}`);\n};\n\nexport const runMCPRemove = async (options?: { local?: boolean }) => {\n clack.intro(chalk.bgRed('Removing the PostHog MCP server'));\n const results = await removeMCPServerFromClientsStep({\n local: options?.local,\n });\n\n if (results.length === 0) {\n clack.outro(`No PostHog MCP servers found to remove.`);\n return;\n }\n\n clack.log.success(`PostHog MCP server removed from:`);\n results.map((c) => clack.log.message(`- ${c}`));\n clack.outro(\n `${chalk.green(\n 'You might need to restart your MCP clients to see the changes.\\n\\n',\n )}`,\n );\n};\n"]}
1
+ {"version":3,"file":"mcp.js","s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CAAC,GAAG,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAChD,eAAK,CAAC,KAAK,CACT,GAAG,eAAK,CAAC,KAAK,CACZ,oEAAoE,CACrE,EAAE,CACJ,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB","sourcesContent":["import chalk from 'chalk';\nimport {\n addMCPServerToClientsStep,\n removeMCPServerFromClientsStep,\n} from './steps/add-mcp-server-to-clients';\nimport clack from './utils/clack';\nimport { enableDebugLogs } from './utils/debug';\n\nexport const runMCPInstall = async (options: {\n signup: boolean;\n local?: boolean;\n debug?: boolean;\n}) => {\n if (options.debug) {\n enableDebugLogs();\n }\n clack.intro(\n chalk.bgGreenBright(\n `Installing the PostHog MCP server ${options.local && '(local)'}`,\n ),\n );\n\n await addMCPServerToClientsStep({\n askPermission: false,\n local: options.local,\n });\n\n clack.log.message(\n `${chalk.greenBright(\n 'You might need to restart your MCP clients to see the changes.',\n )}`,\n );\n\n clack.log.message(\n `You'll be prompted to log in to PostHog when you first use the MCP.`,\n );\n\n clack.log.message(`Get started with some prompts like:\n- What feature flags do I have active?\n- Add a new feature flag for our homepage redesign\n- What are my most common errors?`);\n\n clack.log.message(`Check out our MCP Server documentation:\n${chalk.blueBright(`https://posthog.com/docs/model-context-protocol`)}`);\n};\n\nexport const runMCPRemove = async (options?: { local?: boolean }) => {\n clack.intro(chalk.bgRed('Removing the PostHog MCP server'));\n const results = await removeMCPServerFromClientsStep({\n local: options?.local,\n });\n\n if (results.length === 0) {\n clack.outro(`No PostHog MCP servers found to remove.`);\n return;\n }\n\n clack.log.success(`PostHog MCP server removed from:`);\n results.map((c) => clack.log.message(`- ${c}`));\n clack.outro(\n `${chalk.green(\n 'You might need to restart your MCP clients to see the changes.\\n\\n',\n )}`,\n );\n};\n"]}
package/dist/src/run.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- import type { CloudRegion } from './utils/types';
2
1
  import { Integration } from './lib/constants';
3
2
  type Args = {
4
3
  integration?: Integration;
5
4
  debug?: boolean;
6
5
  forceInstall?: boolean;
7
6
  installDir?: string;
8
- region?: CloudRegion;
9
7
  default?: boolean;
10
8
  signup?: boolean;
11
9
  localMcp?: boolean;
package/dist/src/run.js CHANGED
@@ -43,7 +43,6 @@ async function runWizard(argv) {
43
43
  debug: finalArgs.debug ?? false,
44
44
  forceInstall: finalArgs.forceInstall ?? false,
45
45
  installDir: resolvedInstallDir,
46
- cloudRegion: finalArgs.region ?? undefined,
47
46
  default: finalArgs.default ?? false,
48
47
  signup: finalArgs.signup ?? false,
49
48
  localMcp: finalArgs.localMcp ?? false,
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;AAuCA,8BA+EC;AAtHD,qDAAuD;AAIvD,+CAA8C;AAC9C,qDAAsD;AACtD,0DAAkC;AAClC,gDAAwB;AACxB,6CAAoD;AACpD,iDAA8C;AAC9C,qDAAoD;AACpD,mCAAsC;AACtC,kDAA0B;AAC1B,yCAA0C;AAE1C,qBAAY,CAAC,mBAAmB,GAAG,EAAE,CAAC;AAkBtC,SAAS,cAAc,CAAC,KAAyB;IAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC1D,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAEM,KAAK,UAAU,SAAS,CAAC,IAAU;IACxC,MAAM,SAAS,GAAG;QAChB,GAAG,IAAI;QACP,GAAG,IAAA,6BAAe,GA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CAAC,MAAM,CAAC;QACX,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,uBAAW,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAClD,KAAK;YACL,KAAK,EAAE,6BAAkB,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI;SAC/C,CAAC,CAAC;KACJ,CAAC,CACH,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { abortIfCancelled } from './utils/clack-utils';\n\nimport type { CloudRegion, WizardOptions } from './utils/types';\n\nimport { Integration } from './lib/constants';\nimport { readEnvironment } from './utils/environment';\nimport clack from './utils/clack';\nimport path from 'path';\nimport { FRAMEWORK_REGISTRY } from './lib/registry';\nimport { analytics } from './utils/analytics';\nimport { runAgentWizard } from './lib/agent-runner';\nimport { EventEmitter } from 'events';\nimport chalk from 'chalk';\nimport { logToFile } from './utils/debug';\n\nEventEmitter.defaultMaxListeners = 50;\n\ntype Args = {\n integration?: Integration;\n debug?: boolean;\n forceInstall?: boolean;\n installDir?: string;\n region?: CloudRegion;\n default?: boolean;\n signup?: boolean;\n localMcp?: boolean;\n ci?: boolean;\n apiKey?: string;\n projectId?: string;\n menu?: boolean;\n benchmark?: boolean;\n};\n\nfunction parseProjectId(value: string | undefined): number | undefined {\n if (value === undefined || value === '') return undefined;\n const n = Number(value);\n return Number.isInteger(n) && n > 0 ? n : undefined;\n}\n\nexport async function runWizard(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n let resolvedInstallDir: string;\n if (finalArgs.installDir) {\n if (path.isAbsolute(finalArgs.installDir)) {\n resolvedInstallDir = finalArgs.installDir;\n } else {\n resolvedInstallDir = path.join(process.cwd(), finalArgs.installDir);\n }\n } else {\n resolvedInstallDir = process.cwd();\n }\n\n const wizardOptions: WizardOptions = {\n debug: finalArgs.debug ?? false,\n forceInstall: finalArgs.forceInstall ?? false,\n installDir: resolvedInstallDir,\n cloudRegion: finalArgs.region ?? undefined,\n default: finalArgs.default ?? false,\n signup: finalArgs.signup ?? false,\n localMcp: finalArgs.localMcp ?? false,\n ci: finalArgs.ci ?? false,\n apiKey: finalArgs.apiKey,\n projectId: parseProjectId(finalArgs.projectId),\n menu: finalArgs.menu ?? false,\n benchmark: finalArgs.benchmark ?? false,\n };\n\n clack.intro(`Welcome to the PostHog setup wizard ✨`);\n\n if (wizardOptions.ci) {\n clack.log.info(chalk.dim('Running in CI mode'));\n }\n\n const integration =\n finalArgs.integration ?? (await getIntegrationForSetup(wizardOptions));\n\n analytics.setTag('integration', integration);\n\n const config = FRAMEWORK_REGISTRY[integration];\n\n try {\n await runAgentWizard(config, wizardOptions);\n } catch (error) {\n analytics.captureException(error as Error, {\n integration,\n arguments: JSON.stringify(finalArgs),\n });\n\n await analytics.shutdown('error');\n\n const errorMessage = error instanceof Error ? error.message : String(error);\n const errorStack =\n error instanceof Error && error.stack ? error.stack : undefined;\n\n // Log to file for debugging\n logToFile(`[Wizard run.ts] ERROR MESSAGE: ${errorMessage} `);\n if (errorStack) {\n logToFile(`[Wizard run.ts] ERROR STACK: ${errorStack}`);\n }\n\n clack.log.error(\n `Something went wrong: ${chalk.red(\n errorMessage,\n )}\\n\\nYou can read the documentation at ${chalk.cyan(\n config.metadata.docsUrl,\n )} to set up PostHog manually.`,\n );\n\n if (wizardOptions.debug && errorStack) {\n clack.log.info(chalk.dim(errorStack));\n }\n\n process.exit(1);\n }\n}\n\nconst DETECTION_TIMEOUT_MS = 5000;\n\nasync function detectIntegration(\n options: Pick<WizardOptions, 'installDir'>,\n): Promise<Integration | undefined> {\n for (const integration of Object.values(Integration)) {\n const config = FRAMEWORK_REGISTRY[integration];\n try {\n const detected = await Promise.race([\n config.detection.detect(options),\n new Promise<false>((resolve) =>\n setTimeout(() => resolve(false), DETECTION_TIMEOUT_MS),\n ),\n ]);\n if (detected) {\n return integration;\n }\n } catch {\n // Skip frameworks whose detection throws\n }\n }\n}\n\nasync function getIntegrationForSetup(\n options: Pick<WizardOptions, 'installDir' | 'menu'>,\n) {\n if (!options.menu) {\n const detectedIntegration = await detectIntegration(options);\n\n if (detectedIntegration) {\n clack.log.success(\n `Detected integration: ${FRAMEWORK_REGISTRY[detectedIntegration].metadata.name}`,\n );\n return detectedIntegration;\n }\n\n clack.log.info(\n \"I couldn't detect your framework. Please choose one to get started.\",\n );\n }\n\n const integration: Integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: Object.values(Integration).map((value) => ({\n value,\n label: FRAMEWORK_REGISTRY[value].metadata.name,\n })),\n }),\n );\n\n return integration;\n}\n"]}
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;AAsCA,8BA8EC;AApHD,qDAAuD;AAIvD,+CAA8C;AAC9C,qDAAsD;AACtD,0DAAkC;AAClC,gDAAwB;AACxB,6CAAoD;AACpD,iDAA8C;AAC9C,qDAAoD;AACpD,mCAAsC;AACtC,kDAA0B;AAC1B,yCAA0C;AAE1C,qBAAY,CAAC,mBAAmB,GAAG,EAAE,CAAC;AAiBtC,SAAS,cAAc,CAAC,KAAyB;IAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC1D,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAEM,KAAK,UAAU,SAAS,CAAC,IAAU;IACxC,MAAM,SAAS,GAAG;QAChB,GAAG,IAAI;QACP,GAAG,IAAA,6BAAe,GAAE;KACrB,CAAC;IAEF,IAAI,kBAA0B,CAAC;IAC/B,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;QACzB,IAAI,cAAI,CAAC,UAAU,C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ACL,KAAK,EAAE,6BAAkB,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI;SAC/C,CAAC,CAAC;KACJ,CAAC,CACH,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { abortIfCancelled } from './utils/clack-utils';\n\nimport type { WizardOptions } from './utils/types';\n\nimport { Integration } from './lib/constants';\nimport { readEnvironment } from './utils/environment';\nimport clack from './utils/clack';\nimport path from 'path';\nimport { FRAMEWORK_REGISTRY } from './lib/registry';\nimport { analytics } from './utils/analytics';\nimport { runAgentWizard } from './lib/agent-runner';\nimport { EventEmitter } from 'events';\nimport chalk from 'chalk';\nimport { logToFile } from './utils/debug';\n\nEventEmitter.defaultMaxListeners = 50;\n\ntype Args = {\n integration?: Integration;\n debug?: boolean;\n forceInstall?: boolean;\n installDir?: string;\n default?: boolean;\n signup?: boolean;\n localMcp?: boolean;\n ci?: boolean;\n apiKey?: string;\n projectId?: string;\n menu?: boolean;\n benchmark?: boolean;\n};\n\nfunction parseProjectId(value: string | undefined): number | undefined {\n if (value === undefined || value === '') return undefined;\n const n = Number(value);\n return Number.isInteger(n) && n > 0 ? n : undefined;\n}\n\nexport async function runWizard(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n let resolvedInstallDir: string;\n if (finalArgs.installDir) {\n if (path.isAbsolute(finalArgs.installDir)) {\n resolvedInstallDir = finalArgs.installDir;\n } else {\n resolvedInstallDir = path.join(process.cwd(), finalArgs.installDir);\n }\n } else {\n resolvedInstallDir = process.cwd();\n }\n\n const wizardOptions: WizardOptions = {\n debug: finalArgs.debug ?? false,\n forceInstall: finalArgs.forceInstall ?? false,\n installDir: resolvedInstallDir,\n default: finalArgs.default ?? false,\n signup: finalArgs.signup ?? false,\n localMcp: finalArgs.localMcp ?? false,\n ci: finalArgs.ci ?? false,\n apiKey: finalArgs.apiKey,\n projectId: parseProjectId(finalArgs.projectId),\n menu: finalArgs.menu ?? false,\n benchmark: finalArgs.benchmark ?? false,\n };\n\n clack.intro(`Welcome to the PostHog setup wizard ✨`);\n\n if (wizardOptions.ci) {\n clack.log.info(chalk.dim('Running in CI mode'));\n }\n\n const integration =\n finalArgs.integration ?? (await getIntegrationForSetup(wizardOptions));\n\n analytics.setTag('integration', integration);\n\n const config = FRAMEWORK_REGISTRY[integration];\n\n try {\n await runAgentWizard(config, wizardOptions);\n } catch (error) {\n analytics.captureException(error as Error, {\n integration,\n arguments: JSON.stringify(finalArgs),\n });\n\n await analytics.shutdown('error');\n\n const errorMessage = error instanceof Error ? error.message : String(error);\n const errorStack =\n error instanceof Error && error.stack ? error.stack : undefined;\n\n // Log to file for debugging\n logToFile(`[Wizard run.ts] ERROR MESSAGE: ${errorMessage} `);\n if (errorStack) {\n logToFile(`[Wizard run.ts] ERROR STACK: ${errorStack}`);\n }\n\n clack.log.error(\n `Something went wrong: ${chalk.red(\n errorMessage,\n )}\\n\\nYou can read the documentation at ${chalk.cyan(\n config.metadata.docsUrl,\n )} to set up PostHog manually.`,\n );\n\n if (wizardOptions.debug && errorStack) {\n clack.log.info(chalk.dim(errorStack));\n }\n\n process.exit(1);\n }\n}\n\nconst DETECTION_TIMEOUT_MS = 5000;\n\nasync function detectIntegration(\n options: Pick<WizardOptions, 'installDir'>,\n): Promise<Integration | undefined> {\n for (const integration of Object.values(Integration)) {\n const config = FRAMEWORK_REGISTRY[integration];\n try {\n const detected = await Promise.race([\n config.detection.detect(options),\n new Promise<false>((resolve) =>\n setTimeout(() => resolve(false), DETECTION_TIMEOUT_MS),\n ),\n ]);\n if (detected) {\n return integration;\n }\n } catch {\n // Skip frameworks whose detection throws\n }\n }\n}\n\nasync function getIntegrationForSetup(\n options: Pick<WizardOptions, 'installDir' | 'menu'>,\n) {\n if (!options.menu) {\n const detectedIntegration = await detectIntegration(options);\n\n if (detectedIntegration) {\n clack.log.success(\n `Detected integration: ${FRAMEWORK_REGISTRY[detectedIntegration].metadata.name}`,\n );\n return detectedIntegration;\n }\n\n clack.log.info(\n \"I couldn't detect your framework. Please choose one to get started.\",\n );\n }\n\n const integration: Integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: Object.values(Integration).map((value) => ({\n value,\n label: FRAMEWORK_REGISTRY[value].metadata.name,\n })),\n }),\n );\n\n return integration;\n}\n"]}
@@ -1,11 +1,10 @@
1
- import type { CloudRegion } from '../../utils/types';
2
1
  export type MCPServerConfig = Record<string, unknown>;
3
2
  export declare abstract class MCPClient {
4
3
  name: string;
5
4
  abstract getConfigPath(): Promise<string>;
6
5
  abstract getServerPropertyName(): string;
7
6
  abstract isServerInstalled(local?: boolean): Promise<boolean>;
8
- abstract addServer(apiKey?: string, selectedFeatures?: string[], local?: boolean, region?: CloudRegion): Promise<{
7
+ abstract addServer(apiKey?: string, selectedFeatures?: string[], local?: boolean): Promise<{
9
8
  success: boolean;
10
9
  }>;
11
10
  abstract removeServer(local?: boolean): Promise<{
@@ -17,12 +16,12 @@ export declare abstract class DefaultMCPClient extends MCPClient {
17
16
  name: string;
18
17
  constructor();
19
18
  getServerPropertyName(): string;
20
- getServerConfig(apiKey: string | undefined, type: 'sse' | 'streamable-http', selectedFeatures?: string[], local?: boolean, region?: CloudRegion): MCPServerConfig;
19
+ getServerConfig(apiKey: string | undefined, type: 'sse' | 'streamable-http', selectedFeatures?: string[], local?: boolean): MCPServerConfig;
21
20
  isServerInstalled(local?: boolean): Promise<boolean>;
22
- addServer(apiKey?: string, selectedFeatures?: string[], local?: boolean, region?: CloudRegion): Promise<{
21
+ addServer(apiKey?: string, selectedFeatures?: string[], local?: boolean): Promise<{
23
22
  success: boolean;
24
23
  }>;
25
- _addServerType(apiKey: string | undefined, type: 'sse' | 'streamable-http', selectedFeatures?: string[], local?: boolean, region?: CloudRegion): Promise<{
24
+ _addServerType(apiKey: string | undefined, type: 'sse' | 'streamable-http', selectedFeatures?: string[], local?: boolean): Promise<{
26
25
  success: boolean;
27
26
  }>;
28
27
  removeServer(local?: boolean): Promise<{
@@ -50,8 +50,8 @@ class DefaultMCPClient extends MCPClient {
50
50
  getServerPropertyName() {
51
51
  return 'mcpServers';
52
52
  }
53
- getServerConfig(apiKey, type, selectedFeatures, local, region) {
54
- return (0, defaults_1.getDefaultServerConfig)(apiKey, type, selectedFeatures, local, region);
53
+ getServerConfig(apiKey, type, selectedFeatures, local) {
54
+ return (0, defaults_1.getDefaultServerConfig)(apiKey, type, selectedFeatures, local);
55
55
  }
56
56
  async isServerInstalled(local) {
57
57
  try {
@@ -69,10 +69,10 @@ class DefaultMCPClient extends MCPClient {
69
69
  return false;
70
70
  }
71
71
  }
72
- async addServer(apiKey, selectedFeatures, local, region) {
73
- return this._addServerType(apiKey, 'sse', selectedFeatures, local, region);
72
+ async addServer(apiKey, selectedFeatures, local) {
73
+ return this._addServerType(apiKey, 'sse', selectedFeatures, local);
74
74
  }
75
- async _addServerType(apiKey, type, selectedFeatures, local, region) {
75
+ async _addServerType(apiKey, type, selectedFeatures, local) {
76
76
  try {
77
77
  const configPath = await this.getConfigPath();
78
78
  const configDir = path.dirname(configPath);
@@ -84,7 +84,7 @@ class DefaultMCPClient extends MCPClient {
84
84
  configContent = await fs.promises.readFile(configPath, 'utf8');
85
85
  existingConfig = jsonc.parse(configContent) || {};
86
86
  }
87
- const newServerConfig = this.getServerConfig(apiKey, type, selectedFeatures, local, region);
87
+ const newServerConfig = this.getServerConfig(apiKey, type, selectedFeatures, local);
88
88
  const typedConfig = existingConfig;
89
89
  if (!typedConfig[serverPropertyName]) {
90
90
  typedConfig[serverPropertyName] = {};
@@ -1 +1 @@
1
- {"version":3,"file":"MCPClient.js","sourceRoot":"","sources":["../../../../src/steps/add-mcp-server-to-clients/MCPClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,oDAAsC;AACtC,yCAAoD;AAKpD,MAAsB,SAAS;IAC7B,IAAI,CAAS;CAYd;AAbD,8BAaC;AAED,MAAsB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,IAAI;qBACnB;iBACF,CACF,CAAC;gBAEF,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;gBAE/D,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;gBAEjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,EAAE;QACJ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF;AA7JD,4CA6JC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as jsonc from 'jsonc-parser';\nimport { getDefaultServerConfig } from './defaults';\nimport type { CloudRegion } from '../../utils/types';\n\nexport type MCPServerConfig = Record<string, unknown>;\n\nexport abstract class MCPClient {\n name: string;\n abstract getConfigPath(): Promise<string>;\n abstract getServerPropertyName(): string;\n abstract isServerInstalled(local?: boolean): Promise<boolean>;\n abstract addServer(\n apiKey?: string,\n selectedFeatures?: string[],\n local?: boolean,\n region?: CloudRegion,\n ): Promise<{ success: boolean }>;\n abstract removeServer(local?: boolean): Promise<{ success: boolean }>;\n abstract isClientSupported(): Promise<boolean>;\n}\n\nexport abstract class DefaultMCPClient extends MCPClient {\n name = 'Default';\n\n constructor() {\n super();\n }\n\n getServerPropertyName(): string {\n return 'mcpServers';\n }\n\n getServerConfig(\n apiKey: string | undefined,\n type: 'sse' | 'streamable-http',\n selectedFeatures?: string[],\n local?: boolean,\n region?: CloudRegion,\n ): MCPServerConfig {\n return getDefaultServerConfig(\n apiKey,\n type,\n selectedFeatures,\n local,\n region,\n );\n }\n\n async isServerInstalled(local?: boolean): Promise<boolean> {\n try {\n const configPath = await this.getConfigPath();\n\n if (!fs.existsSync(configPath)) {\n return false;\n }\n\n const configContent = await fs.promises.readFile(configPath, 'utf8');\n const config = jsonc.parse(configContent) as Record<string, any>;\n const serverPropertyName = this.getServerPropertyName();\n const serverName = local ? 'posthog-local' : 'posthog';\n\n return (\n serverPropertyName in config && serverName in config[serverPropertyName]\n );\n } catch {\n return false;\n }\n }\n\n async addServer(\n apiKey?: string,\n selectedFeatures?: string[],\n local?: boolean,\n region?: CloudRegion,\n ): Promise<{ success: boolean }> {\n return this._addServerType(apiKey, 'sse', selectedFeatures, local, region);\n }\n\n async _addServerType(\n apiKey: string | undefined,\n type: 'sse' | 'streamable-http',\n selectedFeatures?: string[],\n local?: boolean,\n region?: CloudRegion,\n ): Promise<{ success: boolean }> {\n try {\n const configPath = await this.getConfigPath();\n const configDir = path.dirname(configPath);\n\n await fs.promises.mkdir(configDir, { recursive: true });\n\n const serverPropertyName = this.getServerPropertyName();\n let configContent = '';\n let existingConfig = {};\n\n if (fs.existsSync(configPath)) {\n configContent = await fs.promises.readFile(configPath, 'utf8');\n existingConfig = jsonc.parse(configContent) || {};\n }\n\n const newServerConfig = this.getServerConfig(\n apiKey,\n type,\n selectedFeatures,\n local,\n region,\n );\n const typedConfig = existingConfig as Record<string, any>;\n if (!typedConfig[serverPropertyName]) {\n typedConfig[serverPropertyName] = {};\n }\n const serverName = local ? 'posthog-local' : 'posthog';\n typedConfig[serverPropertyName][serverName] = newServerConfig;\n\n const edits = jsonc.modify(\n configContent,\n [serverPropertyName, serverName],\n newServerConfig,\n {\n formattingOptions: {\n tabSize: 2,\n insertSpaces: true,\n },\n },\n );\n\n const modifiedContent = jsonc.applyEdits(configContent, edits);\n\n await fs.promises.writeFile(configPath, modifiedContent, 'utf8');\n\n return { success: true };\n } catch {\n return { success: false };\n }\n }\n\n async removeServer(local?: boolean): Promise<{ success: boolean }> {\n try {\n const configPath = await this.getConfigPath();\n\n if (!fs.existsSync(configPath)) {\n return { success: false };\n }\n\n const configContent = await fs.promises.readFile(configPath, 'utf8');\n const config = jsonc.parse(configContent) as Record<string, any>;\n const serverPropertyName = this.getServerPropertyName();\n\n const serverName = local ? 'posthog-local' : 'posthog';\n\n if (\n serverPropertyName in config &&\n serverName in config[serverPropertyName]\n ) {\n const edits = jsonc.modify(\n configContent,\n [serverPropertyName, serverName],\n undefined,\n {\n formattingOptions: {\n tabSize: 2,\n insertSpaces: true,\n },\n },\n );\n\n const modifiedContent = jsonc.applyEdits(configContent, edits);\n\n await fs.promises.writeFile(configPath, modifiedContent, 'utf8');\n\n return { success: true };\n }\n } catch {\n //\n }\n\n return { success: false };\n }\n}\n"]}
1
+ {"version":3,"file":"MCPClient.js","sourceRoot":"","sources":["../../../../src/steps/add-mcp-server-to-clients/MCPClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,oDAAsC;AACtC,yCAAoD;AAIpD,MAAsB,SAAS;IAC7B,IAAI,CAAS;CAWd;AAZD,8BAYC;AAED,MAAsB,gBAAiB,SAAQ,SAAS;IACtD,IAAI,GAAG,SAAS,CAAC;IAEjB;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,qBAAqB;QACnB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,eAAe,CACb,MAA0B,EAC1B,IAA+B,EAC/B,gBAA2B,EAC3B,KAAe;QAEf,OAAO,IAAA,iCAAsB,EAAC,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAAe;QACrC,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;YAE9C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACf,CAAC;YAED,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YACrE,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa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CAAC;YACrE,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAwB,CAAC;YACjE,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAExD,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;YAEvD,IACE,kBAAkB,IAAI,MAAM;gBAC5B,UAAU,IAAI,MAAM,CAAC,kBAAkB,CAAC,EACxC,CAAC;gBACD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CACxB,aAAa,EACb,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAChC,SAAS,EACT;oBACE,iBAAiB,EAAE;wBACjB,OAAO,EAAE,CAAC;wBACV,YAAY,EAAE,IAAI;qBACnB;iBACF,CACF,CAAC;gBAEF,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;gBAE/D,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;gBAEjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,EAAE;QACJ,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF;AAnJD,4CAmJC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as jsonc from 'jsonc-parser';\nimport { getDefaultServerConfig } from './defaults';\n\nexport type MCPServerConfig = Record<string, unknown>;\n\nexport abstract class MCPClient {\n name: string;\n abstract getConfigPath(): Promise<string>;\n abstract getServerPropertyName(): string;\n abstract isServerInstalled(local?: boolean): Promise<boolean>;\n abstract addServer(\n apiKey?: string,\n selectedFeatures?: string[],\n local?: boolean,\n ): Promise<{ success: boolean }>;\n abstract removeServer(local?: boolean): Promise<{ success: boolean }>;\n abstract isClientSupported(): Promise<boolean>;\n}\n\nexport abstract class DefaultMCPClient extends MCPClient {\n name = 'Default';\n\n constructor() {\n super();\n }\n\n getServerPropertyName(): string {\n return 'mcpServers';\n }\n\n getServerConfig(\n apiKey: string | undefined,\n type: 'sse' | 'streamable-http',\n selectedFeatures?: string[],\n local?: boolean,\n ): MCPServerConfig {\n return getDefaultServerConfig(apiKey, type, selectedFeatures, local);\n }\n\n async isServerInstalled(local?: boolean): Promise<boolean> {\n try {\n const configPath = await this.getConfigPath();\n\n if (!fs.existsSync(configPath)) {\n return false;\n }\n\n const configContent = await fs.promises.readFile(configPath, 'utf8');\n const config = jsonc.parse(configContent) as Record<string, any>;\n const serverPropertyName = this.getServerPropertyName();\n const serverName = local ? 'posthog-local' : 'posthog';\n\n return (\n serverPropertyName in config && serverName in config[serverPropertyName]\n );\n } catch {\n return false;\n }\n }\n\n async addServer(\n apiKey?: string,\n selectedFeatures?: string[],\n local?: boolean,\n ): Promise<{ success: boolean }> {\n return this._addServerType(apiKey, 'sse', selectedFeatures, local);\n }\n\n async _addServerType(\n apiKey: string | undefined,\n type: 'sse' | 'streamable-http',\n selectedFeatures?: string[],\n local?: boolean,\n ): Promise<{ success: boolean }> {\n try {\n const configPath = await this.getConfigPath();\n const configDir = path.dirname(configPath);\n\n await fs.promises.mkdir(configDir, { recursive: true });\n\n const serverPropertyName = this.getServerPropertyName();\n let configContent = '';\n let existingConfig = {};\n\n if (fs.existsSync(configPath)) {\n configContent = await fs.promises.readFile(configPath, 'utf8');\n existingConfig = jsonc.parse(configContent) || {};\n }\n\n const newServerConfig = this.getServerConfig(\n apiKey,\n type,\n selectedFeatures,\n local,\n );\n const typedConfig = existingConfig as Record<string, any>;\n if (!typedConfig[serverPropertyName]) {\n typedConfig[serverPropertyName] = {};\n }\n const serverName = local ? 'posthog-local' : 'posthog';\n typedConfig[serverPropertyName][serverName] = newServerConfig;\n\n const edits = jsonc.modify(\n configContent,\n [serverPropertyName, serverName],\n newServerConfig,\n {\n formattingOptions: {\n tabSize: 2,\n insertSpaces: true,\n },\n },\n );\n\n const modifiedContent = jsonc.applyEdits(configContent, edits);\n\n await fs.promises.writeFile(configPath, modifiedContent, 'utf8');\n\n return { success: true };\n } catch {\n return { success: false };\n }\n }\n\n async removeServer(local?: boolean): Promise<{ success: boolean }> {\n try {\n const configPath = await this.getConfigPath();\n\n if (!fs.existsSync(configPath)) {\n return { success: false };\n }\n\n const configContent = await fs.promises.readFile(configPath, 'utf8');\n const config = jsonc.parse(configContent) as Record<string, any>;\n const serverPropertyName = this.getServerPropertyName();\n\n const serverName = local ? 'posthog-local' : 'posthog';\n\n if (\n serverPropertyName in config &&\n serverName in config[serverPropertyName]\n ) {\n const edits = jsonc.modify(\n configContent,\n [serverPropertyName, serverName],\n undefined,\n {\n formattingOptions: {\n tabSize: 2,\n insertSpaces: true,\n },\n },\n );\n\n const modifiedContent = jsonc.applyEdits(configContent, edits);\n\n await fs.promises.writeFile(configPath, modifiedContent, 'utf8');\n\n return { success: true };\n }\n } catch {\n //\n }\n\n return { success: false };\n }\n}\n"]}
@@ -19,22 +19,10 @@ describe('defaults', () => {
19
19
  const url = (0, defaults_1.buildMCPUrl)('streamable-http', ['dashboards', 'insights']);
20
20
  expect(url).toBe('https://mcp.posthog.com/mcp?features=dashboards,insights');
21
21
  });
22
- it('should use EU subdomain for EU region', () => {
23
- const url = (0, defaults_1.buildMCPUrl)('streamable-http', undefined, false, 'eu');
24
- expect(url).toBe('https://mcp-eu.posthog.com/mcp');
25
- });
26
- it('should not add region param for US region (default)', () => {
27
- const url = (0, defaults_1.buildMCPUrl)('streamable-http', undefined, false, 'us');
28
- expect(url).toBe('https://mcp.posthog.com/mcp');
29
- });
30
22
  it('should not add region param in local mode', () => {
31
- const url = (0, defaults_1.buildMCPUrl)('streamable-http', undefined, true, 'eu');
23
+ const url = (0, defaults_1.buildMCPUrl)('streamable-http', undefined, true);
32
24
  expect(url).toBe('http://localhost:8787/mcp');
33
25
  });
34
- it('should combine EU subdomain with features param', () => {
35
- const url = (0, defaults_1.buildMCPUrl)('streamable-http', ['dashboards'], false, 'eu');
36
- expect(url).toBe('https://mcp-eu.posthog.com/mcp?features=dashboards');
37
- });
38
26
  });
39
27
  describe('getDefaultServerConfig', () => {
40
28
  it('should return config with auth header when API key provided', () => {
@@ -61,10 +49,6 @@ describe('defaults', () => {
61
49
  });
62
50
  expect(config).not.toHaveProperty('env');
63
51
  });
64
- it('should use EU subdomain for EU users in OAuth mode', () => {
65
- const config = (0, defaults_1.getDefaultServerConfig)(undefined, 'streamable-http', undefined, false, 'eu');
66
- expect(config.args).toContain('https://mcp-eu.posthog.com/mcp');
67
- });
68
52
  });
69
53
  describe('getNativeHTTPServerConfig', () => {
70
54
  it('should return config with headers when API key provided', () => {
@@ -83,10 +67,6 @@ describe('defaults', () => {
83
67
  });
84
68
  expect(config).not.toHaveProperty('headers');
85
69
  });
86
- it('should use EU subdomain for EU users', () => {
87
- const config = (0, defaults_1.getNativeHTTPServerConfig)(undefined, 'streamable-http', undefined, false, 'eu');
88
- expect(config.url).toBe('https://mcp-eu.posthog.com/mcp');
89
- });
90
70
  });
91
71
  });
92
72
  //# sourceMappingURL=defaults.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.test.js","sourceRoot":"","sources":["../../../../../src/steps/add-mcp-server-to-clients/__tests__/defaults.test.ts"],"names":[],"mappings":";;AAAA,0CAIqB;AAErB,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,GAAG,GAAG,IAAA,sBAAW,EAAC,iBAAiB,CAAC,CAAC;YAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,GAAG,GAAG,IAAA,sBAAW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escribe('defaults', () => {\n describe('buildMCPUrl', () => {\n it('should build base URL for streamable-http type', () => {\n const url = buildMCPUrl('streamable-http');\n expect(url).toBe('https://mcp.posthog.com/mcp');\n });\n\n it('should build base URL for sse type', () => {\n const url = buildMCPUrl('sse');\n expect(url).toBe('https://mcp.posthog.com/sse');\n });\n\n it('should use localhost for local mode', () => {\n const url = buildMCPUrl('streamable-http', undefined, true);\n expect(url).toBe('http://localhost:8787/mcp');\n });\n\n it('should add features param when not all features selected', () => {\n const url = buildMCPUrl('streamable-http', ['dashboards', 'insights']);\n expect(url).toBe(\n 'https://mcp.posthog.com/mcp?features=dashboards,insights',\n );\n });\n\n it('should use EU subdomain for EU region', () => {\n const url = buildMCPUrl('streamable-http', undefined, false, 'eu');\n expect(url).toBe('https://mcp-eu.posthog.com/mcp');\n });\n\n it('should not add region param for US region (default)', () => {\n const url = buildMCPUrl('streamable-http', undefined, false, 'us');\n expect(url).toBe('https://mcp.posthog.com/mcp');\n });\n\n it('should not add region param in local mode', () => {\n const url = buildMCPUrl('streamable-http', undefined, true, 'eu');\n expect(url).toBe('http://localhost:8787/mcp');\n });\n\n it('should combine EU subdomain with features param', () => {\n const url = buildMCPUrl('streamable-http', ['dashboards'], false, 'eu');\n expect(url).toBe('https://mcp-eu.posthog.com/mcp?features=dashboards');\n });\n });\n\n describe('getDefaultServerConfig', () => {\n it('should return config with auth header when API key provided', () => {\n const config = getDefaultServerConfig('phx_test123', 'sse');\n expect(config).toEqual({\n command: 'npx',\n args: [\n '-y',\n 'mcp-remote@latest',\n 'https://mcp.posthog.com/sse',\n '--header',\n 'Authorization:${POSTHOG_AUTH_HEADER}',\n ],\n env: {\n POSTHOG_AUTH_HEADER: 'Bearer phx_test123',\n },\n });\n });\n\n it('should return config without auth header for OAuth mode (no API key)', () => {\n const config = getDefaultServerConfig(undefined, 'sse');\n expect(config).toEqual({\n command: 'npx',\n args: ['-y', 'mcp-remote@latest', 'https://mcp.posthog.com/sse'],\n });\n expect(config).not.toHaveProperty('env');\n });\n\n it('should use EU subdomain for EU users in OAuth mode', () => {\n const config = getDefaultServerConfig(\n undefined,\n 'streamable-http',\n undefined,\n false,\n 'eu',\n );\n expect(config.args).toContain('https://mcp-eu.posthog.com/mcp');\n });\n });\n\n describe('getNativeHTTPServerConfig', () => {\n it('should return config with headers when API key provided', () => {\n const config = getNativeHTTPServerConfig(\n 'phx_test123',\n 'streamable-http',\n );\n expect(config).toEqual({\n url: 'https://mcp.posthog.com/mcp',\n headers: {\n Authorization: 'Bearer phx_test123',\n },\n });\n });\n\n it('should return config without headers for OAuth mode (no API key)', () => {\n const config = getNativeHTTPServerConfig(undefined, 'streamable-http');\n expect(config).toEqual({\n url: 'https://mcp.posthog.com/mcp',\n });\n expect(config).not.toHaveProperty('headers');\n });\n\n it('should use EU subdomain for EU users', () => {\n const config = getNativeHTTPServerConfig(\n undefined,\n 'streamable-http',\n undefined,\n false,\n 'eu',\n );\n expect(config.url).toBe('https://mcp-eu.posthog.com/mcp');\n });\n });\n});\n"]}
1
+ {"version":3,"file":"defaults.test.js","sourceRoot":"","sources":["../../../../../src/steps/add-mcp-server-to-clients/__tests__/defaults.test.ts"],"names":[],"mappings":";;AAAA,0CAIqB;AAErB,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,GAAG,GAAG,IAAA,sBAAW,EAAC,iBAAiB,CAAC,CAAC;YAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,GAAG,GAAG,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC;YAC/B,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAClD,CAAC,CAAC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AAsB,EAAC,SAAS,EAAE,KAAK,CAAC,CAAC;YACxD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,CAAC,IAAI,EAAE,mBAAmB,EAAE,6BAA6B,CAAC;aACjE,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACzC,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;YACjE,MAAM,MAAM,GAAG,IAAA,oCAAyB,EACtC,aAAa,EACb,iBAAiB,CAClB,CAAC;YACF,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB,GAAG,EAAE,6BAA6B;gBAClC,OAAO,EAAE;oBACP,aAAa,EAAE,oBAAoB;iBACpC;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;YAC1E,MAAM,MAAM,GAAG,IAAA,oCAAyB,EAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;YACvE,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB,GAAG,EAAE,6BAA6B;aACnC,CAAC,CAAC;YACH,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n buildMCPUrl,\n getDefaultServerConfig,\n getNativeHTTPServerConfig,\n} from '../defaults';\n\ndescribe('defaults', () => {\n describe('buildMCPUrl', () => {\n it('should build base URL for streamable-http type', () => {\n const url = buildMCPUrl('streamable-http');\n expect(url).toBe('https://mcp.posthog.com/mcp');\n });\n\n it('should build base URL for sse type', () => {\n const url = buildMCPUrl('sse');\n expect(url).toBe('https://mcp.posthog.com/sse');\n });\n\n it('should use localhost for local mode', () => {\n const url = buildMCPUrl('streamable-http', undefined, true);\n expect(url).toBe('http://localhost:8787/mcp');\n });\n\n it('should add features param when not all features selected', () => {\n const url = buildMCPUrl('streamable-http', ['dashboards', 'insights']);\n expect(url).toBe(\n 'https://mcp.posthog.com/mcp?features=dashboards,insights',\n );\n });\n\n it('should not add region param in local mode', () => {\n const url = buildMCPUrl('streamable-http', undefined, true);\n expect(url).toBe('http://localhost:8787/mcp');\n });\n });\n\n describe('getDefaultServerConfig', () => {\n it('should return config with auth header when API key provided', () => {\n const config = getDefaultServerConfig('phx_test123', 'sse');\n expect(config).toEqual({\n command: 'npx',\n args: [\n '-y',\n 'mcp-remote@latest',\n 'https://mcp.posthog.com/sse',\n '--header',\n 'Authorization:${POSTHOG_AUTH_HEADER}',\n ],\n env: {\n POSTHOG_AUTH_HEADER: 'Bearer phx_test123',\n },\n });\n });\n\n it('should return config without auth header for OAuth mode (no API key)', () => {\n const config = getDefaultServerConfig(undefined, 'sse');\n expect(config).toEqual({\n command: 'npx',\n args: ['-y', 'mcp-remote@latest', 'https://mcp.posthog.com/sse'],\n });\n expect(config).not.toHaveProperty('env');\n });\n });\n\n describe('getNativeHTTPServerConfig', () => {\n it('should return config with headers when API key provided', () => {\n const config = getNativeHTTPServerConfig(\n 'phx_test123',\n 'streamable-http',\n );\n expect(config).toEqual({\n url: 'https://mcp.posthog.com/mcp',\n headers: {\n Authorization: 'Bearer phx_test123',\n },\n });\n });\n\n it('should return config without headers for OAuth mode (no API key)', () => {\n const config = getNativeHTTPServerConfig(undefined, 'streamable-http');\n expect(config).toEqual({\n url: 'https://mcp.posthog.com/mcp',\n });\n expect(config).not.toHaveProperty('headers');\n });\n });\n});\n"]}
@@ -268,17 +268,12 @@ describe('ClaudeMCPClient', () => {
268
268
  it('should call getDefaultServerConfig with the provided API key', async () => {
269
269
  existsSyncMock.mockReturnValue(false);
270
270
  await client.addServer(mockApiKey);
271
- expect(getDefaultServerConfigMock).toHaveBeenCalledWith(mockApiKey, 'sse', undefined, undefined, undefined);
271
+ expect(getDefaultServerConfigMock).toHaveBeenCalledWith(mockApiKey, 'sse', undefined, undefined);
272
272
  });
273
273
  it('should call getDefaultServerConfig with undefined API key for OAuth mode', async () => {
274
274
  existsSyncMock.mockReturnValue(false);
275
275
  await client.addServer(undefined);
276
- expect(getDefaultServerConfigMock).toHaveBeenCalledWith(undefined, 'sse', undefined, undefined, undefined);
277
- });
278
- it('should pass region parameter to getDefaultServerConfig', async () => {
279
- existsSyncMock.mockReturnValue(false);
280
- await client.addServer(mockApiKey, undefined, undefined, 'eu');
281
- expect(getDefaultServerConfigMock).toHaveBeenCalledWith(mockApiKey, 'sse', undefined, undefined, 'eu');
276
+ expect(getDefaultServerConfigMock).toHaveBeenCalledWith(undefined, 'sse', undefined, undefined);
282
277
  });
283
278
  });
284
279
  describe('removeServer', () => {