workos 0.19.0 → 0.20.2
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 +4 -646
- package/bin/workos.js +44 -0
- package/package.json +18 -99
- package/LICENSE +0 -47
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +0 -1790
- package/dist/bin.js.map +0 -1
- package/dist/cli.config.d.ts +0 -88
- package/dist/cli.config.js +0 -110
- package/dist/cli.config.js.map +0 -1
- package/dist/commands/api/catalog.d.ts +0 -23
- package/dist/commands/api/catalog.js +0 -97
- package/dist/commands/api/catalog.js.map +0 -1
- package/dist/commands/api/format.d.ts +0 -5
- package/dist/commands/api/format.js +0 -46
- package/dist/commands/api/format.js.map +0 -1
- package/dist/commands/api/index.d.ts +0 -15
- package/dist/commands/api/index.js +0 -213
- package/dist/commands/api/index.js.map +0 -1
- package/dist/commands/api/interactive.d.ts +0 -3
- package/dist/commands/api/interactive.js +0 -133
- package/dist/commands/api/interactive.js.map +0 -1
- package/dist/commands/api/request.d.ts +0 -14
- package/dist/commands/api/request.js +0 -38
- package/dist/commands/api/request.js.map +0 -1
- package/dist/commands/api-key-mgmt.d.ts +0 -16
- package/dist/commands/api-key-mgmt.js +0 -96
- package/dist/commands/api-key-mgmt.js.map +0 -1
- package/dist/commands/audit-log.d.ts +0 -26
- package/dist/commands/audit-log.js +0 -155
- package/dist/commands/audit-log.js.map +0 -1
- package/dist/commands/auth-status.d.ts +0 -1
- package/dist/commands/auth-status.js +0 -57
- package/dist/commands/auth-status.js.map +0 -1
- package/dist/commands/claim.d.ts +0 -11
- package/dist/commands/claim.js +0 -143
- package/dist/commands/claim.js.map +0 -1
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.js +0 -54
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/connection.d.ts +0 -13
- package/dist/commands/connection.js +0 -96
- package/dist/commands/connection.js.map +0 -1
- package/dist/commands/debug-sso.d.ts +0 -1
- package/dist/commands/debug-sso.js +0 -78
- package/dist/commands/debug-sso.js.map +0 -1
- package/dist/commands/debug-sync.d.ts +0 -1
- package/dist/commands/debug-sync.js +0 -102
- package/dist/commands/debug-sync.js.map +0 -1
- package/dist/commands/debug.d.ts +0 -28
- package/dist/commands/debug.js +0 -406
- package/dist/commands/debug.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -22
- package/dist/commands/dev.js +0 -145
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/directory.d.ts +0 -27
- package/dist/commands/directory.js +0 -176
- package/dist/commands/directory.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -12
- package/dist/commands/doctor.js +0 -41
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/emulate.d.ts +0 -7
- package/dist/commands/emulate.js +0 -69
- package/dist/commands/emulate.js.map +0 -1
- package/dist/commands/env.d.ts +0 -19
- package/dist/commands/env.js +0 -303
- package/dist/commands/env.js.map +0 -1
- package/dist/commands/event.d.ts +0 -9
- package/dist/commands/event.js +0 -43
- package/dist/commands/event.js.map +0 -1
- package/dist/commands/feature-flag.d.ts +0 -12
- package/dist/commands/feature-flag.js +0 -96
- package/dist/commands/feature-flag.js.map +0 -1
- package/dist/commands/install-skill.d.ts +0 -85
- package/dist/commands/install-skill.js +0 -332
- package/dist/commands/install-skill.js.map +0 -1
- package/dist/commands/install.d.ts +0 -6
- package/dist/commands/install.js +0 -51
- package/dist/commands/install.js.map +0 -1
- package/dist/commands/invitation.d.ts +0 -19
- package/dist/commands/invitation.js +0 -94
- package/dist/commands/invitation.js.map +0 -1
- package/dist/commands/list-skills.d.ts +0 -4
- package/dist/commands/list-skills.js +0 -52
- package/dist/commands/list-skills.js.map +0 -1
- package/dist/commands/login.d.ts +0 -32
- package/dist/commands/login.js +0 -239
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -1
- package/dist/commands/logout.js +0 -17
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -14
- package/dist/commands/mcp.js +0 -99
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/membership.d.ts +0 -20
- package/dist/commands/membership.js +0 -129
- package/dist/commands/membership.js.map +0 -1
- package/dist/commands/migrations.d.ts +0 -2
- package/dist/commands/migrations.js +0 -50
- package/dist/commands/migrations.js.map +0 -1
- package/dist/commands/onboard-user.d.ts +0 -7
- package/dist/commands/onboard-user.js +0 -61
- package/dist/commands/onboard-user.js.map +0 -1
- package/dist/commands/org-domain.d.ts +0 -4
- package/dist/commands/org-domain.js +0 -45
- package/dist/commands/org-domain.js.map +0 -1
- package/dist/commands/organization.d.ts +0 -14
- package/dist/commands/organization.js +0 -103
- package/dist/commands/organization.js.map +0 -1
- package/dist/commands/permission.d.ts +0 -20
- package/dist/commands/permission.js +0 -93
- package/dist/commands/permission.js.map +0 -1
- package/dist/commands/portal.d.ts +0 -7
- package/dist/commands/portal.js +0 -26
- package/dist/commands/portal.js.map +0 -1
- package/dist/commands/role.d.ts +0 -17
- package/dist/commands/role.js +0 -122
- package/dist/commands/role.js.map +0 -1
- package/dist/commands/seed.d.ts +0 -6
- package/dist/commands/seed.js +0 -298
- package/dist/commands/seed.js.map +0 -1
- package/dist/commands/session.d.ts +0 -8
- package/dist/commands/session.js +0 -63
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/setup-org.d.ts +0 -6
- package/dist/commands/setup-org.js +0 -99
- package/dist/commands/setup-org.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -50
- package/dist/commands/setup.js +0 -237
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/telemetry.d.ts +0 -3
- package/dist/commands/telemetry.js +0 -88
- package/dist/commands/telemetry.js.map +0 -1
- package/dist/commands/uninstall-skill.d.ts +0 -11
- package/dist/commands/uninstall-skill.js +0 -117
- package/dist/commands/uninstall-skill.js.map +0 -1
- package/dist/commands/user.d.ts +0 -19
- package/dist/commands/user.js +0 -92
- package/dist/commands/user.js.map +0 -1
- package/dist/commands/vault-run.d.ts +0 -13
- package/dist/commands/vault-run.js +0 -195
- package/dist/commands/vault-run.js.map +0 -1
- package/dist/commands/vault.d.ts +0 -25
- package/dist/commands/vault.js +0 -153
- package/dist/commands/vault.js.map +0 -1
- package/dist/commands/verify-login.d.ts +0 -25
- package/dist/commands/verify-login.js +0 -158
- package/dist/commands/verify-login.js.map +0 -1
- package/dist/commands/webhook.d.ts +0 -3
- package/dist/commands/webhook.js +0 -92
- package/dist/commands/webhook.js.map +0 -1
- package/dist/craft-pre-release.sh +0 -10
- package/dist/dashboard/components/AnimatedLogo.d.ts +0 -8
- package/dist/dashboard/components/AnimatedLogo.js +0 -16
- package/dist/dashboard/components/AnimatedLogo.js.map +0 -1
- package/dist/dashboard/components/CompletionView.d.ts +0 -13
- package/dist/dashboard/components/CompletionView.js +0 -25
- package/dist/dashboard/components/CompletionView.js.map +0 -1
- package/dist/dashboard/components/ConfirmPrompt.d.ts +0 -9
- package/dist/dashboard/components/ConfirmPrompt.js +0 -25
- package/dist/dashboard/components/ConfirmPrompt.js.map +0 -1
- package/dist/dashboard/components/CredentialsForm.d.ts +0 -10
- package/dist/dashboard/components/CredentialsForm.js +0 -47
- package/dist/dashboard/components/CredentialsForm.js.map +0 -1
- package/dist/dashboard/components/Dashboard.d.ts +0 -3
- package/dist/dashboard/components/Dashboard.js +0 -100
- package/dist/dashboard/components/Dashboard.js.map +0 -1
- package/dist/dashboard/components/DashboardLayout.d.ts +0 -24
- package/dist/dashboard/components/DashboardLayout.js +0 -25
- package/dist/dashboard/components/DashboardLayout.js.map +0 -1
- package/dist/dashboard/components/DiffPanel.d.ts +0 -9
- package/dist/dashboard/components/DiffPanel.js +0 -136
- package/dist/dashboard/components/DiffPanel.js.map +0 -1
- package/dist/dashboard/components/InlinePrompt.d.ts +0 -8
- package/dist/dashboard/components/InlinePrompt.js +0 -19
- package/dist/dashboard/components/InlinePrompt.js.map +0 -1
- package/dist/dashboard/components/OutputPanel.d.ts +0 -10
- package/dist/dashboard/components/OutputPanel.js +0 -100
- package/dist/dashboard/components/OutputPanel.js.map +0 -1
- package/dist/dashboard/components/Panel.d.ts +0 -12
- package/dist/dashboard/components/Panel.js +0 -6
- package/dist/dashboard/components/Panel.js.map +0 -1
- package/dist/dashboard/components/TextInput.d.ts +0 -13
- package/dist/dashboard/components/TextInput.js +0 -57
- package/dist/dashboard/components/TextInput.js.map +0 -1
- package/dist/dashboard/components/WelcomeArt.d.ts +0 -2
- package/dist/dashboard/components/WelcomeArt.js +0 -9
- package/dist/dashboard/components/WelcomeArt.js.map +0 -1
- package/dist/dashboard/hooks/useAnimation.d.ts +0 -7
- package/dist/dashboard/hooks/useAnimation.js +0 -24
- package/dist/dashboard/hooks/useAnimation.js.map +0 -1
- package/dist/dashboard/hooks/useKeyboard.d.ts +0 -8
- package/dist/dashboard/hooks/useKeyboard.js +0 -18
- package/dist/dashboard/hooks/useKeyboard.js.map +0 -1
- package/dist/dashboard/hooks/useTerminalSize.d.ts +0 -8
- package/dist/dashboard/hooks/useTerminalSize.js +0 -23
- package/dist/dashboard/hooks/useTerminalSize.js.map +0 -1
- package/dist/dashboard/index.d.ts +0 -6
- package/dist/dashboard/index.js +0 -36
- package/dist/dashboard/index.js.map +0 -1
- package/dist/dashboard/lib/diff-utils.d.ts +0 -21
- package/dist/dashboard/lib/diff-utils.js +0 -271
- package/dist/dashboard/lib/diff-utils.js.map +0 -1
- package/dist/dashboard/lib/logo-frames.d.ts +0 -20
- package/dist/dashboard/lib/logo-frames.js +0 -109
- package/dist/dashboard/lib/logo-frames.js.map +0 -1
- package/dist/dashboard/lib/welcome-art.d.ts +0 -1
- package/dist/dashboard/lib/welcome-art.js +0 -5
- package/dist/dashboard/lib/welcome-art.js.map +0 -1
- package/dist/dashboard/types.d.ts +0 -5
- package/dist/dashboard/types.js +0 -2
- package/dist/dashboard/types.js.map +0 -1
- package/dist/doctor/agent-prompt.d.ts +0 -10
- package/dist/doctor/agent-prompt.js +0 -190
- package/dist/doctor/agent-prompt.js.map +0 -1
- package/dist/doctor/checks/ai-analysis.d.ts +0 -9
- package/dist/doctor/checks/ai-analysis.js +0 -124
- package/dist/doctor/checks/ai-analysis.js.map +0 -1
- package/dist/doctor/checks/auth-patterns.d.ts +0 -2
- package/dist/doctor/checks/auth-patterns.js +0 -569
- package/dist/doctor/checks/auth-patterns.js.map +0 -1
- package/dist/doctor/checks/connectivity.d.ts +0 -2
- package/dist/doctor/checks/connectivity.js +0 -35
- package/dist/doctor/checks/connectivity.js.map +0 -1
- package/dist/doctor/checks/dashboard.d.ts +0 -3
- package/dist/doctor/checks/dashboard.js +0 -123
- package/dist/doctor/checks/dashboard.js.map +0 -1
- package/dist/doctor/checks/environment.d.ts +0 -2
- package/dist/doctor/checks/environment.js +0 -86
- package/dist/doctor/checks/environment.js.map +0 -1
- package/dist/doctor/checks/framework.d.ts +0 -2
- package/dist/doctor/checks/framework.js +0 -94
- package/dist/doctor/checks/framework.js.map +0 -1
- package/dist/doctor/checks/host-execution.d.ts +0 -2
- package/dist/doctor/checks/host-execution.js +0 -21
- package/dist/doctor/checks/host-execution.js.map +0 -1
- package/dist/doctor/checks/language.d.ts +0 -6
- package/dist/doctor/checks/language.js +0 -104
- package/dist/doctor/checks/language.js.map +0 -1
- package/dist/doctor/checks/mcp.d.ts +0 -15
- package/dist/doctor/checks/mcp.js +0 -34
- package/dist/doctor/checks/mcp.js.map +0 -1
- package/dist/doctor/checks/runtime.d.ts +0 -2
- package/dist/doctor/checks/runtime.js +0 -20
- package/dist/doctor/checks/runtime.js.map +0 -1
- package/dist/doctor/checks/sdk.d.ts +0 -2
- package/dist/doctor/checks/sdk.js +0 -192
- package/dist/doctor/checks/sdk.js.map +0 -1
- package/dist/doctor/checks/skills.d.ts +0 -9
- package/dist/doctor/checks/skills.js +0 -84
- package/dist/doctor/checks/skills.js.map +0 -1
- package/dist/doctor/clipboard.d.ts +0 -1
- package/dist/doctor/clipboard.js +0 -43
- package/dist/doctor/clipboard.js.map +0 -1
- package/dist/doctor/index.d.ts +0 -26
- package/dist/doctor/index.js +0 -182
- package/dist/doctor/index.js.map +0 -1
- package/dist/doctor/issues.d.ts +0 -63
- package/dist/doctor/issues.js +0 -199
- package/dist/doctor/issues.js.map +0 -1
- package/dist/doctor/json-output.d.ts +0 -2
- package/dist/doctor/json-output.js +0 -4
- package/dist/doctor/json-output.js.map +0 -1
- package/dist/doctor/output.d.ts +0 -7
- package/dist/doctor/output.js +0 -289
- package/dist/doctor/output.js.map +0 -1
- package/dist/doctor/types.d.ts +0 -203
- package/dist/doctor/types.js +0 -2
- package/dist/doctor/types.js.map +0 -1
- package/dist/integrations/dotnet/index.d.ts +0 -8
- package/dist/integrations/dotnet/index.js +0 -170
- package/dist/integrations/dotnet/index.js.map +0 -1
- package/dist/integrations/elixir/index.d.ts +0 -8
- package/dist/integrations/elixir/index.js +0 -146
- package/dist/integrations/elixir/index.js.map +0 -1
- package/dist/integrations/go/index.d.ts +0 -11
- package/dist/integrations/go/index.js +0 -212
- package/dist/integrations/go/index.js.map +0 -1
- package/dist/integrations/kotlin/index.d.ts +0 -4
- package/dist/integrations/kotlin/index.js +0 -78
- package/dist/integrations/kotlin/index.js.map +0 -1
- package/dist/integrations/nextjs/index.d.ts +0 -4
- package/dist/integrations/nextjs/index.js +0 -93
- package/dist/integrations/nextjs/index.js.map +0 -1
- package/dist/integrations/nextjs/utils.d.ts +0 -8
- package/dist/integrations/nextjs/utils.js +0 -68
- package/dist/integrations/nextjs/utils.js.map +0 -1
- package/dist/integrations/node/index.d.ts +0 -4
- package/dist/integrations/node/index.js +0 -52
- package/dist/integrations/node/index.js.map +0 -1
- package/dist/integrations/php/index.d.ts +0 -4
- package/dist/integrations/php/index.js +0 -51
- package/dist/integrations/php/index.js.map +0 -1
- package/dist/integrations/php-laravel/index.d.ts +0 -4
- package/dist/integrations/php-laravel/index.js +0 -51
- package/dist/integrations/php-laravel/index.js.map +0 -1
- package/dist/integrations/python/index.d.ts +0 -9
- package/dist/integrations/python/index.js +0 -249
- package/dist/integrations/python/index.js.map +0 -1
- package/dist/integrations/react/index.d.ts +0 -4
- package/dist/integrations/react/index.js +0 -49
- package/dist/integrations/react/index.js.map +0 -1
- package/dist/integrations/react-router/index.d.ts +0 -4
- package/dist/integrations/react-router/index.js +0 -94
- package/dist/integrations/react-router/index.js.map +0 -1
- package/dist/integrations/react-router/utils.d.ts +0 -10
- package/dist/integrations/react-router/utils.js +0 -162
- package/dist/integrations/react-router/utils.js.map +0 -1
- package/dist/integrations/ruby/index.d.ts +0 -8
- package/dist/integrations/ruby/index.js +0 -137
- package/dist/integrations/ruby/index.js.map +0 -1
- package/dist/integrations/sveltekit/index.d.ts +0 -4
- package/dist/integrations/sveltekit/index.js +0 -50
- package/dist/integrations/sveltekit/index.js.map +0 -1
- package/dist/integrations/tanstack-start/index.d.ts +0 -4
- package/dist/integrations/tanstack-start/index.js +0 -51
- package/dist/integrations/tanstack-start/index.js.map +0 -1
- package/dist/integrations/vanilla-js/index.d.ts +0 -4
- package/dist/integrations/vanilla-js/index.js +0 -49
- package/dist/integrations/vanilla-js/index.js.map +0 -1
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.d.ts +0 -7
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.js +0 -12
- package/dist/lib/__test-helpers__/mock-unclaimed-env-api-error.js.map +0 -1
- package/dist/lib/adapters/cli-adapter.d.ts +0 -113
- package/dist/lib/adapters/cli-adapter.js +0 -641
- package/dist/lib/adapters/cli-adapter.js.map +0 -1
- package/dist/lib/adapters/dashboard-adapter.d.ts +0 -34
- package/dist/lib/adapters/dashboard-adapter.js +0 -121
- package/dist/lib/adapters/dashboard-adapter.js.map +0 -1
- package/dist/lib/adapters/headless-adapter.d.ts +0 -80
- package/dist/lib/adapters/headless-adapter.js +0 -347
- package/dist/lib/adapters/headless-adapter.js.map +0 -1
- package/dist/lib/adapters/index.d.ts +0 -4
- package/dist/lib/adapters/index.js +0 -4
- package/dist/lib/adapters/index.js.map +0 -1
- package/dist/lib/adapters/types.d.ts +0 -41
- package/dist/lib/adapters/types.js +0 -2
- package/dist/lib/adapters/types.js.map +0 -1
- package/dist/lib/agent-interface.d.ts +0 -84
- package/dist/lib/agent-interface.js +0 -840
- package/dist/lib/agent-interface.js.map +0 -1
- package/dist/lib/agent-runner.d.ts +0 -9
- package/dist/lib/agent-runner.js +0 -261
- package/dist/lib/agent-runner.js.map +0 -1
- package/dist/lib/ai-content.d.ts +0 -14
- package/dist/lib/ai-content.js +0 -131
- package/dist/lib/ai-content.js.map +0 -1
- package/dist/lib/api-error-handler.d.ts +0 -18
- package/dist/lib/api-error-handler.js +0 -76
- package/dist/lib/api-error-handler.js.map +0 -1
- package/dist/lib/api-key.d.ts +0 -14
- package/dist/lib/api-key.js +0 -37
- package/dist/lib/api-key.js.map +0 -1
- package/dist/lib/api.d.ts +0 -25
- package/dist/lib/api.js +0 -120
- package/dist/lib/api.js.map +0 -1
- package/dist/lib/background-refresh.d.ts +0 -29
- package/dist/lib/background-refresh.js +0 -95
- package/dist/lib/background-refresh.js.map +0 -1
- package/dist/lib/command-aliases.d.ts +0 -8
- package/dist/lib/command-aliases.js +0 -12
- package/dist/lib/command-aliases.js.map +0 -1
- package/dist/lib/completion-data.d.ts +0 -33
- package/dist/lib/completion-data.js +0 -33
- package/dist/lib/completion-data.js.map +0 -1
- package/dist/lib/config-store.d.ts +0 -63
- package/dist/lib/config-store.js +0 -293
- package/dist/lib/config-store.js.map +0 -1
- package/dist/lib/config.d.ts +0 -34
- package/dist/lib/config.js +0 -37
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -51
- package/dist/lib/constants.js +0 -50
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/credential-discovery.d.ts +0 -42
- package/dist/lib/credential-discovery.js +0 -100
- package/dist/lib/credential-discovery.js.map +0 -1
- package/dist/lib/credential-proxy.d.ts +0 -45
- package/dist/lib/credential-proxy.js +0 -364
- package/dist/lib/credential-proxy.js.map +0 -1
- package/dist/lib/credential-store.d.ts +0 -32
- package/dist/lib/credential-store.js +0 -236
- package/dist/lib/credential-store.js.map +0 -1
- package/dist/lib/credentials.d.ts +0 -13
- package/dist/lib/credentials.js +0 -34
- package/dist/lib/credentials.js.map +0 -1
- package/dist/lib/dev-command.d.ts +0 -26
- package/dist/lib/dev-command.js +0 -129
- package/dist/lib/dev-command.js.map +0 -1
- package/dist/lib/device-auth.d.ts +0 -48
- package/dist/lib/device-auth.js +0 -176
- package/dist/lib/device-auth.js.map +0 -1
- package/dist/lib/device-id.d.ts +0 -25
- package/dist/lib/device-id.js +0 -102
- package/dist/lib/device-id.js.map +0 -1
- package/dist/lib/ensure-auth.d.ts +0 -12
- package/dist/lib/ensure-auth.js +0 -111
- package/dist/lib/ensure-auth.js.map +0 -1
- package/dist/lib/env-writer.d.ts +0 -25
- package/dist/lib/env-writer.js +0 -90
- package/dist/lib/env-writer.js.map +0 -1
- package/dist/lib/events.d.ts +0 -248
- package/dist/lib/events.js +0 -19
- package/dist/lib/events.js.map +0 -1
- package/dist/lib/framework-config.d.ts +0 -133
- package/dist/lib/framework-config.js +0 -11
- package/dist/lib/framework-config.js.map +0 -1
- package/dist/lib/helper-functions.d.ts +0 -1
- package/dist/lib/helper-functions.js +0 -2
- package/dist/lib/helper-functions.js.map +0 -1
- package/dist/lib/host-probe.d.ts +0 -28
- package/dist/lib/host-probe.js +0 -154
- package/dist/lib/host-probe.js.map +0 -1
- package/dist/lib/installer-core.d.ts +0 -569
- package/dist/lib/installer-core.js +0 -1134
- package/dist/lib/installer-core.js.map +0 -1
- package/dist/lib/installer-core.types.d.ts +0 -162
- package/dist/lib/installer-core.types.js +0 -2
- package/dist/lib/installer-core.types.js.map +0 -1
- package/dist/lib/mcp-clients.d.ts +0 -45
- package/dist/lib/mcp-clients.js +0 -297
- package/dist/lib/mcp-clients.js.map +0 -1
- package/dist/lib/port-detection.d.ts +0 -7
- package/dist/lib/port-detection.js +0 -244
- package/dist/lib/port-detection.js.map +0 -1
- package/dist/lib/post-install.d.ts +0 -8
- package/dist/lib/post-install.js +0 -51
- package/dist/lib/post-install.js.map +0 -1
- package/dist/lib/preferences.d.ts +0 -143
- package/dist/lib/preferences.js +0 -227
- package/dist/lib/preferences.js.map +0 -1
- package/dist/lib/progress-tracker.d.ts +0 -22
- package/dist/lib/progress-tracker.js +0 -47
- package/dist/lib/progress-tracker.js.map +0 -1
- package/dist/lib/registry.d.ts +0 -42
- package/dist/lib/registry.js +0 -96
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/resolve-install-credentials.d.ts +0 -11
- package/dist/lib/resolve-install-credentials.js +0 -53
- package/dist/lib/resolve-install-credentials.js.map +0 -1
- package/dist/lib/run-with-core.d.ts +0 -7
- package/dist/lib/run-with-core.js +0 -559
- package/dist/lib/run-with-core.js.map +0 -1
- package/dist/lib/safe-tools.d.ts +0 -2
- package/dist/lib/safe-tools.js +0 -212
- package/dist/lib/safe-tools.js.map +0 -1
- package/dist/lib/scaffold/index.d.ts +0 -1
- package/dist/lib/scaffold/index.js +0 -2
- package/dist/lib/scaffold/index.js.map +0 -1
- package/dist/lib/scaffold/scaffold.d.ts +0 -66
- package/dist/lib/scaffold/scaffold.js +0 -156
- package/dist/lib/scaffold/scaffold.js.map +0 -1
- package/dist/lib/settings.d.ts +0 -60
- package/dist/lib/settings.js +0 -31
- package/dist/lib/settings.js.map +0 -1
- package/dist/lib/staging-api.d.ts +0 -22
- package/dist/lib/staging-api.js +0 -74
- package/dist/lib/staging-api.js.map +0 -1
- package/dist/lib/startup-notice-gate.d.ts +0 -21
- package/dist/lib/startup-notice-gate.js +0 -29
- package/dist/lib/startup-notice-gate.js.map +0 -1
- package/dist/lib/telemetry-notice.d.ts +0 -25
- package/dist/lib/telemetry-notice.js +0 -58
- package/dist/lib/telemetry-notice.js.map +0 -1
- package/dist/lib/token-refresh-client.d.ts +0 -23
- package/dist/lib/token-refresh-client.js +0 -89
- package/dist/lib/token-refresh-client.js.map +0 -1
- package/dist/lib/token-refresh.d.ts +0 -12
- package/dist/lib/token-refresh.js +0 -27
- package/dist/lib/token-refresh.js.map +0 -1
- package/dist/lib/unclaimed-env-api.d.ts +0 -42
- package/dist/lib/unclaimed-env-api.js +0 -139
- package/dist/lib/unclaimed-env-api.js.map +0 -1
- package/dist/lib/unclaimed-env-provision.d.ts +0 -24
- package/dist/lib/unclaimed-env-provision.js +0 -80
- package/dist/lib/unclaimed-env-provision.js.map +0 -1
- package/dist/lib/unclaimed-warning.d.ts +0 -15
- package/dist/lib/unclaimed-warning.js +0 -78
- package/dist/lib/unclaimed-warning.js.map +0 -1
- package/dist/lib/validation/build-validator.d.ts +0 -21
- package/dist/lib/validation/build-validator.js +0 -153
- package/dist/lib/validation/build-validator.js.map +0 -1
- package/dist/lib/validation/index.d.ts +0 -4
- package/dist/lib/validation/index.js +0 -4
- package/dist/lib/validation/index.js.map +0 -1
- package/dist/lib/validation/quick-checks.d.ts +0 -19
- package/dist/lib/validation/quick-checks.js +0 -192
- package/dist/lib/validation/quick-checks.js.map +0 -1
- package/dist/lib/validation/security-checks.d.ts +0 -35
- package/dist/lib/validation/security-checks.js +0 -106
- package/dist/lib/validation/security-checks.js.map +0 -1
- package/dist/lib/validation/types.d.ts +0 -56
- package/dist/lib/validation/types.js +0 -2
- package/dist/lib/validation/types.js.map +0 -1
- package/dist/lib/validation/validator.d.ts +0 -13
- package/dist/lib/validation/validator.js +0 -711
- package/dist/lib/validation/validator.js.map +0 -1
- package/dist/lib/version-check.d.ts +0 -6
- package/dist/lib/version-check.js +0 -46
- package/dist/lib/version-check.js.map +0 -1
- package/dist/lib/workos-api.d.ts +0 -30
- package/dist/lib/workos-api.js +0 -69
- package/dist/lib/workos-api.js.map +0 -1
- package/dist/lib/workos-client.d.ts +0 -58
- package/dist/lib/workos-client.js +0 -140
- package/dist/lib/workos-client.js.map +0 -1
- package/dist/lib/workos-management.d.ts +0 -32
- package/dist/lib/workos-management.js +0 -149
- package/dist/lib/workos-management.js.map +0 -1
- package/dist/nextjs/nextjs-installer-agent.d.ts +0 -5
- package/dist/nextjs/nextjs-installer-agent.js +0 -6
- package/dist/nextjs/nextjs-installer-agent.js.map +0 -1
- package/dist/nextjs/utils.d.ts +0 -4
- package/dist/nextjs/utils.js +0 -5
- package/dist/nextjs/utils.js.map +0 -1
- package/dist/react/react-installer-agent.d.ts +0 -4
- package/dist/react/react-installer-agent.js +0 -5
- package/dist/react/react-installer-agent.js.map +0 -1
- package/dist/react-router/react-router-installer-agent.d.ts +0 -4
- package/dist/react-router/react-router-installer-agent.js +0 -5
- package/dist/react-router/react-router-installer-agent.js.map +0 -1
- package/dist/react-router/utils.d.ts +0 -4
- package/dist/react-router/utils.js +0 -5
- package/dist/react-router/utils.js.map +0 -1
- package/dist/run.d.ts +0 -33
- package/dist/run.js +0 -58
- package/dist/run.js.map +0 -1
- package/dist/smoke-test.ts +0 -881
- package/dist/steps/add-or-update-environment-variables.d.ts +0 -10
- package/dist/steps/add-or-update-environment-variables.js +0 -155
- package/dist/steps/add-or-update-environment-variables.js.map +0 -1
- package/dist/steps/index.d.ts +0 -3
- package/dist/steps/index.js +0 -4
- package/dist/steps/index.js.map +0 -1
- package/dist/steps/run-prettier.d.ts +0 -5
- package/dist/steps/run-prettier.js +0 -50
- package/dist/steps/run-prettier.js.map +0 -1
- package/dist/steps/upload-environment-variables/EnvironmentProvider.d.ts +0 -8
- package/dist/steps/upload-environment-variables/EnvironmentProvider.js +0 -7
- package/dist/steps/upload-environment-variables/EnvironmentProvider.js.map +0 -1
- package/dist/steps/upload-environment-variables/index.d.ts +0 -6
- package/dist/steps/upload-environment-variables/index.js +0 -69
- package/dist/steps/upload-environment-variables/index.js.map +0 -1
- package/dist/steps/upload-environment-variables/providers/vercel.d.ts +0 -14
- package/dist/steps/upload-environment-variables/providers/vercel.js +0 -107
- package/dist/steps/upload-environment-variables/providers/vercel.js.map +0 -1
- package/dist/tanstack-start/tanstack-start-installer-agent.d.ts +0 -4
- package/dist/tanstack-start/tanstack-start-installer-agent.js +0 -5
- package/dist/tanstack-start/tanstack-start-installer-agent.js.map +0 -1
- package/dist/telemetry.d.ts +0 -2
- package/dist/telemetry.js +0 -29
- package/dist/telemetry.js.map +0 -1
- package/dist/test/force-insecure-storage.d.ts +0 -1
- package/dist/test/force-insecure-storage.js +0 -9
- package/dist/test/force-insecure-storage.js.map +0 -1
- package/dist/test/setup.d.ts +0 -1
- package/dist/test/setup.js +0 -38
- package/dist/test/setup.js.map +0 -1
- package/dist/utils/analytics.d.ts +0 -66
- package/dist/utils/analytics.js +0 -330
- package/dist/utils/analytics.js.map +0 -1
- package/dist/utils/bash.d.ts +0 -2
- package/dist/utils/bash.js +0 -17
- package/dist/utils/bash.js.map +0 -1
- package/dist/utils/box.d.ts +0 -9
- package/dist/utils/box.js +0 -15
- package/dist/utils/box.js.map +0 -1
- package/dist/utils/cli-exit.d.ts +0 -15
- package/dist/utils/cli-exit.js +0 -11
- package/dist/utils/cli-exit.js.map +0 -1
- package/dist/utils/cli-symbols.d.ts +0 -44
- package/dist/utils/cli-symbols.js +0 -58
- package/dist/utils/cli-symbols.js.map +0 -1
- package/dist/utils/command-invocation.d.ts +0 -10
- package/dist/utils/command-invocation.js +0 -26
- package/dist/utils/command-invocation.js.map +0 -1
- package/dist/utils/command-telemetry.d.ts +0 -17
- package/dist/utils/command-telemetry.js +0 -67
- package/dist/utils/command-telemetry.js.map +0 -1
- package/dist/utils/crash-reporter.d.ts +0 -13
- package/dist/utils/crash-reporter.js +0 -91
- package/dist/utils/crash-reporter.js.map +0 -1
- package/dist/utils/debug.d.ts +0 -9
- package/dist/utils/debug.js +0 -105
- package/dist/utils/debug.js.map +0 -1
- package/dist/utils/env-parser.d.ts +0 -5
- package/dist/utils/env-parser.js +0 -18
- package/dist/utils/env-parser.js.map +0 -1
- package/dist/utils/environment.d.ts +0 -10
- package/dist/utils/environment.js +0 -69
- package/dist/utils/environment.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -3
- package/dist/utils/errors.js +0 -7
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/exec-file.d.ts +0 -15
- package/dist/utils/exec-file.js +0 -39
- package/dist/utils/exec-file.js.map +0 -1
- package/dist/utils/exit-codes.d.ts +0 -31
- package/dist/utils/exit-codes.js +0 -69
- package/dist/utils/exit-codes.js.map +0 -1
- package/dist/utils/git-utils.d.ts +0 -23
- package/dist/utils/git-utils.js +0 -86
- package/dist/utils/git-utils.js.map +0 -1
- package/dist/utils/help-json.d.ts +0 -58
- package/dist/utils/help-json.js +0 -1577
- package/dist/utils/help-json.js.map +0 -1
- package/dist/utils/interaction-mode.d.ts +0 -25
- package/dist/utils/interaction-mode.js +0 -99
- package/dist/utils/interaction-mode.js.map +0 -1
- package/dist/utils/lock-art.d.ts +0 -4
- package/dist/utils/lock-art.js +0 -73
- package/dist/utils/lock-art.js.map +0 -1
- package/dist/utils/logging.d.ts +0 -9
- package/dist/utils/logging.js +0 -36
- package/dist/utils/logging.js.map +0 -1
- package/dist/utils/ndjson.d.ts +0 -16
- package/dist/utils/ndjson.js +0 -18
- package/dist/utils/ndjson.js.map +0 -1
- package/dist/utils/output.d.ts +0 -60
- package/dist/utils/output.js +0 -124
- package/dist/utils/output.js.map +0 -1
- package/dist/utils/package-json.d.ts +0 -26
- package/dist/utils/package-json.js +0 -32
- package/dist/utils/package-json.js.map +0 -1
- package/dist/utils/package-manager.d.ts +0 -21
- package/dist/utils/package-manager.js +0 -166
- package/dist/utils/package-manager.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -5
- package/dist/utils/paths.js +0 -18
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/platform.d.ts +0 -8
- package/dist/utils/platform.js +0 -7
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/recovery-hints.d.ts +0 -42
- package/dist/utils/recovery-hints.js +0 -92
- package/dist/utils/recovery-hints.js.map +0 -1
- package/dist/utils/redact.d.ts +0 -5
- package/dist/utils/redact.js +0 -29
- package/dist/utils/redact.js.map +0 -1
- package/dist/utils/register-subcommand.d.ts +0 -10
- package/dist/utils/register-subcommand.js +0 -33
- package/dist/utils/register-subcommand.js.map +0 -1
- package/dist/utils/semver.d.ts +0 -10
- package/dist/utils/semver.js +0 -43
- package/dist/utils/semver.js.map +0 -1
- package/dist/utils/string.d.ts +0 -1
- package/dist/utils/string.js +0 -6
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/summary-box.d.ts +0 -25
- package/dist/utils/summary-box.js +0 -211
- package/dist/utils/summary-box.js.map +0 -1
- package/dist/utils/table.d.ts +0 -5
- package/dist/utils/table.js +0 -18
- package/dist/utils/table.js.map +0 -1
- package/dist/utils/telemetry-client.d.ts +0 -43
- package/dist/utils/telemetry-client.js +0 -171
- package/dist/utils/telemetry-client.js.map +0 -1
- package/dist/utils/telemetry-store-forward.d.ts +0 -11
- package/dist/utils/telemetry-store-forward.js +0 -94
- package/dist/utils/telemetry-store-forward.js.map +0 -1
- package/dist/utils/telemetry-types.d.ts +0 -100
- package/dist/utils/telemetry-types.js +0 -6
- package/dist/utils/telemetry-types.js.map +0 -1
- package/dist/utils/types.d.ts +0 -123
- package/dist/utils/types.js +0 -2
- package/dist/utils/types.js.map +0 -1
- package/dist/utils/ui-utils.d.ts +0 -97
- package/dist/utils/ui-utils.js +0 -449
- package/dist/utils/ui-utils.js.map +0 -1
- package/dist/utils/ui.d.ts +0 -148
- package/dist/utils/ui.js +0 -368
- package/dist/utils/ui.js.map +0 -1
- package/dist/utils/urls.d.ts +0 -13
- package/dist/utils/urls.js +0 -14
- package/dist/utils/urls.js.map +0 -1
- package/dist/utils/vendor/is-unicorn-supported.d.ts +0 -1
- package/dist/utils/vendor/is-unicorn-supported.js +0 -21
- package/dist/utils/vendor/is-unicorn-supported.js.map +0 -1
- package/dist/vanilla-js/vanilla-js-installer-agent.d.ts +0 -4
- package/dist/vanilla-js/vanilla-js-installer-agent.js +0 -5
- package/dist/vanilla-js/vanilla-js-installer-agent.js.map +0 -1
package/dist/test/setup.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { vi } from 'vitest';
|
|
2
|
-
/**
|
|
3
|
-
* Global test setup — runs before every spec file.
|
|
4
|
-
*
|
|
5
|
-
* Replaces @napi-rs/keyring with an in-memory implementation so the test
|
|
6
|
-
* suite can NEVER touch the real OS keychain. clearCredentials() and
|
|
7
|
-
* saveCredentials() operate on the live `workos-cli` keychain entry even when
|
|
8
|
-
* file-fallback storage is forced, so an un-mocked spec would wipe a
|
|
9
|
-
* developer's real CLI login (this happened — that's why this exists).
|
|
10
|
-
*
|
|
11
|
-
* Specs that need richer keyring behaviour (e.g. simulating an unavailable
|
|
12
|
-
* keychain) still declare their own vi.mock('@napi-rs/keyring', ...); a
|
|
13
|
-
* per-file mock overrides this global default. The __IS_TEST_MOCK__ sentinel
|
|
14
|
-
* is asserted by src/test/keyring-isolation.spec.ts so removing this setup
|
|
15
|
-
* fails CI instead of silently re-arming the footgun.
|
|
16
|
-
*/
|
|
17
|
-
vi.mock('@napi-rs/keyring', () => {
|
|
18
|
-
const store = new Map();
|
|
19
|
-
return {
|
|
20
|
-
__IS_TEST_MOCK__: true,
|
|
21
|
-
Entry: class MockEntry {
|
|
22
|
-
key;
|
|
23
|
-
constructor(service, account) {
|
|
24
|
-
this.key = `${service}:${account}`;
|
|
25
|
-
}
|
|
26
|
-
getPassword() {
|
|
27
|
-
return store.get(this.key) ?? null;
|
|
28
|
-
}
|
|
29
|
-
setPassword(password) {
|
|
30
|
-
store.set(this.key, password);
|
|
31
|
-
}
|
|
32
|
-
deletePassword() {
|
|
33
|
-
store.delete(this.key);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=setup.js.map
|
package/dist/test/setup.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/test/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B;;;;;;;;;;;;;;GAcG;AACH,EAAE,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC/B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,OAAO;QACL,gBAAgB,EAAE,IAAI;QACtB,KAAK,EAAE,MAAM,SAAS;YACZ,GAAG,CAAS;YAEpB,YAAY,OAAe,EAAE,OAAe;gBAC1C,IAAI,CAAC,GAAG,GAAG,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;YACrC,CAAC;YAED,WAAW;gBACT,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;YACrC,CAAC;YAED,WAAW,CAAC,QAAgB;gBAC1B,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YAChC,CAAC;YAED,cAAc;gBACZ,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;SACF;KACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { vi } from 'vitest';\n\n/**\n * Global test setup — runs before every spec file.\n *\n * Replaces @napi-rs/keyring with an in-memory implementation so the test\n * suite can NEVER touch the real OS keychain. clearCredentials() and\n * saveCredentials() operate on the live `workos-cli` keychain entry even when\n * file-fallback storage is forced, so an un-mocked spec would wipe a\n * developer's real CLI login (this happened — that's why this exists).\n *\n * Specs that need richer keyring behaviour (e.g. simulating an unavailable\n * keychain) still declare their own vi.mock('@napi-rs/keyring', ...); a\n * per-file mock overrides this global default. The __IS_TEST_MOCK__ sentinel\n * is asserted by src/test/keyring-isolation.spec.ts so removing this setup\n * fails CI instead of silently re-arming the footgun.\n */\nvi.mock('@napi-rs/keyring', () => {\n const store = new Map<string, string>();\n return {\n __IS_TEST_MOCK__: true,\n Entry: class MockEntry {\n private key: string;\n\n constructor(service: string, account: string) {\n this.key = `${service}:${account}`;\n }\n\n getPassword(): string | null {\n return store.get(this.key) ?? null;\n }\n\n setPassword(password: string): void {\n store.set(this.key, password);\n }\n\n deletePassword(): void {\n store.delete(this.key);\n }\n },\n };\n});\n"]}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { AuthMode, TerminationReason } from './telemetry-types.js';
|
|
2
|
-
export declare class Analytics {
|
|
3
|
-
private tags;
|
|
4
|
-
private sessionId;
|
|
5
|
-
private sessionStartTime;
|
|
6
|
-
private distinctId?;
|
|
7
|
-
private mode?;
|
|
8
|
-
private authMode;
|
|
9
|
-
private totalInputTokens;
|
|
10
|
-
private totalOutputTokens;
|
|
11
|
-
private agentIterations;
|
|
12
|
-
constructor();
|
|
13
|
-
setDistinctId(distinctId: string): void;
|
|
14
|
-
setAccessToken(token: string): void;
|
|
15
|
-
setApiKeyAuth(apiKey: string): void;
|
|
16
|
-
setClaimTokenAuth(clientId: string, claimToken: string): void;
|
|
17
|
-
/**
|
|
18
|
-
* Set the auth mode explicitly for special cases. Normal CLI flows should use
|
|
19
|
-
* `configureAuthFromAvailableSources()` so transport and auth.mode stay aligned.
|
|
20
|
-
*/
|
|
21
|
-
setAuthMode(mode: AuthMode): void;
|
|
22
|
-
setGatewayUrl(url: string): void;
|
|
23
|
-
private isEnabled;
|
|
24
|
-
/**
|
|
25
|
-
* Configure telemetry transport and auth.mode from all available CLI auth
|
|
26
|
-
* sources. Priority: stored JWT, unclaimed-environment claim token, active
|
|
27
|
-
* environment API key, then WORKOS_API_KEY.
|
|
28
|
-
*/
|
|
29
|
-
configureAuthFromAvailableSources(): AuthMode;
|
|
30
|
-
/**
|
|
31
|
-
* Initialize telemetry for non-installer commands.
|
|
32
|
-
* Sets telemetry URL from default config and loads auth credentials.
|
|
33
|
-
*/
|
|
34
|
-
initForNonInstaller(): void;
|
|
35
|
-
setTag(key: string, value: string | boolean | number | null | undefined): void;
|
|
36
|
-
capture(eventName: string, properties?: Record<string, unknown>): void;
|
|
37
|
-
captureException(error: Error, properties?: Record<string, unknown>): void;
|
|
38
|
-
getFeatureFlag(_flagKey: string): Promise<string | boolean | undefined>;
|
|
39
|
-
/** All capture methods that record error details MUST go through this. */
|
|
40
|
-
private extractErrorFields;
|
|
41
|
-
private detectCiProvider;
|
|
42
|
-
private getEnvFingerprint;
|
|
43
|
-
sessionStart(mode: 'cli' | 'tui' | 'headless', version: string): void;
|
|
44
|
-
stepCompleted(name: string, durationMs: number, success: boolean, error?: Error): void;
|
|
45
|
-
toolCalled(toolName: string, durationMs: number, success: boolean): void;
|
|
46
|
-
llmRequest(model: string, inputTokens: number, outputTokens: number): void;
|
|
47
|
-
incrementAgentIterations(): void;
|
|
48
|
-
emitCommandEvent(name: string, durationMs: number, success: boolean, options?: {
|
|
49
|
-
error?: Error;
|
|
50
|
-
flags?: string[];
|
|
51
|
-
reason?: TerminationReason;
|
|
52
|
-
errorCode?: string;
|
|
53
|
-
apiContext?: {
|
|
54
|
-
status?: number;
|
|
55
|
-
code?: string;
|
|
56
|
-
resource?: string;
|
|
57
|
-
};
|
|
58
|
-
extraAttributes?: Record<string, string | number | boolean>;
|
|
59
|
-
}): void;
|
|
60
|
-
captureUnhandledCrash(error: Error, options?: {
|
|
61
|
-
command?: string;
|
|
62
|
-
version?: string;
|
|
63
|
-
}): void;
|
|
64
|
-
shutdown(status: 'success' | 'error' | 'cancelled'): Promise<void>;
|
|
65
|
-
}
|
|
66
|
-
export declare const analytics: Analytics;
|
package/dist/utils/analytics.js
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import os from 'node:os';
|
|
2
|
-
import { basename } from 'node:path';
|
|
3
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import { debug } from './debug.js';
|
|
5
|
-
import { telemetryClient } from './telemetry-client.js';
|
|
6
|
-
import { isTelemetryEnabled } from '../lib/preferences.js';
|
|
7
|
-
import { getVersion } from '../lib/settings.js';
|
|
8
|
-
import { getTelemetryUrl } from './urls.js';
|
|
9
|
-
import { getCredentials, isTokenExpired } from '../lib/credentials.js';
|
|
10
|
-
import { getActiveEnvironment, isUnclaimedEnvironment } from '../lib/config-store.js';
|
|
11
|
-
import { getDeviceId } from '../lib/device-id.js';
|
|
12
|
-
import { sanitizeMessage, sanitizeStack } from './crash-reporter.js';
|
|
13
|
-
export class Analytics {
|
|
14
|
-
tags = {};
|
|
15
|
-
sessionId;
|
|
16
|
-
sessionStartTime;
|
|
17
|
-
distinctId;
|
|
18
|
-
mode;
|
|
19
|
-
authMode = 'none';
|
|
20
|
-
// Agent metrics tracking
|
|
21
|
-
totalInputTokens = 0;
|
|
22
|
-
totalOutputTokens = 0;
|
|
23
|
-
agentIterations = 0;
|
|
24
|
-
constructor() {
|
|
25
|
-
this.sessionId = uuidv4();
|
|
26
|
-
this.sessionStartTime = new Date();
|
|
27
|
-
this.tags = { $app_name: 'authkit-installer' };
|
|
28
|
-
}
|
|
29
|
-
setDistinctId(distinctId) {
|
|
30
|
-
this.distinctId = distinctId;
|
|
31
|
-
}
|
|
32
|
-
setAccessToken(token) {
|
|
33
|
-
telemetryClient.setAccessToken(token);
|
|
34
|
-
}
|
|
35
|
-
setApiKeyAuth(apiKey) {
|
|
36
|
-
telemetryClient.setApiKeyAuth(apiKey);
|
|
37
|
-
}
|
|
38
|
-
setClaimTokenAuth(clientId, claimToken) {
|
|
39
|
-
telemetryClient.setClaimTokenAuth(clientId, claimToken);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Set the auth mode explicitly for special cases. Normal CLI flows should use
|
|
43
|
-
* `configureAuthFromAvailableSources()` so transport and auth.mode stay aligned.
|
|
44
|
-
*/
|
|
45
|
-
setAuthMode(mode) {
|
|
46
|
-
this.authMode = mode;
|
|
47
|
-
}
|
|
48
|
-
setGatewayUrl(url) {
|
|
49
|
-
telemetryClient.setGatewayUrl(url);
|
|
50
|
-
}
|
|
51
|
-
isEnabled() {
|
|
52
|
-
return isTelemetryEnabled();
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Configure telemetry transport and auth.mode from all available CLI auth
|
|
56
|
-
* sources. Priority: stored JWT, unclaimed-environment claim token, active
|
|
57
|
-
* environment API key, then WORKOS_API_KEY.
|
|
58
|
-
*/
|
|
59
|
-
configureAuthFromAvailableSources() {
|
|
60
|
-
if (!this.isEnabled())
|
|
61
|
-
return this.authMode;
|
|
62
|
-
this.authMode = 'none';
|
|
63
|
-
const creds = getCredentials();
|
|
64
|
-
// Only treat the JWT as usable auth when it is still valid. An expired
|
|
65
|
-
// access token would 401 against the telemetry guard and the event would
|
|
66
|
-
// be dropped, so fall through to claim-token / api-key auth instead.
|
|
67
|
-
if (creds?.accessToken && !isTokenExpired(creds)) {
|
|
68
|
-
telemetryClient.setAccessToken(creds.accessToken);
|
|
69
|
-
this.authMode = 'jwt';
|
|
70
|
-
}
|
|
71
|
-
// Preserve identity even when the token is expired.
|
|
72
|
-
if (creds?.userId) {
|
|
73
|
-
this.distinctId = creds.userId;
|
|
74
|
-
}
|
|
75
|
-
// Check for unclaimed environment — fall back to claim-token auth
|
|
76
|
-
// so unclaimed users' telemetry still reaches the backend.
|
|
77
|
-
try {
|
|
78
|
-
const env = getActiveEnvironment();
|
|
79
|
-
if (env && isUnclaimedEnvironment(env)) {
|
|
80
|
-
telemetryClient.setClaimTokenAuth(env.clientId, env.claimToken);
|
|
81
|
-
// Tag distinctId so unclaimed sessions are identifiable in analytics
|
|
82
|
-
this.distinctId = this.distinctId ?? `unclaimed:${env.clientId}`;
|
|
83
|
-
if (this.authMode === 'none')
|
|
84
|
-
this.authMode = 'claim_token';
|
|
85
|
-
}
|
|
86
|
-
else if (env?.apiKey && this.authMode === 'none') {
|
|
87
|
-
telemetryClient.setApiKeyAuth(env.apiKey);
|
|
88
|
-
if (env.clientId)
|
|
89
|
-
this.distinctId = this.distinctId ?? `env:${env.clientId}`;
|
|
90
|
-
this.authMode = 'api_key';
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
// Config-store failure is non-fatal for telemetry
|
|
95
|
-
}
|
|
96
|
-
// WORKOS_API_KEY covers API-key-only users. Lowest priority — JWT and
|
|
97
|
-
// claim-token auth have richer identity context when available.
|
|
98
|
-
if (this.authMode === 'none' && process.env.WORKOS_API_KEY) {
|
|
99
|
-
telemetryClient.setApiKeyAuth(process.env.WORKOS_API_KEY);
|
|
100
|
-
this.authMode = 'api_key';
|
|
101
|
-
}
|
|
102
|
-
return this.authMode;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Initialize telemetry for non-installer commands.
|
|
106
|
-
* Sets telemetry URL from default config and loads auth credentials.
|
|
107
|
-
*/
|
|
108
|
-
initForNonInstaller() {
|
|
109
|
-
if (!this.isEnabled())
|
|
110
|
-
return;
|
|
111
|
-
telemetryClient.setGatewayUrl(getTelemetryUrl());
|
|
112
|
-
this.configureAuthFromAvailableSources();
|
|
113
|
-
}
|
|
114
|
-
setTag(key, value) {
|
|
115
|
-
this.tags[key] = value;
|
|
116
|
-
}
|
|
117
|
-
capture(eventName, properties) {
|
|
118
|
-
if (!this.isEnabled())
|
|
119
|
-
return;
|
|
120
|
-
debug(`[Analytics] capture: ${eventName}`, properties);
|
|
121
|
-
// Accumulate primitive values as tags for the session.end event
|
|
122
|
-
if (properties) {
|
|
123
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
124
|
-
if (['string', 'number', 'boolean'].includes(typeof value)) {
|
|
125
|
-
this.tags[key] = value;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
captureException(error, properties = {}) {
|
|
131
|
-
if (!this.isEnabled())
|
|
132
|
-
return;
|
|
133
|
-
// Sanitize BEFORE logging — raw error.message can carry Bearer tokens /
|
|
134
|
-
// sk_ keys / JWTs on auth-failure paths, which would surface in stdout
|
|
135
|
-
// under WORKOS_DEBUG=1.
|
|
136
|
-
const { type, message } = this.extractErrorFields(error);
|
|
137
|
-
debug('[Analytics] captureException:', message, properties);
|
|
138
|
-
this.tags['error.type'] = type;
|
|
139
|
-
this.tags['error.message'] = message;
|
|
140
|
-
}
|
|
141
|
-
async getFeatureFlag(_flagKey) {
|
|
142
|
-
// Feature flags not implemented yet
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
/** All capture methods that record error details MUST go through this. */
|
|
146
|
-
extractErrorFields(error) {
|
|
147
|
-
return {
|
|
148
|
-
type: error.name,
|
|
149
|
-
message: sanitizeMessage(error.message),
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
detectCiProvider() {
|
|
153
|
-
if (process.env.GITHUB_ACTIONS)
|
|
154
|
-
return 'github-actions';
|
|
155
|
-
if (process.env.BUILDKITE)
|
|
156
|
-
return 'buildkite';
|
|
157
|
-
if (process.env.CIRCLECI)
|
|
158
|
-
return 'circleci';
|
|
159
|
-
if (process.env.GITLAB_CI)
|
|
160
|
-
return 'gitlab-ci';
|
|
161
|
-
if (process.env.JENKINS_URL)
|
|
162
|
-
return 'jenkins';
|
|
163
|
-
return undefined;
|
|
164
|
-
}
|
|
165
|
-
getEnvFingerprint() {
|
|
166
|
-
let osVersion;
|
|
167
|
-
try {
|
|
168
|
-
osVersion = os.release();
|
|
169
|
-
}
|
|
170
|
-
catch {
|
|
171
|
-
osVersion = 'unknown';
|
|
172
|
-
}
|
|
173
|
-
const ciProvider = this.detectCiProvider();
|
|
174
|
-
return {
|
|
175
|
-
'device.id': getDeviceId(),
|
|
176
|
-
'auth.mode': this.authMode,
|
|
177
|
-
'env.os': process.platform,
|
|
178
|
-
'env.os_version': osVersion,
|
|
179
|
-
'env.node_version': process.version,
|
|
180
|
-
'env.shell': basename(process.env.SHELL ?? process.env.COMSPEC ?? 'unknown'),
|
|
181
|
-
'env.ci': Boolean(process.env.CI || process.env.GITHUB_ACTIONS || process.env.BUILDKITE),
|
|
182
|
-
...(ciProvider ? { 'env.ci_provider': ciProvider } : {}),
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
sessionStart(mode, version) {
|
|
186
|
-
if (!this.isEnabled())
|
|
187
|
-
return;
|
|
188
|
-
this.mode = mode;
|
|
189
|
-
const event = {
|
|
190
|
-
type: 'session.start',
|
|
191
|
-
sessionId: this.sessionId,
|
|
192
|
-
timestamp: this.sessionStartTime.toISOString(),
|
|
193
|
-
attributes: {
|
|
194
|
-
'installer.version': version,
|
|
195
|
-
'installer.mode': mode,
|
|
196
|
-
'workos.user_id': this.distinctId,
|
|
197
|
-
...this.getEnvFingerprint(),
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
telemetryClient.queueEvent(event);
|
|
201
|
-
}
|
|
202
|
-
stepCompleted(name, durationMs, success, error) {
|
|
203
|
-
if (!this.isEnabled())
|
|
204
|
-
return;
|
|
205
|
-
const event = {
|
|
206
|
-
type: 'step',
|
|
207
|
-
sessionId: this.sessionId,
|
|
208
|
-
timestamp: new Date().toISOString(),
|
|
209
|
-
name,
|
|
210
|
-
startTimestamp: new Date(Date.now() - durationMs).toISOString(),
|
|
211
|
-
durationMs,
|
|
212
|
-
success,
|
|
213
|
-
error: error ? this.extractErrorFields(error) : undefined,
|
|
214
|
-
};
|
|
215
|
-
telemetryClient.queueEvent(event);
|
|
216
|
-
}
|
|
217
|
-
toolCalled(toolName, durationMs, success) {
|
|
218
|
-
if (!this.isEnabled())
|
|
219
|
-
return;
|
|
220
|
-
const event = {
|
|
221
|
-
type: 'agent.tool',
|
|
222
|
-
sessionId: this.sessionId,
|
|
223
|
-
timestamp: new Date().toISOString(),
|
|
224
|
-
toolName,
|
|
225
|
-
startTimestamp: new Date(Date.now() - durationMs).toISOString(),
|
|
226
|
-
durationMs,
|
|
227
|
-
success,
|
|
228
|
-
};
|
|
229
|
-
telemetryClient.queueEvent(event);
|
|
230
|
-
}
|
|
231
|
-
llmRequest(model, inputTokens, outputTokens) {
|
|
232
|
-
if (!this.isEnabled())
|
|
233
|
-
return;
|
|
234
|
-
this.totalInputTokens += inputTokens;
|
|
235
|
-
this.totalOutputTokens += outputTokens;
|
|
236
|
-
const event = {
|
|
237
|
-
type: 'agent.llm',
|
|
238
|
-
sessionId: this.sessionId,
|
|
239
|
-
timestamp: new Date().toISOString(),
|
|
240
|
-
model,
|
|
241
|
-
inputTokens,
|
|
242
|
-
outputTokens,
|
|
243
|
-
};
|
|
244
|
-
telemetryClient.queueEvent(event);
|
|
245
|
-
}
|
|
246
|
-
incrementAgentIterations() {
|
|
247
|
-
this.agentIterations++;
|
|
248
|
-
}
|
|
249
|
-
emitCommandEvent(name, durationMs, success, options) {
|
|
250
|
-
if (!this.isEnabled())
|
|
251
|
-
return;
|
|
252
|
-
const errorFields = options?.error ? this.extractErrorFields(options.error) : undefined;
|
|
253
|
-
const event = {
|
|
254
|
-
type: 'command',
|
|
255
|
-
sessionId: this.sessionId,
|
|
256
|
-
timestamp: new Date().toISOString(),
|
|
257
|
-
attributes: {
|
|
258
|
-
// Extras first: standard fields below win on key collision, so callers
|
|
259
|
-
// can never override command.name, error fields, or the fingerprint.
|
|
260
|
-
...options?.extraAttributes,
|
|
261
|
-
'command.name': name,
|
|
262
|
-
'command.duration_ms': durationMs,
|
|
263
|
-
'command.success': success,
|
|
264
|
-
'cli.version': getVersion(),
|
|
265
|
-
...(this.distinctId ? { 'workos.user_id': this.distinctId } : {}),
|
|
266
|
-
...(errorFields
|
|
267
|
-
? {
|
|
268
|
-
'command.error_type': errorFields.type,
|
|
269
|
-
'command.error_message': errorFields.message,
|
|
270
|
-
}
|
|
271
|
-
: {}),
|
|
272
|
-
...(options?.flags?.length ? { 'command.flags': options.flags.join(',') } : {}),
|
|
273
|
-
...(options?.reason ? { 'termination.reason': options.reason } : {}),
|
|
274
|
-
...(options?.errorCode ? { 'error.code': options.errorCode } : {}),
|
|
275
|
-
...(options?.apiContext?.status !== undefined ? { 'api.status': options.apiContext.status } : {}),
|
|
276
|
-
...(options?.apiContext?.code ? { 'api.code': options.apiContext.code } : {}),
|
|
277
|
-
...(options?.apiContext?.resource ? { 'api.resource': options.apiContext.resource } : {}),
|
|
278
|
-
...this.getEnvFingerprint(),
|
|
279
|
-
},
|
|
280
|
-
};
|
|
281
|
-
telemetryClient.queueEvent(event);
|
|
282
|
-
}
|
|
283
|
-
captureUnhandledCrash(error, options) {
|
|
284
|
-
if (!this.isEnabled())
|
|
285
|
-
return;
|
|
286
|
-
const { type, message } = this.extractErrorFields(error);
|
|
287
|
-
const event = {
|
|
288
|
-
type: 'crash',
|
|
289
|
-
sessionId: this.sessionId,
|
|
290
|
-
timestamp: new Date().toISOString(),
|
|
291
|
-
attributes: {
|
|
292
|
-
'crash.error_type': type,
|
|
293
|
-
'crash.error_message': message,
|
|
294
|
-
'crash.stack': sanitizeStack(error.stack),
|
|
295
|
-
...(options?.command ? { 'crash.command': options.command } : {}),
|
|
296
|
-
'cli.version': options?.version ?? getVersion(),
|
|
297
|
-
...(this.distinctId ? { 'workos.user_id': this.distinctId } : {}),
|
|
298
|
-
...this.getEnvFingerprint(),
|
|
299
|
-
},
|
|
300
|
-
};
|
|
301
|
-
telemetryClient.queueEvent(event);
|
|
302
|
-
}
|
|
303
|
-
async shutdown(status) {
|
|
304
|
-
if (!this.isEnabled())
|
|
305
|
-
return;
|
|
306
|
-
const duration = Date.now() - this.sessionStartTime.getTime();
|
|
307
|
-
// Filter out null/undefined tags
|
|
308
|
-
const extraAttributes = Object.fromEntries(Object.entries(this.tags).filter(([, v]) => v != null));
|
|
309
|
-
const envFingerprint = this.getEnvFingerprint();
|
|
310
|
-
const event = {
|
|
311
|
-
type: 'session.end',
|
|
312
|
-
sessionId: this.sessionId,
|
|
313
|
-
timestamp: new Date().toISOString(),
|
|
314
|
-
attributes: {
|
|
315
|
-
'installer.outcome': status,
|
|
316
|
-
'installer.duration_ms': duration,
|
|
317
|
-
'installer.agent.iterations': this.agentIterations,
|
|
318
|
-
'installer.agent.tokens.input': this.totalInputTokens,
|
|
319
|
-
'installer.agent.tokens.output': this.totalOutputTokens,
|
|
320
|
-
...envFingerprint,
|
|
321
|
-
...(this.mode ? { 'installer.mode': this.mode } : {}),
|
|
322
|
-
...extraAttributes,
|
|
323
|
-
},
|
|
324
|
-
};
|
|
325
|
-
telemetryClient.queueEvent(event);
|
|
326
|
-
await telemetryClient.flush();
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
export const analytics = new Analytics();
|
|
330
|
-
//# sourceMappingURL=analytics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/utils/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAaxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,OAAO,SAAS;IACZ,IAAI,GAAiE,EAAE,CAAC;IACxE,SAAS,CAAS;IAClB,gBAAgB,CAAO;IACvB,UAAU,CAAU;IACpB,IAAI,CAA8B;IAClC,QAAQ,GAAa,MAAM,CAAC;IAEpC,yBAAyB;IACjB,gBAAgB,GAAG,CAAC,CAAC;IACrB,iBAAiB,GAAG,CAAC,CAAC;IACtB,eAAe,GAAG,CAAC,CAAC;IAE5B;QACE,IAAI,CAAC,SA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,IAAI,SAAS,EAAE,CAAC","sourcesContent":["import os from 'node:os';\nimport { basename } from 'node:path';\nimport { v4 as uuidv4 } from 'uuid';\nimport { debug } from './debug.js';\nimport { telemetryClient } from './telemetry-client.js';\nimport type {\n AuthMode,\n SessionStartEvent,\n SessionEndEvent,\n StepEvent,\n AgentToolEvent,\n AgentLLMEvent,\n CommandEvent,\n CrashEvent,\n TerminationReason,\n EnvFingerprint,\n} from './telemetry-types.js';\nimport { isTelemetryEnabled } from '../lib/preferences.js';\nimport { getVersion } from '../lib/settings.js';\nimport { getTelemetryUrl } from './urls.js';\nimport { getCredentials, isTokenExpired } from '../lib/credentials.js';\nimport { getActiveEnvironment, isUnclaimedEnvironment } from '../lib/config-store.js';\nimport { getDeviceId } from '../lib/device-id.js';\nimport { sanitizeMessage, sanitizeStack } from './crash-reporter.js';\n\nexport class Analytics {\n private tags: Record<string, string | boolean | number | null | undefined> = {};\n private sessionId: string;\n private sessionStartTime: Date;\n private distinctId?: string;\n private mode?: 'cli' | 'tui' | 'headless';\n private authMode: AuthMode = 'none';\n\n // Agent metrics tracking\n private totalInputTokens = 0;\n private totalOutputTokens = 0;\n private agentIterations = 0;\n\n constructor() {\n this.sessionId = uuidv4();\n this.sessionStartTime = new Date();\n this.tags = { $app_name: 'authkit-installer' };\n }\n\n setDistinctId(distinctId: string) {\n this.distinctId = distinctId;\n }\n\n setAccessToken(token: string) {\n telemetryClient.setAccessToken(token);\n }\n\n setApiKeyAuth(apiKey: string) {\n telemetryClient.setApiKeyAuth(apiKey);\n }\n\n setClaimTokenAuth(clientId: string, claimToken: string) {\n telemetryClient.setClaimTokenAuth(clientId, claimToken);\n }\n\n /**\n * Set the auth mode explicitly for special cases. Normal CLI flows should use\n * `configureAuthFromAvailableSources()` so transport and auth.mode stay aligned.\n */\n setAuthMode(mode: AuthMode) {\n this.authMode = mode;\n }\n\n setGatewayUrl(url: string) {\n telemetryClient.setGatewayUrl(url);\n }\n\n private isEnabled(): boolean {\n return isTelemetryEnabled();\n }\n\n /**\n * Configure telemetry transport and auth.mode from all available CLI auth\n * sources. Priority: stored JWT, unclaimed-environment claim token, active\n * environment API key, then WORKOS_API_KEY.\n */\n configureAuthFromAvailableSources(): AuthMode {\n if (!this.isEnabled()) return this.authMode;\n\n this.authMode = 'none';\n const creds = getCredentials();\n // Only treat the JWT as usable auth when it is still valid. An expired\n // access token would 401 against the telemetry guard and the event would\n // be dropped, so fall through to claim-token / api-key auth instead.\n if (creds?.accessToken && !isTokenExpired(creds)) {\n telemetryClient.setAccessToken(creds.accessToken);\n this.authMode = 'jwt';\n }\n // Preserve identity even when the token is expired.\n if (creds?.userId) {\n this.distinctId = creds.userId;\n }\n\n // Check for unclaimed environment — fall back to claim-token auth\n // so unclaimed users' telemetry still reaches the backend.\n try {\n const env = getActiveEnvironment();\n if (env && isUnclaimedEnvironment(env)) {\n telemetryClient.setClaimTokenAuth(env.clientId, env.claimToken);\n // Tag distinctId so unclaimed sessions are identifiable in analytics\n this.distinctId = this.distinctId ?? `unclaimed:${env.clientId}`;\n if (this.authMode === 'none') this.authMode = 'claim_token';\n } else if (env?.apiKey && this.authMode === 'none') {\n telemetryClient.setApiKeyAuth(env.apiKey);\n if (env.clientId) this.distinctId = this.distinctId ?? `env:${env.clientId}`;\n this.authMode = 'api_key';\n }\n } catch {\n // Config-store failure is non-fatal for telemetry\n }\n\n // WORKOS_API_KEY covers API-key-only users. Lowest priority — JWT and\n // claim-token auth have richer identity context when available.\n if (this.authMode === 'none' && process.env.WORKOS_API_KEY) {\n telemetryClient.setApiKeyAuth(process.env.WORKOS_API_KEY);\n this.authMode = 'api_key';\n }\n\n return this.authMode;\n }\n\n /**\n * Initialize telemetry for non-installer commands.\n * Sets telemetry URL from default config and loads auth credentials.\n */\n initForNonInstaller(): void {\n if (!this.isEnabled()) return;\n\n telemetryClient.setGatewayUrl(getTelemetryUrl());\n this.configureAuthFromAvailableSources();\n }\n\n setTag(key: string, value: string | boolean | number | null | undefined) {\n this.tags[key] = value;\n }\n\n capture(eventName: string, properties?: Record<string, unknown>) {\n if (!this.isEnabled()) return;\n\n debug(`[Analytics] capture: ${eventName}`, properties);\n\n // Accumulate primitive values as tags for the session.end event\n if (properties) {\n for (const [key, value] of Object.entries(properties)) {\n if (['string', 'number', 'boolean'].includes(typeof value)) {\n this.tags[key] = value as string | number | boolean;\n }\n }\n }\n }\n\n captureException(error: Error, properties: Record<string, unknown> = {}) {\n if (!this.isEnabled()) return;\n\n // Sanitize BEFORE logging — raw error.message can carry Bearer tokens /\n // sk_ keys / JWTs on auth-failure paths, which would surface in stdout\n // under WORKOS_DEBUG=1.\n const { type, message } = this.extractErrorFields(error);\n debug('[Analytics] captureException:', message, properties);\n this.tags['error.type'] = type;\n this.tags['error.message'] = message;\n }\n\n async getFeatureFlag(_flagKey: string): Promise<string | boolean | undefined> {\n // Feature flags not implemented yet\n return undefined;\n }\n\n /** All capture methods that record error details MUST go through this. */\n private extractErrorFields(error: Error): { type: string; message: string } {\n return {\n type: error.name,\n message: sanitizeMessage(error.message),\n };\n }\n\n private detectCiProvider(): string | undefined {\n if (process.env.GITHUB_ACTIONS) return 'github-actions';\n if (process.env.BUILDKITE) return 'buildkite';\n if (process.env.CIRCLECI) return 'circleci';\n if (process.env.GITLAB_CI) return 'gitlab-ci';\n if (process.env.JENKINS_URL) return 'jenkins';\n return undefined;\n }\n\n private getEnvFingerprint(): EnvFingerprint {\n let osVersion: string;\n try {\n osVersion = os.release();\n } catch {\n osVersion = 'unknown';\n }\n\n const ciProvider = this.detectCiProvider();\n\n return {\n 'device.id': getDeviceId(),\n 'auth.mode': this.authMode,\n 'env.os': process.platform,\n 'env.os_version': osVersion,\n 'env.node_version': process.version,\n 'env.shell': basename(process.env.SHELL ?? process.env.COMSPEC ?? 'unknown'),\n 'env.ci': Boolean(process.env.CI || process.env.GITHUB_ACTIONS || process.env.BUILDKITE),\n ...(ciProvider ? { 'env.ci_provider': ciProvider } : {}),\n };\n }\n\n sessionStart(mode: 'cli' | 'tui' | 'headless', version: string) {\n if (!this.isEnabled()) return;\n\n this.mode = mode;\n\n const event: SessionStartEvent = {\n type: 'session.start',\n sessionId: this.sessionId,\n timestamp: this.sessionStartTime.toISOString(),\n attributes: {\n 'installer.version': version,\n 'installer.mode': mode,\n 'workos.user_id': this.distinctId,\n ...this.getEnvFingerprint(),\n },\n };\n\n telemetryClient.queueEvent(event);\n }\n\n stepCompleted(name: string, durationMs: number, success: boolean, error?: Error) {\n if (!this.isEnabled()) return;\n\n const event: StepEvent = {\n type: 'step',\n sessionId: this.sessionId,\n timestamp: new Date().toISOString(),\n name,\n startTimestamp: new Date(Date.now() - durationMs).toISOString(),\n durationMs,\n success,\n error: error ? this.extractErrorFields(error) : undefined,\n };\n\n telemetryClient.queueEvent(event);\n }\n\n toolCalled(toolName: string, durationMs: number, success: boolean) {\n if (!this.isEnabled()) return;\n\n const event: AgentToolEvent = {\n type: 'agent.tool',\n sessionId: this.sessionId,\n timestamp: new Date().toISOString(),\n toolName,\n startTimestamp: new Date(Date.now() - durationMs).toISOString(),\n durationMs,\n success,\n };\n\n telemetryClient.queueEvent(event);\n }\n\n llmRequest(model: string, inputTokens: number, outputTokens: number) {\n if (!this.isEnabled()) return;\n\n this.totalInputTokens += inputTokens;\n this.totalOutputTokens += outputTokens;\n\n const event: AgentLLMEvent = {\n type: 'agent.llm',\n sessionId: this.sessionId,\n timestamp: new Date().toISOString(),\n model,\n inputTokens,\n outputTokens,\n };\n\n telemetryClient.queueEvent(event);\n }\n\n incrementAgentIterations() {\n this.agentIterations++;\n }\n\n emitCommandEvent(\n name: string,\n durationMs: number,\n success: boolean,\n options?: {\n error?: Error;\n flags?: string[];\n reason?: TerminationReason;\n errorCode?: string;\n apiContext?: { status?: number; code?: string; resource?: string };\n extraAttributes?: Record<string, string | number | boolean>;\n },\n ) {\n if (!this.isEnabled()) return;\n\n const errorFields = options?.error ? this.extractErrorFields(options.error) : undefined;\n\n const event: CommandEvent = {\n type: 'command',\n sessionId: this.sessionId,\n timestamp: new Date().toISOString(),\n attributes: {\n // Extras first: standard fields below win on key collision, so callers\n // can never override command.name, error fields, or the fingerprint.\n ...options?.extraAttributes,\n 'command.name': name,\n 'command.duration_ms': durationMs,\n 'command.success': success,\n 'cli.version': getVersion(),\n ...(this.distinctId ? { 'workos.user_id': this.distinctId } : {}),\n ...(errorFields\n ? {\n 'command.error_type': errorFields.type,\n 'command.error_message': errorFields.message,\n }\n : {}),\n ...(options?.flags?.length ? { 'command.flags': options.flags.join(',') } : {}),\n ...(options?.reason ? { 'termination.reason': options.reason } : {}),\n ...(options?.errorCode ? { 'error.code': options.errorCode } : {}),\n ...(options?.apiContext?.status !== undefined ? { 'api.status': options.apiContext.status } : {}),\n ...(options?.apiContext?.code ? { 'api.code': options.apiContext.code } : {}),\n ...(options?.apiContext?.resource ? { 'api.resource': options.apiContext.resource } : {}),\n ...this.getEnvFingerprint(),\n },\n };\n\n telemetryClient.queueEvent(event);\n }\n\n captureUnhandledCrash(error: Error, options?: { command?: string; version?: string }) {\n if (!this.isEnabled()) return;\n\n const { type, message } = this.extractErrorFields(error);\n\n const event: CrashEvent = {\n type: 'crash',\n sessionId: this.sessionId,\n timestamp: new Date().toISOString(),\n attributes: {\n 'crash.error_type': type,\n 'crash.error_message': message,\n 'crash.stack': sanitizeStack(error.stack),\n ...(options?.command ? { 'crash.command': options.command } : {}),\n 'cli.version': options?.version ?? getVersion(),\n ...(this.distinctId ? { 'workos.user_id': this.distinctId } : {}),\n ...this.getEnvFingerprint(),\n },\n };\n\n telemetryClient.queueEvent(event);\n }\n\n async shutdown(status: 'success' | 'error' | 'cancelled') {\n if (!this.isEnabled()) return;\n\n const duration = Date.now() - this.sessionStartTime.getTime();\n\n // Filter out null/undefined tags\n const extraAttributes = Object.fromEntries(Object.entries(this.tags).filter(([, v]) => v != null)) as Record<\n string,\n string | number | boolean\n >;\n\n const envFingerprint = this.getEnvFingerprint();\n\n const event: SessionEndEvent = {\n type: 'session.end',\n sessionId: this.sessionId,\n timestamp: new Date().toISOString(),\n attributes: {\n 'installer.outcome': status,\n 'installer.duration_ms': duration,\n 'installer.agent.iterations': this.agentIterations,\n 'installer.agent.tokens.input': this.totalInputTokens,\n 'installer.agent.tokens.output': this.totalOutputTokens,\n ...envFingerprint,\n ...(this.mode ? { 'installer.mode': this.mode } : {}),\n ...extraAttributes,\n },\n };\n\n telemetryClient.queueEvent(event);\n await telemetryClient.flush();\n }\n}\n\nexport const analytics = new Analytics();\n"]}
|
package/dist/utils/bash.d.ts
DELETED
package/dist/utils/bash.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as child_process from 'child_process';
|
|
2
|
-
export function executeSync(command) {
|
|
3
|
-
const output = child_process.execSync(command);
|
|
4
|
-
return output.toString();
|
|
5
|
-
}
|
|
6
|
-
export function execute(command) {
|
|
7
|
-
return new Promise((resolve, reject) => {
|
|
8
|
-
child_process.exec(command, (error, stdout, _) => {
|
|
9
|
-
if (error) {
|
|
10
|
-
reject(error);
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
resolve(stdout);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=bash.js.map
|
package/dist/utils/bash.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/utils/bash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,eAAe,CAAC;AAE/C,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YAED,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as child_process from 'child_process';\n\nexport function executeSync(command: string): string {\n const output = child_process.execSync(command);\n return output.toString();\n}\n\nexport function execute(command: string): Promise<string> {\n return new Promise((resolve, reject) => {\n child_process.exec(command, (error, stdout, _) => {\n if (error) {\n reject(error);\n return;\n }\n\n resolve(stdout);\n });\n });\n}\n"]}
|
package/dist/utils/box.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flat, gutterless notice to stderr — the de-boxed startup/notice output.
|
|
3
|
-
*
|
|
4
|
-
* Callers pass already-styled lines; this indents them two spaces and frames
|
|
5
|
-
* them with a single blank line above and below so the notice reads as its own
|
|
6
|
-
* beat without a border. This is the only notice primitive: the CLI no longer
|
|
7
|
-
* draws bordered boxes for startup notices (telemetry, unclaimed env, provision).
|
|
8
|
-
*/
|
|
9
|
-
export declare function renderStderrNotice(...lines: string[]): void;
|
package/dist/utils/box.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flat, gutterless notice to stderr — the de-boxed startup/notice output.
|
|
3
|
-
*
|
|
4
|
-
* Callers pass already-styled lines; this indents them two spaces and frames
|
|
5
|
-
* them with a single blank line above and below so the notice reads as its own
|
|
6
|
-
* beat without a border. This is the only notice primitive: the CLI no longer
|
|
7
|
-
* draws bordered boxes for startup notices (telemetry, unclaimed env, provision).
|
|
8
|
-
*/
|
|
9
|
-
export function renderStderrNotice(...lines) {
|
|
10
|
-
console.error('');
|
|
11
|
-
for (const ln of lines)
|
|
12
|
-
console.error(` ${ln}`);
|
|
13
|
-
console.error('');
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=box.js.map
|
package/dist/utils/box.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"box.js","sourceRoot":"","sources":["../../src/utils/box.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAG,KAAe;IACnD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,KAAK,MAAM,EAAE,IAAI,KAAK;QAAE,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC","sourcesContent":["/**\n * Flat, gutterless notice to stderr — the de-boxed startup/notice output.\n *\n * Callers pass already-styled lines; this indents them two spaces and frames\n * them with a single blank line above and below so the notice reads as its own\n * beat without a border. This is the only notice primitive: the CLI no longer\n * draws bordered boxes for startup notices (telemetry, unclaimed env, provision).\n */\nexport function renderStderrNotice(...lines: string[]): void {\n console.error('');\n for (const ln of lines) console.error(` ${ln}`);\n console.error('');\n}\n"]}
|
package/dist/utils/cli-exit.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { TerminationReason } from './telemetry-types.js';
|
|
2
|
-
export interface CliExitContext {
|
|
3
|
-
reason: TerminationReason;
|
|
4
|
-
errorCode?: string;
|
|
5
|
-
apiContext?: {
|
|
6
|
-
status?: number;
|
|
7
|
-
code?: string;
|
|
8
|
-
resource?: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export declare class CliExit extends Error {
|
|
12
|
-
readonly exitCode: number;
|
|
13
|
-
readonly context?: CliExitContext | undefined;
|
|
14
|
-
constructor(exitCode: number, context?: CliExitContext | undefined);
|
|
15
|
-
}
|
package/dist/utils/cli-exit.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export class CliExit extends Error {
|
|
2
|
-
exitCode;
|
|
3
|
-
context;
|
|
4
|
-
constructor(exitCode, context) {
|
|
5
|
-
super(`CLI exit: code ${exitCode}`);
|
|
6
|
-
this.exitCode = exitCode;
|
|
7
|
-
this.context = context;
|
|
8
|
-
this.name = 'CliExit';
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=cli-exit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli-exit.js","sourceRoot":"","sources":["../../src/utils/cli-exit.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAErB;IACA;IAFX,YACW,QAAgB,EAChB,OAAwB;QAEjC,KAAK,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC;QAH3B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,YAAO,GAAP,OAAO,CAAiB;QAGjC,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACxB,CAAC;CACF","sourcesContent":["import type { TerminationReason } from './telemetry-types.js';\n\nexport interface CliExitContext {\n reason: TerminationReason;\n errorCode?: string;\n apiContext?: { status?: number; code?: string; resource?: string };\n}\n\nexport class CliExit extends Error {\n constructor(\n readonly exitCode: number,\n readonly context?: CliExitContext,\n ) {\n super(`CLI exit: code ${exitCode}`);\n this.name = 'CliExit';\n }\n}\n"]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export declare const symbols: {
|
|
2
|
-
readonly success: "✓" | "+";
|
|
3
|
-
readonly error: "✗" | "x";
|
|
4
|
-
readonly warning: "!";
|
|
5
|
-
readonly info: "ℹ" | "i";
|
|
6
|
-
readonly arrow: "→" | "->";
|
|
7
|
-
readonly bullet: "•" | "*";
|
|
8
|
-
readonly progressFilled: "▓" | "#";
|
|
9
|
-
readonly progressEmpty: "-" | "░";
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* WorkOS brand palette (hex). Single source shared by the `ui` facade and the
|
|
13
|
-
* install summary box so the flat CLI output and the summary render identical
|
|
14
|
-
* brand colors. chalk auto-disables color when `chalk.level === 0` (JSON mode).
|
|
15
|
-
*/
|
|
16
|
-
export declare const palette: {
|
|
17
|
-
readonly accent: import("chalk").ChalkInstance;
|
|
18
|
-
readonly green: import("chalk").ChalkInstance;
|
|
19
|
-
readonly red: import("chalk").ChalkInstance;
|
|
20
|
-
readonly yellow: import("chalk").ChalkInstance;
|
|
21
|
-
readonly cyan: import("chalk").ChalkInstance;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Pre-styled output functions for consistent CLI formatting.
|
|
25
|
-
* Uses chalk for coloring with appropriate symbols.
|
|
26
|
-
*/
|
|
27
|
-
export declare const styled: {
|
|
28
|
-
/** Green checkmark with message */
|
|
29
|
-
readonly success: (text: string) => string;
|
|
30
|
-
/** Red X with message */
|
|
31
|
-
readonly error: (text: string) => string;
|
|
32
|
-
/** Yellow warning with message */
|
|
33
|
-
readonly warning: (text: string) => string;
|
|
34
|
-
/** Dim info text */
|
|
35
|
-
readonly info: (text: string) => string;
|
|
36
|
-
/** Cyan arrow for actions */
|
|
37
|
-
readonly action: (text: string) => string;
|
|
38
|
-
/** Label with value, label is dimmed */
|
|
39
|
-
readonly label: (label: string, value: string) => string;
|
|
40
|
-
/** Phase indicator with visual progress bar */
|
|
41
|
-
readonly phase: (num: number, total: number, name: string) => string;
|
|
42
|
-
/** Bullet point for lists */
|
|
43
|
-
readonly bullet: (text: string) => string;
|
|
44
|
-
};
|