wcag-a11y 0.3.2 → 0.3.3

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/dist/cli.js CHANGED
@@ -11,7 +11,7 @@ const program = new Command();
11
11
  program
12
12
  .name('wcag-a11y')
13
13
  .description('WCAG 2.1/2.2 accessibility auditor with AI-powered fixes')
14
- .version('0.3.2');
14
+ .version('0.3.3');
15
15
  program
16
16
  .command('init')
17
17
  .description('Create a11y.config.json in the current directory')
@@ -52,9 +52,25 @@ function buildFullReport(result, fixes) {
52
52
  lines.push('✅ No violations found.', '', '---', '');
53
53
  continue;
54
54
  }
55
+ // Group violations by ruleId so grouped fixes aren't repeated per instance
56
+ const byRule = new Map();
55
57
  for (const v of page.violations) {
58
+ const group = byRule.get(v.ruleId) ?? [];
59
+ group.push(v);
60
+ byRule.set(v.ruleId, group);
61
+ }
62
+ for (const group of byRule.values()) {
63
+ const v = group[0];
56
64
  const fix = fixes.find((f) => f.ruleId === v.ruleId);
57
- lines.push(`### ${IMPACT_EMOJI[v.impact] ?? '⚪'} [${v.impact.toUpperCase()}] ${v.description}`, '', `**Rule:** \`${v.ruleId}\` `, `**WCAG:** ${fix?.wcagReference ?? `SC ${v.wcag} (Level ${v.level})`} `, `**Selector:** \`${v.selector}\``, '', '**Violating element:**', '```html', v.html, '```', '');
65
+ const others = group.slice(1);
66
+ lines.push(`### ${IMPACT_EMOJI[v.impact] ?? '⚪'} [${v.impact.toUpperCase()}] ${v.description}`, '', `**Rule:** \`${v.ruleId}\` `, `**WCAG:** ${fix?.wcagReference ?? `SC ${v.wcag} (Level ${v.level})`} `, `**Instances:** ${group.length}`, '', '**Representative element:**', `\`${v.selector}\``, '```html', v.html, '```', '');
67
+ if (others.length > 0) {
68
+ lines.push(`**Also affects ${others.length} more element${others.length > 1 ? 's' : ''} on this page:**`);
69
+ for (const o of others) {
70
+ lines.push(`- \`${o.selector}\``);
71
+ }
72
+ lines.push('');
73
+ }
58
74
  if (fix) {
59
75
  lines.push('**Why it matters:**', fix.explanation, '', '**Fixed code:**', '```html', fix.fixedCode, '```', '', '**📋 Prompt for your AI assistant (Cursor / Copilot / Claude):**', '```', fix.optimalPrompt, '```', '');
60
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wcag-a11y",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "WCAG 2.1/2.2 accessibility auditor with AI-powered fixes",
5
5
  "type": "module",
6
6
  "bin": {