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
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI facade — flat, gutterless CLI output + interactive prompts.
|
|
3
|
+
*
|
|
4
|
+
* The single import seam for all CLI UI: every module imports the default `ui`
|
|
5
|
+
* from this file. Output is hand-styled ANSI (diffdad-style: 2-space indent, one
|
|
6
|
+
* accent color, no vertical gutter). Input (confirm/select/text/password)
|
|
7
|
+
* delegates to `@inquirer/prompts`.
|
|
8
|
+
*
|
|
9
|
+
* The prompt adapters keep a stable call shape (`{ message, options,
|
|
10
|
+
* initialValue, validate }`) and the `isCancel(answer)` pattern, so the input
|
|
11
|
+
* engine can be swapped underneath without touching the ~30 call sites.
|
|
12
|
+
*
|
|
13
|
+
* Cancellation: @inquirer THROWS on ctrl-c / signal-abort (ExitPromptError /
|
|
14
|
+
* AbortPromptError) instead of returning a symbol. Each adapted prompt catches
|
|
15
|
+
* those and returns the `CANCEL` symbol, so `if (ui.isCancel(x))` keeps working.
|
|
16
|
+
*/
|
|
17
|
+
export declare function setDashboardMode(enabled: boolean): void;
|
|
18
|
+
export declare function isDashboardMode(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* An inverse "badge" chip (e.g. a colored INFO / WARN label). Pure string
|
|
21
|
+
* helper so callers writing to stdout OR stderr can reuse it. chalk.level === 0
|
|
22
|
+
* (JSON mode) strips the color to plain text automatically.
|
|
23
|
+
*/
|
|
24
|
+
export declare function pill(label: string, kind?: 'info' | 'warn'): string;
|
|
25
|
+
/**
|
|
26
|
+
* Branded title line, framed by blank lines. With a subtitle it renders
|
|
27
|
+
* `Title · subtitle` (accent-bold name, dim subtitle) — the dad-style header.
|
|
28
|
+
*/
|
|
29
|
+
declare function intro(title: string, subtitle?: string): void;
|
|
30
|
+
/** Closing line. */
|
|
31
|
+
declare function outro(message?: string): void;
|
|
32
|
+
/** A titled section header — anchors a "moment" that owns several lines. */
|
|
33
|
+
declare function heading(title: string): void;
|
|
34
|
+
/** Multi-line indented note (body dim, framed by blank lines). */
|
|
35
|
+
declare function note(message: string): void;
|
|
36
|
+
export type RowStatusKind = 'ok' | 'muted' | 'warn';
|
|
37
|
+
export interface Row {
|
|
38
|
+
key: string;
|
|
39
|
+
value: string;
|
|
40
|
+
/** Optional trailing status word (e.g. "created", "already set", "updated"). */
|
|
41
|
+
status?: string;
|
|
42
|
+
/** How to color the status word. Defaults to 'muted'. */
|
|
43
|
+
statusKind?: RowStatusKind;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Print a set of aligned key/value rows (leading ✓, dim key padded to the
|
|
47
|
+
* widest key in the set, accent value, optional colored status). Alignment is a
|
|
48
|
+
* property of the whole set, so callers pass every row at once.
|
|
49
|
+
*/
|
|
50
|
+
declare function rows(items: Row[]): void;
|
|
51
|
+
export interface Spinner {
|
|
52
|
+
start: (message?: string) => void;
|
|
53
|
+
message: (message: string) => void;
|
|
54
|
+
stop: (message?: string, code?: number) => void;
|
|
55
|
+
/** Halt and erase the spinner line WITHOUT printing a final status line. */
|
|
56
|
+
clear: () => void;
|
|
57
|
+
}
|
|
58
|
+
/** spinner: start(msg) / message(msg) / stop(msg, code). */
|
|
59
|
+
declare function spinner(): Spinner;
|
|
60
|
+
/**
|
|
61
|
+
* Returned by a prompt when the user cancels (ctrl-c) or a signal aborts it.
|
|
62
|
+
* Typed as a plain `symbol` (not `unique symbol`) to preserve the exact
|
|
63
|
+
* generic-inference behavior at call sites like `assertNotCancelled<T>(v: T | symbol)`.
|
|
64
|
+
*/
|
|
65
|
+
export declare const CANCEL: symbol;
|
|
66
|
+
/** Type guard that narrows a prompt result to a non-cancel value. */
|
|
67
|
+
export declare function isCancel(value: unknown): value is symbol;
|
|
68
|
+
/** Print a cancellation line. */
|
|
69
|
+
export declare function cancel(message?: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Thrown when a prompt is attempted where the user cannot answer: machine
|
|
72
|
+
* (`--json`) output, or a non-interactive stdin (piped / no TTY). Previously
|
|
73
|
+
* these either corrupted machine output or hung forever waiting on a stdin that
|
|
74
|
+
* never delivers a keystroke. Callers that reach this generally have an upstream
|
|
75
|
+
* gap (they should have gated on isPromptAllowed()/isJsonMode() and offered a
|
|
76
|
+
* flag) — surfacing it fails fast with a clear next step instead of hanging.
|
|
77
|
+
*/
|
|
78
|
+
export declare class PromptUnavailableError extends Error {
|
|
79
|
+
readonly reason: 'json' | 'no-tty';
|
|
80
|
+
constructor(reason: 'json' | 'no-tty', message: string);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Adapt the validate contract (return error string / Error when invalid,
|
|
84
|
+
* undefined when valid) to @inquirer's (return true when valid, string when not).
|
|
85
|
+
*/
|
|
86
|
+
type ValidateFn = (value: string) => string | Error | undefined | void | Promise<string | Error | undefined | void>;
|
|
87
|
+
interface ConfirmOptions {
|
|
88
|
+
message: string;
|
|
89
|
+
initialValue?: boolean;
|
|
90
|
+
signal?: AbortSignal;
|
|
91
|
+
}
|
|
92
|
+
declare function confirm(options: ConfirmOptions): Promise<boolean | symbol>;
|
|
93
|
+
interface SelectOption<T> {
|
|
94
|
+
value: T;
|
|
95
|
+
label?: string;
|
|
96
|
+
hint?: string;
|
|
97
|
+
}
|
|
98
|
+
interface SelectOptions<T> {
|
|
99
|
+
message: string;
|
|
100
|
+
options: ReadonlyArray<SelectOption<T>>;
|
|
101
|
+
initialValue?: T;
|
|
102
|
+
maxItems?: number;
|
|
103
|
+
signal?: AbortSignal;
|
|
104
|
+
}
|
|
105
|
+
declare function select<T>(options: SelectOptions<T>): Promise<T | symbol>;
|
|
106
|
+
interface TextOptions {
|
|
107
|
+
message: string;
|
|
108
|
+
placeholder?: string;
|
|
109
|
+
defaultValue?: string;
|
|
110
|
+
initialValue?: string;
|
|
111
|
+
validate?: ValidateFn;
|
|
112
|
+
signal?: AbortSignal;
|
|
113
|
+
}
|
|
114
|
+
declare function text(options: TextOptions): Promise<string | symbol>;
|
|
115
|
+
interface PasswordOptions {
|
|
116
|
+
message: string;
|
|
117
|
+
validate?: ValidateFn;
|
|
118
|
+
signal?: AbortSignal;
|
|
119
|
+
}
|
|
120
|
+
declare function password(options: PasswordOptions): Promise<string | symbol>;
|
|
121
|
+
declare const ui: {
|
|
122
|
+
intro: typeof intro;
|
|
123
|
+
outro: typeof outro;
|
|
124
|
+
heading: typeof heading;
|
|
125
|
+
note: typeof note;
|
|
126
|
+
rows: typeof rows;
|
|
127
|
+
pill: typeof pill;
|
|
128
|
+
log: {
|
|
129
|
+
info: (m: string) => void;
|
|
130
|
+
step: (m: string) => void;
|
|
131
|
+
success: (m: string) => void;
|
|
132
|
+
warn: (m: string) => void;
|
|
133
|
+
warning: (m: string) => void;
|
|
134
|
+
error: (m: string) => void;
|
|
135
|
+
/** A muted, low-priority aside (opt-out hints, "run X later"). One dim line. */
|
|
136
|
+
hint: (m: string) => void;
|
|
137
|
+
/** A nested sub-step, indented one level under its parent line. */
|
|
138
|
+
detail: (m: string) => void;
|
|
139
|
+
};
|
|
140
|
+
spinner: typeof spinner;
|
|
141
|
+
confirm: typeof confirm;
|
|
142
|
+
select: typeof select;
|
|
143
|
+
text: typeof text;
|
|
144
|
+
password: typeof password;
|
|
145
|
+
isCancel: typeof isCancel;
|
|
146
|
+
cancel: typeof cancel;
|
|
147
|
+
};
|
|
148
|
+
export default ui;
|
package/dist/utils/ui.js
ADDED
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI facade — flat, gutterless CLI output + interactive prompts.
|
|
3
|
+
*
|
|
4
|
+
* The single import seam for all CLI UI: every module imports the default `ui`
|
|
5
|
+
* from this file. Output is hand-styled ANSI (diffdad-style: 2-space indent, one
|
|
6
|
+
* accent color, no vertical gutter). Input (confirm/select/text/password)
|
|
7
|
+
* delegates to `@inquirer/prompts`.
|
|
8
|
+
*
|
|
9
|
+
* The prompt adapters keep a stable call shape (`{ message, options,
|
|
10
|
+
* initialValue, validate }`) and the `isCancel(answer)` pattern, so the input
|
|
11
|
+
* engine can be swapped underneath without touching the ~30 call sites.
|
|
12
|
+
*
|
|
13
|
+
* Cancellation: @inquirer THROWS on ctrl-c / signal-abort (ExitPromptError /
|
|
14
|
+
* AbortPromptError) instead of returning a symbol. Each adapted prompt catches
|
|
15
|
+
* those and returns the `CANCEL` symbol, so `if (ui.isCancel(x))` keeps working.
|
|
16
|
+
*/
|
|
17
|
+
import chalk from 'chalk';
|
|
18
|
+
import { isJsonMode } from './output.js';
|
|
19
|
+
import { palette } from './cli-symbols.js';
|
|
20
|
+
// @inquirer/prompts is loaded lazily (inside each prompt fn) so the barrel — all
|
|
21
|
+
// ten widgets — stays off every non-interactive path (--json, --version, --help,
|
|
22
|
+
// resource commands), which is most invocations. import() is module-cached, so
|
|
23
|
+
// only the first prompt pays.
|
|
24
|
+
// ── Dashboard mode ──────────────────────────────────────────────────────────
|
|
25
|
+
// When true, suppress all human output (the Dashboard adapter drives its own UI).
|
|
26
|
+
let dashboardMode = false;
|
|
27
|
+
export function setDashboardMode(enabled) {
|
|
28
|
+
dashboardMode = enabled;
|
|
29
|
+
}
|
|
30
|
+
export function isDashboardMode() {
|
|
31
|
+
return dashboardMode;
|
|
32
|
+
}
|
|
33
|
+
// Brand palette (shared with summary-box via cli-symbols). chalk auto-disables
|
|
34
|
+
// color when chalk.level === 0, set by setOutputMode in JSON mode.
|
|
35
|
+
const { accent, green, red, yellow, cyan } = palette;
|
|
36
|
+
const { dim, bold } = chalk;
|
|
37
|
+
/**
|
|
38
|
+
* An inverse "badge" chip (e.g. a colored INFO / WARN label). Pure string
|
|
39
|
+
* helper so callers writing to stdout OR stderr can reuse it. chalk.level === 0
|
|
40
|
+
* (JSON mode) strips the color to plain text automatically.
|
|
41
|
+
*/
|
|
42
|
+
export function pill(label, kind = 'info') {
|
|
43
|
+
const text = ` ${label} `;
|
|
44
|
+
return kind === 'warn' ? chalk.bgHex('#fbbf24').black(text) : chalk.bgHex('#6363f1').white(text);
|
|
45
|
+
}
|
|
46
|
+
const INDENT = ' ';
|
|
47
|
+
// Every stdout write routes through line()/blank(), which are the single
|
|
48
|
+
// dashboard-mode guard — so no output surface below has to re-check the flag.
|
|
49
|
+
/** Print one indented line to stdout (suppressed in dashboard mode). */
|
|
50
|
+
function line(text = '') {
|
|
51
|
+
if (dashboardMode)
|
|
52
|
+
return;
|
|
53
|
+
console.log(INDENT + text);
|
|
54
|
+
}
|
|
55
|
+
/** Print a vertical blank line (suppressed in dashboard mode). */
|
|
56
|
+
function blank() {
|
|
57
|
+
if (dashboardMode)
|
|
58
|
+
return;
|
|
59
|
+
console.log('');
|
|
60
|
+
}
|
|
61
|
+
// ── Output surface ───────────────────────────────────────────────────────────
|
|
62
|
+
/**
|
|
63
|
+
* Branded title line, framed by blank lines. With a subtitle it renders
|
|
64
|
+
* `Title · subtitle` (accent-bold name, dim subtitle) — the dad-style header.
|
|
65
|
+
*/
|
|
66
|
+
function intro(title, subtitle) {
|
|
67
|
+
blank();
|
|
68
|
+
line(subtitle ? `${accent(bold(title))} ${dim('·')} ${dim(subtitle)}` : accent(bold(title)));
|
|
69
|
+
blank();
|
|
70
|
+
}
|
|
71
|
+
/** Closing line. */
|
|
72
|
+
function outro(message = '') {
|
|
73
|
+
blank();
|
|
74
|
+
if (message)
|
|
75
|
+
line(dim(message));
|
|
76
|
+
blank();
|
|
77
|
+
}
|
|
78
|
+
/** A titled section header — anchors a "moment" that owns several lines. */
|
|
79
|
+
function heading(title) {
|
|
80
|
+
blank();
|
|
81
|
+
line(accent(bold(title)));
|
|
82
|
+
}
|
|
83
|
+
/** Multi-line indented note (body dim, framed by blank lines). */
|
|
84
|
+
function note(message) {
|
|
85
|
+
blank();
|
|
86
|
+
for (const l of String(message).split('\n'))
|
|
87
|
+
line(dim(l));
|
|
88
|
+
blank();
|
|
89
|
+
}
|
|
90
|
+
const log = {
|
|
91
|
+
info: (m) => line(m),
|
|
92
|
+
step: (m) => line(`${accent('›')} ${m}`),
|
|
93
|
+
success: (m) => line(`${green('✓')} ${m}`),
|
|
94
|
+
warn: (m) => line(`${yellow('!')} ${m}`),
|
|
95
|
+
warning: (m) => line(`${yellow('!')} ${m}`),
|
|
96
|
+
error: (m) => line(`${red('✗')} ${m}`),
|
|
97
|
+
/** A muted, low-priority aside (opt-out hints, "run X later"). One dim line. */
|
|
98
|
+
hint: (m) => line(dim(m)),
|
|
99
|
+
/** A nested sub-step, indented one level under its parent line. */
|
|
100
|
+
detail: (m) => line(` ${dim('›')} ${dim(m)}`),
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Print a set of aligned key/value rows (leading ✓, dim key padded to the
|
|
104
|
+
* widest key in the set, accent value, optional colored status). Alignment is a
|
|
105
|
+
* property of the whole set, so callers pass every row at once.
|
|
106
|
+
*/
|
|
107
|
+
function rows(items) {
|
|
108
|
+
if (dashboardMode || items.length === 0)
|
|
109
|
+
return;
|
|
110
|
+
const width = Math.max(...items.map((i) => i.key.length));
|
|
111
|
+
const paint = { ok: green, muted: dim, warn: yellow };
|
|
112
|
+
for (const it of items) {
|
|
113
|
+
const status = it.status ? ` ${paint[it.statusKind ?? 'muted'](it.status)}` : '';
|
|
114
|
+
line(`${green('✓')} ${dim(it.key.padEnd(width))} ${cyan(it.value)}${status}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
118
|
+
let activeSpinner = null;
|
|
119
|
+
/** spinner: start(msg) / message(msg) / stop(msg, code). */
|
|
120
|
+
function spinner() {
|
|
121
|
+
let timer;
|
|
122
|
+
let frame = 0;
|
|
123
|
+
let text = '';
|
|
124
|
+
const isTty = Boolean(process.stdout.isTTY) && !dashboardMode;
|
|
125
|
+
const render = () => {
|
|
126
|
+
process.stdout.write(`\r${INDENT}${dim(SPINNER_FRAMES[(frame = (frame + 1) % SPINNER_FRAMES.length)])} ${text}`);
|
|
127
|
+
};
|
|
128
|
+
const clearLine = () => {
|
|
129
|
+
if (isTty)
|
|
130
|
+
process.stdout.write('\r\x1b[2K');
|
|
131
|
+
};
|
|
132
|
+
const tick = () => {
|
|
133
|
+
if (isTty && !timer) {
|
|
134
|
+
render();
|
|
135
|
+
timer = setInterval(render, 80);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const handle = {
|
|
139
|
+
start(message = '') {
|
|
140
|
+
text = message;
|
|
141
|
+
if (dashboardMode)
|
|
142
|
+
return;
|
|
143
|
+
if (isTty) {
|
|
144
|
+
tick();
|
|
145
|
+
activeSpinner = handle;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
line(`${dim('…')} ${text}`);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
message(message) {
|
|
152
|
+
text = message;
|
|
153
|
+
},
|
|
154
|
+
stop(message, code = 0) {
|
|
155
|
+
if (timer) {
|
|
156
|
+
clearInterval(timer);
|
|
157
|
+
timer = undefined;
|
|
158
|
+
}
|
|
159
|
+
if (activeSpinner === handle)
|
|
160
|
+
activeSpinner = null;
|
|
161
|
+
if (dashboardMode)
|
|
162
|
+
return;
|
|
163
|
+
clearLine();
|
|
164
|
+
const glyph = code === 0 ? green('✓') : red('✗');
|
|
165
|
+
line(`${glyph} ${message ?? text}`);
|
|
166
|
+
},
|
|
167
|
+
// Halt + erase without printing a final line (e.g. an orphaned spinner from
|
|
168
|
+
// a failed step being cleared before a prompt), and deregister so a prompt
|
|
169
|
+
// doesn't resume it.
|
|
170
|
+
clear() {
|
|
171
|
+
if (timer) {
|
|
172
|
+
clearInterval(timer);
|
|
173
|
+
timer = undefined;
|
|
174
|
+
}
|
|
175
|
+
if (activeSpinner === handle)
|
|
176
|
+
activeSpinner = null;
|
|
177
|
+
if (dashboardMode)
|
|
178
|
+
return;
|
|
179
|
+
clearLine();
|
|
180
|
+
},
|
|
181
|
+
// Pause/resume let a prompt borrow the terminal: pause clears the spinner
|
|
182
|
+
// line and halts the redraw interval; resume restarts it. stop() is NOT
|
|
183
|
+
// called, so activeSpinner stays registered across the prompt.
|
|
184
|
+
pause() {
|
|
185
|
+
if (timer) {
|
|
186
|
+
clearInterval(timer);
|
|
187
|
+
timer = undefined;
|
|
188
|
+
}
|
|
189
|
+
clearLine();
|
|
190
|
+
},
|
|
191
|
+
resume() {
|
|
192
|
+
// Only resume if this handle is still the active spinner — never resurrect
|
|
193
|
+
// a spinner that was stopped or cleared while the prompt was open.
|
|
194
|
+
if (activeSpinner === handle && !dashboardMode)
|
|
195
|
+
tick();
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
return handle;
|
|
199
|
+
}
|
|
200
|
+
// ── Cancellation ──────────────────────────────────────────────────────────────
|
|
201
|
+
/**
|
|
202
|
+
* Returned by a prompt when the user cancels (ctrl-c) or a signal aborts it.
|
|
203
|
+
* Typed as a plain `symbol` (not `unique symbol`) to preserve the exact
|
|
204
|
+
* generic-inference behavior at call sites like `assertNotCancelled<T>(v: T | symbol)`.
|
|
205
|
+
*/
|
|
206
|
+
export const CANCEL = Symbol('workos.prompt.cancel');
|
|
207
|
+
/** Type guard that narrows a prompt result to a non-cancel value. */
|
|
208
|
+
export function isCancel(value) {
|
|
209
|
+
return value === CANCEL;
|
|
210
|
+
}
|
|
211
|
+
/** Print a cancellation line. */
|
|
212
|
+
export function cancel(message = 'Cancelled') {
|
|
213
|
+
if (dashboardMode)
|
|
214
|
+
return;
|
|
215
|
+
console.error(INDENT + dim(message));
|
|
216
|
+
}
|
|
217
|
+
const CANCEL_ERROR_NAMES = new Set(['ExitPromptError', 'AbortPromptError', 'CancelPromptError']);
|
|
218
|
+
function isCancelError(error) {
|
|
219
|
+
return error instanceof Error && CANCEL_ERROR_NAMES.has(error.name);
|
|
220
|
+
}
|
|
221
|
+
// ── Prompt coordination ───────────────────────────────────────────────────────
|
|
222
|
+
/**
|
|
223
|
+
* Thrown when a prompt is attempted where the user cannot answer: machine
|
|
224
|
+
* (`--json`) output, or a non-interactive stdin (piped / no TTY). Previously
|
|
225
|
+
* these either corrupted machine output or hung forever waiting on a stdin that
|
|
226
|
+
* never delivers a keystroke. Callers that reach this generally have an upstream
|
|
227
|
+
* gap (they should have gated on isPromptAllowed()/isJsonMode() and offered a
|
|
228
|
+
* flag) — surfacing it fails fast with a clear next step instead of hanging.
|
|
229
|
+
*/
|
|
230
|
+
export class PromptUnavailableError extends Error {
|
|
231
|
+
reason;
|
|
232
|
+
constructor(reason, message) {
|
|
233
|
+
super(message);
|
|
234
|
+
this.reason = reason;
|
|
235
|
+
this.name = 'PromptUnavailableError';
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Serializes every prompt through a single-flight chain so two @inquirer prompts
|
|
240
|
+
* can never share stdin at once. The installer's XState `preparing` state runs
|
|
241
|
+
* git-dirty and protected-branch checks in PARALLEL regions, each of which can
|
|
242
|
+
* open a prompt from a fire-and-forget event handler — without this, both prompts
|
|
243
|
+
* render on the same stdin and steal each other's keystrokes ("it asked a
|
|
244
|
+
* question but wasn't there to answer it"). It also pauses any live spinner so
|
|
245
|
+
* the 80ms redraw interval can't overwrite the question.
|
|
246
|
+
*/
|
|
247
|
+
let promptChain = Promise.resolve();
|
|
248
|
+
async function withPrompt(run) {
|
|
249
|
+
if (isJsonMode()) {
|
|
250
|
+
throw new PromptUnavailableError('json', 'Cannot prompt for input in --json mode. Re-run without --json, or pass the flag that answers it (e.g. --yes / --force).');
|
|
251
|
+
}
|
|
252
|
+
if (!process.stdin.isTTY) {
|
|
253
|
+
throw new PromptUnavailableError('no-tty', 'This step needs an interactive terminal. Re-run in a terminal, or pass the required flags to run non-interactively.');
|
|
254
|
+
}
|
|
255
|
+
const prior = promptChain.catch(() => undefined);
|
|
256
|
+
let release;
|
|
257
|
+
promptChain = new Promise((resolve) => {
|
|
258
|
+
release = resolve;
|
|
259
|
+
});
|
|
260
|
+
await prior;
|
|
261
|
+
const spinner = activeSpinner;
|
|
262
|
+
spinner?.pause();
|
|
263
|
+
try {
|
|
264
|
+
return await run();
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
spinner?.resume();
|
|
268
|
+
release();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function adaptValidate(validate) {
|
|
272
|
+
if (!validate)
|
|
273
|
+
return undefined;
|
|
274
|
+
return async (value) => {
|
|
275
|
+
const result = await validate(value);
|
|
276
|
+
if (result == null)
|
|
277
|
+
return true;
|
|
278
|
+
return result instanceof Error ? result.message : String(result);
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
async function confirm(options) {
|
|
282
|
+
return withPrompt(async () => {
|
|
283
|
+
const { confirm: inquirerConfirm } = await import('@inquirer/prompts');
|
|
284
|
+
try {
|
|
285
|
+
return await inquirerConfirm({ message: options.message, default: options.initialValue }, { signal: options.signal });
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
if (isCancelError(error))
|
|
289
|
+
return CANCEL;
|
|
290
|
+
throw error;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
async function select(options) {
|
|
295
|
+
return withPrompt(async () => {
|
|
296
|
+
const { select: inquirerSelect } = await import('@inquirer/prompts');
|
|
297
|
+
try {
|
|
298
|
+
return await inquirerSelect({
|
|
299
|
+
message: options.message,
|
|
300
|
+
choices: options.options.map((o) => ({
|
|
301
|
+
value: o.value,
|
|
302
|
+
name: o.label ?? String(o.value),
|
|
303
|
+
description: o.hint,
|
|
304
|
+
})),
|
|
305
|
+
default: options.initialValue,
|
|
306
|
+
pageSize: options.maxItems,
|
|
307
|
+
}, { signal: options.signal });
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
if (isCancelError(error))
|
|
311
|
+
return CANCEL;
|
|
312
|
+
throw error;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
async function text(options) {
|
|
317
|
+
return withPrompt(async () => {
|
|
318
|
+
// @inquirer/input has no placeholder concept, and mapping it to `default`
|
|
319
|
+
// would auto-submit the hint as the real value on an empty enter. Fold it
|
|
320
|
+
// into the message so the hint survives (rendered as ghost text previously).
|
|
321
|
+
const message = options.placeholder ? `${options.message} (${options.placeholder})` : options.message;
|
|
322
|
+
const { input: inquirerInput } = await import('@inquirer/prompts');
|
|
323
|
+
try {
|
|
324
|
+
return await inquirerInput({
|
|
325
|
+
message,
|
|
326
|
+
default: options.defaultValue ?? options.initialValue,
|
|
327
|
+
validate: adaptValidate(options.validate),
|
|
328
|
+
}, { signal: options.signal });
|
|
329
|
+
}
|
|
330
|
+
catch (error) {
|
|
331
|
+
if (isCancelError(error))
|
|
332
|
+
return CANCEL;
|
|
333
|
+
throw error;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
async function password(options) {
|
|
338
|
+
return withPrompt(async () => {
|
|
339
|
+
const { password: inquirerPassword } = await import('@inquirer/prompts');
|
|
340
|
+
try {
|
|
341
|
+
return await inquirerPassword({ message: options.message, mask: true, validate: adaptValidate(options.validate) }, { signal: options.signal });
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
if (isCancelError(error))
|
|
345
|
+
return CANCEL;
|
|
346
|
+
throw error;
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
// ── Default export (the `ui` facade) ────────────────────────────────────────
|
|
351
|
+
const ui = {
|
|
352
|
+
intro,
|
|
353
|
+
outro,
|
|
354
|
+
heading,
|
|
355
|
+
note,
|
|
356
|
+
rows,
|
|
357
|
+
pill,
|
|
358
|
+
log,
|
|
359
|
+
spinner,
|
|
360
|
+
confirm,
|
|
361
|
+
select,
|
|
362
|
+
text,
|
|
363
|
+
password,
|
|
364
|
+
isCancel,
|
|
365
|
+
cancel,
|
|
366
|
+
};
|
|
367
|
+
export default ui;
|
|
368
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/utils/ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,iFAAiF;AACjF,iFAAiF;AACjF,+EAA+E;AAC/E,8BAA8B;AAE9B,+EAA+E;AAC/E,kFAAkF;AAClF,IAAI,aAAa,GAAG,KAAK,CAAC;AAC1B,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,aAAa,GAAG,OAAO,CAAC;AAC1B,CAAC;AACD,MAAM,UAAU,eAAe;IAC7B,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,+EAA+E;AAC/E,mEAAmE;AACnE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AACrD,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAE5B;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,KAAa,EAAE,OAAwB,MAAM;IAChE,MAAM,IAAI,GAAG,IAAI,KAAK,GAAG,CAAC;IAC1B,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,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C,CAAC,CAAC;AACL,CAAC;AAOD,KAAK,UAAU,QAAQ,CAAC,OAAwB;IAC9C,OAAO,UAAU,CAAC,KAAK,IAAI,EAAE;QAC3B,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACzE,IAAI,CAAC;YACH,OAAO,MAAM,gBAAgB,CAC3B,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EACnF,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAC3B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,aAAa,CAAC,KAAK,CAAC;gBAAE,OAAO,MAAM,CAAC;YACxC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,+EAA+E;AAE/E,MAAM,EAAE,GAAG;IACT,KAAK;IACL,KAAK;IACL,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,OAAO;IACP,OAAO;IACP,MAAM;IACN,IAAI;IACJ,QAAQ;IACR,QAAQ;IACR,MAAM;CACP,CAAC;AAEF,eAAe,EAAE,CAAC","sourcesContent":["/**\n * UI facade — flat, gutterless CLI output + interactive prompts.\n *\n * The single import seam for all CLI UI: every module imports the default `ui`\n * from this file. Output is hand-styled ANSI (diffdad-style: 2-space indent, one\n * accent color, no vertical gutter). Input (confirm/select/text/password)\n * delegates to `@inquirer/prompts`.\n *\n * The prompt adapters keep a stable call shape (`{ message, options,\n * initialValue, validate }`) and the `isCancel(answer)` pattern, so the input\n * engine can be swapped underneath without touching the ~30 call sites.\n *\n * Cancellation: @inquirer THROWS on ctrl-c / signal-abort (ExitPromptError /\n * AbortPromptError) instead of returning a symbol. Each adapted prompt catches\n * those and returns the `CANCEL` symbol, so `if (ui.isCancel(x))` keeps working.\n */\n\nimport chalk from 'chalk';\nimport { isJsonMode } from './output.js';\nimport { palette } from './cli-symbols.js';\n\n// @inquirer/prompts is loaded lazily (inside each prompt fn) so the barrel — all\n// ten widgets — stays off every non-interactive path (--json, --version, --help,\n// resource commands), which is most invocations. import() is module-cached, so\n// only the first prompt pays.\n\n// ── Dashboard mode ──────────────────────────────────────────────────────────\n// When true, suppress all human output (the Dashboard adapter drives its own UI).\nlet dashboardMode = false;\nexport function setDashboardMode(enabled: boolean): void {\n dashboardMode = enabled;\n}\nexport function isDashboardMode(): boolean {\n return dashboardMode;\n}\n\n// Brand palette (shared with summary-box via cli-symbols). chalk auto-disables\n// color when chalk.level === 0, set by setOutputMode in JSON mode.\nconst { accent, green, red, yellow, cyan } = palette;\nconst { dim, bold } = chalk;\n\n/**\n * An inverse \"badge\" chip (e.g. a colored INFO / WARN label). Pure string\n * helper so callers writing to stdout OR stderr can reuse it. chalk.level === 0\n * (JSON mode) strips the color to plain text automatically.\n */\nexport function pill(label: string, kind: 'info' | 'warn' = 'info'): string {\n const text = ` ${label} `;\n return kind === 'warn' ? chalk.bgHex('#fbbf24').black(text) : chalk.bgHex('#6363f1').white(text);\n}\n\nconst INDENT = ' ';\n\n// Every stdout write routes through line()/blank(), which are the single\n// dashboard-mode guard — so no output surface below has to re-check the flag.\n/** Print one indented line to stdout (suppressed in dashboard mode). */\nfunction line(text = ''): void {\n if (dashboardMode) return;\n console.log(INDENT + text);\n}\n\n/** Print a vertical blank line (suppressed in dashboard mode). */\nfunction blank(): void {\n if (dashboardMode) return;\n console.log('');\n}\n\n// ── Output surface ───────────────────────────────────────────────────────────\n\n/**\n * Branded title line, framed by blank lines. With a subtitle it renders\n * `Title · subtitle` (accent-bold name, dim subtitle) — the dad-style header.\n */\nfunction intro(title: string, subtitle?: string): void {\n blank();\n line(subtitle ? `${accent(bold(title))} ${dim('·')} ${dim(subtitle)}` : accent(bold(title)));\n blank();\n}\n\n/** Closing line. */\nfunction outro(message = ''): void {\n blank();\n if (message) line(dim(message));\n blank();\n}\n\n/** A titled section header — anchors a \"moment\" that owns several lines. */\nfunction heading(title: string): void {\n blank();\n line(accent(bold(title)));\n}\n\n/** Multi-line indented note (body dim, framed by blank lines). */\nfunction note(message: string): void {\n blank();\n for (const l of String(message).split('\\n')) line(dim(l));\n blank();\n}\n\nconst log = {\n info: (m: string) => line(m),\n step: (m: string) => line(`${accent('›')} ${m}`),\n success: (m: string) => line(`${green('✓')} ${m}`),\n warn: (m: string) => line(`${yellow('!')} ${m}`),\n warning: (m: string) => line(`${yellow('!')} ${m}`),\n error: (m: string) => line(`${red('✗')} ${m}`),\n /** A muted, low-priority aside (opt-out hints, \"run X later\"). One dim line. */\n hint: (m: string) => line(dim(m)),\n /** A nested sub-step, indented one level under its parent line. */\n detail: (m: string) => line(` ${dim('›')} ${dim(m)}`),\n};\n\n// ── Aligned key/value rows ────────────────────────────────────────────────────\n\nexport type RowStatusKind = 'ok' | 'muted' | 'warn';\nexport interface Row {\n key: string;\n value: string;\n /** Optional trailing status word (e.g. \"created\", \"already set\", \"updated\"). */\n status?: string;\n /** How to color the status word. Defaults to 'muted'. */\n statusKind?: RowStatusKind;\n}\n\n/**\n * Print a set of aligned key/value rows (leading ✓, dim key padded to the\n * widest key in the set, accent value, optional colored status). Alignment is a\n * property of the whole set, so callers pass every row at once.\n */\nfunction rows(items: Row[]): void {\n if (dashboardMode || items.length === 0) return;\n const width = Math.max(...items.map((i) => i.key.length));\n const paint: Record<RowStatusKind, (s: string) => string> = { ok: green, muted: dim, warn: yellow };\n for (const it of items) {\n const status = it.status ? ` ${paint[it.statusKind ?? 'muted'](it.status)}` : '';\n line(`${green('✓')} ${dim(it.key.padEnd(width))} ${cyan(it.value)}${status}`);\n }\n}\n\nconst SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];\n\nexport interface Spinner {\n start: (message?: string) => void;\n message: (message: string) => void;\n stop: (message?: string, code?: number) => void;\n /** Halt and erase the spinner line WITHOUT printing a final status line. */\n clear: () => void;\n}\n\n/**\n * The currently-running spinner, if any. A prompt pauses it before opening so\n * the 80ms redraw interval can't overwrite the question (see withPrompt).\n * Internal — not part of the public Spinner surface.\n */\ninterface PausableSpinner {\n pause: () => void;\n resume: () => void;\n}\nlet activeSpinner: PausableSpinner | null = null;\n\n/** spinner: start(msg) / message(msg) / stop(msg, code). */\nfunction spinner(): Spinner {\n let timer: ReturnType<typeof setInterval> | undefined;\n let frame = 0;\n let text = '';\n const isTty = Boolean(process.stdout.isTTY) && !dashboardMode;\n const render = () => {\n process.stdout.write(`\\r${INDENT}${dim(SPINNER_FRAMES[(frame = (frame + 1) % SPINNER_FRAMES.length)])} ${text}`);\n };\n const clearLine = () => {\n if (isTty) process.stdout.write('\\r\\x1b[2K');\n };\n const tick = () => {\n if (isTty && !timer) {\n render();\n timer = setInterval(render, 80);\n }\n };\n const handle: Spinner & PausableSpinner = {\n start(message = '') {\n text = message;\n if (dashboardMode) return;\n if (isTty) {\n tick();\n activeSpinner = handle;\n } else {\n line(`${dim('…')} ${text}`);\n }\n },\n message(message: string) {\n text = message;\n },\n stop(message?: string, code = 0) {\n if (timer) {\n clearInterval(timer);\n timer = undefined;\n }\n if (activeSpinner === handle) activeSpinner = null;\n if (dashboardMode) return;\n clearLine();\n const glyph = code === 0 ? green('✓') : red('✗');\n line(`${glyph} ${message ?? text}`);\n },\n // Halt + erase without printing a final line (e.g. an orphaned spinner from\n // a failed step being cleared before a prompt), and deregister so a prompt\n // doesn't resume it.\n clear() {\n if (timer) {\n clearInterval(timer);\n timer = undefined;\n }\n if (activeSpinner === handle) activeSpinner = null;\n if (dashboardMode) return;\n clearLine();\n },\n // Pause/resume let a prompt borrow the terminal: pause clears the spinner\n // line and halts the redraw interval; resume restarts it. stop() is NOT\n // called, so activeSpinner stays registered across the prompt.\n pause() {\n if (timer) {\n clearInterval(timer);\n timer = undefined;\n }\n clearLine();\n },\n resume() {\n // Only resume if this handle is still the active spinner — never resurrect\n // a spinner that was stopped or cleared while the prompt was open.\n if (activeSpinner === handle && !dashboardMode) tick();\n },\n };\n return handle;\n}\n\n// ── Cancellation ──────────────────────────────────────────────────────────────\n\n/**\n * Returned by a prompt when the user cancels (ctrl-c) or a signal aborts it.\n * Typed as a plain `symbol` (not `unique symbol`) to preserve the exact\n * generic-inference behavior at call sites like `assertNotCancelled<T>(v: T | symbol)`.\n */\nexport const CANCEL: symbol = Symbol('workos.prompt.cancel');\n\n/** Type guard that narrows a prompt result to a non-cancel value. */\nexport function isCancel(value: unknown): value is symbol {\n return value === CANCEL;\n}\n\n/** Print a cancellation line. */\nexport function cancel(message = 'Cancelled'): void {\n if (dashboardMode) return;\n console.error(INDENT + dim(message));\n}\n\nconst CANCEL_ERROR_NAMES = new Set(['ExitPromptError', 'AbortPromptError', 'CancelPromptError']);\nfunction isCancelError(error: unknown): boolean {\n return error instanceof Error && CANCEL_ERROR_NAMES.has(error.name);\n}\n\n// ── Prompt coordination ───────────────────────────────────────────────────────\n\n/**\n * Thrown when a prompt is attempted where the user cannot answer: machine\n * (`--json`) output, or a non-interactive stdin (piped / no TTY). Previously\n * these either corrupted machine output or hung forever waiting on a stdin that\n * never delivers a keystroke. Callers that reach this generally have an upstream\n * gap (they should have gated on isPromptAllowed()/isJsonMode() and offered a\n * flag) — surfacing it fails fast with a clear next step instead of hanging.\n */\nexport class PromptUnavailableError extends Error {\n constructor(\n public readonly reason: 'json' | 'no-tty',\n message: string,\n ) {\n super(message);\n this.name = 'PromptUnavailableError';\n }\n}\n\n/**\n * Serializes every prompt through a single-flight chain so two @inquirer prompts\n * can never share stdin at once. The installer's XState `preparing` state runs\n * git-dirty and protected-branch checks in PARALLEL regions, each of which can\n * open a prompt from a fire-and-forget event handler — without this, both prompts\n * render on the same stdin and steal each other's keystrokes (\"it asked a\n * question but wasn't there to answer it\"). It also pauses any live spinner so\n * the 80ms redraw interval can't overwrite the question.\n */\nlet promptChain: Promise<unknown> = Promise.resolve();\n\nasync function withPrompt<T>(run: () => Promise<T>): Promise<T> {\n if (isJsonMode()) {\n throw new PromptUnavailableError(\n 'json',\n 'Cannot prompt for input in --json mode. Re-run without --json, or pass the flag that answers it (e.g. --yes / --force).',\n );\n }\n if (!process.stdin.isTTY) {\n throw new PromptUnavailableError(\n 'no-tty',\n 'This step needs an interactive terminal. Re-run in a terminal, or pass the required flags to run non-interactively.',\n );\n }\n const prior = promptChain.catch(() => undefined);\n let release!: () => void;\n promptChain = new Promise<void>((resolve) => {\n release = resolve;\n });\n await prior;\n const spinner = activeSpinner;\n spinner?.pause();\n try {\n return await run();\n } finally {\n spinner?.resume();\n release();\n }\n}\n\n/**\n * Adapt the validate contract (return error string / Error when invalid,\n * undefined when valid) to @inquirer's (return true when valid, string when not).\n */\ntype ValidateFn = (value: string) => string | Error | undefined | void | Promise<string | Error | undefined | void>;\nfunction adaptValidate(validate?: ValidateFn) {\n if (!validate) return undefined;\n return async (value: string): Promise<boolean | string> => {\n const result = await validate(value);\n if (result == null) return true;\n return result instanceof Error ? result.message : String(result);\n };\n}\n\n// ── Input surface (@inquirer under the hood) ─────────────────────\n\ninterface ConfirmOptions {\n message: string;\n initialValue?: boolean;\n signal?: AbortSignal;\n}\nasync function confirm(options: ConfirmOptions): Promise<boolean | symbol> {\n return withPrompt(async () => {\n const { confirm: inquirerConfirm } = await import('@inquirer/prompts');\n try {\n return await inquirerConfirm(\n { message: options.message, default: options.initialValue },\n { signal: options.signal },\n );\n } catch (error) {\n if (isCancelError(error)) return CANCEL;\n throw error;\n }\n });\n}\n\ninterface SelectOption<T> {\n value: T;\n label?: string;\n hint?: string;\n}\ninterface SelectOptions<T> {\n message: string;\n options: ReadonlyArray<SelectOption<T>>;\n initialValue?: T;\n maxItems?: number;\n signal?: AbortSignal;\n}\nasync function select<T>(options: SelectOptions<T>): Promise<T | symbol> {\n return withPrompt(async () => {\n const { select: inquirerSelect } = await import('@inquirer/prompts');\n try {\n return await inquirerSelect<T>(\n {\n message: options.message,\n choices: options.options.map((o) => ({\n value: o.value,\n name: o.label ?? String(o.value),\n description: o.hint,\n })),\n default: options.initialValue,\n pageSize: options.maxItems,\n },\n { signal: options.signal },\n );\n } catch (error) {\n if (isCancelError(error)) return CANCEL;\n throw error;\n }\n });\n}\n\ninterface TextOptions {\n message: string;\n placeholder?: string;\n defaultValue?: string;\n initialValue?: string;\n validate?: ValidateFn;\n signal?: AbortSignal;\n}\nasync function text(options: TextOptions): Promise<string | symbol> {\n return withPrompt(async () => {\n // @inquirer/input has no placeholder concept, and mapping it to `default`\n // would auto-submit the hint as the real value on an empty enter. Fold it\n // into the message so the hint survives (rendered as ghost text previously).\n const message = options.placeholder ? `${options.message} (${options.placeholder})` : options.message;\n const { input: inquirerInput } = await import('@inquirer/prompts');\n try {\n return await inquirerInput(\n {\n message,\n default: options.defaultValue ?? options.initialValue,\n validate: adaptValidate(options.validate),\n },\n { signal: options.signal },\n );\n } catch (error) {\n if (isCancelError(error)) return CANCEL;\n throw error;\n }\n });\n}\n\ninterface PasswordOptions {\n message: string;\n validate?: ValidateFn;\n signal?: AbortSignal;\n}\nasync function password(options: PasswordOptions): Promise<string | symbol> {\n return withPrompt(async () => {\n const { password: inquirerPassword } = await import('@inquirer/prompts');\n try {\n return await inquirerPassword(\n { message: options.message, mask: true, validate: adaptValidate(options.validate) },\n { signal: options.signal },\n );\n } catch (error) {\n if (isCancelError(error)) return CANCEL;\n throw error;\n }\n });\n}\n\n// ── Default export (the `ui` facade) ────────────────────────────────────────\n\nconst ui = {\n intro,\n outro,\n heading,\n note,\n rows,\n pill,\n log,\n spinner,\n confirm,\n select,\n text,\n password,\n isCancel,\n cancel,\n};\n\nexport default ui;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Official Workos CLI",
|
|
6
6
|
"repository": {
|
|
@@ -38,27 +38,21 @@
|
|
|
38
38
|
".": {
|
|
39
39
|
"import": "./dist/index.js",
|
|
40
40
|
"types": "./dist/index.d.ts"
|
|
41
|
-
},
|
|
42
|
-
"./emulate": {
|
|
43
|
-
"import": "./dist/emulate/index.js",
|
|
44
|
-
"types": "./dist/emulate/index.d.ts"
|
|
45
41
|
}
|
|
46
42
|
},
|
|
47
43
|
"dependencies": {
|
|
48
44
|
"@anthropic-ai/claude-agent-sdk": "~0.3.0",
|
|
49
45
|
"@anthropic-ai/sdk": "^0.106.0",
|
|
50
|
-
"@
|
|
51
|
-
"@clack/prompts": "1.6.0",
|
|
52
|
-
"@hono/node-server": "^1",
|
|
46
|
+
"@inquirer/prompts": "^8.5.2",
|
|
53
47
|
"@napi-rs/keyring": "^1.2.0",
|
|
54
48
|
"@workos-inc/node": "^8.7.0",
|
|
49
|
+
"@workos/emulate": "^0.1.0",
|
|
55
50
|
"@workos/migrations": "^2.4.0",
|
|
56
|
-
"@workos/openapi-spec": "^0.
|
|
51
|
+
"@workos/openapi-spec": "^0.45.0",
|
|
57
52
|
"@workos/skills": "0.6.1",
|
|
58
53
|
"chalk": "^5.6.2",
|
|
59
54
|
"diff": "^8.0.3",
|
|
60
55
|
"fast-glob": "^3.3.3",
|
|
61
|
-
"hono": "^4",
|
|
62
56
|
"ink": "^6.8.0",
|
|
63
57
|
"jsonc-parser": "^3.3.1",
|
|
64
58
|
"open": "^11.0.0",
|
|
@@ -112,8 +106,6 @@
|
|
|
112
106
|
"eval:diff": "tsx tests/evals/index.ts diff",
|
|
113
107
|
"eval:prune": "tsx tests/evals/index.ts prune",
|
|
114
108
|
"eval:logs": "tsx tests/evals/index.ts logs",
|
|
115
|
-
"eval:show": "tsx tests/evals/index.ts show"
|
|
116
|
-
"gen:routes": "tsx scripts/gen-routes.ts",
|
|
117
|
-
"check:coverage": "tsx scripts/check-coverage.ts"
|
|
109
|
+
"eval:show": "tsx tests/evals/index.ts show"
|
|
118
110
|
}
|
|
119
111
|
}
|