workos 0.10.1 → 0.11.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.
- package/README.md +22 -2
- package/dist/bin.js +114 -20
- package/dist/bin.js.map +1 -1
- package/dist/commands/claim.d.ts +11 -0
- package/dist/commands/claim.js +111 -0
- package/dist/commands/claim.js.map +1 -0
- package/dist/commands/debug.d.ts +16 -0
- package/dist/commands/debug.js +350 -0
- package/dist/commands/debug.js.map +1 -0
- package/dist/commands/env.js +11 -4
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/install-skill.d.ts +5 -0
- package/dist/commands/install-skill.js +23 -0
- package/dist/commands/install-skill.js.map +1 -1
- package/dist/commands/install.js +2 -0
- package/dist/commands/install.js.map +1 -1
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.d.ts +7 -0
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.js +12 -0
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.js.map +1 -0
- package/dist/lib/agent-interface.js +17 -3
- package/dist/lib/agent-interface.js.map +1 -1
- package/dist/lib/config-store.d.ts +26 -3
- package/dist/lib/config-store.js +82 -0
- package/dist/lib/config-store.js.map +1 -1
- package/dist/lib/credential-proxy.d.ts +10 -1
- package/dist/lib/credential-proxy.js +96 -38
- package/dist/lib/credential-proxy.js.map +1 -1
- package/dist/lib/env-writer.d.ts +1 -0
- package/dist/lib/env-writer.js.map +1 -1
- package/dist/lib/installer-core.d.ts +3 -3
- package/dist/lib/resolve-install-credentials.d.ts +11 -0
- package/dist/lib/resolve-install-credentials.js +53 -0
- package/dist/lib/resolve-install-credentials.js.map +1 -0
- package/dist/lib/run-with-core.js +5 -0
- package/dist/lib/run-with-core.js.map +1 -1
- package/dist/lib/unclaimed-env-api.d.ts +42 -0
- package/dist/lib/unclaimed-env-api.js +139 -0
- package/dist/lib/unclaimed-env-api.js.map +1 -0
- package/dist/lib/unclaimed-env-provision.d.ts +24 -0
- package/dist/lib/unclaimed-env-provision.js +77 -0
- package/dist/lib/unclaimed-env-provision.js.map +1 -0
- package/dist/lib/unclaimed-warning.d.ts +15 -0
- package/dist/lib/unclaimed-warning.js +74 -0
- package/dist/lib/unclaimed-warning.js.map +1 -0
- package/dist/utils/box.d.ts +5 -0
- package/dist/utils/box.js +14 -0
- package/dist/utils/box.js.map +1 -0
- package/dist/utils/help-json.js +14 -0
- package/dist/utils/help-json.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,10 +51,12 @@ workos [command]
|
|
|
51
51
|
Commands:
|
|
52
52
|
install Install WorkOS AuthKit into your project
|
|
53
53
|
auth Manage authentication (login, logout, status)
|
|
54
|
-
env Manage environment configurations
|
|
54
|
+
env Manage environment configurations (add, remove, switch, list, claim)
|
|
55
55
|
doctor Diagnose WorkOS integration issues
|
|
56
56
|
skills Manage WorkOS skills for coding agents (install, uninstall, list)
|
|
57
57
|
|
|
58
|
+
Skills are automatically installed to detected coding agents when you run `workos install`. Use `workos skills list` to check status.
|
|
59
|
+
|
|
58
60
|
Resource Management:
|
|
59
61
|
organization (org) Manage organizations
|
|
60
62
|
user Manage users
|
|
@@ -85,6 +87,24 @@ Workflows:
|
|
|
85
87
|
|
|
86
88
|
All management commands support `--json` for structured output (auto-enabled in non-TTY) and `--api-key` to override the active environment's key.
|
|
87
89
|
|
|
90
|
+
### Unclaimed Environments
|
|
91
|
+
|
|
92
|
+
When you run `workos install` without credentials, the CLI automatically provisions a temporary WorkOS environment — no account needed. This lets you try AuthKit immediately.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Install with zero setup — environment provisioned automatically
|
|
96
|
+
workos install
|
|
97
|
+
|
|
98
|
+
# Check your environment
|
|
99
|
+
workos env list
|
|
100
|
+
# Shows: unclaimed (unclaimed) ← active
|
|
101
|
+
|
|
102
|
+
# Claim the environment to link it to your WorkOS account
|
|
103
|
+
workos env claim
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Management commands work on unclaimed environments with a warning reminding you to claim.
|
|
107
|
+
|
|
88
108
|
### Workflows
|
|
89
109
|
|
|
90
110
|
The compound workflow commands compose multiple API calls into common operations. These are the highest-value commands for both developers and AI agents.
|
|
@@ -483,7 +503,7 @@ OAuth credentials are stored in the system keychain (with `~/.workos/credentials
|
|
|
483
503
|
## How It Works
|
|
484
504
|
|
|
485
505
|
1. **Detects** your framework and project structure
|
|
486
|
-
2. **
|
|
506
|
+
2. **Resolves credentials** — uses existing config, or auto-provisions an unclaimed environment if none found
|
|
487
507
|
3. **Auto-configures** WorkOS dashboard (redirect URI, CORS, homepage URL)
|
|
488
508
|
4. **Fetches** latest SDK documentation from workos.com
|
|
489
509
|
5. **Uses AI** (Claude) to generate integration code
|
package/dist/bin.js
CHANGED
|
@@ -45,6 +45,12 @@ async function applyInsecureStorage(insecureStorage) {
|
|
|
45
45
|
setInsecureConfigStorage(true);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
/** Show non-blocking warning if active env is unclaimed (once per session). */
|
|
49
|
+
async function maybeWarnUnclaimed() {
|
|
50
|
+
const { warnIfUnclaimed } = await import('./lib/unclaimed-warning.js');
|
|
51
|
+
await warnIfUnclaimed();
|
|
52
|
+
}
|
|
53
|
+
import { resolveInstallCredentials } from './lib/resolve-install-credentials.js';
|
|
48
54
|
/** Shared insecure-storage option for commands that access credentials */
|
|
49
55
|
const insecureStorageOption = {
|
|
50
56
|
'insecure-storage': {
|
|
@@ -53,20 +59,6 @@ const insecureStorageOption = {
|
|
|
53
59
|
type: 'boolean',
|
|
54
60
|
},
|
|
55
61
|
};
|
|
56
|
-
/**
|
|
57
|
-
* Wrap a command handler with authentication check.
|
|
58
|
-
* Ensures valid auth before executing the handler.
|
|
59
|
-
* Respects --skip-auth flag for CI/testing.
|
|
60
|
-
*/
|
|
61
|
-
function withAuth(handler) {
|
|
62
|
-
return async (argv) => {
|
|
63
|
-
const typedArgv = argv;
|
|
64
|
-
await applyInsecureStorage(typedArgv.insecureStorage);
|
|
65
|
-
if (!typedArgv.skipAuth)
|
|
66
|
-
await ensureAuthenticated();
|
|
67
|
-
await handler(argv);
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
62
|
const installerOptions = {
|
|
71
63
|
direct: {
|
|
72
64
|
alias: 'D',
|
|
@@ -173,6 +165,16 @@ yargs(rawArgs)
|
|
|
173
165
|
default: false,
|
|
174
166
|
describe: 'Output results as JSON (auto-enabled in non-TTY)',
|
|
175
167
|
global: true,
|
|
168
|
+
})
|
|
169
|
+
.middleware(async (argv) => {
|
|
170
|
+
// Warn about unclaimed environments before management commands.
|
|
171
|
+
// Excluded: auth/claim/install/dashboard handle their own credential flows;
|
|
172
|
+
// skills/doctor/env/debug are utility commands where the warning is unnecessary.
|
|
173
|
+
const command = String(argv._?.[0] ?? '');
|
|
174
|
+
if (['auth', 'skills', 'doctor', 'env', 'claim', 'install', 'debug', 'dashboard', ''].includes(command))
|
|
175
|
+
return;
|
|
176
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
177
|
+
await maybeWarnUnclaimed();
|
|
176
178
|
})
|
|
177
179
|
.command('auth', 'Manage authentication (login, logout, status)', (yargs) => {
|
|
178
180
|
yargs.options(insecureStorageOption);
|
|
@@ -319,6 +321,11 @@ yargs(rawArgs)
|
|
|
319
321
|
const { runEnvList } = await import('./commands/env.js');
|
|
320
322
|
await runEnvList();
|
|
321
323
|
});
|
|
324
|
+
registerSubcommand(yargs, 'claim', 'Claim an unclaimed environment (link it to your account)', (y) => y, async (argv) => {
|
|
325
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
326
|
+
const { runClaim } = await import('./commands/claim.js');
|
|
327
|
+
await runClaim();
|
|
328
|
+
});
|
|
322
329
|
return yargs.demandCommand(1, 'Please specify an env subcommand').strict();
|
|
323
330
|
})
|
|
324
331
|
.command(['organization', 'org'], 'Manage WorkOS organizations (create, update, get, list, delete)', (yargs) => {
|
|
@@ -1194,15 +1201,103 @@ yargs(rawArgs)
|
|
|
1194
1201
|
const { runDebugSync } = await import('./commands/debug-sync.js');
|
|
1195
1202
|
await runDebugSync(argv.directoryId, resolveApiKey({ apiKey: argv.apiKey }), resolveApiBaseUrl());
|
|
1196
1203
|
})
|
|
1197
|
-
|
|
1204
|
+
// Alias — canonical command is `workos env claim`
|
|
1205
|
+
.command('claim', 'Claim an unclaimed WorkOS environment (link it to your account)', (yargs) => yargs.options({
|
|
1206
|
+
...insecureStorageOption,
|
|
1207
|
+
}), async (argv) => {
|
|
1208
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
1209
|
+
const { runClaim } = await import('./commands/claim.js');
|
|
1210
|
+
await runClaim();
|
|
1211
|
+
})
|
|
1212
|
+
.command('install', 'Install WorkOS AuthKit into your project (interactive framework detection and setup)', (yargs) => yargs.options(installerOptions), async (argv) => {
|
|
1213
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
1214
|
+
await resolveInstallCredentials(argv.apiKey, argv.installDir, argv.skipAuth, ensureAuthenticated);
|
|
1198
1215
|
const { handleInstall } = await import('./commands/install.js');
|
|
1199
1216
|
await handleInstall(argv);
|
|
1200
|
-
})
|
|
1217
|
+
})
|
|
1218
|
+
.command('debug', false, (yargs) => {
|
|
1219
|
+
yargs.options(insecureStorageOption);
|
|
1220
|
+
registerSubcommand(yargs, 'state', 'Dump raw CLI state (credentials, config, storage)', (y) => y.option('show-secrets', {
|
|
1221
|
+
type: 'boolean',
|
|
1222
|
+
default: false,
|
|
1223
|
+
describe: 'Show unredacted tokens and API keys',
|
|
1224
|
+
}), async (argv) => {
|
|
1225
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
1226
|
+
const { runDebugState } = await import('./commands/debug.js');
|
|
1227
|
+
await runDebugState({ showSecrets: argv.showSecrets });
|
|
1228
|
+
});
|
|
1229
|
+
registerSubcommand(yargs, 'reset', 'Clear auth state (keyring + files)', (y) => y
|
|
1230
|
+
.option('force', {
|
|
1231
|
+
type: 'boolean',
|
|
1232
|
+
default: false,
|
|
1233
|
+
describe: 'Skip confirmation prompt',
|
|
1234
|
+
})
|
|
1235
|
+
.option('credentials-only', {
|
|
1236
|
+
type: 'boolean',
|
|
1237
|
+
default: false,
|
|
1238
|
+
describe: 'Only clear credentials',
|
|
1239
|
+
})
|
|
1240
|
+
.option('config-only', {
|
|
1241
|
+
type: 'boolean',
|
|
1242
|
+
default: false,
|
|
1243
|
+
describe: 'Only clear config',
|
|
1244
|
+
}), async (argv) => {
|
|
1245
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
1246
|
+
const { runDebugReset } = await import('./commands/debug.js');
|
|
1247
|
+
await runDebugReset({
|
|
1248
|
+
force: argv.force,
|
|
1249
|
+
credentialsOnly: argv.credentialsOnly,
|
|
1250
|
+
configOnly: argv.configOnly,
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
registerSubcommand(yargs, 'simulate', 'Simulate CLI states for testing', (y) => y
|
|
1254
|
+
.option('expired-token', {
|
|
1255
|
+
type: 'boolean',
|
|
1256
|
+
default: false,
|
|
1257
|
+
describe: 'Set token expiresAt to the past',
|
|
1258
|
+
})
|
|
1259
|
+
.option('no-keyring', {
|
|
1260
|
+
type: 'boolean',
|
|
1261
|
+
default: false,
|
|
1262
|
+
describe: 'Force file-only storage mode',
|
|
1263
|
+
})
|
|
1264
|
+
.option('unclaimed', {
|
|
1265
|
+
type: 'boolean',
|
|
1266
|
+
default: false,
|
|
1267
|
+
describe: 'Write synthetic unclaimed environment',
|
|
1268
|
+
})
|
|
1269
|
+
.option('no-auth', {
|
|
1270
|
+
type: 'boolean',
|
|
1271
|
+
default: false,
|
|
1272
|
+
describe: 'Clear credentials, keep config',
|
|
1273
|
+
}), async (argv) => {
|
|
1274
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
1275
|
+
const { runDebugSimulate } = await import('./commands/debug.js');
|
|
1276
|
+
await runDebugSimulate({
|
|
1277
|
+
expiredToken: argv.expiredToken,
|
|
1278
|
+
noKeyring: argv.noKeyring,
|
|
1279
|
+
unclaimed: argv.unclaimed,
|
|
1280
|
+
noAuth: argv.noAuth,
|
|
1281
|
+
});
|
|
1282
|
+
});
|
|
1283
|
+
registerSubcommand(yargs, 'env', 'Show WORKOS_* environment variables and their effects', (y) => y, async () => {
|
|
1284
|
+
const { runDebugEnv } = await import('./commands/debug.js');
|
|
1285
|
+
await runDebugEnv();
|
|
1286
|
+
});
|
|
1287
|
+
registerSubcommand(yargs, 'token', 'Decode and inspect the current access token', (y) => y, async (argv) => {
|
|
1288
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
1289
|
+
const { runDebugToken } = await import('./commands/debug.js');
|
|
1290
|
+
await runDebugToken();
|
|
1291
|
+
});
|
|
1292
|
+
return yargs.demandCommand(1, 'Run "workos debug <command>" for debug tools.').strict();
|
|
1293
|
+
})
|
|
1201
1294
|
.command('dashboard', false, // hidden from help
|
|
1202
|
-
(yargs) => yargs.options(installerOptions),
|
|
1295
|
+
(yargs) => yargs.options(installerOptions), async (argv) => {
|
|
1296
|
+
await applyInsecureStorage(argv.insecureStorage);
|
|
1297
|
+
await resolveInstallCredentials(argv.apiKey, argv.installDir, argv.skipAuth, ensureAuthenticated);
|
|
1203
1298
|
const { handleInstall } = await import('./commands/install.js');
|
|
1204
1299
|
await handleInstall({ ...argv, dashboard: true });
|
|
1205
|
-
})
|
|
1300
|
+
})
|
|
1206
1301
|
.command(['$0'], 'WorkOS AuthKit CLI', (yargs) => yargs.options(insecureStorageOption), async (argv) => {
|
|
1207
1302
|
// Non-TTY: show help
|
|
1208
1303
|
if (isNonInteractiveEnvironment()) {
|
|
@@ -1216,9 +1311,8 @@ yargs(rawArgs)
|
|
|
1216
1311
|
if (clack.isCancel(shouldInstall) || !shouldInstall) {
|
|
1217
1312
|
process.exit(0);
|
|
1218
1313
|
}
|
|
1219
|
-
// Auth check happens HERE, after user confirms
|
|
1220
1314
|
await applyInsecureStorage(argv.insecureStorage);
|
|
1221
|
-
await ensureAuthenticated
|
|
1315
|
+
await resolveInstallCredentials(undefined, undefined, false, ensureAuthenticated);
|
|
1222
1316
|
const { handleInstall } = await import('./commands/install.js');
|
|
1223
1317
|
await handleInstall({ ...argv, dashboard: false });
|
|
1224
1318
|
process.exit(0);
|