workos 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +5 -2
  2. package/dist/bin.js +23 -13
  3. package/dist/bin.js.map +1 -1
  4. package/dist/commands/auth-status.d.ts +1 -0
  5. package/dist/commands/auth-status.js +56 -0
  6. package/dist/commands/auth-status.js.map +1 -0
  7. package/dist/commands/login.js +5 -4
  8. package/dist/commands/login.js.map +1 -1
  9. package/dist/doctor/checks/ai-analysis.js +3 -3
  10. package/dist/doctor/checks/ai-analysis.js.map +1 -1
  11. package/dist/lib/adapters/cli-adapter.js +1 -1
  12. package/dist/lib/adapters/cli-adapter.js.map +1 -1
  13. package/dist/lib/agent-interface.js +5 -5
  14. package/dist/lib/agent-interface.js.map +1 -1
  15. package/dist/lib/credential-proxy.js +1 -1
  16. package/dist/lib/credential-proxy.js.map +1 -1
  17. package/dist/lib/ensure-auth.js +3 -3
  18. package/dist/lib/ensure-auth.js.map +1 -1
  19. package/dist/lib/run-with-core.js +1 -1
  20. package/dist/lib/run-with-core.js.map +1 -1
  21. package/dist/lib/token-refresh-client.js +1 -1
  22. package/dist/lib/token-refresh-client.js.map +1 -1
  23. package/dist/lib/token-refresh.js +1 -1
  24. package/dist/lib/token-refresh.js.map +1 -1
  25. package/dist/lib/version-check.js +2 -1
  26. package/dist/lib/version-check.js.map +1 -1
  27. package/dist/utils/exit-codes.js +1 -1
  28. package/dist/utils/exit-codes.js.map +1 -1
  29. package/dist/utils/help-json.js +7 -2
  30. package/dist/utils/help-json.js.map +1 -1
  31. package/package.json +1 -1
  32. package/skills/workos-authkit-nextjs/SKILL.md +1 -1
  33. package/skills/workos-authkit-react/SKILL.md +19 -10
  34. package/skills/workos-authkit-react-router/SKILL.md +18 -8
  35. package/skills/workos-authkit-sveltekit/SKILL.md +55 -7
  36. package/skills/workos-authkit-tanstack-start/SKILL.md +22 -8
  37. package/skills/workos-authkit-vanilla-js/SKILL.md +19 -10
  38. package/skills/workos-elixir/SKILL.md +37 -0
  39. package/skills/workos-go/SKILL.md +36 -1
  40. package/skills/workos-kotlin/SKILL.md +34 -0
  41. package/skills/workos-management/SKILL.md +1 -1
  42. package/skills/workos-node/SKILL.md +33 -0
  43. package/skills/workos-php/SKILL.md +34 -1
  44. package/skills/workos-php-laravel/SKILL.md +36 -1
  45. package/skills/workos-python/SKILL.md +34 -0
  46. package/skills/workos-ruby/SKILL.md +35 -0
@@ -24,7 +24,7 @@ description: Integrate WorkOS AuthKit with TanStack Start applications. Full-sta
24
24
 
25
25
  **STOP - Do not proceed until complete.**
26
26
 
27
- WebFetch: `https://github.com/workos/authkit-tanstack-start/blob/main/README.md`
27
+ WebFetch: `https://raw.githubusercontent.com/workos/authkit-tanstack-start/main/README.md`
28
28
 
29
29
  From README, extract:
30
30
 
@@ -110,13 +110,7 @@ export const startInstance = createStart(() => ({
110
110
  1. **Named export `startInstance`** — the build plugin generates `import type { startInstance }` from this file. A `default` export will cause a build error.
111
111
  2. **`createStart` takes a function** returning the options object, not the options directly. `createStart({ ... })` will fail.
112
112
 
113
- ### Verification Checklist
114
-
115
- - [ ] `authkitMiddleware` imported from `@workos/authkit-tanstack-react-start`
116
- - [ ] Middleware in `requestMiddleware` array (not `middleware`)
117
- - [ ] Named export: `export const startInstance = createStart(...)` (not `export default`)
118
-
119
- Verify: `grep -r "authkitMiddleware" src/ app/ 2>/dev/null`
113
+ **WARNING: Do NOT add middleware to `createRouter()` in `router.tsx` or `app.tsx`. That is TanStack Router (client-side only). Server middleware belongs in `start.ts` using `requestMiddleware`.**
120
114
 
121
115
  ## Callback Route (CRITICAL)
122
116
 
@@ -245,6 +239,26 @@ Do not skip this step. If the build fails, fix the errors before finishing. Comm
245
239
  - Missing Vite types → re-run step 2
246
240
  - Wrong import paths → check package name is `@workos/authkit-tanstack-react-start`
247
241
 
242
+ ## Verification Checklist (ALL MUST PASS)
243
+
244
+ Run these commands to confirm integration. **Do not mark complete until all pass:**
245
+
246
+ ```bash
247
+ # 1. Check authkitMiddleware is configured
248
+ grep -r "authkitMiddleware" src/ app/ 2>/dev/null || echo "FAIL: Middleware not configured"
249
+
250
+ # 2. Check callback route exists
251
+ find src/routes app/routes -name "*callback*" 2>/dev/null
252
+
253
+ # 3. Check environment variables
254
+ grep -c "WORKOS_" .env 2>/dev/null || echo "FAIL: No env vars found"
255
+
256
+ # 4. Build succeeds
257
+ pnpm build
258
+ ```
259
+
260
+ **If check #1 fails:** authkitMiddleware must be in src/start.ts (or app/start.ts for legacy) requestMiddleware array. Auth will fail silently without it.
261
+
248
262
  ## Error Recovery
249
263
 
250
264
  ### "AuthKit middleware is not configured"
@@ -9,7 +9,7 @@ description: Integrate WorkOS AuthKit with vanilla JavaScript applications. No f
9
9
 
10
10
  ### Step 1: Fetch README (BLOCKING)
11
11
 
12
- WebFetch: `https://github.com/workos/authkit-js/blob/main/README.md`
12
+ WebFetch: `https://raw.githubusercontent.com/workos/authkit-js/main/README.md`
13
13
 
14
14
  **README is source of truth.** If this skill conflicts, follow README.
15
15
 
@@ -43,16 +43,25 @@ Follow README examples for:
43
43
  const authkit = await createClient(clientId);
44
44
  ```
45
45
 
46
- ## Verification Checklist
46
+ ## Verification Checklist (ALL MUST PASS)
47
47
 
48
- - [ ] README fetched and read before writing code
49
- - [ ] Project type detected (bundled vs CDN)
50
- - [ ] SDK installed/script added
51
- - [ ] `createClient()` called with `await`
52
- - [ ] Client ID provided (env var or hardcoded)
53
- - [ ] Sign in called from user gesture (click handler)
54
- - [ ] No console errors on page load
55
- - [ ] Auth UI updates on sign in/out
48
+ Run these commands to confirm integration. **Do not mark complete until all pass:**
49
+
50
+ ```bash
51
+ # 1. Check SDK is available (bundled or CDN)
52
+ grep -r "createClient\|WorkOS" src/ *.html 2>/dev/null || echo "FAIL: SDK not found"
53
+
54
+ # 2. Check createClient uses await
55
+ grep -rn "await createClient" src/ *.js *.html 2>/dev/null || echo "FAIL: createClient must be awaited"
56
+
57
+ # 3. Check sign-in is on user gesture (click handler)
58
+ grep -rn "signIn\|sign_in" src/ *.js *.html 2>/dev/null
59
+
60
+ # 4. Build succeeds (bundled projects only)
61
+ pnpm build 2>/dev/null || echo "CDN project — verify manually in browser"
62
+ ```
63
+
64
+ **If check #2 fails:** createClient() is async and must be awaited. Using it without await returns a Promise, not a client.
56
65
 
57
66
  ## Environment Variables
58
67
 
@@ -37,6 +37,43 @@ Check `.env.local` for:
37
37
  - `WORKOS_API_KEY` - starts with `sk_`
38
38
  - `WORKOS_CLIENT_ID` - starts with `client_`
39
39
 
40
+ ## Step 2b: Partial Install Recovery
41
+
42
+ Before creating new files, check if a previous AuthKit attempt exists:
43
+
44
+ 1. Check if `:workos` is already in `mix.exs` dependencies
45
+ 2. Check for incomplete auth code — AuthController exists but has TODO stubs, 501 responses, or missing callback/sign_out functions
46
+ 3. If partial install detected:
47
+ - Do NOT re-add the SDK dependency (it's already there)
48
+ - Do NOT re-run `mix deps.get` if deps are already fetched
49
+ - Read existing auth files to understand what's done vs missing
50
+ - Complete the integration by filling gaps (controller methods, routes)
51
+ - Preserve any working code — only fix what's broken
52
+ - Check for missing `/auth/callback` route (most common gap)
53
+
54
+ ## Step 2c: Existing Auth System Detection
55
+
56
+ Check for existing authentication before integrating:
57
+
58
+ ```
59
+ mix.exs has ':ueberauth'? → Ueberauth auth
60
+ mix.exs has ':pow'? → Pow auth
61
+ mix.exs has ':guardian'? → Guardian JWT auth
62
+ mix.exs has ':phx_gen_auth'? → Phoenix generated auth
63
+ config/*.exs has 'Ueberauth' config? → Ueberauth configured
64
+ router.ex has '/:provider' wildcard auth routes? → Ueberauth routes
65
+ ```
66
+
67
+ If existing auth detected:
68
+
69
+ - Do NOT remove or disable it
70
+ - Add WorkOS AuthKit alongside the existing system
71
+ - If Ueberauth is configured, be careful of `/:provider` wildcard routes — use a specific scope like `/auth/workos` to avoid conflicts
72
+ - Reuse existing session infrastructure if compatible
73
+ - Create separate route paths for WorkOS auth
74
+ - Ensure existing auth routes continue to work unchanged
75
+ - Document in code comments how to migrate fully to WorkOS later
76
+
40
77
  ## Step 3: Install SDK
41
78
 
42
79
  Add the `workos` package to `mix.exs` dependencies:
@@ -9,7 +9,7 @@ description: Integrate WorkOS AuthKit with Go applications. Supports Gin and std
9
9
 
10
10
  **STOP. Do not proceed until complete.**
11
11
 
12
- WebFetch: `https://github.com/workos/workos-go/blob/main/README.md`
12
+ WebFetch: `https://raw.githubusercontent.com/workos/workos-go/main/README.md`
13
13
 
14
14
  The README is the source of truth for SDK API usage. If this skill conflicts with README, follow README.
15
15
 
@@ -40,6 +40,41 @@ go.mod contains github.com/gin-gonic/gin?
40
40
  +-- No --> Use stdlib net/http patterns
41
41
  ```
42
42
 
43
+ ## Step 2b: Partial Install Recovery
44
+
45
+ Before creating new files, check if a previous AuthKit attempt exists:
46
+
47
+ 1. Check if `github.com/workos/workos-go` is already in `go.mod`
48
+ 2. Check for incomplete auth code — files that import WorkOS packages but have non-functional handlers (TODO comments, 501 responses, empty handler bodies)
49
+ 3. If partial install detected:
50
+ - Do NOT re-run `go get` (the module is already there)
51
+ - Read existing auth files to understand what's done vs missing
52
+ - Complete the integration by filling gaps rather than starting fresh
53
+ - Preserve any working code — only fix what's broken
54
+ - If `usermanagement.SetAPIKey()` is already called in `init()`, don't call it again
55
+ - Always run `go mod tidy` after changes to keep `go.sum` consistent
56
+
57
+ ## Step 2c: Existing Auth System Detection
58
+
59
+ Check for existing authentication before integrating:
60
+
61
+ ```
62
+ *.go files have 'jwt' or 'JWT'? → Custom JWT auth
63
+ *.go files have 'oauth2'? → OAuth2 middleware
64
+ *.go files have 'authMiddleware'? → Custom auth middleware
65
+ go.mod has 'golang.org/x/oauth2'? → OAuth2 package
66
+ go.mod has 'github.com/coreos/go-oidc'? → OIDC auth
67
+ ```
68
+
69
+ If existing auth detected:
70
+
71
+ - Do NOT remove or disable it
72
+ - Add WorkOS AuthKit alongside the existing system
73
+ - Create separate route paths for WorkOS auth (e.g., `/auth/workos/login` if `/auth/login` is taken)
74
+ - Match handler signatures to the detected framework (Gin `*gin.Context` vs stdlib `http.ResponseWriter, *http.Request`)
75
+ - Ensure existing auth middleware continues to work on its routes
76
+ - Document in code comments how to migrate fully to WorkOS later
77
+
43
78
  ## Step 3: Install SDK
44
79
 
45
80
  Run:
@@ -37,6 +37,40 @@ Check `application.properties` or `application.yml` for:
37
37
  - `workos.api-key` or `WORKOS_API_KEY`
38
38
  - `workos.client-id` or `WORKOS_CLIENT_ID`
39
39
 
40
+ ## Step 2b: Partial Install Recovery
41
+
42
+ Before creating new files, check if a previous AuthKit attempt exists:
43
+
44
+ 1. Check if `workos-kotlin` is already in `build.gradle.kts` dependencies
45
+ 2. Check for incomplete auth code — WorkOS imported/instantiated but no controller with login/callback endpoints
46
+ 3. If partial install detected:
47
+ - Do NOT re-add the SDK dependency (it's already there)
48
+ - Read existing source files to understand what's done vs missing
49
+ - Complete the integration by filling gaps (controller, config bean, routes)
50
+ - Preserve any working code — only fix what's broken
51
+ - Check for a missing `/auth/callback` endpoint (most common gap)
52
+
53
+ ## Step 2c: Existing Auth System Detection
54
+
55
+ Check for existing authentication before integrating:
56
+
57
+ ```
58
+ build.gradle.kts has 'spring-boot-starter-security'? → Spring Security
59
+ *.kt files have 'SecurityFilterChain'? → Security filter config
60
+ *.kt files have 'formLogin'? → Form-based auth
61
+ *.kt files have 'oauth2Login'? → OAuth2 auth
62
+ *.kt files have 'httpBasic'? → Basic auth
63
+ ```
64
+
65
+ If existing auth detected:
66
+
67
+ - Do NOT remove or disable it
68
+ - Add WorkOS AuthKit alongside the existing system
69
+ - If Spring Security is configured, ensure WorkOS auth routes are permitted through the security filter chain (add `.requestMatchers("/auth/workos/**").permitAll()`)
70
+ - Create separate route paths for WorkOS auth (e.g., `/auth/workos/login` if `/login` is taken)
71
+ - Ensure existing auth routes continue to work unchanged
72
+ - Document in code comments how to migrate fully to WorkOS later
73
+
40
74
  ## Step 3: Install SDK
41
75
 
42
76
  Add the WorkOS Kotlin SDK dependency to `build.gradle.kts`:
@@ -5,7 +5,7 @@ description: Manage WorkOS resources (orgs, users, roles, SSO, directories, webh
5
5
 
6
6
  # WorkOS Management Commands
7
7
 
8
- Use these commands to manage WorkOS resources directly from the terminal. The CLI must be authenticated via `workos login` or `WORKOS_API_KEY` env var.
8
+ Use these commands to manage WorkOS resources directly from the terminal. The CLI must be authenticated via `workos auth login` or `WORKOS_API_KEY` env var.
9
9
 
10
10
  All commands support `--json` for structured output. Use `--json` when you need to parse output (e.g., extract an ID).
11
11
 
@@ -36,6 +36,39 @@ Detect package manager: `pnpm-lock.yaml` → `yarn.lock` → `bun.lockb` → npm
36
36
 
37
37
  **Adapt all subsequent steps to the detected framework and module system.**
38
38
 
39
+ ## Step 2b: Partial Install Recovery
40
+
41
+ Before creating new files, check if a previous AuthKit attempt exists:
42
+
43
+ 1. Check if `@workos-inc/node` is already in `package.json`
44
+ 2. Check for incomplete auth files — routes/handlers that import `@workos-inc/node` but are non-functional (TODO comments, 501 responses, empty handlers)
45
+ 3. If partial install detected:
46
+ - Do NOT reinstall the SDK (it's already there)
47
+ - Read existing auth files to understand what's done vs missing
48
+ - Complete the integration by filling gaps rather than starting fresh
49
+ - Preserve any working code — only fix what's broken
50
+ - Check for a missing `/callback` route (most common gap)
51
+
52
+ ## Step 2c: Existing Auth System Detection
53
+
54
+ Check for existing authentication before integrating:
55
+
56
+ ```
57
+ package.json has 'passport'? → Passport.js auth
58
+ package.json has 'express-openid-connect'? → Auth0 / OIDC
59
+ package.json has 'express-session'? → Session-based auth may exist
60
+ *.js/*.ts files have 'jsonwebtoken'? → JWT-based auth
61
+ ```
62
+
63
+ If existing auth detected:
64
+
65
+ - Do NOT remove or disable it
66
+ - Add WorkOS AuthKit alongside the existing system
67
+ - If `express-session` is already configured, reuse it for WorkOS session storage (don't create a second session middleware)
68
+ - Create separate route paths for WorkOS auth (e.g., `/auth/workos/login` if `/login` is taken)
69
+ - Ensure existing auth routes continue to work unchanged
70
+ - Document in code comments how to migrate fully to WorkOS later
71
+
39
72
  ## Step 3: Install SDK
40
73
 
41
74
  ```
@@ -9,7 +9,7 @@ description: Integrate WorkOS AuthKit with generic PHP applications. Uses the wo
9
9
 
10
10
  **STOP. Do not proceed until complete.**
11
11
 
12
- WebFetch: `https://github.com/workos/workos-php/blob/main/README.md`
12
+ WebFetch: `https://raw.githubusercontent.com/workos/workos-php/main/README.md`
13
13
 
14
14
  The README is the source of truth. If this skill conflicts with README, follow README.
15
15
 
@@ -30,6 +30,39 @@ Check for `.env` file with:
30
30
 
31
31
  If `.env` doesn't exist, create it with the required variables.
32
32
 
33
+ ## Step 2b: Partial Install Recovery
34
+
35
+ Before creating new files, check if a previous AuthKit attempt exists:
36
+
37
+ 1. Check if `workos/workos-php` is already in `composer.json`
38
+ 2. Check for incomplete auth files — `login.php` or `callback.php` that import WorkOS but are non-functional (TODO comments, 501 responses, empty handlers)
39
+ 3. If partial install detected:
40
+ - Do NOT reinstall the SDK (it's already there)
41
+ - Read existing auth files to understand what's done vs missing
42
+ - Complete the integration by filling gaps rather than starting fresh
43
+ - Preserve any working code — only fix what's broken
44
+ - Check for a missing `callback.php` (most common gap)
45
+
46
+ ## Step 2c: Existing Auth System Detection
47
+
48
+ Check for existing authentication before integrating:
49
+
50
+ ```
51
+ *.php files have 'session_start()' + '$_SESSION'? → Native PHP session auth
52
+ *.php files have 'password_verify'? → Password-based auth
53
+ *.php files have form POST to '/login'? → Form-based auth
54
+ composer.json has auth libraries? → Third-party auth
55
+ ```
56
+
57
+ If existing auth detected:
58
+
59
+ - Do NOT remove or disable it
60
+ - Add WorkOS AuthKit alongside the existing system
61
+ - If `session_start()` is already used, reuse the session for WorkOS (don't create a second session mechanism)
62
+ - Create separate file paths for WorkOS auth (e.g., `workos-login.php` if `login.php` is taken)
63
+ - Ensure existing auth routes continue to work unchanged
64
+ - Document in code comments how to migrate fully to WorkOS later
65
+
33
66
  ## Step 3: Install SDK
34
67
 
35
68
  ```bash
@@ -9,7 +9,7 @@ description: Integrate WorkOS AuthKit with Laravel applications. Uses the dedica
9
9
 
10
10
  **STOP. Do not proceed until complete.**
11
11
 
12
- WebFetch: `https://github.com/workos/workos-php-laravel/blob/main/README.md`
12
+ WebFetch: `https://raw.githubusercontent.com/workos/workos-php-laravel/main/README.md`
13
13
 
14
14
  The README is the source of truth. If this skill conflicts with README, follow README.
15
15
 
@@ -31,6 +31,41 @@ Check `.env` for:
31
31
 
32
32
  If `.env` exists but is missing these variables, append them. If `.env` doesn't exist, copy `.env.example` and add them.
33
33
 
34
+ ## Step 2b: Partial Install Recovery
35
+
36
+ Before creating new files, check if a previous AuthKit attempt exists:
37
+
38
+ 1. Check if `workos/workos-php-laravel` is already in `composer.json`
39
+ 2. Check if `config/workos.php` exists but no auth controller or routes are wired
40
+ 3. If partial install detected:
41
+ - Do NOT reinstall the SDK (it's already there)
42
+ - Do NOT re-publish config if `config/workos.php` already exists
43
+ - Read existing files to understand what's done vs missing
44
+ - Complete the integration by filling gaps (controller, routes, middleware)
45
+ - Preserve any working code — only fix what's broken
46
+ - Check for missing auth controller or routes (most common gap)
47
+
48
+ ## Step 2c: Existing Auth System Detection
49
+
50
+ Check for existing authentication before integrating:
51
+
52
+ ```
53
+ composer.json has 'laravel/breeze'? → Breeze auth scaffolding
54
+ composer.json has 'laravel/jetstream'? → Jetstream auth
55
+ composer.json has 'laravel/fortify'? → Fortify auth backend
56
+ app/Http/Controllers/Auth/ exists? → Auth controllers present
57
+ routes/auth.php exists? → Auth routes file
58
+ ```
59
+
60
+ If existing auth detected:
61
+
62
+ - Do NOT remove or disable it
63
+ - Add WorkOS AuthKit alongside the existing system
64
+ - If Laravel session is already configured, reuse it for WorkOS
65
+ - Create separate route paths for WorkOS auth (e.g., `/auth/workos/login` if `/login` is taken)
66
+ - Ensure existing auth routes continue to work unchanged
67
+ - Document in code comments how to migrate fully to WorkOS later
68
+
34
69
  ## Step 3: Install SDK
35
70
 
36
71
  ```bash
@@ -35,6 +35,40 @@ None of the above? → Vanilla Python (use Flask quickstar
35
35
 
36
36
  **Adapt all subsequent steps to the detected framework.** Do not force one framework onto another.
37
37
 
38
+ ## Step 2b: Partial Install Recovery
39
+
40
+ Before creating new files, check if a previous AuthKit attempt exists:
41
+
42
+ 1. Check if `workos` is already in `requirements.txt` or `pyproject.toml`
43
+ 2. Check for incomplete auth files — files that import `workos` but have non-functional routes (TODO comments, commented-out code, empty handlers)
44
+ 3. If partial install detected:
45
+ - Do NOT reinstall the SDK (it's already there)
46
+ - Read existing auth files to understand what's done vs missing
47
+ - Complete the integration by filling gaps rather than starting fresh
48
+ - Preserve any working code — only fix what's broken
49
+ - Check for a missing `/callback` route (most common gap)
50
+
51
+ ## Step 2c: Existing Auth System Detection
52
+
53
+ Check for existing authentication before integrating:
54
+
55
+ ```
56
+ requirements.txt has 'flask-login'? → Flask-Login auth
57
+ requirements.txt has 'authlib'? → OAuth/OIDC auth (e.g., Auth0)
58
+ requirements.txt has 'django-allauth'? → Django allauth
59
+ manage.py exists + 'django.contrib.auth'? → Django built-in auth
60
+ *.py files have 'flask_login'? → Flask-Login in use
61
+ ```
62
+
63
+ If existing auth detected:
64
+
65
+ - Do NOT remove or disable it
66
+ - Add WorkOS AuthKit alongside the existing system
67
+ - If `flask-login` is present, use Flask-Login's session infrastructure (`login_user()`) for WorkOS auth too, rather than raw session management
68
+ - Create separate route paths for WorkOS auth (e.g., `/auth/workos/login` if `/login` is taken)
69
+ - Ensure existing auth routes continue to work unchanged
70
+ - Document in code comments how to migrate fully to WorkOS later
71
+
38
72
  ## Step 3: Pre-Flight Validation
39
73
 
40
74
  ### Package Manager Detection
@@ -32,6 +32,41 @@ None of the above? → Vanilla Ruby (use Sinatra quickstar
32
32
 
33
33
  **Adapt all subsequent steps to the detected framework.** Do not force Rails on a Sinatra project or vice versa.
34
34
 
35
+ ## Step 2b: Partial Install Recovery
36
+
37
+ Before creating new files, check if a previous AuthKit attempt exists:
38
+
39
+ 1. Check if `workos` is already in `Gemfile`
40
+ 2. Check for incomplete auth files — files that `require "workos"` but have non-functional routes (TODO comments, 501 responses, empty handlers)
41
+ 3. If partial install detected:
42
+ - Do NOT reinstall the gem (it's already there)
43
+ - Read existing auth files to understand what's done vs missing
44
+ - Complete the integration by filling gaps rather than starting fresh
45
+ - Preserve any working code — only fix what's broken
46
+ - Run `bundle install` (not `bundle update`) to avoid unexpected gem upgrades
47
+
48
+ ## Step 2c: Existing Auth System Detection
49
+
50
+ Check for existing authentication before integrating:
51
+
52
+ ```
53
+ Gemfile has 'devise'? → Devise auth (uses Warden)
54
+ Gemfile has 'warden'? → Warden auth
55
+ Gemfile has 'omniauth'? → OmniAuth (OAuth/OIDC)
56
+ *.rb files have 'Warden'? → Warden middleware in use
57
+ config/initializers has devise.rb? → Devise configured
58
+ ```
59
+
60
+ If existing auth detected:
61
+
62
+ - Do NOT remove or disable it
63
+ - Add WorkOS AuthKit alongside the existing system
64
+ - If Devise is present, Devise uses Warden under the hood — integrate WorkOS at the Warden strategy level if possible
65
+ - Create separate route paths for WorkOS auth (e.g., `/auth/workos/login` if `/login` is taken)
66
+ - Ensure Rack middleware ordering is correct (WorkOS session middleware must not conflict)
67
+ - Ensure existing auth routes continue to work unchanged
68
+ - Document in code comments how to migrate fully to WorkOS later
69
+
35
70
  ## Step 3: Install WorkOS Gem
36
71
 
37
72
  ```bash