@diegovelasquezweb/a11y-engine 0.11.28 → 0.11.30
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
|
@@ -388,6 +388,7 @@ function validateAiPatchOutput(output, projectDir, fileSet) {
|
|
|
388
388
|
function applyChanges(projectDir, changes) {
|
|
389
389
|
const changedFiles = [];
|
|
390
390
|
const patchParts = [];
|
|
391
|
+
const succeededFindingIds = new Set();
|
|
391
392
|
|
|
392
393
|
for (const change of changes) {
|
|
393
394
|
const rel = change.filePath;
|
|
@@ -401,6 +402,9 @@ function applyChanges(projectDir, changes) {
|
|
|
401
402
|
fs.writeFileSync(abs, updated, "utf8");
|
|
402
403
|
changedFiles.push(rel);
|
|
403
404
|
patchParts.push(`--- ${rel}\n+++ ${rel}\n@@\n-${change.search}\n+${change.replace}`);
|
|
405
|
+
if (typeof change.findingId === "string" && change.findingId.trim()) {
|
|
406
|
+
succeededFindingIds.add(change.findingId.trim());
|
|
407
|
+
}
|
|
404
408
|
}
|
|
405
409
|
|
|
406
410
|
if (changedFiles.length === 0) return { ok: false, reason: "No effective changes were applied" };
|
|
@@ -409,6 +413,7 @@ function applyChanges(projectDir, changes) {
|
|
|
409
413
|
ok: true,
|
|
410
414
|
changedFiles: [...new Set(changedFiles)],
|
|
411
415
|
patch: patchParts.join("\n"),
|
|
416
|
+
succeededFindingIds,
|
|
412
417
|
};
|
|
413
418
|
}
|
|
414
419
|
|
|
@@ -661,8 +666,8 @@ export async function applyFindingFix(input) {
|
|
|
661
666
|
message: "Patch applied successfully.",
|
|
662
667
|
changedFiles: applied.changedFiles,
|
|
663
668
|
patch: applied.patch,
|
|
664
|
-
verifyRule:
|
|
665
|
-
verifyRoute:
|
|
669
|
+
verifyRule: execution.verify.ruleId,
|
|
670
|
+
verifyRoute: execution.verify.route,
|
|
666
671
|
findingTitle: finding.title || "",
|
|
667
672
|
branchSlug: slugify(`${findingId}-${ruleId}`),
|
|
668
673
|
usage: claudeUsage,
|
|
@@ -867,19 +872,30 @@ export async function applyFindingsFix(input) {
|
|
|
867
872
|
const perInput = Math.round(claudeUsage.input_tokens / n);
|
|
868
873
|
const perOutput = Math.round(claudeUsage.output_tokens / n);
|
|
869
874
|
|
|
875
|
+
// If Claude tagged changes with findingId, use those for per-finding success tracking.
|
|
876
|
+
// If no findingId tags were emitted, fall back to group-level success for all findings.
|
|
877
|
+
const hasFindingIdTracking = applied.succeededFindingIds.size > 0;
|
|
878
|
+
|
|
870
879
|
for (const finding of withRules) {
|
|
871
880
|
const ruleId = typeof finding.rule_id === "string" ? finding.rule_id.trim() : "";
|
|
872
881
|
const intelligenceRule = intelligenceRules[ruleId] || {};
|
|
873
882
|
const execution = buildExecution(ruleId, intelligenceRule, finding);
|
|
883
|
+
|
|
884
|
+
const findingApplied = hasFindingIdTracking
|
|
885
|
+
? applied.succeededFindingIds.has(finding.id)
|
|
886
|
+
: true;
|
|
887
|
+
|
|
874
888
|
resultMap.set(
|
|
875
889
|
finding.id,
|
|
876
890
|
makeResult(finding.id, {
|
|
877
|
-
applied:
|
|
878
|
-
reason: "",
|
|
879
|
-
message:
|
|
891
|
+
applied: findingApplied,
|
|
892
|
+
reason: findingApplied ? "" : FIX_ERROR_CODES.PATCH_APPLY_FAILED,
|
|
893
|
+
message: findingApplied
|
|
894
|
+
? "Patch applied successfully."
|
|
895
|
+
: "The change for this finding could not be applied (search block not found).",
|
|
880
896
|
changedFiles: applied.changedFiles,
|
|
881
897
|
patch: applied.patch,
|
|
882
|
-
verifyRule:
|
|
898
|
+
verifyRule: execution.verify.ruleId,
|
|
883
899
|
verifyRoute: execution.verify.route,
|
|
884
900
|
findingTitle: finding.title || "",
|
|
885
901
|
branchSlug: slugify(`${finding.id}-${ruleId}`),
|
|
@@ -605,8 +605,11 @@ async function analyzeRoute(
|
|
|
605
605
|
const builder = new AxeBuilder({ page });
|
|
606
606
|
|
|
607
607
|
if (onlyRule) {
|
|
608
|
-
|
|
609
|
-
|
|
608
|
+
const rules = onlyRule.includes(",")
|
|
609
|
+
? onlyRule.split(",").map((r) => r.trim()).filter(Boolean)
|
|
610
|
+
: [onlyRule];
|
|
611
|
+
log.info(`Targeted Audit: Only checking rules "${rules.join(", ")}"`);
|
|
612
|
+
builder.withRules(rules);
|
|
610
613
|
} else {
|
|
611
614
|
const tagsToUse = axeTags || AXE_TAGS;
|
|
612
615
|
builder.withTags(tagsToUse);
|