@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,66 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.detectUnityProject = detectUnityProject;
37
+ exports.isAmplitudePluginPresent = isAmplitudePluginPresent;
38
+ const fs = __importStar(require("node:fs"));
39
+ const path = __importStar(require("node:path"));
40
+ /**
41
+ * Returns true when the directory contains a Unity project.
42
+ * Primary signal: ProjectSettings/ProjectVersion.txt — Unity-specific,
43
+ * present in every Unity project since 2017+.
44
+ */
45
+ function detectUnityProject(options) {
46
+ return Promise.resolve(fs.existsSync(path.join(options.installDir, 'ProjectSettings', 'ProjectVersion.txt')));
47
+ }
48
+ /**
49
+ * Returns true if the Amplitude Unity plugin is already present,
50
+ * either via UPM (Packages/manifest.json) or manual import (Assets/).
51
+ */
52
+ function isAmplitudePluginPresent(options) {
53
+ // Check UPM manifest
54
+ const manifestPath = path.join(options.installDir, 'Packages', 'manifest.json');
55
+ try {
56
+ const manifest = fs.readFileSync(manifestPath, 'utf-8');
57
+ if (manifest.includes('amplitude/unity-plugin'))
58
+ return true;
59
+ }
60
+ catch {
61
+ // no manifest
62
+ }
63
+ // Check for manually imported Assets
64
+ const assetsAmplitudePath = path.join(options.installDir, 'Assets', 'Amplitude');
65
+ return fs.existsSync(assetsAmplitudePath);
66
+ }
@@ -0,0 +1,6 @@
1
+ import type { FrameworkConfig } from '../../lib/framework-config';
2
+ type UnrealContext = {
3
+ pluginAlreadyPresent?: boolean;
4
+ };
5
+ export declare const UNREAL_AGENT_CONFIG: FrameworkConfig<UnrealContext>;
6
+ export {};
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UNREAL_AGENT_CONFIG = void 0;
4
+ const package_manager_detection_1 = require("../../lib/package-manager-detection");
5
+ const constants_1 = require("../../lib/constants");
6
+ const utils_1 = require("./utils");
7
+ exports.UNREAL_AGENT_CONFIG = {
8
+ metadata: {
9
+ name: 'Unreal Engine',
10
+ integration: constants_1.Integration.unreal,
11
+ beta: true,
12
+ docsUrl: 'https://amplitude.com/docs/sdks/analytics/unreal/unreal-sdk',
13
+ preRunNotice: 'Close the Unreal Editor before running the wizard to avoid file conflicts.',
14
+ gatherContext: async (options) => {
15
+ const pluginAlreadyPresent = await (0, utils_1.isAmplitudePluginPresent)(options);
16
+ return { pluginAlreadyPresent };
17
+ },
18
+ },
19
+ detection: {
20
+ packageName: 'AmplitudeUnreal',
21
+ packageDisplayName: 'Unreal Engine',
22
+ usesPackageJson: false,
23
+ getVersion: () => undefined,
24
+ detect: utils_1.detectUnrealProject,
25
+ detectPackageManager: package_manager_detection_1.unrealPackageManager,
26
+ },
27
+ environment: {
28
+ // API key goes in Config/DefaultEngine.ini — no .env files in Unreal projects
29
+ uploadToHosting: false,
30
+ getEnvVars: () => ({}),
31
+ },
32
+ analytics: {
33
+ getTags: (context) => ({
34
+ pluginAlreadyPresent: context.pluginAlreadyPresent ? 'true' : 'false',
35
+ }),
36
+ },
37
+ prompts: {
38
+ projectTypeDetection: 'This is an Unreal Engine project. Look for a .uproject file at the project root to confirm.',
39
+ packageInstallation: 'There is no package manager for Unreal Engine plugins. Download AmplitudeUnreal.zip from https://github.com/amplitude/Amplitude-Unreal/releases/latest, then extract it into Plugins/AmplitudeUnreal/ inside the project directory. Use Bash to run: mkdir -p Plugins/AmplitudeUnreal && curl -L <release-url> -o /tmp/AmplitudeUnreal.zip && unzip -o /tmp/AmplitudeUnreal.zip -d Plugins/AmplitudeUnreal/',
40
+ getAdditionalContextLines: (context) => {
41
+ const lines = [
42
+ `Framework docs ID: unreal (use amplitude://docs/frameworks/unreal for documentation)`,
43
+ `Plugin: AmplitudeUnreal — manual install into Plugins/AmplitudeUnreal/`,
44
+ `API key storage: Config/DefaultEngine.ini under [Analytics] section`,
45
+ `Required INI settings:`,
46
+ ` [Analytics]`,
47
+ ` ProviderModuleName=Amplitude`,
48
+ ` AmplitudeApiKey=<api_key>`,
49
+ `C++ usage: FAnalytics::Get().GetDefaultConfiguredProvider()->RecordEvent(TEXT("Event Name"));`,
50
+ `IMPORTANT: The Amplitude Unreal plugin only executes on Apple platforms (iOS/macOS/tvOS). On other platforms all calls are no-ops.`,
51
+ `IMPORTANT: No EU data residency, no server zone configuration, and no batch/flush interval settings are available in this SDK.`,
52
+ ];
53
+ if (context.pluginAlreadyPresent) {
54
+ lines.unshift('Amplitude plugin already present at Plugins/AmplitudeUnreal/ — skip download, proceed to INI configuration.');
55
+ }
56
+ return lines;
57
+ },
58
+ },
59
+ ui: {
60
+ successMessage: 'Amplitude integration complete',
61
+ estimatedDurationMinutes: 10,
62
+ getOutroChanges: (context) => [
63
+ context.pluginAlreadyPresent
64
+ ? 'Amplitude plugin was already present — skipped download'
65
+ : 'Downloaded and extracted AmplitudeUnreal plugin into Plugins/AmplitudeUnreal/',
66
+ 'Configured AmplitudeApiKey in Config/DefaultEngine.ini',
67
+ 'Enabled Amplitude as the analytics provider',
68
+ ],
69
+ getOutroNextSteps: () => [
70
+ 'Open the Unreal Editor and enable the plugin: Settings > Plugins > Analytics > AmplitudeUnreal',
71
+ 'Rebuild your project from source',
72
+ 'Call FAnalytics::Get().GetDefaultConfiguredProvider()->StartSession() on game start',
73
+ 'Visit your Amplitude dashboard to see incoming events',
74
+ 'Note: events are only sent on iOS, macOS, and tvOS — other platforms are no-ops',
75
+ ],
76
+ },
77
+ };
@@ -0,0 +1,10 @@
1
+ import type { WizardOptions } from '../../utils/types';
2
+ /**
3
+ * Returns true when the directory contains an Unreal Engine project.
4
+ * Primary signal: a .uproject file at the project root (Unreal-specific JSON manifest).
5
+ */
6
+ export declare function detectUnrealProject(options: Pick<WizardOptions, 'installDir'>): Promise<boolean>;
7
+ /**
8
+ * Returns true if the Amplitude plugin is already extracted into the project.
9
+ */
10
+ export declare function isAmplitudePluginPresent(options: Pick<WizardOptions, 'installDir'>): Promise<boolean>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.detectUnrealProject = detectUnrealProject;
7
+ exports.isAmplitudePluginPresent = isAmplitudePluginPresent;
8
+ const fast_glob_1 = __importDefault(require("fast-glob"));
9
+ /**
10
+ * Returns true when the directory contains an Unreal Engine project.
11
+ * Primary signal: a .uproject file at the project root (Unreal-specific JSON manifest).
12
+ */
13
+ async function detectUnrealProject(options) {
14
+ const uprojectFiles = await (0, fast_glob_1.default)('*.uproject', {
15
+ cwd: options.installDir,
16
+ deep: 1,
17
+ });
18
+ return uprojectFiles.length > 0;
19
+ }
20
+ /**
21
+ * Returns true if the Amplitude plugin is already extracted into the project.
22
+ */
23
+ async function isAmplitudePluginPresent(options) {
24
+ const upluginFiles = await (0, fast_glob_1.default)('Plugins/AmplitudeUnreal/Amplitude.uplugin', {
25
+ cwd: options.installDir,
26
+ deep: 3,
27
+ });
28
+ return upluginFiles.length > 0;
29
+ }
@@ -0,0 +1,4 @@
1
+ import type { FrameworkConfig } from '../../lib/framework-config';
2
+ type VueContext = Record<string, unknown>;
3
+ export declare const VUE_AGENT_CONFIG: FrameworkConfig<VueContext>;
4
+ export {};
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VUE_AGENT_CONFIG = void 0;
4
+ const package_manager_detection_1 = require("../../lib/package-manager-detection");
5
+ const constants_1 = require("../../lib/constants");
6
+ const package_json_1 = require("../../utils/package-json");
7
+ const setup_utils_1 = require("../../utils/setup-utils");
8
+ const semver_1 = require("../../utils/semver");
9
+ const getVueVersionBucket = (0, semver_1.createVersionBucket)();
10
+ exports.VUE_AGENT_CONFIG = {
11
+ metadata: {
12
+ name: 'Vue',
13
+ integration: constants_1.Integration.vue,
14
+ docsUrl: 'https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2',
15
+ beta: true,
16
+ },
17
+ detection: {
18
+ packageName: 'vue',
19
+ packageDisplayName: 'Vue',
20
+ getVersion: (packageJson) => (0, package_json_1.getPackageVersion)('vue', packageJson),
21
+ getVersionBucket: getVueVersionBucket,
22
+ getInstalledVersion: async (options) => {
23
+ const packageJson = await (0, setup_utils_1.tryGetPackageJson)(options);
24
+ return packageJson ? (0, package_json_1.getPackageVersion)('vue', packageJson) : undefined;
25
+ },
26
+ detect: async (options) => {
27
+ const packageJson = await (0, setup_utils_1.tryGetPackageJson)(options);
28
+ return packageJson ? (0, package_json_1.hasPackageInstalled)('vue', packageJson) : false;
29
+ },
30
+ detectPackageManager: package_manager_detection_1.detectNodePackageManagers,
31
+ },
32
+ environment: {
33
+ uploadToHosting: true,
34
+ getEnvVars: (apiKey, _host) => ({
35
+ VITE_AMPLITUDE_API_KEY: apiKey,
36
+ }),
37
+ },
38
+ analytics: {
39
+ getTags: () => ({}),
40
+ },
41
+ prompts: {
42
+ projectTypeDetection: 'This is a JavaScript/TypeScript project. Look for package.json and lockfiles (package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb) to confirm.',
43
+ getAdditionalContextLines: () => {
44
+ const frameworkId = 'vue';
45
+ return [
46
+ `Framework docs ID: ${frameworkId} (use amplitude://docs/frameworks/${frameworkId} for documentation)`,
47
+ `Preferred Amplitude SDK: @amplitude/unified (prefer over @amplitude/analytics-browser for new browser integrations)`,
48
+ ];
49
+ },
50
+ },
51
+ ui: {
52
+ successMessage: 'Amplitude integration complete',
53
+ estimatedDurationMinutes: 5,
54
+ getOutroChanges: () => [
55
+ 'Analyzed your Vue project structure',
56
+ 'Created and configured Amplitude initializers',
57
+ 'Integrated Amplitude into your application',
58
+ ],
59
+ getOutroNextSteps: () => [
60
+ 'Start your development server to see Amplitude in action',
61
+ 'Visit your Amplitude dashboard to see incoming events',
62
+ ],
63
+ },
64
+ };
@@ -0,0 +1,26 @@
1
+ /** Mirror of HookEvent from @anthropic-ai/claude-agent-sdk */
2
+ export type HookEvent = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'Notification' | 'UserPromptSubmit' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'SubagentStart' | 'SubagentStop' | 'PreCompact' | 'PermissionRequest';
3
+ /** Mirror of HookCallback from @anthropic-ai/claude-agent-sdk */
4
+ export type HookCallback = (input: Record<string, unknown>, toolUseID: string | undefined, options: {
5
+ signal: AbortSignal;
6
+ }) => Promise<Record<string, unknown>>;
7
+ /** Mirror of HookCallbackMatcher from @anthropic-ai/claude-agent-sdk */
8
+ export interface HookCallbackMatcher {
9
+ matcher?: string;
10
+ hooks: HookCallback[];
11
+ timeout?: number;
12
+ }
13
+ export interface AgentHook {
14
+ name: HookEvent;
15
+ pre: boolean;
16
+ implemented: boolean;
17
+ description: string;
18
+ notes: string;
19
+ }
20
+ export declare const agentHooks: AgentHook[];
21
+ /**
22
+ * Builds the SDK hooks config from the implemented agentHooks registry.
23
+ * Only hooks present in both the registry (implemented: true) and the
24
+ * callbacks map are included in the output.
25
+ */
26
+ export declare function buildHooksConfig(callbacks: Partial<Record<HookEvent, HookCallback>>): Partial<Record<HookEvent, HookCallbackMatcher[]>>;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ // Agent hook definitions that are supported by the Anthropic SDK.
3
+ // See docs/flows.md for flow details.
4
+ //
5
+ // SDK types are mirrored locally to avoid ESM/CJS import issues with
6
+ // @anthropic-ai/claude-agent-sdk (which is dynamically imported elsewhere).
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.agentHooks = void 0;
9
+ exports.buildHooksConfig = buildHooksConfig;
10
+ exports.agentHooks = [
11
+ {
12
+ name: 'PreToolUse',
13
+ pre: true,
14
+ implemented: true,
15
+ description: 'Tool call request (can block or modify)',
16
+ notes: 'Block dangerous shell commands',
17
+ },
18
+ {
19
+ name: 'PostToolUse',
20
+ pre: true,
21
+ implemented: true,
22
+ description: 'Tool execution result',
23
+ notes: 'Log all file changes to audit trail',
24
+ },
25
+ {
26
+ name: 'PostToolUseFailure',
27
+ pre: true,
28
+ implemented: true,
29
+ description: 'Tool execution failure',
30
+ notes: 'Handle or log tool errors',
31
+ },
32
+ {
33
+ name: 'UserPromptSubmit',
34
+ pre: true,
35
+ implemented: true,
36
+ description: 'User prompt submission',
37
+ notes: 'Inject additional context into prompts',
38
+ },
39
+ {
40
+ name: 'Stop',
41
+ pre: true,
42
+ implemented: true,
43
+ description: 'Agent execution stop',
44
+ notes: 'Drain feature queue, collect remark, then allow stop',
45
+ },
46
+ {
47
+ name: 'SubagentStart',
48
+ pre: true,
49
+ implemented: true,
50
+ description: 'Subagent initialization',
51
+ notes: 'Track parallel task spawning',
52
+ },
53
+ {
54
+ name: 'SubagentStop',
55
+ pre: true,
56
+ implemented: true,
57
+ description: 'Subagent completion',
58
+ notes: 'Aggregate results from parallel tasks',
59
+ },
60
+ {
61
+ name: 'PreCompact',
62
+ pre: true,
63
+ implemented: true,
64
+ description: 'Conversation compaction request',
65
+ notes: 'Archive full transcript before summarizing',
66
+ },
67
+ {
68
+ name: 'PermissionRequest',
69
+ pre: true,
70
+ implemented: true,
71
+ description: 'Permission dialog would be displayed',
72
+ notes: 'Custom permission handling',
73
+ },
74
+ {
75
+ name: 'SessionStart',
76
+ pre: false,
77
+ implemented: true,
78
+ description: 'Session initialization',
79
+ notes: 'Initialize logging and telemetry',
80
+ },
81
+ {
82
+ name: 'SessionEnd',
83
+ pre: false,
84
+ implemented: true,
85
+ description: 'Session termination',
86
+ notes: 'Clean up temporary resources',
87
+ },
88
+ {
89
+ name: 'Notification',
90
+ pre: true,
91
+ implemented: true,
92
+ description: 'Agent status messages',
93
+ notes: 'Send agent status updates to Slack or PagerDuty',
94
+ },
95
+ ];
96
+ const HOOK_TIMEOUTS = {
97
+ Stop: 30,
98
+ };
99
+ /**
100
+ * Builds the SDK hooks config from the implemented agentHooks registry.
101
+ * Only hooks present in both the registry (implemented: true) and the
102
+ * callbacks map are included in the output.
103
+ */
104
+ function buildHooksConfig(callbacks) {
105
+ const config = {};
106
+ for (const hook of exports.agentHooks.filter((h) => h.implemented)) {
107
+ const callback = callbacks[hook.name];
108
+ if (!callback)
109
+ continue;
110
+ const timeout = HOOK_TIMEOUTS[hook.name];
111
+ const matcher = {
112
+ hooks: [callback],
113
+ ...(timeout !== undefined && { timeout }),
114
+ };
115
+ config[hook.name] = [matcher];
116
+ }
117
+ return config;
118
+ }
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Shared agent interface for Amplitude wizards
3
+ * Uses Claude Agent SDK directly with Amplitude LLM gateway
4
+ */
5
+ import { type SpinnerHandle } from '../ui';
6
+ import type { WizardOptions } from '../utils/types';
7
+ import { type AdditionalFeature } from './wizard-session';
8
+ import type { PackageManagerDetector } from './package-manager-detection';
9
+ import type { SDKMessage } from './middleware/types';
10
+ import { type HookCallback } from './agent-hooks';
11
+ type McpServersConfig = Record<string, unknown>;
12
+ export declare const AgentSignals: {
13
+ /** Signal emitted when the agent reports progress to the user */
14
+ readonly STATUS: "[STATUS]";
15
+ /** Signal emitted when the agent cannot access the Amplitude MCP server */
16
+ readonly ERROR_MCP_MISSING: "[ERROR-MCP-MISSING]";
17
+ /** Signal emitted when the agent cannot access the setup resource */
18
+ readonly ERROR_RESOURCE_MISSING: "[ERROR-RESOURCE-MISSING]";
19
+ /** Signal emitted when the agent provides a remark about its run */
20
+ readonly WIZARD_REMARK: "[WIZARD-REMARK]";
21
+ /** Signal prefix for benchmark logging */
22
+ readonly BENCHMARK: "[BENCHMARK]";
23
+ };
24
+ export type AgentSignal = (typeof AgentSignals)[keyof typeof AgentSignals];
25
+ /**
26
+ * Error types that can be returned from agent execution.
27
+ * These correspond to the error signals that the agent emits.
28
+ */
29
+ export declare enum AgentErrorType {
30
+ /** Agent could not access the Amplitude MCP server */
31
+ MCP_MISSING = "WIZARD_MCP_MISSING",
32
+ /** Agent could not access the setup resource */
33
+ RESOURCE_MISSING = "WIZARD_RESOURCE_MISSING",
34
+ /** API rate limit exceeded */
35
+ RATE_LIMIT = "WIZARD_RATE_LIMIT",
36
+ /** Generic API error */
37
+ API_ERROR = "WIZARD_API_ERROR",
38
+ /** Authentication failed — bearer token invalid or expired */
39
+ AUTH_ERROR = "WIZARD_AUTH_ERROR"
40
+ }
41
+ /**
42
+ * Check if .claude/settings.json in the project directory contains env
43
+ * overrides for blocking keys that block the Wizard from accessing the Amplitude LLM Gateway.
44
+ * Returns the list of matched key names, or an empty array if none found.
45
+ */
46
+ export declare function checkClaudeSettingsOverrides(workingDirectory: string): string[];
47
+ /**
48
+ * Copy .claude/settings.json to .wizard-backup (overwriting if it exists),
49
+ * then remove the original so the SDK doesn't load the blocking overrides.
50
+ */
51
+ export declare function backupAndFixClaudeSettings(workingDirectory: string): boolean;
52
+ /**
53
+ * Restore .claude/settings.json from .wizard-backup.
54
+ * Copies (not moves) so the backup is preserved.
55
+ */
56
+ export declare function restoreClaudeSettings(workingDirectory: string): void;
57
+ export type AgentConfig = {
58
+ workingDirectory: string;
59
+ amplitudeMcpUrl: string;
60
+ amplitudeApiKey: string;
61
+ amplitudeBearerToken: string;
62
+ amplitudeApiHost: string;
63
+ additionalMcpServers?: Record<string, {
64
+ url: string;
65
+ }>;
66
+ detectPackageManager: PackageManagerDetector;
67
+ /** Feature flag key -> variant (evaluated at start of run). */
68
+ wizardFlags?: Record<string, string>;
69
+ wizardMetadata?: Record<string, string>;
70
+ /** When true, omit the amplitude-wizard MCP server (e.g. for generic/quickstart path). */
71
+ skipAmplitudeMcp?: boolean;
72
+ /** Remote skills URL. When set, skills are downloaded instead of using bundled copies. */
73
+ skillsBaseUrl?: string;
74
+ };
75
+ /**
76
+ * Create a stop hook callback that drains the additional feature queue,
77
+ * then collects a remark, then allows stop.
78
+ *
79
+ * Three-phase logic using closure state:
80
+ * Phase 1 — drain queue: block with each feature prompt in order
81
+ * Phase 2 — collect remark (once): block with remark prompt
82
+ * Phase 3 — allow stop: return {}
83
+ *
84
+ * If `isAuthError()` returns true, all phases are skipped and stop is
85
+ * allowed immediately — the agent cannot respond when auth has failed.
86
+ */
87
+ export declare function createStopHook(featureQueue: readonly AdditionalFeature[], isAuthError?: () => boolean): HookCallback;
88
+ /**
89
+ * Configuration object returned by initializeAgent / getAgent.
90
+ */
91
+ export type AgentRunConfig = {
92
+ workingDirectory: string;
93
+ mcpServers: McpServersConfig;
94
+ model: string;
95
+ wizardFlags?: Record<string, string>;
96
+ wizardMetadata?: Record<string, string>;
97
+ /** When true, bypass the Amplitude gateway and run via the local `claude` CLI. */
98
+ useLocalClaude?: boolean;
99
+ /** When true, ANTHROPIC_API_KEY is passed through to the SDK instead of the gateway. */
100
+ useDirectApiKey?: boolean;
101
+ };
102
+ /**
103
+ * Select wizard metadata from WIZARD_VARIANTS using the variant feature flag.
104
+ * If the flag is missing or the value is not in config, returns the "base" variant (VARIANT: "base").
105
+ */
106
+ export declare function buildWizardMetadata(flags?: Record<string, string>): Record<string, string>;
107
+ /**
108
+ * Check if command is a Amplitude skill installation from MCP.
109
+ * We control the MCP server, so we only need to verify:
110
+ * 1. It installs to .claude/skills/
111
+ * 2. It downloads from our GitHub releases or localhost (dev)
112
+ */
113
+ export declare function isSkillInstallCommand(command: string): boolean;
114
+ /**
115
+ * Check if command is an allowed package manager command.
116
+ * Matches: <pkg-manager> [run|exec] <safe-script> [args...]
117
+ */
118
+ export declare function matchesAllowedPrefix(command: string): boolean;
119
+ /**
120
+ * Permission hook that allows only safe commands.
121
+ * - Package manager install commands
122
+ * - Build/typecheck/lint commands for verification
123
+ * - Piping to tail/head for output limiting is allowed
124
+ * - Stderr redirection (2>&1) is allowed
125
+ * - Amplitude skill installation commands from MCP
126
+ */
127
+ export declare function wizardCanUseTool(toolName: string, input: Record<string, unknown>): {
128
+ behavior: 'allow';
129
+ updatedInput: Record<string, unknown>;
130
+ } | {
131
+ behavior: 'deny';
132
+ message: string;
133
+ };
134
+ /**
135
+ * Initialize agent configuration for the LLM gateway
136
+ */
137
+ export declare function initializeAgent(config: AgentConfig, options: WizardOptions): Promise<AgentRunConfig>;
138
+ /**
139
+ * Return the already-initialized agent config, or call initializeAgent to create it.
140
+ * Concurrent calls during initialization share the same Promise.
141
+ * On error the cached Promise is cleared so the next call retries.
142
+ *
143
+ * Omitting config/options reads the bearer token from ~/.ampli.json and uses production
144
+ * defaults (MCP disabled if no token found, cwd as working directory).
145
+ */
146
+ export declare function getAgent(config?: AgentConfig, options?: WizardOptions): Promise<AgentRunConfig>;
147
+ /**
148
+ * Run the agent by spawning the user's local `claude` CLI with --continue.
149
+ * Used when no Amplitude API key is present (local development).
150
+ * Streams stdout line-by-line and forwards text to the spinner.
151
+ */
152
+ export declare function runAgentLocally(prompt: string, workingDirectory: string, spinner: SpinnerHandle, successMessage: string, errorMessage: string): Promise<{
153
+ error?: AgentErrorType;
154
+ message?: string;
155
+ }>;
156
+ /**
157
+ * Execute an agent with the provided prompt and options
158
+ * Handles the full lifecycle: spinner, execution, error handling
159
+ *
160
+ * @returns An object containing any error detected in the agent's output
161
+ */
162
+ export declare function runAgent(agentConfig: AgentRunConfig, prompt: string, options: WizardOptions, spinner: SpinnerHandle, config?: {
163
+ estimatedDurationMinutes?: number;
164
+ spinnerMessage?: string;
165
+ successMessage?: string;
166
+ errorMessage?: string;
167
+ additionalFeatureQueue?: readonly AdditionalFeature[];
168
+ }, middleware?: {
169
+ onMessage(message: SDKMessage): void;
170
+ finalize(resultMessage: SDKMessage, totalDurationMs: number): unknown;
171
+ }): Promise<{
172
+ error?: AgentErrorType;
173
+ message?: string;
174
+ }>;
175
+ export {};