ux-audit
v0.1.1
Published
Deterministic UI/UX testing and evidence platform for AI-assisted remediation
Maintainers
Readme
ux-audit
Deterministic UI/UX testing and evidence platform for AI-assisted remediation.
ux-audit audits one or more URLs using deterministic checks (Axe + Lighthouse), then writes a structured evidence bundle your AI agent (or team) can use to prioritize and implement fixes.
Features
- Deterministic checks for accessibility and performance
- Flexible scope: single URL, URL list, or base URL + paths
- Pattern opt-in for targeted UX guidance (for example
auth,forms,crud) - Evidence bundle with JSON/Markdown report and per-page artifacts
- Optional screenshots and DOM snapshots for debugging
- Authenticated page support via Playwright storage state
Requirements
- Node.js
>=18 - Chrome/Chromium available for Lighthouse
- Playwright Chromium browser installed for Axe runner
Install
npm install ux-auditIf you are developing this repo locally:
npm install
npm run build
npm run install:browsersQuick Start
Audit a single page:
npx ux-audit audit https://example.comAudit multiple URLs:
npx ux-audit audit --urls https://example.com/,https://example.com/docs --out ./test-runAudit with base URL + paths:
npx ux-audit audit --base-url https://example.com --paths /,/pricing,/docs --patterns auth,formsShow CLI help:
npx ux-audit --helpCLI Usage
ux-audit audit [url] [options]Scope (choose one):
url(positional) or--url <url>--urls <url1,url2,...>--base-url <url> --paths <path1,path2,...>
Options:
--out <dir>output directory (default:./ux-audit-bundle)--patterns <id,id,...>enable pattern-specific checks--include-screenshotsinclude screenshots (default: enabled)--no-screenshotsdisable screenshots--include-dom-snapshotinclude page HTML snapshots--storage-state <path>Playwright auth state JSON--config <path>config file path override--help,-h
Exit codes:
0success with no critical findings1critical findings exist (or runtime failure)
Configuration
By default, the CLI looks for:
ux-audit.config.jsonux-audit.config.js.ux-audit.json
Recommended config format (ux-audit.config.json):
{
"baseUrl": "https://example.com",
"paths": ["/", "/docs"],
"patterns": ["auth", "forms"],
"out": "./custom-out",
"auth": {
"storageState": "./playwright-auth.json"
}
}Supported fields:
urls: string[]baseUrl: stringpaths: string[]patterns: string[]out: stringauth.storageState: string
CLI arguments override config values.
Pattern IDs
Available pattern IDs:
authformscrudnavigationonboardingsearch-filterempty-error-loadingsettingsdashboardscheckoutcontent-displaymodals-overlaysdata-tables
Auditing Authenticated Pages
- Create a Playwright storage state file from a logged-in session:
// Example snippet
await context.storageState({ path: "playwright-auth.json" });- Run audit with that state:
npx ux-audit audit https://yourapp.com/dashboard --storage-state ./playwright-auth.json --out ./test-runSecurity note: storage state contains session data. Never commit it.
Output Bundle
For each run, ux-audit writes:
ux-audit-report.jsonmachine-readable findingsux-audit-report.mdhuman-readable summaryindex.jsonmanifest with scope, patterns, and artifact pathsa11y/*.jsonper-page Axe + heuristics artifactsmetrics/*.jsonper-page Lighthouse artifactsscreenshots/*.pngwhen screenshots are enabledsnapshots/*.htmlwhen--include-dom-snapshotis enabledpatterns.jsonwhen pattern IDs are enabledAGENT_PROMPT.mdguide for consuming findings in an AI workflow
NPM Scripts (repo)
npm run buildcompile TypeScriptnpm run testrun Jest testsnpm run test:noderun Node test runnernpm run install:browsersinstall Playwright Chromiumnpm run audit -- <args>run CLI through package scriptnpm run audit:demorun demo audit againsthttps://example.com
Programmatic API
The package currently exports:
runAuditfromsrc/pipeline/runAudit.tsgetPatternIdsfromsrc/patterns/catalog.ts- report/finding types from
src/report/types.ts
License
MIT
