@cleaver/breakcheck-core 0.1.0 → 0.2.1

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 (59) hide show
  1. package/README.md +15 -9
  2. package/dist/api/index.d.ts +24 -0
  3. package/dist/api/index.js +6 -6
  4. package/dist/api/index.js.map +1 -1
  5. package/dist/core/compare/classes/ComparisonRepository.d.ts +25 -0
  6. package/dist/core/compare/classes/ComparisonRepository.js +1 -1
  7. package/dist/core/compare/classes/ComparisonRepository.js.map +1 -1
  8. package/dist/core/compare/index.d.ts +14 -0
  9. package/dist/core/compare/index.js +1 -1
  10. package/dist/core/compare/index.js.map +1 -1
  11. package/dist/core/crawler/implementations/cheerio.d.ts +3 -0
  12. package/dist/core/crawler/implementations/playwright.d.ts +3 -0
  13. package/dist/core/crawler/index.d.ts +10 -0
  14. package/dist/core/crawler/index.js +3 -3
  15. package/dist/core/crawler/index.js.map +1 -1
  16. package/dist/core/rules/RulesDsl.d.ts +2 -0
  17. package/dist/core/rules/RulesDsl.js +9 -12
  18. package/dist/core/rules/RulesDsl.js.map +1 -1
  19. package/dist/core/rules/RulesEngine.d.ts +8 -0
  20. package/dist/core/rules/RulesEngine.js +5 -19
  21. package/dist/core/rules/RulesEngine.js.map +1 -1
  22. package/dist/core/snapshot/classes/LoadedSnapshot.d.ts +12 -0
  23. package/dist/core/snapshot/classes/LoadedSnapshot.js +1 -1
  24. package/dist/core/snapshot/classes/LoadedSnapshot.js.map +1 -1
  25. package/dist/core/snapshot/classes/SnapshotRepository.d.ts +43 -0
  26. package/dist/core/snapshot/classes/SnapshotRepository.js +2 -2
  27. package/dist/core/snapshot/classes/SnapshotRepository.js.map +1 -1
  28. package/dist/core/snapshot/index.d.ts +9 -0
  29. package/dist/core/snapshot/index.js +4 -4
  30. package/dist/core/snapshot/index.js.map +1 -1
  31. package/dist/core/view/index.d.ts +2 -0
  32. package/dist/core/view/index.handlers.d.ts +3 -0
  33. package/dist/core/view/index.handlers.js +1 -1
  34. package/dist/core/view/index.handlers.js.map +1 -1
  35. package/dist/core/view/index.js +3 -16
  36. package/dist/core/view/index.js.map +1 -1
  37. package/dist/index.d.ts +13 -14
  38. package/dist/index.js +10 -11
  39. package/dist/index.js.map +1 -1
  40. package/dist/lib/logger.d.ts +8 -0
  41. package/dist/lib/logger.js +1 -1
  42. package/dist/lib/logger.js.map +1 -1
  43. package/dist/lib/root.d.ts +7 -0
  44. package/dist/types/api.d.ts +173 -0
  45. package/dist/types/compare.d.ts +55 -0
  46. package/dist/types/crawler.d.ts +20 -0
  47. package/dist/types/rules.d.ts +61 -0
  48. package/dist/types/snapshot.d.ts +31 -0
  49. package/package.json +7 -1
  50. package/dist/__tests__/compare/index.test.js +0 -322
  51. package/dist/__tests__/compare/index.test.js.map +0 -1
  52. package/dist/__tests__/rules/RulesDsl.test.js +0 -190
  53. package/dist/__tests__/rules/RulesDsl.test.js.map +0 -1
  54. package/dist/__tests__/rules/RulesEngine.test.js +0 -142
  55. package/dist/__tests__/rules/RulesEngine.test.js.map +0 -1
  56. package/dist/__tests__/snapshot/index.test.js +0 -238
  57. package/dist/__tests__/snapshot/index.test.js.map +0 -1
  58. package/dist/__tests__/view/index.test.js +0 -102
  59. package/dist/__tests__/view/index.test.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/snapshot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAsB,EACtB,kBAAsC;IAEtC,MAAM,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MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QAExC,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,MAAM,CAAC,IAAI;YACvB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS;YACT,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE;gBACR,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,UAAU,EAAE,QAAQ;aACrB;YACD,WAAW;SACZ,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,EAAE,MAAM,CAAC,OAAO;YACnB,OAAO,EACL,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB;SACpE,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE,MAAM,CAAC,IAAI;YACvB,OAAO,EACL,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB;YACnE,MAAM;SACP,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import http from "http";
2
+ export declare function startViewServer(comparisonName: string, port?: number): Promise<http.Server>;
@@ -0,0 +1,3 @@
1
+ import { RequestHandler } from "express";
2
+ export declare const createIndexHandler: (comparisonDir: string) => RequestHandler;
3
+ export declare const createDiffHandler: (comparisonDir: string) => RequestHandler;
@@ -1,7 +1,7 @@
1
1
  import fs from "fs/promises";
2
2
  import path from "path";
3
3
  import { gunzip } from "zlib";
4
- import { logger } from "../../lib/logger";
4
+ import { logger } from "../../lib/logger.js";
5
5
  export const createIndexHandler = (comparisonDir) => {
6
6
  return async (req, res) => {
7
7
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"index.handlers.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gBACd,OAAO;gBACP,QAAQ;aACT,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,yBAAyB,CAAC,CAAC;YACxD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAClD,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import express from "express";
2
2
  import path from "path";
3
3
  import { fileURLToPath } from "url";
4
- import { logger } from "../../lib/logger";
5
- import { findRootDir } from "../../lib/root";
6
- import { createDiffHandler, createIndexHandler } from "./index.handlers";
4
+ import { logger } from "../../lib/logger.js";
5
+ import { findRootDir } from "../../lib/root.js";
6
+ import { createDiffHandler, createIndexHandler } from "./index.handlers.js";
7
7
  const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = path.dirname(__filename);
9
9
  export async function startViewServer(comparisonName, port = 8080) {
@@ -34,17 +34,4 @@ export async function startViewServer(comparisonName, port = 8080) {
34
34
  server.on('error', startupErrorHandler);
35
35
  });
36
36
  }
37
- export async function startCliViewServer(comparisonName, port) {
38
- const server = await startViewServer(comparisonName, port);
39
- logger.info("Press Ctrl+C to stop the server");
40
- const shutdown = () => {
41
- logger.info("\nGracefully shutting down. Please wait...");
42
- server.close(() => {
43
- logger.info("✅ Server has been shut down.");
44
- process.exit(0);
45
- });
46
- };
47
- process.on("SIGINT", shutdown);
48
- process.on("SIGTERM", shutdown);
49
- }
50
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/view/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,MAA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D,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;YACnC,8DAA8D;YAC9D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;YACpD,MAAM,CAAC,IAAI,CAAC,8CAA8C,IAAI,EAAE,CAAC,CAAC;YAClE,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,8CAA8C;QAC9C,MAAM,mBAAmB,GAAG,CAAC,GAA0B,EAAE,EAAE;YACzD,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC9B,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,IAAI,qBAAqB,CAAC,CAAC,CAAC;YACvD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,14 +1,13 @@
1
- export * from "./api/index";
2
- export { createSnapshotFromConfig, listSnapshots, runComparison } from "./api/index";
3
- export * from "./core/view";
4
- export { startCliViewServer } from "./core/view";
5
- export * from "./lib/logger";
6
- export { createLogger, logger } from "./lib/logger";
7
- export * from "./types/api";
8
- export type { ComparisonConfig, SnapshotConfig, SnapshotResult } from "./types/api";
9
- export * from "./types/compare";
10
- export * from "./types/crawler";
11
- export type { CrawlError } from "./types/crawler";
12
- export * from "./types/rules";
13
- export * from "./types/snapshot";
14
- export type { SnapshotSummary } from "./types/snapshot";
1
+ export * from "./api/index.js";
2
+ export { createSnapshotFromConfig, listSnapshots, runComparison } from "./api/index.js";
3
+ export * from "./core/view/index.js";
4
+ export * from "./lib/logger.js";
5
+ export { createLogger, logger } from "./lib/logger.js";
6
+ export * from "./types/api.js";
7
+ export type { ComparisonConfig, SnapshotConfig, SnapshotResult } from "./types/api.js";
8
+ export * from "./types/compare.js";
9
+ export * from "./types/crawler.js";
10
+ export type { CrawlError } from "./types/crawler.js";
11
+ export * from "./types/rules.js";
12
+ export * from "./types/snapshot.js";
13
+ export type { SnapshotSummary } from "./types/snapshot.js";
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
1
- export * from "./api/index";
1
+ export * from "./api/index.js";
2
2
  // Explicit exports for CLI and other consumers
3
- export { createSnapshotFromConfig, listSnapshots, runComparison } from "./api/index";
4
- export * from "./core/view";
5
- export { startCliViewServer } from "./core/view";
6
- export * from "./lib/logger";
7
- export { createLogger, logger } from "./lib/logger";
8
- export * from "./types/api";
9
- export * from "./types/compare";
10
- export * from "./types/crawler";
11
- export * from "./types/rules";
12
- export * from "./types/snapshot";
3
+ export { createSnapshotFromConfig, listSnapshots, runComparison } from "./api/index.js";
4
+ export * from "./core/view/index.js";
5
+ export * from "./lib/logger.js";
6
+ export { createLogger, logger } from "./lib/logger.js";
7
+ export * from "./types/api.js";
8
+ export * from "./types/compare.js";
9
+ export * from "./types/crawler.js";
10
+ export * from "./types/rules.js";
11
+ export * from "./types/snapshot.js";
13
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,+CAA+C;AAC/C,OAAO,EACH,wBAAwB,EACxB,aAAa,EACb,aAAa,EAChB,MAAM,aAAa,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpD,cAAc,aAAa,CAAC;AAM5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,+CAA+C;AAC/C,OAAO,EACH,wBAAwB,EACxB,aAAa,EACb,aAAa,EAChB,MAAM,gBAAgB,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACvD,cAAc,gBAAgB,CAAC;AAM/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,8 @@
1
+ type LogLevel = "fatal" | "error" | "warn" | "info" | "debug" | "trace";
2
+ export interface LoggerConfig {
3
+ useJsonLogs?: boolean;
4
+ level?: LogLevel;
5
+ }
6
+ export declare function createLogger(config?: LoggerConfig): import("pino").Logger<never, boolean>;
7
+ export declare const logger: import("pino").Logger<never, boolean>;
8
+ export {};
@@ -1,4 +1,4 @@
1
- import pino from "pino";
1
+ import { pino } from "pino";
2
2
  // Determine the log level from the environment variable, defaulting to 'info'
3
3
  const logLevel = process.env.LOG_LEVEL || "info";
4
4
  // Create a logger with the specified configuration
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB,8EAA8E;AAC9E,MAAM,QAAQ,GAAc,OAAO,CAAC,GAAG,CAAC,SAAsB,IAAI,MAAM,CAAC;AAQzE,mDAAmD;AACnD,MAAM,UAAU,YAAY,CAAC,SAAuB,EAAE;IACpD,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,KAAK,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;IAEzD,gDAAgD;IAChD,MAAM,SAAS,GAAG,WAAW;QAC3B,CAAC,CAAC,SAAS,CAAC,4BAA4B;QACxC,CAAC,CAAC;YACE,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI;gBACd,aAAa,EAAE,cAAc;gBAC7B,MAAM,EAAE,cAAc;aACvB;SACF,CAAC;IAEN,OAAO,IAAI,CAAC;QACV,KAAK;QACL,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED,yEAAyE;AACzE,yEAAyE;AACzE,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK5B,8EAA8E;AAC9E,MAAM,QAAQ,GAAc,OAAO,CAAC,GAAG,CAAC,SAAsB,IAAI,MAAM,CAAC;AAQzE,mDAAmD;AACnD,MAAM,UAAU,YAAY,CAAC,SAAuB,EAAE;IACpD,MAAM,EAAE,WAAW,GAAG,KAAK,EAAE,KAAK,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC;IAEzD,gDAAgD;IAChD,MAAM,SAAS,GAAG,WAAW;QAC3B,CAAC,CAAC,SAAS,CAAC,4BAA4B;QACxC,CAAC,CAAC;YACE,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI;gBACd,aAAa,EAAE,cAAc;gBAC7B,MAAM,EAAE,cAAc;aACvB;SACF,CAAC;IAEN,OAAO,IAAI,CAAC;QACV,KAAK;QACL,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED,yEAAyE;AACzE,yEAAyE;AACzE,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Finds the root directory of the project by looking for a package.json file
3
+ * that contains a "workspaces" configuration.
4
+ *
5
+ * @returns The absolute path to the root directory
6
+ */
7
+ export declare function findRootDir(): Promise<string>;
@@ -0,0 +1,173 @@
1
+ /** Types for API users. */
2
+ import { CrawlError } from "./crawler.js";
3
+ import { Ruleset } from "./rules.js";
4
+ export type CrawlerType = "cheerio" | "playwright";
5
+ /**
6
+ * Configuration for the crawler behavior.
7
+ * Used both internally by the crawler and externally via the API.
8
+ */
9
+ export interface CrawlerConfig {
10
+ /** Base URL to start crawling from */
11
+ baseUrl: string;
12
+ /** Maximum depth to crawl from the base URL */
13
+ maxDepth?: number;
14
+ /** Maximum number of requests to make */
15
+ maxRequests?: number;
16
+ /** Maximum number of concurrent requests */
17
+ maxConcurrency?: number;
18
+ /** URL patterns to include in the crawl */
19
+ includePatterns?: string[];
20
+ /** URL patterns to exclude from the crawl */
21
+ excludePatterns?: string[];
22
+ /** User agent string to use for requests */
23
+ userAgent?: string;
24
+ /** Type of crawler to use (cheerio or playwright) */
25
+ crawlerType: CrawlerType;
26
+ }
27
+ /**
28
+ * Configuration for creating a snapshot
29
+ */
30
+ export interface SnapshotConfig {
31
+ /** Base URL to start crawling from */
32
+ baseUrl: string;
33
+ /** Name/identifier for this snapshot */
34
+ name: string;
35
+ /** Crawler configuration to use */
36
+ crawlSettings: CrawlerConfig;
37
+ /** Optional path to generate a URL list file */
38
+ urlListPath?: string;
39
+ }
40
+ interface SnapshotJobBase {
41
+ snapshotId: string;
42
+ }
43
+ /**
44
+ * Snapshot job is pending
45
+ */
46
+ export interface SnapshotJobPending extends SnapshotJobBase {
47
+ status: "pending";
48
+ message?: string;
49
+ }
50
+ /**
51
+ * Snapshot job is processing
52
+ */
53
+ export interface SnapshotJobProcessing extends SnapshotJobBase {
54
+ status: "processing";
55
+ message?: string;
56
+ progress?: {
57
+ pagesCrawled?: number;
58
+ };
59
+ }
60
+ /**
61
+ * Snapshot job is successful
62
+ */
63
+ export interface SnapshotJobSuccess extends SnapshotJobBase {
64
+ status: "success";
65
+ timestamp: string;
66
+ baseUrl: string;
67
+ pageCount: number;
68
+ errors: Array<CrawlError>;
69
+ metadata: {
70
+ crawlSettings: CrawlerConfig;
71
+ durationMs: number;
72
+ };
73
+ /** Path to the URL list file */
74
+ urlListPath?: string;
75
+ /** List of URLs crawled */
76
+ urlList?: string[];
77
+ }
78
+ /**
79
+ * Snapshot job failed
80
+ */
81
+ export interface SnapshotJobFailed extends SnapshotJobBase {
82
+ status: "failed";
83
+ message: string;
84
+ errors: Array<{
85
+ statusCode?: number;
86
+ message: string;
87
+ }>;
88
+ }
89
+ export type SnapshotJobStatusResponse = SnapshotJobPending | SnapshotJobProcessing | SnapshotJobSuccess | SnapshotJobFailed;
90
+ /**
91
+ * Result of a snapshot creation operation
92
+ */
93
+ export type SnapshotResult = SnapshotJobSuccess | SnapshotJobFailed;
94
+ type RulesetName = string;
95
+ /**
96
+ * Configuration for running a comparison
97
+ */
98
+ export interface ComparisonConfig {
99
+ /** Name/identifier of the "before" snapshot */
100
+ beforeSnapshotId: string;
101
+ /** Name/identifier of the "after" snapshot */
102
+ afterSnapshotId: string;
103
+ /** Name/identifier of the comparison */
104
+ comparisonName: string;
105
+ /** Optional directory containing rules.breakcheck, or an inline ruleset. Relative directories resolve from process.cwd(). */
106
+ ruleset?: RulesetName | Ruleset;
107
+ /** Optional list of URLs to compare */
108
+ urls?: string[];
109
+ }
110
+ /**
111
+ * Response payload when a comparison job is successfully initiated.
112
+ */
113
+ export interface ComparisonJobInfo {
114
+ comparisonId: string;
115
+ status: "pending" | "processing";
116
+ message: string;
117
+ statusUrl: string;
118
+ resultsPath: string;
119
+ }
120
+ /**
121
+ * Progress details for a running comparison job.
122
+ */
123
+ export interface ComparisonProgress {
124
+ processedPages: number;
125
+ totalPages: number;
126
+ currentStage?: string;
127
+ }
128
+ /**
129
+ * Represents the status of a comparison job.
130
+ */
131
+ export interface ComparisonJobStatus {
132
+ comparisonId: string;
133
+ status: "pending" | "processing" | "completed" | "failed";
134
+ progress?: ComparisonProgress;
135
+ startTime?: string;
136
+ endTime?: string;
137
+ message?: string;
138
+ summaryUrl?: string;
139
+ pageDiffsUrl?: string;
140
+ resultsPath: string;
141
+ }
142
+ /**
143
+ * Details of an error that occurred during the comparison process itself.
144
+ */
145
+ export interface ComparisonProcessError {
146
+ pageUrl?: string;
147
+ stage?: string;
148
+ message: string;
149
+ details?: any;
150
+ }
151
+ /**
152
+ * Summary of a completed comparison job.
153
+ */
154
+ export interface ComparisonSummary {
155
+ comparisonId: string;
156
+ status: "completed" | "failed";
157
+ overallResult: "pass" | "fail";
158
+ beforeSnapshotId: string;
159
+ afterSnapshotId: string;
160
+ /** Identifier of the ruleset or description of rules used (e.g., 'custom_rules_provided', rulesetName, or filePath). */
161
+ rulesUsedIdentifier?: string;
162
+ timestamp: string;
163
+ durationMs: number;
164
+ totalPagesCompared: number;
165
+ pagesWithDifferences: number;
166
+ pagesWithErrors: number;
167
+ newUrls: string[];
168
+ removedUrls: string[];
169
+ comparisonProcessErrors: ComparisonProcessError[];
170
+ summaryFilePath: string;
171
+ resultsPath: string;
172
+ }
173
+ export {};
@@ -0,0 +1,55 @@
1
+ /** Internal types for diffs / comparisons used by other modules */
2
+ import { Change } from "diff";
3
+ /**
4
+ * Represents a single difference found between two page snapshots
5
+ * This is equivalent to the Change type from the diff package
6
+ */
7
+ export type LineDiff = Change;
8
+ /**
9
+ * Represents the complete diff result for a single page
10
+ */
11
+ export interface PageDiff {
12
+ /** URL of the page being compared */
13
+ url: string;
14
+ /** List of differences found */
15
+ differences: LineDiff[];
16
+ /** The patch of the diff */
17
+ patch: string;
18
+ /** Whether the page had any differences */
19
+ hasDifferences: boolean;
20
+ }
21
+ /**
22
+ * Result of comparing two snapshots
23
+ */
24
+ export interface SnapshotDiff {
25
+ /** List of page differences found */
26
+ pageDiffs: PageDiff[];
27
+ /** URLs that exist in the after snapshot but not in the before snapshot */
28
+ newUrls: string[];
29
+ /** URLs that exist in the before snapshot but not in the after snapshot */
30
+ removedUrls: string[];
31
+ }
32
+ /**
33
+ * Metadata stored in metadata.json for a comparison.
34
+ */
35
+ export interface ComparisonMetadata {
36
+ beforeSnapshotId: string;
37
+ afterSnapshotId: string;
38
+ rulesUsedIdentifier?: string;
39
+ }
40
+ /**
41
+ * The structure of the main index for a comparison result.
42
+ */
43
+ export interface ComparisonIndex {
44
+ urls: {
45
+ [url: string]: {
46
+ filename: string;
47
+ hasDifferences: boolean;
48
+ };
49
+ };
50
+ metadata: ComparisonMetadata & {
51
+ timestamp: string;
52
+ totalPages: number;
53
+ pagesWithDifferences: number;
54
+ };
55
+ }
@@ -0,0 +1,20 @@
1
+ /** Internal types for crawling used by other modules. */
2
+ import { CheerioCrawler, PlaywrightCrawler } from "crawlee";
3
+ export interface PageSnapshot {
4
+ url: string;
5
+ finalUrl: string;
6
+ content: string;
7
+ statusCode: number;
8
+ headers: Record<string, string>;
9
+ title?: string;
10
+ }
11
+ export interface CrawlResult {
12
+ datasetName: string;
13
+ errors: CrawlError[];
14
+ }
15
+ export interface CrawlError {
16
+ url: string;
17
+ message: string;
18
+ statusCode?: number;
19
+ }
20
+ export type CrawlerInstance = CheerioCrawler | PlaywrightCrawler;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Type definitions for Breakcheck JSON Rules
3
+ * Based on the JSON Rules Specification
4
+ */
5
+ /**
6
+ * The type of action to perform
7
+ */
8
+ export type ActionType = "include" | "exclude" | "remove_attr" | "rewrite_attr" | "rewrite_content";
9
+ /**
10
+ * Base interface for action modifiers
11
+ */
12
+ interface BaseActionModifiers {
13
+ content_regex?: string;
14
+ }
15
+ /**
16
+ * Modifiers for remove_attr action
17
+ */
18
+ interface RemoveAttrModifiers extends BaseActionModifiers {
19
+ attr: string;
20
+ }
21
+ /**
22
+ * Modifiers for rewrite_attr action
23
+ */
24
+ interface RewriteAttrModifiers extends BaseActionModifiers {
25
+ attr: string;
26
+ regex: string;
27
+ replace: string;
28
+ }
29
+ /**
30
+ * Modifiers for rewrite_content action
31
+ */
32
+ interface RewriteContentModifiers extends BaseActionModifiers {
33
+ regex: string;
34
+ replace: string;
35
+ }
36
+ /**
37
+ * Union type for all possible action modifiers
38
+ */
39
+ export type ActionModifiers = RemoveAttrModifiers | RewriteAttrModifiers | RewriteContentModifiers | BaseActionModifiers;
40
+ /**
41
+ * Represents a single action to be performed
42
+ */
43
+ export interface Action {
44
+ action: ActionType;
45
+ modifiers?: ActionModifiers;
46
+ }
47
+ /**
48
+ * Represents a single rule with a selector and its actions
49
+ */
50
+ export interface Rule {
51
+ selector: string;
52
+ actions: Action[];
53
+ }
54
+ /**
55
+ * The root structure of the JSON rules document
56
+ */
57
+ export interface Ruleset {
58
+ name: string;
59
+ rules: Rule[];
60
+ }
61
+ export {};
@@ -0,0 +1,31 @@
1
+ /** Internal types for snapshot saves / indexing used by other modules. */
2
+ export interface SnapshotIndex {
3
+ urls: {
4
+ [url: string]: {
5
+ filename: string;
6
+ statusCode: number;
7
+ finalUrl?: string;
8
+ pageTitle?: string;
9
+ };
10
+ };
11
+ metadata: {
12
+ baseUrl: string;
13
+ timestamp: string;
14
+ totalPages: number;
15
+ };
16
+ }
17
+ export interface SnapshotMetadata {
18
+ baseUrl: string;
19
+ timestamp: string;
20
+ crawlSettings: any;
21
+ }
22
+ export interface SnapshotSummary {
23
+ name: string;
24
+ date: string;
25
+ pageCount: number;
26
+ errorCount: number;
27
+ }
28
+ export interface SnapshotData {
29
+ dataset: any;
30
+ metadata: SnapshotMetadata;
31
+ }
package/package.json CHANGED
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "name": "@cleaver/breakcheck-core",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
7
13
  "license": "Apache-2.0",
8
14
  "author": "Cleaver Barnes",
9
15
  "publishConfig": {