@posthog/wizard 2.84.1 → 2.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/{PickerMenu-BtheKi1o.js → PickerMenu-DB8MO29j.js} +14 -5
  2. package/dist/PickerMenu-DB8MO29j.js.map +1 -0
  3. package/dist/{agent-interface-D8mrarFD.js → agent-interface-DuRXDmuv.js} +18 -11
  4. package/dist/agent-interface-DuRXDmuv.js.map +1 -0
  5. package/dist/{agent-prompt-loader-Bt6mrV7q.js → agent-prompt-loader-DibvEzkO.js} +6 -6
  6. package/dist/{agent-prompt-loader-Bt6mrV7q.js.map → agent-prompt-loader-DibvEzkO.js.map} +1 -1
  7. package/dist/{analytics-CX2kvq0R.js → analytics-CZNcNpiq.js} +2 -2
  8. package/dist/{analytics-CX2kvq0R.js.map → analytics-CZNcNpiq.js.map} +1 -1
  9. package/dist/analytics-jaYrwNS5.js +2 -0
  10. package/dist/{api-BOP8gF35.js → api-C3wnIy9r.js} +2 -2
  11. package/dist/{api-BOP8gF35.js.map → api-C3wnIy9r.js.map} +1 -1
  12. package/dist/api-Cjhon9jT.js +2 -0
  13. package/dist/{api-key-login-DbrZknHp.js → api-key-login-BEoyy3Pq.js} +5 -5
  14. package/dist/{api-key-login-DbrZknHp.js.map → api-key-login-BEoyy3Pq.js.map} +1 -1
  15. package/dist/api-key-login-zfRkp4JK.js +2 -0
  16. package/dist/bin.js +1 -1
  17. package/dist/{bounded-fs-BENh-Jzc.js → bounded-fs-CQGn0HxE.js} +5 -4
  18. package/dist/bounded-fs-CQGn0HxE.js.map +1 -0
  19. package/dist/{ci-install-DnjuAl1l.js → ci-install-BG77SHEw.js} +4 -4
  20. package/dist/{ci-install-DnjuAl1l.js.map → ci-install-BG77SHEw.js.map} +1 -1
  21. package/dist/{debug-C_9xDg9j.js → debug-Bw13gmS3.js} +3 -3
  22. package/dist/debug-Bw13gmS3.js.map +1 -0
  23. package/dist/{defaults-BWLIffh5.js → defaults-CLRka8GN.js} +4 -5
  24. package/dist/{defaults-BWLIffh5.js.map → defaults-CLRka8GN.js.map} +1 -1
  25. package/dist/{family-picker-CAW_VtYf.js → family-picker-CntEtZJE.js} +2 -2
  26. package/dist/{family-picker-CAW_VtYf.js.map → family-picker-CntEtZJE.js.map} +1 -1
  27. package/dist/{gateway-C6_zPLyx.js → gateway-Cl7h4Eot.js} +9 -6
  28. package/dist/{gateway-C6_zPLyx.js.map → gateway-Cl7h4Eot.js.map} +1 -1
  29. package/dist/{headless-BIQpNAHc.js → headless-DRA4mv9n.js} +2 -2
  30. package/dist/{headless-BIQpNAHc.js.map → headless-DRA4mv9n.js.map} +1 -1
  31. package/dist/{headless-sWzDbxAu.js → headless-DZAVKFMW.js} +1 -1
  32. package/dist/{host-resolution-C3ctTKNg.js → host-resolution-B0cQUK2A.js} +4 -4
  33. package/dist/{host-resolution-C3ctTKNg.js.map → host-resolution-B0cQUK2A.js.map} +1 -1
  34. package/dist/{install-CDhljVka.js → install-C0CKn7AV.js} +1 -1
  35. package/dist/{install-Dayhuaun.js → install-IvnTzMlR.js} +137 -39
  36. package/dist/install-IvnTzMlR.js.map +1 -0
  37. package/dist/{interactive-CjbttghI.js → interactive-wm9OcauB.js} +3 -3
  38. package/dist/{interactive-CjbttghI.js.map → interactive-wm9OcauB.js.map} +1 -1
  39. package/dist/{links-BOOGSL_G.js → links-Cj6OQ9Kv.js} +3 -3
  40. package/dist/{links-BOOGSL_G.js.map → links-Cj6OQ9Kv.js.map} +1 -1
  41. package/dist/{main-MzQaWN8w.js → main-SU6W6oek.js} +20 -20
  42. package/dist/{main-MzQaWN8w.js.map → main-SU6W6oek.js.map} +1 -1
  43. package/dist/{mcp-BwlD260T.js → mcp-m46rxecB.js} +3 -3
  44. package/dist/{mcp-BwlD260T.js.map → mcp-m46rxecB.js.map} +1 -1
  45. package/dist/{mcp-prompt-streaming-CoplNPI8.js → mcp-prompt-streaming-DuDUi7nq.js} +5 -5
  46. package/dist/{mcp-prompt-streaming-CoplNPI8.js.map → mcp-prompt-streaming-DuDUi7nq.js.map} +1 -1
  47. package/dist/{models-HwzgIr2E.js → models-D6XiGoty.js} +2 -2
  48. package/dist/{models-HwzgIr2E.js.map → models-D6XiGoty.js.map} +1 -1
  49. package/dist/{oauth-session-C4JV-yA9.js → oauth-session-DvAgen9l.js} +2 -2
  50. package/dist/{oauth-session-C4JV-yA9.js.map → oauth-session-DvAgen9l.js.map} +1 -1
  51. package/dist/{orchestrator-tools-Dr4w80Tn.js → orchestrator-tools-DSKw-1S6.js} +3 -3
  52. package/dist/{orchestrator-tools-Dr4w80Tn.js.map → orchestrator-tools-DSKw-1S6.js.map} +1 -1
  53. package/dist/{package-manager-Zw0JN1Kh.js → package-manager-CPzIaeu0.js} +4 -4
  54. package/dist/{package-manager-Zw0JN1Kh.js.map → package-manager-CPzIaeu0.js.map} +1 -1
  55. package/dist/{pi-qzRJcTgu.js → pi-T8emzbHL.js} +12 -12
  56. package/dist/{pi-qzRJcTgu.js.map → pi-T8emzbHL.js.map} +1 -1
  57. package/dist/{playground-B0SpcGYQ.js → playground-DE_9g_nd.js} +4 -4
  58. package/dist/{playground-B0SpcGYQ.js.map → playground-DE_9g_nd.js.map} +1 -1
  59. package/dist/{posthog-integration-4vQjbU-f.js → posthog-integration-CuEK-hPp.js} +21 -21
  60. package/dist/{posthog-integration-4vQjbU-f.js.map → posthog-integration-CuEK-hPp.js.map} +1 -1
  61. package/dist/programs-CWXzMPOe.js +3 -0
  62. package/dist/{programs-7aIrstFy.js → programs-T4EhU20m.js} +19 -15
  63. package/dist/programs-T4EhU20m.js.map +1 -0
  64. package/dist/{provisioning-BMJ3J0Vb.js → provisioning-9_MWLl8u.js} +4 -4
  65. package/dist/{provisioning-BMJ3J0Vb.js.map → provisioning-9_MWLl8u.js.map} +1 -1
  66. package/dist/provisioning-BXahZmpw.js +2 -0
  67. package/dist/{queue-tools-D8HPaGck.js → queue-tools-jFZ5kLU1.js} +4 -4
  68. package/dist/{queue-tools-D8HPaGck.js.map → queue-tools-jFZ5kLU1.js.map} +1 -1
  69. package/dist/{results-8xNiBbaP.js → results-CXTeEIUi.js} +2 -2
  70. package/dist/{results-8xNiBbaP.js.map → results-CXTeEIUi.js.map} +1 -1
  71. package/dist/{run-Dte7AuRg.js → run-Bnu1vqZG.js} +10 -10
  72. package/dist/{run-Dte7AuRg.js.map → run-Bnu1vqZG.js.map} +1 -1
  73. package/dist/run-tool-B0kgP7oA.js +2 -0
  74. package/dist/{run-tool-sdhoPp9H.js → run-tool-DOZz2dEJ.js} +37 -30
  75. package/dist/{run-tool-sdhoPp9H.js.map → run-tool-DOZz2dEJ.js.map} +1 -1
  76. package/dist/{run-DUcJFhzP.js → run-yiqaCX7y.js} +7 -7
  77. package/dist/{run-DUcJFhzP.js.map → run-yiqaCX7y.js.map} +1 -1
  78. package/dist/{runners-DxbNGuKH.js → runners-CVFLsNvO.js} +8 -8
  79. package/dist/{runners-DxbNGuKH.js.map → runners-CVFLsNvO.js.map} +1 -1
  80. package/dist/{security-BMqK129i.js → security-Bk0aumrm.js} +5 -5
  81. package/dist/{security-BMqK129i.js.map → security-Bk0aumrm.js.map} +1 -1
  82. package/dist/{setup-utils-DBOw3lnu.js → setup-utils-D5SquGvT.js} +3 -3
  83. package/dist/{setup-utils-DBOw3lnu.js.map → setup-utils-D5SquGvT.js.map} +1 -1
  84. package/dist/{start-playground-Uf3nte-P.js → start-playground-C__Gy1yk.js} +29 -14
  85. package/dist/start-playground-C__Gy1yk.js.map +1 -0
  86. package/dist/{subagent-DYza5kN6.js → subagent-DaSkUEg7.js} +3 -3
  87. package/dist/{subagent-DYza5kN6.js.map → subagent-DaSkUEg7.js.map} +1 -1
  88. package/dist/{task-CiStV2CD.js → task-Bv_o-lNo.js} +14 -14
  89. package/dist/{task-CiStV2CD.js.map → task-Bv_o-lNo.js.map} +1 -1
  90. package/dist/{telemetry-DLLuQiCt.js → telemetry-d_03gIpQ.js} +2 -2
  91. package/dist/{telemetry-DLLuQiCt.js.map → telemetry-d_03gIpQ.js.map} +1 -1
  92. package/dist/{terminal-B4EXuZra.js → terminal-BLGYQpSO.js} +583 -341
  93. package/dist/terminal-BLGYQpSO.js.map +1 -0
  94. package/dist/{tools-M5ENAiPc.js → tools-BE4Et6sl.js} +8 -8
  95. package/dist/{tools-M5ENAiPc.js.map → tools-BE4Et6sl.js.map} +1 -1
  96. package/dist/{tools-BTAi_RrA.js → tools-C8-l1rBv.js} +14 -14
  97. package/dist/{tools-BTAi_RrA.js.map → tools-C8-l1rBv.js.map} +1 -1
  98. package/dist/{tui-DigZ-Q1i.js → tui-DivYObcb.js} +5 -5
  99. package/dist/{tui-DigZ-Q1i.js.map → tui-DivYObcb.js.map} +1 -1
  100. package/dist/{tui-DU9MmsAK.js → tui-Zdby16pT.js} +1 -1
  101. package/dist/{upload-step-VNWq-3aL.js → upload-step-BfAUAEYC.js} +3 -3
  102. package/dist/{upload-step-VNWq-3aL.js.map → upload-step-BfAUAEYC.js.map} +1 -1
  103. package/dist/{urls-Bgngk5HI.js → urls-CvKF1P3f.js} +2 -2
  104. package/dist/{urls-Bgngk5HI.js.map → urls-CvKF1P3f.js.map} +1 -1
  105. package/dist/{wizard-abort-CdKk1lpi.js → wizard-abort-DTn9HFAi.js} +4 -4
  106. package/dist/{wizard-abort-CdKk1lpi.js.map → wizard-abort-DTn9HFAi.js.map} +1 -1
  107. package/dist/{yara-hooks-DPqy6eVo.js → yara-hooks-CA_ZEpAV.js} +4 -4
  108. package/dist/{yara-hooks-DPqy6eVo.js.map → yara-hooks-CA_ZEpAV.js.map} +1 -1
  109. package/dist/{yara-hooks-DCgSsXFP.js → yara-hooks-DXIqi0Km.js} +1 -1
  110. package/package.json +1 -1
  111. package/dist/PickerMenu-BtheKi1o.js.map +0 -1
  112. package/dist/agent-interface-D8mrarFD.js.map +0 -1
  113. package/dist/analytics-DgLAjlIK.js +0 -2
  114. package/dist/api-BphZo4f2.js +0 -2
  115. package/dist/api-key-login-BEi3wymJ.js +0 -2
  116. package/dist/bounded-fs-BENh-Jzc.js.map +0 -1
  117. package/dist/debug-C_9xDg9j.js.map +0 -1
  118. package/dist/install-Dayhuaun.js.map +0 -1
  119. package/dist/programs-7aIrstFy.js.map +0 -1
  120. package/dist/programs-B9Iu3Mye.js +0 -3
  121. package/dist/provisioning-BG_lh4hk.js +0 -2
  122. package/dist/run-tool-BXpuefYa.js +0 -2
  123. package/dist/start-playground-Uf3nte-P.js.map +0 -1
  124. package/dist/terminal-B4EXuZra.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-IvnTzMlR.js","names":["fs","path","fs","path","os","path","fs","os","PLUGIN_MARKETPLACE","PLUGIN_MARKETPLACE_SOURCE","PLUGIN_REF","EXPECTED_FAILURES","RUN_TIMEOUT_MS","MAX_OUTPUT_BYTES","path","os","fs","reportSpawnFailure","z","fs","path","os","z","fs","path","os","reportFailure","path","fs","z","path","fs","os"],"sources":["../src/shared/mcp-clients/MCPClient.ts","../src/shared/mcp-clients/clients/cursor.ts","../src/shared/mcp-clients/trusted-binary.ts","../src/shared/mcp-clients/clients/claude-code.ts","../src/shared/mcp-clients/clients/claude-web.ts","../src/shared/mcp-clients/clients/chatgpt-web.ts","../src/shared/mcp-clients/clients/visual-studio-code.ts","../src/shared/mcp-clients/clients/zed.ts","../src/shared/mcp-clients/clients/codex.ts","../src/shared/mcp-clients/clients/opencode.ts","../src/shared/mcp-clients/plugin-client.ts","../src/shared/mcp-clients/install.ts"],"sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as jsonc from 'jsonc-parser';\nimport { getDefaultServerConfig } from './defaults';\nimport type { InstallResult } from './results';\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<InstallResult>;\n abstract removeServer(local?: boolean): Promise<InstallResult>;\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 selectedFeatures?: string[],\n local?: boolean,\n ): MCPServerConfig {\n return getDefaultServerConfig(apiKey, 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<InstallResult> {\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 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\n // An identical entry means this config is already set up — leave the file\n // untouched and report it, so a re-run says \"already installed\" instead of\n // claiming a write that changed nothing. A differing entry (new features,\n // new key) still gets overwritten and reported as installed.\n const existingServerConfig = typedConfig[serverPropertyName][serverName];\n if (\n existingServerConfig !== undefined &&\n JSON.stringify(existingServerConfig) === JSON.stringify(newServerConfig)\n ) {\n return { success: true, alreadyInstalled: true };\n }\n\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 (error) {\n return {\n success: false,\n reason: error instanceof Error ? error.message : String(error),\n };\n }\n }\n\n async removeServer(local?: boolean): Promise<InstallResult> {\n let configPath = '';\n try {\n configPath = await this.getConfigPath();\n\n if (!fs.existsSync(configPath)) {\n return { success: true, alreadyInstalled: true };\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 // No PostHog entry to delete — the config changed under us between the\n // detection pass and now. Nothing failed, so don't report a failure.\n return { success: true, alreadyInstalled: true };\n } catch (error) {\n return {\n success: false,\n reason: `${configPath}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n };\n }\n }\n}\n","import {\n DefaultMCPClient,\n MCPServerConfig,\n} from '@shared/mcp-clients/MCPClient';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport {\n DefaultMCPClientConfig,\n getNativeHTTPServerConfig,\n} from '@shared/mcp-clients/defaults';\nimport { z } from 'zod';\n\nexport const CursorMCPConfig = DefaultMCPClientConfig;\n\nexport type CursorMCPConfig = z.infer<typeof DefaultMCPClientConfig>;\n\nexport class CursorMCPClient extends DefaultMCPClient {\n name = 'Cursor';\n\n constructor() {\n super();\n }\n\n async isClientSupported(): Promise<boolean> {\n if (process.platform !== 'darwin' && process.platform !== 'win32') {\n return false;\n }\n // Cursor creates ~/.cursor on first launch; without it, it isn't installed.\n return fs.existsSync(path.dirname(await this.getConfigPath()));\n }\n\n async getConfigPath(): Promise<string> {\n return Promise.resolve(path.join(os.homedir(), '.cursor', 'mcp.json'));\n }\n\n getServerConfig(\n apiKey: string | undefined,\n selectedFeatures?: string[],\n local?: boolean,\n ): MCPServerConfig {\n return getNativeHTTPServerConfig(apiKey, selectedFeatures, local);\n }\n}\n","/**\n * Find an MCP client's CLI on PATH without trusting copies the current project\n * can plant. `npx` puts the project's `node_modules/.bin` on PATH, and a\n * repository can check one in, so a bare `command -v codex` can resolve to\n * repository code that then runs as the user.\n */\n\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport * as path from 'path';\nimport { runtimeEnv } from '@env';\n\nconst NODE_BIN = `${path.sep}node_modules${path.sep}.bin`;\n\nconst realOrResolved = (p: string): string => {\n try {\n return fs.realpathSync(p);\n } catch {\n return path.resolve(p);\n }\n};\n\n/** Whether `child` is `parent` or somewhere under it. */\nconst isWithin = (child: string, parent: string): boolean => {\n const rel = path.relative(parent, child);\n return rel === '' || (!rel.startsWith('..') && !path.isAbsolute(rel));\n};\n\nconst inNodeBin = (p: string): boolean =>\n p.endsWith(NODE_BIN) || p.includes(`${NODE_BIN}${path.sep}`);\n\n/**\n * The directory whose files count as the project's: the working directory,\n * unless it is the home directory or above it, where everything the user\n * installed under `~` would otherwise count as untrusted.\n */\nconst projectRoot = (): string | null => {\n const cwd = realOrResolved(process.cwd());\n return isWithin(realOrResolved(os.homedir()), cwd) ? null : cwd;\n};\n\n/**\n * The real path of the first executable `name` on PATH that the project can't\n * have placed there: relative PATH entries, `node_modules/.bin` folders, and\n * files (or symlink targets) inside the project are skipped, and the search\n * moves on to the next PATH entry. Null when there is none.\n */\nexport function findTrustedBinary(name: string): string | null {\n const root = projectRoot();\n for (const dir of (runtimeEnv('PATH') ?? '').split(path.delimiter)) {\n if (!dir || !path.isAbsolute(dir) || inNodeBin(dir)) continue;\n const file = path.join(dir, name);\n let real: string;\n try {\n if (!fs.statSync(file).isFile()) continue;\n fs.accessSync(file, fs.constants.X_OK);\n real = fs.realpathSync(file);\n } catch {\n continue;\n }\n if (inNodeBin(path.dirname(real))) continue;\n if (root && (isWithin(file, root) || isWithin(real, root))) continue;\n return real;\n }\n return null;\n}\n","import { DefaultMCPClient } from '@shared/mcp-clients/MCPClient';\nimport {\n DefaultMCPClientConfig,\n buildMCPUrl,\n} from '@shared/mcp-clients/defaults';\nimport {\n PluginCapable,\n PluginInstallResult,\n} from '@shared/mcp-clients/plugin-client';\nimport {\n reportSpawnFailure,\n redactSecrets,\n scrubHomePaths,\n type ExpectedFailure,\n type InstallResult,\n} from '@shared/mcp-clients/results';\nimport { LoginCapable } from '@shared/mcp-clients/login-client';\nimport { z } from 'zod';\nimport { execFileSync, execFile } from 'child_process';\nimport { findTrustedBinary } from '@shared/mcp-clients/trusted-binary';\nimport { logToFile } from '@utils/debug';\nimport * as os from 'os';\nimport * as path from 'path';\nimport * as fs from 'fs';\n\nexport const ClaudeCodeMCPConfig = DefaultMCPClientConfig;\n\nexport type ClaudeCodeMCPConfig = z.infer<typeof DefaultMCPClientConfig>;\n\n// `plugin install <name>` only resolves against marketplaces the user already\n// registered, and the wizard never opens Claude Code interactively — so without\n// the add below the install dies with `not found in any configured marketplace`.\n// Our own marketplace, not Anthropic's: that one carries us as a pinned sha, so\n// installing through it would gate plugin releases on Anthropic bumping the pin.\nconst PLUGIN_NAME = 'posthog';\nconst PLUGIN_MARKETPLACE = 'posthog';\nconst PLUGIN_MARKETPLACE_SOURCE = 'PostHog/ai-plugin';\nconst PLUGIN_REF = `${PLUGIN_NAME}@${PLUGIN_MARKETPLACE}`;\n\n/** The plugin is missing from every catalog the CLI can currently see. */\nconst NOT_IN_A_MARKETPLACE = /not found in/i;\n\n/**\n * What a failing `claude` call was doing, for hint scoping and for the report.\n * A union rather than loose strings: a hint scoped to a stage nobody passes is\n * silently dead.\n */\ntype ClaudeCodeStage =\n | 'MCP add'\n | 'MCP remove'\n | 'plugin install'\n | 'plugin uninstall';\n\n/**\n * Failures in the user's own environment during `plugin install`. Reporting\n * them files issues nobody can action, so hand back a hint instead.\n */\ninterface ClaudeCodeExpectedFailure extends ExpectedFailure {\n stages?: ClaudeCodeStage[];\n}\n\nconst EXPECTED_FAILURES: ClaudeCodeExpectedFailure[] = [\n {\n // Only the user-level file: a project settings file is not one we can name.\n match:\n /invalid JSON syntax in settings file at ~[\\\\/]\\.claude[\\\\/]settings\\.json/i,\n stages: ['plugin install'],\n hint: 'Claude Code could not read its settings — fix the invalid JSON in ~/.claude/settings.json, then retry',\n },\n];\n\n/** One `plugin list --json` row; the CLI returns more fields than we read. */\ninterface ListedPlugin {\n /** `<plugin>@<marketplace>`, e.g. `posthog@posthog`. */\n id: string;\n /**\n * A plugin disabled in `/plugin` stays listed with `enabled: false`. It is\n * still installed, but it contributes no MCP server, so treating it as\n * installed reports \"you are good to go\" with nothing serving posthog.\n */\n enabled?: boolean;\n}\n\ninterface ListedMarketplace {\n name: string;\n /**\n * `owner/repo`, present since the CLI started emitting `--json`. A\n * marketplace merely *named* `posthog` may be someone else's, and installing\n * from it would ship a different plugin under our name.\n */\n repo?: string;\n}\n\ntype ClaudeRun = { ok: boolean; output: string };\n\n/**\n * `plugin marketplace add` clones a git repository, the slowest thing we run.\n * Past this the command is not slow, it is stuck, and a clone waiting on a\n * credential prompt would otherwise hang the wizard with the spinner frozen.\n */\nconst RUN_TIMEOUT_MS = 120_000;\n\n/**\n * `execFile` kills the child once output passes this. The default is 1 MB,\n * which a verbose clone can reach, and the kill then looks like Claude Code\n * rejecting the install rather than us cutting it off.\n */\nconst MAX_OUTPUT_BYTES = 16 * 1024 * 1024;\n\n/**\n * Our catalog, by name *and* repository. A marketplace merely called `posthog`\n * may be someone else's, and neither installing from it nor removing it is\n * ours to do. `repo` is absent on CLIs predating it, where the name is all\n * there is.\n */\nconst isOurMarketplace = (m: ListedMarketplace | undefined): boolean =>\n m?.name === PLUGIN_MARKETPLACE &&\n (m.repo === undefined ||\n m.repo.toLowerCase() === PLUGIN_MARKETPLACE_SOURCE.toLowerCase());\n\nexport class ClaudeCodeMCPClient\n extends DefaultMCPClient\n implements PluginCapable, LoginCapable\n{\n name = 'Claude Code';\n private claudeBinaryPath: string | null = null;\n\n constructor() {\n super();\n }\n\n private findClaudeBinary(): string | null {\n if (this.claudeBinaryPath) {\n return this.claudeBinaryPath;\n }\n\n // Common installation paths for Claude Code CLI\n const possiblePaths = [\n path.join(os.homedir(), '.claude', 'local', 'claude'),\n '/usr/local/bin/claude',\n '/opt/homebrew/bin/claude',\n ];\n\n for (const claudePath of possiblePaths) {\n if (fs.existsSync(claudePath)) {\n logToFile(` Found claude binary at: ${claudePath}`);\n this.claudeBinaryPath = claudePath;\n return claudePath;\n }\n }\n\n // PATH as fallback, skipping copies the project could have planted.\n const onPath = findTrustedBinary('claude');\n if (onPath) {\n logToFile(` Found claude in PATH at: ${onPath}`);\n this.claudeBinaryPath = onPath;\n }\n return onPath;\n }\n\n isClientSupported(): Promise<boolean> {\n try {\n logToFile(' Checking for Claude Code...');\n const claudeBinary = this.findClaudeBinary();\n\n if (!claudeBinary) {\n logToFile(' Claude Code not found. Installation paths checked:');\n logToFile(\n ` - ${path.join(os.homedir(), '.claude', 'local', 'claude')}`,\n );\n logToFile(` - /usr/local/bin/claude`);\n logToFile(` - /opt/homebrew/bin/claude`);\n logToFile(` - PATH`);\n return Promise.resolve(false);\n }\n\n const output = execFileSync(claudeBinary, ['--version'], {\n stdio: 'pipe',\n });\n const version = output.toString().trim();\n logToFile(` Claude Code detected: ${version}`);\n return Promise.resolve(true);\n } catch (error) {\n logToFile(\n ` Claude Code check failed: ${\n error instanceof Error ? error.message : String(error)\n }`,\n );\n return Promise.resolve(false);\n }\n }\n\n isServerInstalled(local?: boolean): Promise<boolean> {\n const binary = this.findClaudeBinary();\n if (!binary) return Promise.resolve(false);\n const serverName = local ? 'posthog-local' : 'posthog';\n // `mcp get <name>` exits non-zero when the entry doesn't exist. A substring\n // scan of `mcp list` also matches the claude.ai \"PostHog\" connector and the\n // plugin's `plugin:posthog:posthog`, reporting installed forever.\n try {\n execFileSync(binary, ['mcp', 'get', serverName], { stdio: 'pipe' });\n return Promise.resolve(true);\n } catch {\n return Promise.resolve(false);\n }\n }\n\n getConfigPath(): Promise<string> {\n throw new Error('Not implemented');\n }\n\n addServer(\n apiKey?: string,\n selectedFeatures?: string[],\n local?: boolean,\n ): Promise<InstallResult> {\n const binary = this.findClaudeBinary();\n if (!binary)\n return Promise.resolve({\n success: false,\n reason: 'The claude CLI is no longer on your PATH.',\n });\n\n const serverName = local ? 'posthog-local' : 'posthog';\n const url = buildMCPUrl(selectedFeatures, local);\n const args = [\n 'mcp',\n 'add',\n '--transport',\n 'http',\n '--scope',\n 'user',\n serverName,\n url,\n ];\n if (apiKey) {\n args.push('--header', `Authorization: Bearer ${apiKey}`);\n }\n\n try {\n execFileSync(binary, args, { stdio: 'pipe' });\n return Promise.resolve({ success: true });\n } catch (error) {\n // The failing command echoes back the Authorization header we passed, so\n // redact before this reaches a log, the screen, or an exception report.\n const msg = redactSecrets(\n error instanceof Error ? error.message : String(error),\n );\n if (msg.includes('already exists')) {\n return Promise.resolve({ success: true, alreadyInstalled: true });\n }\n return Promise.resolve(\n reportSpawnFailure<ClaudeCodeStage>({\n client: this.name,\n stage: 'MCP add',\n details: msg,\n table: EXPECTED_FAILURES,\n }),\n );\n }\n }\n\n /** Claude Code's own login runs its OAuth and owns the token; the wizard only surfaces the command. */\n loginCommand(local?: boolean): string {\n return `claude mcp login ${local ? 'posthog-local' : 'posthog'}`;\n }\n\n /** The plugin bundles its own `posthog` server, addressed as `plugin:<plugin>:<server>`. */\n pluginLoginCommand(): string {\n return 'claude mcp login plugin:posthog:posthog';\n }\n\n async removePlugin(): Promise<PluginInstallResult> {\n const binary = this.findClaudeBinary();\n if (!binary)\n return {\n success: false,\n reason: 'The claude CLI is no longer on your PATH.',\n };\n\n // `plugin uninstall posthog` removes exactly one match, so with both\n // `posthog@posthog` and `posthog@claude-plugins-official` installed the bare\n // call leaves the other copy enabled — and `mcp remove` would be lying.\n const ids = await this.installedPluginIds(binary);\n // `installPlugin` registers the marketplace, so removal owes the user the\n // other half: a machine left with our catalog and no plugin is a state the\n // wizard created. `codex.ts` clears both on the same call.\n const marketplace = await this.ourMarketplaceRegistered(binary);\n\n const nothingInstalled =\n ids?.length === 0 || (ids === null && !(await this.isPluginInstalled()));\n if (nothingInstalled && !marketplace) {\n return { success: true, alreadyInstalled: true };\n }\n\n const targets = nothingInstalled ? [] : ids?.length ? ids : [PLUGIN_NAME];\n const failures: string[] = [];\n for (const target of targets) {\n const run = await this.runClaude(binary, ['plugin', 'uninstall', target]);\n if (!run.ok) failures.push(`${target}: ${run.output}`);\n }\n\n // Only when we know it is there: `marketplace remove` exits non-zero on a\n // marketplace that is absent, which would report a failure for a no-op.\n if (marketplace) {\n const run = await this.runClaude(binary, [\n 'plugin',\n 'marketplace',\n 'remove',\n PLUGIN_MARKETPLACE,\n ]);\n if (!run.ok) failures.push(`${PLUGIN_MARKETPLACE}: ${run.output}`);\n }\n\n if (failures.length === 0) return { success: true };\n\n const reason = failures.join('; ');\n return reportSpawnFailure<ClaudeCodeStage>({\n client: this.name,\n stage: 'plugin uninstall',\n details: reason,\n table: EXPECTED_FAILURES,\n });\n }\n\n removeServer(local?: boolean): Promise<InstallResult> {\n const claudeBinary = this.findClaudeBinary();\n if (!claudeBinary) {\n return Promise.resolve({\n success: false,\n reason: 'The claude CLI is no longer on your PATH.',\n });\n }\n\n const serverName = local ? 'posthog-local' : 'posthog';\n\n try {\n execFileSync(\n claudeBinary,\n ['mcp', 'remove', '--scope', 'user', serverName],\n {\n stdio: 'pipe',\n },\n );\n } catch (error) {\n const reason = redactSecrets(\n error instanceof Error ? error.message : String(error),\n );\n // Removing something that isn't there is the requested end state, not a\n // failure to report.\n if (/no( such)? mcp server|not found/i.test(reason)) {\n return Promise.resolve({ success: true, alreadyInstalled: true });\n }\n return Promise.resolve(\n reportSpawnFailure<ClaudeCodeStage>({\n client: this.name,\n stage: 'MCP remove',\n details: reason,\n table: EXPECTED_FAILURES,\n }),\n );\n }\n\n return Promise.resolve({ success: true });\n }\n\n /** The plugin ships mcp.json with the posthog server — no direct entry needed. */\n pluginBundlesMcpServer(): boolean {\n return true;\n }\n\n supportsPlugin(): boolean {\n return this.findClaudeBinary() !== null;\n }\n\n // Async on purpose: these calls clone git repos and take seconds, and\n // execSync would block the event loop and freeze the TUI spinner. Never\n // throws; the caller decides what a failure means.\n private runClaude(binary: string, args: string[]): Promise<ClaudeRun> {\n return new Promise((resolve) => {\n execFile(\n binary,\n args,\n { timeout: RUN_TIMEOUT_MS, maxBuffer: MAX_OUTPUT_BYTES },\n (error, stdout) => {\n if (!error)\n return resolve({ ok: true, output: stdout?.toString() ?? '' });\n if (error.code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER')\n return resolve({\n ok: false,\n output:\n 'claude produced more output than the wizard can hold, so it was stopped',\n });\n if (error.killed || error.signal)\n return resolve({\n ok: false,\n output: `claude did not finish within ${\n RUN_TIMEOUT_MS / 1000\n }s, so it was stopped`,\n });\n // execFile puts `Command failed: <cmd>` and stderr in the message, the\n // same text execSync produced, so failure matching is unchanged.\n resolve({\n ok: false,\n output: scrubHomePaths(redactSecrets(error.message)),\n });\n },\n );\n });\n }\n\n /** Null when `--json` is unsupported, the command failed, or output didn't parse — never \"nothing installed\". */\n private async listJson<T>(\n binary: string,\n args: string[],\n ): Promise<T[] | null> {\n const result = await this.runClaude(binary, [...args, '--json']);\n if (!result.ok) return null;\n try {\n const parsed: unknown = JSON.parse(result.output);\n return Array.isArray(parsed) ? (parsed as T[]) : null;\n } catch {\n return null;\n }\n }\n\n // Every installed copy, from any marketplace: Claude Code permits\n // `posthog@posthog` and `posthog@claude-plugins-official` at the same time.\n // Null means the probe is unavailable, which is not the same as none.\n private async installedPlugins(\n binary: string,\n ): Promise<ListedPlugin[] | null> {\n const listed = await this.listJson<ListedPlugin>(binary, [\n 'plugin',\n 'list',\n ]);\n if (!listed) return null;\n return listed.filter(\n (p): p is ListedPlugin =>\n typeof p?.id === 'string' && p.id.split('@')[0] === PLUGIN_NAME,\n );\n }\n\n private async installedPluginIds(binary: string): Promise<string[] | null> {\n const listed = await this.installedPlugins(binary);\n return listed?.map((p) => p.id) ?? null;\n }\n\n async isPluginInstalled(): Promise<boolean> {\n const binary = this.findClaudeBinary();\n if (!binary) return false;\n\n // Presence, not health: `index.ts` asks this to decide whether there is\n // anything to remove, and a disabled plugin still has to be uninstalled.\n // Whether it actually serves is `installPlugin`'s question, not this one.\n const listed = await this.installedPlugins(binary);\n if (listed) return listed.length > 0;\n\n // Older CLI without `--json`. A substring scan also matches a plugin merely\n // named `posthog-something`, which is why it's the fallback and not the path.\n const plain = await this.runClaude(binary, ['plugin', 'list']);\n return plain.ok && plain.output.toLowerCase().includes(PLUGIN_NAME);\n }\n\n async installPlugin(): Promise<PluginInstallResult> {\n const binary = this.findClaudeBinary();\n if (!binary)\n return {\n success: false,\n reason: 'The claude CLI is no longer on your PATH.',\n };\n\n // Ask before installing so a re-run reports \"already installed\" rather than\n // relying on the CLI's error text to spot the no-op.\n //\n // A plugin disabled in `/plugin` is installed but serves nothing, and\n // Claude Code takes its MCP server from the plugin. Reporting it as\n // already installed leaves the user with no server and a screen saying\n // they are done, so fall through and install: the CLI re-enables it.\n const listed = await this.installedPlugins(binary);\n const serving = listed\n ? listed.some((p) => p.enabled !== false)\n : await this.isPluginInstalled();\n if (serving) {\n return { success: true, alreadyInstalled: true };\n }\n\n const marketplaceFailure = await this.ensurePluginMarketplace(binary);\n\n let result = await this.runClaude(binary, [\n 'plugin',\n 'install',\n PLUGIN_REF,\n ]);\n\n // A registered but stale catalog still reports the plugin as missing.\n if (!result.ok && NOT_IN_A_MARKETPLACE.test(result.output)) {\n await this.runClaude(binary, [\n 'plugin',\n 'marketplace',\n 'update',\n PLUGIN_MARKETPLACE,\n ]);\n result = await this.runClaude(binary, ['plugin', 'install', PLUGIN_REF]);\n }\n\n // Last resort: let Claude Code resolve the bare name against whatever the\n // user does have, the way the wizard always did. Never worse than before.\n if (!result.ok && NOT_IN_A_MARKETPLACE.test(result.output)) {\n result = await this.runClaude(binary, ['plugin', 'install', PLUGIN_NAME]);\n }\n\n if (result.ok) return { success: true };\n\n const msg = result.output;\n if (msg.includes('already installed') || msg.includes('already exists')) {\n return { success: true, alreadyInstalled: true };\n }\n // `not found in any configured marketplace` is also what the pre-PR bug\n // produced, so the marketplace-add failure travels beside it to tell the\n // two apart.\n return reportSpawnFailure<ClaudeCodeStage>({\n client: this.name,\n stage: 'plugin install',\n details: msg,\n table: EXPECTED_FAILURES,\n extra: marketplaceFailure ? { marketplaceFailure } : undefined,\n });\n }\n\n // Best-effort: a failure here only matters if the install also fails, since\n // the user may hold the plugin in another catalog that the fallback finds.\n /** Registered, and ours: a catalog merely named `posthog` is someone else's. */\n private async ourMarketplaceRegistered(\n binary: string,\n ): Promise<boolean | null> {\n const listed = await this.listJson<ListedMarketplace>(binary, [\n 'plugin',\n 'marketplace',\n 'list',\n ]);\n return listed ? listed.some(isOurMarketplace) : null;\n }\n\n private async ensurePluginMarketplace(\n binary: string,\n ): Promise<string | undefined> {\n const listed = await this.listJson<ListedMarketplace>(binary, [\n 'plugin',\n 'marketplace',\n 'list',\n ]);\n if (listed?.some(isOurMarketplace)) {\n logToFile(` Marketplace ${PLUGIN_MARKETPLACE} already registered`);\n return undefined;\n }\n\n // `marketplace add` is idempotent on Claude Code and exits 0 when the\n // marketplace is already on disk, so there's no \"already added\" text to\n // special-case here — unlike the Codex CLI, where it exits non-zero.\n const added = await this.runClaude(binary, [\n 'plugin',\n 'marketplace',\n 'add',\n PLUGIN_MARKETPLACE_SOURCE,\n ]);\n if (!added.ok) {\n logToFile(` Marketplace add failed: ${added.output}`);\n return added.output;\n }\n return undefined;\n }\n}\n","import { MCPClient } from '@shared/mcp-clients/MCPClient';\nimport type { InstallResult } from '@shared/mcp-clients/results';\nimport { BrowserFinishable } from '@shared/mcp-clients/browser-client';\nimport { openTrackedLink } from '@utils/links';\n\n/**\n * Claude Desktop / Claude.ai (web). PostHog ships here as a hosted connector,\n * not a local config — so instead of writing files we open the connector\n * directory page and let the user sign in and click \"Connect\".\n */\nexport class ClaudeWebMCPClient extends MCPClient implements BrowserFinishable {\n name = 'Claude Desktop/Web';\n connectorUrl = 'https://claude.ai/directory/connectors/posthog';\n finishInstruction = 'Sign in and click \"Connect\" to finish.';\n\n isClientSupported(): Promise<boolean> {\n // Browser-based — available on every platform.\n return Promise.resolve(true);\n }\n\n isServerInstalled(): Promise<boolean> {\n // The connector lives in the user's Claude account; nothing local to\n // inspect. Returning false also keeps it out of `mcp remove`.\n return Promise.resolve(false);\n }\n\n addServer(): Promise<InstallResult> {\n // Not a PostHog property, so no UTMs — just the tracked open.\n openTrackedLink(this.connectorUrl, 'claude-web-connector', {\n auto: true,\n skipUtm: true,\n });\n return Promise.resolve({ success: true });\n }\n\n removeServer(): Promise<InstallResult> {\n // The connector lives in the user's Claude account, so `mcp remove` can't\n // touch it. It never reaches here today (isServerInstalled is always\n // false), but say where to go if it ever does.\n return Promise.resolve({\n success: false,\n reason:\n 'This connector is managed in your Claude account — remove it at claude.ai/settings/connectors.',\n });\n }\n\n getConfigPath(): Promise<string> {\n throw new Error('Not implemented');\n }\n\n getServerPropertyName(): string {\n throw new Error('Not implemented');\n }\n}\n\nexport default ClaudeWebMCPClient;\n","import { MCPClient } from '@shared/mcp-clients/MCPClient';\nimport type { InstallResult } from '@shared/mcp-clients/results';\nimport { BrowserFinishable } from '@shared/mcp-clients/browser-client';\nimport { openTrackedLink } from '@utils/links';\n\n/**\n * ChatGPT (web and desktop). PostHog ships here as a listing in the ChatGPT\n * plugin directory, installed into the user's ChatGPT account — so instead of\n * writing files we open the listing and let the user install and connect it.\n */\nexport class ChatGptWebMCPClient\n extends MCPClient\n implements BrowserFinishable\n{\n name = 'ChatGPT';\n connectorUrl =\n 'https://chatgpt.com/plugins/plugin_asdk_app_699caef2d680819188727b0ddbb349dd';\n finishInstruction = 'Press + to install, then connect PostHog when asked.';\n\n isClientSupported(): Promise<boolean> {\n // Browser-based — available on every platform.\n return Promise.resolve(true);\n }\n\n isServerInstalled(): Promise<boolean> {\n // The plugin lives in the user's ChatGPT account; nothing local to\n // inspect. Returning false also keeps it out of `mcp remove`.\n return Promise.resolve(false);\n }\n\n addServer(): Promise<InstallResult> {\n // Not a PostHog property, so no UTMs — just the tracked open.\n openTrackedLink(this.connectorUrl, 'chatgpt-plugin', {\n auto: true,\n skipUtm: true,\n });\n return Promise.resolve({ success: true });\n }\n\n removeServer(): Promise<InstallResult> {\n // Never reached today (isServerInstalled is always false), but say where\n // to go if it ever is.\n return Promise.resolve({\n success: false,\n reason:\n 'This plugin is managed in your ChatGPT account — remove it from the Plugins tab in ChatGPT.',\n });\n }\n\n getConfigPath(): Promise<string> {\n throw new Error('Not implemented');\n }\n\n getServerPropertyName(): string {\n throw new Error('Not implemented');\n }\n}\n\nexport default ChatGptWebMCPClient;\n","import z from 'zod';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport {\n DefaultMCPClient,\n MCPServerConfig,\n} from '@shared/mcp-clients/MCPClient';\nimport { getNativeHTTPServerConfig } from '@shared/mcp-clients/defaults';\nimport { runtimeEnv } from '@env';\n\nexport const VisualStudioCodeMCPConfig = z\n .object({\n servers: z.record(\n z.string(),\n z.union([\n z.object({\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.string()).optional(),\n }),\n z.object({\n type: z.enum(['http', 'sse']),\n url: z.string(),\n headers: z.record(z.string(), z.string()).optional(),\n }),\n ]),\n ),\n })\n .passthrough();\n\nexport type VisualStudioCodeMCPConfig = z.infer<\n typeof VisualStudioCodeMCPConfig\n>;\n\nexport class VisualStudioCodeClient extends DefaultMCPClient {\n name = 'Visual Studio Code';\n\n getServerPropertyName(): string {\n return 'servers';\n }\n\n async isClientSupported(): Promise<boolean> {\n if (!['darwin', 'win32', 'linux'].includes(process.platform)) return false;\n // VS Code creates its Code/User folder on first launch; without it, it isn't installed.\n return fs.existsSync(path.dirname(await this.getConfigPath()));\n }\n\n async getConfigPath(): Promise<string> {\n const homeDir = os.homedir();\n const isWindows = process.platform === 'win32';\n const isMac = process.platform === 'darwin';\n const isLinux = process.platform === 'linux';\n\n if (isMac) {\n return Promise.resolve(\n path.join(\n homeDir,\n 'Library',\n 'Application Support',\n 'Code',\n 'User',\n 'mcp.json',\n ),\n );\n }\n\n if (isWindows) {\n return Promise.resolve(\n path.join(runtimeEnv('APPDATA') || '', 'Code', 'User', 'mcp.json'),\n );\n }\n\n if (isLinux) {\n return Promise.resolve(\n path.join(homeDir, '.config', 'Code', 'User', 'mcp.json'),\n );\n }\n\n throw new Error(`Unsupported platform: ${process.platform}`);\n }\n\n getServerConfig(\n apiKey: string | undefined,\n selectedFeatures?: string[],\n local?: boolean,\n ): MCPServerConfig {\n return {\n type: 'http',\n ...getNativeHTTPServerConfig(apiKey, selectedFeatures, local),\n };\n }\n}\n","import z from 'zod';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport {\n DefaultMCPClient,\n MCPServerConfig,\n} from '@shared/mcp-clients/MCPClient';\nimport { getNativeHTTPServerConfig } from '@shared/mcp-clients/defaults';\nimport { runtimeEnv } from '@env';\n\nexport const ZedMCPConfig = z\n .object({\n context_servers: z.record(\n z.string(),\n z.union([\n z.object({\n enabled: z.boolean().optional(),\n source: z.string().optional(),\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), z.string()).optional(),\n }),\n z.object({\n enabled: z.boolean().optional(),\n url: z.string(),\n headers: z.record(z.string(), z.string()).optional(),\n }),\n ]),\n ),\n })\n .passthrough();\n\nexport type ZedMCPConfig = z.infer<typeof ZedMCPConfig>;\n\nexport class ZedClient extends DefaultMCPClient {\n name = 'Zed';\n\n getServerPropertyName(): string {\n return 'context_servers';\n }\n\n async isClientSupported(): Promise<boolean> {\n if (process.platform !== 'darwin' && process.platform !== 'linux') {\n return false;\n }\n // Zed creates its config folder on first launch; without it, it isn't installed.\n return fs.existsSync(path.dirname(await this.getConfigPath()));\n }\n\n async getConfigPath(): Promise<string> {\n const homeDir = os.homedir();\n const isMac = process.platform === 'darwin';\n const isLinux = process.platform === 'linux';\n\n if (isMac) {\n return Promise.resolve(\n path.join(homeDir, '.config', 'zed', 'settings.json'),\n );\n }\n\n if (isLinux) {\n // https://zed.dev/docs/configuring-zed#settings-files\n const xdgConfigHome = runtimeEnv('XDG_CONFIG_HOME');\n if (xdgConfigHome) {\n return Promise.resolve(\n path.join(xdgConfigHome, 'zed', 'settings.json'),\n );\n }\n return Promise.resolve(\n path.join(homeDir, '.config', 'zed', 'settings.json'),\n );\n }\n\n throw new Error(`Unsupported platform: ${process.platform}`);\n }\n\n getServerConfig(\n apiKey: string | undefined,\n selectedFeatures?: string[],\n local?: boolean,\n ): MCPServerConfig {\n return {\n enabled: true,\n ...getNativeHTTPServerConfig(apiKey, selectedFeatures, local),\n };\n }\n}\n","import { z } from 'zod';\nimport { execFile, type ExecFileException } from 'node:child_process';\nimport { findTrustedBinary } from '@shared/mcp-clients/trusted-binary';\nimport * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport * as path from 'node:path';\n\nimport { LoginCapable } from '@shared/mcp-clients/login-client';\nimport { DefaultMCPClient } from '@shared/mcp-clients/MCPClient';\nimport {\n DefaultMCPClientConfig,\n buildMCPUrl,\n} from '@shared/mcp-clients/defaults';\nimport {\n PluginCapable,\n PluginInstallResult,\n} from '@shared/mcp-clients/plugin-client';\nimport {\n redactSecrets,\n scrubHomePaths,\n reportSpawnFailure as reportFailure,\n type ExpectedFailure,\n type InstallResult,\n} from '@shared/mcp-clients/results';\n\nimport { analytics } from '@utils/analytics';\n\nconst PLUGIN_MARKETPLACE = 'posthog';\nconst PLUGIN_MARKETPLACE_SOURCE = 'PostHog/ai-plugin';\nconst PLUGIN_REF = `posthog@${PLUGIN_MARKETPLACE}`;\n\n/**\n * The plugin's row in `codex plugin list`, whose STATUS column reads\n * `installed, enabled` or `not installed`. Registering the marketplace only\n * publishes the catalog, so the marketplace section in config.toml says nothing\n * about whether the plugin itself is there.\n */\nconst listedAsInstalled = (stdout: string): boolean => {\n const row = new RegExp(`^${PLUGIN_REF}\\\\s+(.*)$`, 'm').exec(stdout)?.[1];\n return !!row && /\\binstalled\\b/.test(row) && !/\\bnot installed\\b/.test(row);\n};\n\n/**\n * What `reportSpawnFailure` was doing, for hint scoping and for the report.\n * A union rather than loose strings: a hint scoped to a stage nobody passes is\n * silently dead, which is how `marketplace add` lost its hint the first time.\n */\ntype CodexStage =\n | 'MCP add'\n | 'MCP remove'\n | 'plugin install'\n | 'plugin uninstall'\n | 'marketplace add';\n\nconst PLUGIN_STAGES: CodexStage[] = [\n 'plugin install',\n 'plugin uninstall',\n 'marketplace add',\n];\nconst MCP_STAGES: CodexStage[] = ['MCP add', 'MCP remove'];\nconst ALL_STAGES: CodexStage[] = [...PLUGIN_STAGES, ...MCP_STAGES];\n\n/**\n * Wording that proves the file codex choked on is the plugin's, not the user's.\n * Serde phrasing alone (\"invalid type\", \"is no longer supported\") says nothing\n * about whose file it came from, and blaming `~/.codex/config.toml` for our own\n * broken manifest sends the user to edit a file that is fine.\n */\nconst OUR_MANIFEST =\n /ai-plugin|plugin\\.toml|plugin\\.json|marketplace\\.toml|posthog@posthog/i;\n\n/**\n * Failures in the user's own environment. Reporting them files issues nobody\n * can action, so hand back a hint instead. Drawn from what the codex install\n * path actually produced in the field.\n *\n * Every entry is scoped: a hint that fires on the wrong stage tells the user to\n * run a command that has nothing to do with what just failed.\n */\nconst EXPECTED_FAILURES: ExpectedFailure[] = [\n {\n // `plugin`/`marketplace` subcommands a pre-plugin codex doesn't have.\n match:\n /unexpected argument|unknown (command|option|argument)|Missing option/i,\n stages: PLUGIN_STAGES,\n hint: 'your codex CLI is too old for plugins — update codex, then run `codex plugin marketplace add PostHog/ai-plugin`',\n },\n {\n // The same wording during `mcp add` is a flag we passed, not a plugin\n // subcommand, so the plugin advice above would send the user nowhere.\n match:\n /unexpected argument|unknown (command|option|argument)|Missing option/i,\n stages: MCP_STAGES,\n hint: 'your codex CLI is too old for this install — update codex, then run `npx @posthog/wizard mcp add` again',\n },\n {\n match: /ENOENT|not found in PATH|spawn .* ENOENT/i,\n stages: ALL_STAGES,\n hint: 'your codex install looks broken — reinstall codex, then run `codex plugin marketplace add PostHog/ai-plugin`',\n },\n {\n // Either codex says outright that it could not load its configuration, or\n // serde phrasing appears alongside `config.toml`. Bare serde wording cannot\n // tell the user's file from the plugin's, and `config.toml` on its own\n // silences any failure that merely mentions the path — both send someone to\n // edit a file that is fine, so the ambiguous case stays reportable.\n match:\n /failed to load (bootstrap )?configuration|OPENAI_API_KEY|Missing OpenAI API key|(?=[\\s\\S]*config\\.toml)[\\s\\S]*(invalid type|unknown field|is no longer supported|must contain at least one)/i,\n stages: ALL_STAGES,\n unless: OUR_MANIFEST,\n hint: 'codex could not read its own config — fix what it reports in ~/.codex/config.toml, then retry',\n },\n {\n match:\n /EACCES|EPERM|permission denied|read-only file system|not permitted/i,\n stages: ALL_STAGES,\n // git says `Permission denied (publickey)` when an SSH clone of the\n // marketplace cannot authenticate to GitHub. Nothing on ~/.codex is wrong\n // there, so the hint below would send the user to chmod a directory that\n // is already fine while the real cause goes unreported.\n unless: /permission denied \\((?:publickey|password|gssapi)/i,\n hint: 'codex could not write to its config — fix the permissions on ~/.codex, then retry',\n },\n {\n match: /ENOSPC|no space left/i,\n stages: ALL_STAGES,\n hint: 'the disk is full — free some space, then retry',\n },\n {\n // A clone that fails because the repo is missing is our publishing problem,\n // not the user's network, and telling them to check their connection buries\n // a renamed or deleted PostHog/ai-plugin where nobody will see it.\n match:\n /git clone .* failed|ENOTFOUND|ETIMEDOUT|ECONNREFUSED|could not resolve host/i,\n stages: ALL_STAGES,\n unless:\n /repository not found|not found|404|does not exist|authentication failed/i,\n hint: 'codex could not reach GitHub to download the plugin — check your network, then retry',\n },\n];\n\ninterface CodexRun {\n ok: boolean;\n /** Never blank on a failure: the cause, or the exit status when there is none. */\n output: string;\n}\n\n/**\n * A clone of the plugin marketplace is the slowest thing we run. Past this the\n * command is not slow, it is stuck, and the wizard should say so rather than\n * wait forever.\n */\nconst RUN_TIMEOUT_MS = 120_000;\n\n/**\n * `execFile` kills the child once output passes this. The default is 1 MB,\n * which a verbose clone can reach, and the kill then looks like codex rejecting\n * the install rather than us cutting it off.\n */\nconst MAX_OUTPUT_BYTES = 16 * 1024 * 1024;\n\n/**\n * What `execFile` puts in `error.message` when the command itself never spoke:\n * the full binary path and arguments. That path contains the user's home\n * directory, so reporting it fingerprints one root cause per machine — the\n * failure this reporting was built to stop. Never send it onward.\n */\nconst COMMAND_FAILED_PREAMBLE = /^Command failed:.*$/m;\n\n/**\n * The cause when neither stream carried one. `execFile` always sets a message,\n * so there is no \"empty error\" case to fall through — the message just isn't\n * usable as it stands.\n */\nconst describeExecFailure = (error: ExecFileException): string => {\n if (error.code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER')\n return 'codex produced more output than the wizard can hold, so it was stopped';\n if (error.killed)\n return `codex did not finish within ${\n RUN_TIMEOUT_MS / 1000\n }s, so it was stopped`;\n if (error.signal) return `codex was killed by ${error.signal}`;\n\n const said = error.message.replace(COMMAND_FAILED_PREAMBLE, '').trim();\n if (said) return said;\n if (typeof error.code === 'number')\n return `codex exited with code ${error.code}`;\n if (error.code) return `codex failed with ${error.code}`;\n return 'codex failed without reporting a reason';\n};\n\n/**\n * One codex invocation. Async on purpose: `plugin marketplace add` and\n * `plugin add` clone git repositories and take seconds, and a synchronous child\n * process blocks the event loop, which freezes the TUI spinner on its first\n * frame. Never throws; the caller decides what a failure means.\n *\n * A failure's cause is split across the error and the two streams, and none of\n * them carries it when the process merely exits non-zero — reading one alone\n * reported a blank reason and filed an exception carrying nothing.\n */\nconst runCodex = (\n binary: string,\n args: string[],\n env?: NodeJS.ProcessEnv,\n): Promise<CodexRun> =>\n new Promise((resolve) => {\n const child = execFile(\n binary,\n args,\n { env, timeout: RUN_TIMEOUT_MS, maxBuffer: MAX_OUTPUT_BYTES },\n (error, stdout, stderr) => {\n if (!error) return resolve({ ok: true, output: stdout ?? '' });\n // stderr first: it carries what codex actually said, and the TUI shows\n // the first line. `error.message` leads with our own invocation, so\n // preferring it would show the user the command instead of the cause.\n const said = [stderr, stdout]\n .map((p) => (p ? String(p).trim() : ''))\n .filter(Boolean)\n .join('\\n');\n // A kill is ours, not codex's, so it outranks whatever the streams got\n // out before we cut them off.\n const stopped =\n error.killed ||\n !!error.signal ||\n error.code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER';\n resolve({\n ok: false,\n output: redactSecrets(\n stopped || !said ? describeExecFailure(error) : said,\n ),\n });\n },\n );\n // codex asks for nothing on stdin here. Leaving the pipe open means a\n // command that does ask waits on input that never comes, and the promise\n // never settles. `spawnSync` closed it for us.\n child.stdin?.end();\n });\n\nconst reportSpawnFailure = (\n stage: CodexStage,\n details: string,\n): InstallResult =>\n reportFailure({ client: 'Codex', stage, details, table: EXPECTED_FAILURES });\n\n/** Wording codex uses when the thing we're adding is already registered. */\nconst ALREADY_INSTALLED_PATTERN =\n /already (installed|exists|added|registered)/i;\n/** Wording that means the opposite: a cache entry exists but the plugin doesn't. */\nconst STALE_MARKETPLACE_CACHE = /already added from a different source/i;\n\n/**\n * Codex allows servers 10s to finish the MCP initialize handshake, and a remote\n * OAuth handshake can exceed that on a cold start — the \"servers were not\n * initialized\" warning.\n */\nconst STARTUP_TIMEOUT_SEC = 30;\n\n/**\n * The server's table header. TOML accepts a bare or quoted key for the same\n * table, and matching only the bare form means we append a second definition of\n * a table that already exists — a duplicate-key error that takes the user's\n * whole config down, not just PostHog's entry.\n */\nconst sectionHeader = (serverName: string): RegExp =>\n new RegExp(\n `^\\\\[mcp_servers\\\\.(?:${serverName}|\"${serverName}\")\\\\][ \\\\t]*$`,\n 'm',\n );\n\n/**\n * Set `key = value` inside a section body, inserting it when absent. Scans the\n * whole body rather than the line after the header: TOML does not care about\n * key order, and assuming it does means silently matching nothing.\n */\nconst setKey = (body: string, key: string, value: string): string => {\n const existing = new RegExp(`^[ \\\\t]*${key}[ \\\\t]*=.*$`, 'm');\n return existing.test(body)\n ? body.replace(existing, `${key} = ${value}`)\n : `\\n${key} = ${value}${body}`;\n};\n\nexport const CodexMCPConfig = DefaultMCPClientConfig;\n\nexport type CodexMCPConfig = z.infer<typeof DefaultMCPClientConfig>;\n\nexport class CodexMCPClient\n extends DefaultMCPClient\n implements PluginCapable, LoginCapable\n{\n name = 'Codex';\n private codexBinaryPath: string | null = null;\n\n constructor() {\n super();\n }\n\n private findCodexBinary(): string | null {\n if (this.codexBinaryPath) return this.codexBinaryPath;\n this.codexBinaryPath = findTrustedBinary('codex');\n return this.codexBinaryPath;\n }\n\n private configPath(): string {\n return path.join(os.homedir(), '.codex', 'config.toml');\n }\n\n isClientSupported(): Promise<boolean> {\n return Promise.resolve(this.findCodexBinary() !== null);\n }\n\n getConfigPath(): Promise<string> {\n throw new Error('Not implemented');\n }\n\n isServerInstalled(local?: boolean): Promise<boolean> {\n const serverName = local ? 'posthog-local' : 'posthog';\n // The `[mcp_servers.<name>]` section in config.toml — both the CLI and the\n // desktop app read (and `codex mcp add` writes) this file, and a substring\n // scan of `mcp list` matches unrelated posthog-ish servers.\n try {\n const contents = fs.readFileSync(this.configPath(), 'utf-8');\n return Promise.resolve(sectionHeader(serverName).test(contents));\n } catch {\n return Promise.resolve(false);\n }\n }\n\n async addServer(\n apiKey?: string,\n selectedFeatures?: string[],\n local?: boolean,\n ): Promise<InstallResult> {\n const serverName = local ? 'posthog-local' : 'posthog';\n const url = buildMCPUrl(selectedFeatures, local);\n\n // Api-key installs go through the CLI for its bearer-token env wiring.\n if (apiKey) {\n const binary = this.findCodexBinary();\n if (!binary)\n return {\n success: false,\n reason: 'An API-key install into Codex needs the codex CLI.',\n };\n const args = [\n 'mcp',\n 'add',\n serverName,\n '--url',\n url,\n '--bearer-token-env-var',\n 'POSTHOG_AUTH_HEADER',\n ];\n const env = { ...process.env, POSTHOG_AUTH_HEADER: `Bearer ${apiKey}` };\n const result = await runCodex(binary, args, env);\n if (!result.ok) {\n if (ALREADY_INSTALLED_PATTERN.test(result.output)) {\n return { success: true, alreadyInstalled: true };\n }\n return reportSpawnFailure('MCP add', result.output);\n }\n return { success: true };\n }\n\n // OAuth installs write config.toml directly: running `codex mcp add` here\n // would hang the wizard on its built-in OAuth browser wait. Codex nags\n // about the unauthenticated server until the surfaced `codex mcp login`\n // runs — the same interim state as Claude Code's \"needs authentication\".\n return this.writeServerSection(serverName, url);\n }\n\n /**\n * Create or update the `[mcp_servers.<name>]` section in config.toml, editing\n * in place so the user's other servers, key order, and comments survive.\n */\n private writeServerSection(serverName: string, url: string): InstallResult {\n const configPath = this.configPath();\n try {\n // A machine that has codex installed but has never run it has no\n // ~/.codex at all — `codex mcp add` used to create it for us.\n fs.mkdirSync(path.dirname(configPath), { recursive: true });\n const contents = fs.existsSync(configPath)\n ? fs.readFileSync(configPath, 'utf-8')\n : '';\n\n const header = sectionHeader(serverName).exec(contents);\n if (!header) {\n const gap = contents === '' || contents.endsWith('\\n\\n') ? '' : '\\n';\n const pad = contents === '' || contents.endsWith('\\n') ? '' : '\\n';\n this.write(\n configPath,\n `${contents}${pad}${gap}[mcp_servers.${serverName}]\\n` +\n `url = \"${url}\"\\nstartup_timeout_sec = ${STARTUP_TIMEOUT_SEC}\\n`,\n );\n return { success: true };\n }\n\n // Everything up to the next table header belongs to this server.\n const start = header.index + header[0].length;\n const rest = contents.slice(start);\n const next = /^\\[/m.exec(rest);\n const end = next ? start + next.index : contents.length;\n\n const body = contents.slice(start, end);\n const updated = setKey(\n setKey(body, 'url', `\"${url}\"`),\n 'startup_timeout_sec',\n String(STARTUP_TIMEOUT_SEC),\n );\n if (updated === body) return { success: true, alreadyInstalled: true };\n\n this.write(\n configPath,\n contents.slice(0, start) + updated + contents.slice(end),\n );\n return { success: true };\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n // Constant message, varying detail in properties: the reason carries the\n // config path, so interpolating it filed one issue per user.\n analytics.captureException(new Error('Codex config.toml write failed'), {\n details: scrubHomePaths(reason),\n });\n return { success: false, reason };\n }\n }\n\n /** Write via a sibling temp file: a crash mid-write must not truncate the config. */\n private write(configPath: string, contents: string): void {\n const tmp = `${configPath}.wizard-tmp`;\n fs.writeFileSync(tmp, contents);\n fs.renameSync(tmp, configPath);\n }\n\n /** Codex's own login runs its OAuth and owns the token; the wizard only surfaces the command. */\n loginCommand(local?: boolean): string | null {\n if (!this.findCodexBinary()) return null;\n return `codex mcp login ${local ? 'posthog-local' : 'posthog'}`;\n }\n\n async removeServer(local?: boolean): Promise<InstallResult> {\n const binary = this.findCodexBinary();\n if (!binary)\n return {\n success: false,\n reason: 'The codex CLI is no longer on your PATH.',\n };\n\n // `local` was ignored here, so `mcp remove --local` reported success while\n // leaving the posthog-local server in place.\n const serverName = local ? 'posthog-local' : 'posthog';\n const result = await runCodex(binary, ['mcp', 'remove', serverName]);\n\n if (!result.ok) {\n return reportSpawnFailure('MCP remove', result.output);\n }\n\n return { success: true };\n }\n\n /** The codex marketplace plugin ships skills only — the MCP server needs its own entry. */\n pluginBundlesMcpServer(): boolean {\n return false;\n }\n\n supportsPlugin(): boolean {\n return this.findCodexBinary() !== null;\n }\n\n /** The plugin itself, as the CLI reports it. The install decision's question. */\n private async isPluginPresent(): Promise<boolean> {\n const binary = this.findCodexBinary();\n if (!binary) return false;\n const result = await runCodex(binary, [\n 'plugin',\n 'list',\n '-m',\n PLUGIN_MARKETPLACE,\n ]);\n return result.ok && listedAsInstalled(result.output);\n }\n\n /**\n * Anything of ours left on the machine, which is what `index.ts` asks before\n * offering removal. A registered marketplace with no plugin is a state the\n * wizard created — and the state this branch exists to correct — so removal\n * has to see it, or `removePlugin` never runs and the catalog stays forever.\n */\n async isPluginInstalled(): Promise<boolean> {\n return (await this.isPluginPresent()) || this.isMarketplaceRegistered();\n }\n\n /** The catalog, which the plugin is installed *from* — not the plugin. */\n private isMarketplaceRegistered(): boolean {\n try {\n const contents = fs.readFileSync(this.configPath(), 'utf-8');\n return contents\n .toLowerCase()\n .includes(`[marketplaces.${PLUGIN_MARKETPLACE}]`);\n } catch {\n return false;\n }\n }\n\n async removePlugin(): Promise<PluginInstallResult> {\n const binary = this.findCodexBinary();\n if (!binary)\n return {\n success: false,\n reason: 'The codex CLI is no longer on your PATH.',\n };\n\n // Both halves are removed, and either alone is enough to act on: a user\n // left with a registered marketplace and no plugin still needs it cleared.\n const steps: string[][] = [];\n if (await this.isPluginPresent())\n steps.push(['plugin', 'remove', PLUGIN_REF]);\n if (this.isMarketplaceRegistered())\n steps.push(['plugin', 'marketplace', 'remove', PLUGIN_MARKETPLACE]);\n\n if (steps.length === 0) return { success: true, alreadyInstalled: true };\n\n for (const args of steps) {\n const result = await runCodex(binary, args);\n if (!result.ok) {\n return reportSpawnFailure('plugin uninstall', result.output);\n }\n }\n return { success: true };\n }\n\n async installPlugin(): Promise<PluginInstallResult> {\n const binary = this.findCodexBinary();\n if (!binary)\n return {\n success: false,\n reason: 'The codex CLI is no longer on your PATH.',\n };\n\n // The plugin, not the catalog: a registered marketplace with no plugin is\n // exactly the broken state this installs over, so asking the wider question\n // here would skip the install and leave it broken.\n if (await this.isPluginPresent()) {\n return { success: true, alreadyInstalled: true };\n }\n\n // `codex plugin marketplace add` exits non-zero once the marketplace is\n // registered, so ask config.toml first. Without this the second run of\n // `mcp add` looked like a failure and reported nothing at all.\n const marketplace = this.isMarketplaceRegistered()\n ? null\n : await this.registerMarketplace(binary);\n if (marketplace && !marketplace.success) return marketplace;\n\n // Registering the catalog does not install from it. Skipping this left the\n // user with a marketplace, no skills, and a wizard reporting success.\n const result = await runCodex(binary, ['plugin', 'add', PLUGIN_REF]);\n\n if (!result.ok) {\n // The listing above can report \"not installed\" when it merely failed to\n // run, and every other spawn here reads codex's own wording rather than\n // turning a no-op into a reported failure.\n if (ALREADY_INSTALLED_PATTERN.test(result.output)) {\n return { success: true, alreadyInstalled: true };\n }\n return reportSpawnFailure('plugin install', result.output);\n }\n\n return { success: true };\n }\n\n /**\n * Add the catalog the plugin is published in. A stale cache directory with no\n * config.toml entry reports the marketplace as added from a different source;\n * clear it and retry once.\n */\n private async registerMarketplace(\n binary: string,\n ): Promise<PluginInstallResult> {\n const run = () =>\n runCodex(binary, [\n 'plugin',\n 'marketplace',\n 'add',\n PLUGIN_MARKETPLACE_SOURCE,\n ]);\n\n let result = await run();\n\n if (!result.ok && STALE_MARKETPLACE_CACHE.test(result.output)) {\n const staleDir = path.join(\n os.homedir(),\n '.codex',\n '.tmp',\n 'marketplaces',\n PLUGIN_MARKETPLACE,\n );\n try {\n fs.rmSync(staleDir, { recursive: true, force: true });\n } catch {\n // ignore — retry anyway\n }\n result = await run();\n }\n\n if (!result.ok) {\n const details = result.output;\n // Registered by something other than us — the plugin add below can still\n // resolve against it. The stale-cache wording is excluded: that one means\n // the marketplace is NOT usable, and only reaches here if the retry failed.\n if (\n ALREADY_INSTALLED_PATTERN.test(details) &&\n !STALE_MARKETPLACE_CACHE.test(details)\n ) {\n return { success: true };\n }\n return reportSpawnFailure('marketplace add', details);\n }\n return { success: true };\n }\n}\n\nexport default CodexMCPClient;\n","import z from 'zod';\nimport * as path from 'path';\nimport * as os from 'os';\nimport * as fs from 'fs';\nimport { findTrustedBinary } from '@shared/mcp-clients/trusted-binary';\nimport {\n DefaultMCPClient,\n MCPServerConfig,\n} from '@shared/mcp-clients/MCPClient';\nimport { getNativeHTTPServerConfig } from '@shared/mcp-clients/defaults';\nimport { runtimeEnv } from '@env';\n\nexport const OpenCodeMCPConfig = z\n .object({\n mcp: z.record(\n z.string(),\n z.object({\n type: z.literal('remote'),\n url: z.string(),\n headers: z.record(z.string(), z.string()).optional(),\n }),\n ),\n })\n .passthrough();\n\nexport type OpenCodeMCPConfig = z.infer<typeof OpenCodeMCPConfig>;\n\nexport class OpenCodeMCPClient extends DefaultMCPClient {\n name = 'OpenCode';\n private opencodeBinaryPath: string | null = null;\n\n override getServerPropertyName(): string {\n return 'mcp';\n }\n\n private findOpenCodeBinary(): string | null {\n if (this.opencodeBinaryPath) return this.opencodeBinaryPath;\n this.opencodeBinaryPath = findTrustedBinary('opencode');\n return this.opencodeBinaryPath;\n }\n\n isClientSupported(): Promise<boolean> {\n return Promise.resolve(this.findOpenCodeBinary() !== null);\n }\n\n getConfigPath(): Promise<string> {\n const configDir = this.resolveConfigDir();\n const jsoncPath = path.join(configDir, 'opencode.jsonc');\n const jsonPath = path.join(configDir, 'opencode.json');\n if (fs.existsSync(jsoncPath)) return Promise.resolve(jsoncPath);\n return Promise.resolve(jsonPath);\n }\n\n private resolveConfigDir(): string {\n const envDir = runtimeEnv('OPENCODE_CONFIG_DIR');\n if (envDir) return envDir;\n\n const xdgHome = runtimeEnv('XDG_CONFIG_HOME');\n if (xdgHome) return path.join(xdgHome, 'opencode');\n\n return path.join(os.homedir(), '.config', 'opencode');\n }\n\n override getServerConfig(\n apiKey: string | undefined,\n selectedFeatures?: string[],\n local?: boolean,\n ): MCPServerConfig {\n return {\n type: 'remote',\n ...getNativeHTTPServerConfig(apiKey, selectedFeatures, local),\n };\n }\n}\n","import type { InstallResult } from './results';\n\nexport type PluginInstallResult = InstallResult;\n\nexport interface PluginCapable {\n supportsPlugin(): boolean;\n isPluginInstalled(): Promise<boolean>;\n installPlugin(): Promise<PluginInstallResult>;\n /** Uninstall the plugin. Absent when the client CLI has no uninstall surface. */\n removePlugin?(): Promise<PluginInstallResult>;\n /** True when the plugin ships its own posthog MCP server, making a direct entry redundant. */\n pluginBundlesMcpServer(): boolean;\n}\n\nexport function isPluginCapable<T>(client: T): client is T & PluginCapable {\n return (\n typeof client === 'object' &&\n client !== null &&\n 'supportsPlugin' in client &&\n 'installPlugin' in client\n );\n}\n","// The MCP client operations every MCP surface shares: detect, add, remove or check, one result per client.\nimport { logToFile } from '../utils/debug';\nimport { MCPClient } from './MCPClient';\nimport { CursorMCPClient } from './clients/cursor';\nimport { ClaudeCodeMCPClient } from './clients/claude-code';\nimport { ClaudeWebMCPClient } from './clients/claude-web';\nimport { ChatGptWebMCPClient } from './clients/chatgpt-web';\nimport { VisualStudioCodeClient } from './clients/visual-studio-code';\nimport { ZedClient } from './clients/zed';\nimport { CodexMCPClient } from './clients/codex';\nimport { OpenCodeMCPClient } from './clients/opencode';\nimport { isPluginCapable, PluginCapable } from './plugin-client';\nimport { toClientResult, type McpClientResult } from './results';\n\nexport const getSupportedClients = async (): Promise<MCPClient[]> => {\n const allClients = [\n new ClaudeCodeMCPClient(),\n new ClaudeWebMCPClient(),\n new ChatGptWebMCPClient(),\n new CodexMCPClient(),\n new CursorMCPClient(),\n new VisualStudioCodeClient(),\n new ZedClient(),\n new OpenCodeMCPClient(),\n ];\n const supportedClients: MCPClient[] = [];\n\n logToFile('Checking for supported MCP clients...');\n for (const client of allClients) {\n const isSupported = await client.isClientSupported();\n logToFile(\n `${client.name}: ${isSupported ? '✓ supported' : '✗ not supported'}`,\n );\n if (isSupported) {\n supportedClients.push(client);\n }\n }\n logToFile(\n `Found ${supportedClients.length} supported client(s): ${supportedClients\n .map((c) => c.name)\n .join(', ')}`,\n );\n\n return supportedClients;\n};\n\nexport const getInstalledClients = async (\n local?: boolean,\n): Promise<MCPClient[]> => {\n const clients = await getSupportedClients();\n const installedClients: MCPClient[] = [];\n\n for (const client of clients) {\n // The plugin bundles its own posthog MCP server, so for removal purposes a\n // plugin install counts as installed even with no config entry (`--local`\n // targets only the local-dev entry and leaves the plugin alone).\n const pluginInstalled =\n !local && isPluginCapable(client) && (await client.isPluginInstalled());\n if ((await client.isServerInstalled(local)) || pluginInstalled) {\n installedClients.push(client);\n }\n }\n\n return installedClients;\n};\n\nexport const addMCPServer = async (\n clients: MCPClient[],\n personalApiKey?: string,\n selectedFeatures?: string[],\n local?: boolean,\n): Promise<McpClientResult[]> => {\n const results: McpClientResult[] = [];\n for (const client of clients) {\n try {\n const result = await client.addServer(\n personalApiKey,\n selectedFeatures,\n local,\n );\n results.push(toClientResult(client.name, result));\n } catch (err) {\n logToFile(`[addMCPServer] addServer threw for ${client.name}: ${err}`);\n results.push(\n toClientResult(client.name, {\n success: false,\n reason: err instanceof Error ? err.message : String(err),\n }),\n );\n }\n }\n return results;\n};\n\nexport const getSupportedPluginClients = (\n clients: MCPClient[],\n): Array<MCPClient & PluginCapable> => {\n return clients.filter(isPluginCapable).filter((c) => c.supportsPlugin());\n};\n\nexport const installPlugins = async (\n clients: Array<MCPClient & PluginCapable>,\n): Promise<McpClientResult[]> => {\n const results: McpClientResult[] = [];\n for (const client of clients) {\n try {\n results.push(toClientResult(client.name, await client.installPlugin()));\n } catch (err) {\n logToFile(\n `[installPlugins] installPlugin threw for ${client.name}: ${err}`,\n );\n results.push(\n toClientResult(client.name, {\n success: false,\n reason: err instanceof Error ? err.message : String(err),\n }),\n );\n }\n }\n return results;\n};\n\nexport const removeMCPServer = async (\n clients: MCPClient[],\n local?: boolean,\n): Promise<McpClientResult[]> => {\n const results: McpClientResult[] = [];\n for (const client of clients) {\n try {\n let result = await client.removeServer(local);\n // The plugin bundles its own posthog server — leaving it installed makes\n // the removal a lie (`--local` never touches the plugin).\n if (!local && isPluginCapable(client) && client.removePlugin) {\n const plugin = await client.removePlugin();\n result =\n !result.success || !plugin.success\n ? {\n success: false,\n reason: [result.reason, plugin.reason]\n .filter(Boolean)\n .join('; '),\n }\n : {\n success: true,\n ...(result.alreadyInstalled && plugin.alreadyInstalled\n ? { alreadyInstalled: true }\n : {}),\n };\n }\n results.push(toClientResult(client.name, result));\n } catch (err) {\n logToFile(\n `[removeMCPServer] removeServer threw for ${client.name}: ${err}`,\n );\n results.push(\n toClientResult(client.name, {\n success: false,\n reason: err instanceof Error ? err.message : String(err),\n }),\n );\n }\n }\n return results;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,IAAsB,YAAtB,MAAgC;CAC9B;;AAaF,IAAsB,mBAAtB,cAA+C,UAAU;CACvD,OAAO;CAEP,cAAc;AACZ,SAAO;;CAGT,wBAAgC;AAC9B,SAAO;;CAGT,gBACE,QACA,kBACA,OACiB;AACjB,SAAO,uBAAuB,QAAQ,kBAAkB,MAAM;;CAGhE,MAAM,kBAAkB,OAAmC;AACzD,MAAI;GACF,MAAM,aAAa,MAAM,KAAK,eAAe;AAE7C,OAAI,CAACA,KAAG,WAAW,WAAW,CAC5B,QAAO;GAGT,MAAM,gBAAgB,MAAMA,KAAG,SAAS,SAAS,YAAY,OAAO;GACpE,MAAM,SAAS,MAAM,MAAM,cAAc;GACzC,MAAM,qBAAqB,KAAK,uBAAuB;GACvD,MAAM,aAAa,QAAQ,kBAAkB;AAE7C,UACE,sBAAsB,UAAU,cAAc,OAAO;UAEjD;AACN,UAAO;;;CAIX,MAAM,UACJ,QACA,kBACA,OACwB;AACxB,MAAI;GACF,MAAM,aAAa,MAAM,KAAK,eAAe;GAC7C,MAAM,YAAYC,OAAK,QAAQ,WAAW;AAE1C,SAAMD,KAAG,SAAS,MAAM,WAAW,EAAE,WAAW,MAAM,CAAC;GAEvD,MAAM,qBAAqB,KAAK,uBAAuB;GACvD,IAAI,gBAAgB;GACpB,IAAI,iBAAiB,EAAE;AAEvB,OAAIA,KAAG,WAAW,WAAW,EAAE;AAC7B,oBAAgB,MAAMA,KAAG,SAAS,SAAS,YAAY,OAAO;AAC9D,qBAAiB,MAAM,MAAM,cAAc,IAAI,EAAE;;GAGnD,MAAM,kBAAkB,KAAK,gBAC3B,QACA,kBACA,MACD;GACD,MAAM,cAAc;AACpB,OAAI,CAAC,YAAY,oBACf,aAAY,sBAAsB,EAAE;GAEtC,MAAM,aAAa,QAAQ,kBAA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,MAAa,iBAAiB,OAC5B,YAC+B;CAC/B,MAAM,UAA6B,EAAE;AACrC,MAAK,MAAM,UAAU,QACnB,KAAI;AACF,UAAQ,KAAK,eAAe,OAAO,MAAM,MAAM,OAAO,eAAe,CAAC,CAAC;UAChE,KAAK;AACZ,YACE,4CAA4C,OAAO,KAAK,IAAI,MAC7D;AACD,UAAQ,KACN,eAAe,OAAO,MAAM;GAC1B,SAAS;GACT,QAAQ,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;GACzD,CAAC,CACH;;AAGL,QAAO;;AAGT,MAAa,kBAAkB,OAC7B,SACA,UAC+B;CAC/B,MAAM,UAA6B,EAAE;AACrC,MAAK,MAAM,UAAU,QACnB,KAAI;EACF,IAAI,SAAS,MAAM,OAAO,aAAa,MAAM;AAG7C,MAAI,CAAC,SAAS,gBAAgB,OAAO,IAAI,OAAO,cAAc;GAC5D,MAAM,SAAS,MAAM,OAAO,cAAc;AAC1C,YACE,CAAC,OAAO,WAAW,CAAC,OAAO,UACvB;IACE,SAAS;IACT,QAAQ,CAAC,OAAO,QAAQ,OAAO,OAAO,CACnC,OAAO,QAAQ,CACf,KAAK,KAAK;IACd,GACD;IACE,SAAS;IACT,GAAI,OAAO,oBAAoB,OAAO,mBAClC,EAAE,kBAAkB,MAAM,GAC1B,EAAE;IACP;;AAET,UAAQ,KAAK,eAAe,OAAO,MAAM,OAAO,CAAC;UAC1C,KAAK;AACZ,YACE,4CAA4C,OAAO,KAAK,IAAI,MAC7D;AACD,UAAQ,KACN,eAAe,OAAO,MAAM;GAC1B,SAAS;GACT,QAAQ,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;GACzD,CAAC,CACH;;AAGL,QAAO"}
@@ -1,5 +1,5 @@
1
- import { a as runWizard } from "./runners-DxbNGuKH.js";
2
- import { t as config } from "./posthog-integration-4vQjbU-f.js";
1
+ import { a as runWizard } from "./runners-CVFLsNvO.js";
2
+ import { t as config } from "./posthog-integration-CuEK-hPp.js";
3
3
  //#region src/cli/commands/basic-integration/interactive.ts
4
4
  /** Default flow: run the posthog-integration program through the TUI. */
5
5
  function runInteractive(argv) {
@@ -8,4 +8,4 @@ function runInteractive(argv) {
8
8
  //#endregion
9
9
  export { runInteractive };
10
10
 
11
- //# sourceMappingURL=interactive-CjbttghI.js.map
11
+ //# sourceMappingURL=interactive-wm9OcauB.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-CjbttghI.js","names":["posthogIntegrationConfig"],"sources":["../src/cli/commands/basic-integration/interactive.ts"],"sourcesContent":["import type { Arguments } from 'yargs';\nimport { runWizard } from '@cli/runners';\nimport { config as posthogIntegrationConfig } from '@programs/posthog-integration';\n\n/** Default flow: run the posthog-integration program through the TUI. */\nexport function runInteractive(argv: Arguments): void {\n runWizard(posthogIntegrationConfig, argv);\n}\n"],"mappings":";;;;AAKA,SAAgB,eAAe,MAAuB;AACpD,WAAUA,QAA0B,KAAK"}
1
+ {"version":3,"file":"interactive-wm9OcauB.js","names":["posthogIntegrationConfig"],"sources":["../src/cli/commands/basic-integration/interactive.ts"],"sourcesContent":["import type { Arguments } from 'yargs';\nimport { runWizard } from '@cli/runners';\nimport { config as posthogIntegrationConfig } from '@programs/posthog-integration';\n\n/** Default flow: run the posthog-integration program through the TUI. */\nexport function runInteractive(argv: Arguments): void {\n runWizard(posthogIntegrationConfig, argv);\n}\n"],"mappings":";;;;AAKA,SAAgB,eAAe,MAAuB;AACpD,WAAUA,QAA0B,KAAK"}
@@ -1,5 +1,5 @@
1
- import "./debug-C_9xDg9j.js";
2
- import { n as analytics } from "./analytics-CX2kvq0R.js";
1
+ import "./debug-Bw13gmS3.js";
2
+ import { n as analytics } from "./analytics-CZNcNpiq.js";
3
3
  import opn from "opn";
4
4
  //#region src/shared/utils/links.ts
5
5
  /**
@@ -56,4 +56,4 @@ function openTrackedLink(url, content, opts) {
56
56
  //#endregion
57
57
  export { setEntryCommand as n, withUtm as r, openTrackedLink as t };
58
58
 
59
- //# sourceMappingURL=links-BOOGSL_G.js.map
59
+ //# sourceMappingURL=links-Cj6OQ9Kv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"links-BOOGSL_G.js","names":[],"sources":["../src/shared/utils/links.ts"],"sourcesContent":["/**\n * Outbound links: UTM tagging and tracked opens.\n *\n * Every URL the wizard sends a user to — auto-opened or printed in the TUI —\n * carries `utm_source=wizard`, `utm_medium=cli`, `utm_content=<which link>`.\n * The command dimension rides on every wizard event as the `command` tag.\n * Opening a link also captures a wizard event.\n */\nimport opn from 'opn';\nimport { NODE_ENV } from '@env';\nimport { analytics } from './analytics';\n\n/**\n * Record the CLI command this run was started with (e.g. `integrate`,\n * `slack`, `mcp-add`). Set once at dispatch; tagged onto every wizard\n * event so wizard-side events segment by command.\n */\nexport function setEntryCommand(command: string): void {\n analytics.setTag('command', command);\n}\n\n/**\n * Tag a URL with the wizard's UTM params. `content` names the specific link\n * (e.g. `oauth-signup`, `slack-connect-setup`). URLs that already carry a\n * utm_source — or don't parse — are returned untouched.\n */\nexport function withUtm(url: string, content: string): string {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return url;\n }\n if (parsed.searchParams.has('utm_source')) return url;\n parsed.searchParams.set('utm_source', 'wizard');\n parsed.searchParams.set('utm_medium', 'cli');\n parsed.searchParams.set('utm_content', content);\n return parsed.toString();\n}\n\n/**\n * Open a URL in the user's browser, UTM-tagged (pass `skipUtm` for\n * destinations that aren't PostHog properties or are already final), and\n * capture the interaction. `auto` marks opens the wizard initiated itself,\n * as opposed to a user picking a link on screen. opn throws in headless\n * environments — the URL is always also printed on screen, so the failure\n * is swallowed.\n */\nexport function openTrackedLink(\n url: string,\n content: string,\n opts?: { auto?: boolean; skipUtm?: boolean },\n): void {\n const finalUrl = opts?.skipUtm ? url : withUtm(url, content);\n analytics.wizardCapture('link opened', {\n content,\n url: finalUrl,\n auto: opts?.auto ?? false,\n });\n if (NODE_ENV !== 'test') {\n opn(finalUrl, { wait: false }).catch(() => {\n // No browser available — the printed URL is the fallback.\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAgB,gBAAgB,SAAuB;AACrD,WAAU,OAAO,WAAW,QAAQ;;;;;;;AAQtC,SAAgB,QAAQ,KAAa,SAAyB;CAC5D,IAAI;AACJ,KAAI;AACF,WAAS,IAAI,IAAI,IAAI;SACf;AACN,SAAO;;AAET,KAAI,OAAO,aAAa,IAAI,aAAa,CAAE,QAAO;AAClD,QAAO,aAAa,IAAI,cAAc,SAAS;AAC/C,QAAO,aAAa,IAAI,cAAc,MAAM;AAC5C,QAAO,aAAa,IAAI,eAAe,QAAQ;AAC/C,QAAO,OAAO,UAAU;;;;;;;;;;AAW1B,SAAgB,gBACd,KACA,SACA,MACM;CACN,MAAM,WAAW,MAAM,UAAU,MAAM,QAAQ,KAAK,QAAQ;AAC5D,WAAU,cAAc,eAAe;EACrC;EACA,KAAK;EACL,MAAM,MAAM,QAAQ;EACrB,CAAC;AAEA,KAAI,UAAU,EAAE,MAAM,OAAO,CAAC,CAAC,YAAY,GAEzC"}
1
+ {"version":3,"file":"links-Cj6OQ9Kv.js","names":[],"sources":["../src/shared/utils/links.ts"],"sourcesContent":["/**\n * Outbound links: UTM tagging and tracked opens.\n *\n * Every URL the wizard sends a user to — auto-opened or printed in the TUI —\n * carries `utm_source=wizard`, `utm_medium=cli`, `utm_content=<which link>`.\n * The command dimension rides on every wizard event as the `command` tag.\n * Opening a link also captures a wizard event.\n */\nimport opn from 'opn';\nimport { NODE_ENV } from '@env';\nimport { analytics } from './analytics';\n\n/**\n * Record the CLI command this run was started with (e.g. `integrate`,\n * `slack`, `mcp-add`). Set once at dispatch; tagged onto every wizard\n * event so wizard-side events segment by command.\n */\nexport function setEntryCommand(command: string): void {\n analytics.setTag('command', command);\n}\n\n/**\n * Tag a URL with the wizard's UTM params. `content` names the specific link\n * (e.g. `oauth-signup`, `slack-connect-setup`). URLs that already carry a\n * utm_source — or don't parse — are returned untouched.\n */\nexport function withUtm(url: string, content: string): string {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return url;\n }\n if (parsed.searchParams.has('utm_source')) return url;\n parsed.searchParams.set('utm_source', 'wizard');\n parsed.searchParams.set('utm_medium', 'cli');\n parsed.searchParams.set('utm_content', content);\n return parsed.toString();\n}\n\n/**\n * Open a URL in the user's browser, UTM-tagged (pass `skipUtm` for\n * destinations that aren't PostHog properties or are already final), and\n * capture the interaction. `auto` marks opens the wizard initiated itself,\n * as opposed to a user picking a link on screen. opn throws in headless\n * environments — the URL is always also printed on screen, so the failure\n * is swallowed.\n */\nexport function openTrackedLink(\n url: string,\n content: string,\n opts?: { auto?: boolean; skipUtm?: boolean },\n): void {\n const finalUrl = opts?.skipUtm ? url : withUtm(url, content);\n analytics.wizardCapture('link opened', {\n content,\n url: finalUrl,\n auto: opts?.auto ?? false,\n });\n if (NODE_ENV !== 'test') {\n opn(finalUrl, { wait: false }).catch(() => {\n // No browser available — the printed URL is the fallback.\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAgB,gBAAgB,SAAuB;AACrD,WAAU,OAAO,WAAW,QAAQ;;;;;;;AAQtC,SAAgB,QAAQ,KAAa,SAAyB;CAC5D,IAAI;AACJ,KAAI;AACF,WAAS,IAAI,IAAI,IAAI;SACf;AACN,SAAO;;AAET,KAAI,OAAO,aAAa,IAAI,aAAa,CAAE,QAAO;AAClD,QAAO,aAAa,IAAI,cAAc,SAAS;AAC/C,QAAO,aAAa,IAAI,cAAc,MAAM;AAC5C,QAAO,aAAa,IAAI,eAAe,QAAQ;AAC/C,QAAO,OAAO,UAAU;;;;;;;;;;AAW1B,SAAgB,gBACd,KACA,SACA,MACM;CACN,MAAM,WAAW,MAAM,UAAU,MAAM,QAAQ,KAAK,QAAQ;AAC5D,WAAU,cAAc,eAAe;EACrC;EACA,KAAK;EACL,MAAM,MAAM,QAAQ;EACrB,CAAC;AAEA,KAAI,UAAU,EAAE,MAAM,OAAO,CAAC,CAAC,YAAY,GAEzC"}
@@ -1,15 +1,15 @@
1
1
  import { n as ErrorCodes, t as emitWizardError } from "./emit-BqLCdV8Y.js";
2
- import { t as configureLogFile } from "./debug-C_9xDg9j.js";
3
- import { P as POSTHOG_DOCS_URL, at as getSkillsBaseUrl, dt as initLocalDev, ft as localMcpSkillsNotice, n as analytics } from "./analytics-CX2kvq0R.js";
4
- import { A as getProgramConfig, B as config$10, Ct as regionOption, E as Program, G as config$9, I as config$12, L as config$11, N as config$5, St as isHeadless, dt as config$3, et as config$8, ft as config$2, gt as CLI_STEERING_TARGETS, ht as createSkillProgram, mt as config, nt as config$6, pt as config$1, rt as config$4, tt as config$7, xt as headlessOption } from "./programs-7aIrstFy.js";
2
+ import { t as configureLogFile } from "./debug-Bw13gmS3.js";
3
+ import { P as POSTHOG_DOCS_URL, at as getSkillsBaseUrl, dt as initLocalDev, ft as localMcpSkillsNotice, n as analytics } from "./analytics-CZNcNpiq.js";
4
+ import { A as getProgramConfig, B as config$10, Ct as regionOption, E as Program, G as config$9, I as config$12, L as config$11, N as config$5, St as isHeadless, dt as config$3, et as config$8, ft as config$2, gt as CLI_STEERING_TARGETS, ht as createSkillProgram, mt as config, nt as config$6, pt as config$1, rt as config$4, tt as config$7, xt as headlessOption } from "./programs-T4EhU20m.js";
5
5
  import "./errors-BXlWujEw.js";
6
- import { n as setEntryCommand } from "./links-BOOGSL_G.js";
7
- import { a as runWizard, c as underSignals, i as readApiKeyFromEnv, l as withSignals, n as runWizardCI, o as tuiSessionArgs, s as exitWith, t as runWizardHeadless, u as isNonInteractiveEnvironment } from "./runners-DxbNGuKH.js";
6
+ import { n as setEntryCommand } from "./links-Cj6OQ9Kv.js";
7
+ import { a as runWizard, c as underSignals, i as readApiKeyFromEnv, l as withSignals, n as runWizardCI, o as tuiSessionArgs, s as exitWith, t as runWizardHeadless, u as isNonInteractiveEnvironment } from "./runners-CVFLsNvO.js";
8
8
  import { t as consoleLog } from "./console-log-BMhBoX-o.js";
9
- import { R as WIZARD_TOOL_NAMES, u as recoverOrphanedSettingsBackups } from "./agent-interface-D8mrarFD.js";
10
- import "./posthog-integration-4vQjbU-f.js";
11
- import { S as AUDIT_CHECKS_FILE, b as fetchSkillMenu } from "./yara-hooks-DPqy6eVo.js";
12
- import { a as runCliAdd, d as runDoctorReport, i as runProvision, o as addMCPServerToClientsStep, r as listSkills, s as removeMCPServerFromClientsStep, t as Tool, u as DOCTOR } from "./tools-BTAi_RrA.js";
9
+ import { R as WIZARD_TOOL_NAMES, u as recoverOrphanedSettingsBackups } from "./agent-interface-DuRXDmuv.js";
10
+ import "./posthog-integration-CuEK-hPp.js";
11
+ import { S as AUDIT_CHECKS_FILE, b as fetchSkillMenu } from "./yara-hooks-CA_ZEpAV.js";
12
+ import { a as runCliAdd, d as runDoctorReport, i as runProvision, o as addMCPServerToClientsStep, r as listSkills, s as removeMCPServerFromClientsStep, t as Tool, u as DOCTOR } from "./tools-C8-l1rBv.js";
13
13
  import { Agent, setGlobalDispatcher } from "undici";
14
14
  import yargs from "yargs";
15
15
  import { hideBin } from "yargs/helpers";
@@ -262,11 +262,11 @@ const basicIntegrationCommand = {
262
262
  setEntryCommand("integrate");
263
263
  (async () => {
264
264
  if (isHeadless(argv)) {
265
- const { runHeadlessInstall } = await import("./ci-install-DnjuAl1l.js");
265
+ const { runHeadlessInstall } = await import("./ci-install-BG77SHEw.js");
266
266
  return runHeadlessInstall(argv);
267
267
  }
268
268
  if (argv.ci) {
269
- const { runCIInstall } = await import("./ci-install-DnjuAl1l.js");
269
+ const { runCIInstall } = await import("./ci-install-BG77SHEw.js");
270
270
  return runCIInstall(argv);
271
271
  }
272
272
  if (isNonInteractiveEnvironment()) {
@@ -274,10 +274,10 @@ const basicIntegrationCommand = {
274
274
  return failNonInteractive();
275
275
  }
276
276
  if (argv.playground) {
277
- const { runPlayground } = await import("./playground-B0SpcGYQ.js");
277
+ const { runPlayground } = await import("./playground-DE_9g_nd.js");
278
278
  return runPlayground();
279
279
  }
280
- const { runInteractive } = await import("./interactive-CjbttghI.js");
280
+ const { runInteractive } = await import("./interactive-wm9OcauB.js");
281
281
  runInteractive(argv);
282
282
  })();
283
283
  }
@@ -333,7 +333,7 @@ function runMcpAdd(argv) {
333
333
  }
334
334
  exitWith(async () => {
335
335
  try {
336
- const { runTuiTool } = await import("./tui-DU9MmsAK.js");
336
+ const { runTuiTool } = await import("./tui-Zdby16pT.js");
337
337
  return await underSignals((signal) => runTuiTool(Tool.McpAdd, {
338
338
  session: {
339
339
  debug: argv.debug,
@@ -378,7 +378,7 @@ function runMcpRemove(argv) {
378
378
  }
379
379
  exitWith(async () => {
380
380
  try {
381
- const { runTuiTool } = await import("./tui-DU9MmsAK.js");
381
+ const { runTuiTool } = await import("./tui-Zdby16pT.js");
382
382
  return await underSignals((signal) => runTuiTool(Tool.McpRemove, {
383
383
  session: {
384
384
  debug: argv.debug,
@@ -408,7 +408,7 @@ const mcpTutorialCommand = {
408
408
  function runMcpTutorial(argv) {
409
409
  exitWith(async () => {
410
410
  try {
411
- const { runTuiTool } = await import("./tui-DU9MmsAK.js");
411
+ const { runTuiTool } = await import("./tui-Zdby16pT.js");
412
412
  return await underSignals((signal) => runTuiTool(Tool.McpTutorial, {
413
413
  session: {
414
414
  debug: argv.debug,
@@ -782,7 +782,7 @@ function orderFamilyChildren(children) {
782
782
  async function chooseFamilyChild(parentLabel, children) {
783
783
  const ordered = orderFamilyChildren(children);
784
784
  if (ordered.length === 0) return null;
785
- const { renderFamilyPicker } = await import("./tui-DU9MmsAK.js");
785
+ const { renderFamilyPicker } = await import("./tui-Zdby16pT.js");
786
786
  return renderFamilyPicker(parentLabel, ordered.map((child) => ({
787
787
  label: describe(child),
788
788
  value: child,
@@ -890,7 +890,7 @@ const doctorCommand = {
890
890
  return;
891
891
  }
892
892
  withSignals(async (signal) => {
893
- const { runTuiTool } = await import("./tui-DU9MmsAK.js");
893
+ const { runTuiTool } = await import("./tui-Zdby16pT.js");
894
894
  return runTuiTool(Tool.PosthogDoctor, {
895
895
  session: tuiSessionArgs(options),
896
896
  signal
@@ -973,7 +973,7 @@ const slackCommand = {
973
973
  function runSlackConnect(argv) {
974
974
  exitWith(async () => {
975
975
  try {
976
- const { runTuiTool } = await import("./tui-DU9MmsAK.js");
976
+ const { runTuiTool } = await import("./tui-Zdby16pT.js");
977
977
  return await underSignals((signal) => runTuiTool(Tool.SlackConnect, {
978
978
  session: {
979
979
  debug: argv.debug,
@@ -1139,4 +1139,4 @@ runCli();
1139
1139
  //#endregion
1140
1140
  export {};
1141
1141
 
1142
- //# sourceMappingURL=main-MzQaWN8w.js.map
1142
+ //# sourceMappingURL=main-SU6W6oek.js.map