workos 0.8.1 → 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 (52) 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 +7 -5
  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/doctor/checks/auth-patterns.js +10 -5
  12. package/dist/doctor/checks/auth-patterns.js.map +1 -1
  13. package/dist/lib/adapters/cli-adapter.js +1 -1
  14. package/dist/lib/adapters/cli-adapter.js.map +1 -1
  15. package/dist/lib/agent-interface.js +5 -5
  16. package/dist/lib/agent-interface.js.map +1 -1
  17. package/dist/lib/config-store.js +8 -7
  18. package/dist/lib/config-store.js.map +1 -1
  19. package/dist/lib/credential-proxy.js +1 -1
  20. package/dist/lib/credential-proxy.js.map +1 -1
  21. package/dist/lib/credential-store.js +8 -2
  22. package/dist/lib/credential-store.js.map +1 -1
  23. package/dist/lib/ensure-auth.js +12 -24
  24. package/dist/lib/ensure-auth.js.map +1 -1
  25. package/dist/lib/run-with-core.js +1 -1
  26. package/dist/lib/run-with-core.js.map +1 -1
  27. package/dist/lib/token-refresh-client.js +1 -1
  28. package/dist/lib/token-refresh-client.js.map +1 -1
  29. package/dist/lib/token-refresh.js +1 -1
  30. package/dist/lib/token-refresh.js.map +1 -1
  31. package/dist/lib/version-check.js +2 -1
  32. package/dist/lib/version-check.js.map +1 -1
  33. package/dist/utils/exit-codes.js +1 -1
  34. package/dist/utils/exit-codes.js.map +1 -1
  35. package/dist/utils/help-json.js +7 -2
  36. package/dist/utils/help-json.js.map +1 -1
  37. package/package.json +1 -1
  38. package/skills/workos-authkit-nextjs/SKILL.md +1 -1
  39. package/skills/workos-authkit-react/SKILL.md +19 -10
  40. package/skills/workos-authkit-react-router/SKILL.md +18 -8
  41. package/skills/workos-authkit-sveltekit/SKILL.md +55 -7
  42. package/skills/workos-authkit-tanstack-start/SKILL.md +67 -16
  43. package/skills/workos-authkit-vanilla-js/SKILL.md +19 -10
  44. package/skills/workos-elixir/SKILL.md +37 -0
  45. package/skills/workos-go/SKILL.md +36 -1
  46. package/skills/workos-kotlin/SKILL.md +34 -0
  47. package/skills/workos-management/SKILL.md +1 -1
  48. package/skills/workos-node/SKILL.md +33 -0
  49. package/skills/workos-php/SKILL.md +34 -1
  50. package/skills/workos-php-laravel/SKILL.md +36 -1
  51. package/skills/workos-python/SKILL.md +34 -0
  52. package/skills/workos-ruby/SKILL.md +35 -0
@@ -9,7 +9,7 @@ description: Integrate WorkOS AuthKit with SvelteKit. Server-side authentication
9
9
 
10
10
  **STOP. Do not proceed until complete.**
11
11
 
12
- WebFetch: `https://github.com/workos/authkit-sveltekit/blob/main/README.md`
12
+ WebFetch: `https://raw.githubusercontent.com/workos/authkit-sveltekit/main/README.md`
13
13
 
14
14
  The README is the source of truth. If this skill conflicts with README, follow README.
15
15
 
@@ -32,15 +32,63 @@ Check `.env` or `.env.local` for:
32
32
 
33
33
  SvelteKit uses `$env/static/private` and `$env/dynamic/private` natively. The agent should write env vars to `.env` (SvelteKit's default) or `.env.local`.
34
34
 
35
+ ## Step 2b: Partial Install Recovery
36
+
37
+ Before installing the SDK, check if a previous AuthKit attempt already exists:
38
+
39
+ 1. Check if `@workos/authkit-sveltekit` is already in `package.json`
40
+ 2. Check for incomplete setup signals:
41
+ - `src/hooks.server.ts` has commented-out `authkitHandle` import or exports a passthrough handle
42
+ - `src/routes/+layout.server.ts` has TODO comments about loading the session
43
+ - No callback `+server.ts` route exists in `src/routes/`
44
+ - No `WORKOS_COOKIE_PASSWORD` in `.env`
45
+ 3. If partial install detected:
46
+ - Do NOT reinstall the SDK (it's already there)
47
+ - Read existing files to understand what's done vs missing
48
+ - Complete the integration by filling gaps rather than starting fresh
49
+ - The most common gap is the missing callback route — create it
50
+ - Wire up `authkitHandle` in hooks.server.ts properly (use `sequence()` if other hooks exist)
51
+ - Complete the layout load function
52
+ - Ensure `WORKOS_COOKIE_PASSWORD` is set in `.env`
53
+
54
+ ## Step 2c: Existing Auth System Detection
55
+
56
+ Check for existing authentication before integrating:
57
+
58
+ ```
59
+ package.json has 'lucia'? → Lucia v3 session auth
60
+ package.json has '@auth0/auth0-spa-js'? → Auth0 SPA auth
61
+ package.json has '@auth/sveltekit'? → Auth.js SvelteKit
62
+ src/hooks.server.ts handles cookies? → Custom session middleware
63
+ ```
64
+
65
+ If existing auth detected (Lucia is most common in SvelteKit):
66
+
67
+ - Do NOT remove or disable the existing auth system
68
+ - Use `sequence()` from `@sveltejs/kit/hooks` to compose handles:
69
+
70
+ ```typescript
71
+ import { sequence } from '@sveltejs/kit/hooks';
72
+ import { authkitHandle } from '@workos/authkit-sveltekit';
73
+
74
+ // Keep existing handle, compose with AuthKit
75
+ export const handle = sequence(authkitHandle, existingHandle);
76
+ ```
77
+
78
+ - AuthKit handle should come FIRST in `sequence()` so it runs before other middleware
79
+ - Create separate WorkOS routes if `/login` or `/callback` are already taken (e.g., use `/auth/callback`)
80
+ - Ensure existing auth routes, form actions, and session cookies continue to work unchanged
81
+ - Document in code comments how to migrate fully to WorkOS AuthKit later
82
+
35
83
  ## Step 3: Install SDK
36
84
 
37
85
  Detect package manager, install SDK package from README.
38
86
 
39
87
  ```
40
- pnpm-lock.yaml? → pnpm add @workos-inc/authkit-sveltekit
41
- yarn.lock? → yarn add @workos-inc/authkit-sveltekit
42
- bun.lockb? → bun add @workos-inc/authkit-sveltekit
43
- else → npm install @workos-inc/authkit-sveltekit
88
+ pnpm-lock.yaml? → pnpm add @workos/authkit-sveltekit
89
+ yarn.lock? → yarn add @workos/authkit-sveltekit
90
+ bun.lockb? → bun add @workos/authkit-sveltekit
91
+ else → npm install @workos/authkit-sveltekit
44
92
  ```
45
93
 
46
94
  **Verify:** SDK package exists in node_modules before continuing.
@@ -57,7 +105,7 @@ If `src/hooks.server.ts` already exists with custom logic, use SvelteKit's `sequ
57
105
 
58
106
  ```typescript
59
107
  import { sequence } from '@sveltejs/kit/hooks';
60
- import { authkitHandle } from '@workos-inc/authkit-sveltekit'; // Check README for exact export
108
+ import { authkitHandle } from '@workos/authkit-sveltekit'; // Check README for exact export
61
109
 
62
110
  export const handle = sequence(authkitHandle, yourExistingHandle);
63
111
  ```
@@ -126,7 +174,7 @@ pnpm build || npm run build
126
174
 
127
175
  ## Error Recovery
128
176
 
129
- ### "Cannot find module '@workos-inc/authkit-sveltekit'"
177
+ ### "Cannot find module '@workos/authkit-sveltekit'"
130
178
 
131
179
  - Check: SDK installed before writing imports
132
180
  - Check: SDK package directory exists in node_modules
@@ -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
 
@@ -86,34 +86,31 @@ Default redirect URI: `http://localhost:3000/api/auth/callback`
86
86
 
87
87
  **authkitMiddleware MUST be configured or auth will fail silently.**
88
88
 
89
- Create or update `src/start.ts` (or `app/start.ts` for legacy):
89
+ **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`.**
90
90
 
91
- ```typescript
92
- import { authkitMiddleware } from '@workos/authkit-tanstack-react-start';
91
+ ### If `start.ts` already exists
93
92
 
94
- export default {
95
- requestMiddleware: [authkitMiddleware()],
96
- };
97
- ```
93
+ Read the existing file first. Add `authkitMiddleware` to the existing `requestMiddleware` array (or create the array if missing). Preserve the existing export style. Do not rewrite the file from scratch.
94
+
95
+ ### If `start.ts` does not exist
98
96
 
99
- Alternative pattern with createStart:
97
+ Create `src/start.ts` (or `app/start.ts` for legacy) using `createStart`:
100
98
 
101
99
  ```typescript
102
100
  import { createStart } from '@tanstack/react-start';
103
101
  import { authkitMiddleware } from '@workos/authkit-tanstack-react-start';
104
102
 
105
- export default createStart({
103
+ export const startInstance = createStart(() => ({
106
104
  requestMiddleware: [authkitMiddleware()],
107
- });
105
+ }));
108
106
  ```
109
107
 
110
- ### Verification Checklist
108
+ **Two things matter here:**
111
109
 
112
- - [ ] `authkitMiddleware` imported from `@workos/authkit-tanstack-react-start`
113
- - [ ] Middleware in `requestMiddleware` array
114
- - [ ] File exports the config (default export or named `startInstance`)
110
+ 1. **Named export `startInstance`** — the build plugin generates `import type { startInstance }` from this file. A `default` export will cause a build error.
111
+ 2. **`createStart` takes a function** returning the options object, not the options directly. `createStart({ ... })` will fail.
115
112
 
116
- 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`.**
117
114
 
118
115
  ## Callback Route (CRITICAL)
119
116
 
@@ -208,6 +205,60 @@ function Profile() {
208
205
 
209
206
  **Note:** Server-side `getAuth()` is preferred for most use cases.
210
207
 
208
+ ## Finalize (REQUIRED before declaring success)
209
+
210
+ After creating/editing all files, run these steps in order. Skipping them is the most common cause of build failures.
211
+
212
+ ### 1. Regenerate the route tree
213
+
214
+ Adding new route files (callback, signout, etc.) makes the existing `routeTree.gen.ts` stale. The build will fail with type errors about missing routes until it is regenerated.
215
+
216
+ ```bash
217
+ pnpm build 2>/dev/null || npx tsr generate
218
+ ```
219
+
220
+ The build itself triggers route tree regeneration. If it fails for other reasons, use `tsr generate` directly.
221
+
222
+ ### 2. Ensure Vite type declarations exist
223
+
224
+ TanStack Start projects import CSS with `import styles from './styles.css?url'`. Without Vite's type declarations, TypeScript will error on these imports. Check if `src/vite-env.d.ts` (or `app/vite-env.d.ts`) exists — if not, create it now (before attempting the build):
225
+
226
+ ```typescript
227
+ /// <reference types="vite/client" />
228
+ ```
229
+
230
+ ### 3. Verify the build
231
+
232
+ ```bash
233
+ pnpm build
234
+ ```
235
+
236
+ Do not skip this step. If the build fails, fix the errors before finishing. Common causes:
237
+
238
+ - Stale route tree → re-run step 1
239
+ - Missing Vite types → re-run step 2
240
+ - Wrong import paths → check package name is `@workos/authkit-tanstack-react-start`
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
+
211
262
  ## Error Recovery
212
263
 
213
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