@teevee98/synapse-hub 3.10.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.agents/rules/mandatory-playwright-live.md +18 -4
  2. package/.agents/rules/stack-auto-router.md +11 -4
  3. package/.agents/skills/{playwright-webapp-testing → 01-web-automation/playwright-webapp-testing}/SKILL.md +18 -1
  4. package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +116 -0
  5. package/.agents/workflows/generate_manual_testcases_rbt.md +1 -1
  6. package/Dockerfile +14 -6
  7. package/README.en.md +2 -2
  8. package/README.md +2 -2
  9. package/agentskills.json +16 -2
  10. package/docs/ARCHITECTURE.en.md +1 -1
  11. package/docs/ARCHITECTURE.md +1 -1
  12. package/package.json +1 -1
  13. package/plugin.json +1 -1
  14. package/skills_manifest.json +514 -511
  15. package/synapse.config.json +1 -1
  16. package/tools/__init__.py +1 -1
  17. package/tools/ast_cache.py +173 -0
  18. package/tools/browser_helpers.js +2 -2
  19. package/tools/build_consolidated_report.py +1 -1
  20. package/tools/cache_resolver.py +11 -6
  21. package/tools/cli.py +16 -3
  22. package/tools/core/file_lock.py +106 -8
  23. package/tools/core/process_supervisor.py +25 -0
  24. package/tools/dashboard_generator.py +6 -6
  25. package/tools/git_pre_commit_guard.py +6 -4
  26. package/tools/infer_linter.py +2 -2
  27. package/tools/lint_ai_docs.py +19 -5
  28. package/tools/mcp_docx_server.py +1 -1
  29. package/tools/mcp_excel_server.py +1 -1
  30. package/tools/mcp_server.py +1 -1
  31. package/tools/pinpoint_failure.py +14 -2
  32. package/tools/rules_router.py +373 -0
  33. package/tools/ui_server.py +1 -1
  34. package/tools/update_sentinel.py +3 -3
  35. package/tools/verify_all.py +43 -1
  36. package/tools/wcag_audit.py +1 -1
  37. package/tools/welcome_page.py +1 -1
  38. package/.agents/skills/wcag-audit-patterns/SKILL.md +0 -77
  39. /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/SKILL.md +0 -0
  40. /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/examples/multi_role_auth_matrix.md +0 -0
  41. /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/examples/storage_state_sample.json +0 -0
  42. /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/SKILL.md +0 -0
  43. /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/examples/cli_runner_test.bats +0 -0
  44. /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/resources/implementation-playbook.md +0 -0
  45. /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/SKILL.md +0 -0
  46. /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/examples/standard_test_case.groovy +0 -0
  47. /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/references/pom_patterns.groovy +0 -0
  48. /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/SKILL.md +0 -0
  49. /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/examples/playwright_sharded_config.ts +0 -0
  50. /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/resources/implementation-playbook.md +0 -0
  51. /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/SKILL.md +0 -0
  52. /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/examples/headless_kre_exec.sh +0 -0
  53. /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/groovy-patterns.md +0 -0
  54. /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/katalon-api.md +0 -0
  55. /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/runner_commands.md +0 -0
  56. /package/.agents/skills/{lam-script-generator → 01-web-automation/lam-script-generator}/SKILL.md +0 -0
  57. /package/.agents/skills/{lam-script-generator → 01-web-automation/lam-script-generator}/examples/user_story_sample.md +0 -0
  58. /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/SKILL.md +0 -0
  59. /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/BaseScreen.java +0 -0
  60. /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/LoginScreen.java +0 -0
  61. /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/TC_MobileLogin.java +0 -0
  62. /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/SKILL.md +0 -0
  63. /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/examples/live_probe_script.js +0 -0
  64. /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/advanced_superpowers.md +0 -0
  65. /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/compact_accessibility_snapshots.md +0 -0
  66. /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/recipes.md +0 -0
  67. /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/swarm_orchestration.md +0 -0
  68. /package/.agents/skills/{playwright-webapp-testing → 01-web-automation/playwright-webapp-testing}/examples/server_lifecycle_playwright.py +0 -0
  69. /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/SKILL.md +0 -0
  70. /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/examples/benchmark_report_sample.json +0 -0
  71. /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/examples/enterprise_tasks_suite.json +0 -0
  72. /package/.agents/skills/{architecture-decision-records → 02-test-design/architecture-decision-records}/SKILL.md +0 -0
  73. /package/.agents/skills/{architecture-decision-records → 02-test-design/architecture-decision-records}/examples/0001-record-architecture-decisions.md +0 -0
  74. /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/SKILL.md +0 -0
  75. /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/examples/checkout.feature +0 -0
  76. /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/examples/suite_report_sample.json +0 -0
  77. /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/SKILL.md +0 -0
  78. /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/examples/checkout_rbt_manual_suite.md +0 -0
  79. /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/references/field_validation_checklist.md +0 -0
  80. /package/.agents/skills/{review-spec → 02-test-design/review-spec}/SKILL.md +0 -0
  81. /package/.agents/skills/{review-spec → 02-test-design/review-spec}/examples/pocock_grilling_decision_rubric.md +0 -0
  82. /package/.agents/skills/{review-spec → 02-test-design/review-spec}/examples/sample_spec_review.md +0 -0
  83. /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/SKILL.md +0 -0
  84. /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/examples/payment_gateway_tot_tree.json +0 -0
  85. /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/examples/tot_graph_sample.json +0 -0
  86. /package/.agents/skills/{api-network-mocking-interception → 03-api-and-contracts/api-network-mocking-interception}/SKILL.md +0 -0
  87. /package/.agents/skills/{api-network-mocking-interception → 03-api-and-contracts/api-network-mocking-interception}/examples/network_route_stub.json +0 -0
  88. /package/.agents/skills/{api-spec-to-e2e-matrix → 03-api-and-contracts/api-spec-to-e2e-matrix}/SKILL.md +0 -0
  89. /package/.agents/skills/{api-spec-to-e2e-matrix → 03-api-and-contracts/api-spec-to-e2e-matrix}/examples/sample_openapi.json +0 -0
  90. /package/.agents/skills/{consumer-driven-contract-testing → 03-api-and-contracts/consumer-driven-contract-testing}/SKILL.md +0 -0
  91. /package/.agents/skills/{consumer-driven-contract-testing → 03-api-and-contracts/consumer-driven-contract-testing}/examples/order_service_pact.json +0 -0
  92. /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/SKILL.md +0 -0
  93. /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/examples/k6_load_test_sample.js +0 -0
  94. /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/references/k6_load_template.js +0 -0
  95. /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/SKILL.md +0 -0
  96. /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/examples/sample_benchmark_gain.md +0 -0
  97. /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/examples/sample_scoreboard.md +0 -0
  98. /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/SKILL.md +0 -0
  99. /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/examples/cwv_budget_policy.json +0 -0
  100. /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/examples/playwright_cwv_profiler_fixture.ts +0 -0
  101. /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/SKILL.md +0 -0
  102. /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/examples/dast_scan_config.json +0 -0
  103. /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/AI-AND-LLM.md +0 -0
  104. /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/ATTACK-CLASSES.md +0 -0
  105. /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/dast_recipes.ts +0 -0
  106. /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/SKILL.md +0 -0
  107. /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/examples/audit_threat_vectors_report.json +0 -0
  108. /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/examples/safe_mcp_config.json +0 -0
  109. /package/.agents/skills/{wcag-audit-patterns → 05-security-and-compliance/wcag-audit-patterns}/examples/wcag_compliance_checklist.json +0 -0
  110. /package/.agents/skills/{wcag-audit-patterns → 05-security-and-compliance/wcag-audit-patterns}/resources/implementation-playbook.md +0 -0
  111. /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/SKILL.md +0 -0
  112. /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/examples/healing_report_sample.json +0 -0
  113. /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/examples/three_phase_repair_workflow.md +0 -0
  114. /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/SKILL.md +0 -0
  115. /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/examples/dod_gate_policy.json +0 -0
  116. /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/examples/sprint_dod_enforcement.md +0 -0
  117. /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/SKILL.md +0 -0
  118. /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/examples/closed_loop_healing_walkthrough.md +0 -0
  119. /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/examples/sample_junit_failure.xml +0 -0
  120. /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/references/healing_matrix.md +0 -0
  121. /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/references/qa_investigation_protocol.md +0 -0
  122. /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/scripts/triage_failures.sh +0 -0
  123. /package/.agents/skills/{flaky-test-sentinel-and-quarantine → 06-healing-and-resilience/flaky-test-sentinel-and-quarantine}/SKILL.md +0 -0
  124. /package/.agents/skills/{flaky-test-sentinel-and-quarantine → 06-healing-and-resilience/flaky-test-sentinel-and-quarantine}/examples/quarantine_registry.json +0 -0
  125. /package/.agents/skills/{self-healing-locator → 06-healing-and-resilience/self-healing-locator}/SKILL.md +0 -0
  126. /package/.agents/skills/{self-healing-locator → 06-healing-and-resilience/self-healing-locator}/examples/aom_diff_sample.json +0 -0
  127. /package/.agents/skills/{systematic-debugging → 06-healing-and-resilience/systematic-debugging}/SKILL.md +0 -0
  128. /package/.agents/skills/{systematic-debugging → 06-healing-and-resilience/systematic-debugging}/examples/four_phase_case.md +0 -0
  129. /package/.agents/skills/{test-driven-development → 06-healing-and-resilience/test-driven-development}/SKILL.md +0 -0
  130. /package/.agents/skills/{test-driven-development → 06-healing-and-resilience/test-driven-development}/examples/red_green_refactor_qa.md +0 -0
  131. /package/.agents/skills/{verification-before-completion → 06-healing-and-resilience/verification-before-completion}/SKILL.md +0 -0
  132. /package/.agents/skills/{verification-before-completion → 06-healing-and-resilience/verification-before-completion}/examples/evidence_log_example.md +0 -0
  133. /package/.agents/skills/{visual-regression-sentinel → 06-healing-and-resilience/visual-regression-sentinel}/SKILL.md +0 -0
  134. /package/.agents/skills/{visual-regression-sentinel → 06-healing-and-resilience/visual-regression-sentinel}/examples/visual_mask_rules.json +0 -0
  135. /package/.agents/skills/{db-state-verifier-and-seeder → 07-data-and-state/db-state-verifier-and-seeder}/SKILL.md +0 -0
  136. /package/.agents/skills/{db-state-verifier-and-seeder → 07-data-and-state/db-state-verifier-and-seeder}/examples/db_fixture_seed.json +0 -0
  137. /package/.agents/skills/{file-and-report-validator → 07-data-and-state/file-and-report-validator}/SKILL.md +0 -0
  138. /package/.agents/skills/{file-and-report-validator → 07-data-and-state/file-and-report-validator}/examples/sample_export_schema.json +0 -0
  139. /package/.agents/skills/{synthetic-test-data-generator → 07-data-and-state/synthetic-test-data-generator}/SKILL.md +0 -0
  140. /package/.agents/skills/{synthetic-test-data-generator → 07-data-and-state/synthetic-test-data-generator}/examples/idempotent_data_recipe.json +0 -0
  141. /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/SKILL.md +0 -0
  142. /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/examples/refactored_page_sample.groovy +0 -0
  143. /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/examples/refactored_playwright_pom.ts +0 -0
  144. /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/resources/implementation-playbook.md +0 -0
  145. /package/.agents/skills/{graphify-impact-analyzer → 08-code-quality/graphify-impact-analyzer}/SKILL.md +0 -0
  146. /package/.agents/skills/{graphify-impact-analyzer → 08-code-quality/graphify-impact-analyzer}/examples/dependency_blast_radius.json +0 -0
  147. /package/.agents/skills/{lean-code-ladder → 08-code-quality/lean-code-ladder}/SKILL.md +0 -0
  148. /package/.agents/skills/{lean-code-ladder → 08-code-quality/lean-code-ladder}/examples/ladder_walkthrough.md +0 -0
  149. /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/SKILL.md +0 -0
  150. /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/examples/sample_audit_walkthrough.md +0 -0
  151. /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/examples/sample_repo_audit.md +0 -0
  152. /package/.agents/skills/{senior-code-review → 08-code-quality/senior-code-review}/SKILL.md +0 -0
  153. /package/.agents/skills/{senior-code-review → 08-code-quality/senior-code-review}/examples/sample_review_walkthrough.md +0 -0
  154. /package/.agents/skills/{surgical-coding-principles → 08-code-quality/surgical-coding-principles}/SKILL.md +0 -0
  155. /package/.agents/skills/{surgical-coding-principles → 08-code-quality/surgical-coding-principles}/examples/surgical_vs_scope_creep.md +0 -0
  156. /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/SKILL.md +0 -0
  157. /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/examples/sample_debt_ledger.md +0 -0
  158. /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/examples/sample_ledger_output.md +0 -0
  159. /package/.agents/skills/{github-actions-templates → 09-ci-and-devops/github-actions-templates}/SKILL.md +0 -0
  160. /package/.agents/skills/{github-actions-templates → 09-ci-and-devops/github-actions-templates}/examples/matrix_test_pipeline.yml +0 -0
  161. /package/.agents/skills/{actor-qa-swarm → 10-agent-orchestration/actor-qa-swarm}/SKILL.md +0 -0
  162. /package/.agents/skills/{actor-qa-swarm → 10-agent-orchestration/actor-qa-swarm}/examples/broker_sharding_sample.json +0 -0
  163. /package/.agents/skills/{agent-orchestration-multi-agent-optimize → 10-agent-orchestration/agent-orchestration-multi-agent-optimize}/SKILL.md +0 -0
  164. /package/.agents/skills/{agent-orchestration-multi-agent-optimize → 10-agent-orchestration/agent-orchestration-multi-agent-optimize}/examples/swarm_workload_config.json +0 -0
  165. /package/.agents/skills/{event-stream-qa-orchestrator → 10-agent-orchestration/event-stream-qa-orchestrator}/SKILL.md +0 -0
  166. /package/.agents/skills/{event-stream-qa-orchestrator → 10-agent-orchestration/event-stream-qa-orchestrator}/examples/timeline_sample.jsonl +0 -0
  167. /package/.agents/skills/{persistent-planning-files → 10-agent-orchestration/persistent-planning-files}/SKILL.md +0 -0
  168. /package/.agents/skills/{persistent-planning-files → 10-agent-orchestration/persistent-planning-files}/examples/task_plan_example.md +0 -0
  169. /package/.agents/skills/{qa-memory-os → 10-agent-orchestration/qa-memory-os}/SKILL.md +0 -0
  170. /package/.agents/skills/{qa-memory-os → 10-agent-orchestration/qa-memory-os}/examples/archival_memory_sample.json +0 -0
  171. /package/.agents/skills/{meta-prompt-crafter → 11-ai-and-prompting/meta-prompt-crafter}/SKILL.md +0 -0
  172. /package/.agents/skills/{meta-prompt-crafter → 11-ai-and-prompting/meta-prompt-crafter}/examples/qa_prompt_template.md +0 -0
  173. /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/SKILL.md +0 -0
  174. /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/examples/compiled_module_sample.json +0 -0
  175. /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/examples/dspy_assertion_optimizer_case.md +0 -0
  176. /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/SKILL.md +0 -0
  177. /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/examples/surgical_code_window_walkthrough.md +0 -0
  178. /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/examples/surgical_edit_sample.json +0 -0
  179. /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/SKILL.md +0 -0
  180. /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/examples/distilled_log_sample.txt +0 -0
  181. /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/references/context_engineering_guide.md +0 -0
@@ -15,6 +15,15 @@ import glob
15
15
  import xml.etree.ElementTree as ET
16
16
  import re
17
17
 
18
+ try:
19
+ from cache_resolver import compute_error_fingerprint
20
+ except ImportError:
21
+ try:
22
+ from tools.cache_resolver import compute_error_fingerprint
23
+ except ImportError:
24
+ def compute_error_fingerprint(t, m, a=""):
25
+ return f"fp_fallback_{hash((t, m, a)) & 0xffffffff:08x}"
26
+
18
27
  if hasattr(sys.stdout, 'reconfigure'):
19
28
  try:
20
29
  sys.stdout.reconfigure(encoding='utf-8')
@@ -144,13 +153,16 @@ def parse_failures(xml_path):
144
153
  except (ValueError, TypeError):
145
154
  formatted_time = "0.0s"
146
155
 
156
+ tc_short = tc_name.split("/")[-1]
157
+ fp = compute_error_fingerprint(tc_short, reason.split("\n")[0], f"{f_file}:{f_line}")
147
158
  failures.append({
148
- "tc": tc_name.split("/")[-1],
159
+ "tc": tc_short,
149
160
  "time": formatted_time,
150
161
  "reason": reason.split("\n")[0][:180],
151
162
  "failed_at": failed_locs[:2] if failed_locs else ["See JUnit report"],
152
163
  "file": f_file,
153
- "line": f_line
164
+ "line": f_line,
165
+ "fingerprint": fp,
154
166
  })
155
167
 
156
168
  return failures
@@ -0,0 +1,373 @@
1
+ #!/usr/bin/env python3
2
+ # SPDX-FileCopyrightText: Copyright (c) 2026 Thế Vị (@TeeVee98). All rights reserved.
3
+ # SPDX-License-Identifier: MIT
4
+ # Project: Synapse-Hub (https://github.com/TeeVee98/Synapse-Hub)
5
+
6
+ """
7
+ tools/rules_router.py — Progressive Rules Router & Context Optimizer (Boost B2)
8
+ --------------------------------------------------------------------------------
9
+ Dynamically inspects workspace markers (Playwright, Cypress, Appium, K6, Security,
10
+ API) to route and emit ONLY the minimal necessary rule files and skill subset.
11
+ Prevents 4,000+ tokens of rule/skill bloat per agent turn while ensuring 100%
12
+ quality gate compliance.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import argparse
18
+ import glob
19
+ import json
20
+ import os
21
+ import sys
22
+ from typing import Any, Dict, List, Set
23
+
24
+ if hasattr(sys.stdout, "reconfigure"):
25
+ try:
26
+ sys.stdout.reconfigure(encoding="utf-8")
27
+ sys.stderr.reconfigure(encoding="utf-8")
28
+ except Exception:
29
+ pass
30
+
31
+ # Token constants for estimation (1 token ~= 4 chars)
32
+ CHARS_PER_TOKEN = 4
33
+
34
+ # Base rules always recommended (Attribution guard, communication style, precedence)
35
+ CORE_BASE_RULES = [
36
+ "author-integrity-guard.md",
37
+ "communication-style.md",
38
+ "skill-precedence.md",
39
+ ]
40
+
41
+ # Stack-to-Rule mappings
42
+ STACK_RULE_MAPPINGS = {
43
+ "playwright": ["mandatory-playwright-live.md", "systematic-debugging.md"],
44
+ "cypress": ["systematic-debugging.md"],
45
+ "mobile": ["mobile_appium_rules.md", "systematic-debugging.md"],
46
+ "performance": ["performance_testing_rules.md"],
47
+ "security": ["security_testing_rules.md"],
48
+ "api": ["systematic-debugging.md"],
49
+ "git": ["git-push-protocol.md"],
50
+ }
51
+
52
+ # Stack-to-Skill mappings (scoped down to essential skills per domain)
53
+ STACK_SKILL_MAPPINGS = {
54
+ "playwright": [
55
+ "playwright-webapp-testing",
56
+ "playwright-live-interaction",
57
+ "clean-pom-crafter",
58
+ "api-network-mocking-interception",
59
+ "self-healing-locator",
60
+ ],
61
+ "cypress": [
62
+ "clean-pom-crafter",
63
+ "api-network-mocking-interception",
64
+ "self-healing-locator",
65
+ ],
66
+ "mobile": [
67
+ "mobile-appium-som",
68
+ "clean-pom-crafter",
69
+ ],
70
+ "performance": [
71
+ "backend-load-and-stress-patterns",
72
+ ],
73
+ "security": [
74
+ "security-dast-sentinel",
75
+ "skillspector-security-guard",
76
+ ],
77
+ "api": [
78
+ "api-spec-to-e2e-matrix",
79
+ "consumer-driven-contract-testing",
80
+ "api-network-mocking-interception",
81
+ ],
82
+ }
83
+
84
+ DEFAULT_CORE_SKILLS = [
85
+ "clean-pom-crafter",
86
+ "verification-before-completion",
87
+ "systematic-debugging",
88
+ ]
89
+
90
+ # Total baseline tokens when unrouted (all rules ~15KB + 53 skill descriptions ~12KB ~= 6,750 tokens)
91
+ ESTIMATED_UNROUTED_TOKENS = 6500
92
+
93
+
94
+ def _find_repo_root() -> str:
95
+ """Finds the root of Synapse-Hub repository."""
96
+ curr = os.path.abspath(os.path.dirname(__file__))
97
+ while curr != os.path.dirname(curr):
98
+ if os.path.exists(os.path.join(curr, "AGENTS.md")) and os.path.exists(os.path.join(curr, ".agents")):
99
+ return curr
100
+ curr = os.path.dirname(curr)
101
+ return os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
102
+
103
+
104
+ def detect_workspace_stacks(workspace_dir: str) -> Dict[str, Any]:
105
+ """
106
+ Inspects workspace directory up to 2 levels deep to identify active tech stacks.
107
+ Ignores heavy vendor and cache folders (.git, node_modules, build, etc.).
108
+ """
109
+ workspace = os.path.abspath(workspace_dir)
110
+ detected: Dict[str, List[str]] = {
111
+ "playwright": [],
112
+ "cypress": [],
113
+ "mobile": [],
114
+ "performance": [],
115
+ "security": [],
116
+ "api": [],
117
+ "git": [],
118
+ }
119
+
120
+ if not os.path.isdir(workspace):
121
+ return {"detected_stacks": [], "evidence": detected}
122
+
123
+ # Fast check for git
124
+ if os.path.isdir(os.path.join(workspace, ".git")):
125
+ detected["git"].append(".git directory")
126
+
127
+ # Read package.json / requirements / configs in root
128
+ pkg_json = os.path.join(workspace, "package.json")
129
+ if os.path.isfile(pkg_json):
130
+ try:
131
+ with open(pkg_json, "r", encoding="utf-8", errors="ignore") as f:
132
+ content = f.read().lower()
133
+ if "playwright" in content or "@playwright/test" in content:
134
+ detected["playwright"].append("package.json (playwright dependency)")
135
+ if "cypress" in content:
136
+ detected["cypress"].append("package.json (cypress dependency)")
137
+ if "appium" in content:
138
+ detected["mobile"].append("package.json (appium dependency)")
139
+ if "k6" in content or "artillery" in content:
140
+ detected["performance"].append("package.json (perf dependency)")
141
+ except Exception as err:
142
+ _ = err
143
+
144
+ # Read Python requirement / project config markers (requirements*.txt, pyproject.toml, Pipfile)
145
+ for py_cfg_name in ("requirements.txt", "requirements-dev.txt", "pyproject.toml", "Pipfile", "setup.py"):
146
+ py_cfg = os.path.join(workspace, py_cfg_name)
147
+ if os.path.isfile(py_cfg):
148
+ try:
149
+ with open(py_cfg, "r", encoding="utf-8", errors="ignore") as f:
150
+ content = f.read().lower()
151
+ if "playwright" in content or "pytest-playwright" in content:
152
+ detected["playwright"].append(f"{py_cfg_name} (playwright dependency)")
153
+ if "cypress" in content:
154
+ detected["cypress"].append(f"{py_cfg_name} (cypress dependency)")
155
+ if "appium" in content:
156
+ detected["mobile"].append(f"{py_cfg_name} (appium dependency)")
157
+ if "locust" in content or "k6" in content:
158
+ detected["performance"].append(f"{py_cfg_name} (performance dependency)")
159
+ if "bandit" in content or "semgrep" in content:
160
+ detected["security"].append(f"{py_cfg_name} (security dependency)")
161
+ except Exception as err:
162
+ _ = err
163
+
164
+ # Read JVM build markers (build.gradle, build.gradle.kts, pom.xml)
165
+ for jvm_cfg_name in ("build.gradle", "build.gradle.kts", "pom.xml"):
166
+ jvm_cfg = os.path.join(workspace, jvm_cfg_name)
167
+ if os.path.isfile(jvm_cfg):
168
+ try:
169
+ with open(jvm_cfg, "r", encoding="utf-8", errors="ignore") as f:
170
+ content = f.read().lower()
171
+ if "playwright" in content:
172
+ detected["playwright"].append(f"{jvm_cfg_name} (playwright dependency)")
173
+ if "appium" in content:
174
+ detected["mobile"].append(f"{jvm_cfg_name} (appium dependency)")
175
+ if "jmeter" in content or "gatling" in content:
176
+ detected["performance"].append(f"{jvm_cfg_name} (performance dependency)")
177
+ if "pact" in content or "rest-assured" in content:
178
+ detected["api"].append(f"{jvm_cfg_name} (api contract dependency)")
179
+ except Exception as err:
180
+ _ = err
181
+
182
+ # Scan files up to depth 2
183
+ ignored = {".git", "node_modules", ".venv", "venv", "__pycache__", "dist", "build", "target", ".gradle"}
184
+ for root, dirs, files in os.walk(workspace):
185
+ rel = os.path.relpath(root, workspace)
186
+ depth = 0 if rel == "." else len(rel.split(os.sep))
187
+ if depth >= 2:
188
+ dirs.clear()
189
+ continue
190
+ dirs[:] = [d for d in dirs if d not in ignored]
191
+
192
+ for file_name in files:
193
+ f_lower = file_name.lower()
194
+ rel_file = os.path.join(rel, file_name) if rel != "." else file_name
195
+
196
+ # Playwright markers
197
+ if f_lower.startswith("playwright.config."):
198
+ detected["playwright"].append(rel_file)
199
+
200
+ # Cypress markers
201
+ if f_lower.startswith("cypress.config.") or f_lower == "cypress.json":
202
+ detected["cypress"].append(rel_file)
203
+
204
+ # Mobile markers
205
+ if f_lower in ("caps.json", "androidmanifest.xml") or f_lower.endswith(".xcodeproj"):
206
+ detected["mobile"].append(rel_file)
207
+
208
+ # Performance markers
209
+ if f_lower.endswith(".jmx") or f_lower == "locustfile.py" or ".k6." in f_lower or f_lower == "k6.js":
210
+ detected["performance"].append(rel_file)
211
+
212
+ # Security markers
213
+ if any(k in f_lower for k in ("zap", "burp", "nuclei", "semgrep.yml")):
214
+ detected["security"].append(rel_file)
215
+
216
+ # API markers
217
+ if f_lower in ("openapi.json", "openapi.yaml", "swagger.json", "swagger.yaml") or f_lower.endswith(".pact.json"):
218
+ detected["api"].append(rel_file)
219
+
220
+ active_stacks = [stack for stack, evidence in detected.items() if evidence]
221
+ return {
222
+ "detected_stacks": active_stacks,
223
+ "evidence": {k: v for k, v in detected.items() if v},
224
+ }
225
+
226
+
227
+ def route_rules(workspace_dir: str = ".") -> Dict[str, Any]:
228
+ """
229
+ Determines the minimal set of rules and skills for the target workspace.
230
+ Calculates estimated tokens consumed versus the unrouted baseline.
231
+ """
232
+ repo_root = _find_repo_root()
233
+ stack_info = detect_workspace_stacks(workspace_dir)
234
+ active_stacks = stack_info["detected_stacks"]
235
+
236
+ # Compile rules
237
+ rules_set: Set[str] = set(CORE_BASE_RULES)
238
+ for stack in active_stacks:
239
+ for r in STACK_RULE_MAPPINGS.get(stack, []):
240
+ rules_set.add(r)
241
+
242
+ # Compile skills
243
+ skills_set: Set[str] = set(DEFAULT_CORE_SKILLS)
244
+ for stack in active_stacks:
245
+ for s in STACK_SKILL_MAPPINGS.get(stack, []):
246
+ skills_set.add(s)
247
+
248
+ # Ensure rule files exist in .agents/rules
249
+ rules_dir = os.path.join(repo_root, ".agents", "rules")
250
+ valid_rules: List[str] = []
251
+ total_rule_bytes = 0
252
+
253
+ for r in sorted(rules_set):
254
+ rule_path = os.path.join(rules_dir, r)
255
+ if os.path.isfile(rule_path):
256
+ valid_rules.append(r)
257
+ try:
258
+ total_rule_bytes += os.path.getsize(rule_path)
259
+ except OSError:
260
+ total_rule_bytes += 2000
261
+ else:
262
+ valid_rules.append(r)
263
+ total_rule_bytes += 2000
264
+
265
+ # Dynamic calculation of unrouted baseline from actual rules directory + 53 skill catalogue
266
+ unrouted_rule_bytes = 0
267
+ if os.path.isdir(rules_dir):
268
+ for f in os.listdir(rules_dir):
269
+ if f.endswith(".md"):
270
+ try:
271
+ unrouted_rule_bytes += os.path.getsize(os.path.join(rules_dir, f))
272
+ except OSError:
273
+ unrouted_rule_bytes += 2500
274
+ else:
275
+ unrouted_rule_bytes = 30000
276
+
277
+ unrouted_baseline = (unrouted_rule_bytes // CHARS_PER_TOKEN) + (53 * 120)
278
+ unrouted_baseline = max(unrouted_baseline, ESTIMATED_UNROUTED_TOKENS)
279
+
280
+ # Skill tokens (~120 tokens per skill metadata summary)
281
+ skill_tokens = len(skills_set) * 120
282
+ rule_tokens = total_rule_bytes // CHARS_PER_TOKEN
283
+ total_routed_tokens = rule_tokens + skill_tokens
284
+
285
+ # Ensure estimated savings calculation
286
+ tokens_saved = max(0, unrouted_baseline - total_routed_tokens)
287
+
288
+ return {
289
+ "workspace": os.path.abspath(workspace_dir),
290
+ "detected_stacks": active_stacks,
291
+ "evidence": stack_info["evidence"],
292
+ "recommended_rules": valid_rules,
293
+ "recommended_skills": sorted(skills_set),
294
+ "token_metrics": {
295
+ "unrouted_baseline_tokens": unrouted_baseline,
296
+ "routed_tokens": total_routed_tokens,
297
+ "tokens_saved": tokens_saved,
298
+ "reduction_percentage": round((tokens_saved / unrouted_baseline) * 100, 1),
299
+ },
300
+ }
301
+
302
+
303
+ def format_routing_report(result: Dict[str, Any], fmt: str = "text") -> str:
304
+ """Formats the routing outcome into human-readable text or JSON."""
305
+ if fmt == "json":
306
+ return json.dumps(result, indent=2, ensure_ascii=False)
307
+
308
+ metrics = result["token_metrics"]
309
+ stacks_str = ", ".join(result["detected_stacks"]) if result["detected_stacks"] else "Standard QA / Clean POM"
310
+
311
+ lines = [
312
+ "╔══════════════════════════════════════════════════════════════════╗",
313
+ "║ SYNAPSE HUB — PROGRESSIVE RULES ROUTER (BOOST B2) ║",
314
+ "╚══════════════════════════════════════════════════════════════════╝",
315
+ f"Target Workspace: {result['workspace']}",
316
+ f"Active Stacks : {stacks_str}",
317
+ "",
318
+ "─── Minimal Recommended Rules ───",
319
+ ]
320
+ for r in result["recommended_rules"]:
321
+ lines.append(f" ✓ .agents/rules/{r}")
322
+
323
+ lines.append("")
324
+ lines.append("─── Minimal Recommended Skills ───")
325
+ for s in result["recommended_skills"]:
326
+ lines.append(f" ⚡ {s}")
327
+
328
+ lines.append("")
329
+ lines.append("─── Token Optimization Metrics ───")
330
+ lines.append(f" Unrouted Baseline : {metrics['unrouted_baseline_tokens']:,} tokens")
331
+ lines.append(f" Progressive Routed: {metrics['routed_tokens']:,} tokens")
332
+ lines.append(f" Tokens Saved/Turn : {metrics['tokens_saved']:,} tokens ({metrics['reduction_percentage']}%)")
333
+ lines.append("════════════════════════════════════════════════════════════════════")
334
+
335
+ return "\n".join(lines)
336
+
337
+
338
+ def main():
339
+ parser = argparse.ArgumentParser(
340
+ description="Progressive Rules Router & Context Optimizer (Boost B2)"
341
+ )
342
+ parser.add_argument(
343
+ "workspace",
344
+ nargs="?",
345
+ default=".",
346
+ help="Target workspace directory to inspect (default: .)",
347
+ )
348
+ parser.add_argument(
349
+ "--json",
350
+ action="store_true",
351
+ help="Output raw JSON data instead of text format",
352
+ )
353
+ parser.add_argument(
354
+ "--summary",
355
+ action="store_true",
356
+ help="Print single-line summary of routed rules and tokens saved",
357
+ )
358
+ args = parser.parse_args()
359
+
360
+ result = route_rules(args.workspace)
361
+
362
+ if args.json:
363
+ print(format_routing_report(result, fmt="json"))
364
+ elif args.summary:
365
+ m = result["token_metrics"]
366
+ stacks = ",".join(result["detected_stacks"]) or "base"
367
+ print(f"[RULES-ROUTER] Stacks: {stacks} | Rules: {len(result['recommended_rules'])} | Saved: {m['tokens_saved']:,} tokens/turn ({m['reduction_percentage']}%)")
368
+ else:
369
+ print(format_routing_report(result, fmt="text"))
370
+
371
+
372
+ if __name__ == "__main__":
373
+ main()
@@ -236,7 +236,7 @@ class SynapseUiHandler(BaseHTTPRequestHandler):
236
236
  if path == "/api/status":
237
237
  active_target = JOB_MANAGER.target_dir or REPO_ROOT
238
238
  self.send_json(200, {
239
- "version": "3.10.0",
239
+ "version": "4.0.0",
240
240
  "status": "ONLINE",
241
241
  "os": sys.platform,
242
242
  "workspace": active_target,
@@ -65,7 +65,7 @@ def get_local_version():
65
65
  try:
66
66
  with open(pkg_file, "r", encoding="utf-8") as f:
67
67
  data = json.load(f)
68
- return data.get("version", "3.10.0")
68
+ return data.get("version", "4.0.0")
69
69
  except (OSError, json.JSONDecodeError):
70
70
  data = {}
71
71
 
@@ -74,11 +74,11 @@ def get_local_version():
74
74
  try:
75
75
  with open(manifest_file, "r", encoding="utf-8") as f:
76
76
  data = json.load(f)
77
- return data.get("version", "3.10.0")
77
+ return data.get("version", "4.0.0")
78
78
  except (OSError, json.JSONDecodeError):
79
79
  data = {}
80
80
 
81
- return "3.10.0"
81
+ return "4.0.0"
82
82
 
83
83
 
84
84
  def fetch_remote_version():
@@ -581,6 +581,7 @@ def check_python_ast_integrity(repo_root):
581
581
  """
582
582
  Performs static AST validation across all Python files in the repository.
583
583
  Enforces F821 parity (zero undefined variable names) and zero syntax errors.
584
+ Accelerated with Boost B3 AST Dataflow Pre-Validation Cache.
584
585
  """
585
586
  builtin_names = set(dir(builtins)) | {'__file__', '__name__', '__doc__', '__package__'}
586
587
  py_files = []
@@ -594,14 +595,44 @@ def check_python_ast_integrity(repo_root):
594
595
 
595
596
  violations = []
596
597
 
598
+ # Boost B3: Initialize AST Pre-Validation Cache
599
+ try:
600
+ from ast_cache import get_ast_cache
601
+ cache = get_ast_cache(repo_root)
602
+ except Exception:
603
+ try:
604
+ from tools.ast_cache import get_ast_cache
605
+ cache = get_ast_cache(repo_root)
606
+ except Exception:
607
+ try:
608
+ tools_dir = os.path.dirname(os.path.abspath(__file__))
609
+ if tools_dir not in sys.path:
610
+ sys.path.insert(0, tools_dir)
611
+ from ast_cache import get_ast_cache
612
+ cache = get_ast_cache(repo_root)
613
+ except Exception:
614
+ cache = None
615
+
597
616
  for file_path in sorted(py_files):
598
617
  rel_path = os.path.relpath(file_path, repo_root)
618
+
619
+ sig = cache.get_signature(file_path) if cache else None
620
+ if sig is not None:
621
+ cached_data = cache.get_cached_result(rel_path, sig[0], sig[1])
622
+ if cached_data is not None:
623
+ cached_viols = cached_data.get("violations", [])
624
+ violations.extend([(rel_path, v[0], v[1]) for v in cached_viols])
625
+ continue
626
+
599
627
  try:
600
628
  with open(file_path, 'r', encoding='utf-8', errors='ignore') as fp:
601
629
  content = fp.read()
602
630
  tree = ast.parse(content, file_path)
603
631
  except SyntaxError as e:
604
- violations.append((rel_path, e.lineno or 1, f"SyntaxError: {e.msg}"))
632
+ syntax_viol = (rel_path, e.lineno or 1, f"SyntaxError: {e.msg}")
633
+ violations.append(syntax_viol)
634
+ if cache and sig is not None:
635
+ cache.put_result(rel_path, sig[0], sig[1], {"violations": [[syntax_viol[1], syntax_viol[2]]]})
605
636
  continue
606
637
 
607
638
  module_names = set(builtin_names)
@@ -757,6 +788,17 @@ def check_python_ast_integrity(repo_root):
757
788
  visitor.visit(tree)
758
789
  violations.extend(visitor.file_violations)
759
790
 
791
+ if cache and sig is not None:
792
+ cache.put_result(
793
+ rel_path,
794
+ sig[0],
795
+ sig[1],
796
+ {"violations": [[v[1], v[2]] for v in visitor.file_violations]}
797
+ )
798
+
799
+ if cache:
800
+ cache.save()
801
+
760
802
  return violations
761
803
 
762
804
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
3
  tools/wcag_audit.py - Automated Accessibility (WCAG 2.2) Linter & Auditor
4
- Operationalizes the .agents/skills/wcag-audit-patterns skill for Web & Enterprise Applications.
4
+ Operationalizes the .agents/skills/05-security-and-compliance/wcag-audit-patterns skill for Web & Enterprise Applications.
5
5
 
6
6
  Checks WCAG 2.2 Level A and AA criteria:
7
7
  - WCAG 1.1.1: Images missing alt attributes
@@ -47,7 +47,7 @@ def get_hub_metadata() -> Dict[str, Any]:
47
47
  """Retrieves version and catalog count from skills_manifest.json."""
48
48
  manifest_path = os.path.join(HUB_ROOT, "skills_manifest.json")
49
49
  meta = {
50
- "version": "3.10.0",
50
+ "version": "4.0.0",
51
51
  "totalSkills": 42,
52
52
  "author": "Thế Vị (@TeeVee98)",
53
53
  "repo": "https://github.com/TeeVee98/Synapse-Hub"
@@ -1,77 +0,0 @@
1
- ---
2
- name: wcag-audit-patterns
3
- description: "Audit WCAG 2.2 accessibility (A/AA), keyboard navigation, and ARIA roles. Use when auditing accessibility against WCAG 2.2 A/AA criteria."
4
- ---
5
-
6
- # WCAG 2.2 Accessibility Audit Patterns
7
-
8
- Engineering standards for automated, continuous Web Content Accessibility Guidelines (WCAG 2.2 Level A and AA) auditing across enterprise web applications.
9
-
10
- ---
11
-
12
- ## 1. Core WCAG 2.2 Success Criteria Matrix
13
-
14
- | Criterion | Rule Code | Requirement & Automated Assertion |
15
- | :--- | :--- | :--- |
16
- | **Non-text Content** | WCAG 1.1.1 | All `<img>` tags must possess non-empty `alt` attributes or `aria-hidden="true"` if decorative. |
17
- | **Info and Relationships**| WCAG 1.3.1 | Form controls `<input>`, `<select>` must link to `<label>` via `id/for` or `aria-label`. |
18
- | **Heading Structure** | WCAG 1.3.1 | Headings must not skip levels (e.g. `<h1>` followed immediately by `<h3>`). |
19
- | **Contrast (Minimum)** | WCAG 1.4.3 | Normal text contrast ratio $\ge 4.5:1$; Large text ($\ge 18\text{pt}$ or bold $14\text{pt}$) $\ge 3:1$. |
20
- | **Keyboard Navigable** | WCAG 2.1.1 | All interactive elements must be focusable via `Tab` with visible focus indicators. |
21
- | **No Keyboard Trap** | WCAG 2.1.2 | Focus must not become permanently trapped in modal dialogs; `Esc` key must exit. |
22
- | **Target Size (Minimum)**| WCAG 2.5.8 | Interactive targets must meet $24 \times 24\text{px}$ minimum clickable area (WCAG 2.2 new). |
23
-
24
- ---
25
-
26
- ## 2. Playwright Automated Accessibility Testing Patterns
27
-
28
- ### Pattern A: Integrating `@axe-core/playwright` for Comprehensive Audits
29
- ```typescript
30
- import { test, expect } from '@playwright/test';
31
- import AxeBuilder from '@axe-core/playwright';
32
-
33
- test('verify WCAG 2.2 Level AA compliance on dashboard', async ({ page }) => {
34
- await page.goto('/dashboard');
35
- await page.waitForLoadState('networkidle');
36
-
37
- const accessibilityScanResults = await new AxeBuilder({ page })
38
- .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa'])
39
- .exclude('.legacy-third-party-widget') // Explicitly scoped exclusion
40
- .analyze();
41
-
42
- expect(accessibilityScanResults.violations).toEqual([]);
43
- });
44
- ```
45
-
46
- ### Pattern B: Modal Keyboard Focus Trap and Escape Verification
47
- ```typescript
48
- test('modal dialog traps keyboard focus and closes on Escape', async ({ page }) => {
49
- await page.goto('/settings');
50
- await page.getByRole('button', { name: 'Edit Profile' }).click();
51
-
52
- const modal = page.getByRole('dialog', { name: 'Edit Profile' });
53
- await expect(modal).toBeVisible();
54
-
55
- // Verify focus shifts into modal
56
- await expect(modal.getByRole('textbox', { name: 'Username' })).toBeFocused();
57
-
58
- // Press Escape and verify focus returns to trigger
59
- await page.keyboard.press('Escape');
60
- await expect(modal).toBeHidden();
61
- await expect(page.getByRole('button', { name: 'Edit Profile' })).toBeFocused();
62
- });
63
- ```
64
-
65
- ---
66
-
67
- ## 3. Automated CLI Auditing via Tooling
68
-
69
- Agent can automatically audit accessibility for any HTML file or live page URL via `tools/wcag_audit.py`:
70
-
71
- ```bash
72
- # Audit a local HTML snapshot
73
- python tools/wcag_audit.py path/to/page.html -o docs/wcag_audit_report.md
74
-
75
- # Audit a live application URL directly
76
- python tools/wcag_audit.py https://staging.example.com --url -o docs/wcag_audit_report.md
77
- ```