wcag-a11y 0.4.1 → 0.4.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/README.md CHANGED
@@ -87,6 +87,12 @@ wcag-a11y scan -u http://localhost:3000
87
87
 
88
88
  Add `--pages / /about /contact` to scan specific routes, or `--crawl` to follow links automatically.
89
89
 
90
+ **Optional — set your framework once:** The tool auto-detects common frameworks at runtime. If detection fails (e.g. scanning a staging URL, or using Astro/SvelteKit), set it in your config so every run uses the right syntax:
91
+
92
+ ```bash
93
+ wcag-a11y init --framework next # or react, vue, angular, svelte, astro, …
94
+ ```
95
+
90
96
  ---
91
97
 
92
98
  ## Commands
@@ -116,6 +122,7 @@ wcag-a11y scan -u http://localhost:3000 --terminal --fast-mode
116
122
  | `--group <strategy>` | `rule` | `rule`: one prompt per rule type. `none`: one prompt per element |
117
123
  | `--ci` | off | Exit with code `1` if any violations are found |
118
124
  | `--provider <name>` | from config | Override AI provider for this run |
125
+ | `--framework <name>` | from config | *(optional)* Override framework for this run. Auto-detected by default; use this when scanning staging URLs or for frameworks outside the detection list |
119
126
 
120
127
  ---
121
128
 
@@ -159,6 +166,7 @@ wcag-a11y fix --from-report --apply # patches files from that report, no s
159
166
  | `--from-report [path]` | `a11y-report.md` | Load violations from an existing report instead of rescanning |
160
167
  | `--apply` | off | Write fixes to disk (dry-run without this flag) |
161
168
  | `--provider <name>` | from config | Override AI provider for this run |
169
+ | `--framework <name>` | from config | *(optional)* Override framework for this run. Auto-detected by default; use this when scanning staging URLs or for frameworks outside the detection list |
162
170
 
163
171
  ---
164
172
 
@@ -167,13 +175,19 @@ wcag-a11y fix --from-report --apply # patches files from that report, no s
167
175
  Create `a11y.config.json` pre-configured for your chosen provider.
168
176
 
169
177
  ```bash
170
- wcag-a11y init # Gemini (free, default)
178
+ wcag-a11y init # Gemini (free, default)
171
179
  wcag-a11y init --provider openai
172
- wcag-a11y init --provider anthropic
173
- wcag-a11y init --provider ollama # local no API key needed
174
- # … and 8 more providers
180
+ wcag-a11y init --provider ollama # local — no API key needed
181
+ wcag-a11y init --provider openai --framework next # optional: save framework too
175
182
  ```
176
183
 
184
+ | Flag | Description |
185
+ |---|---|
186
+ | `--provider <name>` | AI provider. Default: `gemini`. See [AI Providers](#ai-providers) for all options |
187
+ | `--framework <name>` | *(optional)* Your project framework — saved to config so every scan uses it automatically. The tool auto-detects common frameworks; use this flag when scanning staging URLs or using a framework not in the detection list |
188
+
189
+ Accepted framework values: `next`, `react`, `vue`, `nuxt`, `angular`, `svelte`, `gatsby`, `remix`, `astro` — or any free-form string. You can also add `"framework": "next"` directly to `a11y.config.json` at any time.
190
+
177
191
  ---
178
192
 
179
193
  ### `wcag-a11y demo`
@@ -221,6 +235,16 @@ Run `wcag-a11y init` to generate `a11y.config.json`. Only fill in the fields for
221
235
  }
222
236
  ```
223
237
 
238
+ `"framework"` is optional — add it if auto-detection fails for your setup:
239
+
240
+ ```json
241
+ {
242
+ "provider": "gemini",
243
+ "apiKey": "YOUR_GEMINI_API_KEY",
244
+ "framework": "next"
245
+ }
246
+ ```
247
+
224
248
  <details>
225
249
  <summary>Full config reference (all 12 providers)</summary>
226
250
 
package/dist/cli.js CHANGED
@@ -13,13 +13,14 @@ const program = new Command();
13
13
  program
14
14
  .name('wcag-a11y')
15
15
  .description('WCAG 2.1/2.2 accessibility auditor with AI-powered fixes')
16
- .version('0.4.1');
16
+ .version('0.4.3');
17
17
  program
18
18
  .command('init')
19
19
  .description('Create a11y.config.json in the current directory')
20
20
  .option('--provider <name>', 'AI provider to configure (gemini|openai|ollama|anthropic|mistral|groq|cohere|xai|deepseek|together|perplexity|azure-openai)', 'gemini')
21
+ .option('--framework <name>', 'Your project framework — saves to config so every run uses it automatically (e.g. next, react, vue, angular, svelte, astro)')
21
22
  .action((opts) => {
22
- initConfig(opts.provider);
23
+ initConfig(opts.provider, opts.framework);
23
24
  });
24
25
  program
25
26
  .command('scan')
@@ -35,10 +36,11 @@ program
35
36
  .option('--group <strategy>', 'Group violations by rule or show individually (rule|none)', 'rule')
36
37
  .option('--ci', 'Exit with code 1 if any violations are found (for CI/CD pipelines)', false)
37
38
  .option('--provider <name>', 'Override the AI provider from config (gemini|openai|ollama|anthropic|mistral|groq|cohere|xai|deepseek|together|perplexity|azure-openai)')
39
+ .option('--framework <name>', 'Override framework detection for this run (e.g. next, react, vue, angular, svelte, astro)')
38
40
  .action(async (opts) => {
39
41
  try {
40
42
  console.log(`\nScanning ${opts.url}...`);
41
- const result = await crawl({ url: opts.url, pages: opts.pages, crawl: opts.crawl });
43
+ const result = await crawl({ url: opts.url, pages: opts.pages, crawl: opts.crawl, framework: opts.framework });
42
44
  if (opts.terminal && !opts.fastMode) {
43
45
  printTerminalReport(result);
44
46
  }
@@ -51,10 +53,11 @@ program
51
53
  const provider = createAIProvider(config);
52
54
  const allViolations = result.pages.flatMap((p) => p.violations);
53
55
  const ruleGroups = groupViolations(allViolations, strategy);
56
+ const framework = result.framework ?? config.framework;
54
57
  if (!opts.fastMode) {
55
58
  console.log(`\nGenerating AI fixes for ${ruleGroups.length} rule groups (${allViolations.length} violations)...`);
56
59
  }
57
- const fixes = await provider.generateFixes(allViolations, strategy, result.framework);
60
+ const fixes = await provider.generateFixes(allViolations, strategy, framework);
58
61
  if (opts.terminal) {
59
62
  printAIPrompts(fixes, { explain: opts.explain, fastMode: opts.fastMode });
60
63
  }
@@ -83,6 +86,7 @@ program
83
86
  .option('--from-report [path]', 'Use an existing report instead of scanning (default: a11y-report.md)')
84
87
  .option('--apply', 'Write fixes to source files (default: dry-run, shows diff only)', false)
85
88
  .option('--provider <name>', 'Override the AI provider from config (gemini|openai|ollama|anthropic|mistral|groq|cohere|xai|deepseek|together|perplexity|azure-openai)')
89
+ .option('--framework <name>', 'Override framework detection for this run (e.g. next, react, vue, angular, svelte, astro)')
86
90
  .action(async (opts) => {
87
91
  if (!opts.url && !opts.fromReport) {
88
92
  console.error('\nError: provide --url <url> to scan, or --from-report [path] to load an existing report.');
@@ -104,6 +108,7 @@ program
104
108
  apply: opts.apply,
105
109
  provider,
106
110
  srcDir: resolve(process.cwd(), 'src'),
111
+ framework: opts.framework ?? config.framework,
107
112
  });
108
113
  }
109
114
  catch (err) {
package/dist/config.js CHANGED
@@ -82,13 +82,14 @@ const STARTER_CONFIGS = {
82
82
  `Created ${CONFIG_FILE} — fill in your Azure OpenAI endpoint, deployment, and API key from https://portal.azure.com`,
83
83
  ],
84
84
  };
85
- export function initConfig(provider = 'gemini') {
85
+ export function initConfig(provider = 'gemini', framework) {
86
86
  const configPath = join(process.cwd(), CONFIG_FILE);
87
87
  if (existsSync(configPath)) {
88
88
  console.log(`${CONFIG_FILE} already exists.`);
89
89
  return;
90
90
  }
91
91
  const [starter, message] = STARTER_CONFIGS[provider];
92
- writeFileSync(configPath, JSON.stringify(starter, null, 2));
92
+ const config = framework ? { ...starter, framework } : starter;
93
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
93
94
  console.log(message);
94
95
  }
package/dist/crawler.js CHANGED
@@ -61,7 +61,7 @@ export async function crawl(options) {
61
61
  }
62
62
  }
63
63
  const results = [];
64
- let framework;
64
+ let framework = options.framework;
65
65
  for (const pageUrl of pagesToVisit) {
66
66
  const page = await context.newPage();
67
67
  try {
package/dist/fixer.js CHANGED
@@ -18,11 +18,12 @@ export async function runFix(opts) {
18
18
  console.log(chalk.green('\nNo violations found in report.'));
19
19
  return;
20
20
  }
21
+ framework = opts.framework;
21
22
  console.log(`Found ${allViolations.length} violation(s) in report. Locating source files...\n`);
22
23
  }
23
24
  else {
24
25
  console.log(`\nScanning ${opts.url}...`);
25
- const result = await crawl({ url: opts.url, pages: opts.pages, crawl: opts.crawl });
26
+ const result = await crawl({ url: opts.url, pages: opts.pages, crawl: opts.crawl, framework: opts.framework });
26
27
  framework = result.framework;
27
28
  if (result.totalViolations === 0) {
28
29
  console.log(chalk.green('\nNo violations found.'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wcag-a11y",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "WCAG 2.1/2.2 accessibility auditor with AI-powered fixes. Crawls your dev server with Playwright, runs 40+ checks, and uses AI (12 providers) to generate fix prompts or patch source files directly.",
5
5
  "keywords": [
6
6
  "wcag",