@vizzly-testing/cli 0.16.0 → 0.16.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/dist/client/index.js +21 -4
- package/dist/reporter/reporter-bundle.css +1 -1
- package/dist/reporter/reporter-bundle.iife.js +14 -14
- package/dist/sdk/index.js +6 -6
- package/dist/server/handlers/tdd-handler.js +13 -6
- package/dist/services/test-runner.js +0 -8
- package/dist/services/uploader.js +1 -1
- package/dist/types/client.d.ts +88 -0
- package/dist/types/config.d.ts +29 -0
- package/dist/types/index.d.ts +426 -9
- package/dist/types/sdk.d.ts +146 -0
- package/dist/utils/config-helpers.js +2 -2
- package/package.json +24 -7
- package/dist/types/cli.d.ts +0 -2
- package/dist/types/client/index.d.ts +0 -80
- package/dist/types/commands/doctor.d.ts +0 -11
- package/dist/types/commands/finalize.d.ts +0 -13
- package/dist/types/commands/init.d.ts +0 -32
- package/dist/types/commands/login.d.ts +0 -11
- package/dist/types/commands/logout.d.ts +0 -11
- package/dist/types/commands/project.d.ts +0 -28
- package/dist/types/commands/run.d.ts +0 -16
- package/dist/types/commands/status.d.ts +0 -13
- package/dist/types/commands/tdd-daemon.d.ts +0 -24
- package/dist/types/commands/tdd.d.ts +0 -17
- package/dist/types/commands/upload.d.ts +0 -13
- package/dist/types/commands/whoami.d.ts +0 -11
- package/dist/types/errors/vizzly-error.d.ts +0 -75
- package/dist/types/plugin-loader.d.ts +0 -7
- package/dist/types/reporter/src/api/client.d.ts +0 -178
- package/dist/types/reporter/src/components/app-router.d.ts +0 -1
- package/dist/types/reporter/src/components/code-block.d.ts +0 -4
- package/dist/types/reporter/src/components/comparison/comparison-actions.d.ts +0 -5
- package/dist/types/reporter/src/components/comparison/comparison-card.d.ts +0 -7
- package/dist/types/reporter/src/components/comparison/comparison-group.d.ts +0 -10
- package/dist/types/reporter/src/components/comparison/comparison-list.d.ts +0 -6
- package/dist/types/reporter/src/components/comparison/comparison-modes/onion-skin-mode.d.ts +0 -10
- package/dist/types/reporter/src/components/comparison/comparison-modes/overlay-mode.d.ts +0 -11
- package/dist/types/reporter/src/components/comparison/comparison-modes/shared/base-comparison-mode.d.ts +0 -14
- package/dist/types/reporter/src/components/comparison/comparison-modes/shared/image-renderer.d.ts +0 -30
- package/dist/types/reporter/src/components/comparison/comparison-modes/toggle-view.d.ts +0 -8
- package/dist/types/reporter/src/components/comparison/comparison-viewer.d.ts +0 -8
- package/dist/types/reporter/src/components/comparison/fullscreen-viewer.d.ts +0 -13
- package/dist/types/reporter/src/components/comparison/screenshot-display.d.ts +0 -16
- package/dist/types/reporter/src/components/comparison/screenshot-list.d.ts +0 -9
- package/dist/types/reporter/src/components/comparison/variant-selector.d.ts +0 -9
- package/dist/types/reporter/src/components/comparison/view-mode-selector.d.ts +0 -4
- package/dist/types/reporter/src/components/dashboard/dashboard-filters.d.ts +0 -16
- package/dist/types/reporter/src/components/design-system/alert.d.ts +0 -9
- package/dist/types/reporter/src/components/design-system/badge.d.ts +0 -17
- package/dist/types/reporter/src/components/design-system/button.d.ts +0 -19
- package/dist/types/reporter/src/components/design-system/card.d.ts +0 -31
- package/dist/types/reporter/src/components/design-system/empty-state.d.ts +0 -13
- package/dist/types/reporter/src/components/design-system/form-controls.d.ts +0 -44
- package/dist/types/reporter/src/components/design-system/health-ring.d.ts +0 -7
- package/dist/types/reporter/src/components/design-system/index.d.ts +0 -11
- package/dist/types/reporter/src/components/design-system/modal.d.ts +0 -10
- package/dist/types/reporter/src/components/design-system/skeleton.d.ts +0 -19
- package/dist/types/reporter/src/components/design-system/spinner.d.ts +0 -10
- package/dist/types/reporter/src/components/design-system/tabs.d.ts +0 -13
- package/dist/types/reporter/src/components/layout/header.d.ts +0 -5
- package/dist/types/reporter/src/components/layout/index.d.ts +0 -2
- package/dist/types/reporter/src/components/layout/layout.d.ts +0 -6
- package/dist/types/reporter/src/components/ui/smart-image.d.ts +0 -7
- package/dist/types/reporter/src/components/ui/toast.d.ts +0 -4
- package/dist/types/reporter/src/components/views/builds-view.d.ts +0 -1
- package/dist/types/reporter/src/components/views/comparison-detail-view.d.ts +0 -5
- package/dist/types/reporter/src/components/views/comparisons-view.d.ts +0 -5
- package/dist/types/reporter/src/components/views/projects-view.d.ts +0 -1
- package/dist/types/reporter/src/components/views/settings-view.d.ts +0 -1
- package/dist/types/reporter/src/components/views/stats-view.d.ts +0 -1
- package/dist/types/reporter/src/components/waiting-for-screenshots.d.ts +0 -1
- package/dist/types/reporter/src/hooks/queries/use-auth-queries.d.ts +0 -15
- package/dist/types/reporter/src/hooks/queries/use-cloud-queries.d.ts +0 -6
- package/dist/types/reporter/src/hooks/queries/use-config-queries.d.ts +0 -6
- package/dist/types/reporter/src/hooks/queries/use-tdd-queries.d.ts +0 -9
- package/dist/types/reporter/src/hooks/use-comparison-filters.d.ts +0 -20
- package/dist/types/reporter/src/hooks/use-image-loader.d.ts +0 -1
- package/dist/types/reporter/src/lib/query-client.d.ts +0 -2
- package/dist/types/reporter/src/lib/query-keys.d.ts +0 -13
- package/dist/types/reporter/src/main.d.ts +0 -1
- package/dist/types/reporter/src/services/api-client.d.ts +0 -11
- package/dist/types/reporter/src/utils/comparison-helpers.d.ts +0 -16
- package/dist/types/reporter/src/utils/constants.d.ts +0 -37
- package/dist/types/reporter/vite.config.d.ts +0 -2
- package/dist/types/reporter/vite.dev.config.d.ts +0 -2
- package/dist/types/sdk/index.d.ts +0 -110
- package/dist/types/server/handlers/api-handler.d.ts +0 -88
- package/dist/types/server/handlers/tdd-handler.d.ts +0 -162
- package/dist/types/server/http-server.d.ts +0 -6
- package/dist/types/server/middleware/cors.d.ts +0 -11
- package/dist/types/server/middleware/json-parser.d.ts +0 -10
- package/dist/types/server/middleware/response.d.ts +0 -50
- package/dist/types/server/routers/assets.d.ts +0 -6
- package/dist/types/server/routers/auth.d.ts +0 -9
- package/dist/types/server/routers/baseline.d.ts +0 -13
- package/dist/types/server/routers/cloud-proxy.d.ts +0 -11
- package/dist/types/server/routers/config.d.ts +0 -9
- package/dist/types/server/routers/dashboard.d.ts +0 -6
- package/dist/types/server/routers/health.d.ts +0 -11
- package/dist/types/server/routers/projects.d.ts +0 -9
- package/dist/types/server/routers/screenshot.d.ts +0 -11
- package/dist/types/services/api-service.d.ts +0 -121
- package/dist/types/services/auth-service.d.ts +0 -59
- package/dist/types/services/build-manager.d.ts +0 -69
- package/dist/types/services/config-service.d.ts +0 -97
- package/dist/types/services/html-report-generator.d.ts +0 -52
- package/dist/types/services/index.d.ts +0 -7
- package/dist/types/services/project-service.d.ts +0 -105
- package/dist/types/services/report-generator/viewer.d.ts +0 -0
- package/dist/types/services/screenshot-server.d.ts +0 -10
- package/dist/types/services/server-manager.d.ts +0 -269
- package/dist/types/services/static-report-generator.d.ts +0 -25
- package/dist/types/services/tdd-service.d.ts +0 -122
- package/dist/types/services/test-runner.d.ts +0 -31
- package/dist/types/services/uploader.d.ts +0 -36
- package/dist/types/utils/browser.d.ts +0 -6
- package/dist/types/utils/build-history.d.ts +0 -16
- package/dist/types/utils/ci-env.d.ts +0 -55
- package/dist/types/utils/colors.d.ts +0 -12
- package/dist/types/utils/config-helpers.d.ts +0 -6
- package/dist/types/utils/config-loader.d.ts +0 -25
- package/dist/types/utils/config-schema.d.ts +0 -51
- package/dist/types/utils/environment-config.d.ts +0 -59
- package/dist/types/utils/environment.d.ts +0 -36
- package/dist/types/utils/fetch-utils.d.ts +0 -1
- package/dist/types/utils/file-helpers.d.ts +0 -18
- package/dist/types/utils/git.d.ts +0 -56
- package/dist/types/utils/global-config.d.ts +0 -84
- package/dist/types/utils/image-input-detector.d.ts +0 -71
- package/dist/types/utils/output.d.ts +0 -84
- package/dist/types/utils/package-info.d.ts +0 -15
- package/dist/types/utils/security.d.ts +0 -30
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment Configuration Utility
|
|
3
|
-
* Centralized access to environment variables with proper defaults
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Get API token from environment
|
|
7
|
-
* @returns {string|undefined} API token
|
|
8
|
-
*/
|
|
9
|
-
export function getApiToken(): string | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* Get API URL from environment
|
|
12
|
-
* @returns {string} API URL with default
|
|
13
|
-
*/
|
|
14
|
-
export function getApiUrl(): string;
|
|
15
|
-
/**
|
|
16
|
-
* Get log level from environment
|
|
17
|
-
* @returns {string} Log level with default
|
|
18
|
-
*/
|
|
19
|
-
export function getLogLevel(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Get user agent from environment
|
|
22
|
-
* @returns {string|undefined} User agent string
|
|
23
|
-
*/
|
|
24
|
-
export function getUserAgent(): string | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Check if Vizzly is enabled in client
|
|
27
|
-
* @returns {boolean} Whether Vizzly is enabled
|
|
28
|
-
*/
|
|
29
|
-
export function isVizzlyEnabled(): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Get server URL from environment
|
|
32
|
-
* @returns {string|undefined} Server URL
|
|
33
|
-
*/
|
|
34
|
-
export function getServerUrl(): string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Get build ID from environment
|
|
37
|
-
* @returns {string|undefined} Build ID
|
|
38
|
-
*/
|
|
39
|
-
export function getBuildId(): string | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Get parallel ID from environment
|
|
42
|
-
* @returns {string|undefined} Parallel ID
|
|
43
|
-
*/
|
|
44
|
-
export function getParallelId(): string | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Check if TDD mode is enabled
|
|
47
|
-
* @returns {boolean} Whether TDD mode is enabled
|
|
48
|
-
*/
|
|
49
|
-
export function isTddMode(): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Set Vizzly enabled state (for client)
|
|
52
|
-
* @param {boolean} enabled - Whether to enable Vizzly
|
|
53
|
-
*/
|
|
54
|
-
export function setVizzlyEnabled(enabled: boolean): void;
|
|
55
|
-
/**
|
|
56
|
-
* Get all Vizzly environment variables
|
|
57
|
-
* @returns {Object} All environment configuration
|
|
58
|
-
*/
|
|
59
|
-
export function getAllEnvironmentConfig(): any;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment detection utilities for handling CI/interactive environments
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Check if running in a CI environment
|
|
6
|
-
* Based on common CI environment variables
|
|
7
|
-
* @returns {boolean} True if running in CI
|
|
8
|
-
*/
|
|
9
|
-
export function isCI(): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Check if stdout supports interactive features
|
|
12
|
-
* @returns {boolean} True if interactive features are supported
|
|
13
|
-
*/
|
|
14
|
-
export function isInteractiveTerminal(): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Determine if interactive mode should be enabled
|
|
17
|
-
* Takes into account CI detection, TTY support, and explicit flags
|
|
18
|
-
* @param {Object} options
|
|
19
|
-
* @param {boolean} [options.noInteractive] - Explicit flag to disable interactive mode
|
|
20
|
-
* @param {boolean} [options.interactive] - Explicit flag to force interactive mode
|
|
21
|
-
* @returns {boolean} True if interactive mode should be enabled
|
|
22
|
-
*/
|
|
23
|
-
export function shouldUseInteractiveMode(options?: {
|
|
24
|
-
noInteractive?: boolean;
|
|
25
|
-
interactive?: boolean;
|
|
26
|
-
}): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Get environment type for logging/debugging
|
|
29
|
-
* @returns {string} Environment type description
|
|
30
|
-
*/
|
|
31
|
-
export function getEnvironmentType(): string;
|
|
32
|
-
/**
|
|
33
|
-
* Get detailed environment info for debugging
|
|
34
|
-
* @returns {Object} Environment details
|
|
35
|
-
*/
|
|
36
|
-
export function getEnvironmentDetails(): any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function fetchWithTimeout(url: any, opts?: {}, ms?: number): Promise<Response>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve image buffer from file path or return buffer as-is
|
|
3
|
-
* Handles both Buffer inputs and file path strings, with proper validation and error handling
|
|
4
|
-
*
|
|
5
|
-
* @param {Buffer|string} imageBufferOrPath - Image data as Buffer or file path
|
|
6
|
-
* @param {string} contextName - Context for error messages (e.g., 'screenshot', 'compare')
|
|
7
|
-
* @returns {Buffer} The image buffer
|
|
8
|
-
* @throws {VizzlyError} When file not found, unreadable, or invalid input type
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // With Buffer
|
|
12
|
-
* const buffer = resolveImageBuffer(myBuffer, 'screenshot');
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* // With file path
|
|
16
|
-
* const buffer = resolveImageBuffer('./my-image.png', 'screenshot');
|
|
17
|
-
*/
|
|
18
|
-
export function resolveImageBuffer(imageBufferOrPath: Buffer | string, contextName: string): Buffer;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export function getCommonAncestor(commit1: any, commit2: any, cwd?: any): Promise<any>;
|
|
2
|
-
export function getCurrentCommitSha(cwd?: any): Promise<any>;
|
|
3
|
-
export function getCurrentBranch(cwd?: any): Promise<any>;
|
|
4
|
-
export function getDefaultBranch(cwd?: any): Promise<any>;
|
|
5
|
-
export function generateBuildName(): string;
|
|
6
|
-
/**
|
|
7
|
-
* Get the current commit message
|
|
8
|
-
* @param {string} cwd - Working directory
|
|
9
|
-
* @returns {Promise<string|null>} Commit message or null if not available
|
|
10
|
-
*/
|
|
11
|
-
export function getCommitMessage(cwd?: string): Promise<string | null>;
|
|
12
|
-
/**
|
|
13
|
-
* Detect commit message with override and environment variable support
|
|
14
|
-
* @param {string} override - Commit message override from CLI
|
|
15
|
-
* @param {string} cwd - Working directory
|
|
16
|
-
* @returns {Promise<string|null>} Commit message or null if not available
|
|
17
|
-
*/
|
|
18
|
-
export function detectCommitMessage(override?: string, cwd?: string): Promise<string | null>;
|
|
19
|
-
/**
|
|
20
|
-
* Check if the working directory is a git repository
|
|
21
|
-
* @param {string} cwd - Working directory
|
|
22
|
-
* @returns {Promise<boolean>}
|
|
23
|
-
*/
|
|
24
|
-
export function isGitRepository(cwd?: string): Promise<boolean>;
|
|
25
|
-
/**
|
|
26
|
-
* Get git status information
|
|
27
|
-
* @param {string} cwd - Working directory
|
|
28
|
-
* @returns {Promise<Object|null>} Git status info or null
|
|
29
|
-
*/
|
|
30
|
-
export function getGitStatus(cwd?: string): Promise<any | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Detect branch with override support
|
|
33
|
-
* @param {string} override - Branch override from CLI
|
|
34
|
-
* @param {string} cwd - Working directory
|
|
35
|
-
* @returns {Promise<string>}
|
|
36
|
-
*/
|
|
37
|
-
export function detectBranch(override?: string, cwd?: string): Promise<string>;
|
|
38
|
-
/**
|
|
39
|
-
* Detect commit SHA with override support
|
|
40
|
-
* @param {string} override - Commit override from CLI
|
|
41
|
-
* @param {string} cwd - Working directory
|
|
42
|
-
* @returns {Promise<string|null>}
|
|
43
|
-
*/
|
|
44
|
-
export function detectCommit(override?: string, cwd?: string): Promise<string | null>;
|
|
45
|
-
/**
|
|
46
|
-
* Generate build name with git information
|
|
47
|
-
* @param {string} override - Build name override from CLI
|
|
48
|
-
* @param {string} cwd - Working directory
|
|
49
|
-
* @returns {Promise<string>}
|
|
50
|
-
*/
|
|
51
|
-
export function generateBuildNameWithGit(override?: string, cwd?: string): Promise<string>;
|
|
52
|
-
/**
|
|
53
|
-
* Detect pull request number from CI environment
|
|
54
|
-
* @returns {number|null} Pull request number or null if not in PR context
|
|
55
|
-
*/
|
|
56
|
-
export function detectPullRequestNumber(): number | null;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the path to the global Vizzly directory
|
|
3
|
-
* @returns {string} Path to ~/.vizzly
|
|
4
|
-
*/
|
|
5
|
-
export function getGlobalConfigDir(): string;
|
|
6
|
-
/**
|
|
7
|
-
* Get the path to the global config file
|
|
8
|
-
* @returns {string} Path to ~/.vizzly/config.json
|
|
9
|
-
*/
|
|
10
|
-
export function getGlobalConfigPath(): string;
|
|
11
|
-
/**
|
|
12
|
-
* Load the global configuration
|
|
13
|
-
* @returns {Promise<Object>} Global config object
|
|
14
|
-
*/
|
|
15
|
-
export function loadGlobalConfig(): Promise<any>;
|
|
16
|
-
/**
|
|
17
|
-
* Save the global configuration
|
|
18
|
-
* @param {Object} config - Configuration object to save
|
|
19
|
-
* @returns {Promise<void>}
|
|
20
|
-
*/
|
|
21
|
-
export function saveGlobalConfig(config: any): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Clear all global configuration
|
|
24
|
-
* @returns {Promise<void>}
|
|
25
|
-
*/
|
|
26
|
-
export function clearGlobalConfig(): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Get authentication tokens from global config
|
|
29
|
-
* @returns {Promise<Object|null>} Token object with accessToken, refreshToken, expiresAt, user, or null if not found
|
|
30
|
-
*/
|
|
31
|
-
export function getAuthTokens(): Promise<any | null>;
|
|
32
|
-
/**
|
|
33
|
-
* Save authentication tokens to global config
|
|
34
|
-
* @param {Object} auth - Auth object with accessToken, refreshToken, expiresAt, user
|
|
35
|
-
* @returns {Promise<void>}
|
|
36
|
-
*/
|
|
37
|
-
export function saveAuthTokens(auth: any): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Clear authentication tokens from global config
|
|
40
|
-
* @returns {Promise<void>}
|
|
41
|
-
*/
|
|
42
|
-
export function clearAuthTokens(): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Check if authentication tokens exist and are not expired
|
|
45
|
-
* @returns {Promise<boolean>} True if valid tokens exist
|
|
46
|
-
*/
|
|
47
|
-
export function hasValidTokens(): Promise<boolean>;
|
|
48
|
-
/**
|
|
49
|
-
* Get the access token from global config if available
|
|
50
|
-
* @returns {Promise<string|null>} Access token or null
|
|
51
|
-
*/
|
|
52
|
-
export function getAccessToken(): Promise<string | null>;
|
|
53
|
-
/**
|
|
54
|
-
* Get project mapping for a directory
|
|
55
|
-
* Walks up the directory tree to find the closest mapping
|
|
56
|
-
* @param {string} directoryPath - Absolute path to project directory
|
|
57
|
-
* @returns {Promise<Object|null>} Project data or null
|
|
58
|
-
*/
|
|
59
|
-
export function getProjectMapping(directoryPath: string): Promise<any | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Save project mapping for a directory
|
|
62
|
-
* @param {string} directoryPath - Absolute path to project directory
|
|
63
|
-
* @param {Object} projectData - Project configuration
|
|
64
|
-
* @param {string} projectData.token - Project API token (vzt_...)
|
|
65
|
-
* @param {string} projectData.projectSlug - Project slug
|
|
66
|
-
* @param {string} projectData.organizationSlug - Organization slug
|
|
67
|
-
* @param {string} projectData.projectName - Project name
|
|
68
|
-
*/
|
|
69
|
-
export function saveProjectMapping(directoryPath: string, projectData: {
|
|
70
|
-
token: string;
|
|
71
|
-
projectSlug: string;
|
|
72
|
-
organizationSlug: string;
|
|
73
|
-
projectName: string;
|
|
74
|
-
}): Promise<void>;
|
|
75
|
-
/**
|
|
76
|
-
* Get all project mappings
|
|
77
|
-
* @returns {Promise<Object>} Map of directory paths to project data
|
|
78
|
-
*/
|
|
79
|
-
export function getProjectMappings(): Promise<any>;
|
|
80
|
-
/**
|
|
81
|
-
* Delete project mapping for a directory
|
|
82
|
-
* @param {string} directoryPath - Absolute path to project directory
|
|
83
|
-
*/
|
|
84
|
-
export function deleteProjectMapping(directoryPath: string): Promise<void>;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module image-input-detector
|
|
3
|
-
* @description Utilities for detecting whether a string is a base64 image or a file path
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Check if a string is valid base64 encoded data
|
|
7
|
-
*
|
|
8
|
-
* Base64 strings consist only of:
|
|
9
|
-
* - A-Z, a-z, 0-9, +, /
|
|
10
|
-
* - Optional padding with = at the end
|
|
11
|
-
* - Must be in groups of 4 characters (with optional 2-3 char group at end with padding)
|
|
12
|
-
*
|
|
13
|
-
* @param {string} str - String to check
|
|
14
|
-
* @returns {boolean} True if the string appears to be valid base64
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* isBase64('ZmFrZS1wbmctZGF0YQ==') // true
|
|
18
|
-
* isBase64('./screenshot.png') // false
|
|
19
|
-
* isBase64('/absolute/path.png') // false
|
|
20
|
-
*/
|
|
21
|
-
export function isBase64(str: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Check if a string looks like a file path
|
|
24
|
-
*
|
|
25
|
-
* Detects common file path patterns across platforms:
|
|
26
|
-
* - Relative paths: ./file.png, ../file.png, subdirectory/file.png
|
|
27
|
-
* - Absolute Unix paths: /absolute/path/file.png
|
|
28
|
-
* - Absolute Windows paths: C:\path\file.png, C:/path/file.png
|
|
29
|
-
* - File URIs: file:///path/to/file.png
|
|
30
|
-
* - Paths with common image extensions
|
|
31
|
-
*
|
|
32
|
-
* Note: This is heuristic-based and doesn't check file existence
|
|
33
|
-
*
|
|
34
|
-
* @param {string} str - String to check
|
|
35
|
-
* @returns {boolean} True if the string looks like a file path
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* looksLikeFilePath('./screenshot.png') // true
|
|
39
|
-
* looksLikeFilePath('/abs/path/file.png') // true
|
|
40
|
-
* looksLikeFilePath('C:\\Windows\\file.png') // true
|
|
41
|
-
* looksLikeFilePath('ZmFrZS1wbmctZGF0YQ==') // false
|
|
42
|
-
*/
|
|
43
|
-
export function looksLikeFilePath(str: string): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Detect the type of image input
|
|
46
|
-
*
|
|
47
|
-
* Determines whether a string input is:
|
|
48
|
-
* - 'base64': Base64 encoded image data
|
|
49
|
-
* - 'file-path': A file path (relative or absolute)
|
|
50
|
-
* - 'unknown': Cannot determine (ambiguous or invalid)
|
|
51
|
-
*
|
|
52
|
-
* Strategy:
|
|
53
|
-
* 1. First check if it's valid base64 (can contain / which might look like paths)
|
|
54
|
-
* 2. Then check if it looks like a file path (more specific patterns)
|
|
55
|
-
* 3. Otherwise return 'unknown'
|
|
56
|
-
*
|
|
57
|
-
* This order prevents base64 strings (which can contain /) from being
|
|
58
|
-
* misidentified as file paths. Base64 validation is stricter and should
|
|
59
|
-
* be checked first.
|
|
60
|
-
*
|
|
61
|
-
* @param {string} str - String to detect
|
|
62
|
-
* @returns {'base64' | 'file-path' | 'unknown'} Detected input type
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* detectImageInputType('./screenshot.png') // 'file-path'
|
|
66
|
-
* detectImageInputType('ZmFrZS1wbmctZGF0YQ==') // 'base64'
|
|
67
|
-
* detectImageInputType('data:image/png;base64,iVBOR...') // 'base64'
|
|
68
|
-
* detectImageInputType('C:\\path\\image.png') // 'file-path'
|
|
69
|
-
* detectImageInputType('invalid!!!') // 'unknown'
|
|
70
|
-
*/
|
|
71
|
-
export function detectImageInputType(str: string): "base64" | "file-path" | "unknown";
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configure output settings
|
|
3
|
-
* Call this once at CLI startup with global options
|
|
4
|
-
*/
|
|
5
|
-
export function configure(options?: {}): void;
|
|
6
|
-
/**
|
|
7
|
-
* Show command header (e.g., "vizzly · tdd · local")
|
|
8
|
-
* Only shows once per command execution
|
|
9
|
-
*/
|
|
10
|
-
export function header(command: any, mode?: any): void;
|
|
11
|
-
/**
|
|
12
|
-
* Get current colors instance (for custom formatting)
|
|
13
|
-
*/
|
|
14
|
-
export function getColors(): {
|
|
15
|
-
success: any;
|
|
16
|
-
error: any;
|
|
17
|
-
warning: any;
|
|
18
|
-
info: any;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Show a success message
|
|
22
|
-
*/
|
|
23
|
-
export function success(message: any, data?: {}): void;
|
|
24
|
-
/**
|
|
25
|
-
* Show final result summary (e.g., "✓ 5 screenshots · 234ms")
|
|
26
|
-
*/
|
|
27
|
-
export function result(message: any): void;
|
|
28
|
-
/**
|
|
29
|
-
* Show an info message
|
|
30
|
-
*/
|
|
31
|
-
export function info(message: any, data?: {}): void;
|
|
32
|
-
/**
|
|
33
|
-
* Show a warning message (goes to stderr)
|
|
34
|
-
*/
|
|
35
|
-
export function warn(message: any, data?: {}): void;
|
|
36
|
-
/**
|
|
37
|
-
* Show an error message (goes to stderr)
|
|
38
|
-
* Does NOT exit - caller decides whether to exit
|
|
39
|
-
*/
|
|
40
|
-
export function error(message: any, err?: any, data?: {}): void;
|
|
41
|
-
/**
|
|
42
|
-
* Print a blank line for spacing
|
|
43
|
-
*/
|
|
44
|
-
export function blank(): void;
|
|
45
|
-
/**
|
|
46
|
-
* Print raw text without any formatting
|
|
47
|
-
*/
|
|
48
|
-
export function print(text: any): void;
|
|
49
|
-
/**
|
|
50
|
-
* Print raw text to stderr
|
|
51
|
-
*/
|
|
52
|
-
export function printErr(text: any): void;
|
|
53
|
-
/**
|
|
54
|
-
* Output structured data
|
|
55
|
-
*/
|
|
56
|
-
export function data(obj: any): void;
|
|
57
|
-
/**
|
|
58
|
-
* Start a spinner with message
|
|
59
|
-
*/
|
|
60
|
-
export function startSpinner(message: any): void;
|
|
61
|
-
/**
|
|
62
|
-
* Update spinner message
|
|
63
|
-
*/
|
|
64
|
-
export function updateSpinner(message: any, current?: number, total?: number): void;
|
|
65
|
-
/**
|
|
66
|
-
* Stop the spinner
|
|
67
|
-
*/
|
|
68
|
-
export function stopSpinner(): void;
|
|
69
|
-
/**
|
|
70
|
-
* Show progress update
|
|
71
|
-
*/
|
|
72
|
-
export function progress(message: any, current?: number, total?: number): void;
|
|
73
|
-
/**
|
|
74
|
-
* Log debug message with component prefix (only shown in verbose mode)
|
|
75
|
-
*
|
|
76
|
-
* @param {string} component - Component name (e.g., 'server', 'config', 'build')
|
|
77
|
-
* @param {string} message - Debug message
|
|
78
|
-
* @param {Object} data - Optional data object to display inline
|
|
79
|
-
*/
|
|
80
|
-
export function debug(component: string, message: string, data?: any): void;
|
|
81
|
-
/**
|
|
82
|
-
* Clean up (stop spinner, flush logs)
|
|
83
|
-
*/
|
|
84
|
-
export function cleanup(): void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get package.json information
|
|
3
|
-
* @returns {Object} Package.json data
|
|
4
|
-
*/
|
|
5
|
-
export function getPackageInfo(): any;
|
|
6
|
-
/**
|
|
7
|
-
* Get package version
|
|
8
|
-
* @returns {string} Package version
|
|
9
|
-
*/
|
|
10
|
-
export function getPackageVersion(): string;
|
|
11
|
-
/**
|
|
12
|
-
* Get package name
|
|
13
|
-
* @returns {string} Package name
|
|
14
|
-
*/
|
|
15
|
-
export function getPackageName(): string;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sanitizes a screenshot name to prevent path traversal and ensure safe file naming
|
|
3
|
-
* @param {string} name - Original screenshot name
|
|
4
|
-
* @param {number} maxLength - Maximum allowed length (default: 255)
|
|
5
|
-
* @param {boolean} allowSlashes - Whether to allow forward slashes (for browser version strings)
|
|
6
|
-
* @returns {string} Sanitized screenshot name
|
|
7
|
-
*/
|
|
8
|
-
export function sanitizeScreenshotName(name: string, maxLength?: number, allowSlashes?: boolean): string;
|
|
9
|
-
/**
|
|
10
|
-
* Validates that a path stays within the allowed working directory bounds
|
|
11
|
-
* @param {string} targetPath - Path to validate
|
|
12
|
-
* @param {string} workingDir - Working directory that serves as the security boundary
|
|
13
|
-
* @returns {string} Resolved and normalized path if valid
|
|
14
|
-
* @throws {Error} If path is invalid or outside bounds
|
|
15
|
-
*/
|
|
16
|
-
export function validatePathSecurity(targetPath: string, workingDir: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Safely constructs a path within the working directory
|
|
19
|
-
* @param {string} workingDir - Base working directory
|
|
20
|
-
* @param {...string} pathSegments - Path segments to join
|
|
21
|
-
* @returns {string} Safely constructed path
|
|
22
|
-
* @throws {Error} If resulting path would be outside working directory
|
|
23
|
-
*/
|
|
24
|
-
export function safePath(workingDir: string, ...pathSegments: string[]): string;
|
|
25
|
-
/**
|
|
26
|
-
* Validates screenshot properties object for safe values
|
|
27
|
-
* @param {Object} properties - Properties to validate
|
|
28
|
-
* @returns {Object} Validated properties object
|
|
29
|
-
*/
|
|
30
|
-
export function validateScreenshotProperties(properties?: any): any;
|