@jrpool/kilotest 60.8.0 → 60.9.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/lhm.plugin.json +1 -1
- package/openapi-3.0.yaml +1 -1
- package/openapi.yaml +1 -1
- package/package.json +1 -1
- package/scripts/strip-report-images.ts +67 -0
- package/server.json +1 -1
package/lhm.plugin.json
CHANGED
package/openapi-3.0.yaml
CHANGED
|
@@ -2,7 +2,7 @@ openapi: 3.0.3
|
|
|
2
2
|
info:
|
|
3
3
|
title: Kilotest API
|
|
4
4
|
description: 'Kilotest is an ensemble testing and reporting service for front-end web quality. It uses an ensemble of 12 rule engines to test web pages for front-end quality (accessibility, usability, and web standards, including HTML, CSS, ARIA, and WCAG). Kilotest acts as a web server for human users, an MCP server for AI platforms, and an API for programmatic access. With this API you can request that a page be tested or retested, discover available reports, incrementally retrieve facts from a report: from what reports are available, to what issues were reported in one report, to what elements violated one issue, to what diagnoses rule engines gave for one violation.'
|
|
5
|
-
version: 60.
|
|
5
|
+
version: 60.9.0
|
|
6
6
|
license:
|
|
7
7
|
name: MIT
|
|
8
8
|
url: https://github.com/jrpool/kilotest/blob/main/LICENSE
|
package/openapi.yaml
CHANGED
|
@@ -2,7 +2,7 @@ openapi: 3.1.0
|
|
|
2
2
|
info:
|
|
3
3
|
title: Kilotest API
|
|
4
4
|
description: 'Kilotest is an ensemble testing and reporting service for front-end web quality. It uses an ensemble of 12 rule engines to test web pages for front-end quality (accessibility, usability, and web standards, including HTML, CSS, ARIA, and WCAG). Kilotest acts as a web server for human users, an MCP server for AI platforms, and an API for programmatic access. With this API you can request that a page be tested or retested, discover available reports, incrementally retrieve facts from a report: from what reports are available, to what issues were reported in one report, to what elements violated one issue, to what diagnoses rule engines gave for one violation.'
|
|
5
|
-
version: 60.
|
|
5
|
+
version: 60.9.0
|
|
6
6
|
license:
|
|
7
7
|
name: MIT
|
|
8
8
|
identifier: MIT
|
package/package.json
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
strip-report-images.ts
|
|
3
|
+
Replaces the base64 page-image payloads in report images arrays with the marker string "deleted", cutting the bulk of each report while leaving every other property untouched. Array length is preserved, so checkpoints[].imageIndexes still resolves to a real element, and job properties such as imageColor remain as a record of what the job specified.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
node scripts/strip-report-images.ts [--dry-run] [reportsDir]
|
|
7
|
+
|
|
8
|
+
reportsDir defaults to db/reports. Run it once per report directory (reports, hiddenReports). With --dry-run, reports are analyzed and the changes are listed but no file is written.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// IMPORTS
|
|
12
|
+
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
|
|
16
|
+
// CONSTANTS
|
|
17
|
+
|
|
18
|
+
const DRY_RUN = process.argv.includes('--dry-run');
|
|
19
|
+
const reportsDir = process.argv.find((arg, index) => index > 1 && !arg.startsWith('--'))
|
|
20
|
+
?? path.join(import.meta.dirname, '..', 'db', 'reports');
|
|
21
|
+
const STUB = 'deleted';
|
|
22
|
+
|
|
23
|
+
// FUNCTIONS
|
|
24
|
+
|
|
25
|
+
// Serializes an object exactly as Kilotest writes reports (util.getJSON).
|
|
26
|
+
const getJSON = (object: unknown): string => `${JSON.stringify(object, null, 2)}\n`;
|
|
27
|
+
|
|
28
|
+
// OPERATION
|
|
29
|
+
|
|
30
|
+
const fileNames = fs.readdirSync(reportsDir).filter(name => name.endsWith('.json'));
|
|
31
|
+
if (!fileNames.length) {
|
|
32
|
+
console.log(`No report files found in ${reportsDir}`);
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
let revised = 0;
|
|
36
|
+
let skipped = 0;
|
|
37
|
+
for (const fileName of fileNames) {
|
|
38
|
+
const filePath = path.join(reportsDir, fileName);
|
|
39
|
+
let report;
|
|
40
|
+
try {
|
|
41
|
+
report = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.log(`${fileName}: SKIPPED (unreadable or not JSON: ${(error as Error).message})`);
|
|
45
|
+
skipped++;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const {images} = report;
|
|
49
|
+
const needsStubbing = Array.isArray(images) && images.some(image => image !== STUB);
|
|
50
|
+
if (!needsStubbing) {
|
|
51
|
+
skipped++;
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const freedBytes = images
|
|
55
|
+
.filter((image: unknown) => image !== STUB)
|
|
56
|
+
.reduce((total: number, image: any) => total + String(image).length, 0);
|
|
57
|
+
report.images = images.map(() => STUB);
|
|
58
|
+
revised++;
|
|
59
|
+
console.log(
|
|
60
|
+
`${fileName}:${DRY_RUN ? ' (dry run)' : ''} stubbed ${images.length} image(s), `
|
|
61
|
+
+ `freed ~${Math.round(freedBytes / 1024)} KB`
|
|
62
|
+
);
|
|
63
|
+
if (!DRY_RUN) {
|
|
64
|
+
fs.writeFileSync(filePath, getJSON(report));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
console.log(`Done: ${revised} report(s) ${DRY_RUN ? 'would be ' : ''}revised, ${skipped} skipped.`);
|