@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,12 @@
1
+ /**
2
+ * ReportViewer — Scrollable viewer for amplitude-setup-report.md.
3
+ *
4
+ * Reads the file from disk and displays it with basic markdown rendering
5
+ * (headings bold, bullet points preserved). Supports up/down scrolling
6
+ * via arrow keys or j/k vim keys.
7
+ */
8
+ interface ReportViewerProps {
9
+ filePath: string;
10
+ }
11
+ export declare const ReportViewer: ({ filePath }: ReportViewerProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,99 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * ReportViewer — Scrollable viewer for amplitude-setup-report.md.
4
+ *
5
+ * Reads the file from disk and displays it with basic markdown rendering
6
+ * (headings bold, bullet points preserved). Supports up/down scrolling
7
+ * via arrow keys or j/k vim keys.
8
+ */
9
+ import { Box, Text } from 'ink';
10
+ import { useState, useEffect } from 'react';
11
+ import * as fs from 'fs';
12
+ import { useStdoutDimensions } from '../hooks/useStdoutDimensions.js';
13
+ import { useScreenInput } from '../hooks/useScreenInput.js';
14
+ import { Colors } from '../styles.js';
15
+ /** Rows consumed by ConsoleView border + TitleBar + separator + tab bar chrome */
16
+ const CHROME_ROWS = 10;
17
+ /** Strip markdown syntax for terminal rendering — keep text readable. */
18
+ function renderLine(line) {
19
+ if (/^#{1,3}\s/.test(line)) {
20
+ return { text: line.replace(/^#+\s*/, ''), bold: true, dimmed: false };
21
+ }
22
+ if (/^---+$/.test(line.trim())) {
23
+ return { text: '─'.repeat(40), bold: false, dimmed: true };
24
+ }
25
+ return { text: line, bold: false, dimmed: false };
26
+ }
27
+ export const ReportViewer = ({ filePath }) => {
28
+ const [, rows] = useStdoutDimensions();
29
+ const visibleLines = Math.max(5, rows - CHROME_ROWS);
30
+ const [lines, setLines] = useState([]);
31
+ const [offset, setOffset] = useState(0);
32
+ useEffect(() => {
33
+ try {
34
+ const content = fs.readFileSync(filePath, 'utf-8');
35
+ setLines(content.split('\n'));
36
+ }
37
+ catch {
38
+ setLines(['(No report found — the agent may still be running)']);
39
+ }
40
+ // Watch for the file to appear/update (agent may still be writing)
41
+ let watcher;
42
+ let interval;
43
+ const startWatch = () => {
44
+ try {
45
+ watcher = fs.watch(filePath, () => {
46
+ try {
47
+ const content = fs.readFileSync(filePath, 'utf-8');
48
+ setLines(content.split('\n'));
49
+ }
50
+ catch {
51
+ // ignore
52
+ }
53
+ });
54
+ }
55
+ catch {
56
+ // File not yet available — poll
57
+ interval = setInterval(() => {
58
+ try {
59
+ fs.accessSync(filePath);
60
+ const content = fs.readFileSync(filePath, 'utf-8');
61
+ setLines(content.split('\n'));
62
+ clearInterval(interval);
63
+ interval = undefined;
64
+ startWatch();
65
+ }
66
+ catch {
67
+ // still waiting
68
+ }
69
+ }, 1000);
70
+ }
71
+ };
72
+ startWatch();
73
+ return () => {
74
+ watcher?.close();
75
+ if (interval)
76
+ clearInterval(interval);
77
+ };
78
+ }, [filePath]);
79
+ const maxOffset = Math.max(0, lines.length - visibleLines);
80
+ useScreenInput((input, key) => {
81
+ if (key.upArrow || input === 'k') {
82
+ setOffset((o) => Math.max(0, o - 1));
83
+ }
84
+ else if (key.downArrow || input === 'j') {
85
+ setOffset((o) => Math.min(maxOffset, o + 1));
86
+ }
87
+ else if (key.pageUp) {
88
+ setOffset((o) => Math.max(0, o - visibleLines));
89
+ }
90
+ else if (key.pageDown) {
91
+ setOffset((o) => Math.min(maxOffset, o + visibleLines));
92
+ }
93
+ });
94
+ const visible = lines.slice(offset, offset + visibleLines);
95
+ return (_jsxs(Box, { flexDirection: "column", height: visibleLines, children: [visible.map((line, i) => {
96
+ const { text, bold, dimmed } = renderLine(line);
97
+ return (_jsx(Text, { bold: bold, color: dimmed ? Colors.muted : undefined, wrap: "truncate", children: text }, i));
98
+ }), lines.length > visibleLines && (_jsxs(Text, { color: Colors.muted, children: [' ', "\u2191\u2193 to scroll \u00B7 ", offset + visibleLines, "/", lines.length, " lines"] }))] }));
99
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * ScreenErrorBoundary — catches React render errors in screens
3
+ * and surfaces them in ConsoleView via store.screenError.
4
+ *
5
+ * The error is displayed between the content area and the text input.
6
+ * Pressing R in ConsoleView increments store.screenErrorRetry, which
7
+ * causes this boundary to reset and re-render the screen.
8
+ */
9
+ import { Component, type ReactNode } from 'react';
10
+ import type { WizardStore } from '../store.js';
11
+ interface Props {
12
+ store: WizardStore;
13
+ retryToken: number;
14
+ children: ReactNode;
15
+ }
16
+ interface State {
17
+ error: Error | null;
18
+ }
19
+ export declare class ScreenErrorBoundary extends Component<Props, State> {
20
+ state: State;
21
+ static getDerivedStateFromError(error: Error): State;
22
+ componentDidCatch(error: Error): void;
23
+ componentDidUpdate(prevProps: Props): void;
24
+ render(): ReactNode;
25
+ }
26
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * ScreenErrorBoundary — catches React render errors in screens
3
+ * and surfaces them in ConsoleView via store.screenError.
4
+ *
5
+ * The error is displayed between the content area and the text input.
6
+ * Pressing R in ConsoleView increments store.screenErrorRetry, which
7
+ * causes this boundary to reset and re-render the screen.
8
+ */
9
+ import { Component } from 'react';
10
+ export class ScreenErrorBoundary extends Component {
11
+ state = { error: null };
12
+ static getDerivedStateFromError(error) {
13
+ return { error };
14
+ }
15
+ componentDidCatch(error) {
16
+ this.props.store.setScreenError(error);
17
+ }
18
+ componentDidUpdate(prevProps) {
19
+ if (prevProps.retryToken !== this.props.retryToken && this.state.error) {
20
+ this.setState({ error: null });
21
+ }
22
+ }
23
+ render() {
24
+ // When errored, render nothing — ConsoleView shows the banner.
25
+ if (this.state.error)
26
+ return null;
27
+ return this.props.children;
28
+ }
29
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * SlashCommandInput — Text input with slash-command picker.
3
+ *
4
+ * When isActive=false (default): renders a dim hint, captures no input.
5
+ * When isActive=true: captures all input, calls onDeactivate on submit/escape.
6
+ *
7
+ * Activation is controlled by the parent (ConsoleView).
8
+ */
9
+ export interface SlashCommand {
10
+ cmd: string;
11
+ desc: string;
12
+ }
13
+ interface SlashCommandInputProps {
14
+ commands?: SlashCommand[];
15
+ isActive: boolean;
16
+ initialValue?: string;
17
+ onSubmit: (value: string) => void;
18
+ onDeactivate: () => void;
19
+ }
20
+ export declare const SlashCommandInput: ({ commands, isActive, initialValue, onSubmit, onDeactivate, }: SlashCommandInputProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,85 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * SlashCommandInput — Text input with slash-command picker.
4
+ *
5
+ * When isActive=false (default): renders a dim hint, captures no input.
6
+ * When isActive=true: captures all input, calls onDeactivate on submit/escape.
7
+ *
8
+ * Activation is controlled by the parent (ConsoleView).
9
+ */
10
+ import { Box, Text, useInput } from 'ink';
11
+ import { useState, useEffect } from 'react';
12
+ import { Colors, Icons } from '../styles.js';
13
+ export const SlashCommandInput = ({ commands = [], isActive, initialValue = '', onSubmit, onDeactivate, }) => {
14
+ const [value, setValue] = useState(initialValue);
15
+ const [selectedIndex, setSelectedIndex] = useState(0);
16
+ const [cursorVisible, setCursorVisible] = useState(true);
17
+ useEffect(() => {
18
+ if (!isActive)
19
+ return;
20
+ setCursorVisible(true);
21
+ const id = setInterval(() => setCursorVisible((v) => !v), 530);
22
+ return () => clearInterval(id);
23
+ }, [isActive]);
24
+ const isSlashMode = value.startsWith('/');
25
+ const query = value.slice(1).toLowerCase();
26
+ const filtered = isSlashMode
27
+ ? commands
28
+ .filter((c) => c.cmd.slice(1).startsWith(query) ||
29
+ c.desc.toLowerCase().includes(query))
30
+ .sort((a, b) => {
31
+ const aStarts = a.cmd.slice(1).startsWith(query) ? 0 : 1;
32
+ const bStarts = b.cmd.slice(1).startsWith(query) ? 0 : 1;
33
+ return aStarts - bStarts;
34
+ })
35
+ : [];
36
+ const clampedIndex = Math.min(selectedIndex, Math.max(0, filtered.length - 1));
37
+ useInput((char, key) => {
38
+ if (key.upArrow && isSlashMode) {
39
+ setSelectedIndex((i) => Math.max(0, i - 1));
40
+ return;
41
+ }
42
+ if (key.downArrow && isSlashMode) {
43
+ setSelectedIndex((i) => Math.min(filtered.length - 1, i + 1));
44
+ return;
45
+ }
46
+ if (key.return) {
47
+ if (isSlashMode && filtered.length > 0) {
48
+ onSubmit(filtered[clampedIndex].cmd);
49
+ }
50
+ else if (value.trim()) {
51
+ onSubmit(value.trim());
52
+ }
53
+ setValue('');
54
+ setSelectedIndex(0);
55
+ onDeactivate();
56
+ return;
57
+ }
58
+ if (key.escape) {
59
+ setValue('');
60
+ setSelectedIndex(0);
61
+ onDeactivate();
62
+ return;
63
+ }
64
+ if (key.backspace || key.delete) {
65
+ const next = value.slice(0, -1);
66
+ setValue(next);
67
+ setSelectedIndex(0);
68
+ if (next === '')
69
+ onDeactivate();
70
+ return;
71
+ }
72
+ if (key.ctrl || key.meta || key.tab)
73
+ return;
74
+ if (char) {
75
+ setValue((v) => v + char);
76
+ setSelectedIndex(0);
77
+ }
78
+ }, { isActive });
79
+ if (!isActive) {
80
+ return (_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: Colors.muted, children: '>' }), _jsx(Text, { color: Colors.muted, inverse: false, children: ' ' })] }));
81
+ }
82
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: Colors.muted, children: '>' }), _jsxs(Text, { children: [value, cursorVisible ? _jsx(Text, { inverse: true, children: " " }) : _jsx(Text, { children: " " })] })] }), isSlashMode && filtered.length > 0 && (_jsx(Box, { flexDirection: "column", marginTop: 1, children: filtered.map((c, i) => (_jsxs(Box, { gap: 2, children: [_jsx(Text, { color: i === clampedIndex ? Colors.primary : undefined, bold: i === clampedIndex, children: i === clampedIndex
83
+ ? Icons.triangleSmallRight + ' ' + c.cmd
84
+ : ' ' + c.cmd }), _jsx(Text, { color: i !== clampedIndex ? Colors.muted : undefined, children: c.desc })] }, c.cmd))) }))] }));
85
+ };
@@ -0,0 +1 @@
1
+ export { SnakeGame } from '@pavus/snake-game';
@@ -0,0 +1 @@
1
+ export { SnakeGame } from '@pavus/snake-game';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * SplitView — Two-pane horizontal layout: 50/50.
3
+ */
4
+ import type { ReactNode } from 'react';
5
+ interface SplitViewProps {
6
+ left: ReactNode;
7
+ right: ReactNode;
8
+ gap?: number;
9
+ }
10
+ export declare const SplitView: ({ left, right, gap }: SplitViewProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * SplitView — Two-pane horizontal layout: 50/50.
4
+ */
5
+ import { Box } from 'ink';
6
+ export const SplitView = ({ left, right, gap = 2 }) => {
7
+ return (_jsxs(Box, { flexDirection: "row", flexGrow: 1, gap: gap, children: [_jsx(Box, { width: "50%", flexDirection: "column", children: left }), _jsx(Box, { width: "50%", flexDirection: "column", children: right })] }));
8
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * TabContainer — Self-contained tabbed interface.
3
+ * Absorbs BottomTabBar + StatusPanel functionality.
4
+ */
5
+ import { type ReactNode } from 'react';
6
+ export interface TabDefinition {
7
+ id: string;
8
+ label: string;
9
+ component: ReactNode;
10
+ }
11
+ interface TabContainerProps {
12
+ tabs: TabDefinition[];
13
+ statusMessage?: string;
14
+ requestedTab?: string | null;
15
+ onTabConsumed?: () => void;
16
+ }
17
+ export declare const TabContainer: ({ tabs, statusMessage, requestedTab, onTabConsumed, }: TabContainerProps) => import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * TabContainer — Self-contained tabbed interface.
4
+ * Absorbs BottomTabBar + StatusPanel functionality.
5
+ */
6
+ import { Box, Text } from 'ink';
7
+ import { useScreenInput } from '../hooks/useScreenInput.js';
8
+ import { useState, useEffect } from 'react';
9
+ import { Colors, Icons } from '../styles.js';
10
+ export const TabContainer = ({ tabs, statusMessage, requestedTab, onTabConsumed, }) => {
11
+ const [activeTab, setActiveTab] = useState(0);
12
+ useEffect(() => {
13
+ if (!requestedTab)
14
+ return;
15
+ const idx = tabs.findIndex((t) => t.id === requestedTab);
16
+ if (idx !== -1)
17
+ setActiveTab(idx);
18
+ onTabConsumed?.();
19
+ }, [requestedTab]);
20
+ useScreenInput((_input, key) => {
21
+ if (key.leftArrow) {
22
+ setActiveTab((prev) => Math.max(0, prev - 1));
23
+ }
24
+ if (key.rightArrow) {
25
+ setActiveTab((prev) => Math.min(tabs.length - 1, prev + 1));
26
+ }
27
+ });
28
+ const current = tabs[activeTab];
29
+ return (_jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, children: current?.component }), statusMessage && (_jsx(Box, { borderStyle: "single", borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, borderColor: Colors.muted, paddingX: 1, overflow: "hidden", children: _jsxs(Text, { color: Colors.muted, children: [Icons.diamondOpen, " ", statusMessage] }) })), _jsx(Box, { height: 1 }), _jsxs(Box, { gap: 1, paddingX: 1, justifyContent: "space-between", children: [_jsx(Box, { gap: 1, children: tabs.map((tab, i) => (_jsx(Text, { inverse: i === activeTab, color: i === activeTab ? Colors.accent : Colors.muted, bold: i === activeTab, children: ` ${tab.label} ` }, tab.id))) }), _jsx(Text, { color: Colors.muted, children: "\u2190 \u2192 to browse tabs while the wizard runs" })] })] }));
30
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Barrel export for all TUI layout primitives.
3
+ */
4
+ export { CardLayout } from './CardLayout.js';
5
+ export { SplitView } from './SplitView.js';
6
+ export { LoadingBox } from './LoadingBox.js';
7
+ export { ProgressList } from './ProgressList.js';
8
+ export type { ProgressItem } from './ProgressList.js';
9
+ export { PromptLabel } from './PromptLabel.js';
10
+ export { PickerMenu } from './PickerMenu.js';
11
+ export { ConfirmationInput } from './ConfirmationInput.js';
12
+ export { LogViewer } from './LogViewer.js';
13
+ export { ReportViewer } from './ReportViewer.js';
14
+ export { EventPlanViewer } from './EventPlanViewer.js';
15
+ export { ScreenErrorBoundary } from './ScreenErrorBoundary.js';
16
+ export { TabContainer } from './TabContainer.js';
17
+ export type { TabDefinition } from './TabContainer.js';
18
+ export { KagiSmallWebViewer } from './KagiSmallWebViewer.js';
19
+ export { SnakeGame } from './SnakeGame.js';
20
+ export { DissolveTransition } from './DissolveTransition.js';
21
+ export type { WipeDirection } from './DissolveTransition.js';
22
+ export { SlashCommandInput } from './SlashCommandInput.js';
23
+ export type { SlashCommand } from './SlashCommandInput.js';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Barrel export for all TUI layout primitives.
3
+ */
4
+ export { CardLayout } from './CardLayout.js';
5
+ export { SplitView } from './SplitView.js';
6
+ export { LoadingBox } from './LoadingBox.js';
7
+ export { ProgressList } from './ProgressList.js';
8
+ export { PromptLabel } from './PromptLabel.js';
9
+ export { PickerMenu } from './PickerMenu.js';
10
+ export { ConfirmationInput } from './ConfirmationInput.js';
11
+ export { LogViewer } from './LogViewer.js';
12
+ export { ReportViewer } from './ReportViewer.js';
13
+ export { EventPlanViewer } from './EventPlanViewer.js';
14
+ export { ScreenErrorBoundary } from './ScreenErrorBoundary.js';
15
+ export { TabContainer } from './TabContainer.js';
16
+ export { KagiSmallWebViewer } from './KagiSmallWebViewer.js';
17
+ export { SnakeGame } from './SnakeGame.js';
18
+ export { DissolveTransition } from './DissolveTransition.js';
19
+ export { SlashCommandInput } from './SlashCommandInput.js';
@@ -0,0 +1,61 @@
1
+ /**
2
+ * WizardRouter — declarative flow pipelines + overlay stack.
3
+ *
4
+ * Two layers:
5
+ * Flow cursor — linear pipeline of screens, advanced with next()
6
+ * Overlay stack — interrupts (outage, auth-expired, etc.) that push/pop
7
+ *
8
+ * The visible screen is: top of overlay stack if non-empty, otherwise the flow cursor.
9
+ *
10
+ * Adding a flow screen = append to a pipeline array.
11
+ * Adding an overlay = call pushOverlay() from anywhere.
12
+ * No switch statements, no hardcoded transitions in business logic.
13
+ */
14
+ import type { WizardSession } from '../../lib/wizard-session.js';
15
+ import { Screen, Flow, type FlowEntry } from './flows.js';
16
+ export { Screen, Flow };
17
+ export type { FlowEntry };
18
+ /** Screens that interrupt flows as overlays */
19
+ export declare enum Overlay {
20
+ Outage = "outage",
21
+ SettingsOverride = "settings-override",
22
+ Snake = "snake",
23
+ Mcp = "mcp-overlay",
24
+ Slack = "slack-overlay",
25
+ Logout = "logout-overlay",
26
+ Login = "login-overlay"
27
+ }
28
+ /** Union of all screen names */
29
+ export type ScreenName = Screen | Overlay;
30
+ export declare class WizardRouter {
31
+ private flow;
32
+ private flowName;
33
+ private overlays;
34
+ constructor(flowName?: Flow);
35
+ /**
36
+ * Resolve which screen should be active based on session state.
37
+ * Walks the flow pipeline, skipping hidden entries and completed entries,
38
+ * returns the first incomplete screen.
39
+ */
40
+ resolve(session: WizardSession): ScreenName;
41
+ /** The screen that should be rendered right now. */
42
+ get activeScreen(): ScreenName;
43
+ /** The name of the active flow. */
44
+ get activeFlow(): Flow;
45
+ /** Whether an overlay is currently active. */
46
+ get hasOverlay(): boolean;
47
+ /**
48
+ * Push an overlay that interrupts the current flow.
49
+ * The flow resumes when the overlay is dismissed via popOverlay().
50
+ */
51
+ pushOverlay(overlay: Overlay): void;
52
+ /**
53
+ * Dismiss the topmost overlay. The flow screen underneath resumes.
54
+ */
55
+ popOverlay(): void;
56
+ /**
57
+ * Direction hint for screen transitions.
58
+ */
59
+ private _lastDirection;
60
+ get lastNavDirection(): 'push' | 'pop' | null;
61
+ }
@@ -0,0 +1,104 @@
1
+ /**
2
+ * WizardRouter — declarative flow pipelines + overlay stack.
3
+ *
4
+ * Two layers:
5
+ * Flow cursor — linear pipeline of screens, advanced with next()
6
+ * Overlay stack — interrupts (outage, auth-expired, etc.) that push/pop
7
+ *
8
+ * The visible screen is: top of overlay stack if non-empty, otherwise the flow cursor.
9
+ *
10
+ * Adding a flow screen = append to a pipeline array.
11
+ * Adding an overlay = call pushOverlay() from anywhere.
12
+ * No switch statements, no hardcoded transitions in business logic.
13
+ */
14
+ import { OutroKind } from '../../lib/wizard-session.js';
15
+ import { FLOWS, Screen, Flow } from './flows.js';
16
+ // Re-export so existing imports from './router.js' keep working
17
+ export { Screen, Flow };
18
+ // ── Screen name taxonomy ──────────────────────────────────────────────
19
+ /** Screens that interrupt flows as overlays */
20
+ export var Overlay;
21
+ (function (Overlay) {
22
+ Overlay["Outage"] = "outage";
23
+ Overlay["SettingsOverride"] = "settings-override";
24
+ Overlay["Snake"] = "snake";
25
+ Overlay["Mcp"] = "mcp-overlay";
26
+ Overlay["Slack"] = "slack-overlay";
27
+ Overlay["Logout"] = "logout-overlay";
28
+ Overlay["Login"] = "login-overlay";
29
+ })(Overlay || (Overlay = {}));
30
+ // ── Router ────────────────────────────────────────────────────────────
31
+ export class WizardRouter {
32
+ flow;
33
+ flowName;
34
+ overlays = [];
35
+ constructor(flowName = Flow.Wizard) {
36
+ this.flowName = flowName;
37
+ this.flow = FLOWS[flowName];
38
+ }
39
+ /**
40
+ * Resolve which screen should be active based on session state.
41
+ * Walks the flow pipeline, skipping hidden entries and completed entries,
42
+ * returns the first incomplete screen.
43
+ */
44
+ resolve(session) {
45
+ if (this.overlays.length > 0) {
46
+ return this.overlays[this.overlays.length - 1];
47
+ }
48
+ // If the user cancelled before the run completed, jump directly to Outro.
49
+ // Success/Error are handled by the normal flow (MCP + Slack still need to show).
50
+ if (session.outroData?.kind === OutroKind.Cancel) {
51
+ return Screen.Outro;
52
+ }
53
+ for (const entry of this.flow) {
54
+ if (entry.show && !entry.show(session))
55
+ continue;
56
+ if (entry.isComplete && entry.isComplete(session))
57
+ continue;
58
+ return entry.screen;
59
+ }
60
+ // All entries complete — show the last screen (outro)
61
+ return this.flow[this.flow.length - 1].screen;
62
+ }
63
+ /** The screen that should be rendered right now. */
64
+ get activeScreen() {
65
+ // Overlays take priority — resolve() handles this too,
66
+ // but activeScreen is called before session is available in some paths
67
+ if (this.overlays.length > 0) {
68
+ return this.overlays[this.overlays.length - 1];
69
+ }
70
+ return this.flow[0].screen;
71
+ }
72
+ /** The name of the active flow. */
73
+ get activeFlow() {
74
+ return this.flowName;
75
+ }
76
+ /** Whether an overlay is currently active. */
77
+ get hasOverlay() {
78
+ return this.overlays.length > 0;
79
+ }
80
+ /**
81
+ * Push an overlay that interrupts the current flow.
82
+ * The flow resumes when the overlay is dismissed via popOverlay().
83
+ */
84
+ pushOverlay(overlay) {
85
+ this.overlays.push(overlay);
86
+ }
87
+ /**
88
+ * Dismiss the topmost overlay. The flow screen underneath resumes.
89
+ */
90
+ popOverlay() {
91
+ this.overlays.pop();
92
+ }
93
+ /**
94
+ * Direction hint for screen transitions.
95
+ */
96
+ _lastDirection = null;
97
+ get lastNavDirection() {
98
+ return this._lastDirection;
99
+ }
100
+ /** @internal — called by store wrapper to track direction */
101
+ _setDirection(dir) {
102
+ this._lastDirection = dir;
103
+ }
104
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Screen registry — maps screen names to React components.
3
+ *
4
+ * Adding a new screen:
5
+ * 1. Create the component in screens/
6
+ * 2. Add an entry here
7
+ * 3. Add the screen name to the router flow (router.ts)
8
+ *
9
+ * App.tsx never needs to change.
10
+ */
11
+ import type { ReactNode } from 'react';
12
+ import type { WizardStore } from './store.js';
13
+ import { type ScreenName } from './router.js';
14
+ import type { McpInstaller } from './services/mcp-installer.js';
15
+ export interface ScreenServices {
16
+ mcpInstaller: McpInstaller;
17
+ }
18
+ export declare function createServices(localMcp?: boolean): ScreenServices;
19
+ export declare function createScreens(store: WizardStore, services: ScreenServices): Record<ScreenName, ReactNode>;
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Screen, Overlay } from './router.js';
3
+ import { OutageScreen } from './screens/OutageScreen.js';
4
+ import { SettingsOverrideScreen } from './screens/SettingsOverrideScreen.js';
5
+ import { IntroScreen } from './screens/IntroScreen.js';
6
+ import { SetupScreen } from './screens/SetupScreen.js';
7
+ import { AuthScreen } from './screens/AuthScreen.js';
8
+ import { RegionSelectScreen } from './screens/RegionSelectScreen.js';
9
+ import { DataSetupScreen } from './screens/DataSetupScreen.js';
10
+ import { ActivationOptionsScreen } from './screens/ActivationOptionsScreen.js';
11
+ import { RunScreen } from './screens/RunScreen.js';
12
+ import { McpScreen } from './screens/McpScreen.js';
13
+ import { DataIngestionCheckScreen } from './screens/DataIngestionCheckScreen.js';
14
+ import { ChecklistScreen } from './screens/ChecklistScreen.js';
15
+ import { SlackScreen } from './screens/SlackScreen.js';
16
+ import { LogoutScreen } from './screens/LogoutScreen.js';
17
+ import { LoginScreen } from './screens/LoginScreen.js';
18
+ import { OutroScreen } from './screens/OutroScreen.js';
19
+ import { createMcpInstaller } from './services/mcp-installer.js';
20
+ import { SnakeGame } from './primitives/SnakeGame.js';
21
+ export function createServices(localMcp = false) {
22
+ return {
23
+ mcpInstaller: createMcpInstaller(localMcp),
24
+ };
25
+ }
26
+ export function createScreens(store, services) {
27
+ return {
28
+ // Overlays
29
+ [Overlay.Outage]: _jsx(OutageScreen, { store: store }),
30
+ [Overlay.SettingsOverride]: _jsx(SettingsOverrideScreen, { store: store }),
31
+ [Overlay.Snake]: _jsx(SnakeGame, { onExit: () => store.hideSnakeOverlay() }),
32
+ [Overlay.Mcp]: (_jsx(McpScreen, { store: store, installer: services.mcpInstaller, onComplete: () => store.hideMcpOverlay() })),
33
+ [Overlay.Slack]: (_jsx(SlackScreen, { store: store, onComplete: () => store.hideSlackOverlay() })),
34
+ [Overlay.Logout]: (_jsx(LogoutScreen, { onComplete: () => store.hideLogoutOverlay(), installDir: store.session.installDir })),
35
+ [Overlay.Login]: (_jsx(LoginScreen, { store: store, onComplete: () => store.hideLoginOverlay() })),
36
+ // Wizard flow
37
+ [Screen.Intro]: _jsx(IntroScreen, { store: store }),
38
+ [Screen.Setup]: _jsx(SetupScreen, { store: store }),
39
+ [Screen.Auth]: _jsx(AuthScreen, { store: store }),
40
+ [Screen.RegionSelect]: _jsx(RegionSelectScreen, { store: store }),
41
+ [Screen.DataSetup]: _jsx(DataSetupScreen, { store: store }),
42
+ [Screen.ActivationOptions]: _jsx(ActivationOptionsScreen, { store: store }),
43
+ [Screen.Options]: null,
44
+ [Screen.Run]: _jsx(RunScreen, { store: store }),
45
+ [Screen.Mcp]: _jsx(McpScreen, { store: store, installer: services.mcpInstaller }),
46
+ [Screen.DataIngestionCheck]: _jsx(DataIngestionCheckScreen, { store: store }),
47
+ [Screen.Checklist]: _jsx(ChecklistScreen, { store: store }),
48
+ [Screen.Outro]: _jsx(OutroScreen, { store: store }),
49
+ // Standalone MCP flows
50
+ [Screen.McpAdd]: (_jsx(McpScreen, { store: store, installer: services.mcpInstaller, standalone: true })),
51
+ [Screen.McpRemove]: (_jsx(McpScreen, { store: store, installer: services.mcpInstaller, mode: "remove", standalone: true })),
52
+ // Slack integration (in-wizard step and standalone flow)
53
+ [Screen.Slack]: _jsx(SlackScreen, { store: store }),
54
+ [Screen.SlackSetup]: _jsx(SlackScreen, { store: store, standalone: true }),
55
+ };
56
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ActivationOptionsScreen — "What would you like to do?" prompt.
3
+ *
4
+ * Shown when the user has the SDK installed but hasn't fully activated yet
5
+ * (1–49 events). Offers next-step options without forcing a full re-run.
6
+ */
7
+ import type { WizardStore } from '../store.js';
8
+ interface ActivationOptionsScreenProps {
9
+ store: WizardStore;
10
+ }
11
+ export declare const ActivationOptionsScreen: ({ store, }: ActivationOptionsScreenProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};