workos 0.17.1 → 0.19.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 (366) hide show
  1. package/README.md +11 -149
  2. package/dist/bin.js +155 -23
  3. package/dist/bin.js.map +1 -1
  4. package/dist/cli.config.d.ts +0 -2
  5. package/dist/cli.config.js +3 -3
  6. package/dist/cli.config.js.map +1 -1
  7. package/dist/commands/api/index.js +18 -10
  8. package/dist/commands/api/index.js.map +1 -1
  9. package/dist/commands/api/interactive.js +11 -11
  10. package/dist/commands/api/interactive.js.map +1 -1
  11. package/dist/commands/claim.js +28 -16
  12. package/dist/commands/claim.js.map +1 -1
  13. package/dist/commands/connection.js +3 -3
  14. package/dist/commands/connection.js.map +1 -1
  15. package/dist/commands/debug.d.ts +11 -0
  16. package/dist/commands/debug.js +30 -14
  17. package/dist/commands/debug.js.map +1 -1
  18. package/dist/commands/dev.d.ts +7 -8
  19. package/dist/commands/dev.js +14 -14
  20. package/dist/commands/dev.js.map +1 -1
  21. package/dist/commands/directory.js +3 -3
  22. package/dist/commands/directory.js.map +1 -1
  23. package/dist/commands/doctor.js +2 -2
  24. package/dist/commands/doctor.js.map +1 -1
  25. package/dist/commands/emulate.d.ts +1 -0
  26. package/dist/commands/emulate.js +3 -2
  27. package/dist/commands/emulate.js.map +1 -1
  28. package/dist/commands/env.d.ts +10 -0
  29. package/dist/commands/env.js +94 -18
  30. package/dist/commands/env.js.map +1 -1
  31. package/dist/commands/install.js +9 -10
  32. package/dist/commands/install.js.map +1 -1
  33. package/dist/commands/login.d.ts +25 -15
  34. package/dist/commands/login.js +126 -71
  35. package/dist/commands/login.js.map +1 -1
  36. package/dist/commands/logout.js +4 -4
  37. package/dist/commands/logout.js.map +1 -1
  38. package/dist/commands/mcp.d.ts +14 -0
  39. package/dist/commands/mcp.js +99 -0
  40. package/dist/commands/mcp.js.map +1 -0
  41. package/dist/commands/migrations.js +2 -1
  42. package/dist/commands/migrations.js.map +1 -1
  43. package/dist/commands/seed.js +5 -4
  44. package/dist/commands/seed.js.map +1 -1
  45. package/dist/commands/setup.d.ts +50 -0
  46. package/dist/commands/setup.js +237 -0
  47. package/dist/commands/setup.js.map +1 -0
  48. package/dist/commands/vault-run.js +3 -2
  49. package/dist/commands/vault-run.js.map +1 -1
  50. package/dist/commands/verify-login.d.ts +25 -0
  51. package/dist/commands/verify-login.js +158 -0
  52. package/dist/commands/verify-login.js.map +1 -0
  53. package/dist/doctor/checks/ai-analysis.js +2 -1
  54. package/dist/doctor/checks/ai-analysis.js.map +1 -1
  55. package/dist/doctor/checks/mcp.d.ts +15 -0
  56. package/dist/doctor/checks/mcp.js +34 -0
  57. package/dist/doctor/checks/mcp.js.map +1 -0
  58. package/dist/doctor/index.js +7 -1
  59. package/dist/doctor/index.js.map +1 -1
  60. package/dist/doctor/issues.js +18 -1
  61. package/dist/doctor/issues.js.map +1 -1
  62. package/dist/doctor/output.js +18 -3
  63. package/dist/doctor/output.js.map +1 -1
  64. package/dist/doctor/types.d.ts +17 -0
  65. package/dist/doctor/types.js.map +1 -1
  66. package/dist/integrations/dotnet/index.js +1 -1
  67. package/dist/integrations/dotnet/index.js.map +1 -1
  68. package/dist/integrations/elixir/index.js +1 -1
  69. package/dist/integrations/elixir/index.js.map +1 -1
  70. package/dist/integrations/go/index.js +1 -1
  71. package/dist/integrations/go/index.js.map +1 -1
  72. package/dist/integrations/nextjs/index.js +8 -5
  73. package/dist/integrations/nextjs/index.js.map +1 -1
  74. package/dist/integrations/nextjs/utils.d.ts +1 -1
  75. package/dist/integrations/nextjs/utils.js +21 -6
  76. package/dist/integrations/nextjs/utils.js.map +1 -1
  77. package/dist/integrations/react-router/index.js +5 -5
  78. package/dist/integrations/react-router/index.js.map +1 -1
  79. package/dist/integrations/react-router/utils.js +28 -12
  80. package/dist/integrations/react-router/utils.js.map +1 -1
  81. package/dist/integrations/ruby/index.js +1 -1
  82. package/dist/integrations/ruby/index.js.map +1 -1
  83. package/dist/lib/adapters/cli-adapter.d.ts +33 -4
  84. package/dist/lib/adapters/cli-adapter.js +251 -135
  85. package/dist/lib/adapters/cli-adapter.js.map +1 -1
  86. package/dist/lib/adapters/dashboard-adapter.js +3 -3
  87. package/dist/lib/adapters/dashboard-adapter.js.map +1 -1
  88. package/dist/lib/adapters/headless-adapter.d.ts +7 -0
  89. package/dist/lib/adapters/headless-adapter.js +42 -5
  90. package/dist/lib/adapters/headless-adapter.js.map +1 -1
  91. package/dist/lib/agent-interface.js +19 -5
  92. package/dist/lib/agent-interface.js.map +1 -1
  93. package/dist/lib/agent-runner.js +1 -1
  94. package/dist/lib/agent-runner.js.map +1 -1
  95. package/dist/lib/ai-content.js +2 -1
  96. package/dist/lib/ai-content.js.map +1 -1
  97. package/dist/lib/api-key.js +2 -1
  98. package/dist/lib/api-key.js.map +1 -1
  99. package/dist/lib/completion-data.d.ts +33 -0
  100. package/dist/lib/completion-data.js +33 -0
  101. package/dist/lib/completion-data.js.map +1 -0
  102. package/dist/lib/config-store.d.ts +13 -0
  103. package/dist/lib/config-store.js +24 -0
  104. package/dist/lib/config-store.js.map +1 -1
  105. package/dist/lib/config.d.ts +1 -1
  106. package/dist/lib/config.js +1 -1
  107. package/dist/lib/config.js.map +1 -1
  108. package/dist/lib/constants.d.ts +17 -0
  109. package/dist/lib/constants.js +17 -0
  110. package/dist/lib/constants.js.map +1 -1
  111. package/dist/lib/events.d.ts +34 -1
  112. package/dist/lib/events.js.map +1 -1
  113. package/dist/lib/framework-config.d.ts +6 -0
  114. package/dist/lib/framework-config.js.map +1 -1
  115. package/dist/lib/installer-core.d.ts +34 -21
  116. package/dist/lib/installer-core.js +24 -5
  117. package/dist/lib/installer-core.js.map +1 -1
  118. package/dist/lib/installer-core.types.d.ts +3 -1
  119. package/dist/lib/installer-core.types.js.map +1 -1
  120. package/dist/lib/mcp-clients.d.ts +45 -0
  121. package/dist/lib/mcp-clients.js +297 -0
  122. package/dist/lib/mcp-clients.js.map +1 -0
  123. package/dist/lib/port-detection.js +19 -13
  124. package/dist/lib/port-detection.js.map +1 -1
  125. package/dist/lib/preferences.d.ts +42 -0
  126. package/dist/lib/preferences.js +34 -5
  127. package/dist/lib/preferences.js.map +1 -1
  128. package/dist/lib/run-with-core.js +42 -4
  129. package/dist/lib/run-with-core.js.map +1 -1
  130. package/dist/lib/settings.d.ts +5 -14
  131. package/dist/lib/settings.js +5 -16
  132. package/dist/lib/settings.js.map +1 -1
  133. package/dist/lib/startup-notice-gate.d.ts +21 -0
  134. package/dist/lib/startup-notice-gate.js +29 -0
  135. package/dist/lib/startup-notice-gate.js.map +1 -0
  136. package/dist/lib/telemetry-notice.d.ts +5 -5
  137. package/dist/lib/telemetry-notice.js +10 -8
  138. package/dist/lib/telemetry-notice.js.map +1 -1
  139. package/dist/lib/unclaimed-env-provision.js +15 -12
  140. package/dist/lib/unclaimed-env-provision.js.map +1 -1
  141. package/dist/lib/unclaimed-warning.js +7 -3
  142. package/dist/lib/unclaimed-warning.js.map +1 -1
  143. package/dist/lib/validation/security-checks.js +2 -1
  144. package/dist/lib/validation/security-checks.js.map +1 -1
  145. package/dist/lib/validation/validator.js +30 -3
  146. package/dist/lib/validation/validator.js.map +1 -1
  147. package/dist/lib/workos-management.js +26 -19
  148. package/dist/lib/workos-management.js.map +1 -1
  149. package/dist/run.d.ts +1 -0
  150. package/dist/run.js +5 -1
  151. package/dist/run.js.map +1 -1
  152. package/dist/steps/add-or-update-environment-variables.js +10 -10
  153. package/dist/steps/add-or-update-environment-variables.js.map +1 -1
  154. package/dist/steps/run-prettier.js +3 -3
  155. package/dist/steps/run-prettier.js.map +1 -1
  156. package/dist/steps/upload-environment-variables/index.js +15 -3
  157. package/dist/steps/upload-environment-variables/index.js.map +1 -1
  158. package/dist/steps/upload-environment-variables/providers/vercel.js +2 -2
  159. package/dist/steps/upload-environment-variables/providers/vercel.js.map +1 -1
  160. package/dist/utils/analytics.d.ts +1 -0
  161. package/dist/utils/analytics.js +5 -1
  162. package/dist/utils/analytics.js.map +1 -1
  163. package/dist/utils/box.d.ts +6 -30
  164. package/dist/utils/box.js +8 -95
  165. package/dist/utils/box.js.map +1 -1
  166. package/dist/utils/cli-symbols.d.ts +14 -2
  167. package/dist/utils/cli-symbols.js +12 -0
  168. package/dist/utils/cli-symbols.js.map +1 -1
  169. package/dist/utils/debug.js +3 -3
  170. package/dist/utils/debug.js.map +1 -1
  171. package/dist/utils/environment.js +1 -1
  172. package/dist/utils/environment.js.map +1 -1
  173. package/dist/utils/help-json.js +153 -4
  174. package/dist/utils/help-json.js.map +1 -1
  175. package/dist/utils/interaction-mode.d.ts +1 -1
  176. package/dist/utils/interaction-mode.js +0 -3
  177. package/dist/utils/interaction-mode.js.map +1 -1
  178. package/dist/utils/output.d.ts +5 -3
  179. package/dist/utils/output.js +5 -5
  180. package/dist/utils/output.js.map +1 -1
  181. package/dist/utils/package-manager.js +1 -1
  182. package/dist/utils/package-manager.js.map +1 -1
  183. package/dist/utils/recovery-hints.d.ts +5 -0
  184. package/dist/utils/recovery-hints.js +12 -0
  185. package/dist/utils/recovery-hints.js.map +1 -1
  186. package/dist/utils/summary-box.d.ts +8 -1
  187. package/dist/utils/summary-box.js +67 -4
  188. package/dist/utils/summary-box.js.map +1 -1
  189. package/dist/utils/telemetry-types.d.ts +1 -1
  190. package/dist/utils/telemetry-types.js.map +1 -1
  191. package/dist/utils/types.d.ts +10 -0
  192. package/dist/utils/types.js.map +1 -1
  193. package/dist/utils/{clack-utils.d.ts → ui-utils.d.ts} +1 -1
  194. package/dist/utils/{clack-utils.js → ui-utils.js} +64 -37
  195. package/dist/utils/ui-utils.js.map +1 -0
  196. package/dist/utils/ui.d.ts +148 -0
  197. package/dist/utils/ui.js +368 -0
  198. package/dist/utils/ui.js.map +1 -0
  199. package/dist/utils/urls.d.ts +9 -3
  200. package/dist/utils/urls.js +10 -4
  201. package/dist/utils/urls.js.map +1 -1
  202. package/package.json +13 -20
  203. package/dist/check-coverage.ts +0 -237
  204. package/dist/emulate/core/id.d.ts +0 -48
  205. package/dist/emulate/core/id.js +0 -73
  206. package/dist/emulate/core/id.js.map +0 -1
  207. package/dist/emulate/core/index.d.ts +0 -8
  208. package/dist/emulate/core/index.js +0 -8
  209. package/dist/emulate/core/index.js.map +0 -1
  210. package/dist/emulate/core/jwt.d.ts +0 -28
  211. package/dist/emulate/core/jwt.js +0 -78
  212. package/dist/emulate/core/jwt.js.map +0 -1
  213. package/dist/emulate/core/middleware/auth.d.ts +0 -15
  214. package/dist/emulate/core/middleware/auth.js +0 -17
  215. package/dist/emulate/core/middleware/auth.js.map +0 -1
  216. package/dist/emulate/core/middleware/error-handler.d.ts +0 -22
  217. package/dist/emulate/core/middleware/error-handler.js +0 -72
  218. package/dist/emulate/core/middleware/error-handler.js.map +0 -1
  219. package/dist/emulate/core/pagination.d.ts +0 -27
  220. package/dist/emulate/core/pagination.js +0 -43
  221. package/dist/emulate/core/pagination.js.map +0 -1
  222. package/dist/emulate/core/plugin.d.ts +0 -15
  223. package/dist/emulate/core/plugin.js +0 -2
  224. package/dist/emulate/core/plugin.js.map +0 -1
  225. package/dist/emulate/core/server.d.ts +0 -17
  226. package/dist/emulate/core/server.js +0 -90
  227. package/dist/emulate/core/server.js.map +0 -1
  228. package/dist/emulate/core/store.d.ts +0 -44
  229. package/dist/emulate/core/store.js +0 -169
  230. package/dist/emulate/core/store.js.map +0 -1
  231. package/dist/emulate/index.d.ts +0 -25
  232. package/dist/emulate/index.js +0 -47
  233. package/dist/emulate/index.js.map +0 -1
  234. package/dist/emulate/workos/constants.d.ts +0 -56
  235. package/dist/emulate/workos/constants.js +0 -56
  236. package/dist/emulate/workos/constants.js.map +0 -1
  237. package/dist/emulate/workos/entities.d.ts +0 -360
  238. package/dist/emulate/workos/entities.js +0 -2
  239. package/dist/emulate/workos/entities.js.map +0 -1
  240. package/dist/emulate/workos/event-bus.d.ts +0 -17
  241. package/dist/emulate/workos/event-bus.js +0 -70
  242. package/dist/emulate/workos/event-bus.js.map +0 -1
  243. package/dist/emulate/workos/helpers.d.ts +0 -72
  244. package/dist/emulate/workos/helpers.js +0 -211
  245. package/dist/emulate/workos/helpers.js.map +0 -1
  246. package/dist/emulate/workos/index.d.ts +0 -93
  247. package/dist/emulate/workos/index.js +0 -326
  248. package/dist/emulate/workos/index.js.map +0 -1
  249. package/dist/emulate/workos/role-helpers.d.ts +0 -21
  250. package/dist/emulate/workos/role-helpers.js +0 -130
  251. package/dist/emulate/workos/role-helpers.js.map +0 -1
  252. package/dist/emulate/workos/routes/api-keys.d.ts +0 -2
  253. package/dist/emulate/workos/routes/api-keys.js +0 -32
  254. package/dist/emulate/workos/routes/api-keys.js.map +0 -1
  255. package/dist/emulate/workos/routes/audit-logs.d.ts +0 -2
  256. package/dist/emulate/workos/routes/audit-logs.js +0 -104
  257. package/dist/emulate/workos/routes/audit-logs.js.map +0 -1
  258. package/dist/emulate/workos/routes/auth-challenges.d.ts +0 -2
  259. package/dist/emulate/workos/routes/auth-challenges.js +0 -51
  260. package/dist/emulate/workos/routes/auth-challenges.js.map +0 -1
  261. package/dist/emulate/workos/routes/auth-factors.d.ts +0 -2
  262. package/dist/emulate/workos/routes/auth-factors.js +0 -51
  263. package/dist/emulate/workos/routes/auth-factors.js.map +0 -1
  264. package/dist/emulate/workos/routes/auth.d.ts +0 -2
  265. package/dist/emulate/workos/routes/auth.js +0 -350
  266. package/dist/emulate/workos/routes/auth.js.map +0 -1
  267. package/dist/emulate/workos/routes/authorization-checks.d.ts +0 -10
  268. package/dist/emulate/workos/routes/authorization-checks.js +0 -123
  269. package/dist/emulate/workos/routes/authorization-checks.js.map +0 -1
  270. package/dist/emulate/workos/routes/authorization-org-roles.d.ts +0 -2
  271. package/dist/emulate/workos/routes/authorization-org-roles.js +0 -64
  272. package/dist/emulate/workos/routes/authorization-org-roles.js.map +0 -1
  273. package/dist/emulate/workos/routes/authorization-permissions.d.ts +0 -2
  274. package/dist/emulate/workos/routes/authorization-permissions.js +0 -67
  275. package/dist/emulate/workos/routes/authorization-permissions.js.map +0 -1
  276. package/dist/emulate/workos/routes/authorization-resources.d.ts +0 -2
  277. package/dist/emulate/workos/routes/authorization-resources.js +0 -117
  278. package/dist/emulate/workos/routes/authorization-resources.js.map +0 -1
  279. package/dist/emulate/workos/routes/authorization-roles.d.ts +0 -2
  280. package/dist/emulate/workos/routes/authorization-roles.js +0 -13
  281. package/dist/emulate/workos/routes/authorization-roles.js.map +0 -1
  282. package/dist/emulate/workos/routes/config.d.ts +0 -2
  283. package/dist/emulate/workos/routes/config.js +0 -57
  284. package/dist/emulate/workos/routes/config.js.map +0 -1
  285. package/dist/emulate/workos/routes/connect.d.ts +0 -2
  286. package/dist/emulate/workos/routes/connect.js +0 -65
  287. package/dist/emulate/workos/routes/connect.js.map +0 -1
  288. package/dist/emulate/workos/routes/connections.d.ts +0 -2
  289. package/dist/emulate/workos/routes/connections.js +0 -73
  290. package/dist/emulate/workos/routes/connections.js.map +0 -1
  291. package/dist/emulate/workos/routes/data-integrations.d.ts +0 -2
  292. package/dist/emulate/workos/routes/data-integrations.js +0 -55
  293. package/dist/emulate/workos/routes/data-integrations.js.map +0 -1
  294. package/dist/emulate/workos/routes/directories.d.ts +0 -2
  295. package/dist/emulate/workos/routes/directories.js +0 -90
  296. package/dist/emulate/workos/routes/directories.js.map +0 -1
  297. package/dist/emulate/workos/routes/email-verification.d.ts +0 -2
  298. package/dist/emulate/workos/routes/email-verification.js +0 -49
  299. package/dist/emulate/workos/routes/email-verification.js.map +0 -1
  300. package/dist/emulate/workos/routes/events.d.ts +0 -2
  301. package/dist/emulate/workos/routes/events.js +0 -18
  302. package/dist/emulate/workos/routes/events.js.map +0 -1
  303. package/dist/emulate/workos/routes/feature-flags.d.ts +0 -2
  304. package/dist/emulate/workos/routes/feature-flags.js +0 -103
  305. package/dist/emulate/workos/routes/feature-flags.js.map +0 -1
  306. package/dist/emulate/workos/routes/invitations.d.ts +0 -2
  307. package/dist/emulate/workos/routes/invitations.js +0 -122
  308. package/dist/emulate/workos/routes/invitations.js.map +0 -1
  309. package/dist/emulate/workos/routes/legacy-mfa.d.ts +0 -2
  310. package/dist/emulate/workos/routes/legacy-mfa.js +0 -75
  311. package/dist/emulate/workos/routes/legacy-mfa.js.map +0 -1
  312. package/dist/emulate/workos/routes/magic-auth.d.ts +0 -2
  313. package/dist/emulate/workos/routes/magic-auth.js +0 -32
  314. package/dist/emulate/workos/routes/magic-auth.js.map +0 -1
  315. package/dist/emulate/workos/routes/memberships.d.ts +0 -2
  316. package/dist/emulate/workos/routes/memberships.js +0 -114
  317. package/dist/emulate/workos/routes/memberships.js.map +0 -1
  318. package/dist/emulate/workos/routes/organization-domains.d.ts +0 -2
  319. package/dist/emulate/workos/routes/organization-domains.js +0 -58
  320. package/dist/emulate/workos/routes/organization-domains.js.map +0 -1
  321. package/dist/emulate/workos/routes/organizations.d.ts +0 -2
  322. package/dist/emulate/workos/routes/organizations.js +0 -131
  323. package/dist/emulate/workos/routes/organizations.js.map +0 -1
  324. package/dist/emulate/workos/routes/password-reset.d.ts +0 -2
  325. package/dist/emulate/workos/routes/password-reset.js +0 -61
  326. package/dist/emulate/workos/routes/password-reset.js.map +0 -1
  327. package/dist/emulate/workos/routes/pipes.d.ts +0 -2
  328. package/dist/emulate/workos/routes/pipes.js +0 -82
  329. package/dist/emulate/workos/routes/pipes.js.map +0 -1
  330. package/dist/emulate/workos/routes/portal.d.ts +0 -2
  331. package/dist/emulate/workos/routes/portal.js +0 -18
  332. package/dist/emulate/workos/routes/portal.js.map +0 -1
  333. package/dist/emulate/workos/routes/radar.d.ts +0 -2
  334. package/dist/emulate/workos/routes/radar.js +0 -41
  335. package/dist/emulate/workos/routes/radar.js.map +0 -1
  336. package/dist/emulate/workos/routes/sessions.d.ts +0 -2
  337. package/dist/emulate/workos/routes/sessions.js +0 -51
  338. package/dist/emulate/workos/routes/sessions.js.map +0 -1
  339. package/dist/emulate/workos/routes/sso.d.ts +0 -2
  340. package/dist/emulate/workos/routes/sso.js +0 -161
  341. package/dist/emulate/workos/routes/sso.js.map +0 -1
  342. package/dist/emulate/workos/routes/user-features.d.ts +0 -2
  343. package/dist/emulate/workos/routes/user-features.js +0 -50
  344. package/dist/emulate/workos/routes/user-features.js.map +0 -1
  345. package/dist/emulate/workos/routes/users.d.ts +0 -2
  346. package/dist/emulate/workos/routes/users.js +0 -129
  347. package/dist/emulate/workos/routes/users.js.map +0 -1
  348. package/dist/emulate/workos/routes/webhook-endpoints.d.ts +0 -2
  349. package/dist/emulate/workos/routes/webhook-endpoints.js +0 -67
  350. package/dist/emulate/workos/routes/webhook-endpoints.js.map +0 -1
  351. package/dist/emulate/workos/routes/widgets.d.ts +0 -2
  352. package/dist/emulate/workos/routes/widgets.js +0 -27
  353. package/dist/emulate/workos/routes/widgets.js.map +0 -1
  354. package/dist/emulate/workos/store.d.ts +0 -48
  355. package/dist/emulate/workos/store.js +0 -102
  356. package/dist/emulate/workos/store.js.map +0 -1
  357. package/dist/emulate/workos/webhook-signer.d.ts +0 -1
  358. package/dist/emulate/workos/webhook-signer.js +0 -8
  359. package/dist/emulate/workos/webhook-signer.js.map +0 -1
  360. package/dist/gen-routes-lib.spec.ts +0 -659
  361. package/dist/gen-routes-lib.ts +0 -647
  362. package/dist/gen-routes.ts +0 -96
  363. package/dist/utils/clack-utils.js.map +0 -1
  364. package/dist/utils/clack.d.ts +0 -5
  365. package/dist/utils/clack.js +0 -34
  366. package/dist/utils/clack.js.map +0 -1
@@ -12,9 +12,11 @@ import { fulfillsVersionRange } from './semver.js';
12
12
  import { getPackageVersion } from './package-json.js';
13
13
  import { ISSUES_URL } from '../lib/constants.js';
14
14
  import { analytics } from './analytics.js';
15
- import clack from './clack.js';
15
+ import ui from './ui.js';
16
16
  import { INTEGRATION_CONFIG } from '../lib/config.js';
17
17
  import { SPAWN_OPTS } from './platform.js';
18
+ import { isPromptAllowed } from './interaction-mode.js';
19
+ import { exitWithError, isJsonMode } from './output.js';
18
20
  /**
19
21
  * Redact sensitive info (API keys, client secrets) from a string.
20
22
  */
@@ -24,16 +26,37 @@ export function redactSensitiveInfo(str) {
24
26
  }
25
27
  export async function abort(message, status) {
26
28
  await analytics.shutdown('cancelled');
27
- clack.outro(message ?? 'Installer setup cancelled.');
29
+ ui.outro(message ?? 'Installer setup cancelled.');
28
30
  return process.exit(status ?? 1);
29
31
  }
30
32
  export async function abortIfCancelled(input, integration) {
31
- await analytics.shutdown('cancelled');
33
+ if (!isPromptAllowed()) {
34
+ // Never await `input` in non-interactive mode — awaiting a never-resolving
35
+ // prompt is exactly the hang this guard fixes. Fail fast with a structured
36
+ // error instead. Placed before analytics.shutdown('cancelled') so a
37
+ // non-interactive block is not mislabeled as a user cancel.
38
+ exitWithError({
39
+ code: 'non_interactive_prompt',
40
+ message: `This step requires interactive input${integration ? ` for ${integration}` : ''}, but the CLI is running ` +
41
+ `in a non-interactive mode (agent/CI/non-TTY). Pass the required flags (e.g. --router app|pages for Next.js) ` +
42
+ `or run in an interactive terminal.`,
43
+ recovery: {
44
+ hints: [
45
+ {
46
+ description: 'Re-run in an interactive terminal, or pass the flags that answer this prompt (e.g. --router).',
47
+ },
48
+ ],
49
+ },
50
+ });
51
+ }
32
52
  const resolvedInput = await input;
33
- if (clack.isCancel(resolvedInput) ||
34
- (typeof resolvedInput === 'symbol' && resolvedInput.description === 'clack:cancel')) {
53
+ if (ui.isCancel(resolvedInput)) {
54
+ // Flush a 'cancelled' session end ONLY on an actual cancel. Running this on
55
+ // every prompt (the previous behavior) emitted a bogus session end and added
56
+ // up to 3s of flush dead-time to each prompt on the happy path.
57
+ await analytics.shutdown('cancelled');
35
58
  const docsUrl = integration ? INTEGRATION_CONFIG[integration].docsUrl : 'https://workos.com/docs/user-management';
36
- clack.cancel(`Installer setup cancelled. You can read the documentation for ${integration ?? 'WorkOS AuthKit'} at ${chalk.cyan(docsUrl)} to continue with the setup manually.`);
59
+ ui.cancel(`Installer setup cancelled. You can read the documentation for ${integration ?? 'WorkOS AuthKit'} at ${chalk.cyan(docsUrl)} to continue with the setup manually.`);
37
60
  process.exit(0);
38
61
  }
39
62
  else {
@@ -41,12 +64,10 @@ export async function abortIfCancelled(input, integration) {
41
64
  }
42
65
  }
43
66
  export function printWelcome(options) {
44
- // eslint-disable-next-line no-console
45
- console.log('');
46
- clack.intro(chalk.inverse(` ${options.wizardName} `));
67
+ ui.intro('WorkOS', options.wizardName);
47
68
  const welcomeText = options.message ||
48
69
  `The ${options.wizardName} will help you set up WorkOS AuthKit for your application.\nThank you for using WorkOS AuthKit :)`;
49
- clack.note(welcomeText);
70
+ ui.note(welcomeText);
50
71
  }
51
72
  export async function confirmContinueIfNoOrDirtyGitRepo(options) {
52
73
  return traceStep('check-git-status', async () => {
@@ -54,7 +75,7 @@ export async function confirmContinueIfNoOrDirtyGitRepo(options) {
54
75
  // CI mode: auto-continue without git
55
76
  const continueWithoutGit = options.ci
56
77
  ? true
57
- : await abortIfCancelled(clack.confirm({
78
+ : await abortIfCancelled(ui.confirm({
58
79
  message: 'You are not inside a git repository. The installer will create and update files. Do you want to continue anyway?',
59
80
  }));
60
81
  analytics.setTag('continue-without-git', continueWithoutGit);
@@ -68,16 +89,16 @@ export async function confirmContinueIfNoOrDirtyGitRepo(options) {
68
89
  if (uncommittedOrUntrackedFiles.length) {
69
90
  // CI mode: auto-continue with dirty repo
70
91
  if (options.ci) {
71
- clack.log.info(`CI mode: continuing with uncommitted/untracked files in repo`);
92
+ ui.log.info(`CI mode: continuing with uncommitted/untracked files in repo`);
72
93
  analytics.setTag('continue-with-dirty-repo', true);
73
94
  return;
74
95
  }
75
- clack.log.warn(`You have uncommitted or untracked files in your repo:
96
+ ui.log.warn(`You have uncommitted or untracked files in your repo:
76
97
 
77
98
  ${uncommittedOrUntrackedFiles.join('\n')}
78
99
 
79
100
  The installer will create and update files.`);
80
- const continueWithDirtyRepo = await abortIfCancelled(clack.confirm({
101
+ const continueWithDirtyRepo = await abortIfCancelled(ui.confirm({
81
102
  message: 'Do you want to continue anyway?',
82
103
  }));
83
104
  analytics.setTag('continue-with-dirty-repo', continueWithDirtyRepo);
@@ -118,7 +139,7 @@ export function getUncommittedOrUntrackedFiles() {
118
139
  }
119
140
  }
120
141
  export async function askForItemSelection(items, message) {
121
- const selection = await abortIfCancelled(clack.select({
142
+ const selection = await abortIfCancelled(ui.select({
122
143
  maxItems: 12,
123
144
  message: message,
124
145
  options: items.map((item, index) => {
@@ -142,11 +163,11 @@ export async function confirmContinueIfPackageVersionNotSupported({ packageId, p
142
163
  analytics.setTag(`${packageName.toLowerCase()}-supported`, true);
143
164
  return;
144
165
  }
145
- clack.log.warn(`You have an unsupported version of ${packageName} installed:
166
+ ui.log.warn(`You have an unsupported version of ${packageName} installed:
146
167
 
147
168
  ${packageId}@${packageVersion}`);
148
- clack.note(note ?? `Please upgrade to ${acceptableVersions} if you wish to use the WorkOS AuthKit installer.`);
149
- const continueWithUnsupportedVersion = await abortIfCancelled(clack.confirm({
169
+ ui.note(note ?? `Please upgrade to ${acceptableVersions} if you wish to use the WorkOS AuthKit installer.`);
170
+ const continueWithUnsupportedVersion = await abortIfCancelled(ui.confirm({
150
171
  message: 'Do you want to continue anyway?',
151
172
  }));
152
173
  analytics.setTag(`${packageName.toLowerCase()}-continue-with-unsupported-version`, continueWithUnsupportedVersion);
@@ -181,14 +202,14 @@ export async function isReact19Installed({ installDir }) {
181
202
  export async function installPackage({ packageName, alreadyInstalled, askBeforeUpdating = true, packageNameDisplayLabel, packageManager, forceInstall = false, integration, installDir, }) {
182
203
  return traceStep('install-package', async () => {
183
204
  if (alreadyInstalled && askBeforeUpdating) {
184
- const shouldUpdatePackage = await abortIfCancelled(clack.confirm({
205
+ const shouldUpdatePackage = await abortIfCancelled(ui.confirm({
185
206
  message: `The ${chalk.bold.cyan(packageNameDisplayLabel ?? packageName)} package is already installed. Do you want to update it to the latest version?`,
186
207
  }));
187
208
  if (!shouldUpdatePackage) {
188
209
  return {};
189
210
  }
190
211
  }
191
- const sdkInstallSpinner = clack.spinner();
212
+ const sdkInstallSpinner = ui.spinner();
192
213
  const pkgManager = packageManager || (await getPackageManager({ installDir }));
193
214
  // Most packages aren't compatible with React 19 yet, skip strict peer dependency checks if needed.
194
215
  const isReact19 = await isReact19Installed({ installDir });
@@ -230,7 +251,7 @@ export async function installPackage({ packageName, alreadyInstalled, askBeforeU
230
251
  }
231
252
  catch (e) {
232
253
  sdkInstallSpinner.stop('Installation failed.');
233
- clack.log.error(`${chalk.red('Encountered the following error during installation:')}\n\n${e}\n\n${chalk.dim(`The installer has created an \`workos-installation-error-*.log\` file. If you think this issue is caused by the WorkOS AuthKit installer, create an issue on GitHub and include the log file's content:\n${ISSUES_URL}`)}`);
254
+ ui.log.error(`${chalk.red('Encountered the following error during installation:')}\n\n${e}\n\n${chalk.dim(`The installer has created an \`workos-installation-error-*.log\` file. If you think this issue is caused by the WorkOS AuthKit installer, create an issue on GitHub and include the log file's content:\n${ISSUES_URL}`)}`);
234
255
  await abort();
235
256
  }
236
257
  sdkInstallSpinner.stop(`${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk.bold.cyan(packageNameDisplayLabel ?? packageName)} with ${chalk.bold(pkgManager.label)}.`);
@@ -262,7 +283,7 @@ export async function ensurePackageIsInstalled(packageJson, packageId, packageNa
262
283
  if (options?.dashboard) {
263
284
  return;
264
285
  }
265
- const continueWithoutPackage = await abortIfCancelled(clack.confirm({
286
+ const continueWithoutPackage = await abortIfCancelled(ui.confirm({
266
287
  message: `${packageName} does not seem to be installed. Do you still want to continue?`,
267
288
  initialValue: false,
268
289
  }));
@@ -274,7 +295,7 @@ export async function ensurePackageIsInstalled(packageJson, packageId, packageNa
274
295
  }
275
296
  export async function getPackageDotJson({ installDir }) {
276
297
  const packageJsonFileContents = await fs.promises.readFile(join(installDir, 'package.json'), 'utf8').catch(() => {
277
- clack.log.error('Could not find package.json. Make sure to run the installer in the root of your app!');
298
+ ui.log.error('Could not find package.json. Make sure to run the installer in the root of your app!');
278
299
  return abort();
279
300
  });
280
301
  let packageJson = undefined;
@@ -283,7 +304,7 @@ export async function getPackageDotJson({ installDir }) {
283
304
  packageJson = JSON.parse(packageJsonFileContents);
284
305
  }
285
306
  catch {
286
- clack.log.error(`Unable to parse your ${chalk.cyan('package.json')}. Make sure it has a valid format!`);
307
+ ui.log.error(`Unable to parse your ${chalk.cyan('package.json')}. Make sure it has a valid format!`);
287
308
  await abort();
288
309
  }
289
310
  return packageJson || {};
@@ -298,7 +319,7 @@ export async function updatePackageDotJson(packageDotJson, { installDir }) {
298
319
  });
299
320
  }
300
321
  catch {
301
- clack.log.error(`Unable to update your ${chalk.cyan('package.json')}.`);
322
+ ui.log.error(`Unable to update your ${chalk.cyan('package.json')}.`);
302
323
  await abort();
303
324
  }
304
325
  }
@@ -315,7 +336,7 @@ export async function getPackageManager(options) {
315
336
  // CI mode: auto-select first detected or npm
316
337
  if (options.ci) {
317
338
  const selectedPackageManager = detectedPackageManagers.length > 0 ? detectedPackageManagers[0] : npm;
318
- clack.log.info(`CI mode: auto-selected package manager: ${selectedPackageManager.label}`);
339
+ ui.log.info(`CI mode: auto-selected package manager: ${selectedPackageManager.label}`);
319
340
  analytics.setTag('package-manager', selectedPackageManager.name);
320
341
  return selectedPackageManager;
321
342
  }
@@ -324,7 +345,7 @@ export async function getPackageManager(options) {
324
345
  const message = detectedPackageManagers.length > 1
325
346
  ? 'Multiple package managers detected. Please select one:'
326
347
  : 'Please select your package manager.';
327
- const selectedPackageManager = await abortIfCancelled(clack.select({
348
+ const selectedPackageManager = await abortIfCancelled(ui.select({
328
349
  message,
329
350
  options: pkgOptions.map((packageManager) => ({
330
351
  value: packageManager,
@@ -351,9 +372,15 @@ export async function getOrAskForWorkOSCredentials(_options, requireApiKey = tru
351
372
  let clientId = _options.clientId;
352
373
  // If credentials provided via CLI (e.g., CI mode or dashboard mode), use them
353
374
  if ((!requireApiKey || apiKey) && clientId) {
354
- // Only log in non-dashboard mode
355
- if (!_options.dashboard) {
356
- clack.log.info('Using provided WorkOS credentials');
375
+ // Say "you provided" only when the user actually supplied credentials
376
+ // (cli/manual, or an unknown source). For device/stored/env the state
377
+ // machine already announced the source accurately before this runs, so
378
+ // stay silent rather than double-announce. Gate on human output mode so
379
+ // this never pollutes JSON/NDJSON.
380
+ const source = _options.credentialSource;
381
+ const userProvided = source === 'cli' || source === 'manual' || source === undefined;
382
+ if (!_options.dashboard && !isJsonMode() && userProvided) {
383
+ ui.log.info('Using the WorkOS credentials you provided');
357
384
  }
358
385
  return { apiKey: apiKey || '', clientId };
359
386
  }
@@ -368,7 +395,7 @@ export async function getOrAskForWorkOSCredentials(_options, requireApiKey = tru
368
395
  // Use existing credentials if both are present (or API key not required)
369
396
  if (existingClientId && (!requireApiKey || existingApiKey)) {
370
397
  if (!_options.dashboard) {
371
- clack.log.success(`Found existing WorkOS credentials in .env.local`);
398
+ ui.log.success(`Found existing WorkOS credentials in .env.local`);
372
399
  }
373
400
  return {
374
401
  apiKey: existingApiKey || '',
@@ -382,10 +409,10 @@ export async function getOrAskForWorkOSCredentials(_options, requireApiKey = tru
382
409
  }
383
410
  }
384
411
  // Otherwise, prompt user for credentials
385
- clack.log.step(`Get your credentials from ${chalk.cyan('https://dashboard.workos.com')}`);
412
+ ui.log.step(`Get your credentials from ${chalk.cyan('https://dashboard.workos.com')}`);
386
413
  if (requireApiKey && !apiKey) {
387
- clack.log.info(`${chalk.dim('ℹ️ Your API key will be hidden for security and saved to .env.local')}`);
388
- apiKey = (await abortIfCancelled(clack.password({
414
+ ui.log.info(`${chalk.dim('ℹ️ Your API key will be hidden for security and saved to .env.local')}`);
415
+ apiKey = (await abortIfCancelled(ui.password({
389
416
  message: 'Enter your WorkOS API Key',
390
417
  validate: (value) => {
391
418
  if (!value)
@@ -398,10 +425,10 @@ export async function getOrAskForWorkOSCredentials(_options, requireApiKey = tru
398
425
  })));
399
426
  }
400
427
  else if (!requireApiKey) {
401
- clack.log.info(`${chalk.dim('ℹ️ Client-only SDK - API key not required')}`);
428
+ ui.log.info(`${chalk.dim('ℹ️ Client-only SDK - API key not required')}`);
402
429
  }
403
430
  if (!clientId) {
404
- clientId = (await abortIfCancelled(clack.text({
431
+ clientId = (await abortIfCancelled(ui.text({
405
432
  message: 'Enter your WorkOS Client ID',
406
433
  placeholder: 'client_...',
407
434
  validate: (value) => {
@@ -419,4 +446,4 @@ export async function getOrAskForWorkOSCredentials(_options, requireApiKey = tru
419
446
  /**
420
447
  * Fetch project data using a personal API key (for CI mode)
421
448
  */
422
- //# sourceMappingURL=clack-utils.js.map
449
+ //# sourceMappingURL=ui-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-utils.js","sourceRoot":"","sources":["../../src/utils/ui-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAuB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAuB,wBAAwB,EAAE,eAAe,EAAE,GAAG,IAAI,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAClH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OA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EAAE;gBAClB,IAAI,CAAC,KAAK;oBAAE,OAAO,uBAAuB,CAAC;gBAC3C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;oBACjC,OAAO,qCAAqC,CAAC;gBAC/C,CAAC;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC,CACH,CAAW,CAAC;IACf,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC;AAC5C,CAAC;AAED;;GAEG","sourcesContent":["import * as childProcess from 'node:child_process';\nimport * as fs from 'node:fs';\nimport * as os from 'node:os';\nimport { join } from 'node:path';\n\nimport chalk from 'chalk';\nimport { traceStep } from '../telemetry.js';\nimport { debug } from './debug.js';\nimport { parseEnvFile } from './env-parser.js';\nimport { type PackageDotJson, hasPackageInstalled } from './package-json.js';\nimport { type PackageManager, detectAllPackageManagers, packageManagers, NPM as npm } from './package-manager.js';\nimport { fulfillsVersionRange } from './semver.js';\nimport type { InstallerOptions } from './types.js';\nimport { getPackageVersion } from './package-json.js';\nimport { ISSUES_URL, type Integration } from '../lib/constants.js';\nimport { analytics } from './analytics.js';\nimport ui from './ui.js';\nimport { INTEGRATION_CONFIG } from '../lib/config.js';\nimport { SPAWN_OPTS } from './platform.js';\nimport { isPromptAllowed } from './interaction-mode.js';\nimport { exitWithError, isJsonMode } from './output.js';\n\n/**\n * Redact sensitive info (API keys, client secrets) from a string.\n */\nexport function redactSensitiveInfo(str: string): string {\n // Redact WorkOS API keys (sk_...), client secrets, etc.\n return str.replace(/sk_[a-zA-Z0-9]+/g, 'sk_***').replace(/client_[a-zA-Z0-9]{20,}/g, 'client_***');\n}\n\nexport interface CliSetupConfig {\n filename: string;\n name: string;\n gitignore: boolean;\n\n likelyAlreadyHasAuthToken(contents: string): boolean;\n tokenContent(authToken: string): string;\n\n likelyAlreadyHasOrgAndProject(contents: string): boolean;\n orgAndProjContent(org: string, project: string): string;\n\n likelyAlreadyHasUrl?(contents: string): boolean;\n urlContent?(url: string): string;\n}\n\nexport interface CliSetupConfigContent {\n authToken: string;\n org?: string;\n project?: string;\n url?: string;\n}\n\nexport async function abort(message?: string, status?: number): Promise<never> {\n await analytics.shutdown('cancelled');\n\n ui.outro(message ?? 'Installer setup cancelled.');\n return process.exit(status ?? 1);\n}\n\nexport async function abortIfCancelled<T>(\n input: T | Promise<T>,\n integration?: Integration,\n): Promise<Exclude<T, symbol>> {\n if (!isPromptAllowed()) {\n // Never await `input` in non-interactive mode — awaiting a never-resolving\n // prompt is exactly the hang this guard fixes. Fail fast with a structured\n // error instead. Placed before analytics.shutdown('cancelled') so a\n // non-interactive block is not mislabeled as a user cancel.\n exitWithError({\n code: 'non_interactive_prompt',\n message:\n `This step requires interactive input${integration ? ` for ${integration}` : ''}, but the CLI is running ` +\n `in a non-interactive mode (agent/CI/non-TTY). Pass the required flags (e.g. --router app|pages for Next.js) ` +\n `or run in an interactive terminal.`,\n recovery: {\n hints: [\n {\n description:\n 'Re-run in an interactive terminal, or pass the flags that answer this prompt (e.g. --router).',\n },\n ],\n },\n });\n }\n\n const resolvedInput = await input;\n\n if (ui.isCancel(resolvedInput)) {\n // Flush a 'cancelled' session end ONLY on an actual cancel. Running this on\n // every prompt (the previous behavior) emitted a bogus session end and added\n // up to 3s of flush dead-time to each prompt on the happy path.\n await analytics.shutdown('cancelled');\n\n const docsUrl = integration ? INTEGRATION_CONFIG[integration].docsUrl : 'https://workos.com/docs/user-management';\n\n ui.cancel(\n `Installer setup cancelled. You can read the documentation for ${\n integration ?? 'WorkOS AuthKit'\n } at ${chalk.cyan(docsUrl)} to continue with the setup manually.`,\n );\n process.exit(0);\n } else {\n return input as Exclude<T, symbol>;\n }\n}\n\nexport function printWelcome(options: { wizardName: string; message?: string }): void {\n ui.intro('WorkOS', options.wizardName);\n\n const welcomeText =\n options.message ||\n `The ${options.wizardName} will help you set up WorkOS AuthKit for your application.\\nThank you for using WorkOS AuthKit :)`;\n\n ui.note(welcomeText);\n}\n\nexport async function confirmContinueIfNoOrDirtyGitRepo(options: Pick<InstallerOptions, 'ci'>): Promise<void> {\n return traceStep('check-git-status', async () => {\n if (!isInGitRepo()) {\n // CI mode: auto-continue without git\n const continueWithoutGit = options.ci\n ? true\n : await abortIfCancelled(\n ui.confirm({\n message:\n 'You are not inside a git repository. The installer will create and update files. Do you want to continue anyway?',\n }),\n );\n\n analytics.setTag('continue-without-git', continueWithoutGit);\n\n if (!continueWithoutGit) {\n await abort(undefined, 0);\n }\n // return early to avoid checking for uncommitted files\n return;\n }\n\n const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();\n if (uncommittedOrUntrackedFiles.length) {\n // CI mode: auto-continue with dirty repo\n if (options.ci) {\n ui.log.info(`CI mode: continuing with uncommitted/untracked files in repo`);\n analytics.setTag('continue-with-dirty-repo', true);\n return;\n }\n\n ui.log.warn(\n `You have uncommitted or untracked files in your repo:\n\n${uncommittedOrUntrackedFiles.join('\\n')}\n\nThe installer will create and update files.`,\n );\n const continueWithDirtyRepo = await abortIfCancelled(\n ui.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n\n analytics.setTag('continue-with-dirty-repo', continueWithDirtyRepo);\n\n if (!continueWithDirtyRepo) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport function isInGitRepo() {\n try {\n childProcess.execSync('git rev-parse --is-inside-work-tree', {\n stdio: 'ignore',\n });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function getUncommittedOrUntrackedFiles(): string[] {\n try {\n const gitStatus = childProcess\n .execSync('git status --porcelain=v1', {\n // we only care about stdout\n stdio: ['ignore', 'pipe', 'ignore'],\n })\n .toString();\n\n const files = gitStatus\n .split(os.EOL)\n .map((line) => line.trim())\n .filter(Boolean)\n .map((f) => `- ${f.split(/\\s+/)[1]}`);\n\n return files;\n } catch {\n return [];\n }\n}\n\nexport async function askForItemSelection(items: string[], message: string): Promise<{ value: string; index: number }> {\n const selection = await abortIfCancelled<{ value: string; index: number } | symbol>(\n ui.select({\n maxItems: 12,\n message: message,\n options: items.map((item, index) => {\n return {\n value: { value: item, index: index },\n label: item,\n };\n }),\n }),\n );\n\n return selection as { value: string; index: number };\n}\n\nexport async function confirmContinueIfPackageVersionNotSupported({\n packageId,\n packageName,\n packageVersion,\n acceptableVersions,\n note,\n}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: string;\n note?: string;\n}): Promise<void> {\n return traceStep(`check-package-version`, async () => {\n analytics.setTag(`${packageName.toLowerCase()}-version`, packageVersion);\n const isSupportedVersion = fulfillsVersionRange({\n acceptableVersions,\n version: packageVersion,\n canBeLatest: true,\n });\n\n if (isSupportedVersion) {\n analytics.setTag(`${packageName.toLowerCase()}-supported`, true);\n return;\n }\n\n ui.log.warn(\n `You have an unsupported version of ${packageName} installed:\n\n ${packageId}@${packageVersion}`,\n );\n\n ui.note(note ?? `Please upgrade to ${acceptableVersions} if you wish to use the WorkOS AuthKit installer.`);\n const continueWithUnsupportedVersion = await abortIfCancelled(\n ui.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n analytics.setTag(`${packageName.toLowerCase()}-continue-with-unsupported-version`, continueWithUnsupportedVersion);\n\n if (!continueWithUnsupportedVersion) {\n await abort(undefined, 0);\n }\n });\n}\n\nexport async function isReact19Installed({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<boolean> {\n try {\n const packageJson = await getPackageDotJson({ installDir });\n const reactVersion = getPackageVersion('react', packageJson);\n\n if (!reactVersion) {\n return false;\n }\n\n return fulfillsVersionRange({\n version: reactVersion,\n acceptableVersions: '>=19.0.0',\n canBeLatest: true,\n });\n } catch {\n return false;\n }\n}\n\n/**\n * Installs or updates a package with the user's package manager.\n *\n * IMPORTANT: This function modifies the `package.json`! Be sure to re-read\n * it if you make additional modifications to it after calling this function!\n */\nexport async function installPackage({\n packageName,\n alreadyInstalled,\n askBeforeUpdating = true,\n packageNameDisplayLabel,\n packageManager,\n forceInstall = false,\n integration,\n installDir,\n}: {\n /** The string that is passed to the package manager CLI as identifier to install (e.g. `@workos-inc/authkit-nextjs`, or `@workos-inc/authkit-nextjs@^2.0.0`) */\n packageName: string;\n alreadyInstalled: boolean;\n askBeforeUpdating?: boolean;\n /** Overrides what is shown in the installation logs in place of the `packageName` option. Useful if the `packageName` is ugly */\n packageNameDisplayLabel?: string;\n packageManager?: PackageManager;\n /** Add force install flag to command to skip install precondition fails */\n forceInstall?: boolean;\n /** The integration that is being used */\n integration?: string;\n /** The directory to install the package in */\n installDir: string;\n}): Promise<{ packageManager?: PackageManager }> {\n return traceStep('install-package', async () => {\n if (alreadyInstalled && askBeforeUpdating) {\n const shouldUpdatePackage = await abortIfCancelled(\n ui.confirm({\n message: `The ${chalk.bold.cyan(\n packageNameDisplayLabel ?? packageName,\n )} package is already installed. Do you want to update it to the latest version?`,\n }),\n );\n\n if (!shouldUpdatePackage) {\n return {};\n }\n }\n\n const sdkInstallSpinner = ui.spinner();\n\n const pkgManager = packageManager || (await getPackageManager({ installDir }));\n\n // Most packages aren't compatible with React 19 yet, skip strict peer dependency checks if needed.\n const isReact19 = await isReact19Installed({ installDir });\n const legacyPeerDepsFlag = isReact19 && pkgManager.name === 'npm' ? '--legacy-peer-deps' : '';\n\n sdkInstallSpinner.start(\n `${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk.bold.cyan(\n packageNameDisplayLabel ?? packageName,\n )} with ${chalk.bold(pkgManager.label)}.`,\n );\n\n try {\n await new Promise<void>((resolve, reject) => {\n const [cmd, ...baseArgs] = pkgManager.installCommand.split(' ');\n const args = [\n ...baseArgs,\n packageName,\n ...pkgManager.flags.split(/\\s+/).filter(Boolean),\n ...(forceInstall && pkgManager.forceInstallFlag ? pkgManager.forceInstallFlag.split(/\\s+/) : []),\n ...(legacyPeerDepsFlag ? [legacyPeerDepsFlag] : []),\n ];\n const proc = childProcess.spawn(cmd, args, { cwd: installDir, ...SPAWN_OPTS });\n let stdout = '';\n let stderr = '';\n proc.stdout?.on('data', (d: Buffer) => {\n stdout += d.toString();\n });\n proc.stderr?.on('data', (d: Buffer) => {\n stderr += d.toString();\n });\n proc.on('close', (code) => {\n if (code !== 0) {\n fs.writeFileSync(\n join(process.cwd(), `workos-installation-error-${Date.now()}.log`),\n JSON.stringify({\n stdout: redactSensitiveInfo(stdout),\n stderr: redactSensitiveInfo(stderr),\n }),\n { encoding: 'utf8' },\n );\n reject(new Error(`${cmd} exited with code ${code}\\n${stderr}`));\n } else {\n resolve();\n }\n });\n proc.on('error', reject);\n });\n } catch (e) {\n sdkInstallSpinner.stop('Installation failed.');\n ui.log.error(\n `${chalk.red(\n 'Encountered the following error during installation:',\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n )}\\n\\n${e}\\n\\n${chalk.dim(\n `The installer has created an \\`workos-installation-error-*.log\\` file. If you think this issue is caused by the WorkOS AuthKit installer, create an issue on GitHub and include the log file's content:\\n${ISSUES_URL}`,\n )}`,\n );\n await abort();\n }\n\n sdkInstallSpinner.stop(\n `${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk.bold.cyan(\n packageNameDisplayLabel ?? packageName,\n )} with ${chalk.bold(pkgManager.label)}.`,\n );\n\n analytics.capture('installer interaction', {\n action: 'package installed',\n package_name: packageName,\n package_manager: pkgManager.name,\n integration,\n });\n\n return { packageManager: pkgManager };\n });\n}\n\n/**\n * Checks if @param packageId is listed as a dependency in @param packageJson.\n * If not, it will ask users if they want to continue without the package.\n *\n * Use this function to check if e.g. a the framework of the SDK is installed\n *\n * @param packageJson the package.json object\n * @param packageId the npm name of the package\n * @param packageName a human readable name of the package\n */\nexport async function ensurePackageIsInstalled(\n packageJson: PackageDotJson,\n packageId: string,\n packageName: string,\n options?: Pick<InstallerOptions, 'dashboard'>,\n): Promise<void> {\n return traceStep('ensure-package-installed', async () => {\n const installed = hasPackageInstalled(packageId, packageJson);\n\n analytics.setTag(`${packageName.toLowerCase()}-installed`, installed);\n\n if (!installed) {\n // In dashboard mode, auto-continue (integration was already detected)\n if (options?.dashboard) {\n return;\n }\n\n const continueWithoutPackage = await abortIfCancelled(\n ui.confirm({\n message: `${packageName} does not seem to be installed. Do you still want to continue?`,\n initialValue: false,\n }),\n );\n\n if (!continueWithoutPackage) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport async function getPackageDotJson({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<PackageDotJson> {\n const packageJsonFileContents = await fs.promises.readFile(join(installDir, 'package.json'), 'utf8').catch(() => {\n ui.log.error('Could not find package.json. Make sure to run the installer in the root of your app!');\n return abort();\n });\n\n let packageJson: PackageDotJson | undefined = undefined;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(packageJsonFileContents);\n } catch {\n ui.log.error(`Unable to parse your ${chalk.cyan('package.json')}. Make sure it has a valid format!`);\n\n await abort();\n }\n\n return packageJson || {};\n}\n\nexport async function updatePackageDotJson(\n packageDotJson: PackageDotJson,\n { installDir }: Pick<InstallerOptions, 'installDir'>,\n): Promise<void> {\n try {\n await fs.promises.writeFile(\n join(installDir, 'package.json'),\n // TODO: maybe figure out the original indentation\n JSON.stringify(packageDotJson, null, 2),\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n } catch {\n ui.log.error(`Unable to update your ${chalk.cyan('package.json')}.`);\n\n await abort();\n }\n}\n\nexport async function getPackageManager(\n options: Pick<InstallerOptions, 'installDir'> & { ci?: boolean },\n): Promise<PackageManager> {\n const detectedPackageManagers = detectAllPackageManagers({\n installDir: options.installDir,\n });\n\n // If exactly one package manager detected, use it automatically\n if (detectedPackageManagers.length === 1) {\n const detectedPackageManager = detectedPackageManagers[0];\n analytics.setTag('package-manager', detectedPackageManager.name);\n return detectedPackageManager;\n }\n\n // CI mode: auto-select first detected or npm\n if (options.ci) {\n const selectedPackageManager = detectedPackageManagers.length > 0 ? detectedPackageManagers[0] : npm;\n ui.log.info(`CI mode: auto-selected package manager: ${selectedPackageManager.label}`);\n analytics.setTag('package-manager', selectedPackageManager.name);\n return selectedPackageManager;\n }\n\n // If multiple or no package managers detected, prompt user to select\n const pkgOptions = detectedPackageManagers.length > 0 ? detectedPackageManagers : packageManagers;\n\n const message =\n detectedPackageManagers.length > 1\n ? 'Multiple package managers detected. Please select one:'\n : 'Please select your package manager.';\n\n const selectedPackageManager = await abortIfCancelled<PackageManager | symbol>(\n ui.select({\n message,\n options: pkgOptions.map((packageManager) => ({\n value: packageManager,\n label: packageManager.label,\n })),\n }),\n );\n\n analytics.setTag('package-manager', (selectedPackageManager as PackageManager).name);\n return selectedPackageManager as PackageManager;\n}\n\nexport function isUsingTypeScript({ installDir }: Pick<InstallerOptions, 'installDir'>) {\n try {\n return fs.existsSync(join(installDir, 'tsconfig.json'));\n } catch {\n return false;\n }\n}\n\n/**\n * Get WorkOS credentials (API Key and Client ID) from user or CLI options\n * @param requireApiKey - Whether API key is needed (false for client-only SDKs like React, Vanilla JS)\n */\nexport async function getOrAskForWorkOSCredentials(\n _options: Pick<InstallerOptions, 'ci' | 'apiKey' | 'clientId' | 'installDir' | 'dashboard' | 'credentialSource'>,\n requireApiKey: boolean = true,\n): Promise<{\n apiKey: string;\n clientId: string;\n}> {\n let apiKey = _options.apiKey;\n let clientId = _options.clientId;\n\n // If credentials provided via CLI (e.g., CI mode or dashboard mode), use them\n if ((!requireApiKey || apiKey) && clientId) {\n // Say \"you provided\" only when the user actually supplied credentials\n // (cli/manual, or an unknown source). For device/stored/env the state\n // machine already announced the source accurately before this runs, so\n // stay silent rather than double-announce. Gate on human output mode so\n // this never pollutes JSON/NDJSON.\n const source = _options.credentialSource;\n const userProvided = source === 'cli' || source === 'manual' || source === undefined;\n if (!_options.dashboard && !isJsonMode() && userProvided) {\n ui.log.info('Using the WorkOS credentials you provided');\n }\n return { apiKey: apiKey || '', clientId };\n }\n\n // Check if credentials already exist in .env.local\n const envPath = join(_options.installDir, '.env.local');\n if (fs.existsSync(envPath)) {\n try {\n const envContent = fs.readFileSync(envPath, 'utf-8');\n const envVars = parseEnvFile(envContent);\n\n const existingApiKey = envVars.WORKOS_API_KEY;\n const existingClientId = envVars.WORKOS_CLIENT_ID;\n\n // Use existing credentials if both are present (or API key not required)\n if (existingClientId && (!requireApiKey || existingApiKey)) {\n if (!_options.dashboard) {\n ui.log.success(`Found existing WorkOS credentials in .env.local`);\n }\n return {\n apiKey: existingApiKey || '',\n clientId: existingClientId,\n };\n }\n } catch (error) {\n // If we can't read/parse .env.local, just continue to prompt\n debug('Failed to read .env.local:', error);\n }\n }\n\n // Otherwise, prompt user for credentials\n ui.log.step(`Get your credentials from ${chalk.cyan('https://dashboard.workos.com')}`);\n\n if (requireApiKey && !apiKey) {\n ui.log.info(`${chalk.dim('ℹ️ Your API key will be hidden for security and saved to .env.local')}`);\n apiKey = (await abortIfCancelled(\n ui.password({\n message: 'Enter your WorkOS API Key',\n validate: (value) => {\n if (!value) return 'API Key is required';\n if (!value.startsWith('sk_')) {\n return 'API Key should start with sk_';\n }\n return undefined;\n },\n }),\n )) as string;\n } else if (!requireApiKey) {\n ui.log.info(`${chalk.dim('ℹ️ Client-only SDK - API key not required')}`);\n }\n\n if (!clientId) {\n clientId = (await abortIfCancelled(\n ui.text({\n message: 'Enter your WorkOS Client ID',\n placeholder: 'client_...',\n validate: (value) => {\n if (!value) return 'Client ID is required';\n if (!value.startsWith('client_')) {\n return 'Client ID should start with client_';\n }\n return undefined;\n },\n }),\n )) as string;\n }\n\n return { apiKey: apiKey || '', clientId };\n}\n\n/**\n * Fetch project data using a personal API key (for CI mode)\n */\n"]}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * UI facade — flat, gutterless CLI output + interactive prompts.
3
+ *
4
+ * The single import seam for all CLI UI: every module imports the default `ui`
5
+ * from this file. Output is hand-styled ANSI (diffdad-style: 2-space indent, one
6
+ * accent color, no vertical gutter). Input (confirm/select/text/password)
7
+ * delegates to `@inquirer/prompts`.
8
+ *
9
+ * The prompt adapters keep a stable call shape (`{ message, options,
10
+ * initialValue, validate }`) and the `isCancel(answer)` pattern, so the input
11
+ * engine can be swapped underneath without touching the ~30 call sites.
12
+ *
13
+ * Cancellation: @inquirer THROWS on ctrl-c / signal-abort (ExitPromptError /
14
+ * AbortPromptError) instead of returning a symbol. Each adapted prompt catches
15
+ * those and returns the `CANCEL` symbol, so `if (ui.isCancel(x))` keeps working.
16
+ */
17
+ export declare function setDashboardMode(enabled: boolean): void;
18
+ export declare function isDashboardMode(): boolean;
19
+ /**
20
+ * An inverse "badge" chip (e.g. a colored INFO / WARN label). Pure string
21
+ * helper so callers writing to stdout OR stderr can reuse it. chalk.level === 0
22
+ * (JSON mode) strips the color to plain text automatically.
23
+ */
24
+ export declare function pill(label: string, kind?: 'info' | 'warn'): string;
25
+ /**
26
+ * Branded title line, framed by blank lines. With a subtitle it renders
27
+ * `Title · subtitle` (accent-bold name, dim subtitle) — the dad-style header.
28
+ */
29
+ declare function intro(title: string, subtitle?: string): void;
30
+ /** Closing line. */
31
+ declare function outro(message?: string): void;
32
+ /** A titled section header — anchors a "moment" that owns several lines. */
33
+ declare function heading(title: string): void;
34
+ /** Multi-line indented note (body dim, framed by blank lines). */
35
+ declare function note(message: string): void;
36
+ export type RowStatusKind = 'ok' | 'muted' | 'warn';
37
+ export interface Row {
38
+ key: string;
39
+ value: string;
40
+ /** Optional trailing status word (e.g. "created", "already set", "updated"). */
41
+ status?: string;
42
+ /** How to color the status word. Defaults to 'muted'. */
43
+ statusKind?: RowStatusKind;
44
+ }
45
+ /**
46
+ * Print a set of aligned key/value rows (leading ✓, dim key padded to the
47
+ * widest key in the set, accent value, optional colored status). Alignment is a
48
+ * property of the whole set, so callers pass every row at once.
49
+ */
50
+ declare function rows(items: Row[]): void;
51
+ export interface Spinner {
52
+ start: (message?: string) => void;
53
+ message: (message: string) => void;
54
+ stop: (message?: string, code?: number) => void;
55
+ /** Halt and erase the spinner line WITHOUT printing a final status line. */
56
+ clear: () => void;
57
+ }
58
+ /** spinner: start(msg) / message(msg) / stop(msg, code). */
59
+ declare function spinner(): Spinner;
60
+ /**
61
+ * Returned by a prompt when the user cancels (ctrl-c) or a signal aborts it.
62
+ * Typed as a plain `symbol` (not `unique symbol`) to preserve the exact
63
+ * generic-inference behavior at call sites like `assertNotCancelled<T>(v: T | symbol)`.
64
+ */
65
+ export declare const CANCEL: symbol;
66
+ /** Type guard that narrows a prompt result to a non-cancel value. */
67
+ export declare function isCancel(value: unknown): value is symbol;
68
+ /** Print a cancellation line. */
69
+ export declare function cancel(message?: string): void;
70
+ /**
71
+ * Thrown when a prompt is attempted where the user cannot answer: machine
72
+ * (`--json`) output, or a non-interactive stdin (piped / no TTY). Previously
73
+ * these either corrupted machine output or hung forever waiting on a stdin that
74
+ * never delivers a keystroke. Callers that reach this generally have an upstream
75
+ * gap (they should have gated on isPromptAllowed()/isJsonMode() and offered a
76
+ * flag) — surfacing it fails fast with a clear next step instead of hanging.
77
+ */
78
+ export declare class PromptUnavailableError extends Error {
79
+ readonly reason: 'json' | 'no-tty';
80
+ constructor(reason: 'json' | 'no-tty', message: string);
81
+ }
82
+ /**
83
+ * Adapt the validate contract (return error string / Error when invalid,
84
+ * undefined when valid) to @inquirer's (return true when valid, string when not).
85
+ */
86
+ type ValidateFn = (value: string) => string | Error | undefined | void | Promise<string | Error | undefined | void>;
87
+ interface ConfirmOptions {
88
+ message: string;
89
+ initialValue?: boolean;
90
+ signal?: AbortSignal;
91
+ }
92
+ declare function confirm(options: ConfirmOptions): Promise<boolean | symbol>;
93
+ interface SelectOption<T> {
94
+ value: T;
95
+ label?: string;
96
+ hint?: string;
97
+ }
98
+ interface SelectOptions<T> {
99
+ message: string;
100
+ options: ReadonlyArray<SelectOption<T>>;
101
+ initialValue?: T;
102
+ maxItems?: number;
103
+ signal?: AbortSignal;
104
+ }
105
+ declare function select<T>(options: SelectOptions<T>): Promise<T | symbol>;
106
+ interface TextOptions {
107
+ message: string;
108
+ placeholder?: string;
109
+ defaultValue?: string;
110
+ initialValue?: string;
111
+ validate?: ValidateFn;
112
+ signal?: AbortSignal;
113
+ }
114
+ declare function text(options: TextOptions): Promise<string | symbol>;
115
+ interface PasswordOptions {
116
+ message: string;
117
+ validate?: ValidateFn;
118
+ signal?: AbortSignal;
119
+ }
120
+ declare function password(options: PasswordOptions): Promise<string | symbol>;
121
+ declare const ui: {
122
+ intro: typeof intro;
123
+ outro: typeof outro;
124
+ heading: typeof heading;
125
+ note: typeof note;
126
+ rows: typeof rows;
127
+ pill: typeof pill;
128
+ log: {
129
+ info: (m: string) => void;
130
+ step: (m: string) => void;
131
+ success: (m: string) => void;
132
+ warn: (m: string) => void;
133
+ warning: (m: string) => void;
134
+ error: (m: string) => void;
135
+ /** A muted, low-priority aside (opt-out hints, "run X later"). One dim line. */
136
+ hint: (m: string) => void;
137
+ /** A nested sub-step, indented one level under its parent line. */
138
+ detail: (m: string) => void;
139
+ };
140
+ spinner: typeof spinner;
141
+ confirm: typeof confirm;
142
+ select: typeof select;
143
+ text: typeof text;
144
+ password: typeof password;
145
+ isCancel: typeof isCancel;
146
+ cancel: typeof cancel;
147
+ };
148
+ export default ui;