@bernierllc/validators-cli
v1.2.2
Published
Unified CLI interface for all BernierLLC validators
Downloads
17
Readme
@bernierllc/validators-cli
Unified CLI interface for all BernierLLC validators.
Installation
npm install -g @bernierllc/validators-cliOr use locally:
npm install --save-dev @bernierllc/validators-cliQuick Start
# Initialize configuration
bernier-validate init
# Run validation
bernier-validate run
# Run specific validator
bernier-validate run --validator html-syntax
# Watch mode
bernier-validate run --watch
# List available validators
bernier-validate list
# Describe validator
bernier-validate describe html-syntaxCommands
bernier-validate run [files...]
Run validation on files.
Options:
-v, --validator <name>- Run specific validator-c, --config <path>- Config file path-r, --reporter <type>- Output format (json, sarif, markdown, junit)-o, --output <path>- Output file path-w, --watch- Watch mode for continuous validation-p, --profile <name>- Validation profile (strict, standard, relaxed)--parallel <n>- Number of parallel validators (default: 4)--verbose- Verbose output
Examples:
# Validate all files
bernier-validate run
# Validate specific files
bernier-validate run src/**/*.html
# Use strict profile
bernier-validate run --profile strict
# Output to file
bernier-validate run --output validation-report.json
# SARIF output for GitHub Code Scanning
bernier-validate run --reporter sarif --output results.sarif
# Watch mode
bernier-validate run --watchbernier-validate fix [files...]
Auto-fix validation issues where possible.
Options:
-c, --config <path>- Config file path--verbose- Verbose output
Examples:
# Fix all files
bernier-validate fix
# Fix specific files
bernier-validate fix src/**/*.htmlbernier-validate list
List all available validators.
Examples:
bernier-validate listbernier-validate describe <validator>
Show detailed information about a validator.
Examples:
bernier-validate describe html-syntax
bernier-validate describe securitybernier-validate init
Initialize configuration file interactively.
Options:
--no-interactive- Skip interactive prompts
Examples:
# Interactive setup
bernier-validate init
# Non-interactive with defaults
bernier-validate init --no-interactiveConfiguration
Create a .validators.json file in your project root:
{
"profile": "standard",
"reporter": "json",
"parallel": 4,
"include": ["**/*.{html,css,js,ts,json}"],
"exclude": ["node_modules/**", "dist/**", "coverage/**"],
"validators": ["html-syntax", "css-syntax", "security"],
"rules": {
"html/syntax": "error",
"css/properties": "warning"
},
"waivers": [
{
"rule": "security/xss",
"reason": "Third-party library issue",
"owner": "[email protected]",
"expiry": "2025-12-31",
"patterns": ["vendor/**/*.js"]
}
]
}Configuration Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| profile | string | "standard" | Validation profile (strict, standard, relaxed) |
| reporter | string | "json" | Output format (json, sarif, markdown, junit) |
| parallel | number | 4 | Number of parallel validators |
| include | string[] | ["**/*.{html,css,js,ts,json}"] | File patterns to validate |
| exclude | string[] | ["node_modules/**", "dist/**"] | File patterns to exclude |
| validators | string[] | undefined | Specific validators to run |
| rules | object | {} | Rule-specific configuration |
| waivers | array | [] | Rule suppression with justification |
Profiles
Strict Profile
Maximum enforcement with zero tolerance:
- All validators enabled
- All rules set to error
- Zero error/warning thresholds
- Includes WCAG AAA accessibility rules
Standard Profile (Default)
Balanced validation:
- Core validators enabled
- Mix of error and warning rules
- Reasonable thresholds
- Includes WCAG AA accessibility rules
Relaxed Profile
Minimal validation for rapid development:
- Essential validators only
- Most rules set to warning
- Lenient thresholds
- Critical security rules only
Reporters
JSON Reporter
Standard JSON output with detailed results:
bernier-validate run --reporter jsonSARIF Reporter
GitHub Code Scanning compatible format:
bernier-validate run --reporter sarif --output results.sarifMarkdown Reporter
Human-readable reports:
bernier-validate run --reporter markdown --output report.mdJUnit Reporter
CI/CD test result format:
bernier-validate run --reporter junit --output test-results.xmlCI/CD Integration
GitHub Actions
name: Validate
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- run: npx bernier-validate run --reporter sarif --output results.sarif
- uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: results.sarifGitLab CI
validate:
stage: test
script:
- npm install
- npx bernier-validate run --reporter junit --output validation.xml
artifacts:
reports:
junit: validation.xmlPre-commit Hook
#!/bin/sh
npx bernier-validate run --profile strict $(git diff --cached --name-only --diff-filter=ACM)Watch Mode
Continuously validate files as they change:
bernier-validate run --watchFeatures:
- Real-time validation on file changes
- Incremental validation of modified files
- Console output with color coding
- Automatic re-validation on save
Integration Status
- Logger: not-applicable - CLI tool outputs directly to terminal. Logging handled by runner.
- Docs-Suite: ready - All commands documented with examples
- NeverHub: not-applicable - CLI tool for local/CI execution
API Usage
Use validators-cli programmatically:
import { createCLI, runCLI } from '@bernierllc/validators-cli';
// Create CLI instance
const program = createCLI();
// Run CLI programmatically
await runCLI();Dependencies
@bernierllc/validators-core- Core validator types@bernierllc/validators-runner- Validation orchestration@bernierllc/validators-reporters- Output formatting@bernierllc/validators-rulesets- Pre-configured rule bundlescommander- CLI frameworkchalk- Terminal colorsora- Loading spinnersinquirer- Interactive promptschokidar- File watching
License
Copyright (c) 2025 Bernier LLC. All rights reserved.
See LICENSE file for details.
See Also
- @bernierllc/validators-core - Core validator types
- @bernierllc/validators-runner - Validation runner
- @bernierllc/validators-reporters - Reporter implementations
- @bernierllc/validators-rulesets - Pre-configured rulesets
