@diegovelasquezweb/a11y-engine 0.11.27 → 0.11.28
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
|
@@ -208,7 +208,7 @@ function groupFindingsByFile(domFindings, projectDir) {
|
|
|
208
208
|
return { abs, rel, content };
|
|
209
209
|
});
|
|
210
210
|
|
|
211
|
-
const
|
|
211
|
+
const initialGroups = new Map();
|
|
212
212
|
|
|
213
213
|
for (const finding of domFindings) {
|
|
214
214
|
const tokens = selectorTokens(finding.selector);
|
|
@@ -219,13 +219,29 @@ function groupFindingsByFile(domFindings, projectDir) {
|
|
|
219
219
|
.slice(0, MAX_CANDIDATE_FILES);
|
|
220
220
|
|
|
221
221
|
const key = ranked.length > 0 ? ranked[0].rel : `__no_candidates_${finding.id}`;
|
|
222
|
-
if (!
|
|
223
|
-
|
|
222
|
+
if (!initialGroups.has(key)) {
|
|
223
|
+
initialGroups.set(key, { candidates: ranked, findings: [] });
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
initialGroups.get(key).findings.push(finding);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
const merged = [];
|
|
229
|
+
for (const group of initialGroups.values()) {
|
|
230
|
+
const fileSet = new Set(group.candidates.map((c) => c.rel));
|
|
231
|
+
const existing = merged.find((m) => m.candidates.some((c) => fileSet.has(c.rel)));
|
|
232
|
+
if (existing) {
|
|
233
|
+
existing.findings.push(...group.findings);
|
|
234
|
+
for (const candidate of group.candidates) {
|
|
235
|
+
if (!existing.candidates.some((c) => c.rel === candidate.rel)) {
|
|
236
|
+
existing.candidates.push(candidate);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
merged.push({ candidates: [...group.candidates], findings: [...group.findings] });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return merged;
|
|
229
245
|
}
|
|
230
246
|
|
|
231
247
|
function buildAiFixInputMulti({ findings, intelligenceRules, candidates, projectHints }) {
|
|
@@ -378,7 +394,7 @@ function applyChanges(projectDir, changes) {
|
|
|
378
394
|
const abs = path.resolve(projectDir, rel);
|
|
379
395
|
const original = fs.readFileSync(abs, "utf8");
|
|
380
396
|
if (!original.includes(change.search)) {
|
|
381
|
-
|
|
397
|
+
continue;
|
|
382
398
|
}
|
|
383
399
|
const updated = original.replace(change.search, change.replace);
|
|
384
400
|
if (updated === original) continue;
|
|
@@ -738,7 +754,7 @@ export async function applyFindingsFix(input) {
|
|
|
738
754
|
|
|
739
755
|
const groups = groupFindingsByFile(domFindings, projectDir);
|
|
740
756
|
|
|
741
|
-
for (const
|
|
757
|
+
for (const { candidates, findings: groupFindings } of groups) {
|
|
742
758
|
if (candidates.length === 0) {
|
|
743
759
|
for (const finding of groupFindings) {
|
|
744
760
|
resultMap.set(
|
|
@@ -800,7 +816,7 @@ export async function applyFindingsFix(input) {
|
|
|
800
816
|
makeResult(finding.id, {
|
|
801
817
|
applied: false,
|
|
802
818
|
reason: FIX_ERROR_CODES.PATCH_GENERATION_FAILED,
|
|
803
|
-
message: `Could not generate patch output for file group (top file: ${
|
|
819
|
+
message: `Could not generate patch output for file group (top file: ${candidates[0]?.rel || "unknown"}).`,
|
|
804
820
|
findingTitle: finding.title || "",
|
|
805
821
|
branchSlug: slugify(`${finding.id}-${finding.rule_id || ""}`),
|
|
806
822
|
usage: claudeUsage,
|
|
@@ -864,7 +880,7 @@ export async function applyFindingsFix(input) {
|
|
|
864
880
|
changedFiles: applied.changedFiles,
|
|
865
881
|
patch: applied.patch,
|
|
866
882
|
verifyRule: patchOutput.verifyRule || execution.verify.ruleId,
|
|
867
|
-
verifyRoute:
|
|
883
|
+
verifyRoute: execution.verify.route,
|
|
868
884
|
findingTitle: finding.title || "",
|
|
869
885
|
branchSlug: slugify(`${finding.id}-${ruleId}`),
|
|
870
886
|
usage: { input_tokens: perInput, output_tokens: perOutput },
|