@vizzly-testing/cli 0.3.2 → 0.5.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.
Files changed (60) hide show
  1. package/README.md +50 -28
  2. package/dist/cli.js +34 -30
  3. package/dist/client/index.js +1 -1
  4. package/dist/commands/run.js +38 -11
  5. package/dist/commands/tdd.js +30 -18
  6. package/dist/commands/upload.js +56 -5
  7. package/dist/server/handlers/api-handler.js +83 -0
  8. package/dist/server/handlers/tdd-handler.js +138 -0
  9. package/dist/server/http-server.js +132 -0
  10. package/dist/services/api-service.js +22 -2
  11. package/dist/services/server-manager.js +45 -29
  12. package/dist/services/test-runner.js +66 -69
  13. package/dist/services/uploader.js +11 -4
  14. package/dist/types/commands/run.d.ts +4 -1
  15. package/dist/types/commands/tdd.d.ts +5 -1
  16. package/dist/types/sdk/index.d.ts +6 -6
  17. package/dist/types/server/handlers/api-handler.d.ts +49 -0
  18. package/dist/types/server/handlers/tdd-handler.d.ts +85 -0
  19. package/dist/types/server/http-server.d.ts +5 -0
  20. package/dist/types/services/api-service.d.ts +1 -0
  21. package/dist/types/services/server-manager.d.ts +148 -3
  22. package/dist/types/services/test-runner.d.ts +1 -0
  23. package/dist/types/services/uploader.d.ts +2 -1
  24. package/dist/types/utils/ci-env.d.ts +55 -0
  25. package/dist/types/utils/config-helpers.d.ts +1 -1
  26. package/dist/types/utils/console-ui.d.ts +1 -1
  27. package/dist/types/utils/git.d.ts +12 -0
  28. package/dist/utils/ci-env.js +293 -0
  29. package/dist/utils/console-ui.js +4 -14
  30. package/dist/utils/git.js +38 -0
  31. package/docs/api-reference.md +17 -5
  32. package/docs/getting-started.md +1 -1
  33. package/docs/tdd-mode.md +9 -9
  34. package/docs/test-integration.md +9 -17
  35. package/docs/upload-command.md +7 -0
  36. package/package.json +4 -5
  37. package/dist/screenshot-wrapper.js +0 -68
  38. package/dist/server/index.js +0 -522
  39. package/dist/services/service-utils.js +0 -171
  40. package/dist/types/index.js +0 -153
  41. package/dist/types/screenshot-wrapper.d.ts +0 -27
  42. package/dist/types/server/index.d.ts +0 -38
  43. package/dist/types/services/service-utils.d.ts +0 -45
  44. package/dist/types/types/index.d.ts +0 -373
  45. package/dist/types/utils/diagnostics.d.ts +0 -69
  46. package/dist/types/utils/error-messages.d.ts +0 -42
  47. package/dist/types/utils/framework-detector.d.ts +0 -5
  48. package/dist/types/utils/help.d.ts +0 -11
  49. package/dist/types/utils/image-comparison.d.ts +0 -42
  50. package/dist/types/utils/package.d.ts +0 -1
  51. package/dist/types/utils/project-detection.d.ts +0 -19
  52. package/dist/types/utils/ui-helpers.d.ts +0 -23
  53. package/dist/utils/diagnostics.js +0 -184
  54. package/dist/utils/error-messages.js +0 -34
  55. package/dist/utils/framework-detector.js +0 -40
  56. package/dist/utils/help.js +0 -66
  57. package/dist/utils/image-comparison.js +0 -172
  58. package/dist/utils/package.js +0 -9
  59. package/dist/utils/project-detection.js +0 -145
  60. package/dist/utils/ui-helpers.js +0 -86
@@ -1,373 +0,0 @@
1
- declare const _default: {};
2
- export default _default;
3
- export type VizzlyConfig = {
4
- /**
5
- * - API key for authentication
6
- */
7
- apiKey?: string;
8
- /**
9
- * - API base URL
10
- */
11
- apiUrl?: string;
12
- /**
13
- * - Server configuration
14
- */
15
- server?: ServerConfig;
16
- /**
17
- * - Build configuration
18
- */
19
- build?: BuildConfig;
20
- /**
21
- * - Upload configuration
22
- */
23
- upload?: UploadConfig;
24
- /**
25
- * - Comparison configuration
26
- */
27
- comparison?: ComparisonConfig;
28
- };
29
- export type ServerConfig = {
30
- /**
31
- * - Server port
32
- */
33
- port?: number;
34
- /**
35
- * - Server host
36
- */
37
- host?: string;
38
- /**
39
- * - Use HTTPS
40
- */
41
- https?: boolean;
42
- /**
43
- * - Path to SSL certificate
44
- */
45
- certPath?: string;
46
- /**
47
- * - Path to SSL key
48
- */
49
- keyPath?: string;
50
- /**
51
- * - Screenshot POST endpoint path
52
- */
53
- screenshotPath?: string;
54
- };
55
- export type BuildConfig = {
56
- /**
57
- * - Build name
58
- */
59
- name?: string;
60
- /**
61
- * - Git branch
62
- */
63
- branch?: string;
64
- /**
65
- * - Git commit SHA
66
- */
67
- commit?: string;
68
- /**
69
- * - Commit message
70
- */
71
- message?: string;
72
- /**
73
- * - Environment name
74
- */
75
- environment?: string;
76
- /**
77
- * - Additional metadata
78
- */
79
- metadata?: {
80
- [x: string]: any;
81
- };
82
- };
83
- export type UploadConfig = {
84
- /**
85
- * - Directory containing screenshots
86
- */
87
- screenshotsDir?: string;
88
- /**
89
- * - Upload batch size
90
- */
91
- batchSize?: number;
92
- /**
93
- * - Upload timeout in ms
94
- */
95
- timeout?: number;
96
- /**
97
- * - Number of retries
98
- */
99
- retries?: number;
100
- /**
101
- * - Enable deduplication
102
- */
103
- deduplication?: boolean;
104
- };
105
- export type ComparisonConfig = {
106
- /**
107
- * - Default comparison threshold (0-1)
108
- */
109
- threshold?: number;
110
- /**
111
- * - Ignore antialiasing differences
112
- */
113
- ignoreAntialiasing?: boolean;
114
- /**
115
- * - Ignore color differences
116
- */
117
- ignoreColors?: boolean;
118
- /**
119
- * - Color for diff highlighting
120
- */
121
- diffColor?: string;
122
- };
123
- export type Screenshot = {
124
- /**
125
- * - Screenshot name
126
- */
127
- name: string;
128
- /**
129
- * - Image buffer data
130
- */
131
- image: Buffer;
132
- /**
133
- * - Additional properties
134
- */
135
- properties?: {
136
- [x: string]: any;
137
- };
138
- /**
139
- * - Comparison threshold override
140
- */
141
- threshold?: number;
142
- /**
143
- * - Screenshot group/category
144
- */
145
- group?: string;
146
- /**
147
- * - Screenshot tags
148
- */
149
- tags?: string[];
150
- };
151
- export type UploadOptions = {
152
- /**
153
- * - Directory containing screenshots
154
- */
155
- screenshotsDir: string;
156
- /**
157
- * - Name for this build
158
- */
159
- buildName?: string;
160
- /**
161
- * - Git branch name
162
- */
163
- branch?: string;
164
- /**
165
- * - Git commit SHA
166
- */
167
- commit?: string;
168
- /**
169
- * - Commit message
170
- */
171
- message?: string;
172
- /**
173
- * - Environment name
174
- */
175
- environment?: string;
176
- /**
177
- * - Default comparison threshold
178
- */
179
- threshold?: number;
180
- /**
181
- * - Progress callback
182
- */
183
- onProgress?: ProgressCallback;
184
- };
185
- export type UploadResult = {
186
- /**
187
- * - Whether upload succeeded
188
- */
189
- success: boolean;
190
- /**
191
- * - Build ID if successful
192
- */
193
- buildId?: string;
194
- /**
195
- * - Build URL if available
196
- */
197
- url?: string;
198
- /**
199
- * - Upload statistics
200
- */
201
- stats: UploadStats;
202
- /**
203
- * - Error message if failed
204
- */
205
- error?: string;
206
- };
207
- export type UploadStats = {
208
- /**
209
- * - Total files found
210
- */
211
- total: number;
212
- /**
213
- * - Files uploaded
214
- */
215
- uploaded: number;
216
- /**
217
- * - Files skipped (duplicates)
218
- */
219
- skipped: number;
220
- /**
221
- * - Files failed to upload
222
- */
223
- failed: number;
224
- };
225
- export type ProgressEvent = {
226
- /**
227
- * - Current phase
228
- */
229
- phase: "scanning" | "processing" | "deduplication" | "uploading" | "completed" | "error";
230
- /**
231
- * - Current item being processed
232
- */
233
- current?: number;
234
- /**
235
- * - Total items to process
236
- */
237
- total?: number;
238
- /**
239
- * - Progress message
240
- */
241
- message?: string;
242
- /**
243
- * - Files to upload (deduplication phase)
244
- */
245
- toUpload?: number;
246
- /**
247
- * - Existing files (deduplication phase)
248
- */
249
- existing?: number;
250
- /**
251
- * - Build ID (completed phase)
252
- */
253
- buildId?: string;
254
- /**
255
- * - Build URL (completed phase)
256
- */
257
- url?: string;
258
- };
259
- export type ProgressCallback = (event: ProgressEvent) => void;
260
- export type TDDOptions = {
261
- /**
262
- * - Baseline screenshots directory
263
- */
264
- baselineDir?: string;
265
- /**
266
- * - Current screenshots directory
267
- */
268
- currentDir?: string;
269
- /**
270
- * - Diff output directory
271
- */
272
- diffDir?: string;
273
- /**
274
- * - Comparison threshold
275
- */
276
- threshold?: number;
277
- /**
278
- * - Fail on any difference
279
- */
280
- failOnDifference?: boolean;
281
- /**
282
- * - Update baseline on difference
283
- */
284
- updateBaseline?: boolean;
285
- };
286
- export type ComparisonResult = {
287
- /**
288
- * - Screenshot name
289
- */
290
- name: string;
291
- /**
292
- * - Whether comparison passed
293
- */
294
- passed: boolean;
295
- /**
296
- * - Difference percentage (0-1)
297
- */
298
- difference?: number;
299
- /**
300
- * - Path to diff image
301
- */
302
- diffPath?: string;
303
- /**
304
- * - Error message if comparison failed
305
- */
306
- error?: string;
307
- };
308
- export type BuildInfo = {
309
- /**
310
- * - Build ID
311
- */
312
- id: string;
313
- /**
314
- * - Build name
315
- */
316
- name: string;
317
- /**
318
- * - Build status
319
- */
320
- status: "pending" | "processing" | "completed" | "failed";
321
- /**
322
- * - Git branch
323
- */
324
- branch: string;
325
- /**
326
- * - Git commit SHA
327
- */
328
- commit?: string;
329
- /**
330
- * - Environment name
331
- */
332
- environment: string;
333
- /**
334
- * - Creation timestamp
335
- */
336
- createdAt: Date;
337
- /**
338
- * - Completion timestamp
339
- */
340
- completedAt?: Date;
341
- /**
342
- * - Number of screenshots
343
- */
344
- screenshotCount: number;
345
- /**
346
- * - Additional metadata
347
- */
348
- metadata?: {
349
- [x: string]: any;
350
- };
351
- };
352
- export type CLIOptions = {
353
- /**
354
- * - Enable verbose logging
355
- */
356
- verbose?: boolean;
357
- /**
358
- * - Log level
359
- */
360
- logLevel?: string;
361
- /**
362
- * - Suppress all output
363
- */
364
- quiet?: boolean;
365
- /**
366
- * - Output JSON instead of text
367
- */
368
- json?: boolean;
369
- /**
370
- * - Path to config file
371
- */
372
- config?: string;
373
- };
@@ -1,69 +0,0 @@
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
- };
@@ -1,42 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Detect testing framework from project dependencies
3
- * @returns {Promise<string|null>} Detected framework or null
4
- */
5
- export function detectFramework(): Promise<string | null>;
@@ -1,11 +0,0 @@
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;
@@ -1,42 +0,0 @@
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>;
@@ -1 +0,0 @@
1
- export function getPackageInfo(): Promise<any>;
@@ -1,19 +0,0 @@
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;
@@ -1,23 +0,0 @@
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
- };