@mcptoolshop/a11y-evidence-engine 0.2.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.
- package/.github/workflows/ci.yml +53 -0
- package/CODE_OF_CONDUCT.md +129 -0
- package/CONTRIBUTING.md +128 -0
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/bin/a11y-engine.js +11 -0
- package/fixtures/bad/button-no-name.html +30 -0
- package/fixtures/bad/img-missing-alt.html +19 -0
- package/fixtures/bad/input-missing-label.html +26 -0
- package/fixtures/bad/missing-lang.html +11 -0
- package/fixtures/good/index.html +29 -0
- package/package.json +44 -0
- package/src/cli.js +74 -0
- package/src/evidence/canonicalize.js +52 -0
- package/src/evidence/json_pointer.js +34 -0
- package/src/evidence/prov_emit.js +153 -0
- package/src/fswalk.js +56 -0
- package/src/html_parse.js +117 -0
- package/src/ids.js +53 -0
- package/src/rules/document_missing_lang.js +50 -0
- package/src/rules/form_control_missing_label.js +105 -0
- package/src/rules/img_missing_alt.js +77 -0
- package/src/rules/index.js +37 -0
- package/src/rules/interactive_missing_name.js +129 -0
- package/src/scan.js +128 -0
- package/test/scan.test.js +149 -0
- package/test/vectors.test.js +200 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [18.x, 20.x, 22.x]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
cache: 'npm'
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: npm test
|
|
31
|
+
|
|
32
|
+
- name: Verify CLI works
|
|
33
|
+
run: |
|
|
34
|
+
node bin/a11y-engine.js scan fixtures/html --out test-results
|
|
35
|
+
test -d test-results
|
|
36
|
+
|
|
37
|
+
lint:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Use Node.js
|
|
44
|
+
uses: actions/setup-node@v4
|
|
45
|
+
with:
|
|
46
|
+
node-version: '20.x'
|
|
47
|
+
cache: 'npm'
|
|
48
|
+
|
|
49
|
+
- name: Install dependencies
|
|
50
|
+
run: npm ci
|
|
51
|
+
|
|
52
|
+
- name: Check for syntax errors
|
|
53
|
+
run: node --check bin/a11y-engine.js src/cli.js
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
[INSERT CONTACT METHOD].
|
|
64
|
+
|
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
66
|
+
|
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
68
|
+
reporter of any incident.
|
|
69
|
+
|
|
70
|
+
## Enforcement Guidelines
|
|
71
|
+
|
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
74
|
+
|
|
75
|
+
### 1. Correction
|
|
76
|
+
|
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
78
|
+
unprofessional or unwelcome in the community.
|
|
79
|
+
|
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
|
83
|
+
|
|
84
|
+
### 2. Warning
|
|
85
|
+
|
|
86
|
+
**Community Impact**: A violation through a single incident or series
|
|
87
|
+
of actions.
|
|
88
|
+
|
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
93
|
+
like social media. Violating these terms may lead to a temporary or
|
|
94
|
+
permanent ban.
|
|
95
|
+
|
|
96
|
+
### 3. Temporary Ban
|
|
97
|
+
|
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
|
99
|
+
sustained inappropriate behavior.
|
|
100
|
+
|
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
102
|
+
communication with the community for a specified period of time. No public or
|
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
105
|
+
Violating these terms may lead to a permanent ban.
|
|
106
|
+
|
|
107
|
+
### 4. Permanent Ban
|
|
108
|
+
|
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
112
|
+
|
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
114
|
+
the community.
|
|
115
|
+
|
|
116
|
+
## Attribution
|
|
117
|
+
|
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
119
|
+
version 2.0, available at
|
|
120
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
121
|
+
|
|
122
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
123
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
124
|
+
|
|
125
|
+
[homepage]: https://www.contributor-covenant.org
|
|
126
|
+
|
|
127
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
128
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
129
|
+
https://www.contributor-covenant.org/translations.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributing to a11y-evidence-engine
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to a11y-evidence-engine! We appreciate your help in building a robust accessibility evidence engine with provenance tracking.
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
### Reporting Issues
|
|
8
|
+
|
|
9
|
+
If you find a bug or have a suggestion:
|
|
10
|
+
|
|
11
|
+
1. Check if the issue already exists in [GitHub Issues](https://github.com/mcp-tool-shop/a11y-evidence-engine/issues)
|
|
12
|
+
2. If not, create a new issue with:
|
|
13
|
+
- A clear, descriptive title
|
|
14
|
+
- Steps to reproduce (for bugs)
|
|
15
|
+
- Expected vs. actual behavior
|
|
16
|
+
- Your environment (Node version, OS)
|
|
17
|
+
- Sample HTML if relevant
|
|
18
|
+
|
|
19
|
+
### Contributing Code
|
|
20
|
+
|
|
21
|
+
1. **Fork the repository** and create a branch from `main`
|
|
22
|
+
2. **Set up your development environment**
|
|
23
|
+
```bash
|
|
24
|
+
npm install
|
|
25
|
+
```
|
|
26
|
+
3. **Make your changes**
|
|
27
|
+
- Follow the existing code style
|
|
28
|
+
- Add tests for new functionality
|
|
29
|
+
- Ensure all tests pass: `npm test`
|
|
30
|
+
- Update documentation as needed
|
|
31
|
+
4. **Commit your changes**
|
|
32
|
+
- Use clear, descriptive commit messages
|
|
33
|
+
- Reference issue numbers when applicable
|
|
34
|
+
5. **Submit a pull request**
|
|
35
|
+
- Describe what your PR does and why
|
|
36
|
+
- Link to related issues
|
|
37
|
+
|
|
38
|
+
### Development Workflow
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Install dependencies
|
|
42
|
+
npm install
|
|
43
|
+
|
|
44
|
+
# Run tests
|
|
45
|
+
npm test
|
|
46
|
+
|
|
47
|
+
# Scan HTML files (test the CLI)
|
|
48
|
+
npm run scan -- fixtures/html/example.html
|
|
49
|
+
|
|
50
|
+
# Test the engine directly
|
|
51
|
+
node bin/a11y-engine.js scan path/to/html --out results
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Testing
|
|
55
|
+
|
|
56
|
+
All new features should include tests. Tests are located in the `test/` directory and use Node's built-in test runner.
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
// Example test structure
|
|
60
|
+
import { test } from 'node:test';
|
|
61
|
+
import assert from 'node:assert/strict';
|
|
62
|
+
|
|
63
|
+
test('should detect missing lang attribute', () => {
|
|
64
|
+
const html = '<html><head></head><body></body></html>';
|
|
65
|
+
const findings = scan(html);
|
|
66
|
+
assert.equal(findings[0].rule, 'html.document.missing_lang');
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Adding New Rules
|
|
71
|
+
|
|
72
|
+
1. Add rule implementation in `src/rules/`
|
|
73
|
+
2. Add test cases in `test/*.test.js`
|
|
74
|
+
3. Update README.md with rule documentation
|
|
75
|
+
4. Ensure provenance records are generated correctly
|
|
76
|
+
|
|
77
|
+
### Code Style
|
|
78
|
+
|
|
79
|
+
- Use ES modules (`import`/`export`)
|
|
80
|
+
- Prefer `const` over `let`
|
|
81
|
+
- Use descriptive variable names
|
|
82
|
+
- Add JSDoc comments for public APIs
|
|
83
|
+
- Follow existing patterns for consistency
|
|
84
|
+
|
|
85
|
+
### Provenance Design Principles
|
|
86
|
+
|
|
87
|
+
- **Deterministic** - Same input produces same output
|
|
88
|
+
- **Verifiable** - Evidence can be independently verified
|
|
89
|
+
- **Tamper-evident** - SHA-256 digests detect any changes
|
|
90
|
+
- **Traceable** - prov-spec records document all operations
|
|
91
|
+
- **Evidence-anchored** - Findings reference specific artifact locations (JSON Pointer)
|
|
92
|
+
|
|
93
|
+
## Project Structure
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
a11y-evidence-engine/
|
|
97
|
+
├── bin/ # CLI entry point
|
|
98
|
+
├── src/ # Source code
|
|
99
|
+
│ ├── cli.js # CLI implementation
|
|
100
|
+
│ ├── scanner.js # Core scanner
|
|
101
|
+
│ ├── rules/ # Rule implementations
|
|
102
|
+
│ └── provenance.js # Provenance generation
|
|
103
|
+
├── test/ # Test suite
|
|
104
|
+
├── fixtures/ # Test fixtures
|
|
105
|
+
└── package.json # Project configuration
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Exit Codes
|
|
109
|
+
|
|
110
|
+
Maintain CI-native exit codes:
|
|
111
|
+
- `0` - No findings with severity `error`
|
|
112
|
+
- `2` - At least one `error` finding
|
|
113
|
+
- `3` - Internal engine failure / invalid input
|
|
114
|
+
|
|
115
|
+
## Provenance Records
|
|
116
|
+
|
|
117
|
+
Ensure all findings include three prov-spec records:
|
|
118
|
+
1. `record.json` - Evidence extraction
|
|
119
|
+
2. `digest.json` - SHA-256 integrity
|
|
120
|
+
3. `envelope.json` - MCP envelope
|
|
121
|
+
|
|
122
|
+
## Code of Conduct
|
|
123
|
+
|
|
124
|
+
Please note that this project is released with a [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you agree to abide by its terms.
|
|
125
|
+
|
|
126
|
+
## Questions?
|
|
127
|
+
|
|
128
|
+
Open an issue or start a discussion. We're here to help!
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mcp-tool-shop
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# a11y-evidence-engine
|
|
2
|
+
|
|
3
|
+
Headless accessibility evidence engine that emits [prov-spec](https://github.com/mcp-tool-shop/prov-spec) provenance records.
|
|
4
|
+
|
|
5
|
+
Designed to pair with **a11y-assist**: this engine finds issues and captures verifiable evidence; a11y-assist turns those findings into fixes.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Deterministic output**: Same input always produces identical findings and provenance
|
|
10
|
+
- **prov-spec compatible**: Every finding includes cryptographically verifiable evidence
|
|
11
|
+
- **CI-friendly**: Exit codes designed for automation
|
|
12
|
+
- **No browser required**: Pure static HTML analysis
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g a11y-evidence-engine
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Scan a file or directory
|
|
24
|
+
a11y-engine scan ./path/to/html --out ./results
|
|
25
|
+
|
|
26
|
+
# View help
|
|
27
|
+
a11y-engine --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Output
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
results/
|
|
34
|
+
├── findings.json # All findings with metadata
|
|
35
|
+
└── provenance/
|
|
36
|
+
└── finding-0001/
|
|
37
|
+
├── record.json # engine.extract.evidence.json_pointer
|
|
38
|
+
├── digest.json # integrity.digest.sha256
|
|
39
|
+
└── envelope.json # adapter.wrap.envelope_v0_1
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Exit Codes
|
|
43
|
+
|
|
44
|
+
| Code | Meaning |
|
|
45
|
+
|------|---------|
|
|
46
|
+
| 0 | No findings with severity `error` |
|
|
47
|
+
| 2 | At least one `error` finding |
|
|
48
|
+
| 3 | Internal engine failure / invalid input |
|
|
49
|
+
|
|
50
|
+
## Rules (v0.1.0)
|
|
51
|
+
|
|
52
|
+
| Rule ID | Description |
|
|
53
|
+
|---------|-------------|
|
|
54
|
+
| `html.document.missing_lang` | `<html>` element missing `lang` attribute |
|
|
55
|
+
| `html.img.missing_alt` | `<img>` element missing `alt` attribute |
|
|
56
|
+
| `html.form_control.missing_label` | Form control missing associated label |
|
|
57
|
+
| `html.interactive.missing_name` | Interactive element missing accessible name |
|
|
58
|
+
|
|
59
|
+
## Provenance
|
|
60
|
+
|
|
61
|
+
Each finding includes three prov-spec records:
|
|
62
|
+
|
|
63
|
+
1. **record.json**: Evidence extraction using `engine.extract.evidence.json_pointer`
|
|
64
|
+
2. **digest.json**: SHA-256 hash of canonical evidence using `integrity.digest.sha256`
|
|
65
|
+
3. **envelope.json**: Wrapped result using `adapter.wrap.envelope_v0_1`
|
|
66
|
+
|
|
67
|
+
These records are independently verifiable without trusting the engine.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Buttons Without Names</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Interactive Elements</h1>
|
|
9
|
+
|
|
10
|
+
<!-- Empty button -->
|
|
11
|
+
<button type="button"></button>
|
|
12
|
+
|
|
13
|
+
<!-- Icon button without label -->
|
|
14
|
+
<button type="button" class="icon-btn">
|
|
15
|
+
<span class="icon"></span>
|
|
16
|
+
</button>
|
|
17
|
+
|
|
18
|
+
<!-- Empty link -->
|
|
19
|
+
<a href="/somewhere"></a>
|
|
20
|
+
|
|
21
|
+
<!-- This is fine -->
|
|
22
|
+
<button type="submit">Submit Form</button>
|
|
23
|
+
|
|
24
|
+
<!-- This is fine (has aria-label) -->
|
|
25
|
+
<button type="button" aria-label="Close dialog"></button>
|
|
26
|
+
|
|
27
|
+
<!-- This is fine (has title) -->
|
|
28
|
+
<a href="/help" title="Get Help"></a>
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Missing Alt Text</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Images Without Alt</h1>
|
|
9
|
+
|
|
10
|
+
<!-- This image is missing alt text -->
|
|
11
|
+
<img src="photo.jpg">
|
|
12
|
+
|
|
13
|
+
<!-- This one too -->
|
|
14
|
+
<img src="banner.png" class="hero">
|
|
15
|
+
|
|
16
|
+
<!-- This is fine (decorative) -->
|
|
17
|
+
<img src="divider.gif" role="presentation">
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Missing Labels</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Form Without Labels</h1>
|
|
9
|
+
|
|
10
|
+
<form>
|
|
11
|
+
<!-- Missing label -->
|
|
12
|
+
<input type="text" name="username" placeholder="Username">
|
|
13
|
+
|
|
14
|
+
<!-- Missing label -->
|
|
15
|
+
<input type="password" name="password">
|
|
16
|
+
|
|
17
|
+
<!-- This is fine (has aria-label) -->
|
|
18
|
+
<input type="search" aria-label="Search the site">
|
|
19
|
+
|
|
20
|
+
<!-- This is fine (hidden) -->
|
|
21
|
+
<input type="hidden" name="token" value="abc">
|
|
22
|
+
|
|
23
|
+
<button type="submit">Login</button>
|
|
24
|
+
</form>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Accessible Page</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<h1>Welcome</h1>
|
|
9
|
+
|
|
10
|
+
<img src="logo.png" alt="Company Logo">
|
|
11
|
+
<img src="decorative.png" role="presentation">
|
|
12
|
+
|
|
13
|
+
<form>
|
|
14
|
+
<label for="name">Name:</label>
|
|
15
|
+
<input type="text" id="name" name="name">
|
|
16
|
+
|
|
17
|
+
<label for="email">Email:</label>
|
|
18
|
+
<input type="email" id="email" name="email">
|
|
19
|
+
|
|
20
|
+
<input type="hidden" name="csrf" value="token">
|
|
21
|
+
<button type="submit">Submit</button>
|
|
22
|
+
</form>
|
|
23
|
+
|
|
24
|
+
<nav>
|
|
25
|
+
<a href="/home">Home</a>
|
|
26
|
+
<a href="/about">About Us</a>
|
|
27
|
+
</nav>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mcptoolshop/a11y-evidence-engine",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Headless accessibility evidence engine with prov-spec provenance",
|
|
5
|
+
"main": "src/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"a11y-engine": "./bin/a11y-engine.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "node --test test/*.test.js",
|
|
11
|
+
"scan": "node bin/a11y-engine.js scan"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"accessibility",
|
|
15
|
+
"a11y",
|
|
16
|
+
"wcag",
|
|
17
|
+
"provenance",
|
|
18
|
+
"prov-spec",
|
|
19
|
+
"evidence",
|
|
20
|
+
"testing",
|
|
21
|
+
"headless"
|
|
22
|
+
],
|
|
23
|
+
"author": "mcp-tool-shop <64996768+mcp-tool-shop@users.noreply.github.com>",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"homepage": "https://github.com/mcp-tool-shop/a11y-evidence-engine#readme",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/mcp-tool-shop/a11y-evidence-engine.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/mcp-tool-shop/a11y-evidence-engine/issues"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.0.0"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public",
|
|
38
|
+
"registry": "https://registry.npmjs.org"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"htmlparser2": "^9.1.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {}
|
|
44
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { scan } = require("./scan.js");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const HELP = `
|
|
7
|
+
a11y-engine - Headless accessibility evidence engine
|
|
8
|
+
|
|
9
|
+
USAGE:
|
|
10
|
+
a11y-engine scan <path> --out <dir> Scan HTML files and emit findings
|
|
11
|
+
a11y-engine --help Show this help
|
|
12
|
+
|
|
13
|
+
OPTIONS:
|
|
14
|
+
--out <dir> Output directory for findings.json and provenance (default: ./out)
|
|
15
|
+
|
|
16
|
+
EXIT CODES:
|
|
17
|
+
0 No findings with severity 'error'
|
|
18
|
+
2 At least one 'error' finding
|
|
19
|
+
3 Internal engine failure / invalid input
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
async function run(args) {
|
|
23
|
+
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
24
|
+
console.log(HELP);
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const command = args[0];
|
|
29
|
+
|
|
30
|
+
if (command === "scan") {
|
|
31
|
+
return runScan(args.slice(1));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
console.error(`Unknown command: ${command}`);
|
|
35
|
+
console.log(HELP);
|
|
36
|
+
return 3;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function runScan(args) {
|
|
40
|
+
// Parse arguments
|
|
41
|
+
let targetPath = null;
|
|
42
|
+
let outDir = "./out";
|
|
43
|
+
|
|
44
|
+
for (let i = 0; i < args.length; i++) {
|
|
45
|
+
if (args[i] === "--out" && args[i + 1]) {
|
|
46
|
+
outDir = args[++i];
|
|
47
|
+
} else if (!args[i].startsWith("-")) {
|
|
48
|
+
targetPath = args[i];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!targetPath) {
|
|
53
|
+
console.error("Error: No target path specified");
|
|
54
|
+
return 3;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
const result = await scan(targetPath, outDir);
|
|
59
|
+
|
|
60
|
+
console.log(`Scanned ${result.summary.files_scanned} file(s)`);
|
|
61
|
+
console.log(` Errors: ${result.summary.errors}`);
|
|
62
|
+
console.log(` Warnings: ${result.summary.warnings}`);
|
|
63
|
+
console.log(` Info: ${result.summary.info}`);
|
|
64
|
+
console.log(`\nOutput: ${path.resolve(outDir)}/findings.json`);
|
|
65
|
+
|
|
66
|
+
// Exit code based on error count
|
|
67
|
+
return result.summary.errors > 0 ? 2 : 0;
|
|
68
|
+
} catch (err) {
|
|
69
|
+
console.error(`Scan failed: ${err.message}`);
|
|
70
|
+
return 3;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
module.exports = { run };
|