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,192 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
import { readFile } from 'fs/promises';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { detectBuildCommand, detectPackageManager, parseBuildErrors } from './build-validator.js';
|
|
5
|
-
import { SPAWN_OPTS } from '../../utils/platform.js';
|
|
6
|
-
const DEFAULT_TYPECHECK_TIMEOUT_MS = 30_000;
|
|
7
|
-
const DEFAULT_BUILD_TIMEOUT_MS = 60_000;
|
|
8
|
-
/**
|
|
9
|
-
* Run fast deterministic checks: typecheck first, then build.
|
|
10
|
-
* Short-circuits: if typecheck fails, skip build (build will fail too).
|
|
11
|
-
*/
|
|
12
|
-
export async function runQuickChecks(projectDir, options) {
|
|
13
|
-
const startTime = Date.now();
|
|
14
|
-
const results = [];
|
|
15
|
-
const typecheckResult = await runTypecheckValidation(projectDir, options?.timeoutMs ?? DEFAULT_TYPECHECK_TIMEOUT_MS);
|
|
16
|
-
results.push(typecheckResult);
|
|
17
|
-
if (typecheckResult.passed && !options?.skipBuild) {
|
|
18
|
-
results.push(await runBuildQuickCheck(projectDir, options?.timeoutMs ?? DEFAULT_BUILD_TIMEOUT_MS));
|
|
19
|
-
}
|
|
20
|
-
const passed = results.every((r) => r.passed);
|
|
21
|
-
return {
|
|
22
|
-
passed,
|
|
23
|
-
results,
|
|
24
|
-
agentRetryPrompt: passed ? null : formatForAgent(results),
|
|
25
|
-
totalDurationMs: Date.now() - startTime,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function passResult(phase, startTime) {
|
|
29
|
-
return { passed: true, phase, issues: [], agentPrompt: null, durationMs: Date.now() - startTime };
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Run typecheck only (tsc --noEmit or framework equivalent).
|
|
33
|
-
* Faster than full build — catches type errors in ~5s.
|
|
34
|
-
*/
|
|
35
|
-
export async function runTypecheckValidation(projectDir, timeoutMs = DEFAULT_TYPECHECK_TIMEOUT_MS) {
|
|
36
|
-
const startTime = Date.now();
|
|
37
|
-
const typecheckCmd = await detectTypecheckCommand(projectDir);
|
|
38
|
-
if (!typecheckCmd) {
|
|
39
|
-
return passResult('typecheck', startTime);
|
|
40
|
-
}
|
|
41
|
-
const { exitCode, stdout, stderr } = await spawnCommand(typecheckCmd.command, typecheckCmd.args, projectDir, timeoutMs);
|
|
42
|
-
if (exitCode === 0) {
|
|
43
|
-
return passResult('typecheck', startTime);
|
|
44
|
-
}
|
|
45
|
-
const output = stdout + stderr;
|
|
46
|
-
const errors = parseTypecheckErrors(output);
|
|
47
|
-
const issues = errors.map((error) => ({
|
|
48
|
-
type: 'file',
|
|
49
|
-
severity: 'error',
|
|
50
|
-
message: `Type error: ${error}`,
|
|
51
|
-
hint: 'Fix the type error and run typecheck again',
|
|
52
|
-
}));
|
|
53
|
-
if (issues.length === 0) {
|
|
54
|
-
issues.push({
|
|
55
|
-
type: 'file',
|
|
56
|
-
severity: 'error',
|
|
57
|
-
message: 'Typecheck failed',
|
|
58
|
-
hint: `Run \`${typecheckCmd.command} ${typecheckCmd.args.join(' ')}\` to see full output`,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
passed: false,
|
|
63
|
-
phase: 'typecheck',
|
|
64
|
-
issues,
|
|
65
|
-
agentPrompt: formatTypecheckErrors(errors, output),
|
|
66
|
-
durationMs: Date.now() - startTime,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
async function runBuildQuickCheck(projectDir, timeoutMs) {
|
|
70
|
-
const startTime = Date.now();
|
|
71
|
-
const buildCmd = await detectBuildCommand(projectDir);
|
|
72
|
-
if (!buildCmd) {
|
|
73
|
-
return passResult('build', startTime);
|
|
74
|
-
}
|
|
75
|
-
const { exitCode, stdout, stderr } = await spawnCommand(buildCmd.command, buildCmd.args, projectDir, timeoutMs);
|
|
76
|
-
if (exitCode === 0) {
|
|
77
|
-
return passResult('build', startTime);
|
|
78
|
-
}
|
|
79
|
-
const output = stdout + stderr;
|
|
80
|
-
const errors = parseBuildErrors(output);
|
|
81
|
-
const issues = errors.length > 0
|
|
82
|
-
? errors.map((e) => ({
|
|
83
|
-
type: 'file',
|
|
84
|
-
severity: 'error',
|
|
85
|
-
message: `Build error: ${e}`,
|
|
86
|
-
hint: 'Fix the error and run build again',
|
|
87
|
-
}))
|
|
88
|
-
: [
|
|
89
|
-
{
|
|
90
|
-
type: 'file',
|
|
91
|
-
severity: 'error',
|
|
92
|
-
message: 'Build failed',
|
|
93
|
-
hint: `Run \`${buildCmd.command} ${buildCmd.args.join(' ')}\` to see full output`,
|
|
94
|
-
},
|
|
95
|
-
];
|
|
96
|
-
return {
|
|
97
|
-
passed: false,
|
|
98
|
-
phase: 'build',
|
|
99
|
-
issues,
|
|
100
|
-
agentPrompt: formatBuildErrors(issues),
|
|
101
|
-
durationMs: Date.now() - startTime,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
async function detectTypecheckCommand(projectDir) {
|
|
105
|
-
const pm = detectPackageManager(projectDir);
|
|
106
|
-
try {
|
|
107
|
-
const content = await readFile(join(projectDir, 'package.json'), 'utf-8');
|
|
108
|
-
const pkg = JSON.parse(content);
|
|
109
|
-
const scriptName = pkg.scripts?.typecheck ? 'typecheck' : pkg.scripts?.['type-check'] ? 'type-check' : null;
|
|
110
|
-
if (scriptName) {
|
|
111
|
-
const args = pm === 'npm' ? ['run', scriptName] : [scriptName];
|
|
112
|
-
return { command: pm, args };
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
catch {
|
|
116
|
-
// No package.json or malformed
|
|
117
|
-
}
|
|
118
|
-
try {
|
|
119
|
-
await readFile(join(projectDir, 'tsconfig.json'), 'utf-8');
|
|
120
|
-
return { command: 'npx', args: ['tsc', '--noEmit'] };
|
|
121
|
-
}
|
|
122
|
-
catch {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
function parseTypecheckErrors(output) {
|
|
127
|
-
// Match both TS error formats:
|
|
128
|
-
// src/file.ts(line,col): error TS2345: ...
|
|
129
|
-
// src/file.ts:line:col - error TS2345: ... (tsc --pretty)
|
|
130
|
-
const pattern = /[\w./]+\.\w+(?:\(\d+,\d+\):\s*|:\d+:\d+\s*-\s*)error\s+TS\d+:.+/g;
|
|
131
|
-
const matches = output.match(pattern);
|
|
132
|
-
return matches ? [...new Set(matches)].slice(0, 10) : [];
|
|
133
|
-
}
|
|
134
|
-
function formatTypecheckErrors(errors, rawOutput) {
|
|
135
|
-
if (errors.length === 0) {
|
|
136
|
-
// Couldn't parse specific errors — give raw output
|
|
137
|
-
const truncated = rawOutput.slice(0, 2000);
|
|
138
|
-
return `The typecheck failed. Here is the output:\n\n${truncated}\n\nFix the type errors shown above.`;
|
|
139
|
-
}
|
|
140
|
-
const lines = errors.map((error) => {
|
|
141
|
-
// Extract file:line info and error description
|
|
142
|
-
const fileMatch = error.match(/([\w./]+\.\w+)[:(]\d+/);
|
|
143
|
-
const tsMatch = error.match(/error\s+(TS\d+):\s*(.+)/);
|
|
144
|
-
if (fileMatch && tsMatch) {
|
|
145
|
-
return `- ${fileMatch[1]}: ${tsMatch[2]} (${tsMatch[1]})`;
|
|
146
|
-
}
|
|
147
|
-
return `- ${error}`;
|
|
148
|
-
});
|
|
149
|
-
return `The typecheck failed with ${errors.length} error${errors.length === 1 ? '' : 's'}:\n\n${lines.join('\n')}\n\nFix these type errors in the indicated files.`;
|
|
150
|
-
}
|
|
151
|
-
function formatBuildErrors(issues) {
|
|
152
|
-
const errorMessages = issues.map((i) => `- ${i.message}`);
|
|
153
|
-
return `The build failed:\n\n${errorMessages.join('\n')}\n\nFix these build errors.`;
|
|
154
|
-
}
|
|
155
|
-
function formatForAgent(results) {
|
|
156
|
-
return results
|
|
157
|
-
.filter((r) => !r.passed && r.agentPrompt)
|
|
158
|
-
.map((r) => r.agentPrompt)
|
|
159
|
-
.join('\n\n');
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Validation callback suitable for RetryConfig.validateAndFormat.
|
|
163
|
-
* Returns null if checks pass, or an agent-ready error prompt if they fail.
|
|
164
|
-
*/
|
|
165
|
-
export async function quickCheckValidateAndFormat(workingDirectory) {
|
|
166
|
-
const result = await runQuickChecks(workingDirectory);
|
|
167
|
-
return result.passed ? null : result.agentRetryPrompt;
|
|
168
|
-
}
|
|
169
|
-
function spawnCommand(command, args, cwd, timeoutMs) {
|
|
170
|
-
return new Promise((resolve) => {
|
|
171
|
-
const proc = spawn(command, args, {
|
|
172
|
-
cwd,
|
|
173
|
-
timeout: timeoutMs,
|
|
174
|
-
...SPAWN_OPTS,
|
|
175
|
-
});
|
|
176
|
-
let stdout = '';
|
|
177
|
-
let stderr = '';
|
|
178
|
-
proc.stdout?.on('data', (data) => {
|
|
179
|
-
stdout += data.toString();
|
|
180
|
-
});
|
|
181
|
-
proc.stderr?.on('data', (data) => {
|
|
182
|
-
stderr += data.toString();
|
|
183
|
-
});
|
|
184
|
-
proc.on('close', (code) => {
|
|
185
|
-
resolve({ exitCode: code ?? 1, stdout, stderr });
|
|
186
|
-
});
|
|
187
|
-
proc.on('error', () => {
|
|
188
|
-
resolve({ exitCode: 1, stdout, stderr });
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
//# sourceMappingURL=quick-checks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quick-checks.js","sourceRoot":"","sources":["../../../src/lib/validation/quick-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAC5C,MAAM,wBAAwB,GAAG,MAAM,CAAC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QAAQ,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACxB,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACpB,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { spawn } from 'child_process';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\nimport type { QuickCheckResult, QuickChecksOutput, ValidationIssue } from './types.js';\nimport { detectBuildCommand, detectPackageManager, parseBuildErrors } from './build-validator.js';\nimport { SPAWN_OPTS } from '../../utils/platform.js';\n\nconst DEFAULT_TYPECHECK_TIMEOUT_MS = 30_000;\nconst DEFAULT_BUILD_TIMEOUT_MS = 60_000;\n\n/**\n * Run fast deterministic checks: typecheck first, then build.\n * Short-circuits: if typecheck fails, skip build (build will fail too).\n */\nexport async function runQuickChecks(\n projectDir: string,\n options?: { skipBuild?: boolean; timeoutMs?: number },\n): Promise<QuickChecksOutput> {\n const startTime = Date.now();\n const results: QuickCheckResult[] = [];\n\n const typecheckResult = await runTypecheckValidation(projectDir, options?.timeoutMs ?? DEFAULT_TYPECHECK_TIMEOUT_MS);\n results.push(typecheckResult);\n\n if (typecheckResult.passed && !options?.skipBuild) {\n results.push(await runBuildQuickCheck(projectDir, options?.timeoutMs ?? DEFAULT_BUILD_TIMEOUT_MS));\n }\n\n const passed = results.every((r) => r.passed);\n\n return {\n passed,\n results,\n agentRetryPrompt: passed ? null : formatForAgent(results),\n totalDurationMs: Date.now() - startTime,\n };\n}\n\nfunction passResult(phase: QuickCheckResult['phase'], startTime: number): QuickCheckResult {\n return { passed: true, phase, issues: [], agentPrompt: null, durationMs: Date.now() - startTime };\n}\n\n/**\n * Run typecheck only (tsc --noEmit or framework equivalent).\n * Faster than full build — catches type errors in ~5s.\n */\nexport async function runTypecheckValidation(\n projectDir: string,\n timeoutMs: number = DEFAULT_TYPECHECK_TIMEOUT_MS,\n): Promise<QuickCheckResult> {\n const startTime = Date.now();\n const typecheckCmd = await detectTypecheckCommand(projectDir);\n\n if (!typecheckCmd) {\n return passResult('typecheck', startTime);\n }\n\n const { exitCode, stdout, stderr } = await spawnCommand(\n typecheckCmd.command,\n typecheckCmd.args,\n projectDir,\n timeoutMs,\n );\n\n if (exitCode === 0) {\n return passResult('typecheck', startTime);\n }\n\n const output = stdout + stderr;\n const errors = parseTypecheckErrors(output);\n const issues: ValidationIssue[] = errors.map((error) => ({\n type: 'file',\n severity: 'error',\n message: `Type error: ${error}`,\n hint: 'Fix the type error and run typecheck again',\n }));\n\n if (issues.length === 0) {\n issues.push({\n type: 'file',\n severity: 'error',\n message: 'Typecheck failed',\n hint: `Run \\`${typecheckCmd.command} ${typecheckCmd.args.join(' ')}\\` to see full output`,\n });\n }\n\n return {\n passed: false,\n phase: 'typecheck',\n issues,\n agentPrompt: formatTypecheckErrors(errors, output),\n durationMs: Date.now() - startTime,\n };\n}\n\nasync function runBuildQuickCheck(projectDir: string, timeoutMs: number): Promise<QuickCheckResult> {\n const startTime = Date.now();\n const buildCmd = await detectBuildCommand(projectDir);\n\n if (!buildCmd) {\n return passResult('build', startTime);\n }\n\n const { exitCode, stdout, stderr } = await spawnCommand(buildCmd.command, buildCmd.args, projectDir, timeoutMs);\n\n if (exitCode === 0) {\n return passResult('build', startTime);\n }\n\n const output = stdout + stderr;\n const errors = parseBuildErrors(output);\n const issues: ValidationIssue[] =\n errors.length > 0\n ? errors.map((e) => ({\n type: 'file',\n severity: 'error',\n message: `Build error: ${e}`,\n hint: 'Fix the error and run build again',\n }))\n : [\n {\n type: 'file',\n severity: 'error',\n message: 'Build failed',\n hint: `Run \\`${buildCmd.command} ${buildCmd.args.join(' ')}\\` to see full output`,\n },\n ];\n\n return {\n passed: false,\n phase: 'build',\n issues,\n agentPrompt: formatBuildErrors(issues),\n durationMs: Date.now() - startTime,\n };\n}\n\ninterface TypecheckCommand {\n command: string;\n args: string[];\n}\n\nasync function detectTypecheckCommand(projectDir: string): Promise<TypecheckCommand | null> {\n const pm = detectPackageManager(projectDir);\n\n try {\n const content = await readFile(join(projectDir, 'package.json'), 'utf-8');\n const pkg = JSON.parse(content) as { scripts?: Record<string, string> };\n\n const scriptName = pkg.scripts?.typecheck ? 'typecheck' : pkg.scripts?.['type-check'] ? 'type-check' : null;\n if (scriptName) {\n const args = pm === 'npm' ? ['run', scriptName] : [scriptName];\n return { command: pm, args };\n }\n } catch {\n // No package.json or malformed\n }\n\n try {\n await readFile(join(projectDir, 'tsconfig.json'), 'utf-8');\n return { command: 'npx', args: ['tsc', '--noEmit'] };\n } catch {\n return null;\n }\n}\n\nfunction parseTypecheckErrors(output: string): string[] {\n // Match both TS error formats:\n // src/file.ts(line,col): error TS2345: ...\n // src/file.ts:line:col - error TS2345: ... (tsc --pretty)\n const pattern = /[\\w./]+\\.\\w+(?:\\(\\d+,\\d+\\):\\s*|:\\d+:\\d+\\s*-\\s*)error\\s+TS\\d+:.+/g;\n const matches = output.match(pattern);\n return matches ? [...new Set(matches)].slice(0, 10) : [];\n}\n\nfunction formatTypecheckErrors(errors: string[], rawOutput: string): string {\n if (errors.length === 0) {\n // Couldn't parse specific errors — give raw output\n const truncated = rawOutput.slice(0, 2000);\n return `The typecheck failed. Here is the output:\\n\\n${truncated}\\n\\nFix the type errors shown above.`;\n }\n\n const lines = errors.map((error) => {\n // Extract file:line info and error description\n const fileMatch = error.match(/([\\w./]+\\.\\w+)[:(]\\d+/);\n const tsMatch = error.match(/error\\s+(TS\\d+):\\s*(.+)/);\n\n if (fileMatch && tsMatch) {\n return `- ${fileMatch[1]}: ${tsMatch[2]} (${tsMatch[1]})`;\n }\n return `- ${error}`;\n });\n\n return `The typecheck failed with ${errors.length} error${errors.length === 1 ? '' : 's'}:\\n\\n${lines.join('\\n')}\\n\\nFix these type errors in the indicated files.`;\n}\n\nfunction formatBuildErrors(issues: ValidationIssue[]): string {\n const errorMessages = issues.map((i) => `- ${i.message}`);\n return `The build failed:\\n\\n${errorMessages.join('\\n')}\\n\\nFix these build errors.`;\n}\n\nfunction formatForAgent(results: QuickCheckResult[]): string {\n return results\n .filter((r) => !r.passed && r.agentPrompt)\n .map((r) => r.agentPrompt!)\n .join('\\n\\n');\n}\n\n/**\n * Validation callback suitable for RetryConfig.validateAndFormat.\n * Returns null if checks pass, or an agent-ready error prompt if they fail.\n */\nexport async function quickCheckValidateAndFormat(workingDirectory: string): Promise<string | null> {\n const result = await runQuickChecks(workingDirectory);\n return result.passed ? null : result.agentRetryPrompt;\n}\n\nfunction spawnCommand(\n command: string,\n args: string[],\n cwd: string,\n timeoutMs: number,\n): Promise<{ exitCode: number; stdout: string; stderr: string }> {\n return new Promise((resolve) => {\n const proc = spawn(command, args, {\n cwd,\n timeout: timeoutMs,\n ...SPAWN_OPTS,\n });\n\n let stdout = '';\n let stderr = '';\n\n proc.stdout?.on('data', (data: Buffer) => {\n stdout += data.toString();\n });\n proc.stderr?.on('data', (data: Buffer) => {\n stderr += data.toString();\n });\n\n proc.on('close', (code) => {\n resolve({ exitCode: code ?? 1, stdout, stderr });\n });\n\n proc.on('error', () => {\n resolve({ exitCode: 1, stdout, stderr });\n });\n });\n}\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { AuthPatternFinding } from '../../doctor/types.js';
|
|
2
|
-
import type { ValidationIssue } from './types.js';
|
|
3
|
-
export interface SecurityCheckResult {
|
|
4
|
-
/** All security-class findings for this install (errors + warnings). */
|
|
5
|
-
findings: AuthPatternFinding[];
|
|
6
|
-
/**
|
|
7
|
-
* Error-severity findings that must block a successful install. Empty when the
|
|
8
|
-
* install is secure; a non-empty list means install should not report success.
|
|
9
|
-
*/
|
|
10
|
-
blocking: AuthPatternFinding[];
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Run the security subset of doctor's auth-pattern checks against an install
|
|
14
|
-
* directory. Pure file inspection — no network — so it is safe to call both
|
|
15
|
-
* inside the installer's self-correction loop and as the final pre-success gate.
|
|
16
|
-
*
|
|
17
|
-
* This closes the install-validate ↔ doctor gap: previously install could report
|
|
18
|
-
* `success: true` while `workos doctor` immediately found a security hole,
|
|
19
|
-
* because neither the retry loop nor `validateInstallation` ran these checks.
|
|
20
|
-
*/
|
|
21
|
-
export declare function runInstallSecurityChecks(integration: string, installDir: string): Promise<SecurityCheckResult>;
|
|
22
|
-
/** Convert security findings into ValidationIssues for the emitter/report surfaces. */
|
|
23
|
-
export declare function securityFindingsToIssues(findings: AuthPatternFinding[]): ValidationIssue[];
|
|
24
|
-
/**
|
|
25
|
-
* Build an agent correction prompt from security findings so the installer's
|
|
26
|
-
* self-correction loop fixes them before declaring success. Returns an empty
|
|
27
|
-
* string when there is nothing to correct.
|
|
28
|
-
*/
|
|
29
|
-
export declare function formatSecurityFindingsForAgent(findings: AuthPatternFinding[]): string;
|
|
30
|
-
/**
|
|
31
|
-
* Build the error message thrown when error-severity security findings survive
|
|
32
|
-
* the installer's retries — the message that turns a silent insecure "success"
|
|
33
|
-
* into a visible failure.
|
|
34
|
-
*/
|
|
35
|
-
export declare function formatBlockingSecurityError(blocking: AuthPatternFinding[]): string;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { checkAuthPatterns } from '../../doctor/checks/auth-patterns.js';
|
|
2
|
-
import { formatWorkOSCommand } from '../../utils/command-invocation.js';
|
|
3
|
-
/**
|
|
4
|
-
* The "security subset" of `workos doctor`'s auth-pattern checks that the
|
|
5
|
-
* installer enforces. These are the patterns that are *unsafe* or *leak secrets*
|
|
6
|
-
* (an unsafe GET sign-out, an API key in client env/source, an ungitignored
|
|
7
|
-
* .env). Completeness checks (missing middleware/callback/provider) are
|
|
8
|
-
* intentionally excluded here — `validateInstallation` already covers those, and
|
|
9
|
-
* they carry higher false-positive risk than we want gating install success.
|
|
10
|
-
*
|
|
11
|
-
* Keep in sync with the codes emitted by `src/doctor/checks/auth-patterns.ts`.
|
|
12
|
-
*/
|
|
13
|
-
const SECURITY_FINDING_CODES = new Set([
|
|
14
|
-
'SIGNOUT_GET_HANDLER',
|
|
15
|
-
'SIGNOUT_LINK_PREFETCH',
|
|
16
|
-
'API_KEY_LEAKED_TO_CLIENT',
|
|
17
|
-
'API_KEY_IN_SOURCE',
|
|
18
|
-
'ENV_FILE_NOT_GITIGNORED',
|
|
19
|
-
'MIXED_ENVIRONMENT',
|
|
20
|
-
]);
|
|
21
|
-
/** Map an installer integration id to the framework name doctor's checks expect. */
|
|
22
|
-
const INTEGRATION_FRAMEWORK_NAME = {
|
|
23
|
-
nextjs: 'Next.js',
|
|
24
|
-
'react-router': 'React Router',
|
|
25
|
-
'tanstack-start': 'TanStack Start',
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Run the security subset of doctor's auth-pattern checks against an install
|
|
29
|
-
* directory. Pure file inspection — no network — so it is safe to call both
|
|
30
|
-
* inside the installer's self-correction loop and as the final pre-success gate.
|
|
31
|
-
*
|
|
32
|
-
* This closes the install-validate ↔ doctor gap: previously install could report
|
|
33
|
-
* `success: true` while `workos doctor` immediately found a security hole,
|
|
34
|
-
* because neither the retry loop nor `validateInstallation` ran these checks.
|
|
35
|
-
*/
|
|
36
|
-
export async function runInstallSecurityChecks(integration, installDir) {
|
|
37
|
-
const framework = {
|
|
38
|
-
name: INTEGRATION_FRAMEWORK_NAME[integration] ?? null,
|
|
39
|
-
version: null,
|
|
40
|
-
};
|
|
41
|
-
// checkAuthPatterns loads .env files itself; these structs only satisfy the
|
|
42
|
-
// shape its non-Next.js checks read from.
|
|
43
|
-
const environment = {
|
|
44
|
-
apiKeyConfigured: false,
|
|
45
|
-
apiKeyType: null,
|
|
46
|
-
clientId: null,
|
|
47
|
-
redirectUri: null,
|
|
48
|
-
cookieDomain: null,
|
|
49
|
-
baseUrl: null,
|
|
50
|
-
};
|
|
51
|
-
const sdk = {
|
|
52
|
-
name: null,
|
|
53
|
-
version: null,
|
|
54
|
-
latest: null,
|
|
55
|
-
outdated: false,
|
|
56
|
-
isAuthKit: false,
|
|
57
|
-
language: 'javascript',
|
|
58
|
-
};
|
|
59
|
-
const result = await checkAuthPatterns({ installDir }, framework, environment, sdk);
|
|
60
|
-
const findings = result.findings.filter((f) => SECURITY_FINDING_CODES.has(f.code));
|
|
61
|
-
const blocking = findings.filter((f) => f.severity === 'error');
|
|
62
|
-
return { findings, blocking };
|
|
63
|
-
}
|
|
64
|
-
/** Convert security findings into ValidationIssues for the emitter/report surfaces. */
|
|
65
|
-
export function securityFindingsToIssues(findings) {
|
|
66
|
-
return findings.map((f) => ({
|
|
67
|
-
type: 'pattern',
|
|
68
|
-
severity: f.severity,
|
|
69
|
-
message: f.filePath ? `${f.message} (${f.filePath})` : f.message,
|
|
70
|
-
hint: f.remediation,
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Build an agent correction prompt from security findings so the installer's
|
|
75
|
-
* self-correction loop fixes them before declaring success. Returns an empty
|
|
76
|
-
* string when there is nothing to correct.
|
|
77
|
-
*/
|
|
78
|
-
export function formatSecurityFindingsForAgent(findings) {
|
|
79
|
-
if (findings.length === 0)
|
|
80
|
-
return '';
|
|
81
|
-
const lines = findings.map((f) => {
|
|
82
|
-
const loc = f.filePath ? ` in ${f.filePath}` : '';
|
|
83
|
-
const fix = f.remediation ? ` Fix: ${f.remediation}` : '';
|
|
84
|
-
return `- [${f.severity}] ${f.message}${loc}.${fix}`;
|
|
85
|
-
});
|
|
86
|
-
return `Security checks found issues that must be fixed:\n\n${lines.join('\n')}\n\nApply the fixes above, then make sure the project still builds.`;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Build the error message thrown when error-severity security findings survive
|
|
90
|
-
* the installer's retries — the message that turns a silent insecure "success"
|
|
91
|
-
* into a visible failure.
|
|
92
|
-
*/
|
|
93
|
-
export function formatBlockingSecurityError(blocking) {
|
|
94
|
-
const lines = blocking.map((f) => {
|
|
95
|
-
const loc = f.filePath ? ` (${f.filePath})` : '';
|
|
96
|
-
return ` • ${f.code}: ${f.message}${loc}`;
|
|
97
|
-
});
|
|
98
|
-
return [
|
|
99
|
-
'Installation produced insecure code that could not be auto-corrected:',
|
|
100
|
-
'',
|
|
101
|
-
...lines,
|
|
102
|
-
'',
|
|
103
|
-
`Fix the issues above (or run \`${formatWorkOSCommand('doctor')}\` for details and remediation) and re-run the installer.`,
|
|
104
|
-
].join('\n');
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=security-checks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"security-checks.js","sourceRoot":"","sources":["../../../src/lib/validation/security-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE;;;;;;;;;GASG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAS;IAC7C,qBAAqB;IACrB,uBAAuB;IACvB,0BAA0B;IAC1B,mBAAmB;IACnB,yBAAyB;IACzB,mBAAmB;CACpB,CAAC,CAAC;AAEH,oFAAoF;AACpF,MAAM,0BAA0B,GAA2B;IACzD,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,cAAc;IAC9B,gBAAgB,EAAE,gBAAgB;CACnC,CAAC;AAYF;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,WAAmB,EAAE,UAAkB;IACpF,MAAM,SAAS,GAAkB;QAC/B,IAAI,EAAE,0BAA0B,CAAC,WAAW,CAAC,IAAI,IAAI;QACrD,OAAO,EAAE,IAAI;KACd,CAAC;IACF,4EAA4E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{ AuthPatternFinding, FrameworkInfo, EnvironmentInfo, SdkInfo } from '../../doctor/types.js';\nimport type { ValidationIssue } from './types.js';\nimport { formatWorkOSCommand } from '../../utils/command-invocation.js';\n\n/**\n * The \"security subset\" of `workos doctor`'s auth-pattern checks that the\n * installer enforces. These are the patterns that are *unsafe* or *leak secrets*\n * (an unsafe GET sign-out, an API key in client env/source, an ungitignored\n * .env). Completeness checks (missing middleware/callback/provider) are\n * intentionally excluded here — `validateInstallation` already covers those, and\n * they carry higher false-positive risk than we want gating install success.\n *\n * Keep in sync with the codes emitted by `src/doctor/checks/auth-patterns.ts`.\n */\nconst SECURITY_FINDING_CODES = new Set<string>([\n 'SIGNOUT_GET_HANDLER',\n 'SIGNOUT_LINK_PREFETCH',\n 'API_KEY_LEAKED_TO_CLIENT',\n 'API_KEY_IN_SOURCE',\n 'ENV_FILE_NOT_GITIGNORED',\n 'MIXED_ENVIRONMENT',\n]);\n\n/** Map an installer integration id to the framework name doctor's checks expect. */\nconst INTEGRATION_FRAMEWORK_NAME: Record<string, string> = {\n nextjs: 'Next.js',\n 'react-router': 'React Router',\n 'tanstack-start': 'TanStack Start',\n};\n\nexport interface SecurityCheckResult {\n /** All security-class findings for this install (errors + warnings). */\n findings: AuthPatternFinding[];\n /**\n * Error-severity findings that must block a successful install. Empty when the\n * install is secure; a non-empty list means install should not report success.\n */\n blocking: AuthPatternFinding[];\n}\n\n/**\n * Run the security subset of doctor's auth-pattern checks against an install\n * directory. Pure file inspection — no network — so it is safe to call both\n * inside the installer's self-correction loop and as the final pre-success gate.\n *\n * This closes the install-validate ↔ doctor gap: previously install could report\n * `success: true` while `workos doctor` immediately found a security hole,\n * because neither the retry loop nor `validateInstallation` ran these checks.\n */\nexport async function runInstallSecurityChecks(integration: string, installDir: string): Promise<SecurityCheckResult> {\n const framework: FrameworkInfo = {\n name: INTEGRATION_FRAMEWORK_NAME[integration] ?? null,\n version: null,\n };\n // checkAuthPatterns loads .env files itself; these structs only satisfy the\n // shape its non-Next.js checks read from.\n const environment: EnvironmentInfo = {\n apiKeyConfigured: false,\n apiKeyType: null,\n clientId: null,\n redirectUri: null,\n cookieDomain: null,\n baseUrl: null,\n };\n const sdk: SdkInfo = {\n name: null,\n version: null,\n latest: null,\n outdated: false,\n isAuthKit: false,\n language: 'javascript',\n };\n\n const result = await checkAuthPatterns({ installDir }, framework, environment, sdk);\n const findings = result.findings.filter((f) => SECURITY_FINDING_CODES.has(f.code));\n const blocking = findings.filter((f) => f.severity === 'error');\n return { findings, blocking };\n}\n\n/** Convert security findings into ValidationIssues for the emitter/report surfaces. */\nexport function securityFindingsToIssues(findings: AuthPatternFinding[]): ValidationIssue[] {\n return findings.map((f) => ({\n type: 'pattern',\n severity: f.severity,\n message: f.filePath ? `${f.message} (${f.filePath})` : f.message,\n hint: f.remediation,\n }));\n}\n\n/**\n * Build an agent correction prompt from security findings so the installer's\n * self-correction loop fixes them before declaring success. Returns an empty\n * string when there is nothing to correct.\n */\nexport function formatSecurityFindingsForAgent(findings: AuthPatternFinding[]): string {\n if (findings.length === 0) return '';\n const lines = findings.map((f) => {\n const loc = f.filePath ? ` in ${f.filePath}` : '';\n const fix = f.remediation ? ` Fix: ${f.remediation}` : '';\n return `- [${f.severity}] ${f.message}${loc}.${fix}`;\n });\n return `Security checks found issues that must be fixed:\\n\\n${lines.join('\\n')}\\n\\nApply the fixes above, then make sure the project still builds.`;\n}\n\n/**\n * Build the error message thrown when error-severity security findings survive\n * the installer's retries — the message that turns a silent insecure \"success\"\n * into a visible failure.\n */\nexport function formatBlockingSecurityError(blocking: AuthPatternFinding[]): string {\n const lines = blocking.map((f) => {\n const loc = f.filePath ? ` (${f.filePath})` : '';\n return ` • ${f.code}: ${f.message}${loc}`;\n });\n return [\n 'Installation produced insecure code that could not be auto-corrected:',\n '',\n ...lines,\n '',\n `Fix the issues above (or run \\`${formatWorkOSCommand('doctor')}\\` for details and remediation) and re-run the installer.`,\n ].join('\\n');\n}\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export type ValidationSeverity = 'error' | 'warning';
|
|
2
|
-
export type ValidationIssueType = 'package' | 'env' | 'file' | 'pattern';
|
|
3
|
-
export interface ValidationIssue {
|
|
4
|
-
type: ValidationIssueType;
|
|
5
|
-
severity: ValidationSeverity;
|
|
6
|
-
message: string;
|
|
7
|
-
hint?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface ValidationResult {
|
|
10
|
-
passed: boolean;
|
|
11
|
-
framework: string;
|
|
12
|
-
issues: ValidationIssue[];
|
|
13
|
-
durationMs: number;
|
|
14
|
-
}
|
|
15
|
-
export interface PackageRule {
|
|
16
|
-
name: string;
|
|
17
|
-
location?: 'dependencies' | 'devDependencies' | 'any';
|
|
18
|
-
}
|
|
19
|
-
export interface EnvVarRule {
|
|
20
|
-
name: string;
|
|
21
|
-
required?: boolean;
|
|
22
|
-
alternates?: string[];
|
|
23
|
-
}
|
|
24
|
-
export interface FileRule {
|
|
25
|
-
path: string;
|
|
26
|
-
mustContain?: string[];
|
|
27
|
-
mustContainAny?: string[];
|
|
28
|
-
}
|
|
29
|
-
export interface VariantRules {
|
|
30
|
-
files?: FileRule[];
|
|
31
|
-
packages?: PackageRule[];
|
|
32
|
-
envVars?: EnvVarRule[];
|
|
33
|
-
}
|
|
34
|
-
export interface ValidationRules {
|
|
35
|
-
framework: string;
|
|
36
|
-
packages: PackageRule[];
|
|
37
|
-
envVars: EnvVarRule[];
|
|
38
|
-
files: FileRule[];
|
|
39
|
-
variants?: Record<string, VariantRules>;
|
|
40
|
-
}
|
|
41
|
-
export interface QuickCheckResult {
|
|
42
|
-
passed: boolean;
|
|
43
|
-
phase: 'typecheck' | 'build';
|
|
44
|
-
issues: ValidationIssue[];
|
|
45
|
-
/** Formatted for agent consumption — actionable, not just error messages */
|
|
46
|
-
agentPrompt: string | null;
|
|
47
|
-
durationMs: number;
|
|
48
|
-
}
|
|
49
|
-
export interface QuickChecksOutput {
|
|
50
|
-
passed: boolean;
|
|
51
|
-
results: QuickCheckResult[];
|
|
52
|
-
/** Combined agent-ready prompt summarizing all failures */
|
|
53
|
-
agentRetryPrompt: string | null;
|
|
54
|
-
totalDurationMs: number;
|
|
55
|
-
}
|
|
56
|
-
export type { BuildResult } from './build-validator.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/validation/types.ts"],"names":[],"mappings":"","sourcesContent":["export type ValidationSeverity = 'error' | 'warning';\nexport type ValidationIssueType = 'package' | 'env' | 'file' | 'pattern';\n\nexport interface ValidationIssue {\n type: ValidationIssueType;\n severity: ValidationSeverity;\n message: string;\n hint?: string; // How to fix\n}\n\nexport interface ValidationResult {\n passed: boolean;\n framework: string;\n issues: ValidationIssue[];\n durationMs: number;\n}\n\n// Rule definitions (matches JSON schema)\nexport interface PackageRule {\n name: string;\n location?: 'dependencies' | 'devDependencies' | 'any'; // default: 'any'\n}\n\nexport interface EnvVarRule {\n name: string;\n required?: boolean; // default: true\n alternates?: string[]; // alternate env var names (e.g., VITE_WORKOS_CLIENT_ID)\n}\n\nexport interface FileRule {\n path: string; // glob pattern, e.g., \"middleware.ts\" or \"app/**/callback/**/route.ts\"\n mustContain?: string[]; // strings that must appear in file\n mustContainAny?: string[]; // at least one must appear\n}\n\nexport interface VariantRules {\n files?: FileRule[];\n packages?: PackageRule[];\n envVars?: EnvVarRule[];\n}\n\nexport interface ValidationRules {\n framework: string;\n packages: PackageRule[];\n envVars: EnvVarRule[];\n files: FileRule[];\n variants?: Record<string, VariantRules>;\n}\n\nexport interface QuickCheckResult {\n passed: boolean;\n phase: 'typecheck' | 'build';\n issues: ValidationIssue[];\n /** Formatted for agent consumption — actionable, not just error messages */\n agentPrompt: string | null;\n durationMs: number;\n}\n\nexport interface QuickChecksOutput {\n passed: boolean;\n results: QuickCheckResult[];\n /** Combined agent-ready prompt summarizing all failures */\n agentRetryPrompt: string | null;\n totalDurationMs: number;\n}\n\n// Re-export BuildResult from build-validator\nexport type { BuildResult } from './build-validator.js';\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ValidationResult, ValidationRules, ValidationIssue } from './types.js';
|
|
2
|
-
export interface ValidateOptions {
|
|
3
|
-
variant?: string;
|
|
4
|
-
runBuild?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare function validateInstallation(framework: string, projectDir: string, options?: ValidateOptions): Promise<ValidationResult>;
|
|
7
|
-
export declare function validatePackages(rules: ValidationRules, projectDir: string): Promise<ValidationIssue[]>;
|
|
8
|
-
export declare function validateEnvVars(rules: ValidationRules, projectDir: string): Promise<ValidationIssue[]>;
|
|
9
|
-
export declare function validateFiles(rules: ValidationRules, projectDir: string): Promise<ValidationIssue[]>;
|
|
10
|
-
/**
|
|
11
|
-
* Framework-specific cross-validations that require reading multiple sources.
|
|
12
|
-
*/
|
|
13
|
-
export declare function validateFrameworkSpecific(framework: string, projectDir: string): Promise<ValidationIssue[]>;
|