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.
- package/README.md +4 -646
- package/bin/workos.js +44 -0
- package/package.json +18 -99
- package/LICENSE +0 -47
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +0 -1790
- package/dist/bin.js.map +0 -1
- package/dist/cli.config.d.ts +0 -88
- package/dist/cli.config.js +0 -110
- package/dist/cli.config.js.map +0 -1
- package/dist/commands/api/catalog.d.ts +0 -23
- package/dist/commands/api/catalog.js +0 -97
- package/dist/commands/api/catalog.js.map +0 -1
- package/dist/commands/api/format.d.ts +0 -5
- package/dist/commands/api/format.js +0 -46
- package/dist/commands/api/format.js.map +0 -1
- package/dist/commands/api/index.d.ts +0 -15
- package/dist/commands/api/index.js +0 -213
- package/dist/commands/api/index.js.map +0 -1
- package/dist/commands/api/interactive.d.ts +0 -3
- package/dist/commands/api/interactive.js +0 -133
- package/dist/commands/api/interactive.js.map +0 -1
- package/dist/commands/api/request.d.ts +0 -14
- package/dist/commands/api/request.js +0 -38
- package/dist/commands/api/request.js.map +0 -1
- package/dist/commands/api-key-mgmt.d.ts +0 -16
- package/dist/commands/api-key-mgmt.js +0 -96
- package/dist/commands/api-key-mgmt.js.map +0 -1
- package/dist/commands/audit-log.d.ts +0 -26
- package/dist/commands/audit-log.js +0 -155
- package/dist/commands/audit-log.js.map +0 -1
- package/dist/commands/auth-status.d.ts +0 -1
- package/dist/commands/auth-status.js +0 -57
- package/dist/commands/auth-status.js.map +0 -1
- package/dist/commands/claim.d.ts +0 -11
- package/dist/commands/claim.js +0 -143
- package/dist/commands/claim.js.map +0 -1
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.js +0 -54
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/connection.d.ts +0 -13
- package/dist/commands/connection.js +0 -96
- package/dist/commands/connection.js.map +0 -1
- package/dist/commands/debug-sso.d.ts +0 -1
- package/dist/commands/debug-sso.js +0 -78
- package/dist/commands/debug-sso.js.map +0 -1
- package/dist/commands/debug-sync.d.ts +0 -1
- package/dist/commands/debug-sync.js +0 -102
- package/dist/commands/debug-sync.js.map +0 -1
- package/dist/commands/debug.d.ts +0 -28
- package/dist/commands/debug.js +0 -406
- package/dist/commands/debug.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -22
- package/dist/commands/dev.js +0 -145
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/directory.d.ts +0 -27
- package/dist/commands/directory.js +0 -176
- package/dist/commands/directory.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -12
- package/dist/commands/doctor.js +0 -41
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/emulate.d.ts +0 -7
- package/dist/commands/emulate.js +0 -69
- package/dist/commands/emulate.js.map +0 -1
- package/dist/commands/env.d.ts +0 -19
- package/dist/commands/env.js +0 -303
- package/dist/commands/env.js.map +0 -1
- package/dist/commands/event.d.ts +0 -9
- package/dist/commands/event.js +0 -43
- package/dist/commands/event.js.map +0 -1
- package/dist/commands/feature-flag.d.ts +0 -12
- package/dist/commands/feature-flag.js +0 -96
- package/dist/commands/feature-flag.js.map +0 -1
- package/dist/commands/install-skill.d.ts +0 -85
- package/dist/commands/install-skill.js +0 -332
- package/dist/commands/install-skill.js.map +0 -1
- package/dist/commands/install.d.ts +0 -6
- package/dist/commands/install.js +0 -51
- package/dist/commands/install.js.map +0 -1
- package/dist/commands/invitation.d.ts +0 -19
- package/dist/commands/invitation.js +0 -94
- package/dist/commands/invitation.js.map +0 -1
- package/dist/commands/list-skills.d.ts +0 -4
- package/dist/commands/list-skills.js +0 -52
- package/dist/commands/list-skills.js.map +0 -1
- package/dist/commands/login.d.ts +0 -32
- package/dist/commands/login.js +0 -239
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -1
- package/dist/commands/logout.js +0 -17
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -14
- package/dist/commands/mcp.js +0 -99
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/membership.d.ts +0 -20
- package/dist/commands/membership.js +0 -129
- package/dist/commands/membership.js.map +0 -1
- package/dist/commands/migrations.d.ts +0 -2
- package/dist/commands/migrations.js +0 -50
- package/dist/commands/migrations.js.map +0 -1
- package/dist/commands/onboard-user.d.ts +0 -7
- package/dist/commands/onboard-user.js +0 -61
- package/dist/commands/onboard-user.js.map +0 -1
- package/dist/commands/org-domain.d.ts +0 -4
- package/dist/commands/org-domain.js +0 -45
- package/dist/commands/org-domain.js.map +0 -1
- package/dist/commands/organization.d.ts +0 -14
- package/dist/commands/organization.js +0 -103
- package/dist/commands/organization.js.map +0 -1
- package/dist/commands/permission.d.ts +0 -20
- package/dist/commands/permission.js +0 -93
- package/dist/commands/permission.js.map +0 -1
- package/dist/commands/portal.d.ts +0 -7
- package/dist/commands/portal.js +0 -26
- package/dist/commands/portal.js.map +0 -1
- package/dist/commands/role.d.ts +0 -17
- package/dist/commands/role.js +0 -122
- package/dist/commands/role.js.map +0 -1
- package/dist/commands/seed.d.ts +0 -6
- package/dist/commands/seed.js +0 -298
- package/dist/commands/seed.js.map +0 -1
- package/dist/commands/session.d.ts +0 -8
- package/dist/commands/session.js +0 -63
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/setup-org.d.ts +0 -6
- package/dist/commands/setup-org.js +0 -99
- package/dist/commands/setup-org.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -50
- package/dist/commands/setup.js +0 -237
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/telemetry.d.ts +0 -3
- package/dist/commands/telemetry.js +0 -88
- package/dist/commands/telemetry.js.map +0 -1
- package/dist/commands/uninstall-skill.d.ts +0 -11
- package/dist/commands/uninstall-skill.js +0 -117
- package/dist/commands/uninstall-skill.js.map +0 -1
- package/dist/commands/user.d.ts +0 -19
- package/dist/commands/user.js +0 -92
- package/dist/commands/user.js.map +0 -1
- package/dist/commands/vault-run.d.ts +0 -13
- package/dist/commands/vault-run.js +0 -195
- package/dist/commands/vault-run.js.map +0 -1
- package/dist/commands/vault.d.ts +0 -25
- package/dist/commands/vault.js +0 -153
- package/dist/commands/vault.js.map +0 -1
- package/dist/commands/verify-login.d.ts +0 -25
- package/dist/commands/verify-login.js +0 -158
- package/dist/commands/verify-login.js.map +0 -1
- package/dist/commands/webhook.d.ts +0 -3
- package/dist/commands/webhook.js +0 -92
- package/dist/commands/webhook.js.map +0 -1
- package/dist/craft-pre-release.sh +0 -10
- package/dist/dashboard/components/AnimatedLogo.d.ts +0 -8
- package/dist/dashboard/components/AnimatedLogo.js +0 -16
- package/dist/dashboard/components/AnimatedLogo.js.map +0 -1
- package/dist/dashboard/components/CompletionView.d.ts +0 -13
- package/dist/dashboard/components/CompletionView.js +0 -25
- package/dist/dashboard/components/CompletionView.js.map +0 -1
- package/dist/dashboard/components/ConfirmPrompt.d.ts +0 -9
- package/dist/dashboard/components/ConfirmPrompt.js +0 -25
- package/dist/dashboard/components/ConfirmPrompt.js.map +0 -1
- package/dist/dashboard/components/CredentialsForm.d.ts +0 -10
- package/dist/dashboard/components/CredentialsForm.js +0 -47
- package/dist/dashboard/components/CredentialsForm.js.map +0 -1
- package/dist/dashboard/components/Dashboard.d.ts +0 -3
- package/dist/dashboard/components/Dashboard.js +0 -100
- package/dist/dashboard/components/Dashboard.js.map +0 -1
- package/dist/dashboard/components/DashboardLayout.d.ts +0 -24
- package/dist/dashboard/components/DashboardLayout.js +0 -25
- package/dist/dashboard/components/DashboardLayout.js.map +0 -1
- package/dist/dashboard/components/DiffPanel.d.ts +0 -9
- package/dist/dashboard/components/DiffPanel.js +0 -136
- package/dist/dashboard/components/DiffPanel.js.map +0 -1
- package/dist/dashboard/components/InlinePrompt.d.ts +0 -8
- package/dist/dashboard/components/InlinePrompt.js +0 -19
- package/dist/dashboard/components/InlinePrompt.js.map +0 -1
- package/dist/dashboard/components/OutputPanel.d.ts +0 -10
- package/dist/dashboard/components/OutputPanel.js +0 -100
- package/dist/dashboard/components/OutputPanel.js.map +0 -1
- package/dist/dashboard/components/Panel.d.ts +0 -12
- package/dist/dashboard/components/Panel.js +0 -6
- package/dist/dashboard/components/Panel.js.map +0 -1
- package/dist/dashboard/components/TextInput.d.ts +0 -13
- package/dist/dashboard/components/TextInput.js +0 -57
- package/dist/dashboard/components/TextInput.js.map +0 -1
- package/dist/dashboard/components/WelcomeArt.d.ts +0 -2
- package/dist/dashboard/components/WelcomeArt.js +0 -9
- package/dist/dashboard/components/WelcomeArt.js.map +0 -1
- package/dist/dashboard/hooks/useAnimation.d.ts +0 -7
- package/dist/dashboard/hooks/useAnimation.js +0 -24
- package/dist/dashboard/hooks/useAnimation.js.map +0 -1
- package/dist/dashboard/hooks/useKeyboard.d.ts +0 -8
- package/dist/dashboard/hooks/useKeyboard.js +0 -18
- package/dist/dashboard/hooks/useKeyboard.js.map +0 -1
- package/dist/dashboard/hooks/useTerminalSize.d.ts +0 -8
- package/dist/dashboard/hooks/useTerminalSize.js +0 -23
- package/dist/dashboard/hooks/useTerminalSize.js.map +0 -1
- package/dist/dashboard/index.d.ts +0 -6
- package/dist/dashboard/index.js +0 -36
- package/dist/dashboard/index.js.map +0 -1
- package/dist/dashboard/lib/diff-utils.d.ts +0 -21
- package/dist/dashboard/lib/diff-utils.js +0 -271
- package/dist/dashboard/lib/diff-utils.js.map +0 -1
- package/dist/dashboard/lib/logo-frames.d.ts +0 -20
- package/dist/dashboard/lib/logo-frames.js +0 -109
- package/dist/dashboard/lib/logo-frames.js.map +0 -1
- package/dist/dashboard/lib/welcome-art.d.ts +0 -1
- package/dist/dashboard/lib/welcome-art.js +0 -5
- package/dist/dashboard/lib/welcome-art.js.map +0 -1
- package/dist/dashboard/types.d.ts +0 -5
- package/dist/dashboard/types.js +0 -2
- package/dist/dashboard/types.js.map +0 -1
- package/dist/doctor/agent-prompt.d.ts +0 -10
- package/dist/doctor/agent-prompt.js +0 -190
- package/dist/doctor/agent-prompt.js.map +0 -1
- package/dist/doctor/checks/ai-analysis.d.ts +0 -9
- package/dist/doctor/checks/ai-analysis.js +0 -124
- package/dist/doctor/checks/ai-analysis.js.map +0 -1
- package/dist/doctor/checks/auth-patterns.d.ts +0 -2
- package/dist/doctor/checks/auth-patterns.js +0 -569
- package/dist/doctor/checks/auth-patterns.js.map +0 -1
- package/dist/doctor/checks/connectivity.d.ts +0 -2
- package/dist/doctor/checks/connectivity.js +0 -35
- package/dist/doctor/checks/connectivity.js.map +0 -1
- package/dist/doctor/checks/dashboard.d.ts +0 -3
- package/dist/doctor/checks/dashboard.js +0 -123
- package/dist/doctor/checks/dashboard.js.map +0 -1
- package/dist/doctor/checks/environment.d.ts +0 -2
- package/dist/doctor/checks/environment.js +0 -86
- package/dist/doctor/checks/environment.js.map +0 -1
- package/dist/doctor/checks/framework.d.ts +0 -2
- package/dist/doctor/checks/framework.js +0 -94
- package/dist/doctor/checks/framework.js.map +0 -1
- package/dist/doctor/checks/host-execution.d.ts +0 -2
- package/dist/doctor/checks/host-execution.js +0 -21
- package/dist/doctor/checks/host-execution.js.map +0 -1
- package/dist/doctor/checks/language.d.ts +0 -6
- package/dist/doctor/checks/language.js +0 -104
- package/dist/doctor/checks/language.js.map +0 -1
- package/dist/doctor/checks/mcp.d.ts +0 -15
- package/dist/doctor/checks/mcp.js +0 -34
- package/dist/doctor/checks/mcp.js.map +0 -1
- package/dist/doctor/checks/runtime.d.ts +0 -2
- package/dist/doctor/checks/runtime.js +0 -20
- package/dist/doctor/checks/runtime.js.map +0 -1
- package/dist/doctor/checks/sdk.d.ts +0 -2
- package/dist/doctor/checks/sdk.js +0 -192
- package/dist/doctor/checks/sdk.js.map +0 -1
- package/dist/doctor/checks/skills.d.ts +0 -9
- package/dist/doctor/checks/skills.js +0 -84
- package/dist/doctor/checks/skills.js.map +0 -1
- package/dist/doctor/clipboard.d.ts +0 -1
- package/dist/doctor/clipboard.js +0 -43
- package/dist/doctor/clipboard.js.map +0 -1
- package/dist/doctor/index.d.ts +0 -26
- package/dist/doctor/index.js +0 -182
- package/dist/doctor/index.js.map +0 -1
- package/dist/doctor/issues.d.ts +0 -63
- package/dist/doctor/issues.js +0 -199
- package/dist/doctor/issues.js.map +0 -1
- package/dist/doctor/json-output.d.ts +0 -2
- package/dist/doctor/json-output.js +0 -4
- package/dist/doctor/json-output.js.map +0 -1
- package/dist/doctor/output.d.ts +0 -7
- package/dist/doctor/output.js +0 -289
- package/dist/doctor/output.js.map +0 -1
- package/dist/doctor/types.d.ts +0 -203
- package/dist/doctor/types.js +0 -2
- package/dist/doctor/types.js.map +0 -1
- package/dist/integrations/dotnet/index.d.ts +0 -8
- package/dist/integrations/dotnet/index.js +0 -170
- package/dist/integrations/dotnet/index.js.map +0 -1
- package/dist/integrations/elixir/index.d.ts +0 -8
- package/dist/integrations/elixir/index.js +0 -146
- package/dist/integrations/elixir/index.js.map +0 -1
- package/dist/integrations/go/index.d.ts +0 -11
- package/dist/integrations/go/index.js +0 -212
- package/dist/integrations/go/index.js.map +0 -1
- package/dist/integrations/kotlin/index.d.ts +0 -4
- package/dist/integrations/kotlin/index.js +0 -78
- package/dist/integrations/kotlin/index.js.map +0 -1
- package/dist/integrations/nextjs/index.d.ts +0 -4
- package/dist/integrations/nextjs/index.js +0 -93
- package/dist/integrations/nextjs/index.js.map +0 -1
- package/dist/integrations/nextjs/utils.d.ts +0 -8
- package/dist/integrations/nextjs/utils.js +0 -68
- package/dist/integrations/nextjs/utils.js.map +0 -1
- package/dist/integrations/node/index.d.ts +0 -4
- package/dist/integrations/node/index.js +0 -52
- package/dist/integrations/node/index.js.map +0 -1
- package/dist/integrations/php/index.d.ts +0 -4
- package/dist/integrations/php/index.js +0 -51
- package/dist/integrations/php/index.js.map +0 -1
- package/dist/integrations/php-laravel/index.d.ts +0 -4
- package/dist/integrations/php-laravel/index.js +0 -51
- package/dist/integrations/php-laravel/index.js.map +0 -1
- package/dist/integrations/python/index.d.ts +0 -9
- package/dist/integrations/python/index.js +0 -249
- package/dist/integrations/python/index.js.map +0 -1
- package/dist/integrations/react/index.d.ts +0 -4
- package/dist/integrations/react/index.js +0 -49
- package/dist/integrations/react/index.js.map +0 -1
- package/dist/integrations/react-router/index.d.ts +0 -4
- package/dist/integrations/react-router/index.js +0 -94
- package/dist/integrations/react-router/index.js.map +0 -1
- package/dist/integrations/react-router/utils.d.ts +0 -10
- package/dist/integrations/react-router/utils.js +0 -162
- package/dist/integrations/react-router/utils.js.map +0 -1
- package/dist/integrations/ruby/index.d.ts +0 -8
- package/dist/integrations/ruby/index.js +0 -137
- package/dist/integrations/ruby/index.js.map +0 -1
- package/dist/integrations/sveltekit/index.d.ts +0 -4
- package/dist/integrations/sveltekit/index.js +0 -50
- package/dist/integrations/sveltekit/index.js.map +0 -1
- package/dist/integrations/tanstack-start/index.d.ts +0 -4
- package/dist/integrations/tanstack-start/index.js +0 -51
- package/dist/integrations/tanstack-start/index.js.map +0 -1
- package/dist/integrations/vanilla-js/index.d.ts +0 -4
- package/dist/integrations/vanilla-js/index.js +0 -49
- package/dist/integrations/vanilla-js/index.js.map +0 -1
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.d.ts +0 -7
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.js +0 -12
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.js.map +0 -1
- package/dist/lib/adapters/cli-adapter.d.ts +0 -113
- package/dist/lib/adapters/cli-adapter.js +0 -641
- package/dist/lib/adapters/cli-adapter.js.map +0 -1
- package/dist/lib/adapters/dashboard-adapter.d.ts +0 -34
- package/dist/lib/adapters/dashboard-adapter.js +0 -121
- package/dist/lib/adapters/dashboard-adapter.js.map +0 -1
- package/dist/lib/adapters/headless-adapter.d.ts +0 -80
- package/dist/lib/adapters/headless-adapter.js +0 -347
- package/dist/lib/adapters/headless-adapter.js.map +0 -1
- package/dist/lib/adapters/index.d.ts +0 -4
- package/dist/lib/adapters/index.js +0 -4
- package/dist/lib/adapters/index.js.map +0 -1
- package/dist/lib/adapters/types.d.ts +0 -41
- package/dist/lib/adapters/types.js +0 -2
- package/dist/lib/adapters/types.js.map +0 -1
- package/dist/lib/agent-interface.d.ts +0 -84
- package/dist/lib/agent-interface.js +0 -840
- package/dist/lib/agent-interface.js.map +0 -1
- package/dist/lib/agent-runner.d.ts +0 -9
- package/dist/lib/agent-runner.js +0 -261
- package/dist/lib/agent-runner.js.map +0 -1
- package/dist/lib/ai-content.d.ts +0 -14
- package/dist/lib/ai-content.js +0 -131
- package/dist/lib/ai-content.js.map +0 -1
- package/dist/lib/api-error-handler.d.ts +0 -18
- package/dist/lib/api-error-handler.js +0 -76
- package/dist/lib/api-error-handler.js.map +0 -1
- package/dist/lib/api-key.d.ts +0 -14
- package/dist/lib/api-key.js +0 -37
- package/dist/lib/api-key.js.map +0 -1
- package/dist/lib/api.d.ts +0 -25
- package/dist/lib/api.js +0 -120
- package/dist/lib/api.js.map +0 -1
- package/dist/lib/background-refresh.d.ts +0 -29
- package/dist/lib/background-refresh.js +0 -95
- package/dist/lib/background-refresh.js.map +0 -1
- package/dist/lib/command-aliases.d.ts +0 -8
- package/dist/lib/command-aliases.js +0 -12
- package/dist/lib/command-aliases.js.map +0 -1
- package/dist/lib/completion-data.d.ts +0 -33
- package/dist/lib/completion-data.js +0 -33
- package/dist/lib/completion-data.js.map +0 -1
- package/dist/lib/config-store.d.ts +0 -63
- package/dist/lib/config-store.js +0 -293
- package/dist/lib/config-store.js.map +0 -1
- package/dist/lib/config.d.ts +0 -34
- package/dist/lib/config.js +0 -37
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -51
- package/dist/lib/constants.js +0 -50
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/credential-discovery.d.ts +0 -42
- package/dist/lib/credential-discovery.js +0 -100
- package/dist/lib/credential-discovery.js.map +0 -1
- package/dist/lib/credential-proxy.d.ts +0 -45
- package/dist/lib/credential-proxy.js +0 -364
- package/dist/lib/credential-proxy.js.map +0 -1
- package/dist/lib/credential-store.d.ts +0 -32
- package/dist/lib/credential-store.js +0 -236
- package/dist/lib/credential-store.js.map +0 -1
- package/dist/lib/credentials.d.ts +0 -13
- package/dist/lib/credentials.js +0 -34
- package/dist/lib/credentials.js.map +0 -1
- package/dist/lib/dev-command.d.ts +0 -26
- package/dist/lib/dev-command.js +0 -129
- package/dist/lib/dev-command.js.map +0 -1
- package/dist/lib/device-auth.d.ts +0 -48
- package/dist/lib/device-auth.js +0 -176
- package/dist/lib/device-auth.js.map +0 -1
- package/dist/lib/device-id.d.ts +0 -25
- package/dist/lib/device-id.js +0 -102
- package/dist/lib/device-id.js.map +0 -1
- package/dist/lib/ensure-auth.d.ts +0 -12
- package/dist/lib/ensure-auth.js +0 -111
- package/dist/lib/ensure-auth.js.map +0 -1
- package/dist/lib/env-writer.d.ts +0 -25
- package/dist/lib/env-writer.js +0 -90
- package/dist/lib/env-writer.js.map +0 -1
- package/dist/lib/events.d.ts +0 -248
- package/dist/lib/events.js +0 -19
- package/dist/lib/events.js.map +0 -1
- package/dist/lib/framework-config.d.ts +0 -133
- package/dist/lib/framework-config.js +0 -11
- package/dist/lib/framework-config.js.map +0 -1
- package/dist/lib/helper-functions.d.ts +0 -1
- package/dist/lib/helper-functions.js +0 -2
- package/dist/lib/helper-functions.js.map +0 -1
- package/dist/lib/host-probe.d.ts +0 -28
- package/dist/lib/host-probe.js +0 -154
- package/dist/lib/host-probe.js.map +0 -1
- package/dist/lib/installer-core.d.ts +0 -569
- package/dist/lib/installer-core.js +0 -1134
- package/dist/lib/installer-core.js.map +0 -1
- package/dist/lib/installer-core.types.d.ts +0 -162
- package/dist/lib/installer-core.types.js +0 -2
- package/dist/lib/installer-core.types.js.map +0 -1
- package/dist/lib/mcp-clients.d.ts +0 -45
- package/dist/lib/mcp-clients.js +0 -297
- package/dist/lib/mcp-clients.js.map +0 -1
- package/dist/lib/port-detection.d.ts +0 -7
- package/dist/lib/port-detection.js +0 -244
- package/dist/lib/port-detection.js.map +0 -1
- package/dist/lib/post-install.d.ts +0 -8
- package/dist/lib/post-install.js +0 -51
- package/dist/lib/post-install.js.map +0 -1
- package/dist/lib/preferences.d.ts +0 -143
- package/dist/lib/preferences.js +0 -227
- package/dist/lib/preferences.js.map +0 -1
- package/dist/lib/progress-tracker.d.ts +0 -22
- package/dist/lib/progress-tracker.js +0 -47
- package/dist/lib/progress-tracker.js.map +0 -1
- package/dist/lib/registry.d.ts +0 -42
- package/dist/lib/registry.js +0 -96
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/resolve-install-credentials.d.ts +0 -11
- package/dist/lib/resolve-install-credentials.js +0 -53
- package/dist/lib/resolve-install-credentials.js.map +0 -1
- package/dist/lib/run-with-core.d.ts +0 -7
- package/dist/lib/run-with-core.js +0 -559
- package/dist/lib/run-with-core.js.map +0 -1
- package/dist/lib/safe-tools.d.ts +0 -2
- package/dist/lib/safe-tools.js +0 -212
- package/dist/lib/safe-tools.js.map +0 -1
- package/dist/lib/scaffold/index.d.ts +0 -1
- package/dist/lib/scaffold/index.js +0 -2
- package/dist/lib/scaffold/index.js.map +0 -1
- package/dist/lib/scaffold/scaffold.d.ts +0 -66
- package/dist/lib/scaffold/scaffold.js +0 -156
- package/dist/lib/scaffold/scaffold.js.map +0 -1
- package/dist/lib/settings.d.ts +0 -60
- package/dist/lib/settings.js +0 -31
- package/dist/lib/settings.js.map +0 -1
- package/dist/lib/staging-api.d.ts +0 -22
- package/dist/lib/staging-api.js +0 -74
- package/dist/lib/staging-api.js.map +0 -1
- package/dist/lib/startup-notice-gate.d.ts +0 -21
- package/dist/lib/startup-notice-gate.js +0 -29
- package/dist/lib/startup-notice-gate.js.map +0 -1
- package/dist/lib/telemetry-notice.d.ts +0 -25
- package/dist/lib/telemetry-notice.js +0 -58
- package/dist/lib/telemetry-notice.js.map +0 -1
- package/dist/lib/token-refresh-client.d.ts +0 -23
- package/dist/lib/token-refresh-client.js +0 -89
- package/dist/lib/token-refresh-client.js.map +0 -1
- package/dist/lib/token-refresh.d.ts +0 -12
- package/dist/lib/token-refresh.js +0 -27
- package/dist/lib/token-refresh.js.map +0 -1
- package/dist/lib/unclaimed-env-api.d.ts +0 -42
- package/dist/lib/unclaimed-env-api.js +0 -139
- package/dist/lib/unclaimed-env-api.js.map +0 -1
- package/dist/lib/unclaimed-env-provision.d.ts +0 -24
- package/dist/lib/unclaimed-env-provision.js +0 -80
- package/dist/lib/unclaimed-env-provision.js.map +0 -1
- package/dist/lib/unclaimed-warning.d.ts +0 -15
- package/dist/lib/unclaimed-warning.js +0 -78
- package/dist/lib/unclaimed-warning.js.map +0 -1
- package/dist/lib/validation/build-validator.d.ts +0 -21
- package/dist/lib/validation/build-validator.js +0 -153
- package/dist/lib/validation/build-validator.js.map +0 -1
- package/dist/lib/validation/index.d.ts +0 -4
- package/dist/lib/validation/index.js +0 -4
- package/dist/lib/validation/index.js.map +0 -1
- package/dist/lib/validation/quick-checks.d.ts +0 -19
- package/dist/lib/validation/quick-checks.js +0 -192
- package/dist/lib/validation/quick-checks.js.map +0 -1
- package/dist/lib/validation/security-checks.d.ts +0 -35
- package/dist/lib/validation/security-checks.js +0 -106
- package/dist/lib/validation/security-checks.js.map +0 -1
- package/dist/lib/validation/types.d.ts +0 -56
- package/dist/lib/validation/types.js +0 -2
- package/dist/lib/validation/types.js.map +0 -1
- package/dist/lib/validation/validator.d.ts +0 -13
- package/dist/lib/validation/validator.js +0 -711
- package/dist/lib/validation/validator.js.map +0 -1
- package/dist/lib/version-check.d.ts +0 -6
- package/dist/lib/version-check.js +0 -46
- package/dist/lib/version-check.js.map +0 -1
- package/dist/lib/workos-api.d.ts +0 -30
- package/dist/lib/workos-api.js +0 -69
- package/dist/lib/workos-api.js.map +0 -1
- package/dist/lib/workos-client.d.ts +0 -58
- package/dist/lib/workos-client.js +0 -140
- package/dist/lib/workos-client.js.map +0 -1
- package/dist/lib/workos-management.d.ts +0 -32
- package/dist/lib/workos-management.js +0 -149
- package/dist/lib/workos-management.js.map +0 -1
- package/dist/nextjs/nextjs-installer-agent.d.ts +0 -5
- package/dist/nextjs/nextjs-installer-agent.js +0 -6
- package/dist/nextjs/nextjs-installer-agent.js.map +0 -1
- package/dist/nextjs/utils.d.ts +0 -4
- package/dist/nextjs/utils.js +0 -5
- package/dist/nextjs/utils.js.map +0 -1
- package/dist/react/react-installer-agent.d.ts +0 -4
- package/dist/react/react-installer-agent.js +0 -5
- package/dist/react/react-installer-agent.js.map +0 -1
- package/dist/react-router/react-router-installer-agent.d.ts +0 -4
- package/dist/react-router/react-router-installer-agent.js +0 -5
- package/dist/react-router/react-router-installer-agent.js.map +0 -1
- package/dist/react-router/utils.d.ts +0 -4
- package/dist/react-router/utils.js +0 -5
- package/dist/react-router/utils.js.map +0 -1
- package/dist/run.d.ts +0 -33
- package/dist/run.js +0 -58
- package/dist/run.js.map +0 -1
- package/dist/smoke-test.ts +0 -881
- package/dist/steps/add-or-update-environment-variables.d.ts +0 -10
- package/dist/steps/add-or-update-environment-variables.js +0 -155
- package/dist/steps/add-or-update-environment-variables.js.map +0 -1
- package/dist/steps/index.d.ts +0 -3
- package/dist/steps/index.js +0 -4
- package/dist/steps/index.js.map +0 -1
- package/dist/steps/run-prettier.d.ts +0 -5
- package/dist/steps/run-prettier.js +0 -50
- package/dist/steps/run-prettier.js.map +0 -1
- package/dist/steps/upload-environment-variables/EnvironmentProvider.d.ts +0 -8
- package/dist/steps/upload-environment-variables/EnvironmentProvider.js +0 -7
- package/dist/steps/upload-environment-variables/EnvironmentProvider.js.map +0 -1
- package/dist/steps/upload-environment-variables/index.d.ts +0 -6
- package/dist/steps/upload-environment-variables/index.js +0 -69
- package/dist/steps/upload-environment-variables/index.js.map +0 -1
- package/dist/steps/upload-environment-variables/providers/vercel.d.ts +0 -14
- package/dist/steps/upload-environment-variables/providers/vercel.js +0 -107
- package/dist/steps/upload-environment-variables/providers/vercel.js.map +0 -1
- package/dist/tanstack-start/tanstack-start-installer-agent.d.ts +0 -4
- package/dist/tanstack-start/tanstack-start-installer-agent.js +0 -5
- package/dist/tanstack-start/tanstack-start-installer-agent.js.map +0 -1
- package/dist/telemetry.d.ts +0 -2
- package/dist/telemetry.js +0 -29
- package/dist/telemetry.js.map +0 -1
- package/dist/test/force-insecure-storage.d.ts +0 -1
- package/dist/test/force-insecure-storage.js +0 -9
- package/dist/test/force-insecure-storage.js.map +0 -1
- package/dist/test/setup.d.ts +0 -1
- package/dist/test/setup.js +0 -38
- package/dist/test/setup.js.map +0 -1
- package/dist/utils/analytics.d.ts +0 -66
- package/dist/utils/analytics.js +0 -330
- package/dist/utils/analytics.js.map +0 -1
- package/dist/utils/bash.d.ts +0 -2
- package/dist/utils/bash.js +0 -17
- package/dist/utils/bash.js.map +0 -1
- package/dist/utils/box.d.ts +0 -9
- package/dist/utils/box.js +0 -15
- package/dist/utils/box.js.map +0 -1
- package/dist/utils/cli-exit.d.ts +0 -15
- package/dist/utils/cli-exit.js +0 -11
- package/dist/utils/cli-exit.js.map +0 -1
- package/dist/utils/cli-symbols.d.ts +0 -44
- package/dist/utils/cli-symbols.js +0 -58
- package/dist/utils/cli-symbols.js.map +0 -1
- package/dist/utils/command-invocation.d.ts +0 -10
- package/dist/utils/command-invocation.js +0 -26
- package/dist/utils/command-invocation.js.map +0 -1
- package/dist/utils/command-telemetry.d.ts +0 -17
- package/dist/utils/command-telemetry.js +0 -67
- package/dist/utils/command-telemetry.js.map +0 -1
- package/dist/utils/crash-reporter.d.ts +0 -13
- package/dist/utils/crash-reporter.js +0 -91
- package/dist/utils/crash-reporter.js.map +0 -1
- package/dist/utils/debug.d.ts +0 -9
- package/dist/utils/debug.js +0 -105
- package/dist/utils/debug.js.map +0 -1
- package/dist/utils/env-parser.d.ts +0 -5
- package/dist/utils/env-parser.js +0 -18
- package/dist/utils/env-parser.js.map +0 -1
- package/dist/utils/environment.d.ts +0 -10
- package/dist/utils/environment.js +0 -69
- package/dist/utils/environment.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -3
- package/dist/utils/errors.js +0 -7
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/exec-file.d.ts +0 -15
- package/dist/utils/exec-file.js +0 -39
- package/dist/utils/exec-file.js.map +0 -1
- package/dist/utils/exit-codes.d.ts +0 -31
- package/dist/utils/exit-codes.js +0 -69
- package/dist/utils/exit-codes.js.map +0 -1
- package/dist/utils/git-utils.d.ts +0 -23
- package/dist/utils/git-utils.js +0 -86
- package/dist/utils/git-utils.js.map +0 -1
- package/dist/utils/help-json.d.ts +0 -58
- package/dist/utils/help-json.js +0 -1577
- package/dist/utils/help-json.js.map +0 -1
- package/dist/utils/interaction-mode.d.ts +0 -25
- package/dist/utils/interaction-mode.js +0 -99
- package/dist/utils/interaction-mode.js.map +0 -1
- package/dist/utils/lock-art.d.ts +0 -4
- package/dist/utils/lock-art.js +0 -73
- package/dist/utils/lock-art.js.map +0 -1
- package/dist/utils/logging.d.ts +0 -9
- package/dist/utils/logging.js +0 -36
- package/dist/utils/logging.js.map +0 -1
- package/dist/utils/ndjson.d.ts +0 -16
- package/dist/utils/ndjson.js +0 -18
- package/dist/utils/ndjson.js.map +0 -1
- package/dist/utils/output.d.ts +0 -60
- package/dist/utils/output.js +0 -124
- package/dist/utils/output.js.map +0 -1
- package/dist/utils/package-json.d.ts +0 -26
- package/dist/utils/package-json.js +0 -32
- package/dist/utils/package-json.js.map +0 -1
- package/dist/utils/package-manager.d.ts +0 -21
- package/dist/utils/package-manager.js +0 -166
- package/dist/utils/package-manager.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -5
- package/dist/utils/paths.js +0 -18
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/platform.d.ts +0 -8
- package/dist/utils/platform.js +0 -7
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/recovery-hints.d.ts +0 -42
- package/dist/utils/recovery-hints.js +0 -92
- package/dist/utils/recovery-hints.js.map +0 -1
- package/dist/utils/redact.d.ts +0 -5
- package/dist/utils/redact.js +0 -29
- package/dist/utils/redact.js.map +0 -1
- package/dist/utils/register-subcommand.d.ts +0 -10
- package/dist/utils/register-subcommand.js +0 -33
- package/dist/utils/register-subcommand.js.map +0 -1
- package/dist/utils/semver.d.ts +0 -10
- package/dist/utils/semver.js +0 -43
- package/dist/utils/semver.js.map +0 -1
- package/dist/utils/string.d.ts +0 -1
- package/dist/utils/string.js +0 -6
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/summary-box.d.ts +0 -25
- package/dist/utils/summary-box.js +0 -211
- package/dist/utils/summary-box.js.map +0 -1
- package/dist/utils/table.d.ts +0 -5
- package/dist/utils/table.js +0 -18
- package/dist/utils/table.js.map +0 -1
- package/dist/utils/telemetry-client.d.ts +0 -43
- package/dist/utils/telemetry-client.js +0 -171
- package/dist/utils/telemetry-client.js.map +0 -1
- package/dist/utils/telemetry-store-forward.d.ts +0 -11
- package/dist/utils/telemetry-store-forward.js +0 -94
- package/dist/utils/telemetry-store-forward.js.map +0 -1
- package/dist/utils/telemetry-types.d.ts +0 -100
- package/dist/utils/telemetry-types.js +0 -6
- package/dist/utils/telemetry-types.js.map +0 -1
- package/dist/utils/types.d.ts +0 -123
- package/dist/utils/types.js +0 -2
- package/dist/utils/types.js.map +0 -1
- package/dist/utils/ui-utils.d.ts +0 -97
- package/dist/utils/ui-utils.js +0 -449
- package/dist/utils/ui-utils.js.map +0 -1
- package/dist/utils/ui.d.ts +0 -148
- package/dist/utils/ui.js +0 -368
- package/dist/utils/ui.js.map +0 -1
- package/dist/utils/urls.d.ts +0 -13
- package/dist/utils/urls.js +0 -14
- package/dist/utils/urls.js.map +0 -1
- package/dist/utils/vendor/is-unicorn-supported.d.ts +0 -1
- package/dist/utils/vendor/is-unicorn-supported.js +0 -21
- package/dist/utils/vendor/is-unicorn-supported.js.map +0 -1
- package/dist/vanilla-js/vanilla-js-installer-agent.d.ts +0 -4
- package/dist/vanilla-js/vanilla-js-installer-agent.js +0 -5
- package/dist/vanilla-js/vanilla-js-installer-agent.js.map +0 -1
|
@@ -1,711 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'fs/promises';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import fg from 'fast-glob';
|
|
5
|
-
import { runBuildValidation } from './build-validator.js';
|
|
6
|
-
import { detectPort } from '../port-detection.js';
|
|
7
|
-
export async function validateInstallation(framework, projectDir, options = {}) {
|
|
8
|
-
const startTime = Date.now();
|
|
9
|
-
const issues = [];
|
|
10
|
-
// Load rules for framework (with optional variant)
|
|
11
|
-
const rules = await loadRules(framework, options.variant);
|
|
12
|
-
if (!rules) {
|
|
13
|
-
return {
|
|
14
|
-
passed: true,
|
|
15
|
-
framework,
|
|
16
|
-
issues: [],
|
|
17
|
-
durationMs: Date.now() - startTime,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
// Run validations
|
|
21
|
-
issues.push(...(await validatePackages(rules, projectDir)));
|
|
22
|
-
issues.push(...(await validateEnvVars(rules, projectDir)));
|
|
23
|
-
issues.push(...(await validateFiles(rules, projectDir)));
|
|
24
|
-
// Run framework-specific cross-validations
|
|
25
|
-
issues.push(...(await validateFrameworkSpecific(framework, projectDir)));
|
|
26
|
-
// Run build validation if enabled
|
|
27
|
-
if (options.runBuild !== false) {
|
|
28
|
-
const buildResult = await runBuildValidation(projectDir);
|
|
29
|
-
issues.push(...buildResult.issues);
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
passed: issues.filter((i) => i.severity === 'error').length === 0,
|
|
33
|
-
framework,
|
|
34
|
-
issues,
|
|
35
|
-
durationMs: Date.now() - startTime,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
async function loadRules(framework, variant) {
|
|
39
|
-
const rulesPath = new URL(`./rules/${framework}.json`, import.meta.url);
|
|
40
|
-
try {
|
|
41
|
-
const content = await readFile(rulesPath, 'utf-8');
|
|
42
|
-
const rules = JSON.parse(content);
|
|
43
|
-
// Merge variant rules if specified
|
|
44
|
-
if (variant && rules.variants?.[variant]) {
|
|
45
|
-
const variantRules = rules.variants[variant];
|
|
46
|
-
return {
|
|
47
|
-
...rules,
|
|
48
|
-
files: [...rules.files, ...(variantRules.files || [])],
|
|
49
|
-
packages: [...rules.packages, ...(variantRules.packages || [])],
|
|
50
|
-
envVars: [...rules.envVars, ...(variantRules.envVars || [])],
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return rules;
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
return null; // No rules for this framework yet
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export async function validatePackages(rules, projectDir) {
|
|
60
|
-
const issues = [];
|
|
61
|
-
const pkgPath = join(projectDir, 'package.json');
|
|
62
|
-
if (!existsSync(pkgPath))
|
|
63
|
-
return issues;
|
|
64
|
-
let pkg;
|
|
65
|
-
try {
|
|
66
|
-
pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
|
67
|
-
}
|
|
68
|
-
catch {
|
|
69
|
-
// Malformed package.json - skip package validation
|
|
70
|
-
return issues;
|
|
71
|
-
}
|
|
72
|
-
const deps = (pkg.dependencies || {});
|
|
73
|
-
const devDeps = (pkg.devDependencies || {});
|
|
74
|
-
const allDeps = { ...devDeps, ...deps };
|
|
75
|
-
for (const rule of rules.packages) {
|
|
76
|
-
const location = rule.location || 'any';
|
|
77
|
-
const searchIn = location === 'any' ? allDeps : location === 'dependencies' ? deps : devDeps;
|
|
78
|
-
if (!searchIn[rule.name]) {
|
|
79
|
-
issues.push({
|
|
80
|
-
type: 'package',
|
|
81
|
-
severity: 'error',
|
|
82
|
-
message: `Missing package: ${rule.name}`,
|
|
83
|
-
hint: `Run: npm install ${rule.name}`,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return issues;
|
|
88
|
-
}
|
|
89
|
-
export async function validateEnvVars(rules, projectDir) {
|
|
90
|
-
const issues = [];
|
|
91
|
-
const envPath = join(projectDir, '.env.local');
|
|
92
|
-
let envContent = '';
|
|
93
|
-
try {
|
|
94
|
-
envContent = await readFile(envPath, 'utf-8');
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
if (rules.envVars.length > 0) {
|
|
98
|
-
issues.push({
|
|
99
|
-
type: 'env',
|
|
100
|
-
severity: 'error',
|
|
101
|
-
message: 'Missing .env.local file',
|
|
102
|
-
hint: 'Create .env.local with required environment variables',
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return issues;
|
|
106
|
-
}
|
|
107
|
-
for (const rule of rules.envVars) {
|
|
108
|
-
// Check primary name and any alternates
|
|
109
|
-
const varsToCheck = [rule.name, ...(rule.alternates || [])];
|
|
110
|
-
const found = varsToCheck.some((varName) => {
|
|
111
|
-
const pattern = new RegExp(`^${varName}=.+`, 'm');
|
|
112
|
-
return pattern.test(envContent);
|
|
113
|
-
});
|
|
114
|
-
if (!found) {
|
|
115
|
-
const hint = rule.alternates
|
|
116
|
-
? `Add ${rule.name} (or one of: ${rule.alternates.join(', ')}) to .env.local`
|
|
117
|
-
: `Add ${rule.name}=your_value to .env.local`;
|
|
118
|
-
issues.push({
|
|
119
|
-
type: 'env',
|
|
120
|
-
severity: rule.required === false ? 'warning' : 'error',
|
|
121
|
-
message: `Missing environment variable: ${rule.name}`,
|
|
122
|
-
hint,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return issues;
|
|
127
|
-
}
|
|
128
|
-
export async function validateFiles(rules, projectDir) {
|
|
129
|
-
const issues = [];
|
|
130
|
-
for (const rule of rules.files) {
|
|
131
|
-
let matches;
|
|
132
|
-
try {
|
|
133
|
-
matches = await fg(rule.path, { cwd: projectDir });
|
|
134
|
-
}
|
|
135
|
-
catch {
|
|
136
|
-
// Invalid glob pattern - skip
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if (matches.length === 0) {
|
|
140
|
-
issues.push({
|
|
141
|
-
type: 'file',
|
|
142
|
-
severity: 'error',
|
|
143
|
-
message: `Missing file: ${rule.path}`,
|
|
144
|
-
hint: `Create ${rule.path}`,
|
|
145
|
-
});
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
// Check content patterns
|
|
149
|
-
if (rule.mustContain || rule.mustContainAny) {
|
|
150
|
-
const filePath = join(projectDir, matches[0]);
|
|
151
|
-
let content;
|
|
152
|
-
try {
|
|
153
|
-
content = await readFile(filePath, 'utf-8');
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
// File read error - skip content checks
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
// All must be present
|
|
160
|
-
if (rule.mustContain) {
|
|
161
|
-
for (const pattern of rule.mustContain) {
|
|
162
|
-
if (!content.includes(pattern)) {
|
|
163
|
-
issues.push({
|
|
164
|
-
type: 'pattern',
|
|
165
|
-
severity: 'warning',
|
|
166
|
-
message: `File ${matches[0]} missing expected pattern: "${pattern}"`,
|
|
167
|
-
hint: `Ensure ${matches[0]} contains: ${pattern}`,
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
// At least one must be present
|
|
173
|
-
if (rule.mustContainAny) {
|
|
174
|
-
const hasAny = rule.mustContainAny.some((p) => content.includes(p));
|
|
175
|
-
if (!hasAny) {
|
|
176
|
-
issues.push({
|
|
177
|
-
type: 'pattern',
|
|
178
|
-
severity: 'warning',
|
|
179
|
-
message: `File ${matches[0]} missing one of: ${rule.mustContainAny.join(', ')}`,
|
|
180
|
-
hint: `Ensure ${matches[0]} contains one of these patterns`,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return issues;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Framework-specific cross-validations that require reading multiple sources.
|
|
190
|
-
*/
|
|
191
|
-
export async function validateFrameworkSpecific(framework, projectDir) {
|
|
192
|
-
const issues = [];
|
|
193
|
-
// Universal cross-validations
|
|
194
|
-
await validateCredentialFormats(projectDir, issues);
|
|
195
|
-
await validateDuplicateEnvVars(projectDir, issues);
|
|
196
|
-
// Framework-specific validations
|
|
197
|
-
switch (framework) {
|
|
198
|
-
case 'nextjs':
|
|
199
|
-
await validateNextjsRedirectUri(projectDir, issues);
|
|
200
|
-
await validateNextjsMiddlewarePlacement(projectDir, issues);
|
|
201
|
-
await validateCookiePasswordLength(projectDir, issues, 'WORKOS_COOKIE_PASSWORD');
|
|
202
|
-
break;
|
|
203
|
-
case 'react':
|
|
204
|
-
await validateReactProviderWrapping(projectDir, issues);
|
|
205
|
-
break;
|
|
206
|
-
case 'react-router':
|
|
207
|
-
await validateReactRouterRedirectUri(projectDir, issues);
|
|
208
|
-
await validateCookiePasswordLength(projectDir, issues, 'WORKOS_COOKIE_PASSWORD');
|
|
209
|
-
break;
|
|
210
|
-
case 'tanstack-start':
|
|
211
|
-
await validateTanstackStartRedirectUri(projectDir, issues);
|
|
212
|
-
await validateCookiePasswordLength(projectDir, issues, 'WORKOS_COOKIE_PASSWORD');
|
|
213
|
-
break;
|
|
214
|
-
}
|
|
215
|
-
return issues;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Compares the redirect URI's effective port to the detected dev server port,
|
|
219
|
-
* for local dev hosts only, and records an error-severity issue on mismatch.
|
|
220
|
-
* Skips production URIs and placeholder hosts like http://test.
|
|
221
|
-
*/
|
|
222
|
-
function validateRedirectUriPort(url, framework, projectDir, issues) {
|
|
223
|
-
// Only enforce for local dev hosts; skip production URIs and placeholder
|
|
224
|
-
// hosts like http://test. Node parses IPv6 hostnames with brackets: [::1].
|
|
225
|
-
const localHosts = new Set(['localhost', '127.0.0.1', '[::1]', '::1']);
|
|
226
|
-
if (!localHosts.has(url.hostname))
|
|
227
|
-
return;
|
|
228
|
-
const effectivePort = url.port || (url.protocol === 'https:' ? '443' : '80');
|
|
229
|
-
const detected = detectPort(framework, projectDir);
|
|
230
|
-
if (Number(effectivePort) !== detected) {
|
|
231
|
-
issues.push({
|
|
232
|
-
type: 'env',
|
|
233
|
-
severity: 'error',
|
|
234
|
-
message: `Redirect URI port :${effectivePort} does not match the detected dev server port :${detected}`,
|
|
235
|
-
hint: `Update the redirect URI to use port :${detected} in .env.local and the WorkOS dashboard ` +
|
|
236
|
-
`(redirect URI, CORS origin, homepage URL), or change your dev server to run on port ${effectivePort}.`,
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Validates that the Next.js redirect URI matches an existing callback route.
|
|
242
|
-
*
|
|
243
|
-
* Common failure: .env.local has /auth/callback but route is at /api/auth/callback
|
|
244
|
-
*/
|
|
245
|
-
async function validateNextjsRedirectUri(projectDir, issues) {
|
|
246
|
-
const envPath = join(projectDir, '.env.local');
|
|
247
|
-
let envContent;
|
|
248
|
-
try {
|
|
249
|
-
envContent = await readFile(envPath, 'utf-8');
|
|
250
|
-
}
|
|
251
|
-
catch {
|
|
252
|
-
return; // No .env.local - other validators handle this
|
|
253
|
-
}
|
|
254
|
-
// Extract redirect URI value
|
|
255
|
-
const match = envContent.match(/^NEXT_PUBLIC_WORKOS_REDIRECT_URI=(.+)$/m);
|
|
256
|
-
if (!match) {
|
|
257
|
-
return; // Missing env var - other validators handle this
|
|
258
|
-
}
|
|
259
|
-
const redirectUri = match[1].trim();
|
|
260
|
-
let callbackPath;
|
|
261
|
-
try {
|
|
262
|
-
const url = new URL(redirectUri);
|
|
263
|
-
callbackPath = url.pathname;
|
|
264
|
-
validateRedirectUriPort(url, 'nextjs', projectDir, issues);
|
|
265
|
-
}
|
|
266
|
-
catch {
|
|
267
|
-
issues.push({
|
|
268
|
-
type: 'env',
|
|
269
|
-
severity: 'error',
|
|
270
|
-
message: `Invalid redirect URI: ${redirectUri}`,
|
|
271
|
-
hint: 'NEXT_PUBLIC_WORKOS_REDIRECT_URI must be a valid URL',
|
|
272
|
-
});
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
// Remove leading slash for path matching
|
|
276
|
-
const routePath = callbackPath.replace(/^\//, '');
|
|
277
|
-
// Check if route file exists at expected location (Next.js App Router)
|
|
278
|
-
const routePatterns = [
|
|
279
|
-
`app/${routePath}/route.ts`,
|
|
280
|
-
`app/${routePath}/route.tsx`,
|
|
281
|
-
`app/${routePath}/route.js`,
|
|
282
|
-
`app/${routePath}/route.jsx`,
|
|
283
|
-
`src/app/${routePath}/route.ts`,
|
|
284
|
-
`src/app/${routePath}/route.tsx`,
|
|
285
|
-
`src/app/${routePath}/route.js`,
|
|
286
|
-
`src/app/${routePath}/route.jsx`,
|
|
287
|
-
];
|
|
288
|
-
const routeExists = routePatterns.some((pattern) => existsSync(join(projectDir, pattern)));
|
|
289
|
-
if (!routeExists) {
|
|
290
|
-
// Check what routes DO exist to give a better hint
|
|
291
|
-
const existingRoutes = await fg(['app/**/callback/**/route.{ts,tsx,js,jsx}', 'src/app/**/callback/**/route.{ts,tsx,js,jsx}'], {
|
|
292
|
-
cwd: projectDir,
|
|
293
|
-
});
|
|
294
|
-
let hint = `Create a route handler at app/${routePath}/route.ts`;
|
|
295
|
-
if (existingRoutes.length > 0) {
|
|
296
|
-
// Found a route at a different path - likely the mismatch
|
|
297
|
-
const actualPath = '/' + existingRoutes[0].replace(/^(src\/)?app\//, '').replace(/\/route\.(ts|tsx|js|jsx)$/, '');
|
|
298
|
-
hint =
|
|
299
|
-
`Found callback route at ${existingRoutes[0]} but redirect URI points to ${callbackPath}. Either:\n` +
|
|
300
|
-
` 1. Change NEXT_PUBLIC_WORKOS_REDIRECT_URI to ${new URL(redirectUri).origin}${actualPath}\n` +
|
|
301
|
-
` 2. Move the route to app/${routePath}/route.ts`;
|
|
302
|
-
}
|
|
303
|
-
issues.push({
|
|
304
|
-
type: 'file',
|
|
305
|
-
severity: 'error',
|
|
306
|
-
message: `Redirect URI path "${callbackPath}" has no matching route file`,
|
|
307
|
-
hint,
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Validates that the React Router redirect URI matches an existing callback route.
|
|
313
|
-
*
|
|
314
|
-
* React Router v7 framework mode uses file-based routing:
|
|
315
|
-
* - /auth/callback → app/routes/auth.callback.tsx (dot notation)
|
|
316
|
-
* - /auth/callback → app/routes/auth/callback.tsx (nested folders)
|
|
317
|
-
*/
|
|
318
|
-
async function validateReactRouterRedirectUri(projectDir, issues) {
|
|
319
|
-
const envPath = join(projectDir, '.env.local');
|
|
320
|
-
let envContent;
|
|
321
|
-
try {
|
|
322
|
-
envContent = await readFile(envPath, 'utf-8');
|
|
323
|
-
}
|
|
324
|
-
catch {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
const match = envContent.match(/^WORKOS_REDIRECT_URI=(.+)$/m);
|
|
328
|
-
if (!match) {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
const redirectUri = match[1].trim();
|
|
332
|
-
let callbackPath;
|
|
333
|
-
try {
|
|
334
|
-
const url = new URL(redirectUri);
|
|
335
|
-
callbackPath = url.pathname;
|
|
336
|
-
validateRedirectUriPort(url, 'react-router', projectDir, issues);
|
|
337
|
-
}
|
|
338
|
-
catch {
|
|
339
|
-
issues.push({
|
|
340
|
-
type: 'env',
|
|
341
|
-
severity: 'error',
|
|
342
|
-
message: `Invalid redirect URI: ${redirectUri}`,
|
|
343
|
-
hint: 'WORKOS_REDIRECT_URI must be a valid URL',
|
|
344
|
-
});
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
const routePath = callbackPath.replace(/^\//, '');
|
|
348
|
-
// React Router uses dot notation: /auth/callback → auth.callback
|
|
349
|
-
const dotPath = routePath.replace(/\//g, '.');
|
|
350
|
-
// Check possible route file locations
|
|
351
|
-
const routePatterns = [
|
|
352
|
-
// Dot notation (e.g., app/routes/auth.callback.tsx)
|
|
353
|
-
`app/routes/${dotPath}.tsx`,
|
|
354
|
-
`app/routes/${dotPath}.ts`,
|
|
355
|
-
`app/routes/${dotPath}.jsx`,
|
|
356
|
-
`app/routes/${dotPath}.js`,
|
|
357
|
-
// Nested folders (e.g., app/routes/auth/callback.tsx)
|
|
358
|
-
`app/routes/${routePath}.tsx`,
|
|
359
|
-
`app/routes/${routePath}.ts`,
|
|
360
|
-
`app/routes/${routePath}.jsx`,
|
|
361
|
-
`app/routes/${routePath}.js`,
|
|
362
|
-
// Index file in folder (e.g., app/routes/auth/callback/index.tsx)
|
|
363
|
-
`app/routes/${routePath}/index.tsx`,
|
|
364
|
-
`app/routes/${routePath}/index.ts`,
|
|
365
|
-
`app/routes/${routePath}/index.jsx`,
|
|
366
|
-
`app/routes/${routePath}/index.js`,
|
|
367
|
-
// Route file in folder (e.g., app/routes/auth/callback/route.tsx)
|
|
368
|
-
`app/routes/${routePath}/route.tsx`,
|
|
369
|
-
`app/routes/${routePath}/route.ts`,
|
|
370
|
-
`app/routes/${routePath}/route.jsx`,
|
|
371
|
-
`app/routes/${routePath}/route.js`,
|
|
372
|
-
];
|
|
373
|
-
const routeExists = routePatterns.some((pattern) => existsSync(join(projectDir, pattern)));
|
|
374
|
-
if (!routeExists) {
|
|
375
|
-
const existingRoutes = await fg(['app/routes/**/*callback*.{ts,tsx,js,jsx}'], {
|
|
376
|
-
cwd: projectDir,
|
|
377
|
-
});
|
|
378
|
-
let hint = `Create a route at app/routes/${dotPath}.tsx`;
|
|
379
|
-
if (existingRoutes.length > 0) {
|
|
380
|
-
const actualFile = existingRoutes[0];
|
|
381
|
-
// Convert file path back to URL path
|
|
382
|
-
const actualPath = '/' +
|
|
383
|
-
actualFile
|
|
384
|
-
.replace(/^app\/routes\//, '')
|
|
385
|
-
.replace(/\.(tsx?|jsx?)$/, '')
|
|
386
|
-
.replace(/\/(index|route)$/, '')
|
|
387
|
-
.replace(/\./g, '/');
|
|
388
|
-
hint =
|
|
389
|
-
`Found callback route at ${actualFile} but redirect URI points to ${callbackPath}. Either:\n` +
|
|
390
|
-
` 1. Change WORKOS_REDIRECT_URI to ${new URL(redirectUri).origin}${actualPath}\n` +
|
|
391
|
-
` 2. Move the route to app/routes/${dotPath}.tsx`;
|
|
392
|
-
}
|
|
393
|
-
issues.push({
|
|
394
|
-
type: 'file',
|
|
395
|
-
severity: 'error',
|
|
396
|
-
message: `Redirect URI path "${callbackPath}" has no matching route file`,
|
|
397
|
-
hint,
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Validates that the TanStack Start redirect URI matches an existing callback route.
|
|
403
|
-
*
|
|
404
|
-
* TanStack Start uses file-based routing:
|
|
405
|
-
* - /auth/callback → app/routes/auth/callback.tsx
|
|
406
|
-
*/
|
|
407
|
-
async function validateTanstackStartRedirectUri(projectDir, issues) {
|
|
408
|
-
const envPath = join(projectDir, '.env.local');
|
|
409
|
-
let envContent;
|
|
410
|
-
try {
|
|
411
|
-
envContent = await readFile(envPath, 'utf-8');
|
|
412
|
-
}
|
|
413
|
-
catch {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const match = envContent.match(/^WORKOS_REDIRECT_URI=(.+)$/m);
|
|
417
|
-
if (!match) {
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
const redirectUri = match[1].trim();
|
|
421
|
-
let callbackPath;
|
|
422
|
-
try {
|
|
423
|
-
const url = new URL(redirectUri);
|
|
424
|
-
callbackPath = url.pathname;
|
|
425
|
-
validateRedirectUriPort(url, 'tanstack-start', projectDir, issues);
|
|
426
|
-
}
|
|
427
|
-
catch {
|
|
428
|
-
issues.push({
|
|
429
|
-
type: 'env',
|
|
430
|
-
severity: 'error',
|
|
431
|
-
message: `Invalid redirect URI: ${redirectUri}`,
|
|
432
|
-
hint: 'WORKOS_REDIRECT_URI must be a valid URL',
|
|
433
|
-
});
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
const routePath = callbackPath.replace(/^\//, '');
|
|
437
|
-
// TanStack Start route patterns
|
|
438
|
-
const routePatterns = [
|
|
439
|
-
`app/routes/${routePath}.tsx`,
|
|
440
|
-
`app/routes/${routePath}.ts`,
|
|
441
|
-
`app/routes/${routePath}.jsx`,
|
|
442
|
-
`app/routes/${routePath}.js`,
|
|
443
|
-
`app/routes/${routePath}/index.tsx`,
|
|
444
|
-
`app/routes/${routePath}/index.ts`,
|
|
445
|
-
`app/routes/${routePath}/index.jsx`,
|
|
446
|
-
`app/routes/${routePath}/index.js`,
|
|
447
|
-
];
|
|
448
|
-
const routeExists = routePatterns.some((pattern) => existsSync(join(projectDir, pattern)));
|
|
449
|
-
if (!routeExists) {
|
|
450
|
-
const existingRoutes = await fg(['app/routes/**/*callback*.{ts,tsx,js,jsx}'], {
|
|
451
|
-
cwd: projectDir,
|
|
452
|
-
});
|
|
453
|
-
let hint = `Create a route at app/routes/${routePath}.tsx`;
|
|
454
|
-
if (existingRoutes.length > 0) {
|
|
455
|
-
const actualFile = existingRoutes[0];
|
|
456
|
-
const actualPath = '/' +
|
|
457
|
-
actualFile
|
|
458
|
-
.replace(/^app\/routes\//, '')
|
|
459
|
-
.replace(/\.(tsx?|jsx?)$/, '')
|
|
460
|
-
.replace(/\/index$/, '');
|
|
461
|
-
hint =
|
|
462
|
-
`Found callback route at ${actualFile} but redirect URI points to ${callbackPath}. Either:\n` +
|
|
463
|
-
` 1. Change WORKOS_REDIRECT_URI to ${new URL(redirectUri).origin}${actualPath}\n` +
|
|
464
|
-
` 2. Move the route to app/routes/${routePath}.tsx`;
|
|
465
|
-
}
|
|
466
|
-
issues.push({
|
|
467
|
-
type: 'file',
|
|
468
|
-
severity: 'error',
|
|
469
|
-
message: `Redirect URI path "${callbackPath}" has no matching route file`,
|
|
470
|
-
hint,
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Validates cookie password is at least 32 characters.
|
|
476
|
-
* WorkOS requires this for secure session encryption.
|
|
477
|
-
*/
|
|
478
|
-
async function validateCookiePasswordLength(projectDir, issues, envVarName) {
|
|
479
|
-
const envPath = join(projectDir, '.env.local');
|
|
480
|
-
let envContent;
|
|
481
|
-
try {
|
|
482
|
-
envContent = await readFile(envPath, 'utf-8');
|
|
483
|
-
}
|
|
484
|
-
catch {
|
|
485
|
-
return; // No .env.local - other validators handle this
|
|
486
|
-
}
|
|
487
|
-
const match = envContent.match(new RegExp(`^${envVarName}=(.*)$`, 'm'));
|
|
488
|
-
if (!match) {
|
|
489
|
-
return; // Missing env var - other validators handle this
|
|
490
|
-
}
|
|
491
|
-
const password = match[1].trim();
|
|
492
|
-
if (password.length < 32) {
|
|
493
|
-
issues.push({
|
|
494
|
-
type: 'env',
|
|
495
|
-
severity: 'error',
|
|
496
|
-
message: `${envVarName} must be at least 32 characters (currently ${password.length})`,
|
|
497
|
-
hint: `Generate a secure password: openssl rand -base64 32`,
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Validates credential formats:
|
|
503
|
-
* - API key should start with sk_
|
|
504
|
-
* - Client ID should start with client_
|
|
505
|
-
*/
|
|
506
|
-
async function validateCredentialFormats(projectDir, issues) {
|
|
507
|
-
const envPath = join(projectDir, '.env.local');
|
|
508
|
-
let envContent;
|
|
509
|
-
try {
|
|
510
|
-
envContent = await readFile(envPath, 'utf-8');
|
|
511
|
-
}
|
|
512
|
-
catch {
|
|
513
|
-
return;
|
|
514
|
-
}
|
|
515
|
-
// Check API key format (any common variation)
|
|
516
|
-
const apiKeyPatterns = [/^WORKOS_API_KEY=(.*)$/m, /^NEXT_PUBLIC_WORKOS_API_KEY=(.*)$/m];
|
|
517
|
-
for (const pattern of apiKeyPatterns) {
|
|
518
|
-
const match = envContent.match(pattern);
|
|
519
|
-
if (match) {
|
|
520
|
-
const value = match[1].trim();
|
|
521
|
-
if (value && !value.startsWith('sk_')) {
|
|
522
|
-
issues.push({
|
|
523
|
-
type: 'env',
|
|
524
|
-
severity: 'error',
|
|
525
|
-
message: `Invalid API key format: "${value.substring(0, 10)}..."`,
|
|
526
|
-
hint: 'WorkOS API keys start with "sk_". Check your WorkOS Dashboard for the correct key.',
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
// Check Client ID format
|
|
532
|
-
const clientIdPatterns = [/^WORKOS_CLIENT_ID=(.*)$/m, /^NEXT_PUBLIC_WORKOS_CLIENT_ID=(.*)$/m];
|
|
533
|
-
for (const pattern of clientIdPatterns) {
|
|
534
|
-
const match = envContent.match(pattern);
|
|
535
|
-
if (match) {
|
|
536
|
-
const value = match[1].trim();
|
|
537
|
-
if (value && !value.startsWith('client_')) {
|
|
538
|
-
issues.push({
|
|
539
|
-
type: 'env',
|
|
540
|
-
severity: 'error',
|
|
541
|
-
message: `Invalid Client ID format: "${value.substring(0, 15)}..."`,
|
|
542
|
-
hint: 'WorkOS Client IDs start with "client_". Check your WorkOS Dashboard for the correct ID.',
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Validates Next.js middleware/proxy is at the correct location.
|
|
550
|
-
* Must be alongside the app/ directory — Next.js only watches for these files
|
|
551
|
-
* in the parent directory of app/.
|
|
552
|
-
*/
|
|
553
|
-
async function validateNextjsMiddlewarePlacement(projectDir, issues) {
|
|
554
|
-
// Determine where app/ lives to know where middleware/proxy should be
|
|
555
|
-
const appInSrc = existsSync(join(projectDir, 'src', 'app'));
|
|
556
|
-
const expectedDir = appInSrc ? 'src/' : '';
|
|
557
|
-
const correctPaths = [
|
|
558
|
-
`${expectedDir}middleware.ts`,
|
|
559
|
-
`${expectedDir}middleware.js`,
|
|
560
|
-
`${expectedDir}proxy.ts`,
|
|
561
|
-
`${expectedDir}proxy.js`,
|
|
562
|
-
];
|
|
563
|
-
const hasCorrectPlacement = correctPaths.some((p) => existsSync(join(projectDir, p)));
|
|
564
|
-
if (hasCorrectPlacement) {
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
// Check for middleware/proxy at the wrong level
|
|
568
|
-
const allPossible = [
|
|
569
|
-
'middleware.ts',
|
|
570
|
-
'middleware.js',
|
|
571
|
-
'src/middleware.ts',
|
|
572
|
-
'src/middleware.js',
|
|
573
|
-
'proxy.ts',
|
|
574
|
-
'proxy.js',
|
|
575
|
-
'src/proxy.ts',
|
|
576
|
-
'src/proxy.js',
|
|
577
|
-
];
|
|
578
|
-
const wrongLevel = allPossible.find((p) => existsSync(join(projectDir, p)) && !correctPaths.includes(p));
|
|
579
|
-
if (wrongLevel) {
|
|
580
|
-
issues.push({
|
|
581
|
-
type: 'file',
|
|
582
|
-
severity: 'error',
|
|
583
|
-
message: `${wrongLevel} is at the wrong level — app/ is in ${appInSrc ? 'src/' : 'root'}`,
|
|
584
|
-
hint: `Move it to ${expectedDir}${wrongLevel.replace(/^src\//, '')} (must be alongside app/ directory). Next.js silently ignores middleware/proxy files at the wrong level.`,
|
|
585
|
-
});
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
// Check for deeply misplaced middleware
|
|
589
|
-
const misplaced = await fg(['**/{middleware,proxy}.{ts,js}'], {
|
|
590
|
-
cwd: projectDir,
|
|
591
|
-
ignore: ['node_modules/**'],
|
|
592
|
-
});
|
|
593
|
-
if (misplaced.length > 0) {
|
|
594
|
-
issues.push({
|
|
595
|
-
type: 'file',
|
|
596
|
-
severity: 'error',
|
|
597
|
-
message: `middleware/proxy found at wrong location: ${misplaced[0]}`,
|
|
598
|
-
hint: `Must be at ${expectedDir}middleware.ts or ${expectedDir}proxy.ts (alongside app/ directory).`,
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Validates React SPA has AuthKitProvider wrapping the app.
|
|
604
|
-
*/
|
|
605
|
-
async function validateReactProviderWrapping(projectDir, issues) {
|
|
606
|
-
// Common entry points for React apps
|
|
607
|
-
const entryPatterns = [
|
|
608
|
-
'src/main.tsx',
|
|
609
|
-
'src/main.jsx',
|
|
610
|
-
'src/index.tsx',
|
|
611
|
-
'src/index.jsx',
|
|
612
|
-
'src/App.tsx',
|
|
613
|
-
'src/App.jsx',
|
|
614
|
-
'app/layout.tsx',
|
|
615
|
-
'app/layout.jsx',
|
|
616
|
-
];
|
|
617
|
-
let foundProvider = false;
|
|
618
|
-
for (const pattern of entryPatterns) {
|
|
619
|
-
const filePath = join(projectDir, pattern);
|
|
620
|
-
if (!existsSync(filePath))
|
|
621
|
-
continue;
|
|
622
|
-
try {
|
|
623
|
-
const content = await readFile(filePath, 'utf-8');
|
|
624
|
-
if (content.includes('AuthKitProvider')) {
|
|
625
|
-
foundProvider = true;
|
|
626
|
-
break;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
catch {
|
|
630
|
-
continue;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
if (!foundProvider) {
|
|
634
|
-
// Check if package is installed (if not, other validators handle it)
|
|
635
|
-
const pkgPath = join(projectDir, 'package.json');
|
|
636
|
-
if (existsSync(pkgPath)) {
|
|
637
|
-
try {
|
|
638
|
-
const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
|
639
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
640
|
-
if (deps['@workos-inc/authkit-react']) {
|
|
641
|
-
issues.push({
|
|
642
|
-
type: 'pattern',
|
|
643
|
-
severity: 'warning',
|
|
644
|
-
message: 'AuthKitProvider not found in common entry points',
|
|
645
|
-
hint: 'Wrap your app with <AuthKitProvider> in main.tsx or App.tsx. See: https://workos.com/docs/user-management/react/authkit',
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
catch {
|
|
650
|
-
// Malformed package.json - skip
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* Detects duplicate env vars between .env and .env.local with different values.
|
|
657
|
-
* This can cause confusing behavior where wrong values are used.
|
|
658
|
-
*/
|
|
659
|
-
async function validateDuplicateEnvVars(projectDir, issues) {
|
|
660
|
-
const envPath = join(projectDir, '.env');
|
|
661
|
-
const envLocalPath = join(projectDir, '.env.local');
|
|
662
|
-
let envContent;
|
|
663
|
-
let envLocalContent;
|
|
664
|
-
try {
|
|
665
|
-
envContent = await readFile(envPath, 'utf-8');
|
|
666
|
-
}
|
|
667
|
-
catch {
|
|
668
|
-
return; // No .env file - no conflict possible
|
|
669
|
-
}
|
|
670
|
-
try {
|
|
671
|
-
envLocalContent = await readFile(envLocalPath, 'utf-8');
|
|
672
|
-
}
|
|
673
|
-
catch {
|
|
674
|
-
return; // No .env.local - no conflict possible
|
|
675
|
-
}
|
|
676
|
-
// Parse env files into key-value maps
|
|
677
|
-
const parseEnv = (content) => {
|
|
678
|
-
const map = new Map();
|
|
679
|
-
for (const line of content.split(/\r?\n/)) {
|
|
680
|
-
const match = line.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);
|
|
681
|
-
if (match) {
|
|
682
|
-
map.set(match[1], match[2].trim());
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
return map;
|
|
686
|
-
};
|
|
687
|
-
const envVars = parseEnv(envContent);
|
|
688
|
-
const envLocalVars = parseEnv(envLocalContent);
|
|
689
|
-
// Check for WorkOS-related vars that differ
|
|
690
|
-
const workosVars = [
|
|
691
|
-
'WORKOS_API_KEY',
|
|
692
|
-
'WORKOS_CLIENT_ID',
|
|
693
|
-
'WORKOS_REDIRECT_URI',
|
|
694
|
-
'WORKOS_COOKIE_PASSWORD',
|
|
695
|
-
'NEXT_PUBLIC_WORKOS_CLIENT_ID',
|
|
696
|
-
'NEXT_PUBLIC_WORKOS_REDIRECT_URI',
|
|
697
|
-
];
|
|
698
|
-
for (const varName of workosVars) {
|
|
699
|
-
const envValue = envVars.get(varName);
|
|
700
|
-
const localValue = envLocalVars.get(varName);
|
|
701
|
-
if (envValue && localValue && envValue !== localValue) {
|
|
702
|
-
issues.push({
|
|
703
|
-
type: 'env',
|
|
704
|
-
severity: 'warning',
|
|
705
|
-
message: `${varName} has different values in .env and .env.local`,
|
|
706
|
-
hint: `.env.local takes precedence. Remove from .env to avoid confusion, or ensure they match.`,
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
//# sourceMappingURL=validator.js.map
|