"Self-Healing" Accessibility for the Open Web
π₯ Watch the 3-Minute Video Demo here
Audit. Understand. Fix. OpenSpec doesn't just report accessibility errors. It eliminates them.
96% of the top 1,000,000 websites fail basic WCAG accessibility tests (WebAIM Million Report, 2024).
Every major accessibility tool (Lighthouse, axe DevTools, WAVE) stops at the same place: a list of violations. They hand you a report and walk away. The result? Developers are buried under cryptic rule IDs, documentation rabbit holes, and manual fixes that take hours.
The web has a massive accessibility debt. The existing tooling makes developers the ones who pay it.
OpenSpec is a lightweight, open-source CLI tool that closes the loop. It audits your HTML, understands each violation, and hands you back corrected code in seconds.
$ node index.js examples/sample.html --max 4
β‘ OpenSpec β Self-Healing Accessibility
Powered by axe-core + Llama 3 via Groq
Auditing: sample.html
Found 10 broken element(s) across 4 rule(s).
Generating fixes for the first 4 element(s)...
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
VIOLATION 1 [heading-order]
Impact: MODERATE
Ensure the order of headings is semantically correct
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π΄ BEFORE
- <h4>Our Features</h4>
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π’ AFTER (AI-generated fix)
+ <h2>Our Features</h2>
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
VIOLATION 2 [html-has-lang]
Impact: SERIOUS
Ensure every HTML document has a lang attribute
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π΄ BEFORE
- <html>
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π’ AFTER (AI-generated fix)
+ <html lang="en">
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
VIOLATION 3 [image-alt]
Impact: CRITICAL
Ensure <img> elements have alternative text or a role of none or presentation
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π΄ BEFORE
- <img src="hero.png">
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π’ AFTER (AI-generated fix)
+ <img src="hero.png" alt="Hero image">
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
VIOLATION 4 [region]
Impact: MODERATE
Ensure all page content is contained by landmarks
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π΄ BEFORE
- <img src="hero.png">
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π’ AFTER (AI-generated fix)
+ <main role="main">
+ <img src="hero.png">
+ </main>
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Done. Processed 4 of 10 violation(s) found.
βΉ 6 violation(s) not processed (run with --max <n> to process more).
βΉ Tip: run with --fix to write a corrected .fixed.html file to disk.
βΉ Tip: run with --strict to exit 1 on violations β use this in CI to gate deploys.
No boilerplate. No config files. No data leaves your machine except to the Groq inference API. Just your file, fixed.
-
π Powered by
axe-coreβ The industry-standard accessibility engine trusted by Google, Microsoft, and Deloitte. Battle-tested WCAG 2.1/2.2 rule coverage running insidejsdom, no real browser required. -
π€ Open-Weight AI Fixes β Uses Llama 3 (8B), an open-weight model, to read each violation in context and generate semantically correct HTML corrections. (Note: Currently configured to use Groq's API purely for fast, free inference during the hackathon, but the prompt architecture is provider-agnostic and fully compatible with local FOSS runners like Ollama).
-
π Audit Files or Live URLs β Point OpenSpec at a local HTML file or any live website with
--url https://example.com. No browser, no Puppeteer, no Playwright. -
πΎ Write Fixes to Disk β Pass
--fixto apply all AI-generated corrections and write the result to<filename>.fixed.html. The original is never modified. -
π¦ CI/CD Ready β Pass
--strictto exit with code1when violations are found. Use the official GitHub Action to drop it into any pipeline in seconds. -
ποΈ Tunable Depth β Pass
--max <n>to control how many violations are fixed per run. Default is 2 for speed; crank it up when you want a full sweep. -
β‘ Fast by Design β Groq's inference layer is among the fastest available. All Groq calls run concurrently, so fixing 4 violations takes the same time as fixing 1. No GPU, no Docker, no local model weights.
-
π¨ Color-Coded Terminal Diff β Every fix renders as a Before/After diff with ANSI color highlighting. Impact severity (Critical / Serious / Moderate / Minor) is color-coded at a glance.
-
π¦ Truly Lightweight β Four runtime dependencies. No Electron, no browser extension, no SaaS subscription. Runs anywhere Node.js 18+ runs.
-
π 100% Open Source β MIT licensed. The audit logic, the AI prompt, the diff renderer. All of it is yours to inspect, fork, and extend.
| Layer | Technology |
|---|---|
| Runtime | Node.js 18+ (CommonJS) |
| Accessibility Engine | axe-core + jsdom |
| AI / LLM | Llama 3 llama-3.1-8b-instant (Open-weight model) Inference provided by Groq for demo speed |
| Environment Config | dotenv |
| Terminal UI | Raw ANSI escape codes (zero extra deps) |
| License | MIT |
- Node.js v18 or higher β Download here. Verify with
node --version. - A Groq API Key β Free tier available, no credit card required. Get yours at console.groq.com.
1. Clone the repository
git clone https://github.com/codev-aryan/openspec.git
cd openspec2. Install dependencies
npm installThis installs: axe-core, jsdom, groq-sdk, dotenv.
3. Configure your environment
cp .env.example .envOpen .env and add your key:
GROQ_API_KEY=your_groq_api_key_herePrivacy note: Your API key is read locally by
dotenv. OpenSpec has no telemetry, no analytics, and no remote servers beyond the Groq inference API call you explicitly trigger.
node index.js <path-to-html-file>node index.js --url https://example.comNote: URL mode audits the initial HTML payload returned by the server. JavaScript-rendered content (SPAs) may show fewer violations than a real browser would. Static and server-rendered sites audit accurately.
node index.js examples/sample.html --fixApplies all AI-generated corrections and writes the result to sample.fixed.html in the same directory. The original file is never touched.
node index.js examples/sample.html --max 4Defaults to 2 for fast runs. Pass any number to sweep more violations in one pass. All fixes are generated concurrently, so fixing 4 takes the same time as fixing 1.
node index.js ./src/index.html --strictExits with code 1 if any violations are found, exit 0 means clean. This flag only affects the exit code, making it safe to drop into any pipeline.
All flags are composable and can appear in any order:
# Audit, fix all violations, write to disk, and fail CI if any remain
node index.js examples/sample.html --max 4 --fix --strict
# Audit a live URL and fail CI if violations are found
node index.js --url https://example.com --strictOpenSpec ships with an official GitHub Action. Add it to any workflow to automatically audit your HTML and block deployments when accessibility violations are found.
Add your Groq API key to your repository secrets:
- Go to Settings > Secrets and variables > Actions
- Click New repository secret
- Name it
GROQ_API_KEYand paste your key
name: Accessibility Audit
on: [push, pull_request]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run OpenSpec
uses: codev-aryan/openspec@main
with:
target: index.html
groq_api_key: ${{ secrets.GROQ_API_KEY }}This will audit index.html on every push and pull request. The workflow fails if any WCAG violations are found.
| Input | Required | Default | Description |
|---|---|---|---|
target |
Yes | index.html |
File path or URL to audit |
groq_api_key |
Yes | Your Groq API key | |
max |
No | 5 |
Max number of violations to process |
name: Accessibility Gate
on:
pull_request:
branches: [main]
jobs:
a11y:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Audit accessibility
uses: codev-aryan/openspec@main
with:
target: ./src/index.html
groq_api_key: ${{ secrets.GROQ_API_KEY }}
max: 10Pull requests that introduce accessibility violations will be blocked automatically.
node index.js examples/sample.htmlexamples/sample.html is a deliberately inaccessible page with violations across missing alt attributes, missing lang attribute, skipped heading levels, unlabelled inputs, icon-only buttons, non-descriptive link text, and low-contrast text. It's designed to demonstrate OpenSpec's full audit-and-fix loop out of the box.
openspec/
βββ index.js # CLI entry point and orchestrator
βββ auditor.js # axe-core + jsdom: virtual DOM audit engine (file + URL)
βββ fixer.js # Groq SDK + Llama 3: prompt engineering and fix generation
βββ diff.js # Terminal UI: ANSI color diff renderer, zero extra deps
βββ action.yml # GitHub Action definition
βββ examples/
β βββ sample.html # Deliberately broken HTML with WCAG violations
βββ .env.example # Environment variable template
βββ package.json # Node.js dependencies
βββ LICENSE # MIT License
Each module owns exactly one concern. index.js contains no business logic, only orchestration. auditor.js, fixer.js, and diff.js are independently testable and swappable without touching the rest of the codebase.
The prompt sent to Llama 3 is intentionally strict:
- The system prompt constrains the model to act as a pure code transformer, not an explainer. It must return raw HTML and nothing else.
temperature: 0.2keeps output deterministic and prevents the model from adding markdown fences, prose, or creative rewrites.- Each call receives only the single failing HTML node and its axe-core rule description. No surrounding page context that could dilute the output.
The returned string is dropped directly into the terminal diff with no post-processing required. When --fix is passed, it is applied back to the original HTML via surgical string replacement. Only the exact failing nodes are swapped, everything else is preserved byte-for-byte.
| Flag | Mode | Description |
|---|---|---|
<file> |
File | Path to a local HTML file to audit |
--url <url> |
URL | Fetch and audit a live URL |
--max <n> |
Both | Number of violations to fix per run (default: 2) |
--fix |
File only | Write AI-corrected HTML to <filename>.fixed.html |
--strict |
Both | Exit code 1 if any violations are found |
- Watch mode (
--watch) for live re-auditing on file save -
--output report.jsonflag for structured violation + fix export - Support for auditing entire directories in batch mode
- Live progress indicator while Groq fixes are being generated
Contributions are welcome. Please open an issue before submitting a pull request for significant changes.
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for details.
Built for FOSS 2026 by @codev-aryan
Making the web accessible shouldn't require a manual.