@diegovelasquezweb/a11y-engine 0.11.33 → 0.11.34
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diegovelasquezweb/a11y-engine",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.34",
|
|
4
4
|
"description": "WCAG 2.2 accessibility audit engine — scanner, analyzer, and report builders",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
"CHANGELOG.md",
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"test": "vitest run"
|
|
37
|
+
},
|
|
35
38
|
"dependencies": {
|
|
36
39
|
"@axe-core/playwright": "^4.11.1",
|
|
37
40
|
"axe-core": "^4.11.1",
|
|
@@ -41,7 +44,5 @@
|
|
|
41
44
|
"devDependencies": {
|
|
42
45
|
"vitest": "^4.0.18"
|
|
43
46
|
},
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
}
|
|
47
|
+
"packageManager": "pnpm@10.22.0+sha512.bf049efe995b28f527fd2b41ae0474ce29186f7edcb3bf545087bd61fbbebb2bf75362d1307fda09c2d288e1e499787ac12d4fcb617a974718a6051f2eee741c"
|
|
48
|
+
}
|
|
File without changes
|
|
@@ -371,11 +371,14 @@ function parseJsonBlock(text) {
|
|
|
371
371
|
async function callClaudeForPatch({ apiKey, model, aiInput }) {
|
|
372
372
|
const system = [
|
|
373
373
|
"You are an accessibility fix engine.",
|
|
374
|
-
"Return JSON only.",
|
|
375
|
-
"
|
|
376
|
-
"
|
|
377
|
-
"
|
|
378
|
-
"
|
|
374
|
+
"Return JSON only — no markdown fences, no extra text.",
|
|
375
|
+
"The input contains either a single 'finding' object or a 'findings' array. Fix EVERY finding present.",
|
|
376
|
+
"For each finding, read its fixDescription and constraints.must fields to understand the required fix.",
|
|
377
|
+
"Generate text-replacement changes in the provided source files.",
|
|
378
|
+
"CRITICAL — filePath rules: use the EXACT filePath string from the files array. Never derive filePath from area, url, selector, or any other field. Never add or remove leading slashes or file extensions.",
|
|
379
|
+
"CRITICAL — search accuracy: the 'search' value must be a verbatim copy of a substring from the file content. Do not paraphrase, reformat, or reconstruct it — copy it character-for-character.",
|
|
380
|
+
"For insertions (new element not yet in the file), anchor the search on the nearest existing surrounding element and include it in both search and replace.",
|
|
381
|
+
"Do not create new files. Only write changes for filePaths listed in the files array.",
|
|
379
382
|
"Schema:",
|
|
380
383
|
"{\"changes\":[{\"filePath\":\"...\",\"search\":\"...\",\"replace\":\"...\"}],\"verifyRule\":\"...\",\"verifyRoute\":\"...\",\"notes\":\"...\"}",
|
|
381
384
|
].join("\n");
|
|
@@ -413,6 +416,11 @@ async function callClaudeForPatch({ apiKey, model, aiInput }) {
|
|
|
413
416
|
return { patch: parsed, usage };
|
|
414
417
|
}
|
|
415
418
|
|
|
419
|
+
function normalizeFilePath(filePath) {
|
|
420
|
+
// Strip leading slashes Claude may copy from finding.area (e.g. "/contact.html" → "contact.html")
|
|
421
|
+
return typeof filePath === "string" ? filePath.replace(/^\/+/, "") : filePath;
|
|
422
|
+
}
|
|
423
|
+
|
|
416
424
|
function validateAiPatchOutput(output, projectDir, fileSet) {
|
|
417
425
|
if (!isObject(output)) return { ok: false, reason: "AI patch output is empty" };
|
|
418
426
|
if (!Array.isArray(output.changes) || output.changes.length === 0) {
|
|
@@ -421,18 +429,22 @@ function validateAiPatchOutput(output, projectDir, fileSet) {
|
|
|
421
429
|
|
|
422
430
|
for (const change of output.changes) {
|
|
423
431
|
if (!isObject(change)) return { ok: false, reason: "Invalid change item" };
|
|
424
|
-
const
|
|
432
|
+
const rawPath = typeof change.filePath === "string" ? change.filePath.trim() : "";
|
|
433
|
+
const filePath = normalizeFilePath(rawPath);
|
|
425
434
|
const search = typeof change.search === "string" ? change.search : "";
|
|
426
435
|
const replace = typeof change.replace === "string" ? change.replace : "";
|
|
427
436
|
if (!filePath || !search) return { ok: false, reason: "Change is missing filePath/search" };
|
|
428
|
-
if (!fileSet.has(filePath)) return { ok: false, reason: `Change file not in candidate set: ${
|
|
437
|
+
if (!fileSet.has(filePath)) return { ok: false, reason: `Change file not in candidate set: ${rawPath}` };
|
|
429
438
|
if (search === replace) return { ok: false, reason: `AI generated a no-op patch for ${filePath} — search and replace are identical` };
|
|
430
439
|
|
|
431
440
|
const abs = path.resolve(projectDir, filePath);
|
|
432
|
-
if (!isWithin(projectDir, abs)
|
|
441
|
+
if (!isWithin(projectDir, abs)) {
|
|
433
442
|
return { ok: false, reason: `Change path escapes projectDir: ${filePath}` };
|
|
434
443
|
}
|
|
435
444
|
if (replace.length > 20000) return { ok: false, reason: `Replacement too large for ${filePath}` };
|
|
445
|
+
|
|
446
|
+
// Normalize in-place so downstream applyChanges uses the clean path
|
|
447
|
+
change.filePath = filePath;
|
|
436
448
|
}
|
|
437
449
|
|
|
438
450
|
return { ok: true };
|
|
File without changes
|
package/src/reports/html.mjs
CHANGED
|
File without changes
|
package/assets/.DS_Store
DELETED
|
Binary file
|