Quality Commands

Run quality gates to ensure code meets standards.

Synopsis#

bootspring quality <gate> [options]

Gates#

GateDescriptionWhen to Use
pre-commitFast checksBefore every commit
pre-pushThorough checksBefore pushing
pre-deployComprehensive checksBefore deployment
fullAll checksManual validation

bootspring quality pre-commit#

Fast checks suitable for every commit.

Usage#

bootspring quality pre-commit [options]

Checks Included#

  • Linting (ESLint) - Code quality rules
  • Formatting (Prettier) - Code style
  • Types (TypeScript) - Type checking
  • Import sorting - Consistent imports

Options#

OptionDescription
--fixAuto-fix issues when possible
--files <paths>Check specific files
--verboseShow detailed output
--jsonOutput as JSON

Examples#

# Basic check bootspring quality pre-commit

Output:

Pre-commit Quality Gate ═══════════════════════════════════════════════════════════════════ ✓ Lint passed (1.2s) ✓ Format passed (0.4s) ✓ Types passed (2.1s) ✓ Imports passed (0.3s) ─────────────────────────────────────────────────────────────────── All checks passed (4.0s)
# Auto-fix issues bootspring quality pre-commit --fix

Output:

Pre-commit Quality Gate (auto-fix enabled) ═══════════════════════════════════════════════════════════════════ ✓ Lint passed (fixed 2 issues) ✓ Format passed (fixed 5 files) ✓ Types passed ✓ Imports passed (fixed 3 files) ─────────────────────────────────────────────────────────────────── All checks passed (4.2s) Fixed 10 issues automatically
# Check specific files bootspring quality pre-commit --files "src/components/Button.tsx,src/lib/utils.ts" # Verbose output bootspring quality pre-commit --verbose

bootspring quality pre-push#

More thorough checks before pushing.

Usage#

bootspring quality pre-push [options]

Checks Included#

  • All pre-commit checks
  • Unit tests - Run test suite
  • Coverage - Check coverage threshold
  • Build - Verify build succeeds
  • Bundle size - Check for regressions

Options#

OptionDescription
--skip-testsSkip test execution
--coverage <n>Override coverage threshold
--verboseShow detailed output

Examples#

# Basic check bootspring quality pre-push

Output:

Pre-push Quality Gate ═══════════════════════════════════════════════════════════════════ ✓ Lint passed (1.2s) ✓ Format passed (0.4s) ✓ Types passed (2.1s) ✓ Tests passed (45 tests, 8.3s) ✓ Coverage 85% (threshold: 80%) ✓ Build passed (12.4s) ─────────────────────────────────────────────────────────────────── All checks passed (24.4s)
# With coverage override bootspring quality pre-push --coverage 90

bootspring quality pre-deploy#

Comprehensive checks before deployment.

Usage#

bootspring quality pre-deploy [options]

Checks Included#

  • All pre-push checks
  • Integration tests - API and service tests
  • E2E tests - End-to-end tests
  • Security scan - Dependency vulnerabilities
  • Performance audit - Lighthouse metrics
  • Accessibility - a11y checks

Options#

OptionDescription
--skip-e2eSkip E2E tests
--skip-securitySkip security scan
--verboseShow detailed output

Examples#

bootspring quality pre-deploy

Output:

Pre-deploy Quality Gate ═══════════════════════════════════════════════════════════════════ ✓ Lint passed (1.2s) ✓ Format passed (0.4s) ✓ Types passed (2.1s) ✓ Unit Tests passed (45 tests) ✓ Coverage 85% ✓ Integration passed (12 tests) ✓ E2E Tests passed (8 scenarios) ✓ Security no vulnerabilities ✓ Performance score: 94/100 ✓ Accessibility passed (0 violations) ✓ Build passed ─────────────────────────────────────────────────────────────────── All checks passed (2m 34s) Ready for deployment

bootspring quality full#

Run all available checks.

Usage#

bootspring quality full [options]

Same as pre-deploy but includes additional checks like:

  • License compliance
  • Documentation coverage
  • Dead code detection
  • Complexity analysis

Handling Failures#

When checks fail:

Pre-commit Quality Gate ═══════════════════════════════════════════════════════════════════ ✓ Lint passed ✗ Format FAILED └── 3 files need formatting • src/components/Button.tsx • src/lib/utils.ts • src/hooks/useAuth.ts ✓ Types passed ─────────────────────────────────────────────────────────────────── Quality gate FAILED Fix with: bootspring quality pre-commit --fix

Auto-fix#

bootspring quality pre-commit --fix

Manual Fix#

For issues that can't be auto-fixed:

  1. Read the error details
  2. Fix the issues manually
  3. Re-run the check

Configuration#

Gate Settings#

1// bootspring.config.js 2module.exports = { 3 quality: { 4 preCommit: { 5 lint: true, 6 format: true, 7 types: true, 8 imports: true, 9 }, 10 prePush: { 11 tests: true, 12 coverage: 80, 13 build: true, 14 }, 15 preDeploy: { 16 e2e: true, 17 security: true, 18 performance: { 19 threshold: 90, 20 }, 21 accessibility: true, 22 }, 23 }, 24};

Custom Rules#

1module.exports = { 2 quality: { 3 lint: { 4 extends: ['eslint:recommended', 'next/core-web-vitals'], 5 rules: { 6 'no-console': 'warn', 7 'no-unused-vars': 'error', 8 }, 9 }, 10 format: { 11 printWidth: 100, 12 singleQuote: true, 13 trailingComma: 'es5', 14 }, 15 }, 16};

Custom Checks#

1module.exports = { 2 quality: { 3 customChecks: [ 4 { 5 name: 'no-todos', 6 description: 'No TODO comments', 7 pattern: /\/\/\s*TODO/i, 8 severity: 'warning', 9 }, 10 { 11 name: 'max-file-size', 12 check: async (file) => file.lines <= 500, 13 severity: 'warning', 14 message: 'File exceeds 500 lines', 15 }, 16 ], 17 }, 18};

Git Hooks Integration#

Using Husky#

1# Install husky 2npm install -D husky 3npx husky init 4 5# Add pre-commit hook 6echo 'npx bootspring quality pre-commit' > .husky/pre-commit 7 8# Add pre-push hook 9echo 'npx bootspring quality pre-push' > .husky/pre-push

Using lint-staged#

1// package.json 2{ 3 "lint-staged": { 4 "*.{ts,tsx}": "bootspring quality pre-commit --files" 5 } 6}

CI/CD Integration#

GitHub Actions#

1name: Quality Gates 2 3on: [push, pull_request] 4 5jobs: 6 quality: 7 runs-on: ubuntu-latest 8 steps: 9 - uses: actions/checkout@v4 10 - uses: actions/setup-node@v4 11 with: 12 node-version: '20' 13 cache: 'npm' 14 15 - run: npm ci 16 17 - name: Pre-deploy checks 18 run: npx bootspring quality pre-deploy