ally-a11y 1.0.0

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.
Files changed (84) hide show
  1. package/ACCESSIBILITY.md +205 -0
  2. package/LICENSE +21 -0
  3. package/README.md +940 -0
  4. package/dist/cli.d.ts +7 -0
  5. package/dist/cli.js +528 -0
  6. package/dist/commands/audit-palette.d.ts +18 -0
  7. package/dist/commands/audit-palette.js +613 -0
  8. package/dist/commands/auto-pr.d.ts +19 -0
  9. package/dist/commands/auto-pr.js +434 -0
  10. package/dist/commands/badge.d.ts +11 -0
  11. package/dist/commands/badge.js +143 -0
  12. package/dist/commands/completion.d.ts +4 -0
  13. package/dist/commands/completion.js +185 -0
  14. package/dist/commands/crawl.d.ts +12 -0
  15. package/dist/commands/crawl.js +249 -0
  16. package/dist/commands/doctor.d.ts +5 -0
  17. package/dist/commands/doctor.js +233 -0
  18. package/dist/commands/explain.d.ts +12 -0
  19. package/dist/commands/explain.js +233 -0
  20. package/dist/commands/fix.d.ts +13 -0
  21. package/dist/commands/fix.js +668 -0
  22. package/dist/commands/health.d.ts +11 -0
  23. package/dist/commands/health.js +367 -0
  24. package/dist/commands/history.d.ts +10 -0
  25. package/dist/commands/history.js +191 -0
  26. package/dist/commands/init.d.ts +9 -0
  27. package/dist/commands/init.js +164 -0
  28. package/dist/commands/learn.d.ts +8 -0
  29. package/dist/commands/learn.js +592 -0
  30. package/dist/commands/pr-check.d.ts +12 -0
  31. package/dist/commands/pr-check.js +270 -0
  32. package/dist/commands/report.d.ts +11 -0
  33. package/dist/commands/report.js +375 -0
  34. package/dist/commands/scan-storybook.d.ts +18 -0
  35. package/dist/commands/scan-storybook.js +402 -0
  36. package/dist/commands/scan.d.ts +25 -0
  37. package/dist/commands/scan.js +673 -0
  38. package/dist/commands/stats.d.ts +5 -0
  39. package/dist/commands/stats.js +137 -0
  40. package/dist/commands/tree.d.ts +12 -0
  41. package/dist/commands/tree.js +635 -0
  42. package/dist/commands/triage.d.ts +13 -0
  43. package/dist/commands/triage.js +327 -0
  44. package/dist/commands/watch.d.ts +17 -0
  45. package/dist/commands/watch.js +302 -0
  46. package/dist/types/index.d.ts +60 -0
  47. package/dist/types/index.js +4 -0
  48. package/dist/utils/baseline.d.ts +62 -0
  49. package/dist/utils/baseline.js +169 -0
  50. package/dist/utils/browser.d.ts +78 -0
  51. package/dist/utils/browser.js +239 -0
  52. package/dist/utils/cache.d.ts +76 -0
  53. package/dist/utils/cache.js +178 -0
  54. package/dist/utils/config.d.ts +102 -0
  55. package/dist/utils/config.js +237 -0
  56. package/dist/utils/converters.d.ts +77 -0
  57. package/dist/utils/converters.js +200 -0
  58. package/dist/utils/copilot.d.ts +36 -0
  59. package/dist/utils/copilot.js +139 -0
  60. package/dist/utils/detect.d.ts +22 -0
  61. package/dist/utils/detect.js +197 -0
  62. package/dist/utils/enhanced-errors.d.ts +46 -0
  63. package/dist/utils/enhanced-errors.js +295 -0
  64. package/dist/utils/errors.d.ts +31 -0
  65. package/dist/utils/errors.js +149 -0
  66. package/dist/utils/fix-patterns.d.ts +56 -0
  67. package/dist/utils/fix-patterns.js +529 -0
  68. package/dist/utils/history-tracking.d.ts +94 -0
  69. package/dist/utils/history-tracking.js +230 -0
  70. package/dist/utils/history.d.ts +42 -0
  71. package/dist/utils/history.js +255 -0
  72. package/dist/utils/impact-scores.d.ts +44 -0
  73. package/dist/utils/impact-scores.js +257 -0
  74. package/dist/utils/retry.d.ts +24 -0
  75. package/dist/utils/retry.js +76 -0
  76. package/dist/utils/scanner.d.ts +74 -0
  77. package/dist/utils/scanner.js +606 -0
  78. package/dist/utils/scanner.test.d.ts +4 -0
  79. package/dist/utils/scanner.test.js +162 -0
  80. package/dist/utils/ui.d.ts +44 -0
  81. package/dist/utils/ui.js +276 -0
  82. package/mcp-server/dist/index.d.ts +8 -0
  83. package/mcp-server/dist/index.js +1923 -0
  84. package/package.json +88 -0
package/README.md ADDED
@@ -0,0 +1,940 @@
1
+ # ally
2
+
3
+ > **The only accessibility CLI with real-time auto-fix and impact scoring.**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/ally-a11y)](https://www.npmjs.com/package/ally-a11y)
6
+ [![CI](https://github.com/forbiddenlink/ally/actions/workflows/ci.yml/badge.svg)](https://github.com/forbiddenlink/ally/actions/workflows/ci.yml)
7
+ [![codecov](https://codecov.io/gh/forbiddenlink/ally/branch/main/graph/badge.svg)](https://codecov.io/gh/forbiddenlink/ally)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org/)
10
+ ![Accessibility](https://img.shields.io/badge/a11y-first-blue)
11
+
12
+ ---
13
+
14
+ ## Table of Contents
15
+
16
+ - [Key Features](#two-features-no-other-tool-has)
17
+ - [Quick Start](#installation)
18
+ - [Commands](#commands)
19
+ - [Strategic Features (Feb 2026)](#strategic-features-feb-2026)
20
+ - [Configuration](#configuration)
21
+ - [CI/CD Integration](#github-action)
22
+ - [Why Ally?](#why-ally)
23
+ - [FAQ](#faq)
24
+ - [Contributing](#contributing)
25
+
26
+ ---
27
+
28
+ ## Two Features No Other Tool Has
29
+
30
+ ### 1. Real-Time Auto-Fix (`watch --fix-on-save`)
31
+
32
+ **Fixes accessibility issues as you save files** — zero manual intervention.
33
+
34
+ ```bash
35
+ $ ally watch src/ --fix-on-save
36
+
37
+ ✓ Auto-fix: ON (confidence ≥ 90%)
38
+ 📄 Button.tsx changed
39
+ ✓ Auto-applied 2 fixes
40
+ • <button> → <button aria-label="Submit">
41
+ • <img> → <img alt="Logo">
42
+
43
+ No issues found (score: 100) ✨
44
+ ```
45
+
46
+ **Why it's unique:**
47
+ - 🔥 **Instant fixes** — No "fix later" backlog
48
+ - 🎯 **High confidence** — Only applies fixes ≥90% confidence
49
+ - ⚡ **Zero friction** — Edit files normally, ally handles the rest
50
+ - 🤖 **Pattern learning** — Learns from your fix history
51
+
52
+ ### 2. Impact Scoring (Industry-First)
53
+
54
+ **Shows which violations actually hurt users** — eliminates developer overwhelm.
55
+
56
+ ```bash
57
+ $ ally scan ./src
58
+
59
+ [!!!] CRITICAL Impact: 96/100 (WCAG A)
60
+ Links must have discernible text
61
+ 💡 Users cannot navigate your site, unable to determine link
62
+ destinations or purposes
63
+ 👥 Affects: Screen reader users, Voice control users
64
+ 📊 Estimated: 15-20% of users
65
+ File: Button.tsx:14
66
+ → a[href="#"]
67
+ ```
68
+
69
+ **Why developers love it:**
70
+ - 💯 **Prioritization** — No more guessing what to fix first
71
+ - 💡 **Business context** — Understand why violations block users
72
+ - 👥 **User impact** — See who's affected (screen readers, low vision, etc.)
73
+ - 📊 **Metrics** — Estimated % of users impacted
74
+ - 🏷️ **WCAG levels** — A, AA, or AAA compliance
75
+
76
+ **Research-backed:** Solves the #1 developer pain point — feeling overwhelmed by too many violations.
77
+
78
+ ---
79
+
80
+ ## What It Does
81
+
82
+ **Core commands (19 total):**
83
+ ```bash
84
+ # Scanning
85
+ ally scan ./src # Scan for violations with impact scores
86
+ ally watch --fix-on-save # Auto-fix issues as you save files
87
+ ally crawl <url> # Multi-page website scanning
88
+ ally scan-storybook # Scan Storybook components
89
+ ally tree <url> # View accessibility tree
90
+
91
+ # Fixing & Learning
92
+ ally fix # Interactive fix approval (35+ patterns)
93
+ ally explain # WCAG explanations + Copilot integration
94
+ ally learn <violation> # Educational deep-dive on violations
95
+ ally triage # Prioritize violations interactively
96
+
97
+ # Reporting & Progress
98
+ ally report # Generate reports (MD/HTML/JSON/SARIF/CSV)
99
+ ally history # View progress over time with trends
100
+ ally stats # Accessibility progress dashboard
101
+ ally badge # Generate score badges
102
+ ally pr-check # Post results to GitHub PRs
103
+
104
+ # Design Systems
105
+ ally audit-palette # Audit color palette for contrast
106
+
107
+ # Setup & Diagnostics
108
+ ally init # Initialize ally in your project
109
+ ally doctor # Diagnose configuration issues
110
+ ally health # Quick accessibility health check
111
+ ally completion # Shell tab completion
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Quick Demo
117
+
118
+ **With Impact Scoring:**
119
+ ```bash
120
+ $ ally scan ./src
121
+
122
+ ✔ Found 47 HTML files
123
+ ✔ Scanned 47 files
124
+
125
+ 📄 Button.tsx
126
+ [!!!] CRITICAL Impact: 98/100 (WCAG A)
127
+ Buttons must have discernible text
128
+ 💡 Users cannot activate buttons, blocking core actions
129
+ 👥 Affects: Screen reader users, Voice control users
130
+ 📊 Estimated: 15-20% of users
131
+ → button
132
+
133
+ ╭───────── Scan Results ─────────╮
134
+ │ Accessibility Score: 62/100 │
135
+ │ !!! CRITICAL: 3 │
136
+ │ !! SERIOUS: 5 │
137
+ ╰────────────────────────────────╯
138
+ ```
139
+
140
+ **Interactive Fix:**
141
+ ```bash
142
+ $ ally fix
143
+
144
+ 📝 Fixing: Button.tsx:14 — missing accessible name
145
+
146
+ - <button onClick={handleClick}>
147
+ + <button onClick={handleClick} aria-label="Submit form">
148
+
149
+ Apply this fix? [Y/n/skip] y ✓
150
+
151
+ ✅ Fixed 3/3 critical issues. Score: 62 → 78/100
152
+ ```
153
+
154
+ **Auto-Fix on Save:**
155
+ ```bash
156
+ $ ally watch src/ --fix-on-save
157
+
158
+ ✓ Watching 47 files for changes...
159
+ 📄 Button.tsx changed
160
+ ✓ Auto-applied 2 fixes (confidence ≥ 90%)
161
+ Score: 62 → 78/100 ✨
162
+ ```
163
+
164
+ ## Installation
165
+
166
+ ```bash
167
+ npm install -g ally-a11y
168
+
169
+ # Initialize in your project
170
+ ally init
171
+
172
+ # For AI-powered fixes, also install GitHub Copilot CLI
173
+ npm install -g @github/copilot-cli
174
+ copilot auth login
175
+ ```
176
+
177
+ ## Commands
178
+
179
+ ### `ally init`
180
+
181
+ Initialize ally in your project. Creates configuration files for MCP integration.
182
+
183
+ ```bash
184
+ ally init # Set up ally in current directory
185
+ ally init --force # Overwrite existing configuration
186
+ ally init --hooks # Also generate pre-commit hook
187
+ ```
188
+
189
+ **Creates:**
190
+ - `.ally/` directory for scan results
191
+ - `.copilot/mcp-config.json` for Copilot CLI integration
192
+ - `.husky/pre-commit` (with `--hooks` flag) for automated scanning
193
+
194
+ ### `ally stats`
195
+
196
+ Show your accessibility progress dashboard with score animation and history.
197
+
198
+ ```bash
199
+ ally stats # View score, trends, and progress over time
200
+ ```
201
+
202
+ **Features:**
203
+ - Animated score display
204
+ - Progress history tracking
205
+ - Motivational feedback
206
+
207
+ ### `ally history` 🆕
208
+
209
+ **View scan history and progress trends** - Track your accessibility improvements over time.
210
+
211
+ ```bash
212
+ ally history # View recent scans and trends
213
+ ally history --limit 20 # Show last 20 scans
214
+ ally history --branch main # Filter by git branch
215
+ ally history --verbose # Show detailed information
216
+ ```
217
+
218
+ **Features:**
219
+ - **Current score** with change from previous scan
220
+ - **Trend analysis** (improving/declining/stable)
221
+ - **Streak tracking** (consecutive improving scans)
222
+ - **Statistics**: Best, average, and worst scores
223
+ - **Progress metrics**: Total scans, issues fixed
224
+ - **Sparkline visualization** of score history
225
+ - **Git integration**: Shows branch and commit for each scan
226
+ - **Motivational messages** based on your progress
227
+
228
+ **Example Output:**
229
+ ```
230
+ ╭───── 📊 Accessibility Progress ─────╮
231
+ │ │
232
+ │ Current Score: 85/100 +7 │
233
+ │ │
234
+ │ Trend: ↗ improving │
235
+ │ Streak: 3 scans improving/stable │
236
+ │ │
237
+ │ Statistics: │
238
+ │ Best: 92/100 │
239
+ │ Average: 78/100 │
240
+ │ Worst: 45/100 │
241
+ │ │
242
+ │ Progress: │
243
+ │ Total scans: 15 │
244
+ │ Issues fixed: 23 fixed │
245
+ │ First scan: 2 weeks ago │
246
+ │ Last scan: just now │
247
+ │ │
248
+ ╰─────────────────────────────────────╯
249
+
250
+ Score History:
251
+ ▁▃▄▅▅▆▆▇▇██
252
+ 45 92
253
+
254
+ Recent Scans (last 5):
255
+
256
+ #15 just now 85/100 (5 issues, 47 files) [main@a1b2c3d]
257
+ #14 2 hours ago 78/100 (8 issues, 47 files) [main@e4f5g6h]
258
+ #13 1 day ago 75/100 (10 issues, 45 files) [feature/a11y@i7j8k9l]
259
+
260
+ 💡 Great momentum! You've improved for 3 consecutive scans. Keep it up!
261
+ ```
262
+
263
+ ### `ally scan [path]`
264
+
265
+ Scans HTML files for accessibility violations using axe-core. **Violations are sorted by impact score** (0-100) showing which issues hurt users most.
266
+
267
+ ```bash
268
+ ally scan ./src # Scan with impact scoring
269
+ ally scan --url http://localhost:3000 # Scan a running app
270
+ ally scan -v # Verbose (show all issues with impact data)
271
+ ally scan -o ./reports # Custom output directory
272
+ ally scan --threshold 5 # Exit with error if >5 violations (CI mode)
273
+ ally scan --ci # CI mode: minimal output
274
+ ally scan --format sarif # SARIF output for GitHub Code Scanning
275
+ ally scan --fail-on critical,serious # Fail only on specific severities
276
+ ```
277
+
278
+ **Impact Scoring Features:**
279
+ - **0-100 score** per violation based on user impact
280
+ - **Business reasoning** (e.g., "Users cannot navigate your site")
281
+ - **Affected user groups** (screen readers, low vision, keyboard-only, etc.)
282
+ - **Estimated % impact** (e.g., "15-20% of users")
283
+ - **WCAG level** (A, AA, or AAA)
284
+ - **Context-aware** (checkout pages score higher for form issues)
285
+ - **Auto-sorted** by impact (highest first)
286
+
287
+ **CI Integration:**
288
+ ```yaml
289
+ # GitHub Actions example
290
+ - run: ally scan ./src --threshold 0
291
+
292
+ # GitHub Code Scanning integration
293
+ - run: ally scan ./src --format sarif -o results.sarif
294
+ - uses: github/codeql-action/upload-sarif@v3
295
+ with:
296
+ sarif_file: results.sarif
297
+ ```
298
+
299
+ **Granular CI Control:**
300
+ ```bash
301
+ # Fail only on critical issues
302
+ ally scan ./src --fail-on critical
303
+
304
+ # Fail on critical and serious issues
305
+ ally scan ./src --fail-on critical,serious
306
+
307
+ # Valid severities: critical, serious, moderate, minor
308
+ ```
309
+
310
+ **Output:** Creates `.ally/scan.json` with detailed violation data.
311
+
312
+ ### `ally explain`
313
+
314
+ Explains each violation in plain language with WCAG references. Shows built-in explanations and suggests Copilot CLI commands for deeper analysis.
315
+
316
+ ```bash
317
+ ally explain # Explain all issues
318
+ ally explain -s critical # Only critical issues
319
+ ally explain -l 5 # Limit to 5 issues
320
+ ```
321
+
322
+ ### `ally fix`
323
+
324
+ Applies accessibility fixes using 35+ pattern-based transformations. Optionally integrates with GitHub Copilot CLI for complex fixes.
325
+
326
+ ```bash
327
+ ally fix # Interactive (approve each fix)
328
+ ally fix --auto # Auto-apply high-confidence fixes
329
+ ally fix --dry-run # Preview without changing files
330
+ ally fix -s serious # Only fix serious+ issues
331
+ ```
332
+
333
+ **Features:**
334
+ - 35+ automated fix patterns (image-alt, button-name, ARIA, etc.)
335
+ - Shows diff before applying
336
+ - Approve/reject each change
337
+ - Tracks fix history for consistency
338
+ - Optional Copilot CLI integration for complex cases
339
+
340
+ ### `ally report`
341
+
342
+ Generates an accessibility report for your repository.
343
+
344
+ ```bash
345
+ ally report # ACCESSIBILITY.md (default)
346
+ ally report -f html # HTML report
347
+ ally report -f json # JSON report
348
+ ally report -o a11y-report.md
349
+ ```
350
+
351
+ **Output:** Creates committable report with:
352
+ - Accessibility score badge
353
+ - Violations by severity
354
+ - WCAG compliance status
355
+ - Next steps
356
+
357
+ ### `ally badge`
358
+
359
+ Generate accessibility score badges for your README or documentation.
360
+
361
+ ```bash
362
+ ally badge # Print shields.io URL
363
+ ally badge --format markdown # Markdown image syntax
364
+ ally badge --format svg # Raw SVG content
365
+ ally badge --format svg --output badge.svg # Save SVG to file
366
+ ```
367
+
368
+ **Formats:**
369
+ - `url` (default) - Shields.io badge URL
370
+ - `markdown` - Ready-to-paste markdown: `![Ally Score](https://...)`
371
+ - `svg` - Raw SVG for self-hosting
372
+
373
+ **Example output:**
374
+ ```markdown
375
+ ![Ally Score](https://img.shields.io/badge/a11y-92%2F100-brightgreen)
376
+ ```
377
+
378
+ ### `ally watch` \ud83d\udd25 KILLER FEATURE
379
+
380
+ **Real-time accessibility testing with auto-fix on save.** The only tool that fixes violations as you code.
381
+
382
+ ```bash
383
+ ally watch ./src # Watch directory for changes
384
+ ally watch ./src --fix-on-save # AUTO-FIX violations as files save
385
+ ally watch ./src --debounce 500 # Custom debounce delay (ms)
386
+ ally watch ./src --clear # Clear terminal between scans
387
+ ally watch ./src --fix-on-save --verbose # Show all fixes applied
388
+ ```
389
+
390
+ **`--fix-on-save` Options:**
391
+ - Applies **35+ fix patterns** automatically
392
+ - Only fixes with **\u226590% confidence** (safe defaults)
393
+ - Shows **diff** of each auto-fix in terminal
394
+ - Tracks **stats** (files changed, fixes applied)
395
+ - **Rescans** file after applying fixes
396
+ - Works with **all file types** (HTML, JSX, Vue, Svelte, etc.)
397
+
398
+ **Why It's Unique:**
399
+ - \ud83d\udd25 **Zero friction** \u2014 Just save files normally
400
+ - \ud83c\udfaf **High confidence** \u2014 No breaking changes
401
+ - \u26a1 **Instant feedback** \u2014 See score improve in real-time
402
+ - \ud83e\udd16 **Pattern learning** \u2014 Learns from your fix history
403
+ - \ud83d\ude80 **Market-first** \u2014 No competitor has this
404
+
405
+ **Example session:**
406
+ ```bash
407
+ $ ally watch src/ --fix-on-save
408
+
409
+ \u2713 Auto-fix: ON (confidence \u2265 90%)
410
+ \u2713 Watching 47 files...
411
+
412
+ \ud83d\udcc4 Button.tsx changed
413
+ \u2713 Auto-applied 2 fixes:
414
+ \u2022 button-name: Added aria-label=\"Submit\"
415
+ \u2022 image-alt: Added alt=\"Logo\"
416
+ Score: 62 \u2192 78/100 (+16)
417
+
418
+ \ud83d\udcc4 Hero.jsx changed
419
+ \u2713 Auto-applied 1 fix:
420
+ \u2022 html-has-lang: Added lang=\"en\"
421
+ Score: 78 \u2192 85/100 (+7)
422
+
423
+ \ud83c\udf89 All violations fixed! Score: 100/100
424
+ ```
425
+
426
+ ### `ally learn`
427
+
428
+ Educational WCAG explainer. Understand violations and accessibility concepts.
429
+
430
+ ```bash
431
+ ally learn color-contrast # Learn about color-contrast violations
432
+ ally learn aria-label # Learn about ARIA labeling
433
+ ally learn --list # List all available topics
434
+ ```
435
+
436
+ **Usage:**
437
+ - Pass a violation ID from scan results to learn about that specific issue
438
+ - Includes WCAG success criteria, techniques, and real-world impact
439
+ - Provides code examples and fix patterns
440
+
441
+ **Example:**
442
+ ```bash
443
+ $ ally learn image-alt
444
+
445
+ 📚 image-alt — Images must have alternate text
446
+
447
+ WCAG: 1.1.1 Non-text Content (Level A)
448
+
449
+ Why it matters:
450
+ Screen reader users cannot perceive images without alt text.
451
+ Alt text also helps when images fail to load.
452
+
453
+ Good examples:
454
+ <img src="logo.png" alt="Acme Corp logo">
455
+ <img src="chart.png" alt="Q4 revenue: $2.3M, up 15%">
456
+ <img src="decorative.png" alt="" role="presentation">
457
+ ```
458
+
459
+ ### `ally crawl <url>`
460
+
461
+ Crawl an entire website following links and scan each page.
462
+
463
+ ```bash
464
+ ally crawl https://example.com # Crawl with defaults
465
+ ally crawl https://example.com --depth 3 # Follow links 3 levels deep
466
+ ally crawl https://example.com --limit 50 # Scan up to 50 pages
467
+ ally crawl https://example.com --no-same-origin # Follow external links too
468
+ ```
469
+
470
+ **Options:**
471
+ - `--depth <n>` - Maximum crawl depth (default: 2)
472
+ - `--limit <n>` - Maximum pages to scan (default: 10)
473
+ - `--same-origin` - Only follow links to same origin (default)
474
+
475
+ ### `ally tree <url>`
476
+
477
+ Display the accessibility tree for a URL. Shows how screen readers see your page.
478
+
479
+ ```bash
480
+ ally tree https://example.com # View a11y tree
481
+ ally tree https://example.com -d 10 # Show deeper tree
482
+ ally tree https://example.com -r button # Filter to button roles
483
+ ally tree https://example.com --json # Output as JSON
484
+ ```
485
+
486
+ **Output:**
487
+ - Visual ASCII tree with proper box-drawing characters
488
+ - Color-coded roles (landmarks=blue, headings=yellow, interactive=green)
489
+ - Shows ARIA roles, names, and properties
490
+
491
+ ### `ally triage`
492
+
493
+ Interactively categorize and prioritize accessibility issues.
494
+
495
+ ```bash
496
+ ally triage # Start interactive triage session
497
+ ```
498
+
499
+ **Features:**
500
+ - Arrow-key navigation through violations
501
+ - Categorize each issue: Fix now / Backlog / Ignore
502
+ - Saves `.allyignore` for ignored rules
503
+ - Creates `.ally/fix-queue.json` for quick fixes
504
+ - Creates `.ally/backlog.json` for deferred items
505
+
506
+ ### `ally pr-check`
507
+
508
+ Post accessibility results to a GitHub Pull Request.
509
+
510
+ ```bash
511
+ ally pr-check # Auto-detect PR in GitHub Actions
512
+ ally pr-check --pr 123 # Specify PR number manually
513
+ ally pr-check --fail-on critical # Fail CI on critical issues
514
+ ```
515
+
516
+ **Features:**
517
+ - Posts formatted comment with score and violations
518
+ - Works with GitHub CLI (`gh`)
519
+ - Auto-detects PR number in GitHub Actions
520
+ - Supports `--fail-on` for CI gates
521
+
522
+ ### `ally scan-storybook`
523
+
524
+ Scan Storybook stories for accessibility issues. Automatically discovers and tests all stories.
525
+
526
+ ```bash
527
+ ally scan-storybook # Scan localhost:6006
528
+ ally scan-storybook -u http://localhost:9009 # Custom Storybook URL
529
+ ally scan-storybook --filter "Button*" # Filter stories by pattern
530
+ ally scan-storybook -f json -o ./reports # Output as JSON
531
+ ```
532
+
533
+ **Options:**
534
+ - `-u, --url` - Storybook URL (default: http://localhost:6006)
535
+ - `-T, --timeout` - Page load timeout in ms (default: 10000)
536
+ - `-f, --filter` - Filter stories by name pattern
537
+ - `-F, --format` - Output format (default, json, csv)
538
+ - `-s, --standard` - WCAG standard (default: wcag22aa)
539
+
540
+ ### `ally audit-palette`
541
+
542
+ Audit a design system color palette for contrast issues. Supports JSON/CSS/SCSS palette files.
543
+
544
+ ```bash
545
+ ally audit-palette colors.json # Audit palette file
546
+ ally audit-palette tokens.css --apca # Include APCA contrast values
547
+ ally audit-palette palette.scss --level aaa # Require AAA compliance
548
+ ally audit-palette colors.json -f csv # Output as CSV
549
+ ```
550
+
551
+ **Options:**
552
+ - `-f, --format` - Output format (default, json, csv)
553
+ - `-l, --level` - Minimum WCAG level to pass (aa, aaa)
554
+ - `--large-text` - Use large text thresholds (3:1 for AA)
555
+ - `--apca` - Include APCA Lc values in output
556
+
557
+ ### `ally doctor`
558
+
559
+ Diagnose installation and configuration issues. Run this if ally isn't working as expected.
560
+
561
+ ```bash
562
+ ally doctor # Check installation health
563
+ ```
564
+
565
+ **Checks:**
566
+ - Node.js version compatibility
567
+ - Required dependencies installed
568
+ - Browser automation setup (Puppeteer/Playwright)
569
+ - Configuration file validity
570
+ - MCP server connectivity
571
+
572
+ ### `ally health`
573
+
574
+ Quick accessibility health check similar to `npm audit`. Get a fast overview of your project's accessibility status.
575
+
576
+ ```bash
577
+ ally health # Quick scan with summary
578
+ ally health -p ./src # Scan specific path
579
+ ally health -s wcag21aa # Use specific standard
580
+ ally health -i .ally/scan.json # Use existing scan results
581
+ ```
582
+
583
+ ### `ally completion`
584
+
585
+ Generate shell completion scripts for tab completion of commands and options.
586
+
587
+ ```bash
588
+ ally completion bash >> ~/.bashrc # Bash completion
589
+ ally completion zsh >> ~/.zshrc # Zsh completion
590
+ ally completion fish > ~/.config/fish/completions/ally.fish
591
+ ```
592
+
593
+ ## Configuration
594
+
595
+ Ally supports configuration files. Create `.allyrc.json` in your project root:
596
+
597
+ ```json
598
+ {
599
+ "scan": {
600
+ "standard": "wcag22aa",
601
+ "threshold": 5,
602
+ "failOn": ["critical", "serious"],
603
+ "ignore": ["**/node_modules/**"]
604
+ },
605
+ "report": {
606
+ "format": "markdown",
607
+ "output": "ACCESSIBILITY.md"
608
+ },
609
+ "fix": {
610
+ "autoApprove": ["image-alt", "html-has-lang"]
611
+ }
612
+ }
613
+ ```
614
+
615
+ **Supported files:**
616
+ - `.allyrc.json`
617
+ - `.allyrc` (JSON format)
618
+ - `ally.config.js` (CommonJS)
619
+
620
+ ## MCP Server Integration
621
+
622
+ Ally includes a custom MCP server that provides project-specific context to Copilot CLI:
623
+
624
+ ```json
625
+ // .copilot/mcp-config.json
626
+ {
627
+ "mcpServers": {
628
+ "ally-patterns": {
629
+ "type": "local",
630
+ "command": "node",
631
+ "args": ["./node_modules/ally-a11y/mcp-server/dist/index.js"]
632
+ }
633
+ }
634
+ }
635
+ ```
636
+
637
+ **Available Tools:**
638
+ - `get_component_patterns` - Analyzes existing ARIA patterns in your components
639
+ - `get_design_tokens` - Extracts color palette for WCAG-compliant contrast fixes
640
+ - `get_fix_history` - Returns previously applied fixes for consistency
641
+ - `get_scan_summary` - Current scan results summary
642
+ - `get_wcag_guideline` - Get full WCAG success criterion details
643
+ - `suggest_aria_pattern` - Get ARIA patterns for specific component types
644
+
645
+ ## Why Ally?
646
+
647
+ **Two industry-first features** no other tool has:
648
+
649
+ | Feature | ally | axe-cli | pa11y | Lighthouse |
650
+ |---------|------|---------|-------|------------|
651
+ | **Impact Scoring (0-100)** | ✅ | ❌ | ❌ | ❌ |
652
+ | **Auto-Fix on Save** | ✅ | ❌ | ❌ | ❌ |
653
+ | **Business Context** | ✅ | ❌ | ❌ | ❌ |
654
+ | **User Impact %** | ✅ | ❌ | ❌ | ❌ |
655
+ | Scan | ✅ | ✅ | ✅ | ✅ |
656
+ | AI Fixes (35+ patterns) | ✅ | ❌ | ❌ | ❌ |
657
+ | MCP Integration | ✅ | ❌ | ❌ | ❌ |
658
+ | Watch Mode | ✅ | ❌ | ❌ | ❌ |
659
+ | SARIF/JUnit/CSV Output | ✅ | ❌ | ✅ | ❌ |
660
+ | Report Generation | ✅ | ❌ | ❌ | ✅ |
661
+ | Badge Generation | ✅ | ❌ | ❌ | ❌ |
662
+ | Interactive Triage | ✅ | ❌ | ❌ | ❌ |
663
+ | Multi-page Crawl | ✅ | ❌ | ✅ | ✅ |
664
+ | GitHub PR Integration | ✅ | ❌ | ❌ | ❌ |
665
+ | Incremental Caching | ✅ | ❌ | ❌ | ❌ |
666
+
667
+ **What makes ally unique:**
668
+ 1. **Impact Scoring** — The only tool that prioritizes violations by real user impact (0-100 scores)
669
+ 2. **Auto-Fix on Save** — The only CLI with real-time fixing as you code
670
+ 3. **Business Context** — Explains WHY violations matter, not just WHAT is wrong
671
+ 4. **Developer Focus** — Designed to eliminate overwhelm with smart prioritization
672
+
673
+ ## GitHub Action
674
+
675
+ Use ally in your CI/CD pipeline with our official GitHub Action:
676
+
677
+ ```yaml
678
+ - uses: forbiddenlink/ally@v1
679
+ with:
680
+ path: ./src
681
+ threshold: 0 # Fail if any violations
682
+ compare-baseline: true # Check for regressions
683
+ fail-on-regression: true # Block PRs that decrease accessibility
684
+ ```
685
+
686
+ **Quick Wins Features in GitHub Action:**
687
+ - 🚀 **`max-files`** — Limit scanning to first N files for faster feedback on large projects
688
+ - 📊 **`baseline`** — Save current scan as accessibility baseline (set on main branch)
689
+ - 🔄 **`compare-baseline`** — Compare against baseline and detect regressions
690
+ - ⛔ **`fail-on-regression`** — Fail workflow if accessibility regresses
691
+
692
+ **Full Input Reference:**
693
+
694
+ | Input | Type | Default | Description |
695
+ |-------|------|---------|-------------|
696
+ | `path` | string | `.` | Directory or URL to scan |
697
+ | `threshold` | number | 0 | Max violations before failure |
698
+ | `fail-on` | string | `critical` | Violation levels: `critical,serious,moderate,minor` |
699
+ | `max-files` | number | 0 | Limit scan to first N files (Quick Win) |
700
+ | `baseline` | boolean | false | Save as baseline for regression tracking (Quick Win) |
701
+ | `compare-baseline` | boolean | false | Compare against saved baseline (Quick Win) |
702
+ | `fail-on-regression` | boolean | false | Fail if accessibility regresses (Quick Win) |
703
+
704
+ **Output Reference:**
705
+
706
+ | Output | Type | Description |
707
+ |--------|------|-------------|
708
+ | `score` | number | Overall accessibility score (0-100) |
709
+ | `violations` | number | Total accessibility violations found |
710
+ | `improved` | number | Files with improved accessibility (when comparing baseline) |
711
+ | `regressed` | number | Files with regressed accessibility (when comparing baseline) |
712
+
713
+ **📚 Workflow Documentation:**
714
+ - [Ally Workflow Guide](.github/WORKFLOW_GUIDE.md) — Complete guide with real-world examples
715
+ - [Example Workflows](.github/workflows/ally-a11y.yml) — 5 production-ready workflow templates
716
+ - Basic PR validation with regressions
717
+ - Large project with file limiting
718
+ - Monorepo with progressive scanning
719
+ - Parallel chunk processing
720
+ - Smart scanning based on changes
721
+
722
+ ## Accessible CLI
723
+
724
+ Ally practices what it preaches. The CLI respects accessibility preferences:
725
+
726
+ ```bash
727
+ NO_COLOR=1 ally scan ./src # Disable colors
728
+ ALLY_NO_COLOR=1 ally scan # Alternative env var
729
+ ```
730
+
731
+ ## Performance
732
+
733
+ Ally is optimized for speed and resource efficiency:
734
+
735
+ ### Scanning Speed
736
+ - **Cold start:** ~1-2 seconds (browser launch)
737
+ - **Per file:** ~0.75-1 second average
738
+ - **Parallel scanning:** 4 files concurrent by default
739
+ - **File caching:** Unchanged files skipped automatically
740
+
741
+ ### Performance Examples
742
+ ```bash
743
+ # Small project (10 files)
744
+ $ ally scan ./src
745
+ ✔ Completed in ~8-10 seconds
746
+
747
+ # Medium project (50 files)
748
+ $ ally scan ./src
749
+ ✔ Completed in ~45-60 seconds
750
+
751
+ # Large project (200+ files)
752
+ $ ally scan ./src
753
+ ✔ Completed in ~3-5 minutes
754
+ ```
755
+
756
+ ### Optimization Tips
757
+ ```bash
758
+ # Skip unchanged files (automatic unless --no-cache)
759
+ ally scan --no-cache ./src # Force full rescan
760
+
761
+ # Adjust parallel batch size for your system
762
+ # Default is 4 files parallel - increase for powerful machines
763
+ ally scan ./src # Uses default batch size
764
+
765
+ # Scan specific directories instead of entire project
766
+ ally scan ./src/components # Much faster than ./
767
+
768
+ # Use --url to scan already-built output
769
+ ally scan --url http://localhost:3000
770
+ ```
771
+
772
+ ### Memory Usage
773
+ - Browser instance: ~80-150 MB
774
+ - Cache index: ~50 KB per 100 scanned files
775
+ - Results in memory: Minimal (streamed to disk)
776
+
777
+ ## Strategic Features (Feb 2026)
778
+
779
+ ### 🔥 Large Project Optimization
780
+
781
+ **Handle massive codebases without timeouts** using the `--max-files` flag.
782
+
783
+ ```bash
784
+ # Scan only first 50 files (quick feedback)
785
+ ally scan . --max-files 50
786
+
787
+ # Why use this?
788
+ # • Unblocks large projects (1000+ files)
789
+ # • Get quick feedback before full scan
790
+ # • Progressive analysis workflow
791
+ ```
792
+
793
+ **Perfect for:**
794
+ - Monorepos with thousands of files
795
+ - CI environments with tight timeouts
796
+ - Initial accessibility assessment of large codebases
797
+ - Progressive improvement workflows
798
+
799
+ ---
800
+
801
+ ### 📊 Baseline & Regression Detection
802
+
803
+ **Track accessibility improvements and prevent regressions** with built-in baseline comparison.
804
+
805
+ ```bash
806
+ # Week 1: Set baseline
807
+ ally scan . --baseline
808
+ # ✓ Baseline saved! Future scans will track improvements...
809
+
810
+ # Week 2: Compare against baseline
811
+ ally scan . --compare-baseline
812
+ # 📊 Regression Analysis
813
+ # ✅ 5 improvements, 0 regressions, 2 unchanged
814
+
815
+ # CI Mode: Fail if regressions detected
816
+ ally scan . --compare-baseline --fail-on-regression
817
+ # Exit code 0 (no regressions) or 1 (regressions found)
818
+ ```
819
+
820
+ **Features:**
821
+ - **Track Progress** — See score improvements over time
822
+ - **Prevent Regressions** — Block PRs if accessibility declines
823
+ - **Team Accountability** — Visible metrics for accessibility work
824
+ - **CI/CD Integration** — Perfect for GitHub Actions, GitLab CI, etc.
825
+
826
+ **Usage in CI/CD:**
827
+ ```yaml
828
+ # GitHub Actions example
829
+ - name: Check accessibility regressions
830
+ run: ally scan . --compare-baseline --fail-on-regression
831
+
832
+ # Fails the build if any accessibility regresses
833
+ # Passes if improvements or unchanged
834
+ ```
835
+
836
+ **Commands:**
837
+ ```bash
838
+ ally scan . --baseline # Create/update baseline
839
+ ally scan . --compare-baseline # Compare & show analysis
840
+ ally scan . --compare-baseline --fail-on-regression # CI gate
841
+ ```
842
+
843
+ ---
844
+
845
+ ### 🎯 New Scan Flags
846
+
847
+ **Four powerful new flags for large projects and CI integration:**
848
+
849
+ | Flag | Purpose | Example |
850
+ |------|---------|---------|
851
+ | `--max-files <n>` | Limit to first N files | `ally scan . --max-files 100` |
852
+ | `--baseline` | Save current scan as baseline | `ally scan . --baseline` |
853
+ | `--compare-baseline` | Compare against saved baseline | `ally scan . --compare-baseline` |
854
+ | `--fail-on-regression` | Exit 1 if regressions detected | `ally scan . --compare-baseline --fail-on-regression` |
855
+
856
+ **Composable flags:**
857
+ ```bash
858
+ # Use together for powerful CI/CD workflows
859
+ ally scan . --max-files 200 --compare-baseline --fail-on-regression
860
+ ```
861
+
862
+ ---
863
+
864
+ ### Combined Workflow Example
865
+
866
+ **Real team workflow:**
867
+
868
+ ```bash
869
+ # Monday: Establish baseline on main branch
870
+ git checkout main
871
+ ally scan . --baseline
872
+ # ✓ Baseline saved (85/100 score)
873
+
874
+ # Wednesday: Feature branch work
875
+ git checkout feature/a11y-fixes
876
+ ally scan . --compare-baseline
877
+ # 📊 Regression Analysis
878
+ # ✅ 3 improvements (85 → 88)
879
+ # ✅ Ready to merge!
880
+
881
+ # CI/CD: Always check for regressions
882
+ ally scan . --compare-baseline --fail-on-regression
883
+ # ✓ No regressions (or ✗ Build fails if regressions)
884
+ ```
885
+
886
+ ---
887
+
888
+ ## Requirements
889
+
890
+ - Node.js 18+
891
+ - GitHub Copilot CLI (optional, for AI-powered explain/fix)
892
+ - Copilot subscription (Individual, Business, or Enterprise)
893
+
894
+ ## FAQ
895
+
896
+ ### Does ally work with all frameworks?
897
+
898
+ Yes! Ally scans static HTML output, so it works with React, Vue, Angular, Svelte, plain HTML, and any other framework that generates HTML.
899
+
900
+ ### Do I need GitHub Copilot CLI?
901
+
902
+ Basic scanning works without Copilot CLI. The `explain` and `fix` commands require Copilot CLI for AI-powered analysis.
903
+
904
+ ### Is my data sent anywhere?
905
+
906
+ No. All scanning happens locally using axe-core. Only when using Copilot CLI features does data go to GitHub's API.
907
+
908
+ ### Can I use this in CI/CD?
909
+
910
+ Yes! We provide a GitHub Action, and the CLI has a `--ci` mode for pipeline integration.
911
+
912
+ ### Does it support WCAG 2.0, 2.1, 2.2?
913
+
914
+ Yes! Use the `--standard` flag to specify which WCAG level (A, AA, AAA) and version (2.0, 2.1, 2.2) to test against.
915
+
916
+ ## Contributing
917
+
918
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
919
+
920
+ For understanding the codebase structure, see [ARCHITECTURE.md](ARCHITECTURE.md).
921
+
922
+ ## Security
923
+
924
+ For security issues, see [SECURITY.md](SECURITY.md).
925
+
926
+ ## License
927
+
928
+ MIT © Liz Fong-Jones
929
+
930
+ ## Acknowledgments
931
+
932
+ - Built with [axe-core](https://github.com/dequelabs/axe-core) - Industry-standard accessibility testing engine
933
+ - Powered by [GitHub Copilot CLI](https://githubnext.com/projects/copilot-cli) - AI pair programmer
934
+ - Uses [Puppeteer](https://pptr.dev/) and [Playwright](https://playwright.dev/) for browser automation
935
+
936
+ ---
937
+
938
+ **Made with care for the accessibility community**
939
+
940
+ *Simplifying WCAG compliance, one fix at a time.*