Skip to main content

Quick start

This guide will get you analyzing code with Vibrant in under 5 minutes.

Basic usage

1

Run Vibrant on your codebase

The simplest way to use Vibrant is to run it on your current directory:
npx vibrant-cli .
Or if you installed it globally:
vibrant .
Vibrant automatically detects TypeScript and JavaScript files in common source directories like src/, lib/, app/, etc.
2

Review the results

Vibrant will analyze your code and display any issues found:
๐Ÿ”ฎ Vibrant Analysis
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โœ” Analysis complete

โœ• src/api.ts:24:5
  โ””โ”€ hardcoded-credentials
     API key hardcoded in source code

     24|   const API_KEY = "sk-abc123...";

     โ†’ Use environment variables instead

โš  src/utils.ts:85:1
  โ””โ”€ empty-catch-block
     Empty catch block swallows errors

     85|   } catch (e) {}

     โ†’ Log or handle the error properly

โœ• 1 error ยท โš  1 warning ยท 48 files ยท 200ms
  • โœ• (red) indicates errors - critical issues that should be fixed
  • โš  (yellow) indicates warnings - issues that should be reviewed
3

Fix issues automatically (optional)

Some issues can be automatically fixed:
vibrant . --fix
This will fix issues like:
  • Removing console.log statements
  • Adding error handling to empty catch blocks
  • Other auto-fixable patterns
โœ“ fixed 5 issues

Analyze specific files or directories

You can target specific paths:
vibrant src/api.ts

Ignore files

Exclude certain files or directories from analysis:
vibrant . --ignore "dist,coverage,*.test.ts"
Or configure it in vibrant.config.js:
vibrant.config.js
module.exports = {
  ignore: ['node_modules', '.git', 'dist', '*.test.ts', 'coverage']
};

AI-powered analysis

AI analysis requires an API key. See the Installation guide for setup instructions.
Enable AI-powered deep analysis for more sophisticated pattern detection:
1

Set up your API key

Create a .env file in your project:
.env
OPENROUTER_API_KEY="sk-or-v1-..."
OpenRouter offers free models and is recommended for getting started. See Installation for other providers.
2

Run AI analysis

vibrant . --ai
Youโ€™ll see enhanced analysis with:
  • Overall code health assessment
  • Key findings and patterns
  • Actionable recommendations
3

Review AI insights

๐Ÿ”ฎ Vibrant Analysis
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โœ” Analysis complete

๐Ÿ” Issues Found

[... issues ...]

๐Ÿ“Š Diagnosis

The codebase shows signs of AI-generated code with
multiple hardcoded credentials and incomplete error
handling patterns.

โšก Key Findings

โ€ข 3 hardcoded API keys need to be moved to environment variables
โ€ข 5 empty catch blocks silently swallow errors
โ€ข 12 console.log statements should be removed

๐Ÿ’ก Recommendations

โ†’ Move all credentials to environment variables using dotenv
โ†’ Add proper error logging in catch blocks
โ†’ Remove debug console.log statements before production

โœ• 8 errors ยท โš  12 warnings ยท 48 files ยท 10.2s

Choose a specific AI provider

Use a different AI provider:
vibrant . --ai --provider openrouter

Output formats

Vibrant supports different output formats for different use cases:
Human-readable output with colors:
vibrant .
Best for: Interactive terminal usage

Common commands

List all detection rules

See all available rules Vibrant can detect:
vibrant rules
Output:
๐Ÿ“‹ Available Detection Rules

Security
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
hardcoded-credentials    Hardcoded API keys, passwords
no-sql-injection        SQL injection vulnerabilities
no-unsafe-inner-html    XSS via innerHTML

Bugs
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
empty-catch-block        Empty catch blocks
unimplemented-error     Unimplemented code
empty-function-body     Empty functions
[...]

View help

Get help on available commands and options:
vibrant --help

Check version

Display the installed version:
vibrant --version

Ignoring false positives

Sometimes you need to ignore specific lines:
// vibrant ignore
const debug = true;

CI/CD integration

Integrate Vibrant into your continuous integration pipeline:
name: Code Quality

on: [push, pull_request]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Run Vibrant
        run: npx vibrant-cli . --format compact
Vibrant exits with code 1 if errors are found, and 0 if no issues or only warnings. This integrates naturally with CI/CD systems.

Next steps

CLI reference

Complete reference for all commands and options

Detection rules

Learn about all the patterns Vibrant can detect

Configuration

Customize Vibrant for your project

AI providers

Deep dive into AI-powered analysis

Build docs developers (and LLMs) love