@vizzly-testing/cli 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/LICENSE +21 -0
- package/README.md +363 -0
- package/bin/vizzly.js +3 -0
- package/dist/cli.js +104 -0
- package/dist/client/index.js +237 -0
- package/dist/commands/doctor.js +158 -0
- package/dist/commands/init.js +102 -0
- package/dist/commands/run.js +224 -0
- package/dist/commands/status.js +164 -0
- package/dist/commands/tdd.js +212 -0
- package/dist/commands/upload.js +181 -0
- package/dist/container/index.js +184 -0
- package/dist/errors/vizzly-error.js +149 -0
- package/dist/index.js +31 -0
- package/dist/screenshot-wrapper.js +68 -0
- package/dist/sdk/index.js +364 -0
- package/dist/server/index.js +522 -0
- package/dist/services/api-service.js +215 -0
- package/dist/services/base-service.js +154 -0
- package/dist/services/build-manager.js +214 -0
- package/dist/services/screenshot-server.js +96 -0
- package/dist/services/server-manager.js +61 -0
- package/dist/services/service-utils.js +171 -0
- package/dist/services/tdd-service.js +444 -0
- package/dist/services/test-runner.js +210 -0
- package/dist/services/uploader.js +413 -0
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/client/index.d.ts +76 -0
- package/dist/types/commands/doctor.d.ts +11 -0
- package/dist/types/commands/init.d.ts +14 -0
- package/dist/types/commands/run.d.ts +13 -0
- package/dist/types/commands/status.d.ts +13 -0
- package/dist/types/commands/tdd.d.ts +13 -0
- package/dist/types/commands/upload.d.ts +13 -0
- package/dist/types/container/index.d.ts +61 -0
- package/dist/types/errors/vizzly-error.d.ts +75 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +153 -0
- package/dist/types/screenshot-wrapper.d.ts +27 -0
- package/dist/types/sdk/index.d.ts +108 -0
- package/dist/types/server/index.d.ts +38 -0
- package/dist/types/services/api-service.d.ts +77 -0
- package/dist/types/services/base-service.d.ts +72 -0
- package/dist/types/services/build-manager.d.ts +68 -0
- package/dist/types/services/screenshot-server.d.ts +10 -0
- package/dist/types/services/server-manager.d.ts +8 -0
- package/dist/types/services/service-utils.d.ts +45 -0
- package/dist/types/services/tdd-service.d.ts +55 -0
- package/dist/types/services/test-runner.d.ts +25 -0
- package/dist/types/services/uploader.d.ts +34 -0
- package/dist/types/types/index.d.ts +373 -0
- package/dist/types/utils/colors.d.ts +12 -0
- package/dist/types/utils/config-helpers.d.ts +6 -0
- package/dist/types/utils/config-loader.d.ts +22 -0
- package/dist/types/utils/console-ui.d.ts +61 -0
- package/dist/types/utils/diagnostics.d.ts +69 -0
- package/dist/types/utils/environment-config.d.ts +54 -0
- package/dist/types/utils/environment.d.ts +36 -0
- package/dist/types/utils/error-messages.d.ts +42 -0
- package/dist/types/utils/fetch-utils.d.ts +1 -0
- package/dist/types/utils/framework-detector.d.ts +5 -0
- package/dist/types/utils/git.d.ts +44 -0
- package/dist/types/utils/help.d.ts +11 -0
- package/dist/types/utils/image-comparison.d.ts +42 -0
- package/dist/types/utils/logger-factory.d.ts +26 -0
- package/dist/types/utils/logger.d.ts +79 -0
- package/dist/types/utils/package-info.d.ts +15 -0
- package/dist/types/utils/package.d.ts +1 -0
- package/dist/types/utils/project-detection.d.ts +19 -0
- package/dist/types/utils/ui-helpers.d.ts +23 -0
- package/dist/utils/colors.js +66 -0
- package/dist/utils/config-helpers.js +8 -0
- package/dist/utils/config-loader.js +120 -0
- package/dist/utils/console-ui.js +226 -0
- package/dist/utils/diagnostics.js +184 -0
- package/dist/utils/environment-config.js +93 -0
- package/dist/utils/environment.js +109 -0
- package/dist/utils/error-messages.js +34 -0
- package/dist/utils/fetch-utils.js +9 -0
- package/dist/utils/framework-detector.js +40 -0
- package/dist/utils/git.js +226 -0
- package/dist/utils/help.js +66 -0
- package/dist/utils/image-comparison.js +172 -0
- package/dist/utils/logger-factory.js +76 -0
- package/dist/utils/logger.js +231 -0
- package/dist/utils/package-info.js +38 -0
- package/dist/utils/package.js +9 -0
- package/dist/utils/project-detection.js +145 -0
- package/dist/utils/ui-helpers.js +86 -0
- package/package.json +103 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define Vizzly configuration with type hints
|
|
3
|
+
* @param {import('../types/index.js').VizzlyConfig} config
|
|
4
|
+
* @returns {import('../types/index.js').VizzlyConfig}
|
|
5
|
+
*/
|
|
6
|
+
export function defineConfig(config: import("../types/index.js").VizzlyConfig): import("../types/index.js").VizzlyConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function loadConfig(configPath?: any, cliOverrides?: {}): Promise<{
|
|
2
|
+
server: {
|
|
3
|
+
port: number;
|
|
4
|
+
timeout: number;
|
|
5
|
+
screenshotPath: string;
|
|
6
|
+
};
|
|
7
|
+
build: {
|
|
8
|
+
name: string;
|
|
9
|
+
environment: string;
|
|
10
|
+
};
|
|
11
|
+
upload: {
|
|
12
|
+
screenshotsDir: string;
|
|
13
|
+
batchSize: number;
|
|
14
|
+
timeout: number;
|
|
15
|
+
};
|
|
16
|
+
comparison: {
|
|
17
|
+
threshold: number;
|
|
18
|
+
};
|
|
19
|
+
apiKey: string;
|
|
20
|
+
apiUrl: string;
|
|
21
|
+
}>;
|
|
22
|
+
export function getScreenshotPaths(config: any): string[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple console UI utilities for CLI output
|
|
3
|
+
*/
|
|
4
|
+
export class ConsoleUI {
|
|
5
|
+
constructor(options?: {});
|
|
6
|
+
colors: {
|
|
7
|
+
success: any;
|
|
8
|
+
error: any;
|
|
9
|
+
warning: any;
|
|
10
|
+
info: any;
|
|
11
|
+
};
|
|
12
|
+
json: any;
|
|
13
|
+
verbose: any;
|
|
14
|
+
spinner: NodeJS.Timeout;
|
|
15
|
+
lastLine: string;
|
|
16
|
+
/**
|
|
17
|
+
* Show a success message
|
|
18
|
+
*/
|
|
19
|
+
success(message: any, data?: {}): void;
|
|
20
|
+
/**
|
|
21
|
+
* Show an error message and exit
|
|
22
|
+
*/
|
|
23
|
+
error(message: any, error?: {}, exitCode?: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* Show an info message
|
|
26
|
+
*/
|
|
27
|
+
info(message: any, data?: {}): void;
|
|
28
|
+
/**
|
|
29
|
+
* Show a warning message
|
|
30
|
+
*/
|
|
31
|
+
warning(message: any, data?: {}): void;
|
|
32
|
+
/**
|
|
33
|
+
* Show progress with spinner
|
|
34
|
+
*/
|
|
35
|
+
progress(message: any, current?: number, total?: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Update a status line in place (for dynamic updates)
|
|
38
|
+
*/
|
|
39
|
+
updateStatus(line: any, message: any): void;
|
|
40
|
+
/**
|
|
41
|
+
* Output structured data
|
|
42
|
+
*/
|
|
43
|
+
data(data: any): void;
|
|
44
|
+
/**
|
|
45
|
+
* Start a spinner with message
|
|
46
|
+
*/
|
|
47
|
+
startSpinner(message: any): void;
|
|
48
|
+
/**
|
|
49
|
+
* Update spinner message and progress
|
|
50
|
+
*/
|
|
51
|
+
updateSpinner(message: any, current?: number, total?: number): void;
|
|
52
|
+
currentMessage: string;
|
|
53
|
+
/**
|
|
54
|
+
* Stop the spinner
|
|
55
|
+
*/
|
|
56
|
+
stopSpinner(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Clean up on exit
|
|
59
|
+
*/
|
|
60
|
+
cleanup(): void;
|
|
61
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if required dependencies are available
|
|
3
|
+
*/
|
|
4
|
+
export function checkDependencies(): Promise<{
|
|
5
|
+
all_ok: boolean;
|
|
6
|
+
details: {
|
|
7
|
+
node: {
|
|
8
|
+
available: boolean;
|
|
9
|
+
version: string;
|
|
10
|
+
supported: boolean;
|
|
11
|
+
message: string;
|
|
12
|
+
error?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
available: boolean;
|
|
15
|
+
error: any;
|
|
16
|
+
version?: undefined;
|
|
17
|
+
supported?: undefined;
|
|
18
|
+
message?: undefined;
|
|
19
|
+
};
|
|
20
|
+
npm: any;
|
|
21
|
+
git: any;
|
|
22
|
+
odiff: {
|
|
23
|
+
available: boolean;
|
|
24
|
+
path: any;
|
|
25
|
+
message: string;
|
|
26
|
+
error?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
available: boolean;
|
|
29
|
+
error: any;
|
|
30
|
+
message: string;
|
|
31
|
+
path?: undefined;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Check API connectivity
|
|
37
|
+
*/
|
|
38
|
+
export function checkApiConnectivity(config: any): Promise<{
|
|
39
|
+
url: any;
|
|
40
|
+
has_token: boolean;
|
|
41
|
+
reachable: boolean;
|
|
42
|
+
authenticated: boolean;
|
|
43
|
+
} | {
|
|
44
|
+
error: any;
|
|
45
|
+
reachable: boolean;
|
|
46
|
+
authenticated: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Check terminal capabilities
|
|
50
|
+
*/
|
|
51
|
+
export function checkTerminalCapabilities(): {
|
|
52
|
+
stdout_is_tty: boolean;
|
|
53
|
+
stdin_is_tty: boolean;
|
|
54
|
+
supports_color: boolean;
|
|
55
|
+
terminal_type: string;
|
|
56
|
+
columns: number;
|
|
57
|
+
rows: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Get system information
|
|
61
|
+
*/
|
|
62
|
+
export function getSystemInfo(): {
|
|
63
|
+
platform: NodeJS.Platform;
|
|
64
|
+
arch: NodeJS.Architecture;
|
|
65
|
+
node_version: string;
|
|
66
|
+
memory_usage: NodeJS.MemoryUsage;
|
|
67
|
+
uptime: number;
|
|
68
|
+
working_directory: string;
|
|
69
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
* Check if TDD mode is enabled
|
|
42
|
+
* @returns {boolean} Whether TDD mode is enabled
|
|
43
|
+
*/
|
|
44
|
+
export function isTddMode(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Set Vizzly enabled state (for client)
|
|
47
|
+
* @param {boolean} enabled - Whether to enable Vizzly
|
|
48
|
+
*/
|
|
49
|
+
export function setVizzlyEnabled(enabled: boolean): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get all Vizzly environment variables
|
|
52
|
+
* @returns {Object} All environment configuration
|
|
53
|
+
*/
|
|
54
|
+
export function getAllEnvironmentConfig(): any;
|
|
@@ -0,0 +1,36 @@
|
|
|
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;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function formatError(errorCode: any, context?: {}): {
|
|
2
|
+
message: any;
|
|
3
|
+
hint?: undefined;
|
|
4
|
+
docs?: undefined;
|
|
5
|
+
context?: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
message: any;
|
|
8
|
+
hint: any;
|
|
9
|
+
docs: any;
|
|
10
|
+
context: {};
|
|
11
|
+
};
|
|
12
|
+
export namespace ERROR_MESSAGES {
|
|
13
|
+
namespace NO_API_TOKEN {
|
|
14
|
+
let message: string;
|
|
15
|
+
let hint: string;
|
|
16
|
+
let docs: string;
|
|
17
|
+
}
|
|
18
|
+
namespace BUILD_CREATION_FAILED {
|
|
19
|
+
let message_1: string;
|
|
20
|
+
export { message_1 as message };
|
|
21
|
+
let hint_1: string;
|
|
22
|
+
export { hint_1 as hint };
|
|
23
|
+
let docs_1: string;
|
|
24
|
+
export { docs_1 as docs };
|
|
25
|
+
}
|
|
26
|
+
namespace NO_SCREENSHOTS_FOUND {
|
|
27
|
+
let message_2: string;
|
|
28
|
+
export { message_2 as message };
|
|
29
|
+
let hint_2: string;
|
|
30
|
+
export { hint_2 as hint };
|
|
31
|
+
let docs_2: string;
|
|
32
|
+
export { docs_2 as docs };
|
|
33
|
+
}
|
|
34
|
+
namespace PORT_IN_USE {
|
|
35
|
+
let message_3: string;
|
|
36
|
+
export { message_3 as message };
|
|
37
|
+
let hint_3: string;
|
|
38
|
+
export { hint_3 as hint };
|
|
39
|
+
let docs_3: string;
|
|
40
|
+
export { docs_3 as docs };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function fetchWithTimeout(url: any, opts?: {}, ms?: number): Promise<Response>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export function getCommonAncestor(commit1: any, commit2: any, cwd?: string): Promise<string>;
|
|
2
|
+
export function getCurrentCommitSha(cwd?: string): Promise<string>;
|
|
3
|
+
export function getCurrentBranch(cwd?: string): Promise<string>;
|
|
4
|
+
export function getDefaultBranch(cwd?: string): Promise<string>;
|
|
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
|
+
* Check if the working directory is a git repository
|
|
14
|
+
* @param {string} cwd - Working directory
|
|
15
|
+
* @returns {Promise<boolean>}
|
|
16
|
+
*/
|
|
17
|
+
export function isGitRepository(cwd?: string): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Get git status information
|
|
20
|
+
* @param {string} cwd - Working directory
|
|
21
|
+
* @returns {Promise<Object|null>} Git status info or null
|
|
22
|
+
*/
|
|
23
|
+
export function getGitStatus(cwd?: string): Promise<any | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Detect branch with override support
|
|
26
|
+
* @param {string} override - Branch override from CLI
|
|
27
|
+
* @param {string} cwd - Working directory
|
|
28
|
+
* @returns {Promise<string>}
|
|
29
|
+
*/
|
|
30
|
+
export function detectBranch(override?: string, cwd?: string): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Detect commit SHA with override support
|
|
33
|
+
* @param {string} override - Commit override from CLI
|
|
34
|
+
* @param {string} cwd - Working directory
|
|
35
|
+
* @returns {Promise<string|null>}
|
|
36
|
+
*/
|
|
37
|
+
export function detectCommit(override?: string, cwd?: string): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Generate build name with git information
|
|
40
|
+
* @param {string} override - Build name override from CLI
|
|
41
|
+
* @param {string} cwd - Working directory
|
|
42
|
+
* @returns {Promise<string>}
|
|
43
|
+
*/
|
|
44
|
+
export function generateBuildNameWithGit(override?: string, cwd?: string): Promise<string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display help information for the CLI
|
|
3
|
+
* @param {Object} globalOptions - Global CLI options
|
|
4
|
+
*/
|
|
5
|
+
export function showHelp(globalOptions?: any): void;
|
|
6
|
+
/**
|
|
7
|
+
* Show error for unknown command
|
|
8
|
+
* @param {string} command - Unknown command name
|
|
9
|
+
* @param {Object} globalOptions - Global CLI options
|
|
10
|
+
*/
|
|
11
|
+
export function showUnknownCommand(command: string, globalOptions?: any): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare two images and return the difference
|
|
3
|
+
* @param {Buffer} imageBuffer1 - First image buffer
|
|
4
|
+
* @param {Buffer} imageBuffer2 - Second image buffer
|
|
5
|
+
* @param {Object} options - Comparison options
|
|
6
|
+
* @param {number} options.threshold - Matching threshold (0-1)
|
|
7
|
+
* @param {boolean} options.ignoreAntialiasing - Ignore antialiasing
|
|
8
|
+
* @param {boolean} options.ignoreColors - Ignore colors (not supported by odiff)
|
|
9
|
+
* @param {Array} options.ignoreRegions - Regions to ignore in comparison
|
|
10
|
+
* @returns {Promise<Object>} Comparison result
|
|
11
|
+
*/
|
|
12
|
+
export function compareImages(imageBuffer1: Buffer, imageBuffer2: Buffer, options?: {
|
|
13
|
+
threshold: number;
|
|
14
|
+
ignoreAntialiasing: boolean;
|
|
15
|
+
ignoreColors: boolean;
|
|
16
|
+
ignoreRegions: any[];
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Check if buffer is a valid PNG image
|
|
20
|
+
* @param {Buffer} buffer - Image buffer
|
|
21
|
+
* @returns {boolean} True if valid PNG
|
|
22
|
+
*/
|
|
23
|
+
export function isValidPNG(buffer: Buffer): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get image dimensions from PNG buffer
|
|
26
|
+
* @param {Buffer} buffer - Image buffer
|
|
27
|
+
* @returns {Object|null} Dimensions or null if invalid
|
|
28
|
+
*/
|
|
29
|
+
export function getImageDimensions(buffer: Buffer): any | null;
|
|
30
|
+
/**
|
|
31
|
+
* Compare images with ignore regions
|
|
32
|
+
* @param {Buffer} imageBuffer1 - First image buffer
|
|
33
|
+
* @param {Buffer} imageBuffer2 - Second image buffer
|
|
34
|
+
* @param {Array<{x: number, y: number, width: number, height: number}>} ignoreRegions - Regions to ignore
|
|
35
|
+
* @returns {Promise<Object>} Comparison result
|
|
36
|
+
*/
|
|
37
|
+
export function compareImagesWithIgnoreRegions(imageBuffer1: Buffer, imageBuffer2: Buffer, ignoreRegions?: Array<{
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
}>): Promise<any>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a service logger with consistent naming and options
|
|
3
|
+
* @param {string} serviceName - Name of the service (e.g., 'TDD', 'SERVER', 'API')
|
|
4
|
+
* @param {Object} options - Logger options
|
|
5
|
+
* @returns {Logger} Configured logger instance
|
|
6
|
+
*/
|
|
7
|
+
export function createServiceLogger(serviceName: string, options?: any): Logger;
|
|
8
|
+
/**
|
|
9
|
+
* Create a component logger for CLI commands and utilities
|
|
10
|
+
* @param {string} componentName - Name of the component
|
|
11
|
+
* @param {Object} options - Logger options
|
|
12
|
+
* @returns {Logger} Configured logger instance
|
|
13
|
+
*/
|
|
14
|
+
export function createComponentLogger(componentName: string, options?: any): Logger;
|
|
15
|
+
/**
|
|
16
|
+
* Create a basic logger with standard defaults
|
|
17
|
+
* @param {Object} options - Logger options
|
|
18
|
+
* @returns {Logger} Configured logger instance
|
|
19
|
+
*/
|
|
20
|
+
export function createStandardLogger(options?: any): Logger;
|
|
21
|
+
/**
|
|
22
|
+
* Create a logger for uploader service with specific defaults
|
|
23
|
+
* @param {Object} options - Logger options
|
|
24
|
+
* @returns {Logger} Configured logger instance
|
|
25
|
+
*/
|
|
26
|
+
export function createUploaderLogger(options?: any): Logger;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create default logger instance
|
|
3
|
+
*/
|
|
4
|
+
export function createLogger(options?: {}): Logger;
|
|
5
|
+
/**
|
|
6
|
+
* Structured logger with multiple output targets and log levels
|
|
7
|
+
*/
|
|
8
|
+
export class Logger {
|
|
9
|
+
constructor(options?: {});
|
|
10
|
+
level: any;
|
|
11
|
+
logFile: any;
|
|
12
|
+
verbose: any;
|
|
13
|
+
silent: any;
|
|
14
|
+
colors: boolean;
|
|
15
|
+
levels: {
|
|
16
|
+
error: number;
|
|
17
|
+
warn: number;
|
|
18
|
+
info: number;
|
|
19
|
+
debug: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Initialize log file with session header
|
|
23
|
+
*/
|
|
24
|
+
initLogFile(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Check if message should be logged at current level
|
|
27
|
+
*/
|
|
28
|
+
shouldLog(level: any): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Log a message with specified level
|
|
31
|
+
*/
|
|
32
|
+
log(level: any, message: any, data?: {}): void;
|
|
33
|
+
/**
|
|
34
|
+
* Output formatted message to console
|
|
35
|
+
*/
|
|
36
|
+
outputToConsole(level: any, message: any, data: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get colored prefix for log level
|
|
39
|
+
*/
|
|
40
|
+
getColoredPrefix(level: any): any;
|
|
41
|
+
/**
|
|
42
|
+
* Convenience methods
|
|
43
|
+
*/
|
|
44
|
+
error(message: any, data?: {}): void;
|
|
45
|
+
warn(message: any, data?: {}): void;
|
|
46
|
+
info(message: any, data?: {}): void;
|
|
47
|
+
debug(message: any, data?: {}): void;
|
|
48
|
+
/**
|
|
49
|
+
* Log progress updates
|
|
50
|
+
*/
|
|
51
|
+
progress(stage: any, message: any, data?: {}): void;
|
|
52
|
+
/**
|
|
53
|
+
* Log command execution
|
|
54
|
+
*/
|
|
55
|
+
command(command: any, data?: {}): void;
|
|
56
|
+
/**
|
|
57
|
+
* Log performance metrics
|
|
58
|
+
*/
|
|
59
|
+
perf(operation: any, duration: any, data?: {}): void;
|
|
60
|
+
/**
|
|
61
|
+
* Create child logger with additional context
|
|
62
|
+
*/
|
|
63
|
+
child(context?: {}): ChildLogger;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Child logger that inherits from parent with additional context
|
|
67
|
+
*/
|
|
68
|
+
declare class ChildLogger {
|
|
69
|
+
constructor(parent: any, context: any);
|
|
70
|
+
parent: any;
|
|
71
|
+
context: any;
|
|
72
|
+
log(level: any, message: any, data?: {}): void;
|
|
73
|
+
error(message: any, data?: {}): void;
|
|
74
|
+
warn(message: any, data?: {}): void;
|
|
75
|
+
info(message: any, data?: {}): void;
|
|
76
|
+
debug(message: any, data?: {}): void;
|
|
77
|
+
progress(stage: any, message: any, data?: {}): void;
|
|
78
|
+
}
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function getPackageInfo(): Promise<any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect project type and framework
|
|
3
|
+
* @param {string} directory - Directory to analyze
|
|
4
|
+
* @returns {Promise<Object>} Project information
|
|
5
|
+
*/
|
|
6
|
+
export function detectProjectType(directory?: string): Promise<any>;
|
|
7
|
+
/**
|
|
8
|
+
* Get suggested test command for framework
|
|
9
|
+
* @param {string} framework - Framework name
|
|
10
|
+
* @param {Object} packageJson - Package.json content
|
|
11
|
+
* @returns {string} Suggested test command
|
|
12
|
+
*/
|
|
13
|
+
export function getSuggestedTestCommand(framework: string, packageJson: any): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get suggested screenshots directory for framework
|
|
16
|
+
* @param {string} framework - Framework name
|
|
17
|
+
* @returns {string} Screenshots directory
|
|
18
|
+
*/
|
|
19
|
+
export function getSuggestedScreenshotsDir(framework: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color and styling utilities for Ink components
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Check if colors should be used
|
|
6
|
+
*/
|
|
7
|
+
export function shouldUseColors(flags?: {}): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Get color for text based on type and color support
|
|
10
|
+
*/
|
|
11
|
+
export function getColor(type: any, flags?: {}): any;
|
|
12
|
+
/**
|
|
13
|
+
* Get status icon with fallback for no-color mode
|
|
14
|
+
*/
|
|
15
|
+
export function getStatusIcon(status: any, flags?: {}): any;
|
|
16
|
+
/**
|
|
17
|
+
* Responsive layout helper
|
|
18
|
+
*/
|
|
19
|
+
export function getLayout(columns?: number): {
|
|
20
|
+
type: string;
|
|
21
|
+
showDetails: boolean;
|
|
22
|
+
maxWidth: number;
|
|
23
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Zero-dependency color helper using raw ANSI codes.
|
|
2
|
+
// Detects terminal color support and emits codes only when enabled.
|
|
3
|
+
|
|
4
|
+
function supportsColorDefault() {
|
|
5
|
+
// Respect NO_COLOR: https://no-color.org/
|
|
6
|
+
if ('NO_COLOR' in process.env) return false;
|
|
7
|
+
|
|
8
|
+
// Respect FORCE_COLOR if set to a truthy value (except '0')
|
|
9
|
+
if ('FORCE_COLOR' in process.env) {
|
|
10
|
+
const v = process.env.FORCE_COLOR;
|
|
11
|
+
if (v && v !== '0') return true;
|
|
12
|
+
if (v === '0') return false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// If stdout is not a TTY, assume no color
|
|
16
|
+
if (!process.stdout || !process.stdout.isTTY) return false;
|
|
17
|
+
|
|
18
|
+
// Prefer getColorDepth when available
|
|
19
|
+
try {
|
|
20
|
+
const depth = typeof process.stdout.getColorDepth === 'function' ? process.stdout.getColorDepth() : 1;
|
|
21
|
+
return depth && depth > 1;
|
|
22
|
+
} catch {
|
|
23
|
+
// Fallback heuristic
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function styleFn(open, close, enabled) {
|
|
28
|
+
return (input = '') => {
|
|
29
|
+
const str = String(input);
|
|
30
|
+
if (!enabled) return str;
|
|
31
|
+
return open + str + close;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function createColors(options = {}) {
|
|
35
|
+
const enabled = options.useColor !== undefined ? !!options.useColor : supportsColorDefault();
|
|
36
|
+
const codes = {
|
|
37
|
+
reset: ['\x1b[0m', ''],
|
|
38
|
+
bold: ['\x1b[1m', '\x1b[22m'],
|
|
39
|
+
dim: ['\x1b[2m', '\x1b[22m'],
|
|
40
|
+
italic: ['\x1b[3m', '\x1b[23m'],
|
|
41
|
+
underline: ['\x1b[4m', '\x1b[24m'],
|
|
42
|
+
strikethrough: ['\x1b[9m', '\x1b[29m'],
|
|
43
|
+
red: ['\x1b[31m', '\x1b[39m'],
|
|
44
|
+
green: ['\x1b[32m', '\x1b[39m'],
|
|
45
|
+
yellow: ['\x1b[33m', '\x1b[39m'],
|
|
46
|
+
blue: ['\x1b[34m', '\x1b[39m'],
|
|
47
|
+
magenta: ['\x1b[35m', '\x1b[39m'],
|
|
48
|
+
cyan: ['\x1b[36m', '\x1b[39m'],
|
|
49
|
+
white: ['\x1b[37m', '\x1b[39m'],
|
|
50
|
+
gray: ['\x1b[90m', '\x1b[39m']
|
|
51
|
+
};
|
|
52
|
+
const api = {};
|
|
53
|
+
for (const [name, [open, close]] of Object.entries(codes)) {
|
|
54
|
+
api[name] = styleFn(open, close || '\x1b[0m', enabled);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Semantic aliases
|
|
58
|
+
api.success = api.green;
|
|
59
|
+
api.error = api.red;
|
|
60
|
+
api.warning = api.yellow;
|
|
61
|
+
api.info = api.blue;
|
|
62
|
+
return api;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Default export with auto-detected color support
|
|
66
|
+
export const colors = createColors();
|