workos 0.1.2 → 0.2.1

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 (60) hide show
  1. package/dist/cli.config.d.ts +1 -0
  2. package/dist/cli.config.js +1 -0
  3. package/dist/cli.config.js.map +1 -1
  4. package/dist/src/commands/login.js +1 -1
  5. package/dist/src/commands/login.js.map +1 -1
  6. package/dist/src/lib/adapters/cli-adapter.d.ts +21 -0
  7. package/dist/src/lib/adapters/cli-adapter.js +165 -21
  8. package/dist/src/lib/adapters/cli-adapter.js.map +1 -1
  9. package/dist/src/lib/adapters/dashboard-adapter.js +13 -0
  10. package/dist/src/lib/adapters/dashboard-adapter.js.map +1 -1
  11. package/dist/src/lib/ai-content.d.ts +10 -0
  12. package/dist/src/lib/ai-content.js +68 -0
  13. package/dist/src/lib/ai-content.js.map +1 -0
  14. package/dist/src/lib/credential-discovery.d.ts +42 -0
  15. package/dist/src/lib/credential-discovery.js +100 -0
  16. package/dist/src/lib/credential-discovery.js.map +1 -0
  17. package/dist/src/lib/credentials.d.ts +22 -0
  18. package/dist/src/lib/credentials.js +29 -0
  19. package/dist/src/lib/credentials.js.map +1 -1
  20. package/dist/src/lib/device-auth.d.ts +44 -0
  21. package/dist/src/lib/device-auth.js +137 -0
  22. package/dist/src/lib/device-auth.js.map +1 -0
  23. package/dist/src/lib/events.d.ts +75 -0
  24. package/dist/src/lib/events.js.map +1 -1
  25. package/dist/src/lib/post-install.d.ts +8 -0
  26. package/dist/src/lib/post-install.js +51 -0
  27. package/dist/src/lib/post-install.js.map +1 -0
  28. package/dist/src/lib/run-with-core.js +107 -1
  29. package/dist/src/lib/run-with-core.js.map +1 -1
  30. package/dist/src/lib/settings.js +2 -3
  31. package/dist/src/lib/settings.js.map +1 -1
  32. package/dist/src/lib/staging-api.d.ts +22 -0
  33. package/dist/src/lib/staging-api.js +74 -0
  34. package/dist/src/lib/staging-api.js.map +1 -0
  35. package/dist/src/lib/wizard-core.d.ts +300 -8
  36. package/dist/src/lib/wizard-core.js +622 -27
  37. package/dist/src/lib/wizard-core.js.map +1 -1
  38. package/dist/src/lib/wizard-core.types.d.ts +64 -1
  39. package/dist/src/lib/wizard-core.types.js.map +1 -1
  40. package/dist/src/run.d.ts +1 -0
  41. package/dist/src/run.js +1 -0
  42. package/dist/src/run.js.map +1 -1
  43. package/dist/src/utils/debug.js +15 -9
  44. package/dist/src/utils/debug.js.map +1 -1
  45. package/dist/src/utils/git-utils.d.ts +23 -0
  46. package/dist/src/utils/git-utils.js +86 -0
  47. package/dist/src/utils/git-utils.js.map +1 -0
  48. package/dist/src/utils/types.d.ts +4 -0
  49. package/dist/src/utils/types.js.map +1 -1
  50. package/dist/src/version.d.ts +1 -0
  51. package/dist/src/version.js +2 -0
  52. package/dist/src/version.js.map +1 -0
  53. package/package.json +7 -7
  54. package/skills/workos-authkit-base/SKILL.md +24 -14
  55. package/skills/workos-authkit-nextjs/SKILL.md +12 -1
  56. package/skills/workos-authkit-react/SKILL.md +4 -4
  57. package/skills/workos-authkit-react-router/SKILL.md +11 -10
  58. package/skills/workos-authkit-tanstack-start/SKILL.md +8 -6
  59. package/skills/workos-authkit-vanilla-js/SKILL.md +10 -8
  60. package/dist/package.json +0 -87
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workos",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "The Official Workos CLI",
6
6
  "keywords": [
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@anthropic-ai/claude-agent-sdk": "~0.2.19",
39
+ "@anthropic-ai/sdk": "^0.71.2",
39
40
  "@clack/core": "^0.5.0",
40
41
  "@clack/prompts": "0.11.0",
41
42
  "chalk": "^5.6.2",
@@ -67,10 +68,11 @@
67
68
  "engines": {
68
69
  "node": ">=20.20"
69
70
  },
70
- "packageManager": "pnpm@10.23.0+sha512.21c4e5698002ade97e4efe8b8b4a89a8de3c85a37919f957e7a0f30f38fbc5bbdd05980ffe29179b2fb6e6e691242e098d945d1601772cad0fef5fb6411e2a4b",
71
+ "author": "WorkOS",
72
+ "license": "MIT",
71
73
  "scripts": {
72
74
  "clean": "rm -rf ./dist",
73
- "prebuild": "pnpm clean",
75
+ "prebuild": "echo \"export const version = '$(node -p \"require('./package.json').version\")';\" > src/version.ts && pnpm clean",
74
76
  "build:watch": "pnpm tsc -w",
75
77
  "build": "pnpm tsc",
76
78
  "postbuild": "chmod +x ./dist/bin.js && cp -r scripts/** dist",
@@ -81,7 +83,5 @@
81
83
  "test": "vitest run",
82
84
  "test:watch": "vitest",
83
85
  "typecheck": "tsc --noEmit"
84
- },
85
- "author": "WorkOS",
86
- "license": "MIT"
87
- }
86
+ }
87
+ }
@@ -17,14 +17,14 @@ README is the source of truth for: install commands, imports, API usage, code pa
17
17
 
18
18
  ## Task Structure (Required)
19
19
 
20
- | Phase | Task | Blocked By | Purpose |
21
- |-------|------|------------|---------|
22
- | 1 | preflight | - | Verify env vars, detect framework |
23
- | 2 | install | preflight | Install SDK package |
24
- | 3 | callback | install | Create OAuth callback route |
25
- | 4 | provider | install | Setup auth context/middleware |
26
- | 5 | ui | callback, provider | Add sign-in/out UI |
27
- | 6 | verify | ui | Build confirmation |
20
+ | Phase | Task | Blocked By | Purpose |
21
+ | ----- | --------- | ------------------ | --------------------------------- |
22
+ | 1 | preflight | - | Verify env vars, detect framework |
23
+ | 2 | install | preflight | Install SDK package |
24
+ | 3 | callback | install | Create OAuth callback route |
25
+ | 4 | provider | install | Setup auth context/middleware |
26
+ | 5 | ui | callback, provider | Add sign-in/out UI |
27
+ | 6 | verify | ui | Build confirmation |
28
28
 
29
29
  ## Decision Trees
30
30
 
@@ -51,57 +51,67 @@ Extract path from `WORKOS_REDIRECT_URI` → create route at that exact path.
51
51
 
52
52
  ## Environment Variables
53
53
 
54
- | Variable | Purpose | When Required |
55
- |----------|---------|---------------|
56
- | `WORKOS_API_KEY` | Server authentication | Server SDKs |
57
- | `WORKOS_CLIENT_ID` | Client identification | All SDKs |
58
- | `WORKOS_REDIRECT_URI` | OAuth callback URL | Server SDKs |
59
- | `WORKOS_COOKIE_PASSWORD` | Session encryption (32+ chars) | Server SDKs |
54
+ | Variable | Purpose | When Required |
55
+ | ------------------------ | ------------------------------ | ------------- |
56
+ | `WORKOS_API_KEY` | Server authentication | Server SDKs |
57
+ | `WORKOS_CLIENT_ID` | Client identification | All SDKs |
58
+ | `WORKOS_REDIRECT_URI` | OAuth callback URL | Server SDKs |
59
+ | `WORKOS_COOKIE_PASSWORD` | Session encryption (32+ chars) | Server SDKs |
60
60
 
61
61
  Note: Some frameworks use prefixed variants (e.g., `NEXT_PUBLIC_*`). Check README.
62
62
 
63
63
  ## Verification Checklists
64
64
 
65
65
  ### After Install
66
+
66
67
  - [ ] SDK package installed in node_modules
67
68
  - [ ] No install errors in output
68
69
 
69
70
  ### After Callback Route
71
+
70
72
  - [ ] Route file exists at path matching `WORKOS_REDIRECT_URI`
71
73
  - [ ] Imports SDK callback handler (not custom OAuth)
72
74
 
73
75
  ### After Provider/Middleware
76
+
74
77
  - [ ] Provider wraps entire app (client-side)
75
78
  - [ ] Middleware configured in correct location (server-side)
76
79
 
77
80
  ### After UI
81
+
78
82
  - [ ] Home page shows conditional auth state
79
83
  - [ ] Uses SDK functions for sign-in/out URLs
80
84
 
81
85
  ### Final Verification
86
+
82
87
  - [ ] Build completes with exit code 0
83
88
  - [ ] No import resolution errors
84
89
 
85
90
  ## Error Recovery
86
91
 
87
92
  ### Module not found
93
+
88
94
  - [ ] Verify install completed successfully
89
95
  - [ ] Verify SDK exists in node_modules
90
96
  - [ ] Re-run install if missing
91
97
 
92
98
  ### Build import errors
99
+
93
100
  - [ ] Delete `node_modules`, reinstall
94
101
  - [ ] Verify package.json has SDK dependency
95
102
 
96
103
  ### Invalid redirect URI
104
+
97
105
  - [ ] Compare route path to `WORKOS_REDIRECT_URI`
98
106
  - [ ] Paths must match exactly
99
107
 
100
108
  ### Cookie password error
109
+
101
110
  - [ ] Verify `WORKOS_COOKIE_PASSWORD` is 32+ characters
102
111
  - [ ] Generate new: `openssl rand -base64 32`
103
112
 
104
113
  ### Auth state not persisting
114
+
105
115
  - [ ] Verify provider wraps entire app
106
116
  - [ ] Check middleware is in correct location
107
117
 
@@ -16,11 +16,14 @@ The README is the source of truth. If this skill conflicts with README, follow R
16
16
  ## Step 2: Pre-Flight Validation
17
17
 
18
18
  ### Project Structure
19
+
19
20
  - Confirm `next.config.js` or `next.config.mjs` exists
20
21
  - Confirm `package.json` contains `"next"` dependency
21
22
 
22
23
  ### Environment Variables
24
+
23
25
  Check `.env.local` for:
26
+
24
27
  - `WORKOS_API_KEY` - starts with `sk_`
25
28
  - `WORKOS_CLIENT_ID` - starts with `client_`
26
29
  - `NEXT_PUBLIC_WORKOS_REDIRECT_URI` - valid callback URL
@@ -106,9 +109,11 @@ All checks must pass before marking complete.
106
109
  ## Error Recovery
107
110
 
108
111
  ### "cookies was called outside a request scope" (Next.js 15+)
112
+
109
113
  **Most common cause:** Route handler not properly async or missing await.
110
114
 
111
115
  Fix for callback route:
116
+
112
117
  1. Check that `handleAuth()` is exported directly: `export const GET = handleAuth();`
113
118
  2. If using custom wrapper, ensure it's `async` and awaits any cookie operations
114
119
  3. Verify authkit-nextjs SDK version supports Next.js 15+ (check README for compatibility)
@@ -117,25 +122,31 @@ Fix for callback route:
117
122
  This error causes OAuth codes to expire ("invalid_grant"), so fix the handler first.
118
123
 
119
124
  ### "middleware.ts not found"
125
+
120
126
  - Check: File at project root or `src/`, not inside `app/`
121
127
  - Check: Filename matches Next.js version (proxy.ts for 16+, middleware.ts for 13-15)
122
128
 
123
129
  ### "Cannot use getUser in client component"
130
+
124
131
  - Check: Component has no `'use client'` directive, or
125
132
  - Check: Move auth logic to server component/API route
126
133
 
127
134
  ### "Module not found" for SDK import
135
+
128
136
  - Check: SDK installed before writing imports
129
137
  - Check: SDK package directory exists in node_modules
130
138
 
131
139
  ### "withAuth route not covered by middleware"
140
+
132
141
  - Check: Middleware/proxy file exists at correct location
133
142
  - Check: Matcher config includes the route path
134
143
 
135
144
  ### Build fails after AuthKitProvider
145
+
136
146
  - Check: README for correct import path (may be subpath export)
137
147
  - Check: No client/server boundary violations
138
148
 
139
- ### NEXT_PUBLIC_ prefix issues
149
+ ### NEXT*PUBLIC* prefix issues
150
+
140
151
  - Client components need `NEXT_PUBLIC_*` prefix
141
152
  - Server components use plain env var names
@@ -27,10 +27,10 @@ START
27
27
 
28
28
  ## Critical: Build Tool Detection
29
29
 
30
- | Marker File | Build Tool | Env Prefix | Access Pattern |
31
- |-------------|------------|------------|----------------|
32
- | `vite.config.ts` | Vite | `VITE_` | `import.meta.env.VITE_*` |
33
- | `craco.config.js` or none | CRA | `REACT_APP_` | `process.env.REACT_APP_*` |
30
+ | Marker File | Build Tool | Env Prefix | Access Pattern |
31
+ | ------------------------- | ---------- | ------------ | ------------------------- |
32
+ | `vite.config.ts` | Vite | `VITE_` | `import.meta.env.VITE_*` |
33
+ | `craco.config.js` or none | CRA | `REACT_APP_` | `process.env.REACT_APP_*` |
34
34
 
35
35
  **Wrong prefix = undefined values at runtime.** This is the #1 integration failure.
36
36
 
@@ -24,14 +24,15 @@ The README is the source of truth. If this skill conflicts with README, **follow
24
24
 
25
25
  ## Phase 2: Detect Router Mode
26
26
 
27
- | Mode | Detection Signal | Key Indicator |
28
- | -------------- | ------------------------------- | --------------------------- |
29
- | v7 Framework | `react-router.config.ts` exists | Routes in `app/routes/` |
30
- | v7 Data | `createBrowserRouter` in source | Loaders in route config |
31
- | v7 Declarative | `<BrowserRouter>` component | Routes as JSX, no loaders |
32
- | v6 | package.json version `"6.x"` | Similar to v7 Declarative |
27
+ | Mode | Detection Signal | Key Indicator |
28
+ | -------------- | ------------------------------- | ------------------------- |
29
+ | v7 Framework | `react-router.config.ts` exists | Routes in `app/routes/` |
30
+ | v7 Data | `createBrowserRouter` in source | Loaders in route config |
31
+ | v7 Declarative | `<BrowserRouter>` component | Routes as JSX, no loaders |
32
+ | v6 | package.json version `"6.x"` | Similar to v7 Declarative |
33
33
 
34
34
  **Detection order:**
35
+
35
36
  1. Check for `react-router.config.ts` (Framework mode)
36
37
  2. Grep for `createBrowserRouter` (Data mode)
37
38
  3. Check package.json version (v6 vs v7)
@@ -45,10 +46,10 @@ Based on detected mode, apply the corresponding README section. The README conta
45
46
 
46
47
  ### authLoader vs authkitLoader
47
48
 
48
- | Function | Purpose | Where to use |
49
- | -------------- | -------------------------------- | ----------------------- |
50
- | `authLoader` | OAuth callback handler | Callback route ONLY |
51
- | `authkitLoader`| Fetch user data in routes | Any route needing auth |
49
+ | Function | Purpose | Where to use |
50
+ | --------------- | ------------------------- | ---------------------- |
51
+ | `authLoader` | OAuth callback handler | Callback route ONLY |
52
+ | `authkitLoader` | Fetch user data in routes | Any route needing auth |
52
53
 
53
54
  **Common mistake:** Using `authkitLoader` for callback route. Use `authLoader()`.
54
55
 
@@ -27,6 +27,7 @@ description: Integrate WorkOS AuthKit with TanStack Start applications. Full-sta
27
27
  WebFetch: `https://github.com/workos/authkit-tanstack-start/blob/main/README.md`
28
28
 
29
29
  From README, extract:
30
+
30
31
  1. Package name from install command (e.g., `pnpm add @workos/...`)
31
32
  2. Use that exact name for all imports
32
33
 
@@ -41,12 +42,12 @@ From README, extract:
41
42
 
42
43
  ## Environment Variables
43
44
 
44
- | Variable | Format | Required |
45
- |----------|--------|----------|
46
- | `WORKOS_API_KEY` | `sk_...` | Yes |
47
- | `WORKOS_CLIENT_ID` | `client_...` | Yes |
48
- | `WORKOS_REDIRECT_URI` | Full URL | Yes |
49
- | `WORKOS_COOKIE_PASSWORD` | 32+ chars | Yes |
45
+ | Variable | Format | Required |
46
+ | ------------------------ | ------------ | -------- |
47
+ | `WORKOS_API_KEY` | `sk_...` | Yes |
48
+ | `WORKOS_CLIENT_ID` | `client_...` | Yes |
49
+ | `WORKOS_REDIRECT_URI` | Full URL | Yes |
50
+ | `WORKOS_COOKIE_PASSWORD` | 32+ chars | Yes |
50
51
 
51
52
  Generate password if missing: `openssl rand -base64 32`
52
53
 
@@ -71,6 +72,7 @@ Logout requires `signOut()` followed by redirect in a route loader. See README f
71
72
  ## Callback Route
72
73
 
73
74
  Path must match `WORKOS_REDIRECT_URI`. If URI is `/api/auth/callback`:
75
+
74
76
  - File: `app/routes/api/auth/callback.tsx`
75
77
  - Use `handleAuth()` from SDK - do not write custom OAuth logic
76
78
 
@@ -29,6 +29,7 @@ Has package.json with build tool (Vite, webpack, Parcel)?
29
29
  ### Step 4: Implement Per README
30
30
 
31
31
  Follow README examples for:
32
+
32
33
  - Client initialization
33
34
  - Sign in/out handlers
34
35
  - User state management
@@ -56,20 +57,21 @@ const authkit = await createClient(clientId);
56
57
  ## Environment Variables
57
58
 
58
59
  **Bundled projects only:**
60
+
59
61
  - Vite: `VITE_WORKOS_CLIENT_ID`
60
62
  - Webpack: `REACT_APP_WORKOS_CLIENT_ID` or custom
61
63
  - No `WORKOS_API_KEY` needed (client-side SDK)
62
64
 
63
65
  ## Error Recovery
64
66
 
65
- | Error | Cause | Fix |
66
- |-------|-------|-----|
67
- | `WorkOS is not defined` | CDN not loaded | Add script to `<head>` before your code |
68
- | `createClient is not a function` | Wrong import | npm: check import path; CDN: use `WorkOS.createClient` |
69
- | `clientId is required` | Undefined env var | Check env prefix matches build tool |
70
- | CORS errors | `file://` protocol | Use local dev server (`npx serve`) |
71
- | Popup blocked | Not user gesture | Call `signIn()` only from click handler |
72
- | Auth state lost | Token not persisted | Check localStorage in dev tools |
67
+ | Error | Cause | Fix |
68
+ | -------------------------------- | ------------------- | ------------------------------------------------------ |
69
+ | `WorkOS is not defined` | CDN not loaded | Add script to `<head>` before your code |
70
+ | `createClient is not a function` | Wrong import | npm: check import path; CDN: use `WorkOS.createClient` |
71
+ | `clientId is required` | Undefined env var | Check env prefix matches build tool |
72
+ | CORS errors | `file://` protocol | Use local dev server (`npx serve`) |
73
+ | Popup blocked | Not user gesture | Call `signIn()` only from click handler |
74
+ | Auth state lost | Token not persisted | Check localStorage in dev tools |
73
75
 
74
76
  ## Task Flow
75
77
 
package/dist/package.json DELETED
@@ -1,87 +0,0 @@
1
- {
2
- "name": "workos",
3
- "version": "0.1.2",
4
- "type": "module",
5
- "description": "The Official Workos CLI",
6
- "keywords": [
7
- "workos",
8
- "authkit",
9
- "authentication",
10
- "wizard",
11
- "cli",
12
- "setup",
13
- "install",
14
- "oauth",
15
- "sso"
16
- ],
17
- "bin": {
18
- "workos": "dist/bin.js"
19
- },
20
- "publishConfig": {
21
- "access": "public"
22
- },
23
- "files": [
24
- "dist/bin.*",
25
- "dist/src",
26
- "dist/cli.config.*",
27
- ".claude-plugin",
28
- "skills",
29
- "package.json",
30
- "README.md"
31
- ],
32
- "main": "dist/index.js",
33
- "typings": "dist/index.d.ts",
34
- "typescript": {
35
- "definition": "dist/index.d.ts"
36
- },
37
- "dependencies": {
38
- "@anthropic-ai/claude-agent-sdk": "~0.2.19",
39
- "@clack/core": "^0.5.0",
40
- "@clack/prompts": "0.11.0",
41
- "chalk": "^5.6.2",
42
- "diff": "^8.0.3",
43
- "fast-glob": "^3.3.3",
44
- "ink": "^6.6.0",
45
- "opn": "^5.4.0",
46
- "react": "^19.2.3",
47
- "semver": "^7.7.3",
48
- "uuid": "^13.0.0",
49
- "xstate": "^5.25.1",
50
- "yargs": "^18.0.0",
51
- "zod": "^4.3.5"
52
- },
53
- "devDependencies": {
54
- "@statelyai/inspect": "^0.4.0",
55
- "@types/node": "~22.19.7",
56
- "@types/opn": "5.1.0",
57
- "@types/react": "^19.2.9",
58
- "@types/semver": "^7.7.1",
59
- "@types/yargs": "^17.0.35",
60
- "@vitest/ui": "^4.0.17",
61
- "dotenv": "^17.2.3",
62
- "prettier": "^3.8.0",
63
- "tsx": "^4.20.3",
64
- "typescript": "^5.9.3",
65
- "vitest": "^4.0.17"
66
- },
67
- "engines": {
68
- "node": ">=20.20"
69
- },
70
- "packageManager": "pnpm@10.23.0+sha512.21c4e5698002ade97e4efe8b8b4a89a8de3c85a37919f957e7a0f30f38fbc5bbdd05980ffe29179b2fb6e6e691242e098d945d1601772cad0fef5fb6411e2a4b",
71
- "scripts": {
72
- "clean": "rm -rf ./dist",
73
- "prebuild": "pnpm clean",
74
- "build:watch": "pnpm tsc -w",
75
- "build": "pnpm tsc",
76
- "postbuild": "chmod +x ./dist/bin.js && cp -r scripts/** dist",
77
- "lint": "prettier --check \"{lib,src,test}/**/*.ts\"",
78
- "format": "prettier --write .",
79
- "try": "tsx dev.ts",
80
- "dev": "pnpm build && pnpm link --global && pnpm build:watch",
81
- "test": "vitest run",
82
- "test:watch": "vitest",
83
- "typecheck": "tsc --noEmit"
84
- },
85
- "author": "WorkOS",
86
- "license": "MIT"
87
- }