workos 0.0.24 → 0.1.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/.claude-plugin/plugin.json +13 -0
- package/LICENSE +47 -0
- package/README.md +154 -1
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +163 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.config.d.ts +52 -0
- package/dist/cli.config.js +70 -0
- package/dist/cli.config.js.map +1 -0
- package/dist/package.json +87 -0
- package/dist/src/commands/install-skill.d.ts +20 -0
- package/dist/src/commands/install-skill.js +130 -0
- package/dist/src/commands/install-skill.js.map +1 -0
- package/dist/src/commands/install.d.ts +22 -0
- package/dist/src/commands/install.js +57 -0
- package/dist/src/commands/install.js.map +1 -0
- package/dist/src/commands/login.d.ts +1 -0
- package/dist/src/commands/login.js +141 -0
- package/dist/src/commands/login.js.map +1 -0
- package/dist/src/commands/logout.d.ts +1 -0
- package/dist/src/commands/logout.js +17 -0
- package/dist/src/commands/logout.js.map +1 -0
- package/dist/src/dashboard/components/AnimatedLogo.d.ts +8 -0
- package/dist/src/dashboard/components/AnimatedLogo.js +16 -0
- package/dist/src/dashboard/components/AnimatedLogo.js.map +1 -0
- package/dist/src/dashboard/components/CompletionView.d.ts +13 -0
- package/dist/src/dashboard/components/CompletionView.js +21 -0
- package/dist/src/dashboard/components/CompletionView.js.map +1 -0
- package/dist/src/dashboard/components/ConfirmPrompt.d.ts +9 -0
- package/dist/src/dashboard/components/ConfirmPrompt.js +25 -0
- package/dist/src/dashboard/components/ConfirmPrompt.js.map +1 -0
- package/dist/src/dashboard/components/CredentialsForm.d.ts +10 -0
- package/dist/src/dashboard/components/CredentialsForm.js +47 -0
- package/dist/src/dashboard/components/CredentialsForm.js.map +1 -0
- package/dist/src/dashboard/components/Dashboard.d.ts +3 -0
- package/dist/src/dashboard/components/Dashboard.js +100 -0
- package/dist/src/dashboard/components/Dashboard.js.map +1 -0
- package/dist/src/dashboard/components/DashboardLayout.d.ts +24 -0
- package/dist/src/dashboard/components/DashboardLayout.js +25 -0
- package/dist/src/dashboard/components/DashboardLayout.js.map +1 -0
- package/dist/src/dashboard/components/DiffPanel.d.ts +9 -0
- package/dist/src/dashboard/components/DiffPanel.js +136 -0
- package/dist/src/dashboard/components/DiffPanel.js.map +1 -0
- package/dist/src/dashboard/components/InlinePrompt.d.ts +8 -0
- package/dist/src/dashboard/components/InlinePrompt.js +19 -0
- package/dist/src/dashboard/components/InlinePrompt.js.map +1 -0
- package/dist/src/dashboard/components/OutputPanel.d.ts +10 -0
- package/dist/src/dashboard/components/OutputPanel.js +100 -0
- package/dist/src/dashboard/components/OutputPanel.js.map +1 -0
- package/dist/src/dashboard/components/Panel.d.ts +12 -0
- package/dist/src/dashboard/components/Panel.js +6 -0
- package/dist/src/dashboard/components/Panel.js.map +1 -0
- package/dist/src/dashboard/components/TextInput.d.ts +13 -0
- package/dist/src/dashboard/components/TextInput.js +57 -0
- package/dist/src/dashboard/components/TextInput.js.map +1 -0
- package/dist/src/dashboard/components/WelcomeArt.d.ts +2 -0
- package/dist/src/dashboard/components/WelcomeArt.js +9 -0
- package/dist/src/dashboard/components/WelcomeArt.js.map +1 -0
- package/dist/src/dashboard/hooks/useAnimation.d.ts +7 -0
- package/dist/src/dashboard/hooks/useAnimation.js +24 -0
- package/dist/src/dashboard/hooks/useAnimation.js.map +1 -0
- package/dist/src/dashboard/hooks/useKeyboard.d.ts +8 -0
- package/dist/src/dashboard/hooks/useKeyboard.js +18 -0
- package/dist/src/dashboard/hooks/useKeyboard.js.map +1 -0
- package/dist/src/dashboard/hooks/useTerminalSize.d.ts +8 -0
- package/dist/src/dashboard/hooks/useTerminalSize.js +23 -0
- package/dist/src/dashboard/hooks/useTerminalSize.js.map +1 -0
- package/dist/src/dashboard/index.d.ts +6 -0
- package/dist/src/dashboard/index.js +36 -0
- package/dist/src/dashboard/index.js.map +1 -0
- package/dist/src/dashboard/lib/diff-utils.d.ts +21 -0
- package/dist/src/dashboard/lib/diff-utils.js +271 -0
- package/dist/src/dashboard/lib/diff-utils.js.map +1 -0
- package/dist/src/dashboard/lib/logo-frames.d.ts +20 -0
- package/dist/src/dashboard/lib/logo-frames.js +109 -0
- package/dist/src/dashboard/lib/logo-frames.js.map +1 -0
- package/dist/src/dashboard/lib/welcome-art.d.ts +1 -0
- package/dist/src/dashboard/lib/welcome-art.js +5 -0
- package/dist/src/dashboard/lib/welcome-art.js.map +1 -0
- package/dist/src/dashboard/types.d.ts +5 -0
- package/dist/src/dashboard/types.js +2 -0
- package/dist/src/dashboard/types.js.map +1 -0
- package/dist/src/lib/__tests__/test-utils.d.ts +40 -0
- package/dist/src/lib/__tests__/test-utils.js +108 -0
- package/dist/src/lib/__tests__/test-utils.js.map +1 -0
- package/dist/src/lib/adapters/cli-adapter.d.ts +56 -0
- package/dist/src/lib/adapters/cli-adapter.js +318 -0
- package/dist/src/lib/adapters/cli-adapter.js.map +1 -0
- package/dist/src/lib/adapters/dashboard-adapter.d.ts +30 -0
- package/dist/src/lib/adapters/dashboard-adapter.js +97 -0
- package/dist/src/lib/adapters/dashboard-adapter.js.map +1 -0
- package/dist/src/lib/adapters/index.d.ts +3 -0
- package/dist/src/lib/adapters/index.js +3 -0
- package/dist/src/lib/adapters/index.js.map +1 -0
- package/dist/src/lib/adapters/types.d.ts +41 -0
- package/dist/src/lib/adapters/types.js +2 -0
- package/dist/src/lib/adapters/types.js.map +1 -0
- package/dist/src/lib/agent-interface.d.ts +75 -0
- package/dist/src/lib/agent-interface.js +563 -0
- package/dist/src/lib/agent-interface.js.map +1 -0
- package/dist/src/lib/agent-runner.d.ts +9 -0
- package/dist/src/lib/agent-runner.js +213 -0
- package/dist/src/lib/agent-runner.js.map +1 -0
- package/dist/src/lib/api.d.ts +25 -0
- package/dist/src/lib/api.js +120 -0
- package/dist/src/lib/api.js.map +1 -0
- package/dist/src/lib/config.d.ts +60 -0
- package/dist/src/lib/config.js +88 -0
- package/dist/src/lib/config.js.map +1 -0
- package/dist/src/lib/constants.d.ts +32 -0
- package/dist/src/lib/constants.js +53 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/credentials.d.ts +19 -0
- package/dist/src/lib/credentials.js +55 -0
- package/dist/src/lib/credentials.js.map +1 -0
- package/dist/src/lib/env-writer.d.ts +14 -0
- package/dist/src/lib/env-writer.js +39 -0
- package/dist/src/lib/env-writer.js.map +1 -0
- package/dist/src/lib/events.d.ts +114 -0
- package/dist/src/lib/events.js +19 -0
- package/dist/src/lib/events.js.map +1 -0
- package/dist/src/lib/framework-config.d.ts +108 -0
- package/dist/src/lib/framework-config.js +11 -0
- package/dist/src/lib/framework-config.js.map +1 -0
- package/dist/src/lib/helper-functions.d.ts +1 -0
- package/dist/src/lib/helper-functions.js +2 -0
- package/dist/src/lib/helper-functions.js.map +1 -0
- package/dist/src/lib/port-detection.d.ts +7 -0
- package/dist/src/lib/port-detection.js +112 -0
- package/dist/src/lib/port-detection.js.map +1 -0
- package/dist/src/lib/progress-tracker.d.ts +22 -0
- package/dist/src/lib/progress-tracker.js +47 -0
- package/dist/src/lib/progress-tracker.js.map +1 -0
- package/dist/src/lib/run-with-core.d.ts +2 -0
- package/dist/src/lib/run-with-core.js +266 -0
- package/dist/src/lib/run-with-core.js.map +1 -0
- package/dist/src/lib/safe-tools.d.ts +2 -0
- package/dist/src/lib/safe-tools.js +212 -0
- package/dist/src/lib/safe-tools.js.map +1 -0
- package/dist/src/lib/settings.d.ts +59 -0
- package/dist/src/lib/settings.js +36 -0
- package/dist/src/lib/settings.js.map +1 -0
- package/dist/src/lib/token-refresh.d.ts +12 -0
- package/dist/src/lib/token-refresh.js +26 -0
- package/dist/src/lib/token-refresh.js.map +1 -0
- package/dist/src/lib/validation/build-validator.d.ts +9 -0
- package/dist/src/lib/validation/build-validator.js +118 -0
- package/dist/src/lib/validation/build-validator.js.map +1 -0
- package/dist/src/lib/validation/index.d.ts +3 -0
- package/dist/src/lib/validation/index.js +3 -0
- package/dist/src/lib/validation/index.js.map +1 -0
- package/dist/src/lib/validation/types.d.ts +41 -0
- package/dist/src/lib/validation/types.js +2 -0
- package/dist/src/lib/validation/types.js.map +1 -0
- package/dist/src/lib/validation/validator.d.ts +6 -0
- package/dist/src/lib/validation/validator.js +647 -0
- package/dist/src/lib/validation/validator.js.map +1 -0
- package/dist/src/lib/wizard-core.d.ts +200 -0
- package/dist/src/lib/wizard-core.js +392 -0
- package/dist/src/lib/wizard-core.js.map +1 -0
- package/dist/src/lib/wizard-core.types.d.ts +73 -0
- package/dist/src/lib/wizard-core.types.js +2 -0
- package/dist/src/lib/wizard-core.types.js.map +1 -0
- package/dist/src/lib/workos-management.d.ts +32 -0
- package/dist/src/lib/workos-management.js +142 -0
- package/dist/src/lib/workos-management.js.map +1 -0
- package/dist/src/nextjs/nextjs-wizard-agent.d.ts +6 -0
- package/dist/src/nextjs/nextjs-wizard-agent.js +97 -0
- package/dist/src/nextjs/nextjs-wizard-agent.js.map +1 -0
- package/dist/src/nextjs/utils.d.ts +8 -0
- package/dist/src/nextjs/utils.js +53 -0
- package/dist/src/nextjs/utils.js.map +1 -0
- package/dist/src/react/react-wizard-agent.d.ts +2 -0
- package/dist/src/react/react-wizard-agent.js +47 -0
- package/dist/src/react/react-wizard-agent.js.map +1 -0
- package/dist/src/react-router/react-router-wizard-agent.d.ts +6 -0
- package/dist/src/react-router/react-router-wizard-agent.js +103 -0
- package/dist/src/react-router/react-router-wizard-agent.js.map +1 -0
- package/dist/src/react-router/utils.d.ts +19 -0
- package/dist/src/react-router/utils.js +210 -0
- package/dist/src/react-router/utils.js.map +1 -0
- package/dist/src/run.d.ts +24 -0
- package/dist/src/run.js +48 -0
- package/dist/src/run.js.map +1 -0
- package/dist/src/steps/add-or-update-environment-variables.d.ts +10 -0
- package/dist/src/steps/add-or-update-environment-variables.js +155 -0
- package/dist/src/steps/add-or-update-environment-variables.js.map +1 -0
- package/dist/src/steps/index.d.ts +3 -0
- package/dist/src/steps/index.js +4 -0
- package/dist/src/steps/index.js.map +1 -0
- package/dist/src/steps/run-prettier.d.ts +5 -0
- package/dist/src/steps/run-prettier.js +54 -0
- package/dist/src/steps/run-prettier.js.map +1 -0
- package/dist/src/steps/upload-environment-variables/EnvironmentProvider.d.ts +8 -0
- package/dist/src/steps/upload-environment-variables/EnvironmentProvider.js +7 -0
- package/dist/src/steps/upload-environment-variables/EnvironmentProvider.js.map +1 -0
- package/dist/src/steps/upload-environment-variables/index.d.ts +6 -0
- package/dist/src/steps/upload-environment-variables/index.js +57 -0
- package/dist/src/steps/upload-environment-variables/index.js.map +1 -0
- package/dist/src/steps/upload-environment-variables/providers/vercel.d.ts +14 -0
- package/dist/src/steps/upload-environment-variables/providers/vercel.js +104 -0
- package/dist/src/steps/upload-environment-variables/providers/vercel.js.map +1 -0
- package/dist/src/tanstack-start/tanstack-start-wizard-agent.d.ts +2 -0
- package/dist/src/tanstack-start/tanstack-start-wizard-agent.js +49 -0
- package/dist/src/tanstack-start/tanstack-start-wizard-agent.js.map +1 -0
- package/dist/src/telemetry.d.ts +2 -0
- package/dist/src/telemetry.js +29 -0
- package/dist/src/telemetry.js.map +1 -0
- package/dist/src/utils/analytics.d.ts +24 -0
- package/dist/src/utils/analytics.js +139 -0
- package/dist/src/utils/analytics.js.map +1 -0
- package/dist/src/utils/bash.d.ts +2 -0
- package/dist/src/utils/bash.js +17 -0
- package/dist/src/utils/bash.js.map +1 -0
- package/dist/src/utils/clack-utils.d.ts +93 -0
- package/dist/src/utils/clack-utils.js +397 -0
- package/dist/src/utils/clack-utils.js.map +1 -0
- package/dist/src/utils/clack.d.ts +5 -0
- package/dist/src/utils/clack.js +34 -0
- package/dist/src/utils/clack.js.map +1 -0
- package/dist/src/utils/cli-symbols.d.ts +32 -0
- package/dist/src/utils/cli-symbols.js +46 -0
- package/dist/src/utils/cli-symbols.js.map +1 -0
- package/dist/src/utils/debug.d.ts +7 -0
- package/dist/src/utils/debug.js +88 -0
- package/dist/src/utils/debug.js.map +1 -0
- package/dist/src/utils/env-parser.d.ts +5 -0
- package/dist/src/utils/env-parser.js +18 -0
- package/dist/src/utils/env-parser.js.map +1 -0
- package/dist/src/utils/environment.d.ts +4 -0
- package/dist/src/utils/environment.js +69 -0
- package/dist/src/utils/environment.js.map +1 -0
- package/dist/src/utils/errors.d.ts +3 -0
- package/dist/src/utils/errors.js +7 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/logging.d.ts +9 -0
- package/dist/src/utils/logging.js +36 -0
- package/dist/src/utils/logging.js.map +1 -0
- package/dist/src/utils/package-json.d.ts +25 -0
- package/dist/src/utils/package-json.js +21 -0
- package/dist/src/utils/package-json.js.map +1 -0
- package/dist/src/utils/package-manager.d.ts +21 -0
- package/dist/src/utils/package-manager.js +167 -0
- package/dist/src/utils/package-manager.js.map +1 -0
- package/dist/src/utils/redact.d.ts +5 -0
- package/dist/src/utils/redact.js +29 -0
- package/dist/src/utils/redact.js.map +1 -0
- package/dist/src/utils/semver.d.ts +10 -0
- package/dist/src/utils/semver.js +43 -0
- package/dist/src/utils/semver.js.map +1 -0
- package/dist/src/utils/string.d.ts +1 -0
- package/dist/src/utils/string.js +6 -0
- package/dist/src/utils/string.js.map +1 -0
- package/dist/src/utils/telemetry-client.d.ts +15 -0
- package/dist/src/utils/telemetry-client.js +57 -0
- package/dist/src/utils/telemetry-client.js.map +1 -0
- package/dist/src/utils/telemetry-types.d.ts +51 -0
- package/dist/src/utils/telemetry-types.js +6 -0
- package/dist/src/utils/telemetry-types.js.map +1 -0
- package/dist/src/utils/types.d.ts +80 -0
- package/dist/src/utils/types.js +2 -0
- package/dist/src/utils/types.js.map +1 -0
- package/dist/src/utils/urls.d.ts +7 -0
- package/dist/src/utils/urls.js +8 -0
- package/dist/src/utils/urls.js.map +1 -0
- package/dist/src/utils/vendor/is-unicorn-supported.d.ts +1 -0
- package/dist/src/utils/vendor/is-unicorn-supported.js +21 -0
- package/dist/src/utils/vendor/is-unicorn-supported.js.map +1 -0
- package/dist/src/vanilla-js/vanilla-js-wizard-agent.d.ts +2 -0
- package/dist/src/vanilla-js/vanilla-js-wizard-agent.js +47 -0
- package/dist/src/vanilla-js/vanilla-js-wizard-agent.js.map +1 -0
- package/package.json +76 -84
- package/skills/workos-authkit-base/SKILL.md +113 -0
- package/skills/workos-authkit-nextjs/SKILL.md +115 -0
- package/skills/workos-authkit-react/SKILL.md +91 -0
- package/skills/workos-authkit-react-router/SKILL.md +106 -0
- package/skills/workos-authkit-tanstack-start/SKILL.md +104 -0
- package/skills/workos-authkit-vanilla-js/SKILL.md +81 -0
- package/build/apps/index.js +0 -50
- package/build/apps/slack.js +0 -151
- package/build/cli.js +0 -42
- package/build/config.js +0 -34
- package/build/dev.js +0 -5
- package/build/enable-api-access.png +0 -0
- package/build/groups.js +0 -480
- package/build/index.js +0 -3
- package/build/info.js +0 -69
- package/build/login.js +0 -161
- package/build/main.js +0 -214
- package/build/users.js +0 -402
- package/build/util.js +0 -157
- package/coverage/clover.xml +0 -66
- package/coverage/coverage-final.json +0 -4
- package/coverage/lcov-report/base.css +0 -212
- package/coverage/lcov-report/cli.ts.html +0 -329
- package/coverage/lcov-report/config.ts.html +0 -152
- package/coverage/lcov-report/index.html +0 -119
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -1
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -158
- package/coverage/lcov-report/util.ts.html +0 -350
- package/coverage/lcov.info +0 -121
- package/package-lock.json +0 -7617
- package/tests/util.test.ts +0 -35
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get version from package.json
|
|
3
|
+
*/
|
|
4
|
+
export declare function getVersion(): string;
|
|
5
|
+
export interface InstallerConfig {
|
|
6
|
+
model: string;
|
|
7
|
+
workos: {
|
|
8
|
+
clientId: string;
|
|
9
|
+
authkitDomain: string;
|
|
10
|
+
llmGatewayUrl: string;
|
|
11
|
+
};
|
|
12
|
+
telemetry: {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
eventName: string;
|
|
15
|
+
};
|
|
16
|
+
nodeVersion: string;
|
|
17
|
+
logging: {
|
|
18
|
+
debugMode: boolean;
|
|
19
|
+
};
|
|
20
|
+
documentation: {
|
|
21
|
+
workosDocsUrl: string;
|
|
22
|
+
dashboardUrl: string;
|
|
23
|
+
issuesUrl: string;
|
|
24
|
+
};
|
|
25
|
+
frameworks: {
|
|
26
|
+
[key: string]: {
|
|
27
|
+
port: number;
|
|
28
|
+
callbackPath: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
legacy: {
|
|
32
|
+
oauthPort: number;
|
|
33
|
+
};
|
|
34
|
+
branding: {
|
|
35
|
+
showAsciiArt: boolean;
|
|
36
|
+
asciiArt: string;
|
|
37
|
+
compactAsciiArt: string;
|
|
38
|
+
useCompact: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get config
|
|
43
|
+
*/
|
|
44
|
+
export declare function getConfig(): InstallerConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Get the CLI auth client ID.
|
|
47
|
+
* Env var overrides config default.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getCliAuthClientId(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Get the AuthKit domain.
|
|
52
|
+
* Env var overrides config default.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getAuthkitDomain(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Get the LLM gateway URL.
|
|
57
|
+
* Env var overrides config default.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getLlmGatewayUrl(): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { config } from '../../cli.config.js';
|
|
2
|
+
import pkg from '../../package.json' with { type: 'json' };
|
|
3
|
+
/**
|
|
4
|
+
* Get version from package.json
|
|
5
|
+
*/
|
|
6
|
+
export function getVersion() {
|
|
7
|
+
return pkg.version;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get config
|
|
11
|
+
*/
|
|
12
|
+
export function getConfig() {
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get the CLI auth client ID.
|
|
17
|
+
* Env var overrides config default.
|
|
18
|
+
*/
|
|
19
|
+
export function getCliAuthClientId() {
|
|
20
|
+
return process.env.WORKOS_CLIENT_ID || config.workos.clientId;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the AuthKit domain.
|
|
24
|
+
* Env var overrides config default.
|
|
25
|
+
*/
|
|
26
|
+
export function getAuthkitDomain() {
|
|
27
|
+
return process.env.WORKOS_AUTHKIT_DOMAIN || config.workos.authkitDomain;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the LLM gateway URL.
|
|
31
|
+
* Env var overrides config default.
|
|
32
|
+
*/
|
|
33
|
+
export function getLlmGatewayUrl() {
|
|
34
|
+
return process.env.WORKOS_LLM_GATEWAY_URL || config.workos.llmGatewayUrl;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../src/lib/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,GAAG,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE3D;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAuCD;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;AAC3E,CAAC","sourcesContent":["import { config } from '../../cli.config.js';\nimport pkg from '../../package.json' with { type: 'json' };\n\n/**\n * Get version from package.json\n */\nexport function getVersion(): string {\n return pkg.version;\n}\n\nexport interface InstallerConfig {\n model: string;\n workos: {\n clientId: string;\n authkitDomain: string;\n llmGatewayUrl: string;\n };\n telemetry: {\n enabled: boolean;\n eventName: string;\n };\n nodeVersion: string;\n logging: {\n debugMode: boolean;\n };\n documentation: {\n workosDocsUrl: string;\n dashboardUrl: string;\n issuesUrl: string;\n };\n frameworks: {\n [key: string]: {\n port: number;\n callbackPath: string;\n };\n };\n legacy: {\n oauthPort: number;\n };\n branding: {\n showAsciiArt: boolean;\n asciiArt: string;\n compactAsciiArt: string;\n useCompact: boolean;\n };\n}\n\n/**\n * Get config\n */\nexport function getConfig(): InstallerConfig {\n return config;\n}\n\n/**\n * Get the CLI auth client ID.\n * Env var overrides config default.\n */\nexport function getCliAuthClientId(): string {\n return process.env.WORKOS_CLIENT_ID || config.workos.clientId;\n}\n\n/**\n * Get the AuthKit domain.\n * Env var overrides config default.\n */\nexport function getAuthkitDomain(): string {\n return process.env.WORKOS_AUTHKIT_DOMAIN || config.workos.authkitDomain;\n}\n\n/**\n * Get the LLM gateway URL.\n * Env var overrides config default.\n */\nexport function getLlmGatewayUrl(): string {\n return process.env.WORKOS_LLM_GATEWAY_URL || config.workos.llmGatewayUrl;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Credentials } from './credentials.js';
|
|
2
|
+
export interface TokenValidationResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
credentials?: Credentials;
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Check if the current token is valid.
|
|
9
|
+
* If expired, returns an error prompting re-authentication.
|
|
10
|
+
* No refresh is attempted - refresh tokens are not stored for security.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ensureValidToken(): Promise<TokenValidationResult>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getCredentials, isTokenExpired } from './credentials.js';
|
|
2
|
+
import { logInfo } from '../utils/debug.js';
|
|
3
|
+
/**
|
|
4
|
+
* Check if the current token is valid.
|
|
5
|
+
* If expired, returns an error prompting re-authentication.
|
|
6
|
+
* No refresh is attempted - refresh tokens are not stored for security.
|
|
7
|
+
*/
|
|
8
|
+
export async function ensureValidToken() {
|
|
9
|
+
const creds = getCredentials();
|
|
10
|
+
if (!creds) {
|
|
11
|
+
logInfo('[ensureValidToken] No credentials found');
|
|
12
|
+
return { success: false, error: 'Not authenticated' };
|
|
13
|
+
}
|
|
14
|
+
logInfo(`[ensureValidToken] Token expiresAt: ${new Date(creds.expiresAt).toISOString()}`);
|
|
15
|
+
logInfo(`[ensureValidToken] Current time: ${new Date().toISOString()}`);
|
|
16
|
+
if (isTokenExpired(creds)) {
|
|
17
|
+
logInfo('[ensureValidToken] Token expired, re-authentication required');
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
error: 'Session expired. Run `wizard login` to re-authenticate.',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
logInfo('[ensureValidToken] Token valid');
|
|
24
|
+
return { success: true, credentials: creds };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=token-refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-refresh.js","sourceRoot":"","sources":["../../../src/lib/token-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAe,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAQ5C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAE/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,yCAAyC,CAAC,CAAC;QACnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;IACxD,CAAC;IAED,OAAO,CAAC,uCAAuC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC1F,OAAO,CAAC,oCAAoC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAExE,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,8DAA8D,CAAC,CAAC;QACxE,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,yDAAyD;SACjE,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,gCAAgC,CAAC,CAAC;IAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["import { getCredentials, isTokenExpired, Credentials } from './credentials.js';\nimport { logInfo } from '../utils/debug.js';\n\nexport interface TokenValidationResult {\n success: boolean;\n credentials?: Credentials;\n error?: string;\n}\n\n/**\n * Check if the current token is valid.\n * If expired, returns an error prompting re-authentication.\n * No refresh is attempted - refresh tokens are not stored for security.\n */\nexport async function ensureValidToken(): Promise<TokenValidationResult> {\n const creds = getCredentials();\n\n if (!creds) {\n logInfo('[ensureValidToken] No credentials found');\n return { success: false, error: 'Not authenticated' };\n }\n\n logInfo(`[ensureValidToken] Token expiresAt: ${new Date(creds.expiresAt).toISOString()}`);\n logInfo(`[ensureValidToken] Current time: ${new Date().toISOString()}`);\n\n if (isTokenExpired(creds)) {\n logInfo('[ensureValidToken] Token expired, re-authentication required');\n return {\n success: false,\n error: 'Session expired. Run `wizard login` to re-authenticate.',\n };\n }\n\n logInfo('[ensureValidToken] Token valid');\n return { success: true, credentials: creds };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ValidationIssue } from './types.js';
|
|
2
|
+
export interface BuildResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
issues: ValidationIssue[];
|
|
5
|
+
durationMs: number;
|
|
6
|
+
stdout: string;
|
|
7
|
+
stderr: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function runBuildValidation(projectDir: string, timeoutMs?: number): Promise<BuildResult>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import { existsSync } from 'fs';
|
|
3
|
+
import { readFile } from 'fs/promises';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
export async function runBuildValidation(projectDir, timeoutMs = 60000) {
|
|
6
|
+
const startTime = Date.now();
|
|
7
|
+
const pm = detectPackageManager(projectDir);
|
|
8
|
+
const hasBuildScript = await hasBuildScriptInPackageJson(projectDir);
|
|
9
|
+
if (!hasBuildScript) {
|
|
10
|
+
return {
|
|
11
|
+
success: true,
|
|
12
|
+
issues: [],
|
|
13
|
+
durationMs: Date.now() - startTime,
|
|
14
|
+
stdout: '',
|
|
15
|
+
stderr: '',
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
const args = pm === 'npm' ? ['run', 'build'] : ['build'];
|
|
20
|
+
const proc = spawn(pm, args, {
|
|
21
|
+
cwd: projectDir,
|
|
22
|
+
shell: true,
|
|
23
|
+
timeout: timeoutMs,
|
|
24
|
+
});
|
|
25
|
+
let stdout = '';
|
|
26
|
+
let stderr = '';
|
|
27
|
+
proc.stdout?.on('data', (data) => {
|
|
28
|
+
stdout += data.toString();
|
|
29
|
+
});
|
|
30
|
+
proc.stderr?.on('data', (data) => {
|
|
31
|
+
stderr += data.toString();
|
|
32
|
+
});
|
|
33
|
+
proc.on('close', (code) => {
|
|
34
|
+
const issues = [];
|
|
35
|
+
if (code !== 0) {
|
|
36
|
+
// Parse errors from output
|
|
37
|
+
const errors = parseBuildErrors(stdout + stderr);
|
|
38
|
+
for (const error of errors) {
|
|
39
|
+
issues.push({
|
|
40
|
+
type: 'file',
|
|
41
|
+
severity: 'error',
|
|
42
|
+
message: `Build error: ${error}`,
|
|
43
|
+
hint: 'Fix the error and run build again',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// Fallback if no specific errors parsed
|
|
47
|
+
if (issues.length === 0) {
|
|
48
|
+
issues.push({
|
|
49
|
+
type: 'file',
|
|
50
|
+
severity: 'error',
|
|
51
|
+
message: 'Build failed',
|
|
52
|
+
hint: `Run \`${pm} ${args.join(' ')}\` to see full output`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
resolve({
|
|
57
|
+
success: code === 0,
|
|
58
|
+
issues,
|
|
59
|
+
durationMs: Date.now() - startTime,
|
|
60
|
+
stdout,
|
|
61
|
+
stderr,
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
proc.on('error', (err) => {
|
|
65
|
+
resolve({
|
|
66
|
+
success: false,
|
|
67
|
+
issues: [
|
|
68
|
+
{
|
|
69
|
+
type: 'file',
|
|
70
|
+
severity: 'warning',
|
|
71
|
+
message: `Could not run build: ${err.message}`,
|
|
72
|
+
hint: 'Build validation skipped',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
durationMs: Date.now() - startTime,
|
|
76
|
+
stdout: '',
|
|
77
|
+
stderr: '',
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function detectPackageManager(projectDir) {
|
|
83
|
+
if (existsSync(join(projectDir, 'pnpm-lock.yaml')))
|
|
84
|
+
return 'pnpm';
|
|
85
|
+
if (existsSync(join(projectDir, 'yarn.lock')))
|
|
86
|
+
return 'yarn';
|
|
87
|
+
return 'npm';
|
|
88
|
+
}
|
|
89
|
+
async function hasBuildScriptInPackageJson(projectDir) {
|
|
90
|
+
try {
|
|
91
|
+
const content = await readFile(join(projectDir, 'package.json'), 'utf-8');
|
|
92
|
+
const pkg = JSON.parse(content);
|
|
93
|
+
return !!pkg.scripts?.build;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function parseBuildErrors(output) {
|
|
100
|
+
const errors = [];
|
|
101
|
+
// TypeScript errors: "file.ts(line,col): error TS..."
|
|
102
|
+
const tsErrors = output.match(/[\w./]+\.\w+\(\d+,\d+\):\s*error\s+TS\d+:.+/g);
|
|
103
|
+
if (tsErrors) {
|
|
104
|
+
errors.push(...tsErrors.slice(0, 5)); // Limit to first 5
|
|
105
|
+
}
|
|
106
|
+
// Next.js errors: "Error: ..."
|
|
107
|
+
const nextErrors = output.match(/Error:\s+.+/g);
|
|
108
|
+
if (nextErrors) {
|
|
109
|
+
errors.push(...nextErrors.slice(0, 5));
|
|
110
|
+
}
|
|
111
|
+
// ESLint errors: "file.ts line:col error ..."
|
|
112
|
+
const eslintErrors = output.match(/[\w./]+:\d+:\d+\s+error\s+.+/g);
|
|
113
|
+
if (eslintErrors) {
|
|
114
|
+
errors.push(...eslintErrors.slice(0, 5));
|
|
115
|
+
}
|
|
116
|
+
return errors;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=build-validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-validator.js","sourceRoot":"","sources":["../../../../src/lib/validation/build-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,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EAAE,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,8CAA8C;IAC9C,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnE,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { spawn } from 'child_process';\nimport { existsSync } from 'fs';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\nimport type { ValidationIssue } from './types.js';\n\nexport interface BuildResult {\n success: boolean;\n issues: ValidationIssue[];\n durationMs: number;\n stdout: string;\n stderr: string;\n}\n\nexport async function runBuildValidation(projectDir: string, timeoutMs: number = 60000): Promise<BuildResult> {\n const startTime = Date.now();\n const pm = detectPackageManager(projectDir);\n const hasBuildScript = await hasBuildScriptInPackageJson(projectDir);\n\n if (!hasBuildScript) {\n return {\n success: true,\n issues: [],\n durationMs: Date.now() - startTime,\n stdout: '',\n stderr: '',\n };\n }\n\n return new Promise((resolve) => {\n const args = pm === 'npm' ? ['run', 'build'] : ['build'];\n const proc = spawn(pm, args, {\n cwd: projectDir,\n shell: true,\n timeout: timeoutMs,\n });\n\n let stdout = '';\n let stderr = '';\n\n proc.stdout?.on('data', (data: Buffer) => {\n stdout += data.toString();\n });\n proc.stderr?.on('data', (data: Buffer) => {\n stderr += data.toString();\n });\n\n proc.on('close', (code) => {\n const issues: ValidationIssue[] = [];\n\n if (code !== 0) {\n // Parse errors from output\n const errors = parseBuildErrors(stdout + stderr);\n for (const error of errors) {\n issues.push({\n type: 'file',\n severity: 'error',\n message: `Build error: ${error}`,\n hint: 'Fix the error and run build again',\n });\n }\n\n // Fallback if no specific errors parsed\n if (issues.length === 0) {\n issues.push({\n type: 'file',\n severity: 'error',\n message: 'Build failed',\n hint: `Run \\`${pm} ${args.join(' ')}\\` to see full output`,\n });\n }\n }\n\n resolve({\n success: code === 0,\n issues,\n durationMs: Date.now() - startTime,\n stdout,\n stderr,\n });\n });\n\n proc.on('error', (err) => {\n resolve({\n success: false,\n issues: [\n {\n type: 'file',\n severity: 'warning',\n message: `Could not run build: ${err.message}`,\n hint: 'Build validation skipped',\n },\n ],\n durationMs: Date.now() - startTime,\n stdout: '',\n stderr: '',\n });\n });\n });\n}\n\nfunction detectPackageManager(projectDir: string): 'pnpm' | 'yarn' | 'npm' {\n if (existsSync(join(projectDir, 'pnpm-lock.yaml'))) return 'pnpm';\n if (existsSync(join(projectDir, 'yarn.lock'))) return 'yarn';\n return 'npm';\n}\n\nasync function hasBuildScriptInPackageJson(projectDir: string): Promise<boolean> {\n try {\n const content = await readFile(join(projectDir, 'package.json'), 'utf-8');\n const pkg = JSON.parse(content) as { scripts?: { build?: string } };\n return !!pkg.scripts?.build;\n } catch {\n return false;\n }\n}\n\nfunction parseBuildErrors(output: string): string[] {\n const errors: string[] = [];\n\n // TypeScript errors: \"file.ts(line,col): error TS...\"\n const tsErrors = output.match(/[\\w./]+\\.\\w+\\(\\d+,\\d+\\):\\s*error\\s+TS\\d+:.+/g);\n if (tsErrors) {\n errors.push(...tsErrors.slice(0, 5)); // Limit to first 5\n }\n\n // Next.js errors: \"Error: ...\"\n const nextErrors = output.match(/Error:\\s+.+/g);\n if (nextErrors) {\n errors.push(...nextErrors.slice(0, 5));\n }\n\n // ESLint errors: \"file.ts line:col error ...\"\n const eslintErrors = output.match(/[\\w./]+:\\d+:\\d+\\s+error\\s+.+/g);\n if (eslintErrors) {\n errors.push(...eslintErrors.slice(0, 5));\n }\n\n return errors;\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { validateInstallation, type ValidateOptions } from './validator.js';
|
|
2
|
+
export { runBuildValidation, type BuildResult } from './build-validator.js';
|
|
3
|
+
export type { ValidationResult, ValidationRules, ValidationIssue, ValidationSeverity, ValidationIssueType, PackageRule, EnvVarRule, FileRule, VariantRules, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAwB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAoB,MAAM,sBAAsB,CAAC","sourcesContent":["export { validateInstallation, type ValidateOptions } from './validator.js';\nexport { runBuildValidation, type BuildResult } from './build-validator.js';\nexport type {\n ValidationResult,\n ValidationRules,\n ValidationIssue,\n ValidationSeverity,\n ValidationIssueType,\n PackageRule,\n EnvVarRule,\n FileRule,\n VariantRules,\n} from './types.js';\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type ValidationSeverity = 'error' | 'warning';
|
|
2
|
+
export type ValidationIssueType = 'package' | 'env' | 'file' | 'pattern';
|
|
3
|
+
export interface ValidationIssue {
|
|
4
|
+
type: ValidationIssueType;
|
|
5
|
+
severity: ValidationSeverity;
|
|
6
|
+
message: string;
|
|
7
|
+
hint?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ValidationResult {
|
|
10
|
+
passed: boolean;
|
|
11
|
+
framework: string;
|
|
12
|
+
issues: ValidationIssue[];
|
|
13
|
+
durationMs: number;
|
|
14
|
+
}
|
|
15
|
+
export interface PackageRule {
|
|
16
|
+
name: string;
|
|
17
|
+
location?: 'dependencies' | 'devDependencies' | 'any';
|
|
18
|
+
}
|
|
19
|
+
export interface EnvVarRule {
|
|
20
|
+
name: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
alternates?: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface FileRule {
|
|
25
|
+
path: string;
|
|
26
|
+
mustContain?: string[];
|
|
27
|
+
mustContainAny?: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface VariantRules {
|
|
30
|
+
files?: FileRule[];
|
|
31
|
+
packages?: PackageRule[];
|
|
32
|
+
envVars?: EnvVarRule[];
|
|
33
|
+
}
|
|
34
|
+
export interface ValidationRules {
|
|
35
|
+
framework: string;
|
|
36
|
+
packages: PackageRule[];
|
|
37
|
+
envVars: EnvVarRule[];
|
|
38
|
+
files: FileRule[];
|
|
39
|
+
variants?: Record<string, VariantRules>;
|
|
40
|
+
}
|
|
41
|
+
export type { BuildResult } from './build-validator.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/validation/types.ts"],"names":[],"mappings":"","sourcesContent":["export type ValidationSeverity = 'error' | 'warning';\nexport type ValidationIssueType = 'package' | 'env' | 'file' | 'pattern';\n\nexport interface ValidationIssue {\n type: ValidationIssueType;\n severity: ValidationSeverity;\n message: string;\n hint?: string; // How to fix\n}\n\nexport interface ValidationResult {\n passed: boolean;\n framework: string;\n issues: ValidationIssue[];\n durationMs: number;\n}\n\n// Rule definitions (matches JSON schema)\nexport interface PackageRule {\n name: string;\n location?: 'dependencies' | 'devDependencies' | 'any'; // default: 'any'\n}\n\nexport interface EnvVarRule {\n name: string;\n required?: boolean; // default: true\n alternates?: string[]; // alternate env var names (e.g., VITE_WORKOS_CLIENT_ID)\n}\n\nexport interface FileRule {\n path: string; // glob pattern, e.g., \"middleware.ts\" or \"app/**/callback/**/route.ts\"\n mustContain?: string[]; // strings that must appear in file\n mustContainAny?: string[]; // at least one must appear\n}\n\nexport interface VariantRules {\n files?: FileRule[];\n packages?: PackageRule[];\n envVars?: EnvVarRule[];\n}\n\nexport interface ValidationRules {\n framework: string;\n packages: PackageRule[];\n envVars: EnvVarRule[];\n files: FileRule[];\n variants?: Record<string, VariantRules>;\n}\n\n// Re-export BuildResult from build-validator\nexport type { BuildResult } from './build-validator.js';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ValidationResult } from './types.js';
|
|
2
|
+
export interface ValidateOptions {
|
|
3
|
+
variant?: string;
|
|
4
|
+
runBuild?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function validateInstallation(framework: string, projectDir: string, options?: ValidateOptions): Promise<ValidationResult>;
|