@amplitude/wizard 1.0.0-beta.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 (333) hide show
  1. package/LICENSE +47 -0
  2. package/README.md +119 -0
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +763 -0
  5. package/dist/package.json +144 -0
  6. package/dist/src/frameworks/android/android-wizard-agent.d.ts +6 -0
  7. package/dist/src/frameworks/android/android-wizard-agent.js +72 -0
  8. package/dist/src/frameworks/android/utils.d.ts +11 -0
  9. package/dist/src/frameworks/android/utils.js +32 -0
  10. package/dist/src/frameworks/django/django-wizard-agent.d.ts +8 -0
  11. package/dist/src/frameworks/django/django-wizard-agent.js +171 -0
  12. package/dist/src/frameworks/django/utils.d.ts +31 -0
  13. package/dist/src/frameworks/django/utils.js +305 -0
  14. package/dist/src/frameworks/fastapi/fastapi-wizard-agent.d.ts +11 -0
  15. package/dist/src/frameworks/fastapi/fastapi-wizard-agent.js +189 -0
  16. package/dist/src/frameworks/fastapi/utils.d.ts +26 -0
  17. package/dist/src/frameworks/fastapi/utils.js +257 -0
  18. package/dist/src/frameworks/flask/flask-wizard-agent.d.ts +8 -0
  19. package/dist/src/frameworks/flask/flask-wizard-agent.js +177 -0
  20. package/dist/src/frameworks/flask/utils.d.ts +28 -0
  21. package/dist/src/frameworks/flask/utils.js +343 -0
  22. package/dist/src/frameworks/flutter/flutter-wizard-agent.d.ts +4 -0
  23. package/dist/src/frameworks/flutter/flutter-wizard-agent.js +57 -0
  24. package/dist/src/frameworks/flutter/utils.d.ts +7 -0
  25. package/dist/src/frameworks/flutter/utils.js +64 -0
  26. package/dist/src/frameworks/generic/generic-wizard-agent.d.ts +2 -0
  27. package/dist/src/frameworks/generic/generic-wizard-agent.js +176 -0
  28. package/dist/src/frameworks/go/go-wizard-agent.d.ts +4 -0
  29. package/dist/src/frameworks/go/go-wizard-agent.js +57 -0
  30. package/dist/src/frameworks/go/utils.d.ts +5 -0
  31. package/dist/src/frameworks/go/utils.js +44 -0
  32. package/dist/src/frameworks/java/java-wizard-agent.d.ts +7 -0
  33. package/dist/src/frameworks/java/java-wizard-agent.js +73 -0
  34. package/dist/src/frameworks/java/utils.d.ts +15 -0
  35. package/dist/src/frameworks/java/utils.js +64 -0
  36. package/dist/src/frameworks/javascript-node/javascript-node-wizard-agent.d.ts +4 -0
  37. package/dist/src/frameworks/javascript-node/javascript-node-wizard-agent.js +57 -0
  38. package/dist/src/frameworks/javascript-web/javascript-web-wizard-agent.d.ts +3 -0
  39. package/dist/src/frameworks/javascript-web/javascript-web-wizard-agent.js +151 -0
  40. package/dist/src/frameworks/javascript-web/utils.d.ts +28 -0
  41. package/dist/src/frameworks/javascript-web/utils.js +153 -0
  42. package/dist/src/frameworks/nextjs/nextjs-wizard-agent.d.ts +7 -0
  43. package/dist/src/frameworks/nextjs/nextjs-wizard-agent.js +98 -0
  44. package/dist/src/frameworks/nextjs/utils.d.ts +12 -0
  45. package/dist/src/frameworks/nextjs/utils.js +51 -0
  46. package/dist/src/frameworks/python/python-wizard-agent.d.ts +7 -0
  47. package/dist/src/frameworks/python/python-wizard-agent.js +193 -0
  48. package/dist/src/frameworks/python/utils.d.ts +28 -0
  49. package/dist/src/frameworks/python/utils.js +146 -0
  50. package/dist/src/frameworks/react-native/react-native-wizard-agent.d.ts +6 -0
  51. package/dist/src/frameworks/react-native/react-native-wizard-agent.js +84 -0
  52. package/dist/src/frameworks/react-native/utils.d.ts +21 -0
  53. package/dist/src/frameworks/react-native/utils.js +82 -0
  54. package/dist/src/frameworks/react-router/react-router-wizard-agent.d.ts +7 -0
  55. package/dist/src/frameworks/react-router/react-router-wizard-agent.js +98 -0
  56. package/dist/src/frameworks/react-router/utils.d.ts +13 -0
  57. package/dist/src/frameworks/react-router/utils.js +160 -0
  58. package/dist/src/frameworks/swift/swift-wizard-agent.d.ts +7 -0
  59. package/dist/src/frameworks/swift/swift-wizard-agent.js +72 -0
  60. package/dist/src/frameworks/swift/utils.d.ts +12 -0
  61. package/dist/src/frameworks/swift/utils.js +82 -0
  62. package/dist/src/frameworks/unity/unity-wizard-agent.d.ts +6 -0
  63. package/dist/src/frameworks/unity/unity-wizard-agent.js +79 -0
  64. package/dist/src/frameworks/unity/utils.d.ts +12 -0
  65. package/dist/src/frameworks/unity/utils.js +66 -0
  66. package/dist/src/frameworks/unreal/unreal-wizard-agent.d.ts +6 -0
  67. package/dist/src/frameworks/unreal/unreal-wizard-agent.js +77 -0
  68. package/dist/src/frameworks/unreal/utils.d.ts +10 -0
  69. package/dist/src/frameworks/unreal/utils.js +29 -0
  70. package/dist/src/frameworks/vue/vue-wizard-agent.d.ts +4 -0
  71. package/dist/src/frameworks/vue/vue-wizard-agent.js +64 -0
  72. package/dist/src/lib/agent-hooks.d.ts +26 -0
  73. package/dist/src/lib/agent-hooks.js +118 -0
  74. package/dist/src/lib/agent-interface.d.ts +175 -0
  75. package/dist/src/lib/agent-interface.js +1217 -0
  76. package/dist/src/lib/agent-runner.d.ts +9 -0
  77. package/dist/src/lib/agent-runner.js +415 -0
  78. package/dist/src/lib/ampli-config.d.ts +105 -0
  79. package/dist/src/lib/ampli-config.js +178 -0
  80. package/dist/src/lib/api.d.ts +107 -0
  81. package/dist/src/lib/api.js +442 -0
  82. package/dist/src/lib/commandments.d.ts +1 -0
  83. package/dist/src/lib/commandments.js +24 -0
  84. package/dist/src/lib/console-query.d.ts +27 -0
  85. package/dist/src/lib/console-query.js +121 -0
  86. package/dist/src/lib/constants.d.ts +124 -0
  87. package/dist/src/lib/constants.js +170 -0
  88. package/dist/src/lib/detect-amplitude.d.ts +31 -0
  89. package/dist/src/lib/detect-amplitude.js +407 -0
  90. package/dist/src/lib/framework-config.d.ts +188 -0
  91. package/dist/src/lib/framework-config.js +21 -0
  92. package/dist/src/lib/health-checks/endpoints.d.ts +3 -0
  93. package/dist/src/lib/health-checks/endpoints.js +45 -0
  94. package/dist/src/lib/health-checks/index.d.ts +4 -0
  95. package/dist/src/lib/health-checks/index.js +22 -0
  96. package/dist/src/lib/health-checks/readiness.d.ts +24 -0
  97. package/dist/src/lib/health-checks/readiness.js +118 -0
  98. package/dist/src/lib/health-checks/statuspage.d.ts +9 -0
  99. package/dist/src/lib/health-checks/statuspage.js +104 -0
  100. package/dist/src/lib/health-checks/types.d.ts +31 -0
  101. package/dist/src/lib/health-checks/types.js +9 -0
  102. package/dist/src/lib/helper-functions.d.ts +1 -0
  103. package/dist/src/lib/helper-functions.js +5 -0
  104. package/dist/src/lib/middleware/benchmark.d.ts +54 -0
  105. package/dist/src/lib/middleware/benchmark.js +48 -0
  106. package/dist/src/lib/middleware/benchmarks/cache-tracker.d.ts +44 -0
  107. package/dist/src/lib/middleware/benchmarks/cache-tracker.js +80 -0
  108. package/dist/src/lib/middleware/benchmarks/compaction-tracker.d.ts +29 -0
  109. package/dist/src/lib/middleware/benchmarks/compaction-tracker.js +59 -0
  110. package/dist/src/lib/middleware/benchmarks/context-size-tracker.d.ts +26 -0
  111. package/dist/src/lib/middleware/benchmarks/context-size-tracker.js +55 -0
  112. package/dist/src/lib/middleware/benchmarks/cost-tracker.d.ts +16 -0
  113. package/dist/src/lib/middleware/benchmarks/cost-tracker.js +75 -0
  114. package/dist/src/lib/middleware/benchmarks/duration-tracker.d.ts +20 -0
  115. package/dist/src/lib/middleware/benchmarks/duration-tracker.js +39 -0
  116. package/dist/src/lib/middleware/benchmarks/index.d.ts +9 -0
  117. package/dist/src/lib/middleware/benchmarks/index.js +67 -0
  118. package/dist/src/lib/middleware/benchmarks/json-writer.d.ts +15 -0
  119. package/dist/src/lib/middleware/benchmarks/json-writer.js +144 -0
  120. package/dist/src/lib/middleware/benchmarks/summary.d.ts +9 -0
  121. package/dist/src/lib/middleware/benchmarks/summary.js +105 -0
  122. package/dist/src/lib/middleware/benchmarks/token-tracker.d.ts +40 -0
  123. package/dist/src/lib/middleware/benchmarks/token-tracker.js +76 -0
  124. package/dist/src/lib/middleware/benchmarks/turn-counter.d.ts +34 -0
  125. package/dist/src/lib/middleware/benchmarks/turn-counter.js +58 -0
  126. package/dist/src/lib/middleware/config.d.ts +24 -0
  127. package/dist/src/lib/middleware/config.js +96 -0
  128. package/dist/src/lib/middleware/index.d.ts +11 -0
  129. package/dist/src/lib/middleware/index.js +17 -0
  130. package/dist/src/lib/middleware/phase-detector.d.ts +8 -0
  131. package/dist/src/lib/middleware/phase-detector.js +63 -0
  132. package/dist/src/lib/middleware/pipeline.d.ts +29 -0
  133. package/dist/src/lib/middleware/pipeline.js +81 -0
  134. package/dist/src/lib/middleware/schemas.d.ts +27 -0
  135. package/dist/src/lib/middleware/schemas.js +84 -0
  136. package/dist/src/lib/middleware/types.d.ts +94 -0
  137. package/dist/src/lib/middleware/types.js +8 -0
  138. package/dist/src/lib/package-manager-detection.d.ts +42 -0
  139. package/dist/src/lib/package-manager-detection.js +292 -0
  140. package/dist/src/lib/registry.d.ts +3 -0
  141. package/dist/src/lib/registry.js +42 -0
  142. package/dist/src/lib/safe-tools.d.ts +2 -0
  143. package/dist/src/lib/safe-tools.js +214 -0
  144. package/dist/src/lib/wizard-session.d.ts +220 -0
  145. package/dist/src/lib/wizard-session.js +127 -0
  146. package/dist/src/lib/wizard-tools.d.ts +82 -0
  147. package/dist/src/lib/wizard-tools.js +499 -0
  148. package/dist/src/run.d.ts +19 -0
  149. package/dist/src/run.js +151 -0
  150. package/dist/src/steps/add-mcp-server-to-clients/MCPClient.d.ts +30 -0
  151. package/dist/src/steps/add-mcp-server-to-clients/MCPClient.js +141 -0
  152. package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.d.ts +29 -0
  153. package/dist/src/steps/add-mcp-server-to-clients/clients/claude-code.js +180 -0
  154. package/dist/src/steps/add-mcp-server-to-clients/clients/claude.d.ts +20 -0
  155. package/dist/src/steps/add-mcp-server-to-clients/clients/claude.js +63 -0
  156. package/dist/src/steps/add-mcp-server-to-clients/clients/codex.d.ts +28 -0
  157. package/dist/src/steps/add-mcp-server-to-clients/clients/codex.js +77 -0
  158. package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.d.ts +24 -0
  159. package/dist/src/steps/add-mcp-server-to-clients/clients/cursor.js +60 -0
  160. package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.d.ts +27 -0
  161. package/dist/src/steps/add-mcp-server-to-clients/clients/visual-studio-code.js +101 -0
  162. package/dist/src/steps/add-mcp-server-to-clients/clients/zed.d.ts +26 -0
  163. package/dist/src/steps/add-mcp-server-to-clients/clients/zed.js +102 -0
  164. package/dist/src/steps/add-mcp-server-to-clients/defaults.d.ts +44 -0
  165. package/dist/src/steps/add-mcp-server-to-clients/defaults.js +123 -0
  166. package/dist/src/steps/add-mcp-server-to-clients/index.d.ts +19 -0
  167. package/dist/src/steps/add-mcp-server-to-clients/index.js +110 -0
  168. package/dist/src/steps/add-or-update-environment-variables.d.ts +10 -0
  169. package/dist/src/steps/add-or-update-environment-variables.js +188 -0
  170. package/dist/src/steps/index.d.ts +4 -0
  171. package/dist/src/steps/index.js +20 -0
  172. package/dist/src/steps/run-prettier.d.ts +5 -0
  173. package/dist/src/steps/run-prettier.js +90 -0
  174. package/dist/src/steps/upload-environment-variables/EnvironmentProvider.d.ts +11 -0
  175. package/dist/src/steps/upload-environment-variables/EnvironmentProvider.js +11 -0
  176. package/dist/src/steps/upload-environment-variables/index.d.ts +6 -0
  177. package/dist/src/steps/upload-environment-variables/index.js +37 -0
  178. package/dist/src/steps/upload-environment-variables/providers/vercel.d.ts +15 -0
  179. package/dist/src/steps/upload-environment-variables/providers/vercel.js +145 -0
  180. package/dist/src/telemetry.d.ts +2 -0
  181. package/dist/src/telemetry.js +12 -0
  182. package/dist/src/ui/index.d.ts +8 -0
  183. package/dist/src/ui/index.js +16 -0
  184. package/dist/src/ui/logging-ui.d.ts +56 -0
  185. package/dist/src/ui/logging-ui.js +157 -0
  186. package/dist/src/ui/tui/App.d.ts +6 -0
  187. package/dist/src/ui/tui/App.js +34 -0
  188. package/dist/src/ui/tui/components/AmplitudeLogo.d.ts +5 -0
  189. package/dist/src/ui/tui/components/AmplitudeLogo.js +81 -0
  190. package/dist/src/ui/tui/components/AmplitudeTextLogo.d.ts +3 -0
  191. package/dist/src/ui/tui/components/AmplitudeTextLogo.js +31 -0
  192. package/dist/src/ui/tui/components/ConsoleView.d.ts +23 -0
  193. package/dist/src/ui/tui/components/ConsoleView.js +220 -0
  194. package/dist/src/ui/tui/components/TitleBar.d.ts +6 -0
  195. package/dist/src/ui/tui/components/TitleBar.js +16 -0
  196. package/dist/src/ui/tui/console-commands.d.ts +16 -0
  197. package/dist/src/ui/tui/console-commands.js +31 -0
  198. package/dist/src/ui/tui/context/CommandModeContext.d.ts +2 -0
  199. package/dist/src/ui/tui/context/CommandModeContext.js +3 -0
  200. package/dist/src/ui/tui/flows.d.ts +48 -0
  201. package/dist/src/ui/tui/flows.js +154 -0
  202. package/dist/src/ui/tui/hooks/useScreenInput.d.ts +13 -0
  203. package/dist/src/ui/tui/hooks/useScreenInput.js +18 -0
  204. package/dist/src/ui/tui/hooks/useStdoutDimensions.d.ts +9 -0
  205. package/dist/src/ui/tui/hooks/useStdoutDimensions.js +29 -0
  206. package/dist/src/ui/tui/ink-ui.d.ts +62 -0
  207. package/dist/src/ui/tui/ink-ui.js +142 -0
  208. package/dist/src/ui/tui/primitives/CardLayout.d.ts +12 -0
  209. package/dist/src/ui/tui/primitives/CardLayout.js +9 -0
  210. package/dist/src/ui/tui/primitives/ConfirmationInput.d.ts +13 -0
  211. package/dist/src/ui/tui/primitives/ConfirmationInput.js +35 -0
  212. package/dist/src/ui/tui/primitives/DissolveTransition.d.ts +21 -0
  213. package/dist/src/ui/tui/primitives/DissolveTransition.js +143 -0
  214. package/dist/src/ui/tui/primitives/EventPlanViewer.d.ts +9 -0
  215. package/dist/src/ui/tui/primitives/EventPlanViewer.js +9 -0
  216. package/dist/src/ui/tui/primitives/KagiSmallWebViewer.d.ts +7 -0
  217. package/dist/src/ui/tui/primitives/KagiSmallWebViewer.js +101 -0
  218. package/dist/src/ui/tui/primitives/LoadingBox.d.ts +8 -0
  219. package/dist/src/ui/tui/primitives/LoadingBox.js +9 -0
  220. package/dist/src/ui/tui/primitives/LogViewer.d.ts +11 -0
  221. package/dist/src/ui/tui/primitives/LogViewer.js +55 -0
  222. package/dist/src/ui/tui/primitives/PickerMenu.d.ts +20 -0
  223. package/dist/src/ui/tui/primitives/PickerMenu.js +212 -0
  224. package/dist/src/ui/tui/primitives/ProgressList.d.ts +15 -0
  225. package/dist/src/ui/tui/primitives/ProgressList.js +29 -0
  226. package/dist/src/ui/tui/primitives/PromptLabel.d.ts +11 -0
  227. package/dist/src/ui/tui/primitives/PromptLabel.js +12 -0
  228. package/dist/src/ui/tui/primitives/ReportViewer.d.ts +12 -0
  229. package/dist/src/ui/tui/primitives/ReportViewer.js +99 -0
  230. package/dist/src/ui/tui/primitives/ScreenErrorBoundary.d.ts +26 -0
  231. package/dist/src/ui/tui/primitives/ScreenErrorBoundary.js +29 -0
  232. package/dist/src/ui/tui/primitives/SlashCommandInput.d.ts +21 -0
  233. package/dist/src/ui/tui/primitives/SlashCommandInput.js +85 -0
  234. package/dist/src/ui/tui/primitives/SnakeGame.d.ts +1 -0
  235. package/dist/src/ui/tui/primitives/SnakeGame.js +1 -0
  236. package/dist/src/ui/tui/primitives/SplitView.d.ts +11 -0
  237. package/dist/src/ui/tui/primitives/SplitView.js +8 -0
  238. package/dist/src/ui/tui/primitives/TabContainer.d.ts +18 -0
  239. package/dist/src/ui/tui/primitives/TabContainer.js +30 -0
  240. package/dist/src/ui/tui/primitives/index.d.ts +23 -0
  241. package/dist/src/ui/tui/primitives/index.js +19 -0
  242. package/dist/src/ui/tui/router.d.ts +61 -0
  243. package/dist/src/ui/tui/router.js +104 -0
  244. package/dist/src/ui/tui/screen-registry.d.ts +19 -0
  245. package/dist/src/ui/tui/screen-registry.js +56 -0
  246. package/dist/src/ui/tui/screens/ActivationOptionsScreen.d.ts +12 -0
  247. package/dist/src/ui/tui/screens/ActivationOptionsScreen.js +57 -0
  248. package/dist/src/ui/tui/screens/AuthScreen.d.ts +18 -0
  249. package/dist/src/ui/tui/screens/AuthScreen.js +107 -0
  250. package/dist/src/ui/tui/screens/ChecklistScreen.d.ts +22 -0
  251. package/dist/src/ui/tui/screens/ChecklistScreen.js +122 -0
  252. package/dist/src/ui/tui/screens/DataIngestionCheckScreen.d.ts +24 -0
  253. package/dist/src/ui/tui/screens/DataIngestionCheckScreen.js +113 -0
  254. package/dist/src/ui/tui/screens/DataSetupScreen.d.ts +17 -0
  255. package/dist/src/ui/tui/screens/DataSetupScreen.js +73 -0
  256. package/dist/src/ui/tui/screens/IntroScreen.d.ts +16 -0
  257. package/dist/src/ui/tui/screens/IntroScreen.js +86 -0
  258. package/dist/src/ui/tui/screens/LoginScreen.d.ts +15 -0
  259. package/dist/src/ui/tui/screens/LoginScreen.js +65 -0
  260. package/dist/src/ui/tui/screens/LogoutScreen.d.ts +12 -0
  261. package/dist/src/ui/tui/screens/LogoutScreen.js +28 -0
  262. package/dist/src/ui/tui/screens/McpScreen.d.ts +26 -0
  263. package/dist/src/ui/tui/screens/McpScreen.js +148 -0
  264. package/dist/src/ui/tui/screens/OutageScreen.d.ts +10 -0
  265. package/dist/src/ui/tui/screens/OutageScreen.js +17 -0
  266. package/dist/src/ui/tui/screens/OutroScreen.d.ts +11 -0
  267. package/dist/src/ui/tui/screens/OutroScreen.js +69 -0
  268. package/dist/src/ui/tui/screens/RegionSelectScreen.d.ts +17 -0
  269. package/dist/src/ui/tui/screens/RegionSelectScreen.js +40 -0
  270. package/dist/src/ui/tui/screens/RunScreen.d.ts +16 -0
  271. package/dist/src/ui/tui/screens/RunScreen.js +212 -0
  272. package/dist/src/ui/tui/screens/SettingsOverrideScreen.d.ts +10 -0
  273. package/dist/src/ui/tui/screens/SettingsOverrideScreen.js +23 -0
  274. package/dist/src/ui/tui/screens/SetupScreen.d.ts +13 -0
  275. package/dist/src/ui/tui/screens/SetupScreen.js +73 -0
  276. package/dist/src/ui/tui/screens/SlackScreen.d.ts +25 -0
  277. package/dist/src/ui/tui/screens/SlackScreen.js +97 -0
  278. package/dist/src/ui/tui/services/mcp-installer.d.ts +25 -0
  279. package/dist/src/ui/tui/services/mcp-installer.js +82 -0
  280. package/dist/src/ui/tui/start-tui.d.ts +10 -0
  281. package/dist/src/ui/tui/start-tui.js +50 -0
  282. package/dist/src/ui/tui/store.d.ts +231 -0
  283. package/dist/src/ui/tui/store.js +568 -0
  284. package/dist/src/ui/tui/styles.d.ts +31 -0
  285. package/dist/src/ui/tui/styles.js +33 -0
  286. package/dist/src/ui/wizard-ui.d.ts +110 -0
  287. package/dist/src/ui/wizard-ui.js +18 -0
  288. package/dist/src/utils/ampli-settings.d.ts +37 -0
  289. package/dist/src/utils/ampli-settings.js +182 -0
  290. package/dist/src/utils/analytics.d.ts +35 -0
  291. package/dist/src/utils/analytics.js +133 -0
  292. package/dist/src/utils/anthropic-status.d.ts +17 -0
  293. package/dist/src/utils/anthropic-status.js +51 -0
  294. package/dist/src/utils/api-key-store.d.ts +35 -0
  295. package/dist/src/utils/api-key-store.js +176 -0
  296. package/dist/src/utils/bash.d.ts +2 -0
  297. package/dist/src/utils/bash.js +53 -0
  298. package/dist/src/utils/custom-headers.d.ts +9 -0
  299. package/dist/src/utils/custom-headers.js +23 -0
  300. package/dist/src/utils/debug.d.ts +23 -0
  301. package/dist/src/utils/debug.js +86 -0
  302. package/dist/src/utils/environment.d.ts +4 -0
  303. package/dist/src/utils/environment.js +76 -0
  304. package/dist/src/utils/file-utils.d.ts +2 -0
  305. package/dist/src/utils/file-utils.js +16 -0
  306. package/dist/src/utils/get-api-key.d.ts +17 -0
  307. package/dist/src/utils/get-api-key.js +50 -0
  308. package/dist/src/utils/logging.d.ts +9 -0
  309. package/dist/src/utils/logging.js +48 -0
  310. package/dist/src/utils/oauth.d.ts +53 -0
  311. package/dist/src/utils/oauth.js +354 -0
  312. package/dist/src/utils/package-json.d.ts +25 -0
  313. package/dist/src/utils/package-json.js +26 -0
  314. package/dist/src/utils/package-manager.d.ts +21 -0
  315. package/dist/src/utils/package-manager.js +208 -0
  316. package/dist/src/utils/semver.d.ts +21 -0
  317. package/dist/src/utils/semver.js +61 -0
  318. package/dist/src/utils/setup-utils.d.ts +82 -0
  319. package/dist/src/utils/setup-utils.js +467 -0
  320. package/dist/src/utils/shell-completions.d.ts +10 -0
  321. package/dist/src/utils/shell-completions.js +199 -0
  322. package/dist/src/utils/string.d.ts +1 -0
  323. package/dist/src/utils/string.js +8 -0
  324. package/dist/src/utils/types.d.ts +72 -0
  325. package/dist/src/utils/types.js +2 -0
  326. package/dist/src/utils/urls.d.ts +14 -0
  327. package/dist/src/utils/urls.js +69 -0
  328. package/dist/src/utils/vendor/is-unicorn-supported.d.ts +1 -0
  329. package/dist/src/utils/vendor/is-unicorn-supported.js +23 -0
  330. package/dist/src/utils/wizard-abort.d.ts +13 -0
  331. package/dist/src/utils/wizard-abort.js +56 -0
  332. package/man/amplitude-wizard.1 +170 -0
  333. package/package.json +144 -0
@@ -0,0 +1,407 @@
1
+ "use strict";
2
+ /**
3
+ * detect-amplitude — Static heuristics to check if Amplitude is already
4
+ * installed in the project directory, without calling any APIs or AI.
5
+ *
6
+ * Checks (in order of confidence):
7
+ * 1. package.json — Amplitude npm packages in dependencies
8
+ * 2. Python requirements files — amplitude-analytics
9
+ * 3. Swift — Podfile or Package.resolved
10
+ * 4. Android / Java — build.gradle / build.gradle.kts
11
+ * 5. Flutter — pubspec.yaml
12
+ * 6. Go — go.mod
13
+ * 7. Unreal Engine — Config/DefaultEngine.ini or Plugins/AmplitudeUnreal/
14
+ * 8. Unity — Packages/manifest.json
15
+ * 9. Source code imports — grep for amplitude import statements
16
+ *
17
+ * Returns a confidence level so callers can decide how to act:
18
+ * 'high' — package file explicitly lists an Amplitude SDK
19
+ * 'low' — import found in source but no package file entry
20
+ * 'none' — no evidence found
21
+ */
22
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
26
+ desc = { enumerable: true, get: function() { return m[k]; } };
27
+ }
28
+ Object.defineProperty(o, k2, desc);
29
+ }) : (function(o, m, k, k2) {
30
+ if (k2 === undefined) k2 = k;
31
+ o[k2] = m[k];
32
+ }));
33
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
34
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
35
+ }) : function(o, v) {
36
+ o["default"] = v;
37
+ });
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ exports.detectAmplitudeInProject = detectAmplitudeInProject;
57
+ const fs = __importStar(require("node:fs"));
58
+ const path = __importStar(require("node:path"));
59
+ // ── npm packages ─────────────────────────────────────────────────────
60
+ const AMPLITUDE_NPM_PACKAGES = [
61
+ '@amplitude/analytics-browser',
62
+ '@amplitude/analytics-node',
63
+ '@amplitude/analytics-react-native',
64
+ '@amplitude/unified',
65
+ 'amplitude-js', // legacy browser SDK
66
+ ];
67
+ function checkPackageJson(dir) {
68
+ const pkgPath = path.join(dir, 'package.json');
69
+ try {
70
+ const raw = fs.readFileSync(pkgPath, 'utf-8');
71
+ const pkg = JSON.parse(raw);
72
+ const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
73
+ for (const name of AMPLITUDE_NPM_PACKAGES) {
74
+ if (allDeps[name]) {
75
+ return { confidence: 'high', reason: `${name} found in package.json` };
76
+ }
77
+ }
78
+ }
79
+ catch {
80
+ // No package.json or invalid JSON — not a JS project
81
+ }
82
+ return { confidence: 'none', reason: null };
83
+ }
84
+ // ── Python requirements ──────────────────────────────────────────────
85
+ /** Matches `amplitude-analytics` with optional version specifier */
86
+ const PYTHON_AMPLITUDE_RE = /^\s*amplitude[-_]analytics\b/im;
87
+ function checkPythonRequirements(dir) {
88
+ const candidates = [
89
+ 'requirements.txt',
90
+ 'requirements-dev.txt',
91
+ 'requirements/base.txt',
92
+ 'requirements/common.txt',
93
+ ];
94
+ for (const rel of candidates) {
95
+ try {
96
+ const content = fs.readFileSync(path.join(dir, rel), 'utf-8');
97
+ if (PYTHON_AMPLITUDE_RE.test(content)) {
98
+ return {
99
+ confidence: 'high',
100
+ reason: `amplitude-analytics found in ${rel}`,
101
+ };
102
+ }
103
+ }
104
+ catch {
105
+ // File doesn't exist — skip
106
+ }
107
+ }
108
+ // pyproject.toml
109
+ try {
110
+ const content = fs.readFileSync(path.join(dir, 'pyproject.toml'), 'utf-8');
111
+ if (PYTHON_AMPLITUDE_RE.test(content)) {
112
+ return {
113
+ confidence: 'high',
114
+ reason: 'amplitude-analytics found in pyproject.toml',
115
+ };
116
+ }
117
+ }
118
+ catch {
119
+ // Not a Python project or no pyproject.toml
120
+ }
121
+ // setup.cfg / setup.py
122
+ for (const file of ['setup.cfg', 'setup.py']) {
123
+ try {
124
+ const content = fs.readFileSync(path.join(dir, file), 'utf-8');
125
+ if (PYTHON_AMPLITUDE_RE.test(content)) {
126
+ return {
127
+ confidence: 'high',
128
+ reason: `amplitude-analytics found in ${file}`,
129
+ };
130
+ }
131
+ }
132
+ catch {
133
+ // Skip
134
+ }
135
+ }
136
+ return { confidence: 'none', reason: null };
137
+ }
138
+ // ── Swift (CocoaPods / Swift Package Manager) ────────────────────────
139
+ function checkSwiftPackages(dir) {
140
+ // CocoaPods Podfile
141
+ try {
142
+ const podfile = fs.readFileSync(path.join(dir, 'Podfile'), 'utf-8');
143
+ if (/pod\s+['"]AmplitudeUnified['"]/i.test(podfile)) {
144
+ return {
145
+ confidence: 'high',
146
+ reason: 'AmplitudeUnified found in Podfile',
147
+ };
148
+ }
149
+ }
150
+ catch {
151
+ // No Podfile
152
+ }
153
+ // Swift Package Manager — Package.resolved (locked dependency graph)
154
+ for (const rel of [
155
+ 'Package.resolved',
156
+ '.package/checkouts/.resolved',
157
+ '.build/workspace-state.json', // fallback
158
+ ]) {
159
+ try {
160
+ const content = fs.readFileSync(path.join(dir, rel), 'utf-8');
161
+ if (content.includes('AmplitudeUnified-Swift') ||
162
+ content.includes('amplitude/AmplitudeUnified')) {
163
+ return {
164
+ confidence: 'high',
165
+ reason: `AmplitudeUnified found in ${rel}`,
166
+ };
167
+ }
168
+ }
169
+ catch {
170
+ // Skip
171
+ }
172
+ }
173
+ return { confidence: 'none', reason: null };
174
+ }
175
+ // ── Android / Java (Gradle) ──────────────────────────────────────────
176
+ const GRADLE_AMPLITUDE_RE = /com\.amplitude:(analytics-android|java-sdk)/;
177
+ function checkGradleFiles(dir) {
178
+ const candidates = [
179
+ 'build.gradle',
180
+ 'build.gradle.kts',
181
+ 'app/build.gradle',
182
+ 'app/build.gradle.kts',
183
+ ];
184
+ for (const rel of candidates) {
185
+ try {
186
+ const content = fs.readFileSync(path.join(dir, rel), 'utf-8');
187
+ if (GRADLE_AMPLITUDE_RE.test(content)) {
188
+ return {
189
+ confidence: 'high',
190
+ reason: `Amplitude dependency found in ${rel}`,
191
+ };
192
+ }
193
+ }
194
+ catch {
195
+ // Skip
196
+ }
197
+ }
198
+ return { confidence: 'none', reason: null };
199
+ }
200
+ // ── Flutter (pubspec.yaml) ───────────────────────────────────────────
201
+ function checkPubspecYaml(dir) {
202
+ try {
203
+ const content = fs.readFileSync(path.join(dir, 'pubspec.yaml'), 'utf-8');
204
+ if (/^\s*amplitude_flutter\s*:/m.test(content)) {
205
+ return {
206
+ confidence: 'high',
207
+ reason: 'amplitude_flutter found in pubspec.yaml',
208
+ };
209
+ }
210
+ }
211
+ catch {
212
+ // No pubspec.yaml
213
+ }
214
+ return { confidence: 'none', reason: null };
215
+ }
216
+ // ── Go (go.mod) ──────────────────────────────────────────────────────
217
+ function checkGoMod(dir) {
218
+ try {
219
+ const content = fs.readFileSync(path.join(dir, 'go.mod'), 'utf-8');
220
+ if (content.includes('github.com/amplitude/analytics-go')) {
221
+ return {
222
+ confidence: 'high',
223
+ reason: 'github.com/amplitude/analytics-go found in go.mod',
224
+ };
225
+ }
226
+ }
227
+ catch {
228
+ // No go.mod
229
+ }
230
+ return { confidence: 'none', reason: null };
231
+ }
232
+ // ── Unreal Engine ────────────────────────────────────────────────────
233
+ function checkUnrealConfig(dir) {
234
+ // Config/DefaultEngine.ini with Amplitude analytics provider
235
+ try {
236
+ const content = fs.readFileSync(path.join(dir, 'Config', 'DefaultEngine.ini'), 'utf-8');
237
+ if (/AmplitudeApiKey\s*=|ProviderModuleName\s*=\s*Amplitude/i.test(content)) {
238
+ return {
239
+ confidence: 'high',
240
+ reason: 'Amplitude configured in Config/DefaultEngine.ini',
241
+ };
242
+ }
243
+ }
244
+ catch {
245
+ // No config
246
+ }
247
+ // Plugin already extracted into Plugins/
248
+ if (fs.existsSync(path.join(dir, 'Plugins', 'AmplitudeUnreal', 'Amplitude.uplugin'))) {
249
+ return {
250
+ confidence: 'high',
251
+ reason: 'AmplitudeUnreal plugin found in Plugins/',
252
+ };
253
+ }
254
+ return { confidence: 'none', reason: null };
255
+ }
256
+ // ── Unity ────────────────────────────────────────────────────────────
257
+ function checkUnityManifest(dir) {
258
+ // UPM manifest
259
+ try {
260
+ const content = fs.readFileSync(path.join(dir, 'Packages', 'manifest.json'), 'utf-8');
261
+ if (content.includes('amplitude/unity-plugin')) {
262
+ return {
263
+ confidence: 'high',
264
+ reason: 'amplitude/unity-plugin found in Packages/manifest.json',
265
+ };
266
+ }
267
+ }
268
+ catch {
269
+ // No manifest
270
+ }
271
+ // Manual .unitypackage import lands under Assets/Amplitude/
272
+ if (fs.existsSync(path.join(dir, 'Assets', 'Amplitude'))) {
273
+ return {
274
+ confidence: 'high',
275
+ reason: 'Amplitude assets found in Assets/Amplitude/',
276
+ };
277
+ }
278
+ return { confidence: 'none', reason: null };
279
+ }
280
+ // ── Source-code import grep ──────────────────────────────────────────
281
+ const JS_AMPLITUDE_IMPORT_RE = /from\s+['"]@?amplitude\b|require\s*\(\s*['"]@?amplitude\b/;
282
+ const PY_AMPLITUDE_IMPORT_RE = /^\s*(from\s+amplitude\b|import\s+amplitude\b)/m;
283
+ const SWIFT_AMPLITUDE_IMPORT_RE = /import\s+AmplitudeUnified|Amplitude\s*\(\s*apiKey:/;
284
+ const KOTLIN_JAVA_AMPLITUDE_RE = /com\.amplitude\b/;
285
+ const GO_AMPLITUDE_IMPORT_RE = /["']github\.com\/amplitude\/analytics-go/;
286
+ const DART_AMPLITUDE_IMPORT_RE = /amplitude_flutter|amplitude\.track\b/;
287
+ const CSHARP_AMPLITUDE_RE = /Amplitude\.getInstance\b|Amplitude\.Instance\b/;
288
+ const IGNORE_DIRS = new Set([
289
+ 'node_modules',
290
+ '.git',
291
+ '.next',
292
+ 'dist',
293
+ 'build',
294
+ '.turbo',
295
+ '.cache',
296
+ '__pycache__',
297
+ '.venv',
298
+ 'venv',
299
+ 'env',
300
+ // Native build output dirs
301
+ '.build',
302
+ 'Pods',
303
+ 'DerivedData',
304
+ '.gradle',
305
+ 'Library', // Unity Library cache
306
+ ]);
307
+ const JS_EXTS = new Set(['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs']);
308
+ const PY_EXTS = new Set(['.py']);
309
+ const SWIFT_EXTS = new Set(['.swift']);
310
+ const KOTLIN_JAVA_EXTS = new Set(['.kt', '.java']);
311
+ const GO_EXTS = new Set(['.go']);
312
+ const DART_EXTS = new Set(['.dart']);
313
+ const CSHARP_EXTS = new Set(['.cs']);
314
+ function getImportRegex(ext) {
315
+ if (JS_EXTS.has(ext))
316
+ return JS_AMPLITUDE_IMPORT_RE;
317
+ if (PY_EXTS.has(ext))
318
+ return PY_AMPLITUDE_IMPORT_RE;
319
+ if (SWIFT_EXTS.has(ext))
320
+ return SWIFT_AMPLITUDE_IMPORT_RE;
321
+ if (KOTLIN_JAVA_EXTS.has(ext))
322
+ return KOTLIN_JAVA_AMPLITUDE_RE;
323
+ if (GO_EXTS.has(ext))
324
+ return GO_AMPLITUDE_IMPORT_RE;
325
+ if (DART_EXTS.has(ext))
326
+ return DART_AMPLITUDE_IMPORT_RE;
327
+ if (CSHARP_EXTS.has(ext))
328
+ return CSHARP_AMPLITUDE_RE;
329
+ return null;
330
+ }
331
+ const ALL_SCANNED_EXTS = new Set([
332
+ ...JS_EXTS,
333
+ ...PY_EXTS,
334
+ ...SWIFT_EXTS,
335
+ ...KOTLIN_JAVA_EXTS,
336
+ ...GO_EXTS,
337
+ ...DART_EXTS,
338
+ ...CSHARP_EXTS,
339
+ ]);
340
+ function grepSourceFiles(dir, maxFiles = 200) {
341
+ let checked = 0;
342
+ function walk(current) {
343
+ if (checked >= maxFiles)
344
+ return null;
345
+ let entries;
346
+ try {
347
+ entries = fs.readdirSync(current, { withFileTypes: true });
348
+ }
349
+ catch {
350
+ return null;
351
+ }
352
+ for (const entry of entries) {
353
+ if (entry.isDirectory()) {
354
+ if (IGNORE_DIRS.has(entry.name))
355
+ continue;
356
+ const found = walk(path.join(current, entry.name));
357
+ if (found)
358
+ return found;
359
+ }
360
+ else if (entry.isFile()) {
361
+ const ext = path.extname(entry.name).toLowerCase();
362
+ if (!ALL_SCANNED_EXTS.has(ext))
363
+ continue;
364
+ checked++;
365
+ try {
366
+ const content = fs.readFileSync(path.join(current, entry.name), 'utf-8');
367
+ const re = getImportRegex(ext);
368
+ if (re && re.test(content)) {
369
+ return path.relative(dir, path.join(current, entry.name));
370
+ }
371
+ }
372
+ catch {
373
+ // Unreadable file — skip
374
+ }
375
+ }
376
+ }
377
+ return null;
378
+ }
379
+ const hit = walk(dir);
380
+ if (hit) {
381
+ return { confidence: 'low', reason: `Amplitude import found in ${hit}` };
382
+ }
383
+ return { confidence: 'none', reason: null };
384
+ }
385
+ // ── Public API ───────────────────────────────────────────────────────
386
+ /**
387
+ * Run all static checks in priority order.
388
+ * Returns the first non-'none' result, or 'none' if nothing found.
389
+ */
390
+ function detectAmplitudeInProject(installDir) {
391
+ const checks = [
392
+ checkPackageJson,
393
+ checkPythonRequirements,
394
+ checkSwiftPackages,
395
+ checkGradleFiles,
396
+ checkPubspecYaml,
397
+ checkGoMod,
398
+ checkUnrealConfig,
399
+ checkUnityManifest,
400
+ ];
401
+ for (const check of checks) {
402
+ const result = check(installDir);
403
+ if (result.confidence !== 'none')
404
+ return result;
405
+ }
406
+ return grepSourceFiles(installDir);
407
+ }
@@ -0,0 +1,188 @@
1
+ import type { Integration } from './constants';
2
+ import type { WizardOptions } from '../utils/types';
3
+ import type { PackageManagerDetector } from './package-manager-detection';
4
+ /**
5
+ * A setup question that the SetupScreen renders for framework disambiguation.
6
+ * If detect() returns a value, the question is auto-resolved and not shown.
7
+ */
8
+ export interface SetupQuestion {
9
+ /** Stored in session.frameworkContext[key] */
10
+ key: string;
11
+ /** Displayed to user, e.g. "Which router are you using?" */
12
+ message: string;
13
+ /** Picker options */
14
+ options: Array<{
15
+ label: string;
16
+ value: string;
17
+ hint?: string;
18
+ }>;
19
+ /** Auto-detect; null = ask the user */
20
+ detect: (options: Pick<WizardOptions, 'installDir'>) => Promise<string | null>;
21
+ }
22
+ /**
23
+ * Configuration interface for framework-specific agent integrations.
24
+ * Each framework exports a FrameworkConfig that the universal runner uses.
25
+ *
26
+ * The TContext generic represents the framework-specific context gathered
27
+ * before the agent runs (e.g., router type for Next.js, project type for Django).
28
+ * The runner threads this opaquely — all framework-specific logic stays inside the config.
29
+ */
30
+ export interface FrameworkConfig<TContext extends Record<string, unknown> = Record<string, unknown>> {
31
+ metadata: FrameworkMetadata<TContext>;
32
+ detection: FrameworkDetection;
33
+ environment: EnvironmentConfig;
34
+ analytics: AnalyticsConfig<TContext>;
35
+ prompts: PromptConfig<TContext>;
36
+ ui: UIConfig<TContext>;
37
+ }
38
+ /**
39
+ * Basic framework information and documentation
40
+ */
41
+ export interface FrameworkMetadata<TContext extends Record<string, unknown> = Record<string, unknown>> {
42
+ /** Display name (e.g., "Next.js", "React") */
43
+ name: string;
44
+ /** Integration type from constants */
45
+ integration: Integration;
46
+ /** URL to framework-specific Amplitude docs */
47
+ docsUrl: string;
48
+ /**
49
+ * Optional URL to docs for users with unsupported framework versions.
50
+ * If not provided, defaults to docsUrl.
51
+ */
52
+ unsupportedVersionDocsUrl?: string;
53
+ /** If true, shows a beta notice before running the wizard. */
54
+ beta?: boolean;
55
+ /** Optional notice shown before the agent runs (e.g., "Close Xcode before proceeding"). */
56
+ preRunNotice?: string;
57
+ /**
58
+ * Optional function to gather framework-specific context before agent runs.
59
+ * For Next.js: detects router type
60
+ * For React Native: detects Expo vs bare
61
+ */
62
+ gatherContext?: (options: WizardOptions) => Promise<TContext>;
63
+ /** Optional additional MCP servers for this framework (e.g., Svelte MCP). */
64
+ additionalMcpServers?: Record<string, {
65
+ url: string;
66
+ }>;
67
+ /**
68
+ * Setup questions for framework disambiguation.
69
+ * The SetupScreen iterates unresolved questions and renders a PickerMenu for each.
70
+ * If all questions are auto-resolved (or none defined), the screen is skipped.
71
+ */
72
+ setup?: {
73
+ questions: SetupQuestion[];
74
+ };
75
+ }
76
+ /**
77
+ * Framework detection and version handling
78
+ */
79
+ export interface FrameworkDetection {
80
+ /** Package name to check in package.json (e.g., "next", "react") */
81
+ packageName: string;
82
+ /** Human-readable name for error messages (e.g., "Next.js") */
83
+ packageDisplayName: string;
84
+ /** Extract version from package.json */
85
+ getVersion: (packageJson: unknown) => string | undefined;
86
+ /** Optional: Convert version to analytics bucket (e.g., "15.x") */
87
+ getVersionBucket?: (version: string) => string;
88
+ /**
89
+ * Whether this framework uses package.json (Node.js/JavaScript).
90
+ * If false, skips package.json checks (for Python, Go, etc.)
91
+ * Defaults to true if not specified.
92
+ */
93
+ usesPackageJson?: boolean;
94
+ /** Minimum supported version. If set, runner checks before proceeding. */
95
+ minimumVersion?: string;
96
+ /** Get the currently installed version. Called by runner for version check. */
97
+ getInstalledVersion?: (options: WizardOptions) => Promise<string | undefined>;
98
+ /** Detect whether this framework is present in the project. */
99
+ detect: (options: Pick<WizardOptions, 'installDir'>) => Promise<boolean>;
100
+ /** Detect the project's package manager(s). Used by the in-process MCP tool. */
101
+ detectPackageManager: PackageManagerDetector;
102
+ }
103
+ /**
104
+ * Environment variable configuration
105
+ */
106
+ export interface EnvironmentConfig {
107
+ /** Whether to upload env vars to hosting providers post-agent */
108
+ uploadToHosting: boolean;
109
+ /**
110
+ * Build the environment variables object for this framework.
111
+ * Returns the exact variable names and values to upload to hosting providers.
112
+ */
113
+ getEnvVars: (apiKey: string, host: string) => Record<string, string>;
114
+ }
115
+ /**
116
+ * Analytics configuration
117
+ */
118
+ export interface AnalyticsConfig<TContext extends Record<string, unknown> = Record<string, unknown>> {
119
+ /** Generate tags from context (e.g., { 'nextjs-version': '15.x', 'router': 'app' }) */
120
+ getTags: (context: TContext) => Record<string, string>;
121
+ /** Optional: Additional event properties */
122
+ getEventProperties?: (context: TContext) => Record<string, string>;
123
+ }
124
+ /**
125
+ * Default package installation instruction used when frameworks don't
126
+ * provide their own. Frameworks with specific needs (e.g., Swift SPM,
127
+ * Composer) override this in their config.
128
+ */
129
+ export declare const DEFAULT_PACKAGE_INSTALLATION = "Use the detect_package_manager tool to determine the package manager. Do not manually edit package.json; the package manager handles it automatically.";
130
+ export declare const PYTHON_PACKAGE_INSTALLATION = "Use the detect_package_manager tool to determine the package manager. If the detected tool manages dependencies directly (e.g. uv add, poetry add), use it \u2014 it will update the manifest automatically. If using pip, you must also add the dependency to requirements.txt or the appropriate manifest file.";
131
+ /**
132
+ * Prompt configuration
133
+ */
134
+ export interface PromptConfig<TContext extends Record<string, unknown> = Record<string, unknown>> {
135
+ /**
136
+ * Optional: Completely replace the default MCP-skills prompt.
137
+ * When provided, none of the other PromptConfig fields are used for the prompt.
138
+ * Receives the same context that buildIntegrationPrompt receives.
139
+ */
140
+ buildPrompt?: (context: {
141
+ projectApiKey: string;
142
+ host: string;
143
+ projectId: number;
144
+ typescript: boolean;
145
+ frameworkVersion: string;
146
+ frameworkContext: TContext;
147
+ }) => string;
148
+ /**
149
+ * Optional: Additional context lines to append to base prompt
150
+ * For Next.js: "- Router: app"
151
+ * For React Native: "- Platform: Expo"
152
+ */
153
+ getAdditionalContextLines?: (context: TContext) => string[];
154
+ /**
155
+ * How to detect the project type for this framework.
156
+ * Included in the agent prompt as project context.
157
+ * e.g., "Look for package.json and lockfiles" or "Look for requirements.txt and manage.py"
158
+ */
159
+ projectTypeDetection: string;
160
+ /**
161
+ * How to install packages for this framework.
162
+ * Included in the agent prompt as project context.
163
+ * Defaults to DEFAULT_PACKAGE_INSTALLATION. Only override if the framework
164
+ * has specific installation guidance (e.g., Swift SPM, Composer).
165
+ */
166
+ packageInstallation?: string;
167
+ }
168
+ /**
169
+ * UI messaging configuration
170
+ */
171
+ export interface UIConfig<TContext extends Record<string, unknown> = Record<string, unknown>> {
172
+ /** Success message when agent completes */
173
+ successMessage: string;
174
+ /** Estimated time for agent to complete (in minutes) */
175
+ estimatedDurationMinutes: number;
176
+ /** Generate "What the agent did" bullets from context */
177
+ getOutroChanges: (context: TContext) => string[];
178
+ /** Generate "Next steps" bullets from context */
179
+ getOutroNextSteps: (context: TContext) => string[];
180
+ }
181
+ /**
182
+ * Generate welcome message from framework name
183
+ */
184
+ export declare function getWelcomeMessage(frameworkName: string): string;
185
+ /**
186
+ * Shared spinner message for all frameworks
187
+ */
188
+ export declare const SPINNER_MESSAGE = "Writing your Amplitude setup with events, error capture and more...";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SPINNER_MESSAGE = exports.PYTHON_PACKAGE_INSTALLATION = exports.DEFAULT_PACKAGE_INSTALLATION = void 0;
4
+ exports.getWelcomeMessage = getWelcomeMessage;
5
+ /**
6
+ * Default package installation instruction used when frameworks don't
7
+ * provide their own. Frameworks with specific needs (e.g., Swift SPM,
8
+ * Composer) override this in their config.
9
+ */
10
+ exports.DEFAULT_PACKAGE_INSTALLATION = 'Use the detect_package_manager tool to determine the package manager. Do not manually edit package.json; the package manager handles it automatically.';
11
+ exports.PYTHON_PACKAGE_INSTALLATION = 'Use the detect_package_manager tool to determine the package manager. If the detected tool manages dependencies directly (e.g. uv add, poetry add), use it — it will update the manifest automatically. If using pip, you must also add the dependency to requirements.txt or the appropriate manifest file.';
12
+ /**
13
+ * Generate welcome message from framework name
14
+ */
15
+ function getWelcomeMessage(frameworkName) {
16
+ return `Amplitude ${frameworkName} wizard (agent-powered)`;
17
+ }
18
+ /**
19
+ * Shared spinner message for all frameworks
20
+ */
21
+ exports.SPINNER_MESSAGE = 'Writing your Amplitude setup with events, error capture and more...';
@@ -0,0 +1,3 @@
1
+ import { type BaseHealthResult } from './types';
2
+ export declare const checkLlmGatewayHealth: () => Promise<BaseHealthResult>;
3
+ export declare const checkMcpHealth: () => Promise<BaseHealthResult>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkMcpHealth = exports.checkLlmGatewayHealth = void 0;
4
+ const types_1 = require("./types");
5
+ // ---------------------------------------------------------------------------
6
+ // Direct endpoint health checks
7
+ //
8
+ // These ping Amplitude-owned services directly (no Statuspage intermediary).
9
+ // A non-expected HTTP status or any network error is treated as Down.
10
+ //
11
+ // LLM Gateway – FastAPI service
12
+ // Source: amplitude/services/llm-gateway/src/llm_gateway/api/health.py
13
+ // GET /_liveness → 200 {"status":"alive"}
14
+ //
15
+ // MCP – Cloudflare Worker
16
+ // Source: amplitude/services/mcp/src/index.ts
17
+ // GET / → 200 (HTML landing page)
18
+ // ---------------------------------------------------------------------------
19
+ function downResult(error) {
20
+ return { status: types_1.ServiceHealthStatus.Down, error };
21
+ }
22
+ async function fetchEndpointHealth(url, timeoutMs = 5000, expectedStatus = 200) {
23
+ try {
24
+ const controller = new AbortController();
25
+ const tid = setTimeout(() => controller.abort(), timeoutMs);
26
+ const res = await fetch(url, { signal: controller.signal });
27
+ clearTimeout(tid);
28
+ if (res.status === expectedStatus) {
29
+ return {
30
+ status: types_1.ServiceHealthStatus.Healthy,
31
+ rawIndicator: `HTTP ${res.status}`,
32
+ };
33
+ }
34
+ return downResult(`HTTP ${res.status}`);
35
+ }
36
+ catch (e) {
37
+ if (e instanceof Error && e.name === 'AbortError')
38
+ return downResult('Request timed out');
39
+ return downResult(e instanceof Error ? e.message : 'Unknown error');
40
+ }
41
+ }
42
+ const checkLlmGatewayHealth = () => fetchEndpointHealth('https://gateway.us.amplitude.com/_liveness');
43
+ exports.checkLlmGatewayHealth = checkLlmGatewayHealth;
44
+ const checkMcpHealth = () => fetchEndpointHealth('https://mcp.amplitude.com/');
45
+ exports.checkMcpHealth = checkMcpHealth;
@@ -0,0 +1,4 @@
1
+ export { ServiceHealthStatus, type BaseHealthResult, type ComponentStatus, type ComponentHealthResult, type AllServicesHealth, type HealthCheckKey, } from './types';
2
+ export { checkAnthropicHealth, checkAmplitudeOverallHealth, checkAmplitudeComponentHealth, checkGithubHealth, checkNpmOverallHealth, checkNpmComponentHealth, checkCloudflareOverallHealth, checkCloudflareComponentHealth, } from './statuspage';
3
+ export { checkLlmGatewayHealth, checkMcpHealth } from './endpoints';
4
+ export { type WizardReadinessConfig, DEFAULT_WIZARD_READINESS_CONFIG, checkAllExternalServices, WizardReadiness, type WizardReadinessResult, evaluateWizardReadiness, } from './readiness';