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/review.ts
View on GitHubimport { readdirSync, readFileSync, statSync } from 'node:fs'
import path from 'node:path'
import { executeReviewCode } from '@repo/mcp/tools'
import type { Rule } from '@repo/types'
import { type CliOptions, EXIT, meetsPriority, UsageError } from '../args'
import { type Finding, printFindings } from '../output'
/** Files the static heuristics understand. */
const REVIEWABLE = new Set([
'.html',
'.htm',
'.jsx',
'.tsx',
'.js',
'.mjs',
'.ts',
'.vue',
'.svelte',
'.astro',
'.css',
'.scss'
])
const SKIPPED_DIRS = new Set([
'node_modules',
'.git',
'.next',
'dist',
'build',
'coverage',
'.turbo'
])
const MAX_FILE_BYTES = 1024 * 1024
/**
* Expand files and directories into reviewable file paths.
*
* @param target - File or directory path.
* @returns Reviewable files (directories are walked, vendor dirs skipped).
*/
function expandTarget(target: string): string[] {
let stats: ReturnType<typeof statSync>
try {
stats = statSync(target)
} catch {
throw new UsageError(`No such file or directory: ${target}`)
}
if (stats.isFile()) return [target]
return readdirSync(target, { withFileTypes: true }).flatMap(entry => {
const child = path.join(target, entry.name)
if (entry.isDirectory()) return SKIPPED_DIRS.has(entry.name) ? [] : expandTarget(child)
return REVIEWABLE.has(path.extname(entry.name)) ? [child] : []
})
}
/**
* Read all of stdin.
*
* @returns Stdin as text.
*/
async function readStdin(): Promise<string> {
const chunks: Buffer[] = []
for await (const chunk of process.stdin) {
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk)
}
return Buffer.concat(chunks).toString('utf-8')
}
/**
* Collect the sources to review: files/directories, or stdin for `-` / piped input.
*
* @param positionals - Paths from the command line.
* @returns Pairs of target label and source code.
*/
async function collectSources(
positionals: string[]
): Promise<Array<{ target: string; code: string }>> {
if (positionals.length === 0 || positionals[0] === '-') {
if (process.stdin.isTTY) {
throw new UsageError(
'review needs file/directory paths, or code on stdin (e.g. `git diff | frontendchecklist review -`)'
)
}
const code = await readStdin()
if (!code.trim()) throw new UsageError('No code received on stdin.')
return [{ target: 'stdin', code }]
}
return positionals
.flatMap(expandTarget)
.filter(file => statSync(file).size <= MAX_FILE_BYTES)
.map(file => ({ target: file, code: readFileSync(file, 'utf-8') }))
}
/**
* `frontendchecklist review <paths...|->` — static heuristic review of local code.
*
* @param options - Parsed CLI options.
* @param rules - Rule corpus.
* @returns Exit code.
*/
export async function runReview(options: CliOptions, rules: Rule[]): Promise<number> {
const sources = await collectSources(options.positionals)
const files = sources.map(({ target, code }) => {
const result = executeReviewCode(
{
code,
...(options.focus.length > 0 ? { focus: options.focus } : {}),
minPriority: options.minPriority
},
rules
)
return { target, ...result }
})
const findings: Finding[] = files.flatMap(file =>
file.issues.map(issue => ({
target: file.target,
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)) : []
printFindings(options.format, `Front-End Checklist review — ${files.length} file(s)`, findings, {
command: 'review',
files: files.length,
issues: findings.length,
failOn: failOn ?? null,
failing: failing.length,
findings
})
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: 472k | 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: 472k | 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: 472k | 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 |