workos 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -145
- package/dist/bin.js +129 -50
- package/dist/bin.js.map +1 -1
- package/dist/commands/api/index.js +18 -10
- package/dist/commands/api/index.js.map +1 -1
- package/dist/commands/api/interactive.js +11 -11
- package/dist/commands/api/interactive.js.map +1 -1
- package/dist/commands/claim.js +28 -16
- package/dist/commands/claim.js.map +1 -1
- package/dist/commands/connection.js +3 -3
- package/dist/commands/connection.js.map +1 -1
- package/dist/commands/debug.js +6 -6
- package/dist/commands/debug.js.map +1 -1
- package/dist/commands/dev.d.ts +7 -8
- package/dist/commands/dev.js +14 -14
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/directory.js +3 -3
- package/dist/commands/directory.js.map +1 -1
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/emulate.d.ts +1 -0
- package/dist/commands/emulate.js +3 -2
- package/dist/commands/emulate.js.map +1 -1
- package/dist/commands/env.d.ts +10 -0
- package/dist/commands/env.js +94 -18
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/install.js +8 -13
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/login.d.ts +25 -15
- package/dist/commands/login.js +126 -71
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +4 -4
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/mcp.js +7 -16
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/migrations.js +2 -1
- package/dist/commands/migrations.js.map +1 -1
- package/dist/commands/seed.js +5 -4
- package/dist/commands/seed.js.map +1 -1
- package/dist/commands/setup.d.ts +50 -0
- package/dist/commands/setup.js +237 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/vault-run.js +3 -2
- package/dist/commands/vault-run.js.map +1 -1
- package/dist/commands/verify-login.d.ts +25 -0
- package/dist/commands/verify-login.js +158 -0
- package/dist/commands/verify-login.js.map +1 -0
- package/dist/doctor/issues.js +3 -2
- package/dist/doctor/issues.js.map +1 -1
- package/dist/doctor/output.js +2 -1
- package/dist/doctor/output.js.map +1 -1
- package/dist/integrations/dotnet/index.js +1 -1
- package/dist/integrations/dotnet/index.js.map +1 -1
- package/dist/integrations/elixir/index.js +1 -1
- package/dist/integrations/elixir/index.js.map +1 -1
- package/dist/integrations/go/index.js +1 -1
- package/dist/integrations/go/index.js.map +1 -1
- package/dist/integrations/nextjs/index.js +8 -5
- package/dist/integrations/nextjs/index.js.map +1 -1
- package/dist/integrations/nextjs/utils.d.ts +1 -1
- package/dist/integrations/nextjs/utils.js +21 -6
- package/dist/integrations/nextjs/utils.js.map +1 -1
- package/dist/integrations/react-router/index.js +5 -5
- package/dist/integrations/react-router/index.js.map +1 -1
- package/dist/integrations/react-router/utils.js +28 -12
- package/dist/integrations/react-router/utils.js.map +1 -1
- package/dist/integrations/ruby/index.js +1 -1
- package/dist/integrations/ruby/index.js.map +1 -1
- package/dist/lib/adapters/cli-adapter.d.ts +33 -4
- package/dist/lib/adapters/cli-adapter.js +251 -135
- package/dist/lib/adapters/cli-adapter.js.map +1 -1
- package/dist/lib/adapters/dashboard-adapter.js +3 -3
- package/dist/lib/adapters/dashboard-adapter.js.map +1 -1
- package/dist/lib/adapters/headless-adapter.d.ts +7 -0
- package/dist/lib/adapters/headless-adapter.js +42 -5
- package/dist/lib/adapters/headless-adapter.js.map +1 -1
- package/dist/lib/agent-interface.js +15 -1
- package/dist/lib/agent-interface.js.map +1 -1
- package/dist/lib/agent-runner.js +1 -1
- package/dist/lib/agent-runner.js.map +1 -1
- package/dist/lib/api-key.js +2 -1
- package/dist/lib/api-key.js.map +1 -1
- package/dist/lib/completion-data.d.ts +33 -0
- package/dist/lib/completion-data.js +33 -0
- package/dist/lib/completion-data.js.map +1 -0
- package/dist/lib/config-store.d.ts +13 -0
- package/dist/lib/config-store.js +24 -0
- package/dist/lib/config-store.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +8 -0
- package/dist/lib/constants.js +8 -0
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/events.d.ts +34 -1
- package/dist/lib/events.js.map +1 -1
- package/dist/lib/framework-config.d.ts +6 -0
- package/dist/lib/framework-config.js.map +1 -1
- package/dist/lib/installer-core.d.ts +14 -1
- package/dist/lib/installer-core.js +24 -5
- package/dist/lib/installer-core.js.map +1 -1
- package/dist/lib/installer-core.types.d.ts +3 -1
- package/dist/lib/installer-core.types.js.map +1 -1
- package/dist/lib/mcp-clients.d.ts +6 -0
- package/dist/lib/mcp-clients.js +13 -0
- package/dist/lib/mcp-clients.js.map +1 -1
- package/dist/lib/port-detection.js +19 -13
- package/dist/lib/port-detection.js.map +1 -1
- package/dist/lib/preferences.d.ts +30 -2
- package/dist/lib/preferences.js +34 -8
- package/dist/lib/preferences.js.map +1 -1
- package/dist/lib/run-with-core.js +40 -3
- package/dist/lib/run-with-core.js.map +1 -1
- package/dist/lib/telemetry-notice.d.ts +5 -5
- package/dist/lib/telemetry-notice.js +7 -8
- package/dist/lib/telemetry-notice.js.map +1 -1
- package/dist/lib/unclaimed-env-provision.js +15 -12
- package/dist/lib/unclaimed-env-provision.js.map +1 -1
- package/dist/lib/unclaimed-warning.js +4 -3
- package/dist/lib/unclaimed-warning.js.map +1 -1
- package/dist/lib/validation/security-checks.js +2 -1
- package/dist/lib/validation/security-checks.js.map +1 -1
- package/dist/lib/validation/validator.js +30 -3
- package/dist/lib/validation/validator.js.map +1 -1
- package/dist/lib/workos-management.js +26 -19
- package/dist/lib/workos-management.js.map +1 -1
- package/dist/run.d.ts +1 -0
- package/dist/run.js +5 -1
- package/dist/run.js.map +1 -1
- package/dist/steps/add-or-update-environment-variables.js +10 -10
- package/dist/steps/add-or-update-environment-variables.js.map +1 -1
- package/dist/steps/run-prettier.js +3 -3
- package/dist/steps/run-prettier.js.map +1 -1
- package/dist/steps/upload-environment-variables/index.js +15 -3
- package/dist/steps/upload-environment-variables/index.js.map +1 -1
- package/dist/steps/upload-environment-variables/providers/vercel.js +2 -2
- package/dist/steps/upload-environment-variables/providers/vercel.js.map +1 -1
- package/dist/utils/box.d.ts +6 -30
- package/dist/utils/box.js +8 -95
- package/dist/utils/box.js.map +1 -1
- package/dist/utils/cli-symbols.d.ts +14 -2
- package/dist/utils/cli-symbols.js +12 -0
- package/dist/utils/cli-symbols.js.map +1 -1
- package/dist/utils/debug.js +3 -3
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/environment.js +1 -1
- package/dist/utils/environment.js.map +1 -1
- package/dist/utils/help-json.js +115 -4
- package/dist/utils/help-json.js.map +1 -1
- package/dist/utils/package-manager.js +1 -1
- package/dist/utils/package-manager.js.map +1 -1
- package/dist/utils/recovery-hints.d.ts +5 -0
- package/dist/utils/recovery-hints.js +12 -0
- package/dist/utils/recovery-hints.js.map +1 -1
- package/dist/utils/summary-box.d.ts +8 -1
- package/dist/utils/summary-box.js +67 -4
- package/dist/utils/summary-box.js.map +1 -1
- package/dist/utils/types.d.ts +10 -0
- package/dist/utils/types.js.map +1 -1
- package/dist/utils/{clack-utils.d.ts → ui-utils.d.ts} +1 -1
- package/dist/utils/{clack-utils.js → ui-utils.js} +64 -37
- package/dist/utils/ui-utils.js.map +1 -0
- package/dist/utils/ui.d.ts +148 -0
- package/dist/utils/ui.js +368 -0
- package/dist/utils/ui.js.map +1 -0
- package/package.json +5 -13
- package/dist/check-coverage.ts +0 -237
- package/dist/emulate/core/id.d.ts +0 -48
- package/dist/emulate/core/id.js +0 -73
- package/dist/emulate/core/id.js.map +0 -1
- package/dist/emulate/core/index.d.ts +0 -8
- package/dist/emulate/core/index.js +0 -8
- package/dist/emulate/core/index.js.map +0 -1
- package/dist/emulate/core/jwt.d.ts +0 -28
- package/dist/emulate/core/jwt.js +0 -78
- package/dist/emulate/core/jwt.js.map +0 -1
- package/dist/emulate/core/middleware/auth.d.ts +0 -15
- package/dist/emulate/core/middleware/auth.js +0 -17
- package/dist/emulate/core/middleware/auth.js.map +0 -1
- package/dist/emulate/core/middleware/error-handler.d.ts +0 -22
- package/dist/emulate/core/middleware/error-handler.js +0 -72
- package/dist/emulate/core/middleware/error-handler.js.map +0 -1
- package/dist/emulate/core/pagination.d.ts +0 -27
- package/dist/emulate/core/pagination.js +0 -43
- package/dist/emulate/core/pagination.js.map +0 -1
- package/dist/emulate/core/plugin.d.ts +0 -15
- package/dist/emulate/core/plugin.js +0 -2
- package/dist/emulate/core/plugin.js.map +0 -1
- package/dist/emulate/core/server.d.ts +0 -17
- package/dist/emulate/core/server.js +0 -90
- package/dist/emulate/core/server.js.map +0 -1
- package/dist/emulate/core/store.d.ts +0 -44
- package/dist/emulate/core/store.js +0 -169
- package/dist/emulate/core/store.js.map +0 -1
- package/dist/emulate/index.d.ts +0 -25
- package/dist/emulate/index.js +0 -47
- package/dist/emulate/index.js.map +0 -1
- package/dist/emulate/workos/constants.d.ts +0 -56
- package/dist/emulate/workos/constants.js +0 -56
- package/dist/emulate/workos/constants.js.map +0 -1
- package/dist/emulate/workos/entities.d.ts +0 -360
- package/dist/emulate/workos/entities.js +0 -2
- package/dist/emulate/workos/entities.js.map +0 -1
- package/dist/emulate/workos/event-bus.d.ts +0 -17
- package/dist/emulate/workos/event-bus.js +0 -70
- package/dist/emulate/workos/event-bus.js.map +0 -1
- package/dist/emulate/workos/helpers.d.ts +0 -72
- package/dist/emulate/workos/helpers.js +0 -211
- package/dist/emulate/workos/helpers.js.map +0 -1
- package/dist/emulate/workos/index.d.ts +0 -93
- package/dist/emulate/workos/index.js +0 -326
- package/dist/emulate/workos/index.js.map +0 -1
- package/dist/emulate/workos/role-helpers.d.ts +0 -21
- package/dist/emulate/workos/role-helpers.js +0 -130
- package/dist/emulate/workos/role-helpers.js.map +0 -1
- package/dist/emulate/workos/routes/api-keys.d.ts +0 -2
- package/dist/emulate/workos/routes/api-keys.js +0 -32
- package/dist/emulate/workos/routes/api-keys.js.map +0 -1
- package/dist/emulate/workos/routes/audit-logs.d.ts +0 -2
- package/dist/emulate/workos/routes/audit-logs.js +0 -104
- package/dist/emulate/workos/routes/audit-logs.js.map +0 -1
- package/dist/emulate/workos/routes/auth-challenges.d.ts +0 -2
- package/dist/emulate/workos/routes/auth-challenges.js +0 -51
- package/dist/emulate/workos/routes/auth-challenges.js.map +0 -1
- package/dist/emulate/workos/routes/auth-factors.d.ts +0 -2
- package/dist/emulate/workos/routes/auth-factors.js +0 -51
- package/dist/emulate/workos/routes/auth-factors.js.map +0 -1
- package/dist/emulate/workos/routes/auth.d.ts +0 -2
- package/dist/emulate/workos/routes/auth.js +0 -350
- package/dist/emulate/workos/routes/auth.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-checks.d.ts +0 -10
- package/dist/emulate/workos/routes/authorization-checks.js +0 -123
- package/dist/emulate/workos/routes/authorization-checks.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-org-roles.d.ts +0 -2
- package/dist/emulate/workos/routes/authorization-org-roles.js +0 -64
- package/dist/emulate/workos/routes/authorization-org-roles.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-permissions.d.ts +0 -2
- package/dist/emulate/workos/routes/authorization-permissions.js +0 -67
- package/dist/emulate/workos/routes/authorization-permissions.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-resources.d.ts +0 -2
- package/dist/emulate/workos/routes/authorization-resources.js +0 -117
- package/dist/emulate/workos/routes/authorization-resources.js.map +0 -1
- package/dist/emulate/workos/routes/authorization-roles.d.ts +0 -2
- package/dist/emulate/workos/routes/authorization-roles.js +0 -13
- package/dist/emulate/workos/routes/authorization-roles.js.map +0 -1
- package/dist/emulate/workos/routes/config.d.ts +0 -2
- package/dist/emulate/workos/routes/config.js +0 -57
- package/dist/emulate/workos/routes/config.js.map +0 -1
- package/dist/emulate/workos/routes/connect.d.ts +0 -2
- package/dist/emulate/workos/routes/connect.js +0 -65
- package/dist/emulate/workos/routes/connect.js.map +0 -1
- package/dist/emulate/workos/routes/connections.d.ts +0 -2
- package/dist/emulate/workos/routes/connections.js +0 -73
- package/dist/emulate/workos/routes/connections.js.map +0 -1
- package/dist/emulate/workos/routes/data-integrations.d.ts +0 -2
- package/dist/emulate/workos/routes/data-integrations.js +0 -55
- package/dist/emulate/workos/routes/data-integrations.js.map +0 -1
- package/dist/emulate/workos/routes/directories.d.ts +0 -2
- package/dist/emulate/workos/routes/directories.js +0 -90
- package/dist/emulate/workos/routes/directories.js.map +0 -1
- package/dist/emulate/workos/routes/email-verification.d.ts +0 -2
- package/dist/emulate/workos/routes/email-verification.js +0 -49
- package/dist/emulate/workos/routes/email-verification.js.map +0 -1
- package/dist/emulate/workos/routes/events.d.ts +0 -2
- package/dist/emulate/workos/routes/events.js +0 -18
- package/dist/emulate/workos/routes/events.js.map +0 -1
- package/dist/emulate/workos/routes/feature-flags.d.ts +0 -2
- package/dist/emulate/workos/routes/feature-flags.js +0 -103
- package/dist/emulate/workos/routes/feature-flags.js.map +0 -1
- package/dist/emulate/workos/routes/invitations.d.ts +0 -2
- package/dist/emulate/workos/routes/invitations.js +0 -122
- package/dist/emulate/workos/routes/invitations.js.map +0 -1
- package/dist/emulate/workos/routes/legacy-mfa.d.ts +0 -2
- package/dist/emulate/workos/routes/legacy-mfa.js +0 -75
- package/dist/emulate/workos/routes/legacy-mfa.js.map +0 -1
- package/dist/emulate/workos/routes/magic-auth.d.ts +0 -2
- package/dist/emulate/workos/routes/magic-auth.js +0 -32
- package/dist/emulate/workos/routes/magic-auth.js.map +0 -1
- package/dist/emulate/workos/routes/memberships.d.ts +0 -2
- package/dist/emulate/workos/routes/memberships.js +0 -114
- package/dist/emulate/workos/routes/memberships.js.map +0 -1
- package/dist/emulate/workos/routes/organization-domains.d.ts +0 -2
- package/dist/emulate/workos/routes/organization-domains.js +0 -58
- package/dist/emulate/workos/routes/organization-domains.js.map +0 -1
- package/dist/emulate/workos/routes/organizations.d.ts +0 -2
- package/dist/emulate/workos/routes/organizations.js +0 -131
- package/dist/emulate/workos/routes/organizations.js.map +0 -1
- package/dist/emulate/workos/routes/password-reset.d.ts +0 -2
- package/dist/emulate/workos/routes/password-reset.js +0 -61
- package/dist/emulate/workos/routes/password-reset.js.map +0 -1
- package/dist/emulate/workos/routes/pipes.d.ts +0 -2
- package/dist/emulate/workos/routes/pipes.js +0 -82
- package/dist/emulate/workos/routes/pipes.js.map +0 -1
- package/dist/emulate/workos/routes/portal.d.ts +0 -2
- package/dist/emulate/workos/routes/portal.js +0 -18
- package/dist/emulate/workos/routes/portal.js.map +0 -1
- package/dist/emulate/workos/routes/radar.d.ts +0 -2
- package/dist/emulate/workos/routes/radar.js +0 -41
- package/dist/emulate/workos/routes/radar.js.map +0 -1
- package/dist/emulate/workos/routes/sessions.d.ts +0 -2
- package/dist/emulate/workos/routes/sessions.js +0 -51
- package/dist/emulate/workos/routes/sessions.js.map +0 -1
- package/dist/emulate/workos/routes/sso.d.ts +0 -2
- package/dist/emulate/workos/routes/sso.js +0 -161
- package/dist/emulate/workos/routes/sso.js.map +0 -1
- package/dist/emulate/workos/routes/user-features.d.ts +0 -2
- package/dist/emulate/workos/routes/user-features.js +0 -50
- package/dist/emulate/workos/routes/user-features.js.map +0 -1
- package/dist/emulate/workos/routes/users.d.ts +0 -2
- package/dist/emulate/workos/routes/users.js +0 -129
- package/dist/emulate/workos/routes/users.js.map +0 -1
- package/dist/emulate/workos/routes/webhook-endpoints.d.ts +0 -2
- package/dist/emulate/workos/routes/webhook-endpoints.js +0 -67
- package/dist/emulate/workos/routes/webhook-endpoints.js.map +0 -1
- package/dist/emulate/workos/routes/widgets.d.ts +0 -2
- package/dist/emulate/workos/routes/widgets.js +0 -27
- package/dist/emulate/workos/routes/widgets.js.map +0 -1
- package/dist/emulate/workos/store.d.ts +0 -48
- package/dist/emulate/workos/store.js +0 -102
- package/dist/emulate/workos/store.js.map +0 -1
- package/dist/emulate/workos/webhook-signer.d.ts +0 -1
- package/dist/emulate/workos/webhook-signer.js +0 -8
- package/dist/emulate/workos/webhook-signer.js.map +0 -1
- package/dist/gen-routes-lib.spec.ts +0 -659
- package/dist/gen-routes-lib.ts +0 -647
- package/dist/gen-routes.ts +0 -96
- package/dist/lib/mcp-notice.d.ts +0 -72
- package/dist/lib/mcp-notice.js +0 -275
- package/dist/lib/mcp-notice.js.map +0 -1
- package/dist/utils/clack-utils.js.map +0 -1
- package/dist/utils/clack.d.ts +0 -5
- package/dist/utils/clack.js +0 -34
- package/dist/utils/clack.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/go/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,uCAAuC;AACvC,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C;;GAEG;AACH,SAAS,iBAAiB,CAAC,UAAkB;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AAU,EAAE,gBAAgB,CAAC,UAAU;SACxC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IAChB,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5E,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEhF,MAAM,KAAK,GAAa;QACtB,wCAAwC;QACxC,EAAE;QACF,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3F,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvF,eAAe,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACxC,EAAE;QACF,4GAA4G;KAC7G,CAAC;IAEF,MAAM,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEpC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/* Go integration — auto-discovered by registry */\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport { SPINNER_MESSAGE } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\nimport { analytics } from '../../utils/analytics.js';\nimport { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';\nimport { initializeAgent, runAgent } from '../../lib/agent-interface.js';\nimport { getOrAskForWorkOSCredentials } from '../../utils/clack-utils.js';\nimport { autoConfigureWorkOSEnvironment } from '../../lib/workos-management.js';\nimport { validateInstallation } from '../../lib/validation/index.js';\nimport { parseEnvFile } from '../../utils/env-parser.js';\nimport { getReference } from '@workos/skills';\n\n/** Default port for Go HTTP servers */\nconst GO_DEFAULT_PORT = 8080;\nconst GO_CALLBACK_PATH = '/auth/callback';\n\n/**\n * Detect whether go.mod includes the Gin web framework.\n */\nfunction detectGoFramework(installDir: string): 'gin' | 'stdlib' {\n try {\n const goMod = readFileSync(join(installDir, 'go.mod'), 'utf-8');\n return goMod.includes('github.com/gin-gonic/gin') ? 'gin' : 'stdlib';\n } catch {\n return 'stdlib';\n }\n}\n\n/**\n * Write environment variables to .env (Go convention, not .env.local).\n * Merges with existing .env if present.\n */\nfunction writeGoEnv(installDir: string, envVars: Record<string, string>): void {\n const envPath = join(installDir, '.env');\n let existing: Record<string, string> = {};\n\n if (existsSync(envPath)) {\n existing = parseEnvFile(readFileSync(envPath, 'utf-8'));\n }\n\n const merged = { ...existing, ...envVars };\n const content = Object.entries(merged)\n .map(([key, value]) => `${key}=${value}`)\n .join('\\n');\n\n writeFileSync(envPath, content + '\\n');\n}\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'Go',\n integration: 'go',\n docsUrl: 'https://workos.com/docs/authkit/vanilla/go',\n skillName: 'workos-go',\n language: 'go',\n stability: 'experimental',\n priority: 50,\n packageManager: 'go',\n manifestFile: 'go.mod',\n gatherContext: async (options) => {\n return { framework: detectGoFramework(options.installDir) };\n },\n },\n\n detection: {\n packageName: 'github.com/workos/workos-go/v4',\n packageDisplayName: 'Go',\n getVersion: () => undefined,\n },\n\n environment: {\n uploadToHosting: false,\n requiresApiKey: true,\n getEnvVars: (apiKey: string, clientId: string) => ({\n WORKOS_API_KEY: apiKey,\n WORKOS_CLIENT_ID: clientId,\n }),\n },\n\n analytics: {\n getTags: (context: any) => (context?.framework ? { 'go-framework': context.framework } : {}),\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => (context?.framework ? [`Go web framework: ${context.framework}`] : []),\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your Go project structure',\n 'Installed workos-go SDK',\n 'Created authentication handlers',\n 'Configured environment variables',\n ],\n getOutroNextSteps: () => [\n 'Run `go run .` to start your server',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\n/**\n * Run the Go integration.\n *\n * Custom flow that bypasses runAgentInstaller because the universal runner\n * assumes package.json exists (getPackageDotJson aborts without it) and\n * port-detection/env-writer are JS-specific.\n */\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n options.emitter?.emit('status', {\n message: `Setting up WorkOS AuthKit for ${config.metadata.name}`,\n });\n\n analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {\n action: 'started agent integration',\n integration: config.metadata.integration,\n });\n\n // Get WorkOS credentials\n const { apiKey, clientId } = await getOrAskForWorkOSCredentials(options, config.environment.requiresApiKey);\n\n // Auto-configure WorkOS environment (redirect URI, CORS)\n const callerHandledConfig = Boolean(options.apiKey || options.clientId);\n if (!callerHandledConfig && apiKey) {\n const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;\n await autoConfigureWorkOSEnvironment(apiKey, config.metadata.integration, GO_DEFAULT_PORT, {\n homepageUrl: options.homepageUrl,\n redirectUri,\n });\n }\n\n // Gather Go-specific context\n const frameworkContext = config.metadata.gatherContext ? await config.metadata.gatherContext(options) : {};\n\n // Write .env (not .env.local — Go convention)\n if (!callerHandledConfig) {\n const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;\n writeGoEnv(options.installDir, {\n ...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),\n WORKOS_CLIENT_ID: clientId,\n WORKOS_REDIRECT_URI: redirectUri,\n });\n }\n\n // Set analytics tags\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n // Build prompt\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\n const additionalContext =\n additionalLines.length > 0 ? '\\n' + additionalLines.map((line) => `- ${line}`).join('\\n') : '';\n\n const skillName = config.metadata.skillName!;\n const refContent = await getReference(skillName);\n const integrationPrompt = `You are integrating WorkOS AuthKit into this ${config.metadata.name} application.\n\n## Project Context\n\n- Language: Go\n- Framework: ${frameworkContext.framework === 'gin' ? 'Gin' : 'stdlib net/http'}${additionalContext}\n\n## Environment\n\nThe following environment variables have been configured in .env:\n- WORKOS_API_KEY\n- WORKOS_CLIENT_ID\n- WORKOS_REDIRECT_URI\n\n## Integration Instructions\n\n${refContent}\n\nReport your progress using [STATUS] prefixes.\n\nBegin integration now.`;\n\n // Initialize and run agent\n const agent = await initializeAgent(\n {\n workingDirectory: options.installDir,\n workOSApiKey: apiKey,\n workOSApiHost: 'https://api.workos.com',\n },\n options,\n );\n\n const agentResult = await runAgent(\n agent,\n integrationPrompt,\n options,\n {\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n },\n options.emitter,\n );\n\n if (agentResult.error) {\n await analytics.shutdown('error');\n const message = agentResult.errorMessage || agentResult.error;\n throw new Error(message);\n }\n\n // Post-installation validation (gracefully skips — no rules file for Go)\n if (!options.noValidate) {\n options.emitter?.emit('validation:start', { framework: config.metadata.integration });\n\n const validationResult = await validateInstallation(config.metadata.integration, options.installDir, {\n runBuild: true,\n });\n\n if (validationResult.issues.length > 0) {\n options.emitter?.emit('validation:issues', { issues: validationResult.issues });\n }\n\n options.emitter?.emit('validation:complete', {\n passed: validationResult.passed,\n issueCount: validationResult.issues.length,\n durationMs: validationResult.durationMs,\n });\n }\n\n // Build summary\n const changes = config.ui.getOutroChanges(frameworkContext).filter(Boolean);\n const nextSteps = config.ui.getOutroNextSteps(frameworkContext).filter(Boolean);\n\n const lines: string[] = [\n 'Successfully installed WorkOS AuthKit!',\n '',\n ...(changes.length > 0 ? ['What the agent did:', ...changes.map((c) => `• ${c}`), ''] : []),\n ...(nextSteps.length > 0 ? ['Next steps:', ...nextSteps.map((s) => `• ${s}`), ''] : []),\n `Learn more: ${config.metadata.docsUrl}`,\n '',\n 'Note: This installer uses an LLM agent to analyze and modify your project. Please review the changes made.',\n ];\n\n await analytics.shutdown('success');\n\n return lines.join('\\n');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/go/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,uCAAuC;AACvC,MAAM,eAAe,GAAG,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;YAC3C,MAAM,EAAE,gBAAgB,CAAC,MAAM;YAC/B,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM;YAC1C,UAAU,EAAE,gBAAgB,CAAC,UAAU;SACxC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;IAChB,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5E,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEhF,MAAM,KAAK,GAAa;QACtB,wCAAwC;QACxC,EAAE;QACF,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3F,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvF,eAAe,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACxC,EAAE;QACF,4GAA4G;KAC7G,CAAC;IAEF,MAAM,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEpC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/* Go integration — auto-discovered by registry */\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport { SPINNER_MESSAGE } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\nimport { analytics } from '../../utils/analytics.js';\nimport { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';\nimport { initializeAgent, runAgent } from '../../lib/agent-interface.js';\nimport { getOrAskForWorkOSCredentials } from '../../utils/ui-utils.js';\nimport { autoConfigureWorkOSEnvironment } from '../../lib/workos-management.js';\nimport { validateInstallation } from '../../lib/validation/index.js';\nimport { parseEnvFile } from '../../utils/env-parser.js';\nimport { getReference } from '@workos/skills';\n\n/** Default port for Go HTTP servers */\nconst GO_DEFAULT_PORT = 8080;\nconst GO_CALLBACK_PATH = '/auth/callback';\n\n/**\n * Detect whether go.mod includes the Gin web framework.\n */\nfunction detectGoFramework(installDir: string): 'gin' | 'stdlib' {\n try {\n const goMod = readFileSync(join(installDir, 'go.mod'), 'utf-8');\n return goMod.includes('github.com/gin-gonic/gin') ? 'gin' : 'stdlib';\n } catch {\n return 'stdlib';\n }\n}\n\n/**\n * Write environment variables to .env (Go convention, not .env.local).\n * Merges with existing .env if present.\n */\nfunction writeGoEnv(installDir: string, envVars: Record<string, string>): void {\n const envPath = join(installDir, '.env');\n let existing: Record<string, string> = {};\n\n if (existsSync(envPath)) {\n existing = parseEnvFile(readFileSync(envPath, 'utf-8'));\n }\n\n const merged = { ...existing, ...envVars };\n const content = Object.entries(merged)\n .map(([key, value]) => `${key}=${value}`)\n .join('\\n');\n\n writeFileSync(envPath, content + '\\n');\n}\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'Go',\n integration: 'go',\n docsUrl: 'https://workos.com/docs/authkit/vanilla/go',\n skillName: 'workos-go',\n language: 'go',\n stability: 'experimental',\n priority: 50,\n packageManager: 'go',\n manifestFile: 'go.mod',\n gatherContext: async (options) => {\n return { framework: detectGoFramework(options.installDir) };\n },\n },\n\n detection: {\n packageName: 'github.com/workos/workos-go/v4',\n packageDisplayName: 'Go',\n getVersion: () => undefined,\n },\n\n environment: {\n uploadToHosting: false,\n requiresApiKey: true,\n getEnvVars: (apiKey: string, clientId: string) => ({\n WORKOS_API_KEY: apiKey,\n WORKOS_CLIENT_ID: clientId,\n }),\n },\n\n analytics: {\n getTags: (context: any) => (context?.framework ? { 'go-framework': context.framework } : {}),\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => (context?.framework ? [`Go web framework: ${context.framework}`] : []),\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your Go project structure',\n 'Installed workos-go SDK',\n 'Created authentication handlers',\n 'Configured environment variables',\n ],\n getOutroNextSteps: () => [\n 'Run `go run .` to start your server',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\n/**\n * Run the Go integration.\n *\n * Custom flow that bypasses runAgentInstaller because the universal runner\n * assumes package.json exists (getPackageDotJson aborts without it) and\n * port-detection/env-writer are JS-specific.\n */\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n options.emitter?.emit('status', {\n message: `Setting up WorkOS AuthKit for ${config.metadata.name}`,\n });\n\n analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {\n action: 'started agent integration',\n integration: config.metadata.integration,\n });\n\n // Get WorkOS credentials\n const { apiKey, clientId } = await getOrAskForWorkOSCredentials(options, config.environment.requiresApiKey);\n\n // Auto-configure WorkOS environment (redirect URI, CORS)\n const callerHandledConfig = Boolean(options.apiKey || options.clientId);\n if (!callerHandledConfig && apiKey) {\n const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;\n await autoConfigureWorkOSEnvironment(apiKey, config.metadata.integration, GO_DEFAULT_PORT, {\n homepageUrl: options.homepageUrl,\n redirectUri,\n });\n }\n\n // Gather Go-specific context\n const frameworkContext = config.metadata.gatherContext ? await config.metadata.gatherContext(options) : {};\n\n // Write .env (not .env.local — Go convention)\n if (!callerHandledConfig) {\n const redirectUri = options.redirectUri || `http://localhost:${GO_DEFAULT_PORT}${GO_CALLBACK_PATH}`;\n writeGoEnv(options.installDir, {\n ...(apiKey ? { WORKOS_API_KEY: apiKey } : {}),\n WORKOS_CLIENT_ID: clientId,\n WORKOS_REDIRECT_URI: redirectUri,\n });\n }\n\n // Set analytics tags\n const contextTags = config.analytics.getTags(frameworkContext);\n Object.entries(contextTags).forEach(([key, value]) => {\n analytics.setTag(key, value);\n });\n\n // Build prompt\n const additionalLines = config.prompts.getAdditionalContextLines\n ? config.prompts.getAdditionalContextLines(frameworkContext)\n : [];\n const additionalContext =\n additionalLines.length > 0 ? '\\n' + additionalLines.map((line) => `- ${line}`).join('\\n') : '';\n\n const skillName = config.metadata.skillName!;\n const refContent = await getReference(skillName);\n const integrationPrompt = `You are integrating WorkOS AuthKit into this ${config.metadata.name} application.\n\n## Project Context\n\n- Language: Go\n- Framework: ${frameworkContext.framework === 'gin' ? 'Gin' : 'stdlib net/http'}${additionalContext}\n\n## Environment\n\nThe following environment variables have been configured in .env:\n- WORKOS_API_KEY\n- WORKOS_CLIENT_ID\n- WORKOS_REDIRECT_URI\n\n## Integration Instructions\n\n${refContent}\n\nReport your progress using [STATUS] prefixes.\n\nBegin integration now.`;\n\n // Initialize and run agent\n const agent = await initializeAgent(\n {\n workingDirectory: options.installDir,\n workOSApiKey: apiKey,\n workOSApiHost: 'https://api.workos.com',\n },\n options,\n );\n\n const agentResult = await runAgent(\n agent,\n integrationPrompt,\n options,\n {\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n },\n options.emitter,\n );\n\n if (agentResult.error) {\n await analytics.shutdown('error');\n const message = agentResult.errorMessage || agentResult.error;\n throw new Error(message);\n }\n\n // Post-installation validation (gracefully skips — no rules file for Go)\n if (!options.noValidate) {\n options.emitter?.emit('validation:start', { framework: config.metadata.integration });\n\n const validationResult = await validateInstallation(config.metadata.integration, options.installDir, {\n runBuild: true,\n });\n\n if (validationResult.issues.length > 0) {\n options.emitter?.emit('validation:issues', { issues: validationResult.issues });\n }\n\n options.emitter?.emit('validation:complete', {\n passed: validationResult.passed,\n issueCount: validationResult.issues.length,\n durationMs: validationResult.durationMs,\n });\n }\n\n // Build summary\n const changes = config.ui.getOutroChanges(frameworkContext).filter(Boolean);\n const nextSteps = config.ui.getOutroNextSteps(frameworkContext).filter(Boolean);\n\n const lines: string[] = [\n 'Successfully installed WorkOS AuthKit!',\n '',\n ...(changes.length > 0 ? ['What the agent did:', ...changes.map((c) => `• ${c}`), ''] : []),\n ...(nextSteps.length > 0 ? ['Next steps:', ...nextSteps.map((s) => `• ${s}`), ''] : []),\n `Learn more: ${config.metadata.docsUrl}`,\n '',\n 'Note: This installer uses an LLM agent to analyze and modify your project. Please review the changes made.',\n ];\n\n await analytics.shutdown('success');\n\n return lines.join('\\n');\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { enableDebugLogs } from '../../utils/debug.js';
|
|
2
2
|
import { getPackageVersion } from '../../utils/package-json.js';
|
|
3
|
-
import { getPackageDotJson } from '../../utils/
|
|
4
|
-
import
|
|
3
|
+
import { getPackageDotJson } from '../../utils/ui-utils.js';
|
|
4
|
+
import ui from '../../utils/ui.js';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import * as semver from 'semver';
|
|
7
7
|
import { getNextJsRouter, getNextJsVersionBucket, getNextJsRouterName, NextJsRouter } from './utils.js';
|
|
@@ -65,6 +65,9 @@ export const config = {
|
|
|
65
65
|
'Start your development server to test authentication',
|
|
66
66
|
'Visit the WorkOS Dashboard to manage users and settings',
|
|
67
67
|
],
|
|
68
|
+
// Client-side sign-in per the AuthKit Next.js guidance: trigger sign-in from
|
|
69
|
+
// a click handler with refreshAuth (getSignInUrl must not run during render).
|
|
70
|
+
getSignInSnippet: () => 'Add a sign-in button in a client component: call refreshAuth({ ensureSignedIn: true }) on click',
|
|
68
71
|
},
|
|
69
72
|
};
|
|
70
73
|
export async function run(options) {
|
|
@@ -78,9 +81,9 @@ export async function run(options) {
|
|
|
78
81
|
const coercedVersion = semver.coerce(nextVersion);
|
|
79
82
|
if (coercedVersion && semver.lt(coercedVersion, MINIMUM_NEXTJS_VERSION)) {
|
|
80
83
|
const docsUrl = config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
ui.log.warn(`Sorry: the installer can't help you with Next.js ${nextVersion}. Upgrade to Next.js ${MINIMUM_NEXTJS_VERSION} or later, or check out the manual setup guide.`);
|
|
85
|
+
ui.log.info(`Setup Next.js manually: ${chalk.cyan(docsUrl)}`);
|
|
86
|
+
ui.outro('WorkOS AuthKit installer will see you next time!');
|
|
84
87
|
return '';
|
|
85
88
|
}
|
|
86
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/nextjs/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/nextjs/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAExG,MAAM,sBAAsB,GAAG,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;YACF,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,2BAA2B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC9D,EAAE,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;YAC7D,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/* Next.js integration — auto-discovered by registry */\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\nimport { getPackageVersion } from '../../utils/package-json.js';\nimport { getPackageDotJson } from '../../utils/ui-utils.js';\nimport ui from '../../utils/ui.js';\nimport chalk from 'chalk';\nimport * as semver from 'semver';\nimport { getNextJsRouter, getNextJsVersionBucket, getNextJsRouterName, NextJsRouter } from './utils.js';\n\nconst MINIMUM_NEXTJS_VERSION = '15.3.0';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'Next.js',\n integration: 'nextjs',\n docsUrl: 'https://workos.com/docs/user-management/authkit/nextjs',\n unsupportedVersionDocsUrl: 'https://workos.com/docs/user-management/authkit/nextjs',\n skillName: 'workos-authkit-nextjs',\n language: 'javascript',\n stability: 'stable',\n priority: 100,\n gatherContext: async (options: InstallerOptions) => {\n const router = await getNextJsRouter(options);\n return { router };\n },\n },\n\n detection: {\n packageName: 'next',\n packageDisplayName: 'Next.js',\n getVersion: (packageJson: any) => getPackageVersion('next', packageJson),\n getVersionBucket: getNextJsVersionBucket,\n },\n\n environment: {\n uploadToHosting: true,\n requiresApiKey: true,\n getEnvVars: (apiKey: string, clientId: string) => ({\n WORKOS_API_KEY: apiKey,\n WORKOS_CLIENT_ID: clientId,\n }),\n },\n\n analytics: {\n getTags: (context: any) => {\n const router = context.router as NextJsRouter;\n return {\n router: router === NextJsRouter.APP_ROUTER ? 'app' : 'pages',\n };\n },\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => {\n const router = context.router as NextJsRouter;\n const routerType = router === NextJsRouter.APP_ROUTER ? 'app' : 'pages';\n return [`Router: ${routerType}`];\n },\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: (context: any) => {\n const router = context.router as NextJsRouter;\n const routerName = getNextJsRouterName(router);\n return [\n `Analyzed your Next.js project structure (${routerName})`,\n `Created and configured WorkOS AuthKit`,\n `Integrated authentication into your application`,\n ];\n },\n getOutroNextSteps: () => [\n 'Start your development server to test authentication',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n // Client-side sign-in per the AuthKit Next.js guidance: trigger sign-in from\n // a click handler with refreshAuth (getSignInUrl must not run during render).\n getSignInSnippet: () =>\n 'Add a sign-in button in a client component: call refreshAuth({ ensureSignedIn: true }) on click',\n },\n};\n\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n // Check Next.js version - agent wizard requires >= 15.3.0\n const packageJson = await getPackageDotJson(options);\n const nextVersion = getPackageVersion('next', packageJson);\n\n if (nextVersion) {\n const coercedVersion = semver.coerce(nextVersion);\n if (coercedVersion && semver.lt(coercedVersion, MINIMUM_NEXTJS_VERSION)) {\n const docsUrl = config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;\n\n ui.log.warn(\n `Sorry: the installer can't help you with Next.js ${nextVersion}. Upgrade to Next.js ${MINIMUM_NEXTJS_VERSION} or later, or check out the manual setup guide.`,\n );\n ui.log.info(`Setup Next.js manually: ${chalk.cyan(docsUrl)}`);\n ui.outro('WorkOS AuthKit installer will see you next time!');\n return '';\n }\n }\n\n const { runAgentInstaller } = await import('../../lib/agent-runner.js');\n return runAgentInstaller(config, options);\n}\n"]}
|
|
@@ -4,5 +4,5 @@ export declare enum NextJsRouter {
|
|
|
4
4
|
APP_ROUTER = "app-router",
|
|
5
5
|
PAGES_ROUTER = "pages-router"
|
|
6
6
|
}
|
|
7
|
-
export declare function getNextJsRouter({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<NextJsRouter>;
|
|
7
|
+
export declare function getNextJsRouter({ installDir, router, }: Pick<InstallerOptions, 'installDir' | 'router'>): Promise<NextJsRouter>;
|
|
8
8
|
export declare const getNextJsRouterName: (router: NextJsRouter) => "app router" | "pages router";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import fg from 'fast-glob';
|
|
2
|
-
import { abortIfCancelled } from '../../utils/
|
|
3
|
-
import
|
|
2
|
+
import { abortIfCancelled } from '../../utils/ui-utils.js';
|
|
3
|
+
import ui from '../../utils/ui.js';
|
|
4
4
|
import { getVersionBucket } from '../../utils/semver.js';
|
|
5
5
|
import { IGNORE_PATTERNS } from '../../lib/constants.js';
|
|
6
|
+
import { isPromptAllowed } from '../../utils/interaction-mode.js';
|
|
6
7
|
export function getNextJsVersionBucket(version) {
|
|
7
8
|
return getVersionBucket(version, 11);
|
|
8
9
|
}
|
|
@@ -11,7 +12,13 @@ export var NextJsRouter;
|
|
|
11
12
|
NextJsRouter["APP_ROUTER"] = "app-router";
|
|
12
13
|
NextJsRouter["PAGES_ROUTER"] = "pages-router";
|
|
13
14
|
})(NextJsRouter || (NextJsRouter = {}));
|
|
14
|
-
export async function getNextJsRouter({ installDir }) {
|
|
15
|
+
export async function getNextJsRouter({ installDir, router, }) {
|
|
16
|
+
// Explicit flag wins over detection (deterministic for agents).
|
|
17
|
+
if (router) {
|
|
18
|
+
const chosen = router === 'pages' ? NextJsRouter.PAGES_ROUTER : NextJsRouter.APP_ROUTER;
|
|
19
|
+
ui.log.info(`Using ${getNextJsRouterName(chosen)} (--router)`);
|
|
20
|
+
return chosen;
|
|
21
|
+
}
|
|
15
22
|
const pagesMatches = await fg('**/pages/_app.@(ts|tsx|js|jsx)', {
|
|
16
23
|
dot: true,
|
|
17
24
|
cwd: installDir,
|
|
@@ -25,14 +32,22 @@ export async function getNextJsRouter({ installDir }) {
|
|
|
25
32
|
});
|
|
26
33
|
const hasAppDir = appMatches.length > 0;
|
|
27
34
|
if (hasPagesDir && !hasAppDir) {
|
|
28
|
-
|
|
35
|
+
ui.log.detail(`Detected ${getNextJsRouterName(NextJsRouter.PAGES_ROUTER)}`);
|
|
29
36
|
return NextJsRouter.PAGES_ROUTER;
|
|
30
37
|
}
|
|
31
38
|
if (hasAppDir && !hasPagesDir) {
|
|
32
|
-
|
|
39
|
+
ui.log.detail(`Detected ${getNextJsRouterName(NextJsRouter.APP_ROUTER)}`);
|
|
40
|
+
return NextJsRouter.APP_ROUTER;
|
|
41
|
+
}
|
|
42
|
+
// Ambiguous (both app/ and pages/ present, or neither). In non-interactive
|
|
43
|
+
// mode default to the app router (dominant/new-project case) with a warning
|
|
44
|
+
// instead of prompting — the --router flag above is the escape hatch.
|
|
45
|
+
if (!isPromptAllowed()) {
|
|
46
|
+
ui.log.warn('Could not determine the Next.js router (both app/ and pages/ present, or neither). ' +
|
|
47
|
+
'Defaulting to app router. Pass --router app|pages to override.');
|
|
33
48
|
return NextJsRouter.APP_ROUTER;
|
|
34
49
|
}
|
|
35
|
-
const result = await abortIfCancelled(
|
|
50
|
+
const result = await abortIfCancelled(ui.select({
|
|
36
51
|
message: 'What router are you using?',
|
|
37
52
|
options: [
|
|
38
53
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/integrations/nextjs/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/integrations/nextjs/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO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ils/ui.js';\nimport { getVersionBucket } from '../../utils/semver.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { IGNORE_PATTERNS } from '../../lib/constants.js';\nimport { isPromptAllowed } from '../../utils/interaction-mode.js';\n\nexport function getNextJsVersionBucket(version: string | undefined): string {\n return getVersionBucket(version, 11);\n}\n\nexport enum NextJsRouter {\n APP_ROUTER = 'app-router',\n PAGES_ROUTER = 'pages-router',\n}\n\nexport async function getNextJsRouter({\n installDir,\n router,\n}: Pick<InstallerOptions, 'installDir' | 'router'>): Promise<NextJsRouter> {\n // Explicit flag wins over detection (deterministic for agents).\n if (router) {\n const chosen = router === 'pages' ? NextJsRouter.PAGES_ROUTER : NextJsRouter.APP_ROUTER;\n ui.log.info(`Using ${getNextJsRouterName(chosen)} (--router)`);\n return chosen;\n }\n\n const pagesMatches = await fg('**/pages/_app.@(ts|tsx|js|jsx)', {\n dot: true,\n cwd: installDir,\n ignore: IGNORE_PATTERNS,\n });\n\n const hasPagesDir = pagesMatches.length > 0;\n\n const appMatches = await fg('**/app/**/layout.@(ts|tsx|js|jsx)', {\n dot: true,\n cwd: installDir,\n ignore: IGNORE_PATTERNS,\n });\n\n const hasAppDir = appMatches.length > 0;\n\n if (hasPagesDir && !hasAppDir) {\n ui.log.detail(`Detected ${getNextJsRouterName(NextJsRouter.PAGES_ROUTER)}`);\n return NextJsRouter.PAGES_ROUTER;\n }\n\n if (hasAppDir && !hasPagesDir) {\n ui.log.detail(`Detected ${getNextJsRouterName(NextJsRouter.APP_ROUTER)}`);\n return NextJsRouter.APP_ROUTER;\n }\n\n // Ambiguous (both app/ and pages/ present, or neither). In non-interactive\n // mode default to the app router (dominant/new-project case) with a warning\n // instead of prompting — the --router flag above is the escape hatch.\n if (!isPromptAllowed()) {\n ui.log.warn(\n 'Could not determine the Next.js router (both app/ and pages/ present, or neither). ' +\n 'Defaulting to app router. Pass --router app|pages to override.',\n );\n return NextJsRouter.APP_ROUTER;\n }\n\n const result: NextJsRouter = await abortIfCancelled(\n ui.select({\n message: 'What router are you using?',\n options: [\n {\n label: getNextJsRouterName(NextJsRouter.APP_ROUTER),\n value: NextJsRouter.APP_ROUTER,\n },\n {\n label: getNextJsRouterName(NextJsRouter.PAGES_ROUTER),\n value: NextJsRouter.PAGES_ROUTER,\n },\n ],\n }),\n 'nextjs',\n );\n\n return result;\n}\n\nexport const getNextJsRouterName = (router: NextJsRouter) => {\n return router === NextJsRouter.APP_ROUTER ? 'app router' : 'pages router';\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { enableDebugLogs } from '../../utils/debug.js';
|
|
2
2
|
import { getPackageVersion } from '../../utils/package-json.js';
|
|
3
|
-
import { getPackageDotJson } from '../../utils/
|
|
4
|
-
import
|
|
3
|
+
import { getPackageDotJson } from '../../utils/ui-utils.js';
|
|
4
|
+
import ui from '../../utils/ui.js';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import * as semver from 'semver';
|
|
7
7
|
import { getReactRouterMode, getReactRouterModeName, getReactRouterVersionBucket, ReactRouterMode } from './utils.js';
|
|
@@ -82,9 +82,9 @@ export async function run(options) {
|
|
|
82
82
|
const coercedVersion = semver.coerce(reactRouterVersion);
|
|
83
83
|
if (coercedVersion && semver.lt(coercedVersion, MINIMUM_REACT_ROUTER_VERSION)) {
|
|
84
84
|
const docsUrl = config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
ui.log.warn(`Sorry: the installer can't help you with React Router ${reactRouterVersion}. Upgrade to React Router ${MINIMUM_REACT_ROUTER_VERSION} or later, or check out the manual setup guide.`);
|
|
86
|
+
ui.log.info(`Setup React Router manually: ${chalk.cyan(docsUrl)}`);
|
|
87
|
+
ui.outro('WorkOS AuthKit installer will see you next time!');
|
|
88
88
|
return '';
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/react-router/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/react-router/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEtH,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAE7C,MAAM,CAAC,MAAM,MAAM,GAAoB;IACrC,QAAQ,EAAE;QACR,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,8DAA8D;QACvE,yBAAyB,EAAE,8DAA8D;QACzF,SAAS,EAAE,6BAA6B;QACxC,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,KAAK,EAAE,OAAyB,EAAE,EAAE;YACjD,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC;YACrD,OAAO,EAAE,UAAU,EAAE,CAAC;QACxB,CAAC;KACF;IAED,SAAS,EAAE;QACT,WAAW,EAAE,cAAc;QAC3B,kBAAkB,EAAE,cAAc;QAClC,UAAU,EAAE,CAAC,WAAgB,EAAE,EAAE,CAAC,iBAAiB,C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AC,CAAC;IACxE,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/* React Router integration — auto-discovered by registry */\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\nimport { getPackageVersion } from '../../utils/package-json.js';\nimport { getPackageDotJson } from '../../utils/ui-utils.js';\nimport ui from '../../utils/ui.js';\nimport chalk from 'chalk';\nimport * as semver from 'semver';\nimport { getReactRouterMode, getReactRouterModeName, getReactRouterVersionBucket, ReactRouterMode } from './utils.js';\n\nconst MINIMUM_REACT_ROUTER_VERSION = '6.0.0';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'React Router',\n integration: 'react-router',\n docsUrl: 'https://workos.com/docs/user-management/authkit/react-router',\n unsupportedVersionDocsUrl: 'https://workos.com/docs/user-management/authkit/react-router',\n skillName: 'workos-authkit-react-router',\n language: 'javascript',\n stability: 'stable',\n priority: 80,\n gatherContext: async (options: InstallerOptions) => {\n const routerMode = await getReactRouterMode(options);\n return { routerMode };\n },\n },\n\n detection: {\n packageName: 'react-router',\n packageDisplayName: 'React Router',\n getVersion: (packageJson: any) => getPackageVersion('react-router', packageJson),\n getVersionBucket: getReactRouterVersionBucket,\n },\n\n environment: {\n uploadToHosting: false,\n requiresApiKey: true,\n getEnvVars: (apiKey: string, clientId: string) => ({\n WORKOS_API_KEY: apiKey,\n WORKOS_CLIENT_ID: clientId,\n }),\n },\n\n analytics: {\n getTags: (context: any) => {\n const routerMode = context.routerMode as ReactRouterMode;\n return { routerMode: routerMode || 'unknown' };\n },\n },\n\n prompts: {\n getAdditionalContextLines: (context: any) => {\n const routerMode = context.routerMode as ReactRouterMode;\n const modeName = routerMode ? getReactRouterModeName(routerMode) : 'unknown';\n\n const frameworkIdMap: Record<ReactRouterMode, string> = {\n [ReactRouterMode.V6]: 'react-react-router-6',\n [ReactRouterMode.V7_FRAMEWORK]: 'react-react-router-7-framework',\n [ReactRouterMode.V7_DATA]: 'react-react-router-7-data',\n [ReactRouterMode.V7_DECLARATIVE]: 'react-react-router-7-declarative',\n };\n\n const frameworkId = routerMode ? frameworkIdMap[routerMode] : ReactRouterMode.V7_FRAMEWORK;\n\n return [`Router mode: ${modeName}`, `Framework docs ID: ${frameworkId}`];\n },\n },\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: (context: any) => {\n const routerMode = context.routerMode as ReactRouterMode;\n const modeName = routerMode ? getReactRouterModeName(routerMode) : 'React Router';\n return [\n `Analyzed your React Router project structure (${modeName})`,\n `Created and configured WorkOS AuthKit`,\n `Integrated authentication into your application`,\n ];\n },\n getOutroNextSteps: () => [\n 'Start your development server to test authentication',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n const packageJson = await getPackageDotJson(options);\n const reactRouterVersion = getPackageVersion('react-router', packageJson);\n\n if (reactRouterVersion) {\n const coercedVersion = semver.coerce(reactRouterVersion);\n if (coercedVersion && semver.lt(coercedVersion, MINIMUM_REACT_ROUTER_VERSION)) {\n const docsUrl = config.metadata.unsupportedVersionDocsUrl ?? config.metadata.docsUrl;\n\n ui.log.warn(\n `Sorry: the installer can't help you with React Router ${reactRouterVersion}. Upgrade to React Router ${MINIMUM_REACT_ROUTER_VERSION} or later, or check out the manual setup guide.`,\n );\n ui.log.info(`Setup React Router manually: ${chalk.cyan(docsUrl)}`);\n ui.outro('WorkOS AuthKit installer will see you next time!');\n return '';\n }\n }\n\n const { runAgentInstaller } = await import('../../lib/agent-runner.js');\n return runAgentInstaller(config, options);\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { major } from 'semver';
|
|
2
2
|
import fg from 'fast-glob';
|
|
3
|
-
import { abortIfCancelled, getPackageDotJson } from '../../utils/
|
|
4
|
-
import
|
|
3
|
+
import { abortIfCancelled, getPackageDotJson } from '../../utils/ui-utils.js';
|
|
4
|
+
import ui from '../../utils/ui.js';
|
|
5
5
|
import { getVersionBucket } from '../../utils/semver.js';
|
|
6
6
|
import { IGNORE_PATTERNS } from '../../lib/constants.js';
|
|
7
7
|
import { getPackageVersion } from '../../utils/package-json.js';
|
|
8
|
+
import { isPromptAllowed } from '../../utils/interaction-mode.js';
|
|
8
9
|
import chalk from 'chalk';
|
|
9
10
|
import * as fs from 'node:fs';
|
|
10
11
|
import * as path from 'node:path';
|
|
@@ -69,13 +70,24 @@ async function hasDeclarativeRouter({ installDir }) {
|
|
|
69
70
|
}
|
|
70
71
|
return false;
|
|
71
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Non-interactive runs cannot answer the mode prompt, so warn and fall back to
|
|
75
|
+
* the most common mode instead of aborting.
|
|
76
|
+
*/
|
|
77
|
+
function defaultModeNonInteractive() {
|
|
78
|
+
ui.log.warn('Could not determine the React Router mode. Defaulting to v7 Framework mode. ' +
|
|
79
|
+
'Run in an interactive terminal to choose a different mode.');
|
|
80
|
+
return ReactRouterMode.V7_FRAMEWORK;
|
|
81
|
+
}
|
|
72
82
|
export async function getReactRouterMode(options) {
|
|
73
83
|
const { installDir } = options;
|
|
74
84
|
const packageJson = await getPackageDotJson(options);
|
|
75
85
|
const reactRouterVersion = getPackageVersion('react-router-dom', packageJson) || getPackageVersion('react-router', packageJson);
|
|
76
86
|
if (!reactRouterVersion) {
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
if (!isPromptAllowed())
|
|
88
|
+
return defaultModeNonInteractive();
|
|
89
|
+
ui.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);
|
|
90
|
+
const result = await abortIfCancelled(ui.select({
|
|
79
91
|
message: 'What React Router version and mode are you using?',
|
|
80
92
|
options: [
|
|
81
93
|
{ label: 'React Router v6', value: ReactRouterMode.V6 },
|
|
@@ -89,27 +101,29 @@ export async function getReactRouterMode(options) {
|
|
|
89
101
|
const coercedVersion = semver.coerce(reactRouterVersion);
|
|
90
102
|
const majorVersion = coercedVersion ? major(coercedVersion) : null;
|
|
91
103
|
if (majorVersion === 6) {
|
|
92
|
-
|
|
104
|
+
ui.log.info('Detected React Router v6');
|
|
93
105
|
return ReactRouterMode.V6;
|
|
94
106
|
}
|
|
95
107
|
if (majorVersion === 7) {
|
|
96
108
|
const hasConfig = await hasReactRouterConfig({ installDir });
|
|
97
109
|
if (hasConfig) {
|
|
98
|
-
|
|
110
|
+
ui.log.info('Detected React Router v7 - Framework mode');
|
|
99
111
|
return ReactRouterMode.V7_FRAMEWORK;
|
|
100
112
|
}
|
|
101
113
|
const hasDataMode = await hasCreateBrowserRouter({ installDir });
|
|
102
114
|
if (hasDataMode) {
|
|
103
|
-
|
|
115
|
+
ui.log.info('Detected React Router v7 - Data mode');
|
|
104
116
|
return ReactRouterMode.V7_DATA;
|
|
105
117
|
}
|
|
106
118
|
const hasDeclarative = await hasDeclarativeRouter({ installDir });
|
|
107
119
|
if (hasDeclarative) {
|
|
108
|
-
|
|
120
|
+
ui.log.info('Detected React Router v7 - Declarative mode');
|
|
109
121
|
return ReactRouterMode.V7_DECLARATIVE;
|
|
110
122
|
}
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
if (!isPromptAllowed())
|
|
124
|
+
return defaultModeNonInteractive();
|
|
125
|
+
ui.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);
|
|
126
|
+
const result = await abortIfCancelled(ui.select({
|
|
113
127
|
message: 'What React Router v7 mode are you using?',
|
|
114
128
|
options: [
|
|
115
129
|
{ label: 'Framework mode', value: ReactRouterMode.V7_FRAMEWORK },
|
|
@@ -119,8 +133,10 @@ export async function getReactRouterMode(options) {
|
|
|
119
133
|
}), 'react-router');
|
|
120
134
|
return result;
|
|
121
135
|
}
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
if (!isPromptAllowed())
|
|
137
|
+
return defaultModeNonInteractive();
|
|
138
|
+
ui.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);
|
|
139
|
+
const result = await abortIfCancelled(ui.select({
|
|
124
140
|
message: 'What React Router version and mode are you using?',
|
|
125
141
|
options: [
|
|
126
142
|
{ label: 'React Router v6', value: ReactRouterMode.V6 },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/integrations/react-router/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,4BAAS,CAAA;IACT,gDAA6B,CAAA;IAC7B,sCAAmB,CAAA;IACnB,oDAAiC,CAAA;AACnC,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED,MAAM,UAAU,2BAA2B,CAAC,OAA2B;IACrE,OAAO,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,EAAE,UAAU,EAAwC;IACtF,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,yCAAyC,EAAE;QACxE,GAAG,EAAE,IAAI;QACT,G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DotJson } from '../../utils/clack-utils.js';\nimport clack from '../../utils/clack.js';\nimport { getVersionBucket } from '../../utils/semver.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { IGNORE_PATTERNS } from '../../lib/constants.js';\nimport { getPackageVersion } from '../../utils/package-json.js';\nimport chalk from 'chalk';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as semver from 'semver';\n\nexport enum ReactRouterMode {\n V6 = 'v6',\n V7_FRAMEWORK = 'v7-framework',\n V7_DATA = 'v7-data',\n V7_DECLARATIVE = 'v7-declarative',\n}\n\nexport function getReactRouterVersionBucket(version: string | undefined): string {\n return getVersionBucket(version, 6);\n}\n\nasync function hasReactRouterConfig({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<boolean> {\n const configMatches = await fg('**/react-router.config.@(ts|js|tsx|jsx)', {\n dot: true,\n cwd: installDir,\n ignore: IGNORE_PATTERNS,\n });\n return configMatches.length > 0;\n}\n\nasync function hasCreateBrowserRouter({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<boolean> {\n const sourceFiles = await fg('**/*.@(ts|tsx|js|jsx)', {\n dot: true,\n cwd: installDir,\n ignore: IGNORE_PATTERNS,\n });\n\n for (const file of sourceFiles) {\n try {\n const filePath = path.join(installDir, file);\n const content = fs.readFileSync(filePath, 'utf-8');\n if (content.includes('createBrowserRouter')) {\n return true;\n }\n } catch {\n continue;\n }\n }\n return false;\n}\n\nasync function hasDeclarativeRouter({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<boolean> {\n const sourceFiles = await fg('**/*.@(ts|tsx|js|jsx)', {\n dot: true,\n cwd: installDir,\n ignore: IGNORE_PATTERNS,\n });\n\n for (const file of sourceFiles) {\n try {\n const filePath = path.join(installDir, file);\n const content = fs.readFileSync(filePath, 'utf-8');\n if (\n content.includes('<BrowserRouter') ||\n (content.includes('BrowserRouter') &&\n (content.includes('from \"react-router-dom\"') || content.includes(\"from 'react-router-dom'\")))\n ) {\n return true;\n }\n } catch {\n continue;\n }\n }\n return false;\n}\n\nexport async function getReactRouterMode(options: InstallerOptions): Promise<ReactRouterMode> {\n const { installDir } = options;\n\n const packageJson = await getPackageDotJson(options);\n const reactRouterVersion =\n getPackageVersion('react-router-dom', packageJson) || getPackageVersion('react-router', packageJson);\n\n if (!reactRouterVersion) {\n clack.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);\n const result: ReactRouterMode = await abortIfCancelled(\n clack.select({\n message: 'What React Router version and mode are you using?',\n options: [\n { label: 'React Router v6', value: ReactRouterMode.V6 },\n { label: 'React Router v7 - Framework mode', value: ReactRouterMode.V7_FRAMEWORK },\n { label: 'React Router v7 - Data mode', value: ReactRouterMode.V7_DATA },\n { label: 'React Router v7 - Declarative mode', value: ReactRouterMode.V7_DECLARATIVE },\n ],\n }),\n 'react-router',\n );\n return result;\n }\n\n const coercedVersion = semver.coerce(reactRouterVersion);\n const majorVersion = coercedVersion ? major(coercedVersion) : null;\n\n if (majorVersion === 6) {\n clack.log.info('Detected React Router v6');\n return ReactRouterMode.V6;\n }\n\n if (majorVersion === 7) {\n const hasConfig = await hasReactRouterConfig({ installDir });\n if (hasConfig) {\n clack.log.info('Detected React Router v7 - Framework mode');\n return ReactRouterMode.V7_FRAMEWORK;\n }\n\n const hasDataMode = await hasCreateBrowserRouter({ installDir });\n if (hasDataMode) {\n clack.log.info('Detected React Router v7 - Data mode');\n return ReactRouterMode.V7_DATA;\n }\n\n const hasDeclarative = await hasDeclarativeRouter({ installDir });\n if (hasDeclarative) {\n clack.log.info('Detected React Router v7 - Declarative mode');\n return ReactRouterMode.V7_DECLARATIVE;\n }\n\n clack.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);\n const result: ReactRouterMode = await abortIfCancelled(\n clack.select({\n message: 'What React Router v7 mode are you using?',\n options: [\n { label: 'Framework mode', value: ReactRouterMode.V7_FRAMEWORK },\n { label: 'Data mode', value: ReactRouterMode.V7_DATA },\n { label: 'Declarative mode', value: ReactRouterMode.V7_DECLARATIVE },\n ],\n }),\n 'react-router',\n );\n return result;\n }\n\n clack.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);\n const result: ReactRouterMode = await abortIfCancelled(\n clack.select({\n message: 'What React Router version and mode are you using?',\n options: [\n { label: 'React Router v6', value: ReactRouterMode.V6 },\n { label: 'React Router v7 - Framework mode', value: ReactRouterMode.V7_FRAMEWORK },\n { label: 'React Router v7 - Data mode', value: ReactRouterMode.V7_DATA },\n { label: 'React Router v7 - Declarative mode', value: ReactRouterMode.V7_DECLARATIVE },\n ],\n }),\n 'react-router',\n );\n return result;\n}\n\nexport function getReactRouterModeName(mode: ReactRouterMode): string {\n switch (mode) {\n case ReactRouterMode.V6:\n return 'v6';\n case ReactRouterMode.V7_FRAMEWORK:\n return 'v7 Framework mode';\n case ReactRouterMode.V7_DATA:\n return 'v7 Data mode';\n case ReactRouterMode.V7_DECLARATIVE:\n return 'v7 Declarative mode';\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/integrations/react-router/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,MAAM,WAAW,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,W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,CAAC,MAAM,CAAC;QACR,OAAO,EAAE,mDAAmD;QAC5D,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,eAAe,CAAC,EAAE,EAAE;YACvD,EAAE,KAAK,EAAE,kCAAkC,EAAE,KAAK,EAAE,eAAe,CAAC,YAAY,EAAE;YAClF,EAAE,KAAK,EAAE,6BAA6B,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,EAAE;YACxE,EAAE,KAAK,EAAE,oCAAoC,EAAE,KAAK,EAAE,eAAe,CAAC,cAAc,EAAE;SACvF;KACF,CAAC,EACF,cAAc,CACf,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAqB;IAC1D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,eAAe,CAAC,EAAE;YACrB,OAAO,IAAI,CAAC;QACd,KAAK,eAAe,CAAC,YAAY;YAC/B,OAAO,mBAAmB,CAAC;QAC7B,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,eAAe,CAAC,cAAc;YACjC,OAAO,qBAAqB,CAAC;IACjC,CAAC;AACH,CAAC","sourcesContent":["import { major } from 'semver';\nimport fg from 'fast-glob';\nimport { abortIfCancelled, getPackageDotJson } from '../../utils/ui-utils.js';\nimport ui from '../../utils/ui.js';\nimport { getVersionBucket } from '../../utils/semver.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { IGNORE_PATTERNS } from '../../lib/constants.js';\nimport { getPackageVersion } from '../../utils/package-json.js';\nimport { isPromptAllowed } from '../../utils/interaction-mode.js';\nimport chalk from 'chalk';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as semver from 'semver';\n\nexport enum ReactRouterMode {\n V6 = 'v6',\n V7_FRAMEWORK = 'v7-framework',\n V7_DATA = 'v7-data',\n V7_DECLARATIVE = 'v7-declarative',\n}\n\nexport function getReactRouterVersionBucket(version: string | undefined): string {\n return getVersionBucket(version, 6);\n}\n\nasync function hasReactRouterConfig({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<boolean> {\n const configMatches = await fg('**/react-router.config.@(ts|js|tsx|jsx)', {\n dot: true,\n cwd: installDir,\n ignore: IGNORE_PATTERNS,\n });\n return configMatches.length > 0;\n}\n\nasync function hasCreateBrowserRouter({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<boolean> {\n const sourceFiles = await fg('**/*.@(ts|tsx|js|jsx)', {\n dot: true,\n cwd: installDir,\n ignore: IGNORE_PATTERNS,\n });\n\n for (const file of sourceFiles) {\n try {\n const filePath = path.join(installDir, file);\n const content = fs.readFileSync(filePath, 'utf-8');\n if (content.includes('createBrowserRouter')) {\n return true;\n }\n } catch {\n continue;\n }\n }\n return false;\n}\n\nasync function hasDeclarativeRouter({ installDir }: Pick<InstallerOptions, 'installDir'>): Promise<boolean> {\n const sourceFiles = await fg('**/*.@(ts|tsx|js|jsx)', {\n dot: true,\n cwd: installDir,\n ignore: IGNORE_PATTERNS,\n });\n\n for (const file of sourceFiles) {\n try {\n const filePath = path.join(installDir, file);\n const content = fs.readFileSync(filePath, 'utf-8');\n if (\n content.includes('<BrowserRouter') ||\n (content.includes('BrowserRouter') &&\n (content.includes('from \"react-router-dom\"') || content.includes(\"from 'react-router-dom'\")))\n ) {\n return true;\n }\n } catch {\n continue;\n }\n }\n return false;\n}\n\n/**\n * Non-interactive runs cannot answer the mode prompt, so warn and fall back to\n * the most common mode instead of aborting.\n */\nfunction defaultModeNonInteractive(): ReactRouterMode {\n ui.log.warn(\n 'Could not determine the React Router mode. Defaulting to v7 Framework mode. ' +\n 'Run in an interactive terminal to choose a different mode.',\n );\n return ReactRouterMode.V7_FRAMEWORK;\n}\n\nexport async function getReactRouterMode(options: InstallerOptions): Promise<ReactRouterMode> {\n const { installDir } = options;\n\n const packageJson = await getPackageDotJson(options);\n const reactRouterVersion =\n getPackageVersion('react-router-dom', packageJson) || getPackageVersion('react-router', packageJson);\n\n if (!reactRouterVersion) {\n if (!isPromptAllowed()) return defaultModeNonInteractive();\n ui.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);\n const result: ReactRouterMode = await abortIfCancelled(\n ui.select({\n message: 'What React Router version and mode are you using?',\n options: [\n { label: 'React Router v6', value: ReactRouterMode.V6 },\n { label: 'React Router v7 - Framework mode', value: ReactRouterMode.V7_FRAMEWORK },\n { label: 'React Router v7 - Data mode', value: ReactRouterMode.V7_DATA },\n { label: 'React Router v7 - Declarative mode', value: ReactRouterMode.V7_DECLARATIVE },\n ],\n }),\n 'react-router',\n );\n return result;\n }\n\n const coercedVersion = semver.coerce(reactRouterVersion);\n const majorVersion = coercedVersion ? major(coercedVersion) : null;\n\n if (majorVersion === 6) {\n ui.log.info('Detected React Router v6');\n return ReactRouterMode.V6;\n }\n\n if (majorVersion === 7) {\n const hasConfig = await hasReactRouterConfig({ installDir });\n if (hasConfig) {\n ui.log.info('Detected React Router v7 - Framework mode');\n return ReactRouterMode.V7_FRAMEWORK;\n }\n\n const hasDataMode = await hasCreateBrowserRouter({ installDir });\n if (hasDataMode) {\n ui.log.info('Detected React Router v7 - Data mode');\n return ReactRouterMode.V7_DATA;\n }\n\n const hasDeclarative = await hasDeclarativeRouter({ installDir });\n if (hasDeclarative) {\n ui.log.info('Detected React Router v7 - Declarative mode');\n return ReactRouterMode.V7_DECLARATIVE;\n }\n\n if (!isPromptAllowed()) return defaultModeNonInteractive();\n ui.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);\n const result: ReactRouterMode = await abortIfCancelled(\n ui.select({\n message: 'What React Router v7 mode are you using?',\n options: [\n { label: 'Framework mode', value: ReactRouterMode.V7_FRAMEWORK },\n { label: 'Data mode', value: ReactRouterMode.V7_DATA },\n { label: 'Declarative mode', value: ReactRouterMode.V7_DECLARATIVE },\n ],\n }),\n 'react-router',\n );\n return result;\n }\n\n if (!isPromptAllowed()) return defaultModeNonInteractive();\n ui.log.info(`Learn more about React Router modes: ${chalk.cyan('https://reactrouter.com/start/modes')}`);\n const result: ReactRouterMode = await abortIfCancelled(\n ui.select({\n message: 'What React Router version and mode are you using?',\n options: [\n { label: 'React Router v6', value: ReactRouterMode.V6 },\n { label: 'React Router v7 - Framework mode', value: ReactRouterMode.V7_FRAMEWORK },\n { label: 'React Router v7 - Data mode', value: ReactRouterMode.V7_DATA },\n { label: 'React Router v7 - Declarative mode', value: ReactRouterMode.V7_DECLARATIVE },\n ],\n }),\n 'react-router',\n );\n return result;\n}\n\nexport function getReactRouterModeName(mode: ReactRouterMode): string {\n switch (mode) {\n case ReactRouterMode.V6:\n return 'v6';\n case ReactRouterMode.V7_FRAMEWORK:\n return 'v7 Framework mode';\n case ReactRouterMode.V7_DATA:\n return 'v7 Data mode';\n case ReactRouterMode.V7_DECLARATIVE:\n return 'v7 Declarative mode';\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { SPINNER_MESSAGE } from '../../lib/framework-config.js';
|
|
|
3
3
|
import { analytics } from '../../utils/analytics.js';
|
|
4
4
|
import { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';
|
|
5
5
|
import { initializeAgent, runAgent } from '../../lib/agent-interface.js';
|
|
6
|
-
import { getOrAskForWorkOSCredentials } from '../../utils/
|
|
6
|
+
import { getOrAskForWorkOSCredentials } from '../../utils/ui-utils.js';
|
|
7
7
|
import { autoConfigureWorkOSEnvironment } from '../../lib/workos-management.js';
|
|
8
8
|
import { getReference } from '@workos/skills';
|
|
9
9
|
export const config = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/ruby/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,O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E,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,EAAE;QACF,aAAa;QACb,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,EAAE;QACF,eAAe,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;QACxC,EAAE;QACF,4GAA4G;KAC7G,CAAC;IAEF,MAAM,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEpC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/* Ruby/Rails integration — auto-discovered by registry */\nimport type { FrameworkConfig } from '../../lib/framework-config.js';\nimport type { InstallerOptions } from '../../utils/types.js';\nimport { enableDebugLogs } from '../../utils/debug.js';\nimport { SPINNER_MESSAGE } from '../../lib/framework-config.js';\nimport { analytics } from '../../utils/analytics.js';\nimport { INSTALLER_INTERACTION_EVENT_NAME } from '../../lib/constants.js';\nimport { initializeAgent, runAgent } from '../../lib/agent-interface.js';\nimport { getOrAskForWorkOSCredentials } from '../../utils/ui-utils.js';\nimport { autoConfigureWorkOSEnvironment } from '../../lib/workos-management.js';\nimport { getReference } from '@workos/skills';\n\nexport const config: FrameworkConfig = {\n metadata: {\n name: 'Ruby (Rails)',\n integration: 'ruby',\n docsUrl: 'https://workos.com/docs/authkit/vanilla/ruby',\n skillName: 'workos-ruby',\n language: 'ruby',\n stability: 'experimental',\n priority: 55,\n packageManager: 'bundle',\n manifestFile: 'Gemfile',\n },\n\n detection: {\n packageName: 'rails',\n packageDisplayName: 'Rails',\n getVersion: () => undefined,\n },\n\n environment: {\n uploadToHosting: false,\n requiresApiKey: true,\n getEnvVars: (apiKey: string, clientId: string) => ({\n WORKOS_API_KEY: apiKey,\n WORKOS_CLIENT_ID: clientId,\n }),\n },\n\n analytics: {\n getTags: () => ({}),\n },\n\n prompts: {},\n\n ui: {\n successMessage: 'WorkOS AuthKit integration complete',\n getOutroChanges: () => [\n 'Analyzed your Rails project structure',\n 'Installed and configured the WorkOS Ruby SDK',\n 'Created authentication controller with login, callback, and logout',\n 'Added authentication routes to config/routes.rb',\n ],\n getOutroNextSteps: () => [\n 'Start your Rails server with `rails server` to test authentication',\n 'Visit the WorkOS Dashboard to manage users and settings',\n ],\n },\n};\n\n/**\n * Custom run function for Ruby/Rails — bypasses runAgentInstaller\n * since that assumes a JS project (package.json, node_modules, .env.local).\n */\nexport async function run(options: InstallerOptions): Promise<string> {\n if (options.debug) {\n enableDebugLogs();\n }\n\n options.emitter?.emit('status', {\n message: `Setting up WorkOS AuthKit for ${config.metadata.name}`,\n });\n\n analytics.capture(INSTALLER_INTERACTION_EVENT_NAME, {\n action: 'started agent integration',\n integration: config.metadata.integration,\n });\n\n // Get WorkOS credentials\n const { apiKey, clientId: _clientId } = await getOrAskForWorkOSCredentials(\n options,\n config.environment.requiresApiKey,\n );\n\n // Auto-configure WorkOS environment (redirect URI, CORS, homepage) if not already done\n const callerHandledConfig = Boolean(options.apiKey || options.clientId);\n if (!callerHandledConfig && apiKey) {\n const port = 3000; // Rails default\n await autoConfigureWorkOSEnvironment(apiKey, config.metadata.integration, port, {\n homepageUrl: options.homepageUrl,\n redirectUri: options.redirectUri,\n });\n }\n\n // Build prompt for the agent\n const redirectUri = options.redirectUri || 'http://localhost:3000/auth/callback';\n const refContent = await getReference('workos-ruby');\n const prompt = `You are integrating WorkOS AuthKit into this Ruby on Rails application.\n\n## Project Context\n\n- Framework: Ruby (Rails)\n- Language: Ruby\n\n## Environment\n\nThe following environment variables are needed (create a .env file if one does not exist):\n- WORKOS_API_KEY\n- WORKOS_CLIENT_ID\n- WORKOS_REDIRECT_URI=${redirectUri}\n\n## Integration Instructions\n\n${refContent}\n\nReport your progress using [STATUS] prefixes.\n\nBegin integration now.`;\n\n // Initialize and run agent\n const agent = await initializeAgent(\n {\n workingDirectory: options.installDir,\n workOSApiKey: apiKey,\n workOSApiHost: 'https://api.workos.com',\n },\n options,\n );\n\n const agentResult = await runAgent(\n agent,\n prompt,\n options,\n {\n spinnerMessage: SPINNER_MESSAGE,\n successMessage: config.ui.successMessage,\n errorMessage: 'Integration failed',\n },\n options.emitter,\n );\n\n if (agentResult.error) {\n await analytics.shutdown('error');\n const message = agentResult.errorMessage || agentResult.error;\n throw new Error(message);\n }\n\n // Build completion summary\n const changes = config.ui.getOutroChanges({});\n const nextSteps = config.ui.getOutroNextSteps({});\n\n const lines: string[] = [\n 'Successfully installed WorkOS AuthKit!',\n '',\n 'What the agent did:',\n ...changes.map((c) => `• ${c}`),\n '',\n 'Next steps:',\n ...nextSteps.map((s) => `• ${s}`),\n '',\n `Learn more: ${config.metadata.docsUrl}`,\n '',\n 'Note: This installer uses an LLM agent to analyze and modify your project. Please review the changes made.',\n ];\n\n await analytics.shutdown('success');\n\n return lines.join('\\n');\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { InstallerAdapter, AdapterConfig } from './types.js';
|
|
2
2
|
import type { InstallerEventEmitter } from '../events.js';
|
|
3
3
|
/**
|
|
4
|
-
* CLI adapter that renders wizard events via
|
|
4
|
+
* CLI adapter that renders wizard events via ui.
|
|
5
5
|
*
|
|
6
6
|
* Subscribes to InstallerEventEmitter and translates events into
|
|
7
|
-
*
|
|
7
|
+
* UI facade operations (logs, spinners, prompts).
|
|
8
8
|
*/
|
|
9
9
|
export declare class CLIAdapter implements InstallerAdapter {
|
|
10
10
|
readonly emitter: InstallerEventEmitter;
|
|
@@ -19,7 +19,9 @@ export declare class CLIAdapter implements InstallerAdapter {
|
|
|
19
19
|
private isPromptActive;
|
|
20
20
|
private pendingLogs;
|
|
21
21
|
private sigIntHandler;
|
|
22
|
-
private
|
|
22
|
+
private promptAbort;
|
|
23
|
+
private lastAgentMessage;
|
|
24
|
+
private lastFileOp;
|
|
23
25
|
constructor(config: AdapterConfig);
|
|
24
26
|
/**
|
|
25
27
|
* Queue a log call if a prompt is active, otherwise execute immediately.
|
|
@@ -29,9 +31,15 @@ export declare class CLIAdapter implements InstallerAdapter {
|
|
|
29
31
|
* Flush any queued logs after prompt completes.
|
|
30
32
|
*/
|
|
31
33
|
private flushPendingLogs;
|
|
34
|
+
/**
|
|
35
|
+
* Run a prompt with the log queue engaged: mark a prompt active so async log
|
|
36
|
+
* events (detection:complete, branch:created, …) buffer instead of scribbling
|
|
37
|
+
* over the question, then release and flush once it resolves. Wraps every
|
|
38
|
+
* prompt handler so the active/flush lifecycle lives in one place.
|
|
39
|
+
*/
|
|
40
|
+
private withPromptActive;
|
|
32
41
|
start(): Promise<void>;
|
|
33
42
|
stop(): Promise<void>;
|
|
34
|
-
private stopAgentUpdates;
|
|
35
43
|
private stopSpinner;
|
|
36
44
|
/** Debug logging - only outputs when debug mode is enabled */
|
|
37
45
|
private debugLog;
|
|
@@ -39,6 +47,14 @@ export declare class CLIAdapter implements InstallerAdapter {
|
|
|
39
47
|
* Helper to subscribe and track handlers for cleanup.
|
|
40
48
|
*/
|
|
41
49
|
private subscribe;
|
|
50
|
+
/**
|
|
51
|
+
* Terminal handler failure. A PromptUnavailableError means we reached a prompt
|
|
52
|
+
* in a context that can't answer it (non-TTY stdin) — the CLIAdapter only runs
|
|
53
|
+
* in human, non-JSON output, so this is always a real human at a broken input,
|
|
54
|
+
* never a JSON stream. Surface a clear message and exit before anything is
|
|
55
|
+
* written, rather than hanging or crashing. Re-throw anything else.
|
|
56
|
+
*/
|
|
57
|
+
private onHandlerError;
|
|
42
58
|
private handleStateEnter;
|
|
43
59
|
private handleStateExit;
|
|
44
60
|
private handleAuthSuccess;
|
|
@@ -52,11 +68,24 @@ export declare class CLIAdapter implements InstallerAdapter {
|
|
|
52
68
|
private handleStagingFetching;
|
|
53
69
|
private handleStagingSuccess;
|
|
54
70
|
private handleEnvCredentialsFound;
|
|
71
|
+
private handleDeviceError;
|
|
72
|
+
private handleDeviceTimeout;
|
|
73
|
+
private handleStagingError;
|
|
55
74
|
private handleGitDirty;
|
|
56
75
|
private handleCredentialsRequest;
|
|
57
76
|
private handleConfigComplete;
|
|
58
77
|
private handleAgentStart;
|
|
59
78
|
private handleAgentProgress;
|
|
79
|
+
/**
|
|
80
|
+
* Render a persistent line above the running spinner: stop the spinner to
|
|
81
|
+
* finalize its line, emit the log, then restart it on the last phase message.
|
|
82
|
+
* Mirrors the existing stop→log and stop→start-new-spinner precedents.
|
|
83
|
+
*/
|
|
84
|
+
private logAboveSpinner;
|
|
85
|
+
private logFileOp;
|
|
86
|
+
private handleFileWrite;
|
|
87
|
+
private handleFileEdit;
|
|
88
|
+
private handleAgentTool;
|
|
60
89
|
private handleValidationStart;
|
|
61
90
|
private handleValidationIssues;
|
|
62
91
|
private handleValidationComplete;
|