feat: Initialize MediaWiki project with accessibility-focused workflow
- Added package.json to manage project dependencies and scripts for initialization, setup, and accessibility testing. - Created scripts for initializing MediaWiki, installing dependencies, and starting a development server. - Implemented accessibility testing configurations using Pa11y and Lighthouse. - Added configuration files for accessibility testing with Pa11y and Lighthouse.
This commit is contained in:
commit
277e289c45
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
name: accessibility-reviewer
|
||||
description: Reviews MediaWiki changes for WCAG 2.1 AA conformance
|
||||
model: GPT-5.3-Codex
|
||||
tools:
|
||||
- read_file
|
||||
- grep_search
|
||||
- semantic_search
|
||||
---
|
||||
|
||||
You are an accessibility-focused code reviewer for this repository.
|
||||
|
||||
Objectives:
|
||||
- Enforce WCAG 2.1 AA baseline for any UI or template change.
|
||||
- Treat AAA improvements as best-effort enhancements.
|
||||
- Return findings ordered by severity.
|
||||
|
||||
When reviewing:
|
||||
1. Identify violations affecting keyboard, semantics, labels, focus, contrast, and error handling.
|
||||
2. Reference likely WCAG criteria in plain language.
|
||||
3. Propose concrete code-level fixes.
|
||||
4. Flag missing automated tests where relevant.
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
applyTo:
|
||||
- "mediawiki/skins/**/*.mustache"
|
||||
- "mediawiki/skins/**/*.css"
|
||||
- "mediawiki/skins/**/*.less"
|
||||
- "mediawiki/extensions/**/*.php"
|
||||
- "mediawiki/extensions/**/*.js"
|
||||
---
|
||||
|
||||
# Accessibility Rules For This Repository
|
||||
|
||||
Treat WCAG 2.1 AA as required and AAA as best effort.
|
||||
|
||||
## Required checks in code changes
|
||||
- Use semantic elements for page landmarks and structure.
|
||||
- Ensure all controls are keyboard operable.
|
||||
- Keep visible focus indicators.
|
||||
- Provide labels for form controls and clear error messages.
|
||||
- Keep meaningful alt text on informative images.
|
||||
- Avoid color-only communication.
|
||||
- Maintain AA contrast ratios for text and UI components.
|
||||
|
||||
## Review behavior
|
||||
- Call out WCAG failures with exact remediation.
|
||||
- Prefer MediaWiki/Codex conventions over custom inaccessible patterns.
|
||||
- Recommend tests for any UI change that can regress accessibility.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
node_modules/
|
||||
mediawiki/
|
||||
composer.phar
|
||||
mediawiki/cache/
|
||||
mediawiki/images/
|
||||
mediawiki/vendor/
|
||||
mediawiki/LocalSettings.php
|
||||
.lighthouseci/
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
# GPLX MediaWiki
|
||||
|
||||
Local-first MediaWiki bootstrap for Windows with an accessibility-focused workflow.
|
||||
|
||||
## Quick start
|
||||
|
||||
1. Install prerequisites:
|
||||
|
||||
- Git
|
||||
- Node.js 20+
|
||||
- PHP 8.1+ (XAMPP/WampServer or standalone)
|
||||
|
||||
2. Install Node tooling:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
3. Initialize MediaWiki core:
|
||||
|
||||
```bash
|
||||
npm run mw:init
|
||||
```
|
||||
|
||||
4. Install MediaWiki PHP dependencies:
|
||||
|
||||
```bash
|
||||
npm run mw:deps
|
||||
```
|
||||
|
||||
Or run both steps with one command:
|
||||
|
||||
```bash
|
||||
npm run mw:setup
|
||||
```
|
||||
|
||||
5. Start local dev server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Then open: http://127.0.0.1:8080 and continue setup at /mw-config/index.php
|
||||
|
||||
## Accessibility checks
|
||||
|
||||
Run static/runtime checks against local pages:
|
||||
|
||||
```bash
|
||||
npm run a11y:all
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- This setup runs without Docker.
|
||||
- WCAG AA is the required baseline.
|
||||
- AAA improvements are tracked as best effort.
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# Accessibility Workflow
|
||||
|
||||
## Policy
|
||||
|
||||
- Baseline: WCAG 2.1 AA required
|
||||
- Stretch target: AAA where practical
|
||||
|
||||
## Agent usage
|
||||
|
||||
- Use repository instructions in .github/instructions/accessibility.instructions.md
|
||||
- Use dedicated reviewer in .github/agents/accessibility-reviewer.agent.md
|
||||
|
||||
## Developer checklist
|
||||
|
||||
- Keyboard-only interaction works for all interactive elements
|
||||
- Focus state remains visible in every state
|
||||
- Forms have programmatic labels and useful error hints
|
||||
- Landmarks and heading order are logical
|
||||
- Contrast meets AA ratios
|
||||
- Content is understandable without color cues alone
|
||||
|
||||
## Tooling
|
||||
|
||||
- Pa11y CI with WCAG2AA profile
|
||||
- Lighthouse accessibility scoring
|
||||
|
||||
## Local command
|
||||
|
||||
```bash
|
||||
npm run a11y:all
|
||||
```
|
||||
|
||||
Run after any template, style, or interaction change.
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# Windows Installation (No Docker)
|
||||
|
||||
## 1. Install prerequisites
|
||||
|
||||
- Git
|
||||
- Node.js 20+
|
||||
- PHP 8.1+ with required extensions for MediaWiki
|
||||
- One database option:
|
||||
- SQLite for fast local tests, or
|
||||
- MariaDB/MySQL for production-like behavior
|
||||
|
||||
## 2. Install project dependencies
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
## 3. Fetch MediaWiki source
|
||||
|
||||
```bash
|
||||
npm run mw:init
|
||||
```
|
||||
|
||||
Default branch is REL1_43 in scripts/mw-init.ps1. Adjust if needed.
|
||||
|
||||
## 4. Start local server
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Open http://127.0.0.1:8080 and complete the MediaWiki web installer.
|
||||
|
||||
## 5. Save LocalSettings.php
|
||||
|
||||
After installer completion, place generated LocalSettings.php in mediawiki/.
|
||||
|
||||
## 6. Run accessibility checks
|
||||
|
||||
```bash
|
||||
npm run a11y:all
|
||||
```
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "gplx-mediawiki",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"description": "Local MediaWiki project with accessibility-focused workflow",
|
||||
"scripts": {
|
||||
"mw:init": "pwsh -ExecutionPolicy Bypass -File ./scripts/mw-init.ps1",
|
||||
"mw:deps": "pwsh -ExecutionPolicy Bypass -File ./scripts/mw-deps.ps1",
|
||||
"mw:setup": "npm run mw:init && npm run mw:deps",
|
||||
"dev": "pwsh -ExecutionPolicy Bypass -File ./scripts/dev.ps1",
|
||||
"a11y:pa11y": "pa11y-ci --config ./tests/accessibility/pa11y.config.json",
|
||||
"a11y:lighthouse": "lhci autorun --config=./tests/accessibility/lighthouserc.json",
|
||||
"a11y:all": "npm run a11y:pa11y && npm run a11y:lighthouse"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@lhci/cli": "^0.14.0",
|
||||
"pa11y-ci": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
param(
|
||||
[int]$Port = 8080,
|
||||
[string]$HostName = "127.0.0.1"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Resolve-PhpCommand {
|
||||
$phpCommand = Get-Command php -ErrorAction SilentlyContinue
|
||||
if ($phpCommand) {
|
||||
return "php"
|
||||
}
|
||||
|
||||
$candidates = @(
|
||||
"D:\\xampp\\php\\php.exe",
|
||||
"C:\\xampp\\php\\php.exe",
|
||||
"C:\\wamp64\\bin\\php\\php8.3.0\\php.exe",
|
||||
"C:\\wamp64\\bin\\php\\php8.2.0\\php.exe",
|
||||
"C:\\wamp64\\bin\\php\\php8.1.0\\php.exe"
|
||||
)
|
||||
|
||||
foreach ($candidate in $candidates) {
|
||||
if (Test-Path $candidate) {
|
||||
return $candidate
|
||||
}
|
||||
}
|
||||
|
||||
return $null
|
||||
}
|
||||
|
||||
$php = Resolve-PhpCommand
|
||||
if (-not $php) {
|
||||
Write-Error "PHP is not available in PATH and no common XAMPP/Wamp PHP executable was found. Install PHP or add php.exe to PATH."
|
||||
}
|
||||
|
||||
if (-not (Test-Path "./mediawiki")) {
|
||||
Write-Error "Missing ./mediawiki. Run 'npm run mw:init' first."
|
||||
}
|
||||
|
||||
if (-not (Test-Path "./mediawiki/index.php")) {
|
||||
Write-Error "./mediawiki does not look like a valid MediaWiki core directory."
|
||||
}
|
||||
|
||||
Write-Host "Starting MediaWiki dev server at http://$HostName`:$Port"
|
||||
Write-Host "Use Ctrl+C to stop."
|
||||
& $php -S "$HostName`:$Port" -t "./mediawiki"
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Resolve-PhpCommand {
|
||||
$phpCommand = Get-Command php -ErrorAction SilentlyContinue
|
||||
if ($phpCommand) {
|
||||
return "php"
|
||||
}
|
||||
|
||||
$candidates = @(
|
||||
"D:\\xampp\\php\\php.exe",
|
||||
"C:\\xampp\\php\\php.exe",
|
||||
"C:\\wamp64\\bin\\php\\php8.3.0\\php.exe",
|
||||
"C:\\wamp64\\bin\\php\\php8.2.0\\php.exe",
|
||||
"C:\\wamp64\\bin\\php\\php8.1.0\\php.exe"
|
||||
)
|
||||
|
||||
foreach ($candidate in $candidates) {
|
||||
if (Test-Path $candidate) {
|
||||
return $candidate
|
||||
}
|
||||
}
|
||||
|
||||
return $null
|
||||
}
|
||||
|
||||
if (-not (Test-Path "./mediawiki/composer.json")) {
|
||||
Write-Error "Missing ./mediawiki/composer.json. Run 'npm run mw:init' first."
|
||||
}
|
||||
|
||||
$php = Resolve-PhpCommand
|
||||
if (-not $php) {
|
||||
Write-Error "PHP executable not found. Install XAMPP/WampServer or add php.exe to PATH."
|
||||
}
|
||||
|
||||
if (-not (Test-Path "./composer.phar")) {
|
||||
Write-Host "Downloading Composer locally (composer.phar)..."
|
||||
& $php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
if (-not (Test-Path "./composer-setup.php")) {
|
||||
Write-Error "Could not download Composer installer."
|
||||
}
|
||||
& $php .\composer-setup.php --filename=composer.phar
|
||||
Remove-Item .\composer-setup.php -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Write-Host "Checking required PHP extensions..."
|
||||
$loadedExtensions = (& $php -m) | ForEach-Object { $_.Trim().ToLower() }
|
||||
$requiredExtensions = @("intl")
|
||||
$missing = @()
|
||||
|
||||
foreach ($ext in $requiredExtensions) {
|
||||
if ($loadedExtensions -notcontains $ext) {
|
||||
$missing += $ext
|
||||
}
|
||||
}
|
||||
|
||||
if ($missing.Count -gt 0) {
|
||||
Write-Error "Missing PHP extension(s): $($missing -join ', '). Enable them in php.ini and restart dev server."
|
||||
}
|
||||
|
||||
Write-Host "Installing MediaWiki Composer dependencies..."
|
||||
& $php .\composer.phar --working-dir=mediawiki install --no-dev --prefer-dist --optimize-autoloader
|
||||
|
||||
Write-Host "MediaWiki dependencies are installed."
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
param(
|
||||
[string]$Branch = "REL1_43",
|
||||
[string]$RepoUrl = "https://gerrit.wikimedia.org/r/mediawiki/core.git"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (Test-Path "./mediawiki") {
|
||||
Write-Host "mediawiki directory already exists. Skip clone."
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "Cloning MediaWiki branch $Branch..."
|
||||
git clone --depth 1 --branch $Branch $RepoUrl mediawiki
|
||||
|
||||
Write-Host "MediaWiki source ready in ./mediawiki"
|
||||
Write-Host "Next: run 'npm run dev' to start local server."
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"ci": {
|
||||
"collect": {
|
||||
"numberOfRuns": 1,
|
||||
"url": [
|
||||
"http://127.0.0.1:8080/",
|
||||
"http://127.0.0.1:8080/index.php/Main_Page"
|
||||
]
|
||||
},
|
||||
"assert": {
|
||||
"assertions": {
|
||||
"categories:accessibility": [
|
||||
"warn",
|
||||
{
|
||||
"minScore": 0.9
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"upload": {
|
||||
"target": "temporary-public-storage"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"defaults": {
|
||||
"standard": "WCAG2AA",
|
||||
"timeout": 60000,
|
||||
"wait": 1000
|
||||
},
|
||||
"urls": [
|
||||
"http://127.0.0.1:8080/",
|
||||
"http://127.0.0.1:8080/index.php/Main_Page"
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue