@diegovelasquezweb/a11y-engine 0.7.5 → 0.7.7

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.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "WCAG 2.2 accessibility audit engine — scanner, analyzer, and report builders",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/ai/enrich.mjs CHANGED
@@ -46,13 +46,18 @@ async function main() {
46
46
  githubToken,
47
47
  });
48
48
 
49
- writeJson(findingsPath, { ...payload, findings: enriched });
49
+ const enrichedWithFlag = enriched.map((f, i) => {
50
+ const original = findings[i];
51
+ const wasImproved = original && (
52
+ f.fixDescription !== original.fixDescription ||
53
+ f.fixCode !== original.fixCode
54
+ );
55
+ return wasImproved ? { ...f, aiEnhanced: true } : f;
56
+ });
50
57
 
51
- const improved = enriched.filter((f, i) =>
52
- f.fixDescription !== findings[i]?.fixDescription ||
53
- f.fixCode !== findings[i]?.fixCode
54
- ).length;
58
+ writeJson(findingsPath, { ...payload, findings: enrichedWithFlag });
55
59
 
60
+ const improved = enrichedWithFlag.filter((f) => f.aiEnhanced).length;
56
61
  log.success(`AI enrichment complete. ${improved} finding(s) improved.`);
57
62
  }
58
63
 
@@ -843,7 +843,11 @@ function buildFindings(inputPayload, cliArgs) {
843
843
 
844
844
  findings.push({
845
845
  id: "",
846
- rule_id: v.source === "cdp" ? v.id.replace(/^cdp-/, "") : v.id,
846
+ rule_id: v.source === "cdp"
847
+ ? v.id.replace(/^cdp-/, "")
848
+ : v.source === "pa11y"
849
+ ? `pa11y-${v.id.split(".").pop()?.toLowerCase() ?? v.id.toLowerCase()}`
850
+ : v.id,
847
851
  source_rule_id: v.source_rule_id || null,
848
852
  source: v.source || "axe",
849
853
  title: v.help,