@mcptoolshop/accessibility-suite 0.1.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 +63 -0
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/docs/prov-spec/.github/workflows/ci.yml +68 -0
- package/docs/prov-spec/CHANGELOG.md +69 -0
- package/docs/prov-spec/CODE_OF_CONDUCT.md +129 -0
- package/docs/prov-spec/CONFORMANCE_LEVELS.md +223 -0
- package/docs/prov-spec/CONTRIBUTING.md +145 -0
- package/docs/prov-spec/IMPLEMENTER_CHECKLIST.md +137 -0
- package/docs/prov-spec/LICENSE +21 -0
- package/docs/prov-spec/PRESS_RELEASE.md +74 -0
- package/docs/prov-spec/README.md +182 -0
- package/docs/prov-spec/SETUP.md +135 -0
- package/docs/prov-spec/WHY.md +86 -0
- package/docs/prov-spec/examples/artifact.example.json +14 -0
- package/docs/prov-spec/examples/artifact.ref.example.json +9 -0
- package/docs/prov-spec/examples/evidence.example.json +6 -0
- package/docs/prov-spec/examples/mcp.envelope.example.json +97 -0
- package/docs/prov-spec/examples/mcp.request.example.json +28 -0
- package/docs/prov-spec/examples/prov.record.example.json +35 -0
- package/docs/prov-spec/interop/PROOF_NODE_ENGINE.md +114 -0
- package/docs/prov-spec/spec/MCP_COMPATIBILITY.md +241 -0
- package/docs/prov-spec/spec/PROV_METHODS_CATALOG.md +142 -0
- package/docs/prov-spec/spec/PROV_METHODS_SPEC.md +397 -0
- package/docs/prov-spec/spec/methods.json +213 -0
- package/docs/prov-spec/spec/schemas/artifact.ref.schema.v0.1.json +58 -0
- package/docs/prov-spec/spec/schemas/artifact.schema.v0.1.json +61 -0
- package/docs/prov-spec/spec/schemas/assist.request.schema.v0.1.json +52 -0
- package/docs/prov-spec/spec/schemas/assist.response.schema.v0.1.json +70 -0
- package/docs/prov-spec/spec/schemas/cli.error.schema.v0.1.json +78 -0
- package/docs/prov-spec/spec/schemas/evidence.schema.v0.1.json +37 -0
- package/docs/prov-spec/spec/schemas/mcp.envelope.schema.v0.1.json +141 -0
- package/docs/prov-spec/spec/schemas/mcp.request.schema.v0.1.json +79 -0
- package/docs/prov-spec/spec/schemas/methods.schema.json +93 -0
- package/docs/prov-spec/spec/schemas/prov-capabilities.schema.json +122 -0
- package/docs/prov-spec/spec/schemas/prov.record.schema.v0.1.json +133 -0
- package/docs/prov-spec/spec/vectors/adapter.wrap.envelope_v0_1/expected.json +4 -0
- package/docs/prov-spec/spec/vectors/adapter.wrap.envelope_v0_1/input.json +1 -0
- package/docs/prov-spec/spec/vectors/adapter.wrap.envelope_v0_1/negative/double_wrapped.json +14 -0
- package/docs/prov-spec/spec/vectors/adapter.wrap.envelope_v0_1/negative/wrong_schema_version.json +11 -0
- package/docs/prov-spec/spec/vectors/engine.extract.evidence.json_pointer/expected.json +24 -0
- package/docs/prov-spec/spec/vectors/engine.extract.evidence.json_pointer/input.json +8 -0
- package/docs/prov-spec/spec/vectors/integrity.digest.sha256/expected.json +7 -0
- package/docs/prov-spec/spec/vectors/integrity.digest.sha256/input.json +1 -0
- package/docs/prov-spec/spec/vectors/integrity.digest.sha256/negative/non_hex_chars.json +16 -0
- package/docs/prov-spec/spec/vectors/integrity.digest.sha256/negative/uppercase_hex.json +16 -0
- package/docs/prov-spec/spec/vectors/integrity.digest.sha256/negative/wrong_length.json +16 -0
- package/docs/prov-spec/spec/vectors/method_id_syntax/negative/hyphen_separator.json +8 -0
- package/docs/prov-spec/spec/vectors/method_id_syntax/negative/reserved_namespace.json +8 -0
- package/docs/prov-spec/spec/vectors/method_id_syntax/negative/starts_with_digit.json +8 -0
- package/docs/prov-spec/spec/vectors/method_id_syntax/negative/uppercase.json +8 -0
- package/docs/prov-spec/spec/vectors/method_id_syntax/positive/valid_ids.json +18 -0
- package/docs/prov-spec/tools/python/prov_validator.py +428 -0
- package/examples/a11y-demo-site/.github/workflows/a11y-artifacts.yml +81 -0
- package/examples/a11y-demo-site/.github/workflows/a11y.yml +34 -0
- package/examples/a11y-demo-site/CODE_OF_CONDUCT.md +129 -0
- package/examples/a11y-demo-site/CONTRIBUTING.md +83 -0
- package/examples/a11y-demo-site/LICENSE +21 -0
- package/examples/a11y-demo-site/README.md +155 -0
- package/examples/a11y-demo-site/html/contact.html +15 -0
- package/examples/a11y-demo-site/html/index.html +20 -0
- package/examples/a11y-demo-site/scripts/a11y.sh +20 -0
- package/package.json +26 -0
- package/src/a11y-assist/.github/workflows/publish.yml +52 -0
- package/src/a11y-assist/.github/workflows/test.yml +30 -0
- package/src/a11y-assist/A11Y_ASSIST_TEST_COVERAGE_REQUIREMENTS.md +104 -0
- package/src/a11y-assist/CODE_OF_CONDUCT.md +129 -0
- package/src/a11y-assist/CONTRIBUTING.md +98 -0
- package/src/a11y-assist/ENGINE.md +363 -0
- package/src/a11y-assist/LICENSE +21 -0
- package/src/a11y-assist/PRESS_RELEASE.md +71 -0
- package/src/a11y-assist/QUICKSTART.md +101 -0
- package/src/a11y-assist/README.md +192 -0
- package/src/a11y-assist/RELEASE_NOTES.md +319 -0
- package/src/a11y-assist/a11y_assist/__init__.py +3 -0
- package/src/a11y-assist/a11y_assist/cli.py +599 -0
- package/src/a11y-assist/a11y_assist/from_cli_error.py +149 -0
- package/src/a11y-assist/a11y_assist/guard.py +444 -0
- package/src/a11y-assist/a11y_assist/ingest.py +407 -0
- package/src/a11y-assist/a11y_assist/methods.py +137 -0
- package/src/a11y-assist/a11y_assist/parse_raw.py +71 -0
- package/src/a11y-assist/a11y_assist/profiles/__init__.py +29 -0
- package/src/a11y-assist/a11y_assist/profiles/cognitive_load.py +245 -0
- package/src/a11y-assist/a11y_assist/profiles/cognitive_load_render.py +86 -0
- package/src/a11y-assist/a11y_assist/profiles/dyslexia.py +144 -0
- package/src/a11y-assist/a11y_assist/profiles/dyslexia_render.py +77 -0
- package/src/a11y-assist/a11y_assist/profiles/plain_language.py +119 -0
- package/src/a11y-assist/a11y_assist/profiles/plain_language_render.py +66 -0
- package/src/a11y-assist/a11y_assist/profiles/screen_reader.py +348 -0
- package/src/a11y-assist/a11y_assist/profiles/screen_reader_render.py +89 -0
- package/src/a11y-assist/a11y_assist/render.py +95 -0
- package/src/a11y-assist/a11y_assist/schemas/assist.request.schema.v0.1.json +52 -0
- package/src/a11y-assist/a11y_assist/schemas/assist.response.schema.v0.1.json +70 -0
- package/src/a11y-assist/a11y_assist/schemas/cli.error.schema.v0.1.json +78 -0
- package/src/a11y-assist/a11y_assist/storage.py +31 -0
- package/src/a11y-assist/pyproject.toml +60 -0
- package/src/a11y-assist/tests/__init__.py +1 -0
- package/src/a11y-assist/tests/fixtures/base_inputs/cli_error_high.json +18 -0
- package/src/a11y-assist/tests/fixtures/base_inputs/cli_error_medium.json +16 -0
- package/src/a11y-assist/tests/fixtures/base_inputs/raw_text_low.txt +3 -0
- package/src/a11y-assist/tests/fixtures/cli_error_good.json +9 -0
- package/src/a11y-assist/tests/fixtures/cli_error_missing_id.json +7 -0
- package/src/a11y-assist/tests/fixtures/cli_error_string_format.json +7 -0
- package/src/a11y-assist/tests/fixtures/expected/cognitive_load_high.txt +20 -0
- package/src/a11y-assist/tests/fixtures/expected/dyslexia_high.txt +20 -0
- package/src/a11y-assist/tests/fixtures/expected/lowvision_high.txt +18 -0
- package/src/a11y-assist/tests/fixtures/expected/plain_language_high.txt +14 -0
- package/src/a11y-assist/tests/fixtures/expected/screen_reader_high.txt +19 -0
- package/src/a11y-assist/tests/fixtures/golden_screen_reader_cli_error.txt +16 -0
- package/src/a11y-assist/tests/fixtures/golden_screen_reader_raw_no_id.txt +14 -0
- package/src/a11y-assist/tests/fixtures/golden_screen_reader_raw_with_id.txt +14 -0
- package/src/a11y-assist/tests/fixtures/raw_good.txt +11 -0
- package/src/a11y-assist/tests/fixtures/raw_no_id.txt +2 -0
- package/src/a11y-assist/tests/test_cognitive_load.py +469 -0
- package/src/a11y-assist/tests/test_dyslexia.py +337 -0
- package/src/a11y-assist/tests/test_explain.py +74 -0
- package/src/a11y-assist/tests/test_golden.py +127 -0
- package/src/a11y-assist/tests/test_guard.py +819 -0
- package/src/a11y-assist/tests/test_guard_integration.py +457 -0
- package/src/a11y-assist/tests/test_ingest.py +311 -0
- package/src/a11y-assist/tests/test_methods_metadata.py +236 -0
- package/src/a11y-assist/tests/test_plain_language.py +348 -0
- package/src/a11y-assist/tests/test_render.py +117 -0
- package/src/a11y-assist/tests/test_screen_reader.py +703 -0
- package/src/a11y-assist/tests/test_storage_last.py +61 -0
- package/src/a11y-assist/tests/test_triage.py +86 -0
- package/src/a11y-ci/.github/workflows/ci.yml +43 -0
- package/src/a11y-ci/.github/workflows/test.yml +30 -0
- package/src/a11y-ci/A11Y_CI_TEST_COVERAGE_REQUIREMENTS.md +94 -0
- package/src/a11y-ci/CODE_OF_CONDUCT.md +129 -0
- package/src/a11y-ci/CONTRIBUTING.md +142 -0
- package/src/a11y-ci/LICENSE +21 -0
- package/src/a11y-ci/README.md +105 -0
- package/src/a11y-ci/a11y_ci/__init__.py +3 -0
- package/src/a11y-ci/a11y_ci/allowlist.py +83 -0
- package/src/a11y-ci/a11y_ci/cli.py +145 -0
- package/src/a11y-ci/a11y_ci/gate.py +131 -0
- package/src/a11y-ci/a11y_ci/render.py +48 -0
- package/src/a11y-ci/a11y_ci/schemas/allowlist.schema.json +24 -0
- package/src/a11y-ci/a11y_ci/scorecard.py +99 -0
- package/src/a11y-ci/npm/package.json +35 -0
- package/src/a11y-ci/pyproject.toml +64 -0
- package/src/a11y-ci/tests/__init__.py +1 -0
- package/src/a11y-ci/tests/fixtures/allowlist_expired.json +10 -0
- package/src/a11y-ci/tests/fixtures/allowlist_ok.json +10 -0
- package/src/a11y-ci/tests/fixtures/baseline_ok.json +7 -0
- package/src/a11y-ci/tests/fixtures/current_fail.json +6 -0
- package/src/a11y-ci/tests/fixtures/current_ok.json +6 -0
- package/src/a11y-ci/tests/fixtures/current_regresses.json +7 -0
- package/src/a11y-ci/tests/test_gate.py +134 -0
- package/src/a11y-evidence-engine/.github/workflows/ci.yml +53 -0
- package/src/a11y-evidence-engine/CODE_OF_CONDUCT.md +129 -0
- package/src/a11y-evidence-engine/CONTRIBUTING.md +128 -0
- package/src/a11y-evidence-engine/LICENSE +21 -0
- package/src/a11y-evidence-engine/README.md +71 -0
- package/src/a11y-evidence-engine/bin/a11y-engine.js +11 -0
- package/src/a11y-evidence-engine/fixtures/bad/button-no-name.html +30 -0
- package/src/a11y-evidence-engine/fixtures/bad/img-missing-alt.html +19 -0
- package/src/a11y-evidence-engine/fixtures/bad/input-missing-label.html +26 -0
- package/src/a11y-evidence-engine/fixtures/bad/missing-lang.html +11 -0
- package/src/a11y-evidence-engine/fixtures/good/index.html +29 -0
- package/src/a11y-evidence-engine/package-lock.json +109 -0
- package/src/a11y-evidence-engine/package.json +45 -0
- package/src/a11y-evidence-engine/src/cli.js +74 -0
- package/src/a11y-evidence-engine/src/evidence/canonicalize.js +52 -0
- package/src/a11y-evidence-engine/src/evidence/json_pointer.js +34 -0
- package/src/a11y-evidence-engine/src/evidence/prov_emit.js +153 -0
- package/src/a11y-evidence-engine/src/fswalk.js +56 -0
- package/src/a11y-evidence-engine/src/html_parse.js +117 -0
- package/src/a11y-evidence-engine/src/ids.js +53 -0
- package/src/a11y-evidence-engine/src/rules/document_missing_lang.js +50 -0
- package/src/a11y-evidence-engine/src/rules/form_control_missing_label.js +105 -0
- package/src/a11y-evidence-engine/src/rules/img_missing_alt.js +77 -0
- package/src/a11y-evidence-engine/src/rules/index.js +37 -0
- package/src/a11y-evidence-engine/src/rules/interactive_missing_name.js +129 -0
- package/src/a11y-evidence-engine/src/scan.js +128 -0
- package/src/a11y-evidence-engine/test/scan.test.js +149 -0
- package/src/a11y-evidence-engine/test/vectors.test.js +200 -0
- package/src/a11y-lint/.github/workflows/ci.yml +46 -0
- package/src/a11y-lint/.github/workflows/test.yml +34 -0
- package/src/a11y-lint/CODE_OF_CONDUCT.md +129 -0
- package/src/a11y-lint/CONTRIBUTING.md +70 -0
- package/src/a11y-lint/GOVERNANCE.md +57 -0
- package/src/a11y-lint/LICENSE +21 -0
- package/src/a11y-lint/PRESS_RELEASE.md +50 -0
- package/src/a11y-lint/README.md +276 -0
- package/src/a11y-lint/RELEASE_NOTES.md +57 -0
- package/src/a11y-lint/RELEASING.md +57 -0
- package/src/a11y-lint/a11y_lint/__init__.py +64 -0
- package/src/a11y-lint/a11y_lint/cli.py +319 -0
- package/src/a11y-lint/a11y_lint/errors.py +252 -0
- package/src/a11y-lint/a11y_lint/render.py +293 -0
- package/src/a11y-lint/a11y_lint/report_md.py +289 -0
- package/src/a11y-lint/a11y_lint/scan_cli_text.py +434 -0
- package/src/a11y-lint/a11y_lint/schemas/cli.error.schema.v0.1.json +83 -0
- package/src/a11y-lint/a11y_lint/scorecard.py +244 -0
- package/src/a11y-lint/a11y_lint/validate.py +225 -0
- package/src/a11y-lint/pyproject.toml +75 -0
- package/src/a11y-lint/tests/__init__.py +1 -0
- package/src/a11y-lint/tests/test_cli.py +200 -0
- package/src/a11y-lint/tests/test_errors.py +188 -0
- package/src/a11y-lint/tests/test_render.py +202 -0
- package/src/a11y-lint/tests/test_report_md.py +188 -0
- package/src/a11y-lint/tests/test_scan_cli_text.py +290 -0
- package/src/a11y-lint/tests/test_scorecard.py +195 -0
- package/src/a11y-lint/tests/test_validate.py +257 -0
- package/src/a11y-mcp-tools/.github/workflows/ci.yml +53 -0
- package/src/a11y-mcp-tools/CODE_OF_CONDUCT.md +129 -0
- package/src/a11y-mcp-tools/CONTRIBUTING.md +136 -0
- package/src/a11y-mcp-tools/LICENSE +21 -0
- package/src/a11y-mcp-tools/PROV_METHODS_CATALOG.md +104 -0
- package/src/a11y-mcp-tools/README.md +168 -0
- package/src/a11y-mcp-tools/bin/cli.js +452 -0
- package/src/a11y-mcp-tools/bin/server.js +244 -0
- package/src/a11y-mcp-tools/fixtures/requests/a11y.diagnose.ok.json +27 -0
- package/src/a11y-mcp-tools/fixtures/requests/a11y.evidence.ok.json +25 -0
- package/src/a11y-mcp-tools/fixtures/responses/a11y.diagnose.ok.json +139 -0
- package/src/a11y-mcp-tools/fixtures/responses/a11y.diagnose.provenance_fail.json +13 -0
- package/src/a11y-mcp-tools/fixtures/responses/a11y.evidence.ok.json +88 -0
- package/src/a11y-mcp-tools/package-lock.json +189 -0
- package/src/a11y-mcp-tools/package.json +49 -0
- package/src/a11y-mcp-tools/src/envelope.js +197 -0
- package/src/a11y-mcp-tools/src/index.js +9 -0
- package/src/a11y-mcp-tools/src/schemas/artifact.js +85 -0
- package/src/a11y-mcp-tools/src/schemas/diagnosis.schema.v0.1.json +137 -0
- package/src/a11y-mcp-tools/src/schemas/envelope.schema.v0.1.json +108 -0
- package/src/a11y-mcp-tools/src/schemas/evidence.bundle.schema.v0.1.json +129 -0
- package/src/a11y-mcp-tools/src/schemas/evidence.js +97 -0
- package/src/a11y-mcp-tools/src/schemas/index.js +11 -0
- package/src/a11y-mcp-tools/src/schemas/provenance.js +140 -0
- package/src/a11y-mcp-tools/src/schemas/tools/a11y.diagnose.request.schema.v0.1.json +77 -0
- package/src/a11y-mcp-tools/src/schemas/tools/a11y.diagnose.response.schema.v0.1.json +50 -0
- package/src/a11y-mcp-tools/src/schemas/tools/a11y.evidence.request.schema.v0.1.json +120 -0
- package/src/a11y-mcp-tools/src/schemas/tools/a11y.evidence.response.schema.v0.1.json +50 -0
- package/src/a11y-mcp-tools/src/tools/diagnose.js +597 -0
- package/src/a11y-mcp-tools/src/tools/evidence.js +481 -0
- package/src/a11y-mcp-tools/src/tools/index.js +10 -0
- package/src/a11y-mcp-tools/test/contract.test.mjs +154 -0
- package/src/a11y-mcp-tools/test/diagnose.test.js +485 -0
- package/src/a11y-mcp-tools/test/evidence.test.js +183 -0
- package/src/a11y-mcp-tools/test/schema.test.js +327 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"""Tests for validate module."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import pytest
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import tempfile
|
|
7
|
+
|
|
8
|
+
from a11y_lint.validate import (
|
|
9
|
+
validate_dict,
|
|
10
|
+
validate_message,
|
|
11
|
+
is_valid,
|
|
12
|
+
validate_json_file,
|
|
13
|
+
validate_and_convert,
|
|
14
|
+
MessageValidator,
|
|
15
|
+
load_schema,
|
|
16
|
+
)
|
|
17
|
+
from a11y_lint.errors import A11yMessage, Level
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class TestLoadSchema:
|
|
21
|
+
"""Tests for schema loading."""
|
|
22
|
+
|
|
23
|
+
def test_schema_loads(self) -> None:
|
|
24
|
+
schema = load_schema()
|
|
25
|
+
assert schema["title"] == "CLI Ground Truth Message"
|
|
26
|
+
assert "properties" in schema
|
|
27
|
+
assert "level" in schema["properties"]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TestValidateDict:
|
|
31
|
+
"""Tests for validate_dict function."""
|
|
32
|
+
|
|
33
|
+
def test_valid_ok_message(self) -> None:
|
|
34
|
+
data = {
|
|
35
|
+
"level": "OK",
|
|
36
|
+
"code": "TST001",
|
|
37
|
+
"what": "Test passed",
|
|
38
|
+
}
|
|
39
|
+
errors = validate_dict(data)
|
|
40
|
+
assert errors == []
|
|
41
|
+
|
|
42
|
+
def test_valid_error_message(self) -> None:
|
|
43
|
+
data = {
|
|
44
|
+
"level": "ERROR",
|
|
45
|
+
"code": "TST001",
|
|
46
|
+
"what": "Test failed",
|
|
47
|
+
"why": "Reason",
|
|
48
|
+
"fix": "Fix it",
|
|
49
|
+
}
|
|
50
|
+
errors = validate_dict(data)
|
|
51
|
+
assert errors == []
|
|
52
|
+
|
|
53
|
+
def test_missing_required_field(self) -> None:
|
|
54
|
+
data = {
|
|
55
|
+
"level": "OK",
|
|
56
|
+
"what": "Test",
|
|
57
|
+
}
|
|
58
|
+
errors = validate_dict(data)
|
|
59
|
+
assert len(errors) > 0
|
|
60
|
+
assert any("code" in e for e in errors)
|
|
61
|
+
|
|
62
|
+
def test_invalid_level(self) -> None:
|
|
63
|
+
data = {
|
|
64
|
+
"level": "INVALID",
|
|
65
|
+
"code": "TST001",
|
|
66
|
+
"what": "Test",
|
|
67
|
+
}
|
|
68
|
+
errors = validate_dict(data)
|
|
69
|
+
assert len(errors) > 0
|
|
70
|
+
assert any("level" in e.lower() for e in errors)
|
|
71
|
+
|
|
72
|
+
def test_invalid_code_pattern(self) -> None:
|
|
73
|
+
data = {
|
|
74
|
+
"level": "OK",
|
|
75
|
+
"code": "invalid",
|
|
76
|
+
"what": "Test",
|
|
77
|
+
}
|
|
78
|
+
errors = validate_dict(data)
|
|
79
|
+
assert len(errors) > 0
|
|
80
|
+
assert any("code" in e for e in errors)
|
|
81
|
+
|
|
82
|
+
def test_what_too_long(self) -> None:
|
|
83
|
+
data = {
|
|
84
|
+
"level": "OK",
|
|
85
|
+
"code": "TST001",
|
|
86
|
+
"what": "x" * 300, # Exceeds maxLength of 200
|
|
87
|
+
}
|
|
88
|
+
errors = validate_dict(data)
|
|
89
|
+
assert len(errors) > 0
|
|
90
|
+
|
|
91
|
+
def test_additional_properties_rejected(self) -> None:
|
|
92
|
+
data = {
|
|
93
|
+
"level": "OK",
|
|
94
|
+
"code": "TST001",
|
|
95
|
+
"what": "Test",
|
|
96
|
+
"unknown_field": "value",
|
|
97
|
+
}
|
|
98
|
+
errors = validate_dict(data)
|
|
99
|
+
assert len(errors) > 0
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class TestValidateMessage:
|
|
103
|
+
"""Tests for validate_message function."""
|
|
104
|
+
|
|
105
|
+
def test_valid_message(self) -> None:
|
|
106
|
+
msg = A11yMessage.ok("TST001", "Test passed")
|
|
107
|
+
errors = validate_message(msg)
|
|
108
|
+
assert errors == []
|
|
109
|
+
|
|
110
|
+
def test_message_with_all_fields(self) -> None:
|
|
111
|
+
msg = A11yMessage.error(
|
|
112
|
+
"TST001",
|
|
113
|
+
"Test error",
|
|
114
|
+
"Why",
|
|
115
|
+
"Fix",
|
|
116
|
+
rule="test-rule",
|
|
117
|
+
metadata={"key": "value"},
|
|
118
|
+
)
|
|
119
|
+
errors = validate_message(msg)
|
|
120
|
+
assert errors == []
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
class TestIsValid:
|
|
124
|
+
"""Tests for is_valid function."""
|
|
125
|
+
|
|
126
|
+
def test_valid_dict(self) -> None:
|
|
127
|
+
data = {"level": "OK", "code": "TST001", "what": "Test"}
|
|
128
|
+
assert is_valid(data) is True
|
|
129
|
+
|
|
130
|
+
def test_invalid_dict(self) -> None:
|
|
131
|
+
data = {"level": "INVALID", "code": "TST001", "what": "Test"}
|
|
132
|
+
assert is_valid(data) is False
|
|
133
|
+
|
|
134
|
+
def test_valid_message(self) -> None:
|
|
135
|
+
msg = A11yMessage.ok("TST001", "Test")
|
|
136
|
+
assert is_valid(msg) is True
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class TestValidateJsonFile:
|
|
140
|
+
"""Tests for validate_json_file function."""
|
|
141
|
+
|
|
142
|
+
def test_valid_single_message(self) -> None:
|
|
143
|
+
data = {"level": "OK", "code": "TST001", "what": "Test"}
|
|
144
|
+
with tempfile.NamedTemporaryFile(
|
|
145
|
+
mode="w", suffix=".json", delete=False
|
|
146
|
+
) as f:
|
|
147
|
+
json.dump(data, f)
|
|
148
|
+
f.flush()
|
|
149
|
+
valid, errors = validate_json_file(f.name)
|
|
150
|
+
assert len(valid) == 1
|
|
151
|
+
assert errors == []
|
|
152
|
+
Path(f.name).unlink()
|
|
153
|
+
|
|
154
|
+
def test_valid_array_messages(self) -> None:
|
|
155
|
+
data = [
|
|
156
|
+
{"level": "OK", "code": "TST001", "what": "Test 1"},
|
|
157
|
+
{"level": "WARN", "code": "TST002", "what": "Test 2", "why": "Reason"},
|
|
158
|
+
]
|
|
159
|
+
with tempfile.NamedTemporaryFile(
|
|
160
|
+
mode="w", suffix=".json", delete=False
|
|
161
|
+
) as f:
|
|
162
|
+
json.dump(data, f)
|
|
163
|
+
f.flush()
|
|
164
|
+
valid, errors = validate_json_file(f.name)
|
|
165
|
+
assert len(valid) == 2
|
|
166
|
+
assert errors == []
|
|
167
|
+
Path(f.name).unlink()
|
|
168
|
+
|
|
169
|
+
def test_partial_valid_messages(self) -> None:
|
|
170
|
+
data = [
|
|
171
|
+
{"level": "OK", "code": "TST001", "what": "Test 1"},
|
|
172
|
+
{"level": "INVALID", "code": "TST002", "what": "Test 2"},
|
|
173
|
+
]
|
|
174
|
+
with tempfile.NamedTemporaryFile(
|
|
175
|
+
mode="w", suffix=".json", delete=False
|
|
176
|
+
) as f:
|
|
177
|
+
json.dump(data, f)
|
|
178
|
+
f.flush()
|
|
179
|
+
valid, errors = validate_json_file(f.name)
|
|
180
|
+
assert len(valid) == 1
|
|
181
|
+
assert len(errors) > 0
|
|
182
|
+
Path(f.name).unlink()
|
|
183
|
+
|
|
184
|
+
def test_invalid_json(self) -> None:
|
|
185
|
+
with tempfile.NamedTemporaryFile(
|
|
186
|
+
mode="w", suffix=".json", delete=False
|
|
187
|
+
) as f:
|
|
188
|
+
f.write("not valid json")
|
|
189
|
+
f.flush()
|
|
190
|
+
valid, errors = validate_json_file(f.name)
|
|
191
|
+
assert valid == []
|
|
192
|
+
assert len(errors) == 1
|
|
193
|
+
assert "Invalid JSON" in errors[0]
|
|
194
|
+
Path(f.name).unlink()
|
|
195
|
+
|
|
196
|
+
def test_file_not_found(self) -> None:
|
|
197
|
+
valid, errors = validate_json_file("nonexistent.json")
|
|
198
|
+
assert valid == []
|
|
199
|
+
assert len(errors) == 1
|
|
200
|
+
assert "File not found" in errors[0]
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class TestValidateAndConvert:
|
|
204
|
+
"""Tests for validate_and_convert function."""
|
|
205
|
+
|
|
206
|
+
def test_valid_returns_message(self) -> None:
|
|
207
|
+
data = {"level": "OK", "code": "TST001", "what": "Test"}
|
|
208
|
+
result = validate_and_convert(data)
|
|
209
|
+
assert isinstance(result, A11yMessage)
|
|
210
|
+
assert result.level == Level.OK
|
|
211
|
+
assert result.code == "TST001"
|
|
212
|
+
|
|
213
|
+
def test_invalid_returns_errors(self) -> None:
|
|
214
|
+
data = {"level": "INVALID", "code": "TST001", "what": "Test"}
|
|
215
|
+
result = validate_and_convert(data)
|
|
216
|
+
assert isinstance(result, list)
|
|
217
|
+
assert len(result) > 0
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class TestMessageValidator:
|
|
221
|
+
"""Tests for MessageValidator class."""
|
|
222
|
+
|
|
223
|
+
def test_validate_batch(self) -> None:
|
|
224
|
+
messages = [
|
|
225
|
+
{"level": "OK", "code": "TST001", "what": "Test 1"},
|
|
226
|
+
{"level": "WARN", "code": "TST002", "what": "Test 2", "why": "Reason"},
|
|
227
|
+
{"level": "INVALID", "code": "TST003", "what": "Test 3"},
|
|
228
|
+
]
|
|
229
|
+
validator = MessageValidator()
|
|
230
|
+
validator.validate_batch(messages)
|
|
231
|
+
|
|
232
|
+
assert validator.valid_count == 2
|
|
233
|
+
assert validator.invalid_count == 1
|
|
234
|
+
assert validator.total_count == 3
|
|
235
|
+
assert not validator.is_all_valid
|
|
236
|
+
assert len(validator.messages) == 2
|
|
237
|
+
assert len(validator.errors) == 1
|
|
238
|
+
|
|
239
|
+
def test_summary(self) -> None:
|
|
240
|
+
validator = MessageValidator()
|
|
241
|
+
assert validator.summary() == "No messages validated"
|
|
242
|
+
|
|
243
|
+
validator.validate({"level": "OK", "code": "TST001", "what": "Test"})
|
|
244
|
+
assert "All 1 messages valid" in validator.summary()
|
|
245
|
+
|
|
246
|
+
validator.validate({"level": "INVALID"}, index=1)
|
|
247
|
+
assert "1 valid" in validator.summary()
|
|
248
|
+
assert "1 invalid" in validator.summary()
|
|
249
|
+
|
|
250
|
+
def test_error_report(self) -> None:
|
|
251
|
+
validator = MessageValidator()
|
|
252
|
+
assert validator.error_report() == "No errors"
|
|
253
|
+
|
|
254
|
+
validator.validate({"level": "INVALID"}, index=0)
|
|
255
|
+
report = validator.error_report()
|
|
256
|
+
assert "1 invalid" in report
|
|
257
|
+
assert "Message 0" in report
|
|
@@ -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/cli.js evidence --target fixtures/html/index.html --dom-snapshot --out test-output.json
|
|
35
|
+
test -f test-output.json
|
|
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/cli.js bin/server.js src/index.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.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Contributing to a11y-mcp-tools
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to a11y-mcp-tools! We appreciate your help in making web accessibility testing more robust and evidence-based.
|
|
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-org/a11y-mcp-tools/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
|
+
# Test CLI locally
|
|
48
|
+
node bin/cli.js evidence --target fixtures/html/example.html --dom-snapshot
|
|
49
|
+
|
|
50
|
+
# Test MCP server locally
|
|
51
|
+
node bin/server.js
|
|
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 accessibility issue', () => {
|
|
64
|
+
// Arrange
|
|
65
|
+
const html = '<img src="test.jpg">';
|
|
66
|
+
|
|
67
|
+
// Act
|
|
68
|
+
const result = diagnose({ html });
|
|
69
|
+
|
|
70
|
+
// Assert
|
|
71
|
+
assert.equal(result.findings.length, 1);
|
|
72
|
+
assert.equal(result.findings[0].rule, 'alt');
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Adding New WCAG Rules
|
|
77
|
+
|
|
78
|
+
1. Add rule implementation in `src/rules/`
|
|
79
|
+
2. Add test cases in `test/*.test.js`
|
|
80
|
+
3. Update README.md with rule documentation
|
|
81
|
+
4. Add method ID to PROV_METHODS_CATALOG.md
|
|
82
|
+
5. Update schemas if needed
|
|
83
|
+
|
|
84
|
+
### Code Style
|
|
85
|
+
|
|
86
|
+
- Use ES modules (`import`/`export`)
|
|
87
|
+
- Prefer `const` over `let`
|
|
88
|
+
- Use descriptive variable names
|
|
89
|
+
- Add JSDoc comments for public APIs
|
|
90
|
+
- Follow existing patterns for consistency
|
|
91
|
+
|
|
92
|
+
### MCP Envelope Design Principles
|
|
93
|
+
|
|
94
|
+
- **Tamper-evident** - All evidence includes integrity digests
|
|
95
|
+
- **Traceable** - Provenance records for all operations
|
|
96
|
+
- **Deterministic** - Same input produces same output
|
|
97
|
+
- **Evidence-anchored** - Findings reference specific artifact locations
|
|
98
|
+
- **SAFE guidance** - Fix suggestions describe intent, not direct code writes
|
|
99
|
+
|
|
100
|
+
## Project Structure
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
a11y-mcp-tools/
|
|
104
|
+
├── bin/ # CLI and server entry points
|
|
105
|
+
├── src/ # Source code
|
|
106
|
+
│ ├── tools/ # MCP tool implementations
|
|
107
|
+
│ ├── rules/ # WCAG rule checkers
|
|
108
|
+
│ ├── schemas/ # JSON schemas
|
|
109
|
+
│ └── index.js # Main exports
|
|
110
|
+
├── test/ # Test suite
|
|
111
|
+
├── fixtures/ # Test fixtures
|
|
112
|
+
└── package.json # Project configuration
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Schema Validation
|
|
116
|
+
|
|
117
|
+
All requests and responses must validate against JSON schemas in `src/schemas/`:
|
|
118
|
+
- `envelope.schema.v0.1.json` - MCP envelope format
|
|
119
|
+
- `evidence.bundle.schema.v0.1.json` - Evidence bundle
|
|
120
|
+
- `diagnosis.schema.v0.1.json` - Diagnosis output
|
|
121
|
+
|
|
122
|
+
## Exit Codes
|
|
123
|
+
|
|
124
|
+
Maintain CI-native exit codes:
|
|
125
|
+
- `0` - Success (no findings at/above severity threshold)
|
|
126
|
+
- `2` - Findings exist (operation succeeded, but issues found)
|
|
127
|
+
- `3` - Capture/validation failure
|
|
128
|
+
- `4` - Provenance verification failed
|
|
129
|
+
|
|
130
|
+
## Code of Conduct
|
|
131
|
+
|
|
132
|
+
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.
|
|
133
|
+
|
|
134
|
+
## Questions?
|
|
135
|
+
|
|
136
|
+
Open an issue or start a discussion. We're here to help!
|
|
@@ -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.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Provenance Method ID Catalog (v0.1)
|
|
2
|
+
|
|
3
|
+
Stable method IDs for provenance tracking in a11y-mcp-tools.
|
|
4
|
+
|
|
5
|
+
These IDs are **locked** and MUST NOT change within a major version.
|
|
6
|
+
See [prov-spec](https://github.com/mcp-tool-shop-org/prov-spec) for the full specification.
|
|
7
|
+
|
|
8
|
+
## Envelope Methods
|
|
9
|
+
|
|
10
|
+
| Method ID | Description |
|
|
11
|
+
|-----------|-------------|
|
|
12
|
+
| `adapter.wrap.envelope_v0_1` | Wrap request/response in MCP envelope |
|
|
13
|
+
|
|
14
|
+
## Provenance Methods
|
|
15
|
+
|
|
16
|
+
| Method ID | Description |
|
|
17
|
+
|-----------|-------------|
|
|
18
|
+
| `adapter.provenance.record_v0_1` | Create provenance record with inputs/outputs |
|
|
19
|
+
|
|
20
|
+
## Integrity Methods
|
|
21
|
+
|
|
22
|
+
| Method ID | Description |
|
|
23
|
+
|-----------|-------------|
|
|
24
|
+
| `adapter.integrity.sha256_v0_1` | SHA-256 digest for artifact integrity |
|
|
25
|
+
|
|
26
|
+
## Evidence Capture Methods
|
|
27
|
+
|
|
28
|
+
| Method ID | Description |
|
|
29
|
+
|-----------|-------------|
|
|
30
|
+
| `engine.capture.html_canonicalize_v0_1` | Capture HTML with canonicalization (sorted attrs, normalized whitespace) |
|
|
31
|
+
| `engine.capture.dom_snapshot_v0_1` | Extract DOM snapshot as flat node array |
|
|
32
|
+
| `engine.capture.file_v0_1` | Generic file capture (CLI logs, etc.) |
|
|
33
|
+
|
|
34
|
+
## Diagnosis Methods
|
|
35
|
+
|
|
36
|
+
| Method ID | Description |
|
|
37
|
+
|-----------|-------------|
|
|
38
|
+
| `engine.diagnose.wcag_rules_v0_1` | Evaluate WCAG accessibility rules |
|
|
39
|
+
|
|
40
|
+
## Evidence Extraction Methods
|
|
41
|
+
|
|
42
|
+
| Method ID | Description |
|
|
43
|
+
|-----------|-------------|
|
|
44
|
+
| `engine.extract.evidence.json_pointer_v0_1` | Extract evidence anchor via JSON Pointer (RFC 6901) |
|
|
45
|
+
| `engine.extract.evidence.selector_v0_1` | Extract evidence anchor via CSS selector |
|
|
46
|
+
|
|
47
|
+
## Fix Guidance Methods
|
|
48
|
+
|
|
49
|
+
| Method ID | Description |
|
|
50
|
+
|-----------|-------------|
|
|
51
|
+
| `engine.generate.fix_guidance_v0_1` | Generate SAFE-only fix guidance (intent patches) |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Method ID Naming Convention
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
<namespace>.<action>.<target>_v<major>_<minor>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Namespaces:**
|
|
62
|
+
- `adapter.*` - Data transformation, wrapping, integrity
|
|
63
|
+
- `engine.*` - Core processing (capture, diagnose, extract)
|
|
64
|
+
|
|
65
|
+
**Versioning:**
|
|
66
|
+
- Method IDs include version suffix (e.g., `_v0_1`)
|
|
67
|
+
- Breaking changes require new method ID
|
|
68
|
+
- Minor changes (backwards-compatible) use same ID
|
|
69
|
+
|
|
70
|
+
## Usage in Provenance Records
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"provenance": {
|
|
75
|
+
"record_id": "prov:record:abc123",
|
|
76
|
+
"methods": [
|
|
77
|
+
"adapter.wrap.envelope_v0_1",
|
|
78
|
+
"adapter.provenance.record_v0_1",
|
|
79
|
+
"adapter.integrity.sha256_v0_1",
|
|
80
|
+
"engine.capture.html_canonicalize_v0_1",
|
|
81
|
+
"engine.capture.dom_snapshot_v0_1"
|
|
82
|
+
],
|
|
83
|
+
"inputs": ["html/index.html"],
|
|
84
|
+
"outputs": ["artifact:html:index", "artifact:dom:index"],
|
|
85
|
+
"verified": false,
|
|
86
|
+
"created_at": "2026-01-27T04:12:00Z"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Adding New Methods
|
|
92
|
+
|
|
93
|
+
1. Choose appropriate namespace (`adapter.*` or `engine.*`)
|
|
94
|
+
2. Use descriptive action + target naming
|
|
95
|
+
3. Include version suffix
|
|
96
|
+
4. Add to this catalog with description
|
|
97
|
+
5. Update `src/schemas/provenance.js`
|
|
98
|
+
|
|
99
|
+
## Related
|
|
100
|
+
|
|
101
|
+
- [prov-spec](https://github.com/mcp-tool-shop-org/prov-spec) - Full provenance specification
|
|
102
|
+
- [envelope.schema.v0.1.json](src/schemas/envelope.schema.v0.1.json) - MCP envelope schema
|
|
103
|
+
- [evidence.bundle.schema.v0.1.json](src/schemas/evidence.bundle.schema.v0.1.json) - Bundle schema
|
|
104
|
+
- [diagnosis.schema.v0.1.json](src/schemas/diagnosis.schema.v0.1.json) - Diagnosis schema
|