@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.
Files changed (241) hide show
  1. package/.github/workflows/ci.yml +63 -0
  2. package/LICENSE +21 -0
  3. package/README.md +37 -0
  4. package/docs/prov-spec/.github/workflows/ci.yml +68 -0
  5. package/docs/prov-spec/CHANGELOG.md +69 -0
  6. package/docs/prov-spec/CODE_OF_CONDUCT.md +129 -0
  7. package/docs/prov-spec/CONFORMANCE_LEVELS.md +223 -0
  8. package/docs/prov-spec/CONTRIBUTING.md +145 -0
  9. package/docs/prov-spec/IMPLEMENTER_CHECKLIST.md +137 -0
  10. package/docs/prov-spec/LICENSE +21 -0
  11. package/docs/prov-spec/PRESS_RELEASE.md +74 -0
  12. package/docs/prov-spec/README.md +182 -0
  13. package/docs/prov-spec/SETUP.md +135 -0
  14. package/docs/prov-spec/WHY.md +86 -0
  15. package/docs/prov-spec/examples/artifact.example.json +14 -0
  16. package/docs/prov-spec/examples/artifact.ref.example.json +9 -0
  17. package/docs/prov-spec/examples/evidence.example.json +6 -0
  18. package/docs/prov-spec/examples/mcp.envelope.example.json +97 -0
  19. package/docs/prov-spec/examples/mcp.request.example.json +28 -0
  20. package/docs/prov-spec/examples/prov.record.example.json +35 -0
  21. package/docs/prov-spec/interop/PROOF_NODE_ENGINE.md +114 -0
  22. package/docs/prov-spec/spec/MCP_COMPATIBILITY.md +241 -0
  23. package/docs/prov-spec/spec/PROV_METHODS_CATALOG.md +142 -0
  24. package/docs/prov-spec/spec/PROV_METHODS_SPEC.md +397 -0
  25. package/docs/prov-spec/spec/methods.json +213 -0
  26. package/docs/prov-spec/spec/schemas/artifact.ref.schema.v0.1.json +58 -0
  27. package/docs/prov-spec/spec/schemas/artifact.schema.v0.1.json +61 -0
  28. package/docs/prov-spec/spec/schemas/assist.request.schema.v0.1.json +52 -0
  29. package/docs/prov-spec/spec/schemas/assist.response.schema.v0.1.json +70 -0
  30. package/docs/prov-spec/spec/schemas/cli.error.schema.v0.1.json +78 -0
  31. package/docs/prov-spec/spec/schemas/evidence.schema.v0.1.json +37 -0
  32. package/docs/prov-spec/spec/schemas/mcp.envelope.schema.v0.1.json +141 -0
  33. package/docs/prov-spec/spec/schemas/mcp.request.schema.v0.1.json +79 -0
  34. package/docs/prov-spec/spec/schemas/methods.schema.json +93 -0
  35. package/docs/prov-spec/spec/schemas/prov-capabilities.schema.json +122 -0
  36. package/docs/prov-spec/spec/schemas/prov.record.schema.v0.1.json +133 -0
  37. package/docs/prov-spec/spec/vectors/adapter.wrap.envelope_v0_1/expected.json +4 -0
  38. package/docs/prov-spec/spec/vectors/adapter.wrap.envelope_v0_1/input.json +1 -0
  39. package/docs/prov-spec/spec/vectors/adapter.wrap.envelope_v0_1/negative/double_wrapped.json +14 -0
  40. package/docs/prov-spec/spec/vectors/adapter.wrap.envelope_v0_1/negative/wrong_schema_version.json +11 -0
  41. package/docs/prov-spec/spec/vectors/engine.extract.evidence.json_pointer/expected.json +24 -0
  42. package/docs/prov-spec/spec/vectors/engine.extract.evidence.json_pointer/input.json +8 -0
  43. package/docs/prov-spec/spec/vectors/integrity.digest.sha256/expected.json +7 -0
  44. package/docs/prov-spec/spec/vectors/integrity.digest.sha256/input.json +1 -0
  45. package/docs/prov-spec/spec/vectors/integrity.digest.sha256/negative/non_hex_chars.json +16 -0
  46. package/docs/prov-spec/spec/vectors/integrity.digest.sha256/negative/uppercase_hex.json +16 -0
  47. package/docs/prov-spec/spec/vectors/integrity.digest.sha256/negative/wrong_length.json +16 -0
  48. package/docs/prov-spec/spec/vectors/method_id_syntax/negative/hyphen_separator.json +8 -0
  49. package/docs/prov-spec/spec/vectors/method_id_syntax/negative/reserved_namespace.json +8 -0
  50. package/docs/prov-spec/spec/vectors/method_id_syntax/negative/starts_with_digit.json +8 -0
  51. package/docs/prov-spec/spec/vectors/method_id_syntax/negative/uppercase.json +8 -0
  52. package/docs/prov-spec/spec/vectors/method_id_syntax/positive/valid_ids.json +18 -0
  53. package/docs/prov-spec/tools/python/prov_validator.py +428 -0
  54. package/examples/a11y-demo-site/.github/workflows/a11y-artifacts.yml +81 -0
  55. package/examples/a11y-demo-site/.github/workflows/a11y.yml +34 -0
  56. package/examples/a11y-demo-site/CODE_OF_CONDUCT.md +129 -0
  57. package/examples/a11y-demo-site/CONTRIBUTING.md +83 -0
  58. package/examples/a11y-demo-site/LICENSE +21 -0
  59. package/examples/a11y-demo-site/README.md +155 -0
  60. package/examples/a11y-demo-site/html/contact.html +15 -0
  61. package/examples/a11y-demo-site/html/index.html +20 -0
  62. package/examples/a11y-demo-site/scripts/a11y.sh +20 -0
  63. package/package.json +26 -0
  64. package/src/a11y-assist/.github/workflows/publish.yml +52 -0
  65. package/src/a11y-assist/.github/workflows/test.yml +30 -0
  66. package/src/a11y-assist/A11Y_ASSIST_TEST_COVERAGE_REQUIREMENTS.md +104 -0
  67. package/src/a11y-assist/CODE_OF_CONDUCT.md +129 -0
  68. package/src/a11y-assist/CONTRIBUTING.md +98 -0
  69. package/src/a11y-assist/ENGINE.md +363 -0
  70. package/src/a11y-assist/LICENSE +21 -0
  71. package/src/a11y-assist/PRESS_RELEASE.md +71 -0
  72. package/src/a11y-assist/QUICKSTART.md +101 -0
  73. package/src/a11y-assist/README.md +192 -0
  74. package/src/a11y-assist/RELEASE_NOTES.md +319 -0
  75. package/src/a11y-assist/a11y_assist/__init__.py +3 -0
  76. package/src/a11y-assist/a11y_assist/cli.py +599 -0
  77. package/src/a11y-assist/a11y_assist/from_cli_error.py +149 -0
  78. package/src/a11y-assist/a11y_assist/guard.py +444 -0
  79. package/src/a11y-assist/a11y_assist/ingest.py +407 -0
  80. package/src/a11y-assist/a11y_assist/methods.py +137 -0
  81. package/src/a11y-assist/a11y_assist/parse_raw.py +71 -0
  82. package/src/a11y-assist/a11y_assist/profiles/__init__.py +29 -0
  83. package/src/a11y-assist/a11y_assist/profiles/cognitive_load.py +245 -0
  84. package/src/a11y-assist/a11y_assist/profiles/cognitive_load_render.py +86 -0
  85. package/src/a11y-assist/a11y_assist/profiles/dyslexia.py +144 -0
  86. package/src/a11y-assist/a11y_assist/profiles/dyslexia_render.py +77 -0
  87. package/src/a11y-assist/a11y_assist/profiles/plain_language.py +119 -0
  88. package/src/a11y-assist/a11y_assist/profiles/plain_language_render.py +66 -0
  89. package/src/a11y-assist/a11y_assist/profiles/screen_reader.py +348 -0
  90. package/src/a11y-assist/a11y_assist/profiles/screen_reader_render.py +89 -0
  91. package/src/a11y-assist/a11y_assist/render.py +95 -0
  92. package/src/a11y-assist/a11y_assist/schemas/assist.request.schema.v0.1.json +52 -0
  93. package/src/a11y-assist/a11y_assist/schemas/assist.response.schema.v0.1.json +70 -0
  94. package/src/a11y-assist/a11y_assist/schemas/cli.error.schema.v0.1.json +78 -0
  95. package/src/a11y-assist/a11y_assist/storage.py +31 -0
  96. package/src/a11y-assist/pyproject.toml +60 -0
  97. package/src/a11y-assist/tests/__init__.py +1 -0
  98. package/src/a11y-assist/tests/fixtures/base_inputs/cli_error_high.json +18 -0
  99. package/src/a11y-assist/tests/fixtures/base_inputs/cli_error_medium.json +16 -0
  100. package/src/a11y-assist/tests/fixtures/base_inputs/raw_text_low.txt +3 -0
  101. package/src/a11y-assist/tests/fixtures/cli_error_good.json +9 -0
  102. package/src/a11y-assist/tests/fixtures/cli_error_missing_id.json +7 -0
  103. package/src/a11y-assist/tests/fixtures/cli_error_string_format.json +7 -0
  104. package/src/a11y-assist/tests/fixtures/expected/cognitive_load_high.txt +20 -0
  105. package/src/a11y-assist/tests/fixtures/expected/dyslexia_high.txt +20 -0
  106. package/src/a11y-assist/tests/fixtures/expected/lowvision_high.txt +18 -0
  107. package/src/a11y-assist/tests/fixtures/expected/plain_language_high.txt +14 -0
  108. package/src/a11y-assist/tests/fixtures/expected/screen_reader_high.txt +19 -0
  109. package/src/a11y-assist/tests/fixtures/golden_screen_reader_cli_error.txt +16 -0
  110. package/src/a11y-assist/tests/fixtures/golden_screen_reader_raw_no_id.txt +14 -0
  111. package/src/a11y-assist/tests/fixtures/golden_screen_reader_raw_with_id.txt +14 -0
  112. package/src/a11y-assist/tests/fixtures/raw_good.txt +11 -0
  113. package/src/a11y-assist/tests/fixtures/raw_no_id.txt +2 -0
  114. package/src/a11y-assist/tests/test_cognitive_load.py +469 -0
  115. package/src/a11y-assist/tests/test_dyslexia.py +337 -0
  116. package/src/a11y-assist/tests/test_explain.py +74 -0
  117. package/src/a11y-assist/tests/test_golden.py +127 -0
  118. package/src/a11y-assist/tests/test_guard.py +819 -0
  119. package/src/a11y-assist/tests/test_guard_integration.py +457 -0
  120. package/src/a11y-assist/tests/test_ingest.py +311 -0
  121. package/src/a11y-assist/tests/test_methods_metadata.py +236 -0
  122. package/src/a11y-assist/tests/test_plain_language.py +348 -0
  123. package/src/a11y-assist/tests/test_render.py +117 -0
  124. package/src/a11y-assist/tests/test_screen_reader.py +703 -0
  125. package/src/a11y-assist/tests/test_storage_last.py +61 -0
  126. package/src/a11y-assist/tests/test_triage.py +86 -0
  127. package/src/a11y-ci/.github/workflows/ci.yml +43 -0
  128. package/src/a11y-ci/.github/workflows/test.yml +30 -0
  129. package/src/a11y-ci/A11Y_CI_TEST_COVERAGE_REQUIREMENTS.md +94 -0
  130. package/src/a11y-ci/CODE_OF_CONDUCT.md +129 -0
  131. package/src/a11y-ci/CONTRIBUTING.md +142 -0
  132. package/src/a11y-ci/LICENSE +21 -0
  133. package/src/a11y-ci/README.md +105 -0
  134. package/src/a11y-ci/a11y_ci/__init__.py +3 -0
  135. package/src/a11y-ci/a11y_ci/allowlist.py +83 -0
  136. package/src/a11y-ci/a11y_ci/cli.py +145 -0
  137. package/src/a11y-ci/a11y_ci/gate.py +131 -0
  138. package/src/a11y-ci/a11y_ci/render.py +48 -0
  139. package/src/a11y-ci/a11y_ci/schemas/allowlist.schema.json +24 -0
  140. package/src/a11y-ci/a11y_ci/scorecard.py +99 -0
  141. package/src/a11y-ci/npm/package.json +35 -0
  142. package/src/a11y-ci/pyproject.toml +64 -0
  143. package/src/a11y-ci/tests/__init__.py +1 -0
  144. package/src/a11y-ci/tests/fixtures/allowlist_expired.json +10 -0
  145. package/src/a11y-ci/tests/fixtures/allowlist_ok.json +10 -0
  146. package/src/a11y-ci/tests/fixtures/baseline_ok.json +7 -0
  147. package/src/a11y-ci/tests/fixtures/current_fail.json +6 -0
  148. package/src/a11y-ci/tests/fixtures/current_ok.json +6 -0
  149. package/src/a11y-ci/tests/fixtures/current_regresses.json +7 -0
  150. package/src/a11y-ci/tests/test_gate.py +134 -0
  151. package/src/a11y-evidence-engine/.github/workflows/ci.yml +53 -0
  152. package/src/a11y-evidence-engine/CODE_OF_CONDUCT.md +129 -0
  153. package/src/a11y-evidence-engine/CONTRIBUTING.md +128 -0
  154. package/src/a11y-evidence-engine/LICENSE +21 -0
  155. package/src/a11y-evidence-engine/README.md +71 -0
  156. package/src/a11y-evidence-engine/bin/a11y-engine.js +11 -0
  157. package/src/a11y-evidence-engine/fixtures/bad/button-no-name.html +30 -0
  158. package/src/a11y-evidence-engine/fixtures/bad/img-missing-alt.html +19 -0
  159. package/src/a11y-evidence-engine/fixtures/bad/input-missing-label.html +26 -0
  160. package/src/a11y-evidence-engine/fixtures/bad/missing-lang.html +11 -0
  161. package/src/a11y-evidence-engine/fixtures/good/index.html +29 -0
  162. package/src/a11y-evidence-engine/package-lock.json +109 -0
  163. package/src/a11y-evidence-engine/package.json +45 -0
  164. package/src/a11y-evidence-engine/src/cli.js +74 -0
  165. package/src/a11y-evidence-engine/src/evidence/canonicalize.js +52 -0
  166. package/src/a11y-evidence-engine/src/evidence/json_pointer.js +34 -0
  167. package/src/a11y-evidence-engine/src/evidence/prov_emit.js +153 -0
  168. package/src/a11y-evidence-engine/src/fswalk.js +56 -0
  169. package/src/a11y-evidence-engine/src/html_parse.js +117 -0
  170. package/src/a11y-evidence-engine/src/ids.js +53 -0
  171. package/src/a11y-evidence-engine/src/rules/document_missing_lang.js +50 -0
  172. package/src/a11y-evidence-engine/src/rules/form_control_missing_label.js +105 -0
  173. package/src/a11y-evidence-engine/src/rules/img_missing_alt.js +77 -0
  174. package/src/a11y-evidence-engine/src/rules/index.js +37 -0
  175. package/src/a11y-evidence-engine/src/rules/interactive_missing_name.js +129 -0
  176. package/src/a11y-evidence-engine/src/scan.js +128 -0
  177. package/src/a11y-evidence-engine/test/scan.test.js +149 -0
  178. package/src/a11y-evidence-engine/test/vectors.test.js +200 -0
  179. package/src/a11y-lint/.github/workflows/ci.yml +46 -0
  180. package/src/a11y-lint/.github/workflows/test.yml +34 -0
  181. package/src/a11y-lint/CODE_OF_CONDUCT.md +129 -0
  182. package/src/a11y-lint/CONTRIBUTING.md +70 -0
  183. package/src/a11y-lint/GOVERNANCE.md +57 -0
  184. package/src/a11y-lint/LICENSE +21 -0
  185. package/src/a11y-lint/PRESS_RELEASE.md +50 -0
  186. package/src/a11y-lint/README.md +276 -0
  187. package/src/a11y-lint/RELEASE_NOTES.md +57 -0
  188. package/src/a11y-lint/RELEASING.md +57 -0
  189. package/src/a11y-lint/a11y_lint/__init__.py +64 -0
  190. package/src/a11y-lint/a11y_lint/cli.py +319 -0
  191. package/src/a11y-lint/a11y_lint/errors.py +252 -0
  192. package/src/a11y-lint/a11y_lint/render.py +293 -0
  193. package/src/a11y-lint/a11y_lint/report_md.py +289 -0
  194. package/src/a11y-lint/a11y_lint/scan_cli_text.py +434 -0
  195. package/src/a11y-lint/a11y_lint/schemas/cli.error.schema.v0.1.json +83 -0
  196. package/src/a11y-lint/a11y_lint/scorecard.py +244 -0
  197. package/src/a11y-lint/a11y_lint/validate.py +225 -0
  198. package/src/a11y-lint/pyproject.toml +75 -0
  199. package/src/a11y-lint/tests/__init__.py +1 -0
  200. package/src/a11y-lint/tests/test_cli.py +200 -0
  201. package/src/a11y-lint/tests/test_errors.py +188 -0
  202. package/src/a11y-lint/tests/test_render.py +202 -0
  203. package/src/a11y-lint/tests/test_report_md.py +188 -0
  204. package/src/a11y-lint/tests/test_scan_cli_text.py +290 -0
  205. package/src/a11y-lint/tests/test_scorecard.py +195 -0
  206. package/src/a11y-lint/tests/test_validate.py +257 -0
  207. package/src/a11y-mcp-tools/.github/workflows/ci.yml +53 -0
  208. package/src/a11y-mcp-tools/CODE_OF_CONDUCT.md +129 -0
  209. package/src/a11y-mcp-tools/CONTRIBUTING.md +136 -0
  210. package/src/a11y-mcp-tools/LICENSE +21 -0
  211. package/src/a11y-mcp-tools/PROV_METHODS_CATALOG.md +104 -0
  212. package/src/a11y-mcp-tools/README.md +168 -0
  213. package/src/a11y-mcp-tools/bin/cli.js +452 -0
  214. package/src/a11y-mcp-tools/bin/server.js +244 -0
  215. package/src/a11y-mcp-tools/fixtures/requests/a11y.diagnose.ok.json +27 -0
  216. package/src/a11y-mcp-tools/fixtures/requests/a11y.evidence.ok.json +25 -0
  217. package/src/a11y-mcp-tools/fixtures/responses/a11y.diagnose.ok.json +139 -0
  218. package/src/a11y-mcp-tools/fixtures/responses/a11y.diagnose.provenance_fail.json +13 -0
  219. package/src/a11y-mcp-tools/fixtures/responses/a11y.evidence.ok.json +88 -0
  220. package/src/a11y-mcp-tools/package-lock.json +189 -0
  221. package/src/a11y-mcp-tools/package.json +49 -0
  222. package/src/a11y-mcp-tools/src/envelope.js +197 -0
  223. package/src/a11y-mcp-tools/src/index.js +9 -0
  224. package/src/a11y-mcp-tools/src/schemas/artifact.js +85 -0
  225. package/src/a11y-mcp-tools/src/schemas/diagnosis.schema.v0.1.json +137 -0
  226. package/src/a11y-mcp-tools/src/schemas/envelope.schema.v0.1.json +108 -0
  227. package/src/a11y-mcp-tools/src/schemas/evidence.bundle.schema.v0.1.json +129 -0
  228. package/src/a11y-mcp-tools/src/schemas/evidence.js +97 -0
  229. package/src/a11y-mcp-tools/src/schemas/index.js +11 -0
  230. package/src/a11y-mcp-tools/src/schemas/provenance.js +140 -0
  231. package/src/a11y-mcp-tools/src/schemas/tools/a11y.diagnose.request.schema.v0.1.json +77 -0
  232. package/src/a11y-mcp-tools/src/schemas/tools/a11y.diagnose.response.schema.v0.1.json +50 -0
  233. package/src/a11y-mcp-tools/src/schemas/tools/a11y.evidence.request.schema.v0.1.json +120 -0
  234. package/src/a11y-mcp-tools/src/schemas/tools/a11y.evidence.response.schema.v0.1.json +50 -0
  235. package/src/a11y-mcp-tools/src/tools/diagnose.js +597 -0
  236. package/src/a11y-mcp-tools/src/tools/evidence.js +481 -0
  237. package/src/a11y-mcp-tools/src/tools/index.js +10 -0
  238. package/src/a11y-mcp-tools/test/contract.test.mjs +154 -0
  239. package/src/a11y-mcp-tools/test/diagnose.test.js +485 -0
  240. package/src/a11y-mcp-tools/test/evidence.test.js +183 -0
  241. package/src/a11y-mcp-tools/test/schema.test.js +327 -0
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+
3
+ const { describe, it, before, after } = require("node:test");
4
+ const assert = require("node:assert");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const { scan } = require("../src/scan.js");
8
+
9
+ const FIXTURES_DIR = path.join(__dirname, "..", "fixtures");
10
+ const TEST_OUT_DIR = path.join(__dirname, "..", "test-output");
11
+
12
+ describe("scan", () => {
13
+ before(() => {
14
+ // Clean up test output
15
+ if (fs.existsSync(TEST_OUT_DIR)) {
16
+ fs.rmSync(TEST_OUT_DIR, { recursive: true });
17
+ }
18
+ });
19
+
20
+ after(() => {
21
+ // Clean up test output
22
+ if (fs.existsSync(TEST_OUT_DIR)) {
23
+ fs.rmSync(TEST_OUT_DIR, { recursive: true });
24
+ }
25
+ });
26
+
27
+ describe("good fixtures", () => {
28
+ it("should find no errors in accessible HTML", async () => {
29
+ const outDir = path.join(TEST_OUT_DIR, "good");
30
+ const result = await scan(path.join(FIXTURES_DIR, "good"), outDir);
31
+
32
+ assert.strictEqual(result.summary.errors, 0);
33
+ assert.strictEqual(result.findings.length, 0);
34
+ });
35
+ });
36
+
37
+ describe("bad fixtures", () => {
38
+ it("should detect missing alt text", async () => {
39
+ const outDir = path.join(TEST_OUT_DIR, "img-missing-alt");
40
+ const result = await scan(
41
+ path.join(FIXTURES_DIR, "bad", "img-missing-alt.html"),
42
+ outDir
43
+ );
44
+
45
+ assert.strictEqual(result.summary.errors, 2);
46
+
47
+ const altFindings = result.findings.filter(
48
+ (f) => f.rule_id === "html.img.missing_alt"
49
+ );
50
+ assert.strictEqual(altFindings.length, 2);
51
+
52
+ // Check evidence_ref exists
53
+ for (const finding of altFindings) {
54
+ assert.ok(finding.evidence_ref);
55
+ assert.ok(finding.evidence_ref.record);
56
+ assert.ok(finding.evidence_ref.digest);
57
+ assert.ok(finding.evidence_ref.envelope);
58
+ }
59
+ });
60
+
61
+ it("should detect missing labels", async () => {
62
+ const outDir = path.join(TEST_OUT_DIR, "input-missing-label");
63
+ const result = await scan(
64
+ path.join(FIXTURES_DIR, "bad", "input-missing-label.html"),
65
+ outDir
66
+ );
67
+
68
+ const labelFindings = result.findings.filter(
69
+ (f) => f.rule_id === "html.form_control.missing_label"
70
+ );
71
+ assert.strictEqual(labelFindings.length, 2);
72
+ });
73
+
74
+ it("should detect missing accessible names", async () => {
75
+ const outDir = path.join(TEST_OUT_DIR, "button-no-name");
76
+ const result = await scan(
77
+ path.join(FIXTURES_DIR, "bad", "button-no-name.html"),
78
+ outDir
79
+ );
80
+
81
+ const nameFindings = result.findings.filter(
82
+ (f) => f.rule_id === "html.interactive.missing_name"
83
+ );
84
+ // 2 empty buttons + 1 empty link = 3
85
+ assert.strictEqual(nameFindings.length, 3);
86
+ });
87
+
88
+ it("should detect missing lang attribute", async () => {
89
+ const outDir = path.join(TEST_OUT_DIR, "missing-lang");
90
+ const result = await scan(
91
+ path.join(FIXTURES_DIR, "bad", "missing-lang.html"),
92
+ outDir
93
+ );
94
+
95
+ const langFindings = result.findings.filter(
96
+ (f) => f.rule_id === "html.document.missing_lang"
97
+ );
98
+ assert.strictEqual(langFindings.length, 1);
99
+ });
100
+ });
101
+
102
+ describe("output structure", () => {
103
+ it("should produce findings.json with correct structure", async () => {
104
+ const outDir = path.join(TEST_OUT_DIR, "structure");
105
+ const result = await scan(
106
+ path.join(FIXTURES_DIR, "bad", "img-missing-alt.html"),
107
+ outDir
108
+ );
109
+
110
+ // Check top-level structure
111
+ assert.strictEqual(result.engine, "a11y-evidence-engine");
112
+ assert.strictEqual(result.version, "0.1.0");
113
+ assert.ok(result.target);
114
+ assert.ok(result.summary);
115
+ assert.ok(Array.isArray(result.findings));
116
+
117
+ // Check findings.json was written
118
+ const findingsPath = path.join(outDir, "findings.json");
119
+ assert.ok(fs.existsSync(findingsPath));
120
+
121
+ const written = JSON.parse(fs.readFileSync(findingsPath, "utf8"));
122
+ assert.deepStrictEqual(written, result);
123
+ });
124
+
125
+ it("should assign deterministic finding IDs", async () => {
126
+ const outDir = path.join(TEST_OUT_DIR, "deterministic");
127
+ const result = await scan(
128
+ path.join(FIXTURES_DIR, "bad", "img-missing-alt.html"),
129
+ outDir
130
+ );
131
+
132
+ assert.strictEqual(result.findings[0].finding_id, "finding-0001");
133
+ assert.strictEqual(result.findings[1].finding_id, "finding-0002");
134
+ });
135
+ });
136
+
137
+ describe("directory scanning", () => {
138
+ it("should scan all HTML files in a directory", async () => {
139
+ const outDir = path.join(TEST_OUT_DIR, "all-bad");
140
+ const result = await scan(path.join(FIXTURES_DIR, "bad"), outDir);
141
+
142
+ // Should scan all 4 bad fixture files
143
+ assert.strictEqual(result.summary.files_scanned, 4);
144
+
145
+ // Should find issues from all files
146
+ assert.ok(result.summary.errors > 0);
147
+ });
148
+ });
149
+ });
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+
3
+ const { describe, it, before, after } = require("node:test");
4
+ const assert = require("node:assert");
5
+ const crypto = require("crypto");
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const { scan } = require("../src/scan.js");
9
+ const { canonicalize } = require("../src/evidence/canonicalize.js");
10
+
11
+ const FIXTURES_DIR = path.join(__dirname, "..", "fixtures");
12
+ const TEST_OUT_DIR = path.join(__dirname, "..", "test-output-vectors");
13
+
14
+ describe("provenance vectors", () => {
15
+ before(() => {
16
+ if (fs.existsSync(TEST_OUT_DIR)) {
17
+ fs.rmSync(TEST_OUT_DIR, { recursive: true });
18
+ }
19
+ });
20
+
21
+ after(() => {
22
+ if (fs.existsSync(TEST_OUT_DIR)) {
23
+ fs.rmSync(TEST_OUT_DIR, { recursive: true });
24
+ }
25
+ });
26
+
27
+ describe("provenance file emission", () => {
28
+ it("should emit record.json, digest.json, envelope.json for each finding", async () => {
29
+ const outDir = path.join(TEST_OUT_DIR, "prov-files");
30
+ const result = await scan(
31
+ path.join(FIXTURES_DIR, "bad", "img-missing-alt.html"),
32
+ outDir
33
+ );
34
+
35
+ for (const finding of result.findings) {
36
+ const provDir = path.join(outDir, "provenance", finding.finding_id);
37
+
38
+ assert.ok(fs.existsSync(path.join(provDir, "record.json")));
39
+ assert.ok(fs.existsSync(path.join(provDir, "digest.json")));
40
+ assert.ok(fs.existsSync(path.join(provDir, "envelope.json")));
41
+ }
42
+ });
43
+ });
44
+
45
+ describe("digest verification", () => {
46
+ it("should produce verifiable SHA-256 digests", async () => {
47
+ const outDir = path.join(TEST_OUT_DIR, "digest-verify");
48
+ const result = await scan(
49
+ path.join(FIXTURES_DIR, "bad", "img-missing-alt.html"),
50
+ outDir
51
+ );
52
+
53
+ for (const finding of result.findings) {
54
+ const provDir = path.join(outDir, "provenance", finding.finding_id);
55
+
56
+ // Read the record and digest
57
+ const record = JSON.parse(
58
+ fs.readFileSync(path.join(provDir, "record.json"), "utf8")
59
+ );
60
+ const digest = JSON.parse(
61
+ fs.readFileSync(path.join(provDir, "digest.json"), "utf8")
62
+ );
63
+
64
+ // Extract evidence from record
65
+ const evidence =
66
+ record["prov.record.v0.1"].outputs[0]["artifact.v0.1"].content;
67
+
68
+ // Extract expected digest
69
+ const expectedDigest =
70
+ digest["prov.record.v0.1"].outputs[0]["artifact.v0.1"].digest.value;
71
+
72
+ // Compute actual digest
73
+ const canonical = canonicalize(evidence);
74
+ const actualDigest = crypto
75
+ .createHash("sha256")
76
+ .update(canonical, "utf8")
77
+ .digest("hex");
78
+
79
+ assert.strictEqual(
80
+ actualDigest,
81
+ expectedDigest,
82
+ `Digest mismatch for ${finding.finding_id}`
83
+ );
84
+ }
85
+ });
86
+ });
87
+
88
+ describe("record structure", () => {
89
+ it("should emit valid engine.extract.evidence.json_pointer records", async () => {
90
+ const outDir = path.join(TEST_OUT_DIR, "record-structure");
91
+ const result = await scan(
92
+ path.join(FIXTURES_DIR, "bad", "img-missing-alt.html"),
93
+ outDir
94
+ );
95
+
96
+ const provDir = path.join(
97
+ outDir,
98
+ "provenance",
99
+ result.findings[0].finding_id
100
+ );
101
+ const record = JSON.parse(
102
+ fs.readFileSync(path.join(provDir, "record.json"), "utf8")
103
+ );
104
+
105
+ const prov = record["prov.record.v0.1"];
106
+
107
+ assert.strictEqual(prov.method_id, "engine.extract.evidence.json_pointer");
108
+ assert.ok(prov.timestamp);
109
+ assert.ok(prov.inputs);
110
+ assert.ok(prov.outputs);
111
+ assert.ok(prov.agent);
112
+ assert.strictEqual(prov.agent.name, "a11y-evidence-engine");
113
+ });
114
+
115
+ it("should emit valid integrity.digest.sha256 records", async () => {
116
+ const outDir = path.join(TEST_OUT_DIR, "digest-structure");
117
+ const result = await scan(
118
+ path.join(FIXTURES_DIR, "bad", "img-missing-alt.html"),
119
+ outDir
120
+ );
121
+
122
+ const provDir = path.join(
123
+ outDir,
124
+ "provenance",
125
+ result.findings[0].finding_id
126
+ );
127
+ const digest = JSON.parse(
128
+ fs.readFileSync(path.join(provDir, "digest.json"), "utf8")
129
+ );
130
+
131
+ const prov = digest["prov.record.v0.1"];
132
+
133
+ assert.strictEqual(prov.method_id, "integrity.digest.sha256");
134
+ assert.ok(prov.outputs[0]["artifact.v0.1"].digest);
135
+ assert.strictEqual(
136
+ prov.outputs[0]["artifact.v0.1"].digest.algorithm,
137
+ "sha256"
138
+ );
139
+
140
+ // Digest value should be 64 hex chars
141
+ const digestValue = prov.outputs[0]["artifact.v0.1"].digest.value;
142
+ assert.strictEqual(digestValue.length, 64);
143
+ assert.match(digestValue, /^[a-f0-9]+$/);
144
+ });
145
+
146
+ it("should emit valid adapter.wrap.envelope_v0_1 records", async () => {
147
+ const outDir = path.join(TEST_OUT_DIR, "envelope-structure");
148
+ const result = await scan(
149
+ path.join(FIXTURES_DIR, "bad", "img-missing-alt.html"),
150
+ outDir
151
+ );
152
+
153
+ const provDir = path.join(
154
+ outDir,
155
+ "provenance",
156
+ result.findings[0].finding_id
157
+ );
158
+ const envelope = JSON.parse(
159
+ fs.readFileSync(path.join(provDir, "envelope.json"), "utf8")
160
+ );
161
+
162
+ assert.ok(envelope["mcp.envelope.v0.1"]);
163
+ assert.ok(envelope["mcp.envelope.v0.1"].result);
164
+ assert.ok(envelope["mcp.envelope.v0.1"].provenance);
165
+
166
+ const prov = envelope["mcp.envelope.v0.1"].provenance["prov.record.v0.1"];
167
+ assert.strictEqual(prov.method_id, "adapter.wrap.envelope_v0_1");
168
+ });
169
+ });
170
+
171
+ describe("canonicalization", () => {
172
+ it("should canonicalize JSON correctly", () => {
173
+ // Test sorted keys
174
+ const obj = { z: 1, a: 2, m: 3 };
175
+ assert.strictEqual(canonicalize(obj), '{"a":2,"m":3,"z":1}');
176
+
177
+ // Test nested objects
178
+ const nested = { b: { d: 1, c: 2 }, a: 1 };
179
+ assert.strictEqual(canonicalize(nested), '{"a":1,"b":{"c":2,"d":1}}');
180
+
181
+ // Test arrays (preserve order)
182
+ const arr = [3, 1, 2];
183
+ assert.strictEqual(canonicalize(arr), "[3,1,2]");
184
+
185
+ // Test strings with escaping
186
+ assert.strictEqual(canonicalize('hello "world"'), '"hello \\"world\\""');
187
+
188
+ // Test null and booleans
189
+ assert.strictEqual(canonicalize(null), "null");
190
+ assert.strictEqual(canonicalize(true), "true");
191
+ assert.strictEqual(canonicalize(false), "false");
192
+ });
193
+
194
+ it("should reject non-finite numbers", () => {
195
+ assert.throws(() => canonicalize(Infinity));
196
+ assert.throws(() => canonicalize(-Infinity));
197
+ assert.throws(() => canonicalize(NaN));
198
+ });
199
+ });
200
+ });
@@ -0,0 +1,46 @@
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
+ python-version: ["3.10", "3.11", "3.12"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install -e .
29
+ pip install -e .[dev]
30
+
31
+ - name: Run tests
32
+ run: pytest tests/ -v --cov=a11y_lint --cov-report=term-missing
33
+
34
+ - name: Type check
35
+ run: pyright a11y_lint tests
36
+
37
+ - name: Test CLI commands
38
+ run: |
39
+ a11y-lint --help
40
+ a11y-lint list-rules
41
+ a11y-lint list-rules -v
42
+ a11y-lint schema
43
+ # Test scan with sample output if fixtures exist
44
+ if [ -f tests/fixtures/sample_output.txt ]; then
45
+ a11y-lint scan tests/fixtures/sample_output.txt || true
46
+ fi
@@ -0,0 +1,34 @@
1
+ name: Tests
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
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -e ".[dev]"
28
+
29
+ - name: Run tests
30
+ run: pytest tests/ -v --tb=short
31
+
32
+ - name: Type check
33
+ run: pyright
34
+ continue-on-error: true
@@ -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,70 @@
1
+ # Contributing to a11y-lint
2
+
3
+ Thank you for helping improve accessibility tooling.
4
+
5
+ Before contributing, please understand the core rule:
6
+
7
+ > **Accessibility behavior is a public API.**
8
+
9
+ ---
10
+
11
+ ## Non-Negotiables
12
+
13
+ - Do not change the CLI output contract without discussion
14
+ - Do not weaken accessibility rules for convenience
15
+ - All new rules must include:
16
+ - a clear problem statement
17
+ - why it affects accessibility
18
+ - a concrete fix
19
+
20
+ ---
21
+
22
+ ## Adding a Rule
23
+
24
+ Rules must be deterministic and testable.
25
+
26
+ Each rule must:
27
+ - operate on plain text
28
+ - produce actionable output
29
+ - include tests with good and bad fixtures
30
+
31
+ ---
32
+
33
+ ## Rule Categories
34
+
35
+ When adding a rule, classify it correctly:
36
+
37
+ - **WCAG**: Mapped to a specific WCAG success criterion (e.g., SC 1.4.1)
38
+ - **Policy**: Best practice for cognitive accessibility, not a WCAG violation
39
+
40
+ Policy rules are intentional and valuable — but should not be conflated with WCAG requirements.
41
+
42
+ ---
43
+
44
+ ## Tests
45
+
46
+ All contributions must include tests.
47
+ Behavior without tests will not be merged.
48
+
49
+ Run tests with:
50
+
51
+ ```bash
52
+ pytest tests/ -v
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Tone
58
+
59
+ This project is strict, not judgmental.
60
+
61
+ Output should explain *what*, *why*, and *how to fix* — never shame.
62
+
63
+ ---
64
+
65
+ ## Pull Requests
66
+
67
+ - Keep PRs focused on a single change
68
+ - Include test coverage for new behavior
69
+ - Update documentation if behavior changes
70
+ - Ensure all tests pass before submitting
@@ -0,0 +1,57 @@
1
+ # Project Governance
2
+
3
+ a11y-lint is maintained with a bias toward stability.
4
+
5
+ ---
6
+
7
+ ## Decision Principles
8
+
9
+ 1. Accessibility > aesthetics
10
+ 2. Determinism > cleverness
11
+ 3. Clarity > terseness
12
+ 4. Humans under stress are the primary user
13
+
14
+ ---
15
+
16
+ ## What We Protect
17
+
18
+ The following are considered stable public interfaces:
19
+
20
+ - **CLI output contract**: `[OK]/[WARN]/[ERROR]` + `What/Why/Fix` structure
21
+ - **JSON schema**: `cli.error.schema.v0.1.json`
22
+ - **Exit codes**: 0 = clean, 1 = errors found
23
+
24
+ Changes to these require major version bumps and community discussion.
25
+
26
+ ---
27
+
28
+ ## What May Change
29
+
30
+ - New rules may be added
31
+ - Rule descriptions may be clarified
32
+ - Internal implementation details
33
+ - Performance optimizations
34
+
35
+ ---
36
+
37
+ ## Versioning
38
+
39
+ - **Patch** (0.1.x): Bug fixes, rule tuning
40
+ - **Minor** (0.x.0): New rules, new outputs
41
+ - **Major** (x.0.0): Contract or schema changes
42
+
43
+ ---
44
+
45
+ ## Accessibility Regressions
46
+
47
+ Accessibility regressions are treated as release blockers.
48
+
49
+ A change that makes output less accessible is a bug, not a feature.
50
+
51
+ ---
52
+
53
+ ## Maintainers
54
+
55
+ Final authority rests with the project maintainer(s).
56
+
57
+ Decisions prioritize the needs of users with disabilities over convenience of contributors.