workos 0.19.0 → 0.20.2

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 (681) hide show
  1. package/README.md +4 -646
  2. package/bin/workos.js +44 -0
  3. package/package.json +18 -99
  4. package/LICENSE +0 -47
  5. package/dist/bin.d.ts +0 -2
  6. package/dist/bin.js +0 -1790
  7. package/dist/bin.js.map +0 -1
  8. package/dist/cli.config.d.ts +0 -88
  9. package/dist/cli.config.js +0 -110
  10. package/dist/cli.config.js.map +0 -1
  11. package/dist/commands/api/catalog.d.ts +0 -23
  12. package/dist/commands/api/catalog.js +0 -97
  13. package/dist/commands/api/catalog.js.map +0 -1
  14. package/dist/commands/api/format.d.ts +0 -5
  15. package/dist/commands/api/format.js +0 -46
  16. package/dist/commands/api/format.js.map +0 -1
  17. package/dist/commands/api/index.d.ts +0 -15
  18. package/dist/commands/api/index.js +0 -213
  19. package/dist/commands/api/index.js.map +0 -1
  20. package/dist/commands/api/interactive.d.ts +0 -3
  21. package/dist/commands/api/interactive.js +0 -133
  22. package/dist/commands/api/interactive.js.map +0 -1
  23. package/dist/commands/api/request.d.ts +0 -14
  24. package/dist/commands/api/request.js +0 -38
  25. package/dist/commands/api/request.js.map +0 -1
  26. package/dist/commands/api-key-mgmt.d.ts +0 -16
  27. package/dist/commands/api-key-mgmt.js +0 -96
  28. package/dist/commands/api-key-mgmt.js.map +0 -1
  29. package/dist/commands/audit-log.d.ts +0 -26
  30. package/dist/commands/audit-log.js +0 -155
  31. package/dist/commands/audit-log.js.map +0 -1
  32. package/dist/commands/auth-status.d.ts +0 -1
  33. package/dist/commands/auth-status.js +0 -57
  34. package/dist/commands/auth-status.js.map +0 -1
  35. package/dist/commands/claim.d.ts +0 -11
  36. package/dist/commands/claim.js +0 -143
  37. package/dist/commands/claim.js.map +0 -1
  38. package/dist/commands/config.d.ts +0 -3
  39. package/dist/commands/config.js +0 -54
  40. package/dist/commands/config.js.map +0 -1
  41. package/dist/commands/connection.d.ts +0 -13
  42. package/dist/commands/connection.js +0 -96
  43. package/dist/commands/connection.js.map +0 -1
  44. package/dist/commands/debug-sso.d.ts +0 -1
  45. package/dist/commands/debug-sso.js +0 -78
  46. package/dist/commands/debug-sso.js.map +0 -1
  47. package/dist/commands/debug-sync.d.ts +0 -1
  48. package/dist/commands/debug-sync.js +0 -102
  49. package/dist/commands/debug-sync.js.map +0 -1
  50. package/dist/commands/debug.d.ts +0 -28
  51. package/dist/commands/debug.js +0 -406
  52. package/dist/commands/debug.js.map +0 -1
  53. package/dist/commands/dev.d.ts +0 -22
  54. package/dist/commands/dev.js +0 -145
  55. package/dist/commands/dev.js.map +0 -1
  56. package/dist/commands/directory.d.ts +0 -27
  57. package/dist/commands/directory.js +0 -176
  58. package/dist/commands/directory.js.map +0 -1
  59. package/dist/commands/doctor.d.ts +0 -12
  60. package/dist/commands/doctor.js +0 -41
  61. package/dist/commands/doctor.js.map +0 -1
  62. package/dist/commands/emulate.d.ts +0 -7
  63. package/dist/commands/emulate.js +0 -69
  64. package/dist/commands/emulate.js.map +0 -1
  65. package/dist/commands/env.d.ts +0 -19
  66. package/dist/commands/env.js +0 -303
  67. package/dist/commands/env.js.map +0 -1
  68. package/dist/commands/event.d.ts +0 -9
  69. package/dist/commands/event.js +0 -43
  70. package/dist/commands/event.js.map +0 -1
  71. package/dist/commands/feature-flag.d.ts +0 -12
  72. package/dist/commands/feature-flag.js +0 -96
  73. package/dist/commands/feature-flag.js.map +0 -1
  74. package/dist/commands/install-skill.d.ts +0 -85
  75. package/dist/commands/install-skill.js +0 -332
  76. package/dist/commands/install-skill.js.map +0 -1
  77. package/dist/commands/install.d.ts +0 -6
  78. package/dist/commands/install.js +0 -51
  79. package/dist/commands/install.js.map +0 -1
  80. package/dist/commands/invitation.d.ts +0 -19
  81. package/dist/commands/invitation.js +0 -94
  82. package/dist/commands/invitation.js.map +0 -1
  83. package/dist/commands/list-skills.d.ts +0 -4
  84. package/dist/commands/list-skills.js +0 -52
  85. package/dist/commands/list-skills.js.map +0 -1
  86. package/dist/commands/login.d.ts +0 -32
  87. package/dist/commands/login.js +0 -239
  88. package/dist/commands/login.js.map +0 -1
  89. package/dist/commands/logout.d.ts +0 -1
  90. package/dist/commands/logout.js +0 -17
  91. package/dist/commands/logout.js.map +0 -1
  92. package/dist/commands/mcp.d.ts +0 -14
  93. package/dist/commands/mcp.js +0 -99
  94. package/dist/commands/mcp.js.map +0 -1
  95. package/dist/commands/membership.d.ts +0 -20
  96. package/dist/commands/membership.js +0 -129
  97. package/dist/commands/membership.js.map +0 -1
  98. package/dist/commands/migrations.d.ts +0 -2
  99. package/dist/commands/migrations.js +0 -50
  100. package/dist/commands/migrations.js.map +0 -1
  101. package/dist/commands/onboard-user.d.ts +0 -7
  102. package/dist/commands/onboard-user.js +0 -61
  103. package/dist/commands/onboard-user.js.map +0 -1
  104. package/dist/commands/org-domain.d.ts +0 -4
  105. package/dist/commands/org-domain.js +0 -45
  106. package/dist/commands/org-domain.js.map +0 -1
  107. package/dist/commands/organization.d.ts +0 -14
  108. package/dist/commands/organization.js +0 -103
  109. package/dist/commands/organization.js.map +0 -1
  110. package/dist/commands/permission.d.ts +0 -20
  111. package/dist/commands/permission.js +0 -93
  112. package/dist/commands/permission.js.map +0 -1
  113. package/dist/commands/portal.d.ts +0 -7
  114. package/dist/commands/portal.js +0 -26
  115. package/dist/commands/portal.js.map +0 -1
  116. package/dist/commands/role.d.ts +0 -17
  117. package/dist/commands/role.js +0 -122
  118. package/dist/commands/role.js.map +0 -1
  119. package/dist/commands/seed.d.ts +0 -6
  120. package/dist/commands/seed.js +0 -298
  121. package/dist/commands/seed.js.map +0 -1
  122. package/dist/commands/session.d.ts +0 -8
  123. package/dist/commands/session.js +0 -63
  124. package/dist/commands/session.js.map +0 -1
  125. package/dist/commands/setup-org.d.ts +0 -6
  126. package/dist/commands/setup-org.js +0 -99
  127. package/dist/commands/setup-org.js.map +0 -1
  128. package/dist/commands/setup.d.ts +0 -50
  129. package/dist/commands/setup.js +0 -237
  130. package/dist/commands/setup.js.map +0 -1
  131. package/dist/commands/telemetry.d.ts +0 -3
  132. package/dist/commands/telemetry.js +0 -88
  133. package/dist/commands/telemetry.js.map +0 -1
  134. package/dist/commands/uninstall-skill.d.ts +0 -11
  135. package/dist/commands/uninstall-skill.js +0 -117
  136. package/dist/commands/uninstall-skill.js.map +0 -1
  137. package/dist/commands/user.d.ts +0 -19
  138. package/dist/commands/user.js +0 -92
  139. package/dist/commands/user.js.map +0 -1
  140. package/dist/commands/vault-run.d.ts +0 -13
  141. package/dist/commands/vault-run.js +0 -195
  142. package/dist/commands/vault-run.js.map +0 -1
  143. package/dist/commands/vault.d.ts +0 -25
  144. package/dist/commands/vault.js +0 -153
  145. package/dist/commands/vault.js.map +0 -1
  146. package/dist/commands/verify-login.d.ts +0 -25
  147. package/dist/commands/verify-login.js +0 -158
  148. package/dist/commands/verify-login.js.map +0 -1
  149. package/dist/commands/webhook.d.ts +0 -3
  150. package/dist/commands/webhook.js +0 -92
  151. package/dist/commands/webhook.js.map +0 -1
  152. package/dist/craft-pre-release.sh +0 -10
  153. package/dist/dashboard/components/AnimatedLogo.d.ts +0 -8
  154. package/dist/dashboard/components/AnimatedLogo.js +0 -16
  155. package/dist/dashboard/components/AnimatedLogo.js.map +0 -1
  156. package/dist/dashboard/components/CompletionView.d.ts +0 -13
  157. package/dist/dashboard/components/CompletionView.js +0 -25
  158. package/dist/dashboard/components/CompletionView.js.map +0 -1
  159. package/dist/dashboard/components/ConfirmPrompt.d.ts +0 -9
  160. package/dist/dashboard/components/ConfirmPrompt.js +0 -25
  161. package/dist/dashboard/components/ConfirmPrompt.js.map +0 -1
  162. package/dist/dashboard/components/CredentialsForm.d.ts +0 -10
  163. package/dist/dashboard/components/CredentialsForm.js +0 -47
  164. package/dist/dashboard/components/CredentialsForm.js.map +0 -1
  165. package/dist/dashboard/components/Dashboard.d.ts +0 -3
  166. package/dist/dashboard/components/Dashboard.js +0 -100
  167. package/dist/dashboard/components/Dashboard.js.map +0 -1
  168. package/dist/dashboard/components/DashboardLayout.d.ts +0 -24
  169. package/dist/dashboard/components/DashboardLayout.js +0 -25
  170. package/dist/dashboard/components/DashboardLayout.js.map +0 -1
  171. package/dist/dashboard/components/DiffPanel.d.ts +0 -9
  172. package/dist/dashboard/components/DiffPanel.js +0 -136
  173. package/dist/dashboard/components/DiffPanel.js.map +0 -1
  174. package/dist/dashboard/components/InlinePrompt.d.ts +0 -8
  175. package/dist/dashboard/components/InlinePrompt.js +0 -19
  176. package/dist/dashboard/components/InlinePrompt.js.map +0 -1
  177. package/dist/dashboard/components/OutputPanel.d.ts +0 -10
  178. package/dist/dashboard/components/OutputPanel.js +0 -100
  179. package/dist/dashboard/components/OutputPanel.js.map +0 -1
  180. package/dist/dashboard/components/Panel.d.ts +0 -12
  181. package/dist/dashboard/components/Panel.js +0 -6
  182. package/dist/dashboard/components/Panel.js.map +0 -1
  183. package/dist/dashboard/components/TextInput.d.ts +0 -13
  184. package/dist/dashboard/components/TextInput.js +0 -57
  185. package/dist/dashboard/components/TextInput.js.map +0 -1
  186. package/dist/dashboard/components/WelcomeArt.d.ts +0 -2
  187. package/dist/dashboard/components/WelcomeArt.js +0 -9
  188. package/dist/dashboard/components/WelcomeArt.js.map +0 -1
  189. package/dist/dashboard/hooks/useAnimation.d.ts +0 -7
  190. package/dist/dashboard/hooks/useAnimation.js +0 -24
  191. package/dist/dashboard/hooks/useAnimation.js.map +0 -1
  192. package/dist/dashboard/hooks/useKeyboard.d.ts +0 -8
  193. package/dist/dashboard/hooks/useKeyboard.js +0 -18
  194. package/dist/dashboard/hooks/useKeyboard.js.map +0 -1
  195. package/dist/dashboard/hooks/useTerminalSize.d.ts +0 -8
  196. package/dist/dashboard/hooks/useTerminalSize.js +0 -23
  197. package/dist/dashboard/hooks/useTerminalSize.js.map +0 -1
  198. package/dist/dashboard/index.d.ts +0 -6
  199. package/dist/dashboard/index.js +0 -36
  200. package/dist/dashboard/index.js.map +0 -1
  201. package/dist/dashboard/lib/diff-utils.d.ts +0 -21
  202. package/dist/dashboard/lib/diff-utils.js +0 -271
  203. package/dist/dashboard/lib/diff-utils.js.map +0 -1
  204. package/dist/dashboard/lib/logo-frames.d.ts +0 -20
  205. package/dist/dashboard/lib/logo-frames.js +0 -109
  206. package/dist/dashboard/lib/logo-frames.js.map +0 -1
  207. package/dist/dashboard/lib/welcome-art.d.ts +0 -1
  208. package/dist/dashboard/lib/welcome-art.js +0 -5
  209. package/dist/dashboard/lib/welcome-art.js.map +0 -1
  210. package/dist/dashboard/types.d.ts +0 -5
  211. package/dist/dashboard/types.js +0 -2
  212. package/dist/dashboard/types.js.map +0 -1
  213. package/dist/doctor/agent-prompt.d.ts +0 -10
  214. package/dist/doctor/agent-prompt.js +0 -190
  215. package/dist/doctor/agent-prompt.js.map +0 -1
  216. package/dist/doctor/checks/ai-analysis.d.ts +0 -9
  217. package/dist/doctor/checks/ai-analysis.js +0 -124
  218. package/dist/doctor/checks/ai-analysis.js.map +0 -1
  219. package/dist/doctor/checks/auth-patterns.d.ts +0 -2
  220. package/dist/doctor/checks/auth-patterns.js +0 -569
  221. package/dist/doctor/checks/auth-patterns.js.map +0 -1
  222. package/dist/doctor/checks/connectivity.d.ts +0 -2
  223. package/dist/doctor/checks/connectivity.js +0 -35
  224. package/dist/doctor/checks/connectivity.js.map +0 -1
  225. package/dist/doctor/checks/dashboard.d.ts +0 -3
  226. package/dist/doctor/checks/dashboard.js +0 -123
  227. package/dist/doctor/checks/dashboard.js.map +0 -1
  228. package/dist/doctor/checks/environment.d.ts +0 -2
  229. package/dist/doctor/checks/environment.js +0 -86
  230. package/dist/doctor/checks/environment.js.map +0 -1
  231. package/dist/doctor/checks/framework.d.ts +0 -2
  232. package/dist/doctor/checks/framework.js +0 -94
  233. package/dist/doctor/checks/framework.js.map +0 -1
  234. package/dist/doctor/checks/host-execution.d.ts +0 -2
  235. package/dist/doctor/checks/host-execution.js +0 -21
  236. package/dist/doctor/checks/host-execution.js.map +0 -1
  237. package/dist/doctor/checks/language.d.ts +0 -6
  238. package/dist/doctor/checks/language.js +0 -104
  239. package/dist/doctor/checks/language.js.map +0 -1
  240. package/dist/doctor/checks/mcp.d.ts +0 -15
  241. package/dist/doctor/checks/mcp.js +0 -34
  242. package/dist/doctor/checks/mcp.js.map +0 -1
  243. package/dist/doctor/checks/runtime.d.ts +0 -2
  244. package/dist/doctor/checks/runtime.js +0 -20
  245. package/dist/doctor/checks/runtime.js.map +0 -1
  246. package/dist/doctor/checks/sdk.d.ts +0 -2
  247. package/dist/doctor/checks/sdk.js +0 -192
  248. package/dist/doctor/checks/sdk.js.map +0 -1
  249. package/dist/doctor/checks/skills.d.ts +0 -9
  250. package/dist/doctor/checks/skills.js +0 -84
  251. package/dist/doctor/checks/skills.js.map +0 -1
  252. package/dist/doctor/clipboard.d.ts +0 -1
  253. package/dist/doctor/clipboard.js +0 -43
  254. package/dist/doctor/clipboard.js.map +0 -1
  255. package/dist/doctor/index.d.ts +0 -26
  256. package/dist/doctor/index.js +0 -182
  257. package/dist/doctor/index.js.map +0 -1
  258. package/dist/doctor/issues.d.ts +0 -63
  259. package/dist/doctor/issues.js +0 -199
  260. package/dist/doctor/issues.js.map +0 -1
  261. package/dist/doctor/json-output.d.ts +0 -2
  262. package/dist/doctor/json-output.js +0 -4
  263. package/dist/doctor/json-output.js.map +0 -1
  264. package/dist/doctor/output.d.ts +0 -7
  265. package/dist/doctor/output.js +0 -289
  266. package/dist/doctor/output.js.map +0 -1
  267. package/dist/doctor/types.d.ts +0 -203
  268. package/dist/doctor/types.js +0 -2
  269. package/dist/doctor/types.js.map +0 -1
  270. package/dist/integrations/dotnet/index.d.ts +0 -8
  271. package/dist/integrations/dotnet/index.js +0 -170
  272. package/dist/integrations/dotnet/index.js.map +0 -1
  273. package/dist/integrations/elixir/index.d.ts +0 -8
  274. package/dist/integrations/elixir/index.js +0 -146
  275. package/dist/integrations/elixir/index.js.map +0 -1
  276. package/dist/integrations/go/index.d.ts +0 -11
  277. package/dist/integrations/go/index.js +0 -212
  278. package/dist/integrations/go/index.js.map +0 -1
  279. package/dist/integrations/kotlin/index.d.ts +0 -4
  280. package/dist/integrations/kotlin/index.js +0 -78
  281. package/dist/integrations/kotlin/index.js.map +0 -1
  282. package/dist/integrations/nextjs/index.d.ts +0 -4
  283. package/dist/integrations/nextjs/index.js +0 -93
  284. package/dist/integrations/nextjs/index.js.map +0 -1
  285. package/dist/integrations/nextjs/utils.d.ts +0 -8
  286. package/dist/integrations/nextjs/utils.js +0 -68
  287. package/dist/integrations/nextjs/utils.js.map +0 -1
  288. package/dist/integrations/node/index.d.ts +0 -4
  289. package/dist/integrations/node/index.js +0 -52
  290. package/dist/integrations/node/index.js.map +0 -1
  291. package/dist/integrations/php/index.d.ts +0 -4
  292. package/dist/integrations/php/index.js +0 -51
  293. package/dist/integrations/php/index.js.map +0 -1
  294. package/dist/integrations/php-laravel/index.d.ts +0 -4
  295. package/dist/integrations/php-laravel/index.js +0 -51
  296. package/dist/integrations/php-laravel/index.js.map +0 -1
  297. package/dist/integrations/python/index.d.ts +0 -9
  298. package/dist/integrations/python/index.js +0 -249
  299. package/dist/integrations/python/index.js.map +0 -1
  300. package/dist/integrations/react/index.d.ts +0 -4
  301. package/dist/integrations/react/index.js +0 -49
  302. package/dist/integrations/react/index.js.map +0 -1
  303. package/dist/integrations/react-router/index.d.ts +0 -4
  304. package/dist/integrations/react-router/index.js +0 -94
  305. package/dist/integrations/react-router/index.js.map +0 -1
  306. package/dist/integrations/react-router/utils.d.ts +0 -10
  307. package/dist/integrations/react-router/utils.js +0 -162
  308. package/dist/integrations/react-router/utils.js.map +0 -1
  309. package/dist/integrations/ruby/index.d.ts +0 -8
  310. package/dist/integrations/ruby/index.js +0 -137
  311. package/dist/integrations/ruby/index.js.map +0 -1
  312. package/dist/integrations/sveltekit/index.d.ts +0 -4
  313. package/dist/integrations/sveltekit/index.js +0 -50
  314. package/dist/integrations/sveltekit/index.js.map +0 -1
  315. package/dist/integrations/tanstack-start/index.d.ts +0 -4
  316. package/dist/integrations/tanstack-start/index.js +0 -51
  317. package/dist/integrations/tanstack-start/index.js.map +0 -1
  318. package/dist/integrations/vanilla-js/index.d.ts +0 -4
  319. package/dist/integrations/vanilla-js/index.js +0 -49
  320. package/dist/integrations/vanilla-js/index.js.map +0 -1
  321. package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.d.ts +0 -7
  322. package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.js +0 -12
  323. package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.js.map +0 -1
  324. package/dist/lib/adapters/cli-adapter.d.ts +0 -113
  325. package/dist/lib/adapters/cli-adapter.js +0 -641
  326. package/dist/lib/adapters/cli-adapter.js.map +0 -1
  327. package/dist/lib/adapters/dashboard-adapter.d.ts +0 -34
  328. package/dist/lib/adapters/dashboard-adapter.js +0 -121
  329. package/dist/lib/adapters/dashboard-adapter.js.map +0 -1
  330. package/dist/lib/adapters/headless-adapter.d.ts +0 -80
  331. package/dist/lib/adapters/headless-adapter.js +0 -347
  332. package/dist/lib/adapters/headless-adapter.js.map +0 -1
  333. package/dist/lib/adapters/index.d.ts +0 -4
  334. package/dist/lib/adapters/index.js +0 -4
  335. package/dist/lib/adapters/index.js.map +0 -1
  336. package/dist/lib/adapters/types.d.ts +0 -41
  337. package/dist/lib/adapters/types.js +0 -2
  338. package/dist/lib/adapters/types.js.map +0 -1
  339. package/dist/lib/agent-interface.d.ts +0 -84
  340. package/dist/lib/agent-interface.js +0 -840
  341. package/dist/lib/agent-interface.js.map +0 -1
  342. package/dist/lib/agent-runner.d.ts +0 -9
  343. package/dist/lib/agent-runner.js +0 -261
  344. package/dist/lib/agent-runner.js.map +0 -1
  345. package/dist/lib/ai-content.d.ts +0 -14
  346. package/dist/lib/ai-content.js +0 -131
  347. package/dist/lib/ai-content.js.map +0 -1
  348. package/dist/lib/api-error-handler.d.ts +0 -18
  349. package/dist/lib/api-error-handler.js +0 -76
  350. package/dist/lib/api-error-handler.js.map +0 -1
  351. package/dist/lib/api-key.d.ts +0 -14
  352. package/dist/lib/api-key.js +0 -37
  353. package/dist/lib/api-key.js.map +0 -1
  354. package/dist/lib/api.d.ts +0 -25
  355. package/dist/lib/api.js +0 -120
  356. package/dist/lib/api.js.map +0 -1
  357. package/dist/lib/background-refresh.d.ts +0 -29
  358. package/dist/lib/background-refresh.js +0 -95
  359. package/dist/lib/background-refresh.js.map +0 -1
  360. package/dist/lib/command-aliases.d.ts +0 -8
  361. package/dist/lib/command-aliases.js +0 -12
  362. package/dist/lib/command-aliases.js.map +0 -1
  363. package/dist/lib/completion-data.d.ts +0 -33
  364. package/dist/lib/completion-data.js +0 -33
  365. package/dist/lib/completion-data.js.map +0 -1
  366. package/dist/lib/config-store.d.ts +0 -63
  367. package/dist/lib/config-store.js +0 -293
  368. package/dist/lib/config-store.js.map +0 -1
  369. package/dist/lib/config.d.ts +0 -34
  370. package/dist/lib/config.js +0 -37
  371. package/dist/lib/config.js.map +0 -1
  372. package/dist/lib/constants.d.ts +0 -51
  373. package/dist/lib/constants.js +0 -50
  374. package/dist/lib/constants.js.map +0 -1
  375. package/dist/lib/credential-discovery.d.ts +0 -42
  376. package/dist/lib/credential-discovery.js +0 -100
  377. package/dist/lib/credential-discovery.js.map +0 -1
  378. package/dist/lib/credential-proxy.d.ts +0 -45
  379. package/dist/lib/credential-proxy.js +0 -364
  380. package/dist/lib/credential-proxy.js.map +0 -1
  381. package/dist/lib/credential-store.d.ts +0 -32
  382. package/dist/lib/credential-store.js +0 -236
  383. package/dist/lib/credential-store.js.map +0 -1
  384. package/dist/lib/credentials.d.ts +0 -13
  385. package/dist/lib/credentials.js +0 -34
  386. package/dist/lib/credentials.js.map +0 -1
  387. package/dist/lib/dev-command.d.ts +0 -26
  388. package/dist/lib/dev-command.js +0 -129
  389. package/dist/lib/dev-command.js.map +0 -1
  390. package/dist/lib/device-auth.d.ts +0 -48
  391. package/dist/lib/device-auth.js +0 -176
  392. package/dist/lib/device-auth.js.map +0 -1
  393. package/dist/lib/device-id.d.ts +0 -25
  394. package/dist/lib/device-id.js +0 -102
  395. package/dist/lib/device-id.js.map +0 -1
  396. package/dist/lib/ensure-auth.d.ts +0 -12
  397. package/dist/lib/ensure-auth.js +0 -111
  398. package/dist/lib/ensure-auth.js.map +0 -1
  399. package/dist/lib/env-writer.d.ts +0 -25
  400. package/dist/lib/env-writer.js +0 -90
  401. package/dist/lib/env-writer.js.map +0 -1
  402. package/dist/lib/events.d.ts +0 -248
  403. package/dist/lib/events.js +0 -19
  404. package/dist/lib/events.js.map +0 -1
  405. package/dist/lib/framework-config.d.ts +0 -133
  406. package/dist/lib/framework-config.js +0 -11
  407. package/dist/lib/framework-config.js.map +0 -1
  408. package/dist/lib/helper-functions.d.ts +0 -1
  409. package/dist/lib/helper-functions.js +0 -2
  410. package/dist/lib/helper-functions.js.map +0 -1
  411. package/dist/lib/host-probe.d.ts +0 -28
  412. package/dist/lib/host-probe.js +0 -154
  413. package/dist/lib/host-probe.js.map +0 -1
  414. package/dist/lib/installer-core.d.ts +0 -569
  415. package/dist/lib/installer-core.js +0 -1134
  416. package/dist/lib/installer-core.js.map +0 -1
  417. package/dist/lib/installer-core.types.d.ts +0 -162
  418. package/dist/lib/installer-core.types.js +0 -2
  419. package/dist/lib/installer-core.types.js.map +0 -1
  420. package/dist/lib/mcp-clients.d.ts +0 -45
  421. package/dist/lib/mcp-clients.js +0 -297
  422. package/dist/lib/mcp-clients.js.map +0 -1
  423. package/dist/lib/port-detection.d.ts +0 -7
  424. package/dist/lib/port-detection.js +0 -244
  425. package/dist/lib/port-detection.js.map +0 -1
  426. package/dist/lib/post-install.d.ts +0 -8
  427. package/dist/lib/post-install.js +0 -51
  428. package/dist/lib/post-install.js.map +0 -1
  429. package/dist/lib/preferences.d.ts +0 -143
  430. package/dist/lib/preferences.js +0 -227
  431. package/dist/lib/preferences.js.map +0 -1
  432. package/dist/lib/progress-tracker.d.ts +0 -22
  433. package/dist/lib/progress-tracker.js +0 -47
  434. package/dist/lib/progress-tracker.js.map +0 -1
  435. package/dist/lib/registry.d.ts +0 -42
  436. package/dist/lib/registry.js +0 -96
  437. package/dist/lib/registry.js.map +0 -1
  438. package/dist/lib/resolve-install-credentials.d.ts +0 -11
  439. package/dist/lib/resolve-install-credentials.js +0 -53
  440. package/dist/lib/resolve-install-credentials.js.map +0 -1
  441. package/dist/lib/run-with-core.d.ts +0 -7
  442. package/dist/lib/run-with-core.js +0 -559
  443. package/dist/lib/run-with-core.js.map +0 -1
  444. package/dist/lib/safe-tools.d.ts +0 -2
  445. package/dist/lib/safe-tools.js +0 -212
  446. package/dist/lib/safe-tools.js.map +0 -1
  447. package/dist/lib/scaffold/index.d.ts +0 -1
  448. package/dist/lib/scaffold/index.js +0 -2
  449. package/dist/lib/scaffold/index.js.map +0 -1
  450. package/dist/lib/scaffold/scaffold.d.ts +0 -66
  451. package/dist/lib/scaffold/scaffold.js +0 -156
  452. package/dist/lib/scaffold/scaffold.js.map +0 -1
  453. package/dist/lib/settings.d.ts +0 -60
  454. package/dist/lib/settings.js +0 -31
  455. package/dist/lib/settings.js.map +0 -1
  456. package/dist/lib/staging-api.d.ts +0 -22
  457. package/dist/lib/staging-api.js +0 -74
  458. package/dist/lib/staging-api.js.map +0 -1
  459. package/dist/lib/startup-notice-gate.d.ts +0 -21
  460. package/dist/lib/startup-notice-gate.js +0 -29
  461. package/dist/lib/startup-notice-gate.js.map +0 -1
  462. package/dist/lib/telemetry-notice.d.ts +0 -25
  463. package/dist/lib/telemetry-notice.js +0 -58
  464. package/dist/lib/telemetry-notice.js.map +0 -1
  465. package/dist/lib/token-refresh-client.d.ts +0 -23
  466. package/dist/lib/token-refresh-client.js +0 -89
  467. package/dist/lib/token-refresh-client.js.map +0 -1
  468. package/dist/lib/token-refresh.d.ts +0 -12
  469. package/dist/lib/token-refresh.js +0 -27
  470. package/dist/lib/token-refresh.js.map +0 -1
  471. package/dist/lib/unclaimed-env-api.d.ts +0 -42
  472. package/dist/lib/unclaimed-env-api.js +0 -139
  473. package/dist/lib/unclaimed-env-api.js.map +0 -1
  474. package/dist/lib/unclaimed-env-provision.d.ts +0 -24
  475. package/dist/lib/unclaimed-env-provision.js +0 -80
  476. package/dist/lib/unclaimed-env-provision.js.map +0 -1
  477. package/dist/lib/unclaimed-warning.d.ts +0 -15
  478. package/dist/lib/unclaimed-warning.js +0 -78
  479. package/dist/lib/unclaimed-warning.js.map +0 -1
  480. package/dist/lib/validation/build-validator.d.ts +0 -21
  481. package/dist/lib/validation/build-validator.js +0 -153
  482. package/dist/lib/validation/build-validator.js.map +0 -1
  483. package/dist/lib/validation/index.d.ts +0 -4
  484. package/dist/lib/validation/index.js +0 -4
  485. package/dist/lib/validation/index.js.map +0 -1
  486. package/dist/lib/validation/quick-checks.d.ts +0 -19
  487. package/dist/lib/validation/quick-checks.js +0 -192
  488. package/dist/lib/validation/quick-checks.js.map +0 -1
  489. package/dist/lib/validation/security-checks.d.ts +0 -35
  490. package/dist/lib/validation/security-checks.js +0 -106
  491. package/dist/lib/validation/security-checks.js.map +0 -1
  492. package/dist/lib/validation/types.d.ts +0 -56
  493. package/dist/lib/validation/types.js +0 -2
  494. package/dist/lib/validation/types.js.map +0 -1
  495. package/dist/lib/validation/validator.d.ts +0 -13
  496. package/dist/lib/validation/validator.js +0 -711
  497. package/dist/lib/validation/validator.js.map +0 -1
  498. package/dist/lib/version-check.d.ts +0 -6
  499. package/dist/lib/version-check.js +0 -46
  500. package/dist/lib/version-check.js.map +0 -1
  501. package/dist/lib/workos-api.d.ts +0 -30
  502. package/dist/lib/workos-api.js +0 -69
  503. package/dist/lib/workos-api.js.map +0 -1
  504. package/dist/lib/workos-client.d.ts +0 -58
  505. package/dist/lib/workos-client.js +0 -140
  506. package/dist/lib/workos-client.js.map +0 -1
  507. package/dist/lib/workos-management.d.ts +0 -32
  508. package/dist/lib/workos-management.js +0 -149
  509. package/dist/lib/workos-management.js.map +0 -1
  510. package/dist/nextjs/nextjs-installer-agent.d.ts +0 -5
  511. package/dist/nextjs/nextjs-installer-agent.js +0 -6
  512. package/dist/nextjs/nextjs-installer-agent.js.map +0 -1
  513. package/dist/nextjs/utils.d.ts +0 -4
  514. package/dist/nextjs/utils.js +0 -5
  515. package/dist/nextjs/utils.js.map +0 -1
  516. package/dist/react/react-installer-agent.d.ts +0 -4
  517. package/dist/react/react-installer-agent.js +0 -5
  518. package/dist/react/react-installer-agent.js.map +0 -1
  519. package/dist/react-router/react-router-installer-agent.d.ts +0 -4
  520. package/dist/react-router/react-router-installer-agent.js +0 -5
  521. package/dist/react-router/react-router-installer-agent.js.map +0 -1
  522. package/dist/react-router/utils.d.ts +0 -4
  523. package/dist/react-router/utils.js +0 -5
  524. package/dist/react-router/utils.js.map +0 -1
  525. package/dist/run.d.ts +0 -33
  526. package/dist/run.js +0 -58
  527. package/dist/run.js.map +0 -1
  528. package/dist/smoke-test.ts +0 -881
  529. package/dist/steps/add-or-update-environment-variables.d.ts +0 -10
  530. package/dist/steps/add-or-update-environment-variables.js +0 -155
  531. package/dist/steps/add-or-update-environment-variables.js.map +0 -1
  532. package/dist/steps/index.d.ts +0 -3
  533. package/dist/steps/index.js +0 -4
  534. package/dist/steps/index.js.map +0 -1
  535. package/dist/steps/run-prettier.d.ts +0 -5
  536. package/dist/steps/run-prettier.js +0 -50
  537. package/dist/steps/run-prettier.js.map +0 -1
  538. package/dist/steps/upload-environment-variables/EnvironmentProvider.d.ts +0 -8
  539. package/dist/steps/upload-environment-variables/EnvironmentProvider.js +0 -7
  540. package/dist/steps/upload-environment-variables/EnvironmentProvider.js.map +0 -1
  541. package/dist/steps/upload-environment-variables/index.d.ts +0 -6
  542. package/dist/steps/upload-environment-variables/index.js +0 -69
  543. package/dist/steps/upload-environment-variables/index.js.map +0 -1
  544. package/dist/steps/upload-environment-variables/providers/vercel.d.ts +0 -14
  545. package/dist/steps/upload-environment-variables/providers/vercel.js +0 -107
  546. package/dist/steps/upload-environment-variables/providers/vercel.js.map +0 -1
  547. package/dist/tanstack-start/tanstack-start-installer-agent.d.ts +0 -4
  548. package/dist/tanstack-start/tanstack-start-installer-agent.js +0 -5
  549. package/dist/tanstack-start/tanstack-start-installer-agent.js.map +0 -1
  550. package/dist/telemetry.d.ts +0 -2
  551. package/dist/telemetry.js +0 -29
  552. package/dist/telemetry.js.map +0 -1
  553. package/dist/test/force-insecure-storage.d.ts +0 -1
  554. package/dist/test/force-insecure-storage.js +0 -9
  555. package/dist/test/force-insecure-storage.js.map +0 -1
  556. package/dist/test/setup.d.ts +0 -1
  557. package/dist/test/setup.js +0 -38
  558. package/dist/test/setup.js.map +0 -1
  559. package/dist/utils/analytics.d.ts +0 -66
  560. package/dist/utils/analytics.js +0 -330
  561. package/dist/utils/analytics.js.map +0 -1
  562. package/dist/utils/bash.d.ts +0 -2
  563. package/dist/utils/bash.js +0 -17
  564. package/dist/utils/bash.js.map +0 -1
  565. package/dist/utils/box.d.ts +0 -9
  566. package/dist/utils/box.js +0 -15
  567. package/dist/utils/box.js.map +0 -1
  568. package/dist/utils/cli-exit.d.ts +0 -15
  569. package/dist/utils/cli-exit.js +0 -11
  570. package/dist/utils/cli-exit.js.map +0 -1
  571. package/dist/utils/cli-symbols.d.ts +0 -44
  572. package/dist/utils/cli-symbols.js +0 -58
  573. package/dist/utils/cli-symbols.js.map +0 -1
  574. package/dist/utils/command-invocation.d.ts +0 -10
  575. package/dist/utils/command-invocation.js +0 -26
  576. package/dist/utils/command-invocation.js.map +0 -1
  577. package/dist/utils/command-telemetry.d.ts +0 -17
  578. package/dist/utils/command-telemetry.js +0 -67
  579. package/dist/utils/command-telemetry.js.map +0 -1
  580. package/dist/utils/crash-reporter.d.ts +0 -13
  581. package/dist/utils/crash-reporter.js +0 -91
  582. package/dist/utils/crash-reporter.js.map +0 -1
  583. package/dist/utils/debug.d.ts +0 -9
  584. package/dist/utils/debug.js +0 -105
  585. package/dist/utils/debug.js.map +0 -1
  586. package/dist/utils/env-parser.d.ts +0 -5
  587. package/dist/utils/env-parser.js +0 -18
  588. package/dist/utils/env-parser.js.map +0 -1
  589. package/dist/utils/environment.d.ts +0 -10
  590. package/dist/utils/environment.js +0 -69
  591. package/dist/utils/environment.js.map +0 -1
  592. package/dist/utils/errors.d.ts +0 -3
  593. package/dist/utils/errors.js +0 -7
  594. package/dist/utils/errors.js.map +0 -1
  595. package/dist/utils/exec-file.d.ts +0 -15
  596. package/dist/utils/exec-file.js +0 -39
  597. package/dist/utils/exec-file.js.map +0 -1
  598. package/dist/utils/exit-codes.d.ts +0 -31
  599. package/dist/utils/exit-codes.js +0 -69
  600. package/dist/utils/exit-codes.js.map +0 -1
  601. package/dist/utils/git-utils.d.ts +0 -23
  602. package/dist/utils/git-utils.js +0 -86
  603. package/dist/utils/git-utils.js.map +0 -1
  604. package/dist/utils/help-json.d.ts +0 -58
  605. package/dist/utils/help-json.js +0 -1577
  606. package/dist/utils/help-json.js.map +0 -1
  607. package/dist/utils/interaction-mode.d.ts +0 -25
  608. package/dist/utils/interaction-mode.js +0 -99
  609. package/dist/utils/interaction-mode.js.map +0 -1
  610. package/dist/utils/lock-art.d.ts +0 -4
  611. package/dist/utils/lock-art.js +0 -73
  612. package/dist/utils/lock-art.js.map +0 -1
  613. package/dist/utils/logging.d.ts +0 -9
  614. package/dist/utils/logging.js +0 -36
  615. package/dist/utils/logging.js.map +0 -1
  616. package/dist/utils/ndjson.d.ts +0 -16
  617. package/dist/utils/ndjson.js +0 -18
  618. package/dist/utils/ndjson.js.map +0 -1
  619. package/dist/utils/output.d.ts +0 -60
  620. package/dist/utils/output.js +0 -124
  621. package/dist/utils/output.js.map +0 -1
  622. package/dist/utils/package-json.d.ts +0 -26
  623. package/dist/utils/package-json.js +0 -32
  624. package/dist/utils/package-json.js.map +0 -1
  625. package/dist/utils/package-manager.d.ts +0 -21
  626. package/dist/utils/package-manager.js +0 -166
  627. package/dist/utils/package-manager.js.map +0 -1
  628. package/dist/utils/paths.d.ts +0 -5
  629. package/dist/utils/paths.js +0 -18
  630. package/dist/utils/paths.js.map +0 -1
  631. package/dist/utils/platform.d.ts +0 -8
  632. package/dist/utils/platform.js +0 -7
  633. package/dist/utils/platform.js.map +0 -1
  634. package/dist/utils/recovery-hints.d.ts +0 -42
  635. package/dist/utils/recovery-hints.js +0 -92
  636. package/dist/utils/recovery-hints.js.map +0 -1
  637. package/dist/utils/redact.d.ts +0 -5
  638. package/dist/utils/redact.js +0 -29
  639. package/dist/utils/redact.js.map +0 -1
  640. package/dist/utils/register-subcommand.d.ts +0 -10
  641. package/dist/utils/register-subcommand.js +0 -33
  642. package/dist/utils/register-subcommand.js.map +0 -1
  643. package/dist/utils/semver.d.ts +0 -10
  644. package/dist/utils/semver.js +0 -43
  645. package/dist/utils/semver.js.map +0 -1
  646. package/dist/utils/string.d.ts +0 -1
  647. package/dist/utils/string.js +0 -6
  648. package/dist/utils/string.js.map +0 -1
  649. package/dist/utils/summary-box.d.ts +0 -25
  650. package/dist/utils/summary-box.js +0 -211
  651. package/dist/utils/summary-box.js.map +0 -1
  652. package/dist/utils/table.d.ts +0 -5
  653. package/dist/utils/table.js +0 -18
  654. package/dist/utils/table.js.map +0 -1
  655. package/dist/utils/telemetry-client.d.ts +0 -43
  656. package/dist/utils/telemetry-client.js +0 -171
  657. package/dist/utils/telemetry-client.js.map +0 -1
  658. package/dist/utils/telemetry-store-forward.d.ts +0 -11
  659. package/dist/utils/telemetry-store-forward.js +0 -94
  660. package/dist/utils/telemetry-store-forward.js.map +0 -1
  661. package/dist/utils/telemetry-types.d.ts +0 -100
  662. package/dist/utils/telemetry-types.js +0 -6
  663. package/dist/utils/telemetry-types.js.map +0 -1
  664. package/dist/utils/types.d.ts +0 -123
  665. package/dist/utils/types.js +0 -2
  666. package/dist/utils/types.js.map +0 -1
  667. package/dist/utils/ui-utils.d.ts +0 -97
  668. package/dist/utils/ui-utils.js +0 -449
  669. package/dist/utils/ui-utils.js.map +0 -1
  670. package/dist/utils/ui.d.ts +0 -148
  671. package/dist/utils/ui.js +0 -368
  672. package/dist/utils/ui.js.map +0 -1
  673. package/dist/utils/urls.d.ts +0 -13
  674. package/dist/utils/urls.js +0 -14
  675. package/dist/utils/urls.js.map +0 -1
  676. package/dist/utils/vendor/is-unicorn-supported.d.ts +0 -1
  677. package/dist/utils/vendor/is-unicorn-supported.js +0 -21
  678. package/dist/utils/vendor/is-unicorn-supported.js.map +0 -1
  679. package/dist/vanilla-js/vanilla-js-installer-agent.d.ts +0 -4
  680. package/dist/vanilla-js/vanilla-js-installer-agent.js +0 -5
  681. package/dist/vanilla-js/vanilla-js-installer-agent.js.map +0 -1
@@ -1,1134 +0,0 @@
1
- import { setup, assign, fromPromise } from 'xstate';
2
- import { getManualPrInstructions } from './post-install.js';
3
- import { hasGhCli } from '../utils/git-utils.js';
4
- import { formatWorkOSCommand } from '../utils/command-invocation.js';
5
- export const installerMachine = setup({
6
- types: {
7
- context: {},
8
- input: {},
9
- events: {},
10
- },
11
- actions: {
12
- emitStateEnter: ({ context }, params) => {
13
- context.emitter.emit('state:enter', { state: params.state });
14
- },
15
- emitStateExit: ({ context }, params) => {
16
- context.emitter.emit('state:exit', { state: params.state });
17
- },
18
- emitAuthChecking: ({ context }) => {
19
- context.emitter.emit('auth:checking', {});
20
- },
21
- emitAuthRequired: ({ context }) => {
22
- context.emitter.emit('auth:required', {});
23
- },
24
- emitAuthSuccess: ({ context }) => {
25
- context.emitter.emit('auth:success', {});
26
- },
27
- emitAuthFailure: ({ context }) => {
28
- const message = context.error?.message ?? 'Authentication failed';
29
- context.emitter.emit('auth:failure', { message });
30
- },
31
- emitDetectionStart: ({ context }) => {
32
- context.emitter.emit('detection:start', {});
33
- },
34
- emitDetectionComplete: ({ context }) => {
35
- if (context.integration) {
36
- context.emitter.emit('detection:complete', { integration: context.integration });
37
- }
38
- else {
39
- context.emitter.emit('detection:none', {});
40
- }
41
- },
42
- emitGitChecking: ({ context }) => {
43
- context.emitter.emit('git:checking', {});
44
- },
45
- emitGitClean: ({ context }) => {
46
- context.emitter.emit('git:clean', {});
47
- },
48
- emitGitDirty: ({ context }) => {
49
- context.emitter.emit('git:dirty', { files: context.gitDirtyFiles });
50
- },
51
- emitGitConfirmed: ({ context }) => {
52
- context.emitter.emit('git:dirty:confirmed', {});
53
- },
54
- emitGitCancelled: ({ context }) => {
55
- context.emitter.emit('git:dirty:cancelled', {});
56
- },
57
- emitScaffoldChecking: ({ context }) => {
58
- context.emitter.emit('scaffold:checking', {});
59
- },
60
- emitScaffoldPrompt: ({ context }) => {
61
- context.emitter.emit('scaffold:prompt', { packageManager: context.packageManager ?? 'npm' });
62
- },
63
- emitScaffoldStart: ({ context }) => {
64
- context.emitter.emit('scaffold:start', { packageManager: context.packageManager ?? 'npm' });
65
- },
66
- emitScaffoldComplete: ({ context }) => {
67
- context.emitter.emit('scaffold:complete', {});
68
- },
69
- emitScaffoldFailed: ({ context }) => {
70
- const message = context.error?.message ?? 'Scaffold failed';
71
- context.emitter.emit('scaffold:failed', { error: message });
72
- },
73
- emitScaffoldSkipped: ({ context }) => {
74
- context.emitter.emit('scaffold:skipped', {});
75
- },
76
- assignWorkspaceResult: assign({
77
- scaffoldable: ({ event }) => event.output?.scaffoldable ?? false,
78
- packageManager: ({ event }) => event.output?.packageManager ?? 'npm',
79
- autoScaffold: ({ event }) => event.output?.autoScaffold ?? false,
80
- }),
81
- assignScaffolded: assign({
82
- scaffolded: () => true,
83
- }),
84
- emitBranchChecking: ({ context }) => {
85
- context.emitter.emit('branch:checking', {});
86
- },
87
- emitBranchProtected: ({ context }) => {
88
- if (context.currentBranch) {
89
- context.emitter.emit('branch:protected', { branch: context.currentBranch });
90
- context.emitter.emit('branch:prompt', { branch: context.currentBranch });
91
- }
92
- },
93
- emitBranchCreated: ({ context }, params) => {
94
- context.emitter.emit('branch:created', { branch: params.branch });
95
- },
96
- emitBranchCreateFailed: ({ context }) => {
97
- const message = context.error?.message ?? 'Failed to create branch';
98
- context.emitter.emit('branch:create:failed', { error: message });
99
- },
100
- assignBranchResult: assign({
101
- currentBranch: ({ event }) => {
102
- const doneEvent = event;
103
- return doneEvent.output?.branch ?? undefined;
104
- },
105
- isProtectedBranch: ({ event }) => {
106
- const doneEvent = event;
107
- return doneEvent.output?.isProtected ?? false;
108
- },
109
- }),
110
- emitCredentialsGathering: ({ context }) => {
111
- const requiresApiKey = ['nextjs', 'tanstack-start', 'react-router'].includes(context.integration ?? '');
112
- context.emitter.emit('credentials:gathering', { requiresApiKey });
113
- context.emitter.emit('credentials:request', { requiresApiKey });
114
- },
115
- emitCredentialsFound: ({ context }) => {
116
- context.emitter.emit('credentials:found', {});
117
- },
118
- emitEnvDetected: ({ context }) => {
119
- context.emitter.emit('credentials:env:detected', { files: context.envFilesDetected ?? [] });
120
- },
121
- emitEnvScanPrompt: ({ context }) => {
122
- context.emitter.emit('credentials:env:prompt', { files: context.envFilesDetected ?? [] });
123
- },
124
- emitEnvScanning: ({ context }) => {
125
- context.emitter.emit('credentials:env:scanning', {});
126
- },
127
- emitEnvCredentialsFound: ({ context }) => {
128
- context.emitter.emit('credentials:env:found', { sourcePath: context.envCredentialPath ?? '.env' });
129
- },
130
- emitEnvNotFound: ({ context }) => {
131
- context.emitter.emit('credentials:env:notfound', {});
132
- },
133
- emitDeviceAuthStart: () => {
134
- // Emitted by actor when it has verification URL
135
- },
136
- emitDeviceAuthSuccess: ({ context }) => {
137
- context.emitter.emit('device:success', { email: undefined });
138
- },
139
- emitDeviceAuthError: ({ context }) => {
140
- const message = context.error?.message ?? 'Device authorization failed';
141
- context.emitter.emit('device:error', { message });
142
- },
143
- emitDeviceTimeout: ({ context }) => {
144
- context.emitter.emit('device:timeout', {});
145
- },
146
- emitStagingFetching: ({ context }) => {
147
- context.emitter.emit('staging:fetching', {});
148
- },
149
- emitStagingSuccess: ({ context }) => {
150
- context.emitter.emit('staging:success', { source: context.deviceAuth ? 'device' : 'stored' });
151
- },
152
- emitStagingError: ({ context }) => {
153
- const message = context.error?.message ?? 'Failed to fetch staging credentials';
154
- context.emitter.emit('staging:error', { message });
155
- },
156
- emitConfigStart: ({ context }) => {
157
- context.emitter.emit('config:start', {});
158
- },
159
- emitConfigComplete: ({ context }) => {
160
- context.emitter.emit('config:complete', {});
161
- },
162
- emitAgentStart: ({ context }) => {
163
- context.emitter.emit('agent:start', {});
164
- },
165
- emitAgentSuccess: ({ context }, params) => {
166
- context.emitter.emit('agent:success', { summary: params.summary });
167
- context.emitter.emit('complete', { success: true, summary: params.summary });
168
- },
169
- emitAgentFailure: ({ context }) => {
170
- const message = context.error?.message ?? 'Agent execution failed';
171
- const stack = context.error?.stack;
172
- context.emitter.emit('agent:failure', { message, stack });
173
- context.emitter.emit('complete', { success: false });
174
- },
175
- assignDetectionResult: assign({
176
- integration: ({ event }) => {
177
- const doneEvent = event;
178
- return doneEvent.output?.integration;
179
- },
180
- }),
181
- assignGitResult: assign({
182
- gitIsClean: ({ event }) => {
183
- const doneEvent = event;
184
- return doneEvent.output?.isClean ?? true;
185
- },
186
- gitDirtyFiles: ({ event }) => {
187
- const doneEvent = event;
188
- return doneEvent.output?.files ?? [];
189
- },
190
- }),
191
- assignCredentials: assign({
192
- credentials: ({ event }) => {
193
- if (event.type === 'CREDENTIALS_SUBMITTED') {
194
- return { apiKey: event.apiKey, clientId: event.clientId };
195
- }
196
- return undefined;
197
- },
198
- }),
199
- assignError: assign({
200
- error: ({ event }) => {
201
- if ('error' in event && event.error instanceof Error) {
202
- return event.error;
203
- }
204
- if ('error' in event && typeof event.error === 'object' && event.error !== null) {
205
- return new Error(String(event.error.message ?? event.error));
206
- }
207
- return new Error('Unknown error');
208
- },
209
- }),
210
- emitCancelled: ({ context }) => {
211
- context.emitter.emit('complete', { success: false, summary: 'Installer cancelled by user' });
212
- },
213
- emitError: ({ context }) => {
214
- const message = context.error?.message ?? 'An unexpected error occurred';
215
- context.emitter.emit('error', { message, stack: context.error?.stack });
216
- context.emitter.emit('complete', { success: false });
217
- },
218
- // Post-install actions
219
- assignChangedFiles: assign({
220
- changedFiles: ({ event }) => {
221
- const doneEvent = event;
222
- return doneEvent.output?.files ?? [];
223
- },
224
- }),
225
- emitChangesDetected: ({ context }) => {
226
- context.emitter.emit('postinstall:changes', { files: context.changedFiles ?? [] });
227
- },
228
- emitNoChanges: ({ context }) => {
229
- context.emitter.emit('postinstall:nochanges', {});
230
- },
231
- emitCommitPrompt: ({ context }) => {
232
- context.emitter.emit('postinstall:commit:prompt', {});
233
- },
234
- emitGeneratingCommitMessage: ({ context }) => {
235
- context.emitter.emit('postinstall:commit:generating', {});
236
- },
237
- assignCommitMessage: assign({
238
- commitMessage: ({ event }) => {
239
- const doneEvent = event;
240
- return doneEvent.output;
241
- },
242
- }),
243
- emitCommitting: ({ context }) => {
244
- context.emitter.emit('postinstall:commit:committing', { message: context.commitMessage ?? '' });
245
- },
246
- emitCommitSuccess: ({ context }) => {
247
- context.emitter.emit('postinstall:commit:success', { message: context.commitMessage ?? '' });
248
- },
249
- emitCommitFailed: ({ context }) => {
250
- const message = context.error?.message ?? 'Commit failed';
251
- context.emitter.emit('postinstall:commit:failed', { error: message });
252
- },
253
- emitPrPrompt: ({ context }) => {
254
- context.emitter.emit('postinstall:pr:prompt', {});
255
- },
256
- emitGeneratingPrDescription: ({ context }) => {
257
- context.emitter.emit('postinstall:pr:generating', {});
258
- },
259
- assignPrDescription: assign({
260
- prDescription: ({ event }) => {
261
- const doneEvent = event;
262
- return doneEvent.output;
263
- },
264
- }),
265
- emitPushing: ({ context }) => {
266
- context.emitter.emit('postinstall:pr:pushing', {});
267
- },
268
- emitPushFailed: ({ context }) => {
269
- const message = context.error?.message ?? 'Push failed';
270
- context.emitter.emit('postinstall:push:failed', { error: message });
271
- },
272
- emitCreatingPr: ({ context }) => {
273
- context.emitter.emit('postinstall:pr:creating', {});
274
- },
275
- assignPrUrl: assign({
276
- prUrl: ({ event }) => {
277
- const doneEvent = event;
278
- return doneEvent.output;
279
- },
280
- }),
281
- emitPrCreated: ({ context }) => {
282
- context.emitter.emit('postinstall:pr:success', { url: context.prUrl ?? '' });
283
- },
284
- emitPrFailed: ({ context }) => {
285
- const message = context.error?.message ?? 'PR creation failed';
286
- context.emitter.emit('postinstall:pr:failed', { error: message });
287
- },
288
- emitManualInstructions: ({ context }) => {
289
- const branch = context.currentBranch ?? 'HEAD';
290
- const instructions = getManualPrInstructions(branch);
291
- context.emitter.emit('postinstall:manual', { instructions });
292
- },
293
- emitComplete: ({ context }) => {
294
- const summary = context.agentSummary ?? 'WorkOS AuthKit installed successfully!';
295
- context.emitter.emit('complete', { success: true, summary, completion: context.completion });
296
- },
297
- assignCompletion: assign({
298
- completion: ({ event }) => event.output,
299
- }),
300
- },
301
- guards: {
302
- shouldSkipAuth: ({ context }) => context.options.skipAuth === true,
303
- gitIsClean: ({ context }) => context.gitIsClean === true,
304
- hasCredentials: ({ context }) => context.options.apiKey !== undefined && context.options.clientId !== undefined,
305
- hasIntegration: ({ context }) => context.integration !== undefined,
306
- shouldSkipPostInstall: ({ context }) => context.options.noCommit === true,
307
- hasGhCli: () => hasGhCli(),
308
- // Read from the actor's done event (output), not context: the
309
- // assignWorkspaceResult action has not run yet when guards are evaluated.
310
- notScaffoldable: ({ event }) => !event.output?.scaffoldable,
311
- shouldAutoScaffold: ({ event }) => {
312
- const output = event.output;
313
- return !!output?.scaffoldable && !!output?.autoScaffold;
314
- },
315
- },
316
- actors: {
317
- checkAuthentication: fromPromise(async () => {
318
- throw new Error('checkAuthentication not implemented - provide via machine.provide()');
319
- }),
320
- checkWorkspace: fromPromise(async () => {
321
- throw new Error('checkWorkspace not implemented - provide via machine.provide()');
322
- }),
323
- runScaffold: fromPromise(async () => {
324
- throw new Error('runScaffold not implemented - provide via machine.provide()');
325
- }),
326
- detectIntegration: fromPromise(async () => {
327
- throw new Error('detectIntegration not implemented - provide via machine.provide()');
328
- }),
329
- checkGitStatus: fromPromise(async () => {
330
- throw new Error('checkGitStatus not implemented - provide via machine.provide()');
331
- }),
332
- configureEnvironment: fromPromise(async () => {
333
- throw new Error('configureEnvironment not implemented - provide via machine.provide()');
334
- }),
335
- runAgent: fromPromise(async () => {
336
- throw new Error('runAgent not implemented - provide via machine.provide()');
337
- }),
338
- buildCompletion: fromPromise(async () => {
339
- throw new Error('buildCompletion not implemented - provide via machine.provide()');
340
- }),
341
- // Credential discovery actors
342
- detectEnvFiles: fromPromise(async () => {
343
- throw new Error('detectEnvFiles not implemented - provide via machine.provide()');
344
- }),
345
- scanEnvFiles: fromPromise(async () => {
346
- throw new Error('scanEnvFiles not implemented - provide via machine.provide()');
347
- }),
348
- checkStoredAuth: fromPromise(async () => {
349
- throw new Error('checkStoredAuth not implemented - provide via machine.provide()');
350
- }),
351
- runDeviceAuth: fromPromise(async () => {
352
- throw new Error('runDeviceAuth not implemented - provide via machine.provide()');
353
- }),
354
- fetchStagingCredentials: fromPromise(async () => {
355
- throw new Error('fetchStagingCredentials not implemented - provide via machine.provide()');
356
- }),
357
- // Branch check actors
358
- checkBranch: fromPromise(async () => {
359
- throw new Error('checkBranch not implemented - provide via machine.provide()');
360
- }),
361
- createBranch: fromPromise(async () => {
362
- throw new Error('createBranch not implemented - provide via machine.provide()');
363
- }),
364
- // Post-install actors
365
- detectChanges: fromPromise(async () => {
366
- throw new Error('detectChanges not implemented - provide via machine.provide()');
367
- }),
368
- generateCommitMessage: fromPromise(async () => {
369
- throw new Error('generateCommitMessage not implemented - provide via machine.provide()');
370
- }),
371
- commitChanges: fromPromise(async () => {
372
- throw new Error('commitChanges not implemented - provide via machine.provide()');
373
- }),
374
- generatePrDescription: fromPromise(async () => {
375
- throw new Error('generatePrDescription not implemented - provide via machine.provide()');
376
- }),
377
- pushBranch: fromPromise(async () => {
378
- throw new Error('pushBranch not implemented - provide via machine.provide()');
379
- }),
380
- createPr: fromPromise(async () => {
381
- throw new Error('createPr not implemented - provide via machine.provide()');
382
- }),
383
- },
384
- }).createMachine({
385
- id: 'installer',
386
- initial: 'idle',
387
- context: ({ input }) => ({
388
- emitter: input.emitter,
389
- options: input.options,
390
- // Set by the detection actor; no pre-seeding (the --integration flag is gone).
391
- integration: undefined,
392
- credentials: input.options.apiKey && input.options.clientId
393
- ? { apiKey: input.options.apiKey, clientId: input.options.clientId }
394
- : undefined,
395
- gitIsClean: true,
396
- gitDirtyFiles: [],
397
- error: undefined,
398
- }),
399
- // Global event handlers - CANCEL can be sent from any state
400
- on: {
401
- CANCEL: {
402
- target: '.cancelled',
403
- },
404
- },
405
- states: {
406
- idle: {
407
- on: {
408
- START: [
409
- {
410
- target: 'scaffold',
411
- guard: 'shouldSkipAuth',
412
- actions: { type: 'emitStateEnter', params: { state: 'scaffold' } },
413
- },
414
- {
415
- target: 'authenticating',
416
- actions: { type: 'emitStateEnter', params: { state: 'authenticating' } },
417
- },
418
- ],
419
- },
420
- },
421
- authenticating: {
422
- entry: ['emitAuthChecking'],
423
- invoke: {
424
- id: 'checkAuthentication',
425
- src: 'checkAuthentication',
426
- input: ({ context }) => ({ options: context.options }),
427
- onDone: {
428
- target: 'scaffold',
429
- actions: [
430
- 'emitAuthSuccess',
431
- { type: 'emitStateExit', params: { state: 'authenticating' } },
432
- { type: 'emitStateEnter', params: { state: 'scaffold' } },
433
- ],
434
- },
435
- onError: {
436
- target: 'error',
437
- actions: ['assignError', 'emitAuthFailure', { type: 'emitStateExit', params: { state: 'authenticating' } }],
438
- },
439
- },
440
- },
441
- scaffold: {
442
- initial: 'checking',
443
- states: {
444
- checking: {
445
- entry: ['emitScaffoldChecking'],
446
- invoke: {
447
- id: 'checkWorkspace',
448
- src: 'checkWorkspace',
449
- input: ({ context }) => ({ options: context.options }),
450
- onDone: [
451
- {
452
- // Not an empty dir: fall through to today's behavior.
453
- target: 'done',
454
- guard: 'notScaffoldable',
455
- actions: ['assignWorkspaceResult'],
456
- },
457
- {
458
- // Headless or --scaffold: skip the prompt.
459
- target: 'running',
460
- guard: 'shouldAutoScaffold',
461
- actions: ['assignWorkspaceResult'],
462
- },
463
- {
464
- // Interactive empty dir: ask first.
465
- target: 'prompting',
466
- actions: ['assignWorkspaceResult'],
467
- },
468
- ],
469
- onError: {
470
- // Workspace check failure is non-fatal: proceed to preparing,
471
- // which errors on no-integration exactly as before this feature.
472
- target: 'done',
473
- },
474
- },
475
- },
476
- prompting: {
477
- entry: ['emitScaffoldPrompt'],
478
- on: {
479
- SCAFFOLD_CONFIRMED: {
480
- target: 'running',
481
- },
482
- SCAFFOLD_CANCELLED: {
483
- target: '#installer.cancelled',
484
- actions: ['emitScaffoldSkipped', { type: 'emitStateExit', params: { state: 'scaffold' } }],
485
- },
486
- },
487
- },
488
- running: {
489
- entry: ['emitScaffoldStart'],
490
- invoke: {
491
- id: 'runScaffold',
492
- src: 'runScaffold',
493
- input: ({ context }) => ({ context }),
494
- onDone: {
495
- target: 'done',
496
- actions: ['assignScaffolded', 'emitScaffoldComplete'],
497
- },
498
- onError: {
499
- target: '#installer.error',
500
- actions: ['assignError', 'emitScaffoldFailed', { type: 'emitStateExit', params: { state: 'scaffold' } }],
501
- },
502
- },
503
- },
504
- done: {
505
- type: 'final',
506
- },
507
- },
508
- onDone: {
509
- target: 'preparing',
510
- actions: [
511
- { type: 'emitStateExit', params: { state: 'scaffold' } },
512
- { type: 'emitStateEnter', params: { state: 'preparing' } },
513
- ],
514
- },
515
- },
516
- preparing: {
517
- type: 'parallel',
518
- states: {
519
- detection: {
520
- initial: 'running',
521
- states: {
522
- running: {
523
- entry: ['emitDetectionStart'],
524
- invoke: {
525
- id: 'detectIntegration',
526
- src: 'detectIntegration',
527
- input: ({ context }) => ({ options: context.options }),
528
- onDone: {
529
- target: 'done',
530
- actions: ['assignDetectionResult', 'emitDetectionComplete'],
531
- },
532
- onError: {
533
- // Detection failure is non-fatal - user can select manually
534
- target: 'done',
535
- actions: ['emitDetectionComplete'],
536
- },
537
- },
538
- },
539
- done: {
540
- type: 'final',
541
- },
542
- },
543
- },
544
- gitCheck: {
545
- initial: 'running',
546
- states: {
547
- running: {
548
- entry: ['emitGitChecking'],
549
- invoke: {
550
- id: 'checkGitStatus',
551
- src: 'checkGitStatus',
552
- input: ({ context }) => ({ installDir: context.options.installDir }),
553
- onDone: {
554
- target: 'evaluating',
555
- actions: ['assignGitResult'],
556
- },
557
- onError: {
558
- // Git check failure is non-fatal - treat as clean
559
- target: 'done',
560
- },
561
- },
562
- },
563
- evaluating: {
564
- always: [
565
- {
566
- target: 'done',
567
- guard: 'gitIsClean',
568
- actions: ['emitGitClean'],
569
- },
570
- {
571
- target: 'awaitingConfirmation',
572
- actions: ['emitGitDirty'],
573
- },
574
- ],
575
- },
576
- awaitingConfirmation: {
577
- on: {
578
- GIT_CONFIRMED: {
579
- target: 'done',
580
- actions: ['emitGitConfirmed'],
581
- },
582
- GIT_CANCELLED: {
583
- target: '#installer.cancelled',
584
- actions: ['emitGitCancelled'],
585
- },
586
- },
587
- },
588
- done: {
589
- type: 'final',
590
- },
591
- },
592
- },
593
- branchCheck: {
594
- initial: 'running',
595
- states: {
596
- running: {
597
- entry: ['emitBranchChecking'],
598
- invoke: {
599
- id: 'checkBranch',
600
- src: 'checkBranch',
601
- onDone: [
602
- {
603
- target: 'awaitingConfirmation',
604
- guard: ({ event }) => event.output.isProtected,
605
- actions: ['assignBranchResult', 'emitBranchProtected'],
606
- },
607
- {
608
- target: 'done',
609
- actions: ['assignBranchResult'],
610
- },
611
- ],
612
- onError: {
613
- // Branch check failure is non-fatal
614
- target: 'done',
615
- },
616
- },
617
- },
618
- awaitingConfirmation: {
619
- on: {
620
- BRANCH_CREATE: {
621
- target: 'creating',
622
- },
623
- BRANCH_CONTINUE: {
624
- target: 'done',
625
- },
626
- BRANCH_CANCEL: {
627
- target: '#installer.cancelled',
628
- },
629
- },
630
- },
631
- creating: {
632
- invoke: {
633
- id: 'createBranch',
634
- src: 'createBranch',
635
- input: () => ({
636
- name: 'feat/add-workos-authkit',
637
- fallbackName: `feat/add-workos-authkit-${Date.now()}`,
638
- }),
639
- onDone: {
640
- target: 'done',
641
- actions: [
642
- {
643
- type: 'emitBranchCreated',
644
- params: ({ event }) => ({ branch: event.output.branch }),
645
- },
646
- ],
647
- },
648
- onError: {
649
- // Branch creation failure is non-fatal
650
- target: 'done',
651
- actions: ['assignError', 'emitBranchCreateFailed'],
652
- },
653
- },
654
- },
655
- done: {
656
- type: 'final',
657
- },
658
- },
659
- },
660
- },
661
- onDone: [
662
- {
663
- target: 'gatheringCredentials',
664
- guard: 'hasIntegration',
665
- actions: { type: 'emitStateExit', params: { state: 'preparing' } },
666
- },
667
- {
668
- target: 'error',
669
- actions: [
670
- assign({
671
- error: ({ context }) => {
672
- const dir = context.options.installDir;
673
- return new Error(`No supported framework was detected in ${dir}.\n` +
674
- `Because this directory isn't empty, a new app wasn't scaffolded, and no recognized ` +
675
- `framework (such as a package.json with Next.js) was found to install into.\n\n` +
676
- `Next steps:\n` +
677
- ` - New app: run \`${formatWorkOSCommand('install')}\` in an empty directory to scaffold Next.js + AuthKit.\n` +
678
- ` - Existing project: run from the directory that contains your package.json, or pass --install-dir <path>.`);
679
- },
680
- }),
681
- { type: 'emitStateExit', params: { state: 'preparing' } },
682
- ],
683
- },
684
- ],
685
- },
686
- gatheringCredentials: {
687
- entry: [{ type: 'emitStateEnter', params: { state: 'gatheringCredentials' } }],
688
- initial: 'checkingCliFlags',
689
- states: {
690
- // Step 1: Check CLI flags (highest priority)
691
- checkingCliFlags: {
692
- always: [
693
- {
694
- target: '#installer.configuring',
695
- guard: 'hasCredentials',
696
- actions: [
697
- assign({ credentialSource: () => 'cli' }),
698
- 'emitCredentialsFound',
699
- { type: 'emitStateExit', params: { state: 'gatheringCredentials' } },
700
- ],
701
- },
702
- { target: 'detectingEnvFiles' },
703
- ],
704
- },
705
- // Step 2: Check if env files exist (don't read yet)
706
- detectingEnvFiles: {
707
- invoke: {
708
- id: 'detectEnvFiles',
709
- src: 'detectEnvFiles',
710
- input: ({ context }) => ({ installDir: context.options.installDir }),
711
- onDone: [
712
- {
713
- target: 'promptingEnvScan',
714
- guard: ({ event }) => {
715
- const output = event.output;
716
- return output.exists;
717
- },
718
- actions: [
719
- assign({
720
- envFilesDetected: ({ event }) => {
721
- const output = event.output;
722
- return output.files;
723
- },
724
- }),
725
- 'emitEnvDetected',
726
- ],
727
- },
728
- { target: 'checkingStoredAuth' },
729
- ],
730
- onError: {
731
- target: 'checkingStoredAuth', // Non-fatal, continue
732
- },
733
- },
734
- },
735
- // Step 3: Ask user for consent to scan env files
736
- promptingEnvScan: {
737
- entry: ['emitEnvScanPrompt'],
738
- on: {
739
- ENV_SCAN_APPROVED: {
740
- target: 'scanningEnvFiles',
741
- actions: assign({ envScanConsent: () => true }),
742
- },
743
- ENV_SCAN_DECLINED: {
744
- target: 'checkingStoredAuth',
745
- actions: assign({ envScanConsent: () => false }),
746
- },
747
- CANCEL: {
748
- target: '#installer.cancelled',
749
- actions: { type: 'emitStateExit', params: { state: 'gatheringCredentials' } },
750
- },
751
- },
752
- },
753
- // Step 4: Scan env files for credentials (with consent)
754
- scanningEnvFiles: {
755
- entry: ['emitEnvScanning'],
756
- invoke: {
757
- id: 'scanEnvFiles',
758
- src: 'scanEnvFiles',
759
- input: ({ context }) => ({ installDir: context.options.installDir }),
760
- onDone: [
761
- {
762
- target: '#installer.configuring',
763
- guard: ({ event }) => {
764
- const result = event.output;
765
- return result.found && !!result.clientId;
766
- },
767
- actions: [
768
- assign({
769
- credentials: ({ event }) => {
770
- const result = event.output;
771
- return { clientId: result.clientId, apiKey: result.apiKey };
772
- },
773
- credentialSource: () => 'env',
774
- envCredentialPath: ({ event }) => event.output.sourcePath,
775
- }),
776
- 'emitEnvCredentialsFound',
777
- { type: 'emitStateExit', params: { state: 'gatheringCredentials' } },
778
- ],
779
- },
780
- {
781
- target: 'checkingStoredAuth',
782
- actions: ['emitEnvNotFound'],
783
- },
784
- ],
785
- onError: {
786
- target: 'checkingStoredAuth',
787
- },
788
- },
789
- },
790
- // Step 5: Check for stored auth token
791
- checkingStoredAuth: {
792
- invoke: {
793
- id: 'checkStoredAuth',
794
- src: 'checkStoredAuth',
795
- onDone: [
796
- {
797
- target: 'fetchingStagingCredentials',
798
- guard: ({ event }) => event.output === true,
799
- },
800
- { target: 'runningDeviceAuth' },
801
- ],
802
- onError: {
803
- target: 'runningDeviceAuth',
804
- },
805
- },
806
- },
807
- // Step 6: Run device authorization flow
808
- runningDeviceAuth: {
809
- entry: ['emitDeviceAuthStart'],
810
- invoke: {
811
- id: 'runDeviceAuth',
812
- src: 'runDeviceAuth',
813
- input: ({ context }) => ({ emitter: context.emitter }),
814
- onDone: {
815
- target: 'fetchingStagingCredentials',
816
- actions: [
817
- 'emitDeviceAuthSuccess',
818
- assign({
819
- deviceAuth: ({ event }) => {
820
- const output = event.output;
821
- return {
822
- verificationUri: output.deviceAuth.verification_uri,
823
- verificationUriComplete: output.deviceAuth.verification_uri_complete,
824
- userCode: output.deviceAuth.user_code,
825
- };
826
- },
827
- }),
828
- ],
829
- },
830
- onError: {
831
- target: 'promptingManual',
832
- actions: ['assignError', 'emitDeviceAuthError'],
833
- },
834
- },
835
- },
836
- // Step 7: Fetch staging credentials from API
837
- fetchingStagingCredentials: {
838
- entry: ['emitStagingFetching'],
839
- invoke: {
840
- id: 'fetchStagingCredentials',
841
- src: 'fetchStagingCredentials',
842
- onDone: {
843
- target: '#installer.configuring',
844
- actions: [
845
- assign({
846
- credentials: ({ event }) => {
847
- const staging = event.output;
848
- return { clientId: staging.clientId, apiKey: staging.apiKey };
849
- },
850
- credentialSource: ({ context }) => context.deviceAuth ? 'device' : 'stored',
851
- }),
852
- 'emitStagingSuccess',
853
- { type: 'emitStateExit', params: { state: 'gatheringCredentials' } },
854
- ],
855
- },
856
- onError: {
857
- target: 'promptingManual',
858
- actions: ['assignError', 'emitStagingError'],
859
- },
860
- },
861
- },
862
- // Step 8: Manual fallback
863
- promptingManual: {
864
- entry: ['emitCredentialsGathering'],
865
- on: {
866
- CREDENTIALS_SUBMITTED: {
867
- target: '#installer.configuring',
868
- actions: [
869
- 'assignCredentials',
870
- assign({ credentialSource: () => 'manual' }),
871
- { type: 'emitStateExit', params: { state: 'gatheringCredentials' } },
872
- ],
873
- },
874
- RETRY_AUTH: {
875
- target: 'runningDeviceAuth',
876
- },
877
- CANCEL: {
878
- target: '#installer.cancelled',
879
- actions: { type: 'emitStateExit', params: { state: 'gatheringCredentials' } },
880
- },
881
- },
882
- },
883
- },
884
- },
885
- configuring: {
886
- entry: [{ type: 'emitStateEnter', params: { state: 'configuring' } }, 'emitConfigStart'],
887
- invoke: {
888
- id: 'configureEnvironment',
889
- src: 'configureEnvironment',
890
- input: ({ context }) => ({ context }),
891
- onDone: {
892
- target: 'runningAgent',
893
- actions: ['emitConfigComplete', { type: 'emitStateExit', params: { state: 'configuring' } }],
894
- },
895
- onError: {
896
- target: 'error',
897
- actions: ['assignError', { type: 'emitStateExit', params: { state: 'configuring' } }],
898
- },
899
- },
900
- },
901
- runningAgent: {
902
- entry: [{ type: 'emitStateEnter', params: { state: 'runningAgent' } }, 'emitAgentStart'],
903
- invoke: {
904
- id: 'runAgent',
905
- src: 'runAgent',
906
- input: ({ context }) => ({ context }),
907
- onDone: [
908
- {
909
- target: 'error',
910
- guard: ({ event }) => {
911
- const output = event.output;
912
- return !output.success;
913
- },
914
- actions: [
915
- ({ context, event }) => {
916
- const output = event.output;
917
- context.emitter.emit('agent:failure', {
918
- message: output.error?.message ?? 'Agent failed',
919
- });
920
- },
921
- assign({
922
- error: ({ event }) => {
923
- const output = event.output;
924
- return output.error ?? new Error('Agent failed');
925
- },
926
- }),
927
- { type: 'emitStateExit', params: { state: 'runningAgent' } },
928
- ],
929
- },
930
- {
931
- target: 'postInstall',
932
- actions: [
933
- assign({
934
- agentSummary: ({ event }) => {
935
- const output = event.output;
936
- return output.summary;
937
- },
938
- }),
939
- ({ context, event }) => {
940
- const output = event.output;
941
- context.emitter.emit('agent:success', { summary: output.summary });
942
- },
943
- { type: 'emitStateExit', params: { state: 'runningAgent' } },
944
- ],
945
- },
946
- ],
947
- onError: {
948
- target: 'error',
949
- actions: ['assignError', 'emitAgentFailure', { type: 'emitStateExit', params: { state: 'runningAgent' } }],
950
- },
951
- },
952
- },
953
- postInstall: {
954
- initial: 'checking',
955
- entry: [{ type: 'emitStateEnter', params: { state: 'postInstall' } }],
956
- states: {
957
- checking: {
958
- always: [
959
- {
960
- target: '#installer.buildingCompletion',
961
- guard: 'shouldSkipPostInstall',
962
- },
963
- { target: 'detectingChanges' },
964
- ],
965
- },
966
- detectingChanges: {
967
- invoke: {
968
- id: 'detectChanges',
969
- src: 'detectChanges',
970
- onDone: [
971
- {
972
- target: 'promptingCommit',
973
- guard: ({ event }) => event.output.hasChanges,
974
- actions: ['assignChangedFiles', 'emitChangesDetected'],
975
- },
976
- {
977
- target: 'done',
978
- actions: ['emitNoChanges'],
979
- },
980
- ],
981
- onError: { target: 'done' },
982
- },
983
- },
984
- promptingCommit: {
985
- entry: ['emitCommitPrompt'],
986
- on: {
987
- COMMIT_APPROVED: { target: 'generatingCommitMessage' },
988
- COMMIT_DECLINED: { target: 'done' },
989
- CANCEL: { target: '#installer.cancelled' },
990
- },
991
- },
992
- generatingCommitMessage: {
993
- entry: ['emitGeneratingCommitMessage'],
994
- invoke: {
995
- id: 'generateCommitMessage',
996
- src: 'generateCommitMessage',
997
- input: ({ context }) => ({
998
- integration: context.integration ?? 'project',
999
- files: context.changedFiles ?? [],
1000
- direct: context.options.direct,
1001
- }),
1002
- onDone: {
1003
- target: 'committing',
1004
- actions: ['assignCommitMessage'],
1005
- },
1006
- },
1007
- },
1008
- committing: {
1009
- entry: ['emitCommitting'],
1010
- invoke: {
1011
- id: 'commitChanges',
1012
- src: 'commitChanges',
1013
- input: ({ context }) => ({
1014
- message: context.commitMessage ?? '',
1015
- cwd: context.options.installDir,
1016
- }),
1017
- onDone: {
1018
- target: 'checkingGhCli',
1019
- actions: ['emitCommitSuccess'],
1020
- },
1021
- onError: {
1022
- target: 'done',
1023
- actions: ['assignError', 'emitCommitFailed'],
1024
- },
1025
- },
1026
- },
1027
- checkingGhCli: {
1028
- always: [
1029
- {
1030
- target: 'promptingPr',
1031
- guard: 'hasGhCli',
1032
- },
1033
- {
1034
- target: 'showingManualInstructions',
1035
- },
1036
- ],
1037
- },
1038
- promptingPr: {
1039
- entry: ['emitPrPrompt'],
1040
- on: {
1041
- PR_APPROVED: { target: 'generatingPrDescription' },
1042
- PR_DECLINED: { target: 'done' },
1043
- CANCEL: { target: '#installer.cancelled' },
1044
- },
1045
- },
1046
- generatingPrDescription: {
1047
- entry: ['emitGeneratingPrDescription'],
1048
- invoke: {
1049
- id: 'generatePrDescription',
1050
- src: 'generatePrDescription',
1051
- input: ({ context }) => ({
1052
- integration: context.integration ?? 'project',
1053
- files: context.changedFiles ?? [],
1054
- commitMessage: context.commitMessage ?? '',
1055
- direct: context.options.direct,
1056
- }),
1057
- onDone: {
1058
- target: 'pushing',
1059
- actions: ['assignPrDescription'],
1060
- },
1061
- },
1062
- },
1063
- pushing: {
1064
- entry: ['emitPushing'],
1065
- invoke: {
1066
- id: 'pushBranch',
1067
- src: 'pushBranch',
1068
- input: ({ context }) => ({ cwd: context.options.installDir }),
1069
- onDone: { target: 'creatingPr' },
1070
- onError: {
1071
- target: 'showingManualInstructions',
1072
- actions: ['assignError', 'emitPushFailed'],
1073
- },
1074
- },
1075
- },
1076
- creatingPr: {
1077
- entry: ['emitCreatingPr'],
1078
- invoke: {
1079
- id: 'createPr',
1080
- src: 'createPr',
1081
- input: ({ context }) => ({
1082
- title: context.commitMessage ?? '',
1083
- body: context.prDescription ?? '',
1084
- cwd: context.options.installDir,
1085
- }),
1086
- onDone: {
1087
- target: 'done',
1088
- actions: ['assignPrUrl', 'emitPrCreated'],
1089
- },
1090
- onError: {
1091
- target: 'done',
1092
- actions: ['assignError', 'emitPrFailed'],
1093
- },
1094
- },
1095
- },
1096
- showingManualInstructions: {
1097
- entry: ['emitManualInstructions'],
1098
- always: { target: 'done' },
1099
- },
1100
- done: {
1101
- type: 'final',
1102
- },
1103
- },
1104
- onDone: {
1105
- target: 'buildingCompletion',
1106
- },
1107
- },
1108
- // Compute the structured completion payload before entering `complete`.
1109
- // `emitComplete` is a synchronous entry action, but the builder is async
1110
- // (lockfile-aware dev command, port detection), so it must run in an actor
1111
- // first. Errors never block completion — they fall through to the static box.
1112
- buildingCompletion: {
1113
- invoke: {
1114
- src: 'buildCompletion',
1115
- input: ({ context }) => ({ context }),
1116
- onDone: { target: 'complete', actions: ['assignCompletion'] },
1117
- onError: { target: 'complete' },
1118
- },
1119
- },
1120
- complete: {
1121
- type: 'final',
1122
- entry: [{ type: 'emitStateEnter', params: { state: 'complete' } }, 'emitComplete'],
1123
- },
1124
- cancelled: {
1125
- type: 'final',
1126
- entry: [{ type: 'emitStateEnter', params: { state: 'cancelled' } }, 'emitCancelled'],
1127
- },
1128
- error: {
1129
- type: 'final',
1130
- entry: [{ type: 'emitStateEnter', params: { state: 'error' } }, 'emitError'],
1131
- },
1132
- },
1133
- });
1134
- //# sourceMappingURL=installer-core.js.map