doc-detective-common 4.0.0-beta.0-dev.3 → 4.0.0-beta.0-dev.5

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 (200) hide show
  1. package/package.json +1 -1
  2. package/.c8rc.json +0 -8
  3. package/.mocharc.yml +0 -1
  4. package/icon.png +0 -0
  5. package/scripts/check-coverage-ratchet.cjs +0 -123
  6. package/scripts/createCjsWrapper.js +0 -25
  7. package/scripts/generateTypes.cjs +0 -54
  8. package/src/detectTests.ts +0 -660
  9. package/src/index.ts +0 -3
  10. package/src/schemas/build/checkLink_v2.schema.json +0 -81
  11. package/src/schemas/build/checkLink_v3.schema.json +0 -92
  12. package/src/schemas/build/click_v3.schema.json +0 -145
  13. package/src/schemas/build/config_v2.schema.json +0 -1079
  14. package/src/schemas/build/config_v3.schema.json +0 -696
  15. package/src/schemas/build/context_v2.schema.json +0 -135
  16. package/src/schemas/build/context_v3.schema.json +0 -229
  17. package/src/schemas/build/dragAndDrop_v3.schema.json +0 -189
  18. package/src/schemas/build/find_v2.schema.json +0 -168
  19. package/src/schemas/build/find_v3.schema.json +0 -214
  20. package/src/schemas/build/goTo_v2.schema.json +0 -63
  21. package/src/schemas/build/goTo_v3.schema.json +0 -257
  22. package/src/schemas/build/httpRequest_v2.schema.json +0 -321
  23. package/src/schemas/build/httpRequest_v3.schema.json +0 -439
  24. package/src/schemas/build/loadCookie_v3.schema.json +0 -138
  25. package/src/schemas/build/loadVariables_v3.schema.json +0 -10
  26. package/src/schemas/build/moveTo_v2.schema.json +0 -99
  27. package/src/schemas/build/openApi_v2.schema.json +0 -76
  28. package/src/schemas/build/openApi_v3.schema.json +0 -161
  29. package/src/schemas/build/record_v3.schema.json +0 -70
  30. package/src/schemas/build/report_v3.schema.json +0 -53
  31. package/src/schemas/build/resolvedTests_v3.schema.json +0 -238
  32. package/src/schemas/build/runCode_v2.schema.json +0 -201
  33. package/src/schemas/build/runCode_v3.schema.json +0 -138
  34. package/src/schemas/build/runShell_v2.schema.json +0 -189
  35. package/src/schemas/build/runShell_v3.schema.json +0 -156
  36. package/src/schemas/build/saveCookie_v3.schema.json +0 -149
  37. package/src/schemas/build/saveScreenshot_v2.schema.json +0 -150
  38. package/src/schemas/build/screenshot_v3.schema.json +0 -250
  39. package/src/schemas/build/setVariables_v2.schema.json +0 -39
  40. package/src/schemas/build/sourceIntegration_v3.schema.json +0 -51
  41. package/src/schemas/build/spec_v2.schema.json +0 -199
  42. package/src/schemas/build/spec_v3.schema.json +0 -213
  43. package/src/schemas/build/startRecording_v2.schema.json +0 -57
  44. package/src/schemas/build/step_v3.schema.json +0 -669
  45. package/src/schemas/build/stopRecord_v3.schema.json +0 -13
  46. package/src/schemas/build/stopRecording_v2.schema.json +0 -33
  47. package/src/schemas/build/test_v2.schema.json +0 -244
  48. package/src/schemas/build/test_v3.schema.json +0 -292
  49. package/src/schemas/build/typeKeys_v2.schema.json +0 -72
  50. package/src/schemas/build/type_v3.schema.json +0 -131
  51. package/src/schemas/build/wait_v2.schema.json +0 -42
  52. package/src/schemas/build/wait_v3.schema.json +0 -37
  53. package/src/schemas/dereferenceSchemas.cjs +0 -208
  54. package/src/schemas/index.ts +0 -6
  55. package/src/schemas/output_schemas/analytics_v1.schema.json +0 -585
  56. package/src/schemas/output_schemas/checkLink_v1.schema.json +0 -42
  57. package/src/schemas/output_schemas/checkLink_v2.schema.json +0 -80
  58. package/src/schemas/output_schemas/checkLink_v3.schema.json +0 -145
  59. package/src/schemas/output_schemas/click_v1.schema.json +0 -60
  60. package/src/schemas/output_schemas/click_v3.schema.json +0 -252
  61. package/src/schemas/output_schemas/config_v2.schema.json +0 -2628
  62. package/src/schemas/output_schemas/config_v3.schema.json +0 -16470
  63. package/src/schemas/output_schemas/context_v2.schema.json +0 -134
  64. package/src/schemas/output_schemas/context_v3.schema.json +0 -374
  65. package/src/schemas/output_schemas/dragAndDrop_v3.schema.json +0 -496
  66. package/src/schemas/output_schemas/endRecord_v3.schema.json +0 -12
  67. package/src/schemas/output_schemas/find_v1.schema.json +0 -171
  68. package/src/schemas/output_schemas/find_v2.schema.json +0 -184
  69. package/src/schemas/output_schemas/find_v3.schema.json +0 -1349
  70. package/src/schemas/output_schemas/goTo_v1.schema.json +0 -30
  71. package/src/schemas/output_schemas/goTo_v2.schema.json +0 -62
  72. package/src/schemas/output_schemas/goTo_v3.schema.json +0 -419
  73. package/src/schemas/output_schemas/httpRequest_v1.schema.json +0 -115
  74. package/src/schemas/output_schemas/httpRequest_v2.schema.json +0 -392
  75. package/src/schemas/output_schemas/httpRequest_v3.schema.json +0 -994
  76. package/src/schemas/output_schemas/loadCookie_v3.schema.json +0 -228
  77. package/src/schemas/output_schemas/loadVariables_v3.schema.json +0 -9
  78. package/src/schemas/output_schemas/matchText_v1.schema.json +0 -32
  79. package/src/schemas/output_schemas/moveMouse_v1.schema.json +0 -60
  80. package/src/schemas/output_schemas/moveTo_v2.schema.json +0 -98
  81. package/src/schemas/output_schemas/openApi_v2.schema.json +0 -75
  82. package/src/schemas/output_schemas/openApi_v3.schema.json +0 -162
  83. package/src/schemas/output_schemas/record_v3.schema.json +0 -101
  84. package/src/schemas/output_schemas/report_v3.schema.json +0 -16826
  85. package/src/schemas/output_schemas/resolvedTests_v3.schema.json +0 -33331
  86. package/src/schemas/output_schemas/runCode_v2.schema.json +0 -200
  87. package/src/schemas/output_schemas/runCode_v3.schema.json +0 -222
  88. package/src/schemas/output_schemas/runShell_v1.schema.json +0 -35
  89. package/src/schemas/output_schemas/runShell_v2.schema.json +0 -188
  90. package/src/schemas/output_schemas/runShell_v3.schema.json +0 -236
  91. package/src/schemas/output_schemas/saveCookie_v3.schema.json +0 -245
  92. package/src/schemas/output_schemas/saveScreenshot_v2.schema.json +0 -149
  93. package/src/schemas/output_schemas/screenshot_v1.schema.json +0 -48
  94. package/src/schemas/output_schemas/screenshot_v3.schema.json +0 -681
  95. package/src/schemas/output_schemas/scroll_v1.schema.json +0 -50
  96. package/src/schemas/output_schemas/setVariables_v2.schema.json +0 -38
  97. package/src/schemas/output_schemas/sourceIntegration_v3.schema.json +0 -50
  98. package/src/schemas/output_schemas/spec_v2.schema.json +0 -2301
  99. package/src/schemas/output_schemas/spec_v3.schema.json +0 -16630
  100. package/src/schemas/output_schemas/startRecording_v1.schema.json +0 -55
  101. package/src/schemas/output_schemas/startRecording_v2.schema.json +0 -56
  102. package/src/schemas/output_schemas/step_v3.schema.json +0 -7317
  103. package/src/schemas/output_schemas/stopRecord_v3.schema.json +0 -12
  104. package/src/schemas/output_schemas/stopRecording_v1.schema.json +0 -20
  105. package/src/schemas/output_schemas/stopRecording_v2.schema.json +0 -32
  106. package/src/schemas/output_schemas/test_v2.schema.json +0 -1903
  107. package/src/schemas/output_schemas/test_v3.schema.json +0 -15863
  108. package/src/schemas/output_schemas/typeKeys_v2.schema.json +0 -71
  109. package/src/schemas/output_schemas/type_v1.schema.json +0 -62
  110. package/src/schemas/output_schemas/type_v3.schema.json +0 -244
  111. package/src/schemas/output_schemas/wait_v1.schema.json +0 -42
  112. package/src/schemas/output_schemas/wait_v2.schema.json +0 -41
  113. package/src/schemas/output_schemas/wait_v3.schema.json +0 -41
  114. package/src/schemas/schemas.json +0 -121331
  115. package/src/schemas/src_schemas/analytics_v1.schema.json +0 -585
  116. package/src/schemas/src_schemas/checkLink_v1.schema.json +0 -42
  117. package/src/schemas/src_schemas/checkLink_v2.schema.json +0 -65
  118. package/src/schemas/src_schemas/checkLink_v3.schema.json +0 -91
  119. package/src/schemas/src_schemas/click_v1.schema.json +0 -60
  120. package/src/schemas/src_schemas/click_v3.schema.json +0 -144
  121. package/src/schemas/src_schemas/config_v2.schema.json +0 -929
  122. package/src/schemas/src_schemas/config_v3.schema.json +0 -633
  123. package/src/schemas/src_schemas/context_v2.schema.json +0 -108
  124. package/src/schemas/src_schemas/context_v3.schema.json +0 -202
  125. package/src/schemas/src_schemas/dragAndDrop_v3.schema.json +0 -185
  126. package/src/schemas/src_schemas/find_v1.schema.json +0 -137
  127. package/src/schemas/src_schemas/find_v2.schema.json +0 -155
  128. package/src/schemas/src_schemas/find_v3.schema.json +0 -210
  129. package/src/schemas/src_schemas/goTo_v1.schema.json +0 -30
  130. package/src/schemas/src_schemas/goTo_v2.schema.json +0 -58
  131. package/src/schemas/src_schemas/goTo_v3.schema.json +0 -232
  132. package/src/schemas/src_schemas/httpRequest_v1.schema.json +0 -115
  133. package/src/schemas/src_schemas/httpRequest_v2.schema.json +0 -284
  134. package/src/schemas/src_schemas/httpRequest_v3.schema.json +0 -402
  135. package/src/schemas/src_schemas/loadCookie_v3.schema.json +0 -113
  136. package/src/schemas/src_schemas/loadVariables_v3.schema.json +0 -9
  137. package/src/schemas/src_schemas/matchText_v1.schema.json +0 -32
  138. package/src/schemas/src_schemas/moveMouse_v1.schema.json +0 -60
  139. package/src/schemas/src_schemas/moveTo_v2.schema.json +0 -89
  140. package/src/schemas/src_schemas/openApi_v2.schema.json +0 -64
  141. package/src/schemas/src_schemas/openApi_v3.schema.json +0 -161
  142. package/src/schemas/src_schemas/record_v3.schema.json +0 -69
  143. package/src/schemas/src_schemas/report_v3.schema.json +0 -52
  144. package/src/schemas/src_schemas/resolvedTests_v3.schema.json +0 -237
  145. package/src/schemas/src_schemas/runCode_v2.schema.json +0 -181
  146. package/src/schemas/src_schemas/runCode_v3.schema.json +0 -137
  147. package/src/schemas/src_schemas/runShell_v1.schema.json +0 -35
  148. package/src/schemas/src_schemas/runShell_v2.schema.json +0 -166
  149. package/src/schemas/src_schemas/runShell_v3.schema.json +0 -155
  150. package/src/schemas/src_schemas/saveCookie_v3.schema.json +0 -124
  151. package/src/schemas/src_schemas/saveScreenshot_v2.schema.json +0 -129
  152. package/src/schemas/src_schemas/screenshot_v1.schema.json +0 -48
  153. package/src/schemas/src_schemas/screenshot_v3.schema.json +0 -249
  154. package/src/schemas/src_schemas/scroll_v1.schema.json +0 -50
  155. package/src/schemas/src_schemas/setVariables_v2.schema.json +0 -38
  156. package/src/schemas/src_schemas/sourceIntegration_v3.schema.json +0 -45
  157. package/src/schemas/src_schemas/spec_v2.schema.json +0 -175
  158. package/src/schemas/src_schemas/spec_v3.schema.json +0 -212
  159. package/src/schemas/src_schemas/startRecording_v1.schema.json +0 -55
  160. package/src/schemas/src_schemas/startRecording_v2.schema.json +0 -54
  161. package/src/schemas/src_schemas/step_v3.schema.json +0 -632
  162. package/src/schemas/src_schemas/stopRecord_v3.schema.json +0 -9
  163. package/src/schemas/src_schemas/stopRecording_v1.schema.json +0 -20
  164. package/src/schemas/src_schemas/stopRecording_v2.schema.json +0 -32
  165. package/src/schemas/src_schemas/test_v2.schema.json +0 -200
  166. package/src/schemas/src_schemas/test_v3.schema.json +0 -268
  167. package/src/schemas/src_schemas/typeKeys_v2.schema.json +0 -63
  168. package/src/schemas/src_schemas/type_v1.schema.json +0 -62
  169. package/src/schemas/src_schemas/type_v3.schema.json +0 -118
  170. package/src/schemas/src_schemas/wait_v1.schema.json +0 -42
  171. package/src/schemas/src_schemas/wait_v2.schema.json +0 -41
  172. package/src/schemas/src_schemas/wait_v3.schema.json +0 -36
  173. package/src/types/generated/checkLink_v3.ts +0 -29
  174. package/src/types/generated/click_v3.ts +0 -17
  175. package/src/types/generated/config_v3.ts +0 -405
  176. package/src/types/generated/context_v3.ts +0 -112
  177. package/src/types/generated/dragAndDrop_v3.ts +0 -39
  178. package/src/types/generated/endRecord_v3.ts +0 -10
  179. package/src/types/generated/find_v3.ts +0 -17
  180. package/src/types/generated/goTo_v3.ts +0 -48
  181. package/src/types/generated/httpRequest_v3.ts +0 -17
  182. package/src/types/generated/loadCookie_v3.ts +0 -17
  183. package/src/types/generated/loadVariables_v3.ts +0 -10
  184. package/src/types/generated/openApi_v3.ts +0 -64
  185. package/src/types/generated/record_v3.ts +0 -34
  186. package/src/types/generated/report_v3.ts +0 -183
  187. package/src/types/generated/resolvedTests_v3.ts +0 -585
  188. package/src/types/generated/runCode_v3.ts +0 -59
  189. package/src/types/generated/runShell_v3.ts +0 -58
  190. package/src/types/generated/saveCookie_v3.ts +0 -17
  191. package/src/types/generated/screenshot_v3.ts +0 -76
  192. package/src/types/generated/sourceIntegration_v3.ts +0 -31
  193. package/src/types/generated/spec_v3.ts +0 -166
  194. package/src/types/generated/step_v3.ts +0 -1288
  195. package/src/types/generated/stopRecord_v3.ts +0 -10
  196. package/src/types/generated/test_v3.ts +0 -3048
  197. package/src/types/generated/type_v3.ts +0 -56
  198. package/src/types/generated/wait_v3.ts +0 -13
  199. package/src/validate.ts +0 -627
  200. package/tsconfig.json +0 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doc-detective-common",
3
- "version": "4.0.0-beta.0-dev.3",
3
+ "version": "4.0.0-beta.0-dev.5",
4
4
  "description": "Shared components for Doc Detective projects.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/.c8rc.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "all": true,
3
- "include": ["dist/**/*.js"],
4
- "exclude": ["dist/types/generated/**/*.js", "dist/**/*.d.ts", "dist/**/*.cjs"],
5
- "reporter": ["text", "lcov", "json", "json-summary"],
6
- "report-dir": "coverage",
7
- "check-coverage": false
8
- }
package/.mocharc.yml DELETED
@@ -1 +0,0 @@
1
- exit: true
package/icon.png DELETED
Binary file
@@ -1,123 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Coverage Ratchet Script
5
- *
6
- * Compares current coverage against baseline thresholds.
7
- * Fails if any metric has decreased.
8
- *
9
- * Usage: node scripts/check-coverage-ratchet.cjs
10
- */
11
-
12
- const fs = require('fs');
13
- const path = require('path');
14
-
15
- const THRESHOLDS_FILE = path.join(__dirname, '..', 'coverage-thresholds.json');
16
- const COVERAGE_SUMMARY_FILE = path.join(__dirname, '..', 'coverage', 'coverage-summary.json');
17
-
18
- /**
19
- * Load and parse JSON from the given path, exiting the process with code 1 if the file is missing or cannot be parsed.
20
- * @param {string} filePath - Filesystem path to the JSON file.
21
- * @param {string} description - Human-readable name for the file used in error messages.
22
- * @returns {Object} The parsed JSON object.
23
- */
24
- function loadJSON(filePath, description) {
25
- if (!fs.existsSync(filePath)) {
26
- console.error(`Error: ${description} not found at ${filePath}`);
27
- console.error(`Run 'npm run test:coverage' first to generate coverage data.`);
28
- process.exit(1);
29
- }
30
-
31
- try {
32
- return JSON.parse(fs.readFileSync(filePath, 'utf8'));
33
- } catch (error) {
34
- console.error(`Error parsing ${description}: ${error.message}`);
35
- process.exit(1);
36
- }
37
- }
38
-
39
- /**
40
- * Compares current test coverage against the stored baseline thresholds and enforces the coverage ratchet.
41
- *
42
- * Loads baseline thresholds and the current coverage summary, prints a per-metric table of baseline vs current values and statuses, and enforces policy:
43
- * - Exits with code 1 if any metric has decreased relative to the baseline.
44
- * - If one or more metrics have improved, prints suggested threshold updates.
45
- * - Exits with code 0 when all metrics meet or exceed their baselines.
46
- */
47
- function main() {
48
- // Load baseline thresholds
49
- const thresholds = loadJSON(THRESHOLDS_FILE, 'Coverage thresholds file');
50
-
51
- // Load current coverage
52
- const coverageSummary = loadJSON(COVERAGE_SUMMARY_FILE, 'Coverage summary');
53
-
54
- const current = coverageSummary.total;
55
- const metrics = ['lines', 'statements', 'functions', 'branches'];
56
-
57
- let failed = false;
58
- const results = [];
59
-
60
- console.log('\n=== Coverage Ratchet Check ===\n');
61
- console.log('Metric | Baseline | Current | Status');
62
- console.log('------------|----------|----------|--------');
63
-
64
- for (const metric of metrics) {
65
- const baseline = thresholds[metric];
66
- const currentMetric = current?.[metric];
67
- if (typeof baseline !== 'number' || typeof currentMetric?.pct !== 'number') {
68
- console.error(`Invalid or missing coverage metric: "${metric}"`);
69
- process.exit(1);
70
- }
71
- const currentValue = currentMetric.pct;
72
- const diff = (currentValue - baseline).toFixed(2);
73
-
74
- let status;
75
- if (currentValue < baseline) {
76
- status = `FAIL (${diff}%)`;
77
- failed = true;
78
- } else if (currentValue > baseline) {
79
- status = `PASS (+${diff}%)`;
80
- } else {
81
- status = 'PASS';
82
- }
83
-
84
- const baselineStr = `${baseline.toFixed(2)}%`.padEnd(8);
85
- const currentStr = `${currentValue.toFixed(2)}%`.padEnd(8);
86
- const metricStr = metric.padEnd(11);
87
-
88
- console.log(`${metricStr} | ${baselineStr} | ${currentStr} | ${status}`);
89
-
90
- results.push({
91
- metric,
92
- baseline,
93
- current: currentValue,
94
- passed: currentValue >= baseline
95
- });
96
- }
97
-
98
- console.log('');
99
-
100
- if (failed) {
101
- console.error('Coverage ratchet check FAILED!');
102
- console.error('Coverage has decreased from the baseline.');
103
- console.error('Please add tests to restore coverage before committing.');
104
- process.exit(1);
105
- }
106
-
107
- // Check if we can bump thresholds
108
- const canBump = results.filter(r => r.current > r.baseline);
109
- if (canBump.length > 0) {
110
- console.log('Coverage has improved! Consider updating thresholds:');
111
- console.log('');
112
- for (const r of canBump) {
113
- console.log(` "${r.metric}": ${r.current.toFixed(2)}`);
114
- }
115
- console.log('');
116
- console.log(`Update ${THRESHOLDS_FILE} to lock in the new baseline.`);
117
- }
118
-
119
- console.log('Coverage ratchet check PASSED!');
120
- process.exit(0);
121
- }
122
-
123
- main();
@@ -1,25 +0,0 @@
1
- import { build } from "esbuild";
2
- import { copyFile } from "fs/promises";
3
- import { fileURLToPath } from "url";
4
- import path from "path";
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
- const distDir = path.join(__dirname, "..", "dist");
9
-
10
- await build({
11
- entryPoints: [path.join(distDir, "index.js")],
12
- outfile: path.join(distDir, "index.cjs"),
13
- bundle: true,
14
- format: "cjs",
15
- platform: "node",
16
- packages: "external",
17
- });
18
-
19
- await copyFile(
20
- path.join(distDir, "index.d.ts"),
21
- path.join(distDir, "index.d.cts")
22
- );
23
-
24
- console.log("Created CJS bundle at dist/index.cjs");
25
- console.log("Copied type definitions to dist/index.d.cts");
@@ -1,54 +0,0 @@
1
- const { compile } = require("json-schema-to-typescript");
2
- const fs = require("fs").promises;
3
- const path = require("path");
4
-
5
- async function generateTypes() {
6
- const schemasDir = path.join(__dirname, "..", "src", "schemas", "output_schemas");
7
- const outputDir = path.join(__dirname, "..", "src", "types", "generated");
8
-
9
- // Create output directory
10
- await fs.mkdir(outputDir, { recursive: true });
11
-
12
- // Get all v3 schema files (current version)
13
- const files = await fs.readdir(schemasDir);
14
- const v3Schemas = files.filter((f) => f.endsWith("_v3.schema.json"));
15
-
16
- console.log(`Generating TypeScript types for ${v3Schemas.length} schemas...`);
17
-
18
- let hadErrors = false;
19
- const failedFiles = [];
20
-
21
- for (const file of v3Schemas) {
22
- const schemaPath = path.join(schemasDir, file);
23
-
24
- try {
25
- const schema = JSON.parse(await fs.readFile(schemaPath, "utf-8"));
26
- const ts = await compile(schema, schema.title || file.replace(".schema.json", ""), {
27
- bannerComment: `/* eslint-disable */\n/**\n * Auto-generated from ${file}\n * Do not edit manually\n */`,
28
- style: {
29
- semi: true,
30
- trailingComma: "es5",
31
- },
32
- });
33
-
34
- const outputPath = path.join(outputDir, file.replace(".schema.json", ".ts"));
35
- await fs.writeFile(outputPath, ts);
36
- console.log(` ✓ ${file} → ${path.basename(outputPath)}`);
37
- } catch (error) {
38
- hadErrors = true;
39
- failedFiles.push(file);
40
- console.error(` ✗ Failed to generate ${file}:`, error.message);
41
- }
42
- }
43
-
44
- if (hadErrors) {
45
- throw new Error(`One or more schemas failed to generate TypeScript types: ${failedFiles.join(", ")}`);
46
- }
47
-
48
- console.log("Type generation complete!");
49
- }
50
-
51
- generateTypes().catch((error) => {
52
- console.error("Type generation failed:", error);
53
- process.exit(1);
54
- });