thedaviddias/Front-End-Checklist / packages/cli
frontendchecklist
VerifiedReview frontend code and live pages against the Front-End Checklist (380+ rules for accessibility, performance, SEO, security, HTML, CSS, JavaScript, images, i18n, privacy, testing) using the `frontendchecklist` CLI. Use when writing, reviewing, or shipping HTML/CSS/JS/JSX/TSX/Vue/Svelte/Astro code, before a commit or PR, or when asked to audit a public URL.
| File | Kind | Size |
|---|---|---|
| .gitignore | other | 6 B |
| README.md | markdown | 2.4 KB |
| SKILL.md | skill md | 2.7 KB |
| package.json | manifest | 1.5 KB |
| scripts/build.ts | script | 1.9 KB |
| src/args.ts | script | 5.5 KB |
| src/commands/audit.ts | script | 2.8 KB |
| src/commands/lookup.ts | script | 5.0 KB |
| src/commands/review.ts | script | 3.9 KB |
| src/content.ts | script | 1.5 KB |
| src/index.ts | script | 2.9 KB |
| src/output.ts | script | 3.3 KB |
| src/spec.ts | script | 5.1 KB |
| tests/cli.test.mjs | script | 4.6 KB |
| tsconfig.json | config | 202 B |
src/commands/audit.ts
View on GitHubimport { SITE_URL } from '@repo/config'
import { executeAuditUrl } from '@repo/mcp/tools'
import type { Rule } from '@repo/types'
import { type CliOptions, EXIT, meetsPriority, UsageError } from '../args'
import { type Finding, printFindings } from '../output'
/**
* Save an audit to the Front-End Checklist dashboard and return its public URL.
*
* @param url - Audited URL.
* @param payload - Audit result.
* @returns Report URL, or undefined when saving failed.
*/
async function saveReport(url: string, payload: unknown): Promise<string | undefined> {
const baseUrl = process.env.FRONTENDCHECKLIST_BASE_URL ?? SITE_URL
try {
const response = await fetch(`${baseUrl}/api/audits`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url, result: payload })
})
if (!response.ok) return undefined
const body: unknown = await response.json()
const publicId =
typeof body === 'object' && body !== null ? Reflect.get(body, 'publicId') : undefined
return typeof publicId === 'string' ? `${baseUrl}/en/report/${publicId}` : undefined
} catch {
return undefined
}
}
/**
* `frontendchecklist audit <url>` — fetch a public https page and review its HTML.
*
* @param options - Parsed CLI options.
* @param rules - Rule corpus.
* @returns Exit code.
*/
export async function runAudit(options: CliOptions, rules: Rule[]): Promise<number> {
const url = options.positionals[0]
if (!url)
throw new UsageError('audit needs a URL, e.g. `frontendchecklist audit https://example.com`')
const result = await executeAuditUrl(
{
url,
...(options.focus.length > 0 ? { focus: options.focus } : {}),
minPriority: options.minPriority
},
rules
)
if ('error' in result) throw new UsageError(result.error)
const findings: Finding[] = result.issues.map(issue => ({
target: result.source.url,
rule: issue.rule,
title: issue.title,
priority: issue.priority,
issue: issue.issue,
...(issue.fixPrompt ? { fix: issue.fixPrompt } : {})
}))
const failOn = options.failOn
const failing = failOn ? findings.filter(f => meetsPriority(f.priority, failOn)) : []
const reportUrl = options.save ? await saveReport(result.source.url, result) : undefined
if (options.save && !reportUrl)
process.stderr.write('Could not save the report to the dashboard.\n')
printFindings(options.format, `Front-End Checklist audit — ${result.source.url}`, findings, {
command: 'audit',
url: result.source.url,
summary: result.summary,
failOn: failOn ?? null,
failing: failing.length,
findings,
suggestions: result.suggestions,
...(reportUrl ? { reportUrl } : {})
})
if (reportUrl && options.format !== 'json') process.stderr.write(`Report saved: ${reportUrl}\n`)
return failing.length > 0 ? EXIT.violations : EXIT.ok
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |