npm v1.0.1

validate-ai-context

CLI tool that scans your JSX/TSX files for invalid useVyre component usage. Catches AI hallucinations — wrong prop values, non-existent props — before they ship to production.


Quick start

Run without installing — scans src/ by default:

npx @usevyre/validate-ai-context

Installation

npm install --save-dev @usevyre/validate-ai-context
# or
pnpm add -D @usevyre/validate-ai-context

Add to package.json scripts:

{
  "scripts": {
    "validate": "validate-ai-context src/"
  }
}

Usage

validate-ai-context [paths...] [options]

# Scan default src/ directory
validate-ai-context

# Scan specific directory or file
validate-ai-context src/components
validate-ai-context src/pages/dashboard.tsx

# Only show errors, suppress warnings
validate-ai-context --quiet

# Output as JSON (useful for CI parsing)
validate-ai-context --json

# Custom file extensions
validate-ai-context --ext=tsx,jsx

What it catches

Invalid enum values

Props with a defined set of valid values — catches typos and hallucinated variants:

// ❌ Error: 'xl' is not a valid value for Button size. Valid: sm, md, lg, icon
<Button size="xl">Submit</Button>

// ❌ Error: 'error' is not a valid value for Alert variant. Valid: info, success, warning, danger
<Alert variant="error">Something went wrong</Alert>

Hallucinated props

Props that don't exist on the component at all:

// ❌ Error: 'color' prop does not exist on Button → Use variant= instead
<Button color="blue">Click me</Button>

CI integration

Exits with code 1 if errors are found — works in any CI pipeline:

# .github/workflows/validate-ai.yml
name: Validate AI-generated code

on:
  pull_request:
    paths: ["**/*.tsx", "**/*.ts", "**/*.vue"]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v3
        with: { version: 9 }
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: pnpm }
      - run: pnpm install --frozen-lockfile
      - name: Validate useVyre props
        run: npx @usevyre/validate-ai-context src/ --json
# JSON output for custom reporting
validate-ai-context --json > validation-results.json

Exit codes

CodeMeaning
0No errors (warnings may still exist)
1One or more errors found